Skip to main content

objectiveai_db_proxy/
lib.rs

1//! A Postgres-over-WebSocket conduit for ObjectiveAI plugin containers.
2//!
3//! A container cannot reach the machine hosting it, so a plugin inside
4//! one cannot dial the ObjectiveAI database. This binary is copied into
5//! the container — the way `objectiveai-mcp-laboratory` already is —
6//! and bridges the two legs that DO work: it serves ordinary Postgres
7//! clients on a fixed loopback port, and accepts a WebSocket from the
8//! laboratory host, which dials in and relays to the real database.
9//!
10//! Every Postgres connection rides that one socket, keyed by a small
11//! numeric id ([`frame`]). The point of shipping it as a separate
12//! binary is that a plugin — in any language, using the plugin
13//! framework or not — needs to know none of this. It sees a Postgres
14//! server on localhost.
15//!
16//! There is NO configuration: the addresses and ports are hardcoded
17//! ([`POSTGRES_PORT`], [`HOST_PORT`]), because a binary that gets
18//! `podman exec`'d into an image somebody else built should not be
19//! reconfigurable by that image's environment. [`run`] therefore takes
20//! nothing, and the binary at `main.rs` only sets up logging and calls
21//! it.
22
23mod conduit;
24mod frame;
25mod run;
26
27pub use conduit::*;
28pub use frame::*;
29pub use run::*;