dashclaw 4.0.2 → 4.1.1
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 -0
- package/dashclaw.js +94 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,6 +56,7 @@ const { action, action_id } = await claw.createAction({
|
|
|
56
56
|
action_type: 'deploy',
|
|
57
57
|
declared_goal: 'Ship v2.4.0 to production',
|
|
58
58
|
risk_score: 90,
|
|
59
|
+
// session_id: 'sess_…' // optional: link to a started session for exact attribution (else server correlates by agent + time window)
|
|
59
60
|
});
|
|
60
61
|
|
|
61
62
|
// 3. If the server flagged this for human review, wait for an operator.
|
|
@@ -1022,6 +1023,58 @@ Health responses now include certification and recency fields such as:
|
|
|
1022
1023
|
|
|
1023
1024
|
---
|
|
1024
1025
|
|
|
1026
|
+
## Agent Reputation
|
|
1027
|
+
|
|
1028
|
+
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.
|
|
1029
|
+
|
|
1030
|
+
```js
|
|
1031
|
+
// Current vector (stored snapshot, or computed read-only when none exists yet)
|
|
1032
|
+
const { vector } = await claw.getAgentReputation('agent_42');
|
|
1033
|
+
// vector: { reliability_score, completion_rate, policy_violation_rate, approval_adherence,
|
|
1034
|
+
// quality_score, risk_score, volume_weight, confidence, total_events, last_event_at, computed_at }
|
|
1035
|
+
|
|
1036
|
+
// Recompute from evidence, persist the snapshot, and store a signed receipt
|
|
1037
|
+
await claw.recomputeAgentReputation('agent_42');
|
|
1038
|
+
|
|
1039
|
+
// Paginated reputation events
|
|
1040
|
+
await claw.listAgentReputationEvents('agent_42', { limit: 50, offset: 0 });
|
|
1041
|
+
|
|
1042
|
+
// Signed receipt + verification against the instance's published keys
|
|
1043
|
+
const { receipt } = await claw.getAgentReputationReceipt('agent_42');
|
|
1044
|
+
const { ok } = await claw.verifyReputationReceipt(receipt);
|
|
1045
|
+
```
|
|
1046
|
+
|
|
1047
|
+
- `claw.getAgentReputation(agentId)` -- GET /api/reputation/agents/:agentId
|
|
1048
|
+
- `claw.listAgentReputationEvents(agentId, { limit, offset })` -- GET /api/reputation/agents/:agentId/events
|
|
1049
|
+
- `claw.recomputeAgentReputation(agentId)` -- POST /api/reputation/agents/:agentId/recompute
|
|
1050
|
+
- `claw.getAgentReputationReceipt(agentId)` -- GET /api/reputation/agents/:agentId/receipt
|
|
1051
|
+
- `claw.verifyReputationReceipt(receipt)` -- POST /api/reputation/verify
|
|
1052
|
+
|
|
1053
|
+
---
|
|
1054
|
+
|
|
1055
|
+
## Agent Registry
|
|
1056
|
+
|
|
1057
|
+
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.
|
|
1058
|
+
|
|
1059
|
+
```js
|
|
1060
|
+
const { registered_agent } = await claw.registerAgent({ name: 'Pricing API', endpoint: 'https://pricing.example.com', auth_type: 'bearer', risk_class: 'high', default_budget_usd: 5 });
|
|
1061
|
+
await claw.addAgentCapability(registered_agent.entry_id, 'cap_123');
|
|
1062
|
+
await claw.listAgentCapabilities(registered_agent.entry_id);
|
|
1063
|
+
const result = await claw.invokeRegisteredAgent({ registered_agent_id: registered_agent.entry_id, capability_id: 'cap_123', agent_id: 'agent-1', payload: { q: 'sku-9' } });
|
|
1064
|
+
```
|
|
1065
|
+
|
|
1066
|
+
- `claw.registerAgent(data)` -- POST /api/agents/registry
|
|
1067
|
+
- `claw.listRegisteredAgents(filters)` -- GET /api/agents/registry
|
|
1068
|
+
- `claw.getRegisteredAgent(id)` -- GET /api/agents/registry/:id
|
|
1069
|
+
- `claw.updateRegisteredAgent(id, patch)` -- PATCH /api/agents/registry/:id
|
|
1070
|
+
- `claw.addAgentCapability(id, capabilityId)` -- POST /api/agents/registry/:id/capabilities
|
|
1071
|
+
- `claw.listAgentCapabilities(id)` -- GET /api/agents/registry/:id/capabilities
|
|
1072
|
+
- `claw.invokeRegisteredAgent({ registered_agent_id, capability_id, agent_id?, payload?, declared_goal? })` -- POST /api/agents/invoke
|
|
1073
|
+
|
|
1074
|
+
x402 and auth metadata are recorded on the provider (`auth_metadata`); no payment settlement is performed.
|
|
1075
|
+
|
|
1076
|
+
---
|
|
1077
|
+
|
|
1025
1078
|
## Hosted provisioning (operator surface — not an SDK method)
|
|
1026
1079
|
|
|
1027
1080
|
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
|
@@ -164,7 +164,12 @@ class DashClaw {
|
|
|
164
164
|
* to have a `non_fabrication` guard policy verify the content before the
|
|
165
165
|
* action proceeds. A violation blocks the action or routes it to approval and
|
|
166
166
|
* is recorded with a signed receipt in the decision ledger.
|
|
167
|
+
*
|
|
168
|
+
* Optional `session_id`: pass the id from `createSession()` to link this
|
|
169
|
+
* action to a session via the Direct path (exact attribution). When omitted,
|
|
170
|
+
* the server falls back to time-window correlation by agent_id.
|
|
167
171
|
* @param {Object} action
|
|
172
|
+
* @param {string} [action.session_id] Session to attribute this action to.
|
|
168
173
|
*/
|
|
169
174
|
async createAction(action) {
|
|
170
175
|
return this._request('/api/actions', 'POST', {
|
|
@@ -1326,6 +1331,95 @@ class DashClaw {
|
|
|
1326
1331
|
async previewScorer({ scorer_type, config, sample } = {}) {
|
|
1327
1332
|
return this._request('/api/evaluations/scorers/preview', 'POST', { scorer_type, config, sample });
|
|
1328
1333
|
}
|
|
1334
|
+
|
|
1335
|
+
// ---------------------------------------------------------------------------
|
|
1336
|
+
// Agent Reputation — per-agent trust vector, events, and signed receipts.
|
|
1337
|
+
// ---------------------------------------------------------------------------
|
|
1338
|
+
|
|
1339
|
+
/**
|
|
1340
|
+
* GET /api/reputation/agents/:agentId — current reputation vector.
|
|
1341
|
+
* @returns {Promise<{ agent_id, vector, source }>}
|
|
1342
|
+
*/
|
|
1343
|
+
async getAgentReputation(agentId) {
|
|
1344
|
+
return this._request(`/api/reputation/agents/${agentId}`, 'GET');
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* GET /api/reputation/agents/:agentId/events — paginated reputation events.
|
|
1349
|
+
* @param {string} agentId
|
|
1350
|
+
* @param {Object} [filters] - { limit?, offset? }
|
|
1351
|
+
*/
|
|
1352
|
+
async listAgentReputationEvents(agentId, filters = {}) {
|
|
1353
|
+
return this._request(`/api/reputation/agents/${agentId}/events`, 'GET', null, filters);
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
/**
|
|
1357
|
+
* POST /api/reputation/agents/:agentId/recompute — recompute the vector from
|
|
1358
|
+
* evidence, persist the snapshot, and store a signed receipt.
|
|
1359
|
+
*/
|
|
1360
|
+
async recomputeAgentReputation(agentId) {
|
|
1361
|
+
return this._request(`/api/reputation/agents/${agentId}/recompute`, 'POST');
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/**
|
|
1365
|
+
* GET /api/reputation/agents/:agentId/receipt — signed receipt for the vector.
|
|
1366
|
+
*/
|
|
1367
|
+
async getAgentReputationReceipt(agentId) {
|
|
1368
|
+
return this._request(`/api/reputation/agents/${agentId}/receipt`, 'GET');
|
|
1369
|
+
}
|
|
1370
|
+
|
|
1371
|
+
/**
|
|
1372
|
+
* POST /api/reputation/verify — verify a reputation receipt against the
|
|
1373
|
+
* instance's published signing keys. Returns { ok, kid?, reason? }.
|
|
1374
|
+
* @param {Object} receipt - a signed reputation receipt
|
|
1375
|
+
*/
|
|
1376
|
+
async verifyReputationReceipt(receipt) {
|
|
1377
|
+
return this._request('/api/reputation/verify', 'POST', { receipt });
|
|
1378
|
+
}
|
|
1379
|
+
|
|
1380
|
+
// ---------------------------------------------------------------------------
|
|
1381
|
+
// Agent Registry — register external delegatable providers; invocations are
|
|
1382
|
+
// governed by the existing capability runtime + guard + action ledger.
|
|
1383
|
+
// ---------------------------------------------------------------------------
|
|
1384
|
+
|
|
1385
|
+
/** POST /api/agents/registry — register an external provider. */
|
|
1386
|
+
async registerAgent(data = {}) {
|
|
1387
|
+
return this._request('/api/agents/registry', 'POST', data);
|
|
1388
|
+
}
|
|
1389
|
+
|
|
1390
|
+
/** GET /api/agents/registry — list registered agents. */
|
|
1391
|
+
async listRegisteredAgents(filters = {}) {
|
|
1392
|
+
return this._request('/api/agents/registry', 'GET', null, filters);
|
|
1393
|
+
}
|
|
1394
|
+
|
|
1395
|
+
/** GET /api/agents/registry/:id — registered agent detail. */
|
|
1396
|
+
async getRegisteredAgent(id) {
|
|
1397
|
+
return this._request(`/api/agents/registry/${id}`, 'GET');
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/** PATCH /api/agents/registry/:id — update a registered agent. */
|
|
1401
|
+
async updateRegisteredAgent(id, patch = {}) {
|
|
1402
|
+
return this._request(`/api/agents/registry/${id}`, 'PATCH', patch);
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
/** POST /api/agents/registry/:id/capabilities — group a capability under the agent. */
|
|
1406
|
+
async addAgentCapability(id, capabilityId) {
|
|
1407
|
+
return this._request(`/api/agents/registry/${id}/capabilities`, 'POST', { capability_id: capabilityId });
|
|
1408
|
+
}
|
|
1409
|
+
|
|
1410
|
+
/** GET /api/agents/registry/:id/capabilities — capabilities grouped under the agent. */
|
|
1411
|
+
async listAgentCapabilities(id) {
|
|
1412
|
+
return this._request(`/api/agents/registry/${id}/capabilities`, 'GET');
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
/**
|
|
1416
|
+
* POST /api/agents/invoke — invoke a capability through a registered agent,
|
|
1417
|
+
* governed end to end by the existing capability runtime + guard + action.
|
|
1418
|
+
* @param {Object} args - { registered_agent_id, capability_id, agent_id?, payload?, declared_goal? }
|
|
1419
|
+
*/
|
|
1420
|
+
async invokeRegisteredAgent({ registered_agent_id, capability_id, agent_id, payload, declared_goal } = {}) {
|
|
1421
|
+
return this._request('/api/agents/invoke', 'POST', { registered_agent_id, capability_id, agent_id, payload, declared_goal });
|
|
1422
|
+
}
|
|
1329
1423
|
}
|
|
1330
1424
|
|
|
1331
1425
|
export { DashClaw, ApprovalDeniedError, GuardBlockedError };
|