feat(auth): wire prime to codex/claude oauth cli sessions

This commit is contained in:
Prime Backup Bot
2026-03-11 15:59:02 +00:00
parent c999a0a395
commit 76c0db051b
4 changed files with 92 additions and 13 deletions
+17 -2
View File
@@ -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()
}
+14 -6
View File
@@ -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()
}