@heretek-ai/openclaw 2026.3.31 → 2026.3.32
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/dist/.buildstamp +1 -1
- package/dist/build-info.json +3 -3
- package/dist/canvas-host/a2ui/.bundle.hash +1 -1
- package/dist/chunks/command-registry-BnmWhMEa.mjs +214 -0
- package/dist/chunks/command-registry-CLOY087q.mjs +14 -0
- package/dist/chunks/command-registry-CjAG33h3.mjs +14 -0
- package/dist/chunks/command-registry-DPx6M6gw.mjs +214 -0
- package/dist/chunks/completion-cli-BDWbmV-o.mjs +448 -0
- package/dist/chunks/completion-cli-CBrKGQfJ.mjs +17 -0
- package/dist/chunks/completion-cli-CwouPhbG.mjs +17 -0
- package/dist/chunks/completion-cli-DuMZk0lN.mjs +448 -0
- package/dist/chunks/doctor-completion-1UqU9aiy.mjs +92 -0
- package/dist/chunks/doctor-completion-B_LLsQm-.mjs +92 -0
- package/dist/chunks/gateway-cli-CqAlS2xh.mjs +43508 -0
- package/dist/chunks/gateway-cli-CxfnMGx8.mjs +43508 -0
- package/dist/chunks/onboard-CRZ2jxOE.mjs +601 -0
- package/dist/chunks/onboard-CyzbNCBF.mjs +601 -0
- package/dist/chunks/program-B3JSAo3Q.mjs +163 -0
- package/dist/chunks/program-DVTI5ouc.mjs +163 -0
- package/dist/chunks/prompt-select-styled-AhC9B2Sr.mjs +5035 -0
- package/dist/chunks/prompt-select-styled-DWTJpQCH.mjs +5035 -0
- package/dist/chunks/register.maintenance-DkQKQI29.mjs +685 -0
- package/dist/chunks/register.maintenance-ofEvddjM.mjs +685 -0
- package/dist/chunks/register.onboard-3m3OGP7x.mjs +168 -0
- package/dist/chunks/register.onboard-BpL-OvP9.mjs +168 -0
- package/dist/chunks/register.setup-NRV53Eo_.mjs +188 -0
- package/dist/chunks/register.setup-xf9cH3sc.mjs +188 -0
- package/dist/chunks/register.subclis-B6xOze_R.mjs +319 -0
- package/dist/chunks/register.subclis-CXtcQnsP.mjs +13 -0
- package/dist/chunks/register.subclis-Dd7Q2x2W.mjs +13 -0
- package/dist/chunks/register.subclis-Dj9qGYdr.mjs +319 -0
- package/dist/chunks/run-main-BYaCWOd9.mjs +437 -0
- package/dist/chunks/run-main-nT8E6iSo.mjs +437 -0
- package/dist/chunks/setup-BufxzaUK.mjs +399 -0
- package/dist/chunks/setup-DHU6h2yc.mjs +399 -0
- package/dist/chunks/setup.finalize-Cc2mg8-p.mjs +544 -0
- package/dist/chunks/setup.finalize-DVacBRaT.mjs +544 -0
- package/dist/chunks/update-cli-DK2TX2U4.mjs +1632 -0
- package/dist/chunks/update-cli-JcUKNsam.mjs +1632 -0
- package/dist/entry.mjs +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +134 -134
|
@@ -0,0 +1,437 @@
|
|
|
1
|
+
import "./redact-CtGOTRBK.mjs";
|
|
2
|
+
import { i as formatUncaughtError } from "./errors-CbvpN2RP.mjs";
|
|
3
|
+
import { t as isMainModule } from "./is-main-WJH15zo-.mjs";
|
|
4
|
+
import { C as getCommandPositionalsWithRootOptions, D as getVerboseFlag, E as getPrimaryCommand, I as isValueToken, O as hasFlag, S as getCommandPathWithRootOptions, T as getPositiveIntFlagValue, h as loggingState, j as isRootHelpInvocation, k as hasHelpOrVersion, w as getFlagValue } from "./logger-vRSRu9wD.mjs";
|
|
5
|
+
import { _ as resolveStateDir } from "./paths-CNST7z3O.mjs";
|
|
6
|
+
import { n as applyCliProfileEnv, r as parseCliProfileArgs, t as normalizeWindowsArgv } from "./windows-argv-CuiYIQCb.mjs";
|
|
7
|
+
import "./tmp-openclaw-dir-BeWwpCKM.mjs";
|
|
8
|
+
import "./theme-w86ra_7m.mjs";
|
|
9
|
+
import "./globals-DZFR3wyP.mjs";
|
|
10
|
+
import { a as enableConsoleCapture, m as defaultRuntime } from "./subsystem-yLe4Gjha.mjs";
|
|
11
|
+
import "./ansi-BJ9IOlIp.mjs";
|
|
12
|
+
import "./boolean-Bwxxidw8.mjs";
|
|
13
|
+
import { r as normalizeEnv, t as isTruthyEnvValue } from "./env-9fhyzTaG.mjs";
|
|
14
|
+
import "./openclaw-root-CSfnLaqO.mjs";
|
|
15
|
+
import { n as VERSION } from "./version-Ckv-IbvB.mjs";
|
|
16
|
+
import { t as assertSupportedRuntime } from "./runtime-guard-CWHkkioa.mjs";
|
|
17
|
+
import "./logging-CO6W9Zis.mjs";
|
|
18
|
+
import "./brew-BK7mPzT2.mjs";
|
|
19
|
+
import "./git-commit-CcLZRWTj.mjs";
|
|
20
|
+
import { t as ensureOpenClawCliOnPath } from "./path-env-D3BHdKnJ.mjs";
|
|
21
|
+
import { t as emitCliBanner } from "./banner-BUu5fMZg.mjs";
|
|
22
|
+
import process$1 from "node:process";
|
|
23
|
+
import { fileURLToPath } from "node:url";
|
|
24
|
+
import fs from "node:fs";
|
|
25
|
+
import path from "node:path";
|
|
26
|
+
import dotenv from "dotenv";
|
|
27
|
+
|
|
28
|
+
//#region src/cli/dotenv.ts
|
|
29
|
+
function loadCliDotEnv(opts) {
|
|
30
|
+
const quiet = opts?.quiet ?? true;
|
|
31
|
+
dotenv.config({ quiet });
|
|
32
|
+
const globalEnvPath = path.join(resolveStateDir(process.env), ".env");
|
|
33
|
+
if (!fs.existsSync(globalEnvPath)) return;
|
|
34
|
+
dotenv.config({
|
|
35
|
+
quiet,
|
|
36
|
+
path: globalEnvPath,
|
|
37
|
+
override: false
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
//#endregion
|
|
42
|
+
//#region src/cli/program/routes.ts
|
|
43
|
+
const routeHealth = {
|
|
44
|
+
match: (path$1) => path$1[0] === "health",
|
|
45
|
+
loadPlugins: (argv) => !hasFlag(argv, "--json"),
|
|
46
|
+
run: async (argv) => {
|
|
47
|
+
const json = hasFlag(argv, "--json");
|
|
48
|
+
const verbose = getVerboseFlag(argv, { includeDebug: true });
|
|
49
|
+
const timeoutMs = getPositiveIntFlagValue(argv, "--timeout");
|
|
50
|
+
if (timeoutMs === null) return false;
|
|
51
|
+
const { healthCommand } = await import("./health-Co9G83gO.mjs");
|
|
52
|
+
await healthCommand({
|
|
53
|
+
json,
|
|
54
|
+
timeoutMs,
|
|
55
|
+
verbose
|
|
56
|
+
}, defaultRuntime);
|
|
57
|
+
return true;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
const routeStatus = {
|
|
61
|
+
match: (path$1) => path$1[0] === "status",
|
|
62
|
+
loadPlugins: (argv) => !hasFlag(argv, "--json"),
|
|
63
|
+
run: async (argv) => {
|
|
64
|
+
const json = hasFlag(argv, "--json");
|
|
65
|
+
const deep = hasFlag(argv, "--deep");
|
|
66
|
+
const all = hasFlag(argv, "--all");
|
|
67
|
+
const usage = hasFlag(argv, "--usage");
|
|
68
|
+
const verbose = getVerboseFlag(argv, { includeDebug: true });
|
|
69
|
+
const timeoutMs = getPositiveIntFlagValue(argv, "--timeout");
|
|
70
|
+
if (timeoutMs === null) return false;
|
|
71
|
+
if (json) {
|
|
72
|
+
const { statusJsonCommand } = await import("./status-json-DOrDJZhJ.mjs");
|
|
73
|
+
await statusJsonCommand({
|
|
74
|
+
deep,
|
|
75
|
+
all,
|
|
76
|
+
usage,
|
|
77
|
+
timeoutMs
|
|
78
|
+
}, defaultRuntime);
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
const { statusCommand } = await import("./status-PJeCqJ2V.mjs");
|
|
82
|
+
await statusCommand({
|
|
83
|
+
json,
|
|
84
|
+
deep,
|
|
85
|
+
all,
|
|
86
|
+
usage,
|
|
87
|
+
timeoutMs,
|
|
88
|
+
verbose
|
|
89
|
+
}, defaultRuntime);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const routeGatewayStatus = {
|
|
94
|
+
match: (path$1) => path$1[0] === "gateway" && path$1[1] === "status",
|
|
95
|
+
run: async (argv) => {
|
|
96
|
+
const url = getFlagValue(argv, "--url");
|
|
97
|
+
if (url === null) return false;
|
|
98
|
+
const token = getFlagValue(argv, "--token");
|
|
99
|
+
if (token === null) return false;
|
|
100
|
+
const password = getFlagValue(argv, "--password");
|
|
101
|
+
if (password === null) return false;
|
|
102
|
+
const timeout = getFlagValue(argv, "--timeout");
|
|
103
|
+
if (timeout === null) return false;
|
|
104
|
+
const ssh = getFlagValue(argv, "--ssh");
|
|
105
|
+
if (ssh === null) return false;
|
|
106
|
+
if (ssh !== void 0) return false;
|
|
107
|
+
const sshIdentity = getFlagValue(argv, "--ssh-identity");
|
|
108
|
+
if (sshIdentity === null) return false;
|
|
109
|
+
if (sshIdentity !== void 0) return false;
|
|
110
|
+
if (hasFlag(argv, "--ssh-auto")) return false;
|
|
111
|
+
const deep = hasFlag(argv, "--deep");
|
|
112
|
+
const json = hasFlag(argv, "--json");
|
|
113
|
+
const requireRpc = hasFlag(argv, "--require-rpc");
|
|
114
|
+
const probe = !hasFlag(argv, "--no-probe");
|
|
115
|
+
const { runDaemonStatus } = await import("./status-DkNTo8Bd.mjs");
|
|
116
|
+
await runDaemonStatus({
|
|
117
|
+
rpc: {
|
|
118
|
+
url: url ?? void 0,
|
|
119
|
+
token: token ?? void 0,
|
|
120
|
+
password: password ?? void 0,
|
|
121
|
+
timeout: timeout ?? void 0
|
|
122
|
+
},
|
|
123
|
+
probe,
|
|
124
|
+
requireRpc,
|
|
125
|
+
deep,
|
|
126
|
+
json
|
|
127
|
+
});
|
|
128
|
+
return true;
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
const routeSessions = {
|
|
132
|
+
match: (path$1) => path$1[0] === "sessions" && !path$1[1],
|
|
133
|
+
run: async (argv) => {
|
|
134
|
+
const json = hasFlag(argv, "--json");
|
|
135
|
+
const allAgents = hasFlag(argv, "--all-agents");
|
|
136
|
+
const agent = getFlagValue(argv, "--agent");
|
|
137
|
+
if (agent === null) return false;
|
|
138
|
+
const store = getFlagValue(argv, "--store");
|
|
139
|
+
if (store === null) return false;
|
|
140
|
+
const active = getFlagValue(argv, "--active");
|
|
141
|
+
if (active === null) return false;
|
|
142
|
+
const { sessionsCommand } = await import("./sessions-Ck4qlZkn.mjs");
|
|
143
|
+
await sessionsCommand({
|
|
144
|
+
json,
|
|
145
|
+
store,
|
|
146
|
+
agent,
|
|
147
|
+
allAgents,
|
|
148
|
+
active
|
|
149
|
+
}, defaultRuntime);
|
|
150
|
+
return true;
|
|
151
|
+
}
|
|
152
|
+
};
|
|
153
|
+
const routeAgentsList = {
|
|
154
|
+
match: (path$1) => path$1[0] === "agents" && path$1[1] === "list",
|
|
155
|
+
run: async (argv) => {
|
|
156
|
+
const json = hasFlag(argv, "--json");
|
|
157
|
+
const bindings = hasFlag(argv, "--bindings");
|
|
158
|
+
const { agentsListCommand } = await import("./agents-D1wTE3Ec.mjs");
|
|
159
|
+
await agentsListCommand({
|
|
160
|
+
json,
|
|
161
|
+
bindings
|
|
162
|
+
}, defaultRuntime);
|
|
163
|
+
return true;
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
const routeMemoryStatus = {
|
|
167
|
+
match: (path$1) => path$1[0] === "memory" && path$1[1] === "status",
|
|
168
|
+
run: async (argv) => {
|
|
169
|
+
const agent = getFlagValue(argv, "--agent");
|
|
170
|
+
if (agent === null) return false;
|
|
171
|
+
const json = hasFlag(argv, "--json");
|
|
172
|
+
const deep = hasFlag(argv, "--deep");
|
|
173
|
+
const index = hasFlag(argv, "--index");
|
|
174
|
+
const verbose = hasFlag(argv, "--verbose");
|
|
175
|
+
const { runMemoryStatus } = await import("../cli/memory-cli.mjs");
|
|
176
|
+
await runMemoryStatus({
|
|
177
|
+
agent,
|
|
178
|
+
json,
|
|
179
|
+
deep,
|
|
180
|
+
index,
|
|
181
|
+
verbose
|
|
182
|
+
});
|
|
183
|
+
return true;
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
function getFlagValues(argv, name) {
|
|
187
|
+
const values = [];
|
|
188
|
+
const args = argv.slice(2);
|
|
189
|
+
for (let i = 0; i < args.length; i += 1) {
|
|
190
|
+
const arg = args[i];
|
|
191
|
+
if (!arg || arg === "--") break;
|
|
192
|
+
if (arg === name) {
|
|
193
|
+
const next = args[i + 1];
|
|
194
|
+
if (!isValueToken(next)) return null;
|
|
195
|
+
values.push(next);
|
|
196
|
+
i += 1;
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
if (arg.startsWith(`${name}=`)) {
|
|
200
|
+
const value = arg.slice(name.length + 1).trim();
|
|
201
|
+
if (!value) return null;
|
|
202
|
+
values.push(value);
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
return values;
|
|
206
|
+
}
|
|
207
|
+
const routes = [
|
|
208
|
+
routeHealth,
|
|
209
|
+
routeStatus,
|
|
210
|
+
routeGatewayStatus,
|
|
211
|
+
routeSessions,
|
|
212
|
+
routeAgentsList,
|
|
213
|
+
routeMemoryStatus,
|
|
214
|
+
{
|
|
215
|
+
match: (path$1) => path$1[0] === "config" && path$1[1] === "get",
|
|
216
|
+
run: async (argv) => {
|
|
217
|
+
const positionals = getCommandPositionalsWithRootOptions(argv, {
|
|
218
|
+
commandPath: ["config", "get"],
|
|
219
|
+
booleanFlags: ["--json"]
|
|
220
|
+
});
|
|
221
|
+
if (!positionals || positionals.length !== 1) return false;
|
|
222
|
+
const pathArg = positionals[0];
|
|
223
|
+
if (!pathArg) return false;
|
|
224
|
+
const json = hasFlag(argv, "--json");
|
|
225
|
+
const { runConfigGet } = await import("./config-cli-BuJIvAcn.mjs");
|
|
226
|
+
await runConfigGet({
|
|
227
|
+
path: pathArg,
|
|
228
|
+
json
|
|
229
|
+
});
|
|
230
|
+
return true;
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
match: (path$1) => path$1[0] === "config" && path$1[1] === "unset",
|
|
235
|
+
run: async (argv) => {
|
|
236
|
+
const positionals = getCommandPositionalsWithRootOptions(argv, { commandPath: ["config", "unset"] });
|
|
237
|
+
if (!positionals || positionals.length !== 1) return false;
|
|
238
|
+
const pathArg = positionals[0];
|
|
239
|
+
if (!pathArg) return false;
|
|
240
|
+
const { runConfigUnset } = await import("./config-cli-BuJIvAcn.mjs");
|
|
241
|
+
await runConfigUnset({ path: pathArg });
|
|
242
|
+
return true;
|
|
243
|
+
}
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
match: (path$1) => path$1[0] === "models" && path$1[1] === "list",
|
|
247
|
+
run: async (argv) => {
|
|
248
|
+
const provider = getFlagValue(argv, "--provider");
|
|
249
|
+
if (provider === null) return false;
|
|
250
|
+
const all = hasFlag(argv, "--all");
|
|
251
|
+
const local = hasFlag(argv, "--local");
|
|
252
|
+
const json = hasFlag(argv, "--json");
|
|
253
|
+
const plain = hasFlag(argv, "--plain");
|
|
254
|
+
const { modelsListCommand } = await import("./models-ByATbUwH.mjs");
|
|
255
|
+
await modelsListCommand({
|
|
256
|
+
all,
|
|
257
|
+
local,
|
|
258
|
+
provider,
|
|
259
|
+
json,
|
|
260
|
+
plain
|
|
261
|
+
}, defaultRuntime);
|
|
262
|
+
return true;
|
|
263
|
+
}
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
match: (path$1) => path$1[0] === "models" && path$1[1] === "status",
|
|
267
|
+
run: async (argv) => {
|
|
268
|
+
const probeProvider = getFlagValue(argv, "--probe-provider");
|
|
269
|
+
if (probeProvider === null) return false;
|
|
270
|
+
const probeTimeout = getFlagValue(argv, "--probe-timeout");
|
|
271
|
+
if (probeTimeout === null) return false;
|
|
272
|
+
const probeConcurrency = getFlagValue(argv, "--probe-concurrency");
|
|
273
|
+
if (probeConcurrency === null) return false;
|
|
274
|
+
const probeMaxTokens = getFlagValue(argv, "--probe-max-tokens");
|
|
275
|
+
if (probeMaxTokens === null) return false;
|
|
276
|
+
const agent = getFlagValue(argv, "--agent");
|
|
277
|
+
if (agent === null) return false;
|
|
278
|
+
const probeProfileValues = getFlagValues(argv, "--probe-profile");
|
|
279
|
+
if (probeProfileValues === null) return false;
|
|
280
|
+
const probeProfile = probeProfileValues.length === 0 ? void 0 : probeProfileValues.length === 1 ? probeProfileValues[0] : probeProfileValues;
|
|
281
|
+
const json = hasFlag(argv, "--json");
|
|
282
|
+
const plain = hasFlag(argv, "--plain");
|
|
283
|
+
const check = hasFlag(argv, "--check");
|
|
284
|
+
const probe = hasFlag(argv, "--probe");
|
|
285
|
+
const { modelsStatusCommand } = await import("./models-ByATbUwH.mjs");
|
|
286
|
+
await modelsStatusCommand({
|
|
287
|
+
json,
|
|
288
|
+
plain,
|
|
289
|
+
check,
|
|
290
|
+
probe,
|
|
291
|
+
probeProvider,
|
|
292
|
+
probeProfile,
|
|
293
|
+
probeTimeout,
|
|
294
|
+
probeConcurrency,
|
|
295
|
+
probeMaxTokens,
|
|
296
|
+
agent
|
|
297
|
+
}, defaultRuntime);
|
|
298
|
+
return true;
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
];
|
|
302
|
+
function findRoutedCommand(path$1) {
|
|
303
|
+
for (const route of routes) if (route.match(path$1)) return route;
|
|
304
|
+
return null;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
//#endregion
|
|
308
|
+
//#region src/cli/route.ts
|
|
309
|
+
async function prepareRoutedCommand(params) {
|
|
310
|
+
const suppressDoctorStdout = hasFlag(params.argv, "--json");
|
|
311
|
+
emitCliBanner(VERSION, { argv: params.argv });
|
|
312
|
+
const { ensureConfigReady } = await import("./config-guard-DljdBlo_.mjs");
|
|
313
|
+
await ensureConfigReady({
|
|
314
|
+
runtime: defaultRuntime,
|
|
315
|
+
commandPath: params.commandPath,
|
|
316
|
+
...suppressDoctorStdout ? { suppressDoctorStdout: true } : {}
|
|
317
|
+
});
|
|
318
|
+
if (typeof params.loadPlugins === "function" ? params.loadPlugins(params.argv) : params.loadPlugins) {
|
|
319
|
+
const { ensurePluginRegistryLoaded } = await import("./plugin-registry-ScEVwc1x.mjs");
|
|
320
|
+
const prev = loggingState.forceConsoleToStderr;
|
|
321
|
+
if (suppressDoctorStdout) loggingState.forceConsoleToStderr = true;
|
|
322
|
+
try {
|
|
323
|
+
ensurePluginRegistryLoaded({ scope: params.commandPath[0] === "status" || params.commandPath[0] === "health" ? "channels" : "all" });
|
|
324
|
+
} finally {
|
|
325
|
+
loggingState.forceConsoleToStderr = prev;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
async function tryRouteCli(argv) {
|
|
330
|
+
if (isTruthyEnvValue(process.env.OPENCLAW_DISABLE_ROUTE_FIRST)) return false;
|
|
331
|
+
if (hasHelpOrVersion(argv)) return false;
|
|
332
|
+
const path$1 = getCommandPathWithRootOptions(argv, 2);
|
|
333
|
+
if (!path$1[0]) return false;
|
|
334
|
+
const route = findRoutedCommand(path$1);
|
|
335
|
+
if (!route) return false;
|
|
336
|
+
await prepareRoutedCommand({
|
|
337
|
+
argv,
|
|
338
|
+
commandPath: path$1,
|
|
339
|
+
loadPlugins: route.loadPlugins
|
|
340
|
+
});
|
|
341
|
+
return route.run(argv);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
//#endregion
|
|
345
|
+
//#region src/cli/run-main.ts
|
|
346
|
+
async function closeCliMemoryManagers() {
|
|
347
|
+
try {
|
|
348
|
+
const { closeAllMemorySearchManagers } = await import("./search-manager-DVUooeTu.mjs");
|
|
349
|
+
await closeAllMemorySearchManagers();
|
|
350
|
+
} catch {}
|
|
351
|
+
}
|
|
352
|
+
function rewriteUpdateFlagArgv(argv) {
|
|
353
|
+
const index = argv.indexOf("--update");
|
|
354
|
+
if (index === -1) return argv;
|
|
355
|
+
const next = [...argv];
|
|
356
|
+
next.splice(index, 1, "update");
|
|
357
|
+
return next;
|
|
358
|
+
}
|
|
359
|
+
function shouldRegisterPrimarySubcommand(argv) {
|
|
360
|
+
return !hasHelpOrVersion(argv);
|
|
361
|
+
}
|
|
362
|
+
function shouldSkipPluginCommandRegistration(params) {
|
|
363
|
+
if (params.hasBuiltinPrimary) return true;
|
|
364
|
+
if (!params.primary) return hasHelpOrVersion(params.argv);
|
|
365
|
+
return false;
|
|
366
|
+
}
|
|
367
|
+
function shouldEnsureCliPath(argv) {
|
|
368
|
+
if (hasHelpOrVersion(argv)) return false;
|
|
369
|
+
const [primary, secondary] = getCommandPathWithRootOptions(argv, 2);
|
|
370
|
+
if (!primary) return true;
|
|
371
|
+
if (primary === "status" || primary === "health" || primary === "sessions") return false;
|
|
372
|
+
if (primary === "config" && (secondary === "get" || secondary === "unset")) return false;
|
|
373
|
+
if (primary === "models" && (secondary === "list" || secondary === "status")) return false;
|
|
374
|
+
return true;
|
|
375
|
+
}
|
|
376
|
+
function shouldUseRootHelpFastPath(argv) {
|
|
377
|
+
return isRootHelpInvocation(argv);
|
|
378
|
+
}
|
|
379
|
+
async function runCli(argv = process$1.argv) {
|
|
380
|
+
let normalizedArgv = normalizeWindowsArgv(argv);
|
|
381
|
+
const parsedProfile = parseCliProfileArgs(normalizedArgv);
|
|
382
|
+
if (!parsedProfile.ok) throw new Error(parsedProfile.error);
|
|
383
|
+
if (parsedProfile.profile) applyCliProfileEnv({ profile: parsedProfile.profile });
|
|
384
|
+
normalizedArgv = parsedProfile.argv;
|
|
385
|
+
loadCliDotEnv({ quiet: true });
|
|
386
|
+
normalizeEnv();
|
|
387
|
+
if (shouldEnsureCliPath(normalizedArgv)) ensureOpenClawCliOnPath();
|
|
388
|
+
assertSupportedRuntime();
|
|
389
|
+
try {
|
|
390
|
+
if (shouldUseRootHelpFastPath(normalizedArgv)) {
|
|
391
|
+
const { outputRootHelp } = await import("./root-help-f4-OF6W7.mjs");
|
|
392
|
+
outputRootHelp();
|
|
393
|
+
return;
|
|
394
|
+
}
|
|
395
|
+
if (await tryRouteCli(normalizedArgv)) return;
|
|
396
|
+
enableConsoleCapture();
|
|
397
|
+
const { buildProgram } = await import("./program-B3JSAo3Q.mjs");
|
|
398
|
+
const program = buildProgram();
|
|
399
|
+
const { installUnhandledRejectionHandler } = await import("./unhandled-rejections-lny3zO5z.mjs");
|
|
400
|
+
installUnhandledRejectionHandler();
|
|
401
|
+
process$1.on("uncaughtException", (error) => {
|
|
402
|
+
console.error("[openclaw] Uncaught exception:", formatUncaughtError(error));
|
|
403
|
+
process$1.exit(1);
|
|
404
|
+
});
|
|
405
|
+
const parseArgv = rewriteUpdateFlagArgv(normalizedArgv);
|
|
406
|
+
const primary = getPrimaryCommand(parseArgv);
|
|
407
|
+
if (primary) {
|
|
408
|
+
const { getProgramContext } = await import("./program-context-DwW582G2.mjs");
|
|
409
|
+
const ctx = getProgramContext(program);
|
|
410
|
+
if (ctx) {
|
|
411
|
+
const { registerCoreCliByName } = await import("./command-registry-CLOY087q.mjs");
|
|
412
|
+
await registerCoreCliByName(program, ctx, primary, parseArgv);
|
|
413
|
+
}
|
|
414
|
+
const { registerSubCliByName } = await import("./register.subclis-Dd7Q2x2W.mjs");
|
|
415
|
+
await registerSubCliByName(program, primary);
|
|
416
|
+
}
|
|
417
|
+
if (!shouldSkipPluginCommandRegistration({
|
|
418
|
+
argv: parseArgv,
|
|
419
|
+
primary,
|
|
420
|
+
hasBuiltinPrimary: primary !== null && program.commands.some((command) => command.name() === primary)
|
|
421
|
+
})) {
|
|
422
|
+
const { registerPluginCliCommands } = await import("./cli-CDO-BM0n.mjs");
|
|
423
|
+
const { loadValidatedConfigForPluginRegistration } = await import("./register.subclis-Dd7Q2x2W.mjs");
|
|
424
|
+
const config = await loadValidatedConfigForPluginRegistration();
|
|
425
|
+
if (config) registerPluginCliCommands(program, config);
|
|
426
|
+
}
|
|
427
|
+
await program.parseAsync(parseArgv);
|
|
428
|
+
} finally {
|
|
429
|
+
await closeCliMemoryManagers();
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function isCliMainModule() {
|
|
433
|
+
return isMainModule({ currentFile: fileURLToPath(import.meta.url) });
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
//#endregion
|
|
437
|
+
export { isCliMainModule, rewriteUpdateFlagArgv, runCli, shouldEnsureCliPath, shouldRegisterPrimarySubcommand, shouldSkipPluginCommandRegistration, shouldUseRootHelpFastPath };
|