/** * Cline runner setup and cleanup: where cline keeps its state for a turn, * the session-id lookup (`cline history --json`), and the hub daemon reaper. * * Hub daemon (verified live, cline 3.0.65): a turn that uses cline's own * state (no `--data-dir`) and every `--acp` session spawns a detached * `cline --cline-hub-daemon --cwd … --port …` in its own session (setsid), * which outlives the turn. Its pid is in `/locks/hub/.json`, * and it inherits the spawning cline's environment — so the per-turn marker * CLINE_TURN_ENV the runner sets identifies exactly the daemon this turn * started (a daemon the user already had running is reused, not marked, and * never killed). `--data-dir` (scoped turns) forces cline's local backend: * no daemon at all. */ import type { AgentRunArgs } from './agent-runner.js'; import type { ClineHistoryRow, ClineHost } from './cline-runner-types.js'; /** Per-turn marker env on every cline process this runner spawns (and so on * the hub daemon and the commands cline runs). Also the nested-agent marker. */ export declare const CLINE_TURN_ENV = "MONOMIND_CLINE_TURN"; export declare const defaultClineHost: ClineHost; /** How one run reaches cline: its env, the state flags, the data dir. */ export interface ClineSetup { bin: string; /** Child env (the per-turn marker is added per spawn). */ env: Record; /** `--config ` in scoped mode, [] when cline uses the user's own. */ configArgs: string[]; /** `--data-dir ` for json turns in scoped mode. */ dataDirArgs: string[]; /** Where the hub lock and sessions live for this run. */ dataDir: string; scoped: boolean; } /** * Full access (`access: 'full'`) or `--settings` (settingSources non-empty): * cline runs on the user's own state — `~/.cline` auth, rules, hooks and the * MCP servers in `cline_mcp_settings.json` — untouched. Otherwise (scoped): * `--config`/`--data-dir` point at a persistent monomind-owned dir, and * CLINE_MCP_SETTINGS_PATH at an empty server list, so no user MCP server or * hook loads; auth then comes from the environment (CLINE_PROVIDER plus the * provider's key variable, e.g. ANTHROPIC_API_KEY / OPENROUTER_API_KEY). * Scoped turns also refuse every tool call that needs approval * (cline-runner-scoped.ts): the config dir carries the refusal plugin. */ export declare function prepareClineSetup(args: AgentRunArgs, bin: string, host: ClineHost): ClineSetup; /** The hub daemons a turn started: marker-carrying processes, plus a lock * pid that appeared during the turn — each confirmed a hub daemon by its * command line when the platform can read one. */ export declare function turnHubDaemons(host: ClineHost, marker: string, dataDir: string, before: ReadonlySet): number[]; /** SIGTERM each daemon now and SIGKILL any still alive after a grace. */ export declare function reapHubDaemons(host: ClineHost, pids: number[], graceMs?: number): void; /** The history row of the json turn that just ran: same cwd, started at or * after the spawn; its prompt, else its pid, else the only such row. A * hub-run turn records the daemon's pid, so the prompt is the main key. */ export declare function matchHistoryRow(rows: ClineHistoryRow[], q: { cwd: string; prompt: string; pid?: number; sinceMs: number; }): ClineHistoryRow | undefined; //# sourceMappingURL=cline-runner-host.d.ts.map