Documentation
¶
Overview ¶
Package alerts decides when the owner's phone hears about a session: at once when it shows a permission dialog, and a minute after it finishes a turn with nothing following. Pure rules over the event stream, with no clock or network of its own; the daemon feeds it and sends what it returns (ADR-036).
Index ¶
Constants ¶
const ( // FinishedAfter is how long a Stop must stand before it is "finished": an // agent pausing between turns, or an owner replying at once, pages nobody. FinishedAfter = time.Minute // Cooldown is the quietest a session may be between two alerts of one kind. // A run of permission dialogs a few seconds apart is one interruption, and // whoever answered the first is already looking. Cooldown = 3 * time.Minute // HourlyCap bounds every alert together, whatever the sessions do. HourlyCap = 20 )
Defaults, chosen so that someone at the keyboard is never paged and someone away from it hears once.
Variables ¶
This section is empty.
Functions ¶
func CheckMessage ¶
CheckMessage is what "Send a test alert" sends: the same shape as a real one, saying it is a test, so the person setting it up sees exactly what will arrive.
func Message ¶
Message renders an alert as the text of one Telegram message.
What it may carry is the whole privacy argument for sending it (ADR-036): the project's folder name, what happened, which agent, and a link back to the dashboard. Never a prompt, a reply, a tool, a command or a path — Telegram reads every word of it. link is empty when the dashboard cannot be reached from a phone, and then the line is left out rather than offering a loopback address that opens nothing.
Types ¶
type Alert ¶
type Alert struct {
Kind Kind
SessionID string
// Question says the dialog is AskUserQuestion's: waiting for an answer
// rather than an approval.
Question bool
// LastThisHour says this alert used the hour's final slot, so the message
// can say the rest are held back rather than leaving a silence to explain.
LastThisHour bool
}
Alert is one message to send.
type Rules ¶
type Rules struct {
// Enabled says whether a kind is switched on right now. A switched-off
// kind is still tracked, so turning it on later starts from the truth.
Enabled func(Kind) bool
// contains filtered or unexported fields
}
Rules holds what the alerts depend on: which sessions are waiting or stopped, and what was sent when. Not safe for concurrent use.