notify

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2026 License: MIT Imports: 18 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package notify raises OS notifications for needs_human, dead letters and budget exhaustion (RFC 7.4). Title = agent, body = summary (max 280 chars), never the raw inbound body. ping.go sends the same events to a phone, with no summary.

Index

Constants

View Source
const PingTestText = "smif test ping"

PingTestText is the body of `smif notify test`.

Variables

This section is empty.

Functions

func Clip

func Clip(s string, n int) string

Clip trims s to n runes on a rune boundary.

func PingText added in v0.2.0

func PingText(e Event) string

PingText is the body of the ping for an event.

Types

type Event

type Event struct {
	Kind      string    `json:"kind"` // needs_human | dead_letter | budget | claude_unavailable | session_waiting | session_answered
	Agent     string    `json:"agent"`
	Summary   string    `json:"summary"`
	MessageID string    `json:"message_id,omitempty"`
	At        time.Time `json:"at"`
}

Event is one notification.

type Notifier

type Notifier interface {
	Notify(Event) error
}

Notifier delivers events.

func New

func New(spec, dataDir string) Notifier

New builds a notifier from the config value: "os", "none" or "log:<path>". dataDir holds the macOS notifier app (app.go).

type Pinger added in v0.2.0

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

Pinger posts pings. It holds no URL: the caller gives the current one for each ping, so a config reload needs no new Pinger.

func NewPinger added in v0.2.0

func NewPinger(failed func(kind, why string)) *Pinger

NewPinger builds a Pinger. failed hears each lost ping of Send, from another goroutine, and never gets the URL.

func (*Pinger) Post added in v0.2.0

func (p *Pinger) Post(url, text string) error

Post sends one ping and waits for the answer. Any 2xx is success.

func (*Pinger) Send added in v0.2.0

func (p *Pinger) Send(url string, e Event)

Send posts the ping for e in the background and returns at once. An empty URL sends nothing. There is no retry.

Jump to

Keyboard shortcuts

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