summaryrefslogtreecommitdiff
path: root/config/pi/extensions/alarm.ts
AgeCommit message (Collapse)Author
7 dayspi alarm: keep pending alarms across /reloadIgor Soarez
/reload dropped every pending alarm and stopped its when_done command, without a word. An agent that had ended its turn to wait for one was never woken -- nor a pi-goal goal_wait counting on it. The old copy of the extension now leaves what is pending on globalThis instead: each alarm as plain data, the due queue, the next id, and a when_done command's ChildProcess with its own listeners removed. The copy pi loads next arms fresh timers from each alarm's absolute time, listens on the command again (one that exited meanwhile still holds its status), and resumes polling PIDs. Nothing crosses that would reach the old, stale pi or ctx. A handoff from another session or another HANDOFF_VERSION is refused and its commands stopped, with a notice. If nothing takes it within 30s -- the file failed to load, or was removed -- the old copy stops its commands. Quitting, /new, /resume and /fork still drop everything.
11 dayspi alarm: fire when a command exits or when processes exitIgor Soarez
when_done runs a command (bash -c, in pi's cwd, output to a log file) and fires when it exits, with its exit status; cancelling the alarm or ending the session stops it. when_exits polls PIDs already running and fires once all are gone. Either takes an optional deadline, 24 hours by default, at which the alarm fires anyway and a still-running command is stopped. A process exiting is a signal any condition can be turned into -- gh run watch, sz-wait-for, an until-curl loop -- so the agent can start something long, end its turn and be woken, instead of blocking on it. The delivery path is the existing one, unchanged. pi-subagent: ยง5 sets an alarm on the runs' PIDs instead of waiting.
2026-10-23pi alarm: steer a due alarm into a running taskIgor Soarez
An alarm that fell due mid-task used to wait in the extension until the run settled. Now it is steered in: pi adds it after the tool calls in progress finish, before the next model call, and the model weighs it against the task. The alarm text tells it to say which it chose. pi's Esc empties its queue and drops queued extension messages without a word, so an alarm stays listed until message_end shows it in the conversation. One not seen by the end of a stopped run is held and sent again after the next run completes; resending into that run could deliver it twice, since pi takes one queued steer per turn and other aborts leave the original queued.
2026-10-22pi: alarm extension, timed notes the agent sets for itselfIgor Soarez
An `alarm` tool sets, lists and cancels alarms: after a delay, at a wall-clock time, or repeating (at most 12 fires, the last within 24 hours). A fired alarm is a pi.sendMessage custom message, customType "alarm", rendered as set by the agent rather than typed by the user, and wrapped in fixed text the agent cannot drop: it is the agent's own earlier note, not the user's, and grants no permission -- outward actions still need the user's approval. /alarms lists and cancels. An alarm due while pi is busy waits for the task to finish, held here rather than in pi's queue, which drops a custom message on Esc. A run that ended stopped -- Esc, an error, or the abort before /compact, /new, /resume and /fork -- holds due alarms until a later run completes. Timers die with the session; the tool is withdrawn outside the TUI. Reviewed by Fable and GLM 5.3 Flash. Fixed from the review: unbounded every_minutes overflowed setTimeout into 1 ms fires; a due alarm ran right after Esc, or unseen on a session being replaced; stale repeat fires piled up; the session_compact delivery never ran; impossible dates and times skipped by a clock change were accepted; the note could forge the wrapper's delimiters. Declines dot request 20261021-220352-work-laptop-c46033 (sz-agent-alarm, a skill typing into the agent's tmux pane) in favour of this: a custom message is recorded and shown as the agent's, needs no screen-scraping, and loads only in pi.