@atbash/cli 0.6.0-dev.1 → 0.6.1-dev.2
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 +57 -8
- package/dist/bin/atbash.js +6 -3
- package/dist/bin/atbash.js.map +1 -1
- package/dist/commands/config-cmd.js +15 -15
- package/dist/commands/config-cmd.js.map +1 -1
- package/dist/commands/connect.d.ts +84 -24
- package/dist/commands/connect.js +289 -73
- package/dist/commands/connect.js.map +1 -1
- package/dist/commands/held.js +2 -2
- package/dist/commands/held.js.map +1 -1
- package/dist/commands/history.js +1 -1
- package/dist/commands/history.js.map +1 -1
- package/dist/commands/judge.js +2 -2
- package/dist/commands/judge.js.map +1 -1
- package/dist/commands/mcp-cmd.d.ts +13 -0
- package/dist/commands/mcp-cmd.js +216 -0
- package/dist/commands/mcp-cmd.js.map +1 -0
- package/dist/commands/policy.js +1 -1
- package/dist/commands/policy.js.map +1 -1
- package/dist/commands/setup.d.ts +390 -8
- package/dist/commands/setup.js +1873 -164
- package/dist/commands/setup.js.map +1 -1
- package/dist/commands/stats.js +1 -1
- package/dist/commands/stats.js.map +1 -1
- package/dist/commands/status.js +1 -1
- package/dist/commands/status.js.map +1 -1
- package/dist/commands/tier.js +1 -1
- package/dist/commands/tier.js.map +1 -1
- package/dist/commands/tools.js +3 -3
- package/dist/commands/tools.js.map +1 -1
- package/dist/commands/whoami.js +1 -1
- package/dist/commands/whoami.js.map +1 -1
- package/dist/shared/atbash-targets.d.ts +49 -0
- package/dist/shared/atbash-targets.js +63 -0
- package/dist/shared/atbash-targets.js.map +1 -0
- package/dist/shared/openclaw-runtime.d.ts +221 -0
- package/dist/shared/openclaw-runtime.js +476 -0
- package/dist/shared/openclaw-runtime.js.map +1 -0
- package/dist/shared/win-exec.d.ts +63 -0
- package/dist/shared/win-exec.js +147 -0
- package/dist/shared/win-exec.js.map +1 -0
- package/package.json +3 -2
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
/** How this OpenClaw got onto the machine — decides the UPDATE command. */
|
|
2
|
+
export type OpenclawChannel = "brew-formula" | "brew-cask" | "npm" | "unknown";
|
|
3
|
+
/**
|
|
4
|
+
* Config subcommands this build has.
|
|
5
|
+
*
|
|
6
|
+
* Probed from `openclaw config --help`, because the boundary is not guessable
|
|
7
|
+
* from a version number. Observed: 2026.2.1 has only `get set unset`, while both
|
|
8
|
+
* 2026.6.6 and 2026.7.1 have `file get patch schema set unset validate`.
|
|
9
|
+
*/
|
|
10
|
+
export interface OpenclawCaps {
|
|
11
|
+
/**
|
|
12
|
+
* `openclaw config patch` — "Patch config from a JSON5 object in one validated
|
|
13
|
+
* write. Objects merge recursively, arrays/scalars replace, and null deletes a
|
|
14
|
+
* path", with `--stdin` and `--dry-run`.
|
|
15
|
+
*
|
|
16
|
+
* This is EXACTLY the operation setup needs, performed by OpenClaw itself, so
|
|
17
|
+
* where it exists we stop hand-merging JSON. That hands OpenClaw responsibility
|
|
18
|
+
* for its own file format, key names, schema, permissions and migrations — all
|
|
19
|
+
* the things we kept getting wrong from the outside. It also removes the
|
|
20
|
+
* clobber hazard: a machine in the field had three
|
|
21
|
+
* `openclaw.json.clobbered.<timestamp>` files, so OpenClaw rewrites that file
|
|
22
|
+
* on its own and anything we hand-merge can be discarded without warning.
|
|
23
|
+
*/
|
|
24
|
+
patch: boolean;
|
|
25
|
+
/** `openclaw config validate` — schema check without starting the gateway. */
|
|
26
|
+
validate: boolean;
|
|
27
|
+
/** `openclaw config schema` — the authoritative key list for THIS build. */
|
|
28
|
+
schema: boolean;
|
|
29
|
+
/** `openclaw config file` — where the active config actually lives. */
|
|
30
|
+
configFile: boolean;
|
|
31
|
+
}
|
|
32
|
+
export interface OpenclawRuntime {
|
|
33
|
+
/** False when there is no OpenClaw on this machine at all. */
|
|
34
|
+
present: boolean;
|
|
35
|
+
/** As reported by `openclaw --version`, e.g. "2026.7.1". Undefined if unparseable. */
|
|
36
|
+
version?: string;
|
|
37
|
+
/** Build hash when the version line carries one — pins a build exactly. */
|
|
38
|
+
build?: string;
|
|
39
|
+
channel: OpenclawChannel;
|
|
40
|
+
/** Resolved path to the binary, for diagnostics. */
|
|
41
|
+
binPath?: string;
|
|
42
|
+
caps: OpenclawCaps;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Where the `openclaw` on PATH came from.
|
|
46
|
+
*
|
|
47
|
+
* Path-based rather than asked of a package manager, because shelling out to
|
|
48
|
+
* brew and npm to answer a question we can read off a path is slow and can hang
|
|
49
|
+
* on a bad network — and this runs before we have written anything, where a
|
|
50
|
+
* hang looks like the command being broken.
|
|
51
|
+
*
|
|
52
|
+
* ⚠️ The npm case is not hypothetical or unusual: the machine that reported the
|
|
53
|
+
* original failure ran `/Users/m4/.nvm/versions/node/v24.13.0/bin/openclaw`,
|
|
54
|
+
* so `brew info openclaw-cli` there said "Not installed" while OpenClaw was
|
|
55
|
+
* plainly running. Telling that user `brew upgrade openclaw-cli` would have been
|
|
56
|
+
* useless, which is the whole reason this returns a channel at all.
|
|
57
|
+
*/
|
|
58
|
+
export declare function detectChannel(binPath: string | undefined): OpenclawChannel;
|
|
59
|
+
/**
|
|
60
|
+
* The command that updates THIS install, or undefined when we cannot tell.
|
|
61
|
+
*
|
|
62
|
+
* Returning undefined is deliberate and better than a plausible guess: a user
|
|
63
|
+
* told to run `brew upgrade openclaw-cli` on an npm install gets "No available
|
|
64
|
+
* formula", concludes our instructions are wrong, and is no closer to an
|
|
65
|
+
* upgrade. `openclaw update` is the honest fallback where the channel is
|
|
66
|
+
* unknown — it is OpenClaw's own self-updater, and 2026.6.6's `doctor` already
|
|
67
|
+
* recommends exactly that ("Run `openclaw update` to update via your package
|
|
68
|
+
* manager (npm/pnpm)").
|
|
69
|
+
*/
|
|
70
|
+
export declare function updateCommand(channel: OpenclawChannel): string;
|
|
71
|
+
/**
|
|
72
|
+
* Inspect the OpenClaw on this machine. Read-only: probes `--version` and
|
|
73
|
+
* `config --help`, writes nothing, and never throws.
|
|
74
|
+
*/
|
|
75
|
+
export declare function detectOpenclaw(binary?: string): OpenclawRuntime;
|
|
76
|
+
/** How setup should write config on this machine. */
|
|
77
|
+
export type WriteStrategy =
|
|
78
|
+
/** `openclaw config patch --stdin` — OpenClaw merges and validates its own file. */
|
|
79
|
+
"openclaw-patch"
|
|
80
|
+
/** Hand-merge the JSON ourselves. The only option on 2026.2.x. */
|
|
81
|
+
| "hand-merge";
|
|
82
|
+
export declare function writeStrategy(rt: OpenclawRuntime): WriteStrategy;
|
|
83
|
+
/**
|
|
84
|
+
* Whether this OpenClaw is one we can wire at all, and what to say if not.
|
|
85
|
+
*
|
|
86
|
+
* DELIBERATELY PERMISSIVE. The floor is "there is an OpenClaw here", not "it has
|
|
87
|
+
* the newest config commands", because 2026.2.x installs are real — the box every
|
|
88
|
+
* CLI attestation was verified on is one — and the minimal entry-only config we
|
|
89
|
+
* now write was confirmed to load there with the plugin reporting
|
|
90
|
+
* `[atbash] plugin loaded` and `guard manager ready`. Narrowing support to the
|
|
91
|
+
* versions we happen to run is the mistake that produced this whole module.
|
|
92
|
+
*
|
|
93
|
+
* So an older build is a DEGRADED path with an offer, never a refusal: it gets
|
|
94
|
+
* the hand-merge, and the reason to upgrade is stated once, with the command for
|
|
95
|
+
* its own channel. Refusal is reserved for "no OpenClaw at all", where there is
|
|
96
|
+
* genuinely nothing to configure.
|
|
97
|
+
*/
|
|
98
|
+
export declare function supportStatus(rt: OpenclawRuntime): {
|
|
99
|
+
supported: boolean;
|
|
100
|
+
degraded: boolean;
|
|
101
|
+
/** Plain-language line for a non-technical operator. */
|
|
102
|
+
message: string;
|
|
103
|
+
/** The channel-correct upgrade command, when upgrading would help. */
|
|
104
|
+
upgrade?: string;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* What OpenClaw says about the Atbash plugin after we have wired it.
|
|
108
|
+
*
|
|
109
|
+
* `state` is deliberately not a boolean. "Is this agent governed?" has more than
|
|
110
|
+
* two answers, and collapsing them is how setup came to print a green summary
|
|
111
|
+
* over an ungoverned machine.
|
|
112
|
+
*/
|
|
113
|
+
export interface PluginVerdict {
|
|
114
|
+
state:
|
|
115
|
+
/** Present, switched on, and loaded. The only state that means governed. */
|
|
116
|
+
"loaded"
|
|
117
|
+
/** On disk but switched off — governs nothing, and is a deliberate act. */
|
|
118
|
+
| "disabled"
|
|
119
|
+
/** OpenClaw tried and failed to load it. Worse than missing: it looks wired. */
|
|
120
|
+
| "load-error"
|
|
121
|
+
/** OpenClaw does not know about it at all. */
|
|
122
|
+
| "missing"
|
|
123
|
+
/** We could not ask. Must never be reported as success. */
|
|
124
|
+
| "unknown";
|
|
125
|
+
entry?: string;
|
|
126
|
+
version?: string;
|
|
127
|
+
/** Required runtime dependencies OpenClaw reports as absent. */
|
|
128
|
+
missingDeps?: string[];
|
|
129
|
+
/** Raw explanation for the operator, in OpenClaw's terms where possible. */
|
|
130
|
+
detail?: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Ask OpenClaw whether the plugin actually loaded — the check setup never had.
|
|
134
|
+
*
|
|
135
|
+
* ⚠️ WHY THIS IS NOT OPTIONAL. Setup used to declare success on the strength of
|
|
136
|
+
* having written what it meant to write. That is not the same claim: on the
|
|
137
|
+
* machine that reported the original failure, the config entry existed and the
|
|
138
|
+
* plugin did not, and OpenClaw said so plainly —
|
|
139
|
+
*
|
|
140
|
+
* plugins.entries.atbash-openclaw: plugin not found: atbash-openclaw
|
|
141
|
+
* (stale config entry ignored; remove it from plugins config)
|
|
142
|
+
*
|
|
143
|
+
* — while setup reported the run as done. An owner reading that summary believes
|
|
144
|
+
* their agent is governed. Nothing is more expensive than a false green on a
|
|
145
|
+
* control boundary, so the last word belongs to OpenClaw, not to us.
|
|
146
|
+
*
|
|
147
|
+
* ⚠️ DO NOT check `hookCount` or `hookNames` here. They are 0 and empty for a
|
|
148
|
+
* perfectly healthy plugin: hooks register when the GATEWAY starts, not when
|
|
149
|
+
* `plugins list` runs. Verified against a plugin that was demonstrably loaded and
|
|
150
|
+
* enforcing — it reports `hookCount: 0`. Treating that as a fault would fail
|
|
151
|
+
* every correct install.
|
|
152
|
+
*/
|
|
153
|
+
export declare function verifyOpenclawPlugin(rt: OpenclawRuntime, opts: {
|
|
154
|
+
/** Entry ids that count as Atbash, current first. */
|
|
155
|
+
entryIds: readonly string[];
|
|
156
|
+
/** Pin the config being inspected, so this cannot read a different one. */
|
|
157
|
+
configPath?: string;
|
|
158
|
+
/**
|
|
159
|
+
* The package spec that was installed, e.g. `@atbash/atbash-openclaw@dev`.
|
|
160
|
+
* Used to catch the environment mismatch that loads cleanly and then fails
|
|
161
|
+
* every judge call: the plugin's endpoint and chain ids are compiled in, so a
|
|
162
|
+
* production build on a dev-onboarded agent is silently useless.
|
|
163
|
+
*/
|
|
164
|
+
expectedSpec?: string;
|
|
165
|
+
/**
|
|
166
|
+
* The home directory being configured, when it is not the process's own.
|
|
167
|
+
*
|
|
168
|
+
* ⚠️ REQUIRED FOR A `--home` RUN, AND OMITTING IT PRODUCED A FALSE GREEN.
|
|
169
|
+
* Pinning `OPENCLAW_CONFIG_PATH` aims OpenClaw at the right CONFIG, but
|
|
170
|
+
* plugin discovery still walks `$HOME/.openclaw`, so the child process
|
|
171
|
+
* happily reported the plugin from the operator's real machine while we were
|
|
172
|
+
* asking about a different one. It printed "OpenClaw loads the plugin" about
|
|
173
|
+
* a home directory that contained no plugin at all — precisely the false
|
|
174
|
+
* green this whole check exists to prevent, produced by the check itself.
|
|
175
|
+
*/
|
|
176
|
+
home?: string;
|
|
177
|
+
binary?: string;
|
|
178
|
+
}): PluginVerdict;
|
|
179
|
+
/**
|
|
180
|
+
* Ask OpenClaw whether a config is valid, when it can answer.
|
|
181
|
+
*
|
|
182
|
+
* This is the PREFLIGHT the command never had. Setup merged into
|
|
183
|
+
* `~/.openclaw/openclaw.json` without ever checking whether that file currently
|
|
184
|
+
* loads — so on a machine whose config was already broken it added its own entry
|
|
185
|
+
* to an unloadable file, and then its `openclaw plugins install` step died on the
|
|
186
|
+
* pre-existing breakage. Reported as an Atbash failure; it was not one.
|
|
187
|
+
*
|
|
188
|
+
* `undefined` means "cannot tell" (no `validate` on this build) and must be
|
|
189
|
+
* treated as such — not as a pass and not as a failure.
|
|
190
|
+
*/
|
|
191
|
+
/**
|
|
192
|
+
* Does THIS build accept `hooks` on a plugin entry?
|
|
193
|
+
*
|
|
194
|
+
* Asked of `openclaw config schema`, never inferred from a version number or
|
|
195
|
+
* correlated with other capabilities — the whole point of this module.
|
|
196
|
+
*
|
|
197
|
+
* ⚠️ WHY THIS QUESTION EXISTS. `hooks` was ADDED, not removed: it is unknown on
|
|
198
|
+
* 2026.2.1 and valid, optional and undeprecated on 2026.6.6 and 2026.7.1, where
|
|
199
|
+
* an entry accepts `enabled | hooks | subagent | llm | config`. Because the entry
|
|
200
|
+
* schema is `additionalProperties: false`, the same key is FATAL on the old build
|
|
201
|
+
* and legitimate on the new one.
|
|
202
|
+
*
|
|
203
|
+
* Setup never writes `hooks` — nothing under it is required, and it gates hook
|
|
204
|
+
* families this plugin does not use (it registers only `before_tool_call`). But
|
|
205
|
+
* it also used to DELETE an operator's `hooks` block unconditionally, and on a
|
|
206
|
+
* build that accepts the key that is destroying their configuration:
|
|
207
|
+
* `hooks.timeoutMs` bounds this plugin's hook latency "without changing plugin
|
|
208
|
+
* code", which is a deliberate operator choice, not damage to repair.
|
|
209
|
+
*
|
|
210
|
+
* `undefined` means "cannot tell" (no `config schema` on this build). The caller
|
|
211
|
+
* must treat that as NOT supported and strip: keeping an unrecognized key makes
|
|
212
|
+
* OpenClaw refuse the entire config, and losing a timeout knob is a far smaller
|
|
213
|
+
* harm than a machine whose config will not load at all.
|
|
214
|
+
*/
|
|
215
|
+
export declare function pluginEntryAcceptsHooks(rt: OpenclawRuntime, binary?: string): boolean | undefined;
|
|
216
|
+
export declare function validateConfig(rt: OpenclawRuntime, configPath: string, binary?: string,
|
|
217
|
+
/** The home being configured, when not the process's own — see verifyOpenclawPlugin. */
|
|
218
|
+
home?: string): {
|
|
219
|
+
valid: boolean;
|
|
220
|
+
problems: string;
|
|
221
|
+
} | undefined;
|