zcode-app-cli 3.3.6-3 → 3.3.6-4

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
@@ -26,11 +26,14 @@ Using `@latest` is intentional because the App-aligned release format uses a
26
26
  SemVer prerelease segment such as `3.3.5-2`. The tag always points to the
27
27
  newest validated App-plus-build release.
28
28
 
29
- Interactive startup checks the npm `latest` tag at most once every 20 hours.
29
+ Interactive startup checks the npm `latest` tag at most once every 20 hours for
30
+ each installed package version. Installing a different package build triggers
31
+ one fresh check even when an older cache entry is still within that window.
30
32
  A cached newer version is shown as a non-blocking update card with the exact
31
33
  install command and release-notes link. Missing or stale cache data is refreshed
32
- in the background for the next launch, so registry latency or failure never
33
- delays the editor. Set `ZCODE_DISABLE_UPDATE_CHECK=1` or
34
+ in the background, and a newly discovered update is shown in the current
35
+ session, so registry latency or failure never delays the editor. Set
36
+ `ZCODE_DISABLE_UPDATE_CHECK=1` or
34
37
  `NO_UPDATE_NOTIFIER=1` to disable the check; CI environments skip it
35
38
  automatically.
36
39
 
@@ -549,6 +552,14 @@ zcode --prompt "Explain this repository"
549
552
  zcode app-server
550
553
  ```
551
554
 
555
+ `zcode version`, `zcode --version` and `zcode -v` identify both packaged
556
+ layers explicitly:
557
+
558
+ ```text
559
+ zcode-app-cli 3.3.6-3
560
+ zcode-runtime 0.15.2
561
+ ```
562
+
552
563
  ## Remote extraction
553
564
 
554
565
  The same path used by CI can be run locally:
package/bin/zcode.js CHANGED
@@ -619,24 +619,44 @@ async function runZaiOAuthLogin(options) {
619
619
  //#region src/launcher.ts
620
620
  const packageRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
621
621
  const packageManifestPath = join(packageRoot, "package.json");
622
+ const extractionMetadataPath = join(packageRoot, "vendor", "extraction.json");
622
623
  const runtimePath = join(packageRoot, "vendor", "zcode.cjs");
623
624
  const launcherPath = join(packageRoot, "bin", "zcode.js");
624
625
  const defaultModelRetryMaxRetries = "5";
626
+ const versionArguments = /* @__PURE__ */ new Set([
627
+ "version",
628
+ "--version",
629
+ "-v"
630
+ ]);
625
631
  function resolveModelRetryMaxRetries(env) {
626
632
  return env.ZCODE_MODEL_RETRY_MAX_RETRIES?.trim() || defaultModelRetryMaxRetries;
627
633
  }
628
634
  function resolveNodeExecutable() {
629
635
  return process.env.ZCODE_NODE?.trim() || process.execPath;
630
636
  }
631
- function readDistributionVersion(manifestPath = packageManifestPath) {
637
+ function safeVersion(value) {
638
+ const version = typeof value === "string" ? value.trim() : "";
639
+ return /^[0-9A-Za-z][0-9A-Za-z.+-]{0,63}$/u.test(version) ? version : void 0;
640
+ }
641
+ function readJsonVersion(path, key) {
632
642
  try {
633
- const manifest = JSON.parse(readFileSync(manifestPath, "utf8"));
634
- const version = typeof manifest.version === "string" ? manifest.version.trim() : "";
635
- return /^[0-9A-Za-z][0-9A-Za-z.+-]{0,63}$/u.test(version) ? version : void 0;
643
+ return safeVersion(JSON.parse(readFileSync(path, "utf8"))[key]);
636
644
  } catch {
637
645
  return;
638
646
  }
639
647
  }
648
+ function readDistributionVersion(manifestPath = packageManifestPath) {
649
+ return readJsonVersion(manifestPath, "version");
650
+ }
651
+ function readRuntimeVersion(metadataPath = extractionMetadataPath) {
652
+ return readJsonVersion(metadataPath, "cliVersion");
653
+ }
654
+ function isVersionInvocation(args) {
655
+ return args.length === 1 && versionArguments.has(args[0]);
656
+ }
657
+ function formatVersionOutput(distributionVersion, runtimeVersion) {
658
+ return [`zcode-app-cli ${safeVersion(distributionVersion) ?? "unknown"}`, `zcode-runtime ${safeVersion(runtimeVersion) ?? "unknown"}`].join("\n");
659
+ }
640
660
  function normalizeLoginArgs(args) {
641
661
  if (args.length === 1 && args[0] === "login") return {
642
662
  args,
@@ -736,6 +756,16 @@ async function main(args) {
736
756
  console.error("ZCode runtime is missing. Reinstall the package or run `bun run sync:local` in the source checkout.");
737
757
  return 1;
738
758
  }
759
+ if (isVersionInvocation(args)) {
760
+ const distributionVersion = readDistributionVersion();
761
+ const runtimeVersion = readRuntimeVersion();
762
+ if (!distributionVersion || !runtimeVersion) {
763
+ console.error("Unable to read npm package or bundled runtime version metadata.");
764
+ return 1;
765
+ }
766
+ console.log(formatVersionOutput(distributionVersion, runtimeVersion));
767
+ return 0;
768
+ }
739
769
  try {
740
770
  await ensureUserConfig();
741
771
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zcode-app-cli",
3
- "version": "3.3.6-3",
3
+ "version": "3.3.6-4",
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.3.6",
3
3
  "cliVersion": "0.15.2",
4
- "extractedAt": "2026-07-17T03:15:27.269Z",
4
+ "extractedAt": "2026-07-17T04:19:33.517Z",
5
5
  "sha512": "NwQzSBf+Q5FR3VWwAEQUeALHR9jvDjRT7PJLVQ4iLOyTxPm7Lt8kMQbQXI7MJ/wEDQ0EK3FBBjJQVlJiC4Kgsw==",
6
6
  "source": "https://cdn-zcode.z.ai/zcode/electron/releases/3.3.6/linux-x64/ZCode-3.3.6-linux-x64.deb",
7
7
  "tui": {
@@ -276,7 +276,9 @@ function parseUpdateCache(value) {
276
276
  const cache = value;
277
277
  if (typeof cache.latestVersion !== "string" || !parseReleaseVersion(cache.latestVersion)) return void 0;
278
278
  if (typeof cache.lastCheckedAt !== "string" || !Number.isFinite(Date.parse(cache.lastCheckedAt))) return void 0;
279
+ if (cache.checkedVersion !== void 0 && (typeof cache.checkedVersion !== "string" || !parseReleaseVersion(cache.checkedVersion))) return;
279
280
  return {
281
+ checkedVersion: cache.checkedVersion,
280
282
  latestVersion: cache.latestVersion,
281
283
  lastCheckedAt: cache.lastCheckedAt
282
284
  };
@@ -295,13 +297,17 @@ async function readStartupUpdate(options) {
295
297
  const cache = await readUpdateCache(cachePath);
296
298
  const now = options.now ?? Date.now();
297
299
  const checkedAt = cache ? Date.parse(cache.lastCheckedAt) : NaN;
298
- const refreshRequired = !cache || checkedAt < now - 72e6;
300
+ const refreshRequired = !cache || cache.checkedVersion !== options.currentVersion || checkedAt < now - 72e6;
299
301
  return {
300
- availableVersion: cache && compareReleaseVersions(cache.latestVersion, options.currentVersion) > 0 ? cache.latestVersion : void 0,
302
+ availableVersion: cache ? availableUpdateVersion(options.currentVersion, cache.latestVersion) : void 0,
301
303
  cachePath,
302
304
  refreshRequired
303
305
  };
304
306
  }
307
+ function availableUpdateVersion(currentVersion, latestVersion) {
308
+ if (!parseReleaseVersion(currentVersion) || !parseReleaseVersion(latestVersion)) return void 0;
309
+ return compareReleaseVersions(latestVersion, currentVersion) > 0 ? latestVersion : void 0;
310
+ }
305
311
  async function writeUpdateCache(cachePath, cache) {
306
312
  const directory = dirname(cachePath);
307
313
  const temporaryPath = join(directory, `.version.${process.pid}.${randomUUID()}.tmp`);
@@ -341,6 +347,7 @@ async function refreshUpdateCache(options) {
341
347
  const latestVersion = typeof body === "object" && body !== null && !Array.isArray(body) ? body.version : void 0;
342
348
  if (typeof latestVersion !== "string" || !parseReleaseVersion(latestVersion)) throw new Error("npm registry returned an invalid release version.");
343
349
  await writeUpdateCache(options.cachePath, {
350
+ checkedVersion: options.currentVersion,
344
351
  latestVersion,
345
352
  lastCheckedAt: new Date(options.now ?? Date.now()).toISOString()
346
353
  });
@@ -163451,6 +163458,7 @@ const toolLifecycleEventKinds = /* @__PURE__ */ new Set([
163451
163458
  ]);
163452
163459
  const terminalThemeQueryTimeoutMs = 100;
163453
163460
  const exitUsageQueryTimeoutMs = 250;
163461
+ const updateAvailableBlockId = "update_available";
163454
163462
  function modelRetryProgress(event, phase) {
163455
163463
  const retryNumber = phase === "started" ? Math.max(1, (event.attempt ?? 2) - 1) : Math.max(1, (event.nextAttempt ?? (event.attempt ?? 1) + 1) - 1);
163456
163464
  const maxRetries = event.maxRetries ?? (event.maxAttempts !== void 0 ? Math.max(1, event.maxAttempts - 1) : void 0);
@@ -164608,8 +164616,8 @@ var ZCodeTui = class {
164608
164616
  this.ui.requestRender();
164609
164617
  }
164610
164618
  addUpdateAvailable(currentVersion, latestVersion) {
164611
- this.currentToolGroup = void 0;
164612
164619
  this.transcript.addBlock(new UpdateAvailableView(this.theme, currentVersion, latestVersion), {
164620
+ id: updateAvailableBlockId,
164613
164621
  kind: "update",
164614
164622
  searchText: `Update available: ${currentVersion} -> ${latestVersion}\n${updateCommand}`
164615
164623
  });
@@ -164617,12 +164625,17 @@ var ZCodeTui = class {
164617
164625
  }
164618
164626
  startUpdateRefresh(updateCheck) {
164619
164627
  if (!updateCheck?.refreshRequired || !this.distributionVersion) return;
164628
+ const currentVersion = this.distributionVersion;
164620
164629
  const controller = new AbortController();
164621
164630
  this.updateCheckAbortController = controller;
164622
164631
  refreshUpdateCache({
164623
164632
  cachePath: updateCheck.cachePath,
164624
- currentVersion: this.distributionVersion,
164633
+ currentVersion,
164625
164634
  signal: controller.signal
164635
+ }).then((latestVersion) => {
164636
+ const availableVersion = availableUpdateVersion(currentVersion, latestVersion);
164637
+ if (availableVersion) this.addUpdateAvailable(currentVersion, availableVersion);
164638
+ else if (updateCheck.availableVersion && this.transcript.removeBlock(updateAvailableBlockId)) this.ui.requestRender();
164626
164639
  }).catch(() => {}).finally(() => {
164627
164640
  if (this.updateCheckAbortController === controller) this.updateCheckAbortController = void 0;
164628
164641
  });