Commit Graph

2 Commits

Author SHA1 Message Date
d075fc408a feat(codex): SessionMutator stub + session-file resolver
Wires the host's mirror hook end-to-end: FindCodexSessionFile walks
~/.codex/sessions/<YYYY>/<MM>/<DD>/rollout-*-<thread_id>.jsonl to
prove the path for the captured thread_id, then logs the no-op.

Real rewrite is deferred to v2: codex keys tool calls by `call_<id>`
not the `toolu_<id>` Plexum's canonical block format uses, so a v1
rewriter would never find a matching id. When tool-call id round-trip
through codex's native surface lands, the rewriter plugs into this
file's path resolver.

Also rescues cmd/plexum-openai-provider-plugin/main.go from .gitignore
(the bare 'plexum-openai-provider-plugin' pattern was too greedy — it
matched the source directory). Tightened to '/plexum-openai-provider-plugin'
+ '/bin/' so only built binaries get ignored.
2026-06-01 14:01:15 +01:00
33de696653 feat: Plexum-openai-provider v0.1 — OpenAI codex CLI as backend
Plexum ProviderPlugin that wraps the local `codex` CLI binary
(OpenAI Codex CLI ≥ 0.135). Same CLI-driven pattern as
Plexum-gemini-provider and Plexum-anthropic-provider's contractor.

internal/runner/ (~200 LOC):
- Per Plexum turn, fork:
    codex exec [resume <thread_id>] \
      --skip-git-repo-check \
      --dangerously-bypass-approvals-and-sandbox \
      --json \
      [--model <m>] \
      "<last user msg>"
  in agent workspace, with stdin = /dev/null (codex would otherwise
  block waiting for additional input).
- Stream-parses JSONL events:
    thread.started        → save thread_id to .plexum-codex-session
    item.completed        → if type==agent_message, emit text_delta
    turn.completed        → capture usage (input/output/cached/reasoning)
    error / turn.failed   → emit canonical EventError
- Other event types (turn.started, item.started, reasoning, etc.)
  logged at debug, don't produce user-facing events for v1

cmd/plexum-openai-provider-plugin/ implements ProviderPluginWithAgent
(needs AgentContext.Workspace as cwd).

Model surface:
  default: ["codex"]  (no --model flag → CLI default; only thing
                       ChatGPT-account installs support)
  override via config.supported_models + config.model_args for
  API-key installs that want gpt-5 / o3 / etc.

HostConfig (all optional):
  binary           default "codex" (operator should set abs path for
                   systemd PATH)
  extra_args       appended before the prompt
  supported_models override the advertised model list
  model_args       map plexum id → CLI --model value

No api_key field — codex CLI handles auth via ~/.codex/ state
(ChatGPT login OR OPENAI_API_KEY env).

End-to-end verified against local install (ChatGPT login):

1. CLI turn 1:        "OpenAI built me."
2. CLI turn 2 (resume): "I said: 'OpenAI built me.'" (multi-turn ✓)
3. Fabric channel e2e: alice → cx agent → codex CLI → outbound REST →
   seq=23: "Use list comprehensions for concise, readable filtering and
            transformation of iterables."

Known: when daemon runs under systemd PATH doesn't include nvm/local
bin dirs; operator must set absolute binary path in config.json.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 20:44:42 +01:00