ai-agentmanager 1.28.0 → 1.30.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/src/today.js CHANGED
@@ -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
- items.push({ id: `issue:${r.key}`, kind: 'issue-review', label: 'Jira', title, why: r.note, score: 25, at: r.updatedAt ?? null, agentId: r.agent?.id ?? null, url: r.url ?? null, issueKey: r.key });
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();
@@ -102,8 +111,14 @@ export function todayItems({ inbox = [], issues = [], actions = [], reviews = []
102
111
  }
103
112
  // Bugs a hunt found and the check confirmed: the serious ones (the rest wait in the Bugs list).
104
113
  for (const f of findings) {
114
+ // Fixed without you: a draft pull request to look over.
115
+ if (f.status === 'pr') {
116
+ items.push({ id: `bug:${f.id}`, kind: 'bug-pr', label: 'Fix ready', title: f.title, why: `Fixed automatically (${f.severity}): a draft pull request; its test failed before and passes now${f.auto?.check ? ', and the judge reviewed it' : ''}`, score: 34, at: f.auto?.doneAt ?? f.at ?? null, findingId: f.id, url: f.prUrl ?? null });
117
+ continue;
118
+ }
105
119
  if (f.status !== 'open' || !['critical', 'high'].includes(f.severity)) continue;
106
- 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 });
120
+ const failed = f.auto?.state === 'failed' ? ` · the automatic fix didn't hold up: ${f.auto.reason}` : '';
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 });
107
122
  }
108
123
  return items.sort((x, y) => x.score - y.score || String(y.at ?? '').localeCompare(String(x.at ?? '')));
109
124
  }
@@ -118,7 +133,15 @@ export function todaySpeech(items, max = 8) {
118
133
  return parts;
119
134
  }
120
135
 
121
- const ASIDE = { skip: 'Skipped', done: 'Done', remove: 'Removed' };
136
+ const ASIDE = { skip: 'Skipped', snooze: 'Snoozed', done: 'Done', remove: 'Removed' };
137
+
138
+ /** How an agent's question is answered from Today: the choices it offered, and where an answer goes. */
139
+ function answerOf(i) {
140
+ if (i.kind === 'prompt') return { answer: { via: 'key', choices: (i.prompt?.choices ?? []).slice(0, 6).map((c) => ({ key: c.key, label: c.label })) } };
141
+ if (i.kind === 'waiting') return { answer: { via: 'waiting', choices: (i.waiting?.choices ?? []).slice(0, 6), reply: true } };
142
+ 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 } };
143
+ return {};
144
+ }
122
145
 
123
146
  /**
124
147
  * What you set aside from Today's lists (skipped, done, removed), newest first, so any of it can be
@@ -128,11 +151,11 @@ export function todayAside({ issues = [], actions = [], max = 50 } = {}) {
128
151
  const out = [];
129
152
  for (const r of issues) {
130
153
  if (!ASIDE[r.action]) continue;
131
- 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 });
154
+ 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 });
132
155
  }
133
156
  for (const a of actions) {
134
157
  if (!ASIDE[a.status]) continue;
135
- 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 });
158
+ 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 });
136
159
  }
137
160
  return out.sort((x, y) => String(y.at ?? '').localeCompare(String(x.at ?? ''))).slice(0, max);
138
161
  }