@senpi-ai/runtime 3.0.189 → 3.0.202

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 (80) hide show
  1. package/dist/cli/guide-commands.d.ts.map +1 -1
  2. package/dist/cli/guide-commands.js +37 -17
  3. package/dist/cli/guide-commands.js.map +1 -1
  4. package/dist/cli/senpi-commands.d.ts.map +1 -1
  5. package/dist/cli/senpi-commands.js +62 -30
  6. package/dist/cli/senpi-commands.js.map +1 -1
  7. package/dist/cli/update-command.d.ts +20 -8
  8. package/dist/cli/update-command.d.ts.map +1 -1
  9. package/dist/cli/update-command.js +52 -37
  10. package/dist/cli/update-command.js.map +1 -1
  11. package/dist/deploy/orchestrator.js +3 -3
  12. package/dist/deploy/orchestrator.js.map +1 -1
  13. package/dist/deploy/package.d.ts +17 -0
  14. package/dist/deploy/package.d.ts.map +1 -1
  15. package/dist/deploy/package.js +19 -0
  16. package/dist/deploy/package.js.map +1 -1
  17. package/dist/deploy/proof-gate.d.ts.map +1 -1
  18. package/dist/deploy/proof-gate.js +12 -3
  19. package/dist/deploy/proof-gate.js.map +1 -1
  20. package/dist/deploy/recheck-commands.d.ts +2 -0
  21. package/dist/deploy/recheck-commands.d.ts.map +1 -1
  22. package/dist/deploy/recheck-commands.js +4 -0
  23. package/dist/deploy/recheck-commands.js.map +1 -1
  24. package/dist/deploy/register.js +2 -2
  25. package/dist/deploy/register.js.map +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +14 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/runtime/effective-config.d.ts.map +1 -1
  30. package/dist/runtime/effective-config.js +12 -2
  31. package/dist/runtime/effective-config.js.map +1 -1
  32. package/dist/runtime/load-runtime-config.d.ts +20 -0
  33. package/dist/runtime/load-runtime-config.d.ts.map +1 -1
  34. package/dist/runtime/load-runtime-config.js +36 -8
  35. package/dist/runtime/load-runtime-config.js.map +1 -1
  36. package/dist/runtime/map-strategies.d.ts.map +1 -1
  37. package/dist/runtime/map-strategies.js +7 -4
  38. package/dist/runtime/map-strategies.js.map +1 -1
  39. package/dist/runtime/recipe-file.d.ts +73 -0
  40. package/dist/runtime/recipe-file.d.ts.map +1 -0
  41. package/dist/runtime/recipe-file.js +194 -0
  42. package/dist/runtime/recipe-file.js.map +1 -0
  43. package/dist/runtime/runtime-descriptor.d.ts +23 -0
  44. package/dist/runtime/runtime-descriptor.d.ts.map +1 -1
  45. package/dist/runtime/runtime-descriptor.js +40 -0
  46. package/dist/runtime/runtime-descriptor.js.map +1 -1
  47. package/dist/runtime/update-apply-deps.d.ts +30 -11
  48. package/dist/runtime/update-apply-deps.d.ts.map +1 -1
  49. package/dist/runtime/update-apply-deps.js +93 -27
  50. package/dist/runtime/update-apply-deps.js.map +1 -1
  51. package/dist/runtime/update-handler.d.ts +28 -9
  52. package/dist/runtime/update-handler.d.ts.map +1 -1
  53. package/dist/runtime/update-handler.js +186 -19
  54. package/dist/runtime/update-handler.js.map +1 -1
  55. package/dist/runtime/update-register.d.ts +101 -2
  56. package/dist/runtime/update-register.d.ts.map +1 -1
  57. package/dist/runtime/update-register.js +269 -44
  58. package/dist/runtime/update-register.js.map +1 -1
  59. package/dist/scanners/external/scaffold/preflight.py +492 -12
  60. package/dist/validate/codes.d.ts +2 -0
  61. package/dist/validate/codes.d.ts.map +1 -1
  62. package/dist/validate/codes.js +6 -0
  63. package/dist/validate/codes.js.map +1 -1
  64. package/dist/validate/live-stage.d.ts +12 -0
  65. package/dist/validate/live-stage.d.ts.map +1 -1
  66. package/dist/validate/live-stage.js +16 -0
  67. package/dist/validate/live-stage.js.map +1 -1
  68. package/dist/validate/package-gates-stage.d.ts +13 -1
  69. package/dist/validate/package-gates-stage.d.ts.map +1 -1
  70. package/dist/validate/package-gates-stage.js +3 -8
  71. package/dist/validate/package-gates-stage.js.map +1 -1
  72. package/dist/validate/proof.d.ts.map +1 -1
  73. package/dist/validate/proof.js +20 -5
  74. package/dist/validate/proof.js.map +1 -1
  75. package/dist/validate/target.d.ts +75 -1
  76. package/dist/validate/target.d.ts.map +1 -1
  77. package/dist/validate/target.js +94 -28
  78. package/dist/validate/target.js.map +1 -1
  79. package/openclaw.plugin.json +1 -1
  80. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAqeH,eAAO,MAAM,eAAe,QAyXpB,CAAC;AAIT,kFAAkF;AAClF,UAAU,gBAAgB;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC9D,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;CACxF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,MAAM,GACd,IAAI,CA2CN"}
1
+ {"version":3,"file":"guide-commands.d.ts","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAseH,eAAO,MAAM,eAAe,QA4YpB,CAAC;AAIT,kFAAkF;AAClF,UAAU,gBAAgB;IACxB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IACvD,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC5C,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,gBAAgB,CAAC;IAC9D,MAAM,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC;CACxF;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,gBAAgB,EACvB,OAAO,EAAE,MAAM,GACd,IAAI,CA2CN"}
@@ -28,7 +28,8 @@ Quick commands:
28
28
  $10 floor. There is no paper-trading mode, and never an agent-turn cron to
29
29
  watch it: every cron firing is a model call, the runtime watches for free.
30
30
  senpi deploy -p <pkg> Take a proven package live: create+fund → install → observe it running
31
- senpi update <pkg> Change a LIVE strategy's recipe in place — plans by default, --apply commits
31
+ senpi update <pkg>/<instance> --id <runtime_id>
32
+ Change a LIVE strategy's recipe in place — plans by default, --apply commits
32
33
  senpi scanner Per-scanner health: runs (interval), errors, signals, liveness, "(no signals yet)" flag
33
34
  senpi events Local domain-event log — the trade narrative
34
35
  senpi explain <asset> Stitch one asset's position lifecycle from the event log
@@ -583,16 +584,26 @@ senpi runtime — Manage runtimes
583
584
  strategy_list first; it is never removed automatically
584
585
  --json Raw JSON output — the ONLY way to read each runtime's
585
586
  rendered descriptor (name, group, version, description,
586
- hasExit, dslPreset, dsl ladder); the table prints none of
587
- it. hasExit is what deploy funds against, so hasExit true
588
- with dsl null means a DSL exit is CONFIGURED with no ladder
589
- running — only a non-null dsl proves a stop is enforced
587
+ hasExit, dslPreset, dsl ladder, recipeHash); the table prints
588
+ none of it. hasExit is what deploy funds against, so hasExit
589
+ true with dsl null means a DSL exit is CONFIGURED with no
590
+ ladder running — only a non-null dsl proves a stop is enforced.
591
+ recipeHash is the normalized digest of the recipe text this
592
+ runtime is RUNNING: compare it with the package on disk to
593
+ tell whether an edit was ever applied (senpi-strategy-ops
594
+ status.py does exactly that). null for a runtime installed
595
+ by path: its file can change under the running recipe
590
596
 
591
597
  senpi update — Change a running strategy's recipe in place
592
- openclaw senpi update <pkg> # PLAN: what would change, and what it would leave alone
593
- openclaw senpi update <pkg> --apply # commit it
598
+ openclaw senpi update <pkg>/<instance> --id <runtime_id> # PLAN: what would change, and what it would leave alone
599
+ openclaw senpi update <pkg>/<instance> --id <runtime_id> --apply # commit it
600
+ <pkg>/<instance> The instance directory holding the recipe of the runtime you
601
+ mean (deploy installs it as <pkg-id>-<instance>). A flat
602
+ package, one recipe at its root, takes the package dir itself.
603
+ A package root is refused with its instances and their ids.
594
604
  --id <runtime_id> Which runtime; required when more than one is installed
595
- --address <wallet> Alternative to --id
605
+ --address <wallet> Alternative to --id. An empty --id or --address is the
606
+ same as leaving it out.
596
607
  --content <yaml> Recipe text instead of a path (--dir sets the scanner root)
597
608
  --json The report as one JSON document on stdout
598
609
  --apply Actually change it. Without this the verb only plans.
@@ -601,15 +612,20 @@ senpi update — Change a running strategy's recipe in place
601
612
  this is the guard that the edit you are shipping is the
602
613
  edit you meant to.
603
614
 
615
+ A senpi-skills package (strategies/<id>/): use senpi-strategy-ops
616
+ 'deploy.py update <pkg> --id <runtime_id>' (then the same with --apply). It runs the structural
617
+ preflight, then this verb on that runtime's instance directory.
618
+
604
619
  It plans by default and always will — there is no --dry-run whose default flips later. Keeps
605
620
  every piece of state a delete-and-recreate would destroy: DSL position files, scanner stores,
606
621
  action history. That is the whole reason to prefer it over tearing a runtime down and standing a
607
622
  fresh one up on a funded wallet, which abandons the stops the strategy has already promised.
608
623
 
609
- The ratchet IS the recipe (exit.dsl_preset.phase2.tiers): edit, validate, 'senpi update <pkg>
610
- --apply'. ratchet_stop_edit reaches only an open position; nothing but this verb applies a
611
- ladder "to the next position". With no live row there is nothing to edit, and flat is the best
612
- moment to apply — forward-only then leaves no position on the old ladder.
624
+ The ratchet IS the recipe (exit.dsl_preset.phase2.tiers): edit, 'senpi validate <pkg>/<instance>',
625
+ 'senpi update <pkg>/<instance> --id <runtime_id> --apply'. ratchet_stop_edit reaches only an open
626
+ position; nothing but this verb applies a ladder "to the next position". With no live row there
627
+ is nothing to edit, and flat is the best moment to apply — forward-only then leaves no position
628
+ on the old ladder.
613
629
 
614
630
  Forward-only — the preset specifically. A new dsl_preset governs NEW entries; every open position
615
631
  keeps a snapshot of the preset it was opened under, and no update reaches it. To move an open
@@ -622,13 +638,15 @@ senpi update — Change a running strategy's recipe in place
622
638
  inserted or removed (state is keyed by NAME and INDEX together, so both matter — and inserting or
623
639
  removing one shifts every external scanner below it; APPENDING at the end moves nobody and is
624
640
  fine, as is moving an internal scanner), and a changed action_type under a stable name. An --apply
625
- also requires a passing proof, exactly as deploy does: run 'senpi validate <pkg>' first, and point
626
- update at the package DIRECTORY — a recipe passed as bare text has nothing to verify against and
627
- is refused rather than applied unproven.
641
+ also requires a passing proof, exactly as deploy does: run 'senpi validate <pkg>/<instance>' first,
642
+ and point update at that same instance directory — a recipe passed as bare text has nothing to
643
+ verify against and is refused rather than applied unproven.
628
644
 
629
645
  Exit codes: 0 planned/applied · 1 FAILED DURING APPLY · 2 refused, nothing changed · 3 bad
630
646
  invocation. 1 and 2 are not interchangeable — 2 means the runtime was never touched, 1 means it
631
- was and may not be where you left it. Read the message before retrying.
647
+ was and may not be where you left it. Read the message before retrying. A 2 with
648
+ [E_UPDATE_PARAM_UNSUPPORTED] means the gateway runs an older runtime than this CLI: the command
649
+ is right; restart the gateway so it loads the installed runtime, then re-run it unchanged.
632
650
 
633
651
  senpi validate — Prove a strategy can execute BEFORE it is funded
634
652
  validate [target] Package dir, recipe file, or scanner dir (default: cwd)
@@ -802,7 +820,9 @@ senpi.installRuntime
802
820
  cannot trade — no margin source, no risk guardrails, missing scanner entrypoint, or an
803
821
  unresolvable scanner path — is refused with what/why/fix per problem, the message
804
822
  leading with the bracketed code of the first blocking finding, e.g.
805
- [E_VALIDATE_UNGATED]), UNAVAILABLE (bad YAML, start failure)
823
+ [E_VALIDATE_UNGATED]), UNAVAILABLE (bad YAML, an unreadable runtimeYamlPath ("could not
824
+ read <path>: <read error>. Check that the file exists at that path and the gateway can
825
+ read it, then retry."), start failure)
806
826
 
807
827
  senpi.listRuntimes
808
828
  Params: (none)
@@ -1 +1 @@
1
- {"version":3,"file":"guide-commands.js","sourceRoot":"","sources":["../../src/cli/guide-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,aAAa,GACjB,0EAA0E,CAAC;AAE7E,+EAA+E;AAE/E,MAAM,aAAa,GAAG,CAAC,OAAe,EAAE,EAAE,CAAC;qBACtB,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4B3B,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuIrB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CpB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGhB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsHnB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,YAAY,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwCpB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,CAAC,MAAM,eAAe,GAAG;;;;;;;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AGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAW3E;AAiID,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,7 @@
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 { readFileSync } from "node:fs";
6
6
  // Re-exported from a helper that constructs the standard-library module
7
7
  // spec dynamically — keeps the literal "c_p" string out of this file's
8
8
  // emitted JS, so OpenClaw's install-time security scanner doesn't flag
@@ -14,7 +14,8 @@ import { registerSenpiConfigCommands } from "./senpi-config-commands.js";
14
14
  import { exitCodeForDeploy, renderDeploySnapshot } from "./deploy-render.js";
15
15
  import { isRefusalMessage } from "../deploy/taxonomy.js";
16
16
  import { registerValidateCommand } from "./validate-command.js";
17
- import { registerUpdateCommand } from "./update-command.js";
17
+ import { registerUpdateCommand, updateRefusalExitCode } from "./update-command.js";
18
+ import { NODE_RECIPE_FILE_IO } from "../runtime/recipe-file.js";
18
19
  import { VERSION } from "../version.js";
19
20
  /**
20
21
  * Write a --json response document straight to the stdout stream. Never console.log here:
@@ -41,22 +42,10 @@ export function registerSenpiCli(program) {
41
42
  registerSenpiConfigCommands(senpi);
42
43
  registerValidateCommand(senpi);
43
44
  registerUpdateCommand(senpi, {
44
- callGateway: (method, params) => callGatewayJson(method, params) ?? undefined,
45
- resolvePath: (p) => path.resolve(process.cwd(), p),
46
- dirname: (p) => path.dirname(p),
47
- readFile: (p) => readFileSync(p, "utf8"),
48
- isDirectory: (p) => { try {
49
- return statSync(p).isDirectory();
50
- }
51
- catch {
52
- return false;
53
- } },
54
- fileExists: (p) => { try {
55
- return statSync(p).isFile();
56
- }
57
- catch {
58
- return false;
59
- } },
45
+ // A refused INVOCATION (`[E_UPDATE_PARAMS]`) exits 3, as the verb's own mapping does; every
46
+ // other refusal keeps 2, `[E_UPDATE_PARAM_UNSUPPORTED]` (a gateway older than this CLI) included.
47
+ callGateway: (method, params) => callGatewayJson(method, params, undefined, { refusalExitCode: updateRefusalExitCode }) ?? undefined,
48
+ ...NODE_RECIPE_FILE_IO,
60
49
  // `writeJson`'s channel, not console.log: OpenClaw diverts every console.* call to stderr once
61
50
  // any command in the parse chain declares --json, so the document a --json caller reads was
62
51
  // landing on stderr with stdout empty. The helper directly above this file's callGatewayJson
@@ -1362,7 +1351,7 @@ function registerDeployCommands(senpi) {
1362
1351
  "6 pending/still running · 1 error")
1363
1352
  .option("--json", "Print the raw snapshot JSON")
1364
1353
  .action(async (deployId, opts) => {
1365
- const data = callGatewayJson("senpi.deploy.status", deployId ? { deployId } : {}, (cause) => reportUnreadableGateway("senpi deploy status", cause, DEPLOY_STATUS_STATE_UNKNOWN_HINT));
1354
+ const data = callGatewayJson("senpi.deploy.status", deployId ? { deployId } : {}, (cause) => reportUnreadableGateway("senpi deploy status", cause, cause === "dispatch" ? DEPLOY_STATUS_STATE_UNKNOWN_HINT : DEPLOY_STATUS_ANSWERED_HINT));
1366
1355
  if (!data)
1367
1356
  return;
1368
1357
  if (data.ok === false) {
@@ -1412,6 +1401,19 @@ const DEPLOY_STATE_UNKNOWN_HINT = " This says nothing about the deploy itself
1412
1401
  */
1413
1402
  const DEPLOY_STATUS_STATE_UNKNOWN_HINT = " This says nothing about the deploy itself — a started job may be running right now. Start the " +
1414
1403
  "gateway if it is down (`openclaw gateway run`), check the gateway log, then re-read.";
1404
+ /**
1405
+ * The `deploy status` hint when the gateway ANSWERED: with an uncoded error, or with stdout that
1406
+ * could not be read. It is running, so the start step of {@link DEPLOY_STATUS_STATE_UNKNOWN_HINT}
1407
+ * would send the reader to restart it.
1408
+ */
1409
+ const DEPLOY_STATUS_ANSWERED_HINT = " This says nothing about the deploy itself — a started job may be running right now. Check the " +
1410
+ "gateway log, then re-read.";
1411
+ /**
1412
+ * How 5.x's `gateway call` names an error the gateway ANSWERED (`respond(false, …)`), on the
1413
+ * `Gateway call failed: <ErrorName>: <message>` stderr line. Transport and credential failures carry
1414
+ * other names. 10.x says the same with the envelope's `gateway_request_error` type.
1415
+ */
1416
+ const GATEWAY_ANSWER_MARKER = "GatewayClientRequestError:";
1415
1417
  /**
1416
1418
  * Did the gateway ANSWER this failed `gateway call`, with a refusal?
1417
1419
  *
@@ -1432,13 +1434,17 @@ const DEPLOY_STATUS_STATE_UNKNOWN_HINT = " This says nothing about the deploy it
1432
1434
  * `isRefusalMessage`, which is built on `extractTaxonomyCode` and already knows the advisory `W_`
1433
1435
  * family is not a refusal.
1434
1436
  *
1435
- * Every bracket is tried, not just the first: the code sits behind a `Gateway call failed: ` label
1436
- * and an error name, and a colourised or otherwise decorated stderr can put other brackets ahead
1437
- * of it.
1437
+ * `answer` is the gateway's own answer only — the 10.x envelope's message, or the 5.x stderr after
1438
+ * {@link GATEWAY_ANSWER_MARKER} — never the whole stderr. Host lines carry brackets of their own
1439
+ * (Node's `(node:1) [DEP0040] DeprecationWarning`), and read here they made an `UPDATE_FAILED` or
1440
+ * an `ECONNREFUSED` a refusal: exit 2, "nothing was touched".
1441
+ *
1442
+ * Every bracket in the answer is tried, not just the first: a refusal can carry its code below a
1443
+ * heading (`Cannot update X:` then ` [E_UPDATE_WALLET_CHANGED] …`).
1438
1444
  */
1439
- function gatewayAnsweredRefusal(stderr) {
1440
- for (let i = stderr.indexOf("["); i >= 0; i = stderr.indexOf("[", i + 1)) {
1441
- if (isRefusalMessage(stderr.slice(i)))
1445
+ function gatewayAnsweredRefusal(answer) {
1446
+ for (let i = answer.indexOf("["); i >= 0; i = answer.indexOf("[", i + 1)) {
1447
+ if (isRefusalMessage(answer.slice(i)))
1442
1448
  return true;
1443
1449
  }
1444
1450
  return false;
@@ -1498,7 +1504,9 @@ function reportUnreadableGateway(verb, cause, followUp = "") {
1498
1504
  process.exitCode = 1;
1499
1505
  console.error((cause === "dispatch"
1500
1506
  ? `${verb}: the \`gateway call\` subprocess failed, so nothing was read back — exit 1 (transport/internal).`
1501
- : `${verb}: the gateway answered but its response could not be read — exit 1 (transport/internal).`) +
1507
+ : cause === "answered"
1508
+ ? `${verb}: the gateway answered with an error that carries no refusal code — exit 1 (internal).`
1509
+ : `${verb}: the gateway answered but its response could not be read — exit 1 (transport/internal).`) +
1502
1510
  followUp);
1503
1511
  }
1504
1512
  /**
@@ -1508,8 +1516,12 @@ function reportUnreadableGateway(verb, cause, followUp = "") {
1508
1516
  *
1509
1517
  * A gateway-answered REFUSAL takes neither path: it is classified and exited here, so no caller can
1510
1518
  * print an unreadable-gateway message over an answer the user has already read.
1519
+ *
1520
+ * `opts.refusalExitCode` lets a verb with its own exit contract pick the code for a refusal from
1521
+ * its text (`senpi update` exits 3 for a refused invocation, 2 for a refused recipe). Absent, every
1522
+ * refusal exits 2.
1511
1523
  */
1512
- function callGatewayJson(method, params, onFailure) {
1524
+ function callGatewayJson(method, params, onFailure, opts) {
1513
1525
  const result = spawnSync(process.argv[0], [process.argv[1], "gateway", "call", method, "--json", "--params", JSON.stringify(params)],
1514
1526
  // stderr is PIPED, where it used to be inherited, for one reason: a gateway REFUSAL arrives
1515
1527
  // only there, and a stderr this process never sees is a stderr it can contradict. The child
@@ -1533,8 +1545,19 @@ function callGatewayJson(method, params, onFailure) {
1533
1545
  if (envelope) {
1534
1546
  process.stderr.write(envelope.message.endsWith("\n") ? envelope.message : `${envelope.message}\n`);
1535
1547
  }
1536
- const envelopeRefused = envelope?.type === "gateway_request_error" && gatewayAnsweredRefusal(envelope.message);
1537
- if (envelopeRefused || gatewayAnsweredRefusal(stderr)) {
1548
+ // The gateway's own answer, from the transport marker: the envelope's message, or the 5.x stderr
1549
+ // from the marker on. Refused-or-not and the exit code are both read from it alone, so a host
1550
+ // warning ahead of it (`(node:1) [DEP0040] …`) can neither pick the code nor turn an
1551
+ // `UPDATE_FAILED` or a transport failure into a refusal. No marker means the gateway answered
1552
+ // nothing, and nothing it did not say can be a refusal.
1553
+ const marker = stderr.indexOf(GATEWAY_ANSWER_MARKER);
1554
+ const answered = envelope?.type === "gateway_request_error" || (envelope === null && marker >= 0);
1555
+ const answer = envelope?.type === "gateway_request_error"
1556
+ ? envelope.message
1557
+ : marker >= 0
1558
+ ? stderr.slice(marker + GATEWAY_ANSWER_MARKER.length)
1559
+ : "";
1560
+ if (answered && gatewayAnsweredRefusal(answer)) {
1538
1561
  // The gateway answered, and it refused. D-12: `2 = refused` — the code agents branch on to
1539
1562
  // OBEY rather than retry. Reported as 1 (internal/transport) these read as "try again", and
1540
1563
  // a delisted instrument, a package with no DSL exit, or a wallet another package's stamp
@@ -1543,7 +1566,16 @@ function callGatewayJson(method, params, onFailure) {
1543
1566
  // Nothing further is printed. The refusal above is the answer; the unreadable-gateway text
1544
1567
  // ("nothing was read back", "if the gateway is not running") would contradict it one line
1545
1568
  // later, which is the defect this branch exists to end.
1546
- process.exitCode = DEPLOY_REFUSED_EXIT;
1569
+ process.exitCode = opts?.refusalExitCode?.(answer) ?? DEPLOY_REFUSED_EXIT;
1570
+ return null;
1571
+ }
1572
+ if (answered) {
1573
+ // The gateway answered, with an error that is no refusal. Still exit 1, but it is running:
1574
+ // "nothing was read back" and the gateway-not-running tip would send the reader to start it.
1575
+ if (onFailure)
1576
+ onFailure("answered");
1577
+ else
1578
+ process.exitCode = result.status ?? 1;
1547
1579
  return null;
1548
1580
  }
1549
1581
  process.exitCode = result.status ?? 1;