Add new features across streams, wire, network, scheduling, and supercomputer.

Manual feature pass: stream tee drain APIs, resume prune/checkpoints, transform compose/flush, wire pickBest and framed codec bridge, congestion analytics, bandwidth transfer, deadline extend, bloom union, time-capsule revoke, capacity findByTag/removePeer, cluster removeNode/listReservations, retry jitterDelay — each with tests and api docs.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 01:01:40 -04:00
co-authored by Cursor
parent c294123234
commit cb9caad46c
29 changed files with 399 additions and 218 deletions
@@ -1,82 +1,19 @@
# API: hyper-p2p-stream-tee
**Protocol:** `stream-tee/v1` (local fan-out)
**Export:** `HyperP2PStreamTee`, `PROTOCOL`
## Overview
Fan-out `write(chunk)` to named branches, each with its own FIFO chunk queue. Useful for teeing one ingress stream to logging and processing paths.
**Protocol:** `stream-tee/v1`
## Methods
### `addBranch(name)`
### `addBranch(name) → unsubscribe`
- **Returns:** unsubscribe function
- **Throws:** `branch name required`
### `write(chunk)` — fan-out to all branches
### `write(chunk)` / `readBranch(name)` / `pending(name)`
### `readBranch(name)` / `pending(name)`
### `getStats()` / `ready()` / `close()`
### `listBranches()` / `hasBranch(name)`
## Events
### `drainBranch(name) → Buffer[]` — flush one branch queue
`data` on every write.
### `drainAll() → { [name]: Buffer[] }`
## Wire
None.
## Composition
`hyper-p2p-stream-transform`, `hyper-p2p-stream-chunker`.
## Testing
`npm test`
## Example
`examples/basic.js`
## State model
Each branch stores chunk array; `write` duplicates buffer reference to all branches.
## Performance
Memory multiplies by branch count × queued chunks.
## Versioning
Local-only `stream-tee/v1` id.
## Security
Branches share buffer references; treat as trusted in-process only.
## Related modules
- `hyper-p2p-stream-transform` — per-branch mapping
## Changelog
- Scaffold and flagship passes: local tee for stream pipeline examples and integration tests.
- `addBranch` returns unsubscribe to drop a branch without closing tee.
## Integration checklist
1. `addBranch('audit')` and `addBranch('process')`.
2. `write(chunk)` fans out to both queues.
3. `readBranch('process')` consumes on worker tick.
4. `close()` clears all branches on shutdown.
5. Use `pending(name)` to detect backlog before applying backpressure upstream.
6. Monitor `getStats().written` vs branch `pending` for imbalance.
## Changelog
- Initial production release with branch fan-out and per-branch FIFO queues.
## See also
[`docs/architecture.md`](architecture.md)
### `getStats()` / `async close()`