import type { AgentAttachment } from "./messages.js"; export type AgentProvider = string; export interface AgentMetadata { [key: string]: unknown; } export type AgentProviderNotice = { type: "info"; message: string; } | { type: "warning"; message: string; } | { type: "error"; message: string; }; /** * Stdio-based MCP server (spawns a subprocess). */ export interface McpStdioServerConfig { type: "stdio"; command: string; args?: string[]; env?: Record; /** * When true, all tools from this server are always included in the prompt * and never deferred behind tool search. Honored by the Claude provider. */ alwaysLoad?: boolean; } /** * HTTP-based MCP server. */ export interface McpHttpServerConfig { type: "http"; url: string; headers?: Record; /** * When true, all tools from this server are always included in the prompt * and never deferred behind tool search. Honored by the Claude provider. */ alwaysLoad?: boolean; } /** * SSE-based MCP server (Server-Sent Events over HTTP). */ export interface McpSseServerConfig { type: "sse"; url: string; headers?: Record; /** * When true, all tools from this server are always included in the prompt * and never deferred behind tool search. Honored by the Claude provider. */ alwaysLoad?: boolean; } /** * Canonical MCP server configuration. * Discriminated union by `type` field. * Each provider normalizes this to their expected format. */ export type McpServerConfig = McpStdioServerConfig | McpHttpServerConfig | McpSseServerConfig; export interface AgentMode { id: string; label: string; description?: string; icon?: string; colorTier?: string; } export type ProviderStatus = "ready" | "loading" | "error" | "unavailable"; export interface AgentModelDefinition { provider: AgentProvider; id: string; aliases?: string[]; isSelectable?: boolean; label: string; description?: string; isDefault?: boolean; metadata?: AgentMetadata; contextWindowMaxTokens?: number; thinkingOptions?: AgentSelectOption[]; defaultThinkingOptionId?: string; } export interface AgentSelectOption { id: string; label: string; description?: string; isDefault?: boolean; metadata?: AgentMetadata; } export declare function normalizeAgentModelDefinition(model: AgentModelDefinition): AgentModelDefinition; /** A provider addresses models by ID; repeated rows retain the first definition. */ export declare function normalizeAgentModelCatalog(models: AgentModelDefinition[]): AgentModelDefinition[]; export interface ProviderSnapshotEntry { provider: AgentProvider; status: ProviderStatus; enabled: boolean; source?: "builtin" | "custom"; error?: string; models?: AgentModelDefinition[]; modes?: AgentMode[]; fetchedAt?: string; label?: string; description?: string; iconSvg?: string; defaultModeId?: string | null; } export interface AgentFeatureToggle { type: "toggle"; id: string; label: string; description?: string; tooltip?: string; icon?: string; value: boolean; } export interface AgentFeatureSelect { type: "select"; id: string; label: string; description?: string; tooltip?: string; icon?: string; value: string | null; options: AgentSelectOption[]; } export type AgentFeature = AgentFeatureToggle | AgentFeatureSelect; export interface AgentCapabilityFlags { [capability: string]: boolean | undefined; supportsStreaming: boolean; supportsSessionPersistence: boolean; supportsSessionListing?: boolean; supportsDynamicModes: boolean; supportsMcpServers: boolean; supportsReasoningStream: boolean; supportsToolInvocations: boolean; supportsRewindConversation?: boolean; supportsRewindFiles?: boolean; supportsRewindBoth?: boolean; } export interface AgentPersistenceHandle { provider: AgentProvider; sessionId: string; /** Provider specific handle (Codex thread id, Claude resume token, etc). */ nativeHandle?: string; metadata?: AgentMetadata; } export type AgentPromptContentBlock = { type: "text"; text: string; } | { type: "image"; data: string; mimeType: string; } | AgentAttachment; export type AgentPromptInput = string | AgentPromptContentBlock[]; export interface AgentRunOptions { outputSchema?: unknown; resumeFrom?: AgentPersistenceHandle; maxThinkingTokens?: number; } export interface AgentUsage { inputTokens?: number; cachedInputTokens?: number; outputTokens?: number; totalCostUsd?: number; contextWindowMaxTokens?: number; contextWindowUsedTokens?: number; } export declare const TOOL_CALL_ICON_NAMES: readonly ["wrench", "square_terminal", "eye", "pencil", "search", "bot", "sparkles", "brain", "mic_vocal"]; export type ToolCallIconName = (typeof TOOL_CALL_ICON_NAMES)[number]; export type ToolCallDetail = { type: "shell"; command: string; cwd?: string; output?: string; exitCode?: number | null; } | { type: "read"; filePath: string; content?: string; offset?: number; limit?: number; } | { type: "edit"; filePath: string; oldString?: string; newString?: string; unifiedDiff?: string; } | { type: "write"; filePath: string; content?: string; } | { type: "search"; query: string; toolName?: "search" | "grep" | "glob" | "web_search"; content?: string; filePaths?: string[]; webResults?: Array<{ title: string; url: string; }>; annotations?: string[]; numFiles?: number; numMatches?: number; durationMs?: number; durationSeconds?: number; truncated?: boolean; mode?: "content" | "files_with_matches" | "count"; } | { type: "fetch"; url: string; prompt?: string; result?: string; code?: number; codeText?: string; bytes?: number; durationMs?: number; } | { type: "worktree_setup"; worktreePath: string; branchName: string; log: string; commands: Array<{ index: number; command: string; cwd: string; log: string; status: "running" | "completed" | "failed"; exitCode: number | null; durationMs?: number; }>; truncated?: boolean; } | { type: "sub_agent"; subAgentType?: string; description?: string; childSessionId?: string; log: string; actions?: Array<{ index: number; toolName: string; summary?: string; }>; } | { type: "plain_text"; label?: string; text?: string; icon?: ToolCallIconName; } | { type: "plan"; text: string; } | { type: "unknown"; input: unknown; output: unknown; }; interface ToolCallBase { [key: string]: unknown; type: "tool_call"; callId: string; name: string; detail: ToolCallDetail; metadata?: Record; } type ToolCallRunningTimelineItem = ToolCallBase & { status: "running"; error: null; }; type ToolCallCompletedTimelineItem = ToolCallBase & { status: "completed"; error: null; }; type ToolCallFailedTimelineItem = ToolCallBase & { status: "failed"; error: unknown; }; type ToolCallCanceledTimelineItem = ToolCallBase & { status: "canceled"; error: null; }; export type ToolCallTimelineItem = ToolCallRunningTimelineItem | ToolCallCompletedTimelineItem | ToolCallFailedTimelineItem | ToolCallCanceledTimelineItem; export interface CompactionTimelineItem { [key: string]: unknown; type: "compaction"; status: "loading" | "completed"; trigger?: "auto" | "manual"; preTokens?: number; } export interface PluginTimelineItem { type: "plugin"; id: string; pluginId: string; kind: string; version: number; data: JsonValue; } export interface AgentTaskItem { text: string; completed: boolean; id?: string; status?: "pending" | "in_progress" | "completed"; activeForm?: string; } export type AgentTimelineItem = { type: "user_message"; text: string; messageId?: string; clientMessageId?: string; } | { type: "assistant_message"; text: string; messageId?: string; } | { type: "reasoning"; text: string; } | ToolCallTimelineItem | { type: "todo"; items: AgentTaskItem[]; } | { type: "error"; message: string; } | { type: "notification"; level: "info" | "warning" | "error"; message: string; } | CompactionTimelineItem | PluginTimelineItem; export type AgentStreamEvent = { type: "thread_started"; sessionId: string; provider: AgentProvider; } | { type: "turn_started"; provider: AgentProvider; turnId?: string; } | { type: "turn_completed"; provider: AgentProvider; usage?: AgentUsage; turnId?: string; } | { type: "usage_updated"; provider: AgentProvider; usage: AgentUsage; turnId?: string; } | { type: "mode_changed"; provider: AgentProvider; currentModeId: string | null; availableModes: AgentMode[]; } | { type: "model_changed"; provider: AgentProvider; runtimeInfo: AgentRuntimeInfo; } | { type: "thinking_option_changed"; provider: AgentProvider; thinkingOptionId: string | null; } | { type: "turn_failed"; provider: AgentProvider; error: string; code?: string; diagnostic?: string; turnId?: string; } | { type: "turn_canceled"; provider: AgentProvider; reason: string; turnId?: string; } | { type: "timeline"; item: AgentTimelineItem; provider: AgentProvider; turnId?: string; timestamp?: string; } | { type: "permission_requested"; provider: AgentProvider; request: AgentPermissionRequest; turnId?: string; } | { type: "permission_resolved"; provider: AgentProvider; requestId: string; resolution: AgentPermissionResponse; turnId?: string; } | { type: "attention_required"; provider: AgentProvider; reason: "finished" | "error" | "permission"; timestamp: string; }; export declare function getAgentStreamEventTurnId(event: AgentStreamEvent): string | undefined; export type AgentPermissionRequestKind = "tool" | "plan" | "question" | "mode" | "other"; export type AgentPermissionUpdate = AgentMetadata; export interface AgentPermissionAction { id: string; label: string; behavior: "allow" | "deny"; variant?: "primary" | "secondary" | "danger"; intent?: "implement" | "implement_resume" | "dismiss"; } export interface AgentPermissionRequest { id: string; provider: AgentProvider; name: string; kind: AgentPermissionRequestKind; title?: string; description?: string; input?: AgentMetadata; detail?: ToolCallDetail; suggestions?: AgentPermissionUpdate[]; actions?: AgentPermissionAction[]; metadata?: AgentMetadata; } export type AgentPermissionResponse = { behavior: "allow"; selectedActionId?: string; updatedInput?: AgentMetadata; updatedPermissions?: AgentPermissionUpdate[]; } | { behavior: "deny"; selectedActionId?: string; message?: string; interrupt?: boolean; }; export interface AgentRunResult { sessionId: string; finalText: string; usage?: AgentUsage; timeline: AgentTimelineItem[]; canceled?: boolean; } export type JsonValue = null | boolean | number | string | JsonValue[] | { [key: string]: JsonValue; }; export type ProviderOptions = Record; export interface McpToolRef { kind: "mcp"; server: string; tool: string; } export interface ToolPolicy { preapproved: McpToolRef[]; } export interface AgentSessionConfig { provider: AgentProvider; cwd: string; /** * Provider-agnostic system/developer instruction string. * Mapped by each provider to its native instruction field. */ systemPrompt?: string; modeId?: string; model?: string; thinkingOptionId?: string; featureValues?: Record; title?: string | null; providerOptions?: ProviderOptions; toolPolicy?: ToolPolicy; mcpServers?: Record; /** * Internal agents are hidden from listings and don't trigger notifications. * They are used for ephemeral system tasks like commit/PR generation. */ internal?: boolean; } export interface AgentRuntimeInfo { provider: AgentProvider; sessionId: string | null; model?: string | null; thinkingOptionId?: string | null; modeId?: string | null; extra?: AgentMetadata; } export {}; //# sourceMappingURL=agent-types.d.ts.map