zcode-app-cli 3.14.4-30 → 3.14.4-32

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.
@@ -653,6 +653,98 @@ function appServerRegistryOptions(env, createRefreshReporter) {
653
653
  return appServerAuthMode(env) === "host" ? {} : { standalone: createRefreshReporter(process.stderr) };
654
654
  }
655
655
  //#endregion
656
+ //#region src/config-diagnostics.ts
657
+ const schemaDiagnosticPrefix = /^(?:<config>|modelStream|permission|storage|network|features|memory|mcp|plugins|skills|skill|command|logging|ui|toolConcurrency|modelAnomalyGuard|hooks)(?:[.:[\]]|$)/u;
658
+ function publicDiagnostic(diagnostic, scope) {
659
+ const message = diagnostic.code === "config_file_invalid" && !schemaDiagnosticPrefix.test(diagnostic.message) ? "Unable to read or parse configuration JSON. Check the file syntax and permissions." : diagnostic.message;
660
+ return {
661
+ code: diagnostic.code,
662
+ scope,
663
+ severity: diagnostic.severity,
664
+ filePath: diagnostic.filePath,
665
+ path: diagnostic.path,
666
+ message
667
+ };
668
+ }
669
+ function sourceStatus(source) {
670
+ if (source.diagnostics.some((diagnostic) => diagnostic.code === "config_file_invalid")) return "invalid";
671
+ return source.loaded ? "loaded" : "missing";
672
+ }
673
+ /** Inspect the runtime's resolved configuration without starting providers, plugins or MCP connections. */
674
+ function inspectRuntimeConfiguration(workingDirectory, createConfig, env = process.env) {
675
+ const logger = {
676
+ child: () => logger,
677
+ warn() {}
678
+ };
679
+ const result = createConfig({
680
+ workingDirectory,
681
+ env,
682
+ loggerFactory: { createLogger: () => logger }
683
+ });
684
+ const diagnostics = [...result.sources.user.diagnostics.map((diagnostic) => publicDiagnostic(diagnostic, "user")), ...result.sources.project.diagnostics.map((diagnostic) => publicDiagnostic(diagnostic, "project"))];
685
+ let providerPath;
686
+ try {
687
+ providerPath = providerConfigPath(env);
688
+ } catch {
689
+ diagnostics.push({
690
+ code: "desktop_settings_invalid",
691
+ scope: "desktop",
692
+ severity: "error",
693
+ filePath: desktopSettingsPath(env),
694
+ message: "Desktop settings could not be read to resolve the provider configuration path."
695
+ });
696
+ }
697
+ const legacyPath = legacyCliConfigPath(env);
698
+ return {
699
+ ok: !diagnostics.some((diagnostic) => diagnostic.severity === "error" || diagnostic.code === "config_mcp_server_invalid"),
700
+ user: {
701
+ path: result.sources.user.path,
702
+ status: sourceStatus(result.sources.user),
703
+ mcpServerNames: result.sources.user.mcpServerNames
704
+ },
705
+ project: {
706
+ paths: [.../* @__PURE__ */ new Set([...result.sources.project.paths ?? [], ...result.sources.project.diagnostics.flatMap((diagnostic) => diagnostic.filePath ? [diagnostic.filePath] : [])])],
707
+ status: sourceStatus(result.sources.project),
708
+ mcpServerNames: result.sources.project.mcpServerNames
709
+ },
710
+ provider: { path: providerPath },
711
+ legacy: {
712
+ path: legacyPath,
713
+ exists: (0, node_fs.existsSync)(legacyPath),
714
+ usage: "first-run-migration-only"
715
+ },
716
+ mcp: {
717
+ enabled: result.config.features.mcp,
718
+ servers: Object.entries(result.config.mcp.servers).map(([name, server]) => ({
719
+ name,
720
+ type: server.type,
721
+ enabled: server.enabled !== false,
722
+ source: result.sources.mcp.serverSources[name] ?? "unknown"
723
+ })).sort((left, right) => left.name.localeCompare(right.name))
724
+ },
725
+ diagnostics
726
+ };
727
+ }
728
+ function printable(value) {
729
+ return value.replace(/[\u0000-\u001f\u007f-\u009f]/gu, (character) => `\\u${character.charCodeAt(0).toString(16).padStart(4, "0")}`);
730
+ }
731
+ function writeConfigurationDoctor(output, report) {
732
+ const lines = [
733
+ "",
734
+ "Configuration:",
735
+ ` user: ${report.user.path ?? "unknown"} (${report.user.status})`,
736
+ ` project: ${report.project.paths.join(", ") || "none"} (${report.project.status})`,
737
+ ` providers: ${report.provider.path ?? "unavailable"}`,
738
+ ` legacy: ${report.legacy.path} (${report.legacy.exists ? "present; migration source only" : "absent"})`,
739
+ ` MCP: ${report.mcp.enabled ? "enabled" : "disabled"}; ${report.mcp.servers.length} configured server(s)`,
740
+ ...report.mcp.servers.map((server) => ` ${JSON.stringify(server.name)}: ${server.type}, ${server.source}, ${server.enabled ? "enabled" : "disabled"}`),
741
+ " Plugin and built-in MCP servers are added at session startup; connections were not tested.",
742
+ ...report.diagnostics.map((diagnostic) => ` ${diagnostic.severity}: ${diagnostic.filePath ?? diagnostic.scope}${diagnostic.path ? ` [${diagnostic.path}]` : ""}: ${diagnostic.message}`)
743
+ ];
744
+ output.write(lines.map(printable).join("\n") + "\n");
745
+ return report.ok ? 0 : 1;
746
+ }
747
+ //#endregion
656
748
  //#region src/runtime-config-bridge.ts
657
749
  function record(value) {
658
750
  return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
@@ -662,7 +754,7 @@ function mergeDesktopSettings(value, filePath, env = process.env) {
662
754
  const settings = record(value);
663
755
  if (!settings || (0, node_path.resolve)(filePath) !== (0, node_path.resolve)(cliSettingsPath(env))) return value;
664
756
  const desktop = readDesktopSettings(env);
665
- const locale = desktop.localePreference;
757
+ const locale = desktop.localePreference === "system" ? "auto" : desktop.localePreference;
666
758
  const memory = typeof desktop.memoryEnabled === "boolean" ? desktop.memoryEnabled : void 0;
667
759
  const memorySettings = {
668
760
  ...memory !== void 0 ? {
@@ -771,6 +863,7 @@ async function migrateLegacyProviders(options) {
771
863
  //#endregion
772
864
  exports.appServerRegistryOptions = appServerRegistryOptions;
773
865
  exports.assertSessionModelReady = assertSessionModelReady;
866
+ exports.inspectRuntimeConfiguration = inspectRuntimeConfiguration;
774
867
  exports.installSqliteWriteRecovery = installSqliteWriteRecovery;
775
868
  exports.mergeDesktopSettings = mergeDesktopSettings;
776
869
  exports.migrateLegacyProviders = migrateLegacyProviders;
@@ -781,3 +874,4 @@ exports.readTuiRuntimeProjection = readTuiRuntimeProjection;
781
874
  exports.restoreTuiBackgroundTasks = restoreTuiBackgroundTasks;
782
875
  exports.sendTuiBackgroundTaskMessage = sendTuiBackgroundTaskMessage;
783
876
  exports.sqliteRecoveryStats = sqliteRecoveryStats;
877
+ exports.writeConfigurationDoctor = writeConfigurationDoctor;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "appVersion": "3.14.4",
3
3
  "cliVersion": "0.16.9",
4
- "extractedAt": "2026-09-30T14:53:13.830Z",
4
+ "extractedAt": "2026-10-05T04:52:23.363Z",
5
5
  "sha512": "CMaAUbHehEEGuClDJeJI30ufA0zAgzfXgzV4ES200EuGDt0yYhEpzvtjayxvE/ag9T9ThnDg1eP4o3j9HkCHKg==",
6
6
  "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.14.4/linux-x64/ZCode-3.14.4-linux-x64.deb",
7
7
  "runtimeCapabilities": {
@@ -116,6 +116,11 @@
116
116
  "requirement": "required",
117
117
  "status": "applied"
118
118
  },
119
+ {
120
+ "id": "configuration-diagnostics",
121
+ "requirement": "required",
122
+ "status": "applied"
123
+ },
119
124
  {
120
125
  "id": "session-model-recovery",
121
126
  "requirement": "required",
@@ -186,6 +191,11 @@
186
191
  "requirement": "optional",
187
192
  "status": "applied"
188
193
  },
194
+ {
195
+ "id": "cli-credentials",
196
+ "requirement": "required",
197
+ "status": "applied"
198
+ },
189
199
  {
190
200
  "id": "desktop-oauth",
191
201
  "requirement": "required",
@@ -116,6 +116,9 @@ function providerConfigPath(env = process.env, platform = process.platform, fall
116
116
  const path = platform === "win32" ? win32 : posix;
117
117
  return env.ZCODE_PERSONAL_PROVIDER_CONFIG_FILE?.trim() || path.join(sharedDataBaseDir(env, platform, fallbackHome), ".zcode", "v2", "provider_config.json");
118
118
  }
119
+ function credentialsPath(env = process.env) {
120
+ return env.ZCODE_CLI_CREDENTIALS_FILE?.trim() || join(sharedDataBaseDir(env), ".zcode", "v2", "credentials.json");
121
+ }
119
122
  function legacyCliConfigPath(env = process.env) {
120
123
  return join(dirname(cliSettingsPath(env)), "config.json");
121
124
  }
@@ -266,7 +269,6 @@ function record$5(value) {
266
269
  }
267
270
  /** Configuration presence only; the runtime owns credential decryption and authentication. */
268
271
  async function readConfiguredModelAccess(env = process.env) {
269
- const directory = join(sharedDataBaseDir(env), ".zcode", "v2");
270
272
  const configPath = providerConfigPath(env);
271
273
  let value;
272
274
  try {
@@ -286,7 +288,7 @@ async function readConfiguredModelAccess(env = process.env) {
286
288
  providerId
287
289
  };
288
290
  if (providerId.startsWith("account:")) try {
289
- const credentials = record$5(JSON.parse(await readFile(join(directory, "credentials.json"), "utf8")));
291
+ const credentials = record$5(JSON.parse(await readFile(credentialsPath(env), "utf8")));
290
292
  const identity = credentials?.[`account-provider:${providerId}:identity`];
291
293
  const keyPrefix = `account-provider:coding-plan:${providerId}:account:`;
292
294
  return typeof identity === "string" && identity.length > 0 && Object.entries(credentials ?? {}).some(([key, secret]) => key.startsWith(keyPrefix) && key.endsWith(":api-key") && typeof secret === "string" && secret.length > 0) ? result : null;
@@ -160415,12 +160417,24 @@ function changedWords(hunk, theme, filePath) {
160415
160417
  var FileDiffView = class {
160416
160418
  theme;
160417
160419
  options;
160420
+ cachedLines;
160421
+ cachedWidth;
160418
160422
  constructor(theme, options) {
160419
160423
  this.theme = theme;
160420
160424
  this.options = options;
160421
160425
  }
160422
- invalidate() {}
160426
+ invalidate() {
160427
+ this.cachedLines = void 0;
160428
+ this.cachedWidth = void 0;
160429
+ }
160423
160430
  render(width) {
160431
+ if (this.cachedLines && this.cachedWidth === width) return this.cachedLines;
160432
+ const lines = this.renderDiff(width);
160433
+ this.cachedLines = lines;
160434
+ this.cachedWidth = width;
160435
+ return lines;
160436
+ }
160437
+ renderDiff(width) {
160424
160438
  const output = [];
160425
160439
  const diffs = this.options.expanded ? this.options.diffs : this.options.diffs.slice(0, maxVisibleFiles);
160426
160440
  const digits = Math.max(2, String(maximumLineNumber(diffs)).length);
@@ -167056,6 +167070,7 @@ var ZCodeTui = class {
167056
167070
  }
167057
167071
  if (matchesKey(data, "ctrl+f")) {
167058
167072
  this.editor.setText("/search ");
167073
+ this.ui.requestRender();
167059
167074
  return { consume: true };
167060
167075
  }
167061
167076
  if (matchesKey(data, "shift+tab")) {
@@ -167079,8 +167094,10 @@ var ZCodeTui = class {
167079
167094
  return { consume: true };
167080
167095
  }
167081
167096
  if (matchesKey(data, "ctrl+c")) {
167082
- if (this.editor.getText()) this.editor.setText("");
167083
- else if (this.turnAbortController) {
167097
+ if (this.editor.getText()) {
167098
+ this.editor.setText("");
167099
+ this.ui.requestRender();
167100
+ } else if (this.turnAbortController) {
167084
167101
  this.pendingSteerInterrupt = void 0;
167085
167102
  this.turnAbortController.abort();
167086
167103
  this.updateActivity("cancelling…");