@dashclaw/openclaw-plugin 1.2.5 → 1.5.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.
@@ -1,67 +1,67 @@
1
- {
2
- "id": "dashclaw-governance",
3
- "name": "DashClaw Governance",
4
- "description": "Policy enforcement, human-in-the-loop approval, and decision recording for every OpenClaw tool call. Powered by DashClaw.",
5
- "version": "1.2.5",
6
- "entry": "src/index.ts",
7
- "main": "./src/index.ts",
8
- "configSchema": {
9
- "type": "object",
10
- "additionalProperties": false,
11
- "description": "Configure the DashClaw connection via any of three shapes: (a) canonical plugin-config keys `dashclawUrl` + `dashclawApiKey` (+ optional `agentId`); (b) SDK-style aliases `baseUrl` + `apiKey`; (c) environment variables `DASHCLAW_BASE_URL` (or legacy `DASHCLAW_URL`) + `DASHCLAW_API_KEY` (+ optional `DASHCLAW_AGENT_ID`) set before the gateway starts. Precedence is plugin config > env. No field is strictly required in this schema — env vars alone are sufficient.",
12
- "properties": {
13
- "dashclawUrl": {
14
- "type": "string",
15
- "description": "URL of your DashClaw instance (e.g. https://my-dashclaw.vercel.app). Optional if DASHCLAW_BASE_URL / DASHCLAW_URL env var is set, or if baseUrl is provided."
16
- },
17
- "dashclawApiKey": {
18
- "type": "string",
19
- "description": "DashClaw API key (starts with oc_live_). Optional if DASHCLAW_API_KEY env var is set, or if apiKey is provided."
20
- },
21
- "baseUrl": {
22
- "type": "string",
23
- "description": "SDK-style alias for dashclawUrl. Use whichever you prefer."
24
- },
25
- "apiKey": {
26
- "type": "string",
27
- "description": "SDK-style alias for dashclawApiKey. Use whichever you prefer."
28
- },
29
- "agentId": {
30
- "type": "string",
31
- "default": "openclaw",
32
- "description": "Agent identifier in DashClaw"
33
- },
34
- "defaultModel": {
35
- "type": "string",
36
- "description": "Fallback model id (e.g. 'openai-codex/gpt-5.4') used when llm_output events fire without a model field. Without this, server-side cost estimation cannot price the turn and stores cost_estimate = 0. Also settable via DASHCLAW_DEFAULT_MODEL env var."
37
- },
38
- "failClosed": {
39
- "type": "boolean",
40
- "default": true,
41
- "description": "If true, block tool calls when DashClaw is unreachable. If false, allow them to proceed."
42
- },
43
- "riskScoreDefault": {
44
- "type": "number",
45
- "default": 50,
46
- "description": "Default risk score for tool calls that don't have a specific mapping"
47
- },
48
- "highRiskTools": {
49
- "type": "array",
50
- "items": { "type": "string" },
51
- "default": [],
52
- "description": "Tool names that should always get risk_score 80+ (e.g. bash, exec, deploy)"
53
- }
54
- }
55
- },
56
- "uiHints": {
57
- "dashclawApiKey": { "sensitive": true, "label": "DashClaw API Key" },
58
- "dashclawUrl": { "label": "DashClaw URL", "placeholder": "https://my-dashclaw.vercel.app" },
59
- "baseUrl": { "label": "DashClaw URL (alias)", "advanced": true },
60
- "apiKey": { "sensitive": true, "label": "DashClaw API Key (alias)", "advanced": true },
61
- "agentId": { "label": "Agent ID" },
62
- "defaultModel": { "label": "Default model (for cost pricing)", "placeholder": "openai-codex/gpt-5.4", "advanced": true },
63
- "failClosed": { "label": "Fail-closed when DashClaw unreachable", "advanced": true },
64
- "riskScoreDefault": { "label": "Default risk score", "advanced": true },
65
- "highRiskTools": { "label": "High-risk tool names", "advanced": true }
66
- }
67
- }
1
+ {
2
+ "id": "dashclaw-governance",
3
+ "name": "DashClaw Governance",
4
+ "description": "Policy enforcement, human-in-the-loop approval, and decision recording for every OpenClaw tool call. Powered by DashClaw.",
5
+ "version": "1.5.0",
6
+ "entry": "src/index.ts",
7
+ "main": "./src/index.ts",
8
+ "configSchema": {
9
+ "type": "object",
10
+ "additionalProperties": false,
11
+ "description": "Configure the DashClaw connection via any of three shapes: (a) canonical plugin-config keys `dashclawUrl` + `dashclawApiKey` (+ optional `agentId`); (b) SDK-style aliases `baseUrl` + `apiKey`; (c) environment variables `DASHCLAW_BASE_URL` (or legacy `DASHCLAW_URL`) + `DASHCLAW_API_KEY` (+ optional `DASHCLAW_AGENT_ID`) set before the gateway starts. Precedence is plugin config > env. No field is strictly required in this schema — env vars alone are sufficient.",
12
+ "properties": {
13
+ "dashclawUrl": {
14
+ "type": "string",
15
+ "description": "URL of your DashClaw instance (e.g. https://my-dashclaw.vercel.app). Optional if DASHCLAW_BASE_URL / DASHCLAW_URL env var is set, or if baseUrl is provided."
16
+ },
17
+ "dashclawApiKey": {
18
+ "type": "string",
19
+ "description": "DashClaw API key (starts with oc_live_). Optional if DASHCLAW_API_KEY env var is set, or if apiKey is provided."
20
+ },
21
+ "baseUrl": {
22
+ "type": "string",
23
+ "description": "SDK-style alias for dashclawUrl. Use whichever you prefer."
24
+ },
25
+ "apiKey": {
26
+ "type": "string",
27
+ "description": "SDK-style alias for dashclawApiKey. Use whichever you prefer."
28
+ },
29
+ "agentId": {
30
+ "type": "string",
31
+ "default": "openclaw",
32
+ "description": "Agent identifier in DashClaw"
33
+ },
34
+ "defaultModel": {
35
+ "type": "string",
36
+ "description": "Fallback model id (e.g. 'openai-codex/gpt-5.4') used when llm_output events fire without a model field. Without this, server-side cost estimation cannot price the turn and stores cost_estimate = 0. Also settable via DASHCLAW_DEFAULT_MODEL env var."
37
+ },
38
+ "failClosed": {
39
+ "type": "boolean",
40
+ "default": true,
41
+ "description": "If true, block tool calls when DashClaw is unreachable. If false, allow them to proceed."
42
+ },
43
+ "riskScoreDefault": {
44
+ "type": "number",
45
+ "default": 50,
46
+ "description": "Default risk score for tool calls that don't have a specific mapping"
47
+ },
48
+ "highRiskTools": {
49
+ "type": "array",
50
+ "items": { "type": "string" },
51
+ "default": [],
52
+ "description": "Tool names that should always get risk_score 80+ (e.g. bash, exec, deploy)"
53
+ }
54
+ }
55
+ },
56
+ "uiHints": {
57
+ "dashclawApiKey": { "sensitive": true, "label": "DashClaw API Key" },
58
+ "dashclawUrl": { "label": "DashClaw URL", "placeholder": "https://my-dashclaw.vercel.app" },
59
+ "baseUrl": { "label": "DashClaw URL (alias)", "advanced": true },
60
+ "apiKey": { "sensitive": true, "label": "DashClaw API Key (alias)", "advanced": true },
61
+ "agentId": { "label": "Agent ID" },
62
+ "defaultModel": { "label": "Default model (for cost pricing)", "placeholder": "openai-codex/gpt-5.4", "advanced": true },
63
+ "failClosed": { "label": "Fail-closed when DashClaw unreachable", "advanced": true },
64
+ "riskScoreDefault": { "label": "Default risk score", "advanced": true },
65
+ "highRiskTools": { "label": "High-risk tool names", "advanced": true }
66
+ }
67
+ }
package/package.json CHANGED
@@ -1,62 +1,80 @@
1
- {
2
- "name": "@dashclaw/openclaw-plugin",
3
- "version": "1.2.5",
4
- "description": "DashClaw governance for OpenClaw — policy enforcement, human approval, and decision recording for every tool call.",
5
- "main": "src/index.ts",
6
- "type": "module",
7
- "license": "MIT",
8
- "author": "DashClaw",
9
- "keywords": [
10
- "openclaw",
11
- "openclaw-plugin",
12
- "dashclaw",
13
- "governance",
14
- "ai-safety",
15
- "hitl",
16
- "approval"
17
- ],
18
- "repository": {
19
- "type": "git",
20
- "url": "git+https://github.com/ucsandman/DashClaw.git",
21
- "directory": "packages/openclaw-plugin"
22
- },
23
- "homepage": "https://github.com/ucsandman/DashClaw/tree/main/packages/openclaw-plugin#readme",
24
- "files": [
25
- "src/",
26
- "openclaw.plugin.json",
27
- "README.md",
28
- "LICENSE"
29
- ],
30
- "openclaw": {
31
- "extensions": [
32
- "./src/index.ts"
33
- ],
34
- "hooks": [
35
- "./src/index.ts"
36
- ]
37
- },
38
- "scripts": {
39
- "build": "tsc --noEmit",
40
- "typecheck": "tsc --noEmit"
41
- },
42
- "dependencies": {
43
- "dashclaw": "^2.11.1"
44
- },
45
- "peerDependencies": {
46
- "openclaw": "^2026.4.15"
47
- },
48
- "peerDependenciesMeta": {
49
- "openclaw": {
50
- "optional": false
51
- }
52
- },
53
- "devDependencies": {
54
- "@types/node": "^20.11.0",
55
- "typescript": "^5.4.0"
56
- },
57
- "overrides": {
58
- "axios": "^1.15.0",
59
- "tar": "^7.5.11",
60
- "protobufjs": "^7.5.5"
61
- }
62
- }
1
+ {
2
+ "name": "@dashclaw/openclaw-plugin",
3
+ "version": "1.5.0",
4
+ "description": "DashClaw governance for OpenClaw — policy enforcement, human approval, and decision recording for every tool call.",
5
+ "main": "./dist/index.js",
6
+ "types": "./dist/index.d.ts",
7
+ "type": "module",
8
+ "license": "MIT",
9
+ "author": "DashClaw",
10
+ "keywords": [
11
+ "openclaw",
12
+ "openclaw-plugin",
13
+ "dashclaw",
14
+ "governance",
15
+ "ai-safety",
16
+ "hitl",
17
+ "approval"
18
+ ],
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/ucsandman/DashClaw.git",
22
+ "directory": "packages/openclaw-plugin"
23
+ },
24
+ "homepage": "https://github.com/ucsandman/DashClaw/tree/main/packages/openclaw-plugin#readme",
25
+ "files": [
26
+ "dist/",
27
+ "src/",
28
+ "openclaw.plugin.json",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "openclaw": {
33
+ "extensions": [
34
+ "./src/index.ts"
35
+ ],
36
+ "hooks": [
37
+ "./src/index.ts"
38
+ ],
39
+ "compat": {
40
+ "pluginApi": ">=2026.4.15",
41
+ "minGatewayVersion": "2026.4.15"
42
+ },
43
+ "build": {
44
+ "openclawVersion": "2026.4.15",
45
+ "pluginSdkVersion": "2026.4.15"
46
+ }
47
+ },
48
+ "scripts": {
49
+ "build": "tsc",
50
+ "typecheck": "tsc --noEmit",
51
+ "prepack": "npm run build"
52
+ },
53
+ "dependencies": {
54
+ "dashclaw": "^5.0.0"
55
+ },
56
+ "peerDependencies": {
57
+ "openclaw": "^2026.4.15"
58
+ },
59
+ "peerDependenciesMeta": {
60
+ "openclaw": {
61
+ "optional": false
62
+ }
63
+ },
64
+ "devDependencies": {
65
+ "@types/node": "^20.11.0",
66
+ "typescript": "^5.4.0"
67
+ },
68
+ "overrides": {
69
+ "axios": "^1.16.0",
70
+ "tar": "^7.5.22",
71
+ "protobufjs": "^7.6.5",
72
+ "gaxios": {
73
+ "uuid": "^11.1.1"
74
+ },
75
+ "brace-expansion": "^5.0.8",
76
+ "@hono/node-server": "^2.0.5",
77
+ "fast-uri": "^3.1.4",
78
+ "hono": "^4.12.27"
79
+ }
80
+ }
package/src/HOOK.md CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: dashclaw-governance
3
3
  description: Policy enforcement, human-in-the-loop approval, and decision recording for every OpenClaw tool call. Powered by DashClaw.
4
- version: 1.2.1
4
+ version: 1.5.0
5
5
  ---
6
6
 
7
7
  # DashClaw Governance Hook
@@ -13,6 +13,8 @@ Intercepts every OpenClaw tool call through a four-step governance loop:
13
13
  3. **Wait** — For `pending_approval` actions, the hook calls `waitForApproval(action_id)` using the **action_records ID from step 2**, not the `guard_decisions` ID from step 1. Operators approve from the DashClaw dashboard, CLI, or mobile PWA.
14
14
  4. **Outcome** — `after_tool_call` records `completed` or `failed` with the error message, giving DashClaw a full intent → policy → outcome trail.
15
15
 
16
+ On the first tool call of a run the plugin also opens a DashClaw **Agent Session** (`POST /api/sessions`), and closes it (`PATCH /api/sessions/:id` → `status: completed`) on `agent_end`, so each OpenClaw run appears under the Agent Sessions feature. Session calls are fully fail-safe — a session error never blocks a tool call or the run.
17
+
16
18
  The hook never modifies tool parameters or results. It only blocks, allows, waits, or records.
17
19
 
18
20
  ## Configuration
package/src/dashclaw.d.ts CHANGED
@@ -1,70 +1,79 @@
1
- /**
2
- * Ambient type declarations for the `dashclaw` npm package.
3
- *
4
- * The published package ships as ESM JavaScript without `.d.ts` files, so we
5
- * describe only the surface this plugin touches: the `DashClaw` client and the
6
- * shapes of `guard()`, `createAction()`, `waitForApproval()`, and
7
- * `updateOutcome()` responses.
8
- *
9
- * Shapes mirror `dashclaw@2.11.1/dashclaw.js`:
10
- * - `guard()` → `{ decision, action_id, reason, signals }`
11
- * - `createAction()` → API returns `{ action, action_id, decision, ... }`
12
- * - `waitForApproval()` → `{ action }`
13
- */
14
- declare module 'dashclaw' {
15
- export interface GuardDecision {
16
- decision: 'allow' | 'block' | 'warn' | 'require_approval';
17
- action_id: string;
18
- reason?: string;
19
- signals?: string[];
20
- }
21
-
22
- export interface ActionRecord {
23
- action_id?: string;
24
- id?: string;
25
- status?: string;
26
- approved_by?: string | null;
27
- error_message?: string | null;
28
- [key: string]: unknown;
29
- }
30
-
31
- /** Envelope returned by `POST /api/actions`. */
32
- export interface CreateActionResult {
33
- action: ActionRecord;
34
- action_id?: string;
35
- [key: string]: unknown;
36
- }
37
-
38
- export interface WaitForApprovalResult {
39
- action: ActionRecord;
40
- }
41
-
42
- export interface DashClawOptions {
43
- baseUrl: string;
44
- apiKey: string;
45
- agentId: string;
46
- }
47
-
48
- export class DashClaw {
49
- constructor(opts: DashClawOptions);
50
- guard(context: Record<string, unknown>): Promise<GuardDecision>;
51
- createAction(action: Record<string, unknown>): Promise<CreateActionResult>;
52
- updateOutcome(
53
- actionId: string,
54
- outcome: Record<string, unknown>
55
- ): Promise<unknown>;
56
- waitForApproval(
57
- actionId: string,
58
- opts?: { timeout?: number; interval?: number }
59
- ): Promise<WaitForApprovalResult>;
60
- recordAssumption(assumption: Record<string, unknown>): Promise<unknown>;
61
- }
62
-
63
- export class ApprovalDeniedError extends Error {
64
- status: string;
65
- }
66
-
67
- export class GuardBlockedError extends Error {
68
- decision: GuardDecision;
69
- }
70
- }
1
+ /**
2
+ * Ambient type declarations for the `dashclaw` npm package.
3
+ *
4
+ * The published package ships as ESM JavaScript without `.d.ts` files, so we
5
+ * describe only the surface this plugin touches: the `DashClaw` client and the
6
+ * shapes of `guard()`, `createAction()`, `waitForApproval()`, and
7
+ * `updateOutcome()` responses.
8
+ *
9
+ * Shapes mirror `dashclaw@4.2.x+/dashclaw.js`:
10
+ * - `guard()` → `{ decision, action_id, reason, signals }`
11
+ * - `createAction()` → API returns `{ action, action_id, decision, ... }`
12
+ * - `waitForApproval()` → `{ action }`
13
+ */
14
+ declare module 'dashclaw' {
15
+ export interface GuardDecision {
16
+ decision: 'allow' | 'block' | 'warn' | 'require_approval';
17
+ action_id: string;
18
+ reason?: string;
19
+ signals?: string[];
20
+ }
21
+
22
+ export interface ActionRecord {
23
+ action_id?: string;
24
+ id?: string;
25
+ status?: string;
26
+ approved_by?: string | null;
27
+ error_message?: string | null;
28
+ [key: string]: unknown;
29
+ }
30
+
31
+ /** Envelope returned by `POST /api/actions`. */
32
+ export interface CreateActionResult {
33
+ action: ActionRecord;
34
+ action_id?: string;
35
+ [key: string]: unknown;
36
+ }
37
+
38
+ export interface WaitForApprovalResult {
39
+ action: ActionRecord;
40
+ }
41
+
42
+ export interface DashClawOptions {
43
+ baseUrl: string;
44
+ apiKey: string;
45
+ agentId: string;
46
+ }
47
+
48
+ export class DashClaw {
49
+ constructor(opts: DashClawOptions);
50
+ guard(context: Record<string, unknown>): Promise<GuardDecision>;
51
+ createAction(action: Record<string, unknown>): Promise<CreateActionResult>;
52
+ updateOutcome(
53
+ actionId: string,
54
+ outcome: Record<string, unknown>
55
+ ): Promise<unknown>;
56
+ waitForApproval(
57
+ actionId: string,
58
+ opts?: { timeout?: number; interval?: number }
59
+ ): Promise<WaitForApprovalResult>;
60
+ recordAssumption(assumption: Record<string, unknown>): Promise<unknown>;
61
+ createSession(
62
+ agentId?: string,
63
+ workspace?: string,
64
+ branch?: string | null
65
+ ): Promise<{ session?: { id?: string }; [key: string]: unknown }>;
66
+ updateSession(
67
+ sessionId: string,
68
+ updates: Record<string, unknown>
69
+ ): Promise<unknown>;
70
+ }
71
+
72
+ export class ApprovalDeniedError extends Error {
73
+ status: string;
74
+ }
75
+
76
+ export class GuardBlockedError extends Error {
77
+ decision: GuardDecision;
78
+ }
79
+ }