Files
reverse-engineering-anything/src/contracts/toolContractHelpers.ts
T
morluto 2f71375efc fix(hopper)!: bind analysis to the active target and correct boundary contracts
Preserve native document identity, nullable bookmark labels, address diagnostics, segment-end byte prefixes, and verified file mappings. Validate batch rename addresses before mutation.

BREAKING CHANGE: remove set_current_document. Use open_binary to switch targets; document arguments are scoped to the active target.
2026-10-09 02:05:31 +08:00

34 lines
1017 B
TypeScript

import { z } from "zod";
import { jsonValueSchema } from "../domain/jsonValue.js";
import { TOOL_EXAMPLE_OVERRIDES } from "./toolContractExamples.js";
import type { ToolExample } from "./toolContractTypes.js";
export const document = z
.string()
.optional()
.describe(
"The active target's provider document name; use open_binary to switch targets",
);
export const address = z
.string()
.describe(
"A provider-normalized address; default memory uses 0x-prefixed hexadecimal",
);
export const optionalAddress = address.optional();
export const procedure = z.string().describe("The procedure name or address");
const exampleInputSchema = z.record(z.string(), jsonValueSchema);
export const examplesFor = (
name: string,
inputSchema: z.ZodObject,
): readonly ToolExample[] => {
const parsed = inputSchema.parse(TOOL_EXAMPLE_OVERRIDES[name] ?? {});
return [
{
title: `Example ${name.replaceAll("_", " ")} request`,
input: exampleInputSchema.parse(parsed),
},
];
};