@senpi-ai/runtime 3.0.189 → 3.0.202

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/dist/cli/guide-commands.d.ts.map +1 -1
  2. package/dist/cli/guide-commands.js +37 -17
  3. package/dist/cli/guide-commands.js.map +1 -1
  4. package/dist/cli/senpi-commands.d.ts.map +1 -1
  5. package/dist/cli/senpi-commands.js +62 -30
  6. package/dist/cli/senpi-commands.js.map +1 -1
  7. package/dist/cli/update-command.d.ts +20 -8
  8. package/dist/cli/update-command.d.ts.map +1 -1
  9. package/dist/cli/update-command.js +52 -37
  10. package/dist/cli/update-command.js.map +1 -1
  11. package/dist/deploy/orchestrator.js +3 -3
  12. package/dist/deploy/orchestrator.js.map +1 -1
  13. package/dist/deploy/package.d.ts +17 -0
  14. package/dist/deploy/package.d.ts.map +1 -1
  15. package/dist/deploy/package.js +19 -0
  16. package/dist/deploy/package.js.map +1 -1
  17. package/dist/deploy/proof-gate.d.ts.map +1 -1
  18. package/dist/deploy/proof-gate.js +12 -3
  19. package/dist/deploy/proof-gate.js.map +1 -1
  20. package/dist/deploy/recheck-commands.d.ts +2 -0
  21. package/dist/deploy/recheck-commands.d.ts.map +1 -1
  22. package/dist/deploy/recheck-commands.js +4 -0
  23. package/dist/deploy/recheck-commands.js.map +1 -1
  24. package/dist/deploy/register.js +2 -2
  25. package/dist/deploy/register.js.map +1 -1
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +14 -3
  28. package/dist/index.js.map +1 -1
  29. package/dist/runtime/effective-config.d.ts.map +1 -1
  30. package/dist/runtime/effective-config.js +12 -2
  31. package/dist/runtime/effective-config.js.map +1 -1
  32. package/dist/runtime/load-runtime-config.d.ts +20 -0
  33. package/dist/runtime/load-runtime-config.d.ts.map +1 -1
  34. package/dist/runtime/load-runtime-config.js +36 -8
  35. package/dist/runtime/load-runtime-config.js.map +1 -1
  36. package/dist/runtime/map-strategies.d.ts.map +1 -1
  37. package/dist/runtime/map-strategies.js +7 -4
  38. package/dist/runtime/map-strategies.js.map +1 -1
  39. package/dist/runtime/recipe-file.d.ts +73 -0
  40. package/dist/runtime/recipe-file.d.ts.map +1 -0
  41. package/dist/runtime/recipe-file.js +194 -0
  42. package/dist/runtime/recipe-file.js.map +1 -0
  43. package/dist/runtime/runtime-descriptor.d.ts +23 -0
  44. package/dist/runtime/runtime-descriptor.d.ts.map +1 -1
  45. package/dist/runtime/runtime-descriptor.js +40 -0
  46. package/dist/runtime/runtime-descriptor.js.map +1 -1
  47. package/dist/runtime/update-apply-deps.d.ts +30 -11
  48. package/dist/runtime/update-apply-deps.d.ts.map +1 -1
  49. package/dist/runtime/update-apply-deps.js +93 -27
  50. package/dist/runtime/update-apply-deps.js.map +1 -1
  51. package/dist/runtime/update-handler.d.ts +28 -9
  52. package/dist/runtime/update-handler.d.ts.map +1 -1
  53. package/dist/runtime/update-handler.js +186 -19
  54. package/dist/runtime/update-handler.js.map +1 -1
  55. package/dist/runtime/update-register.d.ts +101 -2
  56. package/dist/runtime/update-register.d.ts.map +1 -1
  57. package/dist/runtime/update-register.js +269 -44
  58. package/dist/runtime/update-register.js.map +1 -1
  59. package/dist/scanners/external/scaffold/preflight.py +492 -12
  60. package/dist/validate/codes.d.ts +2 -0
  61. package/dist/validate/codes.d.ts.map +1 -1
  62. package/dist/validate/codes.js +6 -0
  63. package/dist/validate/codes.js.map +1 -1
  64. package/dist/validate/live-stage.d.ts +12 -0
  65. package/dist/validate/live-stage.d.ts.map +1 -1
  66. package/dist/validate/live-stage.js +16 -0
  67. package/dist/validate/live-stage.js.map +1 -1
  68. package/dist/validate/package-gates-stage.d.ts +13 -1
  69. package/dist/validate/package-gates-stage.d.ts.map +1 -1
  70. package/dist/validate/package-gates-stage.js +3 -8
  71. package/dist/validate/package-gates-stage.js.map +1 -1
  72. package/dist/validate/proof.d.ts.map +1 -1
  73. package/dist/validate/proof.js +20 -5
  74. package/dist/validate/proof.js.map +1 -1
  75. package/dist/validate/target.d.ts +75 -1
  76. package/dist/validate/target.d.ts.map +1 -1
  77. package/dist/validate/target.js +94 -28
  78. package/dist/validate/target.js.map +1 -1
  79. package/openclaw.plugin.json +1 -1
  80. package/package.json +1 -1
@@ -14,7 +14,7 @@
14
14
  */
15
15
  import type { Finding } from "../validate/types.js";
16
16
  import type { RuntimeConfig } from "./runtime-schema.js";
17
- import type { RecipeSource } from "./update-handler.js";
17
+ import type { RecipeSource, UpdateRecipe } from "./update-handler.js";
18
18
  import { KeyedMutex } from "../utils/keyed-mutex.js";
19
19
  /**
20
20
  * One apply or delete at a time, per runtime, across the whole process.
@@ -46,24 +46,42 @@ export interface ProofOutcome {
46
46
  };
47
47
  finding?: Finding;
48
48
  }
49
+ /**
50
+ * The recipe an update is about to apply, as the caller named it: its text (`runtimeYamlContent`,
51
+ * before the wallet placeholder is bound), or the file it named (`runtimeYamlPath`).
52
+ */
53
+ export interface AppliedRecipe {
54
+ content?: string;
55
+ path?: string;
56
+ }
49
57
  /**
50
58
  * Decide whether a proof covers the recipe actually being applied.
51
59
  *
52
60
  * `verifyProof` answers a question about a directory: do these files still hash to what passed?
53
61
  * An update asks a narrower one, because the recipe it applies does not have to be the file in that
54
- * directory — `--content` supplies bytes directly, and `--dir` only says where relative scanner
55
- * paths resolve. So a caller could point `--dir` at a validated package, hand `--content` something
56
- * else entirely, and the gate would pass on the strength of a proof about a file it was not going
57
- * to run.
62
+ * directory. `runtimeYamlContent` supplies bytes directly, and `runtimeYamlDir` only says where the
63
+ * proof is read and relative scanner paths resolve. A `runtimeYamlPath` names a file, but not
64
+ * necessarily the one the proof was taken over: a second recipe beside the proven one, outside every
65
+ * scanner root, leaves the package fingerprint matching. So the gate passes only when the applied
66
+ * file IS the proven recipe and the applied bytes are its bytes. Nothing to compare is a refusal.
58
67
  *
59
- * `appliedRecipe` is the caller's text BEFORE the wallet placeholder is bound. The proof describes
68
+ * `applied.content` is the caller's text BEFORE the wallet placeholder is bound. The proof describes
60
69
  * bytes on disk and binding happens afterwards, so comparing the bound form would reject every
61
70
  * package that legitimately writes `${WALLET}`.
62
71
  */
63
- export declare function checkProofCoversRecipe(packageDir: string, result: ProofOutcome, appliedRecipe: string | undefined, readFile: (path: string) => string): {
72
+ export declare function checkProofCoversRecipe(packageDir: string, result: ProofOutcome, applied: AppliedRecipe, readFile: (path: string) => string): {
64
73
  ok: boolean;
65
74
  finding?: Finding;
66
75
  };
76
+ /**
77
+ * The `verifyProof` dependency `senpi.update` runs on: the package's proof, then whether it covers
78
+ * the recipe being applied. `index.ts` and the end-to-end test both build it here, so the test
79
+ * exercises the gate the gateway ships rather than a copy of it.
80
+ */
81
+ export declare function makeUpdateProofCheck(verify: (packageDir: string) => ProofOutcome, readFile: (path: string) => string): (packageDir: string, applied: AppliedRecipe) => Promise<{
82
+ ok: boolean;
83
+ finding?: Finding;
84
+ }>;
67
85
  /** The slice of a `run()` handle an apply needs. */
68
86
  export interface ApplicableRuntime {
69
87
  applyUpdatedConfig(next: RuntimeConfig): Promise<void>;
@@ -110,9 +128,10 @@ relaunchScanners?: (runtimeId: string, next: RuntimeConfig, recipe: RecipeSource
110
128
  * describe a recipe the runtime failed to build.
111
129
  *
112
130
  * The entry carries exactly one of `runtimeYamlPath` / `runtimeYamlContent`, mirroring how install
113
- * writes it. Both are cleared before the new one is set: leaving the old sibling in place would let
114
- * `listRuntimes` resolve the pre-update source on the next boot, which reads as the update having
115
- * silently reverted itself.
131
+ * writes it, and an update always writes content (the CLI and the gateway method read a path into
132
+ * content before the handler runs). Both are cleared before the new one is set: leaving the old
133
+ * sibling in place would let `listRuntimes` resolve the pre-update source on the next boot, which
134
+ * reads as the update having silently reverted itself.
116
135
  *
117
136
  * Under {@link withRegistryLock}: this runs AFTER `applyToRuntime` returns — outside even the
118
137
  * per-runtime {@link runtimeChangeLock} — so two concurrent applies to DIFFERENT runtimes would
@@ -120,5 +139,5 @@ relaunchScanners?: (runtimeId: string, next: RuntimeConfig, recipe: RecipeSource
120
139
  * in-process while the registry names the old one, the next restart silently reverts it, and no
121
140
  * `registryDiverged` finding fires, because its own write "succeeded".
122
141
  */
123
- export declare function makeWriteRegistry(baseStateDir: string): (runtimeId: string, recipe: RecipeSource) => Promise<void>;
142
+ export declare function makeWriteRegistry(baseStateDir: string): (runtimeId: string, recipe: UpdateRecipe) => Promise<void>;
124
143
  //# sourceMappingURL=update-apply-deps.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-apply-deps.d.ts","sourceRoot":"","sources":["../../src/runtime/update-apply-deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB,EAAE,IAAI,CAAC,UAAU,EAAE,aAAa,GAAG,QAAQ,CAGxE,CAAC;AASF,4FAA4F;AAC5F,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,OAAO,CAAC;IACZ,MAAM,CAAC,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,sBAAsB,CACpC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,YAAY,EACpB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,QAAQ,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,GACjC;IAAE,EAAE,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CA6BpC;AAED,oDAAoD;AACpD,MAAM,WAAW,iBAAiB;IAChC,k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OAAO,CAAC,IAAI,GAAG;IAAE,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GACxC,CACD,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,aAAa,EACnB,MAAM,EAAE,YAAY,KACjB,OAAO,CAAC;IAAE,eAAe,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAoBzC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GACnB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,KAAK,OAAO,CAAC,IAAI,CAAC,CAe5D"}
@@ -12,7 +12,8 @@
12
12
  * Extracted rather than copied into a test: a test over a duplicate of this logic proves only that
13
13
  * the duplicate works.
14
14
  */
15
- import { join } from "node:path";
15
+ import { realpathSync } from "node:fs";
16
+ import { dirname, join, resolve } from "node:path";
16
17
  import { readRegistry, writeRegistry, withRegistryLock } from "./strategy-registry.js";
17
18
  import { KeyedMutex } from "../utils/keyed-mutex.js";
18
19
  import { runtimeProcessState } from "./process-state.js";
@@ -52,31 +53,90 @@ function heldRuntimeChangeLock() {
52
53
  *
53
54
  * `verifyProof` answers a question about a directory: do these files still hash to what passed?
54
55
  * An update asks a narrower one, because the recipe it applies does not have to be the file in that
55
- * directory — `--content` supplies bytes directly, and `--dir` only says where relative scanner
56
- * paths resolve. So a caller could point `--dir` at a validated package, hand `--content` something
57
- * else entirely, and the gate would pass on the strength of a proof about a file it was not going
58
- * to run.
56
+ * directory. `runtimeYamlContent` supplies bytes directly, and `runtimeYamlDir` only says where the
57
+ * proof is read and relative scanner paths resolve. A `runtimeYamlPath` names a file, but not
58
+ * necessarily the one the proof was taken over: a second recipe beside the proven one, outside every
59
+ * scanner root, leaves the package fingerprint matching. So the gate passes only when the applied
60
+ * file IS the proven recipe and the applied bytes are its bytes. Nothing to compare is a refusal.
59
61
  *
60
- * `appliedRecipe` is the caller's text BEFORE the wallet placeholder is bound. The proof describes
62
+ * `applied.content` is the caller's text BEFORE the wallet placeholder is bound. The proof describes
61
63
  * bytes on disk and binding happens afterwards, so comparing the bound form would reject every
62
64
  * package that legitimately writes `${WALLET}`.
63
65
  */
64
- export function checkProofCoversRecipe(packageDir, result, appliedRecipe, readFile) {
65
- if (!result.ok)
66
- return { ok: false, ...(result.finding ? { finding: result.finding } : {}) };
67
- // Nothing to compare: the recipe was named by path, and the proof already covers that file.
68
- if (appliedRecipe === undefined || !result.record)
66
+ export function checkProofCoversRecipe(packageDir, result, applied, readFile) {
67
+ // Validating a file writes its proof to the file's own directory. When the caller sent a
68
+ // `runtimeYamlDir` elsewhere, the gate keeps reading that one, so any fix that says only
69
+ // "validate" refuses again forever: every refusal here must also say to move or drop it.
70
+ const fileDir = applied.path !== undefined ? dirname(resolve(applied.path)) : undefined;
71
+ const dirElsewhere = fileDir !== undefined && canonicalPath(fileDir) !== canonicalPath(packageDir);
72
+ const moveDirFix = `Validate this recipe (openclaw senpi validate ${applied.path}), then send \`runtimeYamlDir\` as ${fileDir} or leave it out, so the proof is read where validate writes it`;
73
+ if (!result.ok) {
74
+ if (!result.finding)
75
+ return { ok: false };
76
+ return { ok: false, finding: dirElsewhere ? { ...result.finding, fix: moveDirFix } : result.finding };
77
+ }
78
+ if (!result.record) {
79
+ return proofMismatch(`The proof for ${packageDir} names no recipe, so it cannot cover the one being applied`, dirElsewhere ? moveDirFix : `Run: openclaw senpi validate ${packageDir}`);
80
+ }
81
+ const proven = resolve(join(packageDir, result.record.recipe));
82
+ if (applied.path !== undefined && canonicalPath(applied.path) !== canonicalPath(proven)) {
83
+ return proofMismatch(`The proof for ${packageDir} covers ${result.record.recipe}, not ${applied.path}, the recipe being applied`, dirElsewhere
84
+ ? `Apply the validated recipe (${proven}), or validate this one (openclaw senpi validate ${applied.path}), ` +
85
+ `then send \`runtimeYamlDir\` as ${fileDir} or leave it out, so the proof is read where validate writes it`
86
+ : `Apply the validated recipe (${proven}), or validate this one first: openclaw senpi validate ${applied.path}`);
87
+ }
88
+ // Unreadable is not the same as matching, and treating it as a pass would make an apply against
89
+ // a deleted recipe the easiest way through the gate. Both fall through to the refusal below.
90
+ const read = (path) => {
91
+ try {
92
+ return readFile(path);
93
+ }
94
+ catch {
95
+ return undefined;
96
+ }
97
+ };
98
+ // A path that reaches here already names the proven file (realpath compare above), so reading it
99
+ // again would only compare the file with itself.
100
+ const onDisk = read(proven);
101
+ if (onDisk === undefined) {
102
+ return proofMismatch(`The proven recipe file ${proven} could not be read`, dirElsewhere ? moveDirFix : `Re-run: openclaw senpi validate ${packageDir}`, "A proof is a claim about exact content. The proven file could not be read back, so nothing " +
103
+ "shows the recipe being applied is the one that passed.");
104
+ }
105
+ const covered = applied.content !== undefined ? onDisk === applied.content : applied.path !== undefined;
106
+ if (covered)
69
107
  return { ok: true };
70
- let onDisk = null;
108
+ return proofMismatch(`The proof for ${packageDir} covers ${result.record.recipe}, which is not the recipe being applied`, dirElsewhere ? moveDirFix : `Apply the package as validated, or re-run: openclaw senpi validate ${packageDir}`);
109
+ }
110
+ /**
111
+ * A path as the filesystem resolves it, so two names for one file compare equal: `/tmp/pkg` and
112
+ * `/private/tmp/pkg` on macOS, or a symlinked package or home directory. A path that does not
113
+ * exist falls back to its lexical form; the gate then refuses it as unreadable anyway.
114
+ */
115
+ function canonicalPath(p) {
71
116
  try {
72
- onDisk = readFile(join(packageDir, result.record.recipe));
117
+ return realpathSync(p);
73
118
  }
74
119
  catch {
75
- // Unreadable is not the same as matching, and treating it as a pass would make an apply against
76
- // a deleted recipe the easiest way through the gate. Falls through to the refusal below.
120
+ return resolve(p);
77
121
  }
78
- if (onDisk === appliedRecipe)
79
- return { ok: true };
122
+ }
123
+ /**
124
+ * Build the `E_UPDATE_PROOF_MISMATCH` refusal: the package's proof exists but does not show that
125
+ * the recipe being applied is the one that passed validation.
126
+ *
127
+ * @param what - The headline: which proof, which recipe, and what is wrong between them.
128
+ * @param fix - The command or change that clears it, computed by the caller against the request
129
+ * (for example the move-or-drop fix when `runtimeYamlDir` is not the recipe file's directory).
130
+ * @param why - Why the pass does not count. The default asserts that the recipe being applied is
131
+ * NOT the file that passed validation, so it is true only when the caller has established that:
132
+ * another recipe file, other content, or a proof that names no recipe at all. A caller that
133
+ * could not make that comparison must pass its own reason: the unreadable-proven-file case does,
134
+ * since nothing there shows the recipes differ, and the default would send the caller after a
135
+ * mismatch that may not exist.
136
+ * @returns A failed outcome carrying the finding; no side effects.
137
+ */
138
+ function proofMismatch(what, fix, why = "A proof is a claim about exact content. The recipe being applied is not the file that " +
139
+ "passed validation, so the pass says nothing about what would actually run.") {
80
140
  return {
81
141
  ok: false,
82
142
  finding: {
@@ -85,13 +145,20 @@ export function checkProofCoversRecipe(packageDir, result, appliedRecipe, readFi
85
145
  stage: "invocation",
86
146
  actor: "agent",
87
147
  fix_kind: "command",
88
- what: `The proof for ${packageDir} covers ${result.record.recipe}, which is not the recipe being applied`,
89
- why: "A proof is a claim about exact content. The supplied recipe differs from the file that " +
90
- "passed validation, so the pass says nothing about what would actually run.",
91
- fix: `Apply the package as validated, or re-run: openclaw senpi validate ${packageDir}`,
148
+ what,
149
+ why,
150
+ fix,
92
151
  },
93
152
  };
94
153
  }
154
+ /**
155
+ * The `verifyProof` dependency `senpi.update` runs on: the package's proof, then whether it covers
156
+ * the recipe being applied. `index.ts` and the end-to-end test both build it here, so the test
157
+ * exercises the gate the gateway ships rather than a copy of it.
158
+ */
159
+ export function makeUpdateProofCheck(verify, readFile) {
160
+ return async (packageDir, applied) => checkProofCoversRecipe(packageDir, verify(packageDir), applied, readFile);
161
+ }
95
162
  /**
96
163
  * Swap the live runtime onto the new recipe.
97
164
  *
@@ -146,9 +213,10 @@ relaunchScanners) {
146
213
  * describe a recipe the runtime failed to build.
147
214
  *
148
215
  * The entry carries exactly one of `runtimeYamlPath` / `runtimeYamlContent`, mirroring how install
149
- * writes it. Both are cleared before the new one is set: leaving the old sibling in place would let
150
- * `listRuntimes` resolve the pre-update source on the next boot, which reads as the update having
151
- * silently reverted itself.
216
+ * writes it, and an update always writes content (the CLI and the gateway method read a path into
217
+ * content before the handler runs). Both are cleared before the new one is set: leaving the old
218
+ * sibling in place would let `listRuntimes` resolve the pre-update source on the next boot, which
219
+ * reads as the update having silently reverted itself.
152
220
  *
153
221
  * Under {@link withRegistryLock}: this runs AFTER `applyToRuntime` returns — outside even the
154
222
  * per-runtime {@link runtimeChangeLock} — so two concurrent applies to DIFFERENT runtimes would
@@ -165,9 +233,7 @@ export function makeWriteRegistry(baseStateDir) {
165
233
  const { runtimeYamlPath: _p, runtimeYamlContent: _c, runtimeYamlDir: _d, ...rest } = entry;
166
234
  return {
167
235
  ...rest,
168
- ...(recipe.path !== undefined
169
- ? { runtimeYamlPath: recipe.path }
170
- : { runtimeYamlContent: recipe.content ?? "" }),
236
+ runtimeYamlContent: recipe.content,
171
237
  ...(recipe.dir !== undefined ? { runtimeYamlDir: recipe.dir } : {}),
172
238
  };
173
239
  });
@@ -1 +1 @@
1
- {"version":3,"file":"update-apply-deps.js","sourceRoot":"","sources":["../../src/runtime/update-apply-deps.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AACvF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEzD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAA+C;IAC3E,WAAW,EAAE,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC,qBAAqB,EAAE,CAAC,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC;IACtE,MAAM,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,qBAAqB,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC;CACrD,CA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AAC;YACzC,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,cAAc,EAAE,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;YAC3F,OAAO;gBACL,GAAG,IAAI;gBACP,kBAAkB,EAAE,MAAM,CAAC,OAAO;gBAClC,GAAG,CAAC,MAAM,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;aACpE,CAAC;QACJ,CAAC,CAAC,CAAC;QACH,MAAM,aAAa,CAAC,YAAY,EAAE,EAAE,GAAG,QAAQ,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -34,6 +34,16 @@ export interface RecipeSource {
34
34
  /** Directory relative scanner paths resolve against, when reading content. */
35
35
  dir?: string;
36
36
  }
37
+ /**
38
+ * The recipe an update proposes: always text. The CLI and the gateway method both read a path into
39
+ * content before calling the handler, so a path cannot reach the registry write or the proof
40
+ * lookup through an update.
41
+ */
42
+ export interface UpdateRecipe {
43
+ content: string;
44
+ /** Directory relative scanner paths resolve against, and the proof is checked over. */
45
+ dir?: string;
46
+ }
37
47
  /** One installed runtime, as the registry knows it. */
38
48
  export interface RegisteredRuntime {
39
49
  id: string;
@@ -60,13 +70,16 @@ export interface UpdateHandlerDeps {
60
70
  /**
61
71
  * Pure observation; never enforced here.
62
72
  *
63
- * `appliedRecipe` is the recipe text as the CALLER supplied it, before the wallet placeholder is
64
- * bound — the proof describes bytes on disk, and binding happens after, so the bound form would
65
- * never match a package that uses `${WALLET}`. Passing it lets the check answer the question that
66
- * matters: does the proof cover the recipe about to be applied, or merely some recipe that lives
67
- * in the same directory?
73
+ * `applied` is the recipe as the CALLER named it: its text before the wallet placeholder is bound
74
+ * (the proof describes bytes on disk, and binding happens after, so the bound form would never
75
+ * match a package that uses `${WALLET}`), or the file it named. Passing it lets the check answer
76
+ * the question that matters: does the proof cover the recipe about to be applied, or merely some
77
+ * recipe that lives in the same directory?
68
78
  */
69
- verifyProof(packageDir: string, appliedRecipe?: string): Promise<{
79
+ verifyProof(packageDir: string, applied: {
80
+ content?: string;
81
+ path?: string;
82
+ }): Promise<{
70
83
  ok: boolean;
71
84
  finding?: Finding;
72
85
  }>;
@@ -75,7 +88,7 @@ export interface UpdateRequest {
75
88
  /** Explicit target. Omit both when the box runs exactly one runtime. */
76
89
  id?: string;
77
90
  address?: string;
78
- recipe: RecipeSource;
91
+ recipe: UpdateRecipe;
79
92
  /**
80
93
  * "I changed only scanner code, not the recipe."
81
94
  *
@@ -115,6 +128,12 @@ export declare const UPDATE_HANDLER_CODE: {
115
128
  readonly recipeChangedUnderCodeOnly: "E_UPDATE_RECIPE_CHANGED";
116
129
  /** The proposed recipe still carries a `${VAR}` that nothing in the environment resolves. */
117
130
  readonly unresolvedPlaceholder: "E_UPDATE_UNRESOLVED_PLACEHOLDER";
131
+ /**
132
+ * The wallet placeholder sits on a line other than a plain `wallet:` line (a flow map, a quoted
133
+ * key, a block scalar, a value on the next line), so binding it changes a line that `recipeHash`
134
+ * keeps and the stored recipe would read as drifted from its package forever.
135
+ */
136
+ readonly walletPlaceholderForm: "E_UPDATE_WALLET_FORM";
118
137
  /** The swap failed and the runtime was restored to the recipe it was already running. */
119
138
  readonly rebuildFailed: "E_UPDATE_REBUILD_FAILED";
120
139
  /** The swap failed AND the restore failed. Nothing is managing the book. */
@@ -152,7 +171,7 @@ export interface UpdateApplyDeps extends UpdateHandlerDeps {
152
171
  * deliberate one: if this fails, a restart reverts to a recipe known to work, where the reverse
153
172
  * order would have a restart apply a recipe that had just failed to build.
154
173
  */
155
- writeRegistry(runtimeId: string, recipe: RecipeSource): Promise<void>;
174
+ writeRegistry(runtimeId: string, recipe: UpdateRecipe): Promise<void>;
156
175
  }
157
176
  /**
158
177
  * The outcome of an apply.
@@ -175,7 +194,7 @@ export type UpdateApplyOutcome = {
175
194
  * next boot, and the next boot reads the stored bytes. Hashing the unbound request would
176
195
  * make an update look like a different recipe from the one it installed.
177
196
  */
178
- stored?: RecipeSource;
197
+ stored?: UpdateRecipe;
179
198
  } | {
180
199
  ok: false;
181
200
  stage: "refused";
@@ -1 +1 @@
1
- {"version":3,"file":"update-handler.d.ts","sourceRoot":"","sources":["../../src/runtime/update-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAI/D,4FAA4F;AAC5F,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8EAA8E;IAC9E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,uDAAuD;AACvD,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,MAAM,WAAW,iBAAiB;IAChC,yGAAyG;IACzG,YAAY,IAAI,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAAC;IAC7C,WAAW,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IAC1D,6FAA6F;IAC7F,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACxD,oDAAoD;IACpD,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IACzD;;;OAGG;IACH,WAAW,C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