@ngockhoale/ckit 0.2.6 → 0.2.7
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/dist/src/team/config.js +4 -2
- package/dist/src/team/types.d.ts +2 -0
- package/gui/app.css +178 -0
- package/gui/app.js +278 -65
- package/gui/assets/ckit-oriental-avatar-pack/README.md +5 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-01.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-02.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-03.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-04.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-05.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-06.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-07.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-08.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-architect-09.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-01.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-02.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-03.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-04.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-05.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-06.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-07.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-08.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-data-ai-09.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-01.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-02.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-03.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-04.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-05.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-06.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-07.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-08.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-developer-09.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-01.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-02.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-03.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-04.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-05.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-06.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-07.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-08.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-devops-09.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-01.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-02.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-03.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-04.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-05.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-06.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-07.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-08.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-pm-09.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-01.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-02.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-03.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-04.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-05.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-06.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-07.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-08.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-qa-09.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-01.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-02.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-03.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-04.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-05.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-06.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-07.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-08.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/avatars/oriental-security-09.png +0 -0
- package/gui/assets/ckit-oriental-avatar-pack/manifest.json +447 -0
- package/gui/index.html +28 -12
- package/gui/network.js +108 -20
- package/package.json +2 -1
package/gui/app.js
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
Object.keys(attrs || {}).forEach(function (k) {
|
|
16
16
|
var v = attrs[k]; if (v === false || v == null) return;
|
|
17
17
|
if (k === 'class') e.className = v; else if (k === 'text') e.textContent = v; else if (k.slice(0, 2) === 'on') e.addEventListener(k.slice(2), v);
|
|
18
|
-
else if (k === 'style') e.setAttribute('
|
|
18
|
+
else if (k === 'style' || k === 'role' || k.indexOf('-') > 0) e.setAttribute(k, v === true ? '' : String(v)); else e[k] = v === true ? true : v;
|
|
19
19
|
});
|
|
20
20
|
(kids || []).forEach(function (c) { if (c != null) e.appendChild(typeof c === 'string' ? document.createTextNode(c) : c); });
|
|
21
21
|
return e;
|
|
@@ -81,6 +81,43 @@
|
|
|
81
81
|
function nm(id) { return A(id) ? A(id).cfg.name : id === 'all' ? 'everyone' : TL[id] || id; }
|
|
82
82
|
function tcol(id) { return A(id) ? TC[A(id).cfg.team] || '#8A9AAF' : TC[id] || '#8A9AAF'; }
|
|
83
83
|
function ini(id) { return A(id) ? net.initials(A(id).cfg) : '?'; }
|
|
84
|
+
/* avatars: one shared helper. Ids come from the bundled pack (gui/assets/ckit-oriental-avatar-pack); any role may use any avatar. */
|
|
85
|
+
var AV_BASE = '/assets/ckit-oriental-avatar-pack/', AVATARS = [], AV_CATS = ['architect', 'data-ai', 'developer', 'devops', 'pm', 'qa', 'security'];
|
|
86
|
+
var TEAM_CAT = {director: 'pm', ba: 'architect', implement: 'developer', qc: 'qa'}, XCAT = ['data-ai', 'devops', 'security'];
|
|
87
|
+
var AV_RE = /^[a-z0-9-]{1,64}$/, RM = window.matchMedia ? window.matchMedia('(prefers-reduced-motion: reduce)') : {matches: false};
|
|
88
|
+
fetch(AV_BASE + 'manifest.json').then(function (r) { return r.ok ? r.json() : null; }).then(function (m) { if (m && Array.isArray(m.avatars)) { AVATARS = m.avatars.filter(function (a) { return a && AV_RE.test(a.id); }); S.dirty = true; } }).catch(function () { /* offline-safe: initials fallback */ });
|
|
89
|
+
/* stable default: team category + position inside the team (01..09); an explicit cfg.avatar always wins */
|
|
90
|
+
function avatarId(cfg) {
|
|
91
|
+
if (!cfg) return '';
|
|
92
|
+
if (cfg.avatar && AV_RE.test(cfg.avatar)) return cfg.avatar;
|
|
93
|
+
var cat = TEAM_CAT[cfg.team];
|
|
94
|
+
if (!cat) { var xi = extrasOf(S.config).map(function (t) { return t.id; }).indexOf(cfg.team); cat = XCAT[(xi < 0 ? 0 : xi) % XCAT.length]; }
|
|
95
|
+
var mates = S.config ? cfgAgents(S.config).filter(function (a) { return a.team === cfg.team; }).map(function (a) { return a.id; }) : [], i = mates.indexOf(cfg.id);
|
|
96
|
+
if (i < 0) { i = 0; for (var k = 0; k < String(cfg.id).length; k++) i = (i * 31 + String(cfg.id).charCodeAt(k)) % 9; }
|
|
97
|
+
return 'oriental-' + cat + '-' + String(i % 9 + 1).padStart(2, '0');
|
|
98
|
+
}
|
|
99
|
+
function avatarUrl(id) { return id && AV_RE.test(id) ? AV_BASE + 'avatars/' + id + '.png' : ''; }
|
|
100
|
+
/* engine identity: one registry, text marks (no emoji) */
|
|
101
|
+
var ENG = {'claude-code': {mark: 'C', color: '#E8875B', label: 'Claude Code'}, codex: {mark: 'X', color: '#DCE6F5', label: 'Codex'}, omp: {mark: 'O', color: '#4AD69A', label: 'omp'},
|
|
102
|
+
api: {mark: 'A', color: '#4F8CFF', label: 'API'}, auto: {mark: 'D', color: '#A36BFF', label: 'Built-in'}, simulated: {mark: 'S', color: '#8A9AAF', label: 'Simulated'}};
|
|
103
|
+
function eng(cli) { return ENG[cli] || {mark: '?', color: '#8A9AAF', label: String(cli || 'unknown')}; }
|
|
104
|
+
window.CKNet.setAvatarResolver(function (a) { return avatarUrl(avatarId(a)); });
|
|
105
|
+
window.CKNet.setEngineResolver(function (a) { return eng(a.cli); });
|
|
106
|
+
var IMGC = {};
|
|
107
|
+
/* avatar block: portrait (initials if the image is missing), engine badge, status dot. slot keeps one live node per place so 400 ms re-renders do not flicker. */
|
|
108
|
+
function avatarEl(cfg, size, opt) {
|
|
109
|
+
opt = opt || {}; var c = TC[cfg.team] || '#8A9AAF', url = avatarUrl(opt.id || avatarId(cfg)), e = eng(cfg.cli);
|
|
110
|
+
var box = h('div', {class: 'ava' + (opt.cls ? ' ' + opt.cls : ''), style: '--s:' + size + 'px;--tc:' + c + ';--tg:' + hexA(c, .35)});
|
|
111
|
+
var fb = h('span', {class: 'ini', text: net.initials(cfg)});
|
|
112
|
+
if (url) {
|
|
113
|
+
var key = (opt.slot || '') + '|' + url, im = opt.slot && IMGC[key];
|
|
114
|
+
if (!im) { im = h('img', {src: url, alt: '', loading: 'lazy', decoding: 'async', draggable: false}); im.addEventListener('error', function () { im.dataset.bad = '1'; im.replaceWith(h('span', {class: 'ini', text: net.initials(cfg)})); }); if (opt.slot) IMGC[key] = im; }
|
|
115
|
+
box.appendChild(im.dataset.bad ? fb : im);
|
|
116
|
+
} else box.appendChild(fb);
|
|
117
|
+
if (!opt.noEngine) box.appendChild(h('span', {class: 'eng', title: e.label, style: '--ec:' + e.color, text: e.mark}));
|
|
118
|
+
if (opt.state) box.appendChild(h('span', {class: 'dot ' + opt.state, title: opt.state}));
|
|
119
|
+
return box;
|
|
120
|
+
}
|
|
84
121
|
function setNarr(t) { S.narr = t; $('nowtext').textContent = t; $('now').classList.toggle('ask', !!S.waiting); }
|
|
85
122
|
|
|
86
123
|
function activeSubs() { var n = 0; S.order.forEach(function (id) { Object.keys(A(id).subs).forEach(function (k) { if (A(id).subs[k].state === 'run') n++; }); }); return n; }
|
|
@@ -113,14 +150,15 @@
|
|
|
113
150
|
var full = text, flat = plain(full), long = flat.length > 150, show = long ? flat.slice(0, 149) + '…' : flat, col = tcol(id);
|
|
114
151
|
var el = h('div', {class: 'bub', style: '--bc:' + col + ';--bg2:' + hexA(col, .5) + ';--bg3:' + hexA(col, .22)});
|
|
115
152
|
var body = h('span'), cur = h('span', {class: 'cur', text: '▍'});
|
|
116
|
-
el.appendChild(h('div', {class: 'who'}, [
|
|
153
|
+
el.appendChild(h('div', {class: 'who'}, [avatarEl(n.cfg, 22, {noEngine: true}), h('b', {text: nm(id)}), h('em', {text: '→ ' + nm(to)})]));
|
|
117
154
|
el.appendChild(h('div', {class: 'btx'}, [body, cur]));
|
|
118
155
|
if (long) el.appendChild(h('div', {class: 'more', text: 'Read full message ⤢'}));
|
|
119
156
|
el.addEventListener('click', function () { showMessage({from: id, to: to, at: e.at, tokens: e.tokens, text: full}); });
|
|
120
157
|
var rec = {el: el, hover: false, id: id, typed: 0};
|
|
121
158
|
el.addEventListener('mouseenter', function () { rec.hover = true; }); el.addEventListener('mouseleave', function () { rec.hover = false; if (rec.typed) rec.typed = performance.now() - 3000; });
|
|
122
159
|
$('bubbles').appendChild(el); S.bubbles[id] = rec;
|
|
123
|
-
|
|
160
|
+
if (RM.matches) { body.textContent = show; rec.typed = performance.now(); }
|
|
161
|
+
else { var i = 0; rec.timer = setInterval(function () { i += 1; body.textContent = show.slice(0, i); if (i >= show.length) { clearInterval(rec.timer); rec.typed = performance.now(); } }, 26); }
|
|
124
162
|
placeBubble(rec);
|
|
125
163
|
}
|
|
126
164
|
function placeBubble(rec) {
|
|
@@ -183,6 +221,7 @@
|
|
|
183
221
|
/* reducer */
|
|
184
222
|
function onEvent(e) {
|
|
185
223
|
S.events.push(e); S.dirty = true;
|
|
224
|
+
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) : ''));
|
|
186
225
|
var now = performance.now(), a = e.agentId ? A(e.agentId) : null;
|
|
187
226
|
if (e.type === 'run.started') {
|
|
188
227
|
S.started = Date.parse(e.at); S.config = e.config; S.simulated = e.simulated; S.run = S.run || {}; S.run.runId = e.runId; S.run.goal = e.goal; S.run.running = true; S.lane = null; S.laneBy = ''; net.setActiveTeams(null); setupAgents(e.config);
|
|
@@ -211,13 +250,14 @@
|
|
|
211
250
|
case 'agent.message':
|
|
212
251
|
S.msgs++; S.tokens += e.tokens || 0; if (a) { a.state = 'done'; a.tokens += e.tokens || 0; a.msgs++; a.label = ''; a.outputs.unshift({text: e.text, to: e.to, at: e.at, tokens: e.tokens}); a.outputs.length = Math.min(a.outputs.length, 5); net.setState(e.agentId, 'done'); a.activity = 'finished turn'; }
|
|
213
252
|
S.tokBuckets.push([Date.parse(e.at), S.tokens]); S.buckets.push(Date.parse(e.at));
|
|
214
|
-
if (!S.history) { net.pulse(e.agentId, e.to === 'all' ? S.config.director.id : e.to); bubbleFor(e.agentId, e.text, e, e.to); }
|
|
253
|
+
if (!S.history) { net.pulse(e.agentId, e.to === 'all' ? S.config.director.id : e.to, undefined, e.round ? 'Round ' + e.round : plain(e.text).slice(0, 20)); bubbleFor(e.agentId, e.text, e, e.to); }
|
|
254
|
+
termLine(e.at, nm(e.agentId) + ' → ' + nm(e.to) + (e.tokens ? ' (' + e.tokens + ' tok)' : '') + ': ' + plain(e.text).slice(0, 160));
|
|
215
255
|
feedMsg(e); comicMsg(e);
|
|
216
256
|
break;
|
|
217
257
|
case 'agent.failed': if (a) { a.state = 'failed'; a.activity = e.reason; net.setState(e.agentId, 'failed'); } S.fails.push(e); feedBanner('fail', '✕ ' + nm(e.agentId) + ' failed: ' + plain(e.reason).slice(0, 220) + ' (click for details)', function () { showFailure(); }); break;
|
|
218
258
|
case 'handoff.created':
|
|
219
|
-
S.handoffs.push(e); if (!S.history) { net.handoff(e.from, e.to, e.title); showHoBanner('
|
|
220
|
-
feedBanner('ho', '
|
|
259
|
+
S.handoffs.push(e); if (!S.history) { net.handoff(e.from, e.to, e.title); showHoBanner('HANDOFF ' + TL[e.from] + ' → ' + TL[e.to]); }
|
|
260
|
+
feedBanner('ho', '⇢ HANDOFF ' + teamLbl(e.from) + ' → ' + teamLbl(e.to) + ' · ' + e.title, e.text ? function () { showMessage({from: e.from, to: e.to, at: e.at, text: e.text}); } : null); comicHandoff(e);
|
|
221
261
|
S.order.forEach(function (id) { if (A(id).cfg.team === e.from) { A(id).state = 'idle'; net.setState(id, 'idle'); } });
|
|
222
262
|
break;
|
|
223
263
|
case 'flow.back': {
|
|
@@ -264,10 +304,49 @@
|
|
|
264
304
|
function bump(a) { a.spark.push(Date.now()); if (a.spark.length > 80) a.spark.shift(); }
|
|
265
305
|
|
|
266
306
|
/* feed */
|
|
267
|
-
|
|
307
|
+
/* auto-scroll only while the reader is already at the bottom; reading older messages is never interrupted */
|
|
308
|
+
var feedStick = true;
|
|
309
|
+
$('feed').addEventListener('scroll', function () { var f = $('feed'); feedStick = f.scrollHeight - f.scrollTop - f.clientHeight < 48; });
|
|
310
|
+
function feedScroll() { var f = $('feed'); if (feedStick) f.scrollTop = f.scrollHeight; trimFeed(f); }
|
|
311
|
+
function trimFeed(f) { while (f.childElementCount > 600) f.removeChild(f.firstElementChild); }
|
|
312
|
+
/* terminal: bounded raw event stream (text only) */
|
|
313
|
+
var TERM = [], termDirty = false;
|
|
314
|
+
function termLine(at, t) { TERM.push(clock(at) + ' ' + String(t).replace(/[\u0000-\u0008\u000b-\u001f]/g, '')); if (TERM.length > 400) TERM.splice(0, TERM.length - 400); termDirty = true; }
|
|
315
|
+
function flushTerm() { var el = $('term'); if (!termDirty || el.hidden) return; termDirty = false; var stick = el.scrollHeight - el.scrollTop - el.clientHeight < 40; el.textContent = TERM.join('\n'); if (stick) el.scrollTop = el.scrollHeight; }
|
|
316
|
+
/* conversation tabs: All + one per agent; same selection as roster / topology */
|
|
317
|
+
var curTab = '';
|
|
318
|
+
function setTab(id) {
|
|
319
|
+
curTab = id && A(id) ? id : ''; $('feed').dataset.filter = curTab;
|
|
320
|
+
Array.prototype.forEach.call($('feed').children, function (n) { n.classList.toggle('fhide', !!curTab && n.dataset.agent !== curTab); });
|
|
321
|
+
renderTabs();
|
|
322
|
+
if (curTab) { var f = $('feed'); f.scrollTop = f.scrollHeight; feedStick = true; }
|
|
323
|
+
}
|
|
324
|
+
function renderTabs() {
|
|
325
|
+
var box = $('ctabs'), ids = S.order.slice(0, 12), sig = curTab + '|' + ids.join(',');
|
|
326
|
+
if (box.dataset.sig === sig) return; box.dataset.sig = sig; box.innerHTML = '';
|
|
327
|
+
var mk = function (id, label, col, cfg) {
|
|
328
|
+
var on = curTab === id, b = h('button', {class: 'ctab' + (on ? ' on' : ''), type: 'button', role: 'tab', 'aria-selected': String(on), style: col ? '--tc:' + col : '', title: id ? 'Show only ' + label : 'Show the whole conversation', onclick: function () { selectAgent(id || null); }}, [cfg ? avatarEl(cfg, 18, {noEngine: true, slot: 't'}) : null, h('span', {text: label})]);
|
|
329
|
+
box.appendChild(b);
|
|
330
|
+
};
|
|
331
|
+
mk('', 'All', '', null);
|
|
332
|
+
ids.forEach(function (id) { var a = A(id); mk(id, a.cfg.name, tcol(id), a.cfg); });
|
|
333
|
+
box.appendChild(h('button', {class: 'ctab add', type: 'button', text: '+', title: 'Add an agent (opens Config)', 'aria-label': 'Add an agent', onclick: function () { setView('settings'); }}));
|
|
334
|
+
}
|
|
335
|
+
function dockView(v) {
|
|
336
|
+
UI.dockView = v; saveUI();
|
|
337
|
+
var fa = $('feedarea'), term = v === 'term' || v === 'split';
|
|
338
|
+
fa.classList.toggle('split', v === 'split'); fa.classList.toggle('termonly', v === 'term');
|
|
339
|
+
$('term').hidden = !term; $('feed').hidden = v === 'term';
|
|
340
|
+
$('bSplit').setAttribute('aria-pressed', String(v === 'split')); $('bTerm').setAttribute('aria-pressed', String(v === 'term'));
|
|
341
|
+
$('bSplit').classList.toggle('on', v === 'split'); $('bTerm').classList.toggle('on', v === 'term');
|
|
342
|
+
termDirty = true; flushTerm();
|
|
343
|
+
}
|
|
344
|
+
/* view toggles only change what is shown; they never touch the run or an agent session */
|
|
345
|
+
$('bSplit').onclick = function () { dockView(UI.dockView === 'split' ? 'chat' : 'split'); };
|
|
346
|
+
$('bTerm').onclick = function () { dockView(UI.dockView === 'term' ? 'chat' : 'term'); };
|
|
268
347
|
function teamLbl(id) { if (id === 'director') return 'Director'; var t = extrasOf(S.config).filter(function (x) { return x.id === id; })[0]; return t ? t.name : ({ba: 'BA', implement: 'Implement', qc: 'QC'})[id] || id; }
|
|
269
348
|
function feedPhase(t, team) { $('feed').appendChild(h('div', {class: 'fphase', style: 'color:' + TC[team], text: '▍' + t})); feedScroll(); }
|
|
270
|
-
function feedBanner(kind, t, onclick) { $('feed').appendChild(h('div', {class: 'fban ' + kind + (onclick ? ' click' : ''), text: t, onclick: onclick})); feedScroll(); count(); }
|
|
349
|
+
function feedBanner(kind, t, onclick) { $('feed').appendChild(h('div', {class: 'fban ' + kind + (onclick ? ' click' : '') + (curTab ? ' fhide' : ''), text: t, onclick: onclick})); feedScroll(); count(); }
|
|
271
350
|
function fmtSize(n) { return n >= 1048576 ? (n / 1048576).toFixed(1) + ' MB' : n >= 1024 ? Math.round(n / 1024) + ' KB' : n + ' B'; }
|
|
272
351
|
function attUrl(a) { return '/api/runs/' + encodeURIComponent((S.run && S.run.runId) || 'current') + '/attachment/' + encodeURIComponent(a.name) + '?t=' + encodeURIComponent(TOKEN); }
|
|
273
352
|
/* a stored attachment: thumbnail for images, name + size for everything else; click opens / downloads it */
|
|
@@ -288,18 +367,21 @@
|
|
|
288
367
|
h('div', {class: 'qhint', text: as.length ? 'Type your answer in the ANSWER box (you can attach files and use @), or choose Proceed with assumptions.' : e.team ? 'Type your answer in the ANSWER box (you can attach files and use @). The run is paused until you answer.' : 'Type your answer in the ANSWER box (you can attach files and use @). No team starts until you answer.'}),
|
|
289
368
|
h('button', {class: 'primary qgo', type: 'button', text: 'Answer now ▸', onclick: function () { $('msg').focus(); }})])); feedScroll(); count();
|
|
290
369
|
}
|
|
291
|
-
function feedSub(parent, t) { $('feed').appendChild(h('div', {class: 'fsub', text: '↳ ' + nm(parent) + ' ' + t})); feedScroll(); }
|
|
370
|
+
function feedSub(parent, t) { $('feed').appendChild(h('div', {class: 'fsub' + (curTab && curTab !== parent ? ' fhide' : ''), 'data-agent': parent, text: '↳ ' + nm(parent) + ' ' + t})); feedScroll(); }
|
|
292
371
|
function count() { $('feedcount').textContent = S.events.filter(function (e) { return e.type === 'agent.message'; }).length + ' MESSAGES'; }
|
|
293
372
|
function typeInto(el, text) {
|
|
294
373
|
if (S.history) { el.textContent = text; return; }
|
|
295
|
-
|
|
374
|
+
if (RM.matches) { el.textContent = text; return; }
|
|
375
|
+
/* typewriter: one character per tick, long texts speed up so a message never takes more than ~6 s */
|
|
376
|
+
var i = 0, step = Math.max(1, Math.ceil(text.length / 240)), t = setInterval(function () { i += step; el.textContent = text.slice(0, i); feedScroll(); if (i >= text.length) clearInterval(t); }, 24);
|
|
296
377
|
}
|
|
297
378
|
function feedMsg(e) {
|
|
298
379
|
var col = tcol(e.agentId), short = plain(e.text); if (short.length > 280) short = short.slice(0, 279) + '…';
|
|
299
380
|
var txt = h('div', {class: 'ft'});
|
|
300
|
-
var
|
|
301
|
-
|
|
302
|
-
|
|
381
|
+
var a = A(e.agentId), arts = (e.text.match(/(?:^|[\s`(])((?:[\w.-]+\/)*[\w-]+\.(?:ts|js|mjs|tsx|jsx|vue|css|html|json|md|py|go|rs|java|sql|yml|yaml|sh|txt))(?=[\s`),.:;]|$)/g) || []).map(function (x) { return x.replace(/^[\s`(]/, ''); }).filter(function (x, i, l) { return l.indexOf(x) === i; }).slice(0, 4);
|
|
382
|
+
var row = h('div', {class: 'fm' + (curTab && curTab !== e.agentId ? ' fhide' : ''), 'data-agent': e.agentId, role: 'button', tabIndex: 0, style: '--tc:' + col + ';--tg:' + hexA(col, .3) + ';--tg2:' + hexA(col, .1), onclick: function () { showMessage({from: e.agentId, to: e.to, at: e.at, tokens: e.tokens, text: e.text}); }, onkeydown: function (ev) { if (ev.key === 'Enter') this.click(); }}, [
|
|
383
|
+
a ? avatarEl(a.cfg, 48, {cls: 'fava'}) : h('div', {class: 'fav', text: ini(e.agentId)}),
|
|
384
|
+
h('div', {class: 'fb'}, [h('div', {class: 'fh'}, [h('b', {text: nm(e.agentId)}), h('span', {class: 'to', text: '→ ' + nm(e.to)}), e.round ? h('span', {class: 'rnd', text: 'round ' + e.round}) : null, h('span', {class: 'tm', text: clock(e.at) + (e.tokens ? ' · ' + e.tokens + ' tok' : '')})]), txt, arts.length ? h('div', {class: 'farts'}, arts.map(function (f) { return h('span', {class: 'fart mono', title: 'File named in this message', text: f}); })) : null])]);
|
|
303
385
|
$('feed').appendChild(row); typeInto(txt, short); feedScroll(); count();
|
|
304
386
|
}
|
|
305
387
|
|
|
@@ -323,7 +405,7 @@
|
|
|
323
405
|
function comicHandoff(e) {
|
|
324
406
|
var p = panelEl(e.from, 'wide'); p.style.setProperty('--pg', hexA(TC[e.to] || TC.director, .5));
|
|
325
407
|
p.appendChild(h('div', {class: 'cap', text: 'HANDOFF!'}));
|
|
326
|
-
p.appendChild(h('div', {class: 'cscene', style: 'justify-content:space-around;align-items:center'}, [h('div', {class: 'cwho', style: 'color:' + TC[e.from], text: TL[e.from]}), h('div', {class: 'onom', text: '
|
|
408
|
+
p.appendChild(h('div', {class: 'cscene', style: 'justify-content:space-around;align-items:center'}, [h('div', {class: 'cwho', style: 'color:' + TC[e.from], text: TL[e.from]}), h('div', {class: 'onom', text: 'WHOOSH!'}), h('div', {class: 'cwho', style: 'color:' + TC[e.to], text: TL[e.to]})]));
|
|
327
409
|
p.appendChild(h('div', {class: 'sm', text: e.title})); addPanel(p);
|
|
328
410
|
}
|
|
329
411
|
function comicVerdict(e) {
|
|
@@ -412,29 +494,68 @@
|
|
|
412
494
|
var mx = Math.max(1, Math.max.apply(null, c)), pts = c.map(function (v, i) { return (i / (B - 1) * 100).toFixed(1) + ',' + (15 - v / mx * 14).toFixed(1); }).join(' ');
|
|
413
495
|
return '<svg class="spark" viewBox="0 0 100 16" preserveAspectRatio="none"><polyline fill="none" stroke="' + color + '" stroke-width="1.4" points="' + pts + '"/></svg>';
|
|
414
496
|
}
|
|
497
|
+
var UI = (function () { try { return JSON.parse(localStorage.getItem('ckit-ui') || '{}') || {}; } catch (e) { return {}; } })();
|
|
498
|
+
UI.collapsed = UI.collapsed || {};
|
|
499
|
+
function saveUI() { try { localStorage.setItem('ckit-ui', JSON.stringify({collapsed: UI.collapsed, dockView: UI.dockView, activeOnly: UI.activeOnly})); } catch (e) { /* private mode */ } }
|
|
500
|
+
var ICON = {
|
|
501
|
+
chat: '<svg viewBox="0 0 16 16"><path d="M2 3h12v8H6l-4 3z" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>',
|
|
502
|
+
crown: '<svg viewBox="0 0 16 16"><path d="M2 12h12l1-7-4 3-3-5-3 5-4-3z" fill="currentColor"/></svg>',
|
|
503
|
+
filter: '<svg viewBox="0 0 16 16"><path d="M2 4h12M4 8h8M6 12h4" stroke="currentColor" stroke-width="1.6" fill="none"/></svg>',
|
|
504
|
+
search: '<svg viewBox="0 0 16 16"><circle cx="7" cy="7" r="4.5" fill="none" stroke="currentColor" stroke-width="1.5"/><path d="M10.5 10.5L14 14" stroke="currentColor" stroke-width="1.5"/></svg>',
|
|
505
|
+
arrow: '<svg viewBox="0 0 16 16"><path d="M2 8h11M9 4l4 4-4 4" fill="none" stroke="currentColor" stroke-width="1.6"/></svg>',
|
|
506
|
+
check: '<svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="6.5" fill="none" stroke="currentColor" stroke-width="1.4"/><path d="M5 8.2l2 2 4-4.4" fill="none" stroke="currentColor" stroke-width="1.6"/></svg>',
|
|
507
|
+
cross: '<svg viewBox="0 0 16 16"><circle cx="8" cy="8" r="6.5" fill="none" stroke="currentColor" stroke-width="1.4"/><path d="M5.5 5.5l5 5M10.5 5.5l-5 5" stroke="currentColor" stroke-width="1.6"/></svg>',
|
|
508
|
+
back: '<svg viewBox="0 0 16 16"><path d="M6 4L2 8l4 4M2 8h8a4 4 0 010 8" fill="none" stroke="currentColor" stroke-width="1.5"/></svg>'};
|
|
509
|
+
function ico(name, cls) { var sp = h('span', {class: 'ico' + (cls ? ' ' + cls : '')}); sp.innerHTML = ICON[name] || ''; return sp; } /* static markup only */
|
|
510
|
+
function stateWord(a) { return a.state === 'thinking' ? (a.label || a.activity || 'working…') : a.state === 'done' ? 'finished turn' : a.state === 'failed' ? 'failed' : a.task ? 'waiting' : 'idle'; }
|
|
511
|
+
function rosterShell() {
|
|
512
|
+
var r = $('roster'); if (r.querySelector('.rlist')) return r;
|
|
513
|
+
var q = h('input', {type: 'search', class: 'rq', placeholder: 'Tìm agent…', 'aria-label': 'Search agents', spellcheck: false, autocomplete: 'off'});
|
|
514
|
+
q.addEventListener('input', function () { S.dirty = true; });
|
|
515
|
+
q.addEventListener('keydown', function (e) { if (e.key === 'Escape') { q.value = ''; S.dirty = true; q.blur(); } });
|
|
516
|
+
var fbtn = h('button', {class: 'iconbtn' + (UI.activeOnly ? ' on' : ''), type: 'button', title: 'Show only working agents', 'aria-label': 'Filter: only working agents', onclick: function () { UI.activeOnly = !UI.activeOnly; fbtn.classList.toggle('on', !!UI.activeOnly); fbtn.setAttribute('aria-pressed', String(!!UI.activeOnly)); saveUI(); S.dirty = true; }});
|
|
517
|
+
fbtn.appendChild(ico('filter'));
|
|
518
|
+
r.appendChild(h('div', {class: 'rhead'}, [h('span', {class: 'ml rtitle'}, ['AGENTS ', h('b', {class: 'rcount', text: '(0)'})]), fbtn]));
|
|
519
|
+
r.appendChild(h('label', {class: 'rsearch'}, [ico('search'), q, h('kbd', {text: '⌘K'})]));
|
|
520
|
+
r.appendChild(h('div', {class: 'rlist'}));
|
|
521
|
+
r.appendChild(h('button', {class: 'rnew', type: 'button', title: 'Agents are added in Config (one place for all settings)', text: '+ Tạo Agent mới', onclick: function () { setView('settings'); }}));
|
|
522
|
+
document.addEventListener('keydown', function (e) { if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === 'k' && S.view === 'live') { e.preventDefault(); drawer('roster', true); q.focus(); q.select(); } });
|
|
523
|
+
return r;
|
|
524
|
+
}
|
|
415
525
|
function renderRoster() {
|
|
416
|
-
var r =
|
|
526
|
+
var r = rosterShell(), list = r.querySelector('.rlist'), keep = list.scrollTop, q = r.querySelector('.rq').value.trim().toLowerCase();
|
|
527
|
+
var frag = document.createDocumentFragment(), total = 0;
|
|
417
528
|
var dimmed = function (t) { return !!S.lane && t !== 'director' && S.lane.order.indexOf(t) < 0; };
|
|
418
529
|
['director'].concat(orderOf(S.config)).forEach(function (team) {
|
|
419
|
-
var
|
|
420
|
-
|
|
530
|
+
var all = S.order.filter(function (i) { return A(i).cfg.team === team; }); if (!all.length) return; total += all.length;
|
|
531
|
+
var ids = all.filter(function (id) { var a = A(id), c = a.cfg; if (UI.activeOnly && a.state !== 'thinking') return false; return !q || (c.name + ' ' + c.cli + ' ' + (c.model || '') + ' ' + (TL[team] || '') + ' ' + (c.short || '')).toLowerCase().indexOf(q) >= 0; });
|
|
532
|
+
if (!ids.length && (q || UI.activeOnly)) return;
|
|
533
|
+
var col = !!UI.collapsed[team] && !q, c = TC[team];
|
|
534
|
+
var hd = h('button', {class: 'rteam' + (dimmed(team) ? ' dim' : '') + (col ? ' col' : ''), type: 'button', style: 'color:' + c, 'aria-expanded': String(!col), title: col ? 'Expand' : 'Collapse', onclick: function () { UI.collapsed[team] = !UI.collapsed[team]; saveUI(); S.dirty = true; }}, [h('i', {style: 'background:' + c}), h('span', {text: TL[team] + ' (' + all.length + ')'}), team === 'director' ? ico('crown', 'crown') : null, h('span', {class: 'chev', text: col ? '▸' : '▾'})]);
|
|
535
|
+
frag.appendChild(hd); if (col) return;
|
|
421
536
|
ids.forEach(function (id) {
|
|
422
|
-
var a = A(id),
|
|
423
|
-
var
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
if (work) {
|
|
537
|
+
var a = A(id), work = a.state === 'thinking', sel = S.selected === id;
|
|
538
|
+
var el = h('div', {class: 'tile ' + a.state + (sel ? ' sel' : '') + (dimmed(team) ? ' dim' : ''), role: 'button', tabIndex: 0, 'aria-pressed': String(sel), style: '--tc:' + c + ';--tg:' + hexA(c, .35), title: a.cfg.name + ' — ' + a.cfg.cli + (a.cfg.model ? ' · ' + a.cfg.model : ''),
|
|
539
|
+
onclick: function () { selectAgent(sel ? null : id); }, onkeydown: function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); selectAgent(sel ? null : id); } }});
|
|
540
|
+
var elapsed = work && a.t0 ? fmtT(performance.now() - a.t0) : '';
|
|
541
|
+
el.appendChild(avatarEl(a.cfg, 44, {slot: 'r', state: a.state}));
|
|
542
|
+
el.appendChild(h('div', {class: 'tmain'}, [
|
|
543
|
+
h('div', {class: 'tl1'}, [h('b', {class: 'tname', text: a.cfg.name}), team === 'director' ? ico('crown', 'crown') : null, h('span', {class: 'tel mono', text: elapsed})]),
|
|
544
|
+
h('div', {class: 'tact ' + a.state}, [h('i'), h('span', {text: stateWord(a)})]),
|
|
545
|
+
h('div', {class: 'tl3'}, [h('span', {class: 'tcli mono'}, [h('span', {text: eng(a.cfg.cli).label}), h('span', {class: 'tmodel', text: a.cfg.model || 'default model'})]), h('span', {class: 'tstat mono'}, [ico('chat'), h('span', {text: String(a.msgs)}), h('b', {text: fmtN(a.tokens)})])])]));
|
|
546
|
+
if (work && a.total) el.appendChild(h('div', {class: 'bar', title: 'Step ' + a.step + ' of ' + a.total}, [h('b', {style: 'width:' + Math.min(100, a.step / a.total * 100) + '%'})]));
|
|
432
547
|
var run = Object.keys(a.subs).filter(function (k) { return a.subs[k].state === 'run'; });
|
|
433
548
|
if (run.length) { var sb = h('div', {class: 'subs'}, [h('span', {class: 'ml', text: 'Subagents (' + run.length + ' active)'})]); run.forEach(function (k) { sb.appendChild(h('div', {class: 'subl'}, [h('b', {text: '◆ ' + a.subs[k].kind + ' '}), a.subs[k].text])); }); el.appendChild(sb); }
|
|
434
|
-
|
|
549
|
+
frag.appendChild(el);
|
|
435
550
|
});
|
|
436
551
|
});
|
|
437
|
-
|
|
552
|
+
if (!frag.childNodes.length) frag.appendChild(h('div', {class: 'rempty', text: q ? 'No agent matches “' + q + '”.' : UI.activeOnly ? 'No agent is working right now.' : 'No agents configured.'}));
|
|
553
|
+
list.innerHTML = ''; list.appendChild(frag); list.scrollTop = keep;
|
|
554
|
+
r.querySelector('.rcount').textContent = '(' + total + ')';
|
|
555
|
+
}
|
|
556
|
+
/* one selection drives roster, topology, inspector and the conversation tab */
|
|
557
|
+
function selectAgent(id) {
|
|
558
|
+
S.selected = id || null; net.select(S.selected); setTab(S.selected || ''); S.dirty = true;
|
|
438
559
|
}
|
|
439
560
|
function kv(k, v) { return h('div', {class: 'kv'}, [h('span', {text: k}), h('span', {class: 'mono', text: String(v)})]); }
|
|
440
561
|
function lineSvg(vals, col) {
|
|
@@ -447,39 +568,76 @@
|
|
|
447
568
|
var mx = Math.max(1, Math.max.apply(null, c));
|
|
448
569
|
return '<svg class="spark" style="height:32px" viewBox="0 0 100 32" preserveAspectRatio="none">' + c.map(function (v, i) { return '<rect x="' + (i * 10 + 1) + '" y="' + (32 - v / mx * 30) + '" width="8" height="' + (v / mx * 30) + '" fill="#A36BFF"/>'; }).join('') + '</svg>';
|
|
449
570
|
}
|
|
571
|
+
function hm(iso) { var d = new Date(iso); return isNaN(d) ? '' : d.toTimeString().slice(0, 5); }
|
|
572
|
+
function abbr(id) { if (id === 'director') return 'DIR'; if (A(id)) return net.initials(A(id).cfg); return String(teamLbl(id)).toUpperCase().slice(0, 4); }
|
|
573
|
+
function secHead(title, extra) { return h('div', {class: 'ish'}, [h('span', {text: title}), extra || null]); }
|
|
574
|
+
function flowRows(max) {
|
|
575
|
+
var rows = [];
|
|
576
|
+
S.handoffs.forEach(function (e) { rows.push({at: e.at, icon: 'arrow', cls: 'ho', a: e.from, b: e.to, t: e.title, open: e.text ? function () { showMessage({from: e.from, to: e.to, at: e.at, text: e.text}); } : null}); });
|
|
577
|
+
S.verdicts.forEach(function (e) { var pass = e.verdict === 'PASS'; rows.push({at: e.at, icon: pass ? 'check' : 'cross', cls: pass ? 'pass' : 'fail', a: e.type === 'review.verdict' ? 'director' : 'qc', b: e.type === 'review.verdict' ? 'delivery' : pass ? 'director' : 'implement', t: (e.type === 'review.verdict' ? 'Review ' : 'QC ') + e.verdict + (e.loop ? ' · loop ' + e.loop : '') + ' — ' + e.summary}); });
|
|
578
|
+
S.flowBacks.forEach(function (e) { rows.push({at: e.at, icon: 'back', cls: 'ret', a: e.from, b: e.to, t: (e.kind === 'ask' ? 'asked: ' : 'returned: ') + e.reason}); });
|
|
579
|
+
rows.sort(function (x, y) { return Date.parse(x.at) - Date.parse(y.at); });
|
|
580
|
+
return rows.slice(-max);
|
|
581
|
+
}
|
|
582
|
+
function activityRows(max, only) {
|
|
583
|
+
var out = [];
|
|
584
|
+
for (var i = S.events.length - 1; i >= 0 && out.length < max; i--) {
|
|
585
|
+
var e = S.events[i], t = '';
|
|
586
|
+
if (only && e.agentId !== only) continue;
|
|
587
|
+
if (e.type === 'agent.started') t = 'started: ' + plain(String(e.task || '')); else if (e.type === 'agent.step') t = 'step ' + e.step + (e.total ? '/' + e.total : '') + ' · ' + e.label;
|
|
588
|
+
else if (e.type === 'agent.activity') t = e.text; else if (e.type === 'agent.message') t = '→ ' + nm(e.to) + ': ' + plain(e.text); else if (e.type === 'agent.failed') t = 'failed: ' + plain(String(e.reason || ''));
|
|
589
|
+
else if (e.type === 'subagent.started') t = 'spawned ' + (e.kind || 'subagent'); else continue;
|
|
590
|
+
out.push({at: e.at, id: e.agentId, t: t, k: e.type});
|
|
591
|
+
}
|
|
592
|
+
return out;
|
|
593
|
+
}
|
|
594
|
+
function teleRow(label, value, na, frac) {
|
|
595
|
+
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
|
+
}
|
|
450
597
|
function renderInspector() {
|
|
451
|
-
var r = $('inspector'), keep = r.scrollTop
|
|
598
|
+
var r = $('inspector'), keep = r.scrollTop, frag = document.createDocumentFragment();
|
|
452
599
|
var a = S.selected && A(S.selected);
|
|
453
600
|
if (a) {
|
|
454
|
-
var c = TC[a.cfg.team];
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
kv('Engine', a.cfg.cli), kv('Model', a.cfg.model || 'default'), kv('Access', a.cfg.access === 'write' ? 'read + write' : 'read only'), a.cfg.baseUrl ? kv('Endpoint', a.cfg.baseUrl.replace(/^https?:\/\//, '').slice(0, 26)) : null, kv('State', a.
|
|
458
|
-
|
|
601
|
+
var c = TC[a.cfg.team] || '#8A9AAF';
|
|
602
|
+
frag.appendChild(secHead('AGENT INSPECTOR', h('button', {class: 'iconbtn', type: 'button', title: 'Close inspector', 'aria-label': 'Deselect agent', text: '✕', onclick: function () { selectAgent(null); }})));
|
|
603
|
+
frag.appendChild(h('div', {class: 'icard agent', style: '--tc:' + c}, [h('div', {class: 'aghead'}, [avatarEl(a.cfg, 64, {slot: 'i', state: a.state}), h('div', {class: 'agid'}, [h('b', {text: a.cfg.name}), h('div', {class: 'ml', style: 'color:' + c, text: TL[a.cfg.team]}), h('button', {class: 'chip', type: 'button', text: 'Change avatar', title: 'Pick a portrait. The agent keeps running; only the picture changes.', onclick: function () { avatarPicker(a.cfg, function (v) { saveAvatar(a.cfg.id, v); }); }})])]),
|
|
604
|
+
kv('Engine', eng(a.cfg.cli).label + ' (' + a.cfg.cli + ')'), kv('Model', a.cfg.model || 'default'), kv('Access', a.cfg.access === 'write' ? 'read + write' : 'read only'), a.cfg.baseUrl ? kv('Endpoint', a.cfg.baseUrl.replace(/^https?:\/\//, '').slice(0, 26)) : null, kv('State', stateWord(a)), kv('Messages', a.msgs), kv('Tokens', fmtN(a.tokens)),
|
|
605
|
+
a.total ? kv('Step', a.step + ' / ' + a.total) : null,
|
|
606
|
+
h('div', {class: 'ml', style: 'margin-top:6px', text: 'Current task'}), h('div', {class: 'agtask', text: a.task || '—'})]));
|
|
459
607
|
var af = (S.fails || []).filter(function (f) { return f.agentId === a.cfg.id; }).pop();
|
|
460
|
-
if (af)
|
|
461
|
-
|
|
462
|
-
a.outputs.forEach(function (o) {
|
|
463
|
-
if (!a.outputs.length)
|
|
464
|
-
r.appendChild(h('button', {text: '× deselect', style: 'margin-top:6px', onclick: function () { S.selected = null; net.select(null); S.dirty = true; }}));
|
|
608
|
+
if (af) frag.appendChild(h('div', {class: 'card fail failcard'}, [h('b', {class: 'bad', text: 'WHY IT FAILED'}), h('pre', {text: af.reason}), h('div', {class: 'fix'}, [h('b', {text: 'How to fix '}), fixHint(af.reason, a.cfg)]), h('div', {style: 'display:flex;gap:6px;margin-top:8px'}, [h('button', {text: 'Full details', onclick: showFailure}), h('button', {class: 'primary', text: 'Open Config', onclick: function () { setView('settings'); }})])]));
|
|
609
|
+
frag.appendChild(secHead('RECENT OUTPUTS', a.outputs.length > 2 ? h('span', {class: 'ml', text: '2 / ' + a.outputs.length}) : null));
|
|
610
|
+
a.outputs.slice(0, 2).forEach(function (o) { frag.appendChild(h('div', {class: 'out', text: o.text.replace(/\s+/g, ' '), onclick: function () { showMessage({from: a.cfg.id, to: o.to, at: o.at, tokens: o.tokens, text: o.text}); }})); });
|
|
611
|
+
if (!a.outputs.length) frag.appendChild(h('div', {class: 'iempty', text: 'No output yet.'}));
|
|
465
612
|
} else {
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
S.
|
|
472
|
-
if (!S.handoffs.length && !S.verdicts.length) r.appendChild(h('div', {class: 'tact', text: 'Click an agent to inspect it.'}));
|
|
473
|
-
if (S.atts && S.atts.length) { r.appendChild(h('h3', {style: 'margin-top:12px', text: 'Attachments · ' + S.atts.length})); r.appendChild(h('div', {class: 'tact', text: 'Every team gets these with the request.'})); r.appendChild(h('div', {class: 'fatts', style: 'margin-top:6px'}, S.atts.map(attChip))); }
|
|
613
|
+
frag.appendChild(secHead('HANDOFFS & VERDICTS', h('span', {class: 'ml', text: String(S.handoffs.length + S.verdicts.length)})));
|
|
614
|
+
var rows = flowRows(6), box = h('div', {class: 'icard rows'});
|
|
615
|
+
rows.forEach(function (x) { box.appendChild(h('div', {class: 'frow ' + x.cls + (x.open ? ' click' : ''), title: x.t, onclick: x.open, role: x.open ? 'button' : null, tabIndex: x.open ? 0 : null}, [ico(x.icon), h('span', {class: 'fr'}, [h('b', {class: 'mono', text: abbr(x.a) + ' → ' + abbr(x.b)}), ' · ' + x.t]), h('span', {class: 'mono tm', text: hm(x.at)})])); });
|
|
616
|
+
if (!rows.length) box.appendChild(h('div', {class: 'iempty', text: 'No handoff or verdict yet. They appear here as the teams pass work along.'}));
|
|
617
|
+
frag.appendChild(box);
|
|
618
|
+
if (S.atts && S.atts.length) { frag.appendChild(secHead('ATTACHMENTS · ' + S.atts.length)); frag.appendChild(h('div', {class: 'fatts', style: 'margin-bottom:8px'}, S.atts.map(attChip))); }
|
|
474
619
|
}
|
|
475
|
-
|
|
476
|
-
var
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
var
|
|
482
|
-
|
|
620
|
+
/* telemetry: only measured values; what CKit cannot measure says N/A */
|
|
621
|
+
var sl = stageList(S.config), n = sl.length, doneN = S.outcome === 'delivered' ? n : Math.max(0, Math.min(n, S.stageIdx)), pct = S.stageIdx < 0 && !S.outcome ? 0 : doneN / Math.max(1, n);
|
|
622
|
+
frag.appendChild(secHead('TELEMETRY'));
|
|
623
|
+
var tele = h('div', {class: 'icard tele2'}), gauge = h('div', {class: 'gauge2'}), circ = 2 * Math.PI * 30;
|
|
624
|
+
gauge.innerHTML = '<svg width="78" height="78" viewBox="0 0 78 78" role="img" aria-label="Flow progress"><circle cx="39" cy="39" r="30" fill="none" stroke="#16223a" stroke-width="7"/><circle cx="39" cy="39" r="30" fill="none" stroke="#21D6E8" stroke-width="7" stroke-linecap="round" stroke-dasharray="' + (circ * pct).toFixed(1) + ' ' + circ.toFixed(1) + '" transform="rotate(-90 39 39)"/><text x="39" y="44" text-anchor="middle" fill="#fff" font-family="ui-monospace,Menlo,monospace" font-size="16" font-weight="700">' + Math.round(pct * 100) + '%</text></svg>';
|
|
625
|
+
gauge.appendChild(h('span', {class: 'ml', text: 'STAGES ' + doneN + '/' + n}));
|
|
626
|
+
var last = S.verdicts[S.verdicts.length - 1], verified = !!last && last.verdict === 'PASS';
|
|
627
|
+
var nums = h('div', {class: 'tnums'}, [kv('TOKENS', S.tokens.toLocaleString('en-US')), kv('MESSAGES', S.msgs), kv('COST (est.)', 'N/A'), kv('OUTCOME', S.outcome ? (S.outcome === 'delivered' ? (verified ? 'delivered · verified' : 'delivered · unverified') : S.outcome) : S.run ? 'in progress' : '—')]);
|
|
628
|
+
nums.lastChild.title = 'Delivered = the run finished. Verified = the last QC / Director review verdict was PASS.';
|
|
629
|
+
tele.appendChild(h('div', {class: 'tgrid'}, [gauge, nums]));
|
|
630
|
+
tele.appendChild(teleRow('CPU', 'N/A', true)); tele.appendChild(teleRow('RAM', 'N/A', true));
|
|
631
|
+
var tk = h('div', {class: 'tspark'}); tk.innerHTML = '<span class="ml">TOKENS / TIME</span>' + lineSvg(S.tokBuckets.map(function (x) { return x[1]; }), '#4F8CFF'); tele.appendChild(tk);
|
|
632
|
+
var st = Object.keys(S.stageTimes).slice(-4);
|
|
633
|
+
if (st.length) tele.appendChild(h('div', {class: 'tstages'}, st.map(function (k) { return h('span', {class: 'mono', text: k.replace('director-intake', 'intake').replace('ba-discussion', 'ba').replace(/^x:/, '') + ' ' + fmtT(S.stageTimes[k])}); })));
|
|
634
|
+
frag.appendChild(tele);
|
|
635
|
+
frag.appendChild(secHead('RECENT ACTIVITY'));
|
|
636
|
+
var act = activityRows(a ? 6 : 8, a ? a.cfg.id : null), ab = h('div', {class: 'icard rows'});
|
|
637
|
+
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
|
+
if (!act.length) ab.appendChild(h('div', {class: 'iempty', text: 'Nothing has happened yet.'}));
|
|
639
|
+
frag.appendChild(ab);
|
|
640
|
+
r.innerHTML = ''; r.appendChild(frag); r.scrollTop = keep;
|
|
483
641
|
}
|
|
484
642
|
function renderStrip() {
|
|
485
643
|
var st = $('stages'); st.innerHTML = '';
|
|
@@ -487,7 +645,7 @@
|
|
|
487
645
|
$('lanename').textContent = S.lane ? 'Lane: ' + S.lane.name : ''; $('lanename').hidden = !S.lane;
|
|
488
646
|
list.forEach(function (x, i) {
|
|
489
647
|
var cls = cur > i ? 'done' : cur === i ? 'cur' : '', dur = S.stageTimes[x.key], xs = x.key.slice(0, 2) === 'x:';
|
|
490
|
-
st.appendChild(h('div', {class: 'st ' + cls + (x.key === 'review' ? ' rv' : ''), style: xs ? 'border-color:' + hexA(TC[x.team] || '#8A9AAF', .6) : ''}, [x.label, cls === 'done' && dur ? h('small', {text: fmtT(dur)}) : null, x.key === 'qc' && S.loop > 1 ? h('small', {text: 'loop ' + S.loop}) : null]));
|
|
648
|
+
st.appendChild(h('div', {class: 'st ' + cls + (x.key === 'review' ? ' rv' : ''), role: 'listitem', 'aria-current': cls === 'cur' ? 'step' : null, title: x.label + (cls === 'done' ? ' · done' + (dur ? ' in ' + fmtT(dur) : '') : cls === 'cur' ? ' · in progress' : ' · pending'), style: '--sc:' + (TC[x.team] || '#8A9AAF') + (xs ? ';border-color:' + hexA(TC[x.team] || '#8A9AAF', .6) : '')}, [cls === 'done' ? h('span', {class: 'sok', text: '✓'}) : null, String(x.label).toUpperCase(), cls === 'done' && dur ? h('small', {text: fmtT(dur)}) : null, x.key === 'qc' && S.loop > 1 ? h('small', {text: 'loop ' + S.loop}) : null]));
|
|
491
649
|
});
|
|
492
650
|
}
|
|
493
651
|
function renderTop() {
|
|
@@ -498,12 +656,19 @@
|
|
|
498
656
|
var end = S.outcome || S.replay ? (S.lastAt || S.started) : Date.now();
|
|
499
657
|
$('elapsed').textContent = S.started ? fmtT(end - S.started) : '00:00'; $('tokens').textContent = fmtN(S.tokens); $('msgs').textContent = S.msgs;
|
|
500
658
|
$('active').textContent = S.order.filter(function (i) { return A(i).state === 'thinking'; }).length + activeSubs();
|
|
501
|
-
$('idleHint').style.display =
|
|
659
|
+
$('idleHint').style.display = 'none'; $('now').style.display = S.run ? '' : 'none';
|
|
660
|
+
var mt = $('mtag'), mg = $('mgoal'), mtxt = S.run ? (S.run.goal || 'Run ' + (S.run.runId || '')) : 'No active run — describe a mission in the box below and press Enter.';
|
|
661
|
+
mt.textContent = live ? (S.waiting ? 'WAITING' : S.replay ? 'REPLAY' : 'RUNNING') : S.outcome ? String(S.outcome).toUpperCase() : 'READY';
|
|
662
|
+
mt.className = 'mtag ' + (live ? (S.waiting ? 'wait' : 'run') : S.outcome === 'delivered' ? 'ok' : S.outcome ? 'bad' : '');
|
|
663
|
+
if (mg.textContent !== mtxt) { mg.textContent = mtxt; mg.title = mtxt; }
|
|
664
|
+
$('bHint').hidden = !!live;
|
|
665
|
+
net.setHubStats(S.run || S.msgs ? ['⏱ ' + $('elapsed').textContent, String(S.msgs) + ' MSG', fmtN(S.tokens) + ' TOK'] : []);
|
|
666
|
+
renderTabs(); flushTerm();
|
|
502
667
|
/* composer: talks to the Director during a run, starts a mission when nothing is running */
|
|
503
668
|
var sim = simDefault(), wt = !!(live && S.waiting), mode = wt ? 'wait' + (S.waiting.assumptions ? 'A' : '') + S.waiting.round + (S.waiting.team || '') : live ? 'live' : sim ? 'sim' : 'real';
|
|
504
669
|
if (S.cmode !== mode) {
|
|
505
670
|
S.cmode = mode; $('clabel').textContent = wt ? 'ANSWER → DIRECTOR' : live ? 'OWNER → DIRECTOR' : 'NEW MISSION → DIRECTOR'; $('send').textContent = wt ? 'Send answer ▸' : live ? 'Send ▸' : 'Start ▸'; $('chips').style.display = live && !wt ? '' : 'none';
|
|
506
|
-
$('composer').classList.toggle('wait', wt); $('msg').placeholder = wt ? 'Type your answer and press Enter… (@ for a file, 📎 to attach)' : live ? '
|
|
671
|
+
$('composer').classList.toggle('wait', wt); $('msg').placeholder = wt ? 'Type your answer and press Enter… (@ for a file, 📎 to attach)' : live ? 'Gửi tin nhắn cho Director… (Enter to send, @ for a file)' : 'Describe the mission and press Enter to start the team… Type @ to point at a file or folder.';
|
|
507
672
|
$('cnote').textContent = wt ? (S.waiting.team ? 'The run is paused: the Director is waiting for your decision.' : 'The Director is waiting for you: no team has started and nothing is running.') : live ? '' : sim ? 'Demo mode: no real agent is configured, so this starts a simulated run.' : 'Starts real agents in ' + shortPath(S.projectRoot); $('cnote').title = S.projectRoot || '';
|
|
508
673
|
waitButtons(wt); if (wt) setTimeout(function () { $('msg').focus(); }, 30);
|
|
509
674
|
}
|
|
@@ -531,13 +696,26 @@
|
|
|
531
696
|
/* views */
|
|
532
697
|
function setView(v) {
|
|
533
698
|
S.view = v; ['live', 'settings', 'runs'].forEach(function (x) { $(x).hidden = x !== v; });
|
|
534
|
-
$('strip').hidden = v !== 'live'; $('bLive').classList.toggle('on', v === 'live' && !S.comic); $('bCfg').classList.toggle('on', v === 'settings');
|
|
699
|
+
$('strip').hidden = v !== 'live'; $('bLive').classList.toggle('on', v === 'live' && !S.comic); $('bCfg').classList.toggle('on', v === 'settings'); railSync();
|
|
535
700
|
if (v === 'settings') mountEditor($('settings'), false);
|
|
536
701
|
if (v === 'runs') renderRuns();
|
|
537
702
|
if (v === 'live') setTimeout(net.resize, 30);
|
|
538
703
|
if (location.hash.slice(1) !== v) history.replaceState(null, '', '#' + v);
|
|
539
704
|
}
|
|
540
|
-
function setComic(on) { S.comic = on; $('comic').hidden = !on; document.body.classList.toggle('comicmode', on); $('bComic').classList.toggle('on', on); $('bLive').classList.toggle('on', !on); if (on) $('comic').scrollTop = 1e9; }
|
|
705
|
+
function setComic(on) { S.comic = on; $('comic').hidden = !on; document.body.classList.toggle('comicmode', on); $('bComic').classList.toggle('on', on); $('bLive').classList.toggle('on', !on); if (on) $('comic').scrollTop = 1e9; railSync(); }
|
|
706
|
+
function railSync() {
|
|
707
|
+
var on = {rHome: S.view === 'live' && !S.comic, rTopo: S.view === 'live' && !!S.comic, rHist: S.view === 'runs', rSet: S.view === 'settings', rAgents: S.view === 'live' && !document.body.classList.contains('noroster')};
|
|
708
|
+
Object.keys(on).forEach(function (k) { var b = $(k); if (b) { b.classList.toggle('on', on[k]); b.setAttribute('aria-pressed', String(on[k])); } });
|
|
709
|
+
}
|
|
710
|
+
$('rHome').onclick = function () { setComic(false); setView('live'); };
|
|
711
|
+
$('rAgents').onclick = function () { if (S.view !== 'live') setView('live'); if (matchMedia('(max-height:720px),(max-width:1180px)').matches) drawer('roster'); else { document.body.classList.toggle('noroster'); setTimeout(net.resize, 30); } railSync(); };
|
|
712
|
+
$('rTopo').onclick = function () { setView('live'); setComic(!S.comic); };
|
|
713
|
+
$('rCode').onclick = function () { if (window.__ckExplorer) window.__ckExplorer.open(''); };
|
|
714
|
+
$('rData').onclick = function () { if (S.run && S.outcome) showArtifact('Run report', 'report.md'); else toast('The report appears here when a run finishes.'); };
|
|
715
|
+
$('rHist').onclick = function () { setView('runs'); };
|
|
716
|
+
$('rSet').onclick = function () { setView('settings'); };
|
|
717
|
+
$('wsbox').onclick = function () { if (window.__ckExplorer) window.__ckExplorer.open(''); };
|
|
718
|
+
$('wsbox').setAttribute('role', 'button'); $('wsbox').tabIndex = 0; $('wsbox').onkeydown = function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); $('wsbox').onclick(); } };
|
|
541
719
|
$('bLive').onclick = function () { setComic(false); setView('live'); };
|
|
542
720
|
$('bComic').onclick = function () { setView('live'); setComic(!S.comic); };
|
|
543
721
|
$('bRuns').onclick = function () { setView('runs'); };
|
|
@@ -735,16 +913,50 @@
|
|
|
735
913
|
/* compact layout: roster/inspector are drawers */
|
|
736
914
|
var picked = false;
|
|
737
915
|
function drawer(id, on) { $(id).classList.toggle('pop', on === undefined ? !$(id).classList.contains('pop') : on); }
|
|
738
|
-
net.onSelect(function (id) { S.selected = id; S.dirty = true; picked = true; drawer('inspector', true); });
|
|
916
|
+
net.onSelect(function (id) { S.selected = id; setTab(id || ''); S.dirty = true; picked = true; drawer('inspector', true); });
|
|
739
917
|
$('net').addEventListener('click', function () { if (picked) { picked = false; return; } drawer('roster', false); drawer('inspector', false); });
|
|
740
918
|
$('now').addEventListener('click', function () { if ($('now').classList.contains('click')) showFailure(); });
|
|
741
919
|
$('bRoster').onclick = function () { drawer('roster'); }; $('bInsp').onclick = function () { drawer('inspector'); };
|
|
742
920
|
document.addEventListener('keydown', function (e) { if (e.key === 'Escape') { drawer('roster', false); drawer('inspector', false); } });
|
|
743
921
|
|
|
922
|
+
/* avatar picker: category filter, search, preview, Random / Apply / Cancel. onApply(id) gets '' for "use the default". */
|
|
923
|
+
function avatarPicker(cfg, onApply) {
|
|
924
|
+
var cur = cfg.avatar || '', pick = cur || avatarId(cfg), cat = '', q = '';
|
|
925
|
+
var grid = h('div', {class: 'avgrid', role: 'listbox', 'aria-label': 'Avatars'}), prev = h('div', {class: 'avprev'}), cats = h('div', {class: 'avcats', role: 'tablist'});
|
|
926
|
+
var search = h('input', {type: 'search', placeholder: 'Search avatars…', 'aria-label': 'Search avatars', oninput: function () { q = search.value.trim().toLowerCase(); draw(); }});
|
|
927
|
+
function list() { return AVATARS.filter(function (x) { return (!cat || x.category === cat) && (!q || x.id.indexOf(q) >= 0 || x.category.indexOf(q) >= 0); }); }
|
|
928
|
+
function drawPrev() { prev.innerHTML = ''; prev.appendChild(avatarEl(cfg, 112, {id: pick, noEngine: true})); prev.appendChild(h('b', {text: cfg.name})); prev.appendChild(h('span', {class: 'mono ml', text: pick + (cur ? '' : pick === avatarId(cfg) ? ' (default)' : '')})); }
|
|
929
|
+
function draw() {
|
|
930
|
+
cats.innerHTML = ''; [''].concat(AV_CATS).forEach(function (c) { cats.appendChild(h('button', {type: 'button', role: 'tab', class: 'chip' + (cat === c ? ' on' : ''), 'aria-selected': String(cat === c), text: c || 'All', onclick: function () { cat = c; draw(); }})); });
|
|
931
|
+
grid.innerHTML = ''; var l = list();
|
|
932
|
+
l.forEach(function (x) { var on = x.id === pick; grid.appendChild(h('button', {type: 'button', role: 'option', 'aria-selected': String(on), class: 'avopt' + (on ? ' on' : ''), title: x.id, onclick: function () { pick = x.id; draw(); }, ondblclick: function () { pick = x.id; ok(); }}, [h('img', {src: AV_BASE + 'avatars/' + x.id + '.png', alt: x.id, loading: 'lazy', width: 64, height: 64})])); });
|
|
933
|
+
if (!l.length) grid.appendChild(h('div', {class: 'iempty', text: AVATARS.length ? 'No avatar matches.' : 'Avatar pack not available — initials are used.'}));
|
|
934
|
+
drawPrev();
|
|
935
|
+
}
|
|
936
|
+
function ok() { closeModal(); onApply(pick === avatarId(Object.assign({}, cfg, {avatar: ''})) && !cur ? '' : pick); }
|
|
937
|
+
openModal(h('div', {class: 'dlg wide avdlg', role: 'dialog', 'aria-label': 'Choose avatar'}, [
|
|
938
|
+
h('header', {}, [h('b', {text: 'Choose avatar · ' + cfg.name}), h('button', {text: '✕', 'aria-label': 'Close', onclick: closeModal})]),
|
|
939
|
+
h('div', {class: 'body avbody'}, [h('div', {class: 'avside'}, [prev, h('p', {class: 'clinote', text: 'Any portrait fits any role. Changing it never restarts the agent or its session.'})]), h('div', {class: 'avmain'}, [h('div', {class: 'avtools'}, [cats, search]), grid])]),
|
|
940
|
+
h('footer', {}, [h('button', {type: 'button', text: 'Random', onclick: function () { var l = list().length ? list() : AVATARS; if (l.length) { pick = l[Math.floor(Math.random() * l.length)].id; draw(); } }}), cur ? h('button', {type: 'button', text: 'Use default', onclick: function () { closeModal(); onApply(''); }}) : null, h('span', {style: 'flex:1'}), h('button', {type: 'button', text: 'Cancel', onclick: closeModal}), h('button', {class: 'primary', type: 'button', text: 'Apply', onclick: ok})])]));
|
|
941
|
+
draw(); setTimeout(function () { search.focus(); }, 30);
|
|
942
|
+
}
|
|
943
|
+
/* persist one agent's avatar: config only, no setupAgents, no run restart, no session reset */
|
|
944
|
+
function saveAvatar(id, v) {
|
|
945
|
+
if (!S.config) return;
|
|
946
|
+
var next = JSON.parse(JSON.stringify(S.config)), ag = cfgAgents(next).filter(function (x) { return x.id === id; })[0]; if (!ag) return;
|
|
947
|
+
if (v) ag.avatar = v; else delete ag.avatar;
|
|
948
|
+
api('PUT', '/api/config', strip(next)).then(function (r) {
|
|
949
|
+
if (r.status !== 200) { toast('Could not save avatar: ' + ((r.body && r.body.error) || r.status)); return; }
|
|
950
|
+
var live = cfgAgents(S.config).filter(function (x) { return x.id === id; })[0]; if (live) { if (v) live.avatar = v; else delete live.avatar; }
|
|
951
|
+
if (A(id)) { if (v) A(id).cfg.avatar = v; else delete A(id).cfg.avatar; }
|
|
952
|
+
net.refreshAgents(cfgAgents(S.config)); $('ctabs').dataset.sig = ''; S.dirty = true; toast('Avatar saved');
|
|
953
|
+
});
|
|
954
|
+
}
|
|
955
|
+
if (UI.dockView && UI.dockView !== 'chat') dockView(UI.dockView);
|
|
744
956
|
/* config editor (settings view + popup) */
|
|
745
957
|
function strip(cfg) {
|
|
746
958
|
var c = JSON.parse(JSON.stringify(cfg));
|
|
747
|
-
cfgAgents(c).forEach(function (a) { delete a.hasKey; delete a._auto; if (a.baseUrl === '') delete a.baseUrl; if (!a.persona) delete a.persona; if (!a.short) delete a.short; if (typeof a.cliArgs !== 'string' || !a.cliArgs.trim()) delete a.cliArgs; else a.cliArgs = a.cliArgs.trim(); });
|
|
959
|
+
cfgAgents(c).forEach(function (a) { delete a.hasKey; delete a._auto; if (a.baseUrl === '') delete a.baseUrl; if (!a.persona) delete a.persona; if (!a.short) delete a.short; if (!a.avatar) delete a.avatar; if (typeof a.cliArgs !== 'string' || !a.cliArgs.trim()) delete a.cliArgs; else a.cliArgs = a.cliArgs.trim(); });
|
|
748
960
|
['ba', 'implement', 'qc'].forEach(function (k) { if (!c.teams[k]) c.teams[k] = []; });
|
|
749
961
|
if (c.missions) { Object.keys(c.missions).forEach(function (k) { if (!String(c.missions[k] || '').trim()) delete c.missions[k]; }); if (!Object.keys(c.missions).length) delete c.missions; }
|
|
750
962
|
if (c.extraTeams && !c.extraTeams.length) delete c.extraTeams;
|
|
@@ -917,7 +1129,8 @@
|
|
|
917
1129
|
f.appendChild(h('div', {class: 'sec', text: 'IDENTITY'}));
|
|
918
1130
|
var sn = h('input', {value: a.short || '', maxLength: 4, placeholder: net.initials({name: a.name || '?', team: a.team}), style: 'text-transform:uppercase;font-family:var(--mono);font-weight:700;letter-spacing:.08em', title: 'Shown inside the agent circle. 1-4 letters or digits. Empty = ' + net.initials({name: a.name || '?', team: a.team}) + ' (from the name).'});
|
|
919
1131
|
sn.addEventListener('input', function () { var v = sn.value.replace(/[^\p{L}\p{N}]/gu, '').toUpperCase().slice(0, 4); if (v !== sn.value) sn.value = v; });
|
|
920
|
-
|
|
1132
|
+
var avb = h('button', {class: 'avpick', type: 'button', title: 'Change avatar (any portrait fits any role)', 'aria-label': 'Change avatar', onclick: function () { avatarPicker(a, function (v) { if (v) a.avatar = v; else delete a.avatar; mark(); render(); }); }}, [avatarEl(a, 52, {noEngine: true}), h('span', {class: 'ml', text: 'CHANGE'})]);
|
|
1133
|
+
f.appendChild(h('div', {class: 'row2', style: 'grid-template-columns:72px 150px 1fr 1fr;align-items:end'}, [avb, fld('Short name (max 4)', bind(sn, a, 'short')), fld('Name', bind(h('input', {value: a.name}), a, 'name')), fld('Team', h('input', {value: a.team, disabled: true}))]));
|
|
921
1134
|
var pta = bind(h('textarea', {rows: 2, value: a.persona || ''}), a, 'persona');
|
|
922
1135
|
f.appendChild(fld('Persona / extra guidance (optional)', pta));
|
|
923
1136
|
f.appendChild(enhance('persona', {team: a.team, agent: a.id}, pta, function (v) { a.persona = v; }));
|
|
@@ -1030,7 +1243,7 @@
|
|
|
1030
1243
|
return;
|
|
1031
1244
|
}
|
|
1032
1245
|
if (r.status !== 200) { document.body.innerHTML = '<p style="padding:40px;color:#F05668;font-family:monospace">Missing or invalid session token. Open the URL printed by `ckit gui`.</p>'; return; }
|
|
1033
|
-
S.config = r.body.config; S.configExists = r.body.configExists !== false; S.projectRoot = r.body.projectRoot || ''; staleNotice(r.body.version, r.body.diskVersion); (function (root) { var name = root.split(/[\\/]/).filter(Boolean).pop() || root, ws = $('cwd').parentNode; $('cwdn').textContent = name; $('cwd').textContent = '\u200e' + root; document.title = name + ' · CKit'; ws.title = 'Open workspace files\n' + root; ws.style.cursor = 'pointer'; ws.setAttribute('role', 'button'); ws.tabIndex = 0; ws.onclick = function () { if (window.__ckExplorer) window.__ckExplorer.open(''); }; ws.onkeydown = function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); ws.onclick(); } }; })(S.projectRoot); S.simulatedDefault = r.body.simulatedDefault; S.run = r.body.run ? {runId: r.body.run.runId, running: r.body.run.running, goal: r.body.run.goal} : null;
|
|
1246
|
+
S.config = r.body.config; S.configExists = r.body.configExists !== false; S.projectRoot = r.body.projectRoot || ''; staleNotice(r.body.version, r.body.diskVersion); (function (root) { var name = root.split(/[\\/]/).filter(Boolean).pop() || root, ws = $('cwd').parentNode; $('cwdn').textContent = name; $('cwd').textContent = '\u200e' + root; $('wsboxn').textContent = name; $('wsbox').title = 'Workspace: ' + root + '\nClick to open files'; document.title = name + ' · CKit'; ws.title = 'Open workspace files\n' + root; ws.style.cursor = 'pointer'; ws.setAttribute('role', 'button'); ws.tabIndex = 0; ws.onclick = function () { if (window.__ckExplorer) window.__ckExplorer.open(''); }; ws.onkeydown = function (e) { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); ws.onclick(); } }; })(S.projectRoot); S.simulatedDefault = r.body.simulatedDefault; S.run = r.body.run ? {runId: r.body.run.runId, running: r.body.run.running, goal: r.body.run.goal} : null;
|
|
1034
1247
|
S.replay = !!(r.body.run && r.body.run.goal === '(replay)'); S.replaySpeed = r.body.run && r.body.run.replay ? r.body.run.replay.speed : 0; $('bStopRp').onclick = stopReplay;
|
|
1035
1248
|
setupAgents(S.config);
|
|
1036
1249
|
// First run (no .ckit/team.json, nothing running): land on Config so setup starts in the GUI.
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
# CKit Oriental Avatar Pack
|
|
2
|
+
|
|
3
|
+
63 selectable portraits, grouped into seven suggested role categories. Every avatar may be used for any role. PNG files are 128 x 128 with rounded transparent corners.
|
|
4
|
+
|
|
5
|
+
Read manifest.json to populate the picker and persist the selected avatar id. Status indicators and provider icons should be separate overlays, not part of avatar identity. The portraits were extracted from an AI-generated concept sheet (source cells approximately 100 px); they are suitable for small UI avatars, not high-resolution illustrations.
|