feat(auth): wire prime to codex/claude oauth cli sessions
This commit is contained in:
@@ -1,8 +1,23 @@
|
||||
from __future__ import annotations
|
||||
import subprocess
|
||||
|
||||
|
||||
def code(task: str, plan: list[str] | None = None) -> dict:
|
||||
prompt = task
|
||||
if plan:
|
||||
prompt = f"Task: {task}\n\nPlan:\n- " + "\n- ".join(plan)
|
||||
cmd = ['claude', '--print', '--output-format', 'json', prompt]
|
||||
proc = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if proc.returncode != 0:
|
||||
return {
|
||||
'provider': 'anthropic',
|
||||
'role': 'coder',
|
||||
'error': proc.stderr.strip() or proc.stdout.strip(),
|
||||
'hint': 'Run: prime auth anthropic'
|
||||
}
|
||||
return {
|
||||
'provider': 'anthropic',
|
||||
'role': 'coder',
|
||||
'task': task,
|
||||
'received_plan': plan or [],
|
||||
'result': 'Stub coder output. Wire OAuth provider call next.'
|
||||
'raw': proc.stdout.strip()
|
||||
}
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
from __future__ import annotations
|
||||
import subprocess
|
||||
|
||||
|
||||
def plan(task: str) -> dict:
|
||||
cmd = ['codex', 'exec', '--skip-git-repo-check', '--json', task]
|
||||
proc = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if proc.returncode != 0:
|
||||
return {
|
||||
'provider': 'openai',
|
||||
'role': 'planner',
|
||||
'error': proc.stderr.strip() or proc.stdout.strip(),
|
||||
'hint': 'Run: prime auth openai'
|
||||
}
|
||||
return {
|
||||
'provider': 'openai',
|
||||
'role': 'planner',
|
||||
'task': task,
|
||||
'plan': [
|
||||
'Clarify requirements',
|
||||
'Decompose into executable steps',
|
||||
'Define validation criteria',
|
||||
],
|
||||
'note': 'Stub planner output. Wire OAuth provider call next.'
|
||||
'raw': proc.stdout.strip()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user