@senpi/runtime 3.0.237 → 3.0.238
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/actions/close-position/close-position.action.d.ts.map +1 -1
- package/dist/actions/close-position/close-position.action.js +15 -0
- package/dist/actions/close-position/close-position.action.js.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.d.ts +25 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.d.ts.map +1 -1
- package/dist/actions/llm-decision/openclaw-llm-decision.js +83 -15
- package/dist/actions/llm-decision/openclaw-llm-decision.js.map +1 -1
- package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
- package/dist/actions/open-position/open-position.action.js +15 -0
- package/dist/actions/open-position/open-position.action.js.map +1 -1
- package/dist/adapter/api-wrapper.d.ts +61 -0
- package/dist/adapter/api-wrapper.d.ts.map +1 -0
- package/dist/adapter/api-wrapper.js +92 -0
- package/dist/adapter/api-wrapper.js.map +1 -0
- package/dist/adapter/approvals-file.d.ts +35 -0
- package/dist/adapter/approvals-file.d.ts.map +1 -0
- package/dist/adapter/approvals-file.js +80 -0
- package/dist/adapter/approvals-file.js.map +1 -0
- package/dist/adapter/busy-file.d.ts +56 -0
- package/dist/adapter/busy-file.d.ts.map +1 -0
- package/dist/adapter/busy-file.js +86 -0
- package/dist/adapter/busy-file.js.map +1 -0
- package/dist/adapter/daemon-client.d.ts +37 -0
- package/dist/adapter/daemon-client.d.ts.map +1 -0
- package/dist/adapter/daemon-client.js +74 -0
- package/dist/adapter/daemon-client.js.map +1 -0
- package/dist/adapter/mode.d.ts +28 -0
- package/dist/adapter/mode.d.ts.map +1 -0
- package/dist/adapter/mode.js +42 -0
- package/dist/adapter/mode.js.map +1 -0
- package/dist/adapter/passthrough-cli.d.ts +30 -0
- package/dist/adapter/passthrough-cli.d.ts.map +1 -0
- package/dist/adapter/passthrough-cli.js +44 -0
- package/dist/adapter/passthrough-cli.js.map +1 -0
- package/dist/adapter/runtime-skill-cap.d.ts +13 -0
- package/dist/adapter/runtime-skill-cap.d.ts.map +1 -0
- package/dist/adapter/runtime-skill-cap.js +17 -0
- package/dist/adapter/runtime-skill-cap.js.map +1 -0
- package/dist/approvals/tool-approval-gate.d.ts +2 -0
- package/dist/approvals/tool-approval-gate.d.ts.map +1 -1
- package/dist/approvals/tool-approval-gate.js +5 -2
- package/dist/approvals/tool-approval-gate.js.map +1 -1
- package/dist/cli/daemon-call.d.ts +50 -0
- package/dist/cli/daemon-call.d.ts.map +1 -0
- package/dist/cli/daemon-call.js +165 -0
- package/dist/cli/daemon-call.js.map +1 -0
- package/dist/cli/guide-commands.d.ts.map +1 -1
- package/dist/cli/guide-commands.js +53 -17
- package/dist/cli/guide-commands.js.map +1 -1
- package/dist/cli/senpi-commands.d.ts +8 -6
- package/dist/cli/senpi-commands.d.ts.map +1 -1
- package/dist/cli/senpi-commands.js +101 -67
- package/dist/cli/senpi-commands.js.map +1 -1
- package/dist/cli/standalone.d.ts +24 -0
- package/dist/cli/standalone.d.ts.map +1 -0
- package/dist/cli/standalone.js +111 -0
- package/dist/cli/standalone.js.map +1 -0
- package/dist/cli/update-command.d.ts +7 -8
- package/dist/cli/update-command.d.ts.map +1 -1
- package/dist/cli/update-command.js +8 -33
- package/dist/cli/update-command.js.map +1 -1
- package/dist/daemon/api-version.d.ts +3 -0
- package/dist/daemon/api-version.d.ts.map +1 -0
- package/dist/daemon/api-version.js +3 -0
- package/dist/daemon/api-version.js.map +1 -0
- package/dist/daemon/errors.d.ts +36 -0
- package/dist/daemon/errors.d.ts.map +1 -0
- package/dist/daemon/errors.js +97 -0
- package/dist/daemon/errors.js.map +1 -0
- package/dist/daemon/host.d.ts +130 -0
- package/dist/daemon/host.d.ts.map +1 -0
- package/dist/daemon/host.js +202 -0
- package/dist/daemon/host.js.map +1 -0
- package/dist/daemon/http-routes.d.ts +37 -0
- package/dist/daemon/http-routes.d.ts.map +1 -0
- package/dist/daemon/http-routes.js +233 -0
- package/dist/daemon/http-routes.js.map +1 -0
- package/dist/daemon/main.d.ts +93 -0
- package/dist/daemon/main.d.ts.map +1 -0
- package/dist/daemon/main.js +308 -0
- package/dist/daemon/main.js.map +1 -0
- package/dist/daemon/mcp-endpoint.d.ts +55 -0
- package/dist/daemon/mcp-endpoint.d.ts.map +1 -0
- package/dist/daemon/mcp-endpoint.js +178 -0
- package/dist/daemon/mcp-endpoint.js.map +1 -0
- package/dist/daemon/memory.d.ts +29 -0
- package/dist/daemon/memory.d.ts.map +1 -0
- package/dist/daemon/memory.js +74 -0
- package/dist/daemon/memory.js.map +1 -0
- package/dist/daemon/owner-lock.d.ts +44 -0
- package/dist/daemon/owner-lock.d.ts.map +1 -0
- package/dist/daemon/owner-lock.js +149 -0
- package/dist/daemon/owner-lock.js.map +1 -0
- package/dist/daemon/request-ids.d.ts +48 -0
- package/dist/daemon/request-ids.d.ts.map +1 -0
- package/dist/daemon/request-ids.js +123 -0
- package/dist/daemon/request-ids.js.map +1 -0
- package/dist/daemon/route-table.d.ts +51 -0
- package/dist/daemon/route-table.d.ts.map +1 -0
- package/dist/daemon/route-table.js +120 -0
- package/dist/daemon/route-table.js.map +1 -0
- package/dist/daemon/telemetry-ws.d.ts +60 -0
- package/dist/daemon/telemetry-ws.d.ts.map +1 -0
- package/dist/daemon/telemetry-ws.js +166 -0
- package/dist/daemon/telemetry-ws.js.map +1 -0
- package/dist/daemon/update-request.d.ts +145 -0
- package/dist/daemon/update-request.d.ts.map +1 -0
- package/dist/daemon/update-request.js +250 -0
- package/dist/daemon/update-request.js.map +1 -0
- package/dist/deploy/package.d.ts +8 -0
- package/dist/deploy/package.d.ts.map +1 -1
- package/dist/deploy/package.js +8 -0
- package/dist/deploy/package.js.map +1 -1
- package/dist/deploy/recheck-commands.d.ts +2 -0
- package/dist/deploy/recheck-commands.d.ts.map +1 -1
- package/dist/deploy/recheck-commands.js +4 -0
- package/dist/deploy/recheck-commands.js.map +1 -1
- package/dist/deploy/sim-admission.d.ts +94 -0
- package/dist/deploy/sim-admission.d.ts.map +1 -0
- package/dist/deploy/sim-admission.js +138 -0
- package/dist/deploy/sim-admission.js.map +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +174 -14
- package/dist/index.js.map +1 -1
- package/dist/runtime/agent-wake.d.ts +116 -0
- package/dist/runtime/agent-wake.d.ts.map +1 -0
- package/dist/runtime/agent-wake.js +181 -0
- package/dist/runtime/agent-wake.js.map +1 -0
- package/dist/runtime/auto-update/coordinator.d.ts +18 -0
- package/dist/runtime/auto-update/coordinator.d.ts.map +1 -1
- package/dist/runtime/auto-update/coordinator.js +80 -2
- package/dist/runtime/auto-update/coordinator.js.map +1 -1
- package/dist/runtime/auto-update/idle-gate.d.ts +12 -1
- package/dist/runtime/auto-update/idle-gate.d.ts.map +1 -1
- package/dist/runtime/auto-update/idle-gate.js +7 -4
- package/dist/runtime/auto-update/idle-gate.js.map +1 -1
- package/dist/runtime/create-actions.d.ts +5 -1
- package/dist/runtime/create-actions.d.ts.map +1 -1
- package/dist/runtime/create-actions.js +17 -2
- package/dist/runtime/create-actions.js.map +1 -1
- package/dist/runtime/decision-errors.d.ts +5 -0
- package/dist/runtime/decision-errors.d.ts.map +1 -1
- package/dist/runtime/decision-errors.js +10 -0
- package/dist/runtime/decision-errors.js.map +1 -1
- package/dist/runtime/recipe-file.d.ts +73 -0
- package/dist/runtime/recipe-file.d.ts.map +1 -0
- package/dist/runtime/recipe-file.js +194 -0
- package/dist/runtime/recipe-file.js.map +1 -0
- package/dist/runtime/runtime-descriptor.d.ts +23 -0
- package/dist/runtime/runtime-descriptor.d.ts.map +1 -1
- package/dist/runtime/runtime-descriptor.js +40 -0
- package/dist/runtime/runtime-descriptor.js.map +1 -1
- package/dist/runtime/runtime.d.ts +12 -0
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +109 -4
- package/dist/runtime/runtime.js.map +1 -1
- package/dist/runtime/update-apply-deps.d.ts +4 -2
- package/dist/runtime/update-apply-deps.d.ts.map +1 -1
- package/dist/runtime/update-apply-deps.js +4 -2
- package/dist/runtime/update-apply-deps.js.map +1 -1
- package/dist/runtime/update-handler.d.ts +6 -0
- package/dist/runtime/update-handler.d.ts.map +1 -1
- package/dist/runtime/update-handler.js +159 -12
- package/dist/runtime/update-handler.js.map +1 -1
- package/dist/runtime/update-register.d.ts.map +1 -1
- package/dist/runtime/update-register.js +18 -0
- package/dist/runtime/update-register.js.map +1 -1
- package/dist/runtime-api/extensions.d.ts +20 -0
- package/dist/runtime-api/extensions.d.ts.map +1 -0
- package/dist/runtime-api/extensions.js +28 -0
- package/dist/runtime-api/extensions.js.map +1 -0
- package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
- package/dist/runtime-api/intake/intake-mount.js +3 -1
- package/dist/runtime-api/intake/intake-mount.js.map +1 -1
- package/dist/runtime-api/lifecycle.d.ts.map +1 -1
- package/dist/runtime-api/lifecycle.js +6 -0
- package/dist/runtime-api/lifecycle.js.map +1 -1
- package/dist/runtime-api/server.d.ts.map +1 -1
- package/dist/runtime-api/server.js +3 -0
- package/dist/runtime-api/server.js.map +1 -1
- package/dist/scanners/external-scanner-receiver.d.ts +2 -0
- package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
- package/dist/scanners/external-scanner-receiver.js +4 -0
- package/dist/scanners/external-scanner-receiver.js.map +1 -1
- package/dist/telemetry/context.d.ts +17 -0
- package/dist/telemetry/context.d.ts.map +1 -1
- package/dist/telemetry/context.js.map +1 -1
- package/dist/telemetry/otel-sdk.d.ts +2 -0
- package/dist/telemetry/otel-sdk.d.ts.map +1 -1
- package/dist/telemetry/otel-sdk.js +2 -0
- package/dist/telemetry/otel-sdk.js.map +1 -1
- package/dist/types/scanner.d.ts +6 -0
- package/dist/types/scanner.d.ts.map +1 -1
- package/dist/validate/package-gates-stage.d.ts +13 -1
- package/dist/validate/package-gates-stage.d.ts.map +1 -1
- package/dist/validate/package-gates-stage.js +3 -8
- package/dist/validate/package-gates-stage.js.map +1 -1
- package/dist/validate/target.d.ts +75 -1
- package/dist/validate/target.d.ts.map +1 -1
- package/dist/validate/target.js +94 -28
- package/dist/validate/target.js.map +1 -1
- package/openclaw.plugin.json +1 -1
- package/package.json +8 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"senpi-commands.d.ts","sourceRoot":"","sources":["../../src/cli/senpi-commands.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"senpi-commands.d.ts","sourceRoot":"","sources":["../../src/cli/senpi-commands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAyBH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAe/D;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE;IAAE,OAAO,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,gBAAgB,GAAG,OAAO,CAAA;CAAE,GAChF,IAAI,CA68CN;AAsaD;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAEjG;AAoCD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAEzD;AACD,iGAAiG;AACjG,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAKxE;AAmND;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,MAAM,CAWvE;AAmDD,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CASjE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAW3E;AA4ID,kEAAkE;AAClE,UAAU,gBAAgB;IACxB,uGAAuG;IACvG,OAAO,CACL,IAAI,EAAE,MAAM,EACZ,UAAU,CAAC,EAAE,MAAM,GAAG;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,EAC1C,IAAI,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE,GAC1B,gBAAgB,CAAC;IACpB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC5C,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC/D,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC9D,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACtE,MAAM,CACJ,EAAE,EACE,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACzD,CAAC,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,GACzE,gBAAgB,CAAC;CACrB"}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* OpenClaw CLI commands: openclaw senpi runtime create | list | delete.
|
|
3
3
|
* Thin layer: all three invoke gateway RPCs only; validation and registry live in the gateway.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { fileURLToPath } from "node:url";
|
|
6
|
+
import { readFileSync } from "node:fs";
|
|
6
7
|
// Re-exported from a helper that constructs the standard-library module
|
|
7
8
|
// spec dynamically — keeps the literal "c_p" string out of this file's
|
|
8
9
|
// emitted JS, so OpenClaw's install-time security scanner doesn't flag
|
|
@@ -15,6 +16,7 @@ import { exitCodeForDeploy, renderDeploySnapshot } from "./deploy-render.js";
|
|
|
15
16
|
import { isRefusalMessage } from "../deploy/taxonomy.js";
|
|
16
17
|
import { registerValidateCommand } from "./validate-command.js";
|
|
17
18
|
import { registerUpdateCommand, updateRefusalExitCode } from "./update-command.js";
|
|
19
|
+
import { NODE_RECIPE_FILE_IO } from "../runtime/recipe-file.js";
|
|
18
20
|
import { registerQuantCommands } from "./quant-command.js";
|
|
19
21
|
import { VERSION } from "../version.js";
|
|
20
22
|
/**
|
|
@@ -45,21 +47,7 @@ export function registerSenpiCli(program) {
|
|
|
45
47
|
// A refused INVOCATION (`[E_UPDATE_PARAMS]`) exits 3, as the verb's own mapping does; every
|
|
46
48
|
// other refusal keeps 2, `[E_UPDATE_PARAM_UNSUPPORTED]` (a gateway older than this CLI) included.
|
|
47
49
|
callGateway: (method, params, opts) => callGatewayJson(method, params, undefined, { refusalExitCode: updateRefusalExitCode, ...opts }) ?? undefined,
|
|
48
|
-
|
|
49
|
-
dirname: (p) => path.dirname(p),
|
|
50
|
-
readFile: (p) => readFileSync(p, "utf8"),
|
|
51
|
-
isDirectory: (p) => { try {
|
|
52
|
-
return statSync(p).isDirectory();
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
return false;
|
|
56
|
-
} },
|
|
57
|
-
fileExists: (p) => { try {
|
|
58
|
-
return statSync(p).isFile();
|
|
59
|
-
}
|
|
60
|
-
catch {
|
|
61
|
-
return false;
|
|
62
|
-
} },
|
|
50
|
+
...NODE_RECIPE_FILE_IO,
|
|
63
51
|
// `writeJson`'s channel, not console.log: OpenClaw diverts every console.* call to stderr once
|
|
64
52
|
// any command in the parse chain declares --json, so the document a --json caller reads was
|
|
65
53
|
// landing on stderr with stdout empty. The helper directly above this file's callGatewayJson
|
|
@@ -151,7 +139,7 @@ export function registerSenpiCli(program) {
|
|
|
151
139
|
// which routinely exceeds the gateway client's 10s default and returns a
|
|
152
140
|
// spurious GatewayTransportError while the runtime is in fact coming up.
|
|
153
141
|
// Wait long enough for the install to actually complete and report truthfully.
|
|
154
|
-
const result = spawnSync(
|
|
142
|
+
const result = spawnSync(gatewayCallCommand("senpi.installRuntime"), gatewayCallArgs("senpi.installRuntime", ["--timeout", "60000", "--params", JSON.stringify(params)]), {
|
|
155
143
|
stdio: "inherit",
|
|
156
144
|
cwd: process.cwd(),
|
|
157
145
|
});
|
|
@@ -177,7 +165,7 @@ export function registerSenpiCli(program) {
|
|
|
177
165
|
params.id = runtimeId;
|
|
178
166
|
if (address)
|
|
179
167
|
params.address = address;
|
|
180
|
-
const result = spawnSync(
|
|
168
|
+
const result = spawnSync(gatewayCallCommand("senpi.deleteRuntime"), gatewayCallArgs("senpi.deleteRuntime", ["--params", JSON.stringify(params)]), { stdio: "inherit", cwd: process.cwd() });
|
|
181
169
|
process.exitCode = result.status ?? 1;
|
|
182
170
|
});
|
|
183
171
|
runtime
|
|
@@ -229,10 +217,10 @@ export function registerSenpiCli(program) {
|
|
|
229
217
|
params.runtimeId = opts.runtime;
|
|
230
218
|
if (typeof opts.address === "string" && opts.address.length > 0)
|
|
231
219
|
params.address = opts.address;
|
|
232
|
-
const result = spawnSync(
|
|
220
|
+
const result = spawnSync(gatewayCallCommand("senpi.listDslPositions"), gatewayCallArgs("senpi.listDslPositions", ["--json", "--params", JSON.stringify(params)]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
233
221
|
if (result.status !== 0) {
|
|
234
222
|
process.exitCode = result.status ?? 1;
|
|
235
|
-
|
|
223
|
+
reportGatewayCallFailure(result.stdout);
|
|
236
224
|
return;
|
|
237
225
|
}
|
|
238
226
|
let data;
|
|
@@ -292,10 +280,10 @@ export function registerSenpiCli(program) {
|
|
|
292
280
|
params.runtimeId = opts.runtime;
|
|
293
281
|
if (typeof opts.address === "string" && opts.address.length > 0)
|
|
294
282
|
params.address = opts.address;
|
|
295
|
-
const result = spawnSync(
|
|
283
|
+
const result = spawnSync(gatewayCallCommand("senpi.getDslPositionState"), gatewayCallArgs("senpi.getDslPositionState", ["--json", "--params", JSON.stringify(params)]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
296
284
|
if (result.status !== 0) {
|
|
297
285
|
process.exitCode = result.status ?? 1;
|
|
298
|
-
|
|
286
|
+
reportGatewayCallFailure(result.stdout);
|
|
299
287
|
return;
|
|
300
288
|
}
|
|
301
289
|
let data;
|
|
@@ -360,10 +348,10 @@ export function registerSenpiCli(program) {
|
|
|
360
348
|
if (Number.isFinite(n))
|
|
361
349
|
params.limit = n;
|
|
362
350
|
}
|
|
363
|
-
const result = spawnSync(
|
|
351
|
+
const result = spawnSync(gatewayCallCommand("senpi.listDslArchives"), gatewayCallArgs("senpi.listDslArchives", ["--json", "--params", JSON.stringify(params)]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
364
352
|
if (result.status !== 0) {
|
|
365
353
|
process.exitCode = result.status ?? 1;
|
|
366
|
-
|
|
354
|
+
reportGatewayCallFailure(result.stdout);
|
|
367
355
|
return;
|
|
368
356
|
}
|
|
369
357
|
let data;
|
|
@@ -426,10 +414,10 @@ export function registerSenpiCli(program) {
|
|
|
426
414
|
if (typeof opts.address === "string" && opts.address.length > 0) {
|
|
427
415
|
params.address = opts.address;
|
|
428
416
|
}
|
|
429
|
-
const result = spawnSync(
|
|
417
|
+
const result = spawnSync(gatewayCallCommand("senpi.listActions"), gatewayCallArgs("senpi.listActions", ["--json", "--params", JSON.stringify(params)]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
430
418
|
if (result.status !== 0) {
|
|
431
419
|
process.exitCode = result.status ?? 1;
|
|
432
|
-
|
|
420
|
+
reportGatewayCallFailure(result.stdout);
|
|
433
421
|
return;
|
|
434
422
|
}
|
|
435
423
|
let data;
|
|
@@ -489,10 +477,10 @@ export function registerSenpiCli(program) {
|
|
|
489
477
|
if (typeof opts.address === "string" && opts.address.length > 0) {
|
|
490
478
|
params.address = opts.address;
|
|
491
479
|
}
|
|
492
|
-
const result = spawnSync(
|
|
480
|
+
const result = spawnSync(gatewayCallCommand("senpi.getActionState"), gatewayCallArgs("senpi.getActionState", ["--json", "--params", JSON.stringify(params)]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
493
481
|
if (result.status !== 0) {
|
|
494
482
|
process.exitCode = result.status ?? 1;
|
|
495
|
-
|
|
483
|
+
reportGatewayCallFailure(result.stdout);
|
|
496
484
|
return;
|
|
497
485
|
}
|
|
498
486
|
let data;
|
|
@@ -556,10 +544,10 @@ export function registerSenpiCli(program) {
|
|
|
556
544
|
params.limit = n;
|
|
557
545
|
}
|
|
558
546
|
}
|
|
559
|
-
const result = spawnSync(
|
|
547
|
+
const result = spawnSync(gatewayCallCommand("senpi.getActionHistory"), gatewayCallArgs("senpi.getActionHistory", ["--json", "--params", JSON.stringify(params)]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
560
548
|
if (result.status !== 0) {
|
|
561
549
|
process.exitCode = result.status ?? 1;
|
|
562
|
-
|
|
550
|
+
reportGatewayCallFailure(result.stdout);
|
|
563
551
|
return;
|
|
564
552
|
}
|
|
565
553
|
let data;
|
|
@@ -626,10 +614,10 @@ export function registerSenpiCli(program) {
|
|
|
626
614
|
params.limit = n;
|
|
627
615
|
}
|
|
628
616
|
}
|
|
629
|
-
const result = spawnSync(
|
|
617
|
+
const result = spawnSync(gatewayCallCommand("senpi.getActionHistory"), gatewayCallArgs("senpi.getActionHistory", ["--json", "--params", JSON.stringify(params)]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
630
618
|
if (result.status !== 0) {
|
|
631
619
|
process.exitCode = result.status ?? 1;
|
|
632
|
-
|
|
620
|
+
reportGatewayCallFailure(result.stdout);
|
|
633
621
|
return;
|
|
634
622
|
}
|
|
635
623
|
let data;
|
|
@@ -694,11 +682,20 @@ export function registerSenpiCli(program) {
|
|
|
694
682
|
return;
|
|
695
683
|
}
|
|
696
684
|
const payload = (data.payload ?? data);
|
|
685
|
+
const reportedBy = payload.approvals?.reportedAt ? ` (reported by the agent at ${payload.approvals.reportedAt})` : "";
|
|
697
686
|
const statuses = selectMany(payload.status, payload.statuses ?? []);
|
|
698
687
|
if (opts.json) {
|
|
699
|
-
writeJson({
|
|
688
|
+
writeJson({
|
|
689
|
+
ok: true,
|
|
690
|
+
statuses,
|
|
691
|
+
...(payload.approvals ? { approvals: payload.approvals } : {}),
|
|
692
|
+
...(payload.runtimeModeWarning ? { runtimeModeWarning: payload.runtimeModeWarning } : {}),
|
|
693
|
+
});
|
|
700
694
|
return;
|
|
701
695
|
}
|
|
696
|
+
if (payload.runtimeModeWarning) {
|
|
697
|
+
console.log(`WARNING runtime mode: ${payload.runtimeModeWarning}. The runtime trades inside OpenClaw (plugin mode).`);
|
|
698
|
+
}
|
|
702
699
|
// A box-level fact, printed whatever the runtimes say: without run
|
|
703
700
|
// classification the approval gate asks in every run (D15). Only a case the
|
|
704
701
|
// box can fix is a warning. On 5.x (`hostLimit`) every run is asked exactly
|
|
@@ -709,7 +706,8 @@ export function registerSenpiCli(program) {
|
|
|
709
706
|
// a reason may carry.
|
|
710
707
|
const reason = payload.approvals.reason?.trim().replace(/[.\s]+$/, "");
|
|
711
708
|
console.log("WARNING trade approvals: this box cannot tell chat turns from scheduled runs, so every run is asked, scheduled ones included." +
|
|
712
|
-
(reason ? ` Reason: ${reason}.` : "")
|
|
709
|
+
(reason ? ` Reason: ${reason}.` : "") +
|
|
710
|
+
reportedBy);
|
|
713
711
|
}
|
|
714
712
|
// The gate fails closed on a run it cannot classify, so a chat turn can be refused while
|
|
715
713
|
// classification reads `available`. The counts are what tell that apart from a one-off.
|
|
@@ -717,7 +715,8 @@ export function registerSenpiCli(program) {
|
|
|
717
715
|
const { unclassifiedBlocks, runsRecorded, lastUnclassifiedBlockAt } = payload.approvals;
|
|
718
716
|
console.log(`WARNING trade approvals: ${unclassifiedBlocks} gated call(s) were refused since the gateway started because their run could not be classified as a chat turn ` +
|
|
719
717
|
`(last ${lastUnclassifiedBlockAt ?? "unknown"}; ${runsRecorded ?? 0} run(s) recorded). A new chat message starts a new run. ` +
|
|
720
|
-
"If trades keep being refused in chat, this box needs Senpi support; it is not a strategy problem."
|
|
718
|
+
"If trades keep being refused in chat, this box needs Senpi support; it is not a strategy problem." +
|
|
719
|
+
reportedBy);
|
|
721
720
|
}
|
|
722
721
|
if (statuses.length === 0) {
|
|
723
722
|
console.log("No running runtime health status.");
|
|
@@ -1008,20 +1007,14 @@ export function registerSenpiCli(program) {
|
|
|
1008
1007
|
// install (120s, see run-update-command.ts), the post-tick hook and a
|
|
1009
1008
|
// config write. The gateway client's 10s default would report a transport
|
|
1010
1009
|
// error while the install is still running, so ask for the real budget.
|
|
1011
|
-
const result = spawnSync(
|
|
1012
|
-
process.argv[1],
|
|
1013
|
-
"gateway",
|
|
1014
|
-
"call",
|
|
1015
|
-
"senpi.autoUpdate.checkNow",
|
|
1016
|
-
"--json",
|
|
1010
|
+
const result = spawnSync(gatewayCallCommand("senpi.autoUpdate.checkNow"), gatewayCallArgs("senpi.autoUpdate.checkNow", ["--json",
|
|
1017
1011
|
"--timeout",
|
|
1018
1012
|
"180000",
|
|
1019
1013
|
"--params",
|
|
1020
|
-
"{}",
|
|
1021
|
-
], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
1014
|
+
"{}"]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
1022
1015
|
if (result.status !== 0) {
|
|
1023
1016
|
process.exitCode = result.status ?? 1;
|
|
1024
|
-
|
|
1017
|
+
reportGatewayCallFailure(result.stdout);
|
|
1025
1018
|
return;
|
|
1026
1019
|
}
|
|
1027
1020
|
let data;
|
|
@@ -1083,10 +1076,10 @@ export function registerSenpiCli(program) {
|
|
|
1083
1076
|
.description("Show installed skills, their versions, and any pending updates")
|
|
1084
1077
|
.option("--json", "Print raw JSON from the gateway")
|
|
1085
1078
|
.action(async (opts) => {
|
|
1086
|
-
const result = spawnSync(
|
|
1079
|
+
const result = spawnSync(gatewayCallCommand("senpi.skills.status"), gatewayCallArgs("senpi.skills.status", ["--json", "--params", "{}"]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
1087
1080
|
if (result.status !== 0) {
|
|
1088
1081
|
process.exitCode = result.status ?? 1;
|
|
1089
|
-
|
|
1082
|
+
reportGatewayCallFailure(result.stdout);
|
|
1090
1083
|
return;
|
|
1091
1084
|
}
|
|
1092
1085
|
let data;
|
|
@@ -1154,18 +1147,12 @@ export function registerSenpiCli(program) {
|
|
|
1154
1147
|
// Pre-fix this command used `stdio: "inherit"` and dumped the raw JSON
|
|
1155
1148
|
// envelope at every invocation — inconsistent with the other two
|
|
1156
1149
|
// subcommands of the same group.
|
|
1157
|
-
const result = spawnSync(
|
|
1158
|
-
process.argv[1],
|
|
1159
|
-
"gateway",
|
|
1160
|
-
"call",
|
|
1161
|
-
"senpi.skills.update",
|
|
1162
|
-
"--json",
|
|
1150
|
+
const result = spawnSync(gatewayCallCommand("senpi.skills.update"), gatewayCallArgs("senpi.skills.update", ["--json",
|
|
1163
1151
|
"--params",
|
|
1164
|
-
JSON.stringify({ name }),
|
|
1165
|
-
], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
1152
|
+
JSON.stringify({ name })]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
1166
1153
|
if (result.status !== 0) {
|
|
1167
1154
|
process.exitCode = result.status ?? 1;
|
|
1168
|
-
|
|
1155
|
+
reportGatewayCallFailure(result.stdout);
|
|
1169
1156
|
return;
|
|
1170
1157
|
}
|
|
1171
1158
|
let data;
|
|
@@ -1209,10 +1196,10 @@ export function registerSenpiCli(program) {
|
|
|
1209
1196
|
.description("Force an immediate version check and apply for all managed skills")
|
|
1210
1197
|
.option("--json", "Print raw JSON from the gateway")
|
|
1211
1198
|
.action(async (opts) => {
|
|
1212
|
-
const result = spawnSync(
|
|
1199
|
+
const result = spawnSync(gatewayCallCommand("senpi.skills.updateAll"), gatewayCallArgs("senpi.skills.updateAll", ["--json", "--params", "{}"]), { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
|
|
1213
1200
|
if (result.status !== 0) {
|
|
1214
1201
|
process.exitCode = result.status ?? 1;
|
|
1215
|
-
|
|
1202
|
+
reportGatewayCallFailure(result.stdout);
|
|
1216
1203
|
return;
|
|
1217
1204
|
}
|
|
1218
1205
|
let data;
|
|
@@ -1585,17 +1572,16 @@ function reportUnreadableGateway(verb, cause, followUp = "") {
|
|
|
1585
1572
|
followUp);
|
|
1586
1573
|
}
|
|
1587
1574
|
/**
|
|
1588
|
-
* argv
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1575
|
+
* The argv after the method name for a JSON `gateway call` (see {@link gatewayCallArgs}, which
|
|
1576
|
+
* places it). Exported so the timeout wiring is testable without a subprocess. `--timeout` is the
|
|
1577
|
+
* per-call gateway timeout (the CLI default is 10 s); omitting `timeoutMs` keeps the historical argv
|
|
1578
|
+
* byte-for-byte, so every existing caller is unchanged. The daemon-call helper reads the same flags.
|
|
1591
1579
|
*
|
|
1592
|
-
* @param method Gateway method name, e.g. `senpi.quant.status`.
|
|
1593
1580
|
* @param params JSON-serialisable params, passed as one `--params` argv element (never via a shell).
|
|
1594
1581
|
* @param timeoutMs Optional per-call timeout in milliseconds, placed before `--params`.
|
|
1595
|
-
* @returns argv to append after the OpenClaw entry script.
|
|
1596
1582
|
*/
|
|
1597
|
-
export function
|
|
1598
|
-
return ["
|
|
1583
|
+
export function gatewayJsonCallArgs(params, timeoutMs) {
|
|
1584
|
+
return ["--json", ...(timeoutMs !== undefined ? ["--timeout", String(timeoutMs)] : []), "--params", JSON.stringify(params)];
|
|
1599
1585
|
}
|
|
1600
1586
|
/**
|
|
1601
1587
|
* `onFailure` fires on either null path, naming which one. Callers that pass it own the exit code
|
|
@@ -1618,9 +1604,55 @@ export function gatewayCallArgs(method, params, timeoutMs) {
|
|
|
1618
1604
|
* the child's text — for verbs whose own first stderr line is a contract (`senpi quant run`'s
|
|
1619
1605
|
* `[quant-desk] run <id>`), which success-path diagnostics from the child would otherwise push down.
|
|
1620
1606
|
*/
|
|
1607
|
+
/** The daemon-call helper, next to this module in the build (`dist/cli/daemon-call.js`). */
|
|
1608
|
+
const DAEMON_CALL_SCRIPT = fileURLToPath(new URL("./daemon-call.js", import.meta.url));
|
|
1609
|
+
/**
|
|
1610
|
+
* Where one `gateway call <method>` goes. Inside OpenClaw: this process's own `gateway call`.
|
|
1611
|
+
* Standalone `senpi` (SENPI_CLI_TRANSPORT=daemon): the daemon-call helper, which prints what
|
|
1612
|
+
* `openclaw gateway call --json` prints; `senpi.skills.*` is served by the adapter's skills manager
|
|
1613
|
+
* inside OpenClaw, so it goes to the `openclaw` binary even then.
|
|
1614
|
+
*/
|
|
1615
|
+
function gatewayCallTarget(method) {
|
|
1616
|
+
if (process.env.SENPI_CLI_TRANSPORT !== "daemon")
|
|
1617
|
+
return "self";
|
|
1618
|
+
return method.startsWith("senpi.skills.") ? "openclaw" : "daemon";
|
|
1619
|
+
}
|
|
1620
|
+
export function gatewayCallCommand(method) {
|
|
1621
|
+
return gatewayCallTarget(method) === "openclaw" ? "openclaw" : process.argv[0];
|
|
1622
|
+
}
|
|
1623
|
+
/** `rest` is everything after the method name: `--json`, `--timeout <ms>`, `--params <json>`. */
|
|
1624
|
+
export function gatewayCallArgs(method, rest) {
|
|
1625
|
+
const target = gatewayCallTarget(method);
|
|
1626
|
+
if (target === "daemon")
|
|
1627
|
+
return [DAEMON_CALL_SCRIPT, method, ...rest];
|
|
1628
|
+
if (target === "openclaw")
|
|
1629
|
+
return ["gateway", "call", method, ...rest];
|
|
1630
|
+
return [process.argv[1], "gateway", "call", method, ...rest];
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* A `gateway call` that exited non-zero, for the commands that read its stdout themselves. Under
|
|
1634
|
+
* the standalone `senpi` the answer is an error envelope on stdout: print its message (it was
|
|
1635
|
+
* swallowed with the captured stdout), and give the "not running" tip only when nothing answered,
|
|
1636
|
+
* naming the right process.
|
|
1637
|
+
*/
|
|
1638
|
+
function reportGatewayCallFailure(stdout) {
|
|
1639
|
+
if (process.env.SENPI_CLI_TRANSPORT !== "daemon") {
|
|
1640
|
+
console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
|
|
1641
|
+
return;
|
|
1642
|
+
}
|
|
1643
|
+
const envelope = readGatewayErrorEnvelope(typeof stdout === "string" ? stdout : "");
|
|
1644
|
+
if (envelope)
|
|
1645
|
+
console.error(envelope.message);
|
|
1646
|
+
if (envelope?.type === "gateway_request_error")
|
|
1647
|
+
return;
|
|
1648
|
+
console.error("\nTip: the runtime daemon is restarting or not running; retry in a moment.");
|
|
1649
|
+
}
|
|
1621
1650
|
function callGatewayJson(method, params, onFailure, opts) {
|
|
1622
|
-
|
|
1623
|
-
|
|
1651
|
+
// Standalone `senpi` (the runtime daemon's CLI) calls the daemon over its local HTTP API; the
|
|
1652
|
+
// helper prints exactly what `openclaw gateway call --json` prints, so everything below is the same.
|
|
1653
|
+
// `senpi.skills.*` is served by the adapter's skills manager inside OpenClaw, so it keeps going
|
|
1654
|
+
// through `openclaw gateway call` (the `openclaw` binary, not this process) even then.
|
|
1655
|
+
const result = spawnSync(gatewayCallCommand(method), gatewayCallArgs(method, gatewayJsonCallArgs(params, opts?.timeoutMs)),
|
|
1624
1656
|
// stderr is PIPED, where it used to be inherited, for one reason: a gateway REFUSAL arrives
|
|
1625
1657
|
// only there, and a stderr this process never sees is a stderr it can contradict. The child
|
|
1626
1658
|
// still owns every character of it — see the verbatim re-emit directly below.
|
|
@@ -1678,7 +1710,9 @@ function callGatewayJson(method, params, onFailure, opts) {
|
|
|
1678
1710
|
return null;
|
|
1679
1711
|
}
|
|
1680
1712
|
process.exitCode = result.status ?? 1;
|
|
1681
|
-
console.error(
|
|
1713
|
+
console.error(gatewayCallTarget(method) === "daemon"
|
|
1714
|
+
? "\nTip: the runtime daemon is restarting or not running; retry in a moment."
|
|
1715
|
+
: "\nTip: If the gateway is not running, start it with: openclaw gateway run");
|
|
1682
1716
|
onFailure?.("dispatch");
|
|
1683
1717
|
return null;
|
|
1684
1718
|
}
|