/** * @license * Copyright 2025 Qwen * SPDX-License-Identifier: Apache-2.0 */ import type { Config, GeminiChat, ChatRecord } from '@3-/qwen-code-core'; import * as acp from '../acp.js'; import type { LoadedSettings } from '../../config/settings.js'; import type { SetModeRequest, SetModeResponse } from '../schema.js'; import type { SessionContext } from './types.js'; /** * Built-in commands that are allowed in ACP integration mode. * Only safe, read-only commands that don't require interactive UI. */ export declare const ALLOWED_BUILTIN_COMMANDS_FOR_ACP: string[]; /** * Session represents an active conversation session with the AI model. * It uses modular components for consistent event emission: * - HistoryReplayer for replaying past conversations * - ToolCallEmitter for tool-related session updates * - PlanEmitter for todo/plan updates * - SubAgentTracker for tracking sub-agent tool calls */ export declare class Session implements SessionContext { #private; private readonly chat; readonly config: Config; private readonly client; private readonly settings; private pendingPrompt; private turn; private readonly historyReplayer; private readonly toolCallEmitter; private readonly planEmitter; readonly sessionId: string; constructor(id: string, chat: GeminiChat, config: Config, client: acp.Client, settings: LoadedSettings); getId(): string; getConfig(): Config; /** * Replays conversation history to the client using modular components. * Delegates to HistoryReplayer for consistent event emission. */ replayHistory(records: ChatRecord[]): Promise; cancelPendingPrompt(): Promise; prompt(params: acp.PromptRequest): Promise; sendUpdate(update: acp.SessionUpdate): Promise; sendAvailableCommandsUpdate(): Promise; /** * Requests permission from the client for a tool call. * Used by SubAgentTracker for sub-agent approval requests. */ requestPermission(params: acp.RequestPermissionRequest): Promise; /** * Sets the approval mode for the current session. * Maps ACP approval mode values to core ApprovalMode enum. */ setMode(params: SetModeRequest): Promise; /** * Sends a current_mode_update notification to the client. * Called after the agent switches modes (e.g., from exit_plan_mode tool). */ private sendCurrentModeUpdateNotification; private runTool; debug(msg: string): void; }