Codex Agent integration: HTTP surface + plugin bundle + Settings UI
This persists work that had been living only in the cookbook docker
container's writable layer — never committed to the host source. Brought
back to git intact, app.py registration re-applied surgically on top of
current main (not the older container copy, which would have regressed
the Windows MIME fix, asynccontextmanager lifespan, and webhook auth
exempts).
routes/codex_routes.py (new):
- GET /api/codex/capabilities — what this Odysseus exposes.
- GET /api/codex/plugin.zip — downloads integrations/codex as a zip.
- GET /api/codex/todos — scope-gated todos:read|write.
- POST /api/codex/todos — scope-gated todos:write.
- GET /api/codex/emails — scope-gated email:read|draft|send.
- GET /api/codex/emails/{uid} — single-message fetch.
- _scope_owner() enforces api_token scopes before touching user data.
routes/api_token_routes.py (+103 lines):
- Adds Codex-token-specific issuance + revocation paths.
integrations/codex/ (new bundle, shipped via /api/codex/plugin.zip):
- README.md — install instructions.
- .codex-plugin/plugin.json — Codex plugin manifest.
- scripts/odysseus_api.py — Python client used by the skill.
- skills/odysseus/SKILL.md — Codex skill definition.
static/js/settings.js (+253 lines):
- New "Codex Agent" option in the Integrations dropdown.
- Add / edit panel with plugin-bundle download link + curl-with-token
install instructions per agent.
app.py:
- 7-line surgical change: capture email_router = setup_email_routes()
and register setup_codex_routes(email_router=email_router) after the
email module so the Codex routes can borrow its helpers.
This commit is contained in:
11
app.py
11
app.py
@@ -690,7 +690,16 @@ app.include_router(setup_note_routes(task_scheduler))
|
||||
|
||||
# Email
|
||||
from routes.email_routes import setup_email_routes
|
||||
app.include_router(setup_email_routes())
|
||||
email_router = setup_email_routes()
|
||||
app.include_router(email_router)
|
||||
|
||||
# Codex integration — HTTP surface for the Codex plugin/MCP bridge. Reuses
|
||||
# api_token scopes (todos:read|write, email:read|draft|send) so external
|
||||
# Codex sessions can only touch the data the user explicitly allowed. Mounted
|
||||
# AFTER email so the codex_routes can borrow the email router for shared
|
||||
# search/threading helpers.
|
||||
from routes.codex_routes import setup_codex_routes
|
||||
app.include_router(setup_codex_routes(email_router=email_router))
|
||||
|
||||
from routes.vault_routes import setup_vault_routes
|
||||
app.include_router(setup_vault_routes())
|
||||
|
||||
Reference in New Issue
Block a user