# Tasks — network-suite ## Phase 1: Core - [ ] 1.1 Implement `network-core` — `@suaveplan/network` core interfaces. - [ ] 1.2 Implement `network-plugin-webrtc` — WebRTC transport plugin. ## Phase 2: Governance & Failover - [ ] 2.1 Implement `network-plugin-governance` — elections, scoring, voting, transitions. - [ ] 2.2 Implement `network-plugin-failover` — heartbeat, health, failover. ## Phase 3: Registry, Topology & Sessions - [ ] 3.1 Implement `network-plugin-registry` — fixed-capacity registry, binary encoder. - [ ] 3.2 Implement `network-plugin-topology` — tiered hierarchy, latency groups. - [ ] 3.3 Implement `network-plugin-session` — logical sessions, nested hierarchies, session-scoped routing. ## Phase 4: Protocol, Transport Manager & Crypto - [ ] 4.1 Implement `network-plugin-protocol` — 13-byte header, pipeline. - [ ] 4.2 Implement `network-plugin-transport-manager` — multi-transport, priority, round-robin. - [ ] 4.3 Implement `network-plugin-crypto-messages` — signed messages, server tokens, identity. ## Phase 5: Server Bridge, Content Delivery & Audit - [ ] 5.1 Implement `network-plugin-server-bridge` — server gateway, offline mode, reconciliation. - [ ] 5.2 Implement `network-plugin-content-delivery` — P2P chunk distribution, redundancy, prefetch. - [ ] 5.3 Implement `network-plugin-audit-mesh` — signed logs, replication, compaction, conflict resolution. ## Phase 6: Integration & End-to-End - [ ] 6.1 Integration test: all 13 packages together. - [ ] 6.2 End-to-end test: 3-node mesh, election, host failure, failover, re-election. - [ ] 6.3 Session test: 30-peer free-roam, 4-peer mission, 2-peer phase, join/leave/move. - [ ] 6.4 Offline resilience test: server disconnects, mesh continues, server reconnects, logs reconcile. - [ ] 6.5 Content delivery test: pack file, distribute chunks, verify redundancy, fetch from nearest peer. - [ ] 6.6 Crypto test: forge session token (rejected), spoof peer (rejected), verify all signatures. - [ ] 6.7 Transport test: WebRTC fails, fallback to WebSocket, CRITICAL redundant delivery. - [ ] 6.8 Performance test: 32-peer registry, 1000 messages, latency < 10ms local. ## Phase 7: Verification - [ ] 7.1 All 13 packages pass `bunx turbo lint typecheck test`. - [ ] 7.2 All 13 packages reach 100/100/100/100 coverage. - [ ] 7.3 All 13 packages pass `bun scripts/openspec-conformance.ts`. - [ ] 7.4 `bun run gate` (root) is green. ## Pre-archive checklist - [ ] Row 1 — Verified by: `bunx turbo lint typecheck test --filter='@suaveplan/network*'` green. - [ ] Row 2 — Verified by: `bunx turbo test:coverage --filter='@suaveplan/network*'` 100/100/100/100. - [ ] Row 3 — Verified by: `bun scripts/openspec-conformance.ts @suaveplan/network` and all plugins PASS. - [ ] Row 4 — Verified by: All `Verified by:` lines in child proposals are filled. - [ ] Row 5 — Verified by: Root `bun run gate` green. - [ ] Row 6 — Verified by: No stubs used — `CryptoTransform`, `compressStream`, `lengthPrefixEncode/Decode` from `@suaveplan/streams`. - [ ] Row 7 — Verified by: Integration and end-to-end tests pass. - [ ] Row 8 — Verified by: Offline resilience test passes — server disconnect, autonomous operation, reconnection, reconciliation. - [ ] Row 9 — Verified by: Crypto integrity test passes — forged tokens rejected, spoofed peers rejected, all signatures verified. - [ ] Row 10 — Verified by: Content delivery test passes — chunk distribution, redundancy, integrity, prefetch.