Skip to main content

Module db

Module db 

Source
Expand description

Postgres-backed state for the CLI.

Replaces the legacy filesystem::db SQLite tree. One sqlx PgPool over the objectiveai-db cluster whose postgresql:// URL is published in the db spawn lock (or a remote postgres pointed at via db config address), lazily initialized by Context::db_client(); every tier (tags, message_queue, logs) takes &Pool and runs natively async.

Modules§

agent_continuations
Latest-continuation registry keyed by agent_instance_hierarchy.
compartment
Per-plugin/tool database compartments.
instances
instances tier — aggregate enumeration backing agents instances {list, get}.
laboratory_attachments
Laboratory IDs attached to an agent target, backed by the postgres laboratory_attachments table.
logs
Postgres-backed log writer.
message_queue
Deferred-message storage for agents queue {add, list, read id}.
query
objectiveai db query — read-only SQL executor.
tag_groups
tag_groups table — explicit grouping container that lets many tags rows share one resolved AgentSpec + parent lineage.
tags
Client-side agent tags backed by the postgres tags + tag_groups tables.
time
Time conversion helpers for CLI command responses.

Structs§

DbHandle
The live pool PLUS the admin coordinates it was built from — what super::compartment needs to mint derived per-plugin connection strings. Cached as a unit by Context::db_client; the password stays in memory exactly as long as the pool it authenticated.
Pool

Enums§

Error

Functions§

init
Open the admin pool against url (no database path — lands on the connecting user’s default database, postgres), ensure database exists, then open the application pool and apply the inline schema. Idempotent across cold and warm starts — re-running against an already-bootstrapped database is a no-op (every CREATE uses IF NOT EXISTS).