Class: Carson::Adapters::Codex
- Inherits:
-
Object
- Object
- Carson::Adapters::Codex
- Includes:
- Prompt
- Defined in:
- lib/carson/adapters/codex.rb
Overview
Adapter for dispatching work to OpenAI Codex.
Instance Method Summary collapse
- #dispatch(work_order:) ⇒ Object
-
#initialize(repo_root:, config: {}) ⇒ Codex
constructor
A new instance of Codex.
Constructor Details
#initialize(repo_root:, config: {}) ⇒ Codex
Returns a new instance of Codex.
11 12 13 14 |
# File 'lib/carson/adapters/codex.rb', line 11 def initialize( repo_root:, config: {} ) @repo_root = repo_root @config = config end |
Instance Method Details
#dispatch(work_order:) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/carson/adapters/codex.rb', line 16 def dispatch( work_order: ) prompt = build_prompt( work_order: work_order ) stdout_text, stderr_text, status = Open3.capture3( "codex", "--quiet", "--approval-mode", "full-auto", prompt, chdir: repo_root ) parse_result( stdout_text: stdout_text, stderr_text: stderr_text, success: status.success? ) rescue Errno::ENOENT Agent::Result.new( status: "failed", summary: "codex CLI not found in PATH", evidence: nil, commit_sha: nil ) end |