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/src/autonomy.js
CHANGED
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
import crypto from 'node:crypto';
|
|
22
22
|
import fs from 'node:fs';
|
|
23
23
|
import { parseJsonReply, specPath } from './brief.js';
|
|
24
|
+
import { FREE_CHOICE } from './inbox.js';
|
|
25
|
+
import { keptPrivate } from './private.js';
|
|
24
26
|
import { memoryKey, memoryText } from './memory.js';
|
|
25
27
|
import { landState } from './tracker.js';
|
|
26
28
|
|
|
@@ -73,6 +75,8 @@ export function autonomySettings(config = {}) {
|
|
|
73
75
|
const d = AUTONOMY_DEFAULTS;
|
|
74
76
|
return {
|
|
75
77
|
level: parseLevel(c.level) ?? d.level,
|
|
78
|
+
// A level for the new agents of one project, by its name; the others get `level`.
|
|
79
|
+
projects: Object.fromEntries(Object.entries(c.projects ?? {}).map(([k, v]) => [k, parseLevel(v)]).filter(([k, v]) => k && v)),
|
|
76
80
|
models: models.length ? models : d.models,
|
|
77
81
|
answers: c.answers !== false,
|
|
78
82
|
nudges: c.nudges !== false,
|
|
@@ -147,6 +151,21 @@ export function sensitive(text) {
|
|
|
147
151
|
return SENSITIVE.find(([re]) => re.test(t))?.[1] ?? null;
|
|
148
152
|
}
|
|
149
153
|
|
|
154
|
+
const PERMISSION_ASK = /\bdo you want to (?:proceed|allow|make this edit|create|run|overwrite)\b|\b(?:allow|grant|approve)\b.{0,60}\b(?:access|permission|command|tool|edit|read|write)|\bpermission (?:prompt|request|to)\b|\bwaiting for (?:approval|permission)\b|\btrust (?:the files in )?this folder\b/i;
|
|
155
|
+
const PERMISSION_CHOICE = /don'?t ask again|switch to auto mode|\ballow (?:reading|writing|all edits|this|it)\b|\balways allow\b|\bfor this (?:session|project)\b/i;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Whether what the screen judge read as a question is the engine's own permission prompt (run this
|
|
159
|
+
* command? allow this read?). Those are never answered for the person, and no model is asked: a
|
|
160
|
+
* numbered Yes/No menu counts, so does the wording of the prompt or of what the judge saw.
|
|
161
|
+
*/
|
|
162
|
+
export function permissionPrompt({ question, options = [], summary } = {}) {
|
|
163
|
+
const opts = options.map((o) => String(o).replace(/^\s*\d+[.)]\s*/, ''));
|
|
164
|
+
if (opts.some((o) => /^yes\b/i.test(o)) && opts.some((o) => /^no\b/i.test(o))) return true;
|
|
165
|
+
if (opts.some((o) => PERMISSION_CHOICE.test(o))) return true;
|
|
166
|
+
return PERMISSION_ASK.test(`${question ?? ''}\n${summary ?? ''}`);
|
|
167
|
+
}
|
|
168
|
+
|
|
150
169
|
const block = (tag, body) => (String(body ?? '').trim() ? [`<${tag}>`, String(body).trim(), `</${tag}>`] : []);
|
|
151
170
|
|
|
152
171
|
/**
|
|
@@ -161,14 +180,16 @@ export function answerPrompt(ctx) {
|
|
|
161
180
|
'- the answer is already decided by what the person wrote or agreed: the request, the agreed points for what done means, their ground rules, the lessons of the repository, or an earlier answer of theirs;',
|
|
162
181
|
'- it is a routine implementation detail the request leaves to the implementer and that is cheap to change later (a name, where a file goes, which existing helper to use, a default the agent itself proposes).',
|
|
163
182
|
'Leave it for the person ("ask": true) when it changes what is built or how much; when it trades off cost, security, privacy, data or compatibility;',
|
|
164
|
-
'when it would delete, overwrite, publish, deploy, merge, spend money, touch credentials or reach outside the repository; when the
|
|
183
|
+
'when it would delete, overwrite, publish, deploy, merge, spend money, touch credentials or reach outside the repository; when the request itself says to ask the person about this choice;',
|
|
184
|
+
'when the sources disagree or do not cover it; or when you are not sure.',
|
|
165
185
|
'Never invent a preference the person has not shown. When nothing decides it and the choice is cheap to change, the agent\'s own stated default is the answer.',
|
|
166
186
|
'Reply with one JSON object only, no prose around it. confidence is a number from 0 to 1.',
|
|
167
187
|
'Shape: {"ask": true|false, "answer": "what to tell the agent, one to three sentences, or empty", "basis": "the source that decides it, quoted briefly, or: routine detail, cheap to change", "confidence": 0.0}',
|
|
168
188
|
'',
|
|
169
189
|
'<question>',
|
|
170
190
|
ctx.question,
|
|
171
|
-
ctx.options?.length ? `Options: ${ctx.options.join(' | ')}` : '',
|
|
191
|
+
ctx.menu?.length ? `The agent shows a menu and takes one of these, by its number:\n${ctx.menu.map((c) => `${c.key}. ${c.label}${c.hint ? ` (${c.hint})` : ''}`).join('\n')}` : ctx.options?.length ? `Options: ${ctx.options.join(' | ')}` : '',
|
|
192
|
+
ctx.menu?.length ? 'When you answer, add "option": the number of the one to pick, and give its label as the answer. If none of them is right, leave it for the person.' : '',
|
|
172
193
|
ctx.default ? `The agent's default until answered: ${ctx.default}` : '',
|
|
173
194
|
ctx.context ? `Context from the agent: ${ctx.context}` : '',
|
|
174
195
|
'</question>',
|
|
@@ -197,7 +218,8 @@ export function parseAnswer(text) {
|
|
|
197
218
|
}
|
|
198
219
|
if (!d || typeof d !== 'object' || typeof d.ask !== 'boolean') return null;
|
|
199
220
|
const answer = clip(d.answer, 600);
|
|
200
|
-
|
|
221
|
+
const option = /^\d$/.test(String(d.option ?? '')) ? String(d.option) : null;
|
|
222
|
+
return { ask: d.ask || !answer, answer, option, basis: clip(d.basis, 300), confidence: Math.max(0, Math.min(1, Number(d.confidence) || 0)) };
|
|
201
223
|
}
|
|
202
224
|
|
|
203
225
|
/** What the agent is told: the answer, and that it was given for the person, not by them. */
|
|
@@ -227,6 +249,28 @@ export function logLine(log = []) {
|
|
|
227
249
|
}
|
|
228
250
|
|
|
229
251
|
/** An agent this can work for: a task with changes of its own, not a team member, reviewer, hunter or builder. */
|
|
252
|
+
/**
|
|
253
|
+
* The agent's own question shown as a menu (not a permission prompt, not one that takes several
|
|
254
|
+
* ticks): { key, question, options, menu: [{ key, label, hint }] }, or null.
|
|
255
|
+
*/
|
|
256
|
+
export function menuOf(view) {
|
|
257
|
+
const p = view?.runtime?.attention === 'Question' ? view.runtime.prompt : null;
|
|
258
|
+
const menu = (p?.choices ?? []).filter((c) => !FREE_CHOICE.test(c.label));
|
|
259
|
+
if (!p?.question || menu.length < 2 || p.multi) return null;
|
|
260
|
+
return { key: `m:${hash(`${p.question}\n${menu.map((c) => c.label).join('\n')}`)}`, question: p.question, options: menu.map((c) => c.label), menu };
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
/** Why a merge is the person's: the agent says it left something out, or its proof did not hold when run again. */
|
|
264
|
+
export function leftOut(agent, view) {
|
|
265
|
+
const kept = keptPrivate(agent);
|
|
266
|
+
if (kept) return `It is kept private: ${kept.why}.`;
|
|
267
|
+
const nd = view?.results?.notDone ?? [];
|
|
268
|
+
if (nd.length) return `The agent lists as not done: ${clip(nd.join('; '), 240)}.`;
|
|
269
|
+
const rerun = agent.proof && agent.proof.proofAt === (agent.proofDoc?.updatedAt ?? null) ? agent.proof.results.filter((r) => r.status === 'differs') : [];
|
|
270
|
+
if (rerun.length) return `${rerun.length} of its recorded commands gave a different result when run again: ${clip(rerun.map((r) => r.title).join('; '), 200)}.`;
|
|
271
|
+
return null;
|
|
272
|
+
}
|
|
273
|
+
|
|
230
274
|
export const eligible = (agent) => agent?.kind === 'task' && !agent.team && !agent.builds && !agent.reviewing && !agent.hunting && !agent.fixing && !agent.raceId;
|
|
231
275
|
|
|
232
276
|
export class Autonomy {
|
|
@@ -324,9 +368,15 @@ export class Autonomy {
|
|
|
324
368
|
change(b = {}) {
|
|
325
369
|
const next = { ...this.config.autonomy };
|
|
326
370
|
if ('level' in b) {
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
371
|
+
// "default" with a project: back to the level every other project gets.
|
|
372
|
+
const level = b.project && /^default$/i.test(String(b.level).trim()) ? null : parseLevel(b.level);
|
|
373
|
+
if (!level && !(b.project && /^default$/i.test(String(b.level).trim()))) throw err(400, `level is one of ${LEVELS.join(', ')}`);
|
|
374
|
+
const project = String(b.project ?? '').trim();
|
|
375
|
+
if (project) {
|
|
376
|
+
next.projects = { ...next.projects };
|
|
377
|
+
if (level) next.projects[project] = level;
|
|
378
|
+
else delete next.projects[project];
|
|
379
|
+
} else next.level = level;
|
|
330
380
|
}
|
|
331
381
|
if ('models' in b) {
|
|
332
382
|
const models = cleanModels(b.models);
|
|
@@ -366,15 +416,23 @@ export class Autonomy {
|
|
|
366
416
|
const v = this.manager.view(agent);
|
|
367
417
|
const st = this.state(agent);
|
|
368
418
|
const count = (k) => st.log.filter((e) => e.kind === k).length;
|
|
419
|
+
// While what done means or the plan waits for the person, the agent is asking for exactly that:
|
|
420
|
+
// nothing is answered or nudged for them.
|
|
421
|
+
const theirs = this.manager.acceptanceWaits(agent) || Boolean(agent.planReview && agent.planReview.status !== 'approved');
|
|
369
422
|
|
|
370
|
-
if (s.answers) {
|
|
423
|
+
if (s.answers && !theirs) {
|
|
371
424
|
// Questions in QUESTIONS.md and plans are Decide's (advisor.js); the one it stopped on in its terminal is ours.
|
|
372
425
|
const w = v.runtime?.waiting;
|
|
373
426
|
const asked = w?.state === 'question' ? w.question || w.summary : null;
|
|
374
|
-
|
|
427
|
+
// A permission prompt the app itself sees is in the inbox already, as a prompt.
|
|
428
|
+
const prompted = v.runtime?.prompt || v.runtime?.attention;
|
|
429
|
+
if (asked && !prompted && !st.seen[`w:${hash(asked)}`]) return this.answer(agent, { key: `w:${hash(asked)}`, question: asked, options: w.choices ?? [], summary: w.summary });
|
|
430
|
+
// Its question as a menu: one option is picked by its key (a typed message would not be read).
|
|
431
|
+
const menu = menuOf(v);
|
|
432
|
+
if (menu && !st.seen[menu.key]) return this.answer(agent, menu);
|
|
375
433
|
}
|
|
376
434
|
|
|
377
|
-
if (s.nudges) {
|
|
435
|
+
if (s.nudges && !theirs) {
|
|
378
436
|
for (const f of v.stuck ?? []) {
|
|
379
437
|
const key = `s:${f.key}:${f.since}`;
|
|
380
438
|
if (st.seen[key] || f.ai?.verdict !== 'stuck' || !(f.ai.confidence >= s.minConfidence) || !f.nudge) continue;
|
|
@@ -393,7 +451,7 @@ export class Autonomy {
|
|
|
393
451
|
|
|
394
452
|
const fu = v.followUp;
|
|
395
453
|
if (s.followUps && fu?.kind === 'followup' && !st.seen[`f:${fu.since}`]) {
|
|
396
|
-
const waitsOnPerson =
|
|
454
|
+
const waitsOnPerson = theirs || v.results?.outcome === 'blocked';
|
|
397
455
|
if (!waitsOnPerson) {
|
|
398
456
|
this.put(id, (x) => (x.seen[`f:${fu.since}`] = now()));
|
|
399
457
|
if (count('followup') < s.maxFollowUps) {
|
|
@@ -451,6 +509,7 @@ export class Autonomy {
|
|
|
451
509
|
this.put(id, (x) => (x.seen[q.key] = now()));
|
|
452
510
|
this.record(id, { kind: 'left', key: q.key, question: clip(q.question, 300), why });
|
|
453
511
|
};
|
|
512
|
+
if (permissionPrompt(q)) return left('It is a permission prompt: only you answer those.');
|
|
454
513
|
const touchy = sensitive([q.question, ...(q.options ?? []), q.default, q.context].filter(Boolean).join('\n'));
|
|
455
514
|
if (touchy) return left(`It is about ${touchy}: yours to answer.`);
|
|
456
515
|
if (st.log.filter((e) => e.kind === 'answer').length >= s.maxAnswers) return left(`${s.maxAnswers} questions were already answered for you on this agent.`);
|
|
@@ -481,6 +540,16 @@ export class Autonomy {
|
|
|
481
540
|
if (q.qid) {
|
|
482
541
|
if (cur.answers?.[q.qid]) return;
|
|
483
542
|
this.manager.patch(id, { answers: { ...cur.answers, [q.qid]: { text: d.answer, at: now(), by: 'autonomy', model: r.by, basis: d.basis } } });
|
|
543
|
+
} else if (q.menu) {
|
|
544
|
+
const c = q.menu.find((x) => x.key === d.option);
|
|
545
|
+
if (!c || menuOf(this.manager.view(cur))?.key !== q.key) {
|
|
546
|
+
if (!c) this.record(id, { kind: 'left', key: q.key, question: clip(q.question, 300), why: 'The reply did not pick one of the choices.' });
|
|
547
|
+
return; // or the menu was answered, or changed, meanwhile
|
|
548
|
+
}
|
|
549
|
+
const e = this.record(id, { kind: 'answer', key: q.key, qid: null, question: clip(q.question, 300), answer: c.label, basis: d.basis, confidence: d.confidence, model: r.by, ack: false });
|
|
550
|
+
this.manager.answerPrompt(id, c.key);
|
|
551
|
+
this.log(`autonomy: picked "${c.label}" for ${agent.name} (${r.by}): ${clip(q.question, 80)}`);
|
|
552
|
+
return e;
|
|
484
553
|
} else {
|
|
485
554
|
const rt = this.manager.runtimes.get(id);
|
|
486
555
|
const w = rt?.waiting;
|
|
@@ -581,6 +650,8 @@ export class Autonomy {
|
|
|
581
650
|
if (this.manager.acceptanceWaits(agent)) return this.hold(id, key, 'What done means is not agreed yet.');
|
|
582
651
|
const own = v.results?.confidence;
|
|
583
652
|
if (own && own.percent < s.minBuildConfidence) return this.hold(id, key, `The agent's own confidence in this is ${own.percent}%${own.why ? `: ${own.why}` : ''}.`);
|
|
653
|
+
const left = leftOut(agent, v);
|
|
654
|
+
if (left) return this.hold(id, key, left);
|
|
584
655
|
const changes = this.review ? await this.review.get(id) : null;
|
|
585
656
|
const risk = changes ? this.manager.standards?.riskIn(agent, changes.files ?? []) ?? [] : [];
|
|
586
657
|
if (risk.length) return this.hold(id, key, `It changes high-risk paths (${risk.slice(0, 3).map((r) => r.path).join(', ')}${risk.length > 3 ? ` and ${risk.length - 3} more` : ''}): yours to merge.`);
|
package/src/autopilot.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
// and stops early once a round no longer raises the score. Anything else ("look at these first"
|
|
11
11
|
// without a target, a failed step, a closed pull request) waits for you in the inbox, with Ship it to
|
|
12
12
|
// go ahead anyway. An item whose pull request merges is done.
|
|
13
|
-
import { autonomySettings } from './autonomy.js';
|
|
13
|
+
import { autonomySettings, leftOut } from './autonomy.js';
|
|
14
14
|
import { landState } from './tracker.js';
|
|
15
15
|
|
|
16
16
|
export const AUTOPILOT_LEVELS = ['off', 'pr', 'merge'];
|
|
@@ -173,6 +173,8 @@ export class Autopilot {
|
|
|
173
173
|
const own = this.manager.view(agent).results?.confidence;
|
|
174
174
|
const min = autonomySettings(this.config).minBuildConfidence;
|
|
175
175
|
if (own && own.percent < min) return this.hold(it, `The agent's own confidence in this is ${own.percent}%${own.why ? `: ${own.why}` : ''}. Its pull request is open; merging it is yours.`);
|
|
176
|
+
const left = leftOut(agent, this.manager.view(agent));
|
|
177
|
+
if (left) return this.hold(it, `${left} Its pull request is open; merging it is yours.`);
|
|
176
178
|
this.note(it, { state: 'merging' });
|
|
177
179
|
await this.landing.merge(agent.id, { url: pr.url });
|
|
178
180
|
this.log(`autopilot: merged ${pr.url}`);
|
package/src/brief.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// The agent's living brief: Problem, Solution, Diagram and Checks, written by
|
|
2
2
|
// Claude to a Markdown file outside the repository and shown in the UI.
|
|
3
|
+
import { parsePaths } from '../public/valuelens.js';
|
|
3
4
|
import fs from 'node:fs';
|
|
4
5
|
import path from 'node:path';
|
|
5
6
|
import { paths } from './config.js';
|
|
@@ -48,6 +49,8 @@ const SECTION_ALIASES = {
|
|
|
48
49
|
checks: ['checks', 'verification', 'tests', 'testing', 'validation'],
|
|
49
50
|
references: ['references', 'links', 'documents', 'docs', 'specs', 'prd / tech spec', 'prd/tech spec'],
|
|
50
51
|
results: ['results', 'result', 'outcome', 'status and results', 'results and status'],
|
|
52
|
+
risks: ['risks', 'what could go wrong', 'pre-mortem', 'premortem', 'risks named before starting'],
|
|
53
|
+
options: ['options', 'paths', 'alternatives', 'options considered', 'options weighed'],
|
|
51
54
|
};
|
|
52
55
|
|
|
53
56
|
// "- **PRD**: [Title](https://...) — highlight", tolerating ":" / "-" / "–" separators and bare URLs.
|
|
@@ -74,6 +77,36 @@ function sectionKey(heading) {
|
|
|
74
77
|
}
|
|
75
78
|
|
|
76
79
|
const CHECK_STATES = { ' ': 'pending', '~': 'running', x: 'passed', X: 'passed', '!': 'failed' };
|
|
80
|
+
const RISK_STATES = { ' ': 'open', '~': 'open', x: 'avoided', X: 'avoided', '!': 'happened' };
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* The pre-mortem: before it changes anything the agent names how the task could go wrong, and at
|
|
84
|
+
* the end says for each whether it did. The list tells a reviewer where to look.
|
|
85
|
+
*/
|
|
86
|
+
export const RISKS_PROMPT =
|
|
87
|
+
'Before you change anything, add a section "## Risks" to the brief: the 3 to 5 most likely ways this task could go wrong or be done ' +
|
|
88
|
+
'wrongly, each on one line as "- [ ] <the risk>". Be specific to this task (a part of the request that can be read two ways, an input ' +
|
|
89
|
+
'that breaks it, something else that depends on what you change, a step that is easy to skip), not general ("bugs", "bad tests"). ' +
|
|
90
|
+
'Do not remove or reword a risk later. When you finish, mark each one: "- [x] <the risk>: avoided, <how you know: the test or command>", ' +
|
|
91
|
+
'"- [!] <the risk>: happened, <what, and what you did about it>", or leave "- [ ]" when you did not check it.';
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Value and paths: a design is a decision when there is more than one way. The agent lists the
|
|
95
|
+
* ways, preferred first, with what each is worth now and later; and says when something looks new.
|
|
96
|
+
*/
|
|
97
|
+
export const OPTIONS_PROMPT =
|
|
98
|
+
'When there is more than one reasonable way to solve this, add a section "## Options" to the brief before you build: 2 to 4 ways, ' +
|
|
99
|
+
'preferred first, one line each as\n' +
|
|
100
|
+
'"1. <name>: <what it is> | now: high/medium/low | later: high/medium/low | cost: small/medium/large | risk: low/medium/high | when: <when this one is the right pick>"\n' +
|
|
101
|
+
'"now" is what the user gains as soon as it ships; "later" is what it makes possible, saves or avoids over time, counted lower the less sure it is. ' +
|
|
102
|
+
'Then one line "- Preferred: <why the first wins>". How to rank: the most value for its cost first; between close ones, the one that is easier ' +
|
|
103
|
+
'to undo; a way worth more later than now comes first only when waiting costs little or the cheaper way would close that door. ' +
|
|
104
|
+
'Build the first unless the user says otherwise. When there is only one reasonable way, leave the section out: most work is just a task. ' +
|
|
105
|
+
'If part of your design seems new beyond common practice, add a line "- New: <what is new>" there and do not publish it outside this ' +
|
|
106
|
+
'repository: no public gist, post or package, no pull request, and write the design doc as a file without publishing it. Whether it is worth a paper or a patent is for the user to decide.';
|
|
107
|
+
|
|
108
|
+
/** Counts of a brief's risks: { total, avoided, happened, open }. */
|
|
109
|
+
export const riskCounts = (risks = []) => ({ total: risks.length, avoided: risks.filter((r) => r.state === 'avoided').length, happened: risks.filter((r) => r.state === 'happened').length, open: risks.filter((r) => r.state === 'open').length });
|
|
77
110
|
|
|
78
111
|
/** Parse the brief Markdown into its four sections. Unknown sections are ignored. */
|
|
79
112
|
const CONFIDENCE_LINE = /^\s*(?:[-*]\s+)?\**\s*confidence\s*\**\s*:\s*\**\s*(\d{1,3})\s*%?\s*\**\s*(?:[-–—:,;.]\s*)?(.*)$/i;
|
|
@@ -90,7 +123,7 @@ export function parseConfidence(body) {
|
|
|
90
123
|
}
|
|
91
124
|
|
|
92
125
|
export function parseBrief(markdown) {
|
|
93
|
-
const out = { status: null, problem: '', solution: '', diagram: null, diagramNotes: '', checks: [], references: [], results: null };
|
|
126
|
+
const out = { status: null, problem: '', solution: '', diagram: null, diagramNotes: '', checks: [], references: [], results: null, risks: [], options: null };
|
|
94
127
|
const st = markdown.split(/^##\s/m)[0].match(/^\s*\**status\**\s*:\s*\**\s*(planning|working|blocked|done)\b/im);
|
|
95
128
|
if (st) out.status = st[1].toLowerCase();
|
|
96
129
|
const parts = markdown.split(/^##\s+(.+?)\s*#*\s*$/m);
|
|
@@ -112,10 +145,13 @@ export function parseBrief(markdown) {
|
|
|
112
145
|
delivered: pick(/^\s*[-*]\s+\**\s*delivered\s*\**\s*:\s*\**\s*(.+)$/i),
|
|
113
146
|
blockers: pick(/^\s*[-*]\s+\**\s*blocked by\s*\**\s*:\s*\**\s*(.+)$/i),
|
|
114
147
|
filed: pick(/^\s*[-*]\s+\**\s*filed\s*\**\s*:\s*\**\s*(.+)$/i),
|
|
148
|
+
// "- Not done: ..." (proof.js): what the request asked that the agent says it left out. "nothing" is none.
|
|
149
|
+
notDone: pick(/^\s*[-*]\s+\**\s*not done\s*\**\s*:\s*\**\s*(.+)$/i).filter((t) => !/^(nothing|none|n\/a|-)\b\.?\**$/i.test(t)),
|
|
150
|
+
notDoneSaid: lines.some((l) => /^\s*[-*]\s+\**\s*not done\s*\**\s*:/i.test(l)),
|
|
115
151
|
// "Confidence: 85% - why": the agent's own, in what it built (null until it says).
|
|
116
152
|
confidence: parseConfidence(body),
|
|
117
153
|
notes: lines
|
|
118
|
-
.filter((l) => !/^\s*\**\s*outcome\s*\**\s*:/i.test(l) && !CONFIDENCE_LINE.test(l) && !/^\s*[-*]\s+\**\s*(delivered|blocked by|filed)\s*\**\s*:/i.test(l))
|
|
154
|
+
.filter((l) => !/^\s*\**\s*outcome\s*\**\s*:/i.test(l) && !CONFIDENCE_LINE.test(l) && !/^\s*[-*]\s+\**\s*(delivered|blocked by|filed|not done)\s*\**\s*:/i.test(l))
|
|
119
155
|
.join('\n')
|
|
120
156
|
.trim(),
|
|
121
157
|
};
|
|
@@ -124,6 +160,16 @@ export function parseBrief(markdown) {
|
|
|
124
160
|
const ref = parseReference(line);
|
|
125
161
|
if (ref) out.references.push(ref);
|
|
126
162
|
}
|
|
163
|
+
} else if (key === 'options') {
|
|
164
|
+
// The ways it weighed (OPTIONS_PROMPT): preferred first, each with its value now and later, cost and risk.
|
|
165
|
+
const o = parsePaths(body);
|
|
166
|
+
out.options = o.paths.length || o.new ? o : null;
|
|
167
|
+
} else if (key === 'risks') {
|
|
168
|
+
// The pre-mortem (RISKS_PROMPT): "- [ ] risk" as named before starting; "[x]" avoided, "[!]" happened.
|
|
169
|
+
for (const line of body.split('\n')) {
|
|
170
|
+
const m = line.match(/^\s*[-*]\s+\[([ xX!~])\]\s+(.+?)\s*$/);
|
|
171
|
+
if (m && out.risks.length < 12) out.risks.push({ state: RISK_STATES[m[1]], text: m[2].slice(0, 400) });
|
|
172
|
+
}
|
|
127
173
|
} else if (key === 'checks') {
|
|
128
174
|
for (const line of body.split('\n')) {
|
|
129
175
|
const m = line.match(/^\s*[-*]\s+\[([ xX!~])\]\s+(.+?)\s*$/);
|
|
@@ -237,8 +283,8 @@ export function explainPrompt({ intent, status, digest, repo, briefMarkdown }) {
|
|
|
237
283
|
/** Prompt for "Insights": Why / What / How / Now, three tidy points each. */
|
|
238
284
|
export function insightsPrompt({ intent, status, digest, repo, briefMarkdown }) {
|
|
239
285
|
return [
|
|
240
|
-
"Give a human the
|
|
241
|
-
'context below. Write Markdown with exactly these
|
|
286
|
+
"Give a human the insights that matter about an AI coding agent's work, from its ask and live",
|
|
287
|
+
'context below. Write Markdown with exactly these seven sections, in this order:',
|
|
242
288
|
'### Why',
|
|
243
289
|
'Why this work matters: the motivation, the user or business need, or the root cause of the problem.',
|
|
244
290
|
'### What',
|
|
@@ -247,12 +293,33 @@ export function insightsPrompt({ intent, status, digest, repo, briefMarkdown })
|
|
|
247
293
|
'How it is being done: the approach, the key mechanism or the main changes.',
|
|
248
294
|
'### Now',
|
|
249
295
|
'Where it stands now and the next step, including anything waiting on the user.',
|
|
296
|
+
'### Value',
|
|
297
|
+
'What the work is worth now against later. Exactly these four bullets:',
|
|
298
|
+
'- Now: high, medium or low - who gains what as soon as it ships',
|
|
299
|
+
'- Later: high, medium or low - what it makes possible, saves or avoids over time; lower the less sure it is',
|
|
300
|
+
'- Waiting: what is lost each week it is not done, or "little"',
|
|
301
|
+
'- Weighs: now, later or both - which of the two should drive the design, and why',
|
|
302
|
+
'### Kind',
|
|
303
|
+
'What kind of idea this is. Exactly these three bullets:',
|
|
304
|
+
'- Kind: task, white paper or patentable idea. "task" for ordinary work done in a known way (most work). "white paper" when the approach or',
|
|
305
|
+
' the result would teach others something and is worth writing up. "patentable idea" only when there is a specific technical mechanism',
|
|
306
|
+
' that seems new, not an obvious step for someone skilled in the field, and useful; an idea, a goal or a business rule alone is not.',
|
|
307
|
+
'- New: what, concretely, is new beyond common practice, or "nothing new"',
|
|
308
|
+
'- Next: what to do about it: build it; write it up (and for whom); or keep it unpublished and talk to a patent attorney before sharing',
|
|
309
|
+
'### Paths',
|
|
310
|
+
'The 2 to 4 real ways to go from here, preferred first, one numbered line each, exactly in this form:',
|
|
311
|
+
'1. <name>: <what it is> | now: high/medium/low | later: high/medium/low | cost: small/medium/large | risk: low/medium/high | when: <when this is the right pick>',
|
|
312
|
+
'Then one bullet "- Preferred: <why the first wins>". Rank by the most value for the cost; between close ones, the one easier to undo;',
|
|
313
|
+
'a way worth more later than now comes first only when waiting costs little or the cheaper way would close that door.',
|
|
314
|
+
'Include the way the agent is taking. If there is truly one way, give it alone and say so in Preferred.',
|
|
250
315
|
'',
|
|
251
316
|
'Style rules, strictly:',
|
|
252
|
-
'-
|
|
253
|
-
'-
|
|
317
|
+
'- Why, What, How and Now have 1 to 3 bullets each, never more. Fewer is better when it is enough.',
|
|
318
|
+
'- In those four, each bullet is one short, concrete line of at most 12 words: easy to remember and repeat.',
|
|
319
|
+
'- In Value, Kind and Paths, keep each line under 25 words and keep the labels exactly as given.',
|
|
254
320
|
'- Lead with the key word; no filler, no hedging, no nested bullets, no preamble or closing text.',
|
|
255
321
|
'- Use only the context. If something is not known yet, write "Unclear yet" as the bullet.',
|
|
322
|
+
'- Kind is a first read, not legal advice, and you have not searched for prior art: when unsure between two kinds, give the lower one.',
|
|
256
323
|
'',
|
|
257
324
|
'<agent_status>',
|
|
258
325
|
status,
|
package/src/cli.js
CHANGED
|
@@ -388,6 +388,9 @@ export async function main(argv) {
|
|
|
388
388
|
});
|
|
389
389
|
for (const a of created) console.log(`${green('+')} ${bold(a.name)} ${dim(a.id)} session ${cyan(a.sessionId)}`);
|
|
390
390
|
console.log(dim(`Workspace setup and launch continue in the background. "agentmgr ls" shows status.`));
|
|
391
|
+
if (created.some((a) => a.autonomy && !['auto', 'bypassPermissions'].includes(a.permissionMode ?? ''))) {
|
|
392
|
+
console.log(dim('Without you: it still stops at each permission prompt, which is never answered for you ("agentmgr inbox"). With -p auto, Claude Code approves what it judges safe.'));
|
|
393
|
+
}
|
|
391
394
|
if (opts.attach && created.length === 1) {
|
|
392
395
|
let a = created[0];
|
|
393
396
|
for (let i = 0; i < 600 && a.status === 'preparing' && !a.runtime.running; i++) {
|
|
@@ -582,6 +585,77 @@ export async function main(argv) {
|
|
|
582
585
|
if (d.data.verdict === 'wrong') process.exitCode = 1;
|
|
583
586
|
});
|
|
584
587
|
|
|
588
|
+
program
|
|
589
|
+
.command('proof')
|
|
590
|
+
.description('What an agent ran to verify its work: each check with its command, exit code and output, as the agent recorded them, and what it says it did not do. --run runs the commands again here and says which gave the same result (exit 1 when one differs).')
|
|
591
|
+
.argument('<agent>')
|
|
592
|
+
.option('--run', 'run the recorded commands again in the agent\'s folder (ones that change things are not run)')
|
|
593
|
+
.option('--json', 'print it as JSON')
|
|
594
|
+
.action(async (ref, opts) => {
|
|
595
|
+
await daemon();
|
|
596
|
+
const a = await resolveAgent(ref);
|
|
597
|
+
let v = await api('GET', `/agents/${a.id}/proof`);
|
|
598
|
+
if (opts.run) {
|
|
599
|
+
const n = v.entries.filter((e) => e.runnable).length;
|
|
600
|
+
process.stderr.write(dim(`Running ${n} command${n === 1 ? '' : 's'} again in ${a.workdir ?? 'its folder'}…\n`));
|
|
601
|
+
v = await api('POST', `/agents/${a.id}/proof/run`);
|
|
602
|
+
}
|
|
603
|
+
if (opts.json) console.log(JSON.stringify(v, null, 2));
|
|
604
|
+
else {
|
|
605
|
+
console.log((await api('GET', `/agents/${a.id}/proof?format=md`)).markdown);
|
|
606
|
+
if (v.notDone.length) console.log(`${bold('Not done, as the agent says:')}\n${v.notDone.map((t) => `- ${t}`).join('\n')}\n`);
|
|
607
|
+
if (v.rerun && !v.rerun.stale) console.log(`Run again ${v.rerun.at}: ${green(`${v.rerun.same} same`)}${v.rerun.differs ? `, ${red(`${v.rerun.differs} different`)}` : ''}${v.rerun.skipped ? dim(`, ${v.rerun.skipped} not run`) : ''}`);
|
|
608
|
+
else if (v.counts.commands) console.log(dim(`Run them again: agentmgr proof ${a.id} --run${v.rerun?.stale ? ' (the last run was before the agent changed its proof)' : ''}`));
|
|
609
|
+
}
|
|
610
|
+
if (v.rerun && !v.rerun.stale && v.rerun.differs) process.exitCode = 1;
|
|
611
|
+
});
|
|
612
|
+
|
|
613
|
+
program
|
|
614
|
+
.command('test-tests')
|
|
615
|
+
.description("Test an agent's tests: break the lines it changed one at a time (=== becomes !==, && becomes ||, a number goes up by one), run the tests on each, and put the line back. A break the tests still pass on is a line nothing checks. Without --run it shows the last run (exit 1 when a break went unnoticed).")
|
|
616
|
+
.argument('<agent>')
|
|
617
|
+
.option('--run', "break the changed lines and run the tests now, in the agent's folder")
|
|
618
|
+
.option('-c, --command <command>', 'the command that runs the tests (default: the passing commands the agent recorded in its proof)')
|
|
619
|
+
.option('--max <n>', 'how many lines to break (default 8)')
|
|
620
|
+
.option('--send', 'tell the agent which breaks its tests did not notice')
|
|
621
|
+
.option('--json', 'print it as JSON')
|
|
622
|
+
.action(async (ref, opts) => {
|
|
623
|
+
await daemon();
|
|
624
|
+
const a = await resolveAgent(ref);
|
|
625
|
+
let v = await api('GET', `/agents/${a.id}/breaks`);
|
|
626
|
+
if (opts.run) {
|
|
627
|
+
const cmds = opts.command ? [opts.command] : v.commands;
|
|
628
|
+
if (cmds.length) process.stderr.write(dim(`Breaking up to ${opts.max ?? v.max} changed lines in ${a.workdir ?? 'its folder'}, one at a time, and running: ${cmds.join(' && ')}\nEach line is put back after its run…\n`));
|
|
629
|
+
v = await api('POST', `/agents/${a.id}/breaks/run`, { command: opts.command, max: opts.max ? Number(opts.max) : undefined });
|
|
630
|
+
}
|
|
631
|
+
if (opts.send) v = await api('POST', `/agents/${a.id}/breaks/send`);
|
|
632
|
+
if (opts.json) console.log(JSON.stringify(v, null, 2));
|
|
633
|
+
else {
|
|
634
|
+
console.log((await api('GET', `/agents/${a.id}/breaks?format=md`)).markdown);
|
|
635
|
+
if (!v.last) console.log(dim(v.commands.length ? `\nRun it: agentmgr test-tests ${a.id} --run (tests: ${v.commands.join(' && ')})` : `\nThe agent recorded no passing test command. Run it with yours: agentmgr test-tests ${a.id} --run -c "npm test"`));
|
|
636
|
+
else if (opts.send) console.log(green('\nSent to the agent.'));
|
|
637
|
+
else if (v.last.missed && !v.last.stale) console.log(dim(`\nTell the agent: agentmgr test-tests ${a.id} --send`));
|
|
638
|
+
}
|
|
639
|
+
if (v.last && !v.last.stale && (v.last.missed || !v.last.baseline.ok)) process.exitCode = 1;
|
|
640
|
+
});
|
|
641
|
+
|
|
642
|
+
program
|
|
643
|
+
.command('private')
|
|
644
|
+
.description("Keep an agent's work private, or allow sharing it. Work that may be patentable (the agent says part of its design is new, or Insights reads it so) is kept private by itself: publishing to Google Drive, updates, Slack, comments on the pull request and opening the pull request are held until you allow it. Publishing before filing can cost the right to a patent.")
|
|
645
|
+
.argument('<agent>')
|
|
646
|
+
.option('--keep', 'keep it private')
|
|
647
|
+
.option('--allow', 'allow sharing it')
|
|
648
|
+
.option('--reset', 'back to what the agent and Insights say')
|
|
649
|
+
.option('--note <text>', 'why, in a line')
|
|
650
|
+
.action(async (ref, o) => {
|
|
651
|
+
await daemon();
|
|
652
|
+
const a = await resolveAgent(ref);
|
|
653
|
+
if ([o.keep, o.allow, o.reset].filter(Boolean).length > 1) throw new Error('Give one of --keep, --allow or --reset');
|
|
654
|
+
const v = o.keep || o.allow || o.reset ? await api('POST', `/agents/${a.id}/private`, { private: o.keep ? true : o.allow ? false : null, note: o.note ?? '' }) : a;
|
|
655
|
+
if (v.keptPrivate) console.log(`${bold('Kept private.')} ${v.keptPrivate.why}\n${dim(`Nothing of it is published or sent by the app. Allow sharing: agentmgr private ${a.id} --allow`)}`);
|
|
656
|
+
else console.log(v.idea?.allowed ? `${green('✓')} Sharing is allowed (you said so).` : `Not kept private: nothing in it was read as new. ${dim(`Keep it private anyway: agentmgr private ${a.id} --keep`)}`);
|
|
657
|
+
});
|
|
658
|
+
|
|
585
659
|
program
|
|
586
660
|
.command('acceptance')
|
|
587
661
|
.description('What done means for an agent: the points its work is checked against. The agent drafts them in its spec; you edit and agree; the review scorecard then reports each one as met, not met or not verified')
|
|
@@ -639,7 +713,7 @@ export async function main(argv) {
|
|
|
639
713
|
|
|
640
714
|
program
|
|
641
715
|
.command('insights')
|
|
642
|
-
.description('Why / What / How / Now
|
|
716
|
+
.description('Insights for an agent: Why / What / How / Now in three tidy points each, then what the work is worth now against later, what kind of idea it is (a task, worth a white paper, possibly patentable) and the ways to go, preferred first (one-off Claude call)')
|
|
643
717
|
.argument('<agent>')
|
|
644
718
|
.action(async (ref) => {
|
|
645
719
|
await daemon();
|
|
@@ -1488,6 +1562,17 @@ export async function main(argv) {
|
|
|
1488
1562
|
for (const it of items) console.log(` ${truncate(`#${it.number ?? '?'} ${it.title}`, 54).padEnd(54)} ${(['clean', 'watching'].includes(it.verdict) ? green : it.verdict === 'unchecked' ? dim : yellow)(word[it.verdict].padEnd(17))} ${dim(it.url)}`);
|
|
1489
1563
|
if (!v.github) console.log(dim('\nGitHub is not asked here, so nothing is looked at.'));
|
|
1490
1564
|
});
|
|
1565
|
+
qualityCmd
|
|
1566
|
+
.command('record')
|
|
1567
|
+
.description("The track record: what was said when each pull request merged (the agent's own confidence, the scorecard, whether its tests were tested, the model, how far it ran without you) against what held up; and the level of \"Without you\" each project's record supports")
|
|
1568
|
+
.option('--json', 'print JSON')
|
|
1569
|
+
.action(async (opts) => {
|
|
1570
|
+
await daemon();
|
|
1571
|
+
if (opts.json) return console.log(JSON.stringify(await api('GET', '/quality/record'), null, 2));
|
|
1572
|
+
const r = await api('GET', '/quality/record');
|
|
1573
|
+
console.log((await api('GET', '/quality/record?format=md')).markdown);
|
|
1574
|
+
for (const p of r.projects.filter((x) => x.suggestion)) console.log(dim(`\nSet it: agentmgr autonomy --project "${p.label}" --default ${p.suggestion.level}`));
|
|
1575
|
+
});
|
|
1491
1576
|
qualityCmd
|
|
1492
1577
|
.command('mark <pr-url>')
|
|
1493
1578
|
.description('Say what a merged pull request was: not a problem, a problem, or back to what was found')
|
|
@@ -1765,6 +1850,7 @@ export async function main(argv) {
|
|
|
1765
1850
|
.argument('[agent]')
|
|
1766
1851
|
.argument('[level]', 'ask, run, pr or merge: set it for this agent')
|
|
1767
1852
|
.option('--default <level>', 'the level new agents get when none is named')
|
|
1853
|
+
.option('--project <name>', 'with --default: the level for the new agents of this project only ("default" takes it away again)')
|
|
1768
1854
|
.option('--models <list>', 'the models its calls run on, best first; the next one is used when a call fails (default: fable,opus,sonnet)')
|
|
1769
1855
|
.option('--ok <entry>', 'you have seen an answer given for you (its id from the list; "hold" for a held merge)')
|
|
1770
1856
|
.option('--change <entry=answer>', 'your own answer to a question that was answered for you; the agent is told to apply it')
|
|
@@ -1773,10 +1859,12 @@ export async function main(argv) {
|
|
|
1773
1859
|
await daemon();
|
|
1774
1860
|
const { LEVEL_LABEL, logLine } = await import('./autonomy.js');
|
|
1775
1861
|
if (!ref) {
|
|
1776
|
-
|
|
1862
|
+
if (o.project && !o.default) throw new Error('--project goes with --default <level>');
|
|
1863
|
+
const patch = { ...(o.default ? { level: o.default, ...(o.project ? { project: o.project } : {}) } : {}), ...(o.models ? { models: o.models } : {}) };
|
|
1777
1864
|
const s = Object.keys(patch).length ? await api('PUT', '/autonomy', patch) : await api('GET', '/autonomy');
|
|
1778
1865
|
if (o.json) return console.log(JSON.stringify(s, null, 2));
|
|
1779
1866
|
console.log(`${bold('New agents:')} ${LEVEL_LABEL[s.level]} ${dim(`(${s.level})`)}`);
|
|
1867
|
+
for (const [name, l] of Object.entries(s.projects ?? {})) console.log(`${bold(`New agents in ${name}:`)} ${LEVEL_LABEL[l]} ${dim(`(${l})`)}`);
|
|
1780
1868
|
console.log(`${bold('Models, best first:')} ${s.models.map((m) => (typeof m === 'string' ? m : `${m.engine ?? 'claude'}:${m.model}`)).join(' → ')}`);
|
|
1781
1869
|
console.log(dim(`${s.agents} agent${s.agents === 1 ? '' : 's'} running without you · ${s.calls} of ${s.dailyCalls} calls today${s.lastModel ? ` · last answered by ${s.lastModel}` : ''}`));
|
|
1782
1870
|
if (s.lastError) console.log(dim(`Last failure ${s.lastError.at}: ${s.lastError.message}`));
|
|
@@ -2057,7 +2145,13 @@ export async function main(argv) {
|
|
|
2057
2145
|
console.log(dim(' agentmgr rules'));
|
|
2058
2146
|
continue;
|
|
2059
2147
|
}
|
|
2060
|
-
|
|
2148
|
+
if (it.kind === 'auto') {
|
|
2149
|
+
console.log(`${cyan('done for you')} ${bold(it.agentName)} ${dim(it.agentId)} ${it.title}`);
|
|
2150
|
+
if (it.entry?.answer) console.log(dim(` → ${it.entry.answer}\n agentmgr autonomy ${it.agentId} --ok · agentmgr autonomy ${it.agentId} --change ${it.entry.id}="your answer"`));
|
|
2151
|
+
else console.log(dim(` agentmgr autonomy ${it.agentId} --ok`));
|
|
2152
|
+
continue;
|
|
2153
|
+
}
|
|
2154
|
+
console.log(`${label[it.kind] ?? cyan(it.kind)} ${bold(it.agentName)} ${dim(it.agentId)} ${(it.kind === 'prompt' && it.title === 'Question' && it.prompt?.question) || it.title}`);
|
|
2061
2155
|
if (it.kind === 'prompt') console.log(dim(` ${(it.prompt?.choices ?? []).map((c) => `${c.key}. ${c.label}`).join(' ')} → agentmgr attach ${it.agentId}`));
|
|
2062
2156
|
if (it.kind === 'question') {
|
|
2063
2157
|
if (it.question.options.length) console.log(dim(` options: ${it.question.options.join(' | ')}`));
|
|
@@ -3627,7 +3721,9 @@ export async function main(argv) {
|
|
|
3627
3721
|
if (!gone) throw new Error(`The daemon (pid ${before.pid}) is still shutting down after 5 minutes; check the log`);
|
|
3628
3722
|
}
|
|
3629
3723
|
const st = await svc.status();
|
|
3630
|
-
|
|
3724
|
+
// The login service starts its own daemon: for another home or port, this one is started here.
|
|
3725
|
+
const viaService = st.loaded && st.ours;
|
|
3726
|
+
if (viaService) await svc.kickstart();
|
|
3631
3727
|
else await ensureDaemon({ quiet: true });
|
|
3632
3728
|
const back = async () => {
|
|
3633
3729
|
const h = await health();
|
|
@@ -3636,7 +3732,7 @@ export async function main(argv) {
|
|
|
3636
3732
|
for (let i = 0; i < 150 && !(await back()); i++) await new Promise((res) => setTimeout(res, 200));
|
|
3637
3733
|
if (!(await back())) throw new Error('Daemon did not come back; check the log');
|
|
3638
3734
|
const agents = await api('GET', '/agents');
|
|
3639
|
-
console.log(`${green('✓')} restarted${
|
|
3735
|
+
console.log(`${green('✓')} restarted${viaService ? ' (login service)' : ''}; ${agents.filter((a) => a.desired === 'running').length} agents set to resume`);
|
|
3640
3736
|
});
|
|
3641
3737
|
|
|
3642
3738
|
program
|
package/src/config.js
CHANGED
|
@@ -51,6 +51,14 @@ const DEFAULTS = {
|
|
|
51
51
|
flushSec: 30,
|
|
52
52
|
// Ask task agents to keep a brief (Problem / Solution / Diagram / Checks) for the UI.
|
|
53
53
|
brief: true,
|
|
54
|
+
// With the brief: ask for the proof of its checks (PROOF.md: command, exit code, output) and what it did not do.
|
|
55
|
+
proof: true,
|
|
56
|
+
// With the brief: ask for a pre-mortem (## Risks: how the task could go wrong, named before starting and marked at the end).
|
|
57
|
+
premortem: true,
|
|
58
|
+
// With the brief: when there is more than one way, ask for the options ranked by value now and later (## Options).
|
|
59
|
+
valueLens: true,
|
|
60
|
+
// Test the tests (mutate.js): how many changed lines are broken in one run, the longest the tests may take, and one run in all.
|
|
61
|
+
testTheTests: { max: 8, timeoutMs: 300_000, budgetMs: 900_000 },
|
|
54
62
|
// Backlog: items worked on at once per project (overridable per project), and overall.
|
|
55
63
|
backlogParallel: 2,
|
|
56
64
|
backlogMaxActive: 4,
|
package/src/engines/claude.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// and how to read them. Other engines implement the same shape (see docs/engines.md).
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
|
-
import { promptChoices } from '../inbox.js';
|
|
5
|
+
import { promptChoices, questionMenu } from '../inbox.js';
|
|
6
6
|
import { scanActivity } from '../stuck.js';
|
|
7
7
|
import { recentSessionFiles, scanTranscript, sessionDigest, subagentTranscripts, transcriptPath } from '../tracker.js';
|
|
8
8
|
import { trustFolder } from '../trust.js';
|
|
@@ -107,8 +107,13 @@ export default {
|
|
|
107
107
|
attention: [
|
|
108
108
|
[/trustthisfolder/i, 'Folder trust prompt'],
|
|
109
109
|
[/Doyouwantto(proceed|make|create|allow|run|overwrite)/i, 'Permission prompt'],
|
|
110
|
+
// The same prompt when a redraw dropped letters of its question ("Do you want to pro eed?"): its
|
|
111
|
+
// choices and footer, Yes first, No last, then "Esc to cancel" (a question menu ends "Enter to select").
|
|
112
|
+
[/(?:^|[^a-z0-9])1\.?Yes.{0,300}\d\.?No.{0,60}(?<!Entertoselect.{0,40})Esctocancel/i, 'Permission prompt'],
|
|
113
|
+
// The agent's own question, as a menu: a message typed now would pick the highlighted option.
|
|
114
|
+
[/Entertoselect.{0,40}Esctocancel/i, 'Question'],
|
|
110
115
|
],
|
|
111
|
-
promptChoices: (screen) => promptChoices(screen),
|
|
116
|
+
promptChoices: (screen, attention) => (attention === 'Question' && questionMenu(screen)) || promptChoices(screen),
|
|
112
117
|
|
|
113
118
|
/** Lines of Claude Code's own frame (input box, mode and status bar): never a question to the person. */
|
|
114
119
|
screenChrome: [
|