attention

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

type Handler struct {
	handler.Base
	// contains filtered or unexported fields
}

Handler serves /api/v1/attention: the blocks agents have raised in this repository and waiting on a person, plus the one write that closes one.

GET answers {"requests":[...],"store":"<dir>"} - the same shape `magus session attention -o json` prints, so the console and the terminal cannot come to describe one queue differently. The requests are sessions.AttentionRequest values, which is what makes the two identical by construction rather than by review.

POST {"id":"<id or prefix>","reason":"<text>"} disposes one, and is a HUMAN act. Nothing magus does closes a request: an event whose whole meaning is "blocked on a person" stops meaning that the moment the tool answers it (docs/doctrine.md, "Manual on purpose"). This route exists because the console IS the person's surface, alongside the CLI - not as an automation door. There is deliberately no dispose-all, no expiry and no filter that could clear the queue without reading it.

Authorship rides the ROUTE, never the payload, the same rule DiffSessionHandler states: an agent reaches magus through MCP and cannot arrive here, so a write that lands here came from the console and is stamped [consoleSessionHost] without trusting anything the caller sent.

func NewHandler

func NewHandler(root, version string, log *slog.Logger, tel observability.Provider) *Handler

NewHandler returns the /api/v1/attention handler for the repository at root.

The store is resolved per request from root rather than once here: sessions.Dir is a hash and a path join, and resolving it live keeps the handler saying what the CLI would say from the same checkout even if the state directory moves under a long-lived daemon.

tel may be nil; it records how long each closed request waited. Only the disposals that come through THIS route are measured - the CLI's `magus session dispose` closes requests in a one-shot process with no collector - which is why the instrument is a wait-time distribution and not a queue depth that would read as the whole queue and be neither.

Jump to

Keyboard shortcuts

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