Skip to main content

Module config

Module config 

Source
Expand description

Config resolution for std.kv / std.sql / std.ts storage backends.

All knobs are ENV-driven (no CLI flags) so .env can drive them uniformly.

ENV varDefaultUsed by
AGENT_BLOCK_HOME$HOME/.agent-blockall
AGENT_BLOCK_KV_PATH{HOME}/kv.sqlitestd.kv
AGENT_BLOCK_SQL_PATH{HOME}/db.sqlitestd.sql
AGENT_BLOCK_TS_PATH{HOME}/ts.sqlitestd.ts
AGENT_BLOCK_SQL_BUSY_TIMEOUT_MS5000all
AGENT_BLOCK_SQL_QUERY_TIMEOUT_MS5000all
AGENT_BLOCK_SQL_JOURNAL_MODEWALall
AGENT_BLOCK_BUS_CAPACITY64EventBus
AGENT_BLOCK_TASK_GRACE_MS1000task/bus

std.kv, std.sql, and std.ts are backed by separate SQLite database files so that agent-internal KV state, explicit user SQL data, and time-series rows don’t share WAL, page cache, or backup lifecycle. Pragma/timeout knobs apply to all three.

Special: =:memory: selects an in-memory database (works for AGENT_BLOCK_KV_PATH, AGENT_BLOCK_SQL_PATH, and AGENT_BLOCK_TS_PATH). Journal mode is ignored for :memory: (SQLite forces MEMORY). AGENT_BLOCK_SQL_QUERY_TIMEOUT_MS=0 disables the query timeout.

Functions§

base_dir
Base dir for agent-block local state. AGENT_BLOCK_HOME$HOME/.agent-block.
bus_capacity
EventBus bounded mpsc capacity. AGENT_BLOCK_BUS_CAPACITY → 64. Parse failures warn and fall back.
is_memory_sql
True when the resolved path is SQLite’s in-memory sentinel.
kv_path
Path to the std.kv SQLite database file (or :memory:). AGENT_BLOCK_KV_PATH{base_dir}/kv.sqlite.
sql_busy_timeout
SQLite busy_timeout. AGENT_BLOCK_SQL_BUSY_TIMEOUT_MS → 5000ms.
sql_journal_mode
SQLite journal_mode pragma value. AGENT_BLOCK_SQL_JOURNAL_MODEWAL.
sql_path
Path to the std.sql SQLite database file (or :memory:). AGENT_BLOCK_SQL_PATH{base_dir}/db.sqlite.
sql_query_timeout
Per-query timeout. 0 disables the timeout. AGENT_BLOCK_SQL_QUERY_TIMEOUT_MS → 5000ms.
task_grace_ms
SIGTERM/SIGINT grace window (ms) shared by std.task.with_timeout and the EventBus shutdown path. AGENT_BLOCK_TASK_GRACE_MS → 1000. Parse failures warn and fall back.
ts_path
Path to the std.ts SQLite database file (or :memory:).