Initial Commit
This commit is contained in:
@@ -0,0 +1,72 @@
|
||||
# Tasks — network-plugin-webrtc
|
||||
|
||||
> Blocked on: `network-core`.
|
||||
|
||||
## 1. Scaffold
|
||||
|
||||
- [x] 1.1 `packages/network/network-plugin-webrtc/` with `package.json` (`@suaveplan/network-plugin-webrtc@0.0.0`), `tsconfig.json`, `vitest.config.ts`, `README.md`.
|
||||
- [x] 1.2 Workspace deps: `@suaveplan/network`, `@suaveplan/error`, `@suaveplan/types`, `@suaveplan/events`, `@suaveplan/streams`, `@suaveplan/timing`, `@opentelemetry/api`, `zod`.
|
||||
- [x] 1.3 `sideEffects: false`.
|
||||
|
||||
## 2. Types
|
||||
|
||||
- [x] 2.1 `src/types/signaling.types.ts` — `SignalingClient`, `SignalingMessage`, `SignalType`.
|
||||
- [x] 2.2 `src/types/webrtc.types.ts` — `WebRTCConfig`, `PeerConnectionState`, `DataChannelConfig`.
|
||||
- [x] 2.3 `src/types/ping.types.ts` — `PingFrame`, `PongFrame`, `LatencyRecord`.
|
||||
- [x] 2.4 `src/error-codes.ts` — `defineCodes("NET_WEBRTC", [...])`.
|
||||
|
||||
## 3. Signaling
|
||||
|
||||
- [x] 3.1 `src/signaling/signaling-client.ts` — `SignalingClient` interface.
|
||||
- [x] 3.2 `src/signaling/websocket-signaling-client.ts` — WebSocket implementation with reconnect.
|
||||
|
||||
## 4. ICE management
|
||||
|
||||
- [x] 4.1 `src/ice/ice-manager.ts` — monitors `iceConnectionState`, triggers restart on `failed`.
|
||||
- [x] 4.2 Configurable `iceServers` (STUN + TURN).
|
||||
|
||||
## 5. Data channel
|
||||
|
||||
- [x] 5.1 `src/data-channel/data-channel-manager.ts` — open/close channels, `bufferedAmount` backpressure.
|
||||
- [x] 5.2 Emits `Uint8Array` messages on the bus.
|
||||
|
||||
## 6. Transport implementation
|
||||
|
||||
- [x] 6.1 `src/transport/webrtc-transport.ts` — implements `Transport`: `connect`, `disconnect`, `send`, `onMessage`, `getConnectedPeers`.
|
||||
- [x] 6.2 Manages one `RTCPeerConnection` per peer.
|
||||
|
||||
## 7. Mesh
|
||||
|
||||
- [x] 7.1 `src/mesh/webrtc-mesh.ts` — auto-connects to discovered peers, maintains full-mesh.
|
||||
- [x] 7.2 Removes peers on disconnect or heartbeat timeout.
|
||||
|
||||
## 8. Ping / latency
|
||||
|
||||
- [x] 8.1 `src/ping/ping-manager.ts` — correlated echo frames, RTT measurement.
|
||||
- [x] 8.2 EMA smoothing with configurable window.
|
||||
- [x] 8.3 Publishes `peer:latency` on `NetworkBus`.
|
||||
|
||||
## 9. Plugin wrapper
|
||||
|
||||
- [x] 9.1 `src/plugin/webrtc-plugin.ts` — `WebRTCPlugin` implements `NetworkPlugin`.
|
||||
- [x] 9.2 Registers itself as a transport with the node on `install()`.
|
||||
|
||||
## 10. Spec
|
||||
|
||||
- [x] 10.1 Update `openspec/specs/network/spec.md` with `NET-06`, `NET-07`.
|
||||
|
||||
## 11. Conformance tests
|
||||
|
||||
- [x] 11.1 `src/transport/transport.spec-conformance.test.ts` — `Transport` compliance.
|
||||
- [x] 11.2 `src/mesh/mesh.spec-conformance.test.ts` — auto-connect, full-mesh, removal.
|
||||
- [x] 11.3 `src/ping/ping.spec-conformance.test.ts` — echo, RTT, EMA.
|
||||
- [x] 11.4 `src/ice/ice.spec-conformance.test.ts` — restart on failure.
|
||||
- [x] 11.5 `src/signaling/signaling.spec-conformance.test.ts` — interface, WebSocket impl.
|
||||
- [x] 11.6 `src/backpressure/backpressure.spec-conformance.test.ts` — bufferedAmount pause.
|
||||
- [x] 11.7 `src/error-codes.spec-conformance.test.ts` — frozen registry.
|
||||
|
||||
## 12. Verify
|
||||
|
||||
- [x] 12.1 `bunx turbo lint typecheck test --filter=@suaveplan/network-plugin-webrtc` green.
|
||||
- [x] 12.2 `bunx turbo test:coverage --filter=@suaveplan/network-plugin-webrtc` 100/100/100/100.
|
||||
- [x] 12.3 `bun scripts/openspec-conformance.ts @suaveplan/network-plugin-webrtc` PASS.
|
||||
Reference in New Issue
Block a user