@codyswann/lisa 4.92.1 → 4.92.2

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 (93) hide show
  1. package/all/copy-overwrite/scripts/lisa-enforcement-fallback.sh +11 -1
  2. package/dist/core/lisa-owned-hash-ledger.d.ts.map +1 -1
  3. package/dist/core/lisa-owned-hash-ledger.js +2 -0
  4. package/dist/core/lisa-owned-hash-ledger.js.map +1 -1
  5. package/dist/core/nightly-e2e-guard-behavior-certificate.js +2 -2
  6. package/dist/core/upstream-evidence-manifest.d.ts.map +1 -1
  7. package/dist/core/upstream-evidence-manifest.js +20 -3
  8. package/dist/core/upstream-evidence-manifest.js.map +1 -1
  9. package/package.json +4 -4
  10. package/plugins/lisa/.claude-plugin/plugin.json +1 -1
  11. package/plugins/lisa/.codex-plugin/plugin.json +1 -1
  12. package/plugins/lisa/.codex-plugin/skills/lisa-verification-lifecycle/SKILL.md +49 -0
  13. package/plugins/lisa/skills/lisa-verification-lifecycle/SKILL.md +49 -0
  14. package/plugins/lisa-agy/plugin.json +1 -1
  15. package/plugins/lisa-agy/skills/lisa-verification-lifecycle/SKILL.md +49 -0
  16. package/plugins/lisa-cdk/.claude-plugin/plugin.json +1 -1
  17. package/plugins/lisa-cdk/.codex-plugin/plugin.json +1 -1
  18. package/plugins/lisa-cdk-agy/plugin.json +1 -1
  19. package/plugins/lisa-cdk-copilot/.claude-plugin/plugin.json +1 -1
  20. package/plugins/lisa-cdk-cursor/.claude-plugin/plugin.json +1 -1
  21. package/plugins/lisa-cdk-devin/.claude-plugin/plugin.json +1 -1
  22. package/plugins/lisa-cdk-devin/.devin-plugin/plugin.json +1 -1
  23. package/plugins/lisa-copilot/.claude-plugin/plugin.json +1 -1
  24. package/plugins/lisa-copilot/skills/lisa-verification-lifecycle/SKILL.md +49 -0
  25. package/plugins/lisa-cursor/.claude-plugin/plugin.json +1 -1
  26. package/plugins/lisa-cursor/skills/lisa-verification-lifecycle/SKILL.md +49 -0
  27. package/plugins/lisa-devin/.claude-plugin/plugin.json +1 -1
  28. package/plugins/lisa-devin/.devin-plugin/plugin.json +1 -1
  29. package/plugins/lisa-devin/skills/lisa-verification-lifecycle/SKILL.md +49 -0
  30. package/plugins/lisa-expo/.claude-plugin/plugin.json +1 -1
  31. package/plugins/lisa-expo/.codex-plugin/plugin.json +1 -1
  32. package/plugins/lisa-expo-agy/plugin.json +1 -1
  33. package/plugins/lisa-expo-copilot/.claude-plugin/plugin.json +1 -1
  34. package/plugins/lisa-expo-cursor/.claude-plugin/plugin.json +1 -1
  35. package/plugins/lisa-expo-devin/.claude-plugin/plugin.json +1 -1
  36. package/plugins/lisa-expo-devin/.devin-plugin/plugin.json +1 -1
  37. package/plugins/lisa-harper-fabric/.claude-plugin/plugin.json +1 -1
  38. package/plugins/lisa-harper-fabric/.codex-plugin/plugin.json +1 -1
  39. package/plugins/lisa-harper-fabric-agy/plugin.json +1 -1
  40. package/plugins/lisa-harper-fabric-copilot/.claude-plugin/plugin.json +1 -1
  41. package/plugins/lisa-harper-fabric-cursor/.claude-plugin/plugin.json +1 -1
  42. package/plugins/lisa-harper-fabric-devin/.claude-plugin/plugin.json +1 -1
  43. package/plugins/lisa-harper-fabric-devin/.devin-plugin/plugin.json +1 -1
  44. package/plugins/lisa-nestjs/.claude-plugin/plugin.json +1 -1
  45. package/plugins/lisa-nestjs/.codex-plugin/plugin.json +1 -1
  46. package/plugins/lisa-nestjs-agy/plugin.json +1 -1
  47. package/plugins/lisa-nestjs-copilot/.claude-plugin/plugin.json +1 -1
  48. package/plugins/lisa-nestjs-cursor/.claude-plugin/plugin.json +1 -1
  49. package/plugins/lisa-nestjs-devin/.claude-plugin/plugin.json +1 -1
  50. package/plugins/lisa-nestjs-devin/.devin-plugin/plugin.json +1 -1
  51. package/plugins/lisa-openclaw/.claude-plugin/plugin.json +1 -1
  52. package/plugins/lisa-openclaw/.codex-plugin/plugin.json +1 -1
  53. package/plugins/lisa-openclaw-agy/plugin.json +1 -1
  54. package/plugins/lisa-openclaw-copilot/.claude-plugin/plugin.json +1 -1
  55. package/plugins/lisa-openclaw-cursor/.claude-plugin/plugin.json +1 -1
  56. package/plugins/lisa-openclaw-devin/.claude-plugin/plugin.json +1 -1
  57. package/plugins/lisa-openclaw-devin/.devin-plugin/plugin.json +1 -1
  58. package/plugins/lisa-phaser/.claude-plugin/plugin.json +1 -1
  59. package/plugins/lisa-phaser/.codex-plugin/plugin.json +1 -1
  60. package/plugins/lisa-phaser-agy/plugin.json +1 -1
  61. package/plugins/lisa-phaser-copilot/.claude-plugin/plugin.json +1 -1
  62. package/plugins/lisa-phaser-cursor/.claude-plugin/plugin.json +1 -1
  63. package/plugins/lisa-phaser-devin/.claude-plugin/plugin.json +1 -1
  64. package/plugins/lisa-phaser-devin/.devin-plugin/plugin.json +1 -1
  65. package/plugins/lisa-rails/.claude-plugin/plugin.json +1 -1
  66. package/plugins/lisa-rails/.codex-plugin/plugin.json +1 -1
  67. package/plugins/lisa-rails-agy/plugin.json +1 -1
  68. package/plugins/lisa-rails-copilot/.claude-plugin/plugin.json +1 -1
  69. package/plugins/lisa-rails-cursor/.claude-plugin/plugin.json +1 -1
  70. package/plugins/lisa-rails-devin/.claude-plugin/plugin.json +1 -1
  71. package/plugins/lisa-rails-devin/.devin-plugin/plugin.json +1 -1
  72. package/plugins/lisa-typescript/.claude-plugin/plugin.json +1 -1
  73. package/plugins/lisa-typescript/.codex-plugin/plugin.json +1 -1
  74. package/plugins/lisa-typescript-agy/plugin.json +1 -1
  75. package/plugins/lisa-typescript-copilot/.claude-plugin/plugin.json +1 -1
  76. package/plugins/lisa-typescript-cursor/.claude-plugin/plugin.json +1 -1
  77. package/plugins/lisa-typescript-devin/.claude-plugin/plugin.json +1 -1
  78. package/plugins/lisa-typescript-devin/.devin-plugin/plugin.json +1 -1
  79. package/plugins/lisa-wiki/.claude-plugin/plugin.json +1 -1
  80. package/plugins/lisa-wiki/.codex-plugin/plugin.json +1 -1
  81. package/plugins/lisa-wiki-agy/plugin.json +1 -1
  82. package/plugins/lisa-wiki-copilot/.claude-plugin/plugin.json +1 -1
  83. package/plugins/lisa-wiki-cursor/.claude-plugin/plugin.json +1 -1
  84. package/plugins/lisa-wiki-devin/.claude-plugin/plugin.json +1 -1
  85. package/plugins/lisa-wiki-devin/.devin-plugin/plugin.json +1 -1
  86. package/plugins/src/base/skills/lisa-verification-lifecycle/SKILL.md +49 -0
  87. package/scripts/fixtures/packaged-apply/Dockerfile +7 -0
  88. package/scripts/fixtures/packaged-apply/guard-cases.json +16 -0
  89. package/scripts/lib/packaged-apply-driver.mjs +292 -0
  90. package/scripts/lib/packaged-apply-isolation.d.mts +25 -0
  91. package/scripts/lib/packaged-apply-isolation.mjs +160 -0
  92. package/scripts/lisa-enforcement-fallback.sh +11 -1
  93. package/scripts/verify-packaged-apply.mjs +327 -0
@@ -0,0 +1,327 @@
1
+ #!/usr/bin/env node
2
+ /** Genuine packaged verification with a checked disposable filesystem boundary. */
3
+ import { execFile } from "node:child_process";
4
+ import { createHash, randomUUID } from "node:crypto";
5
+ import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
6
+ import os from "node:os";
7
+ import path from "node:path";
8
+ import { pathToFileURL } from "node:url";
9
+ import { parseArgs, promisify } from "node:util";
10
+
11
+ import {
12
+ assertDisposableContainer,
13
+ compareSnapshots,
14
+ preserveUnexpectedWrite,
15
+ refuseHostApply,
16
+ snapshotFiles,
17
+ } from "./lib/packaged-apply-isolation.mjs";
18
+
19
+ const execute = promisify(execFile);
20
+ const packageRoot = path.resolve(import.meta.dirname, "..");
21
+ const harnesses = [
22
+ "claude",
23
+ "codex",
24
+ "cursor",
25
+ "opencode",
26
+ "agy",
27
+ "copilot",
28
+ "devin",
29
+ "fleet",
30
+ ];
31
+
32
+ /**
33
+ * Bounded native command; no shell interpolation or operator credentials passed
34
+ * to the container. Docker itself retains its normal local daemon access.
35
+ * @param {string[]} args - Literal Docker arguments.
36
+ * @returns {Promise<string>} Native stdout.
37
+ */
38
+ async function docker(args) {
39
+ const result = await execute("docker", args, {
40
+ encoding: "utf8",
41
+ timeout: 25 * 60_000,
42
+ maxBuffer: 32 * 1024 * 1024,
43
+ });
44
+ return result.stdout;
45
+ }
46
+
47
+ /**
48
+ * @param {string} directory - Newly owned output directory.
49
+ * @param {string} name - Private evidence filename.
50
+ * @param {unknown} value - Evidence without raw operator configuration.
51
+ * @returns {Promise<void>}
52
+ */
53
+ async function record(directory, name, value) {
54
+ await writeFile(
55
+ path.join(directory, name),
56
+ `${JSON.stringify(value, null, 2)}\n`,
57
+ {
58
+ mode: 0o600,
59
+ flag: "wx",
60
+ }
61
+ );
62
+ }
63
+
64
+ /** @returns {Promise<void>} CLI action. */
65
+ async function main() {
66
+ const { values } = parseArgs({
67
+ options: {
68
+ backend: { type: "string", default: "host" },
69
+ archive: { type: "string" },
70
+ image: { type: "string" },
71
+ harness: { type: "string", default: "codex" },
72
+ output: { type: "string" },
73
+ preserve: { type: "string", multiple: true, default: [] },
74
+ "failure-control": { type: "boolean", default: false },
75
+ help: { type: "boolean", default: false },
76
+ },
77
+ });
78
+ if (values.help) {
79
+ console.log(
80
+ "Usage: node scripts/verify-packaged-apply.mjs --backend docker --archive FILE --image IMAGE --output NEW_DIRECTORY [--harness codex|fleet|claude|cursor|opencode|agy|copilot|devin] [--preserve FILE ...] [--failure-control]"
81
+ );
82
+ console.log(
83
+ "Default host preflight refuses without spawning apply. Build scripts/fixtures/packaged-apply/Dockerfile first. No host mounts or operator environment are forwarded."
84
+ );
85
+ return;
86
+ }
87
+ if (!harnesses.includes(values.harness))
88
+ throw new Error("Unsupported harness");
89
+ if (values["failure-control"] && !["fleet", "agy"].includes(values.harness)) {
90
+ throw new Error("The failed-child control requires --harness fleet or agy");
91
+ }
92
+ const { defaultUserMcpConfigPath } = await import(
93
+ pathToFileURL(path.join(packageRoot, "dist/agy/mcp-installer.js")).href
94
+ );
95
+ const agyDestination = defaultUserMcpConfigPath();
96
+ if (values.backend === "host")
97
+ refuseHostApply(values.harness, agyDestination);
98
+ if (
99
+ values.backend !== "docker" ||
100
+ !values.archive ||
101
+ !values.image ||
102
+ !values.output
103
+ ) {
104
+ throw new Error(
105
+ "Docker verification requires --archive FILE --image IMAGE --output NEW_DIRECTORY"
106
+ );
107
+ }
108
+ const archive = path.resolve(values.archive);
109
+ const archiveBytes = await readFile(archive);
110
+ const output = path.resolve(values.output);
111
+ await mkdir(output, { mode: 0o700 });
112
+ const ownedArchive = path.join(output, "input.tgz");
113
+ // Docker may retain the copying client's UID. Keep this public package
114
+ // readable inside the capability-dropped container; its host parent is 0700.
115
+ await writeFile(ownedArchive, archiveBytes, { mode: 0o644, flag: "wx" });
116
+ await chmod(ownedArchive, 0o644);
117
+ const driverBytes = await readFile(
118
+ path.join(import.meta.dirname, "lib/packaged-apply-driver.mjs")
119
+ );
120
+ const driverCopy = path.join(output, "driver.mjs");
121
+ await writeFile(driverCopy, driverBytes, { mode: 0o644, flag: "wx" });
122
+ await chmod(driverCopy, 0o644);
123
+ const casesBytes = await readFile(
124
+ path.join(import.meta.dirname, "fixtures/packaged-apply/guard-cases.json")
125
+ );
126
+ const casesCopy = path.join(output, "guard-cases.json");
127
+ await writeFile(casesCopy, casesBytes, { mode: 0o644, flag: "wx" });
128
+ await chmod(casesCopy, 0o644);
129
+ const files = [
130
+ ...new Set([
131
+ agyDestination,
132
+ path.join(os.homedir(), ".claude/settings.json"),
133
+ path.join(os.homedir(), ".claude/plugins/known_marketplaces.json"),
134
+ path.join(os.homedir(), ".codex/config.toml"),
135
+ ...values.preserve.map(file => path.resolve(file)),
136
+ ]),
137
+ ];
138
+ const before = await snapshotFiles(files, path.join(output, "before-images"));
139
+ await record(output, "before.json", before);
140
+ const image = JSON.parse(await docker(["image", "inspect", values.image]))[0];
141
+ if (!/^sha256:[a-f0-9]{64}$/u.test(image?.Id ?? ""))
142
+ throw new Error("Unresolved Docker image identity");
143
+ let id;
144
+ let failure;
145
+ let cleanupError;
146
+ let preservation = false;
147
+ try {
148
+ id = (
149
+ await docker([
150
+ "create",
151
+ "--name",
152
+ `lisa-verify-${randomUUID()}`,
153
+ "--label",
154
+ "lisa.verification=packaged-apply",
155
+ "--cap-drop",
156
+ "ALL",
157
+ "--security-opt",
158
+ "no-new-privileges",
159
+ "--network",
160
+ "bridge",
161
+ "--ipc",
162
+ "private",
163
+ "--cgroupns",
164
+ "private",
165
+ "--pids-limit",
166
+ "512",
167
+ "--memory",
168
+ "4g",
169
+ "--cpus",
170
+ "2",
171
+ "--env",
172
+ "LISA_DISPOSABLE_APPLY=1",
173
+ "--entrypoint",
174
+ "/usr/bin/timeout",
175
+ image.Id,
176
+ "--signal=TERM",
177
+ "--kill-after=10s",
178
+ "20m",
179
+ "/usr/local/bin/node",
180
+ "/lisa-verify-driver.mjs",
181
+ values.harness,
182
+ ...(values["failure-control"] ? ["failure-control"] : []),
183
+ ])
184
+ ).trim();
185
+ const inspected = JSON.parse(await docker(["inspect", id]))[0];
186
+ assertDisposableContainer(inspected, id);
187
+ await record(output, "preflight.json", {
188
+ container_id: id,
189
+ image_id: image.Id,
190
+ archive_sha256: createHash("sha256").update(archiveBytes).digest("hex"),
191
+ driver_sha256: createHash("sha256").update(driverBytes).digest("hex"),
192
+ guard_cases_sha256: createHash("sha256").update(casesBytes).digest("hex"),
193
+ harness: values.harness,
194
+ mounts: inspected.Mounts,
195
+ inspection: {
196
+ Id: inspected.Id,
197
+ State: inspected.State,
198
+ Mounts: inspected.Mounts,
199
+ HostConfig: Object.fromEntries(
200
+ [
201
+ "Binds",
202
+ "Mounts",
203
+ "VolumesFrom",
204
+ "Privileged",
205
+ "Devices",
206
+ "DeviceRequests",
207
+ "CapAdd",
208
+ "CapDrop",
209
+ "SecurityOpt",
210
+ "NetworkMode",
211
+ "PidMode",
212
+ "IpcMode",
213
+ "UsernsMode",
214
+ "CgroupnsMode",
215
+ ].map(key => [key, inspected.HostConfig[key] ?? null])
216
+ ),
217
+ },
218
+ isolation:
219
+ "disposable root filesystem; no host mounts or shared namespaces",
220
+ operator_home_overridden: false,
221
+ operator_credentials_forwarded: false,
222
+ host_destinations: files,
223
+ });
224
+ await docker(["cp", ownedArchive, `${id}:/lisa-input.tgz`]);
225
+ await docker(["cp", driverCopy, `${id}:/lisa-verify-driver.mjs`]);
226
+ await docker(["cp", casesCopy, `${id}:/lisa-guard-cases.json`]);
227
+ let stdout = "";
228
+ let childFailure;
229
+ try {
230
+ stdout = await docker(["start", "--attach", id]);
231
+ } catch (error) {
232
+ stdout = error.stdout ?? "";
233
+ childFailure = error;
234
+ }
235
+ await writeFile(path.join(output, "container.stdout.log"), stdout, {
236
+ mode: 0o600,
237
+ flag: "wx",
238
+ });
239
+ const terminal = JSON.parse(await docker(["inspect", id]))[0];
240
+ await record(output, "terminal.json", terminal.State);
241
+ await docker([
242
+ "cp",
243
+ `${id}:/lisa-proof.json`,
244
+ path.join(output, "native-proof.json"),
245
+ ]);
246
+ if (childFailure) throw childFailure;
247
+ if (terminal.State.Status !== "exited" || terminal.State.ExitCode !== 0) {
248
+ throw new Error(
249
+ `Native verification child exited ${terminal.State.ExitCode}`
250
+ );
251
+ }
252
+ } catch (error) {
253
+ failure = error;
254
+ await record(output, "failure.json", {
255
+ message: error.message,
256
+ stdout: error.stdout ?? null,
257
+ stderr: error.stderr ?? null,
258
+ });
259
+ } finally {
260
+ // Stop every process in the owned namespace before examining host state.
261
+ try {
262
+ if (id) await docker(["rm", "--force", "--volumes", id]);
263
+ } catch (error) {
264
+ cleanupError = error;
265
+ }
266
+ const after = await snapshotFiles(
267
+ files,
268
+ path.join(output, "after-images"),
269
+ { phase: "after" }
270
+ );
271
+ const changed = compareSnapshots(before, after);
272
+ const recovery = [];
273
+ for (const file of changed) {
274
+ if (after[file]?.present)
275
+ recovery.push({
276
+ ...(await preserveUnexpectedWrite(
277
+ file,
278
+ path.join(output, "recovery")
279
+ )),
280
+ prior_content: Object.hasOwn(before, file)
281
+ ? before[file].present
282
+ ? "captured privately"
283
+ : "absent"
284
+ : "unknown",
285
+ });
286
+ }
287
+ preservation = changed.length === 0;
288
+ await record(output, "preservation.json", {
289
+ before,
290
+ after,
291
+ changed,
292
+ recovery,
293
+ preserved: preservation,
294
+ container_removed: Boolean(id) && !cleanupError,
295
+ cleanup_error: cleanupError?.message ?? null,
296
+ restoration_attempted: false,
297
+ private_images:
298
+ "before-images/ and after-images/; filenames are SHA256 of each absolute path; never publish these directories",
299
+ limit:
300
+ "Declared product-config destinations; Docker infrastructure bookkeeping is expected",
301
+ });
302
+ }
303
+ if (cleanupError)
304
+ throw new Error(
305
+ `Could not stop/remove owned container ${id}: ${cleanupError.message}`
306
+ );
307
+ if (!preservation)
308
+ throw new Error(
309
+ `Unexpected outside write; stopped and preserved current bytes privately in ${output}`
310
+ );
311
+ if (failure) throw failure;
312
+ console.log(
313
+ JSON.stringify({
314
+ output,
315
+ harness: values.harness,
316
+ preserved: preservation,
317
+ native_agent_activation: "not established",
318
+ })
319
+ );
320
+ }
321
+
322
+ try {
323
+ await main();
324
+ } catch (error) {
325
+ console.error(error.message);
326
+ process.exitCode = 1;
327
+ }