zcode-app-cli 3.7.7-13 → 3.7.7-14

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.7.7-13",
3
+ "version": "3.7.7-14",
4
4
  "description": "Unofficial terminal client for the ZCode agent runtime",
5
5
  "keywords": [
6
6
  "agent",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "appVersion": "3.7.7",
3
3
  "cliVersion": "0.16.3",
4
- "extractedAt": "2026-08-15T12:57:05.587Z",
4
+ "extractedAt": "2026-08-18T06:06:14.063Z",
5
5
  "sha512": "9vUj/HFAUk0AS7S/TwPr6qa+qJv8ccAIvHJxp29TYvVnMoOZKPQ3rDiTlXGo9htFL7V5HBRb0n+NbXm5Cm5BqA==",
6
6
  "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.7.7/linux-x64/ZCode-3.7.7-linux-x64.deb",
7
7
  "tui": {
@@ -130,6 +130,9 @@ function userConfigPath(env = process.env, platform = process.platform, fallback
130
130
  const configuredHome = (platform === "win32" ? env.USERPROFILE : env.HOME)?.trim();
131
131
  return path.join(configuredHome || fallbackHome, ".zcode", "cli", "config.json");
132
132
  }
133
+ function userConfigPathHint(platform = process.platform) {
134
+ return platform === "win32" ? "%USERPROFILE%\\.zcode\\cli\\config.json" : "~/.zcode/cli/config.json";
135
+ }
133
136
  async function ensureUserConfig(env = process.env) {
134
137
  const configPath = userConfigPath(env);
135
138
  const configDirectory = dirname(configPath);
@@ -158090,6 +158093,60 @@ function goalStatusText(goal) {
158090
158093
  return goal.timeUsedSeconds > 0 ? `${label} (${formatGoalElapsed(goal.timeUsedSeconds)})` : label;
158091
158094
  }
158092
158095
  //#endregion
158096
+ //#region packages/zcode-tui/src/session-status.ts
158097
+ function nonNegativeNumber(value) {
158098
+ return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
158099
+ }
158100
+ function projectionMetrics(value) {
158101
+ if (!isRecord(value)) return void 0;
158102
+ const metrics = {
158103
+ contextUsed: nonNegativeNumber(value.contextUsed),
158104
+ contextWindow: nonNegativeNumber(value.contextWindow),
158105
+ totalTokens: nonNegativeNumber(value.totalTokenCount),
158106
+ turnCount: nonNegativeNumber(value.turnCount)
158107
+ };
158108
+ return Object.values(metrics).some((metric) => metric !== void 0) ? metrics : void 0;
158109
+ }
158110
+ function usageMetrics(value) {
158111
+ if (!isRecord(value)) return void 0;
158112
+ const metrics = {
158113
+ totalTokens: nonNegativeNumber(value.totalTokens),
158114
+ inputTokens: nonNegativeNumber(value.inputTokens),
158115
+ outputTokens: nonNegativeNumber(value.outputTokens),
158116
+ reasoningTokens: nonNegativeNumber(value.reasoningTokens),
158117
+ cacheCreationTokens: nonNegativeNumber(value.cacheCreationTokens),
158118
+ cacheReadTokens: nonNegativeNumber(value.cacheReadTokens),
158119
+ modelRequestCount: nonNegativeNumber(value.modelRequestCount),
158120
+ modelErrorCount: nonNegativeNumber(value.modelErrorCount)
158121
+ };
158122
+ return Object.values(metrics).some((metric) => metric !== void 0) ? metrics : void 0;
158123
+ }
158124
+ function sessionIdFromUsage(value) {
158125
+ if (!isRecord(value)) return void 0;
158126
+ return (asString(value.sessionId) ?? asString(value.sessionID))?.trim() || void 0;
158127
+ }
158128
+ function mergeMetrics(current, update) {
158129
+ if (!update) return current;
158130
+ const defined = Object.fromEntries(Object.entries(update).filter((entry) => entry[1] !== void 0));
158131
+ return {
158132
+ ...current,
158133
+ ...defined
158134
+ };
158135
+ }
158136
+ function mergeProjectionMetrics(current, update, hasAuthoritativeSessionUsage) {
158137
+ if (!update || !hasAuthoritativeSessionUsage) return mergeMetrics(current, update);
158138
+ const { totalTokens: _projectionTotal, ...contextMetrics } = update;
158139
+ return mergeMetrics(current, contextMetrics);
158140
+ }
158141
+ function contextUsedPercent(metrics) {
158142
+ if (metrics.contextUsed === void 0 || !metrics.contextWindow) return void 0;
158143
+ return Math.max(0, Math.min(100, Math.round(metrics.contextUsed / metrics.contextWindow * 100)));
158144
+ }
158145
+ function contextRemainingPercent(metrics) {
158146
+ const used = contextUsedPercent(metrics);
158147
+ return used === void 0 ? void 0 : 100 - used;
158148
+ }
158149
+ //#endregion
158093
158150
  //#region packages/zcode-tui/src/context-status-view.ts
158094
158151
  const contextLabels = {
158095
158152
  system_prompt: "System prompt",
@@ -158205,7 +158262,10 @@ var ContextDetailView = class {
158205
158262
  const columns = totalChars > 0 ? Math.max(1, Math.round(item.chars / totalChars * barWidth)) : 0;
158206
158263
  return contextStyle(item.source, this.theme)("█".repeat(columns));
158207
158264
  }).join("");
158208
- const usedPercent = Math.max(0, Math.round(this.usage.used / this.usage.size * 100));
158265
+ const usedPercent = contextUsedPercent({
158266
+ contextUsed: this.usage.used,
158267
+ contextWindow: this.usage.size
158268
+ }) ?? 0;
158209
158269
  const remaining = Math.max(0, this.usage.size - this.usage.used);
158210
158270
  const usageStyle = usedPercent >= 90 ? this.theme.error : usedPercent >= 70 ? this.theme.warning : (text) => text;
158211
158271
  const lines = [this.theme.bold("Context overview"), usageStyle(`${formatTokens(this.usage.used)} / ${formatTokens(this.usage.size)} tokens · ${usedPercent}% used · ${formatTokens(remaining)} remaining`)];
@@ -158319,7 +158379,7 @@ var StatusDetailView = class {
158319
158379
  ["Runtime state", projection?.status],
158320
158380
  ["Last error", projection?.lastError ? [projection.lastError.code, projection.lastError.message].filter(Boolean).join(" · ") : void 0],
158321
158381
  ["Turns", String(metrics.turnCount ?? projection?.turnCount ?? 0)],
158322
- ["Tokens", metrics.totalTokens !== void 0 ? formatTokens(metrics.totalTokens) : void 0],
158382
+ ["Session tokens", metrics.totalTokens !== void 0 ? formatTokens(metrics.totalTokens) : void 0],
158323
158383
  ["Requests", metrics.modelRequestCount !== void 0 ? `${metrics.modelRequestCount}${metrics.modelErrorCount ? ` · ${metrics.modelErrorCount} errors` : ""}` : void 0],
158324
158384
  ["Active tools", projection ? String(projection.activeToolCalls.length) : void 0],
158325
158385
  ["Background", projection ? String(projection.backgroundJobs.filter((job) => job.status === "running").length) : void 0],
@@ -162648,49 +162708,6 @@ function skillDescription(candidate) {
162648
162708
  return description ? truncateGraphemes(description, skillDescriptionLimit) : void 0;
162649
162709
  }
162650
162710
  //#endregion
162651
- //#region packages/zcode-tui/src/session-status.ts
162652
- function nonNegativeNumber(value) {
162653
- return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
162654
- }
162655
- function projectionMetrics(value) {
162656
- if (!isRecord(value)) return void 0;
162657
- const metrics = {
162658
- contextUsed: nonNegativeNumber(value.contextUsed),
162659
- contextWindow: nonNegativeNumber(value.contextWindow),
162660
- totalTokens: nonNegativeNumber(value.totalTokenCount),
162661
- turnCount: nonNegativeNumber(value.turnCount)
162662
- };
162663
- return Object.values(metrics).some((metric) => metric !== void 0) ? metrics : void 0;
162664
- }
162665
- function usageMetrics(value) {
162666
- if (!isRecord(value)) return void 0;
162667
- const metrics = {
162668
- totalTokens: nonNegativeNumber(value.totalTokens),
162669
- inputTokens: nonNegativeNumber(value.inputTokens),
162670
- outputTokens: nonNegativeNumber(value.outputTokens),
162671
- reasoningTokens: nonNegativeNumber(value.reasoningTokens),
162672
- cacheCreationTokens: nonNegativeNumber(value.cacheCreationTokens),
162673
- cacheReadTokens: nonNegativeNumber(value.cacheReadTokens),
162674
- modelRequestCount: nonNegativeNumber(value.modelRequestCount),
162675
- modelErrorCount: nonNegativeNumber(value.modelErrorCount)
162676
- };
162677
- return Object.values(metrics).some((metric) => metric !== void 0) ? metrics : void 0;
162678
- }
162679
- function sessionIdFromUsage(value) {
162680
- if (!isRecord(value)) return void 0;
162681
- return (asString(value.sessionId) ?? asString(value.sessionID))?.trim() || void 0;
162682
- }
162683
- function mergeMetrics(current, update) {
162684
- return update ? {
162685
- ...current,
162686
- ...update
162687
- } : current;
162688
- }
162689
- function contextRemainingPercent(metrics) {
162690
- if (metrics.contextUsed === void 0 || !metrics.contextWindow) return void 0;
162691
- return Math.max(0, Math.min(100, Math.round((1 - metrics.contextUsed / metrics.contextWindow) * 100)));
162692
- }
162693
- //#endregion
162694
162711
  //#region packages/zcode-tui/src/shortcuts.ts
162695
162712
  const modes = [
162696
162713
  "build",
@@ -165134,8 +165151,9 @@ var ZCodeTui = class {
165134
165151
  this.editor.onSubmit = (text) => void this.submit(text);
165135
165152
  }
165136
165153
  updateLoginWarning() {
165154
+ const configPath = userConfigPathHint();
165137
165155
  this.loginWarning.setText(this.loginRequired ? this.theme.warning("Model access is not configured.") : "");
165138
- this.loginHelp.setText(this.loginRequired ? this.theme.warning("Run /login, or configure a custom provider in ~/.zcode/cli/config.json.") : "");
165156
+ this.loginHelp.setText(this.loginRequired ? this.theme.warning(`Run /login, or configure a custom provider in ${configPath}.`) : "");
165139
165157
  }
165140
165158
  setLoginRequired(required) {
165141
165159
  const changed = this.loginRequired !== required;
@@ -165805,7 +165823,7 @@ var ZCodeTui = class {
165805
165823
  if (appliesToSetting(settingTarget, "effort") && typeof result.thoughtLevel === "string") this.thoughtLevel = result.thoughtLevel;
165806
165824
  if (Array.isArray(result.modelOptions)) this.modelOptions = [...result.modelOptions];
165807
165825
  if (Array.isArray(result.effortOptions)) this.effortOptions = [...result.effortOptions];
165808
- this.sessionMetrics = mergeMetrics(this.sessionMetrics, projectionMetrics(result.projection));
165826
+ this.sessionMetrics = mergeProjectionMetrics(this.sessionMetrics, projectionMetrics(result.projection), Boolean(this.options.readSessionUsage));
165809
165827
  if (Array.isArray(result.todos)) this.todos = normalizeTodos(result.todos);
165810
165828
  if (Array.isArray(result.todoGroups)) this.todoGroups = normalizeTodoGroups(result);
165811
165829
  this.applyRuntimeProjection(normalizeRuntimeProjection(result));
@@ -167012,7 +167030,8 @@ var ZCodeTui = class {
167012
167030
  }))?.payload;
167013
167031
  if (!command?.command) return;
167014
167032
  if (command.command === customProviderHelpCommand) {
167015
- this.addNotice("Custom providers do not require login. Copy config.example.json to ~/.zcode/cli/config.json, set provider kind, baseURL, apiKey and model IDs, then run /new. See README: Custom provider without login.", "muted");
167033
+ const configPath = userConfigPathHint();
167034
+ this.addNotice(`Custom providers do not require login. Copy config.example.json to ${configPath}, set provider kind, baseURL, apiKey and model IDs, then run /new. See README: Custom provider without login.`, "muted");
167016
167035
  return;
167017
167036
  }
167018
167037
  if (!command.input) {
@@ -168078,8 +168097,8 @@ var ZCodeTui = class {
168078
168097
  if (this.sessionMetrics.totalTokens !== void 0) {
168079
168098
  const tokens = formatTokens(this.sessionMetrics.totalTokens);
168080
168099
  fields.push({
168081
- text: this.theme.muted(`${tokens} tokens`),
168082
- compactText: this.theme.muted(`${tokens} tok`),
168100
+ text: this.theme.muted(`session ${tokens} tokens`),
168101
+ compactText: this.theme.muted(`session ${tokens}`),
168083
168102
  priority: 20
168084
168103
  });
168085
168104
  }
@@ -168160,12 +168179,12 @@ var ZCodeTui = class {
168160
168179
  this.runtimeProjection = projection;
168161
168180
  this.reconcileTurnTiming(projection);
168162
168181
  if (projection.sessionId) this.sessionId = projection.sessionId;
168163
- this.sessionMetrics = mergeMetrics(this.sessionMetrics, {
168182
+ this.sessionMetrics = mergeProjectionMetrics(this.sessionMetrics, {
168164
168183
  contextUsed: projection.contextUsage?.used,
168165
168184
  contextWindow: projection.contextUsage?.size,
168166
168185
  totalTokens: projection.totalTokenCount,
168167
168186
  turnCount: projection.turnCount
168168
- });
168187
+ }, Boolean(this.options.readSessionUsage));
168169
168188
  this.updateRuntimeActivity(false);
168170
168189
  }
168171
168190
  updateRuntimeActivity(requestRender = true) {