This commit is contained in:
Raven Scott
2026-05-20 23:48:59 -04:00
parent 8653b5b9c1
commit ac60c93151
22 changed files with 239 additions and 85 deletions
+119 -48
View File
@@ -1,62 +1,133 @@
# Holepunch / Bare / Pear Modules Workspace # Hyper-P2P module workspace
**152** production modules in **30** category directories. This directory is the **module library** for the repository: **152** independent npm packages for [Bare](https://github.com/holepunchto/bare) and Pear. Each package is a small, composable peer-to-peer primitive—discovery, messaging, storage, coordination, security, or application logic—built on shared Hyperswarm and Protomux conventions.
## Directory layout The parent repository adds cross-cutting guides under `docs/`, composition examples under `examples/`, and the unified test runner under `real_tests/`. Start at the [repository README](../README.md) for clone, CI, and top-level commands.
``` ## What a module is
modules/
├── MODULE_REGISTRY.yaml # source of truth Every package follows the same shape:
├── module-paths.json # name → category/path
├── MODULE_CATEGORIES.md # index with tier badges - **`index.js`** — public API (`HyperP2P…` class or factory), a versioned **protocol id** (e.g. `topic-channel/v1`), and optional swarm join when a `topic` is configured.
├── _shared/ # p2p-bare.js, MODULE_SYSTEM.md, DOC_STANDARDS.md - **`package.json`** — Bare runtime, `bare-*` / `hyper-*` dependencies, brittle-bare tests.
├── experimental/ # Wave 4 — 10 modules - **`test/`** — unit tests (load, API contracts, gossip paths where applicable).
├── experimental-wave5/ # Wave 5 — 6 modules - **`examples/`** — runnable minimal usage (typically `basic.js`).
├── network-stack/ # 10 - **`docs/`** — API reference and architecture (wire messages, state, composition).
├── core-infrastructure/ # 5 - **`README`** — when to use the module, quick start, and how it fits neighbors.
├── messaging-pubsub/ # 4
├── storage-hypercore/ # 7 Modules are **production** implementations: domain logic, structured errors, `getStats()` where relevant, and no generic key-value gossip stubs. Local-only utilities omit swarm setup; networked modules use `ready()` / `close()` around Hyperswarm lifecycle.
└── … # see MODULE_CATEGORIES.md
## Shared runtime
All networked modules lean on internal helpers in **`_shared/`**, especially `p2p-bare.js` (`initModuleSwarm`, `gossipSend`, topic encoding) and small libraries under `_shared/lib/`. Do not publish `_shared` as its own package—it is copied/imported by relative path from category trees.
Naming convention: **`hyper-p2p-<feature>`** (or `hyper-<pear-feature>` for Pear platform bridges). Protocol strings match the feature: `<feature>/v1` unless a module documents a minor revision (e.g. presence `v1.1`).
## How modules are grouped
Packages live under **30 functional categories** (one folder per category). Category folder names are stable ids (e.g. `messaging-pubsub`, `storage-hypercore`); they describe **what the code does**, not release history.
| Category | Count | Role |
|----------|------:|------|
| Core infrastructure | 5 | Presence, RPC, capabilities, sessions, vector clocks |
| Network stack | 10 | Handshake, pools, overlay, probes, anycast, congestion, bandwidth, shaping, multipath, circuits |
| Network discovery | 5 | Capabilities, health, bootstrap, seeders, topic announce |
| Network transport | 6 | Noise, relays, DHT hints, secret streams, UDX metrics, wakeup |
| Messaging pub/sub | 4 | Topic channels, QoS, retained messages, subscription leases |
| Messaging streams | 6 | Chunking, multiplex, backpressure, tee, transform, resume tokens |
| Messaging & gossip | 3 | Gossip mesh, event bus, deduplication |
| Routing & paths | 4 | Intent router, pattern router, relay tunnel, merge registry |
| Routing (advanced) | 5 | Circuit breaker, geo hints, load spread, retry, sticky session |
| Encoding & wire | 4 | Envelopes, codecs, schema validation, wire registry |
| Observability | 5 | Traces, metrics, logs, health probes, stats export |
| State & CRDTs | 10 | CRDT types, reactive state, conflict sets |
| Consensus & coordination | 5 | Locks, leases, quorum, Raft-lite, causal consensus |
| Scheduling & queues | 5 | Activity queue, peer scheduler, topic lease, cron, deadlines |
| Measurement & rate control | 4 | Token buckets, histograms, sketches, SLA budgets |
| Indexes & search | 8 | Bloom, fulltext, graph, inverted, vector, LSH, trie, spatial |
| Storage (Hypercore) | 7 | Replication, fetch, forks, merkle, audit, bitfield, seed policy |
| Storage (Hyperbee) | 5 | Batch write, diff follow, range watch, secondary index, tombstones |
| Storage (Hyperdrive) | 6 | Catalog, GC, mirror, mount bridge, snapshots, watch notify |
| Storage (Autobase) | 5 | Fork choice, indexer bus, light writer, view sync, writer lease |
| Trust & security | 8 | Trust graph, reputation, encryption, rotation, multisig, attestation |
| Agents & workflows | 3 | Agent memory, task orchestrator, workflow graph |
| Applications (collaboration) | 4 | Collab rooms, cursors, line locks, whiteboard ops |
| Applications (economy) | 3 | Auctions, credit ledger, marketplace listings |
| Experimental | 10 | Research primitives (entropy, trails, capsules, whispers, …) |
| Experimental (extended) | 6 | Void channels, memetic spread, tension fields, phase clocks, … |
| Pear / Bare platform | 4 | Bundles, distributables, Pear runtime session, update gossip |
| Oracles | 1 | Decentralized oracle gossip |
| Time & ordering | 1 | Temporal index |
**152** modules total. The authoritative list with protocol ids and paths is in **`MODULE_REGISTRY.yaml`**; **`module-paths.json`** maps package name → category path for tooling and tests.
For a per-module index with protocol ids, use **`MODULE_CATEGORIES.md`** in this directory.
## Typical stack (conceptual)
Most networked apps compose layers rather than importing everything:
```text
Application (collab, economy, agents, …)
Messaging (pub/sub, streams, gossip) + Encoding (envelopes, codecs)
Routing + Network stack (handshake → pool → overlay → probes → egress)
Discovery + Transport (bootstrap, noise, relays)
Hyperswarm topic + Protomux channels
Optional: Storage (Hypercore / Hyperbee / Hyperdrive / Autobase), CRDTs, consensus
``` ```
Experimental hub (required reading for Wave 4/5): [`../docs/experimental/README.md`](../docs/experimental/README.md). Reference compositions live under `examples/` (network stack demo, full messaging/collab stack, encoding stack). See the examples index at the repository root.
Each module: `modules/<category>/<name>/` with `index.js`, `test/`, `examples/basic.js`, `docs/api.md`, `docs/architecture.md`, `README.md`. Topic guides for large categories (network stack, experimental) are under `docs/` at the repository root.
## Tiers ## Working on one module
All **152** modules are **production** (`0.3.x+`) with domain `index.js` and production tests.
| Command | Scope |
|---------|--------|
| `./real_tests/run-all.sh --tier=production` | 152 modules (default) |
| `./real_tests/run-all.sh --tier=all` | Same 152 (alias) |
See [`_shared/MODULE_SYSTEM.md`](_shared/MODULE_SYSTEM.md).
## Testing
- **Unit:** [`../real_tests/run-all.sh`](../real_tests/run-all.sh) — 152 modules
- **Integration:** [`../real_tests/run-integration.sh`](../real_tests/run-integration.sh)
- **Categories:** [`MODULE_CATEGORIES.md`](MODULE_CATEGORIES.md)
- **Experimental:** [`experimental/README.md`](experimental/README.md), [`experimental-wave5/README.md`](experimental-wave5/README.md)
## Tooling
```bash ```bash
python3 ../scripts/docs-deepen.py --module <name> # optional helper, one module cd modules/<category>/<package-name>
../scripts/check-docs-quality.sh # strict quality gate npm install
./scripts/run-wave9-gates.sh # Wave 9 subset npm test
``` ```
Prefer **manual** doc edits per [`_shared/DOC_STANDARDS.md`](_shared/DOC_STANDARDS.md) and [`../MODULE_DOC_PASS.md`](../MODULE_DOC_PASS.md). Run from the repository root to exercise the full library:
## Composition demos ```bash
./real_tests/run-all.sh --tier=production # all 152 unit tests
INTEGRATION_TIMEOUT=120 ./real_tests/run-integration.sh
```
| Demo | Path | Integration tests spin up two-node Hyperswarm scenarios for modules that define them under `real_tests/integration/`.
|------|------|
| Network stack | [`../examples/p2p-network-stack-demo/`](../examples/p2p-network-stack-demo/) |
| Wave 9 full stack | [`../examples/wave9-full-stack/`](../examples/wave9-full-stack/) |
| Wave 9 encoding | [`../examples/wave9-encoding-stack/`](../examples/wave9-encoding-stack/) |
See [`../examples/README.md`](../examples/README.md). ## Adding or locating a package
1. Find the functional area in the table above (or search `MODULE_REGISTRY.yaml`).
2. Open the package directory under `modules/<category>/<package-name>/`.
3. Read its README and run `examples/basic.js` with `bare` where documented.
New modules should register in **`MODULE_REGISTRY.yaml`**, add an entry to **`module-paths.json`**, extend **`MODULE_CATEGORIES.md`**, and match existing patterns in `_shared/` and sibling packages in the same category.
## Quality expectations
- **API** — Documented constructor options, methods, events, and thrown errors aligned with `index.js`.
- **Wire** — Architecture docs list gossip / Protomux message types and fields.
- **Tests** — Pass under `real_tests/run-all.sh` for the production tier.
- **Composition** — README states which neighbors to pair with (not only “uses Hyperswarm”).
Optional repository scripts can regenerate scaffolding from the registry; **semantic** documentation and behavior are maintained by hand from source.
## Related material
| Location | Contents |
|----------|----------|
| [Repository root](../README.md) | Install, global test commands, layout |
| [Development guide](../DEVELOPMENT.md) | Bare import rules, conventions, checklists |
| [Module categories](./MODULE_CATEGORIES.md) | Full index of all 152 packages |
| [Registry](./MODULE_REGISTRY.yaml) | Machine-readable metadata |
| [Examples](../examples/) | Multi-module demos |
| [Tests](../real_tests/) | `run-all.sh`, integration smokes |
This workspace is the **source of truth for package code**. Treat each `hyper-p2p-*` directory as a focused library you can depend on, extend, or compose in larger Pear/Bare systems.
+1 -1
View File
@@ -1,6 +1,6 @@
# Documentation standards (exhaustive) # Documentation standards (exhaustive)
All **152** modules and hub docs follow these rules. Hub files that must stay in sync on doc passes: root [`README.md`](../../README.md), [`docs/experimental/README.md`](../../docs/experimental/README.md), [`modules/experimental/README.md`](../experimental/README.md), [`modules/experimental-wave5/README.md`](../experimental-wave5/README.md). Source of truth: `index.js` + [`p2p-bare.js`](p2p-bare.js). All **152** modules and hub docs follow these rules. Hub files that must stay in sync on doc passes: root [`README.md`](../../README.md), [`docs/network-stack/README.md`](../../docs/network-stack/README.md), [`modules/network-stack/README.md`](../network-stack/README.md), [`docs/experimental/README.md`](../../docs/experimental/README.md), [`modules/experimental/README.md`](../experimental/README.md), [`modules/experimental-wave5/README.md`](../experimental-wave5/README.md). Source of truth: `index.js` + [`p2p-bare.js`](p2p-bare.js).
Regenerate module docs: Regenerate module docs:
+76 -12
View File
@@ -1,16 +1,80 @@
# Network stack # Network stack
**Path:** `modules/network-stack/` · **Modules:** 10 (10 production, 0 scaffold) **Path:** `modules/network-stack/` · **Modules:** 10 (all production, Wave 6)
See [MODULE_CATEGORIES.md](../MODULE_CATEGORIES.md#network-stack). Layered P2P networking over Hyperswarm: handshake → pool → overlay → probes → anycast → congestion → bandwidth → shaping → multipath → circuits. Full hub: [`../../docs/network-stack/README.md`](../../docs/network-stack/README.md).
- [hyper-p2p-anycast-selector](./hyper-p2p-anycast-selector/) — production See [MODULE_CATEGORIES.md](../MODULE_CATEGORIES.md#network-stack-network-stack--10-modules) and composition layers in [`../_shared/WAVE6_NETWORK_STACK.md`](../_shared/WAVE6_NETWORK_STACK.md).
- [hyper-p2p-bandwidth-broker](./hyper-p2p-bandwidth-broker/) — production
- [hyper-p2p-circuit-loom](./hyper-p2p-circuit-loom/) — production ## When to use
- [hyper-p2p-congestion-signal](./hyper-p2p-congestion-signal/) — production
- [hyper-p2p-connection-pool](./hyper-p2p-connection-pool/) — production Composing multiple network concerns on one topic (see [`../../examples/p2p-network-stack-demo/`](../../examples/p2p-network-stack-demo/)). Use individual modules when you only need one concern (e.g. only `link-probe` for RTT matrix).
- [hyper-p2p-flow-shaper](./hyper-p2p-flow-shaper/) — production
- [hyper-p2p-link-probe](./hyper-p2p-link-probe/) — production ## When not to use
- [hyper-p2p-multipath-fanout](./hyper-p2p-multipath-fanout/) — production
- [hyper-p2p-overlay-topology](./hyper-p2p-overlay-topology/) — production Simple pub/sub or RPC-only apps — use `messaging-pubsub` or `core-infrastructure/hyper-p2p-rpc` without pulling the full stack.
- [hyper-p2p-protocol-handshake](./hyper-p2p-protocol-handshake/) — production
## Quick start
```bash
bare ../../examples/p2p-network-stack-demo/demo.js
```
```js
const { HyperP2PProtocolHandshake } = require('hyper-p2p-protocol-handshake')
const { HyperP2POverlayTopology } = require('hyper-p2p-overlay-topology')
const hs = new HyperP2PProtocolHandshake()
const offerId = hs.offer({ json: true })
hs.accept(offerId)
const topo = new HyperP2POverlayTopology({ maxDegree: 8 })
topo.addNeighbor('peer-a', 1)
```
## Docs — modules by layer
### Layer 1 — Session & topology
| Module | Protocol | Summary |
|--------|----------|---------|
| [hyper-p2p-protocol-handshake](./hyper-p2p-protocol-handshake/) | `protocol-handshake/v1` | `offer` / `accept` / `reject` feature negotiation |
| [hyper-p2p-connection-pool](./hyper-p2p-connection-pool/) | `connection-pool/v1` | `acquire` / `release` lanes, idle sweep |
| [hyper-p2p-overlay-topology](./hyper-p2p-overlay-topology/) | `overlay-topology/v1` | Weighted neighbor graph |
### Layer 2 — Measurement & routing
| Module | Protocol | Summary |
|--------|----------|---------|
| [hyper-p2p-link-probe](./hyper-p2p-link-probe/) | `link-probe/v1` | `probe` / `pong` RTT metrics |
| [hyper-p2p-anycast-selector](./hyper-p2p-anycast-selector/) | `anycast-selector/v1` | Capability + lowest-latency `resolve` |
| [hyper-p2p-congestion-signal](./hyper-p2p-congestion-signal/) | `congestion-signal/v1` | RTT/loss samples, `shouldThrottle` |
### Layer 3 — Capacity & egress
| Module | Protocol | Summary |
|--------|----------|---------|
| [hyper-p2p-bandwidth-broker](./hyper-p2p-bandwidth-broker/) | `bandwidth-broker/v1` | `grant` / `consume` byte credits |
| [hyper-p2p-flow-shaper](./hyper-p2p-flow-shaper/) | `flow-shaper/v1` | Priority `enqueue` / `drain` |
| [hyper-p2p-multipath-fanout](./hyper-p2p-multipath-fanout/) | `multipath-fanout/v1` | `fanout` shards + `reassemble` |
### Layer 4 — Circuits
| Module | Protocol | Summary |
|--------|----------|---------|
| [hyper-p2p-circuit-loom](./hyper-p2p-circuit-loom/) | `circuit-loom/v1` | `buildCircuit`, `extend`, `relay`, `teardown` |
## Test
```bash
# Full stack demo (no swarm required)
bare ../../examples/p2p-network-stack-demo/demo.js
# Per module
cd hyper-p2p-protocol-handshake && npm install && npm test
# All 152 production modules
../../real_tests/run-all.sh --tier=production
```
## Composition
Pairs with [`hyper-p2p-relay-tunnel`](../routing-paths/hyper-p2p-relay-tunnel/) and [`hyper-p2p-gossip-mesh`](../messaging-gossip/hyper-p2p-gossip-mesh/) in the demo. Diagram: [`docs/network-stack/README.md`](../../docs/network-stack/README.md).
@@ -1,6 +1,6 @@
# hyper-p2p-anycast-selector # hyper-p2p-anycast-selector
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Anycast by capability tag — `registerCapability`, `updateLatency`, and `resolve(tag)` to pick the lowest-latency peer.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Maps capability tags to peer candidates and latency samples; `resolve(tag)` returns the best peer for edge/relay roles. Consumes `link-probe` metrics when available.
## Constructor ## Constructor
@@ -1,6 +1,6 @@
# hyper-p2p-bandwidth-broker # hyper-p2p-bandwidth-broker
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Inter-peer send credits — `grant`, `consume`, `request`, and `balance` for bandwidth allocation across the mesh.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Byte credit ledger per peer: grant capacity, consume on send, and request additional quota via gossip. Use before high-volume `multipath-fanout` egress.
## Constructor ## Constructor
@@ -1,6 +1,6 @@
# hyper-p2p-circuit-loom # hyper-p2p-circuit-loom
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Multi-hop overlay circuits — `buildCircuit`, `extend`, `relay`, `teardown`, and `rotateKeys` with CREATE/EXTEND/RELAY/DESTROY gossip (Tier A docs).
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -1,6 +1,6 @@
# hyper-p2p-congestion-signal # hyper-p2p-congestion-signal
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Congestion hints from RTT/loss — `reportSample`, `getHint`, and `shouldThrottle` for adaptive send rates.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Gossiped RTT and packet-loss samples per peer; exposes throttle hints for senders. Pairs with `bucket-rate-limit` and `flow-shaper` in full stacks.
## Constructor ## Constructor
@@ -1,6 +1,6 @@
# hyper-p2p-connection-pool # hyper-p2p-connection-pool
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Warm peer connection lanes — `acquire(peerId)`, `release(peerId)`, idle sweep via `setIdleTimeout`, and pool stats for stack demos.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. In-memory (and gossiped) connection pool tracking which peers are in use, last activity, and idle teardown. Pair with `protocol-handshake` before mux traffic.
## Constructor ## Constructor
@@ -1,6 +1,6 @@
# hyper-p2p-flow-shaper # hyper-p2p-flow-shaper
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Priority egress queues — `enqueue(priority, payload)`, token `setRates`, and `drain()` for control vs data traffic.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Multi-priority outbound queue with configurable token refill rates. `drain()` emits shaped traffic; pairs with `intent-router` and congestion hints.
## Constructor ## Constructor
+3 -1
View File
@@ -1,6 +1,6 @@
# hyper-p2p-link-probe # hyper-p2p-link-probe
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Link RTT measurement — `probe(peerId)`, `pong(peerId, sentAt)`, `getMetrics`, and `publishMatrix` for routing inputs.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Builds per-peer RTT/jitter metrics via probe/pong gossip. `publishMatrix` shares the matrix for `anycast-selector` and congestion modules.
## Constructor ## Constructor
@@ -1,6 +1,6 @@
# hyper-p2p-multipath-fanout # hyper-p2p-multipath-fanout
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Multipath striping — `fanout(payload, pathCount)`, `onShard`, and `reassemble(msgId)` for redundant paths.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Splits payloads into numbered shards across paths, gossips shards to peers, and reassembles by `msgId`. Use after `flow-shaper` and with `relay-tunnel` in demos.
## Constructor ## Constructor
@@ -1,6 +1,6 @@
# hyper-p2p-overlay-topology # hyper-p2p-overlay-topology
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Explicit overlay neighbor graph — weighted `addNeighbor` / `removeNeighbor`, `getNeighbors`, and `suggestReplacement` when a peer fails.
**Category:** Network stack **Category:** Network stack
@@ -29,6 +29,8 @@ await mod.close()
## Docs ## Docs
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- [docs/api.md](docs/api.md) — constructor, methods, events, errors - [docs/api.md](docs/api.md) — constructor, methods, events, errors
- [docs/architecture.md](docs/architecture.md) — wire types, state, composition - [docs/architecture.md](docs/architecture.md) — wire types, state, composition
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Maintains a degree-bounded neighbor map with weights, gossips topology updates, and suggests replacements for failed peers. Feeds `circuit-loom` hop selection.
## Constructor ## Constructor
@@ -1,6 +1,6 @@
# hyper-p2p-protocol-handshake # hyper-p2p-protocol-handshake
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Protocol version and feature negotiation — `offer()`, `accept()`, `reject()`, and `getAgreed(peerId)` before app traffic on a topic.
**Category:** Network stack **Category:** Network stack
@@ -20,11 +20,10 @@ Single-process tools with no P2P topic (use local APIs only or skip `ready()`).
```js ```js
const { HyperP2PProtocolHandshake } = require('hyper-p2p-protocol-handshake') const { HyperP2PProtocolHandshake } = require('hyper-p2p-protocol-handshake')
const topic = process.argv[2] // 64-char hex or string const hs = new HyperP2PProtocolHandshake()
const mod = new HyperP2PProtocolHandshake({ topic, enableBackgroundTimers: false }) const offerId = hs.offer({ stack: 'wave6', json: true })
await mod.ready() // joins swarm when topic set hs.accept(offerId)
// ... application logic ... console.log(hs.getAgreed('local'))
await mod.close()
``` ```
## Docs ## Docs
@@ -34,6 +33,8 @@ await mod.close()
- [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist - [../_shared/PRODUCTION.md](../../_shared/PRODUCTION.md) — production checklist
- [../_shared/DOC_STANDARDS.md](../../_shared/DOC_STANDARDS.md) — documentation standards - [../_shared/DOC_STANDARDS.md](../../_shared/DOC_STANDARDS.md) — documentation standards
- [Category hub](../../docs/network-stack/README.md) — Wave 6 stack index
- [Stack demo](../../examples/p2p-network-stack-demo/)
- Integration: [`../../real_tests/integration/`](../../../real_tests/integration/) — `protocol-handshake-two-node.js` - Integration: [`../../real_tests/integration/`](../../../real_tests/integration/) — `protocol-handshake-two-node.js`
## Test ## Test
@@ -6,7 +6,7 @@
## Overview ## Overview
Production network stack module: Hyperswarm discovery + Protomux when `topic` is set. Pre-mux handshake: peers exchange feature offers, accept or reject, and record agreed capability sets. Works locally without `topic`; gossips offers when swarm is joined.
## Constructor ## Constructor