@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.
package/README.md CHANGED
@@ -81,6 +81,8 @@ Every tool call your agent makes flows through DashClaw before it executes:
81
81
  5. If the action is `pending_approval`, the plugin pauses on `waitForApproval(action.action_id)`. You approve from the DashClaw dashboard, the CLI (`dashclaw approve <id>`), or the mobile PWA — the agent is unblocked the moment the operator approves (SSE first, polling fallback).
82
82
  6. On approval, the tool executes. The `after_tool_call` hook records the outcome (`completed` or `failed`, with the error message) so DashClaw has a full intent → policy → outcome trail.
83
83
 
84
+ On the first tool call of each run the plugin opens a DashClaw **Agent Session** and closes it (`status: completed`) on `agent_end`, so every OpenClaw run shows up under the Agent Sessions feature (not just Code Sessions). Session lifecycle calls are fully fail-safe — a session error never blocks a tool call or the run.
85
+
84
86
  The plugin is read-mostly: it never modifies the tool's parameters or the tool's result. It only blocks, allows, or records.
85
87
 
86
88
  ### Unified policy surface
@@ -117,7 +119,7 @@ empty because the wait target didn't exist. Fixed in `1.0.1`.
117
119
  | `dashclawUrl` | string | **required** | Base URL of your DashClaw instance, e.g. `https://my-dashclaw.vercel.app`. |
118
120
  | `dashclawApiKey` | string | **required** | DashClaw API key (starts with `oc_live_`). |
119
121
  | `agentId` | string | `"openclaw"` | Identifier this OpenClaw instance reports to DashClaw. |
120
- | `defaultModel` | string | `""` | Fallback model id (e.g. `claude-sonnet-4-6`, `gpt-4o`) used when `llm_output` events don't include a `model` field. Without this, unpriced turns land `tokens_in`/`tokens_out` but `cost_estimate` stays `$0`. Env var: `DASHCLAW_DEFAULT_MODEL`. |
122
+ | `defaultModel` | string | `""` | Fallback model id (e.g. `claude-sonnet-5`, `openai-codex/gpt-5.4`) used when `llm_output` events don't include a `model` field. Without this, unpriced turns land `tokens_in`/`tokens_out` but `cost_estimate` stays `$0`. Env var: `DASHCLAW_DEFAULT_MODEL`. |
121
123
  | `failClosed` | boolean | `true` | If DashClaw is unreachable, block the tool call. Set `false` to fail open. |
122
124
  | `riskScoreDefault` | number | `50` | Fallback risk score for tool calls the classifier doesn't recognize. Recognized commands (git, curl, rm, npm, etc.) compute their own risk score automatically. |
123
125
  | `highRiskTools` | string[] | `[]` | Tool names that should always start at risk score 85 before classification. The classifier may raise the score further (e.g. `rm -rf` → 90) but will never lower it below 85 for tools in this list. |
@@ -185,8 +187,6 @@ Interpretation:
185
187
  | `> 0` | `> 0` | `0` | Model string isn't matched by DashClaw's pricing table. Add it via Settings → Model Pricing. |
186
188
  | `> 0` | `> 0` | `> 0` | Working. If the UI disagrees, check the analytics aggregation. |
187
189
 
188
- Repo operators can run `node scripts/diagnose-cost-attribution.mjs` from a DashClaw checkout — it auto-discovers `org_id` from `.env.local` and prints the same table.
189
-
190
190
  ## Links
191
191
 
192
192
  - DashClaw: <https://github.com/ucsandman/DashClaw>
@@ -0,0 +1,24 @@
1
+ /**
2
+ * @dashclaw/openclaw-plugin
3
+ *
4
+ * OpenClaw plugin that routes every tool call through DashClaw governance:
5
+ * 1. `before_tool_call` → `guard()` + optional `waitForApproval()` +
6
+ * `createAction()` to open a governance record.
7
+ * 2. `after_tool_call` → `updateOutcome()` to close that record.
8
+ *
9
+ * Type accuracy notes (verified against `openclaw` plugin SDK types):
10
+ * - `PluginHookBeforeToolCallResult` uses `blockReason`, not `reason`.
11
+ * - `PluginKind` is `"memory" | "context-engine"` — neither applies to this
12
+ * generic hook plugin, so the manifest and `definePluginEntry` call both
13
+ * omit `kind`.
14
+ * - Event/context field shapes come from `PluginHookBeforeToolCallEvent`,
15
+ * `PluginHookAfterToolCallEvent`, and `PluginHookToolContext`. No
16
+ * defensive fallbacks for alternative field names are needed.
17
+ *
18
+ * The DashClaw client is cached at module scope and rebuilt only when the
19
+ * resolved config key changes, mirroring the pattern used by OpenClaw's
20
+ * bundled MemOS plugin.
21
+ */
22
+ import { definePluginEntry } from 'openclaw/plugin-sdk/plugin-entry';
23
+ declare const pluginEntry: ReturnType<typeof definePluginEntry>;
24
+ export default pluginEntry;