@oked/openclaw 0.6.24 → 0.6.26

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
@@ -3,26 +3,38 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@oked/openclaw.svg)](https://www.npmjs.com/package/@oked/openclaw)
4
4
  [![License: Apache-2.0](https://img.shields.io/npm/l/@oked/openclaw.svg)](./LICENSE)
5
5
 
6
- OpenClaw plugin. A `before_tool_call` hook runs for every tool the host reports (built-in or registered by a skill), classifies it, and holds `review` and `high_stakes` calls until you approve in Telegram or on the [web dashboard](https://oked.ai/dashboard). The iPhone app is coming soon.
6
+ OKed pauses risky OpenClaw actions, like `rm -rf`, force-push, destructive SQL, and production deploys, until you approve them in Telegram or on the [web dashboard](https://oked.ai/dashboard). Reads and other ordinary actions just run. OKed is free during beta, and every decision gets a signed receipt. The iPhone app is coming soon.
7
7
 
8
- Optional peer dependency: `openclaw` >= 2026.4.20. A denial returns `{ block: true, blockReason }` instead of throwing. The plugin source says OpenClaw 2026.5.4 and later treat that return value as a veto and show the reason to the agent. An earlier host ignored the return and ran the tool.
8
+ A `before_tool_call` hook runs for every tool the host reports (built-in or registered by a skill) and classifies it. Calls at `review` and `high_stakes` wait until you decide. A denial returns `{ block: true, blockReason }`.
9
+
10
+ OpenClaw 2026.5.4 or newer is required. That release treats the returned denial as a veto and shows the reason to the agent. An earlier host ignored the return and ran the tool. The declared floor is `>=2026.5.4` on `peerDependencies.openclaw`, `engines.openclaw`, `openclaw.compat.pluginApi`, and `openclaw.install.minHostVersion`. `openclaw.compat.minGatewayVersion` and `openclaw.build.openclawVersion` are `2026.5.4` (2026.5.4 and newer).
9
11
 
10
12
  ## Install
11
13
 
14
+ Install from [ClawHub](https://clawhub.ai/plugins/@oked/openclaw):
15
+
12
16
  ```bash
13
- npm install -g @oked/openclaw @oked/openclaw-cli
14
- oked-openclaw init
17
+ openclaw plugins install clawhub:@oked/openclaw
15
18
  ```
16
19
 
17
- The CLI ([`@oked/openclaw-cli`](../openclaw-cli)) needs the `openclaw` command on your PATH. It runs `openclaw plugins install --link` against this package, pairs this device (or reuses an existing API key), sets `minTier` (a terminal prompt when none is set), writes the entry into `~/.openclaw/openclaw.json`, and offers to restart the gateway.
20
+ On OpenClaw 2026.10.9 a package name with no source locator is an npm install. A noninteractive npm install stops with `Install cancelled; rerun with --force`. The `clawhub:` locator selects ClawHub. That install may also ask you to accept the plugin capabilities.
18
21
 
19
- To wire it by hand:
22
+ To install straight from npm instead:
20
23
 
21
24
  ```bash
22
- openclaw plugins install --link <path-to-this-package>
25
+ openclaw plugins install npm:@oked/openclaw
23
26
  ```
24
27
 
25
- Then in `~/.openclaw/openclaw.json`:
28
+ Pair this machine with [`@oked/openclaw-cli`](../openclaw-cli). The CLI needs the `openclaw` command on your PATH. It pairs this device (or reuses an existing API key), sets `minTier` (a terminal prompt when none is set), writes the entry into `~/.openclaw/openclaw.json`, and offers to restart the gateway.
29
+
30
+ ```bash
31
+ npm install -g @oked/openclaw-cli
32
+ oked-openclaw init
33
+ ```
34
+
35
+ If this package is not already installed, and there is no local checkout, `oked-openclaw init` tries `openclaw plugins install clawhub:@oked/openclaw` ([ClawHub](https://clawhub.ai/plugins/@oked/openclaw)). If that fails, it retries `openclaw plugins install npm:@oked/openclaw`. A checkout or a global npm copy is still linked with `openclaw plugins install --link`.
36
+
37
+ To wire the config by hand after the plugin install, edit `~/.openclaw/openclaw.json`:
26
38
 
27
39
  ```json
28
40
  {
@@ -43,7 +55,7 @@ Restart the OpenClaw gateway after a manual edit. [Sign up](https://oked.ai/sign
43
55
 
44
56
  ## Configuration
45
57
 
46
- Keys live under `plugins.entries.oked`. The plugin manifest sets `additionalProperties: false`, so unknown keys are rejected. `OKED_STRICT_FAIL_CLOSED` is read from the environment, not from this object.
58
+ Keys live under `plugins.entries.oked`. The plugin manifest sets `additionalProperties: false`, so unknown keys are rejected. `OKED_STRICT_FAIL_CLOSED` is read from the environment, not from this object. `OKED_SEND_SCRIPT_CONTENT` is the environment form of `sendScriptContent`. A boolean in this object wins when both are set.
47
59
 
48
60
  | Key | Type | Default | Description |
49
61
  |---|---|---|---|
@@ -52,6 +64,7 @@ Keys live under `plugins.entries.oked`. The plugin manifest sets `additionalProp
52
64
  | `alwaysApprove` | `string[]` | `[]` | Tool names that are always `high_stakes`, whatever the classifier says. |
53
65
  | `alwaysAllow` | `string[]` | `[]` | Tool names that are always `safe`. Use sparingly. |
54
66
  | `timeoutMs` | `number` | `630000` | Per-approval wait, in milliseconds (10.5 minutes, so the backend's 10 minute expiry answers first). Minimum `1000`, maximum `1800000`. |
67
+ | `sendScriptContent` | `boolean` | `true` | Attach the first 4,096 bytes of a recognized local script so you can see what will run. Set `false` to omit it. Env `OKED_SEND_SCRIPT_CONTENT=0` (or `false`) does the same when this key is absent. |
55
68
 
56
69
  ## What gets gated
57
70
 
@@ -59,14 +72,42 @@ Names are matched against OpenClaw skill conventions, then unknown names default
59
72
 
60
73
  - **High stakes** (always an approval at the default `minTier`): names that send, post, publish, call, dial, charge, pay, delete, drop, deploy, or release, among the patterns in `src/classify-openclaw.ts`.
61
74
  - **Review** (an approval at the default `minTier`): `create`, `update`, `write`, `edit`, `rename`, `modify`, and any tool name the classifier does not recognize.
62
- - **Safe** (never gated): `get_*`, `list_*`, `search_*`, `read_*`, `find_*`, and the other read-style prefixes and suffixes in that file.
75
+ - **Safe** (never gated): exact read-only OpenClaw built-ins such as `read`, `ls`, `web_search`, `web_fetch`, and `memory_search` (the full list is in `src/classify-openclaw.ts`), plus `get_*`, `list_*`, `search_*`, `read_*`, `find_*`, and the other read-style prefixes and suffixes in that file. `write`, `edit`, and `apply_patch` stay at review.
63
76
  - **Bash / shell / exec**: deferred to the `@oked/sdk` shell classifier (`rm -rf`, `git push --force`, and the rest).
64
77
 
65
78
  `warning` is logged by the SDK classifier and does not block, even if you set `minTier` below `review`.
66
79
 
80
+ ## What OKed sends
81
+
82
+ Each approval is one JSON request. These fields are in the body:
83
+
84
+ | Field | Contents |
85
+ |---|---|
86
+ | `action` | Tool name, for example `bash` or `deploy_site`. |
87
+ | `description` | One-line summary built from the tool arguments. |
88
+ | `tier` | `review` or `high_stakes`. |
89
+ | `nonce` | A new id for this request, so an old receipt cannot approve a later call. |
90
+ | `client` | This package and version, for example `@oked/openclaw@0.6.25`. |
91
+ | `metadata.tool_input` | The full tool arguments. |
92
+ | `metadata.cwd` | Working directory of the OpenClaw process. |
93
+ | `metadata.source` | `openclaw`. |
94
+
95
+ `metadata.session_id` is included when OpenClaw provides a session id. If there is no session id, the session key is sent under that same field. If neither is present, the field is omitted. The `Authorization` header carries your API key (`Bearer`).
96
+
97
+ For `bash`, `shell`, and `exec`, `metadata.tool_input` can also include:
98
+
99
+ - `_file_size_bytes`: size in bytes of an `rm`, `trash`, `trash-put`, or `rmdir` target, when that path exists.
100
+ - `_script_body`: the first 4,096 bytes of a local script named by the command, so you can see what will run before you approve. The file is read for `python` (including `python3` and `python3.x`), `node`, `ruby`, `perl`, `deno run`, and `bun run`, when the path ends in `.py`, `.js`, `.mjs`, `.ts`, `.rb`, or `.pl`. A shell script invoked as `bash foo.sh` or `sh foo.sh` stays in the command string only.
101
+
102
+ The excerpt is redacted before it is sent. On each line, an assignment whose name is or contains the word `key`, `token`, `secret`, or `password` (including `API_KEY`, `apiKey`, and `DB_PASSWORD`) has the value replaced with `[REDACTED]`. AWS access key ids (`AKIA` or `ASIA` plus 16 characters) and `Bearer` tokens are replaced the same way. A PEM private key block is replaced with `[REDACTED]`. This is a best-effort pass. A secret written in an unusual shape can remain in the excerpt, and the command string is sent as the agent wrote it.
103
+
104
+ The signed receipt is bound to the action, description, tool input (including any excerpt), source, and nonce.
105
+
106
+ To stop sending the excerpt, set `sendScriptContent` to `false` or export `OKED_SEND_SCRIPT_CONTENT=0`. The default is to send it.
107
+
67
108
  ## Degraded-mode behavior
68
109
 
69
- Explicit denials, invalid API keys, a missing API key, receipts that do not verify, and unexpected plugin errors deny the tool call. If the backend is unreachable, OKed denies `high_stakes` and, by default, allows lower tiers. Set `OKED_STRICT_FAIL_CLOSED=1` to deny every sensitive action during an outage.
110
+ Explicit denials, invalid API keys, a missing API key, receipts that do not verify, and unexpected plugin errors deny the tool call. If OKed cannot be reached, the default is to deny `high_stakes` and allow lower tiers, so a short outage does not stop every workflow. Set `OKED_STRICT_FAIL_CLOSED=1` (or `true`) to deny every sensitive action during an outage. That is the recommended setting when these actions should stay blocked until you can decide.
70
111
 
71
112
  ## Development
72
113
 
Binary file
@@ -32,6 +32,41 @@ const SAFE_PATTERNS = [
32
32
  /_version$/,
33
33
  /_health$/,
34
34
  ];
35
+ /**
36
+ * Exact OpenClaw core tool ids that only read, list, search, or fetch.
37
+ * The match is case-insensitive and exact, so `read` is safe and
38
+ * `read_and_delete_file` is not. Names are from OpenClaw v2026.10.9
39
+ * `src/agents/tool-catalog.ts` (`CORE_TOOL_DEFINITIONS`). Session summaries
40
+ * are from `src/agents/tool-description-presets.ts` at the same tag.
41
+ *
42
+ * Not included: `glob`, `grep`, `find`, and `search` are not core tool ids
43
+ * in that catalog. `write`, `edit`, and `apply_patch` change files.
44
+ * `exec`, `bash`, and `shell` stay on the shell classifier.
45
+ */
46
+ const SAFE_BUILTIN_TOOLS = new Set([
47
+ // Files: "List directory entries", "Read file contents".
48
+ "ls",
49
+ "read",
50
+ // Web: "Search the web", "Fetch web content", "Search X posts".
51
+ "web_search",
52
+ "web_fetch",
53
+ "x_search",
54
+ // Memory: "Semantic search", "Read memory files".
55
+ "memory_search",
56
+ "memory_get",
57
+ // Sessions and agents that only list, read, or search.
58
+ "presence",
59
+ "sessions_list",
60
+ "sessions_history",
61
+ "sessions_search",
62
+ "conversations_list",
63
+ "session_status",
64
+ "github_identity_status",
65
+ "agents_list",
66
+ "get_goal",
67
+ "skills_search",
68
+ "skills_read",
69
+ ]);
35
70
  const HIGH_STAKES_PATTERNS = [
36
71
  // Communication that touches the real world
37
72
  /(_|^)(send|reply|post|publish|broadcast|email|sms|imessage|whatsapp|slack|telegram|tweet|toot)$/,
@@ -72,6 +107,8 @@ export function classifyOpenClawTool(toolName, toolInput, opts) {
72
107
  if (re.test(lower))
73
108
  return "high_stakes";
74
109
  }
110
+ if (SAFE_BUILTIN_TOOLS.has(lower))
111
+ return "safe";
75
112
  for (const re of SAFE_PATTERNS) {
76
113
  if (re.test(lower))
77
114
  return "safe";
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @oked/openclaw. OKed plugin for OpenClaw.
3
3
  *
4
- * Registers a `before_tool_call` hook that runs for *every* tool the agent
4
+ * Registers a `before_tool_call` hook that runs for every tool the agent
5
5
  * invokes (built-in or skill-registered). For tool calls classified as
6
6
  * sensitive, the hook freezes the agent and asks for a human approval via
7
- * the OKed backend (push to your phone). The agent only proceeds on Approve;
7
+ * Telegram or the OKed dashboard. The agent only proceeds on Approve;
8
8
  * any other outcome blocks the call.
9
9
  *
10
10
  * Failure semantics: fail safe always. If the OKed backend is unreachable,
@@ -14,10 +14,10 @@
14
14
  * Plugin config (set in openclaw.json under plugins.entries.oked):
15
15
  * {
16
16
  * "apiKey": "ok_...", // OKed API key (or OKED_API_KEY env)
17
- * "backendUrl": "https://...", // optional override
18
17
  * "alwaysApprove": ["custom_tool"], // additional names to require approval for
19
18
  * "alwaysAllow": ["safe_tool"], // names to never gate
20
- * "minTier": "review" // minimum tier to require approval (default: "review")
19
+ * "minTier": "review", // minimum tier to require approval (default: "review")
20
+ * "sendScriptContent": true // false omits local script excerpts (or OKED_SEND_SCRIPT_CONTENT=0)
21
21
  * }
22
22
  */
23
23
  import { type RiskTier } from "@oked/sdk";
@@ -34,6 +34,12 @@ interface OkedPluginConfig extends ClassifyOptions {
34
34
  * single outage does not mass-abort the agent. high_stakes always denies.
35
35
  */
36
36
  strictFailClosed?: boolean;
37
+ /**
38
+ * When false, do not attach the local script excerpt (`_script_body`).
39
+ * Default true. Env `OKED_SEND_SCRIPT_CONTENT=0` is the same opt-out when
40
+ * this key is absent. A boolean here wins over the env var.
41
+ */
42
+ sendScriptContent?: boolean;
37
43
  }
38
44
  interface BeforeToolCallEvent {
39
45
  toolName: string;
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  /**
2
2
  * @oked/openclaw. OKed plugin for OpenClaw.
3
3
  *
4
- * Registers a `before_tool_call` hook that runs for *every* tool the agent
4
+ * Registers a `before_tool_call` hook that runs for every tool the agent
5
5
  * invokes (built-in or skill-registered). For tool calls classified as
6
6
  * sensitive, the hook freezes the agent and asks for a human approval via
7
- * the OKed backend (push to your phone). The agent only proceeds on Approve;
7
+ * Telegram or the OKed dashboard. The agent only proceeds on Approve;
8
8
  * any other outcome blocks the call.
9
9
  *
10
10
  * Failure semantics: fail safe always. If the OKed backend is unreachable,
@@ -14,10 +14,10 @@
14
14
  * Plugin config (set in openclaw.json under plugins.entries.oked):
15
15
  * {
16
16
  * "apiKey": "ok_...", // OKed API key (or OKED_API_KEY env)
17
- * "backendUrl": "https://...", // optional override
18
17
  * "alwaysApprove": ["custom_tool"], // additional names to require approval for
19
18
  * "alwaysAllow": ["safe_tool"], // names to never gate
20
- * "minTier": "review" // minimum tier to require approval (default: "review")
19
+ * "minTier": "review", // minimum tier to require approval (default: "review")
20
+ * "sendScriptContent": true // false omits local script excerpts (or OKED_SEND_SCRIPT_CONTENT=0)
21
21
  * }
22
22
  */
23
23
  import * as fs from "node:fs";
@@ -26,29 +26,7 @@ import * as path from "node:path";
26
26
  import { fileURLToPath } from "node:url";
27
27
  import { OKedClient, describe as describeAction, degradedDecision, OKedAuthError, OKedBackendUnreachableError, OKedReceiptError, TIER_ORDER, } from "@oked/sdk";
28
28
  import { classifyOpenClawTool } from "./classify-openclaw.js";
29
- const MAX_SCRIPT_READ = 4096;
30
- function tryReadScriptFile(command) {
31
- // Match: python3 script.py, node script.js, ruby script.rb, etc.
32
- // Skip -c/-e flags (handled by findSqlInCommand inline path).
33
- const m = command.trim().match(/\b(?:python\d?(?:\.\d+)?|node|ruby|perl|deno\s+run|bun\s+run)\s+(?:-[^\s]+\s+)*(['"]?)([^\s'"]+\.(?:py|js|mjs|ts|rb|pl))\1/);
34
- if (!m)
35
- return undefined;
36
- let target = m[2];
37
- if (target.startsWith("~/"))
38
- target = path.join(os.homedir(), target.slice(2));
39
- else if (!path.isAbsolute(target))
40
- target = path.resolve(target);
41
- try {
42
- const fd = fs.openSync(target, "r");
43
- const buf = Buffer.alloc(MAX_SCRIPT_READ);
44
- const bytesRead = fs.readSync(fd, buf, 0, MAX_SCRIPT_READ, 0);
45
- fs.closeSync(fd);
46
- return buf.toString("utf8", 0, bytesRead);
47
- }
48
- catch {
49
- return undefined;
50
- }
51
- }
29
+ import { redactScriptExcerpt, resolveSendScriptContent, tryReadScriptFile } from "./script-excerpt.js";
52
30
  function tryStatRmTarget(command) {
53
31
  const m = command.trim().match(/\b(?:rm|trash|trash-put|rmdir)\s+(?:-[^\s]+\s+)*(['"]?)([^\s'"]+)\1/);
54
32
  if (!m)
@@ -100,10 +78,11 @@ const CLIENT_ID = (() => {
100
78
  }
101
79
  })();
102
80
  const PLUGIN_ID = "oked";
81
+ const LISTING_DESCRIPTION = "Pauses risky OpenClaw actions, like rm -rf, force-push, destructive SQL and prod deploys, until you approve them in Telegram or on the OKed web dashboard. Everything else just runs. Every decision gets a signed receipt.";
103
82
  const plugin = {
104
83
  id: PLUGIN_ID,
105
84
  name: "OKed Approvals",
106
- description: "Freeze the agent before sensitive tool calls and ask for human approval via the OKed mobile app.",
85
+ description: LISTING_DESCRIPTION,
107
86
  register(api) {
108
87
  const cfg = api.pluginConfig ?? {};
109
88
  const log = api.logger;
@@ -187,9 +166,15 @@ const plugin = {
187
166
  const sizeBytes = tryStatRmTarget(cmd);
188
167
  if (sizeBytes !== undefined)
189
168
  enrichedParams = { ...params, _file_size_bytes: sizeBytes };
190
- const scriptBody = tryReadScriptFile(cmd);
191
- if (scriptBody !== undefined)
192
- enrichedParams = { ...enrichedParams, _script_body: scriptBody };
169
+ // First 4,096 bytes of a recognized local script, after redaction,
170
+ // so the approver can see what will run. Opt out with
171
+ // sendScriptContent: false or OKED_SEND_SCRIPT_CONTENT=0.
172
+ if (resolveSendScriptContent(cfg.sendScriptContent)) {
173
+ const scriptBody = tryReadScriptFile(cmd);
174
+ if (scriptBody !== undefined) {
175
+ enrichedParams = { ...enrichedParams, _script_body: redactScriptExcerpt(scriptBody) };
176
+ }
177
+ }
193
178
  }
194
179
  }
195
180
  // Compute the outcome first; only throw/return AFTER the try/catch so a
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Local script excerpt attached to an OpenClaw approval.
3
+ *
4
+ * For a recognized interpreter command, the first 4,096 bytes of the named
5
+ * file are included so the approver can see what will run. Obvious secrets
6
+ * in that excerpt are redacted first. This is a best-effort pass.
7
+ */
8
+ export declare const MAX_SCRIPT_READ = 4096;
9
+ /** Replace obvious secrets. The command string itself is not passed through here. */
10
+ export declare function redactScriptExcerpt(text: string): string;
11
+ /**
12
+ * Whether the approval should include `_script_body`.
13
+ * Plugin config wins. Otherwise `OKED_SEND_SCRIPT_CONTENT=0` or `false` turns
14
+ * it off. Anything else, including an unset variable, leaves the default on.
15
+ */
16
+ export declare function resolveSendScriptContent(configValue?: boolean): boolean;
17
+ export declare function tryReadScriptFile(command: string): string | undefined;
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Local script excerpt attached to an OpenClaw approval.
3
+ *
4
+ * For a recognized interpreter command, the first 4,096 bytes of the named
5
+ * file are included so the approver can see what will run. Obvious secrets
6
+ * in that excerpt are redacted first. This is a best-effort pass.
7
+ */
8
+ import * as fs from "node:fs";
9
+ import * as os from "node:os";
10
+ import * as path from "node:path";
11
+ export const MAX_SCRIPT_READ = 4096;
12
+ const SENSITIVE_WORDS = new Set(["password", "passwd", "pwd", "secret", "token", "key"]);
13
+ const ASSIGN = /^(\s*(?:export\s+)?)((?:const|let|var)\s+)?(['"]?)([A-Za-z_][A-Za-z0-9_.-]*)\3(\s*[=:]\s*)(.*)$/;
14
+ const PEM = /-----BEGIN [A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END [A-Z ]*PRIVATE KEY-----|$)/g;
15
+ function nameWords(name) {
16
+ return name
17
+ .replace(/([a-z0-9])([A-Z])/g, "$1 $2")
18
+ .split(/[_\-.]+/)
19
+ .flatMap((part) => part.split(/\s+/))
20
+ .filter((part) => part.length > 0)
21
+ .map((part) => part.toLowerCase());
22
+ }
23
+ function isSensitiveName(name) {
24
+ return nameWords(name).some((word) => SENSITIVE_WORDS.has(word));
25
+ }
26
+ function redactAssignmentAndTokens(line) {
27
+ const assigned = line.replace(ASSIGN, (full, prefix, decl, quote, name, sep) => {
28
+ if (!isSensitiveName(name))
29
+ return full;
30
+ return `${prefix}${decl ?? ""}${quote}${name}${quote}${sep}[REDACTED]`;
31
+ });
32
+ return assigned
33
+ .replace(/\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g, "[REDACTED]")
34
+ .replace(/\b(Bearer\s+)[A-Za-z0-9._~+/-]{8,}/gi, "$1[REDACTED]");
35
+ }
36
+ /** Replace obvious secrets. The command string itself is not passed through here. */
37
+ export function redactScriptExcerpt(text) {
38
+ const withoutKeys = text.replace(PEM, "[REDACTED]");
39
+ return withoutKeys
40
+ .split(/\r?\n/)
41
+ .map((line) => {
42
+ const comment = line.match(/^(\s*(?:\/\/|#)\s*)(.*)$/);
43
+ if (!comment)
44
+ return redactAssignmentAndTokens(line);
45
+ return `${comment[1]}${redactAssignmentAndTokens(comment[2] ?? "")}`;
46
+ })
47
+ .join("\n");
48
+ }
49
+ /**
50
+ * Whether the approval should include `_script_body`.
51
+ * Plugin config wins. Otherwise `OKED_SEND_SCRIPT_CONTENT=0` or `false` turns
52
+ * it off. Anything else, including an unset variable, leaves the default on.
53
+ */
54
+ export function resolveSendScriptContent(configValue) {
55
+ if (typeof configValue === "boolean")
56
+ return configValue;
57
+ const raw = process.env.OKED_SEND_SCRIPT_CONTENT;
58
+ if (raw === undefined)
59
+ return true;
60
+ const value = raw.trim().toLowerCase();
61
+ if (value === "0" || value === "false" || value === "no" || value === "off")
62
+ return false;
63
+ return true;
64
+ }
65
+ export function tryReadScriptFile(command) {
66
+ // python3 script.py, node script.js, ruby script.rb, and the same for
67
+ // perl, deno run, and bun run. Skip -c/-e (those bodies are already in
68
+ // the command string). Shell scripts such as `bash foo.sh` are not read.
69
+ const m = command.trim().match(/\b(?:python\d?(?:\.\d+)?|node|ruby|perl|deno\s+run|bun\s+run)\s+(?:-[^\s]+\s+)*(['"]?)([^\s'"]+\.(?:py|js|mjs|ts|rb|pl))\1/);
70
+ if (!m)
71
+ return undefined;
72
+ let target = m[2];
73
+ if (!target)
74
+ return undefined;
75
+ if (target.startsWith("~/"))
76
+ target = path.join(os.homedir(), target.slice(2));
77
+ else if (!path.isAbsolute(target))
78
+ target = path.resolve(target);
79
+ try {
80
+ const fd = fs.openSync(target, "r");
81
+ const buf = Buffer.alloc(MAX_SCRIPT_READ);
82
+ const bytesRead = fs.readSync(fd, buf, 0, MAX_SCRIPT_READ, 0);
83
+ fs.closeSync(fd);
84
+ return buf.toString("utf8", 0, bytesRead);
85
+ }
86
+ catch {
87
+ return undefined;
88
+ }
89
+ }
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "id": "oked",
3
3
  "name": "OKed",
4
- "description": "Human approval layer for AI agents - freezes the agent before sensitive tool calls and asks for human approval via Telegram or the OKed dashboard.",
4
+ "description": "Pauses risky OpenClaw actions, like rm -rf, force-push, destructive SQL and prod deploys, until you approve them in Telegram or on the OKed web dashboard. Everything else just runs. Every decision gets a signed receipt.",
5
+ "categories": ["security"],
5
6
  "activation": {
6
7
  "onStartup": true
7
8
  },
@@ -35,6 +36,10 @@
35
36
  "type": "integer",
36
37
  "minimum": 1000,
37
38
  "maximum": 1800000
39
+ },
40
+ "sendScriptContent": {
41
+ "type": "boolean",
42
+ "default": true
38
43
  }
39
44
  }
40
45
  },
@@ -46,12 +51,8 @@
46
51
  "apiKey": {
47
52
  "label": "OKed API Key",
48
53
  "placeholder": "ok_...",
49
- "help": "Your OKed API key from https://app.oked.ai/dashboard."
50
- },
51
- "backendUrl": {
52
- "label": "Backend URL",
53
- "placeholder": "https://api.oked.ai",
54
- "help": "Override the OKed backend URL. Default is the hosted backend."
54
+ "help": "Your OKed API key from https://app.oked.ai/dashboard.",
55
+ "sensitive": true
55
56
  },
56
57
  "minTier": {
57
58
  "label": "Minimum Approval Tier",
@@ -68,6 +69,10 @@
68
69
  "timeoutMs": {
69
70
  "label": "Approval Timeout (ms)",
70
71
  "help": "How long to wait for a human decision before the action is denied. Defaults to the SDK's value of 630000 (10.5 minutes, just above the backend's 10 minute expiry); max 1800000 (30 minutes)."
72
+ },
73
+ "sendScriptContent": {
74
+ "label": "Send script excerpt",
75
+ "help": "When a shell command runs a local Python, Node, Ruby, Perl, Deno, or Bun script, include the first 4096 bytes in the approval so you can see what will run. Set false to omit it. OKED_SEND_SCRIPT_CONTENT=0 does the same when this is unset."
71
76
  }
72
77
  }
73
78
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oked/openclaw",
3
- "version": "0.6.24",
4
- "description": "OKed plugin for OpenClaw. Gates skill and tool calls behind a human approval push to your phone.",
3
+ "version": "0.6.26",
4
+ "description": "Pauses risky OpenClaw actions, like rm -rf, force-push, destructive SQL and prod deploys, until you approve them in Telegram or on the OKed web dashboard. Everything else just runs. Every decision gets a signed receipt.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -14,22 +14,36 @@
14
14
  "files": [
15
15
  "dist",
16
16
  "openclaw.plugin.json",
17
- "README.md"
17
+ "README.md",
18
+ "assets"
18
19
  ],
19
20
  "scripts": {
20
21
  "prebuild": "npm run build --workspace=@oked/sdk",
21
22
  "build": "tsc",
22
23
  "dev": "tsc --watch",
23
- "test": "npm run build && node src/smoke.test.mjs",
24
+ "test": "npm run build && node src/classify-openclaw.test.mjs && node src/clawhub-metadata.test.mjs && node src/script-excerpt.test.mjs && node src/smoke.test.mjs",
24
25
  "prepublishOnly": "npm run build"
25
26
  },
26
27
  "openclaw": {
27
28
  "extensions": [
28
29
  "./dist/index.js"
29
- ]
30
+ ],
31
+ "compat": {
32
+ "pluginApi": ">=2026.5.4",
33
+ "minGatewayVersion": "2026.5.4"
34
+ },
35
+ "build": {
36
+ "openclawVersion": "2026.5.4"
37
+ },
38
+ "install": {
39
+ "clawhubSpec": "@oked/openclaw",
40
+ "npmSpec": "@oked/openclaw",
41
+ "defaultChoice": "clawhub",
42
+ "minHostVersion": ">=2026.5.4"
43
+ }
30
44
  },
31
45
  "peerDependencies": {
32
- "openclaw": ">=2026.4.20"
46
+ "openclaw": ">=2026.5.4"
33
47
  },
34
48
  "peerDependenciesMeta": {
35
49
  "openclaw": {
@@ -37,7 +51,7 @@
37
51
  }
38
52
  },
39
53
  "dependencies": {
40
- "@oked/sdk": "0.6.24"
54
+ "@oked/sdk": "0.6.26"
41
55
  },
42
56
  "devDependencies": {
43
57
  "@types/node": "^26.6.5",
@@ -62,7 +76,8 @@
62
76
  "homepage": "https://github.com/oked-ai/oked-sdk/tree/main/packages/openclaw#readme",
63
77
  "license": "Apache-2.0",
64
78
  "engines": {
65
- "node": ">=18"
79
+ "node": ">=18",
80
+ "openclaw": ">=2026.5.4"
66
81
  },
67
82
  "publishConfig": {
68
83
  "access": "public"