@ngockhoale/ckit 0.1.1 → 0.2.1
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 +5 -1
- package/dist/src/gui/server.js +72 -6
- package/dist/src/team/cli-args.d.ts +12 -0
- package/dist/src/team/cli-args.js +69 -0
- package/dist/src/team/config.js +205 -8
- package/dist/src/team/engine.d.ts +19 -1
- package/dist/src/team/engine.js +503 -109
- package/dist/src/team/runners.d.ts +6 -0
- package/dist/src/team/runners.js +47 -13
- package/dist/src/team/types.d.ts +90 -10
- package/dist/src/team/types.js +17 -1
- package/dist/src/tui/team/app.js +12 -12
- package/dist/src/tui/team/model.d.ts +23 -12
- package/dist/src/tui/team/model.js +25 -9
- package/gui/app.css +31 -0
- package/gui/app.js +333 -65
- package/gui/index.html +2 -2
- package/gui/network.js +34 -9
- package/package.json +1 -1
package/gui/index.html
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<button id="bCfg">⚙ Config</button><button id="bRuns">Runs</button><button id="bNew" class="primary">+ New run</button>
|
|
18
18
|
</nav>
|
|
19
19
|
</header>
|
|
20
|
-
<div id="strip"><div id="stages"></div><div id="caption"></div><div id="ws"><span class="ml">WORKSPACE</span><b class="mono" id="cwdn"></b><span class="mono" id="cwd"></span></div></div>
|
|
20
|
+
<div id="strip"><div id="stages"></div><div id="lanename" hidden></div><div id="caption"></div><div id="ws"><span class="ml">WORKSPACE</span><b class="mono" id="cwdn"></b><span class="mono" id="cwd"></span></div></div>
|
|
21
21
|
<main id="live">
|
|
22
22
|
<aside id="roster"></aside>
|
|
23
23
|
<section id="center">
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
<div id="feedwrap"><div class="dh"><span class="ml">CONVERSATION</span><span class="ml" id="feedcount"></span></div><div id="feed"></div></div>
|
|
34
34
|
<div id="composer">
|
|
35
35
|
<div class="dh"><span class="ml" id="clabel">OWNER → DIRECTOR</span><button class="chip" id="attach" title="Attach any files: images, PDF, Word, Excel, drawio, XML… You can also drop or paste them here.">📎 Attach files</button><input type="file" id="file" multiple hidden></div>
|
|
36
|
-
<div class="chips" id="chips"></div>
|
|
36
|
+
<div class="chips" id="chips"></div><div class="chips" id="wbtns" hidden></div><span id="lanewrap" hidden><select id="lane" title="Lane for this request. Auto: the Director decides which lane fits."></select></span>
|
|
37
37
|
<div class="attlist" id="atts"></div>
|
|
38
38
|
<div class="cbox"><textarea id="msg" rows="2" placeholder="Message the Director… (Enter to send)"></textarea><button class="primary" id="send">Send ▸</button></div>
|
|
39
39
|
<div id="cnote"></div>
|
package/gui/network.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
var TEAM_LABEL = {director: 'DIRECTOR', ba: 'TEAM BA', implement: 'TEAM IMPLEMENT', qc: 'TEAM QC'};
|
|
6
6
|
var ZONE_POS = {ba: [0.16, 0.5], implement: [0.84, 0.5], qc: [0.5, 0.78]}, HUB_POS = [0.5, 0.31];
|
|
7
7
|
var ZONE_WIDE = {ba: [0.13, 0.56], implement: [0.63, 0.56], qc: [0.87, 0.56]}, HUB_WIDE = [0.38, 0.5];
|
|
8
|
-
var STAGE_COUNT = 6;
|
|
8
|
+
var STAGE_COUNT = 6; /* default; the app passes the real chip count to setStage */
|
|
9
9
|
function hexA(hex, a) { var n = parseInt(hex.slice(1), 16); return 'rgba(' + (n >> 16) + ',' + ((n >> 8) & 255) + ',' + (n & 255) + ',' + a + ')'; }
|
|
10
10
|
function rnd(a, b) { return a + Math.random() * (b - a); }
|
|
11
11
|
function bez(p0, c, p1, t) { var u = 1 - t; return {x: u * u * p0.x + 2 * u * t * c.x + t * t * p1.x, y: u * u * p0.y + 2 * u * t * c.y + t * t * p1.y}; }
|
|
@@ -38,16 +38,40 @@
|
|
|
38
38
|
wide = H < 330 || W / H > 3.2;
|
|
39
39
|
S = wide ? Math.max(.5, Math.min(W / 1150, H / 300, 1.15)) : Math.max(.55, Math.min(W / 1050, H / 600, 1.25));
|
|
40
40
|
var zp = wide ? ZONE_WIDE : ZONE_POS, hp = wide ? HUB_WIDE : HUB_POS, old = nodes;
|
|
41
|
+
var BUILTIN = {director: 1, ba: 1, implement: 1, qc: 1}, extraIds = [];
|
|
42
|
+
agents.forEach(function (a) { if (!BUILTIN[a.team] && extraIds.indexOf(a.team) < 0) extraIds.push(a.team); });
|
|
43
|
+
var teamIds = ['ba', 'implement', 'qc'].filter(function (t) { return agents.some(function (a) { return a.team === t; }); }).concat(extraIds);
|
|
44
|
+
/* flow order (CKNet.TEAM_ORDER, set by the app) decides the placement; the default order keeps the classic layout */
|
|
45
|
+
var ord = (window.CKNet.TEAM_ORDER || []).filter(function (t) { return teamIds.indexOf(t) >= 0; }), classic = ['ba', 'implement', 'qc'].filter(function (t) { return teamIds.indexOf(t) >= 0; });
|
|
46
|
+
if (ord.length === teamIds.length) teamIds = ord;
|
|
47
|
+
var reordered = !extraIds.length && teamIds.some(function (t, i) { return t !== classic[i]; });
|
|
48
|
+
if (extraIds.length || reordered) {
|
|
49
|
+
/* extra teams: re-pack. Wide: one row after the hub. Tall: ba + implement on the upper row, the rest (qc + extras) share a bottom row. Zones shrink so nothing overlaps. */
|
|
50
|
+
zp = {}; var maxN = 1;
|
|
51
|
+
teamIds.forEach(function (t) { maxN = Math.max(maxN, Math.min(4, agents.filter(function (a) { return a.team === t; }).length)); });
|
|
52
|
+
var zw = 2 * 1.2 * (64 + 26 * maxN);
|
|
53
|
+
if (wide) {
|
|
54
|
+
var slots = teamIds.length + 1; hp = [.5 / slots, .5];
|
|
55
|
+
teamIds.forEach(function (t, i) { zp[t] = [(i + 1.5) / slots, .56]; });
|
|
56
|
+
S = Math.max(.4, Math.min(S, W / slots / zw));
|
|
57
|
+
} else {
|
|
58
|
+
/* clockwise from the hub: first two teams on the upper row (left, right), the rest along the bottom row from right to left */
|
|
59
|
+
var top = teamIds.slice(0, 2), bottom = teamIds.slice(2).reverse();
|
|
60
|
+
top.forEach(function (t, i) { zp[t] = [top.length === 1 ? .5 : (i ? .84 : .16), .44]; });
|
|
61
|
+
bottom.forEach(function (t, i) { zp[t] = [(i + .5) / bottom.length, .84]; });
|
|
62
|
+
S = Math.max(.4, Math.min(S * .8, W / Math.max(bottom.length, 2) / zw));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
41
65
|
hub = {x: W * hp[0], y: H * hp[1], r: 50 * S};
|
|
42
66
|
zones = {}; nodes = {};
|
|
43
|
-
|
|
67
|
+
teamIds.forEach(function (tid) {
|
|
44
68
|
var list = agents.filter(function (a) { return a.team === tid; }), n = Math.max(1, list.length);
|
|
45
69
|
var rz = (64 + 26 * Math.min(n, 4)) * S, zy = Math.max(rz + 26 * S, Math.min(H - rz - 6, H * zp[tid][1]));
|
|
46
|
-
zones[tid] = {id: tid, x: W * zp[tid][0], y: zy, r: rz, n: list.length, color: TEAM_COLOR[tid]};
|
|
70
|
+
zones[tid] = {id: tid, x: W * zp[tid][0], y: zy, r: rz, n: list.length, color: TEAM_COLOR[tid] || '#8A9AAF'};
|
|
47
71
|
list.forEach(function (a, i) {
|
|
48
72
|
var ang, rad = list.length === 1 ? 0 : rz * .52, o = old[a.id];
|
|
49
73
|
if (list.length === 2) ang = i === 0 ? Math.PI : 0; else ang = -Math.PI / 2 + i * 2 * Math.PI / list.length;
|
|
50
|
-
nodes[a.id] = {agent: a, x: zones[tid].x + Math.cos(ang) * rad, y: zy + Math.sin(ang) * rad - 8 * S, r: 38 * S, color: TEAM_COLOR[tid], state: o ? o.state : 'idle', prog: o ? o.prog : null};
|
|
74
|
+
nodes[a.id] = {agent: a, x: zones[tid].x + Math.cos(ang) * rad, y: zy + Math.sin(ang) * rad - 8 * S, r: 38 * S, color: TEAM_COLOR[tid] || '#8A9AAF', state: o ? o.state : 'idle', prog: o ? o.prog : null};
|
|
51
75
|
});
|
|
52
76
|
});
|
|
53
77
|
agents.filter(function (a) { return a.team === 'director'; }).forEach(function (a) { var o = old[a.id]; nodes[a.id] = {agent: a, x: hub.x, y: hub.y, r: hub.r, color: TEAM_COLOR.director, state: o ? o.state : 'idle', prog: null}; });
|
|
@@ -108,7 +132,7 @@
|
|
|
108
132
|
verdictFlash = {until: performance.now() + 1600, color: c, v: v};
|
|
109
133
|
if (v === 'FAIL' && zones.implement) { var A = q, B = zones.implement; addParticle(A, B, .3, '#F05668', {speed: .5, size: 4}); for (var i = 0; i < 6; i++) addParticle(A, B, .3 + rnd(-.15, .15), '#F05668', {speed: rnd(.4, .8), size: 2, delay: i * .07}); }
|
|
110
134
|
}
|
|
111
|
-
function setStage(idx, loop) { if (idx > stageIdx) stageDone = idx; stageIdx = idx; stageLoop = loop || 1; if (idx < stageDone && idx >= 0) stageDone = idx; }
|
|
135
|
+
function setStage(idx, loop, count) { if (count > 0) STAGE_COUNT = count; if (idx > stageIdx) stageDone = idx; stageIdx = idx; stageLoop = loop || 1; if (idx < stageDone && idx >= 0) stageDone = idx; }
|
|
112
136
|
function setAgents(list) {
|
|
113
137
|
agents = list.slice(); subs = {}; layout(); particles = []; packages = []; hot = {};
|
|
114
138
|
}
|
|
@@ -203,18 +227,19 @@
|
|
|
203
227
|
var lab = 'DIRECTOR', tw = ctx.measureText(lab).width + 24, ly = y + rr2 + 24 * S;
|
|
204
228
|
ctx.fillStyle = 'rgba(8,13,22,.92)'; roundRect(x - tw / 2, ly - 11, tw, 22, 11); ctx.fill();
|
|
205
229
|
ctx.strokeStyle = hexA(c, .8); ctx.lineWidth = 1; ctx.stroke(); ctx.fillStyle = '#E6EEFA'; ctx.fillText(lab, x, ly + .5);
|
|
206
|
-
if (stageLoop > 1 && stageIdx >=
|
|
230
|
+
if (stageLoop > 1 && stageIdx >= 1) { ctx.fillStyle = '#F3A544'; ctx.fillText('QC LOOP ' + stageLoop, x, ly + 20 * S); }
|
|
207
231
|
ctx.restore();
|
|
208
232
|
}
|
|
209
233
|
function initials(a) { if (a.short) return String(a.short).toUpperCase().slice(0, 4); if (a.team === 'director') return 'DIR'; var m = a.name.replace(/[^\p{L}\p{N} ·]/gu, '').split(/[ ·]+/).filter(Boolean); return ((m[0] || '?')[0] + ((m[1] || m[0] || '')[1] || (m[1] || '')[0] || '')).toUpperCase().slice(0, 2); }
|
|
210
234
|
function cut(t, n) { return t.length > n ? t.slice(0, n - 1) + '…' : t; }
|
|
235
|
+
var dimTeams = null;
|
|
211
236
|
function drawNode(n, tms) {
|
|
212
237
|
if (n.agent.team === 'director') return;
|
|
213
238
|
var x = n.x, y = n.y, r = n.r, c = n.color, st = n.state;
|
|
214
239
|
var thinking = st === 'thinking', sel = selected === n.agent.id, hov = hover === n.agent.id;
|
|
215
240
|
var ring = st === 'failed' ? '#F05668' : st === 'done' ? '#4AD69A' : c, dim = st === 'idle' && !sel && !hov;
|
|
216
241
|
var frac = thinking && n.prog && n.prog.total ? Math.min(1, n.prog.step / n.prog.total) : 0;
|
|
217
|
-
ctx.save();
|
|
242
|
+
ctx.save(); var na = dimTeams && dimTeams.indexOf(n.agent.team) < 0 ? .25 : 1; ctx.globalAlpha = na; /* teams outside the chosen lane are dimmed */
|
|
218
243
|
/* halo */
|
|
219
244
|
var br = thinking ? .5 + .5 * Math.sin(tms / 320) : 0, hr = r * (1.9 + br * .5);
|
|
220
245
|
var hg = ctx.createRadialGradient(x, y, r * .7, x, y, hr);
|
|
@@ -230,7 +255,7 @@
|
|
|
230
255
|
var fg = ctx.createRadialGradient(x - r * .35, y - r * .45, 1, x, y, r);
|
|
231
256
|
fg.addColorStop(0, hexA(ring, .62)); fg.addColorStop(.55, hexA(ring, .16)); fg.addColorStop(1, 'rgba(8,13,24,.97)');
|
|
232
257
|
ctx.fillStyle = fg; ctx.beginPath(); ctx.arc(x, y, r, 0, 6.283); ctx.fill();
|
|
233
|
-
ctx.lineWidth = 2.5 * S; ctx.strokeStyle = ring; ctx.globalAlpha = dim ? .8 : 1; ctx.stroke(); ctx.shadowBlur = 0; ctx.globalAlpha =
|
|
258
|
+
ctx.lineWidth = 2.5 * S; ctx.strokeStyle = ring; ctx.globalAlpha = (dim ? .8 : 1) * na; ctx.stroke(); ctx.shadowBlur = 0; ctx.globalAlpha = na;
|
|
234
259
|
ctx.strokeStyle = hexA(ring, .3); ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(x, y, r * .8, 0, 6.283); ctx.stroke();
|
|
235
260
|
ctx.strokeStyle = 'rgba(255,255,255,.38)'; ctx.lineWidth = 1.5; ctx.beginPath(); ctx.arc(x, y, r * .9, 3.5, 4.6); ctx.stroke();
|
|
236
261
|
if (thinking) {
|
|
@@ -401,7 +426,7 @@
|
|
|
401
426
|
canvas.addEventListener('click', function (e) { var h = hit(e); if (h) { selected = h; if (onSelect) onSelect(h); } });
|
|
402
427
|
resize(); ro(); initAmbient(); requestAnimationFrame(frame);
|
|
403
428
|
return {
|
|
404
|
-
spawnSub: spawnSub, subActivity: subActivity, finishSub: finishSub, subCount: subCount, setAgents: setAgents, setState: setState, setStep: setStep, pulse: pulse, handoff: handoff, verdict: verdict, setStage: setStage, reset: reset, resize: resize,
|
|
429
|
+
spawnSub: spawnSub, subActivity: subActivity, finishSub: finishSub, subCount: subCount, setAgents: setAgents, setState: setState, setStep: setStep, pulse: pulse, handoff: handoff, verdict: verdict, setStage: setStage, setActiveTeams: function (l) { dimTeams = l && l.length ? l : null; }, reset: reset, resize: resize,
|
|
405
430
|
select: function (id) { selected = id; }, onSelect: function (f) { onSelect = f; }, onFrame: function (f) { onFrame = f; },
|
|
406
431
|
setSlow: function (v) { slow = !!v; },
|
|
407
432
|
getNodePos: function (id) { var n = nodes[id]; if (n) return {x: n.x, y: n.y, r: n.r, w: W, h: H}; return {x: hub.x, y: hub.y, r: hub.r, w: W, h: H}; },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngockhoale/ckit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "CKit — local Agent Company: a Director plus BA / Implement / QC teams running your own codex, claude and omp CLIs, with a web Mission Control (ckit gui).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|