zelari-code 2.50.1 → 2.51.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/README.md +1 -0
  2. package/dist/cli/acp/command.js +127 -0
  3. package/dist/cli/acp/command.js.map +1 -0
  4. package/dist/cli/acp/eventMap.js +84 -0
  5. package/dist/cli/acp/eventMap.js.map +1 -0
  6. package/dist/cli/acp/framing.js +118 -0
  7. package/dist/cli/acp/framing.js.map +1 -0
  8. package/dist/cli/acp/protocol.js +192 -0
  9. package/dist/cli/acp/protocol.js.map +1 -0
  10. package/dist/cli/acp/server.js +229 -0
  11. package/dist/cli/acp/server.js.map +1 -0
  12. package/dist/cli/acp/turnAdapter.js +144 -0
  13. package/dist/cli/acp/turnAdapter.js.map +1 -0
  14. package/dist/cli/commands/report.js +273 -0
  15. package/dist/cli/commands/report.js.map +1 -0
  16. package/dist/cli/components/statusChips.js +18 -1
  17. package/dist/cli/components/statusChips.js.map +1 -1
  18. package/dist/cli/main.bundled.js +2392 -763
  19. package/dist/cli/main.bundled.js.map +4 -4
  20. package/dist/cli/main.js +32 -0
  21. package/dist/cli/main.js.map +1 -1
  22. package/dist/cli/safety/jails/baseEnv.js +132 -0
  23. package/dist/cli/safety/jails/baseEnv.js.map +1 -0
  24. package/dist/cli/safety/jails/execPath.js +116 -0
  25. package/dist/cli/safety/jails/execPath.js.map +1 -0
  26. package/dist/cli/safety/jails/linux.js +19 -21
  27. package/dist/cli/safety/jails/linux.js.map +1 -1
  28. package/dist/cli/safety/osJail.js +29 -5
  29. package/dist/cli/safety/osJail.js.map +1 -1
  30. package/dist/cli/slashCommands.js +21 -1
  31. package/dist/cli/slashCommands.js.map +1 -1
  32. package/dist/cli/slashHandlers/statusline.js +126 -0
  33. package/dist/cli/slashHandlers/statusline.js.map +1 -0
  34. package/dist/cli/statusline/statuslineConfig.js +169 -0
  35. package/dist/cli/statusline/statuslineConfig.js.map +1 -0
  36. package/dist/cli/statusline/statuslineCustom.js +154 -0
  37. package/dist/cli/statusline/statuslineCustom.js.map +1 -0
  38. package/dist/cli/statusline/statuslineItems.js +93 -0
  39. package/dist/cli/statusline/statuslineItems.js.map +1 -0
  40. package/package.json +2 -2
@@ -0,0 +1,154 @@
1
+ /**
2
+ * statuslineCustom — the `custom` status-line item: run a user script and show
3
+ * its first line (t114).
4
+ *
5
+ * PROTOCOL (stable, documented for users):
6
+ * - the script is a shell command line (the same shell the tool surface
7
+ * resolves — Git Bash on Windows when present, /bin/sh elsewhere), so
8
+ * `node ~/status.js` or `./bin/status.sh` both work;
9
+ * - one JSON object arrives on STDIN:
10
+ * {cwd, model, sessionId, turn, pendingTodos}
11
+ * - the FIRST line of STDOUT becomes the item text, ANSI/OSC escapes
12
+ * stripped and truncated to 120 chars;
13
+ * - the item is HIDDEN (never a crash, never a partial chip) when the
14
+ * script exits non-zero, produces no usable first line, or exceeds the
15
+ * timeout — in which case the child is killed.
16
+ *
17
+ * Two entry points share the same protocol helpers:
18
+ * - `runStatusLineCustomItem` (async): what a live status line refreshes
19
+ * with, so a slow script can never block a render;
20
+ * - `previewStatusLineCustomItem` (sync, bounded): what `/statusline custom
21
+ * <cmd>` uses to confirm a freshly configured command immediately.
22
+ */
23
+ import { spawn, spawnSync } from 'node:child_process';
24
+ import { resolveShell } from '@zelari/core/harness/tools/builtin/shellResolver';
25
+ import { DEFAULT_STATUSLINE_TIMEOUT_MS, MAX_STATUSLINE_TIMEOUT_MS, STATUSLINE_MAX_TEXT_CHARS, } from './statuslineConfig.js';
26
+ /**
27
+ * Shell wrapper for `command`: bash ⇒ `-c`, PowerShell ⇒ `-Command`, plain
28
+ * cmd/sh otherwise. Explicit argv (never `shell: true` + args, which Node
29
+ * deprecates and which cannot express a multi-word command safely).
30
+ */
31
+ export function shellInvocation(command) {
32
+ const resolved = resolveShell();
33
+ if (resolved.isBash && resolved.shell !== true)
34
+ return { program: resolved.shell, args: ['-c', command] };
35
+ if (resolved.isPowerShell && resolved.shell !== true) {
36
+ return { program: resolved.shell, args: ['-NoProfile', '-Command', command] };
37
+ }
38
+ if (process.platform === 'win32') {
39
+ return { program: process.env.COMSPEC?.trim() || 'cmd.exe', args: ['/d', '/s', '/c', command] };
40
+ }
41
+ return { program: '/bin/sh', args: ['-c', command] };
42
+ }
43
+ /** Escape sequences that must never reach the status line. */
44
+ // eslint-disable-next-line no-control-regex
45
+ const ANSI_RE = /\u001b(?:\[[0-9;?]*[ -/]*[@-~]|\][^\u0007]*(?:\u0007|\u001b\\)|[@-Z\\-_])/g;
46
+ /** First stdout line, ANSI-stripped and truncated; null when unusable. */
47
+ export function normalizeStatusLineText(raw) {
48
+ if (typeof raw !== 'string')
49
+ return null;
50
+ const firstLine = raw.split(/\r?\n/, 1)[0] ?? '';
51
+ const clean = firstLine.replace(ANSI_RE, '').replace(/\s+$/, '').trim();
52
+ if (clean.length === 0)
53
+ return null;
54
+ return clean.length > STATUSLINE_MAX_TEXT_CHARS ? clean.slice(0, STATUSLINE_MAX_TEXT_CHARS) : clean;
55
+ }
56
+ /** Payload defaults (every field is always present — the contract is JSON). */
57
+ export function customItemPayload(partial = {}) {
58
+ return {
59
+ cwd: partial.cwd ?? process.cwd(),
60
+ model: partial.model ?? '',
61
+ sessionId: partial.sessionId ?? '',
62
+ turn: partial.turn ?? 0,
63
+ pendingTodos: partial.pendingTodos ?? 0,
64
+ };
65
+ }
66
+ function boundedTimeout(timeoutMs) {
67
+ const t = timeoutMs ?? DEFAULT_STATUSLINE_TIMEOUT_MS;
68
+ if (!Number.isFinite(t) || t <= 0)
69
+ return DEFAULT_STATUSLINE_TIMEOUT_MS;
70
+ return Math.min(Math.floor(t), MAX_STATUSLINE_TIMEOUT_MS);
71
+ }
72
+ /** Cap on captured stdout — a chatty script must not grow our memory. */
73
+ const MAX_CAPTURE_CHARS = 8192;
74
+ /**
75
+ * Run the custom script and resolve with its first usable line, or null on
76
+ * ANY failure (bad command, non-zero exit, timeout, empty output). Never
77
+ * rejects: the status line must not be able to crash the TUI.
78
+ */
79
+ export function runStatusLineCustomItem(opts) {
80
+ return new Promise((resolve) => {
81
+ const invocation = opts.invocation ?? shellInvocation(opts.command);
82
+ const timeoutMs = boundedTimeout(opts.timeoutMs);
83
+ let settled = false;
84
+ let child;
85
+ const finish = (value) => {
86
+ if (settled)
87
+ return;
88
+ settled = true;
89
+ clearTimeout(timer);
90
+ resolve(value);
91
+ };
92
+ let timer;
93
+ try {
94
+ child = spawn(invocation.program, invocation.args, {
95
+ cwd: opts.cwd ?? process.cwd(),
96
+ env: opts.env ?? process.env,
97
+ shell: false, // the invocation already carries the shell
98
+ windowsHide: true,
99
+ stdio: ['pipe', 'pipe', 'ignore'],
100
+ });
101
+ }
102
+ catch {
103
+ resolve(null);
104
+ return;
105
+ }
106
+ timer = setTimeout(() => {
107
+ try {
108
+ child.kill('SIGKILL');
109
+ }
110
+ catch {
111
+ /* already gone */
112
+ }
113
+ finish(null);
114
+ }, timeoutMs);
115
+ // A script that never reads stdin makes the write fail with EPIPE — the
116
+ // status line must ignore that, not surface it.
117
+ child.stdin?.on('error', () => { });
118
+ child.stdin?.end(JSON.stringify(customItemPayload({ cwd: opts.cwd, ...opts.payload })));
119
+ let out = '';
120
+ child.stdout?.on('data', (chunk) => {
121
+ if (out.length < MAX_CAPTURE_CHARS)
122
+ out += chunk.toString();
123
+ });
124
+ child.on('error', () => finish(null));
125
+ child.on('close', (code) => finish(code === 0 || code === null ? normalizeStatusLineText(out) : null));
126
+ });
127
+ }
128
+ /**
129
+ * SYNC, bounded preview for `/statusline custom <cmd>` — the one place where
130
+ * blocking is acceptable (an explicit user command, capped by the same
131
+ * timeout). Same protocol, same normalization, same fail-soft contract.
132
+ */
133
+ export function previewStatusLineCustomItem(opts) {
134
+ const invocation = opts.invocation ?? shellInvocation(opts.command);
135
+ try {
136
+ const res = spawnSync(invocation.program, invocation.args, {
137
+ cwd: opts.cwd ?? process.cwd(),
138
+ env: opts.env ?? process.env,
139
+ input: JSON.stringify(customItemPayload({ cwd: opts.cwd, ...opts.payload })),
140
+ timeout: boundedTimeout(opts.timeoutMs),
141
+ killSignal: 'SIGKILL',
142
+ encoding: 'utf-8',
143
+ windowsHide: true,
144
+ maxBuffer: MAX_CAPTURE_CHARS,
145
+ });
146
+ if (res.error || (typeof res.status === 'number' && res.status !== 0))
147
+ return null;
148
+ return normalizeStatusLineText(res.stdout ?? '');
149
+ }
150
+ catch {
151
+ return null;
152
+ }
153
+ }
154
+ //# sourceMappingURL=statuslineCustom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statuslineCustom.js","sourceRoot":"","sources":["../../../src/cli/statusline/statuslineCustom.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,kDAAkD,CAAC;AAChF,OAAO,EACL,6BAA6B,EAC7B,yBAAyB,EACzB,yBAAyB,GAC1B,MAAM,uBAAuB,CAAC;AA8B/B;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,MAAM,QAAQ,GAAG,YAAY,EAAE,CAAC;IAChC,IAAI,QAAQ,CAAC,MAAM,IAAI,QAAQ,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,OAAO,CAAC,EAAE,CAAC;IAC1G,IAAI,QAAQ,CAAC,YAAY,IAAI,QAAQ,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACrD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,YAAY,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,CAAC;IAChF,CAAC;IACD,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;QACjC,OAAO,EAAE,OAAO,EAAE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,CAAC,CAAC;IACzG,CAAC,CAAC,CAAC;AACL,CAAC;AAID;;;;GAIG;AACH,MAAM,UAAU,2BAA2B,CAAC,IAA6B;IACvE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACpE,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,SAAS,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU,CAAC,IAAI,EAAE;YACzD,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG,EAAE;YAC9B,GAAG,EAAE,IAAI,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG;YAC5B,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,iBAAiB,CAAC,EAAE,GAAG,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC;YAC5E,OAAO,EAAE,cAAc,CAAC,IAAI,CAAC,SAAS,CAAC;YACvC,UAAU,EAAE,SAAS;YACrB,QAAQ,EAAE,OAAO;YACjB,WAAW,EAAE,IAAI;YACjB,SAAS,EAAE,iBAAiB;SAC7B,CAAC,CAAC;QACH,IAAI,GAAG,CAAC,KAAK,IAAI,CAAC,OAAO,GAAG,CAAC,MAAM,KAAK,QAAQ,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,CAAC;YAAE,OAAO,IAAI,CAAC;QACnF,OAAO,uBAAuB,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC"}
@@ -0,0 +1,93 @@
1
+ /**
2
+ * statuslineItems — the StatusLine vocabulary (t114).
3
+ *
4
+ * The `<StatusBar>` renders a fixed sequence of chips. This module names that
5
+ * sequence so a user configuration can reorder / hide members of it and append
6
+ * ONE `custom` item whose text comes from an external script
7
+ * (see statuslineCustom.ts).
8
+ *
9
+ * DEFAULT = the current order, all enabled — importing this module changes
10
+ * nothing on screen until a user opts in through `/statusline` (or by editing
11
+ * the persisted config). The renderer stays dumb: it asks for the values it
12
+ * already computes and prints the items this resolver returns, in order.
13
+ *
14
+ * Pure: no I/O, no clock, no React. Unknown/invalid ids are dropped, never
15
+ * rendered as empty chips.
16
+ */
17
+ /**
18
+ * The canonical chip order — one entry per visible StatusBar item today, in
19
+ * the order `<StatusBar>` paints them (left group first: phase BEFORE mode).
20
+ */
21
+ export const DEFAULT_STATUSLINE_ITEMS = [
22
+ // left box
23
+ 'phase',
24
+ 'mode',
25
+ 'verify',
26
+ 'permissions',
27
+ 'jail',
28
+ 'provider',
29
+ 'model',
30
+ 'cwd',
31
+ // right box
32
+ 'elapsed',
33
+ 'queue',
34
+ 'todos',
35
+ 'krakenLive',
36
+ 'krakenGraph',
37
+ 'context',
38
+ 'cost',
39
+ 'session',
40
+ ];
41
+ /** The one item whose text comes from a user script instead of the session. */
42
+ export const STATUSLINE_CUSTOM_ID = 'custom';
43
+ /** Any id a configuration may reference (built-ins + `custom`). */
44
+ export const STATUSLINE_ITEM_IDS = [...DEFAULT_STATUSLINE_ITEMS, STATUSLINE_CUSTOM_ID];
45
+ /** Catalog for `/statusline` (order = the default order). */
46
+ export const STATUSLINE_ITEMS = [
47
+ { id: 'phase', label: 'phase', description: 'work phase (plan | build)' },
48
+ { id: 'mode', label: 'mode', description: 'dispatch mode (kraken | council | zelari)' },
49
+ { id: 'verify', label: 'prova', description: 'strict-done verification chip' },
50
+ { id: 'permissions', label: 'perm', description: 'effective permission preset' },
51
+ { id: 'jail', label: 'jail', description: 'OS-jail honesty chip' },
52
+ { id: 'provider', label: 'provider', description: 'active provider id' },
53
+ { id: 'model', label: 'model', description: 'active model' },
54
+ { id: 'cwd', label: 'cwd', description: 'shortened working directory' },
55
+ { id: 'elapsed', label: 'time', description: 'elapsed / last-run duration' },
56
+ { id: 'queue', label: 'queue', description: 'queued follow-up prompts' },
57
+ { id: 'todos', label: 'todos', description: 'session todo summary' },
58
+ { id: 'krakenLive', label: 'tentacles', description: 'Kraken live tentacle radio' },
59
+ { id: 'krakenGraph', label: 'graph', description: 'Kraken graph-run summary' },
60
+ { id: 'context', label: 'ctx', description: 'context window occupancy' },
61
+ { id: 'cost', label: 'cost', description: 'session cost / cache metrics' },
62
+ { id: 'session', label: 'session', description: 'session id' },
63
+ { id: STATUSLINE_CUSTOM_ID, label: 'custom', description: 'first line of an external script (JSON on stdin)' },
64
+ ];
65
+ /** True when `id` is a known item (built-in or `custom`). */
66
+ export function isStatusLineItemId(id) {
67
+ return STATUSLINE_ITEM_IDS.includes(id);
68
+ }
69
+ /** Human label for one id (falls back to the id itself). */
70
+ export function statusLineItemLabel(id) {
71
+ return STATUSLINE_ITEMS.find((i) => i.id === id)?.label ?? id;
72
+ }
73
+ /**
74
+ * Ordered, non-empty items for the configured list. `customText` is the
75
+ * already-resolved custom item text (undefined ⇒ hidden, which is also the
76
+ * behaviour when the script errors or times out).
77
+ */
78
+ export function resolveStatusLineItems(values, items, customText) {
79
+ const out = [];
80
+ for (const id of items) {
81
+ const raw = id === STATUSLINE_CUSTOM_ID ? customText : values[id];
82
+ const text = typeof raw === 'string' ? raw.trim() : '';
83
+ if (text.length > 0)
84
+ out.push({ id, text });
85
+ }
86
+ return out;
87
+ }
88
+ /** One-line preview used by `/statusline` (id order + enabled/disabled). */
89
+ export function formatStatusLineItems(items) {
90
+ const enabled = new Set(items);
91
+ return STATUSLINE_ITEMS.map((item) => `${enabled.has(item.id) ? '[x]' : '[ ]'} ${item.id.padEnd(12)} ${item.description}`).join('\n');
92
+ }
93
+ //# sourceMappingURL=statuslineItems.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statuslineItems.js","sourceRoot":"","sources":["../../../src/cli/statusline/statuslineItems.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAsB;IACzD,WAAW;IACX,OA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AAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;QAClE,MAAM,IAAI,GAAG,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,IAAI,IAAI,CAAC,MAAM,GAAG,CAAC;YAAE,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,4EAA4E;AAC5E,MAAM,UAAU,qBAAqB,CAAC,KAAwB;IAC5D,MAAM,OAAO,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,OAAO,gBAAgB,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC,CAAC,IAAI,CAC7H,IAAI,CACL,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zelari-code",
3
- "version": "2.50.1",
3
+ "version": "2.51.0",
4
4
  "description": "Zelari Code — open-source coding orchestrator CLI. You choose the model; the proof is mandatory. Kraken by default, council when the work earns it: plan/build phases, provider-agnostic LLM streaming, self-update.",
5
5
  "author": "Anathema Studio <https://anathema-studio.com/>",
6
6
  "license": "Apache-2.0",
@@ -77,7 +77,7 @@
77
77
  "@testing-library/react": "^16.3.2",
78
78
  "@types/node": "^25.3.0",
79
79
  "@types/react": "^19.0.10",
80
- "@zelari/core": "2.50.1",
80
+ "@zelari/core": "2.51.0",
81
81
  "esbuild": "^0.25.0",
82
82
  "eslint": "^10.10.0",
83
83
  "jsdom": "^29.1.1",