/** * Host-aware exec — feat/codex-support Phase 2 (P2-2/P2-3 공통) * * compound-extractor + auto-compound-runner 가 *어느 host CLI 로 LLM 호출* 할지 * 결정. profile.default_host 우선 + override 가능. * * 출력은 단일 string (agent message) 으로 통일 — caller 가 stdout 파싱 안 해도 됨. * * 호환성: 기존 'claude -p prompt --model haiku' 호출은 default_host 가 'claude' 인 * 경우 동일 동작. Codex 메인 사용자는 자동으로 codex exec --json 호출. */ import type { HostId } from '../core/trust-layer-intent.js'; export interface ExecHostOptions { /** prompt — `-p`/`exec` 의 본문 */ prompt: string; /** model 힌트 (claude: --model haiku, codex: 무시 — codex CLI 가 default 사용) */ model?: string; /** child process timeout (ms). 미지정 시 host 별 기본값: claude 30s, codex 90s. */ timeout?: number; /** working directory */ cwd?: string; /** explicit host override (default: profile.default_host). */ host?: HostId; /** ENV vars 추가 (기존 process.env 위에 머지) */ env?: NodeJS.ProcessEnv; } /** * Host 별 기본 timeout. Phase 3 deferred fix: * - claude -p 는 보통 1~5s 응답이라 30s 충분. * - codex exec --json 은 cold start + reasoning 모드로 60~90s 정상이라 * 30s default 가 false-positive ETIMEDOUT 발생. 90s 마진 필요. * - 명시 timeout 옵션은 그대로 우선. */ export declare const DEFAULT_TIMEOUT_BY_HOST: Record; export interface ExecHostResult { message: string; host: HostId; /** 토큰 사용량 (codex 만 노출. claude 는 null). */ usage: { input_tokens?: number; output_tokens?: number; } | null; } /** * 실 host CLI 를 호출하여 prompt 응답 받기. * - claude: `claude -p --model ` * - codex: `codex exec --json -s read-only -c approval_policy="never" --ephemeral --skip-git-repo-check ` * * Codex 호출은 sandbox read-only + approval never + ephemeral 로 *자동 추출 안전성* * 보장 (사용자 환경 미오염). compound-extractor / auto-compound-runner 같은 * 백그라운드 학습 호출에 적합. */ export declare function execHost(opts: ExecHostOptions): ExecHostResult; /** 1회 retry — transient 에러(ETIMEDOUT 등) 대응. */ export declare function execHostRetry(opts: ExecHostOptions): ExecHostResult;