notify

package
v0.0.0-...-fad1b39 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package notify defines the SPI for human approval notifications.

When an intent requires human approval, the approval orchestrator dispatches a notification via this SPI. The notification includes a deep link back to the web app where the approver can review and act.

The built-in implementations deliver via Slack and email. Alternative implementations can target other channels (PagerDuty, SMS, Teams, etc.) without modifying the orchestrator.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Approver

type Approver struct {
	PrincipalID string
	DisplayName string
	// Contact is the channel-specific address (email address, Slack user ID).
	Contact string
}

Approver is a person who should be notified about an approval request.

type LogNotifier

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

LogNotifier logs approval notifications to slog. For development only.

func NewLogNotifier

func NewLogNotifier(log *slog.Logger) *LogNotifier

NewLogNotifier returns a Notifier that logs to the provided logger.

func (*LogNotifier) Notify

func (n *LogNotifier) Notify(_ context.Context, notif Notification) error

type Multi

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

Multi dispatches a notification to multiple notifiers in sequence. Errors from individual notifiers are collected but do not stop delivery to subsequent notifiers.

func NewMulti

func NewMulti(notifiers ...Notifier) *Multi

NewMulti returns a Notifier that dispatches to all provided notifiers.

func (*Multi) Notify

func (m *Multi) Notify(ctx context.Context, n Notification) error

Notify dispatches the notification to all registered notifiers.

type MultiError

type MultiError struct {
	Errors []error
}

MultiError collects errors from multiple notifiers.

func (*MultiError) Error

func (e *MultiError) Error() string

type Notification

type Notification struct {
	ApprovalID  string
	IntentID    string
	WorkspaceID string
	// Summary is a one-line human-readable description of what the agent
	// wants to do, drawn from the intent.
	Summary string
	// ReviewURL is the deep link to the approval UI for this request.
	ReviewURL string
	// Approvers are the people who should receive this notification.
	Approvers []Approver
}

Notification is the data delivered to approvers when an approval is needed.

type Notifier

type Notifier interface {
	// Notify sends an approval request notification to the listed approvers.
	Notify(ctx context.Context, n Notification) error
}

Notifier delivers approval request notifications to human approvers.

type TerminalNotifier

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

TerminalNotifier writes approval notifications as a human-readable multi-line block to an io.Writer. Production wiring points it at the daemon's stderr (which the daemon redirects into `~/.aileron/daemon.log`); the user can follow that file, or reach the queue via the webapp at the URL printed in the block.

Output shape (with leading and trailing blank lines so the block stands out in a tail of mixed log output):

aileron: approval required — <Summary>
  open: <ReviewURL>
  or:   aileron open approval <ApprovalID>

Both lines under the header are designed to be useful from a different terminal than the one running the agent: the URL is directly openable (most terminals turn it into a clickable link) and the `aileron open approval <id>` form lets the user trigger the same open from any shell on the host.

Replaces the previous DesktopNotifier (osascript / notify-send), which surfaced notifications that had no working click action on macOS — clicking the notification opened Finder rather than the review URL, which was strictly worse than no notification at all.

func NewTerminalNotifier

func NewTerminalNotifier(w io.Writer, log *slog.Logger) *TerminalNotifier

NewTerminalNotifier returns a TerminalNotifier writing to w. Passing nil for w substitutes io.Discard so production callers that mis-wire the notifier degrade to silent-but-correct rather than panicking. Passing nil for log uses slog.Default.

func (*TerminalNotifier) Notify

func (n *TerminalNotifier) Notify(_ context.Context, notif Notification) error

Notify writes the formatted block to the configured writer. Fails soft: a writer error is logged and swallowed so a transient stderr problem can't break the approval flow itself (the queue's invariants don't depend on notifications firing).

Jump to

Keyboard shortcuts

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