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

notify

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package notify pushes agent events to a logged-in admin in real time.

SSE rather than WebSockets: the traffic is one-directional (server tells the browser something happened), SSE reconnects on its own, and it needs no protocol upgrade through whatever proxy sits in front. A WebSocket would be more machinery for a strictly simpler job.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	ID       string `json:"id"`
	Kind     string `json:"kind"`     // decision_opened | run_finished | issue_moved | mention
	Severity string `json:"severity"` // info | warn | action_required
	Title    string `json:"title"`
	Preview  string `json:"preview"`
	Link     string `json:"link"`
	// Sound names a clip the browser plays. Empty means silent — most events
	// should be silent, or the alert stops meaning anything.
	Sound   string `json:"sound"`
	Urgency string `json:"urgency"`
	IssueID string `json:"issueId,omitempty"`
	At      string `json:"at"`
}

Event is one push.

type Service

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

func New

func New(db *sql.DB, log *slog.Logger) *Service

func (*Service) NotifyDecision

func (s *Service) NotifyDecision(ctx context.Context, userID string, issueID string, issueNumber int64, agent, question string)

NotifyDecision is what the orchestrator calls when an agent needs a human.

This is the one event that always makes a sound: it is the only class where nothing proceeds until a person acts, so it is the only one that has earned the right to interrupt.

func (*Service) Publish

func (s *Service) Publish(ctx context.Context, userID string, ev Event)

Publish records the notification and pushes it to every live subscriber.

The database write comes first: a browser that is closed must still find the notification waiting when it opens. SSE is the fast path, not the record.

func (*Service) Routes

func (s *Service) Routes(r chi.Router)

Jump to

Keyboard shortcuts

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