@oked/openclaw-cli 0.6.25 → 0.6.27

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,23 +3,31 @@
3
3
  [![npm version](https://img.shields.io/npm/v/@oked/openclaw-cli.svg)](https://www.npmjs.com/package/@oked/openclaw-cli)
4
4
  [![License: Apache-2.0](https://img.shields.io/npm/l/@oked/openclaw-cli.svg)](./LICENSE)
5
5
 
6
- Pairing CLI for the [`@oked/openclaw`](../openclaw) plugin. Install the plugin with `openclaw plugins install npm:@oked/openclaw`, then use this CLI to pair the device, write the OKed entry into `~/.openclaw/openclaw.json`, and restart the gateway. The plugin requires OpenClaw 2026.5.4 or newer.
6
+ Pairing CLI for the [`@oked/openclaw`](../openclaw) plugin. Approvals are decided in Telegram and on the [web dashboard](https://oked.ai/dashboard). The plugin requires OpenClaw 2026.5.4 or newer.
7
7
 
8
- Approvals are decided in Telegram and on the [web dashboard](https://oked.ai/dashboard). The iPhone app is coming soon.
8
+ ```bash
9
+ openclaw plugins install clawhub:@oked/openclaw
10
+ npx @oked/openclaw-cli init
11
+ ```
9
12
 
10
- ## Install
13
+ A non-interactive install needs `--accept-capabilities` so OpenClaw can record the capability consent:
11
14
 
12
15
  ```bash
13
- openclaw plugins install npm:@oked/openclaw
14
- npm install -g @oked/openclaw-cli
15
- oked-openclaw init
16
+ openclaw plugins install clawhub:@oked/openclaw --accept-capabilities
17
+ npx @oked/openclaw-cli init
16
18
  ```
17
19
 
18
- Once the package is listed on ClawHub, `openclaw plugins install @oked/openclaw` installs it from there.
20
+ The install asks you to allow the Prompt injection capability. The plugin asks for it because a denial returns the reason to the agent. That text is how the agent learns the action was blocked and should stop.
21
+
22
+ ## Install
23
+
24
+ The two commands above install from [ClawHub](https://clawhub.ai/plugins/@oked/openclaw) and pair this machine. `openclaw` must already be on your PATH. You can also install this CLI globally with `npm install -g @oked/openclaw-cli` and run `oked-openclaw init`.
25
+
26
+ On OpenClaw 2026.10.9 a package name with no source locator is an npm install. To install the plugin straight from npm instead, use `openclaw plugins install npm:@oked/openclaw`.
19
27
 
20
- `openclaw` must already be on your PATH. `init` then:
28
+ `init` then:
21
29
 
22
- 1. If a local checkout or a global npm copy of `@oked/openclaw` is present, runs `openclaw plugins install --link <path>`. If the plugin is already installed and no local copy is present, skips install. Otherwise it tries `openclaw plugins install @oked/openclaw` (ClawHub). If that fails, it retries `openclaw plugins install npm:@oked/openclaw`.
30
+ 1. If a local checkout or a global npm copy of `@oked/openclaw` is present, runs `openclaw plugins install --link <path>`. If the plugin is already installed and no local copy is present, skips install. Otherwise it 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`.
23
31
  2. Reuses `OKED_API_KEY` or an existing `plugins.entries.oked.apiKey`. Otherwise it pairs this device in the browser and saves the key to `~/.oked/config.json`. It does not ask you to paste a key.
24
32
  3. Keeps `OKED_MIN_TIER` or an existing `minTier` when one is set. Otherwise a terminal asks (default `review`), and a non-interactive run uses `review`. Accepted values are `safe`, `warning`, `review`, and `high_stakes`.
25
33
  4. Adds `"oked"` to `plugins.allow` and writes `plugins.entries.oked` with `enabled`, `apiKey`, and `minTier`. Existing keys on that entry are kept.
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * Subcommands:
6
6
  * oked-openclaw init Install the plugin if needed (`openclaw plugins install
7
- * @oked/openclaw`, then `npm:@oked/openclaw` if ClawHub
8
- * fails, or `--link` for a local copy),
7
+ * clawhub:@oked/openclaw`, then `npm:@oked/openclaw` if
8
+ * ClawHub fails, or `--link` for a local copy),
9
9
  * persist API key + minTier into ~/.openclaw/openclaw.json,
10
10
  * and restart the OpenClaw gateway daemon.
11
11
  * oked-openclaw status Print install state, config, and backend reachability.
@@ -14,9 +14,10 @@
14
14
  */
15
15
 
16
16
  import { readFile, writeFile, mkdir, access, chmod } from 'node:fs/promises';
17
+ import { realpathSync } from 'node:fs';
17
18
  import { homedir, hostname, platform } from 'node:os';
18
19
  import path from 'node:path';
19
- import { fileURLToPath, pathToFileURL } from 'node:url';
20
+ import { fileURLToPath } from 'node:url';
20
21
  import readline from 'node:readline/promises';
21
22
  import { stdin as input, stdout as output } from 'node:process';
22
23
  import { spawn, spawnSync } from 'node:child_process';
@@ -276,8 +277,12 @@ function detectDaemon() {
276
277
 
277
278
  // --- commands -------------------------------------------------------------
278
279
 
279
- /** Bare package name. OpenClaw resolves this from ClawHub only, with no npm fallback. */
280
- export const CLAWHUB_INSTALL_ARGS = ['plugins', 'install', '@oked/openclaw'];
280
+ /**
281
+ * ClawHub locator. On OpenClaw 2026.10.9 a bare package name is an npm spec
282
+ * (`resolvePluginInstallSourcePlan`), and a noninteractive npm install stops
283
+ * with "Install cancelled; rerun with --force". The clawhub: prefix selects ClawHub.
284
+ */
285
+ export const CLAWHUB_INSTALL_ARGS = ['plugins', 'install', 'clawhub:@oked/openclaw'];
281
286
  /** npm specifier. Used when the ClawHub install fails. */
282
287
  export const NPM_INSTALL_ARGS = ['plugins', 'install', 'npm:@oked/openclaw'];
283
288
  /** Printed when both registry installs fail. */
@@ -359,7 +364,7 @@ async function cmdInit() {
359
364
  console.log(' Leaving the current install in place.\n');
360
365
  } else {
361
366
  console.log('not on disk');
362
- console.log(' Will try ClawHub: openclaw plugins install @oked/openclaw');
367
+ console.log(' Will try ClawHub: openclaw plugins install clawhub:@oked/openclaw');
363
368
  console.log(' If that fails: openclaw plugins install npm:@oked/openclaw\n');
364
369
  }
365
370
 
@@ -423,20 +428,14 @@ async function cmdInit() {
423
428
 
424
429
  // 4. Update openclaw.json - apiKey/minTier are now declared in the plugin's
425
430
  // configSchema, so OpenClaw 2026.5+ will accept them under entries.oked.
431
+ // plugins.allow is the host allowlist. An install that leaves oked off
432
+ // that list shows "Plugin allowed: no" and the gateway will not load it.
426
433
  process.stdout.write('4. Updating ~/.openclaw/openclaw.json... ');
427
- const cfg = existing && typeof existing === 'object' ? existing : {};
428
- cfg.plugins = cfg.plugins || {};
429
- const allow = Array.isArray(cfg.plugins.allow) ? cfg.plugins.allow : [];
430
- if (!allow.includes('oked')) allow.push('oked');
431
- cfg.plugins.allow = allow;
432
- cfg.plugins.entries = cfg.plugins.entries || {};
433
- cfg.plugins.entries.oked = {
434
- ...(cfg.plugins.entries.oked || {}),
435
- enabled: true,
434
+ const cfg = applyPluginConfig(existing, {
436
435
  apiKey,
437
- backendUrl: DEFAULT_BACKEND_URL,
438
436
  minTier,
439
- };
437
+ backendUrl: DEFAULT_BACKEND_URL,
438
+ });
440
439
  await writeConfig(cfg);
441
440
  console.log('done');
442
441
  console.log(` File: ${OPENCLAW_CONFIG}\n`);
@@ -598,6 +597,30 @@ async function cmdUninstall() {
598
597
  console.log(' Restart the OpenClaw daemon to fully unload the plugin.');
599
598
  }
600
599
 
600
+ /**
601
+ * Write the OKed plugin entry and make sure `oked` is on plugins.allow.
602
+ * Mutates and returns cfg. A missing allow list becomes ["oked"]. An existing
603
+ * list keeps its other ids and gains oked when it is absent.
604
+ */
605
+ export function applyPluginConfig(cfg, { apiKey, minTier, backendUrl }) {
606
+ const next = cfg && typeof cfg === 'object' ? cfg : {};
607
+ next.plugins = next.plugins && typeof next.plugins === 'object' ? next.plugins : {};
608
+ const allow = Array.isArray(next.plugins.allow) ? next.plugins.allow : [];
609
+ if (!allow.includes('oked')) allow.push('oked');
610
+ next.plugins.allow = allow;
611
+ next.plugins.entries = next.plugins.entries && typeof next.plugins.entries === 'object'
612
+ ? next.plugins.entries
613
+ : {};
614
+ next.plugins.entries.oked = {
615
+ ...(next.plugins.entries.oked || {}),
616
+ enabled: true,
617
+ apiKey,
618
+ backendUrl,
619
+ minTier,
620
+ };
621
+ return next;
622
+ }
623
+
601
624
  function usage() {
602
625
  console.log(`oked-openclaw - pairing CLI for the @oked/openclaw plugin
603
626
 
@@ -638,10 +661,21 @@ async function main() {
638
661
  }
639
662
  }
640
663
 
641
- const isDirectRun =
642
- process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href;
664
+ /**
665
+ * True when this file is the process entrypoint.
666
+ * npm and npx put a symlink in the bin path, so process.argv[1] is the link
667
+ * and import.meta.url is the real file. Compare the real paths.
668
+ */
669
+ function isDirectRun(argvPath = process.argv[1]) {
670
+ if (!argvPath) return false;
671
+ try {
672
+ return realpathSync(argvPath) === realpathSync(fileURLToPath(import.meta.url));
673
+ } catch {
674
+ return false;
675
+ }
676
+ }
643
677
 
644
- if (isDirectRun) {
678
+ if (isDirectRun()) {
645
679
  main().catch((err) => {
646
680
  console.error(`oked-openclaw: ${err.message}`);
647
681
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oked/openclaw-cli",
3
- "version": "0.6.25",
3
+ "version": "0.6.27",
4
4
  "description": "Installer CLI for the @oked/openclaw plugin. Wraps `openclaw plugins install` and configures the plugin entry in openclaw.json.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,10 +11,10 @@
11
11
  "README.md"
12
12
  ],
13
13
  "scripts": {
14
- "test": "node --check bin/oked-openclaw.mjs && node test/install-plan.test.mjs"
14
+ "test": "node --check bin/oked-openclaw.mjs && node test/install-plan.test.mjs && node test/plugin-config.test.mjs && node test/direct-run.test.mjs"
15
15
  },
16
16
  "dependencies": {
17
- "@oked/sdk": "0.6.25"
17
+ "@oked/sdk": "0.6.27"
18
18
  },
19
19
  "keywords": [
20
20
  "openclaw",