@double_geste/agent-standup 1.44.0 → 1.46.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/bin/agent-standup.js +56 -3
- package/boards.js +258 -0
- package/codex.js +2 -1
- package/package.json +2 -1
- package/public/index.html +91 -44
- package/public/locales/da.json +6 -2
- package/public/locales/de.json +6 -2
- package/public/locales/en.json +6 -2
- package/public/locales/es.json +6 -2
- package/public/locales/ja.json +6 -2
- package/public/locales/ko.json +6 -2
- package/public/locales/pt-BR.json +6 -2
- package/public/locales/zh-CN.json +6 -2
- package/public/locales/zh-TW.json +6 -2
- package/server.js +24 -14
|
@@ -175,6 +175,8 @@
|
|
|
175
175
|
"Web search": "Pesquisa na web",
|
|
176
176
|
"working": "trabalhando",
|
|
177
177
|
"Writing ": "Escrevendo ",
|
|
178
|
+
"Drawing on ": "Desenhando em ",
|
|
179
|
+
"Filling ": "Preenchendo ",
|
|
178
180
|
"You": "Você",
|
|
179
181
|
"Your agents are done 🎉": "Seus agentes terminaram 🎉",
|
|
180
182
|
"Your Claude Code agents as a live team call": "Seus agentes do Claude Code em uma chamada de equipe ao vivo",
|
|
@@ -193,7 +195,6 @@
|
|
|
193
195
|
"Voice style": "Estilo de voz",
|
|
194
196
|
"⌨ Keyboard shortcuts (?)": "⌨ Atalhos de teclado (?)",
|
|
195
197
|
"Keyboard shortcuts": "Atalhos de teclado",
|
|
196
|
-
"Mute / unmute": "Silenciar / ativar som",
|
|
197
198
|
"Pause / play": "Pausar / reproduzir",
|
|
198
199
|
"Recap": "Resumo",
|
|
199
200
|
"This help": "Esta ajuda",
|
|
@@ -459,5 +460,8 @@
|
|
|
459
460
|
"Sub-agent names": "Nomes dos subagentes",
|
|
460
461
|
"Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "Renomeie todos os subagentes: nomes separados por vírgulas, dados na ordem em que os agentes começam. Vazio: os nomes embutidos.",
|
|
461
462
|
"Agents you named yourself keep their names (switch below).": "Os agentes que você mesmo nomeou mantêm seus nomes (chave abaixo).",
|
|
462
|
-
"Agents you named yourself take these names too (switch below).": "Os agentes que você mesmo nomeou também recebem esses nomes (chave abaixo)."
|
|
463
|
+
"Agents you named yourself take these names too (switch below).": "Os agentes que você mesmo nomeou também recebem esses nomes (chave abaixo).",
|
|
464
|
+
"Zen: alerts only, no voices (M key)": "Zen: só os alertas, sem vozes (tecla M)",
|
|
465
|
+
"Sound: all, zen (alerts only), off": "Som: tudo, zen (só alertas), desligado",
|
|
466
|
+
"Zen mode: alerts, no voices": "Modo zen: alertas, sem vozes"
|
|
463
467
|
}
|
|
@@ -168,6 +168,8 @@
|
|
|
168
168
|
"Web search": "网页搜索",
|
|
169
169
|
"working": "工作中",
|
|
170
170
|
"Writing ": "正在写入 ",
|
|
171
|
+
"Drawing on ": "正在绘制 ",
|
|
172
|
+
"Filling ": "正在填写 ",
|
|
171
173
|
"You": "你",
|
|
172
174
|
"Your agents are done 🎉": "你的代理都完成啦 🎉",
|
|
173
175
|
"Your Claude Code agents as a live team call": "把你的 Claude Code 代理变成实时团队通话",
|
|
@@ -193,7 +195,6 @@
|
|
|
193
195
|
"Voice style": "语音风格",
|
|
194
196
|
"⌨ Keyboard shortcuts (?)": "⌨ 键盘快捷键 (?)",
|
|
195
197
|
"Keyboard shortcuts": "键盘快捷键",
|
|
196
|
-
"Mute / unmute": "静音 / 取消静音",
|
|
197
198
|
"Pause / play": "暂停 / 播放",
|
|
198
199
|
"Recap": "回顾",
|
|
199
200
|
"This help": "此帮助",
|
|
@@ -459,5 +460,8 @@
|
|
|
459
460
|
"Sub-agent names": "子代理名字",
|
|
460
461
|
"Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "重命名所有子代理:用逗号分隔名字,按代理启动的顺序分配。留空:使用内置名字。",
|
|
461
462
|
"Agents you named yourself keep their names (switch below).": "你自己命名的代理保留其名字(见下方开关)。",
|
|
462
|
-
"Agents you named yourself take these names too (switch below).": "你自己命名的代理也会使用这些名字(见下方开关)。"
|
|
463
|
+
"Agents you named yourself take these names too (switch below).": "你自己命名的代理也会使用这些名字(见下方开关)。",
|
|
464
|
+
"Zen: alerts only, no voices (M key)": "禅模式:只有提示音,没有语音(M 键)",
|
|
465
|
+
"Sound: all, zen (alerts only), off": "声音:全部、禅模式(仅提示音)、关闭",
|
|
466
|
+
"Zen mode: alerts, no voices": "禅模式:提示音,无语音"
|
|
463
467
|
}
|
|
@@ -175,6 +175,8 @@
|
|
|
175
175
|
"Web search": "網頁搜尋",
|
|
176
176
|
"working": "工作中",
|
|
177
177
|
"Writing ": "撰寫 ",
|
|
178
|
+
"Drawing on ": "繪製 ",
|
|
179
|
+
"Filling ": "填寫 ",
|
|
178
180
|
"You": "你",
|
|
179
181
|
"Your agents are done 🎉": "你的代理都完成了 🎉",
|
|
180
182
|
"Your Claude Code agents as a live team call": "把你的 Claude Code 代理變成即時團隊通話",
|
|
@@ -193,7 +195,6 @@
|
|
|
193
195
|
"Voice style": "語音風格",
|
|
194
196
|
"⌨ Keyboard shortcuts (?)": "⌨ 鍵盤快速鍵 (?)",
|
|
195
197
|
"Keyboard shortcuts": "鍵盤快速鍵",
|
|
196
|
-
"Mute / unmute": "靜音 / 取消靜音",
|
|
197
198
|
"Pause / play": "暫停 / 播放",
|
|
198
199
|
"Recap": "回顧",
|
|
199
200
|
"This help": "此說明",
|
|
@@ -459,5 +460,8 @@
|
|
|
459
460
|
"Sub-agent names": "子代理名字",
|
|
460
461
|
"Rename every sub-agent: names separated by commas, given in the order the agents start. Empty: the built-in names.": "重新命名所有子代理:以逗號分隔名字,依代理啟動的順序分配。留空:使用內建名字。",
|
|
461
462
|
"Agents you named yourself keep their names (switch below).": "你自己命名的代理保留其名字(見下方開關)。",
|
|
462
|
-
"Agents you named yourself take these names too (switch below).": "你自己命名的代理也會使用這些名字(見下方開關)。"
|
|
463
|
+
"Agents you named yourself take these names too (switch below).": "你自己命名的代理也會使用這些名字(見下方開關)。",
|
|
464
|
+
"Zen: alerts only, no voices (M key)": "禪模式:只有提示音,沒有語音(M 鍵)",
|
|
465
|
+
"Sound: all, zen (alerts only), off": "聲音:全部、禪模式(僅提示音)、關閉",
|
|
466
|
+
"Zen mode: alerts, no voices": "禪模式:提示音,無語音"
|
|
463
467
|
}
|
package/server.js
CHANGED
|
@@ -8,6 +8,7 @@ const os = require('os');
|
|
|
8
8
|
const crypto = require('crypto');
|
|
9
9
|
const codex = require('./codex.js'); // Codex sessions, read as the same call (see codex.js)
|
|
10
10
|
const vibe = require('./vibe.js'); // Mistral Vibe sessions, the same way (see vibe.js)
|
|
11
|
+
const boards = require('./boards.js'); // Claude Whiteboards and Sheets, drawn again from the session's writes for the shared screen (see boards.js)
|
|
11
12
|
const reply = require('./reply.js'); // the human's line, typed into the session's tmux pane (see reply.js); off unless AGENT_STANDUP_REPLY=on
|
|
12
13
|
const SOURCES = [codex, vibe], sourceOf = (proj) => SOURCES.find((m) => m.PROJ === proj) || null, guard = (fn, or) => { try { return fn(); } catch (e) { logError('reader', e); return or; } }; // guard: a session of another tool that cannot be read costs that session, never the list // the tools other than Claude Code: each lists its sessions under one made-up project
|
|
13
14
|
const kokoro = require('./kokoro.js'); // natural voices, installed on demand (see kokoro.js)
|
|
@@ -39,10 +40,11 @@ function claudeHomes() { // [CLAUDE_HOME, the other folders that hold sessions
|
|
|
39
40
|
const home = os.homedir(), real = (d) => { try { return fs.statSync(d).isDirectory() ? fs.realpathSync(d) : ''; } catch { return ''; } };
|
|
40
41
|
let names = []; try { names = fs.readdirSync(home).filter((n) => /^\.claude[-_.][^\\/]+$/.test(n) && !/([-_.~ ](bak|bkp|backup|old|orig|copy|save|saved|prev|archive|snapshot)[\dT_.-]*| \(copy( \d+)?\)| \d+|[-_.]\d{6,}[\dT_.-]*|~)$/i.test(n) && ['.claude.json', '.config.json', '.claude-custom-oauth.json'].some((j) => isFile(path.join(home, n, j)))).sort(); } catch {}
|
|
41
42
|
const extra = EXTRA_HOMES.split(path.delimiter).map((d) => d.trim()).filter(Boolean).map((d) => path.resolve(d.replace(/^~(?=$|[\\/])/, home)));
|
|
42
|
-
const list = [CLAUDE_HOME], seen = new Set([real(path.join(CLAUDE_HOME, 'projects')) || path.join(CLAUDE_HOME, 'projects')]);
|
|
43
|
-
for (const d of [path.join(home, '.claude'), ...names.map((n) => path.join(home, n)), ...extra]) { const r = real(path.join(d, 'projects')); if (r && !seen.has(r)) { seen.add(r); list.push(d); } }
|
|
44
|
-
homesMemo = { at: now, list }; return list;
|
|
43
|
+
const list = [CLAUDE_HOME], seen = new Set([real(path.join(CLAUDE_HOME, 'projects')) || path.join(CLAUDE_HOME, 'projects')]), twins = [], seenS = new Set([real(path.join(CLAUDE_HOME, 'sessions')) || path.join(CLAUDE_HOME, 'sessions')]);
|
|
44
|
+
for (const d of [path.join(home, '.claude'), ...names.map((n) => path.join(home, n)), ...extra]) { const r = real(path.join(d, 'projects')), s = real(path.join(d, 'sessions')); if (r && !seen.has(r)) { seen.add(r); list.push(d); if (s) seenS.add(s); } else if (r && s && !seenS.has(s)) { seenS.add(s); twins.push(d); } } // a twin: its projects folder is a link to one already read (claude --resume works from both logins), its sessions folder its own
|
|
45
|
+
homesMemo = { at: now, list, twins }; return list;
|
|
45
46
|
}
|
|
47
|
+
function twinHomes() { claudeHomes(); return homesMemo.twins || []; } // the twins of the last look: their sessions folders are read for status, their projects never twice
|
|
46
48
|
const projRoots = () => { const h = claudeHomes(); return h.length < 2 ? [ROOT] : h.map((d) => path.join(d, 'projects')); }; // one folder, as most people have: exactly the one read before
|
|
47
49
|
const PUBLIC = path.join(__dirname, 'public');
|
|
48
50
|
// Cowork, a tab of the Claude desktop app, keeps each of its sessions in the app's own folder, in the format of Claude Code: <folder>/<account>/<organisation>/<session>/.claude/projects/<project>/<id>.jsonl.
|
|
@@ -213,6 +215,7 @@ const toolLabel = (b, ts) => {
|
|
|
213
215
|
const outs = i.files.map((f) => (typeof f === 'string' ? f : f && f.file_path)).filter((f) => typeof f === 'string' && path.isAbsolute(f) && f.length <= 400).slice(0, 16);
|
|
214
216
|
out.d = { kind: 'text', what: 'mcp', v: 'cowork · present_files', text: clip(outs.map((f) => path.basename(f)).join('\n'), 400), ...(outs.length ? { outs } : {}) }; break;
|
|
215
217
|
}
|
|
218
|
+
{ const lv = boards.liveCall(b.name, i); if (lv && lv.op === 'write') { out.d = { kind: 'artifact', file: '', title: '', note: '', live: lv.kind, key: clip(lv.key, 200) }; break; } } // a write to a Claude Whiteboard (its store) or a Claude Sheet (its cells): the call shows the board or the Sheet as that write left it (see liveNote)
|
|
216
219
|
if (mcp && /(^|_)Claude_Docs$/.test(mcp[1] || '') && mcp[2] === 'batch' && i.container && i.container.create && typeof i.container.create.name === 'string') { out.d = { kind: 'artifact', file: '', title: clip(i.container.create.name, 120), note: '', doc: 1 }; break; } // a doc of the Claude Docs connector being born (its later edits are calls like any other)
|
|
217
220
|
out.d = mcp ? { kind: 'text', what: 'mcp', v: (mcp[1] || '') + ' · ' + (mcp.slice(2).join('__') || ''), text: clip(JSON.stringify(i), 400) } : { kind: 'text', text: clip(JSON.stringify(i), 300) };
|
|
218
221
|
}
|
|
@@ -230,12 +233,19 @@ const artifactOf = (u) => (u && typeof u === 'object' && typeof u.url === 'strin
|
|
|
230
233
|
// What a call that put an artifact in front of the person answered, for the line of files: a publish (above); a doc the Claude Docs connector created, whose answer names the doc and its address;
|
|
231
234
|
// an artifact opened on the person's screen, only when this session did not publish or create it already (the same artifact under its other address would show twice, and an open would take the place of the publish that has the preview).
|
|
232
235
|
const DOC_ID = /"created":\{[^{}]*"minted":"([\w-]{6,80})"/, DOC_URL = /"frame":\{[^{}]*"url":"(https:\/\/claude\.ai\/(?:code\/)?artifact\/[\w-]{6,80})"/;
|
|
233
|
-
function artOf(st, how, u, text) {
|
|
236
|
+
function artOf(st, how, u, text, tid) {
|
|
234
237
|
const seen = (st.artIds = st.artIds || new Set()), note = (id, url) => { if (id) seen.add('id ' + id); seen.add('url ' + url); }; // known by its id and by its address: a publish may answer without an id
|
|
238
|
+
if (how === 'peek') { const m = SHEET_FRAME.exec(text); if (m && ART_URL.test(m[2])) (st.sheetUrl = st.sheetUrl || new Map()).set(m[1], m[2]); return null; } // a read of a Sheet names its address: a Sheet made in another session can be shown too
|
|
239
|
+
if (how === 'live') { const d = st.lives && st.lives.get(tid); if (!d) return null; const url = d.live === 'board' ? d.key : (st.sheetUrl && st.sheetUrl.get(d.key)) || ''; if (!ART_URL.test(url) || (st.plainArt && st.plainArt.has(url)) || (d.live === 'sheet' && !/"data":\{"revision":\d+/.test(text))) return null; return { url, title: (st.artT && st.artT.get(url)) || '', typed: 1, live: d.live }; } // a write that went through: a new version of that board or Sheet
|
|
235
240
|
if (how === 'doc') { const id = DOC_ID.exec(text), m = DOC_URL.exec(text); if (!id || !m || !ART_URL.test(m[1])) return null; note(id[1], m[1]); return { url: m[1], title: '', typed: 1 }; }
|
|
236
241
|
const a = artifactOf(u), id = a && typeof u.artifact_id === 'string' ? u.artifact_id : ''; if (!a) return null;
|
|
237
242
|
if (how === 'open') { if ((id && seen.has('id ' + id)) || seen.has('url ' + a.url)) return null; note(id, a.url); return { ...a, typed: 1 }; } // opened, not made here: the window gives its title and its link
|
|
238
|
-
note(id, a.url); return a;
|
|
243
|
+
note(id, a.url); (st.artT = st.artT || new Map()).set(a.url, a.title); if (!a.typed) (st.plainArt = st.plainArt || new Set()).add(a.url); /* a page this session published from its own file: its database writes are its own, not a board's */ const sp = SHEET_MADE.exec(text); if (sp) (st.sheetUrl = st.sheetUrl || new Map()).set(sp[1], a.url); return a; // its title, for the writes that fill it; a Sheet: the Claude Docs project that holds its cells
|
|
244
|
+
}
|
|
245
|
+
const SHEET_MADE = /Claude Docs document \(project "([\w-]{6,80})"\)/, SHEET_FRAME = /"frame":\{"slug":"([\w-]{6,80})","url":"(https:\/\/claude\.ai\/(?:code\/)?artifact\/[\w-]{6,80})"/;
|
|
246
|
+
function liveNote(st, b, tool) { // a write to a board or a Sheet is looked up when its answer comes (artOf, 'live'); a read of a Sheet tells its address ('peek')
|
|
247
|
+
const d = tool.d; if (d && d.live) { (st.lives = st.lives || new Map()).set(b.id, d); const url = d.live === 'board' ? d.key : (st.sheetUrl && st.sheetUrl.get(d.key)) || ''; d.title = (st.artT && st.artT.get(url)) || ''; return; }
|
|
248
|
+
if (/^mcp__.+Claude_Docs__read$/.test(b.name || '')) (st.pubs = st.pubs || new Map()).set(b.id, 'peek');
|
|
239
249
|
}
|
|
240
250
|
const resultText = (c) => (typeof c === 'string' ? c : Array.isArray(c) ? c.map((x) => x.text || '').join('\n') : '');
|
|
241
251
|
// The colours and cursor moves of a terminal (ANSI escape codes) are taken out of what a tool printed: the page shows text. clipOut: clip for an output, taking them out of the part it keeps.
|
|
@@ -478,9 +488,9 @@ function listSessions() {
|
|
|
478
488
|
if (Date.now() - sessionsMemo.at < 2000) return sessionsMemo.rows;
|
|
479
489
|
const out = listSessions0(); sessionsMemo = { at: Date.now(), rows: out }; return out;
|
|
480
490
|
}
|
|
481
|
-
function listSessions0() {
|
|
491
|
+
function listSessions0(since) { // since: every session written since then, however many (the day report), instead of the most recent ones
|
|
482
492
|
const rows = [];
|
|
483
|
-
for (const m of SOURCES) for (const r of guard(() => m.sessions(30), [])) rows.push({ proj: m.PROJ, id: r.id, mtime: r.mtime, size: r.size, agents: guard(() => (m.subCount ? m.subCount(r.id) : m.subFiles ? m.subFiles(r.id).length : 0), 0), cx: r, src: m });
|
|
493
|
+
for (const m of SOURCES) for (const r of guard(() => m.sessions(since != null ? 2000 : 30), [])) rows.push({ proj: m.PROJ, id: r.id, mtime: r.mtime, size: r.size, agents: guard(() => (m.subCount ? m.subCount(r.id) : m.subFiles ? m.subFiles(r.id).length : 0), 0), cx: r, src: m });
|
|
484
494
|
for (const proj of projects()) {
|
|
485
495
|
for (const { id, file } of transcripts(proj)) {
|
|
486
496
|
let st; try { st = fs.statSync(file); } catch { continue; } // a link to a transcript that is gone
|
|
@@ -488,7 +498,7 @@ function listSessions0() {
|
|
|
488
498
|
}
|
|
489
499
|
}
|
|
490
500
|
rows.sort((a, b) => b.mtime - a.mtime);
|
|
491
|
-
const own = (r) => !r.cx && r.proj !== COWORK, top = rows.filter(own).slice(0, 60).concat(rows.filter((r) => r.cx), rows.filter((r) => r.proj === COWORK).slice(0, 30)).sort((a, b) => b.mtime - a.mtime); // the 60 most recent Claude Code sessions as always, and up to 30 of each other tool beside them, Cowork included: none pushes another out
|
|
501
|
+
const own = (r) => !r.cx && r.proj !== COWORK, top = since != null ? rows.filter((r) => r.mtime >= since) : rows.filter(own).slice(0, 60).concat(rows.filter((r) => r.cx), rows.filter((r) => r.proj === COWORK).slice(0, 30)).sort((a, b) => b.mtime - a.mtime); // the 60 most recent Claude Code sessions as always, and up to 30 of each other tool beside them, Cowork included: none pushes another out
|
|
492
502
|
for (const r of top) {
|
|
493
503
|
if (r.cx) { const c = r.cx, m = r.src; delete r.cx; delete r.src; r.title = guard(() => m.title(c), '') || r.id; r.project = guard(() => m.projectLabel(c.cwd), '') || m.SOURCE; r.source = m.SOURCE; continue; }
|
|
494
504
|
// titles come from the cached tail read (custom title, then AI title, then first prompt): no whole-file reads
|
|
@@ -578,7 +588,7 @@ const PR_URL = /^https:\/\/github\.com\/[\w.-]+\/[\w.-]+\/pull\/\d+$/; // noth
|
|
|
578
588
|
const askOf = (b) => { const q = b.name === 'AskUserQuestion' && b.input && Array.isArray(b.input.questions) && b.input.questions[0] && b.input.questions[0].question; return typeof q === 'string' ? clip(q.trim(), 200) : ''; }; // the question a session stopped on, for its card
|
|
579
589
|
const callOf = (b) => { const i = b.input || {}, v = b.name === 'Bash' ? i.command : /^(Edit|Write|MultiEdit|NotebookEdit)$/.test(b.name) ? path.basename(String(i.file_path || i.notebook_path || '')) : b.name === 'WebFetch' ? i.url : ''; return typeof v === 'string' && v.trim() ? b.name + '(' + clip(v.replace(/\s+/g, ' ').trim(), 160) + ')' : ''; }; // what a call waiting for your go-ahead would do, written the way Claude Code shows it: Bash(npm test)
|
|
580
590
|
const PLAN_FILE = /[\\/]\.claude[\\/]plans[\\/][^\\/]+\.md$/, PLAN_DIR = process.env.CLAUDE_CONFIG_DIR ? path.join(process.env.CLAUDE_CONFIG_DIR, 'plans') + path.sep : '';
|
|
581
|
-
const planFile = (f) => PLAN_FILE.test(f) || (!!PLAN_DIR && f.startsWith(PLAN_DIR) && f.endsWith('.md')) || (f.endsWith('.md') && claudeHomes().slice(1).some((h) => f.startsWith(path.join(h, 'plans') + path.sep))); // also where a CLAUDE_CONFIG_DIR set elsewhere keeps them, and the other folders read (claudeHomes)
|
|
591
|
+
const planFile = (f) => PLAN_FILE.test(f) || (!!PLAN_DIR && f.startsWith(PLAN_DIR) && f.endsWith('.md')) || (f.endsWith('.md') && claudeHomes().slice(1).concat(twinHomes()).some((h) => f.startsWith(path.join(h, 'plans') + path.sep))); // also where a CLAUDE_CONFIG_DIR set elsewhere keeps them, and the other folders read (claudeHomes, and their twins)
|
|
582
592
|
const planDoc = (f) => { try { const st = fs.statSync(f); if (!st.isFile() || st.size > 262144) return ''; return clip(fs.readFileSync(f, 'utf8').trim(), 4000); } catch { return ''; } }; // the whole plan, for the shared screen
|
|
583
593
|
const planText = (f) => { try { const st = fs.statSync(f); if (!st.isFile() || st.size > 262144) return ''; return clip(fs.readFileSync(f, 'utf8').trim(), 1200); } catch { return ''; } };
|
|
584
594
|
const menuOf = (b) => { // what a menu waiting for you shows, from the call it waits on, word for word: the questions and their options in their order (the terminal numbers them the same way), the command, the file, the plan
|
|
@@ -593,7 +603,7 @@ const menuOf = (b) => { // what a menu waiting for you shows, from the call it
|
|
|
593
603
|
// Claude Code also keeps <config>/sessions/<pid>.json for each open session: its status (busy, idle, or waiting while a menu waits for your answer: a permission, a question) and since when.
|
|
594
604
|
// It is the only sign of a Bash approval: in the transcript, a command waiting for your go-ahead looks just like one that runs. A file whose process has ended is left out.
|
|
595
605
|
const CC_SESSIONS = process.env.AGENT_STANDUP_CC_SESSIONS || path.join(process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), '.claude'), 'sessions'), CC_SESSIONS_SET = !!process.env.AGENT_STANDUP_CC_SESSIONS;
|
|
596
|
-
const statusDirs = () => { const h = CC_SESSIONS_SET ? [] : claudeHomes(); return h.length < 2 ? [CC_SESSIONS] : h.map((d) => path.join(d, 'sessions')); }; // each folder read keeps the status of its own sessions
|
|
606
|
+
const statusDirs = () => { const h = CC_SESSIONS_SET ? [] : claudeHomes().concat(twinHomes()); return h.length < 2 ? [CC_SESSIONS] : h.map((d) => path.join(d, 'sessions')); }; // each folder read keeps the status of its own sessions
|
|
597
607
|
const alive = (pid) => { try { process.kill(pid, 0); return true; } catch (e) { return e.code === 'EPERM'; } };
|
|
598
608
|
function liveStatus() { // session id → { status, since, pid, ep (where it runs: claude-vscode, cli, claude-desktop, sdk-cli…), and for missingTranscripts: raw (the status as written), cwd, kind, startedAt, version, updatedAt (when the file was last written: a /clear moves it, and the id, but not statusUpdatedAt) }
|
|
599
609
|
const out = new Map(), later = (a, b) => Math.max(a.updatedAt, a.since) > Math.max(b.updatedAt, b.since);
|
|
@@ -1049,7 +1059,7 @@ function parseRecord(st, r) {
|
|
|
1049
1059
|
const one = blocks(r).filter((b) => b.type === 'tool_result').length === 1; // what Claude Code noted about the call (toolUseResult) is that call's when the record answers one call
|
|
1050
1060
|
if (one && st.plans && r.toolUseResult && typeof r.toolUseResult.plan === 'string' && r.toolUseResult.plan.trim()) for (const b of blocks(r)) if (b.type === 'tool_result' && st.plans.has(b.tool_use_id)) st.plans.get(b.tool_use_id).d.text = clip(r.toolUseResult.plan.trim(), 4000); // the answer names the plan exactly: the plan file holds only the latest one
|
|
1051
1061
|
for (const b of blocks(r)) if (b.type === 'tool_result' && st.toolName[b.tool_use_id] && !NO_RESULT.has(st.toolName[b.tool_use_id])) {
|
|
1052
|
-
const n = st.toolName[b.tool_use_id], text = resultText(b.content), img = resultImages(b.content).length, files = n === 'Bash' && !b.is_error ? docPaths(text, false).map((f) => absPath(f, r.cwd)) : [], art = !b.is_error && st.pubs && st.pubs.has(b.tool_use_id) ? artOf(st, st.pubs.get(b.tool_use_id), r.toolUseResult, text) : null;
|
|
1062
|
+
const n = st.toolName[b.tool_use_id], text = resultText(b.content), img = resultImages(b.content).length, files = n === 'Bash' && !b.is_error ? docPaths(text, false).map((f) => absPath(f, r.cwd)) : [], art = !b.is_error && st.pubs && st.pubs.has(b.tool_use_id) ? artOf(st, st.pubs.get(b.tool_use_id), r.toolUseResult, text, b.tool_use_id) : null;
|
|
1053
1063
|
items.push({ id: b.tool_use_id, err: !!b.is_error, out: clipOut(text.replace(/<system-reminder>[\s\S]*?<\/system-reminder>/g, '').trimEnd(), RESULT_MAX[n] || (/^mcp__/.test(n) ? 900 : 600)), ...(img ? { img } : {}), ...(files.length ? { files } : {}), ...(art ? { art } : {}), ...(BROWSER_MCP.test(n) && !b.is_error ? browserSeen(text, n) : {}), ...resultMore(n, text, one ? r.toolUseResult : null) }); // img: how many pictures came back; the page fetches them from /api/media · files: the documents a command says it made
|
|
1054
1064
|
}
|
|
1055
1065
|
if (items.length) push({ ts, agent, kind: 'results', items });
|
|
@@ -1074,7 +1084,7 @@ function parseRecord(st, r) {
|
|
|
1074
1084
|
else if (b.type === 'tool_use') {
|
|
1075
1085
|
st.toolName[b.id] = b.name; if (b.name === 'TaskCreate') st.tasks = 1; (st.out = st.out || new Set()).add(b.id); if (b.input && b.input.run_in_background) (st.bg = st.bg || {})[b.id] = true; // out: the calls that have no answer yet
|
|
1076
1086
|
if (b.name === 'Agent' || b.name === 'Task') push({ ts, agent, kind: 'agentcall', toolId: b.id, bg: !!(b.input && b.input.run_in_background), text: (b.input && b.input.prompt) || '', title: (b.input && b.input.description) || '', ...(b.input && typeof b.input.name === 'string' && b.input.name.trim() ? { nm: b.input.name.trim() } : {}) });
|
|
1077
|
-
else { const tool = toolLabel(b, ts); if (tool.d && tool.d.outs) tool.d.outs = tool.d.outs.map((f) => absPath(f, r.cwd)); if (/^(Write|Edit|MultiEdit)$/.test(b.name) && b.input && planFile(String(b.input.file_path || ''))) { st.planF = String(b.input.file_path); st.planW = b.name === 'Write' && typeof b.input.content === 'string' ? { mid: m.id, text: clip(b.input.content.trim(), 4000) } : null; } if (tool.d && tool.d.kind === 'plan') { (st.plans = st.plans || new Map()).set(b.id, tool); if (st.planW && st.planW.mid && st.planW.mid === m.id) tool.d.text = st.planW.text; else if (!tool.d.text && st.planF) tool.d.text = (st.planW && st.planW.text) || planDoc(st.planF); } /* a plan written in the same message as its call: the call carries the one before, or none */ /* Claude Code 2.1.30x sends ExitPlanMode with no plan: the plan is the file the session just wrote in ~/.claude/plans */ if (tool.d && tool.d.kind === 'artifact') (st.pubs = st.pubs || new Map()).set(b.id, tool.d.open ? 'open' : tool.d.doc ? 'doc' : 'pub'); push({ ts, agent, kind: 'tool', tool, ...th() }); st.act = st.raw.length - 1; }
|
|
1087
|
+
else { const tool = toolLabel(b, ts); if (tool.d && tool.d.outs) tool.d.outs = tool.d.outs.map((f) => absPath(f, r.cwd)); if (/^(Write|Edit|MultiEdit)$/.test(b.name) && b.input && planFile(String(b.input.file_path || ''))) { st.planF = String(b.input.file_path); st.planW = b.name === 'Write' && typeof b.input.content === 'string' ? { mid: m.id, text: clip(b.input.content.trim(), 4000) } : null; } if (tool.d && tool.d.kind === 'plan') { (st.plans = st.plans || new Map()).set(b.id, tool); if (st.planW && st.planW.mid && st.planW.mid === m.id) tool.d.text = st.planW.text; else if (!tool.d.text && st.planF) tool.d.text = (st.planW && st.planW.text) || planDoc(st.planF); } /* a plan written in the same message as its call: the call carries the one before, or none */ /* Claude Code 2.1.30x sends ExitPlanMode with no plan: the plan is the file the session just wrote in ~/.claude/plans */ liveNote(st, b, tool); if (tool.d && tool.d.kind === 'artifact') (st.pubs = st.pubs || new Map()).set(b.id, tool.d.open ? 'open' : tool.d.doc ? 'doc' : tool.d.live ? 'live' : 'pub'); push({ ts, agent, kind: 'tool', tool, ...th() }); st.act = st.raw.length - 1; }
|
|
1078
1088
|
}
|
|
1079
1089
|
}
|
|
1080
1090
|
if (agent === 'main' && (m.stop_reason === 'end_turn' || ((r.isApiErrorMessage || (m.model === '<synthetic>' && m.stop_reason === 'stop_sequence')) && !(st.out && st.out.size)))) { // also a turn that ends on a message Claude Code writes itself, in the place of the model's: the API is down, the limit is reached, the request was refused, or there was nothing to answer. Nothing follows it, unless a call of the lead is still out: the connection dropped while its agents worked, and it goes on when they answer. (A message of the model that a safety check cuts is not the end either: Claude Code tells the model, which goes on.) The lead's turn is over: Claude Code writes one record per content block, each with the message's stop reason, so the mark goes on the line this record carries (a thinking block carries none)
|
|
@@ -1585,7 +1595,7 @@ function start(port = PORT) {
|
|
|
1585
1595
|
if (url.pathname === '/api/artifact') { // the page a publish of this session sent, for the frame of the shared screen · check=1: is there one, and does it name libraries (asked before the frame is drawn) · whole=1: the whole document
|
|
1586
1596
|
const q = (k) => url.searchParams.get(k) || '', SAFE = /^[\w.\-]+$/, bad = [q('proj'), q('id'), q('agent'), q('tool')].some((v) => !SAFE.test(v) || v === '..' || v.length > 200) || q('tool').length < 6;
|
|
1587
1597
|
if (bad) { res.writeHead(400); return res.end('bad request'); }
|
|
1588
|
-
const file = sourceOf(q('proj')) ? null : mediaFile(q('proj'), q('id'), q('agent')), plan = file && fs.existsSync(file) && fs.existsSync(mediaFile(q('proj'), q('id'), 'main')) ? artifactPlan(q('proj'), q('id'), q('agent'), q('tool')) : null, page = plan
|
|
1598
|
+
const file = sourceOf(q('proj')) ? null : mediaFile(q('proj'), q('id'), q('agent')), plan = file && fs.existsSync(file) && fs.existsSync(mediaFile(q('proj'), q('id'), 'main')) ? artifactPlan(q('proj'), q('id'), q('agent'), q('tool')) : null, page = plan ? artifactBuild(file, q('tool'), plan, q('whole') === '1') : file && fs.existsSync(file) ? guard(() => boards.livePage(file, q('tool')), null) : null; // no page sent: a write to a board or a Sheet, drawn again from the session's writes
|
|
1589
1599
|
if (q('check')) return json(page ? { ok: true, net: page.net, ...(page.pages > 1 ? { pages: page.pages, label: page.label } : {}) } : { ok: false }, page ? 200 : 404); // pages: a document of several pages, which can be shown whole (whole=1)
|
|
1590
1600
|
if (!page) { res.writeHead(404); return res.end('not found'); }
|
|
1591
1601
|
const body = Buffer.from((/^\s*<!doctype/i.test(page.html) ? '' : '<!doctype html><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1">') + page.html, 'utf8'); // an artifact is published as the inside of a page: claude.ai adds the rest, and so does this
|
|
@@ -1632,7 +1642,7 @@ function start(port = PORT) {
|
|
|
1632
1642
|
} catch (e) { logError(req.method + ' ' + url.pathname, e); if (res.headersSent) return res.destroy(); json({ error: String(e.message || e) }, 500); }
|
|
1633
1643
|
}).listen(port, '127.0.0.1', function () { console.log(`Agent Standup → http://localhost:${this.address().port}`); });
|
|
1634
1644
|
}
|
|
1635
|
-
module.exports = { answerIn, missingTranscripts, noteEditor, forgetEditor, _winArg: winArg, start, currentSession, shutdown, findClaude, bundledClaude, boardRows, transcriptFile: (proj, id) => path.join(projDir(proj, id), id + '.jsonl'), sessionRows: listSessions, charactersDir, listCharacters, packsDir, installPack, logError, updateInfo, _reveal: reveal, _scrub: { tidy, homeRe }, _artifact: { page: artifactPage, csp: artifactCsp } };
|
|
1645
|
+
module.exports = { answerIn, missingTranscripts, noteEditor, forgetEditor, _winArg: winArg, start, currentSession, shutdown, findClaude, bundledClaude, boardRows, timeline: (proj, id) => timelineEntry(proj, id).tl, transcriptFile: (proj, id) => path.join(projDir(proj, id), id + '.jsonl'), sessionRows: listSessions, sessionsSince: (t) => listSessions0(+t || 0), codexPending: () => guard(() => !!(codex.zPending && codex.zPending()), false), charactersDir, listCharacters, packsDir, installPack, logError, updateInfo, _reveal: reveal, _scrub: { tidy, homeRe }, _artifact: { page: artifactPage, csp: artifactCsp } };
|
|
1636
1646
|
if (require.main === module && process.env.AGENT_STANDUP_CHILD === '1' && typeof process.send === 'function') { // started by the VS Code extension in a process of its own (see extension.js): reading a large session no longer stops the editor's extensions. Asked for by name: pm2 and others give any app a channel too
|
|
1637
1647
|
const srv = start(+process.env.PORT || 0), tell = (m) => { try { process.send(m); } catch {} };
|
|
1638
1648
|
srv.on('listening', () => tell({ port: srv.address().port })).on('error', (e) => { tell({ error: e.code || String(e) }); process.exit(1); });
|