ai-agentmanager 1.63.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 +37 -0
- package/README.md +168 -3
- package/package.json +1 -1
- package/public/app.js +48 -4
- package/public/autonomy.js +4 -0
- package/public/groups.js +2 -0
- package/public/index.html +7 -0
- package/public/machine.js +2 -0
- package/public/proof.js +194 -0
- package/public/quality.js +81 -3
- package/public/style.css +54 -1
- package/public/valuelens.js +114 -0
- package/src/autonomy.js +81 -10
- package/src/autopilot.js +3 -1
- package/src/brief.js +73 -6
- package/src/cli.js +101 -5
- package/src/config.js +8 -0
- package/src/engines/claude.js +7 -2
- package/src/inbox.js +60 -6
- package/src/manager.js +44 -4
- package/src/mutate.js +456 -0
- package/src/private.js +52 -0
- package/src/proof.js +255 -0
- package/src/quality.js +16 -2
- package/src/record.js +147 -0
- package/src/scorecard.js +40 -2
- package/src/server.js +53 -2
- package/src/service.js +24 -3
package/public/proof.js
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// Proof on the page: what the agent recorded of its checks (the command, its exit code, the last
|
|
2
|
+
// lines of output), what it says it did not do, and the commands run again here when you ask.
|
|
3
|
+
|
|
4
|
+
/** "3 recorded runs, 1 by reading" for the results card. */
|
|
5
|
+
export function proofLine(doc) {
|
|
6
|
+
if (!doc?.entries) return '';
|
|
7
|
+
return `${doc.commands} recorded run${doc.commands === 1 ? '' : 's'}${doc.entries > doc.commands ? `, ${doc.entries - doc.commands} by reading` : ''}`;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** The last run by the app, when it still speaks for the proof as it is now. */
|
|
11
|
+
export function rerunOf(a) {
|
|
12
|
+
const r = a.proof;
|
|
13
|
+
if (!r?.results?.length || r.proofAt !== (a.proofDoc?.updatedAt ?? null)) return null;
|
|
14
|
+
const n = (s) => r.results.filter((x) => x.status === s).length;
|
|
15
|
+
return { at: r.at, same: n('same'), differs: n('differs'), skipped: n('skipped') };
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/** The rows in the results card: what was left out, and the proof with the way in. */
|
|
19
|
+
export function proofRows(a, esc) {
|
|
20
|
+
const r = a.results;
|
|
21
|
+
if (!r?.fromAgent) return '';
|
|
22
|
+
const finished = ['done', 'partial'].includes(r.outcome);
|
|
23
|
+
const passed = (a.brief?.checks ?? []).filter((c) => c.state === 'passed').length;
|
|
24
|
+
const doc = a.proofDoc;
|
|
25
|
+
const rr = rerunOf(a);
|
|
26
|
+
const notDone = r.notDone?.length
|
|
27
|
+
? `<div class="not-done"><b>Not done, as the agent says</b><ul>${r.notDone.map((t) => `<li>${esc(t)}</li>`).join('')}</ul></div>`
|
|
28
|
+
: finished && !r.notDoneSaid
|
|
29
|
+
? '<p class="hint not-done-none">The agent has not said what it left out.</p>'
|
|
30
|
+
: '';
|
|
31
|
+
const proof = doc?.entries
|
|
32
|
+
? `<p class="proof-row"><b>Proof</b> <span class="hint">${esc(proofLine(doc))}</span>${rr ? ` <span class="tag ${rr.differs ? 'proof-bad' : 'proof-ok'}" title="The recorded commands, run again on this computer">${rr.differs ? `${rr.differs} different when run again` : `${rr.same} same when run again`}</span>` : ''} <button class="small" data-act="proof-open">Open</button></p>`
|
|
33
|
+
: finished && passed
|
|
34
|
+
? `<p class="hint proof-row">No proof recorded for its ${passed} passed check${passed === 1 ? '' : 's'}: they are its word.</p>`
|
|
35
|
+
: '';
|
|
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>`;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function initProof({ dialog, api, esc, toast, ago, agentOf }) {
|
|
58
|
+
let id = null;
|
|
59
|
+
let view = null;
|
|
60
|
+
let stamp = '';
|
|
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
|
+
}
|
|
95
|
+
|
|
96
|
+
function render() {
|
|
97
|
+
const a = id && agentOf(id);
|
|
98
|
+
if (!a || !view) return;
|
|
99
|
+
dialog.querySelector('#proof-title').textContent = `Proof: ${a.name}`;
|
|
100
|
+
const mark = { same: ['proof-ok', 'Same result'], differs: ['proof-bad', 'Different result'], skipped: ['', 'Not run again'] };
|
|
101
|
+
const entry = (e) => `<li>
|
|
102
|
+
<div class="proof-title">${esc(e.title)}${e.rerun ? ` <span class="tag ${mark[e.rerun.status][0]}">${mark[e.rerun.status][1]}</span>` : ''}</div>
|
|
103
|
+
${e.command ? `<code class="proof-cmd">${esc(e.command)}</code>${e.exit === null ? '' : ` <span class="hint">exit ${e.exit}</span>`}` : `<span class="hint">Verified by reading${e.note ? `: ${esc(e.note)}` : ''}</span>`}
|
|
104
|
+
${e.output ? `<pre class="proof-out">${esc(e.output)}</pre>` : ''}
|
|
105
|
+
${e.rerun?.status === 'differs' ? `<p class="hint">Run again: exit ${e.rerun.code ?? 'none (stopped)'}${e.rerun.output === 'differs' ? ', and its last recorded line was not printed' : ''}</p><pre class="proof-out bad">${esc(e.rerun.tail ?? '')}</pre>` : ''}
|
|
106
|
+
${e.rerun?.status === 'same' && e.rerun.output === 'differs' ? '<p class="hint">The same exit code; its last recorded line was not printed this time (durations and dates differ between runs).</p>' : ''}
|
|
107
|
+
${e.command && !e.runnable ? `<p class="hint">Not run again by the app: ${esc(e.why)}.</p>` : ''}
|
|
108
|
+
</li>`;
|
|
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;
|
|
112
|
+
dialog.querySelector('#proof-body').innerHTML = `
|
|
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>
|
|
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>` : ''}
|
|
115
|
+
${view.entries.length ? `<ul class="proof-list">${view.entries.map(entry).join('')}</ul>` : '<p class="hint">Nothing recorded yet.</p>'}
|
|
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>` : ''}
|
|
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
|
+
}
|
|
124
|
+
const btn = dialog.querySelector('[data-proof="run"]');
|
|
125
|
+
btn.hidden = !view.canRun || !n;
|
|
126
|
+
btn.disabled = view.running;
|
|
127
|
+
btn.textContent = view.running ? 'Running…' : `Run ${n === 1 ? 'it' : `these ${n}`} again here`;
|
|
128
|
+
btn.title = 'Runs the commands above in the agent\'s folder on this computer, without its permission prompts. Read them first.';
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
async function load() {
|
|
132
|
+
stamp = stampOf(agentOf(id) ?? {});
|
|
133
|
+
try {
|
|
134
|
+
[view, breaks] = await Promise.all([api('GET', `/agents/${id}/proof`), api('GET', `/agents/${id}/breaks`)]);
|
|
135
|
+
} catch (e) {
|
|
136
|
+
toast(`Error: ${e.message}`, 5000);
|
|
137
|
+
}
|
|
138
|
+
render();
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
dialog.addEventListener('click', async (e) => {
|
|
142
|
+
const act = e.target.closest('[data-proof]')?.dataset.proof;
|
|
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
|
+
}
|
|
160
|
+
if (act !== 'run' || !id || !view) return;
|
|
161
|
+
view.running = true;
|
|
162
|
+
render();
|
|
163
|
+
try {
|
|
164
|
+
view = await api('POST', `/agents/${id}/proof/run`);
|
|
165
|
+
toast(view.rerun.differs ? `${view.rerun.differs} gave a different result` : 'All gave the same result');
|
|
166
|
+
} catch (err) {
|
|
167
|
+
view.running = false;
|
|
168
|
+
toast(`Error: ${err.message}`, 5000);
|
|
169
|
+
}
|
|
170
|
+
render();
|
|
171
|
+
});
|
|
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 = '')));
|
|
176
|
+
|
|
177
|
+
return {
|
|
178
|
+
open(agentId) {
|
|
179
|
+
id = agentId;
|
|
180
|
+
view = null;
|
|
181
|
+
breaks = null;
|
|
182
|
+
command = '';
|
|
183
|
+
dialog.querySelector('#proof-title').textContent = 'Proof';
|
|
184
|
+
dialog.querySelector('#proof-body').innerHTML = '<p class="hint">Loading…</p>';
|
|
185
|
+
dialog.querySelector('[data-proof="run"]').hidden = true;
|
|
186
|
+
if (!dialog.open) dialog.showModal();
|
|
187
|
+
return load();
|
|
188
|
+
},
|
|
189
|
+
/** The agent changed its proof while the dialog is open. */
|
|
190
|
+
agentChanged(a) {
|
|
191
|
+
if (id === a.id && view && !view.running && !breaks?.running && stampOf(a) !== stamp) load();
|
|
192
|
+
},
|
|
193
|
+
};
|
|
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);
|
package/public/style.css
CHANGED
|
@@ -362,7 +362,34 @@ body.term-max .term-agent, .term-wrap:fullscreen .term-agent { display: inline-b
|
|
|
362
362
|
.insight h4 { margin: 0 0 6px; font-size: 13px; color: var(--text); }
|
|
363
363
|
.insight .md ul { margin: 0; padding-left: 16px; }
|
|
364
364
|
.insight .md li { margin: 0 0 4px; }
|
|
365
|
+
.insight-wide { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 2fr); margin-top: 10px; }
|
|
366
|
+
.insight.value { border-top-color: #f08c00; }
|
|
367
|
+
.insight.kind { border-top-color: #0c8599; }
|
|
368
|
+
.insight.paths { border-top-color: #6741d9; }
|
|
369
|
+
.vl-row { margin: 0 0 8px; font-size: 13px; }
|
|
370
|
+
.vl-row b { display: inline-block; min-width: 40px; }
|
|
371
|
+
.vl-word { font-weight: 600; }
|
|
372
|
+
.vl-meter { display: inline-flex; gap: 2px; vertical-align: middle; }
|
|
373
|
+
.vl-meter i { width: 10px; height: 8px; border-radius: 2px; background: var(--border); }
|
|
374
|
+
.vl-high i, .vl-medium i:nth-child(-n+2), .vl-low i:first-child { background: var(--accent); }
|
|
375
|
+
.vl-line { margin: 0 0 6px; font-size: 13px; overflow-wrap: anywhere; }
|
|
376
|
+
.vl-kind-task { color: var(--muted); }
|
|
377
|
+
.vl-kind-paper { color: #0c8599; font-weight: 600; }
|
|
378
|
+
.vl-kind-patent { color: #e8590c; font-weight: 600; }
|
|
379
|
+
.vl-paths { margin: 0 0 6px; padding-left: 20px; font-size: 13px; }
|
|
380
|
+
.vl-paths li { margin: 0 0 8px; overflow-wrap: anywhere; }
|
|
381
|
+
.vl-paths li.vl-first { font-size: 14px; }
|
|
382
|
+
.tag.vl-pick { color: var(--green); font-weight: 600; }
|
|
383
|
+
.vl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 3px 0; }
|
|
384
|
+
.vl-chip { padding: 0 7px; border: 1px solid var(--border); border-radius: 999px; font-size: 12px; white-space: nowrap; }
|
|
385
|
+
.vl-chip.vl-good { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
|
|
386
|
+
.vl-chip.vl-poor { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
|
|
387
|
+
.vl-options .vl-paths { margin-top: 6px; }
|
|
388
|
+
.kept-private { margin: 6px 0 10px; padding: 8px 10px; border: 1px solid #e8590c; border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
|
|
389
|
+
.kept-private p { margin: 4px 0 6px; }
|
|
390
|
+
.kept-private-off { margin: 4px 0; }
|
|
365
391
|
@media (max-width: 1000px) { .insight-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
|
|
392
|
+
@media (max-width: 1000px) { .insight-wide { grid-template-columns: minmax(0, 1fr); } }
|
|
366
393
|
@media (max-width: 560px) { .insight-grid { grid-template-columns: minmax(0, 1fr); } }
|
|
367
394
|
.explain { margin: 0 0 12px; padding: 10px 12px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid var(--accent); }
|
|
368
395
|
.explain .md h3 { font-size: 13px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 8px 0 2px; display: block; }
|
|
@@ -444,7 +471,7 @@ body.term-max .term-agent, .term-wrap:fullscreen .term-agent { display: inline-b
|
|
|
444
471
|
.browser-frames { flex: 1; min-height: 0; position: relative; }
|
|
445
472
|
.browser-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
|
|
446
473
|
/* Swipes scroll the terminal (handled in app.js), not the page. */
|
|
447
|
-
.terminal .xterm { touch-action: none; }
|
|
474
|
+
.terminal .xterm, .gterm .xterm { touch-action: none; }
|
|
448
475
|
.term-overlay {
|
|
449
476
|
position: absolute; inset: 36px 0 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
|
|
450
477
|
gap: 8px; background: rgba(15, 17, 23, .78); color: #e5e8ef;
|
|
@@ -1712,6 +1739,10 @@ table.os-table .num { text-align: right; font-variant-numeric: tabular-nums; whi
|
|
|
1712
1739
|
.quality-chip.clean, .quality-chip.watching { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
|
|
1713
1740
|
.quality-chip.reverted, .quality-chip.fixed, .quality-chip.broke, .quality-chip.problem { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
|
|
1714
1741
|
.quality-chip.unchecked { color: var(--muted); }
|
|
1742
|
+
.rec-head { margin: 16px 0 2px; font-size: 14px; }
|
|
1743
|
+
.rec-table td.num, .rec-table th.num { text-align: right; white-space: nowrap; }
|
|
1744
|
+
.rec-ok { color: var(--green); }
|
|
1745
|
+
.rec-bad { color: var(--red); font-weight: 600; }
|
|
1715
1746
|
.value-legend .sw.rev { background: color-mix(in srgb, var(--green) 70%, transparent); }
|
|
1716
1747
|
table.value-items td.mine { color: var(--accent); font-weight: 600; }
|
|
1717
1748
|
table.value-items tr.excluded td { opacity: 0.5; text-decoration: line-through; }
|
|
@@ -1929,6 +1960,28 @@ table.eval-items tr.eval-na td { color: var(--muted); }
|
|
|
1929
1960
|
.tag.auto-on { border-color: var(--accent, #4c8dff); color: var(--accent, #4c8dff); }
|
|
1930
1961
|
.auto-answer { margin: 4px 0; font-size: 14px; overflow-wrap: anywhere; }
|
|
1931
1962
|
.auto-hold { margin: 8px 0; font-size: 13px; }
|
|
1963
|
+
.auto-perm { margin: 4px 0 8px; }
|
|
1964
|
+
.auto-perm button { margin-left: 4px; }
|
|
1965
|
+
.not-done { margin: 6px 0; padding: 6px 10px; border-left: 3px solid var(--warn, #d9a441); font-size: 13px; overflow-wrap: anywhere; }
|
|
1966
|
+
.not-done ul { margin: 4px 0 0; padding-left: 18px; }
|
|
1967
|
+
.proof-row { margin: 6px 0; font-size: 13px; }
|
|
1968
|
+
.tag.proof-ok { color: var(--green); }
|
|
1969
|
+
.tag.proof-bad { color: var(--red); font-weight: 600; }
|
|
1970
|
+
.proof-list, .breaks-list { list-style: none; margin: 8px 0; padding: 0; }
|
|
1971
|
+
.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; }
|
|
1972
|
+
.proof-title { font-weight: 600; margin-bottom: 4px; }
|
|
1973
|
+
.proof-cmd { display: inline-block; max-width: 100%; white-space: pre-wrap; overflow-wrap: anywhere; }
|
|
1974
|
+
.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; }
|
|
1975
|
+
.proof-out.bad { border: 1px solid var(--danger, #d9534f); }
|
|
1976
|
+
.breaks-head { margin: 18px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); font-size: 15px; }
|
|
1977
|
+
.breaks-cmd { display: block; margin: 8px 0 2px; font-size: 13px; }
|
|
1978
|
+
.breaks-cmd input { display: block; width: 100%; margin-top: 4px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
|
|
1979
|
+
.breaks-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
|
|
1980
|
+
.proof-warn { color: var(--red); font-weight: 600; }
|
|
1981
|
+
.risks, .vl-options { margin: 6px 0; font-size: 13px; }
|
|
1982
|
+
.risks summary, .vl-options summary { cursor: pointer; }
|
|
1983
|
+
.risks ul { list-style: none; margin: 6px 0 0; padding: 0; }
|
|
1984
|
+
.risks li { margin: 0 0 4px; overflow-wrap: anywhere; }
|
|
1932
1985
|
.auto-log { list-style: none; margin: 8px 0; padding: 0; }
|
|
1933
1986
|
.auto-log li { margin: 0 0 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; overflow-wrap: anywhere; }
|
|
1934
1987
|
.auto-dialog select, #settings-autonomy select, #settings-autonomy input, #settings-ground textarea, #new-autonomy { width: 100%; font: inherit; font-size: 16px; }
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
// Value and paths: the part of a design that is a decision. Three things are read from Markdown
|
|
2
|
+
// the same way wherever they are written (the Insights call, or the agent's own brief):
|
|
3
|
+
// Value - what the work is worth now against what it is worth later, and what waiting costs.
|
|
4
|
+
// Kind - whether it is just a task, worth writing up (a white paper), or possibly patentable.
|
|
5
|
+
// Paths - the ways to do it, preferred first, each with its value now and later, cost and risk.
|
|
6
|
+
// Shared by the page and the daemon (brief.js reads an agent's "## Options" with it).
|
|
7
|
+
|
|
8
|
+
const LEVELS = ['high', 'medium', 'low'];
|
|
9
|
+
const COSTS = ['small', 'medium', 'large'];
|
|
10
|
+
export const KINDS = { task: 'Just a task', paper: 'Worth a white paper', patent: 'Possibly patentable' };
|
|
11
|
+
|
|
12
|
+
const level = (s, set = LEVELS) => set.find((l) => new RegExp(`^\\W*${l}\\b`, 'i').test(String(s ?? ''))) ?? null;
|
|
13
|
+
const clean = (s) => String(s ?? '').replace(/\*\*/g, '').trim();
|
|
14
|
+
/** "high - support stops doing this by hand" -> { level: 'high', why: 'support stops…' } */
|
|
15
|
+
const rated = (s, set = LEVELS) => {
|
|
16
|
+
const t = clean(s);
|
|
17
|
+
const l = level(t, set);
|
|
18
|
+
return { level: l, why: (l ? t.replace(new RegExp(`^\\W*${l}\\b`, 'i'), '') : t).replace(/^\s*[-–—:,;.()]+\s*/, '').trim() };
|
|
19
|
+
};
|
|
20
|
+
const field = (md, name) => new RegExp(`^\\s*[-*]\\s+\\**\\s*${name}\\s*\\**\\s*:\\s*\\**\\s*(.+)$`, 'im').exec(String(md ?? ''))?.[1]?.trim() ?? '';
|
|
21
|
+
|
|
22
|
+
/** "### Value": { now, later: { level, why }, waiting, weighs: { side: now|later|both, why } } or null. */
|
|
23
|
+
export function parseValue(md) {
|
|
24
|
+
const now = field(md, 'now');
|
|
25
|
+
const later = field(md, 'later');
|
|
26
|
+
if (!now && !later) return null;
|
|
27
|
+
const w = clean(field(md, 'weighs'));
|
|
28
|
+
const side = /^\W*(now|later|both)\b/i.exec(w)?.[1].toLowerCase() ?? null;
|
|
29
|
+
return { now: rated(now), later: rated(later), waiting: clean(field(md, 'waiting')), weighs: { side, why: (side ? w.replace(/^\W*(now|later|both)\b/i, '') : w).replace(/^\s*[-–—:,;.]+\s*/, '').trim() } };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** "### Kind": { kind: task|paper|patent, new, next } or null. */
|
|
33
|
+
export function parseKind(md) {
|
|
34
|
+
const k = clean(field(md, 'kind')).toLowerCase();
|
|
35
|
+
if (!k) return null;
|
|
36
|
+
const kind = /patent/.test(k) ? 'patent' : /paper|write-?up|publish/.test(k) ? 'paper' : 'task';
|
|
37
|
+
return { kind, new: clean(field(md, 'new')), next: clean(field(md, 'next')) };
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* One path: "1. Name: what it is | now: high | later: low | cost: small | risk: low | when: …"
|
|
42
|
+
* -> { rank, name, what, now, later, cost, risk, when }, or null when the line is not one.
|
|
43
|
+
*/
|
|
44
|
+
export function parsePathLine(line) {
|
|
45
|
+
const m = /^\s*(\d+)[.)]\s+(.+)$/.exec(String(line ?? ''));
|
|
46
|
+
if (!m) return null;
|
|
47
|
+
const [head, ...rest] = m[2].split('|').map((s) => s.trim());
|
|
48
|
+
const [name, ...what] = clean(head).split(/:\s+/);
|
|
49
|
+
const get = (key) => rest.map((r) => new RegExp(`^\\**${key}\\**\\s*:\\s*(.+)$`, 'i').exec(r)?.[1]).find(Boolean) ?? '';
|
|
50
|
+
if (!name) return null;
|
|
51
|
+
return { rank: Number(m[1]), name: name.trim().slice(0, 120), what: what.join(': ').trim().slice(0, 300), now: level(get('now')), later: level(get('later')), cost: level(get('cost'), COSTS), risk: level(get('risk')), when: clean(get('when') || get('pick when')).slice(0, 300) };
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** "### Paths" (or a brief's "## Options"): { paths (by rank), preferred (why the first wins), new }. */
|
|
55
|
+
export function parsePaths(md) {
|
|
56
|
+
const paths = String(md ?? '').split('\n').map(parsePathLine).filter(Boolean).slice(0, 6).sort((a, b) => a.rank - b.rank);
|
|
57
|
+
return { paths, preferred: clean(field(md, 'preferred')).replace(/^\d+\s*[,:]?\s*(because\s+)?/i, '').slice(0, 400), new: clean(field(md, 'new')).slice(0, 300) };
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const WORD = { high: 'High', medium: 'Medium', low: 'Low', small: 'Small', large: 'Large' };
|
|
61
|
+
const meter = (l) => `<span class="vl-meter vl-${l ?? 'none'}" aria-hidden="true"><i></i><i></i><i></i></span>`;
|
|
62
|
+
|
|
63
|
+
export function valueHtml(v, esc) {
|
|
64
|
+
if (!v) return '';
|
|
65
|
+
const row = (label, r) => `<div class="vl-row"><b>${label}</b> ${meter(r.level)} <span class="vl-word">${WORD[r.level] ?? 'Unclear'}</span><div class="hint">${esc(r.why)}</div></div>`;
|
|
66
|
+
const weighs = { now: 'Design for now', later: 'Design for later', both: 'Both count' }[v.weighs.side];
|
|
67
|
+
return `${row('Now', v.now)}${row('Later', v.later)}
|
|
68
|
+
${v.waiting ? `<p class="vl-line"><b>Waiting costs</b> ${esc(v.waiting)}</p>` : ''}
|
|
69
|
+
${weighs || v.weighs.why ? `<p class="vl-line"><b>${weighs ?? 'Weighs'}</b> ${esc(v.weighs.why)}</p>` : ''}`;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function kindHtml(k, esc) {
|
|
73
|
+
if (!k) return '';
|
|
74
|
+
return `<p class="vl-line"><span class="tag vl-kind vl-kind-${k.kind}">${KINDS[k.kind]}</span></p>
|
|
75
|
+
${k.new ? `<p class="vl-line"><b>New</b> ${esc(k.new)}</p>` : ''}
|
|
76
|
+
${k.next ? `<p class="vl-line"><b>Next</b> ${esc(k.next)}</p>` : ''}
|
|
77
|
+
${k.kind === 'patent' ? '<p class="hint">A first read, not legal advice. Publishing before filing can cost the right to a patent: keep it private until you have talked to a patent attorney.</p>' : ''}`;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export function pathsHtml(p, esc) {
|
|
81
|
+
if (!p?.paths.length) return '';
|
|
82
|
+
const chip = (label, l, good) => (l ? `<span class="vl-chip ${good.includes(l) ? 'vl-good' : l === 'medium' ? '' : 'vl-poor'}">${label} ${l}</span>` : '');
|
|
83
|
+
return `<ol class="vl-paths">${p.paths
|
|
84
|
+
.map(
|
|
85
|
+
(x, i) => `<li class="${i === 0 ? 'vl-first' : ''}">
|
|
86
|
+
<div class="vl-name">${i === 0 ? '<span class="tag vl-pick">Preferred</span> ' : ''}<b>${esc(x.name)}</b>${x.what ? ` <span class="hint">${esc(x.what)}</span>` : ''}</div>
|
|
87
|
+
<div class="vl-chips">${chip('now', x.now, ['high'])}${chip('later', x.later, ['high'])}${chip('cost', x.cost, ['small'])}${chip('risk', x.risk, ['low'])}</div>
|
|
88
|
+
${x.when ? `<div class="hint">Pick when: ${esc(x.when)}</div>` : ''}
|
|
89
|
+
</li>`,
|
|
90
|
+
)
|
|
91
|
+
.join('')}</ol>
|
|
92
|
+
${p.preferred ? `<p class="vl-line"><b>Why the first</b> ${esc(p.preferred)}</p>` : ''}`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** In the agent's Results: the ways it weighed before building, preferred first. */
|
|
96
|
+
export function optionsRows(a, esc) {
|
|
97
|
+
const o = a.brief?.options;
|
|
98
|
+
if (!o?.paths?.length && !o?.new) return '';
|
|
99
|
+
return `<details class="vl-options"${o.new ? ' open' : ''}><summary><b>Paths it weighed</b> <span class="hint">${o.paths.length ? `${o.paths.length}, preferred first${o.paths[0] ? `: ${esc(o.paths[0].name)}` : ''}` : ''}</span></summary>
|
|
100
|
+
${pathsHtml(o, esc)}
|
|
101
|
+
${o.new ? `<p class="vl-line"><span class="tag vl-kind vl-kind-paper">Possibly new</span> ${esc(o.new)} <span class="hint">Kept inside the repository; whether it is worth a paper or a patent is yours to decide.</span></p>` : ''}
|
|
102
|
+
</details>`;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** In the agent's Results: that its work is kept private, why, and the way to allow sharing; or the way to keep it private. */
|
|
106
|
+
export function privateRow(a, esc) {
|
|
107
|
+
const k = a.keptPrivate;
|
|
108
|
+
if (k)
|
|
109
|
+
return `<div class="kept-private"><b>🔒 Kept private</b> <span>${esc(k.why)}.</span>
|
|
110
|
+
<p class="hint">The app does not publish or send it: no Google Drive, update, Slack, comment on the pull request or new pull request. Publishing before filing can cost the right to a patent; talk to a patent attorney first.</p>
|
|
111
|
+
<button class="small" data-act="idea-allow" title="You decide it can be shared: the holds are lifted">Allow sharing</button></div>`;
|
|
112
|
+
if (a.idea?.allowed) return `<p class="hint kept-private-off">Sharing allowed by you. <button class="link" data-act="idea-reset">Undo</button></p>`;
|
|
113
|
+
return '';
|
|
114
|
+
}
|