ai-agentmanager 1.19.0 → 1.21.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 +13 -0
- package/README.md +13 -3
- package/package.json +1 -1
- package/public/app.js +130 -7
- package/public/codemap.js +209 -0
- package/public/index.html +27 -0
- package/public/keys.js +93 -0
- package/public/land.js +9 -2
- package/public/speak.js +4 -2
- package/public/standup.js +348 -0
- package/public/style.css +96 -0
- package/public/voice.js +16 -0
- package/public/watch.js +254 -0
- package/src/backlog.js +7 -3
- package/src/brief.js +31 -3
- package/src/cli.js +7 -2
- package/src/codemap.js +115 -0
- package/src/config.js +6 -0
- package/src/drive.js +1 -0
- package/src/landing.js +88 -9
- package/src/livebrowser.js +5 -2
- package/src/manager.js +81 -1
- package/src/notify.js +1 -0
- package/src/server.js +41 -2
- package/src/standup.js +209 -0
- package/src/tracker.js +57 -0
package/src/tracker.js
CHANGED
|
@@ -298,6 +298,63 @@ export async function prDetails(url) {
|
|
|
298
298
|
}
|
|
299
299
|
}
|
|
300
300
|
|
|
301
|
+
// ---------------------------------------------------------------- review feedback on a PR
|
|
302
|
+
|
|
303
|
+
/** Marks a comment an agent posted, so it is never read back as feedback. */
|
|
304
|
+
export const AGENT_MARK = '<!-- agentmgr -->';
|
|
305
|
+
const TRUSTED = new Set(['OWNER', 'MEMBER', 'COLLABORATOR']);
|
|
306
|
+
const WHO = 'authorAssociation author { login __typename }';
|
|
307
|
+
const FEEDBACK_QUERY = `query($owner: String!, $name: String!, $number: Int!) { repository(owner: $owner, name: $name) { pullRequest(number: $number) {
|
|
308
|
+
comments(last: 50) { nodes { id url body createdAt ${WHO} } }
|
|
309
|
+
reviews(last: 30) { nodes { id url body state submittedAt ${WHO} } }
|
|
310
|
+
reviewThreads(last: 50) { nodes { isResolved comments(last: 20) { nodes { id databaseId url body createdAt path line originalLine ${WHO} } } } }
|
|
311
|
+
} } }`;
|
|
312
|
+
|
|
313
|
+
/** gh's GraphQL answer -> a flat list of comments, reviews and line comments. */
|
|
314
|
+
export function feedbackItems(pr) {
|
|
315
|
+
const who = (n) => ({ author: n.author?.login ?? 'someone', bot: n.author?.__typename === 'Bot', trusted: TRUSTED.has(n.authorAssociation) });
|
|
316
|
+
const items = [];
|
|
317
|
+
for (const n of pr?.comments?.nodes ?? []) items.push({ kind: 'comment', id: n.id, url: n.url, body: n.body ?? '', at: n.createdAt, ...who(n) });
|
|
318
|
+
for (const n of pr?.reviews?.nodes ?? []) items.push({ kind: 'review', id: n.id, url: n.url, body: n.body ?? '', at: n.submittedAt, state: n.state, ...who(n) });
|
|
319
|
+
for (const t of pr?.reviewThreads?.nodes ?? []) {
|
|
320
|
+
for (const n of t.comments?.nodes ?? []) {
|
|
321
|
+
items.push({ kind: 'line', id: n.id, dbId: n.databaseId ?? null, url: n.url, body: n.body ?? '', at: n.createdAt, path: n.path ?? null, line: n.line ?? n.originalLine ?? null, resolved: Boolean(t.isResolved), ...who(n) });
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return items.filter((i) => i.at);
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* The feedback an agent should act on, newer than `since`: from the repo's owners, members or
|
|
329
|
+
* collaborators (and review bots on the code), with text, not posted by an agent, not an approval,
|
|
330
|
+
* not in a resolved thread, and not a "/agent" command (those are passed on as they are).
|
|
331
|
+
*/
|
|
332
|
+
export function newFeedback(items, { since, prefix = null } = {}) {
|
|
333
|
+
const after = Date.parse(since ?? 0) || 0;
|
|
334
|
+
return items
|
|
335
|
+
.filter((i) => Date.parse(i.at) > after)
|
|
336
|
+
.filter((i) => i.body.trim() && !i.body.includes(AGENT_MARK))
|
|
337
|
+
.filter((i) => i.trusted || (i.bot && i.kind !== 'comment'))
|
|
338
|
+
.filter((i) => !(i.kind === 'review' && ['APPROVED', 'DISMISSED', 'PENDING'].includes(i.state)))
|
|
339
|
+
.filter((i) => !(i.kind === 'line' && i.resolved))
|
|
340
|
+
.filter((i) => !(prefix && i.body.trim().toLowerCase().startsWith(prefix.toLowerCase())))
|
|
341
|
+
.sort((a, b) => Date.parse(a.at) - Date.parse(b.at));
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
/** Every comment, review and line comment on a PR (null when gh can't say). */
|
|
345
|
+
export async function prFeedback(url) {
|
|
346
|
+
if (process.env.AGENTMGR_NO_GH) return null;
|
|
347
|
+
const m = url.match(/github\.com\/([\w.-]+)\/([\w.-]+)\/pull\/(\d+)/);
|
|
348
|
+
if (!m) return null;
|
|
349
|
+
try {
|
|
350
|
+
const out = await run(ghBin(), ['api', 'graphql', '-f', `query=${FEEDBACK_QUERY}`, '-F', `owner=${m[1]}`, '-F', `name=${m[2]}`, '-F', `number=${m[3]}`], { timeout: 30_000 });
|
|
351
|
+
const pr = JSON.parse(out)?.data?.repository?.pullRequest;
|
|
352
|
+
return pr ? feedbackItems(pr) : null;
|
|
353
|
+
} catch {
|
|
354
|
+
return null;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
|
|
301
358
|
// ---------------------------------------------------------------- session digest (for Explain)
|
|
302
359
|
|
|
303
360
|
const stripNoise = (s) =>
|