@senpi-ai/runtime 3.0.77 → 3.0.80

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 (167) 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.d.ts.map +1 -1
  104. package/dist/skills-manager/manifest.js +4 -3
  105. package/dist/skills-manager/manifest.js.map +1 -1
  106. package/dist/skills-manager/skills-manifest.json +4 -3
  107. package/dist/telemetry/metrics.d.ts +30 -0
  108. package/dist/telemetry/metrics.d.ts.map +1 -1
  109. package/dist/telemetry/metrics.js +72 -0
  110. package/dist/telemetry/metrics.js.map +1 -1
  111. package/dist/types/strategy.d.ts +9 -1
  112. package/dist/types/strategy.d.ts.map +1 -1
  113. package/dist/universe/package-universe.d.ts +97 -0
  114. package/dist/universe/package-universe.d.ts.map +1 -0
  115. package/dist/universe/package-universe.js +304 -0
  116. package/dist/universe/package-universe.js.map +1 -0
  117. package/dist/validate/codes.d.ts +30 -0
  118. package/dist/validate/codes.d.ts.map +1 -1
  119. package/dist/validate/codes.js +74 -1
  120. package/dist/validate/codes.js.map +1 -1
  121. package/dist/validate/index.d.ts +1 -1
  122. package/dist/validate/index.d.ts.map +1 -1
  123. package/dist/validate/index.js.map +1 -1
  124. package/dist/validate/install-gate.d.ts.map +1 -1
  125. package/dist/validate/install-gate.js +10 -2
  126. package/dist/validate/install-gate.js.map +1 -1
  127. package/dist/validate/live-instruments.d.ts +44 -0
  128. package/dist/validate/live-instruments.d.ts.map +1 -0
  129. package/dist/validate/live-instruments.js +71 -0
  130. package/dist/validate/live-instruments.js.map +1 -0
  131. package/dist/validate/live-stage.d.ts +8 -0
  132. package/dist/validate/live-stage.d.ts.map +1 -1
  133. package/dist/validate/live-stage.js +87 -18
  134. package/dist/validate/live-stage.js.map +1 -1
  135. package/dist/validate/package-gates-stage.d.ts +61 -0
  136. package/dist/validate/package-gates-stage.d.ts.map +1 -0
  137. package/dist/validate/package-gates-stage.js +215 -0
  138. package/dist/validate/package-gates-stage.js.map +1 -0
  139. package/dist/validate/proof.d.ts +11 -1
  140. package/dist/validate/proof.d.ts.map +1 -1
  141. package/dist/validate/proof.js +10 -6
  142. package/dist/validate/proof.js.map +1 -1
  143. package/dist/validate/recipe-checks.d.ts.map +1 -1
  144. package/dist/validate/recipe-checks.js +6 -4
  145. package/dist/validate/recipe-checks.js.map +1 -1
  146. package/dist/validate/run.d.ts +29 -1
  147. package/dist/validate/run.d.ts.map +1 -1
  148. package/dist/validate/run.js +65 -6
  149. package/dist/validate/run.js.map +1 -1
  150. package/dist/validate/target.d.ts +41 -0
  151. package/dist/validate/target.d.ts.map +1 -1
  152. package/dist/validate/target.js +192 -16
  153. package/dist/validate/target.js.map +1 -1
  154. package/dist/validate/taxonomy-finding.d.ts +22 -0
  155. package/dist/validate/taxonomy-finding.d.ts.map +1 -0
  156. package/dist/validate/taxonomy-finding.js +25 -0
  157. package/dist/validate/taxonomy-finding.js.map +1 -0
  158. package/dist/validate/universe-stage.d.ts +71 -0
  159. package/dist/validate/universe-stage.d.ts.map +1 -0
  160. package/dist/validate/universe-stage.js +165 -0
  161. package/dist/validate/universe-stage.js.map +1 -0
  162. package/dist/validate/wallet-binding-stage.d.ts +44 -0
  163. package/dist/validate/wallet-binding-stage.d.ts.map +1 -0
  164. package/dist/validate/wallet-binding-stage.js +92 -0
  165. package/dist/validate/wallet-binding-stage.js.map +1 -0
  166. package/openclaw.plugin.json +1 -1
  167. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-gate.d.ts","sourceRoot":"","sources":["../../src/deploy/proof-gate.ts"],"names":[],"mappings":"AA6BA,OAAO,EAA8B,KAAK,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAExG,OAAO,EAAmB,KAAK,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAC;AAGxF,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,aAAa,GAAG,YAAY,CAGlE;AAED,mFAAmF;AACnF,MAAM,WAAW,oBAAoB;IACnC,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,aAAa,GAAG,oBAAoB,EAAE,CAQhF;AA6BD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gCAAgC,CAC9C,UAAU,EAAE,oBAAoB,EAAE,EAClC,GAAG,EAAE,aAAa,GACjB,MAAM,CAqCR;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,YAAY,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;CACb;AAgED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,iBAAiB,CAwD7F;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAalF"}
@@ -0,0 +1,278 @@
1
+ /**
2
+ * Deploy's half of the proof contract.
3
+ *
4
+ * `verifyProof` owns the fact; this module owns turning it into a refusal deploy can render.
5
+ * The instances argument is the whole reason this file exists: VerifyOptions.instances is
6
+ * documented as directory names relative to the package root and consumed as
7
+ * `join(packageRoot, instance)`, while a DeployInstance carries a MANIFEST name. Passing the
8
+ * name verifies a directory that may not exist and reports `no_proof` for a proven package.
9
+ *
10
+ * ## What a proof actually attests, and what it does not
11
+ *
12
+ * A proof records that a full, unscoped `senpi validate` at live depth PASSED over exactly these
13
+ * bytes under exactly this runtime. It does NOT assert that every check that depth offers actually
14
+ * produced a verdict: the live-instrument check warns (`W_VALIDATE_UNIVERSE_UNAVAILABLE`) when the
15
+ * exchange list cannot be read, the verdict stays `PASS`, and `PASS` at live depth is what makes a
16
+ * run proof-eligible (`validate/run.ts`). So a proof can attest a run in which the universe check
17
+ * never ran.
18
+ *
19
+ * That is not a money leak, and it is deliberately not repaired here: `runDeploy` re-checks the
20
+ * universe itself, pre-money, from a live read on every deploy (`universe/package-universe.ts`), so
21
+ * no dead instrument reaches funding either way. What it means for THIS module is a rule about
22
+ * language: the refusals below say what a proof is a claim about — "this content ran under this
23
+ * runtime" — and never that the package was "fully validated" or "everything was checked". Recording
24
+ * the skipped checks INTO the proof was considered and rejected: deploy would then be enforcing on a
25
+ * stale record of an ops fault (an unreachable MCP server), refusing packages whose instruments it
26
+ * had just read as live, and routing an environment problem to the author.
27
+ */
28
+ import { isAbsolute, join, relative } from "node:path";
29
+ import { parse as parseYaml } from "yaml";
30
+ import { verifyProof, VALIDATE_CODE } from "../validate/index.js";
31
+ import { VERSION } from "../version.js";
32
+ import { readRuntimeYaml } from "./package.js";
33
+ import { validateCommand } from "./recheck-commands.js";
34
+ export function checkPackageProof(pkg) {
35
+ const instances = pkg.instances.map((inst) => relative(pkg.dir, inst.runtimeYamlDir));
36
+ return verifyProof(pkg.dir, { instances });
37
+ }
38
+ /**
39
+ * The one package shape a proof cannot answer for, which therefore has to be refused rather than
40
+ * verified.
41
+ *
42
+ * A proof is one file per DIRECTORY — `writeProof` writes `dirname(recipePath)/.senpi-proof.json` —
43
+ * and it records the recipe it was made for, which `verifyProofInner` re-fingerprints. Nothing in
44
+ * `loadDeployPackage` requires instances to live in different directories: a manifest naming
45
+ * `aggressive.yaml` and `calm.yaml` at the package root is legal and gives both instances the same
46
+ * `runtimeYamlDir`. Verifying that package asks the same directory twice and gets the same answer
47
+ * twice, so a proof recorded for ONE recipe passes the other — a recipe nobody watched run reaches
48
+ * funding, which is the precise harm this gate exists to prevent.
49
+ *
50
+ * Fixing it inside `verifyProof` would mean teaching the proof format about instances; the deploy
51
+ * layer is the one that HAS the manifest and can see the collision, so it refuses here. Fail-closed
52
+ * on principle and free in practice: of the 103 packages in the shipped catalog, 21 are
53
+ * multi-instance and none shares a runtime directory.
54
+ *
55
+ * `senpi validate` calls this too, at static depth (`E_VALIDATE_INSTANCE_DIR_COLLISION`), scoped to
56
+ * the collision the validated recipe is IN — reporting a sibling pair the run never looked at would
57
+ * send an author to edit files outside the target.
58
+ */
59
+ export function collidingInstanceDirs(pkg) {
60
+ const byDir = new Map();
61
+ for (const inst of pkg.instances) {
62
+ byDir.set(inst.runtimeYamlDir, [...(byDir.get(inst.runtimeYamlDir) ?? []), inst]);
63
+ }
64
+ return [...byDir.entries()]
65
+ .filter(([, instances]) => instances.length > 1)
66
+ .map(([dir, instances]) => ({ dir, instances }));
67
+ }
68
+ /**
69
+ * The relative `scanners[].path` values in one instance's recipe — the things that silently
70
+ * re-point if the recipe moves without them.
71
+ *
72
+ * `runtimeYamlDir` is documented as "the base relative scanner paths resolve against"
73
+ * (`package.ts`), so a recipe moved into a new directory takes every relative path with it and
74
+ * lands them somewhere that does not exist. Never throws: this feeds a refusal, and a gate that
75
+ * can fail to render is a gate that sometimes does nothing. (`runDeploy` has already parsed these
76
+ * same files twice by the time it gets here, so a parse error is not reachable on that path.)
77
+ */
78
+ function relativeScannerPaths(inst) {
79
+ try {
80
+ const parsed = parseYaml(readRuntimeYaml(inst));
81
+ const scanners = Array.isArray(parsed?.scanners) ? parsed.scanners : [];
82
+ const paths = scanners
83
+ .map((scanner) => scanner !== null && typeof scanner === "object"
84
+ ? scanner.path
85
+ : undefined)
86
+ .filter((path) => typeof path === "string" && path.length > 0 && !isAbsolute(path));
87
+ return [...new Set(paths)];
88
+ }
89
+ catch {
90
+ return [];
91
+ }
92
+ }
93
+ /**
94
+ * The collision as an instruction — deliberately an END STATE, not a command.
95
+ *
96
+ * The obvious rendering ("mv the recipe into its own directory") produces a package that does not
97
+ * validate: a relative `path:` resolves against the recipe's own directory, so moving the recipe
98
+ * alone re-points `./scanners` at a directory that does not exist and the very next validation
99
+ * fails on an unresolvable scanner path. Nor can the right move be computed here — two recipes that
100
+ * share a directory may well be sharing what is in it, and whether the tree moves, is copied, or is
101
+ * referenced from both is a decision about this package that this gate does not have the standing
102
+ * to make. So it names what will break (computed from each recipe, not templated), describes the
103
+ * state to reach, and emits no command whose preconditions it cannot check — the same rule
104
+ * `buildBudgetEscape` follows when a report cannot support a teardown.
105
+ *
106
+ * It also emits no post-move `senpi validate` path. Those directories do not exist yet, and a
107
+ * non-colliding sleeve's directory is not its manifest name — the exact trap this module exists to
108
+ * prevent, which is easy to walk back into while writing helpful-looking text. Re-running the
109
+ * deploy is the loop: it names any instance still unproven and carries the exact command for it.
110
+ */
111
+ export function buildInstanceDirCollisionRefusal(collisions, pkg) {
112
+ const relatives = new Set();
113
+ const groups = collisions.map((collision) => {
114
+ const rows = collision.instances.map((inst) => {
115
+ const paths = relativeScannerPaths(inst);
116
+ paths.forEach((path) => relatives.add(path));
117
+ const carries = paths.length > 0 ? ` — relative paths inside it: ${paths.join(", ")}` : "";
118
+ return ` "${inst.name}" → ${inst.runtimeYamlPath}${carries}`;
119
+ });
120
+ return ` - ${collision.dir} is shared by:\n${rows.join("\n")}`;
121
+ });
122
+ const movingCaveat = relatives.size > 0
123
+ ? `Moving a recipe is not enough on its own: a relative path in it (${[...relatives].join(", ")} ` +
124
+ `above) resolves against the directory the RECIPE is in, so a recipe that moves alone points ` +
125
+ `every one of them at a directory that does not exist, and the next validation fails on an ` +
126
+ `unresolvable scanner path. Whether the tree it names moves with the recipe, is copied, or is ` +
127
+ `referenced from both is a decision about this package — these sleeves share a directory ` +
128
+ `today, so they may be sharing what is in it. `
129
+ : "";
130
+ return (`[INVALID_REQUEST] ${collisions.length} directory(ies) in this package hold more than one ` +
131
+ `instance's recipe, and no proof can speak for either of them:\n${groups.join("\n")}\n\n` +
132
+ `Why: a proof lives BESIDE the recipe it is a claim about — one \`.senpi-proof.json\` per ` +
133
+ `directory, naming the one recipe it was recorded for. Two recipes in one directory therefore ` +
134
+ `share a single proof file, and whichever validation ran last is the only one it describes. ` +
135
+ `Deploy will not read that as evidence for both: it would fund and install a recipe nobody has ` +
136
+ `ever watched run, which is the one thing this gate exists to prevent.\n\n` +
137
+ `Nothing was created by this run — this gate reads the package's own files and nothing else, so ` +
138
+ `it stopped before any live read. Whatever this package already had is untouched, and this gate ` +
139
+ `cannot see it.\n\n` +
140
+ `Fix — each instance above needs its OWN directory, holding its recipe, with its \`runtime:\` in ` +
141
+ `${join(pkg.dir, "strategy.yaml")} updated to point there. ${movingCaveat}` +
142
+ `Once each one has its own directory and every relative path in its recipe still resolves from ` +
143
+ `there, re-run the deploy: it names any instance that is still unproven and carries the exact ` +
144
+ `\`openclaw senpi validate\` command for it.`);
145
+ }
146
+ /** How many changed files a single sentence names before it starts counting instead. */
147
+ const MAX_NAMED_FILES = 5;
148
+ /**
149
+ * The command that produces a proof, one per directory — from the shared producer, so the quoting
150
+ * these strings need (they are copied into a shell verbatim, and a real workspace path has spaces)
151
+ * is decided in one place for every surface that emits it.
152
+ *
153
+ * No python route here, deliberately: this gate is ABOUT the proof, and the skills validator does
154
+ * not write one. Naming it would be naming a command that cannot answer the refusal.
155
+ */
156
+ function validateCommands(dirs) {
157
+ return dirs.map((dir) => ` ${validateCommand(dir)}`).join("\n");
158
+ }
159
+ /**
160
+ * Which directories the fix should send the reader to, and how to name the instance in prose.
161
+ *
162
+ * `verifyProof` reports the FIRST instance it could not verify and stops, carrying its name on the
163
+ * result. Using it keeps the fix to the sleeve that actually failed — listing every instance is not
164
+ * wrong (deploy requires them all proven) but costs a real live tick per sleeve to follow. When
165
+ * there is no instance identity — a flat package, whose one instance IS the package root — the
166
+ * package directory is the only honest target.
167
+ */
168
+ function failingTarget(result, pkg) {
169
+ const failed = result.instance === undefined || result.instance === ""
170
+ ? undefined
171
+ : pkg.instances.find((inst) => relative(pkg.dir, inst.runtimeYamlDir) === result.instance);
172
+ if (failed === undefined) {
173
+ // Either a flat package, or a name this package no longer declares — in both cases the whole
174
+ // package is the target, which is never a wrong instruction, only a broader one.
175
+ const dirs = [...new Set(pkg.instances.map((inst) => inst.runtimeYamlDir))];
176
+ return { dirs, named: undefined };
177
+ }
178
+ return { dirs: [failed.runtimeYamlDir], named: failed.name };
179
+ }
180
+ /**
181
+ * The sentence that stops a second refusal from reading as "my fix did not work".
182
+ *
183
+ * Verification stops at the first unproven instance, so a package with two unproven sleeves refuses
184
+ * twice. Only said when there is more than one instance — on a flat package it would be noise.
185
+ */
186
+ function everyInstanceNote(pkg) {
187
+ // Its OWN line. Appended to the last command line, an agent copying that line pastes the
188
+ // sentence into a shell along with it.
189
+ return pkg.instances.length > 1
190
+ ? `\nDeploy needs every instance of this package proven and stops at the first that is not, so ` +
191
+ `expect to be sent back here if another one is also unproven.`
192
+ : "";
193
+ }
194
+ /** `scan.py, scoring.py` — the first few, then a count. Never a bare "the package differs". */
195
+ function nameChangedFiles(changed) {
196
+ const named = changed.slice(0, MAX_NAMED_FILES).join(", ");
197
+ return changed.length > MAX_NAMED_FILES ? `${named} and ${changed.length - MAX_NAMED_FILES} more` : named;
198
+ }
199
+ /**
200
+ * The three reasons, each with its own fix.
201
+ *
202
+ * A single generic "run senpi validate" would be a template hint rather than a computed one: the
203
+ * three states call for different reading. `no_proof` says nothing has ever been observed to run
204
+ * here; `content_changed` says the bytes moved and names which; `runtime_version_changed` says the
205
+ * package is unchanged and only the engine under it moved — the one case where editing the package
206
+ * would be exactly the wrong response.
207
+ */
208
+ export function proofRefusalParts(result, pkg) {
209
+ const { dirs, named } = failingTarget(result, pkg);
210
+ const commands = validateCommands(dirs);
211
+ const scope = named === undefined ? "this package" : `instance "${named}" (${dirs[0]})`;
212
+ if (result.reason === "content_changed") {
213
+ const changed = result.changedFiles ?? [];
214
+ return {
215
+ code: VALIDATE_CODE.contentChanged,
216
+ what: changed.length > 0
217
+ ? `This package differs from the content that passed: ${nameChangedFiles(changed)}`
218
+ : "This package differs from the content that passed",
219
+ why: "A proof is a claim about exact bytes: these files are not the ones that ran, so nothing is " +
220
+ "known about how they behave. An edit is not required to be large to change what a scanner does.",
221
+ fix: `either restore the proven content, or prove what is there now — re-run the validation and ` +
222
+ `let it PASS, then re-run the deploy:\n${commands}${everyInstanceNote(pkg)}`,
223
+ };
224
+ }
225
+ if (result.reason === "runtime_version_changed") {
226
+ const proved = result.record?.runtime_version;
227
+ return {
228
+ code: VALIDATE_CODE.runtimeVersionChanged,
229
+ what: proved
230
+ ? `The proof was recorded under runtime ${proved}; this box runs ${VERSION}`
231
+ : `The proof was recorded under a runtime other than the ${VERSION} running here`,
232
+ why: "A pass is a claim about this package running under a specific runtime build. The proof " +
233
+ "predates the running runtime — the runtime self-updates in place — or, on a box that was " +
234
+ "rolled back, was made under a later one. Either way it no longer describes the code that " +
235
+ "would actually execute; the two versions above say which case this is.",
236
+ fix: `the package needs no editing: its content still matches its proof, and only the engine under ` +
237
+ `it moved. Re-prove it against the runtime running here, then re-run the deploy:` +
238
+ `\n${commands}${everyInstanceNote(pkg)}`,
239
+ };
240
+ }
241
+ return {
242
+ code: VALIDATE_CODE.noProof,
243
+ what: `No proof of a passing validation exists for ${scope}`,
244
+ // The flags are NAMED, not described. This read "at live depth", and the flag is `--stage` —
245
+ // a reader turned that noun into `--depth static` as the first command of a dev-box pass and
246
+ // got `error: unknown option '--depth'`. A refusal's job is to name the sanctioned next step
247
+ // exactly; an abstract noun for it is a command the reader has to guess at.
248
+ why: "Deploy funds a wallet and installs code onto it. A proof is the record that this exact " +
249
+ "content ran: only a run that goes all the way and covers the whole package writes one — " +
250
+ "`--stage live` (the default), no `--scanner`, no `--no-attest`. A `--stage static` or " +
251
+ "`--stage import` run, and any run scoped to one scanner, deliberately writes none. Without " +
252
+ "it, nothing here has been observed to execute at all.",
253
+ fix: `record one, and let it PASS, then re-run the deploy:\n${commands}${everyInstanceNote(pkg)}`,
254
+ };
255
+ }
256
+ /**
257
+ * The refusal as the step row's `detail`.
258
+ *
259
+ * The bracketed code leads, and is not decoration: `taxonomy.ts` extracts it and the CLI uses it to
260
+ * exit 2 (obey this) rather than 1 (state unknown).
261
+ *
262
+ * It emits NO re-run command of its own. The report's `next` already ends a refused report with
263
+ * `openclaw senpi deploy -p '<dir>' --budget <the real figure>`; a copy here would carry a `<usd>` placeholder
264
+ * instead, which is a second, worse command competing with the authoritative one.
265
+ */
266
+ export function buildProofRefusal(result, pkg) {
267
+ const parts = proofRefusalParts(result, pkg);
268
+ return (`[${parts.code}] ${parts.what}.\n\n` +
269
+ `Why: ${parts.why}\n\n` +
270
+ // Scoped to THIS RUN, like the universe gate's refusal: the check runs before deploy reads any
271
+ // live state, so on a resume the package may already own a funded wallet this gate cannot see.
272
+ // Claiming "no wallet exists" there would invite funding a second one beside the live one.
273
+ `Nothing was created by this run — this gate reads the package's own files and nothing else, so ` +
274
+ `it stopped before any live read. Whatever this package already had is untouched, and this gate ` +
275
+ `cannot see it.\n\n` +
276
+ `Fix — ${parts.fix}`);
277
+ }
278
+ //# sourceMappingURL=proof-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-gate.js","sourceRoot":"","sources":["../../src/deploy/proof-gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,aAAa,EAAwC,MAAM,sBAAsB,CAAC;AACxG,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,eAAe,EAA2C,MAAM,cAAc,CAAC;AACxF,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,MAAM,UAAU,iBAAiB,CAAC,GAAkB;IAClD,MAAM,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC;IACtF,OAAO,WAAW,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AAC7C,CAAC;AAQD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,qBAAqB,CAAC,GAAkB;IACtD,MAAM,KAAK,GAAG,IAAI,GAAG,EAA4B,CAAC;IAClD,KAAK,MAAM,IAAI,IAAI,GAAG,CAAC,SAAS,EAAE,CAAC;QACjC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC;IACp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J,CAAC"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Read a YAML scalar the way Python's `float()` would — the ONE implementation of that question in
3
+ * the deploy module.
4
+ *
5
+ * Two places need it, for the same reason: the numbers they read are also read on the skills side
6
+ * by Python, and a disagreement means the discovery card and the verb compute different money.
7
+ * `min-budget.ts` uses it as the port of `min_budget.py`'s `_f`; `package.ts` uses it for
8
+ * `funding_share`, which additionally drives `planFunding`'s real allocation. They were briefly two
9
+ * near-copies that had already drifted (one had a boolean branch, the other did not) — which is the
10
+ * drift class this whole workstream exists to close, so they are one function now.
11
+ *
12
+ * SHAPE, NOT LETTER. A number, a bool, or a numeric string parses; everything else is null. Two
13
+ * classes of input where that is not exactly `float()`, both verified, both deliberately left:
14
+ *
15
+ * - **A blank/whitespace string.** `float("")` raises, `Number("")` is `0`, so the explicit guard
16
+ * aligns them. Defence in depth: it changes no output today, because every call site rejects `0`
17
+ * downstream anyway — but that alignment then survives the next edit to any of those guards
18
+ * instead of holding by accident.
19
+ * - **Quoted exotic numeric strings**, the only real parity gap across ~450 adversarial inputs, and
20
+ * reachable ONLY through a quoted YAML scalar (an unquoted `0x14` parses to `20` on both sides
21
+ * before either implementation sees it). Python accepts more than `Number` in some places
22
+ * (`"2_5"` → 25.0 under PEP 515, `"Infinity"`/`"inf"` → inf) and less in others (`"0x14"` raises
23
+ * where `Number` gives 20). Deliberately NOT "fixed" with a numeric-literal regex: that closes
24
+ * the `0x14` direction while leaving the underscore direction open, trading a documented, tested
25
+ * divergence for a half-corrected one. Both directions are pinned as tests — in
26
+ * `min-budget.test.ts` for the sizing path and `package.test.ts` for `funding_share` — so a
27
+ * future "fix" cannot flip one silently.
28
+ *
29
+ * No shipped package is affected either way: across the 103 catalog packages, zero declare a quoted
30
+ * or non-numeric `funding_share` and zero declare a quoted sizing value.
31
+ */
32
+ /** Python `float(x)`, returning null where it would raise. See the module header for the two gaps. */
33
+ export declare function pythonFloat(value: unknown): number | null;
34
+ //# sourceMappingURL=python-float.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-float.d.ts","sourceRoot":"","sources":["../../src/deploy/python-float.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,sGAAsG;AACtG,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CASzD"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Read a YAML scalar the way Python's `float()` would — the ONE implementation of that question in
3
+ * the deploy module.
4
+ *
5
+ * Two places need it, for the same reason: the numbers they read are also read on the skills side
6
+ * by Python, and a disagreement means the discovery card and the verb compute different money.
7
+ * `min-budget.ts` uses it as the port of `min_budget.py`'s `_f`; `package.ts` uses it for
8
+ * `funding_share`, which additionally drives `planFunding`'s real allocation. They were briefly two
9
+ * near-copies that had already drifted (one had a boolean branch, the other did not) — which is the
10
+ * drift class this whole workstream exists to close, so they are one function now.
11
+ *
12
+ * SHAPE, NOT LETTER. A number, a bool, or a numeric string parses; everything else is null. Two
13
+ * classes of input where that is not exactly `float()`, both verified, both deliberately left:
14
+ *
15
+ * - **A blank/whitespace string.** `float("")` raises, `Number("")` is `0`, so the explicit guard
16
+ * aligns them. Defence in depth: it changes no output today, because every call site rejects `0`
17
+ * downstream anyway — but that alignment then survives the next edit to any of those guards
18
+ * instead of holding by accident.
19
+ * - **Quoted exotic numeric strings**, the only real parity gap across ~450 adversarial inputs, and
20
+ * reachable ONLY through a quoted YAML scalar (an unquoted `0x14` parses to `20` on both sides
21
+ * before either implementation sees it). Python accepts more than `Number` in some places
22
+ * (`"2_5"` → 25.0 under PEP 515, `"Infinity"`/`"inf"` → inf) and less in others (`"0x14"` raises
23
+ * where `Number` gives 20). Deliberately NOT "fixed" with a numeric-literal regex: that closes
24
+ * the `0x14` direction while leaving the underscore direction open, trading a documented, tested
25
+ * divergence for a half-corrected one. Both directions are pinned as tests — in
26
+ * `min-budget.test.ts` for the sizing path and `package.test.ts` for `funding_share` — so a
27
+ * future "fix" cannot flip one silently.
28
+ *
29
+ * No shipped package is affected either way: across the 103 catalog packages, zero declare a quoted
30
+ * or non-numeric `funding_share` and zero declare a quoted sizing value.
31
+ */
32
+ /** Python `float(x)`, returning null where it would raise. See the module header for the two gaps. */
33
+ export function pythonFloat(value) {
34
+ if (typeof value === "number")
35
+ return Number.isFinite(value) ? value : null;
36
+ if (typeof value === "boolean")
37
+ return value ? 1 : 0; // float(True) === 1.0
38
+ if (typeof value === "string") {
39
+ if (value.trim() === "")
40
+ return null;
41
+ const parsed = Number(value);
42
+ return Number.isFinite(parsed) ? parsed : null;
43
+ }
44
+ return null;
45
+ }
46
+ //# sourceMappingURL=python-float.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"python-float.js","sourceRoot":"","sources":["../../src/deploy/python-float.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH,sGAAsG;AACtG,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;IAC5E,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,sBAAsB;IAC5E,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE;YAAE,OAAO,IAAI,CAAC;QACrC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;QAC7B,OAAO,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;IACjD,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,50 @@
1
+ /**
2
+ * The commands a deploy refusal sends a reader to when something has to be re-checked.
3
+ *
4
+ * TWO ROUTES, and both are named wherever either is. `python3 senpi-strategy-ops/scripts/…` is what
5
+ * the skills layer teaches today; `senpi validate` is what actually enforces, because a full,
6
+ * unscoped run at live depth that PASSES is the only thing that writes the `.senpi-proof.json` this
7
+ * verb now refuses a package without. A refusal naming only the python route sends an agent around
8
+ * a loop that cannot close: run the python validator, deploy, get refused for a missing proof,
9
+ * repeat — the python route cannot end it, and nothing in the refusal says so.
10
+ *
11
+ * ONE producer, for the same reason `resumeCommand` is one: every string here is pasted into a
12
+ * shell verbatim, so the quoting rule (a real workspace path has spaces in it) is decided once
13
+ * rather than per call site. Its own module because the callers span `deploy/` and `universe/`:
14
+ * `orchestrator.ts` imports `../universe/package-universe.ts`, so a producer living in either one
15
+ * would be imported back by the other — the same cycle constraint that gave `error-text.ts` a
16
+ * module of its own.
17
+ */
18
+ /**
19
+ * `openclaw senpi validate '<dir>'` — the route that records a proof.
20
+ *
21
+ * The argument is always a DIRECTORY: an instance's `runtimeYamlDir`, a package root when no
22
+ * instance is known, or — where the package would not load at all — the directory the caller named,
23
+ * which is the only target left and the one validate diagnoses identically. Never a manifest
24
+ * instance NAME (validate resolves a path, and a name is not one — the exact confusion the proof
25
+ * gate exists to survive), and never a `<placeholder>`, which an agent pastes literally.
26
+ */
27
+ export declare function validateCommand(dir: string): string;
28
+ /** The skills package validator: the author-side checks over a package, and no proof. */
29
+ export declare function deployPyValidateCommand(packageDir: string): string;
30
+ /** The skills universe validator: the live-instrument half of the checks, and no proof. */
31
+ export declare function validateUniversePyCommand(packageDir: string): string;
32
+ /**
33
+ * Both routes as an indented block, one command per line — the form every refusal below the "fix"
34
+ * line uses.
35
+ *
36
+ * The validate directories are de-duplicated because two instances can legally share one, and the
37
+ * same line twice reads as two things to do. The runtime route leads: it is the one that ends the
38
+ * loop, and a reader who runs only the first command they see should be that reader.
39
+ */
40
+ export declare function recheckBlock(validateDirs: readonly string[], pythonCommand: string): string;
41
+ /**
42
+ * The sentence that stops "either" from reading as "either one finishes this".
43
+ *
44
+ * Named routes without it are a coin flip an agent loses half the time: the python route answers
45
+ * the question the refusal asked and still leaves the deploy refusing, with nothing in the text to
46
+ * explain why. It says which route ends the loop, and does not disparage the other — the skills
47
+ * validator is what the author-side skill teaches, and it catches these same faults.
48
+ */
49
+ export declare const PROOF_ROUTE_NOTE = "Only `openclaw senpi validate` records the proof this deploy requires; the python route writes none.";
50
+ //# sourceMappingURL=recheck-commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recheck-commands.d.ts","sourceRoot":"","sources":["../../src/deploy/recheck-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAqBH;;;;;;;;GAQG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEnD;AAED,yFAAyF;AACzF,wBAAgB,uBAAuB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAElE;AAED,2FAA2F;AAC3F,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,MAAM,CAG3F;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,yGAC2E,CAAC"}
@@ -0,0 +1,77 @@
1
+ /**
2
+ * The commands a deploy refusal sends a reader to when something has to be re-checked.
3
+ *
4
+ * TWO ROUTES, and both are named wherever either is. `python3 senpi-strategy-ops/scripts/…` is what
5
+ * the skills layer teaches today; `senpi validate` is what actually enforces, because a full,
6
+ * unscoped run at live depth that PASSES is the only thing that writes the `.senpi-proof.json` this
7
+ * verb now refuses a package without. A refusal naming only the python route sends an agent around
8
+ * a loop that cannot close: run the python validator, deploy, get refused for a missing proof,
9
+ * repeat — the python route cannot end it, and nothing in the refusal says so.
10
+ *
11
+ * ONE producer, for the same reason `resumeCommand` is one: every string here is pasted into a
12
+ * shell verbatim, so the quoting rule (a real workspace path has spaces in it) is decided once
13
+ * rather than per call site. Its own module because the callers span `deploy/` and `universe/`:
14
+ * `orchestrator.ts` imports `../universe/package-universe.ts`, so a producer living in either one
15
+ * would be imported back by the other — the same cycle constraint that gave `error-text.ts` a
16
+ * module of its own.
17
+ */
18
+ /**
19
+ * A path as a single POSIX shell word.
20
+ *
21
+ * Wrapping in quotes is not the same as quoting. A directory is package-controlled input — the
22
+ * manifest chooses it, an instance's `runtime:` can point anywhere, and a directory name may
23
+ * legally contain `'` — so a bare `'${dir}'` lets the path CLOSE the quote and everything after it
24
+ * parses as further commands. These strings are printed under "fix" as something the reader pastes,
25
+ * which makes the refusal itself the delivery vehicle: the operator runs the line we told them to
26
+ * run, on the box holding the trading funds.
27
+ *
28
+ * The rule is the standard one — end the quote, emit an escaped `'`, reopen — so `a'b` becomes
29
+ * `'a'\''b'`. Nothing inside single quotes is special to the shell, so no other character needs a
30
+ * case. Every path this module emits goes through it; the wrapping quotes stay because a real
31
+ * workspace path has spaces in it, which is what they were always for.
32
+ */
33
+ function shellQuote(value) {
34
+ return `'${value.split("'").join(`'\\''`)}'`;
35
+ }
36
+ /**
37
+ * `openclaw senpi validate '<dir>'` — the route that records a proof.
38
+ *
39
+ * The argument is always a DIRECTORY: an instance's `runtimeYamlDir`, a package root when no
40
+ * instance is known, or — where the package would not load at all — the directory the caller named,
41
+ * which is the only target left and the one validate diagnoses identically. Never a manifest
42
+ * instance NAME (validate resolves a path, and a name is not one — the exact confusion the proof
43
+ * gate exists to survive), and never a `<placeholder>`, which an agent pastes literally.
44
+ */
45
+ export function validateCommand(dir) {
46
+ return `openclaw senpi validate ${shellQuote(dir)}`;
47
+ }
48
+ /** The skills package validator: the author-side checks over a package, and no proof. */
49
+ export function deployPyValidateCommand(packageDir) {
50
+ return `python3 senpi-strategy-ops/scripts/deploy.py validate ${shellQuote(packageDir)}`;
51
+ }
52
+ /** The skills universe validator: the live-instrument half of the checks, and no proof. */
53
+ export function validateUniversePyCommand(packageDir) {
54
+ return `python3 senpi-strategy-ops/scripts/validate_universe.py ${shellQuote(packageDir)}`;
55
+ }
56
+ /**
57
+ * Both routes as an indented block, one command per line — the form every refusal below the "fix"
58
+ * line uses.
59
+ *
60
+ * The validate directories are de-duplicated because two instances can legally share one, and the
61
+ * same line twice reads as two things to do. The runtime route leads: it is the one that ends the
62
+ * loop, and a reader who runs only the first command they see should be that reader.
63
+ */
64
+ export function recheckBlock(validateDirs, pythonCommand) {
65
+ const lines = [...new Set(validateDirs)].map(validateCommand);
66
+ return [...lines, pythonCommand].map((command) => ` ${command}`).join("\n");
67
+ }
68
+ /**
69
+ * The sentence that stops "either" from reading as "either one finishes this".
70
+ *
71
+ * Named routes without it are a coin flip an agent loses half the time: the python route answers
72
+ * the question the refusal asked and still leaves the deploy refusing, with nothing in the text to
73
+ * explain why. It says which route ends the loop, and does not disparage the other — the skills
74
+ * validator is what the author-side skill teaches, and it catches these same faults.
75
+ */
76
+ export const PROOF_ROUTE_NOTE = "Only `openclaw senpi validate` records the proof this deploy requires; the python route writes none.";
77
+ //# sourceMappingURL=recheck-commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recheck-commands.js","sourceRoot":"","sources":["../../src/deploy/recheck-commands.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH;;;;;;;;;;;;;;GAcG;AACH,SAAS,UAAU,CAAC,KAAa;IAC/B,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;AAC/C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,2BAA2B,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;AACtD,CAAC;AAED,yFAAyF;AACzF,MAAM,UAAU,uBAAuB,CAAC,UAAkB;IACxD,OAAO,yDAAyD,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;AAC3F,CAAC;AAED,2FAA2F;AAC3F,MAAM,UAAU,yBAAyB,CAAC,UAAkB;IAC1D,OAAO,2DAA2D,UAAU,CAAC,UAAU,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,YAAY,CAAC,YAA+B,EAAE,aAAqB;IACjF,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;IAC9D,OAAO,CAAC,GAAG,KAAK,EAAE,aAAa,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,KAAK,OAAO,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAC3B,sGAAsG,CAAC"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Gateway wiring for the deploy job: `senpi.deploy.start` / `.status`.
3
+ *
4
+ * These two methods are **internal transport** between the `senpi deploy` CLI
5
+ * verbs and the plugin. They are deliberately absent from the cheatsheet, the
6
+ * README's agent-facing sections and the skills: one teaching surface (the CLI)
7
+ * wins routing, and naming the RPCs too would invite raw-RPC calls that bypass
8
+ * the CLI-side validation.
9
+ *
10
+ * The module owns no logic of its own beyond adapting ctx → collaborators:
11
+ * everything it needs arrives in an explicit {@link DeployGatewayContext}, so it
12
+ * never reaches into the plugin's boot closure.
13
+ */
14
+ import type { SenpiClient } from "../senpi/client.js";
15
+ import { type RegistryEntryLite, type ScannerRowLite } from "./orchestrator.js";
16
+ import { type DeployJobController } from "./job.js";
17
+ /**
18
+ * Mirrors `installRuntimeCore`'s return shape (index.ts) without importing the boot closure.
19
+ *
20
+ * `payload.unwired` is the unwired phase — the install succeeded, but the runtime has NO live entry
21
+ * scanners. Deploy reads it as an install failure (it funded a wallet for a runtime that can never
22
+ * tick); direct gateway/CLI installs keep treating `ok` as ok.
23
+ */
24
+ export type InstallGatewayResult = {
25
+ ok: true;
26
+ payload: {
27
+ id: string;
28
+ name: string;
29
+ wallet: string;
30
+ unwired?: string;
31
+ };
32
+ } | {
33
+ ok: false;
34
+ error: {
35
+ code: string;
36
+ message: string;
37
+ };
38
+ };
39
+ /** The slice of the plugin API this module uses. */
40
+ export interface DeployPluginApi {
41
+ registerGatewayMethod(name: string, handler: (ctx: {
42
+ respond: (ok: boolean, value: unknown) => void;
43
+ params?: Record<string, unknown>;
44
+ }) => void | Promise<void>, opts?: {
45
+ scope?: "operator.write" | "operator.read";
46
+ }): void;
47
+ }
48
+ /**
49
+ * Everything the deploy gateway needs from the plugin boot closure, injected
50
+ * explicitly — register.ts never reaches into index.ts internals.
51
+ */
52
+ export interface DeployGatewayContext {
53
+ controller: DeployJobController;
54
+ /**
55
+ * Runs fn with a fresh connected SenpiClient; always disconnects. One helper, reused per job.
56
+ *
57
+ * NOTE: a deploy holds this client for the whole job (up to `maxWait` + `tickWait` + install),
58
+ * unlike every other call site, which connects per operation. That is deliberate — the create
59
+ * poll must keep the same session — but it is the seam where an MCP idle/TTL bound would first
60
+ * surface, as a throw from the poll. That throw is now contained: the orchestrator records the
61
+ * step `failed` with the message quoted rather than losing the whole report.
62
+ */
63
+ withSenpiClient<T>(fn: (client: SenpiClient) => Promise<T>): Promise<T>;
64
+ /** = installRuntimeCore */
65
+ installRuntime(params: Record<string, unknown>): Promise<InstallGatewayResult>;
66
+ /** = deleteRuntimeCore — archival/launcher teardown is NOT reimplemented here. */
67
+ deleteRuntime(id: string): Promise<void>;
68
+ registryFindByWallet(wallet: string): Promise<RegistryEntryLite | undefined>;
69
+ registryFindById(id: string): Promise<RegistryEntryLite | undefined>;
70
+ getScannerRows(runtimeId: string): Promise<ScannerRowLite[] | null>;
71
+ /** H4: does this runtime id have a LIVE handle (not merely a registry row)? */
72
+ runtimeIsLive(id: string): Promise<boolean>;
73
+ /** = the gateway's in-process install fence; see `installsInFlight` in index.ts. */
74
+ installPendingOnWallet(wallet: string): Promise<boolean>;
75
+ logger: {
76
+ info(line: string): void;
77
+ };
78
+ }
79
+ export interface DeployLiveLayer {
80
+ strategies: Array<{
81
+ strategyName: string;
82
+ status: string;
83
+ strategyWalletAddress: string;
84
+ totalFunded?: number;
85
+ }>;
86
+ runtimes: Array<{
87
+ id: string;
88
+ wallet?: string;
89
+ }>;
90
+ /**
91
+ * Set when this layer could not be read at all — the package is gone (moved/deleted) or the
92
+ * strategy read failed closed (`listStrategies` throws rather than reporting zero). The layer is
93
+ * then EMPTY, not wrong: the renderer prints the reason instead of "none matching this package",
94
+ * which over a job that may have funded wallets would be the one claim this layer exists to
95
+ * prevent. Never set for a genuinely empty result.
96
+ */
97
+ unavailable?: string;
98
+ }
99
+ /** Register the internal deploy transport pair. */
100
+ export declare function registerDeployGatewayMethods(api: DeployPluginApi, ctx: DeployGatewayContext): void;
101
+ //# sourceMappingURL=register.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"register.d.ts","sourceRoot":"","sources":["../../src/deploy/register.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAoCtD,OAAO,EAA8B,KAAK,iBAAiB,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAC5G,OAAO,EAAuB,KAAK,mBAAmB,EAAwC,MAAM,UAAU,CAAC;AAE/G;;;;;;GAMG;AACH,MAAM,MAAM,oBAAoB,GAC5B;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,GACrF;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE;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