@codexhost/cli-win32-arm64 0.27.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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +369 -163
  4. package/app/console-web.js +223 -9
  5. package/app/desktop-controller.mjs +105 -4
  6. package/app/host-runtime.mjs +1938 -1024
  7. package/app/plugins/antigravity/plugin.mjs +390 -135
  8. package/app/plugins/claude-code/plugin.mjs +383 -32
  9. package/app/plugins/codebuddy/plugin.mjs +213 -30
  10. package/app/plugins/codex-usage/plugin.mjs +370 -52
  11. package/app/plugins/copilot/plugin.mjs +105 -4
  12. package/app/plugins/cursor-cli/plugin.mjs +126 -4
  13. package/app/plugins/deepseek-harness/plugin.mjs +107 -4
  14. package/app/plugins/devin/plugin.mjs +106 -4
  15. package/app/plugins/grok/plugin.mjs +186 -25
  16. package/app/plugins/hermes/plugin.mjs +107 -4
  17. package/app/plugins/kimi-code/plugin.mjs +105 -4
  18. package/app/plugins/kiro-cli/plugin.mjs +105 -4
  19. package/app/plugins/omp/plugin.mjs +261 -45
  20. package/app/plugins/opencode/plugin.mjs +107 -4
  21. package/app/plugins/pi/plugin.mjs +312 -48
  22. package/app/plugins/qoder/plugin.mjs +179 -18
  23. package/app/plugins/qoder-cn/plugin.mjs +179 -18
  24. package/app/plugins/qwen-code/plugin.mjs +105 -4
  25. package/app/plugins/workbuddy/plugin.mjs +213 -30
  26. package/app/plugins/zcode/plugin.mjs +225 -85
  27. package/app/renderer-extension.js +11973 -11468
  28. package/app/web/assets/index-BJq8mT6r.js +204 -0
  29. package/app/web/assets/index-CMDliP5b.css +1 -0
  30. package/app/web/codexhost-settings.js +110 -49
  31. package/app/web/index.html +2 -2
  32. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
  33. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  34. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  35. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +72 -72
  36. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +14 -14
  37. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  38. package/app/web/plugins/deepseek-ai__dsh-client-ui-layout/client.js +1 -1
  39. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +5 -5
  40. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.pdf.js +2 -2
  41. package/app/web/plugins/deepseek-ai__dsh-client-ui-theme/client.js +1 -1
  42. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  43. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +7 -7
  44. package/app/web-modules/server.mjs +2494 -1132
  45. package/bin/codexhost.exe +0 -0
  46. package/libexec/codexhost-node-repl.exe +0 -0
  47. package/libexec/codexhost-shell.exe +0 -0
  48. package/libexec/codexhost-shim.exe +0 -0
  49. package/libexec/codexhost-updater.exe +0 -0
  50. package/package.json +1 -1
  51. package/app/web/assets/index-D9l7_ThH.js +0 -199
  52. package/app/web/assets/index-nw2RXcDu.css +0 -1
@@ -1627,128 +1627,6 @@ import path2 from "node:path";
1627
1627
  // packages/update-manager/dist/distribution.js
1628
1628
  import path from "node:path";
1629
1629
 
1630
- // packages/update-manager/dist/status.js
1631
- var STATUS_SCHEMA_VERSION = 1;
1632
- var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
1633
- function requireSemanticVersion(value) {
1634
- if (!SEMVER_PATTERN.test(value))
1635
- throw new Error("update version must be valid semantic version");
1636
- return value;
1637
- }
1638
- function preparedStatus(version2, installation, now) {
1639
- return {
1640
- schemaVersion: STATUS_SCHEMA_VERSION,
1641
- version: version2,
1642
- installation,
1643
- phase: "prepared",
1644
- updatedAt: Math.floor(now / 1e3)
1645
- };
1646
- }
1647
- function parseUpdateStatus(value) {
1648
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
1649
- throw new Error("background update status must be an object");
1650
- }
1651
- const status = value;
1652
- const allowed = [
1653
- "downloadedBytes",
1654
- "error",
1655
- "installation",
1656
- "phase",
1657
- "schemaVersion",
1658
- "serviceStopOutput",
1659
- "totalBytes",
1660
- "updatedAt",
1661
- "version"
1662
- ];
1663
- if (Object.keys(status).some((key) => !allowed.includes(key))) {
1664
- throw new Error("background update status contains unknown fields");
1665
- }
1666
- if (status.schemaVersion !== STATUS_SCHEMA_VERSION || typeof status.version !== "string" || !SEMVER_PATTERN.test(status.version) || !["npm", "windows-installer", "macos-dmg", "linux-archive"].includes(String(status.installation)) || ![
1667
- "prepared",
1668
- "downloading",
1669
- "waiting-for-exit",
1670
- "installing",
1671
- "restarting",
1672
- "succeeded",
1673
- "failed"
1674
- ].includes(String(status.phase)) || !Number.isSafeInteger(status.updatedAt) || status.downloadedBytes !== void 0 && (typeof status.downloadedBytes !== "number" || !Number.isSafeInteger(status.downloadedBytes) || status.downloadedBytes < 0) || status.totalBytes !== void 0 && (typeof status.totalBytes !== "number" || !Number.isSafeInteger(status.totalBytes) || status.totalBytes <= 0) || typeof status.downloadedBytes === "number" && typeof status.totalBytes === "number" && status.downloadedBytes > status.totalBytes || status.error !== void 0 && typeof status.error !== "string" || status.serviceStopOutput !== void 0 && typeof status.serviceStopOutput !== "string") {
1675
- throw new Error("background update status is invalid");
1676
- }
1677
- return status;
1678
- }
1679
-
1680
- // packages/update-manager/dist/distribution.js
1681
- var UPDATE_RUNTIME_ENV = Object.freeze({
1682
- launcherPid: "CODEXHOST_LAUNCHER_PID",
1683
- launcherExecutable: "CODEXHOST_LAUNCHER_EXECUTABLE",
1684
- runtimeDescriptorPath: "CODEXHOST_RUNTIME_DESCRIPTOR_PATH",
1685
- controllerPort: "CODEXHOST_CONTROL_PORT",
1686
- controllerNonce: "CODEXHOST_CONTROL_NONCE",
1687
- npmNodePath: "CODEXHOST_NPM_NODE_PATH",
1688
- npmCliPath: "CODEXHOST_NPM_CLI_PATH",
1689
- npmLauncherPath: "CODEXHOST_NPM_LAUNCHER_PATH",
1690
- npmPackageRoot: "CODEXHOST_NPM_PACKAGE_ROOT",
1691
- serviceManaged: "CODEXHOST_UPDATE_SERVICE"
1692
- });
1693
- function object(value, label) {
1694
- if (typeof value !== "object" || value === null || Array.isArray(value)) {
1695
- throw new Error(`${label} must be an object`);
1696
- }
1697
- return value;
1698
- }
1699
- function parseDistributionMetadata(value) {
1700
- const metadata = object(value, "distribution metadata");
1701
- const allowed = ["distribution", "schemaVersion", "target", "version"];
1702
- if (Object.keys(metadata).some((key) => !allowed.includes(key))) {
1703
- throw new Error("distribution metadata contains unknown fields");
1704
- }
1705
- if (metadata.schemaVersion !== 1 || metadata.distribution !== "npm" && metadata.distribution !== "installer" || ![
1706
- "macos-arm64",
1707
- "macos-x64",
1708
- "windows-x64",
1709
- "windows-arm64",
1710
- "linux-x64",
1711
- "linux-arm64"
1712
- ].includes(String(metadata.target)) || typeof metadata.version !== "string") {
1713
- throw new Error("distribution metadata is invalid");
1714
- }
1715
- return {
1716
- schemaVersion: 1,
1717
- version: requireSemanticVersion(metadata.version),
1718
- distribution: metadata.distribution,
1719
- target: metadata.target
1720
- };
1721
- }
1722
- function defaultUpdateStateDirectory(platform = process.platform, environment = process.env) {
1723
- if (platform === "win32") {
1724
- const root = environment.LOCALAPPDATA;
1725
- if (!root || !path.isAbsolute(root))
1726
- throw new Error("LOCALAPPDATA is unavailable");
1727
- return path.join(root, "codexhost", "updates");
1728
- }
1729
- const home = environment.HOME;
1730
- if (!home || !path.isAbsolute(home))
1731
- throw new Error("HOME is unavailable");
1732
- return platform === "darwin" ? path.join(home, "Library", "Application Support", "codexhost", "updates") : path.join(home, ".codexhost", "updates");
1733
- }
1734
-
1735
- // packages/update-manager/dist/runtime-metadata.js
1736
- async function readRuntimeMetadata(entryPath2, environment = process.env) {
1737
- const directory = path2.dirname(entryPath2);
1738
- try {
1739
- return parseDistributionMetadata(JSON.parse(await readFile(path2.join(directory, "codexhost-distribution.json"), "utf8")));
1740
- } catch (error62) {
1741
- if (path2.basename(directory) !== "dist" || path2.basename(path2.resolve(directory, "../..")) !== "packages")
1742
- throw error62;
1743
- const workspace = JSON.parse(await readFile(path2.resolve(directory, "../../../package.json"), "utf8"));
1744
- if (workspace.name !== "codexhost" || typeof workspace.version !== "string")
1745
- throw error62;
1746
- const workspaceVersion = requireSemanticVersion(workspace.version);
1747
- const version2 = environment.CODEXHOST_DEV_VERSION === void 0 ? `${workspaceVersion}-dev` : requireSemanticVersion(environment.CODEXHOST_DEV_VERSION);
1748
- return { version: version2, distribution: "development" };
1749
- }
1750
- }
1751
-
1752
1630
  // node_modules/zod/v4/classic/external.js
1753
1631
  var external_exports = {};
1754
1632
  __export(external_exports, {
@@ -1943,7 +1821,7 @@ __export(external_exports, {
1943
1821
  nullable: () => nullable,
1944
1822
  nullish: () => nullish2,
1945
1823
  number: () => number2,
1946
- object: () => object2,
1824
+ object: () => object,
1947
1825
  optional: () => optional,
1948
1826
  output: () => output,
1949
1827
  overwrite: () => _overwrite,
@@ -18863,7 +18741,7 @@ __export(schemas_exports2, {
18863
18741
  nullable: () => nullable,
18864
18742
  nullish: () => nullish2,
18865
18743
  number: () => number2,
18866
- object: () => object2,
18744
+ object: () => object,
18867
18745
  optional: () => optional,
18868
18746
  partialRecord: () => partialRecord,
18869
18747
  pipe: () => pipe,
@@ -19857,7 +19735,7 @@ var ZodObject = /* @__PURE__ */ $constructor("ZodObject", (inst, def) => {
19857
19735
  return util_exports.required(ZodNonOptional, this, args[0]);
19858
19736
  }
19859
19737
  });
19860
- function object2(shape, params) {
19738
+ function object(shape, params) {
19861
19739
  const def = {
19862
19740
  type: "object",
19863
19741
  shape: shape ?? {},
@@ -21864,11 +21742,21 @@ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionS
21864
21742
  ids.add(option.id);
21865
21743
  }
21866
21744
  });
21745
+ var harnessThinkingOptionsScopeSchema = external_exports.enum(["catalog", "activeModel"]);
21867
21746
  var harnessModelCatalogSchema = external_exports.object({
21868
21747
  models: external_exports.array(harnessModelSchema),
21869
21748
  defaultModel: harnessModelRefSchema.optional(),
21870
21749
  thinkingOptions: harnessThinkingOptionsSchema,
21871
- defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
21750
+ defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
21751
+ /**
21752
+ * Scope of per-Model `supportedThinkingOptionIds` in this catalog.
21753
+ * Omitted or `"catalog"` means each Model's `supportedThinkingOptionIds`
21754
+ * reflects its own options (omitted or `[]` means none).
21755
+ * `"activeModel"` means only the active Model's Thinking options were
21756
+ * observed; other Models omit `supportedThinkingOptionIds` and must be
21757
+ * validated by the Adapter after selecting the Model.
21758
+ */
21759
+ thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
21872
21760
  }).strict().superRefine((catalog, context) => {
21873
21761
  const refs = [];
21874
21762
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
@@ -22847,7 +22735,12 @@ var clientProjectlessWorkspaceSchema = external_exports.object({
22847
22735
  prompt: external_exports.string().max(16384).optional()
22848
22736
  }).strict();
22849
22737
  var clientWorkspaceSnapshotSchema = external_exports.object({
22850
- projects: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), rootPaths: external_exports.array(external_exports.string()) })),
22738
+ projects: external_exports.array(external_exports.object({
22739
+ id: external_exports.string(),
22740
+ name: external_exports.string(),
22741
+ rootPaths: external_exports.array(external_exports.string()),
22742
+ createdAt: external_exports.number().int().optional()
22743
+ })),
22851
22744
  nativeProjects: external_exports.literal(true).optional(),
22852
22745
  assignments: external_exports.record(external_exports.string(), external_exports.string()),
22853
22746
  projectless: external_exports.array(external_exports.string()),
@@ -23260,6 +23153,7 @@ var delegationReadParamsSchema = external_exports.strictObject({
23260
23153
  // packages/shared-contracts/dist/remote-peers.js
23261
23154
  var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
23262
23155
  var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
23156
+ var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
23263
23157
  var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
23264
23158
  var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
23265
23159
  var REMOTE_PEER_COLORS = [
@@ -23283,6 +23177,7 @@ var remotePeerStateSchema = external_exports.enum([
23283
23177
  var remotePeerSummarySchema = external_exports.object({
23284
23178
  peerId: remotePeerIdSchema,
23285
23179
  hostId: remotePeerHostIdSchema,
23180
+ nodeId: remotePeerNodeIdSchema.optional(),
23286
23181
  name: external_exports.string().min(1).max(120),
23287
23182
  color: remotePeerColorSchema.optional(),
23288
23183
  origin: external_exports.string().min(1).max(2048),
@@ -23290,6 +23185,11 @@ var remotePeerSummarySchema = external_exports.object({
23290
23185
  encrypted: external_exports.boolean(),
23291
23186
  enabled: external_exports.boolean(),
23292
23187
  state: remotePeerStateSchema,
23188
+ supportsPeerPairing: external_exports.boolean().optional(),
23189
+ /** Omitted when either side's node mapping is unknown. */
23190
+ pairedBack: external_exports.boolean().optional(),
23191
+ /** Other configured remote peerIds on this Hub present in this peer's `manifest.peerNodes`. */
23192
+ linkedPeerIds: external_exports.array(remotePeerIdSchema).max(128).optional(),
23293
23193
  latencyMs: external_exports.number().int().nonnegative().optional(),
23294
23194
  version: external_exports.string().max(128).optional(),
23295
23195
  platform: external_exports.string().max(64).optional(),
@@ -23308,8 +23208,48 @@ var remotePeerAddParamsSchema = external_exports.object({
23308
23208
  origin: external_exports.string().min(1).max(2048).optional(),
23309
23209
  token: external_exports.string().min(1).max(2048).optional(),
23310
23210
  name: external_exports.string().trim().min(1).max(120).optional(),
23311
- color: remotePeerColorSchema.optional()
23211
+ color: remotePeerColorSchema.optional(),
23212
+ pairBack: external_exports.boolean().optional(),
23213
+ meshPeerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
23214
+ selfOrigin: external_exports.string().min(1).max(2048).optional()
23312
23215
  }).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
23216
+ var remotePeerIntroduceParamsSchema = external_exports.strictObject({
23217
+ origin: external_exports.string().min(1).max(2048),
23218
+ token: external_exports.string().min(1).max(2048),
23219
+ name: external_exports.string().trim().min(1).max(120).optional(),
23220
+ color: remotePeerColorSchema.optional(),
23221
+ expectedNodeId: remotePeerNodeIdSchema.optional()
23222
+ });
23223
+ var remotePeerIntroduceResultSchema = external_exports.object({
23224
+ status: external_exports.enum(["added", "updated", "existing"]),
23225
+ peerId: remotePeerIdSchema,
23226
+ hostId: remotePeerHostIdSchema,
23227
+ nodeId: remotePeerNodeIdSchema.optional()
23228
+ });
23229
+ var remotePeerPairingStatusSchema = external_exports.enum([
23230
+ "added",
23231
+ "updated",
23232
+ "existing",
23233
+ "failed",
23234
+ "skipped"
23235
+ ]);
23236
+ var remotePeerPairingStepSchema = external_exports.object({
23237
+ targetPeerId: remotePeerIdSchema,
23238
+ targetName: external_exports.string().min(1).max(120),
23239
+ introducedHost: external_exports.union([external_exports.literal("local"), remotePeerIdSchema]),
23240
+ introducedName: external_exports.string().min(1).max(120),
23241
+ status: remotePeerPairingStatusSchema,
23242
+ error: external_exports.string().max(1e3).optional()
23243
+ });
23244
+ var remotePeerPairingReportSchema = external_exports.object({
23245
+ results: external_exports.array(remotePeerPairingStepSchema)
23246
+ });
23247
+ var remotePeerSyncMeshParamsSchema = external_exports.object({
23248
+ peerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
23249
+ includeSelf: external_exports.boolean().optional(),
23250
+ includeMesh: external_exports.boolean().optional(),
23251
+ selfOrigin: external_exports.string().min(1).max(2048).optional()
23252
+ });
23313
23253
  var remotePeerUpdateParamsSchema = external_exports.object({
23314
23254
  peerId: remotePeerIdSchema,
23315
23255
  name: external_exports.string().trim().min(1).max(120).optional(),
@@ -23338,6 +23278,9 @@ var remotePeerTestProjectSchema = external_exports.object({
23338
23278
  });
23339
23279
  var remotePeerTestResultSchema = external_exports.object({
23340
23280
  ok: external_exports.boolean(),
23281
+ nodeId: remotePeerNodeIdSchema.optional(),
23282
+ supportsPeerPairing: external_exports.boolean().optional(),
23283
+ pairedBack: external_exports.boolean().optional(),
23341
23284
  latencyMs: external_exports.number().int().nonnegative().optional(),
23342
23285
  origin: external_exports.string().max(2048).optional(),
23343
23286
  transportKind: remotePeerTransportKindSchema.optional(),
@@ -23364,7 +23307,9 @@ var remotePeerCapabilitiesSchema = external_exports.object({
23364
23307
  /** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
23365
23308
  officePreview: external_exports.literal(1).optional(),
23366
23309
  /** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
23367
- delegation: external_exports.literal(1).optional()
23310
+ delegation: external_exports.literal(1).optional(),
23311
+ /** POST /api/peer/v1/peers is available. */
23312
+ peerPairing: external_exports.literal(1).optional()
23368
23313
  });
23369
23314
  var remotePeerManifestSchema = external_exports.object({
23370
23315
  version: external_exports.string().max(128),
@@ -23372,6 +23317,8 @@ var remotePeerManifestSchema = external_exports.object({
23372
23317
  hostname: external_exports.string().max(255),
23373
23318
  homeDir: external_exports.string().max(4096).optional(),
23374
23319
  epoch: external_exports.string().min(1).max(256),
23320
+ nodeId: remotePeerNodeIdSchema.optional(),
23321
+ peerNodes: external_exports.record(remotePeerHostIdSchema, remotePeerNodeIdSchema).refine((v) => Object.keys(v).length <= 128).optional(),
23375
23322
  projects: external_exports.array(remotePeerManifestProjectSchema),
23376
23323
  capabilities: remotePeerCapabilitiesSchema.optional()
23377
23324
  });
@@ -23458,6 +23405,29 @@ var remotePeerWorkspaceMutationResultSchema = external_exports.object({
23458
23405
  workspaceId: external_exports.string().min(1).max(1024).optional(),
23459
23406
  manifest: remotePeerManifestSchema
23460
23407
  });
23408
+ var delegationRemoteHostsParamsSchema = external_exports.object({
23409
+ sessionHostId: external_exports.string().min(1).max(128).optional()
23410
+ });
23411
+ var delegationRemoteHostOptionSchema = external_exports.object({
23412
+ hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema]),
23413
+ name: external_exports.string().min(1).max(120),
23414
+ isLocal: external_exports.boolean().optional(),
23415
+ color: remotePeerColorSchema.optional(),
23416
+ hostname: external_exports.string().max(255).optional()
23417
+ });
23418
+ var delegationRemoteHostsResultSchema = external_exports.object({
23419
+ hosts: external_exports.array(delegationRemoteHostOptionSchema)
23420
+ });
23421
+ var delegationHostHarnessesParamsSchema = external_exports.object({
23422
+ hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema])
23423
+ });
23424
+ var delegationHostHarnessOptionSchema = external_exports.object({
23425
+ id: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/u),
23426
+ name: external_exports.string().min(1).max(120)
23427
+ });
23428
+ var delegationHostHarnessesResultSchema = external_exports.object({
23429
+ harnesses: external_exports.array(delegationHostHarnessOptionSchema)
23430
+ });
23461
23431
 
23462
23432
  // packages/shared-contracts/dist/peer-delegation.js
23463
23433
  var PEER_DELEGATION_BRIDGE_VERSION = 1;
@@ -23501,6 +23471,7 @@ var peerDelegationHostProjectSchema = external_exports.strictObject({
23501
23471
  });
23502
23472
  var peerDelegationHostSummarySchema = external_exports.strictObject({
23503
23473
  hostId: remotePeerHostIdSchema,
23474
+ nodeId: remotePeerNodeIdSchema.optional(),
23504
23475
  displayName: external_exports.string().min(1).max(120),
23505
23476
  online: external_exports.boolean(),
23506
23477
  state: remotePeerStateSchema,
@@ -24401,6 +24372,13 @@ var updatePhaseSchema = external_exports.enum([
24401
24372
  "succeeded",
24402
24373
  "failed"
24403
24374
  ]);
24375
+ var npmDownloadProgressSchema = external_exports.strictObject({
24376
+ completed: external_exports.number().int().nonnegative(),
24377
+ total: external_exports.number().int().positive()
24378
+ }).refine((progress) => progress.completed <= progress.total, {
24379
+ path: ["completed"],
24380
+ message: "completed must not exceed total"
24381
+ });
24404
24382
  var updateStatusSchema = external_exports.strictObject({
24405
24383
  version: updateSemanticVersionSchema,
24406
24384
  installation: updateInstallationSchema,
@@ -24408,6 +24386,7 @@ var updateStatusSchema = external_exports.strictObject({
24408
24386
  updatedAt: external_exports.number().int().nonnegative(),
24409
24387
  downloadedBytes: external_exports.number().int().nonnegative().optional(),
24410
24388
  totalBytes: external_exports.number().int().positive().optional(),
24389
+ npmDownload: npmDownloadProgressSchema.optional(),
24411
24390
  error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
24412
24391
  serviceStopOutput: external_exports.string().optional()
24413
24392
  }).superRefine((status, context) => {
@@ -24745,6 +24724,120 @@ var webUiExtensionRemoveSchema = external_exports.object({ id: webUiExtensionIdS
24745
24724
  // packages/shared-contracts/dist/index.js
24746
24725
  var workspaceContractVersionSchema = external_exports.literal(WORKSPACE_CONTRACT_VERSION);
24747
24726
 
24727
+ // packages/update-manager/dist/status.js
24728
+ var STATUS_SCHEMA_VERSION = 1;
24729
+ var SEMVER_PATTERN = /^\d+\.\d+\.\d+(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?$/u;
24730
+ function requireSemanticVersion(value) {
24731
+ if (!SEMVER_PATTERN.test(value))
24732
+ throw new Error("update version must be valid semantic version");
24733
+ return value;
24734
+ }
24735
+ function parseUpdateStatus(value) {
24736
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
24737
+ throw new Error("background update status must be an object");
24738
+ }
24739
+ const status = value;
24740
+ const allowed = [
24741
+ "downloadedBytes",
24742
+ "error",
24743
+ "installation",
24744
+ "npmDownload",
24745
+ "phase",
24746
+ "schemaVersion",
24747
+ "serviceStopOutput",
24748
+ "totalBytes",
24749
+ "updatedAt",
24750
+ "version"
24751
+ ];
24752
+ if (Object.keys(status).some((key) => !allowed.includes(key))) {
24753
+ throw new Error("background update status contains unknown fields");
24754
+ }
24755
+ if (status.schemaVersion !== STATUS_SCHEMA_VERSION || typeof status.version !== "string" || !SEMVER_PATTERN.test(status.version) || !["npm", "windows-installer", "macos-dmg", "linux-archive"].includes(String(status.installation)) || ![
24756
+ "prepared",
24757
+ "downloading",
24758
+ "waiting-for-exit",
24759
+ "installing",
24760
+ "restarting",
24761
+ "succeeded",
24762
+ "failed"
24763
+ ].includes(String(status.phase)) || !Number.isSafeInteger(status.updatedAt) || status.downloadedBytes !== void 0 && (typeof status.downloadedBytes !== "number" || !Number.isSafeInteger(status.downloadedBytes) || status.downloadedBytes < 0) || status.totalBytes !== void 0 && (typeof status.totalBytes !== "number" || !Number.isSafeInteger(status.totalBytes) || status.totalBytes <= 0) || typeof status.downloadedBytes === "number" && typeof status.totalBytes === "number" && status.downloadedBytes > status.totalBytes || status.npmDownload !== void 0 && !npmDownloadProgressSchema.safeParse(status.npmDownload).success || status.error !== void 0 && typeof status.error !== "string" || status.serviceStopOutput !== void 0 && typeof status.serviceStopOutput !== "string") {
24764
+ throw new Error("background update status is invalid");
24765
+ }
24766
+ return status;
24767
+ }
24768
+
24769
+ // packages/update-manager/dist/distribution.js
24770
+ var UPDATE_RUNTIME_ENV = Object.freeze({
24771
+ launcherPid: "CODEXHOST_LAUNCHER_PID",
24772
+ launcherExecutable: "CODEXHOST_LAUNCHER_EXECUTABLE",
24773
+ runtimeDescriptorPath: "CODEXHOST_RUNTIME_DESCRIPTOR_PATH",
24774
+ controllerPort: "CODEXHOST_CONTROL_PORT",
24775
+ controllerNonce: "CODEXHOST_CONTROL_NONCE",
24776
+ npmNodePath: "CODEXHOST_NPM_NODE_PATH",
24777
+ npmCliPath: "CODEXHOST_NPM_CLI_PATH",
24778
+ npmLauncherPath: "CODEXHOST_NPM_LAUNCHER_PATH",
24779
+ npmPackageRoot: "CODEXHOST_NPM_PACKAGE_ROOT",
24780
+ serviceManaged: "CODEXHOST_UPDATE_SERVICE"
24781
+ });
24782
+ function object2(value, label) {
24783
+ if (typeof value !== "object" || value === null || Array.isArray(value)) {
24784
+ throw new Error(`${label} must be an object`);
24785
+ }
24786
+ return value;
24787
+ }
24788
+ function parseDistributionMetadata(value) {
24789
+ const metadata = object2(value, "distribution metadata");
24790
+ const allowed = ["distribution", "schemaVersion", "target", "version"];
24791
+ if (Object.keys(metadata).some((key) => !allowed.includes(key))) {
24792
+ throw new Error("distribution metadata contains unknown fields");
24793
+ }
24794
+ if (metadata.schemaVersion !== 1 || metadata.distribution !== "npm" && metadata.distribution !== "installer" || ![
24795
+ "macos-arm64",
24796
+ "macos-x64",
24797
+ "windows-x64",
24798
+ "windows-arm64",
24799
+ "linux-x64",
24800
+ "linux-arm64"
24801
+ ].includes(String(metadata.target)) || typeof metadata.version !== "string") {
24802
+ throw new Error("distribution metadata is invalid");
24803
+ }
24804
+ return {
24805
+ schemaVersion: 1,
24806
+ version: requireSemanticVersion(metadata.version),
24807
+ distribution: metadata.distribution,
24808
+ target: metadata.target
24809
+ };
24810
+ }
24811
+ function defaultUpdateStateDirectory(platform = process.platform, environment = process.env) {
24812
+ if (platform === "win32") {
24813
+ const root = environment.LOCALAPPDATA;
24814
+ if (!root || !path.isAbsolute(root))
24815
+ throw new Error("LOCALAPPDATA is unavailable");
24816
+ return path.join(root, "codexhost", "updates");
24817
+ }
24818
+ const home = environment.HOME;
24819
+ if (!home || !path.isAbsolute(home))
24820
+ throw new Error("HOME is unavailable");
24821
+ return platform === "darwin" ? path.join(home, "Library", "Application Support", "codexhost", "updates") : path.join(home, ".codexhost", "updates");
24822
+ }
24823
+
24824
+ // packages/update-manager/dist/runtime-metadata.js
24825
+ async function readRuntimeMetadata(entryPath2, environment = process.env) {
24826
+ const directory = path2.dirname(entryPath2);
24827
+ try {
24828
+ return parseDistributionMetadata(JSON.parse(await readFile(path2.join(directory, "codexhost-distribution.json"), "utf8")));
24829
+ } catch (error62) {
24830
+ if (path2.basename(directory) !== "dist" || path2.basename(path2.resolve(directory, "../..")) !== "packages")
24831
+ throw error62;
24832
+ const workspace = JSON.parse(await readFile(path2.resolve(directory, "../../../package.json"), "utf8"));
24833
+ if (workspace.name !== "codexhost" || typeof workspace.version !== "string")
24834
+ throw error62;
24835
+ const workspaceVersion = requireSemanticVersion(workspace.version);
24836
+ const version2 = environment.CODEXHOST_DEV_VERSION === void 0 ? `${workspaceVersion}-dev` : requireSemanticVersion(environment.CODEXHOST_DEV_VERSION);
24837
+ return { version: version2, distribution: "development" };
24838
+ }
24839
+ }
24840
+
24748
24841
  // packages/update-manager/dist/release-announcement.js
24749
24842
  var graphemes = new Intl.Segmenter();
24750
24843
 
@@ -24927,13 +25020,37 @@ async function releaseInstallable(target2, run2) {
24927
25020
  }
24928
25021
  return true;
24929
25022
  }
24930
- async function prefetchNpmRelease(target2, run2 = runNpmCommand) {
24931
- const result = await run2(target2, ["cache", "add", ...npmReleasePackages(target2.packageRoot, target2.version)], PREFETCH_TIMEOUT_MS);
24932
- if (result.code === 0)
24933
- return;
24934
- if (missingFromRegistry(result))
24935
- throw new Error(`npm registry does not have codexhost ${target2.version} yet; retry later`);
24936
- throw new Error(`npm could not download the update: ${firstErrorLine(result)}`);
25023
+ async function prefetchNpmRelease(target2, run2 = runNpmCommand, onProgress) {
25024
+ const specs = npmReleasePackages(target2.packageRoot, target2.version);
25025
+ const deadline = Date.now() + PREFETCH_TIMEOUT_MS;
25026
+ await onProgress?.({ completed: 0, total: specs.length });
25027
+ for (const [index, spec] of specs.entries()) {
25028
+ const remaining = deadline - Date.now();
25029
+ if (remaining <= 0)
25030
+ throw new Error("npm update download timed out");
25031
+ const result = await run2(target2, ["cache", "add", spec], remaining);
25032
+ if (missingFromRegistry(result) && result.code !== 0)
25033
+ throw new Error(`npm registry does not have codexhost ${target2.version} yet; retry later`);
25034
+ if (result.code !== 0)
25035
+ throw new Error(`npm could not download the update: ${firstErrorLine(result)}`);
25036
+ await onProgress?.({ completed: index + 1, total: specs.length });
25037
+ }
25038
+ }
25039
+ async function fetchLatestNpmRelease(nodePath, npmCliPath, run2 = runNpmCommand) {
25040
+ const result = await run2({ nodePath, npmCliPath, packageRoot: "", version: "" }, ["view", CLI_PACKAGE, "dist-tags.latest"], VIEW_TIMEOUT_MS);
25041
+ if (result.code !== 0)
25042
+ return null;
25043
+ try {
25044
+ const version2 = requireSemanticVersion(result.stdout.trim());
25045
+ return Object.freeze({
25046
+ version: version2,
25047
+ releaseNotes: null,
25048
+ releaseNotesUrl: "",
25049
+ assets: Object.freeze([])
25050
+ });
25051
+ } catch {
25052
+ return null;
25053
+ }
24937
25054
  }
24938
25055
  function createNpmReleaseAvailability(run2 = runNpmCommand, now = Date.now) {
24939
25056
  const answers = /* @__PURE__ */ new Map();
@@ -25438,7 +25555,7 @@ function createBackgroundUpdateManager(dependencies = {}) {
25438
25555
  const randomId = dependencies.randomId ?? randomUUID2;
25439
25556
  const download2 = dependencies.download ?? downloadArtifact;
25440
25557
  const spawnUpdater = dependencies.spawnUpdater ?? defaultSpawnUpdater;
25441
- const prefetchNpm = dependencies.prefetchNpm ?? ((target2) => prefetchNpmRelease(target2));
25558
+ const prefetchNpm = dependencies.prefetchNpm ?? ((target2, onProgress) => prefetchNpmRelease(target2, void 0, onProgress));
25442
25559
  const now = dependencies.now ?? Date.now;
25443
25560
  const preparedRequests = /* @__PURE__ */ new Set();
25444
25561
  async function writeStatusSnapshot(statusPath, status) {
@@ -25516,7 +25633,7 @@ function createBackgroundUpdateManager(dependencies = {}) {
25516
25633
  await chmod(helperPath, 448);
25517
25634
  const requestPath = path6.join(workDirectory, "request-v1.json");
25518
25635
  const statusPath = path6.join(workDirectory, "status-v1.json");
25519
- await writePrivateJson(statusPath, preparedStatus(version2, installation, now()));
25636
+ await writePrivateJson(statusPath, statusSnapshot(version2, installation, "downloading"));
25520
25637
  await options.onPrepared?.({ version: version2, installation, statusPath });
25521
25638
  return {
25522
25639
  version: version2,
@@ -25533,11 +25650,12 @@ function createBackgroundUpdateManager(dependencies = {}) {
25533
25650
  };
25534
25651
  }
25535
25652
  async function prepareArtifact(common, installation, sourceValue, fileName) {
25536
- const source = validateArtifact(sourceValue);
25537
25653
  const temporaryPath = path6.join(common.workDirectory, `.${fileName}.download`);
25538
25654
  const artifactPath = path6.join(common.workDirectory, fileName);
25539
- const progress = progressReporter(common.statusPath, common.version, installation, source.size);
25655
+ let progress;
25540
25656
  try {
25657
+ const source = validateArtifact(sourceValue);
25658
+ progress = progressReporter(common.statusPath, common.version, installation, source.size);
25541
25659
  const result = await download2(source, temporaryPath, progress.update);
25542
25660
  progress.update({ downloadedBytes: result.bytes, totalBytes: source.size });
25543
25661
  await progress.flush();
@@ -25550,7 +25668,7 @@ function createBackgroundUpdateManager(dependencies = {}) {
25550
25668
  return { source, artifactPath };
25551
25669
  } catch (error62) {
25552
25670
  await rm2(temporaryPath, { force: true });
25553
- await progress.flush();
25671
+ await progress?.flush();
25554
25672
  await writeFailedStatus(common.statusPath, common.version, installation, error62);
25555
25673
  throw error62;
25556
25674
  }
@@ -25568,8 +25686,13 @@ function createBackgroundUpdateManager(dependencies = {}) {
25568
25686
  ...common.dataDirectory ? { data_directory: common.dataDirectory } : {},
25569
25687
  installation
25570
25688
  };
25571
- await writePrivateJson(common.requestPath, request);
25572
- await writeStatusSnapshot(common.statusPath, statusSnapshot(common.version, installation.kind, "prepared"));
25689
+ try {
25690
+ await writePrivateJson(common.requestPath, request);
25691
+ await writeStatusSnapshot(common.statusPath, statusSnapshot(common.version, installation.kind, "prepared"));
25692
+ } catch (error62) {
25693
+ await writeFailedStatus(common.statusPath, common.version, installation.kind, error62);
25694
+ throw error62;
25695
+ }
25573
25696
  preparedRequests.add(common.requestPath);
25574
25697
  return Object.freeze({
25575
25698
  version: common.version,
@@ -25587,8 +25710,10 @@ function createBackgroundUpdateManager(dependencies = {}) {
25587
25710
  const nodePath = await requireRegularFile(options.nodePath, "npm Node.js executable");
25588
25711
  const npmCliPath = await requireRegularFile(options.npmCliPath, "npm CLI");
25589
25712
  const packageRoot = requireAbsolutePath(options.packageRoot, "npm platform package root");
25590
- await writeStatusSnapshot(common.statusPath, statusSnapshot(common.version, "npm", "downloading"));
25591
- await prefetchNpm({ nodePath, npmCliPath, packageRoot, version: common.version });
25713
+ await prefetchNpm({ nodePath, npmCliPath, packageRoot, version: common.version }, (npmDownload) => writeStatusSnapshot(common.statusPath, {
25714
+ ...statusSnapshot(common.version, "npm", "downloading"),
25715
+ npmDownload
25716
+ }).catch(() => void 0));
25592
25717
  return await finalize2(common, {
25593
25718
  kind: "npm",
25594
25719
  node_path: nodePath,
@@ -25604,23 +25729,24 @@ function createBackgroundUpdateManager(dependencies = {}) {
25604
25729
  async prepareWindowsInstaller(options) {
25605
25730
  if (platform !== "win32")
25606
25731
  throw new Error("Windows installer updates require Windows");
25732
+ const installRoot = requireAbsolutePath(options.installRoot, "Windows install root");
25607
25733
  const common = await prepareCommon(options, "windows-installer");
25608
25734
  const artifact = await prepareArtifact(common, "windows-installer", options.artifact, "update.exe");
25609
25735
  return finalize2(common, {
25610
25736
  kind: "windows-installer",
25611
25737
  installer_path: artifact.artifactPath,
25612
25738
  artifact_sha256: artifact.source.sha256,
25613
- install_root: requireAbsolutePath(options.installRoot, "Windows install root")
25739
+ install_root: installRoot
25614
25740
  }, artifact.artifactPath);
25615
25741
  },
25616
25742
  async prepareMacOsDmg(options) {
25617
25743
  if (platform !== "darwin")
25618
25744
  throw new Error("macOS DMG updates require macOS");
25619
- const common = await prepareCommon(options, "macos-dmg");
25620
25745
  const appPath = requireAbsolutePath(options.appPath, "macOS application path");
25621
25746
  if (path6.extname(appPath) !== ".app") {
25622
25747
  throw new Error("macOS application path must end in .app");
25623
25748
  }
25749
+ const common = await prepareCommon(options, "macos-dmg");
25624
25750
  const artifact = await prepareArtifact(common, "macos-dmg", options.artifact, "update.dmg");
25625
25751
  return finalize2(common, {
25626
25752
  kind: "macos-dmg",
@@ -25632,13 +25758,14 @@ function createBackgroundUpdateManager(dependencies = {}) {
25632
25758
  async prepareLinuxArchive(options) {
25633
25759
  if (platform !== "linux")
25634
25760
  throw new Error("Linux archive updates require Linux");
25761
+ const installRoot = requireAbsolutePath(options.installRoot, "Linux install root");
25635
25762
  const common = await prepareCommon(options, "linux-archive");
25636
25763
  const artifact = await prepareArtifact(common, "linux-archive", options.artifact, "update.tar.gz");
25637
25764
  return finalize2(common, {
25638
25765
  kind: "linux-archive",
25639
25766
  archive_path: artifact.artifactPath,
25640
25767
  artifact_sha256: artifact.source.sha256,
25641
- install_root: requireAbsolutePath(options.installRoot, "Linux install root")
25768
+ install_root: installRoot
25642
25769
  }, artifact.artifactPath);
25643
25770
  },
25644
25771
  async start(prepared, transferOwnership) {
@@ -27270,6 +27397,7 @@ function publicStatus(status) {
27270
27397
  updatedAt: status.updatedAt,
27271
27398
  ...status.downloadedBytes === void 0 ? {} : { downloadedBytes: status.downloadedBytes },
27272
27399
  ...status.totalBytes === void 0 ? {} : { totalBytes: status.totalBytes },
27400
+ ...status.npmDownload === void 0 ? {} : { npmDownload: status.npmDownload },
27273
27401
  error: status.error?.slice(0, ERROR_MAX_LENGTH) ?? null,
27274
27402
  ...status.serviceStopOutput === void 0 ? {} : { serviceStopOutput: status.serviceStopOutput }
27275
27403
  };
@@ -27308,6 +27436,15 @@ function createConsoleUpdates(options) {
27308
27436
  });
27309
27437
  let candidate = null;
27310
27438
  let handedOff = false;
27439
+ const npmFallbackRelease = async (metadata, error62) => {
27440
+ if (!metadata || installationKind(metadata) !== "npm") throw error62;
27441
+ const fallback = await fetchLatestNpmRelease(
27442
+ absoluteEnvironmentPath(environment, "CODEXHOST_NPM_NODE_PATH"),
27443
+ absoluteEnvironmentPath(environment, "CODEXHOST_NPM_CLI_PATH")
27444
+ );
27445
+ if (!fallback) throw error62;
27446
+ return fallback;
27447
+ };
27311
27448
  let currentStatusPath = null;
27312
27449
  async function latestStatus() {
27313
27450
  if (!currentStatusPath) {
@@ -27414,7 +27551,9 @@ function createConsoleUpdates(options) {
27414
27551
  await recoverUpdateOperationLock(stateDirectory());
27415
27552
  await cleanupTerminalUpdateState(stateDirectory());
27416
27553
  status = await latestStatus();
27417
- const release = await fetchLatest(signal);
27554
+ const release = await fetchLatest(signal).catch(
27555
+ (error63) => npmFallbackRelease(metadata, error63)
27556
+ );
27418
27557
  candidate = release;
27419
27558
  const updateAvailable = compareSemanticVersions(metadata.version, release.version) < 0;
27420
27559
  const { available: installationAvailable, error: error62 } = updateAvailable ? await installable(metadata, target2, release) : { available: false, error: null };
@@ -27460,7 +27599,7 @@ function createConsoleUpdates(options) {
27460
27599
  }
27461
27600
  currentStatusPath = null;
27462
27601
  try {
27463
- const release = await fetchLatest();
27602
+ const release = await fetchLatest().catch((error62) => npmFallbackRelease(metadata, error62));
27464
27603
  if (compareSemanticVersions(metadata.version, release.version) >= 0 || candidate && candidate.version !== release.version) {
27465
27604
  throw new ConsoleUpdateError(
27466
27605
  "stale",
@@ -28178,7 +28317,22 @@ async function openConsole(options) {
28178
28317
  }
28179
28318
 
28180
28319
  // packages/console-server/src/update-cli.ts
28181
- async function runUpdateCommand(target2, updates, write = console.log) {
28320
+ import { setTimeout as delay4 } from "node:timers/promises";
28321
+ var POLL_INTERVAL_MS = 500;
28322
+ var DOWNLOAD_IDLE_TIMEOUT_MS = 15 * 6e4;
28323
+ function downloadMessage(status) {
28324
+ const prefix = "Downloading update...";
28325
+ if (status.npmDownload) {
28326
+ return `${prefix} ${status.npmDownload.completed}/${status.npmDownload.total} npm packages ready`;
28327
+ }
28328
+ if (status.downloadedBytes === void 0) return prefix;
28329
+ const mib = (bytes) => `${(bytes / (1024 * 1024)).toFixed(1)} MiB`;
28330
+ const downloaded = mib(status.downloadedBytes);
28331
+ if (status.totalBytes === void 0) return `${prefix} ${downloaded}`;
28332
+ const percent = Math.floor(status.downloadedBytes / status.totalBytes * 100);
28333
+ return `${prefix} ${percent}% (${downloaded} / ${mib(status.totalBytes)})`;
28334
+ }
28335
+ async function runUpdateCommand(target2, updates, write = (message) => console.log(message)) {
28182
28336
  write("Checking for codexhost updates...");
28183
28337
  const checked = await updates.check(target2);
28184
28338
  if (checked.error) throw new Error(checked.error);
@@ -28192,8 +28346,37 @@ async function runUpdateCommand(target2, updates, write = console.log) {
28192
28346
  );
28193
28347
  }
28194
28348
  write(`Updating codexhost ${checked.currentVersion} → ${checked.latestVersion}...`);
28195
- const { status } = await updates.start(target2);
28349
+ let lastProgress;
28350
+ const report = (status2) => {
28351
+ if (status2?.phase !== "downloading" || status2.version !== checked.latestVersion) return;
28352
+ const message = downloadMessage(status2);
28353
+ if (message === lastProgress) return;
28354
+ lastProgress = message;
28355
+ write(message, true);
28356
+ };
28357
+ const starting = updates.start(target2).then(({ status: status2 }) => status2);
28358
+ const startOrPoll = () => Promise.race([starting, delay4(POLL_INTERVAL_MS, null, { ref: false })]);
28359
+ let status = await startOrPoll();
28360
+ while (status === null) {
28361
+ report((await updates.status()).status);
28362
+ status = await startOrPoll();
28363
+ }
28364
+ const waitingSince = Date.now();
28365
+ while (status.phase === "downloading") {
28366
+ report(status);
28367
+ if (Date.now() - Math.max(waitingSince, status.updatedAt * 1e3) >= DOWNLOAD_IDLE_TIMEOUT_MS)
28368
+ throw new Error("Timed out waiting for download progress");
28369
+ await delay4(POLL_INTERVAL_MS);
28370
+ const current = (await updates.status()).status;
28371
+ if (current?.version === status.version && current.installation === status.installation)
28372
+ status = current;
28373
+ }
28196
28374
  if (status.phase === "failed") throw new Error(status.error ?? "Update failed");
28375
+ if (lastProgress) write("Download complete.");
28376
+ if (status.phase === "succeeded") {
28377
+ write(`Update ${status.version}: installed successfully.`);
28378
+ return;
28379
+ }
28197
28380
  write(
28198
28381
  `Update ${status.version}: ${status.phase}. The update request was accepted; installation is not complete yet. The background updater will install it and restart codexhost.`
28199
28382
  );
@@ -28208,17 +28391,40 @@ async function updateFromCommand(appDirectory2, arguments_) {
28208
28391
  updateAppDirectory: appDirectory2
28209
28392
  });
28210
28393
  const inspected = await inspectInstallation(installation.launcherExecutable);
28211
- await runUpdateCommand(
28212
- {
28213
- ...installation,
28214
- runtimeDescriptorPath: inspected.runtime.descriptorPath,
28215
- codexhostRunning: inspected.runtime.running,
28216
- dataDirectory: paths.dataDirectory,
28217
- restartTarget: inspected.desktop === null ? "web" : "desktop"
28218
- },
28219
- await host.available() ? createHostUpdates(host) : createConsoleUpdates({ waitForHandoff: true, onHandedOff() {
28220
- } })
28221
- );
28394
+ const local = createConsoleUpdates({ waitForHandoff: true, onHandedOff() {
28395
+ } });
28396
+ const updates = await host.available() ? { ...createHostUpdates(host), status: local.status } : local;
28397
+ const output2 = process.stdout;
28398
+ let progressVisible = false;
28399
+ const clearProgress = () => {
28400
+ if (!progressVisible) return;
28401
+ output2.clearLine(0);
28402
+ output2.cursorTo(0);
28403
+ progressVisible = false;
28404
+ };
28405
+ try {
28406
+ await runUpdateCommand(
28407
+ {
28408
+ ...installation,
28409
+ runtimeDescriptorPath: inspected.runtime.descriptorPath,
28410
+ codexhostRunning: inspected.runtime.running,
28411
+ dataDirectory: paths.dataDirectory,
28412
+ restartTarget: inspected.desktop === null ? "web" : "desktop"
28413
+ },
28414
+ updates,
28415
+ (message, live) => {
28416
+ clearProgress();
28417
+ if (live && output2.isTTY) {
28418
+ output2.write(message);
28419
+ progressVisible = true;
28420
+ } else {
28421
+ console.log(message);
28422
+ }
28423
+ }
28424
+ );
28425
+ } finally {
28426
+ clearProgress();
28427
+ }
28222
28428
  }
28223
28429
 
28224
28430
  // packages/console-server/src/main.ts