ai-agentmanager 1.20.0 → 1.22.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,18 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.22.0 (2026-11-06)
4
+
5
+ - **Value.** A **Value** button (or `v`) shows what the delivered work is worth, by day, week, month and quarter: engineering hours saved (valued at your loaded hourly rate), other savings, potential revenue and strategic weight, against the AI cost and your own time (leverage, value per AI dollar). Each delivered item (its pull request merged, or done without one) gets an estimate from one short model call, with reasons; correct any figure and yours win, marked ✎ in reports. Weekly, monthly and quarterly reports (daily if you like) go to Slack and, if you choose, a Google Doc, and are saved in `~/.agentmanager/value` with `value.csv`. `agentmgr value` (`edit`, `estimate`, `report`, `set`).
6
+ - **Jira summary.** A **Jira** button (or `i`) lists every Jira or Linear issue an agent works on, the ones waiting for your review first, with a count on the button: the issue and its Jira status, where the work stands (ready for your review, needs your answer, approved but not merged, checks failing, merged), its plan (steps done, approval) and design doc (read it here, its page and Google Doc), its pull request and checks, and a link to the agent's session. **Copy** puts the list on the clipboard as a Markdown table. From the terminal: `agentmgr issues` (`--all`, `--markdown`, `--json`).
7
+ - **Pick which Jira issues get agents.** **Let me pick** in **Assistant** (`agentmgr assistant set --pick-issues on`): the assistant lists new Jira and Linear issues assigned to you under **Jira → Not started** instead of starting agents for them. Tick the ones you want and **Start**; agents start only for those. **Dismiss** takes the rest off the list for good. Also `agentmgr issues propose`, `start` and `dismiss`.
8
+ - **Explain the review, by voice.** **🔊 Explain** on each pull request (in Jira, Land and the agent's AI review) reads a short briefing for the person about to review it: the issue, what the PR does (from its design doc or walkthrough), its state and checks, what the AI review found met, missing and risky, the high-risk changes, open questions, and what's left before it can merge. It starts at once (no model call); Review's change-by-change walkthrough goes deeper.
9
+ - **Designs.** A **Designs** button (or `d`) lists every agent's design doc, the ones waiting for your review first: its name and summary from DESIGN.md, the agent and its issue, and links to read it here, its design page, its Google Doc and the specs it builds on. Search, filters and **Copy** as Markdown. `agentmgr designs` (`--waiting`, `--markdown`, `--json`).
10
+
11
+ ## 1.21.0 (2026-11-06)
12
+
13
+ - **Map: where agents are in the code.** A **Map** page (or `m`) shows a project's folders as tiles with each agent on the folders it's changing or reading now. Two agents that changed the same file are joined in red; one reading a file another changed is joined with a dashed line, the warning before they collide, and each is spelled out above the map.
14
+ - **Standup.** Every weekday morning (or on demand: **Standup**, or `p`), each agent's news is read aloud in its own voice: what it did, what it's on and what it needs from you, the ones that need you first. It stops on those with their questions beside it: answer by tap, or by voice (read back, sent on "send"). Worded by one short model call; a Slack alert says when it's ready.
15
+
3
16
  ## 1.20.0 (2026-11-06)
4
17
 
5
18
  - **Review comments reach the agent while its pull request is open.** New comments, reviews and line comments on an agent's open pull request are sent to it in one message (waking it if closed), checked every couple of minutes; it makes the changes, pushes and replies on the pull request. Only the repo's owners, members and collaborators (and review bots on the code) count; approvals, resolved threads and the agent's own replies don't. On by default: **Send new review comments** in the Land tab, `agentmgr land set --fix-comments off`, or `"landing": { "fixComments": false }`.
package/README.md CHANGED
@@ -29,8 +29,10 @@ Run one background [Claude Code](https://claude.com/claude-code) agent per inten
29
29
  - **Share for review.** One click writes an **Analysis**, **Design**, **Flow** or **Proposal** document from the agent's work. Copy it as Markdown, download it, or print it to PDF with diagrams.
30
30
  - **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.
31
31
  - **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.
32
+ - **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.
33
+ - **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.
32
34
  - **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.
33
- - **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, `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.
35
+ - **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.
34
36
  - **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.
35
37
  - **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.
36
38
  - **Repo memory.** What one agent learns about a repo (how to run its tests, a gotcha) is recorded in one line and given to every later agent there.
@@ -903,7 +905,7 @@ An always-on Claude session that works on your behalf. **Assistant** in the top
903
905
 
904
906
  | It watches | What it does |
905
907
  |---|---|
906
- | Jira issues newly assigned to you | Starts an agent in the matching project, with the issue link first so the agent is named after the issue (`OPS-7`) |
908
+ | Jira issues newly assigned to you | Starts an agent in the matching project, with the issue link first so the agent is named after the issue (`OPS-7`); with **Let me pick** on, lists it under **Jira → Not started** for you to tick instead |
907
909
  | Linear issues newly assigned to you (turn it on in the dialog) | The same, with the Linear link first (`ENG-42`) |
908
910
  | New comments and mentions on your Jira issues | Passes the comment to the agent on that issue (`agentmgr tell`), or starts one if the comment asks for new work |
909
911
  | GitHub pull requests waiting for your review | Starts a review agent that drafts the review for you to post |
@@ -924,6 +926,43 @@ agentmgr assistant pause # stop checking and close the sessio
924
926
 
925
927
  Settings live in `config.json` under `"assistant"`. A running assistant reads new watch lists and notes after **Pause** and **Turn on**.
926
928
 
929
+ ### Jira summary
930
+
931
+ **Jira** in the top bar (or `i`) lists every Jira or Linear issue an agent works on (the ones started from an issue link, by you or the assistant), one row per agent. **Waiting for you** comes first, and its count shows on the button:
932
+
933
+ | Where it stands | When |
934
+ |---|---|
935
+ | Needs your answer | The agent asked a question, waits at a prompt, or its plan waits for review |
936
+ | Ready for your review | Its pull request is open, not a draft, with no review yet and checks not failing; or it finished without a pull request |
937
+ | Blocked | It says it can't go on |
938
+ | Approved, not merged yet | You approved; merging is left |
939
+
940
+ **Not started** comes before them: issues proposed for agents, each with a box to tick. Tick the ones you want and press **Start**: agents start only for those, named after the issue. **Dismiss** takes ticked ones off the list, and they aren't proposed again. Issues get there when **Let me pick** is on in **Assistant** (`agentmgr assistant set --pick-issues on`): the assistant then proposes new Jira and Linear issues assigned to you instead of starting agents for them. You can propose one yourself too: `agentmgr issues propose @cc "<issue link> what to do"`.
941
+
942
+ **Agents on it** has the ones still working, fixing failing checks or working on your review comments; **Done** the merged and closed ones. Each row shows the issue with its Jira status, the agent's plan (**Read** it here, steps done, and whether it waits for your approval) and design doc (**Read**, its design page and Google Doc), the pull request with its checks and AI review, and the agent, which opens its session. Jira status needs your site, email and API token in **Settings → Jira** (public Atlassian Cloud issues need nothing); it's fetched a few issues at a time and kept five minutes. **Copy** puts the list as a Markdown table on the clipboard, for Slack, Jira or a doc.
943
+
944
+ ```bash
945
+ agentmgr issues # not started, and waiting for your review
946
+ agentmgr issues start OPS-7 OPS-9 # start agents for proposed issues
947
+ agentmgr issues dismiss OPS-8 # not for an agent
948
+ agentmgr issues --all # and the rest
949
+ agentmgr issues --markdown # a table to paste
950
+ ```
951
+
952
+ ### Explain the review, by voice
953
+
954
+ **🔊 Explain** on a pull request (in **Jira**, **Land**, and next to **Review with AI** on the agent) reads a short spoken briefing for whoever reviews it, in this order: the issue; the PR and its state (open or draft, checks, conflicts, approved or changes requested); what it does, from the agent's design doc, else its change walkthrough; the AI review's verdict with what is met, missing and risky; the high-risk changes from the walkthrough; questions the agent is waiting on; and what's left before it can merge. It's built from what AI Agent Manager already tracks, so it starts at once; for each change in turn, use 🔊 Listen in **Review**. Pause, stop and speed are next to it while it plays.
955
+
956
+ ### Designs
957
+
958
+ **Designs** in the top bar (or `d`) lists every agent's design doc, the ones whose work waits for your review first, with their count on the button. Each shows the doc's name and the summary from its DESIGN.md, the agent (opens its session), its Jira issue and where the work stands, and links: **Read** it here, the design page the agent published, its Google Doc after **Publish to Google Drive**, and the PRDs and tech specs in the agent's brief. Search by name, summary, agent, project or issue; **Copy** puts the shown list on the clipboard as Markdown.
959
+
960
+ ```bash
961
+ agentmgr designs # all design docs
962
+ agentmgr designs --waiting # only the ones waiting for your review
963
+ agentmgr designs --markdown # a list to paste
964
+ ```
965
+
927
966
  ## Triggers
928
967
 
929
968
  Start agents from where the work lives, with no session watching and no tokens spent on it. **Assistant → Triggers…**, or `agentmgr triggers`:
@@ -943,6 +982,29 @@ Agents started this way are marked **⚡ GitHub** or **⚡ webhook**, Slack aler
943
982
  }
944
983
  ```
945
984
 
985
+ ## Value
986
+
987
+ **Value** in the top bar (or `v`) shows what the work delivered with agents is worth, for you and for management: by **Day**, **Week**, **Month** or **Quarter**, with bars for the last periods and the items behind each.
988
+
989
+ | Figure | What it is |
990
+ |---|---|
991
+ | Value delivered | Engineering hours the work saved × your loaded hourly rate, plus other savings in its first year |
992
+ | Potential revenue | Revenue the work plausibly enables or protects in its first year (kept apart: it's the least certain) |
993
+ | Strategic | Items rated 4 or 5 of 5 for moving the product or company position |
994
+ | Leverage | Engineering hours delivered per hour of your own time (30 minutes per item unless you set it) |
995
+ | AI cost | What the agents cost, and value per AI dollar |
996
+
997
+ Work counts once it's delivered: its pull request merged, or the agent finished without one. Each item gets an estimate from one short model call (at most 30 a day) based on its issue, pull request, design doc, results and AI review, with a reason for each figure. They are estimates, and conservative by instruction. **Edit** any figure, category or the one-line summary for management: yours win, are marked, and stay through re-estimates. **Don't count it** leaves an item out. **Notes for the estimates** in settings give the model your context ("B2B SaaS, ~2,000 customers; checkout work affects revenue").
998
+
999
+ Reports: **Copy report** (Markdown) or **Send** for the current period or the one just ended, and on a schedule (weekly on Mondays, monthly on the 1st and quarterly by default; daily if you turn it on; at 09:00) to Slack (with **value reports** on in Slack alerts) and, if you choose, as a Google Doc in "Value reports (AI Agent Manager)" through the Google Drive connector of your Claude account. Every report is also saved in `~/.agentmanager/value/`, next to `value.csv` with every item's figures.
1000
+
1001
+ ```bash
1002
+ agentmgr value --period month # totals by month, and this month's items
1003
+ agentmgr value edit OPS-7 --revenue 15000 --summary "Ends login timeouts for our largest customer"
1004
+ agentmgr value report --kind quarter --current # this quarter so far, as Markdown
1005
+ agentmgr value set --rate 140 --reports weekly,monthly,quarterly --at 08:30 --drive on
1006
+ ```
1007
+
946
1008
  ## Results and spend
947
1009
 
948
1010
  **Results** in the top bar shows how agents did over the last 7, 30 or 90 days (or all time): how many started and how many opened a pull request, PRs merged and closed, the merge rate, the median time from starting an agent to its first PR and to merge, and the cost per merged PR. The same by engine and model (which one gets merged more, for less), by where agents came from (you, the assistant, triggers, the backlog, teams, races) and by project. `agentmgr stats --days 30`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agentmanager",
3
- "version": "1.20.0",
3
+ "version": "1.22.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",
package/public/app.js CHANGED
@@ -24,6 +24,12 @@ import { initMenu } from '/menu.js';
24
24
  import { initCode } from '/code.js';
25
25
  import { initMachine } from '/machine.js';
26
26
  import { initWatch } from '/watch.js';
27
+ import { initStandup } from '/standup.js';
28
+ import { initIssues } from '/issues.js';
29
+ import { reviewSpeech } from '/prvoice.js';
30
+ import { initDesigns } from '/designs.js';
31
+ import { initValue } from '/value.js';
32
+ import { initCodeMap } from '/codemap.js';
27
33
  import { initKeys } from '/keys.js';
28
34
  import { morph } from '/morph.js';
29
35
 
@@ -47,8 +53,11 @@ const goHash = ticketHash ? decodeURIComponent(location.hash.match(/(?:^#|&)go=(
47
53
  const [hashId, hashView] = loginHash ? [null, null] : (ticketHash ? goHash : location.hash.slice(1)).split('/');
48
54
  // "#watch": the Watch page, not an agent.
49
55
  const watchOnLoad = hashId === 'watch';
56
+ const standupOnLoad = hashId === 'standup';
57
+ const mapOnLoad = hashId === 'map';
58
+ const valueOnLoad = hashId === 'value';
50
59
  let watchShown = false;
51
- let selectedId = (watchOnLoad ? null : hashId) || null;
60
+ let selectedId = (watchOnLoad || standupOnLoad || mapOnLoad || valueOnLoad ? null : hashId) || null;
52
61
  let openTermOnLoad = hashView === 'term' || hashView === 'code' || isShell(hashView) || isBrowser(hashView);
53
62
  let filterText = '';
54
63
  // "Only agents created in the last N days": remembered in this browser.
@@ -180,7 +189,49 @@ const watchUi = initWatch({
180
189
  projectLabel: (a) => a.projectInfo?.name ?? 'Other',
181
190
  openAgent: (id) => (showTab('agents'), select(id), term.open(id)),
182
191
  });
183
- $('#watch-btn').onclick = () => watchUi.show(!watchUi.isOpen());
192
+ $('#watch-btn').onclick = () => (mapUi.isOpen() && mapUi.show(false), watchUi.show(!watchUi.isOpen()));
193
+
194
+ // Map: where each agent is in the code, and who is about to collide.
195
+ const mapUi = initCodeMap({ api, $, esc, agents, toast: (m, ms) => toast(m, ms), openAgent: (id) => (showTab('agents'), select(id)) });
196
+ $('#map-btn').onclick = () => (watchUi.isOpen() && watchUi.show(false), mapUi.show(!mapUi.isOpen()));
197
+
198
+ // The standup: each agent's news read aloud, stopping on the ones that need you.
199
+ const standupUi = initStandup({
200
+ api,
201
+ $,
202
+ esc,
203
+ agents,
204
+ needsFor: (a) => needsFor(a),
205
+ needCard: (it, o) => needCard(it, o),
206
+ onNeed: (e) => onNeed(e),
207
+ toast: (m, ms) => toast(m, ms),
208
+ openAgent: (id) => (showTab('agents'), select(id)),
209
+ });
210
+ // Jira: every issue an agent works on, the ones waiting for your review first.
211
+ const issuesUi = initIssues({
212
+ api,
213
+ $,
214
+ esc,
215
+ ago,
216
+ toast: (m, ms) => toast(m, ms),
217
+ openAgent: (id) => (showTab('agents'), select(id)),
218
+ openDoc: (id, kind) => (showTab('agents'), select(id), openDoc(id, kind)),
219
+ });
220
+ $('#issues-btn').onclick = () => issuesUi.open();
221
+ // Designs: every agent's design doc, the ones waiting for your review first.
222
+ const designsUi = initDesigns({
223
+ api,
224
+ $,
225
+ esc,
226
+ ago,
227
+ toast: (m, ms) => toast(m, ms),
228
+ openAgent: (id) => (showTab('agents'), select(id)),
229
+ openDoc: (id) => (showTab('agents'), select(id), openDoc(id, 'designdoc')),
230
+ });
231
+ $('#designs-btn').onclick = () => designsUi.open();
232
+ // Value: what the delivered work is worth, for you and for management.
233
+ const valueUi = initValue({ api, $, esc, toast: (m, ms) => toast(m, ms), openAgent: (id) => (showTab('agents'), select(id)) });
234
+ $('#value-btn').onclick = () => valueUi.open();
184
235
  // Keyboard shortcuts (keys.js): the same actions as the buttons.
185
236
  const keysUi = initKeys({ $, esc, run: (act) => shortcut(act) });
186
237
  $('#keys-btn').onclick = () => keysUi.help();
@@ -220,6 +271,11 @@ function shortcut(act) {
220
271
  return $('#filter').select();
221
272
  }
222
273
  if (act === 'watch') return $('#watch-btn') ? $('#watch-btn').click() : false;
274
+ if (act === 'standup') return standupUi.open();
275
+ if (act === 'map') return $('#map-btn').click();
276
+ if (act === 'issues') return issuesUi.open();
277
+ if (act === 'designs') return designsUi.open();
278
+ if (act === 'value') return valueUi.open();
223
279
  if (act.startsWith('tab:')) return showTab(act.slice(4));
224
280
  return false;
225
281
  }
@@ -354,7 +410,11 @@ function reviewBox(a) {
354
410
  if (noRepo(a)) return { button: '', box: '' };
355
411
  const r = a.aiReview;
356
412
  const button = `<button class="small" data-act="review" ${r?.pending ? 'disabled' : ''}
357
- title="Check the work against the intent and brief: what is met, missing or risky. A separate one-off model call; runs by itself when the agent says it is done">${r?.pending ? 'Reviewing…' : 'Review with AI'}</button>`;
413
+ title="Check the work against the intent and brief: what is met, missing or risky. A separate one-off model call; runs by itself when the agent says it is done">${r?.pending ? 'Reviewing…' : 'Review with AI'}</button>${
414
+ r?.verdict || a.prs?.some((p) => p.source !== 'mentioned' && p.state)
415
+ ? listenHtml(`prvoice:${a.id}`, { title: 'Explain the review aloud: the PR, its checks, the AI review, the riskiest changes and what is left', label: 'Explain review' })
416
+ : ''
417
+ }`;
358
418
  // An unhandled review shows as a card above the brief; a handled one stays here, compact.
359
419
  if (!r?.verdict || !r.seen) return { button, box: '' };
360
420
  return {
@@ -668,6 +728,7 @@ bindListen((id) => {
668
728
  else if (what === 'walk') parts = reviewUi.listenParts();
669
729
  else if (what === 'score') parts = a?.docs?.scorecard?.data ? scorecardSpeech(a.docs.scorecard) : null;
670
730
  else if (what === 'sidewalk') parts = sidePane?.listenParts();
731
+ else if (what === 'prvoice') parts = reviewSpeech(a, issuesUi.about(agentId));
671
732
  if (!parts?.length || !play(id, parts)) toast('Nothing to read aloud here (or this browser has no speech)');
672
733
  });
673
734
 
@@ -2172,6 +2233,7 @@ const VIEWS = {
2172
2233
  detail: () => renderDetail(),
2173
2234
  overlay: () => term.syncOverlay(),
2174
2235
  watch: () => watchUi?.render(),
2236
+ standup: () => standupUi?.render(),
2175
2237
  };
2176
2238
  const ALL_VIEWS = Object.keys(VIEWS);
2177
2239
 
@@ -4074,6 +4136,20 @@ function handleEvent(msg) {
4074
4136
  else if (agents.get(selectedId).runtime.running) term.open(selectedId);
4075
4137
  }
4076
4138
  openTermOnLoad = false;
4139
+ if (mapOnLoad && !watchShown) {
4140
+ watchShown = true;
4141
+ mapUi.show(true);
4142
+ }
4143
+ if (valueOnLoad && !watchShown) {
4144
+ watchShown = true;
4145
+ history.replaceState(null, '', '#');
4146
+ valueUi.open();
4147
+ }
4148
+ if (standupOnLoad && !watchShown) {
4149
+ watchShown = true;
4150
+ history.replaceState(null, '', '#');
4151
+ standupUi.open();
4152
+ }
4077
4153
  if (watchOnLoad && !watchUi.isOpen() && !watchShown) {
4078
4154
  watchShown = true;
4079
4155
  watchUi.show(true);
@@ -4084,10 +4160,13 @@ function handleEvent(msg) {
4084
4160
  watchDocs(msg.agent);
4085
4161
  agentChanged(msg.agent);
4086
4162
  if (msg.agent.builds) builtUi.sessionChanged(msg.agent);
4163
+ issuesUi.changed();
4164
+ designsUi.changed();
4087
4165
  // The detail, terminal and document views show one agent; another agent's update leaves them be.
4088
4166
  return invalidate([
4089
4167
  'list', 'backlog', 'land', 'inbox', 'race', 'team',
4090
4168
  ...(watchUi.isOpen() ? ['watch'] : []),
4169
+ ...(standupUi.isOpen() ? ['standup'] : []),
4091
4170
  ...(docView?.agentId === id ? ['doc'] : []),
4092
4171
  ...(id === selectedId || msg.agent.forkOf?.agentId === selectedId ? ['detail'] : []),
4093
4172
  ...(id === term.agentId ? ['overlay'] : []),
@@ -4103,6 +4182,11 @@ function handleEvent(msg) {
4103
4182
  teams.set(msg.team.id, msg.team);
4104
4183
  } else if (msg.t === 'team-removed') {
4105
4184
  teams.delete(msg.id);
4185
+ } else if (msg.t === 'value') {
4186
+ valueUi.changed();
4187
+ } else if (msg.t === 'standup') {
4188
+ standupUi.set(msg.latest);
4189
+ if (msg.latest?.reason === 'scheduled' && msg.latest.items.length) toast('Standup ready: press Standup (or p) to play it', 8000);
4106
4190
  } else if (msg.t === 'rules') {
4107
4191
  rulesState = msg.rules;
4108
4192
  } else if (msg.t === 'repeats') {
@@ -4457,6 +4541,7 @@ async function loadAssistant({ fill = true } = {}) {
4457
4541
  f.maxPerDay.value = a.maxPerDay;
4458
4542
  f.maxRunning.value = a.maxRunning;
4459
4543
  f.notes.value = a.notes ?? '';
4544
+ f.pickIssues.checked = Boolean(a.pickIssues);
4460
4545
  }
4461
4546
  const state = !a.agentId ? 'Not set up yet. Start it to create its session.' : a.on ? (a.busy ? 'On: checking now.' : 'On.') : 'Paused: not checking.';
4462
4547
  $('#assistant-status').innerHTML = `<p><b>${esc(state)}</b>
@@ -4479,6 +4564,7 @@ const assistantPatch = (f) => ({
4479
4564
  maxPerDay: Number(f.maxPerDay.value),
4480
4565
  maxRunning: Number(f.maxRunning.value),
4481
4566
  notes: f.notes.value,
4567
+ pickIssues: f.pickIssues.checked,
4482
4568
  });
4483
4569
  const assistantError = (err) => {
4484
4570
  $('#assistant-error').textContent = err.message;
@@ -0,0 +1,209 @@
1
+ // Map: a repository's folders as tiles sized by their files, with each agent as a badge on the
2
+ // folders it is changing (solid) or reading (ring) now. A red line joins two agents that changed
3
+ // the same file; a dashed one runs from an agent reading a file to the agent that changed it.
4
+
5
+ const SAVED = 'agentmgr.mapProject';
6
+ const EVERY_MS = 8000;
7
+
8
+ const hue = (id) => [...String(id)].reduce((h, c) => (h * 31 + c.charCodeAt(0)) % 360, 17);
9
+ const initials = (name) => String(name).split(/[^a-z0-9]+/i).filter(Boolean).slice(0, 2).map((w) => w[0].toUpperCase()).join('') || '?';
10
+
11
+ /** Squarified treemap: items [{ weight }] into the rectangle, as [{ x, y, w, h, item }]. */
12
+ export function squarify(items, x, y, w, h) {
13
+ const total = items.reduce((s, i) => s + i.weight, 0);
14
+ if (!items.length || total <= 0 || w <= 0 || h <= 0) return [];
15
+ const scale = (w * h) / total;
16
+ const out = [];
17
+ let rest = items.map((item) => ({ item, area: item.weight * scale }));
18
+ const worst = (row, side) => {
19
+ const s = row.reduce((a, r) => a + r.area, 0);
20
+ const max = Math.max(...row.map((r) => r.area));
21
+ const min = Math.min(...row.map((r) => r.area));
22
+ return Math.max((side * side * max) / (s * s), (s * s) / (side * side * min));
23
+ };
24
+ while (rest.length) {
25
+ const side = Math.min(w, h);
26
+ let row = [rest[0]];
27
+ let i = 1;
28
+ while (i < rest.length && worst([...row, rest[i]], side) <= worst(row, side)) row.push(rest[i++]);
29
+ rest = rest.slice(i);
30
+ const s = row.reduce((a, r) => a + r.area, 0);
31
+ if (w >= h) {
32
+ const rw = s / h;
33
+ let yy = y;
34
+ for (const r of row) {
35
+ const rh = r.area / rw;
36
+ out.push({ x, y: yy, w: rw, h: rh, item: r.item });
37
+ yy += rh;
38
+ }
39
+ x += rw;
40
+ w -= rw;
41
+ } else {
42
+ const rh = s / w;
43
+ let xx = x;
44
+ for (const r of row) {
45
+ const rw = r.area / rh;
46
+ out.push({ x: xx, y, w: rw, h: rh, item: r.item });
47
+ xx += rw;
48
+ }
49
+ y += rh;
50
+ h -= rh;
51
+ }
52
+ }
53
+ return out;
54
+ }
55
+
56
+ export function initCodeMap({ api, $, esc, agents, openAgent, toast }) {
57
+ const view = $('#map-view');
58
+ let open = false;
59
+ let data = null;
60
+ let timer = null;
61
+ let project = null;
62
+ try {
63
+ project = localStorage.getItem(SAVED) || null;
64
+ } catch {}
65
+
66
+ const nameOf = (id) => data?.map.agents.find((a) => a.id === id)?.name ?? agents.get(id)?.name ?? id;
67
+ const color = (id) => `hsl(${hue(id)} 70% 55%)`;
68
+
69
+ async function load() {
70
+ try {
71
+ data = await api('GET', `/codemap${project ? `?project=${encodeURIComponent(project)}` : ''}`);
72
+ if (data.project && data.project.key !== project) project = data.project.key;
73
+ } catch (e) {
74
+ toast?.(e.message, 5000);
75
+ }
76
+ draw();
77
+ }
78
+
79
+ function sentence(l) {
80
+ const a = `<button class="link" data-map-open="${esc(l.a)}">${esc(nameOf(l.a))}</button>`;
81
+ const b = `<button class="link" data-map-open="${esc(l.b)}">${esc(nameOf(l.b))}</button>`;
82
+ const files = l.files.slice(0, 3).map((f) => `<code>${esc(f)}</code>`).join(', ') + (l.files.length > 3 ? ` and ${l.files.length - 3} more` : '');
83
+ if (l.kind === 'collide') return `<li class="collide">${a} and ${b} both changed ${files}: they will conflict when merged.</li>`;
84
+ if (l.kind === 'heading') return `<li class="heading">${a} is reading ${files}, which ${b} changed: heading for the same code.</li>`;
85
+ return '';
86
+ }
87
+
88
+ function draw() {
89
+ if (!open) return;
90
+ const m = data?.map;
91
+ const projects = data?.projects ?? [];
92
+ $('#map-bar').innerHTML = `
93
+ <b>Map</b>
94
+ ${projects.length ? `<select data-map-set="project" aria-label="Project">${projects.map((p) => `<option value="${esc(p.key)}" ${p.key === data?.project?.key ? 'selected' : ''}>${esc(p.name)} (${p.running} running)</option>`).join('')}</select>` : ''}
95
+ <span class="map-legend"><span class="map-key solid"></span>changing <span class="map-key ring"></span>reading <span class="map-key red"></span>same file changed <span class="map-key dash"></span>reading what another changed</span>
96
+ <span class="spacer"></span>
97
+ <button class="small" data-map="refresh" title="Look again now (it refreshes every few seconds)">↻</button>
98
+ <button class="small" data-map="close" title="Back (Esc)">Close</button>`;
99
+ const warn = (m?.links ?? []).filter((l) => l.kind !== 'near');
100
+ $('#map-warn').innerHTML = warn.length ? `<ul>${warn.map(sentence).join('')}</ul>` : m?.agents.length ? '<p class="hint">No agents are on the same code.</p>' : '';
101
+ const box = $('#map-box');
102
+ if (!m || !m.agents.length) {
103
+ box.innerHTML = `<p class="hint map-empty">${data?.project ? 'No agent in this project is running or has changes yet.' : 'No agents with a repository yet.'}</p>`;
104
+ $('#map-agents').innerHTML = '';
105
+ return;
106
+ }
107
+ // Folders with agents in them get room to show their badges.
108
+ const items = m.modules.map((mod) => ({ ...mod, weight: Math.max(1, mod.files) + (mod.agents.length ? 6 + 4 * mod.agents.length : 0) }));
109
+ const W = box.clientWidth;
110
+ const H = Math.max(320, view.clientHeight - box.offsetTop - $('#map-agents').offsetHeight - 24);
111
+ box.style.height = `${H}px`;
112
+ // Small folders past the first hundred go into one tile.
113
+ const big = items.slice(0, 100);
114
+ const rest = items.slice(100);
115
+ if (rest.length) big.push({ key: `${rest.length} more folders`, files: rest.reduce((s, x) => s + x.files, 0), agents: rest.flatMap((x) => x.agents), weight: rest.reduce((s, x) => s + x.weight, 0), more: true });
116
+ const rects = squarify(big, 0, 0, W, H);
117
+ // Agents in a collision get a red ring, ones heading for one a yellow ring.
118
+ const ring = new Map();
119
+ for (const l of m.links) {
120
+ if (l.kind === 'collide') for (const id of [l.a, l.b]) ring.set(id, 'collide');
121
+ if (l.kind === 'heading' && ring.get(l.a) !== 'collide') ring.set(l.a, 'heading');
122
+ }
123
+ const tiles = rects.map(({ x, y, w, h, item }) => {
124
+ const busy = item.agents.length;
125
+ const badges = item.agents.map((x2) => {
126
+ const a = m.agents.find((z) => z.id === x2.id);
127
+ const cls = [x2.changed ? 'solid' : 'ring', a?.busy ? 'busy' : '', a?.attention ? 'needs' : '', ring.get(x2.id) ?? ''].join(' ');
128
+ return `<span class="map-badge ${cls}" data-badge="${esc(x2.id)}" data-mod="${esc(item.key)}" style="--c:${color(x2.id)}" title="${esc(`${nameOf(x2.id)}: ${x2.changed} changed, ${x2.reading} reading here`)}">${esc(initials(nameOf(x2.id)))}</span>`;
129
+ }).join('');
130
+ return `<div class="map-tile ${busy ? 'active' : ''} ${item.more ? 'more' : ''}" style="left:${x}px;top:${y}px;width:${w}px;height:${h}px" title="${esc(`${item.key}: ${item.files} files`)}">
131
+ ${w > 46 && h > 22 ? `<span class="map-name">${esc(item.key === '.' ? '(top level)' : item.key)}</span>` : ''}
132
+ ${w > 46 && h > 38 ? `<span class="map-count">${item.files}</span>` : ''}
133
+ <span class="map-badges">${badges}</span>
134
+ </div>`;
135
+ }).join('');
136
+ box.innerHTML = `${tiles}<svg class="map-links" width="${W}" height="${H}"></svg>`;
137
+ drawLinks(m.links);
138
+ $('#map-agents').innerHTML = m.agents.map((a) => `<button class="map-agent" data-map-open="${esc(a.id)}" style="--c:${color(a.id)}"><span class="map-badge solid ${a.busy ? 'busy' : ''} ${a.attention ? 'needs' : ''}" style="--c:${color(a.id)}">${esc(initials(a.name))}</span>${esc(a.name)} <span class="hint">${a.changed} changed · ${a.reading} reading</span></button>`).join('');
139
+ }
140
+
141
+ /** Lines between badges: in the folder of the first shared file, else their nearest badges. */
142
+ function drawLinks(links) {
143
+ const box = $('#map-box');
144
+ const svg = box.querySelector('svg');
145
+ const origin = box.getBoundingClientRect();
146
+ const center = (el) => {
147
+ const r = el.getBoundingClientRect();
148
+ return [r.left - origin.left + r.width / 2, r.top - origin.top + r.height / 2];
149
+ };
150
+ const badges = (id) => [...box.querySelectorAll(`[data-badge="${CSS.escape(id)}"]`)];
151
+ const lines = [];
152
+ for (const l of links.filter((x) => x.kind !== 'near')) {
153
+ const A = badges(l.a);
154
+ const B = badges(l.b);
155
+ if (!A.length || !B.length) continue;
156
+ let best = null;
157
+ for (const p of A) for (const q of B) {
158
+ const [x1, y1] = center(p);
159
+ const [x2, y2] = center(q);
160
+ const d = Math.hypot(x2 - x1, y2 - y1) - (p.dataset.mod === q.dataset.mod ? 1e6 : 0);
161
+ if (!best || d < best.d) best = { d, x1, y1, x2, y2 };
162
+ }
163
+ lines.push(`<line class="${l.kind}" x1="${best.x1}" y1="${best.y1}" x2="${best.x2}" y2="${best.y2}"><title>${esc(l.files.join(', '))}</title></line>`);
164
+ }
165
+ svg.innerHTML = lines.join('');
166
+ }
167
+
168
+ function show(on) {
169
+ open = on;
170
+ view.hidden = !on;
171
+ document.body.classList.toggle('mapping', on);
172
+ $('#map-btn')?.classList.toggle('active', on);
173
+ clearInterval(timer);
174
+ if (on) {
175
+ history.replaceState(null, '', '#map');
176
+ load();
177
+ timer = setInterval(() => document.visibilityState === 'visible' && load(), EVERY_MS);
178
+ } else if (location.hash === '#map') history.replaceState(null, '', '#');
179
+ }
180
+
181
+ view.addEventListener('click', (e) => {
182
+ const o = e.target.closest('[data-map-open]');
183
+ if (o) {
184
+ show(false);
185
+ return openAgent(o.dataset.mapOpen);
186
+ }
187
+ const b = e.target.closest('[data-map]');
188
+ if (b?.dataset.map === 'close') return show(false);
189
+ if (b?.dataset.map === 'refresh') return load();
190
+ });
191
+ view.addEventListener('change', (e) => {
192
+ if (e.target.dataset.mapSet !== 'project') return;
193
+ project = e.target.value;
194
+ try {
195
+ localStorage.setItem(SAVED, project);
196
+ } catch {}
197
+ load();
198
+ });
199
+ document.addEventListener('keydown', (e) => {
200
+ if (open && e.key === 'Escape' && !document.querySelector('dialog[open]')) show(false);
201
+ });
202
+ let resizeTimer = null;
203
+ window.addEventListener('resize', () => {
204
+ clearTimeout(resizeTimer);
205
+ resizeTimer = setTimeout(draw, 100);
206
+ });
207
+
208
+ return { show, isOpen: () => open };
209
+ }