Expand description
Append-only provider invocation audit log.
Records minimal metadata for each provider routing event without
storing prompts or tool payloads. File: $SYNAPS_BASE_DIR/extensions/audit.jsonl.
Design constraints:
- One JSON object per line; missing file is equivalent to no entries.
- Append-only: each new entry uses
O_APPENDso concurrent appenders on Unix produce well-formed line records without locking. - Malformed lines (e.g. partial write from a crash) are skipped on read
with a
tracing::warn!so a corrupt line cannot lock the user out. - Never contains prompt text, tool inputs, tool outputs, or tokens.
Structs§
Functions§
- append_
audit_ entry - Append a single entry as one JSON line. Creates parent dirs and the file
if missing. Atomic per-line via
O_APPENDon Unix. - audit_
file_ path - Path to the audit file under the active base dir. Caller is responsible for creating parent directories when writing.
- new_
audit_ entry - Build a fresh entry with the current UTC timestamp.
- read_
audit_ entries - Read all entries (one per line). Missing file → empty Vec. Malformed
lines are skipped with a
tracing::warn!.