ShtukbaseStandard
包文件→ .shtukbase/packages/harness-codex/adapter.ts

adapter.ts

22 行, 1.2 KB.

文件按包中的原样显示:代码及其注释不做翻译。

  1. // Codex CLI: `codex exec` reads the prompt on stdin (`-`). Safe defaults: the OS sandbox `workspace-write` (or
  2. // `read-only`) rooted at the working folder, network off inside the sandbox, no approvals asked, no session saved.
  3. // `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).
  4. import type { Adapter } from '../harness/lib/harness.ts';
  5. export const adapter: Adapter = {
  6. id: 'codex', pkg: 'harness-codex', bin: 'codex', title: 'Codex CLI', defaultModel: 'gpt-6-luna',
  7. install: 'npm i -g @openai/codex (or brew install codex), then codex login with a ChatGPT subscription',
  8. build(s) {
  9. return {
  10. exe: 'codex',
  11. args: [
  12. 'exec', '-C', s.cwd, '-m', s.model, '-s', s.access === 'write' ? 'workspace-write' : 'read-only',
  13. '-c', `sandbox_workspace_write.network_access=${s.network}`, '-c', 'approval_policy="never"',
  14. ...(s.network ? ['-c', 'web_search="live"'] : []), // the model's web search: what `codex --search` sets; exec has no flag
  15. ...(s.effort ? ['-c', `model_reasoning_effort="${s.effort}"`] : []),
  16. '--skip-git-repo-check', '--ephemeral', '--color', 'never', '-',
  17. ],
  18. stdin: s.prompt,
  19. };
  20. },
  21. };