返回 html-video
codex.ts
根目录 / packages / runtime / src / defs / codex.ts
1 import type { AgentDef } from '../types.js';
2
3 /**
4 * Codex CLI def (`codex`, by OpenAI).
5 *
6 * Slim version matching html-video's text-first model: the studio reads the
7 * model's free-form output and extracts the fenced ```html``` block, so we run
8 * `codex exec` in plain (non-JSON) mode rather than `--json` — the latter emits
9 * NDJSON envelopes that the v0.1 spawn loop would dump verbatim into the chat.
10 *
11 * `--skip-git-repo-check` lets it run in the project dir without a git repo;
12 * prompt is piped via stdin (long HTML-generation prompts).
13 */
14 export const codex: AgentDef = {
15 id: 'codex',
16 name: 'Codex CLI',
17 bin: 'codex',
18 versionArgs: ['--version'],
19 buildArgs(_prompt, _ctx) {
20 return ['exec', '--skip-git-repo-check'];
21 },
22 streamFormat: 'plain',
23 promptViaStdin: true,
24 installUrl: 'https://developers.openai.com/codex/cli',
25 };
26
26 lines TYPESCRIPT