audit

package
v0.54.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2026 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// FileName is the audit log file name stored under .beads/.
	FileName = "interactions.jsonl"
)

Variables

This section is empty.

Functions

func Append

func Append(e *Entry) (string, error)

Append appends an event to .beads/interactions.jsonl as a single JSON line. This is intentionally append-only: callers must not mutate existing lines.

func EnsureFile

func EnsureFile() (string, error)

EnsureFile creates .beads/interactions.jsonl if it does not exist.

func Path

func Path() (string, error)

func Redact

func Redact(s string) string

Redact masks sensitive information in command arguments or config values

func RedactSlice

func RedactSlice(args []string) []string

RedactSlice redacts an entire slice of strings (e.g. command args)

Types

type Entry

type Entry struct {
	ID        string    `json:"id"`
	Kind      string    `json:"kind"`
	CreatedAt time.Time `json:"created_at"`

	// Common metadata
	Actor   string `json:"actor,omitempty"`
	IssueID string `json:"issue_id,omitempty"`

	// LLM call
	Model    string `json:"model,omitempty"`
	Prompt   string `json:"prompt,omitempty"`
	Response string `json:"response,omitempty"`
	Error    string `json:"error,omitempty"`

	// Tool call
	ToolName string `json:"tool_name,omitempty"`
	ExitCode *int   `json:"exit_code,omitempty"`

	// Labeling (append-only)
	ParentID string `json:"parent_id,omitempty"`
	Label    string `json:"label,omitempty"`  // "good" | "bad" | etc
	Reason   string `json:"reason,omitempty"` // human / pipeline explanation

	// Evaluation (bd-2zb)
	EvalSessionID string `json:"eval_session_id,omitempty"`

	Extra map[string]any `json:"extra,omitempty"`
}

Entry is a generic append-only audit event. It is intentionally flexible: use Kind + typed fields for common cases, and Extra for everything else.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL