refactor(domain): remove provider-specific target and snapshot state
Move Hopper loader derivation and compatibility projection into the Hopper adapter so BinaryTarget carries only provider-neutral identity and format metadata. Introduce bounded canonical analysis-profile commitments, exact provider/profile snapshot v2 bindings, legacy snapshot rejection guidance, and backward-compatible profiled Evidence v2 records. Partition cache and replay behavior by target, concrete provider build, and profile while preserving custom Hopper loader overrides. Propagate profiles consistently through CLI, MCP, composed workflows, and session lifecycle; preserve the 78-tool contract and legacy loaderArgs response projection. Add migration documentation, generated API updates, property regressions, package verification, and real Hopper coverage.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { ToolContract } from "./toolContracts.js";
|
||||
import { z } from "zod";
|
||||
import { evidenceSchema } from "../domain/evidence.js";
|
||||
import { evidenceEnvelopeSchema } from "../domain/evidence.js";
|
||||
import {
|
||||
browserTargetListSchema,
|
||||
inspectWebPageInputSchema,
|
||||
@@ -31,17 +31,17 @@ import {
|
||||
} from "../domain/webScreenshot.js";
|
||||
|
||||
const evidenceResult = <Schema extends z.ZodType>(schema: Schema) =>
|
||||
evidenceSchema
|
||||
evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: schema });
|
||||
const listOutputSchema = evidenceResult(browserTargetListSchema);
|
||||
const inspectionOutputSchema = evidenceSchema
|
||||
const inspectionOutputSchema = evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: webPageInspectionSchema });
|
||||
const bundleOutputSchema = evidenceSchema
|
||||
const bundleOutputSchema = evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: webBundleAnalysisSchema });
|
||||
const observationSessionOutputSchema = evidenceSchema
|
||||
const observationSessionOutputSchema = evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: webObservationSessionSchema });
|
||||
const webMcpOutputSchema = evidenceResult(webMcpDiscoverySchema);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ToolContract } from "./toolContracts.js";
|
||||
import { evidenceSchema } from "../domain/evidence.js";
|
||||
import { evidenceEnvelopeSchema } from "../domain/evidence.js";
|
||||
import {
|
||||
electronPageInspectionSchema,
|
||||
electronTargetListSchema,
|
||||
@@ -7,10 +7,10 @@ import {
|
||||
listElectronTargetsInputSchema,
|
||||
} from "../domain/electronObservation.js";
|
||||
|
||||
const listOutputSchema = evidenceSchema
|
||||
const listOutputSchema = evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: electronTargetListSchema });
|
||||
const inspectionOutputSchema = evidenceSchema
|
||||
const inspectionOutputSchema = evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: electronPageInspectionSchema });
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ export const binarySessionInputSchema = z.object({
|
||||
export const SESSION_TOOL_CONTRACTS = [
|
||||
session(
|
||||
"open_binary",
|
||||
"Open a local executable, application bundle, archive, JavaScript, source map, plist, or Hopper database after validation. An optional provider-neutral snapshot is imported atomically and must match the binary digest, format, and architecture exactly; provider resources may still start before an MCP cache replay.",
|
||||
"Open a local executable, application bundle, archive, JavaScript, source map, plist, or analysis database after validation. An optional snapshot v2 is imported atomically and must match the binary identity, concrete provider, and canonical analysis profile exactly; provider resources may still start before an MCP cache replay.",
|
||||
openBinaryInputSchema,
|
||||
),
|
||||
session(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { z } from "zod";
|
||||
import { evidenceSchema } from "../domain/evidence.js";
|
||||
import { evidenceEnvelopeSchema } from "../domain/evidence.js";
|
||||
import {
|
||||
processCaptureComparisonSchema,
|
||||
processCaptureSchema,
|
||||
@@ -28,7 +28,7 @@ import { reconstructionVerificationResultSchema } from "../domain/reconstruction
|
||||
import { analysisErrorProjectionSchema } from "./errorSchemas.js";
|
||||
|
||||
const resultOf = (schema: z.ZodType) =>
|
||||
evidenceSchema
|
||||
evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: schema });
|
||||
const lifecycleResultOf = (schema: z.ZodType) => z.object({ result: schema });
|
||||
@@ -45,6 +45,7 @@ export const requireOutputSchema = (
|
||||
};
|
||||
const targetFormatSchema = z.enum([
|
||||
"hopper",
|
||||
"analysis-database",
|
||||
"mach-o",
|
||||
"elf",
|
||||
"pe",
|
||||
@@ -473,47 +474,47 @@ export const sessionOutputSchemas: Readonly<Record<string, z.ZodObject>> = {
|
||||
}),
|
||||
),
|
||||
capture_process_scenario: lifecycleResultOf(
|
||||
evidenceSchema
|
||||
evidenceEnvelopeSchema
|
||||
.omit({ normalized_result: true })
|
||||
.extend({ normalized_result: processCaptureSchema }),
|
||||
),
|
||||
compare_process_captures: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: processCaptureComparisonSchema,
|
||||
}),
|
||||
),
|
||||
compare_artifacts: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: artifactComparisonResultSchema,
|
||||
}),
|
||||
),
|
||||
compare_functions: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: functionComparisonResultSchema,
|
||||
}),
|
||||
),
|
||||
compare_bundles: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: bundleComparisonResultSchema,
|
||||
}),
|
||||
),
|
||||
find_changed_behavior: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: changedBehaviorResultSchema,
|
||||
}),
|
||||
),
|
||||
build_call_path: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: callPathResultSchema,
|
||||
}),
|
||||
),
|
||||
correlate_static_and_runtime: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: staticRuntimeCorrelationResultSchema,
|
||||
}),
|
||||
),
|
||||
verify_reconstruction: lifecycleResultOf(
|
||||
evidenceSchema.omit({ normalized_result: true }).extend({
|
||||
evidenceEnvelopeSchema.omit({ normalized_result: true }).extend({
|
||||
normalized_result: reconstructionVerificationResultSchema,
|
||||
}),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user