import { StdioTransport } from './transport.js'; import { SessionModeState, SessionConfigOption, ListPersonalitiesResult } from './protocol.js'; import { type Personality } from '../utils/personalities.js'; export declare const AGENT_MODES: SessionModeState; /** * Format a tool call's parameters into a human-readable object for the * permission dialog. Truncates long content fields so the dialog stays readable. * * Exported for unit testing (see server.test.ts). */ export declare function formatToolInputForPermission(tool: string, params: Record): Record; /** * Resolve a `file://` (or absolute path) URI to a local filesystem path. * Returns null for unsupported schemes (http/https/git/etc.) — we only embed * local content for safety/privacy. * * Exported for unit testing (see server.test.ts). */ export declare function resolveLocalPath(uri: string): string | null; /** * Walk the prompt's ContentBlock[] looking for ResourceLink and Resource * blocks. ResourceLink → read file from disk. Resource → use embedded text. * Returns a markdown-fenced snippet block ready to prepend to the prompt, * or empty string if there are no embedded contexts. * * Exported for unit testing (see server.test.ts). */ export declare function collectEmbeddedContext(blocks: import('./protocol.js').ContentBlock[]): Promise; /** Check if a provider has an API key stored (synchronous; relies on the cache * loaded at startup via loadAllApiKeys and the non-secret configuredProviderIds * index — never reads plaintext key material). * * Exported for unit testing (see server.test.ts). */ export declare function providerHasKey(providerId: string): boolean; /** * Build the list of session-level config options advertised to the ACP client * (provider/model picker, language, per-tool confirmation toggles). * * Reads the global config + provider table; pure of transport/session state. * Exported for unit testing (see server.test.ts). */ export declare function buildConfigOptions(): SessionConfigOption[]; /** Build the stable Codeep ACP personality extension payload for a workspace. */ export declare function buildPersonalityListResult(workspaceRoot: string): ListPersonalitiesResult; /** Resolve an ACP selection using the same scope/model availability gate as list. */ export declare function resolvePersonalitySelection(personalityId: unknown, workspaceRoot: string): Personality | null; export interface AcpCommandOutcome { stdout: string; stderr: string; exitCode: number; } /** Per-command budget, the same one a local run gets. */ export declare const ACP_COMMAND_TIMEOUT_MS = 120000; export interface AcpCommandContext { transport: Pick; sessionId: string; clientSupportsTerminal: boolean; /** The prompt's signal: firing it kills a command in the client terminal. */ signal: AbortSignal; timeoutMs?: number; } /** * Read the exit code from a terminal/wait_for_exit answer. ACP sends * `{ exitCode, signal }`; older clients nest `{ type, code }` under * `exitStatus`. Returns null when the answer carries no exit status. * * Exported for unit testing (see server.command.test.ts). */ export declare function exitCodeFromWaitResult(result: unknown): number | null; /** * Run an execute_command tool call for an ACP session, in the client's * terminal when it offers one, otherwise locally. * * Never throws: the agent loop reports a throw to the model as a failed * command, which hides whether the client terminal already ran it. A * failure comes back as exitCode -1 with the reason instead. * * Exported for unit testing (see server.command.test.ts). */ export declare function executeAcpCommand(command: string, args: string[], cwd: string, ctx: AcpCommandContext): Promise; export declare function startAcpServer(transport?: StdioTransport): Promise;