feat(dotnet): add managed member comparison
This commit is contained in:
@@ -37,7 +37,7 @@ describe("browser MCP tools", () => {
|
||||
const connected = await connectBrowser(browser);
|
||||
|
||||
const tools = await connected.client.listTools();
|
||||
expect(tools.tools).toHaveLength(85);
|
||||
expect(tools.tools).toHaveLength(86);
|
||||
expect(tools.tools.map(({ name }) => name)).toEqual(
|
||||
expect.arrayContaining([
|
||||
"list_browser_targets",
|
||||
|
||||
@@ -9,12 +9,14 @@ import {
|
||||
import { NATIVE_TOOL_CONTRACTS } from "../src/contracts/nativeToolContracts.js";
|
||||
import { ARTIFACT_TOOL_CONTRACTS } from "../src/contracts/artifactToolContracts.js";
|
||||
import { MANAGED_TOOL_CONTRACTS } from "../src/contracts/managedToolContracts.js";
|
||||
import { MANAGED_WORKFLOW_TOOL_CONTRACTS } from "../src/contracts/managedWorkflowToolContracts.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,
|
||||
managedOutputSchemas,
|
||||
managedWorkflowOutputSchemas,
|
||||
officialOutputSchemas,
|
||||
sessionOutputSchemas,
|
||||
} from "../src/contracts/toolOutputSchemas.js";
|
||||
@@ -59,11 +61,12 @@ describe("tool contract surface", () => {
|
||||
...NATIVE_TOOL_CONTRACTS,
|
||||
...ARTIFACT_TOOL_CONTRACTS,
|
||||
...MANAGED_TOOL_CONTRACTS,
|
||||
...MANAGED_WORKFLOW_TOOL_CONTRACTS,
|
||||
...BROWSER_TOOL_CONTRACTS,
|
||||
...ELECTRON_TOOL_CONTRACTS,
|
||||
...APPLICATION_TOOL_CONTRACTS,
|
||||
];
|
||||
expect(contracts).toHaveLength(67);
|
||||
expect(contracts).toHaveLength(68);
|
||||
for (const contract of contracts) {
|
||||
const inputSchema = contractJsonSchema(contract.inputSchema);
|
||||
const outputSchema = contractJsonSchema(contract.outputSchema);
|
||||
@@ -143,11 +146,15 @@ describe("tool contract surface", () => {
|
||||
expect(Object.keys(managedOutputSchemas).sort()).toEqual(
|
||||
MANAGED_TOOL_CONTRACTS.map(({ name }) => name).sort(),
|
||||
);
|
||||
expect(Object.keys(managedWorkflowOutputSchemas).sort()).toEqual(
|
||||
MANAGED_WORKFLOW_TOOL_CONTRACTS.map(({ name }) => name).sort(),
|
||||
);
|
||||
|
||||
for (const contract of [
|
||||
...OFFICIAL_TOOL_CONTRACTS,
|
||||
...ENHANCED_TOOL_CONTRACTS,
|
||||
...MANAGED_TOOL_CONTRACTS,
|
||||
...MANAGED_WORKFLOW_TOOL_CONTRACTS,
|
||||
...SESSION_TOOL_CONTRACTS,
|
||||
]) {
|
||||
const schema = contractJsonSchema(contract.outputSchema);
|
||||
@@ -157,19 +164,20 @@ describe("tool contract surface", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("publishes no unconstrained output-schema holes across all 85 tools", () => {
|
||||
it("publishes no unconstrained output-schema holes across all 86 tools", () => {
|
||||
const contracts = [
|
||||
...OFFICIAL_TOOL_CONTRACTS,
|
||||
...ENHANCED_TOOL_CONTRACTS,
|
||||
...NATIVE_TOOL_CONTRACTS,
|
||||
...ARTIFACT_TOOL_CONTRACTS,
|
||||
...MANAGED_TOOL_CONTRACTS,
|
||||
...MANAGED_WORKFLOW_TOOL_CONTRACTS,
|
||||
...BROWSER_TOOL_CONTRACTS,
|
||||
...ELECTRON_TOOL_CONTRACTS,
|
||||
...APPLICATION_TOOL_CONTRACTS,
|
||||
...SESSION_TOOL_CONTRACTS,
|
||||
];
|
||||
expect(contracts).toHaveLength(85);
|
||||
expect(contracts).toHaveLength(86);
|
||||
for (const contract of contracts) {
|
||||
const schema = contractJsonSchema(contract.outputSchema);
|
||||
expect(emptySchemaPaths(schema), contract.name).toEqual([]);
|
||||
|
||||
Vendored
+28
-14
@@ -1,11 +1,17 @@
|
||||
interface ManagedPeFixtureOptions {
|
||||
readonly cliFlags?: number;
|
||||
readonly corruptMetadataSignature?: boolean;
|
||||
readonly fieldName?: string;
|
||||
readonly ilBody?: Buffer;
|
||||
readonly metadataValidMaskExtra?: bigint;
|
||||
readonly methodName?: string;
|
||||
readonly mvid?: Buffer;
|
||||
readonly readyToRun?: boolean;
|
||||
readonly references?: readonly string[];
|
||||
readonly resourceData?: Buffer;
|
||||
readonly targetFramework?: string;
|
||||
readonly typeName?: string;
|
||||
readonly typeNamespace?: string;
|
||||
}
|
||||
|
||||
const textEncoder = new TextEncoder();
|
||||
@@ -51,11 +57,16 @@ class BlobHeap {
|
||||
}
|
||||
}
|
||||
|
||||
const guidHeap = (): Buffer =>
|
||||
Buffer.from([
|
||||
0x33, 0x22, 0x11, 0x00, 0x55, 0x44, 0x77, 0x66, 0x88, 0x99, 0xaa, 0xbb,
|
||||
0xcc, 0xdd, 0xee, 0xff,
|
||||
]);
|
||||
const DEFAULT_MVID = Buffer.from([
|
||||
0x33, 0x22, 0x11, 0x00, 0x55, 0x44, 0x77, 0x66, 0x88, 0x99, 0xaa, 0xbb, 0xcc,
|
||||
0xdd, 0xee, 0xff,
|
||||
]);
|
||||
|
||||
const guidHeap = (mvid: Buffer = DEFAULT_MVID): Buffer => {
|
||||
if (mvid.length !== 16)
|
||||
throw new RangeError("Managed PE fixture MVID must be 16 bytes");
|
||||
return Buffer.from(mvid);
|
||||
};
|
||||
|
||||
const u16 = (value: number): Buffer => {
|
||||
const bytes = Buffer.alloc(2);
|
||||
@@ -238,10 +249,10 @@ export const buildManagedPeFixture = (
|
||||
const attributeName = strings.add("TargetFrameworkAttribute");
|
||||
const attributeNamespace = strings.add("System.Runtime.Versioning");
|
||||
const constructorName = strings.add(".ctor");
|
||||
const typeName = strings.add("Program");
|
||||
const typeNamespace = strings.add("Fixture");
|
||||
const fieldName = strings.add("counter");
|
||||
const methodName = strings.add("Main");
|
||||
const typeName = strings.add(options.typeName ?? "Program");
|
||||
const typeNamespace = strings.add(options.typeNamespace ?? "Fixture");
|
||||
const fieldName = strings.add(options.fieldName ?? "counter");
|
||||
const methodName = strings.add(options.methodName ?? "Main");
|
||||
const resourceName = strings.add("Fixture.resources");
|
||||
const referenceNames = options.references ?? ["System.Runtime"];
|
||||
const referenceStringIndexes = referenceNames.map((name) =>
|
||||
@@ -271,7 +282,7 @@ export const buildManagedPeFixture = (
|
||||
const metadata = metadataRoot(
|
||||
tablesStream(rows, options.metadataValidMaskExtra ?? 0n),
|
||||
strings.toBuffer(),
|
||||
guidHeap(),
|
||||
guidHeap(options.mvid),
|
||||
blobs.toBuffer(),
|
||||
);
|
||||
if (options.corruptMetadataSignature === true) metadata.writeUInt32LE(0, 0);
|
||||
@@ -322,10 +333,13 @@ export const buildManagedPeFixture = (
|
||||
image.writeUInt32LE(4, cli + 68);
|
||||
image.write("RTR\0", 0x0900, "ascii");
|
||||
}
|
||||
Buffer.from([
|
||||
0x32, 0x02, 0x7b, 0x01, 0x00, 0x00, 0x04, 0x28, 0x01, 0x00, 0x00, 0x0a,
|
||||
0x2a,
|
||||
]).copy(image, 0x0a00);
|
||||
(
|
||||
options.ilBody ??
|
||||
Buffer.from([
|
||||
0x32, 0x02, 0x7b, 0x01, 0x00, 0x00, 0x04, 0x28, 0x01, 0x00, 0x00, 0x0a,
|
||||
0x2a,
|
||||
])
|
||||
).copy(image, 0x0a00);
|
||||
metadata.copy(image, 0x0300);
|
||||
resourceDirectory.copy(image, 0x0800);
|
||||
return image;
|
||||
|
||||
@@ -131,7 +131,7 @@ describe("full MCP integration with multi-tool sequences", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves the complete 85-tool inventory with a session", async () => {
|
||||
it("preserves the complete 86-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(85);
|
||||
expect(listed.tools).toHaveLength(86);
|
||||
const names = listed.tools.map((t) => t.name);
|
||||
expect(names).toContain("open_binary");
|
||||
expect(names).toContain("close_binary");
|
||||
|
||||
@@ -18,7 +18,12 @@ describe("managed artifact MCP tools", () => {
|
||||
it("opens a managed PE and executes the managed static provider through MCP", async () => {
|
||||
const directory = await mkdtemp(join(tmpdir(), "rea-managed-mcp-"));
|
||||
const path = join(directory, "fixture.exe");
|
||||
const rightPath = join(directory, "fixture-renamed.exe");
|
||||
await writeFile(path, buildManagedPeFixture());
|
||||
await writeFile(
|
||||
rightPath,
|
||||
buildManagedPeFixture({ methodName: "Renamed" }),
|
||||
);
|
||||
const session = new BinarySession(
|
||||
SessionProviderRouter.selectable(new AnalysisProviderRegistry([]), [
|
||||
new ManagedStaticProvider(),
|
||||
@@ -38,6 +43,9 @@ describe("managed artifact MCP tools", () => {
|
||||
expect(tools.tools.map(({ name }) => name)).toContain(
|
||||
"inspect_managed_members",
|
||||
);
|
||||
expect(tools.tools.map(({ name }) => name)).toContain(
|
||||
"compare_managed_members",
|
||||
);
|
||||
|
||||
await client.callTool({
|
||||
name: "open_binary",
|
||||
@@ -81,6 +89,41 @@ describe("managed artifact MCP tools", () => {
|
||||
field_accesses: { total: 1 },
|
||||
},
|
||||
});
|
||||
|
||||
await client.callTool({
|
||||
name: "open_binary",
|
||||
arguments: { path: rightPath },
|
||||
});
|
||||
const rightMembers = structured(
|
||||
await client.callTool({
|
||||
name: "inspect_managed_members",
|
||||
arguments: { method_limit: 1 },
|
||||
}),
|
||||
);
|
||||
const compared = structured(
|
||||
await client.callTool({
|
||||
name: "compare_managed_members",
|
||||
arguments: {
|
||||
left: members,
|
||||
right: rightMembers,
|
||||
limits: {
|
||||
max_method_matches: 100,
|
||||
max_field_matches: 100,
|
||||
max_candidates: 10,
|
||||
},
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(compared).toMatchObject({
|
||||
operation: "compare_managed_members",
|
||||
provider: { id: "rea-dotnet-workflows" },
|
||||
confidence: "inferred",
|
||||
normalized_result: {
|
||||
algorithm: { name_matching: "not-used" },
|
||||
matching: { exact_il_signature: 1 },
|
||||
},
|
||||
});
|
||||
} finally {
|
||||
await Promise.all([client.close(), server.close()]);
|
||||
await session.close();
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
import { createHash } from "node:crypto";
|
||||
import { mkdtemp, writeFile } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { compareManagedMemberPaths } from "../src/application/ManagedMemberComparisonService.js";
|
||||
import { MANAGED_STATIC_PROVIDER } from "../src/application/InvestigationProviders.js";
|
||||
import {
|
||||
compareManagedMembers,
|
||||
managedMemberComparisonResultSchema,
|
||||
} from "../src/domain/managedMemberComparison.js";
|
||||
import { createEvidence } from "../src/domain/evidence.js";
|
||||
import type { BinaryTarget } from "../src/domain/binaryTarget.js";
|
||||
import { inspectManagedMembersBytes } from "../src/dotnet/ManagedMemberInspector.js";
|
||||
import { buildManagedPeFixture } from "./fixtures/managedPe.js";
|
||||
|
||||
const memberLimits = {
|
||||
typeOffset: 0,
|
||||
typeLimit: 100,
|
||||
methodOffset: 0,
|
||||
methodLimit: 100,
|
||||
fieldOffset: 0,
|
||||
fieldLimit: 100,
|
||||
memberRefOffset: 0,
|
||||
memberRefLimit: 100,
|
||||
edgeOffset: 0,
|
||||
edgeLimit: 100,
|
||||
instructionAnchorLimit: 100,
|
||||
maxMetadataBytes: 1024 * 1024,
|
||||
maxTableRows: 1_000,
|
||||
maxHeapItemBytes: 1024 * 1024,
|
||||
maxMethodBodyBytes: 1024 * 1024,
|
||||
maxMethodInstructions: 1_000,
|
||||
};
|
||||
|
||||
const pathMemberLimits = {
|
||||
...memberLimits,
|
||||
maxFileBytes: 1024 * 1024,
|
||||
};
|
||||
|
||||
const comparisonLimits = {
|
||||
max_method_matches: 100,
|
||||
max_field_matches: 100,
|
||||
max_candidates: 10,
|
||||
};
|
||||
|
||||
describe("managed member comparison", () => {
|
||||
it("remaps renamed methods by exact CIL/signature without using names", () => {
|
||||
const leftBytes = buildManagedPeFixture();
|
||||
const rightBytes = buildManagedPeFixture({
|
||||
mvid: Buffer.from("00112233445566778899aabbccddeefe", "hex"),
|
||||
typeName: "A",
|
||||
typeNamespace: "X",
|
||||
methodName: "b",
|
||||
fieldName: "c",
|
||||
});
|
||||
const left = inspect(leftBytes, "/tmp/left.dll");
|
||||
const right = inspect(rightBytes, "/tmp/right.dll");
|
||||
const result = compareManagedMembers(
|
||||
{ evidenceId: left.evidence.evidence_id, result: left.result },
|
||||
{ evidenceId: right.evidence.evidence_id, result: right.result },
|
||||
comparisonLimits,
|
||||
);
|
||||
|
||||
expect(result.algorithm.name_matching).toBe("not-used");
|
||||
expect(result.left.mvid).toBe("00112233-4455-6677-8899-aabbccddeeff");
|
||||
expect(result.right.mvid).toBe("33221100-5544-7766-8899-aabbccddeefe");
|
||||
expect(result.matching.exact_il_signature).toBe(1);
|
||||
expect(result.methods).toEqual([
|
||||
expect.objectContaining({
|
||||
status: "unchanged",
|
||||
left: expect.objectContaining({ token: "0x06000001", name: "Main" }),
|
||||
right: expect.objectContaining({ token: "0x06000001", name: "b" }),
|
||||
match: expect.objectContaining({
|
||||
status: "matched",
|
||||
basis: "exact-il-signature",
|
||||
confidence: "exact",
|
||||
}),
|
||||
dimensions: [],
|
||||
}),
|
||||
]);
|
||||
expect(result.limitations).toContain(
|
||||
"Names are reported as observations but are not used as a matching basis.",
|
||||
);
|
||||
});
|
||||
|
||||
it("uses structural method shape when build-local token operands drift", () => {
|
||||
const leftBytes = buildManagedPeFixture();
|
||||
const rightBytes = buildManagedPeFixture({
|
||||
ilBody: Buffer.from([
|
||||
0x32, 0x02, 0x7b, 0x02, 0x00, 0x00, 0x04, 0x28, 0x02, 0x00, 0x00, 0x0a,
|
||||
0x2a,
|
||||
]),
|
||||
});
|
||||
const left = inspect(leftBytes, "/tmp/left.dll");
|
||||
const right = inspect(rightBytes, "/tmp/right.dll");
|
||||
const result = compareManagedMembers(
|
||||
{ evidenceId: left.evidence.evidence_id, result: left.result },
|
||||
{ evidenceId: right.evidence.evidence_id, result: right.result },
|
||||
comparisonLimits,
|
||||
);
|
||||
|
||||
expect(result.matching.exact_il_signature).toBe(0);
|
||||
expect(result.matching.structural_method_shape).toBe(1);
|
||||
expect(result.methods[0]).toMatchObject({
|
||||
status: "changed",
|
||||
match: { status: "matched", basis: "structural-method-shape" },
|
||||
dimensions: ["cil"],
|
||||
});
|
||||
});
|
||||
|
||||
it("does not guess ambiguous field signature matches", () => {
|
||||
const left = inspect(buildManagedPeFixture(), "/tmp/left.dll");
|
||||
const leftField = left.result.fields.items[0];
|
||||
expect(leftField).toBeDefined();
|
||||
if (leftField === undefined) return;
|
||||
const duplicatedLeft = {
|
||||
...left.result,
|
||||
fields: {
|
||||
...left.result.fields,
|
||||
items: [
|
||||
leftField,
|
||||
{
|
||||
...leftField,
|
||||
token: "0x04000002",
|
||||
name: "other",
|
||||
},
|
||||
],
|
||||
total: 2,
|
||||
returned: 2,
|
||||
},
|
||||
};
|
||||
const right = inspect(buildManagedPeFixture(), "/tmp/right.dll");
|
||||
const rightField = right.result.fields.items[0];
|
||||
expect(rightField).toBeDefined();
|
||||
if (rightField === undefined) return;
|
||||
const duplicatedRight = {
|
||||
...right.result,
|
||||
fields: {
|
||||
...right.result.fields,
|
||||
items: [
|
||||
rightField,
|
||||
{
|
||||
...rightField,
|
||||
token: "0x04000002",
|
||||
name: "renamed",
|
||||
},
|
||||
],
|
||||
total: 2,
|
||||
returned: 2,
|
||||
},
|
||||
};
|
||||
const result = compareManagedMembers(
|
||||
{ evidenceId: left.evidence.evidence_id, result: duplicatedLeft },
|
||||
{ evidenceId: right.evidence.evidence_id, result: duplicatedRight },
|
||||
comparisonLimits,
|
||||
);
|
||||
|
||||
expect(result.matching.ambiguous).toBe(1);
|
||||
expect(result.fields).toEqual([
|
||||
expect.objectContaining({
|
||||
status: "unknown",
|
||||
match: expect.objectContaining({
|
||||
status: "ambiguous",
|
||||
basis: "field-signature",
|
||||
candidate_left_tokens: ["0x04000001", "0x04000002"],
|
||||
candidate_right_tokens: ["0x04000001", "0x04000002"],
|
||||
}),
|
||||
}),
|
||||
]);
|
||||
});
|
||||
|
||||
it("compares two local paths and returns derived Evidence", async () => {
|
||||
const directory = await mkdtemp(join(tmpdir(), "rea-managed-compare-"));
|
||||
const leftPath = join(directory, "left.dll");
|
||||
const rightPath = join(directory, "right.dll");
|
||||
await writeFile(leftPath, buildManagedPeFixture());
|
||||
await writeFile(
|
||||
rightPath,
|
||||
buildManagedPeFixture({ methodName: "Renamed" }),
|
||||
);
|
||||
|
||||
const result = await compareManagedMemberPaths({
|
||||
leftPath,
|
||||
rightPath,
|
||||
memberLimits: pathMemberLimits,
|
||||
comparisonLimits,
|
||||
});
|
||||
|
||||
expect(result.ok).toBe(true);
|
||||
if (!result.ok) return;
|
||||
expect(result.value.operation).toBe("compare_managed_members");
|
||||
expect(result.value.confidence).toBe("inferred");
|
||||
expect(result.value.authority).toBe("analyst-inference");
|
||||
expect(
|
||||
managedMemberComparisonResultSchema.parse(result.value.normalized_result)
|
||||
.matching.exact_il_signature,
|
||||
).toBe(1);
|
||||
});
|
||||
});
|
||||
|
||||
const inspect = (bytes: Buffer, path: string) => {
|
||||
const target: BinaryTarget = {
|
||||
path,
|
||||
sha256: hash(bytes),
|
||||
kind: "executable",
|
||||
format: "pe",
|
||||
architecture: "x86",
|
||||
};
|
||||
const result = inspectManagedMembersBytes(bytes, target, memberLimits);
|
||||
return {
|
||||
result,
|
||||
evidence: createEvidence(target, MANAGED_STATIC_PROVIDER, {
|
||||
operation: "inspect_managed_members",
|
||||
parameters: {},
|
||||
result,
|
||||
rawResult: null,
|
||||
limitations: result.limitations,
|
||||
}),
|
||||
};
|
||||
};
|
||||
|
||||
const hash = (bytes: Buffer): string =>
|
||||
createHash("sha256").update(bytes).digest("hex");
|
||||
@@ -13,6 +13,7 @@ import {
|
||||
JAVASCRIPT_APPLICATION_WORKFLOW_PROVIDER,
|
||||
JAVASCRIPT_RUNTIME_RECONCILIATION_PROVIDER,
|
||||
MANAGED_STATIC_PROVIDER,
|
||||
MANAGED_WORKFLOW_PROVIDER,
|
||||
} from "../src/application/InvestigationProviders.js";
|
||||
import { CDP_BROWSER_PROVIDER_IDENTITY } from "../src/browser/CdpBrowserProvider.js";
|
||||
import { CDP_ELECTRON_PROVIDER_IDENTITY } from "../src/browser/CdpElectronProvider.js";
|
||||
@@ -71,6 +72,7 @@ describe("canonical product catalog", () => {
|
||||
NATIVE_MACOS_PROVIDER_IDENTITY,
|
||||
ARTIFACT_GRAPH_PROVIDER,
|
||||
MANAGED_STATIC_PROVIDER,
|
||||
MANAGED_WORKFLOW_PROVIDER,
|
||||
CDP_BROWSER_PROVIDER_IDENTITY,
|
||||
CDP_ELECTRON_PROVIDER_IDENTITY,
|
||||
JAVASCRIPT_APPLICATION_PROVIDER,
|
||||
@@ -112,6 +114,10 @@ describe("canonical product catalog", () => {
|
||||
"run_controlled_replay",
|
||||
"trace_application_feature",
|
||||
]);
|
||||
expect(
|
||||
catalog.providers.find(({ id }) => id === MANAGED_WORKFLOW_PROVIDER.id)
|
||||
?.capabilities,
|
||||
).toEqual(["compare_managed_members"]);
|
||||
expect(
|
||||
z.toJSONSchema(analysisSnapshotSchema).properties?.snapshot_version,
|
||||
).toMatchObject({
|
||||
|
||||
@@ -54,7 +54,7 @@ describe("guided prompts over MCP", () => {
|
||||
),
|
||||
);
|
||||
}
|
||||
expect((await client.listTools()).tools).toHaveLength(85);
|
||||
expect((await client.listTools()).tools).toHaveLength(86);
|
||||
const result = await client.getPrompt({
|
||||
name: "investigate_feature",
|
||||
arguments: {
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
import { NATIVE_TOOL_CONTRACTS } from "../src/contracts/nativeToolContracts.js";
|
||||
import { ARTIFACT_TOOL_CONTRACTS } from "../src/contracts/artifactToolContracts.js";
|
||||
import { MANAGED_TOOL_CONTRACTS } from "../src/contracts/managedToolContracts.js";
|
||||
import { MANAGED_WORKFLOW_TOOL_CONTRACTS } from "../src/contracts/managedWorkflowToolContracts.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";
|
||||
@@ -29,7 +30,7 @@ const expectedToolCounts = [
|
||||
ENHANCED_TOOL_CONTRACTS.length,
|
||||
NATIVE_TOOL_CONTRACTS.length,
|
||||
ARTIFACT_TOOL_CONTRACTS.length,
|
||||
MANAGED_TOOL_CONTRACTS.length,
|
||||
MANAGED_TOOL_CONTRACTS.length + MANAGED_WORKFLOW_TOOL_CONTRACTS.length,
|
||||
BROWSER_TOOL_CONTRACTS.length,
|
||||
ELECTRON_TOOL_CONTRACTS.length,
|
||||
APPLICATION_TOOL_CONTRACTS.length,
|
||||
|
||||
@@ -10,7 +10,7 @@ const fixturePath = fileURLToPath(
|
||||
);
|
||||
|
||||
describe("production stdio runtime", () => {
|
||||
it("starts the built entrypoint, lists 85 tools, calls one, and shuts down", async () => {
|
||||
it("starts the built entrypoint, lists 86 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(85);
|
||||
expect(tools.tools).toHaveLength(86);
|
||||
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(85);
|
||||
expect((await client.listTools()).tools).toHaveLength(86);
|
||||
} 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(45);
|
||||
expect(new Set(CLI_COMMAND_NAMES).size).toBe(45);
|
||||
expect(CLI_COMMAND_NAMES).toHaveLength(46);
|
||||
expect(new Set(CLI_COMMAND_NAMES).size).toBe(46);
|
||||
expect(CATALOG_IDENTITY.counts).toEqual({
|
||||
cli_commands: 45,
|
||||
mcp_tools: 85,
|
||||
cli_commands: 46,
|
||||
mcp_tools: 86,
|
||||
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: 85, cli_commands: 45 } },
|
||||
catalog: { counts: { mcp_tools: 86, cli_commands: 46 } },
|
||||
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(85);
|
||||
expect((await mcp.listTools()).tools).toHaveLength(86);
|
||||
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: "18"');
|
||||
expect(await readFile(destination, "utf8")).toContain('version: "19"');
|
||||
expect(await readFile(destination, "utf8")).toContain(
|
||||
`tool_count: ${String(TOOL_CONTRACTS.length)}`,
|
||||
);
|
||||
|
||||
@@ -8,13 +8,14 @@ import {
|
||||
} from "../src/contracts/toolContracts.js";
|
||||
import { ARTIFACT_TOOL_CONTRACTS } from "../src/contracts/artifactToolContracts.js";
|
||||
import { MANAGED_TOOL_CONTRACTS } from "../src/contracts/managedToolContracts.js";
|
||||
import { MANAGED_WORKFLOW_TOOL_CONTRACTS } from "../src/contracts/managedWorkflowToolContracts.js";
|
||||
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 67 analysis contracts and eighteen session tools", () => {
|
||||
it("publishes 68 analysis contracts and eighteen session tools", () => {
|
||||
expect(OFFICIAL_TOOL_CONTRACTS).toHaveLength(33);
|
||||
expect(ENHANCED_TOOL_CONTRACTS).toHaveLength(10);
|
||||
expect(NATIVE_TOOL_CONTRACTS).toHaveLength(5);
|
||||
@@ -23,6 +24,9 @@ describe("tool contract inventory", () => {
|
||||
"inspect_managed_artifact",
|
||||
"inspect_managed_members",
|
||||
]);
|
||||
expect(MANAGED_WORKFLOW_TOOL_CONTRACTS.map(({ name }) => name)).toEqual([
|
||||
"compare_managed_members",
|
||||
]);
|
||||
expect(BROWSER_TOOL_CONTRACTS.map(({ name }) => name)).toEqual([
|
||||
"list_browser_targets",
|
||||
"inspect_web_page",
|
||||
@@ -64,8 +68,8 @@ describe("tool contract inventory", () => {
|
||||
"update_unknown",
|
||||
"verify_unknown_resolution",
|
||||
]);
|
||||
expect(TOOL_CONTRACTS).toHaveLength(85);
|
||||
expect(new Set(TOOL_CONTRACTS.map(({ name }) => name)).size).toBe(85);
|
||||
expect(TOOL_CONTRACTS).toHaveLength(86);
|
||||
expect(new Set(TOOL_CONTRACTS.map(({ name }) => name)).size).toBe(86);
|
||||
});
|
||||
|
||||
it("retains documented enhanced-tool limits at the input boundary", () => {
|
||||
|
||||
Reference in New Issue
Block a user