dashclaw 2.6.0 → 2.7.0
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 +101 -1
- package/dashclaw.js +20 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# DashClaw SDK (v2.
|
|
1
|
+
# DashClaw SDK (v2.7.0)
|
|
2
2
|
|
|
3
3
|
**Minimal governance runtime for AI agents.**
|
|
4
4
|
|
|
@@ -235,6 +235,106 @@ await claw.syncState({
|
|
|
235
235
|
|
|
236
236
|
---
|
|
237
237
|
|
|
238
|
+
## Agent Identity
|
|
239
|
+
|
|
240
|
+
Enroll agents via public-key pairing and manage approved identities for signature verification. Pairing is available in the v1 legacy SDK; the REST endpoints are callable directly from any HTTP client.
|
|
241
|
+
|
|
242
|
+
### Create Pairing
|
|
243
|
+
|
|
244
|
+
```javascript
|
|
245
|
+
// Node SDK (v1 legacy)
|
|
246
|
+
import { DashClaw } from 'dashclaw/legacy';
|
|
247
|
+
const claw = new DashClaw({ baseUrl, apiKey, agentId });
|
|
248
|
+
|
|
249
|
+
const { pairing } = await claw.createPairing(publicKeyPem, 'RSASSA-PKCS1-v1_5', 'my-agent');
|
|
250
|
+
console.log(pairing.id); // pair_...
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
### Wait for Pairing Approval
|
|
254
|
+
|
|
255
|
+
```javascript
|
|
256
|
+
const approved = await claw.waitForPairing(pairing.id, { timeout: 300 });
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Get Pairing
|
|
260
|
+
|
|
261
|
+
```javascript
|
|
262
|
+
const status = await claw.getPairing(pairingId);
|
|
263
|
+
console.log(status.pairing.status); // pending | approved | expired
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Approve Pairing (Admin)
|
|
267
|
+
|
|
268
|
+
```javascript
|
|
269
|
+
// Direct HTTP — admin API key required
|
|
270
|
+
const res = await fetch(`${baseUrl}/api/pairings/${pairingId}/approve`, {
|
|
271
|
+
method: 'POST',
|
|
272
|
+
headers: { 'x-api-key': adminApiKey }
|
|
273
|
+
});
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
### List Pairings (Admin)
|
|
277
|
+
|
|
278
|
+
```javascript
|
|
279
|
+
const res = await fetch(`${baseUrl}/api/pairings`, {
|
|
280
|
+
headers: { 'x-api-key': adminApiKey }
|
|
281
|
+
});
|
|
282
|
+
const { pairings } = await res.json();
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Register Identity (Admin)
|
|
286
|
+
|
|
287
|
+
```javascript
|
|
288
|
+
// Node SDK (v1 legacy)
|
|
289
|
+
await claw.registerIdentity('agent-007', publicKeyPem, 'RSASSA-PKCS1-v1_5');
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
### List Identities (Admin)
|
|
293
|
+
|
|
294
|
+
```javascript
|
|
295
|
+
const { identities } = await claw.getIdentities();
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### Revoke Identity (Admin)
|
|
299
|
+
|
|
300
|
+
```javascript
|
|
301
|
+
// Direct HTTP — admin API key required
|
|
302
|
+
const res = await fetch(`${baseUrl}/api/identities/${agentId}`, {
|
|
303
|
+
method: 'DELETE',
|
|
304
|
+
headers: { 'x-api-key': adminApiKey }
|
|
305
|
+
});
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
---
|
|
309
|
+
|
|
310
|
+
## Action Context (Auto-Tagging)
|
|
311
|
+
|
|
312
|
+
When sending messages or recording assumptions during an action, use `actionContext()` to automatically tag them with the action_id:
|
|
313
|
+
|
|
314
|
+
### Node.js
|
|
315
|
+
```javascript
|
|
316
|
+
const action = await claw.createAction({ action_type: 'deploy', declared_goal: 'Deploy v2' });
|
|
317
|
+
|
|
318
|
+
const ctx = claw.actionContext(action.action_id);
|
|
319
|
+
await ctx.sendMessage({ to: 'ops-agent', type: 'status', body: 'Starting deploy' });
|
|
320
|
+
await ctx.recordAssumption({ assumption: 'Staging tests passed' });
|
|
321
|
+
await ctx.updateOutcome({ status: 'completed', output_summary: 'Deployed' });
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
### Python
|
|
325
|
+
```python
|
|
326
|
+
action = claw.create_action(action_type="deploy", declared_goal="Deploy v2")
|
|
327
|
+
|
|
328
|
+
with claw.action_context(action["action_id"]) as ctx:
|
|
329
|
+
ctx.send_message("Starting deploy", to="ops-agent")
|
|
330
|
+
ctx.record_assumption({"assumption": "Staging tests passed"})
|
|
331
|
+
ctx.update_outcome(status="completed", output_summary="Deployed")
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Messages sent through the context are automatically correlated with the action in the decisions ledger and timeline.
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
238
338
|
## Error Handling
|
|
239
339
|
|
|
240
340
|
DashClaw uses standard HTTP status codes and custom error classes:
|
package/dashclaw.js
CHANGED
|
@@ -456,6 +456,26 @@ class DashClaw {
|
|
|
456
456
|
});
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
+
/**
|
|
460
|
+
* Create a scoped action context that auto-tags messages and assumptions
|
|
461
|
+
* with the given action_id.
|
|
462
|
+
* @param {string} actionId - The action_id to attach to all operations
|
|
463
|
+
* @returns {{ sendMessage, recordAssumption, updateOutcome }}
|
|
464
|
+
*/
|
|
465
|
+
actionContext(actionId) {
|
|
466
|
+
return {
|
|
467
|
+
sendMessage: ({ to, type, subject, body, threadId, urgent }) => {
|
|
468
|
+
return this.sendMessage({ to, type, subject, body, threadId, urgent, actionId });
|
|
469
|
+
},
|
|
470
|
+
recordAssumption: (assumption) => {
|
|
471
|
+
return this.recordAssumption({ ...assumption, action_id: actionId });
|
|
472
|
+
},
|
|
473
|
+
updateOutcome: (outcome) => {
|
|
474
|
+
return this.updateOutcome(actionId, outcome);
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
|
|
459
479
|
/**
|
|
460
480
|
* GET /api/messages — Fetch this agent's inbox.
|
|
461
481
|
*/
|