zcode-app-cli 3.7.3-10 → 3.7.5-11

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 CHANGED
@@ -117,8 +117,9 @@ Mermaid previews with source fallback for unsupported or oversized diagrams.
117
117
  **Inspection and navigation.** `/diff` browser for current Git changes and
118
118
  per-turn file changes; `/context` prompt-composition, cache and context-usage
119
119
  details; `/status` session, runtime, goal, MCP and workspace details;
120
- `/activity` and `/tasks` for active tools and background tasks; searchable
121
- transcript navigation with per-block expansion, selected-block copying and
120
+ `/activity` and a task center for background status, output, agent conversations
121
+ and recovery; searchable transcript navigation with per-block expansion,
122
+ selected-block copying and
122
123
  `n`/`N` match traversal; persistent active-tool, background-task and open-plan
123
124
  activity between the transcript and editor.
124
125
 
@@ -246,7 +247,10 @@ picker to return to input selection, then `Esc` again to close rewind.
246
247
  /context inspect context usage and source composition
247
248
  /status inspect detailed runtime and session status
248
249
  /activity inspect every active tool and open task
249
- /tasks inspect or stop background tasks
250
+ /tasks inspect and manage background tasks
251
+ /tasks message <id> <text> send guidance to a running background agent
252
+ /tasks resume <id> [text] resume a stopped or failed background agent
253
+ /tasks stop <id> stop a running background task
250
254
  /search <text> search retained transcript blocks
251
255
  /search next|prev|clear navigate or close transcript search
252
256
  /transcript latest select the latest transcript block
@@ -254,6 +258,23 @@ picker to return to input selection, then `Esc` again to close rewind.
254
258
  /copy copy the selected block, or the latest response
255
259
  ```
256
260
 
261
+ The task center keeps autonomous task output out of the foreground transcript.
262
+ The main conversation receives only compact completion, reply and failure
263
+ notices; select the task to inspect its output and task-scoped activity. Agent
264
+ tasks can receive messages while running, and the official runtime resumes a
265
+ terminal agent from its saved child session when messaged. Bash tasks expose a
266
+ reviewable rerun request because a stopped process cannot continue from an
267
+ execution checkpoint. Saved final task output remains available after a TUI
268
+ restart, with large files limited to their latest 64 KiB. Workflow tasks open
269
+ their existing run panel and controls.
270
+
271
+ Agent calls that finish within one second remain ordinary foreground tools so
272
+ their result can feed the current response directly. Longer Agent calls move to
273
+ the task center automatically, releasing the foreground turn while they keep
274
+ running. Set `subagents.autoBackgroundMs` to a different positive duration, or
275
+ to `0` to disable automatic backgrounding. An explicit
276
+ `run_in_background: true` still backgrounds an Agent immediately.
277
+
257
278
  While the editor is empty, `Alt+Up` and `Alt+Down` navigate selected transcript
258
279
  blocks. `Ctrl+O` expands only the selected/search-matched block; without a
259
280
  selection it toggles all expandable content. During transcript search, `n` and
package/bin/zcode.js CHANGED
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { spawn } from "node:child_process";
3
- import { existsSync, readFileSync } from "node:fs";
3
+ import { appendFileSync, chmodSync, existsSync, mkdirSync, readFileSync, renameSync, statSync, unlinkSync } from "node:fs";
4
4
  import { constants, homedir, tmpdir } from "node:os";
5
5
  import { basename, dirname, join, posix, resolve, sep, win32 } from "node:path";
6
6
  import { fileURLToPath } from "node:url";
@@ -49,6 +49,7 @@ var config_example_default = {
49
49
  "skill": true,
50
50
  "mcp": true
51
51
  },
52
+ subagents: { "autoBackgroundMs": 1e3 },
52
53
  memory: {
53
54
  "use": true,
54
55
  "write": true,
@@ -1237,6 +1238,7 @@ const runtimePath = join(packageRoot, "vendor", "zcode.cjs");
1237
1238
  const launcherPath = join(packageRoot, "bin", "zcode.js");
1238
1239
  const defaultModelRetryMaxRetries = "5";
1239
1240
  const defaultBrowserUseArgument = "--browser-use=headless";
1241
+ const tuiRuntimeLogLimitBytes = 2 * 1024 * 1024;
1240
1242
  const versionArguments = /* @__PURE__ */ new Set([
1241
1243
  "version",
1242
1244
  "--version",
@@ -1314,10 +1316,12 @@ function longOptionName(argument) {
1314
1316
  const separator = argument.indexOf("=");
1315
1317
  return separator < 0 ? argument : argument.slice(0, separator);
1316
1318
  }
1317
- function withDefaultBrowserUse(args) {
1319
+ function inspectRuntimeInvocation(args) {
1318
1320
  let agentInvocation = false;
1319
1321
  let command;
1322
+ let explicitBrowserUse = false;
1320
1323
  let invalid = false;
1324
+ let passthrough = false;
1321
1325
  for (let index = 0; index < args.length; index += 1) {
1322
1326
  const argument = args[index];
1323
1327
  if (argument === "--") {
@@ -1327,8 +1331,16 @@ function withDefaultBrowserUse(args) {
1327
1331
  if (argument.startsWith("--")) {
1328
1332
  const option = longOptionName(argument);
1329
1333
  const inlineValue = option.length !== argument.length;
1330
- if (option === "--browser-use") return args;
1331
- if (option === "--help" || option === "--version") return args;
1334
+ if (option === "--browser-use") {
1335
+ explicitBrowserUse = true;
1336
+ if (!inlineValue) if (index + 1 >= args.length || args[index + 1].startsWith("-")) invalid = true;
1337
+ else index += 1;
1338
+ continue;
1339
+ }
1340
+ if (option === "--help" || option === "--version") {
1341
+ passthrough = true;
1342
+ continue;
1343
+ }
1332
1344
  if (option === "--print") {
1333
1345
  if (inlineValue) invalid = true;
1334
1346
  else agentInvocation = true;
@@ -1358,7 +1370,10 @@ function withDefaultBrowserUse(args) {
1358
1370
  continue;
1359
1371
  }
1360
1372
  if (argument.startsWith("-")) {
1361
- if (argument === "-h" || argument === "-v") return args;
1373
+ if (argument === "-h" || argument === "-v") {
1374
+ passthrough = true;
1375
+ continue;
1376
+ }
1362
1377
  if (argument === "-p" || argument.startsWith("-p")) {
1363
1378
  agentInvocation = true;
1364
1379
  if (argument === "-p") if (index + 1 >= args.length || args[index + 1].startsWith("-")) invalid = true;
@@ -1371,9 +1386,23 @@ function withDefaultBrowserUse(args) {
1371
1386
  }
1372
1387
  command ??= argument;
1373
1388
  }
1374
- if (invalid || !agentInvocation && command !== void 0 && command !== "tui") return args;
1389
+ return {
1390
+ agentInvocation,
1391
+ command,
1392
+ explicitBrowserUse,
1393
+ invalid,
1394
+ passthrough
1395
+ };
1396
+ }
1397
+ function withDefaultBrowserUse(args) {
1398
+ const invocation = inspectRuntimeInvocation(args);
1399
+ if (invocation.explicitBrowserUse || invocation.passthrough || invocation.invalid || !invocation.agentInvocation && invocation.command !== void 0 && invocation.command !== "tui") return args;
1375
1400
  return [defaultBrowserUseArgument, ...args];
1376
1401
  }
1402
+ function isTuiRuntimeInvocation(args) {
1403
+ const invocation = inspectRuntimeInvocation(args);
1404
+ return !invocation.agentInvocation && !invocation.invalid && !invocation.passthrough && (invocation.command === void 0 || invocation.command === "tui");
1405
+ }
1377
1406
  function runtimeEnvironment(extra = {}) {
1378
1407
  const env = { ...process.env };
1379
1408
  delete env.ZCODE_CLI_OAUTH_CALLBACK_STDIN;
@@ -1396,7 +1425,7 @@ function signalExitCode(signal) {
1396
1425
  const number = constants.signals[signal];
1397
1426
  return typeof number === "number" ? 128 + number : 1;
1398
1427
  }
1399
- async function waitForChild(child) {
1428
+ async function waitForChild(child, onError = (error) => console.error("Error: " + error.message)) {
1400
1429
  return await new Promise((resolveExit) => {
1401
1430
  let settled = false;
1402
1431
  const finish = (code) => {
@@ -1405,19 +1434,65 @@ async function waitForChild(child) {
1405
1434
  resolveExit(code);
1406
1435
  };
1407
1436
  child.once("error", (error) => {
1408
- console.error(`Error: ${error.message}`);
1437
+ onError(error);
1409
1438
  finish(1);
1410
1439
  });
1411
1440
  child.once("exit", (code, signal) => finish(code ?? signalExitCode(signal)));
1412
1441
  });
1413
1442
  }
1443
+ function appendTuiRuntimeDiagnostic(chunk, state) {
1444
+ if (state.bytes >= tuiRuntimeLogLimitBytes) return;
1445
+ const text = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
1446
+ try {
1447
+ const path = state.path ?? (process.env.ZCODE_TUI_RUNTIME_LOG?.trim() || join(homedir(), ".zcode", "cli", "tui-runtime.log"));
1448
+ state.path = path;
1449
+ mkdirSync(dirname(path), {
1450
+ recursive: true,
1451
+ mode: 448
1452
+ });
1453
+ if (!state.initialized) {
1454
+ state.initialized = true;
1455
+ const existingBytes = existsSync(path) ? statSync(path).size : 0;
1456
+ if (existingBytes >= tuiRuntimeLogLimitBytes) {
1457
+ const rotated = `${path}.1`;
1458
+ if (existsSync(rotated)) unlinkSync(rotated);
1459
+ renameSync(path, rotated);
1460
+ chmodSync(rotated, 384);
1461
+ } else state.bytes = existingBytes;
1462
+ }
1463
+ const bounded = text.subarray(0, tuiRuntimeLogLimitBytes - state.bytes);
1464
+ if (bounded.byteLength === 0) return;
1465
+ appendFileSync(path, bounded, { mode: 384 });
1466
+ chmodSync(path, 384);
1467
+ state.bytes += bounded.byteLength;
1468
+ } catch {
1469
+ state.writeFailed = true;
1470
+ }
1471
+ }
1472
+ function tuiRuntimeFailureMessage(code, state) {
1473
+ return `Error: ZCode runtime exited with status ${code}.${state.path && !state.writeFailed ? ` Diagnostics: ${state.path}` : " Runtime diagnostics could not be written."}\n`;
1474
+ }
1414
1475
  async function runRuntime(node, args) {
1476
+ const tuiInvocation = isTuiRuntimeInvocation(args);
1415
1477
  const child = spawn(node, [runtimePath, ...args], {
1416
1478
  cwd: process.cwd(),
1417
1479
  env: runtimeEnvironment(),
1418
- stdio: "inherit"
1480
+ stdio: tuiInvocation ? [
1481
+ "inherit",
1482
+ "inherit",
1483
+ "pipe"
1484
+ ] : "inherit"
1419
1485
  });
1486
+ const diagnosticState = {
1487
+ bytes: 0,
1488
+ initialized: false,
1489
+ writeFailed: false
1490
+ };
1491
+ const onDiagnostic = (chunk) => appendTuiRuntimeDiagnostic(chunk, diagnosticState);
1492
+ child.stderr?.on("data", onDiagnostic);
1493
+ let forwardedSignal = false;
1420
1494
  const forwardSignal = (signal) => {
1495
+ forwardedSignal = true;
1421
1496
  if (!child.killed) child.kill(signal);
1422
1497
  };
1423
1498
  const onSigint = () => forwardSignal("SIGINT");
@@ -1427,8 +1502,11 @@ async function runRuntime(node, args) {
1427
1502
  process.once("SIGTERM", onSigterm);
1428
1503
  if (process.platform !== "win32") process.once("SIGHUP", onSighup);
1429
1504
  try {
1430
- return await waitForChild(child);
1505
+ const code = await waitForChild(child, tuiInvocation ? (error) => appendTuiRuntimeDiagnostic((error.stack ?? error.message) + "\n", diagnosticState) : void 0);
1506
+ if (tuiInvocation && code !== 0 && !forwardedSignal) process.stderr.write(tuiRuntimeFailureMessage(code, diagnosticState));
1507
+ return code;
1431
1508
  } finally {
1509
+ child.stderr?.off("data", onDiagnostic);
1432
1510
  process.off("SIGINT", onSigint);
1433
1511
  process.off("SIGTERM", onSigterm);
1434
1512
  if (process.platform !== "win32") process.off("SIGHUP", onSighup);
@@ -50,6 +50,9 @@
50
50
  "skill": true,
51
51
  "mcp": true
52
52
  },
53
+ "subagents": {
54
+ "autoBackgroundMs": 1000
55
+ },
53
56
  "memory": {
54
57
  "use": true,
55
58
  "write": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-app-cli",
3
- "version": "3.7.3-10",
3
+ "version": "3.7.5-11",
4
4
  "description": "Unofficial terminal client for the ZCode agent runtime",
5
5
  "keywords": [
6
6
  "agent",
@@ -1,9 +1,9 @@
1
1
  {
2
- "appVersion": "3.7.3",
2
+ "appVersion": "3.7.5",
3
3
  "cliVersion": "0.16.1",
4
- "extractedAt": "2026-08-09T09:35:54.190Z",
5
- "sha512": "YwYP2b8z0XPYdys/3Elgg7KvwsBb12Pn2PbP0VCdcdvlxAnJCLUgUMq8n/OCSXUp3xEdriqfb5riEF7eJhJldA==",
6
- "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.7.3/linux-x64/ZCode-3.7.3-linux-x64.deb",
4
+ "extractedAt": "2026-08-10T13:21:56.494Z",
5
+ "sha512": "+gCFedwyxr4BJEIQ4QWmbj21FlyGn7Gb3LbcQsyx38PKAt2qoRbjAVjM5XVU0Tj5wViuKFZk/1xRuem28Kjf7A==",
6
+ "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.7.5/linux-x64/ZCode-3.7.5-linux-x64.deb",
7
7
  "tui": {
8
8
  "implementation": "@zcode/tui",
9
9
  "foundation": "@earendil-works/pi-tui"