ai-agentmanager 1.64.0 → 1.65.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 +149 -1
- package/package.json +1 -1
- package/public/app.js +24 -2
- package/public/proof.js +86 -6
- package/public/quality.js +81 -3
- package/public/style.css +42 -2
- package/public/valuelens.js +114 -0
- package/src/autonomy.js +14 -3
- package/src/brief.js +69 -5
- package/src/cli.js +62 -2
- package/src/config.js +6 -0
- package/src/engines/claude.js +3 -0
- package/src/inbox.js +12 -6
- package/src/manager.js +33 -1
- package/src/mutate.js +456 -0
- package/src/private.js +52 -0
- package/src/quality.js +16 -2
- package/src/record.js +147 -0
- package/src/scorecard.js +26 -1
- package/src/server.js +40 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.65.0 (2026-11-23)
|
|
4
|
+
|
|
5
|
+
- **Test the tests: would the agent's tests notice a mistake?** The app breaks the lines the agent changed, one at a time and in a small way (`===` becomes `!==`, `&&` becomes `||`, a number goes up by one), runs the tests on each, and puts the line back. A break the tests still pass on is a line nothing checks. In the agent's **Proof** dialog under **Test the tests**, or `agentmgr test-tests <agent> --run` (`-c` for the test command, `--max` for how many lines). The Results show **Tests tested**, for example "5 of 6 breaks caught".
|
|
6
|
+
- **Tell the agent.** **Tell the agent**, or `--send`, sends the lines whose breaks went unnoticed and asks for tests that fail when they are wrong.
|
|
7
|
+
- **The scorecard uses it.** When no break was caught the tests score is at most 35; when more than half went unnoticed, at most 55. A run before the latest changes is not counted.
|
|
8
|
+
- **The folder is kept as it was.** The tests run first with nothing changed. One line is different at a time and is written down first, so a daemon that stops halfway puts it back when it starts. A run does not start while the agent works, messages to it wait, and typing to it stops the run.
|
|
9
|
+
- **Limits.** Only you can ask for it (it runs commands on your computer and changes the agent's files for a moment). A break that went unnoticed is a pointer, not a verdict: some change nothing a test could see. The breaks are made on the text of a line, in 14 languages; agents in containers are not covered.
|
|
10
|
+
|
|
11
|
+
Found by running real agents:
|
|
12
|
+
|
|
13
|
+
- **A permission prompt that lost letters to a redraw is seen again.** Claude Code redraws only the screen cells that changed, so a prompt could arrive as "Do you want to pro eed?" with its first choice as "1 Yes". It was not recognised: the agent sat at the prompt while the app showed nothing to answer. The prompt is now also recognised by its choices and footer, and its choices are read without the dot.
|
|
14
|
+
- **Insights: value now against later, the kind of idea, and paths ranked.** Below Why / What / How / Now, Insights adds three cards. **Value** rates what the work is worth as soon as it ships and what it is worth over time, with what waiting costs and which should drive the design. **Kind of idea** says whether it is just a task, worth a white paper, or possibly patentable, what is new and what to do next. **Paths** lists the 2 to 4 real ways to go, preferred first, each with its value now and later, cost, risk and when it is the right pick. The kind is a first read without a prior-art search, not legal advice.
|
|
15
|
+
- **Agents weigh the paths while they design.** When a task has more than one reasonable way, the agent lists them under **Options** in its brief, preferred first, and its Results show **Paths it weighed**. Something that seems new is said in one line and kept inside the repository. `"valueLens": false` in config.json turns it off.
|
|
16
|
+
- **Kept private: possibly patentable work is not sent out.** When the agent says part of its design is new, Insights reads the work as possibly patentable, or you mark it (`agentmgr private <agent> --keep`), the app holds every way out: publishing to Google Drive, updates and Slack, the scorecard comment, opening the pull request (also without you and on autopilot), and a merge without you. The agent is told to keep it inside the repository. Only you lift it: **Allow sharing**, or `agentmgr private <agent> --allow`. It guards what the app sends, not what an agent can run in its terminal.
|
|
17
|
+
- **Pre-mortem: how could this go wrong?** Before it changes anything, each agent writes **Risks** in its brief: the 3 to 5 most likely ways the task could go wrong. At the end it marks each as avoided (with how it knows), happened, or not checked. The Results show **Risks it named before starting**; the scorecard is given the list and notes the ones that happened or were not checked. `"premortem": false` in config.json turns it off.
|
|
18
|
+
- **Track record: was the confidence right?** As a pull request merges, the app keeps what was said about it: the agent's own confidence, the scorecard's recommendation, whether its tests were tested, the model, and how far it ran without you. **Quality → Track record**, or `agentmgr quality record`, compares that with what happened after the merge: "90 to 100%: 6 of 10 held up, said 92% on average: said more than held up". Rows with fewer than 5 settled pull requests say "too few to say".
|
|
19
|
+
- **Earned autonomy.** Per project, the record says which level of "Without you" it supports: up one step after 5 settled pull requests with 9 in 10 held up and none of the last 5 a problem (10 for "Run to merge"); down one step when one of the last 3 did not hold up. It only suggests: the level changes when you press **Set** or run `agentmgr autonomy --project <name> --default <level>`. A project's level applies to its new agents when none is named.
|
|
20
|
+
|
|
3
21
|
## 1.64.0 (2026-11-22)
|
|
4
22
|
|
|
5
23
|
- **Proof: what the agent ran, kept so you can check it.** Next to its brief each agent keeps `PROOF.md`: for every check it ticked and every agreed point of what done means, the exact command, its exit code and the last lines of real output. The agent's Results show a **Proof** row; **Open** lists each check with its command and output. `agentmgr proof <agent>` prints it.
|
package/README.md
CHANGED
|
@@ -550,9 +550,96 @@ The number is the agent's own statement, not a measurement.
|
|
|
550
550
|
|
|
551
551
|
**Limits.** The record is written by the agent: until you run the commands again, it is still its word, now in a form you can check. Running them again happens on your computer with your rights and without the agent's permission prompts, which is why only you can ask for it (an agent's own call is refused) and why the commands are shown first; the list of what is not run is a filter on the command's text, not a sandbox, so read the commands. The same exit code does not prove the same output (durations and dates differ between runs; the page says when the last recorded line was not printed). An agent in a container cannot be run again from here. `"proof": false` in `config.json` stops asking agents for it.
|
|
552
552
|
|
|
553
|
+
## Pre-mortem: how could this go wrong?
|
|
554
|
+
|
|
555
|
+
Before it changes anything, each agent writes **Risks** in its brief: the 3 to 5 most likely ways this task could go wrong or be done wrongly, specific to the task. When it finishes it marks each one:
|
|
556
|
+
|
|
557
|
+
| Mark | Meaning |
|
|
558
|
+
| --- | --- |
|
|
559
|
+
| **Avoided** | with how it knows (the test or command) |
|
|
560
|
+
| **Happened** | with what, and what it did about it |
|
|
561
|
+
| **Not checked** | it named the risk and did not look |
|
|
562
|
+
|
|
563
|
+
- **Where you see it.** In the agent's Results, as **Risks it named before starting** ("3 avoided, 1 not checked"). The list is open when one happened or was not checked.
|
|
564
|
+
- **Why it helps.** The list is written before the work, so it is not shaped by what was built. It tells a reviewer where to look first, and a risk left "not checked" is a place nobody looked.
|
|
565
|
+
- **What it feeds.** The review scorecard is given the list and asked to check the ones not marked avoided against the changes. Risks that happened are noted under safety, ones not checked under tests.
|
|
566
|
+
- **Off:** `"premortem": false` in config.json.
|
|
567
|
+
|
|
568
|
+
**Limit.** The marks are the agent's word. "Avoided" with a command is as good as that command; [Proof](#proof-what-it-ran-and-what-it-did-not-do) lets you run it again.
|
|
569
|
+
|
|
570
|
+
## Test the tests: would they notice a mistake?
|
|
571
|
+
|
|
572
|
+
Proof shows the tests ran and passed. It does not show they could have failed. Tests written by the same agent as the code can pass while checking very little.
|
|
573
|
+
|
|
574
|
+
**Test the tests** answers that by measuring. The app takes the lines the agent changed and breaks them one at a time in a small way, runs the tests, and puts the line back:
|
|
575
|
+
|
|
576
|
+
| Kind of break | Example |
|
|
577
|
+
| --- | --- |
|
|
578
|
+
| Equal and not equal swapped | `===` becomes `!==` |
|
|
579
|
+
| A comparison turned around | `<=` becomes `>` |
|
|
580
|
+
| And / or swapped | `&&` becomes `\|\|` |
|
|
581
|
+
| True / false swapped | `true` becomes `false` |
|
|
582
|
+
| Plus / minus swapped | `total + fee` becomes `total - fee` |
|
|
583
|
+
| A number moved by one | `10` becomes `11` |
|
|
584
|
+
|
|
585
|
+
A break the tests fail on is **Caught**. A break they still pass on is **Not noticed**: that line can be wrong and no test will say so.
|
|
586
|
+
|
|
587
|
+
- **Where.** In the agent's **Proof** dialog, under **Test the tests**: **Break the code and run the tests**. Or `agentmgr test-tests <agent> --run`. The Results then show **Tests tested**, for example "5 of 6 breaks caught".
|
|
588
|
+
- **Which tests.** The passing commands the agent recorded in its proof, or the command you type (`-c "npm test"`).
|
|
589
|
+
- **Which lines.** Up to 8 (`--max`), spread over the changed source lines and over the kinds of break. Test files, comments, text inside strings, imports and logging lines are left alone.
|
|
590
|
+
- **Tell the agent.** **Tell the agent** (or `--send`) sends it the lines whose breaks went unnoticed and asks for tests that fail when they are wrong, or a reason why none should.
|
|
591
|
+
- **What it feeds.** The review scorecard is given the result. When no break was caught, its tests score is at most 35; when more than half went unnoticed, at most 55. A run made before the latest changes is not counted.
|
|
592
|
+
- **Exit code.** `agentmgr test-tests` exits with 1 when a break went unnoticed or the tests fail as they are.
|
|
593
|
+
|
|
594
|
+
**How the folder is kept safe.** The tests are run first with nothing changed; if they fail, nothing is broken. One line of one file is different at a time, and it is put back before the next. The line is written down before it is changed, so a daemon that stops halfway puts it back when it starts again. A run does not start while the agent is working, messages to the agent wait until the run is over, and typing to the agent stops the run. After the run the app compares the folder's changes with those before it and says so if they differ.
|
|
595
|
+
|
|
596
|
+
**Limits.**
|
|
597
|
+
|
|
598
|
+
- It runs on your computer with your rights, without the agent's permission prompts, and changes the agent's files for a moment. For that reason only you can ask for it; an agent's own call is refused.
|
|
599
|
+
- "Not noticed" is a pointer, not a verdict. Some breaks change nothing a test could see (a number in a timeout, two versions that behave the same). Read the line before asking for a test.
|
|
600
|
+
- "Caught" includes a break that stops the code from loading at all, which any test would notice. A high count shows the changed lines are exercised; it does not show every behaviour is checked.
|
|
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
|
+
- 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
|
+
|
|
604
|
+
## Track record: was the confidence right?
|
|
605
|
+
|
|
606
|
+
An agent writes "Confidence: 85%" and the scorecard says "Ready to approve". The track record shows how much those were worth.
|
|
607
|
+
|
|
608
|
+
[Quality](#quality-what-happened-after-the-merge) already watches each merged pull request for some days: held up, or reverted, fixed afterwards, failed its checks. As a pull request merges, the app now also keeps what was said about it:
|
|
609
|
+
|
|
610
|
+
- the agent's own confidence,
|
|
611
|
+
- the review scorecard's recommendation,
|
|
612
|
+
- whether its tests were tested, and whether every break was caught,
|
|
613
|
+
- the engine and model,
|
|
614
|
+
- how far the agent ran without you.
|
|
615
|
+
|
|
616
|
+
**Quality → Track record**, or `agentmgr quality record`, compares the two once a pull request is settled:
|
|
617
|
+
|
|
618
|
+
| Table | Reads like |
|
|
619
|
+
| --- | --- |
|
|
620
|
+
| The agent's own confidence | "90 to 100%: 6 of 10 held up (60%), said 92% on average: said more than held up" |
|
|
621
|
+
| The review scorecard | "Ready to approve: 9 of 10 held up" |
|
|
622
|
+
| Tests tested | "every break caught: 6 of 6 held up" |
|
|
623
|
+
| Model | "claude · opus: 11 of 13 held up" |
|
|
624
|
+
| Without you | "Run to pull request: 4 of 5 held up" |
|
|
625
|
+
|
|
626
|
+
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
|
+
|
|
628
|
+
### Earned autonomy: the level a project's record supports
|
|
629
|
+
|
|
630
|
+
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:
|
|
631
|
+
|
|
632
|
+
- **Up one step** after at least 5 settled pull requests, 9 in 10 held up, and none of the last 5 a problem. "Run to merge" needs 10, with 95% held up and all of the last 10.
|
|
633
|
+
- **Down one step** when one of the last 3 did not hold up.
|
|
634
|
+
- Otherwise, keep it.
|
|
635
|
+
|
|
636
|
+
It is a suggestion. The level changes only when you press **Set** or run `agentmgr autonomy --project <name> --default <level>`; an agent's own call is refused. A project's level applies to its new agents when none is named; agents that run now keep theirs. `--default default` takes the project's own level away again.
|
|
637
|
+
|
|
638
|
+
**Limits.** The record counts merged pull requests only: work that was thrown away before a merge is not in it. "Fixed afterwards" is Quality's guess from titles and files, so mark the ones it gets wrong there. A pull request merged before this version has what is said about its agent now, not as it merged. A project is matched by its name. Small numbers say little, which is why the app waits for 5.
|
|
639
|
+
|
|
553
640
|
## Insights
|
|
554
641
|
|
|
555
|
-
**Insights** in the Brief panel, or `agentmgr insights <agent>`, shows the agent's work as four cards built from its ask and live context:
|
|
642
|
+
**Insights** in the Brief panel, or `agentmgr insights <agent>`, shows the agent's work as four quick cards built from its ask and live context, followed by three cards for the decision in it:
|
|
556
643
|
|
|
557
644
|
| Card | Answers |
|
|
558
645
|
| --- | --- |
|
|
@@ -563,6 +650,67 @@ The number is the agent's own statement, not a measurement.
|
|
|
563
650
|
|
|
564
651
|
Each card has at most **three points of about 12 words each**, so they're easy to remember and repeat. Insights uses the same context and the same separate, tool-less Claude call as Explain, so the agent isn't interrupted. Use Insights for a quick glance and Explain for the full briefing.
|
|
565
652
|
|
|
653
|
+
### The decision side: value, kind of idea, and paths
|
|
654
|
+
|
|
655
|
+
Below the four cards, Insights adds three more, for the part of a design that is a decision:
|
|
656
|
+
|
|
657
|
+
| Card | Answers |
|
|
658
|
+
| --- | --- |
|
|
659
|
+
| ⚖️ **Value: now and later** | What the work is worth as soon as it ships, what it is worth over time, what waiting costs, and which of the two should drive the design |
|
|
660
|
+
| 💡 **Kind of idea** | Just a task, worth a white paper, or possibly patentable; what is new, and what to do next |
|
|
661
|
+
| 🧭 **Paths, preferred first** | The 2 to 4 real ways to go, ranked, each with its value now and later, cost, risk, and when it is the right pick |
|
|
662
|
+
|
|
663
|
+
**Now against later.** "Now" is what someone gains as soon as it ships. "Later" is what it makes possible, saves or avoids over time, counted lower the less sure it is. Each is rated high, medium or low with a one-line reason.
|
|
664
|
+
|
|
665
|
+
**How the paths are ranked.**
|
|
666
|
+
|
|
667
|
+
1. The most value for its cost comes first.
|
|
668
|
+
2. Between close ones, the one that is easier to undo.
|
|
669
|
+
3. A path worth more later than now comes first only when waiting costs little, or when the cheaper path would close that door.
|
|
670
|
+
|
|
671
|
+
The first path is marked **Preferred**, with the reason it wins. The others stay listed with the condition under which each becomes the right pick, so the ranking can change when your situation does.
|
|
672
|
+
|
|
673
|
+
**Kind of idea.**
|
|
674
|
+
|
|
675
|
+
| Kind | Means | Next |
|
|
676
|
+
| --- | --- | --- |
|
|
677
|
+
| Just a task | Ordinary work done in a known way. Most work. | Build it |
|
|
678
|
+
| Worth a white paper | The approach or the result would teach others something | Write it up, and for whom |
|
|
679
|
+
| Possibly patentable | A specific technical mechanism that seems new, not an obvious step, and useful. An idea, a goal or a business rule alone is not. | Keep it unpublished and talk to a patent attorney before sharing |
|
|
680
|
+
|
|
681
|
+
When unsure between two kinds, the lower one is given.
|
|
682
|
+
|
|
683
|
+
**While the agent designs.** Agents weigh the same things before they build. When a task has more than one reasonable way, the agent lists them in its brief under **Options**, preferred first, in the same form, and builds the first unless you say otherwise. Its Results show them as **Paths it weighed**. If part of its design seems new, it says so in one line and keeps it inside the repository; whether that is worth a paper or a patent is yours to decide. A task with one reasonable way has no Options section. `"valueLens": false` in config.json turns this off for agents.
|
|
684
|
+
|
|
685
|
+
### Kept private: possibly patentable work is not sent out
|
|
686
|
+
|
|
687
|
+
Publishing before filing can cost the right to a patent. So when part of an agent's work is read as possibly new, the app keeps it private until you say otherwise.
|
|
688
|
+
|
|
689
|
+
**What makes it private:**
|
|
690
|
+
|
|
691
|
+
- the agent says part of its design is new (the "New:" line under Options in its brief),
|
|
692
|
+
- Insights reads it as possibly patentable,
|
|
693
|
+
- or you mark it: **keep this work private** under Insights, or `agentmgr private <agent> --keep`.
|
|
694
|
+
|
|
695
|
+
**What is held**, each with the reason and how to lift it:
|
|
696
|
+
|
|
697
|
+
| Held | Where it would have gone |
|
|
698
|
+
| --- | --- |
|
|
699
|
+
| Publishing its documents | Google Drive |
|
|
700
|
+
| Publishing an update, or posting it | Google Drive, Slack |
|
|
701
|
+
| Posting the scorecard | A comment on the pull request |
|
|
702
|
+
| Opening the pull request | GitHub, also when the agent runs without you or on autopilot |
|
|
703
|
+
| A merge without you | Left to you |
|
|
704
|
+
|
|
705
|
+
The agent is told as well: nothing published outside the repository, no pull request, and its design doc stays a file.
|
|
706
|
+
|
|
707
|
+
**Lifting it** is yours alone: **Allow sharing** in the agent's Results, or `agentmgr private <agent> --allow`. An agent's own call is refused. `--reset` goes back to what the agent and Insights say. A white paper is not held.
|
|
708
|
+
|
|
709
|
+
**Limits.** This guards what the app sends. It does not stop an agent from running a command in its terminal that publishes something; the agent is instructed not to, and its permission prompts still apply. Work already pushed or published before it was marked stays where it is. It is a caution based on a first read, not a finding that anything is patentable: talk to a patent attorney.
|
|
710
|
+
|
|
711
|
+
**Limits.** The ratings are a model's judgement from the agent's request and session, not a calculation with your numbers. The kind of idea is a first read: no search for prior art is made, and it is not legal advice. Publishing before filing can cost the right to a patent, so treat "possibly patentable" as a reason to ask an attorney before you share, not as a finding.
|
|
712
|
+
|
|
713
|
+
|
|
566
714
|
## Review changes
|
|
567
715
|
|
|
568
716
|
**Review changes** on an agent opens its changes against where its branch started (the merge base with the branch it came from), new files included:
|
package/package.json
CHANGED
package/public/app.js
CHANGED
|
@@ -60,6 +60,7 @@ import { morph } from '/morph.js';
|
|
|
60
60
|
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
|
+
import { kindHtml, optionsRows, parseKind, parsePaths, parseValue, pathsHtml, privateRow, valueHtml } from '/valuelens.js';
|
|
63
64
|
|
|
64
65
|
const $ = (sel) => document.querySelector(sel);
|
|
65
66
|
const agents = new Map();
|
|
@@ -661,6 +662,8 @@ function reviewBox(a) {
|
|
|
661
662
|
}
|
|
662
663
|
|
|
663
664
|
const INSIGHT_ICONS = { why: '🎯', what: '📦', how: '🛠', now: '📍' };
|
|
665
|
+
// The decision side of Insights (valuelens.js): worth now against later, the kind of idea, the ways ranked.
|
|
666
|
+
const INSIGHT_WIDE = { value: ['⚖️', 'Value: now and later'], kind: ['💡', 'Kind of idea'], paths: ['🧭', 'Paths, preferred first'] };
|
|
664
667
|
|
|
665
668
|
// ------------------------------------------------------------------ stakeholder documents
|
|
666
669
|
|
|
@@ -1055,14 +1058,17 @@ bindListen((id) => {
|
|
|
1055
1058
|
function insightsBox(a) {
|
|
1056
1059
|
const ins = a.insights;
|
|
1057
1060
|
const button = `<button class="small ${ins?.markdown ? '' : 'primary'}" data-act="insights" ${ins?.pending ? 'disabled' : ''}
|
|
1058
|
-
title="Why, What, How and Now in three memorable points each,
|
|
1061
|
+
title="Why, What, How and Now in three memorable points each; then what it is worth now against later, what kind of idea it is, and the ways to go ranked. From the agent's ask and live session (a separate one-off Claude call)">${ins?.pending ? 'Thinking…' : ins?.markdown ? 'Refresh insights' : 'Insights'}</button>`;
|
|
1059
1062
|
if (!ins?.markdown && !ins?.error) return { button, box: '' };
|
|
1060
1063
|
const sections = {};
|
|
1064
|
+
const wide = {};
|
|
1061
1065
|
for (const part of (ins.markdown ?? '').split(/^###\s+/m).slice(1)) {
|
|
1062
1066
|
const [head, ...rest] = part.split('\n');
|
|
1063
1067
|
const key = head.trim().toLowerCase().replace(/[^a-z]/g, '');
|
|
1064
1068
|
if (INSIGHT_ICONS[key]) sections[key] = rest.join('\n').trim();
|
|
1069
|
+
if (INSIGHT_WIDE[key]) wide[key] = rest.join('\n').trim();
|
|
1065
1070
|
}
|
|
1071
|
+
const lens = { value: valueHtml(parseValue(wide.value), esc), kind: kindHtml(parseKind(wide.kind), esc), paths: pathsHtml(parsePaths(wide.paths), esc) };
|
|
1066
1072
|
const stale = ins.markdown && a.brief?.updatedAt && ins.briefUpdatedAt !== a.brief.updatedAt;
|
|
1067
1073
|
const box = `<div class="insights">
|
|
1068
1074
|
${ins.error ? `<p class="error">Couldn't get insights: ${esc(ins.error)}</p>` : ''}
|
|
@@ -1070,7 +1076,14 @@ function insightsBox(a) {
|
|
|
1070
1076
|
? Object.keys(sections).length
|
|
1071
1077
|
? `<div class="insight-grid">${Object.keys(INSIGHT_ICONS)
|
|
1072
1078
|
.map((k) => `<section class="insight ${k}"><h4>${INSIGHT_ICONS[k]} ${k[0].toUpperCase()}${k.slice(1)}</h4><div class="md">${md(sections[k] || 'Unclear yet')}</div></section>`)
|
|
1073
|
-
.join('')}</div
|
|
1079
|
+
.join('')}</div>${
|
|
1080
|
+
Object.keys(INSIGHT_WIDE).some((k) => wide[k])
|
|
1081
|
+
? `<div class="insight-grid insight-wide">${Object.keys(INSIGHT_WIDE)
|
|
1082
|
+
.filter((k) => wide[k])
|
|
1083
|
+
.map((k) => `<section class="insight ${k}"><h4>${INSIGHT_WIDE[k][0]} ${INSIGHT_WIDE[k][1]}</h4>${lens[k] || `<div class="md">${md(wide[k])}</div>`}</section>`)
|
|
1084
|
+
.join('')}</div>${a.keptPrivate ? '' : '<p class="hint">If this may be worth protecting, <button class="link" data-act="idea-keep" title="The app then publishes and sends nothing of it until you allow it, and the agent is told">keep this work private</button>.</p>'}`
|
|
1085
|
+
: ''
|
|
1086
|
+
}`
|
|
1074
1087
|
: `<div class="md">${md(ins.markdown)}</div>`
|
|
1075
1088
|
: ''}
|
|
1076
1089
|
${ins.markdown ? `<p class="hint">${stale ? 'The brief has changed since; refresh for the latest. · ' : ''}From ${ago(ins.at)}.</p>` : ''}
|
|
@@ -1103,6 +1116,8 @@ function resultsCard(a) {
|
|
|
1103
1116
|
${scoreStrip(a)}
|
|
1104
1117
|
${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>' : ''}
|
|
1105
1118
|
${r.blockers.length ? `<ul class="blockers">${r.blockers.map((x) => item(x, 'blocker')).join('')}</ul>` : ''}
|
|
1119
|
+
${privateRow(a, esc)}
|
|
1120
|
+
${optionsRows(a, esc)}
|
|
1106
1121
|
${proofRows(a, esc)}
|
|
1107
1122
|
${r.delivered.length ? `<ul class="delivered">${r.delivered.map((x) => item(x, 'delivered')).join('')}</ul>` : '<p class="hint">Nothing delivered yet.</p>'}
|
|
1108
1123
|
${r.notes ? `<div class="md">${md(r.notes)}</div>` : ''}
|
|
@@ -4199,6 +4214,13 @@ $('#detail-body').addEventListener('click', async (e) => {
|
|
|
4199
4214
|
return openPlan(a.id);
|
|
4200
4215
|
case 'accept-open':
|
|
4201
4216
|
return acceptUi.open(a.id);
|
|
4217
|
+
case 'idea-allow':
|
|
4218
|
+
case 'idea-keep':
|
|
4219
|
+
case 'idea-reset':
|
|
4220
|
+
return act(async () => {
|
|
4221
|
+
upsert(await api('POST', `/agents/${a.id}/private`, { private: btn.dataset.act === 'idea-keep' ? true : btn.dataset.act === 'idea-allow' ? false : null }));
|
|
4222
|
+
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');
|
|
4223
|
+
});
|
|
4202
4224
|
case 'proof-open':
|
|
4203
4225
|
return proofUi.open(a.id);
|
|
4204
4226
|
case 'auto-open':
|
package/public/proof.js
CHANGED
|
@@ -33,14 +33,65 @@ export function proofRows(a, esc) {
|
|
|
33
33
|
: finished && passed
|
|
34
34
|
? `<p class="hint proof-row">No proof recorded for its ${passed} passed check${passed === 1 ? '' : 's'}: they are its word.</p>`
|
|
35
35
|
: '';
|
|
36
|
-
|
|
36
|
+
// Its tests tested (Test the tests): how many small breaks in the changed lines they noticed.
|
|
37
|
+
const b = a.breaks;
|
|
38
|
+
const n = (st) => (b?.breaks ?? []).filter((x) => x.status === st).length;
|
|
39
|
+
const tested = b
|
|
40
|
+
? `<p class="proof-row"><b>Tests tested</b> <span class="tag ${!b.baseline?.ok || n('missed') ? 'proof-bad' : 'proof-ok'}" title="Lines of the change broken one at a time, and the tests run on each">${!b.baseline?.ok ? 'the tests fail as it is' : `${n('caught')} of ${n('caught') + n('missed')} breaks caught`}</span>${doc?.entries ? '' : ' <button class="small" data-act="proof-open">Open</button>'}</p>`
|
|
41
|
+
: finished && !doc?.entries
|
|
42
|
+
? '<p class="hint proof-row">Do its tests notice a mistake? <button class="small" data-act="proof-open">Test its tests</button></p>'
|
|
43
|
+
: '';
|
|
44
|
+
return notDone + riskRows(a, esc, finished) + proof + tested;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/** The pre-mortem: the risks the agent named before starting, and how each ended. */
|
|
48
|
+
export function riskRows(a, esc, finished) {
|
|
49
|
+
const risks = a.brief?.risks ?? [];
|
|
50
|
+
if (!risks.length) return '';
|
|
51
|
+
const n = (st) => risks.filter((r) => r.state === st).length;
|
|
52
|
+
const mark = { avoided: ['proof-ok', 'Avoided'], happened: ['proof-bad', 'Happened'], open: ['', finished ? 'Not checked' : 'Open'] };
|
|
53
|
+
const head = finished ? `${n('avoided')} avoided${n('happened') ? `, ${n('happened')} happened` : ''}${n('open') ? `, ${n('open')} not checked` : ''}` : `${risks.length} named`;
|
|
54
|
+
return `<details class="risks"${n('happened') || (finished && n('open')) ? ' open' : ''}><summary><b>Risks it named before starting</b> <span class="hint">${head}</span></summary><ul>${risks.map((r) => `<li><span class="tag ${mark[r.state][0]}">${mark[r.state][1]}</span> ${esc(r.text)}</li>`).join('')}</ul></details>`;
|
|
37
55
|
}
|
|
38
56
|
|
|
39
57
|
export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
40
58
|
let id = null;
|
|
41
59
|
let view = null;
|
|
42
60
|
let stamp = '';
|
|
43
|
-
|
|
61
|
+
let breaks = null; // Test the tests: the view of /breaks
|
|
62
|
+
let command = ''; // the test command typed here, kept over redraws
|
|
63
|
+
const stampOf = (a) => `${a.proofDoc?.updatedAt ?? ''}|${a.proof?.at ?? ''}|${a.breaks?.at ?? ''}|${a.breaks?.sentAt ?? ''}`;
|
|
64
|
+
|
|
65
|
+
/** Test the tests: the last run, the command, and the buttons. */
|
|
66
|
+
function breaksHtml() {
|
|
67
|
+
const v = breaks;
|
|
68
|
+
if (!v) return '';
|
|
69
|
+
const m = v.last;
|
|
70
|
+
const mark = { caught: ['proof-ok', 'Caught'], missed: ['proof-bad', 'Not noticed'], skipped: ['', 'Not tried'] };
|
|
71
|
+
const row = (b) => `<li>
|
|
72
|
+
<div class="proof-title"><span class="tag ${mark[b.status][0]}">${mark[b.status][1]}</span> ${esc(b.file)}:${b.line} <span class="hint"><code>${esc(b.from)}</code> became <code>${esc(b.to)}</code></span></div>
|
|
73
|
+
<code class="proof-cmd">${esc(b.before.trim())}</code>
|
|
74
|
+
${b.status === 'missed' ? '<p class="hint">The tests still passed with this line wrong: nothing checks it.</p>' : ''}
|
|
75
|
+
${b.status === 'caught' && b.stopped ? '<p class="hint">The tests did not finish with this line wrong, which counts as caught.</p>' : ''}
|
|
76
|
+
${b.status === 'skipped' ? `<p class="hint">${esc(b.why)}</p>` : ''}
|
|
77
|
+
</li>`;
|
|
78
|
+
const last = !m
|
|
79
|
+
? ''
|
|
80
|
+
: !m.baseline.ok
|
|
81
|
+
? `<p class="hint">Run ${ago(m.at)} with <code>${esc(m.commands.join(' && '))}</code>: the tests fail before anything is changed (exit ${m.baseline.code ?? 'none, stopped'}), so there is nothing to compare with.</p><pre class="proof-out bad">${esc(m.baseline.tail ?? '')}</pre>`
|
|
82
|
+
: `<p class="hint">${m.stale ? 'Before the latest changes: ' : ''}Run ${ago(m.at)} with <code>${esc(m.commands.join(' && '))}</code>: <b>${esc(v.line)}</b>.${m.sentAt ? ` The ones not noticed were sent to the agent ${ago(m.sentAt)}.` : ''}</p>
|
|
83
|
+
${m.breaks.length ? `<ul class="breaks-list">${m.breaks.map(row).join('')}</ul>` : ''}
|
|
84
|
+
${m.restored === false ? '<p class="hint proof-warn">The folder is not as it was before the run: look at its changes.</p>' : ''}`;
|
|
85
|
+
return `<h3 class="breaks-head">Test the tests</h3>
|
|
86
|
+
<p class="hint">Do its tests notice a mistake? This breaks the lines the agent changed, one at a time (<code>===</code> becomes <code>!==</code>, <code>&&</code> becomes <code>||</code>, a number goes up by one), runs the tests on each, and puts the line back. A break the tests still pass on is a line nothing checks.</p>
|
|
87
|
+
${last}
|
|
88
|
+
${v.canRun ? `<label class="breaks-cmd">The command that runs the tests <input type="text" data-breaks="command" value="${esc(command)}" placeholder="${esc(v.commands.join(' && ') || 'npm test')}" autocapitalize="off" autocorrect="off" spellcheck="false"></label>
|
|
89
|
+
<p class="hint">${v.commands.length ? 'Empty: the passing commands the agent recorded, shown in grey.' : 'The agent recorded no passing test command: type the one that runs the tests.'} It runs in the agent's folder on this computer, without its permission prompts, up to ${v.max + 1} times.</p>` : `<p class="hint">${esc(v.whyNot)}</p>`}
|
|
90
|
+
<div class="breaks-actions">
|
|
91
|
+
${v.canRun ? `<button type="button" class="small" data-breaks="run" ${v.running ? 'disabled' : ''}>${v.running ? 'Breaking and testing…' : m ? 'Run it again' : 'Break the code and run the tests'}</button>` : ''}
|
|
92
|
+
${m && !m.stale && m.missed ? `<button type="button" class="small" data-breaks="send" ${v.running ? 'disabled' : ''} title="Sends the lines whose breaks were not noticed, asking for tests that fail when they are wrong">${m.sentAt ? 'Tell the agent again' : 'Tell the agent'}</button>` : ''}
|
|
93
|
+
</div>`;
|
|
94
|
+
}
|
|
44
95
|
|
|
45
96
|
function render() {
|
|
46
97
|
const a = id && agentOf(id);
|
|
@@ -56,12 +107,20 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
56
107
|
${e.command && !e.runnable ? `<p class="hint">Not run again by the app: ${esc(e.why)}.</p>` : ''}
|
|
57
108
|
</li>`;
|
|
58
109
|
const n = view.entries.filter((e) => e.runnable).length;
|
|
110
|
+
// Typing the test command goes on over a redraw.
|
|
111
|
+
const typing = document.activeElement?.dataset?.breaks === 'command' ? document.activeElement.selectionStart : null;
|
|
59
112
|
dialog.querySelector('#proof-body').innerHTML = `
|
|
60
113
|
<p class="hint">The agent's own record of what it ran. ${view.passed ? `Its brief ticks ${view.passed} check${view.passed === 1 ? '' : 's'} as passed; ` : ''}${view.counts.commands} ${view.counts.commands === 1 ? 'has' : 'have'} a command and output here.</p>
|
|
61
114
|
${view.notDone.length ? `<div class="not-done"><b>Not done, as the agent says</b><ul>${view.notDone.map((t) => `<li>${esc(t)}</li>`).join('')}</ul></div>` : ''}
|
|
62
115
|
${view.entries.length ? `<ul class="proof-list">${view.entries.map(entry).join('')}</ul>` : '<p class="hint">Nothing recorded yet.</p>'}
|
|
63
116
|
${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>` : ''}
|
|
64
|
-
${!view.canRun && view.counts.commands ? `<p class="hint">${esc(view.whyNot)}</p>` : ''}
|
|
117
|
+
${!view.canRun && view.counts.commands ? `<p class="hint">${esc(view.whyNot)}</p>` : ''}
|
|
118
|
+
${breaksHtml()}`;
|
|
119
|
+
if (typing !== null) {
|
|
120
|
+
const input = dialog.querySelector('[data-breaks="command"]');
|
|
121
|
+
input?.focus();
|
|
122
|
+
input?.setSelectionRange(typing, typing);
|
|
123
|
+
}
|
|
65
124
|
const btn = dialog.querySelector('[data-proof="run"]');
|
|
66
125
|
btn.hidden = !view.canRun || !n;
|
|
67
126
|
btn.disabled = view.running;
|
|
@@ -72,7 +131,7 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
72
131
|
async function load() {
|
|
73
132
|
stamp = stampOf(agentOf(id) ?? {});
|
|
74
133
|
try {
|
|
75
|
-
view = await api('GET', `/agents/${id}/proof`);
|
|
134
|
+
[view, breaks] = await Promise.all([api('GET', `/agents/${id}/proof`), api('GET', `/agents/${id}/breaks`)]);
|
|
76
135
|
} catch (e) {
|
|
77
136
|
toast(`Error: ${e.message}`, 5000);
|
|
78
137
|
}
|
|
@@ -82,6 +141,22 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
82
141
|
dialog.addEventListener('click', async (e) => {
|
|
83
142
|
const act = e.target.closest('[data-proof]')?.dataset.proof;
|
|
84
143
|
if (act === 'close') return dialog.close();
|
|
144
|
+
const b = e.target.closest('button[data-breaks]')?.dataset.breaks;
|
|
145
|
+
if (b && id && breaks) {
|
|
146
|
+
const send = b === 'send';
|
|
147
|
+
breaks.running = true;
|
|
148
|
+
render();
|
|
149
|
+
try {
|
|
150
|
+
breaks = await api('POST', `/agents/${id}/breaks/${send ? 'send' : 'run'}`, send ? undefined : { command: command.trim() || undefined });
|
|
151
|
+
const m = breaks.last;
|
|
152
|
+
toast(send ? 'Sent to the agent' : !m.baseline.ok ? 'The tests fail before anything is changed' : m.missed ? `${m.missed} of ${m.tried} breaks were not noticed` : m.tried ? `All ${m.tried} breaks were caught` : 'No line of the change could be broken in a small way', 5000);
|
|
153
|
+
} catch (err) {
|
|
154
|
+
if (breaks) breaks.running = false;
|
|
155
|
+
toast(`Error: ${err.message}`, 6000);
|
|
156
|
+
}
|
|
157
|
+
stamp = stampOf(agentOf(id) ?? {});
|
|
158
|
+
return render();
|
|
159
|
+
}
|
|
85
160
|
if (act !== 'run' || !id || !view) return;
|
|
86
161
|
view.running = true;
|
|
87
162
|
render();
|
|
@@ -94,12 +169,17 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
94
169
|
}
|
|
95
170
|
render();
|
|
96
171
|
});
|
|
97
|
-
dialog.addEventListener('
|
|
172
|
+
dialog.addEventListener('input', (e) => {
|
|
173
|
+
if (e.target.dataset?.breaks === 'command') command = e.target.value;
|
|
174
|
+
});
|
|
175
|
+
dialog.addEventListener('close', () => ((id = null), (view = null), (breaks = null), (command = '')));
|
|
98
176
|
|
|
99
177
|
return {
|
|
100
178
|
open(agentId) {
|
|
101
179
|
id = agentId;
|
|
102
180
|
view = null;
|
|
181
|
+
breaks = null;
|
|
182
|
+
command = '';
|
|
103
183
|
dialog.querySelector('#proof-title').textContent = 'Proof';
|
|
104
184
|
dialog.querySelector('#proof-body').innerHTML = '<p class="hint">Loading…</p>';
|
|
105
185
|
dialog.querySelector('[data-proof="run"]').hidden = true;
|
|
@@ -108,7 +188,7 @@ export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
|
108
188
|
},
|
|
109
189
|
/** The agent changed its proof while the dialog is open. */
|
|
110
190
|
agentChanged(a) {
|
|
111
|
-
if (id === a.id && view && !view.running && stampOf(a) !== stamp) load();
|
|
191
|
+
if (id === a.id && view && !view.running && !breaks?.running && stampOf(a) !== stamp) load();
|
|
112
192
|
},
|
|
113
193
|
};
|
|
114
194
|
}
|
package/public/quality.js
CHANGED
|
@@ -25,7 +25,8 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
25
25
|
let selected = null; // a period key; null is the current one
|
|
26
26
|
let only = false; // only the ones that did not hold up
|
|
27
27
|
let again = null;
|
|
28
|
-
let mode = 'after'; // or 'standards': what every change in a repository has to meet (standards.js)
|
|
28
|
+
let mode = 'after'; // or 'standards': what every change in a repository has to meet (standards.js); or 'record': what was said against what held (record.js)
|
|
29
|
+
let record = null;
|
|
29
30
|
const std = initStandards({
|
|
30
31
|
api,
|
|
31
32
|
esc,
|
|
@@ -39,6 +40,15 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
39
40
|
period = localStorage.getItem(SAVED) || 'week';
|
|
40
41
|
} catch {}
|
|
41
42
|
|
|
43
|
+
async function loadRecord() {
|
|
44
|
+
try {
|
|
45
|
+
record = await api('GET', '/quality/record');
|
|
46
|
+
} catch (e) {
|
|
47
|
+
toast?.(e.message, 5000);
|
|
48
|
+
}
|
|
49
|
+
render();
|
|
50
|
+
}
|
|
51
|
+
|
|
42
52
|
async function load() {
|
|
43
53
|
try {
|
|
44
54
|
data = await api('GET', `/quality?period=${period}`);
|
|
@@ -106,6 +116,41 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
106
116
|
</tr>`;
|
|
107
117
|
}
|
|
108
118
|
|
|
119
|
+
/** Track record: what was said at the merge against what held up. */
|
|
120
|
+
function recordHtml() {
|
|
121
|
+
const r = record;
|
|
122
|
+
if (!r) return '<p class="hint">Loading…</p>';
|
|
123
|
+
const LEVEL = { ask: 'Ask me', run: 'Agree, then run', pr: 'Run to pull request', merge: 'Run to merge' };
|
|
124
|
+
const intro = '<p class="hint">Was the confidence right? For each merged pull request the app keeps what was said about it as it merged, and compares that with what happened after: held up, or reverted, fixed afterwards, failed its checks. One counts once it is settled.</p>';
|
|
125
|
+
if (!r.settled) return `${intro}<p class="hint issues-empty">No merged pull request is settled yet${r.open ? ` (${r.open} still watched or not looked at)` : ''}. The record fills as the watch days pass.</p>`;
|
|
126
|
+
const cls = (x) => (x.read === 'said more than held up' ? 'rec-bad' : x.read === 'about right' || x.read === 'held up better than said' ? 'rec-ok' : '');
|
|
127
|
+
const rows = (list, said) => list.map((x) => `<tr><td>${esc(x.label)}</td><td class="num">${x.held} of ${x.n}</td><td class="num">${x.heldPct}%</td>${said ? `<td class="num">${x.said == null ? '—' : `${x.said}%`}</td>` : ''}<td class="${cls(x)}">${esc(x.read)}</td></tr>`).join('');
|
|
128
|
+
const table = (title, hint, list, said = false) =>
|
|
129
|
+
list.length
|
|
130
|
+
? `<h3 class="rec-head">${title}</h3><p class="hint">${hint}</p><div class="issues-scroll"><table class="issues rec-table"><thead><tr><th></th><th class="num">Held up</th><th class="num">Share</th>${said ? '<th class="num">Said, on average</th>' : ''}<th></th></tr></thead><tbody>${rows(list, said)}</tbody></table></div>`
|
|
131
|
+
: '';
|
|
132
|
+
const project = (p) => `<tr>
|
|
133
|
+
<td>${esc(p.label)}</td><td class="num">${p.held} of ${p.n}</td><td class="num">${p.heldPct}%</td>
|
|
134
|
+
<td>${LEVEL[p.current]}${p.level ? '' : ' <span class="hint">(the default)</span>'}</td>
|
|
135
|
+
<td>${p.suggestion ? `<span class="${p.suggestion.direction === 'up' ? 'rec-ok' : 'rec-bad'}">The record supports <b>${LEVEL[p.suggestion.level]}</b></span><div class="hint">${esc(p.suggestion.why)}</div>` : `<span class="hint">${p.n < 5 ? 'too few to say' : 'keep it'}</span>`}</td>
|
|
136
|
+
<td class="nowrap">${p.suggestion ? `<button class="small" data-record-level="${p.suggestion.level}" data-project="${esc(p.label)}" title="New agents in this project get this level when none is named. Agents that run now keep theirs.">Set ${LEVEL[p.suggestion.level]}</button>` : ''}${p.level ? ` <button class="link" data-record-level="default" data-project="${esc(p.label)}" title="Back to the level every other project gets">Use the default</button>` : ''}</td>
|
|
137
|
+
</tr>`;
|
|
138
|
+
return `${intro}
|
|
139
|
+
<div class="value-cards">
|
|
140
|
+
${card('Held up', `${r.heldPct}%`, `${r.held} of ${r.settled} settled pull requests`, null)}
|
|
141
|
+
${r.confidence ? card('Said by the agents', `${r.confidence.said}%`, `their own confidence, on average; ${r.confidence.heldPct}% of those held up`, null) : ''}
|
|
142
|
+
${card('Not settled yet', String(r.open), 'still watched, or not looked at', null)}
|
|
143
|
+
</div>
|
|
144
|
+
${table("The agent's own confidence", `What the agent wrote as its confidence, against the share that held up.${r.noConfidence ? ` ${r.noConfidence} had none written.` : ''}`, [...(r.confidence ? [r.confidence] : []), ...r.bands], true)}
|
|
145
|
+
${table('The review scorecard', 'What the scorecard recommended as it merged.', r.scorecard)}
|
|
146
|
+
${table('Tests tested', 'Whether the tests were tested before the merge (Test the tests), and how that went.', r.tests)}
|
|
147
|
+
${table('Model', 'The engine and model that did the work.', r.models)}
|
|
148
|
+
${table('Without you', 'How far the agent ran without you.', r.levels)}
|
|
149
|
+
<h3 class="rec-head">Projects: the level the record supports</h3>
|
|
150
|
+
<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>
|
|
151
|
+
<div class="issues-scroll"><table class="issues rec-table"><thead><tr><th>Project</th><th class="num">Held up</th><th class="num">Share</th><th>New agents</th><th>Record</th><th></th></tr></thead><tbody>${r.projects.map(project).join('')}</tbody></table></div>`;
|
|
152
|
+
}
|
|
153
|
+
|
|
109
154
|
function render() {
|
|
110
155
|
if (!dialog.open) return;
|
|
111
156
|
if (!data) {
|
|
@@ -117,6 +162,7 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
117
162
|
const modes = `<div class="chips" role="tablist" aria-label="Quality">
|
|
118
163
|
<button class="chip ${mode === 'after' ? 'active' : ''}" role="tab" aria-selected="${mode === 'after'}" data-quality-mode="after">After the merge</button>
|
|
119
164
|
<button class="chip ${mode === 'standards' ? 'active' : ''}" role="tab" aria-selected="${mode === 'standards'}" data-quality-mode="standards" title="What every change in a repository has to meet: lessons from what went wrong, high-risk paths, and the checks the app runs itself">Standards${n ? ` <span class="badge">${n}</span>` : ''}</button>
|
|
165
|
+
<button class="chip ${mode === 'record' ? 'active' : ''}" role="tab" aria-selected="${mode === 'record'}" data-quality-mode="record" title="What was said when each pull request merged, against what held up; and the level of Without you each project's record supports">Track record</button>
|
|
120
166
|
</div>`;
|
|
121
167
|
if (mode === 'standards') {
|
|
122
168
|
body.innerHTML = `
|
|
@@ -130,6 +176,19 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
130
176
|
${std.html()}`;
|
|
131
177
|
return;
|
|
132
178
|
}
|
|
179
|
+
if (mode === 'record') {
|
|
180
|
+
body.innerHTML = `
|
|
181
|
+
<div class="issues-head">
|
|
182
|
+
<h2>Quality</h2>
|
|
183
|
+
${modes}
|
|
184
|
+
<span class="spacer"></span>
|
|
185
|
+
<button class="small" data-quality="copy-record" title="Copy the track record as Markdown">Copy</button>
|
|
186
|
+
${expandButton(dialog)}
|
|
187
|
+
<button class="small" data-quality="close" title="Close (Esc)">Close</button>
|
|
188
|
+
</div>
|
|
189
|
+
${recordHtml()}`;
|
|
190
|
+
return;
|
|
191
|
+
}
|
|
133
192
|
const ps = data.periods;
|
|
134
193
|
const i = Math.max(0, ps.findIndex((p) => p.key === selected));
|
|
135
194
|
const p = ps[i];
|
|
@@ -181,9 +240,28 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
181
240
|
if (m) {
|
|
182
241
|
mode = m.dataset.qualityMode;
|
|
183
242
|
render();
|
|
184
|
-
return mode === 'standards' ? std.load() : load();
|
|
243
|
+
return mode === 'standards' ? std.load() : mode === 'record' ? loadRecord() : load();
|
|
185
244
|
}
|
|
186
245
|
if (mode === 'standards' && std.click(e)) return;
|
|
246
|
+
const lvl = e.target.closest('[data-record-level]');
|
|
247
|
+
if (lvl) {
|
|
248
|
+
try {
|
|
249
|
+
await api('PUT', '/autonomy', { project: lvl.dataset.project, level: lvl.dataset.recordLevel });
|
|
250
|
+
toast?.(lvl.dataset.recordLevel === 'default' ? `${lvl.dataset.project}: new agents get the default again` : `${lvl.dataset.project}: set for its new agents`);
|
|
251
|
+
} catch (err) {
|
|
252
|
+
toast?.(err.message, 6000);
|
|
253
|
+
}
|
|
254
|
+
return loadRecord();
|
|
255
|
+
}
|
|
256
|
+
if (e.target.closest('[data-quality="copy-record"]')) {
|
|
257
|
+
try {
|
|
258
|
+
await navigator.clipboard.writeText((await api('GET', '/quality/record?format=md')).markdown);
|
|
259
|
+
toast?.('Copied the track record');
|
|
260
|
+
} catch (err) {
|
|
261
|
+
toast?.(err.message, 6000);
|
|
262
|
+
}
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
187
265
|
const per = e.target.closest('[data-quality-period]');
|
|
188
266
|
if (per) {
|
|
189
267
|
period = per.dataset.qualityPeriod;
|
|
@@ -266,7 +344,7 @@ export function initQuality({ api, $, esc, toast, ago, openAgent }) {
|
|
|
266
344
|
function changed() {
|
|
267
345
|
if (!dialog.open) return;
|
|
268
346
|
clearTimeout(again);
|
|
269
|
-
again = setTimeout(() => (load(), std.load()), 800);
|
|
347
|
+
again = setTimeout(() => (load(), std.load(), mode === 'record' && loadRecord()), 800);
|
|
270
348
|
}
|
|
271
349
|
|
|
272
350
|
expandable(dialog, render);
|