@weave_protocol/domere 1.2.4 → 1.2.6
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 +434 -231
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,37 +1,104 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 🛡️ Weave Protocol Security Suite
|
|
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 security and orchestration infrastructure for AI agents.**
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Weave Protocol provides defense-in-depth for autonomous AI systems: secret scanning, secure containment, intent verification, execution replay, multi-agent coordination, and compliance tracking—all with blockchain anchoring for immutable audit trails.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## 📦 Packages
|
|
12
12
|
|
|
13
|
-
|
|
|
14
|
-
|
|
15
|
-
| **
|
|
16
|
-
| **
|
|
17
|
-
| **
|
|
18
|
-
| **
|
|
13
|
+
| Package | Description | Install |
|
|
14
|
+
|---------|-------------|---------|
|
|
15
|
+
| **[@weave_protocol/mund](./mund)** | Guardian Protocol - Secret & threat scanning | `npm i @weave_protocol/mund` |
|
|
16
|
+
| **[@weave_protocol/hord](./hord)** | Vault Protocol - Secure containment & sandboxing | `npm i @weave_protocol/hord` |
|
|
17
|
+
| **[@weave_protocol/domere](./domere)** | Judge Protocol - Verification, orchestration & compliance | `npm i @weave_protocol/domere` |
|
|
18
|
+
| **[@weave_protocol/witan](./witan)** | Council Protocol - Consensus, communication & governance | `npm i @weave_protocol/witan` |
|
|
19
|
+
| **[@weave_protocol/api](./api)** | Universal REST API for all protocols | `npm i @weave_protocol/api` |
|
|
19
20
|
|
|
20
|
-
##
|
|
21
|
+
## 🏗️ Architecture
|
|
21
22
|
|
|
22
|
-
```
|
|
23
|
-
|
|
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
|
+
└─────────────────────────────────────────────────────────────────────────────┘
|
|
24
57
|
```
|
|
25
58
|
|
|
26
|
-
## 🚀 Quick Start
|
|
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');
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Option 2: Dōmere Orchestration (Core)
|
|
27
93
|
|
|
28
94
|
```typescript
|
|
29
95
|
import { Orchestrator } from '@weave_protocol/domere';
|
|
30
96
|
|
|
97
|
+
// Create orchestrator for 10 agents
|
|
31
98
|
const orch = new Orchestrator({ max_agents: 10 });
|
|
32
99
|
await orch.start();
|
|
33
100
|
|
|
34
|
-
// Register
|
|
101
|
+
// Register agents with capabilities
|
|
35
102
|
for (let i = 0; i < 10; i++) {
|
|
36
103
|
await orch.registerAgent({
|
|
37
104
|
name: `agent-${i}`,
|
|
@@ -41,155 +108,149 @@ for (let i = 0; i < 10; i++) {
|
|
|
41
108
|
}
|
|
42
109
|
|
|
43
110
|
// Submit tasks with dependencies
|
|
44
|
-
const
|
|
45
|
-
intent: 'Fetch Q3 data',
|
|
46
|
-
priority: 'high'
|
|
111
|
+
const fetchTask = await orch.submitTask({
|
|
112
|
+
intent: 'Fetch Q3 financial data',
|
|
113
|
+
priority: 'high',
|
|
114
|
+
required_capabilities: ['research']
|
|
47
115
|
});
|
|
48
116
|
|
|
49
|
-
const
|
|
117
|
+
const analyzeTask = await orch.submitTask({
|
|
50
118
|
intent: 'Analyze Q3 trends',
|
|
51
|
-
dependencies: [
|
|
119
|
+
dependencies: [fetchTask.id], // Waits for fetch to complete
|
|
120
|
+
required_capabilities: ['analysis']
|
|
52
121
|
});
|
|
53
122
|
|
|
54
|
-
//
|
|
55
|
-
const
|
|
56
|
-
console.log(`${stats.agents.ready} agents ready, ${stats.tasks.queued} tasks queued`);
|
|
123
|
+
// Agents receive tasks via heartbeat
|
|
124
|
+
const { tasks_to_run } = await orch.heartbeat('agent-0', []);
|
|
57
125
|
```
|
|
58
126
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
## 📊 Task Scheduler
|
|
127
|
+
### Option 3: REST API (Any AI Agent)
|
|
62
128
|
|
|
63
|
-
|
|
129
|
+
```bash
|
|
130
|
+
npm install @weave_protocol/api
|
|
131
|
+
npx weave-api
|
|
132
|
+
# Server running on http://localhost:3000
|
|
133
|
+
```
|
|
64
134
|
|
|
65
|
-
```
|
|
66
|
-
|
|
135
|
+
```bash
|
|
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
|
+
```
|
|
67
145
|
|
|
68
|
-
|
|
146
|
+
### Option 4: Direct Package Usage
|
|
69
147
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
constraints: {
|
|
75
|
-
required_capabilities: ['data-analysis'],
|
|
76
|
-
max_duration_ms: 300000,
|
|
77
|
-
exclusive_resources: ['gpu-1']
|
|
78
|
-
},
|
|
79
|
-
retry_policy: {
|
|
80
|
-
max_retries: 3,
|
|
81
|
-
backoff: 'exponential'
|
|
82
|
-
}
|
|
83
|
-
});
|
|
148
|
+
```typescript
|
|
149
|
+
import { MundScanner } from '@weave_protocol/mund';
|
|
150
|
+
import { HordVault } from '@weave_protocol/hord';
|
|
151
|
+
import { ExecutionReplayManager, ComplianceManager } from '@weave_protocol/domere';
|
|
84
152
|
|
|
85
|
-
//
|
|
86
|
-
const
|
|
153
|
+
// Scan for secrets
|
|
154
|
+
const scanner = new MundScanner();
|
|
155
|
+
const threats = await scanner.scan('API key: sk-1234567890abcdef');
|
|
87
156
|
|
|
88
|
-
//
|
|
89
|
-
|
|
157
|
+
// Secure storage
|
|
158
|
+
const vault = new HordVault();
|
|
159
|
+
await vault.store('api-key', 'sk-1234...', { encryption: true });
|
|
90
160
|
|
|
91
|
-
//
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
});
|
|
161
|
+
// Track execution
|
|
162
|
+
const replay = new ExecutionReplayManager('encryption-key');
|
|
163
|
+
await replay.recordAction({ thread_id: 'thr_1', agent_id: 'agent-1', ... });
|
|
95
164
|
```
|
|
96
165
|
|
|
97
166
|
---
|
|
98
167
|
|
|
99
|
-
##
|
|
168
|
+
## 🔐 Mund - Guardian Protocol
|
|
100
169
|
|
|
101
|
-
|
|
170
|
+
Real-time threat detection for AI inputs/outputs.
|
|
171
|
+
|
|
172
|
+
**Detects:**
|
|
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
177
|
|
|
103
178
|
```typescript
|
|
104
|
-
import {
|
|
179
|
+
import { MundScanner } from '@weave_protocol/mund';
|
|
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
|
+
```
|
|
105
193
|
|
|
106
|
-
|
|
107
|
-
heartbeat_interval_ms: 5000,
|
|
108
|
-
heartbeat_timeout_ms: 15000
|
|
109
|
-
});
|
|
194
|
+
---
|
|
110
195
|
|
|
111
|
-
|
|
112
|
-
const agent = await registry.register({
|
|
113
|
-
agent_id: 'agent-7',
|
|
114
|
-
capabilities: ['code-generation', 'testing'],
|
|
115
|
-
max_concurrent_tasks: 3
|
|
116
|
-
});
|
|
196
|
+
## 🏛️ Hord - Vault Protocol
|
|
117
197
|
|
|
118
|
-
|
|
198
|
+
Secure containment and sandboxed execution.
|
|
119
199
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
200
|
+
**Features:**
|
|
201
|
+
- 🔒 Encrypted secret storage
|
|
202
|
+
- 📝 Automatic redaction
|
|
203
|
+
- 🏖️ Sandboxed code execution
|
|
204
|
+
- 🔐 Access control policies
|
|
125
205
|
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
console.log(`${agent.id} down with ${tasks.length} tasks`);
|
|
129
|
-
// Reassign tasks...
|
|
130
|
-
});
|
|
206
|
+
```typescript
|
|
207
|
+
import { HordVault } from '@weave_protocol/hord';
|
|
131
208
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
209
|
+
const vault = new HordVault({ encryption_key: process.env.VAULT_KEY });
|
|
210
|
+
|
|
211
|
+
// Store secrets securely
|
|
212
|
+
await vault.store('openai-key', 'sk-...', { ttl: 3600 });
|
|
213
|
+
|
|
214
|
+
// Redact sensitive data
|
|
215
|
+
const safe = await vault.redact('My SSN is 123-45-6789');
|
|
216
|
+
// → "My SSN is [REDACTED]"
|
|
137
217
|
```
|
|
138
218
|
|
|
139
219
|
---
|
|
140
220
|
|
|
141
|
-
##
|
|
221
|
+
## ⚖️ Dōmere - Judge Protocol
|
|
222
|
+
|
|
223
|
+
Intent verification, orchestration, compliance, and blockchain anchoring.
|
|
142
224
|
|
|
143
|
-
|
|
225
|
+
### 🎯 Intent Tracking & Drift Detection
|
|
144
226
|
|
|
145
227
|
```typescript
|
|
146
|
-
import {
|
|
228
|
+
import { ThreadManager } from '@weave_protocol/domere';
|
|
147
229
|
|
|
148
|
-
const
|
|
149
|
-
conflict_resolution: 'last-write-wins'
|
|
150
|
-
});
|
|
230
|
+
const manager = new ThreadManager();
|
|
151
231
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
type: 'exclusive'
|
|
232
|
+
const thread = await manager.createThread({
|
|
233
|
+
origin_type: 'human',
|
|
234
|
+
origin_identity: 'user@company.com',
|
|
235
|
+
intent: 'Generate quarterly report',
|
|
236
|
+
constraints: ['read-only', 'no-external-api']
|
|
158
237
|
});
|
|
159
238
|
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Git-style branching
|
|
166
|
-
await state.createBranch('experiment', { parent: 'main' });
|
|
167
|
-
await state.set('config', newConfig, { branch: 'experiment' });
|
|
168
|
-
|
|
169
|
-
// Merge with conflict detection
|
|
170
|
-
const result = await state.merge('experiment', 'main');
|
|
171
|
-
if (result.conflicts.length > 0) {
|
|
172
|
-
// Resolve conflicts
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
// Snapshots for rollback
|
|
176
|
-
const snap = await state.createSnapshot();
|
|
177
|
-
// ... later ...
|
|
178
|
-
await state.restoreSnapshot(snap.id);
|
|
239
|
+
// Check for drift
|
|
240
|
+
const drift = await manager.checkDrift(thread.id, 'Sending data to external API');
|
|
241
|
+
// → { drifted: true, reason: 'Violates no-external-api constraint' }
|
|
179
242
|
```
|
|
180
243
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
## 🔄 Execution Replay
|
|
244
|
+
### 🔄 Execution Replay & Audit Trail
|
|
184
245
|
|
|
185
|
-
|
|
246
|
+
Complete forensic trail with cryptographic verification.
|
|
186
247
|
|
|
187
248
|
```typescript
|
|
188
249
|
import { ExecutionReplayManager } from '@weave_protocol/domere';
|
|
189
250
|
|
|
190
251
|
const replay = new ExecutionReplayManager('encryption-key');
|
|
191
252
|
|
|
192
|
-
// Record
|
|
253
|
+
// Record every action
|
|
193
254
|
await replay.recordAction({
|
|
194
255
|
thread_id: 'thr_xxx',
|
|
195
256
|
agent_id: 'gpt-4-agent',
|
|
@@ -204,57 +265,41 @@ await replay.recordAction({
|
|
|
204
265
|
tokens_out: 1000
|
|
205
266
|
});
|
|
206
267
|
|
|
207
|
-
// Get trail
|
|
268
|
+
// Get tamper-proof trail
|
|
208
269
|
const trail = await replay.getExecutionTrail('thr_xxx');
|
|
209
270
|
console.log(trail.integrity_valid); // true
|
|
210
|
-
console.log(trail.merkle_root); // For blockchain
|
|
211
|
-
|
|
212
|
-
// Generate report
|
|
213
|
-
const report = await replay.generateAuditReport({
|
|
214
|
-
start_time: new Date('2026-01-01'),
|
|
215
|
-
end_time: new Date('2026-01-31')
|
|
216
|
-
});
|
|
271
|
+
console.log(trail.merkle_root); // For blockchain anchoring
|
|
217
272
|
```
|
|
218
273
|
|
|
219
|
-
|
|
274
|
+
### 🤝 Multi-Agent Handoff Verification
|
|
220
275
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
Secure delegation with permission inheritance.
|
|
276
|
+
Secure delegation between AI agents with permission inheritance.
|
|
224
277
|
|
|
225
278
|
```typescript
|
|
226
279
|
import { HandoffManager } from '@weave_protocol/domere';
|
|
227
280
|
|
|
228
281
|
const handoff = new HandoffManager('signing-key', {
|
|
229
|
-
max_delegation_depth: 5
|
|
282
|
+
max_delegation_depth: 5,
|
|
283
|
+
max_handoff_duration_ms: 3600000
|
|
230
284
|
});
|
|
231
285
|
|
|
232
|
-
//
|
|
286
|
+
// Delegate from orchestrator to researcher
|
|
233
287
|
const token = await handoff.createHandoff({
|
|
234
288
|
thread_id: 'thr_xxx',
|
|
235
289
|
from_agent: 'orchestrator',
|
|
236
290
|
to_agent: 'researcher',
|
|
237
|
-
delegated_intent: 'Find Q3 data',
|
|
238
|
-
constraints: ['read-only'],
|
|
291
|
+
delegated_intent: 'Find Q3 revenue data',
|
|
292
|
+
constraints: ['read-only', 'internal-data-only'],
|
|
239
293
|
permissions: [{ resource: 'database', actions: ['read'] }],
|
|
240
294
|
max_actions: 10,
|
|
241
295
|
expires_in_ms: 300000
|
|
242
296
|
});
|
|
243
297
|
|
|
244
|
-
//
|
|
245
|
-
const
|
|
246
|
-
if (v.valid) {
|
|
247
|
-
console.log(`${v.remaining_actions} actions left`);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
// Track chain
|
|
251
|
-
const chain = await handoff.getDelegationChain('thr_xxx');
|
|
252
|
-
console.log(`Depth: ${chain.depth}, Valid: ${chain.integrity_valid}`);
|
|
298
|
+
// Researcher verifies before acting
|
|
299
|
+
const verification = await handoff.verifyHandoff(token.token, 'researcher');
|
|
253
300
|
```
|
|
254
301
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
## 📋 Compliance (SOC2/HIPAA)
|
|
302
|
+
### 📋 Compliance Checkpoints (SOC2/HIPAA)
|
|
258
303
|
|
|
259
304
|
Automated compliance tracking and reporting.
|
|
260
305
|
|
|
@@ -266,124 +311,282 @@ const compliance = new ComplianceManager('signing-key');
|
|
|
266
311
|
// HIPAA: Log PHI access
|
|
267
312
|
await compliance.logPHIAccess({
|
|
268
313
|
thread_id: 'thr_xxx',
|
|
269
|
-
agent_id: 'medical-
|
|
314
|
+
agent_id: 'medical-assistant',
|
|
270
315
|
patient_id: 'patient_123',
|
|
271
|
-
access_reason: 'Treatment',
|
|
272
|
-
data_accessed: ['diagnosis'],
|
|
316
|
+
access_reason: 'Treatment recommendation',
|
|
317
|
+
data_accessed: ['diagnosis', 'medications'],
|
|
273
318
|
legal_basis: 'treatment'
|
|
274
319
|
});
|
|
275
320
|
|
|
276
|
-
//
|
|
277
|
-
await compliance.logAccessControl({
|
|
278
|
-
thread_id: 'thr_xxx',
|
|
279
|
-
agent_id: 'admin-bot',
|
|
280
|
-
resource: 'reports',
|
|
281
|
-
action: 'grant',
|
|
282
|
-
success: true
|
|
283
|
-
});
|
|
284
|
-
|
|
285
|
-
// Generic checkpoint
|
|
286
|
-
await compliance.checkpoint({
|
|
287
|
-
thread_id: 'thr_xxx',
|
|
288
|
-
framework: 'SOC2',
|
|
289
|
-
control: 'CC6.1',
|
|
290
|
-
event_type: 'access',
|
|
291
|
-
event_description: 'Data accessed',
|
|
292
|
-
data_classification: 'confidential',
|
|
293
|
-
agent_id: 'agent-1',
|
|
294
|
-
sign: true
|
|
295
|
-
});
|
|
296
|
-
|
|
297
|
-
// Generate report
|
|
321
|
+
// Generate compliance report
|
|
298
322
|
const report = await compliance.generateReport({
|
|
299
323
|
framework: 'HIPAA',
|
|
300
324
|
period_start: new Date('2026-01-01'),
|
|
301
325
|
period_end: new Date('2026-03-31')
|
|
302
326
|
});
|
|
303
|
-
console.log(
|
|
327
|
+
console.log('Score:', report.compliance_score);
|
|
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' }
|
|
348
|
+
});
|
|
349
|
+
|
|
350
|
+
const assignment = await scheduler.assignTask(task.id);
|
|
351
|
+
```
|
|
352
|
+
|
|
353
|
+
### 🤖 Agent Registry (Health & Capabilities)
|
|
354
|
+
|
|
355
|
+
Agent lifecycle, heartbeat monitoring, and failover.
|
|
356
|
+
|
|
357
|
+
```typescript
|
|
358
|
+
import { AgentRegistry } from '@weave_protocol/domere';
|
|
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
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
registry.onAgentDown((agent, activeTasks) => {
|
|
369
|
+
console.log(`Agent ${agent.id} down, reassigning tasks`);
|
|
370
|
+
});
|
|
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
413
|
```
|
|
305
414
|
|
|
306
415
|
---
|
|
307
416
|
|
|
308
|
-
##
|
|
417
|
+
## 🏛️ Witan - Council Protocol
|
|
309
418
|
|
|
310
|
-
|
|
419
|
+
Multi-agent consensus, communication, governance, and recovery.
|
|
420
|
+
|
|
421
|
+
### 🗳️ Consensus Engine
|
|
311
422
|
|
|
312
423
|
```typescript
|
|
313
|
-
import {
|
|
424
|
+
import { ConsensusEngine } from '@weave_protocol/witan';
|
|
314
425
|
|
|
315
|
-
const
|
|
316
|
-
|
|
426
|
+
const consensus = new ConsensusEngine('signing-key', {
|
|
427
|
+
default_quorum: 0.5,
|
|
428
|
+
default_threshold: 0.6
|
|
317
429
|
});
|
|
318
430
|
|
|
319
|
-
await
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
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']
|
|
324
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'
|
|
325
443
|
```
|
|
326
444
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
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();
|
|
474
|
+
|
|
475
|
+
// Rate limit: 100 requests per minute
|
|
476
|
+
await policy.createRateLimit({
|
|
477
|
+
name: 'api-limit',
|
|
478
|
+
targets: [{ type: 'all' }],
|
|
479
|
+
max_requests: 100,
|
|
480
|
+
window_ms: 60000
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
// Enforce
|
|
484
|
+
const decision = await policy.enforce({
|
|
485
|
+
agent_id: 'agent-1',
|
|
486
|
+
action: 'api_call',
|
|
487
|
+
timestamp: new Date()
|
|
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
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
// ... operations ...
|
|
511
|
+
await recovery.commitTransaction(txn.id);
|
|
512
|
+
// or: await recovery.rollbackTransaction(txn.id);
|
|
513
|
+
```
|
|
514
|
+
|
|
515
|
+
---
|
|
516
|
+
|
|
517
|
+
## ⛓️ Blockchain Deployments
|
|
518
|
+
|
|
519
|
+
| Chain | Network | Contract/Program | Explorer |
|
|
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) |
|
|
331
524
|
|
|
332
525
|
---
|
|
333
526
|
|
|
334
|
-
##
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
|
340
|
-
|
|
|
341
|
-
|
|
|
342
|
-
|
|
|
343
|
-
|
|
|
344
|
-
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
|
348
|
-
|
|
349
|
-
|
|
|
350
|
-
|
|
|
351
|
-
|
|
|
352
|
-
|
|
|
353
|
-
|
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
|
357
|
-
|
|
358
|
-
| `register(params)` | Register agent |
|
|
359
|
-
| `heartbeat(payload)` | Process heartbeat |
|
|
360
|
-
| `findAgents(query)` | Find matching agents |
|
|
361
|
-
| `drain(agentId)` | Stop accepting tasks |
|
|
362
|
-
| `deregister(agentId)` | Remove agent |
|
|
363
|
-
|
|
364
|
-
### StateManager
|
|
365
|
-
| Method | Description |
|
|
366
|
-
|--------|-------------|
|
|
367
|
-
| `get(key)` / `set(key, value)` | Basic operations |
|
|
368
|
-
| `acquireLock(request)` | Acquire lock |
|
|
369
|
-
| `releaseLock(key, holder)` | Release lock |
|
|
370
|
-
| `createBranch(name)` | Create branch |
|
|
371
|
-
| `merge(source, target)` | Merge branches |
|
|
372
|
-
| `createSnapshot()` | Create snapshot |
|
|
527
|
+
## 📊 Feature Matrix
|
|
528
|
+
|
|
529
|
+
| Feature | Mund | Hord | Dōmere | Witan |
|
|
530
|
+
|---------|:----:|:----:|:------:|:-----:|
|
|
531
|
+
| Secret Detection | ✅ | | | |
|
|
532
|
+
| PII Detection | ✅ | | | |
|
|
533
|
+
| Injection Detection | ✅ | | | |
|
|
534
|
+
| Encrypted Storage | | ✅ | | |
|
|
535
|
+
| Redaction | | ✅ | | |
|
|
536
|
+
| Sandboxing | | ✅ | | |
|
|
537
|
+
| Intent Tracking | | | ✅ | |
|
|
538
|
+
| Drift Detection | | | ✅ | |
|
|
539
|
+
| Execution Replay | | | ✅ | |
|
|
540
|
+
| Multi-Agent Handoff | | | ✅ | |
|
|
541
|
+
| SOC2 Compliance | | | ✅ | |
|
|
542
|
+
| HIPAA Compliance | | | ✅ | |
|
|
543
|
+
| Task Scheduling | | | ✅ | |
|
|
544
|
+
| Agent Registry | | | ✅ | |
|
|
545
|
+
| Shared State/Locks | | | ✅ | |
|
|
546
|
+
| Blockchain Anchoring | | | ✅ | |
|
|
547
|
+
| Consensus/Voting | | | | ✅ |
|
|
548
|
+
| Agent Messaging | | | | ✅ |
|
|
549
|
+
| Policy Engine | | | | ✅ |
|
|
550
|
+
| Checkpoints/Recovery | | | | ✅ |
|
|
373
551
|
|
|
374
552
|
---
|
|
375
553
|
|
|
376
|
-
##
|
|
554
|
+
## 🗺️ Roadmap
|
|
377
555
|
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
556
|
+
### Current (v1.x)
|
|
557
|
+
- ✅ Mund - Secret & threat scanning
|
|
558
|
+
- ✅ Hord - Secure vault & sandbox
|
|
559
|
+
- ✅ Dōmere - Verification & orchestration
|
|
560
|
+
- ✅ Witan - Consensus, communication & governance
|
|
561
|
+
- ✅ REST API
|
|
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
|
+
---
|
|
383
572
|
|
|
384
573
|
## 📄 License
|
|
385
574
|
|
|
386
|
-
Apache 2.0
|
|
575
|
+
Apache 2.0 - See [LICENSE](LICENSE) for details.
|
|
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.
|
|
387
590
|
|
|
388
591
|
---
|
|
389
592
|
|