Help us shape the future of Go! Take the 2026 Go Developer Survey

audit

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package audit 实现 Golem 的运行时审计日志记录功能。

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"`                 // 事件发生时间
	Type      string    `json:"type"`                 // 事件类型(如 policy_allow, tool_execution)
	RequestID string    `json:"request_id,omitempty"` // 请求追踪 ID
	Tool      string    `json:"tool,omitempty"`       // 关联的工具名称
	Result    string    `json:"result,omitempty"`     // 执行结果或决策状态
}

Event 表示单条审计记录,以 JSON 行 (JSONL) 格式写入。

type Writer

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

Writer 负责将审计事件异步追加到工作区内的 <workspace>/state/audit.jsonl 文件中。

func NewWriter

func NewWriter(workspace string) *Writer

NewWriter 在工作区的 state 目录下创建一个新的审计日志写入器。

func (*Writer) Append

func (w *Writer) Append(event Event) error

Append 将一个审计事件作为一行 JSON 数据追加到文件中。

Jump to

Keyboard shortcuts

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