Skip to content
Unverified: This page has not yet been anchored to automated code tests.

Codex HTTP API

Rust implementation surfaces live in vox-db (Codex schema, readiness, store ops). There is no separate vox-codex-api workspace crate; operators integrate HTTP routers built on vox_db types (see OpenAPI below).

  • cargo test -p vox-db — integration tests under crates/vox-db/tests/ (e.g. ops_codex_tests.rs) exercise Codex HTTP / store behavior where applicable.
ItemValue
BindVOX_DASH_HOST (default 127.0.0.1) + VOX_DASH_PORT (default 3847) when a dashboard-compatible server is run
ReadinessGET /ready uses vox_db::evaluate_codex_api_readiness (baseline schema_version 1 + required tables + manifest digest)

OpenAPI paths GET /api/audio/status, POST /api/audio/transcribe, POST /api/audio/transcribe/upload are implemented by the speech ingress stack (crates/vox-speech library surfaces + thin HTTP adapters): Oratio STT on paths under VOX_ORATIO_WORKSPACE (or process CWD) or multipart upload. Same bind vars as the table above. This is separate from Codex CRUD routes but lives in the shared contracts/codex-api.openapi.yaml catalog for client codegen.

Codex is a type alias, not a distinct struct: pub type Codex = VoxDb in crates/vox-db/src/lib.rs. It’s the type injected as Extension<Arc<Codex>> into every generated Axum handler (see Transactional boundaries), and the type every generated per-table CRUD method takes as its first argument (db: &Codex).

Connecting: Codex::connect(config: DbConfig), connect_default(), and connect_canonical() (the last resolving VOX_DB_URL/VOX_DB_TOKEN, legacy TURSO_*, or a local file path, per env-vars.md).

Transactions: db.transaction(f) runs an async closure between BEGIN and COMMIT, rolling back on error (facade/migrations.rs). This is the primitive generated mutation handlers wrap around whenever their module has a table (see Transactional boundaries). Caveat, stated in the method’s own doc comment: the closure is awaited without holding a guard across it, so concurrent use of the same Codex inside the closure is unsafe — keep transaction bodies short and sequential.

Raw queries: db.connection() returns a GuardedConnection wrapping turso::Connection behind a tokio::sync::Mutex — every query/execute/ execute_batch/pragma_update call acquires the lock for that call only. This exists to prevent the underlying driver’s Misuse("concurrent use forbidden") error class. One documented residual edge case: last_insert_rowid() is deliberately not guarded (it’s a synchronous, non-blocking read), so a call-site pattern of execute(...).await; connection.last_insert_rowid() can race with another task’s guarded execute() in between and silently observe the wrong task’s row id — noted in the source as a known gap, not fixed by the guard.

Generated per-table methods (insert, get, all, all_order_limit, count, count_where, filter_where, filter_where_order_limit, unsafe_query_raw_clause, delete) are emitted per table declaration by crates/vox-codegen/src/codegen_rust/emit/tables/codegen.rs — these are the Rust functions the .vox-level db.Table.* surface in ref-db-surface.md desugars to.

Facade extension modules under crates/vox-db/src/facade/ add hand-written impl VoxDb methods for platform subsystems, not generated per-project schema:

ModuleAdds
connect.rsconnect/connect_default/connect_canonical
migrations.rstransaction, schema migration ops
memory.rsstore_memory, search_memories, ingested-chunk search
workflow.rsdurable-workflow activity result persistence, project registration
hitl_approvals.rsdurable audit trail for the PendingApprovals HITL gate (see tool confirmation)
agent_runs.rsthe canonical agent_runs ledger (one row per agent/CLI invocation)
actor_state.rsactor KV state persistence
scheduled.rsscheduled_runs state for the workflow scheduler
scientia.rsdiscovery pending/approve/reject ops
vox_mesh.rskudos and peer-reputation ops
model_prompt.rsmodel_prompt_profiles table ops
writer_raw.rsraw event/cost/exec-history inserts, bypassing the generated-schema path