@weave_protocol/domere 1.2.6 β 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +234 -434
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,104 +1,38 @@
|
|
|
1
|
-
#
|
|
1
|
+
# βοΈ DΕmere - Judge Protocol
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@weave_protocol/domere)
|
|
4
4
|
[](LICENSE)
|
|
5
5
|
[](https://www.npmjs.com/package/@weave_protocol/domere)
|
|
6
6
|
|
|
7
|
-
**Enterprise-grade
|
|
7
|
+
**Enterprise-grade verification, orchestration, compliance, and audit infrastructure for AI agents.**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Part of the [Weave Protocol Security Suite](https://github.com/Tyox-all/Weave_Protocol).
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## β¨ Features
|
|
12
12
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
| **
|
|
16
|
-
| **
|
|
17
|
-
| **
|
|
18
|
-
| **
|
|
19
|
-
| **[@weave_protocol/api](./api)** | Universal REST API for all protocols | `npm i @weave_protocol/api` |
|
|
13
|
+
| Category | Features |
|
|
14
|
+
|----------|----------|
|
|
15
|
+
| **Verification** | Intent tracking, drift detection, execution replay, multi-agent handoff |
|
|
16
|
+
| **Orchestration** | Task scheduler, agent registry, shared state with locks |
|
|
17
|
+
| **Compliance** | SOC2 controls, HIPAA checkpoints, automated reporting |
|
|
18
|
+
| **Blockchain** | Solana & Ethereum anchoring for immutable audit trails |
|
|
20
19
|
|
|
21
|
-
##
|
|
20
|
+
## π¦ Installation
|
|
22
21
|
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
β WEAVE PROTOCOL SUITE β
|
|
26
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
27
|
-
β β
|
|
28
|
-
β βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ βββββββββββββββ β
|
|
29
|
-
β β MUND β β HORD β β DΕMERE β β WITAN β β
|
|
30
|
-
β β Guardian β β Vault β β Judge β β Council β β
|
|
31
|
-
β βββββββββββββββββ€ βββββββββββββββββ€ βββββββββββββββββ€ βββββββββββββββ€ β
|
|
32
|
-
β β β’ Secrets β β β’ Storage β β β’ Intent β β β’ Consensus β β
|
|
33
|
-
β β β’ PII β β β’ Redaction β β β’ Replay β β β’ Comms Bus β β
|
|
34
|
-
β β β’ Injection β β β’ Sandbox β β β’ Handoff β β β’ Policy β β
|
|
35
|
-
β β β’ Exfil β β β’ Encrypt β β β’ Compliance β β β’ Recovery β β
|
|
36
|
-
β β β β β β β’ Scheduler β β β’ Voting β β
|
|
37
|
-
β β β β β β β’ Registry β β β’ Channels β β
|
|
38
|
-
β βββββββββββββββββ βββββββββββββββββ βββββββββββββββββ βββββββββββββββ β
|
|
39
|
-
β β β β β β
|
|
40
|
-
β ββββββββββββββββββββ΄ββββββββββββββββββββ΄ββββββββββββββββββ β
|
|
41
|
-
β β β
|
|
42
|
-
β ββββββββββββββββΌβββββββββββββββ β
|
|
43
|
-
β β WITAN COUNCIL β β
|
|
44
|
-
β β (Orchestrator + N Agents) β β
|
|
45
|
-
β ββββββββββββββββ¬βββββββββββββββ β
|
|
46
|
-
β ββββββ¬βββββ¬βββββ¬βββββ¬βββ΄βββ¬βββββ¬βββββ¬βββββ β
|
|
47
|
-
β βΌ βΌ βΌ βΌ βΌ βΌ βΌ βΌ βΌ β
|
|
48
|
-
β [A1] [A2] [A3] [A4] [A5] [A6] [A7] [A8] [...] β
|
|
49
|
-
β β
|
|
50
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
51
|
-
β BLOCKCHAIN LAYER β
|
|
52
|
-
β βββββββββββββββ¬ββββββββββββββ β
|
|
53
|
-
β β Solana β Ethereum β β
|
|
54
|
-
β β Devnet β Mainnet β β
|
|
55
|
-
β βββββββββββββββ΄ββββββββββββββ β
|
|
56
|
-
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
## π Quick Start
|
|
60
|
-
|
|
61
|
-
### Option 1: Witan Council (Full Stack)
|
|
62
|
-
|
|
63
|
-
```typescript
|
|
64
|
-
import { WitanCouncil } from '@weave_protocol/witan';
|
|
65
|
-
|
|
66
|
-
const council = new WitanCouncil({
|
|
67
|
-
signing_key: 'your-secret-key',
|
|
68
|
-
max_agents: 10
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
await council.start();
|
|
72
|
-
|
|
73
|
-
// Register agents with voting weights
|
|
74
|
-
await council.registerAgent({
|
|
75
|
-
name: 'researcher',
|
|
76
|
-
capabilities: ['search', 'analysis'],
|
|
77
|
-
voting_weight: 2
|
|
78
|
-
});
|
|
79
|
-
|
|
80
|
-
// Submit tasks, propose decisions, send messages
|
|
81
|
-
await council.submitTask({ intent: 'Analyze market data', priority: 'high' });
|
|
82
|
-
|
|
83
|
-
const proposal = await council.propose({
|
|
84
|
-
title: 'Increase compute budget',
|
|
85
|
-
type: 'resource',
|
|
86
|
-
proposer_id: 'researcher'
|
|
87
|
-
});
|
|
88
|
-
|
|
89
|
-
await council.vote(proposal.id, 'researcher', 'approve');
|
|
22
|
+
```bash
|
|
23
|
+
npm install @weave_protocol/domere
|
|
90
24
|
```
|
|
91
25
|
|
|
92
|
-
|
|
26
|
+
## π Quick Start: Multi-Agent Orchestration
|
|
93
27
|
|
|
94
28
|
```typescript
|
|
95
29
|
import { Orchestrator } from '@weave_protocol/domere';
|
|
96
30
|
|
|
97
|
-
//
|
|
31
|
+
// Configure agent limit as needed (no hard maximum)
|
|
98
32
|
const orch = new Orchestrator({ max_agents: 10 });
|
|
99
33
|
await orch.start();
|
|
100
34
|
|
|
101
|
-
// Register agents
|
|
35
|
+
// Register agents
|
|
102
36
|
for (let i = 0; i < 10; i++) {
|
|
103
37
|
await orch.registerAgent({
|
|
104
38
|
name: `agent-${i}`,
|
|
@@ -108,149 +42,155 @@ for (let i = 0; i < 10; i++) {
|
|
|
108
42
|
}
|
|
109
43
|
|
|
110
44
|
// Submit tasks with dependencies
|
|
111
|
-
const
|
|
112
|
-
intent: 'Fetch Q3
|
|
113
|
-
priority: 'high'
|
|
114
|
-
required_capabilities: ['research']
|
|
45
|
+
const task1 = await orch.submitTask({
|
|
46
|
+
intent: 'Fetch Q3 data',
|
|
47
|
+
priority: 'high'
|
|
115
48
|
});
|
|
116
49
|
|
|
117
|
-
const
|
|
50
|
+
const task2 = await orch.submitTask({
|
|
118
51
|
intent: 'Analyze Q3 trends',
|
|
119
|
-
dependencies: [
|
|
120
|
-
required_capabilities: ['analysis']
|
|
52
|
+
dependencies: [task1.id] // Waits for task1
|
|
121
53
|
});
|
|
122
54
|
|
|
123
|
-
//
|
|
124
|
-
const
|
|
55
|
+
// Get stats
|
|
56
|
+
const stats = orch.getStats();
|
|
57
|
+
console.log(`${stats.agents.ready} agents ready, ${stats.tasks.queued} tasks queued`);
|
|
125
58
|
```
|
|
126
59
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
```bash
|
|
130
|
-
npm install @weave_protocol/api
|
|
131
|
-
npx weave-api
|
|
132
|
-
# Server running on http://localhost:3000
|
|
133
|
-
```
|
|
60
|
+
---
|
|
134
61
|
|
|
135
|
-
|
|
136
|
-
# Scan for secrets/threats
|
|
137
|
-
curl -X POST http://localhost:3000/api/v1/mund/scan \
|
|
138
|
-
-H "Content-Type: application/json" \
|
|
139
|
-
-d '{"content": "AWS key: AKIAIOSFODNN7EXAMPLE"}'
|
|
140
|
-
|
|
141
|
-
# Create verified thread
|
|
142
|
-
curl -X POST http://localhost:3000/api/v1/domere/threads \
|
|
143
|
-
-d '{"origin_type": "agent", "origin_identity": "gpt-4", "intent": "Process data"}'
|
|
144
|
-
```
|
|
62
|
+
## π Task Scheduler
|
|
145
63
|
|
|
146
|
-
|
|
64
|
+
Priority queue with dependencies, retries, and load balancing.
|
|
147
65
|
|
|
148
66
|
```typescript
|
|
149
|
-
import {
|
|
150
|
-
import { HordVault } from '@weave_protocol/hord';
|
|
151
|
-
import { ExecutionReplayManager, ComplianceManager } from '@weave_protocol/domere';
|
|
67
|
+
import { TaskScheduler } from '@weave_protocol/domere';
|
|
152
68
|
|
|
153
|
-
|
|
154
|
-
const scanner = new MundScanner();
|
|
155
|
-
const threats = await scanner.scan('API key: sk-1234567890abcdef');
|
|
69
|
+
const scheduler = new TaskScheduler();
|
|
156
70
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
71
|
+
const task = await scheduler.createTask({
|
|
72
|
+
intent: 'Analyze Q3 data',
|
|
73
|
+
priority: 'high',
|
|
74
|
+
dependencies: ['fetch-data-task'],
|
|
75
|
+
constraints: {
|
|
76
|
+
required_capabilities: ['data-analysis'],
|
|
77
|
+
max_duration_ms: 300000,
|
|
78
|
+
exclusive_resources: ['gpu-1']
|
|
79
|
+
},
|
|
80
|
+
retry_policy: {
|
|
81
|
+
max_retries: 3,
|
|
82
|
+
backoff: 'exponential'
|
|
83
|
+
}
|
|
84
|
+
});
|
|
160
85
|
|
|
161
|
-
//
|
|
162
|
-
const
|
|
163
|
-
|
|
86
|
+
// Auto-assign to best agent
|
|
87
|
+
const assignment = await scheduler.assignTask(task.id);
|
|
88
|
+
|
|
89
|
+
// Track progress
|
|
90
|
+
scheduler.onTaskProgress(task.id, (p) => console.log(`${p.percent}%`));
|
|
91
|
+
|
|
92
|
+
// Handle completion
|
|
93
|
+
scheduler.onTaskComplete(task.id, (result) => {
|
|
94
|
+
console.log(`Completed in ${result.duration_ms}ms`);
|
|
95
|
+
});
|
|
164
96
|
```
|
|
165
97
|
|
|
166
98
|
---
|
|
167
99
|
|
|
168
|
-
##
|
|
169
|
-
|
|
170
|
-
Real-time threat detection for AI inputs/outputs.
|
|
100
|
+
## π€ Agent Registry
|
|
171
101
|
|
|
172
|
-
|
|
173
|
-
- π **Secrets**: API keys (OpenAI, AWS, GitHub, etc.), passwords, tokens
|
|
174
|
-
- π€ **PII**: SSN, emails, phone numbers, credit cards
|
|
175
|
-
- π **Injection**: Prompt injection, jailbreak attempts
|
|
176
|
-
- π€ **Exfiltration**: Data theft patterns
|
|
102
|
+
Agent lifecycle, heartbeat monitoring, and failover.
|
|
177
103
|
|
|
178
104
|
```typescript
|
|
179
|
-
import {
|
|
180
|
-
|
|
181
|
-
const scanner = new MundScanner();
|
|
182
|
-
const result = await scanner.scan(`
|
|
183
|
-
My AWS key is AKIAIOSFODNN7EXAMPLE
|
|
184
|
-
and my SSN is 123-45-6789
|
|
185
|
-
`);
|
|
186
|
-
|
|
187
|
-
console.log(result.issues);
|
|
188
|
-
// [
|
|
189
|
-
// { type: 'secret', name: 'AWS Access Key', severity: 'critical' },
|
|
190
|
-
// { type: 'pii', name: 'SSN', severity: 'high' }
|
|
191
|
-
// ]
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
---
|
|
195
|
-
|
|
196
|
-
## ποΈ Hord - Vault Protocol
|
|
105
|
+
import { AgentRegistry } from '@weave_protocol/domere';
|
|
197
106
|
|
|
198
|
-
|
|
107
|
+
const registry = new AgentRegistry({
|
|
108
|
+
heartbeat_interval_ms: 5000,
|
|
109
|
+
heartbeat_timeout_ms: 15000
|
|
110
|
+
});
|
|
199
111
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
-
|
|
203
|
-
|
|
204
|
-
|
|
112
|
+
// Register agent
|
|
113
|
+
const agent = await registry.register({
|
|
114
|
+
agent_id: 'agent-7',
|
|
115
|
+
capabilities: ['code-generation', 'testing'],
|
|
116
|
+
max_concurrent_tasks: 3
|
|
117
|
+
});
|
|
205
118
|
|
|
206
|
-
|
|
207
|
-
import { HordVault } from '@weave_protocol/hord';
|
|
119
|
+
await registry.setReady('agent-7');
|
|
208
120
|
|
|
209
|
-
|
|
121
|
+
// Process heartbeats
|
|
122
|
+
await registry.heartbeat({
|
|
123
|
+
agent_id: 'agent-7',
|
|
124
|
+
current_tasks: ['task_1', 'task_2']
|
|
125
|
+
});
|
|
210
126
|
|
|
211
|
-
//
|
|
212
|
-
|
|
127
|
+
// Handle failures
|
|
128
|
+
registry.onAgentDown((agent, tasks) => {
|
|
129
|
+
console.log(`${agent.id} down with ${tasks.length} tasks`);
|
|
130
|
+
// Reassign tasks...
|
|
131
|
+
});
|
|
213
132
|
|
|
214
|
-
//
|
|
215
|
-
const
|
|
216
|
-
|
|
133
|
+
// Find best agent
|
|
134
|
+
const best = registry.getBestAgent({
|
|
135
|
+
capabilities: ['code-generation'],
|
|
136
|
+
prefer_lowest_load: true
|
|
137
|
+
});
|
|
217
138
|
```
|
|
218
139
|
|
|
219
140
|
---
|
|
220
141
|
|
|
221
|
-
##
|
|
222
|
-
|
|
223
|
-
Intent verification, orchestration, compliance, and blockchain anchoring.
|
|
142
|
+
## ποΈ State Manager
|
|
224
143
|
|
|
225
|
-
|
|
144
|
+
Shared state with locking, branching, and conflict resolution.
|
|
226
145
|
|
|
227
146
|
```typescript
|
|
228
|
-
import {
|
|
147
|
+
import { StateManager } from '@weave_protocol/domere';
|
|
229
148
|
|
|
230
|
-
const
|
|
149
|
+
const state = new StateManager({
|
|
150
|
+
conflict_resolution: 'last-write-wins'
|
|
151
|
+
});
|
|
231
152
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
153
|
+
// Lock before writing
|
|
154
|
+
const lock = await state.acquireLock({
|
|
155
|
+
key: 'customer-db',
|
|
156
|
+
holder: 'agent-3',
|
|
157
|
+
duration_ms: 30000,
|
|
158
|
+
type: 'exclusive'
|
|
237
159
|
});
|
|
238
160
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
161
|
+
if (lock.acquired) {
|
|
162
|
+
await state.set('customer-db', { updated: true });
|
|
163
|
+
await state.releaseLock('customer-db', 'agent-3');
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// Git-style branching
|
|
167
|
+
await state.createBranch('experiment', { parent: 'main' });
|
|
168
|
+
await state.set('config', newConfig, { branch: 'experiment' });
|
|
169
|
+
|
|
170
|
+
// Merge with conflict detection
|
|
171
|
+
const result = await state.merge('experiment', 'main');
|
|
172
|
+
if (result.conflicts.length > 0) {
|
|
173
|
+
// Resolve conflicts
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Snapshots for rollback
|
|
177
|
+
const snap = await state.createSnapshot();
|
|
178
|
+
// ... later ...
|
|
179
|
+
await state.restoreSnapshot(snap.id);
|
|
242
180
|
```
|
|
243
181
|
|
|
244
|
-
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## π Execution Replay
|
|
245
185
|
|
|
246
|
-
|
|
186
|
+
Tamper-proof audit trail with cryptographic verification.
|
|
247
187
|
|
|
248
188
|
```typescript
|
|
249
189
|
import { ExecutionReplayManager } from '@weave_protocol/domere';
|
|
250
190
|
|
|
251
191
|
const replay = new ExecutionReplayManager('encryption-key');
|
|
252
192
|
|
|
253
|
-
// Record
|
|
193
|
+
// Record actions
|
|
254
194
|
await replay.recordAction({
|
|
255
195
|
thread_id: 'thr_xxx',
|
|
256
196
|
agent_id: 'gpt-4-agent',
|
|
@@ -265,41 +205,57 @@ await replay.recordAction({
|
|
|
265
205
|
tokens_out: 1000
|
|
266
206
|
});
|
|
267
207
|
|
|
268
|
-
// Get
|
|
208
|
+
// Get trail
|
|
269
209
|
const trail = await replay.getExecutionTrail('thr_xxx');
|
|
270
210
|
console.log(trail.integrity_valid); // true
|
|
271
|
-
console.log(trail.merkle_root); // For blockchain
|
|
211
|
+
console.log(trail.merkle_root); // For blockchain
|
|
212
|
+
|
|
213
|
+
// Generate report
|
|
214
|
+
const report = await replay.generateAuditReport({
|
|
215
|
+
start_time: new Date('2026-01-01'),
|
|
216
|
+
end_time: new Date('2026-01-31')
|
|
217
|
+
});
|
|
272
218
|
```
|
|
273
219
|
|
|
274
|
-
|
|
220
|
+
---
|
|
275
221
|
|
|
276
|
-
|
|
222
|
+
## π€ Multi-Agent Handoff
|
|
223
|
+
|
|
224
|
+
Secure delegation with permission inheritance.
|
|
277
225
|
|
|
278
226
|
```typescript
|
|
279
227
|
import { HandoffManager } from '@weave_protocol/domere';
|
|
280
228
|
|
|
281
229
|
const handoff = new HandoffManager('signing-key', {
|
|
282
|
-
max_delegation_depth: 5
|
|
283
|
-
max_handoff_duration_ms: 3600000
|
|
230
|
+
max_delegation_depth: 5
|
|
284
231
|
});
|
|
285
232
|
|
|
286
|
-
//
|
|
233
|
+
// Create handoff token
|
|
287
234
|
const token = await handoff.createHandoff({
|
|
288
235
|
thread_id: 'thr_xxx',
|
|
289
236
|
from_agent: 'orchestrator',
|
|
290
237
|
to_agent: 'researcher',
|
|
291
|
-
delegated_intent: 'Find Q3
|
|
292
|
-
constraints: ['read-only'
|
|
238
|
+
delegated_intent: 'Find Q3 data',
|
|
239
|
+
constraints: ['read-only'],
|
|
293
240
|
permissions: [{ resource: 'database', actions: ['read'] }],
|
|
294
241
|
max_actions: 10,
|
|
295
242
|
expires_in_ms: 300000
|
|
296
243
|
});
|
|
297
244
|
|
|
298
|
-
//
|
|
299
|
-
const
|
|
245
|
+
// Verify before acting
|
|
246
|
+
const v = await handoff.verifyHandoff(token.token, 'researcher');
|
|
247
|
+
if (v.valid) {
|
|
248
|
+
console.log(`${v.remaining_actions} actions left`);
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
// Track chain
|
|
252
|
+
const chain = await handoff.getDelegationChain('thr_xxx');
|
|
253
|
+
console.log(`Depth: ${chain.depth}, Valid: ${chain.integrity_valid}`);
|
|
300
254
|
```
|
|
301
255
|
|
|
302
|
-
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## π Compliance (SOC2/HIPAA)
|
|
303
259
|
|
|
304
260
|
Automated compliance tracking and reporting.
|
|
305
261
|
|
|
@@ -311,282 +267,126 @@ const compliance = new ComplianceManager('signing-key');
|
|
|
311
267
|
// HIPAA: Log PHI access
|
|
312
268
|
await compliance.logPHIAccess({
|
|
313
269
|
thread_id: 'thr_xxx',
|
|
314
|
-
agent_id: 'medical-
|
|
270
|
+
agent_id: 'medical-ai',
|
|
315
271
|
patient_id: 'patient_123',
|
|
316
|
-
access_reason: 'Treatment
|
|
317
|
-
data_accessed: ['diagnosis'
|
|
272
|
+
access_reason: 'Treatment',
|
|
273
|
+
data_accessed: ['diagnosis'],
|
|
318
274
|
legal_basis: 'treatment'
|
|
319
275
|
});
|
|
320
276
|
|
|
321
|
-
//
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
```
|
|
329
|
-
|
|
330
|
-
### π Task Scheduler (Multi-Agent)
|
|
331
|
-
|
|
332
|
-
Priority queue with dependencies, retries, and load balancing.
|
|
333
|
-
|
|
334
|
-
```typescript
|
|
335
|
-
import { TaskScheduler } from '@weave_protocol/domere';
|
|
336
|
-
|
|
337
|
-
const scheduler = new TaskScheduler();
|
|
338
|
-
|
|
339
|
-
const task = await scheduler.createTask({
|
|
340
|
-
intent: 'Analyze Q3 data',
|
|
341
|
-
priority: 'high',
|
|
342
|
-
dependencies: ['fetch-data-task'],
|
|
343
|
-
constraints: {
|
|
344
|
-
required_capabilities: ['data-analysis'],
|
|
345
|
-
max_duration_ms: 300000
|
|
346
|
-
},
|
|
347
|
-
retry_policy: { max_retries: 3, backoff: 'exponential' }
|
|
277
|
+
// SOC2: Log access control
|
|
278
|
+
await compliance.logAccessControl({
|
|
279
|
+
thread_id: 'thr_xxx',
|
|
280
|
+
agent_id: 'admin-bot',
|
|
281
|
+
resource: 'reports',
|
|
282
|
+
action: 'grant',
|
|
283
|
+
success: true
|
|
348
284
|
});
|
|
349
285
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
const registry = new AgentRegistry();
|
|
361
|
-
|
|
362
|
-
const agent = await registry.register({
|
|
363
|
-
agent_id: 'agent-7',
|
|
364
|
-
capabilities: ['code-generation', 'testing'],
|
|
365
|
-
max_concurrent_tasks: 3
|
|
286
|
+
// Generic checkpoint
|
|
287
|
+
await compliance.checkpoint({
|
|
288
|
+
thread_id: 'thr_xxx',
|
|
289
|
+
framework: 'SOC2',
|
|
290
|
+
control: 'CC6.1',
|
|
291
|
+
event_type: 'access',
|
|
292
|
+
event_description: 'Data accessed',
|
|
293
|
+
data_classification: 'confidential',
|
|
294
|
+
agent_id: 'agent-1',
|
|
295
|
+
sign: true
|
|
366
296
|
});
|
|
367
297
|
|
|
368
|
-
|
|
369
|
-
|
|
298
|
+
// Generate report
|
|
299
|
+
const report = await compliance.generateReport({
|
|
300
|
+
framework: 'HIPAA',
|
|
301
|
+
period_start: new Date('2026-01-01'),
|
|
302
|
+
period_end: new Date('2026-03-31')
|
|
370
303
|
});
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
### ποΈ State Manager (Shared State with Locks)
|
|
374
|
-
|
|
375
|
-
Distributed state with locking, branching, and conflict resolution.
|
|
376
|
-
|
|
377
|
-
```typescript
|
|
378
|
-
import { StateManager } from '@weave_protocol/domere';
|
|
379
|
-
|
|
380
|
-
const state = new StateManager({ conflict_resolution: 'last-write-wins' });
|
|
381
|
-
|
|
382
|
-
// Lock before writing
|
|
383
|
-
const lock = await state.acquireLock({ key: 'db', holder: 'agent-3' });
|
|
384
|
-
if (lock.acquired) {
|
|
385
|
-
await state.set('db', { updated: true });
|
|
386
|
-
await state.releaseLock('db', 'agent-3');
|
|
387
|
-
}
|
|
388
|
-
|
|
389
|
-
// Git-style branching
|
|
390
|
-
await state.createBranch('experiment');
|
|
391
|
-
await state.set('config', newConfig, { branch: 'experiment' });
|
|
392
|
-
await state.merge('experiment', 'main');
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
### ποΈ Unified Orchestrator
|
|
396
|
-
|
|
397
|
-
Single interface for multi-agent coordination.
|
|
398
|
-
|
|
399
|
-
```typescript
|
|
400
|
-
import { Orchestrator } from '@weave_protocol/domere';
|
|
401
|
-
|
|
402
|
-
const orch = new Orchestrator({ max_agents: 10 });
|
|
403
|
-
await orch.start();
|
|
404
|
-
|
|
405
|
-
for (let i = 0; i < 10; i++) {
|
|
406
|
-
await orch.registerAgent({ name: `worker-${i}`, capabilities: ['general'] });
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
await orch.submitTask({ intent: 'Process batch', priority: 'high' });
|
|
410
|
-
|
|
411
|
-
const stats = orch.getStats();
|
|
412
|
-
console.log(`${stats.agents.ready}/${stats.agents.total} agents ready`);
|
|
304
|
+
console.log(`Score: ${report.compliance_score}`);
|
|
413
305
|
```
|
|
414
306
|
|
|
415
307
|
---
|
|
416
308
|
|
|
417
|
-
##
|
|
309
|
+
## βοΈ Blockchain Anchoring
|
|
418
310
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
### π³οΈ Consensus Engine
|
|
311
|
+
Immutable proof on Solana and Ethereum.
|
|
422
312
|
|
|
423
313
|
```typescript
|
|
424
|
-
import {
|
|
425
|
-
|
|
426
|
-
const consensus = new ConsensusEngine('signing-key', {
|
|
427
|
-
default_quorum: 0.5,
|
|
428
|
-
default_threshold: 0.6
|
|
429
|
-
});
|
|
430
|
-
|
|
431
|
-
const proposal = await consensus.createProposal({
|
|
432
|
-
title: 'Deploy new model',
|
|
433
|
-
proposal_type: 'action',
|
|
434
|
-
proposer_id: 'orchestrator',
|
|
435
|
-
eligible_voters: ['agent-1', 'agent-2', 'agent-3']
|
|
436
|
-
});
|
|
437
|
-
|
|
438
|
-
await consensus.vote(proposal.id, 'agent-1', 'approve');
|
|
439
|
-
await consensus.vote(proposal.id, 'agent-2', 'approve');
|
|
440
|
-
|
|
441
|
-
const result = await consensus.finalizeProposal(proposal.id);
|
|
442
|
-
console.log(result.decision); // 'approved'
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
### π¨ Communication Bus
|
|
446
|
-
|
|
447
|
-
```typescript
|
|
448
|
-
import { CommunicationBus } from '@weave_protocol/witan';
|
|
449
|
-
|
|
450
|
-
const bus = new CommunicationBus('signing-key');
|
|
451
|
-
|
|
452
|
-
// Direct message
|
|
453
|
-
await bus.send({
|
|
454
|
-
from: 'agent-1',
|
|
455
|
-
to: 'agent-2',
|
|
456
|
-
type: 'data-handoff',
|
|
457
|
-
payload: { dataset_id: 'ds_123' }
|
|
458
|
-
});
|
|
459
|
-
|
|
460
|
-
// Broadcast to all
|
|
461
|
-
await bus.broadcast({
|
|
462
|
-
from: 'orchestrator',
|
|
463
|
-
type: 'priority-change',
|
|
464
|
-
payload: { all_tasks: 'high' }
|
|
465
|
-
});
|
|
466
|
-
```
|
|
467
|
-
|
|
468
|
-
### π Policy Engine
|
|
469
|
-
|
|
470
|
-
```typescript
|
|
471
|
-
import { PolicyEngine } from '@weave_protocol/witan';
|
|
472
|
-
|
|
473
|
-
const policy = new PolicyEngine();
|
|
314
|
+
import { EthereumAnchor } from '@weave_protocol/domere';
|
|
474
315
|
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
name: 'api-limit',
|
|
478
|
-
targets: [{ type: 'all' }],
|
|
479
|
-
max_requests: 100,
|
|
480
|
-
window_ms: 60000
|
|
316
|
+
const anchor = new EthereumAnchor({
|
|
317
|
+
contract_address: '0xAA8b52adD3CEce6269d14C6335a79df451543820'
|
|
481
318
|
});
|
|
482
319
|
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
});
|
|
489
|
-
```
|
|
490
|
-
|
|
491
|
-
### π Recovery Manager
|
|
492
|
-
|
|
493
|
-
```typescript
|
|
494
|
-
import { RecoveryManager } from '@weave_protocol/witan';
|
|
495
|
-
|
|
496
|
-
const recovery = new RecoveryManager('signing-key');
|
|
497
|
-
|
|
498
|
-
// Checkpoint
|
|
499
|
-
const checkpoint = await recovery.checkpoint({
|
|
500
|
-
name: 'Pre-deployment',
|
|
501
|
-
created_by: 'admin'
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
// Transaction with auto-rollback
|
|
505
|
-
const txn = await recovery.beginTransaction({
|
|
506
|
-
initiator: 'agent-1',
|
|
507
|
-
auto_checkpoint: true
|
|
320
|
+
await anchor.anchorThread({
|
|
321
|
+
thread_id: 'thr_xxx',
|
|
322
|
+
merkle_root: trail.merkle_root,
|
|
323
|
+
intent_hash: 'abc123...',
|
|
324
|
+
compliant: true
|
|
508
325
|
});
|
|
509
|
-
|
|
510
|
-
// ... operations ...
|
|
511
|
-
await recovery.commitTransaction(txn.id);
|
|
512
|
-
// or: await recovery.rollbackTransaction(txn.id);
|
|
513
326
|
```
|
|
514
327
|
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
|
520
|
-
|-------|---------|------------------|----------|
|
|
521
|
-
| **Solana** | Mainnet | `6g7raTAHU2h331VKtfVtkS5pmuvR8vMYwjGsZF1CUj2o` | [View](https://solscan.io/account/6g7raTAHU2h331VKtfVtkS5pmuvR8vMYwjGsZF1CUj2o) |
|
|
522
|
-
| **Solana** | Devnet | `BeCYVJYfbUu3k2TPGmh9VoGWeJwzm2hg2NdtnvbdBNCj` | [View](https://solscan.io/account/BeCYVJYfbUu3k2TPGmh9VoGWeJwzm2hg2NdtnvbdBNCj?cluster=devnet) |
|
|
523
|
-
| **Ethereum** | Mainnet | `0xAA8b52adD3CEce6269d14C6335a79df451543820` | [View](https://etherscan.io/address/0xAA8b52adD3CEce6269d14C6335a79df451543820) |
|
|
328
|
+
| Chain | Network | Address |
|
|
329
|
+
|-------|---------|---------|
|
|
330
|
+
| Solana | Mainnet | `6g7raTAHU2h331VKtfVtkS5pmuvR8vMYwjGsZF1CUj2o` |
|
|
331
|
+
| Solana | Devnet | `BeCYVJYfbUu3k2TPGmh9VoGWeJwzm2hg2NdtnvbdBNCj` |
|
|
332
|
+
| Ethereum | Mainnet | `0xAA8b52adD3CEce6269d14C6335a79df451543820` |
|
|
524
333
|
|
|
525
334
|
---
|
|
526
335
|
|
|
527
|
-
##
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
|
533
|
-
|
|
|
534
|
-
|
|
|
535
|
-
|
|
|
536
|
-
|
|
|
537
|
-
|
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
|
541
|
-
|
|
542
|
-
|
|
|
543
|
-
|
|
|
544
|
-
|
|
|
545
|
-
|
|
|
546
|
-
|
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
|
550
|
-
|
|
336
|
+
## π API Reference
|
|
337
|
+
|
|
338
|
+
### Orchestrator
|
|
339
|
+
| Method | Description |
|
|
340
|
+
|--------|-------------|
|
|
341
|
+
| `start()` | Start orchestrator |
|
|
342
|
+
| `registerAgent(params)` | Register new agent |
|
|
343
|
+
| `submitTask(params)` | Submit task to queue |
|
|
344
|
+
| `heartbeat(agentId, tasks)` | Process agent heartbeat |
|
|
345
|
+
| `taskCompleted(agentId, taskId, result)` | Report completion |
|
|
346
|
+
| `getStats()` | Get orchestrator stats |
|
|
347
|
+
|
|
348
|
+
### TaskScheduler
|
|
349
|
+
| Method | Description |
|
|
350
|
+
|--------|-------------|
|
|
351
|
+
| `createTask(params)` | Create task with dependencies |
|
|
352
|
+
| `assignTask(taskId, agentId?)` | Assign to agent |
|
|
353
|
+
| `completeTask(taskId, agentId, result)` | Mark complete |
|
|
354
|
+
| `failTask(taskId, agentId, error)` | Mark failed (auto-retry) |
|
|
355
|
+
| `reassignFromAgent(agentId)` | Reassign failed agent's tasks |
|
|
356
|
+
|
|
357
|
+
### AgentRegistry
|
|
358
|
+
| Method | Description |
|
|
359
|
+
|--------|-------------|
|
|
360
|
+
| `register(params)` | Register agent |
|
|
361
|
+
| `heartbeat(payload)` | Process heartbeat |
|
|
362
|
+
| `findAgents(query)` | Find matching agents |
|
|
363
|
+
| `drain(agentId)` | Stop accepting tasks |
|
|
364
|
+
| `deregister(agentId)` | Remove agent |
|
|
365
|
+
|
|
366
|
+
### StateManager
|
|
367
|
+
| Method | Description |
|
|
368
|
+
|--------|-------------|
|
|
369
|
+
| `get(key)` / `set(key, value)` | Basic operations |
|
|
370
|
+
| `acquireLock(request)` | Acquire lock |
|
|
371
|
+
| `releaseLock(key, holder)` | Release lock |
|
|
372
|
+
| `createBranch(name)` | Create branch |
|
|
373
|
+
| `merge(source, target)` | Merge branches |
|
|
374
|
+
| `createSnapshot()` | Create snapshot |
|
|
551
375
|
|
|
552
376
|
---
|
|
553
377
|
|
|
554
|
-
##
|
|
378
|
+
## π Related Packages
|
|
555
379
|
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
- β
Ethereum mainnet deployment
|
|
563
|
-
- β
Solana mainnet deployment
|
|
564
|
-
|
|
565
|
-
### Next (v2.x)
|
|
566
|
-
- π² MCP server integration
|
|
567
|
-
- π² Advanced agent coordination patterns
|
|
568
|
-
- π² Real-time monitoring dashboard
|
|
569
|
-
- π² Additional compliance frameworks (PCI-DSS, ISO27001)
|
|
570
|
-
|
|
571
|
-
---
|
|
380
|
+
| Package | Description |
|
|
381
|
+
|---------|-------------|
|
|
382
|
+
| [@weave_protocol/witan](https://www.npmjs.com/package/@weave_protocol/witan) | Consensus, communication & governance |
|
|
383
|
+
| [@weave_protocol/mund](https://www.npmjs.com/package/@weave_protocol/mund) | Secret & threat scanning |
|
|
384
|
+
| [@weave_protocol/hord](https://www.npmjs.com/package/@weave_protocol/hord) | Secure vault & sandbox |
|
|
385
|
+
| [@weave_protocol/api](https://www.npmjs.com/package/@weave_protocol/api) | Universal REST API |
|
|
572
386
|
|
|
573
387
|
## π License
|
|
574
388
|
|
|
575
|
-
Apache 2.0
|
|
576
|
-
|
|
577
|
-
---
|
|
578
|
-
|
|
579
|
-
## π€ Contributing
|
|
580
|
-
|
|
581
|
-
Contributions welcome! Here's how:
|
|
582
|
-
|
|
583
|
-
1. Fork the repository
|
|
584
|
-
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
|
|
585
|
-
3. Commit your changes (`git commit -m 'Add amazing feature'`)
|
|
586
|
-
4. Push to the branch (`git push origin feature/amazing-feature`)
|
|
587
|
-
5. Open a Pull Request
|
|
588
|
-
|
|
589
|
-
Please ensure your code passes existing tests and follows the project's coding style.
|
|
389
|
+
Apache 2.0
|
|
590
390
|
|
|
591
391
|
---
|
|
592
392
|
|