feat(application): add cross-layer graph workflows

This commit is contained in:
N0zoM1z0
2026-07-16 11:29:54 +09:00
committed by N0zoM1z0
parent 87b23482e2
commit 778b995bbf
218 changed files with 6783 additions and 325 deletions
+67
View File
@@ -0,0 +1,67 @@
import { execFile } from "node:child_process";
import { mkdtemp, rm, writeFile } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { promisify } from "node:util";
import { afterEach, describe, expect, it } from "vitest";
import {
JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE,
JAVASCRIPT_FEATURE_TRACE_EXAMPLE,
} from "../src/contracts/javascriptApplicationWorkflowExamples.js";
const execute = promisify(execFile);
describe("application workflow CLI parity", () => {
const temporary: string[] = [];
afterEach(async () => {
await Promise.all(
temporary
.splice(0)
.map(async (path) => rm(path, { recursive: true, force: true })),
);
});
it("accepts inline trace JSON and file-backed comparison JSON", async () => {
const traced = await runCli([
"trace-application-feature",
JSON.stringify(JAVASCRIPT_FEATURE_TRACE_EXAMPLE),
"--json",
]);
expect(traced).toMatchObject({
operation: "trace_application_feature",
normalized_result: { schema_version: 1 },
});
const root = await mkdtemp(join(tmpdir(), "rea-application-cli-"));
temporary.push(root);
const comparisonPath = join(root, "comparison.json");
await writeFile(
comparisonPath,
JSON.stringify(JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE),
);
const compared = await runCli([
"compare-application-versions",
comparisonPath,
"--json",
]);
expect(compared).toMatchObject({
operation: "compare_application_versions",
normalized_result: {
schema_version: 1,
summary: { unknown: expect.any(Number) },
},
});
}, 20_000);
});
const runCli = async (arguments_: readonly string[]): Promise<unknown> => {
const { stdout } = await execute(
process.execPath,
["scripts/rea.mjs", ...arguments_],
{ cwd: process.cwd(), env: process.env, maxBuffer: 16 * 1_024 * 1_024 },
);
return JSON.parse(stdout);
};
+78
View File
@@ -0,0 +1,78 @@
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
import { describe, expect, it } from "vitest";
import { BinarySession } from "../src/application/BinarySession.js";
import {
JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE,
JAVASCRIPT_FEATURE_TRACE_EXAMPLE,
} from "../src/contracts/javascriptApplicationWorkflowExamples.js";
import { createServer } from "../src/server/createServer.js";
import { observed } from "./fixtures/analysisExecution.js";
describe("application workflow MCP parity", () => {
it("traces and compares authenticated graph Evidence in the session", async () => {
const session = new BinarySession(() => ({
execute: () => Promise.resolve(observed(null)),
close: () => Promise.resolve(),
}));
const server = createServer(session, session);
const client = new Client({
name: "application-workflow-test",
version: "1",
});
const [clientTransport, serverTransport] =
InMemoryTransport.createLinkedPair();
try {
await server.connect(serverTransport);
await client.connect(clientTransport);
const traced = await client.callTool({
name: "trace_application_feature",
arguments: JAVASCRIPT_FEATURE_TRACE_EXAMPLE,
});
expect(traced.isError).not.toBe(true);
expect(traced.structuredContent).toMatchObject({
operation: "trace_application_feature",
provider: { id: "rea-javascript-application-workflows" },
normalized_result: {
schema_version: 1,
coverage: { status: expect.any(String) },
},
});
const compared = await client.callTool({
name: "compare_application_versions",
arguments: {
...JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE,
unknown_registry_approved: true,
},
});
expect(compared.isError).not.toBe(true);
expect(compared.structuredContent).toMatchObject({
operation: "compare_application_versions",
normalized_result: {
schema_version: 1,
summary: { unknown: expect.any(Number) },
coverage: { status: expect.any(String) },
},
});
expect(session.exportEvidenceBundle().records.length).toBeGreaterThan(2);
const spoofed = await client.callTool({
name: "trace_application_feature",
arguments: {
...JAVASCRIPT_FEATURE_TRACE_EXAMPLE,
application: {
...JAVASCRIPT_FEATURE_TRACE_EXAMPLE.application,
provider: { id: "spoofed", name: "spoofed", version: "1" },
},
},
});
expect(spoofed.isError).toBe(true);
} finally {
await client.close();
await server.close();
await session.close();
}
});
});
+61
View File
@@ -0,0 +1,61 @@
import { execFile } from "node:child_process";
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { promisify } from "node:util";
import { afterEach, describe, expect, it } from "vitest";
import { writeVersionedJavaScriptApplicationFixtures } from "./fixtures/javascriptArtifactApplication.js";
const execute = promisify(execFile);
describe("local application workflow verifier", () => {
const temporary: string[] = [];
afterEach(async () => {
await Promise.all(
temporary
.splice(0)
.map(async (path) => rm(path, { recursive: true, force: true })),
);
});
it("reports bounded two-version and trace claims without source text", async () => {
const root = await mkdtemp(join(tmpdir(), "rea-application-verifier-"));
temporary.push(root);
const fixtures = await writeVersionedJavaScriptApplicationFixtures(root);
const { stdout } = await execute(
process.execPath,
[
"scripts/verify-local-application-workflows.mjs",
"--left",
fixtures.left,
"--right",
fixtures.right,
"--seed-kind",
"module",
"--seed-value",
"stable",
],
{ cwd: process.cwd(), maxBuffer: 16 * 1_024 * 1_024 },
);
const result = JSON.parse(stdout);
expect(result).toMatchObject({
verified: true,
summary: {
added: expect.any(Number),
removed: expect.any(Number),
changed: expect.any(Number),
unknown: expect.any(Number),
},
matching: {
exact_module_source_digest: expect.any(Number),
structural_fingerprint: expect.any(Number),
},
coverage: { status: expect.any(String) },
trace: { summary: { matched_seeds: expect.any(Number) } },
});
expect(stdout).not.toContain("stableValue");
}, 20_000);
});
+1 -1
View File
@@ -37,7 +37,7 @@ describe("browser MCP tools", () => {
const connected = await connectBrowser(browser);
const tools = await connected.client.listTools();
expect(tools.tools).toHaveLength(80);
expect(tools.tools).toHaveLength(82);
expect(tools.tools.map(({ name }) => name)).toEqual(
expect.arrayContaining([
"list_browser_targets",
+6 -3
View File
@@ -10,6 +10,7 @@ import { NATIVE_TOOL_CONTRACTS } from "../src/contracts/nativeToolContracts.js";
import { ARTIFACT_TOOL_CONTRACTS } from "../src/contracts/artifactToolContracts.js";
import { BROWSER_TOOL_CONTRACTS } from "../src/contracts/browserToolContracts.js";
import { ELECTRON_TOOL_CONTRACTS } from "../src/contracts/electronToolContracts.js";
import { APPLICATION_TOOL_CONTRACTS } from "../src/contracts/applicationToolContracts.js";
import {
enhancedOutputSchemas,
officialOutputSchemas,
@@ -57,8 +58,9 @@ describe("tool contract surface", () => {
...ARTIFACT_TOOL_CONTRACTS,
...BROWSER_TOOL_CONTRACTS,
...ELECTRON_TOOL_CONTRACTS,
...APPLICATION_TOOL_CONTRACTS,
];
expect(contracts).toHaveLength(62);
expect(contracts).toHaveLength(64);
for (const contract of contracts) {
const inputSchema = contractJsonSchema(contract.inputSchema);
const outputSchema = contractJsonSchema(contract.outputSchema);
@@ -148,7 +150,7 @@ describe("tool contract surface", () => {
}
});
it("publishes no unconstrained output-schema holes across all 80 tools", () => {
it("publishes no unconstrained output-schema holes across all 82 tools", () => {
const contracts = [
...OFFICIAL_TOOL_CONTRACTS,
...ENHANCED_TOOL_CONTRACTS,
@@ -156,9 +158,10 @@ describe("tool contract surface", () => {
...ARTIFACT_TOOL_CONTRACTS,
...BROWSER_TOOL_CONTRACTS,
...ELECTRON_TOOL_CONTRACTS,
...APPLICATION_TOOL_CONTRACTS,
...SESSION_TOOL_CONTRACTS,
];
expect(contracts).toHaveLength(80);
expect(contracts).toHaveLength(82);
for (const contract of contracts) {
const schema = contractJsonSchema(contract.outputSchema);
expect(emptySchemaPaths(schema), contract.name).toEqual([]);
+95
View File
@@ -123,3 +123,98 @@ export const writeJavaScriptArtifactFixture = async (
),
]);
};
/** Materialize two source-owned rechunked/minified comparison fixtures. */
export const writeVersionedJavaScriptApplicationFixtures = async (
root: string,
): Promise<{ readonly left: string; readonly right: string }> => {
const left = join(root, "version-1");
const right = join(root, "version-2");
await Promise.all([
writeVersionFixture(left, "1.0.0", "left-bundle.js", versionOneBundle()),
writeVersionFixture(right, "2.0.0", "right-bundle.js", versionTwoBundle()),
]);
return { left, right };
};
const writeVersionFixture = async (
root: string,
version: string,
bundleName: string,
bundle: string,
): Promise<void> => {
await mkdir(join(root, "renderer", "chunks"), { recursive: true });
await Promise.all([
writeFile(
join(root, "package.json"),
JSON.stringify({
name: "rea-version-comparison-fixture",
version,
main: "./main.js",
renderer: "./renderer/index.html",
}),
),
writeFile(
join(root, "main.js"),
'const { ipcMain } = require("electron"); ipcMain.handle("feature:open", () => require("./native.node"));\n',
),
writeFile(
join(root, "renderer", "index.html"),
`<!doctype html><script src="./chunks/${bundleName}"></script>`,
),
writeFile(join(root, "renderer", "chunks", bundleName), bundle),
writeFile(
join(root, "renderer", `${bundleName}.map`),
JSON.stringify({
version: 3,
file: bundleName,
sources: ["src/feature.ts"],
sourcesContent: [
version === "1.0.0"
? 'export const feature = "before";'
: 'export const feature = "after";',
],
names: [],
mappings: "AAAA",
}),
),
writeFile(
join(root, "native.node"),
Buffer.from([0x7f, 0x45, 0x4c, 0x46, 0x02, 0x01, 0x01, 0x00]),
),
]);
};
const versionOneBundle = (): string => `
(globalThis.webpackChunkfixture = globalThis.webpackChunkfixture || []).push([
[101],
{
"stable-old": (module, exports) => { exports.stable = () => 42; },
"descriptive-name": (module, exports) => {
const descriptiveValue = 1;
exports.changedName = () => descriptiveValue + 2;
},
"duplicate-a": (module, exports) => { exports.duplicate = () => 7; },
"duplicate-b": (module, exports) => { exports.duplicate = () => 7; },
"removed": (module, exports) => { exports.removed = true; }
}
]);
${String.fromCharCode(47, 47)}# sourceMap${"ping"}URL=left-bundle.js.map
`;
const versionTwoBundle = (): string => `
(globalThis.webpackChunkfixture = globalThis.webpackChunkfixture || []).push([
[909],
{
"stable-new": (module, exports) => { exports.stable = () => 42; },
"a": (module, exports) => {
const b = 1;
exports.changedName = () => b + 2;
},
"collision-x": (module, exports) => { exports.duplicate = () => 7; },
"collision-y": (module, exports) => { exports.duplicate = () => 7; },
"added": (module, exports) => { exports.added = true; }
}
]);
${String.fromCharCode(47, 47)}# sourceMap${"ping"}URL=right-bundle.js.map
`;
+2 -2
View File
@@ -131,7 +131,7 @@ describe("full MCP integration with multi-tool sequences", () => {
});
});
it("preserves the complete 80-tool inventory with a session", async () => {
it("preserves the complete 82-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(80);
expect(listed.tools).toHaveLength(82);
const names = listed.tools.map((t) => t.name);
expect(names).toContain("open_binary");
expect(names).toContain("close_binary");
@@ -0,0 +1,291 @@
import { mkdtemp, rm } from "node:fs/promises";
import { tmpdir } from "node:os";
import { join } from "node:path";
import { afterEach, describe, expect, it } from "vitest";
import { analyzeJavaScriptApplication } from "../src/application/JavaScriptApplicationService.js";
import { compareApplicationVersionsEvidence } from "../src/application/JavaScriptApplicationWorkflowService.js";
import { createEvidence } from "../src/domain/evidence.js";
import { applicationVersionComparisonResultSchema } from "../src/domain/javascriptApplicationVersionComparisonSchemas.js";
import { compareJavaScriptApplicationVersions } from "../src/domain/javascriptApplicationVersionComparison.js";
import { createJavaScriptApplicationGraph } from "../src/domain/javascriptApplicationGraph.js";
import { traceApplicationFeature } from "../src/domain/javascriptFeatureTrace.js";
import { applicationFeatureTraceResultSchema } from "../src/domain/javascriptFeatureTraceSchemas.js";
import {
APPLICATION_GRAPH_DIGESTS,
buildSyntheticJavaScriptApplicationGraph,
} from "./fixtures/javascriptApplicationGraph.js";
import { writeVersionedJavaScriptApplicationFixtures } from "./fixtures/javascriptArtifactApplication.js";
import { permissionAuthorityForRoot } from "./fixtures/permissionAuthority.js";
describe("JavaScript application workflows", () => {
const temporary: string[] = [];
afterEach(async () => {
await Promise.all(
temporary
.splice(0)
.map(async (path) => rm(path, { recursive: true, force: true })),
);
});
it("traces a contextBridge API through IPC into linked native evidence", () => {
const graph = buildSyntheticJavaScriptApplicationGraph();
const nativeEvidence = createEvidence(
{
path: "/tmp/synthetic.node",
sha256: APPLICATION_GRAPH_DIGESTS.nativeAddon,
format: "elf",
architecture: "x86_64",
},
{ id: "ghidra", name: "Ghidra", version: "fixture" },
{
operation: "analyze_function",
parameters: { address: "openProject" },
result: { name: "openProject", address: "0x1000" },
limitations: ["Synthetic native provider observation."],
},
);
const result = traceApplicationFeature({
sourceEvidenceId: `ev_${"a".repeat(64)}`,
graph,
nativeEvidence: [nativeEvidence],
seed: {
kind: "api",
value: "desktopApi",
match: "exact",
case_sensitive: false,
},
direction: "outgoing",
limits: traceLimits(),
});
expect(() =>
applicationFeatureTraceResultSchema.parse(result),
).not.toThrow();
expect(result.summary).toMatchObject({
matched_seeds: 1,
native_handoffs: 1,
});
expect(result.native_handoffs).toContainEqual(
expect.objectContaining({
artifact_sha256: APPLICATION_GRAPH_DIGESTS.nativeAddon,
status: "evidence-linked",
evidence_ids: [nativeEvidence.evidence_id],
requested_exports: expect.arrayContaining(["openProject"]),
}),
);
expect(result.paths).toEqual(
expect.arrayContaining([
expect.objectContaining({ end_kind: "native-export" }),
]),
);
expect(
result.graph?.edges.some(
({ evidence }) =>
evidence.authority === "static-relationship-inference" &&
evidence.state === "inferred",
),
).toBe(true);
});
it("keeps no-match and bounded frontiers explicit", () => {
const graph = buildSyntheticJavaScriptApplicationGraph();
const noMatch = traceApplicationFeature({
sourceEvidenceId: `ev_${"a".repeat(64)}`,
graph,
nativeEvidence: [],
seed: {
kind: "route",
value: "/missing",
match: "exact",
case_sensitive: false,
},
direction: "both",
limits: traceLimits(),
});
expect(noMatch).toMatchObject({
graph: null,
coverage: { status: "no-match" },
summary: { matched_seeds: 0 },
});
const bounded = traceApplicationFeature({
sourceEvidenceId: `ev_${"a".repeat(64)}`,
graph,
nativeEvidence: [],
seed: {
kind: "api",
value: "desktopApi",
match: "exact",
case_sensitive: false,
},
direction: "outgoing",
limits: { ...traceLimits(), max_depth: 1 },
});
expect(bounded.coverage).toMatchObject({ status: "truncated" });
expect(bounded.coverage.omitted_nodes).toBeGreaterThan(0);
expect(bounded.summary.native_handoffs).toBe(0);
});
it("matches rechunked modules by exact source and minified modules by structural fingerprint", async () => {
const root = await mkdtemp(join(tmpdir(), "rea-application-versions-"));
temporary.push(root);
const fixtures = await writeVersionedJavaScriptApplicationFixtures(root);
const [left, right] = await Promise.all([
analyzeFixture(fixtures.left, true),
analyzeFixture(fixtures.right, true),
]);
const compared = compareApplicationVersionsEvidence({ left, right });
if (!compared.ok) throw compared.error;
const result = applicationVersionComparisonResultSchema.parse(
compared.value.normalized_result,
);
const modules = result.items.filter(
({ node_kind: kind }) => kind === "javascript-module",
);
expect(modules).toEqual(
expect.arrayContaining([
expect.objectContaining({
match: expect.objectContaining({
status: "matched",
basis: "exact-module-source-digest",
confidence: "exact",
}),
}),
expect.objectContaining({
status: "changed",
match: expect.objectContaining({
status: "matched",
basis: "structural-fingerprint",
confidence: "medium",
}),
}),
]),
);
expect(result.matching.ambiguous).toBeGreaterThanOrEqual(4);
expect(modules.filter(({ match }) => match.status === "ambiguous")).toEqual(
expect.arrayContaining([expect.objectContaining({ status: "unknown" })]),
);
expect(result.summary.added).toBeGreaterThan(0);
expect(result.summary.removed).toBeGreaterThan(0);
expect(result.graph.edges).toEqual(
expect.arrayContaining([
expect.objectContaining({
relation: "changed_from",
evidence: expect.objectContaining({
authority: "cross-version-comparison",
state: "inferred",
}),
}),
]),
);
expect(result.limitations.join(" ")).toMatch(
/module ordinals|fuzzy pairing/u,
);
});
it("pairs source-map originals without promoting the match to exact", async () => {
const root = await mkdtemp(join(tmpdir(), "rea-source-map-versions-"));
temporary.push(root);
const fixtures = await writeVersionedJavaScriptApplicationFixtures(root);
const [left, right] = await Promise.all([
analyzeFixture(fixtures.left, true),
analyzeFixture(fixtures.right, true),
]);
const compared = compareApplicationVersionsEvidence({ left, right });
if (!compared.ok) throw compared.error;
const result = applicationVersionComparisonResultSchema.parse(
compared.value.normalized_result,
);
expect(result.items).toContainEqual(
expect.objectContaining({
node_kind: "source-module",
status: "changed",
match: expect.objectContaining({
basis: "source-map-identity",
confidence: "high",
}),
}),
);
});
it("keeps incomplete one-sided absence unknown and reports output truncation", () => {
const complete = buildSyntheticJavaScriptApplicationGraph();
const rootNode = complete.nodes.find(({ node_id: id }) =>
complete.root_node_ids.includes(id),
);
if (rootNode === undefined) throw new Error("Synthetic graph root missing");
const partial = createJavaScriptApplicationGraph({
schema: "JavaScriptApplicationGraph",
schema_version: 1,
root_node_ids: [rootNode.node_id],
nodes: [rootNode],
edges: [],
coverage: {
status: "partial",
truncated: true,
omitted_count: complete.nodes.length - 1,
limits: [{ name: "fixture_nodes", value: 1, unit: "items" }],
},
limitations: ["Synthetic partial graph."],
});
const input = {
left: {
evidenceId: `ev_${"a".repeat(64)}`,
rootArtifactSha256: APPLICATION_GRAPH_DIGESTS.package,
graph: complete,
},
right: {
evidenceId: `ev_${"b".repeat(64)}`,
rootArtifactSha256: APPLICATION_GRAPH_DIGESTS.package,
graph: partial,
},
leftNativeEvidence: [],
rightNativeEvidence: [],
limits: {
max_comparison_items: 1,
max_candidate_nodes: 1,
max_graph_nodes: 20,
max_graph_edges: 20,
},
};
const first = compareJavaScriptApplicationVersions(input);
const second = compareJavaScriptApplicationVersions(input);
expect(first.comparison_id).toBe(second.comparison_id);
expect(first.coverage).toMatchObject({
status: "truncated",
right_graph_status: "partial",
});
expect(first.coverage.omitted_comparison_items).toBeGreaterThan(0);
expect(first.summary.removed).toBe(0);
expect(first.summary.unknown).toBeGreaterThan(0);
});
});
const traceLimits = () => ({
max_seed_matches: 25,
max_depth: 12,
max_nodes: 2_000,
max_edges: 4_000,
max_paths: 100,
});
const analyzeFixture = async (root: string, sourceMaps = false) => {
const authority = await permissionAuthorityForRoot(
root,
["investigation_input"],
["investigation_input"],
);
const result = await analyzeJavaScriptApplication(authority, {
input_path: root,
approved: true,
source_map_read_approved: sourceMaps,
});
if (!result.ok) throw result.error;
return result.value;
};
+7
View File
@@ -10,6 +10,7 @@ import { SUPPORTED_CLIENT_DEFINITIONS } from "../src/application/SupportedClient
import {
ARTIFACT_GRAPH_PROVIDER,
JAVASCRIPT_APPLICATION_PROVIDER,
JAVASCRIPT_APPLICATION_WORKFLOW_PROVIDER,
JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER,
} from "../src/application/InvestigationProviders.js";
import { CDP_BROWSER_PROVIDER_IDENTITY } from "../src/browser/CdpBrowserProvider.js";
@@ -72,6 +73,7 @@ describe("canonical product catalog", () => {
CDP_ELECTRON_PROVIDER_IDENTITY,
JAVASCRIPT_APPLICATION_PROVIDER,
JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER,
JAVASCRIPT_APPLICATION_WORKFLOW_PROVIDER,
]
.map(({ id }) => id)
.sort(),
@@ -99,6 +101,11 @@ describe("canonical product catalog", () => {
({ id }) => id === JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER.id,
)?.capabilities,
).toEqual(["reconcile_javascript_runtime"]);
expect(
catalog.providers.find(
({ id }) => id === JAVASCRIPT_APPLICATION_WORKFLOW_PROVIDER.id,
)?.capabilities,
).toEqual(["compare_application_versions", "trace_application_feature"]);
expect(
z.toJSONSchema(analysisSnapshotSchema).properties?.snapshot_version,
).toMatchObject({
+1 -1
View File
@@ -54,7 +54,7 @@ describe("guided prompts over MCP", () => {
),
);
}
expect((await client.listTools()).tools).toHaveLength(80);
expect((await client.listTools()).tools).toHaveLength(82);
const result = await client.getPrompt({
name: "investigate_feature",
arguments: {
+2
View File
@@ -12,6 +12,7 @@ import { NATIVE_TOOL_CONTRACTS } from "../src/contracts/nativeToolContracts.js";
import { ARTIFACT_TOOL_CONTRACTS } from "../src/contracts/artifactToolContracts.js";
import { BROWSER_TOOL_CONTRACTS } from "../src/contracts/browserToolContracts.js";
import { ELECTRON_TOOL_CONTRACTS } from "../src/contracts/electronToolContracts.js";
import { APPLICATION_TOOL_CONTRACTS } from "../src/contracts/applicationToolContracts.js";
import { SUPPORTED_CLIENT_DEFINITIONS } from "../src/application/SupportedClients.js";
const readmes = [
@@ -29,6 +30,7 @@ const expectedToolCounts = [
ARTIFACT_TOOL_CONTRACTS.length,
BROWSER_TOOL_CONTRACTS.length,
ELECTRON_TOOL_CONTRACTS.length,
APPLICATION_TOOL_CONTRACTS.length,
SESSION_TOOL_CONTRACTS.length,
] as const;
+3 -3
View File
@@ -10,7 +10,7 @@ const fixturePath = fileURLToPath(
);
describe("production stdio runtime", () => {
it("starts the built entrypoint, lists 80 tools, calls one, and shuts down", async () => {
it("starts the built entrypoint, lists 82 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(80);
expect(tools.tools).toHaveLength(82);
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(80);
expect((await client.listTools()).tools).toHaveLength(82);
} finally {
await client.close();
await transport.close();
+5 -5
View File
@@ -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(40);
expect(new Set(CLI_COMMAND_NAMES).size).toBe(40);
expect(CLI_COMMAND_NAMES).toHaveLength(42);
expect(new Set(CLI_COMMAND_NAMES).size).toBe(42);
expect(CATALOG_IDENTITY.counts).toEqual({
cli_commands: 40,
mcp_tools: 80,
cli_commands: 42,
mcp_tools: 82,
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: 80, cli_commands: 40 } },
catalog: { counts: { mcp_tools: 82, cli_commands: 42 } },
alignment: { state: "mcp_server_restart_required" },
},
tool_availability: expect.arrayContaining([
+1 -1
View File
@@ -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(80);
expect((await mcp.listTools()).tools).toHaveLength(82);
const deniedCapture = await mcp.callTool({
name: "capture_process_scenario",
arguments: {
+1 -1
View File
@@ -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: "16"');
expect(await readFile(destination, "utf8")).toContain('version: "17"');
expect(await readFile(destination, "utf8")).toContain(
`tool_count: ${String(TOOL_CONTRACTS.length)}`,
);
+8 -3
View File
@@ -10,9 +10,10 @@ import { ARTIFACT_TOOL_CONTRACTS } from "../src/contracts/artifactToolContracts.
import { NATIVE_TOOL_CONTRACTS } from "../src/contracts/nativeToolContracts.js";
import { BROWSER_TOOL_CONTRACTS } from "../src/contracts/browserToolContracts.js";
import { ELECTRON_TOOL_CONTRACTS } from "../src/contracts/electronToolContracts.js";
import { APPLICATION_TOOL_CONTRACTS } from "../src/contracts/applicationToolContracts.js";
describe("tool contract inventory", () => {
it("publishes 62 analysis contracts and eighteen session tools", () => {
it("publishes 64 analysis contracts and eighteen session tools", () => {
expect(OFFICIAL_TOOL_CONTRACTS).toHaveLength(33);
expect(ENHANCED_TOOL_CONTRACTS).toHaveLength(10);
expect(NATIVE_TOOL_CONTRACTS).toHaveLength(5);
@@ -33,6 +34,10 @@ describe("tool contract inventory", () => {
"analyze_javascript_application",
"reconcile_javascript_runtime",
]);
expect(APPLICATION_TOOL_CONTRACTS.map(({ name }) => name)).toEqual([
"trace_application_feature",
"compare_application_versions",
]);
expect(SESSION_TOOL_CONTRACTS.map(({ name }) => name)).toEqual([
"open_binary",
"close_binary",
@@ -53,8 +58,8 @@ describe("tool contract inventory", () => {
"update_unknown",
"verify_unknown_resolution",
]);
expect(TOOL_CONTRACTS).toHaveLength(80);
expect(new Set(TOOL_CONTRACTS.map(({ name }) => name)).size).toBe(80);
expect(TOOL_CONTRACTS).toHaveLength(82);
expect(new Set(TOOL_CONTRACTS.map(({ name }) => name)).size).toBe(82);
});
it("retains documented enhanced-tool limits at the input boundary", () => {