dashclaw 1.8.2 → 1.8.3
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 +93 -9
- package/dashclaw.js +16 -17
- package/index.cjs +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
# DashClaw SDK
|
|
1
|
+
# DashClaw SDK: Agent Decision Infrastructure
|
|
2
2
|
|
|
3
3
|
Full reference for the DashClaw SDK (Node.js). For Python, see the [Python SDK docs](../sdk-python/README.md).
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
DashClaw treats every agent action as a governed decision. The SDK provides decision recording, policy enforcement, assumption tracking, and compliance mapping. It proves what your agents decided and why.
|
|
6
|
+
|
|
7
|
+
Install, configure, and govern your AI agents with 95+ methods across 21+ categories including action recording, behavior guard, context management, session handoffs, security scanning, agent messaging, agent pairing, identity binding, organization management, webhooks, policy testing, compliance, task routing, and more.
|
|
6
8
|
|
|
7
9
|
---
|
|
8
10
|
|
|
@@ -111,11 +113,93 @@ try {
|
|
|
111
113
|
}
|
|
112
114
|
```
|
|
113
115
|
|
|
116
|
+
### Compliance & Governance Patterns
|
|
117
|
+
|
|
118
|
+
DashClaw's guard + action recording pipeline maps directly to compliance controls.
|
|
119
|
+
|
|
120
|
+
**SOC 2 CC6.1: Logical Access Controls**
|
|
121
|
+
```javascript
|
|
122
|
+
// Before any high-risk operation, enforce policy
|
|
123
|
+
const guardResult = await claw.guard({
|
|
124
|
+
action_type: 'database_write',
|
|
125
|
+
risk_score: 85,
|
|
126
|
+
systems_touched: ['production_db'],
|
|
127
|
+
reversible: false,
|
|
128
|
+
declared_goal: 'Drop legacy user table'
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
if (guardResult.decision === 'block') {
|
|
132
|
+
// SOC 2 control satisfied: unauthorized action prevented
|
|
133
|
+
console.log('Policy blocked:', guardResult.reasons);
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
// Decision is governed. Record with full lineage
|
|
138
|
+
const { action_id } = await claw.createAction({
|
|
139
|
+
action_type: 'database_write',
|
|
140
|
+
declared_goal: 'Drop legacy user table',
|
|
141
|
+
risk_score: 85,
|
|
142
|
+
reversible: false,
|
|
143
|
+
authorization_scope: 'admin-approved'
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Register the assumption this decision relies on
|
|
147
|
+
await claw.registerAssumption({
|
|
148
|
+
action_id,
|
|
149
|
+
assumption: 'Legacy table has zero active references',
|
|
150
|
+
basis: 'Schema dependency scan completed 2h ago'
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**EU AI Act Article 14: Human Oversight**
|
|
155
|
+
```javascript
|
|
156
|
+
// require_approval forces human-in-the-loop
|
|
157
|
+
const result = await claw.guard({
|
|
158
|
+
action_type: 'customer_communication',
|
|
159
|
+
risk_score: 60,
|
|
160
|
+
declared_goal: 'Send pricing update to 500 customers'
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
if (result.decision === 'require_approval') {
|
|
164
|
+
// Create action in pending state, wait for human approval
|
|
165
|
+
const { action_id } = await claw.createAction({
|
|
166
|
+
action_type: 'customer_communication',
|
|
167
|
+
declared_goal: 'Send pricing update to 500 customers',
|
|
168
|
+
status: 'pending'
|
|
169
|
+
});
|
|
170
|
+
// Approval queue at /approvals shows this to operators
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
**ISO 42001: AI Decision Accountability**
|
|
175
|
+
```javascript
|
|
176
|
+
// Full decision lineage: guard → action → assumptions → outcome
|
|
177
|
+
const { action_id } = await claw.createAction({
|
|
178
|
+
action_type: 'data_processing',
|
|
179
|
+
declared_goal: 'Rebuild customer segmentation model',
|
|
180
|
+
risk_score: 45,
|
|
181
|
+
systems_touched: ['ml-pipeline', 'customer-db']
|
|
182
|
+
});
|
|
183
|
+
|
|
184
|
+
await claw.registerAssumption({
|
|
185
|
+
action_id,
|
|
186
|
+
assumption: 'Customer data is current as of today',
|
|
187
|
+
basis: 'CRM sync completed at 09:00 UTC'
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
// Later: validate or invalidate assumptions
|
|
191
|
+
await claw.validateAssumption(assumptionId, true);
|
|
192
|
+
|
|
193
|
+
// Decision integrity signals auto-detect when assumptions drift
|
|
194
|
+
const signals = await claw.getSignals();
|
|
195
|
+
// → Returns 'assumption_drift' if too many invalidated
|
|
196
|
+
```
|
|
197
|
+
|
|
114
198
|
---
|
|
115
199
|
|
|
116
200
|
## Action Recording
|
|
117
201
|
|
|
118
|
-
Create, update, and query action records. Every agent action
|
|
202
|
+
Create, update, and query action records. Every agent action is a governed decision with a full audit trail capturing intent, reasoning, and outcome for compliance and review.
|
|
119
203
|
|
|
120
204
|
### claw.createAction(action)
|
|
121
205
|
Create a new action record. The agent's agentId, agentName, and swarmId are automatically attached.
|
|
@@ -268,7 +352,7 @@ stream.close();
|
|
|
268
352
|
|
|
269
353
|
### claw.waitForApproval(actionId, { useEvents: true })
|
|
270
354
|
|
|
271
|
-
SSE-powered approval waiting
|
|
355
|
+
SSE-powered approval waiting. Resolves instantly when the operator approves/denies instead of polling every 5 seconds.
|
|
272
356
|
|
|
273
357
|
```javascript
|
|
274
358
|
// SSE mode (instant, recommended)
|
|
@@ -280,7 +364,7 @@ const { action } = await claw.waitForApproval('act_abc');
|
|
|
280
364
|
|
|
281
365
|
| Parameter | Type | Default | Description |
|
|
282
366
|
|-----------|------|---------|-------------|
|
|
283
|
-
| actionId | string |
|
|
367
|
+
| actionId | string | Yes | Action ID to watch |
|
|
284
368
|
| options.timeout | number | 300000 | Max wait time (ms) |
|
|
285
369
|
| options.interval | number | 5000 | Poll interval (polling mode only) |
|
|
286
370
|
| options.useEvents | boolean | false | Use SSE instead of polling |
|
|
@@ -425,7 +509,7 @@ Get current risk signals across all agents. Returns 7 signal types: autonomy_spi
|
|
|
425
509
|
|
|
426
510
|
## Behavior Guard
|
|
427
511
|
|
|
428
|
-
|
|
512
|
+
Guard is the heart of DashClaw. Every action can be checked against policies before execution. Returns allow, warn, block, or require_approval based on configured guard policies.
|
|
429
513
|
|
|
430
514
|
### claw.guard(context, options?)
|
|
431
515
|
Evaluate guard policies for a proposed action. Call this before risky operations to get a go/no-go decision. The agent_id is auto-attached from the SDK constructor.
|
|
@@ -1128,7 +1212,7 @@ Get a URL to download an attachment.
|
|
|
1128
1212
|
|---|---|---|
|
|
1129
1213
|
| `attachmentId` | `string` | Attachment ID (`att_*`) |
|
|
1130
1214
|
|
|
1131
|
-
**Returns:** `string
|
|
1215
|
+
**Returns:** `string`: URL to fetch the attachment binary
|
|
1132
1216
|
|
|
1133
1217
|
---
|
|
1134
1218
|
|
|
@@ -1379,7 +1463,7 @@ Run guardrails tests against all active policies. Returns pass/fail results per
|
|
|
1379
1463
|
const report = await claw.testPolicies();
|
|
1380
1464
|
console.log(`${report.passed}/${report.total} policies passed`);
|
|
1381
1465
|
for (const r of report.results.filter(r => !r.passed)) {
|
|
1382
|
-
console.log(`FAIL: ${r.policy}
|
|
1466
|
+
console.log(`FAIL: ${r.policy}: ${r.reason}`);
|
|
1383
1467
|
}
|
|
1384
1468
|
```
|
|
1385
1469
|
|
|
@@ -1425,7 +1509,7 @@ Map active policies to framework controls. Returns a control-by-control coverage
|
|
|
1425
1509
|
const { controls, coverage_pct } = await claw.mapCompliance('soc2');
|
|
1426
1510
|
console.log(`SOC 2 coverage: ${coverage_pct}%`);
|
|
1427
1511
|
for (const ctrl of controls.filter(c => !c.covered)) {
|
|
1428
|
-
console.log(`Gap: ${ctrl.id}
|
|
1512
|
+
console.log(`Gap: ${ctrl.id}: ${ctrl.name}`);
|
|
1429
1513
|
}
|
|
1430
1514
|
```
|
|
1431
1515
|
|
package/dashclaw.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* DashClaw SDK
|
|
3
3
|
* Full-featured agent toolkit for the DashClaw platform.
|
|
4
|
-
* Zero-dependency ESM SDK
|
|
4
|
+
* Zero-dependency ESM SDK. Requires Node 18+ (native fetch).
|
|
5
5
|
*
|
|
6
6
|
* 96+ methods across 22+ categories:
|
|
7
7
|
* - Action Recording (7)
|
|
@@ -217,7 +217,7 @@ class DashClaw {
|
|
|
217
217
|
try {
|
|
218
218
|
decision = await this.guard(context);
|
|
219
219
|
} catch (err) {
|
|
220
|
-
// Guard API failure is fail-open
|
|
220
|
+
// Guard API failure is fail-open: log and proceed
|
|
221
221
|
console.warn(`[DashClaw] Guard check failed (proceeding): ${err.message}`);
|
|
222
222
|
return;
|
|
223
223
|
}
|
|
@@ -403,11 +403,11 @@ class DashClaw {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
// ══════════════════════════════════════════════
|
|
406
|
-
// Category 1:
|
|
406
|
+
// Category 1: Decision Recording (6 methods)
|
|
407
407
|
// ══════════════════════════════════════════════
|
|
408
408
|
|
|
409
409
|
/**
|
|
410
|
-
*
|
|
410
|
+
* Record a governed decision. Every action is a decision with a full audit trail: goal, reasoning, assumptions, and policy compliance.
|
|
411
411
|
* @param {Object} action
|
|
412
412
|
* @param {string} action.action_type - One of: build, deploy, post, apply, security, message, api, calendar, research, review, fix, refactor, test, config, monitor, alert, cleanup, sync, migrate, other
|
|
413
413
|
* @param {string} action.declared_goal - What this action aims to accomplish
|
|
@@ -619,9 +619,9 @@ class DashClaw {
|
|
|
619
619
|
} else if (line.startsWith('data: ')) {
|
|
620
620
|
currentData += line.slice(6);
|
|
621
621
|
} else if (line.startsWith(':')) {
|
|
622
|
-
// SSE comment (keepalive heartbeat)
|
|
622
|
+
// SSE comment (keepalive heartbeat). Ignore.
|
|
623
623
|
} else if (line === '' && currentEvent) {
|
|
624
|
-
// End of SSE frame
|
|
624
|
+
// End of SSE frame. Dispatch.
|
|
625
625
|
if (currentData) {
|
|
626
626
|
try {
|
|
627
627
|
const parsed = JSON.parse(currentData);
|
|
@@ -631,7 +631,7 @@ class DashClaw {
|
|
|
631
631
|
currentEvent = null;
|
|
632
632
|
currentData = '';
|
|
633
633
|
} else if (line === '') {
|
|
634
|
-
// Blank line without a pending event
|
|
634
|
+
// Blank line without a pending event. Reset partial state.
|
|
635
635
|
currentEvent = null;
|
|
636
636
|
currentData = '';
|
|
637
637
|
}
|
|
@@ -766,11 +766,11 @@ class DashClaw {
|
|
|
766
766
|
}
|
|
767
767
|
|
|
768
768
|
// ══════════════════════════════════════════════
|
|
769
|
-
// Category 2: Loops & Assumptions (7 methods)
|
|
769
|
+
// Category 2: Decision Integrity (Loops & Assumptions) (7 methods)
|
|
770
770
|
// ══════════════════════════════════════════════
|
|
771
771
|
|
|
772
772
|
/**
|
|
773
|
-
* Register an
|
|
773
|
+
* Register an unresolved dependency for a decision. Open loops track work that must be completed before the decision can be considered fully resolved.
|
|
774
774
|
* @param {Object} loop
|
|
775
775
|
* @param {string} loop.action_id - Parent action ID
|
|
776
776
|
* @param {string} loop.loop_type - One of: followup, question, dependency, approval, review, handoff, other
|
|
@@ -817,7 +817,7 @@ class DashClaw {
|
|
|
817
817
|
}
|
|
818
818
|
|
|
819
819
|
/**
|
|
820
|
-
* Register assumptions
|
|
820
|
+
* Register assumptions underlying a decision. Assumptions are the decision basis. They must be validated or invalidated to maintain decision integrity.
|
|
821
821
|
* @param {Object} assumption
|
|
822
822
|
* @param {string} assumption.action_id - Parent action ID
|
|
823
823
|
* @param {string} assumption.assumption - The assumption being made
|
|
@@ -873,11 +873,11 @@ class DashClaw {
|
|
|
873
873
|
}
|
|
874
874
|
|
|
875
875
|
// ══════════════════════════════════════════════
|
|
876
|
-
// Category 3: Signals (1 method)
|
|
876
|
+
// Category 3: Decision Integrity Signals (1 method)
|
|
877
877
|
// ══════════════════════════════════════════════
|
|
878
878
|
|
|
879
879
|
/**
|
|
880
|
-
* Get current
|
|
880
|
+
* Get current decision integrity signals. Returns autonomy breaches, logic drift, and governance violations.
|
|
881
881
|
* @returns {Promise<{signals: Object[], counts: {red: number, amber: number, total: number}}>}
|
|
882
882
|
*/
|
|
883
883
|
async getSignals() {
|
|
@@ -1669,7 +1669,7 @@ class DashClaw {
|
|
|
1669
1669
|
|
|
1670
1670
|
/**
|
|
1671
1671
|
* Create or update a shared workspace document.
|
|
1672
|
-
* Upserts by (org_id, name)
|
|
1672
|
+
* Upserts by (org_id, name). Updates increment the version.
|
|
1673
1673
|
* @param {Object} params
|
|
1674
1674
|
* @param {string} params.name - Document name (unique per org)
|
|
1675
1675
|
* @param {string} params.content - Document content
|
|
@@ -1717,12 +1717,11 @@ class DashClaw {
|
|
|
1717
1717
|
}
|
|
1718
1718
|
|
|
1719
1719
|
// ══════════════════════════════════════════════
|
|
1720
|
-
// Category 13:
|
|
1720
|
+
// Category 13: Policy Enforcement (Guard) (2 methods)
|
|
1721
1721
|
// ══════════════════════════════════════════════
|
|
1722
1722
|
|
|
1723
1723
|
/**
|
|
1724
|
-
*
|
|
1725
|
-
* Returns allow/warn/block/require_approval.
|
|
1724
|
+
* Enforce policies before a decision executes. Guard is the heart of DashClaw. It intercepts intent and returns allow/warn/block/require_approval.
|
|
1726
1725
|
* @param {Object} context
|
|
1727
1726
|
* @param {string} context.action_type - Action type (required)
|
|
1728
1727
|
* @param {number} [context.risk_score] - Risk score 0-100
|
|
@@ -2133,7 +2132,7 @@ class DashClaw {
|
|
|
2133
2132
|
|
|
2134
2133
|
/**
|
|
2135
2134
|
* Sync multiple data categories in a single request.
|
|
2136
|
-
* Every key is optional
|
|
2135
|
+
* Every key is optional. Only provided categories are processed.
|
|
2137
2136
|
* @param {Object} state - Data to sync (connections, memory, goals, learning, content, inspiration, context_points, context_threads, handoffs, preferences, snippets)
|
|
2138
2137
|
* @returns {Promise<{results: Object, total_synced: number, total_errors: number, duration_ms: number}>}
|
|
2139
2138
|
*/
|
package/index.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dashclaw",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.3",
|
|
4
4
|
"description": "Full-featured agent toolkit for the DashClaw platform. 96+ methods across 22+ categories for action recording, context management, session handoffs, security scanning, behavior guard, compliance, task routing, identity binding, organization management, webhooks, bulk sync, and more.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"keywords": [
|
|
24
24
|
"ai-agent",
|
|
25
|
-
"
|
|
25
|
+
"decision-infrastructure",
|
|
26
26
|
"agent-toolkit",
|
|
27
27
|
"dashclaw",
|
|
28
28
|
"dashclaw",
|