@senpi-ai/runtime 3.0.77 → 3.0.78

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 (165) hide show
  1. package/README.md +76 -2
  2. package/dist/cli/deploy-render.d.ts +93 -0
  3. package/dist/cli/deploy-render.d.ts.map +1 -0
  4. package/dist/cli/deploy-render.js +438 -0
  5. package/dist/cli/deploy-render.js.map +1 -0
  6. package/dist/cli/guide-commands.d.ts.map +1 -1
  7. package/dist/cli/guide-commands.js +94 -9
  8. package/dist/cli/guide-commands.js.map +1 -1
  9. package/dist/cli/senpi-commands.d.ts +6 -1
  10. package/dist/cli/senpi-commands.d.ts.map +1 -1
  11. package/dist/cli/senpi-commands.js +290 -41
  12. package/dist/cli/senpi-commands.js.map +1 -1
  13. package/dist/cli/validate-command.d.ts.map +1 -1
  14. package/dist/cli/validate-command.js +10 -1
  15. package/dist/cli/validate-command.js.map +1 -1
  16. package/dist/deploy/deadlines.d.ts +107 -0
  17. package/dist/deploy/deadlines.d.ts.map +1 -0
  18. package/dist/deploy/deadlines.js +139 -0
  19. package/dist/deploy/deadlines.js.map +1 -0
  20. package/dist/deploy/error-text.d.ts +25 -0
  21. package/dist/deploy/error-text.d.ts.map +1 -0
  22. package/dist/deploy/error-text.js +42 -0
  23. package/dist/deploy/error-text.js.map +1 -0
  24. package/dist/deploy/funding.d.ts +125 -0
  25. package/dist/deploy/funding.d.ts.map +1 -0
  26. package/dist/deploy/funding.js +268 -0
  27. package/dist/deploy/funding.js.map +1 -0
  28. package/dist/deploy/install-gate-runner.d.ts +12 -0
  29. package/dist/deploy/install-gate-runner.d.ts.map +1 -0
  30. package/dist/deploy/install-gate-runner.js +17 -0
  31. package/dist/deploy/install-gate-runner.js.map +1 -0
  32. package/dist/deploy/job.d.ts +215 -0
  33. package/dist/deploy/job.d.ts.map +1 -0
  34. package/dist/deploy/job.js +484 -0
  35. package/dist/deploy/job.js.map +1 -0
  36. package/dist/deploy/messages.d.ts +603 -0
  37. package/dist/deploy/messages.d.ts.map +1 -0
  38. package/dist/deploy/messages.js +1388 -0
  39. package/dist/deploy/messages.js.map +1 -0
  40. package/dist/deploy/min-budget.d.ts +68 -0
  41. package/dist/deploy/min-budget.d.ts.map +1 -0
  42. package/dist/deploy/min-budget.js +297 -0
  43. package/dist/deploy/min-budget.js.map +1 -0
  44. package/dist/deploy/orchestrator.d.ts +314 -0
  45. package/dist/deploy/orchestrator.d.ts.map +1 -0
  46. package/dist/deploy/orchestrator.js +2171 -0
  47. package/dist/deploy/orchestrator.js.map +1 -0
  48. package/dist/deploy/package.d.ts +228 -0
  49. package/dist/deploy/package.d.ts.map +1 -0
  50. package/dist/deploy/package.js +542 -0
  51. package/dist/deploy/package.js.map +1 -0
  52. package/dist/deploy/proof-gate.d.ts +86 -0
  53. package/dist/deploy/proof-gate.d.ts.map +1 -0
  54. package/dist/deploy/proof-gate.js +278 -0
  55. package/dist/deploy/proof-gate.js.map +1 -0
  56. package/dist/deploy/python-float.d.ts +34 -0
  57. package/dist/deploy/python-float.d.ts.map +1 -0
  58. package/dist/deploy/python-float.js +46 -0
  59. package/dist/deploy/python-float.js.map +1 -0
  60. package/dist/deploy/recheck-commands.d.ts +50 -0
  61. package/dist/deploy/recheck-commands.d.ts.map +1 -0
  62. package/dist/deploy/recheck-commands.js +77 -0
  63. package/dist/deploy/recheck-commands.js.map +1 -0
  64. package/dist/deploy/register.d.ts +101 -0
  65. package/dist/deploy/register.d.ts.map +1 -0
  66. package/dist/deploy/register.js +714 -0
  67. package/dist/deploy/register.js.map +1 -0
  68. package/dist/deploy/taxonomy.d.ts +43 -0
  69. package/dist/deploy/taxonomy.d.ts.map +1 -0
  70. package/dist/deploy/taxonomy.js +59 -0
  71. package/dist/deploy/taxonomy.js.map +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +467 -222
  74. package/dist/index.js.map +1 -1
  75. package/dist/runtime/env-resolve.d.ts +13 -0
  76. package/dist/runtime/env-resolve.d.ts.map +1 -1
  77. package/dist/runtime/env-resolve.js +14 -1
  78. package/dist/runtime/env-resolve.js.map +1 -1
  79. package/dist/runtime/runtime-descriptor.d.ts +37 -0
  80. package/dist/runtime/runtime-descriptor.d.ts.map +1 -0
  81. package/dist/runtime/runtime-descriptor.js +163 -0
  82. package/dist/runtime/runtime-descriptor.js.map +1 -0
  83. package/dist/runtime/runtime-schema.d.ts +100 -100
  84. package/dist/runtime/strategy-registry.d.ts +8 -0
  85. package/dist/runtime/strategy-registry.d.ts.map +1 -1
  86. package/dist/runtime/strategy-registry.js +14 -1
  87. package/dist/runtime/strategy-registry.js.map +1 -1
  88. package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
  89. package/dist/runtime-api/intake/intake-mount.js +7 -4
  90. package/dist/runtime-api/intake/intake-mount.js.map +1 -1
  91. package/dist/scanners/external/scaffold/preflight.py +39 -0
  92. package/dist/scanners/implementations/market-regime.d.ts +1 -1
  93. package/dist/senpi/client.d.ts +58 -4
  94. package/dist/senpi/client.d.ts.map +1 -1
  95. package/dist/senpi/client.js +262 -18
  96. package/dist/senpi/client.js.map +1 -1
  97. package/dist/senpi/strategy-status.d.ts +32 -0
  98. package/dist/senpi/strategy-status.d.ts.map +1 -0
  99. package/dist/senpi/strategy-status.js +70 -0
  100. package/dist/senpi/strategy-status.js.map +1 -0
  101. package/dist/senpi/types.d.ts +65 -3
  102. package/dist/senpi/types.d.ts.map +1 -1
  103. package/dist/skills-manager/manifest.js +3 -3
  104. package/dist/skills-manager/skills-manifest.json +3 -3
  105. package/dist/telemetry/metrics.d.ts +30 -0
  106. package/dist/telemetry/metrics.d.ts.map +1 -1
  107. package/dist/telemetry/metrics.js +72 -0
  108. package/dist/telemetry/metrics.js.map +1 -1
  109. package/dist/types/strategy.d.ts +9 -1
  110. package/dist/types/strategy.d.ts.map +1 -1
  111. package/dist/universe/package-universe.d.ts +97 -0
  112. package/dist/universe/package-universe.d.ts.map +1 -0
  113. package/dist/universe/package-universe.js +304 -0
  114. package/dist/universe/package-universe.js.map +1 -0
  115. package/dist/validate/codes.d.ts +30 -0
  116. package/dist/validate/codes.d.ts.map +1 -1
  117. package/dist/validate/codes.js +74 -1
  118. package/dist/validate/codes.js.map +1 -1
  119. package/dist/validate/index.d.ts +1 -1
  120. package/dist/validate/index.d.ts.map +1 -1
  121. package/dist/validate/index.js.map +1 -1
  122. package/dist/validate/install-gate.d.ts.map +1 -1
  123. package/dist/validate/install-gate.js +10 -2
  124. package/dist/validate/install-gate.js.map +1 -1
  125. package/dist/validate/live-instruments.d.ts +44 -0
  126. package/dist/validate/live-instruments.d.ts.map +1 -0
  127. package/dist/validate/live-instruments.js +71 -0
  128. package/dist/validate/live-instruments.js.map +1 -0
  129. package/dist/validate/live-stage.d.ts +8 -0
  130. package/dist/validate/live-stage.d.ts.map +1 -1
  131. package/dist/validate/live-stage.js +87 -18
  132. package/dist/validate/live-stage.js.map +1 -1
  133. package/dist/validate/package-gates-stage.d.ts +61 -0
  134. package/dist/validate/package-gates-stage.d.ts.map +1 -0
  135. package/dist/validate/package-gates-stage.js +215 -0
  136. package/dist/validate/package-gates-stage.js.map +1 -0
  137. package/dist/validate/proof.d.ts +11 -1
  138. package/dist/validate/proof.d.ts.map +1 -1
  139. package/dist/validate/proof.js +10 -6
  140. package/dist/validate/proof.js.map +1 -1
  141. package/dist/validate/recipe-checks.d.ts.map +1 -1
  142. package/dist/validate/recipe-checks.js +6 -4
  143. package/dist/validate/recipe-checks.js.map +1 -1
  144. package/dist/validate/run.d.ts +29 -1
  145. package/dist/validate/run.d.ts.map +1 -1
  146. package/dist/validate/run.js +65 -6
  147. package/dist/validate/run.js.map +1 -1
  148. package/dist/validate/target.d.ts +41 -0
  149. package/dist/validate/target.d.ts.map +1 -1
  150. package/dist/validate/target.js +192 -16
  151. package/dist/validate/target.js.map +1 -1
  152. package/dist/validate/taxonomy-finding.d.ts +22 -0
  153. package/dist/validate/taxonomy-finding.d.ts.map +1 -0
  154. package/dist/validate/taxonomy-finding.js +25 -0
  155. package/dist/validate/taxonomy-finding.js.map +1 -0
  156. package/dist/validate/universe-stage.d.ts +71 -0
  157. package/dist/validate/universe-stage.d.ts.map +1 -0
  158. package/dist/validate/universe-stage.js +165 -0
  159. package/dist/validate/universe-stage.js.map +1 -0
  160. package/dist/validate/wallet-binding-stage.d.ts +44 -0
  161. package/dist/validate/wallet-binding-stage.d.ts.map +1 -0
  162. package/dist/validate/wallet-binding-stage.js +92 -0
  163. package/dist/validate/wallet-binding-stage.js.map +1 -0
  164. package/openclaw.plugin.json +1 -1
  165. package/package.json +1 -1
package/README.md CHANGED
@@ -165,9 +165,83 @@ Templates live under `examples/strategies/` in the package. See [examples/strate
165
165
 
166
166
  ## CLI reference
167
167
 
168
+ **Deploy a strategy package (the supported go-live path):**
169
+
170
+ `senpi deploy` runs the whole path — funds preflight → wallet create+fund (with
171
+ `skillName`/`skillVersion` attribution from `strategy.yaml`) → install → one observed
172
+ scanner tick — as a **detached background job**. The verb returns in ~1s with a
173
+ `deployId`; monitoring is explicit polling.
174
+
175
+ - `openclaw senpi deploy -p <package-dir> --budget <usd>` — start the job (detached) and print the `deployId` plus the watch command
176
+ - `-p, --path <dir>` — strategy package directory (contains `strategy.yaml`)
177
+ - `--budget <usd>` — total budget across the package's wallets (min $10/wallet — the platform floor `min_budget.py` owns)
178
+ - `--decision-model <model>` — required if the package uses `decision_mode: llm`
179
+ - `--tick-wait <seconds>` — how long the job waits to observe one verified scanner tick (default 120, `0` skips)
180
+ - `--max-wait <seconds>` — how long the job waits for wallets to reach ACTIVE (default 150)
181
+ - `--json` — print the raw start response
182
+ - **Exit codes (start):** `0` the job started · `2` refused · `1` internal/transport error. A refusal is recognisable by its message, which leads with the code (`[INVALID_REQUEST] …`, `[E_DEPLOY_IN_PROGRESS] …`) — the same `2 = refused` class `deploy status` uses, so a caller branching on the code obeys a refusal instead of retrying it. `1` is reserved for a gateway that could not be reached or whose response could not be read; on that code the deploy's state is unknown and `senpi deploy status` is the way to find out.
183
+ - `openclaw senpi deploy status [deployId]` — the job's phase while running; the full verified report once terminal. **Exit codes:** `0` live · `2` refused · `3` failed · `4` installed-unobserved · `5` interrupted · `6` pending (a wallet still funding, or the job still running) · `1` internal/transport error. The code is set on the `--json` path too. Anything richer than the overall status: read `--json`. A tick that was not observed within the window reports as `unobserved` (with the check-later command) — never as success. After a gateway restart an unfinished job reports as `interrupted`, showing both the journal history and a fresh read of what actually exists, plus the resume command.
184
+
185
+ There is no `cancel` verb: undeploying a strategy is closing it (`senpi-strategy-ops/scripts/close.py`),
186
+ not stopping the job. Every MCP call a deploy makes is deadline-bounded — the job stops *waiting* on
187
+ a call that overruns (the request may still be in flight on the server, so the report says the
188
+ outcome is unknown rather than claiming it failed) — and the job itself has a wall-clock deadline — past it the run is abandoned at its next step boundary and the slot is freed,
189
+ so a wedged deploy can never block the next one until the gateway restarts.
190
+
191
+ One deploy runs at a time (`[E_DEPLOY_IN_PROGRESS]`): concurrent deploys share one funding
192
+ waterfall and could jointly overdraw. Re-running `senpi deploy` on the same package resumes —
193
+ reconciliation reads the backend and the registry and adopts whatever already exists, waiting for a
194
+ wallet that is still initializing rather than creating a second one. A match that is paused or being
195
+ torn down is refused outright, naming its real status and what to do about it — it is never waited on
196
+ as if it were funding. Deploy never *adds* funds to a
197
+ wallet that already exists; when the requested `--budget` exceeds what an adopted wallet holds, the
198
+ report says so instead of implying the money was applied.
199
+
200
+ A package whose instances declare no DSL exit block (`exit.dsl_preset`, or `exit.engine: dsl`) is
201
+ refused before anything is created: a strategy that cannot stop itself out is never funded.
202
+
203
+ A package that **hardcodes an instrument which is not live on Hyperliquid** is refused the same way,
204
+ pre-money, before the deploy reads the backend at all (`[E_UNIVERSE_NOT_LIVE]`). A dead name does not
205
+ error at runtime — the scan skips it and the strategy silently trades nothing — so the one refusal
206
+ enumerates *every* dead name with the exact file and key path it appears in (`catalog.assets`, or an
207
+ instance's `scanners[].inputs`), plus the read-only re-check command and the re-run. A bare ticker
208
+ counts as live if either `T` or `xyz:T` is; a package that hardcodes nothing (a derived universe)
209
+ never reads the instrument list at all. Names under an **exclusion** key (`excludeAssets`, `deny…`,
210
+ `skip…`) are not hardcoded instruments in this sense and are never checked: the package is naming
211
+ what it will *not* trade, and such a list routinely names things the venue does not carry — which is
212
+ usually the reason they are on it. When the live instrument list **cannot be read**, the deploy
213
+ fails closed — the step reports the read failure with no refusal code and names no instrument dead,
214
+ because unknown is never "not live", and nothing is created either way.
215
+
216
+ **The budget is checked in two tiers, and only the first one refuses.** The **hard floor** is
217
+ $10/wallet (the platform minimum): a budget the accessible balance cannot fund at that floor halts
218
+ with `[E_FUNDS_BELOW_FLOOR]` and no wallet is created. The **soft tier** is the package's *calculated
219
+ minimum* — the smallest total at which every sleeve's smallest slot can still open, computed locally
220
+ from the package's own sizing (the same calculation `min_budget.py` bakes into the discovery card).
221
+ When a wallet this deploy funds is allocated less than its own sizing needs, it **deploys anyway**
222
+ and reports `[W_BUDGET_BELOW_STRATEGY_MIN]`, naming each short wallet and both its numbers: the
223
+ strategy runs degraded (fewer slots than authored), which is a choice, not a fault. When a sleeve
224
+ exposes no readable slot size the minimum is a lower bound and the report says so with
225
+ `[W_BUDGET_UNRESOLVED]` — plus the shortfall, if a wallet is short anyway. Both are warnings — they
226
+ never refuse, and they show up as `calculated minimum:` / `warn:` lines in `deploy status` and as
227
+ `minBudget`/`minWalletCount`/`belowMin`/`minBudgetNote`/`minBudgetUnresolved` in `--json`.
228
+ `belowMin` is a claim about the funding PLAN — set whenever the plan allocated a wallet under its own sizing, under either code, and left true if the deploy then failed; the note marks that difference in tense ("would have funded").
229
+
230
+ The shortfall is judged **per wallet**, against what `planFunding` actually allocates each one —
231
+ never whole-budget against whole-package minimum. Those differ as soon as a sleeve is adopted (the
232
+ budget is then split among fewer wallets), and comparing the totals reports shortfalls that do not
233
+ exist. `minBudget` rides the report as *context* — "deploying the whole package fresh needs $30
234
+ across 2 wallets" — not as the thing that was violated.
235
+
236
+ Running the authored design after a below-minimum deploy means **starting over**, not re-running at
237
+ a bigger number: deploy never adds funds to a wallet that already exists, so a re-run would simply
238
+ adopt the one just created. The warn names the exact sequence, **scoped to the short sleeves**
239
+ (`close.py <id> --instance <name>`, which returns their funds) so adopted live wallets beside them
240
+ are left alone — and it is omitted entirely when the deploy created no wallet at all.
241
+
168
242
  **Runtime recipes:**
169
- - `openclaw senpi runtime create -p <path>` — create from YAML file (hot-load)
170
- - `openclaw senpi runtime create -c "<yaml>"` — create from inline YAML
243
+ - `openclaw senpi runtime create` — **internal**; prefer `senpi deploy`, which adds the funds preflight, attribution and the verified tick that direct create skips. Hidden from help; still executes.
244
+ - `--runtime-yaml-dir <dir>` — directory to resolve relative scanner paths against (content installs only). Without it, a content install whose YAML declares a relative scanner `path` is refused with `[E_VALIDATE_UNRESOLVABLE_SCANNER_PATH]` rather than silently resolving against the gateway's working directory. The refusal comes from the install gate, which also names the other ways to supply the directory.
171
245
  - `openclaw senpi runtime list` — list installed runtimes
172
246
  - `openclaw senpi runtime delete <runtime_id>` — remove by id
173
247
 
@@ -0,0 +1,93 @@
1
+ export interface DeployStepLike {
2
+ status: string;
3
+ detail: string;
4
+ evidence?: Record<string, unknown>;
5
+ }
6
+ export interface DeployInstanceLike {
7
+ instance: string;
8
+ wallet?: string;
9
+ strategyId?: string;
10
+ funded?: number;
11
+ runtimeId?: string;
12
+ /** D-6: this job created the wallet, its install failed, and the close+refund completed. */
13
+ rolledBack?: boolean;
14
+ steps: Record<string, DeployStepLike>;
15
+ }
16
+ export interface DeployReportLike {
17
+ packageId: string;
18
+ version: string;
19
+ overall: string;
20
+ instances: DeployInstanceLike[];
21
+ next?: string;
22
+ /** The SOFT calculated-minimum tier — advisory, and never part of `overall`. */
23
+ minBudget?: number;
24
+ minWalletCount?: number;
25
+ belowMin?: boolean;
26
+ minBudgetNote?: string;
27
+ minBudgetUnresolved?: string[];
28
+ /** The OUTCOME tier — the backend funded a wallet short of the ask. Advisory, like the above. */
29
+ partialFundNote?: string;
30
+ /** The OUTCOME tier's other half — the backend reported no readable funded amount. Advisory. */
31
+ fundedUnreadableNote?: string;
32
+ }
33
+ export interface DeployEventLike {
34
+ seq: number;
35
+ ts: string;
36
+ type: string;
37
+ phase?: string;
38
+ instance?: string;
39
+ step?: string;
40
+ status?: string;
41
+ detail: string;
42
+ }
43
+ export interface DeployLiveLayerLike {
44
+ strategies: Array<{
45
+ strategyName: string;
46
+ status: string;
47
+ strategyWalletAddress: string;
48
+ totalFunded?: number;
49
+ }>;
50
+ runtimes: Array<{
51
+ id: string;
52
+ wallet?: string;
53
+ }>;
54
+ unavailable?: string;
55
+ }
56
+ export interface DeploySnapshotLike {
57
+ meta: {
58
+ deployId: string;
59
+ packageId: string;
60
+ version: string;
61
+ packageDir: string;
62
+ budget?: number;
63
+ startedAt: string;
64
+ };
65
+ state: {
66
+ status: "running";
67
+ phase: string;
68
+ stopRequested: boolean;
69
+ } | {
70
+ status: "done";
71
+ overall: string;
72
+ } | {
73
+ status: "interrupted";
74
+ };
75
+ events?: DeployEventLike[];
76
+ report?: DeployReportLike;
77
+ live?: DeployLiveLayerLike;
78
+ next?: string;
79
+ /** ISO, quoted from the terminal journal line — see {@link durationEndMs}. */
80
+ endedAt?: string;
81
+ }
82
+ export declare function renderHeader(snap: DeploySnapshotLike, now: number): string;
83
+ export declare function renderStepTable(report: DeployReportLike): string[];
84
+ export declare function renderEventsTail(events: DeployEventLike[], carried?: ReadonlyMap<string, string>): string[];
85
+ export declare function renderReportFooter(report: DeployReportLike): string[];
86
+ /** Fresh-read layer, printed beside (never instead of) the journal narration. */
87
+ export declare function renderLiveLayer(live: DeployLiveLayerLike): string[];
88
+ export declare function renderDeploySnapshotLines(snap: DeploySnapshotLike, now?: number): string[];
89
+ /** The ONE place the D-12 map lives; the status action calls it. */
90
+ export declare function exitCodeForDeploy(snap: DeploySnapshotLike): number;
91
+ /** CLI entry point: print the snapshot rendering. */
92
+ export declare function renderDeploySnapshot(snap: DeploySnapshotLike, now?: number): void;
93
+ //# sourceMappingURL=deploy-render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-render.d.ts","sourceRoot":"","sources":["../../src/cli/deploy-render.ts"],"names":[],"mappings":"AAgBA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4FAA4F;IAC5F,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,kBAAkB,EAAE,CAAC;IAChC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,gFAAgF;IAChF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B,iGAAiG;IACjG,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gGAAgG;IAChG,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,eAAe;IAC9B,GAAG,EAAE,MAAM,CAAC;IACZ,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KA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AAgB,YAAY,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAQ1E;AASD,wBAAgB,eAAe,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAkClE;AA6DD,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,eAAe,EAAE,EACzB,OAAO,GAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAa,GAC/C,MAAM,EAAE,CAGV;AA8CD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAYrE;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAenE;AAyCD,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,EAAE,CAqBtG;AAmBD,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAmBlE;AAED,qDAAqD;AACrD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,GAAE,MAAmB,GAAG,IAAI,CAE7F"}
@@ -0,0 +1,438 @@
1
+ /**
2
+ * Pure renderer for `senpi deploy status`.
3
+ *
4
+ * Every number and lifecycle claim printed here is quoted from the surface that
5
+ * proves it — the report's `funded` (backend `totalFunded`), the scanner row's
6
+ * fields, the install payload — never re-derived in prose and never reformatted.
7
+ * A running phase renders as an in-progress fact, never as an achievement, and
8
+ * an unobserved tick renders as `unobserved` with the check-later command.
9
+ *
10
+ * Kept free of I/O so it unit-tests without the gateway spawn mock. It borrows exactly one thing
11
+ * from the deploy module — `usd()`, so money reads the same here as in the notes this prints beside
12
+ * — and nothing else: the report types below are structural mirrors, deliberately not imports, so
13
+ * the renderer stays decoupled from the orchestrator's shapes.
14
+ */
15
+ import { usd } from "../deploy/funding.js";
16
+ const STEP_ORDER = ["reconcile", "preflight", "create", "install", "observe"];
17
+ const EVENT_TAIL = 6;
18
+ /**
19
+ * What an event line prints where the payload carried no value — see {@link eventLine}.
20
+ *
21
+ * Markers, not fallbacks: uppercase and unquotable as a timestamp or a narration, so a reader
22
+ * cannot mistake either for something the gateway said.
23
+ */
24
+ const NO_TIMESTAMP = "NO TIMESTAMP";
25
+ const NO_DETAIL = "NO DETAIL — this event arrived without one";
26
+ /**
27
+ * One rule for every field this switch interpolates, so the three arms cannot disagree about what
28
+ * an unusable value is.
29
+ *
30
+ * `state` is a structural mirror of gateway JSON, like `DeployEventLike`, and every arm read its
31
+ * field bare: an absent `phase` or `overall` printed the literal `undefined` into the header line
32
+ * an operator reads to decide whether to wait, retry or walk away, and a non-string one printed
33
+ * `[object Object]`.
34
+ *
35
+ * Two different absences, two different answers, and the difference is load-bearing. Nothing
36
+ * supplied → say nothing was supplied. Something supplied that this build cannot use → hand the
37
+ * reader the value, exactly as the `default` arm does for an unrecognised status, because "no
38
+ * outcome was reported" over a payload that DID report one is a new false sentence, not a fix.
39
+ * Markers are uppercase and unquotable as a phase or an outcome, the same discipline `NO DETAIL`
40
+ * and `NO TIMESTAMP` follow in the events tail.
41
+ */
42
+ function statePart(field, value) {
43
+ if (typeof value === "string" && value !== "")
44
+ return value;
45
+ return value === undefined || value === null || value === ""
46
+ ? `NO ${field} REPORTED — this answer carries none`
47
+ : `UNREADABLE ${field} ${describeUnreadable(value)} — this build cannot read that value`;
48
+ }
49
+ /**
50
+ * How the unreadable arm reads a value it has already decided it cannot use.
51
+ *
52
+ * `JSON.stringify` alone defeats the arm it serves in three ways, all confirmed by executing it: a
53
+ * symbol or a function makes it RETURN `undefined` — the literal word the guard exists to stop — and
54
+ * a circular object or a BigInt makes it THROW, which escapes `renderState` and `renderHeader` and
55
+ * loses the whole page. Losing the page is the worse outcome of the two: the step table, the event
56
+ * tail and the live layer that did arrive are discarded over one field in the header.
57
+ *
58
+ * `String(v)` is the fallback and NOT the rule, because the fidelity is the point of this arm:
59
+ * `["live"]` has to render as `["live"]` and not collapse to `live`, which is the very value the
60
+ * reader must not mistake for a string the payload carried. So stringify first, and fall back only
61
+ * where it cannot answer.
62
+ *
63
+ * Unreachable from the real path — a snapshot arrives via `JSON.parse` of gateway stdout, which
64
+ * cannot produce a symbol, a function, a BigInt or a cycle — so this is defence of the same class as
65
+ * the guards around it.
66
+ */
67
+ function describeUnreadable(value) {
68
+ try {
69
+ return JSON.stringify(value) ?? String(value);
70
+ }
71
+ catch {
72
+ return String(value);
73
+ }
74
+ }
75
+ /** Human phrase for a job state — running phases stay in-progress, never triumphant. */
76
+ function renderState(state) {
77
+ switch (state.status) {
78
+ case "running": {
79
+ // Third arm of the same defect, and the last one: both templates interpolated `state.phase`
80
+ // bare, so a `running` payload with no phase rendered `running (phase: undefined)`.
81
+ const phase = statePart("PHASE", state.phase);
82
+ return state.stopRequested
83
+ ? `running (phase: ${phase}; deploy deadline reached — stopping at the next step boundary)`
84
+ : `running (phase: ${phase})`;
85
+ }
86
+ case "done":
87
+ // The same defect the `default` arm below was added for, one line up and on a different
88
+ // field: `state.overall` was read unguarded, so `{ state: { status: "done" } }` rendered
89
+ // `done — undefined`. `unrenderableSnapshot` does not cover it — it checks `state.status` and
90
+ // three `meta` fields — and is deliberately not extended to, because refusing the whole page
91
+ // would discard the report and the event tail that DID arrive over one missing word in the
92
+ // header. So it is fixed the same way its neighbour was: name the absence, invent nothing.
93
+ // `exitCodeForDeploy` answers 1 for a missing overall AND for a present-but-unreadable one,
94
+ // so the line and the code now agree on every payload — see the note on the map.
95
+ return `done — ${statePart("OVERALL", state.overall)}`;
96
+ case "interrupted":
97
+ return "interrupted by a gateway restart (no deploy is running now)";
98
+ default:
99
+ // With no `default` arm at all, a status outside the union fell off the end, returned
100
+ // `undefined`, and the header template interpolated the literal string `undefined` into the
101
+ // line an operator reads to decide whether to wait, retry, or walk away.
102
+ //
103
+ // What replaces it must not read as a fourth state this runtime knows about and has decided:
104
+ // `unknown` or `pending` would, and that is the same fail-open the duration fix removed one
105
+ // screen up. So it reports the only two things available here — that nothing recognised the
106
+ // value, and what the value was — and leaves the reader holding the value itself.
107
+ return (`UNRECOGNISED STATE ${JSON.stringify(String(state.status))} — ` +
108
+ `this runtime build has no meaning for it`);
109
+ }
110
+ }
111
+ function elapsedSeconds(startedAt, endMs) {
112
+ const started = Date.parse(startedAt);
113
+ if (Number.isNaN(started))
114
+ return null;
115
+ return Math.max(0, Math.round((endMs - started) / 1000));
116
+ }
117
+ /**
118
+ * What the duration is measured TO — the one thing that decides whether this line is a measurement
119
+ * or a fabrication.
120
+ *
121
+ * A running job measures to the read time: that number is meant to grow, and it is how an operator
122
+ * sees a deploy is still moving. A finished job measures to the end its journal recorded, so the
123
+ * duration is frozen at what the job actually took — before this, `now` was used for both, and one
124
+ * refusal that took five seconds reported 48s, 83s and 100s on three reads of the same terminal
125
+ * job, with "still going after 100s" and "finished in 5s" printing identically.
126
+ *
127
+ * `null` suppresses the duration entirely, and covers two cases that are the same claim:
128
+ *
129
+ * - A terminal journal with no parseable `endedAt` (written before the field was carried, or
130
+ * truncated). `now - startedAt` is not a worse estimate of that job's duration, it is not a
131
+ * measurement of it at all — a missing number is honest, a growing one on a finished job is the
132
+ * defect.
133
+ * - An `interrupted` job, whatever it carries. Its `endedAt` is stamped by the boot scan when it
134
+ * NOTICES the dead journal, so it measures start → next restart, not start → stop; the same
135
+ * journal read before any boot scan has no stamp at all. Nobody observed when that job stopped,
136
+ * so nothing here can report how long it ran.
137
+ */
138
+ function durationEndMs(snap, now) {
139
+ if (snap.state.status === "running")
140
+ return now;
141
+ if (snap.state.status !== "done")
142
+ return null;
143
+ const ended = Date.parse(snap.endedAt ?? "");
144
+ return Number.isNaN(ended) ? null : ended;
145
+ }
146
+ export function renderHeader(snap, now) {
147
+ const endMs = durationEndMs(snap, now);
148
+ const elapsed = endMs === null ? null : elapsedSeconds(snap.meta.startedAt, endMs);
149
+ const elapsedPart = elapsed === null ? "" : `, elapsed ${elapsed}s`;
150
+ return (`deploy ${snap.meta.deployId} — ${renderState(snap.state)} — package ` +
151
+ `${snap.meta.packageId} v${snap.meta.version}${elapsedPart}`);
152
+ }
153
+ /** `k=v` pairs straight from the evidence object — no rounding, no currency formatting. */
154
+ function renderEvidence(evidence) {
155
+ return Object.entries(evidence)
156
+ .map(([key, value]) => `${key}=${typeof value === "string" ? value : JSON.stringify(value)}`)
157
+ .join(" ");
158
+ }
159
+ export function renderStepTable(report) {
160
+ const lines = [];
161
+ for (const instance of report.instances) {
162
+ // A rolled-back wallet is closed and its funds are back with the owner — rendering it as
163
+ // `funded N` here would be the same fail-open as calling an unobserved tick `live`. An
164
+ // INCOMPLETE rollback deliberately keeps the funded figure: there the money really is stranded.
165
+ const facts = [
166
+ instance.wallet ? `wallet ${instance.wallet}` : null,
167
+ instance.strategyId ? `strategyId ${instance.strategyId}` : null,
168
+ instance.rolledBack
169
+ ? "ROLLED BACK — strategy closed, funds returned"
170
+ : instance.funded !== undefined
171
+ ? `funded ${instance.funded}`
172
+ : null,
173
+ // A runtime id survives a FAILED install (a blind runtime records its id as a fact), and the
174
+ // facts line is the skim line agents quote. Bare, it relays as "the runtime is installed" —
175
+ // the exact opposite of what the install step two lines below says.
176
+ instance.runtimeId
177
+ ? instance.steps.install?.status === "failed"
178
+ ? `runtime ${instance.runtimeId} (install FAILED — not watching this wallet)`
179
+ : `runtime ${instance.runtimeId}`
180
+ : null,
181
+ ].filter((fact) => fact !== null);
182
+ lines.push(` instance ${instance.instance}${facts.length > 0 ? ` — ${facts.join(", ")}` : ""}`);
183
+ for (const step of STEP_ORDER) {
184
+ const outcome = instance.steps[step];
185
+ if (!outcome)
186
+ continue;
187
+ lines.push(` ${step.padEnd(9)} ${outcome.status.padEnd(11)} ${outcome.detail}`);
188
+ if (outcome.evidence && Object.keys(outcome.evidence).length > 0) {
189
+ lines.push(` evidence: ${renderEvidence(outcome.evidence)}`);
190
+ }
191
+ }
192
+ }
193
+ return lines;
194
+ }
195
+ /**
196
+ * The step rows the table above has already printed, keyed by the exact text each one printed.
197
+ *
198
+ * `record()` in the orchestrator narrates a step by emitting an event whose `detail` IS the step
199
+ * outcome's `detail` — the same string — so a refusal lands in both places verbatim. On a refused
200
+ * deploy that rendered the whole multi-paragraph teaching block twice in one screen (~15 duplicated
201
+ * lines for `[E_UNIVERSE_NOT_LIVE]`), on the surface an agent polls, where every read pays for it.
202
+ *
203
+ * Keyed by the TEXT rather than by `(instance, step)`: byte equality is the only thing that proves
204
+ * the reader already has that body in front of them. If the two ever diverge, nothing is elided and
205
+ * the tail prints whole — the failure mode is a duplicate, never a fact that went missing.
206
+ *
207
+ * Built from the same `STEP_ORDER` walk `renderStepTable` renders from, so a step the table skips
208
+ * is never counted as on-screen.
209
+ */
210
+ function stepDetailsOnScreen(report) {
211
+ const carried = new Map();
212
+ if (!report)
213
+ return carried;
214
+ const named = report.instances.length > 1;
215
+ for (const instance of report.instances) {
216
+ for (const step of STEP_ORDER) {
217
+ const outcome = instance.steps?.[step];
218
+ if (!outcome || carried.has(outcome.detail))
219
+ continue;
220
+ carried.set(outcome.detail, named ? `the ${step} step of instance ${instance.instance}` : `the ${step} step`);
221
+ }
222
+ }
223
+ return carried;
224
+ }
225
+ /**
226
+ * One event as one line — with the body elided only where the reader can already see it.
227
+ *
228
+ * The tail is a TIMELINE, not a second transcript. An event whose text is on screen above keeps its
229
+ * timestamp and its first line — which is where the bracketed code lives, so the tail stays
230
+ * skimmable and greppable — and says where the rest of it is. An event whose text is NOT on screen
231
+ * prints whole: for an interrupted job the tail is the only place its narration exists at all, and
232
+ * truncating there would delete the fact rather than de-duplicate it.
233
+ */
234
+ function eventLine(event, carried) {
235
+ // The same presence discipline `unrenderableSnapshot` applies to the page, applied to one row:
236
+ // `DeployEventLike` mirrors gateway JSON, and the page-level guard checks `state` and `meta` and
237
+ // never reaches `events[]`. A missing field here must cost that row's content and nothing more —
238
+ // reading it unguarded took the whole page down with a TypeError, which is strictly worse than
239
+ // the line it was meant to improve.
240
+ //
241
+ // Each absence gets a marker rather than a value. Blank would read as an event that happened and
242
+ // said nothing; interpolating prints the literal `undefined` the header arm exists to remove.
243
+ const ts = typeof event?.ts === "string" && event.ts !== "" ? event.ts : NO_TIMESTAMP;
244
+ if (typeof event?.detail !== "string")
245
+ return ` ${ts} ${NO_DETAIL}`;
246
+ const where = carried.get(event.detail);
247
+ const firstLine = event.detail.split("\n", 1)[0] ?? "";
248
+ // A single-line detail has no body to elide, and one whose first line is blank has no legible
249
+ // stand-in to elide it TO — both print exactly as they always did.
250
+ if (where === undefined || firstLine.length === event.detail.length || firstLine.trim() === "") {
251
+ return ` ${ts} ${event.detail}`;
252
+ }
253
+ return ` ${ts} ${firstLine} — full text above, under ${where}`;
254
+ }
255
+ export function renderEventsTail(events, carried = new Map()) {
256
+ if (events.length === 0)
257
+ return [];
258
+ return [" recent events:", ...events.slice(-EVENT_TAIL).map((event) => eventLine(event, carried))];
259
+ }
260
+ /**
261
+ * The SOFT calculated-minimum tier, rendered beside the overall — never folded INTO it.
262
+ *
263
+ * A deploy that ran below the package's calculated minimum is still `live`: the minimum is a local
264
+ * estimate over the package's own YAML, not a platform rule, and the deploy proceeded. So the
265
+ * figure prints as its own fact and the note prints under an explicit `warn:` label, which is what
266
+ * keeps a reader (agent or human) from reading its `[E_…]` code as a refusal.
267
+ *
268
+ * The figure renders through the same `usd()` every note in the deploy module uses. It is NOT in
269
+ * the "quote it exactly as carried" class that `funded` and the scanner fields are in: those are
270
+ * backend-quoted facts that must never be re-derived, whereas this one is computed locally two
271
+ * modules away. `SKILL.md` tells the agent to quote the report's numbers verbatim, so a bare `125`
272
+ * is what would reach the user.
273
+ *
274
+ * The two qualifiers COMPOSE rather than compete. `belowMin` and an unresolved sleeve can hold at
275
+ * once, and this line is what a skimming reader takes away, so dropping either half would
276
+ * understate the situation.
277
+ *
278
+ * `belowMin` renders as a statement about a WALLET, never about the budget versus this total. The
279
+ * two are different claims — a partially-adopted deploy splits the budget among fewer wallets — and
280
+ * "the requested budget is BELOW it" is not merely weaker but false where they diverge: a declared
281
+ * `funding_share: 0` sleeve is floored at MIN_WALLET at every budget, so `belowMin` holds while the
282
+ * budget may be far above the total.
283
+ */
284
+ function renderSoftBudgetTier(report) {
285
+ const lines = [];
286
+ if (report.minBudget !== undefined) {
287
+ const unresolved = report.minBudgetUnresolved ?? [];
288
+ const parts = [];
289
+ if (unresolved.length > 0)
290
+ parts.push(`UNRESOLVED for ${unresolved.join(", ")}`);
291
+ if (report.belowMin) {
292
+ parts.push(`${unresolved.length > 0 ? "and " : ""}a wallet in this deploy is sized below its own minimum`);
293
+ }
294
+ const qualifier = parts.length > 0 ? ` — ${parts.join(", ")}` : "";
295
+ lines.push(` calculated minimum: ${usd(report.minBudget)} across ${report.minWalletCount} wallet(s)${qualifier}`);
296
+ }
297
+ if (report.minBudgetNote)
298
+ lines.push(` warn: ${report.minBudgetNote}`);
299
+ return lines;
300
+ }
301
+ export function renderReportFooter(report) {
302
+ const lines = [` overall: ${report.overall}`, ...renderSoftBudgetTier(report)];
303
+ // A SECOND warn line, never merged with the soft tier's: that one is a claim about the funding
304
+ // plan against the package's own sizing, this one is a claim about what the backend actually
305
+ // landed, and a report can truthfully carry both. Same `warn:` label for the same reason — it is
306
+ // what stops a reader taking a bracketed code on a `live` deploy for a refusal.
307
+ if (report.partialFundNote)
308
+ lines.push(` warn: ${report.partialFundNote}`);
309
+ // Mutually exclusive with the line above per wallet, but not per report: a two-sleeve package
310
+ // can land one short wallet and one unreadable read, and each wallet gets the note that fits it.
311
+ if (report.fundedUnreadableNote)
312
+ lines.push(` warn: ${report.fundedUnreadableNote}`);
313
+ if (report.next)
314
+ lines.push(` next: ${report.next}`);
315
+ return lines;
316
+ }
317
+ /** Fresh-read layer, printed beside (never instead of) the journal narration. */
318
+ export function renderLiveLayer(live) {
319
+ if (live.unavailable)
320
+ return [` live (fresh read): unavailable — ${live.unavailable}`];
321
+ const lines = [" live (fresh read):"];
322
+ if (live.strategies.length === 0)
323
+ lines.push(" strategies: none matching this package");
324
+ for (const strategy of live.strategies) {
325
+ lines.push(` strategy ${strategy.strategyName}: status ${strategy.status}, ` +
326
+ `wallet ${strategy.strategyWalletAddress}, totalFunded ${strategy.totalFunded ?? "unreadable"}`);
327
+ }
328
+ if (live.runtimes.length === 0)
329
+ lines.push(" runtimes: none registered for this package");
330
+ for (const runtime of live.runtimes) {
331
+ lines.push(` runtime ${runtime.id}: wallet ${runtime.wallet ?? "(none)"}`);
332
+ }
333
+ return lines;
334
+ }
335
+ /**
336
+ * The fields this renderer cannot print one honest line without — checked at the entry point, the
337
+ * way {@link exitCodeForDeploy} already checks its own.
338
+ *
339
+ * `exitCodeForDeploy` is hardened against a shape-broken gateway payload (`{}`, `{state:{}}`) and
340
+ * answers 1, with tests pinning it. The renderer read the very same fields unguarded, and the
341
+ * status action calls BOTH on the same payload — so a malformed answer got a considered exit code
342
+ * and then a stack trace over the explanation.
343
+ *
344
+ * Refusing to render is the third option this file already prefers over a plausible fallback: a
345
+ * header reading `deploy undefined — … package undefined vundefined` is not a rougher reading of a
346
+ * broken payload, it is a fabricated one.
347
+ *
348
+ * The exit code is deliberately not re-decided here. On the payloads this actually fires for it is
349
+ * already 1 from the guard above; a payload carrying a real `state.status` but no `meta` cannot be
350
+ * produced by the in-repo gateway (`readJournal` returns null without a header line), and where the
351
+ * state IS readable an outcome derived from it is a fact this message does not contradict.
352
+ */
353
+ function unrenderableSnapshot(snap) {
354
+ const missing = [
355
+ ["state.status", snap?.state?.status],
356
+ ["meta.deployId", snap?.meta?.deployId],
357
+ ["meta.packageId", snap?.meta?.packageId],
358
+ ["meta.version", snap?.meta?.version],
359
+ ]
360
+ .filter(([, value]) => typeof value !== "string" || value === "")
361
+ .map(([field]) => field);
362
+ if (missing.length === 0)
363
+ return null;
364
+ return [
365
+ `deploy status: this answer is not a readable deploy snapshot — it carries no ${missing.join(", ")}.`,
366
+ " Nothing here can describe the job, and this says nothing about the deploy itself: a started " +
367
+ "job may be running right now.",
368
+ " Read what did arrive, verbatim: openclaw senpi deploy status --json",
369
+ " If it keeps reading like this, check the gateway log.",
370
+ ];
371
+ }
372
+ export function renderDeploySnapshotLines(snap, now = Date.now()) {
373
+ const unrenderable = unrenderableSnapshot(snap);
374
+ if (unrenderable)
375
+ return unrenderable;
376
+ const lines = [renderHeader(snap, now)];
377
+ const interrupted = snap.state.status === "interrupted";
378
+ if (snap.report)
379
+ lines.push(...renderStepTable(snap.report));
380
+ const events = snap.events ?? [];
381
+ if (events.length > 0) {
382
+ lines.push(...(interrupted ? [" history (journal):"] : []), ...renderEventsTail(events, stepDetailsOnScreen(snap.report)));
383
+ }
384
+ if (snap.live)
385
+ lines.push(...renderLiveLayer(snap.live));
386
+ if (snap.report)
387
+ lines.push(...renderReportFooter(snap.report));
388
+ if (snap.next)
389
+ lines.push(` next: ${snap.next}`);
390
+ return lines;
391
+ }
392
+ /**
393
+ * D-12 exit-code contract for `senpi deploy status`. 1 is reserved for transport/internal
394
+ * errors (node/commander default) and is also the unknown-status fallback so a future status
395
+ * can never silently read as success. Anything richer than the overall status: use --json.
396
+ */
397
+ const DEPLOY_EXIT_CODES = {
398
+ live: 0,
399
+ refused: 2,
400
+ failed: 3,
401
+ "installed-unobserved": 4,
402
+ interrupted: 5,
403
+ // A report whose overall is `pending` (a wallet was still funding when the poll budget ran out)
404
+ // is the same answer as a job still in flight: not finished, re-run to resume. It shares code 6
405
+ // rather than falling to 1, which would call a normal resumable outcome an internal error.
406
+ pending: 6,
407
+ };
408
+ /** The ONE place the D-12 map lives; the status action calls it. */
409
+ export function exitCodeForDeploy(snap) {
410
+ // A snapshot with no state is a broken gateway contract, not a running job — 1, not 6.
411
+ if (!snap?.state?.status)
412
+ return 1;
413
+ // `interrupted` is a terminal STATE, not an overall — a gateway restart killed the job. It is
414
+ // not pending: nothing is running, so it must never exit 6.
415
+ if (snap.state.status === "interrupted")
416
+ return DEPLOY_EXIT_CODES.interrupted;
417
+ if (snap.state.status !== "done")
418
+ return 6; // pending — job still running
419
+ // The type guard is the fix for a divergence from the header that was filed rather than made:
420
+ // this index coerces its key, so a non-string overall that stringifies onto a known one —
421
+ // `["live"]`, `Object("live")` — answered 0, "live", while `renderState` printed
422
+ // `UNREADABLE OVERALL ["live"]` for the same payload. That is a fail-open against this map's own
423
+ // stated rule (1 is the fallback "so a future status can never silently read as success"), and it
424
+ // is the surface an agent BRANCHES on, so it is worse here than in prose. Unreadable now answers
425
+ // 1 and the two surfaces agree on every payload. Nothing real moves: `job.ts` always supplies a
426
+ // string, so only shapes no in-repo producer emits change answer. A MISSING overall is unaffected
427
+ // — `undefined ?? ""` missed the map and already answered 1, agreeing with the header.
428
+ const overall = snap.state.overall;
429
+ if (typeof overall !== "string")
430
+ return 1;
431
+ return DEPLOY_EXIT_CODES[overall] ?? 1;
432
+ }
433
+ /** CLI entry point: print the snapshot rendering. */
434
+ export function renderDeploySnapshot(snap, now = Date.now()) {
435
+ for (const line of renderDeploySnapshotLines(snap, now))
436
+ console.log(line);
437
+ }
438
+ //# sourceMappingURL=deploy-render.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-render.js","sourceRoot":"","sources":["../../src/cli/deploy-render.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AA2E3C,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AACvF,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB;;;;;GAKG;AACH,MAAM,YAAY,GAAG,cAAc,CAAC;AACpC,MAAM,SAAS,GAAG,4CAA4C,CAAC;AAE/D;;;;;;;;;;;;;;;GAeG;AACH,SAAS,SAAS,CAAC,KAA0B,EAAE,KAAc;IAC3D,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,KAAK,CAAC;IAC5D,OAAO,KAAK,KAAK,SAAS,IAAI,KAA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