zcode-app-cli 3.11.2-22 → 3.11.2-24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-app-cli",
3
- "version": "3.11.2-22",
3
+ "version": "3.11.2-24",
4
4
  "description": "Unofficial terminal client for the ZCode agent runtime",
5
5
  "keywords": [
6
6
  "agent",
@@ -51,7 +51,14 @@
51
51
  "check": "bun run build && bun scripts/check-runtime.ts",
52
52
  "check:oauth-callback": "bun scripts/smoke-oauth-callback.ts",
53
53
  "check:tui": "bun scripts/smoke-tui.ts && bun scripts/smoke-tui-features.ts && bun scripts/smoke-tui-clear.ts && bun scripts/smoke-tui-session-title.ts && bun scripts/smoke-tui-pressure.ts && bun scripts/smoke-tui-widths.ts && bun scripts/smoke-tui-fullscreen.ts && bun scripts/smoke-tui-fullscreen-switch.ts && bun scripts/smoke-tui-fullscreen-layout.ts",
54
- "test": "bun test",
54
+ "check:tui-scenarios": "bun run test:tui",
55
+ "test": "bun run test:fast",
56
+ "test:all": "bun run test:fast && bun run test:tui && bun run test:runtime",
57
+ "test:fast": "bun test test/*.test.ts",
58
+ "test:runtime": "bun test test/runtime/*.test.ts",
59
+ "test:tui": "bun test test/tui/*.test.ts",
60
+ "test:tui:manual": "bun scripts/tui-scenario.ts --manual",
61
+ "test:tui-scenario": "bun scripts/tui-scenario.ts",
55
62
  "typecheck": "tsc --noEmit",
56
63
  "verify:tui-perf": "bun scripts/verify-tui-perf.ts",
57
64
  "version:build": "bun scripts/bump-build.ts",
@@ -73,10 +80,14 @@
73
80
  "playwright-core": "1.59.1"
74
81
  },
75
82
  "devDependencies": {
83
+ "@xterm/headless": "6.0.0",
76
84
  "beautiful-mermaid": "^1.1.3",
77
85
  "bun-types": "^1.3.14",
78
86
  "cli-highlight": "^2.1.11",
79
87
  "diff": "^9.0.0",
88
+ "just-bash": "^3.4.2",
89
+ "mountx": "^0.0.2",
90
+ "msw": "^2.15.0",
80
91
  "tsdown": "^0.22.7",
81
92
  "typescript": "^7.0.2",
82
93
  "yaml": "^2.8.1"
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "appVersion": "3.11.2",
3
3
  "cliVersion": "0.16.5",
4
- "extractedAt": "2026-09-07T15:55:02.609Z",
4
+ "extractedAt": "2026-09-11T20:51:11.565Z",
5
5
  "sha512": "4UAMZSP9ZWBrnb8wGaP39rb5dB5ikPx4aYPXKXGea1Vmd6L6vGma3rXwRxKbhBxgsCIE9jv6tmrdSL60RrzGcA==",
6
6
  "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.11.2/linux-x64/ZCode-3.11.2-linux-x64.deb",
7
7
  "runtimeCapabilities": {
@@ -158169,6 +158169,8 @@ var ChoiceDialog = class {
158169
158169
  contentOffset = 0;
158170
158170
  contentLineCount = 0;
158171
158171
  contentPageSize = 1;
158172
+ /** Number of quick-selectable items; digits beyond this are ignored. */
158173
+ numberShortcutCount = 0;
158172
158174
  constructor(title, prompt, help, list, theme, content, contentLabel = "Details", maxContentLines = 0, maxExpandedContentLines = 0) {
158173
158175
  this.title = title;
158174
158176
  this.prompt = prompt;
@@ -158219,6 +158221,14 @@ var ChoiceDialog = class {
158219
158221
  this.contentExpanded = !this.contentExpanded;
158220
158222
  return;
158221
158223
  }
158224
+ if (this.numberShortcutCount > 0 && this.filter === "" && !this.contentExpanded && data.length === 1 && data >= "1" && data <= "9") {
158225
+ const index = data.charCodeAt(0) - "1".charCodeAt(0);
158226
+ if (index >= this.numberShortcutCount) return;
158227
+ this.list.setSelectedIndex(index);
158228
+ const item = this.list.getSelectedItem();
158229
+ if (item) this.list.onSelect?.(item);
158230
+ return;
158231
+ }
158222
158232
  if ((this.content?.handleInput)?.call(this.content, data) === true) return;
158223
158233
  if (this.contentExpanded) {
158224
158234
  if (matchesKey(data, "escape")) {
@@ -158323,18 +158333,20 @@ function choose(ui, host, theme, options) {
158323
158333
  return new Promise((resolve) => {
158324
158334
  const choicesByValue = /* @__PURE__ */ new Map();
158325
158335
  const detailsByValue = /* @__PURE__ */ new Map();
158336
+ const numberShortcutsEnabled = options.numberShortcuts === true && options.items.length <= 9;
158326
158337
  const searchableItems = options.items.map((item, index) => {
158327
158338
  const safeItem = {
158328
158339
  ...item,
158329
158340
  label: sanitizeTerminalText(item.label, { preserveSgr: false }),
158330
158341
  description: item.description ? sanitizeTerminalText(item.description, { preserveSgr: false }) : void 0
158331
158342
  };
158343
+ const displayLabel = numberShortcutsEnabled ? `${index + 1}. ${safeItem.label}` : safeItem.label;
158332
158344
  const value = `${safeItem.label}\u0000${index}`;
158333
158345
  choicesByValue.set(value, safeItem);
158334
158346
  if (options.showSelectedItemDetails) detailsByValue.set(value, new ChoiceItemDetails(safeItem, theme));
158335
158347
  return {
158336
158348
  value,
158337
- label: safeItem.label,
158349
+ label: displayLabel,
158338
158350
  description: safeItem.description
158339
158351
  };
158340
158352
  });
@@ -158344,7 +158356,8 @@ function choose(ui, host, theme, options) {
158344
158356
  list.setSelectedIndex(options.selectedIndex ?? 0);
158345
158357
  const maxContentLines = Math.max(0, ui.terminal.rows - maxVisible - 9);
158346
158358
  const maxExpandedContentLines = Math.max(2, maxContentLines, ui.terminal.rows - 8);
158347
- const dialog = new ChoiceDialog(sanitizeTerminalText(options.title, { preserveSgr: false }), sanitizeTerminalText(options.prompt, { preserveSgr: false }), sanitizeTerminalText(options.help ?? (hasDetails ? "Type to filter · Up/Down choose · Ctrl+O details · ←/→ or PgUp/PgDn scroll · Enter confirm · Esc cancel" : "Type to filter · Up/Down choose · Enter confirm · Esc cancel · Ctrl+U clear"), { preserveSgr: false }), list, theme, options.content, sanitizeTerminalText(options.contentLabel ?? "Details", { preserveSgr: false }), maxContentLines, maxExpandedContentLines);
158359
+ const dialog = new ChoiceDialog(sanitizeTerminalText(options.title, { preserveSgr: false }), sanitizeTerminalText(options.prompt, { preserveSgr: false }), sanitizeTerminalText(options.help ?? (hasDetails ? numberShortcutsEnabled ? "Type to filter · number selects · Up/Down choose · Ctrl+O details · ←/→ or PgUp/PgDn scroll · Enter confirm · Esc cancel" : "Type to filter · Up/Down choose · Ctrl+O details · ←/→ or PgUp/PgDn scroll · Enter confirm · Esc cancel" : numberShortcutsEnabled ? "Type to filter · number selects · Up/Down choose · Enter confirm · Esc cancel · Ctrl+U clear" : "Type to filter · Up/Down choose · Enter confirm · Esc cancel · Ctrl+U clear"), { preserveSgr: false }), list, theme, options.content, sanitizeTerminalText(options.contentLabel ?? "Details", { preserveSgr: false }), maxContentLines, maxExpandedContentLines);
158360
+ dialog.numberShortcutCount = numberShortcutsEnabled ? options.items.length : 0;
158348
158361
  const previewFor = (item) => {
158349
158362
  if (!item) return void 0;
158350
158363
  return options.showSelectedItemDetails ? detailsByValue.get(item.value) : choicesByValue.get(item.value)?.preview;
@@ -162104,6 +162117,17 @@ var PermissionPreview = class {
162104
162117
  }
162105
162118
  };
162106
162119
  //#endregion
162120
+ //#region packages/zcode-tui/src/permission-request-queue.ts
162121
+ /** Runs complete permission interactions in FIFO order so their dialogs never overlap. */
162122
+ var PermissionRequestQueue = class {
162123
+ tail = Promise.resolve();
162124
+ run(request) {
162125
+ const result = this.tail.then(request);
162126
+ this.tail = result.then(() => void 0, () => void 0);
162127
+ return result;
162128
+ }
162129
+ };
162130
+ //#endregion
162107
162131
  //#region src/app-server-client.ts
162108
162132
  const maximumOutputBytes = 16 * 1024 * 1024;
162109
162133
  const forceTerminationDelayMilliseconds = 500;
@@ -163901,6 +163925,23 @@ function redactSecrets(message, secrets) {
163901
163925
  //#endregion
163902
163926
  //#region packages/zcode-tui/src/session-title.ts
163903
163927
  const SESSION_TITLE_PREFIX = "ZC | ";
163928
+ const sessionTitleSpinnerFrames = [
163929
+ "⠋",
163930
+ "⠙",
163931
+ "⠹",
163932
+ "⠸",
163933
+ "⠼",
163934
+ "⠴",
163935
+ "⠦",
163936
+ "⠧",
163937
+ "⠇",
163938
+ "⠏"
163939
+ ];
163940
+ function sessionTitleSpinnerFrame(elapsedMilliseconds, animated = true) {
163941
+ if (!animated) return sessionTitleSpinnerFrames[0];
163942
+ const frame = Math.floor(Math.max(0, elapsedMilliseconds) / 120);
163943
+ return sessionTitleSpinnerFrames[frame % sessionTitleSpinnerFrames.length] ?? sessionTitleSpinnerFrames[0];
163944
+ }
163904
163945
  function sessionTitleFromFirstMessage(message) {
163905
163946
  const normalized = sanitizeTerminalText(message).replace(/\s+/gu, " ").trim();
163906
163947
  if (!normalized) return null;
@@ -166597,6 +166638,7 @@ var ZCodeTui = class {
166597
166638
  workflowPanel;
166598
166639
  workflowView;
166599
166640
  workflowRefreshInFlight = false;
166641
+ permissionRequests = new PermissionRequestQueue();
166600
166642
  choiceDepth = 0;
166601
166643
  settingSwitchInFlight = false;
166602
166644
  fullscreenWelcomeVisible = true;
@@ -166611,6 +166653,8 @@ var ZCodeTui = class {
166611
166653
  turnTimingVisible = false;
166612
166654
  turnHadWorkActivity = false;
166613
166655
  turnTimer;
166656
+ sessionTitleSpinnerTimer;
166657
+ sessionTitleSpinnerStartedAt;
166614
166658
  pendingTurnNotification;
166615
166659
  pendingTurnNotificationDetail = "";
166616
166660
  goal;
@@ -166619,6 +166663,7 @@ var ZCodeTui = class {
166619
166663
  sessionId;
166620
166664
  sessionTitleEmitted = false;
166621
166665
  sessionTerminalTitle;
166666
+ emittedSessionTerminalTitle;
166622
166667
  sessionMetrics = {};
166623
166668
  usageRefreshInFlight = false;
166624
166669
  usageRefreshPending = false;
@@ -167826,6 +167871,8 @@ var ZCodeTui = class {
167826
167871
  this.sessionId = void 0;
167827
167872
  this.sessionTitleEmitted = false;
167828
167873
  this.sessionTerminalTitle = void 0;
167874
+ this.stopSessionTitleSpinner();
167875
+ this.emittedSessionTerminalTitle = "";
167829
167876
  emitSessionTerminalTitle(this.options.stdout ?? process.stdout, "");
167830
167877
  this.sessionMetrics = {};
167831
167878
  this.restoreTranscript(restoredMessages(result.restoredMessages));
@@ -168823,10 +168870,13 @@ var ZCodeTui = class {
168823
168870
  if (wasActive && !this.attachmentBar.isActive()) this.focusEditor();
168824
168871
  this.ui.requestRender();
168825
168872
  }
168826
- async requestPermission(requestValue, context) {
168827
- const request = isRecord(requestValue) ? requestValue : {};
168873
+ requestPermission(requestValue, context) {
168828
168874
  const contextRecord = isRecord(context) ? context : void 0;
168829
168875
  const signal = contextRecord?.abortSignal instanceof AbortSignal ? contextRecord.abortSignal : this.turnAbortController?.signal;
168876
+ return this.permissionRequests.run(() => this.requestPermissionUnqueued(requestValue, signal));
168877
+ }
168878
+ async requestPermissionUnqueued(requestValue, signal) {
168879
+ const request = isRecord(requestValue) ? requestValue : {};
168830
168880
  const toolName = asString(request.toolName) ?? "tool";
168831
168881
  const asksUserQuestion = isAskUserQuestionTool(toolName);
168832
168882
  const toolCallId = asString(request.toolCallId) ?? asString(request.toolUseId) ?? asString(request.callId);
@@ -168871,6 +168921,7 @@ var ZCodeTui = class {
168871
168921
  prompt: asString(request.reason) ?? `${toolName} requests permission to continue.`,
168872
168922
  items,
168873
168923
  signal,
168924
+ numberShortcuts: true,
168874
168925
  content: this.permissionPreview(toolName, request.input, asString(request.riskLevel))
168875
168926
  });
168876
168927
  if (!selected) return {
@@ -170488,7 +170539,7 @@ var ZCodeTui = class {
170488
170539
  return await choose(this.ui, this.choiceHost, this.theme, options);
170489
170540
  } finally {
170490
170541
  this.choiceDepth = Math.max(0, this.choiceDepth - 1);
170491
- this.focusEditor();
170542
+ if (this.choiceDepth === 0) this.focusEditor();
170492
170543
  this.ui.requestRender();
170493
170544
  }
170494
170545
  }
@@ -170498,7 +170549,7 @@ var ZCodeTui = class {
170498
170549
  return await promptText(this.ui, this.choiceHost, this.theme, options);
170499
170550
  } finally {
170500
170551
  this.choiceDepth = Math.max(0, this.choiceDepth - 1);
170501
- this.focusEditor();
170552
+ if (this.choiceDepth === 0) this.focusEditor();
170502
170553
  this.ui.requestRender();
170503
170554
  }
170504
170555
  }
@@ -170630,9 +170681,30 @@ var ZCodeTui = class {
170630
170681
  this.updateTurnStatus(requestRender);
170631
170682
  }
170632
170683
  refreshSessionTerminalTitle() {
170633
- if (!this.sessionTerminalTitle) return;
170634
- const working = this.activeSubmissions > 0 && this.activity ? `⠋ ${this.activity}` : void 0;
170635
- emitSessionTerminalTitle(this.options.stdout ?? process.stdout, working ?? this.sessionTerminalTitle);
170684
+ if (!this.sessionTerminalTitle) {
170685
+ this.stopSessionTitleSpinner();
170686
+ return;
170687
+ }
170688
+ const now = performance.now();
170689
+ const working = this.activeSubmissions > 0 && this.activity ? `${sessionTitleSpinnerFrame(this.sessionTitleSpinnerStartedAt === void 0 ? 0 : Math.max(0, now - this.sessionTitleSpinnerStartedAt), this.animateTurnTimer)} ${this.activity}` : void 0;
170690
+ if (working && this.animateTurnTimer) {
170691
+ if (this.sessionTitleSpinnerStartedAt === void 0) this.sessionTitleSpinnerStartedAt = now;
170692
+ if (!this.sessionTitleSpinnerTimer) {
170693
+ this.sessionTitleSpinnerTimer = setInterval(() => this.refreshSessionTerminalTitle(), 120);
170694
+ this.sessionTitleSpinnerTimer.unref?.();
170695
+ }
170696
+ } else this.stopSessionTitleSpinner();
170697
+ const nextTitle = working ?? this.sessionTerminalTitle;
170698
+ if (nextTitle === this.emittedSessionTerminalTitle) return;
170699
+ this.emittedSessionTerminalTitle = nextTitle;
170700
+ emitSessionTerminalTitle(this.options.stdout ?? process.stdout, nextTitle);
170701
+ }
170702
+ stopSessionTitleSpinner() {
170703
+ if (this.sessionTitleSpinnerTimer) {
170704
+ clearInterval(this.sessionTitleSpinnerTimer);
170705
+ this.sessionTitleSpinnerTimer = void 0;
170706
+ }
170707
+ this.sessionTitleSpinnerStartedAt = void 0;
170636
170708
  }
170637
170709
  updateTurnStatus(requestRender = true) {
170638
170710
  if (this.turnStartedAt !== void 0) this.turnElapsedMilliseconds = Math.max(0, performance.now() - this.turnStartedAt);
@@ -170645,6 +170717,7 @@ var ZCodeTui = class {
170645
170717
  const right = goalText ? goalStyle(`[ Goal: ${goalText} ]`) : void 0;
170646
170718
  const compactRight = goalLabel ? goalStyle(`[ Goal: ${goalLabel} ]`) : void 0;
170647
170719
  this.turnStatus.setContent(left, right, compactRight);
170720
+ this.refreshSessionTerminalTitle();
170648
170721
  this.updateRuntimeActivity(false);
170649
170722
  if (requestRender) this.ui.requestRender();
170650
170723
  }
@@ -170883,6 +170956,7 @@ var ZCodeTui = class {
170883
170956
  this.updateCheckAbortController?.abort();
170884
170957
  this.modelCatalogRefresh?.stop();
170885
170958
  if (this.turnTimer) clearInterval(this.turnTimer);
170959
+ this.stopSessionTitleSpinner();
170886
170960
  if (this.rewindEscapeTimer) clearTimeout(this.rewindEscapeTimer);
170887
170961
  if (this.fullscreenWelcomeTransitionTimer) clearTimeout(this.fullscreenWelcomeTransitionTimer);
170888
170962
  if (this.runtimeRefreshTimer) clearTimeout(this.runtimeRefreshTimer);