Files
reverse-engineering-anything/src/application/EnhancedToolTypes.ts
T
morluto 676d29f9ee fix(native): preserve qualified feature trace observations
Use one containing-procedure parser beside its declared schema for
navigation, address facets, and feature trace references. Keep the trace
cache and reference type bound to parsed facts, returning typed malformed
output before SDK projection instead of passing unchecked JSON onward.

Retain same-address search alternatives such as Kuna's distinct string
encodings. References identify target addresses, so observe and emit each
target once while retaining duplicate rows from the provider observation.
Remove address-only match collapse and redundant residual deduplication.
Document these semantics.

Validation: regression-first runs reproduced four malformed-resolution
failures and three alternative/reference-replay failures. Focused MCP and
consumer controls passed after repair. Real native engines were not run.
2026-10-24 09:17:10 +08:00

34 lines
1.2 KiB
TypeScript

import type { z } from "zod";
import { AnalysisInputError } from "../domain/analysisErrorCore.js";
import type { AnalysisError } from "../domain/analysisErrorBase.js";
import type { JsonValue } from "../domain/jsonValue.js";
import type { ContainingProcedureResolution } from "../domain/hopperValues.js";
import { err, type Result } from "../domain/result.js";
import {
enhancedInputSchemas,
type EnhancedToolName,
} from "../contracts/enhancedInputs.js";
export type EnhancedResult = Promise<Result<JsonValue, AnalysisError>>;
export type { LiteralFeatureMatch as TraceMatch } from "../domain/native/literalFeatureMatch.js";
export type TraceReference = {
readonly target_address: string;
readonly source_address: string;
readonly containing_procedure: ContainingProcedureResolution;
};
/** One enhanced call whose input was parsed at its owning adapter boundary. */
export type ValidatedEnhancedCall = {
[Name in EnhancedToolName]: {
readonly name: Name;
readonly input: z.output<(typeof enhancedInputSchemas)[Name]>;
};
}[EnhancedToolName];
export const invalidEnhancedInput = (
name: EnhancedToolName,
cause: Error,
): EnhancedResult =>
Promise.resolve(err(new AnalysisInputError(name, { cause })));