refactor(contracts): simplify workflows and drop readiness tool
This commit is contained in:
@@ -126,7 +126,6 @@ describe("canonical product catalog", () => {
|
||||
"compare_javascript_export_shapes",
|
||||
"compare_source_to_bundle",
|
||||
"evaluate_reconstruction_coverage",
|
||||
"evaluate_reconstruction_readiness",
|
||||
"execute_node_characterization",
|
||||
"prepare_node_characterization",
|
||||
"run_controlled_replay",
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
import { execFile } from "node:child_process";
|
||||
import { promisify } from "node:util";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { RECONSTRUCTION_READINESS_EXAMPLE } from "../../../src/contracts/reconstructionReadinessExample.js";
|
||||
|
||||
const execute = promisify(execFile);
|
||||
|
||||
describe("reconstruction readiness CLI parity", () => {
|
||||
it("emits the same passing report through the public CLI", async () => {
|
||||
const { stdout } = await execute(
|
||||
process.execPath,
|
||||
[
|
||||
"scripts/rea.mjs",
|
||||
"evaluate-reconstruction-readiness",
|
||||
JSON.stringify(RECONSTRUCTION_READINESS_EXAMPLE),
|
||||
"--json",
|
||||
],
|
||||
{
|
||||
cwd: process.cwd(),
|
||||
env: process.env,
|
||||
maxBuffer: 32 * 1_024 * 1_024,
|
||||
},
|
||||
);
|
||||
expect(JSON.parse(stdout)).toMatchObject({
|
||||
operation: "evaluate_reconstruction_readiness",
|
||||
predicate_type: "rea.reconstruction-readiness-report/v1",
|
||||
normalized_result: {
|
||||
schema: "ReconstructionReadinessReport",
|
||||
status: "pass",
|
||||
summary: { passed_required_stages: 9 },
|
||||
},
|
||||
});
|
||||
}, 20_000);
|
||||
});
|
||||
@@ -27,7 +27,7 @@ afterEach(async () => {
|
||||
});
|
||||
|
||||
it(
|
||||
"exposes CLI-equivalent Evidence v2 and session resources",
|
||||
"exposes CLI-equivalent Evidence v2 results and session tools",
|
||||
async () => {
|
||||
const browser = await startFakeCdpBrowser({
|
||||
sessionTimeline: "same_origin",
|
||||
|
||||
@@ -9,6 +9,8 @@ import { createTestBinarySession } from "../../fixtures/binarySession.js";
|
||||
import { ARTIFACT_COMPARISON_EXAMPLE } from "../../../src/contracts/artifactComparisonExample.js";
|
||||
import { PROCESS_CAPTURE_REFERENCE } from "../../../src/contracts/investigationExamples.js";
|
||||
import { createEvidence } from "../../../src/domain/evidence.js";
|
||||
import { createArtifactInspection } from "../../../src/domain/artifactInspection.js";
|
||||
import { jsonValueSchema } from "../../../src/domain/jsonValue.js";
|
||||
import { createPromptCompletionSource } from "../../../src/server/promptCompletion.js";
|
||||
import { observed } from "../../fixtures/analysisExecution.js";
|
||||
|
||||
@@ -71,8 +73,20 @@ describe("guided prompt completion from investigation records", () => {
|
||||
confidence: "observed",
|
||||
authority: "shipped-artifact",
|
||||
});
|
||||
const inventoryInspection = createArtifactInspection(
|
||||
ARTIFACT_COMPARISON_EXAMPLE.left,
|
||||
);
|
||||
const inspectionEvidence = createEvidence(undefined, fixtureProvider, {
|
||||
operation: "inspect_artifact",
|
||||
parameters: {},
|
||||
result: jsonValueSchema.parse(inventoryInspection),
|
||||
confidence: "observed",
|
||||
authority: "shipped-artifact",
|
||||
evidenceLinks: inventoryInspection.evidence_links,
|
||||
});
|
||||
for (const evidence of [
|
||||
ARTIFACT_COMPARISON_EXAMPLE.left,
|
||||
inspectionEvidence,
|
||||
PROCESS_CAPTURE_REFERENCE,
|
||||
invalidCapture,
|
||||
invalidInventory,
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
import { Client, InMemoryTransport } from "@modelcontextprotocol/client";
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { createTestBinarySession } from "../../fixtures/binarySession.js";
|
||||
import { RECONSTRUCTION_READINESS_EXAMPLE } from "../../../src/contracts/reconstructionReadinessExample.js";
|
||||
import { createServer } from "../../../src/server/createServer.js";
|
||||
import { observed } from "../../fixtures/analysisExecution.js";
|
||||
|
||||
describe("reconstruction readiness MCP parity", () => {
|
||||
it("returns the complete passing report inline", async () => {
|
||||
const session = createTestBinarySession(() => ({
|
||||
execute: () => Promise.resolve(observed(null)),
|
||||
close: () => Promise.resolve(),
|
||||
}));
|
||||
const server = createServer(session, session);
|
||||
const client = new Client({ name: "readiness-test", version: "1" });
|
||||
const [clientTransport, serverTransport] =
|
||||
InMemoryTransport.createLinkedPair();
|
||||
try {
|
||||
await server.connect(serverTransport);
|
||||
await client.connect(clientTransport);
|
||||
const result = await client.callTool({
|
||||
name: "evaluate_reconstruction_readiness",
|
||||
arguments: RECONSTRUCTION_READINESS_EXAMPLE,
|
||||
});
|
||||
expect(result.isError).not.toBe(true);
|
||||
expect(result.structuredContent).toMatchObject({
|
||||
evidence_id: expect.stringMatching(/^ev_[a-f0-9]{64}$/u),
|
||||
result: {
|
||||
schema: "ReconstructionReadinessReport",
|
||||
status: "pass",
|
||||
summary: { passed_required_stages: 9 },
|
||||
stages: expect.arrayContaining([expect.any(Object)]),
|
||||
},
|
||||
});
|
||||
expect(result.structuredContent).toHaveProperty("result.snapshot");
|
||||
expect(result.structuredContent).toHaveProperty("result.stages");
|
||||
expect(result.structuredContent).not.toHaveProperty(
|
||||
"result.report_resource_uri",
|
||||
);
|
||||
} finally {
|
||||
await client.close();
|
||||
await server.close();
|
||||
await session.close();
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -241,12 +241,11 @@ describe("live server identity over MCP", () => {
|
||||
|
||||
const assertLiveIdentity = async (client: Client): Promise<void> => {
|
||||
const instructions = client.getInstructions();
|
||||
expect(instructions?.length).toBeLessThanOrEqual(640);
|
||||
expect(instructions).toContain(
|
||||
"ASAR/JavaScript -> analyze_javascript_application",
|
||||
"For standalone JavaScript or ASAR analysis, use analyze_javascript_application",
|
||||
);
|
||||
expect(instructions).toContain(
|
||||
"native binary/database -> open_binary, then binary_overview",
|
||||
"For an archive or application package, call open_binary(path), then inspect_artifact",
|
||||
);
|
||||
const identity = await client.callTool({
|
||||
name: "binary_session",
|
||||
|
||||
@@ -116,14 +116,12 @@ describe("target-free MCP workflow", () => {
|
||||
const beforeTools = (await mcp.listTools()).tools;
|
||||
const beforeNames = beforeTools.map(({ name }) => name);
|
||||
expect(mcp.getInstructions()).toContain(
|
||||
"archive/package -> open_binary(path), then inspect_artifact/inventory_artifact",
|
||||
"For an archive or application package, call open_binary(path), then inspect_artifact",
|
||||
);
|
||||
expect(
|
||||
beforeTools.find(({ name }) => name === "inventory_artifact")
|
||||
?.description,
|
||||
).toContain(
|
||||
"This tool accepts no path; in a target-free session open the target first.",
|
||||
);
|
||||
beforeTools.find(({ name }) => name === "inspect_artifact")?.description,
|
||||
).toContain("Returns the complete content-addressed artifact graph");
|
||||
expect(beforeNames).not.toContain("inventory_artifact");
|
||||
expect(beforeNames).toContain("open_binary");
|
||||
expect(beforeNames).toContain("binary_session");
|
||||
expect(beforeNames).toContain("current_document");
|
||||
@@ -132,14 +130,22 @@ describe("target-free MCP workflow", () => {
|
||||
(await mcp.callTool({ name: "open_binary", arguments: { path: first } }))
|
||||
.isError,
|
||||
).not.toBe(true);
|
||||
const openedStatus = structured(
|
||||
await mcp.callTool({ name: "binary_session", arguments: {} }),
|
||||
);
|
||||
expect(openedStatus).toMatchObject({
|
||||
result: { path: await realpath(first) },
|
||||
});
|
||||
expect(
|
||||
structured(
|
||||
await mcp.callTool({
|
||||
name: "binary_session",
|
||||
arguments: {},
|
||||
}),
|
||||
),
|
||||
).toMatchObject({ result: { path: await realpath(first) } });
|
||||
z
|
||||
.object({
|
||||
result: z.object({
|
||||
capabilities: z.array(z.object({ operation: z.string() })),
|
||||
}),
|
||||
})
|
||||
.parse(openedStatus)
|
||||
.result.capabilities.map(({ operation }) => operation),
|
||||
).not.toContain("inventory_artifact");
|
||||
expect(
|
||||
text(await mcp.callTool({ name: "current_document", arguments: {} })),
|
||||
).toContain("first.hop");
|
||||
|
||||
Reference in New Issue
Block a user