This commit is contained in:
Raven Scott
2026-05-20 19:51:22 -04:00
parent 0f2ab198a6
commit 040f1d05ea
324 changed files with 2715 additions and 5466 deletions
@@ -3,4 +3,6 @@
## v0.1.0
- Initial release.
## v0.2.0
- Production-grade docs, validation, and expanded tests.
+11 -3
View File
@@ -1,18 +1,26 @@
# hyper-p2p-contradiction-graph
Bare/Pear P2P primitive **contradiction-graph/v1**.
Bare/Pear P2P — **opposing claims contradiction lattice**
**Protocol:** `contradiction-graph/v1`
## Quick start
```js
const { HyperP2PContradictionGraph } = require('hyper-p2p-contradiction-graph')
const mod = new HyperP2PContradictionGraph()
// await mod.ready() when using topic
await mod.close()
```
See `examples/basic.js` and `docs/api.md`.
## Docs
- [docs/api.md](docs/api.md)
- [docs/architecture.md](docs/architecture.md)
- [../_shared/PRODUCTION.md](../_shared/PRODUCTION.md)
## Test
```bash
npm test
```
+31 -1
View File
@@ -4,5 +4,35 @@
**Export:** `HyperP2PContradictionGraph`
Integration: `../../real_tests/integration/` smoke tests.
## Constructor
```js
const mod = new HyperP2PContradictionGraph(opts)
```
| Option | Type | Default | Description |
|--------|------|---------|-------------|
| `topic` | `string` \| `Buffer` | `null` | Hyperswarm topic; enables P2P when set |
| `keyPair` | `KeyPair` | random | Ed25519 key pair (`hypercore-crypto`) |
| `enableBackgroundTimers` | `boolean` | `false` | Periodic timers (keep false in unit tests) |
## Methods
See [`index.js`](../index.js) for the full method list. Core operations implement **opposing claims contradiction lattice**.
## Events
The instance extends `EventEmitter`. Common events: `closed`, plus module-specific events documented in source.
## P2P
When `topic` is set, `ready()` joins Hyperswarm and opens Protomux channel `contradiction-graph/v1` via [`_shared/p2p-bare.js`](../_shared/p2p-bare.js).
## Testing
```bash
npm install
npm test
```
Integration: [`../../real_tests/integration/contradiction-graph-two-node.js`](../../real_tests/integration/contradiction-graph-two-node.js)
@@ -1,4 +1,10 @@
# Architecture: hyper-p2p-contradiction-graph
Hyperswarm + Protomux (`contradiction-graph/v1`) when `topic` is set via `p2p-bare.js`.
```mermaid
flowchart LR
App[Application] --> Mod[HyperP2PContradictionGraph]
Mod --> P2P[Protomux contradiction-graph/v1]
P2P --> Swarm[Hyperswarm]
```
Local state lives in memory maps/arrays; gossip merges remote updates when `topic` is configured.
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "hyper-p2p-contradiction-graph",
"version": "0.1.0",
"version": "0.2.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "hyper-p2p-contradiction-graph",
"version": "0.1.0",
"version": "0.2.0",
"license": "Apache-2.0",
"dependencies": {
"b4a": "^1.6.7",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hyper-p2p-contradiction-graph",
"version": "0.1.0",
"version": "0.2.0",
"description": "Opposing claims contradiction lattice for Bare/Pear P2P.",
"main": "index.js",
"type": "commonjs",
@@ -20,3 +20,8 @@ test('contradiction-graph: merge', async (t) => {
await a.close()
await b.close()
})
test('hyper-p2p-contradiction-graph: close without leak', async (t) => {
const m = new HyperP2PContradictionGraph()
await m.close()
t.pass()
})