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 var | Default | Used by |
|---|---|---|
AGENT_BLOCK_HOME | $HOME/.agent-block | all |
AGENT_BLOCK_KV_PATH | {HOME}/kv.sqlite | std.kv |
AGENT_BLOCK_SQL_PATH | {HOME}/db.sqlite | std.sql |
AGENT_BLOCK_TS_PATH | {HOME}/ts.sqlite | std.ts |
AGENT_BLOCK_SQL_BUSY_TIMEOUT_MS | 5000 | all |
AGENT_BLOCK_SQL_QUERY_TIMEOUT_MS | 5000 | all |
AGENT_BLOCK_SQL_JOURNAL_MODE | WAL | all |
AGENT_BLOCK_BUS_CAPACITY | 64 | EventBus |
AGENT_BLOCK_TASK_GRACE_MS | 1000 | task/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_MODE→WAL. - 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.
0disables the timeout.AGENT_BLOCK_SQL_QUERY_TIMEOUT_MS→ 5000ms. - task_
grace_ ms - SIGTERM/SIGINT grace window (ms) shared by
std.task.with_timeoutand 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:).