feat(audit): Add core audit logging infrastructure

- Add AuditLogger class with rotation support
- Add audit configuration to config schema
- Instrument tool execution with full audit logging
- Instrument session lifecycle (create, message, delete, transfer, compact)
- Add audit logger initialization in daemon
- Add cron scheduler audit logging

Audit events captured:
- tool.start/success/error/denied
- session.create/message/delete/transfer/compact
- cron.trigger/add/remove

All logs go to ~/.local/share/flynn/audit.log (JSON lines)
with rotation (10MB files, 30-day retention)
This commit is contained in:
William Valentin
2026-02-11 15:58:07 -08:00
parent fae3565480
commit d62e836b5d
12 changed files with 732 additions and 1 deletions
+8
View File
@@ -132,6 +132,14 @@ export interface ToolPolicyContext {
agent?: string;
/** Provider name (e.g. 'ollama', 'anthropic'). */
provider?: string;
/** Session ID for audit logging. */
sessionId?: string;
/** Channel name for audit logging. */
channel?: string;
/** Sender ID for audit logging. */
sender?: string;
/** Model tier for audit logging. */
tier?: string;
}
// ── ToolPolicy engine ───────────────────────────────────────────────