Documentation
¶
Overview ¶
Package audit writes an append-only JSONL record of what tools did and what the user approved or denied. Secrets are masked before writing.
Index ¶
Constants ¶
const ( KindSession = "session_start" KindPrompt = "prompt" KindToolCall = "tool_call" KindToolResult = "tool_result" KindApproval = "approval" KindDenial = "denial" KindHook = "hook" KindUndo = "undo" KindAttachment = "attachment" // an image sent to the model: path and hash only KindUserShell = "user_shell" // a command the user ran with "!" (not an agent action) KindUserSearch = "user_search" // a web search the user ran with /search web )
Kinds of audit entries.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct {
Time time.Time `json:"time"`
Session string `json:"session,omitempty"`
Kind string `json:"kind"`
Tool string `json:"tool,omitempty"`
Args map[string]any `json:"args,omitempty"`
Detail string `json:"detail,omitempty"`
Decision string `json:"decision,omitempty"`
Error string `json:"error,omitempty"`
Workspace string `json:"workspace,omitempty"`
}
Entry is one audit record.
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger appends entries to <dir>/audit-YYYY-MM-DD.jsonl. A nil *Logger is a valid no-op, so callers never need to check whether auditing is enabled.
func (*Logger) Log ¶
Log appends an entry. Failures are reported once to stderr and otherwise ignored: auditing must never break the session.
func (*Logger) SetContext ¶
SetContext sets the session and workspace recorded on later entries.