@double_geste/agent-standup 1.39.2 → 1.40.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 +1 -0
- package/package.json +1 -1
- package/public/index.html +146 -45
- package/public/locales/da.json +27 -2
- package/public/locales/de.json +27 -2
- package/public/locales/en.json +27 -2
- package/public/locales/es.json +27 -2
- package/public/locales/ja.json +27 -2
- package/public/locales/ko.json +27 -2
- package/public/locales/pt-BR.json +27 -2
- package/public/locales/zh-CN.json +27 -2
- package/public/locales/zh-TW.json +27 -2
- package/server.js +164 -25
- package/vibe.js +1 -1
package/public/index.html
CHANGED
|
@@ -150,6 +150,13 @@
|
|
|
150
150
|
.pweb { flex:1; min-height:0; position:relative; overflow:hidden; background:#fff } .pweb iframe { position:absolute; left:0; top:0; border:0; width:calc(100% / var(--z,1)); height:calc(100% / var(--z,1)); transform:scale(var(--z,1)); transform-origin:0 0; background:#fff }
|
|
151
151
|
.pzoom { position:absolute; inset:0; width:100%; cursor:zoom-in }
|
|
152
152
|
.pcard { position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:7px; padding:14px; text-align:center; background:#0d1117; color:#d6dae6 } .pcard i { font-style:normal; font-size:30px } .pcard b { font-size:16px } .pcard p { margin:0; max-width:520px; color:#9aa0b4; font-size:12.5px } .pcard em { font-style:normal; color:#6b7089; font-size:11.5px }
|
|
153
|
+
/* a browser the agent drives (Claude in Chrome): its last screenshot in a frame of the page's shape, and a pointer that goes where it clicks */
|
|
154
|
+
.pwin.browser { flex-basis:1100px } .pwin.browser #pbody { display:flex; flex-direction:column; padding:0; background:#0b0c11; font:12px -apple-system,system-ui,sans-serif }
|
|
155
|
+
.pbr { flex:1; min-height:0; position:relative; container-type:size; display:flex; align-items:center; justify-content:center; padding:6px } .pbr.none .pfr { display:none } .pbr:not(.none) .pnone { display:none }
|
|
156
|
+
.pfr { position:relative; flex:none; width:min(100cqw, 100cqh * var(--ar,1.36)); aspect-ratio:var(--ar,1.36) } .pfr img { position:absolute; inset:0; width:100%; height:100%; border-radius:3px; background:#fff }
|
|
157
|
+
.pptr { position:absolute; left:50%; top:50%; width:17px; height:23px; margin:-1px 0 0 -1px; z-index:1; pointer-events:none; background:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 17 23'%3E%3Cpath d='M1.5 1.5v17l4.3-4.1 3 6.6 2.7-1.2-3-6.5h6z' fill='%23fff' stroke='%23111' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat; filter:drop-shadow(0 2px 3px rgba(0,0,0,.45)); transition:left .6s cubic-bezier(.3,.7,.3,1), top .6s cubic-bezier(.3,.7,.3,1) }
|
|
158
|
+
.pptr::after { content:''; position:absolute; left:-13px; top:-13px; width:28px; height:28px; box-sizing:border-box; border-radius:50%; border:3px solid #f0a020; opacity:0 } .pptr.clk::after { animation:pclk .6s ease-out .55s } @keyframes pclk { from { opacity:1; transform:scale(.3) } to { opacity:0; transform:scale(1.5) } }
|
|
159
|
+
.pkey { position:absolute; z-index:1; margin:24px 0 0 12px; max-width:60%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; background:rgba(10,11,16,.88); color:#fff; padding:2px 8px; border-radius:6px; font:12px ui-monospace,Menlo,monospace; transition:left .6s, top .6s } .pkey:empty { display:none }
|
|
153
160
|
#present.pin { height:clamp(240px,74vh,1000px) } #present.pin #pcam, #present.pin #pcap, #present.pin #pbadge { display:none } #present:has(.pwin.web) #pcam { width:110px; height:82px }
|
|
154
161
|
body.narrow #present.pin { height:clamp(220px,70vh,900px) } #present.pin:has(.pcard), body.narrow #present.pin:has(.pcard) { height:clamp(190px,34vh,300px) } /* nothing to read there but a title and a link */
|
|
155
162
|
.ptab { display:flex; align-items:center; gap:10px; background:#16161e; padding:5px 12px; border-bottom:1px solid #2a2b3d; font:11.5px -apple-system,system-ui,sans-serif } .ptab span { background:#1a1b26; padding:3px 10px; border-radius:6px 6px 0 0; color:#e9eaf0 } .ptab em { color:#6b7089; font-style:normal }
|
|
@@ -305,6 +312,7 @@
|
|
|
305
312
|
#prefs .pfoot { display:flex; justify-content:flex-end; padding:12px 10px 0; margin-top:8px; border-top:1px solid var(--line) } #prefsReset.sure { border-color:#ff7a6b; color:#ffb4a8 }
|
|
306
313
|
#menuTip { position:fixed; z-index:13; max-width:260px; padding:10px 12px; border-radius:10px; background:#2b3352; border:1px solid var(--accent); box-shadow:0 10px 30px rgba(0,0,0,.5); font-size:12.5px; line-height:1.45; color:var(--text) } #menuTip::before { content:''; position:absolute; top:-7px; right:var(--ax,14px); width:12px; height:12px; background:#2b3352; border-left:1px solid var(--accent); border-top:1px solid var(--accent); transform:rotate(45deg) } #menuTip .btn { display:block; margin:8px 0 0 auto } /* once, after the menu moved */
|
|
307
314
|
#rateTip, #coffeeTip, #usageTip { position:fixed; z-index:13; max-width:280px; padding:10px 12px; border-radius:10px; background:#2b3352; border:1px solid var(--accent); box-shadow:0 10px 30px rgba(0,0,0,.5); font-size:12.5px; line-height:1.45; color:var(--text) } #rateTip::before, #coffeeTip::before, #usageTip::before { content:''; position:absolute; top:-7px; right:var(--ax,14px); width:12px; height:12px; background:#2b3352; border-left:1px solid var(--accent); border-top:1px solid var(--accent); transform:rotate(45deg) } #rateTip .rtb, #coffeeTip .rtb, #usageTip .rtb { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:8px } #usageTip { max-width:360px } #rateYes, #coffeeYes, #usageYes { border-color:var(--accent) } /* once, on the third day: a star (desktop app, command line) */
|
|
315
|
+
#updTip { position:fixed; z-index:13; max-width:340px; padding:10px 12px; border-radius:10px; background:#2b3352; border:1px solid var(--accent); box-shadow:0 10px 30px rgba(0,0,0,.5); font-size:12.5px; line-height:1.45; color:var(--text) } #updTip::before { content:''; position:absolute; top:-7px; right:var(--ax,14px); width:12px; height:12px; background:#2b3352; border-left:1px solid var(--accent); border-top:1px solid var(--accent); transform:rotate(45deg) } #updTip .rtb { display:flex; flex-wrap:wrap; gap:6px; justify-content:flex-end; margin-top:8px } #updCmd { display:block; margin-top:6px; padding:5px 7px; border-radius:6px; background:rgba(0,0,0,.28); font:11.5px ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap:anywhere; user-select:all } #updGo { border-color:var(--accent) } /* a newer version, once per version (desktop app, command line, plugin) */
|
|
308
316
|
a.artist { color:#f5c04a; text-underline-offset:2px } #menuShop:empty { display:none } #menuShop { margin:2px 0 8px; font-size:12px; line-height:1.5; color:#c3c6d4 } /* the Halloween pack, for those who do not have it */
|
|
309
317
|
#recap { position:fixed; inset:0; z-index:15; background:rgba(5,6,12,.88); display:none; overflow:auto; padding:28px 16px } #recap.on { display:block }
|
|
310
318
|
#recap .box { max-width:860px; margin:0 auto; background:var(--panel); border:1px solid var(--line); border-radius:14px; padding:22px 26px }
|
|
@@ -382,6 +390,7 @@
|
|
|
382
390
|
<div id="usageTip" role="dialog" aria-live="polite" style="display:none"><span id="usageTipT"></span><div class="rtb"><button class="btn" id="usageRead"></button><button class="btn" id="usageNo"></button><button class="btn" id="usageYes"></button></div></div>
|
|
383
391
|
<div id="coffeeTip" role="status" style="display:none"><span id="coffeeTipT"></span><div class="rtb"><button class="btn" id="coffeeNo"></button><button class="btn" id="coffeeYes"></button></div></div>
|
|
384
392
|
<div id="rateTip" role="status" style="display:none"><span id="rateTipT"></span><div class="rtb"><button class="btn" id="rateNo"></button><button class="btn" id="rateLater"></button><button class="btn" id="rateYes"></button></div></div>
|
|
393
|
+
<div id="updTip" role="status" style="display:none"><span id="updTipT"></span><code id="updCmd" style="display:none"></code><div class="rtb"><button class="btn" id="updNotes"></button><button class="btn" id="updLater"></button><button class="btn" id="updGo"></button></div></div>
|
|
385
394
|
<div id="prefs" role="dialog" aria-modal="true" aria-labelledby="prefsT"><div class="pbox">
|
|
386
395
|
<div class="phead"><h2 id="prefsT" data-fr="Réglages" data-en="Settings">Réglages</h2><button class="btn" id="prefsX" data-fr="Fermer" data-en="Close">Fermer</button></div>
|
|
387
396
|
<div class="pcols"><div class="pcol">
|
|
@@ -390,7 +399,9 @@
|
|
|
390
399
|
<div class="box" id="officeBox" style="display:none"><input id="officeVol" type="range" min="0.1" max="1" step="0.05" style="width:100%" aria-label="Ambience volume"></div>
|
|
391
400
|
<button class="mi" data-t="music"><span data-fr="Musique d’ambiance (radio FIP)" data-en="Office music (FIP radio)">Musique d’ambiance (radio FIP)</span><i class="sw"></i></button>
|
|
392
401
|
<div class="box" id="musicBox" style="display:none"><select id="station"></select><input id="musicVol" type="range" min="0" max="1" step="0.05" style="width:100%" aria-label="Music volume"></div>
|
|
393
|
-
<button class="mi" data-t="shareUsage" id="mShare" style="display:none"><span data-fr="Aider à compter les utilisateurs (1 requête par semaine)" data-en="Help count users (1 request a week)">Aider à compter les utilisateurs (1 requête par semaine)</span><i class="sw"></i></button>
|
|
402
|
+
<button class="mi" data-t="shareUsage" id="mShare" style="display:none"><span data-fr="Aider à compter les utilisateurs (1 requête par semaine)" data-en="Help count users (1 request a week)">Aider à compter les utilisateurs (1 requête par semaine)</span><i class="sw"></i></button>
|
|
403
|
+
<button class="mi" data-t="updateNotice" id="mUpd" style="display:none"><span data-fr="Me dire quand une nouvelle version sort (1 requête par jour)" data-en="Tell me when a new version is out (1 request a day)">Me dire quand une nouvelle version sort (1 requête par jour)</span><i class="sw"></i></button>
|
|
404
|
+
<button class="mi" data-t="notify"><span data-fr="Me prévenir quand les agents ont fini" data-en="Notify me when agents finish">Me prévenir quand les agents ont fini</span><i class="sw"></i></button>
|
|
394
405
|
<h4 data-fr="Personnages" data-en="Characters">Personnages</h4>
|
|
395
406
|
<button class="mi" data-t="customLaptop"><span data-fr="Ordinateur devant vos personnages" data-en="Laptop in front of your own characters">Ordinateur devant vos personnages</span><i class="sw"></i></button>
|
|
396
407
|
<button class="mi" data-t="ownNames"><span data-fr="Garder les noms de mes agents" data-en="Keep my agents’ own names">Garder les noms de mes agents</span><i class="sw"></i></button>
|
|
@@ -478,8 +489,8 @@ if (prefs.vstyle === 'sims' && prefs.vstyleChosen) prefs.vstyle = 'animal';
|
|
|
478
489
|
if (prefs.vstyle !== 'animal' || !prefs.vstyleChosen) prefs.vstyle = 'kokoro';
|
|
479
490
|
if (!prefs.notifyChosen) prefs.notify = true; // “tell me when the agents are done” is on unless the person chose otherwise
|
|
480
491
|
let prefsTimer = null;
|
|
481
|
-
let shareWas = prefs.shareUsage; // the usage answer as last saved: when it changes, savePrefs dates it, and the server keeps the newest (another page may write older settings)
|
|
482
|
-
const savePrefs = () => { prefs._t = Date.now(); if (prefs.shareUsage !== shareWas) { shareWas = prefs.shareUsage; prefs.shareUsageT = Date.now(); } try { localStorage.setItem('cc.prefs', JSON.stringify(prefs)); } catch {} clearTimeout(prefsTimer); prefsTimer = setTimeout(() => { fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(prefs) }).catch(() => {}); }, 400); };
|
|
492
|
+
let shareWas = prefs.shareUsage, updWas = prefs.updateNotice; // the usage answer as last saved: when it changes, savePrefs dates it, and the server keeps the newest (another page may write older settings)
|
|
493
|
+
const savePrefs = () => { prefs._t = Date.now(); if (prefs.shareUsage !== shareWas) { shareWas = prefs.shareUsage; prefs.shareUsageT = Date.now(); } if (prefs.updateNotice !== updWas) { updWas = prefs.updateNotice; prefs.updateNoticeT = Date.now(); } try { localStorage.setItem('cc.prefs', JSON.stringify(prefs)); } catch {} clearTimeout(prefsTimer); prefsTimer = setTimeout(() => { fetch('/api/prefs', { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(prefs) }).catch(() => {}); }, 400); };
|
|
483
494
|
// Languages: French and English live in the code as pairs L(french, english); every other language is a catalogue public/locales/<code>.json mapping the English text to its translation.
|
|
484
495
|
// A missing string falls back to English, so a half-translated language still works. See public/locales/README.md to add one.
|
|
485
496
|
const LANGS = [['en', 'English', 'en'], ['fr', 'Français', 'fr'], ['zh-TW', '繁體中文', 'zh-Hant-TW'], ['zh-CN', '简体中文', 'zh-Hans-CN'], ['es', 'Español', 'es'], ['de', 'Deutsch', 'de'], ['da', 'Dansk', 'da'], ['pt-BR', 'Português (Brasil)', 'pt-BR'], ['ja', '日本語', 'ja'], ['ko', '한국어', 'ko']];
|
|
@@ -660,7 +671,7 @@ function packNote() { // the Halloween pack, to someone without it, twice a se
|
|
|
660
671
|
: dd >= 19 ? L('Halloween approche : déguisez vos agents en citrouille, fantôme, sorcière ou squelette, dessinés à la main par Fabien Coupas.', 'Halloween is coming: dress your agents up as a pumpkin, a ghost, a witch or a skeleton, drawn by hand by Fabien Coupas.') : L('Pour Halloween, vous êtes le vampire. Le reste de l’équipe est dans le pack Halloween.', 'This Halloween, you are the vampire. The rest of the cast is in the Halloween pack.');
|
|
661
672
|
$('#packNoteB').textContent = L('Voir le pack', 'See the pack') + ' · ' + price;
|
|
662
673
|
}
|
|
663
|
-
function persona(a) { const p = persona0(a); p.custom = customFor(a.id); return p; }
|
|
674
|
+
function persona(a) { const p = persona0(a); p.custom = customFor(p.twin ? 'main' : a.id); return p; } // a fork wears the lead's own picture too
|
|
664
675
|
const subName = (a, h) => (a.own && prefs.ownNames ? (nameBook[a.id] = a.own) : a.given || uniqueName(a.id, h)); // own: the name the person gave this agent (see ownName in server.js); otherwise a first name from the list. a.own is tested first: the landing page reuses this section and has no settings
|
|
665
676
|
function renameAll() { // ⚙ → own names on or off: every sub-agent is named again, in the order it arrived
|
|
666
677
|
for (const k in nameBook) delete nameBook[k]; for (const p of Object.values(S.agents)) if (p.id !== 'main' && p.id !== 'user') p.name = subName(p, hash(p.id));
|
|
@@ -670,6 +681,7 @@ function persona0(a) {
|
|
|
670
681
|
const h = hash(a.id), base = { ...a, given: 'given' in a ? a.given : a.name };
|
|
671
682
|
if (a.id === 'main') return { ...base, name: a.name || 'Margot', role: L('Chef', 'Lead'), shirt: '#e8845f', shape: 0, acc: 1, eye: 0, glasses: false, scene: 6, prop: 1, acc2: '#f5c04a', lead: true, vi: 0, gid: 'main' };
|
|
672
683
|
if (a.id === 'user') return { ...base, name: L('Vous', 'You'), role: L('Humain', 'Human'), shirt: '#8a94c9', shape: 1, acc: 2, eye: 1, glasses: false, scene: 7, prop: 1, acc2: '#ff7a6b', vi: 3, gid: 'user' };
|
|
684
|
+
if (/^fork$/i.test(a.type || '')) return { ...base, name: subName(base, h), roleEn: a.roleEn || a.role, role: (FR() && a.roleFr) || a.roleEn || a.role, shirt: '#e8845f', shape: 0, acc: 1, eye: 0, glasses: true, scene: (h >>> 18) % 6, prop: 1, acc2: '#f5c04a', vi: 0, twin: true, gid: h.toString(36) }; // a fork (Claude Code's subagent_type "fork", on by default since 2.1.302) starts as a copy of the lead: the lead's face, shirt and voice, glasses and a room of its own to tell them apart
|
|
673
685
|
return { ...base, name: subName(base, h), roleEn: a.roleEn || a.role, role: (FR() && a.roleFr) || a.roleEn || a.role, shirt: PAL[(h >>> 6) % 8], shape: (h >>> 3) % 5, acc: (h >>> 9) % 6, eye: (h >>> 12) % 3, glasses: ((h >>> 15) % 4) === 0,
|
|
674
686
|
scene: (h >>> 18) % 6, prop: (h >>> 21) % 3, acc2: PAL[(h >>> 24) % 8], vi: h >>> 4, gid: h.toString(36) };
|
|
675
687
|
}
|
|
@@ -803,6 +815,7 @@ const caughtUp = () => !S.live || lagMs() < 6000;
|
|
|
803
815
|
const nearLive = () => !S.live || lagMs() < 30000; // an answer to what was just said (a word after an order, a thank-you after a report) still fits here: reading the line took longer than 6 s and the session went on meanwhile
|
|
804
816
|
const spd = () => (S.live ? 1.12 * lagFactor() : +$('#speed').value) * (S.boost || 1);
|
|
805
817
|
const nameOf = (id) => (S.agents[id] || {}).name || id;
|
|
818
|
+
const twinOf = (a) => (/^fork$/i.test(a.type || '') && !('given' in a) && !(a.own && prefs.ownNames) ? { ...a, given: nameOf('main') + ' ' + (2 + Object.values(S.agents).filter((p) => p.twin).length) } : a); // a fork is named after the lead: Margot 2, Margot 3…
|
|
806
819
|
|
|
807
820
|
// ---------- text prep ----------
|
|
808
821
|
const plain = (t) => String(t).replace(/```[\s\S]*?```/g, ' ').replace(/`([^`]*)`/g, '$1').replace(/https?:\/\/\S+/g, 'link').replace(/[#*_>|~\[\]]/g, ' ').replace(/\s+/g, ' ').trim();
|
|
@@ -1332,7 +1345,7 @@ const applyStatus = (ev) => {
|
|
|
1332
1345
|
};
|
|
1333
1346
|
function recomputeStatus(upTo) {
|
|
1334
1347
|
S.files = new Map(); S.cands = new Map(); S.turnN = 0; S.turnSaid = ''; S.arts = new Map(); S.artCalls = new Map();
|
|
1335
|
-
S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.lastTool = {}; S.mainBusyAt = 0; S.turnOver = false; S.th = {}; S.ctx = {}; S.model = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.recomputing = true; document.querySelectorAll('.tile').forEach((t) => { clearTimeout(t._byeT); t.classList.remove('bye'); }); hidePresent();
|
|
1348
|
+
S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.lastTool = {}; S.mainBusyAt = 0; S.turnOver = false; S.th = {}; S.ctx = {}; S.model = {}; S.effort = {}; S.adv = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.recomputing = true; document.querySelectorAll('.tile').forEach((t) => { clearTimeout(t._byeT); t.classList.remove('bye'); }); hidePresent();
|
|
1336
1349
|
S.status = {}; S.tc = {}; S.doneAt = {}; S.gone.clear(); S.leaving.clear(); document.querySelectorAll('.tile.vanishing').forEach((t) => t.classList.remove('vanishing')); const doneIdx = {}; document.querySelectorAll('.ticker').forEach((x) => { x.classList.remove('on'); x.innerHTML = ''; });
|
|
1337
1350
|
for (let i = 0; i < upTo; i++) {
|
|
1338
1351
|
const e = S.events[i]; applyStatus(e); tally(e); if (e.kind === 'tools') S.tc[e.agent] = (S.tc[e.agent] || 0) + e.tools.length;
|
|
@@ -1351,7 +1364,7 @@ function syncUI() {
|
|
|
1351
1364
|
|
|
1352
1365
|
// ---------- tool ticker, shared screen, flying messages ----------
|
|
1353
1366
|
// ---------- what each agent is doing: tool calls with their real outputs ----------
|
|
1354
|
-
S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.ctx = {}; S.model = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.present = null; S.camFor = null; let presentTimer = null;
|
|
1367
|
+
S.term = {}; S.todos = {}; S.run = {}; S.act = {}; S.usage = {}; S.errs = {}; S.lastAct = {}; S.waitOn = {}; S.orderTs = {}; S.prevState = {}; S.ctx = {}; S.model = {}; S.effort = {}; S.adv = {}; S.cw = {}; S.compacts = {}; S.ctxWarned = {}; S.rep = {}; S.loops = {}; S.wst = {}; S.errList = {}; S.callById = new Map(); S.present = null; S.camFor = null; let presentTimer = null;
|
|
1355
1368
|
S.files = new Map(); S.cands = new Map(); S.turnN = 0; S.turnSaid = ''; S.fgone = new Set(); S.fmade = new Map(); S.arts = new Map(); S.artCalls = new Map(); S.artOk = new Map(); S.artPin = null; S.artWhole = null; S.wholeSeen = new Set(); // files: path → the Write call that created it, in the order they were written · cands: the documents the commands name (see candFile) · turnN: how many orders you gave so far · turnSaid: what you and the lead said in this turn · fgone: the files found missing on a click · fmade: what the server answered about a document a command names
|
|
1356
1369
|
const later = (k, fn, ms = 160) => { later.p = later.p || {}; if (later.p[k]) return; later.p[k] = setTimeout(() => { later.p[k] = 0; fn(); }, ms); }; // coalesce bursts of repaints
|
|
1357
1370
|
const fmtTok = (n) => (n < 1000 ? String(n) : n < 1e6 ? (n / 1000).toFixed(n < 1e4 ? 1 : 0) + 'k' : (n / 1e6).toFixed(n < 1e7 ? 2 : 1) + 'M');
|
|
@@ -1434,7 +1447,7 @@ function tally(ev) { // numbers that pile up over a session: token usage, erro
|
|
|
1434
1447
|
if (ev.kind === 'compact') { S.compacts[ev.agent] = (S.compacts[ev.agent] || 0) + 1; delete S.ctxWarned[ev.agent]; }
|
|
1435
1448
|
noteCalls(ev); if (wasteStep(S.wst, ev)) later('badges', renderBadges, 300);
|
|
1436
1449
|
const det = loopStep(S.rep, ev); if (det) { S.loops[ev.agent] = det; later('badges', renderBadges, 300); } else if (S.loops[ev.agent] && (ev.kind === 'results' ? (S.loops[ev.agent].kind === 'errors' && ev.items.every((it) => !it.err)) : (ev.kind === 'tools' && S.rep[ev.agent].n < 2))) { delete S.loops[ev.agent]; later('badges', renderBadges, 300); }
|
|
1437
|
-
if (ev.kind === 'usage') { const c = ev.u.i + ev.u.r + ev.u.w; if (c > 0 && ev.model !== '<synthetic>') { S.ctx[ev.agent] = c; S.model[ev.agent] = ev.model; if (ev.cw) S.cw[ev.agent] = ev.cw; } const u = (S.usage[ev.agent] = S.usage[ev.agent] || { i: 0, o: 0, r: 0, w: 0 }); u.i += ev.u.i; u.o += ev.u.o; u.r += ev.u.r; u.w += ev.u.w; later('tok', renderTokens, 300); } // which also redraws the context chips. Asking for those first, under the same name, left this one unasked: the counts on the tiles and in the header stood still during a live call
|
|
1450
|
+
if (ev.kind === 'usage') { const c = ev.u.i + ev.u.r + ev.u.w; if (c > 0 && ev.model !== '<synthetic>') { S.ctx[ev.agent] = c; S.model[ev.agent] = ev.model; if (ev.cw) S.cw[ev.agent] = ev.cw; if (ev.ef) S.effort[ev.agent] = ev.ef; if (ev.adv) S.adv[ev.agent] = ev.adv; } const u = (S.usage[ev.agent] = S.usage[ev.agent] || { i: 0, o: 0, r: 0, w: 0 }); u.i += ev.u.i; u.o += ev.u.o; u.r += ev.u.r; u.w += ev.u.w; later('tok', renderTokens, 300); } // which also redraws the context chips. Asking for those first, under the same name, left this one unasked: the counts on the tiles and in the header stood still during a live call
|
|
1438
1451
|
else if (ev.kind === 'results') ev.items.forEach((it) => { if (it.err) { S.errs[ev.agent] = (S.errs[ev.agent] || 0) + 1; later('badges', renderBadges, 300); oops(ev.agent); noteTrouble(ev.agent, false); } else noteTrouble(ev.agent, true); });
|
|
1439
1452
|
else if (ev.kind === 'tools' || ev.kind === 'say') S.lastAct[ev.agent] = ev.ts;
|
|
1440
1453
|
if (ev.th) S.th[ev.agent] = { text: ev.th, ts: ev.ts }; else if (ev.kind === 'user') delete S.th.main; // your order starts a new chain of thought: what the lead thought before is no longer what it is on
|
|
@@ -1453,8 +1466,8 @@ function renderTokens() {
|
|
|
1453
1466
|
renderCtx(); const mix = mixedModels();
|
|
1454
1467
|
const all = { i: 0, o: 0, r: 0, w: 0 }; for (const id in S.usage) for (const k in all) all[k] += S.usage[id][k];
|
|
1455
1468
|
const b = $('#tok'), tot = tokTotal(all); b.style.display = tot ? '' : 'none';
|
|
1456
|
-
if (tot) { b.textContent = `⚡ ${fmtTok(tot)} ${L('jetons', 'tokens')}`; b.title = tokTip(all) + '\n' + Object.keys(S.usage).filter((id) => S.agents[id] && tokTotal(S.usage[id])).sort((x, y) => tokTotal(S.usage[y]) - tokTotal(S.usage[x])).slice(0, 14).map((id) => `\n${nameOf(id)} ⚡${fmtTok(tokTotal(S.usage[id]))}${modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]) : ''}`).join(''); } // and who used what, the biggest first
|
|
1457
|
-
for (const id in S.agents) { const t = $('#t-' + id); if (!t) continue; const u = S.usage[id], el = t.querySelector('.tk'); el.textContent = u && tokTotal(u) ? `⚡${fmtTok(tokTotal(u))}${mix && modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]).split(' ')[0] : ''}` : ''; el.dataset.w = L('jetons', 'tokens'); if (u) t.title = tokTip(u) + modelTip(id); }
|
|
1469
|
+
if (tot) { b.textContent = `⚡ ${fmtTok(tot)} ${L('jetons', 'tokens')}`; b.title = tokTip(all) + '\n' + Object.keys(S.usage).filter((id) => S.agents[id] && tokTotal(S.usage[id])).sort((x, y) => tokTotal(S.usage[y]) - tokTotal(S.usage[x])).slice(0, 14).map((id) => `\n${nameOf(id)} ⚡${fmtTok(tokTotal(S.usage[id]))}${modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]) + effortOf(id) : ''}`).join('') + (S.cost ? `\n\n💵 ${costStr(S.cost)} · ${costTip()}` : ''); } // and who used what, the biggest first
|
|
1470
|
+
for (const id in S.agents) { const t = $('#t-' + id); if (!t) continue; const u = S.usage[id], el = t.querySelector('.tk'); el.textContent = u && tokTotal(u) ? `⚡${fmtTok(tokTotal(u))}${mix && modelShort(S.model[id]) ? ' · ' + modelShort(S.model[id]).split(' ')[0] : ''}${/^(xhigh|max)$/.test(S.effort[id] || '') ? ' · ' + effortWord(S.effort[id]) : ''}` : ''; el.dataset.w = L('jetons', 'tokens'); if (u) t.title = tokTip(u) + modelTip(id); }
|
|
1458
1471
|
camTok(); if (S.events.length && document.body.classList.contains('rost')) paintStates(); // the list of agents carries the counts too
|
|
1459
1472
|
}
|
|
1460
1473
|
function camTok() { // the one who shares a screen: what it has used so far, next to its name in the camera, as on its tile
|
|
@@ -1469,14 +1482,14 @@ function gaveOf(la) { // the turn of the followed session ended on "I couldn't
|
|
|
1469
1482
|
}
|
|
1470
1483
|
function agentState(id, now) {
|
|
1471
1484
|
let s = S.status[id]; const r = S.run[id], w = S.waitOn[id], la = S.lastAct[id];
|
|
1472
|
-
if (id === 'main' && S.live && atTail()) { const row = rowOf(S.cur); if (row && row.state === 'blocked' && row.since && !(la > S.rowsAt)) return { k: 'blocked', txt: '✋ ' + (row.sure ? L('vous attend ', 'needs you ') : L('attend
|
|
1485
|
+
if (id === 'main' && S.live && atTail()) { const row = rowOf(S.cur); if (row && row.state === 'blocked' && row.since && !(la > S.rowsAt)) return { k: 'blocked', txt: '✋ ' + (row.sure ? L('vous attend ', 'needs you ') : L('vous attend ? ', 'needs you? ')) + fmtShort(Math.max(0, now - row.since)), ask: row.ask || '', sure: !!row.sure, since: row.since }; } // what the server knows: a menu open in the session (a Bash approval looks like a running command here), and the question or command it waits on; unless the session moved since that answer. Before "your turn": a menu left open for longer than the lead's quiet time still needs you
|
|
1473
1486
|
if (id === 'main' && !s) { // the lead is at work until the message that closes its turn, even while it thinks, and from its first turn on (the server says which transcripts carry that mark); one without it falls back on "quiet for 25 s", and a turn cut short on 3 minutes of silence
|
|
1474
1487
|
const open = S.live && la && (S.sawEnd ? !S.turnOver && now - la < 180000 : now - la < 25000);
|
|
1475
1488
|
if (r || (w && w.size) || open) s = 'working'; else if (S.live && la) { const g = gaveOf(la); return { k: 'done', txt: (g ? '⚠ ' + L('a abandonné ?', 'gave up?') : '✓ ' + L('à vous', 'your turn')) + ' · ' + fmtShort(Math.max(0, now - la)), ...(g ? { gave: g } : {}) }; }
|
|
1476
1489
|
}
|
|
1477
1490
|
if (s === 'done') return { k: 'done', txt: '✓ ' + L('terminé', 'done') };
|
|
1478
1491
|
if (!s) return { k: 'idle', txt: '' };
|
|
1479
|
-
if (S.live && atTail() && r && r.ts && r.name && NEEDS_OK.test(r.name)) { const age = now - r.ts; if (age > (ASKS.test(r.name) ? 4000 : 15000)) return { k: 'blocked', txt: '✋ ' + L('attend
|
|
1492
|
+
if (S.live && atTail() && r && r.ts && r.name && NEEDS_OK.test(r.name) && !(rowOf(S.cur) || {}).known) { const age = now - r.ts; if (age > (ASKS.test(r.name) ? 4000 : 15000)) return { k: 'blocked', txt: '✋ ' + L('vous attend ? ', 'needs you? ') + fmtShort(age), since: r.ts }; } /* a guess, on the tile only (not sure: no red line, no sound), and only where Claude Code does not say whether a menu is open (known): there, its word is believed */
|
|
1480
1493
|
if (w && w.size) { // really waiting only while the lead has a sub-agent call pending, or while those agents are still active (background agents never block the lead)
|
|
1481
1494
|
const pendingSub = r && /^(Task|Agent)$/.test(r.name), open = [...w].filter((c) => S.status[c] !== 'done' && (pendingSub || !S.live || now - Math.max(S.lastAct[c] || 0, S.orderTs[c] || 0) < 120000));
|
|
1482
1495
|
if (open.length) {
|
|
@@ -1511,7 +1524,7 @@ function paintAsk(now) {
|
|
|
1511
1524
|
if (el.dataset.k !== m.id) { el.dataset.k = m.id; el.className = 'on'; el.setAttribute('aria-label', L('Ce que la session attend de vous', 'What the session is waiting for from you')); el.innerHTML = askHtml(m, p); } // built once per menu, so it is announced once
|
|
1512
1525
|
const t = el.querySelector('.ak-t'); if (t) t.textContent = fmtShort(Math.max(0, now - (row.since || now)));
|
|
1513
1526
|
}
|
|
1514
|
-
$('#askc').onclick = (e) => { if (e.target.closest('.ax')) { ASKC.off = $('#askc').dataset.k; paintAsk(Date.now()); } };
|
|
1527
|
+
$('#askc').onclick = (e) => { if (e.target.closest('.ax')) { ASKC.off = $('#askc').dataset.k; paintAsk(Date.now()); } else if (!String(getSelection() || '')) answerAt(S.cur); }; /* not while you select its text to copy it */
|
|
1515
1528
|
function paintStates() {
|
|
1516
1529
|
const now = Date.now(), n = { working: 0, waiting: 0, blocked: 0, stalled: 0, done: 0 }, ros = [], attn = [];
|
|
1517
1530
|
for (const p of Object.values(S.agents)) {
|
|
@@ -1520,7 +1533,7 @@ function paintStates() {
|
|
|
1520
1533
|
STATE_CLASSES.forEach((c) => t.classList.toggle(c, st.k === c));
|
|
1521
1534
|
const el = t.querySelector('.status'); if (el.textContent !== st.txt) { el.textContent = st.txt; const tb = t.querySelector('.tbadge'); if (tb) tb.style.top = el.offsetHeight > 26 ? el.offsetTop + el.offsetHeight + 4 + 'px' : ''; } /* a status on two lines: the badges under it move down */ const sc = 'status ' + st.k + (isTurn(p.id, st) ? ' turn' : '') + (st.gave ? ' gave' : ''); if (el.className !== sc) el.className = sc;
|
|
1522
1535
|
const pr = t.querySelector('.prop'), want = { blocked: '✋', stalled: '😰', waiting: '⌛' }[st.k] || '', was = S.prevState[p.id]; // a raised hand, a sweat drop, an hourglass: the call metaphor for "needs you / stuck / waiting"
|
|
1523
|
-
const spot = S.spotted || (S.spotted = new Set()); if (st.k !== 'blocked') spot.delete(p.id); else if (!spot.has(p.id) && shown && !S.gone.has(p.id) && !S.speakers.size && !(S.focusLock > Date.now())) { spot.add(p.id); setFocus(p.id); } // one that waits on you takes the spotlight once per wait, as soon as nobody talks (the speaker has it until then)
|
|
1536
|
+
const spot = S.spotted || (S.spotted = new Set()); if (st.k !== 'blocked' || !st.sure) spot.delete(p.id); else if (!spot.has(p.id) && shown && !S.gone.has(p.id) && !S.speakers.size && !(S.focusLock > Date.now())) { spot.add(p.id); setFocus(p.id); } // one that waits on you takes the spotlight once per wait, as soon as nobody talks (the speaker has it until then)
|
|
1524
1537
|
if (st.k === 'done' && was && was !== 'done' && was !== 'idle') { pr.textContent = '🎉'; pr.className = 'prop cheer'; setTimeout(() => { if (pr.classList.contains('cheer')) { pr.textContent = ''; pr.className = 'prop'; } }, 1200); }
|
|
1525
1538
|
else if (!pr.classList.contains('cheer')) { if (pr.textContent !== want) pr.textContent = want; const pc = 'prop ' + (want ? st.k : ''); if (pr.className !== pc) pr.className = pc; }
|
|
1526
1539
|
if (shown && !S.gone.has(p.id)) ros.push({ p, st });
|
|
@@ -1531,7 +1544,7 @@ function paintStates() {
|
|
|
1531
1544
|
paintPill();
|
|
1532
1545
|
const b = $('#board'), parts = [['working', '⚙', L('au travail', 'working')], ['waiting', '🔗', L('attendent leurs sous-agents', 'on sub-agents')], ['blocked', '✋', L('vous attendent', 'need you')], ['stalled', '⚠', L('bloqués', 'stalled')], ['done', '✓', L('terminés', 'done')]]
|
|
1533
1546
|
.filter(([k]) => n[k] && !S.pillSess).map(([k, i, l]) => `<span class="${k}" title="${n[k]} ${l}">${i} ${n[k]}<em> ${l}</em></span>`).join('');
|
|
1534
|
-
if (b.innerHTML !== parts) b.innerHTML = parts; fitBoard(); S.nBlocked =
|
|
1547
|
+
if (b.innerHTML !== parts) b.innerHTML = parts; fitBoard(); S.nBlocked = ros.filter((x) => x.st.k === 'blocked' && x.st.sure).length; /* the sound, the red icon and the title: only a menu really open, not a guess nor a stalled hand-off */ S.attn = attn; paintRoster(ros); paintFiles(); paintAsk(now); paintAttn(now); return n;
|
|
1535
1548
|
}
|
|
1536
1549
|
function fitBoard(force) { // the chips lose their words when they do not all fit (a long language, a narrower window): a chip is never cut mid-word. Tried again with the words only when the window or the texts around have changed
|
|
1537
1550
|
const b = $('#board'), key = innerWidth + '|' + b.textContent.length + '|' + $('#pill').textContent.length + '|' + $('#subtitle').textContent.length;
|
|
@@ -1543,7 +1556,12 @@ const RORDER = { blocked: 0, stalled: 1, working: 2, waiting: 3, idle: 4, done:
|
|
|
1543
1556
|
const TOOL = { _codex: 'Codex', _vibe: 'Vibe', _cowork: 'Cowork' }, leadTool = (p) => (p.id === 'main' && S.cur && TOOL[S.cur.proj] ? ' · ' + TOOL[S.cur.proj] : ''); // a session that is not a Claude Code one says which tool runs it: on its tab, and next to its lead, who has the same name in every call
|
|
1544
1557
|
const modelShort = (m) => { const v = String(m || ''); if (!v || v[0] === '<') return ''; const c = /(opus|sonnet|haiku|fable)[-_ ]?(\d{1,2})(?:[-.](\d{1,2})(?!\d))?(?!\d)/i.exec(v); const o = /claude-(\d)(?:-(\d))?-(opus|sonnet|haiku)/i.exec(v), cap = (w) => w[0].toUpperCase() + w.slice(1).toLowerCase(); if (o) return cap(o[3]) + ' ' + o[1] + (o[2] ? '.' + o[2] : ''); const g = /^gpt-(\d+(?:\.\d+)?[a-z]?)(?:-(.+))?$/i.exec(v.replace(/^.*\//, '').replace(/-\d{4}-?\d{2}-?\d{2}$/, '')); if (g) return ('GPT-' + g[1].toLowerCase() + (g[2] ? ' ' + g[2].split('-').map((w) => (/^(mini|nano)$/i.test(w) ? w.toLowerCase() : cap(w))).join(' ') : '')).slice(0, 24); /* Codex: gpt-6-pro → GPT-6 Pro, gpt-5.1-codex-max → GPT-5.1 Codex Max, gpt-5-mini → GPT-5 mini */ return c ? cap(c[1]) + ' ' + c[2] + (c[3] ? '.' + c[3] : '') : v.replace(/^.*\//, '').replace(/-\d{8}$/, '').slice(0, 24); }; /* older ids put the version first: claude-3-5-sonnet → Sonnet 3.5 */ // claude-haiku-4-5-20251001 → Haiku 4.5
|
|
1545
1558
|
const mixedModels = () => new Set(Object.keys(S.usage).filter((id) => S.agents[id] && S.model[id] && tokTotal(S.usage[id])).map((id) => modelShort(S.model[id])).filter(Boolean)).size > 1; // only then is the model worth a place next to the count
|
|
1546
|
-
const
|
|
1559
|
+
const effortWord = (e) => ({ low: L('faible', 'low'), medium: L('moyen', 'medium'), high: L('élevé', 'high'), xhigh: L('très élevé', 'extra high'), max: L('maximal', 'max') }[e] || e); // the effort Claude Code says it worked at (written since 2.1.275; nothing from older versions)
|
|
1560
|
+
const effortOf = (id) => (S.effort && S.effort[id] ? ' · ' + L('effort', 'effort') + ' ' + effortWord(S.effort[id]) : '');
|
|
1561
|
+
const advisorOf = (id) => (S.adv && S.adv[id] && modelShort(S.adv[id]) ? L('conseillé par', 'advised by') + ' ' + modelShort(S.adv[id]) : ''); // the model it may ask for advice, when not itself
|
|
1562
|
+
const modelTip = (id) => (S.model[id] && modelShort(S.model[id]) ? '\n' + L('Modèle', 'Model') + ' · ' + S.model[id] + effortOf(id) + (advisorOf(id) ? '\n' + advisorOf(id) : '') : '');
|
|
1563
|
+
const costStr = (c) => (c.final ? '' : '≥ ') + '$' + (c.usd < 0.01 ? '0.01' : c.usd.toFixed(2)); // Claude Code's own count (cost-state, 2.1.300 on), sub-agents included; ≥ when work went on after it counted
|
|
1564
|
+
const costTip = () => L('Compté par Claude Code, sous-agents compris', 'Counted by Claude Code, sub-agents included') + (S.cost && !S.cost.final ? '. ' + L('Au moins : le travail a continué depuis son dernier compte.', 'At least: work went on after it last counted.') : '');
|
|
1547
1565
|
const rosTok = (id) => { const u = S.usage[id]; return u && tokTotal(u) ? `<span class="rt" title="${esc(tokTip(u) + modelTip(id))}">⚡${fmtTok(tokTotal(u))}${mixedModels() && modelShort(S.model[id]) ? ' · ' + esc(modelShort(S.model[id])) : ''}</span>` : ''; };
|
|
1548
1566
|
function paintRoster(ros) { // a fixed list beside the call: who is doing what, urgent first, readable even with dozens of agents
|
|
1549
1567
|
const box = $('#roster'); if (!box || !document.body.classList.contains('rost')) return;
|
|
@@ -1623,6 +1641,7 @@ function activityLabel(t) { // the short "what is on their screen" tag
|
|
|
1623
1641
|
case 'glob': return L('Liste ', 'Listing ') + String(d.pattern || '').slice(0, 24);
|
|
1624
1642
|
case 'todo': return L('Met à jour sa todo', 'Updating todo list');
|
|
1625
1643
|
case 'artifact': return (d.open ? L('Montre ', 'Showing ') : d.doc ? L('Crée ', 'Writing ') : L('Publie ', 'Publishing ')) + (d.title || (d.open ? 'Artifact' : f)).slice(0, 30);
|
|
1644
|
+
case 'browser': { const s = (d.steps || []).slice(-1)[0] || {}, n = (s.n || '').trim(), h = hostOf(s.u); if (n) return n.length > 36 ? n.slice(0, 36).replace(/\s+\S*$/, '') + '…' : n; return h ? L('Navigue sur ', 'Browsing ') + h : L('Navigue sur le web', 'Browsing the web'); }
|
|
1626
1645
|
case 'web': return d.url ? L('Consulte ', 'Fetching ') + d.url.replace(/^https?:\/\//, '').slice(0, 26) : L('Recherche sur le web', 'Web search');
|
|
1627
1646
|
case 'text': { const w = d.what; if (w === 'question') return L('Pose une question', 'Asking a question'); if (w === 'skill') return L('Utilise ', 'Using skill ') + (d.v || ''); if (w === 'mcp') return d.v || t.name; if (w === 'toolsearch') return L('Cherche un outil', 'Looking for a tool'); return t.name; }
|
|
1628
1647
|
default: return t.name;
|
|
@@ -1637,14 +1656,14 @@ function pushTerm(id, tool) {
|
|
|
1637
1656
|
}
|
|
1638
1657
|
function applyResults(ev, silent) { // the output of a tool call arrives
|
|
1639
1658
|
const buf = S.term[ev.agent] || []; let last = null;
|
|
1640
|
-
for (const it of ev.items) for (let i = buf.length - 1; i >= 0; i--) if (buf[i].id === it.id) { Object.assign(buf[i], { out: it.out, err: it.err, end: ev.ts, img: it.img || 0, picAt: it.img && !silent ? performance.now() : 0, art: it.art || null }); last = buf[i]; break; }
|
|
1659
|
+
for (const it of ev.items) for (let i = buf.length - 1; i >= 0; i--) if (buf[i].id === it.id) { Object.assign(buf[i], { out: it.out, err: it.err, end: ev.ts, img: it.img || 0, picAt: it.img && !silent ? performance.now() : 0, art: it.art || null, web: it.web || null }); last = buf[i]; break; }
|
|
1641
1660
|
if (S.run[ev.agent] && ev.items.some((it) => it.id === S.run[ev.agent].id)) delete S.run[ev.agent];
|
|
1642
1661
|
if (silent || !last) return;
|
|
1643
1662
|
setTicker(ev.agent, last); if (S.present === ev.agent) { renderPresent(); armPresent(); }
|
|
1644
1663
|
}
|
|
1645
1664
|
function setTicker(id, e) { // the strip on the tile: spinner while running, then ✓/✗ and the real duration
|
|
1646
1665
|
const t = $('#t-' + id); if (!t) return; const tk = t.querySelector('.ticker'), tool = e.tool, running = e.end == null;
|
|
1647
|
-
tk.innerHTML = `${running ? '<span class="spin"></span>' : ''}<i>${esc(tool.name)}</i> ${esc(tool.arg || '')}${running ? ' <em class="el"></em>' : ` <em class="${e.err ? 'bad' : 'ok'}">${e.err ? '✗' : '✓'} ${fmtDur(e.end - e.ts)}</em>`}`;
|
|
1666
|
+
tk.innerHTML = `${running ? '<span class="spin"></span>' : ''}<i>${esc(e.k === 'browser' ? 'Chrome' : tool.name)}</i> ${esc(tool.arg || '')}${running ? ' <em class="el"></em>' : ` <em class="${e.err ? 'bad' : 'ok'}">${e.err ? '✗' : '✓'} ${fmtDur(e.end - e.ts)}</em>`}`;
|
|
1648
1667
|
tk.classList.add('on'); if (running) { tk.classList.remove('flash'); void tk.offsetWidth; tk.classList.add('flash'); }
|
|
1649
1668
|
}
|
|
1650
1669
|
function tickTools(ev) {
|
|
@@ -1671,6 +1690,7 @@ function termModel(id) {
|
|
|
1671
1690
|
const buf = S.term[id] || [], last = buf[buf.length - 1], lines = [], more = (n) => ({ c: 'dim', t: `… +${n} ${L('lignes', 'lines')}` });
|
|
1672
1691
|
const pic = S.cur && buf.slice(-12).reverse().find((e) => e.img), fresh = pic && performance.now() - pic.picAt < (S.live ? 8000 : 2500 / spd()); // a picture a tool returned (screenshot, image file) stays up for a few seconds whatever comes next, then for the next few calls: a screenshot is usually followed by a click or two
|
|
1673
1692
|
const web = last && last.k === 'artifact' && last.art ? S.arts.get(last.art.url) : null; if (web) return artModel(web, id); // a page that was just published: the browser window, until the agent does something else
|
|
1693
|
+
if (last && last.k === 'browser') return browserModel(buf, last, id);
|
|
1674
1694
|
if (pic && (fresh || (buf.length - buf.indexOf(pic) <= 4 && (pic === last || !/^(edit|write|read)$/.test(last.k))))) return { view: 'image', title: pic.k === 'read' ? base(pic.tool.d.file) : pic.tool.name.split('__').pop(), imgs: Array.from({ length: Math.min(pic.img, 3) }, (_, n) => mediaUrl(id, pic.id, n)), more: pic.img - 3, lines, stat: statOf(last, id) };
|
|
1675
1695
|
if (last && (last.k === 'edit' || last.k === 'write' || last.k === 'read')) {
|
|
1676
1696
|
const d = last.tool.d, rows = (txt, c) => String(txt || '').split('\n').slice(0, 14).map((t) => ({ c, t }));
|
|
@@ -1690,6 +1710,32 @@ function termModel(id) {
|
|
|
1690
1710
|
}
|
|
1691
1711
|
return { view: 'term', lines: lines.slice(-60), stat: statOf(last, id) };
|
|
1692
1712
|
}
|
|
1713
|
+
// An agent driving a browser (Claude in Chrome, the desktop app's browser): the window as it last saw it, the address it is on, and the pointer where it last clicked, which glides to the next click as that call starts.
|
|
1714
|
+
// The picture is the last screenshot, unless the agent has gone to another address since: an old page is not shown as the new one.
|
|
1715
|
+
const hostOf = (u) => { try { return u ? new URL(u).host : ''; } catch { return ''; } };
|
|
1716
|
+
function browserModel(buf, last, id) {
|
|
1717
|
+
let pic = null, url = '', title = '', frame = null, ptr = null, gone = false;
|
|
1718
|
+
for (let i = buf.length - 1; i >= 0; i--) {
|
|
1719
|
+
const e = buf[i]; if (e.k !== 'browser') continue; const w = e.web || {}, st = (e.tool.d && e.tool.d.steps) || [];
|
|
1720
|
+
if (!url) url = w.u || (st.filter((s) => s.u).pop() || {}).u || ''; if (!title && w.t) title = w.t; if (!frame && w.f) frame = w.f;
|
|
1721
|
+
if (!ptr) for (let j = st.length - 1, ask = true; j >= 0; j--) { const at = st[j].x != null ? [st[j].x, st[j].y] : ask && w.p; if (/click|move|drag|hover/.test(st[j].a)) { if (at) { ptr = { x: at[0], y: at[1], k: e.id + ':' + j, clk: /click/.test(st[j].a) }; break; } ask = false; } } // a click on an element has its point in the answer (w.p, of the last click only); without one, the pointer stays where it last was
|
|
1722
|
+
if (!pic && e.img) pic = e; if (!pic && st.some((s) => s.u)) gone = true;
|
|
1723
|
+
if (pic && url && title && frame && ptr) break;
|
|
1724
|
+
}
|
|
1725
|
+
const s = ((last.tool.d && last.tool.d.steps) || []).slice(-1)[0] || {}, host = hostOf(url), say = s.n || (s.q ? '🔎 ' + s.q : s.u ? '→ ' + s.u.replace(/^https?:\/\//, '') : s.a ? 'Chrome · ' + s.a.replace(/_/g, ' ') : ''), stat = statOf(last, id);
|
|
1726
|
+
return { view: 'browser', title: title || host || 'Chrome', url, host, img: pic && !gone ? mediaUrl(id, pic.id, Math.min(pic.img - 1, 9)) : '', frame, ptr, typed: s.t || '', lines: [], stat: say ? stat.replace(last.tool.name, say) : stat };
|
|
1727
|
+
}
|
|
1728
|
+
const BROWSER_HTML = '<div class="pnav"><span class="purl"></span></div><div class="pbr"><div class="pfr"><img alt=""><i class="pptr"></i><span class="pkey"></span></div><div class="pcard pnone"><i>🌐</i><b></b><em></em></div></div>';
|
|
1729
|
+
function paintBrowser(pb, m) { // the window stays from one step to the next: the address changes, the pointer glides, the picture is swapped when a new one comes back
|
|
1730
|
+
const q = (s) => pb.querySelector(s), fr = q('.pfr'), img = q('.pfr img'), ptr = q('.pptr'), key = q('.pkey'); if (!fr) return;
|
|
1731
|
+
q('.purl').textContent = m.url ? (/^https:/.test(m.url) ? '🔒 ' : '') + m.url.replace(/^https?:\/\//, '') : '';
|
|
1732
|
+
q('.pbr').classList.toggle('none', !m.img); q('.pnone b').textContent = m.host || 'Chrome'; q('.pnone em').textContent = m.typed ? '⌨ ' + m.typed : L('Pas encore d’image de cette page', 'No picture of this page yet');
|
|
1733
|
+
if (m.img && img.getAttribute('src') !== m.img) { img.onload = () => { if (S.present) renderPresent(); }; img.src = m.img; }
|
|
1734
|
+
const W = m.frame ? m.frame[0] : img.naturalWidth, H = m.frame ? m.frame[1] : img.naturalHeight, on = !!(m.ptr && W && H); if (W && H) fr.style.setProperty('--ar', (W / H).toFixed(4));
|
|
1735
|
+
const pos = (el) => { el.style.left = Math.min(100, Math.max(0, m.ptr.x / W * 100)) + '%'; el.style.top = Math.min(100, Math.max(0, m.ptr.y / H * 100)) + '%'; };
|
|
1736
|
+
ptr.hidden = !on; if (on) { pos(ptr); pos(key); if (m.ptr.clk && ptr.dataset.k !== m.ptr.k) { ptr.classList.remove('clk'); void ptr.offsetWidth; ptr.classList.add('clk'); } ptr.dataset.k = m.ptr.k; }
|
|
1737
|
+
key.textContent = on && m.typed ? '⌨ ' + m.typed : '';
|
|
1738
|
+
}
|
|
1693
1739
|
const lineHtml = (l, view) => view === 'editor'
|
|
1694
1740
|
? `<div class="ln ${l.c}"><b>${esc(l.n != null ? l.n : l.c === 'add' ? '+' : l.c === 'del' ? '−' : '')}</b>${esc(l.t) || ' '}</div>`
|
|
1695
1741
|
: `<div class="tl ${l.c}">${l.c === 'cmd' ? '<span class="ps">❯</span> ' : l.c === 'tool' ? '<span class="dotg">●</span> ' : l.c === 'run' ? '<span class="spin"></span>' : ''}${esc(l.t)}</div>`;
|
|
@@ -1697,12 +1743,13 @@ const lineHtml = (l, view) => view === 'editor'
|
|
|
1697
1743
|
// ---------- screen sharing: a real video-call presentation (window + presenter camera) ----------
|
|
1698
1744
|
function renderPresent() {
|
|
1699
1745
|
const id = S.present, p = S.agents[id]; if (!p) return; if (S.artPin && !S.arts.has(S.artPin)) { S.artPin = null; armPresent(); }
|
|
1700
|
-
const pinned = S.artPin ? S.arts.get(S.artPin) : null, whole = !pinned && S.artWhole ? S.arts.get(S.artWhole) : null, m = pinned ? artModel(pinned, id) : whole ? artModel(whole, id) : termModel(id), shape = m.view === 'web' && pinned ? 'pin' : m.view === 'web' || m.view === 'image' ? 'pic' : '';
|
|
1746
|
+
const pinned = S.artPin ? S.arts.get(S.artPin) : null, whole = !pinned && S.artWhole ? S.arts.get(S.artWhole) : null, m = pinned ? artModel(pinned, id) : whole ? artModel(whole, id) : termModel(id), shape = m.view === 'web' && pinned ? 'pin' : m.view === 'web' || m.view === 'image' || m.view === 'browser' ? 'pic' : '';
|
|
1701
1747
|
$('#present .pwin').className = 'pwin ' + (m.view === 'term' ? 'term' : m.view); $('#present').classList.toggle('pic', shape === 'pic'); $('#present').classList.toggle('pin', shape === 'pin'); if (shape !== S.picUp) { S.picUp = shape; layout(); } // a picture or a page gets a taller window, a pinned page the tallest
|
|
1702
1748
|
$('#ptitle').textContent = m.view === 'term' ? `${p.name} — zsh — 96×24` : m.title;
|
|
1703
|
-
const pb = $('#pbody'), shown = m.view === 'image' ? m.imgs.join(' ') : m.view === 'web' ? m.key : ''; pb.dataset.art = m.view === 'web' ? m.a.url : '';
|
|
1704
|
-
if (shown) { if (pb.dataset.img !== shown) pb.innerHTML = m.view === 'web' ? artHtml(m) : m.imgs.map((u) => `<img src="${esc(u)}" alt="">`).join('') + (m.more > 0 ? `<span class="pmore">+${m.more}</span>` : ''); } // the same pictures are left in place: redrawing them would make them blink
|
|
1749
|
+
const pb = $('#pbody'), shown = m.view === 'image' ? m.imgs.join(' ') : m.view === 'web' ? m.key : m.view === 'browser' ? 'browser' : ''; pb.dataset.art = m.view === 'web' ? m.a.url : '';
|
|
1750
|
+
if (shown) { if (pb.dataset.img !== shown) pb.innerHTML = m.view === 'web' ? artHtml(m) : m.view === 'browser' ? BROWSER_HTML : m.imgs.map((u) => `<img src="${esc(u)}" alt="">`).join('') + (m.more > 0 ? `<span class="pmore">+${m.more}</span>` : ''); } // the same pictures are left in place: redrawing them would make them blink
|
|
1705
1751
|
else pb.innerHTML = (m.view === 'editor' ? `<div class="ptab"><span>${esc(m.tab.file)}</span><em>${esc(m.tab.path)}</em></div>` : '') + m.lines.map((l) => lineHtml(l, m.view)).join('') + (m.view === 'term' ? '<div class="tl"><span class="ps">❯</span> <span class="cursor"></span></div>' : '');
|
|
1752
|
+
if (m.view === 'browser') paintBrowser(pb, m);
|
|
1706
1753
|
pb.dataset.img = shown; pb.scrollTop = m.view === 'term' ? pb.scrollHeight : 0; $('#pstat').textContent = m.stat; if (m.view === 'web') fitArt();
|
|
1707
1754
|
const td = S.todos[id], el = $('#ptodo'), tk = m.view !== 'web' && td && td.length ? prefs.lang + '\n' + td.map((x) => x.s + ' ' + x.c).join('\n') : ''; el.style.display = tk ? '' : 'none'; $('#present').classList.toggle('has-todo', !!tk);
|
|
1708
1755
|
if (tk && el.dataset.k !== tk) { // redrawn only when it changes, so it stays where you scrolled it; the task in progress is brought into view
|
|
@@ -2052,7 +2099,7 @@ function renderDetail() {
|
|
|
2052
2099
|
if (!S.detail) return; const id = S.detail, evs = S.events.slice(0, S.idx + 1).filter((e) => e.agent === id || e.to === id);
|
|
2053
2100
|
const order = evs.find((e) => e.kind === 'order' && e.to === id), tools = evs.filter((e) => e.agent === id && e.kind === 'tools').flatMap((e) => e.tools);
|
|
2054
2101
|
const counts = {}; tools.forEach((t) => (counts[t.name] = (counts[t.name] || 0) + 1));
|
|
2055
|
-
const u = S.usage[id], tokHtml = u && tokTotal(u) ? `<h3>${L('Jetons', 'Tokens')} · ⚡ ${fmtTok(tokTotal(u))}</h3><div class="dim">${L('entrée', 'input')} ${fmtTok(u.i)} · ${L('sortie', 'output')} ${fmtTok(u.o)} · ${L('écriture cache', 'cache write')} ${fmtTok(u.w)} · ${L('lecture cache', 'cache read')} ${fmtTok(u.r)}${modelShort(S.model[id]) ? ` · ${L('Modèle', 'Model')} ${esc(S.model[id])}` : ''}</div>` : '';
|
|
2102
|
+
const u = S.usage[id], tokHtml = u && tokTotal(u) ? `<h3>${L('Jetons', 'Tokens')} · ⚡ ${fmtTok(tokTotal(u))}</h3><div class="dim">${L('entrée', 'input')} ${fmtTok(u.i)} · ${L('sortie', 'output')} ${fmtTok(u.o)} · ${L('écriture cache', 'cache write')} ${fmtTok(u.w)} · ${L('lecture cache', 'cache read')} ${fmtTok(u.r)}${modelShort(S.model[id]) ? ` · ${L('Modèle', 'Model')} ${esc(S.model[id])}${esc(effortOf(id))}${advisorOf(id) ? ' · ' + esc(advisorOf(id)) : ''}` : ''}</div>` : '';
|
|
2056
2103
|
$('#dbody').innerHTML = tokHtml + (order ? `<h3>${L('Consigne de', 'Prompt from')} ${esc(nameOf(order.agent))}</h3><pre>${esc(order.text)}</pre>` : '') +
|
|
2057
2104
|
(id === 'user' ? (S.idleHtml = (S.idleFor === S.detailOpen && S.idleHtml) || idleHtml(), S.idleFor = S.detailOpen, S.idleHtml) : `<h3>${L('Outils', 'Tools')} (${tools.length})</h3><div>${Object.entries(counts).map(([n, c]) => `${esc(n)} ×${c}`).join(' · ') || '—'}</div>` +
|
|
2058
2105
|
`<h3>${L('Activité récente', 'Recent activity')}</h3>` + (S.term[id] || []).slice(-30).reverse().map((e) => `<details><summary>${e.end == null ? '⠋' : e.err ? '✗' : '✓'} ${esc(e.tool.name)} <span class="dim">${e.end != null ? fmtDur(e.end - e.ts) : L('en cours', 'running')}</span> — ${esc((e.tool.arg || '').slice(-60))}</summary><pre>${esc((e.tool.d && e.tool.d.kind === 'cmd' ? '$ ' + e.tool.d.text + '\n' : '') + (e.out || ''))}</pre>${e.img && S.cur ? `<img class="dimg" src="${esc(mediaUrl(id, e.id, 0))}" alt="" loading="lazy">` : ''}</details>`).join('')) +
|
|
@@ -2115,7 +2162,7 @@ function rateDay() { // a day of use: the page in view that day
|
|
|
2115
2162
|
rateTip();
|
|
2116
2163
|
}
|
|
2117
2164
|
function rateTip() {
|
|
2118
|
-
const t = $('#rateTip'); if (!RATE_ASKS || prefs.rateDone || firstDay() || askedToday('rate') || (+prefs.rateDays || 0) < 3 || (prefs.rateLater && utcDay() < prefs.rateLater) || $('#menuTip').style.display !== 'none' || $('#usageTip').style.display !== 'none' || $('#menu').classList.contains('on')) { t.style.display = 'none'; return; }
|
|
2165
|
+
const t = $('#rateTip'); if (!RATE_ASKS || prefs.rateDone || firstDay() || askedToday('rate') || (+prefs.rateDays || 0) < 3 || (prefs.rateLater && utcDay() < prefs.rateLater) || $('#menuTip').style.display !== 'none' || $('#usageTip').style.display !== 'none' || $('#updTip').style.display !== 'none' || $('#menu').classList.contains('on')) { t.style.display = 'none'; return; }
|
|
2119
2166
|
const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return;
|
|
2120
2167
|
$('#rateTipT').textContent = L('Agent Standup vous plaît ? Une étoile sur GitHub aide d’autres personnes à le trouver.', 'Enjoying Agent Standup? A star on GitHub helps other people find it.');
|
|
2121
2168
|
$('#rateYes').textContent = L('⭐ Mettre une étoile', '⭐ Star it'); $('#rateLater').textContent = L('Plus tard', 'Later'); $('#rateNo').textContent = L('Non merci', 'No thanks');
|
|
@@ -2132,7 +2179,7 @@ function coffeeAsk(busyAt) {
|
|
|
2132
2179
|
const now = Date.now(), team = Object.keys(S.agents).filter((id) => id !== 'main' && id !== 'user' && S.lastAct[id] >= busyAt).length;
|
|
2133
2180
|
if (!(now - busyAt >= 10 * 60e3 || (team >= 3 && now - busyAt >= 2 * 60e3))) return;
|
|
2134
2181
|
if ($('#rateTip').style.display !== 'none' || $('#usageTip').style.display !== 'none' || rateTip.seen === utcDay() || prefs.rateDone === utcDay() || (RATE_ASKS && !prefs.rateDone && prefs.rateLast === utcDay() && (+prefs.rateDays || 0) >= 3)) return; /* the star shown, given or declined today */
|
|
2135
|
-
clearTimeout(coffeeAsk.t); coffeeAsk.t = setTimeout(() => { if (prefs.coffeeAsked || document.hidden || $('#menu').classList.contains('on') || $('#menuTip').style.display !== 'none' || $('#rateTip').style.display !== 'none' || agentState('main', Date.now()).k !== 'done') return; coffeeTip(); }, 8000); /* after the confetti and the lead's last word */
|
|
2182
|
+
clearTimeout(coffeeAsk.t); coffeeAsk.t = setTimeout(() => { if (prefs.coffeeAsked || document.hidden || $('#menu').classList.contains('on') || $('#menuTip').style.display !== 'none' || $('#rateTip').style.display !== 'none' || $('#updTip').style.display !== 'none' || agentState('main', Date.now()).k !== 'done') return; coffeeTip(); }, 8000); /* after the confetti and the lead's last word */
|
|
2136
2183
|
}
|
|
2137
2184
|
function coffeeTip() {
|
|
2138
2185
|
const at = [$('#bCoffee'), $('#bMenu')].find((b) => b.getBoundingClientRect().width), t = $('#coffeeTip'); if (!at) return;
|
|
@@ -2156,7 +2203,7 @@ function usageStart() {
|
|
|
2156
2203
|
}
|
|
2157
2204
|
function usageTip() {
|
|
2158
2205
|
const t = $('#usageTip'); if (!USAGE_ASKS || prefs.usageAsked || prefs.shareUsage === true || firstDay() || document.hidden || $('#menu').classList.contains('on')) { t.style.display = 'none'; return; } /* firstDay: like every ask, not the first day the app is used */
|
|
2159
|
-
if ($('#menuTip').style.display !== 'none') { usageStart.t = setTimeout(usageTip, 4000); return; } /* after the tip about the moved menu */
|
|
2206
|
+
if ($('#menuTip').style.display !== 'none' || $('#updTip').style.display !== 'none') { usageStart.t = setTimeout(usageTip, 4000); return; } /* after the tip about the moved menu, or about a new version */
|
|
2160
2207
|
if (prefs.askDay === utcDay() && prefs.askWhat === 'pack') { t.style.display = 'none'; return; } /* the Halloween pack's day: one ask at a time, this one comes back on the next */
|
|
2161
2208
|
const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return;
|
|
2162
2209
|
$('#rateTip').style.display = 'none'; $('#coffeeTip').style.display = 'none'; noteAsk('usage'); if (!prefs.usageDay) { prefs.usageDay = utcDay(); savePrefs(); }
|
|
@@ -2167,6 +2214,49 @@ function usageTip() {
|
|
|
2167
2214
|
const usageAnswer = (yes) => { prefs.shareUsage = yes; prefs.usageAsked = true; savePrefs(); $('#usageTip').style.display = 'none'; syncSwitches(); document.querySelectorAll('.mi[data-t="shareUsage"] .sw').forEach((x) => x.classList.toggle('on', yes)); if (yes) usageOpened(true); };
|
|
2168
2215
|
$('#usageYes').onclick = () => usageAnswer(true); $('#usageNo').onclick = () => usageAnswer(false); $('#usageRead').onclick = () => openExternal('https://agent-standup.com/privacy/');
|
|
2169
2216
|
document.addEventListener('visibilitychange', () => { if (!document.hidden) { usageOpened(); if (USAGE_ASKS && !prefs.usageAsked && prefs.shareUsage !== true && $('#usageTip').style.display === 'none') usageStart(); } });
|
|
2217
|
+
// A newer version, in the desktop app, the command line and the Claude Code plugin (the editor updates itself from its store). Off until the person says yes: the page asks once, by the menu,
|
|
2218
|
+
// from the second day and on a day nothing else was asked, once the usage question is answered ("Yes, tell me" turns prefs.updateNotice on; any other answer leaves it off and it is not asked
|
|
2219
|
+
// again; ⚙ › All settings turns it on or off). Then the server asks npm at most once a day which version is the latest (server.js, updateInfo, which reads the answer again in the settings
|
|
2220
|
+
// file) and this page shows it once per version, with the step that updates this app: download the desktop app again, update the plugin, or the npx / npm command to copy. "Later" hides it
|
|
2221
|
+
// until the next version. One tip at a time by the menu; never asked with DO_NOT_TRACK or NO_UPDATE_NOTIFIER set (APP.updates), in a demo or embedded.
|
|
2222
|
+
const UPD_SHOWS = ['desktop', 'cli', 'plugin'].includes(APP.kind) && APP.updates !== false && APP.track !== false && !EMBED && !Q.get('demo');
|
|
2223
|
+
const tipsBusy = () => document.hidden || $('#menu').classList.contains('on') || ['#menuTip', '#usageTip', '#rateTip', '#coffeeTip'].some((s) => $(s).style.display !== 'none');
|
|
2224
|
+
function updStart() {
|
|
2225
|
+
if (!UPD_SHOWS) return; $('#mUpd').style.display = '';
|
|
2226
|
+
if (prefs.updateNotice !== true) { clearTimeout(updAsk.t); if (!prefs.updateAsked) updAsk.t = setTimeout(updAsk, 6000); return; } /* after the usage question, which waits 2.5 s */
|
|
2227
|
+
if (updStart.u) return updTip(0); /* known already: shown again in the language just chosen */
|
|
2228
|
+
if (document.hidden || Date.now() - (updStart.at || 0) < 3600e3) return; updStart.at = Date.now();
|
|
2229
|
+
clearTimeout(updStart.t); updStart.t = setTimeout(() => fetch('/api/update').then((r) => r.json()).then((u) => { if (u && u.newer && typeof u.latest === 'string') { updStart.u = u; updTip(0); } }).catch(() => {}), 3000);
|
|
2230
|
+
}
|
|
2231
|
+
function updAsk() {
|
|
2232
|
+
const t = $('#updTip'); if (!UPD_SHOWS || prefs.updateNotice === true || prefs.updateAsked || firstDay() || usagePending() || askedToday('update') || tipsBusy()) return; /* like every ask: not the first day, one ask a day; it comes back with the next day the page is in view */
|
|
2233
|
+
const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return;
|
|
2234
|
+
noteAsk('update'); updTip.mode = 'ask';
|
|
2235
|
+
$('#updTipT').textContent = L('Être prévenu quand une nouvelle version d’Agent Standup sort ? Au plus une fois par jour, l’app demanderait à npm le numéro de la dernière version : rien sur vous ni sur vos sessions. npm voit votre adresse IP, comme pour tout téléchargement. Vous pouvez l’arrêter quand vous voulez dans ⚙ › Tous les réglages.', 'Get told when a new version of Agent Standup is out? At most once a day, the app would ask npm for the number of the latest version: nothing about you or your sessions. npm sees your IP address, as with any download. You can turn it off any time in ⚙ › All settings.');
|
|
2236
|
+
$('#updCmd').style.display = 'none'; $('#updNotes').textContent = L('Confidentialité', 'Privacy policy'); $('#updLater').textContent = L('Non merci', 'No thanks'); $('#updGo').textContent = L('Oui, prévenez-moi', 'Yes, tell me');
|
|
2237
|
+
updPlace(t, r);
|
|
2238
|
+
}
|
|
2239
|
+
const updPlace = (t, r) => { t.style.display = ''; t.style.top = Math.round(r.bottom + 10) + 'px'; t.style.right = Math.max(8, Math.round(innerWidth - r.right - 6)) + 'px'; t.style.setProperty('--ax', Math.max(8, Math.round(r.width / 2 - 2)) + 'px'); };
|
|
2240
|
+
function updTip(n) {
|
|
2241
|
+
const t = $('#updTip'), u = updStart.u; clearTimeout(updTip.t); if (!u || prefs.updateNotice !== true || prefs.updSeen === u.latest) { t.style.display = 'none'; return; }
|
|
2242
|
+
if (tipsBusy()) { t.style.display = 'none'; if (n < 40) updTip.t = setTimeout(() => updTip(n + 1), 15000); return; } /* after the other tips by the menu */
|
|
2243
|
+
const r = $('#bMenu').getBoundingClientRect(); if (!r.width) return; updTip.mode = 'tell';
|
|
2244
|
+
const step = u.how === 'download' ? L('Téléchargez la nouvelle app sur GitHub.', 'Download the new app from GitHub.') : u.how === 'plugin' ? L('Mettez le plugin à jour dans un terminal, puis redémarrez Claude Code :', 'Update the plugin in a terminal, then restart Claude Code:') : u.how === 'npx' ? L('La prochaine fois, lancez-le avec :', 'Next time, start it with:') : L('Mettez-le à jour avec :', 'Update it with:');
|
|
2245
|
+
$('#updTipT').textContent = L('Agent Standup {0} est sorti (vous avez la {1}).', 'Agent Standup {0} is out (you have {1}).').replace('{0}', () => u.latest).replace('{1}', () => u.current) + ' ' + step;
|
|
2246
|
+
$('#updCmd').textContent = u.cmd || ''; $('#updCmd').style.display = u.cmd ? '' : 'none';
|
|
2247
|
+
$('#updNotes').textContent = L('Nouveautés', 'What’s new'); $('#updLater').textContent = L('Plus tard', 'Later'); $('#updGo').textContent = u.how === 'download' ? L('Télécharger', 'Download') : L('Copier', 'Copy');
|
|
2248
|
+
updPlace(t, r);
|
|
2249
|
+
}
|
|
2250
|
+
const updEnd = () => { if (updStart.u) prefs.updSeen = updStart.u.latest; savePrefs(); $('#updTip').style.display = 'none'; };
|
|
2251
|
+
const updAnswer = (yes) => { prefs.updateNotice = yes; prefs.updateAsked = true; savePrefs(); $('#updTip').style.display = 'none'; syncSwitches(); document.querySelectorAll('.mi[data-t="updateNotice"] .sw').forEach((x) => x.classList.toggle('on', yes)); if (yes) { updStart.at = 0; setTimeout(updStart, 600); } }; /* yes: asked once the settings file says so (savePrefs waits 400 ms) */
|
|
2252
|
+
$('#updLater').onclick = () => (updTip.mode === 'ask' ? updAnswer(false) : updEnd()); $('#updNotes').onclick = () => (updTip.mode === 'ask' ? openExternal('https://agent-standup.com/privacy/') : updStart.u && openExternal(updStart.u.notes));
|
|
2253
|
+
$('#updGo').onclick = async () => {
|
|
2254
|
+
if (updTip.mode === 'ask') return updAnswer(true);
|
|
2255
|
+
const u = updStart.u; if (!u) return; if (u.how === 'download') { openExternal(u.url); return updEnd(); }
|
|
2256
|
+
let ok = false; try { await navigator.clipboard.writeText(u.cmd); ok = true; } catch { try { const ta = document.createElement('textarea'); ta.value = u.cmd; ta.style.cssText = 'position:fixed;opacity:0'; document.body.appendChild(ta); ta.select(); ok = document.execCommand('copy'); ta.remove(); } catch {} }
|
|
2257
|
+
$('#updGo').textContent = ok ? L('Copié', 'Copied') : L('Sélectionnez la commande', 'Select the command'); if (ok) setTimeout(updEnd, 1500);
|
|
2258
|
+
};
|
|
2259
|
+
document.addEventListener('visibilitychange', () => { if (!document.hidden && UPD_SHOWS && !updStart.u) updStart(); }); setInterval(() => { if (UPD_SHOWS && !updStart.u) updStart(); }, 6 * 3600e3); // the desktop window can stay open for days
|
|
2170
2260
|
|
|
2171
2261
|
// =====================================================================
|
|
2172
2262
|
// recap
|
|
@@ -2202,9 +2292,9 @@ function renderHighlights() {
|
|
|
2202
2292
|
}
|
|
2203
2293
|
$('#hl').onclick = (e) => { const b = e.target.closest('.hlc'); if (b && !S.live) seekTo(+b.dataset.i); };
|
|
2204
2294
|
function openRecap() {
|
|
2205
|
-
const per = {}, files = {}, mdl = {}; let tools = 0, cmds = 0, errs = 0; const tk = {}, A = (id) => (per[id] = per[id] || { id, tools: 0, files: new Set(), t0: null, t1: null });
|
|
2295
|
+
const per = {}, files = {}, mdl = {}, eff = {}; let tools = 0, cmds = 0, errs = 0; const tk = {}, A = (id) => (per[id] = per[id] || { id, tools: 0, files: new Set(), t0: null, t1: null });
|
|
2206
2296
|
S.events.forEach((e) => {
|
|
2207
|
-
if (e.kind === 'usage' && e.model && e.model[0] !== '<') mdl[e.agent] = e.model; /* not <synthetic>, as in tally */
|
|
2297
|
+
if (e.kind === 'usage' && e.model && e.model[0] !== '<') { mdl[e.agent] = e.model; if (e.ef) eff[e.agent] = e.ef; } /* not <synthetic>, as in tally */
|
|
2208
2298
|
if (e.kind === 'usage') { const u = (tk[e.agent] = tk[e.agent] || { i: 0, o: 0, r: 0, w: 0 }); u.i += e.u.i; u.o += e.u.o; u.r += e.u.r; u.w += e.u.w; }
|
|
2209
2299
|
if (e.kind === 'results') e.items.forEach((it) => { if (it.err) errs++; });
|
|
2210
2300
|
if (e.kind === 'order') A(e.to).t0 = e.t; if (e.kind === 'report') A(e.agent).t1 = e.t;
|
|
@@ -2215,14 +2305,14 @@ function openRecap() {
|
|
|
2215
2305
|
const k = (v, l) => `<div class="kpi"><b>${v}</b><span>${l}</span></div>`, totTok = Object.values(tk).reduce((n, u) => n + tokTotal(u), 0);
|
|
2216
2306
|
const RW = {}; S.events.forEach((e) => wasteStep(RW, e)); const wl = Object.entries(RW.items || {}).filter(([id]) => S.agents[id]).flatMap(([id, l]) => l.map((it) => [id, it]));
|
|
2217
2307
|
$('#recap .box').innerHTML = `<h1>${L('Récap de l’épisode', 'Episode recap')}</h1>
|
|
2218
|
-
<div class="kpis">${k(Math.max(0, Object.keys(S.agents).length - 2), 'agents')}${k(tools, L('appels d’outils', 'tool calls'))}${k(cmds, L('commandes', 'commands'))}${k(errs, L('outils en erreur', 'tool errors'))}${wl.length ? k('♻ ' + wl.length, L('travail répété', 'repeated work')) : ''}${totTok ? k('⚡ ' + fmtTok(totTok), L('jetons', 'tokens')) : ''}${k(Object.keys(files).length, L('fichiers modifiés', 'files changed'))}${k(fmt(last), L('durée', 'duration'))}</div>
|
|
2308
|
+
<div class="kpis">${k(Math.max(0, Object.keys(S.agents).length - 2), 'agents')}${k(tools, L('appels d’outils', 'tool calls'))}${k(cmds, L('commandes', 'commands'))}${k(errs, L('outils en erreur', 'tool errors'))}${wl.length ? k('♻ ' + wl.length, L('travail répété', 'repeated work')) : ''}${totTok ? k('⚡ ' + fmtTok(totTok), L('jetons', 'tokens')) : ''}${S.cost ? `<div class="kpi" title="${esc(costTip())}"><b>💵 ${esc(costStr(S.cost))}</b><span>${L('coût', 'cost')}</span></div>` : ''}${k(Object.keys(files).length, L('fichiers modifiés', 'files changed'))}${k(fmt(last), L('durée', 'duration'))}</div>
|
|
2219
2309
|
<h3>${L('Agents les plus actifs', 'Busiest agents')}</h3><table><tr><th></th><th>${L('Rôle', 'Role')}</th><th>${L('Outils', 'Tools')}</th><th>${L('Fichiers', 'Files')}</th><th>${L('Jetons', 'Tokens')}</th><th>${L('Modèle', 'Model')}</th><th>${L('Durée', 'Time')}</th></tr>
|
|
2220
|
-
${rows.map((a) => `<tr><td><b>${esc(nameOf(a.id))}</b></td><td>${esc(S.agents[a.id].role)}</td><td>${a.tools}</td><td>${a.files.size || ''}</td><td title="${tk[a.id] ? esc(tokTip(tk[a.id])) : ''}">${tk[a.id] ? '⚡ ' + fmtTok(tokTotal(tk[a.id])) : ''}</td><td>${esc(modelShort(mdl[a.id]))}</td><td>${a.t0 != null && a.t1 != null ? fmt(a.t1 - a.t0) : ''}</td></tr>`).join('')}</table>
|
|
2310
|
+
${rows.map((a) => `<tr><td><b>${esc(nameOf(a.id))}</b></td><td>${esc(S.agents[a.id].role)}</td><td>${a.tools}</td><td>${a.files.size || ''}</td><td title="${tk[a.id] ? esc(tokTip(tk[a.id])) : ''}">${tk[a.id] ? '⚡ ' + fmtTok(tokTotal(tk[a.id])) : ''}</td><td>${esc(modelShort(mdl[a.id]))}${modelShort(mdl[a.id]) && eff[a.id] ? ' · ' + esc(effortWord(eff[a.id])) : ''}</td><td>${a.t0 != null && a.t1 != null ? fmt(a.t1 - a.t0) : ''}</td></tr>`).join('')}</table>
|
|
2221
2311
|
<h3>${L('Fichiers touchés', 'Files touched')}</h3>${fl.length ? `<table>${fl.map(([f, v]) => `<tr><td class="f">${esc(f)}</td><td>×${v.n}</td><td>${esc([...v.who].join(', '))}</td></tr>`).join('')}</table>` : `<div class="dim">${L('Aucune modification.', 'No edits.')}</div>`}
|
|
2222
2312
|
${wl.length ? `<h3>${L('Travail répété', 'Repeated work')}</h3><table>${wl.slice(0, 30).map(([id, it]) => `<tr><td><b>${esc(nameOf(id))}</b></td><td>${esc(wasteLine(it))}</td></tr>`).join('')}</table>` : ''}
|
|
2223
2313
|
${SUPPORT.url ? `<div class="coffee"><span>${esc(coffeeMsg())}</span><button class="btn" id="recapCoffee">☕ ${L('Offrir un café', 'Buy a coffee')}</button></div>` : ''}
|
|
2224
2314
|
<p style="text-align:right;margin:18px 0 0"><button class="btn" id="recapMd">📋 ${L('Copier en Markdown', 'Copy as Markdown')}</button> <button class="cta" id="recapx">${L('Fermer', 'Close')}</button></p>`;
|
|
2225
|
-
const md = [`# Agent Standup — ${S.title || L('épisode', 'session')}`, `_${new Date().toLocaleString()}_ · ${Math.max(0, Object.keys(S.agents).length - 2)} agents · ${tools} ${L('appels d’outils', 'tool calls')} · ${cmds} ${L('commandes', 'commands')} · ${errs} ${L('erreurs', 'errors')}${totTok ? ' · ⚡ ' + fmtTok(totTok) + ' tokens' : ''}`, '', '## Standup'];
|
|
2315
|
+
const md = [`# Agent Standup — ${S.title || L('épisode', 'session')}`, `_${new Date().toLocaleString()}_ · ${Math.max(0, Object.keys(S.agents).length - 2)} agents · ${tools} ${L('appels d’outils', 'tool calls')} · ${cmds} ${L('commandes', 'commands')} · ${errs} ${L('erreurs', 'errors')}${totTok ? ' · ⚡ ' + fmtTok(totTok) + ' tokens' : ''}${S.cost ? ' · 💵 ' + costStr(S.cost) : ''}`, '', '## Standup'];
|
|
2226
2316
|
rows.forEach((a) => { let rep = ''; for (let i = S.events.length - 1; i >= 0; i--) { const e = S.events[i]; if (e.agent === a.id && (e.kind === 'report' || (a.id === 'main' && e.kind === 'say'))) { rep = spoken(e).replace(/\s+/g, ' ').trim().slice(0, 240); break; } }
|
|
2227
2317
|
md.push(`- **${nameOf(a.id)}** (${S.agents[a.id].role}) — ${a.tools} ${L('outils', 'tools')}${a.files.size ? `, ${a.files.size} ${L('fichiers', 'files')}` : ''}${tk[a.id] ? `, ⚡ ${fmtTok(tokTotal(tk[a.id]))}` : ''}${rep ? `\n > ${rep}` : ''}`); });
|
|
2228
2318
|
if (fl.length) { md.push('', '## ' + L('Fichiers touchés', 'Files touched')); fl.forEach(([f, v]) => md.push(`- \`${f}\` ×${v.n} (${[...v.who].join(', ')})`)); }
|
|
@@ -2598,7 +2688,7 @@ async function loadSession(proj, id) {
|
|
|
2598
2688
|
pause(); const mine = (S.loadN = (S.loadN || 0) + 1);
|
|
2599
2689
|
const data = await (await fetch(`/api/session?proj=${encodeURIComponent(proj)}&id=${id}`)).json();
|
|
2600
2690
|
if (mine !== S.loadN || data.error) return false;
|
|
2601
|
-
S.term = {}; S.camFor = null; S.focus = null; S.agents = {}; for (const k in nameBook) delete nameBook[k]; [{ id: 'user' }, ...data.agents].forEach((a) => (S.agents[a.id] = persona(a)));
|
|
2691
|
+
S.term = {}; S.camFor = null; S.focus = null; S.agents = {}; S.cost = data.cost || null; for (const k in nameBook) delete nameBook[k]; [{ id: 'user' }, ...data.agents].forEach((a) => (S.agents[a.id] = persona(twinOf(a))));
|
|
2602
2692
|
clearThoughts(); Object.assign(TH, { since: {}, next: {}, said: {}, last: 0 }); S.events = data.events; stampT(0); S.byK = new Map(data.events.map((e) => [e.k, e])); S.seq = data.seq || 0; S.ep = data.ep || ''; S.sawEnd = !!data.marks || data.events.some((e) => e.end); S.late = []; S.pos = 0; S.joinAt = Date.now(); S.idx = 0; S.status = {}; S.tc = {}; S.cur = { proj, id }; S.logTo = 0; S.detail = null; $('#detail').classList.remove('on'); S.fgone = new Set(); S.fmade = new Map(); S.artOk = new Map(); S.artPin = null; S.artWhole = null; S.wholeSeen = new Set();
|
|
2603
2693
|
const opt = $('#sessions').selectedOptions[0]; S.title = (S.live ? niceProj(proj) : opt && opt.dataset.title) || '';
|
|
2604
2694
|
if (proj === '_demo') S.events.forEach((e) => { if (e.fr) trMem.set(baseText(e), e.fr, 'fr'); }); // the demo ships its own French
|
|
@@ -2653,8 +2743,8 @@ setInterval(async () => {
|
|
|
2653
2743
|
if (switched || !S.cur) return;
|
|
2654
2744
|
const cur = S.cur, d = await (await fetch(`/api/session?proj=${encodeURIComponent(cur.proj)}&id=${cur.id}&after=${S.seq}&ep=${encodeURIComponent(S.ep)}`)).json();
|
|
2655
2745
|
if (d.error || cur !== S.cur) return; if (d.resync) { S.cur = null; return; } // the server no longer has our place (restarted, transcript rewritten): reload next tick
|
|
2656
|
-
S.seq = d.seq; if (d.marks) S.sawEnd = true; if (!d.events || !d.events.length) return;
|
|
2657
|
-
for (const a of d.agents) if (!S.agents[a.id]) { S.agents[a.id] = persona(a); addTile(S.agents[a.id]); }
|
|
2746
|
+
S.seq = d.seq; if (d.marks) S.sawEnd = true; if (d.cost && (!S.cost || d.cost.usd !== S.cost.usd || d.cost.final !== S.cost.final)) { S.cost = d.cost; later('tok', renderTokens, 300); } if (!d.events || !d.events.length) return;
|
|
2747
|
+
for (const a of d.agents) if (!S.agents[a.id]) { S.agents[a.id] = persona(twinOf(a)); addTile(S.agents[a.id]); }
|
|
2658
2748
|
const from = S.events.length, fresh = [], changed = []; // the session is not written in order: what is new goes at the end (the order the call got it in), what the server corrected is corrected in place
|
|
2659
2749
|
for (const e of d.events) { const old = S.byK.get(e.k); if (old) { changed.push([old, { kind: old.kind, n: old.tools ? old.tools.length : 0, end: old.end }]); Object.assign(old, e); } else { S.byK.set(e.k, e); fresh.push(e); } }
|
|
2660
2750
|
if (fresh.some((e) => e.end)) S.sawEnd = true;
|
|
@@ -2667,7 +2757,8 @@ setInterval(async () => {
|
|
|
2667
2757
|
|
|
2668
2758
|
|
|
2669
2759
|
window.addEventListener('message', (e) => { // VS Code asks for a given session: the one the status bar was clicked for, or the one of the Claude Code tab you went to (the message is named 'pin' on both sides, from when the call was pinned there)
|
|
2670
|
-
const d = e.data; if (
|
|
2760
|
+
const d = e.data; if (EMBED && e.source === window.parent && d && d.agentStandup === 'answered' && d.how === 'app' && typeof d.app === 'string') { toast('✋ ' + L('Elle vous attend dans ', 'Waiting for you in ') + d.app.slice(0, 40)); return; } // the extension opened the terminal or app the session runs in (answerAt)
|
|
2761
|
+
if (!EMBED || e.source !== window.parent || !d || d.agentStandup !== 'pin' || typeof d.id !== 'string') return;
|
|
2671
2762
|
if (d.tab) { if (prefs.followTab !== false && S.live && !S.demo && typeof d.proj === 'string' && !(S.pick && S.pick.pin)) goSession(d.proj, d.id); return; } // the Claude Code tab you went to: the call goes with you (followTab in extension.js; off in ⚙), unless you pinned a call (📌): that one stays while you go through your tabs
|
|
2672
2763
|
const dp = typeof d.proj === 'string' ? d.proj : ''; if (!TOOL[dp]) prefs.proj = dp; S.pick = { proj: dp, id: d.id }; S.cur = null; setView('call'); if (S.live) { fillProjects(); followCurrent(); } else setMode('live');
|
|
2673
2764
|
});
|
|
@@ -2690,7 +2781,7 @@ $('#reactBar').onclick = (e) => {
|
|
|
2690
2781
|
};
|
|
2691
2782
|
|
|
2692
2783
|
// ---------- board: every recent session at a glance ----------
|
|
2693
|
-
const BSTATE = { blocked: ['✋', 'needs you
|
|
2784
|
+
const BSTATE = { blocked: ['✋', 'needs you', 'vous attend'], working: ['⚙', 'working', 'au travail'], waiting: ['🔗', 'waiting on sub-agents', 'attend ses sous-agents'], turn: ['✓', 'your turn', 'à vous'], idle: ['💤', 'idle', 'inactif'] };
|
|
2694
2785
|
const BORDER = ['blocked', 'working', 'waiting', 'turn', 'idle'];
|
|
2695
2786
|
const agoStr = (ms) => (ms < 90e3 ? Math.max(1, Math.round(ms / 1000)) + 's' : ms < 5400e3 ? Math.round(ms / 60e3) + ' min' : Math.round(ms / 3600e3) + ' h');
|
|
2696
2787
|
const BGROUP = ['blocked', 'turn', 'working', 'waiting', 'idle']; // the board is in sections, what waits for you first
|
|
@@ -2698,7 +2789,7 @@ let boardBusy = false, boardAll = null, boardDoneOpen = false, boardIdleOpen = f
|
|
|
2698
2789
|
const BTOOLS = [['claude', 'Claude Code'], ['_codex', 'Codex'], ['_vibe', 'Mistral Vibe'], ['_cowork', 'Cowork']], toolOf = (r) => (BTOOLS.some(([k]) => k === r.proj) ? r.proj : 'claude'); // the filter at the top of the board, shown when sessions of two tools or more are listed
|
|
2699
2790
|
const isDone = (r) => !!r.done; // put away by you, until the session moves again: the server says so, to every window
|
|
2700
2791
|
function bcard(r, now, done) {
|
|
2701
|
-
const g = r.state === 'turn' && r.gave ? r.gave : '', [ic, en0, fr0] = g ? ['⚠', 'gave up?', 'a abandonné ?'] : BSTATE[r.state], [en, fr] =
|
|
2792
|
+
const g = r.state === 'turn' && r.gave ? r.gave : '', [ic, en0, fr0] = g ? ['⚠', 'gave up?', 'a abandonné ?'] : BSTATE[r.state], [en, fr] = [en0, fr0], waited = r.since ? now - r.since : r.state === 'blocked' ? r.ageMs : now - r.mtime, mine = r.state === 'blocked' || r.state === 'turn'; // how long it has waited on you
|
|
2702
2793
|
const head = r.state === 'blocked' ? [r.ask ? '' : esc(r.tool), r.ran ? '' : agoStr(waited)].filter(Boolean).join(' ') : r.state === 'working' && r.tool ? esc(r.tool) : r.state === 'idle' || (r.state === 'turn' && !r.ran) ? agoStr(waited) : '', extra = head ? ' · ' + head : '';
|
|
2703
2794
|
const took = mine && r.ran ? `⏱ ${L('a travaillé', 'worked')} ${agoStr(r.ran)} · ${L('vous attend depuis', 'waiting on you for')} ${agoStr(waited)}` : r.state === 'working' && r.asked ? `⏱ ${L('au travail depuis', 'working for')} ${agoStr(Math.max(0, now - r.asked))}` : ''; // the time it worked, apart from the time it has waited on you
|
|
2704
2795
|
const pr = r.pr ? `<button class="bpr" data-url="${esc(r.pr.url)}" title="${esc(L('Ouvrir la pull request', 'Open the pull request'))}">PR #${+r.pr.n} ↗</button>` : '';
|
|
@@ -2823,7 +2914,7 @@ async function visitSay(v, token) {
|
|
|
2823
2914
|
if (S.visit !== v || AUD.off() || !prefs.voice) return; const el = $('#visit'); el.classList.add('speaking'); AUD.duck(true);
|
|
2824
2915
|
await speakLine(v.line, v.p, true, token); el.classList.remove('speaking'); if (!S.speakers.size) AUD.duck(false);
|
|
2825
2916
|
}
|
|
2826
|
-
$('#visit').onclick = (e) => { const v = S.visit; if (!v) return; if (e.target.closest('.vx')) hideVisit(); else goSession(v.r.proj, v.r.id); };
|
|
2917
|
+
$('#visit').onclick = (e) => { const v = S.visit; if (!v) return; if (e.target.closest('.vx')) hideVisit(); else { goSession(v.r.proj, v.r.id); answerAt(v.r); } };
|
|
2827
2918
|
async function sessPoll() {
|
|
2828
2919
|
if (!S.live || S.demo || document.hidden || sessPoll.busy) return; sessPoll.busy = true;
|
|
2829
2920
|
try { const t0 = Date.now(), rows = await (await fetch('/api/board')).json(); if (Array.isArray(rows) && S.live && !S.demo) { S.rows = rows; S.rowsAt = t0; knocks(); paintTabs(); paintAttn(); } } catch {} finally { sessPoll.busy = false; }
|
|
@@ -2938,7 +3029,7 @@ async function exportVideo(from = 0, to = 0, clip = 0) { // clip: length in ms
|
|
|
2938
3029
|
// UI wiring
|
|
2939
3030
|
// =====================================================================
|
|
2940
3031
|
function applyLang() {
|
|
2941
|
-
renderCharInfo(); packNote(); menuTip(); rateDay(); coffeeDay(); usageStart();
|
|
3032
|
+
renderCharInfo(); packNote(); menuTip(); rateDay(); coffeeDay(); usageStart(); updStart();
|
|
2942
3033
|
try { for (const id in S.act) { const b = S.term[id], t = b && b[b.length - 1]; if (t && t.tool) S.act[id] = activityLabel(t.tool); } if (S.live) fillProjects(); } catch {} // what each agent is doing, and the list of projects, were written in the language before
|
|
2943
3034
|
document.documentElement.lang = (LANGS.find((l) => l[0] === prefs.lang) || LANGS[0])[2];
|
|
2944
3035
|
document.querySelectorAll('[data-fr]').forEach((el) => (el.textContent = FR() ? el.dataset.fr : tr(el.dataset.en)));
|
|
@@ -3003,6 +3094,7 @@ function menuInit() {
|
|
|
3003
3094
|
}
|
|
3004
3095
|
const onSwitch = (e) => { const b = e.target.closest('.mi[data-t]'); if (!b) return; prefs[b.dataset.t] = !prefs[b.dataset.t]; savePrefs(); if (prefs[b.dataset.t] && ['voice', 'office', 'music', 'notify'].includes(b.dataset.t)) claimAudio(); b.querySelector('.sw').classList.toggle('on', prefs[b.dataset.t]); AUD.apply(); if (b.dataset.t === 'shareUsage') { prefs.usageAsked = true; savePrefs(); usageOpened(true); } if (b.dataset.t === 'office') $('#officeBox').style.display = prefs.office ? '' : 'none'; if (b.dataset.t === 'callTr') { prefs.callTrSeen = true; savePrefs(); setLang(prefs.lang); } if (b.dataset.t === 'voice') voiceOffer(); if (b.dataset.t === 'customLaptop') { for (const k in imgCache) delete imgCache[k]; buildStage(); paintStatus(); } if (b.dataset.t === 'files') paintFiles(); if (b.dataset.t === 'artNet' && S.present) renderPresent(); if (b.dataset.t === 'ownNames') renameAll(); if (b.dataset.t === 'reactions') document.body.classList.toggle('react', prefs.reactions); if (b.dataset.t === 'focusLayout') { document.body.classList.toggle('focusl', !!prefs.focusLayout); layout(); } if (b.dataset.t === 'roster') { document.body.classList.toggle('rost', prefs.roster); paintStates(); } if (b.dataset.t === 'notify') { prefs.notifyChosen = true; savePrefs(); } if (b.dataset.t === 'notify' && prefs.notify) askNotify(); if (b.dataset.t === 'vanish' && !prefs.vanish) { S.gone.clear(); paintStatus(); }
|
|
3005
3096
|
if (b.dataset.t === 'askCard') paintAsk(Date.now());
|
|
3097
|
+
if (b.dataset.t === 'updateNotice') { prefs.updateAsked = true; savePrefs(); $('#updTip').style.display = 'none'; if (prefs.updateNotice) { updStart.at = 0; setTimeout(updStart, 600); } } /* an answer too; on: asked once the settings file says so (savePrefs waits 400 ms) */
|
|
3006
3098
|
if (b.dataset.t === 'music') { $('#musicBox').style.display = prefs.music ? '' : 'none'; if (prefs.music) { AUD.init(); AUD.apply(); } } };
|
|
3007
3099
|
$('#menu').onclick = onSwitch; $('#prefs').onclick = (e) => { if (e.target === $('#prefs')) return closePrefs(); onSwitch(e); setTimeout(syncSwitches); };
|
|
3008
3100
|
function openPrefs(target) { // ⚙ → All settings; target: one of its settings, found by the search of the menu, shown and lit up
|
|
@@ -3111,18 +3203,26 @@ function attnItems(now) {
|
|
|
3111
3203
|
return out;
|
|
3112
3204
|
}
|
|
3113
3205
|
function paintAttn(now = Date.now()) {
|
|
3114
|
-
const el = $('#attn'), a = attnItems(now), f = a[0];
|
|
3206
|
+
const el = $('#attn'), a = attnItems(now).filter((x) => x.r), f = a[0]; /* the other sessions only: the call's own agents are already on the status line above (G still goes to them) */
|
|
3115
3207
|
const html = f ? `<span class="aw">✋ <b>${esc(f.who)}</b> ${esc(f.sure ? L('vous attend', 'needs you') : L('vous attend peut-être', 'may need you'))}${f.what ? ' · ' + esc(f.what.replace(/\s+/g, ' ').slice(0, 120)) : ''}${f.since ? ' · ' + agoStr(Math.max(0, now - f.since)) : ''}</span>${a.length > 1 ? `<span class="am">+${a.length - 1}</span>` : ''}<span class="ak">G</span>` : '';
|
|
3116
|
-
if (html !== paintAttn.html) { paintAttn.html = html; el.innerHTML = html; el.hidden = !f; el.title = a.map((x) => x.who + (x.what ? ' · ' + x.what : '')).join('\n'); }
|
|
3208
|
+
if (html !== paintAttn.html) { paintAttn.html = html; el.innerHTML = html; el.hidden = !f; el.title = L('Cliquez pour aller répondre', 'Click to go and answer') + '\n' + a.map((x) => x.who + (x.what ? ' · ' + x.what : '')).join('\n'); }
|
|
3209
|
+
}
|
|
3210
|
+
// A click on what needs you also opens that session where it can be answered: its Claude Code tab in the editor window that runs it, or the terminal or app it runs in (server.js, answerIn).
|
|
3211
|
+
// Nothing to open (another tool, an older Claude Code, a session a program runs): the call alone goes there, as before.
|
|
3212
|
+
function answerAt(c) {
|
|
3213
|
+
if (!S.live || S.demo || !c || !c.id || (answerAt.k === c.id && Date.now() - answerAt.at < 2000)) return; answerAt.k = c.id; answerAt.at = Date.now(); // one opening per click, not per repeated click
|
|
3214
|
+
if (EMBED && APP.kind === 'editor') { window.parent.postMessage({ agentStandup: 'answer', proj: c.proj, id: c.id }, '*'); return; } // in the editor: the extension opens a session of its own window itself, with no link
|
|
3215
|
+
fetch('/api/answer', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ proj: c.proj, id: c.id }) }).then((r) => r.json()).then((a) => { if (a && a.how === 'app' && a.app) toast('✋ ' + L('Elle vous attend dans ', 'Waiting for you in ') + a.app); }).catch(() => {});
|
|
3117
3216
|
}
|
|
3118
|
-
function goAttn() { // the next thing that needs you: an agent of this session, or another session (which the call goes to)
|
|
3119
|
-
const a = attnItems(Date.now()); if (!a.length) { toast(L('Personne n’a besoin de vous pour le moment', 'Nobody needs you right now')); return; }
|
|
3217
|
+
function goAttn(others, open) { // the next thing that needs you: an agent of this session, or another session (which the call goes to); others: only the other sessions (the red line shows those); open: a click, which also opens it where it can be answered (G only moves, so that it can be pressed again)
|
|
3218
|
+
const a = attnItems(Date.now()).filter((x) => !others || x.r); if (!a.length) { toast(L('Personne n’a besoin de vous pour le moment', 'Nobody needs you right now')); return; }
|
|
3120
3219
|
goAttn.i = ((goAttn.i || 0) + (goAttn.at && Date.now() - goAttn.at < 30000 ? 1 : 0)) % a.length; goAttn.at = Date.now(); const x = a[goAttn.i];
|
|
3121
|
-
if (x.r) { goAttn.i = 0; setView('call'); goSession(x.r.proj, x.r.id); return; }
|
|
3220
|
+
if (x.r) { goAttn.i = 0; setView('call'); goSession(x.r.proj, x.r.id); if (open) answerAt(x.r); return; }
|
|
3221
|
+
if (open && x.sure) answerAt(S.cur);
|
|
3122
3222
|
if (document.body.classList.contains('tree') || document.body.classList.contains('board')) setView('call');
|
|
3123
3223
|
S.focusLock = Date.now() + 25000; setFocus(x.id); const t = $('#t-' + x.id); if (t) { t.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); popTile(x.id); }
|
|
3124
3224
|
}
|
|
3125
|
-
$('#attn').onclick = goAttn;
|
|
3225
|
+
$('#attn').onclick = () => goAttn(true, true);
|
|
3126
3226
|
// J / K (or a click on the “need you” chip) jump to the agents that need you or are stalled, one after the other
|
|
3127
3227
|
function jumpAttn(dir = 1) {
|
|
3128
3228
|
const a = (S.attn || []).filter((id) => $('#t-' + id));
|
|
@@ -3152,7 +3252,7 @@ function paintPill() {
|
|
|
3152
3252
|
else if (!S.playing) txt = L('PAUSE', 'PAUSED');
|
|
3153
3253
|
else {
|
|
3154
3254
|
sess = true; const st = {}, by = { working: [], waiting: [], blocked: [], stalled: [], done: [], idle: [] };
|
|
3155
|
-
for (const id in S.agents) if (id !== 'user' && !S.gone.has(id) && (id === 'main' || S.status[id])) { st[id] = agentState(id, now); by[st[id].k].push(id); }
|
|
3255
|
+
for (const id in S.agents) if (id !== 'user' && !S.gone.has(id) && (id === 'main' || S.status[id])) { st[id] = agentState(id, now); by[st[id].k === 'blocked' && !st[id].sure ? 'working' : st[id].k].push(id); } /* red only when sure: a guess reads as work, its tile says the rest */
|
|
3156
3256
|
const what = (id) => `${nameOf(id)} — ${st[id].txt.replace(/^\S+\s/, '')}`, more = (a) => (a.length > 1 ? ` +${a.length - 1}` : ''), lead = st.main || { k: 'idle' };
|
|
3157
3257
|
if (by.blocked.length) { cls = 'blocked'; to = by.blocked[0]; const q = st[to].ask || ''; txt = '✋ ' + what(to) + more(by.blocked) + (q ? ' · ' + (q.length > 110 ? q.slice(0, 108).replace(/\s+\S*$/, '') + '…' : q) : ''); if (q) tip = q; } // the question or the command it waits on, next to its timer
|
|
3158
3258
|
else if (by.stalled.length) { cls = 'stalled'; to = by.stalled[0]; txt = '⚠ ' + what(to) + more(by.stalled); }
|
|
@@ -3171,7 +3271,8 @@ function paintPill() {
|
|
|
3171
3271
|
S.pillTo = to; S.pillSess = sess;
|
|
3172
3272
|
}
|
|
3173
3273
|
function pillGo() { // to the agent the status is about; several need you: one after the other (as J does)
|
|
3174
|
-
const id = S.pillTo, t = id && $('#t-' + id); if (!t) return;
|
|
3274
|
+
const id = S.pillTo, t = id && $('#t-' + id); if (!t) return; const st = agentState(id, Date.now()); if (st.k === 'blocked' && st.sure) answerAt(S.cur); /* it asks: where it can be answered too */
|
|
3275
|
+
if ((S.attn || []).includes(id)) { jumpAttn(1); return; }
|
|
3175
3276
|
if (document.body.classList.contains('tree') || document.body.classList.contains('board')) setView('call');
|
|
3176
3277
|
S.focusLock = Date.now() + 25000; setFocus(id); paintStates(); t.scrollIntoView({ block: 'nearest', behavior: 'smooth' }); popTile(id);
|
|
3177
3278
|
}
|