import { type AgentToolResult } from "@earendil-works/pi-coding-agent"; import type { CallToolResult, ReadResourceResult } from "@modelcontextprotocol/client"; import { type Candidate, type ResourceTarget, type TemplateTarget } from "./resources.js"; import type { CatalogTool } from "./catalog.js"; import { type Diagnostic } from "./diagnostics.js"; export type RowState = "candidate" | "active" | "queued" | "running" | "done" | "failed" | "cancelled"; export interface DisplayRow { label: string; description?: string; inlineDescription?: string; inlineAction?: string; state: RowState; } /** Character offsets into the model-facing text, without duplicating payloads. */ export interface DisplayBlock { start: number; end: number; mimeType?: string; structured?: boolean; resourceLink?: boolean; truncated?: boolean; } export interface ClientDetails { mcpClient: 1; rows: DisplayRow[]; failed?: boolean; diagnostics?: Diagnostic[]; loaded?: CatalogTool[]; candidates?: Candidate[]; resource?: ResourceTarget; /** Search-only display notes; omit the duplicated model response in the TUI. */ searchNotes?: string[]; fullOutputPath?: string; displayBlocks?: DisplayBlock[]; } /** Report failures through Pi's `isError`, which keeps `details` for the UI and scripts. */ export declare function markingFailures(execute: (...args: A) => Promise): (...args: A) => Promise; /** Scripts receive the whole result. The generic shape needs no per-tool schema. */ export declare const MCP_RESULT_SCHEMA: { readonly type: "object"; readonly properties: { readonly content: { readonly type: "array"; readonly items: { readonly type: "object"; }; }; readonly structuredContent: {}; readonly isError: { readonly type: "boolean"; }; }; readonly required: readonly ["content"]; }; export declare function textResult(text: string, details: ClientDetails): AgentToolResult; /** A resource read is its own context attachment, never a second chat message. */ export declare function convertResourceResult(result: ReadResourceResult, target: ResourceTarget, template?: TemplateTarget): Promise>; export declare function convertResult(result: CallToolResult, label: string): Promise>;