Skip to main content

Module audit_store

Module audit_store 

Source
Expand description

The durable copy of the jekt audit trail. The handler keeps the last AUDIT_LOG_MAX entries in memory for GET /agentmux/reactive/audit, and loses them at every restart. Every entry is also appended here, as one JSON line, to a file that is never rotated or truncated: AgentMux keeps agent history, and the record of what agents did, forever.

Entries hold a hash and the length of each message, never its text, plus the sender, target, outcome and a caller’s free-text note. The file is shared by every srv instance on the machine, so each line names its channel.

The handler records while holding its lock, so recording does no I/O: it queues the line for a writer thread.

Functions§

default_path
<shared root>/audit/jekt-audit.jsonl, or None while this srv has given the shared folder up.
install
Start recording to path for the rest of this process. The first call wins.
install_for_this_srv
Start recording where this srv writes (write_path), and say so in the log when that is its own file.
own_path
<this channel's folder>/audit/jekt-audit.jsonl: where a srv that gave the shared folder up keeps its own rows. A line goes to exactly one of this and the shared file. It is the channel’s own folder, not the per-version data folder (--wavedata, AGENTMUX_DATA_DIR): a srv that deferred is usually upgraded next, and the new version must still find the rows the old one kept.
read_all
The entries in the file at path, oldest first; lines that don’t parse are skipped.
record
Queue entry for the audit file. Nothing happens before install.
shared_path_for_reading
The shared file to read, whether or not this srv may write to it: a srv that gave the folder up still lists what the account’s other srvs recorded.
write_path
Where this srv appends: the shared file, or its own when it doesn’t use the shared folder.