@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
@@ -64,6 +64,8 @@ function usageEntryFromRequest(request, occurredAtMs) {
64
64
  ...request.reasoningOutputTokens !== void 0 ? { reasoningOutputTokens: request.reasoningOutputTokens } : {}
65
65
  };
66
66
  }
67
+ var JSONL_CHUNK_BYTES = 128 * 1024;
68
+ var JSONL_HEADER_CHUNK_BYTES = 16 * 1024;
67
69
  function nativeTimeMs(value) {
68
70
  const time3 = typeof value === "number" ? value : typeof value === "string" ? Date.parse(value) : Number.NaN;
69
71
  return Number.isFinite(time3) && time3 > 0 ? Math.floor(time3) : null;
@@ -886,10 +888,10 @@ function mergeDefs(...defs) {
886
888
  function cloneDef(schema) {
887
889
  return mergeDefs(schema._zod.def);
888
890
  }
889
- function getElementAtPath(obj, path8) {
890
- if (!path8)
891
+ function getElementAtPath(obj, path9) {
892
+ if (!path9)
891
893
  return obj;
892
- return path8.reduce((acc, key) => acc?.[key], obj);
894
+ return path9.reduce((acc, key) => acc?.[key], obj);
893
895
  }
894
896
  function promiseAllObject(promisesObj) {
895
897
  const keys = Object.keys(promisesObj);
@@ -1229,11 +1231,11 @@ function explicitlyAborted(x, startIndex = 0) {
1229
1231
  }
1230
1232
  return false;
1231
1233
  }
1232
- function prefixIssues(path8, issues) {
1234
+ function prefixIssues(path9, issues) {
1233
1235
  return issues.map((iss) => {
1234
1236
  var _a3;
1235
1237
  (_a3 = iss).path ?? (_a3.path = []);
1236
- iss.path.unshift(path8);
1238
+ iss.path.unshift(path9);
1237
1239
  return iss;
1238
1240
  });
1239
1241
  }
@@ -1695,16 +1697,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
1695
1697
  }
1696
1698
  function formatError(error62, mapper = (issue2) => issue2.message) {
1697
1699
  const fieldErrors = { _errors: [] };
1698
- const processError = (error63, path8 = []) => {
1700
+ const processError = (error63, path9 = []) => {
1699
1701
  for (const issue2 of error63.issues) {
1700
1702
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1701
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1703
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
1702
1704
  } else if (issue2.code === "invalid_key") {
1703
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1705
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1704
1706
  } else if (issue2.code === "invalid_element") {
1705
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1707
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1706
1708
  } else {
1707
- const fullpath = [...path8, ...issue2.path];
1709
+ const fullpath = [...path9, ...issue2.path];
1708
1710
  if (fullpath.length === 0) {
1709
1711
  fieldErrors._errors.push(mapper(issue2));
1710
1712
  } else {
@@ -1743,17 +1745,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
1743
1745
  }
1744
1746
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
1745
1747
  const result = { errors: [] };
1746
- const processError = (error63, path8 = []) => {
1748
+ const processError = (error63, path9 = []) => {
1747
1749
  var _a3;
1748
1750
  for (const issue2 of error63.issues) {
1749
1751
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1750
- issue2.errors.map((issues) => processError({ issues }, [...path8, ...issue2.path]));
1752
+ issue2.errors.map((issues) => processError({ issues }, [...path9, ...issue2.path]));
1751
1753
  } else if (issue2.code === "invalid_key") {
1752
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1754
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1753
1755
  } else if (issue2.code === "invalid_element") {
1754
- processError({ issues: issue2.issues }, [...path8, ...issue2.path]);
1756
+ processError({ issues: issue2.issues }, [...path9, ...issue2.path]);
1755
1757
  } else {
1756
- const fullpath = [...path8, ...issue2.path];
1758
+ const fullpath = [...path9, ...issue2.path];
1757
1759
  if (fullpath.length === 0) {
1758
1760
  result.errors.push(mapper(issue2));
1759
1761
  continue;
@@ -1792,8 +1794,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1792
1794
  }
1793
1795
  function toDotPath(_path) {
1794
1796
  const segs = [];
1795
- const path8 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1796
- for (const seg of path8) {
1797
+ const path9 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1798
+ for (const seg of path9) {
1797
1799
  if (typeof seg === "number")
1798
1800
  segs.push(`[${seg}]`);
1799
1801
  else if (typeof seg === "symbol")
@@ -18931,13 +18933,13 @@ function resolveRef(ref, ctx) {
18931
18933
  if (!ref.startsWith("#")) {
18932
18934
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
18933
18935
  }
18934
- const path8 = ref.slice(1).split("/").filter(Boolean);
18935
- if (path8.length === 0) {
18936
+ const path9 = ref.slice(1).split("/").filter(Boolean);
18937
+ if (path9.length === 0) {
18936
18938
  return ctx.rootSchema;
18937
18939
  }
18938
18940
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
18939
- if (path8[0] === defsKey) {
18940
- 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]);
18941
18943
  if (!key || !ctx.defs[key]) {
18942
18944
  throw new Error(`Reference not found: ${ref}`);
18943
18945
  }
@@ -20312,11 +20314,21 @@ var harnessThinkingOptionsSchema = external_exports.array(harnessThinkingOptionS
20312
20314
  ids.add(option.id);
20313
20315
  }
20314
20316
  });
20317
+ var harnessThinkingOptionsScopeSchema = external_exports.enum(["catalog", "activeModel"]);
20315
20318
  var harnessModelCatalogSchema = external_exports.object({
20316
20319
  models: external_exports.array(harnessModelSchema),
20317
20320
  defaultModel: harnessModelRefSchema.optional(),
20318
20321
  thinkingOptions: harnessThinkingOptionsSchema,
20319
- defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional()
20322
+ defaultThinkingOptionId: harnessThinkingOptionIdSchema.optional(),
20323
+ /**
20324
+ * Scope of per-Model `supportedThinkingOptionIds` in this catalog.
20325
+ * Omitted or `"catalog"` means each Model's `supportedThinkingOptionIds`
20326
+ * reflects its own options (omitted or `[]` means none).
20327
+ * `"activeModel"` means only the active Model's Thinking options were
20328
+ * observed; other Models omit `supportedThinkingOptionIds` and must be
20329
+ * validated by the Adapter after selecting the Model.
20330
+ */
20331
+ thinkingOptionsScope: harnessThinkingOptionsScopeSchema.optional()
20320
20332
  }).strict().superRefine((catalog, context) => {
20321
20333
  const refs = [];
20322
20334
  const thinkingIds = new Set(catalog.thinkingOptions.map(({ id: id2 }) => id2));
@@ -20740,7 +20752,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
20740
20752
  default: external_exports.string().optional()
20741
20753
  })
20742
20754
  ]).superRefine((field3, ctx) => {
20743
- const issue2 = (path8, message) => ctx.addIssue({ code: "custom", path: [path8], message });
20755
+ const issue2 = (path9, message) => ctx.addIssue({ code: "custom", path: [path9], message });
20744
20756
  if (field3.type === "number" || field3.type === "range") {
20745
20757
  const { min = -Infinity, max = Infinity, default: value } = field3;
20746
20758
  if (min > max)
@@ -20846,16 +20858,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
20846
20858
  var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
20847
20859
  var hostExtensionDigestSchema = desktopExtensionHashSchema;
20848
20860
  var hostExtensionActivationIdSchema = external_exports.uuid();
20849
- 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");
20850
20862
  var legacy = desktopExtensionManifestSchema.shape;
20851
20863
  var localized = (max, min = 0) => external_exports.strictObject({
20852
20864
  en: external_exports.string().trim().min(min).max(max),
20853
20865
  "zh-CN": external_exports.string().trim().min(min).max(max)
20854
20866
  });
20855
- 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`);
20856
20868
  var moduleEntry = resourceWithSuffix(".mjs");
20857
20869
  var style = resourceWithSuffix(".css").optional();
20858
- var hostExtensionCanonicalPath = (path8) => path8.normalize("NFC").toLowerCase();
20870
+ var hostExtensionCanonicalPath = (path9) => path9.normalize("NFC").toLowerCase();
20859
20871
  var hostExtensionManifestV2Schema = external_exports.strictObject({
20860
20872
  manifestVersion: external_exports.literal(2),
20861
20873
  id: hostExtensionIdSchema,
@@ -20865,8 +20877,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
20865
20877
  details: localized(16384).optional(),
20866
20878
  author: legacy.author,
20867
20879
  repository: legacy.repository,
20868
- icon: legacy.icon.refine((path8) => path8 === void 0 || hostExtensionResourcePathSchema.safeParse(path8).success),
20869
- 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)),
20870
20882
  categories: legacy.categories,
20871
20883
  settingsSchema: legacy.settingsSchema,
20872
20884
  slots: legacy.slots.removeDefault().optional(),
@@ -20945,7 +20957,7 @@ var active = {
20945
20957
  digest: hostExtensionDigestSchema
20946
20958
  };
20947
20959
  var optionalActivation = { ...id, activationId: active.activationId.optional() };
20948
- 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");
20949
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");
20950
20962
  function base643(maxBytes) {
20951
20963
  return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
@@ -21230,7 +21242,12 @@ var clientProjectlessWorkspaceSchema = external_exports.object({
21230
21242
  prompt: external_exports.string().max(16384).optional()
21231
21243
  }).strict();
21232
21244
  var clientWorkspaceSnapshotSchema = external_exports.object({
21233
- projects: external_exports.array(external_exports.object({ id: external_exports.string(), name: external_exports.string(), rootPaths: external_exports.array(external_exports.string()) })),
21245
+ projects: external_exports.array(external_exports.object({
21246
+ id: external_exports.string(),
21247
+ name: external_exports.string(),
21248
+ rootPaths: external_exports.array(external_exports.string()),
21249
+ createdAt: external_exports.number().int().optional()
21250
+ })),
21234
21251
  nativeProjects: external_exports.literal(true).optional(),
21235
21252
  assignments: external_exports.record(external_exports.string(), external_exports.string()),
21236
21253
  projectless: external_exports.array(external_exports.string()),
@@ -21643,6 +21660,7 @@ var delegationReadParamsSchema = external_exports.strictObject({
21643
21660
  // ../../shared-contracts/dist/remote-peers.js
21644
21661
  var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
21645
21662
  var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
21663
+ var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
21646
21664
  var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
21647
21665
  var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
21648
21666
  var REMOTE_PEER_COLORS = [
@@ -21666,6 +21684,7 @@ var remotePeerStateSchema = external_exports.enum([
21666
21684
  var remotePeerSummarySchema = external_exports.object({
21667
21685
  peerId: remotePeerIdSchema,
21668
21686
  hostId: remotePeerHostIdSchema,
21687
+ nodeId: remotePeerNodeIdSchema.optional(),
21669
21688
  name: external_exports.string().min(1).max(120),
21670
21689
  color: remotePeerColorSchema.optional(),
21671
21690
  origin: external_exports.string().min(1).max(2048),
@@ -21673,6 +21692,11 @@ var remotePeerSummarySchema = external_exports.object({
21673
21692
  encrypted: external_exports.boolean(),
21674
21693
  enabled: external_exports.boolean(),
21675
21694
  state: remotePeerStateSchema,
21695
+ supportsPeerPairing: external_exports.boolean().optional(),
21696
+ /** Omitted when either side's node mapping is unknown. */
21697
+ pairedBack: external_exports.boolean().optional(),
21698
+ /** Other configured remote peerIds on this Hub present in this peer's `manifest.peerNodes`. */
21699
+ linkedPeerIds: external_exports.array(remotePeerIdSchema).max(128).optional(),
21676
21700
  latencyMs: external_exports.number().int().nonnegative().optional(),
21677
21701
  version: external_exports.string().max(128).optional(),
21678
21702
  platform: external_exports.string().max(64).optional(),
@@ -21691,8 +21715,48 @@ var remotePeerAddParamsSchema = external_exports.object({
21691
21715
  origin: external_exports.string().min(1).max(2048).optional(),
21692
21716
  token: external_exports.string().min(1).max(2048).optional(),
21693
21717
  name: external_exports.string().trim().min(1).max(120).optional(),
21694
- color: remotePeerColorSchema.optional()
21718
+ color: remotePeerColorSchema.optional(),
21719
+ pairBack: external_exports.boolean().optional(),
21720
+ meshPeerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
21721
+ selfOrigin: external_exports.string().min(1).max(2048).optional()
21695
21722
  }).refine((input3) => Boolean(input3.connectionUrl) || Boolean(input3.origin) && Boolean(input3.token), "Provide either connectionUrl or both origin and token");
21723
+ var remotePeerIntroduceParamsSchema = external_exports.strictObject({
21724
+ origin: external_exports.string().min(1).max(2048),
21725
+ token: external_exports.string().min(1).max(2048),
21726
+ name: external_exports.string().trim().min(1).max(120).optional(),
21727
+ color: remotePeerColorSchema.optional(),
21728
+ expectedNodeId: remotePeerNodeIdSchema.optional()
21729
+ });
21730
+ var remotePeerIntroduceResultSchema = external_exports.object({
21731
+ status: external_exports.enum(["added", "updated", "existing"]),
21732
+ peerId: remotePeerIdSchema,
21733
+ hostId: remotePeerHostIdSchema,
21734
+ nodeId: remotePeerNodeIdSchema.optional()
21735
+ });
21736
+ var remotePeerPairingStatusSchema = external_exports.enum([
21737
+ "added",
21738
+ "updated",
21739
+ "existing",
21740
+ "failed",
21741
+ "skipped"
21742
+ ]);
21743
+ var remotePeerPairingStepSchema = external_exports.object({
21744
+ targetPeerId: remotePeerIdSchema,
21745
+ targetName: external_exports.string().min(1).max(120),
21746
+ introducedHost: external_exports.union([external_exports.literal("local"), remotePeerIdSchema]),
21747
+ introducedName: external_exports.string().min(1).max(120),
21748
+ status: remotePeerPairingStatusSchema,
21749
+ error: external_exports.string().max(1e3).optional()
21750
+ });
21751
+ var remotePeerPairingReportSchema = external_exports.object({
21752
+ results: external_exports.array(remotePeerPairingStepSchema)
21753
+ });
21754
+ var remotePeerSyncMeshParamsSchema = external_exports.object({
21755
+ peerIds: external_exports.array(remotePeerIdSchema).max(64).optional(),
21756
+ includeSelf: external_exports.boolean().optional(),
21757
+ includeMesh: external_exports.boolean().optional(),
21758
+ selfOrigin: external_exports.string().min(1).max(2048).optional()
21759
+ });
21696
21760
  var remotePeerUpdateParamsSchema = external_exports.object({
21697
21761
  peerId: remotePeerIdSchema,
21698
21762
  name: external_exports.string().trim().min(1).max(120).optional(),
@@ -21721,6 +21785,9 @@ var remotePeerTestProjectSchema = external_exports.object({
21721
21785
  });
21722
21786
  var remotePeerTestResultSchema = external_exports.object({
21723
21787
  ok: external_exports.boolean(),
21788
+ nodeId: remotePeerNodeIdSchema.optional(),
21789
+ supportsPeerPairing: external_exports.boolean().optional(),
21790
+ pairedBack: external_exports.boolean().optional(),
21724
21791
  latencyMs: external_exports.number().int().nonnegative().optional(),
21725
21792
  origin: external_exports.string().max(2048).optional(),
21726
21793
  transportKind: remotePeerTransportKindSchema.optional(),
@@ -21747,7 +21814,9 @@ var remotePeerCapabilitiesSchema = external_exports.object({
21747
21814
  /** Peer supports officeToPdf/render over /api/peer/v1/workspace-files/rpc. */
21748
21815
  officePreview: external_exports.literal(1).optional(),
21749
21816
  /** /api/peer/v1/delegation is available for fixed-whitelist cross-host delegation. */
21750
- delegation: external_exports.literal(1).optional()
21817
+ delegation: external_exports.literal(1).optional(),
21818
+ /** POST /api/peer/v1/peers is available. */
21819
+ peerPairing: external_exports.literal(1).optional()
21751
21820
  });
21752
21821
  var remotePeerManifestSchema = external_exports.object({
21753
21822
  version: external_exports.string().max(128),
@@ -21755,6 +21824,8 @@ var remotePeerManifestSchema = external_exports.object({
21755
21824
  hostname: external_exports.string().max(255),
21756
21825
  homeDir: external_exports.string().max(4096).optional(),
21757
21826
  epoch: external_exports.string().min(1).max(256),
21827
+ nodeId: remotePeerNodeIdSchema.optional(),
21828
+ peerNodes: external_exports.record(remotePeerHostIdSchema, remotePeerNodeIdSchema).refine((v) => Object.keys(v).length <= 128).optional(),
21758
21829
  projects: external_exports.array(remotePeerManifestProjectSchema),
21759
21830
  capabilities: remotePeerCapabilitiesSchema.optional()
21760
21831
  });
@@ -21841,6 +21912,29 @@ var remotePeerWorkspaceMutationResultSchema = external_exports.object({
21841
21912
  workspaceId: external_exports.string().min(1).max(1024).optional(),
21842
21913
  manifest: remotePeerManifestSchema
21843
21914
  });
21915
+ var delegationRemoteHostsParamsSchema = external_exports.object({
21916
+ sessionHostId: external_exports.string().min(1).max(128).optional()
21917
+ });
21918
+ var delegationRemoteHostOptionSchema = external_exports.object({
21919
+ hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema]),
21920
+ name: external_exports.string().min(1).max(120),
21921
+ isLocal: external_exports.boolean().optional(),
21922
+ color: remotePeerColorSchema.optional(),
21923
+ hostname: external_exports.string().max(255).optional()
21924
+ });
21925
+ var delegationRemoteHostsResultSchema = external_exports.object({
21926
+ hosts: external_exports.array(delegationRemoteHostOptionSchema)
21927
+ });
21928
+ var delegationHostHarnessesParamsSchema = external_exports.object({
21929
+ hostId: external_exports.union([external_exports.literal("local"), remotePeerHostIdSchema])
21930
+ });
21931
+ var delegationHostHarnessOptionSchema = external_exports.object({
21932
+ id: external_exports.string().regex(/^[a-z0-9][a-z0-9-]*$/u),
21933
+ name: external_exports.string().min(1).max(120)
21934
+ });
21935
+ var delegationHostHarnessesResultSchema = external_exports.object({
21936
+ harnesses: external_exports.array(delegationHostHarnessOptionSchema)
21937
+ });
21844
21938
 
21845
21939
  // ../../shared-contracts/dist/peer-delegation.js
21846
21940
  var PEER_DELEGATION_BRIDGE_VERSION = 1;
@@ -21884,6 +21978,7 @@ var peerDelegationHostProjectSchema = external_exports.strictObject({
21884
21978
  });
21885
21979
  var peerDelegationHostSummarySchema = external_exports.strictObject({
21886
21980
  hostId: remotePeerHostIdSchema,
21981
+ nodeId: remotePeerNodeIdSchema.optional(),
21887
21982
  displayName: external_exports.string().min(1).max(120),
21888
21983
  online: external_exports.boolean(),
21889
21984
  state: remotePeerStateSchema,
@@ -22776,6 +22871,13 @@ var updatePhaseSchema = external_exports.enum([
22776
22871
  "succeeded",
22777
22872
  "failed"
22778
22873
  ]);
22874
+ var npmDownloadProgressSchema = external_exports.strictObject({
22875
+ completed: external_exports.number().int().nonnegative(),
22876
+ total: external_exports.number().int().positive()
22877
+ }).refine((progress) => progress.completed <= progress.total, {
22878
+ path: ["completed"],
22879
+ message: "completed must not exceed total"
22880
+ });
22779
22881
  var updateStatusSchema = external_exports.strictObject({
22780
22882
  version: updateSemanticVersionSchema,
22781
22883
  installation: updateInstallationSchema,
@@ -22783,6 +22885,7 @@ var updateStatusSchema = external_exports.strictObject({
22783
22885
  updatedAt: external_exports.number().int().nonnegative(),
22784
22886
  downloadedBytes: external_exports.number().int().nonnegative().optional(),
22785
22887
  totalBytes: external_exports.number().int().positive().optional(),
22888
+ npmDownload: npmDownloadProgressSchema.optional(),
22786
22889
  error: external_exports.string().min(1).max(UPDATE_ERROR_MAX_LENGTH).nullable(),
22787
22890
  serviceStopOutput: external_exports.string().optional()
22788
22891
  }).superRefine((status, context) => {
@@ -23741,7 +23844,7 @@ function createZcodeUsageStatistics(environment) {
23741
23844
  }
23742
23845
 
23743
23846
  // dist/adapter.js
23744
- import path7 from "node:path";
23847
+ import path8 from "node:path";
23745
23848
  import { isDeepStrictEqual } from "node:util";
23746
23849
  import { stat as stat2 } from "node:fs/promises";
23747
23850
 
@@ -23777,7 +23880,57 @@ function nativeError(error62) {
23777
23880
  // dist/installation.js
23778
23881
  import { open as open2, stat } from "node:fs/promises";
23779
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";
23780
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
23781
23934
  var DEFAULT_DARWIN_APP = "/Applications/ZCode.app";
23782
23935
  var DEFAULT_LINUX_APP = "/opt/ZCode";
23783
23936
  async function isFile(file2) {
@@ -23822,11 +23975,11 @@ async function resolveDefaultApp(environment, platform2) {
23822
23975
  if (platform2 === "linux")
23823
23976
  return DEFAULT_LINUX_APP;
23824
23977
  const candidates = [
23825
- environment.LOCALAPPDATA && path2.join(environment.LOCALAPPDATA, "Programs", "ZCode"),
23826
- environment.ProgramFiles && path2.join(environment.ProgramFiles, "ZCode")
23978
+ environment.LOCALAPPDATA && path3.join(environment.LOCALAPPDATA, "Programs", "ZCode"),
23979
+ environment.ProgramFiles && path3.join(environment.ProgramFiles, "ZCode")
23827
23980
  ].filter(Boolean);
23828
23981
  for (const candidate of candidates) {
23829
- if (await isFile(path2.join(candidate, "resources", "app.asar")))
23982
+ if (await isFile(path3.join(candidate, "resources", "app.asar")))
23830
23983
  return candidate;
23831
23984
  }
23832
23985
  return candidates[0] ?? "";
@@ -23838,30 +23991,31 @@ async function resolveInstallation(environment, app, platform2 = process.platfor
23838
23991
  const explicitApp = app?.trim() || environment.CODEXHOST_ZCODE_APP?.trim();
23839
23992
  const targetApp = explicitApp || await resolveDefaultApp(environment, platform2);
23840
23993
  const missing = () => new ZcodeError("notInstalled", `ZCode Desktop was not found at ${targetApp}; install it or set its application path`);
23841
- const resources = platform2 === "darwin" ? path2.join(targetApp, "Contents", "Resources") : path2.join(targetApp, "resources");
23842
- 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"));
23843
23996
  if (!pkg?.productName || !pkg.version)
23844
23997
  throw missing();
23845
23998
  let runtime;
23846
23999
  if (platform2 === "darwin") {
23847
- 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`);
23848
24001
  } else if (platform2 === "win32") {
23849
- runtime = path2.join(targetApp, `${pkg.productName}.exe`);
24002
+ runtime = path3.join(targetApp, `${pkg.productName}.exe`);
23850
24003
  } else {
23851
24004
  const linuxExecutableName = pkg.productName.toLowerCase().replace(/\s+/g, "-");
23852
- runtime = path2.join(targetApp, linuxExecutableName);
24005
+ runtime = path3.join(targetApp, linuxExecutableName);
23853
24006
  }
23854
- const cli = path2.join(resources, "glm", "zcode.cjs");
23855
- 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;
23856
24011
  if (!await isFile(runtime) || !await isFile(cli) || !await isFile(builtinProviderConfig))
23857
24012
  throw missing();
23858
- const dataRoot = path2.join(environment.ZCODE_DATA_BASE_DIR?.trim() || environment.HOME || homedir(), ".zcode", "v2");
23859
24013
  return {
23860
24014
  runtime,
23861
24015
  version: pkg.version,
23862
24016
  cli,
23863
24017
  builtinProviderConfig,
23864
- 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"),
23865
24019
  dataRoot
23866
24020
  };
23867
24021
  }
@@ -23888,19 +24042,19 @@ function createZcodeInstallation(environment, app) {
23888
24042
 
23889
24043
  // dist/account.js
23890
24044
  import { createHash as createHash4 } from "node:crypto";
23891
- import { readFile as readFile3 } from "node:fs/promises";
23892
- import path6 from "node:path";
24045
+ import { readFile as readFile4 } from "node:fs/promises";
24046
+ import path7 from "node:path";
23893
24047
 
23894
24048
  // dist/credentials.js
23895
24049
  import { createDecipheriv, createHash } from "node:crypto";
23896
24050
  import { constants } from "node:fs";
23897
- import { open as open3, readFile } from "node:fs/promises";
24051
+ import { open as open3, readFile as readFile2 } from "node:fs/promises";
23898
24052
  import { homedir as homedir2, platform, userInfo } from "node:os";
23899
- import path4 from "node:path";
24053
+ import path5 from "node:path";
23900
24054
 
23901
24055
  // dist/credential-keyring.js
23902
24056
  import { execFile } from "node:child_process";
23903
- import path3 from "node:path";
24057
+ import path4 from "node:path";
23904
24058
  import { promisify } from "node:util";
23905
24059
  var execute = promisify(execFile);
23906
24060
  var SERVICE = "ZCode Credential Encryption";
@@ -23996,9 +24150,9 @@ var readSystemCredentialKey = async (account, options = {}) => {
23996
24150
  let value;
23997
24151
  if (process.platform === "win32") {
23998
24152
  const root = process.env.SystemRoot;
23999
- if (!root || !path3.isAbsolute(root))
24153
+ if (!root || !path4.isAbsolute(root))
24000
24154
  return;
24001
- const powershell = path3.join(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
24155
+ const powershell = path4.join(root, "System32", "WindowsPowerShell", "v1.0", "powershell.exe");
24002
24156
  const command = `${WIN32_READER}
24003
24157
  [Console]::Write([ZCodeKeyReader]::Read('${account}.${SERVICE}'))`;
24004
24158
  value = (await run(powershell, [
@@ -24011,7 +24165,7 @@ var readSystemCredentialKey = async (account, options = {}) => {
24011
24165
  } else if (process.platform === "darwin") {
24012
24166
  const security = "/usr/bin/security";
24013
24167
  const keychain = /^\s*"([^"\r\n]+)"\s*$/.exec(await run(security, ["default-keychain", "-d", "user"]))?.[1];
24014
- if (!keychain || !path3.isAbsolute(keychain)) {
24168
+ if (!keychain || !path4.isAbsolute(keychain)) {
24015
24169
  deniedReads.set(cacheKey, { reason: "denied", readAt: performance.now() });
24016
24170
  return;
24017
24171
  }
@@ -24153,8 +24307,8 @@ async function loadV2Key(file2, values, environment, readSystemKey, source, read
24153
24307
  return { source: "env", key: digest(secret) };
24154
24308
  if (explicitFile)
24155
24309
  return { source: "env", key: digest(await readSecretFile(explicitFile, false)) };
24156
- const directory = path4.dirname(file2);
24157
- 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) => {
24158
24312
  if (error62.code === "ENOENT")
24159
24313
  return void 0;
24160
24314
  throw error62;
@@ -24167,7 +24321,7 @@ async function loadV2Key(file2, values, environment, readSystemKey, source, read
24167
24321
  throw unavailableV2();
24168
24322
  return {
24169
24323
  source: "env",
24170
- key: digest(await readSecretFile(path4.join(directory, "credential-secret"), true))
24324
+ key: digest(await readSecretFile(path5.join(directory, "credential-secret"), true))
24171
24325
  };
24172
24326
  }
24173
24327
  if (source !== "os")
@@ -24198,10 +24352,10 @@ function plaintextCredential(value) {
24198
24352
  return value;
24199
24353
  }
24200
24354
  async function readCredentials(installation, environment, readSystemKey = readSystemCredentialKey, readSystemKeyOptions) {
24201
- const file2 = path4.resolve(installation.dataRoot, "credentials.json");
24355
+ const file2 = path5.resolve(installation.dataRoot, "credentials.json");
24202
24356
  let values;
24203
24357
  try {
24204
- values = storeSchema.parse(JSON.parse(await readFile(file2, "utf8")));
24358
+ values = storeSchema.parse(JSON.parse(await readFile2(file2, "utf8")));
24205
24359
  } catch (error62) {
24206
24360
  if (error62.code === "ENOENT")
24207
24361
  return async () => "";
@@ -24254,9 +24408,9 @@ async function readOAuthUserId(credential, channel) {
24254
24408
 
24255
24409
  // dist/personal-coding-plan.js
24256
24410
  import { createHash as createHash3 } from "node:crypto";
24257
- import { readFile as readFile2 } from "node:fs/promises";
24411
+ import { readFile as readFile3 } from "node:fs/promises";
24258
24412
  import { homedir as homedir3 } from "node:os";
24259
- import path5 from "node:path";
24413
+ import path6 from "node:path";
24260
24414
 
24261
24415
  // dist/project-token.js
24262
24416
  import { createHash as createHash2 } from "node:crypto";
@@ -24380,7 +24534,7 @@ async function readSelection(environment, family) {
24380
24534
  const home = environment.ZCODE_DESKTOP_HOME_DIR?.trim() || environment.HOME?.trim() || environment.USERPROFILE?.trim() || homedir3();
24381
24535
  let raw;
24382
24536
  try {
24383
- 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"));
24384
24538
  } catch (error62) {
24385
24539
  if (error62.code === "ENOENT")
24386
24540
  return false;
@@ -24598,27 +24752,13 @@ var PersonalCodingPlanAccount = class {
24598
24752
 
24599
24753
  // dist/account.js
24600
24754
  var SIGN_IN = "Sign in to ZCode Desktop with a Start Plan account, then try again";
24601
- var builtinSchema = external_exports.object({
24602
- revision: external_exports.union([external_exports.number(), external_exports.string()]),
24603
- config: external_exports.object({
24604
- providerConfigRules: external_exports.object({
24605
- providerRules: external_exports.array(external_exports.object({
24606
- providerId: external_exports.string().min(1),
24607
- config: external_exports.object({
24608
- builtinModelIds: external_exports.array(external_exports.string()).optional(),
24609
- access: external_exports.object({ mode: external_exports.string(), accountType: external_exports.string() }).partial().optional()
24610
- })
24611
- }))
24612
- })
24613
- })
24614
- });
24615
24755
  function resolveEndpointOrigin(environment) {
24616
24756
  return environment.ZCODE_BASE_URL?.trim() || "https://zcode.z.ai";
24617
24757
  }
24618
24758
  async function readDeviceMid(installation) {
24619
24759
  try {
24620
- const file2 = path6.join(installation.dataRoot, "telemetry-state.json");
24621
- 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"));
24622
24762
  return typeof parsed?.deviceMid === "string" ? parsed.deviceMid.trim() : "";
24623
24763
  } catch {
24624
24764
  return "";
@@ -24722,8 +24862,8 @@ async function queryStartPlanBalance(origin, appVersion, jwt2, deviceMid) {
24722
24862
  }
24723
24863
  async function accountConfig(installation, environment, readSystemKeyOptions) {
24724
24864
  const file2 = installation.builtinProviderConfig;
24725
- const builtin = builtinSchema.parse(JSON.parse(await readFile3(file2, "utf8")));
24726
- 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")}`;
24727
24867
  let channel;
24728
24868
  let credentialIssue;
24729
24869
  let credentialAccessRequired = false;
@@ -26061,16 +26201,16 @@ var Diff = class {
26061
26201
  }
26062
26202
  }
26063
26203
  }
26064
- addToPath(path8, added, removed, oldPosInc, options) {
26065
- const last = path8.lastComponent;
26204
+ addToPath(path9, added, removed, oldPosInc, options) {
26205
+ const last = path9.lastComponent;
26066
26206
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
26067
26207
  return {
26068
- oldPos: path8.oldPos + oldPosInc,
26208
+ oldPos: path9.oldPos + oldPosInc,
26069
26209
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
26070
26210
  };
26071
26211
  } else {
26072
26212
  return {
26073
- oldPos: path8.oldPos + oldPosInc,
26213
+ oldPos: path9.oldPos + oldPosInc,
26074
26214
  lastComponent: { count: 1, added, removed, previousComponent: last }
26075
26215
  };
26076
26216
  }
@@ -27703,7 +27843,7 @@ var ZcodeAdapter = class {
27703
27843
  }
27704
27844
  }
27705
27845
  async inspect(input3 = {}) {
27706
- const cwd = path7.resolve(input3.cwd ?? process.cwd());
27846
+ const cwd = path8.resolve(input3.cwd ?? process.cwd());
27707
27847
  const access = input3.credentialAccess;
27708
27848
  return this.#inspect(cwd, access ? { access, requestedAt: performance.now() } : {});
27709
27849
  }
@@ -27796,7 +27936,7 @@ var ZcodeAdapter = class {
27796
27936
  let createdId;
27797
27937
  try {
27798
27938
  const prewarm = input3.kind === "create" && input3.prewarm === true;
27799
- 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" });
27800
27940
  const credentialIssue = transport.credentialIssue ?? "ZCode credential access is required";
27801
27941
  if (prewarm && transport.credentialAccessRequired)
27802
27942
  throw new ZcodeError("credentialAccessRequired", credentialIssue);