ai-agentmanager 1.27.0 → 1.29.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 +12 -0
- package/package.json +1 -1
- package/public/actions.js +63 -6
- package/public/app.js +9 -0
- package/public/bughunt.js +317 -0
- package/public/index.html +4 -0
- package/public/issues.js +34 -5
- package/public/keys.js +5 -2
- package/public/rowkeys.js +2 -1
- package/public/style.css +29 -0
- package/public/today.js +153 -9
- package/src/actions.js +76 -5
- package/src/assistant.js +5 -1
- package/src/bughunt.js +475 -0
- package/src/cli.js +16 -1
- package/src/issues.js +16 -6
- package/src/manager.js +20 -6
- package/src/server.js +42 -3
- package/src/today.js +28 -6
package/src/server.js
CHANGED
|
@@ -52,6 +52,8 @@ import { Value, valueSlack } from './value.js';
|
|
|
52
52
|
import { Store } from './store.js';
|
|
53
53
|
import { about, latestRelease } from './about.js';
|
|
54
54
|
import { Support } from './support.js';
|
|
55
|
+
import { leadingJiraKey } from './tracker.js';
|
|
56
|
+
import { BugHunts } from './bughunt.js';
|
|
55
57
|
|
|
56
58
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
57
59
|
const require = createRequire(import.meta.url);
|
|
@@ -97,6 +99,9 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
97
99
|
const proposed = new ProposedIssues({ store, manager });
|
|
98
100
|
const myActions = new MyActions({ store, manager });
|
|
99
101
|
const reviews = new Reviews({ manager, store, log: (m) => console.log(`[agentmgr] ${m}`) });
|
|
102
|
+
// Bug hunts: the judge checks each finding when it's on (else only failing tests are kept).
|
|
103
|
+
const hunts = new BugHunts({ manager, store, judge: manager.judge, log: (m) => console.log(`[agentmgr] ${m}`) });
|
|
104
|
+
hunts.startTimer();
|
|
100
105
|
const races = new Races({ manager, store });
|
|
101
106
|
const review = new Review({ manager });
|
|
102
107
|
// The walkthrough explains the same diff the review screen shows.
|
|
@@ -603,6 +608,21 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
603
608
|
api.post('/agents/:id/changes/comments', wrap((req) => review.comment(req.params.id, req.body ?? {})));
|
|
604
609
|
api.post('/agents/:id/changes/commit', wrap((req) => review.commit(req.params.id, req.body ?? {})));
|
|
605
610
|
api.post('/agents/:id/changes/pr', wrap((req) => review.pr(req.params.id, req.body ?? {})));
|
|
611
|
+
// Done but no pull request: commit what's left, push and open one, titled after the issue or request.
|
|
612
|
+
api.post('/agents/:id/ship', wrap(async (req) => {
|
|
613
|
+
const a = manager.mustGet(req.params.id);
|
|
614
|
+
const key = leadingJiraKey(a.intent);
|
|
615
|
+
const words = a.synopsis?.text ?? a.brief?.title ?? String(a.intent ?? '').replace(/^<?https?:\/\/\S+>?\s*/, '').split('\n')[0];
|
|
616
|
+
const title = String(req.body?.title ?? '').trim() || `${key ? `${key}: ` : ''}${words || a.name}`.slice(0, 100);
|
|
617
|
+
try {
|
|
618
|
+
await review.commit(a.id, { message: title });
|
|
619
|
+
} catch (e) {
|
|
620
|
+
if (e.status !== 409 || !/nothing to commit/i.test(e.message)) throw e;
|
|
621
|
+
}
|
|
622
|
+
const r = await review.pr(a.id, { title });
|
|
623
|
+
await manager.refresh(a.id, { withPrs: true }).catch(() => {});
|
|
624
|
+
return { url: r.url ?? null, title };
|
|
625
|
+
}));
|
|
606
626
|
api.post('/agents/:id/fork', wrap((req) => manager.fork(req.params.id, req.body ?? {})));
|
|
607
627
|
|
|
608
628
|
api.get('/races', wrap(() => races.list()));
|
|
@@ -822,7 +842,11 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
822
842
|
// My actions: what's asked of you in Slack and meeting notes (the assistant adds them).
|
|
823
843
|
api.get('/actions', wrap(() => ({ rows: myActions.rows(), features: featuresOf(config) })));
|
|
824
844
|
api.post('/actions', wrap((req) => myActions.add({ ...req.body, by: req.headers['x-agentmgr-agent'] ? 'assistant' : 'you' })));
|
|
825
|
-
api.post('/actions/set', wrap((req) => myActions.set(Array.isArray(req.body?.ids) ? req.body.ids.map(String) : [], String(req.body?.state ?? ''), { project: req.body?.project ?? null })));
|
|
845
|
+
api.post('/actions/set', wrap((req) => myActions.set(Array.isArray(req.body?.ids) ? req.body.ids.map(String) : [], String(req.body?.state ?? ''), { project: req.body?.project ?? null, until: req.body?.until ?? null })));
|
|
846
|
+
// The draft answer to a question: the assistant's (from its session) or yours, edited.
|
|
847
|
+
api.put('/actions/:id/answer', wrap((req) => myActions.answer(req.params.id, { text: req.body?.text, sources: req.body?.sources ?? null, by: req.headers['x-agentmgr-agent'] ? 'assistant' : 'you' })));
|
|
848
|
+
// A session that researches the question and records a draft answer.
|
|
849
|
+
api.post('/actions/:id/draft', wrap((req) => myActions.draft(req.params.id, `node ${JSON.stringify(path.join(__dirname, '..', 'bin', 'agentmgr.js'))}`, manager.listProjects().map((p) => ({ name: p.name ?? p.shortcut, dir: p.dir ?? null, repo: p.repo ?? null })))));
|
|
826
850
|
api.post('/actions/:id/discuss', wrap((req) => myActions.discuss(req.params.id, `node ${JSON.stringify(path.join(__dirname, '..', 'bin', 'agentmgr.js'))}`)));
|
|
827
851
|
// The parts you use: Jira, Slack, meeting notes. Off hides its list and the assistant skips it.
|
|
828
852
|
api.get('/features', wrap(() => ({ features: featuresOf(config), me: assistant.settings.me })));
|
|
@@ -835,7 +859,7 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
835
859
|
return { features: featuresOf(config), me: assistant.settings.me };
|
|
836
860
|
}));
|
|
837
861
|
// Your action on issues: assign (starts an agent from the proposal), skip, done, remove, or null to clear.
|
|
838
|
-
api.post('/issues/action', wrap((req) => proposed.setAction(Array.isArray(req.body?.keys) ? req.body.keys.map(String) : [], req.body?.action ?? null)));
|
|
862
|
+
api.post('/issues/action', wrap((req) => proposed.setAction(Array.isArray(req.body?.keys) ? req.body.keys.map(String) : [], req.body?.action ?? null, { until: req.body?.until ?? null })));
|
|
839
863
|
// Design docs of all agents; the same ?group= and ?format=markdown.
|
|
840
864
|
api.get('/designs', wrap((req) => {
|
|
841
865
|
const v = manager.designs();
|
|
@@ -912,7 +936,8 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
912
936
|
f.slack || f.gemini ? got('actions', () => myActions.rows()) : [],
|
|
913
937
|
got('reviews', () => reviews.rows()),
|
|
914
938
|
]);
|
|
915
|
-
const
|
|
939
|
+
const findings = hunts.list().findings.filter((x) => x.status === 'open');
|
|
940
|
+
const items = todayItems({ inbox, issues, actions, reviews: prs, findings });
|
|
916
941
|
return { items, aside: todayAside({ issues, actions }), speech: todaySpeech(items), features: f, errors };
|
|
917
942
|
}));
|
|
918
943
|
// Support tickets: kept on this computer, each with a filled-in link to a new GitHub issue.
|
|
@@ -933,6 +958,18 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
933
958
|
res.status(e.status ?? 500).json({ error: e.message });
|
|
934
959
|
}
|
|
935
960
|
});
|
|
961
|
+
// Bug hunts and what they found.
|
|
962
|
+
api.get('/hunts', wrap(async () => {
|
|
963
|
+
await hunts.sweep();
|
|
964
|
+
return hunts.list();
|
|
965
|
+
}));
|
|
966
|
+
api.post('/hunts', wrap((req) => hunts.add(req.body ?? {})));
|
|
967
|
+
api.put('/hunts/:id', wrap((req) => hunts.update(req.params.id, req.body ?? {})));
|
|
968
|
+
api.delete('/hunts/:id', wrap((req) => hunts.remove(req.params.id)));
|
|
969
|
+
api.post('/hunts/:id/run', wrap((req) => hunts.run(req.params.id)));
|
|
970
|
+
api.post('/findings/set', wrap((req) => hunts.set(Array.isArray(req.body?.ids) ? req.body.ids.map(String) : [], req.body?.status, { until: req.body?.until ?? null })));
|
|
971
|
+
api.post('/findings/:id/fix', wrap((req) => hunts.fix(req.params.id)));
|
|
972
|
+
api.get('/findings/:id/issue', wrap((req) => hunts.issue(req.params.id)));
|
|
936
973
|
api.get('/standup', wrap(() => standup.view()));
|
|
937
974
|
api.post('/standup', wrap(async () => ({ ...standup.view(), latest: await standup.make({ reason: 'asked' }) })));
|
|
938
975
|
api.put('/standup', wrap((req) => {
|
|
@@ -1342,6 +1379,7 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
1342
1379
|
standup.close();
|
|
1343
1380
|
value.close();
|
|
1344
1381
|
reviews.close();
|
|
1382
|
+
hunts.close();
|
|
1345
1383
|
autopilot.close();
|
|
1346
1384
|
goals.close();
|
|
1347
1385
|
worklog.close();
|
|
@@ -1390,6 +1428,7 @@ export async function startServer({ port = PORT, host = HOST } = {}) {
|
|
|
1390
1428
|
.catch((err) => console.error(`[agentmgr] could not join the hub ${process.env.AGENTMGR_HUB_URL}: ${err.message}`));
|
|
1391
1429
|
}
|
|
1392
1430
|
return {
|
|
1431
|
+
hunts,
|
|
1393
1432
|
hubLink,
|
|
1394
1433
|
server,
|
|
1395
1434
|
manager,
|
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 = [], now = new Date() } = {}) {
|
|
62
|
+
export function todayItems({ inbox = [], issues = [], actions = [], reviews = [], findings = [], 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]));
|
|
@@ -70,19 +70,28 @@ export function todayItems({ inbox = [], issues = [], actions = [], reviews = []
|
|
|
70
70
|
const r = i.agentId ? issueOfAgent.get(i.agentId) : null;
|
|
71
71
|
if (r && ['prompt', 'waiting', 'question'].includes(i.kind)) asking.add(r.key);
|
|
72
72
|
const about = !r?.title ? '' : i.agentName === r.key ? ` · ${r.title}` : ` · ${r.key}: ${r.title}`;
|
|
73
|
-
items.push({ id: i.key, kind: i.kind, label: k.label, title: String(i.title ?? '').slice(0, 300), why: k.why(i) + about, score: k.score + (i.priority ?? 2) / 10, at: i.at ?? null, agentId: i.agentId ?? null, ...(r ? { url: r.url ?? null, issueKey: r.key } : {}) });
|
|
73
|
+
items.push({ id: i.key, kind: i.kind, label: k.label, title: String(i.title ?? '').slice(0, 300), why: k.why(i) + about, score: k.score + (i.priority ?? 2) / 10, at: i.at ?? null, agentId: i.agentId ?? null, ...(r ? { url: r.url ?? null, issueKey: r.key } : {}), ...answerOf(i) });
|
|
74
74
|
}
|
|
75
75
|
for (const r of issues) {
|
|
76
76
|
if (asking.has(r.key)) continue;
|
|
77
77
|
const title = r.title ? `${r.key}: ${r.title}` : r.key;
|
|
78
78
|
if (r.group === 'you') {
|
|
79
|
-
|
|
79
|
+
// Done with no pull request yet: shipped from here (commit, push, open one) after a look at the changes.
|
|
80
|
+
const ship = r.stage === 'review' && !r.pr && Boolean(r.agent);
|
|
81
|
+
items.push({ id: `issue:${r.key}`, kind: 'issue-review', label: 'Jira', title, why: ship ? 'Done, no pull request yet: look at the changes, then open one' : r.note, score: 25, at: r.updatedAt ?? null, agentId: r.agent?.id ?? null, url: r.url ?? null, issueKey: r.key, ...(ship ? { ship: true } : {}) });
|
|
80
82
|
} else if (r.group === 'new') {
|
|
81
83
|
items.push({ id: `issue:${r.key}`, kind: 'issue-new', label: r.type && !/^(story|task|bug|sub-?task)$/i.test(r.type) ? r.type : 'Jira', title, why: r.stage === 'assigned' ? 'Assigned to you in Jira, not started' : 'Proposed for an agent, not started', score: 50, at: r.updatedAt ?? null, url: r.url ?? null, issueKey: r.key });
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
86
|
for (const a of actions) {
|
|
85
87
|
if (a.group !== 'open') continue;
|
|
88
|
+
// A question put to you: asked directly is pressing; copied or mentioned can wait a little.
|
|
89
|
+
if (a.kind === 'question') {
|
|
90
|
+
const at = dueAt(a.due, now);
|
|
91
|
+
const why = [a.cc ? `you're copied${a.from ? `; ${a.from} asked` : ''}` : a.from ? `${a.from} asked you` : 'asked of you', a.sourceLabel && `in ${a.sourceLabel}`, dueWords(at, now), a.answer ? 'answer drafted' : 'no answer drafted yet'].filter(Boolean).join(' · ');
|
|
92
|
+
items.push({ id: `action:${a.id}`, kind: 'ask', label: a.cc ? "CC'd" : 'Asked you', title: a.question || a.text, why, score: a.cc ? 44 : at && at.getTime() < now.getTime() + DAY ? 16 : 22, at: a.when ?? null, url: a.link ?? null, actionId: a.id, draft: a.answer ?? null });
|
|
93
|
+
continue;
|
|
94
|
+
}
|
|
86
95
|
const at = dueAt(a.due, now);
|
|
87
96
|
const words = dueWords(at, now);
|
|
88
97
|
const late = at && at.getTime() < now.getTime();
|
|
@@ -100,6 +109,11 @@ export function todayItems({ inbox = [], issues = [], actions = [], reviews = []
|
|
|
100
109
|
items.push({ id: `pr:${r.pr.url}`, kind: 'pr-ready', label: 'Review', title, why: `${r.agent.name}'s review is ready to post: ${verdict}${r.stale ? ' (the author pushed since)' : ''}`, score: 32, at: r.updatedAt ?? null, agentId: r.agent.id, url: r.pr.url, reviewUrl: r.pr.url });
|
|
101
110
|
}
|
|
102
111
|
}
|
|
112
|
+
// Bugs a hunt found and the check confirmed: the serious ones (the rest wait in the Bugs list).
|
|
113
|
+
for (const f of findings) {
|
|
114
|
+
if (f.status !== 'open' || !['critical', 'high'].includes(f.severity)) continue;
|
|
115
|
+
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' : ''}`, score: f.severity === 'critical' ? 28 : 38, at: f.at ?? null, findingId: f.id });
|
|
116
|
+
}
|
|
103
117
|
return items.sort((x, y) => x.score - y.score || String(y.at ?? '').localeCompare(String(x.at ?? '')));
|
|
104
118
|
}
|
|
105
119
|
|
|
@@ -113,7 +127,15 @@ export function todaySpeech(items, max = 8) {
|
|
|
113
127
|
return parts;
|
|
114
128
|
}
|
|
115
129
|
|
|
116
|
-
const ASIDE = { skip: 'Skipped', done: 'Done', remove: 'Removed' };
|
|
130
|
+
const ASIDE = { skip: 'Skipped', snooze: 'Snoozed', done: 'Done', remove: 'Removed' };
|
|
131
|
+
|
|
132
|
+
/** How an agent's question is answered from Today: the choices it offered, and where an answer goes. */
|
|
133
|
+
function answerOf(i) {
|
|
134
|
+
if (i.kind === 'prompt') return { answer: { via: 'key', choices: (i.prompt?.choices ?? []).slice(0, 6).map((c) => ({ key: c.key, label: c.label })) } };
|
|
135
|
+
if (i.kind === 'waiting') return { answer: { via: 'waiting', choices: (i.waiting?.choices ?? []).slice(0, 6), reply: true } };
|
|
136
|
+
if (i.kind === 'question') return { answer: { via: 'question', qid: i.question?.id, choices: (i.question?.options ?? []).slice(0, 6), reply: true, default: i.question?.default ?? null } };
|
|
137
|
+
return {};
|
|
138
|
+
}
|
|
117
139
|
|
|
118
140
|
/**
|
|
119
141
|
* What you set aside from Today's lists (skipped, done, removed), newest first, so any of it can be
|
|
@@ -123,11 +145,11 @@ export function todayAside({ issues = [], actions = [], max = 50 } = {}) {
|
|
|
123
145
|
const out = [];
|
|
124
146
|
for (const r of issues) {
|
|
125
147
|
if (!ASIDE[r.action]) continue;
|
|
126
|
-
out.push({ id: `issue:${r.key}`, kind: 'issue', state: r.action, label: ASIDE[r.action], title: r.title ? `${r.key}: ${r.title}` : r.key, at: r.actionAt ?? r.updatedAt ?? null, issueKey: r.key });
|
|
148
|
+
out.push({ id: `issue:${r.key}`, kind: 'issue', state: r.action, label: ASIDE[r.action], title: r.title ? `${r.key}: ${r.title}` : r.key, at: r.actionAt ?? r.updatedAt ?? null, issueKey: r.key, until: r.snoozeUntil ?? null });
|
|
127
149
|
}
|
|
128
150
|
for (const a of actions) {
|
|
129
151
|
if (!ASIDE[a.status]) continue;
|
|
130
|
-
out.push({ id: `action:${a.id}`, kind: 'action', state: a.status, label: ASIDE[a.status], title: a.text, at: a.updatedAt ?? null, actionId: a.id });
|
|
152
|
+
out.push({ id: `action:${a.id}`, kind: 'action', state: a.status, label: ASIDE[a.status], title: a.question || a.text, at: a.updatedAt ?? null, actionId: a.id, until: a.snoozeUntil ?? null });
|
|
131
153
|
}
|
|
132
154
|
return out.sort((x, y) => String(y.at ?? '').localeCompare(String(x.at ?? ''))).slice(0, max);
|
|
133
155
|
}
|