notify

package
v0.3.9 Latest Latest
Warning

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

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

Documentation

Overview

Package notify exec's a user-configured command for agent-driven notifications. Triggered explicitly by `boid task notify` calls; no payload diffing or polling.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Event

type Event struct {
	TaskID      string
	TaskTitle   string
	ProjectID   string
	ProjectName string
	Message     string
	JobID       string
	// URLPath, when non-empty, overrides the default BOID_TASK_URL target
	// resolution. The caller supplies a full path (e.g. "/tasks/abc/questions/q1")
	// and Notify prefixes it with PublicURL. Used by ask-mode notifications
	// so the user opens the Q&A page directly instead of the job terminal.
	URLPath string
}

Event carries the data passed to the notify command via env vars. All fields except TaskID and Message are best-effort: empty strings surface as empty env vars, which the user's script can ignore.

type Service

type Service struct {
	Command   []string
	PublicURL string
	// contains filtered or unexported fields
}

Service exec's the configured Command for each notification event. A nil receiver or empty Command makes Notify a no-op so the rest of the system does not need to special-case "notifications disabled".

Command/PublicURL are guarded by mu (docs/plans/volume-only-daemon.md §論点 f: `notify.command`/`web.public_url` are both classified "dynamic" — silently hot-reloadable via `boid config set/apply/edit`). Every pre-this-PR caller constructs a Service once at daemon startup and never touches these fields again, so the zero-value mutex is safe to add without changing any existing call site's behavior; internal/server's config-apply path is the only new caller of Update.

func (*Service) Notify

func (s *Service) Notify(ctx context.Context, ev Event) error

Notify exec's the service's Command synchronously, passing event data through environment variables. Returns an error if the command fails to start or exits non-zero. Callers should treat the error as notification-side failure (the agent's intent is recorded by the calling boid task notify regardless).

func (*Service) Update added in v0.1.0

func (s *Service) Update(command []string, publicURL string)

Update swaps Command/PublicURL live, under mu — the daemon-side half of hot-reloading notify.command/web.public_url (internal/server's ApplyConfigYAML). Safe to call concurrently with Notify.

Jump to

Keyboard shortcuts

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