Expand category docs and module APIs across the library.

Manual pass adds helpers (listChannels, taskCounts, openProposals), richer getStats with protocol fields, category README hubs, and tightened api.md for core, messaging, network, routing, supercomputer, and consensus modules.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-21 00:54:19 -04:00
co-authored by Cursor
parent e67097f62b
commit 17876e6284
75 changed files with 1534 additions and 2462 deletions
@@ -4,7 +4,7 @@
## Overview
Gossip registry of peer CPU, RAM, GPU, disk, and bandwidth capacity.
`HyperP2PCapacityRegistry` — P2P module. See [`README.md`](../README.md) and [`architecture.md`](architecture.md).
## Constructor
@@ -14,20 +14,66 @@ const mod = new HyperP2PCapacityRegistry(opts)
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `topic` | Buffer \| string \| null | `null` | Hyperswarm topic |
| `topic` | Buffer \| string \| null | `null` | Hyperswarm topic; omit for local-only |
| `keyPair` | KeyPair | random | Discovery identity |
## Methods
See [`index.js`](../index.js) for the full method list. All modules implement `getStats()`, `async ready()`, and `async close()`.
### `advertise(...)`
## getStats()
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
Returns `{ ...stats, protocol: 'capacity-registry/v1' }` plus module-specific counters.
### `lookup(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `listPeers(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `listPeerIds(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `meetsRequirements(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `exportClusterView(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `clusterTotals(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `bestMatch(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `merge(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `toJSON(...)`
Public API on `HyperP2PCapacityRegistry`. See [`index.js`](../index.js) for parameters and return types.
### `getStats() → object`
Metrics plus `protocol: 'capacity-registry/v1'`.
### `async ready()`
Joins Hyperswarm when `topic` is set; opens Protomux channel.
### `async close()`
Tears down swarm and clears local state; emits `closed` where applicable.
## P2P
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux `capacity-registry/v1`.
Gossip / sync over Protomux `capacity-registry/v1` when `topic` is configured.
## Testing