sqlite

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DecisionRecord

type DecisionRecord struct {
	ID            string         `json:"id"`
	SessionID     string         `json:"session_id"`
	ToolUseID     string         `json:"tool_use_id,omitempty"`
	HookEventName string         `json:"hook_event_name"`
	ToolName      string         `json:"tool_name,omitempty"`
	Decision      risk.Decision  `json:"decision"`
	ReasonCode    string         `json:"reason_code"`
	Reason        string         `json:"reason"`
	RiskScore     *float64       `json:"risk_score,omitempty"`
	Threshold     *float64       `json:"threshold,omitempty"`
	ModelVersion  string         `json:"model_version,omitempty"`
	RiskEvent     risk.RiskEvent `json:"risk_event"`
	CreatedAt     time.Time      `json:"created_at"`
}

type LedgerBatch added in v0.8.0

type LedgerBatch struct {
	Sessions           []LedgerRecord            `json:"agent_sessions"`
	Actions            []LedgerRecord            `json:"authorization_actions"`
	Receipts           []LedgerRecord            `json:"authorization_receipts"`
	ReceiptChainAnchor *LedgerReceiptChainAnchor `json:"receipt_chain_anchor,omitempty"`
}

type LedgerExportOptions added in v0.8.0

type LedgerExportOptions struct {
	UpdatedAfter *time.Time
	Limit        int
}

type LedgerReceiptChainAnchor added in v0.8.0

type LedgerReceiptChainAnchor struct {
	PreviousReceiptHash string `json:"previous_receipt_hash"`
}

type LedgerRecord added in v0.8.0

type LedgerRecord map[string]any

type SessionRecord added in v0.7.0

type SessionRecord struct {
	ID         string     `json:"id"`
	Agent      string     `json:"agent,omitempty"`
	CWD        string     `json:"cwd,omitempty"`
	Source     string     `json:"source,omitempty"`
	Status     string     `json:"status,omitempty"`
	ExternalID string     `json:"external_id,omitempty"`
	CreatedAt  time.Time  `json:"created_at"`
	UpdatedAt  time.Time  `json:"updated_at"`
	ClosedAt   *time.Time `json:"closed_at,omitempty"`
}

type SessionSummary

type SessionSummary struct {
	SessionID string    `json:"session_id"`
	Critical  int       `json:"critical"`
	Warnings  int       `json:"warnings"`
	Actions   int       `json:"actions"`
	LatestAt  time.Time `json:"latest_at"`
	Current   bool      `json:"current,omitempty"`
}

type Store

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

func OpenStore

func OpenStore(path string) (*Store, error)

func (*Store) AgentSessions added in v0.8.0

func (s *Store) AgentSessions(ctx context.Context, ids []string) ([]LedgerRecord, error)

func (*Store) AuthorizationActions added in v0.8.0

func (s *Store) AuthorizationActions(ctx context.Context, opts LedgerExportOptions) ([]LedgerRecord, error)

func (*Store) AuthorizationReceipts added in v0.8.0

func (s *Store) AuthorizationReceipts(ctx context.Context, opts LedgerExportOptions) ([]LedgerRecord, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) CloseSession added in v0.7.0

func (s *Store) CloseSession(ctx context.Context, sessionID string) error

func (*Store) EnsureObservedSession added in v0.7.0

func (s *Store) EnsureObservedSession(ctx context.Context, sessionID, agent, cwd string) (SessionRecord, error)

func (*Store) Events

func (s *Store) Events(ctx context.Context, sessionID string) ([]DecisionRecord, error)

func (*Store) LedgerBatch added in v0.8.0

func (s *Store) LedgerBatch(ctx context.Context, opts LedgerExportOptions) (LedgerBatch, error)

func (*Store) OpenSession added in v0.7.0

func (s *Store) OpenSession(ctx context.Context, sessionID, agent, cwd, source, externalID string) (SessionRecord, error)

func (*Store) Path added in v0.7.0

func (s *Store) Path() string

func (*Store) SaveDecision

func (s *Store) SaveDecision(ctx context.Context, event risk.HookEvent, decision risk.RiskDecision) (DecisionRecord, error)

func (*Store) Session added in v0.7.0

func (s *Store) Session(ctx context.Context, sessionID string) (SessionRecord, error)

func (*Store) SessionSummary

func (s *Store) SessionSummary(ctx context.Context, sessionID string) (SessionSummary, error)

func (*Store) Sessions

func (s *Store) Sessions(ctx context.Context) ([]SessionSummary, error)

func (*Store) Summary

func (s *Store) Summary(ctx context.Context) (Summary, error)

func (*Store) VerifyReceipts added in v0.8.0

func (s *Store) VerifyReceipts(ctx context.Context) error

type Summary

type Summary struct {
	Critical int `json:"critical"`
	Warnings int `json:"warnings"`
	Actions  int `json:"actions"`
	Sessions int `json:"sessions"`
}

Jump to

Keyboard shortcuts

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