@ngockhoale/ckit 0.1.0 → 0.1.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/.env.example +12 -33
- package/README.md +10 -56
- package/dist/src/cli/ckit.js +6 -94
- package/dist/src/cli/lifecycle.d.ts +19 -0
- package/dist/src/cli/lifecycle.js +90 -0
- package/dist/src/cli/setup.js +1 -1
- package/dist/src/gui/server.js +1 -1
- package/dist/src/team/config.js +4 -2
- package/dist/src/team/types.d.ts +2 -0
- package/gui/app.css +1 -1
- package/gui/app.js +6 -4
- package/gui/network.js +4 -4
- package/package.json +2 -3
package/.env.example
CHANGED
|
@@ -1,42 +1,21 @@
|
|
|
1
|
-
# CKit
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
|
|
5
|
-
#
|
|
1
|
+
# CKit KHÔNG cần file .env để chạy: agent dùng đăng nhập của chính codex / claude / omp,
|
|
2
|
+
# còn CLI + model của từng agent chỉnh trong giao diện (nút Config), lưu ở .ckit/team.json.
|
|
3
|
+
#
|
|
4
|
+
# File này chỉ để tùy chỉnh giao diện web "ckit gui". Cần thì sao chép thành .env trong thư mục
|
|
5
|
+
# bạn chạy "ckit gui" (không commit .env), bỏ dấu # ở dòng muốn dùng rồi điền giá trị.
|
|
6
|
+
# Thứ tự ưu tiên: cờ (--host / --port / --lan) > biến môi trường shell > file .env > .ckit/gui.json > mặc định.
|
|
6
7
|
# Đổi xong phải dừng (Ctrl+C) và chạy lại "ckit gui"; mở đúng link mà lệnh in ra.
|
|
7
8
|
|
|
8
|
-
# Địa chỉ lắng nghe. Mặc định 127.0.0.1 = chỉ máy này
|
|
9
|
-
# (HTTP thường, không mã hóa; ai có link đều điều khiển được agent).
|
|
9
|
+
# Địa chỉ lắng nghe. Mặc định 127.0.0.1 = chỉ máy này mở được.
|
|
10
|
+
# 0.0.0.0 = máy khác trong mạng LAN mở được (HTTP thường, không mã hóa; ai có link đều điều khiển được agent).
|
|
10
11
|
# CKIT_GUI_HOST=
|
|
11
12
|
|
|
12
|
-
# Cổng cố định (1..65535). Mặc định 4317.
|
|
13
|
+
# Cổng cố định (1..65535). Mặc định 4317; nếu cổng bận và không đặt cố định, CKit tự chọn cổng khác.
|
|
13
14
|
# CKIT_GUI_PORT=
|
|
14
15
|
|
|
15
|
-
# Token cố định để link không đổi mỗi lần chạy: 16..128 ký
|
|
16
|
-
# Bỏ trống = token ngẫu nhiên mỗi lần. Coi như mật khẩu, không commit.
|
|
16
|
+
# Token cố định để link không đổi sau mỗi lần chạy: 16..128 ký tự, chỉ gồm A-Z a-z 0-9 _ -
|
|
17
|
+
# Bỏ trống hoặc sai định dạng = token ngẫu nhiên mỗi lần chạy. Coi token như mật khẩu, không commit.
|
|
17
18
|
# CKIT_GUI_TOKEN=
|
|
18
19
|
|
|
19
20
|
# Từ máy khác mở: http://<IP-của-máy-này>:<cổng>/?t=<token>
|
|
20
|
-
|
|
21
|
-
# ---- Advisor API cho "ckit run" (chỉ cần khi dùng ckit run) ----
|
|
22
|
-
# URL gốc endpoint OpenAI-compatible, PHẢI gồm phần phiên bản, ví dụ: https://<host>/v1
|
|
23
|
-
CKIT_OPENAI_BASE_URL=
|
|
24
|
-
|
|
25
|
-
# API key. Chỉ gửi tới endpoint ở trên; không bao giờ gửi cho executor, log hay giao diện.
|
|
26
|
-
# Endpoint không cần key: để trống và đặt CKIT_OPENAI_AUTH=none
|
|
27
|
-
CKIT_OPENAI_API_KEY=
|
|
28
|
-
CKIT_OPENAI_AUTH=
|
|
29
|
-
|
|
30
|
-
# Model của advisor.
|
|
31
|
-
CKIT_OPENAI_MODEL=
|
|
32
|
-
|
|
33
|
-
# Executor chạy việc trong dự án: claude-code (mặc định) hoặc omp; và model của nó (tùy chọn).
|
|
34
|
-
CKIT_EXECUTOR=
|
|
35
|
-
CKIT_EXECUTOR_MODEL=
|
|
36
|
-
|
|
37
|
-
# Cho worker claude-code được ghi file: acceptEdits hoặc dontAsk. Mặc định tắt (không ghi được file).
|
|
38
|
-
# CKIT_EXECUTOR_PERMISSION_MODE=
|
|
39
|
-
|
|
40
|
-
# Nâng cao, hiếm khi cần (xem README): CKIT_ADVISOR_PROVIDER, CKIT_PRIMARY_MODEL, CKIT_REVIEWER_MODEL, CKIT_REVIEWERS,
|
|
41
|
-
# CKIT_OPENAI_TIMEOUT_MS, CKIT_OPENAI_MAX_TOKENS, CKIT_EXECUTOR_PATH, CKIT_EXECUTOR_TIMEOUT_MS, CKIT_VERIFY_ALLOW,
|
|
42
|
-
# CKIT_VERIFY_TIMEOUT_MS, CKIT_MAX_TASKS
|
|
21
|
+
# (nếu không vào được, kiểm tra Firewall của macOS có chặn "node" không).
|
package/README.md
CHANGED
|
@@ -6,13 +6,15 @@ nothing here is a released product, and no live provider/agent integration is cl
|
|
|
6
6
|
## Use it like a normal app
|
|
7
7
|
|
|
8
8
|
```bash
|
|
9
|
-
npm install -g @ngockhoale/ckit
|
|
10
|
-
|
|
11
|
-
ckit
|
|
12
|
-
|
|
13
|
-
ckit
|
|
9
|
+
npm install -g @ngockhoale/ckit # once per machine
|
|
10
|
+
cd your-project
|
|
11
|
+
ckit install # once per project: writes .ckit/team.json (an existing one is kept)
|
|
12
|
+
ckit # opens the GUI in this folder; agents read and write files here
|
|
13
|
+
ckit update # later: upgrade to the newest version from npm (ckit update --check only looks)
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
No env file and no API key are needed: every agent uses the login of its own CLI (`codex`, `claude`, `omp`). Pick the CLI and model per agent in the GUI (Config).
|
|
17
|
+
|
|
16
18
|
## Agent Company (team mode)
|
|
17
19
|
|
|
18
20
|
A Director plus Team BA (2 agents discuss, then write one handoff) → Team Implement → Team QC (2 reviewers; FAIL returns to Implement, up to `limits.qcLoops`) → BA review → Director delivery report. You always talk to the Director; it can continue, redirect or stop the run.
|
|
@@ -29,44 +31,7 @@ ckit team --init # write the default .ckit/team.json (--force overwrites
|
|
|
29
31
|
|
|
30
32
|
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.
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
## Quick start (API advisor)
|
|
35
|
-
|
|
36
|
-
No browser login is needed. The advisor is any OpenAI-compatible HTTP endpoint; the executor is your own `claude` (Claude Code) or `omp` CLI.
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
cp .env.example .env # then fill the variables below; never commit .env
|
|
40
|
-
# CKIT_OPENAI_BASE_URL=https://<host>/v1 (must include the version segment; CKit appends only /chat/completions)
|
|
41
|
-
# CKIT_OPENAI_API_KEY=<key> (or CKIT_OPENAI_AUTH=none for a keyless endpoint)
|
|
42
|
-
# CKIT_OPENAI_MODEL=<model>
|
|
43
|
-
# CKIT_EXECUTOR=claude-code (or omp)
|
|
44
|
-
npx ckit doctor # offline config check, no network
|
|
45
|
-
npx ckit doctor --check-connection # optional: exactly one GET <base>/models
|
|
46
|
-
npx ckit run "<goal>" # planned run: Primary plans tasks + acceptance checks -> executor runs each task -> CKit verifies -> reviewers -> Primary verdict
|
|
47
|
-
npx ckit run --single "<goal>" # one instruction, one executor run, no acceptance checks (previous flow)
|
|
48
|
-
npx ckit run --single "<goal>" --project=/path/to/scratch --config-root=/path/with/.env # settings from one folder, worker edits only the other
|
|
49
|
-
npx ckit status # latest session with outcome / advisor delivery / worker execution / acceptance (read-only)
|
|
50
|
-
npx ckit tui # Mission Control, live: in a terminal it re-reads the journal every 0.7 s, so a `ckit run` in another terminal shows up as it happens (read-only, no requests; `q` quits)
|
|
51
|
-
npx ckit sessions # list recorded sessions (read-only)
|
|
52
|
-
npx ckit open <sessionId> # one session's outcome and events (read-only, no requests)
|
|
53
|
-
npx ckit replay <sessionId> # replay the journal (inert: never resends)
|
|
54
|
-
npx ckit backup <dest-dir> # copy .ckit journal + artifacts (regular files only)
|
|
55
|
-
npx ckit restore <backup-dir> # hash-checked restore with rollback; refused while a run holds the lock; a backup from another project needs --allow-other-project
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
Pause/resume of a running session is not available yet; Ctrl-C stops the worker (a second Ctrl-C kills its process group).
|
|
59
|
-
|
|
60
|
-
- The config file is `<project root>/.env`, where the project root is the nearest directory with `.ckit/project.json` (then `.git`); `--project=<path>` overrides. Flags `--executor`, `--model`, `--reviewers` override the matching variables.
|
|
61
|
-
- Planned run: the Primary replies with a JSON plan (at most `CKIT_MAX_TASKS`, default 6); each task needs at least one required automatic check (`command` or `file-exists`). CKit runs the checks itself, without a shell, in the project root. A task is `verified` only when every required check passes; a Primary or reviewer ACCEPT never overrides a failed check, and the run exits 0 only when every task is verified and the verdict is ACCEPT.
|
|
62
|
-
- Acceptance commands must start with an entry of `CKIT_VERIFY_ALLOW` (whole-token match; default `npm test`, `npm run build`, `npm run lint`, `npm run typecheck`, `npx tsc --noEmit`, `node --test`, `pytest`, `go test`, `cargo test`, `make test`) and contain no shell metacharacters. `CKIT_VERIFY_TIMEOUT_MS` bounds each check. An invalid plan stops the run with no task executed and no re-request.
|
|
63
|
-
- Supported dialect: Chat Completions, non-streaming only (`stream:false`). No Responses API, no streaming, no tools. `usage` is optional.
|
|
64
|
-
- The executor uses its own login, config and permissions. CKit never passes any `CKIT_*` variable to it and never changes its config. Any other inherited variable whose value equals or contains the advisor key is withheld, except the worker's own credential variable for the selected executor (claude-code: `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`; omp: none) when you set it yourself with exactly that value (ADR-017, 2026-11-08). `ckit doctor` and `ckit run` print the withheld names and `worker auth: present|missing` (never values, validity not checked) before any advisor request.
|
|
65
|
-
- Headless `claude -p` cannot ask anyone to approve a file edit, so by default the worker cannot write files. To let it edit inside the workspace, set `CKIT_EXECUTOR_PERMISSION_MODE=acceptEdits` (or `dontAsk`) in your own `.env`. It is off by default; `bypassPermissions` and `--dangerously-skip-permissions` are refused. omp ignores this field and says so.
|
|
66
|
-
- What is sent to the endpoint: only the goal, the Primary instruction, the executor result text and reviewer opinions, each passed through secret redaction first.
|
|
67
|
-
- One request per step, no automatic resend or retry, and no fallback to another endpoint. A failed or uncertain step stops the run and is journaled.
|
|
68
|
-
- Mock/local test results are OFFLINE evidence only; a live endpoint check needs your own `.env`.
|
|
69
|
-
- Browser advisors are deferred and not part of this flow.
|
|
34
|
+
`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`.
|
|
70
35
|
|
|
71
36
|
## Quick start (contributor)
|
|
72
37
|
|
|
@@ -76,24 +41,13 @@ npm run build # strict tsc build -> dist/
|
|
|
76
41
|
npm test # node:test suite over dist/
|
|
77
42
|
npm run demo # minimal task flow through the SIMULATED advisor (offline, no external send)
|
|
78
43
|
npm run demo:fault # same flow with an injected ack-lost fault -> unknown outcome, no resend
|
|
79
|
-
npm run try # walk through the real `ckit run` flow offline: local mock advisor + fake worker in a temp project,
|
|
80
|
-
# then `doctor`, `status`, `sessions`; prints the command to open Mission Control on that run
|
|
81
44
|
```
|
|
82
45
|
|
|
83
46
|
Requirements: Node.js >= 22 (observed on v22.22.1, macOS arm64).
|
|
84
47
|
|
|
85
|
-
##
|
|
86
|
-
|
|
87
|
-
Published on npm as `@ngockhoale/ckit` (owner decision 2026-11-14; replaces the earlier private-tarball channel).
|
|
88
|
-
|
|
89
|
-
```bash
|
|
90
|
-
npm install -g @ngockhoale/ckit # update later with the same command
|
|
91
|
-
cd your-project && ckit # opens the GUI; first time it lands on Config
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Each machine needs its own logged-in agent CLIs (`codex`, `claude`, `omp`); CKit ships no credentials.
|
|
48
|
+
## Requirements
|
|
95
49
|
|
|
96
|
-
Requirements: Node.js >= 22 (uses `node:sqlite`, which prints an ExperimentalWarning on 22.x). Runtime deps: `ink`, `react` (MIT; lockfile licenses allowlisted by `test/security-supply-chain.test.ts`).
|
|
50
|
+
Requirements: Node.js >= 22 (uses `node:sqlite`, which prints an ExperimentalWarning on 22.x). Runtime deps: `ink`, `react` (MIT; lockfile licenses allowlisted by `test/security-supply-chain.test.ts`). Used on macOS arm64 / Node 22.22.1 only so far; other platforms are unverified. Published on npm as `@ngockhoale/ckit` (owner decision 2026-11-14).
|
|
97
51
|
|
|
98
52
|
## What exists now
|
|
99
53
|
|
package/dist/src/cli/ckit.js
CHANGED
|
@@ -28,9 +28,8 @@ import { buildDiagnosticBundle, describeConnection, formatDoctorReport, projectK
|
|
|
28
28
|
import { hasAnyAdvisorConfig, loadCkitConfig, maskedConfigSummary, resolveProjectRoot } from '../settings/env-config.js';
|
|
29
29
|
import { checkConnection } from '../adapters/openai/openai-advisor.js';
|
|
30
30
|
import { describeWorkerEnv, describeWorkerPermission, executorEnvironmentReport, resolveExecutable, selectExecutor } from '../adapters/launch/executor.js';
|
|
31
|
-
import { runApiTask } from '../run/api-run.js';
|
|
32
|
-
import { runPlannedTask } from '../run/plan-run.js';
|
|
33
31
|
import { runSetup } from './setup.js';
|
|
32
|
+
import { runInstallCommand, runUpdateCommand } from './lifecycle.js';
|
|
34
33
|
import { runGuiCommand } from '../gui/server.js';
|
|
35
34
|
import { loadTeamConfig, writeDefaultTeamConfig } from '../team/config.js';
|
|
36
35
|
import { startTeamRun } from '../team/engine.js';
|
|
@@ -177,7 +176,7 @@ function advisorDoctorState(root) {
|
|
|
177
176
|
const loaded = loadCkitConfig({ projectRoot: root });
|
|
178
177
|
return loaded.ok ? { state: 'ok', summary: maskedConfigSummary(loaded.config), versionHint: !/\/v\d+(\/|$)/i.test(new URL(loaded.config.baseUrl).pathname) } : { state: 'invalid', variables: [...new Set(loaded.issues.map(issue => issue.variable))], problems: loaded.issues.map(issue => ({ variable: issue.variable, problem: issue.problem })) };
|
|
179
178
|
}
|
|
180
|
-
/** Executor as
|
|
179
|
+
/** Executor as the team/advisor config resolves it (same selectExecutor/resolveExecutable); undefined when the advisor config is absent or invalid. */
|
|
181
180
|
function executorDoctorState(root) {
|
|
182
181
|
if (!hasAnyAdvisorConfig(root))
|
|
183
182
|
return undefined;
|
|
@@ -238,94 +237,6 @@ async function showDoctor(flags) {
|
|
|
238
237
|
}
|
|
239
238
|
return report.overall === 'fail' || connectionFailed ? 1 : 0;
|
|
240
239
|
}
|
|
241
|
-
const RUN_USAGE = 'usage: ckit run "<goal>" [--single] [--project=<path>] [--config-root=<dir>] [--executor=claude-code|omp] [--model=<m>] [--reviewers=<n>]';
|
|
242
|
-
async function showRun(args) {
|
|
243
|
-
const overrides = {};
|
|
244
|
-
let project, goal, configRootArg, single = false;
|
|
245
|
-
for (const arg of args) {
|
|
246
|
-
const eq = arg.indexOf('=');
|
|
247
|
-
const [name, value] = arg.startsWith('--') && eq > 2 ? [arg.slice(0, eq), arg.slice(eq + 1)] : [arg, ''];
|
|
248
|
-
if (arg === '--single')
|
|
249
|
-
single = true;
|
|
250
|
-
else if (name === '--project' && value)
|
|
251
|
-
project = value;
|
|
252
|
-
else if (name === '--config-root' && value)
|
|
253
|
-
configRootArg = value;
|
|
254
|
-
else if (name === '--executor' && value)
|
|
255
|
-
overrides['CKIT_EXECUTOR'] = value;
|
|
256
|
-
else if (name === '--model' && value)
|
|
257
|
-
overrides['CKIT_OPENAI_MODEL'] = value;
|
|
258
|
-
else if (name === '--reviewers' && value)
|
|
259
|
-
overrides['CKIT_REVIEWERS'] = value;
|
|
260
|
-
else if (!arg.startsWith('--') && goal === undefined)
|
|
261
|
-
goal = arg;
|
|
262
|
-
else
|
|
263
|
-
throw new TypeError(RUN_USAGE);
|
|
264
|
-
}
|
|
265
|
-
if (goal === undefined)
|
|
266
|
-
throw new TypeError(RUN_USAGE);
|
|
267
|
-
const root = resolveProjectRoot(process.cwd(), project);
|
|
268
|
-
let configRoot = root;
|
|
269
|
-
if (configRootArg !== undefined) {
|
|
270
|
-
try {
|
|
271
|
-
configRoot = realpathSync(resolve(configRootArg));
|
|
272
|
-
if (!statSync(configRoot).isDirectory())
|
|
273
|
-
throw new Error('not a directory');
|
|
274
|
-
}
|
|
275
|
-
catch {
|
|
276
|
-
console.error('ckit: --config-root must be an existing directory. Fix: pass --config-root=<dir> where <dir> contains the settings file, or omit the flag to use the project root.');
|
|
277
|
-
return 2;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
const loaded = loadCkitConfig({ projectRoot: configRoot, overrides });
|
|
281
|
-
if (!loaded.ok) {
|
|
282
|
-
console.error('ckit: advisor configuration is not valid:');
|
|
283
|
-
for (const issue of loaded.issues)
|
|
284
|
-
console.error(` ${issue.variable}: ${issue.problem}. ${issue.fix}`);
|
|
285
|
-
return 2;
|
|
286
|
-
}
|
|
287
|
-
const spec = selectExecutor(loaded.config);
|
|
288
|
-
let executorPath;
|
|
289
|
-
try {
|
|
290
|
-
executorPath = resolveExecutable(spec, loaded.config);
|
|
291
|
-
}
|
|
292
|
-
catch (error) {
|
|
293
|
-
console.error(`ckit: ${error instanceof Error ? error.message : 'executor not available'}`);
|
|
294
|
-
return 2;
|
|
295
|
-
}
|
|
296
|
-
safeText(goal);
|
|
297
|
-
const { binding, stateDir } = await canonicalProject(root);
|
|
298
|
-
const journal = { projectId: binding.projectId, stateDir, read: () => readEvents(join(stateDir, EVENTS_FILE)), write: events => writeEvents(stateDir, events), lock: operation => withJournalLock(stateDir, operation) };
|
|
299
|
-
console.log(`ckit run: ${maskedConfigSummary(loaded.config)}`);
|
|
300
|
-
console.log(`config: ${loaded.configFile ?? 'none (process env only)'}`);
|
|
301
|
-
console.log(`workspace: ${binding.canonicalCwd}`);
|
|
302
|
-
const base = { projectRoot: binding.canonicalCwd, goal, config: loaded.config, journal, executorSpec: spec, executorPath };
|
|
303
|
-
// The worker runs in its own process group (detached), so a terminal Ctrl-C no longer reaches it.
|
|
304
|
-
// Forward SIGINT/SIGTERM into the run's AbortSignal: the executor's cancelled path group-kills the worker,
|
|
305
|
-
// the outcome is journaled cancelled/unknown (never success), and nothing is resent.
|
|
306
|
-
// Exit code for an interrupted run: 130 (SIGINT) or 143 (SIGTERM), the shell convention 128+signal. A repeat signal escalates to SIGKILL.
|
|
307
|
-
const controller = new AbortController(), hard = new AbortController();
|
|
308
|
-
let interruptedBy;
|
|
309
|
-
// process.on (not once): a repeat signal during the kill grace must not reach Node's default action, which would exit
|
|
310
|
-
// ckit and leave a SIGTERM-ignoring worker orphaned. The first signal aborts; a repeat escalates to SIGKILL on the group.
|
|
311
|
-
const onSignal = (sig) => { if (interruptedBy === undefined) {
|
|
312
|
-
interruptedBy = sig;
|
|
313
|
-
controller.abort();
|
|
314
|
-
}
|
|
315
|
-
else
|
|
316
|
-
hard.abort(); };
|
|
317
|
-
const onSigint = () => onSignal('SIGINT'), onSigterm = () => onSignal('SIGTERM');
|
|
318
|
-
process.on('SIGINT', onSigint);
|
|
319
|
-
process.on('SIGTERM', onSigterm);
|
|
320
|
-
try {
|
|
321
|
-
const result = await (single ? runApiTask({ ...base, signal: controller.signal, hardKill: hard.signal }) : runPlannedTask({ ...base, signal: controller.signal, hardKill: hard.signal }));
|
|
322
|
-
return interruptedBy === undefined ? result.exitCode : interruptedBy === 'SIGINT' ? 130 : 143;
|
|
323
|
-
}
|
|
324
|
-
finally {
|
|
325
|
-
process.removeListener('SIGINT', onSigint);
|
|
326
|
-
process.removeListener('SIGTERM', onSigterm);
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
240
|
/** Mission options for `ckit tui`: one read-only Plan snapshot, REPLAY mode (no side effects); the Actions panel is bound to nothing, so every control is disabled with a reason. */
|
|
330
241
|
export async function buildTuiMissionOptions(cwd, width = Math.max(20, (process.stdout.columns ?? 80) - 4)) {
|
|
331
242
|
const plan = await readMissionPlan(cwd);
|
|
@@ -352,7 +263,7 @@ async function showTui() {
|
|
|
352
263
|
const mission = await buildTuiMissionOptions(cwd);
|
|
353
264
|
try {
|
|
354
265
|
// Ctrl-C quits through Ink's default exitOnCtrlC; `q` unmounts via onQuit.
|
|
355
|
-
// TTY: live follow — re-reads the journal (read-only) so a
|
|
266
|
+
// TTY: live follow — re-reads the journal (read-only) so a run in another terminal shows up as it happens.
|
|
356
267
|
if (process.stdin.isTTY) {
|
|
357
268
|
const load = async () => (await getProjectEvents()).events;
|
|
358
269
|
const instance = render(React.createElement(LiveApp, { initial: events, load, ...(setup ? { setupModel: setup.model } : {}), viewOptions: { viewKeys: true, mission, onQuit: () => instance.unmount() } }));
|
|
@@ -432,10 +343,11 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
432
343
|
await showTui();
|
|
433
344
|
return 0;
|
|
434
345
|
case 'setup': return await runSetup(rest);
|
|
346
|
+
case 'install': return await runInstallCommand(rest);
|
|
347
|
+
case 'update': return await runUpdateCommand(rest);
|
|
435
348
|
case 'gui': return await runGuiCommand(rest);
|
|
436
349
|
case 'team': return await showTeam(rest);
|
|
437
350
|
case 'doctor': return await showDoctor(rest);
|
|
438
|
-
case 'run': return await showRun(rest);
|
|
439
351
|
case 'sessions': return await showSessions(rest);
|
|
440
352
|
case 'open': return await showOpen(rest);
|
|
441
353
|
case 'replay': return await showReplay(rest);
|
|
@@ -451,7 +363,7 @@ export async function main(args = process.argv.slice(2)) {
|
|
|
451
363
|
case undefined: if (process.stdin.isTTY === true && process.stdout.isTTY === true)
|
|
452
364
|
return await runGuiCommand([]);
|
|
453
365
|
// falls through
|
|
454
|
-
default: throw new TypeError('usage: ckit (no command: opens the GUI) | ckit <new <goal>|status|demo|tui|gui [--port=<n>] [--no-open]|team "<goal>"|team --demo|team --init|setup [--path]|
|
|
366
|
+
default: throw new TypeError('usage: ckit (no command: opens the GUI) | ckit <install|update [--check]|new <goal>|status|demo|tui|gui [--port=<n>] [--no-open]|team "<goal>"|team --demo|team --init|setup [--path]|sessions|open <sessionId>|replay <sessionId>|backup <dest-dir>|restore <backup-dir> (each takes [--project=<path>])|doctor [--bundle] [--agent=<path>] [--check-connection]|--version>');
|
|
455
367
|
}
|
|
456
368
|
}
|
|
457
369
|
catch (error) {
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export declare const PACKAGE_NAME = "@ngockhoale/ckit";
|
|
2
|
+
export declare function installedVersion(): string;
|
|
3
|
+
export interface InstallResult {
|
|
4
|
+
readonly root: string;
|
|
5
|
+
readonly configFile: string;
|
|
6
|
+
readonly created: boolean;
|
|
7
|
+
readonly gitignoreUpdated: boolean;
|
|
8
|
+
}
|
|
9
|
+
/** Prepares `cwd` (exactly that folder, never a parent) for CKit: writes the default .ckit/team.json when missing; keeps an existing one untouched. */
|
|
10
|
+
export declare function installProject(cwd: string): InstallResult;
|
|
11
|
+
export declare function runInstallCommand(args: readonly string[]): Promise<number>;
|
|
12
|
+
/** Runs npm; returns exit status and captured stdout (stdout is '' when inherited). */
|
|
13
|
+
export type NpmRunner = (args: readonly string[], inherit: boolean) => {
|
|
14
|
+
status: number;
|
|
15
|
+
stdout: string;
|
|
16
|
+
};
|
|
17
|
+
/** true when version a is newer than b (numeric major.minor.patch; with equal numbers a release beats a pre-release). */
|
|
18
|
+
export declare function isNewer(a: string, b: string): boolean;
|
|
19
|
+
export declare function runUpdateCommand(args: readonly string[], npm?: NpmRunner, current?: string, log?: (line: string) => void): Promise<number>;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
// `ckit install` (prepare the current folder) and `ckit update` (upgrade the globally installed package from npm).
|
|
2
|
+
import { spawnSync } from 'node:child_process';
|
|
3
|
+
import { appendFileSync, existsSync, readFileSync, realpathSync } from 'node:fs';
|
|
4
|
+
import { dirname, join, resolve } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { teamConfigPath, writeDefaultTeamConfig } from '../team/config.js';
|
|
7
|
+
export const PACKAGE_NAME = '@ngockhoale/ckit';
|
|
8
|
+
const IGNORE_LINE = '.ckit/team/';
|
|
9
|
+
export function installedVersion() {
|
|
10
|
+
// dist/src/cli/lifecycle.js -> package root is three levels up.
|
|
11
|
+
const pkg = JSON.parse(readFileSync(join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', 'package.json'), 'utf8'));
|
|
12
|
+
return typeof pkg.version === 'string' ? pkg.version : 'unknown';
|
|
13
|
+
}
|
|
14
|
+
/** Prepares `cwd` (exactly that folder, never a parent) for CKit: writes the default .ckit/team.json when missing; keeps an existing one untouched. */
|
|
15
|
+
export function installProject(cwd) {
|
|
16
|
+
let root;
|
|
17
|
+
try {
|
|
18
|
+
root = realpathSync(resolve(cwd));
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
root = resolve(cwd);
|
|
22
|
+
}
|
|
23
|
+
const configFile = teamConfigPath(root), created = !existsSync(configFile);
|
|
24
|
+
if (created)
|
|
25
|
+
writeDefaultTeamConfig(root);
|
|
26
|
+
// Run journals and uploads are local working data: keep them out of git when the folder already has a .gitignore.
|
|
27
|
+
let gitignoreUpdated = false;
|
|
28
|
+
const gi = join(root, '.gitignore');
|
|
29
|
+
if (existsSync(gi)) {
|
|
30
|
+
const text = readFileSync(gi, 'utf8');
|
|
31
|
+
if (!text.split(/\r?\n/).some(l => l.trim() === IGNORE_LINE || l.trim() === '.ckit/' || l.trim() === '.ckit')) {
|
|
32
|
+
appendFileSync(gi, `${text === '' || text.endsWith('\n') ? '' : '\n'}${IGNORE_LINE}\n`);
|
|
33
|
+
gitignoreUpdated = true;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return { root, configFile, created, gitignoreUpdated };
|
|
37
|
+
}
|
|
38
|
+
export async function runInstallCommand(args) {
|
|
39
|
+
if (args.length !== 0)
|
|
40
|
+
throw new TypeError('usage: ckit install');
|
|
41
|
+
const r = installProject(process.cwd());
|
|
42
|
+
console.log(`CKit ${installedVersion()} is ready in ${r.root}`);
|
|
43
|
+
console.log(r.created ? `created ${r.configFile} (default team; change CLI and model per agent in the GUI: Config)` : `kept your existing ${r.configFile}`);
|
|
44
|
+
if (r.gitignoreUpdated)
|
|
45
|
+
console.log(`added ${IGNORE_LINE} to .gitignore (run journals and uploads stay local)`);
|
|
46
|
+
console.log('next: run "ckit" in this folder to open the GUI.');
|
|
47
|
+
return 0;
|
|
48
|
+
}
|
|
49
|
+
const realNpm = (args, inherit) => {
|
|
50
|
+
const r = spawnSync('npm', [...args], { encoding: 'utf8', stdio: inherit ? 'inherit' : ['ignore', 'pipe', 'pipe'], shell: process.platform === 'win32' });
|
|
51
|
+
return { status: r.error ? 1 : r.status ?? 1, stdout: typeof r.stdout === 'string' ? r.stdout : '' };
|
|
52
|
+
};
|
|
53
|
+
/** true when version a is newer than b (numeric major.minor.patch; with equal numbers a release beats a pre-release). */
|
|
54
|
+
export function isNewer(a, b) {
|
|
55
|
+
const parse = (v) => { const [core = '', ...rest] = v.split('-'); return { n: core.split('.').map(x => Number(x) || 0), pre: rest.length > 0 }; };
|
|
56
|
+
const x = parse(a), y = parse(b);
|
|
57
|
+
for (let i = 0; i < 3; i++) {
|
|
58
|
+
const d = (x.n[i] ?? 0) - (y.n[i] ?? 0);
|
|
59
|
+
if (d !== 0)
|
|
60
|
+
return d > 0;
|
|
61
|
+
}
|
|
62
|
+
return !x.pre && y.pre;
|
|
63
|
+
}
|
|
64
|
+
export async function runUpdateCommand(args, npm = realNpm, current = installedVersion(), log = console.log) {
|
|
65
|
+
const checkOnly = args.length === 1 && args[0] === '--check';
|
|
66
|
+
if (args.length !== 0 && !checkOnly)
|
|
67
|
+
throw new TypeError('usage: ckit update [--check]');
|
|
68
|
+
const view = npm(['view', `${PACKAGE_NAME}@latest`, 'version'], false), latest = view.stdout.trim();
|
|
69
|
+
if (view.status !== 0 || !/^\d+\.\d+\.\d+(?:-[0-9A-Za-z.]+)?$/.test(latest)) {
|
|
70
|
+
log(`could not read the latest version of ${PACKAGE_NAME} from npm (check the network and "npm whoami"/registry settings). Installed: ${current}`);
|
|
71
|
+
return 1;
|
|
72
|
+
}
|
|
73
|
+
if (!isNewer(latest, current)) {
|
|
74
|
+
log(latest === current ? `CKit is up to date (${current}).` : `CKit ${current} is newer than the published ${latest}; nothing to update.`);
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
if (checkOnly) {
|
|
78
|
+
log(`update available: ${current} -> ${latest}. Run "ckit update" to install it.`);
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
log(`updating CKit ${current} -> ${latest} (npm install -g ${PACKAGE_NAME}@${latest})`);
|
|
82
|
+
const r = npm(['install', '-g', `${PACKAGE_NAME}@${latest}`], true);
|
|
83
|
+
if (r.status !== 0) {
|
|
84
|
+
log(`npm could not install the update (exit ${r.status}). Run it yourself to see why: npm install -g ${PACKAGE_NAME}@latest`);
|
|
85
|
+
return 1;
|
|
86
|
+
}
|
|
87
|
+
log(`CKit ${latest} installed. Restart any running "ckit gui" to use it; your projects' .ckit/team.json files are unchanged.`);
|
|
88
|
+
return 0;
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=lifecycle.js.map
|
package/dist/src/cli/setup.js
CHANGED
|
@@ -102,7 +102,7 @@ export async function setupWith(args, io) {
|
|
|
102
102
|
renameSync(temp, file);
|
|
103
103
|
say(`Saved ${file}`);
|
|
104
104
|
say(maskedConfigSummary(check.config));
|
|
105
|
-
say('Next: ckit doctor --check-connection, then ckit
|
|
105
|
+
say('Next: ckit doctor --check-connection, then run ckit (GUI) or ckit team "<goal>" inside your project folder');
|
|
106
106
|
return 0;
|
|
107
107
|
}
|
|
108
108
|
finally {
|
package/dist/src/gui/server.js
CHANGED
|
@@ -489,7 +489,7 @@ export async function runGuiCommand(args) {
|
|
|
489
489
|
throw error;
|
|
490
490
|
srv = await startGuiServer({ projectRoot: root, port: 0, open, host, ...extra });
|
|
491
491
|
}
|
|
492
|
-
process.stdout.write(`CKit Agent Company GUI: ${srv.url}\nProject folder (agents run here): ${root}\n${host === '127.0.0.1' ? '' : `LAN access is ON (host ${host}): from another machine open one of:\n${[hostname(), ...Object.values(networkInterfaces()).flat().filter(i => i && i.family === 'IPv4' && !i.internal).map(i => i.address)].map(h => ` ${srv.url.replace('127.0.0.1', h)}`).join('\n')}\nAnyone on the network holding this link can drive the agents; the link is plain HTTP.\n`}Ctrl+C to stop.\n`);
|
|
492
|
+
process.stdout.write(`CKit Agent Company GUI: ${srv.url}\nProject folder (agents run here): ${root}\nKeeps running after the browser tab is closed (runs continue; reopen the link any time). Stop it with Ctrl+C in this terminal.\n${host === '127.0.0.1' ? '' : `LAN access is ON (host ${host}): from another machine open one of:\n${[hostname(), ...Object.values(networkInterfaces()).flat().filter(i => i && i.family === 'IPv4' && !i.internal).map(i => i.address)].map(h => ` ${srv.url.replace('127.0.0.1', h)}`).join('\n')}\nAnyone on the network holding this link can drive the agents; the link is plain HTTP.\n`}Ctrl+C to stop.\n`);
|
|
493
493
|
await new Promise(r => { process.once('SIGINT', () => r()); process.once('SIGTERM', () => r()); });
|
|
494
494
|
await srv.close();
|
|
495
495
|
return 0;
|
package/dist/src/team/config.js
CHANGED
|
@@ -29,7 +29,7 @@ export function parseTeamConfig(json) {
|
|
|
29
29
|
return null;
|
|
30
30
|
}
|
|
31
31
|
const n = errors.length;
|
|
32
|
-
const id = raw['id'], name = raw['name'], cli = raw['cli'], model = raw['model'] ?? null, access = raw['access'] ?? 'read', persona = raw['persona'];
|
|
32
|
+
const id = raw['id'], name = raw['name'], cli = raw['cli'], model = raw['model'] ?? null, access = raw['access'] ?? 'read', persona = raw['persona'], short = raw['short'];
|
|
33
33
|
if (typeof id !== 'string' || !ID_RE.test(id))
|
|
34
34
|
errors.push(`${path}.id must match ${ID_RE}`);
|
|
35
35
|
else if (seen.has(id))
|
|
@@ -50,6 +50,8 @@ export function parseTeamConfig(json) {
|
|
|
50
50
|
errors.push(`${path}.access must be read|write`);
|
|
51
51
|
if (persona !== undefined && typeof persona !== 'string')
|
|
52
52
|
errors.push(`${path}.persona must be a string`);
|
|
53
|
+
if (short !== undefined && (typeof short !== 'string' || !/^[\p{L}\p{N}]{1,4}$/u.test(short)))
|
|
54
|
+
errors.push(`${path}.short must be 1-4 letters or digits`);
|
|
53
55
|
const baseUrl = raw['baseUrl'], apiKeyRef = raw['apiKeyRef'];
|
|
54
56
|
if (baseUrl !== undefined && (typeof baseUrl !== 'string' || !/^https?:\/\/[^\s/]+/i.test(baseUrl)))
|
|
55
57
|
errors.push(`${path}.baseUrl must be an http(s) URL`);
|
|
@@ -57,7 +59,7 @@ export function parseTeamConfig(json) {
|
|
|
57
59
|
errors.push(`${path}.apiKeyRef must match /^[A-Za-z0-9_-]{1,64}$/`);
|
|
58
60
|
if (errors.length > n)
|
|
59
61
|
return null;
|
|
60
|
-
return { id: id, name: name, team, cli: cli, model: model, access: access, ...(typeof persona === 'string' ? { persona } : {}), ...(typeof baseUrl === 'string' ? { baseUrl: baseUrl.replace(/\/+$/, '') } : {}), ...(typeof apiKeyRef === 'string' ? { apiKeyRef } : {}) };
|
|
62
|
+
return { id: id, name: name, team, cli: cli, model: model, access: access, ...(typeof persona === 'string' ? { persona } : {}), ...(typeof short === 'string' ? { short: short.toUpperCase() } : {}), ...(typeof baseUrl === 'string' ? { baseUrl: baseUrl.replace(/\/+$/, '') } : {}), ...(typeof apiKeyRef === 'string' ? { apiKeyRef } : {}) };
|
|
61
63
|
};
|
|
62
64
|
const director = parseAgent(json['director'], 'director', 'director');
|
|
63
65
|
const teams = isObj(json['teams']) ? json['teams'] : (errors.push('teams must be an object'), {});
|
package/dist/src/team/types.d.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface AgentConfig {
|
|
|
10
10
|
readonly cli: AgentCli;
|
|
11
11
|
readonly model: string | null;
|
|
12
12
|
readonly access: AgentAccess;
|
|
13
|
+
/** Optional badge text shown inside the agent's circle in the GUI: 1-4 letters/digits, stored upper-case. Absent = two letters derived from the name. */
|
|
14
|
+
readonly short?: string;
|
|
13
15
|
readonly persona?: string;
|
|
14
16
|
/** cli 'api' only: per-agent OpenAI-compatible endpoint (must include the version segment, e.g. https://host/v1). Absent = the CKit advisor endpoint. */
|
|
15
17
|
readonly baseUrl?: string;
|
package/gui/app.css
CHANGED
|
@@ -42,7 +42,7 @@ main{flex:1;min-height:0}
|
|
|
42
42
|
.rteam{font:700 10px var(--mono);letter-spacing:.12em;margin:10px 2px 6px;display:flex;align-items:center;gap:6px}.rteam:first-child{margin-top:2px}.rteam i{width:7px;height:7px;border-radius:2px}
|
|
43
43
|
.tile{border:1px solid var(--tc);border-left-width:3px;border-radius:8px;padding:7px 8px;margin-bottom:6px;background:linear-gradient(160deg,rgba(255,255,255,.03),transparent),var(--p2);cursor:pointer;opacity:.82;transition:.2s;box-shadow:0 0 0 rgba(0,0,0,0)}
|
|
44
44
|
.tile.sel{outline:1px dashed #fff8}.tile.thinking{opacity:1;box-shadow:0 0 18px var(--tg)}.tile.done{opacity:.95}.tile.failed{border-color:var(--rd)}
|
|
45
|
-
.trow{display:flex;gap:8px;align-items:center}.av{width:34px;height:34px;border-radius:50%;border:2px solid var(--tc);display:grid;place-items:center;font-weight:700;background:radial-gradient(circle at 30% 30%,var(--tg),#0a101c);flex:none;font-size:13px}
|
|
45
|
+
.trow{display:flex;gap:8px;align-items:center}.av{width:34px;height:34px;border-radius:50%;border:2px solid var(--tc);display:grid;place-items:center;font-weight:700;background:radial-gradient(circle at 30% 30%,var(--tg),#0a101c);flex:none;font-size:13px;letter-spacing:-.02em;overflow:hidden}.av.w3{font-size:11px}.av.w4{font-size:9.5px}
|
|
46
46
|
.tname{font-weight:600;font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.tsub{display:flex;flex-direction:column;gap:3px;align-items:flex-start;margin-top:3px;min-width:0}.tsub .pill{max-width:100%;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
47
47
|
.pill{font:600 9px var(--mono);padding:1px 7px;border-radius:9px;border:1px solid var(--b2);color:var(--mu);letter-spacing:.04em;white-space:nowrap}
|
|
48
48
|
.sp{display:inline-flex;align-items:center;gap:4px;font:700 9px var(--mono);letter-spacing:.08em;text-transform:uppercase;padding:1px 7px;border-radius:9px;border:1px solid var(--b2);color:var(--mu)}
|
package/gui/app.js
CHANGED
|
@@ -324,7 +324,7 @@
|
|
|
324
324
|
ids.forEach(function (id) {
|
|
325
325
|
var a = A(id), c = TC[team], el = h('div', {class: 'tile ' + a.state + (S.selected === id ? ' sel' : ''), style: '--tc:' + c + ';--tg:' + hexA(c, .4), onclick: function () { S.selected = id; net.select(id); S.dirty = true; }});
|
|
326
326
|
var work = a.state === 'thinking';
|
|
327
|
-
el.appendChild(h('div', {class: 'trow'}, [h('div', {class: 'av', text: net.initials(a.cfg)}), h('div', {style: 'min-width:0;flex:1'}, [h('div', {class: 'tname', text: a.cfg.name}), h('div', {class: 'tsub'}, [h('span', {class: 'pill', text: a.cfg.cli}), a.cfg.model ? h('span', {class: 'pill', title: a.cfg.model, text: a.cfg.model}) : null])]),
|
|
327
|
+
el.appendChild(h('div', {class: 'trow'}, [h('div', {class: 'av w' + net.initials(a.cfg).length, text: net.initials(a.cfg)}), h('div', {style: 'min-width:0;flex:1'}, [h('div', {class: 'tname', text: a.cfg.name}), h('div', {class: 'tsub'}, [h('span', {class: 'pill', text: a.cfg.cli}), a.cfg.model ? h('span', {class: 'pill', title: a.cfg.model, text: a.cfg.model}) : null])]),
|
|
328
328
|
h('div', {class: 'tright'}, [h('span', {class: 'sp ' + a.state}, [h('i'), a.state]), h('span', {class: 'tok', text: (work ? fmtT(performance.now() - a.t0) + ' · ' : '') + fmtN(a.tokens) + ' tok'})])]));
|
|
329
329
|
if (work && a.label) {
|
|
330
330
|
el.appendChild(h('div', {class: 'step', text: 'Step ' + a.step + (a.total ? '/' + a.total : '') + ' · ' + a.label}));
|
|
@@ -356,7 +356,7 @@
|
|
|
356
356
|
if (a) {
|
|
357
357
|
var c = TC[a.cfg.team];
|
|
358
358
|
r.appendChild(h('h3', {text: 'Agent inspector'}));
|
|
359
|
-
r.appendChild(h('div', {class: 'card', style: 'border-color:' + c}, [h('div', {class: 'trow'}, [h('div', {class: 'av', style: '--tc:' + c + ';--tg:' + hexA(c, .4), text: net.initials(a.cfg)}), h('div', {}, [h('b', {text: a.cfg.name}), h('div', {class: 'ml', text: TL[a.cfg.team]})])]),
|
|
359
|
+
r.appendChild(h('div', {class: 'card', style: 'border-color:' + c}, [h('div', {class: 'trow'}, [h('div', {class: 'av w' + net.initials(a.cfg).length, style: '--tc:' + c + ';--tg:' + hexA(c, .4), text: net.initials(a.cfg)}), h('div', {}, [h('b', {text: a.cfg.name}), h('div', {class: 'ml', text: TL[a.cfg.team]})])]),
|
|
360
360
|
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.state), kv('Tokens', fmtN(a.tokens)),
|
|
361
361
|
h('div', {class: 'ml', style: 'margin-top:6px', text: 'Current task'}), h('div', {style: 'font-size:12px', text: a.task || '—'})]));
|
|
362
362
|
var af = (S.fails || []).filter(function (f) { return f.agentId === a.cfg.id; }).pop();
|
|
@@ -537,7 +537,7 @@
|
|
|
537
537
|
/* config editor (settings view + popup) */
|
|
538
538
|
function strip(cfg) {
|
|
539
539
|
var c = JSON.parse(JSON.stringify(cfg));
|
|
540
|
-
[c.director].concat(c.teams.ba, c.teams.implement, c.teams.qc).forEach(function (a) { delete a.hasKey; delete a._auto; if (a.baseUrl === '') delete a.baseUrl; if (!a.persona) delete a.persona; });
|
|
540
|
+
[c.director].concat(c.teams.ba, c.teams.implement, c.teams.qc).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; });
|
|
541
541
|
return c;
|
|
542
542
|
}
|
|
543
543
|
function mountEditor(box, modal) {
|
|
@@ -595,7 +595,9 @@
|
|
|
595
595
|
function editAgent(a) {
|
|
596
596
|
var isDir = a.team === 'director', f = h('div');
|
|
597
597
|
f.appendChild(h('div', {class: 'sec', text: 'IDENTITY'}));
|
|
598
|
-
|
|
598
|
+
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).'});
|
|
599
|
+
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; });
|
|
600
|
+
f.appendChild(h('div', {class: 'row2', style: 'grid-template-columns:150px 1fr 1fr'}, [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}))]));
|
|
599
601
|
f.appendChild(fld('Persona / extra guidance (optional)', bind(h('textarea', {rows: 2, value: a.persona || ''}), a, 'persona')));
|
|
600
602
|
f.appendChild(h('div', {class: 'sec', text: 'ENGINE'}));
|
|
601
603
|
/* an agent is: which CLI of this machine, and which of that CLI's own models. `api` stays selectable only where it is already in use. */
|
package/gui/network.js
CHANGED
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
/* thinking arc */
|
|
197
197
|
if (anyThink) { ctx.strokeStyle = '#fff'; ctx.lineWidth = 2.5; ctx.beginPath(); var ra = tms / 300; ctx.arc(x, y, r * 1.12, ra, ra + 1.6); ctx.stroke(); }
|
|
198
198
|
ctx.fillStyle = 'rgba(10,6,24,.9)'; ctx.font = '800 ' + Math.round(19 * S) + 'px system-ui,sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
|
|
199
|
-
ctx.fillStyle = '#fff'; ctx.fillText(
|
|
199
|
+
var dlab = nodes.director ? initials(nodes.director.agent) : 'DIR'; if (dlab.length > 3) ctx.font = '800 ' + Math.round(16 * S) + 'px system-ui,sans-serif'; ctx.fillStyle = '#fff'; ctx.fillText(dlab, x, y + .5);
|
|
200
200
|
if (wide) { ctx.restore(); return; } /* no room under the hub on a letterbox canvas */
|
|
201
201
|
/* label */
|
|
202
202
|
ctx.font = '600 ' + Math.round(11 * Math.max(.9, S)) + 'px ui-monospace,Menlo,monospace';
|
|
@@ -206,7 +206,7 @@
|
|
|
206
206
|
if (stageLoop > 1 && stageIdx >= 2) { ctx.fillStyle = '#F3A544'; ctx.fillText('QC LOOP ' + stageLoop, x, ly + 20 * S); }
|
|
207
207
|
ctx.restore();
|
|
208
208
|
}
|
|
209
|
-
function initials(a) { 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); }
|
|
209
|
+
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
210
|
function cut(t, n) { return t.length > n ? t.slice(0, n - 1) + '…' : t; }
|
|
211
211
|
function drawNode(n, tms) {
|
|
212
212
|
if (n.agent.team === 'director') return;
|
|
@@ -240,8 +240,8 @@
|
|
|
240
240
|
for (var d = 0; d < 3; d++) { var da = tms / 500 + d * 2.09; ctx.fillStyle = '#fff'; ctx.beginPath(); ctx.arc(x + Math.cos(da) * (r + 25 * S), y + Math.sin(da) * (r + 25 * S), 1.8, 0, 6.283); ctx.fill(); }
|
|
241
241
|
}
|
|
242
242
|
if (sel) { ctx.strokeStyle = 'rgba(255,255,255,.8)'; ctx.setLineDash([3, 3]); ctx.lineWidth = 1; ctx.beginPath(); ctx.arc(x, y, r + 15 * S, 0, 6.283); ctx.stroke(); ctx.setLineDash([]); }
|
|
243
|
-
ctx.fillStyle = '#F4F8FF'; ctx.font = '800 ' + Math.round(r * .6) + 'px system-ui,sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
|
|
244
|
-
ctx.shadowColor = 'rgba(0,0,0,.7)'; ctx.shadowBlur = 6; ctx.fillText(
|
|
243
|
+
var badge = initials(n.agent); ctx.fillStyle = '#F4F8FF'; ctx.font = '800 ' + Math.round(r * (badge.length > 3 ? .42 : badge.length > 2 ? .5 : .6)) + 'px system-ui,sans-serif'; ctx.textAlign = 'center'; ctx.textBaseline = 'middle';
|
|
244
|
+
ctx.shadowColor = 'rgba(0,0,0,.7)'; ctx.shadowBlur = 6; ctx.fillText(badge, x, y + 1); ctx.shadowBlur = 0;
|
|
245
245
|
if (st === 'done' || st === 'failed') { var bx = x + r * .74, by = y - r * .74, bb = Math.max(6, 8 * S); ctx.fillStyle = '#05070D'; ctx.beginPath(); ctx.arc(bx, by, bb + 2, 0, 6.283); ctx.fill(); ctx.fillStyle = ring; ctx.beginPath(); ctx.arc(bx, by, bb, 0, 6.283); ctx.fill(); ctx.fillStyle = '#05070D'; ctx.font = '800 ' + Math.round(bb * 1.3) + 'px sans-serif'; ctx.fillText(st === 'done' ? '✓' : '!', bx, by + .5); }
|
|
246
246
|
/* name plate: name, then engine/model, or the live step while working */
|
|
247
247
|
var subs = S < .72 ? [] : thinking && n.prog && n.prog.label ? ['STEP ' + n.prog.step + (n.prog.total ? '/' + n.prog.total : '') + ' · ' + n.prog.label] : [n.agent.cli || '', n.agent.model || ''].filter(Boolean);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ngockhoale/ckit",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.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": {
|
|
@@ -31,8 +31,7 @@
|
|
|
31
31
|
"demo:fault": "npm run build && node dist/src/cli/demo.js --fault=ack-lost",
|
|
32
32
|
"t00-04:harness": "npm run build && node dist/src/host/t00-04-harness.js",
|
|
33
33
|
"cli": "npm run build && node dist/src/cli/ckit.js",
|
|
34
|
-
"tui": "npm run build && node dist/src/cli/ckit.js tui"
|
|
35
|
-
"try": "npm run build && node scripts/try-offline.mjs"
|
|
34
|
+
"tui": "npm run build && node dist/src/cli/ckit.js tui"
|
|
36
35
|
},
|
|
37
36
|
"devDependencies": {
|
|
38
37
|
"@types/node": "^22.18.0",
|