@codexhost/cli-win32-arm64 0.28.0 → 0.28.1

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.
@@ -888,10 +888,10 @@ function mergeDefs(...defs) {
888
888
  function cloneDef(schema) {
889
889
  return mergeDefs(schema._zod.def);
890
890
  }
891
- function getElementAtPath(obj, path8) {
892
- if (!path8)
891
+ function getElementAtPath(obj, path9) {
892
+ if (!path9)
893
893
  return obj;
894
- return path8.reduce((acc, key) => acc?.[key], obj);
894
+ return path9.reduce((acc, key) => acc?.[key], obj);
895
895
  }
896
896
  function promiseAllObject(promisesObj) {
897
897
  const keys = Object.keys(promisesObj);
@@ -1231,11 +1231,11 @@ function explicitlyAborted(x, startIndex = 0) {
1231
1231
  }
1232
1232
  return false;
1233
1233
  }
1234
- function prefixIssues(path8, issues) {
1234
+ function prefixIssues(path9, issues) {
1235
1235
  return issues.map((iss) => {
1236
1236
  var _a3;
1237
1237
  (_a3 = iss).path ?? (_a3.path = []);
1238
- iss.path.unshift(path8);
1238
+ iss.path.unshift(path9);
1239
1239
  return iss;
1240
1240
  });
1241
1241
  }
@@ -1697,16 +1697,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
1697
1697
  }
1698
1698
  function formatError(error62, mapper = (issue2) => issue2.message) {
1699
1699
  const fieldErrors = { _errors: [] };
1700
- const processError = (error63, path8 = []) => {
1700
+ const processError = (error63, path9 = []) => {
1701
1701
  for (const issue2 of error63.issues) {
1702
1702
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1703
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1703
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
1704
1704
  } else if (issue2.code === "invalid_key") {
1705
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1705
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1706
1706
  } else if (issue2.code === "invalid_element") {
1707
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1707
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1708
1708
  } else {
1709
- const fullpath = [...path8, ...issue2.path];
1709
+ const fullpath = [...path9, ...issue2.path];
1710
1710
  if (fullpath.length === 0) {
1711
1711
  fieldErrors._errors.push(mapper(issue2));
1712
1712
  } else {
@@ -1745,17 +1745,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
1745
1745
  }
1746
1746
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
1747
1747
  const result = { errors: [] };
1748
- const processError = (error63, path8 = []) => {
1748
+ const processError = (error63, path9 = []) => {
1749
1749
  var _a3;
1750
1750
  for (const issue2 of error63.issues) {
1751
1751
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1752
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1752
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
1753
1753
  } else if (issue2.code === "invalid_key") {
1754
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1754
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1755
1755
  } else if (issue2.code === "invalid_element") {
1756
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1756
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1757
1757
  } else {
1758
- const fullpath = [...path8, ...issue2.path];
1758
+ const fullpath = [...path9, ...issue2.path];
1759
1759
  if (fullpath.length === 0) {
1760
1760
  result.errors.push(mapper(issue2));
1761
1761
  continue;
@@ -1794,8 +1794,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1794
1794
  }
1795
1795
  function toDotPath(_path) {
1796
1796
  const segs = [];
1797
- const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1798
- for (const seg of path8) {
1797
+ const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1798
+ for (const seg of path9) {
1799
1799
  if (typeof seg === "number")
1800
1800
  segs.push(`[${seg}]`);
1801
1801
  else if (typeof seg === "symbol")
@@ -18933,13 +18933,13 @@ function resolveRef(ref, ctx) {
18933
18933
  if (!ref.startsWith("#")) {
18934
18934
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
18935
18935
  }
18936
- const path8 = ref.slice(1).split("/").filter(Boolean);
18937
- if (path8.length === 0) {
18936
+ const path9 = ref.slice(1).split("/").filter(Boolean);
18937
+ if (path9.length === 0) {
18938
18938
  return ctx.rootSchema;
18939
18939
  }
18940
18940
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
18941
- if (path8[0] === defsKey) {
18942
- const key = path8[1] === void 0 ? void 0 : decodeJSONPointerSegment(path8[1]);
18941
+ if (path9[0] === defsKey) {
18942
+ const key = path9[1] === void 0 ? void 0 : decodeJSONPointerSegment(path9[1]);
18943
18943
  if (!key || !ctx.defs[key]) {
18944
18944
  throw new Error(`Reference not found: ${ref}`);
18945
18945
  }
@@ -20752,7 +20752,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
20752
20752
  default: external_exports.string().optional()
20753
20753
  })
20754
20754
  ]).superRefine((field3, ctx) => {
20755
- const issue2 = (path8, message) => ctx.addIssue({ code: "custom", path: [path8], message });
20755
+ const issue2 = (path9, message) => ctx.addIssue({ code: "custom", path: [path9], message });
20756
20756
  if (field3.type === "number" || field3.type === "range") {
20757
20757
  const { min = -Infinity, max = Infinity, default: value } = field3;
20758
20758
  if (min > max)
@@ -20858,16 +20858,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
20858
20858
  var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
20859
20859
  var hostExtensionDigestSchema = desktopExtensionHashSchema;
20860
20860
  var hostExtensionActivationIdSchema = external_exports.uuid();
20861
- var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path8) => path8.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
20861
+ var hostExtensionResourcePathSchema = pluginRelativeResourceSchema.refine((resource) => !/[\x00-\x1f\x7f<>"|*]/u.test(resource) && resource.split("/").every((part) => !/[. ]$/u.test(part) && !reservedName.test(part)), "Expected a portable relative resource path").refine((path9) => path9.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
20862
20862
  var legacy = desktopExtensionManifestSchema.shape;
20863
20863
  var localized = (max, min = 0) => external_exports.strictObject({
20864
20864
  en: external_exports.string().trim().min(min).max(max),
20865
20865
  "zh-CN": external_exports.string().trim().min(min).max(max)
20866
20866
  });
20867
- var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path8) => path8.endsWith(suffix), `Expected a ${suffix} file`);
20867
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path9) => path9.endsWith(suffix), `Expected a ${suffix} file`);
20868
20868
  var moduleEntry = resourceWithSuffix(".mjs");
20869
20869
  var style = resourceWithSuffix(".css").optional();
20870
- var hostExtensionCanonicalPath = (path8) => path8.normalize("NFC").toLowerCase();
20870
+ var hostExtensionCanonicalPath = (path9) => path9.normalize("NFC").toLowerCase();
20871
20871
  var hostExtensionManifestV2Schema = external_exports.strictObject({
20872
20872
  manifestVersion: external_exports.literal(2),
20873
20873
  id: hostExtensionIdSchema,
@@ -20877,8 +20877,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
20877
20877
  details: localized(16384).optional(),
20878
20878
  author: legacy.author,
20879
20879
  repository: legacy.repository,
20880
- icon: legacy.icon.refine((path8) => path8 === void 0 || hostExtensionResourcePathSchema.safeParse(path8).success),
20881
- screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path8) => hostExtensionResourcePathSchema.safeParse(path8).success)),
20880
+ icon: legacy.icon.refine((path9) => path9 === void 0 || hostExtensionResourcePathSchema.safeParse(path9).success),
20881
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path9) => hostExtensionResourcePathSchema.safeParse(path9).success)),
20882
20882
  categories: legacy.categories,
20883
20883
  settingsSchema: legacy.settingsSchema,
20884
20884
  slots: legacy.slots.removeDefault().optional(),
@@ -20957,7 +20957,7 @@ var active = {
20957
20957
  digest: hostExtensionDigestSchema
20958
20958
  };
20959
20959
  var optionalActivation = { ...id, activationId: active.activationId.optional() };
20960
- var filePath = external_exports.string().min(1).max(4096).refine((path8) => /^(?:\/|[a-z]:[/\\])/iu.test(path8) && !path8.includes("\0") && !path8.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
20960
+ var filePath = external_exports.string().min(1).max(4096).refine((path9) => /^(?:\/|[a-z]:[/\\])/iu.test(path9) && !path9.includes("\0") && !path9.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
20961
20961
  var gitRef = external_exports.string().min(1).max(256).refine((ref) => ref.split("/").every((part) => part && /^[a-z0-9_.-]+$/iu.test(part) && part !== "." && part !== ".."), "Invalid GitHub ref");
20962
20962
  function base643(maxBytes) {
20963
20963
  return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
@@ -23844,7 +23844,7 @@ function createZcodeUsageStatistics(environment) {
23844
23844
  }
23845
23845
 
23846
23846
  // dist/adapter.js
23847
- import path7 from "node:path";
23847
+ import path8 from "node:path";
23848
23848
  import { isDeepStrictEqual } from "node:util";
23849
23849
  import { stat as stat2 } from "node:fs/promises";
23850
23850
 
@@ -23880,7 +23880,57 @@ function nativeError(error62) {
23880
23880
  // dist/installation.js
23881
23881
  import { open as open2, stat } from "node:fs/promises";
23882
23882
  import { homedir } from "node:os";
23883
+ import path3 from "node:path";
23884
+
23885
+ // dist/builtin-provider-config.js
23886
+ import { readFile, readdir } from "node:fs/promises";
23883
23887
  import path2 from "node:path";
23888
+ var builtinProviderConfigSchema = external_exports.object({
23889
+ revision: external_exports.union([external_exports.number(), external_exports.string()]),
23890
+ config: external_exports.object({
23891
+ providerConfigRules: external_exports.object({
23892
+ providerRules: external_exports.array(external_exports.object({
23893
+ providerId: external_exports.string().min(1),
23894
+ config: external_exports.object({
23895
+ builtinModelIds: external_exports.array(external_exports.string()).optional(),
23896
+ access: external_exports.object({ mode: external_exports.string(), accountType: external_exports.string() }).partial().optional()
23897
+ })
23898
+ }))
23899
+ })
23900
+ })
23901
+ });
23902
+ async function readRevision(file2) {
23903
+ let config2;
23904
+ try {
23905
+ config2 = builtinProviderConfigSchema.parse(JSON.parse(await readFile(file2, "utf8")));
23906
+ } catch {
23907
+ return void 0;
23908
+ }
23909
+ const revision = typeof config2.revision === "number" ? config2.revision : Number(config2.revision);
23910
+ return Number.isFinite(revision) ? revision : void 0;
23911
+ }
23912
+ async function resolveDesktopBuiltinProviderConfig(dataRoot, appVersion, bundledFile) {
23913
+ const bundledRevision = await readRevision(bundledFile);
23914
+ if (bundledRevision === void 0)
23915
+ return void 0;
23916
+ const providerRoot = path2.join(dataRoot, "runtime", "provider");
23917
+ let newest;
23918
+ for (const platform2 of await readdir(providerRoot).catch(() => [])) {
23919
+ const versionDirectory = path2.join(providerRoot, platform2, appVersion);
23920
+ for (const endpoint of (await readdir(versionDirectory).catch(() => [])).sort()) {
23921
+ if (!endpoint.startsWith("endpoint-"))
23922
+ continue;
23923
+ const file2 = path2.join(versionDirectory, endpoint, "zcode-builtin.json");
23924
+ const revision = await readRevision(file2);
23925
+ if (revision !== void 0 && (!newest || revision > newest.revision)) {
23926
+ newest = { revision, file: file2 };
23927
+ }
23928
+ }
23929
+ }
23930
+ return newest && newest.revision > bundledRevision ? newest.file : void 0;
23931
+ }
23932
+
23933
+ // dist/installation.js
23884
23934
  var DEFAULT_DARWIN_APP = "/Applications/ZCode.app";
23885
23935
  var DEFAULT_LINUX_APP = "/opt/ZCode";
23886
23936
  async function isFile(file2) {
@@ -23925,11 +23975,11 @@ async function resolveDefaultApp(environment, platform2) {
23925
23975
  if (platform2 === "linux")
23926
23976
  return DEFAULT_LINUX_APP;
23927
23977
  const candidates = [
23928
- environment.LOCALAPPDATA && path2.join(environment.LOCALAPPDATA, "Programs", "ZCode"),
23929
- environment.ProgramFiles && path2.join(environment.ProgramFiles, "ZCode")
23978
+ environment.LOCALAPPDATA && path3.join(environment.LOCALAPPDATA, "Programs", "ZCode"),
23979
+ environment.ProgramFiles && path3.join(environment.ProgramFiles, "ZCode")
23930
23980
  ].filter(Boolean);
23931
23981
  for (const candidate of candidates) {
23932
- if (await isFile(path2.join(candidate, "resources", "app.asar")))
23982
+ if (await isFile(path3.join(candidate, "resources", "app.asar")))
23933
23983
  return candidate;
23934
23984
  }
23935
23985
  return candidates[0] ?? "";
@@ -23941,30 +23991,31 @@ async function resolveInstallation(environment, app, platform2 = process.platfor
23941
23991
  const explicitApp = app?.trim() || environment.CODEXHOST_ZCODE_APP?.trim();
23942
23992
  const targetApp = explicitApp || await resolveDefaultApp(environment, platform2);
23943
23993
  const missing = () => new ZcodeError("notInstalled", `ZCode Desktop was not found at ${targetApp}; install it or set its application path`);
23944
- const resources = platform2 === "darwin" ? path2.join(targetApp, "Contents", "Resources") : path2.join(targetApp, "resources");
23945
- const pkg = await readPackageJsonFromAsar(path2.join(resources, "app.asar"));
23994
+ const resources = platform2 === "darwin" ? path3.join(targetApp, "Contents", "Resources") : path3.join(targetApp, "resources");
23995
+ const pkg = await readPackageJsonFromAsar(path3.join(resources, "app.asar"));
23946
23996
  if (!pkg?.productName || !pkg.version)
23947
23997
  throw missing();
23948
23998
  let runtime;
23949
23999
  if (platform2 === "darwin") {
23950
- runtime = path2.join(targetApp, "Contents", "Frameworks", `${pkg.productName} Helper.app`, "Contents", "MacOS", `${pkg.productName} Helper`);
24000
+ runtime = path3.join(targetApp, "Contents", "Frameworks", `${pkg.productName} Helper.app`, "Contents", "MacOS", `${pkg.productName} Helper`);
23951
24001
  } else if (platform2 === "win32") {
23952
- runtime = path2.join(targetApp, `${pkg.productName}.exe`);
24002
+ runtime = path3.join(targetApp, `${pkg.productName}.exe`);
23953
24003
  } else {
23954
24004
  const linuxExecutableName = pkg.productName.toLowerCase().replace(/\s+/g, "-");
23955
- runtime = path2.join(targetApp, linuxExecutableName);
24005
+ runtime = path3.join(targetApp, linuxExecutableName);
23956
24006
  }
23957
- const cli = path2.join(resources, "glm", "zcode.cjs");
23958
- const builtinProviderConfig = environment.ZCODE_BUILTIN_PROVIDER_CONFIG_FILE || path2.join(resources, "config", "provider", "zcode-builtin.json");
24007
+ const cli = path3.join(resources, "glm", "zcode.cjs");
24008
+ const dataRoot = path3.join(environment.ZCODE_DATA_BASE_DIR?.trim() || environment.HOME || homedir(), ".zcode", "v2");
24009
+ const bundledProviderConfig = path3.join(resources, "config", "provider", "zcode-builtin.json");
24010
+ const builtinProviderConfig = environment.ZCODE_BUILTIN_PROVIDER_CONFIG_FILE || await resolveDesktopBuiltinProviderConfig(dataRoot, pkg.version, bundledProviderConfig) || bundledProviderConfig;
23959
24011
  if (!await isFile(runtime) || !await isFile(cli) || !await isFile(builtinProviderConfig))
23960
24012
  throw missing();
23961
- const dataRoot = path2.join(environment.ZCODE_DATA_BASE_DIR?.trim() || environment.HOME || homedir(), ".zcode", "v2");
23962
24013
  return {
23963
24014
  runtime,
23964
24015
  version: pkg.version,
23965
24016
  cli,
23966
24017
  builtinProviderConfig,
23967
- personalProviderConfig: environment.ZCODE_PERSONAL_PROVIDER_CONFIG_FILE || path2.join(dataRoot, "provider_config.json"),
24018
+ personalProviderConfig: environment.ZCODE_PERSONAL_PROVIDER_CONFIG_FILE || path3.join(dataRoot, "provider_config.json"),
23968
24019
  dataRoot
23969
24020
  };
23970
24021
  }
@@ -23991,19 +24042,19 @@ function createZcodeInstallation(environment, app) {
23991
24042
 
23992
24043
  // dist/account.js
23993
24044
  import { createHash as createHash4 } from "node:crypto";
23994
- import { readFile as readFile3 } from "node:fs/promises";
23995
- import path6 from "node:path";
24045
+ import { readFile as readFile4 } from "node:fs/promises";
24046
+ import path7 from "node:path";
23996
24047
 
23997
24048
  // dist/credentials.js
23998
24049
  import { createDecipheriv, createHash } from "node:crypto";
23999
24050
  import { constants } from "node:fs";
24000
- import { open as open3, readFile } from "node:fs/promises";
24051
+ import { open as open3, readFile as readFile2 } from "node:fs/promises";
24001
24052
  import { homedir as homedir2, platform, userInfo } from "node:os";
24002
- import path4 from "node:path";
24053
+ import path5 from "node:path";
24003
24054
 
24004
24055
  // dist/credential-keyring.js
24005
24056
  import { execFile } from "node:child_process";
24006
- import path3 from "node:path";
24057
+ import path4 from "node:path";
24007
24058
  import { promisify } from "node:util";
24008
24059
  var execute = promisify(execFile);
24009
24060
  var SERVICE = "ZCode Credential Encryption";
@@ -24099,9 +24150,9 @@ var readSystemCredentialKey = async (account, options = {}) => {
24099
24150
  let value;
24100
24151
  if (process.platform === "win32") {
24101
24152
  const root = process.env.SystemRoot;
24102
- if (!root || !path3.isAbsolute(root))
24153
+ if (!root || !path4.isAbsolute(root))
24103
24154
  return;
24104
- const powershell = path3.join(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
24155
+ const powershell = path4.join(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
24105
24156
  const command = `${WIN32_READER}
24106
24157
  [Console]::Write([ZCodeKeyReader]::Read('${account}.${SERVICE}'))`;
24107
24158
  value = (await run(powershell, [
@@ -24114,7 +24165,7 @@ var readSystemCredentialKey = async (account, options = {}) => {
24114
24165
  } else if (process.platform === "darwin") {
24115
24166
  const security = "/usr/bin/security";
24116
24167
  const keychain = /^\s*"([^"\r\n]+)"\s*$/.exec(await run(security, ["default-keychain", "-d", "user"]))?.[1];
24117
- if (!keychain || !path3.isAbsolute(keychain)) {
24168
+ if (!keychain || !path4.isAbsolute(keychain)) {
24118
24169
  deniedReads.set(cacheKey, { reason: "denied", readAt: performance.now() });
24119
24170
  return;
24120
24171
  }
@@ -24256,8 +24307,8 @@ async function loadV2Key(file2, values, environment, readSystemKey, source, read
24256
24307
  return { source: "env", key: digest(secret) };
24257
24308
  if (explicitFile)
24258
24309
  return { source: "env", key: digest(await readSecretFile(explicitFile, false)) };
24259
- const directory = path4.dirname(file2);
24260
- const marker = await readFile(path4.join(directory, "credential-source"), "utf8").catch((error62) => {
24310
+ const directory = path5.dirname(file2);
24311
+ const marker = await readFile2(path5.join(directory, "credential-source"), "utf8").catch((error62) => {
24261
24312
  if (error62.code === "ENOENT")
24262
24313
  return void 0;
24263
24314
  throw error62;
@@ -24270,7 +24321,7 @@ async function loadV2Key(file2, values, environment, readSystemKey, source, read
24270
24321
  throw unavailableV2();
24271
24322
  return {
24272
24323
  source: "env",
24273
- key: digest(await readSecretFile(path4.join(directory, "credential-secret"), true))
24324
+ key: digest(await readSecretFile(path5.join(directory, "credential-secret"), true))
24274
24325
  };
24275
24326
  }
24276
24327
  if (source !== "os")
@@ -24301,10 +24352,10 @@ function plaintextCredential(value) {
24301
24352
  return value;
24302
24353
  }
24303
24354
  async function readCredentials(installation, environment, readSystemKey = readSystemCredentialKey, readSystemKeyOptions) {
24304
- const file2 = path4.resolve(installation.dataRoot, "credentials.json");
24355
+ const file2 = path5.resolve(installation.dataRoot, "credentials.json");
24305
24356
  let values;
24306
24357
  try {
24307
- values = storeSchema.parse(JSON.parse(await readFile(file2, "utf8")));
24358
+ values = storeSchema.parse(JSON.parse(await readFile2(file2, "utf8")));
24308
24359
  } catch (error62) {
24309
24360
  if (error62.code === "ENOENT")
24310
24361
  return async () => "";
@@ -24357,9 +24408,9 @@ async function readOAuthUserId(credential, channel) {
24357
24408
 
24358
24409
  // dist/personal-coding-plan.js
24359
24410
  import { createHash as createHash3 } from "node:crypto";
24360
- import { readFile as readFile2 } from "node:fs/promises";
24411
+ import { readFile as readFile3 } from "node:fs/promises";
24361
24412
  import { homedir as homedir3 } from "node:os";
24362
- import path5 from "node:path";
24413
+ import path6 from "node:path";
24363
24414
 
24364
24415
  // dist/project-token.js
24365
24416
  import { createHash as createHash2 } from "node:crypto";
@@ -24483,7 +24534,7 @@ async function readSelection(environment, family) {
24483
24534
  const home = environment.ZCODE_DESKTOP_HOME_DIR?.trim() || environment.HOME?.trim() || environment.USERPROFILE?.trim() || homedir3();
24484
24535
  let raw;
24485
24536
  try {
24486
- raw = JSON.parse(await readFile2(path5.join(home, ".zcode", "v2", "setting.json"), "utf8"));
24537
+ raw = JSON.parse(await readFile3(path6.join(home, ".zcode", "v2", "setting.json"), "utf8"));
24487
24538
  } catch (error62) {
24488
24539
  if (error62.code === "ENOENT")
24489
24540
  return false;
@@ -24701,27 +24752,13 @@ var PersonalCodingPlanAccount = class {
24701
24752
 
24702
24753
  // dist/account.js
24703
24754
  var SIGN_IN = "Sign in to ZCode Desktop with a Start Plan account, then try again";
24704
- var builtinSchema = external_exports.object({
24705
- revision: external_exports.union([external_exports.number(), external_exports.string()]),
24706
- config: external_exports.object({
24707
- providerConfigRules: external_exports.object({
24708
- providerRules: external_exports.array(external_exports.object({
24709
- providerId: external_exports.string().min(1),
24710
- config: external_exports.object({
24711
- builtinModelIds: external_exports.array(external_exports.string()).optional(),
24712
- access: external_exports.object({ mode: external_exports.string(), accountType: external_exports.string() }).partial().optional()
24713
- })
24714
- }))
24715
- })
24716
- })
24717
- });
24718
24755
  function resolveEndpointOrigin(environment) {
24719
24756
  return environment.ZCODE_BASE_URL?.trim() || "https://zcode.z.ai";
24720
24757
  }
24721
24758
  async function readDeviceMid(installation) {
24722
24759
  try {
24723
- const file2 = path6.join(installation.dataRoot, "telemetry-state.json");
24724
- const parsed = JSON.parse(await readFile3(file2, "utf8"));
24760
+ const file2 = path7.join(installation.dataRoot, "telemetry-state.json");
24761
+ const parsed = JSON.parse(await readFile4(file2, "utf8"));
24725
24762
  return typeof parsed?.deviceMid === "string" ? parsed.deviceMid.trim() : "";
24726
24763
  } catch {
24727
24764
  return "";
@@ -24825,8 +24862,8 @@ async function queryStartPlanBalance(origin, appVersion, jwt2, deviceMid) {
24825
24862
  }
24826
24863
  async function accountConfig(installation, environment, readSystemKeyOptions) {
24827
24864
  const file2 = installation.builtinProviderConfig;
24828
- const builtin = builtinSchema.parse(JSON.parse(await readFile3(file2, "utf8")));
24829
- const basedOnZCodeBuiltinRevision = `zcode-builtin:${builtin.revision}:${createHash4("sha256").update(path6.resolve(file2)).digest("hex")}`;
24865
+ const builtin = builtinProviderConfigSchema.parse(JSON.parse(await readFile4(file2, "utf8")));
24866
+ const basedOnZCodeBuiltinRevision = `zcode-builtin:${builtin.revision}:${createHash4("sha256").update(path7.resolve(file2)).digest("hex")}`;
24830
24867
  let channel;
24831
24868
  let credentialIssue;
24832
24869
  let credentialAccessRequired = false;
@@ -26164,16 +26201,16 @@ var Diff = class {
26164
26201
  }
26165
26202
  }
26166
26203
  }
26167
- addToPath(path8, added, removed, oldPosInc, options) {
26168
- const last = path8.lastComponent;
26204
+ addToPath(path9, added, removed, oldPosInc, options) {
26205
+ const last = path9.lastComponent;
26169
26206
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
26170
26207
  return {
26171
- oldPos: path8.oldPos + oldPosInc,
26208
+ oldPos: path9.oldPos + oldPosInc,
26172
26209
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
26173
26210
  };
26174
26211
  } else {
26175
26212
  return {
26176
- oldPos: path8.oldPos + oldPosInc,
26213
+ oldPos: path9.oldPos + oldPosInc,
26177
26214
  lastComponent: { count: 1, added, removed, previousComponent: last }
26178
26215
  };
26179
26216
  }
@@ -27806,7 +27843,7 @@ var ZcodeAdapter = class {
27806
27843
  }
27807
27844
  }
27808
27845
  async inspect(input3 = {}) {
27809
- const cwd = path7.resolve(input3.cwd ?? process.cwd());
27846
+ const cwd = path8.resolve(input3.cwd ?? process.cwd());
27810
27847
  const access = input3.credentialAccess;
27811
27848
  return this.#inspect(cwd, access ? { access, requestedAt: performance.now() } : {});
27812
27849
  }
@@ -27899,7 +27936,7 @@ var ZcodeAdapter = class {
27899
27936
  let createdId;
27900
27937
  try {
27901
27938
  const prewarm = input3.kind === "create" && input3.prewarm === true;
27902
- transport = await this.#transport(path7.resolve(input3.cwd), input3.environment, prewarm ? void 0 : { access: "allow" });
27939
+ transport = await this.#transport(path8.resolve(input3.cwd), input3.environment, prewarm ? void 0 : { access: "allow" });
27903
27940
  const credentialIssue = transport.credentialIssue ?? "ZCode credential access is required";
27904
27941
  if (prewarm && transport.credentialAccessRequired)
27905
27942
  throw new ZcodeError("credentialAccessRequired", credentialIssue);
@@ -50665,20 +50665,19 @@ ${detail}` : ""}`
50665
50665
  }
50666
50666
  function appendDetails(document2, root, lines, start, open2) {
50667
50667
  let depth = 1;
50668
+ let inFence = false;
50668
50669
  let index = start + 1;
50669
50670
  const innerLines = [];
50670
50671
  while (index < lines.length && depth > 0) {
50671
50672
  const current = lines[index] ?? "";
50672
- const trimmed = current.trim();
50673
- if (DETAILS_OPEN_PATTERN.test(trimmed)) {
50674
- depth += 1;
50675
- innerLines.push(current);
50676
- } else if (DETAILS_CLOSE_PATTERN.test(trimmed)) {
50677
- depth -= 1;
50678
- if (depth > 0) innerLines.push(current);
50679
- } else {
50680
- innerLines.push(current);
50681
- }
50673
+ if (FENCE_PATTERN2.test(current)) {
50674
+ inFence = !inFence;
50675
+ } else if (!inFence) {
50676
+ const trimmed = current.trim();
50677
+ if (DETAILS_OPEN_PATTERN.test(trimmed)) depth += 1;
50678
+ else if (DETAILS_CLOSE_PATTERN.test(trimmed)) depth -= 1;
50679
+ }
50680
+ if (depth > 0) innerLines.push(current);
50682
50681
  index += 1;
50683
50682
  }
50684
50683
  let summaryText = "Details";
@@ -54638,7 +54637,7 @@ ${detail}` : ""}`
54638
54637
  panel.dataset.updateState = view;
54639
54638
  panel.replaceChildren();
54640
54639
  setManualFallback(Boolean(result.error) || actionableStatus !== null);
54641
- const inlineUpdate = !result.error && !actionableStatus && result.updateAvailable;
54640
+ const inlineUpdate = !result.error && !actionableStatus && !result.status?.serviceStopOutput && result.updateAvailable && result.installationAvailable;
54642
54641
  if (inlineUpdate) panel.dataset.inline = "";
54643
54642
  else delete panel.dataset.inline;
54644
54643
  panel.append(
@@ -56463,6 +56462,8 @@ ${detail}` : ""}`
56463
56462
 
56464
56463
  .settings-update-panel {
56465
56464
  display: grid;
56465
+ grid-template-columns: minmax(0, 1fr);
56466
+ min-width: 0;
56466
56467
  gap: 12px;
56467
56468
  padding: 20px;
56468
56469
  color: var(--settings-text);
@@ -56471,21 +56472,39 @@ ${detail}` : ""}`
56471
56472
  border-radius: 8px;
56472
56473
  }
56473
56474
 
56474
- /* Update available: status on the left, the one action on the right. */
56475
+ /* Update available: status on the left, the one action on the right; wraps cleanly on narrow screens. */
56475
56476
  .settings-update-panel[data-inline] {
56476
- grid-template-columns: minmax(0, 1fr) auto;
56477
+ display: flex;
56478
+ flex-wrap: wrap;
56477
56479
  align-items: center;
56480
+ justify-content: space-between;
56481
+ gap: 12px 16px;
56478
56482
  padding: 14px 16px;
56479
56483
  }
56480
56484
 
56485
+ .settings-update-panel[data-inline] > .settings-update-panel__head {
56486
+ flex: 1 1 180px;
56487
+ }
56488
+
56489
+ .settings-update-panel[data-inline] > .settings-update-actions {
56490
+ flex: none;
56491
+ }
56492
+
56493
+ .settings-update-panel[data-inline]
56494
+ > :not(.settings-update-panel__head):not(.settings-update-actions) {
56495
+ flex: 1 0 100%;
56496
+ min-width: 0;
56497
+ }
56498
+
56481
56499
  .settings-update-panel__head {
56482
56500
  display: flex;
56483
- align-items: center;
56501
+ align-items: flex-start;
56484
56502
  min-width: 0;
56485
56503
  gap: 8px;
56486
56504
  }
56487
56505
 
56488
56506
  .settings-update-panel__head .codexhost-settings-icon {
56507
+ margin-top: 3px;
56489
56508
  color: var(--settings-muted);
56490
56509
  }
56491
56510
 
@@ -56530,6 +56549,7 @@ ${detail}` : ""}`
56530
56549
 
56531
56550
  .settings-update-summary,
56532
56551
  .settings-update-error {
56552
+ min-width: 0;
56533
56553
  margin: 0;
56534
56554
  overflow-wrap: anywhere;
56535
56555
  font-size: 13px;
@@ -56543,6 +56563,7 @@ ${detail}` : ""}`
56543
56563
  /* Host stop output is opaque text of any width; wrap it so it cannot widen the panel. */
56544
56564
  .settings-update-service-stop-output {
56545
56565
  min-width: 0;
56566
+ max-width: 100%;
56546
56567
  margin: 0;
56547
56568
  color: var(--settings-muted);
56548
56569
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
@@ -57048,6 +57069,10 @@ ${detail}` : ""}`
57048
57069
  gap: 16px;
57049
57070
  }
57050
57071
 
57072
+ .settings-update-panel {
57073
+ padding: 16px;
57074
+ }
57075
+
57051
57076
  .settings-status-row {
57052
57077
  grid-template-columns: minmax(0, 1fr) auto;
57053
57078
  gap: 16px;