/** * tm layer — structured errors (T1.4) + the ToolResult rendering contract * (official tool.d.ts:39-46). Split out of the former tools.ts hub; behavior * unchanged. * * ToolResult contract: execute() returns {output: string} — ALWAYS. Handles, * structured errors, pages and degraded warnings are formatted INTO the * output text; a bare object return crashes the host result pipeline * (`c.split`) and the model would never see the handle it needs to drive * tm_fetch. */ import type { ToolResult } from "../types.js"; export type TmPhase = "args" | "permission" | "client" | "execute" | "store" | "governance"; export interface TmErrorBody { error: { tool: string; phase: TmPhase; message: string; line?: number; }; } export declare function tmError(tool: string, phase: TmPhase, message: string, line?: number): TmErrorBody; /** Fixed invalid-handle message (spec-pinned wording for tm_fetch). */ export declare const HANDLE_INVALID_MESSAGE = "\u8F7D\u8377\u6587\u4EF6\u5DF2\u88AB TTL \u6E05\u626B\uFF0C\u91CD\u8DD1\u539F\u5DE5\u5177\u5373\u53EF\u91CD\u65B0\u5378\u8F7D\uFF08\u53E5\u67C4\u5BFF\u547D\u7B49\u4E8E\u8F7D\u8377\u6587\u4EF6\u5BFF\u547D\uFF0C\u8FC7\u671F\u65F6\u95F4\u53EA\u4F5C\u63D0\u793A\u3001\u4E0D\u4F5C\u62D2\u7EDD\uFF09\u3002"; export declare function isTmErrorBody(res: unknown): res is TmErrorBody; /** * Render one pipeline result as the host ToolResult: `{output: string}`. * The model can ONLY see this text — so the handle fields it needs to drive * tm_fetch (ref/access_token/expire_at), the preview, paging hints, error * phase/message and degraded warnings are all formatted INTO the output. * Exported for the tm_webfetch tool (built outside the pipelines module). */ export declare function toToolResult(res: unknown): ToolResult; //# sourceMappingURL=result.d.ts.map