/** * v1 tool definitions -> v2 tool registrations. * * Two shapes have to be translated, and both translations are load-bearing: * * 1. THE RESULT. v1 tools answer `{output: string, attachments?: [...]}`. A * live probe measured what the v2 host does with that: every tool that * returned a bare `output` without declaring an `output` schema came back as * "Tool result declared output without an output schema". So the v2 adapter * answers with `content` parts instead — text plus `file` entries, which is * also the first time a screenshot attachment has had a host contract we can * VERIFY rather than assume (the v1 capability row for it is still 未验证). * 2. THE CONTEXT. Our tools read `{directory, sessionID, agent, ask}` off the * per-call ctx. v2's ToolContext carries `{sessionID, agent, messageID, id, * progress}` and NO directory and NO ask bridge. Directory comes from the * boot location; the missing ask bridge is left missing on purpose, because * `askFnOf` then reports "unavailable" and every governed call fails CLOSED * rather than pretending somebody approved it. */ import type { ToolDefinition } from "../types.js"; import type { V2ToolContext, V2ToolInfo, V2ToolResult } from "./v2-types.js"; /** * `args` is a ZodRawShape (see `src/tm/args-schema.ts`) — but it is a * *descriptor* when zod could not be loaded, and it may already be a JSON * Schema. `exact:false` means the model gets no parameter guidance for this * tool, which the caller reports instead of hiding: a tool the model cannot * call correctly is a tool that is broken, whatever the code says. */ export declare function inputSchemaFor(args: unknown): Promise<{ schema: Record; exact: boolean; source: string; note?: string; }>; /** The per-execute literal our pipelines expect. */ export declare function v2ToolCtx(ctx: V2ToolContext, directory: string): Record; export declare function v2Result(res: unknown): V2ToolResult; export interface V2ToolBinding { readonly tool: V2ToolInfo; readonly inputExact: boolean; /** How the schema was obtained: "zod" | "json-schema" | "descriptor" | * "permissive". `exact` alone cannot tell a translated zod shape from a * regex read of a descriptor string, and the boot log must not claim the * two are the same fact. */ readonly inputSource: string; readonly note?: string; } /** * Wrap one v1 ToolDefinition. `execute` may be absent on exotic hosts; a tool * that cannot run must not be registered at all, because the model would spend * a round on it and get nothing. */ export declare function bindV2Tool(name: string, def: ToolDefinition, directory: string, /** Every call to OUR tool tells the host-scope resolver which sessions belong to * Team (#22) — the one fact about a session we can learn from the inside. */ onCall?: (agent: unknown, sessionID: unknown) => void, /** `codemodeDirect: true` sends `options:{codemode:false}`, which the 2.0.16 * binary uses as the visibility switch: without it a registered tool reaches the * model ONLY inside the Code Mode catalog, with its description cut to the first * line — so every governance sentence we wrote below that line never arrives. * Off by default because the cost is the whole definition set riding every * request; the number is measured, not argued (see TM_V2_CODEMODE). */ opts?: { codemodeDirect?: boolean; }): Promise; //# sourceMappingURL=v2-tool.d.ts.map