feat(application): add isolated JavaScript replay
Expose one plan/execute replay contract through both CLI and MCP with exact source, input, runtime, sandbox, limit, and export commitments. Run selected ESM and extracted CommonJS/Rspack factories in a disposable Linux x64 Bubblewrap namespace with a content-addressed Node ELF closure, architecture-checked seccomp, delegated systemd cgroup limits, bounded protocol capture, cancellation, and observable cleanup. Preserve left and right observations as Evidence, derive differential comparisons without erasing unknowns, add optional separately authorized reproducers, and fail closed on stale plans or unavailable host boundaries. Add source-owned parser, sanitizer, clipboard, denial, timeout, OOM, protocol-forgery, and cancellation coverage; a real Linux verifier and workflow; regenerated catalogs and TypeDoc; and updated the packaged REA analysis skill for the 83-tool inventory.
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { readFile, realpath } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { BinarySession } from "../src/application/BinarySession.js";
|
||||
import {
|
||||
@@ -8,6 +10,9 @@ import {
|
||||
} from "../src/contracts/javascriptApplicationWorkflowExamples.js";
|
||||
import { createServer } from "../src/server/createServer.js";
|
||||
import { observed } from "./fixtures/analysisExecution.js";
|
||||
import { PermissionAuthority } from "../src/application/PermissionAuthority.js";
|
||||
import { createPermissionPolicy } from "../src/domain/permissionPolicy.js";
|
||||
import { controlledReplayOutputSchema } from "../src/domain/javascriptReplay.js";
|
||||
|
||||
describe("application workflow MCP parity", () => {
|
||||
it("traces and compares authenticated graph Evidence in the session", async () => {
|
||||
@@ -75,4 +80,160 @@ describe("application workflow MCP parity", () => {
|
||||
await session.close();
|
||||
}
|
||||
});
|
||||
|
||||
it("plans and executes the same controlled replay contract", async () => {
|
||||
const root = resolve("tests/fixtures/replay");
|
||||
const policy = {
|
||||
enabled: true,
|
||||
roots: [root],
|
||||
nodePath: process.execPath,
|
||||
bubblewrapPath: "/usr/bin/bwrap",
|
||||
systemdRunPath: "/usr/bin/systemd-run",
|
||||
systemctlPath: "/usr/bin/systemctl",
|
||||
shellPath: "/usr/bin/bash",
|
||||
};
|
||||
const ceiling = {
|
||||
capability: "javascript_replay" as const,
|
||||
roots: [root],
|
||||
executables: [
|
||||
policy.nodePath,
|
||||
policy.bubblewrapPath,
|
||||
policy.systemdRunPath,
|
||||
policy.systemctlPath,
|
||||
policy.shellPath,
|
||||
],
|
||||
environment_names: [],
|
||||
network: "none" as const,
|
||||
mount: true,
|
||||
};
|
||||
const authority = new PermissionAuthority(
|
||||
createPermissionPolicy(
|
||||
[ceiling],
|
||||
[
|
||||
{
|
||||
...ceiling,
|
||||
grant_id: "administrator:javascript_replay",
|
||||
lifetime: "administrator",
|
||||
operation_identity: null,
|
||||
expires_at: null,
|
||||
},
|
||||
],
|
||||
),
|
||||
);
|
||||
const session = new BinarySession(() => ({
|
||||
execute: () => Promise.resolve(observed(null)),
|
||||
close: () => Promise.resolve(),
|
||||
}));
|
||||
const server = createServer(session, session, {
|
||||
permissionAuthority: authority,
|
||||
javascriptReplayPolicy: policy,
|
||||
javascriptReplayHost: {
|
||||
readSource: async (path) => ({
|
||||
canonicalPath: await realpath(path),
|
||||
bytes: await readFile(path),
|
||||
}),
|
||||
identifyExecutable: async (path) => ({
|
||||
path,
|
||||
version: "fixture",
|
||||
sha256: "1".repeat(64),
|
||||
}),
|
||||
identifyWorker: async () => ({
|
||||
path: "/fixture/worker.js",
|
||||
version: "fixture-worker-1",
|
||||
sha256: "2".repeat(64),
|
||||
}),
|
||||
identifyRuntimeClosure: async (path) => [
|
||||
{
|
||||
sourcePath: path,
|
||||
destinationPath: "/runtime/node",
|
||||
sha256: "1".repeat(64),
|
||||
},
|
||||
],
|
||||
seccompDigest: () => "3".repeat(64),
|
||||
probe: async () => undefined,
|
||||
},
|
||||
javascriptReplayRunner: {
|
||||
execute: async (prepared) => ({
|
||||
schema_version: 1,
|
||||
plan_digest: prepared.publicPlan.plan_digest,
|
||||
outcomes: [
|
||||
{
|
||||
case_id: "heading",
|
||||
outcome: "return",
|
||||
value: { type: "heading", text: "Title" },
|
||||
input_sha256:
|
||||
prepared.publicPlan.cases[0]?.sha256 ?? "0".repeat(64),
|
||||
output_sha256: "2".repeat(64),
|
||||
truncated: false,
|
||||
},
|
||||
],
|
||||
stderr: "",
|
||||
termination: "completed",
|
||||
cleanup: { state: "complete", residual_resources: [] },
|
||||
limitations: ["fixture runner"],
|
||||
reproducer: null,
|
||||
}),
|
||||
},
|
||||
});
|
||||
const client = new Client({ name: "replay-parity-test", version: "1" });
|
||||
const [clientTransport, serverTransport] =
|
||||
InMemoryTransport.createLinkedPair();
|
||||
const input = {
|
||||
mode: "plan",
|
||||
left: {
|
||||
modules: [
|
||||
{
|
||||
alias: "parser",
|
||||
path: resolve(root, "parser.mjs"),
|
||||
format: "esm",
|
||||
role: "module",
|
||||
dependencies: {},
|
||||
},
|
||||
],
|
||||
entry_alias: "parser",
|
||||
entry_export: "default",
|
||||
},
|
||||
cases: [{ case_id: "heading", arguments: ["# Title"] }],
|
||||
approved: false,
|
||||
};
|
||||
try {
|
||||
await server.connect(serverTransport);
|
||||
await client.connect(clientTransport);
|
||||
const planned = await client.callTool({
|
||||
name: "run_controlled_replay",
|
||||
arguments: input,
|
||||
});
|
||||
expect(planned.isError).not.toBe(true);
|
||||
const digest = controlledReplayOutputSchema.parse(
|
||||
planned.structuredContent,
|
||||
).plan?.plan_digest;
|
||||
expect(digest).toMatch(/^[a-f0-9]{64}$/u);
|
||||
const executed = await client.callTool({
|
||||
name: "run_controlled_replay",
|
||||
arguments: {
|
||||
...input,
|
||||
mode: "execute",
|
||||
approved: true,
|
||||
plan_digest: digest,
|
||||
},
|
||||
});
|
||||
expect(executed.isError).not.toBe(true);
|
||||
expect(executed.structuredContent).toMatchObject({
|
||||
phase: "execute",
|
||||
evidence: {
|
||||
authority: "controlled-replay",
|
||||
provider: { id: "rea-javascript-replay" },
|
||||
},
|
||||
});
|
||||
expect(session.exportEvidenceBundle().records).toEqual(
|
||||
expect.arrayContaining([
|
||||
expect.objectContaining({ authority: "controlled-replay" }),
|
||||
]),
|
||||
);
|
||||
} finally {
|
||||
await client.close();
|
||||
await server.close();
|
||||
await session.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ describe("browser MCP tools", () => {
|
||||
const connected = await connectBrowser(browser);
|
||||
|
||||
const tools = await connected.client.listTools();
|
||||
expect(tools.tools).toHaveLength(82);
|
||||
expect(tools.tools).toHaveLength(83);
|
||||
expect(tools.tools.map(({ name }) => name)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"list_browser_targets",
|
||||
|
||||
@@ -35,6 +35,10 @@ describe("runtime configuration", () => {
|
||||
expect(result.value.electronObservationEnabled).toBe(false);
|
||||
expect(result.value.electronCdpEndpoints).toEqual([]);
|
||||
expect(result.value.electronFileRoots).toEqual([]);
|
||||
expect(result.value.javascriptReplayPolicy).toMatchObject({
|
||||
enabled: false,
|
||||
roots: [],
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,6 +93,45 @@ describe("runtime configuration", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("builds a no-network JavaScript replay ceiling only when enabled", () => {
|
||||
const result = parseConfig({
|
||||
REA_JAVASCRIPT_REPLAY_ENABLED: "true",
|
||||
REA_JAVASCRIPT_REPLAY_ROOTS_JSON: '["/tmp/extracted-modules"]',
|
||||
REA_JAVASCRIPT_REPLAY_NODE_PATH: "/opt/node/bin/node",
|
||||
});
|
||||
if (!result.ok) throw result.error;
|
||||
expect(result.value.permissionCeilings).toContainEqual({
|
||||
capability: "javascript_replay",
|
||||
roots: ["/tmp/extracted-modules"],
|
||||
executables: [
|
||||
"/opt/node/bin/node",
|
||||
"/usr/bin/bwrap",
|
||||
"/usr/bin/systemd-run",
|
||||
"/usr/bin/systemctl",
|
||||
"/usr/bin/bash",
|
||||
],
|
||||
environment_names: [],
|
||||
network: "none",
|
||||
mount: true,
|
||||
});
|
||||
expect(result.value.administratorPermissionGrants).toContainEqual(
|
||||
expect.objectContaining({
|
||||
capability: "javascript_replay",
|
||||
lifetime: "administrator",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
it("rejects relative JavaScript replay roots and executables", () => {
|
||||
expect(
|
||||
parseConfig({ REA_JAVASCRIPT_REPLAY_ROOTS_JSON: '["relative/module"]' })
|
||||
.ok,
|
||||
).toBe(false);
|
||||
expect(
|
||||
parseConfig({ REA_JAVASCRIPT_REPLAY_NODE_PATH: "relative/node" }).ok,
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects relative Electron file roots", () => {
|
||||
expect(
|
||||
parseConfig({ REA_ELECTRON_FILE_ROOTS_JSON: '["relative/app"]' }).ok,
|
||||
|
||||
@@ -60,7 +60,7 @@ describe("tool contract surface", () => {
|
||||
...ELECTRON_TOOL_CONTRACTS,
|
||||
...APPLICATION_TOOL_CONTRACTS,
|
||||
];
|
||||
expect(contracts).toHaveLength(64);
|
||||
expect(contracts).toHaveLength(65);
|
||||
for (const contract of contracts) {
|
||||
const inputSchema = contractJsonSchema(contract.inputSchema);
|
||||
const outputSchema = contractJsonSchema(contract.outputSchema);
|
||||
@@ -150,7 +150,7 @@ describe("tool contract surface", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("publishes no unconstrained output-schema holes across all 82 tools", () => {
|
||||
it("publishes no unconstrained output-schema holes across all 83 tools", () => {
|
||||
const contracts = [
|
||||
...OFFICIAL_TOOL_CONTRACTS,
|
||||
...ENHANCED_TOOL_CONTRACTS,
|
||||
@@ -161,7 +161,7 @@ describe("tool contract surface", () => {
|
||||
...APPLICATION_TOOL_CONTRACTS,
|
||||
...SESSION_TOOL_CONTRACTS,
|
||||
];
|
||||
expect(contracts).toHaveLength(82);
|
||||
expect(contracts).toHaveLength(83);
|
||||
for (const contract of contracts) {
|
||||
const schema = contractJsonSchema(contract.outputSchema);
|
||||
expect(emptySchemaPaths(schema), contract.name).toEqual([]);
|
||||
|
||||
@@ -25,6 +25,7 @@ import {
|
||||
ProviderAdapterError,
|
||||
ProviderSelectionError,
|
||||
PermissionRequiredError,
|
||||
ReplayPlanStaleError,
|
||||
UnknownRegistryError,
|
||||
projectAnalysisError,
|
||||
type AnalysisError,
|
||||
@@ -170,10 +171,14 @@ describe("analysis error projection", () => {
|
||||
false,
|
||||
true,
|
||||
),
|
||||
ReplayPlanStaleError: new ReplayPlanStaleError(
|
||||
"a".repeat(64),
|
||||
"b".repeat(64),
|
||||
),
|
||||
} satisfies Readonly<Record<AnalysisErrorTag, AnalysisError>>;
|
||||
const errors = Object.values(byTag);
|
||||
const projected = errors.map(projectAnalysisError);
|
||||
expect(projected).toHaveLength(26);
|
||||
expect(projected).toHaveLength(27);
|
||||
const serialized = JSON.stringify(projected);
|
||||
for (const hidden of [
|
||||
"secret-token",
|
||||
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export default function busyLoop() {
|
||||
while (true) {
|
||||
// Intentionally consume the committed wall-clock budget.
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
202(module, exports, require) {
|
||||
require.r(exports);
|
||||
require.d(exports, {
|
||||
normalize: () => normalize,
|
||||
});
|
||||
const normalize = (value) => ({
|
||||
text: value.replaceAll("\r\n", "\n"),
|
||||
bytes: value.length,
|
||||
});
|
||||
}
|
||||
+1
@@ -0,0 +1 @@
|
||||
export default async () => import("node:fs");
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export default function fail(value) {
|
||||
throw new TypeError(`fixture:${value}`);
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
export default function allocateUntilKilled() {
|
||||
const retained = [];
|
||||
while (true) {
|
||||
const allocation = new Uint8Array(1024 * 1024);
|
||||
allocation.fill(1);
|
||||
retained.push(allocation);
|
||||
}
|
||||
}
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
export default function parseMarkdown(value) {
|
||||
if (value.startsWith("# "))
|
||||
return { type: "heading", depth: 1, text: value.slice(2) };
|
||||
if (/^\*\*.*\*\*$/u.test(value))
|
||||
return { type: "strong", text: value.slice(2, -2) };
|
||||
return { type: "paragraph", text: value.replaceAll("\r\n", "\n") };
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
export default function parseMarkdown(value) {
|
||||
if (value.startsWith("# ")) return { type: "heading", text: value.slice(2) };
|
||||
if (/^\*\*.*\*\*$/u.test(value))
|
||||
return { type: "strong", text: value.slice(2, -2) };
|
||||
return { type: "paragraph", text: value.replaceAll("\r\n", "\n") };
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
export default () =>
|
||||
new Proxy(
|
||||
{ hidden: true },
|
||||
{
|
||||
ownKeys() {
|
||||
throw new Error("proxy trap must not run");
|
||||
},
|
||||
},
|
||||
);
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
101(module) {
|
||||
module.exports.sanitize = (value) => value
|
||||
.replace(/<script[^>]*>[\s\S]*?<\/script>/giu, "")
|
||||
.replace(/\son\w+=[^\s>]+/giu, "")
|
||||
.replace(/javascript:/giu, "");
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
export default function attempt() {
|
||||
return {
|
||||
process: typeof process,
|
||||
require: typeof require,
|
||||
fetch: typeof fetch,
|
||||
buffer: typeof Buffer,
|
||||
timer: typeof setTimeout,
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
303(module, exports, require) {
|
||||
module.exports = () => require("node:fs");
|
||||
}
|
||||
@@ -131,7 +131,7 @@ describe("full MCP integration with multi-tool sequences", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves the complete 82-tool inventory with a session", async () => {
|
||||
it("preserves the complete 83-tool inventory with a session", async () => {
|
||||
const session = new BinarySession(
|
||||
(_path) =>
|
||||
({
|
||||
@@ -154,7 +154,7 @@ describe("full MCP integration with multi-tool sequences", () => {
|
||||
await client.connect(clientTransport);
|
||||
|
||||
const listed = await client.listTools();
|
||||
expect(listed.tools).toHaveLength(82);
|
||||
expect(listed.tools).toHaveLength(83);
|
||||
const names = listed.tools.map((t) => t.name);
|
||||
expect(names).toContain("open_binary");
|
||||
expect(names).toContain("close_binary");
|
||||
|
||||
@@ -0,0 +1,425 @@
|
||||
import { mkdtemp, readFile, realpath, rm, stat } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join, resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { runControlledReplay } from "../src/application/JavaScriptReplayService.js";
|
||||
import type {
|
||||
JavaScriptReplayHost,
|
||||
JavaScriptReplayPolicy,
|
||||
JavaScriptReplayRunner,
|
||||
} from "../src/application/JavaScriptReplayPlanning.js";
|
||||
import { PermissionAuthority } from "../src/application/PermissionAuthority.js";
|
||||
import { createPermissionPolicy } from "../src/domain/permissionPolicy.js";
|
||||
import {
|
||||
controlledReplayInputSchema,
|
||||
controlledReplayOutputSchema,
|
||||
} from "../src/domain/javascriptReplay.js";
|
||||
|
||||
const root = resolve("tests/fixtures/replay");
|
||||
const policy: JavaScriptReplayPolicy = {
|
||||
enabled: true,
|
||||
roots: [root],
|
||||
nodePath: process.execPath,
|
||||
bubblewrapPath: "/usr/bin/bwrap",
|
||||
systemdRunPath: "/usr/bin/systemd-run",
|
||||
systemctlPath: "/usr/bin/systemctl",
|
||||
shellPath: "/usr/bin/bash",
|
||||
};
|
||||
|
||||
const host: JavaScriptReplayHost = {
|
||||
readSource: async (path, maximumBytes) => {
|
||||
const canonicalPath = await realpath(path);
|
||||
const bytes = await readFile(canonicalPath);
|
||||
if (bytes.byteLength > maximumBytes) throw new RangeError("fixture limit");
|
||||
return { canonicalPath, bytes };
|
||||
},
|
||||
identifyExecutable: async (path) => ({
|
||||
path,
|
||||
version: "fixture-1",
|
||||
sha256: "1".repeat(64),
|
||||
}),
|
||||
identifyWorker: async () => ({
|
||||
path: "/fixture/worker.js",
|
||||
version: "fixture-worker-1",
|
||||
sha256: "2".repeat(64),
|
||||
}),
|
||||
identifyRuntimeClosure: async (path) => [
|
||||
{
|
||||
sourcePath: path,
|
||||
destinationPath: "/runtime/node",
|
||||
sha256: "1".repeat(64),
|
||||
},
|
||||
],
|
||||
seccompDigest: () => "3".repeat(64),
|
||||
probe: async () => undefined,
|
||||
};
|
||||
|
||||
const authority = (exportRoot?: string): PermissionAuthority => {
|
||||
const ceiling = {
|
||||
capability: "javascript_replay" as const,
|
||||
roots: [root],
|
||||
executables: [
|
||||
policy.nodePath,
|
||||
policy.bubblewrapPath,
|
||||
policy.systemdRunPath,
|
||||
policy.systemctlPath,
|
||||
policy.shellPath,
|
||||
],
|
||||
environment_names: [],
|
||||
network: "none" as const,
|
||||
mount: true,
|
||||
};
|
||||
const exportCeiling =
|
||||
exportRoot === undefined
|
||||
? []
|
||||
: [
|
||||
{
|
||||
capability: "evidence_write" as const,
|
||||
roots: [exportRoot],
|
||||
executables: [],
|
||||
environment_names: [],
|
||||
network: "none" as const,
|
||||
mount: false,
|
||||
},
|
||||
];
|
||||
return new PermissionAuthority(
|
||||
createPermissionPolicy(
|
||||
[ceiling, ...exportCeiling],
|
||||
[
|
||||
{
|
||||
...ceiling,
|
||||
grant_id: "administrator:javascript_replay",
|
||||
lifetime: "administrator",
|
||||
operation_identity: null,
|
||||
expires_at: null,
|
||||
},
|
||||
...exportCeiling.map((item) => ({
|
||||
...item,
|
||||
grant_id: "administrator:evidence_write",
|
||||
lifetime: "administrator" as const,
|
||||
operation_identity: null,
|
||||
expires_at: null,
|
||||
})),
|
||||
],
|
||||
),
|
||||
);
|
||||
};
|
||||
|
||||
const input = (
|
||||
mode: "plan" | "execute",
|
||||
path = resolve(root, "parser.mjs"),
|
||||
) => ({
|
||||
mode,
|
||||
left: {
|
||||
modules: [
|
||||
{
|
||||
alias: "parser",
|
||||
path,
|
||||
format: "esm" as const,
|
||||
role: "module" as const,
|
||||
dependencies: {},
|
||||
},
|
||||
],
|
||||
entry_alias: "parser",
|
||||
entry_export: "default",
|
||||
},
|
||||
cases: [{ case_id: "heading", arguments: ["# Title"] }],
|
||||
approved: mode === "execute",
|
||||
});
|
||||
|
||||
const completedRunner = (): JavaScriptReplayRunner => ({
|
||||
execute: async (prepared) => ({
|
||||
schema_version: 1,
|
||||
plan_digest: prepared.publicPlan.plan_digest,
|
||||
outcomes: [
|
||||
{
|
||||
case_id: "heading",
|
||||
outcome: "return",
|
||||
value: { type: "heading", text: "Title" },
|
||||
input_sha256: prepared.publicPlan.cases[0]?.sha256 ?? "0".repeat(64),
|
||||
output_sha256: "2".repeat(64),
|
||||
truncated: false,
|
||||
},
|
||||
],
|
||||
stderr: "",
|
||||
termination: "completed",
|
||||
cleanup: { state: "complete", residual_resources: [] },
|
||||
limitations: ["fixture runner"],
|
||||
reproducer: null,
|
||||
}),
|
||||
});
|
||||
|
||||
describe("controlled JavaScript replay", () => {
|
||||
it("rejects relative paths and more than 128 combined cases", () => {
|
||||
expect(
|
||||
controlledReplayInputSchema.safeParse({
|
||||
...input("plan", "relative/parser.mjs"),
|
||||
}).success,
|
||||
).toBe(false);
|
||||
expect(
|
||||
controlledReplayInputSchema.safeParse({
|
||||
...input("plan"),
|
||||
cases: Array.from({ length: 65 }, (_, index) => ({
|
||||
case_id: `explicit-${String(index)}`,
|
||||
arguments: [],
|
||||
})),
|
||||
generator: {
|
||||
preset: "parser-boundaries",
|
||||
seed: 1,
|
||||
count: 64,
|
||||
},
|
||||
}).success,
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("rejects oversized aggregate cases before probing or reading", async () => {
|
||||
const probe = vi.fn(host.probe);
|
||||
const readSource = vi.fn(host.readSource);
|
||||
const result = await runControlledReplay(
|
||||
{
|
||||
policy,
|
||||
host: { ...host, probe, readSource },
|
||||
runner: completedRunner(),
|
||||
authority: authority(),
|
||||
},
|
||||
{
|
||||
...input("plan"),
|
||||
cases: [{ case_id: "large", arguments: ["too large"] }],
|
||||
limits: { input_bytes: 1 },
|
||||
},
|
||||
);
|
||||
expect(result.ok).toBe(false);
|
||||
expect(probe).not.toHaveBeenCalled();
|
||||
expect(readSource).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("returns a deterministic plan without admitting application code", async () => {
|
||||
const execute = vi.fn(completedRunner().execute);
|
||||
const first = await runControlledReplay(
|
||||
{ policy, host, runner: { execute }, authority: authority() },
|
||||
input("plan"),
|
||||
);
|
||||
const second = await runControlledReplay(
|
||||
{ policy, host, runner: { execute }, authority: authority() },
|
||||
input("plan"),
|
||||
);
|
||||
expect(first).toEqual(second);
|
||||
expect(execute).not.toHaveBeenCalled();
|
||||
expect(first.ok && first.value).toMatchObject({
|
||||
phase: "plan",
|
||||
plan: { network: "none", filesystem: { host_writes: false } },
|
||||
evidence: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects a stale digest before worker admission", async () => {
|
||||
const execute = vi.fn(completedRunner().execute);
|
||||
const result = await runControlledReplay(
|
||||
{ policy, host, runner: { execute }, authority: authority() },
|
||||
{ ...input("execute"), plan_digest: "0".repeat(64) },
|
||||
);
|
||||
expect(result.ok).toBe(false);
|
||||
expect(!result.ok && result.error._tag).toBe("ReplayPlanStaleError");
|
||||
expect(execute).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("creates controlled-replay Evidence after an approved exact plan", async () => {
|
||||
const dependencies = {
|
||||
policy,
|
||||
host,
|
||||
runner: completedRunner(),
|
||||
authority: authority(),
|
||||
};
|
||||
const planned = await runControlledReplay(dependencies, input("plan"));
|
||||
if (
|
||||
!planned.ok ||
|
||||
typeof planned.value !== "object" ||
|
||||
planned.value === null ||
|
||||
Array.isArray(planned.value)
|
||||
)
|
||||
throw new Error("missing fixture plan");
|
||||
const plan = planned.value.plan;
|
||||
if (
|
||||
typeof plan !== "object" ||
|
||||
plan === null ||
|
||||
Array.isArray(plan) ||
|
||||
typeof plan.plan_digest !== "string"
|
||||
)
|
||||
throw new Error("missing fixture digest");
|
||||
const executed = await runControlledReplay(dependencies, {
|
||||
...input("execute"),
|
||||
plan_digest: plan.plan_digest,
|
||||
});
|
||||
expect(executed.ok && executed.value).toMatchObject({
|
||||
phase: "execute",
|
||||
plan: null,
|
||||
evidence: {
|
||||
provider: { id: "rea-javascript-replay" },
|
||||
authority: "controlled-replay",
|
||||
confidence: "observed",
|
||||
environment: { isolation: "container" },
|
||||
},
|
||||
});
|
||||
if (!executed.ok) throw executed.error;
|
||||
const output = controlledReplayOutputSchema.parse(executed.value);
|
||||
expect(output.source_evidence).toHaveLength(1);
|
||||
expect(output.source_evidence[0]?.confidence).toBe("observed");
|
||||
expect(output.evidence?.evidence_links).toEqual([
|
||||
output.source_evidence[0]?.evidence_id,
|
||||
]);
|
||||
});
|
||||
|
||||
it("cannot read or execute when replay is disabled", async () => {
|
||||
const readSource = vi.fn(host.readSource);
|
||||
const execute = vi.fn(completedRunner().execute);
|
||||
const result = await runControlledReplay(
|
||||
{
|
||||
policy: { ...policy, enabled: false },
|
||||
host: { ...host, readSource },
|
||||
runner: { execute },
|
||||
authority: authority(),
|
||||
},
|
||||
input("plan"),
|
||||
);
|
||||
expect(result.ok).toBe(false);
|
||||
expect(readSource).not.toHaveBeenCalled();
|
||||
expect(execute).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("changes the commitment when selected module bytes change", async () => {
|
||||
const dependencies = {
|
||||
policy,
|
||||
host,
|
||||
runner: completedRunner(),
|
||||
authority: authority(),
|
||||
};
|
||||
const left = await runControlledReplay(dependencies, input("plan"));
|
||||
const right = await runControlledReplay(
|
||||
dependencies,
|
||||
input("plan", resolve(root, "parser-v2.mjs")),
|
||||
);
|
||||
expect(left.ok && right.ok && left.value).not.toEqual(
|
||||
right.ok && right.value,
|
||||
);
|
||||
});
|
||||
|
||||
it("projects an observed cancelled termination through the shared error algebra", async () => {
|
||||
const execute = vi.fn<JavaScriptReplayRunner["execute"]>(
|
||||
async (prepared) => ({
|
||||
schema_version: 1,
|
||||
plan_digest: prepared.publicPlan.plan_digest,
|
||||
outcomes: [
|
||||
{
|
||||
case_id: "heading",
|
||||
outcome: "cancelled",
|
||||
input_sha256:
|
||||
prepared.publicPlan.cases[0]?.sha256 ?? "0".repeat(64),
|
||||
output_sha256: null,
|
||||
truncated: false,
|
||||
},
|
||||
],
|
||||
stderr: "",
|
||||
termination: "cancelled",
|
||||
cleanup: { state: "complete", residual_resources: [] },
|
||||
limitations: ["fixture cancellation"],
|
||||
reproducer: null,
|
||||
}),
|
||||
);
|
||||
const dependencies = {
|
||||
policy,
|
||||
host,
|
||||
runner: { execute },
|
||||
authority: authority(),
|
||||
};
|
||||
const planned = await runControlledReplay(dependencies, input("plan"));
|
||||
if (!planned.ok) throw planned.error;
|
||||
const plan = controlledReplayOutputSchema.parse(planned.value).plan;
|
||||
if (plan === null) throw new Error("missing cancellation plan");
|
||||
const controller = new AbortController();
|
||||
const result = await runControlledReplay(
|
||||
dependencies,
|
||||
{
|
||||
...input("execute"),
|
||||
plan_digest: plan.plan_digest,
|
||||
},
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
expect(result.ok).toBe(false);
|
||||
expect(!result.ok && result.error._tag).toBe("AnalysisCancelledError");
|
||||
expect(execute).toHaveBeenCalledWith(
|
||||
expect.any(Object),
|
||||
policy,
|
||||
controller.signal,
|
||||
);
|
||||
});
|
||||
|
||||
it("does not admit a worker after cancellation during planning", async () => {
|
||||
const controller = new AbortController();
|
||||
const execute = vi.fn(completedRunner().execute);
|
||||
const result = await runControlledReplay(
|
||||
{
|
||||
policy,
|
||||
host: {
|
||||
...host,
|
||||
probe: async () => {
|
||||
controller.abort();
|
||||
},
|
||||
},
|
||||
runner: { execute },
|
||||
authority: authority(),
|
||||
},
|
||||
{ ...input("execute"), plan_digest: "0".repeat(64) },
|
||||
{ signal: controller.signal },
|
||||
);
|
||||
expect(result.ok).toBe(false);
|
||||
expect(!result.ok && result.error._tag).toBe("AnalysisCancelledError");
|
||||
expect(execute).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("exports an owner-only source-free reproducer after cleanup", async () => {
|
||||
const directory = await mkdtemp(join(tmpdir(), "rea-reproducer-test-"));
|
||||
const path = join(directory, "reproducer.json");
|
||||
const dependencies = {
|
||||
policy,
|
||||
host,
|
||||
runner: completedRunner(),
|
||||
authority: authority(directory),
|
||||
};
|
||||
const export_ = {
|
||||
path,
|
||||
approved: true,
|
||||
include_sources: false,
|
||||
};
|
||||
try {
|
||||
const planned = await runControlledReplay(dependencies, {
|
||||
...input("plan"),
|
||||
reproducer_export: export_,
|
||||
});
|
||||
if (!planned.ok) throw new Error("missing export plan");
|
||||
const plan = controlledReplayOutputSchema.parse(planned.value).plan;
|
||||
if (plan === null) throw new Error("missing export plan");
|
||||
const executed = await runControlledReplay(dependencies, {
|
||||
...input("execute"),
|
||||
reproducer_export: export_,
|
||||
plan_digest: plan.plan_digest,
|
||||
});
|
||||
expect(executed.ok && executed.value).toMatchObject({
|
||||
evidence: {
|
||||
normalized_result: {
|
||||
reproducer: { state: "written", path },
|
||||
},
|
||||
},
|
||||
});
|
||||
const metadata = await stat(path);
|
||||
expect(metadata.mode & 0o777).toBe(0o600);
|
||||
expect(JSON.parse(await readFile(path, "utf8"))).toMatchObject({
|
||||
schema_version: 1,
|
||||
sources: null,
|
||||
});
|
||||
} finally {
|
||||
await rm(directory, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,198 @@
|
||||
import { spawn } from "node:child_process";
|
||||
import { readFile } from "node:fs/promises";
|
||||
import { resolve } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
const fixture = async (name: string): Promise<string> =>
|
||||
readFile(resolve("tests/fixtures/replay", name), "utf8");
|
||||
|
||||
const runWorker = async (request: unknown) =>
|
||||
new Promise<{ code: number | null; stdout: string; stderr: string }>(
|
||||
(resolvePromise, reject) => {
|
||||
const child = spawn(
|
||||
process.execPath,
|
||||
[
|
||||
"--experimental-vm-modules",
|
||||
resolve("dist/replay/JavaScriptReplayWorker.js"),
|
||||
],
|
||||
{ stdio: ["pipe", "pipe", "pipe"] },
|
||||
);
|
||||
let stdout = "";
|
||||
let stderr = "";
|
||||
child.stdout.on("data", (chunk: Buffer) => {
|
||||
stdout += chunk.toString("utf8");
|
||||
});
|
||||
child.stderr.on("data", (chunk: Buffer) => {
|
||||
stderr += chunk.toString("utf8");
|
||||
});
|
||||
child.once("error", reject);
|
||||
child.once("close", (code) => resolvePromise({ code, stdout, stderr }));
|
||||
child.stdin.end(JSON.stringify(request));
|
||||
},
|
||||
);
|
||||
|
||||
const request = async (
|
||||
name: string,
|
||||
format: "esm" | "commonjs-factory",
|
||||
entryExport: string,
|
||||
arguments_: readonly unknown[],
|
||||
) => ({
|
||||
schemaVersion: 1,
|
||||
left: {
|
||||
modules: [
|
||||
{
|
||||
alias: "entry",
|
||||
format,
|
||||
dependencies: {},
|
||||
source: await fixture(name),
|
||||
},
|
||||
],
|
||||
entryAlias: "entry",
|
||||
entryExport,
|
||||
},
|
||||
cases: [
|
||||
{
|
||||
caseId: "case",
|
||||
arguments: arguments_,
|
||||
inputSha256: "a".repeat(64),
|
||||
},
|
||||
],
|
||||
determinism: {
|
||||
clockIso: "2000-01-01T00:00:00.000Z",
|
||||
randomSeed: 7,
|
||||
},
|
||||
limits: { resultDepth: 16, resultNodes: 10_000, exceptionBytes: 4096 },
|
||||
});
|
||||
|
||||
describe("disposable JavaScript replay worker", () => {
|
||||
it("runs an ESM parser with projected plain data", async () => {
|
||||
const result = await runWorker(
|
||||
await request("parser.mjs", "esm", "default", ["# Title"]),
|
||||
);
|
||||
expect(result.code).toBe(0);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
left: [
|
||||
{
|
||||
outcome: "return",
|
||||
value: { type: "heading", text: "Title" },
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("supports extracted Rspack factories and helper-defined exports", async () => {
|
||||
const result = await runWorker(
|
||||
await request("clipboard.factory.txt", "commonjs-factory", "normalize", [
|
||||
"a\r\nb",
|
||||
]),
|
||||
);
|
||||
expect(result.code).toBe(0);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
left: [
|
||||
{
|
||||
outcome: "return",
|
||||
value: { text: "a\nb", bytes: 4 },
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("runs the source-owned sanitizer fixture", async () => {
|
||||
const result = await runWorker(
|
||||
await request("sanitizer.factory.txt", "commonjs-factory", "sanitize", [
|
||||
"<script>alert(1)</script><b onclick=bad>ok</b>",
|
||||
]),
|
||||
);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
left: [{ outcome: "return", value: "<b>ok</b>" }],
|
||||
});
|
||||
});
|
||||
|
||||
it("denies dynamic imports and undeclared requires", async () => {
|
||||
const dynamic = await runWorker(
|
||||
await request("dynamic-import.mjs", "esm", "default", []),
|
||||
);
|
||||
expect(JSON.parse(dynamic.stdout)).toMatchObject({
|
||||
left: [
|
||||
{
|
||||
outcome: "denied",
|
||||
exception: {
|
||||
message: "Dynamic import is unavailable in controlled replay",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
const undeclared = await runWorker(
|
||||
await request(
|
||||
"undeclared-require.factory.txt",
|
||||
"commonjs-factory",
|
||||
"default",
|
||||
[],
|
||||
),
|
||||
);
|
||||
expect(JSON.parse(undeclared.stdout)).toMatchObject({
|
||||
left: [
|
||||
{
|
||||
outcome: "denied",
|
||||
exception: { message: "Undeclared require: node:fs" },
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("retains exceptions as observations", async () => {
|
||||
const result = await runWorker(
|
||||
await request("exception.mjs", "esm", "default", ["value"]),
|
||||
);
|
||||
expect(result.code).toBe(0);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
left: [
|
||||
{
|
||||
outcome: "exception",
|
||||
exception: { name: "TypeError", message: "fixture:value" },
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
it("rejects Proxy results without invoking descriptor traps", async () => {
|
||||
const result = await runWorker(
|
||||
await request("proxy-result.mjs", "esm", "default", []),
|
||||
);
|
||||
expect(result.code).toBe(0);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
left: [
|
||||
{
|
||||
outcome: "serialization_error",
|
||||
exception: {
|
||||
name: "TypeError",
|
||||
message: "Proxy replay results are unavailable",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
expect(result.stderr).not.toContain("proxy trap must not run");
|
||||
});
|
||||
|
||||
it("does not expose ambient process, require, network, buffers, or timers", async () => {
|
||||
const result = await runWorker(
|
||||
await request("side-effect-attempt.mjs", "esm", "default", []),
|
||||
);
|
||||
expect(result.code).toBe(0);
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({
|
||||
left: [
|
||||
{
|
||||
outcome: "return",
|
||||
value: {
|
||||
process: "undefined",
|
||||
require: "undefined",
|
||||
fetch: "undefined",
|
||||
buffer: "undefined",
|
||||
timer: "undefined",
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -105,7 +105,11 @@ describe("canonical product catalog", () => {
|
||||
catalog.providers.find(
|
||||
({ id }) => id === JAVASCRIPT_APPLICATION_WORKFLOW_PROVIDER.id,
|
||||
)?.capabilities,
|
||||
).toEqual(["compare_application_versions", "trace_application_feature"]);
|
||||
).toEqual([
|
||||
"compare_application_versions",
|
||||
"run_controlled_replay",
|
||||
"trace_application_feature",
|
||||
]);
|
||||
expect(
|
||||
z.toJSONSchema(analysisSnapshotSchema).properties?.snapshot_version,
|
||||
).toMatchObject({
|
||||
|
||||
@@ -54,7 +54,7 @@ describe("guided prompts over MCP", () => {
|
||||
),
|
||||
);
|
||||
}
|
||||
expect((await client.listTools()).tools).toHaveLength(82);
|
||||
expect((await client.listTools()).tools).toHaveLength(83);
|
||||
const result = await client.getPrompt({
|
||||
name: "investigate_feature",
|
||||
arguments: {
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { parseReplayWorkerResponse } from "../src/replay/ReplayWorkerProtocol.js";
|
||||
|
||||
const digest = "1".repeat(64);
|
||||
const cases = [{ case_id: "case-1", sha256: digest }];
|
||||
const outcome = {
|
||||
case_id: "case-1",
|
||||
outcome: "return" as const,
|
||||
value: { parsed: true },
|
||||
input_sha256: digest,
|
||||
output_sha256: null,
|
||||
truncated: false as const,
|
||||
};
|
||||
|
||||
describe("replay worker protocol", () => {
|
||||
it("accepts only the exact committed case sequence", () => {
|
||||
expect(
|
||||
parseReplayWorkerResponse(
|
||||
{ schema_version: 1, left: [outcome] },
|
||||
cases,
|
||||
false,
|
||||
),
|
||||
).toMatchObject({ left: [outcome] });
|
||||
expect(() =>
|
||||
parseReplayWorkerResponse(
|
||||
{ schema_version: 1, left: [{ ...outcome, case_id: "forged" }] },
|
||||
cases,
|
||||
false,
|
||||
),
|
||||
).toThrow("case identity changed");
|
||||
expect(() =>
|
||||
parseReplayWorkerResponse(
|
||||
{
|
||||
schema_version: 1,
|
||||
left: [{ ...outcome, input_sha256: "2".repeat(64) }],
|
||||
},
|
||||
cases,
|
||||
false,
|
||||
),
|
||||
).toThrow("case identity changed");
|
||||
});
|
||||
|
||||
it("requires the exact differential shape and strict outcomes", () => {
|
||||
expect(() =>
|
||||
parseReplayWorkerResponse(
|
||||
{ schema_version: 1, left: [outcome] },
|
||||
cases,
|
||||
true,
|
||||
),
|
||||
).toThrow("differential response is incomplete");
|
||||
expect(() =>
|
||||
parseReplayWorkerResponse(
|
||||
{
|
||||
schema_version: 1,
|
||||
left: [{ ...outcome, unexpected: true }],
|
||||
},
|
||||
cases,
|
||||
false,
|
||||
),
|
||||
).toThrow();
|
||||
expect(() =>
|
||||
parseReplayWorkerResponse(
|
||||
{
|
||||
schema_version: 1,
|
||||
left: [{ ...outcome, outcome: "exception", value: undefined }],
|
||||
},
|
||||
cases,
|
||||
false,
|
||||
),
|
||||
).toThrow("Exception is missing");
|
||||
});
|
||||
});
|
||||
@@ -10,7 +10,7 @@ const fixturePath = fileURLToPath(
|
||||
);
|
||||
|
||||
describe("production stdio runtime", () => {
|
||||
it("starts the built entrypoint, lists 82 tools, calls one, and shuts down", async () => {
|
||||
it("starts the built entrypoint, lists 83 tools, calls one, and shuts down", async () => {
|
||||
const transport = new StdioClientTransport({
|
||||
command: process.execPath,
|
||||
args: [mainPath],
|
||||
@@ -32,7 +32,7 @@ describe("production stdio runtime", () => {
|
||||
try {
|
||||
await client.connect(transport);
|
||||
const tools = await client.listTools();
|
||||
expect(tools.tools).toHaveLength(82);
|
||||
expect(tools.tools).toHaveLength(83);
|
||||
const result = await client.callTool({
|
||||
name: "current_document",
|
||||
arguments: {},
|
||||
@@ -78,7 +78,7 @@ describe("production stdio runtime", () => {
|
||||
|
||||
try {
|
||||
await client.connect(transport);
|
||||
expect((await client.listTools()).tools).toHaveLength(82);
|
||||
expect((await client.listTools()).tools).toHaveLength(83);
|
||||
} finally {
|
||||
await client.close();
|
||||
await transport.close();
|
||||
|
||||
@@ -24,11 +24,11 @@ describe("server and catalog identity", () => {
|
||||
});
|
||||
expect(PRODUCT_IDENTITY.packageVersion).toBe(packageJson.version);
|
||||
expect(SDK_IDENTITY.server).toBe("2.0.0-beta.4");
|
||||
expect(CLI_COMMAND_NAMES).toHaveLength(42);
|
||||
expect(new Set(CLI_COMMAND_NAMES).size).toBe(42);
|
||||
expect(CLI_COMMAND_NAMES).toHaveLength(43);
|
||||
expect(new Set(CLI_COMMAND_NAMES).size).toBe(43);
|
||||
expect(CATALOG_IDENTITY.counts).toEqual({
|
||||
cli_commands: 42,
|
||||
mcp_tools: 82,
|
||||
cli_commands: 43,
|
||||
mcp_tools: 83,
|
||||
mcp_prompts: 6,
|
||||
mcp_resources: 2,
|
||||
mcp_resource_templates: 7,
|
||||
@@ -162,7 +162,7 @@ describe("server and catalog identity", () => {
|
||||
expect(status.structuredContent).toMatchObject({
|
||||
result: {
|
||||
server_identity: {
|
||||
catalog: { counts: { mcp_tools: 82, cli_commands: 42 } },
|
||||
catalog: { counts: { mcp_tools: 83, cli_commands: 43 } },
|
||||
alignment: { state: "mcp_server_restart_required" },
|
||||
},
|
||||
tool_availability: expect.arrayContaining([
|
||||
|
||||
@@ -142,7 +142,7 @@ describe("target-free MCP lifecycle", () => {
|
||||
expect(text(before)).toBe(
|
||||
"No app is open. Ask the user which app to investigate, then call open_binary with its local path.",
|
||||
);
|
||||
expect((await mcp.listTools()).tools).toHaveLength(82);
|
||||
expect((await mcp.listTools()).tools).toHaveLength(83);
|
||||
const deniedCapture = await mcp.callTool({
|
||||
name: "capture_process_scenario",
|
||||
arguments: {
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("canonical skill transaction", () => {
|
||||
expect(await readFile(`${destination}.rea.backup`, "utf8")).toBe(
|
||||
"stale managed skill\n",
|
||||
);
|
||||
expect(await readFile(destination, "utf8")).toContain('version: "17"');
|
||||
expect(await readFile(destination, "utf8")).toContain('version: "18"');
|
||||
expect(await readFile(destination, "utf8")).toContain(
|
||||
`tool_count: ${String(TOOL_CONTRACTS.length)}`,
|
||||
);
|
||||
|
||||
@@ -13,7 +13,7 @@ import { ELECTRON_TOOL_CONTRACTS } from "../src/contracts/electronToolContracts.
|
||||
import { APPLICATION_TOOL_CONTRACTS } from "../src/contracts/applicationToolContracts.js";
|
||||
|
||||
describe("tool contract inventory", () => {
|
||||
it("publishes 64 analysis contracts and eighteen session tools", () => {
|
||||
it("publishes 65 analysis contracts and eighteen session tools", () => {
|
||||
expect(OFFICIAL_TOOL_CONTRACTS).toHaveLength(33);
|
||||
expect(ENHANCED_TOOL_CONTRACTS).toHaveLength(10);
|
||||
expect(NATIVE_TOOL_CONTRACTS).toHaveLength(5);
|
||||
@@ -37,6 +37,7 @@ describe("tool contract inventory", () => {
|
||||
expect(APPLICATION_TOOL_CONTRACTS.map(({ name }) => name)).toEqual([
|
||||
"trace_application_feature",
|
||||
"compare_application_versions",
|
||||
"run_controlled_replay",
|
||||
]);
|
||||
expect(SESSION_TOOL_CONTRACTS.map(({ name }) => name)).toEqual([
|
||||
"open_binary",
|
||||
@@ -58,8 +59,8 @@ describe("tool contract inventory", () => {
|
||||
"update_unknown",
|
||||
"verify_unknown_resolution",
|
||||
]);
|
||||
expect(TOOL_CONTRACTS).toHaveLength(82);
|
||||
expect(new Set(TOOL_CONTRACTS.map(({ name }) => name)).size).toBe(82);
|
||||
expect(TOOL_CONTRACTS).toHaveLength(83);
|
||||
expect(new Set(TOOL_CONTRACTS.map(({ name }) => name)).size).toBe(83);
|
||||
});
|
||||
|
||||
it("retains documented enhanced-tool limits at the input boundary", () => {
|
||||
|
||||
Reference in New Issue
Block a user