import type { AgentToolResult, AgentToolUpdateCallback } from '@earendil-works/pi-agent-core'; import type { TurnOrigin } from '@xopcai/endpoint-tools-protocol'; export declare const EXTERNAL_TOOL_SOURCES: readonly ["cli", "composio", "extension", "endpoint"]; export type ExternalToolSource = (typeof EXTERNAL_TOOL_SOURCES)[number]; export interface ExternalToolSearchHit { toolRef: string; source: ExternalToolSource; namespace: string; title: string; summary: string; } export interface ExternalConnectionCandidate { candidateRef: string; source: ExternalToolSource; label: string; summary: string; capabilities: string[]; reason: 'not_connected' | 'reauthorize'; } export interface ExternalToolDescriptor extends ExternalToolSearchHit { description: string; inputSchema: Record; outputSchema?: Record; annotations?: import('@earendil-works/pi-coding-agent').ToolAnnotations; /** Provider execution identity, including connection epochs and policy contracts. */ contractRevision?: string; exposure?: import('@earendil-works/pi-coding-agent').ToolExposure; /** Host-curated contract; never copied from remote readOnlyHint annotations. */ batchRead?: boolean; /** Host-curated read scope; separate from eligibility for batch execution. */ readOnly?: boolean; /** Host-classified device role for endpoint tools in the current turn. */ deviceRole?: 'source' | 'selected' | 'other'; } export interface VersionedExternalToolDescriptor extends ExternalToolDescriptor { revision: string; } export interface ExternalToolExecutionContext { toolCallId: string; signal?: AbortSignal; onUpdate?: AgentToolUpdateCallback>; contractRevision?: string; /** Host authorization recheck immediately before remote dispatch. */ authorize?: () => void; validateArguments?: (args: Record) => void; } export interface ExternalToolTurnContext { channel: string; chatId: string; conversationId: string; origin: TurnOrigin; } /** Host-selected discovery scope; never supplied by the model. */ export interface ExternalToolDiscoveryContext { connectorId: string; accountId: string; } export interface ExternalToolProvider { readonly source: ExternalToolSource; catalog?(): Promise; search(query: string, context?: ExternalToolDiscoveryContext): Promise; connectionCandidates?(query: string): Promise; describe(toolRef: string, context?: ExternalToolDiscoveryContext): Promise; execute(toolRef: string, args: Record, approvalId: string | undefined, context: ExternalToolExecutionContext): Promise>>; }