import { type SystemMessage } from "@bastani/pi-ai"; import type { Api, Model } from "@bastani/pi-ai/compat"; import type { AgentMessage, ThinkingLevel } from "@earendil-works/pi-agent-core"; import type { AgentSessionInternalSurface as AgentSession } from "./agent-session-methods.ts"; import type { ToolDefinition, ToolInfo } from "./extensions/index.js"; import { type NormalizedBuildSystemPromptOptions } from "./system-prompt.ts"; import { type ToolStatusReport } from "./tool-status.js"; export declare function getActiveToolNames(this: AgentSession): string[]; export declare function getCallableToolNames(this: AgentSession): string[]; /** * Get all configured tools with name, description, parameter schema, and source metadata. */ export declare function getAllTools(this: AgentSession): ToolInfo[]; export declare function getToolDefinition(this: AgentSession, name: string): ToolDefinition | undefined; /** * Explain every registered tool (active or not, and why), where the tool selection came from, * and which selected names nothing registered. Format it with `formatToolStatus()`. */ export declare function getToolStatus(this: AgentSession): ToolStatusReport; /** * Set active tools by name. * Only tools in the registry can be enabled. Unknown tool names are ignored. * Also rebuilds the system prompt to reflect the new tool set. * Changes take effect on the next agent turn. */ export declare function setActiveToolsByName(this: AgentSession, toolNames: string[]): void; export declare function _setActiveTools(this: AgentSession, toolNames: string[]): void; /** Whether compaction or branch summarization is currently running */ export declare function setScopedModels(this: AgentSession, scopedModels: Array<{ model: Model; thinkingLevel?: ThinkingLevel; }>): void; /** File-based prompt templates */ export declare function _normalizePromptSnippet(this: AgentSession, text: string | undefined): string | undefined; export declare function _normalizePromptGuidelines(this: AgentSession, guidelines: string[] | undefined): string[]; export declare function _rebuildSystemPrompt(this: AgentSession, toolNames: string[]): void; export declare function _refreshBaseSystemPromptFromActiveTools(this: AgentSession): void; /** Diff structured prompt state; executable tool changes are declared by the agent loop. */ export declare function _preparePromptAndToolLoadout(this: AgentSession, options: NormalizedBuildSystemPromptOptions, messages?: AgentMessage[]): SystemMessage | undefined; export declare function preservesInitialToolLoadout(session: AgentSession): boolean; /** The tools the selected transcript records, and every tool it ever added or removed. */ export interface RecordedToolLoadout { readonly current: readonly string[]; readonly mentioned: ReadonlySet; } /** The recorded loadout of the selected branch, or undefined when it recorded none. */ export declare function recordedToolLoadout(session: AgentSession): RecordedToolLoadout | undefined; /** * Whether restoring a transcript activates a registered tool it never mentioned. Such an extension tool * was registered after the branch recorded its loadout, so it activates like a newly registered tool. * Built-in tools follow `defaultTools` instead, and opt-in tools stay inactive until a selection names them. */ export declare function activatesAfterRecordedLoadout(session: AgentSession, recorded: RecordedToolLoadout, name: string, definition: { exposure?: string; defaultActive?: boolean; } | undefined): boolean; /** * Restore registered tools from the selected transcript, not another branch's live state. * * Explicit tool selections keep their built-in loadout while restoring dynamically registered tools. * Default selections restore the recorded loadout with any CLI modifiers applied. Extension tools the * branch never added or removed were registered after it recorded its loadout, so they are activated * like newly registered tools. */ export declare function _restoreToolsFromTranscript(this: AgentSession, options?: { startup?: boolean; }): void; /** * Send a prompt to the agent. * - Handles extension commands (registered via pi.registerCommand) immediately, even during streaming * - Expands file-based prompt templates by default * - During streaming, queues via steer() or followUp() based on streamingBehavior option * - Validates model and API key before sending (when not streaming) * @throws Error if streaming and no streamingBehavior specified * @throws Error if no model selected or no API key available (when not streaming) */ export declare const agentSessionStateMethods: { getActiveToolNames: typeof getActiveToolNames; getCallableToolNames: typeof getCallableToolNames; getAllTools: typeof getAllTools; getToolDefinition: typeof getToolDefinition; getToolStatus: typeof getToolStatus; setActiveToolsByName: typeof setActiveToolsByName; _setActiveTools: typeof _setActiveTools; setScopedModels: typeof setScopedModels; _normalizePromptSnippet: typeof _normalizePromptSnippet; _normalizePromptGuidelines: typeof _normalizePromptGuidelines; _rebuildSystemPrompt: typeof _rebuildSystemPrompt; _preparePromptAndToolLoadout: typeof _preparePromptAndToolLoadout; _restoreToolsFromTranscript: typeof _restoreToolsFromTranscript; _refreshBaseSystemPromptFromActiveTools: typeof _refreshBaseSystemPromptFromActiveTools; }; //# sourceMappingURL=agent-session-state.d.ts.map