audit

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2026 License: Apache-2.0 Imports: 7 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package audit records every tool call as one JSON line.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	Time      time.Time      `json:"time"`
	User      string         `json:"user"`
	Transport string         `json:"transport"`
	Tool      string         `json:"tool"`
	Args      map[string]any `json:"args,omitempty"`
	Outcome   string         `json:"outcome"` // "ok", "error", "denied", "pending"
	Error     string         `json:"error,omitempty"`
	// Write tools only: the plan shown to the human and how it was approved.
	Plan     string `json:"plan,omitempty"`
	Source   string `json:"source,omitempty"`
	Approval string `json:"approval,omitempty"`
	// Undo records that the result offered an undo link.
	Undo       bool  `json:"undo,omitempty"`
	DurationMS int64 `json:"duration_ms"`
	OutputSize int   `json:"output_bytes"`
}

Event is one tool call. Args must already be redacted by the caller.

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger writes events. It is safe for concurrent use.

func Open

func Open(path string) (*Logger, error)

Open returns a Logger appending to path (created 0600 if missing). An empty path logs to stderr.

func (*Logger) Close

func (l *Logger) Close() error

Close closes an owned log file, leaving stderr open. It is safe to repeat.

func (*Logger) Record

func (l *Logger) Record(e Event)

Record writes e. Failures are reported to stderr, never to the caller, so that a full disk cannot be used to make tools fail open or closed unexpectedly.

Jump to

Keyboard shortcuts

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