ai-agentmanager 1.31.0 → 1.33.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 +15 -0
- package/package.json +1 -1
- package/public/app.js +58 -6
- package/public/codemap.js +119 -5
- package/public/eval.js +42 -0
- package/public/issues.js +2 -1
- package/public/style.css +45 -0
- package/public/today.js +22 -2
- package/src/benchmarks.js +309 -0
- package/src/eval.js +438 -0
- package/src/issues.js +2 -0
- package/src/jira.js +7 -4
- package/src/manager.js +60 -5
- package/src/review.js +21 -0
- package/src/server.js +54 -3
- package/src/today.js +13 -1
package/src/server.js
CHANGED
|
@@ -54,6 +54,9 @@ import { about, latestRelease } from './about.js';
|
|
|
54
54
|
import { Support } from './support.js';
|
|
55
55
|
import { ghBin, leadingJiraKey } from './tracker.js';
|
|
56
56
|
import { BugHunts } from './bughunt.js';
|
|
57
|
+
import { ModuleBenchmarks } from './benchmarks.js';
|
|
58
|
+
import { Evals, readTail, stateHash } from './eval.js';
|
|
59
|
+
import { engineOf } from './engines/index.js';
|
|
57
60
|
import * as git from './git.js';
|
|
58
61
|
|
|
59
62
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -130,16 +133,45 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
130
133
|
const keep = (d) => (out = (out + d).slice(-4000));
|
|
131
134
|
child.stdout.on('data', keep);
|
|
132
135
|
child.stderr.on('data', keep);
|
|
136
|
+
let timedOut = false;
|
|
133
137
|
const timer = setTimeout(() => {
|
|
138
|
+
timedOut = true;
|
|
134
139
|
try {
|
|
135
140
|
process.kill(-child.pid, 'SIGKILL');
|
|
136
141
|
} catch {}
|
|
137
142
|
}, 15 * 60_000);
|
|
138
143
|
child.on('error', (e) => (clearTimeout(timer), resolve({ passed: false, output: e.message })));
|
|
139
|
-
child.on('close', (code) => (clearTimeout(timer), resolve({ passed: code === 0, output: out })));
|
|
144
|
+
child.on('close', (code) => (clearTimeout(timer), resolve({ passed: code === 0 && !timedOut, output: out, timedOut })));
|
|
140
145
|
});
|
|
141
146
|
const hunts = new BugHunts({ manager, store, judge: manager.judge, git: huntGit, log: (m) => console.log(`[agentmgr] ${m}`) });
|
|
142
147
|
hunts.startTimer();
|
|
148
|
+
// Micro benchmarks of the modules where speed matters, for the Jira issues that change them.
|
|
149
|
+
const benches = new ModuleBenchmarks({
|
|
150
|
+
manager,
|
|
151
|
+
store,
|
|
152
|
+
changedFiles: async (a) => {
|
|
153
|
+
const base = await review.base(a);
|
|
154
|
+
return base ? Object.keys((await git.changes(a.workdir, base.sha))?.files ?? {}) : [];
|
|
155
|
+
},
|
|
156
|
+
log: (m) => console.log(`[agentmgr] ${m}`),
|
|
157
|
+
});
|
|
158
|
+
// Eval: the tests run, the checks done and what's pending for each Jira change, with a confidence.
|
|
159
|
+
const evals = new Evals({
|
|
160
|
+
manager,
|
|
161
|
+
store,
|
|
162
|
+
benches,
|
|
163
|
+
run: (a, command) => runCommand(a, command),
|
|
164
|
+
state: async (a) => {
|
|
165
|
+
const opts = { cwd: a.workdir, timeout: 30_000 };
|
|
166
|
+
const [head, status, diff] = await Promise.all([git.run('git', ['rev-parse', 'HEAD'], opts), git.run('git', ['status', '--porcelain'], opts), git.run('git', ['diff', 'HEAD'], opts)]);
|
|
167
|
+
return stateHash(head.trim(), status, diff);
|
|
168
|
+
},
|
|
169
|
+
changes: (a) => review.get(a.id),
|
|
170
|
+
// Claude Code's session: the test runs in it. Other engines keep theirs differently.
|
|
171
|
+
transcript: (a) => (engineOf(a).id === 'claude' && a.workdir ? readTail(engineOf(a).sessionFile(a.workdir, a.sessionId)) : null),
|
|
172
|
+
log: (m) => console.log(`[agentmgr] ${m}`),
|
|
173
|
+
});
|
|
174
|
+
evals.startTimer();
|
|
143
175
|
const races = new Races({ manager, store });
|
|
144
176
|
const review = new Review({ manager });
|
|
145
177
|
// The walkthrough explains the same diff the review screen shows.
|
|
@@ -859,7 +891,24 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
859
891
|
return stats(store.list(), { days, projectOf: (a) => manager.projectInfo(a)?.name ?? null });
|
|
860
892
|
}));
|
|
861
893
|
// ?layer=bugs adds where the bug hunts found bugs: heat per folder, and the paths through the code.
|
|
862
|
-
api.get('/codemap', wrap((req) => manager.codeMap(req.query.project ? String(req.query.project) : null, { bugs: req.query.layer === 'bugs' ? { findings: hunts.findings, hunts: hunts.hunts } : null })));
|
|
894
|
+
api.get('/codemap', wrap((req) => manager.codeMap(req.query.project ? String(req.query.project) : null, { bugs: req.query.layer === 'bugs' ? { findings: hunts.findings, hunts: hunts.hunts } : null, speed: req.query.layer === 'speed' ? benches : null })));
|
|
895
|
+
// Modules to benchmark, and what their benchmarks found (benchmarks.js).
|
|
896
|
+
api.post('/benchmodules', wrap((req) => benches.watch(req.body ?? {})));
|
|
897
|
+
api.delete('/benchmodules/:id', wrap((req) => benches.unwatch(req.params.id)));
|
|
898
|
+
api.post('/benchruns/:id/accept', wrap((req) => benches.accept(req.params.id, req.body?.accepted !== false)));
|
|
899
|
+
api.post('/benchruns/:id/fix', wrap((req) => benches.askToFix(req.params.id)));
|
|
900
|
+
api.get('/agents/:id/eval', wrap(async (req) => (manager.mustGet(req.params.id).eval ? evals.view(manager.mustGet(req.params.id).id) : evals.compute(manager.mustGet(req.params.id).id))));
|
|
901
|
+
api.post('/agents/:id/eval', wrap((req) => evals.compute(manager.mustGet(req.params.id).id)));
|
|
902
|
+
api.post('/agents/:id/eval/verify', wrap(async (req) => {
|
|
903
|
+
const a = manager.mustGet(req.params.id);
|
|
904
|
+
// Answered at once; the run's result comes with the agent's next update.
|
|
905
|
+
evals.verify(a.id).catch((e) => console.log(`[agentmgr] eval: ${e.message}`));
|
|
906
|
+
return { started: true };
|
|
907
|
+
}));
|
|
908
|
+
api.put('/agents/:id/eval/command', wrap((req) => evals.setTestCommand(req.params.id, req.body?.command)));
|
|
909
|
+
api.post('/agents/:id/eval/gaps', wrap((req) => evals.closeGaps(req.params.id)));
|
|
910
|
+
api.post('/agents/:id/eval/seen', wrap((req) => evals.seen(req.params.id, req.body?.seen !== false)));
|
|
911
|
+
api.post('/agents/:id/eval/post', wrap((req) => review.postEval(req.params.id, evals.view(manager.mustGet(req.params.id).id)?.markdown)));
|
|
863
912
|
// Issues agents work on, for the summary; ?group=you|agent|done and ?format=markdown to paste.
|
|
864
913
|
api.get('/issues', wrap(async (req) => {
|
|
865
914
|
// ?fresh=1 (the ↻ button) asks Jira again: the issues assigned to you and each issue's status.
|
|
@@ -976,7 +1025,7 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
976
1025
|
got('reviews', () => reviews.rows()),
|
|
977
1026
|
]);
|
|
978
1027
|
const findings = hunts.list().findings.filter((x) => x.status === 'open' || x.status === 'pr');
|
|
979
|
-
const items = todayItems({ inbox, issues, actions, reviews: prs, findings });
|
|
1028
|
+
const items = todayItems({ inbox, issues, actions, reviews: prs, findings, slower: benches.slower(), unsure: evals.unsure().map((a) => ({ id: a.id, name: a.name, issue: manager.issueKey(a), confidence: a.eval.confidence, pending: a.eval.pending, at: a.eval.at })) });
|
|
980
1029
|
return { items, aside: todayAside({ issues, actions }), speech: todaySpeech(items), features: f, errors };
|
|
981
1030
|
}));
|
|
982
1031
|
// Support tickets: kept on this computer, each with a filled-in link to a new GitHub issue.
|
|
@@ -1419,6 +1468,8 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
1419
1468
|
value.close();
|
|
1420
1469
|
reviews.close();
|
|
1421
1470
|
hunts.close();
|
|
1471
|
+
benches.close();
|
|
1472
|
+
evals.close();
|
|
1422
1473
|
autopilot.close();
|
|
1423
1474
|
goals.close();
|
|
1424
1475
|
worklog.close();
|
package/src/today.js
CHANGED
|
@@ -59,7 +59,7 @@ const INBOX = {
|
|
|
59
59
|
* The list: [{ id, kind, label, title, why, score, at, agentId?, url?, actionId?, issueKey?, reviewUrl? }],
|
|
60
60
|
* most pressing first. Each source may be missing (turned off, or it couldn't be had).
|
|
61
61
|
*/
|
|
62
|
-
export function todayItems({ inbox = [], issues = [], actions = [], reviews = [], findings = [], now = new Date() } = {}) {
|
|
62
|
+
export function todayItems({ inbox = [], issues = [], actions = [], reviews = [], findings = [], slower = [], unsure = [], now = new Date() } = {}) {
|
|
63
63
|
const items = [];
|
|
64
64
|
// The issue each agent works on: named on its questions, and not listed twice.
|
|
65
65
|
const issueOfAgent = new Map(issues.filter((r) => r.agent?.id).map((r) => [r.agent.id, r]));
|
|
@@ -120,6 +120,18 @@ export function todayItems({ inbox = [], issues = [], actions = [], reviews = []
|
|
|
120
120
|
const failed = f.auto?.state === 'failed' ? ` · the automatic fix didn't hold up: ${f.auto.reason}` : '';
|
|
121
121
|
items.push({ id: `bug:${f.id}`, kind: 'bug', label: 'Bug', title: f.title, why: `${f.severity === 'critical' ? 'Critical' : 'High'}: found by the ${f.hunt ?? 'bug'} hunt${f.file ? ` in ${f.file}${f.line ? `:${f.line}` : ''}` : ''}${f.evidence?.type === 'test' ? ' · a test fails' : ''}${failed}`, score: f.severity === 'critical' ? 28 : 38, at: f.at ?? null, findingId: f.id });
|
|
122
122
|
}
|
|
123
|
+
// Done, by its agent's account, but the Eval isn't sure: what's still missing.
|
|
124
|
+
for (const u of unsure) {
|
|
125
|
+
const title = `${u.issue ? `${u.issue}: ` : ''}${u.confidence}% confident`;
|
|
126
|
+
items.push({ id: `eval:${u.id}`, kind: 'eval', label: 'Eval', title, why: u.pending.slice(0, 3).join(' · ') + (u.pending.length > 3 ? ` · and ${u.pending.length - 3} more` : ''), score: u.confidence < 60 ? 26 : 35, at: u.at ?? null, agentId: u.id, issueKey: u.issue ?? null });
|
|
127
|
+
}
|
|
128
|
+
// An issue's change made a module slower in its micro benchmarks (benchmarks.js).
|
|
129
|
+
for (const r of slower) {
|
|
130
|
+
const worst = r.cases.filter((c) => c.change !== null).sort((a, b) => b.change - a.change)[0];
|
|
131
|
+
const title = `${r.issue ? `${r.issue}: ` : ''}${r.module || 'the repository'} is ${r.worst}% slower`;
|
|
132
|
+
const why = `Micro benchmarks${r.agent && r.agent !== r.issue ? ` by ${r.agent}` : ''}${worst ? `: ${worst.name} ${worst.before} → ${worst.after}${worst.unit ? ` ${worst.unit}` : ''}` : ''}${worst?.note ? ` · its note: ${worst.note}` : ''}`;
|
|
133
|
+
items.push({ id: `bench:${r.id}`, kind: 'bench', label: 'Slower', title, why, score: r.worst > 20 ? 27 : 36, at: r.at ?? null, agentId: r.agentId, runId: r.id, issueKey: r.issue ?? null });
|
|
134
|
+
}
|
|
123
135
|
return items.sort((x, y) => x.score - y.score || String(y.at ?? '').localeCompare(String(x.at ?? '')));
|
|
124
136
|
}
|
|
125
137
|
|