ai-agentmanager 1.37.0 → 1.39.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,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.39.0 (2026-11-11)
4
+
5
+ - **Limits: agents carry on after a usage limit.** When an engine stops at a usage limit or exhausted quota ("5-hour limit reached ∙ resets 3pm", Codex's "try again at 3:05 PM") or a busy or failing service (429, 529 overloaded, 5xx), the inbox shows a **Limit** card with the message and when it resets, read in the time zone it names. A minute after the reset the agent is told to continue (a busy service: after 5 minutes), at most three times an hour; `"limits": { "autoResume": false }` turns that off. **Continue now** does it at once.
6
+ - **Continue on another engine.** From the Limit card, **Continue on Codex** (or any other installed engine), or `agentmgr continue-on <agent> <engine>`: a new agent in the same folder and branch, started with the request, the brief and the end of the conversation. It owns the folder from then on; the old agent is closed, says where the work went, and deleting it leaves the folder.
7
+ - **Approval rules for every repo.** Once you've allowed a command in 2 repos, the inbox offers it for every repo; accepted, agents in any repo stop asking about it.
8
+ - **Read-only commands never ask:** `ls`, `pwd`, `wc`, `git status`, `git diff`, `git log`, `git show`, `git blame`, `git rev-parse`, in every repo (plain commands only; chained or redirected ones still ask). `"rules": { "readOnly": false }` turns it off.
9
+ - **Codex agents learn approval rules too:** their "run the following command?" prompt names the command in the inbox, your yeses count toward a rule, and allowed rules answer them.
10
+ - **Close idle sessions after hours.** Settings → Open agents → "Close sessions idle for N hours" (or `agentmgr cleanup --idle-hours 4`): open sessions quiet that long close on the same rules as the open-agent limit, and resume with their conversation when you open them. Off by default.
11
+
12
+ ## 1.38.0 (2026-11-11)
13
+
14
+ - **The top bar fits the window.** View buttons that don't fit go, in order, into a **More ▾** menu at the end of the row (with a dot when one of them has a count); the filter gives up its room first, and below 1100px the title and connection text step aside for the logo and a coloured dot. **+ New agents** and your menu always stay in view.
15
+ - **Split screen: one session in two views.** When a session shows in more than one place (the main panel, a group, another window), the view you type in or click sets its size; the others show it at that size with the font scaled to fit, instead of wrapping oddly.
16
+ - **Split screen keys**, also from inside a terminal: **Cmd+\\** on a Mac or **Ctrl+Shift+\\** splits right (add Shift on a Mac, or Alt, to split down), **Ctrl+Shift+1…6** goes to a group, **Ctrl+Shift+X** closes the active one. They're listed under **?**.
17
+ - Fixed: plain **Ctrl+\\** in a terminal split the screen *and* reached the agent as Ctrl+\\, a quit key. It now only goes to the terminal.
18
+ - Fixed: a terminal reconnecting in the main panel took the keyboard away from the split-screen group you were working in.
19
+ - Tests now drive the page in headless Chrome (`test/browser.test.js`, skipped without Chrome): the top bar at several widths, and the split screen end to end.
20
+
3
21
  ## 1.37.0 (2026-11-10)
4
22
 
5
23
  - **Split screen, as in VS Code.** The area beside the agents list splits right or down into groups, each showing an agent's session or one of its shells, next to the usual panel with the agent's details. Split with **⊞ Split screen** in the terminal bar, **Ctrl+\\** (Ctrl+Shift+\\ splits down) or the buttons on a group; up to six groups. Load a session into a group by dragging an agent onto it (onto its right or bottom edge to split there), from the group's menu (open sessions first), or by clicking an agent in the list while that group is active. In a group you can switch to its shells or open a new one, resume a closed session, or move it to the main panel. Dividers resize; the layout and what each group shows are kept per browser. Narrow screens show the main panel only.
package/README.md CHANGED
@@ -613,7 +613,9 @@ The **Inbox** tab (and `agentmgr inbox`) lists what needs you, across all agents
613
613
 
614
614
  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`.
615
615
 
616
- **Fewer questions: approval rules.** Each yes you give a permission prompt counts toward the command, per repo (`npm test`, `pytest`, `git status`; an MCP tool; fetching from a site). After 3, the inbox offers to always allow it there. An allowed rule goes to every agent in that repo when it starts (Claude Code's `--allowedTools`), and answers its prompts that are already open, so you aren't asked again. Rules are never offered for commands that chain, redirect or substitute (`&&`, `|`, `>`, `$(…)`), or that delete, escalate, publish or reach the network (`rm`, `sudo`, `git push`, `npm publish`, `curl`…). Settings → Approval rules (or `agentmgr rules`) lists them with how many prompts each answered; **Remove** to be asked again. Stored in `~/.agentmanager/rules.json`; In config.json, `"rules": { "auto": false }` stops rules answering open prompts and `"rules": { "suggestAfter": 5 }` changes the count. Claude Code agents only for now.
616
+ **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.
617
+
618
+ **Fewer questions: approval rules.** Each yes you give a permission prompt counts toward the command, per repo (`npm test`, `pytest`, `git status`; an MCP tool; fetching from a site). After 3, the inbox offers to always allow it there. An allowed rule goes to every agent in that repo when it starts (Claude Code's `--allowedTools`), and answers its prompts that are already open, so you aren't asked again. Rules are never offered for commands that chain, redirect or substitute (`&&`, `|`, `>`, `$(…)`), or that delete, escalate, publish or reach the network (`rm`, `sudo`, `git push`, `npm publish`, `curl`…). Settings → Approval rules (or `agentmgr rules`) lists them with how many prompts each answered; **Remove** to be asked again. Stored in `~/.agentmanager/rules.json`; In config.json, `"rules": { "auto": false }` stops rules answering open prompts and `"rules": { "suggestAfter": 5 }` changes the count. Once a rule is allowed in 2 repos, the inbox offers it for every repo. A few commands that only look (`ls`, `pwd`, `wc`, `git status`, `git diff`, `git log`, `git show`, `git blame`, `git rev-parse`) never ask in any repo; `"rules": { "readOnly": false }` turns that off. Claude Code and Codex agents learn rules (Codex from the command its prompt shows).
617
619
 
618
620
  **Questions without stopping.** Task agents are told to write questions that don't block all their work to `QUESTIONS.md` next to their brief, with options and the default they'll assume meanwhile, and then keep going:
619
621
 
@@ -1078,6 +1080,8 @@ Agents closed before clean up was turned on count as closed from the first check
1078
1080
 
1079
1081
  **A limit on open agents.** Many open sessions slow the machine down. In **☰ → Settings** (or `agentmgr cleanup --max-open 12`), set how many agents may be open at once: above it, the agents idle longest are closed, and they resume when you open them. Never closed for the limit: agents working, waiting for your answer, active in the last 5 minutes, marked **Keep**, or in a team that is still going. Off by default (`--max-open off`).
1080
1082
 
1083
+ **Closing idle sessions.** In the same place (or `agentmgr cleanup --idle-hours 4`), set how many hours an open session may sit idle: after that it is closed, on the same rules as the limit, and it resumes with its conversation when you open it. Off by default (`--idle-hours off`).
1084
+
1081
1085
  ## Saving state: flush and restart
1082
1086
 
1083
1087
  - **What's saved immediately.** Agent records (session IDs, settings, links) are written to `state.json` on every change, fsynced, then atomically replaced. Claude writes each conversation to its own transcript as it goes.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-agentmanager",
3
- "version": "1.37.0",
3
+ "version": "1.39.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
@@ -26,7 +26,8 @@ import { initSupport } from '/support.js';
26
26
  import { initCode } from '/code.js';
27
27
  import { initMachine } from '/machine.js';
28
28
  import { initWatch } from '/watch.js';
29
- import { initGroups } from '/groups.js';
29
+ import { initGroups, followSize, scaleToFit, leadSize } from '/groups.js';
30
+ import { initTopNav } from '/topnav.js';
30
31
  import { initStandup } from '/standup.js';
31
32
  import { initIssues } from '/issues.js';
32
33
  import { initActions } from '/actions.js';
@@ -1384,11 +1385,23 @@ function flags(a) {
1384
1385
  }
1385
1386
 
1386
1387
  const TRIAGED = { now: 'sent (AI: urgent)', digest: 'held for the digest', skip: 'dropped by the AI judge' };
1387
- const NEED_ORDER = { approval: 0, prompt: 0, waiting: 1, plan: 1, question: 1, team: 1, rule: 2, review: 2, autopilot: 2, stuck: 3, conflict: 4, reminder: 5, close: 5, repeat: 5 };
1388
+ // Engines a limited agent can carry on with (installed ones), loaded once when a limit card shows.
1389
+ let limitEngines = null;
1390
+ function loadLimitEngines() {
1391
+ limitEngines = [];
1392
+ api('GET', '/engines')
1393
+ .then((list) => {
1394
+ limitEngines = list;
1395
+ renderInbox();
1396
+ })
1397
+ .catch(() => (limitEngines = null));
1398
+ }
1399
+ const NEED_ORDER = { approval: 0, prompt: 0, limit: 1, waiting: 1, plan: 1, question: 1, team: 1, rule: 2, review: 2, autopilot: 2, stuck: 3, conflict: 4, reminder: 5, close: 5, repeat: 5 };
1388
1400
  /** What an agent needs from the user. `both`: overlaps on both agents (detail), else only the one that should rebase (inbox). */
1389
1401
  function needsFor(a, { both = false } = {}) {
1390
1402
  const items = [];
1391
1403
  if (a.runtime.attention) items.push({ a, kind: 'prompt', key: `prompt:${a.id}` });
1404
+ if (a.runtime.limited) items.push({ a, kind: 'limit', key: `limit:${a.id}` });
1392
1405
  if (a.runtime.waiting) items.push({ a, kind: 'waiting', key: `waiting:${a.id}` });
1393
1406
  if (a.planReview?.status === 'review') items.push({ a, kind: 'plan', key: `plan:${a.id}` });
1394
1407
  if (a.aiReview?.verdict && !a.aiReview.seen) items.push({ a, kind: 'review', key: `review:${a.id}` });
@@ -1410,7 +1423,7 @@ function approvalNeeds() {
1410
1423
  return builtReports.flatMap((r) => r.pending.map((p) => ({ a: { id: r.key, name: r.title, priority: 1 }, kind: 'approval', key: `approval:${r.key}:${p.id}`, r, p })));
1411
1424
  }
1412
1425
  /** The repo a rule belongs to, short: its last two path parts. */
1413
- const repoLabel = (k) => String(k).replace(/^dir:/, '').split('/').filter(Boolean).slice(-2).join('/');
1426
+ const repoLabel = (k) => (k === '*' ? 'every repo' : String(k).replace(/^dir:/, '').split('/').filter(Boolean).slice(-2).join('/'));
1414
1427
  /** Commands you keep allowing in a repo, offered as a standing rule. */
1415
1428
  function ruleNeeds() {
1416
1429
  return rulesState.suggestions.map((r) => ({ a: { id: 'rules', name: repoLabel(r.repo), priority: 2 }, kind: 'rule', key: `rule:${r.repo}:${r.rule}`, r }));
@@ -1430,7 +1443,7 @@ function inboxItems() {
1430
1443
  .sort((x, y) => NEED_ORDER[x.kind] - NEED_ORDER[y.kind] || (x.a.priority ?? 2) - (y.a.priority ?? 2));
1431
1444
  }
1432
1445
 
1433
- const NEED_LABEL = { 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', stuck: 'Stuck?', conflict: 'Overlap' };
1446
+ 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', stuck: 'Stuck?', conflict: 'Overlap' };
1434
1447
  /** Why the AI judge thinks so, as a small tag. */
1435
1448
  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>`;
1436
1449
  /** What a permission prompt asks about: the command, file or tool. */
@@ -1485,7 +1498,10 @@ function needCard(it, { inDetail = false } = {}) {
1485
1498
  <p class="hint">${esc(it.it.autopilot.note ?? '')}</p>
1486
1499
  <div class="need-actions"><button class="small primary" data-ib="ap-review">Review changes</button><button class="small" data-ib="ap-ship" title="Commit, push and open its pull request (and merge it, at the Merge level)">Ship it</button><button class="small" data-ib="ap-reopen">Send back…</button>${improveHtml(agents.get(it.it.agentId)).replace('small primary', 'small')}</div>`;
1487
1500
  } else if (it.kind === 'rule') {
1488
- body = `<p class="need-title">You've allowed <code>${esc(it.r.label)}</code> ${it.r.n} times in this repo. Always allow it here?</p>
1501
+ body = it.r.everywhere
1502
+ ? `<p class="need-title">You always allow <code>${esc(it.r.label)}</code> in ${it.r.n} repos. Allow it in every repo?</p>
1503
+ <p class="hint">Agents in any repo won't ask about it again. Remove it any time in Settings → Approval rules.</p>`
1504
+ : `<p class="need-title">You've allowed <code>${esc(it.r.label)}</code> ${it.r.n} times in this repo. Always allow it here?</p>
1489
1505
  <p class="hint">Agents in ${esc(a.name)} won't ask about it again. Remove it any time in Settings → Approval rules.</p>
1490
1506
  <div class="need-actions"><button class="small primary" data-ib="rule-accept">Always allow</button><button class="small" data-ib="rule-dismiss">Not now</button></div>`;
1491
1507
  } else if (it.kind === 'prompt') {
@@ -1496,6 +1512,14 @@ function needCard(it, { inDetail = false } = {}) {
1496
1512
  <button class="small" data-ib="key" data-key="esc" title="Escape">Esc</button>
1497
1513
  <button class="small ghost" data-ib="terminal">Open terminal</button>
1498
1514
  </div>`;
1515
+ } else if (it.kind === 'limit') {
1516
+ const l = a.runtime.limited;
1517
+ const when = l.resetAt ? new Date(l.resetAt).toLocaleString([], { weekday: 'short', hour: 'numeric', minute: '2-digit' }) : null;
1518
+ const others = (limitEngines ?? []).filter((e) => e.installed && e.id !== (a.engine ?? 'claude'));
1519
+ if (!limitEngines) loadLimitEngines();
1520
+ body = `<p class="need-title">${esc(l.text)}</p>
1521
+ <p class="hint">${l.resumedAt ? `Told it to continue ${ago(l.resumedAt)}.` : when ? `It continues by itself ${l.kind === 'busy' ? 'at' : 'after the reset,'} ${esc(when)}.` : 'No reset time on screen: continue it yourself, or carry the work on with another engine.'}${others.length ? ' Another engine picks up the same folder and branch, with the request, the brief and the end of the conversation.' : ''}</p>
1522
+ <div class="need-actions"><button class="small" data-ib="limit-resume" title="Type &quot;continue&quot; now">Continue now</button>${others.map((e) => `<button class="small" data-ib="limit-switch" data-engine="${esc(e.id)}">Continue on ${esc(e.label)}</button>`).join('')}<button class="small ghost" data-ib="terminal">Open terminal</button></div>`;
1499
1523
  } else if (it.kind === 'waiting') {
1500
1524
  const w = a.runtime.waiting;
1501
1525
  body = `<p class="need-title">${esc(w.question || w.summary)} ${aiTag(w.confidence, w.state === 'error' ? 'looks like an error' : 'read from its screen')}</p>
@@ -1683,7 +1707,18 @@ async function onNeed(e) {
1683
1707
  return act(async () => {
1684
1708
  rulesState = await api('POST', `/rules/${accept ? 'accept' : 'dismiss'}`, { repo, rule });
1685
1709
  renderInbox();
1686
- }, accept ? 'Allowed in this repo; agents there won\'t ask again' : 'Won\'t suggest it again');
1710
+ }, accept ? (repo === '*' ? "Allowed in every repo; agents won't ask again" : 'Allowed in this repo; agents there won\'t ask again') : 'Won\'t suggest it again');
1711
+ }
1712
+ case 'limit-resume':
1713
+ return act(async () => upsert(await api('POST', `/agents/${id}/tell`, { text: 'Continue where you left off.' })), 'Told it to continue');
1714
+ case 'limit-switch': {
1715
+ const label = el.textContent.replace(/^Continue on /, '');
1716
+ return act(async () => {
1717
+ const n = await api('POST', `/agents/${id}/continue-on`, { engine: el.dataset.engine });
1718
+ upsert(n);
1719
+ showTab('agents');
1720
+ select(n.id);
1721
+ }, `Continuing on ${label}`);
1687
1722
  }
1688
1723
  case 'terminal':
1689
1724
  showTab('agents');
@@ -2221,7 +2256,10 @@ function renderDetail() {
2221
2256
  ${a.desktop && !running ? `<p class="hint">Continued in the <b>Claude desktop app</b> ${ago(a.desktop.at)}. Messages for it wait here; <b>Resume</b> picks up what was said there (close it in the desktop app first).</p>` : ''}
2222
2257
  ${a.movedTo ? `<p class="hint">Moved to <b>${esc(a.movedTo.machine)}</b> ${ago(a.movedTo.at)}: it continues there with the same conversation and work. This copy stays closed; delete it when you no longer need its folder.</p>` : ''}
2223
2258
  ${a.movedFrom ? `<p class="hint">Moved here from <b>${esc(a.movedFrom.machine ?? 'another machine')}</b> ${ago(a.movedFrom.at)}, with its conversation and uncommitted work.</p>` : ''}
2259
+ ${a.continuedOn ? `<p class="hint">Continued on ${esc(a.continuedOn.label ?? a.continuedOn.engine)} as <a href="#${a.continuedOn.agentId}" data-goto="${a.continuedOn.agentId}">${esc(a.continuedOn.name)}</a> ${ago(a.continuedOn.at)}, in the same folder and branch.</p>` : ''}
2260
+ ${a.continuesFrom ? `<p class="hint">Carries on <a href="#${a.continuesFrom.agentId}" data-goto="${a.continuesFrom.agentId}">${esc(a.continuesFrom.name)}</a>'s work (it ran on ${esc(a.continuesFrom.label ?? a.continuesFrom.engine)}), from ${ago(a.continuesFrom.at)}.</p>` : ''}
2224
2261
  ${!running && a.closedBy === 'cap' ? `<p class="hint">Closed ${ago(a.closedAt)} to stay under the limit on open agents (Settings), as the one idle longest. Resume it any time${a.keep ? '' : ', or mark it Keep'}.</p>` : ''}
2262
+ ${!running && a.closedBy === 'idle' ? `<p class="hint">Closed ${ago(a.closedAt)} after a few hours with no activity (Settings). Resume it any time, with its conversation${a.keep ? '' : ', or mark it Keep'}.</p>` : ''}
2225
2263
  ${!running && a.closedBy === 'cleanup' ? `<p class="hint">Closed by clean up ${ago(a.closedAt)}, after a while with no activity. Resume it any time${a.keep ? '' : ', or mark it Keep'}.</p>` : ''}
2226
2264
  ${a.status === 'preparing'
2227
2265
  ? `<div class="progress-box">
@@ -2449,10 +2487,12 @@ const term = {
2449
2487
  // answers are stale, and the program would get them as typing.
2450
2488
  if (this.replaying) return;
2451
2489
  lastTyped = Date.now();
2490
+ this.lead();
2452
2491
  this.send({ t: 'i', d });
2453
2492
  });
2454
- this.xterm.onResize(({ cols, rows }) => this.send({ t: 'r', cols, rows }));
2455
- new ResizeObserver(() => this.refit()).observe($('#terminal'));
2493
+ // Shown in a split-screen group too (or another window): the view typed in sets the size.
2494
+ this.xterm.onResize(({ cols, rows }) => !this.follow && this.send({ t: 'r', cols, rows }));
2495
+ new ResizeObserver(() => (this.follow ? scaleToFit(this, $('#terminal')) : this.refit())).observe($('#terminal'));
2456
2496
  touchScroll($('#terminal'), this.xterm);
2457
2497
  },
2458
2498
 
@@ -2460,8 +2500,13 @@ const term = {
2460
2500
  this.conn?.send(msg);
2461
2501
  },
2462
2502
 
2503
+ follow: false,
2504
+ lead() {
2505
+ leadSize(this, () => this.fit.fit(), (m) => this.send(m));
2506
+ },
2507
+
2463
2508
  refit() {
2464
- if (!this.agentId) return;
2509
+ if (!this.agentId || this.follow) return;
2465
2510
  try {
2466
2511
  this.fit.fit();
2467
2512
  } catch {}
@@ -2489,6 +2534,8 @@ const term = {
2489
2534
  this.agentId = id;
2490
2535
  this.kind = kind;
2491
2536
  this.shellExited = false;
2537
+ this.follow = false;
2538
+ this.xterm.options.fontSize = 13;
2492
2539
  this.xterm.reset();
2493
2540
  this.syncOverlay();
2494
2541
  requestAnimationFrame(() => this.refit());
@@ -2519,7 +2566,10 @@ const term = {
2519
2566
  this.xterm.reset();
2520
2567
  this.replaying = true;
2521
2568
  this.xterm.write(msg.backlog, () => (this.replaying = false));
2522
- if (!matchMedia('(pointer: coarse)').matches) this.xterm.focus();
2569
+ // Not while you work in a split-screen group: it would take the keyboard from there.
2570
+ if (!matchMedia('(pointer: coarse)').matches && !groupsUi?.activeSplit()) this.xterm.focus();
2571
+ } else if (msg.t === 'size') {
2572
+ return followSize(this, msg.cols, msg.rows, $('#terminal'));
2523
2573
  } else if (msg.t === 'error') {
2524
2574
  toast(`Terminal unavailable: ${msg.error}`, 5000);
2525
2575
  } else if (msg.t === 'o') {
@@ -4359,13 +4409,13 @@ function connectEvents() {
4359
4409
  { events: true },
4360
4410
  {
4361
4411
  onOpen: () => {
4362
- $('#conn').textContent = REMOTE ? 'connected (remote)' : 'daemon connected';
4412
+ $('#conn').textContent = $('#conn').title = REMOTE ? 'connected (remote)' : 'daemon connected';
4363
4413
  $('#conn').className = 'conn ok';
4364
4414
  reloadIfUpdated();
4365
4415
  },
4366
4416
  onMessage: handleEvent,
4367
4417
  onClose: async () => {
4368
- $('#conn').textContent = 'daemon offline, retrying…';
4418
+ $('#conn').textContent = $('#conn').title = 'daemon offline, retrying…';
4369
4419
  $('#conn').className = 'conn bad';
4370
4420
  if (REMOTE && !(await sessionOk())) return showLogin();
4371
4421
  setTimeout(connectEvents, 2000);
@@ -4975,8 +5025,11 @@ groupsUi = initGroups({
4975
5025
  if (kind !== 'claude' || agents.get(id)?.runtime.running) term.open(id, kind);
4976
5026
  },
4977
5027
  refitMain: () => term.refit(),
5028
+ mainActive: () => term.xterm && term.lead(),
5029
+ focusMain: () => (term.agentId && !$('#term-wrap').hidden ? term.xterm.focus() : $('#detail').focus?.()),
4978
5030
  });
4979
5031
  $('#group-split').onclick = () => groupsUi.split('row');
5032
+ initTopNav({ $ });
4980
5033
 
4981
5034
  boot();
4982
5035
  setInterval(renderDetail, 30_000); // keep "x ago" labels fresh
package/public/groups.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Split screen, like editor groups in VS Code: the area beside the agents list splits right or
2
2
  // down into groups, each showing one agent's session (its Claude session or a shell). The main
3
3
  // group is the usual panel (the agent's details and terminal); the others are terminals.
4
+ // Keys: Cmd+\ or Ctrl+Shift+\ splits, Ctrl+Shift+1…6 focuses a group, Ctrl+Shift+X closes one.
4
5
  // Load a session into a group by dragging an agent onto it (onto its right or bottom edge to split
5
6
  // there), with the group's picker, or by clicking an agent in the list while that group is active.
6
7
  // The layout and what each group shows are kept per browser.
@@ -11,8 +12,42 @@ const MAX_GROUPS = 6;
11
12
  const REPLY = /^(\x1b\[[\d;?>]*[IOcRnt]|\x1b\][\d;]*[^\x07\x1b]*(\x07|\x1b\\))+$/;
12
13
  const EDGE = 0.25; // a drop this close to a group's right or bottom edge splits it
13
14
  const isShell = (k) => /^shell(:\d+)?$/.test(k ?? '');
15
+ const FONT = 13;
16
+
17
+ // One session, several views (the main panel, groups, another window): the view you type in or
18
+ // click sets the session's size; the others show it at that size, the font scaled to fit, until
19
+ // you type in or click one of them. `v` is { xterm, follow }.
20
+
21
+ /** Another view resized the session: show it at that size. */
22
+ export function followSize(v, cols, rows, box) {
23
+ if (!(cols > 0 && rows > 0) || (cols === v.xterm.cols && rows === v.xterm.rows)) return;
24
+ v.follow = true;
25
+ v.xterm.resize(cols, rows);
26
+ requestAnimationFrame(() => scaleToFit(v, box));
27
+ }
28
+
29
+ /** While following: the font that fits the session's size into the panel. */
30
+ export function scaleToFit(v, box) {
31
+ const screen = box.querySelector('.xterm-screen');
32
+ if (!v.follow || !screen?.offsetWidth || !box.clientWidth) return;
33
+ const f = v.xterm.options.fontSize;
34
+ const ratio = Math.min(box.clientWidth / screen.offsetWidth, box.clientHeight / screen.offsetHeight);
35
+ const next = Math.max(6, Math.min(FONT, Math.floor(f * ratio * 10) / 10));
36
+ if (Math.abs(next - f) > 0.05) v.xterm.options.fontSize = next;
37
+ }
38
+
39
+ /** This view sets the size again: its own font, fitted to its panel, sent to the session. */
40
+ export function leadSize(v, fit, send) {
41
+ if (!v.follow) return;
42
+ v.follow = false;
43
+ v.xterm.options.fontSize = FONT;
44
+ try {
45
+ fit();
46
+ } catch {}
47
+ send({ t: 'r', cols: v.xterm.cols, rows: v.xterm.rows });
48
+ }
14
49
 
15
- export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api, upsert, toast, statusOf, pillText, engineLabel, dragged, openInMain, refitMain }) {
50
+ export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api, upsert, toast, statusOf, pillText, engineLabel, dragged, openInMain, refitMain, mainActive, focusMain }) {
16
51
  const root = $('#groups');
17
52
  const detail = $('#detail');
18
53
  // A layout is a tree: { leaf: id } or { dir: 'row' | 'col', a, b, size } (the first part's share, %).
@@ -43,9 +78,9 @@ export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api
43
78
  <select class="gkind" aria-label="Session" hidden></select>
44
79
  <span class="spacer"></span>
45
80
  <select class="gpick" aria-label="Open a session in this group" title="Open a session in this group"></select>
46
- <button class="ghost small" data-g="right" title="Split right (Ctrl+\\)">◫</button>
47
- <button class="ghost small" data-g="down" title="Split down">⬓</button>
48
- <button class="ghost small" data-g="close" title="Close this group (the agent keeps running)">✕</button>
81
+ <button class="ghost small" data-g="right" title="Split right (Cmd+\\ on a Mac, or Ctrl+Shift+\\)">◫</button>
82
+ <button class="ghost small" data-g="down" title="Split down (Cmd+Shift+\\ on a Mac, or Ctrl+Alt+Shift+\\)">⬓</button>
83
+ <button class="ghost small" data-g="close" title="Close this group; the agent keeps running (Ctrl+Shift+X)">✕</button>
49
84
  </div>
50
85
  <div class="gbody">
51
86
  <div class="gterm"></div>
@@ -55,27 +90,30 @@ export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api
55
90
  const xterm = new Terminal({
56
91
  cursorBlink: true,
57
92
  fontFamily: 'ui-monospace, SFMono-Regular, Menlo, monospace',
58
- fontSize: 13,
93
+ fontSize: FONT,
59
94
  scrollback: 10000,
60
95
  theme: { background: '#0f1117' },
61
96
  allowProposedApi: true,
62
97
  });
63
98
  const fit = new FitAddon();
64
99
  xterm.loadAddon(fit);
65
- const p = { el, xterm, fit, conn: null, agentId: null, kind: 'claude', replaying: false, exited: false, opened: false };
100
+ const p = { el, xterm, fit, conn: null, agentId: null, kind: 'claude', replaying: false, exited: false, opened: false, follow: false };
66
101
  xterm.onData((d) => {
67
102
  if (p.replaying || REPLY.test(d)) return;
103
+ lead(p);
68
104
  p.conn?.send({ t: 'i', d });
69
105
  });
70
- xterm.onResize(({ cols, rows }) => p.conn?.send({ t: 'r', cols, rows }));
71
- new ResizeObserver(() => refit(p)).observe(el.querySelector('.gterm'));
106
+ xterm.onResize(({ cols, rows }) => !p.follow && p.conn?.send({ t: 'r', cols, rows }));
107
+ new ResizeObserver(() => (p.follow ? scaleToFit(p, el.querySelector('.gterm')) : refit(p))).observe(el.querySelector('.gterm'));
72
108
  panes.set(id, p);
73
109
  if (show.agentId) load(id, show.agentId, show.kind);
74
110
  return p;
75
111
  }
76
112
 
113
+ const lead = (p) => leadSize(p, () => p.fit.fit(), (m) => p.conn?.send(m));
114
+
77
115
  function refit(p) {
78
- if (!p.opened || !p.agentId || !p.el.isConnected) return;
116
+ if (!p.opened || !p.agentId || !p.el.isConnected || p.follow) return;
79
117
  try {
80
118
  p.fit.fit();
81
119
  } catch {}
@@ -104,6 +142,8 @@ export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api
104
142
  p.opened = true;
105
143
  }
106
144
  p.failed = false;
145
+ p.follow = false;
146
+ p.xterm.options.fontSize = FONT;
107
147
  p.xterm.reset();
108
148
  const conn = openStream(
109
149
  { agentId: p.agentId, kind: p.kind },
@@ -119,7 +159,8 @@ export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api
119
159
  p.xterm.reset();
120
160
  p.replaying = true;
121
161
  p.xterm.write(msg.backlog ?? '', () => (p.replaying = false));
122
- } else if (msg.t === 'error') toast(`Terminal unavailable: ${msg.error}`, 5000);
162
+ } else if (msg.t === 'size') followSize(p, msg.cols, msg.rows, p.el.querySelector('.gterm'));
163
+ else if (msg.t === 'error') toast(`Terminal unavailable: ${msg.error}`, 5000);
123
164
  else if (msg.t === 'exit') {
124
165
  if (isShell(p.kind)) p.exited = true;
125
166
  else p.xterm.write(`\r\n\x1b[2m[session exited with code ${msg.code}; session kept]\x1b[0m\r\n`);
@@ -322,12 +363,17 @@ export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api
322
363
  p.xterm.dispose();
323
364
  p.el.remove();
324
365
  panes.delete(id);
325
- if (active === id) active = 'main';
366
+ if (active === id) {
367
+ active = 'main';
368
+ mainActive();
369
+ }
326
370
  layout();
327
371
  save();
328
372
  }
329
373
 
330
374
  function activate(id) {
375
+ if (id === 'main') mainActive();
376
+ else if (panes.get(id)) lead(panes.get(id));
331
377
  if (active === id) return;
332
378
  active = id;
333
379
  detail.classList.toggle('gactive', id === 'main' && Boolean(tree.dir) && !narrow());
@@ -448,13 +494,33 @@ export function initGroups({ $, esc, agents, Terminal, FitAddon, openStream, api
448
494
  });
449
495
  document.addEventListener('dragend', clearDrop);
450
496
 
451
- // Ctrl+\ (Cmd+\ on a Mac), as in VS Code: split the active group to the right.
497
+ // Keys, taken before a focused terminal gets them (plain Ctrl+\ stays the terminal's: it's "quit").
498
+ // Cmd+\ (Mac) or Ctrl+Shift+\: split right; with Shift (Mac) or Alt: split down.
499
+ // Ctrl+Shift+1…6: focus group 1…6 (left to right, top to bottom). Ctrl+Shift+X: close the active group.
452
500
  document.addEventListener('keydown', (e) => {
453
- if ((e.ctrlKey || e.metaKey) && !e.altKey && e.code === 'Backslash') {
454
- e.preventDefault();
455
- split(active, e.shiftKey ? 'col' : 'row');
456
- }
457
- });
501
+ const mac = e.metaKey && !e.ctrlKey;
502
+ const ctrl = e.ctrlKey && e.shiftKey && !e.metaKey;
503
+ let act = null;
504
+ if (e.code === 'Backslash' && mac && !e.altKey) act = () => split(active, e.shiftKey ? 'col' : 'row');
505
+ else if (e.code === 'Backslash' && ctrl) act = () => split(active, e.altKey ? 'col' : 'row');
506
+ else if (ctrl && !e.altKey && /^Digit[1-6]$/.test(e.code)) act = () => focusGroup(Number(e.code.slice(5)));
507
+ else if (ctrl && !e.altKey && e.code === 'KeyX' && active !== 'main' && tree.dir) act = () => close(active);
508
+ if (!act) return;
509
+ e.preventDefault();
510
+ e.stopPropagation();
511
+ act();
512
+ }, true);
513
+
514
+ function focusGroup(n) {
515
+ if (!tree.dir || narrow()) return;
516
+ const id = leaves()[n - 1];
517
+ if (!id) return;
518
+ activate(id);
519
+ if (id === 'main') return focusMain();
520
+ const p = panes.get(id);
521
+ if (p.opened) p.xterm.focus();
522
+ else p.el.querySelector('.gpick').focus();
523
+ }
458
524
  matchMedia('(max-width: 760px)').addEventListener('change', () => layout());
459
525
 
460
526
  // Restore the last layout.
package/public/index.html CHANGED
@@ -29,6 +29,7 @@
29
29
  </div>
30
30
  <div class="top-actions">
31
31
  <input id="filter" type="search" placeholder="Filter agents" aria-label="Filter agents" />
32
+ <nav class="top-nav" id="top-nav" aria-label="Views">
32
33
  <button id="today-btn" title="Today: what needs you, from every list, most pressing first, and why (y)">Today <span id="today-count" class="badge ready"></span></button>
33
34
  <button id="assistant-btn" title="An always-on session that finds new work and starts agents for it">Assistant <span id="assistant-dot" class="assistant-dot" hidden></span></button>
34
35
  <button id="spend-btn" title="Results across agents (merge rate, time to PR, cost per merged PR), what they cost, and spending limits">Results <span id="spend-today" class="spend-today"></span></button>
@@ -43,6 +44,11 @@
43
44
  <button id="watch-btn" title="Running agents' sessions side by side, live: follow them all without clicking from one to the next">Watch</button>
44
45
  <button id="machine-btn" title="A terminal on this computer (your home folder), from any device you're signed in on">Terminal</button>
45
46
  <button id="ask-btn" title="A general session with no repo or folder, on Claude Code or another engine you have (Codex, Muse Code, …)">Ask Agent</button>
47
+ <div class="menu-wrap top-more" id="top-more" hidden>
48
+ <button id="top-more-btn" type="button" aria-haspopup="menu" aria-expanded="false">More ▾</button>
49
+ <div id="top-more-menu" class="menu" role="menu" hidden></div>
50
+ </div>
51
+ </nav>
46
52
  <button id="new-btn" class="primary">+ New agents</button>
47
53
  <div class="menu-wrap">
48
54
  <button id="menu-btn" class="menu-btn" type="button" aria-haspopup="menu" aria-expanded="false" title="Settings and preferences">
@@ -139,7 +145,7 @@
139
145
  <input type="file" id="term-file" multiple hidden>
140
146
  <button id="term-fit" class="ghost small" title="Refit the terminal to the panel">Fit</button>
141
147
  <button id="term-split-btn" class="ghost small desk-only" title="Split: the terminal on the left, and Code, Docs (diagrams) or Changes on the right">◫ Split</button>
142
- <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 (Ctrl+\; Ctrl+Shift+\ splits down). Or drag an agent from the list onto the right or bottom edge">⊞ Split screen</button>
148
+ <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>
143
149
  <button id="term-max" class="ghost small desk-only" title="Expand to fill the window (Ctrl+Shift+E)">⤢ Expand</button>
144
150
  <button id="term-full" class="ghost small desk-only" title="Full screen (Esc to leave)">⛶ Full screen</button>
145
151
  <button id="term-close" class="ghost small" title="Hide the terminal (the agent keeps running)">Hide terminal</button>
@@ -871,12 +877,14 @@
871
877
  <fieldset>
872
878
  <legend>Open agents</legend>
873
879
  <label class="check">Keep at most <input type="number" name="maxRunning" min="1" max="500" placeholder="no limit" class="num" /> agents open at once</label>
874
- <p class="hint">Above it, the agents idle longest are closed (they resume when you open them), so the machine stays responsive. Never closed: agents working, waiting for your answer, active in the last 5 minutes, marked Keep, or in a team that is still going. <span id="settings-running"></span></p>
880
+ <label class="check">Close sessions idle for <input type="number" name="idleHours" min="1" max="720" placeholder="never" class="num" /> hours</label>
881
+ <p class="hint">Above the limit, the agents idle longest are closed, and so are ones idle that many hours (they resume when you open them, with their conversation), so the machine stays responsive. Never closed: agents working, waiting for your answer, active in the last 5 minutes, marked Keep, or in a team that is still going. <span id="settings-running"></span></p>
875
882
  </fieldset>
876
883
  <fieldset id="settings-rules">
877
884
  <legend>Approval rules</legend>
878
- <p class="hint">Commands you chose to always allow in a repo. Agents there run them without asking. After you allow the same command 3 times, the inbox offers a rule.</p>
885
+ <p class="hint">Commands you chose to always allow in a repo. Agents there run them without asking. After you allow the same command 3 times, the inbox offers a rule; once it's allowed in 2 repos, it offers it for every repo. Claude Code and Codex agents learn them.</p>
879
886
  <ul id="settings-rules-list" class="rules-list"></ul>
887
+ <p class="hint" id="settings-rules-readonly"></p>
880
888
  </fieldset>
881
889
  <fieldset class="local-only" id="settings-service">
882
890
  <legend>Start at login</legend>
package/public/keys.js CHANGED
@@ -59,6 +59,12 @@ export const SHORTCUTS = [
59
59
  [['Ctrl+Shift+L'], 'Leave the terminal (then the keys above work)', 'leave'],
60
60
  [['Ctrl+Shift+E'], 'Expand or shrink the terminal', null],
61
61
  ]],
62
+ ['Split screen (also from a terminal)', [
63
+ [['Cmd+\\', 'Ctrl+Shift+\\'], 'Split the active group to the right', null],
64
+ [['Cmd+Shift+\\', 'Ctrl+Alt+Shift+\\'], 'Split it down', null],
65
+ [['Ctrl+Shift+1…6'], 'Go to group 1 to 6 (left to right, top to bottom)', null],
66
+ [['Ctrl+Shift+X'], 'Close the active group (its agent keeps running)', null],
67
+ ]],
62
68
  ];
63
69
 
64
70
  // A single key, as an event names it, to its action.
package/public/menu.js CHANGED
@@ -92,6 +92,7 @@ export function initMenu({ api, esc, toast, $ }) {
92
92
  try {
93
93
  const c = await api('GET', '/cleanup');
94
94
  form.maxRunning.value = c.maxRunning ?? '';
95
+ form.idleHours.value = c.idleHours ?? '';
95
96
  $('#settings-running').textContent = `Open now: ${c.running}.`;
96
97
  service = null;
97
98
  showRules(await api('GET', '/rules').catch(() => null));
@@ -127,8 +128,9 @@ export function initMenu({ api, esc, toast, $ }) {
127
128
  const showRules = (r) => {
128
129
  const list = [...(r?.allowed ?? [])].sort((a, b) => String(b.at).localeCompare(String(a.at)));
129
130
  $('#settings-rules-list').innerHTML = list.length
130
- ? list.map((x) => `<li><code>${esc(x.label)}</code> <span class="hint">in ${esc(String(x.repo).replace(/^dir:/, '').split('/').filter(Boolean).slice(-2).join('/'))}${x.uses ? ` · answered ${x.uses} prompt${x.uses === 1 ? '' : 's'}` : ''}</span> <button type="button" class="small ghost" data-rule-remove="${esc(x.rule)}" data-repo="${esc(x.repo)}">Remove</button></li>`).join('')
131
+ ? list.map((x) => `<li><code>${esc(x.label)}</code> <span class="hint">in ${x.repo === '*' ? 'every repo' : esc(String(x.repo).replace(/^dir:/, '').split('/').filter(Boolean).slice(-2).join('/'))}${x.uses ? ` · answered ${x.uses} prompt${x.uses === 1 ? '' : 's'}` : ''}</span> <button type="button" class="small ghost" data-rule-remove="${esc(x.rule)}" data-repo="${esc(x.repo)}">Remove</button></li>`).join('')
131
132
  : '<li class="hint">None yet.</li>';
133
+ $('#settings-rules-readonly').innerHTML = r?.readOnly?.length ? `Never asked anywhere (they only look): ${r.readOnly.map((c) => `<code>${esc(c)}</code>`).join(' ')}.` : '';
132
134
  };
133
135
  $('#settings-rules-list').addEventListener('click', async (e) => {
134
136
  const b = e.target.closest('[data-rule-remove]');
@@ -173,7 +175,7 @@ export function initMenu({ api, esc, toast, $ }) {
173
175
  form.addEventListener('submit', async (e) => {
174
176
  e.preventDefault();
175
177
  try {
176
- const c = await api('PUT', '/cleanup', { maxRunning: form.maxRunning.value.trim() || null });
178
+ const c = await api('PUT', '/cleanup', { maxRunning: form.maxRunning.value.trim() || null, idleHours: form.idleHours.value.trim() || null });
177
179
  await api('PUT', '/update', { check: form.updateCheck.checked }).catch(() => {});
178
180
  if (features) {
179
181
  const want = Object.fromEntries(FEATURE_KEYS.map((k) => [k, form[`feat_${k}`].checked]));
@@ -196,7 +198,8 @@ export function initMenu({ api, esc, toast, $ }) {
196
198
  toast(s.installed ? `Starts at login from now on${s.note ? `. ${s.note}` : ''}` : 'No longer starts at login', 6000);
197
199
  }
198
200
  dialog.close();
199
- toast(c.maxRunning ? `At most ${c.maxRunning} agents open; the ones idle longest close above that` : 'No limit on open agents');
201
+ const idle = c.idleHours ? `; sessions idle ${c.idleHours} h close` : '';
202
+ toast(c.maxRunning ? `At most ${c.maxRunning} agents open; the ones idle longest close above that${idle}` : `No limit on open agents${idle}`);
200
203
  } catch (err) {
201
204
  $('#settings-error').textContent = err.message;
202
205
  $('#settings-error').hidden = false;
package/public/style.css CHANGED
@@ -88,8 +88,25 @@ a:hover { text-decoration: underline; }
88
88
  .about-list .sep { grid-column: 1 / -1; border-top: 1px solid var(--border); margin: 4px 0; }
89
89
  .conn.ok::before { content: '● '; color: var(--green); }
90
90
  .conn.bad::before { content: '● '; color: var(--red); }
91
- .top-actions { display: flex; gap: 8px; }
92
- .top-actions input { width: 220px; }
91
+ /* Below 1100px the title and connection text step aside for the view buttons: the logo and a dot stay. */
92
+ @media (max-width: 1100px) {
93
+ .brand { gap: 6px; }
94
+ .brand h1 { display: none; }
95
+ .conn { font-size: 0; }
96
+ .conn::before { font-size: 12px; }
97
+ .about-btn { padding: 2px 6px; }
98
+ }
99
+ .top-actions { display: flex; gap: 8px; flex: 1 1 auto; min-width: 0; justify-content: flex-end; }
100
+ .top-actions > * { flex-shrink: 0; }
101
+ /* The filter gives up its room first, then the view buttons go into More (topnav.js). */
102
+ .top-actions > input { width: 220px; flex: 0 1000 220px; min-width: 120px; }
103
+ .top-nav { display: flex; gap: 8px; flex: 0 1 auto; min-width: 0; overflow: hidden; }
104
+ .top-nav > * { flex: none; }
105
+ .top-actions > .top-nav { flex-shrink: 1; }
106
+ .top-more { position: static; }
107
+ #top-more-btn.has-news::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-left: 6px; border-radius: 50%; background: var(--accent); vertical-align: middle; }
108
+ #top-more-menu { position: fixed; top: auto; right: 16px; margin-top: 6px; min-width: 200px; }
109
+ #top-more-menu > button { display: flex; align-items: center; gap: 8px; }
93
110
 
94
111
  /* ---------- controls */
95
112
  button {
@@ -501,6 +518,7 @@ dialog::backdrop { background: rgba(0, 0, 0, .45); }
501
518
  html, body { overflow-x: hidden; max-width: 100vw; }
502
519
  .topbar { flex-wrap: wrap; padding: 8px 12px; }
503
520
  .top-actions { width: 100%; flex-wrap: wrap; }
521
+ .top-actions > .top-nav { flex: 1 1 100%; order: 1; }
504
522
  .top-actions input { flex: 1 1 140px; width: auto; min-width: 0; }
505
523
  .d-head, .d-actions { min-width: 0; }
506
524
  .d-actions button { flex: 1 1 auto; }