zcode-agent 0.0.0-stage → 1.1.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.
@@ -0,0 +1,442 @@
1
+ #!/usr/bin/env node
2
+ 'use strict';
3
+ // zcode — CLI entry: argv parsing + command dispatch. Parsing rejects bad
4
+ // input (exit 2) before any engine spawn or session record exists.
5
+ const { normalizeModel, unknownModelMessage, normalizeEffort, EFFORT_LEVELS, DEFAULT_MODEL } = require('../lib/models.js');
6
+
7
+ const USAGE = `usage:
8
+ zcode-agent task [options] <objective…> execute a task contract, verify it, hand back
9
+ zcode-agent [run] [options] <prompt…> one-shot turn (prompt via stdin when piped)
10
+ zcode-agent agent [options] <instructions…> turn that MUST dispatch a subagent
11
+ zcode-agent resume <id> [message…] continue a session (answer, follow-up, retry)
12
+ zcode-agent status [<id>] [--all] [--json] one session in detail, or the 15 most recent (--all: every session)
13
+ zcode-agent wait <id…> [--any] [--json] block until sessions finish; print handbacks
14
+ zcode-agent watch [<id…> | --plan <name>] [--stall-min n]
15
+ live one-line-per-session view with cost (no model tokens); exits when all finish
16
+ zcode-agent cost [<dir>] [--app] [--json] GLM cost of the zcode-agent sessions in a directory (default: current dir) at
17
+ API list price; --app adds the desktop app's sessions there
18
+ zcode-agent result <id> [--full] [--json] print a finished session's handback (brief by default)
19
+ zcode-agent cancel <id> [--json] stop a running session
20
+ zcode-agent plan check <file> validate a plan file (ids, after, cycles, owns, effort)
21
+ zcode-agent plan run <file> [--preflight] [--detach] [--timeout-ms n] [--id name] [--json]
22
+ run a DAG of task sessions (see "plan" below)
23
+ zcode-agent plan wait|status <name> [--timeout-ms n] [--json]
24
+ one summary line: {type:"plan",name,status,sessions,briefs}
25
+ zcode-agent plan resume <name> [message…] [--session <id>]
26
+ resume failed/partial/blocked sessions, restart supervision
27
+ zcode-agent login store a Z.ai API key piped on stdin (optional
28
+ with ZAI_API_KEY or the ZCode app's key)
29
+ zcode-agent doctor [--json] [--install-browser]
30
+ engine, key, inherited setup and browser report
31
+ zcode-agent skills [install|uninstall] [claude|codex]
32
+ install the orchestrator skills (default: status)
33
+ zcode-agent acp [--mode m] [--model id] [--effort l]
34
+ serve the Agent Client Protocol on stdio (T3 Code,
35
+ Zed, any ACP client; see "acp" below)
36
+
37
+ session:
38
+ --id <id> name the session (letters, digits, . _ -); default zc-<random>.
39
+ An existing id is never re-run: use resume.
40
+ --label <text> free-form label shown in status
41
+ --detach start in the background, print the id, exit 0
42
+ --cwd <dir> workspace (default: current dir)
43
+ --owns <path|glob> repeatable: paths this session may change (relative to
44
+ --cwd). Default: the whole workspace. Overlapping
45
+ ownership with a running session is refused (exit 7)
46
+ --allow-overlap start despite overlapping ownership
47
+
48
+ task contract (task only):
49
+ --task <file|-> JSON contract or markdown brief (- = stdin)
50
+ --accept <text> repeatable acceptance criterion
51
+ --check <command> repeatable shell check zcode-agent runs after the work
52
+ --touch <path|glob> repeatable: minimal edits allowed outside --owns; reported
53
+ as "touched", not a scope violation. Refused (exit 7) if a
54
+ running session owns a matching path; reserves nothing
55
+ --file <path> repeatable relevant file to read first (a file also given
56
+ as --context @file is inlined once, not listed twice)
57
+ --context <text|@f> repeatable extra context (references, background)
58
+ --decision <text> repeatable binding decision the orchestrator made (the
59
+ executor implements it exactly and must not guess others)
60
+ --decisions <@f|text> binding decisions from a file (same list as --decision)
61
+ --preflight read-only turn: the executor lists the open questions it
62
+ would otherwise guess (blocked + questions, or completed
63
+ "no open questions"); no edits, no checks. Then
64
+ zcode-agent resume <id> "<answers>" executes the task
65
+ --unit "n: goal [owns a,b]" repeatable: one subagent per unit inside this
66
+ session; owns must lie within --owns and be disjoint
67
+ --visual <criterion> repeatable: after the work an independent image-capable
68
+ verifier (GLM-5.3-Flash, fresh session) serves the app on
69
+ $ZCODE_PORT, screenshots it and judges each criterion
70
+ --viewport <WxH> repeatable viewport for --visual (default 390x844, 1440x900)
71
+ --serve <cmd> command that serves the app for --visual (honours $ZCODE_PORT)
72
+ --max-repairs <n> repair turns after failing checks (default 2)
73
+ --check-timeout-ms <n> per-check timeout (default 300000)
74
+
75
+ plan (zcode-agent plan run <plan.json>):
76
+ plan.json {cwd?, decisions?, context?, files?, model?, effort?, limits?,
77
+ sessions:[{id, after?:[ids], label?, ...task contract keys}]}; the
78
+ top-level decisions/context/files are prepended to every
79
+ session. A session starts when everything it is "after" has
80
+ completed; sessions that can run together must own disjoint
81
+ paths. A session ending non-completed marks its downstream
82
+ "skipped"; the others continue
83
+ --preflight plan run: read-only preflight of every session ("<id>.pre"),
84
+ prints the questions as one brief per session (exit 10 if any)
85
+ --detach plan run/resume: supervise in a background process
86
+ --id <name> plan name (default: the file's basename)
87
+ --session <id> plan resume: only this session
88
+
89
+ acp (zcode-agent acp):
90
+ --mode <mode> default permission mode of new sessions: build (ask before
91
+ edits and commands) | edit (accept edits) | plan | yolo
92
+ (full access). default: build; clients switch it per session
93
+ --timeout-ms <n> per prompt (default: none)
94
+ also: --model, --effort, --mcp, --hermetic, --no-browser,
95
+ --skills, --no-skills, --inherit-desktop
96
+
97
+ execution:
98
+ --model <id> glm-5.3 | glm-5.3-flash (+aliases). default: glm-5.3-flash
99
+ --effort <level> low | high | max for both models (zcode-agent doctor lists the
100
+ engine's levels per model); an unsupported level exits 2
101
+ before any spawn. default: max
102
+ --timeout-ms <n> whole invocation incl. checks/repairs (default 600000;
103
+ task default 7200000 = 2 h)
104
+ --profile <name> subagent profile (agent command; default general-purpose)
105
+ --mcp <json|@f> add MCP servers (repeatable), on top of the desktop's
106
+ --hermetic don't inherit the ZCode app's MCP servers and skills
107
+ (inherited by default; OAuth-only remote servers never are)
108
+ --no-browser drop the desktop's playwright MCP server (on by default)
109
+ --mcp-list print the effective MCP server set as JSON and exit
110
+ --skills <dir> add skills (repeatable): one skill dir or a root of them
111
+ --no-skills empty skill set
112
+ --inherit-desktop also give the executor the desktop's AGENTS.md, plugins
113
+ and agent profiles (off by default)
114
+
115
+ output:
116
+ --json NDJSON events on stdout; final line is the compact brief
117
+ {"type":"result","schema":"zcode.brief/1",…}
118
+ --full with --json (and result/wait): the full record instead
119
+ (schema zcode.result/1; result.json on disk is always full)
120
+ --any wait: return as soon as the FIRST id finishes
121
+ --quiet no progress: no stderr feed; with --json only the result line;
122
+ usage errors are always a single line
123
+ --thinking / --no-thinking mirror reasoning to stderr (run: on, task: off)
124
+ --stream task --json: include text/reasoning deltas in the events
125
+ --include-reasoning full reasoning text in the result
126
+ -p, --prompt <t> prompt text (alias for positional prompt)
127
+ --session <id> run: continue a session (zcode-agent id or engine sess_ id)
128
+ --install-browser doctor: install the default Playwright server's Chromium
129
+ --version, --help
130
+
131
+ exit codes: 0 completed · 2 usage · 3 no key · 4 no engine · 5 failed ·
132
+ 6 agent: no subagent · 7 workspace conflict / session busy · 8 partial or
133
+ checks failing · 9 unverified · 10 blocked · 124 timeout · 130 cancelled`;
134
+
135
+ function fail(code, message) {
136
+ process.stderr.write(`zcode-agent: ${message}\n`);
137
+ process.exit(code);
138
+ }
139
+
140
+ function readFileOrFail(file, flag) {
141
+ try {
142
+ return require('node:fs').readFileSync(file, 'utf8');
143
+ } catch {
144
+ return fail(2, `${flag} file "${file}" could not be read.`);
145
+ }
146
+ }
147
+
148
+ // --mcp accepts inline JSON or @file mapping server names to definitions.
149
+ function parseMcpSpec(value) {
150
+ const text = value.startsWith('@') ? readFileOrFail(value.slice(1), '--mcp') : value;
151
+ let parsed;
152
+ try {
153
+ parsed = JSON.parse(text);
154
+ } catch (err) {
155
+ fail(2, `--mcp spec must be valid JSON mapping server names to definitions: ${err.message}`);
156
+ }
157
+ if (!parsed || typeof parsed !== 'object' || Array.isArray(parsed)) {
158
+ fail(2, `--mcp spec must be valid JSON mapping server names to definitions, got ${Array.isArray(parsed) ? 'an array' : `a ${typeof parsed}`}.`);
159
+ }
160
+ for (const [name, def] of Object.entries(parsed)) {
161
+ if (!def || typeof def !== 'object' || Array.isArray(def)) {
162
+ fail(2, `--mcp server "${name}" must be an object (e.g. {"type":"stdio","command":...,"args":[...]}).`);
163
+ }
164
+ }
165
+ return parsed;
166
+ }
167
+
168
+ const COMMANDS = new Set(['run', 'task', 'agent', 'resume', 'status', 'list', 'wait', 'watch', 'cost', 'cancel', 'login', 'doctor', 'skills', 'result', 'plan', 'acp', '__plan', '__exec']);
169
+ // The flags `zcode-agent acp` accepts (session defaults for the ACP agent).
170
+ const ACP_FLAGS = new Set(['model', 'effort', 'mode', 'timeoutMs', 'mcpSpecs', 'mcpInherit', 'hermetic', 'noBrowser', 'skillsDirs', 'noSkills', 'inheritDesktop']);
171
+ const TASK_ONLY = new Set(['task', 'accept', 'check', 'file', 'context', 'touch', 'maxRepairs', 'checkTimeoutMs', 'decisions', 'units', 'visual', 'viewports', 'serve', 'preflight']);
172
+ const FULL_COMMANDS = new Set(['run', 'task', 'agent', 'resume', 'wait', 'result', '__exec']);
173
+ const START_ONLY = new Set(['id', 'label', 'owns', 'touch', 'preflight', 'allowOverlap', 'mcpSpecs', 'mcpInherit', 'hermetic', 'noBrowser', 'skillsDirs', 'noSkills', 'inheritDesktop', 'profile', 'cwd']);
174
+
175
+ function parseArgv(argv) {
176
+ const out = {
177
+ command: 'run',
178
+ prompts: [],
179
+ given: new Set(),
180
+ flags: {
181
+ model: DEFAULT_MODEL,
182
+ effort: 'max',
183
+ cwd: process.cwd(),
184
+ json: false,
185
+ fresh: false,
186
+ timeoutMs: undefined,
187
+ profile: 'general-purpose',
188
+ prompt: undefined,
189
+ session: undefined,
190
+ id: undefined,
191
+ label: undefined,
192
+ detach: false,
193
+ task: undefined,
194
+ accept: [],
195
+ check: [],
196
+ file: [],
197
+ context: [],
198
+ owns: [],
199
+ touch: [],
200
+ decisions: [],
201
+ units: [],
202
+ visual: [],
203
+ viewports: [],
204
+ serve: undefined,
205
+ preflight: false,
206
+ allowOverlap: false,
207
+ maxRepairs: undefined,
208
+ checkTimeoutMs: undefined,
209
+ mcpSpecs: [],
210
+ mcpInherit: false, // accepted for pre-1.0 callers: inheriting is the default now
211
+ hermetic: false,
212
+ noBrowser: false,
213
+ mcpList: false,
214
+ skillsDirs: [],
215
+ noSkills: false,
216
+ inheritDesktop: false,
217
+ includeReasoning: false,
218
+ quiet: false,
219
+ thinking: undefined,
220
+ stream: false,
221
+ plan: undefined,
222
+ stallMin: undefined,
223
+ full: false,
224
+ any: false,
225
+ all: false,
226
+ app: false,
227
+ installBrowser: false,
228
+ mode: undefined,
229
+ },
230
+ };
231
+ const valueFlags = new Map([
232
+ ['--model', 'model'], ['--effort', 'effort'], ['--cwd', 'cwd'], ['--profile', 'profile'],
233
+ ['--timeout-ms', 'timeoutMs'], ['-p', 'prompt'], ['--prompt', 'prompt'], ['--session', 'session'],
234
+ ['--id', 'id'], ['--label', 'label'], ['--task', 'task'], ['--max-repairs', 'maxRepairs'],
235
+ ['--check-timeout-ms', 'checkTimeoutMs'], ['--serve', 'serve'], ['--plan', 'plan'], ['--stall-min', 'stallMin'],
236
+ ['--mode', 'mode'],
237
+ ]);
238
+ const listFlags = new Map([
239
+ ['--mcp', 'mcpSpecs'], ['--skills', 'skillsDirs'], ['--accept', 'accept'], ['--check', 'check'],
240
+ ['--file', 'file'], ['--context', 'context'], ['--owns', 'owns'], ['--touch', 'touch'],
241
+ ['--decision', 'decisions'], ['--decisions', 'decisions'], ['--unit', 'units'], ['--visual', 'visual'],
242
+ ['--viewport', 'viewports'],
243
+ ]);
244
+ const boolFlags = new Map([
245
+ ['--json', ['json', true]], ['--fresh', ['fresh', true]], ['--mcp-inherit', ['mcpInherit', true]], ['--hermetic', ['hermetic', true]],
246
+ ['--mcp-list', ['mcpList', true]], ['--no-skills', ['noSkills', true]], ['--inherit-desktop', ['inheritDesktop', true]], ['--no-browser', ['noBrowser', true]],
247
+ ['--include-reasoning', ['includeReasoning', true]], ['--quiet', ['quiet', true]],
248
+ ['--detach', ['detach', true]], ['--allow-overlap', ['allowOverlap', true]],
249
+ ['--thinking', ['thinking', true]], ['--no-thinking', ['thinking', false]], ['--stream', ['stream', true]],
250
+ ['--full', ['full', true]], ['--any', ['any', true]], ['--all', ['all', true]], ['--app', ['app', true]], ['--install-browser', ['installBrowser', true]], ['--preflight', ['preflight', true]],
251
+ ]);
252
+ const numeric = (flag, value, { min = 1 } = {}) => {
253
+ const n = Number(value);
254
+ if (!Number.isFinite(n) || n < min) fail(2, `${flag} must be a number >= ${min}, got "${value}".`);
255
+ return n;
256
+ };
257
+
258
+ for (let i = 0; i < argv.length; i++) {
259
+ const arg = argv[i];
260
+ if (valueFlags.has(arg) || listFlags.has(arg)) {
261
+ const key = valueFlags.get(arg) || listFlags.get(arg);
262
+ const value = argv[++i];
263
+ if (value === undefined) fail(2, `option ${arg} requires a value.`);
264
+ out.given.add(key);
265
+ if (key === 'timeoutMs' || key === 'checkTimeoutMs') out.flags[key] = numeric(arg, value);
266
+ else if (key === 'stallMin') out.flags[key] = numeric(arg, value, { min: 0 });
267
+ else if (key === 'maxRepairs') out.flags[key] = numeric(arg, value, { min: 0 });
268
+ else if (key === 'mcpSpecs') out.flags.mcpSpecs.push(parseMcpSpec(value));
269
+ else if (key === 'skillsDirs') {
270
+ if (!isDirectory(value)) fail(2, `--skills requires an existing directory, got "${value}".`);
271
+ out.flags.skillsDirs.push(value);
272
+ } else if (listFlags.has(arg)) out.flags[key].push(value);
273
+ else if (!value.trim()) fail(2, `${arg} requires a non-empty value.`);
274
+ else out.flags[key] = value.trim();
275
+ continue;
276
+ }
277
+ if (boolFlags.has(arg)) {
278
+ const [key, v] = boolFlags.get(arg);
279
+ out.given.add(key);
280
+ out.flags[key] = v;
281
+ continue;
282
+ }
283
+ if (arg === '--help' || arg === '-h') {
284
+ // Scan the rest of argv for the command: `zcode --help task` works too.
285
+ let command = out.commandSet ? out.command : null;
286
+ if (!command) for (const a of argv) if (COMMANDS.has(a) && !a.startsWith('__')) { command = a === 'list' ? 'status' : a; break; }
287
+ const text = command && require('../lib/help.js').commandHelp(command);
288
+ process.stdout.write((text || USAGE) + '\n');
289
+ process.exit(0);
290
+ }
291
+ if (arg === '--version') {
292
+ process.stdout.write(require('../package.json').version + '\n');
293
+ process.exit(0);
294
+ }
295
+ if (arg === '--') {
296
+ out.prompts.push(...argv.slice(i + 1));
297
+ break;
298
+ }
299
+ if (arg.startsWith('--') && arg.length > 2) {
300
+ const hint = suggestFlag(arg, [...valueFlags.keys(), ...listFlags.keys(), ...boolFlags.keys()]);
301
+ fail(2, `unknown flag ${arg} (${hint ? `did you mean ${hint}?` : 'see zcode-agent --help'})`);
302
+ }
303
+ if (out.prompts.length === 0 && out.command === 'run' && !out.commandSet && COMMANDS.has(arg)) {
304
+ out.command = arg === 'list' ? 'status' : arg;
305
+ out.commandSet = true;
306
+ continue;
307
+ }
308
+ out.prompts.push(arg);
309
+ }
310
+
311
+ const cmd = out.command;
312
+ if (out.flags.prompt !== undefined) out.prompts.unshift(out.flags.prompt);
313
+ if (cmd !== 'task') {
314
+ for (const key of TASK_ONLY) {
315
+ if (cmd === 'plan' && key === 'preflight') continue;
316
+ if (out.given.has(key) && !(cmd === 'resume' && (key === 'maxRepairs' || key === 'checkTimeoutMs'))) {
317
+ fail(2, `--${flagName(key)} is only valid with "zcode-agent task".`);
318
+ }
319
+ }
320
+ }
321
+ if (cmd === 'plan' || cmd === '__plan') {
322
+ for (const key of ['label', 'owns', 'touch', 'allowOverlap', 'model', 'effort', 'profile']) {
323
+ if (out.given.has(key)) fail(2, `--${flagName(key)} is not valid with "zcode-agent plan"; set it in the plan file.`);
324
+ }
325
+ }
326
+ if (cmd === 'resume' || cmd === '__exec') {
327
+ for (const key of START_ONLY) {
328
+ if (out.given.has(key)) fail(2, `--${flagName(key)} cannot change on resume; it is fixed when the session starts.`);
329
+ }
330
+ }
331
+ if (cmd === 'acp') {
332
+ for (const key of out.given) {
333
+ if (!ACP_FLAGS.has(key)) fail(2, `--${flagName(key)} is not valid with "zcode-agent acp".`);
334
+ }
335
+ } else if (out.given.has('mode')) {
336
+ fail(2, '--mode is only valid with "zcode-agent acp".');
337
+ }
338
+ if (out.given.has('all') && cmd !== 'status') fail(2, '--all is only valid with "zcode-agent status".');
339
+ for (const k of ['plan', 'stallMin']) {
340
+ if (out.given.has(k) && cmd !== 'watch') fail(2, `--${flagName(k)} is only valid with "zcode-agent watch".`);
341
+ }
342
+ if (out.given.has('app') && cmd !== 'cost') fail(2, '--app is only valid with "zcode-agent cost".');
343
+ if (out.given.has('installBrowser') && cmd !== 'doctor') fail(2, '--install-browser is only valid with "zcode-agent doctor".');
344
+ if (out.given.has('any') && cmd !== 'wait') fail(2, '--any is only valid with "zcode-agent wait".');
345
+ if (out.given.has('full') && !FULL_COMMANDS.has(cmd)) fail(2, `--full is not valid with "zcode-agent ${cmd}".`);
346
+ if (out.given.has('session') && cmd !== 'run' && cmd !== 'plan') fail(2, '--session is only valid with "zcode-agent run"; use "zcode-agent resume <id>".');
347
+ if (out.given.has('id') && !require('../lib/store.js').validId(out.flags.id)) {
348
+ fail(2, `--id "${out.flags.id}" must be 1-64 chars of letters, digits, ".", "_" or "-", starting with a letter or digit.`);
349
+ }
350
+ if (!isDirectory(out.flags.cwd)) fail(2, `--cwd must be an existing directory, got "${out.flags.cwd}".`);
351
+
352
+ const model = normalizeModel(out.flags.model);
353
+ if (!model) fail(2, unknownModelMessage(out.flags.model));
354
+ out.flags.model = model;
355
+ const effort = normalizeEffort(out.flags.effort);
356
+ if (!effort) fail(2, `unknown effort "${out.flags.effort}". --effort accepts ${EFFORT_LEVELS.join(' | ')}.`);
357
+ out.flags.effort = effort;
358
+ return out;
359
+ }
360
+
361
+ // Closest known flag by edit distance (<= 2), or null.
362
+ function suggestFlag(arg, known) {
363
+ const dist = (a, b) => {
364
+ const row = Array.from({ length: b.length + 1 }, (_, j) => j);
365
+ for (let i = 1; i <= a.length; i++) {
366
+ let prev = row[0];
367
+ row[0] = i;
368
+ for (let j = 1; j <= b.length; j++) {
369
+ const tmp = row[j];
370
+ row[j] = Math.min(row[j] + 1, row[j - 1] + 1, prev + (a[i - 1] === b[j - 1] ? 0 : 1));
371
+ prev = tmp;
372
+ }
373
+ }
374
+ return row[b.length];
375
+ };
376
+ let best = null;
377
+ let bestD = Infinity;
378
+ for (const k of known) {
379
+ if (!k.startsWith('--')) continue;
380
+ const d = dist(arg, k);
381
+ if (d < bestD) { best = k; bestD = d; }
382
+ }
383
+ return best && bestD <= 2 ? best : null;
384
+ }
385
+
386
+ function flagName(key) {
387
+ return key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`).replace(/^mcp-specs$/, 'mcp').replace(/^skills-dirs$/, 'skills')
388
+ .replace(/^(unit|viewport)s$/, '$1');
389
+ }
390
+
391
+ function isDirectory(p) {
392
+ try {
393
+ return require('node:fs').statSync(p).isDirectory();
394
+ } catch {
395
+ return false;
396
+ }
397
+ }
398
+
399
+ async function main() {
400
+ const parsed = parseArgv(process.argv.slice(2));
401
+ if (parsed.flags.mcpList) return require('../lib/commands/mcp-list.js')(parsed);
402
+ switch (parsed.command) {
403
+ case 'run':
404
+ case 'task':
405
+ case 'agent':
406
+ case 'resume':
407
+ case '__exec':
408
+ return require('../lib/commands/exec.js')(parsed);
409
+ case 'plan':
410
+ case '__plan':
411
+ return require('../lib/commands/plan.js')(parsed);
412
+ case 'status':
413
+ case 'wait':
414
+ case 'watch':
415
+ case 'result':
416
+ case 'cancel':
417
+ return require('../lib/commands/sessions.js')(parsed);
418
+ case 'cost':
419
+ return require('../lib/commands/cost.js')(parsed);
420
+ case 'login':
421
+ return require('../lib/commands/login.js')(parsed);
422
+ case 'doctor':
423
+ return require('../lib/commands/doctor.js')(parsed);
424
+ case 'skills':
425
+ return require('../lib/commands/skills.js')(parsed);
426
+ case 'acp':
427
+ return require('../lib/commands/acp.js')(parsed);
428
+ default:
429
+ return fail(2, `unknown command "${parsed.command}" (see zcode-agent --help).`);
430
+ }
431
+ }
432
+
433
+ // Exported before main() runs: the plan supervisor reuses parseArgv.
434
+ module.exports = { parseArgv, USAGE, main };
435
+
436
+ if (require.main === module) {
437
+ main().catch((err) => {
438
+ process.stderr.write(`zcode-agent: internal error: ${err && err.stack ? err.stack : err}\n`);
439
+ process.exit(1);
440
+ });
441
+ }
442
+