@codexhost/cli-win32-x64 0.33.0 → 0.34.0

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 (116) hide show
  1. package/README.md +2 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +191 -9
  4. package/app/console-web.js +930 -168
  5. package/app/desktop-controller.mjs +267 -13
  6. package/app/desktop-mcp-client.mjs +619 -0
  7. package/app/host-runtime.mjs +3254 -2860
  8. package/app/plugins/antigravity/plugin.mjs +409 -22
  9. package/app/plugins/claude-code/plugin.mjs +191 -9
  10. package/app/plugins/codebuddy/plugin.mjs +203 -14
  11. package/app/plugins/codex-usage/plugin.mjs +191 -9
  12. package/app/plugins/copilot/plugin.mjs +191 -9
  13. package/app/plugins/cursor-cli/plugin.mjs +191 -9
  14. package/app/plugins/deepseek-harness/plugin.mjs +191 -9
  15. package/app/plugins/devin/plugin.mjs +191 -9
  16. package/app/plugins/enabled.json +1 -0
  17. package/app/plugins/grok/plugin.mjs +191 -9
  18. package/app/plugins/hermes/plugin.mjs +191 -9
  19. package/app/plugins/kimi-code/plugin.mjs +191 -9
  20. package/app/plugins/kiro-cli/plugin.mjs +191 -9
  21. package/app/plugins/omp/plugin.mjs +1002 -240
  22. package/app/plugins/opencode/plugin.mjs +191 -9
  23. package/app/plugins/pi/plugin.mjs +191 -9
  24. package/app/plugins/qoder/plugin.mjs +191 -9
  25. package/app/plugins/qoder-cn/plugin.mjs +191 -9
  26. package/app/plugins/qwen-code/plugin.mjs +191 -9
  27. package/app/plugins/workbuddy/plugin.mjs +823 -451
  28. package/app/plugins/workbuddy-cn/assets/icon.svg +27 -0
  29. package/app/plugins/workbuddy-cn/manifest.json +32 -0
  30. package/app/plugins/workbuddy-cn/plugin.mjs +36211 -0
  31. package/app/plugins/zcode/plugin.mjs +191 -9
  32. package/app/renderer-extension.js +2479 -229
  33. package/app/web/assets/{abnfDiagram-XWFEHMT6-VnfRaHM6.js → abnfDiagram-XWFEHMT6-Cg-E7mc4.js} +1 -1
  34. package/app/web/assets/{architectureDiagram-CSQXQB3N-BA1ehtvi.js → architectureDiagram-CSQXQB3N-B__CwXjW.js} +1 -1
  35. package/app/web/assets/{blockDiagram-BEDRHYPZ-31BZSfd4.js → blockDiagram-BEDRHYPZ-Bk2gCIVM.js} +1 -1
  36. package/app/web/assets/{c4Diagram-M2UUVUY5-CNzGWc5k.js → c4Diagram-M2UUVUY5-DU_TpjJ3.js} +1 -1
  37. package/app/web/assets/{chunk-2Q5K7J3B-ahAIR-NM.js → chunk-2Q5K7J3B-DnJEi6e4.js} +1 -1
  38. package/app/web/assets/{chunk-3GCGMST5-BIV5YeRJ.js → chunk-3GCGMST5-Dia9jGkf.js} +1 -1
  39. package/app/web/assets/{chunk-5VM5RSS4-CluTMPJG.js → chunk-5VM5RSS4-2PGDiDvK.js} +1 -1
  40. package/app/web/assets/{chunk-7U7NFRK5-4NIQuFbE.js → chunk-7U7NFRK5-BLPm3d5H.js} +1 -1
  41. package/app/web/assets/{chunk-CNRTWJTD-_0bEfGn3.js → chunk-CNRTWJTD-GH_nAEXs.js} +1 -1
  42. package/app/web/assets/{chunk-D5HYT7QG-_kTC6f8F.js → chunk-D5HYT7QG-DnIm-Ely.js} +1 -1
  43. package/app/web/assets/{chunk-EBZ3SEQC-CykaYOrL.js → chunk-EBZ3SEQC-C6N5qLCR.js} +2 -2
  44. package/app/web/assets/{chunk-JWPE2WC7-3vVOQ_py.js → chunk-JWPE2WC7-D_kMgdmr.js} +1 -1
  45. package/app/web/assets/{chunk-KTR4FSNJ-aVg5vgrm.js → chunk-KTR4FSNJ-BRb9femQ.js} +1 -1
  46. package/app/web/assets/{chunk-XXDRQBXY-_gVwGeSp.js → chunk-XXDRQBXY-BFaK95zq.js} +1 -1
  47. package/app/web/assets/{classDiagram-v2-KXABOMEV-fI1LfeBf.js → classDiagram-v2-KXABOMEV--_hR_XrU.js} +1 -1
  48. package/app/web/assets/{cose-bilkent-JH36ORCC-DFXMlWov.js → cose-bilkent-JH36ORCC-C7ghEB3_.js} +1 -1
  49. package/app/web/assets/{cynefin-EF2NZ3EQ-lZy7X6FO.js → cynefin-EF2NZ3EQ-Ce1lURwZ.js} +1 -1
  50. package/app/web/assets/{cynefinDiagram-NJNITYFG-N4DwFSW1.js → cynefinDiagram-NJNITYFG-Cgr5aSTS.js} +1 -1
  51. package/app/web/assets/{dagre-KIHZ2IZ3-B7-8baTH.js → dagre-KIHZ2IZ3-BBFKmRP1.js} +1 -1
  52. package/app/web/assets/{diagram-7YQZDPLS-DLfjiBXV.js → diagram-7YQZDPLS-CJQih32K.js} +1 -1
  53. package/app/web/assets/{diagram-QBROCOUO-CQnRzSTi.js → diagram-QBROCOUO-Cl3S7IUT.js} +1 -1
  54. package/app/web/assets/{diagram-RJJCUUZO-DPnxazRT.js → diagram-RJJCUUZO-B6C8N2cV.js} +1 -1
  55. package/app/web/assets/{diagram-WERXNKYE-BBuEFRvD.js → diagram-WERXNKYE-NkciBSQl.js} +1 -1
  56. package/app/web/assets/{diagram-YHHI257C-BQ92JNJs.js → diagram-YHHI257C-DlEvljeY.js} +1 -1
  57. package/app/web/assets/{diagram-YR4HJLHV-Ce6BQO3J.js → diagram-YR4HJLHV-e4_Gzbt6.js} +1 -1
  58. package/app/web/assets/{ebnfDiagram-N527522P-DYknE2Jy.js → ebnfDiagram-N527522P-WvQEFmPi.js} +1 -1
  59. package/app/web/assets/{elk-O5DQBFGD-4S6_JJFF.js → elk-O5DQBFGD-CkyJsjzf.js} +1 -1
  60. package/app/web/assets/{erDiagram-K3K3BIDK-DRtF7JVQ.js → erDiagram-K3K3BIDK-B93gK3X0.js} +1 -1
  61. package/app/web/assets/{flowDiagram-Z6JWZHQI-7Ho8CyR9.js → flowDiagram-Z6JWZHQI-NFaGX6B4.js} +1 -1
  62. package/app/web/assets/{ganttDiagram-3PRQTZWP-CW8Ig5y4.js → ganttDiagram-3PRQTZWP-Czh68CQm.js} +1 -1
  63. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-CzS8Xg2D.js → gitGraphDiagram-VXDFKS5L-t95UHKja.js} +1 -1
  64. package/app/web/assets/{grid-E2QIVN74-Cq284lCe.js → grid-E2QIVN74-C87DucDN.js} +1 -1
  65. package/app/web/assets/index-CGI50Nfg.css +1 -0
  66. package/app/web/assets/index-Dr6wHi0A.js +208 -0
  67. package/app/web/assets/{infoDiagram-EZ3ZOAHP-BZgN6qlY.js → infoDiagram-EZ3ZOAHP-CxFlfQbY.js} +1 -1
  68. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BH9YHc-1.js → ishikawaDiagram-S3EKX5GW-D4IwQJde.js} +1 -1
  69. package/app/web/assets/{journeyDiagram-POQNLL5X-D50KYOLe.js → journeyDiagram-POQNLL5X-C0Bf5W4T.js} +1 -1
  70. package/app/web/assets/{kanban-definition-BH5XI6FM-Crw_5mMP.js → kanban-definition-BH5XI6FM-Cda7r2yr.js} +1 -1
  71. package/app/web/assets/{mermaid.core-o2Qjrppc.js → mermaid.core-f4LJm6AC.js} +4 -4
  72. package/app/web/assets/{mindmap-definition-WVAN44T4-B_bEbpAH.js → mindmap-definition-WVAN44T4-DKapinG7.js} +1 -1
  73. package/app/web/assets/{pegDiagram-D4NLKWP3-VecAHoyw.js → pegDiagram-D4NLKWP3-D7iEZGN2.js} +1 -1
  74. package/app/web/assets/{pieDiagram-36ENHN4W-o3ei2T-6.js → pieDiagram-36ENHN4W-CopXZ5qt.js} +1 -1
  75. package/app/web/assets/{quadrantDiagram-ZQUDMS73-DHndOAcn.js → quadrantDiagram-ZQUDMS73-mmkKPDGK.js} +1 -1
  76. package/app/web/assets/{railroadDiagram-JIZHGYPL-DRd_lfii.js → railroadDiagram-JIZHGYPL-BAGwIIkV.js} +1 -1
  77. package/app/web/assets/{render-VIF2ZAQL-awM3hUqB.js → render-VIF2ZAQL-dXxGa09y.js} +2 -2
  78. package/app/web/assets/{requirementDiagram-AXW2TVFA-Ce1ePsOe.js → requirementDiagram-AXW2TVFA-C35tmLFs.js} +1 -1
  79. package/app/web/assets/{sankeyDiagram-FBCJTAIF-cP-LtgW-.js → sankeyDiagram-FBCJTAIF-BbSo5yeK.js} +1 -1
  80. package/app/web/assets/{sequenceDiagram-3LA2ROMG-C3JStTuW.js → sequenceDiagram-3LA2ROMG-Cgm2unNy.js} +1 -1
  81. package/app/web/assets/{sizeCapture-2Q2CQKSF-Dyyelr9K.js → sizeCapture-2Q2CQKSF-DCXFjl2x.js} +1 -1
  82. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-DkYRBVTd.js → stateDiagram-v2-ATKHQDJO-B349iAao.js} +1 -1
  83. package/app/web/assets/{swimlanes-YQL5WMAO-B2FwJU5_.js → swimlanes-YQL5WMAO-6OvL1sEz.js} +1 -1
  84. package/app/web/assets/swimlanesDiagram-UCCPES4V-CIKaQUvP.js +8 -0
  85. package/app/web/assets/{timeline-definition-7Z437IG3-Di-qRIIi.js → timeline-definition-7Z437IG3-Bh1E3mhW.js} +1 -1
  86. package/app/web/assets/{usecaseDiagram-RDK6N6HP-yAImn62t.js → usecaseDiagram-RDK6N6HP-Dr5A05lL.js} +1 -1
  87. package/app/web/assets/{vennDiagram-SHRQU5PJ-BEv8jpfv.js → vennDiagram-SHRQU5PJ-CQPPBa27.js} +1 -1
  88. package/app/web/assets/{wardleyDiagram-F3OXNVQS-7irksA0b.js → wardleyDiagram-F3OXNVQS-BHin00q8.js} +1 -1
  89. package/app/web/assets/{xychartDiagram-GDYJKCDI-BokJGG2y.js → xychartDiagram-GDYJKCDI-D4BAWlQZ.js} +1 -1
  90. package/app/web/codexhost-settings.js +330 -130
  91. package/app/web/index.html +2 -2
  92. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  93. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  94. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  95. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +160 -77
  96. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +104 -100
  97. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +64 -64
  98. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +5 -5
  99. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +6 -6
  100. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +80 -80
  101. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -70
  102. package/app/web/role-avatars/builtin/advisor-otter.webp +0 -0
  103. package/app/web/role-avatars/builtin/builder-otter.webp +0 -0
  104. package/app/web/role-avatars/builtin/sailor-otter.webp +0 -0
  105. package/app/web/role-avatars/builtin/wizard-otter.webp +0 -0
  106. package/app/web-modules/server.mjs +5794 -2268
  107. package/bin/codexhost.exe +0 -0
  108. package/libexec/codexhost-node-repl.exe +0 -0
  109. package/libexec/codexhost-screenshot.exe +0 -0
  110. package/libexec/codexhost-shell.exe +0 -0
  111. package/libexec/codexhost-shim.exe +0 -0
  112. package/libexec/codexhost-updater.exe +0 -0
  113. package/package.json +1 -1
  114. package/app/web/assets/index-CINZ6P-q.css +0 -1
  115. package/app/web/assets/index-CvV6veuY.js +0 -208
  116. package/app/web/assets/swimlanesDiagram-UCCPES4V-BkMsxCPb.js +0 -8
@@ -828,10 +828,10 @@ function mergeDefs(...defs) {
828
828
  function cloneDef(schema) {
829
829
  return mergeDefs(schema._zod.def);
830
830
  }
831
- function getElementAtPath(obj, path13) {
832
- if (!path13)
831
+ function getElementAtPath(obj, path14) {
832
+ if (!path14)
833
833
  return obj;
834
- return path13.reduce((acc, key) => acc?.[key], obj);
834
+ return path14.reduce((acc, key) => acc?.[key], obj);
835
835
  }
836
836
  function promiseAllObject(promisesObj) {
837
837
  const keys = Object.keys(promisesObj);
@@ -1171,11 +1171,11 @@ function explicitlyAborted(x, startIndex = 0) {
1171
1171
  }
1172
1172
  return false;
1173
1173
  }
1174
- function prefixIssues(path13, issues) {
1174
+ function prefixIssues(path14, issues) {
1175
1175
  return issues.map((iss) => {
1176
1176
  var _a3;
1177
1177
  (_a3 = iss).path ?? (_a3.path = []);
1178
- iss.path.unshift(path13);
1178
+ iss.path.unshift(path14);
1179
1179
  return iss;
1180
1180
  });
1181
1181
  }
@@ -1637,16 +1637,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
1637
1637
  }
1638
1638
  function formatError(error62, mapper = (issue2) => issue2.message) {
1639
1639
  const fieldErrors = { _errors: [] };
1640
- const processError = (error63, path13 = []) => {
1640
+ const processError = (error63, path14 = []) => {
1641
1641
  for (const issue2 of error63.issues) {
1642
1642
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1643
- issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
1643
+ issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
1644
1644
  } else if (issue2.code === "invalid_key") {
1645
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1645
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
1646
1646
  } else if (issue2.code === "invalid_element") {
1647
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1647
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
1648
1648
  } else {
1649
- const fullpath = [...path13, ...issue2.path];
1649
+ const fullpath = [...path14, ...issue2.path];
1650
1650
  if (fullpath.length === 0) {
1651
1651
  fieldErrors._errors.push(mapper(issue2));
1652
1652
  } else {
@@ -1685,17 +1685,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
1685
1685
  }
1686
1686
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
1687
1687
  const result = { errors: [] };
1688
- const processError = (error63, path13 = []) => {
1688
+ const processError = (error63, path14 = []) => {
1689
1689
  var _a3;
1690
1690
  for (const issue2 of error63.issues) {
1691
1691
  if (issue2.code === "invalid_union" && issue2.errors.length) {
1692
- issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
1692
+ issue2.errors.map((issues) => processError({ issues }, [...path14, ...issue2.path]));
1693
1693
  } else if (issue2.code === "invalid_key") {
1694
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1694
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
1695
1695
  } else if (issue2.code === "invalid_element") {
1696
- processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1696
+ processError({ issues: issue2.issues }, [...path14, ...issue2.path]);
1697
1697
  } else {
1698
- const fullpath = [...path13, ...issue2.path];
1698
+ const fullpath = [...path14, ...issue2.path];
1699
1699
  if (fullpath.length === 0) {
1700
1700
  result.errors.push(mapper(issue2));
1701
1701
  continue;
@@ -1734,8 +1734,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
1734
1734
  }
1735
1735
  function toDotPath(_path) {
1736
1736
  const segs = [];
1737
- const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1738
- for (const seg of path13) {
1737
+ const path14 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1738
+ for (const seg of path14) {
1739
1739
  if (typeof seg === "number")
1740
1740
  segs.push(`[${seg}]`);
1741
1741
  else if (typeof seg === "symbol")
@@ -18873,13 +18873,13 @@ function resolveRef(ref, ctx) {
18873
18873
  if (!ref.startsWith("#")) {
18874
18874
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
18875
18875
  }
18876
- const path13 = ref.slice(1).split("/").filter(Boolean);
18877
- if (path13.length === 0) {
18876
+ const path14 = ref.slice(1).split("/").filter(Boolean);
18877
+ if (path14.length === 0) {
18878
18878
  return ctx.rootSchema;
18879
18879
  }
18880
18880
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
18881
- if (path13[0] === defsKey) {
18882
- const key = path13[1] === void 0 ? void 0 : decodeJSONPointerSegment(path13[1]);
18881
+ if (path14[0] === defsKey) {
18882
+ const key = path14[1] === void 0 ? void 0 : decodeJSONPointerSegment(path14[1]);
18883
18883
  if (!key || !ctx.defs[key]) {
18884
18884
  throw new Error(`Reference not found: ${ref}`);
18885
18885
  }
@@ -19918,7 +19918,11 @@ var BUILTIN_ROLE_AVATAR_IDS = [
19918
19918
  "security-otter",
19919
19919
  "audio-otter",
19920
19920
  "scholar-otter",
19921
- "data-otter"
19921
+ "data-otter",
19922
+ "advisor-otter",
19923
+ "builder-otter",
19924
+ "wizard-otter",
19925
+ "sailor-otter"
19922
19926
  ];
19923
19927
  var builtinRoleAvatarSchema = external_exports.templateLiteral([
19924
19928
  "builtin:",
@@ -20684,7 +20688,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
20684
20688
  default: external_exports.string().optional()
20685
20689
  })
20686
20690
  ]).superRefine((field2, ctx) => {
20687
- const issue2 = (path13, message) => ctx.addIssue({ code: "custom", path: [path13], message });
20691
+ const issue2 = (path14, message) => ctx.addIssue({ code: "custom", path: [path14], message });
20688
20692
  if (field2.type === "number" || field2.type === "range") {
20689
20693
  const { min = -Infinity, max = Infinity, default: value } = field2;
20690
20694
  if (min > max)
@@ -20790,16 +20794,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
20790
20794
  var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
20791
20795
  var hostExtensionDigestSchema = desktopExtensionHashSchema;
20792
20796
  var hostExtensionActivationIdSchema = external_exports.uuid();
20793
- 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((path13) => path13.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
20797
+ 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((path14) => path14.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
20794
20798
  var legacy = desktopExtensionManifestSchema.shape;
20795
20799
  var localized = (max, min = 0) => external_exports.strictObject({
20796
20800
  en: external_exports.string().trim().min(min).max(max),
20797
20801
  "zh-CN": external_exports.string().trim().min(min).max(max)
20798
20802
  });
20799
- var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path13) => path13.endsWith(suffix), `Expected a ${suffix} file`);
20803
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path14) => path14.endsWith(suffix), `Expected a ${suffix} file`);
20800
20804
  var moduleEntry = resourceWithSuffix(".mjs");
20801
20805
  var style = resourceWithSuffix(".css").optional();
20802
- var hostExtensionCanonicalPath = (path13) => path13.normalize("NFC").toLowerCase();
20806
+ var hostExtensionCanonicalPath = (path14) => path14.normalize("NFC").toLowerCase();
20803
20807
  var hostExtensionManifestV2Schema = external_exports.strictObject({
20804
20808
  manifestVersion: external_exports.literal(2),
20805
20809
  id: hostExtensionIdSchema,
@@ -20809,8 +20813,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
20809
20813
  details: localized(16384).optional(),
20810
20814
  author: legacy.author,
20811
20815
  repository: legacy.repository,
20812
- icon: legacy.icon.refine((path13) => path13 === void 0 || hostExtensionResourcePathSchema.safeParse(path13).success),
20813
- screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path13) => hostExtensionResourcePathSchema.safeParse(path13).success)),
20816
+ icon: legacy.icon.refine((path14) => path14 === void 0 || hostExtensionResourcePathSchema.safeParse(path14).success),
20817
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path14) => hostExtensionResourcePathSchema.safeParse(path14).success)),
20814
20818
  categories: legacy.categories,
20815
20819
  settingsSchema: legacy.settingsSchema,
20816
20820
  slots: legacy.slots.removeDefault().optional(),
@@ -20936,7 +20940,7 @@ var active = {
20936
20940
  digest: hostExtensionDigestSchema
20937
20941
  };
20938
20942
  var optionalActivation = { ...id, activationId: active.activationId.optional() };
20939
- var filePath = external_exports.string().min(1).max(4096).refine((path13) => /^(?:\/|[a-z]:[/\\])/iu.test(path13) && !path13.includes("\0") && !path13.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
20943
+ var filePath = external_exports.string().min(1).max(4096).refine((path14) => /^(?:\/|[a-z]:[/\\])/iu.test(path14) && !path14.includes("\0") && !path14.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
20940
20944
  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");
20941
20945
  function base643(maxBytes) {
20942
20946
  return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
@@ -21136,6 +21140,7 @@ var hostExtensionsRpcSchemas = {
21136
21140
  // ../../shared-contracts/dist/group-chat.js
21137
21141
  var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
21138
21142
  var MAX_GROUP_AGENT_HOPS = 20;
21143
+ var GROUP_NOTICE_MAX_LENGTH = 2e3;
21139
21144
  var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
21140
21145
  var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
21141
21146
  var groupMemberIdSchema = external_exports.uuidv4();
@@ -21162,11 +21167,16 @@ var groupMemberSchema = external_exports.object({
21162
21167
  roleSnapshot: threadRoleSnapshotSchema.optional(),
21163
21168
  harnessId: harnessIdSchema,
21164
21169
  status: groupMemberStatusSchema,
21170
+ projectless: external_exports.boolean().optional(),
21165
21171
  joinedAtSeq: nonnegativeInteger,
21166
21172
  lastDeliveredSeq: nonnegativeInteger,
21167
21173
  lastRosterVersion: nonnegativeInteger,
21168
21174
  createdAt: timestamp
21169
21175
  });
21176
+ var groupProjectlessWorkspaceSchema = external_exports.object({
21177
+ workspaceRoot: nonblankString,
21178
+ outputDirectory: nonblankString
21179
+ });
21170
21180
  var groupRoomRemoteHostSchema = external_exports.object({
21171
21181
  hostId: nonblankString,
21172
21182
  displayName: nonblankString,
@@ -21178,6 +21188,7 @@ var groupRoomSchema = external_exports.object({
21178
21188
  roomId: groupRoomIdSchema,
21179
21189
  title: nonblankString,
21180
21190
  defaultCwd: nonblankString,
21191
+ projectlessWorkspace: groupProjectlessWorkspaceSchema.optional(),
21181
21192
  unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
21182
21193
  allowAgentMentions: external_exports.boolean().default(true),
21183
21194
  maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
@@ -21258,8 +21269,10 @@ var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
21258
21269
  var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
21259
21270
  var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
21260
21271
  var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
21272
+ var GROUPS_REBIND_MEMBER_METHOD = "codexhost/groups/member/rebind";
21261
21273
  var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
21262
21274
  var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
21275
+ var GROUPS_INSPECT_CWD_METHOD = "codexhost/groups/cwd/inspect";
21263
21276
  var roomIdentity = { roomId: groupRoomIdSchema };
21264
21277
  var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
21265
21278
  var roomEdits = {
@@ -21282,7 +21295,7 @@ var groupsGetResultSchema = external_exports.object({
21282
21295
  });
21283
21296
  var groupsCreateParamsSchema = external_exports.strictObject({
21284
21297
  ...roomEdits,
21285
- defaultCwd: nonblankString,
21298
+ defaultCwd: nonblankString.optional(),
21286
21299
  members: external_exports.array(groupCreateMemberInputSchema)
21287
21300
  });
21288
21301
  var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
@@ -21308,14 +21321,90 @@ var groupsUpdateMemberParamsSchema = external_exports.strictObject({
21308
21321
  status: groupMemberStatusSchema.optional()
21309
21322
  });
21310
21323
  var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
21324
+ var groupsRebindMemberParamsSchema = external_exports.strictObject({
21325
+ ...memberIdentity,
21326
+ threadId: hostThreadIdSchema,
21327
+ redeliverFrom: positiveInteger.optional(),
21328
+ note: external_exports.string().optional()
21329
+ });
21330
+ var groupCliRebindMemberParamsSchema = external_exports.strictObject({
21331
+ ...roomIdentity,
21332
+ memberId: groupMemberIdSchema.optional(),
21333
+ memberHandle: groupMemberHandleSchema.optional(),
21334
+ threadId: hostThreadIdSchema,
21335
+ redeliverFrom: positiveInteger.optional(),
21336
+ note: external_exports.string().optional()
21337
+ }).refine((value) => value.memberId !== void 0 !== (value.memberHandle !== void 0), "Provide exactly one of memberId or memberHandle");
21338
+ var groupsRebindMemberResultSchema = external_exports.object({
21339
+ room: groupRoomSchema,
21340
+ member: groupMemberSchema,
21341
+ previousThreadId: hostThreadIdSchema,
21342
+ awakened: external_exports.boolean()
21343
+ });
21344
+ var groupCliListMemberSchema = external_exports.object({
21345
+ memberId: groupMemberIdSchema,
21346
+ threadId: hostThreadIdSchema,
21347
+ handle: groupMemberHandleSchema,
21348
+ displayName: nonblankString,
21349
+ status: groupMemberStatusSchema,
21350
+ harnessId: harnessIdSchema,
21351
+ roleSlug: roleSlugSchema.optional(),
21352
+ roleName: nonblankString.optional()
21353
+ });
21354
+ var groupCliListEntrySchema = external_exports.object({
21355
+ roomId: groupRoomIdSchema,
21356
+ title: nonblankString,
21357
+ memberCount: nonnegativeInteger,
21358
+ updatedAt: timestamp,
21359
+ member: groupCliListMemberSchema.optional()
21360
+ });
21361
+ var groupCliListParamsSchema = external_exports.strictObject({
21362
+ threadId: hostThreadIdSchema.optional()
21363
+ });
21364
+ var groupCliListResultSchema = external_exports.object({
21365
+ rooms: external_exports.array(groupCliListEntrySchema)
21366
+ });
21311
21367
  var groupsPostMessageParamsSchema = external_exports.strictObject({
21312
21368
  ...roomIdentity,
21313
21369
  content: external_exports.string().max(64e3),
21314
21370
  attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
21315
21371
  replyToSeq: positiveInteger.optional(),
21316
21372
  targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
21317
- mentionAll: external_exports.boolean().optional()
21318
- }).refine((value) => value.content.trim().length > 0 || (value.attachments?.length ?? 0) > 0, "Message content or at least one attachment is required");
21373
+ mentionAll: external_exports.boolean().optional(),
21374
+ notice: external_exports.boolean().optional()
21375
+ }).superRefine((value, context) => {
21376
+ if (value.notice === true) {
21377
+ if (value.content.trim().length === 0) {
21378
+ context.addIssue({
21379
+ code: "custom",
21380
+ path: ["content"],
21381
+ message: "Notice content is required"
21382
+ });
21383
+ }
21384
+ if (value.content.length > GROUP_NOTICE_MAX_LENGTH) {
21385
+ context.addIssue({
21386
+ code: "custom",
21387
+ path: ["content"],
21388
+ message: `Notice content must be at most ${GROUP_NOTICE_MAX_LENGTH} characters`
21389
+ });
21390
+ }
21391
+ if ((value.targetMemberIds?.length ?? 0) > 0 || value.mentionAll === true || (value.attachments?.length ?? 0) > 0) {
21392
+ context.addIssue({
21393
+ code: "custom",
21394
+ path: ["notice"],
21395
+ message: "System notices cannot target members or include attachments"
21396
+ });
21397
+ }
21398
+ return;
21399
+ }
21400
+ if (value.content.trim().length === 0 && (value.attachments?.length ?? 0) === 0) {
21401
+ context.addIssue({
21402
+ code: "custom",
21403
+ path: ["content"],
21404
+ message: "Message content or at least one attachment is required"
21405
+ });
21406
+ }
21407
+ });
21319
21408
  var groupsPostMessageResultSchema = external_exports.object({
21320
21409
  room: groupRoomSchema,
21321
21410
  message: groupMessageSchema,
@@ -21332,6 +21421,13 @@ var groupsReadMessagesResultSchema = external_exports.object({
21332
21421
  messages: external_exports.array(groupMessageSchema),
21333
21422
  totalSeq: nonnegativeInteger
21334
21423
  });
21424
+ var groupsInspectCwdParamsSchema = external_exports.strictObject({
21425
+ cwd: nonblankString,
21426
+ roomId: groupRoomIdSchema.optional()
21427
+ });
21428
+ var groupsInspectCwdResultSchema = external_exports.object({
21429
+ isGitRepo: external_exports.boolean()
21430
+ });
21335
21431
 
21336
21432
  // ../../shared-contracts/dist/thread-archive-confirm.js
21337
21433
  var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
@@ -21378,6 +21474,7 @@ var TELEMETRY_OFFICIAL_HARNESSES = [
21378
21474
  "kiro-cli",
21379
21475
  "codebuddy",
21380
21476
  "workbuddy",
21477
+ "workbuddy-cn",
21381
21478
  "devin",
21382
21479
  "hermes",
21383
21480
  "qoder",
@@ -21517,8 +21614,10 @@ var CLIENT_CHANNEL_METHODS = [
21517
21614
  GROUPS_ADD_MEMBER_METHOD,
21518
21615
  GROUPS_UPDATE_MEMBER_METHOD,
21519
21616
  GROUPS_REMOVE_MEMBER_METHOD,
21617
+ GROUPS_REBIND_MEMBER_METHOD,
21520
21618
  GROUPS_POST_MESSAGE_METHOD,
21521
21619
  GROUPS_READ_MESSAGES_METHOD,
21620
+ GROUPS_INSPECT_CWD_METHOD,
21522
21621
  "codexhost/voice/status",
21523
21622
  "codexhost/voice/transcribe",
21524
21623
  "codexhost/harness/display-settings/get",
@@ -22083,7 +22182,23 @@ var REMOTE_PEER_ID_PATTERN = /^[a-zA-Z0-9_-]{1,64}$/u;
22083
22182
  var remotePeerIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
22084
22183
  var remotePeerNodeIdSchema = external_exports.string().regex(REMOTE_PEER_ID_PATTERN);
22085
22184
  var remotePeerHostIdSchema = external_exports.string().regex(/^remote-peer:[a-zA-Z0-9_-]{1,64}$/u);
22086
- var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "custom"]);
22185
+ var remotePeerTransportKindSchema = external_exports.enum(["relay", "tailscale", "lan", "ssh", "custom"]);
22186
+ var remotePeerSshAuthModeSchema = external_exports.enum(["auto", "key", "password"]);
22187
+ var remotePeerSshConfigSchema = external_exports.object({
22188
+ host: external_exports.string().trim().min(1).max(255),
22189
+ port: external_exports.number().int().min(1).max(65535).optional(),
22190
+ user: external_exports.string().trim().min(1).max(128).optional(),
22191
+ identityFile: external_exports.string().trim().min(1).max(1024).optional(),
22192
+ authMode: remotePeerSshAuthModeSchema.default("auto"),
22193
+ remoteDataDir: external_exports.string().trim().min(1).max(1024).optional()
22194
+ });
22195
+ var remotePeerSshSummarySchema = external_exports.object({
22196
+ host: external_exports.string().min(1).max(255),
22197
+ port: external_exports.number().int().min(1).max(65535).optional(),
22198
+ user: external_exports.string().min(1).max(128).optional(),
22199
+ authMode: remotePeerSshAuthModeSchema,
22200
+ keyInstalled: external_exports.boolean().optional()
22201
+ });
22087
22202
  var REMOTE_PEER_COLORS = [
22088
22203
  "blue",
22089
22204
  "purple",
@@ -22110,6 +22225,7 @@ var remotePeerSummarySchema = external_exports.object({
22110
22225
  color: remotePeerColorSchema.optional(),
22111
22226
  origin: external_exports.string().min(1).max(2048),
22112
22227
  transportKind: remotePeerTransportKindSchema,
22228
+ ssh: remotePeerSshSummarySchema.optional(),
22113
22229
  encrypted: external_exports.boolean(),
22114
22230
  enabled: external_exports.boolean(),
22115
22231
  state: remotePeerStateSchema,
@@ -22357,8 +22473,66 @@ var delegationHostHarnessOptionSchema = external_exports.object({
22357
22473
  var delegationHostHarnessesResultSchema = external_exports.object({
22358
22474
  harnesses: external_exports.array(delegationHostHarnessOptionSchema)
22359
22475
  });
22476
+ var sshConfigHostEntrySchema = external_exports.object({
22477
+ alias: external_exports.string().min(1).max(255),
22478
+ hostName: external_exports.string().max(255).optional(),
22479
+ user: external_exports.string().max(128).optional(),
22480
+ port: external_exports.number().int().min(1).max(65535).optional(),
22481
+ identityFile: external_exports.string().max(1024).optional()
22482
+ });
22483
+ var remotePeerListSshConfigHostsResultSchema = external_exports.object({
22484
+ hosts: external_exports.array(sshConfigHostEntrySchema)
22485
+ });
22486
+ var remotePeerSshConnectParamsSchema = external_exports.object({
22487
+ host: external_exports.string().trim().min(1).max(255),
22488
+ port: external_exports.number().int().min(1).max(65535).optional(),
22489
+ user: external_exports.string().trim().min(1).max(128).optional(),
22490
+ identityFile: external_exports.string().trim().min(1).max(1024).optional(),
22491
+ authMode: remotePeerSshAuthModeSchema.default("auto"),
22492
+ password: external_exports.string().max(1024).optional(),
22493
+ installAuthorizedKey: external_exports.boolean().optional(),
22494
+ name: external_exports.string().trim().min(1).max(120).optional(),
22495
+ color: remotePeerColorSchema.optional(),
22496
+ remoteDataDir: external_exports.string().trim().min(1).max(1024).optional(),
22497
+ sessionId: external_exports.string().min(1).max(128).optional()
22498
+ });
22499
+ var remotePeerSshTestResultSchema = external_exports.object({
22500
+ ok: external_exports.boolean(),
22501
+ codexhostInstalled: external_exports.boolean(),
22502
+ version: external_exports.string().max(128).optional(),
22503
+ nodeId: remotePeerNodeIdSchema.optional(),
22504
+ platform: external_exports.string().max(64).optional(),
22505
+ hostname: external_exports.string().max(255).optional(),
22506
+ latencyMs: external_exports.number().int().nonnegative().optional(),
22507
+ errorCode: external_exports.string().max(128).optional(),
22508
+ error: external_exports.string().max(1e3).optional()
22509
+ });
22510
+ var remotePeerSshInstallResultSchema = external_exports.object({
22511
+ ok: external_exports.boolean(),
22512
+ version: external_exports.string().max(128).optional(),
22513
+ message: external_exports.string().max(1e3).optional()
22514
+ });
22515
+ var remotePeerSshAuthPromptSchema = external_exports.object({
22516
+ promptId: external_exports.string().min(1).max(128),
22517
+ sessionId: external_exports.string().min(1).max(128).optional(),
22518
+ peerId: remotePeerIdSchema.optional(),
22519
+ host: external_exports.string().min(1).max(255),
22520
+ kind: external_exports.enum(["host-key", "password", "passphrase", "otp", "generic"]),
22521
+ prompt: external_exports.string().min(1).max(1e3),
22522
+ echo: external_exports.boolean()
22523
+ });
22524
+ var remotePeerSshRespondAuthParamsSchema = external_exports.object({
22525
+ promptId: external_exports.string().min(1).max(128),
22526
+ sessionId: external_exports.string().min(1).max(128).optional(),
22527
+ response: external_exports.string().max(1024).optional(),
22528
+ cancel: external_exports.boolean().optional()
22529
+ });
22360
22530
 
22361
22531
  // ../../shared-contracts/dist/peer-delegation.js
22532
+ var peerWatchNudgeParamsSchema = external_exports.strictObject({
22533
+ hostId: remotePeerHostIdSchema,
22534
+ threadId: external_exports.string().min(1).max(1024).optional()
22535
+ });
22362
22536
  var PEER_DELEGATION_BRIDGE_VERSION = 1;
22363
22537
  var PEER_DELEGATION_OPERATIONS = [
22364
22538
  "listHarnesses",
@@ -22542,11 +22716,12 @@ var delegationDefaultsSchema = external_exports.strictObject({
22542
22716
  byHarness: external_exports.record(preferenceHarnessKey, harnessDelegationDefaultSchema)
22543
22717
  });
22544
22718
  var modelId = external_exports.string().min(1).max(1024);
22545
- var harnessPreferenceValuesSchema = external_exports.strictObject({
22719
+ var harnessPreferenceValuesSchema = external_exports.object({
22546
22720
  idleRelease: idleReleaseSettingsSchema.optional(),
22547
22721
  favorites: external_exports.record(preferenceHarnessKey, external_exports.array(modelId).max(2048)).default({}),
22548
22722
  newThread: newThreadDefaultsSchema.optional(),
22549
- delegation: delegationDefaultsSchema.optional()
22723
+ delegation: delegationDefaultsSchema.optional(),
22724
+ showGroupChatsInSidebar: external_exports.boolean().optional()
22550
22725
  });
22551
22726
  var harnessPreferenceSnapshotSchema = external_exports.strictObject({
22552
22727
  scope: harnessPreferenceScopeSchema,
@@ -22579,6 +22754,10 @@ var harnessPreferenceOperationSchema = external_exports.discriminatedUnion("kind
22579
22754
  kind: external_exports.literal("delegation"),
22580
22755
  harnessId: harnessIdSchema,
22581
22756
  configuration: harnessDelegationDefaultSchema.nullable()
22757
+ }),
22758
+ external_exports.strictObject({
22759
+ kind: external_exports.literal("groupChatsSidebar"),
22760
+ visible: external_exports.boolean()
22582
22761
  })
22583
22762
  ]);
22584
22763
  var harnessPreferencePatchSchema = external_exports.strictObject({
@@ -23415,7 +23594,7 @@ var THREAD_WATCH_NOTICE_OUTCOMES = [
23415
23594
  "unreadable",
23416
23595
  "notFound"
23417
23596
  ];
23418
- var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
23597
+ var ENTRY_PATTERN = new RegExp(String.raw`^- \[([^\]\n]+)\]\(thread://([^\s()<>"?#/]+)(?:\?hostId=([^\s()<>"?#/&]+))?\): ` + `(${THREAD_WATCH_NOTICE_OUTCOMES.join("|")})(?:. (.+))?$`, "u");
23419
23598
 
23420
23599
  // ../../shared-contracts/dist/remote-runtime.js
23421
23600
  var remoteUpdatePhaseSchema = external_exports.enum([
@@ -23444,7 +23623,7 @@ var remoteSshSetupParamsSchema = external_exports.object({
23444
23623
  hostname: external_exports.string().min(1).max(1024).refine((value) => !value.startsWith("-") && !/\s/u.test(value)),
23445
23624
  port: external_exports.number().int().min(1).max(65535).nullable(),
23446
23625
  identity: external_exports.string().max(4096).nullable(),
23447
- action: external_exports.enum(["inspect", "install", "update", "repair", "uninstall"]),
23626
+ action: external_exports.enum(["inspect", "install", "update", "restart", "repair", "uninstall"]),
23448
23627
  uninstallPackage: external_exports.boolean().optional(),
23449
23628
  version: external_exports.string().regex(/^\d+\.\d+\.\d+$/u).nullable()
23450
23629
  }).strict();
@@ -23460,6 +23639,7 @@ var target = {
23460
23639
  var thread2 = { ...target, threadId: identity };
23461
23640
  var text = external_exports.string().min(1).max(8e3);
23462
23641
  var input2 = { text, requestId: identity };
23642
+ var queueReorderItemIdsSchema = external_exports.array(identity).min(2).max(100).refine((ids) => new Set(ids).size === ids.length, "Queued submission IDs must be distinct");
23463
23643
  var remoteDeliveryReplySchema = external_exports.discriminatedUnion("accepted", [
23464
23644
  external_exports.object({ accepted: external_exports.literal(true), startQueuedItemId: identity.optional() }),
23465
23645
  external_exports.object({
@@ -23479,6 +23659,7 @@ var remoteQueueSnapshotSchema = external_exports.discriminatedUnion("available",
23479
23659
  external_exports.object({ available: external_exports.literal(false) }),
23480
23660
  external_exports.object({
23481
23661
  available: external_exports.literal(true),
23662
+ canReorder: external_exports.literal(true).optional(),
23482
23663
  items: external_exports.array(external_exports.object({ id: identity, clientUserMessageId: identity, preview: external_exports.string().max(801) })).max(100)
23483
23664
  })
23484
23665
  ]);
@@ -23556,6 +23737,7 @@ var remoteSessionOperationSchema = external_exports.discriminatedUnion("kind", [
23556
23737
  external_exports.strictObject({ kind: external_exports.literal("enqueue"), ...input2 }),
23557
23738
  external_exports.strictObject({ kind: external_exports.literal("steer"), ...input2, turnId: identity }),
23558
23739
  external_exports.strictObject({ kind: external_exports.literal("remove"), itemId: identity }),
23740
+ external_exports.strictObject({ kind: external_exports.literal("reorder"), itemIds: queueReorderItemIdsSchema }),
23559
23741
  external_exports.strictObject({
23560
23742
  kind: external_exports.literal("start"),
23561
23743
  itemId: identity,
@@ -25547,7 +25729,7 @@ var BrokeredHarnessAdapter = class {
25547
25729
  };
25548
25730
 
25549
25731
  // ../codebuddy/dist/usage-statistics.js
25550
- import path4 from "node:path";
25732
+ import path7 from "node:path";
25551
25733
 
25552
25734
  // ../../harness-adapter/dist/usage-statistics.js
25553
25735
  import { createReadStream } from "node:fs";
@@ -25723,10 +25905,338 @@ function nativeTimeMs(value) {
25723
25905
  import { createHash } from "node:crypto";
25724
25906
  import { realpathSync } from "node:fs";
25725
25907
  import { access, readdir as readdir2, realpath as realpath2 } from "node:fs/promises";
25726
- import { homedir } from "node:os";
25727
- import path3 from "node:path";
25908
+ import { homedir as homedir2 } from "node:os";
25909
+ import path6 from "node:path";
25728
25910
  import { isDeepStrictEqual } from "node:util";
25729
25911
 
25912
+ // ../../harness-discovery/dist/environment.js
25913
+ import fs from "node:fs";
25914
+ import path3 from "node:path";
25915
+ function targetPath(platform) {
25916
+ return platform === "win32" ? path3.win32 : path3.posix;
25917
+ }
25918
+ function environmentValue(environment, name) {
25919
+ const lowered = name.toLowerCase();
25920
+ for (const [key, value] of Object.entries(environment)) {
25921
+ if (key.toLowerCase() === lowered)
25922
+ return value;
25923
+ }
25924
+ return void 0;
25925
+ }
25926
+ function pathDelimiter(platform) {
25927
+ return platform === "win32" ? ";" : ":";
25928
+ }
25929
+ function pathDirectories(environment, platform) {
25930
+ return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
25931
+ }
25932
+ function executableExtensions(command, platform, environment) {
25933
+ if (platform !== "win32")
25934
+ return [""];
25935
+ if (targetPath(platform).extname(command) !== "")
25936
+ return [""];
25937
+ return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
25938
+ }
25939
+ function isExecutableFile(filePath2, platform) {
25940
+ try {
25941
+ fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
25942
+ return fs.statSync(filePath2).isFile();
25943
+ } catch {
25944
+ return false;
25945
+ }
25946
+ }
25947
+ function isDirectory(candidate) {
25948
+ try {
25949
+ return fs.statSync(candidate).isDirectory();
25950
+ } catch {
25951
+ return false;
25952
+ }
25953
+ }
25954
+ function subdirectoryNames(directory) {
25955
+ try {
25956
+ return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
25957
+ } catch {
25958
+ return [];
25959
+ }
25960
+ }
25961
+ function newestFirst(names) {
25962
+ return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
25963
+ }
25964
+
25965
+ // ../../harness-discovery/dist/invocation.js
25966
+ import path4 from "node:path";
25967
+ function commandInvocation(command, arguments_, environment, platform = process.platform) {
25968
+ const extension = path4.win32.extname(command).toLowerCase();
25969
+ if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
25970
+ return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
25971
+ }
25972
+ const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
25973
+ const commandLine = [command, ...arguments_].map(quote).join(" ");
25974
+ return {
25975
+ command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
25976
+ arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
25977
+ windowsVerbatimArguments: true
25978
+ };
25979
+ }
25980
+
25981
+ // ../../harness-discovery/dist/node-runtime.js
25982
+ import path5 from "node:path";
25983
+ function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
25984
+ const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
25985
+ const delimiter = platform === "win32" ? ";" : ":";
25986
+ const runtimeDirectory = path5.dirname(runtimeExecutable);
25987
+ const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
25988
+ const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
25989
+ if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
25990
+ directories.push(runtimeDirectory);
25991
+ }
25992
+ return { ...environment, [pathKey]: directories.join(delimiter) };
25993
+ }
25994
+
25995
+ // ../../harness-discovery/dist/resolve.js
25996
+ import os2 from "node:os";
25997
+
25998
+ // ../../harness-discovery/dist/version-managers.js
25999
+ function versionManagerBinaryDirectories(context) {
26000
+ const { platform, environment, home } = context;
26001
+ const list = context.subdirectories ?? subdirectoryNames;
26002
+ const pathFlavor = targetPath(platform);
26003
+ const value = (name) => environmentValue(environment, name);
26004
+ const directories = [];
26005
+ const versioned = (root, ...tail) => {
26006
+ for (const version2 of newestFirst(list(root))) {
26007
+ directories.push(pathFlavor.join(root, version2, ...tail));
26008
+ }
26009
+ };
26010
+ if (platform === "win32") {
26011
+ const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
26012
+ const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
26013
+ versioned(pathFlavor.join(appData, "nvm"));
26014
+ versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
26015
+ directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
26016
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
26017
+ const pnpmHome2 = value("PNPM_HOME");
26018
+ if (pnpmHome2)
26019
+ directories.push(pnpmHome2);
26020
+ directories.push(pathFlavor.join(localAppData, "pnpm"));
26021
+ return directories;
26022
+ }
26023
+ versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
26024
+ const fnmRoots = [
26025
+ value("FNM_DIR"),
26026
+ pathFlavor.join(home, ".local", "share", "fnm"),
26027
+ pathFlavor.join(home, "Library", "Application Support", "fnm")
26028
+ ].filter((root) => root !== void 0);
26029
+ for (const root of fnmRoots) {
26030
+ versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
26031
+ }
26032
+ const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
26033
+ versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
26034
+ directories.push(pathFlavor.join(voltaHome, "bin"));
26035
+ const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
26036
+ versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
26037
+ directories.push(pathFlavor.join(asdfHome, "shims"));
26038
+ const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
26039
+ versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
26040
+ directories.push(pathFlavor.join(nodenvHome, "shims"));
26041
+ versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
26042
+ directories.push(pathFlavor.join(home, ".bun", "bin"));
26043
+ const pnpmHome = value("PNPM_HOME");
26044
+ if (pnpmHome)
26045
+ directories.push(pnpmHome);
26046
+ directories.push(pathFlavor.join(home, "Library", "pnpm"));
26047
+ directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
26048
+ for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
26049
+ for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
26050
+ directories.push(pathFlavor.join(prefix, formula, "bin"));
26051
+ }
26052
+ }
26053
+ return directories;
26054
+ }
26055
+
26056
+ // ../../harness-discovery/dist/resolve.js
26057
+ var VERSION_MANAGER_ROOTS = "<version-managers>";
26058
+ function installRootExtensions(platform) {
26059
+ return platform === "win32" ? [".exe", ".cmd"] : [""];
26060
+ }
26061
+ function resolveHomeDirectory(input3) {
26062
+ return input3.homeDirectory ?? environmentValue(input3.environment, "HOME") ?? environmentValue(input3.environment, "USERPROFILE") ?? os2.homedir();
26063
+ }
26064
+ function templateVariables(environment, platform, home) {
26065
+ const pathFlavor = targetPath(platform);
26066
+ return {
26067
+ HOME: home,
26068
+ USERPROFILE: home,
26069
+ APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
26070
+ LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
26071
+ };
26072
+ }
26073
+ function joinTemplate(platform, value) {
26074
+ const pathFlavor = targetPath(platform);
26075
+ const segments = value.split("/");
26076
+ const head = segments[0] ?? "";
26077
+ const tail = segments.slice(1);
26078
+ if (head === "")
26079
+ return pathFlavor.join(pathFlavor.sep, ...tail);
26080
+ return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
26081
+ }
26082
+ function expandInstallRoot(template, environment, platform, home) {
26083
+ const variables = templateVariables(environment, platform, home);
26084
+ let unresolved = false;
26085
+ const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
26086
+ const value = variables[name] ?? environmentValue(environment, name);
26087
+ if (value === void 0 || value === "") {
26088
+ unresolved = true;
26089
+ return "";
26090
+ }
26091
+ return value;
26092
+ });
26093
+ return unresolved ? void 0 : joinTemplate(platform, substituted);
26094
+ }
26095
+ function installRootDirectories(spec, input3, dependencies, platform, home) {
26096
+ const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
26097
+ const directories = [];
26098
+ for (const template of templates) {
26099
+ if (template === VERSION_MANAGER_ROOTS) {
26100
+ directories.push(...versionManagerBinaryDirectories({
26101
+ platform,
26102
+ environment: input3.environment,
26103
+ home,
26104
+ ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
26105
+ }));
26106
+ continue;
26107
+ }
26108
+ const directory = expandInstallRoot(template, input3.environment, platform, home);
26109
+ if (directory !== void 0)
26110
+ directories.push(directory);
26111
+ }
26112
+ return directories;
26113
+ }
26114
+ function harnessCandidates(spec, input3, dependencies = {}) {
26115
+ const platform = input3.platform ?? process.platform;
26116
+ const pathFlavor = targetPath(platform);
26117
+ const configured = input3.command ?? (spec.commandEnvironmentVariable ? environmentValue(input3.environment, spec.commandEnvironmentVariable) : void 0);
26118
+ const command = configured ?? spec.command;
26119
+ if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
26120
+ return [{ candidate: command, source: "configured" }];
26121
+ }
26122
+ const candidates = [];
26123
+ const extensions = executableExtensions(command, platform, input3.environment);
26124
+ for (const directory of pathDirectories(input3.environment, platform)) {
26125
+ for (const extension of extensions) {
26126
+ candidates.push({
26127
+ candidate: pathFlavor.join(directory, command + extension),
26128
+ source: "path"
26129
+ });
26130
+ }
26131
+ }
26132
+ if (configured !== void 0)
26133
+ return candidates;
26134
+ const home = resolveHomeDirectory(input3);
26135
+ for (const directory of installRootDirectories(spec, input3, dependencies, platform, home)) {
26136
+ for (const extension of installRootExtensions(platform)) {
26137
+ candidates.push({
26138
+ candidate: pathFlavor.join(directory, spec.command + extension),
26139
+ source: "install-root"
26140
+ });
26141
+ }
26142
+ }
26143
+ return candidates;
26144
+ }
26145
+ function resolveHarnessExecutable(spec, input3, dependencies = {}) {
26146
+ const platform = input3.platform ?? process.platform;
26147
+ const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
26148
+ const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
26149
+ const context = { platform, isExecutable };
26150
+ for (const { candidate, source } of harnessCandidates(spec, input3, dependencies)) {
26151
+ const executable = runnable(candidate, context);
26152
+ if (executable !== void 0 && isExecutable(executable))
26153
+ return { executable, source };
26154
+ }
26155
+ return void 0;
26156
+ }
26157
+
26158
+ // ../../harness-discovery/dist/installation.js
26159
+ import { execFile as execFile2 } from "node:child_process";
26160
+ import { homedir } from "node:os";
26161
+ function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
26162
+ const env = withNodeRuntimeOnPath(environment);
26163
+ const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
26164
+ return new Promise((resolve, reject) => {
26165
+ const child = execFile2(invocation.command, invocation.arguments, {
26166
+ env,
26167
+ cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir(),
26168
+ encoding: "utf8",
26169
+ timeout,
26170
+ killSignal: "SIGKILL",
26171
+ maxBuffer: 1024 * 1024,
26172
+ windowsHide: true,
26173
+ windowsVerbatimArguments: invocation.windowsVerbatimArguments
26174
+ }, (error62, stdout, stderr) => {
26175
+ if (error62)
26176
+ reject(new Error(error62.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
26177
+ else
26178
+ resolve((stdout || stderr).trim());
26179
+ });
26180
+ child.stdin?.end();
26181
+ });
26182
+ }
26183
+ function installationVersion(value) {
26184
+ if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
26185
+ throw new Error("Harness returned an invalid version");
26186
+ return value.trim().replace(/^v/, "");
26187
+ }
26188
+ function versionFromOutput(output2) {
26189
+ return installationVersion(output2.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
26190
+ }
26191
+ function newerInstallationVersion(current, latest) {
26192
+ const a = installationVersion(current).replace(/\+.*/, "");
26193
+ const b = installationVersion(latest).replace(/\+.*/, "");
26194
+ const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
26195
+ const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
26196
+ for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
26197
+ if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
26198
+ return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
26199
+ }
26200
+ const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
26201
+ const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
26202
+ if (!preA.length || !preB.length)
26203
+ return !!preA.length && !preB.length;
26204
+ for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
26205
+ const x = preA[i];
26206
+ const y = preB[i];
26207
+ if (x === y)
26208
+ continue;
26209
+ if (x === void 0 || y === void 0)
26210
+ return x === void 0;
26211
+ const numericX = /^\d+$/.test(x);
26212
+ const numericY = /^\d+$/.test(y);
26213
+ if (numericX && numericY) {
26214
+ if (BigInt(x) === BigInt(y))
26215
+ continue;
26216
+ return BigInt(y) > BigInt(x);
26217
+ }
26218
+ if (numericX !== numericY)
26219
+ return numericX;
26220
+ return y > x;
26221
+ }
26222
+ return false;
26223
+ }
26224
+ async function fetchInstallationText(url2) {
26225
+ const request = async () => {
26226
+ const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
26227
+ if (!response.ok)
26228
+ throw new Error("Could not check the latest Harness version");
26229
+ return response.text();
26230
+ };
26231
+ try {
26232
+ return await request();
26233
+ } catch (error62) {
26234
+ if (error62 instanceof DOMException && (error62.name === "AbortError" || error62.name === "TimeoutError"))
26235
+ throw error62;
26236
+ return request();
26237
+ }
26238
+ }
26239
+
25730
26240
  // ../codebuddy/dist/common.js
25731
26241
  var CODEBUDDY_ID = harnessIdSchema.parse("codebuddy");
25732
26242
  var CODEBUDDY_RUNTIME_PROFILE = {
@@ -26051,16 +26561,16 @@ var Diff = class {
26051
26561
  }
26052
26562
  }
26053
26563
  }
26054
- addToPath(path13, added, removed, oldPosInc, options) {
26055
- const last = path13.lastComponent;
26564
+ addToPath(path14, added, removed, oldPosInc, options) {
26565
+ const last = path14.lastComponent;
26056
26566
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
26057
26567
  return {
26058
- oldPos: path13.oldPos + oldPosInc,
26568
+ oldPos: path14.oldPos + oldPosInc,
26059
26569
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
26060
26570
  };
26061
26571
  } else {
26062
26572
  return {
26063
- oldPos: path13.oldPos + oldPosInc,
26573
+ oldPos: path14.oldPos + oldPosInc,
26064
26574
  lastComponent: { count: 1, added, removed, previousComponent: last }
26065
26575
  };
26066
26576
  }
@@ -26749,15 +27259,18 @@ function codeBuddyCanonicalCwd(cwd) {
26749
27259
  try {
26750
27260
  return realpathSync.native(cwd);
26751
27261
  } catch {
26752
- return path3.resolve(cwd);
27262
+ return path6.resolve(cwd);
26753
27263
  }
26754
27264
  }
26755
- function codeBuddyConfigRoot(environment, profile) {
26756
- const configuredRoot = profile.configDirectoryEnvironmentVariables.map((name) => environment[name]).find((value) => typeof value === "string" && value.trim().length > 0);
26757
- return configuredRoot || path3.join(environment.HOME || environment.USERPROFILE || homedir(), profile.defaultConfigDirectoryName);
27265
+ function codeBuddyConfigRoot(environment, profile, source) {
27266
+ const value = (name) => process.platform === "win32" ? environmentValue(environment, name) : environment[name];
27267
+ const configuredRoot = profile.configDirectoryEnvironmentVariables.map((name) => value(name)).find((value2) => typeof value2 === "string" && value2.trim().length > 0);
27268
+ const root = configuredRoot || path6.join(value("HOME") || value("USERPROFILE") || homedir2(), profile.defaultConfigDirectoryName);
27269
+ profile.validateConfigRoot?.(root, source);
27270
+ return root;
26758
27271
  }
26759
27272
  function codeBuddyPrimaryHistoryPath(cwd, ref, environment, profile = CODEBUDDY_RUNTIME_PROFILE) {
26760
- return path3.join(codeBuddyConfigRoot(environment, profile), "projects", codeBuddyProjectSlug(cwd, profile), `${ref.nativeSessionId}.jsonl`);
27273
+ return path6.join(codeBuddyConfigRoot(environment, profile), "projects", codeBuddyProjectSlug(cwd, profile), `${ref.nativeSessionId}.jsonl`);
26761
27274
  }
26762
27275
  function derivedLocator(ref) {
26763
27276
  const locator = record3(ref.locator);
@@ -26800,9 +27313,9 @@ async function sameCwd(left, right) {
26800
27313
  return process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
26801
27314
  }
26802
27315
  async function matchesAnyHistoricalCwd(value, candidates) {
26803
- const resolved = path3.resolve(value);
27316
+ const resolved = path6.resolve(value);
26804
27317
  for (const candidate of candidates) {
26805
- const other = path3.resolve(candidate);
27318
+ const other = path6.resolve(candidate);
26806
27319
  if (process.platform === "win32" ? resolved.toLowerCase() === other.toLowerCase() : resolved === other)
26807
27320
  return true;
26808
27321
  try {
@@ -26826,9 +27339,9 @@ async function codeBuddyLiveNativeHistory(cwd, ref, environment, profile = CODEB
26826
27339
  async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, profile, transaction) {
26827
27340
  validateNativeRef(ref, profile);
26828
27341
  const configRoot = codeBuddyConfigRoot(environment, profile);
26829
- const root = path3.join(configRoot, "projects");
27342
+ const root = path6.join(configRoot, "projects");
26830
27343
  const slug = codeBuddyProjectSlug(cwd, profile);
26831
- const primary = path3.join(root, slug, `${ref.nativeSessionId}.jsonl`);
27344
+ const primary = path6.join(root, slug, `${ref.nativeSessionId}.jsonl`);
26832
27345
  const provenance = derivedLocator(ref);
26833
27346
  let candidates = [];
26834
27347
  try {
@@ -26847,7 +27360,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
26847
27360
  for (const directory of directories) {
26848
27361
  if (!directory.isDirectory())
26849
27362
  continue;
26850
- const file3 = path3.join(root, directory.name, `${ref.nativeSessionId}.jsonl`);
27363
+ const file3 = path6.join(root, directory.name, `${ref.nativeSessionId}.jsonl`);
26851
27364
  try {
26852
27365
  await access(file3);
26853
27366
  candidates.push(file3);
@@ -26862,7 +27375,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
26862
27375
  const file2 = candidates[0];
26863
27376
  if (!file2)
26864
27377
  throw new CodeBuddyError("sessionNotFound", "Native Session history was not found");
26865
- if (profile.historyCapabilities?.fork && !transaction && path3.resolve(file2) !== path3.resolve(primary))
27378
+ if (profile.historyCapabilities?.fork && !transaction && path6.resolve(file2) !== path6.resolve(primary))
26866
27379
  throw new CodeBuddyError("invalidRequest", "Native Session is not stored in the requested working directory");
26867
27380
  const source = await readCodeBuddyVersionedText(file2, 64e6, "Native history exceeds the supported 64 MB snapshot size"), parsed = parseJsonl(source.contents, tolerateIncompleteTail);
26868
27381
  const checkedDirectories = /* @__PURE__ */ new Set();
@@ -26891,7 +27404,7 @@ async function codeBuddyHistory(cwd, ref, environment, tolerateIncompleteTail, p
26891
27404
  }
26892
27405
  }
26893
27406
  } else if (provenance) {
26894
- if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path3.resolve(file2) !== path3.resolve(primary))
27407
+ if (!await sameCwd(provenance.boundCwd, cwd) || provenance.targetProjectSlug !== slug || path6.resolve(file2) !== path6.resolve(primary))
26895
27408
  throw new CodeBuddyError("invalidRequest", "Derived Native Session target binding changed");
26896
27409
  const active2 = nativeHistoryRows(parsed.contents);
26897
27410
  if (provenance.inheritedPrefixRows > active2.length || nativeRowsDigest(active2.slice(0, provenance.inheritedPrefixRows)) !== provenance.inheritedPrefixSha256)
@@ -27454,8 +27967,11 @@ async function readCodeBuddyUsage(file2, signal) {
27454
27967
  function createCodeBuddyUsageStatistics(environment, profile) {
27455
27968
  return Object.freeze({
27456
27969
  // projects/<project>/<session>.jsonl and <session>/subagents/*.jsonl
27457
- listSources: (signal) => jsonlUsageSources(path4.join(codeBuddyConfigRoot(environment, profile), "projects"), 3, signal),
27458
- readSource: (id2, signal) => readCodeBuddyUsage(id2, signal)
27970
+ listSources: async (signal) => jsonlUsageSources(path7.join(codeBuddyConfigRoot(environment, profile), "projects"), 3, signal),
27971
+ readSource: async (id2, signal) => {
27972
+ codeBuddyConfigRoot(environment, profile, id2);
27973
+ return readCodeBuddyUsage(id2, signal);
27974
+ }
27459
27975
  });
27460
27976
  }
27461
27977
 
@@ -31697,334 +32213,6 @@ var CodeBuddyCopyCleanup = class {
31697
32213
  }
31698
32214
  };
31699
32215
 
31700
- // ../../harness-discovery/dist/environment.js
31701
- import fs from "node:fs";
31702
- import path5 from "node:path";
31703
- function targetPath(platform) {
31704
- return platform === "win32" ? path5.win32 : path5.posix;
31705
- }
31706
- function environmentValue(environment, name) {
31707
- const lowered = name.toLowerCase();
31708
- for (const [key, value] of Object.entries(environment)) {
31709
- if (key.toLowerCase() === lowered)
31710
- return value;
31711
- }
31712
- return void 0;
31713
- }
31714
- function pathDelimiter(platform) {
31715
- return platform === "win32" ? ";" : ":";
31716
- }
31717
- function pathDirectories(environment, platform) {
31718
- return (environmentValue(environment, "PATH") ?? "").split(pathDelimiter(platform)).map((directory) => directory.trim().replace(/^"|"$/gu, "")).filter(Boolean);
31719
- }
31720
- function executableExtensions(command, platform, environment) {
31721
- if (platform !== "win32")
31722
- return [""];
31723
- if (targetPath(platform).extname(command) !== "")
31724
- return [""];
31725
- return (environmentValue(environment, "PATHEXT") ?? ".COM;.EXE;.BAT;.CMD").split(";").map((extension) => extension.trim()).filter(Boolean);
31726
- }
31727
- function isExecutableFile(filePath2, platform) {
31728
- try {
31729
- fs.accessSync(filePath2, platform === "win32" ? fs.constants.F_OK : fs.constants.X_OK);
31730
- return fs.statSync(filePath2).isFile();
31731
- } catch {
31732
- return false;
31733
- }
31734
- }
31735
- function isDirectory(candidate) {
31736
- try {
31737
- return fs.statSync(candidate).isDirectory();
31738
- } catch {
31739
- return false;
31740
- }
31741
- }
31742
- function subdirectoryNames(directory) {
31743
- try {
31744
- return fs.readdirSync(directory, { withFileTypes: true }).filter((entry) => entry.isDirectory()).map((entry) => entry.name);
31745
- } catch {
31746
- return [];
31747
- }
31748
- }
31749
- function newestFirst(names) {
31750
- return [...names].sort((left, right) => right.localeCompare(left, void 0, { numeric: true }));
31751
- }
31752
-
31753
- // ../../harness-discovery/dist/invocation.js
31754
- import path6 from "node:path";
31755
- function commandInvocation(command, arguments_, environment, platform = process.platform) {
31756
- const extension = path6.win32.extname(command).toLowerCase();
31757
- if (platform !== "win32" || ![".cmd", ".bat"].includes(extension)) {
31758
- return { command, arguments: [...arguments_], windowsVerbatimArguments: false };
31759
- }
31760
- const quote = (value) => `"${value.replaceAll("%", "%%").replaceAll('"', '""')}"`;
31761
- const commandLine = [command, ...arguments_].map(quote).join(" ");
31762
- return {
31763
- command: environmentValue(environment, "ComSpec") ?? "cmd.exe",
31764
- arguments: ["/d", "/v:off", "/s", "/c", `"${commandLine}"`],
31765
- windowsVerbatimArguments: true
31766
- };
31767
- }
31768
-
31769
- // ../../harness-discovery/dist/node-runtime.js
31770
- import path7 from "node:path";
31771
- function withNodeRuntimeOnPath(environment, runtimeExecutable = process.execPath, platform = process.platform) {
31772
- const pathKey = Object.keys(environment).find((name) => name.toLowerCase() === "path") ?? "PATH";
31773
- const delimiter = platform === "win32" ? ";" : ":";
31774
- const runtimeDirectory = path7.dirname(runtimeExecutable);
31775
- const directories = (environment[pathKey] ?? "").split(delimiter).filter(Boolean);
31776
- const equal = platform === "win32" ? (value) => value.toLowerCase() : (value) => value;
31777
- if (!directories.some((directory) => equal(directory) === equal(runtimeDirectory))) {
31778
- directories.push(runtimeDirectory);
31779
- }
31780
- return { ...environment, [pathKey]: directories.join(delimiter) };
31781
- }
31782
-
31783
- // ../../harness-discovery/dist/resolve.js
31784
- import os2 from "node:os";
31785
-
31786
- // ../../harness-discovery/dist/version-managers.js
31787
- function versionManagerBinaryDirectories(context) {
31788
- const { platform, environment, home } = context;
31789
- const list = context.subdirectories ?? subdirectoryNames;
31790
- const pathFlavor = targetPath(platform);
31791
- const value = (name) => environmentValue(environment, name);
31792
- const directories = [];
31793
- const versioned = (root, ...tail) => {
31794
- for (const version2 of newestFirst(list(root))) {
31795
- directories.push(pathFlavor.join(root, version2, ...tail));
31796
- }
31797
- };
31798
- if (platform === "win32") {
31799
- const appData = value("APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming");
31800
- const localAppData = value("LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local");
31801
- versioned(pathFlavor.join(appData, "nvm"));
31802
- versioned(value("FNM_DIR") ?? pathFlavor.join(appData, "fnm", "node-versions"), "installation");
31803
- directories.push(pathFlavor.join(localAppData, "Volta", "bin"));
31804
- directories.push(pathFlavor.join(home, ".bun", "bin"));
31805
- const pnpmHome2 = value("PNPM_HOME");
31806
- if (pnpmHome2)
31807
- directories.push(pnpmHome2);
31808
- directories.push(pathFlavor.join(localAppData, "pnpm"));
31809
- return directories;
31810
- }
31811
- versioned(pathFlavor.join(value("NVM_DIR") ?? pathFlavor.join(home, ".nvm"), "versions", "node"), "bin");
31812
- const fnmRoots = [
31813
- value("FNM_DIR"),
31814
- pathFlavor.join(home, ".local", "share", "fnm"),
31815
- pathFlavor.join(home, "Library", "Application Support", "fnm")
31816
- ].filter((root) => root !== void 0);
31817
- for (const root of fnmRoots) {
31818
- versioned(pathFlavor.join(root, "node-versions"), "installation", "bin");
31819
- }
31820
- const voltaHome = value("VOLTA_HOME") ?? pathFlavor.join(home, ".volta");
31821
- versioned(pathFlavor.join(voltaHome, "tools", "image", "node"), "bin");
31822
- directories.push(pathFlavor.join(voltaHome, "bin"));
31823
- const asdfHome = value("ASDF_DATA_DIR") ?? pathFlavor.join(home, ".asdf");
31824
- versioned(pathFlavor.join(asdfHome, "installs", "nodejs"), "bin");
31825
- directories.push(pathFlavor.join(asdfHome, "shims"));
31826
- const nodenvHome = value("NODENV_ROOT") ?? pathFlavor.join(home, ".nodenv");
31827
- versioned(pathFlavor.join(nodenvHome, "versions"), "bin");
31828
- directories.push(pathFlavor.join(nodenvHome, "shims"));
31829
- versioned(pathFlavor.join(value("N_PREFIX") ?? "/usr/local", "n", "versions", "node"), "bin");
31830
- directories.push(pathFlavor.join(home, ".bun", "bin"));
31831
- const pnpmHome = value("PNPM_HOME");
31832
- if (pnpmHome)
31833
- directories.push(pnpmHome);
31834
- directories.push(pathFlavor.join(home, "Library", "pnpm"));
31835
- directories.push(pathFlavor.join(home, ".local", "share", "pnpm"));
31836
- for (const prefix of ["/opt/homebrew/opt", "/usr/local/opt"]) {
31837
- for (const formula of newestFirst(list(prefix).filter((name) => name.startsWith("node@")))) {
31838
- directories.push(pathFlavor.join(prefix, formula, "bin"));
31839
- }
31840
- }
31841
- return directories;
31842
- }
31843
-
31844
- // ../../harness-discovery/dist/resolve.js
31845
- var VERSION_MANAGER_ROOTS = "<version-managers>";
31846
- function installRootExtensions(platform) {
31847
- return platform === "win32" ? [".exe", ".cmd"] : [""];
31848
- }
31849
- function resolveHomeDirectory(input3) {
31850
- return input3.homeDirectory ?? environmentValue(input3.environment, "HOME") ?? environmentValue(input3.environment, "USERPROFILE") ?? os2.homedir();
31851
- }
31852
- function templateVariables(environment, platform, home) {
31853
- const pathFlavor = targetPath(platform);
31854
- return {
31855
- HOME: home,
31856
- USERPROFILE: home,
31857
- APPDATA: environmentValue(environment, "APPDATA") ?? pathFlavor.join(home, "AppData", "Roaming"),
31858
- LOCALAPPDATA: environmentValue(environment, "LOCALAPPDATA") ?? pathFlavor.join(home, "AppData", "Local")
31859
- };
31860
- }
31861
- function joinTemplate(platform, value) {
31862
- const pathFlavor = targetPath(platform);
31863
- const segments = value.split("/");
31864
- const head = segments[0] ?? "";
31865
- const tail = segments.slice(1);
31866
- if (head === "")
31867
- return pathFlavor.join(pathFlavor.sep, ...tail);
31868
- return tail.length === 0 ? head : pathFlavor.join(head, ...tail);
31869
- }
31870
- function expandInstallRoot(template, environment, platform, home) {
31871
- const variables = templateVariables(environment, platform, home);
31872
- let unresolved = false;
31873
- const substituted = template.replace(/^~(?=\/|$)/u, home).replace(/\$\{(\w+)\}/gu, (_match, name) => {
31874
- const value = variables[name] ?? environmentValue(environment, name);
31875
- if (value === void 0 || value === "") {
31876
- unresolved = true;
31877
- return "";
31878
- }
31879
- return value;
31880
- });
31881
- return unresolved ? void 0 : joinTemplate(platform, substituted);
31882
- }
31883
- function installRootDirectories(spec, input3, dependencies, platform, home) {
31884
- const templates = (platform === "win32" ? spec.installRoots?.windows : spec.installRoots?.posix) ?? [];
31885
- const directories = [];
31886
- for (const template of templates) {
31887
- if (template === VERSION_MANAGER_ROOTS) {
31888
- directories.push(...versionManagerBinaryDirectories({
31889
- platform,
31890
- environment: input3.environment,
31891
- home,
31892
- ...dependencies.subdirectories ? { subdirectories: dependencies.subdirectories } : {}
31893
- }));
31894
- continue;
31895
- }
31896
- const directory = expandInstallRoot(template, input3.environment, platform, home);
31897
- if (directory !== void 0)
31898
- directories.push(directory);
31899
- }
31900
- return directories;
31901
- }
31902
- function harnessCandidates(spec, input3, dependencies = {}) {
31903
- const platform = input3.platform ?? process.platform;
31904
- const pathFlavor = targetPath(platform);
31905
- const configured = input3.command ?? (spec.commandEnvironmentVariable ? environmentValue(input3.environment, spec.commandEnvironmentVariable) : void 0);
31906
- const command = configured ?? spec.command;
31907
- if (pathFlavor.isAbsolute(command) || command.includes("/") || command.includes("\\")) {
31908
- return [{ candidate: command, source: "configured" }];
31909
- }
31910
- const candidates = [];
31911
- const extensions = executableExtensions(command, platform, input3.environment);
31912
- for (const directory of pathDirectories(input3.environment, platform)) {
31913
- for (const extension of extensions) {
31914
- candidates.push({
31915
- candidate: pathFlavor.join(directory, command + extension),
31916
- source: "path"
31917
- });
31918
- }
31919
- }
31920
- if (configured !== void 0)
31921
- return candidates;
31922
- const home = resolveHomeDirectory(input3);
31923
- for (const directory of installRootDirectories(spec, input3, dependencies, platform, home)) {
31924
- for (const extension of installRootExtensions(platform)) {
31925
- candidates.push({
31926
- candidate: pathFlavor.join(directory, spec.command + extension),
31927
- source: "install-root"
31928
- });
31929
- }
31930
- }
31931
- return candidates;
31932
- }
31933
- function resolveHarnessExecutable(spec, input3, dependencies = {}) {
31934
- const platform = input3.platform ?? process.platform;
31935
- const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
31936
- const runnable = spec.runnableCandidate ?? ((candidate) => candidate);
31937
- const context = { platform, isExecutable };
31938
- for (const { candidate, source } of harnessCandidates(spec, input3, dependencies)) {
31939
- const executable = runnable(candidate, context);
31940
- if (executable !== void 0 && isExecutable(executable))
31941
- return { executable, source };
31942
- }
31943
- return void 0;
31944
- }
31945
-
31946
- // ../../harness-discovery/dist/installation.js
31947
- import { execFile as execFile2 } from "node:child_process";
31948
- import { homedir as homedir2 } from "node:os";
31949
- function runInstallationCommand(command, args, environment, timeout = 3e4, cwd) {
31950
- const env = withNodeRuntimeOnPath(environment);
31951
- const invocation = /\.[cm]?js$/i.test(command) ? commandInvocation(process.execPath, [command, ...args], env) : commandInvocation(command, args, env);
31952
- return new Promise((resolve, reject) => {
31953
- const child = execFile2(invocation.command, invocation.arguments, {
31954
- env,
31955
- cwd: cwd ?? env.HOME ?? env.USERPROFILE ?? homedir2(),
31956
- encoding: "utf8",
31957
- timeout,
31958
- killSignal: "SIGKILL",
31959
- maxBuffer: 1024 * 1024,
31960
- windowsHide: true,
31961
- windowsVerbatimArguments: invocation.windowsVerbatimArguments
31962
- }, (error62, stdout, stderr) => {
31963
- if (error62)
31964
- reject(new Error(error62.killed ? "Harness command timed out" : "Harness command failed; check the native installation and retry"));
31965
- else
31966
- resolve((stdout || stderr).trim());
31967
- });
31968
- child.stdin?.end();
31969
- });
31970
- }
31971
- function installationVersion(value) {
31972
- if (typeof value !== "string" || !/^v?\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?$/.test(value.trim()))
31973
- throw new Error("Harness returned an invalid version");
31974
- return value.trim().replace(/^v/, "");
31975
- }
31976
- function versionFromOutput(output2) {
31977
- return installationVersion(output2.match(/\b\d+(?:\.\d+){1,3}(?:-[\w.-]+)?(?:\+[\w.-]+)?\b/)?.[0]);
31978
- }
31979
- function newerInstallationVersion(current, latest) {
31980
- const a = installationVersion(current).replace(/\+.*/, "");
31981
- const b = installationVersion(latest).replace(/\+.*/, "");
31982
- const coreA = a.replace(/-.*/, "").split(".").map(BigInt);
31983
- const coreB = b.replace(/-.*/, "").split(".").map(BigInt);
31984
- for (let i = 0; i < Math.max(coreA.length, coreB.length); i++) {
31985
- if ((coreA[i] ?? 0n) !== (coreB[i] ?? 0n))
31986
- return (coreB[i] ?? 0n) > (coreA[i] ?? 0n);
31987
- }
31988
- const preA = a.includes("-") ? a.slice(a.indexOf("-") + 1).split(".") : [];
31989
- const preB = b.includes("-") ? b.slice(b.indexOf("-") + 1).split(".") : [];
31990
- if (!preA.length || !preB.length)
31991
- return !!preA.length && !preB.length;
31992
- for (let i = 0; i < Math.max(preA.length, preB.length); i++) {
31993
- const x = preA[i];
31994
- const y = preB[i];
31995
- if (x === y)
31996
- continue;
31997
- if (x === void 0 || y === void 0)
31998
- return x === void 0;
31999
- const numericX = /^\d+$/.test(x);
32000
- const numericY = /^\d+$/.test(y);
32001
- if (numericX && numericY) {
32002
- if (BigInt(x) === BigInt(y))
32003
- continue;
32004
- return BigInt(y) > BigInt(x);
32005
- }
32006
- if (numericX !== numericY)
32007
- return numericX;
32008
- return y > x;
32009
- }
32010
- return false;
32011
- }
32012
- async function fetchInstallationText(url2) {
32013
- const request = async () => {
32014
- const response = await fetch(url2, { signal: AbortSignal.timeout(15e3) });
32015
- if (!response.ok)
32016
- throw new Error("Could not check the latest Harness version");
32017
- return response.text();
32018
- };
32019
- try {
32020
- return await request();
32021
- } catch (error62) {
32022
- if (error62 instanceof DOMException && (error62.name === "AbortError" || error62.name === "TimeoutError"))
32023
- throw error62;
32024
- return request();
32025
- }
32026
- }
32027
-
32028
32216
  // ../codebuddy/dist/command.js
32029
32217
  var codeBuddyDiscoverySpec = {
32030
32218
  id: "codebuddy",
@@ -33811,6 +33999,7 @@ var CodeBuddyChildObserver = class {
33811
33999
  throw error62;
33812
34000
  });
33813
34001
  if (sameCodeBuddyFileVersion(current, this.#parent.version)) {
34002
+ codeBuddyConfigRoot(this.environment, this.profile);
33814
34003
  await this.#validateWorkspaces(this.#parent.historicalCwds);
33815
34004
  this.#assertOpen();
33816
34005
  return this.#parent;
@@ -35070,8 +35259,8 @@ var CodeBuddyAdapter = class {
35070
35259
  };
35071
35260
 
35072
35261
  // dist/command.js
35073
- import { lstatSync, statSync } from "node:fs";
35074
35262
  import { randomBytes as randomBytes2 } from "node:crypto";
35263
+ import { lstatSync, statSync as statSync2 } from "node:fs";
35075
35264
  import { homedir as homedir3 } from "node:os";
35076
35265
 
35077
35266
  // dist/delegation.js
@@ -35300,6 +35489,107 @@ var WORKBUDDY_CREDENTIAL_PRELOAD = String.raw`
35300
35489
  })();
35301
35490
  `;
35302
35491
 
35492
+ // dist/distribution.js
35493
+ import { readFileSync, realpathSync as realpathSync2, statSync } from "node:fs";
35494
+ import path12 from "node:path";
35495
+ var WORKBUDDY_DISTRIBUTIONS = {
35496
+ global: {
35497
+ harnessId: harnessIdSchema.parse("workbuddy"),
35498
+ displayName: "WorkBuddy",
35499
+ commandEnvironmentVariable: "CODEXHOST_WORKBUDDY_COMMAND",
35500
+ configDirectoryEnvironmentVariable: "WORKBUDDY_CONFIG_DIR",
35501
+ dataFolderName: ".workbuddy-ai",
35502
+ endpoint: "https://www.workbuddy.ai",
35503
+ authenticationId: "workbuddy-desktop-ai"
35504
+ },
35505
+ cn: {
35506
+ harnessId: harnessIdSchema.parse("workbuddy-cn"),
35507
+ displayName: "WorkBuddy CN",
35508
+ commandEnvironmentVariable: "CODEXHOST_WORKBUDDYCN_COMMAND",
35509
+ configDirectoryEnvironmentVariable: "WORKBUDDYCN_CONFIG_DIR",
35510
+ dataFolderName: ".workbuddy",
35511
+ endpoint: "https://www.workbuddy.cn",
35512
+ authenticationId: "workbuddy-desktop"
35513
+ }
35514
+ };
35515
+ var RELEASES = Object.keys(WORKBUDDY_DISTRIBUTIONS);
35516
+ function readWorkBuddyProduct(cliScript) {
35517
+ const packageRoot = path12.dirname(path12.dirname(realpathSync2(cliScript)));
35518
+ return JSON.parse(readWorkBuddyProductConfiguration(path12.join(packageRoot, "product.json")));
35519
+ }
35520
+ function readWorkBuddyProductConfiguration(file2) {
35521
+ if (!statSync(file2).isFile())
35522
+ throw new CodeBuddyError("invalidRequest", "WorkBuddy product configuration is not a regular file");
35523
+ return readFileSync(file2, "utf8");
35524
+ }
35525
+ function serviceOrigin(endpoint) {
35526
+ if (typeof endpoint !== "string")
35527
+ return;
35528
+ try {
35529
+ return new URL(endpoint).origin;
35530
+ } catch {
35531
+ return;
35532
+ }
35533
+ }
35534
+ function workBuddyReleasesDeclaredBy(product) {
35535
+ if (product === null || typeof product !== "object")
35536
+ return [];
35537
+ const { dataFolderName, endpoint, authentication } = product;
35538
+ const service = serviceOrigin(endpoint);
35539
+ const authenticationId = authentication !== null && typeof authentication === "object" ? authentication.id : void 0;
35540
+ return RELEASES.filter((release) => {
35541
+ const identity2 = WORKBUDDY_DISTRIBUTIONS[release];
35542
+ return identity2.dataFolderName === dataFolderName || new URL(identity2.endpoint).origin === service || identity2.authenticationId === authenticationId;
35543
+ });
35544
+ }
35545
+ function foreignWorkBuddyProduct(product, distribution) {
35546
+ const foreign = workBuddyReleasesDeclaredBy(product).find((release) => release !== distribution);
35547
+ if (foreign)
35548
+ return foreign;
35549
+ const dataFolderName = product !== null && typeof product === "object" ? product.dataFolderName : void 0;
35550
+ return dataFolderName !== void 0 && dataFolderName !== WORKBUDDY_DISTRIBUTIONS[distribution].dataFolderName ? "other" : void 0;
35551
+ }
35552
+ function rejectForeignWorkBuddyProduct(source, product, distribution) {
35553
+ const foreign = foreignWorkBuddyProduct(product, distribution);
35554
+ const { displayName } = WORKBUDDY_DISTRIBUTIONS[distribution];
35555
+ if (foreign === "other")
35556
+ throw new CodeBuddyError("invalidRequest", `${source} declares another product's data root, not ${displayName}`);
35557
+ if (foreign)
35558
+ throw new CodeBuddyError("invalidRequest", `${source} declares ${WORKBUDDY_DISTRIBUTIONS[foreign].displayName}, not ${displayName}; select the ${WORKBUDDY_DISTRIBUTIONS[foreign].harnessId} Harness for it`);
35559
+ }
35560
+ function verifiedWorkBuddyRootSnapshot(root, distribution, platform = process.platform, readText = readWorkBuddyProductConfiguration, source) {
35561
+ if (source) {
35562
+ const relative = path12.relative(path12.join(realpathSync2(root), "projects"), realpathSync2(source));
35563
+ if (path12.isAbsolute(relative) || relative === ".." || relative.startsWith(`..${path12.sep}`))
35564
+ throw new CodeBuddyError("invalidRequest", "WorkBuddy usage source is outside the selected data root");
35565
+ }
35566
+ const candidate = targetPath(platform).join(root, "cache", "acc-product-config-v3.json");
35567
+ let product;
35568
+ try {
35569
+ product = JSON.parse(readText(candidate));
35570
+ } catch (error62) {
35571
+ if (error62 instanceof CodeBuddyError)
35572
+ throw error62;
35573
+ return;
35574
+ }
35575
+ rejectForeignWorkBuddyProduct("The product snapshot in this WorkBuddy root", product, distribution);
35576
+ return candidate;
35577
+ }
35578
+ function workBuddyDistributionOfProduct(product) {
35579
+ const declared = workBuddyReleasesDeclaredBy(product);
35580
+ const release = declared.length === 1 ? declared[0] : void 0;
35581
+ return release && !foreignWorkBuddyProduct(product, release) ? release : void 0;
35582
+ }
35583
+ function workBuddyDistributionOf(cliScript, readProduct2 = readWorkBuddyProduct) {
35584
+ let product;
35585
+ try {
35586
+ product = readProduct2(cliScript);
35587
+ } catch {
35588
+ return void 0;
35589
+ }
35590
+ return workBuddyDistributionOfProduct(product);
35591
+ }
35592
+
35303
35593
  // dist/discovery.js
35304
35594
  var WORKBUDDY_MACOS_ELECTRON = "/Applications/WorkBuddy AI.app/Contents/MacOS/Electron";
35305
35595
  var windowsRoots = [
@@ -35323,16 +35613,16 @@ var macSpec = {
35323
35613
  ]
35324
35614
  }
35325
35615
  };
35326
- var linuxSpec = {
35616
+ var linuxSpecs = ["workbuddy", "workbuddyai"].map((command) => ({
35327
35617
  id: "workbuddy",
35328
- command: "workbuddy",
35618
+ command,
35329
35619
  installRoots: { posix: linuxRoots }
35330
- };
35620
+ }));
35331
35621
  function resolveWorkBuddyInstallDirectory(directory, environment, platform, isExecutable, subdirectories = subdirectoryNames) {
35332
35622
  const paths = targetPath(platform);
35333
- const entries = platform === "win32" ? ["WorkBuddy-app.exe", "WorkBuddy.exe", "WorkBuddy AI.exe", "WorkBuddyAI.exe"] : platform === "darwin" ? [paths.join("Contents", "MacOS", "Electron")] : platform === "linux" ? ["workbuddy"] : [];
35623
+ const entries = platform === "win32" ? ["WorkBuddy-app.exe", "WorkBuddy.exe", "WorkBuddy AI.exe", "WorkBuddyAI.exe"] : platform === "darwin" ? [paths.join("Contents", "MacOS", "Electron")] : platform === "linux" ? ["workbuddy", "workbuddyai"] : [];
35334
35624
  for (const entry of entries) {
35335
- const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry), subdirectories);
35625
+ const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry), () => true, subdirectories);
35336
35626
  if (bundle)
35337
35627
  return bundle;
35338
35628
  }
@@ -35365,12 +35655,12 @@ function resolveWorkBuddyLauncherLayout(directory, platform, isExecutable, subdi
35365
35655
  }
35366
35656
  return void 0;
35367
35657
  }
35368
- function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, subdirectories = subdirectoryNames) {
35658
+ function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, accept, subdirectories = subdirectoryNames) {
35369
35659
  const specs = platform === "darwin" ? [macSpec] : platform === "win32" ? ["WorkBuddy AI", "WorkBuddy", "WorkBuddyAI"].map((command) => ({
35370
35660
  id: "workbuddy",
35371
35661
  command,
35372
35662
  installRoots: { windows: windowsRoots }
35373
- })) : platform === "linux" ? [linuxSpec] : [];
35663
+ })) : platform === "linux" ? linuxSpecs : [];
35374
35664
  const paths = targetPath(platform);
35375
35665
  const candidates = explicitExecutable ? [{ candidate: explicitExecutable, source: "configured" }] : specs.flatMap((spec) => harnessCandidates(spec, { environment, platform }));
35376
35666
  for (const { candidate, source } of candidates) {
@@ -35381,11 +35671,14 @@ function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExe
35381
35671
  if (!isExecutable(candidate))
35382
35672
  continue;
35383
35673
  const launcher = resolveWorkBuddyLauncherLayout(paths.dirname(candidate), platform, isExecutable, subdirectories);
35384
- if (launcher)
35385
- return launcher;
35674
+ if (launcher) {
35675
+ if (accept(launcher.cli))
35676
+ return launcher;
35677
+ continue;
35678
+ }
35386
35679
  const resources = platform === "darwin" ? paths.resolve(paths.dirname(candidate), "..", "Resources") : paths.join(paths.dirname(candidate), "resources");
35387
35680
  const cli = paths.join(resources, "app.asar.unpacked", "cli", "bin", "codebuddy");
35388
- if (isExecutable(cli))
35681
+ if (isExecutable(cli) && accept(cli))
35389
35682
  return { executable: candidate, cli };
35390
35683
  }
35391
35684
  return void 0;
@@ -35404,18 +35697,29 @@ var WORKBUDDY_PRODUCT_CONFIG_INLINE_ENVS = [
35404
35697
  "ACC_PRODUCT_CONFIG_V2",
35405
35698
  "ACC_PRODUCT_CONFIG"
35406
35699
  ];
35407
- function bundledProductConfigPath(environment, platform, dependencies) {
35408
- if (environment[WORKBUDDY_PRODUCT_CONFIG_PATH_ENV] !== void 0 || WORKBUDDY_PRODUCT_CONFIG_INLINE_ENVS.some((name) => environment[name] !== void 0))
35409
- return;
35410
- const root = environment.WORKBUDDY_CONFIG_DIR;
35411
- if (!root)
35412
- return;
35700
+ function platformEnvironmentValue(environment, name, platform) {
35701
+ return platform === "win32" ? environmentValue(environment, name) : environment[name];
35702
+ }
35703
+ function setPlatformEnvironmentValue(environment, name, value, platform) {
35704
+ if (platform === "win32") {
35705
+ const lowered = name.toLowerCase();
35706
+ for (const key of Object.keys(environment)) {
35707
+ if (key !== name && key.toLowerCase() === lowered)
35708
+ Reflect.deleteProperty(environment, key);
35709
+ }
35710
+ }
35711
+ environment[name] = value;
35712
+ }
35713
+ function hasExplicitProductConfiguration(environment, platform) {
35714
+ return platformEnvironmentValue(environment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, platform) !== void 0 || WORKBUDDY_PRODUCT_CONFIG_INLINE_ENVS.some((name) => platformEnvironmentValue(environment, name, platform) !== void 0);
35715
+ }
35716
+ function forwardableRootProductConfigPath(candidate, platform, dependencies) {
35413
35717
  const paths = targetPath(platform);
35414
- const candidate = paths.join(root, "cache", "acc-product-config-v3.json");
35415
35718
  try {
35416
35719
  const inspect = dependencies.lstat ?? lstatSync;
35417
35720
  const uid = (dependencies.getuid ?? (() => process.getuid?.()))();
35418
- for (const directory of [root, paths.dirname(candidate)]) {
35721
+ const cache = paths.dirname(candidate);
35722
+ for (const directory of [paths.dirname(cache), cache]) {
35419
35723
  const metadata2 = inspect(directory);
35420
35724
  if (!metadata2.isDirectory() || metadata2.isSymbolicLink())
35421
35725
  return;
@@ -35440,14 +35744,38 @@ function bundledProductConfigPath(environment, platform, dependencies) {
35440
35744
  return;
35441
35745
  }
35442
35746
  }
35443
- function workBuddyEnvironment(environment, platform = process.platform) {
35747
+ function verifyExplicitProductConfiguration(environment, distribution, platform, readText) {
35748
+ const path14 = platformEnvironmentValue(environment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, platform)?.trim();
35749
+ const sources = [
35750
+ ...path14 ? [[WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, () => readText(path14)]] : [],
35751
+ ...WORKBUDDY_PRODUCT_CONFIG_INLINE_ENVS.flatMap((name) => {
35752
+ const value = platformEnvironmentValue(environment, name, platform);
35753
+ return value?.trim() ? [[name, () => value]] : [];
35754
+ })
35755
+ ];
35756
+ for (const [name, read] of sources) {
35757
+ let product;
35758
+ try {
35759
+ product = JSON.parse(read());
35760
+ } catch {
35761
+ throw new CodeBuddyError("invalidRequest", `${name} cannot be verified as ${WORKBUDDY_DISTRIBUTIONS[distribution].displayName} product configuration`);
35762
+ }
35763
+ rejectForeignWorkBuddyProduct(name, product, distribution);
35764
+ }
35765
+ }
35766
+ function workBuddyEnvironment(environment, platform = process.platform, distribution = "global") {
35444
35767
  const paths = targetPath(platform);
35445
- const configuredRoot = environment.WORKBUDDY_CONFIG_DIR;
35446
- const root = paths.resolve(configuredRoot?.trim() ? configuredRoot : paths.join(environment.HOME || environment.USERPROFILE || homedir3(), platform === "linux" ? ".workbuddy" : ".workbuddy-ai"));
35768
+ const { configDirectoryEnvironmentVariable, dataFolderName } = WORKBUDDY_DISTRIBUTIONS[distribution];
35769
+ const configuredRoot = platformEnvironmentValue(environment, configDirectoryEnvironmentVariable, platform);
35770
+ const root = paths.resolve(configuredRoot?.trim() ? configuredRoot : paths.join(platformEnvironmentValue(environment, "HOME", platform) || platformEnvironmentValue(environment, "USERPROFILE", platform) || homedir3(), dataFolderName));
35771
+ const rootedEnvironment = { ...environment };
35772
+ setPlatformEnvironmentValue(rootedEnvironment, "CODEBUDDY_CONFIG_DIR", root, platform);
35773
+ setPlatformEnvironmentValue(rootedEnvironment, "WORKBUDDY_CONFIG_DIR", root, platform);
35447
35774
  return {
35448
- ...environment,
35449
- // The bundled core reads CODEBUDDY_CONFIG_DIR. Force both names to one
35450
- // WorkBuddy-owned root so a global CodeBuddy setting cannot leak history.
35775
+ ...rootedEnvironment,
35776
+ // The native CLI runs one product and reads WORKBUDDY_CONFIG_DIR/CODEBUDDY_CONFIG_DIR.
35777
+ // Force both to this release's root so neither a global CodeBuddy nor the other
35778
+ // release's Host override can leak history, authentication or settings.
35451
35779
  CODEBUDDY_CONFIG_DIR: root,
35452
35780
  WORKBUDDY_CONFIG_DIR: root,
35453
35781
  DISABLE_AUTOUPDATER: environment.DISABLE_AUTOUPDATER ?? "1"
@@ -35455,31 +35783,49 @@ function workBuddyEnvironment(environment, platform = process.platform) {
35455
35783
  }
35456
35784
  function resolveWorkBuddyLaunch(environment, dependencies = {}) {
35457
35785
  const platform = dependencies.platform ?? process.platform;
35458
- const configured = environmentValue(environment, "CODEXHOST_WORKBUDDY_COMMAND")?.trim() || void 0;
35786
+ const distribution = dependencies.distribution ?? "global";
35787
+ const { displayName, commandEnvironmentVariable } = WORKBUDDY_DISTRIBUTIONS[distribution];
35788
+ const releaseOf = (cli) => workBuddyDistributionOf(cli, dependencies.readProduct);
35789
+ const configured = environmentValue(environment, commandEnvironmentVariable)?.trim() || void 0;
35459
35790
  if (!configured && platform !== "darwin" && platform !== "win32" && platform !== "linux")
35460
- throw new CodeBuddyError("notInstalled", "WorkBuddy app discovery is unavailable on this platform; set CODEXHOST_WORKBUDDY_COMMAND for a compatible native runtime");
35791
+ throw new CodeBuddyError("notInstalled", `${displayName} app discovery is unavailable on this platform; set ${commandEnvironmentVariable} for a compatible native runtime`);
35461
35792
  const isExecutable = dependencies.isExecutable ?? ((candidate) => isExecutableFile(candidate, platform));
35462
35793
  const subdirectories = dependencies.subdirectories ?? subdirectoryNames;
35463
35794
  const configuredDirectory = configured && (dependencies.isDirectory ?? isDirectory)(configured) ? configured : void 0;
35464
35795
  const explicitExecutable = configured && !configuredDirectory ? resolveHarnessExecutable(workBuddyDiscoverySpec, { environment, platform, command: configured }, { isExecutable })?.executable : void 0;
35465
- const explicitBundle = explicitExecutable ? resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, subdirectories) : void 0;
35466
- const explicitDesktop = explicitExecutable !== void 0 && (platform === "win32" && /^(?:WorkBuddy(?:-app)?|WorkBuddy AI|WorkBuddyAI)\.exe$/iu.test(targetPath(platform).basename(explicitExecutable)) || platform === "darwin" && /\/(?:WorkBuddy|WorkBuddy AI)\.app\/Contents\/MacOS\/Electron$/u.test(explicitExecutable) || platform === "linux" && targetPath(platform).basename(explicitExecutable) === "workbuddy");
35467
- const bundle = configuredDirectory ? resolveWorkBuddyInstallDirectory(configuredDirectory, environment, platform, isExecutable, subdirectories) : !configured ? resolveWorkBuddyBundle(environment, platform, isExecutable, void 0, subdirectories) : explicitDesktop ? explicitBundle : void 0;
35796
+ const explicitBundle = explicitExecutable ? resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, () => true, subdirectories) : void 0;
35797
+ let explicitCliProduct;
35798
+ let hasExplicitCliProduct = false;
35799
+ if (explicitExecutable && !explicitBundle) {
35800
+ try {
35801
+ explicitCliProduct = (dependencies.readProduct ?? readWorkBuddyProduct)(explicitExecutable);
35802
+ hasExplicitCliProduct = true;
35803
+ } catch {
35804
+ }
35805
+ }
35806
+ const explicitDesktop = explicitExecutable !== void 0 && (explicitBundle !== void 0 || !hasExplicitCliProduct && (platform === "linux" || platform === "win32" && /^(?:WorkBuddy(?:-app)?|WorkBuddy AI|WorkBuddyAI)\.exe$/iu.test(targetPath(platform).basename(explicitExecutable)) || platform === "darwin" && /\/(?:WorkBuddy|WorkBuddy AI)\.app\/Contents\/MacOS\/Electron$/u.test(explicitExecutable)));
35807
+ const bundle = configuredDirectory ? resolveWorkBuddyInstallDirectory(configuredDirectory, environment, platform, isExecutable, subdirectories) : !configured ? resolveWorkBuddyBundle(environment, platform, isExecutable, void 0, (cli) => releaseOf(cli) === distribution, subdirectories) : explicitDesktop ? explicitBundle : void 0;
35468
35808
  const executable = configured && !explicitDesktop && !configuredDirectory ? explicitExecutable : bundle?.executable;
35469
35809
  if (!executable)
35470
- throw new CodeBuddyError("notInstalled", "WorkBuddy AI app or its bundled CLI is unavailable");
35810
+ throw new CodeBuddyError("notInstalled", `${displayName} app or its bundled CLI is unavailable`);
35811
+ if (configured) {
35812
+ const release = hasExplicitCliProduct && executable === explicitExecutable ? workBuddyDistributionOfProduct(explicitCliProduct) : releaseOf(bundle?.cli ?? executable);
35813
+ if (release !== distribution)
35814
+ throw new CodeBuddyError("invalidRequest", release ? `${configured} is ${WORKBUDDY_DISTRIBUTIONS[release].displayName}, not ${displayName}; select the ${WORKBUDDY_DISTRIBUTIONS[release].harnessId} Harness for it` : `${configured} does not declare ${displayName} product metadata`);
35815
+ }
35471
35816
  return { executable, bundle };
35472
35817
  }
35473
35818
  function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {}, argumentsOverride) {
35474
35819
  const dependencies = Array.isArray(dependenciesOrArguments) ? {} : dependenciesOrArguments;
35475
35820
  const nativeArguments = Array.isArray(dependenciesOrArguments) ? dependenciesOrArguments : argumentsOverride;
35476
35821
  const platform = dependencies.platform ?? process.platform;
35822
+ const distribution = dependencies.distribution ?? "global";
35477
35823
  const { executable, bundle } = resolveWorkBuddyLaunch(environment, dependencies);
35478
35824
  const paths = targetPath(platform);
35479
35825
  const cliDist = bundle && paths.join(paths.dirname(paths.dirname(bundle.cli)), "dist");
35480
35826
  const isFile = dependencies.isFile ?? ((candidate) => {
35481
35827
  try {
35482
- return statSync(candidate).isFile();
35828
+ return statSync2(candidate).isFile();
35483
35829
  } catch {
35484
35830
  return false;
35485
35831
  }
@@ -35491,8 +35837,15 @@ function workBuddyInvocation(environment, ephemeral, dependenciesOrArguments = {
35491
35837
  ...workBuddyDelegationArguments(environment, ephemeral)
35492
35838
  ];
35493
35839
  const serve = liteOnly && acpArguments.includes("--acp") && !acpArguments.includes("--serve");
35494
- const configuredEnvironment = withNodeRuntimeOnPath(workBuddyEnvironment(environment, platform), process.execPath, platform);
35495
- const productConfigPath = bundle ? bundledProductConfigPath(configuredEnvironment, platform, dependencies) : void 0;
35840
+ const rootEnvironment = workBuddyEnvironment(environment, platform, distribution);
35841
+ const configuredEnvironment = withNodeRuntimeOnPath(rootEnvironment, process.execPath, platform);
35842
+ const explicitProductConfigPath = platformEnvironmentValue(configuredEnvironment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, platform)?.trim();
35843
+ if (explicitProductConfigPath)
35844
+ setPlatformEnvironmentValue(configuredEnvironment, WORKBUDDY_PRODUCT_CONFIG_PATH_ENV, paths.resolve(explicitProductConfigPath), platform);
35845
+ const readText = dependencies.readText ?? readWorkBuddyProductConfiguration;
35846
+ verifyExplicitProductConfiguration(configuredEnvironment, distribution, platform, readText);
35847
+ const rootSnapshot = verifiedWorkBuddyRootSnapshot(rootEnvironment.WORKBUDDY_CONFIG_DIR, distribution, platform, readText);
35848
+ const productConfigPath = bundle && rootSnapshot && !hasExplicitProductConfiguration(configuredEnvironment, platform) ? forwardableRootProductConfigPath(rootSnapshot, platform, dependencies) : void 0;
35496
35849
  const childEnvironment = bundle ? {
35497
35850
  ...configuredEnvironment,
35498
35851
  // EOF-only native Fork copies do no model work. The bundled CLI otherwise
@@ -35520,7 +35873,7 @@ require(process.argv[1]);`, bundle.cli] : [],
35520
35873
  }
35521
35874
 
35522
35875
  // dist/common.js
35523
- var WORKBUDDY_ID = harnessIdSchema.parse("workbuddy");
35876
+ var WORKBUDDY_ID = WORKBUDDY_DISTRIBUTIONS.global.harnessId;
35524
35877
  var WORKBUDDY_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
35525
35878
  commands: [
35526
35879
  {
@@ -35540,22 +35893,30 @@ var WORKBUDDY_COMMAND_CATALOG = harnessCommandCatalogSchema.parse({
35540
35893
  }
35541
35894
  ]
35542
35895
  });
35543
- var WORKBUDDY_RUNTIME_PROFILE = {
35544
- harnessId: WORKBUDDY_ID,
35545
- displayName: "WorkBuddy",
35546
- interactionIdPrefix: "workbuddy",
35547
- configDirectoryEnvironmentVariables: ["WORKBUDDY_CONFIG_DIR"],
35548
- defaultConfigDirectoryName: ".workbuddy-ai",
35549
- // WorkBuddy's native PathUtils.compressPath preserves case, dots, spaces and Unicode.
35550
- projectDirectoryName: (cwd) => cwd.replace(/[/\\:]/gu, "-").replace(/^-+/u, "").replace(/-+$/u, "").replace(/-+/gu, "-"),
35551
- staticCommandCatalog: WORKBUDDY_COMMAND_CATALOG,
35552
- nativeCommands: true,
35553
- historyCapabilities: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true }
35554
- };
35896
+ function workBuddyRuntimeProfile(distribution) {
35897
+ const { harnessId, displayName, configDirectoryEnvironmentVariable, dataFolderName } = WORKBUDDY_DISTRIBUTIONS[distribution];
35898
+ return {
35899
+ harnessId,
35900
+ displayName,
35901
+ interactionIdPrefix: harnessId,
35902
+ // History, subagents and Fork read the same Host key the spawned CLI root is mapped from.
35903
+ configDirectoryEnvironmentVariables: [configDirectoryEnvironmentVariable],
35904
+ defaultConfigDirectoryName: dataFolderName,
35905
+ validateConfigRoot: (root, source) => verifiedWorkBuddyRootSnapshot(root, distribution, process.platform, void 0, source),
35906
+ // WorkBuddy's native PathUtils.compressPath preserves case, dots, spaces and Unicode.
35907
+ projectDirectoryName: (cwd) => cwd.replace(/[/\\:]/gu, "-").replace(/^-+/u, "").replace(/-+$/u, "").replace(/-+/gu, "-"),
35908
+ staticCommandCatalog: WORKBUDDY_COMMAND_CATALOG,
35909
+ nativeCommands: true,
35910
+ // Verified online on the international CLI 2.137.1. The China CLI 2.147.0 ships the same
35911
+ // public `--fork-session` mode and `_codebuddy.ai/session/rollback` extension.
35912
+ historyCapabilities: { fork: true, forkAcrossCwd: true, rollbackLastTurn: true }
35913
+ };
35914
+ }
35915
+ var WORKBUDDY_RUNTIME_PROFILE = workBuddyRuntimeProfile("global");
35555
35916
 
35556
35917
  // dist/product-models.js
35557
35918
  import { readFile as readFile5, stat as stat4 } from "node:fs/promises";
35558
- import path12 from "node:path";
35919
+ import path13 from "node:path";
35559
35920
  var MAX_PRODUCT_SNAPSHOT_BYTES = 8 * 1024 * 1024;
35560
35921
  var PRODUCT_CONFIG_PATH_ENV = "ACC_PRODUCT_CONFIG_PATH";
35561
35922
  var PRODUCT_CONFIG_INLINE_ENVS = [
@@ -35617,10 +35978,10 @@ function bundledFallbackProductPath(invocation) {
35617
35978
  const cli = invocation.bundledCliPath;
35618
35979
  if (!cli)
35619
35980
  return;
35620
- return path12.join(path12.dirname(path12.dirname(cli)), "product.json");
35981
+ return path13.join(path13.dirname(path13.dirname(cli)), "product.json");
35621
35982
  }
35622
- async function loadWorkBuddyProductModels(environment) {
35623
- const invocation = workBuddyInvocation(environment, true);
35983
+ async function loadWorkBuddyProductModels(environment, distribution) {
35984
+ const invocation = workBuddyInvocation(environment, true, { distribution });
35624
35985
  const productEnvironment = invocation.environment;
35625
35986
  const configuredPath = nonBlank(productEnvironment[PRODUCT_CONFIG_PATH_ENV]);
35626
35987
  if (configuredPath) {
@@ -35675,18 +36036,21 @@ function mergeWorkBuddyProductModels(catalog, productModels) {
35675
36036
 
35676
36037
  // dist/workbuddy-adapter.js
35677
36038
  var WorkBuddyAdapter = class extends CodeBuddyAdapter {
36039
+ #displayName;
35678
36040
  #productModels;
35679
36041
  constructor(options = {}) {
35680
- const { productModels, platform = process.platform, ...codeBuddyOptions } = options;
36042
+ const { productModels, platform = process.platform, distribution = "global", ...codeBuddyOptions } = options;
35681
36043
  const environment = { ...codeBuddyOptions.environment ?? process.env };
35682
- const profile = platform === "win32" ? { ...WORKBUDDY_RUNTIME_PROFILE, allowUnlistedModelSelection: true } : platform === "linux" ? { ...WORKBUDDY_RUNTIME_PROFILE, defaultConfigDirectoryName: ".workbuddy" } : WORKBUDDY_RUNTIME_PROFILE;
36044
+ const baseProfile = workBuddyRuntimeProfile(distribution);
36045
+ const profile = platform === "win32" ? { ...baseProfile, allowUnlistedModelSelection: true } : baseProfile;
36046
+ const invocation = (invocationEnvironment, ephemeral, args) => workBuddyInvocation(invocationEnvironment, ephemeral, { distribution, platform }, args);
35683
36047
  super({
35684
36048
  ...codeBuddyOptions,
35685
36049
  profile,
35686
- invocationFactory: workBuddyInvocation,
35687
- clientFactory: codeBuddyOptions.clientFactory ?? ((clientOptions) => new CodeBuddyAcpClient(clientOptions, void 0, workBuddyInvocation))
36050
+ invocationFactory: invocation
35688
36051
  });
35689
- this.#productModels = platform === "win32" ? productModels ?? (() => loadWorkBuddyProductModels(environment)) : async () => [];
36052
+ this.#displayName = baseProfile.displayName;
36053
+ this.#productModels = platform === "win32" ? productModels ?? (() => loadWorkBuddyProductModels(environment, distribution)) : async () => [];
35690
36054
  }
35691
36055
  async inspect(input3 = {}) {
35692
36056
  const inspection = await super.inspect(input3);
@@ -35706,7 +36070,7 @@ var WorkBuddyAdapter = class extends CodeBuddyAdapter {
35706
36070
  ok: false,
35707
36071
  error: {
35708
36072
  code: "invalidRequest",
35709
- message: "WorkBuddy: unattended execution requires native fullAccess permissions",
36073
+ message: `${this.#displayName}: unattended execution requires native fullAccess permissions`,
35710
36074
  retryable: false
35711
36075
  }
35712
36076
  };
@@ -35734,10 +36098,14 @@ async function readProduct(file2) {
35734
36098
  function createWorkBuddyInstallation(environment, dependencies = {}) {
35735
36099
  const platform = dependencies.platform ?? process.platform;
35736
36100
  const arch = dependencies.arch ?? process.arch;
36101
+ const distribution = dependencies.distribution ?? "global";
35737
36102
  return async (action) => {
35738
36103
  if (action === "update")
35739
36104
  throw new Error("Complete the update with WorkBuddy's official desktop installer");
35740
- const { executable, bundle } = resolveWorkBuddyLaunch(environment, { platform });
36105
+ const { executable, bundle } = resolveWorkBuddyLaunch(environment, {
36106
+ platform,
36107
+ distribution
36108
+ });
35741
36109
  if (!bundle)
35742
36110
  return {
35743
36111
  currentVersion: versionFromOutput(await runInstallationCommand(executable, ["--version"], environment)),
@@ -35796,22 +36164,23 @@ function createWorkBuddyInstallation(environment, dependencies = {}) {
35796
36164
  }
35797
36165
 
35798
36166
  // dist/plugin.js
35799
- function createHarnessAdapter(context) {
36167
+ function createHarnessAdapter(context, distribution = "global") {
36168
+ const { harnessId, commandEnvironmentVariable } = WORKBUDDY_DISTRIBUTIONS[distribution];
35800
36169
  if (context.platform === "darwin" && context.managedRemoteHost) {
35801
36170
  const environment2 = {
35802
36171
  ...context.environment,
35803
- ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
36172
+ ...context.launchCommand ? { [commandEnvironmentVariable]: context.launchCommand } : {}
35804
36173
  };
35805
36174
  return new BrokeredHarnessAdapter({
35806
36175
  sessionImport: true,
35807
36176
  accountCredits: false,
35808
- harnessId: "workbuddy",
36177
+ harnessId,
35809
36178
  commandCatalog: WORKBUDDY_COMMAND_CATALOG,
35810
36179
  forwardDelegationEnvironment: true,
35811
36180
  environment: { ...context.environment },
35812
36181
  isInstalled: () => {
35813
36182
  try {
35814
- workBuddyInvocation(environment2, true);
36183
+ workBuddyInvocation(environment2, true, { distribution });
35815
36184
  return true;
35816
36185
  } catch (error62) {
35817
36186
  return !(error62 instanceof CodeBuddyError && error62.code === "notInstalled");
@@ -35822,11 +36191,14 @@ function createHarnessAdapter(context) {
35822
36191
  }
35823
36192
  const environment = {
35824
36193
  ...context.environment,
35825
- ...context.launchCommand ? { CODEXHOST_WORKBUDDY_COMMAND: context.launchCommand } : {}
36194
+ ...context.launchCommand ? { [commandEnvironmentVariable]: context.launchCommand } : {}
35826
36195
  };
35827
36196
  const platform = context.platform === "darwin" || context.platform === "win32" || context.platform === "linux" ? context.platform : void 0;
35828
- return Object.assign(new WorkBuddyAdapter({ environment, ...platform ? { platform } : {} }), {
35829
- installation: createWorkBuddyInstallation(environment, platform ? { platform } : {})
36197
+ return Object.assign(new WorkBuddyAdapter({ distribution, environment, ...platform ? { platform } : {} }), {
36198
+ installation: createWorkBuddyInstallation(environment, {
36199
+ distribution,
36200
+ ...platform ? { platform } : {}
36201
+ })
35830
36202
  });
35831
36203
  }
35832
36204
  export {