ai-agentmanager 1.68.0 → 1.70.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 +18 -0
- package/README.md +99 -2
- package/package.json +1 -1
- package/public/acceptance.js +2 -0
- package/public/app.js +9 -0
- package/public/index.html +13 -1
- package/public/proof.js +21 -2
- package/public/quality.js +10 -2
- package/public/readfirst.js +84 -0
- package/public/style.css +30 -3
- package/public/understand.js +90 -0
- package/public/weekly.js +15 -6
- package/src/brief.js +47 -0
- package/src/cli.js +84 -4
- package/src/manager.js +57 -0
- package/src/proof.js +10 -1
- package/src/quality.js +69 -6
- package/src/readfirst.js +148 -0
- package/src/record.js +92 -1
- package/src/server.js +39 -2
- package/src/standards.js +2 -0
- package/src/trace.js +69 -0
- package/src/weekly.js +68 -28
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.70.0 (2026-11-24)
|
|
4
|
+
|
|
5
|
+
- **Production signal: incidents from your monitoring tool.** Any tool, a script or you can report an incident (`agentmgr quality incident "<title>"`, or `POST /api/quality/incident`). It is linked to the merged pull request it belongs to: the one it names, the one that merged as the commit it was seen on, or the latest that changed a file in its stack trace. That pull request then shows **Incident in production** and counts as one that did not hold up in Quality, the track record and the weekly summary. The same id is counted once. An agent cannot report one.
|
|
6
|
+
- **Delegation map.** The track record sorts work by kind (features, bug fixes, tests, documentation, upgrades, refactoring, investigation), read from each request's words, with how it held up and how much ran without you. It names the next kind worth handing over more of, and the kinds worth keeping close. It sees only work given to agents.
|
|
7
|
+
|
|
8
|
+
## 1.69.0 (2026-11-24)
|
|
9
|
+
|
|
10
|
+
- **Read first: where your attention goes.** **Read first** in the top bar, or `agentmgr read-first`, ranks finished work waiting for your review by how much it needs reading: **Read closely**, **Look** or **Skim**, with the reasons and where to start. The ranking adds up facts the app already measured: high-risk files, the scorecard, checks and CI, breaks the tests did not notice, recorded commands that gave a different result, what was left out, risks not checked, the agent's own confidence, size, and questions answered for you. No model decides it.
|
|
11
|
+
- **In an agent's Results.** A **Review** line with the level and the first reasons; **Why** opens the full list.
|
|
12
|
+
- **Mark as reviewed.** A piece leaves the queue when its pull request merges or when you mark it as reviewed (`--reviewed <agent>`), and comes back if the agent changes its work again. Everything finished more than 14 days ago can be cleared at once.
|
|
13
|
+
- **Limits.** "Skim" means nothing measured speaks against it, not that it is correct. The points are a fixed table chosen by judgement.
|
|
14
|
+
- **Understanding check.** **Check my understanding** on a piece in Read first, or `agentmgr understand <agent>`, asks two or three questions about what the change does: what happens on a failure, an empty input, or what depends on it. Answer first, then show the answer and where to read it, and say whether you knew it. Nothing grades you. One model call.
|
|
15
|
+
- **Requirement trace.** In the Proof dialog, or `agentmgr trace <agent>`: each point of what done means followed to the scorecard's finding, the checks recorded for it (and whether they held when run again), and what is missing. Points with a gap count in Read first.
|
|
16
|
+
- **Monthly and quarterly summaries.** The weekly summary also covers a month or a quarter (`--month`, `--quarter`, and tabs in the dialog), written by itself as drafts when the period ends.
|
|
17
|
+
- **Model fit.** The track record compares models by share that held up, scorecard and cost per piece against the most used one, and suggests a cheaper model that held up as well, with at least 5 settled pull requests behind both.
|
|
18
|
+
- **Fixed: a point typed in What done means could be lost.** When the dialog's load finished after you had started typing a new point, the list was drawn again without it. What is typed is now read back first.
|
|
19
|
+
- **Fixed:** a test that failed in the first minutes after midnight; the split screen test now reports the sizes it saw when it times out.
|
|
20
|
+
|
|
3
21
|
## 1.68.0 (2026-11-24)
|
|
4
22
|
|
|
5
23
|
- **Weekly summary: technical, with no money amounts.** The AI cost and the dollar value are gone. Under each delivered piece the summary now says **How** it was done (from the agent's brief), what was **Changed** (files, lines, folders, test files) and how it was **Checked** (checks passed, commands recorded with their output, breaks caught by the tests, the scorecard, named risks avoided, reviews).
|
package/README.md
CHANGED
|
@@ -601,6 +601,23 @@ A break the tests fail on is **Caught**. A break they still pass on is **Not not
|
|
|
601
601
|
- The breaks are made on the text of a line, not on a parsed program. They cover JavaScript, TypeScript, Python, Go, Ruby, Java, Kotlin, Rust, C, C++, C#, PHP, Swift and Scala.
|
|
602
602
|
- Each run of the tests may take 5 minutes at most, and a whole run 15 (`"testTheTests"` in config.json: `max`, `timeoutMs`, `budgetMs`). An agent in a container is not covered.
|
|
603
603
|
|
|
604
|
+
## Production signal: incidents from your monitoring tool
|
|
605
|
+
|
|
606
|
+
Quality judges merged work by what GitHub shows. An incident in production says more: users met it. Any monitoring tool, a script, or you can report one, and it is linked to the merged pull request it belongs to:
|
|
607
|
+
|
|
608
|
+
```sh
|
|
609
|
+
agentmgr quality incident "NaN totals at checkout" --files src/total.js:12 --id DD-9 --url https://monitor.example/DD-9
|
|
610
|
+
curl -X POST -H 'x-agentmgr: 1' -H 'content-type: application/json' http://127.0.0.1:<port>/api/quality/incident \
|
|
611
|
+
-d '{"title":"NaN totals at checkout","commit":"feedbeef","id":"DD-9","source":"datadog"}'
|
|
612
|
+
```
|
|
613
|
+
|
|
614
|
+
- **How it is matched.** The pull request it names (`--pr`); else the one that merged as the commit it was seen on (`--commit`: a release is often a commit); else, of the pull requests merged in the watch days before it, the latest that changed a file in its stack trace (`--files`).
|
|
615
|
+
- **What it changes.** That pull request shows **Incident in production** in Quality, with the link and how it was matched. It counts as one that did not hold up in Quality's totals, the [track record](#track-record-was-the-confidence-right) and the [weekly summary](#weekly-summary-the-weeks-work-and-achievements-for-management), and it can become a lesson in [Standards](#standards-what-every-change-in-a-repository-has-to-meet). What you mark yourself still wins.
|
|
616
|
+
- **Reported twice.** The same `--id` is counted once. A wrong match can be taken off (`POST /api/quality/incident/drop` with the pull request and the id).
|
|
617
|
+
- **Who reports it.** You or your tools; an agent's own call is refused.
|
|
618
|
+
|
|
619
|
+
**Limits.** There is no built-in connector to a particular tool: point your tool's webhook, or a small script, at the route above. The daemon listens on this computer, so a tool in the cloud needs a script that forwards to it. Matching by files picks the latest pull request that touched them, which can be the wrong one when several did.
|
|
620
|
+
|
|
604
621
|
## Track record: was the confidence right?
|
|
605
622
|
|
|
606
623
|
An agent writes "Confidence: 85%" and the scorecard says "Ready to approve". The track record shows how much those were worth.
|
|
@@ -625,6 +642,25 @@ An agent writes "Confidence: 85%" and the scorecard says "Ready to approve". The
|
|
|
625
642
|
|
|
626
643
|
A row with fewer than 5 settled pull requests says "too few to say". "Said more than held up" means the average confidence was at least 15 points above the share that held.
|
|
627
644
|
|
|
645
|
+
### Delegation map: what to hand over next
|
|
646
|
+
|
|
647
|
+
The track record also sorts work by kind, read from the words of each request: features, bug fixes, tests, documentation, upgrades and migrations, refactoring, investigation. For each kind it shows how it held up and how much of it ran without you.
|
|
648
|
+
|
|
649
|
+
| Advice | When |
|
|
650
|
+
| --- | --- |
|
|
651
|
+
| **Hand over more** | At least 5 settled pull requests, 9 in 10 held up, and most of it still asked you |
|
|
652
|
+
| **Keep close** | At least 5 settled, and under 7 in 10 held up |
|
|
653
|
+
|
|
654
|
+
The kind that held up best among the "hand over more" ones is named as the next to hand over: set its projects' level, or start that kind of work with "Agree, then run".
|
|
655
|
+
|
|
656
|
+
**Limits.** It sees only work given to agents, not what you do by hand. The kind is read from words with fixed rules, so a request can land in the wrong kind; work it cannot place counts as a feature. Pull requests merged before this version are sorted by their title.
|
|
657
|
+
|
|
658
|
+
### Model fit: which model held up as well for less
|
|
659
|
+
|
|
660
|
+
The track record also compares models. For each engine and model it shows how many settled pieces it did, the share that held up, the average review scorecard and the cost per piece against the most used model's (a ratio, not money).
|
|
661
|
+
|
|
662
|
+
It suggests a model when another one held up within 5 points of the most used one, at three quarters of its cost or less, with at least 5 settled pull requests behind both: "sonnet held up as well as opus (100% against 90%) at 0.4 times the cost: worth trying for more of the work." The cost is what the AI work cost as each pull request merged, kept only for this comparison. Pull requests merged before this version have no cost kept and are not counted in it.
|
|
663
|
+
|
|
628
664
|
### Earned autonomy: the level a project's record supports
|
|
629
665
|
|
|
630
666
|
The last table lists each project with the level of [Without you](#without-you-how-far-an-agent-goes-on-its-own) its new agents get, and what the record supports:
|
|
@@ -1429,6 +1465,67 @@ Agents started this way are marked **⚡ GitHub** or **⚡ webhook**, Slack aler
|
|
|
1429
1465
|
}
|
|
1430
1466
|
```
|
|
1431
1467
|
|
|
1468
|
+
## Read first: where your attention goes
|
|
1469
|
+
|
|
1470
|
+
You cannot read everything agents produce with the same care. **Read first** in the top bar, or `agentmgr read-first`, ranks finished work waiting for your review by how much it needs reading.
|
|
1471
|
+
|
|
1472
|
+
Each piece gets a level, the reasons, and where to start:
|
|
1473
|
+
|
|
1474
|
+
| Level | Means |
|
|
1475
|
+
| --- | --- |
|
|
1476
|
+
| **Read closely** | Several things measured speak against it (45 points or more) |
|
|
1477
|
+
| **Look** | Something does, or little was measured (20 to 44) |
|
|
1478
|
+
| **Skim** | Nothing measured speaks against it |
|
|
1479
|
+
|
|
1480
|
+
The points add up facts the app already holds. No model decides the ranking, so each reason can be checked:
|
|
1481
|
+
|
|
1482
|
+
| What | Points |
|
|
1483
|
+
| --- | --- |
|
|
1484
|
+
| Touches files you marked high risk | 30 |
|
|
1485
|
+
| The scorecard says not ready; says to look first; not scored yet | 30; 15; 10 |
|
|
1486
|
+
| The quality bar is not met; CI is failing; its own tests fail when run | 25 each |
|
|
1487
|
+
| A recorded command gave a different result when run again | 25 |
|
|
1488
|
+
| One of its own checks failed | 20 |
|
|
1489
|
+
| Deliberate breaks its tests did not notice | 12 to 20 |
|
|
1490
|
+
| A large change: over 1500 lines; over 400 | 20; 10 |
|
|
1491
|
+
| Its own confidence under 65%; under 85%; none given | 15; 5; 5 |
|
|
1492
|
+
| Points of what done means that are not met; that have no recorded run behind them | 15 each up to 30; 6 each up to 18 |
|
|
1493
|
+
| Things it lists as not done | 6 each, up to 18 |
|
|
1494
|
+
| Risks it named that happened; that it did not check | 10 each; 5 each |
|
|
1495
|
+
| It says the work is partial | 10 |
|
|
1496
|
+
| No proof recorded for passed checks; code changed with no test file | 8 each |
|
|
1497
|
+
| Questions answered for you while it ran without you | 6 to 12 |
|
|
1498
|
+
| Its tests have not been tested | 5 |
|
|
1499
|
+
|
|
1500
|
+
What speaks for a piece is listed too: the scorecard says ready, its tests caught every break, its recorded commands gave the same result again.
|
|
1501
|
+
|
|
1502
|
+
- **Start with.** High-risk files, the places the scorecard pointed at, and the lines whose breaks went unnoticed.
|
|
1503
|
+
- **In an agent's Results.** A **Review** line with its level and the first reasons; **Why** opens the full list.
|
|
1504
|
+
- **Leaving the queue.** A piece leaves when its pull request merges, or when you press **Mark as reviewed** (`--reviewed <agent>`). It comes back if the agent changes its work again. **Mark those as reviewed** clears everything finished more than 14 days ago (`--reviewed-older 14`). An agent cannot mark its own work.
|
|
1505
|
+
- **Exit code.** `agentmgr read-first` exits with 1 when something is to be read closely.
|
|
1506
|
+
|
|
1507
|
+
### Understanding check
|
|
1508
|
+
|
|
1509
|
+
Ranking tells you where to look. **Check my understanding** (on a piece in Read first, or `agentmgr understand <agent>`) asks whether you did, before you approve.
|
|
1510
|
+
|
|
1511
|
+
- It writes two or three questions from the agent's changes: what happens on a failure, an empty input, a second call, or what else depends on what changed. Not trivia and not names.
|
|
1512
|
+
- You answer in your head. Then **Show the answer**, which comes with where to read it, and say whether you knew it.
|
|
1513
|
+
- The ones you did not know point to the file and hunk. Nothing grades you and nothing is sent anywhere.
|
|
1514
|
+
- The command prints only the questions; `--answers` prints the answers. `--again` writes new ones.
|
|
1515
|
+
- It is one model call. The questions and answers are the model's reading of the diff: check an answer against the code before you trust it.
|
|
1516
|
+
|
|
1517
|
+
**Limits.** "Skim" means nothing that was measured speaks against it. It does not mean the work is correct. Work finished before proof, confidence and the scorecard existed has little measured, so it ranks as "Look" for that reason alone. The points are a fixed table chosen by judgement, not fitted to data; the [track record](#track-record-was-the-confidence-right) will show over time whether the ranking matches what held up.
|
|
1518
|
+
|
|
1519
|
+
## Requirement trace: from each point of what done means to what shows it
|
|
1520
|
+
|
|
1521
|
+
In an agent's **Proof** dialog under **What done means, traced**, or `agentmgr trace <agent>`: each point you [agreed on](#acceptance-agree-on-what-done-means) (or the scorecard's criteria when none were agreed), followed to:
|
|
1522
|
+
|
|
1523
|
+
- the scorecard's finding (met, not met, not verified) and its evidence,
|
|
1524
|
+
- the checks the agent recorded for it, with the command, the exit code, and whether it gave the same result when the app ran it again,
|
|
1525
|
+
- what is missing: nothing recorded, checked by reading only, a different result when run again, or not met.
|
|
1526
|
+
|
|
1527
|
+
A point with a gap stands out and counts in the [Read first](#read-first-where-your-attention-goes) ranking. `agentmgr trace` exits with 1 when a point has a gap. It joins what the scorecard and the proof already hold, with no model call. A point is matched to a check by the id its section starts with ("A2 ...") or by the same wording.
|
|
1528
|
+
|
|
1432
1529
|
## Weekly summary: the week's work and achievements, for management
|
|
1433
1530
|
|
|
1434
1531
|
**Work record → Weekly summary**, or `agentmgr weekly`, gives one page on a week that you can pass to your manager.
|
|
@@ -1444,8 +1541,8 @@ Agents started this way are marked **⚡ GitHub** or **⚡ webhook**, Slack aler
|
|
|
1444
1541
|
| In progress | Open work by project: in review or in progress |
|
|
1445
1542
|
| Blocked | What needs a decision or help, with what it waits for |
|
|
1446
1543
|
|
|
1447
|
-
- **Which
|
|
1448
|
-
- **Getting it out.** **Copy** (Markdown, for an email, a document or Slack), **Download**, or **Save on this computer** (`--save`, or `-o <file>`). When a week is over, its summary is also written by itself to `~/.agentmanager/reports
|
|
1544
|
+
- **Which period.** A week by default; **Month** or **Quarter** (`--month`, `--quarter`) for a performance review or a planning meeting, with the same sections and the period before beside it. Last one by default; **This ... so far** or `--current` for the one running.
|
|
1545
|
+
- **Getting it out.** **Copy** (Markdown, for an email, a document or Slack), **Download**, or **Save on this computer** (`--save`, or `-o <file>`). When a week, a month or a quarter is over, its summary is also written by itself to `~/.agentmanager/reports/` (`weekly-<monday>.md`, `monthly-<year>-<month>.md`, `quarterly-<year>-Q<n>.md`) (`"weekly": { "auto": false }` in config.json turns that off).
|
|
1449
1546
|
- **Nothing is sent.** It is a draft for you to read and pass on.
|
|
1450
1547
|
- **Private work stays private.** Work that is [kept private](#kept-private-possibly-patentable-work-is-not-sent-out) is counted and listed as "(kept private)", with no title, link or description.
|
|
1451
1548
|
|
package/package.json
CHANGED
package/public/acceptance.js
CHANGED
|
@@ -101,6 +101,8 @@ export function initAcceptance({ dialog, api, esc, toast, ago, agentOf, upsert }
|
|
|
101
101
|
try {
|
|
102
102
|
const view = await api('GET', `/agents/${id}/acceptance`);
|
|
103
103
|
if (st?.id !== id) return;
|
|
104
|
+
// What was typed while it loaded is read back before the list is drawn again.
|
|
105
|
+
readEdits();
|
|
104
106
|
st.view = view;
|
|
105
107
|
st.error = null;
|
|
106
108
|
// Not agreed yet: straight to the points, to edit. (Typing in progress is kept.)
|
package/public/app.js
CHANGED
|
@@ -61,6 +61,8 @@ import { acceptanceRow, acceptanceWaits, initAcceptance } from '/acceptance.js';
|
|
|
61
61
|
import { autoNeedHtml, autonomyNeeds, autonomyRow, initAutonomy, needsPermissionHint } from '/autonomy.js';
|
|
62
62
|
import { initProof, proofRows } from '/proof.js';
|
|
63
63
|
import { initWeekly } from '/weekly.js';
|
|
64
|
+
import { initReadFirst, readFirstRow } from '/readfirst.js';
|
|
65
|
+
import { initUnderstand } from '/understand.js';
|
|
64
66
|
import { kindHtml, optionsRows, parseKind, parsePaths, parseValue, pathsHtml, privateRow, valueHtml } from '/valuelens.js';
|
|
65
67
|
|
|
66
68
|
const $ = (sel) => document.querySelector(sel);
|
|
@@ -223,6 +225,8 @@ initSpend({ api, esc, toast, $ });
|
|
|
223
225
|
const goalsUi = initGoals({ api, esc, toast, $, ago: (t) => ago(t), getProjects: () => projectsState, rerender: () => renderBacklog() });
|
|
224
226
|
initWorklog({ api, esc, toast, $ });
|
|
225
227
|
initWeekly({ api, esc, toast, $, md: (t) => md(t) });
|
|
228
|
+
const understandUi = initUnderstand({ $, esc, api, toast: (m, ms) => toast(m, ms), openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)), agentOf: (id) => agents.get(id) });
|
|
229
|
+
const readFirstUi = initReadFirst({ $, esc, ago: (t) => ago(t), agents, openAgent: (id) => (showTab('agents'), select(id)), openChanges: (id) => (showTab('agents'), select(id), reviewUi.open(id)), projectOf: (a) => a.projectInfo?.name ?? null, api, toast: (m, ms) => toast(m, ms), understand: (id) => understandUi.open(id) });
|
|
226
230
|
initSetup({ api, esc, $ });
|
|
227
231
|
const updateUi = initUpdate({ api, esc, toast, $ });
|
|
228
232
|
initMenu({ api, esc, toast, $ });
|
|
@@ -1118,6 +1122,7 @@ function resultsCard(a) {
|
|
|
1118
1122
|
${scoreStrip(a)}
|
|
1119
1123
|
${r.confidence ? `<p class="own-conf"><span class="tag conf-${esc(r.confidence.level)}" title="The agent's own confidence in what it built, as it wrote it in its brief. The review scorecard is the separate check.">Its own confidence: ${r.confidence.percent}%</span> ${esc(r.confidence.why)}</p>` : r.fromAgent && ['done', 'partial'].includes(r.outcome) ? '<p class="hint own-conf">The agent has not said how confident it is in this.</p>' : ''}
|
|
1120
1124
|
${r.blockers.length ? `<ul class="blockers">${r.blockers.map((x) => item(x, 'blocker')).join('')}</ul>` : ''}
|
|
1125
|
+
${readFirstRow(a, esc)}
|
|
1121
1126
|
${privateRow(a, esc)}
|
|
1122
1127
|
${optionsRows(a, esc)}
|
|
1123
1128
|
${proofRows(a, esc)}
|
|
@@ -2809,6 +2814,7 @@ const ALL_VIEWS = Object.keys(VIEWS);
|
|
|
2809
2814
|
function render() {
|
|
2810
2815
|
dirty.clear();
|
|
2811
2816
|
perf.draw(ALL_VIEWS);
|
|
2817
|
+
readFirstUi.render();
|
|
2812
2818
|
}
|
|
2813
2819
|
|
|
2814
2820
|
// Live updates come many times a second when many agents work. They mark the views they touch,
|
|
@@ -4024,6 +4030,7 @@ function upsert(a) {
|
|
|
4024
4030
|
|
|
4025
4031
|
/** Views that show one agent's details outside the main render: keep them current. */
|
|
4026
4032
|
function agentChanged(a) {
|
|
4033
|
+
understandUi.agentChanged(a);
|
|
4027
4034
|
if (a.id === term.agentId) term.renderTabs();
|
|
4028
4035
|
// An open intent / spec / plan that the agent just updated: read it again.
|
|
4029
4036
|
if (docView?.agentId === a.id && isSpecKind(a, docView.kind) && specCache.get(`${a.id}:${docView.kind}`)?.at !== (a.specDocs?.[docView.kind] ?? null)) {
|
|
@@ -4233,6 +4240,8 @@ $('#detail-body').addEventListener('click', async (e) => {
|
|
|
4233
4240
|
upsert(await api('POST', `/agents/${a.id}/private`, { private: btn.dataset.act === 'idea-keep' ? true : btn.dataset.act === 'idea-allow' ? false : null }));
|
|
4234
4241
|
toast(btn.dataset.act === 'idea-allow' ? 'Sharing allowed' : btn.dataset.act === 'idea-keep' ? 'Kept private: nothing of it is published or sent' : 'Back to what was read');
|
|
4235
4242
|
});
|
|
4243
|
+
case 'readfirst-open':
|
|
4244
|
+
return readFirstUi.open(a.id);
|
|
4236
4245
|
case 'proof-open':
|
|
4237
4246
|
return proofUi.open(a.id);
|
|
4238
4247
|
case 'auto-open':
|
package/public/index.html
CHANGED
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
<button id="go-btn" class="go-btn" title="Go to: find a view, an agent or a setting by name (Ctrl+K or ⌘K)" aria-label="Go to a view, an agent or a setting">⌕ Go to</button>
|
|
34
34
|
<nav class="top-nav" id="top-nav" aria-label="Views">
|
|
35
35
|
<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>
|
|
36
|
+
<button id="readfirst-btn" title="Read first: finished work waiting for your review, the pieces that need reading most first, and why">Read first <span id="readfirst-count" class="badge"></span></button>
|
|
36
37
|
<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>
|
|
37
38
|
<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>
|
|
38
39
|
<button id="standup-btn" title="Today's standup: each agent's news read aloud, and what they need from you">Standup <span id="standup-dot" class="assistant-dot" hidden></span></button>
|
|
@@ -453,6 +454,17 @@
|
|
|
453
454
|
<dialog id="value-dialog" class="issues-dialog value-dialog" aria-label="Value">
|
|
454
455
|
<div id="value-body"></div>
|
|
455
456
|
</dialog>
|
|
457
|
+
<dialog id="understand-dialog" class="update-dialog readfirst-dialog" aria-label="Understanding check">
|
|
458
|
+
<h2 id="understand-title">Do you understand it?</h2>
|
|
459
|
+
<div id="understand-body"></div>
|
|
460
|
+
<div class="dialog-actions"><button type="button" class="small" data-us="make" title="Write new questions from its changes as they are now">New questions</button><button type="button" class="small" data-us="changes">Review changes</button><span class="spacer"></span><button type="button" class="small primary" data-us="close">Close</button></div>
|
|
461
|
+
</dialog>
|
|
462
|
+
|
|
463
|
+
<dialog id="readfirst-dialog" class="update-dialog readfirst-dialog" aria-label="Read first">
|
|
464
|
+
<h2>Read first</h2>
|
|
465
|
+
<div id="readfirst-body"></div>
|
|
466
|
+
<div class="dialog-actions"><span class="spacer"></span><button type="button" class="small primary" data-rf="close">Close</button></div>
|
|
467
|
+
</dialog>
|
|
456
468
|
<dialog id="quality-dialog" class="issues-dialog value-dialog" aria-label="Quality">
|
|
457
469
|
<div id="quality-body"></div>
|
|
458
470
|
</dialog>
|
|
@@ -885,7 +897,7 @@
|
|
|
885
897
|
</dialog>
|
|
886
898
|
|
|
887
899
|
<dialog id="weekly-dialog" class="update-dialog weekly-dialog" aria-label="Weekly summary">
|
|
888
|
-
<div class="issues-head"><h2>
|
|
900
|
+
<div class="issues-head"><h2>Summary</h2><div class="chips" role="tablist" id="weekly-tabs"></div></div>
|
|
889
901
|
<div id="weekly-body"></div>
|
|
890
902
|
<p id="weekly-note" class="hint"></p>
|
|
891
903
|
<div class="dialog-actions"><button type="button" class="small primary" data-weekly="copy" title="As Markdown, to paste into an email, a document or Slack">Copy</button><button type="button" class="small" data-weekly="download">Download</button><button type="button" class="small" data-weekly="save" title="Write it to the reports folder on this computer">Save on this computer</button><span class="spacer"></span><button type="button" class="small" data-weekly="close">Close</button></div>
|
package/public/proof.js
CHANGED
|
@@ -59,9 +59,27 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
59
59
|
let view = null;
|
|
60
60
|
let stamp = '';
|
|
61
61
|
let breaks = null; // Test the tests: the view of /breaks
|
|
62
|
+
let trace = null; // Requirement trace: each point of what done means, followed to what shows it
|
|
62
63
|
let command = ''; // the test command typed here, kept over redraws
|
|
63
64
|
const stampOf = (a) => `${a.proofDoc?.updatedAt ?? ''}|${a.proof?.at ?? ''}|${a.breaks?.at ?? ''}|${a.breaks?.sentAt ?? ''}`;
|
|
64
65
|
|
|
66
|
+
/** Requirement trace: each point of what done means, what the scorecard found, the checks recorded for it, and what is missing. */
|
|
67
|
+
function traceHtml() {
|
|
68
|
+
const t = trace;
|
|
69
|
+
if (!t?.rows.length) return '';
|
|
70
|
+
const word = { met: ['proof-ok', 'Met'], not_met: ['proof-bad', 'Not met'], unverified: ['', 'Not verified'], unscored: ['', 'Not scored yet'] };
|
|
71
|
+
const again = { same: 'the same result when run again', differs: 'a different result when run again', skipped: 'not run again' };
|
|
72
|
+
const row = (r) => `<li class="${r.gap ? 'trace-gap' : ''}">
|
|
73
|
+
<div class="proof-title"><span class="tag">${esc(r.id)}</span> ${esc(r.text)}</div>
|
|
74
|
+
<div><span class="tag ${word[r.status][0]}">${word[r.status][1]}</span> <span class="hint">by the scorecard${r.evidence ? `: ${esc(r.evidence)}` : ''}</span></div>
|
|
75
|
+
${r.proof.map((p) => `<div class="trace-check">${p.command ? `<code class="proof-cmd">${esc(p.command)}</code>${p.exit === null ? '' : ` <span class="hint">exit ${p.exit}</span>`}${p.rerun ? ` <span class="hint">· ${again[p.rerun]}</span>` : ''}` : `<span class="hint">By reading${p.note ? `: ${esc(p.note)}` : ''}</span>`}</div>`).join('')}
|
|
76
|
+
${r.gap ? `<p class="trace-missing"><b>Gap</b> ${esc(r.gap)}</p>` : '<p class="hint">Shown by a recorded run.</p>'}
|
|
77
|
+
</li>`;
|
|
78
|
+
return `<h3 class="breaks-head trace-head">What done means, traced</h3>
|
|
79
|
+
<p class="hint">${t.source === 'agreed' ? 'Each point you agreed on' : "Each of the scorecard's criteria (no points were agreed)"}, followed to what shows it: the scorecard's finding and the checks recorded for it. <b>${t.counts.shown} of ${t.counts.points}</b> ${t.counts.points === 1 ? 'is' : 'are'} shown by a recorded run${t.counts.gaps ? `; <b>${t.counts.gaps}</b> ${t.counts.gaps === 1 ? 'has' : 'have'} a gap` : ''}.</p>
|
|
80
|
+
<ul class="trace-list">${t.rows.map(row).join('')}</ul>`;
|
|
81
|
+
}
|
|
82
|
+
|
|
65
83
|
/** Test the tests: the last run, the command, and the buttons. */
|
|
66
84
|
function breaksHtml() {
|
|
67
85
|
const v = breaks;
|
|
@@ -115,6 +133,7 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
115
133
|
${view.entries.length ? `<ul class="proof-list">${view.entries.map(entry).join('')}</ul>` : '<p class="hint">Nothing recorded yet.</p>'}
|
|
116
134
|
${view.rerun ? `<p class="hint">${view.rerun.stale ? 'The last run here was before the agent changed its proof.' : `Run again here ${ago(view.rerun.at)}: ${view.rerun.same} same, ${view.rerun.differs} different${view.rerun.skipped ? `, ${view.rerun.skipped} not run` : ''}.`}</p>` : ''}
|
|
117
135
|
${!view.canRun && view.counts.commands ? `<p class="hint">${esc(view.whyNot)}</p>` : ''}
|
|
136
|
+
${traceHtml()}
|
|
118
137
|
${breaksHtml()}`;
|
|
119
138
|
if (typing !== null) {
|
|
120
139
|
const input = dialog.querySelector('[data-breaks="command"]');
|
|
@@ -131,7 +150,7 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
131
150
|
async function load() {
|
|
132
151
|
stamp = stampOf(agentOf(id) ?? {});
|
|
133
152
|
try {
|
|
134
|
-
[view, breaks] = await Promise.all([api('GET', `/agents/${id}/proof`), api('GET', `/agents/${id}/breaks`)]);
|
|
153
|
+
[view, breaks, trace] = await Promise.all([api('GET', `/agents/${id}/proof`), api('GET', `/agents/${id}/breaks`), api('GET', `/agents/${id}/trace`)]);
|
|
135
154
|
} catch (e) {
|
|
136
155
|
toast(`Error: ${e.message}`, 5000);
|
|
137
156
|
}
|
|
@@ -172,7 +191,7 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
172
191
|
dialog.addEventListener('input', (e) => {
|
|
173
192
|
if (e.target.dataset?.breaks === 'command') command = e.target.value;
|
|
174
193
|
});
|
|
175
|
-
dialog.addEventListener('close', () => ((id = null), (view = null), (breaks = null), (command = '')));
|
|
194
|
+
dialog.addEventListener('close', () => ((id = null), (view = null), (breaks = null), (trace = null), (command = '')));
|
|
176
195
|
|
|
177
196
|
return {
|
|
178
197
|
open(agentId) {
|
package/public/quality.js
CHANGED
|
@@ -14,8 +14,8 @@ const PERIODS = [
|
|
|
14
14
|
['year', 'Year'],
|
|
15
15
|
];
|
|
16
16
|
const SAVED = 'agentmgr.qualityPeriod';
|
|
17
|
-
const WORD = { reverted: 'Reverted', fixed: 'Fixed afterwards', broke: 'Checks failed', problem: 'A problem', clean: 'Held up', watching: 'Fine so far', unchecked: 'Not looked at' };
|
|
18
|
-
const BAD = new Set(['reverted', 'fixed', 'broke', 'problem']);
|
|
17
|
+
const WORD = { incident: 'Incident in production', reverted: 'Reverted', fixed: 'Fixed afterwards', broke: 'Checks failed', problem: 'A problem', clean: 'Held up', watching: 'Fine so far', unchecked: 'Not looked at' };
|
|
18
|
+
const BAD = new Set(['incident', 'reverted', 'fixed', 'broke', 'problem']);
|
|
19
19
|
|
|
20
20
|
export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
21
21
|
const dialog = $('#quality-dialog');
|
|
@@ -92,6 +92,7 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
92
92
|
function why(it) {
|
|
93
93
|
const a = it.after;
|
|
94
94
|
if (it.mark) return `You said so${it.mark.note ? `: ${esc(it.mark.note)}` : ''}`;
|
|
95
|
+
if (it.verdict === 'incident') return it.incidents.map((x) => `${x.url ? `<a href="${esc(x.url)}" target="_blank" rel="noopener">${esc(x.title)}</a>` : esc(x.title)} <span class="hint">matched by ${esc(x.by)}${x.source ? ` · ${esc(x.source)}` : ''}</span>`).join('<br>');
|
|
95
96
|
if (it.verdict === 'reverted') return `Reverted by ${link(a.reverted)}`;
|
|
96
97
|
if (it.verdict === 'fixed') return a.fixes.map((f) => `${link(f)}${f.shared.length ? ` <span class="hint">same file${f.shared.length === 1 ? '' : 's'}: ${esc(f.shared.join(', '))}</span>` : ' <span class="hint">names it</span>'}`).join('<br>');
|
|
97
98
|
if (it.verdict === 'broke') return `Failed on the merged commit: ${esc(a.checks.failed.join(', '))}`;
|
|
@@ -145,6 +146,12 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
145
146
|
${table('The review scorecard', 'What the scorecard recommended as it merged.', r.scorecard)}
|
|
146
147
|
${table('Tests tested', 'Whether the tests were tested before the merge (Test the tests), and how that went.', r.tests)}
|
|
147
148
|
${table('Model', 'The engine and model that did the work.', r.models)}
|
|
149
|
+
${r.delegation.rows.length ? `<h3 class="rec-head">Delegation map</h3><p class="hint">By kind of work, read from the words of each request: how it held up and how much of it ran without you. A kind that held up 9 times in 10 over at least 5 settled pull requests while most of it still asked you is worth handing over more of; under 7 in 10 is worth keeping close. It sees only the work given to agents, not what you do by hand.</p>
|
|
150
|
+
<div class="issues-scroll"><table class="issues rec-table"><thead><tr><th>Kind of work</th><th class="num">Held up</th><th class="num">Share</th><th class="num">Without you</th><th></th></tr></thead><tbody>${r.delegation.rows.map((d) => `<tr><td>${esc(d.label)}</td><td class="num">${d.held} of ${d.n}</td><td class="num">${d.heldPct}%</td><td class="num">${d.withoutYou} of ${d.n}</td><td class="${d.advice === 'hand over more' ? 'rec-ok' : d.advice ? 'rec-bad' : 'hint'}">${d.advice ?? (d.n < 5 ? 'too few to say' : 'keep as is')}</td></tr>`).join('')}</tbody></table></div>
|
|
151
|
+
${r.delegation.next ? `<p class="rec-ok">Next to hand over more of: <b>${esc(r.delegation.next.label)}</b> (${r.delegation.next.heldPct}% held up over ${r.delegation.next.n}, most of it still asking you). Set its projects' level above, or start that kind of work with <i>Agree, then run</i>.</p>` : ''}` : ''}
|
|
152
|
+
${r.fit.rows.length > 1 ? `<h3 class="rec-head">Model fit</h3><p class="hint">Which model held up as well as the most used one at a lower cost. Cost is shown against the most used model's, per piece of work. A suggestion needs 5 settled pull requests for both, a share that held up within 5 points of the most used model's, and at most three quarters of its cost.</p>
|
|
153
|
+
<div class="issues-scroll"><table class="issues rec-table"><thead><tr><th>Model</th><th class="num">Held up</th><th class="num">Share</th><th class="num">Scorecard</th><th class="num">Cost</th></tr></thead><tbody>${r.fit.rows.map((m, i) => `<tr><td>${esc(m.model)}</td><td class="num">${m.held} of ${m.n}</td><td class="num">${m.heldPct}%</td><td class="num">${m.score ?? '—'}</td><td class="num">${i === 0 ? 'the most used' : m.costVsMain == null ? '—' : `${m.costVsMain}×`}</td></tr>`).join('')}</tbody></table></div>
|
|
154
|
+
${r.fit.suggestion ? `<p class="rec-ok"><b>${esc(r.fit.suggestion.model)}</b> held up as well as ${esc(r.fit.suggestion.main)} (${r.fit.suggestion.heldPct}% against ${r.fit.suggestion.mainHeldPct}%) at ${r.fit.suggestion.costVsMain}× the cost, over ${r.fit.suggestion.n} settled pull requests: worth trying for more of the work.</p>` : ''}` : ''}
|
|
148
155
|
${table('Without you', 'How far the agent ran without you.', r.levels)}
|
|
149
156
|
<h3 class="rec-head">Projects: the level the record supports</h3>
|
|
150
157
|
<p class="hint">Up one step after at least 5 settled pull requests with 9 in 10 held up and none of the last 5 a problem (10, and all of the last 10, before Run to merge). Down one step when one of the last 3 did not hold up. It is a suggestion: the level changes only when you set it.</p>
|
|
@@ -213,6 +220,7 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
213
220
|
<div class="value-cards">
|
|
214
221
|
${card('Held up', pct(t.heldPct), `${t.held} of ${t.checked} looked at${t.watching ? `; ${t.watching} still watched` : ''}`, prev && t.heldPct != null ? t.heldPct - prev.heldPct : null, true)}
|
|
215
222
|
${card('Problems after the merge', String(t.problems), `${pct(t.failurePct)} of those looked at`, prev && t.failurePct != null ? t.failurePct - prev.failurePct : null, false)}
|
|
223
|
+
${t.incident ? card('Incidents in production', String(t.incident), 'reported by a monitoring tool or by you', null) : ''}
|
|
216
224
|
${card('Reverted', String(t.reverted), 'taken back out', null)}
|
|
217
225
|
${card('Fixed afterwards', String(t.fixed), `a fix to the same files within ${s.watchDays} days`, null)}
|
|
218
226
|
${card('Checks failed', String(t.broke), 'on the commit it merged as', null)}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// Read first (top bar): finished work waiting for your review, the pieces that need reading most
|
|
2
|
+
// first. Each has a level (read closely, look, skim), the reasons as facts the app measured, what
|
|
3
|
+
// speaks for it, and where to start. Drawn from the agents as they are, so it stays current.
|
|
4
|
+
|
|
5
|
+
export const LEVEL = { close: 'Read closely', look: 'Look', skim: 'Skim' };
|
|
6
|
+
|
|
7
|
+
/** The queue from the page's agents: the ones with a ranking, heaviest first. */
|
|
8
|
+
export function queueOf(agents) {
|
|
9
|
+
return [...agents.values()]
|
|
10
|
+
.filter((a) => a.readFirst)
|
|
11
|
+
.sort((x, y) => y.readFirst.score - x.readFirst.score || String(x.brief?.updatedAt).localeCompare(String(y.brief?.updatedAt)));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** In an agent's Results: its level, and the first reasons. */
|
|
15
|
+
export function readFirstRow(a, esc) {
|
|
16
|
+
const r = a.readFirst;
|
|
17
|
+
if (!r) return '';
|
|
18
|
+
return `<p class="read-first-row"><b>Review</b> <span class="tag rf-${r.level}" title="How much this needs reading, from what was measured (${r.score} points)">${LEVEL[r.level]}</span> <span class="hint">${esc(r.reasons.slice(0, 2).map((x) => x.text).join(' · ') || r.calm[0] || 'Nothing measured speaks against it')}</span> <button class="small" data-act="readfirst-open">Why</button></p>`;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function initReadFirst({ $, esc, ago, agents, openAgent, openChanges, projectOf, api, toast, understand }) {
|
|
22
|
+
const dlg = $('#readfirst-dialog');
|
|
23
|
+
let only = null; // an agent id: opened from that agent's Results
|
|
24
|
+
|
|
25
|
+
function render() {
|
|
26
|
+
const all = queueOf(agents);
|
|
27
|
+
const n = (l) => all.filter((a) => a.readFirst.level === l).length;
|
|
28
|
+
const badge = $('#readfirst-count');
|
|
29
|
+
badge.textContent = n('close') || '';
|
|
30
|
+
badge.title = n('close') ? `${n('close')} to read closely` : '';
|
|
31
|
+
if (!dlg.open) return;
|
|
32
|
+
const items = only ? all.filter((a) => a.id === only) : all;
|
|
33
|
+
const old = all.filter((a) => Date.parse(a.brief?.updatedAt) < Date.now() - 14 * 86_400_000);
|
|
34
|
+
const card = (a) => {
|
|
35
|
+
const r = a.readFirst;
|
|
36
|
+
const pr = Object.values(a.prs ?? {}).find((p) => p.state === 'OPEN');
|
|
37
|
+
return `<li class="rf-item rf-${r.level}">
|
|
38
|
+
<div class="rf-head"><span class="tag rf-${r.level}">${LEVEL[r.level]}</span> <b>${esc(a.name)}</b> <span class="hint">${esc(projectOf(a) ?? '')}${a.brief?.updatedAt ? ` · finished ${ago(a.brief.updatedAt)}` : ''} · ${r.score} points</span></div>
|
|
39
|
+
<div class="rf-title">${esc(String(a.intent ?? '').split('\n')[0].slice(0, 160))}</div>
|
|
40
|
+
${r.reasons.length ? `<ul class="rf-reasons">${r.reasons.slice(0, only ? 20 : 5).map((x) => `<li>${esc(x.text)} <span class="hint">+${x.points}</span></li>`).join('')}${!only && r.reasons.length > 5 ? `<li class="hint">and ${r.reasons.length - 5} more</li>` : ''}</ul>` : '<p class="hint">Nothing measured speaks against it.</p>'}
|
|
41
|
+
${r.calm.length ? `<ul class="rf-calm">${r.calm.map((c) => `<li>${esc(c)}</li>`).join('')}</ul>` : ''}
|
|
42
|
+
${r.start.length ? `<p class="rf-start"><b>Start with</b> ${r.start.map((s) => `<code>${esc(s)}</code>`).join(' ')}</p>` : ''}
|
|
43
|
+
<div class="need-actions"><button class="small primary" data-rf-changes="${a.id}">Review changes</button><button class="small" data-rf-understand="${a.id}" title="Two or three questions about what it does, before you approve it">Check my understanding</button><button class="small" data-rf-agent="${a.id}">Open agent</button><button class="small" data-rf-reviewed="${a.id}" title="You have read it: it leaves the queue until the agent changes its work again">Mark as reviewed</button>${pr ? `<a class="small-link" href="${esc(pr.url)}" target="_blank" rel="noopener">Pull request</a>` : ''}</div>
|
|
44
|
+
</li>`;
|
|
45
|
+
};
|
|
46
|
+
$('#readfirst-body').innerHTML = `
|
|
47
|
+
<p class="hint">${only ? 'Why this piece is ranked as it is.' : `Finished work waiting for your review: ${n('close')} to read closely, ${n('look')} to look at, ${n('skim')} to skim.`} The ranking adds up facts the app measured (high-risk files, the scorecard, checks, whether the tests notice a mistake, what was left out, risks not checked, its own confidence, size). No model decides it. "Skim" means nothing measured speaks against it, not that it is correct.</p>
|
|
48
|
+
${items.length ? `<ul class="rf-list">${items.map(card).join('')}</ul>` : '<p class="hint issues-empty">No finished work is waiting for review.</p>'}
|
|
49
|
+
${only && all.length > 1 ? '<p><button class="link" data-rf-all>Show the whole queue</button></p>' : ''}
|
|
50
|
+
${!only && old.length ? `<p class="hint">${old.length} of these finished more than 14 days ago. <button class="link" data-rf-old title="They leave the queue; each comes back if its agent changes its work again">Mark those as reviewed</button></p>` : ''}`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function open(agentId = null) {
|
|
54
|
+
only = agentId;
|
|
55
|
+
if (!dlg.open) dlg.showModal();
|
|
56
|
+
render();
|
|
57
|
+
}
|
|
58
|
+
$('#readfirst-btn').onclick = () => open();
|
|
59
|
+
dlg.addEventListener('click', async (e) => {
|
|
60
|
+
if (e.target.closest('[data-rf="close"]')) return dlg.close();
|
|
61
|
+
const rev = e.target.closest('[data-rf-reviewed]');
|
|
62
|
+
if (rev || e.target.closest('[data-rf-old]')) {
|
|
63
|
+
try {
|
|
64
|
+
const r = await api('POST', '/read-first/reviewed', rev ? { agent: rev.dataset.rfReviewed } : { olderThanDays: 14 });
|
|
65
|
+
toast(`${r.marked} marked as reviewed`);
|
|
66
|
+
// (Each agent's update arrives by itself and redraws the queue.)
|
|
67
|
+
if (only) only = null;
|
|
68
|
+
} catch (err) {
|
|
69
|
+
toast(`Error: ${err.message}`, 6000);
|
|
70
|
+
}
|
|
71
|
+
return render();
|
|
72
|
+
}
|
|
73
|
+
if (e.target.closest('[data-rf-all]')) return open();
|
|
74
|
+
const us = e.target.closest('[data-rf-understand]');
|
|
75
|
+
if (us) return understand(us.dataset.rfUnderstand);
|
|
76
|
+
const ch = e.target.closest('[data-rf-changes]');
|
|
77
|
+
const ag = e.target.closest('[data-rf-agent]');
|
|
78
|
+
if (ch || ag) {
|
|
79
|
+
dlg.close();
|
|
80
|
+
return ch ? openChanges(ch.dataset.rfChanges) : openAgent(ag.dataset.rfAgent);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
return { open, render, isOpen: () => dlg.open };
|
|
84
|
+
}
|
package/public/style.css
CHANGED
|
@@ -388,10 +388,34 @@ body.term-max .term-agent, .term-wrap:fullscreen .term-agent { display: inline-b
|
|
|
388
388
|
.kept-private { margin: 6px 0 10px; padding: 8px 10px; border: 1px solid #e8590c; border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
|
|
389
389
|
.kept-private p { margin: 4px 0 6px; }
|
|
390
390
|
.kept-private-off { margin: 4px 0; }
|
|
391
|
+
.readfirst-dialog { width: min(760px, calc(100vw - 24px)); }
|
|
392
|
+
#readfirst-body { max-height: min(66vh, 680px); overflow: auto; }
|
|
393
|
+
.rf-list { list-style: none; margin: 8px 0; padding: 0; }
|
|
394
|
+
.rf-item { margin: 0 0 10px; padding: 10px 12px; border: 1px solid var(--border); border-left-width: 4px; border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
|
|
395
|
+
.rf-item.rf-close { border-left-color: var(--red); }
|
|
396
|
+
.rf-item.rf-look { border-left-color: #f08c00; }
|
|
397
|
+
.rf-item.rf-skim { border-left-color: var(--green); }
|
|
398
|
+
.tag.rf-close { color: var(--red); font-weight: 600; }
|
|
399
|
+
.tag.rf-look { color: #f08c00; font-weight: 600; }
|
|
400
|
+
.tag.rf-skim { color: var(--green); }
|
|
401
|
+
.rf-title { margin: 2px 0 6px; color: var(--muted); }
|
|
402
|
+
.rf-reasons, .rf-calm { margin: 0 0 6px; padding-left: 18px; }
|
|
403
|
+
.rf-calm { color: var(--green); }
|
|
404
|
+
.rf-start { margin: 0 0 8px; }
|
|
405
|
+
.rf-start code { margin-right: 4px; }
|
|
406
|
+
.us-list { margin: 8px 0; padding-left: 22px; }
|
|
407
|
+
.us-item { margin: 0 0 12px; padding-left: 4px; overflow-wrap: anywhere; font-size: 14px; }
|
|
408
|
+
.us-q { font-weight: 600; margin-bottom: 6px; }
|
|
409
|
+
.us-a { margin: 6px 0; padding: 6px 8px; border-radius: 6px; background: var(--panel-2, rgba(127,127,127,.1)); font-size: 13px; }
|
|
410
|
+
.us-say { margin: 4px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
|
|
411
|
+
.us-item.us-miss { border-left: 3px solid var(--red); padding-left: 8px; }
|
|
412
|
+
.us-item.us-knew { border-left: 3px solid var(--green); padding-left: 8px; }
|
|
413
|
+
.rf-item .small-link { align-self: center; font-size: 13px; }
|
|
391
414
|
.weekly-dialog { width: min(820px, calc(100vw - 24px)); }
|
|
392
415
|
.weekly-dialog .dialog-actions, .weekly-dialog .issues-head { flex-wrap: wrap; gap: 6px; }
|
|
393
416
|
.weekly-dialog .spacer { flex: 1 1 0; min-width: 0; }
|
|
394
417
|
#weekly-note { overflow-wrap: anywhere; }
|
|
418
|
+
.weekly-gap { display: inline-block; width: 10px; }
|
|
395
419
|
.weekly-md { max-height: min(62vh, 640px); overflow: auto; overflow-wrap: anywhere; font-size: 14px; }
|
|
396
420
|
.weekly-md table { border-collapse: collapse; margin: 6px 0 10px; }
|
|
397
421
|
.weekly-md th, .weekly-md td { border: 1px solid var(--border); padding: 3px 8px; text-align: left; }
|
|
@@ -1974,15 +1998,18 @@ table.eval-items tr.eval-na td { color: var(--muted); }
|
|
|
1974
1998
|
.auto-perm button { margin-left: 4px; }
|
|
1975
1999
|
.not-done { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--warn, #d9a441); font-size: 13px; overflow-wrap: anywhere; }
|
|
1976
2000
|
.not-done ul { margin: 4px 0 0; padding-left: 18px; }
|
|
1977
|
-
.proof-row { margin: 6px 0; font-size: 13px; }
|
|
2001
|
+
.proof-row, .read-first-row { margin: 6px 0; font-size: 13px; }
|
|
1978
2002
|
.tag.proof-ok { color: var(--green); }
|
|
1979
2003
|
.tag.proof-bad { color: var(--red); font-weight: 600; }
|
|
1980
|
-
.proof-list, .breaks-list { list-style: none; margin: 8px 0; padding: 0; }
|
|
1981
|
-
.proof-list li, .breaks-list li { margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
|
|
2004
|
+
.proof-list, .breaks-list, .trace-list { list-style: none; margin: 8px 0; padding: 0; }
|
|
2005
|
+
.proof-list li, .breaks-list li, .trace-list li { margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
|
|
1982
2006
|
.proof-title { font-weight: 600; margin-bottom: 4px; }
|
|
1983
2007
|
.proof-cmd { display: inline-block; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1984
2008
|
.proof-out { margin: 6px 0 0; padding: 6px 8px; max-height: 180px; overflow: auto; font-size: 12px; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--bg-2, rgba(127, 127, 127, 0.12)); border-radius: 6px; }
|
|
1985
2009
|
.proof-out.bad { border: 1px solid var(--danger, #d9534f); }
|
|
2010
|
+
.trace-list li.trace-gap { border-left: 3px solid var(--red); }
|
|
2011
|
+
.trace-check { margin: 4px 0 0; }
|
|
2012
|
+
.trace-missing { margin: 6px 0 0; color: var(--red); }
|
|
1986
2013
|
.breaks-head { margin: 18px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 15px; }
|
|
1987
2014
|
.breaks-cmd { display: block; margin: 8px 0 2px; font-size: 13px; }
|
|
1988
2015
|
.breaks-cmd input { display: block; width: 100%; margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// Understanding check: before you approve a large change, two or three questions about what it
|
|
2
|
+
// does (what happens on a failure, an empty input, what else depends on it). Answer in your head,
|
|
3
|
+
// then show the answer and say whether you knew it. The ones you did not know come with where to
|
|
4
|
+
// read. It is a check for you: nothing here grades you, and nothing is sent anywhere.
|
|
5
|
+
|
|
6
|
+
export function understandSummary(u) {
|
|
7
|
+
const qs = u?.data?.questions ?? [];
|
|
8
|
+
const said = Object.values(u?.knew ?? {}).filter((v) => typeof v === 'boolean');
|
|
9
|
+
if (!qs.length) return '';
|
|
10
|
+
if (said.length < qs.length) return `${said.length} of ${qs.length} answered`;
|
|
11
|
+
const knew = said.filter(Boolean).length;
|
|
12
|
+
return knew === qs.length ? `Knew all ${qs.length}` : `Knew ${knew} of ${qs.length}`;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function initUnderstand({ $, esc, api, toast, openChanges, agentOf }) {
|
|
16
|
+
const dlg = $('#understand-dialog');
|
|
17
|
+
let id = null;
|
|
18
|
+
const shown = new Set(); // question indexes whose answer is showing
|
|
19
|
+
|
|
20
|
+
function render() {
|
|
21
|
+
const a = id && agentOf(id);
|
|
22
|
+
const u = a?.docs?.understanding;
|
|
23
|
+
$('#understand-title').textContent = `Do you understand it? ${a ? a.name : ''}`;
|
|
24
|
+
const body = $('#understand-body');
|
|
25
|
+
if (!a) return;
|
|
26
|
+
if (u?.pending) return void (body.innerHTML = '<p class="hint">Writing the questions from its changes…</p>');
|
|
27
|
+
if (u?.error) return void (body.innerHTML = `<p class="error">${esc(u.error)}</p><p><button class="small" data-us="make">Try again</button></p>`);
|
|
28
|
+
const qs = u?.data?.questions ?? [];
|
|
29
|
+
if (!qs.length) return void (body.innerHTML = '<p class="hint">Writing the questions from its changes…</p>');
|
|
30
|
+
const stale = u.at && a.brief?.updatedAt && Date.parse(a.brief.updatedAt) > Date.parse(u.at);
|
|
31
|
+
body.innerHTML = `
|
|
32
|
+
<p class="hint">Answer each in your head first. Then show the answer and say whether you knew it. Nothing here grades you; the ones you did not know point to where to read.</p>
|
|
33
|
+
<ol class="us-list">${qs
|
|
34
|
+
.map((x, i) => {
|
|
35
|
+
const k = u.knew?.[i];
|
|
36
|
+
return `<li class="us-item ${k === false ? 'us-miss' : k === true ? 'us-knew' : ''}">
|
|
37
|
+
<div class="us-q">${esc(x.q)}</div>
|
|
38
|
+
${shown.has(i) || typeof k === 'boolean'
|
|
39
|
+
? `<div class="us-a"><b>Answer</b> ${esc(x.answer)}${x.why ? ` <span class="hint">${esc(x.why)}</span>` : ''}${x.file ? `<div class="hint">Read: <code>${esc(x.file)}</code>${x.head ? ` <code>${esc(x.head)}</code>` : ''}</div>` : ''}</div>
|
|
40
|
+
<div class="us-say">${typeof k === 'boolean' ? `<span class="tag ${k ? 'proof-ok' : 'proof-bad'}">${k ? 'You knew it' : 'You did not'}</span> <button class="link" data-us-knew="${i}" data-v="null">Undo</button>` : `<button class="small" data-us-knew="${i}" data-v="true">I knew it</button><button class="small" data-us-knew="${i}" data-v="false">I did not</button>`}</div>`
|
|
41
|
+
: `<button class="small" data-us-show="${i}">Show the answer</button>`}
|
|
42
|
+
</li>`;
|
|
43
|
+
})
|
|
44
|
+
.join('')}</ol>
|
|
45
|
+
<p class="hint">${esc(understandSummary(u))}${stale ? ' · The agent has changed its work since these were written: make them again.' : ''}</p>`;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
async function make() {
|
|
49
|
+
try {
|
|
50
|
+
await api('POST', `/agents/${id}/docs/understanding`);
|
|
51
|
+
} catch (err) {
|
|
52
|
+
toast(`Error: ${err.message}`, 6000);
|
|
53
|
+
}
|
|
54
|
+
render();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
dlg.addEventListener('click', async (e) => {
|
|
58
|
+
if (e.target.closest('[data-us="close"]')) return dlg.close();
|
|
59
|
+
if (e.target.closest('[data-us="make"]')) return make();
|
|
60
|
+
if (e.target.closest('[data-us="changes"]')) return (dlg.close(), openChanges(id));
|
|
61
|
+
const show = e.target.closest('[data-us-show]');
|
|
62
|
+
if (show) {
|
|
63
|
+
shown.add(Number(show.dataset.usShow));
|
|
64
|
+
return render();
|
|
65
|
+
}
|
|
66
|
+
const knew = e.target.closest('[data-us-knew]');
|
|
67
|
+
if (knew) {
|
|
68
|
+
try {
|
|
69
|
+
await api('POST', `/agents/${id}/understanding/knew`, { question: Number(knew.dataset.usKnew), knew: knew.dataset.v === 'null' ? null : knew.dataset.v === 'true' });
|
|
70
|
+
} catch (err) {
|
|
71
|
+
toast(`Error: ${err.message}`, 6000);
|
|
72
|
+
}
|
|
73
|
+
render();
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
return {
|
|
78
|
+
async open(agentId) {
|
|
79
|
+
id = agentId;
|
|
80
|
+
shown.clear();
|
|
81
|
+
if (!dlg.open) dlg.showModal();
|
|
82
|
+
const u = agentOf(id)?.docs?.understanding;
|
|
83
|
+
render();
|
|
84
|
+
if (!u?.data?.questions?.length) await make();
|
|
85
|
+
},
|
|
86
|
+
agentChanged(a) {
|
|
87
|
+
if (dlg.open && a.id === id) render();
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|