@weave_protocol/domere 1.0.14 → 1.0.16
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 +278 -31
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,55 +1,302 @@
|
|
|
1
|
-
# Dōmere -
|
|
1
|
+
# ⚖️ Dōmere - Judge Protocol
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://www.npmjs.com/package/@weave_protocol/domere)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
[](https://www.npmjs.com/package/@weave_protocol/domere)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
**Enterprise-grade verification, compliance, and audit infrastructure for AI agents.**
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
Part of the [Weave Protocol Security Suite](https://github.com/Tyox-all/Weave_Protocol).
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
## ✨ Features
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
- 🎯 **Intent Tracking** - Track and verify agent intent throughout execution
|
|
14
|
+
- 🔄 **Execution Replay** - Complete audit trails with cryptographic verification
|
|
15
|
+
- 🤝 **Multi-Agent Handoff** - Secure delegation between AI agents
|
|
16
|
+
- 📋 **Compliance Checkpoints** - SOC2, HIPAA, GDPR automated tracking
|
|
17
|
+
- ⛓️ **Blockchain Anchoring** - Immutable proof on Solana & Ethereum
|
|
18
|
+
- 🔍 **Drift Detection** - Detect when agents deviate from original intent
|
|
12
19
|
|
|
13
|
-
|
|
14
|
-
Track intent from origin through every hop with cryptographic signatures.
|
|
20
|
+
## 📦 Installation
|
|
15
21
|
|
|
16
|
-
|
|
17
|
-
|
|
22
|
+
```bash
|
|
23
|
+
npm install @weave_protocol/domere
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## 🚀 Quick Start
|
|
27
|
+
|
|
28
|
+
### Thread Management
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { ThreadManager } from '@weave_protocol/domere';
|
|
32
|
+
|
|
33
|
+
const manager = new ThreadManager();
|
|
34
|
+
|
|
35
|
+
// Create verified thread
|
|
36
|
+
const thread = await manager.createThread({
|
|
37
|
+
origin_type: 'human',
|
|
38
|
+
origin_identity: 'user@company.com',
|
|
39
|
+
intent: 'Generate quarterly report',
|
|
40
|
+
constraints: ['read-only', 'no-external-api']
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Check for intent drift
|
|
44
|
+
const drift = await manager.checkDrift(thread.id, 'Sending data to external API');
|
|
45
|
+
// → { drifted: true, reason: 'Violates no-external-api constraint' }
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 🔄 Execution Replay
|
|
49
|
+
|
|
50
|
+
Complete audit trail with cryptographic verification for forensic analysis.
|
|
51
|
+
|
|
52
|
+
```typescript
|
|
53
|
+
import { ExecutionReplayManager } from '@weave_protocol/domere';
|
|
54
|
+
|
|
55
|
+
const replay = new ExecutionReplayManager('encryption-key');
|
|
56
|
+
|
|
57
|
+
// Record every agent action
|
|
58
|
+
await replay.recordAction({
|
|
59
|
+
thread_id: 'thr_xxx',
|
|
60
|
+
agent_id: 'gpt-4-agent',
|
|
61
|
+
agent_type: 'llm',
|
|
62
|
+
action_type: 'inference',
|
|
63
|
+
action_name: 'generate_report',
|
|
64
|
+
input: { prompt: '...' },
|
|
65
|
+
output: { response: '...' },
|
|
66
|
+
latency_ms: 1250,
|
|
67
|
+
cost_usd: 0.03,
|
|
68
|
+
tokens_in: 500,
|
|
69
|
+
tokens_out: 1000,
|
|
70
|
+
model: 'gpt-4',
|
|
71
|
+
provider: 'openai'
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// Get complete execution trail
|
|
75
|
+
const trail = await replay.getExecutionTrail('thr_xxx');
|
|
76
|
+
console.log(trail.integrity_valid); // true - chain is tamper-proof
|
|
77
|
+
console.log(trail.merkle_root); // For blockchain anchoring
|
|
78
|
+
|
|
79
|
+
// Generate audit report
|
|
80
|
+
const report = await replay.generateAuditReport({
|
|
81
|
+
thread_id: 'thr_xxx',
|
|
82
|
+
start_time: new Date('2026-01-01'),
|
|
83
|
+
end_time: new Date('2026-01-31')
|
|
84
|
+
});
|
|
85
|
+
// → { total_actions: 150, total_cost_usd: 4.50, anomalies: [...] }
|
|
86
|
+
```
|
|
18
87
|
|
|
19
|
-
###
|
|
20
|
-
Immutable proof on Solana (about $0.001) or Ethereum (about $2-10).
|
|
88
|
+
### 🤝 Multi-Agent Handoff Verification
|
|
21
89
|
|
|
22
|
-
|
|
90
|
+
Secure delegation between AI agents with permission inheritance.
|
|
23
91
|
|
|
24
92
|
```typescript
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
93
|
+
import { HandoffManager } from '@weave_protocol/domere';
|
|
94
|
+
|
|
95
|
+
const handoff = new HandoffManager('signing-key', {
|
|
96
|
+
max_delegation_depth: 5,
|
|
97
|
+
max_handoff_duration_ms: 3600000 // 1 hour
|
|
30
98
|
});
|
|
31
99
|
|
|
32
|
-
//
|
|
33
|
-
const
|
|
34
|
-
thread_id:
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
100
|
+
// Agent A delegates to Agent B
|
|
101
|
+
const token = await handoff.createHandoff({
|
|
102
|
+
thread_id: 'thr_xxx',
|
|
103
|
+
from_agent: 'orchestrator',
|
|
104
|
+
to_agent: 'researcher',
|
|
105
|
+
delegated_intent: 'Find Q3 revenue data',
|
|
106
|
+
constraints: ['read-only', 'internal-data-only'],
|
|
107
|
+
permissions: [
|
|
108
|
+
{ resource: 'database', actions: ['read'] },
|
|
109
|
+
{ resource: 'files', actions: ['read'] }
|
|
110
|
+
],
|
|
111
|
+
max_actions: 10,
|
|
112
|
+
expires_in_ms: 300000 // 5 minutes
|
|
38
113
|
});
|
|
39
114
|
|
|
40
|
-
//
|
|
115
|
+
// Agent B verifies before acting
|
|
116
|
+
const verification = await handoff.verifyHandoff(token.token, 'researcher');
|
|
117
|
+
if (verification.valid) {
|
|
118
|
+
console.log('Remaining actions:', verification.remaining_actions);
|
|
119
|
+
console.log('Constraints:', verification.constraints);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Track delegation chain
|
|
123
|
+
const chain = await handoff.getDelegationChain('thr_xxx');
|
|
124
|
+
console.log('Delegation depth:', chain.depth);
|
|
125
|
+
console.log('Chain integrity:', chain.integrity_valid);
|
|
41
126
|
```
|
|
42
127
|
|
|
43
|
-
|
|
128
|
+
### 📋 Compliance Checkpoints - SOC2/HIPAA
|
|
129
|
+
|
|
130
|
+
Automated compliance tracking and reporting.
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import { ComplianceManager } from '@weave_protocol/domere';
|
|
134
|
+
|
|
135
|
+
const compliance = new ComplianceManager('signing-key');
|
|
136
|
+
|
|
137
|
+
// HIPAA: Log PHI access
|
|
138
|
+
await compliance.logPHIAccess({
|
|
139
|
+
thread_id: 'thr_xxx',
|
|
140
|
+
agent_id: 'medical-assistant',
|
|
141
|
+
patient_id: 'patient_123',
|
|
142
|
+
access_reason: 'Treatment recommendation',
|
|
143
|
+
data_accessed: ['diagnosis', 'medications'],
|
|
144
|
+
legal_basis: 'treatment'
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
// SOC2: Log access control event
|
|
148
|
+
await compliance.logAccessControl({
|
|
149
|
+
thread_id: 'thr_xxx',
|
|
150
|
+
agent_id: 'admin-bot',
|
|
151
|
+
user_id: 'user_456',
|
|
152
|
+
resource: 'financial-reports',
|
|
153
|
+
action: 'grant',
|
|
154
|
+
success: true
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
// Generic compliance checkpoint
|
|
158
|
+
await compliance.checkpoint({
|
|
159
|
+
thread_id: 'thr_xxx',
|
|
160
|
+
framework: 'SOC2',
|
|
161
|
+
control: 'CC6.1', // Logical Access Security
|
|
162
|
+
event_type: 'access',
|
|
163
|
+
event_description: 'User accessed sensitive data',
|
|
164
|
+
data_classification: 'confidential',
|
|
165
|
+
agent_id: 'data-agent',
|
|
166
|
+
sign: true
|
|
167
|
+
});
|
|
168
|
+
|
|
169
|
+
// Generate compliance report
|
|
170
|
+
const report = await compliance.generateReport({
|
|
171
|
+
framework: 'HIPAA',
|
|
172
|
+
period_start: new Date('2026-01-01'),
|
|
173
|
+
period_end: new Date('2026-03-31'),
|
|
174
|
+
attester: 'Compliance Officer'
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
console.log('Compliance Score:', report.compliance_score);
|
|
178
|
+
console.log('Open Violations:', report.open_violations);
|
|
179
|
+
console.log('Control Coverage:', report.control_coverage);
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### ⛓️ Blockchain Anchoring
|
|
183
|
+
|
|
184
|
+
Immutable proof of AI agent actions on Solana and Ethereum.
|
|
185
|
+
|
|
186
|
+
```typescript
|
|
187
|
+
import { SolanaAnchor, EthereumAnchor } from '@weave_protocol/domere';
|
|
188
|
+
|
|
189
|
+
// Solana (Devnet)
|
|
190
|
+
const solana = new SolanaAnchor({
|
|
191
|
+
rpc_url: 'https://api.devnet.solana.com',
|
|
192
|
+
program_id: 'BeCYVJYfbUu3k2TPGmh9VoGWeJwzm2hg2NdtnvbdBNCj'
|
|
193
|
+
});
|
|
194
|
+
|
|
195
|
+
await solana.anchorThread({
|
|
196
|
+
thread_id: 'thr_xxx',
|
|
197
|
+
merkle_root: trail.merkle_root,
|
|
198
|
+
hop_count: 5,
|
|
199
|
+
intent_hash: thread.intent_hash,
|
|
200
|
+
compliant: true
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
// Ethereum (Mainnet)
|
|
204
|
+
const ethereum = new EthereumAnchor({
|
|
205
|
+
rpc_url: 'https://mainnet.infura.io/v3/YOUR_KEY',
|
|
206
|
+
contract_address: '0xAA8b52adD3CEce6269d14C6335a79df451543820'
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
await ethereum.anchorThread({
|
|
210
|
+
thread_id: 'thr_xxx',
|
|
211
|
+
merkle_root: trail.merkle_root,
|
|
212
|
+
hop_count: 5,
|
|
213
|
+
intent_hash: thread.intent_hash,
|
|
214
|
+
compliant: true
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
## ⛓️ Blockchain Deployments
|
|
219
|
+
|
|
220
|
+
| Chain | Network | Contract/Program | Explorer |
|
|
221
|
+
|-------|---------|------------------|----------|
|
|
222
|
+
| **Solana** | Devnet | `BeCYVJYfbUu3k2TPGmh9VoGWeJwzm2hg2NdtnvbdBNCj` | [View](https://solscan.io/account/BeCYVJYfbUu3k2TPGmh9VoGWeJwzm2hg2NdtnvbdBNCj?cluster=devnet) |
|
|
223
|
+
| **Ethereum** | Mainnet | `0xAA8b52adD3CEce6269d14C6335a79df451543820` | [View](https://etherscan.io/address/0xAA8b52adD3CEce6269d14C6335a79df451543820) |
|
|
224
|
+
|
|
225
|
+
## 📚 API Reference
|
|
226
|
+
|
|
227
|
+
### ExecutionReplayManager
|
|
228
|
+
|
|
229
|
+
| Method | Description |
|
|
230
|
+
|--------|-------------|
|
|
231
|
+
| `recordAction(params)` | Record an action in the audit trail |
|
|
232
|
+
| `getExecutionTrail(threadId)` | Get complete trail for a thread |
|
|
233
|
+
| `replayActions(threadId)` | Replay actions for analysis |
|
|
234
|
+
| `generateAuditReport(query)` | Generate audit report |
|
|
235
|
+
| `verifyTrailIntegrity(actions)` | Verify chain hasn't been tampered |
|
|
236
|
+
| `exportTrail(threadId)` | Export trail as JSON |
|
|
237
|
+
| `importTrail(data)` | Import trail from JSON |
|
|
238
|
+
|
|
239
|
+
### HandoffManager
|
|
240
|
+
|
|
241
|
+
| Method | Description |
|
|
242
|
+
|--------|-------------|
|
|
243
|
+
| `createHandoff(params)` | Create delegation token |
|
|
244
|
+
| `verifyHandoff(token, agentId)` | Verify token before acting |
|
|
245
|
+
| `recordAction(handoffId, action)` | Record action under handoff |
|
|
246
|
+
| `revokeHandoff(handoffId)` | Revoke handoff and children |
|
|
247
|
+
| `getDelegationChain(threadId)` | Get full delegation chain |
|
|
248
|
+
| `checkPermission(handoffId, resource, action)` | Check if action permitted |
|
|
249
|
+
|
|
250
|
+
### ComplianceManager
|
|
251
|
+
|
|
252
|
+
| Method | Description |
|
|
253
|
+
|--------|-------------|
|
|
254
|
+
| `checkpoint(params)` | Record compliance checkpoint |
|
|
255
|
+
| `logPHIAccess(params)` | HIPAA: Log PHI access |
|
|
256
|
+
| `logAccessControl(params)` | SOC2: Log access control |
|
|
257
|
+
| `recordViolation(params)` | Record compliance violation |
|
|
258
|
+
| `updateRemediation(id, status)` | Update remediation status |
|
|
259
|
+
| `generateReport(params)` | Generate compliance report |
|
|
260
|
+
| `getCheckpoints(threadId)` | Get checkpoints for thread |
|
|
261
|
+
| `getViolations(threadId)` | Get violations for thread |
|
|
262
|
+
|
|
263
|
+
## 🏗️ Architecture
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
┌─────────────────────────────────────────────────────────────────┐
|
|
267
|
+
│ Dōmere - Judge Protocol │
|
|
268
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
269
|
+
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────────────────┐ │
|
|
270
|
+
│ │ Execution │ │ Handoff │ │ Compliance │ │
|
|
271
|
+
│ │ Replay │ │ Manager │ │ Manager │ │
|
|
272
|
+
│ ├─────────────┤ ├─────────────┤ ├─────────────────────────┤ │
|
|
273
|
+
│ │ • Recording │ │ • Tokens │ │ • SOC2 Controls │ │
|
|
274
|
+
│ │ • Trails │ │ • Verify │ │ • HIPAA Controls │ │
|
|
275
|
+
│ │ • Reports │ │ • Revoke │ │ • Checkpoints │ │
|
|
276
|
+
│ │ • Anomalies │ │ • Chain │ │ • Violations │ │
|
|
277
|
+
│ └─────────────┘ └─────────────┘ │ • Reports │ │
|
|
278
|
+
│ └─────────────────────────┘ │
|
|
279
|
+
├─────────────────────────────────────────────────────────────────┤
|
|
280
|
+
│ ┌─────────────────────────┐ ┌─────────────────────────────┐ │
|
|
281
|
+
│ │ Thread Manager │ │ Blockchain Anchoring │ │
|
|
282
|
+
│ │ • Intent Tracking │ │ • Solana (Devnet) │ │
|
|
283
|
+
│ │ • Drift Detection │ │ • Ethereum (Mainnet) │ │
|
|
284
|
+
│ │ • Constraints │ │ • Merkle Proofs │ │
|
|
285
|
+
│ └─────────────────────────┘ └─────────────────────────────┘ │
|
|
286
|
+
└─────────────────────────────────────────────────────────────────┘
|
|
287
|
+
```
|
|
44
288
|
|
|
45
|
-
|
|
46
|
-
**Paid:** Blockchain anchoring only (you bring your wallet)
|
|
289
|
+
## 🔗 Related Packages
|
|
47
290
|
|
|
48
|
-
|
|
291
|
+
| Package | Description |
|
|
292
|
+
|---------|-------------|
|
|
293
|
+
| [@weave_protocol/mund](https://www.npmjs.com/package/@weave_protocol/mund) | Guardian Protocol - Secret & threat scanning |
|
|
294
|
+
| [@weave_protocol/hord](https://www.npmjs.com/package/@weave_protocol/hord) | Vault Protocol - Secure containment |
|
|
295
|
+
| [@weave_protocol/api](https://www.npmjs.com/package/@weave_protocol/api) | Universal REST API |
|
|
49
296
|
|
|
50
|
-
|
|
297
|
+
## 📄 License
|
|
51
298
|
|
|
52
|
-
Apache
|
|
299
|
+
Apache 2.0 - See [LICENSE](LICENSE) for details.
|
|
53
300
|
|
|
54
301
|
---
|
|
55
302
|
|