import type { ChildProcess, StdioOptions } from 'node:child_process'; import { type EffectivePermissionPolicy, type PermissionCapabilities, BYPASS_ONLY_PERMISSION_CAPABILITIES, TIER_FLAG_PERMISSION_CAPABILITIES, permissionPolicyOrDefault } from '../permission-policy.js'; export { BYPASS_ONLY_PERMISSION_CAPABILITIES, TIER_FLAG_PERMISSION_CAPABILITIES, permissionPolicyOrDefault, }; export type { EffectivePermissionPolicy, PermissionCapabilities }; export declare const ADAPTER_CAPABILITIES: Readonly<{ PERSISTENT_SESSION: "persistent_session"; NATIVE_MCP: "native_mcp"; }>; export type AdapterCapability = (typeof ADAPTER_CAPABILITIES)[keyof typeof ADAPTER_CAPABILITIES]; export declare const PARSE_STAGE: Readonly<{ THINKING: "thinking"; COMPOSING: "composing"; }>; export type ParseStage = (typeof PARSE_STAGE)[keyof typeof PARSE_STAGE]; export interface HarnessSpec { system_prompt_append?: string; allowed_tools?: string[]; disallowed_tools?: string[]; model?: string; fallback_models?: string[]; permission_mode?: string; } export interface RuntimeProfileSpec { id: string; kind?: 'claude-backend'; protocol: 'anthropic-compatible' | 'openai-compatible'; base_url: string; model: string; omit_effort?: boolean; claude_executable?: string; cwd?: string; env?: Record; args?: string[]; credential_required?: boolean; credential_ref?: string; auth_env?: string; context_window?: number; max_output_tokens?: number; auto_compact_window?: number; safety_margin_tokens?: number; adapter?: { command?: string; module?: string; executable?: string; python?: string; venv?: string; cwd?: string; env?: Record; args?: string[]; base_url: string; startup_timeout_ms?: number; health_check?: string; lifecycle?: 'on_release' | 'manager_exit' | 'reuse'; }; } export declare const HARNESS_SPEC_KEYS: readonly ["system_prompt_append", "allowed_tools", "disallowed_tools", "model", "permission_mode"]; export declare function partitionHarness(adapter: CliAdapter, harness: HarnessSpec | null | undefined): { applied: HarnessSpec | null; skipped: string[]; }; export declare function buildModelChain(primary: string | null | undefined, fallbacks: string[] | null | undefined): (string | null)[]; export declare function resolveModelChain(effectiveModel: string | null, claudeRuntimeProfile: RuntimeProfileSpec | null | undefined, fallbackModels: string[] | null | undefined): (string | null)[]; export type EffortLevel = 'low' | 'medium' | 'high' | 'max'; export interface EffortSlice { model?: string; effort?: EffortLevel; ultracode?: boolean; } export interface ResolvedEffortPreset { id: string; label?: string; [sliceKey: string]: EffortSlice | string | undefined; } export type EffortSliceKey = 'model' | 'effort' | 'ultracode'; export declare function pickEffortSlice(preset: ResolvedEffortPreset | null | undefined, sliceKey: string, keys: readonly EffortSliceKey[]): EffortSlice | null; export declare function describeHarness(harness: HarnessSpec): string; export declare function describeSpawnArgv(args: readonly string[] | null | undefined): string; export declare function redactSpawnArgToken(arg: string, previous: string): string; export declare function looksLikeSecretArg(arg: string): boolean; export interface OneshotSpec { rolePrompt: string; taskText: string; mcpConfigPath: string | null; cwd?: string | null; cliHomeDir?: string | null; mcpAttribution?: McpAttribution; model?: string | null; harness?: HarnessSpec | null; effort?: string | null; ultracode?: boolean; permission?: EffectivePermissionPolicy | null; } export interface McpAttribution { clientType?: 'managed-subagent' | 'subagent'; ticketId?: string; role?: string; triggerSource?: string; triggerId?: string; sessionId?: string; } export interface SessionSpec { rolePrompt: string; mcpConfigPath: string | null; sessionMode?: 'persistent' | 'resume' | 'control'; sessionId?: string; model?: string | null; harness?: HarnessSpec | null; effort?: string | null; ultracode?: boolean; permission?: EffectivePermissionPolicy | null; } export interface SpawnDescriptor { args: string[]; stdio: StdioOptions; writePrompt?: (child: ChildProcess) => void; needsMcpConfig?: boolean; } export interface ParseResult { stage: ParseStage | null; isResult: boolean; isError: boolean; raw: any; } export interface TurnImage { media_type: string; data: string; } export interface CliUsageSnapshot { input_tokens: number | null; output_tokens: number | null; cache_read_input_tokens: number | null; cache_creation_input_tokens: number | null; total_cost_usd: number | null; } export interface CliProgressEvent { kind: 'command' | 'tool' | 'file' | 'search' | 'task' | 'other'; label: string; detail?: string; status: 'start' | 'success' | 'error'; } export declare abstract class CliAdapter { static cliType: string; capabilities: Set; has(cap: AdapterCapability): boolean; get cliType(): string; abstract resolveBin(configured?: string | null): string; abstract buildOneshotSpawn(spec: OneshotSpec): SpawnDescriptor; buildSessionSpawn(_spec: SessionSpec): SpawnDescriptor; hasPersistedSession(_cliHomeDir: string | null | undefined, _sessionId: string): Promise; formatTurn(_text: string, _images?: TurnImage[]): string; abstract parseStdoutLine(line: string): ParseResult; collectOneshotResult(_lines: string[]): string | null; parseProgressEvent(_raw: any): CliProgressEvent | null; extractAssistantText(_raw: any): string | null; extractUsage(_raw: any): CliUsageSnapshot | null; harnessKeys(): ReadonlyArray; harnessEnv(_harness: HarnessSpec | null | undefined): Record; listModels(_credential?: AdapterCredential | null): Promise; cliUpdate(): { args: string[]; label: string; } | null; updatePackage(): string | null; configDirEnv(): string | null; authEnvKeys(): string[]; readCredentialMeta(_cliHomeDir: string): Promise; permissionCapabilities(): PermissionCapabilities; requiresWorkspaceTrust(_policy?: EffectivePermissionPolicy | null): boolean; readTrustMeta(_cliHomeDir: string, _cwd: string): Promise; ensureWorkspaceTrust(_cliHomeDir: string, _cwd: string): Promise; prepareCliHome(_cliHomeDir: string, _credential?: AdapterCredential | null, _mcp?: AdapterMcpContext | null, _model?: string | null): Promise<{ extraEnv: Record; }>; } export interface AdapterCredential { credential_id: string; provider: string; fields: Record; } export interface AdapterMcpContext { url: string; apiKey: string; } export interface AgentCredentialMeta { kind: 'subscription' | 'api_key' | 'unknown'; expires_at_ms: number | null; refresh_token_present: boolean; } export interface CliTrustMeta { trusted: boolean; }