ai-agentmanager 1.57.3 → 1.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.59.0 (2026-11-19)
4
+
5
+ - **Updates for the people who asked.** When an agent finishes or opens a pull request, what to tell the requester and other stakeholders is written from its work: a Slack message of a few lines, a short email with its subject, and the details both point to. An **Update to send** card appears in the inbox and the alert says it is ready. **Update** with an agent's documents (or `agentmgr announce <agent>`) writes one at any time, for work under way too.
6
+ - **Drafts, sent by you.** Change the text in place, then **Copy**, **Post to Slack** (asked twice; to a webhook for updates, `agentmgr announce --webhook <url>`, or where the Slack alerts go) or **Open in mail**, which fills in your own mail program. Nothing is sent to anyone by itself.
7
+ - **The details as a link.** Paste where they can be read, or **Publish to Google Drive** makes a Google Doc of them; the link goes under both messages.
8
+ - **Cost and turning it off.** Each update is one more tool-less model call on the agent's engine. `agentmgr announce --auto off` stops writing them by themselves.
9
+ - **Tried:** in desktop Chrome with a stand-in Slack webhook, and the wording once with a real model on made-up work. Not yet on a real agent's work, a real Slack channel, a phone's mail program or Google Drive.
10
+ - **Tests on CI stop at the first failure.** A failing slice ends the others, so a failure is known as soon as it happens and not when the slowest slice is through.
11
+
12
+ ## 1.58.0 (2026-11-18)
13
+
14
+ - **Screen: Pad, the screen as a trackpad.** A fingertip covers the button it aims at. With **Pad** on, a drag anywhere moves a pointer drawn on the screen (a slow finger moves it finely, a quick one crosses the screen) and a tap clicks where the pointer is. Two fingers scroll or, tapped, right-click; a finger held still, then dragged, drags. Zoomed in, the screen follows the pointer. The button appears on a touch screen and the choice is remembered. Tried in desktop Chrome with made-up touches, not yet on a phone against a real Mac.
15
+ - **Alerts on the phone.** `agentmgr notify phone` (or **Alerts** on the computer) sends the alerts Slack gets as notifications to the phone, through the [ntfy](https://ntfy.sh) app: the agent as the title, a tap opens it, and what waits for an answer is high priority. It needs no Slack. The text passes through ntfy.sh unless you give a server of your own (`--server`), and whoever knows the topic can read it, so the topic made for you is one nobody can guess. ntfy.sh accepts what is sent; not yet seen arriving on a real phone.
16
+ - **Screen: Clip, the computer's clipboard.** Type or paste text on the phone and **Send and paste** puts it on the computer's clipboard and pastes it there: a password, a link, a one-time code. **Fetch** brings back what was copied on the computer. Text only, and only while screen access is on. Tried on a Mac's clipboard and in desktop Chrome, not yet from a phone.
17
+ - **Keep this computer awake.** In the Screen dialog, or `agentmgr awake always` (or `working`: while an agent works, and five minutes after). A sleeping computer runs no agents and cannot be reached from the phone. The display may still sleep and lock, and a closed lid still puts a laptop to sleep. Tried on a Mac; on Linux it uses `systemd-inhibit`, untried.
18
+ - **Files on this computer.** **Files** in the Screen bar, the Terminal bar and the ☰ menu lists this computer's folders, starting in Downloads. Send files from the phone into the folder shown (photos too, up to 250 MB each, never over a file that is there), and tap a file to fetch it to the phone. It reaches what the terminal on this computer reaches. Tried in desktop Chrome, not yet from a phone.
19
+ - **Inbox, one at a time.** On a phone the inbox shows one card filling the screen; answered, the next takes its place. Swipe to step through them, or **‹ ›**; **Show all** brings the list back. Tried in desktop Chrome with made-up swipes; there a swipe on the card no longer goes back a page, as Chrome on Linux (and Android) otherwise does.
20
+ - **Go to.** `Ctrl+K` or `⌘K`, or **⌕ Go to** in the top bar: one box that finds a view, a list, a menu item or an agent by name and opens it. Agents that wait for you come first. On a phone it saves looking through the More menu.
21
+ - **Fixed: the first click after closing Screen did nothing.** After a mouse click in the screen, an unseen layer stayed over the page and took the next click once the dialog was closed. Found by a test here; a phone's taps did not leave it.
22
+ - **Not the browser's own notifications:** a phone allows those only from a site whose certificate it trusts, and remote access uses a self-signed one.
23
+
3
24
  ## 1.57.3 (2026-11-18)
4
25
 
5
26
  - **Screen: taps from a phone.** A tap did nothing on a Mac. It was sent as move, press and release in the same instant; it is now spaced out as a hand on a mouse would, and a ring shows where the tap landed, so you can see the page took it. Not yet confirmed against a real Mac from a phone.
package/README.md CHANGED
@@ -24,7 +24,8 @@ Run one background [Claude Code](https://claude.com/claude-code) agent per inten
24
24
  - **Projects.** The sidebar is a tree, project → agents, so you see how many projects are in flight and how many parallel sessions each has.
25
25
  - **Project shortcuts.** Each project gets a short name, such as `cc` for cloud-console. Use it instead of the repo URL: `agentmgr add @cc "…"`, `agentmgr ls cc`, `@cc` in the UI filter.
26
26
  - **Backlog.** Queue asks as work orders. Agents pick them up one by one, up to N in parallel per project, until each is done. You accept or reopen each one.
27
- - **Slack alerts.** A message in your channel when an agent needs input, finishes a backlog item, or fails.
27
+ - **Updates for the people who asked.** When an agent finishes or opens a pull request, a short Slack message, a short email and the details they point to are written for you to read, change and send.
28
+ - **Alerts, in Slack and on the phone.** A Slack message, a notification on the phone, or both, when an agent needs input, finishes a backlog item, or fails.
28
29
  - **Priority.** Mark agents P0–P3. P0 and P1 are highlighted, and lists sort by priority.
29
30
  - **Share for review.** One click writes an **Analysis**, **Design**, **Flow** or **Proposal** document from the agent's work, a human time **Estimate** for planning, or the change's **Documentation** with an OpenAPI spec of any API changes. Copy it as Markdown, download it, or print it to PDF with diagrams.
30
31
  - **Plan.** A project's commitment dates (code complete, release candidate, GA) with a checklist of what is still open for each, reminders as they come near, and an at-risk or late flag. A **decision log** gathered from plan reviews, your answers and design docs. A **tech debt radar** from git history and the code. What is open can be handed to an agent.
@@ -49,6 +50,7 @@ Run one background [Claude Code](https://claude.com/claude-code) agent per inten
49
50
  - **Standup.** Each weekday at 9:00 (or whenever you press **Standup**, or `p`), each agent with news since the last one is read aloud in a sentence or two, each in its own voice: what it did, what it's on, what it needs from you. Agents that need you go first and quiet ones are left out. It stops on an agent that needs you, with its questions beside it to answer by tap, or by voice when **Answer by voice** is on (what you say is read back, then sent when you say "send"). The wording comes from one short tool-less model call, plain wording if that fails. A Slack alert says when it's ready (Alerts). Change the time, weekends and wording in the player, or in config.json: `"standup": { "at": "09:00", "weekends": false, "ai": true, "notify": true }`. Speech is your browser's own; voice answers may be sent to your browser's maker to be turned into text.
50
51
  - **Map.** A project's folders as tiles sized by their files, with each agent as a badge on the folders it is changing (filled) or reading right now (ring), refreshed every few seconds (**Map** at the top, `m`, or `#map`). A red line joins two agents that changed the same file: they will conflict when merged. A dashed line runs from an agent reading a file to the agent that already changed it, which is the warning before they collide. Each pair is also spelled out above the map. Reading comes from the last half hour of each agent's session; changes from the conflict radar.
51
52
  - **Watch.** Every running agent's session side by side on one page, live (**Watch** at the top, or `#watch`), so you follow them all without clicking from one to the next. Tiles keep a fixed order; one waiting on you gets a red border and is counted at the top. Click a tile and type to answer it there; its name opens the agent. Show running agents, only those waiting on you or only those working, one project's, or a fixed number per row; **Fit** sizes the tiles so all of them (up to 12) are on screen, keeping the newest lines in view. Tiles show each session at its own size and never resize it.
53
+ - **Go to.** `Ctrl+K` or `⌘K` (or **⌕ Go to** in the top bar) opens one box that finds a view, a list, a menu item or an agent by name; agents that wait for you come first. On a phone it saves looking through the More menu.
52
54
  - **Keyboard shortcuts.** Press **?** for the list. `j`/`k` move through the agents, `Enter` opens the terminal, `r` reviews changes, `s` resumes, `Shift+X` closes the session, `e` edits; `n` new agents, `a` Ask Agent, `/` filter, `w` Watch, `m` Map, `p` the standup, `i` the Jira summary, `d` Designs, `1`-`5` the side tabs. Single keys work when you're not typing in a field or a terminal. From inside a terminal, `Ctrl+Shift+↓`/`↑` switch to the next or previous agent's terminal and `Ctrl+Shift+L` leaves it.
53
55
  - **Landing.** A **Land** tab with every agent's open pull request: ready to merge, needs fixes, behind, waiting. Failing checks and requested changes go back to the agent automatically (a few times at most), and so does every new review comment while the PR is open; **Update**, **Ask to fix** and **Merge** in one click.
54
56
  - **Triggers.** A label on a GitHub issue starts an agent for it, `/agent …` comments on an agent's pull request reach the agent, and a webhook starts agents from Jira automation or CI. No model watches, so no tokens are spent waiting.
@@ -197,6 +199,8 @@ agentmgr explain <agent> # full briefing: ask, status, plan
197
199
  agentmgr remote on | off | status | rotate # phone / remote access (see below)
198
200
  agentmgr backlog add "ask" -r <repo> [-p 1] # queue work; also: ls, start, accept, reopen, move, limit, pause
199
201
  agentmgr notify slack --webhook <url> # Slack alerts; also: test, status, on, off, event <name> on|off
202
+ agentmgr announce <agent> # what to tell the people who asked: a Slack message, an email and the details (--post, --link <url>; no agent: the settings)
203
+ agentmgr notify phone # the same alerts as notifications on the phone (ntfy app); --off stops them
200
204
  agentmgr debug <agent> "what goes wrong" # debug with an agent; no question prints its report; --fix applies the fixes
201
205
  agentmgr reverse <agent> -t /path/to/app "how does search work" # reverse engineer with an agent and REA; no question prints the report; --build builds your own
202
206
  agentmgr dates <project> --cc 2026-12-01 --rc 2026-12-10 --ga 2026-12-20 # commitment dates; no dates: where each stands
@@ -207,6 +211,7 @@ agentmgr skills # Claude Code's skills here (look
207
211
  agentmgr lanes # every agent's own ports and name ending (--off, --port off, --base, --size)
208
212
  agentmgr rounds [agent] # review rounds before a pull request: the settings, or an agent's rounds (--start, --again, --open, --stop)
209
213
  agentmgr screen # this computer's screen in the page, from the phone too: on or off (--on, --off), who is viewing
214
+ agentmgr awake [off|working|always] # keep this computer from going to sleep by itself: always, or while an agent works
210
215
  agentmgr models # models served on this computer (Ollama, LM Studio, llama.cpp, MLX), for --engine local
211
216
  agentmgr usage # each engine's plan limits: used, left, resets (--now, --lean on, --warn 80, --hold 95, --default codex)
212
217
  agentmgr runbook --ticket REL-42 # a support runbook from a release ticket (or --epic KEY, or --since 2026-10-01 -p <project>; -o file.md)
@@ -407,6 +412,24 @@ Type your answers in the viewer, or tap an option to fill one in. **Send my answ
407
412
 
408
413
  **Behaviour.** Documents are kept per agent and marked out of date when the brief changes. They come from the same separate, tool-less Claude call as Explain, so the agent isn't interrupted. On the phone link, the print page needs sign-in like everything else.
409
414
 
415
+ ## Updates for the people who asked
416
+
417
+ The people who asked for the work rarely watch it. **Update** (with the documents in the Brief panel, or `agentmgr announce <agent>`) writes what to tell them, from the agent's live context:
418
+
419
+ - **Slack:** at most five short lines: what it is about and where it stands, what was done, what is left or needed from the reader.
420
+ - **Email:** a subject and a short body saying the same, addressed to whoever asked when the work says who that is.
421
+ - **Details:** the full write-up both point to: what was asked, what was done, the status, what is left, decisions and risks, and the links. It is a document like the others: **Copy Markdown**, **Print / PDF**, **Listen**.
422
+
423
+ **They are drafts.** You read them and change them in place, then:
424
+
425
+ - **Copy** either one, or **Post to Slack**, which asks once more before it posts, since a channel is full of people. It posts to a webhook for updates (`agentmgr announce --webhook <url>`, set on the computer itself) or, without one, to where the Slack alerts go.
426
+ - **Open in mail** opens the email in the mail program of the device in your hand, filled in, for you to send from your own address.
427
+ - **Link to the details:** paste where they can be read (a Google Doc, Confluence, the pull request), or **Publish to Google Drive** makes a Google Doc of them through the Drive connector of your Claude account. The link goes under both messages as `Details: …`.
428
+
429
+ Nothing is sent to anyone by itself, and the messages never mention the agent: they are written as from the person responsible for the work.
430
+
431
+ **Written by themselves.** When an agent finishes (its brief says done) or opens a pull request, the update is written in the background, an **Update to send** card appears in the inbox, and the alert says so (the *update ready* alert). **Read and send** opens it; **Not needed** sets it aside. Only what happens while AI Agent Manager runs counts: agents already finished when it starts are not announced. Each one is a separate, tool-less model call on the agent's engine, like the other documents. `agentmgr announce --auto off` (or `"announce": { "auto": false }` in config.json) turns that off; **Update** on an agent still writes one when you ask.
432
+
410
433
  ## Plan review
411
434
 
412
435
  Tick **Review the implementation plan first** in New agent (or the backlog), or press **Review its plan first** on a running agent. The agent investigates, writes `PLAN.md` (goal, approach, steps, files, tests, risks) next to its brief, and stops. It doesn't edit, commit or run anything that changes the repo until you approve.
@@ -676,6 +699,8 @@ The **Inbox** tab (and `agentmgr inbox`) lists what needs you, across all agents
676
699
  | Follow up | An agent used in the last 3 days has been quiet for 2 hours and isn't finished: still open, or its session ended by itself or was closed by the session cap or clean up | Send the suggested nudge (edit it first), **Resume** a closed one, or **Close session**; **Later** (4 hours) or **Not needed** (until it's used again) |
677
700
  | Close session? | It's done (its brief says so, or its pull request merged), quiet for 2 hours, and its session is still open | **Close session** (it resumes when you open it), **Later** or **Not needed** |
678
701
 
702
+ **One at a time.** On a phone the inbox opens as one card filling the screen, with its buttons under your thumb; answered, the next takes its place. Swipe left for the next card and right for the one before, or use **‹ ›**. **Show all** brings the list back and **One at a time** turns it on anywhere; the choice is kept in that browser.
703
+
679
704
  Follow-up reminders skip agents that are working or already waiting on you for something else, and agents you closed yourself. Change the timing in config.json: `"reminders": { "quietHours": 2, "recentDays": 3, "laterHours": 4 }`, or turn them off with `"enabled": false`. From the command line: `agentmgr remind <agent> later|dismiss`.
680
705
 
681
706
  **Limits.** When an engine stops at a usage limit ("5-hour limit reached ∙ resets 3pm", Codex's "You've hit your usage limit… try again at 3:05 PM", an exhausted quota) or a busy or failing service (429, 529 overloaded, 5xx), the agent shows **Limit** in the inbox with the message and when it resets. It is told to continue by itself a minute after the reset (a busy service: after 5 minutes), at most three times an hour; `"limits": { "autoResume": false }` in config.json turns that off. **Continue now** does it at once, and **Continue on Codex** (or any other installed engine; `agentmgr continue-on <agent> <engine>`) carries the work on: a new agent in the same folder and branch, started with the request, the brief and the end of the conversation (a conversation can't move between engines). The new agent owns the folder from then on; the old one is closed, and deleting it leaves the folder.
@@ -802,7 +827,25 @@ One test run can pass or fail by chance, so the app's own test runs can be repea
802
827
 
803
828
  Repeating costs test time, not AI usage.
804
829
 
805
- ## Slack alerts
830
+ ## Alerts: Slack and the phone
831
+
832
+ Alerts go to Slack, to the phone as notifications, or to both.
833
+
834
+ **On the phone**, through [ntfy](https://ntfy.sh), an open-source notification service with an app for iPhone and Android:
835
+
836
+ ```sh
837
+ agentmgr notify phone # makes a topic nobody can guess and prints it
838
+ ```
839
+
840
+ 1. Install the **ntfy** app on the phone.
841
+ 2. In it: **+ → Subscribe to topic**, and enter the topic that was printed.
842
+ 3. `agentmgr notify test` sends one to try it.
843
+
844
+ A notification's title is the agent, and a tap opens it (at your phone address when remote access is on). Prompts, questions, errors and blocked agents arrive as high priority. It needs no Slack and works on any network, since the phone does not have to reach this computer to be told.
845
+
846
+ - **What leaves this computer.** The alert's text goes through ntfy.sh, a public service, and whoever knows the topic can read what is sent to it, so keep the topic to yourself. Turn off **include the intent text** to send less. `agentmgr notify phone --server https://ntfy.example.com` uses a server of your own, with `--token` if it needs one.
847
+ - **Why not the browser's own notifications?** A phone only allows those from a site whose certificate it trusts, and remote access uses a self-signed one.
848
+ - `agentmgr notify phone --off` stops them.
806
849
 
807
850
  **Three ways to connect Slack:**
808
851
 
@@ -823,7 +866,7 @@ agentmgr notify slack --token xoxb-… --channel '#agents' # or a bot
823
866
  agentmgr notify test
824
867
  ```
825
868
 
826
- Or use **Alerts** in the header (on this computer only). Settings, including the webhook or token, are stored in `~/.agentmanager/notify.json` (mode 0600) and masked in the UI and API.
869
+ Or use **Alerts** in the header (on this computer only), which has the phone's topic too. Settings, including the webhook or token, are stored in `~/.agentmanager/notify.json` (mode 0600) and masked in the UI and API.
827
870
 
828
871
  | Alert | Default | When |
829
872
  | --- | --- | --- |
@@ -885,10 +928,16 @@ It does not capture the screen itself. The computer's own screen sharing does, a
885
928
  2. On the computer itself: **Screen → Turn on** (or `agentmgr screen --on`).
886
929
  3. From any signed-in device: **Screen → Connect**, and sign in with your Mac user name and password when the Mac asks. They go to the Mac's screen sharing and are not kept.
887
930
 
888
- On a phone, the bar has a **Type here** field for the keyboard, and **Esc**, **Tab** and **⏎**. **−** and **+** zoom in up to 400% (the button between them goes back to **Fit**); zoomed in, **Move** lets a drag move around the screen instead of clicking in it. The sign-in has **Show the password**, for a password typed on a phone. **Keys…** sends shortcuts and keys a phone's keyboard does not have: ⌘Space, ⌘Tab, copy, paste, undo, close, quit, force quit, the arrows and delete. With a keyboard, `Shift+S` opens Screen and `Shift+T` the Terminal on this computer.
931
+ On a phone, the bar has a **Type here** field for the keyboard, and **Esc**, **Tab** and **⏎**. **−** and **+** zoom in up to 400% (the button between them goes back to **Fit**); zoomed in, **Move** lets a drag move around the screen instead of clicking in it. **Pad** turns the screen into a trackpad, for targets a fingertip covers: drag anywhere to move a pointer (a slow finger moves it finely) and tap to click where it is. Two fingers scroll or, tapped, right-click; hold a finger still, then drag, to drag. Zoomed in, the screen follows the pointer. The sign-in has **Show the password**, for a password typed on a phone. **Keys…** sends shortcuts and keys a phone's keyboard does not have: ⌘Space, ⌘Tab, copy, paste, undo, close, quit, force quit, the arrows and delete. With a keyboard, `Shift+S` opens Screen and `Shift+T` the Terminal on this computer.
889
932
 
890
933
  A Mac with **Remote Management** on (instead of plain Screen Sharing) lets in only the users listed under **Sharing → Remote Management → ⓘ**, and refuses anyone else as if the password were wrong. The Screen dialog says so when this computer's user is not listed, with the command that adds it.
891
934
 
935
+ **Clip** is the computer's clipboard, as text. Type or paste into its box and **Send and paste** puts it on the computer's clipboard and pastes it where the cursor is there (a password, a link, a one-time code); **Send** only puts it there. **Fetch** brings back what was copied on the computer (**Keys… → copy** first) and, where the browser allows, puts it on this device's clipboard too. The daemon reads and sets the clipboard itself (`pbcopy` and `pbpaste` on a Mac; `wl-copy` or `xclip` on Linux), because a Mac's screen sharing shares it only with Apple's own viewer. It works only while screen access is on.
936
+
937
+ **Files** (in the Screen bar, the Terminal bar and the ☰ menu: **Files on this computer…**) shows this computer's folders, starting in Downloads. **Send files here…** puts files from the device in your hand (photos too, up to 250 MB each) into the folder shown, never over a file that is there: a second `photo.jpg` becomes `photo (2).jpg`. Tap a folder to open it and a file to fetch it to the device. It reaches what the terminal on this computer reaches, and is allowed wherever that is.
938
+
939
+ **Keep this computer awake**, in the Screen dialog before you connect (or `agentmgr awake always`): a sleeping computer shows nothing, runs no agents and cannot be reached from the phone. **Always** keeps it from going to sleep by itself for as long as AI Agent Manager runs; **While an agent works** only then, and for five minutes after. It uses `caffeinate` on a Mac and `systemd-inhibit` on Linux. The display may still sleep and lock, and closing a laptop's lid still puts it to sleep.
940
+
892
941
  - **Whoever uses it controls the whole computer,** not only the agents. So it is off until you turn it on, it can be turned on only on the computer itself (not from a signed-in device), and the computer's screen sharing still asks for its own sign-in every time.
893
942
  - **Who is looking:** while another device views the screen, the **Screen** button shows a dot, and its tooltip and `agentmgr screen` name the device and its address. **Turn off** ends every view at once.
894
943
  - **Only this computer.** The relay connects to `127.0.0.1` and nothing else; `agentmgr screen --port <n>` picks another port there.
@@ -28,7 +28,10 @@ No build step: Node ES modules on the server, plain ES modules in the browser. S
28
28
  | `src/judge.js` | The AI judge: one-shot, tool-less model calls that decide *what is going on* (stuck, waiting, done, collisions, backlog order, alert triage), with a daily cap and feedback examples. Falls back to the rules. |
29
29
  | `src/backlog.js`, `src/races.js` | Work orders picked up per project; several agents on one intent, compared. |
30
30
  | `src/teams.js` | Agents in roles on one problem: handoff files with a verdict line move the team from analysis to review. |
31
- | `src/notify.js` | Slack alerts, triaged by the judge. |
31
+ | `src/notify.js` | Alerts to Slack and to the phone (ntfy), triaged by the judge. |
32
+ | `src/announce.js` | Updates for the people who asked: the prompt, the parts, and writing one when an agent finishes or opens a PR. |
33
+ | `src/awake.js` | Keeps the computer from sleeping, always or while an agent works. |
34
+ | `src/files.js` | This computer's folders for a signed-in device: list, send a file, fetch one. |
32
35
  | `src/preview.js`, `src/livebrowser.js` | Browser tabs: HTTPS relays for remote devices, and a headless Chrome streamed over the Chrome DevTools Protocol (frames, input, sound). |
33
36
  | `src/sessions.js` | Finds Claude Code sessions started in a terminal so they can be continued as agents. |
34
37
  | `src/remote.js` | Remote access: certificate, token, device sessions. |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agentmanager",
3
- "version": "1.57.3",
3
+ "version": "1.59.0",
4
4
  "description": "Run background coding agents (Claude Code, Codex) per intent, and keep track of them from a web UI, your phone or the CLI",
5
5
  "keywords": [
6
6
  "claude",
@@ -0,0 +1,134 @@
1
+ // Update: what to tell the people who asked, in the document dialog. A Slack message and an email,
2
+ // both short and yours to change, and the details they point to (src/announce.js writes them).
3
+ // Nothing is sent from here until you press the button that sends it.
4
+
5
+ const withLink = (text, link) => (link ? `${text.trim()}\n\nDetails: ${link}` : text.trim());
6
+ /** A link that opens the device's mail program with the message filled in: addresses split on commas, spaces or semicolons. */
7
+ export function mailtoFor(to, subject, body) {
8
+ const list = String(to ?? '').split(/[,;\s]+/).filter(Boolean).map((addr) => encodeURIComponent(addr).replace(/%40/g, '@'));
9
+ return `mailto:${list.join(',')}?subject=${encodeURIComponent(subject ?? '')}&body=${encodeURIComponent(body ?? '')}`;
10
+ }
11
+ const sentSome = (u) => Boolean(u?.sent?.slack || u?.sent?.email);
12
+
13
+ /** Whether an update written by itself still waits to be sent (the inbox card). */
14
+ export const updateWaits = (a) => Boolean(a.announce?.auto && a.docs?.update?.markdown && !a.docs.update.pending && !a.announce.dismissedAt && !sentSome(a.announce));
15
+
16
+ export function updateHtml(a, d, { esc, docHtml }) {
17
+ const p = d.parts ?? {};
18
+ const to = a.announce?.to ?? (/@/.test(p.to ?? '') ? p.to : '');
19
+ return `<div class="upd" data-upd="${esc(a.id)}">
20
+ <p class="hint">Drafts, written from the work as it stands (${esc(d.stage ?? 'in progress')}). Change them as you like: nothing goes to anyone until you send it.</p>
21
+ <section class="ha-card upd-card">
22
+ <h3>Slack</h3>
23
+ <textarea data-upd-text="slack" rows="6" aria-label="The Slack message">${esc(p.slack ?? '')}</textarea>
24
+ <p class="hint" data-upd-note="slack"></p>
25
+ <div class="need-actions"><button type="button" class="small primary" data-upd-act="copy-slack">Copy</button><button type="button" class="small" data-upd-act="post-slack">Post to Slack</button></div>
26
+ </section>
27
+ <section class="ha-card upd-card">
28
+ <h3>Email</h3>
29
+ <label>To <input data-upd-text="to" type="text" inputmode="email" autocapitalize="none" autocorrect="off" spellcheck="false" placeholder="${esc(p.to && !to ? `${p.to}'s address` : 'name@example.com, another@example.com')}" value="${esc(to)}" /></label>
30
+ <label>Subject <input data-upd-text="subject" type="text" value="${esc(p.subject ?? '')}" /></label>
31
+ <textarea data-upd-text="email" rows="9" aria-label="The email">${esc(p.email ?? '')}</textarea>
32
+ <p class="hint" data-upd-note="email"></p>
33
+ <div class="need-actions"><button type="button" class="small primary" data-upd-act="mail" title="Open it in this device's mail program, ready to send">Open in mail</button><button type="button" class="small" data-upd-act="copy-email">Copy</button></div>
34
+ </section>
35
+ <section class="ha-card upd-card">
36
+ <h3>Details</h3>
37
+ <label>Link to the details <input data-upd-text="link" type="url" placeholder="https://… where they can read what is below" value="${esc(a.announce?.link ?? '')}" /></label>
38
+ <p class="hint" data-upd-note="link"></p>
39
+ <div class="need-actions"><button type="button" class="small" data-upd-act="publish" title="Put the details below in a Google Doc, through the Google Drive connector of your Claude account; its link then goes under both messages">Publish to Google Drive</button><button type="button" class="small ghost" data-upd-act="dismiss" title="This update is not needed: take it out of the inbox">Not needed</button></div>
40
+ <div class="md upd-details">${docHtml(d.markdown)}</div>
41
+ </section>
42
+ </div>`;
43
+ }
44
+
45
+ export function initUpdateView({ body, api, toast, ago, agentOf, upsert }) {
46
+ let slack; // where Post to Slack goes: undefined until asked, null when nowhere
47
+ const root = () => body.querySelector('[data-upd]');
48
+ const field = (k) => root()?.querySelector(`[data-upd-text="${k}"]`);
49
+ const note = (k, text) => {
50
+ const el = root()?.querySelector(`[data-upd-note="${k}"]`);
51
+ if (el && el.textContent !== text) el.textContent = text;
52
+ };
53
+
54
+ /** What changes around the drafts without touching what you typed: sent, the link, publishing. */
55
+ function refresh(a) {
56
+ if (!root() || !a) return;
57
+ const u = a.announce ?? {};
58
+ const link = u.link ? 'The link to the details goes under it.' : 'No link to the details yet: it goes without one.';
59
+ note('slack', `${u.sent?.slack ? `Posted ${ago(u.sent.slack)}. ` : ''}${link}`);
60
+ note('email', `${u.sent?.email ? `Opened in mail ${ago(u.sent.email)}. ` : ''}${link}`);
61
+ note('link', u.publishing ? 'Publishing to Google Drive… this takes a minute or two.' : u.publishError ? `Not published: ${u.publishError}` : u.link ? (u.published ? `A Google Doc, published ${ago(u.published.at)}. Publish again for a new one after changes.` : '') : 'Paste a link (a Google Doc, Confluence, the pull request), or publish the details below as a Google Doc.');
62
+ const linkField = field('link');
63
+ if (linkField && document.activeElement !== linkField && linkField.value !== (u.link ?? '')) linkField.value = u.link ?? '';
64
+ const post = root().querySelector('[data-upd-act="post-slack"]');
65
+ if (!post.dataset.sure) {
66
+ post.disabled = slack === null;
67
+ post.textContent = slack ? `Post to ${slack}` : 'Post to Slack';
68
+ post.title = slack === null ? 'Slack is not set up: agentmgr announce --webhook <url> on the computer, or set up Slack alerts' : 'Post the message above, as it reads now';
69
+ }
70
+ root().querySelector('[data-upd-act="publish"]').disabled = Boolean(u.publishing);
71
+ root().querySelector('[data-upd-act="dismiss"]').hidden = !updateWaits(a);
72
+ if (slack === undefined) {
73
+ slack = null;
74
+ api('GET', '/announce/settings').then((s) => {
75
+ slack = s.slack ?? null;
76
+ refresh(agentOf(root()?.dataset.upd));
77
+ }).catch(() => {});
78
+ }
79
+ }
80
+
81
+ const copy = (text, what) => navigator.clipboard.writeText(text).then(() => toast(`${what} copied`), () => toast('Copy failed: your browser blocked clipboard access'));
82
+ const save = (id, patch) => api('PUT', `/agents/${id}/announce`, patch).then(upsert);
83
+
84
+ body.addEventListener('change', (e) => {
85
+ const id = root()?.dataset.upd;
86
+ const k = e.target.dataset?.updText;
87
+ if (!id || !['link', 'to'].includes(k)) return;
88
+ save(id, { [k]: e.target.value }).catch((err) => toast(`Error: ${err.message}`, 6000));
89
+ });
90
+
91
+ body.addEventListener('click', async (e) => {
92
+ const b = e.target.closest('[data-upd-act]');
93
+ const id = root()?.dataset.upd;
94
+ if (!b || !id) return;
95
+ const link = agentOf(id)?.announce?.link ?? null;
96
+ const what = b.dataset.updAct;
97
+ try {
98
+ if (what === 'copy-slack') return await copy(withLink(field('slack').value, link), 'The Slack message');
99
+ if (what === 'copy-email') return await copy(`Subject: ${field('subject').value}\n\n${withLink(field('email').value, link)}`, 'The email');
100
+ if (what === 'mail') {
101
+ // The device's own mail program sends it, from your address: this page only fills it in.
102
+ location.href = mailtoFor(field('to').value, field('subject').value, withLink(field('email').value, link));
103
+ return await save(id, { sent: 'email', to: field('to').value });
104
+ }
105
+ if (what === 'post-slack') {
106
+ // A channel full of people: asked twice, so a slip of the thumb posts nothing.
107
+ if (!b.dataset.sure) {
108
+ b.dataset.sure = '1';
109
+ b.textContent = `Post it to ${slack}?`;
110
+ b.classList.add('primary');
111
+ return setTimeout(() => {
112
+ delete b.dataset.sure;
113
+ b.classList.remove('primary');
114
+ refresh(agentOf(id));
115
+ }, 5000);
116
+ }
117
+ delete b.dataset.sure;
118
+ b.classList.remove('primary');
119
+ const r = await api('POST', `/agents/${id}/announce/slack`, { text: field('slack').value });
120
+ upsert(r);
121
+ return toast(`Posted to ${r.postedTo}`);
122
+ }
123
+ if (what === 'publish') return upsert(await api('POST', `/agents/${id}/announce/publish`));
124
+ if (what === 'dismiss') {
125
+ await save(id, { dismissed: true });
126
+ return toast('Taken out of the inbox');
127
+ }
128
+ } catch (err) {
129
+ toast(`Error: ${err.message}`, 6000);
130
+ }
131
+ });
132
+
133
+ return { refresh };
134
+ }
package/public/app.js CHANGED
@@ -50,6 +50,9 @@ import { initBoard } from '/board.js';
50
50
  import { initMcp } from '/mcp.js';
51
51
  import { initCodeMap } from '/codemap.js';
52
52
  import { initKeys } from '/keys.js';
53
+ import { initPalette } from '/palette.js';
54
+ import { initFiles } from '/files.js';
55
+ import { initUpdateView, updateHtml, updateWaits } from '/announce.js';
53
56
  import { morph } from '/morph.js';
54
57
 
55
58
  const $ = (sel) => document.querySelector(sel);
@@ -371,6 +374,18 @@ const mcpUi = initMcp({ api, $, esc, ago, md: (t) => md(t), toast: (m, ms) => to
371
374
  $('#mcp-btn').onclick = () => mcpUi.open(selectedId && agents.get(selectedId)?.workdir ? selectedId : null);
372
375
  // Keyboard shortcuts (keys.js): the same actions as the buttons.
373
376
  const keysUi = initKeys({ $, esc, run: (act) => shortcut(act) });
377
+ // Files on this computer: send one from this device, fetch one to it (files.js).
378
+ initFiles({ api, esc, toast, ago, $ });
379
+ // Go to (Ctrl+K): the agents that wait for you first.
380
+ initPalette({
381
+ $,
382
+ esc,
383
+ select: (id) => (showTab('agents'), select(id)),
384
+ agents: () =>
385
+ [...agents.values()]
386
+ .map((a) => ({ id: a.id, label: a.name, state: statusOf(a), hint: [statusOf(a), a.projectInfo?.name, a.intent?.replace(/\s+/g, ' ').slice(0, 120)].filter(Boolean).join(' · ') }))
387
+ .sort((a, b) => (b.state === 'attention') - (a.state === 'attention')),
388
+ });
374
389
  $('#keys-btn').onclick = () => keysUi.help();
375
390
 
376
391
  /** The agents in the list as shown (collapsed projects left out), top to bottom. */
@@ -615,16 +630,17 @@ const INSIGHT_ICONS = { why: '🎯', what: '📦', how: '🛠', now: '📍' };
615
630
 
616
631
  // ------------------------------------------------------------------ stakeholder documents
617
632
 
618
- const DOCS = { analysis: 'Analysis', design: 'Design', flow: 'Flow', proposal: 'Proposal', humanai: 'Human vs AI', estimate: 'Estimate', documentation: 'Documentation', diagrams: 'Diagrams', scorecard: 'Scorecard' };
633
+ const DOCS = { analysis: 'Analysis', design: 'Design', flow: 'Flow', proposal: 'Proposal', humanai: 'Human vs AI', estimate: 'Estimate', documentation: 'Documentation', diagrams: 'Diagrams', scorecard: 'Scorecard', update: 'Update' };
619
634
  // What a document is before it's written, where "Write a … document for stakeholders" doesn't say it.
620
635
  const DOC_HINTS = {
636
+ update: 'What to tell the people who asked: a short Slack message and a short email for you to send, and the details they point to. Written by itself when the agent finishes or opens a pull request',
621
637
  estimate: 'For planning: how long a person would take to do this work by hand, split into tasks with optimistic, likely and pessimistic hours, a suggested split into tickets, the roles needed and the risks',
622
638
  documentation: 'The documentation for this change: what is new, how to use it, configuration, upgrade notes, which docs to add or update, and an OpenAPI spec of any API changes',
623
639
  };
624
640
  /** The OpenAPI spec in a Documentation document (its ```yaml block), if the change has API changes. */
625
641
  const openApiOf = (markdown) => (markdown ?? '').match(/```ya?ml\s*\n((?:#.*\n|\s*\n)*openapi:[\s\S]*?)```/)?.[1] ?? null;
626
642
  // Optional extras that "Write all" leaves out.
627
- const DOC_EXTRAS = new Set(['diagrams', 'scorecard']);
643
+ const DOC_EXTRAS = new Set(['diagrams', 'scorecard', 'update']);
628
644
  const DOC_TITLES = { ...DOCS, estimate: 'Human time estimate', eval: 'Eval', plan: 'Plan', intent: 'Intent', spec: 'Spec', designdoc: 'Design doc', benchmark: 'Benchmark' };
629
645
  // The agent's intent, spec and plan files (read from the daemon when opened; kept here by agent and kind).
630
646
  const SPEC_KINDS = { intent: 'Intent', spec: 'Spec', plan: 'Plan', designdoc: 'Design doc', benchmark: 'Benchmark' };
@@ -770,10 +786,11 @@ function renderDocDialog() {
770
786
  // The scorecard's Improve button follows the agent being improved.
771
787
  const version = docView.kind === 'scorecard' ? `${d.at}:${Boolean(a.improving)}` : d.at;
772
788
  if (body.dataset.rendered !== version) {
773
- body.innerHTML = docView.kind === 'scorecard' ? scorecardHtml(d, esc, { actions: improveHtml(a) }) : d.data ? humanAiHtml(d) : docHtml(d.markdown);
789
+ body.innerHTML = docView.kind === 'scorecard' ? scorecardHtml(d, esc, { actions: improveHtml(a) }) : docView.kind === 'update' ? updateHtml(a, d, { esc, docHtml }) : d.data ? humanAiHtml(d) : docHtml(d.markdown);
774
790
  body.dataset.rendered = version;
775
791
  renderDiagrams(body);
776
792
  }
793
+ if (docView.kind === 'update') announceUi.refresh(a);
777
794
  }
778
795
  const stale = !plan && d?.markdown && a.brief?.updatedAt && d.briefUpdatedAt !== a.brief.updatedAt;
779
796
  const by = d?.writer ? ` by ${d.writer}${d.critique ? `, checked by ${d.critique.label}` : ''}${d.from ? ` from ${d.from.length ? d.from.join(', ') : "the agent's work"}` : ''}` : '';
@@ -861,6 +878,9 @@ $('#doc-body').addEventListener('submit', (e) => {
861
878
  });
862
879
  });
863
880
 
881
+ // The Update document's own buttons: copy, open in mail, post to Slack, the link to its details.
882
+ const announceUi = initUpdateView({ body: $('#doc-body'), api, toast, ago, agentOf: (id) => agents.get(id), upsert: (a) => upsert(a) });
883
+
864
884
  function generateDoc() {
865
885
  const { agentId, kind } = docView;
866
886
  act(async () => upsert(await api('POST', `/agents/${agentId}/docs/${kind}`)));
@@ -1529,7 +1549,7 @@ function loadLimitEngines() {
1529
1549
  })
1530
1550
  .catch(() => (limitEngines = null));
1531
1551
  }
1532
- const NEED_ORDER = { approval: 0, prompt: 0, limit: 1, waiting: 1, plan: 1, question: 1, team: 1, rule: 2, review: 2, prereview: 2, autopilot: 2, stuck: 3, conflict: 4, reminder: 5, close: 5, repeat: 5 };
1552
+ const NEED_ORDER = { approval: 0, prompt: 0, limit: 1, waiting: 1, plan: 1, question: 1, team: 1, rule: 2, review: 2, prereview: 2, autopilot: 2, stuck: 3, conflict: 4, reminder: 5, close: 5, repeat: 5, update: 4 };
1533
1553
  /** What an agent needs from the user. `both`: overlaps on both agents (detail), else only the one that should rebase (inbox). */
1534
1554
  function needsFor(a, { both = false } = {}) {
1535
1555
  const items = [];
@@ -1541,6 +1561,7 @@ function needsFor(a, { both = false } = {}) {
1541
1561
  if (['stalled', 'error'].includes(a.preReview?.status)) items.push({ a, kind: 'prereview', key: `prereview:${a.id}` });
1542
1562
  for (const q of a.questions ?? []) if (!q.answer) items.push({ a, kind: 'question', key: `q:${a.id}:${q.id}`, q });
1543
1563
  for (const f of a.stuck ?? []) items.push({ a, kind: 'stuck', key: `stuck:${a.id}:${f.key}`, f });
1564
+ if (updateWaits(a)) items.push({ a, kind: 'update', key: `update:${a.id}` });
1544
1565
  if (a.followUp) items.push({ a, kind: a.followUp.kind === 'close' ? 'close' : 'reminder', key: `reminder:${a.id}`, r: a.followUp });
1545
1566
  for (const g of a.conflicts ?? []) if (both || g.mergeFirst !== a.id) items.push({ a, kind: 'conflict', key: `conflict:${a.id}:${g.agent.id}`, g });
1546
1567
  return items;
@@ -1577,7 +1598,7 @@ function inboxItems() {
1577
1598
  .sort((x, y) => NEED_ORDER[x.kind] - NEED_ORDER[y.kind] || (x.a.priority ?? 2) - (y.a.priority ?? 2));
1578
1599
  }
1579
1600
 
1580
- const NEED_LABEL = { limit: 'Limit', reminder: 'Follow up', close: 'Close session?', repeat: 'Make it a playbook?', autopilot: 'Autopilot held', rule: 'Always allow?', approval: 'Approval', team: 'Team', prompt: 'Needs input', waiting: 'Waiting on you', plan: 'Plan review', question: 'Question', review: 'AI review', prereview: 'Not approved', stuck: 'Stuck?', conflict: 'Overlap' };
1601
+ const NEED_LABEL = { update: 'Update to send', limit: 'Limit', reminder: 'Follow up', close: 'Close session?', repeat: 'Make it a playbook?', autopilot: 'Autopilot held', rule: 'Always allow?', approval: 'Approval', team: 'Team', prompt: 'Needs input', waiting: 'Waiting on you', plan: 'Plan review', question: 'Question', review: 'AI review', prereview: 'Not approved', stuck: 'Stuck?', conflict: 'Overlap' };
1581
1602
  /** Why the AI judge thinks so, as a small tag. */
1582
1603
  const aiTag = (confidence, what = 'AI') => `<span class="tag ai" title="Judged by a model from the agent's activity; your reactions tune later calls">🤖 ${what}${confidence != null ? ` ${Math.round(confidence * 100)}%` : ''}</span>`;
1583
1604
  /** What a permission prompt asks about: the command, file or tool. */
@@ -1720,6 +1741,12 @@ function needCard(it, { inDetail = false } = {}) {
1720
1741
  <textarea rows="2" data-draft="${esc(it.key)}:text">${draft('text', FOLLOW_UP)}</textarea>
1721
1742
  <div class="need-actions"><button class="small primary">Send</button><button type="button" class="small ghost" data-ib="terminal">Open terminal</button><button type="button" class="small ghost" data-ib="remind-close">Close session</button>${later}</div>
1722
1743
  </form>`}`;
1744
+ } else if (it.kind === 'update') {
1745
+ const d = a.docs.update;
1746
+ const why = a.announce.auto.milestone === 'done' ? 'It is finished' : 'It opened a pull request';
1747
+ body = `<p class="need-title">${esc(d.parts?.subject || 'An update for the people who asked')}</p>
1748
+ <p class="hint">${why}: what to tell the people who asked is written (${ago(d.at)}), a Slack message and an email. Nothing is sent until you send it.</p>
1749
+ <div class="need-actions"><button class="small primary" data-ib="update-open">Read and send</button><button class="small ghost" data-ib="update-dismiss" title="This one is not needed">Not needed</button></div>`;
1723
1750
  } else if (it.kind === 'stuck') {
1724
1751
  const f = it.f;
1725
1752
  const judged = f.ai?.verdict === 'stuck' ? aiTag(f.ai.confidence, 'confirmed') : f.ai?.verdict === 'checking' ? '<span class="tag ai">🤖 checking…</span>' : '';
@@ -1792,6 +1819,24 @@ function inboxSwitches() {
1792
1819
  return `<div class="inbox-switches hint">${rounds}${judge}<button class="link" data-inbox-settings title="Rounds, critics and the pull request: in Settings">Settings…</button></div>`;
1793
1820
  }
1794
1821
 
1822
+ // One at a time: on a phone the inbox is a long scroll of cards. Shown one by one instead, each
1823
+ // fills the screen with its buttons under the thumb; answered, the next takes its place. A swipe
1824
+ // (or ‹ ›) steps through them. The choice is kept in this browser; a narrow screen starts with it.
1825
+ let inboxOne = (() => {
1826
+ try {
1827
+ const kept = localStorage.getItem('agentmgr.inboxOne');
1828
+ return kept === null ? matchMedia('(max-width: 800px)').matches : kept === '1';
1829
+ } catch {
1830
+ return false;
1831
+ }
1832
+ })();
1833
+ let inboxAt = { key: null, i: 0 }; // the card shown: by its key, or where it was once it is gone
1834
+
1835
+ function inboxStep(step, count) {
1836
+ inboxAt = { key: null, i: (inboxAt.i + step + count) % Math.max(1, count) };
1837
+ renderInbox();
1838
+ }
1839
+
1795
1840
  function renderInbox() {
1796
1841
  const items = inboxItems();
1797
1842
  const urgent = items.filter((i) => i.kind === 'approval' || i.kind === 'prompt' || i.kind === 'question' || i.kind === 'waiting').length;
@@ -1800,11 +1845,16 @@ function renderInbox() {
1800
1845
  if (sideTab !== 'inbox') return;
1801
1846
  const view = $('#inbox-view');
1802
1847
  if (view.contains(document.activeElement) && document.activeElement.dataset.draft) return; // don't yank the field being typed in
1848
+ const cards = [...promptGroups(items).map((g) => [`group:${g.map((it) => it.a.id).join(',')}`, groupCard(g)]), ...items.map((it) => [it.key, needCard(it)])];
1849
+ const found = cards.findIndex(([key]) => key === inboxAt.key);
1850
+ const now = Math.max(0, found >= 0 ? found : Math.min(inboxAt.i, cards.length - 1));
1851
+ inboxAt = { key: cards[now]?.[0] ?? null, i: now };
1852
+ const steps = inboxOne && cards.length > 1 ? `<span class="inbox-step"><button class="small ghost" data-inbox-step="-1" aria-label="The one before">‹</button><span>${now + 1} of ${cards.length}</span><button class="small ghost" data-inbox-step="1" aria-label="The next one">›</button></span>` : '';
1803
1853
  morph(
1804
1854
  view,
1805
1855
  inboxSwitches() +
1806
1856
  (items.length
1807
- ? `<div class="counts"><span>${items.length} waiting on you</span></div><div class="needs inbox">${promptGroups(items).map(groupCard).join('')}${items.map((it) => needCard(it)).join('')}</div>`
1857
+ ? `<div class="counts inbox-counts" data-inbox-cards="${cards.length}"><span>${items.length} waiting on you</span><span class="spacer"></span>${steps}<button class="link" data-inbox-one title="${inboxOne ? 'The whole list again' : 'One card at a time, the next when it is answered; swipe to step through them'}">${inboxOne ? 'Show all' : 'One at a time'}</button></div><div class="needs inbox${inboxOne ? ' one' : ''}">${cards.map(([, html], n) => (inboxOne && n === now ? html.replace('class="need ', 'class="need now ') : html)).join('')}</div>`
1808
1858
  : `<div class="empty"><p>Nothing needs you right now.</p><p>Prompts waiting for an answer, questions agents ask, agents that seem stuck and agents editing the same files show up here.</p></div>`),
1809
1859
  );
1810
1860
  }
@@ -1813,6 +1863,16 @@ async function onNeed(e) {
1813
1863
  // A recommendation's own buttons (Decide draws them on plan and question cards).
1814
1864
  if (decideUi?.handle(e)) return e.preventDefault();
1815
1865
  if (e.target.closest('[data-inbox-settings]')) return $('#settings-btn').click();
1866
+ if (e.target.closest('[data-inbox-one]')) {
1867
+ inboxOne = !inboxOne;
1868
+ inboxAt = { key: null, i: 0 }; // from the first, the most pressing
1869
+ try {
1870
+ localStorage.setItem('agentmgr.inboxOne', inboxOne ? '1' : '0');
1871
+ } catch {}
1872
+ return renderInbox();
1873
+ }
1874
+ const stepBtn = e.target.closest('[data-inbox-step]');
1875
+ if (stepBtn) return inboxStep(Number(stepBtn.dataset.inboxStep), Number(stepBtn.closest('[data-inbox-cards]').dataset.inboxCards));
1816
1876
  const judge = e.target.closest('[data-judge]');
1817
1877
  if (judge) {
1818
1878
  e.preventDefault();
@@ -1918,6 +1978,10 @@ async function onNeed(e) {
1918
1978
  return act(async () => upsert(await api('POST', `/agents/${id}/stop`)), 'Session closed; resume it any time');
1919
1979
  case 'remind-resume':
1920
1980
  return act(async () => upsert(await api('POST', `/agents/${id}/start`, {})), 'Resumed');
1981
+ case 'update-open':
1982
+ return openDoc(id, 'update');
1983
+ case 'update-dismiss':
1984
+ return act(async () => upsert(await api('PUT', `/agents/${id}/announce`, { dismissed: true })));
1921
1985
  case 'remind-later':
1922
1986
  return act(async () => upsert(await api('POST', `/agents/${id}/reminder`, { action: 'later' })), 'Reminding you later');
1923
1987
  case 'remind-dismiss':
@@ -1966,6 +2030,23 @@ async function onNeedSubmit(e) {
1966
2030
  }
1967
2031
  done();
1968
2032
  }
2033
+ // One at a time: a swipe to the left is the next card, to the right the one before.
2034
+ {
2035
+ let from = null;
2036
+ const inbox = $('#inbox-view');
2037
+ inbox.addEventListener('touchstart', (e) => {
2038
+ from = inboxOne && e.touches.length === 1 && !e.target.closest('input, textarea, select') ? { x: e.touches[0].clientX, y: e.touches[0].clientY } : null;
2039
+ }, { passive: true });
2040
+ inbox.addEventListener('touchend', (e) => {
2041
+ const was = from;
2042
+ from = null;
2043
+ const t = e.changedTouches[0];
2044
+ const count = Number(inbox.querySelector('[data-inbox-cards]')?.dataset.inboxCards ?? 0);
2045
+ if (!was || !t || count < 2) return;
2046
+ const dx = t.clientX - was.x;
2047
+ if (Math.abs(dx) > 70 && Math.abs(dx) > 2 * Math.abs(t.clientY - was.y)) inboxStep(dx < 0 ? 1 : -1, count);
2048
+ }, { passive: true });
2049
+ }
1969
2050
  for (const root of [$('#inbox-view'), $('#detail-body'), $('#needs-body')]) {
1970
2051
  root.addEventListener('click', onNeed);
1971
2052
  root.addEventListener('submit', onNeedSubmit);
@@ -5142,7 +5223,7 @@ $('#assistant-dialog').addEventListener('click', (e) => {
5142
5223
  loadAssistant({ fill: false }).catch(() => {});
5143
5224
  setInterval(() => loadAssistant({ fill: false }).catch(() => {}), 60_000);
5144
5225
 
5145
- // ------------------------------------------------------------------ Slack alerts (from this computer)
5226
+ // ------------------------------------------------------------------ Alerts: Slack and the phone (from this computer)
5146
5227
 
5147
5228
  async function loadAlerts() {
5148
5229
  const n = await api('GET', '/notify');
@@ -5152,15 +5233,16 @@ async function loadAlerts() {
5152
5233
  f.channel.value = n.slack.channel ?? '';
5153
5234
  f.webhookUrl.placeholder = n.slack.webhookUrl ?? 'https://hooks.slack.com/services/…';
5154
5235
  f.botToken.placeholder = n.slack.botToken ?? 'xoxb-…';
5236
+ f.phoneTopic.value = n.phone.topic ?? '';
5237
+ f.phoneServer.value = n.phone.server === 'https://ntfy.sh' ? '' : n.phone.server;
5155
5238
  for (const k of Object.keys(n.events)) if (f[`ev_${k}`]) f[`ev_${k}`].checked = n.events[k];
5156
5239
  f.needsInputDelaySec.value = n.needsInputDelaySec;
5157
5240
  f.waitingDelaySec.value = n.waitingDelaySec;
5158
5241
  f.skipWhenWatching.checked = n.skipWhenWatching;
5159
5242
  f.includeIntent.checked = n.includeIntent;
5160
5243
  f.enabled.checked = n.enabled;
5161
- $('#alerts-current').textContent = n.configured
5162
- ? `Configured: ${n.slack.channel ? `bot token → ${n.slack.channel}` : `webhook ${n.slack.webhookUrl}`}. Leave the fields empty to keep it.`
5163
- : 'Not configured yet.';
5244
+ const to = [n.slackConfigured ? `Slack (${n.slack.channel ? `bot token → ${n.slack.channel}` : `webhook ${n.slack.webhookUrl}`}; leave its fields empty to keep it)` : null, n.phone.topic ? 'the phone' : null].filter(Boolean);
5245
+ $('#alerts-current').textContent = to.length ? `Alerts go to ${to.join(' and ')}.` : 'Not configured yet.';
5164
5246
  $('#alerts-recent').innerHTML = n.recent.length
5165
5247
  ? `Recent: ${n.recent.slice(0, 5).map((r) => `${esc(r.kind)} · ${esc(r.agent)} · ${r.error ? `<span class="error">${esc(r.error)}</span>` : TRIAGED[r.urgency] ?? 'sent'} · ${ago(r.at)}`).join('<br>')}`
5166
5248
  : '';
@@ -5186,6 +5268,7 @@ $('#alerts-form').addEventListener('submit', async (e) => {
5186
5268
  includeIntent: f.includeIntent.checked,
5187
5269
  enabled: f.enabled.checked,
5188
5270
  channel: f.channel.value.trim() || undefined,
5271
+ phone: { topic: f.phoneTopic.value.trim() || null, server: f.phoneServer.value.trim() },
5189
5272
  };
5190
5273
  if (f.webhookUrl.value.trim()) body.webhookUrl = f.webhookUrl.value.trim();
5191
5274
  if (f.botToken.value.trim()) body.botToken = f.botToken.value.trim();
@@ -5198,10 +5281,14 @@ $('#alerts-form').addEventListener('submit', async (e) => {
5198
5281
  $('#alerts-error').hidden = false;
5199
5282
  }
5200
5283
  });
5284
+ $('#alerts-phone-new').onclick = () => {
5285
+ const bytes = crypto.getRandomValues(new Uint8Array(12));
5286
+ $('#alerts-form').phoneTopic.value = `agentmgr-${[...bytes].map((b) => b.toString(16).padStart(2, '0')).join('')}`;
5287
+ };
5201
5288
  $('#alerts-test').onclick = async () => {
5202
5289
  try {
5203
5290
  await api('POST', '/notify/test');
5204
- toast('Test message sent to Slack');
5291
+ toast('Test message sent');
5205
5292
  } catch (err) {
5206
5293
  $('#alerts-error').textContent = err.message;
5207
5294
  $('#alerts-error').hidden = false;