包文件→ .shtukbase/packages/harness-codex/adapter.ts
adapter.ts
22 行, 1.2 KB.
文件按包中的原样显示:代码及其注释不做翻译。
- // Codex CLI: `codex exec` reads the prompt on stdin (`-`). Safe defaults: the OS sandbox `workspace-write` (or
- // `read-only`) rooted at the working folder, network off inside the sandbox, no approvals asked, no session saved.
- // `network: true` turns on both the network in the sandbox and the model's web search (`-c web_search="live"`, what the top-level `codex --search` sets).
- import type { Adapter } from '../harness/lib/harness.ts';
- export const adapter: Adapter = {
- id: 'codex', pkg: 'harness-codex', bin: 'codex', title: 'Codex CLI', defaultModel: 'gpt-6-luna',
- install: 'npm i -g @openai/codex (or brew install codex), then codex login with a ChatGPT subscription',
- build(s) {
- return {
- exe: 'codex',
- args: [
- 'exec', '-C', s.cwd, '-m', s.model, '-s', s.access === 'write' ? 'workspace-write' : 'read-only',
- '-c', `sandbox_workspace_write.network_access=${s.network}`, '-c', 'approval_policy="never"',
- ...(s.network ? ['-c', 'web_search="live"'] : []), // the model's web search: what `codex --search` sets; exec has no flag
- ...(s.effort ? ['-c', `model_reasoning_effort="${s.effort}"`] : []),
- '--skip-git-repo-check', '--ephemeral', '--color', 'never', '-',
- ],
- stdin: s.prompt,
- };
- },
- };