@ngockhoale/ckit 0.2.4 → 0.2.5
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 +1 -1
- package/dist/src/gui/server.js +22 -8
- package/gui/app.css +5 -0
- package/gui/app.js +20 -8
- package/gui/index.html +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -30,7 +30,7 @@ ckit team --init # write the default .ckit/team.json (--force overwrites
|
|
|
30
30
|
```
|
|
31
31
|
- Teams are configurable in Config: only the Director is mandatory; BA, Implement and QC can each be removed or re-added, and `+ Add team` creates your own team (`extraTeams` in `.ckit/team.json`: name, mission, agents). All teams follow one numbered flow, `order` (e.g. `["ba","implement","test","qc"]`, reorder with the arrows in Config; absent = ba, implement, qc with custom teams placed by the old `runAfter`): work goes Director -> team 1 -> team 2 ..., each team gets the Director's brief and the previous team's output. A team can end its message with `ASK PREVIOUS: <question>` (the team before it, or the Director, answers) or `RETURN TO PREVIOUS: <reason>` (QC's FAIL means the same); both are limited to `limits.qcLoops` per team boundary ("Max send-backs per team"). Each agent (Director too) also has an optional `cliArgs` text box ("Extra CLI arguments"), e.g. `--settings ./other-settings.json`: it is split like a shell would (quotes group; `~` and `$HOME` become your home folder, other `$VAR` are not expanded), appended to that agent's start command after CKit's own flags and before the prompt, and empty means not used.
|
|
32
32
|
|
|
33
|
-
Every run is journaled to `.ckit/team/runs/<runId>/` (`events.jsonl`, `handoff-ba.md`, `qc-report-N.md`, `transcript.md`, `report.md`). Real agents use their own CLI login; codex runs `read-only` unless the agent has `access: "write"` (then `workspace-write`), claude uses `acceptEdits` only for write access, never bypass.
|
|
33
|
+
The Runs list replays a past run at 1×, 2× or 4×; the row being replayed is marked REPLAYING with a Stop button (also in the header), other rows show READY, and pressing another speed restarts the replay at that speed. Every run is journaled to `.ckit/team/runs/<runId>/` (`events.jsonl`, `handoff-ba.md`, `qc-report-N.md`, `transcript.md`, `report.md`). Real agents use their own CLI login; codex runs `read-only` unless the agent has `access: "write"` (then `workspace-write`), claude uses `acceptEdits` only for write access, never bypass.
|
|
34
34
|
|
|
35
35
|
`ckit gui` network settings (all optional): flags > shell env > the folder's env file > `.ckit/gui.json` > default `127.0.0.1:4317`; see `.env.example`. The earlier `ckit run` command (API advisor + single executor) was removed on 2026-11-14; use the GUI or `ckit team`.
|
|
36
36
|
|
package/dist/src/gui/server.js
CHANGED
|
@@ -104,9 +104,9 @@ export async function startGuiServer(opts) {
|
|
|
104
104
|
const sse = new Set();
|
|
105
105
|
let unsub = null;
|
|
106
106
|
const sendEvent = (res, e) => { res.write(`data: ${JSON.stringify(e)}\n\n`); };
|
|
107
|
-
const attach = (handle, goal, simulated) => {
|
|
107
|
+
const attach = (handle, goal, simulated, replay) => {
|
|
108
108
|
unsub?.();
|
|
109
|
-
const cur = { handle, goal, simulated, startedAt: new Date().toISOString(), outcome: null };
|
|
109
|
+
const cur = { handle, goal, simulated, startedAt: new Date().toISOString(), outcome: null, ...(replay ? { replay } : {}) };
|
|
110
110
|
current = cur;
|
|
111
111
|
for (const r of sse)
|
|
112
112
|
r.write('event: reset\ndata: {}\n\n');
|
|
@@ -190,7 +190,7 @@ export async function startGuiServer(opts) {
|
|
|
190
190
|
const c = loadConfig();
|
|
191
191
|
const configured = allAgents(c).some(a => a.cli !== 'auto' && a.cli !== 'simulated');
|
|
192
192
|
return json(res, 200, { config: publicConfig(c), configExists: existsSync(teamConfigPath(root)), projectRoot: root, version: START_VERSION, diskVersion: packageVersion(), simulatedDefault: !configured,
|
|
193
|
-
run: current ? { runId: current.handle.runId, goal: current.goal, simulated: current.simulated, startedAt: current.startedAt, running: current.outcome === null, outcome: current.outcome } : null });
|
|
193
|
+
run: current ? { runId: current.handle.runId, goal: current.goal, simulated: current.simulated, startedAt: current.startedAt, running: current.outcome === null, outcome: current.outcome, ...(current.replay ? { replay: current.replay } : {}) } : null });
|
|
194
194
|
}
|
|
195
195
|
if (m === 'PUT' && p === '/api/config') {
|
|
196
196
|
const body = await readBody(req);
|
|
@@ -247,7 +247,8 @@ export async function startGuiServer(opts) {
|
|
|
247
247
|
const lane = ev.find(e => e.type === 'lane.chosen');
|
|
248
248
|
return { runId: r.runId, goal, outcome, lane: lane && lane.type === 'lane.chosen' ? lane.name : null, waiting: last?.type === 'run.waiting', startedAt: first?.at ?? null, durationMs, simulated: first?.type === 'run.started' ? first.simulated : false };
|
|
249
249
|
});
|
|
250
|
-
|
|
250
|
+
// The run on screen right now (a real run or a playback), so the list can mark its row and offer Stop.
|
|
251
|
+
return json(res, 200, { runs, active: isRunning() && current ? { runId: current.handle.runId, replay: !!current.replay, speed: current.replay?.speed ?? null } : null });
|
|
251
252
|
}
|
|
252
253
|
if (m === 'POST' && p === '/api/uploads') {
|
|
253
254
|
// Raw file body (any type), name in ?name=. Streamed to disk, never parsed or executed here.
|
|
@@ -300,14 +301,17 @@ export async function startGuiServer(opts) {
|
|
|
300
301
|
if (rp) {
|
|
301
302
|
const id = decodeURIComponent(rp[1]);
|
|
302
303
|
if (m === 'POST' && rp[2] === 'replay') {
|
|
303
|
-
|
|
304
|
+
// A playback may be replaced by another playback (other run or other speed); a real run is never interrupted this way.
|
|
305
|
+
if (isRunning() && !current?.replay)
|
|
304
306
|
return json(res, 409, { error: 'a run is already active' });
|
|
305
307
|
const dir = runDirOf(id);
|
|
306
308
|
if (!dir || id === 'current')
|
|
307
309
|
return json(res, 404, { error: 'unknown run' });
|
|
308
|
-
const
|
|
309
|
-
|
|
310
|
-
|
|
310
|
+
const asked = Number(obj(await readBody(req))['speed']), speed = [1, 2, 4].includes(asked) ? asked : 1;
|
|
311
|
+
if (isRunning())
|
|
312
|
+
current?.handle.stop();
|
|
313
|
+
const handle = replayTeamRun(dir, { speed });
|
|
314
|
+
attach(handle, '(replay)', false, { speed });
|
|
311
315
|
return json(res, 200, { runId: handle.runId, replay: true });
|
|
312
316
|
}
|
|
313
317
|
if (m === 'GET' && rp[2]?.startsWith('attachment/') && rp[3]) {
|
|
@@ -452,6 +456,16 @@ export async function startGuiServer(opts) {
|
|
|
452
456
|
if (!isRunning() || !current)
|
|
453
457
|
return json(res, 409, { error: 'no active run' });
|
|
454
458
|
current.handle.stop();
|
|
459
|
+
// A playback has no run.completed of its own when it is cut short, so every open page is told directly.
|
|
460
|
+
if (current.replay) {
|
|
461
|
+
current.outcome = 'stopped';
|
|
462
|
+
for (const r of sse) {
|
|
463
|
+
try {
|
|
464
|
+
r.write('event: replaystop\ndata: {}\n\n');
|
|
465
|
+
}
|
|
466
|
+
catch { /* dead socket */ }
|
|
467
|
+
}
|
|
468
|
+
}
|
|
455
469
|
return json(res, 200, { ok: true });
|
|
456
470
|
}
|
|
457
471
|
json(res, 404, { error: 'not found' });
|
package/gui/app.css
CHANGED
|
@@ -268,3 +268,8 @@ table.runs td.warn{color:var(--am)}
|
|
|
268
268
|
|
|
269
269
|
.stale{position:fixed;left:50%;bottom:14px;transform:translateX(-50%);z-index:60;max-width:min(760px,92vw);padding:9px 14px;border:1px solid var(--am);border-radius:8px;background:#1a1407;color:var(--am);font-size:12.5px;line-height:1.45;box-shadow:0 8px 30px rgba(0,0,0,.5)}
|
|
270
270
|
.exupl{max-width:230px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
271
|
+
.rstat{display:inline-block;font:700 10px var(--mono);letter-spacing:.1em;padding:3px 8px;border-radius:10px;border:1px solid var(--b1);color:var(--mu);white-space:nowrap}
|
|
272
|
+
.rstat.rp{color:var(--am);border-color:#6b4a1c;background:rgba(243,165,68,.1)}.rstat.run{color:var(--rd);border-color:#6e2a38;background:rgba(240,86,104,.08)}
|
|
273
|
+
table.runs tr.replaying td{background:rgba(243,165,68,.05)}table.runs tr.replaying td:first-child{box-shadow:inset 3px 0 0 var(--am)}
|
|
274
|
+
.rpbtns{white-space:nowrap}.rpbtns button{margin-right:4px}.rpbtns button.on{border-color:var(--am);color:var(--am)}
|
|
275
|
+
#bStopRp{padding:4px 10px;font-size:12px;white-space:nowrap}#bStopRp[hidden]{display:none}
|
package/gui/app.js
CHANGED
|
@@ -250,7 +250,7 @@
|
|
|
250
250
|
case 'subagent.activity': if (a && a.subs[e.childId]) { a.subs[e.childId].text = e.text; net.subActivity(e.childId, e.text); } break;
|
|
251
251
|
case 'subagent.finished': if (a && a.subs[e.childId]) { a.subs[e.childId].state = e.ok ? 'done' : 'failed'; net.finishSub(e.childId, e.ok); feedSub(e.agentId, (e.ok ? '✓ ' : '✕ ') + a.subs[e.childId].kind + ': ' + e.summary); } break;
|
|
252
252
|
case 'run.completed':
|
|
253
|
-
S.ended = Date.parse(e.at); S.outcome = e.outcome; S.reportText = e.report; if (S.run) S.run.running = false;
|
|
253
|
+
S.ended = Date.parse(e.at); S.outcome = e.outcome; S.reportText = e.report; if (S.run) S.run.running = false; if (S.view === 'runs') renderRuns();
|
|
254
254
|
if (S.stageKey) S.stageTimes[S.stageKey] = Date.parse(e.at) - S.lastStageAt;
|
|
255
255
|
if (e.outcome === 'delivered') { var sl2 = stageList(S.config); S.stageIdx = sl2.length; S.stageKey = 'done'; net.setStage(sl2.length, S.loop, sl2.length); }
|
|
256
256
|
S.order.forEach(function (id) { if (A(id).state === 'thinking') { A(id).state = 'idle'; net.setState(id, 'idle'); } });
|
|
@@ -493,7 +493,8 @@
|
|
|
493
493
|
function renderTop() {
|
|
494
494
|
var live = S.run && S.run.running && !S.outcome, b = $('badge');
|
|
495
495
|
b.className = 'badge ' + (S.outcome === 'declined' ? 'replay' : S.outcome ? 'done' : live ? (S.replay ? 'replay' : 'live') : '');
|
|
496
|
-
b.querySelector('span').textContent = S.outcome ? (S.replay ? 'REPLAY DONE' : S.outcome === 'delivered' ? 'COMPLETE' : String(S.outcome).toUpperCase()) : live ? (S.replay ? 'REPLAY' : S.waiting ? 'WAITING' : 'LIVE') : 'IDLE';
|
|
496
|
+
b.querySelector('span').textContent = S.outcome ? (S.replay ? 'REPLAY DONE' : S.outcome === 'delivered' ? 'COMPLETE' : String(S.outcome).toUpperCase()) : live ? (S.replay ? 'REPLAY' + (S.replaySpeed ? ' ' + S.replaySpeed + '×' : '') : S.waiting ? 'WAITING' : 'LIVE') : S.replay && S.run ? 'REPLAY STOPPED' : 'IDLE';
|
|
497
|
+
$('bStopRp').hidden = !(live && S.replay);
|
|
497
498
|
var end = S.outcome || S.replay ? (S.lastAt || S.started) : Date.now();
|
|
498
499
|
$('elapsed').textContent = S.started ? fmtT(end - S.started) : '00:00'; $('tokens').textContent = fmtN(S.tokens); $('msgs').textContent = S.msgs;
|
|
499
500
|
$('active').textContent = S.order.filter(function (i) { return A(i).state === 'thinking'; }).length + activeSubs();
|
|
@@ -542,22 +543,32 @@
|
|
|
542
543
|
$('bRuns').onclick = function () { setView('runs'); };
|
|
543
544
|
$('bCfg').onclick = function () { setView('settings'); }; $('bNew').onclick = newRunDialog; $('bHint').onclick = newRunDialog;
|
|
544
545
|
function renderRuns() {
|
|
545
|
-
var box = $('runs');
|
|
546
|
+
var box = $('runs');
|
|
546
547
|
api('GET', '/api/runs').then(function (r) {
|
|
547
|
-
|
|
548
|
+
box.innerHTML = '<div class="ml" style="margin:6px 0 10px">PAST RUNS — open to replay</div>';
|
|
549
|
+
var rows = r.body.runs || [], act = r.body.active || null, t = h('table', {class: 'runs'}); t.innerHTML = '<tr><th>Date</th><th>Goal</th><th>Lane</th><th>Outcome</th><th>Duration</th><th>Status</th><th>Replay</th></tr>';
|
|
548
550
|
rows.forEach(function (x) {
|
|
549
551
|
var tr = h('tr'); tr.appendChild(h('td', {class: 'mono', text: x.startedAt ? new Date(x.startedAt).toLocaleString() : x.runId})); tr.appendChild(h('td', {text: (x.simulated ? '[demo] ' : '') + x.goal}));
|
|
550
552
|
var lbl = x.outcome === 'declined' ? 'declined: the Director could not take this request' : x.outcome === 'incomplete' ? (x.waiting ? 'interrupted while waiting for your answer' : 'interrupted before it finished') : x.outcome;
|
|
551
553
|
tr.appendChild(h('td', {text: x.lane || ''}));
|
|
552
554
|
tr.appendChild(h('td', {class: x.outcome === 'delivered' ? 'ok' : x.outcome === 'failed' ? 'bad' : x.outcome === 'declined' || x.outcome === 'incomplete' ? 'warn' : '', title: x.outcome === 'incomplete' ? 'A run lives only in the CKit process that started it and is not resumed after CKit stops or restarts. Start the request again as a new run.' : '', text: lbl})); tr.appendChild(h('td', {class: 'mono', text: fmtT(x.durationMs)}));
|
|
553
|
-
var
|
|
555
|
+
var mine = !!act && act.runId === x.runId, rp = mine && act.replay, busy = !!act && !act.replay;
|
|
556
|
+
if (rp) tr.className = 'replaying';
|
|
557
|
+
tr.appendChild(h('td', {}, [h('span', {class: 'rstat ' + (rp ? 'rp' : mine ? 'run' : ''), text: rp ? '▶ REPLAYING ' + act.speed + '×' : mine ? '● RUNNING' : 'READY'})]));
|
|
558
|
+
var td = h('td', {class: 'rpbtns'});
|
|
559
|
+
[1, 2, 4].forEach(function (sp) { td.appendChild(h('button', {text: sp + '×', class: rp && act.speed === sp ? 'on' : '', disabled: busy, title: busy ? 'A run is active; replay is available when it ends.' : rp && act.speed === sp ? 'Playing at this speed' : rp ? 'Restart this replay at ' + sp + '×' : 'Replay at ' + sp + '×', onclick: function () { replay(x.runId, sp); }})); });
|
|
560
|
+
if (rp) td.appendChild(h('button', {class: 'danger', text: '■ Stop', title: 'Stop this replay', onclick: stopReplay}));
|
|
561
|
+
tr.appendChild(td); t.appendChild(tr);
|
|
554
562
|
});
|
|
555
|
-
if (!rows.length) t.appendChild(h('tr', {}, [h('td', {colSpan:
|
|
563
|
+
if (!rows.length) t.appendChild(h('tr', {}, [h('td', {colSpan: 7, text: 'No runs yet.'})]));
|
|
556
564
|
box.appendChild(t);
|
|
557
565
|
});
|
|
558
566
|
}
|
|
559
567
|
function simDefault() { return !S.config || !!S.simulatedDefault || !cfgAgents(S.config).some(function (a) { return a.cli !== 'auto' && a.cli !== 'simulated'; }); }
|
|
560
|
-
function replay(id, speed) { api('POST', '/api/runs/' + id + '/replay', {speed: speed}).then(function (r) { if (r.status !== 200) { toast(r.body.error || 'replay failed'); return; } S.replay = true; setComic(false); setView('live'); }); }
|
|
568
|
+
function replay(id, speed) { api('POST', '/api/runs/' + id + '/replay', {speed: speed}).then(function (r) { if (r.status !== 200) { toast(r.body.error || 'replay failed'); return; } S.replay = true; S.replaySpeed = speed; setComic(false); setView('live'); }); }
|
|
569
|
+
function stopReplay() { api('POST', '/api/runs/current/stop').then(function (r) { if (r.status !== 200) toast(r.body.error || 'No replay is playing'); else toast('Replay stopped'); replayStopped(); }); }
|
|
570
|
+
/* A stopped playback sends no run.completed, so the page is told separately (also for other open tabs). */
|
|
571
|
+
function replayStopped() { if (S.run) S.run.running = false; S.dirty = true; if (S.view === 'runs') renderRuns(); }
|
|
561
572
|
function newRunDialog() {
|
|
562
573
|
var goal = h('textarea', {rows: 4, placeholder: 'Describe the mission… e.g. "Add a dark-mode toggle to the settings page"'}), sim = h('input', {type: 'checkbox', style: 'width:auto'});
|
|
563
574
|
sim.checked = simDefault(); var laneSel = laneSelect();
|
|
@@ -1007,6 +1018,7 @@
|
|
|
1007
1018
|
es.onmessage = function (m) { try { onEvent(JSON.parse(m.data)); } catch (err) { console.error(err); } };
|
|
1008
1019
|
es.addEventListener('reset', function () { resetRun(); S.history = true; });
|
|
1009
1020
|
es.addEventListener('ready', function () { S.history = false; S.dirty = true; shots(); });
|
|
1021
|
+
es.addEventListener('replaystop', replayStopped);
|
|
1010
1022
|
}
|
|
1011
1023
|
api('GET', '/api/clis').then(function (r) { if (r.status === 200) { CLIS = r.body.clis || []; S.configFile = r.body.configFile; if (S.view === 'settings') setView('settings'); } });
|
|
1012
1024
|
api('GET', '/api/state').then(function (r) {
|
|
@@ -1019,7 +1031,7 @@
|
|
|
1019
1031
|
}
|
|
1020
1032
|
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; }
|
|
1021
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;
|
|
1022
|
-
S.replay = !!(r.body.run && r.body.run.goal === '(replay)');
|
|
1034
|
+
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;
|
|
1023
1035
|
setupAgents(S.config);
|
|
1024
1036
|
// First run (no .ckit/team.json, nothing running): land on Config so setup starts in the GUI.
|
|
1025
1037
|
var v = location.hash.slice(1); setView(['live', 'settings', 'runs'].indexOf(v) >= 0 ? v : (!S.configExists && !r.body.run && !SHOT && Q.get('demo') !== '1') ? 'settings' : 'live');
|
package/gui/index.html
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
<div class="goal" id="goal" title="">No active run</div>
|
|
9
9
|
<div class="meta"><span class="ml">RUN</span><span class="mv mono" id="runid">—</span></div>
|
|
10
10
|
<div class="badge" id="badge"><i></i><span>IDLE</span></div>
|
|
11
|
+
<button id="bStopRp" class="danger" type="button" title="Stop this replay" hidden>■ Stop replay</button>
|
|
11
12
|
<div class="metric"><span class="ml">ELAPSED</span><span class="mv big mono" id="elapsed">00:00</span></div>
|
|
12
13
|
<div class="metric"><span class="ml">TOKENS</span><span class="mv big mono" id="tokens">0</span></div>
|
|
13
14
|
<div class="metric"><span class="ml">MESSAGES</span><span class="mv big mono" id="msgs">0</span></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngockhoale/ckit",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.5",
|
|
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": {
|