@double_geste/agent-standup 1.30.0 → 1.31.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/codex.js +2 -1
- package/package.json +1 -1
- package/public/index.html +234 -46
- package/public/locales/README.md +3 -0
- package/public/locales/da.json +15 -3
- package/public/locales/de.json +15 -3
- package/public/locales/en.json +14 -2
- package/public/locales/es.json +15 -3
- package/public/locales/ja.json +15 -3
- package/public/locales/ko.json +15 -3
- package/public/locales/pt-BR.json +15 -3
- package/public/locales/zh-CN.json +15 -3
- package/public/locales/zh-TW.json +15 -3
- package/server.js +83 -17
- package/vibe.js +2 -1
package/public/index.html
CHANGED
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
.tile.slow { border-color:#ff9f1c !important; animation:slowp 1.6s ease-in-out infinite } @keyframes slowp { 50% { box-shadow:0 0 0 4px rgba(255,159,28,.35) } }
|
|
31
31
|
.tile.quiet { opacity:.72 }
|
|
32
32
|
.tag .tk { color:#aab2c5; font-size:10px } .tag .tk:empty { display:none }
|
|
33
|
+
.tile.focus .tag .tk, #pcam .tag .tk { font-size:11.5px; color:#cfd6e6 } body:not(.compact):not(.presenting) .tile.focus .tag .tk:not(:empty)::after { content:' ' attr(data-w) } /* what an agent has used so far, readable where there is room: the large tile (with the word) and the camera of the one who shares a screen */
|
|
33
34
|
.keys { padding:6px 10px 4px; color:var(--dim); font-size:10.5px; line-height:1.5 }
|
|
34
35
|
/* the status of the session: a pill in the header of a wide window, a line of its own under the header from 1080 px down (#sline), where it stays readable in the narrowest side panel. Two lines at most, the whole text in the tooltip */
|
|
35
36
|
#pill, #sline { font-weight:600; background:var(--panel2); color:var(--dim); cursor:default; overflow:hidden; -webkit-box-orient:vertical; -webkit-line-clamp:2 }
|
|
@@ -38,6 +39,14 @@
|
|
|
38
39
|
:is(#pill, #sline).working { color:var(--gold) } :is(#pill, #sline).turn { color:#0b1020; background:var(--accent) } #pill:is(.working, .blocked, .stalled, .turn, .idle) { letter-spacing:0 } :is(#pill, #sline):focus-visible { outline:2px solid var(--accent); outline-offset:-2px }
|
|
39
40
|
@media (max-width:1080px) { #pill { display:none } #sline { display:-webkit-box } } @media (max-width:760px) { #sline::after { content:attr(data-sub); font-weight:400; opacity:.8 } } @media (max-width:400px) { #sline { -webkit-line-clamp:3 } }
|
|
40
41
|
@media (min-width:1081px) { header .brand { min-width:150px } #pill { flex-shrink:20 } .tok, .ctxp { flex-shrink:0 } } /* wide: a long status gives way before the name and the counters */
|
|
42
|
+
/* several sessions at once (live): the sessions of the moment as tabs under the header, the one the call is in among them, each with its state; and a visitor from another session that needs you, who takes you there on a click */
|
|
43
|
+
#tabs { display:none; flex:none; align-items:center; gap:5px; padding:4px 10px; border-bottom:1px solid var(--line); overflow-x:auto; scrollbar-width:none } #tabs::-webkit-scrollbar { display:none } #tabs:not(:empty) { display:flex }
|
|
44
|
+
.stab { flex:0 1 auto; min-width:92px; max-width:190px; display:flex; align-items:center; gap:5px; padding:2px 9px; border-radius:99px; border:1px solid var(--line); color:var(--dim); font-size:11.5px; line-height:1.5; white-space:nowrap } .stab span { overflow:hidden; text-overflow:ellipsis } .stab:hover { color:var(--text); border-color:var(--accent) }
|
|
45
|
+
.stab.on { flex-shrink:0; max-width:min(320px,62vw); background:var(--panel2); color:var(--text); font-weight:600; border-color:var(--accent) } .stab.turn:not(.on) { color:var(--accent) } .stab.blocked:not(.on) { color:#fff; background:#c0392b; border-color:#ff8a80; font-weight:600 } .stab.all { flex:none; min-width:0; padding:2px 8px } /* a narrow panel: the tabs keep a readable width and the row scrolls */
|
|
46
|
+
#visit { position:absolute; right:12px; bottom:14px; z-index:6; display:none; align-items:flex-end; gap:8px; max-width:min(380px,calc(100% - 24px)); cursor:pointer } #visit.on { display:flex; animation:visit .45s cubic-bezier(.2,1.3,.4,1) } @keyframes visit { from { transform:translateX(120%) } } body.react #visit { bottom:140px }
|
|
47
|
+
#visit .vsay { position:relative; min-width:0; background:#fff; color:#1b1d27; border-radius:11px 11px 2px 11px; padding:7px 10px; font-size:12.5px; line-height:1.35; box-shadow:0 4px 14px rgba(0,0,0,.4); overflow-wrap:anywhere } #visit .vsay small { display:block; color:#5a6072; font-size:11px; margin-bottom:2px } #visit .vgo { display:inline-block; margin-top:5px; padding:1px 10px; border-radius:99px; background:var(--accent); color:#0b1020; font-weight:600; font-size:11.5px }
|
|
48
|
+
#visit .vwho { flex:none; width:88px; height:66px; border-radius:12px; overflow:hidden; border:2px solid var(--accent); box-shadow:0 4px 14px rgba(0,0,0,.45); background:#222 } #visit.blocked .vwho { border-color:#ff5252 } #visit.speaking .vwho { box-shadow:0 0 0 3px rgba(124,156,255,.4), 0 4px 14px rgba(0,0,0,.45) } #visit .vwho svg { width:100%; height:100%; display:block }
|
|
49
|
+
#visit .vx { position:absolute; top:-9px; left:-9px; width:20px; height:20px; border-radius:50%; background:var(--panel2); border:1px solid var(--line); color:var(--dim); font-size:11px; line-height:18px } #visit .vx:hover { color:var(--text) }
|
|
41
50
|
@keyframes pulse { 50% { opacity:.3 } }
|
|
42
51
|
.seg { display:flex; background:var(--panel); border:1px solid var(--line); border-radius:8px; padding:2px }
|
|
43
52
|
.seg button { padding:4px 11px; border-radius:6px; color:var(--dim); font-size:12.5px }
|
|
@@ -59,6 +68,7 @@
|
|
|
59
68
|
.rr:hover { background:#2a2f45 } .rr.sel { outline:1px solid var(--accent) }
|
|
60
69
|
.rr .n { display:flex; align-items:center; gap:7px; min-width:0 } .rr .dot { width:9px; height:9px; border-radius:50%; flex:none } .rr b { font-size:12.5px } .rr .ro { color:var(--dim); font-size:11px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; min-width:0 }
|
|
61
70
|
.rr .st { font-size:11.5px; overflow:hidden; text-overflow:ellipsis; white-space:nowrap }
|
|
71
|
+
.rr .rt { margin-left:auto; flex:none; padding-left:6px; color:#aab2c5; font-size:10.5px; white-space:nowrap } .rr.left { opacity:.72; padding-top:4px; padding-bottom:4px } .rr.left:hover { opacity:1 } /* what each agent has used so far; those who left the call keep their line, and their count with it */
|
|
62
72
|
.rr.k-working { border-left-color:var(--gold) } .rr.k-working .st { color:var(--gold) } .rr.k-waiting { border-left-color:#8fd3ff } .rr.k-waiting .st { color:#8fd3ff }
|
|
63
73
|
.rr.k-blocked { border-left-color:#ff5252; background:rgba(192,57,43,.28) } .rr.k-blocked .st { color:#fff; font-weight:700 } .rr.k-stalled { border-left-color:#ffb347 } .rr.k-stalled .st { color:#ffb347; font-weight:700 }
|
|
64
74
|
.rr.k-done { opacity:.82 } .rr.k-done .st { color:var(--ok) } .rr.turn { opacity:1; border-left-color:var(--accent) } .rr.turn .st { color:var(--accent); font-weight:700 } .rr.k-idle .st { color:var(--dim) } .rr.speaking { box-shadow:0 0 0 2px rgba(124,156,255,.5) }
|
|
@@ -74,6 +84,16 @@
|
|
|
74
84
|
.cx:empty { display:none } .tag .cx { font-size:10px }
|
|
75
85
|
#hl { display:none; flex:0 0.01 auto; min-height:30px; max-height:66px; overflow-y:auto; scrollbar-width:thin; flex-wrap:wrap; gap:6px; padding:5px 12px; border-top:1px solid var(--line); background:var(--panel) } body.replay #hl.has { display:flex } body.board #hl, body.tree #hl { display:none !important }
|
|
76
86
|
.hlc { font-size:11.5px; padding:3px 10px; border-radius:99px; background:var(--panel2); border:1px solid var(--line); color:var(--text) } .hlc:hover { border-color:var(--accent) }
|
|
87
|
+
/* shared files: the files the session created, the way a call shows what was shared in it. One quiet line under the call when a turn ends (it scrolls sideways, as the session tabs do); the files of the turn that just ended carry a dot; the list of all of them opens above it */
|
|
88
|
+
#files { display:none; flex:none; align-items:center; gap:6px; padding:5px 12px; border-top:1px solid var(--line); background:var(--panel); overflow-x:auto; scrollbar-width:none } #files::-webkit-scrollbar { display:none } #files.on { display:flex; animation:fadein .4s } body.board #files, body.board #fpop { display:none !important }
|
|
89
|
+
.sfh { flex:none; padding:3px 4px 3px 0; color:var(--dim); font-size:11.5px; font-weight:600; white-space:nowrap } .sfh:hover, .sfh[aria-expanded=true] { color:var(--text) }
|
|
90
|
+
.sfc { flex:0 0 auto; max-width:210px; display:inline-flex; align-items:center; gap:5px; font-size:11.5px; line-height:1.45; padding:3px 10px; border-radius:99px; background:var(--panel2); border:1px solid var(--line); color:var(--text); white-space:nowrap } .sfc:hover { border-color:var(--accent) } .sfc i { font-style:normal; flex:none } .sfc span { overflow:hidden; text-overflow:ellipsis } .sfc.more { color:var(--dim) }
|
|
91
|
+
.sfc.new::before { content:''; flex:none; width:6px; height:6px; border-radius:50%; background:var(--accent) } .sfr.new b::after { content:''; display:inline-block; width:6px; height:6px; margin-left:7px; border-radius:50%; background:var(--accent); vertical-align:1px }
|
|
92
|
+
.sfc.gone, .sfr.gone { opacity:.5 } .sfc.gone span, .sfr.gone b { text-decoration:line-through }
|
|
93
|
+
#fpop { position:absolute; left:10px; z-index:8; width:min(360px,calc(100% - 20px)); max-height:min(46vh,340px); overflow-y:auto; overscroll-behavior:contain; scrollbar-width:thin; background:var(--panel); border:1px solid var(--line); border-radius:12px; box-shadow:0 14px 40px rgba(0,0,0,.55); padding:6px; animation:fadein .15s }
|
|
94
|
+
#fpop h4 { margin:6px 10px 4px; font-size:10.5px; letter-spacing:.08em; text-transform:uppercase; color:var(--dim); font-weight:600 }
|
|
95
|
+
.sfr { display:grid; grid-template-columns:auto 1fr; gap:0 9px; align-items:center; width:100%; text-align:left; padding:6px 10px; border-radius:8px } .sfr:hover { background:var(--panel2) } .sfr i { font-style:normal; grid-row:span 2 } .sfr b, .sfr em { min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap } .sfr b { font-size:12.5px; font-weight:600 } .sfr em { font-style:normal; font-size:11px; color:var(--dim) }
|
|
96
|
+
body:not(.replay) #center:has(#files.on) #toasts { bottom:46px } body:not(.replay):not(.react) #center:has(#files.on) #visit { bottom:48px } /* live: the line is the bottom of the call, and what pops up there stays above it */
|
|
77
97
|
.tbadge .l { color:#ff9f1c } .tbadge span { font-size:11px } .tbadge .q { color:#b4bcd4 }
|
|
78
98
|
.ic:active, .btn:active { transform:scale(.96) } .rr, .ic, .bcard { transition:background .15s var(--ease), border-color .15s var(--ease), transform .15s var(--ease) }
|
|
79
99
|
.meet { font-size:11.5px; color:var(--dim); white-space:nowrap; display:flex; gap:8px; align-items:center } .meet i { width:8px; height:8px; border-radius:50%; background:#ff4d4d; animation:pulse 1.6s infinite }
|
|
@@ -266,6 +286,7 @@
|
|
|
266
286
|
<button class="ic" id="bMenu" title="Réglages">⚙</button>
|
|
267
287
|
</header>
|
|
268
288
|
<div id="sline"></div>
|
|
289
|
+
<div id="tabs" role="tablist" aria-label="Sessions"></div>
|
|
269
290
|
|
|
270
291
|
<div id="menu">
|
|
271
292
|
<input id="menuQ" type="search" placeholder="Search settings…" aria-label="Search settings" style="margin:4px 8px 2px;width:calc(100% - 16px)">
|
|
@@ -280,7 +301,7 @@
|
|
|
280
301
|
<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>
|
|
281
302
|
<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>
|
|
282
303
|
<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>
|
|
283
|
-
<div class="box" id="vstyleBox"><label class="lbl" for="vstyle" data-fr="Style des voix" data-en="Voice style">Style des voix</label><select id="vstyle"></select></div>
|
|
304
|
+
<div class="box" id="vstyleBox"><label class="lbl" for="vstyle" data-fr="Style des voix" data-en="Voice style">Style des voix</label><select id="vstyle"></select><div class="hint" id="vstyleTip" style="padding:6px 0 0;display:none" data-fr="Pour la meilleure expérience, choisissez les voix très naturelles." data-en="For the best experience, pick the very natural voices.">Pour la meilleure expérience, choisissez les voix très naturelles.</div></div>
|
|
284
305
|
<div class="box" id="kokoroBox" style="display:none"><button class="btn" id="kokoroInstall" style="width:100%"></button><div class="hint" id="kokoroHint" style="padding:2px 0 6px"></div></div>
|
|
285
306
|
<h4 data-fr="Affichage" data-en="Display">Affichage</h4>
|
|
286
307
|
<button class="mi" data-t="roster"><span data-fr="Liste des agents (à gauche)" data-en="Agents list (left)">Liste des agents (à gauche)</span><i class="sw"></i></button>
|
|
@@ -289,6 +310,9 @@
|
|
|
289
310
|
<div class="box"><div class="lbl"><span data-fr="Bavardage entre agents" data-en="Chatter between agents">Bavardage entre agents</span></div><select id="chatSel"><option value="quiet" data-fr="Discret" data-en="Quiet">Discret</option><option value="normal" data-fr="Normal" data-en="Normal">Normal</option><option value="lively" data-fr="Animé" data-en="Lively">Animé</option></select></div>
|
|
290
311
|
<button class="mi" data-t="vanish"><span data-fr="Retirer les agents terminés (2 min)" data-en="Remove finished agents (2 min)">Retirer les agents terminés (2 min)</span><i class="sw"></i></button>
|
|
291
312
|
<button class="mi" data-t="epi"><span data-fr="Réactions et blagues" data-en="Reactions & jokes">Réactions et blagues</span><i class="sw"></i></button>
|
|
313
|
+
<button class="mi" data-t="files"><span data-fr="Fichiers créés pour vous, à la fin d’un tour" data-en="Files made for you, when a turn ends">Fichiers créés pour vous, à la fin d’un tour</span><i class="sw"></i></button>
|
|
314
|
+
<button class="mi" data-t="visits"><span data-fr="Un visiteur quand une autre session vous attend" data-en="A visitor when another session needs you">Un visiteur quand une autre session vous attend</span><i class="sw"></i></button>
|
|
315
|
+
<button class="mi" data-t="followTab" id="mFollowTab" style="display:none"><span data-fr="Suivre l’onglet Claude Code affiché" data-en="Follow the Claude Code tab I am on">Suivre l’onglet Claude Code affiché</span><i class="sw"></i></button>
|
|
292
316
|
<h4 data-fr="Source" data-en="Source">Source</h4>
|
|
293
317
|
<div class="box"><div class="seg" style="width:100%" id="modeSeg"><button data-m="live" style="flex:1" data-fr="Live" data-en="Live">Live</button><button data-m="replay" style="flex:1" data-fr="Replay" data-en="Replay">Replay</button><button data-m="demo" style="flex:1" data-fr="Démo" data-en="Demo">Demo</button></div>
|
|
294
318
|
<select id="liveProj" style="display:none;margin-top:6px" title="Project to follow"></select>
|
|
@@ -315,9 +339,10 @@
|
|
|
315
339
|
<div id="present"><div class="pwin term"><div class="pbar"><i class="r"></i><i class="y"></i><i class="g"></i><span id="ptitle"></span><span id="pbadge"></span></div><div id="pbody"></div><div id="pstat"></div></div><div id="ptodo" style="display:none"></div><div id="pcap"></div><div id="pcam" class="tile working"></div></div>
|
|
316
340
|
<div id="stage"></div><div id="tree"></div><div id="boardv"></div>
|
|
317
341
|
<div id="reactBar" aria-label="Reactions"><button data-e="👍">👍</button><button data-e="👏">👏</button><button data-e="☕">☕</button><button data-e="🔥">🔥</button><button data-e="🙌">🙌</button></div>
|
|
342
|
+
<div id="files"></div>
|
|
318
343
|
<div id="hl"></div>
|
|
319
344
|
<canvas id="gantt" height="90"></canvas>
|
|
320
|
-
<div id="toasts" role="status" aria-live="polite"></div>
|
|
345
|
+
<div id="toasts" role="status" aria-live="polite"></div><div id="visit" role="status" aria-live="polite"></div>
|
|
321
346
|
<div id="empty"><h2 id="eT"></h2><p id="eP"></p><button class="cta" id="eDemo"></button></div>
|
|
322
347
|
<div id="gate"><h2 id="gT"></h2><p id="gP"></p><button class="cta" id="gB"></button></div>
|
|
323
348
|
<div id="detail"><div class="hd"><b id="dname"></b><button class="ic" id="dclose">✕</button></div><div id="dbody"></div></div>
|
|
@@ -345,7 +370,7 @@ const CID = Math.random().toString(36).slice(2, 12); // identifies this window
|
|
|
345
370
|
const Q = new URLSearchParams(location.search);
|
|
346
371
|
const EMBED = Q.get('embed') === '1' || window.parent !== window;
|
|
347
372
|
|
|
348
|
-
let prefs = { lang: 'en', voice: true, roster: true, banter: true, reactions: false, office: false, officeVol: 0.8, vstyle: 'cartoon', notify: false, epi: false, vanish: true, music: false, station: 'fip', musicVol: 0.35, view: 'call', hideCode: false, ownNames: true };
|
|
373
|
+
let prefs = { lang: 'en', voice: true, roster: true, banter: true, reactions: false, office: false, officeVol: 0.8, vstyle: 'cartoon', notify: false, epi: false, vanish: true, music: false, station: 'fip', musicVol: 0.35, view: 'call', hideCode: false, ownNames: true, visits: true, followTab: true, files: true };
|
|
349
374
|
{ let loc = {}; try { loc = JSON.parse(localStorage.getItem('cc.prefs') || '{}') || {}; } catch {} // the settings file (shared by every window) and this origin's copy: the more recent one wins
|
|
350
375
|
const sv = window.SAVED_PREFS && typeof window.SAVED_PREFS === 'object' ? window.SAVED_PREFS : {}; Object.assign(prefs, (sv._t || 0) > (loc._t || 0) ? sv : loc); }
|
|
351
376
|
if (prefs.vstyle === 'babble') prefs.vstyle = 'animal', prefs.vstyleChosen = true;
|
|
@@ -671,6 +696,10 @@ const AUD = {
|
|
|
671
696
|
const s = c.createBufferSource(); s.buffer = b; const hp = c.createBiquadFilter(); hp.type = 'highpass'; hp.frequency.value = 1800 + Math.random() * 1500; const g = c.createGain(); g.gain.value = 0.18; s.connect(hp).connect(g).connect(this.sfx); s.start();
|
|
672
697
|
},
|
|
673
698
|
join() { this.tone(523, .14, 'triangle', .1); this.tone(784, .2, 'triangle', .1, .12); },
|
|
699
|
+
knock() { // someone at the door: a visitor from another session. Like the chime above, it is heard with the ambience off
|
|
700
|
+
if (!this.ctx || this.off()) return; const c = this.ctx;
|
|
701
|
+
[[196, 0], [196, 0.17], [247, 0.34]].forEach(([f, w]) => { const t = c.currentTime + w, o = c.createOscillator(), g = c.createGain(); o.type = 'triangle'; o.frequency.value = f; g.gain.setValueAtTime(0.22, t); g.gain.exponentialRampToValueAtTime(0.001, t + 0.12); o.connect(g).connect(c.destination); o.start(t); o.stop(t + 0.13); });
|
|
702
|
+
},
|
|
674
703
|
ding() { this.tone(988, .5, 'triangle', .14); this.tone(1318, .5, 'sine', .06, .02); },
|
|
675
704
|
murmur(pitch, dur, vol = 1) { // cartoon mumble, used when there is no real voice (vol: lower for a thought that escapes)
|
|
676
705
|
if (!this.ctx || !prefs.voice) return; const c = this.ctx, t = c.currentTime, o = c.createOscillator(); o.type = 'sawtooth';
|
|
@@ -996,7 +1025,7 @@ function addTile(p) {
|
|
|
996
1025
|
}
|
|
997
1026
|
function buildStage() { // the tiles, and the presenter camera with them: a character change must never leave the old look in the corner of the shared screen
|
|
998
1027
|
$('#stage').innerHTML = ''; Object.values(S.agents).forEach(addTile); S.camFor = null;
|
|
999
|
-
const pr = S.present && S.agents[S.present]; if (pr) { $('#pcam').innerHTML = avatarSVG(pr, undefined, 'c' + pr.gid + '_') + `<div class="tag"><b>${esc(pr.name)}</b></div>`; S.camFor = pr.id; }
|
|
1028
|
+
const pr = S.present && S.agents[S.present]; if (pr) { $('#pcam').innerHTML = avatarSVG(pr, undefined, 'c' + pr.gid + '_') + `<div class="tag"><b>${esc(pr.name)}</b><span class="tk"></span></div>`; S.camFor = pr.id; camTok(); }
|
|
1000
1029
|
}
|
|
1001
1030
|
const layout = () => {
|
|
1002
1031
|
const st = $('#stage'), w = st.clientWidth - 28 || 600, nar = $('#center').clientWidth < 480, cols = nar ? (w >= 300 ? 2 : 1) : Math.max(1, Math.floor((w + 12) / 212)), colw = (w - 12 * (cols - 1)) / cols;
|
|
@@ -1053,6 +1082,7 @@ const applyStatus = (ev) => {
|
|
|
1053
1082
|
if (ev.kind === 'user' || (ev.agent === 'main' && (ev.kind === 'say' || ev.kind === 'tools' || (ev.kind === 'order' && !ev.wf)))) S.turnOver = !!ev.end; // Claude Code marks the message that closes the lead's turn; anything after it opens the next one (not the agents a workflow launches by itself)
|
|
1054
1083
|
};
|
|
1055
1084
|
function recomputeStatus(upTo) {
|
|
1085
|
+
S.files = new Map(); S.cands = new Map(); S.turnN = 0; S.turnSaid = '';
|
|
1056
1086
|
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.recomputing = true; document.querySelectorAll('.tile').forEach((t) => { clearTimeout(t._byeT); t.classList.remove('bye'); }); hidePresent();
|
|
1057
1087
|
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 = ''; });
|
|
1058
1088
|
for (let i = 0; i < upTo; i++) {
|
|
@@ -1066,13 +1096,14 @@ function recomputeStatus(upTo) {
|
|
|
1066
1096
|
}
|
|
1067
1097
|
function syncUI() {
|
|
1068
1098
|
$('#bPlay').textContent = S.playing ? '⏸' : '▶';
|
|
1069
|
-
paintPill();
|
|
1099
|
+
paintPill(); paintTabs();
|
|
1070
1100
|
document.body.classList.toggle('replay', !S.live);
|
|
1071
1101
|
}
|
|
1072
1102
|
|
|
1073
1103
|
// ---------- tool ticker, shared screen, flying messages ----------
|
|
1074
1104
|
// ---------- what each agent is doing: tool calls with their real outputs ----------
|
|
1075
1105
|
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.present = null; S.camFor = null; let presentTimer = null;
|
|
1106
|
+
S.files = new Map(); S.cands = new Map(); S.turnN = 0; S.turnSaid = ''; S.fgone = new Set(); S.fmade = new Map(); // 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
|
|
1076
1107
|
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
|
|
1077
1108
|
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');
|
|
1078
1109
|
const tokTotal = (u) => (u ? u.i + u.o + u.w : 0); // headline = input + output + cache writes; cache reads are cheap and shown separately
|
|
@@ -1087,10 +1118,11 @@ function loopStep(R, ev) { // R: per-agent repetition state; returns a detecti
|
|
|
1087
1118
|
}
|
|
1088
1119
|
const WIN1M = /(opus-4-[78]|opus-5|sonnet-5|fable-5)/;
|
|
1089
1120
|
function ctxWin(model, ctx) { const base = WIN1M.test(model || '') ? 1e6 : 2e5; return ctx > base ? 1e6 : base; } // the transcript does not say which window is in use: infer it, a bigger observed context proves the 1M window
|
|
1090
|
-
function tally(ev) { // numbers that pile up over a session: token usage, errors, last sign of life
|
|
1121
|
+
function tally(ev) { // numbers that pile up over a session: token usage, errors, last sign of life, the files it created
|
|
1122
|
+
noteFiles(ev);
|
|
1091
1123
|
if (ev.kind === 'compact') { S.compacts[ev.agent] = (S.compacts[ev.agent] || 0) + 1; delete S.ctxWarned[ev.agent]; }
|
|
1092
1124
|
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); }
|
|
1093
|
-
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;
|
|
1125
|
+
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
|
|
1094
1126
|
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); });
|
|
1095
1127
|
else if (ev.kind === 'tools' || ev.kind === 'say') S.lastAct[ev.agent] = ev.ts;
|
|
1096
1128
|
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
|
|
@@ -1109,8 +1141,12 @@ function renderTokens() {
|
|
|
1109
1141
|
renderCtx();
|
|
1110
1142
|
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];
|
|
1111
1143
|
const b = $('#tok'), tot = tokTotal(all); b.style.display = tot ? '' : 'none';
|
|
1112
|
-
if (tot) { b.textContent = `⚡ ${fmtTok(tot)} ${L('jetons', 'tokens')}`; b.title = tokTip(all); }
|
|
1113
|
-
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))}` : ''; if (u) t.title = tokTip(u); }
|
|
1144
|
+
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]))}`).join(''); } // and who used what, the biggest first
|
|
1145
|
+
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))}` : ''; el.dataset.w = L('jetons', 'tokens'); if (u) t.title = tokTip(u); }
|
|
1146
|
+
camTok(); if (S.events.length && document.body.classList.contains('rost')) paintStates(); // the list of agents carries the counts too
|
|
1147
|
+
}
|
|
1148
|
+
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
|
|
1149
|
+
const el = $('#pcam .tk'), u = S.present && S.usage[S.present]; if (!el) return; el.textContent = u && tokTotal(u) ? `⚡${fmtTok(tokTotal(u))}` : ''; $('#pcam').title = u ? tokTip(u) : '';
|
|
1114
1150
|
}
|
|
1115
1151
|
// One boring signal per tile: working · waiting on another agent · may need you · stalled · done. Stalled hand-offs are what really cost time.
|
|
1116
1152
|
// file edits are instant, so one that stays pending is almost surely an approval prompt; a Bash command may legitimately run long (⏳ badge instead)
|
|
@@ -1118,7 +1154,7 @@ const NEEDS_OK = /^(Edit|Write|MultiEdit|NotebookEdit|AskUserQuestion|ExitPlanMo
|
|
|
1118
1154
|
const atTail = () => S.idx >= S.events.length - 3; // only trust wall-clock ages when playback has caught up with the live end
|
|
1119
1155
|
function agentState(id, now) {
|
|
1120
1156
|
let s = S.status[id]; const r = S.run[id], w = S.waitOn[id], la = S.lastAct[id];
|
|
1121
|
-
if (id === 'main' && !s) { // the lead is at work until the message that closes its turn, even while it thinks
|
|
1157
|
+
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
|
|
1122
1158
|
const open = S.live && la && (S.sawEnd ? !S.turnOver && now - la < 180000 : now - la < 25000);
|
|
1123
1159
|
if (r || (w && w.size) || open) s = 'working'; else if (S.live && la) return { k: 'done', txt: '✓ ' + L('à vous', 'your turn') };
|
|
1124
1160
|
}
|
|
@@ -1146,14 +1182,14 @@ function paintStates() {
|
|
|
1146
1182
|
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); }
|
|
1147
1183
|
else if (!pr.classList.contains('cheer')) { if (pr.textContent !== want) pr.textContent = want; pr.className = 'prop ' + (want ? st.k : ''); }
|
|
1148
1184
|
if (shown && !S.gone.has(p.id)) ros.push({ p, st });
|
|
1149
|
-
if (p.id === 'main' && st.k === 'done' && was && was !== 'done' && was !== 'idle' && S.live && S.playing
|
|
1185
|
+
if (p.id === 'main' && st.k === 'done' && was && was !== 'done' && was !== 'idle' && S.live && S.playing) { S.wrap = was; if (Date.now() - (S.mainBusyAt || 0) > 45000) confetti(); } // the lead is done, its face says so: it always has a word for it (see wrapUp, which needs to know what it was doing just before), and confetti after a long turn
|
|
1150
1186
|
if (p.id === 'main') { if (st.k === 'working' || st.k === 'waiting') S.mainBusyAt = S.mainBusyAt || Date.now(); else if (st.k === 'done') S.mainBusyAt = 0; }
|
|
1151
1187
|
S.prevState[p.id] = st.k; const tip = `${p.name} — ${p.role}${st.txt ? '\n' + st.txt : ''}${S.lastTool[p.id] ? '\n' + S.lastTool[p.id] : ''}`; if (t.title !== tip) t.title = tip;
|
|
1152
1188
|
}
|
|
1153
1189
|
paintPill();
|
|
1154
1190
|
const b = $('#board'), parts = [['working', '⚙', L('au travail', 'working')], ['waiting', '🔗', L('en attente', 'waiting')], ['blocked', '✋', L('vous attendent', 'need you')], ['stalled', '⚠', L('bloqués', 'stalled')], ['done', '✓', L('terminés', 'done')]]
|
|
1155
1191
|
.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('');
|
|
1156
|
-
if (b.innerHTML !== parts) b.innerHTML = parts; fitBoard(); S.nBlocked = n.blocked + n.stalled; S.attn = attn; paintRoster(ros); return n;
|
|
1192
|
+
if (b.innerHTML !== parts) b.innerHTML = parts; fitBoard(); S.nBlocked = n.blocked + n.stalled; S.attn = attn; paintRoster(ros); paintFiles(); return n;
|
|
1157
1193
|
}
|
|
1158
1194
|
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
|
|
1159
1195
|
const b = $('#board'), key = innerWidth + '|' + b.textContent.length + '|' + $('#pill').textContent.length + '|' + $('#subtitle').textContent.length;
|
|
@@ -1162,15 +1198,18 @@ function fitBoard(force) { // the chips lose their words when they do not all
|
|
|
1162
1198
|
}
|
|
1163
1199
|
addEventListener('resize', () => fitBoard(true)); new ResizeObserver(() => requestAnimationFrame(() => fitBoard(true))).observe($('#board')); /* the room the chips have also changes when the texts beside them do (a title, a longer status) */
|
|
1164
1200
|
const RORDER = { blocked: 0, stalled: 1, working: 2, waiting: 3, idle: 4, done: 5 };
|
|
1201
|
+
const rosTok = (id) => { const u = S.usage[id]; return u && tokTotal(u) ? `<span class="rt" title="${esc(tokTip(u))}">⚡${fmtTok(tokTotal(u))}</span>` : ''; };
|
|
1165
1202
|
function paintRoster(ros) { // a fixed list beside the call: who is doing what, urgent first, readable even with dozens of agents
|
|
1166
1203
|
const box = $('#roster'); if (!box || !document.body.classList.contains('rost')) return;
|
|
1167
1204
|
ros.sort((a, b) => (a.p.id === 'main' ? -1 : b.p.id === 'main' ? 1 : (RORDER[a.st.k] - RORDER[b.st.k]) || (S.lastAct[b.p.id] || 0) - (S.lastAct[a.p.id] || 0)));
|
|
1168
|
-
const rows = ros.slice(0, 60).map(({ p, st }) => `<div class="rr k-${st.k}${isTurn(p.id, st) ? ' turn' : ''}${S.focus === p.id ? ' sel' : ''}${S.speakers.has(p.id) ? ' speaking' : ''}" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}, ${esc(st.txt || '')}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role)}</span
|
|
1169
|
-
const
|
|
1205
|
+
const rows = ros.slice(0, 60).map(({ p, st }) => `<div class="rr k-${st.k}${isTurn(p.id, st) ? ' turn' : ''}${S.focus === p.id ? ' sel' : ''}${S.speakers.has(p.id) ? ' speaking' : ''}" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}, ${esc(st.txt || '')}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role)}</span>${rosTok(p.id)}</div><div class="st">${esc(st.txt || L('en veille', 'standing by'))}${S.loops[p.id] ? ' 🔁' : ''}</div></div>`).join('');
|
|
1206
|
+
const left = Object.values(S.agents).filter((p) => S.gone.has(p.id) && p.id !== 'main' && p.id !== 'user').sort((a, b) => (S.lastAct[b.id] || 0) - (S.lastAct[a.id] || 0)); // a finished agent's tile leaves the stage: its line stays here, with what it used
|
|
1207
|
+
const gone = left.slice(0, 40).map((p) => `<div class="rr left" data-id="${esc(p.id)}" tabindex="0" role="button" aria-label="${esc(p.name)}"><div class="n"><span class="dot" style="background:${p.shirt}"></span><b>${esc(p.name)}</b><span class="ro">${esc(p.role)}</span>${rosTok(p.id)}</div></div>`).join('');
|
|
1208
|
+
const html = `<h3>${L('Agents', 'Agents')} · ${ros.length}</h3>${rows}${ros.length > 60 ? `<div class="ro" style="padding:4px 8px">+${ros.length - 60}</div>` : ''}${left.length ? `<h3 style="margin-top:8px">${L('terminés', 'done')} · ${left.length}</h3>${gone}` : ''}`;
|
|
1170
1209
|
if (box.dataset.h !== html) { box.dataset.h = html; box.innerHTML = html; }
|
|
1171
1210
|
}
|
|
1172
|
-
$('#roster').onclick = (e) => { const r = e.target.closest('.rr'); if (!r) return; S.focusLock = Date.now() + 25000; setFocus(r.dataset.id); paintStates(); };
|
|
1173
|
-
$('#roster').onkeydown = (e) => { const r = e.target.closest('.rr'); if (r && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); S.focusLock = Date.now() + 25000; setFocus(r.dataset.id); paintStates(); } else if (r && e.key === 'i') openDetail(r.dataset.id); };
|
|
1211
|
+
$('#roster').onclick = (e) => { const r = e.target.closest('.rr'); if (!r) return; if (r.classList.contains('left')) { openDetail(r.dataset.id); return; } S.focusLock = Date.now() + 25000; setFocus(r.dataset.id); paintStates(); };
|
|
1212
|
+
$('#roster').onkeydown = (e) => { const r = e.target.closest('.rr'); if (r && r.classList.contains('left') && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); openDetail(r.dataset.id); } else if (r && (e.key === 'Enter' || e.key === ' ')) { e.preventDefault(); S.focusLock = Date.now() + 25000; setFocus(r.dataset.id); paintStates(); } else if (r && e.key === 'i') openDetail(r.dataset.id); };
|
|
1174
1213
|
$('#roster').ondblclick = (e) => { const r = e.target.closest('.rr'); if (r) openDetail(r.dataset.id); };
|
|
1175
1214
|
function renderBadges() { // per tile: failed tool calls, a command that has been running a long time, an agent that went quiet
|
|
1176
1215
|
const now = Date.now();
|
|
@@ -1310,7 +1349,8 @@ function renderPresent() {
|
|
|
1310
1349
|
}
|
|
1311
1350
|
el.dataset.k = tk;
|
|
1312
1351
|
$('#pbadge').textContent = `🖥 ${p.name} ${L('partage son écran', 'is sharing their screen')}`;
|
|
1313
|
-
if (S.camFor !== id) { $('#pcam').innerHTML = avatarSVG(p, undefined, 'c' + p.gid + '_') + `<div class="tag"><b>${esc(p.name)}</b></div>`; S.camFor = id; }
|
|
1352
|
+
if (S.camFor !== id) { $('#pcam').innerHTML = avatarSVG(p, undefined, 'c' + p.gid + '_') + `<div class="tag"><b>${esc(p.name)}</b><span class="tk"></span></div>`; S.camFor = id; }
|
|
1353
|
+
camTok();
|
|
1314
1354
|
$('#pcam').classList.toggle('speaking', S.speakers.has(id));
|
|
1315
1355
|
}
|
|
1316
1356
|
function armPresent() { // stays up while a command is still running, then ~4 s after the last action (~9 s when it shows a picture)
|
|
@@ -1325,6 +1365,62 @@ function showPresent(id) {
|
|
|
1325
1365
|
function hidePresent() {
|
|
1326
1366
|
clearTimeout(presentTimer); if (!S.present) return; S.present = null; $('#present').classList.remove('on'); document.body.classList.remove('presenting'); document.querySelectorAll('.tile.presenter').forEach((t) => t.classList.remove('presenter')); $('#pcap').textContent = ''; layout();
|
|
1327
1367
|
}
|
|
1368
|
+
// ---------- shared files: the files the session created (its Write calls), the way a call shows what was shared in it ----------
|
|
1369
|
+
// They show when a turn ends, the moment you would go and look for them: one line under the call, the newest first, a dot on those of the turn that just ended. A click shows the file in its folder
|
|
1370
|
+
// (the server opens Finder, Explorer or the file manager, and only for a file this session wrote). Nothing shows while the team works.
|
|
1371
|
+
// The line names the files made for you, not everything that was written: those the lead names when it speaks to you in that turn (or that you asked for by name); in a turn where it names none, the ones that are documents by their type.
|
|
1372
|
+
// A session that writes fifteen source files shows none of them there. All of them are in the list, behind "+N". Off in ⚙ › Display.
|
|
1373
|
+
// A document made by a command (not by a Write call) shows too, when the lead names it: see candFile.
|
|
1374
|
+
const FSKIP = /^(\/private)?\/(tmp|var\/folders)\/|[\\/]AppData[\\/]Local[\\/]Temp[\\/]|[\\/]\.claude[\\/]projects[\\/]/i; // not documents: scratch files in a temporary folder, and the notes an agent keeps for itself
|
|
1375
|
+
const FICON = [[/\.(png|jpe?g|gif|webp|svg|bmp|ico)$/i, '🖼'], [/\.(csv|tsv|xlsx?|json|ya?ml|sql)$/i, '📊']], FMAX = 8; // FMAX: how many files the line names; the others are in the list
|
|
1376
|
+
const FDOC = /\.(html?|md|markdown|txt|rtf|pdf|docx?|pptx?|xlsx?|csv|tsv|png|jpe?g|gif|webp|svg)$/i; // read or looked at, not run
|
|
1377
|
+
const namesFile = (text, name) => { for (let i = name ? text.indexOf(name) : -1; i >= 0; i = text.indexOf(name, i + 1)) if (!/[\w.\-]/.test(text[i - 1] || ' ') && !/[\w\-]/.test(text[i + name.length] || ' ')) return true; return false; }; // the whole name: "report.md" is not named by "old-report.md"
|
|
1378
|
+
const filesForYou = (all) => { const named = new Set(all.filter((f) => f.named).map((f) => f.turn)); return all.filter((f) => f.named || (!named.has(f.turn) && FDOC.test(f.name))); };
|
|
1379
|
+
const fileParts = (f) => { const p = String(f || '').split(/[\\/]/), name = p.pop() || ''; return { name, dir: p.slice(-3).join(' › '), icon: (FICON.find(([re]) => re.test(name)) || [0, '📄'])[1] }; };
|
|
1380
|
+
function noteFiles(ev) { // a file written twice is one file, of the turn that wrote it last; a write that failed created nothing
|
|
1381
|
+
if (ev.kind === 'user') { S.turnN++; S.turnSaid = String(ev.text || ''); }
|
|
1382
|
+
else if (ev.kind === 'say' && ev.agent === 'main') { const t = String(ev.text || ''); S.turnSaid = (S.turnSaid + '\n' + t).slice(-20000); for (const f of S.files.values()) if (!f.named && namesFile(t, f.name)) f.named = true; for (const c of S.cands.values()) if (namesFile(t, c.name)) c.want = S.turnN; } // named before it is written ("I will put it in plan.md") or after: both count
|
|
1383
|
+
else if (ev.kind === 'tools') { for (const t of ev.tools) { const d = t.d || {}, was = S.files.get(d.file); if (d.kind === 'cmd' && d.outs) for (const f of d.outs) candFile(f, t.id, ev.agent); if (d.kind !== 'write' || !d.file || FSKIP.test(d.file) || (was && was.id === t.id)) continue; const name = fileParts(d.file).name; S.files.delete(d.file); S.files.set(d.file, { file: d.file, name, id: t.id, agent: ev.agent, turn: S.turnN, named: !!(was && was.named) || namesFile(S.turnSaid, name), was }); } }
|
|
1384
|
+
else if (ev.kind === 'results') { for (const it of ev.items) { if (it.err) { for (const [k, f] of S.files) if (f.id === it.id) { if (f.was) S.files.set(k, f.was); else S.files.delete(k); } for (const [k, c] of S.cands) if (c.id === it.id) S.cands.delete(k); } else if (it.files) for (const f of it.files) candFile(f, it.id, ev.agent); } }
|
|
1385
|
+
}
|
|
1386
|
+
// A document a command made (an export, a report written by a script, a package) is one of the files made for you when the lead names it. The transcript only says that a command names it:
|
|
1387
|
+
// when the turn ends the server is asked whether it is there and was written since that command started. One that was only read, listed or removed is not shown.
|
|
1388
|
+
function candFile(file, id, agent) {
|
|
1389
|
+
if (!file || FSKIP.test(file) || S.files.has(file) || S.cands.has(file)) return; if (S.cands.size >= 300) S.cands.delete(S.cands.keys().next().value);
|
|
1390
|
+
const c = { file, name: fileParts(file).name, id, agent }; S.cands.set(file, c); if (namesFile(S.turnSaid, c.name)) c.want = S.turnN;
|
|
1391
|
+
}
|
|
1392
|
+
function askMade(c) { // once per file and per turn in which it is named: a command that runs in the background may write it after the first time it is named
|
|
1393
|
+
const key = c.want + '|' + c.file, ok = S.fmade.get(key), cur = S.cur; if (ok === true) { S.files.set(c.file, { file: c.file, name: c.name, id: c.id, agent: c.agent, turn: c.want, named: true, cmd: true }); return; }
|
|
1394
|
+
if (ok !== undefined || S.demo || !cur) return; S.fmade.set(key, null);
|
|
1395
|
+
fetch('/api/reveal', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ proj: cur.proj, id: cur.id, file: c.file, check: true }) }).then((r) => { if (S.cur !== cur) return; S.fmade.set(key, r.ok); if (r.ok) paintFiles(); }).catch(() => { if (S.cur === cur) S.fmade.delete(key); });
|
|
1396
|
+
}
|
|
1397
|
+
const turnDone = () => S.events.length > 0 && !S.locked && (S.live ? agentState('main', Date.now()).k === 'done' : !!S.turnOver || S.idx >= S.events.length - 1); // replay: the mark that closes the lead's turn, or the end of a session that has none
|
|
1398
|
+
const fileTip = (f) => `${f.file}\n${f.agent !== 'main' && S.agents[f.agent] ? nameOf(f.agent) + ' · ' : ''}${S.fgone.has(f.file) ? L('Ce fichier n’existe plus', 'This file is no longer there') : L('Cliquer pour l’afficher dans son dossier', 'Click to show it in its folder')}`;
|
|
1399
|
+
const fileCls = (f) => (f.turn === S.turnN ? ' new' : '') + (S.fgone.has(f.file) ? ' gone' : '');
|
|
1400
|
+
function paintFiles() { // called with every repaint of the states: touches the page only when the line would read differently
|
|
1401
|
+
if (prefs.files !== false && S.cands.size && turnDone()) for (const c of S.cands.values()) if (c.want != null && !S.files.has(c.file)) askMade(c); // the documents the commands made, among those the lead named
|
|
1402
|
+
const el = $('#files'), all = [...S.files.values()].reverse(), mine = prefs.files !== false ? filesForYou(all) : [], on = mine.length > 0 && turnDone(), rest = all.length - Math.min(mine.length, FMAX);
|
|
1403
|
+
const key = on ? prefs.lang + '|' + S.turnN + '|' + all.map((f) => f.file + (S.fgone.has(f.file) ? '!' : '')).join('|') + '||' + mine.map((f) => f.file).join('|') : ''; if (el.dataset.k === key) return;
|
|
1404
|
+
const open = on && !!$('#fpop'), ttl = L('Fichiers créés pendant cette session', 'Files created in this session'); el.dataset.k = key; filesPop(false); if (el.classList.contains('on') !== on) { el.classList.toggle('on', on); later('lay', layout); }
|
|
1405
|
+
el.innerHTML = !on ? '' : `<button class="sfh" id="fAll" aria-expanded="false" title="${esc(ttl)}">📎 ${esc(L('Fichiers', 'Files'))}</button>` + mine.slice(0, FMAX).map((f) => `<button class="sfc${fileCls(f)}" data-f="${esc(f.file)}" title="${esc(fileTip(f))}"><i>${fileParts(f.file).icon}</i><span>${esc(f.name)}</span></button>`).join('') + (rest > 0 ? `<button class="sfc more" title="${esc(ttl)}" aria-label="${esc(ttl)}">+${rest}</button>` : '');
|
|
1406
|
+
el.scrollLeft = 0; if (open) filesPop(true);
|
|
1407
|
+
}
|
|
1408
|
+
function filesPop(open) { // the whole list, above the line: every file with the folder it is in and who created it
|
|
1409
|
+
const old = $('#fpop'), b = $('#fAll'); if (old) old.remove(); if (b) b.setAttribute('aria-expanded', String(!!open)); if (!open) return;
|
|
1410
|
+
const all = [...S.files.values()].reverse(), p = document.createElement('div'), ttl = L('Fichiers créés pendant cette session', 'Files created in this session'); p.id = 'fpop'; p.setAttribute('role', 'dialog'); p.setAttribute('aria-label', ttl);
|
|
1411
|
+
p.innerHTML = `<h4>${esc(ttl)} · ${all.length}</h4>` + all.map((f) => { const x = fileParts(f.file), who = f.agent !== 'main' && S.agents[f.agent] ? nameOf(f.agent) : ''; return `<button class="sfr${fileCls(f)}" data-f="${esc(f.file)}" title="${esc(fileTip(f))}"><i>${x.icon}</i><b>${esc(x.name)}</b><em>${esc([x.dir, who].filter(Boolean).join(' · '))}</em></button>`; }).join('');
|
|
1412
|
+
p.style.bottom = Math.round($('#center').getBoundingClientRect().bottom - $('#files').getBoundingClientRect().top) + 6 + 'px'; p.onclick = filesClick; $('#center').appendChild(p);
|
|
1413
|
+
}
|
|
1414
|
+
async function revealFile(file) {
|
|
1415
|
+
if (S.demo || !S.cur) { toast(L('Fichier de la démo : rien à ouvrir', 'A file of the demo: nothing to open')); return; }
|
|
1416
|
+
let r = null; try { r = await fetch('/api/reveal', { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ proj: S.cur.proj, id: S.cur.id, file }) }); } catch {}
|
|
1417
|
+
if (r && r.ok) { if (S.fgone.delete(file)) paintFiles(); return; }
|
|
1418
|
+
if (r && r.status === 410) { S.fgone.add(file); paintFiles(); toast(L('Ce fichier n’existe plus', 'This file is no longer there')); } else toast(L('Impossible d’ouvrir le dossier', 'Could not open the folder'));
|
|
1419
|
+
}
|
|
1420
|
+
function filesClick(e) { const f = e.target.closest('[data-f]'); if (f) revealFile(f.dataset.f); else if (e.target.closest('.sfh, .more')) filesPop(!$('#fpop')); }
|
|
1421
|
+
$('#files').onclick = filesClick;
|
|
1422
|
+
addEventListener('click', (e) => { if ($('#fpop') && !e.target.closest('#fpop, #files')) filesPop(false); });
|
|
1423
|
+
addEventListener('keydown', (e) => { if (e.key === 'Escape' && $('#fpop')) { filesPop(false); const b = $('#fAll'); if (b) b.focus(); } });
|
|
1328
1424
|
// the speaker always gets the spotlight (and keeps it until someone else talks)
|
|
1329
1425
|
function setFocus(id) {
|
|
1330
1426
|
if (S.focus === id) return; const o = $('#t-' + S.focus); if (o) o.classList.remove('focus'); S.focus = id; const t = $('#t-' + id);
|
|
@@ -1395,7 +1491,6 @@ setInterval(() => { // now and then a busy agent has a little thought; never w
|
|
|
1395
1491
|
}, 7000);
|
|
1396
1492
|
function oops(id) { if (!prefs.banter || !S.playing || S.recomputing) return; const t = $('#t-' + id); if (!t || t.style.display === 'none' || (t._oops && Date.now() - t._oops < 4000)) return; t._oops = Date.now(); t.classList.remove('oops'); void t.offsetWidth; t.classList.add('oops'); thought(id, '😬'); }
|
|
1397
1493
|
function confetti() {
|
|
1398
|
-
S.wrap = true; // the lead is done: if the end of its last message was never read, it is read now (see wrapUp)
|
|
1399
1494
|
if (!prefs.banter || document.hidden) return; const box = $('#center'), cols = ['#f5c04a', '#7c9cff', '#ff7a6b', '#5ad19a', '#c58bff'];
|
|
1400
1495
|
for (let i = 0; i < 26; i++) { const c = document.createElement('i'); c.className = 'confetti'; c.style.left = Math.random() * 100 + '%'; c.style.background = cols[i % cols.length]; c.style.animationDelay = Math.random() * 0.6 + 's'; c.style.animationDuration = 1.8 + Math.random() * 1.4 + 's'; box.appendChild(c); setTimeout(() => c.remove(), 4200); }
|
|
1401
1496
|
}
|
|
@@ -1653,7 +1748,7 @@ function ackLine(ev) {
|
|
|
1653
1748
|
// conversation: short exchanges between agents at the right moments, built from what really happened in the session
|
|
1654
1749
|
// =====================================================================
|
|
1655
1750
|
const CHAT = { quiet: 0.45, normal: 1, lively: 1.8 }, chatMul = () => CHAT[prefs.chat] || 1; // normal unless chosen otherwise
|
|
1656
|
-
const EXW = { en: { edit: ['edit', 'edits'], call: ['tool call', 'tool calls'], error: ['error', 'errors'] }, fr: { edit: ['modification', 'modifications'], call: ['appel d’outil', 'appels d’outils'], error: ['erreur', 'erreurs'] } };
|
|
1751
|
+
const EXW = { en: { edit: ['edit', 'edits'], call: ['tool call', 'tool calls'], error: ['error', 'errors'], file: ['file', 'files'] }, fr: { edit: ['modification', 'modifications'], call: ['appel d’outil', 'appels d’outils'], error: ['erreur', 'erreurs'], file: ['fichier', 'fichiers'] } };
|
|
1657
1752
|
const P = (k, n) => { const w = EXW[FR() ? 'fr' : 'en'][k]; return `${n} ${n === 1 ? w[0] : w[1]}`; };
|
|
1658
1753
|
const EXCH = {
|
|
1659
1754
|
en: { done: ['All done.', 'Finished.', 'Okay, that’s done.', 'Done on my side.', 'That’s wrapped up.'],
|
|
@@ -1678,13 +1773,13 @@ const EXCH = {
|
|
|
1678
1773
|
sync: ['Petit point rapide : où en est-on ?', 'Point d’étape, tout le monde ?', 'On fait un tour de table rapide.'], syncAns: [(a) => `Toujours dessus : ${a}.`, (a) => `${a}, ça avance bien.`, (a) => `En ce moment : ${a}.`] },
|
|
1679
1774
|
};
|
|
1680
1775
|
const exPick = (arr, seed, ...args) => { let k = seed % arr.length; if (arr[k] === S.lastX && arr.length > 1) k = (k + 1) % arr.length; S.lastX = arr[k]; return typeof arr[k] === 'function' ? arr[k](...args) : arr[k]; };
|
|
1681
|
-
function exchFacts(i, agent) { // what this agent did since it received its order: edits, tool calls, errors, the
|
|
1682
|
-
const ev = S.events; let o = -1;
|
|
1683
|
-
for (let k = i; k >= Math.max(0, i - 600); k--)
|
|
1684
|
-
const f = { tools: 0, edits: 0, errs: 0, file: '', dur: '', ms: 0 };
|
|
1776
|
+
function exchFacts(i, agent) { // what this agent did since it received its order: edits, tool calls, errors, the files it changed, how long it took
|
|
1777
|
+
const ev = S.events, lead = agent === 'main'; let o = -1; // the lead: back to your message, or to the message that closed its previous stretch when it was woken without you (a background task that finished)
|
|
1778
|
+
for (let k = i, acted = false; k >= Math.max(0, i - (lead ? 6000 : 600)); k--) { const e = ev[k]; if (lead ? e.kind === 'user' || (e.end && acted) : e.kind === 'order' && e.to === agent) { o = e.end ? k + 1 : k; break; } if (e.agent === 'main' && (e.end || e.kind === 'say' || e.kind === 'tools')) acted = true; }
|
|
1779
|
+
const f = { tools: 0, edits: 0, errs: 0, file: '', files: [], dur: '', ms: 0 };
|
|
1685
1780
|
for (let k = o >= 0 ? o : Math.max(0, i - 250); k <= i; k++) {
|
|
1686
1781
|
const e = ev[k]; if (e.agent !== agent) continue;
|
|
1687
|
-
if (e.kind === 'tools') for (const t of e.tools) { f.tools++; if (/^(Edit|Write|MultiEdit|NotebookEdit)/.test(t.name)) { f.edits++; f.file = base((t.d || {}).file || t.arg) || f.file; } }
|
|
1782
|
+
if (e.kind === 'tools') for (const t of e.tools) { f.tools++; if (/^(Edit|Write|MultiEdit|NotebookEdit)/.test(t.name)) { f.edits++; f.file = base((t.d || {}).file || t.arg) || f.file; if (f.file && !f.files.includes(f.file)) f.files.push(f.file); } }
|
|
1688
1783
|
else if (e.kind === 'results') f.errs += e.items.filter((it) => it.err).length;
|
|
1689
1784
|
}
|
|
1690
1785
|
if (o >= 0 && ev[i].ts && ev[o].ts) { f.ms = Math.max(0, ev[i].ts - ev[o].ts); f.dur = fmtShort(f.ms); }
|
|
@@ -1795,13 +1890,29 @@ async function leadAck(ev, token) {
|
|
|
1795
1890
|
else if (k === 'cmd') { const note = (d.note || '').trim().replace(/[.\s]+$/, ''), cmd = String(d.text || '').trim().split(/\s+/).slice(0, 2).join(' ').slice(0, 26); what = note ? W.note + note + '.' : cmd ? what + cmd + '.' : W.any; }
|
|
1796
1891
|
await sayLine('main', `${W.in[hash('k' + ev.ts) % W.in.length]} ${what}`, '💬', token);
|
|
1797
1892
|
}
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
|
|
1893
|
+
// Live, each time the lead is done (the happy face), it has a word. From its own message when part of it was left unread (wrapUp); else what it just did, taken from the session, and how it ends:
|
|
1894
|
+
// you: its turn is over, the floor goes back to you. step: it only went quiet, nothing says its turn is over. team: the agents it waited for are all back, and Claude Code wakes it with their reports.
|
|
1895
|
+
// The last two are the wins in the middle of a turn: about one closing message in five is followed by more work without a word from you.
|
|
1896
|
+
const CLOSE = {
|
|
1897
|
+
en: { edit: [(a) => `I changed ${a}.`, (a) => `I updated ${a}.`, (a) => `My changes are in ${a}.`], calls: [(w, d) => `That was ${w}${d ? ' in ' + d : ''}.`, (w, d) => `In total: ${w}${d ? ' in ' + d : ''}.`], said: ['That’s my answer.', 'That’s all from me.', 'Nothing more from me.'], ask: ['I’ll wait for your answer.', 'Your call.', 'Tell me what you prefer.'], you: ['Your turn.', 'Over to you.', 'Back to you.'], step: ['One step done.', 'That part is done.', 'So far so good.'], team: ['The team is back. I’ll go through the reports.', 'All the reports are in. Let me read them.', 'Everyone has reported. I’ll take it from here.'], and: ' and ' },
|
|
1898
|
+
fr: { edit: [(a) => `J’ai modifié ${a}.`, (a) => `J’ai mis à jour ${a}.`, (a) => `Mes changements sont dans ${a}.`], calls: [(w, d) => `Ça fait ${w}${d ? ' en ' + d : ''}.`, (w, d) => `Au total : ${w}${d ? ' en ' + d : ''}.`], said: ['Voilà ma réponse.', 'C’est tout pour moi.', 'Rien de plus de mon côté.'], ask: ['J’attends votre réponse.', 'À vous de décider.', 'Dites-moi ce que vous préférez.'], you: ['À vous.', 'C’est à vous.', 'Je vous rends la main.'], step: ['Une étape de faite.', 'Cette partie est faite.', 'Jusqu’ici, tout va bien.'], team: ['L’équipe est de retour. Je parcours les rapports.', 'Tous les rapports sont là. Je les lis.', 'Tout le monde a rendu son rapport. Je prends la suite.'], and: ' et ' },
|
|
1899
|
+
};
|
|
1900
|
+
function closeLine(e, tail) { // e: the message that closed this stretch of work; none when there is no new one, and then the line is only how it ends
|
|
1901
|
+
const W = CLOSE[FR() ? 'fr' : 'en'], f = e ? exchFacts(S.pos - 1, 'main') : null, n = f ? f.files.length : 0, ask = tail === 'you' && !!e && /[??]$/.test(plain(e.text)); // it ends on a question: the floor is yours, to answer it
|
|
1902
|
+
const make = (s) => { const end = W[tail][(s >>> 3) % W[tail].length]; if (!e) return end; if (ask) return W.ask[s % W.ask.length];
|
|
1903
|
+
const did = n ? W.edit[s % W.edit.length](n < 3 ? f.files.join(W.and) : P('file', n)) : f.tools ? W.calls[s % W.calls.length](P('call', f.tools), f.ms >= 20000 ? f.dur : '') : tail === 'you' ? W.said[s % W.said.length] : ''; return (did ? did + ' ' : '') + end; };
|
|
1904
|
+
const s = hash('c' + (e ? e.ts : Date.now())); let line = make(s); if (line === S.lastClose) line = make(s + 8); return (S.lastClose = line); // never the same line twice in a row
|
|
1905
|
+
}
|
|
1906
|
+
async function wrapUp(token, brief) { // brief: the call already has more to play (the lead went on, or you typed): the short line only, not the rest of a message that is no longer the news
|
|
1907
|
+
if (!S.wrap || S.speakers.size || !prefs.voice && !prefs.banter) return false; const was = S.wrap; S.wrap = false;
|
|
1908
|
+
if (agentState('main', Date.now()).k !== 'done') return false; // back at work before it had the floor
|
|
1909
|
+
if (was === 'waiting') { if (!prefs.banter) return false; await sayLine('main', closeLine(null, 'team'), '🎉', token); return true; } // its last message dates from before the wait
|
|
1910
|
+
let k = Math.min(S.pos, S.events.length) - 1; while (k >= 0 && !(S.events[k].agent === 'main' && S.events[k].kind === 'say')) k--; const e = k >= 0 ? S.events[k] : null, m = S.mainSaid; // among what the call has played
|
|
1911
|
+
const fresh = !!e && S.wrapped !== e && e.ts > (S.from || 0); if (fresh) S.wrapped = e; // a message counts once: the lead's state can flip to done several times (a short command, a silence) without a new message
|
|
1912
|
+
const mine = fresh && !!m && m.ev === e; let line = ''; // mine: this very message was read, in full or cut short. Otherwise it was never read, and is summed up from its start
|
|
1913
|
+
if (fresh && !brief && !(mine && m.full)) { const rest = gist(e.text, mine ? plain(e.text).slice(0, m.said) : ''); if (rest.length >= 25) line = (mine ? L('Pour résumer : ', 'To sum up: ') : '') + rest; }
|
|
1914
|
+
if (!line && prefs.banter) line = closeLine(fresh ? e : null, S.turnOver ? 'you' : 'step'); // nothing of its message is left to read: a little line of the call, off with the others in ⚙
|
|
1915
|
+
if (!line) return false; await sayLine('main', line, '🎉', token); return true;
|
|
1805
1916
|
}
|
|
1806
1917
|
async function smallTalk(token) {
|
|
1807
1918
|
if (prefs.chat === 'quiet') return; // quiet: nothing to fill the silences, only the real exchanges
|
|
@@ -1831,6 +1942,8 @@ async function run(i) {
|
|
|
1831
1942
|
while (token === S.token) {
|
|
1832
1943
|
const lim = S.stopAt || S.events.length; S.pos = i;
|
|
1833
1944
|
if (S.live && S.late.length) { await converse(S.late.shift(), token); if (token !== S.token) return; continue; } // a line that turned out to be a report after it was read
|
|
1945
|
+
if (S.live && S.knock && !S.hurry) { const v = S.knock; S.knock = null; await visitSay(v, token); if (token !== S.token) return; continue; } // a visitor from another session: between two lines of the call, never over one
|
|
1946
|
+
if (S.live && S.wrap && i < lim && !S.hurry && S.boost <= 1 && nearLive()) { if (await wrapUp(token, true)) { if (token !== S.token) return; continue; } } // the lead's word for what it just finished comes before what happened next: a win in the middle of a turn is followed by more work within seconds
|
|
1834
1947
|
if (i >= lim) { if (S.live && !S.stopAt) { if (!S.idle) { S.idle = true; syncUI(); } if (await wrapUp(token)) continue; await smallTalk(token); await sleep(350); continue; } break; }
|
|
1835
1948
|
if (S.idle) { S.idle = false; syncUI(); }
|
|
1836
1949
|
if (S.live) { // way behind: skip ahead to stay current, but only count what is actually said: sub-agents produce thousands of silent tool events
|
|
@@ -1869,7 +1982,7 @@ async function run(i) {
|
|
|
1869
1982
|
if (FR() && !S.hurry) { prefetchTr(i); await Promise.race([ensureTr(group.map((g) => baseText(g))), sleep(S.live ? 7000 : 14000)]); if (token !== S.token) return; }
|
|
1870
1983
|
prefetchQuips(i); warmTTS(i);
|
|
1871
1984
|
const playOne = (g) => {
|
|
1872
|
-
applyStatus(g); g._as = g.kind; if (g.agent === 'user') S.owed = true; else if (g.agent === 'main') S.owed = false; // your order waits for a word from the lead
|
|
1985
|
+
applyStatus(g); if (g.end) paintStates(); g._as = g.kind; if (g.agent === 'user') S.owed = true; else if (g.agent === 'main') S.owed = false; // your order waits for a word from the lead
|
|
1873
1986
|
const label = g.kind === 'order' ? `${L('pour', 'to')} ${nameOf(g.to)}` : g.kind === 'report' ? `${L('rapport à', 'report to')} ${nameOf(g.to)}` : '', line = talkLine(g);
|
|
1874
1987
|
startTalk(g.agent, line, label);
|
|
1875
1988
|
if (g.kind === 'order') { S.status[g.to] = 'working'; AUD.join(); setTimeout(() => { paintStatus(); fly(g.agent, g.to, '📨'); popTile(g.to); }, 30); }
|
|
@@ -1925,7 +2038,7 @@ async function loadSession(proj, id) {
|
|
|
1925
2038
|
const data = await (await fetch(`/api/session?proj=${encodeURIComponent(proj)}&id=${id}`)).json();
|
|
1926
2039
|
if (mine !== S.loadN || data.error) return false;
|
|
1927
2040
|
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)));
|
|
1928
|
-
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.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');
|
|
2041
|
+
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();
|
|
1929
2042
|
const opt = $('#sessions').selectedOptions[0]; S.title = (S.live ? niceProj(proj) : opt && opt.dataset.title) || '';
|
|
1930
2043
|
if (proj === '_demo') S.events.forEach((e) => { if (e.fr) trMem.set(baseText(e), e.fr); }); // the demo ships its own French
|
|
1931
2044
|
$('#subtitle').textContent = S.title; recomputeStatus(0); buildStage(); renderHighlights(); setFocus('main'); renderLog(true); computeGantt(); layout(); paintStatus(); prefetchTr(0); return true;
|
|
@@ -1936,13 +2049,17 @@ async function fillProjects() { // live view: follow the latest activity anywh
|
|
|
1936
2049
|
sel.innerHTML = `<option value="">${L('Tous les projets (le plus récent)', 'All projects (most recent)')}</option>` + rows.map((r) => `<option value="${esc(r.proj)}">${esc(niceProj(r.proj))}</option>`).join('');
|
|
1937
2050
|
sel.value = prefs.proj && rows.some((r) => r.proj === prefs.proj) ? prefs.proj : ''; sel.style.display = rows.length > 1 ? '' : 'none';
|
|
1938
2051
|
}
|
|
1939
|
-
$('#liveProj').onchange = () => { Q.delete('proj'); prefs.proj = $('#liveProj').value; S.pin = ''; savePrefs(); S.cur = null; followCurrent(); };
|
|
2052
|
+
$('#liveProj').onchange = () => { Q.delete('proj'); prefs.proj = $('#liveProj').value; S.pin = S.pinProj = ''; S.hold = null; savePrefs(); S.cur = null; followCurrent(); };
|
|
1940
2053
|
async function followCurrent() {
|
|
1941
|
-
|
|
2054
|
+
if (S.hold && (S.pin || Date.now() > S.hold.until)) S.hold = null; const at = S.pin ? { id: S.pin, proj: S.pinProj } : S.hold; // the session the call is kept in: the pinned one, or for a moment the one of the tab you went to (see tabSession)
|
|
2055
|
+
const cur = await (await fetch('/api/current?proj=' + encodeURIComponent((at && at.proj) || Q.get('proj') || prefs.proj || '') + (at ? '&id=' + encodeURIComponent(at.id) : '') + (S.cur && !at ? '&sproj=' + encodeURIComponent(S.cur.proj) + '&sid=' + encodeURIComponent(S.cur.id) : ''))).json();
|
|
2056
|
+
if ((S.pin || (S.hold && S.hold.id) || '') !== (at ? at.id : '')) return false; // asked before a click or a tab sent the call elsewhere (or let it go): the answer to act on is the one asked since. This one undid the click
|
|
1942
2057
|
if (!cur.id) { $('#empty').classList.add('on'); return false; } $('#empty').classList.remove('on');
|
|
1943
|
-
if (S.pin && cur.id !== S.pin) S.pin = ''; // the pinned session is gone: follow the latest one instead of staying silently pinned
|
|
2058
|
+
if (at && at === S.hold && cur.id !== at.id) S.hold = null; if (S.pin && cur.id !== S.pin) S.pin = S.pinProj = ''; // the pinned session is gone: follow the latest one instead of staying silently pinned
|
|
1944
2059
|
if (S.cur && S.cur.id === cur.id && S.cur.proj === cur.proj) return false;
|
|
2060
|
+
const key = cur.proj + '/' + cur.id, was = S.lastKey, moved = !!was && was !== key && !S.locked; if (moved) S.left[was] = Date.now(); // what was said of the session the call leaves is not said again when it comes back to it
|
|
1945
2061
|
if (!(await loadSession(cur.proj, cur.id))) return false;
|
|
2062
|
+
S.lastKey = key; if (moved) { const r = rowOf(cur); toast('↪ ' + (r ? tabName(r) : niceProj(cur.proj))); } paintTabs(); sessPoll();
|
|
1946
2063
|
const start = liveStart(); if (!S.locked && !S.userPaused) run(start); return true;
|
|
1947
2064
|
}
|
|
1948
2065
|
// Live: a call starts when you join it. Only what happened since then, and was not said yet, is said (the last 16 events at most, when a session is picked up on the way);
|
|
@@ -1953,13 +2070,13 @@ function midWork() { // someone is in the middle of something: the session doe
|
|
|
1953
2070
|
}
|
|
1954
2071
|
function liveStart() {
|
|
1955
2072
|
const n = S.events.length; if (!S.locked && !S.since) S.since = Date.now() - (midWork() ? JOIN_BACK_MS : 0); // S.since 0: joining now
|
|
1956
|
-
const since = S.locked ? Date.now() : S.since; let i = n; while (i > Math.max(0, n - 16) && S.events[i - 1].ts > since) i--;
|
|
2073
|
+
const since = S.locked ? Date.now() : Math.max(S.since, (S.cur && S.left[S.cur.proj + '/' + S.cur.id]) || 0); let i = n; while (i > Math.max(0, n - 16) && S.events[i - 1].ts > since) i--;
|
|
1957
2074
|
recomputeStatus(i); S.idx = S.pos = i; S.from = since; trNew(Math.max(0, n - 16)); paintStatus(); return i;
|
|
1958
2075
|
}
|
|
1959
2076
|
function amend(e, was) { // the server corrected an event the call already has: another tool call in the same message, a last line that turns out to be a report, the mark that closes the lead's turn
|
|
1960
2077
|
const i = S.events.indexOf(e), row = $(`#log .row[data-i="${i}"]`); if (row) row.outerHTML = logRow(i);
|
|
1961
2078
|
if (e.end) S.sawEnd = true; if (S.locked || S.recomputing || !S.live) return; const past = i < S.pos; // at the door everything is worked out again on Join
|
|
1962
|
-
if (e.kind === 'tools') { const done = e._n != null ? e._n : past ? was.n : null; if (done != null && e.tools.length > done) { const more = { ...e, tools: e.tools.slice(done) }; e._n = e.tools.length; applyStatus(more); tickTools(more); } }
|
|
2079
|
+
if (e.kind === 'tools') { const done = e._n != null ? e._n : past ? was.n : null; if (done != null && e.tools.length > done) { const more = { ...e, tools: e.tools.slice(done) }; e._n = e.tools.length; applyStatus(more); tickTools(more); noteFiles(more); } }
|
|
1963
2080
|
if (e.kind === 'report' && was.kind === 'say' && (e._as === 'say' || past)) { // it was read as an ordinary line: the report still counts (the agent is done, a ding, perhaps a word of thanks), without reading it again
|
|
1964
2081
|
applyStatus(e); AUD.ding(); fly(e.agent, e.to, '✅'); popTile(e.agent); if (e._as === 'say') { e._as = 'report'; S.late.push(e); }
|
|
1965
2082
|
}
|
|
@@ -1973,7 +2090,7 @@ setInterval(async () => {
|
|
|
1973
2090
|
if (switched || !S.cur) return;
|
|
1974
2091
|
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();
|
|
1975
2092
|
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
|
|
1976
|
-
S.seq = d.seq; if (!d.events || !d.events.length) return;
|
|
2093
|
+
S.seq = d.seq; if (d.marks) S.sawEnd = true; if (!d.events || !d.events.length) return;
|
|
1977
2094
|
for (const a of d.agents) if (!S.agents[a.id]) { S.agents[a.id] = persona(a); addTile(S.agents[a.id]); }
|
|
1978
2095
|
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
|
|
1979
2096
|
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); } }
|
|
@@ -1988,7 +2105,8 @@ setInterval(async () => {
|
|
|
1988
2105
|
|
|
1989
2106
|
window.addEventListener('message', (e) => { // the VS Code status bar asks to follow a given session
|
|
1990
2107
|
const d = e.data; if (!EMBED || e.source !== window.parent || !d || d.agentStandup !== 'pin' || typeof d.id !== 'string') return;
|
|
1991
|
-
prefs.
|
|
2108
|
+
if (d.tab) { if (prefs.followTab !== false && S.live && !S.demo && typeof d.proj === 'string') tabSession(d.proj, d.id); return; } // the Claude Code tab you went to: the call goes with you (see tabSession, and followTab in extension.js)
|
|
2109
|
+
prefs.proj = typeof d.proj === 'string' ? d.proj : ''; S.pin = d.id; S.pinProj = prefs.proj; S.cur = null; setView('call'); if (S.live) { fillProjects(); followCurrent(); } else setMode('live');
|
|
1992
2110
|
});
|
|
1993
2111
|
// ---------- meeting chrome: participants and a clock ----------
|
|
1994
2112
|
function renderMeet() {
|
|
@@ -2026,7 +2144,7 @@ async function renderBoardView() {
|
|
|
2026
2144
|
}
|
|
2027
2145
|
$('#boardv').onkeydown = (e) => { if ((e.key === 'Enter' || e.key === ' ') && e.target.classList.contains('bcard')) { e.preventDefault(); e.target.click(); } };
|
|
2028
2146
|
async function openSession(proj, id) {
|
|
2029
|
-
prefs.proj = proj; S.pin = id; savePrefs(); setView('call');
|
|
2147
|
+
prefs.proj = proj; S.pin = id; S.pinProj = proj; savePrefs(); setView('call');
|
|
2030
2148
|
if (S.live || S.demo) { if (S.demo) await setMode('live'); S.cur = null; fillProjects(); await followCurrent(); } else await setMode('live');
|
|
2031
2149
|
}
|
|
2032
2150
|
$('#boardv').onclick = (e) => { const c = e.target.closest('.bcard'); if (c) openSession(c.dataset.p, c.dataset.i); };
|
|
@@ -2049,6 +2167,76 @@ async function openSwitcher() {
|
|
|
2049
2167
|
}
|
|
2050
2168
|
function closeSwitcher() { const sw = $('#switcher'); if (sw) sw.remove(); }
|
|
2051
2169
|
setInterval(() => { if (!document.hidden) renderBoardView(); }, 2500);
|
|
2170
|
+
// ---------- several sessions at once (live): the sessions of the moment as tabs under the header, and a visitor when another one needs you ----------
|
|
2171
|
+
// The row is there only when there is something to tell apart: a second session at work or waiting for you, or a call you pinned. With a single session the header is as it always was.
|
|
2172
|
+
// The tabs keep the order in which the sessions showed up, so the one the call is in stays where it was. A click on another tab takes the call there and keeps it there (📌);
|
|
2173
|
+
// a click on the call's own tab pins it, or lets the call follow the latest activity again. In VS Code the call also goes to the Claude Code tab you are on, without being pinned there (⚙, see tabSession, and followTab in extension.js).
|
|
2174
|
+
S.rows = []; S.tabOrder = []; S.knockAt = {}; S.left = {}; S.visit = S.knock = null; S.hold = null;
|
|
2175
|
+
const UNTITLED = /^[0-9a-f]{8}-[0-9a-f-]{27}$/, sessKey = (r) => r.proj + '/' + r.id, tabName = (r) => (r.title && !UNTITLED.test(r.title) ? r.title : r.title ? L('Session sans titre', 'Untitled session') : niceProj(r.proj) || L('Session sans titre', 'Untitled session'));
|
|
2176
|
+
const inWatch = (r) => { const k = Q.get('proj') || prefs.proj || ''; return !k || [r.proj, r.dir || ''].some((d) => d === k || d.startsWith(k + '-')); }; // the folder the live view follows, when it follows one
|
|
2177
|
+
const rowOf = (c) => (c && S.rows.find((r) => r.proj === c.proj && r.id === c.id)) || null;
|
|
2178
|
+
function paintTabs() {
|
|
2179
|
+
const el = $('#tabs'), cur = S.cur; if (!S.live || S.demo) { if (paintTabs.html) el.innerHTML = paintTabs.html = ''; if (S.visit) hideVisit(); return; } if (!cur) return; // between two sessions the tabs stay as they are: the row does not come and go
|
|
2180
|
+
const ck = sessKey(cur), by = new Map(S.rows.filter((r) => sessKey(r) === ck || (r.state !== 'idle' && inWatch(r))).map((r) => [sessKey(r), r])); if (!by.has(ck)) by.set(ck, { proj: cur.proj, id: cur.id, title: '', state: '' }); // the call's own session always has its tab, also before the list knows it
|
|
2181
|
+
S.tabOrder = S.tabOrder.filter((k) => by.has(k)); for (const k of by.keys()) if (!S.tabOrder.includes(k)) S.tabOrder.push(k);
|
|
2182
|
+
const ks = S.tabOrder.slice(0, 8); if (!ks.includes(ck)) ks[ks.length - 1] = ck; // the others are in ⋯
|
|
2183
|
+
const html = by.size < 2 && !S.pin ? '' : ks.map((k) => { const r = by.get(k), on = k === ck, st = BSTATE[r.state], pinned = on && !!S.pin; // one session and nothing pinned: no row, there is nothing to tell apart
|
|
2184
|
+
const tip = tabName(r) + '\n' + niceProj(r.proj) + (st ? ' · ' + L(st[2], st[1]) : '') + (on ? '\n' + (pinned ? L('Épinglée : cliquez pour suivre la session la plus récente', 'Pinned: click to follow the latest session') : L('Cliquez pour rester dans cette session', 'Click to stay in this session')) : '');
|
|
2185
|
+
return `<button class="stab ${r.state}${on ? ' on' : ''}" role="tab" aria-selected="${on}" data-k="${esc(k)}" title="${esc(tip)}">${st ? st[0] : ''}<span>${esc(tabName(r))}</span>${pinned ? '📌' : ''}</button>`; }).join('')
|
|
2186
|
+
+ `<button class="stab all" title="${esc(L('Aller à une session', 'Go to a session'))} (Cmd / Ctrl + K)" aria-label="${esc(L('Aller à une session', 'Go to a session'))}">⋯</button>`;
|
|
2187
|
+
if (html === paintTabs.html) return; if (!html) paintTabs.cur = ''; el.innerHTML = paintTabs.html = html;
|
|
2188
|
+
if (paintTabs.cur !== ck) { paintTabs.cur = ck; const on = el.querySelector('.on'); if (on) on.scrollIntoView({ block: 'nearest', inline: 'nearest' }); }
|
|
2189
|
+
}
|
|
2190
|
+
function goSession(proj, id) { // the call moves to this session and stays in it
|
|
2191
|
+
S.pin = id; S.pinProj = proj; if (S.cur && S.cur.proj === proj && S.cur.id === id) { paintTabs(); return; }
|
|
2192
|
+
hideVisit(); S.cur = null; followCurrent();
|
|
2193
|
+
}
|
|
2194
|
+
function tabSession(proj, id) { // the Claude Code tab you went to, in VS Code. A tab never pins the call: going to the tab of the session the call is in changes nothing, and a call that is pinned takes its pin along
|
|
2195
|
+
if (S.cur && S.cur.proj === proj && S.cur.id === id) return;
|
|
2196
|
+
if (S.pin) return goSession(proj, id);
|
|
2197
|
+
S.hold = { proj, id, until: Date.now() + 90000 }; hideVisit(); S.cur = null; followCurrent(); // kept here as long as a session that has just written keeps the call (STICK_MS in server.js), then the latest activity is followed again: going to a conversation is not activity, and without this the call would leave at once for a busier session
|
|
2198
|
+
}
|
|
2199
|
+
$('#tabs').onclick = (e) => {
|
|
2200
|
+
const b = e.target.closest('.stab'); if (!b) return; if (b.classList.contains('all')) { openSwitcher(); return; }
|
|
2201
|
+
const [p, i] = b.dataset.k.split('/'); if (!b.classList.contains('on')) { goSession(p, i); return; }
|
|
2202
|
+
if (S.pin) { S.pin = S.pinProj = ''; toast(L('Suit la session la plus récente', 'Following the latest session')); } else { S.pin = i; S.pinProj = p; toast('📌 ' + tabName(rowOf(S.cur) || { proj: p })); }
|
|
2203
|
+
paintTabs();
|
|
2204
|
+
};
|
|
2205
|
+
// The visitor: another session has just stopped for you (a question, an edit that waits for your go-ahead, or its turn is over). Someone from there leans in at the edge of the call and says so,
|
|
2206
|
+
// between two lines and never over one; a click takes the call there. One at a time, a session that needs you before one that is merely done. Off in ⚙; its line exists in English and French, as the other little lines.
|
|
2207
|
+
const VISIT = {
|
|
2208
|
+
en: { ask: [(t) => `Knock knock. They have a question for you in “${t}”.`, (t) => `Sorry to cut in: “${t}” has a question for you.`], ok: [(t) => `Knock knock. “${t}” is waiting for your go-ahead.`, (t) => `Excuse me, you are wanted in “${t}”: it waits for your approval.`], turn: [(t) => `Just passing by: “${t}” is done, it is your turn over there.`, (t) => `News from “${t}”: they are finished and wait for you.`] },
|
|
2209
|
+
fr: { ask: [(t) => `Toc toc. On a une question pour vous dans « ${t} ».`, (t) => `Pardon de vous couper : « ${t} » a une question pour vous.`], ok: [(t) => `Toc toc. « ${t} » attend votre feu vert.`, (t) => `Excusez-moi, on vous demande dans « ${t} » : on y attend votre accord.`], turn: [(t) => `Je ne fais que passer : « ${t} » a fini, c’est à vous là-bas.`, (t) => `Des nouvelles de « ${t} » : ils ont fini et vous attendent.`] },
|
|
2210
|
+
};
|
|
2211
|
+
function knocks() {
|
|
2212
|
+
const now = Date.now(), first = !knocks.seen, seen = knocks.seen || (knocks.seen = {}), ck = S.cur ? sessKey(S.cur) : ''; let best = null;
|
|
2213
|
+
for (const r of S.rows) {
|
|
2214
|
+
const k = sessKey(r), was = seen[k], st = r.state === 'turn' && now - r.mtime < 6000 ? 'working' : r.state; // a session that does not mark the end of its turns: a line less than 6 s old may only be a pause before the next call
|
|
2215
|
+
const kind = first || !was || was === st || k === ck || !inWatch(r) ? '' : st === 'blocked' ? (/^AskUserQuestion/.test(r.tool) ? 'ask' : 'ok') : st === 'turn' && !r.cut && /^(working|waiting|blocked)$/.test(was) ? 'turn' : ''; // cut: you stopped that session yourself (Esc), which is no news
|
|
2216
|
+
if (kind && now - (S.knockAt[k] || 0) < 20000) continue; // a stop less than 20 s after the last visit for that session is not noted yet: it is told when the 20 s are over, if it still holds
|
|
2217
|
+
seen[k] = st; if (kind && (!best || (kind !== 'turn' && best.kind === 'turn'))) best = { r, kind, k };
|
|
2218
|
+
}
|
|
2219
|
+
const v = S.visit, vr = v && S.rows.find((r) => sessKey(r) === v.k); if (v && (!vr || v.k === ck || (v.kind === 'turn' ? !/^(turn|idle)$/.test(vr.state) : vr.state !== 'blocked'))) hideVisit(); // answered there, or the call went there: the visitor leaves
|
|
2220
|
+
if (best && prefs.visits !== false && !S.locked && !(S.visit && S.visit.kind !== 'turn' && best.kind === 'turn')) { S.knockAt[best.k] = now; showVisit(best); }
|
|
2221
|
+
}
|
|
2222
|
+
function showVisit(v) { // the same face and name each time for a given session; with your own characters, one of them
|
|
2223
|
+
const h = hash('visit' + v.k), p = persona0({ id: 'visit:' + v.k, name: NAMES[h % NAMES.length], role: '' }), W = VISIT[FR() ? 'fr' : 'en'][v.kind], t = tabName(v.r), el = $('#visit');
|
|
2224
|
+
p.custom = CHARS.pool.length ? CHARS.pool[h % CHARS.pool.length] : null; v.p = p; v.line = W[(h + (showVisit.n = (showVisit.n || 0) + 1)) % W.length](t.length > 46 ? t.slice(0, 44).replace(/\s+\S*$/, '') + '…' : t);
|
|
2225
|
+
el.className = 'on ' + (v.kind === 'turn' ? 'turn' : 'blocked');
|
|
2226
|
+
el.innerHTML = `<div class="vsay"><button class="vx" aria-label="${esc(L('Fermer', 'Close'))}">✕</button><small>${esc(p.name)} · ${esc(niceProj(v.r.proj))}</small>${esc(v.line)}<br><button class="vgo">${esc(L('Y aller', 'Go there'))} →</button></div><div class="vwho">${avatarSVG(p, undefined, 'v' + p.gid + '_')}</div>`;
|
|
2227
|
+
S.visit = S.knock = v; AUD.knock(); clearTimeout(showVisit.t); showVisit.t = setTimeout(() => { if (S.visit === v) hideVisit(); }, v.kind === 'turn' ? 16000 : 45000); // the tab of that session keeps its state after the visitor has left
|
|
2228
|
+
}
|
|
2229
|
+
function hideVisit() { clearTimeout(showVisit.t); S.visit = S.knock = null; const el = $('#visit'); if (el.className) { el.className = ''; el.innerHTML = ''; } }
|
|
2230
|
+
async function visitSay(v, token) {
|
|
2231
|
+
if (S.visit !== v || AUD.off() || !prefs.voice) return; const el = $('#visit'); el.classList.add('speaking'); AUD.duck(true);
|
|
2232
|
+
await speakLine(v.line, v.p, true, token); el.classList.remove('speaking'); if (!S.speakers.size) AUD.duck(false);
|
|
2233
|
+
}
|
|
2234
|
+
$('#visit').onclick = (e) => { const v = S.visit; if (!v) return; if (e.target.closest('.vx')) hideVisit(); else goSession(v.r.proj, v.r.id); };
|
|
2235
|
+
async function sessPoll() {
|
|
2236
|
+
if (!S.live || S.demo || document.hidden || sessPoll.busy) return; sessPoll.busy = true;
|
|
2237
|
+
try { const rows = await (await fetch('/api/board')).json(); if (Array.isArray(rows) && S.live && !S.demo) { S.rows = rows; knocks(); paintTabs(); } } catch {} finally { sessPoll.busy = false; }
|
|
2238
|
+
}
|
|
2239
|
+
setInterval(sessPoll, 3000);
|
|
2052
2240
|
async function setMode(m) {
|
|
2053
2241
|
if (m === 'demo') { // a built-in fictional session: nothing to install, nothing private on screen
|
|
2054
2242
|
pause(); S.live = false; S.demo = true; S.userPaused = false; S.cur = null; $('#empty').classList.remove('on');
|
|
@@ -2207,7 +2395,7 @@ function menuInit() {
|
|
|
2207
2395
|
$('#menuNone').style.display = q && !secs.some((sc) => sc.items.some((e) => !e.classList.contains('mhide'))) ? '' : 'none';
|
|
2208
2396
|
};
|
|
2209
2397
|
}
|
|
2210
|
-
$('#menu').onclick = (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 === 'office') $('#officeBox').style.display = prefs.office ? '' : 'none'; if (b.dataset.t === 'customLaptop') { for (const k in imgCache) delete imgCache[k]; buildStage(); paintStatus(); } if (b.dataset.t === 'ownNames') renameAll(); if (b.dataset.t === 'reactions') document.body.classList.toggle('react', prefs.reactions); 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(); }
|
|
2398
|
+
$('#menu').onclick = (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 === 'office') $('#officeBox').style.display = prefs.office ? '' : 'none'; 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 === 'ownNames') renameAll(); if (b.dataset.t === 'reactions') document.body.classList.toggle('react', prefs.reactions); 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(); }
|
|
2211
2399
|
if (b.dataset.t === 'music') { $('#musicBox').style.display = prefs.music ? '' : 'none'; if (prefs.music) { AUD.init(); AUD.apply(); } } };
|
|
2212
2400
|
$('#station').innerHTML = STATIONS.map((s) => `<option value="${s.id}">📻 ${s.name}</option>`).join('');
|
|
2213
2401
|
$('#station').value = prefs.station; $('#musicVol').value = prefs.musicVol; $('#musicBox').style.display = prefs.music ? '' : 'none';
|
|
@@ -2217,14 +2405,14 @@ $('#vstyle').innerHTML = [['animal', 'Animal Crossing (babillage)', 'Animal Cros
|
|
|
2217
2405
|
// ---- ⚙ → very natural voices (Kokoro): install box and status, polled while installing
|
|
2218
2406
|
let kokoroTimer = null;
|
|
2219
2407
|
async function kokoroUI() {
|
|
2220
|
-
const box = $('#kokoroBox'), on = prefs.vstyle === 'kokoro'; box.style.display = on ? '' : 'none'; if (!on) { clearInterval(kokoroTimer); kokoroTimer = null; return; }
|
|
2408
|
+
const box = $('#kokoroBox'), on = prefs.vstyle === 'kokoro'; box.style.display = on ? '' : 'none'; $('#vstyleTip').style.display = on ? 'none' : ''; if (!on) { clearInterval(kokoroTimer); kokoroTimer = null; return; }
|
|
2221
2409
|
let st; try { st = await (await fetch('/api/kokoro')).json(); } catch { return; }
|
|
2222
2410
|
const b = $('#kokoroInstall'), h = $('#kokoroHint'); b.style.display = st.installed ? 'none' : '';
|
|
2223
2411
|
b.disabled = st.installing || !st.npm; b.textContent = st.installing ? L('Installation…', 'Installing…') : L(`Installer (${st.sizeMb} Mo)`, `Install (${st.sizeMb} MB)`);
|
|
2224
2412
|
h.textContent = st.installing ? L('Téléchargement en cours, vous pouvez continuer : les voix du système servent en attendant.', 'Downloading, you can carry on: system voices are used meanwhile.')
|
|
2225
2413
|
: st.error ? st.error : !st.npm && !st.installed ? L('npm est introuvable : installez Node.js pour activer cette option.', 'npm not found: install Node.js to enable this option.')
|
|
2226
|
-
: st.installed ? (st.gaveUp ? L('Le moteur s’est arrêté : les voix du système servent à la place.', 'The engine stopped: system voices are used instead.') : st.ready ? L('Voix prêtes.', 'Voices ready.')
|
|
2227
|
-
: L('Voix locales de bonne qualité, en anglais
|
|
2414
|
+
: st.installed ? (st.gaveUp ? L('Le moteur s’est arrêté : les voix du système servent à la place.', 'The engine stopped: system voices are used instead.') : st.ready ? L('Voix prêtes.', 'Voices ready.') : L('Chargement du modèle (téléchargé au premier usage, environ 305 Mo)…', 'Loading the model (downloaded on first use, about 305 MB)…'))
|
|
2415
|
+
: L('Voix locales de bonne qualité, en anglais. Gratuit, rien n’est envoyé nulle part.', 'Good-quality local voices, in English. Free, nothing leaves your machine.');
|
|
2228
2416
|
if ((st.installing || (st.installed && !st.ready && !st.gaveUp)) && !kokoroTimer) kokoroTimer = setInterval(async () => { await kokoroUI(); }, 2500);
|
|
2229
2417
|
if (!st.installing && (st.ready || st.gaveUp || !st.installed) && kokoroTimer) { clearInterval(kokoroTimer); kokoroTimer = null; if (st.ready && TTS.engine !== 'kokoro') TTS.init(); }
|
|
2230
2418
|
}
|
|
@@ -2359,7 +2547,7 @@ addEventListener('keydown', (e) => {
|
|
|
2359
2547
|
if (e.key === '?') { openKeys(); return; }
|
|
2360
2548
|
if (e.key === ' ') { if (e.target.closest && e.target.closest('button, .tile, .rr, .bcard, a, [role=button]')) return; e.preventDefault(); togglePlay(); } else if (e.key.toLowerCase() === 'm') toggleMute(); else if (e.key.toLowerCase() === 't') { const toTree = !document.body.classList.contains('tree'); setView(toTree ? 'tree' : 'call'); if (toTree) toast(L('Vue arbre : T pour revenir, ? pour l’aide', 'Tree view: T to go back, ? for help')); } else if (e.key.toLowerCase() === 'r') openRecap(); else if (e.key.toLowerCase() === 'l') $('#bLog').click(); else if (e.key === 'ArrowRight' && !S.live) { e.preventDefault(); stepEvent(1); } else if (e.key === 'ArrowLeft' && !S.live) { e.preventDefault(); stepEvent(-1); } else if (e.key.toLowerCase() === 'n') stepHighlight(e.shiftKey ? -1 : 1); else if (e.key.toLowerCase() === 'j') jumpAttn(1); else if (e.key.toLowerCase() === 'k') jumpAttn(-1); else if (e.key === 'Escape') { $('#recap').classList.remove('on'); $('#menu').classList.remove('on'); }
|
|
2361
2549
|
});
|
|
2362
|
-
if (EMBED) $('#mBrowser').style.display = '';
|
|
2550
|
+
if (EMBED) $('#mBrowser').style.display = $('#mFollowTab').style.display = '';
|
|
2363
2551
|
|
|
2364
2552
|
(async function init() {
|
|
2365
2553
|
if (!LANGS.some((l) => l[0] === prefs.lang)) prefs.lang = 'en'; await loadLocale(prefs.lang); await loadChars();
|