ai-agentmanager 1.48.0 → 1.50.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 +19 -0
- package/README.md +43 -0
- package/package.json +1 -1
- package/public/app.js +39 -3
- package/public/decide.js +301 -0
- package/public/index.html +6 -0
- package/public/keys.js +3 -2
- package/public/news.js +2 -1
- package/public/plan.js +18 -2
- package/public/runbooks.js +145 -0
- package/public/side.js +113 -52
- package/public/style.css +63 -1
- package/src/advisor.js +780 -0
- package/src/backlog.js +14 -0
- package/src/brief.js +76 -1
- package/src/cli.js +133 -0
- package/src/config.js +2 -0
- package/src/decisions.js +29 -3
- package/src/jira.js +75 -0
- package/src/manager.js +37 -1
- package/src/notify.js +1 -0
- package/src/rea.js +47 -0
- package/src/runbooks.js +371 -0
- package/src/server.js +68 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.50.0 (2026-11-14)
|
|
4
|
+
|
|
5
|
+
- **Reverse engineer.** **🔍 Reverse engineer** in an agent's detail (or the **Reverse** tab of the split, or `agentmgr reverse`) puts the agent's session on the left and a pane on the right. Name a target (an app's folder, a binary's path, a website's address) and what you want to understand; the agent investigates in its own session with the tools of [REA](https://github.com/morluto/rea), the "Reverse Engineer Anything" MCP server, and changes nothing.
|
|
6
|
+
- **The report.** Drawn beside the session as the agent writes it: what the target is, how the feature works as an animated diagram, the data and interfaces, findings with their evidence marked confirmed or inferred, what could not be determined, and a plan for building your own version.
|
|
7
|
+
- **Build it in my project.** The agent writes your own version from the behaviour the report describes, with tests: its own code, nothing copied from the target.
|
|
8
|
+
- **REA is set up by you.** The pane says whether REA is registered with Claude Code for the agent's folder; if it isn't, run `npx rea-agents setup` in a terminal and restart the agent's session. The app installs nothing. Native binaries also need Hopper, Ghidra, IDA or Kuna.
|
|
9
|
+
- **What it is for.** Software you own or are allowed to analyse. The agent is told to analyse only, not to work on getting around licence checks, copy protection or sign-in, and not to collect credentials or personal data.
|
|
10
|
+
|
|
11
|
+
## 1.49.0 (2026-11-14)
|
|
12
|
+
|
|
13
|
+
- **Decide.** **Decide** in the top bar (or `q`, `#decide`, `agentmgr decide`) helps with the decisions, not only the tasks. A plan waiting for review or an agent's question comes with its options, the one recommended, why, the evidence, the risk, how sure it is, and whether it is hard to undo; one click carries out any option, and the same recommendation is on the item's Inbox card. The reasoning is the AI judge's, on your own plan, within its daily budget; with the judge off nothing is recommended or decided.
|
|
14
|
+
- **Standing decisions and autonomy.** A call you keep making is offered as a standing decision once three of your decisions agree (or write your own); when one applies it is carried out for you and reported under **Handled for you** and by the new *decided* alert. Per project you choose how much may be decided without you: ask everything, only standing decisions (the default, so nothing changes until you make one), what is sure and easy to undo, or most things. Anything hard to undo always waits for you unless a standing decision covers it.
|
|
15
|
+
- **Try both.** A question's options, each tried by its own agent as a race, so you decide from the results.
|
|
16
|
+
- **Priority by impact.** Each project's open backlog ranked by what it is worth now (the nearest date, what it unblocks, risk removed), with the reason beside each item; **Use this order** reorders the queue.
|
|
17
|
+
- **Dates at risk as choices.** A date that is at risk or late is laid out as three choices: hold the least valuable queued items until after it, move the date, or run more agents. One is recommended; picking one carries it out and records it in the decision log.
|
|
18
|
+
- **Looking back.** Two days after a decision, what followed it; for the ones that went badly the judge writes the lesson, and the lessons are given to the next recommendation. The decision log now also says why, who decided, and how it held up.
|
|
19
|
+
- **Runbooks for the support team.** **Plan → Runbooks** (or `agentmgr runbook`) writes a runbook from a release ticket (with what it links to and its fix versions), every ticket of an epic, or a project's code changes in a time frame: what changed, what customers may see, how to check it, troubleshooting, rolling back, when to escalate, and replies to send. It states only what the tickets and code support and lists the rest under *To confirm with engineering*. Edit it, revise it with a note, copy or download it as Markdown, or print it.
|
|
20
|
+
- **Fix.** AI News showed a weekday instead of "Today" for a release dated today ahead of your time zone.
|
|
21
|
+
|
|
3
22
|
## 1.48.0 (2026-11-13)
|
|
4
23
|
|
|
5
24
|
- **OS.** **OS** in the top bar (or `u`, `#os`, `agentmgr os`) shows the computer the agents run on and how loaded it is right now: the processor in use and the load average against the number of cores, memory and swap, and the free space on your disks, with a line of the last ten minutes for processor and memory. A tag sums it up: light load, busy or heavy load.
|
package/README.md
CHANGED
|
@@ -30,6 +30,9 @@ Run one background [Claude Code](https://claude.com/claude-code) agent per inten
|
|
|
30
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
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
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
|
+
- **Reverse engineer.** Name a target (an app's folder, a binary, a website) and what you want to understand, in the **Reverse** tab beside an agent's session: the agent investigates with [REA](https://github.com/morluto/rea)'s tools and keeps a report with animated diagrams of how it works, the evidence, what could not be determined, and a plan to build your own version.
|
|
34
|
+
- **Runbooks for support.** A runbook for the support team written from a release ticket, every ticket of an epic, or a project's code changes in a time frame: what changed, what customers may see, how to check it, troubleshooting, rollback, when to escalate, and what to confirm with engineering.
|
|
35
|
+
- **Decide.** Help with the decisions, not only the tasks: a plan to review or an agent's question arrives with its options, the one recommended, why, and the risk; calls you keep making become standing decisions that are handled for you and reported; the backlog is ranked by impact; a date at risk is laid out as choices; and past decisions are looked back on.
|
|
33
36
|
- **OS.** The computer the agents run on and how loaded it is right now: processor, load average, memory, swap and disks with the last ten minutes, what each open agent session takes, and the busiest processes.
|
|
34
37
|
- **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.
|
|
35
38
|
- **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.
|
|
@@ -187,9 +190,12 @@ agentmgr remote on | off | status | rotate # phone / remote access (see below
|
|
|
187
190
|
agentmgr backlog add "ask" -r <repo> [-p 1] # queue work; also: ls, start, accept, reopen, move, limit, pause
|
|
188
191
|
agentmgr notify slack --webhook <url> # Slack alerts; also: test, status, on, off, event <name> on|off
|
|
189
192
|
agentmgr debug <agent> "what goes wrong" # debug with an agent; no question prints its report; --fix applies the fixes
|
|
193
|
+
agentmgr reverse <agent> -t /path/to/app "how does search work" # reverse engineer with an agent and REA; no question prints the report; --build builds your own
|
|
190
194
|
agentmgr dates <project> --cc 2026-12-01 --rc 2026-12-10 --ga 2026-12-20 # commitment dates; no dates: where each stands
|
|
191
195
|
agentmgr decisions [project] [--md] # the decision log; --add "<question>" --decision "<what>" adds one
|
|
192
196
|
agentmgr debt <project> --scan # the tech debt radar: files that change often and are hard to read
|
|
197
|
+
agentmgr runbook --ticket REL-42 # a support runbook from a release ticket (or --epic KEY, or --since 2026-10-01 -p <project>; -o file.md)
|
|
198
|
+
agentmgr decide # what waits for your decision, with its recommendation (--do <n>, --handled, --standing, --autonomy p=level, --priority, --risk)
|
|
193
199
|
agentmgr os # this computer and its load: processor, memory, disks, what each open session takes (--json)
|
|
194
200
|
agentmgr news # the frontier labs' latest releases, summarized (--refresh, --lab, --days)
|
|
195
201
|
agentmgr inbox # prompts, questions, stuck agents and overlaps waiting on you
|
|
@@ -1215,6 +1221,17 @@ With it, Today opens with **Your day**:
|
|
|
1215
1221
|
|
|
1216
1222
|
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" }`.
|
|
1217
1223
|
|
|
1224
|
+
## Reverse engineer
|
|
1225
|
+
|
|
1226
|
+
**🔍 Reverse engineer** in an agent's detail (or the **Reverse** tab of the split) puts the agent's session on the left and a pane on the right. Name a **target** (an app's folder or `.asar`, a binary's path, a website's address) and what you want to understand ("how does search work in this app"). The agent investigates in its own session with the tools of [REA](https://github.com/morluto/rea), the "Reverse Engineer Anything" MCP server, and changes nothing.
|
|
1227
|
+
|
|
1228
|
+
- **The report**, drawn beside the session as the agent writes it: what the target is, how the feature works as an animated diagram, the data and interfaces (storage, formats, calls between processes, network requests), findings with their evidence marked confirmed or inferred, what could not be determined, and a plan for building your own version in this project.
|
|
1229
|
+
- **Follow-ups and building.** **Ask** continues the investigation. **Build it in my project** has the agent write your own version from the behaviour the report describes, with tests: its own code, nothing copied from the target.
|
|
1230
|
+
- **REA is set up by you.** The pane says whether REA is registered with Claude Code for the agent's folder (read from Claude Code's settings and the project's `.mcp.json`; a plugin that brings REA is not seen there). If it isn't, run `npx rea-agents setup` in a terminal and restart the agent's session: the app installs nothing. Native binaries also need Hopper, Ghidra, IDA or Kuna; JavaScript, Electron and websites need nothing more.
|
|
1231
|
+
- **What it is for.** Software you own or are allowed to analyse: a licence or the law may restrict reverse engineering someone else's product. The agent is told to analyse only, not to work on getting around licence checks, copy protection or sign-in, not to collect credentials or personal data, and to build from behaviour without copying code or assets.
|
|
1232
|
+
|
|
1233
|
+
`agentmgr reverse <agent> -t <target> "<what to understand>"` asks from the terminal, `agentmgr reverse <agent>` prints the report, and `--build` builds your own.
|
|
1234
|
+
|
|
1218
1235
|
## Debug
|
|
1219
1236
|
|
|
1220
1237
|
**🐞 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).
|
|
@@ -1239,6 +1256,32 @@ The agent investigates in its own session, with everything it already knows abou
|
|
|
1239
1256
|
|
|
1240
1257
|
`agentmgr debug <agent> "<what goes wrong>"` asks from the terminal, `agentmgr debug <agent>` prints the report, and `--fix ["1 and 3"]` applies fixes.
|
|
1241
1258
|
|
|
1259
|
+
## Runbooks for the support team
|
|
1260
|
+
|
|
1261
|
+
**Plan → Runbooks** (or `agentmgr runbook`) writes a runbook for the people who answer customers, from one of three sources:
|
|
1262
|
+
|
|
1263
|
+
- **A release ticket**: the ticket, what it links to, its sub-tasks, and every ticket in its fix versions (up to 150).
|
|
1264
|
+
- **An epic**: every ticket of the epic.
|
|
1265
|
+
- **Code changes**: a project's commits in a time frame (since a day, until a day or now), the diffs of the most telling and most changed files (settings, migrations, flags, routes and messages first), and the Jira tickets the commits name.
|
|
1266
|
+
|
|
1267
|
+
Tickets are read from Jira with the site and API token in Settings → Jira; code is read from the project's repository on this computer. One tool-less model call then writes the runbook, on your own plan: a summary, what changed, what customers may see or ask, how to check it is working, troubleshooting, known issues, settings and migrations, rolling back, when to escalate, replies you can send, and sources. It is told to state only what the tickets and code support and to put every open question under **To confirm with engineering**, so have an engineer read it before support relies on it.
|
|
1268
|
+
|
|
1269
|
+
Open one to read it, **Edit** it, **Revise** it with a note (written again from the tickets and code as they are now, keeping what still holds and your edits), **Copy** it or **Download** it as Markdown for your knowledge base, or **Print** it. Runbooks are Markdown files in `~/.agentmanager/runbooks`.
|
|
1270
|
+
|
|
1271
|
+
## Decide
|
|
1272
|
+
|
|
1273
|
+
**Decide** in the top bar (or `q`, `#decide`, or `agentmgr decide`) helps with the decisions themselves. The reasoning is the AI judge's: one tool-less call each, on your own Claude or Codex plan, within the judge's daily budget. With the judge off nothing is recommended and nothing is decided for you.
|
|
1274
|
+
|
|
1275
|
+
- **Waiting.** A plan waiting for review, or a question an agent asks, comes with its options, the one recommended, why, the evidence, the risk, how sure it is, and whether it is hard to undo. One click carries out the recommendation or another option. The same recommendation is on the item's Inbox card. However you decide, the decision log (Plan → Decisions) gets the reasoning and whether you went with the recommendation.
|
|
1276
|
+
- **Try both.** For a question with two or more options, each option is tried by its own agent as a race, so you decide from the results side by side.
|
|
1277
|
+
- **Standing decisions.** A call you made once for every time it comes up, such as "when the plan only bumps a dependency, approve". Offered when three of your decisions agree (and never as broad as "always approve"), or written by you. When one applies it is carried out for you, and reported under **Handled for you** with the reasoning and in Slack (the *decided* alert).
|
|
1278
|
+
- **How much may be decided without you**, per project: *Ask me everything*; *Only my standing decisions* (the default, so nothing changes until you make one); *Also what is sure and easy to undo* (85% or more); *Most things; ask when unsure* (70% or more). Anything hard to undo always waits for you unless a standing decision of yours covers it.
|
|
1279
|
+
- **Priority.** Each project's open backlog ranked by impact: the nearest date, what an item unblocks, risk removed, age, with the reason beside each. Plain rules rank at once; the judge's ranking replaces them when the window is open. **Use this order** reorders the queue (and sets a priority the judge found wrong), and free agents pick from the top.
|
|
1280
|
+
- **Dates at risk.** A date that is at risk or late (Plan → Dates) as choices: hold the least valuable queued items until after the date, move the date by what the recent pace says is missing (later dates move with it), or run more agents at once. One is recommended; picking one carries it out and records it as a decision.
|
|
1281
|
+
- **Looking back.** Two days after a decision, what followed it: the work landed, or it was sent back, judged incomplete, failed its checks, was reopened, or a date was missed. For the ones worth another look the judge writes the lesson, and the lessons are given to the next recommendation.
|
|
1282
|
+
|
|
1283
|
+
Turn it all off with `"decide": { "enabled": false }` in config.json.
|
|
1284
|
+
|
|
1242
1285
|
## OS
|
|
1243
1286
|
|
|
1244
1287
|
**OS** in the top bar (or `u`, `#os`, or `agentmgr os`) shows the computer the agents run on and how loaded it is right now:
|
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -41,6 +41,7 @@ import { initValue } from '/value.js';
|
|
|
41
41
|
import { initNews } from '/news.js';
|
|
42
42
|
import { initPlan } from '/plan.js';
|
|
43
43
|
import { initSystem } from '/system.js';
|
|
44
|
+
import { adviceHtml, initDecide } from '/decide.js';
|
|
44
45
|
import { initMcp } from '/mcp.js';
|
|
45
46
|
import { initCodeMap } from '/codemap.js';
|
|
46
47
|
import { initKeys } from '/keys.js';
|
|
@@ -73,15 +74,19 @@ const newsOnLoad = hashId === 'news';
|
|
|
73
74
|
// "#plan" or "#plan/<dates|decisions|debt>".
|
|
74
75
|
const planOnLoad = hashId === 'plan';
|
|
75
76
|
const osOnLoad = hashId === 'os';
|
|
77
|
+
// "#decide" or "#decide/<waiting|handled|standing|priority|tradeoffs|lookback>".
|
|
78
|
+
const decideOnLoad = hashId === 'decide';
|
|
76
79
|
const reviewsOnLoad = hashId === 'reviews';
|
|
77
80
|
// "#mcp" or "#mcp/<agent>": the MCP window on its own.
|
|
78
81
|
const mcpOnLoad = hashId === 'mcp';
|
|
79
82
|
let watchShown = false;
|
|
80
|
-
let selectedId = (watchOnLoad || standupOnLoad || mapOnLoad || valueOnLoad || newsOnLoad || planOnLoad || osOnLoad || reviewsOnLoad || mcpOnLoad ? null : hashId) || null;
|
|
83
|
+
let selectedId = (watchOnLoad || standupOnLoad || mapOnLoad || valueOnLoad || newsOnLoad || planOnLoad || osOnLoad || decideOnLoad || reviewsOnLoad || mcpOnLoad ? null : hashId) || null;
|
|
81
84
|
let openTermOnLoad = hashView === 'term' || hashView === 'code' || isShell(hashView) || isBrowser(hashView);
|
|
82
85
|
let filterText = '';
|
|
83
86
|
// Only agents whose session is open (the "running" count above the list, clicked).
|
|
84
87
|
let listRunning = false;
|
|
88
|
+
// Decide: the recommendations shown on inbox cards come from it (set once the page is wired).
|
|
89
|
+
let decideUi = null;
|
|
85
90
|
// "Only agents created in the last N days": remembered in this browser.
|
|
86
91
|
const recent = (() => {
|
|
87
92
|
try {
|
|
@@ -318,6 +323,7 @@ const planUi = initPlan({
|
|
|
318
323
|
$,
|
|
319
324
|
esc,
|
|
320
325
|
ago,
|
|
326
|
+
md: (text) => md(text),
|
|
321
327
|
toast: (m, ms) => toast(m, ms),
|
|
322
328
|
projects: () => projectsState.map((p) => ({ key: p.shortcut, name: p.name })),
|
|
323
329
|
openTab: (what, id) => {
|
|
@@ -330,6 +336,20 @@ $('#plan-btn').onclick = () => planUi.open();
|
|
|
330
336
|
// OS: this computer and its load right now.
|
|
331
337
|
const osUi = initSystem({ api, $, esc, toast: (m, ms) => toast(m, ms), openAgent: (id) => (showTab('agents'), select(id)) });
|
|
332
338
|
$('#os-btn').onclick = () => osUi.open();
|
|
339
|
+
// Decide: recommendations on what waits for you, standing decisions, impact, trade-offs, looking back.
|
|
340
|
+
decideUi = initDecide({
|
|
341
|
+
api,
|
|
342
|
+
$,
|
|
343
|
+
esc,
|
|
344
|
+
ago,
|
|
345
|
+
toast: (m, ms) => toast(m, ms),
|
|
346
|
+
openAgent: (id, { plan } = {}) => (showTab('agents'), select(id), plan && openPlan(id)),
|
|
347
|
+
openRace: (id) => openRace(id),
|
|
348
|
+
openPlan: (tab) => planUi.open(tab),
|
|
349
|
+
// The inbox cards and an open agent's cards show the recommendation as soon as it is written.
|
|
350
|
+
onData: () => (renderInbox(), selectedId && renderDetail()),
|
|
351
|
+
});
|
|
352
|
+
$('#decide-btn').onclick = () => decideUi.open();
|
|
333
353
|
// MCP: the MCP servers and tools Claude Code has in a folder, and running one.
|
|
334
354
|
const mcpUi = initMcp({ api, $, esc, ago, md: (t) => md(t), toast: (m, ms) => toast(m, ms), agents: () => [...agents.values()] });
|
|
335
355
|
$('#mcp-btn').onclick = () => mcpUi.open(selectedId && agents.get(selectedId)?.workdir ? selectedId : null);
|
|
@@ -386,6 +406,7 @@ function shortcut(act) {
|
|
|
386
406
|
if (act === 'news') return newsUi.open();
|
|
387
407
|
if (act === 'plan') return planUi.open();
|
|
388
408
|
if (act === 'os') return osUi.open();
|
|
409
|
+
if (act === 'decide') return decideUi.open();
|
|
389
410
|
if (act === 'today') return todayUi.open();
|
|
390
411
|
if (act.startsWith('tab:')) return showTab(act.slice(4));
|
|
391
412
|
return false;
|
|
@@ -1607,13 +1628,15 @@ function needCard(it, { inDetail = false } = {}) {
|
|
|
1607
1628
|
const title = a.planReview.markdown?.match(/^#\s+(.+)$/m)?.[1] ?? 'Implementation plan';
|
|
1608
1629
|
body = `<p class="need-title">${esc(title)}</p>
|
|
1609
1630
|
<p class="hint">Written ${ago(a.planReview.updatedAt)}. The agent waits for your approval before changing anything.</p>
|
|
1610
|
-
|
|
1631
|
+
${adviceHtml(decideUi?.brief(it.key), esc)}
|
|
1632
|
+
<div class="need-actions"><button class="small ${decideUi?.brief(it.key)?.options.length ? '' : 'primary'}" data-ib="plan-open">Review plan</button>${decideUi?.brief(it.key)?.options.length ? '' : '<button class="small" data-ib="plan-approve">Approve as is</button>'}</div>`;
|
|
1611
1633
|
} else if (it.kind === 'question') {
|
|
1612
1634
|
const q = it.q;
|
|
1613
1635
|
body = `<p class="need-title">${esc(q.question)}</p>
|
|
1614
1636
|
${q.context ? `<p class="hint">${esc(q.context)}</p>` : ''}
|
|
1615
1637
|
${q.default ? `<p class="hint">Proceeding with <b>${esc(q.default)}</b> until you answer.</p>` : ''}
|
|
1616
|
-
|
|
1638
|
+
${adviceHtml(decideUi?.brief(it.key), esc)}
|
|
1639
|
+
${decideUi?.brief(it.key)?.options.length ? '' : `<div class="need-actions">${q.options.map((o) => `<button class="small" data-ib="answer" data-text="${esc(o)}">${esc(o)}</button>`).join('')}</div>`}
|
|
1617
1640
|
<form class="need-reply" data-ib-form="answer" data-q="${q.id}">
|
|
1618
1641
|
<input data-draft="${esc(it.key)}:text" placeholder="Or type an answer…" value="${draft('text')}" />
|
|
1619
1642
|
<button class="small primary">Send</button>
|
|
@@ -1702,6 +1725,8 @@ function renderInbox() {
|
|
|
1702
1725
|
}
|
|
1703
1726
|
|
|
1704
1727
|
async function onNeed(e) {
|
|
1728
|
+
// A recommendation's own buttons (Decide draws them on plan and question cards).
|
|
1729
|
+
if (decideUi?.handle(e)) return e.preventDefault();
|
|
1705
1730
|
const judge = e.target.closest('[data-judge]');
|
|
1706
1731
|
if (judge) {
|
|
1707
1732
|
e.preventDefault();
|
|
@@ -2337,6 +2362,7 @@ function renderDetail() {
|
|
|
2337
2362
|
${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>` : ''}
|
|
2338
2363
|
${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>` : ''}
|
|
2339
2364
|
<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>
|
|
2365
|
+
<button data-act="reverse" class="desk-only" ${a.workdir && a.status !== 'preparing' ? '' : 'disabled'} title="Reverse engineer with this agent and REA's tools: name a target (an app's folder, a binary, a website) and what you want to understand. It investigates in its session and writes a report beside it: how it works with animated diagrams, the evidence, what could not be determined, and a plan to build your own version">🔍 Reverse engineer${a.specDocs?.reverse ? ' <span class="count">report</span>' : ''}</button>
|
|
2340
2366
|
<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>
|
|
2341
2367
|
<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>
|
|
2342
2368
|
<button data-act="edit" title="Change its name, request, project, priority, permission mode or model">Edit</button>
|
|
@@ -3942,6 +3968,9 @@ $('#detail-body').addEventListener('click', async (e) => {
|
|
|
3942
3968
|
case 'debug':
|
|
3943
3969
|
term.open(a.id);
|
|
3944
3970
|
return sidePane.open('debug');
|
|
3971
|
+
case 'reverse':
|
|
3972
|
+
term.open(a.id);
|
|
3973
|
+
return sidePane.open('reverse');
|
|
3945
3974
|
case 'mcp':
|
|
3946
3975
|
return mcpUi.open(a.id);
|
|
3947
3976
|
case 'memory':
|
|
@@ -4459,6 +4488,11 @@ function handleEvent(msg) {
|
|
|
4459
4488
|
history.replaceState(null, '', '#');
|
|
4460
4489
|
planUi.open(hashView || 'dates');
|
|
4461
4490
|
}
|
|
4491
|
+
if (decideOnLoad && !watchShown) {
|
|
4492
|
+
watchShown = true;
|
|
4493
|
+
history.replaceState(null, '', '#');
|
|
4494
|
+
decideUi.open(hashView || 'waiting');
|
|
4495
|
+
}
|
|
4462
4496
|
if (osOnLoad && !watchShown) {
|
|
4463
4497
|
watchShown = true;
|
|
4464
4498
|
history.replaceState(null, '', '#');
|
|
@@ -4520,6 +4554,8 @@ function handleEvent(msg) {
|
|
|
4520
4554
|
valueUi.changed();
|
|
4521
4555
|
} else if (msg.t === 'news') {
|
|
4522
4556
|
newsUi.changed();
|
|
4557
|
+
} else if (msg.t === 'advisor') {
|
|
4558
|
+
decideUi.changed();
|
|
4523
4559
|
} else if (msg.t === 'plan') {
|
|
4524
4560
|
planUi.changed();
|
|
4525
4561
|
todayUi.changed();
|
package/public/decide.js
ADDED
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
// Decide: help with the decisions, not only the tasks. What waits for you comes with its options
|
|
2
|
+
// and a recommendation; calls you keep making become standing decisions that are handled for you;
|
|
3
|
+
// the backlog is ranked by impact; a date at risk is laid out as choices; and past decisions are
|
|
4
|
+
// looked back on. The reasoning is the AI judge's, on your own plan.
|
|
5
|
+
|
|
6
|
+
import { expandButton, expandable } from './expand.js';
|
|
7
|
+
|
|
8
|
+
const TABS = [['waiting', 'Waiting'], ['handled', 'Handled for you'], ['standing', 'Standing decisions'], ['priority', 'Priority'], ['tradeoffs', 'Dates at risk'], ['lookback', 'Looking back']];
|
|
9
|
+
const SAVED = 'agentmgr.decideTab';
|
|
10
|
+
const ACTION = { approve: 'approve', changes: 'send back', answer: 'answer' };
|
|
11
|
+
const OUTCOME = { revisit: 'Worth another look', held: 'Held up', early: 'Too early to tell' };
|
|
12
|
+
|
|
13
|
+
/** "92% sure", with what it means. */
|
|
14
|
+
export const sure = (c) => (c == null ? '' : `<span class="tag decide-sure ${c >= 0.85 ? 'high' : c >= 0.7 ? 'mid' : 'low'}" title="How sure the recommendation is that you would agree">${Math.round(c * 100)}% sure</span>`);
|
|
15
|
+
|
|
16
|
+
/** The recommendation as it is shown on an inbox card or in the Decide window. */
|
|
17
|
+
/** An option's own words, when they say more than its name. */
|
|
18
|
+
const said = (o, esc) => (o.action !== 'approve' && o.text && o.text.trim().toLowerCase() !== o.label.trim().toLowerCase() ? `: ${esc(o.text)}` : '');
|
|
19
|
+
|
|
20
|
+
export function adviceHtml(b, esc, { full = false } = {}) {
|
|
21
|
+
if (!b) return '';
|
|
22
|
+
if (!b.options.length) return full ? `<p class="hint decide-none">${esc(b.none ?? 'No recommendation.')} <button class="link" data-decide-refresh="${esc(b.key)}">Try again</button></p>` : '';
|
|
23
|
+
const rec = b.options[b.recommend];
|
|
24
|
+
const others = b.options.map((o, i) => ({ o, i })).filter(({ i }) => i !== b.recommend);
|
|
25
|
+
return `<div class="decide-advice" data-decide-brief="${esc(b.key)}">
|
|
26
|
+
<p class="decide-rec"><span class="tag decide-tag">Recommended</span> <b>${esc(rec.label)}</b>${said(rec, esc)} ${sure(b.confidence)}${b.undo === 'hard' ? ' <span class="tag decide-hard" title="Costly to reverse once acted on: it is never decided without you unless one of your standing decisions covers it">hard to undo</span>' : ''}${b.standing ? ' <span class="tag" title="One of your standing decisions applies">standing decision</span>' : ''}</p>
|
|
27
|
+
<p class="decide-why">${esc(b.why)}</p>
|
|
28
|
+
${full && b.evidence.length ? `<ul class="decide-evidence">${b.evidence.map((e) => `<li>${esc(e)}</li>`).join('')}</ul>` : ''}
|
|
29
|
+
${b.risk ? `<p class="hint"><b>Risk:</b> ${esc(b.risk)}</p>` : ''}
|
|
30
|
+
${full ? `<ul class="decide-options">${b.options.map((o, i) => `<li class="${i === b.recommend ? 'rec' : ''}"><b>${esc(o.label)}</b>${said(o, esc)}${o.consequence ? ` <span class="hint">→ ${esc(o.consequence)}</span>` : ''}</li>`).join('')}</ul>` : ''}
|
|
31
|
+
<div class="need-actions">
|
|
32
|
+
<button class="small primary" data-decide-apply="${b.recommend}" title="${esc(rec.consequence || 'Do what is recommended')}">${esc(rec.action === 'approve' ? 'Approve' : rec.action === 'changes' ? 'Send back as recommended' : `Answer: ${rec.label}`)}</button>
|
|
33
|
+
${others.map(({ o, i }) => `<button class="small" data-decide-apply="${i}" title="${esc(o.consequence || o.text || '')}">${esc(o.action === 'approve' ? 'Approve' : o.action === 'changes' ? 'Send back' : o.label)}</button>`).join('')}
|
|
34
|
+
${b.canRace ? '<button class="small" data-decide-race title="Evidence first: each option is tried by its own agent, and you compare the results side by side (a race)">Try both</button>' : ''}
|
|
35
|
+
</div>
|
|
36
|
+
</div>`;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export function initDecide({ api, $, esc, ago, toast, openAgent, openRace, openPlan, onData }) {
|
|
40
|
+
const dialog = $('#decide-dialog');
|
|
41
|
+
const body = $('#decide-body');
|
|
42
|
+
let data = null;
|
|
43
|
+
let tab = 'waiting';
|
|
44
|
+
let again = null;
|
|
45
|
+
let adding = false;
|
|
46
|
+
try {
|
|
47
|
+
tab = localStorage.getItem(SAVED) || 'waiting';
|
|
48
|
+
} catch {}
|
|
49
|
+
if (!TABS.some(([k]) => k === tab)) tab = 'waiting';
|
|
50
|
+
|
|
51
|
+
async function load({ quiet = false } = {}) {
|
|
52
|
+
try {
|
|
53
|
+
// Open, the missing rankings and trade-off advice are asked for; a glance for the badge asks nothing.
|
|
54
|
+
data = await api('GET', `/advisor${dialog.open ? '?think=1' : ''}`);
|
|
55
|
+
} catch (e) {
|
|
56
|
+
if (!quiet) toast?.(e.message, 5000);
|
|
57
|
+
}
|
|
58
|
+
badge();
|
|
59
|
+
onData?.(data);
|
|
60
|
+
render();
|
|
61
|
+
// A ranking being written arrives by itself.
|
|
62
|
+
if (dialog.open && (data?.writing || data?.impact.some((p) => p.thinking))) changed(4000);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function badge() {
|
|
66
|
+
const el = $('#decide-count');
|
|
67
|
+
if (!el || !data) return;
|
|
68
|
+
const n = data.briefs.filter((b) => b.options.length).length + data.offers.length + data.tradeoffs.length;
|
|
69
|
+
el.textContent = n ? String(n) : data.newHandled ? `✓${data.newHandled}` : '';
|
|
70
|
+
el.classList.toggle('ready', !n && Boolean(data.newHandled));
|
|
71
|
+
el.title = n ? `${n} waiting with a recommendation` : data.newHandled ? `${data.newHandled} decided for you since you last looked` : '';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const typing = () => body.contains(document.activeElement) && /^(INPUT|TEXTAREA|SELECT)$/.test(document.activeElement.tagName);
|
|
75
|
+
const agentLink = (id, name, gone) => (gone || !id ? esc(name ?? '') : `<button class="link" data-decide-agent="${esc(id)}">${esc(name)}</button>`);
|
|
76
|
+
|
|
77
|
+
function waitingHtml() {
|
|
78
|
+
const d = data;
|
|
79
|
+
const list = d.briefs
|
|
80
|
+
.map((b) => `<li class="decide-card" data-decide-brief="${esc(b.key)}">
|
|
81
|
+
<div class="decide-card-head"><span class="tag">${b.kind === 'plan' ? 'Plan' : 'Question'}</span> <b>${esc(b.title)}</b><span class="spacer"></span><span class="hint">${esc(b.project)} · ${agentLink(b.agentId, b.agentName)} · ${esc(ago(b.at))}</span></div>
|
|
82
|
+
${adviceHtml(b, esc, { full: true })}
|
|
83
|
+
${b.kind === 'plan' ? `<p class="hint"><button class="link" data-decide-plan="${esc(b.agentId)}">Read the plan</button></p>` : ''}
|
|
84
|
+
</li>`)
|
|
85
|
+
.join('');
|
|
86
|
+
return `<p class="hint">Plans waiting for review and agents' questions, each with its options, the one recommended, why, and the risk. ${d.agreement ? `You went with the recommendation ${d.agreement.followed} of ${d.agreement.decided} times.` : ''} ${d.judge.enabled ? `Written by the AI judge (${d.judge.calls} of ${d.judge.cap} calls today, on your own plan).` : '<b>The AI judge is off</b>, so nothing is recommended: turn it on in Settings.'}</p>
|
|
87
|
+
${list ? `<ul class="decide-list">${list}</ul>` : `<p class="hint issues-empty">${d.writing ? 'Writing a recommendation…' : 'Nothing is waiting for a decision.'}</p>`}`;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function handledHtml() {
|
|
91
|
+
const list = data.handled
|
|
92
|
+
.map((h) => `<li class="decide-card ${h.isNew ? 'new' : ''}">
|
|
93
|
+
<div class="decide-card-head"><span class="tag">${h.kind === 'plan' ? 'Plan' : 'Question'}</span> <b>${esc(h.title)}</b>${h.isNew ? ' <span class="tag news-new">new</span>' : ''}<span class="spacer"></span><span class="hint">${esc(h.project)} · ${agentLink(h.agentId, h.agentName, h.agentGone)} · ${esc(ago(h.at))}</span></div>
|
|
94
|
+
<p class="decide-rec">${esc(h.did)} ${sure(h.confidence)}</p>
|
|
95
|
+
<p class="decide-why">${esc(h.why)}</p>
|
|
96
|
+
${h.standingWhen ? `<p class="hint">By your standing decision: when ${esc(h.standingWhen)}.</p>` : '<p class="hint">Within the autonomy you set for this project.</p>'}
|
|
97
|
+
</li>`)
|
|
98
|
+
.join('');
|
|
99
|
+
return `<p class="hint">What was decided without you, newest first, with the reasoning. Each one is also in the decision log (Plan → Decisions). How much may be decided without you is set per project under Standing decisions.</p>
|
|
100
|
+
${list ? `<ul class="decide-list">${list}</ul>` : '<p class="hint issues-empty">Nothing has been decided for you yet.</p>'}`;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const ruleWords = (r) => `When ${esc(r.when)} → <b>${esc(ACTION[r.action])}</b>${r.text ? `: ${esc(r.text)}` : ''}`;
|
|
104
|
+
|
|
105
|
+
function standingHtml() {
|
|
106
|
+
const d = data;
|
|
107
|
+
const offers = d.offers
|
|
108
|
+
.map((o) => `<li class="decide-card offer"><div class="decide-card-head"><span class="tag decide-tag">A call you keep making</span><span class="hint">${o.kind === 'plan' ? 'Plans' : 'Questions'} · ${esc(o.projectName ?? 'every project')} · seen ${o.count} times</span></div>
|
|
109
|
+
<p class="decide-rec">${ruleWords(o)}</p>
|
|
110
|
+
<div class="need-actions"><button class="small primary" data-decide-offer="accept" data-id="${esc(o.id)}">Make it standing</button><button class="small" data-decide-offer="dismiss" data-id="${esc(o.id)}">No</button></div></li>`)
|
|
111
|
+
.join('');
|
|
112
|
+
const rules = d.standing
|
|
113
|
+
.map((r) => `<li class="decide-card ${r.on === false ? 'off' : ''}"><div class="decide-card-head"><span class="tag">${r.kind === 'plan' ? 'Plans' : 'Questions'}</span><span class="hint">${esc(r.projectName ?? 'every project')} · used ${r.uses ?? 0} time${r.uses === 1 ? '' : 's'}${r.lastUsedAt ? `, last ${esc(ago(r.lastUsedAt))}` : ''}${r.source === 'offered' ? ' · learned from your decisions' : ''}</span><span class="spacer"></span>
|
|
114
|
+
<label class="check decide-on"><input type="checkbox" data-decide-rule-on="${esc(r.id)}" ${r.on === false ? '' : 'checked'} /> on</label><button class="link" data-decide-rule-del="${esc(r.id)}" title="Remove">✕</button></div>
|
|
115
|
+
<p class="decide-rec">${ruleWords(r)}</p></li>`)
|
|
116
|
+
.join('');
|
|
117
|
+
const form = adding
|
|
118
|
+
? `<form class="plan-form decide-form" data-decide-form="standing">
|
|
119
|
+
<select name="kind" aria-label="For"><option value="plan">For plans</option><option value="question">For questions</option></select>
|
|
120
|
+
<select name="project" aria-label="Project"><option value="">Every project</option>${d.autonomy.map((p) => `<option value="${esc(p.key)}">${esc(p.name)}</option>`).join('')}</select>
|
|
121
|
+
<input name="when" placeholder="When… (the plan only updates dependencies and the tests pass)" required minlength="8" />
|
|
122
|
+
<select name="action" aria-label="Do"><option value="approve">approve</option><option value="changes">send back</option><option value="answer">answer</option></select>
|
|
123
|
+
<input name="text" placeholder="What to send back or answer (not needed to approve)" />
|
|
124
|
+
<button class="small primary">Add</button><button type="button" class="small" data-decide="add-cancel">Cancel</button>
|
|
125
|
+
</form>`
|
|
126
|
+
: '<p><button class="small" data-decide="add">+ Add a standing decision</button> <button class="small" data-decide="learn" title="Look through your recent decisions for calls you keep making (one AI judge call)">Look for patterns now</button></p>';
|
|
127
|
+
const autonomy = d.autonomy.length
|
|
128
|
+
? `<table class="issues decide-autonomy"><tbody>${d.autonomy.map((p) => `<tr><td><b>${esc(p.name)}</b></td><td><select data-decide-level="${esc(p.key)}" aria-label="Autonomy for ${esc(p.name)}">${d.levels.map((l) => `<option value="${l.id}" ${l.id === p.level ? 'selected' : ''}>${esc(l.label)}</option>`).join('')}</select></td></tr>`).join('')}</tbody></table>`
|
|
129
|
+
: '<p class="hint">No projects yet.</p>';
|
|
130
|
+
return `<p class="hint">A standing decision is a call you made once for all the times it comes up: when it applies, it is carried out for you and reported under Handled for you. Offered when three of your decisions agree; you can also write your own.</p>
|
|
131
|
+
${offers ? `<ul class="decide-list">${offers}</ul>` : ''}
|
|
132
|
+
${rules ? `<ul class="decide-list">${rules}</ul>` : '<p class="hint">No standing decisions yet.</p>'}
|
|
133
|
+
${form}
|
|
134
|
+
<h3 class="decide-h">How much may be decided without you</h3>
|
|
135
|
+
<p class="hint">Per project. <b>Sure</b> means 85% or more; anything hard to undo always waits for you unless a standing decision of yours covers it.</p>
|
|
136
|
+
${autonomy}`;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
function priorityHtml() {
|
|
140
|
+
const cards = data.impact
|
|
141
|
+
.map((p) => `<div class="plan-project"><div class="plan-project-head"><h3>${esc(p.project.name)}</h3><span class="hint">${p.by === 'judge' ? `Ranked by the AI judge ${sure(p.confidence)}` : p.thinking ? 'Ranked by plain rules; the AI judge is thinking…' : 'Ranked by plain rules (priority, the nearest date, fixes, age)'}</span><span class="spacer"></span>
|
|
142
|
+
<button class="small ${p.inOrder ? '' : 'primary'}" data-decide-impact="${esc(p.project.key)}" ${p.inOrder ? 'disabled' : ''} title="Put the queue in this order${p.items.some((i) => i.suggest != null) ? ' and set the suggested priorities' : ''}; free agents pick from the top">${p.inOrder ? 'The queue is in this order' : 'Use this order'}</button></div>
|
|
143
|
+
<table class="issues decide-impact"><tbody>${p.items.map((i) => `<tr><td class="num hint">${i.rank}</td><td><span class="tag decide-level ${esc(i.level)}">${esc(i.level)}</span></td><td><b>${esc(i.title)}</b><div class="hint">${esc(i.why)}${i.heldUntil ? ` · held until ${esc(i.heldUntil)}` : ''}</div></td><td class="hint nowrap">P${i.priority}${i.suggest != null ? ` → <b>P${i.suggest}</b>` : ''} · ${esc(i.status)}</td></tr>`).join('')}</tbody></table></div>`)
|
|
144
|
+
.join('');
|
|
145
|
+
return `<p class="hint">Each project's open backlog, most valuable first: what is nearest a date, what unblocks other work, what removes risk. The reason is beside each item.</p>
|
|
146
|
+
${cards || '<p class="hint issues-empty">No open backlog items.</p>'}`;
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
function tradeoffsHtml() {
|
|
150
|
+
const cards = data.tradeoffs
|
|
151
|
+
.map((t) => `<div class="plan-project"><div class="plan-project-head"><h3>${esc(t.project.name)}: ${esc(t.stage.label)}</h3><span class="tag plan-${esc(t.stage.status)}">${t.stage.status === 'late' ? 'late' : 'at risk'}</span><span class="hint">${esc(t.stage.date)} · ${esc(t.stage.words)} · ${t.open} open${t.need != null ? `, about ${t.need} days at the pace of ${t.perDay} a day` : ', nothing finished in the last two weeks to judge the pace by'}</span><span class="spacer"></span><button class="link" data-decide="dates">Checklist</button></div>
|
|
152
|
+
<ul class="decide-choices">${t.options.map((o) => `<li class="${o.id === t.recommend ? 'rec' : ''}">
|
|
153
|
+
<div class="decide-choice-head"><b>${esc(o.label)}</b>${o.id === t.recommend ? ` <span class="tag decide-tag">Recommended</span> ${t.by === 'judge' ? sure(t.confidence) : '<span class="hint">(plain rules)</span>'}` : ''}</div>
|
|
154
|
+
<p>${esc(o.what)}</p><p class="hint">${esc(o.consequence)}</p>
|
|
155
|
+
${o.items ? `<ul class="hint decide-cut">${o.items.map((i) => `<li>${esc(i.title)}</li>`).join('')}</ul>` : ''}
|
|
156
|
+
${o.id === t.recommend ? `<p class="decide-why">${esc(t.why)}</p>` : ''}
|
|
157
|
+
<button class="small ${o.id === t.recommend ? 'primary' : ''}" data-decide-tradeoff="${esc(t.key)}" data-option="${esc(o.id)}">Do this</button></li>`).join('')}</ul></div>`)
|
|
158
|
+
.join('');
|
|
159
|
+
return `<p class="hint">A date that is at risk or late, as choices. Picking one carries it out (items held, the date moved, or more agents started) and records it in the decision log.</p>
|
|
160
|
+
${cards || '<p class="hint issues-empty">No date is at risk. Dates are set in Plan → Dates.</p>'}`;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
function lookbackHtml() {
|
|
164
|
+
const l = data.lookback;
|
|
165
|
+
const rows = l.items
|
|
166
|
+
.map((r) => `<li class="decide-card ${esc(r.outcome)}"><div class="decide-card-head"><span class="tag decide-outcome ${esc(r.outcome)}">${OUTCOME[r.outcome]}</span> <b>${esc(r.title)}</b><span class="spacer"></span><span class="hint">${esc(r.project.name)}${r.agentName ? ` · ${agentLink(r.agentId, r.agentName, !r.agentId)}` : ''} · decided ${esc(ago(r.decidedAt))}</span></div>
|
|
167
|
+
<p class="decide-rec">${esc(r.decision)}</p>
|
|
168
|
+
${r.signs.length ? `<p class="hint">What followed: ${r.signs.map(esc).join('; ')}.</p>` : ''}
|
|
169
|
+
${r.lesson ? `<p class="decide-why"><b>Next time:</b> ${esc(r.lesson)}</p>` : ''}</li>`)
|
|
170
|
+
.join('');
|
|
171
|
+
return `<div class="plan-bar"><span class="hint">What followed each past decision (plans, answers, designs): ${l.revisit} worth another look, ${l.held} held up. The lessons are given to the next recommendation.${l.lookedAt ? ` Looked ${esc(ago(l.lookedAt))}; again every hour.` : ''}</span><span class="spacer"></span><button class="small" data-decide="lookback">Look now</button></div>
|
|
172
|
+
${l.lessons.length ? `<div class="decide-lessons"><b>What they taught</b><ul>${l.lessons.map((x) => `<li>${esc(x)}</li>`).join('')}</ul></div>` : ''}
|
|
173
|
+
${rows ? `<ul class="decide-list">${rows}</ul>` : '<p class="hint issues-empty">Nothing to look back on yet: decisions are looked at two days after they are made.</p>'}`;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
function draw() {
|
|
177
|
+
const d = data;
|
|
178
|
+
const count = d ? { waiting: d.briefs.length, handled: d.newHandled, standing: d.offers.length, tradeoffs: d.tradeoffs.length, lookback: d.lookback.revisit } : {};
|
|
179
|
+
body.innerHTML = `
|
|
180
|
+
<div class="issues-head">
|
|
181
|
+
<h2>Decide</h2>
|
|
182
|
+
<div class="chips" role="tablist">${TABS.map(([k, label]) => `<button class="chip ${k === tab ? 'active' : ''}" role="tab" aria-selected="${k === tab}" data-decide-tab="${k}">${label}${count[k] ? ` <span class="count">${count[k]}</span>` : ''}</button>`).join('')}</div>
|
|
183
|
+
<span class="spacer"></span>
|
|
184
|
+
${expandButton(dialog)}
|
|
185
|
+
<button class="small" data-decide="close" title="Close (Esc)">Close</button>
|
|
186
|
+
</div>
|
|
187
|
+
${!d ? '<p class="hint">Loading…</p>' : d.enabled === false ? '<p class="hint issues-empty">Decide is off. Turn it on with <code>"decide": { "enabled": true }</code> in config.json.</p>' : `<div class="issues-scroll decide-scroll">${{ waiting: waitingHtml, handled: handledHtml, standing: standingHtml, priority: priorityHtml, tradeoffs: tradeoffsHtml, lookback: lookbackHtml }[tab]()}</div>`}`;
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
// A change from the daemon doesn't take what you are typing.
|
|
191
|
+
function render() {
|
|
192
|
+
if (!dialog.open || typing()) return;
|
|
193
|
+
const top = body.querySelector('.decide-scroll')?.scrollTop ?? 0;
|
|
194
|
+
draw();
|
|
195
|
+
const sc = body.querySelector('.decide-scroll');
|
|
196
|
+
if (sc) sc.scrollTop = top;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const run = async (fn, done) => {
|
|
200
|
+
try {
|
|
201
|
+
await fn();
|
|
202
|
+
if (done) toast?.(done, 3000);
|
|
203
|
+
} catch (e) {
|
|
204
|
+
toast?.(e.message, 6000);
|
|
205
|
+
}
|
|
206
|
+
document.activeElement?.blur?.();
|
|
207
|
+
await load({ quiet: true });
|
|
208
|
+
};
|
|
209
|
+
|
|
210
|
+
/** Carry out an option of a brief, from here or from an inbox card. */
|
|
211
|
+
const apply = (key, option) => run(() => api('POST', '/advisor/briefs/apply', { key, option: Number(option) }), 'Done; it is in the decision log');
|
|
212
|
+
const race = (key) =>
|
|
213
|
+
run(async () => {
|
|
214
|
+
const r = await api('POST', '/advisor/briefs/race', { key });
|
|
215
|
+
if (dialog.open) dialog.close();
|
|
216
|
+
openRace?.(r.race);
|
|
217
|
+
}, 'Each option is being tried by its own agent');
|
|
218
|
+
const refresh = (key) => run(() => api('POST', '/advisor/briefs/refresh', { key }), 'Asking again');
|
|
219
|
+
|
|
220
|
+
/** Clicks on a recommendation, wherever it is drawn. True when it was one. */
|
|
221
|
+
function handle(e) {
|
|
222
|
+
const card = e.target.closest('[data-decide-brief]');
|
|
223
|
+
const r = e.target.closest('[data-decide-refresh]');
|
|
224
|
+
if (r) return refresh(r.dataset.decideRefresh), true;
|
|
225
|
+
if (!card) return false;
|
|
226
|
+
const a = e.target.closest('[data-decide-apply]');
|
|
227
|
+
if (a) return apply(card.dataset.decideBrief, a.dataset.decideApply), true;
|
|
228
|
+
if (e.target.closest('[data-decide-race]')) return race(card.dataset.decideBrief), true;
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
body.addEventListener('click', (e) => {
|
|
233
|
+
const t = e.target.closest('[data-decide-tab]');
|
|
234
|
+
if (t) {
|
|
235
|
+
tab = t.dataset.decideTab;
|
|
236
|
+
try {
|
|
237
|
+
localStorage.setItem(SAVED, tab);
|
|
238
|
+
} catch {}
|
|
239
|
+
if (tab === 'handled' && data?.newHandled) api('POST', '/advisor/seen', {}).catch(() => {});
|
|
240
|
+
return draw();
|
|
241
|
+
}
|
|
242
|
+
if (handle(e)) return;
|
|
243
|
+
const ag = e.target.closest('[data-decide-agent]');
|
|
244
|
+
if (ag) return dialog.close(), openAgent?.(ag.dataset.decideAgent);
|
|
245
|
+
const pl = e.target.closest('[data-decide-plan]');
|
|
246
|
+
if (pl) return dialog.close(), openAgent?.(pl.dataset.decidePlan, { plan: true });
|
|
247
|
+
const of = e.target.closest('[data-decide-offer]');
|
|
248
|
+
if (of) return run(() => api('POST', `/advisor/offers/${of.dataset.id}/${of.dataset.decideOffer}`, {}), of.dataset.decideOffer === 'accept' ? 'It is a standing decision now' : null);
|
|
249
|
+
const del = e.target.closest('[data-decide-rule-del]');
|
|
250
|
+
if (del) return run(() => api('DELETE', `/advisor/standing/${del.dataset.decideRuleDel}`));
|
|
251
|
+
const im = e.target.closest('[data-decide-impact]');
|
|
252
|
+
if (im) return run(() => api('POST', '/advisor/impact/apply', { project: im.dataset.decideImpact }), 'The queue is in this order');
|
|
253
|
+
const tr = e.target.closest('[data-decide-tradeoff]');
|
|
254
|
+
if (tr) return run(() => api('POST', '/advisor/tradeoffs/apply', { key: tr.dataset.decideTradeoff, option: tr.dataset.option }), 'Done, and recorded in the decision log');
|
|
255
|
+
const b = e.target.closest('[data-decide]')?.dataset.decide;
|
|
256
|
+
if (b === 'close') return dialog.close();
|
|
257
|
+
if (b === 'add' || b === 'add-cancel') return (adding = b === 'add'), draw();
|
|
258
|
+
if (b === 'dates') return dialog.close(), openPlan?.('dates');
|
|
259
|
+
if (b === 'lookback') return run(() => api('POST', '/advisor/lookback', {}), 'Looked');
|
|
260
|
+
if (b === 'learn') return run(async () => toast?.((await api('POST', '/advisor/learn', {})).offers.length ? 'Found a call you keep making' : 'No clear pattern in your recent decisions', 4000));
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
body.addEventListener('change', (e) => {
|
|
264
|
+
const lv = e.target.closest('[data-decide-level]');
|
|
265
|
+
if (lv) return run(() => api('PUT', '/advisor/autonomy', { project: lv.dataset.decideLevel, level: lv.value }), 'Saved');
|
|
266
|
+
const on = e.target.closest('[data-decide-rule-on]');
|
|
267
|
+
if (on) return run(() => api('POST', `/advisor/standing/${on.dataset.decideRuleOn}`, { on: on.checked }));
|
|
268
|
+
});
|
|
269
|
+
|
|
270
|
+
body.addEventListener('submit', (e) => {
|
|
271
|
+
if (e.target.dataset.decideForm !== 'standing') return;
|
|
272
|
+
e.preventDefault();
|
|
273
|
+
const f = Object.fromEntries(new FormData(e.target));
|
|
274
|
+
run(async () => {
|
|
275
|
+
await api('POST', '/advisor/standing', { ...f, project: f.project || null });
|
|
276
|
+
adding = false;
|
|
277
|
+
}, 'Added');
|
|
278
|
+
});
|
|
279
|
+
|
|
280
|
+
dialog.addEventListener('close', () => {
|
|
281
|
+
if (data?.newHandled && tab === 'handled') load({ quiet: true });
|
|
282
|
+
});
|
|
283
|
+
|
|
284
|
+
function open(which) {
|
|
285
|
+
if (dialog.open && !which) return dialog.close();
|
|
286
|
+
if (which && TABS.some(([k]) => k === which)) tab = which;
|
|
287
|
+
if (!dialog.open) dialog.showModal();
|
|
288
|
+
draw();
|
|
289
|
+
load();
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** The daemon says something changed: the badge and the inbox cards now, the window while open. */
|
|
293
|
+
function changed(ms) {
|
|
294
|
+
clearTimeout(again);
|
|
295
|
+
again = setTimeout(() => load({ quiet: true }), ms ?? (dialog.open ? 300 : 1200));
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
expandable(dialog, draw);
|
|
299
|
+
load({ quiet: true });
|
|
300
|
+
return { open, changed, handle, isOpen: () => dialog.open, brief: (key) => data?.briefs.find((b) => b.key === key) ?? null };
|
|
301
|
+
}
|
package/public/index.html
CHANGED
|
@@ -40,6 +40,7 @@
|
|
|
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="decide-btn" title="Decide: what waits for you with its options and a recommendation, your standing decisions and what was decided for you, the backlog by impact, dates at risk as choices, and a look back at past decisions">Decide <span id="decide-count" class="badge"></span></button>
|
|
43
44
|
<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
45
|
<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>
|
|
45
46
|
<button id="map-btn" title="The codebase map: where each agent is changing and reading code, and who is about to collide">Map</button>
|
|
@@ -198,6 +199,7 @@
|
|
|
198
199
|
<button class="term-tab" data-side="docs" role="tab" title="Diagrams and the other documents">Docs</button>
|
|
199
200
|
<button class="term-tab" data-side="changes" role="tab" title="Its changes, explained one by one">Changes</button>
|
|
200
201
|
<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>
|
|
202
|
+
<button class="term-tab" data-side="reverse" role="tab" title="Reverse engineer: name a target (an app, a binary, a website) and what to understand; the agent investigates with REA's tools and its report shows here, with diagrams, evidence, what could not be determined, and a plan to build your own">Reverse</button>
|
|
201
203
|
</div>
|
|
202
204
|
<span class="spacer"></span>
|
|
203
205
|
<button type="button" class="ghost small" id="side-close" title="Close the split">✕</button>
|
|
@@ -422,6 +424,9 @@
|
|
|
422
424
|
<dialog id="plan-dialog" class="issues-dialog plan-dialog" aria-label="Plan">
|
|
423
425
|
<div id="plan-body"></div>
|
|
424
426
|
</dialog>
|
|
427
|
+
<dialog id="decide-dialog" class="issues-dialog decide-dialog" aria-label="Decide">
|
|
428
|
+
<div id="decide-body"></div>
|
|
429
|
+
</dialog>
|
|
425
430
|
<dialog id="os-dialog" class="issues-dialog os-dialog" aria-label="OS">
|
|
426
431
|
<div id="os-body"></div>
|
|
427
432
|
</dialog>
|
|
@@ -603,6 +608,7 @@
|
|
|
603
608
|
<label class="check"><input type="checkbox" name="ev_budget" /> nears or reaches its budget, or today's spend reaches the daily limit</label>
|
|
604
609
|
<label class="check"><input type="checkbox" name="ev_standup" /> the daily standup is ready (with a link to play it)</label>
|
|
605
610
|
<label class="check"><input type="checkbox" name="ev_value" /> value reports (weekly, monthly, quarterly, as set in Value)</label>
|
|
611
|
+
<label class="check"><input type="checkbox" name="ev_decided" /> something was decided for you: a standing decision of yours applied, or it was within the autonomy you set (Decide)</label>
|
|
606
612
|
<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>
|
|
607
613
|
<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>
|
|
608
614
|
<label class="check"><input type="checkbox" name="skipWhenWatching" /> not while I have its terminal open</label>
|