@ngockhoale/ckit 0.3.0 → 0.4.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/README.md +14 -2
- package/dist/src/gui/server.d.ts +3 -1
- package/dist/src/gui/server.js +41 -15
- package/dist/src/team/bus.d.ts +60 -0
- package/dist/src/team/bus.js +172 -0
- package/dist/src/team/config.js +5 -4
- package/dist/src/team/engine.d.ts +33 -1
- package/dist/src/team/engine.js +1095 -170
- package/dist/src/team/mcp/hub.d.ts +16 -0
- package/dist/src/team/mcp/hub.js +99 -0
- package/dist/src/team/mcp/stdio-server.d.ts +2 -0
- package/dist/src/team/mcp/stdio-server.js +103 -0
- package/dist/src/team/runners.d.ts +4 -0
- package/dist/src/team/runners.js +8 -2
- package/dist/src/team/scheduler.d.ts +20 -0
- package/dist/src/team/scheduler.js +73 -0
- package/dist/src/team/sessions/claude.d.ts +16 -5
- package/dist/src/team/sessions/claude.js +127 -13
- package/dist/src/team/sessions/codex.d.ts +3 -2
- package/dist/src/team/sessions/codex.js +21 -3
- package/dist/src/team/sessions/fallback.js +6 -2
- package/dist/src/team/sessions/index.d.ts +1 -1
- package/dist/src/team/sessions/index.js +3 -3
- package/dist/src/team/sessions/omp.d.ts +12 -3
- package/dist/src/team/sessions/omp.js +95 -8
- package/dist/src/team/sessions/proc.d.ts +20 -2
- package/dist/src/team/sessions/proc.js +64 -18
- package/dist/src/team/sessions/types.d.ts +23 -2
- package/dist/src/team/telemetry.d.ts +32 -0
- package/dist/src/team/telemetry.js +135 -0
- package/dist/src/team/types.d.ts +173 -1
- package/dist/src/tui/team/model.js +10 -0
- package/gui/app.css +23 -0
- package/gui/app.js +208 -6
- package/gui/comic/comic.css +86 -0
- package/gui/comic/engine.js +44 -0
- package/gui/comic/render.js +73 -16
- package/gui/index.html +1 -1
- package/package.json +1 -1
package/gui/app.js
CHANGED
|
@@ -98,7 +98,7 @@
|
|
|
98
98
|
S.events = []; S.atts = []; S.fails = []; S.msgs = 0; S.tokens = 0; S.stageIdx = -1; S.stageKey = ''; S.loop = 1; S.stageTimes = {}; S.started = 0; S.ended = 0; S.outcome = null; S.handoffs = []; S.flowBacks = []; S.verdicts = []; S.buckets = []; S.tokBuckets = []; S.lastStageAt = 0; S.narr = '';
|
|
99
99
|
$('feed').innerHTML = ''; comicCall('reset'); $('bubbles').innerHTML = ''; S.bubbles = {}; S.lastPanelSub = {};
|
|
100
100
|
$('overlay').hidden = true; $('hobanner').classList.remove('on');
|
|
101
|
-
S.lane = null; S.laneBy = ''; S.waiting = null; net.setActiveTeams(null);
|
|
101
|
+
S.lane = null; S.laneBy = ''; S.waiting = null; net.setActiveTeams(null); xReset();
|
|
102
102
|
if (S.config) { setupAgents(S.config); comicCtx(S.config); }
|
|
103
103
|
net.reset(); setNarr('Waiting for a mission…'); S.dirty = true;
|
|
104
104
|
}
|
|
@@ -248,12 +248,14 @@
|
|
|
248
248
|
function runBase() { return '/api/runs/' + encodeURIComponent((S.run && S.run.runId) || 'current'); }
|
|
249
249
|
function onEvent(e) {
|
|
250
250
|
if (S.run && S.run.runId && e.runId && e.runId !== S.run.runId) return; /* another run's event: not for this view */
|
|
251
|
+
xEvent(e);
|
|
251
252
|
if (e.type === 'run.started') comicCtx(e.config);
|
|
252
253
|
if (e.type === 'agent.delta') { /* live typing preview: per-agent buffer only, never stored in the event list */
|
|
253
254
|
var da = e.agentId ? A(e.agentId) : null;
|
|
254
255
|
if (da && typeof e.text === 'string') { da.live = ((da.live || '') + e.text).slice(-2000); S.dirty = true; }
|
|
255
256
|
return;
|
|
256
257
|
}
|
|
258
|
+
if (e.type === 'agent.tool') return; /* live-only execution stream: shown in Agent Lanes / Live Feed, not in the event list */
|
|
257
259
|
comicCall('push', e);
|
|
258
260
|
S.events.push(e); S.dirty = true;
|
|
259
261
|
if (e.type !== 'agent.message') termLine(e.at, e.type + (e.agentId ? ' ' + e.agentId : '') + (e.stage ? ' ' + e.stage : '') + (e.from ? ' ' + e.from + '→' + e.to : '') + (e.verdict ? ' ' + e.verdict : '') + (e.label ? ' · ' + e.label : e.text && e.type !== 'user.message' ? ' · ' + plain(String(e.text)).slice(0, 120) : ''));
|
|
@@ -595,7 +597,7 @@
|
|
|
595
597
|
return h('div', {class: 'trw' + (na ? ' na' : '')}, [h('span', {class: 'ml', text: label}), frac != null ? h('span', {class: 'tbar'}, [h('b', {style: 'width:' + Math.round(frac * 100) + '%'})]) : h('span', {class: 'tbar empty'}), h('span', {class: 'mono tv', title: na ? 'No data source for this metric' : '', text: value})]);
|
|
596
598
|
}
|
|
597
599
|
function renderInspector() {
|
|
598
|
-
var r = $('
|
|
600
|
+
var r = $('ipane'), keep = $('inspector').scrollTop, frag = document.createDocumentFragment();
|
|
599
601
|
var a = S.selected && A(S.selected);
|
|
600
602
|
if (a) {
|
|
601
603
|
var c = TC[a.cfg.team] || '#8A9AAF';
|
|
@@ -637,7 +639,7 @@
|
|
|
637
639
|
act.forEach(function (x) { var col = tcol(x.id); ab.appendChild(h('div', {class: 'arow', title: x.t}, [h('i', {style: 'background:' + (x.k === 'agent.failed' ? '#F05668' : col)}), h('span', {class: 'mono tm', text: clock(x.at)}), h('b', {style: 'color:' + col, text: nm(x.id)}), h('span', {class: 'at', text: x.t})])); });
|
|
638
640
|
if (!act.length) ab.appendChild(h('div', {class: 'iempty', text: 'Nothing has happened yet.'}));
|
|
639
641
|
frag.appendChild(ab);
|
|
640
|
-
r.innerHTML = ''; r.appendChild(frag);
|
|
642
|
+
r.innerHTML = ''; r.appendChild(frag); $('inspector').scrollTop = keep;
|
|
641
643
|
}
|
|
642
644
|
function renderStrip() {
|
|
643
645
|
var st = $('stages'); st.innerHTML = '';
|
|
@@ -661,7 +663,7 @@
|
|
|
661
663
|
mt.textContent = live ? (S.waiting ? 'WAITING' : S.replay ? 'REPLAY' : 'RUNNING') : S.outcome ? String(S.outcome).toUpperCase() : 'READY';
|
|
662
664
|
mt.className = 'mtag ' + (live ? (S.waiting ? 'wait' : 'run') : S.outcome === 'delivered' ? 'ok' : S.outcome ? 'bad' : '');
|
|
663
665
|
if (mg.textContent !== mtxt) { mg.textContent = mtxt; mg.title = mtxt; }
|
|
664
|
-
$('bHint').hidden = !!live;
|
|
666
|
+
$('bHint').hidden = !!live; xCtl(live);
|
|
665
667
|
net.setHubStats(S.run || S.msgs ? ['⏱ ' + $('elapsed').textContent, String(S.msgs) + ' MSG', fmtN(S.tokens) + ' TOK'] : []);
|
|
666
668
|
renderTabs(); flushTerm();
|
|
667
669
|
/* composer: talks to the Director during a run, starts a mission when nothing is running */
|
|
@@ -689,10 +691,210 @@
|
|
|
689
691
|
var lastRender = 0;
|
|
690
692
|
function loop(now) {
|
|
691
693
|
tickBubbles(now);
|
|
692
|
-
if (now - lastRender > 400 || S.dirty) { lastRender = now; S.dirty = false; if (S.view === 'live') { renderRoster(); renderInspector(); renderStrip(); } renderTop(); }
|
|
694
|
+
if (now - lastRender > 400 || S.dirty) { lastRender = now; S.dirty = false; if (S.view === 'live') { renderRoster(); if (xTab === 'inspect') renderInspector(); renderStrip(); } renderTop(); }
|
|
695
|
+
if (S.view === 'live') xFrame(now);
|
|
693
696
|
requestAnimationFrame(loop);
|
|
694
697
|
}
|
|
695
698
|
|
|
699
|
+
|
|
700
|
+
/* ===== Run controls, Live Feed, Agent Lanes, Decision Board, Task Graph, telemetry strip =====
|
|
701
|
+
All text from agents / owner goes in through textContent (h() helper) only. State is per selected run and rebuilt from that run's stream. */
|
|
702
|
+
var XT = [['inspect', 'Inspector'], ['feed', 'Live Feed'], ['lanes', 'Agent Lanes'], ['board', 'Decision Board'], ['tasks', 'Task Graph']];
|
|
703
|
+
var xTab = 'inspect', X = null, xLast = 0, xDirty = true, xFeedF = {agent: '', team: '', type: ''}, xTele = null;
|
|
704
|
+
var FEED_MAX = 500, FEED_TYPES = [['', 'All types'], ['message', 'Messages'], ['mail', 'Mail'], ['contribution', 'Contributions'], ['decision', 'Decisions'], ['task', 'Tasks'], ['tool', 'Tools'], ['wait', 'Waits'], ['control', 'Pause / resume'], ['flow', 'Flow / verdicts'], ['loop', 'Loops / mode']];
|
|
705
|
+
function xReset() { X = {feed: [], pend: [], lanes: {}, contribs: {}, decisions: {}, tasks: {}, taskOrder: [], skipped: [], paused: false, feedBuilt: -1}; xDirty = true; }
|
|
706
|
+
xReset();
|
|
707
|
+
function xClip(t, n) { t = String(t == null ? '' : t).replace(/\s+/g, ' ').trim(); return t.length > n ? t.slice(0, n - 1) + '…' : t; }
|
|
708
|
+
function xLane(id) { return X.lanes[id] || (X.lanes[id] = {wait: '', detail: '', tool: '', live: '', fin: false, turns: 0, tokens: 0, act: '', at: ''}); }
|
|
709
|
+
var SEV_RANK = {critical: 0, high: 1, medium: 2, low: 3, info: 4};
|
|
710
|
+
function topSev(fs) { var b = ''; (fs || []).forEach(function (f) { if (SEV_RANK[f.severity] != null && (b === '' || SEV_RANK[f.severity] < SEV_RANK[b])) b = f.severity; }); return b; }
|
|
711
|
+
function xRow(e, type, agentId, text, team0) {
|
|
712
|
+
var team = team0 || (agentId && A(agentId) ? A(agentId).cfg.team : '');
|
|
713
|
+
X.feed.push({at: e.at, agent: agentId || '', team: team, type: type, text: xClip(text, 220), kind: e.type});
|
|
714
|
+
if (X.feed.length > FEED_MAX) X.feed.splice(0, X.feed.length - FEED_MAX);
|
|
715
|
+
X.pend.push(X.feed[X.feed.length - 1]);
|
|
716
|
+
}
|
|
717
|
+
function xEvent(e) {
|
|
718
|
+
var id = e.agentId, L;
|
|
719
|
+
switch (e.type) {
|
|
720
|
+
case 'agent.started': L = xLane(id); L.turns++; L.live = ''; L.fin = false; L.tool = ''; L.wait = 'starting'; L.detail = ''; L.act = String(e.task || ''); L.at = e.at; break;
|
|
721
|
+
case 'agent.activity': case 'agent.step': L = xLane(id); L.act = String(e.type === 'agent.step' ? e.label || '' : e.text || ''); L.at = e.at; xDirty = true; return;
|
|
722
|
+
case 'agent.delta': L = xLane(id); if (L.fin) { L.live = ''; L.fin = false; } L.live = (L.live + String(e.text || '')).slice(-1500); xDirty = true; return;
|
|
723
|
+
case 'agent.tool': L = xLane(id); L.tool = e.phase === 'call' ? e.name : ''; xRow(e, 'tool', id, (e.phase === 'call' ? '▶ ' : '◀ ') + e.name + (e.text ? ': ' + e.text : '')); break;
|
|
724
|
+
case 'agent.wait': L = xLane(id); L.wait = e.reason; L.detail = e.detail || ''; xRow(e, 'wait', id, 'waiting: ' + e.reason + (e.detail ? ' · ' + e.detail : '')); break;
|
|
725
|
+
case 'agent.message': L = xLane(id); L.live = String(e.text || '').slice(0, 1500); L.fin = true; L.tool = ''; L.wait = 'idle'; L.detail = ''; L.tokens += e.tokens || 0; xRow(e, 'message', id, '→ ' + nm(e.to) + ': ' + plain(String(e.text || ''))); break;
|
|
726
|
+
case 'agent.failed': L = xLane(id); L.tool = ''; L.wait = ''; L.live = ''; xRow(e, 'message', id, 'failed: ' + plain(String(e.reason || ''))); break;
|
|
727
|
+
case 'agent.mail': xRow(e, 'mail', e.from, '✉ ' + nm(e.from) + ' → ' + nm(e.to) + (e.kind && e.kind !== 'mail' ? ' (' + e.kind + ')' : '') + ': ' + (e.subject ? e.subject + ' — ' : '') + plain(String(e.text || ''))); break;
|
|
728
|
+
case 'contribution.published': {
|
|
729
|
+
var c = e.contribution || {}, fs = c.findings || [], ts = topSev(fs);
|
|
730
|
+
X.contribs[c.contributionId] = c;
|
|
731
|
+
xRow(e, 'contribution', c.agentId, fs.length + ' finding' + (fs.length === 1 ? '' : 's') + (ts ? ' · top ' + ts : '') + ' · ' + c.status); break;
|
|
732
|
+
}
|
|
733
|
+
case 'decision.recorded': {
|
|
734
|
+
var d = e.decision || {}, old = X.decisions[d.id];
|
|
735
|
+
if (!old || (d.revision || 0) >= (old.revision || 0)) X.decisions[d.id] = d;
|
|
736
|
+
xRow(e, 'decision', S.config ? S.config.director.id : '', (d.title || d.id) + ' · ' + d.status + (d.revision > 1 ? ' (rev ' + d.revision + ')' : '')); break;
|
|
737
|
+
}
|
|
738
|
+
case 'task.created':
|
|
739
|
+
if (!X.tasks[e.taskId]) X.taskOrder.push(e.taskId);
|
|
740
|
+
X.tasks[e.taskId] = {id: e.taskId, team: e.team, title: e.title, deps: (e.deps || []).slice(), status: 'pending', note: ''};
|
|
741
|
+
xRow(e, 'task', '', 'task ' + e.taskId + ' (' + teamLbl(e.team) + '): ' + e.title + (e.deps && e.deps.length ? ' · after ' + e.deps.join(', ') : '')); break;
|
|
742
|
+
case 'task.updated':
|
|
743
|
+
if (X.tasks[e.taskId]) { X.tasks[e.taskId].status = e.status; X.tasks[e.taskId].note = e.note || ''; }
|
|
744
|
+
xRow(e, 'task', '', 'task ' + e.taskId + ' → ' + e.status + (e.note ? ': ' + e.note : '')); break;
|
|
745
|
+
case 'loop.detected': xRow(e, 'loop', '', 'loop guard (' + e.kind + ') ' + nm(e.from) + ': ' + e.reason); break;
|
|
746
|
+
case 'mode.chosen': xRow(e, 'loop', '', 'mode ' + e.mode + ': ' + e.reason); break;
|
|
747
|
+
case 'team.skipped': X.skipped.push({team: e.team, reason: String(e.reason || '')}); xRow(e, 'flow', '', 'team ' + teamLbl(e.team) + ' skipped: ' + e.reason, e.team); break;
|
|
748
|
+
case 'run.paused': X.paused = true; xRow(e, 'control', '', 'run paused' + (e.by === 'interrupt' ? ' (interrupt)' : '')); break;
|
|
749
|
+
case 'run.resumed': X.paused = false; xRow(e, 'control', '', 'run resumed'); break;
|
|
750
|
+
case 'agent.interrupted': xLane(id).tool = ''; xRow(e, 'control', id, 'turn interrupted'); break;
|
|
751
|
+
case 'flow.back': xRow(e, 'flow', '', (e.kind === 'ask' ? 'ask ' : 'return ') + teamLbl(e.from) + ' → ' + teamLbl(e.to) + ': ' + e.reason); break;
|
|
752
|
+
case 'qc.verdict': case 'review.verdict': xRow(e, 'flow', '', (e.type === 'qc.verdict' ? 'QC ' : 'review ') + e.verdict + ': ' + e.summary); break;
|
|
753
|
+
case 'run.completed': X.paused = false; Object.keys(X.lanes).forEach(function (k) { X.lanes[k].tool = ''; X.lanes[k].wait = ''; }); break;
|
|
754
|
+
default: return;
|
|
755
|
+
}
|
|
756
|
+
xDirty = true;
|
|
757
|
+
}
|
|
758
|
+
function xCtl(live) {
|
|
759
|
+
var box = $('rctl'), id = S.run && S.run.runId, on = !!(live && !S.replay && id && S.run.goal !== '(replay)');
|
|
760
|
+
box.hidden = !on; if (!on) return;
|
|
761
|
+
var paused = X.paused, sig = String(paused);
|
|
762
|
+
if (box.dataset.sig === sig) return; box.dataset.sig = sig; box.innerHTML = '';
|
|
763
|
+
var call = function (what) { var rid = S.run && S.run.runId; if (!rid) return; api('POST', '/api/runs/' + encodeURIComponent(rid) + '/' + what).then(function (r) { if (r.status !== 200) toast((r.body && r.body.error) || ('could not ' + what)); }); };
|
|
764
|
+
box.appendChild(paused ? h('button', {type: 'button', class: 'chip', text: '▶ Resume', title: 'Let agents start new turns again', onclick: function () { call('resume'); }}) : h('button', {type: 'button', class: 'chip', text: '⏸ Pause', title: 'No new agent turn starts; running turns finish', onclick: function () { call('pause'); }}));
|
|
765
|
+
box.appendChild(h('button', {type: 'button', class: 'chip', text: '⚡ Interrupt', title: 'Cancel running turns now and pause; they are redone after Resume', onclick: function () { call('interrupt'); }}));
|
|
766
|
+
box.appendChild(h('button', {type: 'button', class: 'chip dng', text: '■ Stop', title: 'Stop this run', onclick: function () { call('stop'); }}));
|
|
767
|
+
}
|
|
768
|
+
/* inspector tabs */
|
|
769
|
+
(function () {
|
|
770
|
+
var ins = $('inspector'), tabs = h('div', {id: 'itabs', role: 'tablist'}), tele = h('div', {id: 'xtele'}), ip = h('div', {id: 'ipane'}), xp = h('div', {id: 'xpane', hidden: true});
|
|
771
|
+
XT.forEach(function (t) { tabs.appendChild(h('button', {type: 'button', role: 'tab', 'data-t': t[0], class: 'itab' + (t[0] === xTab ? ' on' : ''), text: t[1], onclick: function () { xSetTab(t[0]); }})); });
|
|
772
|
+
ins.appendChild(tabs); ins.appendChild(tele); ins.appendChild(ip); ins.appendChild(xp);
|
|
773
|
+
})();
|
|
774
|
+
function xSetTab(t) {
|
|
775
|
+
xTab = t; xDirty = true; X.feedBuilt = -1;
|
|
776
|
+
Array.prototype.forEach.call($('itabs').children, function (b) { var on = b.getAttribute('data-t') === t; b.classList.toggle('on', on); b.setAttribute('aria-selected', String(on)); });
|
|
777
|
+
$('ipane').hidden = t !== 'inspect'; $('xpane').hidden = t === 'inspect'; $('xpane').innerHTML = ''; $('xpane').dataset.built = '';
|
|
778
|
+
if (t === 'inspect') renderInspector();
|
|
779
|
+
}
|
|
780
|
+
function xTeleStrip() {
|
|
781
|
+
var el = $('xtele'), t = xTele;
|
|
782
|
+
if (!t || !S.run) { el.hidden = true; return; }
|
|
783
|
+
el.hidden = false; el.innerHTML = '';
|
|
784
|
+
[['turns', t.turns], ['model calls', t.modelCalls], ['director', t.directorTurns], ['tokens', fmtN(t.tokens || 0)], ['wall', fmtT(t.wallMs || 0)], ['max ∥', t.maxParallelAgents], ['mode', t.mode || '—']].forEach(function (kv2) {
|
|
785
|
+
el.appendChild(h('span', {class: 'xt', title: kv2[0]}, [h('em', {text: kv2[0]}), h('b', {class: 'mono', text: String(kv2[1])})]));
|
|
786
|
+
});
|
|
787
|
+
if (t.paused) el.appendChild(h('span', {class: 'xt pz', text: 'PAUSED'}));
|
|
788
|
+
}
|
|
789
|
+
function xPoll() {
|
|
790
|
+
var id = S.run && S.run.runId; if (!id || S.view !== 'live' || document.hidden) return;
|
|
791
|
+
api('GET', '/api/state').then(function (r) {
|
|
792
|
+
if (r.status !== 200 || !S.run || S.run.runId !== id) return;
|
|
793
|
+
var me = (r.body.runs || []).filter(function (x) { return x.runId === id; })[0];
|
|
794
|
+
xTele = me && me.telemetry || null; xDirty = true;
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
setInterval(xPoll, 2000);
|
|
798
|
+
function feedMatch(f) { return (!xFeedF.agent || f.agent === xFeedF.agent) && (!xFeedF.team || f.team === xFeedF.team) && (!xFeedF.type || f.type === xFeedF.type); }
|
|
799
|
+
function feedEl(f) {
|
|
800
|
+
var col = f.agent ? tcol(f.agent) : '#8A9AAF';
|
|
801
|
+
return h('div', {class: 'xr xr-' + f.type, style: '--tc:' + col}, [h('span', {class: 'mono tm', text: clock(f.at)}), h('b', {text: f.agent ? nm(f.agent) : 'system'}), f.team ? h('span', {class: 'xteam', text: teamLbl(f.team)}) : null, h('span', {class: 'xty', text: f.kind}), h('span', {class: 'xtx', text: f.text})]);
|
|
802
|
+
}
|
|
803
|
+
function xFeedPane(p) {
|
|
804
|
+
if (!p.dataset.built) {
|
|
805
|
+
p.dataset.built = 'feed'; p.innerHTML = '';
|
|
806
|
+
var ag = h('select', {'aria-label': 'Filter by agent', onchange: function () { xFeedF.agent = this.value; X.feedBuilt = -1; xDirty = true; }}, [h('option', {value: '', text: 'All agents'})].concat(S.order.map(function (id) { return h('option', {value: id, text: nm(id)}); })));
|
|
807
|
+
var teams = []; S.order.forEach(function (id) { var a = A(id), t = a && a.cfg.team; if (t && teams.indexOf(t) < 0) teams.push(t); });
|
|
808
|
+
var tm = h('select', {id: 'xfeed-team', 'aria-label': 'Filter by team', onchange: function () { xFeedF.team = this.value; X.feedBuilt = -1; xDirty = true; }}, [h('option', {value: '', text: 'All teams'})].concat(teams.map(function (t) { return h('option', {value: t, text: teamLbl(t)}); })));
|
|
809
|
+
var ty = h('select', {'aria-label': 'Filter by type', onchange: function () { xFeedF.type = this.value; X.feedBuilt = -1; xDirty = true; }}, FEED_TYPES.map(function (t) { return h('option', {value: t[0], text: t[1]}); }));
|
|
810
|
+
ag.id = 'xfeed-agent'; ty.id = 'xfeed-type';
|
|
811
|
+
ag.value = xFeedF.agent; tm.value = xFeedF.team; ty.value = xFeedF.type;
|
|
812
|
+
p.appendChild(h('div', {class: 'xfilters'}, [ag, tm, ty]));
|
|
813
|
+
p.appendChild(h('div', {id: 'xfeed', class: 'xfeed'}));
|
|
814
|
+
}
|
|
815
|
+
var box = $('xfeed'); if (!box) return;
|
|
816
|
+
var stick = box.scrollHeight - box.scrollTop - box.clientHeight < 40;
|
|
817
|
+
if (X.feedBuilt !== X.feed.length || X.pend.length === 0 && X.feedBuilt < 0) { /* fallthrough below */ }
|
|
818
|
+
if (X.feedBuilt < 0) {
|
|
819
|
+
box.innerHTML = ''; var fr = document.createDocumentFragment(); X.feed.filter(feedMatch).forEach(function (f) { fr.appendChild(feedEl(f)); }); box.appendChild(fr); X.pend = []; X.feedBuilt = 0; stick = true;
|
|
820
|
+
} else if (X.pend.length) {
|
|
821
|
+
var fr2 = document.createDocumentFragment(); X.pend.forEach(function (f) { if (feedMatch(f)) fr2.appendChild(feedEl(f)); }); X.pend = []; box.appendChild(fr2);
|
|
822
|
+
while (box.childElementCount > FEED_MAX) box.removeChild(box.firstElementChild);
|
|
823
|
+
}
|
|
824
|
+
if (stick) box.scrollTop = box.scrollHeight;
|
|
825
|
+
}
|
|
826
|
+
var WAIT_TXT = {starting: 'starting', 'waiting-first-output': 'waiting for first output', generating: 'generating', 'executing-tool': 'running a tool', 'waiting-dependency': 'waiting for a dependency', 'waiting-agent': 'waiting for another agent', 'waiting-owner': 'waiting for you', 'waiting-resource': 'waiting for a resource', paused: 'paused', recovering: 'recovering', idle: 'idle'};
|
|
827
|
+
function xLanesPane(p) {
|
|
828
|
+
var keeps = {}; Array.prototype.forEach.call(p.querySelectorAll('.xlive'), function (n) { keeps[n.dataset.a] = n.scrollTop; });
|
|
829
|
+
p.innerHTML = ''; p.dataset.built = 'lanes';
|
|
830
|
+
var wrap = h('div', {id: 'xlanes', class: 'xlanes'});
|
|
831
|
+
S.order.forEach(function (id) {
|
|
832
|
+
var L = X.lanes[id] || xLane(id), a = A(id), col = tcol(id);
|
|
833
|
+
var live = h('div', {class: 'xlive', 'data-a': id, text: L.live || ''});
|
|
834
|
+
wrap.appendChild(h('div', {class: 'xlane', style: '--tc:' + col}, [
|
|
835
|
+
h('div', {class: 'xlh'}, [h('b', {text: nm(id)}), h('span', {class: 'xteam', text: a ? teamLbl(a.cfg.team) : ''})]),
|
|
836
|
+
h('div', {class: 'xlw ' + (L.wait || 'none'), text: L.wait ? (WAIT_TXT[L.wait] || L.wait) + (L.detail ? ' · ' + xClip(L.detail, 60) : '') : '—'}),
|
|
837
|
+
L.tool ? h('div', {class: 'xlt mono', text: '⚙ ' + xClip(L.tool, 40)}) : null,
|
|
838
|
+
L.act ? h('div', {class: 'xla', text: xClip(L.act, 90)}) : null, live,
|
|
839
|
+
h('div', {class: 'xlf mono', text: L.turns + ' turns · ' + fmtN(L.tokens) + ' tok' + (L.at ? ' · last progress ' + clock(L.at) : '')})]));
|
|
840
|
+
if (keeps[id] != null) setTimeout(function () { live.scrollTop = L.fin ? 0 : 1e9; }, 0); else live.scrollTop = 1e9;
|
|
841
|
+
});
|
|
842
|
+
p.appendChild(wrap);
|
|
843
|
+
}
|
|
844
|
+
function xBoardPane(p0) {
|
|
845
|
+
p0.innerHTML = ''; p0.dataset.built = 'board';
|
|
846
|
+
var p = h('div', {id: 'xboard'}); p0.appendChild(p);
|
|
847
|
+
p.appendChild(secHead('CONTRIBUTIONS'));
|
|
848
|
+
var by = {}; Object.keys(X.contribs).forEach(function (k) { var c = X.contribs[k]; (by[c.agentId] = by[c.agentId] || []).push(c); });
|
|
849
|
+
var ids = Object.keys(by);
|
|
850
|
+
ids.forEach(function (aid) {
|
|
851
|
+
var card = h('div', {class: 'icard xb', style: '--tc:' + tcol(aid)}, [h('b', {text: nm(aid)})]);
|
|
852
|
+
by[aid].forEach(function (c) {
|
|
853
|
+
card.appendChild(h('div', {class: 'ml', text: (c.taskId ? 'task ' + c.taskId + ' · ' : '') + c.status}));
|
|
854
|
+
(c.findings || []).forEach(function (f) { card.appendChild(h('div', {class: 'xfind'}, [h('span', {class: 'sev ' + f.severity, text: f.severity}), h('span', {text: xClip(f.summary, 200)})])); });
|
|
855
|
+
if (!(c.findings || []).length) card.appendChild(h('div', {class: 'iempty', text: 'no findings'}));
|
|
856
|
+
});
|
|
857
|
+
p.appendChild(card);
|
|
858
|
+
});
|
|
859
|
+
if (!ids.length) p.appendChild(h('div', {class: 'iempty', text: 'No contributions yet.'}));
|
|
860
|
+
p.appendChild(secHead('DECISIONS'));
|
|
861
|
+
var dk = Object.keys(X.decisions);
|
|
862
|
+
dk.forEach(function (k) {
|
|
863
|
+
var d = X.decisions[k];
|
|
864
|
+
p.appendChild(h('div', {class: 'icard xb'}, [h('div', {class: 'xdh'}, [h('b', {text: d.title || d.id}), h('span', {class: 'dst ' + d.status, text: d.status + (d.revision > 1 ? ' · rev ' + d.revision : '')})]),
|
|
865
|
+
d.selected ? h('div', {class: 'xsel', text: 'selected: ' + xClip(d.selected, 240)}) : null, d.rationale ? h('div', {class: 'xrat', text: xClip(d.rationale, 400)}) : null]));
|
|
866
|
+
});
|
|
867
|
+
if (!dk.length) p.appendChild(h('div', {class: 'iempty', text: 'No decisions recorded yet.'}));
|
|
868
|
+
}
|
|
869
|
+
/* why a task has not started: open dependencies, else what its team's agents are waiting for (e.g. a free agent slot / the workspace) */
|
|
870
|
+
function xWhy(t, open) {
|
|
871
|
+
if (open.length) return 'waiting for: ' + open.join(', ');
|
|
872
|
+
var w = S.order.filter(function (id) { var a = A(id); return a && a.cfg.team === t.team && X.lanes[id] && X.lanes[id].wait && X.lanes[id].wait !== 'idle'; })
|
|
873
|
+
.map(function (id) { var L = X.lanes[id]; return nm(id) + ': ' + (WAIT_TXT[L.wait] || L.wait) + (L.detail ? ' (' + xClip(L.detail, 60) + ')' : ''); });
|
|
874
|
+
return w.length ? w.join(' · ') : 'ready: starts when the Director dispatches it';
|
|
875
|
+
}
|
|
876
|
+
function xTasksPane(p0) {
|
|
877
|
+
p0.innerHTML = ''; p0.dataset.built = 'tasks';
|
|
878
|
+
var p = h('div', {id: 'xgraph'}); p0.appendChild(p);
|
|
879
|
+
X.skipped.forEach(function (k) { p.appendChild(h('div', {class: 'icard xtask skipped'}, [h('div', {class: 'xdh'}, [h('b', {text: teamLbl(k.team)}), h('span', {class: 'tst skipped', text: 'skipped'})]), h('div', {class: 'xrat', text: xClip(k.reason, 200)})])); });
|
|
880
|
+
if (!X.taskOrder.length) { p.appendChild(h('div', {class: 'iempty', text: 'The Director has not planned a task graph for this run.'})); return; }
|
|
881
|
+
X.taskOrder.forEach(function (id) {
|
|
882
|
+
var t = X.tasks[id], open = t.deps.filter(function (d) { return !X.tasks[d] || X.tasks[d].status !== 'done'; });
|
|
883
|
+
p.appendChild(h('div', {class: 'icard xtask ' + t.status}, [h('div', {class: 'xdh'}, [h('b', {class: 'mono', text: id}), h('span', {class: 'tst ' + t.status, text: t.status}), h('span', {class: 'xteam', text: teamLbl(t.team)})]), h('div', {text: t.title}),
|
|
884
|
+
t.deps.length ? h('div', {class: 'ml', text: 'deps: ' + t.deps.join(', ')}) : null,
|
|
885
|
+
t.status === 'pending' ? h('div', {class: 'xwait', text: 'not started · ' + xWhy(t, open)}) : null, t.note ? h('div', {class: 'xrat', text: xClip(t.note, 200)}) : null]));
|
|
886
|
+
});
|
|
887
|
+
}
|
|
888
|
+
function xFrame(now) {
|
|
889
|
+
if (now - xLast < 250) return; xLast = now;
|
|
890
|
+
if (xTab === 'inspect') { if (xDirty) xTeleStrip(); xDirty = false; return; }
|
|
891
|
+
if (!xDirty && !(xTab === 'feed' && X.pend.length)) return;
|
|
892
|
+
var p = $('xpane'), wasDirty = xDirty; xDirty = false; xTeleStrip();
|
|
893
|
+
if (xTab === 'feed') { if (p.dataset.built !== 'feed') X.feedBuilt = -1; xFeedPane(p); }
|
|
894
|
+
else if (!wasDirty) return;
|
|
895
|
+
else if (xTab === 'lanes') xLanesPane(p); else if (xTab === 'board') xBoardPane(p); else if (xTab === 'tasks') xTasksPane(p);
|
|
896
|
+
}
|
|
897
|
+
|
|
696
898
|
/* views */
|
|
697
899
|
function setView(v) {
|
|
698
900
|
S.view = v; ['live', 'settings', 'runs'].forEach(function (x) { $(x).hidden = x !== v; });
|
|
@@ -1218,7 +1420,7 @@
|
|
|
1218
1420
|
}
|
|
1219
1421
|
function limits() {
|
|
1220
1422
|
var f = h('div'); f.appendChild(h('div', {class: 'sec', text: 'LIMITS'}));
|
|
1221
|
-
f.appendChild(h('div', {class: 'row3'}, [fld('Discussion rounds per team', bind(h('input', {type: 'number', value: draft.limits.baRounds, min:
|
|
1423
|
+
f.appendChild(h('div', {class: 'row3'}, [fld('Discussion rounds per team (0 = parallel contributions)', bind(h('input', {type: 'number', value: draft.limits.baRounds, min: 0}), draft.limits, 'baRounds', true)), fld('Max send-backs per team', bind(h('input', {type: 'number', value: draft.limits.qcLoops, min: 0}), draft.limits, 'qcLoops', true)), fld('Agent timeout (ms)', bind(h('input', {type: 'number', value: draft.limits.agentTimeoutMs}), draft.limits, 'agentTimeoutMs', true))]));
|
|
1222
1424
|
return f;
|
|
1223
1425
|
}
|
|
1224
1426
|
render();
|
package/gui/comic/comic.css
CHANGED
|
@@ -128,3 +128,89 @@
|
|
|
128
128
|
@media (max-height:760px){#comic .ck-panel{height:270px}#comic .ck-panel.w-hero{height:320px;min-height:0}#comic .ck-panel.w-small{height:210px}}
|
|
129
129
|
@media (max-width:900px){#comic{left:4px;right:4px;padding:0 8px 14px}#comic .ck-head{margin:0 -8px 10px}#comic .ck-ttl{font-size:13px}}
|
|
130
130
|
#comic .ck-chip .ck-sim{font:800 9px var(--ff);letter-spacing:.08em;padding:1px 6px;border-radius:8px;background:#F3A544;color:#10151f;white-space:nowrap}
|
|
131
|
+
|
|
132
|
+
/* ===== storyboard layout (DesignRef/comic mockup): numbered tab, big portrait left, bubble right, name plate + status bottom ===== */
|
|
133
|
+
#comic .ck-panel.t-episode{display:none}
|
|
134
|
+
#comic .ck-grid{gap:18px 30px}
|
|
135
|
+
#comic .ck-panel{overflow:visible;border-width:2px;border-radius:12px;box-shadow:0 0 0 1px rgba(255,255,255,.06),0 0 18px var(--pg),inset 0 0 26px rgba(0,0,0,.55);margin-top:14px}
|
|
136
|
+
#comic .ck-panel>.ck-l{border-radius:10px;overflow:hidden}
|
|
137
|
+
#comic .ck-l0:after{content:"";position:absolute;inset:0;background:linear-gradient(90deg,rgba(4,6,14,.15) 0,rgba(4,6,14,.55) 60%,rgba(4,6,14,.35))}
|
|
138
|
+
/* numbered title tab sits on the top border */
|
|
139
|
+
#comic .ck-badge{left:14px;top:-15px;max-width:calc(100% - 28px);padding:3px 18px 3px 3px;border-radius:8px 18px 18px 8px;background:linear-gradient(90deg,#1a1240 0,#10183a 100%);border:2px solid var(--pc);box-shadow:0 0 14px var(--pg)}
|
|
140
|
+
#comic .ck-seq{min-width:30px;height:30px;font-size:16px;background:radial-gradient(circle at 35% 30%,#fff 0,#e7dcff 35%,var(--pc) 100%);border:2px solid #0b1020}
|
|
141
|
+
#comic .ck-ttl{font:italic 800 16px/1.3 var(--ff);text-shadow:0 1px 0 #000,0 0 10px var(--pg)}
|
|
142
|
+
/* status chip bottom-right */
|
|
143
|
+
#comic .ck-chip{top:auto;bottom:12px;right:12px;border-radius:18px;padding:5px 14px;font-size:13px;background:linear-gradient(90deg,rgba(6,10,22,.92),color-mix(in srgb,var(--sc) 22%,#060a16))}
|
|
144
|
+
/* main character: large portrait on the left, blended into the scene */
|
|
145
|
+
#comic .ck-l4{display:block;padding:0}
|
|
146
|
+
#comic .ck-char.is-main{left:0;right:auto;transform:none;width:44%;height:100%;justify-content:flex-end;align-items:flex-start}
|
|
147
|
+
#comic .ck-char.is-main:before{left:4%;right:10%;bottom:14%;height:70%;opacity:.5}
|
|
148
|
+
#comic .ck-char.is-main .ck-bust,#comic .ck-panel .ck-char.is-main .ck-bust{height:auto;width:100%;max-width:300px;aspect-ratio:1;margin:auto 0 0 0;border-radius:0;clip-path:none;background:none;
|
|
149
|
+
-webkit-mask-image:radial-gradient(ellipse 72% 78% at 46% 44%,#000 58%,transparent 100%);mask-image:radial-gradient(ellipse 72% 78% at 46% 44%,#000 58%,transparent 100%)}
|
|
150
|
+
#comic .ck-char.is-main .ck-bust:after{display:none}
|
|
151
|
+
#comic .ck-char.is-main .ck-art{filter:saturate(1.12) contrast(1.05) drop-shadow(0 0 12px var(--cc))}
|
|
152
|
+
#comic .ck-char.is-main .ck-mono{font-size:64px;text-shadow:0 0 18px var(--cc)}
|
|
153
|
+
#comic .ck-char.is-main.is-owner .ck-bust{background:radial-gradient(circle at 50% 38%,#3a3f78,#0a1020 70%)}
|
|
154
|
+
#comic .ck-char.is-main.is-sprite .ck-bust,#comic .ck-char.is-main .ck-bust.is-sprite{-webkit-mask-image:none;mask-image:none;max-width:none;height:96%!important;aspect-ratio:auto}
|
|
155
|
+
/* name plate bottom-left: role icon + uppercase name */
|
|
156
|
+
#comic .ck-plate{left:12px;bottom:12px;gap:8px;align-items:center;padding:3px 16px 3px 3px;border-radius:22px;border-width:2px;background:linear-gradient(90deg,rgba(8,12,28,.95),color-mix(in srgb,var(--cc) 30%,#0a1020))}
|
|
157
|
+
#comic .ck-plate b{font:800 15px var(--ff);letter-spacing:.05em;text-transform:uppercase}
|
|
158
|
+
#comic .ck-plate small{display:none}
|
|
159
|
+
#comic .ck-pico{flex:none;display:grid;place-items:center;min-width:30px;height:30px;padding:0 4px;border-radius:15px;background:#0b1020;border:2px solid var(--cc);color:#fff;font:800 11px var(--mono,monospace);letter-spacing:.02em}
|
|
160
|
+
#comic .ck-pico .ck-owner-svg{width:18px;height:18px}
|
|
161
|
+
/* the other characters: round avatars top-right */
|
|
162
|
+
#comic .ck-minis{position:absolute;right:12px;top:22px;display:flex;gap:6px;z-index:7}
|
|
163
|
+
#comic .ck-char.is-mini{position:relative;width:auto;height:auto;left:auto;right:auto;transform:none}
|
|
164
|
+
#comic .ck-char.is-mini:before{display:none}
|
|
165
|
+
#comic .ck-char.is-mini .ck-bust,#comic .ck-panel .ck-char.is-mini .ck-bust{width:40px;height:40px;margin:0;border-radius:50%;clip-path:none;box-shadow:0 0 0 2px var(--cc),0 0 10px var(--cc)}
|
|
166
|
+
#comic .ck-char.is-mini .ck-bust:after{display:none}
|
|
167
|
+
#comic .ck-char.is-mini .ck-mono{font-size:13px}
|
|
168
|
+
#comic .ck-char.is-mini .ck-plate{display:none}
|
|
169
|
+
/* bubbles fill the right side; tails point back at the portrait */
|
|
170
|
+
#comic .ck-bubbles{left:40%;right:14px;top:30px;bottom:54px;justify-content:center;gap:10px;padding:0}
|
|
171
|
+
#comic .ck-panel[data-cast=none] .ck-bubbles{left:14px}
|
|
172
|
+
#comic .ck-bub,#comic .ck-bub.side-right,#comic .ck-bub.side-center{max-width:100%;align-self:center;margin-bottom:16px}
|
|
173
|
+
#comic .ck-btxt{font:600 14.5px/1.45 var(--ff);text-align:center;padding:12px 18px 10px}
|
|
174
|
+
#comic .ck-cap{align-self:center;max-width:100%}
|
|
175
|
+
#comic .ck-banner{max-width:100%}
|
|
176
|
+
/* chevron to the next panel in the row */
|
|
177
|
+
#comic .ck-next{display:none}
|
|
178
|
+
#comic .ck-panel.has-next .ck-next{display:block;position:absolute;right:-27px;top:50%;width:24px;height:36px;margin-top:-18px;z-index:8;pointer-events:none;
|
|
179
|
+
background:linear-gradient(135deg,#f0d8ff,#a36bff);clip-path:polygon(0 0,45% 0,100% 50%,45% 100%,0 100%,55% 50%);filter:drop-shadow(0 0 6px #a36bff)}
|
|
180
|
+
/* episode header: clapper logo, script title, story box */
|
|
181
|
+
#comic .ck-ep{min-height:72px;gap:20px;padding:10px 22px 10px 14px;border-radius:12px;flex-wrap:wrap}
|
|
182
|
+
#comic .ck-ep-logo{position:relative;display:grid;grid-template-columns:auto auto;grid-template-rows:auto auto;column-gap:8px;align-items:center;padding:6px 14px 6px 8px;border:2px solid #b8a2ff;border-radius:8px;background:linear-gradient(135deg,#1d1250,#0c1434);box-shadow:0 0 14px rgba(163,107,255,.55);transform:rotate(-3deg)}
|
|
183
|
+
#comic .ck-clap{grid-row:1/3;width:34px;height:30px;border-radius:3px;background:linear-gradient(#fff 0 9px,transparent 9px),repeating-linear-gradient(120deg,#0b1020 0 6px,#fff 6px 12px) top/100% 9px no-repeat,#fff;border:2px solid #0b1020;position:relative}
|
|
184
|
+
#comic .ck-clap:after{content:"";position:absolute;left:11px;top:12px;border:6px solid transparent;border-left:9px solid #0b1020;border-right:0}
|
|
185
|
+
#comic .ck-ep-logo b{font:900 17px/1 var(--ff);letter-spacing:.06em;color:#fff}
|
|
186
|
+
#comic .ck-ep-logo em{font:italic 800 17px/1.1 var(--ff);color:#ffe9b0}
|
|
187
|
+
#comic .ck-ep-title{display:flex;gap:10px;align-items:baseline;min-width:0;flex:1 1 320px;position:relative;padding:4px 18px;background:linear-gradient(90deg,#f5d58a,#f0b860 70%,rgba(240,184,96,0));clip-path:polygon(0 8%,100% 0,97% 100%,1% 92%)}
|
|
188
|
+
#comic .ck-ep-n,#comic .ck-ep-t{background:none;padding:0;border-radius:0;color:#2a1606;text-shadow:none;font:italic 900 clamp(18px,2vw,26px)/1.3 var(--ff);letter-spacing:0;white-space:normal}
|
|
189
|
+
#comic .ck-ep-t{overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}
|
|
190
|
+
#comic .ck-ep-story{flex:0 1 420px;position:relative;padding:8px 14px;border:1px solid #4d5fa8;border-radius:8px;background:rgba(8,12,30,.85);color:#e6eeff;font:500 13px/1.5 var(--ff)}
|
|
191
|
+
#comic .ck-ep-story[hidden]{display:none}
|
|
192
|
+
#comic .ck-ep-story b{color:#fff}
|
|
193
|
+
/* end-of-run strip */
|
|
194
|
+
#comic .ck-foot{display:flex;align-items:center;gap:22px;justify-content:center;flex-wrap:wrap;padding:14px 20px;margin-top:4px;border-radius:12px;border:1px solid #4a3fa0;background:linear-gradient(90deg,#0a0f28,#1a1446 50%,#0a0f28)}
|
|
195
|
+
#comic .ck-foot-team{display:flex;align-items:center;gap:10px;font:italic 900 20px var(--ff);color:#9fc4ff;letter-spacing:.04em}
|
|
196
|
+
#comic .ck-foot-ico{width:30px;height:24px;background:radial-gradient(circle at 50% 30%,#9fc4ff 0 5px,transparent 6px),radial-gradient(ellipse at 50% 100%,#9fc4ff 0 10px,transparent 11px)}
|
|
197
|
+
#comic .ck-foot-msg{display:flex;align-items:center;gap:8px;padding:8px 20px;border-radius:24px;border:2px solid #4AD69A;background:rgba(6,14,24,.9);color:#e6eeff;font:600 15px var(--ff);box-shadow:0 0 14px rgba(74,214,154,.4)}
|
|
198
|
+
#comic .ck-foot-msg>b{color:#ffe28a;font-style:italic}
|
|
199
|
+
#comic .ck-foot-chk{font-style:normal;display:grid;place-items:center;width:26px;height:26px;border-radius:50%;border:2px solid currentColor;color:#4AD69A}
|
|
200
|
+
#comic .ck-foot.is-rep .ck-foot-msg{border-color:#21D6E8;box-shadow:0 0 14px rgba(33,214,232,.35)}#comic .ck-foot.is-rep .ck-foot-chk{color:#21D6E8}
|
|
201
|
+
#comic .ck-foot.is-bad .ck-foot-msg{border-color:#F05668;box-shadow:0 0 14px rgba(240,86,104,.35)}#comic .ck-foot.is-bad .ck-foot-chk{color:#F05668}
|
|
202
|
+
#comic[data-cols=narrow] .ck-bub{max-width:100%}
|
|
203
|
+
@media (max-width:900px){#comic .ck-char.is-main{width:40%}#comic .ck-bubbles{left:38%}#comic .ck-ep-story{flex-basis:100%}}
|
|
204
|
+
#comic .ck-panel .ck-char.is-main{width:44%;left:0;right:auto}
|
|
205
|
+
#comic .ck-char.is-main.is-owner .ck-owner-svg{width:62%;height:62%;color:#c9d4f0;opacity:.95}
|
|
206
|
+
#comic .ck-char.is-main.is-team .ck-bust{background:radial-gradient(circle at 50% 42%,color-mix(in srgb,var(--cc) 45%,#0a1020),#0a1020 72%)}
|
|
207
|
+
#comic .ck-panel,#comic .ck-panel.w-small{height:auto;min-height:270px}
|
|
208
|
+
#comic .ck-panel.w-hero{height:auto;min-height:330px}
|
|
209
|
+
@media (max-height:760px){#comic .ck-panel,#comic .ck-panel.w-small{height:auto;min-height:240px}#comic .ck-panel.w-hero{height:auto;min-height:290px}}
|
|
210
|
+
#comic .ck-panel[data-span="12"] .ck-char.is-main{width:24%;min-width:240px}
|
|
211
|
+
#comic .ck-panel[data-span="12"] .ck-bubbles{left:max(26%,260px);right:22%}
|
|
212
|
+
#comic .ck-seq{font-size:14px}
|
|
213
|
+
@media (max-width:900px){#comic .ck-panel[data-span="12"] .ck-char.is-main{width:40%;min-width:0}#comic .ck-panel[data-span="12"] .ck-bubbles{left:38%;right:14px}}
|
|
214
|
+
#comic .ck-ep-title{display:block}
|
|
215
|
+
#comic .ck-ep-n{margin-right:8px}
|
|
216
|
+
#comic .ck-ep-t{display:inline;-webkit-line-clamp:unset}
|
package/gui/comic/engine.js
CHANGED
|
@@ -165,8 +165,26 @@
|
|
|
165
165
|
touch(b);
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
// live text of a running turn: shown as the status line of that agent's open working beat (real text only, replaced by the final message)
|
|
169
|
+
function delta(e) {
|
|
170
|
+
if (!e.agentId || typeof e.text !== 'string') return;
|
|
171
|
+
var b = S.open[e.agentId];
|
|
172
|
+
if (!b) return;
|
|
173
|
+
b._live = ((b._live || '') + e.text).slice(-600);
|
|
174
|
+
var t = clip(normalize(b._live), 160);
|
|
175
|
+
if (!t) return;
|
|
176
|
+
b._status = t; b.status = t;
|
|
177
|
+
var ls = [];
|
|
178
|
+
if (b._par) ls.push(line(null, 'narration', b._par));
|
|
179
|
+
ls.push(line(e.agentId, 'quote', t));
|
|
180
|
+
if (b._ops) ls.push(line(null, 'status', 'Đã thực hiện ' + b._ops + ' thao tác công cụ'));
|
|
181
|
+
b.lines = ls; touch(b);
|
|
182
|
+
}
|
|
183
|
+
var SEV = ['critical', 'high', 'medium', 'low', 'info'];
|
|
184
|
+
|
|
168
185
|
function push(e) {
|
|
169
186
|
added = []; updated = [];
|
|
187
|
+
if (e && e.type === 'agent.delta') { try { delta(e); } catch (err) { /* live preview only */ } return { added: added, updated: updated }; }
|
|
170
188
|
if (!e || typeof e.seq !== 'number') return { added: added, updated: updated };
|
|
171
189
|
var key = (e.runId || '') + ':' + e.seq;
|
|
172
190
|
if (S.seen[key]) return { added: [], updated: [] };
|
|
@@ -299,6 +317,32 @@
|
|
|
299
317
|
case 'lane.chosen':
|
|
300
318
|
mk(e, { type: 'lane', title: (e.by === 'owner' ? 'Chủ dự án chọn quy trình ' : e.by === 'fallback' ? 'Hệ thống chọn quy trình mặc định ' : 'Director chọn quy trình ') + (normalize(e.name || e.laneId || '', 60)), team: 'director', scene: 'briefing', weight: 'small', cast: e.by === 'owner' ? [cast('owner', 'center', 'presenting', true)] : e.by === 'fallback' ? [] : [cast(S.ctx.directorId, 'center', 'presenting', true)], lines: e.reason ? [line(null, 'narration', clip(normalize(e.reason), 160))] : [], truth: 'confirmed', status: e.by === 'fallback' ? 'Quy trình mặc định' : 'Đã chọn quy trình' });
|
|
301
319
|
return;
|
|
320
|
+
case 'agent.mail': {
|
|
321
|
+
var mf = endpoint(e.from), mt = endpoint(e.to), body = e.subject ? e.subject + (e.text ? ': ' + e.text : '') : e.text;
|
|
322
|
+
mk(e, { type: 'mail', title: mf.label + ' gửi thư cho ' + mt.label, team: teamOf(e.from), scene: 'handoff', weight: 'small', cast: pushCast(pushCast([], castEp(mf, 'left', 'sending', true)), castEp(mt, 'right', 'listening', false)), lines: [line(mf.agentId, 'quote', excerpt(body || '', 160), fullText(body || ''))], truth: 'reported', status: e.kind === 'ask' ? 'Câu hỏi' : e.kind === 'answer' ? 'Trả lời' : 'Thư', transfer: { from: mf.agentId || e.from, to: mt.agentId || e.to }, props: ['document'] });
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
case 'task.created': {
|
|
326
|
+
var tk = teamName(e.team), dep = (e.deps || []).length ? ' (sau: ' + e.deps.join(', ') + ')' : '';
|
|
327
|
+
mk(e, { type: 'task', title: 'Task ' + e.taskId + ' cho ' + tk, team: e.team, scene: 'briefing', weight: 'small', cast: [cast(S.ctx.directorId, 'center', 'presenting', true)], lines: [line(S.ctx.directorId, 'narration', clip(normalize(e.title || ''), 140) + dep, fullText(e.title || ''))], truth: 'planned', status: 'Task mới' });
|
|
328
|
+
return;
|
|
329
|
+
}
|
|
330
|
+
case 'task.updated': {
|
|
331
|
+
var tdone = e.status === 'done', tbad = e.status === 'failed' || e.status === 'blocked';
|
|
332
|
+
mk(e, { type: 'task', title: 'Task ' + e.taskId + ': ' + e.status, team: 'director', scene: tbad ? 'blocked' : 'briefing', weight: 'small', cast: [cast(S.ctx.directorId, 'center', tbad ? 'concerned' : 'speaking', true)], lines: [line(null, 'narration', 'Task ' + e.taskId + ' → ' + e.status + (e.note ? ': ' + clip(normalize(e.note), 120) : ''))], truth: tdone ? 'confirmed' : tbad ? 'failed' : 'reported', status: e.status });
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
case 'contribution.published': {
|
|
336
|
+
var ct = e.contribution || {}, fl = ct.findings || [], top = '';
|
|
337
|
+
for (var si = 0; si < SEV.length && !top; si++) for (var fi = 0; fi < fl.length; fi++) if (fl[fi].severity === SEV[si]) { top = SEV[si]; break; }
|
|
338
|
+
mk(e, { type: 'contribution', title: who(ct.agentId) + ' đóng góp', team: teamOf(ct.agentId), scene: 'discussion', weight: 'small', cast: [cast(ct.agentId, 'center', 'presenting', true)], lines: [line(ct.agentId, 'quote', fl.length + (fl.length === 1 ? ' finding' : ' findings') + (top ? ' (cao nhất: ' + top + ')' : '') + (ct.status === 'partial' ? ' - tạm thời' : ''))], truth: 'reported', status: 'Đóng góp' });
|
|
339
|
+
return;
|
|
340
|
+
}
|
|
341
|
+
case 'decision.recorded': {
|
|
342
|
+
var dr = e.decision || {}, dz = S.ctx.directorId;
|
|
343
|
+
mk(e, { type: 'decision', title: 'Director ghi quyết định', team: 'director', scene: 'briefing', weight: 'small', cast: [cast(dz, 'center', 'presenting', true)], lines: [line(dz, 'quote', clip(normalize(dr.title || ''), 160), fullText(dr.title || ''))], truth: dr.status === 'committed' || dr.status === 'verified' ? 'confirmed' : 'planned', status: dr.status || 'Quyết định' });
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
302
346
|
case 'run.completed': {
|
|
303
347
|
closeAll(e.at); S.completed = true; S.waiting = false;
|
|
304
348
|
var di3 = S.ctx.directorId, rep2 = e.report || '', rv = S.ep && S.rv[S.ep.id];
|