import { ChatAgent, ChatAgentLocation, MutableChatRequestModel } from '@theia/ai-chat'; import { TokenUsageService } from '@theia/ai-core'; import { ILogger } from '@theia/core'; import { URI } from '@theia/core/lib/common/uri'; import type { ItemStartedEvent, ItemUpdatedEvent, ItemCompletedEvent, TurnCompletedEvent, TurnFailedEvent, ThreadEvent, ThreadItem, CommandExecutionItem, FileChangeItem, McpToolCallItem, WebSearchItem, Usage, TodoListItem } from '@openai/codex-sdk'; import { FileService } from '@theia/filesystem/lib/browser/file-service'; import { WorkspaceService } from '@theia/workspace/lib/browser'; import { ChangeSetFileElementFactory } from '@theia/ai-chat/lib/browser/change-set-file-element'; import { CodexToolCallChatResponseContent } from './codex-tool-call-content'; import { CodexFrontendService } from './codex-frontend-service'; export declare const CODEX_CHAT_AGENT_ID = "Codex"; export declare const CODEX_INPUT_TOKENS_KEY = "codexInputTokens"; export declare const CODEX_OUTPUT_TOKENS_KEY = "codexOutputTokens"; export declare const CODEX_TOOL_CALLS_KEY = "codexToolCalls"; type ToolInvocationItem = CommandExecutionItem | FileChangeItem | McpToolCallItem | WebSearchItem | TodoListItem; /** * Chat agent for OpenAI Codex integration. */ export declare class CodexChatAgent implements ChatAgent { id: string; name: string; description: string; iconClass: string; locations: ChatAgentLocation[]; tags: string[]; variables: string[]; prompts: []; languageModelRequirements: []; agentSpecificVariables: []; functions: string[]; modes: { id: string; name: string; }[]; protected codexService: CodexFrontendService; protected tokenUsageService: TokenUsageService; protected readonly fileService: FileService; protected readonly workspaceService: WorkspaceService; protected readonly fileChangeFactory: ChangeSetFileElementFactory; protected readonly logger: ILogger; invoke(request: MutableChatRequestModel): Promise; protected extractSandboxMode(modeId?: string): 'read-only' | 'workspace-write' | 'danger-full-access'; protected getToolCalls(request: MutableChatRequestModel): Map; protected handleEvent(event: ThreadEvent, request: MutableChatRequestModel): Promise; /** * Type guard using discriminated union narrowing from SDK types. */ protected isToolInvocation(item: ThreadItem): item is ToolInvocationItem; protected extractToolArguments(item: ToolInvocationItem): string; /** * Creates a pending tool call that will be updated when the item completes. */ protected handleItemStarted(event: ItemStartedEvent, request: MutableChatRequestModel): Promise; /** * Updates the pending tool call with new data, especially for todo_list items. */ protected handleItemUpdated(event: ItemUpdatedEvent, request: MutableChatRequestModel): Promise; protected findMatchingToolCall(item: ToolInvocationItem, toolCalls: Map): [string, CodexToolCallChatResponseContent] | undefined; protected getFileChangeOriginals(request: MutableChatRequestModel): Map>; /** * Snapshot the original contents for files that Codex is about to modify so we can populate the change set later. */ protected captureFileChangeOriginals(item: FileChangeItem, request: MutableChatRequestModel): Promise; protected handleFileChangeCompleted(item: FileChangeItem, request: MutableChatRequestModel): Promise; protected normalizeRelativePath(path: string, rootUri?: URI): string | undefined; protected ensureTrailingSlash(path: string): string; protected resolveFileUri(rootUri: URI, relativePath: string): URI | undefined; protected getWorkspaceRootUri(): Promise; protected handleItemCompleted(event: ItemCompletedEvent, request: MutableChatRequestModel): Promise; protected handleTurnCompleted(event: TurnCompletedEvent, request: MutableChatRequestModel): void; protected handleTurnFailed(event: TurnFailedEvent, request: MutableChatRequestModel): void; protected updateTokens(request: MutableChatRequestModel, inputTokens: number, outputTokens: number): void; protected updateSessionSuggestion(request: MutableChatRequestModel): void; protected getSessionTotalTokens(request: MutableChatRequestModel): { inputTokens: number; outputTokens: number; }; protected reportTokenUsage(request: MutableChatRequestModel, usage: Usage): Promise; } export {}; //# sourceMappingURL=codex-chat-agent.d.ts.map