ai-agentmanager 1.44.0 → 1.47.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 +21 -0
- package/README.md +115 -0
- package/package.json +1 -1
- package/public/app.js +46 -1
- package/public/index.html +11 -1
- package/public/keys.js +4 -2
- package/public/news.js +167 -0
- package/public/plan.js +323 -0
- package/public/side.js +122 -2
- package/public/style.css +92 -0
- package/public/today.js +102 -2
- package/src/brief.js +68 -1
- package/src/calendar.js +385 -0
- package/src/cli.js +150 -0
- package/src/config.js +6 -0
- package/src/debt.js +276 -0
- package/src/decisions.js +188 -0
- package/src/engines/claude.js +7 -0
- package/src/manager.js +41 -4
- package/src/milestones.js +282 -0
- package/src/news.js +454 -0
- package/src/notify.js +1 -0
- package/src/server.js +118 -3
- package/src/today.js +3 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.47.0 (2026-11-13)
|
|
4
|
+
|
|
5
|
+
- **Plan.** **Plan** in the top bar (or `c`, `#plan`) has three tabs: Dates, Decisions and Debt. Its badge counts dates that are late or at risk.
|
|
6
|
+
- **Dates.** Give a project its code complete, RC and GA dates. Each has a checklist: the app counts agents still working, unfinished backlog, open or failing pull requests and critical or high bugs, and you tick the rest (scope agreed, release notes, docs). A date is on track, at risk (a week or less away with counted work open), late or reached. **Show** opens what is behind a count; **Have an agent do it** puts an item on the project's backlog. Reminders come 14, 7, 3 and 1 days ahead, on the day and once when a date passes, with what is still open; dates show in Today from two weeks out. `agentmgr dates [project] --cc --rc --ga`.
|
|
7
|
+
- **Decisions.** One log of what was decided and why: plans you approved or sent back with your notes, your answers to agents' questions, and the decisions in each agent's design doc. Entries stay after the agent is deleted. Add your own, filter by project or words, copy as Markdown. `agentmgr decisions [project] --md`.
|
|
8
|
+
- **Debt.** Files ranked by how often they changed in 90 days, how many of those changes were fixes and how tangled they are, from git history, scanned weekly. **Hand to an agent** queues a refactor task; **Not debt** sets a file aside. `agentmgr debt [project] --scan`. Turn it off with `"debt": { "enabled": false }`.
|
|
9
|
+
- **Your day.** Paste your calendar's private iCal address (Google or Outlook) in Today and it opens with your meetings, the free time between them with what needs you placed in it, and the agents or issues each meeting names. Read-only; the address stays on this computer and isn't shown again.
|
|
10
|
+
- No model calls are added by any of this.
|
|
11
|
+
|
|
12
|
+
## 1.46.0 (2026-11-13)
|
|
13
|
+
|
|
14
|
+
- **Debug.** **🐞 Debug** in an agent's detail (or the **Debug** tab of the split) puts the agent's session on the left and a debug pane on the right. Say what goes wrong (a failure, E2E instability at max scale, slowness under load) and the agent investigates in its own session: it reads the code and logs, reproduces and measures where it can, and changes no code yet.
|
|
15
|
+
- **The report.** Drawn beside the session as the agent writes it: animated diagrams of the code path and the data flow, with where it breaks outlined red and what is only suspected dashed amber; the order of events for timing and load problems; findings with evidence, marked confirmed or suspected; the likely causes; and recommended fixes with how to verify each.
|
|
16
|
+
- **Follow-ups and fixes.** **Ask** continues the investigation and brings the report up to date. **Apply fixes** has the agent make the fixes you name (or the ones it recommends), verify each and record the result before and after. From the terminal: `agentmgr debug <agent> "<what goes wrong>"`, and `--fix`.
|
|
17
|
+
|
|
18
|
+
## 1.45.0 (2026-11-13)
|
|
19
|
+
|
|
20
|
+
- **AI News.** **AI News** in the top bar (or `l`, `#news`, `agentmgr news`) lists what the frontier labs released in the last 30 days, newest first and grouped by day. Each entry has its lab, a summary of a sentence or two, a link to the release and the links from the note. Filter by lab or by words; what arrived since you last looked is marked *new* and counted on the button.
|
|
21
|
+
- **Where it comes from.** The release notes of the Claude Platform, Claude Code, the OpenAI API and the Gemini API, read every 6 hours, and a web search once a day for the other top labs (xAI, Meta, Mistral and the rest). **Refresh** and **Search top labs** look now. Add release notes of your own with `"news": { "custom": [...] }` in config.json.
|
|
22
|
+
- **Model calls, on your Claude plan.** One tool-less call per 25 new entries for the summaries (each entry once), and one Claude Code call a day for the web search, allowed only to search and read the web. What the search finds is as reliable as a web search: check the link. Turn either off with `"news": { "summaries": false, "search": false }`.
|
|
23
|
+
|
|
3
24
|
## 1.44.0 (2026-11-12)
|
|
4
25
|
|
|
5
26
|
- **Whose session is this?** Expanded, in full screen and on a phone, the terminal bar shows the agent's name on the left, on every tab (Claude, Code, Shell, Browser). It follows a rename, and its tooltip has the agent's task.
|
package/README.md
CHANGED
|
@@ -27,6 +27,10 @@ Run one background [Claude Code](https://claude.com/claude-code) agent per inten
|
|
|
27
27
|
- **Slack alerts.** A message in your channel when an agent needs input, finishes a backlog item, or fails.
|
|
28
28
|
- **Priority.** Mark agents P0–P3. P0 and P1 are highlighted, and lists sort by priority.
|
|
29
29
|
- **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
|
+
- **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.
|
|
31
|
+
- **Your day.** Connect your calendar and Today lays the day out around your meetings: the free time between them with what needs you placed in it, and what each meeting is about.
|
|
32
|
+
- **Debug.** Say what to debug (a failure, E2E instability at max scale, slowness under load) in the **Debug** tab beside an agent's session. The agent investigates there and writes a report next to it: animated diagrams of the code path and the data flow with where it breaks, findings with evidence, likely causes and recommended fixes. It changes no code until you press **Apply fixes**.
|
|
33
|
+
- **AI News.** The frontier labs' latest releases in one list, newest first: Claude Platform, Claude Code, the OpenAI API and the Gemini API from their release notes, and the other top labs from a daily web search. Each is summarized in a sentence or two, with its links.
|
|
30
34
|
- **MCP servers and tools.** See every MCP server Claude Code has in a folder (yours, the project's, claude.ai connectors and plugins) with its tools, sign in to the ones that need it, and run any tool directly, through Claude Code, or in an agent's session.
|
|
31
35
|
- **Human vs AI.** It splits the open questions about the work into the top 5 that need your judgment and the ones a model can answer from the evidence. It answers those, then a second model double-checks every answer.
|
|
32
36
|
- **Review changes.** Each agent's diff file by file, line comments sent back to the agent as one message, then **Commit all** and **Push & open PR**, without leaving the page.
|
|
@@ -181,6 +185,11 @@ agentmgr explain <agent> # full briefing: ask, status, plan
|
|
|
181
185
|
agentmgr remote on | off | status | rotate # phone / remote access (see below)
|
|
182
186
|
agentmgr backlog add "ask" -r <repo> [-p 1] # queue work; also: ls, start, accept, reopen, move, limit, pause
|
|
183
187
|
agentmgr notify slack --webhook <url> # Slack alerts; also: test, status, on, off, event <name> on|off
|
|
188
|
+
agentmgr debug <agent> "what goes wrong" # debug with an agent; no question prints its report; --fix applies the fixes
|
|
189
|
+
agentmgr dates <project> --cc 2026-12-01 --rc 2026-12-10 --ga 2026-12-20 # commitment dates; no dates: where each stands
|
|
190
|
+
agentmgr decisions [project] [--md] # the decision log; --add "<question>" --decision "<what>" adds one
|
|
191
|
+
agentmgr debt <project> --scan # the tech debt radar: files that change often and are hard to read
|
|
192
|
+
agentmgr news # the frontier labs' latest releases, summarized (--refresh, --lab, --days)
|
|
184
193
|
agentmgr inbox # prompts, questions, stuck agents and overlaps waiting on you
|
|
185
194
|
agentmgr answer <agent> <question-id> "…" # answer a question from the inbox
|
|
186
195
|
agentmgr tell <agent> "…" # send a message into the session (when it's idle)
|
|
@@ -1145,6 +1154,112 @@ Usage comes from the session transcripts and is refreshed every few seconds whil
|
|
|
1145
1154
|
|
|
1146
1155
|
`agentmgr mcp run <agent|home> <server> <tool> [arguments or request]` does the first two, and `--session` the third. A destructive tool needs a second click. Plugins can refuse runs outside an agent's session with the `mcp.run` policy.
|
|
1147
1156
|
|
|
1157
|
+
## Plan: dates, decisions and tech debt
|
|
1158
|
+
|
|
1159
|
+
**Plan** in the top bar (or `c`, or `#plan`) looks ahead, in three tabs. Its button counts the dates that are late or at risk.
|
|
1160
|
+
|
|
1161
|
+
### Dates
|
|
1162
|
+
|
|
1163
|
+
Give a project its **code complete**, **release candidate** and **GA** dates (**+ Dates for a project**, or `agentmgr dates <project> --cc … --rc … --ga …`; they must be in that order). For each date you get:
|
|
1164
|
+
|
|
1165
|
+
- **How far it is and where it stands.** *On track*, *at risk* (a week or less away with counted work still open), *late*, or *reached* once you mark it.
|
|
1166
|
+
- **A checklist.** What the app can count for itself, and what only you can tick:
|
|
1167
|
+
|
|
1168
|
+
| Date | Counted by the app | Yours to tick |
|
|
1169
|
+
|---|---|---|
|
|
1170
|
+
| Code complete | agents still working, backlog items not finished, things waiting on you (plans, questions, prompts) | scope agreed |
|
|
1171
|
+
| Release candidate | pull requests still open, pull requests with failing checks, critical or high bugs open (bug hunts) | release notes and changelog drafted, RC cut and smoke-tested |
|
|
1172
|
+
| GA | critical or high bugs open, pull requests still open | docs and upgrade notes, release notes final, version tagged and published |
|
|
1173
|
+
|
|
1174
|
+
- **Related actions.** **Show** jumps to the agents, backlog, Land tab or Bugs behind a count. **Have an agent do it** hands one of your items (release notes, docs) to an agent through the project's backlog.
|
|
1175
|
+
- **Reminders.** Planned 14, 7, 3 and 1 days before and on the day, and once when a date passes. Each goes to Slack with what is still open (Alerts → *a project's date*), between 8:00 and 20:00; coming within a nearer one covers the further ones. A date you move gets its reminders again.
|
|
1176
|
+
- **In Today.** A date shows from two weeks out, higher up as it nears, with what is open.
|
|
1177
|
+
|
|
1178
|
+
### Decisions
|
|
1179
|
+
|
|
1180
|
+
What was decided on each project and why, newest first, gathered from what already happens here:
|
|
1181
|
+
|
|
1182
|
+
- **Plan reviews:** a plan you approved or sent back, with your notes.
|
|
1183
|
+
- **Your answers** to agents' questions.
|
|
1184
|
+
- **Design docs:** the bullets under *Decisions and risks*. When a design moves on, what it no longer says is kept and marked *replaced since*.
|
|
1185
|
+
- **Your own**, with **+ Add a decision** (or `agentmgr decisions <project> --add …`).
|
|
1186
|
+
|
|
1187
|
+
Entries stay after their agent is deleted. Filter by project or by words, remove one with ×, and **Copy as Markdown** (or `agentmgr decisions --md`) gives the log as a document. No model is called.
|
|
1188
|
+
|
|
1189
|
+
### Debt
|
|
1190
|
+
|
|
1191
|
+
Where a project's code costs the most to change. **Scan** (or `agentmgr debt <project> --scan`) reads the repository's last 90 days of git history and its source files, and scores each file by:
|
|
1192
|
+
|
|
1193
|
+
- how often it changed, and how many of those changes were fixes;
|
|
1194
|
+
- how tangled it is: its length, branch points, lines nested five deep or more, TODO/FIXME notes;
|
|
1195
|
+
- open bugs the bug hunts found in it.
|
|
1196
|
+
|
|
1197
|
+
Files that are both changed often and hard to read come first, each with its reasons. Test files count for less; vendored, generated and binary files, and commits that touch more than 40 files, are left out. **Hand to an agent** queues a task in the project's backlog (cover it with tests, then refactor in small steps); **Not debt** sets a file aside for good. Projects with a repository on this computer are scanned again every 7 days. It reads git and the files only: no model is called and nothing leaves the machine. In config.json: `"debt": { "enabled": true, "days": 90, "autoDays": 7, "top": 30 }`.
|
|
1198
|
+
|
|
1199
|
+
## Your day: Today around your calendar
|
|
1200
|
+
|
|
1201
|
+
In **Today**, **Connect calendar** takes your calendar's private iCal address:
|
|
1202
|
+
|
|
1203
|
+
- **Google Calendar:** Settings → your calendar → Integrate calendar → *Secret address in iCal format*.
|
|
1204
|
+
- **Outlook:** Settings → Calendar → Shared calendars → Publish a calendar → *ICS*.
|
|
1205
|
+
|
|
1206
|
+
The address gives read access only. It is kept in config.json on this computer, is never shown in the page again, and is fetched only by the daemon (every 10 minutes at most). Nothing is written to your calendar.
|
|
1207
|
+
|
|
1208
|
+
With it, Today opens with **Your day**:
|
|
1209
|
+
|
|
1210
|
+
- **Meetings** from now on, with the one in progress marked, and all-day events on a line of their own.
|
|
1211
|
+
- **Free time** between them until the end of your working day (09:00 to 18:00 unless you change it), with what needs you placed in it, most pressing first. Each kind of item has a usual length (a prompt 3 minutes, a question 5, a pull request review 25), and what doesn't fit is counted as *won't fit today* instead of squeezed in.
|
|
1212
|
+
- **What a meeting is about:** the agents, pull requests and issues its title or description names (a Jira key, `#482`, an agent's or project's name), to open before you walk in.
|
|
1213
|
+
|
|
1214
|
+
Repeating meetings, time zones, moved or cancelled occurrences and events marked *free* are understood. Several calendars can be added; **Disconnect** forgets them. In config.json: `"calendar": { "ics": ["https://…"], "workStart": "09:00", "workEnd": "18:00" }`.
|
|
1215
|
+
|
|
1216
|
+
## Debug
|
|
1217
|
+
|
|
1218
|
+
**🐞 Debug** in an agent's detail (or the **Debug** tab of the split, **◫ Split** in the terminal bar) puts the agent's session on the left and the debug pane on the right. Type what is going wrong, for example *E2E tests fail at max scale after about 20 minutes* or *p99 latency triples under load*, and press **Debug** (or Enter).
|
|
1219
|
+
|
|
1220
|
+
The agent investigates in its own session, with everything it already knows about the work: it reads the code on the path, the logs and the tests, reproduces the problem where it can (the failing test, a small load, a script) and measures. It keeps a report, drawn in the pane as it grows:
|
|
1221
|
+
|
|
1222
|
+
| Section | What it has |
|
|
1223
|
+
|---|---|
|
|
1224
|
+
| Summary | What goes wrong, the most likely cause, and how sure it is |
|
|
1225
|
+
| Symptoms | What is seen and when (scale, load, timing), and how to reproduce it |
|
|
1226
|
+
| Code path | An animated flowchart of the path the failing request, job or test takes through the real files and functions; where it breaks is outlined red, what is only suspected dashed amber |
|
|
1227
|
+
| Data flow | An animated flowchart or sequence diagram of the data on that path: where it grows, waits, is dropped or goes wrong |
|
|
1228
|
+
| Interleaving | For timing, concurrency and load problems: the order of events that breaks |
|
|
1229
|
+
| Findings | Each with its evidence (file and line, a log line, a metric, a command and its output), marked confirmed or suspected |
|
|
1230
|
+
| Root cause | The causes, most likely first, with a confidence and what would confirm each |
|
|
1231
|
+
| Recommended fixes | Each with where, the effort, the risk and how to verify it |
|
|
1232
|
+
| Next checks | What to measure next, and what it needs from you |
|
|
1233
|
+
|
|
1234
|
+
- **Follow-ups.** Type what you know or what to look at next and press **Ask**: the investigation continues and the report is brought up to date. If the agent needs something only you have (the scale it fails at, logs), it asks in its session on the left.
|
|
1235
|
+
- **Apply fixes.** The agent changes no repository code while it investigates. **Apply fixes** asks it to make the fixes (name them in the box, like *1 and 3*, or leave it empty for the ones it recommends), verify each the way the report says, and add a **Fixes applied** section with the result before and after.
|
|
1236
|
+
- **How it runs.** Your question is typed into the agent's session like any message: when it is idle, resuming it if it was closed. It uses the agent's own engine, model and permissions; no other model call is made. The report is `DEBUG.md` next to the agent's brief, outside the repository.
|
|
1237
|
+
|
|
1238
|
+
`agentmgr debug <agent> "<what goes wrong>"` asks from the terminal, `agentmgr debug <agent>` prints the report, and `--fix ["1 and 3"]` applies fixes.
|
|
1239
|
+
|
|
1240
|
+
## AI News
|
|
1241
|
+
|
|
1242
|
+
**AI News** in the top bar (or `l`, `#news`, or `agentmgr news`) lists what the frontier labs released in the last 30 days, newest first and grouped by day. Each entry has its lab, a summary of a sentence or two, a link to the release and the links from the note. Filter by lab or by words. What arrived since you last looked is marked *new* and counted on the button.
|
|
1243
|
+
|
|
1244
|
+
Where it comes from:
|
|
1245
|
+
|
|
1246
|
+
| Source | Read from |
|
|
1247
|
+
|---|---|
|
|
1248
|
+
| Claude Platform (Anthropic) | [platform.claude.com release notes](https://platform.claude.com/docs/en/release-notes/overview) |
|
|
1249
|
+
| Claude Code (Anthropic) | its [GitHub releases](https://github.com/anthropics/claude-code/releases), one entry per version |
|
|
1250
|
+
| OpenAI API | [developers.openai.com/changelog](https://developers.openai.com/changelog) |
|
|
1251
|
+
| Gemini API (Google) | [ai.google.dev release notes](https://ai.google.dev/gemini-api/docs/changelog) |
|
|
1252
|
+
| Top 10 labs | a web search once a day, for labs without release notes read here (xAI, Meta, Mistral and the rest) |
|
|
1253
|
+
|
|
1254
|
+
The daemon reads the release notes every 6 hours; **Refresh** reads them now, and **Search top labs** also searches now. Model calls, on your own Claude plan:
|
|
1255
|
+
|
|
1256
|
+
- **Summaries:** one tool-less call per 25 new entries, each entry summarized once. Until then an entry shows the start of its own text.
|
|
1257
|
+
- **Web search:** one Claude Code call a day that may use only web search and web fetch, with no MCP servers and none of its other tools. What it finds is as reliable as a web search: check the link.
|
|
1258
|
+
|
|
1259
|
+
Only public pages are read, and nothing is sent anywhere. A source whose page can't be read is marked ⚠ with the reason, and the others still show.
|
|
1260
|
+
|
|
1261
|
+
In config.json: `"news": { "enabled": true, "sources": ["claude-platform", "claude-code", "openai", "gemini"], "search": true, "summaries": true, "refreshHours": 6, "searchHours": 24, "days": 30 }`. Add release notes of your own, in Markdown with a dated heading per day and a bullet per change, with `"custom": [{ "id": "mistral", "lab": "Mistral AI", "label": "Mistral API", "url": "https://…/changelog.md" }]`.
|
|
1262
|
+
|
|
1148
1263
|
## Configuration
|
|
1149
1264
|
|
|
1150
1265
|
State lives in `~/.agentmanager/` (`state.json`, `daemon.log`, `repos/` for shared clones, `workspaces/` for worktrees). Set `AGENTMGR_HOME` or `AGENTMGR_PORT` to change the location or port. Optional `~/.agentmanager/config.json`:
|
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -38,6 +38,8 @@ import { initReviews } from '/reviews.js';
|
|
|
38
38
|
import { initBugHunt } from '/bughunt.js';
|
|
39
39
|
import { drawDiagram } from '/diagram.js';
|
|
40
40
|
import { initValue } from '/value.js';
|
|
41
|
+
import { initNews } from '/news.js';
|
|
42
|
+
import { initPlan } from '/plan.js';
|
|
41
43
|
import { initMcp } from '/mcp.js';
|
|
42
44
|
import { initCodeMap } from '/codemap.js';
|
|
43
45
|
import { initKeys } from '/keys.js';
|
|
@@ -66,11 +68,14 @@ const watchOnLoad = hashId === 'watch';
|
|
|
66
68
|
const standupOnLoad = hashId === 'standup';
|
|
67
69
|
const mapOnLoad = hashId === 'map';
|
|
68
70
|
const valueOnLoad = hashId === 'value';
|
|
71
|
+
const newsOnLoad = hashId === 'news';
|
|
72
|
+
// "#plan" or "#plan/<dates|decisions|debt>".
|
|
73
|
+
const planOnLoad = hashId === 'plan';
|
|
69
74
|
const reviewsOnLoad = hashId === 'reviews';
|
|
70
75
|
// "#mcp" or "#mcp/<agent>": the MCP window on its own.
|
|
71
76
|
const mcpOnLoad = hashId === 'mcp';
|
|
72
77
|
let watchShown = false;
|
|
73
|
-
let selectedId = (watchOnLoad || standupOnLoad || mapOnLoad || valueOnLoad || reviewsOnLoad || mcpOnLoad ? null : hashId) || null;
|
|
78
|
+
let selectedId = (watchOnLoad || standupOnLoad || mapOnLoad || valueOnLoad || newsOnLoad || planOnLoad || reviewsOnLoad || mcpOnLoad ? null : hashId) || null;
|
|
74
79
|
let openTermOnLoad = hashView === 'term' || hashView === 'code' || isShell(hashView) || isBrowser(hashView);
|
|
75
80
|
let filterText = '';
|
|
76
81
|
// "Only agents created in the last N days": remembered in this browser.
|
|
@@ -277,6 +282,7 @@ const todayUi = initToday({
|
|
|
277
282
|
openBugs: (show = 'open') => bugsUi.open({ show }),
|
|
278
283
|
openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)),
|
|
279
284
|
openEval: (id) => (showTab('agents'), select(id), openDoc(id, 'eval')),
|
|
285
|
+
openPlan: (tab) => planUi.open(tab),
|
|
280
286
|
});
|
|
281
287
|
$('#today-btn').onclick = () => todayUi.open();
|
|
282
288
|
// Designs: every agent's design doc, the ones waiting for your review first.
|
|
@@ -299,6 +305,24 @@ $('#bugs-btn').onclick = () => bugsUi.open();
|
|
|
299
305
|
// Value: what the delivered work is worth, for you and for management.
|
|
300
306
|
const valueUi = initValue({ api, $, esc, toast: (m, ms) => toast(m, ms), openAgent: (id) => (showTab('agents'), select(id)) });
|
|
301
307
|
$('#value-btn').onclick = () => valueUi.open();
|
|
308
|
+
// AI News: the frontier labs' latest releases, summarized.
|
|
309
|
+
const newsUi = initNews({ api, $, esc, ago, toast: (m, ms) => toast(m, ms) });
|
|
310
|
+
$('#news-btn').onclick = () => newsUi.open();
|
|
311
|
+
// Plan: project dates with their checklists and reminders, the decision log, the tech debt radar.
|
|
312
|
+
const planUi = initPlan({
|
|
313
|
+
api,
|
|
314
|
+
$,
|
|
315
|
+
esc,
|
|
316
|
+
ago,
|
|
317
|
+
toast: (m, ms) => toast(m, ms),
|
|
318
|
+
projects: () => projectsState.map((p) => ({ key: p.shortcut, name: p.name })),
|
|
319
|
+
openTab: (what, id) => {
|
|
320
|
+
if (what === 'agent') return showTab('agents'), select(id);
|
|
321
|
+
if (what === 'bugs') return bugsUi.open({ show: 'open' });
|
|
322
|
+
showTab(what);
|
|
323
|
+
},
|
|
324
|
+
});
|
|
325
|
+
$('#plan-btn').onclick = () => planUi.open();
|
|
302
326
|
// MCP: the MCP servers and tools Claude Code has in a folder, and running one.
|
|
303
327
|
const mcpUi = initMcp({ api, $, esc, ago, md: (t) => md(t), toast: (m, ms) => toast(m, ms), agents: () => [...agents.values()] });
|
|
304
328
|
$('#mcp-btn').onclick = () => mcpUi.open(selectedId && agents.get(selectedId)?.workdir ? selectedId : null);
|
|
@@ -352,6 +376,8 @@ function shortcut(act) {
|
|
|
352
376
|
if (act === 'reviews') return reviewsUi.open();
|
|
353
377
|
if (act === 'bugs') return bugsUi.open();
|
|
354
378
|
if (act === 'value') return valueUi.open();
|
|
379
|
+
if (act === 'news') return newsUi.open();
|
|
380
|
+
if (act === 'plan') return planUi.open();
|
|
355
381
|
if (act === 'today') return todayUi.open();
|
|
356
382
|
if (act.startsWith('tab:')) return showTab(act.slice(4));
|
|
357
383
|
return false;
|
|
@@ -2300,6 +2326,7 @@ function renderDetail() {
|
|
|
2300
2326
|
${a.aiReview?.verdict ? `<button data-act="overview" title="The AI review: what's done, what's missing, the risks">Overview${a.aiReview.seen ? '' : ' <span class="count">new</span>'}</button>` : ''}
|
|
2301
2327
|
${a.questions?.length ? `<button data-act="questions" title="What the agent asked you, and your answers">Questions${openQuestions(a) ? ` <span class="count">${openQuestions(a)}</span>` : ''}</button>` : ''}
|
|
2302
2328
|
${a.conflicts?.length ? `<button data-act="overlaps" title="Other agents changing the same files: which, who should merge first, and what to do">⚔ Overlaps <span class="count">${a.conflicts.length}</span></button>` : ''}
|
|
2329
|
+
<button data-act="debug" class="desk-only" ${a.workdir && a.status !== 'preparing' ? '' : 'disabled'} title="Debug with this agent: say what to debug (a failure, instability at scale, slowness under load). It investigates in its session and writes a report beside it: animated diagrams of the code path and data flow, findings and recommended fixes">🐞 Debug${a.specDocs?.debug ? ' <span class="count">report</span>' : ''}</button>
|
|
2303
2330
|
<button data-act="mcp" ${a.workdir && a.status !== 'preparing' ? '' : 'disabled'} title="The MCP servers and tools Claude Code has in this agent's folder; run one in its session or once in the workspace">MCP tools</button>
|
|
2304
2331
|
<button data-act="fork" ${a.workdir && a.git?.branch ? '' : 'disabled'} title="A new agent with this one's code and conversation, in its own worktree, to try another approach">Fork</button>
|
|
2305
2332
|
<button data-act="edit" title="Change its name, request, project, priority, permission mode or model">Edit</button>
|
|
@@ -3898,6 +3925,9 @@ $('#detail-body').addEventListener('click', async (e) => {
|
|
|
3898
3925
|
case 'questions':
|
|
3899
3926
|
case 'overlaps':
|
|
3900
3927
|
return openNeeds(a.id, btn.dataset.act);
|
|
3928
|
+
case 'debug':
|
|
3929
|
+
term.open(a.id);
|
|
3930
|
+
return sidePane.open('debug');
|
|
3901
3931
|
case 'mcp':
|
|
3902
3932
|
return mcpUi.open(a.id);
|
|
3903
3933
|
case 'memory':
|
|
@@ -4410,6 +4440,16 @@ function handleEvent(msg) {
|
|
|
4410
4440
|
history.replaceState(null, '', '#');
|
|
4411
4441
|
valueUi.open();
|
|
4412
4442
|
}
|
|
4443
|
+
if (planOnLoad && !watchShown) {
|
|
4444
|
+
watchShown = true;
|
|
4445
|
+
history.replaceState(null, '', '#');
|
|
4446
|
+
planUi.open(hashView || 'dates');
|
|
4447
|
+
}
|
|
4448
|
+
if (newsOnLoad && !watchShown) {
|
|
4449
|
+
watchShown = true;
|
|
4450
|
+
history.replaceState(null, '', '#');
|
|
4451
|
+
newsUi.open();
|
|
4452
|
+
}
|
|
4413
4453
|
if (standupOnLoad && !watchShown) {
|
|
4414
4454
|
watchShown = true;
|
|
4415
4455
|
history.replaceState(null, '', '#');
|
|
@@ -4459,6 +4499,11 @@ function handleEvent(msg) {
|
|
|
4459
4499
|
teams.delete(msg.id);
|
|
4460
4500
|
} else if (msg.t === 'value') {
|
|
4461
4501
|
valueUi.changed();
|
|
4502
|
+
} else if (msg.t === 'news') {
|
|
4503
|
+
newsUi.changed();
|
|
4504
|
+
} else if (msg.t === 'plan') {
|
|
4505
|
+
planUi.changed();
|
|
4506
|
+
todayUi.changed();
|
|
4462
4507
|
} else if (msg.t === 'standup') {
|
|
4463
4508
|
standupUi.set(msg.latest);
|
|
4464
4509
|
if (msg.latest?.reason === 'scheduled' && msg.latest.items.length) toast('Standup ready: press Standup (or p) to play it', 8000);
|
package/public/index.html
CHANGED
|
@@ -40,6 +40,8 @@
|
|
|
40
40
|
<button id="bugs-btn" title="Bugs: background hunts in a project or folder, and what they found, checked and worst first">Bugs <span id="bugs-count" class="badge"></span></button>
|
|
41
41
|
<button id="reviews-btn" title="Reviews: pull requests you review. Reviewer agents ask the critical questions and find what blocks approval; you post what you pick">Reviews <span id="reviews-count" class="badge ready"></span></button>
|
|
42
42
|
<button id="value-btn" title="Value: what the delivered work is worth, by day, week, month and quarter, against the AI cost and your time; reports for management">Value</button>
|
|
43
|
+
<button id="plan-btn" title="Plan: a project's dates (code complete, RC, GA) with their checklists and reminders, the decision log, and the tech debt radar">Plan <span id="plan-count" class="badge"></span></button>
|
|
44
|
+
<button id="news-btn" title="AI News: the frontier labs' latest releases (Anthropic, OpenAI, Google and the other top labs), each summarized, with links">AI News <span id="news-count" class="badge ready"></span></button>
|
|
43
45
|
<button id="map-btn" title="The codebase map: where each agent is changing and reading code, and who is about to collide">Map</button>
|
|
44
46
|
<button id="watch-btn" title="Running agents' sessions side by side, live: follow them all without clicking from one to the next">Watch</button>
|
|
45
47
|
<button id="mcp-btn" title="MCP: the MCP servers Claude Code has (yours, projects', claude.ai connectors and plugins), their tools, and running one in an agent's session or workspace">MCP</button>
|
|
@@ -146,7 +148,7 @@
|
|
|
146
148
|
<button id="term-attach" class="ghost small" title="Attach files or images (you can also drop or paste them into the terminal)">📎 Attach</button>
|
|
147
149
|
<input type="file" id="term-file" multiple hidden>
|
|
148
150
|
<button id="term-fit" class="ghost small" title="Refit the terminal to the panel">Fit</button>
|
|
149
|
-
<button id="term-split-btn" class="ghost small desk-only" title="Split: the terminal on the left, and Code, Docs (diagrams) or
|
|
151
|
+
<button id="term-split-btn" class="ghost small desk-only" title="Split: the terminal on the left, and Code, Docs (diagrams), Changes or Debug on the right">◫ Split</button>
|
|
150
152
|
<button id="group-split" class="ghost small desk-only" title="Split the screen: a group to the right for another agent's session, as in VS Code (Cmd+\ on a Mac, or Ctrl+Shift+\; add Shift on a Mac, or Alt, to split down). Or drag an agent from the list onto the right or bottom edge">⊞ Split screen</button>
|
|
151
153
|
<button id="term-max" class="ghost small desk-only" title="Expand to fill the window (Ctrl+Shift+E)">⤢ Expand</button>
|
|
152
154
|
<button id="term-full" class="ghost small desk-only" title="Full screen (Esc to leave)">⛶ Full screen</button>
|
|
@@ -194,6 +196,7 @@
|
|
|
194
196
|
<button class="term-tab" data-side="code" role="tab" title="The agent's files">Code</button>
|
|
195
197
|
<button class="term-tab" data-side="docs" role="tab" title="Diagrams and the other documents">Docs</button>
|
|
196
198
|
<button class="term-tab" data-side="changes" role="tab" title="Its changes, explained one by one">Changes</button>
|
|
199
|
+
<button class="term-tab" data-side="debug" role="tab" title="Debug: say what to debug; the agent investigates in its session and its report shows here, with animated diagrams of the code path and data flow, findings and recommended fixes">Debug</button>
|
|
197
200
|
</div>
|
|
198
201
|
<span class="spacer"></span>
|
|
199
202
|
<button type="button" class="ghost small" id="side-close" title="Close the split">✕</button>
|
|
@@ -415,6 +418,12 @@
|
|
|
415
418
|
<dialog id="value-dialog" class="issues-dialog value-dialog" aria-label="Value">
|
|
416
419
|
<div id="value-body"></div>
|
|
417
420
|
</dialog>
|
|
421
|
+
<dialog id="plan-dialog" class="issues-dialog plan-dialog" aria-label="Plan">
|
|
422
|
+
<div id="plan-body"></div>
|
|
423
|
+
</dialog>
|
|
424
|
+
<dialog id="news-dialog" class="issues-dialog news-dialog" aria-label="AI News">
|
|
425
|
+
<div id="news-body"></div>
|
|
426
|
+
</dialog>
|
|
418
427
|
<dialog id="standup-dialog" class="standup-dialog" aria-label="Standup">
|
|
419
428
|
<div id="standup-body"></div>
|
|
420
429
|
</dialog>
|
|
@@ -590,6 +599,7 @@
|
|
|
590
599
|
<label class="check"><input type="checkbox" name="ev_budget" /> nears or reaches its budget, or today's spend reaches the daily limit</label>
|
|
591
600
|
<label class="check"><input type="checkbox" name="ev_standup" /> the daily standup is ready (with a link to play it)</label>
|
|
592
601
|
<label class="check"><input type="checkbox" name="ev_value" /> value reports (weekly, monthly, quarterly, as set in Value)</label>
|
|
602
|
+
<label class="check"><input type="checkbox" name="ev_milestone" /> a project's date (code complete, RC, GA) is 14, 7, 3 or 1 days away, today, or late (Plan → Dates)</label>
|
|
593
603
|
<label class="check"><input type="checkbox" name="ev_waiting" /> finished its turn and is idle after <input name="waitingDelaySec" type="number" min="0" class="num" />s</label>
|
|
594
604
|
<label class="check"><input type="checkbox" name="skipWhenWatching" /> not while I have its terminal open</label>
|
|
595
605
|
<label class="check"><input type="checkbox" name="includeIntent" /> include the intent text in the message</label>
|
package/public/keys.js
CHANGED
|
@@ -27,6 +27,8 @@ export const SHORTCUTS = [
|
|
|
27
27
|
[['d'], 'Designs: agents\' design docs', 'designs'],
|
|
28
28
|
[['g'], 'Reviews: pull requests you review', 'reviews'],
|
|
29
29
|
[['v'], 'Value: what the work is worth', 'value'],
|
|
30
|
+
[['l'], 'AI News: the latest frontier releases', 'news'],
|
|
31
|
+
[['c'], 'Plan: project dates, decisions and tech debt', 'plan'],
|
|
30
32
|
[['1'], 'Agents tab', 'tab:agents'],
|
|
31
33
|
[['2'], 'Inbox: what needs you', 'tab:inbox'],
|
|
32
34
|
[['3'], 'Backlog', 'tab:backlog'],
|
|
@@ -70,11 +72,11 @@ export const SHORTCUTS = [
|
|
|
70
72
|
// A single key, as an event names it, to its action.
|
|
71
73
|
export const SINGLE = {
|
|
72
74
|
j: 'next', k: 'prev', Enter: 'terminal', t: 'terminal',
|
|
73
|
-
r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', o: 'actions', h: 'assistant', ',': 'settings', d: 'designs', g: 'reviews', v: 'value', y: 'today', b: 'bugs', '?': 'help',
|
|
75
|
+
r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', o: 'actions', h: 'assistant', ',': 'settings', d: 'designs', g: 'reviews', v: 'value', l: 'news', c: 'plan', y: 'today', b: 'bugs', '?': 'help',
|
|
74
76
|
1: 'tab:agents', 2: 'tab:inbox', 3: 'tab:backlog', 4: 'tab:land', 5: 'tab:built',
|
|
75
77
|
};
|
|
76
78
|
// While Watch is open: only what makes sense there.
|
|
77
|
-
const ON_WATCH = new Set(['today', 'new', 'ask', 'watch', 'standup', 'map', 'issues', 'actions', 'assistant', 'settings', 'designs', 'reviews', 'value', 'bugs', 'help']);
|
|
79
|
+
const ON_WATCH = new Set(['today', 'new', 'ask', 'watch', 'standup', 'map', 'issues', 'actions', 'assistant', 'settings', 'designs', 'reviews', 'value', 'news', 'plan', 'bugs', 'help']);
|
|
78
80
|
|
|
79
81
|
/** Typing somewhere: a field, an editor or a terminal (xterm types through a textarea). */
|
|
80
82
|
const typing = (el) => Boolean(el?.closest?.('input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .cm-editor'));
|
package/public/news.js
ADDED
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
// AI News: the frontier labs' latest releases in one list, newest first, each with a short summary
|
|
2
|
+
// and its links. The daemon reads the release notes (and searches the web for the top labs once a
|
|
3
|
+
// day) on its own; Refresh looks now. New since you last looked is marked, and counted on the button.
|
|
4
|
+
|
|
5
|
+
import { expandButton, expandable } from './expand.js';
|
|
6
|
+
|
|
7
|
+
const SAVED = 'agentmgr.newsLab';
|
|
8
|
+
|
|
9
|
+
export function initNews({ api, $, esc, ago, toast }) {
|
|
10
|
+
const dialog = $('#news-dialog');
|
|
11
|
+
const body = $('#news-body');
|
|
12
|
+
let data = null;
|
|
13
|
+
let lab = 'all';
|
|
14
|
+
let query = '';
|
|
15
|
+
let again = null;
|
|
16
|
+
try {
|
|
17
|
+
lab = localStorage.getItem(SAVED) || 'all';
|
|
18
|
+
} catch {}
|
|
19
|
+
|
|
20
|
+
async function load({ quiet = false } = {}) {
|
|
21
|
+
try {
|
|
22
|
+
data = await api('GET', '/news');
|
|
23
|
+
} catch (e) {
|
|
24
|
+
if (!quiet) toast?.(e.message, 5000);
|
|
25
|
+
}
|
|
26
|
+
badge();
|
|
27
|
+
render();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function badge() {
|
|
31
|
+
const n = data?.newCount ?? 0;
|
|
32
|
+
const el = $('#news-count');
|
|
33
|
+
if (!el) return;
|
|
34
|
+
el.textContent = n ? String(n) : '';
|
|
35
|
+
el.title = n ? `${n} new since you last looked` : '';
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/** "Today", "Yesterday", "Monday, Nov 9" (with the year when it isn't this one). */
|
|
39
|
+
function dayLabel(date) {
|
|
40
|
+
const d = new Date(`${date}T12:00:00`);
|
|
41
|
+
const today = new Date();
|
|
42
|
+
const days = Math.round((new Date(today.toDateString()) - new Date(d.toDateString())) / 86_400_000);
|
|
43
|
+
if (days === 0) return 'Today';
|
|
44
|
+
if (days === 1) return 'Yesterday';
|
|
45
|
+
return d.toLocaleDateString([], { weekday: 'long', month: 'short', day: 'numeric', ...(d.getFullYear() === today.getFullYear() ? {} : { year: 'numeric' }) });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
function item(i) {
|
|
49
|
+
const extra = i.links.filter((l) => l.url !== i.url).slice(0, 4);
|
|
50
|
+
return `<li class="news-item${i.isNew ? ' new' : ''}">
|
|
51
|
+
<div class="news-meta"><span class="tag news-lab" data-lab="${esc(i.lab)}">${esc(i.lab)}</span> <span class="hint">${esc(i.label)}</span>${i.isNew ? ' <span class="tag news-new">new</span>' : ''}</div>
|
|
52
|
+
<a class="news-title" href="${esc(i.url)}" target="_blank" rel="noopener">${esc(i.title)}</a>
|
|
53
|
+
${i.summary
|
|
54
|
+
? `<p class="news-summary">${esc(i.summary)}</p>`
|
|
55
|
+
: `<p class="news-summary hint" title="The summary is written on the next refresh">${esc(i.lead ?? '')}</p>`}
|
|
56
|
+
${extra.length ? `<div class="news-links">${extra.map((l) => `<a href="${esc(l.url)}" target="_blank" rel="noopener" title="${esc(l.url)}">${esc(l.text || new URL(l.url).host)} ↗</a>`).join('')}</div>` : ''}
|
|
57
|
+
</li>`;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function source(s) {
|
|
61
|
+
const what = s.error ? `⚠ ${s.error}` : s.at ? `${s.count} entries, read ${ago(s.at)}` : 'not read yet';
|
|
62
|
+
const name = s.page ? `<a href="${esc(s.page)}" target="_blank" rel="noopener">${esc(s.label)}</a>` : esc(s.label);
|
|
63
|
+
return `<span class="news-source${s.error ? ' failed' : ''}" title="${esc(`${s.lab}: ${what}`)}">${name}${s.error ? ' ⚠' : ''}</span>`;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function draw() {
|
|
67
|
+
if (!dialog.open) return;
|
|
68
|
+
if (!data) {
|
|
69
|
+
body.innerHTML = '<p class="hint">Loading…</p>';
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const labs = [...new Set(data.items.map((i) => i.lab))].sort((x, y) => data.items.filter((i) => i.lab === y).length - data.items.filter((i) => i.lab === x).length || x.localeCompare(y));
|
|
73
|
+
if (lab !== 'all' && lab !== 'new' && !labs.includes(lab)) lab = 'all';
|
|
74
|
+
const q = query.trim().toLowerCase();
|
|
75
|
+
const rows = data.items.filter((i) => (lab === 'all' || (lab === 'new' ? i.isNew : i.lab === lab)) && (!q || `${i.title} ${i.summary ?? i.lead ?? ''} ${i.lab} ${i.label} ${(i.tags ?? []).join(' ')}`.toLowerCase().includes(q)));
|
|
76
|
+
const days = [];
|
|
77
|
+
for (const i of rows) {
|
|
78
|
+
if (days.at(-1)?.date !== i.date) days.push({ date: i.date, items: [] });
|
|
79
|
+
days.at(-1).items.push(i);
|
|
80
|
+
}
|
|
81
|
+
const chip = (k, label, n) => `<button class="chip ${k === lab ? 'active' : ''}" role="tab" aria-selected="${k === lab}" data-news-lab="${esc(k)}">${esc(label)} <span class="count">${n}</span></button>`;
|
|
82
|
+
const s = data.settings ?? {};
|
|
83
|
+
body.innerHTML = `
|
|
84
|
+
<div class="issues-head">
|
|
85
|
+
<h2>AI News</h2>
|
|
86
|
+
<div class="chips" role="tablist">${chip('all', 'All', data.items.length)}${data.newCount ? chip('new', 'New', data.newCount) : ''}${labs.map((l) => chip(l, l, data.items.filter((i) => i.lab === l).length)).join('')}</div>
|
|
87
|
+
<span class="spacer"></span>
|
|
88
|
+
<input type="search" class="small news-find" data-news-find placeholder="Find…" value="${esc(query)}" aria-label="Find in the news">
|
|
89
|
+
<button class="small" data-news="refresh" ${data.refreshing || !data.enabled ? 'disabled' : ''} title="Read the release notes again now${s.summaries ? ' and summarize what is new' : ''}">${data.refreshing ? 'Refreshing…' : '↻ Refresh'}</button>
|
|
90
|
+
${s.search ? `<button class="small" data-news="search" ${data.refreshing || !data.enabled ? 'disabled' : ''} title="Also search the web now for the top 10 AI labs' latest releases (otherwise once every ${s.searchHours} hours). One Claude Code call that may only search and read the web">🔎 Search top labs</button>` : ''}
|
|
91
|
+
${expandButton(dialog)}
|
|
92
|
+
<button class="small" data-news="close" title="Close (Esc)">Close</button>
|
|
93
|
+
</div>
|
|
94
|
+
<p class="hint">The frontier labs' latest releases from the last ${esc(String(s.days ?? 30))} days, newest first${s.summaries ? ', each summarized by a model in a sentence or two' : ''}. Read from ${data.sources.map(source).join(', ')}${data.refreshedAt ? `; updated ${esc(ago(data.refreshedAt))}, again every ${esc(String(s.refreshHours))} hours` : ''}. Sources and timing: <code>"news"</code> in config.json.</p>
|
|
95
|
+
${!data.enabled
|
|
96
|
+
? '<p class="hint issues-empty">AI News is off. Turn it on with <code>"news": { "enabled": true }</code> in config.json.</p>'
|
|
97
|
+
: days.length
|
|
98
|
+
? `<div class="issues-scroll news-list">${days.map((d) => `<h3 class="news-day">${esc(dayLabel(d.date))}</h3><ul class="news-items">${d.items.map(item).join('')}</ul>`).join('')}</div>`
|
|
99
|
+
: `<p class="hint issues-empty">${data.refreshing ? 'Reading the release notes…' : data.items.length ? 'Nothing matches.' : 'No news yet. Refresh reads the release notes now.'}</p>`}`;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Typing in Find keeps its focus and caret while the list redraws under it.
|
|
103
|
+
function render() {
|
|
104
|
+
const find = body.querySelector('[data-news-find]');
|
|
105
|
+
const typing = find && document.activeElement === find;
|
|
106
|
+
const at = typing ? find.selectionStart : null;
|
|
107
|
+
draw();
|
|
108
|
+
if (typing) {
|
|
109
|
+
const f = body.querySelector('[data-news-find]');
|
|
110
|
+
f?.focus();
|
|
111
|
+
f?.setSelectionRange(at, at);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function refresh(search) {
|
|
116
|
+
try {
|
|
117
|
+
data = await api('POST', '/news/refresh', search ? { search: true } : {});
|
|
118
|
+
toast?.(search ? 'Reading the release notes and searching the web: this can take a few minutes' : 'Reading the release notes', 3000);
|
|
119
|
+
} catch (e) {
|
|
120
|
+
toast?.(e.message, 6000);
|
|
121
|
+
}
|
|
122
|
+
render();
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
body.addEventListener('input', (e) => {
|
|
126
|
+
if (e.target.dataset.newsFind === undefined) return;
|
|
127
|
+
query = e.target.value;
|
|
128
|
+
render();
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
body.addEventListener('click', (e) => {
|
|
132
|
+
const l = e.target.closest('[data-news-lab]');
|
|
133
|
+
if (l) {
|
|
134
|
+
lab = l.dataset.newsLab;
|
|
135
|
+
try {
|
|
136
|
+
localStorage.setItem(SAVED, lab === 'new' ? 'all' : lab);
|
|
137
|
+
} catch {}
|
|
138
|
+
return render();
|
|
139
|
+
}
|
|
140
|
+
const b = e.target.closest('[data-news]')?.dataset.news;
|
|
141
|
+
if (b === 'close') return dialog.close();
|
|
142
|
+
if (b === 'refresh') return refresh(false);
|
|
143
|
+
if (b === 'search') return refresh(true);
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// Closing marks what you saw as seen: the "new" marks and the count clear. The first look starts them.
|
|
147
|
+
dialog.addEventListener('close', () => {
|
|
148
|
+
if (data && (data.newCount || !data.seenAt)) api('POST', '/news/seen', {}).then(() => load({ quiet: true }), () => {});
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
function open() {
|
|
152
|
+
if (dialog.open) return dialog.close();
|
|
153
|
+
dialog.showModal();
|
|
154
|
+
render();
|
|
155
|
+
load();
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
/** The daemon says the news changed: the count now, and the list while open. */
|
|
159
|
+
function changed() {
|
|
160
|
+
clearTimeout(again);
|
|
161
|
+
again = setTimeout(() => load({ quiet: true }), dialog.open ? 300 : 1500);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
expandable(dialog, render);
|
|
165
|
+
load({ quiet: true });
|
|
166
|
+
return { open, changed, isOpen: () => dialog.open };
|
|
167
|
+
}
|