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
@@ -0,0 +1,58 @@
# API: hyper-p2p-compute-shard
**Protocol:** `compute-shard/v1` · **Export:** `HyperP2PComputeShard`
## Overview
`HyperP2PComputeShard` — P2P module. See [`README.md`](../README.md) and [`architecture.md`](architecture.md).
## Constructor
```js
const mod = new HyperP2PComputeShard(opts)
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `topic` | Buffer \| string \| null | `null` | Hyperswarm topic; omit for local-only |
| `keyPair` | KeyPair | random | Discovery identity |
## Methods
### `shardWorkload(...)`
Public API on `HyperP2PComputeShard`. See [`index.js`](../index.js) for parameters and return types.
### `completeShard(...)`
Public API on `HyperP2PComputeShard`. See [`index.js`](../index.js) for parameters and return types.
### `getPlan(...)`
Public API on `HyperP2PComputeShard`. See [`index.js`](../index.js) for parameters and return types.
### `listPlans(...)`
Public API on `HyperP2PComputeShard`. See [`index.js`](../index.js) for parameters and return types.
### `getStats() → object`
Metrics plus `protocol: 'compute-shard/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
Gossip / sync over Protomux `compute-shard/v1` when `topic` is configured.
## Testing
```bash
npm install && npm test
```