@clawops/cli 2.1.3 → 2.2.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 (51) hide show
  1. package/README.md +120 -2
  2. package/dist/agent-activity-25FAWLAI.js +16 -0
  3. package/dist/{apply-JARPVA5Y.js → apply-F5SQ2ZOS.js} +7 -7
  4. package/dist/backup-flows-NDP5JTR3.js +29 -0
  5. package/dist/{bootstrap-3PBVY7MA.js → bootstrap-32TZXVDF.js} +3 -3
  6. package/dist/bootstrap.sh.tmpl +4 -0
  7. package/dist/chunk-27335SIH.js +51 -0
  8. package/dist/{chunk-E4NJSJ54.js → chunk-4PY6PN4G.js} +51 -7
  9. package/dist/{chunk-PTCVFLZ3.js → chunk-66R52R7K.js} +7 -11
  10. package/dist/{chunk-7T4CIT7C.js → chunk-AX65JMDZ.js} +15 -15
  11. package/dist/{chunk-TYHTISI5.js → chunk-CQOYUWR7.js} +610 -104
  12. package/dist/chunk-E6BRQK67.js +289 -0
  13. package/dist/chunk-LV7UO5CG.js +82 -0
  14. package/dist/{chunk-GIEVAGEK.js → chunk-N5ZYUTZS.js} +16 -1
  15. package/dist/{chunk-CPCO6UJK.js → chunk-OUQVKIIA.js} +368 -30
  16. package/dist/{chunk-XFN3YDZE.js → chunk-PASAVVNS.js} +1 -1
  17. package/dist/chunk-PCSX6Y3U.js +297 -0
  18. package/dist/chunk-POYS3EVQ.js +14 -0
  19. package/dist/chunk-SX75L2T3.js +46 -0
  20. package/dist/{chunk-2Z7J3ERQ.js → chunk-TYNMOYVM.js} +1 -1
  21. package/dist/{chunk-2I7KCMXZ.js → chunk-UAJJEDCJ.js} +2 -2
  22. package/dist/{chunk-NUDIHZEH.js → chunk-WPZIJONN.js} +14 -12
  23. package/dist/{chunk-CHNSL3TC.js → chunk-YPVWF7IA.js} +1 -1
  24. package/dist/{chunk-3OLUJPCB.js → chunk-Z3XLWZWF.js} +1 -1
  25. package/dist/cli.js +303 -698
  26. package/dist/conn-M2V5HBPJ.js +9 -0
  27. package/dist/{context-WOKSKAIA.js → context-EHSLWKSH.js} +2 -2
  28. package/dist/{docker-3PDO4TS7.js → docker-IKM5GRMC.js} +2 -2
  29. package/dist/{flows-HGJIA6EL.js → flows-6B2I6TRW.js} +5 -5
  30. package/dist/{generate-NE54BATS.js → generate-4YYNW3IU.js} +5 -4
  31. package/dist/{harden-RUOUA5BV.js → harden-UHAOVQMZ.js} +3 -3
  32. package/dist/{mcp-wire-FIO5DFBY.js → mcp-wire-BXF4DJFT.js} +21 -14
  33. package/dist/migrate-flow-24XA4GZL.js +25 -0
  34. package/dist/{package-MF5LPITL.js → package-HYGHRX35.js} +3 -1
  35. package/dist/{pool-PIIKJ4L2.js → pool-NT4XBSUT.js} +2 -2
  36. package/dist/{privileged-JFA6LLTV.js → privileged-5Y6O4H7Z.js} +1 -1
  37. package/dist/{ready-KDNRBNSU.js → ready-IJEUBFVX.js} +2 -2
  38. package/dist/{remote-config-3HZLUWEA.js → remote-config-OZYBMBSK.js} +3 -3
  39. package/dist/{runtime-X3KW5TCP.js → runtime-VW53TU2W.js} +5 -1
  40. package/dist/{server-OXWHBTXK.js → server-E3YA32ND.js} +21 -14
  41. package/dist/ssh-HOM7GF3M.js +13 -0
  42. package/dist/stack-delete-NTIGKWUF.js +13 -0
  43. package/dist/{tailscale-cutover-EKAQSDXP.js → tailscale-cutover-V42HO5UM.js} +1 -1
  44. package/dist/{validate-JXKN5WD6.js → validate-DZE6LFEB.js} +1 -1
  45. package/dist/{wait-WO72TRRQ.js → wait-DOUNNJNN.js} +2 -2
  46. package/package.json +3 -1
  47. package/spec/mcp-tools.yaml +213 -7
  48. package/dist/logs-5A7YYA53.js +0 -15
  49. package/dist/ssh-VAI5DU5M.js +0 -11
  50. package/dist/upgrade-ULD4KFYC.js +0 -88
  51. /package/dist/{chunk-NUL5F6YV.js → chunk-SOZ62ZXW.js} +0 -0
@@ -86,9 +86,8 @@ tools:
86
86
  actually running.
87
87
 
88
88
  Do NOT use when: you already know the problem and want to fix it. This tool only
89
- reports — it changes nothing, and never runs `openclaw doctor --fix`. No tool
90
- repairs a gateway: `clawops gateway update` is CLI-only, so tell the user to run
91
- it themselves, after `clawops backup create`.
89
+ reports — it changes nothing, and never runs `openclaw doctor --fix`. To move a
90
+ gateway to another version, use clawops_gateway_update after clawops_backup_create.
92
91
 
93
92
  Every check carries a status: fail (something is wrong that clawops can name),
94
93
  warn (worth knowing, not broken), info (did not apply). `ok` is false only when
@@ -240,8 +239,7 @@ tools:
240
239
  Use when: the user wants to see which agents are running, debug agent
241
240
  routing, or count active workspaces.
242
241
 
243
- Do NOT use when: the user wants one agent's logs — no tool exposes those; tell
244
- the user to run `clawops agents logs <name>`.
242
+ Do NOT use when: the user wants one agent's activity — that is clawops_agents_logs.
245
243
  annotations:
246
244
  title: List OpenClaw Agents
247
245
  readOnlyHint: true
@@ -261,6 +259,84 @@ tools:
261
259
  status: { type: enum, values: [running, paused, errored, stopped] }
262
260
  channels: { type: array, items: { type: string } }
263
261
 
262
+ - name: clawops_agents_logs
263
+ toolset: [cli, read]
264
+ description: |
265
+ One agent's recent activity, read from the gateway's audit log, newest last.
266
+ Paginated: pass the returned cursor to continue.
267
+
268
+ Use when: the user asks what a specific agent did, or why it behaved as it did.
269
+
270
+ Do NOT use when: the user wants the gateway's own log stream — that is
271
+ clawops_logs_tail. Do NOT use to find agent names — that is clawops_agents_list.
272
+ annotations:
273
+ title: Read One Agent's Activity
274
+ readOnlyHint: true
275
+ destructiveHint: false
276
+ idempotentHint: true
277
+ openWorldHint: true
278
+ input:
279
+ stackName: { type: string, optional: true, description: "Which stack the agent runs on. Omitted = the default stack in ~/.clawops/config.json" }
280
+ name: { type: string, description: "The agent's name, as clawops_agents_list reports it" }
281
+ limit: { type: integer, optional: true, default: 50, description: "Maximum activity records to return. Omitted = 50" }
282
+ cursor: { type: string, optional: true, description: "The cursor a previous call returned, to continue from where it stopped. Omitted = the most recent records" }
283
+
284
+ - name: clawops_gateway_status
285
+ toolset: [cli, read]
286
+ description: |
287
+ Whether the OpenClaw gateway container is running, when it started, and which image it
288
+ runs, as docker reports it on the host.
289
+
290
+ Use when: the user asks whether the gateway is up or which OpenClaw version is deployed.
291
+
292
+ Do NOT use when: the user wants a full health check — clawops_doctor probes the gateway
293
+ itself rather than the container. Do NOT use to change anything; this only reads.
294
+ annotations:
295
+ title: Gateway Container Status
296
+ readOnlyHint: true
297
+ destructiveHint: false
298
+ idempotentHint: true
299
+ openWorldHint: true
300
+ input:
301
+ stackName: { type: string, optional: true, description: "Which stack's gateway to inspect. Omitted = the default stack in ~/.clawops/config.json" }
302
+
303
+ - name: clawops_secret_list
304
+ toolset: [cli, read]
305
+ description: |
306
+ List the secrets clawops stores locally, by name and status. Never returns a value.
307
+
308
+ Use when: the user asks which secrets are set, or before a deploy that references one.
309
+
310
+ Do NOT use when: the user wants to set or rotate a secret. No tool does that, because the
311
+ value would pass through the conversation (R6): ask the user to run
312
+ `clawops secret set <NAME>` or `clawops secret rotate <NAME>` in a terminal.
313
+ annotations:
314
+ title: List Stored Secrets
315
+ readOnlyHint: true
316
+ destructiveHint: false
317
+ idempotentHint: true
318
+ openWorldHint: false
319
+ input: {}
320
+
321
+ - name: clawops_secret_audit
322
+ toolset: [cli, read]
323
+ description: |
324
+ Report secrets that stacks reference but clawops does not have, and `$secret:` references
325
+ that cannot be resolved. Never returns a value.
326
+
327
+ Use when: a deploy or config change fails on a missing secret, or before applying a plan
328
+ whose config references secrets.
329
+
330
+ Do NOT use when: the user wants to set the missing secret — ask them to run
331
+ `clawops secret set <NAME>` in a terminal; no tool takes a secret value (R6).
332
+ annotations:
333
+ title: Audit Secret References
334
+ readOnlyHint: true
335
+ destructiveHint: false
336
+ idempotentHint: true
337
+ openWorldHint: false
338
+ input: {}
339
+
264
340
  # ────────────────────────────────────────────────────────────────────────────
265
341
  # MUTATING CLI TOOLS (destructive flagged per R10/R11; elicitation per R19)
266
342
  # ────────────────────────────────────────────────────────────────────────────
@@ -336,8 +412,7 @@ tools:
336
412
  remove a stack. Always confirm the stack name.
337
413
 
338
414
  Do NOT use when: the user wants to stop the gateway temporarily — that is not
339
- a destroy, and no tool stops a gateway; clawops_gateway_restart is the only
340
- gateway tool. Do NOT use when in doubt about which stack; list first with
415
+ a destroy, and no tool stops a gateway; clawops_gateway_restart restarts it. Do NOT use when in doubt about which stack; list first with
341
416
  clawops_stacks_list.
342
417
  annotations:
343
418
  title: Destroy Stack (DESTRUCTIVE)
@@ -504,6 +579,137 @@ tools:
504
579
  restartedAt: { type: string, format: date-time }
505
580
  previousUptimeSec: { type: integer }
506
581
 
582
+ - name: clawops_gateway_update
583
+ toolset: [cli]
584
+ description: |
585
+ Move the gateway to a different OpenClaw version: pull the image and restart the gateway
586
+ on it. Every agent on the host restarts with it.
587
+
588
+ Use when: the user asks to upgrade or downgrade OpenClaw on a running stack, naming a
589
+ version.
590
+
591
+ Do NOT use when: the user has not named a concrete version — moving tags such as
592
+ `latest` are refused, as the CLI refuses them. Do NOT use without a backup the user can
593
+ return to: suggest clawops_backup_create first.
594
+ annotations:
595
+ title: Update OpenClaw Version
596
+ readOnlyHint: false
597
+ destructiveHint: true
598
+ idempotentHint: true
599
+ openWorldHint: true
600
+ input:
601
+ stackName: { type: string, optional: true, description: "Which stack's gateway to update. Omitted = the default stack in ~/.clawops/config.json" }
602
+ version: { type: string, description: "A concrete OpenClaw version to move to, e.g. 2026.9.2. Moving tags are refused" }
603
+ yes: { type: boolean, optional: true, default: false, description: "Skip the confirmation. Only when the user has already approved this specific update" }
604
+
605
+ - name: clawops_backup_create
606
+ toolset: [cli]
607
+ description: |
608
+ Take a backup of the gateway's state (config, database, sessions, transcripts and
609
+ installed plugins) and download it to a local archive. Live state is not changed.
610
+
611
+ Use when: the user asks for a backup, and before anything that replaces state: a
612
+ version update, a migration, a restore, or a plan that replaces the instance.
613
+
614
+ Do NOT use when: the user wants to back up cloud infrastructure — Pulumi state and plans
615
+ cover that, not this.
616
+ annotations:
617
+ title: Back Up Gateway State
618
+ readOnlyHint: false
619
+ destructiveHint: false
620
+ idempotentHint: false
621
+ openWorldHint: true
622
+ input:
623
+ stackName: { type: string, optional: true, description: "Which stack to back up. Omitted = the default stack in ~/.clawops/config.json" }
624
+ out: { type: string, optional: true, description: "Absolute local path to write the archive to. Omitted = a timestamped file under ~/.clawops/backups" }
625
+
626
+ - name: clawops_backup_restore
627
+ toolset: [cli]
628
+ description: |
629
+ Verify a backup archive and expand it on the host beside the live state, never over it.
630
+ With activate: true, also put it into service: stop the gateway, swap the restored state
631
+ in (keeping the state it replaces), restart, and roll back if the gateway does not answer.
632
+
633
+ Use when: the user asks to restore or recover from a backup, naming the archive.
634
+
635
+ Do NOT use when: the gateway is merely unhealthy — clawops_workflow_recover diagnoses that
636
+ without discarding state. Restoring is time travel: everything since the backup is lost,
637
+ and channel credentials may need relinking.
638
+ annotations:
639
+ title: Restore Gateway State (DESTRUCTIVE with activate)
640
+ readOnlyHint: false
641
+ destructiveHint: true
642
+ idempotentHint: false
643
+ openWorldHint: true
644
+ input:
645
+ stackName: { type: string, optional: true, description: "Which stack to restore onto. Omitted = the default stack in ~/.clawops/config.json" }
646
+ file: { type: string, description: "Absolute local path to the backup archive, as clawops_backup_create wrote it" }
647
+ activate: { type: boolean, optional: true, default: false, description: "Put the restored state into service. Omitted = expand into a staging directory and touch nothing live" }
648
+ yes: { type: boolean, optional: true, default: false, description: "Skip the confirmation. Only when the user has already approved this specific restore" }
649
+
650
+ - name: clawops_migrate
651
+ toolset: [cli]
652
+ description: |
653
+ Move a deployment from OpenClaw 1.x onto the 2.0 runtime contract: state ownership,
654
+ config, and the gateway's run command, in the order a real migration showed works.
655
+
656
+ Use when: a stack still runs OpenClaw 1.x and the user wants it on 2.x. clawops_doctor
657
+ and clawops_gateway_status say which line a stack runs.
658
+
659
+ Do NOT use when: the stack is already on 2.x — use clawops_gateway_update to change
660
+ versions within 2.x. Take a backup first with clawops_backup_create.
661
+ annotations:
662
+ title: Migrate 1.x to 2.0 (DESTRUCTIVE)
663
+ readOnlyHint: false
664
+ destructiveHint: true
665
+ idempotentHint: false
666
+ openWorldHint: true
667
+ input:
668
+ stackName: { type: string, optional: true, description: "Which stack to migrate. Omitted = the default stack in ~/.clawops/config.json" }
669
+ openclawVersion: { type: string, optional: true, description: "The OpenClaw 2.x version to migrate to. Omitted = the version this clawops release defaults to" }
670
+ yes: { type: boolean, optional: true, default: false, description: "Skip the confirmation. Only when the user has already approved this migration" }
671
+
672
+ - name: clawops_stacks_delete
673
+ toolset: [admin]
674
+ description: |
675
+ Remove a stack from ~/.clawops/config.json. This forgets the stack; it does not tear
676
+ down its infrastructure, and it refuses a stack that is still deployed unless forced.
677
+
678
+ Use when: the user wants to stop tracking a stack whose resources are already gone.
679
+
680
+ Do NOT use when: the user wants the infrastructure removed — that is clawops_destroy,
681
+ first. Forcing the delete of a deployed stack leaves resources running and billing that
682
+ clawops can no longer see.
683
+ annotations:
684
+ title: Forget a Stack (DESTRUCTIVE)
685
+ readOnlyHint: false
686
+ destructiveHint: true
687
+ idempotentHint: true
688
+ openWorldHint: false
689
+ input:
690
+ name: { type: string, description: "The stack to remove from config, as clawops_stacks_list reports it" }
691
+ force: { type: boolean, optional: true, default: false, description: "Skip the safety checks: allow deleting the default stack, or one still deployed. Omitted = refuse both" }
692
+ yes: { type: boolean, optional: true, default: false, description: "Skip the confirmation. Only when the user has already approved this deletion" }
693
+
694
+ - name: clawops_secret_delete
695
+ toolset: [cli]
696
+ description: |
697
+ Delete a locally stored secret by name. Warns when a stack still references it.
698
+
699
+ Use when: the user asks to remove a secret they no longer use.
700
+
701
+ Do NOT use when: the user wants to replace a value — ask them to run
702
+ `clawops secret rotate <NAME>`; no tool takes a secret value (R6).
703
+ annotations:
704
+ title: Delete a Stored Secret (DESTRUCTIVE)
705
+ readOnlyHint: false
706
+ destructiveHint: true
707
+ idempotentHint: true
708
+ openWorldHint: false
709
+ input:
710
+ name: { type: string, description: "The secret's name, as clawops_secret_list reports it" }
711
+ yes: { type: boolean, optional: true, default: false, description: "Skip the confirmation. Only when the user has already approved this deletion" }
712
+
507
713
  # ────────────────────────────────────────────────────────────────────────────
508
714
  # COMPOSITE WORKFLOW TOOLS (R2: encode user intent, not API sequences)
509
715
  # ────────────────────────────────────────────────────────────────────────────
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- GATEWAY_LOGS_PROBE,
4
- agentAuditCommand,
5
- chooseLogSource,
6
- containerLogsCommand,
7
- gatewayLogsCommand
8
- } from "./chunk-NUL5F6YV.js";
9
- export {
10
- GATEWAY_LOGS_PROBE,
11
- agentAuditCommand,
12
- chooseLogSource,
13
- containerLogsCommand,
14
- gatewayLogsCommand
15
- };
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- connect,
4
- describeConnectError
5
- } from "./chunk-E4NJSJ54.js";
6
- import "./chunk-MC5ATCXS.js";
7
- import "./chunk-KGXPLI7W.js";
8
- export {
9
- connect,
10
- describeConnectError
11
- };
@@ -1,88 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // src/openclaw/upgrade.ts
4
- function judgePreflight(report) {
5
- const { targetVersion, foundVersion, status, reason } = report;
6
- if (status === "indeterminate") {
7
- return {
8
- ok: false,
9
- reason: reason ?? "the database schema could not be determined, so compatibility with the target release is unknown"
10
- };
11
- }
12
- if (typeof foundVersion === "number" && typeof targetVersion === "number") {
13
- if (foundVersion > targetVersion) {
14
- return {
15
- ok: false,
16
- reason: `the state database is at schema ${foundVersion}, but the target release understands ${targetVersion}. This is a downgrade across a schema boundary: the older release would read a database written by a newer one. Restore a backup taken before the upgrade instead.`
17
- };
18
- }
19
- if (foundVersion < targetVersion) {
20
- return { ok: true, note: `state will migrate from schema ${foundVersion} to ${targetVersion}` };
21
- }
22
- return { ok: true };
23
- }
24
- return {
25
- ok: false,
26
- reason: reason ?? `preflight returned no schema version (status: ${status ?? "unknown"})`
27
- };
28
- }
29
- function parsePreflight(stdout) {
30
- try {
31
- const parsed = JSON.parse(stdout.trim());
32
- if (parsed !== null && typeof parsed === "object") return parsed;
33
- } catch {
34
- }
35
- return void 0;
36
- }
37
- function snapshotCommand(image, stateDir, repo) {
38
- return `docker run --rm -v ${stateDir}:/home/node/.openclaw ${image} openclaw backup sqlite create --global --repository ${repo} --json`;
39
- }
40
- function preflightCommand(targetImage, stateDir, snapshotDb) {
41
- return `docker run --rm -v ${stateDir}:/home/node/.openclaw ${targetImage} openclaw database preflight ${snapshotDb} --json`;
42
- }
43
- function snapshotPathFrom(stdout) {
44
- try {
45
- const parsed = JSON.parse(stdout.trim());
46
- if (parsed.ok === true && typeof parsed.snapshotPath === "string") return parsed.snapshotPath;
47
- } catch {
48
- }
49
- return void 0;
50
- }
51
- function repairCommand(image, stateDir) {
52
- return `docker run --rm -v ${stateDir}:/home/node/.openclaw ${image} openclaw doctor --fix --non-interactive --yes`;
53
- }
54
- function describeOutcome(o, version) {
55
- switch (o.kind) {
56
- case "started":
57
- return `Gateway updated to ${version}.`;
58
- case "repaired":
59
- return `Gateway updated to ${version} after a one-shot repair (doctor --fix).`;
60
- case "rolled-back":
61
- return `Rolled back to ${o.to}: the gateway did not start on ${version} \u2014 ${o.reason}. The previous image is running again. If it also fails, restore the snapshot taken before the upgrade.`;
62
- case "failed":
63
- return `Upgrade to ${version} failed and the rollback did not come up either \u2014 ${o.reason}. The state snapshot taken before the upgrade is at ${o.snapshotPath}; restore it with \`openclaw backup sqlite restore\` before retrying.`;
64
- }
65
- }
66
- async function resolveUpgrade(steps, ctx) {
67
- const first = await steps.gate();
68
- if (first.ok) return { kind: "started" };
69
- await steps.repair();
70
- await steps.run(ctx.version);
71
- const second = await steps.gate();
72
- if (second.ok) return { kind: "repaired" };
73
- const reason = second.reason ?? first.reason ?? "unknown";
74
- if (!ctx.previousVersion) return { kind: "failed", reason, snapshotPath: ctx.snapshotPath };
75
- await steps.run(ctx.previousVersion);
76
- const back = await steps.gate();
77
- return back.ok ? { kind: "rolled-back", to: ctx.previousVersion, reason } : { kind: "failed", reason, snapshotPath: ctx.snapshotPath };
78
- }
79
- export {
80
- describeOutcome,
81
- judgePreflight,
82
- parsePreflight,
83
- preflightCommand,
84
- repairCommand,
85
- resolveUpgrade,
86
- snapshotCommand,
87
- snapshotPathFrom
88
- };
File without changes