Versions in this module Expand all Collapse all v0 v0.1.0 Aug 13, 2026 Changes in this version + const TopicCapture + const TopicDecisions + const TopicPolicies + const TopicRequests + var ErrNotFound = errors.New("not found") + func CanonicalJSON(v any) ([]byte, error) + func ContentOf(eventType, eventName string, sequence int, ...) map[string]any + func GenerateSeed() ([]byte, error) + func HashContent(payload map[string]any) (string, error) + func IsStateError(err error) bool + func NewKeyFromSeedB64(seedB64 string) (ed25519.PrivateKey, error) + func SeedToB64(seed []byte) string + func SignMessage(priv ed25519.PrivateKey, prevHash, contentHash string) string + func SummarizeDelta(changes []Change) *string + func VerifyChain(events []map[string]any, pub ed25519.PublicKey) (valid bool, checked int, errors []string) + func VerifySignature(pub ed25519.PublicKey, prevHash, contentHash, sigB64 string) bool + type Bus struct + func NewBus() *Bus + func (b *Bus) Publish(topic string, data any) + func (b *Bus) Subscribe(topics ...string) chan Event + func (b *Bus) Unsubscribe(topics []string, ch chan Event) + type CaptureEventIn struct + EventName string + EventType string + InputPayload json.RawMessage + Metadata json.RawMessage + OutputPayload json.RawMessage + Status string + type CaptureFilter struct + AgentID *string + EventType *models.CaptureEventType + Limit int + Offset int + SessionID *string + type Change struct + From any + Op DeltaOp + Path string + To any + func DiffDicts(base, modified map[string]any, path string) []Change + type CreateParams struct + ActionPayload json.RawMessage + AgentID string + Description string + Framework string + Metadata json.RawMessage + PolicyID *string + Priority int + Requester string + RiskLevel models.RiskLevel + SessionID string + Title string + type DecisionFilter struct + Agreement *bool + Limit int + Offset int + Q *string + Source *models.DecisionSource + type DeltaOp string + const DeltaAdd + const DeltaRemove + const DeltaReplace + type Event struct + Data any + Topic string + type Feedback struct + ApprovedWithFeedback int + NegativeOutcomes int + type Governance struct + CorrectionRate float64 + ErrorEscapeRate float64 + EscalationRate float64 + ReviewerAgreement float64 + SLAComplianceRate float64 + TimeoutRate float64 + type Latency struct + AvgSeconds float64 + HumanReviews int + P50Seconds float64 + P95Seconds float64 + type MetricsResult struct + Feedback Feedback + Governance Governance + Latency Latency + Risk RiskInfo + Totals TotalsInfo + Window WindowInfo + type PolicyEngine struct + func NewPolicyEngine(store *Store, interval time.Duration) *PolicyEngine + func (e *PolicyEngine) Start() + func (e *PolicyEngine) Stop() + type PolicyPatch struct + AutoApproveBelowRisk *bool + Description *string + Enabled *bool + MinReviewers *int + OnTimeout *models.TimeoutAction + RiskLevels *[]models.RiskLevel + TimeoutSeconds *int + type RequestFilter struct + AgentID *string + Escalated *bool + Framework *string + Limit int + Offset int + Q *string + Risk *models.RiskLevel + Status *models.RequestStatus + type ResolveParams struct + Amend bool + Approved bool + DecisionPayload json.RawMessage + Note string + RecordDecision bool + ReviewerID string + Source models.DecisionSource + type RiskBucket struct + Created int + Escalated int + type RiskInfo map[string]RiskBucket + type StateError struct + func (e *StateError) Error() string + type Store struct + func New(db *sql.DB, bus *Bus) *Store + func (s *Store) ApplyTimeout(ctx context.Context, req *models.ApprovalRequest) (*models.ApprovalRequest, error) + func (s *Store) Bus() *Bus + func (s *Store) CancelRequest(ctx context.Context, req *models.ApprovalRequest, agentID string) (*models.ApprovalRequest, error) + func (s *Store) Close() error + func (s *Store) ComputeMetrics(ctx context.Context, sinceDays *int) (*MetricsResult, error) + func (s *Store) CreatePolicy(ctx context.Context, p models.Policy) (*models.Policy, error) + func (s *Store) CreateRequest(ctx context.Context, p CreateParams) (*models.ApprovalRequest, error) + func (s *Store) DB() *sql.DB + func (s *Store) EscalateRequest(ctx context.Context, req *models.ApprovalRequest, reviewerID, note string) (*models.ApprovalRequest, error) + func (s *Store) FindPendingOverdue(ctx context.Context, at time.Time) ([]*models.ApprovalRequest, error) + func (s *Store) GetRequest(ctx context.Context, idOrRef string) (*models.ApprovalRequest, error) + func (s *Store) IngestCaptureBatch(ctx context.Context, agentID, sessionID string, events []CaptureEventIn) ([]*models.CaptureEvent, error) + func (s *Store) ListCapture(ctx context.Context, f CaptureFilter) (int, []*models.CaptureEvent, error) + func (s *Store) ListDecisions(ctx context.Context, f DecisionFilter) (int, []*models.DecisionLog, error) + func (s *Store) ListPolicies(ctx context.Context) ([]*models.Policy, error) + func (s *Store) ListRequests(ctx context.Context, f RequestFilter) (int, []*models.ApprovalRequest, error) + func (s *Store) ResolveRequest(ctx context.Context, req *models.ApprovalRequest, params ResolveParams) (*models.ApprovalRequest, error) + func (s *Store) SubmitFeedback(ctx context.Context, req *models.ApprovalRequest, outcome models.Outcome, ...) (*models.ApprovalRequest, error) + func (s *Store) UpdatePolicy(ctx context.Context, id string, patch PolicyPatch) (*models.Policy, error) + func (s *Store) VerifyCapture(ctx context.Context, agentID, sessionID *string) (valid bool, checked, chains int, errs []string, err error) + type TotalsInfo struct + ByStatus map[string]int + Escalated int + Pending int + Requests int + type WindowInfo struct + GeneratedAt string + SinceDays *int