/** * A resumed cline turn over ACP (`cline --acp --auto-approve true`; scoped * `--auto-approve false`, refusing what needs approval — see * cline-runner-scoped.ts). * * Why ACP: `cline --id ` cannot be combined with `--json` (it forces * the interactive UI and drops the prompt), so the one headless way to add a * turn to an existing session is ACP `session/load` + `session/prompt`. * Verified live against cline 3.0.65 with an OpenRouter free model * (2026-09-29): the loaded session kept its earlier context. * * Wire (JSON-RPC 2.0, one object per line): initialize → session/load * {sessionId, cwd, mcpServers: []} → session/prompt. `session/load` REPLAYS * the stored conversation as `session/update` notifications before it * answers, so every update before the load response is ignored. * * Auth: ACP only restores stored credentials of cline's own sign-ins (cline, * cline-pass, openai-codex). Any other provider needs `CLINE_API_KEY` — which * ACP passes to the provider as its key — so the runner fills it from the * provider's own key variable (OPENROUTER_API_KEY, ...) when unset, and * names the fix when there is none. `CLINE_PROVIDER` / `CLINE_MODEL` pick the * provider and model (the session's own, from `cline history`, by default). * * Gaps ACP has (cline's acp/session-updates.ts drops them): no usage and no * iteration events, and `--thinking` does not exist there (ACP runs with * thinking off). Usage and cost come from the session's cumulative * `metadata.usage` in `cline history --json`, read before and after the turn. * Max turns is approximated: a model step starts at the first message, * thought or tool call after tool results; past the cap the runner sends * `session/cancel` (stopReason `cancelled`), and kills the process if the * prompt has not ended EXIT_GRACE_MS later. */ import type { AgentRunArgs } from './agent-runner.js'; import type { ClineSetup } from './cline-runner-host.js'; import type { ClineEvent, ClineHistoryRow, ClineHost, ClineTurnOutcome, ClineUsage } from './cline-runner-types.js'; /** The key variable cline's provider catalog names for a provider * (`apiKeyEnv`); the common ones, else `_API_KEY`. */ export declare function providerKeyEnv(provider: string): string[]; /** The ACP env for one resumed turn, or the reason it cannot authenticate. */ export declare function acpEnv(base: Record, provider: string | undefined, model: string | undefined): { env: Record; } | { error: string; }; /** Session-cumulative usage of a history row. */ export declare function rowUsage(row: ClineHistoryRow | undefined): ClineUsage | undefined; export declare function streamAcpTurn(setup: ClineSetup, sessionId: string, prompt: string, args: AgentRunArgs, host: ClineHost, outcome: ClineTurnOutcome, known: { provider?: string; model?: string; }): AsyncGenerator; //# sourceMappingURL=cline-runner-acp.d.ts.map