@codyswann/lisa 4.103.7 → 4.103.9

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 (184) hide show
  1. package/all/copy-overwrite/scripts/lisa-hooks/block-direct-issue-create.sh +12 -13
  2. package/all/copy-overwrite/scripts/lisa-hooks/block-no-verify.sh +4 -5
  3. package/all/copy-overwrite/scripts/lisa-hooks/worktree-binding-guard.mjs +16 -30
  4. package/all/copy-overwrite/scripts/lisa-postinstall.mjs +4 -15
  5. package/all/deletions.json +92 -2
  6. package/dist/cli/apply.d.ts.map +1 -1
  7. package/dist/cli/apply.js +1 -22
  8. package/dist/cli/apply.js.map +1 -1
  9. package/dist/cli/refresh-hooks-cmd.d.ts.map +1 -1
  10. package/dist/cli/refresh-hooks-cmd.js +3 -8
  11. package/dist/cli/refresh-hooks-cmd.js.map +1 -1
  12. package/dist/cli/worktree-prune.d.ts.map +1 -1
  13. package/dist/cli/worktree-prune.js +2 -4
  14. package/dist/cli/worktree-prune.js.map +1 -1
  15. package/dist/codex/scripts/block-no-verify.sh +4 -5
  16. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  17. package/dist/core/lisa-owned-hash-ledger.js +8 -0
  18. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  19. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  20. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  21. package/dist/core/upstream-evidence-manifest.js +24 -71
  22. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  23. package/dist/migrations/index.d.ts +0 -1
  24. package/dist/migrations/index.d.ts.map +1 -1
  25. package/dist/migrations/index.js +0 -3
  26. package/dist/migrations/index.js.map +1 -1
  27. package/dist/migrations/prune-retired-third-party-plugins.d.ts +2 -2
  28. package/dist/migrations/prune-retired-third-party-plugins.js +2 -2
  29. package/dist/opencode/hooks-installer.d.ts.map +1 -1
  30. package/dist/opencode/hooks-installer.js +17 -4
  31. package/dist/opencode/hooks-installer.js.map +1 -1
  32. package/dist/opencode/plugin-catalog.d.ts.map +1 -1
  33. package/dist/opencode/plugin-catalog.js +0 -6
  34. package/dist/opencode/plugin-catalog.js.map +1 -1
  35. package/dist/opencode/plugin-templates/block-no-verify.sh +4 -5
  36. package/dist/opencode/plugin-templates/lisa-block-no-verify.ts +1 -1
  37. package/package.json +6 -8
  38. package/plugins/lisa/.claude-plugin/plugin.json +1 -5
  39. package/plugins/lisa/.codex-plugin/hooks.json +0 -4
  40. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  41. package/plugins/lisa/hooks/block-direct-issue-create.sh +12 -13
  42. package/plugins/lisa/hooks/block-no-verify.agy.sh +4 -5
  43. package/plugins/lisa/hooks/block-no-verify.sh +4 -5
  44. package/plugins/lisa/hooks/block-shell-json-parsing.agy.sh +3 -3
  45. package/plugins/lisa/hooks/failure-signature-index.mjs +2 -2
  46. package/plugins/lisa/hooks/worktree-binding-guard.mjs +16 -30
  47. package/plugins/lisa-agy/hooks/block-direct-issue-create.sh +12 -13
  48. package/plugins/lisa-agy/hooks/block-no-verify.agy.sh +4 -5
  49. package/plugins/lisa-agy/hooks/block-shell-json-parsing.agy.sh +3 -3
  50. package/plugins/lisa-agy/hooks.json +0 -13
  51. package/plugins/lisa-agy/plugin.json +1 -1
  52. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  53. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  54. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  55. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  58. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  59. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -5
  60. package/plugins/lisa-copilot/hooks/block-direct-issue-create.sh +12 -13
  61. package/plugins/lisa-copilot/hooks/block-no-verify.sh +4 -5
  62. package/plugins/lisa-copilot/hooks/failure-signature-index.mjs +2 -2
  63. package/plugins/lisa-copilot/hooks/worktree-binding-guard.mjs +16 -30
  64. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  65. package/plugins/lisa-cursor/hooks/block-direct-issue-create.sh +12 -13
  66. package/plugins/lisa-cursor/hooks/block-no-verify.sh +4 -5
  67. package/plugins/lisa-cursor/hooks/failure-signature-index.mjs +2 -2
  68. package/plugins/lisa-cursor/hooks/hooks.json +0 -4
  69. package/plugins/lisa-cursor/hooks/worktree-binding-guard.mjs +16 -30
  70. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  72. package/plugins/lisa-devin/hooks/block-direct-issue-create.sh +12 -13
  73. package/plugins/lisa-devin/hooks/block-no-verify.sh +4 -5
  74. package/plugins/lisa-devin/hooks/failure-signature-index.mjs +2 -2
  75. package/plugins/lisa-devin/hooks/worktree-binding-guard.mjs +16 -30
  76. package/plugins/lisa-devin/hooks.json +0 -4
  77. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  79. package/plugins/lisa-expo-agy/plugin.json +1 -1
  80. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  81. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  82. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  84. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  86. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  87. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  88. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  89. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  90. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  91. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  92. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  93. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  94. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  95. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  96. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  97. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  98. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  99. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  100. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  101. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  102. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  103. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  104. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  105. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  106. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  107. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  108. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  109. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  110. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  111. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  112. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  113. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  114. package/plugins/lisa-rails-agy/plugin.json +1 -1
  115. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  116. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  117. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  118. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  119. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  120. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  121. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  122. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  123. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  124. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  125. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  126. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  127. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  128. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  129. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  130. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  131. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  132. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  133. package/plugins/materialized-artifacts.json +0 -2
  134. package/plugins/src/base/.claude-plugin/plugin.json +0 -4
  135. package/plugins/src/base/hooks/block-direct-issue-create.sh +12 -13
  136. package/plugins/src/base/hooks/block-no-verify.agy.sh +4 -5
  137. package/plugins/src/base/hooks/block-no-verify.sh +4 -5
  138. package/plugins/src/base/hooks/block-shell-json-parsing.agy.sh +3 -3
  139. package/plugins/src/base/hooks/failure-signature-index.mjs +2 -2
  140. package/plugins/src/base/hooks/worktree-binding-guard.mjs +16 -30
  141. package/scripts/build-plugins.sh +10 -15
  142. package/scripts/check-cwd-resolution-corpus.mjs +4 -5
  143. package/scripts/check-generated-artifact-merge-coverage.mjs +0 -7
  144. package/scripts/copy-opencode-plugin-templates.mjs +0 -1
  145. package/scripts/generate-agy-plugin-artifacts.mjs +8 -13
  146. package/scripts/install-claude-plugins.sh +7 -11
  147. package/scripts/lib/packaged-apply-driver.mjs +4 -22
  148. package/scripts/lib/shell-guard-refusal-coverage.mjs +3 -3
  149. package/scripts/materialize-copy-overwrite.mjs +2 -2
  150. package/scripts/merge-generated-artifact.mjs +3 -3
  151. package/scripts/remedy-conformance.mjs +12 -13
  152. package/scripts/two-channel-couplings.json +1 -1
  153. package/all/copy-overwrite/scripts/lisa-hooks/parity-safety-net.sh +0 -16
  154. package/dist/core/native-safety-net-retirement.d.ts +0 -13
  155. package/dist/core/native-safety-net-retirement.d.ts.map +0 -1
  156. package/dist/core/native-safety-net-retirement.js +0 -23
  157. package/dist/core/native-safety-net-retirement.js.map +0 -1
  158. package/dist/migrations/retire-native-safety-net.d.ts +0 -18
  159. package/dist/migrations/retire-native-safety-net.d.ts.map +0 -1
  160. package/dist/migrations/retire-native-safety-net.js +0 -36
  161. package/dist/migrations/retire-native-safety-net.js.map +0 -1
  162. package/dist/opencode/plugin-templates/lisa-parity-safety-net.ts +0 -4
  163. package/dist/opencode/plugin-templates/parity-safety-net.sh +0 -16
  164. package/plugins/lisa/hooks/parity-safety-net.agy.sh +0 -6
  165. package/plugins/lisa/hooks/parity-safety-net.sh +0 -16
  166. package/plugins/lisa-agy/hooks/parity-safety-net.agy.sh +0 -6
  167. package/plugins/lisa-agy/hooks/parity-safety-net.sh +0 -16
  168. package/plugins/lisa-copilot/hooks/parity-safety-net.sh +0 -16
  169. package/plugins/lisa-cursor/hooks/parity-safety-net.sh +0 -16
  170. package/plugins/lisa-devin/hooks/parity-safety-net.sh +0 -16
  171. package/plugins/src/base/hooks/parity-safety-net.agy.sh +0 -6
  172. package/plugins/src/base/hooks/parity-safety-net.sh +0 -13
  173. package/scripts/deployed-guard-advice.mjs +0 -637
  174. package/scripts/fixtures/native-safety-net-retirement/Dockerfile +0 -5
  175. package/scripts/fixtures/native-safety-net-retirement/invoke-opencode.mjs +0 -13
  176. package/scripts/fixtures/native-safety-net-retirement/isolated-linker.mjs +0 -101
  177. package/scripts/fixtures/native-safety-net-retirement/journey.mjs +0 -381
  178. package/scripts/fixtures/native-safety-net-retirement/probes.mjs +0 -208
  179. package/scripts/fixtures/native-safety-net-retirement/reduced-core.mjs +0 -93
  180. package/scripts/generate-retired-safety-net-manifest.mjs +0 -56
  181. package/scripts/generate-scratch-supervisor-profile.mjs +0 -75
  182. package/scripts/lib/retired-safety-net-manifest.json +0 -150
  183. package/scripts/retire-native-safety-net.mjs +0 -237
  184. package/scripts/verify-native-safety-net-retirement.mjs +0 -287
@@ -1,287 +0,0 @@
1
- #!/usr/bin/env node
2
- /** Run the codified package-update journey in a genuinely isolated filesystem. */
3
- import assert from "node:assert/strict";
4
- import { spawnSync } from "node:child_process";
5
- import { createHash, randomUUID } from "node:crypto";
6
- import {
7
- chmodSync,
8
- copyFileSync,
9
- existsSync,
10
- mkdirSync,
11
- mkdtempSync,
12
- readFileSync,
13
- readdirSync,
14
- writeFileSync,
15
- } from "node:fs";
16
- import { tmpdir } from "node:os";
17
- import path from "node:path";
18
-
19
- const root = path.resolve(import.meta.dirname, "..");
20
- const fixture = path.join(
21
- root,
22
- "scripts/fixtures/native-safety-net-retirement"
23
- );
24
- const args = process.argv.slice(2);
25
- const CANDIDATE_OPTION = "--candidate";
26
- const flags = new Set(["--out", CANDIDATE_OPTION, "--image"]);
27
- assert.equal(args.length % 2, 0, "Each verifier option needs a value");
28
- for (let index = 0; index < args.length; index += 2) {
29
- assert.ok(
30
- flags.delete(args[index]),
31
- `Unknown or duplicate verifier option: ${args[index]}`
32
- );
33
- assert.ok(
34
- args[index + 1] && !args[index + 1].startsWith("--"),
35
- "Verifier option needs a value"
36
- );
37
- }
38
- const option = name => {
39
- const index = args.indexOf(name);
40
- return index < 0 ? undefined : args[index + 1];
41
- };
42
- const out = path.resolve(
43
- option("--out") || mkdtempSync(path.join(tmpdir(), "lisa-retirement-proof-"))
44
- );
45
- mkdirSync(out, { recursive: true, mode: 0o700 });
46
- assert.equal(
47
- readdirSync(out).length,
48
- 0,
49
- "Choose a fresh evidence directory; earlier packets must be preserved"
50
- );
51
- const transcript = [];
52
- const sha = bytes => createHash("sha256").update(bytes).digest("hex");
53
- const record = (file, value) =>
54
- writeFileSync(path.join(out, file), `${JSON.stringify(value, null, 2)}\n`, {
55
- mode: 0o600,
56
- });
57
-
58
- /** Bounded controller process; all tool output is retained in the packet. */
59
- function run(command, parameters, milliseconds = 25 * 60_000) {
60
- const result = spawnSync(command, parameters, {
61
- cwd: root,
62
- encoding: "utf8",
63
- timeout: milliseconds,
64
- maxBuffer: 32 * 1024 * 1024,
65
- });
66
- const row = {
67
- command,
68
- args: parameters,
69
- status: result.status,
70
- signal: result.signal,
71
- error: result.error?.message ?? null,
72
- stdout: result.stdout ?? "",
73
- stderr: result.stderr ?? "",
74
- };
75
- transcript.push(row);
76
- record("controller-transcript.json", transcript);
77
- assert.equal(result.error, undefined, JSON.stringify(row));
78
- assert.equal(result.signal, null, JSON.stringify(row));
79
- assert.equal(result.status, 0, JSON.stringify(row));
80
- return row.stdout;
81
- }
82
-
83
- /** Inspect the actual created container rather than trusting creation flags. */
84
- function inspect(id) {
85
- const data = JSON.parse(run("docker", ["inspect", id], 30_000))[0];
86
- assert.equal(data.Id, id);
87
- assert.deepEqual(data.Mounts, []);
88
- const host = data.HostConfig;
89
- for (const key of [
90
- "Binds",
91
- "Mounts",
92
- "VolumesFrom",
93
- "Devices",
94
- "DeviceRequests",
95
- "CapAdd",
96
- ])
97
- assert.ok(host[key] == null || host[key].length === 0, key);
98
- assert.equal(host.Privileged, false);
99
- assert.ok(host.CapDrop.includes("ALL"));
100
- assert.deepEqual(host.SecurityOpt, ["no-new-privileges"]);
101
- assert.equal(host.NetworkMode, "bridge");
102
- assert.equal(host.PidMode, "");
103
- assert.equal(host.IpcMode, "private");
104
- assert.equal(host.CgroupnsMode, "private");
105
- return data;
106
- }
107
-
108
- /** Public immutable baseline bytes, pinned independently of registry metadata. */
109
- async function baseline() {
110
- const metadataResponse = await fetch(
111
- "https://registry.npmjs.org/@codyswann%2Flisa/4.90.0",
112
- { signal: AbortSignal.timeout(60_000) }
113
- );
114
- assert.equal(metadataResponse.status, 200);
115
- const metadata = await metadataResponse.json();
116
- assert.equal(metadata.gitHead, "f7355b414bdf0c994b04fdb1cf9b0b8edc473ba9");
117
- const response = await fetch(
118
- "https://registry.npmjs.org/@codyswann/lisa/-/lisa-4.90.0.tgz",
119
- { signal: AbortSignal.timeout(120_000) }
120
- );
121
- assert.equal(response.status, 200);
122
- const bytes = Buffer.from(await response.arrayBuffer());
123
- const measured = {
124
- sha256: sha(bytes),
125
- integrity: `sha512-${createHash("sha512").update(bytes).digest("base64")}`,
126
- };
127
- assert.equal(
128
- measured.sha256,
129
- "9b8f63426cc9d75821a8e085842fd3cd053bd40d0b5502bec75cd89f41356fbf"
130
- );
131
- assert.equal(
132
- measured.integrity,
133
- "sha512-5CrCmSlov+Nj/1SuwHX9Nx4SHlezHc5e59Oest0oEnGrYOmJI3tuvBmLaHOHRnV+tlbAEf+ZO3aQ94I/GkZMdw=="
134
- );
135
- assert.equal(measured.integrity, metadata.dist.integrity);
136
- writeFileSync(path.join(out, "baseline.tgz"), bytes, { mode: 0o644 });
137
- record("baseline-identity.json", {
138
- version: "4.90.0",
139
- git_head: metadata.gitHead,
140
- ...measured,
141
- });
142
- }
143
-
144
- let id;
145
- try {
146
- assert.ok(
147
- existsSync(path.join(fixture, "journey.mjs")),
148
- "Run the source checkout's verifier, which contains its codified fixture."
149
- );
150
- await baseline();
151
- const candidate = path.join(out, "candidate.tgz");
152
- if (option(CANDIDATE_OPTION))
153
- copyFileSync(path.resolve(option(CANDIDATE_OPTION)), candidate);
154
- else run("bun", ["pm", "pack", "--filename", candidate]);
155
- // Public archives and fixture programs need to be readable after docker cp
156
- // preserves the host UID into a capability-dropped container. Parent stays700.
157
- chmodSync(candidate, 0o644);
158
- record("candidate-identity.json", {
159
- archive_sha256: sha(readFileSync(candidate)),
160
- verification_driver_head: run("git", ["rev-parse", "HEAD"], 30_000).trim(),
161
- verification_driver_worktree_status: run(
162
- "git",
163
- ["status", "--porcelain"],
164
- 30_000
165
- ),
166
- artifact_source: option(CANDIDATE_OPTION)
167
- ? "Caller-supplied immutable archive; source/release relationship must be verified separately"
168
- : "Packed from this checkout; dirty status is recorded and is not exact-commit proof",
169
- fixture: [
170
- "journey.mjs",
171
- "probes.mjs",
172
- "invoke-opencode.mjs",
173
- "Dockerfile",
174
- "reduced-core.mjs",
175
- "isolated-linker.mjs",
176
- ].map(file => ({
177
- file,
178
- sha256: sha(readFileSync(path.join(fixture, file))),
179
- })),
180
- });
181
- const image = option("--image") || "lisa-native-safety-net-retirement:v1";
182
- if (!option("--image")) run("docker", ["build", "--tag", image, fixture]);
183
- const imageData = JSON.parse(
184
- run("docker", ["image", "inspect", image], 30_000)
185
- )[0];
186
- const name = `lisa-native-safety-net-retirement-${randomUUID()}`;
187
- id = run(
188
- "docker",
189
- [
190
- "create",
191
- "--name",
192
- name,
193
- "--label",
194
- "lisa.verification=native-safety-net-retirement",
195
- "--cap-drop",
196
- "ALL",
197
- "--security-opt",
198
- "no-new-privileges",
199
- "--network",
200
- "bridge",
201
- "--ipc",
202
- "private",
203
- "--cgroupns",
204
- "private",
205
- "--pids-limit",
206
- "512",
207
- "--memory",
208
- "4g",
209
- "--cpus",
210
- "2",
211
- "--entrypoint",
212
- "/usr/bin/timeout",
213
- imageData.Id,
214
- "--signal=TERM",
215
- "--kill-after=10s",
216
- "20m",
217
- "node",
218
- "/proof/journey.mjs",
219
- ],
220
- 30_000
221
- ).trim();
222
- assert.match(id, /^[a-f0-9]{64}$/);
223
- record("container-lease.json", {
224
- id,
225
- name,
226
- image_id: imageData.Id,
227
- created_at: new Date().toISOString(),
228
- });
229
- record("isolation-inspection.json", inspect(id));
230
- run("docker", ["cp", `${fixture}/.`, `${id}:/proof`], 30_000);
231
- run(
232
- "docker",
233
- ["cp", path.join(out, "baseline.tgz"), `${id}:/baseline.tgz`],
234
- 30_000
235
- );
236
- run("docker", ["cp", candidate, `${id}:/candidate.tgz`], 30_000);
237
- const output = run("docker", ["start", "--attach", id]);
238
- console.log(output);
239
- const finished = inspect(id);
240
- record("final-inspection.json", finished);
241
- assert.equal(finished.State.Running, false);
242
- assert.equal(finished.State.ExitCode, 0);
243
- run("docker", ["cp", `${id}:/evidence`, path.join(out, "runtime")], 30_000);
244
- const result = JSON.parse(
245
- readFileSync(path.join(out, "runtime/retirement-proof.json"), "utf8")
246
- );
247
- assert.match(result.outcome, /^PASS:/);
248
- const isolated = JSON.parse(result.isolated_linker_update.stdout);
249
- assert.match(isolated.outcome, /^PASS:/);
250
- assert.deepEqual(
251
- isolated.before.results.map(row => row.status),
252
- [2, 2, 0]
253
- );
254
- assert.deepEqual(
255
- isolated.after.results.map(row => row.status),
256
- [0, 2, 0]
257
- );
258
- record("result.json", {
259
- outcome: result.outcome,
260
- archive_sha256: sha(readFileSync(candidate)),
261
- runtime_proof_sha256: sha(
262
- readFileSync(path.join(out, "runtime/retirement-proof.json"))
263
- ),
264
- container_id: id,
265
- observed_at: new Date().toISOString(),
266
- limits: result.boundary,
267
- });
268
- console.log(`Evidence: ${out}`);
269
- } finally {
270
- if (id) {
271
- // Collect failures too. Preserve the leased container for diagnosis; never
272
- // force-remove another process or silently overwrite a previous packet.
273
- const state = JSON.parse(run("docker", ["inspect", id], 30_000))[0];
274
- if (!state.State.Running && !existsSync(path.join(out, "runtime"))) {
275
- try {
276
- run(
277
- "docker",
278
- ["cp", `${id}:/evidence`, path.join(out, "runtime")],
279
- 30_000
280
- );
281
- } catch (error) {
282
- console.error(`Evidence collection failed: ${error.message}`);
283
- }
284
- }
285
- record("last-inspection.json", state);
286
- }
287
- }