@codexhost/cli-win32-x64 0.30.0 → 0.32.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 (115) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +62 -5
  4. package/app/console-web.js +236 -30
  5. package/app/desktop-controller.mjs +68 -9
  6. package/app/host-runtime.mjs +3653 -1136
  7. package/app/plugins/antigravity/plugin.mjs +64 -27
  8. package/app/plugins/claude-code/plugin.mjs +73 -13
  9. package/app/plugins/codebuddy/plugin.mjs +261 -93
  10. package/app/plugins/codex-usage/plugin.mjs +62 -5
  11. package/app/plugins/copilot/plugin.mjs +62 -5
  12. package/app/plugins/cursor-cli/plugin.mjs +62 -5
  13. package/app/plugins/deepseek-harness/plugin.mjs +62 -5
  14. package/app/plugins/devin/plugin.mjs +62 -5
  15. package/app/plugins/grok/plugin.mjs +62 -5
  16. package/app/plugins/hermes/plugin.mjs +62 -5
  17. package/app/plugins/kimi-code/plugin.mjs +62 -5
  18. package/app/plugins/kiro-cli/plugin.mjs +62 -5
  19. package/app/plugins/omp/plugin.mjs +62 -5
  20. package/app/plugins/opencode/plugin.mjs +62 -5
  21. package/app/plugins/pi/plugin.mjs +62 -5
  22. package/app/plugins/qoder/plugin.mjs +62 -5
  23. package/app/plugins/qoder-cn/plugin.mjs +62 -5
  24. package/app/plugins/qwen-code/plugin.mjs +62 -5
  25. package/app/plugins/workbuddy/plugin.mjs +261 -93
  26. package/app/plugins/zcode/plugin.mjs +62 -5
  27. package/app/renderer-extension.js +950 -538
  28. package/app/web/assets/{abnfDiagram-XWFEHMT6-BdinLox4.js → abnfDiagram-XWFEHMT6-CnJyN70L.js} +1 -1
  29. package/app/web/assets/{architectureDiagram-CSQXQB3N-DgPBbtvP.js → architectureDiagram-CSQXQB3N-DH0ITYVE.js} +1 -1
  30. package/app/web/assets/{blockDiagram-BEDRHYPZ-B4ENdwtZ.js → blockDiagram-BEDRHYPZ-WL3ZKoKg.js} +1 -1
  31. package/app/web/assets/{c4Diagram-M2UUVUY5-DA6Owfyu.js → c4Diagram-M2UUVUY5-XwSPKj5H.js} +1 -1
  32. package/app/web/assets/{chunk-2Q5K7J3B-Dvh3qOmo.js → chunk-2Q5K7J3B-CKEzexjg.js} +1 -1
  33. package/app/web/assets/{chunk-3GCGMST5-VIkqueym.js → chunk-3GCGMST5-BdEgLpab.js} +1 -1
  34. package/app/web/assets/{chunk-5VM5RSS4-DTYof_OI.js → chunk-5VM5RSS4-DyxL5-Ts.js} +1 -1
  35. package/app/web/assets/{chunk-7U7NFRK5-Dp7s2dg0.js → chunk-7U7NFRK5-FXLb4tYa.js} +1 -1
  36. package/app/web/assets/{chunk-CNRTWJTD-TKBKxZLU.js → chunk-CNRTWJTD-DcdC1OYr.js} +1 -1
  37. package/app/web/assets/{chunk-D5HYT7QG-BRZDovSS.js → chunk-D5HYT7QG-BOz9vBX9.js} +1 -1
  38. package/app/web/assets/{chunk-EBZ3SEQC-C9USZ3tT.js → chunk-EBZ3SEQC-Dmc_Z53x.js} +2 -2
  39. package/app/web/assets/{chunk-JWPE2WC7-BrdvVNVo.js → chunk-JWPE2WC7-CrFwSwYi.js} +1 -1
  40. package/app/web/assets/{chunk-KTR4FSNJ-C7qwjGba.js → chunk-KTR4FSNJ-BY3AzFaI.js} +1 -1
  41. package/app/web/assets/{chunk-XXDRQBXY-DlSrRuwN.js → chunk-XXDRQBXY-CHgNy82n.js} +1 -1
  42. package/app/web/assets/{classDiagram-v2-KXABOMEV-BFvB4kwX.js → classDiagram-v2-KXABOMEV-ClM3-y5Z.js} +1 -1
  43. package/app/web/assets/{cose-bilkent-JH36ORCC-UyCAqNvj.js → cose-bilkent-JH36ORCC-I7nd8GgO.js} +1 -1
  44. package/app/web/assets/{cynefin-EF2NZ3EQ-CwawUbjJ.js → cynefin-EF2NZ3EQ-DzsXmyBH.js} +1 -1
  45. package/app/web/assets/{cynefinDiagram-NJNITYFG-BaWEIQJ0.js → cynefinDiagram-NJNITYFG-DLHq6igy.js} +1 -1
  46. package/app/web/assets/{dagre-KIHZ2IZ3-B7ENIjLG.js → dagre-KIHZ2IZ3-BK991Mno.js} +1 -1
  47. package/app/web/assets/{diagram-7YQZDPLS-CxRMU8xq.js → diagram-7YQZDPLS-C4qiWdQU.js} +1 -1
  48. package/app/web/assets/{diagram-QBROCOUO-qo7sxm4K.js → diagram-QBROCOUO-C_ZyBohC.js} +1 -1
  49. package/app/web/assets/{diagram-RJJCUUZO-CQiGMCMe.js → diagram-RJJCUUZO-C5Aezm94.js} +1 -1
  50. package/app/web/assets/{diagram-WERXNKYE-D0Jps1As.js → diagram-WERXNKYE-Ckc_umlF.js} +1 -1
  51. package/app/web/assets/{diagram-YHHI257C-p4AB8cqK.js → diagram-YHHI257C-BHjReoZZ.js} +1 -1
  52. package/app/web/assets/{diagram-YR4HJLHV-Bh6JKT04.js → diagram-YR4HJLHV-DVTGi_y9.js} +1 -1
  53. package/app/web/assets/{ebnfDiagram-N527522P-DRac0k4W.js → ebnfDiagram-N527522P-getuz1AR.js} +1 -1
  54. package/app/web/assets/{elk-O5DQBFGD-CWTz5SZP.js → elk-O5DQBFGD-C7mhTIuK.js} +1 -1
  55. package/app/web/assets/{erDiagram-K3K3BIDK-DE3w4BEY.js → erDiagram-K3K3BIDK-sV-HZvUV.js} +1 -1
  56. package/app/web/assets/{flowDiagram-Z6JWZHQI-NYs8bi5t.js → flowDiagram-Z6JWZHQI-D0L4wXUs.js} +1 -1
  57. package/app/web/assets/{ganttDiagram-3PRQTZWP-Bspp9btW.js → ganttDiagram-3PRQTZWP-BNt9Bjjo.js} +1 -1
  58. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-ByGW1uvv.js → gitGraphDiagram-VXDFKS5L-BABZzhHw.js} +1 -1
  59. package/app/web/assets/{grid-E2QIVN74-CegebiIw.js → grid-E2QIVN74-DLe2FQ_d.js} +1 -1
  60. package/app/web/assets/{index-DFPOGLS4.js → index-BLmkBEoq.js} +100 -100
  61. package/app/web/assets/index-Dwdnvinl.css +1 -0
  62. package/app/web/assets/{infoDiagram-EZ3ZOAHP-CexmsdZx.js → infoDiagram-EZ3ZOAHP-BKDuUqcr.js} +1 -1
  63. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BbWqKhg6.js → ishikawaDiagram-S3EKX5GW-C75EGghg.js} +1 -1
  64. package/app/web/assets/{journeyDiagram-POQNLL5X-27YlCe-1.js → journeyDiagram-POQNLL5X-q7Obruqa.js} +1 -1
  65. package/app/web/assets/{kanban-definition-BH5XI6FM-BAhOdeck.js → kanban-definition-BH5XI6FM-CzAqhFED.js} +1 -1
  66. package/app/web/assets/{mermaid.core-sGgCbv5y.js → mermaid.core-Bysx44LR.js} +4 -4
  67. package/app/web/assets/{mindmap-definition-WVAN44T4-CsMIX0Lj.js → mindmap-definition-WVAN44T4-Ds5rXTrF.js} +1 -1
  68. package/app/web/assets/{pegDiagram-D4NLKWP3-Cs3LXqn_.js → pegDiagram-D4NLKWP3-hmdERwtT.js} +1 -1
  69. package/app/web/assets/{pieDiagram-36ENHN4W-DdQsQX9I.js → pieDiagram-36ENHN4W-DfTnyG8D.js} +1 -1
  70. package/app/web/assets/{quadrantDiagram-ZQUDMS73-D1jOKqx_.js → quadrantDiagram-ZQUDMS73-CreQWjZQ.js} +1 -1
  71. package/app/web/assets/{railroadDiagram-JIZHGYPL-XulrgX5n.js → railroadDiagram-JIZHGYPL-Bhc_eO9G.js} +1 -1
  72. package/app/web/assets/{render-VIF2ZAQL-CSsGw-0I.js → render-VIF2ZAQL-BS1Zgk8K.js} +2 -2
  73. package/app/web/assets/{requirementDiagram-AXW2TVFA-CT66GXLN.js → requirementDiagram-AXW2TVFA-Dlp7d6QT.js} +1 -1
  74. package/app/web/assets/{sankeyDiagram-FBCJTAIF-CNRKebNY.js → sankeyDiagram-FBCJTAIF-DGBchL30.js} +1 -1
  75. package/app/web/assets/{sequenceDiagram-3LA2ROMG-DVl5y64e.js → sequenceDiagram-3LA2ROMG-DauFg5_R.js} +1 -1
  76. package/app/web/assets/{sizeCapture-2Q2CQKSF-Kg0XxSga.js → sizeCapture-2Q2CQKSF-DR-zy7an.js} +1 -1
  77. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-DYQnfMsS.js → stateDiagram-v2-ATKHQDJO-BSRBSGUi.js} +1 -1
  78. package/app/web/assets/{swimlanes-YQL5WMAO-Chqt7pxD.js → swimlanes-YQL5WMAO-BwzOr5Dv.js} +1 -1
  79. package/app/web/assets/swimlanesDiagram-UCCPES4V-CNV63-us.js +8 -0
  80. package/app/web/assets/{timeline-definition-7Z437IG3-aHFxjIT6.js → timeline-definition-7Z437IG3-BoZ-mNKc.js} +1 -1
  81. package/app/web/assets/{usecaseDiagram-RDK6N6HP-DsC5tFe4.js → usecaseDiagram-RDK6N6HP-DikhgH2m.js} +1 -1
  82. package/app/web/assets/{vennDiagram-SHRQU5PJ-C65oZxFn.js → vennDiagram-SHRQU5PJ-DY_oIxwl.js} +1 -1
  83. package/app/web/assets/{wardleyDiagram-F3OXNVQS-HTkq7DT0.js → wardleyDiagram-F3OXNVQS-DrRIiB_M.js} +1 -1
  84. package/app/web/assets/{xychartDiagram-GDYJKCDI-p1LpQ9MH.js → xychartDiagram-GDYJKCDI-CzSPgHV7.js} +1 -1
  85. package/app/web/codexhost-settings.js +126 -58
  86. package/app/web/index.html +2 -2
  87. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  88. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  89. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  90. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +3 -3
  91. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +1 -1
  92. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  93. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  94. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +12 -12
  95. package/app/web/plugins/deepseek-ai__dsh-client-ui-commands/client.js +1 -1
  96. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +18 -18
  97. package/app/web/plugins/deepseek-ai__dsh-client-ui-plan/client.js +1 -1
  98. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  99. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +7 -7
  100. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +2 -2
  101. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  102. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  103. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +64 -66
  104. package/app/web/sw.js +230 -16
  105. package/app/web-modules/node_modules/@deepseek-ai/dsh-client-modules/index.js +7 -7
  106. package/app/web-modules/server.mjs +1482 -325
  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-BbmB5VLj.css +0 -1
  115. package/app/web/assets/swimlanesDiagram-UCCPES4V-BfREktNP.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, path12) {
832
- if (!path12)
831
+ function getElementAtPath(obj, path13) {
832
+ if (!path13)
833
833
  return obj;
834
- return path12.reduce((acc, key) => acc?.[key], obj);
834
+ return path13.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(path12, issues) {
1174
+ function prefixIssues(path13, issues) {
1175
1175
  return issues.map((iss) => {
1176
1176
  var _a3;
1177
1177
  (_a3 = iss).path ?? (_a3.path = []);
1178
- iss.path.unshift(path12);
1178
+ iss.path.unshift(path13);
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, path12 = []) => {
1640
+ const processError = (error63, path13 = []) => {
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 }, [...path12, ...issue2.path]));
1643
+ issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
1644
1644
  } else if (issue2.code === "invalid_key") {
1645
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1645
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1646
1646
  } else if (issue2.code === "invalid_element") {
1647
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1647
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1648
1648
  } else {
1649
- const fullpath = [...path12, ...issue2.path];
1649
+ const fullpath = [...path13, ...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, path12 = []) => {
1688
+ const processError = (error63, path13 = []) => {
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 }, [...path12, ...issue2.path]));
1692
+ issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
1693
1693
  } else if (issue2.code === "invalid_key") {
1694
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1694
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1695
1695
  } else if (issue2.code === "invalid_element") {
1696
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
1696
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
1697
1697
  } else {
1698
- const fullpath = [...path12, ...issue2.path];
1698
+ const fullpath = [...path13, ...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 path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1738
- for (const seg of path12) {
1737
+ const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
1738
+ for (const seg of path13) {
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 path12 = ref.slice(1).split("/").filter(Boolean);
18877
- if (path12.length === 0) {
18876
+ const path13 = ref.slice(1).split("/").filter(Boolean);
18877
+ if (path13.length === 0) {
18878
18878
  return ctx.rootSchema;
18879
18879
  }
18880
18880
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
18881
- if (path12[0] === defsKey) {
18882
- const key = path12[1] === void 0 ? void 0 : decodeJSONPointerSegment(path12[1]);
18881
+ if (path13[0] === defsKey) {
18882
+ const key = path13[1] === void 0 ? void 0 : decodeJSONPointerSegment(path13[1]);
18883
18883
  if (!key || !ctx.defs[key]) {
18884
18884
  throw new Error(`Reference not found: ${ref}`);
18885
18885
  }
@@ -20564,7 +20564,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
20564
20564
  default: external_exports.string().optional()
20565
20565
  })
20566
20566
  ]).superRefine((field2, ctx) => {
20567
- const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
20567
+ const issue2 = (path13, message) => ctx.addIssue({ code: "custom", path: [path13], message });
20568
20568
  if (field2.type === "number" || field2.type === "range") {
20569
20569
  const { min = -Infinity, max = Infinity, default: value } = field2;
20570
20570
  if (min > max)
@@ -20670,16 +20670,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
20670
20670
  var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
20671
20671
  var hostExtensionDigestSchema = desktopExtensionHashSchema;
20672
20672
  var hostExtensionActivationIdSchema = external_exports.uuid();
20673
- 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((path12) => path12.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
20673
+ 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");
20674
20674
  var legacy = desktopExtensionManifestSchema.shape;
20675
20675
  var localized = (max, min = 0) => external_exports.strictObject({
20676
20676
  en: external_exports.string().trim().min(min).max(max),
20677
20677
  "zh-CN": external_exports.string().trim().min(min).max(max)
20678
20678
  });
20679
- var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path12) => path12.endsWith(suffix), `Expected a ${suffix} file`);
20679
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path13) => path13.endsWith(suffix), `Expected a ${suffix} file`);
20680
20680
  var moduleEntry = resourceWithSuffix(".mjs");
20681
20681
  var style = resourceWithSuffix(".css").optional();
20682
- var hostExtensionCanonicalPath = (path12) => path12.normalize("NFC").toLowerCase();
20682
+ var hostExtensionCanonicalPath = (path13) => path13.normalize("NFC").toLowerCase();
20683
20683
  var hostExtensionManifestV2Schema = external_exports.strictObject({
20684
20684
  manifestVersion: external_exports.literal(2),
20685
20685
  id: hostExtensionIdSchema,
@@ -20689,8 +20689,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
20689
20689
  details: localized(16384).optional(),
20690
20690
  author: legacy.author,
20691
20691
  repository: legacy.repository,
20692
- icon: legacy.icon.refine((path12) => path12 === void 0 || hostExtensionResourcePathSchema.safeParse(path12).success),
20693
- screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path12) => hostExtensionResourcePathSchema.safeParse(path12).success)),
20692
+ icon: legacy.icon.refine((path13) => path13 === void 0 || hostExtensionResourcePathSchema.safeParse(path13).success),
20693
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path13) => hostExtensionResourcePathSchema.safeParse(path13).success)),
20694
20694
  categories: legacy.categories,
20695
20695
  settingsSchema: legacy.settingsSchema,
20696
20696
  slots: legacy.slots.removeDefault().optional(),
@@ -20812,7 +20812,7 @@ var active = {
20812
20812
  digest: hostExtensionDigestSchema
20813
20813
  };
20814
20814
  var optionalActivation = { ...id, activationId: active.activationId.optional() };
20815
- var filePath = external_exports.string().min(1).max(4096).refine((path12) => /^(?:\/|[a-z]:[/\\])/iu.test(path12) && !path12.includes("\0") && !path12.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
20815
+ 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");
20816
20816
  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");
20817
20817
  function base643(maxBytes) {
20818
20818
  return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
@@ -21128,6 +21128,45 @@ var nativeCodexGoalResultSchema = external_exports.object({
21128
21128
  // ../../shared-contracts/dist/client-channel.js
21129
21129
  var CLIENT_CHANNEL_VERSION = 1;
21130
21130
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
21131
+ var THREAD_SECTION_CAPABILITY = "threadSectionsV1";
21132
+ var threadSectionName = external_exports.string().trim().min(1);
21133
+ var threadSectionId = external_exports.string().min(1);
21134
+ var threadSectionAppearance = external_exports.object({
21135
+ icon: external_exports.string().nullable(),
21136
+ color: external_exports.string().nullable()
21137
+ });
21138
+ var clientThreadSectionAppearanceSchema = threadSectionAppearance.nullable();
21139
+ var CLIENT_THREAD_SECTION_MUTATIONS = {
21140
+ create: {
21141
+ method: "codexhost/thread/sections/create",
21142
+ params: external_exports.object({ name: threadSectionName }).strict()
21143
+ },
21144
+ update: {
21145
+ method: "codexhost/thread/sections/update",
21146
+ params: external_exports.object({
21147
+ sectionId: threadSectionId,
21148
+ name: threadSectionName,
21149
+ appearance: threadSectionAppearance.strict().nullable().optional()
21150
+ }).strict()
21151
+ },
21152
+ delete: {
21153
+ method: "codexhost/thread/sections/delete",
21154
+ params: external_exports.object({ sectionId: threadSectionId }).strict()
21155
+ }
21156
+ };
21157
+ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnion("status", [
21158
+ external_exports.object({ status: external_exports.literal("unknown") }),
21159
+ external_exports.object({
21160
+ status: external_exports.literal("confirmed"),
21161
+ sectionId: threadSectionId,
21162
+ section: external_exports.object({
21163
+ id: threadSectionId,
21164
+ name: external_exports.string().min(1),
21165
+ appearance: clientThreadSectionAppearanceSchema
21166
+ }).nullable(),
21167
+ syncPending: external_exports.boolean()
21168
+ })
21169
+ ]);
21131
21170
  var CLIENT_CHANNEL_METHODS = [
21132
21171
  "codexhost/skills/list",
21133
21172
  "codexhost/voice/status",
@@ -21138,6 +21177,8 @@ var CLIENT_CHANNEL_METHODS = [
21138
21177
  "codexhost/harness/preferences/get",
21139
21178
  "codexhost/harness/preferences/patch",
21140
21179
  "experimentalFeature/list",
21180
+ "collaborationMode/list",
21181
+ "codexhost/thread/collaboration-mode/select",
21141
21182
  "thread/list",
21142
21183
  "thread/metadata/update",
21143
21184
  "codexhost/thread/catalog/read",
@@ -21174,6 +21215,9 @@ var CLIENT_CHANNEL_METHODS = [
21174
21215
  "codexhost/thread/pins/list",
21175
21216
  "codexhost/thread/sections/list",
21176
21217
  "codexhost/thread/sections/move",
21218
+ CLIENT_THREAD_SECTION_MUTATIONS.create.method,
21219
+ CLIENT_THREAD_SECTION_MUTATIONS.update.method,
21220
+ CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
21177
21221
  "codexhost/thread/pins/set",
21178
21222
  "codexhost/harness/plugins/list",
21179
21223
  "codexhost/harness/inspect",
@@ -21224,16 +21268,21 @@ var CLIENT_CHANNEL_METHODS = [
21224
21268
  "codexhost/sessions/loaded/list"
21225
21269
  ];
21226
21270
  var clientThreadSectionsSchema = external_exports.object({
21271
+ [THREAD_SECTION_CAPABILITY]: external_exports.literal(true).optional(),
21272
+ complete: external_exports.literal(false).optional(),
21227
21273
  sections: external_exports.array(external_exports.object({
21228
21274
  id: external_exports.string().min(1),
21229
21275
  name: external_exports.string().min(1),
21276
+ appearance: clientThreadSectionAppearanceSchema.optional(),
21230
21277
  threads: external_exports.array(jsonObjectSchema)
21231
- }).strict())
21232
- }).strict();
21278
+ }))
21279
+ });
21233
21280
  var clientThreadSectionMoveSchema = external_exports.object({
21234
21281
  threadId: external_exports.string().min(1).max(1024),
21235
- sectionId: external_exports.string().min(1).max(1024).nullable()
21236
- }).strict();
21282
+ sectionId: external_exports.string().min(1).max(1024).nullable(),
21283
+ beforeThreadId: external_exports.string().min(1).max(1024).nullable().optional(),
21284
+ expectedSourceSectionId: external_exports.string().min(1).max(1024).optional()
21285
+ }).refine((move) => move.expectedSourceSectionId === void 0 || move.sectionId === null);
21237
21286
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
21238
21287
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
21239
21288
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -21280,6 +21329,7 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
21280
21329
  harnessId: external_exports.string().min(1)
21281
21330
  }),
21282
21331
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
21332
+ external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
21283
21333
  external_exports.object({
21284
21334
  type: external_exports.literal("preferences-changed"),
21285
21335
  cursor: clientChannelCursorSchema,
@@ -21421,6 +21471,7 @@ var clientThreadSnapshotSchema = external_exports.object({
21421
21471
  nextCursor: external_exports.string().nullable()
21422
21472
  }),
21423
21473
  configuration: external_exports.object({
21474
+ codexCollaborationMode: external_exports.enum(["plan", "default"]).optional(),
21424
21475
  /** Native Codex model names are not external Harness transport refs. */
21425
21476
  native: external_exports.object({
21426
21477
  model: external_exports.string().min(1).max(1024).optional(),
@@ -21446,7 +21497,8 @@ var clientChannelDescriptorSchema = external_exports.object({
21446
21497
  startedAt: external_exports.number(),
21447
21498
  epoch: external_exports.string().uuid(),
21448
21499
  capabilities: external_exports.object({
21449
- peerDelegation: external_exports.literal(1).optional()
21500
+ peerDelegation: external_exports.literal(1).optional(),
21501
+ threadReferenceContext: external_exports.literal(1).optional()
21450
21502
  }).optional()
21451
21503
  });
21452
21504
  var clientChannelResponseSchema = external_exports.object({
@@ -22117,6 +22169,11 @@ var harnessDefaultConfigurationSchema = external_exports.strictObject({
22117
22169
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
22118
22170
  permissionModeId: harnessPermissionModeIdSchema.optional()
22119
22171
  }).refine((value) => Boolean(value.model || value.thinkingOptionId || value.permissionModeId), "A default configuration must contain a preference");
22172
+ var projectHarnessSelectionSchema = external_exports.discriminatedUnion("mode", [
22173
+ external_exports.strictObject({ mode: external_exports.literal("global") }),
22174
+ external_exports.strictObject({ mode: external_exports.literal("last") }),
22175
+ external_exports.strictObject({ mode: external_exports.literal("manual"), harnessId: harnessIdSchema })
22176
+ ]);
22120
22177
  var newThreadDefaultsSchema = external_exports.strictObject({
22121
22178
  lastHarness: harnessIdSchema.optional(),
22122
22179
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
@@ -25625,16 +25682,16 @@ var Diff = class {
25625
25682
  }
25626
25683
  }
25627
25684
  }
25628
- addToPath(path12, added, removed, oldPosInc, options) {
25629
- const last = path12.lastComponent;
25685
+ addToPath(path13, added, removed, oldPosInc, options) {
25686
+ const last = path13.lastComponent;
25630
25687
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
25631
25688
  return {
25632
- oldPos: path12.oldPos + oldPosInc,
25689
+ oldPos: path13.oldPos + oldPosInc,
25633
25690
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
25634
25691
  };
25635
25692
  } else {
25636
25693
  return {
25637
- oldPos: path12.oldPos + oldPosInc,
25694
+ oldPos: path13.oldPos + oldPosInc,
25638
25695
  lastComponent: { count: 1, added, removed, previousComponent: last }
25639
25696
  };
25640
25697
  }
@@ -26973,7 +27030,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
26973
27030
  import { stat as stat3 } from "node:fs/promises";
26974
27031
 
26975
27032
  // ../codebuddy/dist/acp-client.js
26976
- import { execFile as execFile3, spawn } from "node:child_process";
27033
+ import { spawn } from "node:child_process";
26977
27034
  import { Readable as Readable2, Writable } from "node:stream";
26978
27035
 
26979
27036
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -31573,6 +31630,77 @@ function codeBuddyInvocation(environment, ephemeral, argumentsOverride) {
31573
31630
  var CODEBUDDY_DELEGATION_INSTRUCTIONS = `This Session runs inside codexhost.
31574
31631
  When the user requests cross-Harness agent delegation, use the executable at the CODEXHOST_CLI_PATH environment variable through your native shell tool. Start with its --help and harness list commands, then use delegate start and thread send/read/wait/cancel as documented by the CLI. Pass --format compact when reporting results. Keep the inherited CODEXHOST_RUNTIME_ENDPOINT, CODEXHOST_RUNTIME_TOKEN and CODEXHOST_THREAD_ID environment variables for all such calls; they identify this Runtime and parent Thread. Do not print or expose their values, replace the configured executable, or start delegation unless the user's request authorizes it. Native CodeBuddy Agent subagents remain available for CodeBuddy-only work.`;
31575
31632
 
31633
+ // ../codebuddy/dist/process-termination.js
31634
+ import { execFile as execFile3 } from "node:child_process";
31635
+ import path8 from "node:path";
31636
+ var WINDOWS_TASKKILL_TIMEOUT_MS = 45e3;
31637
+ var MAX_DIAGNOSTIC_LENGTH = 400;
31638
+ var taskkillQueue = Promise.resolve();
31639
+ function windowsTaskkillPath(env = process.env) {
31640
+ const root = env.SystemRoot ?? env.SYSTEMROOT;
31641
+ return root && path8.win32.isAbsolute(root) ? path8.win32.join(root, "System32", "taskkill.exe") : "taskkill";
31642
+ }
31643
+ function compactDiagnostic(value) {
31644
+ const sanitized = sanitizeDiagnosticTail(value).replace(/\s+/gu, " ").trim();
31645
+ return sanitized.length <= MAX_DIAGNOSTIC_LENGTH ? sanitized : `${sanitized.slice(0, MAX_DIAGNOSTIC_LENGTH)}...`;
31646
+ }
31647
+ function formatTaskkillError(error62, stderr) {
31648
+ const info = typeof error62 === "object" && error62 !== null ? error62 : {};
31649
+ const parts = [
31650
+ ...info.code != null ? [`code=${String(info.code)}`] : [],
31651
+ ...info.signal ? [`signal=${info.signal}`] : [],
31652
+ `killed=${Boolean(info.killed)}`
31653
+ ];
31654
+ const rawStderr = typeof stderr === "string" ? stderr : Buffer.isBuffer(stderr) ? stderr.toString("utf8") : typeof info.stderr === "string" ? info.stderr : "";
31655
+ const detail = compactDiagnostic(rawStderr);
31656
+ if (detail)
31657
+ parts.push(`stderr=${detail}`);
31658
+ else {
31659
+ const message = compactDiagnostic(error62 instanceof Error ? error62.message : String(error62));
31660
+ if (message)
31661
+ parts.push(`error=${message}`);
31662
+ }
31663
+ return `taskkill failed (${parts.join(", ")})`;
31664
+ }
31665
+ async function terminateWindowsProcessTree(child, exited, timeoutMs = WINDOWS_TASKKILL_TIMEOUT_MS) {
31666
+ const exitedNow = () => child.exitCode !== null || child.signalCode !== null;
31667
+ if (!child.pid || exitedNow())
31668
+ return void 0;
31669
+ const deadline = Date.now() + timeoutMs;
31670
+ const previous = taskkillQueue;
31671
+ const slot = Promise.withResolvers();
31672
+ taskkillQueue = previous.then(() => slot.promise);
31673
+ let timer;
31674
+ const status = await Promise.race([
31675
+ previous.then(() => "ready"),
31676
+ exited.then(() => "exited"),
31677
+ new Promise((resolve) => {
31678
+ timer = setTimeout(() => resolve("timeout"), Math.max(0, deadline - Date.now()));
31679
+ })
31680
+ ]).finally(() => clearTimeout(timer));
31681
+ if (status === "exited" || exitedNow()) {
31682
+ slot.resolve();
31683
+ return void 0;
31684
+ }
31685
+ const remainingMs = deadline - Date.now();
31686
+ if (status === "timeout" || remainingMs <= 0) {
31687
+ slot.resolve();
31688
+ return `taskkill timed out waiting in termination queue after ${timeoutMs}ms`;
31689
+ }
31690
+ const execution = new Promise((resolve) => {
31691
+ try {
31692
+ execFile3(windowsTaskkillPath(), ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: remainingMs }, (error62, _stdout, stderr) => {
31693
+ slot.resolve();
31694
+ resolve(error62 ? formatTaskkillError(error62, stderr) : void 0);
31695
+ });
31696
+ } catch (error62) {
31697
+ slot.resolve();
31698
+ resolve(formatTaskkillError(error62));
31699
+ }
31700
+ });
31701
+ return Promise.race([execution, exited.then(() => void 0)]);
31702
+ }
31703
+
31576
31704
  // ../codebuddy/dist/acp-client.js
31577
31705
  var sessionEndCarrier = "codexhost.codebuddy/sessionEnd";
31578
31706
  function carrySessionEnd(message) {
@@ -31607,6 +31735,9 @@ var CodeBuddyAcpClient = class {
31607
31735
  #child;
31608
31736
  #connection;
31609
31737
  #exited;
31738
+ #exitedSettled = false;
31739
+ #closeRequested = false;
31740
+ #stdinEnded = false;
31610
31741
  #closing;
31611
31742
  #failure;
31612
31743
  #exitFailure;
@@ -31631,14 +31762,17 @@ var CodeBuddyAcpClient = class {
31631
31762
  windowsVerbatimArguments: invocation.windowsVerbatimArguments,
31632
31763
  detached: process.platform !== "win32"
31633
31764
  });
31634
- this.#exited = new Promise((resolve) => this.#child.once("close", () => resolve()));
31765
+ this.#exited = new Promise((resolve) => this.#child.once("close", () => {
31766
+ this.#exitedSettled = true;
31767
+ resolve();
31768
+ }));
31635
31769
  this.#child.stderr.on("data", () => {
31636
31770
  });
31637
31771
  this.#child.on("error", (error62) => {
31638
31772
  this.#fault(error62);
31639
31773
  });
31640
31774
  this.#child.once("exit", (code, signal) => {
31641
- if (this.#closing || this.#failure)
31775
+ if (this.#closeRequested || this.#failure)
31642
31776
  return;
31643
31777
  const error62 = new CodeBuddyError("processExited", `ACP process exited (${code ?? signal ?? "unknown"})`);
31644
31778
  this.#exitFailure = error62;
@@ -31648,14 +31782,14 @@ var CodeBuddyAcpClient = class {
31648
31782
  });
31649
31783
  this.#connection = new ClientSideConnection(() => ({
31650
31784
  sessionUpdate: async (notification) => {
31651
- if (!this.#closing && !this.#failure)
31785
+ if (!this.#closeRequested && !this.#failure)
31652
31786
  options.handlers.update(restoreSessionEnd(notification));
31653
31787
  },
31654
- requestPermission: (request) => !this.#exitFailure && !this.#closing && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
31788
+ requestPermission: (request) => !this.#exitFailure && !this.#closeRequested && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
31655
31789
  extMethod: async (method, params) => {
31656
31790
  if (method !== "_codebuddy.ai/question")
31657
31791
  throw RequestError.methodNotFound(method);
31658
- if (this.#exitFailure || this.#closing || this.#failure)
31792
+ if (this.#exitFailure || this.#closeRequested || this.#failure)
31659
31793
  return { outcome: "cancelled" };
31660
31794
  return options.handlers.question(params);
31661
31795
  }
@@ -31678,7 +31812,7 @@ var CodeBuddyAcpClient = class {
31678
31812
  };
31679
31813
  }
31680
31814
  #fault(error62) {
31681
- if (this.#closing || this.#failure)
31815
+ if (this.#closeRequested || this.#failure)
31682
31816
  return;
31683
31817
  clearTimeout(this.#exitDrainTimer);
31684
31818
  this.#failure = error62;
@@ -31692,7 +31826,7 @@ var CodeBuddyAcpClient = class {
31692
31826
  throw this.#failure;
31693
31827
  if (this.#exitFailure)
31694
31828
  throw this.#exitFailure;
31695
- if (this.#closing)
31829
+ if (this.#closeRequested)
31696
31830
  throw new CodeBuddyError("invalidState", "ACP client is closed");
31697
31831
  const work = Promise.race([operation(), this.#failed]);
31698
31832
  return label ? bounded(work, timeout, label, (error62) => this.#fault(error62)) : work;
@@ -31745,16 +31879,29 @@ var CodeBuddyAcpClient = class {
31745
31879
  throw new CodeBuddyError("protocolError", "Native question is no longer pending");
31746
31880
  }
31747
31881
  close() {
31882
+ this.#closeRequested = true;
31748
31883
  clearTimeout(this.#exitDrainTimer);
31749
31884
  this.#rejectFailure(new CodeBuddyError("invalidState", "ACP client is closed"));
31750
- this.#closing ??= this.#closeProcess();
31751
- return this.#closing;
31885
+ if (this.#closing)
31886
+ return this.#closing;
31887
+ const closing = this.#closeProcess().catch((error62) => {
31888
+ if (this.#closing === closing)
31889
+ this.#closing = void 0;
31890
+ throw error62;
31891
+ });
31892
+ this.#closing = closing;
31893
+ return closing;
31752
31894
  }
31753
31895
  async #closeProcess() {
31754
- this.#child.stdin.end();
31755
- const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
31756
- if (exited)
31896
+ if (this.#exitedSettled)
31757
31897
  return;
31898
+ if (!this.#stdinEnded) {
31899
+ this.#stdinEnded = true;
31900
+ this.#child.stdin.end();
31901
+ const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
31902
+ if (exited)
31903
+ return;
31904
+ }
31758
31905
  if (this.#child.exitCode !== null || this.#child.signalCode !== null) {
31759
31906
  this.#child.stdout.destroy();
31760
31907
  this.#child.stderr.destroy();
@@ -31762,23 +31909,31 @@ var CodeBuddyAcpClient = class {
31762
31909
  return;
31763
31910
  }
31764
31911
  const pid = this.#child.pid;
31912
+ let terminationDetail;
31765
31913
  if (pid && process.platform === "win32") {
31766
- await new Promise((resolve) => execFile3("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
31914
+ terminationDetail = await terminateWindowsProcessTree(this.#child, this.#exited);
31767
31915
  } else if (pid) {
31768
31916
  try {
31769
31917
  process.kill(-pid, "SIGKILL");
31770
31918
  } catch {
31771
31919
  }
31772
31920
  }
31773
- await bounded(this.#exited, 3e3, "ACP process exit");
31921
+ try {
31922
+ await bounded(this.#exited, 3e3, "ACP process exit");
31923
+ } catch (error62) {
31924
+ if (terminationDetail && error62 instanceof CodeBuddyError) {
31925
+ throw new CodeBuddyError(error62.code, `${error62.message} (${terminationDetail})`);
31926
+ }
31927
+ throw error62;
31928
+ }
31774
31929
  }
31775
31930
  };
31776
31931
 
31777
31932
  // ../codebuddy/dist/derivation.js
31778
31933
  import { randomUUID as randomUUID3 } from "node:crypto";
31779
- import { execFile as execFile4, spawn as spawn2 } from "node:child_process";
31934
+ import { spawn as spawn2 } from "node:child_process";
31780
31935
  import { lstat as lstat3, mkdir, readFile as readFile3, realpath as realpath4, unlink, writeFile } from "node:fs/promises";
31781
- import path8 from "node:path";
31936
+ import path9 from "node:path";
31782
31937
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
31783
31938
 
31784
31939
  // ../codebuddy/dist/child-provenance.js
@@ -32015,8 +32170,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
32015
32170
  windowsVerbatimArguments: invocation.windowsVerbatimArguments,
32016
32171
  detached: process.platform !== "win32"
32017
32172
  });
32173
+ const exited = new Promise((resolve2) => child.once("close", () => resolve2()));
32018
32174
  let output2 = "", bytes = 0, failed = false;
32019
32175
  let termination = Promise.resolve();
32176
+ let terminationDetail;
32020
32177
  const stop = () => {
32021
32178
  if (failed)
32022
32179
  return;
@@ -32025,11 +32182,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
32025
32182
  child.stdout.destroy();
32026
32183
  child.stderr.destroy();
32027
32184
  } else if (process.platform === "win32" && child.pid) {
32028
- termination = new Promise((done) => {
32029
- execFile4("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => {
32185
+ termination = terminateWindowsProcessTree(child, exited).then((detail) => {
32186
+ terminationDetail = detail;
32187
+ if (child.exitCode === null && child.signalCode === null)
32030
32188
  child.kill();
32031
- done();
32032
- });
32033
32189
  });
32034
32190
  } else if (child.pid) {
32035
32191
  try {
@@ -32059,7 +32215,8 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
32059
32215
  clearTimeout(timer);
32060
32216
  signal.removeEventListener("abort", stop);
32061
32217
  if (failed || signal.aborted || code !== 0) {
32062
- reject(new CodeBuddyError("nativeFailure", "Native history copy failed or was interrupted"));
32218
+ const message = terminationDetail ? `Native history copy failed or was interrupted (${terminationDetail})` : "Native history copy failed or was interrupted";
32219
+ reject(new CodeBuddyError("nativeFailure", message));
32063
32220
  return;
32064
32221
  }
32065
32222
  try {
@@ -32135,14 +32292,14 @@ async function bridgeCopyToTarget(sourceCwd, targetCwd, ref, contents, environme
32135
32292
  const targetFile = codeBuddyPrimaryHistoryPath(targetCwd, ref, environment, profile);
32136
32293
  if (sameResolvedPath(sourceFile, targetFile))
32137
32294
  return void 0;
32138
- const targetDirectory = path8.dirname(targetFile);
32139
- const projectsDirectory = path8.dirname(targetDirectory);
32295
+ const targetDirectory = path9.dirname(targetFile);
32296
+ const projectsDirectory = path9.dirname(targetDirectory);
32140
32297
  await mkdir(targetDirectory, { recursive: true });
32141
32298
  const [realProjects, realTargetDirectory] = await Promise.all([
32142
32299
  realpath4(projectsDirectory),
32143
32300
  realpath4(targetDirectory)
32144
32301
  ]);
32145
- if (!sameResolvedPath(realTargetDirectory, path8.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
32302
+ if (!sameResolvedPath(realTargetDirectory, path9.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
32146
32303
  throw new CodeBuddyError("invalidRequest", "Cross-directory history bridge target escaped the native projects root");
32147
32304
  const expected = Buffer.from(contents, "utf8");
32148
32305
  await writeFile(targetFile, expected, { flag: "wx", mode: 384 });
@@ -32252,7 +32409,7 @@ function assertChildRanges(rows2, child) {
32252
32409
  }
32253
32410
  }
32254
32411
  async function plainDirectory(parent, name) {
32255
- const directory = path8.join(parent, name);
32412
+ const directory = path9.join(parent, name);
32256
32413
  await mkdir(directory, { mode: 448 }).catch((error62) => {
32257
32414
  if (record3(error62).code !== "EEXIST")
32258
32415
  throw error62;
@@ -32298,18 +32455,18 @@ async function copyInheritedChildren(options) {
32298
32455
  if (!references.length)
32299
32456
  return { descriptors: [], created: [] };
32300
32457
  const sourceHistoryFile = await realpath4(options.sourceHistoryFile);
32301
- const sourceProject = path8.dirname(sourceHistoryFile);
32302
- if (!sameResolvedPath(sourceHistoryFile, path8.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
32458
+ const sourceProject = path9.dirname(sourceHistoryFile);
32459
+ if (!sameResolvedPath(sourceHistoryFile, path9.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
32303
32460
  throw new CodeBuddyError("invalidRequest", "Unexpected source history location");
32304
- const sourceDirectory = path8.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
32461
+ const sourceDirectory = path9.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
32305
32462
  const sourceDirectoryInfo = await lstat3(sourceDirectory);
32306
32463
  if (!sourceDirectoryInfo.isDirectory() || sourceDirectoryInfo.isSymbolicLink())
32307
32464
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
32308
32465
  if (!sameResolvedPath(await realpath4(sourceDirectory), sourceDirectory))
32309
32466
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
32310
32467
  const targetHistoryFile = await realpath4(options.targetHistoryFile);
32311
- const targetProject = path8.dirname(targetHistoryFile);
32312
- if (!sameResolvedPath(targetHistoryFile, path8.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
32468
+ const targetProject = path9.dirname(targetHistoryFile);
32469
+ if (!sameResolvedPath(targetHistoryFile, path9.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
32313
32470
  throw new CodeBuddyError("invalidRequest", "Unexpected target history location");
32314
32471
  const targetSessionDirectory = await plainDirectory(targetProject, options.targetRef.nativeSessionId);
32315
32472
  const targetDirectory = await plainDirectory(targetSessionDirectory, "subagents");
@@ -32317,7 +32474,7 @@ async function copyInheritedChildren(options) {
32317
32474
  const created = [];
32318
32475
  try {
32319
32476
  for (const reference of references) {
32320
- const sourceFile = path8.join(sourceDirectory, `${reference.childId}.jsonl`);
32477
+ const sourceFile = path9.join(sourceDirectory, `${reference.childId}.jsonl`);
32321
32478
  const sourceInfo = await lstat3(sourceFile);
32322
32479
  if (!sourceInfo.isFile() || sourceInfo.isSymbolicLink())
32323
32480
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent transcript");
@@ -32336,7 +32493,7 @@ async function copyInheritedChildren(options) {
32336
32493
  throw new CodeBuddyError("protocolError", "Missing Agent result child range");
32337
32494
  const prefix = await codeBuddyChildPrefixThrough(source.contents, last, validated);
32338
32495
  const expected = Buffer.from(prefix.contents, "utf8");
32339
- const targetFile = path8.join(targetDirectory, `${reference.childId}.jsonl`);
32496
+ const targetFile = path9.join(targetDirectory, `${reference.childId}.jsonl`);
32340
32497
  const copy = await persistChildCopy(targetFile, expected);
32341
32498
  if (copy)
32342
32499
  created.push(copy);
@@ -32576,7 +32733,7 @@ async function deriveCodeBuddySession(options) {
32576
32733
  // ../codebuddy/dist/session-import.js
32577
32734
  import { createReadStream as createReadStream2 } from "node:fs";
32578
32735
  import { opendir, readFile as readFile4, stat as stat2 } from "node:fs/promises";
32579
- import path9 from "node:path";
32736
+ import path10 from "node:path";
32580
32737
  import { createInterface as createInterface2 } from "node:readline";
32581
32738
 
32582
32739
  // ../../harness-adapter/dist/session-import.js
@@ -32739,7 +32896,7 @@ async function readFacts(file2, signal) {
32739
32896
  return null;
32740
32897
  }
32741
32898
  const row = record3(parsed);
32742
- if (typeof row.cwd === "string" && path9.isAbsolute(row.cwd))
32899
+ if (typeof row.cwd === "string" && path10.isAbsolute(row.cwd))
32743
32900
  cwd ??= row.cwd;
32744
32901
  if (typeof row.timestamp === "number" && Number.isFinite(row.timestamp))
32745
32902
  updatedAt = row.timestamp;
@@ -32812,7 +32969,7 @@ var CodeBuddySessionImport = class {
32812
32969
  /** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
32813
32970
  async #activeSessions(signal) {
32814
32971
  const active2 = /* @__PURE__ */ new Set();
32815
- const directory = path9.join(this.#root(), "sessions");
32972
+ const directory = path10.join(this.#root(), "sessions");
32816
32973
  const markers = await opendir(directory).catch((error62) => {
32817
32974
  if (isMissingFileError(error62) || record3(error62).code === "ENOTDIR")
32818
32975
  return null;
@@ -32825,7 +32982,7 @@ var CodeBuddySessionImport = class {
32825
32982
  if (!marker.isFile() || !marker.name.endsWith(".json"))
32826
32983
  continue;
32827
32984
  try {
32828
- const file2 = path9.join(directory, marker.name);
32985
+ const file2 = path10.join(directory, marker.name);
32829
32986
  if ((await stat2(file2)).size > MAX_MARKER_BYTES)
32830
32987
  continue;
32831
32988
  const entry = record3(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
@@ -32841,7 +32998,7 @@ var CodeBuddySessionImport = class {
32841
32998
  }
32842
32999
  /** Session ID to every project file claiming it. Enumerated links are not followed. */
32843
33000
  async #sessionFiles(signal) {
32844
- const root = path9.join(this.#root(), "projects");
33001
+ const root = path10.join(this.#root(), "projects");
32845
33002
  const found = /* @__PURE__ */ new Map();
32846
33003
  const info = await optionalLstat(root);
32847
33004
  if (!info)
@@ -32852,7 +33009,7 @@ var CodeBuddySessionImport = class {
32852
33009
  signal.throwIfAborted();
32853
33010
  if (!project2.isDirectory())
32854
33011
  continue;
32855
- const projectDirectory = path9.join(root, project2.name);
33012
+ const projectDirectory = path10.join(root, project2.name);
32856
33013
  const entries = await opendir(projectDirectory).catch((error62) => {
32857
33014
  if (isMissingFileError(error62))
32858
33015
  return null;
@@ -32866,7 +33023,7 @@ var CodeBuddySessionImport = class {
32866
33023
  if (!nativeSessionId)
32867
33024
  continue;
32868
33025
  const files = found.get(nativeSessionId) ?? [];
32869
- files.push(path9.join(projectDirectory, entry.name));
33026
+ files.push(path10.join(projectDirectory, entry.name));
32870
33027
  found.set(nativeSessionId, files);
32871
33028
  }
32872
33029
  }
@@ -32881,7 +33038,7 @@ var CodeBuddySessionImport = class {
32881
33038
  const facts = await readFacts(file2, signal);
32882
33039
  if (!facts)
32883
33040
  return null;
32884
- const cwd = path9.resolve(facts.cwd);
33041
+ const cwd = path10.resolve(facts.cwd);
32885
33042
  if (!(await stat2(cwd)).isDirectory())
32886
33043
  return null;
32887
33044
  const nativeRef = nativeSessionRefSchema.parse({
@@ -32891,7 +33048,7 @@ var CodeBuddySessionImport = class {
32891
33048
  });
32892
33049
  signal.throwIfAborted();
32893
33050
  const history = await codeBuddyNativeHistory(cwd, nativeRef, this.#environment, this.#profile);
32894
- if (path9.resolve(history.file) !== path9.resolve(file2))
33051
+ if (path10.resolve(history.file) !== path10.resolve(file2))
32895
33052
  return null;
32896
33053
  const candidate = sessionImportCandidate({
32897
33054
  nativeSessionId,
@@ -33174,7 +33331,7 @@ var CodeBuddyInteractions = class {
33174
33331
 
33175
33332
  // ../codebuddy/dist/subagent-history.js
33176
33333
  import { readdir as readdir3, realpath as realpath5 } from "node:fs/promises";
33177
- import path10 from "node:path";
33334
+ import path11 from "node:path";
33178
33335
  var equalPath2 = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
33179
33336
  var MAX_CACHED_CHILDREN = 16;
33180
33337
  var CodeBuddyChildObserver = class {
@@ -33238,8 +33395,8 @@ var CodeBuddyChildObserver = class {
33238
33395
  }
33239
33396
  async #directory() {
33240
33397
  const history = await this.#parentHistory();
33241
- const project2 = path10.dirname(await realpath5(history.file));
33242
- const expected = path10.join(project2, this.parent.nativeSessionId, "subagents");
33398
+ const project2 = path11.dirname(await realpath5(history.file));
33399
+ const expected = path11.join(project2, this.parent.nativeSessionId, "subagents");
33243
33400
  const actual = await realpath5(expected);
33244
33401
  this.#assertOpen();
33245
33402
  if (!equalPath2(actual, expected))
@@ -33249,7 +33406,7 @@ var CodeBuddyChildObserver = class {
33249
33406
  async #child(directory, childId) {
33250
33407
  if (!validCodeBuddyChildId(childId))
33251
33408
  throw new CodeBuddyError("invalidRequest", "Invalid native Subagent ID");
33252
- const file2 = path10.join(directory, `${childId}.jsonl`);
33409
+ const file2 = path11.join(directory, `${childId}.jsonl`);
33253
33410
  const before = await codeBuddyFileVersion(file2);
33254
33411
  if (!equalPath2(before.realFile, file2))
33255
33412
  throw new CodeBuddyError("invalidRequest", "Redirected Subagent transcript");
@@ -33576,6 +33733,7 @@ var CodeBuddySession = class {
33576
33733
  #autonomous = new CodeBuddyAutonomousTurns();
33577
33734
  #busy = false;
33578
33735
  #closed = false;
33736
+ #closeNotified = false;
33579
33737
  #closing;
33580
33738
  #fault;
33581
33739
  #hasTurn = false;
@@ -34257,8 +34415,15 @@ var CodeBuddySession = class {
34257
34415
  this.#channel.end();
34258
34416
  }
34259
34417
  close() {
34260
- this.#closing ??= this.#close();
34261
- return this.#closing;
34418
+ if (this.#closing)
34419
+ return this.#closing;
34420
+ const closing = this.#close().catch((error62) => {
34421
+ if (this.#closing === closing)
34422
+ this.#closing = void 0;
34423
+ throw error62;
34424
+ });
34425
+ this.#closing = closing;
34426
+ return closing;
34262
34427
  }
34263
34428
  async #close() {
34264
34429
  this.#closed = true;
@@ -34275,7 +34440,10 @@ var CodeBuddySession = class {
34275
34440
  } finally {
34276
34441
  this.subagents.close();
34277
34442
  this.#channel.end();
34278
- this.onClose();
34443
+ if (!this.#closeNotified) {
34444
+ this.#closeNotified = true;
34445
+ this.onClose();
34446
+ }
34279
34447
  }
34280
34448
  }
34281
34449
  };
@@ -34724,7 +34892,7 @@ var linuxSpec = {
34724
34892
  };
34725
34893
  function resolveWorkBuddyInstallDirectory(directory, environment, platform, isExecutable, subdirectories = subdirectoryNames) {
34726
34894
  const paths = targetPath(platform);
34727
- const entries = platform === "win32" ? ["WorkBuddy.exe", "WorkBuddy AI.exe", "WorkBuddyAI.exe"] : platform === "darwin" ? [paths.join("Contents", "MacOS", "Electron")] : platform === "linux" ? ["workbuddy"] : [];
34895
+ const entries = platform === "win32" ? ["WorkBuddy-app.exe", "WorkBuddy.exe", "WorkBuddy AI.exe", "WorkBuddyAI.exe"] : platform === "darwin" ? [paths.join("Contents", "MacOS", "Electron")] : platform === "linux" ? ["workbuddy"] : [];
34728
34896
  for (const entry of entries) {
34729
34897
  const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry), subdirectories);
34730
34898
  if (bundle)
@@ -34774,13 +34942,13 @@ function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExe
34774
34942
  continue;
34775
34943
  if (!isExecutable(candidate))
34776
34944
  continue;
34945
+ const launcher = resolveWorkBuddyLauncherLayout(paths.dirname(candidate), platform, isExecutable, subdirectories);
34946
+ if (launcher)
34947
+ return launcher;
34777
34948
  const resources = platform === "darwin" ? paths.resolve(paths.dirname(candidate), "..", "Resources") : paths.join(paths.dirname(candidate), "resources");
34778
34949
  const cli = paths.join(resources, "app.asar.unpacked", "cli", "bin", "codebuddy");
34779
34950
  if (isExecutable(cli))
34780
34951
  return { executable: candidate, cli };
34781
- const launcher = resolveWorkBuddyLauncherLayout(paths.dirname(candidate), platform, isExecutable, subdirectories);
34782
- if (launcher)
34783
- return launcher;
34784
34952
  }
34785
34953
  return void 0;
34786
34954
  }
@@ -34857,7 +35025,7 @@ function resolveWorkBuddyLaunch(environment, dependencies = {}) {
34857
35025
  const configuredDirectory = configured && (dependencies.isDirectory ?? isDirectory)(configured) ? configured : void 0;
34858
35026
  const explicitExecutable = configured && !configuredDirectory ? resolveHarnessExecutable(workBuddyDiscoverySpec, { environment, platform, command: configured }, { isExecutable })?.executable : void 0;
34859
35027
  const explicitBundle = explicitExecutable ? resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExecutable, subdirectories) : void 0;
34860
- const explicitDesktop = explicitExecutable !== void 0 && (platform === "win32" && /^(?:WorkBuddy|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");
35028
+ 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");
34861
35029
  const bundle = configuredDirectory ? resolveWorkBuddyInstallDirectory(configuredDirectory, environment, platform, isExecutable, subdirectories) : !configured ? resolveWorkBuddyBundle(environment, platform, isExecutable, void 0, subdirectories) : explicitDesktop ? explicitBundle : void 0;
34862
35030
  const executable = configured && !explicitDesktop && !configuredDirectory ? explicitExecutable : bundle?.executable;
34863
35031
  if (!executable)
@@ -34949,7 +35117,7 @@ var WORKBUDDY_RUNTIME_PROFILE = {
34949
35117
 
34950
35118
  // dist/product-models.js
34951
35119
  import { readFile as readFile5, stat as stat4 } from "node:fs/promises";
34952
- import path11 from "node:path";
35120
+ import path12 from "node:path";
34953
35121
  var MAX_PRODUCT_SNAPSHOT_BYTES = 8 * 1024 * 1024;
34954
35122
  var PRODUCT_CONFIG_PATH_ENV = "ACC_PRODUCT_CONFIG_PATH";
34955
35123
  var PRODUCT_CONFIG_INLINE_ENVS = [
@@ -35011,7 +35179,7 @@ function bundledFallbackProductPath(invocation) {
35011
35179
  const cli = invocation.bundledCliPath;
35012
35180
  if (!cli)
35013
35181
  return;
35014
- return path11.join(path11.dirname(path11.dirname(cli)), "product.json");
35182
+ return path12.join(path12.dirname(path12.dirname(cli)), "product.json");
35015
35183
  }
35016
35184
  async function loadWorkBuddyProductModels(environment) {
35017
35185
  const invocation = workBuddyInvocation(environment, true);