fix(mcp): integrate managed contracts after rebase
This commit is contained in:
+24
-12
@@ -117,12 +117,13 @@ describe("managed artifact MCP tools", () => {
|
||||
},
|
||||
});
|
||||
|
||||
const members = structured(
|
||||
const membersResult = structured(
|
||||
await client.callTool({
|
||||
name: "inspect_managed_members",
|
||||
arguments: { method_limit: 1 },
|
||||
}),
|
||||
);
|
||||
const members = sessionEvidence(session, membersResult);
|
||||
|
||||
expect(members).toMatchObject({
|
||||
operation: "inspect_managed_members",
|
||||
@@ -144,10 +145,7 @@ describe("managed artifact MCP tools", () => {
|
||||
);
|
||||
|
||||
expect(boundaries).toMatchObject({
|
||||
operation: "inspect_managed_native_boundaries",
|
||||
provider: { id: "rea-dotnet-static" },
|
||||
subject: { local_path: path, format: "pe" },
|
||||
normalized_result: {
|
||||
result: {
|
||||
identity_scope: { token_identity: "build-local" },
|
||||
pinvoke_imports: { total: 0, limit: 1 },
|
||||
native_implementations: { total: 0 },
|
||||
@@ -158,18 +156,19 @@ describe("managed artifact MCP tools", () => {
|
||||
name: "open_binary",
|
||||
arguments: { path: rightPath },
|
||||
});
|
||||
const rightMembers = structured(
|
||||
const rightMembersResult = structured(
|
||||
await client.callTool({
|
||||
name: "inspect_managed_members",
|
||||
arguments: { method_limit: 1 },
|
||||
}),
|
||||
);
|
||||
const compared = structured(
|
||||
const rightMembers = sessionEvidence(session, rightMembersResult);
|
||||
const comparedResult = structured(
|
||||
await client.callTool({
|
||||
name: "compare_managed_members",
|
||||
arguments: {
|
||||
left: members,
|
||||
right: rightMembers,
|
||||
left_evidence_id: members.evidence_id,
|
||||
right_evidence_id: rightMembers.evidence_id,
|
||||
limits: {
|
||||
max_method_matches: 100,
|
||||
max_field_matches: 100,
|
||||
@@ -178,6 +177,7 @@ describe("managed artifact MCP tools", () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
const compared = sessionEvidence(session, comparedResult);
|
||||
|
||||
expect(compared).toMatchObject({
|
||||
operation: "compare_managed_members",
|
||||
@@ -205,7 +205,7 @@ describe("managed artifact MCP tools", () => {
|
||||
.parse(method).items[0];
|
||||
expect(methodItem).toBeDefined();
|
||||
if (methodItem === undefined) return;
|
||||
const imported = structured(
|
||||
const importedResult = structured(
|
||||
await client.callTool({
|
||||
name: "import_managed_reconstruction",
|
||||
arguments: {
|
||||
@@ -233,6 +233,7 @@ describe("managed artifact MCP tools", () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
const imported = sessionEvidence(session, importedResult);
|
||||
|
||||
expect(imported).toMatchObject({
|
||||
operation: "import_managed_reconstruction",
|
||||
@@ -249,11 +250,11 @@ describe("managed artifact MCP tools", () => {
|
||||
],
|
||||
},
|
||||
});
|
||||
const planned = structured(
|
||||
const plannedResult = structured(
|
||||
await client.callTool({
|
||||
name: "plan_managed_runtime_correlation",
|
||||
arguments: {
|
||||
static_members: members,
|
||||
static_members_evidence_id: members.evidence_id,
|
||||
method: {
|
||||
token: methodItem.token,
|
||||
signature_sha256: methodItem.signature.raw_sha256,
|
||||
@@ -275,6 +276,7 @@ describe("managed artifact MCP tools", () => {
|
||||
},
|
||||
}),
|
||||
);
|
||||
const planned = sessionEvidence(session, plannedResult);
|
||||
|
||||
expect(planned).toMatchObject({
|
||||
operation: "plan_managed_runtime_correlation",
|
||||
@@ -302,3 +304,13 @@ const structured = (result: CallToolResult): Record<string, unknown> => {
|
||||
throw new Error("missing structured result");
|
||||
return z.record(z.string(), z.unknown()).parse(result.structuredContent);
|
||||
};
|
||||
|
||||
const sessionEvidence = (
|
||||
session: BinarySession,
|
||||
result: Readonly<Record<string, unknown>>,
|
||||
): Record<string, unknown> => {
|
||||
const evidenceId = z.string().parse(result.evidence_id);
|
||||
const evidence = session.evidenceById(evidenceId);
|
||||
if (evidence === undefined) throw new Error("missing session Evidence");
|
||||
return z.record(z.string(), z.unknown()).parse(evidence);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user