@codexhost/cli-win32-x64 0.30.0 → 0.31.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 (102) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +54 -5
  4. package/app/console-web.js +74 -7
  5. package/app/desktop-controller.mjs +60 -9
  6. package/app/host-runtime.mjs +1367 -322
  7. package/app/plugins/antigravity/plugin.mjs +54 -5
  8. package/app/plugins/claude-code/plugin.mjs +65 -13
  9. package/app/plugins/codebuddy/plugin.mjs +253 -93
  10. package/app/plugins/codex-usage/plugin.mjs +54 -5
  11. package/app/plugins/copilot/plugin.mjs +54 -5
  12. package/app/plugins/cursor-cli/plugin.mjs +54 -5
  13. package/app/plugins/deepseek-harness/plugin.mjs +54 -5
  14. package/app/plugins/devin/plugin.mjs +54 -5
  15. package/app/plugins/grok/plugin.mjs +54 -5
  16. package/app/plugins/hermes/plugin.mjs +54 -5
  17. package/app/plugins/kimi-code/plugin.mjs +54 -5
  18. package/app/plugins/kiro-cli/plugin.mjs +54 -5
  19. package/app/plugins/omp/plugin.mjs +54 -5
  20. package/app/plugins/opencode/plugin.mjs +54 -5
  21. package/app/plugins/pi/plugin.mjs +54 -5
  22. package/app/plugins/qoder/plugin.mjs +54 -5
  23. package/app/plugins/qoder-cn/plugin.mjs +54 -5
  24. package/app/plugins/qwen-code/plugin.mjs +54 -5
  25. package/app/plugins/workbuddy/plugin.mjs +253 -93
  26. package/app/plugins/zcode/plugin.mjs +54 -5
  27. package/app/renderer-extension.js +650 -413
  28. package/app/web/assets/{abnfDiagram-XWFEHMT6-BdinLox4.js → abnfDiagram-XWFEHMT6-Bqy7uOSy.js} +1 -1
  29. package/app/web/assets/{architectureDiagram-CSQXQB3N-DgPBbtvP.js → architectureDiagram-CSQXQB3N-6aaP1YoM.js} +1 -1
  30. package/app/web/assets/{blockDiagram-BEDRHYPZ-B4ENdwtZ.js → blockDiagram-BEDRHYPZ-B4QSFXe0.js} +1 -1
  31. package/app/web/assets/{c4Diagram-M2UUVUY5-DA6Owfyu.js → c4Diagram-M2UUVUY5-BYE-C8Gq.js} +1 -1
  32. package/app/web/assets/{chunk-2Q5K7J3B-Dvh3qOmo.js → chunk-2Q5K7J3B-CiEM-GTd.js} +1 -1
  33. package/app/web/assets/{chunk-3GCGMST5-VIkqueym.js → chunk-3GCGMST5-hzY9BiB1.js} +1 -1
  34. package/app/web/assets/{chunk-5VM5RSS4-DTYof_OI.js → chunk-5VM5RSS4-DYXznY0H.js} +1 -1
  35. package/app/web/assets/{chunk-7U7NFRK5-Dp7s2dg0.js → chunk-7U7NFRK5-Bzw5MDPr.js} +1 -1
  36. package/app/web/assets/{chunk-CNRTWJTD-TKBKxZLU.js → chunk-CNRTWJTD-DMbxMfi3.js} +1 -1
  37. package/app/web/assets/{chunk-D5HYT7QG-BRZDovSS.js → chunk-D5HYT7QG-By0ZVBtD.js} +1 -1
  38. package/app/web/assets/{chunk-EBZ3SEQC-C9USZ3tT.js → chunk-EBZ3SEQC-Yyu_sMV7.js} +2 -2
  39. package/app/web/assets/{chunk-JWPE2WC7-BrdvVNVo.js → chunk-JWPE2WC7-DDzqxIPT.js} +1 -1
  40. package/app/web/assets/{chunk-KTR4FSNJ-C7qwjGba.js → chunk-KTR4FSNJ-GlKqhtpl.js} +1 -1
  41. package/app/web/assets/{chunk-XXDRQBXY-DlSrRuwN.js → chunk-XXDRQBXY-DNc-CvYu.js} +1 -1
  42. package/app/web/assets/{classDiagram-v2-KXABOMEV-BFvB4kwX.js → classDiagram-v2-KXABOMEV-4_PFS2N_.js} +1 -1
  43. package/app/web/assets/{cose-bilkent-JH36ORCC-UyCAqNvj.js → cose-bilkent-JH36ORCC-BE3foHUY.js} +1 -1
  44. package/app/web/assets/{cynefin-EF2NZ3EQ-CwawUbjJ.js → cynefin-EF2NZ3EQ-D2PqrYZ3.js} +1 -1
  45. package/app/web/assets/{cynefinDiagram-NJNITYFG-BaWEIQJ0.js → cynefinDiagram-NJNITYFG-DOObpTbq.js} +1 -1
  46. package/app/web/assets/{dagre-KIHZ2IZ3-B7ENIjLG.js → dagre-KIHZ2IZ3-Znm2jin9.js} +1 -1
  47. package/app/web/assets/{diagram-7YQZDPLS-CxRMU8xq.js → diagram-7YQZDPLS-ByZMD-uA.js} +1 -1
  48. package/app/web/assets/{diagram-QBROCOUO-qo7sxm4K.js → diagram-QBROCOUO-BiRShpnN.js} +1 -1
  49. package/app/web/assets/{diagram-RJJCUUZO-CQiGMCMe.js → diagram-RJJCUUZO-D9wLVoK2.js} +1 -1
  50. package/app/web/assets/{diagram-WERXNKYE-D0Jps1As.js → diagram-WERXNKYE-BSbIh-yC.js} +1 -1
  51. package/app/web/assets/{diagram-YHHI257C-p4AB8cqK.js → diagram-YHHI257C-DMWrHMc8.js} +1 -1
  52. package/app/web/assets/{diagram-YR4HJLHV-Bh6JKT04.js → diagram-YR4HJLHV-C4sBAFb1.js} +1 -1
  53. package/app/web/assets/{ebnfDiagram-N527522P-DRac0k4W.js → ebnfDiagram-N527522P-BZLloaoQ.js} +1 -1
  54. package/app/web/assets/{elk-O5DQBFGD-CWTz5SZP.js → elk-O5DQBFGD-Da3e5tn5.js} +1 -1
  55. package/app/web/assets/{erDiagram-K3K3BIDK-DE3w4BEY.js → erDiagram-K3K3BIDK-B2lKAIZF.js} +1 -1
  56. package/app/web/assets/{flowDiagram-Z6JWZHQI-NYs8bi5t.js → flowDiagram-Z6JWZHQI-q2EY_kmB.js} +1 -1
  57. package/app/web/assets/{ganttDiagram-3PRQTZWP-Bspp9btW.js → ganttDiagram-3PRQTZWP-BGrNZ20b.js} +1 -1
  58. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-ByGW1uvv.js → gitGraphDiagram-VXDFKS5L-DIZNXREy.js} +1 -1
  59. package/app/web/assets/{grid-E2QIVN74-CegebiIw.js → grid-E2QIVN74-0cUkPG69.js} +1 -1
  60. package/app/web/assets/{index-DFPOGLS4.js → index-PN7K-15_.js} +76 -76
  61. package/app/web/assets/{infoDiagram-EZ3ZOAHP-CexmsdZx.js → infoDiagram-EZ3ZOAHP-BHhUTQCn.js} +1 -1
  62. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-BbWqKhg6.js → ishikawaDiagram-S3EKX5GW-DPOxtl4c.js} +1 -1
  63. package/app/web/assets/{journeyDiagram-POQNLL5X-27YlCe-1.js → journeyDiagram-POQNLL5X-D8RyXckG.js} +1 -1
  64. package/app/web/assets/{kanban-definition-BH5XI6FM-BAhOdeck.js → kanban-definition-BH5XI6FM-COJv3Hyh.js} +1 -1
  65. package/app/web/assets/{mermaid.core-sGgCbv5y.js → mermaid.core-DYdcDKIt.js} +4 -4
  66. package/app/web/assets/{mindmap-definition-WVAN44T4-CsMIX0Lj.js → mindmap-definition-WVAN44T4-DnYIM4ja.js} +1 -1
  67. package/app/web/assets/{pegDiagram-D4NLKWP3-Cs3LXqn_.js → pegDiagram-D4NLKWP3-Ds3GAEJ6.js} +1 -1
  68. package/app/web/assets/{pieDiagram-36ENHN4W-DdQsQX9I.js → pieDiagram-36ENHN4W-BhLUJGEB.js} +1 -1
  69. package/app/web/assets/{quadrantDiagram-ZQUDMS73-D1jOKqx_.js → quadrantDiagram-ZQUDMS73-DwtX-IxK.js} +1 -1
  70. package/app/web/assets/{railroadDiagram-JIZHGYPL-XulrgX5n.js → railroadDiagram-JIZHGYPL-D2vmTTnJ.js} +1 -1
  71. package/app/web/assets/{render-VIF2ZAQL-CSsGw-0I.js → render-VIF2ZAQL-DGU1ql-Z.js} +2 -2
  72. package/app/web/assets/{requirementDiagram-AXW2TVFA-CT66GXLN.js → requirementDiagram-AXW2TVFA-u3j1sKkI.js} +1 -1
  73. package/app/web/assets/{sankeyDiagram-FBCJTAIF-CNRKebNY.js → sankeyDiagram-FBCJTAIF-k-An9VHW.js} +1 -1
  74. package/app/web/assets/{sequenceDiagram-3LA2ROMG-DVl5y64e.js → sequenceDiagram-3LA2ROMG-DUjbYb4R.js} +1 -1
  75. package/app/web/assets/{sizeCapture-2Q2CQKSF-Kg0XxSga.js → sizeCapture-2Q2CQKSF-DATTL7FZ.js} +1 -1
  76. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-DYQnfMsS.js → stateDiagram-v2-ATKHQDJO-cCJX5M2u.js} +1 -1
  77. package/app/web/assets/{swimlanes-YQL5WMAO-Chqt7pxD.js → swimlanes-YQL5WMAO-B7grWEWt.js} +1 -1
  78. package/app/web/assets/swimlanesDiagram-UCCPES4V-B8Jem9gq.js +8 -0
  79. package/app/web/assets/{timeline-definition-7Z437IG3-aHFxjIT6.js → timeline-definition-7Z437IG3-BhsLa6l1.js} +1 -1
  80. package/app/web/assets/{usecaseDiagram-RDK6N6HP-DsC5tFe4.js → usecaseDiagram-RDK6N6HP-CkPQYmQw.js} +1 -1
  81. package/app/web/assets/{vennDiagram-SHRQU5PJ-C65oZxFn.js → vennDiagram-SHRQU5PJ-CufZSwvw.js} +1 -1
  82. package/app/web/assets/{wardleyDiagram-F3OXNVQS-HTkq7DT0.js → wardleyDiagram-F3OXNVQS-CSkfpFOA.js} +1 -1
  83. package/app/web/assets/{xychartDiagram-GDYJKCDI-p1LpQ9MH.js → xychartDiagram-GDYJKCDI-BhZf9scK.js} +1 -1
  84. package/app/web/codexhost-settings.js +56 -56
  85. package/app/web/index.html +1 -1
  86. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  87. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  88. package/app/web/plugins/deepseek-ai__dsh-api-workspace-controller/client.js +3 -3
  89. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  90. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +16 -16
  91. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +16 -16
  92. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  93. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -72
  94. package/app/web-modules/server.mjs +383 -148
  95. package/bin/codexhost.exe +0 -0
  96. package/libexec/codexhost-node-repl.exe +0 -0
  97. package/libexec/codexhost-screenshot.exe +0 -0
  98. package/libexec/codexhost-shell.exe +0 -0
  99. package/libexec/codexhost-shim.exe +0 -0
  100. package/libexec/codexhost-updater.exe +0 -0
  101. package/package.json +1 -1
  102. 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",
@@ -21174,6 +21213,9 @@ var CLIENT_CHANNEL_METHODS = [
21174
21213
  "codexhost/thread/pins/list",
21175
21214
  "codexhost/thread/sections/list",
21176
21215
  "codexhost/thread/sections/move",
21216
+ CLIENT_THREAD_SECTION_MUTATIONS.create.method,
21217
+ CLIENT_THREAD_SECTION_MUTATIONS.update.method,
21218
+ CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
21177
21219
  "codexhost/thread/pins/set",
21178
21220
  "codexhost/harness/plugins/list",
21179
21221
  "codexhost/harness/inspect",
@@ -21224,16 +21266,21 @@ var CLIENT_CHANNEL_METHODS = [
21224
21266
  "codexhost/sessions/loaded/list"
21225
21267
  ];
21226
21268
  var clientThreadSectionsSchema = external_exports.object({
21269
+ [THREAD_SECTION_CAPABILITY]: external_exports.literal(true).optional(),
21270
+ complete: external_exports.literal(false).optional(),
21227
21271
  sections: external_exports.array(external_exports.object({
21228
21272
  id: external_exports.string().min(1),
21229
21273
  name: external_exports.string().min(1),
21274
+ appearance: clientThreadSectionAppearanceSchema.optional(),
21230
21275
  threads: external_exports.array(jsonObjectSchema)
21231
- }).strict())
21232
- }).strict();
21276
+ }))
21277
+ });
21233
21278
  var clientThreadSectionMoveSchema = external_exports.object({
21234
21279
  threadId: external_exports.string().min(1).max(1024),
21235
- sectionId: external_exports.string().min(1).max(1024).nullable()
21236
- }).strict();
21280
+ sectionId: external_exports.string().min(1).max(1024).nullable(),
21281
+ beforeThreadId: external_exports.string().min(1).max(1024).nullable().optional(),
21282
+ expectedSourceSectionId: external_exports.string().min(1).max(1024).optional()
21283
+ }).refine((move) => move.expectedSourceSectionId === void 0 || move.sectionId === null);
21237
21284
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
21238
21285
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
21239
21286
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -21280,6 +21327,7 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
21280
21327
  harnessId: external_exports.string().min(1)
21281
21328
  }),
21282
21329
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
21330
+ external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
21283
21331
  external_exports.object({
21284
21332
  type: external_exports.literal("preferences-changed"),
21285
21333
  cursor: clientChannelCursorSchema,
@@ -21446,7 +21494,8 @@ var clientChannelDescriptorSchema = external_exports.object({
21446
21494
  startedAt: external_exports.number(),
21447
21495
  epoch: external_exports.string().uuid(),
21448
21496
  capabilities: external_exports.object({
21449
- peerDelegation: external_exports.literal(1).optional()
21497
+ peerDelegation: external_exports.literal(1).optional(),
21498
+ threadReferenceContext: external_exports.literal(1).optional()
21450
21499
  }).optional()
21451
21500
  });
21452
21501
  var clientChannelResponseSchema = external_exports.object({
@@ -25625,16 +25674,16 @@ var Diff = class {
25625
25674
  }
25626
25675
  }
25627
25676
  }
25628
- addToPath(path12, added, removed, oldPosInc, options) {
25629
- const last = path12.lastComponent;
25677
+ addToPath(path13, added, removed, oldPosInc, options) {
25678
+ const last = path13.lastComponent;
25630
25679
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
25631
25680
  return {
25632
- oldPos: path12.oldPos + oldPosInc,
25681
+ oldPos: path13.oldPos + oldPosInc,
25633
25682
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
25634
25683
  };
25635
25684
  } else {
25636
25685
  return {
25637
- oldPos: path12.oldPos + oldPosInc,
25686
+ oldPos: path13.oldPos + oldPosInc,
25638
25687
  lastComponent: { count: 1, added, removed, previousComponent: last }
25639
25688
  };
25640
25689
  }
@@ -26973,7 +27022,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
26973
27022
  import { stat as stat3 } from "node:fs/promises";
26974
27023
 
26975
27024
  // ../codebuddy/dist/acp-client.js
26976
- import { execFile as execFile3, spawn } from "node:child_process";
27025
+ import { spawn } from "node:child_process";
26977
27026
  import { Readable as Readable2, Writable } from "node:stream";
26978
27027
 
26979
27028
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -31573,6 +31622,77 @@ function codeBuddyInvocation(environment, ephemeral, argumentsOverride) {
31573
31622
  var CODEBUDDY_DELEGATION_INSTRUCTIONS = `This Session runs inside codexhost.
31574
31623
  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
31624
 
31625
+ // ../codebuddy/dist/process-termination.js
31626
+ import { execFile as execFile3 } from "node:child_process";
31627
+ import path8 from "node:path";
31628
+ var WINDOWS_TASKKILL_TIMEOUT_MS = 45e3;
31629
+ var MAX_DIAGNOSTIC_LENGTH = 400;
31630
+ var taskkillQueue = Promise.resolve();
31631
+ function windowsTaskkillPath(env = process.env) {
31632
+ const root = env.SystemRoot ?? env.SYSTEMROOT;
31633
+ return root && path8.win32.isAbsolute(root) ? path8.win32.join(root, "System32", "taskkill.exe") : "taskkill";
31634
+ }
31635
+ function compactDiagnostic(value) {
31636
+ const sanitized = sanitizeDiagnosticTail(value).replace(/\s+/gu, " ").trim();
31637
+ return sanitized.length <= MAX_DIAGNOSTIC_LENGTH ? sanitized : `${sanitized.slice(0, MAX_DIAGNOSTIC_LENGTH)}...`;
31638
+ }
31639
+ function formatTaskkillError(error62, stderr) {
31640
+ const info = typeof error62 === "object" && error62 !== null ? error62 : {};
31641
+ const parts = [
31642
+ ...info.code != null ? [`code=${String(info.code)}`] : [],
31643
+ ...info.signal ? [`signal=${info.signal}`] : [],
31644
+ `killed=${Boolean(info.killed)}`
31645
+ ];
31646
+ const rawStderr = typeof stderr === "string" ? stderr : Buffer.isBuffer(stderr) ? stderr.toString("utf8") : typeof info.stderr === "string" ? info.stderr : "";
31647
+ const detail = compactDiagnostic(rawStderr);
31648
+ if (detail)
31649
+ parts.push(`stderr=${detail}`);
31650
+ else {
31651
+ const message = compactDiagnostic(error62 instanceof Error ? error62.message : String(error62));
31652
+ if (message)
31653
+ parts.push(`error=${message}`);
31654
+ }
31655
+ return `taskkill failed (${parts.join(", ")})`;
31656
+ }
31657
+ async function terminateWindowsProcessTree(child, exited, timeoutMs = WINDOWS_TASKKILL_TIMEOUT_MS) {
31658
+ const exitedNow = () => child.exitCode !== null || child.signalCode !== null;
31659
+ if (!child.pid || exitedNow())
31660
+ return void 0;
31661
+ const deadline = Date.now() + timeoutMs;
31662
+ const previous = taskkillQueue;
31663
+ const slot = Promise.withResolvers();
31664
+ taskkillQueue = previous.then(() => slot.promise);
31665
+ let timer;
31666
+ const status = await Promise.race([
31667
+ previous.then(() => "ready"),
31668
+ exited.then(() => "exited"),
31669
+ new Promise((resolve) => {
31670
+ timer = setTimeout(() => resolve("timeout"), Math.max(0, deadline - Date.now()));
31671
+ })
31672
+ ]).finally(() => clearTimeout(timer));
31673
+ if (status === "exited" || exitedNow()) {
31674
+ slot.resolve();
31675
+ return void 0;
31676
+ }
31677
+ const remainingMs = deadline - Date.now();
31678
+ if (status === "timeout" || remainingMs <= 0) {
31679
+ slot.resolve();
31680
+ return `taskkill timed out waiting in termination queue after ${timeoutMs}ms`;
31681
+ }
31682
+ const execution = new Promise((resolve) => {
31683
+ try {
31684
+ execFile3(windowsTaskkillPath(), ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: remainingMs }, (error62, _stdout, stderr) => {
31685
+ slot.resolve();
31686
+ resolve(error62 ? formatTaskkillError(error62, stderr) : void 0);
31687
+ });
31688
+ } catch (error62) {
31689
+ slot.resolve();
31690
+ resolve(formatTaskkillError(error62));
31691
+ }
31692
+ });
31693
+ return Promise.race([execution, exited.then(() => void 0)]);
31694
+ }
31695
+
31576
31696
  // ../codebuddy/dist/acp-client.js
31577
31697
  var sessionEndCarrier = "codexhost.codebuddy/sessionEnd";
31578
31698
  function carrySessionEnd(message) {
@@ -31607,6 +31727,9 @@ var CodeBuddyAcpClient = class {
31607
31727
  #child;
31608
31728
  #connection;
31609
31729
  #exited;
31730
+ #exitedSettled = false;
31731
+ #closeRequested = false;
31732
+ #stdinEnded = false;
31610
31733
  #closing;
31611
31734
  #failure;
31612
31735
  #exitFailure;
@@ -31631,14 +31754,17 @@ var CodeBuddyAcpClient = class {
31631
31754
  windowsVerbatimArguments: invocation.windowsVerbatimArguments,
31632
31755
  detached: process.platform !== "win32"
31633
31756
  });
31634
- this.#exited = new Promise((resolve) => this.#child.once("close", () => resolve()));
31757
+ this.#exited = new Promise((resolve) => this.#child.once("close", () => {
31758
+ this.#exitedSettled = true;
31759
+ resolve();
31760
+ }));
31635
31761
  this.#child.stderr.on("data", () => {
31636
31762
  });
31637
31763
  this.#child.on("error", (error62) => {
31638
31764
  this.#fault(error62);
31639
31765
  });
31640
31766
  this.#child.once("exit", (code, signal) => {
31641
- if (this.#closing || this.#failure)
31767
+ if (this.#closeRequested || this.#failure)
31642
31768
  return;
31643
31769
  const error62 = new CodeBuddyError("processExited", `ACP process exited (${code ?? signal ?? "unknown"})`);
31644
31770
  this.#exitFailure = error62;
@@ -31648,14 +31774,14 @@ var CodeBuddyAcpClient = class {
31648
31774
  });
31649
31775
  this.#connection = new ClientSideConnection(() => ({
31650
31776
  sessionUpdate: async (notification) => {
31651
- if (!this.#closing && !this.#failure)
31777
+ if (!this.#closeRequested && !this.#failure)
31652
31778
  options.handlers.update(restoreSessionEnd(notification));
31653
31779
  },
31654
- requestPermission: (request) => !this.#exitFailure && !this.#closing && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
31780
+ requestPermission: (request) => !this.#exitFailure && !this.#closeRequested && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
31655
31781
  extMethod: async (method, params) => {
31656
31782
  if (method !== "_codebuddy.ai/question")
31657
31783
  throw RequestError.methodNotFound(method);
31658
- if (this.#exitFailure || this.#closing || this.#failure)
31784
+ if (this.#exitFailure || this.#closeRequested || this.#failure)
31659
31785
  return { outcome: "cancelled" };
31660
31786
  return options.handlers.question(params);
31661
31787
  }
@@ -31678,7 +31804,7 @@ var CodeBuddyAcpClient = class {
31678
31804
  };
31679
31805
  }
31680
31806
  #fault(error62) {
31681
- if (this.#closing || this.#failure)
31807
+ if (this.#closeRequested || this.#failure)
31682
31808
  return;
31683
31809
  clearTimeout(this.#exitDrainTimer);
31684
31810
  this.#failure = error62;
@@ -31692,7 +31818,7 @@ var CodeBuddyAcpClient = class {
31692
31818
  throw this.#failure;
31693
31819
  if (this.#exitFailure)
31694
31820
  throw this.#exitFailure;
31695
- if (this.#closing)
31821
+ if (this.#closeRequested)
31696
31822
  throw new CodeBuddyError("invalidState", "ACP client is closed");
31697
31823
  const work = Promise.race([operation(), this.#failed]);
31698
31824
  return label ? bounded(work, timeout, label, (error62) => this.#fault(error62)) : work;
@@ -31745,16 +31871,29 @@ var CodeBuddyAcpClient = class {
31745
31871
  throw new CodeBuddyError("protocolError", "Native question is no longer pending");
31746
31872
  }
31747
31873
  close() {
31874
+ this.#closeRequested = true;
31748
31875
  clearTimeout(this.#exitDrainTimer);
31749
31876
  this.#rejectFailure(new CodeBuddyError("invalidState", "ACP client is closed"));
31750
- this.#closing ??= this.#closeProcess();
31751
- return this.#closing;
31877
+ if (this.#closing)
31878
+ return this.#closing;
31879
+ const closing = this.#closeProcess().catch((error62) => {
31880
+ if (this.#closing === closing)
31881
+ this.#closing = void 0;
31882
+ throw error62;
31883
+ });
31884
+ this.#closing = closing;
31885
+ return closing;
31752
31886
  }
31753
31887
  async #closeProcess() {
31754
- this.#child.stdin.end();
31755
- const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
31756
- if (exited)
31888
+ if (this.#exitedSettled)
31757
31889
  return;
31890
+ if (!this.#stdinEnded) {
31891
+ this.#stdinEnded = true;
31892
+ this.#child.stdin.end();
31893
+ const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
31894
+ if (exited)
31895
+ return;
31896
+ }
31758
31897
  if (this.#child.exitCode !== null || this.#child.signalCode !== null) {
31759
31898
  this.#child.stdout.destroy();
31760
31899
  this.#child.stderr.destroy();
@@ -31762,23 +31901,31 @@ var CodeBuddyAcpClient = class {
31762
31901
  return;
31763
31902
  }
31764
31903
  const pid = this.#child.pid;
31904
+ let terminationDetail;
31765
31905
  if (pid && process.platform === "win32") {
31766
- await new Promise((resolve) => execFile3("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
31906
+ terminationDetail = await terminateWindowsProcessTree(this.#child, this.#exited);
31767
31907
  } else if (pid) {
31768
31908
  try {
31769
31909
  process.kill(-pid, "SIGKILL");
31770
31910
  } catch {
31771
31911
  }
31772
31912
  }
31773
- await bounded(this.#exited, 3e3, "ACP process exit");
31913
+ try {
31914
+ await bounded(this.#exited, 3e3, "ACP process exit");
31915
+ } catch (error62) {
31916
+ if (terminationDetail && error62 instanceof CodeBuddyError) {
31917
+ throw new CodeBuddyError(error62.code, `${error62.message} (${terminationDetail})`);
31918
+ }
31919
+ throw error62;
31920
+ }
31774
31921
  }
31775
31922
  };
31776
31923
 
31777
31924
  // ../codebuddy/dist/derivation.js
31778
31925
  import { randomUUID as randomUUID3 } from "node:crypto";
31779
- import { execFile as execFile4, spawn as spawn2 } from "node:child_process";
31926
+ import { spawn as spawn2 } from "node:child_process";
31780
31927
  import { lstat as lstat3, mkdir, readFile as readFile3, realpath as realpath4, unlink, writeFile } from "node:fs/promises";
31781
- import path8 from "node:path";
31928
+ import path9 from "node:path";
31782
31929
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
31783
31930
 
31784
31931
  // ../codebuddy/dist/child-provenance.js
@@ -32015,8 +32162,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
32015
32162
  windowsVerbatimArguments: invocation.windowsVerbatimArguments,
32016
32163
  detached: process.platform !== "win32"
32017
32164
  });
32165
+ const exited = new Promise((resolve2) => child.once("close", () => resolve2()));
32018
32166
  let output2 = "", bytes = 0, failed = false;
32019
32167
  let termination = Promise.resolve();
32168
+ let terminationDetail;
32020
32169
  const stop = () => {
32021
32170
  if (failed)
32022
32171
  return;
@@ -32025,11 +32174,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
32025
32174
  child.stdout.destroy();
32026
32175
  child.stderr.destroy();
32027
32176
  } 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 }, () => {
32177
+ termination = terminateWindowsProcessTree(child, exited).then((detail) => {
32178
+ terminationDetail = detail;
32179
+ if (child.exitCode === null && child.signalCode === null)
32030
32180
  child.kill();
32031
- done();
32032
- });
32033
32181
  });
32034
32182
  } else if (child.pid) {
32035
32183
  try {
@@ -32059,7 +32207,8 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
32059
32207
  clearTimeout(timer);
32060
32208
  signal.removeEventListener("abort", stop);
32061
32209
  if (failed || signal.aborted || code !== 0) {
32062
- reject(new CodeBuddyError("nativeFailure", "Native history copy failed or was interrupted"));
32210
+ const message = terminationDetail ? `Native history copy failed or was interrupted (${terminationDetail})` : "Native history copy failed or was interrupted";
32211
+ reject(new CodeBuddyError("nativeFailure", message));
32063
32212
  return;
32064
32213
  }
32065
32214
  try {
@@ -32135,14 +32284,14 @@ async function bridgeCopyToTarget(sourceCwd, targetCwd, ref, contents, environme
32135
32284
  const targetFile = codeBuddyPrimaryHistoryPath(targetCwd, ref, environment, profile);
32136
32285
  if (sameResolvedPath(sourceFile, targetFile))
32137
32286
  return void 0;
32138
- const targetDirectory = path8.dirname(targetFile);
32139
- const projectsDirectory = path8.dirname(targetDirectory);
32287
+ const targetDirectory = path9.dirname(targetFile);
32288
+ const projectsDirectory = path9.dirname(targetDirectory);
32140
32289
  await mkdir(targetDirectory, { recursive: true });
32141
32290
  const [realProjects, realTargetDirectory] = await Promise.all([
32142
32291
  realpath4(projectsDirectory),
32143
32292
  realpath4(targetDirectory)
32144
32293
  ]);
32145
- if (!sameResolvedPath(realTargetDirectory, path8.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
32294
+ if (!sameResolvedPath(realTargetDirectory, path9.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
32146
32295
  throw new CodeBuddyError("invalidRequest", "Cross-directory history bridge target escaped the native projects root");
32147
32296
  const expected = Buffer.from(contents, "utf8");
32148
32297
  await writeFile(targetFile, expected, { flag: "wx", mode: 384 });
@@ -32252,7 +32401,7 @@ function assertChildRanges(rows2, child) {
32252
32401
  }
32253
32402
  }
32254
32403
  async function plainDirectory(parent, name) {
32255
- const directory = path8.join(parent, name);
32404
+ const directory = path9.join(parent, name);
32256
32405
  await mkdir(directory, { mode: 448 }).catch((error62) => {
32257
32406
  if (record3(error62).code !== "EEXIST")
32258
32407
  throw error62;
@@ -32298,18 +32447,18 @@ async function copyInheritedChildren(options) {
32298
32447
  if (!references.length)
32299
32448
  return { descriptors: [], created: [] };
32300
32449
  const sourceHistoryFile = await realpath4(options.sourceHistoryFile);
32301
- const sourceProject = path8.dirname(sourceHistoryFile);
32302
- if (!sameResolvedPath(sourceHistoryFile, path8.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
32450
+ const sourceProject = path9.dirname(sourceHistoryFile);
32451
+ if (!sameResolvedPath(sourceHistoryFile, path9.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
32303
32452
  throw new CodeBuddyError("invalidRequest", "Unexpected source history location");
32304
- const sourceDirectory = path8.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
32453
+ const sourceDirectory = path9.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
32305
32454
  const sourceDirectoryInfo = await lstat3(sourceDirectory);
32306
32455
  if (!sourceDirectoryInfo.isDirectory() || sourceDirectoryInfo.isSymbolicLink())
32307
32456
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
32308
32457
  if (!sameResolvedPath(await realpath4(sourceDirectory), sourceDirectory))
32309
32458
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
32310
32459
  const targetHistoryFile = await realpath4(options.targetHistoryFile);
32311
- const targetProject = path8.dirname(targetHistoryFile);
32312
- if (!sameResolvedPath(targetHistoryFile, path8.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
32460
+ const targetProject = path9.dirname(targetHistoryFile);
32461
+ if (!sameResolvedPath(targetHistoryFile, path9.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
32313
32462
  throw new CodeBuddyError("invalidRequest", "Unexpected target history location");
32314
32463
  const targetSessionDirectory = await plainDirectory(targetProject, options.targetRef.nativeSessionId);
32315
32464
  const targetDirectory = await plainDirectory(targetSessionDirectory, "subagents");
@@ -32317,7 +32466,7 @@ async function copyInheritedChildren(options) {
32317
32466
  const created = [];
32318
32467
  try {
32319
32468
  for (const reference of references) {
32320
- const sourceFile = path8.join(sourceDirectory, `${reference.childId}.jsonl`);
32469
+ const sourceFile = path9.join(sourceDirectory, `${reference.childId}.jsonl`);
32321
32470
  const sourceInfo = await lstat3(sourceFile);
32322
32471
  if (!sourceInfo.isFile() || sourceInfo.isSymbolicLink())
32323
32472
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent transcript");
@@ -32336,7 +32485,7 @@ async function copyInheritedChildren(options) {
32336
32485
  throw new CodeBuddyError("protocolError", "Missing Agent result child range");
32337
32486
  const prefix = await codeBuddyChildPrefixThrough(source.contents, last, validated);
32338
32487
  const expected = Buffer.from(prefix.contents, "utf8");
32339
- const targetFile = path8.join(targetDirectory, `${reference.childId}.jsonl`);
32488
+ const targetFile = path9.join(targetDirectory, `${reference.childId}.jsonl`);
32340
32489
  const copy = await persistChildCopy(targetFile, expected);
32341
32490
  if (copy)
32342
32491
  created.push(copy);
@@ -32576,7 +32725,7 @@ async function deriveCodeBuddySession(options) {
32576
32725
  // ../codebuddy/dist/session-import.js
32577
32726
  import { createReadStream as createReadStream2 } from "node:fs";
32578
32727
  import { opendir, readFile as readFile4, stat as stat2 } from "node:fs/promises";
32579
- import path9 from "node:path";
32728
+ import path10 from "node:path";
32580
32729
  import { createInterface as createInterface2 } from "node:readline";
32581
32730
 
32582
32731
  // ../../harness-adapter/dist/session-import.js
@@ -32739,7 +32888,7 @@ async function readFacts(file2, signal) {
32739
32888
  return null;
32740
32889
  }
32741
32890
  const row = record3(parsed);
32742
- if (typeof row.cwd === "string" && path9.isAbsolute(row.cwd))
32891
+ if (typeof row.cwd === "string" && path10.isAbsolute(row.cwd))
32743
32892
  cwd ??= row.cwd;
32744
32893
  if (typeof row.timestamp === "number" && Number.isFinite(row.timestamp))
32745
32894
  updatedAt = row.timestamp;
@@ -32812,7 +32961,7 @@ var CodeBuddySessionImport = class {
32812
32961
  /** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
32813
32962
  async #activeSessions(signal) {
32814
32963
  const active2 = /* @__PURE__ */ new Set();
32815
- const directory = path9.join(this.#root(), "sessions");
32964
+ const directory = path10.join(this.#root(), "sessions");
32816
32965
  const markers = await opendir(directory).catch((error62) => {
32817
32966
  if (isMissingFileError(error62) || record3(error62).code === "ENOTDIR")
32818
32967
  return null;
@@ -32825,7 +32974,7 @@ var CodeBuddySessionImport = class {
32825
32974
  if (!marker.isFile() || !marker.name.endsWith(".json"))
32826
32975
  continue;
32827
32976
  try {
32828
- const file2 = path9.join(directory, marker.name);
32977
+ const file2 = path10.join(directory, marker.name);
32829
32978
  if ((await stat2(file2)).size > MAX_MARKER_BYTES)
32830
32979
  continue;
32831
32980
  const entry = record3(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
@@ -32841,7 +32990,7 @@ var CodeBuddySessionImport = class {
32841
32990
  }
32842
32991
  /** Session ID to every project file claiming it. Enumerated links are not followed. */
32843
32992
  async #sessionFiles(signal) {
32844
- const root = path9.join(this.#root(), "projects");
32993
+ const root = path10.join(this.#root(), "projects");
32845
32994
  const found = /* @__PURE__ */ new Map();
32846
32995
  const info = await optionalLstat(root);
32847
32996
  if (!info)
@@ -32852,7 +33001,7 @@ var CodeBuddySessionImport = class {
32852
33001
  signal.throwIfAborted();
32853
33002
  if (!project2.isDirectory())
32854
33003
  continue;
32855
- const projectDirectory = path9.join(root, project2.name);
33004
+ const projectDirectory = path10.join(root, project2.name);
32856
33005
  const entries = await opendir(projectDirectory).catch((error62) => {
32857
33006
  if (isMissingFileError(error62))
32858
33007
  return null;
@@ -32866,7 +33015,7 @@ var CodeBuddySessionImport = class {
32866
33015
  if (!nativeSessionId)
32867
33016
  continue;
32868
33017
  const files = found.get(nativeSessionId) ?? [];
32869
- files.push(path9.join(projectDirectory, entry.name));
33018
+ files.push(path10.join(projectDirectory, entry.name));
32870
33019
  found.set(nativeSessionId, files);
32871
33020
  }
32872
33021
  }
@@ -32881,7 +33030,7 @@ var CodeBuddySessionImport = class {
32881
33030
  const facts = await readFacts(file2, signal);
32882
33031
  if (!facts)
32883
33032
  return null;
32884
- const cwd = path9.resolve(facts.cwd);
33033
+ const cwd = path10.resolve(facts.cwd);
32885
33034
  if (!(await stat2(cwd)).isDirectory())
32886
33035
  return null;
32887
33036
  const nativeRef = nativeSessionRefSchema.parse({
@@ -32891,7 +33040,7 @@ var CodeBuddySessionImport = class {
32891
33040
  });
32892
33041
  signal.throwIfAborted();
32893
33042
  const history = await codeBuddyNativeHistory(cwd, nativeRef, this.#environment, this.#profile);
32894
- if (path9.resolve(history.file) !== path9.resolve(file2))
33043
+ if (path10.resolve(history.file) !== path10.resolve(file2))
32895
33044
  return null;
32896
33045
  const candidate = sessionImportCandidate({
32897
33046
  nativeSessionId,
@@ -33174,7 +33323,7 @@ var CodeBuddyInteractions = class {
33174
33323
 
33175
33324
  // ../codebuddy/dist/subagent-history.js
33176
33325
  import { readdir as readdir3, realpath as realpath5 } from "node:fs/promises";
33177
- import path10 from "node:path";
33326
+ import path11 from "node:path";
33178
33327
  var equalPath2 = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
33179
33328
  var MAX_CACHED_CHILDREN = 16;
33180
33329
  var CodeBuddyChildObserver = class {
@@ -33238,8 +33387,8 @@ var CodeBuddyChildObserver = class {
33238
33387
  }
33239
33388
  async #directory() {
33240
33389
  const history = await this.#parentHistory();
33241
- const project2 = path10.dirname(await realpath5(history.file));
33242
- const expected = path10.join(project2, this.parent.nativeSessionId, "subagents");
33390
+ const project2 = path11.dirname(await realpath5(history.file));
33391
+ const expected = path11.join(project2, this.parent.nativeSessionId, "subagents");
33243
33392
  const actual = await realpath5(expected);
33244
33393
  this.#assertOpen();
33245
33394
  if (!equalPath2(actual, expected))
@@ -33249,7 +33398,7 @@ var CodeBuddyChildObserver = class {
33249
33398
  async #child(directory, childId) {
33250
33399
  if (!validCodeBuddyChildId(childId))
33251
33400
  throw new CodeBuddyError("invalidRequest", "Invalid native Subagent ID");
33252
- const file2 = path10.join(directory, `${childId}.jsonl`);
33401
+ const file2 = path11.join(directory, `${childId}.jsonl`);
33253
33402
  const before = await codeBuddyFileVersion(file2);
33254
33403
  if (!equalPath2(before.realFile, file2))
33255
33404
  throw new CodeBuddyError("invalidRequest", "Redirected Subagent transcript");
@@ -33576,6 +33725,7 @@ var CodeBuddySession = class {
33576
33725
  #autonomous = new CodeBuddyAutonomousTurns();
33577
33726
  #busy = false;
33578
33727
  #closed = false;
33728
+ #closeNotified = false;
33579
33729
  #closing;
33580
33730
  #fault;
33581
33731
  #hasTurn = false;
@@ -34257,8 +34407,15 @@ var CodeBuddySession = class {
34257
34407
  this.#channel.end();
34258
34408
  }
34259
34409
  close() {
34260
- this.#closing ??= this.#close();
34261
- return this.#closing;
34410
+ if (this.#closing)
34411
+ return this.#closing;
34412
+ const closing = this.#close().catch((error62) => {
34413
+ if (this.#closing === closing)
34414
+ this.#closing = void 0;
34415
+ throw error62;
34416
+ });
34417
+ this.#closing = closing;
34418
+ return closing;
34262
34419
  }
34263
34420
  async #close() {
34264
34421
  this.#closed = true;
@@ -34275,7 +34432,10 @@ var CodeBuddySession = class {
34275
34432
  } finally {
34276
34433
  this.subagents.close();
34277
34434
  this.#channel.end();
34278
- this.onClose();
34435
+ if (!this.#closeNotified) {
34436
+ this.#closeNotified = true;
34437
+ this.onClose();
34438
+ }
34279
34439
  }
34280
34440
  }
34281
34441
  };
@@ -34724,7 +34884,7 @@ var linuxSpec = {
34724
34884
  };
34725
34885
  function resolveWorkBuddyInstallDirectory(directory, environment, platform, isExecutable, subdirectories = subdirectoryNames) {
34726
34886
  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"] : [];
34887
+ 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
34888
  for (const entry of entries) {
34729
34889
  const bundle = resolveWorkBuddyBundle(environment, platform, isExecutable, paths.join(directory, entry), subdirectories);
34730
34890
  if (bundle)
@@ -34774,13 +34934,13 @@ function resolveWorkBuddyBundle(environment, platform, isExecutable, explicitExe
34774
34934
  continue;
34775
34935
  if (!isExecutable(candidate))
34776
34936
  continue;
34937
+ const launcher = resolveWorkBuddyLauncherLayout(paths.dirname(candidate), platform, isExecutable, subdirectories);
34938
+ if (launcher)
34939
+ return launcher;
34777
34940
  const resources = platform === "darwin" ? paths.resolve(paths.dirname(candidate), "..", "Resources") : paths.join(paths.dirname(candidate), "resources");
34778
34941
  const cli = paths.join(resources, "app.asar.unpacked", "cli", "bin", "codebuddy");
34779
34942
  if (isExecutable(cli))
34780
34943
  return { executable: candidate, cli };
34781
- const launcher = resolveWorkBuddyLauncherLayout(paths.dirname(candidate), platform, isExecutable, subdirectories);
34782
- if (launcher)
34783
- return launcher;
34784
34944
  }
34785
34945
  return void 0;
34786
34946
  }
@@ -34857,7 +35017,7 @@ function resolveWorkBuddyLaunch(environment, dependencies = {}) {
34857
35017
  const configuredDirectory = configured && (dependencies.isDirectory ?? isDirectory)(configured) ? configured : void 0;
34858
35018
  const explicitExecutable = configured && !configuredDirectory ? resolveHarnessExecutable(workBuddyDiscoverySpec, { environment, platform, command: configured }, { isExecutable })?.executable : void 0;
34859
35019
  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");
35020
+ 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
35021
  const bundle = configuredDirectory ? resolveWorkBuddyInstallDirectory(configuredDirectory, environment, platform, isExecutable, subdirectories) : !configured ? resolveWorkBuddyBundle(environment, platform, isExecutable, void 0, subdirectories) : explicitDesktop ? explicitBundle : void 0;
34862
35022
  const executable = configured && !explicitDesktop && !configuredDirectory ? explicitExecutable : bundle?.executable;
34863
35023
  if (!executable)
@@ -34949,7 +35109,7 @@ var WORKBUDDY_RUNTIME_PROFILE = {
34949
35109
 
34950
35110
  // dist/product-models.js
34951
35111
  import { readFile as readFile5, stat as stat4 } from "node:fs/promises";
34952
- import path11 from "node:path";
35112
+ import path12 from "node:path";
34953
35113
  var MAX_PRODUCT_SNAPSHOT_BYTES = 8 * 1024 * 1024;
34954
35114
  var PRODUCT_CONFIG_PATH_ENV = "ACC_PRODUCT_CONFIG_PATH";
34955
35115
  var PRODUCT_CONFIG_INLINE_ENVS = [
@@ -35011,7 +35171,7 @@ function bundledFallbackProductPath(invocation) {
35011
35171
  const cli = invocation.bundledCliPath;
35012
35172
  if (!cli)
35013
35173
  return;
35014
- return path11.join(path11.dirname(path11.dirname(cli)), "product.json");
35174
+ return path12.join(path12.dirname(path12.dirname(cli)), "product.json");
35015
35175
  }
35016
35176
  async function loadWorkBuddyProductModels(environment) {
35017
35177
  const invocation = workBuddyInvocation(environment, true);