dashclaw 2.12.0 → 2.13.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.
Files changed (3) hide show
  1. package/README.md +28 -4
  2. package/dashclaw.js +26 -4
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # DashClaw SDK (v2.11.1)
1
+ # DashClaw SDK (v2.12.0)
2
2
 
3
3
  **Minimal governance runtime for AI agents.**
4
4
 
@@ -34,6 +34,10 @@ const claw = new DashClaw({
34
34
  apiKey: process.env.DASHCLAW_API_KEY,
35
35
  agentId: 'my-agent',
36
36
  agentName: 'My Agent', // optional — stored in audit trail for attribution
37
+ // Phase 2 (optional): attach a JWT from your OIDC provider for cryptographic
38
+ // attribution. When set, the server verifies the signature via JWKS and the
39
+ // JWT sub claim overrides agentId in the audit record.
40
+ // authToken: process.env.MY_AGENT_JWT,
37
41
  });
38
42
 
39
43
  // 1. Ask permission
@@ -247,12 +251,12 @@ See:
247
251
 
248
252
  ---
249
253
 
250
- ## SDK Surface Area (v2.11.1)
254
+ ## SDK Surface Area (v2.12.0)
251
255
 
252
256
  The v2 SDK exposes the stable governance runtime plus promoted execution domains in the canonical Node client:
253
257
 
254
258
  ### Core Runtime
255
- - `guard(context)` -- Policy evaluation ("Can I do X?"). Returns `risk_score` (server-computed) and `agent_risk_score` (raw agent value). Automatically includes `agent_name` from the constructor if not overridden in the call context.
259
+ - `guard(context)` -- Policy evaluation ("Can I do X?"). Returns `risk_score` (server-computed), `agent_risk_score` (raw agent value), and `verification_status` (`verified` | `unverified` | `expired` | `failed` | `unknown_issuer`). Automatically includes `agent_name` from the constructor if not overridden in the call context. Pass `authToken` in the constructor to enable JWKS-backed cryptographic attribution (Phase 2 — see `docs/agent-identity.md`).
256
260
  - `createAction(action)` -- Lifecycle tracking ("I am doing X"). Accepts optional `idempotency_key`; on collision returns the existing row with `{ idempotent_replay: true }` instead of inserting a duplicate.
257
261
  - `updateOutcome(id, outcome)` -- Result recording ("X finished with Y"). `outcome` accepts `status`, `output_summary`, `side_effects`, `artifacts_created`, `error_message`, `duration_ms`, `tokens_in`, `tokens_out`, `model`, `cost_estimate`. When `tokens_in` / `tokens_out` are reported without an explicit `cost_estimate`, the server derives cost from `model` using the configured pricing table.
258
262
  - `recordAssumption(assumption)` -- Integrity tracking ("I believe Z while doing X")
@@ -590,10 +594,30 @@ If your agent supports Model Context Protocol (Claude Code, Claude Desktop, Mana
590
594
 
591
595
  **Streamable HTTP transport** (same surface, served by your DashClaw instance at `POST /api/mcp`).
592
596
 
593
- **8 tools:** `dashclaw_guard`, `dashclaw_record`, `dashclaw_invoke`, `dashclaw_capabilities_list`, `dashclaw_policies_list`, `dashclaw_wait_for_approval`, `dashclaw_session_start`, `dashclaw_session_end`.
597
+ **23 tools** in 7 groups:
598
+
599
+ - **Core governance (8):** `dashclaw_guard`, `dashclaw_record`, `dashclaw_invoke`, `dashclaw_capabilities_list`, `dashclaw_policies_list`, `dashclaw_wait_for_approval`, `dashclaw_session_start`, `dashclaw_session_end`.
600
+ - **Optimal files (2):** `dashclaw_optimal_files_preview`, `dashclaw_optimal_files_manifest` — Code Sessions optimizer output (root CLAUDE.md, path-scoped rules, hooks, skill packs).
601
+ - **Session continuity (3):** `dashclaw_handoff_create`, `dashclaw_handoff_latest`, `dashclaw_handoff_consume` — agent-runtime handoff bundle for the next session.
602
+ - **Credential hygiene (3):** `dashclaw_secret_list`, `dashclaw_secret_due`, `dashclaw_secret_mark_rotated` — check rotation due-dates before acting on tracked credentials.
603
+ - **Skill safety (1):** `dashclaw_skill_scan` — static safety scan of untrusted skill files; results cached by content hash.
604
+ - **Open loops (3):** `dashclaw_loop_add`, `dashclaw_loop_list`, `dashclaw_loop_close` — action-scoped commitments (the "I will X later" tracker).
605
+ - **Learning + retrospection (3):** `dashclaw_learning_log`, `dashclaw_learning_query`, `dashclaw_decisions_recent` — log + query non-obvious decisions; recent governed-action ledger.
594
606
 
595
607
  **4 resources:** `dashclaw://policies`, `dashclaw://capabilities`, `dashclaw://agent/{agent_id}/history`, `dashclaw://status`.
596
608
 
609
+ ### Agent runtime endpoints (server-side, no SDK wrapper)
610
+
611
+ DashClaw 2.17 (platform) added three route families that are **agent-runtime infrastructure, not developer SDK methods**. They are called by the MCP server (the tools listed above), by Hermes Agent hooks, and by other governance plumbing — never directly from agent code. By design, they are not exposed on `claw.*`:
612
+
613
+ | Family | Endpoints | Where called from |
614
+ |---|---|---|
615
+ | Session handoffs | `POST/GET /api/handoffs`, `GET /api/handoffs/latest`, `GET /api/handoffs/{id}`, `POST /api/handoffs/{id}/consume` | Hermes `on_session_end` / `on_session_start` / `pre_llm_call` hooks; MCP `dashclaw_handoff_*` tools |
616
+ | Operator-tracked secrets | `GET/POST /api/secrets`, `PATCH/DELETE /api/secrets/{id}`, `GET /api/secrets/rotation-due` | MCP `dashclaw_secret_*` tools; operator UI |
617
+ | Skill safety scan | `POST /api/skills/scan`, `GET /api/skills/scans/{id}` | MCP `dashclaw_skill_scan` tool; agents before loading an untrusted skill |
618
+
619
+ If you're building a custom integration that needs these without MCP, call them as plain HTTP — see `docs/api-inventory.md` and the OpenAPI spec at `docs/openapi/critical-stable.openapi.json`.
620
+
597
621
  ## OpenClaw Plugin (`@dashclaw/openclaw-plugin`)
598
622
 
599
623
  For teams using the OpenClaw agent framework, the governance plugin intercepts `PreToolUse` / `PostToolUse` lifecycle hooks and runs guard → record → wait-for-approval automatically. Tool classification vocabulary aligns with DashClaw's guard action types. Install via the openclaw CLI which picks up the bundled `HOOK.md` pack.
package/dashclaw.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * DashClaw SDK v2.11.0 (Stable Runtime API)
2
+ * DashClaw SDK v2.12.0 (Stable Runtime API)
3
3
  * Focused governance runtime client for AI agents.
4
4
  */
5
5
 
@@ -28,8 +28,12 @@ class DashClaw {
28
28
  * @param {string} options.apiKey - API key for authentication
29
29
  * @param {string} options.agentId - Unique identifier for this agent
30
30
  * @param {string} [options.agentName] - Human-readable label for this agent (stored in audit trail)
31
+ * @param {string} [options.authToken] - Phase 2: JWT bearer token from your OIDC provider.
32
+ * When set, DashClaw server verifies the token via JWKS and returns `verification_status`
33
+ * in every guard response. The JWT `sub` claim overrides agentId in the audit record
34
+ * when verification succeeds — cryptographic proof beats self-assertion.
31
35
  */
32
- constructor({ baseUrl, apiKey, agentId, agentName }) {
36
+ constructor({ baseUrl, apiKey, agentId, agentName, authToken }) {
33
37
  if (!baseUrl) throw new Error('baseUrl is required');
34
38
  if (!apiKey) throw new Error('apiKey is required');
35
39
  if (!agentId) throw new Error('agentId is required');
@@ -38,6 +42,7 @@ class DashClaw {
38
42
  this.apiKey = apiKey;
39
43
  this.agentId = agentId;
40
44
  this.agentName = agentName || null;
45
+ this.authToken = authToken || null;
41
46
 
42
47
  this.execution = {
43
48
  capabilities: {
@@ -63,7 +68,8 @@ class DashClaw {
63
68
 
64
69
  const headers = {
65
70
  'Content-Type': 'application/json',
66
- 'x-api-key': this.apiKey
71
+ 'x-api-key': this.apiKey,
72
+ ...(this.authToken ? { 'Authorization': `Bearer ${this.authToken}` } : {}),
67
73
  };
68
74
 
69
75
  const res = await fetch(url, {
@@ -94,7 +100,23 @@ class DashClaw {
94
100
  /**
95
101
  * POST /api/guard — "Can I do X?"
96
102
  * @param {Object} context
97
- * @returns {Promise<{decision: 'allow'|'block'|'require_approval', action_id: string, reason: string, signals: string[]}>}
103
+ * @returns {Promise<{
104
+ * decision: 'allow'|'block'|'require_approval'|'warn',
105
+ * action_id: string,
106
+ * reason: string,
107
+ * signals: string[],
108
+ * verification_status: 'verified'|'unverified'|'expired'|'failed'|'unknown_issuer',
109
+ * agent_id: string|null,
110
+ * agent_name: string|null,
111
+ * }>}
112
+ *
113
+ * `verification_status` reflects whether the JWT bearer token (if provided
114
+ * via the `authToken` constructor option) was cryptographically verified:
115
+ * verified — signature valid; audit entry anchored to JWT sub
116
+ * unverified — no token, or issuer temporarily unreachable (fail-soft)
117
+ * expired — token expired; consider refreshing before next call
118
+ * failed — bad signature, malformed token, or audience mismatch
119
+ * unknown_issuer — issuer not in DASHCLAW_ALLOWED_ISSUER (server config)
98
120
  */
99
121
  async guard(context) {
100
122
  return this._request('/api/guard', 'POST', {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashclaw",
3
- "version": "2.12.0",
3
+ "version": "2.13.0",
4
4
  "description": "Minimal governance runtime for AI agents. Intercept, govern, and verify agent actions.",
5
5
  "type": "module",
6
6
  "publishConfig": {