Skip to content

armgit / rea

Public Imported from GitHub
0

Reverse engineer anything with agents, from app behavior down to native binaries.

1.1 KB
Raw Blame
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 { err, type Result } from "../domain/result.js";
import {
  enhancedInputSchemas,
  type EnhancedToolName,
} from "../contracts/enhancedInputs.js";

export type EnhancedResult = Promise<Result<JsonValue, AnalysisError>>;
export type TraceMatch = {
  readonly type: string;
  readonly address: string;
  readonly value: string;
};
export type TraceReference = {
  readonly target_address: string;
  readonly source_address: string;
  readonly containing_procedure: JsonValue;
};

/** 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 })));