6 Commits
Author SHA1 Message Date
YanYunCY ea673941ed notify 0.1.5: Claude Code subagent progress summaries are side calls (#1207)
Claude Code 2.1.318+ asks a running subagent for a 3-5 word progress
label about every 30s; its end_turn reply read as the subagent's turn
ending. notify's onRequest now leaves such a request alone.

By YanYunCY (#1207).

Run at d19698067 (macOS via mica-run, temp HOME): bun test in
packages/notify 78 pass; check.mjs ok. Broken by hand: without the early
return the new progress-summary test fails. Fixtures scanned for keys,
emails and home paths: none.
2026-11-16 15:47:40 +08:00
yetone 8adf0a7d79 notify 0.1.4: a sidebar page to edit channels and settings, and a switch that turns every push off (meili145 on X)
The page (magpie.page) edits the plugin's options without a file: add,
pause and remove channels per kind, when to send, agents, language, and an
on/off switch that saves at once (new option enabled, default true; off
sends no turn push and no sign-in push).

Run: bun test packages/notify (67 pass; the enabled test fails on the old
hook), scripts/check.mjs ok. Page tried in magpie's real window (dev build
of origin/main, sandbox HOME, plugin added from the folder) in chromium:
add ntfy channel, Save and the switch wrote plugins.json options, 5
languages at 1000px and 420px with no overflow. Not tried: WebKit (its
launch failed on mote), a real push from the page.
2026-11-11 13:13:40 +08:00
yetone e035ea40bb notify 0.1.3: a push when a subscription account is signed out
shannnnnks on X: with several Codex accounts behind magpie's gateway, one
is now and then signed out; they want notify to push it.

magpie v0.1.3443 calls a hooks file's onSignIn once when an account in
use must be signed in again (Codex revoked or refused, Claude, Copilot or
plugin sign-in lapsed, ...), and when a Claude sign-in ends within days.
notify pushes "⚠️ Codex account x signed out / Sign in again in magpie."
(zh with lang "zh") to the same channels. On by default (accounts: true);
one push per account and state per accountCooldownMinutes (60). Webhook
event: {kind: "signed-out"|"ending", provider, account, endsAt?}. ntfy
takes the message's tag, "warning" here. README, registry summary.

Run on mote: bun test packages/notify, 65 pass (7 new: default push, zh,
Claude ending days, accounts false, cooldown, unknown states, webhook
event); bun scripts/check.mjs ok. The new tests can't import onSignIn
from the old notify.hooks.mjs, so they fail there.
Not tried: a real push from a real revoked account.
2026-11-10 01:45:30 +08:00
Monica Everett cc7f4327e5 notify 0.1.2: a Gotify channel (#593, UnspokenSpell)
notify 0.1.2 adds a Gotify channel (UnspokenSpell): POST <server>/message with X-Gotify-Key, title and message; priority only when the channel sets it (an explicit 0 stays 0), so the application's own default applies otherwise; extras when set. Needs server and token. post() also reads Gotify's errorDescription on failure. Gotify is listed in the package README (with priority's fallback and extras), the root README and the registry summary.

Answers the 11-01 review at f2f5806: priority no longer defaults to 5, the sibling channel lists name Gotify, extras is documented and tested, errorDescription is read.

Run at the reviewed head f84a6a7 on mote:
- bun test packages/notify: 58 pass, 0 fail
- full bun test with HOME=$(mktemp -d): 4551 pass, 9 skip, 0 fail
- Broken by hand, each red then restored: priority back to `?? 5` (1 fail), errorDescription dropped (1 fail)
- A real Gotify server (3.1.1, 127.0.0.1, app with defaultPriority 2) through channels.mjs send(): no priority -> stored with priority 2; priority 0 -> stored 0; wrong token -> {ok:false,status:401,error:"you need to provide a valid access token or user credentials to access this api"}

Not tried: Gotify behind a reverse proxy at this head (tried at f2f5806, unchanged path code).
2026-11-02 03:37:00 +08:00
YanYunCY 74ef5602f1 notify 0.1.1: an interim agent notification or a SendMessage resume holds the turn (YanYunCY, #578)
Claude Code background agents: an interim `<task-notification>` (the agent stopped with background work of its own still running, or a late message is resuming it) no longer ends the turn early, and a SendMessage that resumes an agent (`resumedAgentId`) holds the turn until that agent notifies again. Fixes #576. By YanYunCY.

- Only the `<note>` decides that a notification is interim; the agent's own `<result>` may quote the same words. (Checked against claude 2.1.316's source: the binary always writes `<note>` before `<result>` in an agent notification.)
- An entry marked interim is dropped when the user's next own message starts a turn, so an agent that keeps a dev server running never silences later turns.
- A notification with a `<tool-use-id>` ends only that call; one with only a `<task-id>` ends every call the agent is out under. A SendMessage resume replaces the agent's earlier calls.
- notify 0.1.1. Fixtures recorded from the real claude 2.1.316 (agent-interim, sendmessage, late-message).

What was run (reviewed head 045668c, on the mote Mac mini, Bun 1.4.2, HOME=$(mktemp -d)):
- `bun test packages/notify`: 57 pass, 0 fail. `bun scripts/check.mjs`: exit 0. `bun test` (whole repo) at the head: 4474 pass, 9 skip, 0 fail; and with origin/main e8050e8 merged in: 4494 pass, 9 skip, 0 fail.
- Both repros from the first review are in the suite and pass. At 5d2ed61's turn.mjs/notify.hooks.mjs, 11 tests fail.
- Broken by hand, one at a time: reading the whole notification instead of `<note>` turns 2 tests red; not dropping interim entries on the next message turns 2 red; not replacing an agent's earlier calls on SendMessage turns 1 red; ending by task-id as well as tool-use-id turns 10 red (the hand-built older-run test among them).
- Real fetch to a local fake ntfy server, replaying the recorded runs: agent-interim [0,0,0,0,0,0,1], sendmessage and late-message [0,0,0,0,0,0,0,1]; the first review's second repro pushes the next turn ("took 10 min") and the one after it.
- Extra edge cases, built by hand: two agents, one interim and one still out: the next message drops only the interim one, the interim agent's late task-id-only notification doesn't end the other, and the push comes when the other notifies. An interim agent resumed by SendMessage in the next turn holds that turn until its notification.

Not tried: a live claude session against magpie. Known and accepted: if the user's own words arrive in the same request as an interim notification, that turn stays held until the user writes again (the entry is marked after the drop).
2026-11-01 11:24:52 +08:00
YanYunCY ce3bcd26d1 notify 0.1.0: a push when an agent's turn is done (YanYunCY, #541)
A new gateway-hooks package, @magpie-community/gateway-notify 0.1.0. When an
agent's turn is over (the model answered and asked for no more tools) and it
ran at least minMinutes, or it failed, it sends one push to the channels the
user configured: ntfy, Bark, Server酱, Feishu, DingTalk, WeCom, Telegram or a
webhook. By default a push carries the agent, the project folder's name, the
model and the time taken. The reply's text is sent only with includeText.
Only `local` requests count unless allOrigins is on. The suggested options
have an empty ntfy topic, so nothing is sent until the user fills one in.

How a turn is found, checked on request bodies captured from the real
Claude Code 2.1.316 and Codex 0.166.0 (packages/notify/fixtures):
- A subagent is a conversation of its own, keyed by session plus its first
  words (Codex: its thread_id). It is nested when it first shows up while a
  top-level conversation in the session is busy, waiting on a tool, or
  holding background agents. Codex's client_metadata subagents are always
  nested, except /review.
- Compaction (Claude Code's summary request, Codex local and remote) neither
  opens nor closes a turn. The conversation that goes on from the summary
  takes over the conversation that asked for it.
- Background Agent and Workflow launches are held by tool_use_id until their
  <task-notification> arrives, whether the notification comes as its own
  message (with other <system-reminder> parts beside it) or inside a
  tool_result. A notification-only message is not the user's words.
  Background Bash doesn't hold the turn.
- A failure push waits failureHoldSeconds, and a retry cancels it.

Root README and registry.json each gain one notify row.

What was run, at the reviewed head 09dd37a1 (mote, macOS, Bun 1.4.2):
- `bun test packages/notify`: 47 pass, 0 fail. `bun scripts/check.mjs`:
  exit 0. Full `HOME=$(mktemp -d) bun test`: 4394 pass, 9 skip, 0 fail.
- PR CI (ubuntu) at 09dd37a1: test and on-npm green. The run first sat at
  action_required, so its green is attempt 2. Its log has 4412 pass, 0 fail.
- The reviewer's own Claude Code 2.1.316 captures, replayed through
  onRequest/onResponse in the gateway's call orders: 13 cases pass.
  Compaction mid-tool and `/compact` push once each, "took 20 min". A
  subagent racing the parent's reply is nested. Stale waiting conversations
  expire. A notification with a tools-used reminder beside it pushes once,
  "took 11 min" (round 4 blocker). A retried launch request pushes once,
  "took 11 min". An agent that notifies twice while a second agent runs
  pushes nothing, and one push follows when the second agent notifies.
- Each fixture group, replayed in order: one push per finished turn. There
  is no push on a notification-only message, a compaction request, a
  subagent's end, or the main conversation pausing with an agent out. Every
  push went only to the configured endpoint.
- Mutations: reverting each round-5 change turns the matching test red
  (reminder beside notification, notification inside tool_result, Workflow
  launch, launch without an Agent call, ids replaced by per-request counts,
  Codex client_metadata nesting, Codex thread id, Codex blocks opening a
  turn).
- Fixtures were scanned for personal paths, emails and keys. They hold only
  sandbox paths (/tmp/sbx, /tmp/claude-1000). The tests fake fetch, so there
  is no network. The fixtures are not in the package's npm `files`.

Not tried: the package in a live magpie gateway this round. Round 1 did
that end to end, and this round changes turn detection only. Gemini CLI has
no captured bodies. Two edges taken from the Claude Code binary and not
reproduced are filed as plugins#576. An agent's interim notification
("stopped with background work of its own still running") clears its id,
so the push can come early. A finished agent resumed by SendMessage is not
held.
2026-11-01 02:50:34 +08:00