dashclaw 4.0.1 → 4.1.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 +53 -12
- package/dashclaw.js +89 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -447,18 +447,6 @@ if (result.recommendation === 'block') {
|
|
|
447
447
|
}
|
|
448
448
|
```
|
|
449
449
|
|
|
450
|
-
### Bulk Sync
|
|
451
|
-
- `syncState(state)` -- Push a full agent state snapshot in a single call.
|
|
452
|
-
|
|
453
|
-
```javascript
|
|
454
|
-
// Push a full state snapshot
|
|
455
|
-
await claw.syncState({
|
|
456
|
-
actions: [{ action_type: 'deploy', status: 'completed' }],
|
|
457
|
-
decisions: [{ decision: 'Chose blue-green deploy' }],
|
|
458
|
-
goals: [{ title: 'Ship v2.4.0' }]
|
|
459
|
-
});
|
|
460
|
-
```
|
|
461
|
-
|
|
462
450
|
---
|
|
463
451
|
|
|
464
452
|
## Agent Identity
|
|
@@ -1012,6 +1000,7 @@ The existing flat registry methods remain available for compatibility:
|
|
|
1012
1000
|
- `claw.createCapability(...)`
|
|
1013
1001
|
- `claw.getCapability(...)`
|
|
1014
1002
|
- `claw.updateCapability(...)`
|
|
1003
|
+
- `claw.deleteCapability(capabilityId)` -- DELETE /api/capabilities/:id; removes a capability from the registry.
|
|
1015
1004
|
|
|
1016
1005
|
Use the canonical capability runtime paths:
|
|
1017
1006
|
|
|
@@ -1033,6 +1022,58 @@ Health responses now include certification and recency fields such as:
|
|
|
1033
1022
|
|
|
1034
1023
|
---
|
|
1035
1024
|
|
|
1025
|
+
## Agent Reputation
|
|
1026
|
+
|
|
1027
|
+
Per-agent trust vectors computed from the org's own governed decisions (actions, guard outcomes, evaluations, feedback). Scores use exponential time decay (90-day half-life) with Bayesian smoothing; `risk_score` wraps DashClaw's existing 0-100 risk numbers rather than inventing a parallel scale. Each vector can be returned with an Ed25519-signed receipt that re-verifies against the instance JWKS. All reads are org-scoped.
|
|
1028
|
+
|
|
1029
|
+
```js
|
|
1030
|
+
// Current vector (stored snapshot, or computed read-only when none exists yet)
|
|
1031
|
+
const { vector } = await claw.getAgentReputation('agent_42');
|
|
1032
|
+
// vector: { reliability_score, completion_rate, policy_violation_rate, approval_adherence,
|
|
1033
|
+
// quality_score, risk_score, volume_weight, confidence, total_events, last_event_at, computed_at }
|
|
1034
|
+
|
|
1035
|
+
// Recompute from evidence, persist the snapshot, and store a signed receipt
|
|
1036
|
+
await claw.recomputeAgentReputation('agent_42');
|
|
1037
|
+
|
|
1038
|
+
// Paginated reputation events
|
|
1039
|
+
await claw.listAgentReputationEvents('agent_42', { limit: 50, offset: 0 });
|
|
1040
|
+
|
|
1041
|
+
// Signed receipt + verification against the instance's published keys
|
|
1042
|
+
const { receipt } = await claw.getAgentReputationReceipt('agent_42');
|
|
1043
|
+
const { ok } = await claw.verifyReputationReceipt(receipt);
|
|
1044
|
+
```
|
|
1045
|
+
|
|
1046
|
+
- `claw.getAgentReputation(agentId)` -- GET /api/reputation/agents/:agentId
|
|
1047
|
+
- `claw.listAgentReputationEvents(agentId, { limit, offset })` -- GET /api/reputation/agents/:agentId/events
|
|
1048
|
+
- `claw.recomputeAgentReputation(agentId)` -- POST /api/reputation/agents/:agentId/recompute
|
|
1049
|
+
- `claw.getAgentReputationReceipt(agentId)` -- GET /api/reputation/agents/:agentId/receipt
|
|
1050
|
+
- `claw.verifyReputationReceipt(receipt)` -- POST /api/reputation/verify
|
|
1051
|
+
|
|
1052
|
+
---
|
|
1053
|
+
|
|
1054
|
+
## Agent Registry
|
|
1055
|
+
|
|
1056
|
+
Register external, org-owned providers that group existing capabilities and are invoked through governance. An invocation routes through the existing capability runtime (auth, timeout, retry, request/response mapping, SSRF defense), the guard, and the action ledger; the registry never reimplements HTTP. Risk derives from the provider's `risk_class` + budget + the capability's metadata via the existing risk map and predictive risk.
|
|
1057
|
+
|
|
1058
|
+
```js
|
|
1059
|
+
const { registered_agent } = await claw.registerAgent({ name: 'Pricing API', endpoint: 'https://pricing.example.com', auth_type: 'bearer', risk_class: 'high', default_budget_usd: 5 });
|
|
1060
|
+
await claw.addAgentCapability(registered_agent.entry_id, 'cap_123');
|
|
1061
|
+
await claw.listAgentCapabilities(registered_agent.entry_id);
|
|
1062
|
+
const result = await claw.invokeRegisteredAgent({ registered_agent_id: registered_agent.entry_id, capability_id: 'cap_123', agent_id: 'agent-1', payload: { q: 'sku-9' } });
|
|
1063
|
+
```
|
|
1064
|
+
|
|
1065
|
+
- `claw.registerAgent(data)` -- POST /api/agents/registry
|
|
1066
|
+
- `claw.listRegisteredAgents(filters)` -- GET /api/agents/registry
|
|
1067
|
+
- `claw.getRegisteredAgent(id)` -- GET /api/agents/registry/:id
|
|
1068
|
+
- `claw.updateRegisteredAgent(id, patch)` -- PATCH /api/agents/registry/:id
|
|
1069
|
+
- `claw.addAgentCapability(id, capabilityId)` -- POST /api/agents/registry/:id/capabilities
|
|
1070
|
+
- `claw.listAgentCapabilities(id)` -- GET /api/agents/registry/:id/capabilities
|
|
1071
|
+
- `claw.invokeRegisteredAgent({ registered_agent_id, capability_id, agent_id?, payload?, declared_goal? })` -- POST /api/agents/invoke
|
|
1072
|
+
|
|
1073
|
+
x402 and auth metadata are recorded on the provider (`auth_metadata`); no payment settlement is performed.
|
|
1074
|
+
|
|
1075
|
+
---
|
|
1076
|
+
|
|
1036
1077
|
## Hosted provisioning (operator surface — not an SDK method)
|
|
1037
1078
|
|
|
1038
1079
|
When `DASHCLAW_HOSTED=true` the deployment exposes `/api/hosted/*` routes for one-click trial provisioning. These are operator-facing routes, not SDK methods — they produce the API key the SDK consumes.
|
package/dashclaw.js
CHANGED
|
@@ -1326,6 +1326,95 @@ class DashClaw {
|
|
|
1326
1326
|
async previewScorer({ scorer_type, config, sample } = {}) {
|
|
1327
1327
|
return this._request('/api/evaluations/scorers/preview', 'POST', { scorer_type, config, sample });
|
|
1328
1328
|
}
|
|
1329
|
+
|
|
1330
|
+
// ---------------------------------------------------------------------------
|
|
1331
|
+
// Agent Reputation — per-agent trust vector, events, and signed receipts.
|
|
1332
|
+
// ---------------------------------------------------------------------------
|
|
1333
|
+
|
|
1334
|
+
/**
|
|
1335
|
+
* GET /api/reputation/agents/:agentId — current reputation vector.
|
|
1336
|
+
* @returns {Promise<{ agent_id, vector, source }>}
|
|
1337
|
+
*/
|
|
1338
|
+
async getAgentReputation(agentId) {
|
|
1339
|
+
return this._request(`/api/reputation/agents/${agentId}`, 'GET');
|
|
1340
|
+
}
|
|
1341
|
+
|
|
1342
|
+
/**
|
|
1343
|
+
* GET /api/reputation/agents/:agentId/events — paginated reputation events.
|
|
1344
|
+
* @param {string} agentId
|
|
1345
|
+
* @param {Object} [filters] - { limit?, offset? }
|
|
1346
|
+
*/
|
|
1347
|
+
async listAgentReputationEvents(agentId, filters = {}) {
|
|
1348
|
+
return this._request(`/api/reputation/agents/${agentId}/events`, 'GET', null, filters);
|
|
1349
|
+
}
|
|
1350
|
+
|
|
1351
|
+
/**
|
|
1352
|
+
* POST /api/reputation/agents/:agentId/recompute — recompute the vector from
|
|
1353
|
+
* evidence, persist the snapshot, and store a signed receipt.
|
|
1354
|
+
*/
|
|
1355
|
+
async recomputeAgentReputation(agentId) {
|
|
1356
|
+
return this._request(`/api/reputation/agents/${agentId}/recompute`, 'POST');
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
/**
|
|
1360
|
+
* GET /api/reputation/agents/:agentId/receipt — signed receipt for the vector.
|
|
1361
|
+
*/
|
|
1362
|
+
async getAgentReputationReceipt(agentId) {
|
|
1363
|
+
return this._request(`/api/reputation/agents/${agentId}/receipt`, 'GET');
|
|
1364
|
+
}
|
|
1365
|
+
|
|
1366
|
+
/**
|
|
1367
|
+
* POST /api/reputation/verify — verify a reputation receipt against the
|
|
1368
|
+
* instance's published signing keys. Returns { ok, kid?, reason? }.
|
|
1369
|
+
* @param {Object} receipt - a signed reputation receipt
|
|
1370
|
+
*/
|
|
1371
|
+
async verifyReputationReceipt(receipt) {
|
|
1372
|
+
return this._request('/api/reputation/verify', 'POST', { receipt });
|
|
1373
|
+
}
|
|
1374
|
+
|
|
1375
|
+
// ---------------------------------------------------------------------------
|
|
1376
|
+
// Agent Registry — register external delegatable providers; invocations are
|
|
1377
|
+
// governed by the existing capability runtime + guard + action ledger.
|
|
1378
|
+
// ---------------------------------------------------------------------------
|
|
1379
|
+
|
|
1380
|
+
/** POST /api/agents/registry — register an external provider. */
|
|
1381
|
+
async registerAgent(data = {}) {
|
|
1382
|
+
return this._request('/api/agents/registry', 'POST', data);
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
/** GET /api/agents/registry — list registered agents. */
|
|
1386
|
+
async listRegisteredAgents(filters = {}) {
|
|
1387
|
+
return this._request('/api/agents/registry', 'GET', null, filters);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/** GET /api/agents/registry/:id — registered agent detail. */
|
|
1391
|
+
async getRegisteredAgent(id) {
|
|
1392
|
+
return this._request(`/api/agents/registry/${id}`, 'GET');
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/** PATCH /api/agents/registry/:id — update a registered agent. */
|
|
1396
|
+
async updateRegisteredAgent(id, patch = {}) {
|
|
1397
|
+
return this._request(`/api/agents/registry/${id}`, 'PATCH', patch);
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/** POST /api/agents/registry/:id/capabilities — group a capability under the agent. */
|
|
1401
|
+
async addAgentCapability(id, capabilityId) {
|
|
1402
|
+
return this._request(`/api/agents/registry/${id}/capabilities`, 'POST', { capability_id: capabilityId });
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/** GET /api/agents/registry/:id/capabilities — capabilities grouped under the agent. */
|
|
1406
|
+
async listAgentCapabilities(id) {
|
|
1407
|
+
return this._request(`/api/agents/registry/${id}/capabilities`, 'GET');
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/**
|
|
1411
|
+
* POST /api/agents/invoke — invoke a capability through a registered agent,
|
|
1412
|
+
* governed end to end by the existing capability runtime + guard + action.
|
|
1413
|
+
* @param {Object} args - { registered_agent_id, capability_id, agent_id?, payload?, declared_goal? }
|
|
1414
|
+
*/
|
|
1415
|
+
async invokeRegisteredAgent({ registered_agent_id, capability_id, agent_id, payload, declared_goal } = {}) {
|
|
1416
|
+
return this._request('/api/agents/invoke', 'POST', { registered_agent_id, capability_id, agent_id, payload, declared_goal });
|
|
1417
|
+
}
|
|
1329
1418
|
}
|
|
1330
1419
|
|
|
1331
1420
|
export { DashClaw, ApprovalDeniedError, GuardBlockedError };
|