@senpi/runtime 3.0.59 → 3.0.63

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 (151) hide show
  1. package/README.md +73 -2
  2. package/dist/actions/decision-engine.d.ts +0 -2
  3. package/dist/actions/decision-engine.d.ts.map +1 -1
  4. package/dist/actions/decision-engine.js +1 -79
  5. package/dist/actions/decision-engine.js.map +1 -1
  6. package/dist/cli/deploy-render.d.ts +91 -0
  7. package/dist/cli/deploy-render.d.ts.map +1 -0
  8. package/dist/cli/deploy-render.js +216 -0
  9. package/dist/cli/deploy-render.js.map +1 -0
  10. package/dist/cli/guide-commands.d.ts.map +1 -1
  11. package/dist/cli/guide-commands.js +78 -6
  12. package/dist/cli/guide-commands.js.map +1 -1
  13. package/dist/cli/senpi-commands.d.ts +6 -1
  14. package/dist/cli/senpi-commands.d.ts.map +1 -1
  15. package/dist/cli/senpi-commands.js +244 -8
  16. package/dist/cli/senpi-commands.js.map +1 -1
  17. package/dist/cli/validate-command.d.ts.map +1 -1
  18. package/dist/cli/validate-command.js +32 -1
  19. package/dist/cli/validate-command.js.map +1 -1
  20. package/dist/deploy/deadlines.d.ts +47 -0
  21. package/dist/deploy/deadlines.d.ts.map +1 -0
  22. package/dist/deploy/deadlines.js +56 -0
  23. package/dist/deploy/deadlines.js.map +1 -0
  24. package/dist/deploy/error-text.d.ts +25 -0
  25. package/dist/deploy/error-text.d.ts.map +1 -0
  26. package/dist/deploy/error-text.js +42 -0
  27. package/dist/deploy/error-text.js.map +1 -0
  28. package/dist/deploy/funding.d.ts +87 -0
  29. package/dist/deploy/funding.d.ts.map +1 -0
  30. package/dist/deploy/funding.js +229 -0
  31. package/dist/deploy/funding.js.map +1 -0
  32. package/dist/deploy/install-gate-runner.d.ts +12 -0
  33. package/dist/deploy/install-gate-runner.d.ts.map +1 -0
  34. package/dist/deploy/install-gate-runner.js +17 -0
  35. package/dist/deploy/install-gate-runner.js.map +1 -0
  36. package/dist/deploy/job.d.ts +199 -0
  37. package/dist/deploy/job.d.ts.map +1 -0
  38. package/dist/deploy/job.js +463 -0
  39. package/dist/deploy/job.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 +305 -0
  45. package/dist/deploy/orchestrator.d.ts.map +1 -0
  46. package/dist/deploy/orchestrator.js +2910 -0
  47. package/dist/deploy/orchestrator.js.map +1 -0
  48. package/dist/deploy/package.d.ts +130 -0
  49. package/dist/deploy/package.d.ts.map +1 -0
  50. package/dist/deploy/package.js +351 -0
  51. package/dist/deploy/package.js.map +1 -0
  52. package/dist/deploy/proof-gate.d.ts +82 -0
  53. package/dist/deploy/proof-gate.d.ts.map +1 -0
  54. package/dist/deploy/proof-gate.js +269 -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 +59 -0
  63. package/dist/deploy/recheck-commands.js.map +1 -0
  64. package/dist/deploy/register.d.ts +99 -0
  65. package/dist/deploy/register.d.ts.map +1 -0
  66. package/dist/deploy/register.js +689 -0
  67. package/dist/deploy/register.js.map +1 -0
  68. package/dist/deploy/taxonomy.d.ts +24 -0
  69. package/dist/deploy/taxonomy.d.ts.map +1 -0
  70. package/dist/deploy/taxonomy.js +31 -0
  71. package/dist/deploy/taxonomy.js.map +1 -0
  72. package/dist/index.d.ts.map +1 -1
  73. package/dist/index.js +244 -132
  74. package/dist/index.js.map +1 -1
  75. package/dist/runtime/strategy-registry.d.ts +8 -0
  76. package/dist/runtime/strategy-registry.d.ts.map +1 -1
  77. package/dist/runtime/strategy-registry.js +14 -1
  78. package/dist/runtime/strategy-registry.js.map +1 -1
  79. package/dist/runtime-api/intake/intake-mount.d.ts.map +1 -1
  80. package/dist/runtime-api/intake/intake-mount.js +7 -4
  81. package/dist/runtime-api/intake/intake-mount.js.map +1 -1
  82. package/dist/scanners/implementations/market-regime.d.ts +1 -1
  83. package/dist/senpi/client.d.ts +58 -4
  84. package/dist/senpi/client.d.ts.map +1 -1
  85. package/dist/senpi/client.js +192 -15
  86. package/dist/senpi/client.js.map +1 -1
  87. package/dist/senpi/strategy-status.d.ts +32 -0
  88. package/dist/senpi/strategy-status.d.ts.map +1 -0
  89. package/dist/senpi/strategy-status.js +70 -0
  90. package/dist/senpi/strategy-status.js.map +1 -0
  91. package/dist/senpi/types.d.ts +47 -3
  92. package/dist/senpi/types.d.ts.map +1 -1
  93. package/dist/skills-manager/manifest.js +1 -1
  94. package/dist/skills-manager/skills-manifest.json +1 -1
  95. package/dist/telemetry/metrics.d.ts +23 -0
  96. package/dist/telemetry/metrics.d.ts.map +1 -1
  97. package/dist/telemetry/metrics.js +65 -0
  98. package/dist/telemetry/metrics.js.map +1 -1
  99. package/dist/types/strategy.d.ts +9 -1
  100. package/dist/types/strategy.d.ts.map +1 -1
  101. package/dist/universe/package-universe.d.ts +97 -0
  102. package/dist/universe/package-universe.d.ts.map +1 -0
  103. package/dist/universe/package-universe.js +275 -0
  104. package/dist/universe/package-universe.js.map +1 -0
  105. package/dist/validate/codes.d.ts +20 -0
  106. package/dist/validate/codes.d.ts.map +1 -1
  107. package/dist/validate/codes.js +36 -0
  108. package/dist/validate/codes.js.map +1 -1
  109. package/dist/validate/import-stage.js +5 -5
  110. package/dist/validate/import-stage.js.map +1 -1
  111. package/dist/validate/index.d.ts +1 -1
  112. package/dist/validate/index.d.ts.map +1 -1
  113. package/dist/validate/index.js.map +1 -1
  114. package/dist/validate/install-gate.d.ts.map +1 -1
  115. package/dist/validate/install-gate.js +10 -2
  116. package/dist/validate/install-gate.js.map +1 -1
  117. package/dist/validate/live-instruments.d.ts +44 -0
  118. package/dist/validate/live-instruments.d.ts.map +1 -0
  119. package/dist/validate/live-instruments.js +71 -0
  120. package/dist/validate/live-instruments.js.map +1 -0
  121. package/dist/validate/live-stage.js +5 -5
  122. package/dist/validate/live-stage.js.map +1 -1
  123. package/dist/validate/proof.d.ts +11 -1
  124. package/dist/validate/proof.d.ts.map +1 -1
  125. package/dist/validate/proof.js +7 -6
  126. package/dist/validate/proof.js.map +1 -1
  127. package/dist/validate/recipe-checks.d.ts.map +1 -1
  128. package/dist/validate/recipe-checks.js +6 -4
  129. package/dist/validate/recipe-checks.js.map +1 -1
  130. package/dist/validate/run.d.ts +5 -0
  131. package/dist/validate/run.d.ts.map +1 -1
  132. package/dist/validate/run.js +10 -1
  133. package/dist/validate/run.js.map +1 -1
  134. package/dist/validate/target.d.ts +41 -0
  135. package/dist/validate/target.d.ts.map +1 -1
  136. package/dist/validate/target.js +192 -16
  137. package/dist/validate/target.js.map +1 -1
  138. package/dist/validate/universe-stage.d.ts +71 -0
  139. package/dist/validate/universe-stage.d.ts.map +1 -0
  140. package/dist/validate/universe-stage.js +183 -0
  141. package/dist/validate/universe-stage.js.map +1 -0
  142. package/openclaw.plugin.json +1 -1
  143. package/package.json +1 -1
  144. package/dist/runtime/managed-wallet-guard.d.ts +0 -47
  145. package/dist/runtime/managed-wallet-guard.d.ts.map +0 -1
  146. package/dist/runtime/managed-wallet-guard.js +0 -106
  147. package/dist/runtime/managed-wallet-guard.js.map +0 -1
  148. package/dist/runtime/protection-nudge.d.ts +0 -67
  149. package/dist/runtime/protection-nudge.d.ts.map +0 -1
  150. package/dist/runtime/protection-nudge.js +0 -244
  151. package/dist/runtime/protection-nudge.js.map +0 -1
package/README.md CHANGED
@@ -165,9 +165,80 @@ 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. When the live instrument list **cannot be read**, the deploy
210
+ fails closed — the step reports the read failure with no refusal code and names no instrument dead,
211
+ because unknown is never "not live", and nothing is created either way.
212
+
213
+ **The budget is checked in two tiers, and only the first one refuses.** The **hard floor** is
214
+ $10/wallet (the platform minimum): a budget the accessible balance cannot fund at that floor halts
215
+ with `[E_FUNDS_BELOW_FLOOR]` and no wallet is created. The **soft tier** is the package's *calculated
216
+ minimum* — the smallest total at which every sleeve's smallest slot can still open, computed locally
217
+ from the package's own sizing (the same calculation `min_budget.py` bakes into the discovery card).
218
+ When a wallet this deploy funds is allocated less than its own sizing needs, it **deploys anyway**
219
+ and reports `[W_BUDGET_BELOW_STRATEGY_MIN]`, naming each short wallet and both its numbers: the
220
+ strategy runs degraded (fewer slots than authored), which is a choice, not a fault. When a sleeve
221
+ exposes no readable slot size the minimum is a lower bound and the report says so with
222
+ `[W_BUDGET_UNRESOLVED]` — plus the shortfall, if a wallet is short anyway. Both are warnings — they
223
+ never refuse, and they show up as `calculated minimum:` / `warn:` lines in `deploy status` and as
224
+ `minBudget`/`minWalletCount`/`belowMin`/`minBudgetNote`/`minBudgetUnresolved` in `--json`.
225
+ `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").
226
+
227
+ The shortfall is judged **per wallet**, against what `planFunding` actually allocates each one —
228
+ never whole-budget against whole-package minimum. Those differ as soon as a sleeve is adopted (the
229
+ budget is then split among fewer wallets), and comparing the totals reports shortfalls that do not
230
+ exist. `minBudget` rides the report as *context* — "deploying the whole package fresh needs $30
231
+ across 2 wallets" — not as the thing that was violated.
232
+
233
+ Running the authored design after a below-minimum deploy means **starting over**, not re-running at
234
+ a bigger number: deploy never adds funds to a wallet that already exists, so a re-run would simply
235
+ adopt the one just created. The warn names the exact sequence, **scoped to the short sleeves**
236
+ (`close.py <id> --instance <name>`, which returns their funds) so adopted live wallets beside them
237
+ are left alone — and it is omitted entirely when the deploy created no wallet at all.
238
+
168
239
  **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
240
+ - `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.
241
+ - `--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
242
  - `openclaw senpi runtime list` — list installed runtimes
172
243
  - `openclaw senpi runtime delete <runtime_id>` — remove by id
173
244
 
@@ -23,8 +23,6 @@ export declare class LlmDecisionStrategy implements DecisionStrategy {
23
23
  }
24
24
  export declare class RuleDecisionStrategy implements DecisionStrategy {
25
25
  readonly mode: DecisionMode;
26
- private warnedMissingReason;
27
- private resolveReason;
28
26
  decide(request: DecisionRequest): Promise<ActionDecision>;
29
27
  }
30
28
  export declare class NoDecisionStrategy implements DecisionStrategy {
@@ -1 +1 @@
1
- {"version":3,"file":"decision-engine.d.ts","sourceRoot":"","sources":["../../src/actions/decision-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,UAAU,EACV,YAAY,EACZ,SAAS,EACT,WAAW,EAGZ,MAAM,YAAY,CAAC;AA2EpB,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,UAAU,CAAC;IACvB,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC3D;AAID,qBAAa,cAAc;IACzB,OAAO,CAAC,UAAU,CAA6C;IAE/D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,IAAI;IAIpC,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CAOpF;AAID,qBAAa,mBAAoB,YAAW,gBAAgB;IAG9C,OAAO,CAAC,WAAW;IAF/B,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAS;gBAEhB,WAAW,EAAE,WAAW;IAEtC,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;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AAS;gBAEhB,WAAW,EAAE,WAAW;IAEtC,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CAoDhE;AAID,qBAAa,oBAAqB,YAAW,gBAAgB;IAC3D,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAU;IAE/B,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CA0ChE;AAID,qBAAa,kBAAmB,YAAW,gBAAgB;IACzD,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAU;IAE/B,MAAM,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CAShE"}
@@ -1,68 +1,4 @@
1
1
  import { withSpan } from '../telemetry/tracing.js';
2
- import { createLogger } from '../utils/logger.js';
3
- const logger = createLogger('[actions][decision-engine]');
4
- // The resolved per-signal reason lands on a user-facing card via
5
- // createPosition({ reason }); nothing downstream bounds its length.
6
- const MAX_REASON_LENGTH = 300;
7
- const REASON_ELLIPSIS = '…';
8
- function hardCutReason(text) {
9
- let cut = text.slice(0, MAX_REASON_LENGTH - REASON_ELLIPSIS.length);
10
- // Never end on a lone high surrogate (a split emoji renders as junk).
11
- const last = cut.charCodeAt(cut.length - 1);
12
- if (last >= 0xd800 && last <= 0xdbff) {
13
- cut = cut.slice(0, -1);
14
- }
15
- return cut + REASON_ELLIPSIS;
16
- }
17
- function capReason(text) {
18
- return text.length <= MAX_REASON_LENGTH ? text : hardCutReason(text);
19
- }
20
- /**
21
- * Joins factor tokens keeping a greedy in-order prefix of whole tokens within
22
- * the cap — dropping trailing tokens beats cutting one mid-way.
23
- */
24
- function joinReasonTokens(tokens) {
25
- let out = '';
26
- for (const token of tokens) {
27
- const candidate = out ? `${out}, ${token}` : token;
28
- if (candidate.length + REASON_ELLIPSIS.length > MAX_REASON_LENGTH) {
29
- return out ? out + REASON_ELLIPSIS : hardCutReason(token);
30
- }
31
- out = candidate;
32
- }
33
- return out;
34
- }
35
- /**
36
- * Resolves the human-readable trade rationale from signal metadata, or
37
- * undefined when nothing usable was sent.
38
- *
39
- * `reason` (singular, non-empty string) is the internal single-reason contract
40
- * (e.g. liquidation-watchdog) and wins; anything else falls through to
41
- * `reasons` — the external producers' contract: an array of factor tokens
42
- * whose members are untrusted (the wire schema only checks Array.isArray), so
43
- * only non-empty trimmed strings are kept. A bare non-empty string under
44
- * `reasons` is accepted too.
45
- */
46
- function resolveSignalReason(meta) {
47
- const single = meta?.reason;
48
- if (typeof single === 'string' && single.trim().length > 0) {
49
- return capReason(single.trim());
50
- }
51
- const many = meta?.reasons;
52
- if (typeof many === 'string' && many.trim().length > 0) {
53
- return capReason(many.trim());
54
- }
55
- if (Array.isArray(many)) {
56
- const tokens = many
57
- .filter((member) => typeof member === 'string')
58
- .map((member) => member.trim())
59
- .filter((member) => member.length > 0);
60
- if (tokens.length > 0) {
61
- return joinReasonTokens(tokens);
62
- }
63
- }
64
- return undefined;
65
- }
66
2
  // ─── Decision Engine ────────────────────────────────────────────────────────
67
3
  export class DecisionEngine {
68
4
  strategies = new Map();
@@ -133,20 +69,6 @@ export class LlmDecisionStrategy {
133
69
  // ─── Rule Decision Strategy ─────────────────────────────────────────────────
134
70
  export class RuleDecisionStrategy {
135
71
  mode = 'rule';
136
- // One WARN per signalType: this sits in the per-signal decision path and
137
- // would otherwise fire on every tick of a reason-less producer.
138
- warnedMissingReason = new Set();
139
- resolveReason(signal) {
140
- const resolved = resolveSignalReason(signal.meta);
141
- if (resolved !== undefined) {
142
- return resolved;
143
- }
144
- if (!this.warnedMissingReason.has(signal.signalType)) {
145
- this.warnedMissingReason.add(signal.signalType);
146
- logger.warn('signal carried no usable meta.reason/meta.reasons; user-facing rationale degrades to the signal type', undefined, { signalType: signal.signalType, scannerId: signal.scannerId, asset: signal.asset });
147
- }
148
- return signal.signalType;
149
- }
150
72
  async decide(request) {
151
73
  const scanResult = request.event?.data?.scanResult;
152
74
  const signals = (scanResult?.signals ?? []).filter((s) => s.asset && s.asset.length > 0);
@@ -174,7 +96,7 @@ export class RuleDecisionStrategy {
174
96
  direction: s.direction,
175
97
  score: s.score,
176
98
  signalType: s.signalType,
177
- reason: this.resolveReason(s),
99
+ reason: s.meta?.reason ?? s.signalType,
178
100
  dex: s.meta?.dex,
179
101
  // Canonical per-signal sizing/leverage flow to the open action.
180
102
  ...(s.marginPct != null ? { marginPct: s.marginPct } : {}),
@@ -1 +1 @@
1
- {"version":3,"file":"decision-engine.js","sourceRoot":"","sources":["../../src/actions/decision-engine.ts"],"names":[],"mappings":"AASA,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,MAAM,GAAG,YAAY,CAAC,4BAA4B,CAAC,CAAC;AAE1D,iEAAiE;AACjE,oEAAoE;AACpE,MAAM,iBAAiB,GAAG,GAAG,CAAC;AAC9B,MAAM,eAAe,GAAG,GAAG,CAAC;AAE5B,SAAS,aAAa,CAAC,IAAY;IACjC,IAAI,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACpE,sEAAsE;IACtE,MAAM,IAAI,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC5C,IAAI,IAAI,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,EAAE,CAAC;QACrC,GAAG,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACzB,CAAC;IACD,OAAO,GAAG,GAAG,eAAe,CAAC;AAC/B,CAAC;AAED,SAAS,SAAS,CAAC,IAAY;IAC7B,OAAO,IAAI,CAAC,MAAM,IAAI,iBAAiB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;AACvE,CAAC;AAED;;;GAGG;AACH,SAAS,g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,SAAS,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC1D,GAAG,CAAC,CAAC,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;oBACvD,IAAI,EAAE,CAAC,CAAC,IAAI;iBACb,CAAC,CAAC;aACJ;SACF,CAAC;IACJ,CAAC;CACF;AAED,+EAA+E;AAE/E,MAAM,OAAO,kBAAkB;IACpB,IAAI,GAAiB,MAAM,CAAC;IAErC,KAAK,CAAC,MAAM,CAAC,OAAwB;QACnC,OAAO;YACL,OAAO,EAAE,KAAK;YACd,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,EAAE;YACd,SAAS,EAAE,sBAAsB;YACjC,OAAO,EAAE,EAAE;SACZ,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,91 @@
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
+ }
80
+ export declare function renderHeader(snap: DeploySnapshotLike, now: number): string;
81
+ export declare function renderStepTable(report: DeployReportLike): string[];
82
+ export declare function renderEventsTail(events: DeployEventLike[]): string[];
83
+ export declare function renderReportFooter(report: DeployReportLike): string[];
84
+ /** Fresh-read layer, printed beside (never instead of) the journal narration. */
85
+ export declare function renderLiveLayer(live: DeployLiveLayerLike): string[];
86
+ export declare function renderDeploySnapshotLines(snap: DeploySnapshotLike, now?: number): string[];
87
+ /** The ONE place the D-12 map lives; the status action calls it. */
88
+ export declare function exitCodeForDeploy(snap: DeploySnapshotLike): number;
89
+ /** CLI entry point: print the snapshot rendering. */
90
+ export declare function renderDeploySnapshot(snap: DeploySnapshotLike, now?: number): void;
91
+ //# sourceMappingURL=deploy-render.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deploy-render.d.ts","sourceRoot":"","sources":["../../src/cli/de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ED,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,EAAE,GAAG,MAAM,EAAE,CAGpE;AA8CD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAYrE;AAED,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,IAAI,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAenE;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,GAAE,MAAmB,GAAG,MAAM,EAAE,CAetG;AAmBD,oEAAoE;AACpE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,kBAAkB,GAAG,MAAM,CAQlE;AAED,qDAAqD;AACrD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,kBAAkB,EAAE,GAAG,GAAE,MAAmB,GAAG,IAAI,CAE7F"}
@@ -0,0 +1,216 @@
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
+ /** Human phrase for a job state — running phases stay in-progress, never triumphant. */
19
+ function renderState(state) {
20
+ switch (state.status) {
21
+ case "running":
22
+ return state.stopRequested
23
+ ? `running (phase: ${state.phase}; deploy deadline reached — stopping at the next step boundary)`
24
+ : `running (phase: ${state.phase})`;
25
+ case "done":
26
+ return `done — ${state.overall}`;
27
+ case "interrupted":
28
+ return "interrupted by a gateway restart (no deploy is running now)";
29
+ }
30
+ }
31
+ function elapsedSeconds(startedAt, now) {
32
+ const started = Date.parse(startedAt);
33
+ if (Number.isNaN(started))
34
+ return null;
35
+ return Math.max(0, Math.round((now - started) / 1000));
36
+ }
37
+ export function renderHeader(snap, now) {
38
+ const elapsed = elapsedSeconds(snap.meta.startedAt, now);
39
+ const elapsedPart = elapsed === null ? "" : `, elapsed ${elapsed}s`;
40
+ return (`deploy ${snap.meta.deployId} — ${renderState(snap.state)} — package ` +
41
+ `${snap.meta.packageId} v${snap.meta.version}${elapsedPart}`);
42
+ }
43
+ /** `k=v` pairs straight from the evidence object — no rounding, no currency formatting. */
44
+ function renderEvidence(evidence) {
45
+ return Object.entries(evidence)
46
+ .map(([key, value]) => `${key}=${typeof value === "string" ? value : JSON.stringify(value)}`)
47
+ .join(" ");
48
+ }
49
+ export function renderStepTable(report) {
50
+ const lines = [];
51
+ for (const instance of report.instances) {
52
+ // A rolled-back wallet is closed and its funds are back with the owner — rendering it as
53
+ // `funded N` here would be the same fail-open as calling an unobserved tick `live`. An
54
+ // INCOMPLETE rollback deliberately keeps the funded figure: there the money really is stranded.
55
+ const facts = [
56
+ instance.wallet ? `wallet ${instance.wallet}` : null,
57
+ instance.strategyId ? `strategyId ${instance.strategyId}` : null,
58
+ instance.rolledBack
59
+ ? "ROLLED BACK — strategy closed, funds returned"
60
+ : instance.funded !== undefined
61
+ ? `funded ${instance.funded}`
62
+ : null,
63
+ // A runtime id survives a FAILED install (a blind runtime records its id as a fact), and the
64
+ // facts line is the skim line agents quote. Bare, it relays as "the runtime is installed" —
65
+ // the exact opposite of what the install step two lines below says.
66
+ instance.runtimeId
67
+ ? instance.steps.install?.status === "failed"
68
+ ? `runtime ${instance.runtimeId} (install FAILED — not watching this wallet)`
69
+ : `runtime ${instance.runtimeId}`
70
+ : null,
71
+ ].filter((fact) => fact !== null);
72
+ lines.push(` instance ${instance.instance}${facts.length > 0 ? ` — ${facts.join(", ")}` : ""}`);
73
+ for (const step of STEP_ORDER) {
74
+ const outcome = instance.steps[step];
75
+ if (!outcome)
76
+ continue;
77
+ lines.push(` ${step.padEnd(9)} ${outcome.status.padEnd(11)} ${outcome.detail}`);
78
+ if (outcome.evidence && Object.keys(outcome.evidence).length > 0) {
79
+ lines.push(` evidence: ${renderEvidence(outcome.evidence)}`);
80
+ }
81
+ }
82
+ }
83
+ return lines;
84
+ }
85
+ export function renderEventsTail(events) {
86
+ if (events.length === 0)
87
+ return [];
88
+ return [" recent events:", ...events.slice(-EVENT_TAIL).map((event) => ` ${event.ts} ${event.detail}`)];
89
+ }
90
+ /**
91
+ * The SOFT calculated-minimum tier, rendered beside the overall — never folded INTO it.
92
+ *
93
+ * A deploy that ran below the package's calculated minimum is still `live`: the minimum is a local
94
+ * estimate over the package's own YAML, not a platform rule, and the deploy proceeded. So the
95
+ * figure prints as its own fact and the note prints under an explicit `warn:` label, which is what
96
+ * keeps a reader (agent or human) from reading its `[E_…]` code as a refusal.
97
+ *
98
+ * The figure renders through the same `usd()` every note in the deploy module uses. It is NOT in
99
+ * the "quote it exactly as carried" class that `funded` and the scanner fields are in: those are
100
+ * backend-quoted facts that must never be re-derived, whereas this one is computed locally two
101
+ * modules away. `SKILL.md` tells the agent to quote the report's numbers verbatim, so a bare `125`
102
+ * is what would reach the user.
103
+ *
104
+ * The two qualifiers COMPOSE rather than compete. `belowMin` and an unresolved sleeve can hold at
105
+ * once, and this line is what a skimming reader takes away, so dropping either half would
106
+ * understate the situation.
107
+ *
108
+ * `belowMin` renders as a statement about a WALLET, never about the budget versus this total. The
109
+ * two are different claims — a partially-adopted deploy splits the budget among fewer wallets — and
110
+ * "the requested budget is BELOW it" is not merely weaker but false where they diverge: a declared
111
+ * `funding_share: 0` sleeve is floored at MIN_WALLET at every budget, so `belowMin` holds while the
112
+ * budget may be far above the total.
113
+ */
114
+ function renderSoftBudgetTier(report) {
115
+ const lines = [];
116
+ if (report.minBudget !== undefined) {
117
+ const unresolved = report.minBudgetUnresolved ?? [];
118
+ const parts = [];
119
+ if (unresolved.length > 0)
120
+ parts.push(`UNRESOLVED for ${unresolved.join(", ")}`);
121
+ if (report.belowMin) {
122
+ parts.push(`${unresolved.length > 0 ? "and " : ""}a wallet in this deploy is sized below its own minimum`);
123
+ }
124
+ const qualifier = parts.length > 0 ? ` — ${parts.join(", ")}` : "";
125
+ lines.push(` calculated minimum: ${usd(report.minBudget)} across ${report.minWalletCount} wallet(s)${qualifier}`);
126
+ }
127
+ if (report.minBudgetNote)
128
+ lines.push(` warn: ${report.minBudgetNote}`);
129
+ return lines;
130
+ }
131
+ export function renderReportFooter(report) {
132
+ const lines = [` overall: ${report.overall}`, ...renderSoftBudgetTier(report)];
133
+ // A SECOND warn line, never merged with the soft tier's: that one is a claim about the funding
134
+ // plan against the package's own sizing, this one is a claim about what the backend actually
135
+ // landed, and a report can truthfully carry both. Same `warn:` label for the same reason — it is
136
+ // what stops a reader taking a bracketed code on a `live` deploy for a refusal.
137
+ if (report.partialFundNote)
138
+ lines.push(` warn: ${report.partialFundNote}`);
139
+ // Mutually exclusive with the line above per wallet, but not per report: a two-sleeve package
140
+ // can land one short wallet and one unreadable read, and each wallet gets the note that fits it.
141
+ if (report.fundedUnreadableNote)
142
+ lines.push(` warn: ${report.fundedUnreadableNote}`);
143
+ if (report.next)
144
+ lines.push(` next: ${report.next}`);
145
+ return lines;
146
+ }
147
+ /** Fresh-read layer, printed beside (never instead of) the journal narration. */
148
+ export function renderLiveLayer(live) {
149
+ if (live.unavailable)
150
+ return [` live (fresh read): unavailable — ${live.unavailable}`];
151
+ const lines = [" live (fresh read):"];
152
+ if (live.strategies.length === 0)
153
+ lines.push(" strategies: none matching this package");
154
+ for (const strategy of live.strategies) {
155
+ lines.push(` strategy ${strategy.strategyName}: status ${strategy.status}, ` +
156
+ `wallet ${strategy.strategyWalletAddress}, totalFunded ${strategy.totalFunded ?? "unreadable"}`);
157
+ }
158
+ if (live.runtimes.length === 0)
159
+ lines.push(" runtimes: none registered for this package");
160
+ for (const runtime of live.runtimes) {
161
+ lines.push(` runtime ${runtime.id}: wallet ${runtime.wallet ?? "(none)"}`);
162
+ }
163
+ return lines;
164
+ }
165
+ export function renderDeploySnapshotLines(snap, now = Date.now()) {
166
+ const lines = [renderHeader(snap, now)];
167
+ const interrupted = snap.state.status === "interrupted";
168
+ if (snap.report)
169
+ lines.push(...renderStepTable(snap.report));
170
+ const events = snap.events ?? [];
171
+ if (events.length > 0) {
172
+ lines.push(...(interrupted ? [" history (journal):"] : []), ...renderEventsTail(events));
173
+ }
174
+ if (snap.live)
175
+ lines.push(...renderLiveLayer(snap.live));
176
+ if (snap.report)
177
+ lines.push(...renderReportFooter(snap.report));
178
+ if (snap.next)
179
+ lines.push(` next: ${snap.next}`);
180
+ return lines;
181
+ }
182
+ /**
183
+ * D-12 exit-code contract for `senpi deploy status`. 1 is reserved for transport/internal
184
+ * errors (node/commander default) and is also the unknown-status fallback so a future status
185
+ * can never silently read as success. Anything richer than the overall status: use --json.
186
+ */
187
+ const DEPLOY_EXIT_CODES = {
188
+ live: 0,
189
+ refused: 2,
190
+ failed: 3,
191
+ "installed-unobserved": 4,
192
+ interrupted: 5,
193
+ // A report whose overall is `pending` (a wallet was still funding when the poll budget ran out)
194
+ // is the same answer as a job still in flight: not finished, re-run to resume. It shares code 6
195
+ // rather than falling to 1, which would call a normal resumable outcome an internal error.
196
+ pending: 6,
197
+ };
198
+ /** The ONE place the D-12 map lives; the status action calls it. */
199
+ export function exitCodeForDeploy(snap) {
200
+ // A snapshot with no state is a broken gateway contract, not a running job — 1, not 6.
201
+ if (!snap?.state?.status)
202
+ return 1;
203
+ // `interrupted` is a terminal STATE, not an overall — a gateway restart killed the job. It is
204
+ // not pending: nothing is running, so it must never exit 6.
205
+ if (snap.state.status === "interrupted")
206
+ return DEPLOY_EXIT_CODES.interrupted;
207
+ if (snap.state.status !== "done")
208
+ return 6; // pending — job still running
209
+ return DEPLOY_EXIT_CODES[snap.state.overall ?? ""] ?? 1;
210
+ }
211
+ /** CLI entry point: print the snapshot rendering. */
212
+ export function renderDeploySnapshot(snap, now = Date.now()) {
213
+ for (const line of renderDeploySnapshotLines(snap, now))
214
+ console.log(line);
215
+ }
216
+ //# 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;AAyE3C,MAAM,UAAU,GAAG,CAAC,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AACvF,MAAM,UAAU,GAAG,CAAC,CAAC;AAErB,wFAAwF;AACxF,SAAS,WAAW,CAAC,KAAkC;IACrD,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;QACrB,KAAK,SAAS;YACZ,OAAO,KAAK,CAAC,aAAa;gBACxB,CAAC,CAAC,mBAAmB,KAAK,CAAC,KAAK,iEAAiE;gBACjG,CAAC,CAAC,mBAAmB,KAAK,CAAC,KAAK,GAAG,CAAC;QACxC,KAAK,MAAM;YACT,OAAO,UAAU,KAAK,CAAC,OAAO,EAAE,CAAC;QACnC,KAAK,aAAa;YAChB,OAAO,6DAA6D,CAAC;IACzE,CAAC;AACH,CAAC;AAED,SAAS,cAAc,CAAC,SAAiB,EAAE,GAAW;IACpD,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACtC,IAAI,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,GAAG,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,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