This commit is contained in:
Raven Scott
2026-05-20 20:19:20 -04:00
parent 040f1d05ea
commit d70060ec4e
365 changed files with 23547 additions and 431 deletions
+21 -3
View File
@@ -18,15 +18,33 @@ const mod = new HyperP2PTrustGraph(opts)
## Methods
See [`index.js`](../index.js) for the full method list. Core operations implement **transitive trust graph with decay**.
| Method | Returns | Notes |
|--------|---------|-------|
| `addEdge(...)` | See source | — |
| `close(...)` | See source | — |
| `decaySweep(...)` | See source | — |
| `edges(...)` | See source | — |
| `merge(...)` | See source | — |
| `ready(...)` | See source | — |
| `toJSON(...)` | See source | — |
| `trustScore(...)` | See source | — |
## Events
The instance extends `EventEmitter`. Common events: `closed`, plus module-specific events documented in source.
| Event | Description |
|-------|-------------|
| `closed` | Module-specific |
| `decay` | Module-specific |
| `edge` | Module-specific |
| `merge` | Module-specific |
## Metrics
Call `getStats()` when implemented for counters (Wave 6 network modules always expose stats).
## P2P
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux channel `trust-graph/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux `trust-graph/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
## Testing
+16 -4
View File
@@ -1,10 +1,22 @@
# Architecture: hyper-p2p-trust-graph
Transitive trust graph for Bare/Pear P2P overlays.
```mermaid
flowchart LR
flowchart TB
App[Application] --> Mod[HyperP2PTrustGraph]
Mod --> P2P[Protomux trust-graph/v1]
P2P --> Swarm[Hyperswarm]
Mod --> Mux[Protomux trust-graph/v1]
Mux --> Swarm[Hyperswarm topic]
```
Local state lives in memory maps/arrays; gossip merges remote updates when `topic` is configured.
## Wire messages (gossip)
JSON envelopes via `gossipSend` when connected. Message `type` fields are module-specific; see `index.js` `onmessage` handler.
## Composition (Wave 6)
See [`../_shared/WAVE6_NETWORK_STACK.md`](../_shared/WAVE6_NETWORK_STACK.md) for pairing with network-stack modules.
## State
In-memory maps/arrays; merged from remote gossip when `topic` is configured.