@senpi/runtime 3.0.237 → 3.0.239

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 (218) hide show
  1. package/dist/actions/close-position/close-position.action.d.ts.map +1 -1
  2. package/dist/actions/close-position/close-position.action.js +15 -0
  3. package/dist/actions/close-position/close-position.action.js.map +1 -1
  4. package/dist/actions/llm-decision/openclaw-llm-decision.d.ts +25 -1
  5. package/dist/actions/llm-decision/openclaw-llm-decision.d.ts.map +1 -1
  6. package/dist/actions/llm-decision/openclaw-llm-decision.js +83 -15
  7. package/dist/actions/llm-decision/openclaw-llm-decision.js.map +1 -1
  8. package/dist/actions/open-position/open-position.action.d.ts.map +1 -1
  9. package/dist/actions/open-position/open-position.action.js +15 -0
  10. package/dist/actions/open-position/open-position.action.js.map +1 -1
  11. package/dist/adapter/api-wrapper.d.ts +61 -0
  12. package/dist/adapter/api-wrapper.d.ts.map +1 -0
  13. package/dist/adapter/api-wrapper.js +92 -0
  14. package/dist/adapter/api-wrapper.js.map +1 -0
  15. package/dist/adapter/approvals-file.d.ts +35 -0
  16. package/dist/adapter/approvals-file.d.ts.map +1 -0
  17. package/dist/adapter/approvals-file.js +80 -0
  18. package/dist/adapter/approvals-file.js.map +1 -0
  19. package/dist/adapter/busy-file.d.ts +56 -0
  20. package/dist/adapter/busy-file.d.ts.map +1 -0
  21. package/dist/adapter/busy-file.js +86 -0
  22. package/dist/adapter/busy-file.js.map +1 -0
  23. package/dist/adapter/daemon-client.d.ts +37 -0
  24. package/dist/adapter/daemon-client.d.ts.map +1 -0
  25. package/dist/adapter/daemon-client.js +74 -0
  26. package/dist/adapter/daemon-client.js.map +1 -0
  27. package/dist/adapter/mode.d.ts +28 -0
  28. package/dist/adapter/mode.d.ts.map +1 -0
  29. package/dist/adapter/mode.js +42 -0
  30. package/dist/adapter/mode.js.map +1 -0
  31. package/dist/adapter/passthrough-cli.d.ts +30 -0
  32. package/dist/adapter/passthrough-cli.d.ts.map +1 -0
  33. package/dist/adapter/passthrough-cli.js +44 -0
  34. package/dist/adapter/passthrough-cli.js.map +1 -0
  35. package/dist/adapter/runtime-skill-cap.d.ts +13 -0
  36. package/dist/adapter/runtime-skill-cap.d.ts.map +1 -0
  37. package/dist/adapter/runtime-skill-cap.js +17 -0
  38. package/dist/adapter/runtime-skill-cap.js.map +1 -0
  39. package/dist/approvals/tool-approval-gate.d.ts +2 -0
  40. package/dist/approvals/tool-approval-gate.d.ts.map +1 -1
  41. package/dist/approvals/tool-approval-gate.js +5 -2
  42. package/dist/approvals/tool-approval-gate.js.map +1 -1
  43. package/dist/cli/daemon-call.d.ts +50 -0
  44. package/dist/cli/daemon-call.d.ts.map +1 -0
  45. package/dist/cli/daemon-call.js +165 -0
  46. package/dist/cli/daemon-call.js.map +1 -0
  47. package/dist/cli/guide-commands.d.ts.map +1 -1
  48. package/dist/cli/guide-commands.js +64 -24
  49. package/dist/cli/guide-commands.js.map +1 -1
  50. package/dist/cli/senpi-commands.d.ts +8 -6
  51. package/dist/cli/senpi-commands.d.ts.map +1 -1
  52. package/dist/cli/senpi-commands.js +102 -68
  53. package/dist/cli/senpi-commands.js.map +1 -1
  54. package/dist/cli/standalone.d.ts +24 -0
  55. package/dist/cli/standalone.d.ts.map +1 -0
  56. package/dist/cli/standalone.js +111 -0
  57. package/dist/cli/standalone.js.map +1 -0
  58. package/dist/cli/update-command.d.ts +7 -8
  59. package/dist/cli/update-command.d.ts.map +1 -1
  60. package/dist/cli/update-command.js +8 -33
  61. package/dist/cli/update-command.js.map +1 -1
  62. package/dist/daemon/api-version.d.ts +3 -0
  63. package/dist/daemon/api-version.d.ts.map +1 -0
  64. package/dist/daemon/api-version.js +3 -0
  65. package/dist/daemon/api-version.js.map +1 -0
  66. package/dist/daemon/errors.d.ts +36 -0
  67. package/dist/daemon/errors.d.ts.map +1 -0
  68. package/dist/daemon/errors.js +97 -0
  69. package/dist/daemon/errors.js.map +1 -0
  70. package/dist/daemon/host.d.ts +130 -0
  71. package/dist/daemon/host.d.ts.map +1 -0
  72. package/dist/daemon/host.js +202 -0
  73. package/dist/daemon/host.js.map +1 -0
  74. package/dist/daemon/http-routes.d.ts +37 -0
  75. package/dist/daemon/http-routes.d.ts.map +1 -0
  76. package/dist/daemon/http-routes.js +233 -0
  77. package/dist/daemon/http-routes.js.map +1 -0
  78. package/dist/daemon/main.d.ts +93 -0
  79. package/dist/daemon/main.d.ts.map +1 -0
  80. package/dist/daemon/main.js +308 -0
  81. package/dist/daemon/main.js.map +1 -0
  82. package/dist/daemon/mcp-endpoint.d.ts +55 -0
  83. package/dist/daemon/mcp-endpoint.d.ts.map +1 -0
  84. package/dist/daemon/mcp-endpoint.js +178 -0
  85. package/dist/daemon/mcp-endpoint.js.map +1 -0
  86. package/dist/daemon/memory.d.ts +29 -0
  87. package/dist/daemon/memory.d.ts.map +1 -0
  88. package/dist/daemon/memory.js +74 -0
  89. package/dist/daemon/memory.js.map +1 -0
  90. package/dist/daemon/owner-lock.d.ts +44 -0
  91. package/dist/daemon/owner-lock.d.ts.map +1 -0
  92. package/dist/daemon/owner-lock.js +149 -0
  93. package/dist/daemon/owner-lock.js.map +1 -0
  94. package/dist/daemon/request-ids.d.ts +48 -0
  95. package/dist/daemon/request-ids.d.ts.map +1 -0
  96. package/dist/daemon/request-ids.js +123 -0
  97. package/dist/daemon/request-ids.js.map +1 -0
  98. package/dist/daemon/route-table.d.ts +51 -0
  99. package/dist/daemon/route-table.d.ts.map +1 -0
  100. package/dist/daemon/route-table.js +120 -0
  101. package/dist/daemon/route-table.js.map +1 -0
  102. package/dist/daemon/telemetry-ws.d.ts +60 -0
  103. package/dist/daemon/telemetry-ws.d.ts.map +1 -0
  104. package/dist/daemon/telemetry-ws.js +166 -0
  105. package/dist/daemon/telemetry-ws.js.map +1 -0
  106. package/dist/daemon/update-request.d.ts +145 -0
  107. package/dist/daemon/update-request.d.ts.map +1 -0
  108. package/dist/daemon/update-request.js +250 -0
  109. package/dist/daemon/update-request.js.map +1 -0
  110. package/dist/deploy/messages.d.ts.map +1 -1
  111. package/dist/deploy/messages.js +15 -9
  112. package/dist/deploy/messages.js.map +1 -1
  113. package/dist/deploy/orchestrator.d.ts.map +1 -1
  114. package/dist/deploy/orchestrator.js +32 -8
  115. package/dist/deploy/orchestrator.js.map +1 -1
  116. package/dist/deploy/package.d.ts +8 -0
  117. package/dist/deploy/package.d.ts.map +1 -1
  118. package/dist/deploy/package.js +8 -0
  119. package/dist/deploy/package.js.map +1 -1
  120. package/dist/deploy/recheck-commands.d.ts +2 -0
  121. package/dist/deploy/recheck-commands.d.ts.map +1 -1
  122. package/dist/deploy/recheck-commands.js +4 -0
  123. package/dist/deploy/recheck-commands.js.map +1 -1
  124. package/dist/deploy/scanner-class.d.ts +16 -1
  125. package/dist/deploy/scanner-class.d.ts.map +1 -1
  126. package/dist/deploy/scanner-class.js +49 -0
  127. package/dist/deploy/scanner-class.js.map +1 -1
  128. package/dist/deploy/sim-admission.d.ts +94 -0
  129. package/dist/deploy/sim-admission.d.ts.map +1 -0
  130. package/dist/deploy/sim-admission.js +138 -0
  131. package/dist/deploy/sim-admission.js.map +1 -0
  132. package/dist/index.d.ts.map +1 -1
  133. package/dist/index.js +185 -15
  134. package/dist/index.js.map +1 -1
  135. package/dist/runtime/agent-wake.d.ts +116 -0
  136. package/dist/runtime/agent-wake.d.ts.map +1 -0
  137. package/dist/runtime/agent-wake.js +181 -0
  138. package/dist/runtime/agent-wake.js.map +1 -0
  139. package/dist/runtime/auto-update/coordinator.d.ts +18 -0
  140. package/dist/runtime/auto-update/coordinator.d.ts.map +1 -1
  141. package/dist/runtime/auto-update/coordinator.js +80 -2
  142. package/dist/runtime/auto-update/coordinator.js.map +1 -1
  143. package/dist/runtime/auto-update/idle-gate.d.ts +12 -1
  144. package/dist/runtime/auto-update/idle-gate.d.ts.map +1 -1
  145. package/dist/runtime/auto-update/idle-gate.js +7 -4
  146. package/dist/runtime/auto-update/idle-gate.js.map +1 -1
  147. package/dist/runtime/create-actions.d.ts +5 -1
  148. package/dist/runtime/create-actions.d.ts.map +1 -1
  149. package/dist/runtime/create-actions.js +17 -2
  150. package/dist/runtime/create-actions.js.map +1 -1
  151. package/dist/runtime/decision-errors.d.ts +5 -0
  152. package/dist/runtime/decision-errors.d.ts.map +1 -1
  153. package/dist/runtime/decision-errors.js +10 -0
  154. package/dist/runtime/decision-errors.js.map +1 -1
  155. package/dist/runtime/live-class-backfill.d.ts +10 -0
  156. package/dist/runtime/live-class-backfill.d.ts.map +1 -0
  157. package/dist/runtime/live-class-backfill.js +65 -0
  158. package/dist/runtime/live-class-backfill.js.map +1 -0
  159. package/dist/runtime/recipe-file.d.ts +73 -0
  160. package/dist/runtime/recipe-file.d.ts.map +1 -0
  161. package/dist/runtime/recipe-file.js +194 -0
  162. package/dist/runtime/recipe-file.js.map +1 -0
  163. package/dist/runtime/runtime-descriptor.d.ts +23 -0
  164. package/dist/runtime/runtime-descriptor.d.ts.map +1 -1
  165. package/dist/runtime/runtime-descriptor.js +40 -0
  166. package/dist/runtime/runtime-descriptor.js.map +1 -1
  167. package/dist/runtime/runtime.d.ts +12 -0
  168. package/dist/runtime/runtime.d.ts.map +1 -1
  169. package/dist/runtime/runtime.js +109 -4
  170. package/dist/runtime/runtime.js.map +1 -1
  171. package/dist/runtime/strategy-registry.d.ts +2 -2
  172. package/dist/runtime/update-apply-deps.d.ts +4 -2
  173. package/dist/runtime/update-apply-deps.d.ts.map +1 -1
  174. package/dist/runtime/update-apply-deps.js +4 -2
  175. package/dist/runtime/update-apply-deps.js.map +1 -1
  176. package/dist/runtime/update-handler.d.ts +6 -0
  177. package/dist/runtime/update-handler.d.ts.map +1 -1
  178. package/dist/runtime/update-handler.js +159 -12
  179. package/dist/runtime/update-handler.js.map +1 -1
  180. package/dist/runtime/update-register.d.ts.map +1 -1
  181. package/dist/runtime/update-register.js +18 -0
  182. package/dist/runtime/update-register.js.map +1 -1
  183. package/dist/runtime-api/extensions.d.ts +20 -0
  184. package/dist/runtime-api/extensions.d.ts.map +1 -0
  185. package/dist/runtime-api/extensions.js +28 -0
  186. package/dist/runtime-api/extensions.js.map +1 -0
  187. package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
  188. package/dist/runtime-api/intake/intake-mount.js +3 -1
  189. package/dist/runtime-api/intake/intake-mount.js.map +1 -1
  190. package/dist/runtime-api/lifecycle.d.ts.map +1 -1
  191. package/dist/runtime-api/lifecycle.js +6 -0
  192. package/dist/runtime-api/lifecycle.js.map +1 -1
  193. package/dist/runtime-api/server.d.ts.map +1 -1
  194. package/dist/runtime-api/server.js +3 -0
  195. package/dist/runtime-api/server.js.map +1 -1
  196. package/dist/scanners/external-scanner-receiver.d.ts +2 -0
  197. package/dist/scanners/external-scanner-receiver.d.ts.map +1 -1
  198. package/dist/scanners/external-scanner-receiver.js +4 -0
  199. package/dist/scanners/external-scanner-receiver.js.map +1 -1
  200. package/dist/telemetry/context.d.ts +17 -0
  201. package/dist/telemetry/context.d.ts.map +1 -1
  202. package/dist/telemetry/context.js.map +1 -1
  203. package/dist/telemetry/otel-sdk.d.ts +2 -0
  204. package/dist/telemetry/otel-sdk.d.ts.map +1 -1
  205. package/dist/telemetry/otel-sdk.js +2 -0
  206. package/dist/telemetry/otel-sdk.js.map +1 -1
  207. package/dist/types/scanner.d.ts +6 -0
  208. package/dist/types/scanner.d.ts.map +1 -1
  209. package/dist/validate/package-gates-stage.d.ts +13 -1
  210. package/dist/validate/package-gates-stage.d.ts.map +1 -1
  211. package/dist/validate/package-gates-stage.js +3 -8
  212. package/dist/validate/package-gates-stage.js.map +1 -1
  213. package/dist/validate/target.d.ts +75 -1
  214. package/dist/validate/target.d.ts.map +1 -1
  215. package/dist/validate/target.js +94 -28
  216. package/dist/validate/target.js.map +1 -1
  217. package/openclaw.plugin.json +1 -1
  218. package/package.json +8 -2
@@ -11,16 +11,18 @@ export declare function registerSenpiCli(program: {
11
11
  command: (name: string, desc?: string) => CommanderCommand | unknown;
12
12
  }): void;
13
13
  /**
14
- * argv for `openclaw gateway call`. Exported so the timeout wiring is testable without a
15
- * subprocess. `--timeout` is the per-call gateway timeout (the CLI default is 10 s); omitting
16
- * `timeoutMs` keeps the historical argv byte-for-byte, so every existing caller is unchanged.
14
+ * The argv after the method name for a JSON `gateway call` (see {@link gatewayCallArgs}, which
15
+ * places it). Exported so the timeout wiring is testable without a subprocess. `--timeout` is the
16
+ * per-call gateway timeout (the CLI default is 10 s); omitting `timeoutMs` keeps the historical argv
17
+ * byte-for-byte, so every existing caller is unchanged. The daemon-call helper reads the same flags.
17
18
  *
18
- * @param method Gateway method name, e.g. `senpi.quant.status`.
19
19
  * @param params JSON-serialisable params, passed as one `--params` argv element (never via a shell).
20
20
  * @param timeoutMs Optional per-call timeout in milliseconds, placed before `--params`.
21
- * @returns argv to append after the OpenClaw entry script.
22
21
  */
23
- export declare function gatewayCallArgs(method: string, params: Record<string, unknown>, timeoutMs?: number): string[];
22
+ export declare function gatewayJsonCallArgs(params: Record<string, unknown>, timeoutMs?: number): string[];
23
+ export declare function gatewayCallCommand(method: string): string;
24
+ /** `rest` is everything after the method name: `--json`, `--timeout <ms>`, `--params <json>`. */
25
+ export declare function gatewayCallArgs(method: string, rest: string[]): string[];
24
26
  /**
25
27
  * Render the risk audit log as a tab-separated digest (newest entries last,
26
28
  * as returned). Each row: time, source, then `guardrail=result` per
@@ -1 +1 @@
1
- {"version":3,"file":"senpi-commands.d.ts","sourceRoot":"","sources":["../../src/cli/senpi-commands.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAuBH,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;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAE7G;AAgND;;;;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"}
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 { readFileSync, statSync } from "node:fs";
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
- resolvePath: (p) => path.resolve(process.cwd(), p),
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.installRuntime", "--timeout", "60000", "--params", JSON.stringify(params)], {
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.deleteRuntime", "--params", JSON.stringify(params)], { stdio: "inherit", cwd: process.cwd() });
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.listDslPositions", "--json", "--params", JSON.stringify(params)], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.getDslPositionState", "--json", "--params", JSON.stringify(params)], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.listDslArchives", "--json", "--params", JSON.stringify(params)], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.listActions", "--json", "--params", JSON.stringify(params)], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.getActionState", "--json", "--params", JSON.stringify(params)], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.getActionHistory", "--json", "--params", JSON.stringify(params)], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.getActionHistory", "--json", "--params", JSON.stringify(params)], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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({ ok: true, statuses, ...(payload.approvals ? { approvals: payload.approvals } : {}) });
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(process.argv[0], [
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.skills.status", "--json", "--params", "{}"], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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(process.argv[0], [process.argv[1], "gateway", "call", "senpi.skills.updateAll", "--json", "--params", "{}"], { stdio: ["inherit", "pipe", "inherit"], cwd: process.cwd(), encoding: "utf8" });
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
- console.error("\nTip: If the gateway is not running, start it with: openclaw gateway run");
1202
+ reportGatewayCallFailure(result.stdout);
1216
1203
  return;
1217
1204
  }
1218
1205
  let data;
@@ -1309,7 +1296,7 @@ function registerDeployCommands(senpi) {
1309
1296
  .option("--tick-wait <seconds>", "How long the job waits to observe one scanner tick — or, for an external scanner, one fresh liveness post (default 120, 0 skips)")
1310
1297
  .option("--max-wait <seconds>", "How long the job waits for wallets to reach ACTIVE (default 150)")
1311
1298
  .option("--simulation", "Run the package as a simulation: virtual money on a copy of Hyperliquid, no real balance read or moved")
1312
- .option("--class <scanner=mb...>", "With --simulation: raise a scanner's memory class to 128, 256, 512 or 1024 MB (repeatable). Never lowers the measured class")
1299
+ .option("--class <scanner=mb...>", "Raise a scanner's memory class to 128, 256, 512 or 1024 MB (repeatable). Never lowers the measured class. On a live deploy the class only counts toward the box's memory")
1313
1300
  .option("--from-simulation <simulation-id>", "Take this simulation live: the live strategy keeps its group, variant, settings and source simulation id. Not with --simulation")
1314
1301
  .option("--variant-of <simulation-id>", "With --simulation: run this package as a variation of that simulation; it joins its group as the next vN")
1315
1302
  .option("--batch <id>", "With --variant-of: one id shared by every variation started together")
@@ -1585,17 +1572,16 @@ function reportUnreadableGateway(verb, cause, followUp = "") {
1585
1572
  followUp);
1586
1573
  }
1587
1574
  /**
1588
- * argv for `openclaw gateway call`. Exported so the timeout wiring is testable without a
1589
- * subprocess. `--timeout` is the per-call gateway timeout (the CLI default is 10 s); omitting
1590
- * `timeoutMs` keeps the historical argv byte-for-byte, so every existing caller is unchanged.
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 gatewayCallArgs(method, params, timeoutMs) {
1598
- return ["gateway", "call", method, "--json", ...(timeoutMs !== undefined ? ["--timeout", String(timeoutMs)] : []), "--params", JSON.stringify(params)];
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
- const timeout = opts?.timeoutMs === undefined ? [] : ["--timeout", String(opts.timeoutMs)];
1623
- const result = spawnSync(process.argv[0], [process.argv[1], ...gatewayCallArgs(method, params, opts?.timeoutMs)],
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("\nTip: If the gateway is not running, start it with: openclaw gateway run");
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
  }