ai-agentmanager 1.23.0 → 1.25.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 +18 -0
- package/package.json +1 -1
- package/public/actions.js +200 -0
- package/public/app.js +45 -4
- package/public/diagram.js +38 -0
- package/public/index.html +13 -0
- package/public/issues.js +82 -28
- package/public/keys.js +21 -2
- package/public/menu.js +13 -0
- package/public/rowkeys.js +54 -0
- package/public/share.js +3 -2
- package/public/speak.js +69 -2
- package/public/standup.js +43 -9
- package/public/style.css +19 -1
- package/src/actions.js +172 -0
- package/src/assistant.js +64 -5
- package/src/cli.js +69 -2
- package/src/issues.js +141 -20
- package/src/jira.js +75 -2
- package/src/manager.js +20 -9
- package/src/server.js +27 -3
package/public/keys.js
CHANGED
|
@@ -19,6 +19,9 @@ export const SHORTCUTS = [
|
|
|
19
19
|
[['p'], 'Play the standup', 'standup'],
|
|
20
20
|
[['m'], 'Map: where agents are in the code', 'map'],
|
|
21
21
|
[['i'], 'Jira: issues waiting for your review', 'issues'],
|
|
22
|
+
[['o'], "Actions: what's asked of you in Slack and meetings", 'actions'],
|
|
23
|
+
[['h'], 'Assistant', 'assistant'],
|
|
24
|
+
[[','], 'Settings', 'settings'],
|
|
22
25
|
[['d'], 'Designs: agents\' design docs', 'designs'],
|
|
23
26
|
[['g'], 'Reviews: pull requests you review', 'reviews'],
|
|
24
27
|
[['v'], 'Value: what the work is worth', 'value'],
|
|
@@ -29,6 +32,22 @@ export const SHORTCUTS = [
|
|
|
29
32
|
[['5'], 'Built agents', 'tab:built'],
|
|
30
33
|
[['?'], 'These shortcuts', 'help'],
|
|
31
34
|
]],
|
|
35
|
+
['In the Jira and Actions lists', [
|
|
36
|
+
[['j', 'k'], 'Next / previous row', null],
|
|
37
|
+
[['[', ']'], 'Previous / next filter', null],
|
|
38
|
+
[['a'], 'Assign (starts an agent)', null],
|
|
39
|
+
[['s'], 'Skip', null],
|
|
40
|
+
[['d'], 'Done', null],
|
|
41
|
+
[['x'], 'Remove', null],
|
|
42
|
+
[['o'], 'Undecided again (Actions) or clear (Jira)', null],
|
|
43
|
+
[['c'], 'Discuss it with Claude (Actions)', null],
|
|
44
|
+
[['Enter'], 'Open the issue or where it was asked', null],
|
|
45
|
+
[['r'], 'Look again', null],
|
|
46
|
+
]],
|
|
47
|
+
['In the standup', [
|
|
48
|
+
[['Space'], 'Play or pause', null],
|
|
49
|
+
[['←', '→'], 'Previous / next agent', null],
|
|
50
|
+
]],
|
|
32
51
|
['In a terminal', [
|
|
33
52
|
[['Ctrl+Shift+↓'], "Next agent's terminal", 'next-term'],
|
|
34
53
|
[['Ctrl+Shift+↑'], "Previous agent's terminal", 'prev-term'],
|
|
@@ -40,11 +59,11 @@ export const SHORTCUTS = [
|
|
|
40
59
|
// A single key, as an event names it, to its action.
|
|
41
60
|
export const SINGLE = {
|
|
42
61
|
j: 'next', k: 'prev', Enter: 'terminal', t: 'terminal',
|
|
43
|
-
r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', d: 'designs', g: 'reviews', v: 'value', '?': 'help',
|
|
62
|
+
r: 'changes', s: 'start', X: 'stop', e: 'edit', n: 'new', a: 'ask', '/': 'filter', w: 'watch', p: 'standup', m: 'map', i: 'issues', o: 'actions', h: 'assistant', ',': 'settings', d: 'designs', g: 'reviews', v: 'value', '?': 'help',
|
|
44
63
|
1: 'tab:agents', 2: 'tab:inbox', 3: 'tab:backlog', 4: 'tab:land', 5: 'tab:built',
|
|
45
64
|
};
|
|
46
65
|
// While Watch is open: only what makes sense there.
|
|
47
|
-
const ON_WATCH = new Set(['new', 'ask', 'watch', 'standup', 'map', 'issues', 'designs', 'reviews', 'value', 'help']);
|
|
66
|
+
const ON_WATCH = new Set(['new', 'ask', 'watch', 'standup', 'map', 'issues', 'actions', 'assistant', 'settings', 'designs', 'reviews', 'value', 'help']);
|
|
48
67
|
|
|
49
68
|
/** Typing somewhere: a field, an editor or a terminal (xterm types through a textarea). */
|
|
50
69
|
const typing = (el) => Boolean(el?.closest?.('input, textarea, select, [contenteditable=""], [contenteditable="true"], .xterm, .cm-editor'));
|
package/public/menu.js
CHANGED
|
@@ -56,6 +56,8 @@ export function initMenu({ api, esc, toast, $ }) {
|
|
|
56
56
|
let service = null; // the login service as the dialog opened
|
|
57
57
|
let jira = null; // the Jira settings as the dialog opened
|
|
58
58
|
let containers = null; // Docker and the agent image as the dialog opened
|
|
59
|
+
let features = null; // what you use, and who you are, as the dialog opened
|
|
60
|
+
const FEATURE_KEYS = ['jira', 'slack', 'gemini'];
|
|
59
61
|
function showContainers() {
|
|
60
62
|
const c = containers;
|
|
61
63
|
$('#settings-containers').hidden = !c;
|
|
@@ -93,6 +95,10 @@ export function initMenu({ api, esc, toast, $ }) {
|
|
|
93
95
|
$('#settings-running').textContent = `Open now: ${c.running}.`;
|
|
94
96
|
service = null;
|
|
95
97
|
showRules(await api('GET', '/rules').catch(() => null));
|
|
98
|
+
features = await api('GET', '/features').catch(() => null);
|
|
99
|
+
$('#settings-features').hidden = !features;
|
|
100
|
+
for (const k of FEATURE_KEYS) form[`feat_${k}`].checked = features?.features?.[k] !== false;
|
|
101
|
+
form.me.value = features?.me ?? '';
|
|
96
102
|
const u = await api('GET', '/update').catch(() => null);
|
|
97
103
|
form.updateCheck.checked = u?.check !== false;
|
|
98
104
|
if (!remote()) {
|
|
@@ -145,6 +151,13 @@ export function initMenu({ api, esc, toast, $ }) {
|
|
|
145
151
|
try {
|
|
146
152
|
const c = await api('PUT', '/cleanup', { maxRunning: form.maxRunning.value.trim() || null });
|
|
147
153
|
await api('PUT', '/update', { check: form.updateCheck.checked }).catch(() => {});
|
|
154
|
+
if (features) {
|
|
155
|
+
const want = Object.fromEntries(FEATURE_KEYS.map((k) => [k, form[`feat_${k}`].checked]));
|
|
156
|
+
if (FEATURE_KEYS.some((k) => want[k] !== features.features[k]) || form.me.value.trim() !== (features.me ?? '')) {
|
|
157
|
+
const r = await api('PUT', '/features', { features: want, me: form.me.value });
|
|
158
|
+
document.dispatchEvent(new CustomEvent('agentmgr:features', { detail: r.features }));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
148
161
|
if (!remote() && jira && (form.jiraSite.value.trim() !== (jira.site ?? '') || form.jiraEmail.value.trim() !== (jira.email ?? '') || form.jiraToken.value.trim())) {
|
|
149
162
|
await api('PUT', '/jira', { site: form.jiraSite.value.trim(), email: form.jiraEmail.value.trim(), token: form.jiraToken.value.trim() || undefined });
|
|
150
163
|
toast('Jira saved; summaries for agents from Jira links are being fetched', 4000);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// Keys inside a list dialog (Jira, Actions): j / k move between rows, [ and ] between filters,
|
|
2
|
+
// and the dialog's own keys act on the selected row. Not while typing in a field.
|
|
3
|
+
|
|
4
|
+
const typing = (el) => Boolean(el?.closest?.('input:not([type="checkbox"]), textarea, [contenteditable=""], [contenteditable="true"]'));
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* `rows()` gives the row elements in order; `keys` maps a key to (row) => void; `filters()` gives
|
|
8
|
+
* the filter buttons. The selected row is marked with the class "kb-on" and kept by `idOf(row)`.
|
|
9
|
+
*/
|
|
10
|
+
export function rowKeys(dialog, { rows, keys = {}, filters = () => [], idOf = (r) => r.dataset.rowId }) {
|
|
11
|
+
let selected = null;
|
|
12
|
+
const mark = () => {
|
|
13
|
+
const list = rows();
|
|
14
|
+
let row = list.find((r) => idOf(r) === selected);
|
|
15
|
+
if (!row && selected !== null) row = list[0];
|
|
16
|
+
for (const r of list) r.classList.toggle('kb-on', r === row);
|
|
17
|
+
return row ?? null;
|
|
18
|
+
};
|
|
19
|
+
const move = (step) => {
|
|
20
|
+
const list = rows();
|
|
21
|
+
if (!list.length) return;
|
|
22
|
+
const i = list.findIndex((r) => idOf(r) === selected);
|
|
23
|
+
const next = list[Math.max(0, Math.min(list.length - 1, i < 0 ? 0 : i + step))];
|
|
24
|
+
selected = idOf(next);
|
|
25
|
+
mark();
|
|
26
|
+
next.scrollIntoView({ block: 'nearest' });
|
|
27
|
+
};
|
|
28
|
+
dialog.addEventListener('keydown', (e) => {
|
|
29
|
+
if (e.defaultPrevented || e.isComposing || e.metaKey || e.ctrlKey || e.altKey || typing(e.target)) return;
|
|
30
|
+
// A focused select or checkbox keeps its own arrow keys; ours are letters.
|
|
31
|
+
if (e.key === 'j' || e.key === 'k') {
|
|
32
|
+
e.preventDefault();
|
|
33
|
+
return move(e.key === 'j' ? 1 : -1);
|
|
34
|
+
}
|
|
35
|
+
if (e.key === '[' || e.key === ']') {
|
|
36
|
+
const fs = filters();
|
|
37
|
+
const i = fs.findIndex((f) => f.classList.contains('active'));
|
|
38
|
+
const next = fs[(i + (e.key === ']' ? 1 : -1) + fs.length) % fs.length];
|
|
39
|
+
if (next) {
|
|
40
|
+
e.preventDefault();
|
|
41
|
+
next.click();
|
|
42
|
+
}
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const fn = keys[e.key];
|
|
46
|
+
if (!fn) return;
|
|
47
|
+
const row = mark();
|
|
48
|
+
if (!row && fn.needsRow !== false) return;
|
|
49
|
+
e.preventDefault();
|
|
50
|
+
fn(row);
|
|
51
|
+
});
|
|
52
|
+
/** After the list is drawn again: keep the selection on the same row. */
|
|
53
|
+
return { redraw: mark, clear: () => (selected = null) };
|
|
54
|
+
}
|
package/public/share.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Print-ready view of one agent document: /share.html#<agent id>/<analysis|design|flow|proposal>
|
|
2
2
|
import { marked } from '/vendor/marked/marked.esm.js';
|
|
3
3
|
import DOMPurify from '/vendor/dompurify/purify.es.mjs';
|
|
4
|
+
import { drawDiagram } from '/diagram.js';
|
|
4
5
|
|
|
5
6
|
const $ = (s) => document.querySelector(s);
|
|
6
7
|
const esc = (s) => String(s ?? '').replace(/[&<>"']/g, (c) => ({ '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' })[c]);
|
|
@@ -24,10 +25,10 @@ async function main() {
|
|
|
24
25
|
document.title = (d.markdown.match(/^#\s+(.+)$/m)?.[1] ?? `${kind} · ${a.name}`).slice(0, 120);
|
|
25
26
|
if (blocks.length) {
|
|
26
27
|
const mermaid = (await import('/vendor/mermaid/mermaid.esm.min.mjs')).default;
|
|
27
|
-
mermaid.initialize({ startOnLoad: false, securityLevel: 'strict', theme: 'default', htmlLabels: false, flowchart: { htmlLabels: false } });
|
|
28
|
+
mermaid.initialize({ startOnLoad: false, suppressErrorRendering: true, securityLevel: 'strict', theme: 'default', htmlLabels: false, flowchart: { htmlLabels: false } });
|
|
28
29
|
for (const el of document.querySelectorAll('.diagram')) {
|
|
29
30
|
try {
|
|
30
|
-
el.innerHTML = (await mermaid
|
|
31
|
+
el.innerHTML = (await drawDiagram(mermaid, `d${el.dataset.i}`, blocks[Number(el.dataset.i)])).svg;
|
|
31
32
|
} catch {
|
|
32
33
|
el.innerHTML = `<pre>${esc(blocks[Number(el.dataset.i)])}</pre>`;
|
|
33
34
|
}
|
package/public/speak.js
CHANGED
|
@@ -1,9 +1,72 @@
|
|
|
1
1
|
// Listening instead of reading: Explain, the documents and the change walkthrough read aloud with
|
|
2
|
-
// the browser's own speech (
|
|
2
|
+
// the browser's own speech (on-device voices only unless you pick an online one; it works on
|
|
3
|
+
// phones). The clearest voice here is used, never the robotic or novelty ones. Text goes in short
|
|
3
4
|
// pieces, since some browsers stop a long utterance partway. One thing plays at a time.
|
|
4
5
|
|
|
5
6
|
const RATES = [0.85, 1, 1.25, 1.5, 1.75];
|
|
6
7
|
const RATE_KEY = 'agentmgr.speechRate';
|
|
8
|
+
const VOICE_KEY = 'agentmgr.voice';
|
|
9
|
+
|
|
10
|
+
// Voices that sound robotic or are made for fun: macOS's old and Eloquence voices, and its
|
|
11
|
+
// novelty ones. Not used unless chosen by name.
|
|
12
|
+
const ROBOTIC = /^(Albert|Bad News|Bahh|Bells|Boing|Bruce|Bubbles|Cellos|Deranged|Eddy|Flo|Fred|Good News|Grandma|Grandpa|Hysterical|Jester|Junior|Kathy|Organ|Pipe Organ|Princess|Ralph|Reed|Rocko|Sandy|Shelley|Superstar|Trinoids|Vicki|Victoria|Whisper|Wobble|Zarvox)\b/i;
|
|
13
|
+
// Clear, natural voices: the downloadable high-quality ones, Siri's, Edge's neural and Google's.
|
|
14
|
+
const NATURAL = /\b(Premium|Enhanced|Siri|Natural|Neural|Online)\b|^Google /i;
|
|
15
|
+
const CLEAR = /^(Samantha|Alex|Ava|Allison|Susan|Tom|Karen|Daniel|Moira|Tessa|Serena|Zoe|Evan|Nathan|Joelle|Noelle|Aaron|Nicky|Rishi|Veena|Lee)\b/i;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* How good a voice sounds for reading aloud in `lang` ("en-US"); below 0 means don't use it.
|
|
19
|
+
* Online voices (Chrome's Google ones) send the text to their maker, so they count only when
|
|
20
|
+
* `online` (you pick one by name).
|
|
21
|
+
*/
|
|
22
|
+
export function voiceScore(v, lang = 'en-US', { online = false } = {}) {
|
|
23
|
+
const want = String(lang).toLowerCase();
|
|
24
|
+
const have = String(v?.lang ?? '').toLowerCase().replace('_', '-');
|
|
25
|
+
if (!have.startsWith(want.slice(0, 2)) || ROBOTIC.test(v.name ?? '')) return -1;
|
|
26
|
+
if (v.localService === false && !online) return -1;
|
|
27
|
+
return (NATURAL.test(v.name) ? 6 : 0) + (CLEAR.test(v.name) ? 3 : 0) + (have === want ? 2 : 0) + (v.default ? 1 : 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The voices worth using for `lang`, best first. */
|
|
31
|
+
export function rankVoices(voices = [], lang = 'en-US', opts = {}) {
|
|
32
|
+
return voices
|
|
33
|
+
.map((v) => ({ v, s: voiceScore(v, lang, opts) }))
|
|
34
|
+
.filter((x) => x.s >= 0)
|
|
35
|
+
.sort((a, b) => b.s - a.s || String(a.v.name).localeCompare(String(b.v.name)))
|
|
36
|
+
.map((x) => x.v);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const lang = () => (typeof navigator !== 'undefined' && navigator.language) || 'en-US';
|
|
40
|
+
|
|
41
|
+
/** This browser's good voices for the page's language, best first (`online`: those too). */
|
|
42
|
+
export function goodVoices(opts = {}) {
|
|
43
|
+
return canSpeak() ? rankVoices(speechSynthesis.getVoices(), lang(), opts) : [];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** The voice you picked (by name), or null for "the best one here". */
|
|
47
|
+
export function chosenVoice() {
|
|
48
|
+
try {
|
|
49
|
+
return localStorage.getItem(VOICE_KEY) || null;
|
|
50
|
+
} catch {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function setVoice(name) {
|
|
56
|
+
try {
|
|
57
|
+
if (name) localStorage.setItem(VOICE_KEY, name);
|
|
58
|
+
else localStorage.removeItem(VOICE_KEY);
|
|
59
|
+
} catch {}
|
|
60
|
+
notify();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** The voice to read with when none is given: yours, else the best one here. */
|
|
64
|
+
export function preferredVoice() {
|
|
65
|
+
if (!canSpeak()) return null;
|
|
66
|
+
const name = chosenVoice();
|
|
67
|
+
const all = speechSynthesis.getVoices();
|
|
68
|
+
return (name && all.find((v) => v.name === name)) || goodVoices()[0] || null;
|
|
69
|
+
}
|
|
7
70
|
|
|
8
71
|
export const canSpeak = () => typeof window !== 'undefined' && 'speechSynthesis' in window && 'SpeechSynthesisUtterance' in window;
|
|
9
72
|
|
|
@@ -60,7 +123,11 @@ function playNext() {
|
|
|
60
123
|
const part = s.parts[s.i];
|
|
61
124
|
const u = new SpeechSynthesisUtterance(part.text);
|
|
62
125
|
u.rate = rate();
|
|
63
|
-
|
|
126
|
+
const voice = part.voice ?? preferredVoice();
|
|
127
|
+
if (voice) {
|
|
128
|
+
u.voice = voice;
|
|
129
|
+
u.lang = voice.lang;
|
|
130
|
+
}
|
|
64
131
|
u.onstart = () => part.onStart?.();
|
|
65
132
|
u.onend = () => {
|
|
66
133
|
if (session !== s || s.paused) return;
|
package/public/standup.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
// When an agent needs you it stops on it with its questions beside it, answered by tap (the
|
|
3
3
|
// inbox's own cards) or, when turned on, by voice: what you say is read back and sent on "send".
|
|
4
4
|
|
|
5
|
-
import { canSpeak, cycleRate, pause, play, rateLabel, resume, stop, now as speaking } from '/speak.js';
|
|
5
|
+
import { canSpeak, chosenVoice, cycleRate, goodVoices, voiceScore, pause, play, rateLabel, resume, setVoice, speakable, stop, now as speaking } from '/speak.js';
|
|
6
6
|
import { choiceFor } from '/voice.js';
|
|
7
7
|
|
|
8
8
|
const VOICE_KEY = 'agentmgr.standupVoice';
|
|
9
9
|
const PLAY_ID = 'standup';
|
|
10
10
|
const Recognition = typeof window !== 'undefined' ? window.SpeechRecognition || window.webkitSpeechRecognition : null;
|
|
11
11
|
|
|
12
|
-
//
|
|
13
|
-
const
|
|
12
|
+
// Agents take turns among this many of the best voices (fewer when fewer sound good).
|
|
13
|
+
const MIXED = 4;
|
|
14
14
|
const hash = (s) => [...String(s)].reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 7);
|
|
15
15
|
export function initStandup({ api, $, esc, agents, needsFor, needCard, onNeed, toast, openAgent }) {
|
|
16
16
|
const dialog = $('#standup-dialog');
|
|
@@ -26,18 +26,29 @@ export function initStandup({ api, $, esc, agents, needsFor, needCard, onNeed, t
|
|
|
26
26
|
voiceOn = localStorage.getItem(VOICE_KEY) === '1';
|
|
27
27
|
} catch {}
|
|
28
28
|
|
|
29
|
-
// Each agent keeps one
|
|
29
|
+
// Each agent keeps one of the few best voices here, unless you picked one voice for all; robotic
|
|
30
|
+
// and novelty voices are never used. The intro uses the best one (or yours).
|
|
30
31
|
let voices = [];
|
|
32
|
+
let pickable = [];
|
|
31
33
|
const loadVoices = () => {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
voices = goodVoices();
|
|
35
|
+
pickable = goodVoices({ online: true }).slice(0, 15);
|
|
36
|
+
if (dialog.open) render();
|
|
35
37
|
};
|
|
36
38
|
if (canSpeak()) {
|
|
37
39
|
loadVoices();
|
|
38
40
|
speechSynthesis.addEventListener?.('voiceschanged', loadVoices);
|
|
39
41
|
}
|
|
40
|
-
const voiceFor = (id) =>
|
|
42
|
+
const voiceFor = (id) => {
|
|
43
|
+
if (chosenVoice()) return null;
|
|
44
|
+
// Only voices about as good as the best: a mix that includes a poor one sounds worse than one voice.
|
|
45
|
+
const lang = navigator.language || 'en-US';
|
|
46
|
+
const top = voices[0] ? voiceScore(voices[0], lang) : 0;
|
|
47
|
+
const best = voices.slice(0, MIXED).filter((v) => voiceScore(v, lang) >= top - 2);
|
|
48
|
+
return best.length > 1 ? best[hash(id) % best.length] : null;
|
|
49
|
+
};
|
|
50
|
+
// Names as they'd be said: "WEB-41" → "WEB 41", "fix-login-timeout" → "fix login timeout".
|
|
51
|
+
const sayName = (name) => String(name ?? '').replace(/[-_/]+/g, ' ');
|
|
41
52
|
|
|
42
53
|
const items = () => latest?.items ?? [];
|
|
43
54
|
const current = () => items()[idx] ?? null;
|
|
@@ -106,7 +117,7 @@ export function initStandup({ api, $, esc, agents, needsFor, needCard, onNeed, t
|
|
|
106
117
|
return play(PLAY_ID, ["That's everything."], {});
|
|
107
118
|
}
|
|
108
119
|
const it = current();
|
|
109
|
-
const text = it ? `${it.name}. ${it.text}` : latest?.intro ?? '';
|
|
120
|
+
const text = speakable(it ? `${sayName(it.name)}. ${it.text}` : latest?.intro ?? '');
|
|
110
121
|
state = 'playing';
|
|
111
122
|
render();
|
|
112
123
|
const started = play(PLAY_ID, [{ text, voice: it ? voiceFor(it.agentId) : null }], {
|
|
@@ -268,6 +279,10 @@ export function initStandup({ api, $, esc, agents, needsFor, needCard, onNeed, t
|
|
|
268
279
|
<button class="primary" data-su="play" title="${playingNow ? 'Pause' : 'Play'}" ${canSpeak() ? '' : 'disabled'}>${playingNow ? '⏸' : '▶'}</button>
|
|
269
280
|
<button data-su="next" title="Next" ${idx >= list.length ? 'disabled' : ''}>⏭</button>
|
|
270
281
|
<button class="small" data-su="rate" title="Speed">${esc(rateLabel())}</button>
|
|
282
|
+
${pickable.length ? `<select class="small standup-voice-pick" data-su-voice title="Voice: a mix of the best voices here, or one for everything read aloud" aria-label="Voice">
|
|
283
|
+
<option value="" ${chosenVoice() ? '' : 'selected'}>Best voices</option>
|
|
284
|
+
${pickable.map((v) => `<option value="${esc(v.name)}" ${chosenVoice() === v.name ? 'selected' : ''}>${esc(v.name)}${v.localService === false ? ' · online' : ''}</option>`).join('')}
|
|
285
|
+
</select>` : ''}
|
|
271
286
|
<span class="spacer"></span>
|
|
272
287
|
${Recognition ? `<label class="check" title="Answer agents by speaking. Your browser may send the audio to its maker to turn it into text."><input type="checkbox" data-su="voice" ${voiceOn ? 'checked' : ''}> Answer by voice</label>` : ''}
|
|
273
288
|
</div>
|
|
@@ -279,6 +294,19 @@ export function initStandup({ api, $, esc, agents, needsFor, needCard, onNeed, t
|
|
|
279
294
|
</details>` : ''}`;
|
|
280
295
|
}
|
|
281
296
|
|
|
297
|
+
// Space plays or pauses, the arrows move between agents (not while typing an answer).
|
|
298
|
+
dialog.addEventListener('keydown', (e) => {
|
|
299
|
+
if (e.defaultPrevented || e.metaKey || e.ctrlKey || e.altKey || e.target.closest?.('input:not([type="checkbox"]), textarea, select, [contenteditable]')) return;
|
|
300
|
+
if (e.key === ' ' && !e.target.closest?.('button')) {
|
|
301
|
+
e.preventDefault();
|
|
302
|
+
return toggle();
|
|
303
|
+
}
|
|
304
|
+
if (e.key === 'ArrowRight' || e.key === 'ArrowLeft') {
|
|
305
|
+
e.preventDefault();
|
|
306
|
+
return playFrom(idx + (e.key === 'ArrowRight' ? 1 : -1));
|
|
307
|
+
}
|
|
308
|
+
});
|
|
309
|
+
|
|
282
310
|
body.addEventListener('click', (e) => {
|
|
283
311
|
if (e.target.closest('[data-need]')) return onNeed(e);
|
|
284
312
|
const el = e.target.closest('[data-su]');
|
|
@@ -309,6 +337,12 @@ export function initStandup({ api, $, esc, agents, needsFor, needCard, onNeed, t
|
|
|
309
337
|
}
|
|
310
338
|
});
|
|
311
339
|
body.addEventListener('change', async (e) => {
|
|
340
|
+
if (e.target.dataset.suVoice !== undefined) {
|
|
341
|
+
setVoice(e.target.value || null);
|
|
342
|
+
// Hear it right away.
|
|
343
|
+
if (state !== 'playing') play(PLAY_ID, [`This is how the standup sounds.`], {});
|
|
344
|
+
return render();
|
|
345
|
+
}
|
|
312
346
|
if (e.target.dataset.su === 'voice') {
|
|
313
347
|
voiceOn = e.target.checked;
|
|
314
348
|
try {
|
package/public/style.css
CHANGED
|
@@ -1067,6 +1067,8 @@ kbd { display: inline-block; min-width: 1.6em; padding: 1px 5px; border: 1px sol
|
|
|
1067
1067
|
.standup-dialog { width: min(720px, calc(100% - 32px)); max-height: calc(100% - 32px); padding: 16px; }
|
|
1068
1068
|
.standup-top { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
|
|
1069
1069
|
.standup-top .spacer, .standup-controls .spacer { flex: 1; }
|
|
1070
|
+
.standup-controls .standup-voice-pick { width: auto; max-width: 170px; flex: none; font-size: 12px; padding: 3px 6px; }
|
|
1071
|
+
.standup-controls label.check input[type="checkbox"] { width: auto; flex: none; }
|
|
1070
1072
|
.standup-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
|
|
1071
1073
|
.standup-chip { font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--border); background: var(--panel); cursor: pointer; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
1072
1074
|
.standup-chip.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
|
|
@@ -1144,6 +1146,14 @@ table.issues td { padding: 7px 10px; border-bottom: 1px solid var(--border); ver
|
|
|
1144
1146
|
table.issues tr:last-child td { border-bottom: 0; }
|
|
1145
1147
|
table.issues .issue-key { font-family: var(--mono); font-weight: 600; white-space: nowrap; }
|
|
1146
1148
|
table.issues .issue-title { max-width: 360px; color: var(--text); }
|
|
1149
|
+
table.issues .issue-synopsis { max-width: 420px; margin-top: 2px; font-size: 12px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
|
|
1150
|
+
table.issues .issue-action { width: 1%; white-space: nowrap; }
|
|
1151
|
+
table.issues .issue-type { font-size: 10px; font-weight: 600; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); white-space: nowrap; }
|
|
1152
|
+
table.issues .issue-action select { width: auto; font-size: 12px; padding: 2px 4px; }
|
|
1153
|
+
table.issues select.act-skip { color: var(--yellow); }
|
|
1154
|
+
table.issues select.act-done { color: var(--green); }
|
|
1155
|
+
table.issues select.act-remove { color: var(--red); }
|
|
1156
|
+
table.issues tr.action-skip td:not(.issue-action), table.issues tr.action-remove td:not(.issue-action) { opacity: 0.65; }
|
|
1147
1157
|
table.issues tr td:first-child { border-left: 3px solid transparent; }
|
|
1148
1158
|
table.issues tr.stage-review td:first-child, table.issues tr.stage-approved td:first-child { border-left-color: var(--green); }
|
|
1149
1159
|
table.issues tr.stage-needs td:first-child, table.issues tr.stage-blocked td:first-child { border-left-color: var(--red); }
|
|
@@ -1163,7 +1173,7 @@ table.issues .dot.idle { background: var(--muted); }
|
|
|
1163
1173
|
@media (max-width: 640px) {
|
|
1164
1174
|
.issues-dialog { width: calc(100% - 32px); padding: 12px; }
|
|
1165
1175
|
table.issues .col-active { display: none; }
|
|
1166
|
-
table.issues .issue-title { max-width: 200px; }
|
|
1176
|
+
table.issues .issue-title, table.issues .issue-synopsis { max-width: 200px; }
|
|
1167
1177
|
}
|
|
1168
1178
|
|
|
1169
1179
|
/* ---------- Designs: agents' design docs */
|
|
@@ -1268,3 +1278,11 @@ input.inline { width: 64px; display: inline-block; padding: 2px 4px; }
|
|
|
1268
1278
|
}
|
|
1269
1279
|
.rv-card input[type="checkbox"] { width: auto; flex: none; margin: 0; }
|
|
1270
1280
|
.rv-item input[type="checkbox"] { margin-top: 4px; }
|
|
1281
|
+
|
|
1282
|
+
/* ---------- Lists you move through with j / k (Jira, Actions) */
|
|
1283
|
+
table.issues tr.kb-on td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
|
|
1284
|
+
table.issues tr.kb-on td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
|
|
1285
|
+
.actions-table .action-text { font-weight: 600; color: var(--text); }
|
|
1286
|
+
.actions-table .action-meta { margin-top: 3px; }
|
|
1287
|
+
.actions-table .action-due { color: var(--yellow); font-weight: 600; }
|
|
1288
|
+
.actions-table tr.action-skip td:not(.issue-action), .actions-table tr.action-remove td:not(.issue-action), .actions-table tr.action-done td:not(.issue-action) { opacity: 0.65; }
|
package/src/actions.js
ADDED
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// My actions: what's asked of you in Slack and in meeting notes (Google Meet's "Notes by Gemini"),
|
|
2
|
+
// found by the assistant on its checks and kept in one list, so nothing is missed or has to be
|
|
3
|
+
// remembered. Each one has your decision on it, as for Jira issues: assign (an agent does it),
|
|
4
|
+
// skip, done or remove, kept in state.json and changeable any time; Discuss opens a conversation
|
|
5
|
+
// about it. Nothing is ever sent to Slack or anywhere else from here.
|
|
6
|
+
|
|
7
|
+
import crypto from 'node:crypto';
|
|
8
|
+
|
|
9
|
+
export const ACTION_SOURCES = { slack: 'Slack', gemini: 'Meeting notes', other: 'Other' };
|
|
10
|
+
export const ACTION_STATES = ['open', 'assign', 'skip', 'done', 'remove'];
|
|
11
|
+
const GROUP = { open: 'open', assign: 'assigned', skip: 'skipped', done: 'done', remove: 'removed' };
|
|
12
|
+
const MAX = 500;
|
|
13
|
+
const err = (status, message) => Object.assign(new Error(message), { status });
|
|
14
|
+
const clip = (s, n) => {
|
|
15
|
+
const t = String(s ?? '').replace(/\s+/g, ' ').trim();
|
|
16
|
+
return t.length > n ? `${t.slice(0, n - 1)}…` : t;
|
|
17
|
+
};
|
|
18
|
+
const norm = (s) => String(s ?? '').toLowerCase().replace(/[^a-z0-9]+/g, ' ').trim();
|
|
19
|
+
|
|
20
|
+
/** The request an agent gets when you assign an action to one. */
|
|
21
|
+
export function actionIntent(a) {
|
|
22
|
+
return [
|
|
23
|
+
a.text,
|
|
24
|
+
a.link ? `\nAsked in ${ACTION_SOURCES[a.source] ?? a.source}${a.from ? ` by ${a.from}` : ''}: ${a.link}` : a.from ? `\nAsked by ${a.from}.` : '',
|
|
25
|
+
a.due ? `Due: ${a.due}.` : '',
|
|
26
|
+
a.context ? `\nContext: ${a.context}` : '',
|
|
27
|
+
]
|
|
28
|
+
.filter(Boolean)
|
|
29
|
+
.join('\n')
|
|
30
|
+
.trim();
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** What Discuss starts with: a conversation to decide what to do about the action. */
|
|
34
|
+
export function discussPrompt(a, bin = 'agentmgr') {
|
|
35
|
+
return [
|
|
36
|
+
`Help me decide what to do about something asked of me. Talk it through with me; don't act on your own.`,
|
|
37
|
+
'',
|
|
38
|
+
`The action: ${a.text}`,
|
|
39
|
+
a.from ? `Asked by: ${a.from}` : '',
|
|
40
|
+
a.link ? `Where: ${ACTION_SOURCES[a.source] ?? a.source}, ${a.link}` : `Where: ${ACTION_SOURCES[a.source] ?? a.source}`,
|
|
41
|
+
a.due ? `Due: ${a.due}` : '',
|
|
42
|
+
a.context ? `Context: ${a.context}` : '',
|
|
43
|
+
'',
|
|
44
|
+
`If you can, read the source first (your Slack or Google Drive tools) for the full picture. Then tell me in a few lines what it really asks and suggest one of: do it myself (with the steps), hand it to a coding agent (draft the request), reply or delegate (draft the message for me to send), or drop it (and why).`,
|
|
45
|
+
`Never send a message, comment or email yourself. When we've decided, record it: ${bin} actions set <done|skip|remove> ${a.id}, or ${bin} actions set assign ${a.id} --project <project> to give it to an agent.`,
|
|
46
|
+
]
|
|
47
|
+
.filter((l) => l !== '')
|
|
48
|
+
.join('\n');
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export class MyActions {
|
|
52
|
+
constructor({ store, manager }) {
|
|
53
|
+
this.store = store;
|
|
54
|
+
this.manager = manager;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
get all() {
|
|
58
|
+
return (this.store.data.myActions ??= []);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
find(id) {
|
|
62
|
+
const a = this.all.find((x) => x.id === id);
|
|
63
|
+
if (!a) throw err(404, `No action ${id}`);
|
|
64
|
+
return a;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/** Add one (the assistant does, on its checks). The same action from the same place is kept once. */
|
|
68
|
+
add({ text, source = 'other', link = null, from = null, when = null, due = null, context = null, by = null } = {}) {
|
|
69
|
+
const t = clip(text, 400);
|
|
70
|
+
if (t.length < 3) throw err(400, 'Say what the action is');
|
|
71
|
+
if (!ACTION_SOURCES[source]) throw err(400, `The source is one of ${Object.keys(ACTION_SOURCES).join(', ')}`);
|
|
72
|
+
const url = link ? String(link).trim() : null;
|
|
73
|
+
if (url && !/^https?:\/\/\S+$/.test(url)) throw err(400, 'The link is an http(s) address');
|
|
74
|
+
const key = `${url ?? ''}#${norm(t).slice(0, 120)}`;
|
|
75
|
+
const prev = this.all.find((x) => x.key === key);
|
|
76
|
+
if (prev) return { ...prev, duplicate: true };
|
|
77
|
+
const a = {
|
|
78
|
+
id: crypto.randomBytes(3).toString('hex'),
|
|
79
|
+
key,
|
|
80
|
+
text: t,
|
|
81
|
+
source,
|
|
82
|
+
link: url,
|
|
83
|
+
from: from ? clip(from, 80) : null,
|
|
84
|
+
when: when && !Number.isNaN(Date.parse(when)) ? new Date(when).toISOString() : new Date().toISOString(),
|
|
85
|
+
due: due ? clip(due, 40) : null,
|
|
86
|
+
context: context ? clip(context, 1000) : null,
|
|
87
|
+
by: by ?? null,
|
|
88
|
+
status: 'open',
|
|
89
|
+
at: new Date().toISOString(),
|
|
90
|
+
};
|
|
91
|
+
this.all.push(a);
|
|
92
|
+
// Old decided ones go first when the list grows long.
|
|
93
|
+
while (this.all.length > MAX) {
|
|
94
|
+
const i = this.all.findIndex((x) => x.status !== 'open');
|
|
95
|
+
this.all.splice(i < 0 ? 0 : i, 1);
|
|
96
|
+
}
|
|
97
|
+
this.store.save();
|
|
98
|
+
return a;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/** The list, open ones first, newest first within: rows with their group and agents. */
|
|
102
|
+
rows() {
|
|
103
|
+
const order = Object.fromEntries(Object.values(GROUP).map((g, i) => [g, i]));
|
|
104
|
+
return this.all
|
|
105
|
+
.map((a) => {
|
|
106
|
+
const agent = a.agentId ? this.manager.store?.get?.(a.agentId) ?? null : null;
|
|
107
|
+
const talk = a.discussId ? this.manager.store?.get?.(a.discussId) ?? null : null;
|
|
108
|
+
return {
|
|
109
|
+
id: a.id,
|
|
110
|
+
text: a.text,
|
|
111
|
+
source: a.source,
|
|
112
|
+
sourceLabel: ACTION_SOURCES[a.source] ?? a.source,
|
|
113
|
+
link: a.link,
|
|
114
|
+
from: a.from,
|
|
115
|
+
when: a.when,
|
|
116
|
+
due: a.due,
|
|
117
|
+
context: a.context,
|
|
118
|
+
status: a.status,
|
|
119
|
+
group: GROUP[a.status] ?? 'open',
|
|
120
|
+
agent: agent ? { id: agent.id, name: agent.name } : null,
|
|
121
|
+
discussion: talk ? { id: talk.id, name: talk.name } : null,
|
|
122
|
+
updatedAt: a.updatedAt ?? a.at,
|
|
123
|
+
};
|
|
124
|
+
})
|
|
125
|
+
.sort((x, y) => order[x.group] - order[y.group] || String(y.when).localeCompare(String(x.when)));
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Your decision on actions: open (undecided again), assign (starts an agent; `project` picks
|
|
130
|
+
* where), skip, done or remove. { set: [ids], started: [{ id, agent }], failed: [{ id, reason }] }.
|
|
131
|
+
*/
|
|
132
|
+
set(ids = [], state, { project = null } = {}) {
|
|
133
|
+
if (!ACTION_STATES.includes(state)) throw err(400, `The decision is one of ${ACTION_STATES.join(', ')}`);
|
|
134
|
+
const set = [];
|
|
135
|
+
const started = [];
|
|
136
|
+
const failed = [];
|
|
137
|
+
for (const id of new Set(ids)) {
|
|
138
|
+
const a = this.all.find((x) => x.id === id);
|
|
139
|
+
if (!a) {
|
|
140
|
+
failed.push({ id, reason: 'no such action' });
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
if (state === 'assign' && !(a.agentId && this.manager.store?.get?.(a.agentId))) {
|
|
144
|
+
try {
|
|
145
|
+
const proj = project ? String(project).replace(/^@/, '') : null;
|
|
146
|
+
const [agent] = this.manager.createMany([actionIntent(a)], proj ? { project: proj } : {});
|
|
147
|
+
a.agentId = agent.id;
|
|
148
|
+
started.push({ id, agent: { id: agent.id, name: agent.name } });
|
|
149
|
+
} catch (e) {
|
|
150
|
+
failed.push({ id, reason: e.message });
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
a.status = state;
|
|
155
|
+
a.updatedAt = new Date().toISOString();
|
|
156
|
+
set.push(id);
|
|
157
|
+
}
|
|
158
|
+
this.store.save();
|
|
159
|
+
return { set, started, failed };
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/** A conversation about the action (a general session), or the one already started. */
|
|
163
|
+
discuss(id, bin) {
|
|
164
|
+
const a = this.find(id);
|
|
165
|
+
const prev = a.discussId ? this.manager.store?.get?.(a.discussId) : null;
|
|
166
|
+
if (prev) return { agent: { id: prev.id, name: prev.name }, existing: true };
|
|
167
|
+
const agent = this.manager.createGeneral({ question: discussPrompt(a, bin), name: `About: ${clip(a.text, 40)}` });
|
|
168
|
+
a.discussId = agent.id;
|
|
169
|
+
this.store.save();
|
|
170
|
+
return { agent: { id: agent.id, name: agent.name }, existing: false };
|
|
171
|
+
}
|
|
172
|
+
}
|