Reverse engineer anything with agents, from app behavior down to native binaries.
TypeScript agent-skillsai-agentsbinary-analysisclaude-codeclicodexcordisdecompilerdeveloper-toolsdshdsh-pluginghidrahopperllmmcpmodel-context-protocolreareverse-engineeringstatic-analysistouhou
fix(reconstruction): share artifact inspection source validation
morlutoee250816e182
diff --git a/src/domain/reconstructionVerification.ts b/src/domain/reconstructionVerification.tsindex 1467f1a66..7d3783607 100644--- a/src/domain/reconstructionVerification.ts+++ b/src/domain/reconstructionVerification.ts@@ -4,7 +4,7 @@ import canonicalize from "canonicalize";import { z } from "zod";import { artifactComparisonResultSchema } from "./artifactComparison.js";-import { artifactInventoryResultSchema } from "./artifactGraph.js";+import { parseArtifactInventoryEvidence } from "./artifactInventoryEvidence.js";import { uniqueSorted } from "./canonicalOrdering.js";import { compareUnicodeCodePoints } from "./unicodeCodePointOrder.js";import {@@ -195,19 +195,24 @@ const readValidatedSourceFacts = (claim: Claim,sources: readonly Evidence[],): readonly FunctionSourceFacts[] => {- const expected =- claim.kind === "behavioral"- ? ["capture_process_scenario", "rea.process-capture"]- : claim.kind === "structural-function"- ? ["analyze_function", "rea.analysis"]- : ["inventory_artifact", "rea.analysis"];- if (- sources.some(- (source) =>- source.operation !== expected[0] ||- source.predicate_type !== expected[1],- )- )+ const isExpectedType = (source: Evidence): boolean => {+ if (claim.kind === "behavioral")+ return (+ source.operation === "capture_process_scenario" &&+ source.predicate_type === "rea.process-capture"+ );+ if (claim.kind === "structural-function")+ return (+ source.operation === "analyze_function" &&+ source.predicate_type === "rea.analysis"+ );+ return (+ (source.operation === "inventory_artifact" ||+ source.operation === "inspect_artifact") &&+ source.predicate_type === "rea.analysis"+ );+ };+ if (sources.some((source) => !isExpectedType(source)))throw new TypeError("Comparison source Evidence has an unexpected observation type",);@@ -226,7 +231,7 @@ const readValidatedSourceFacts = (callCoverageBlockers: callCoverage.blockers,callCoverageDiagnostics: callCoverage.diagnostics,});- } else artifactInventoryResultSchema.parse(source.normalized_result);+ } else parseArtifactInventoryEvidence(source);}return functionSources;};diff --git a/tests/acceptance/artifactComparisonPlist.test.ts b/tests/acceptance/artifactComparisonPlist.test.tsindex a6cb31bd2..2559d0b47 100644--- a/tests/acceptance/artifactComparisonPlist.test.ts+++ b/tests/acceptance/artifactComparisonPlist.test.ts@@ -27,8 +27,9 @@ it("compares identical complete plist inventories across CLI and MCP and createsleftPath,"--json",]);+ const cliEvidence = parseEvidence(JSON.parse(cliResult.stdout));const cliInspection = artifactInspectionResultSchema.parse(- parseEvidence(JSON.parse(cliResult.stdout)).normalized_result,+ cliEvidence.normalized_result,);const cliInventory = cliInspection.substeps[0]?.evidence;if (cliInventory === undefined)@@ -43,8 +44,9 @@ it("compares identical complete plist inventories across CLI and MCP and createsexpect(opened.isError, JSON.stringify(opened)).not.toBe(true);const inspected = await call("inspect_artifact", {});expect(inspected.isError, JSON.stringify(inspected)).not.toBe(true);+ const mcpEvidence = parseEvidence(inspected.structuredContent);const mcpInspection = artifactInspectionResultSchema.parse(- parseEvidence(inspected.structuredContent).normalized_result,+ mcpEvidence.normalized_result,);const mcpInventory = mcpInspection.substeps[0]?.evidence;if (mcpInventory === undefined)@@ -55,8 +57,8 @@ it("compares identical complete plist inventories across CLI and MCP and creates});const compared = await call("compare_artifacts", {- left: cliInventory,- right: mcpInventory,+ left: cliEvidence,+ right: mcpEvidence,});expect(compared.isError, JSON.stringify(compared)).not.toBe(true);const comparison = parseEvidence(compared.structuredContent);@@ -66,6 +68,40 @@ it("compares identical complete plist inventories across CLI and MCP and createschanges: [],});+ const verified = await call("verify_reconstruction", {+ specification: {+ name: "Inspected artifact structures agree",+ claims: [+ {+ claim_id: "inspected-artifact",+ title: "The inspected artifact structures agree",+ kind: "structural-artifact",+ dimension: "overall",+ comparison_evidence_id: comparison.evidence_id,+ },+ ],+ },+ });+ expect(verified.isError, JSON.stringify(verified)).not.toBe(true);+ expect(verified.structuredContent).toMatchObject({+ normalized_result: {+ status: "pass",+ claims: {+ items: [+ {+ status: "pass",+ observed_status: "unchanged",+ evidence_links: expect.arrayContaining([+ cliEvidence.evidence_id,+ mcpEvidence.evidence_id,+ comparison.evidence_id,+ ]),+ },+ ],+ },+ },+ });+const behavior = await call("find_changed_behavior", {comparisons: [comparison],});