@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
@@ -1328,10 +1328,10 @@ function mergeDefs(...defs) {
1328
1328
  function cloneDef(schema) {
1329
1329
  return mergeDefs(schema._zod.def);
1330
1330
  }
1331
- function getElementAtPath(obj, path12) {
1332
- if (!path12)
1331
+ function getElementAtPath(obj, path13) {
1332
+ if (!path13)
1333
1333
  return obj;
1334
- return path12.reduce((acc, key) => acc?.[key], obj);
1334
+ return path13.reduce((acc, key) => acc?.[key], obj);
1335
1335
  }
1336
1336
  function promiseAllObject(promisesObj) {
1337
1337
  const keys = Object.keys(promisesObj);
@@ -1671,11 +1671,11 @@ function explicitlyAborted(x, startIndex = 0) {
1671
1671
  }
1672
1672
  return false;
1673
1673
  }
1674
- function prefixIssues(path12, issues) {
1674
+ function prefixIssues(path13, issues) {
1675
1675
  return issues.map((iss) => {
1676
1676
  var _a3;
1677
1677
  (_a3 = iss).path ?? (_a3.path = []);
1678
- iss.path.unshift(path12);
1678
+ iss.path.unshift(path13);
1679
1679
  return iss;
1680
1680
  });
1681
1681
  }
@@ -2137,16 +2137,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
2137
2137
  }
2138
2138
  function formatError(error62, mapper = (issue2) => issue2.message) {
2139
2139
  const fieldErrors = { _errors: [] };
2140
- const processError = (error63, path12 = []) => {
2140
+ const processError = (error63, path13 = []) => {
2141
2141
  for (const issue2 of error63.issues) {
2142
2142
  if (issue2.code === "invalid_union" && issue2.errors.length) {
2143
- issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
2143
+ issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
2144
2144
  } else if (issue2.code === "invalid_key") {
2145
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
2145
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
2146
2146
  } else if (issue2.code === "invalid_element") {
2147
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
2147
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
2148
2148
  } else {
2149
- const fullpath = [...path12, ...issue2.path];
2149
+ const fullpath = [...path13, ...issue2.path];
2150
2150
  if (fullpath.length === 0) {
2151
2151
  fieldErrors._errors.push(mapper(issue2));
2152
2152
  } else {
@@ -2185,17 +2185,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
2185
2185
  }
2186
2186
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
2187
2187
  const result = { errors: [] };
2188
- const processError = (error63, path12 = []) => {
2188
+ const processError = (error63, path13 = []) => {
2189
2189
  var _a3;
2190
2190
  for (const issue2 of error63.issues) {
2191
2191
  if (issue2.code === "invalid_union" && issue2.errors.length) {
2192
- issue2.errors.map((issues) => processError({ issues }, [...path12, ...issue2.path]));
2192
+ issue2.errors.map((issues) => processError({ issues }, [...path13, ...issue2.path]));
2193
2193
  } else if (issue2.code === "invalid_key") {
2194
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
2194
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
2195
2195
  } else if (issue2.code === "invalid_element") {
2196
- processError({ issues: issue2.issues }, [...path12, ...issue2.path]);
2196
+ processError({ issues: issue2.issues }, [...path13, ...issue2.path]);
2197
2197
  } else {
2198
- const fullpath = [...path12, ...issue2.path];
2198
+ const fullpath = [...path13, ...issue2.path];
2199
2199
  if (fullpath.length === 0) {
2200
2200
  result.errors.push(mapper(issue2));
2201
2201
  continue;
@@ -2234,8 +2234,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
2234
2234
  }
2235
2235
  function toDotPath(_path) {
2236
2236
  const segs = [];
2237
- const path12 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
2238
- for (const seg of path12) {
2237
+ const path13 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
2238
+ for (const seg of path13) {
2239
2239
  if (typeof seg === "number")
2240
2240
  segs.push(`[${seg}]`);
2241
2241
  else if (typeof seg === "symbol")
@@ -19373,13 +19373,13 @@ function resolveRef(ref, ctx) {
19373
19373
  if (!ref.startsWith("#")) {
19374
19374
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
19375
19375
  }
19376
- const path12 = ref.slice(1).split("/").filter(Boolean);
19377
- if (path12.length === 0) {
19376
+ const path13 = ref.slice(1).split("/").filter(Boolean);
19377
+ if (path13.length === 0) {
19378
19378
  return ctx.rootSchema;
19379
19379
  }
19380
19380
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
19381
- if (path12[0] === defsKey) {
19382
- const key = path12[1] === void 0 ? void 0 : decodeJSONPointerSegment(path12[1]);
19381
+ if (path13[0] === defsKey) {
19382
+ const key = path13[1] === void 0 ? void 0 : decodeJSONPointerSegment(path13[1]);
19383
19383
  if (!key || !ctx.defs[key]) {
19384
19384
  throw new Error(`Reference not found: ${ref}`);
19385
19385
  }
@@ -21064,7 +21064,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
21064
21064
  default: external_exports.string().optional()
21065
21065
  })
21066
21066
  ]).superRefine((field2, ctx) => {
21067
- const issue2 = (path12, message) => ctx.addIssue({ code: "custom", path: [path12], message });
21067
+ const issue2 = (path13, message) => ctx.addIssue({ code: "custom", path: [path13], message });
21068
21068
  if (field2.type === "number" || field2.type === "range") {
21069
21069
  const { min = -Infinity, max = Infinity, default: value } = field2;
21070
21070
  if (min > max)
@@ -21170,16 +21170,16 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id2) => !reservedNa
21170
21170
  var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
21171
21171
  var hostExtensionDigestSchema = desktopExtensionHashSchema;
21172
21172
  var hostExtensionActivationIdSchema = external_exports.uuid();
21173
- 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");
21173
+ 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");
21174
21174
  var legacy = desktopExtensionManifestSchema.shape;
21175
21175
  var localized = (max, min = 0) => external_exports.strictObject({
21176
21176
  en: external_exports.string().trim().min(min).max(max),
21177
21177
  "zh-CN": external_exports.string().trim().min(min).max(max)
21178
21178
  });
21179
- var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path12) => path12.endsWith(suffix), `Expected a ${suffix} file`);
21179
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path13) => path13.endsWith(suffix), `Expected a ${suffix} file`);
21180
21180
  var moduleEntry = resourceWithSuffix(".mjs");
21181
21181
  var style = resourceWithSuffix(".css").optional();
21182
- var hostExtensionCanonicalPath = (path12) => path12.normalize("NFC").toLowerCase();
21182
+ var hostExtensionCanonicalPath = (path13) => path13.normalize("NFC").toLowerCase();
21183
21183
  var hostExtensionManifestV2Schema = external_exports.strictObject({
21184
21184
  manifestVersion: external_exports.literal(2),
21185
21185
  id: hostExtensionIdSchema,
@@ -21189,8 +21189,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
21189
21189
  details: localized(16384).optional(),
21190
21190
  author: legacy.author,
21191
21191
  repository: legacy.repository,
21192
- icon: legacy.icon.refine((path12) => path12 === void 0 || hostExtensionResourcePathSchema.safeParse(path12).success),
21193
- screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path12) => hostExtensionResourcePathSchema.safeParse(path12).success)),
21192
+ icon: legacy.icon.refine((path13) => path13 === void 0 || hostExtensionResourcePathSchema.safeParse(path13).success),
21193
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path13) => hostExtensionResourcePathSchema.safeParse(path13).success)),
21194
21194
  categories: legacy.categories,
21195
21195
  settingsSchema: legacy.settingsSchema,
21196
21196
  slots: legacy.slots.removeDefault().optional(),
@@ -21312,7 +21312,7 @@ var active = {
21312
21312
  digest: hostExtensionDigestSchema
21313
21313
  };
21314
21314
  var optionalActivation = { ...id, activationId: active.activationId.optional() };
21315
- 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");
21315
+ 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");
21316
21316
  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");
21317
21317
  function base643(maxBytes) {
21318
21318
  return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
@@ -21628,6 +21628,45 @@ var nativeCodexGoalResultSchema = external_exports.object({
21628
21628
  // ../../shared-contracts/dist/client-channel.js
21629
21629
  var CLIENT_CHANNEL_VERSION = 1;
21630
21630
  var CLIENT_REQUEST_LIMIT_BYTES = 128 * 1024 * 1024;
21631
+ var THREAD_SECTION_CAPABILITY = "threadSectionsV1";
21632
+ var threadSectionName = external_exports.string().trim().min(1);
21633
+ var threadSectionId = external_exports.string().min(1);
21634
+ var threadSectionAppearance = external_exports.object({
21635
+ icon: external_exports.string().nullable(),
21636
+ color: external_exports.string().nullable()
21637
+ });
21638
+ var clientThreadSectionAppearanceSchema = threadSectionAppearance.nullable();
21639
+ var CLIENT_THREAD_SECTION_MUTATIONS = {
21640
+ create: {
21641
+ method: "codexhost/thread/sections/create",
21642
+ params: external_exports.object({ name: threadSectionName }).strict()
21643
+ },
21644
+ update: {
21645
+ method: "codexhost/thread/sections/update",
21646
+ params: external_exports.object({
21647
+ sectionId: threadSectionId,
21648
+ name: threadSectionName,
21649
+ appearance: threadSectionAppearance.strict().nullable().optional()
21650
+ }).strict()
21651
+ },
21652
+ delete: {
21653
+ method: "codexhost/thread/sections/delete",
21654
+ params: external_exports.object({ sectionId: threadSectionId }).strict()
21655
+ }
21656
+ };
21657
+ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnion("status", [
21658
+ external_exports.object({ status: external_exports.literal("unknown") }),
21659
+ external_exports.object({
21660
+ status: external_exports.literal("confirmed"),
21661
+ sectionId: threadSectionId,
21662
+ section: external_exports.object({
21663
+ id: threadSectionId,
21664
+ name: external_exports.string().min(1),
21665
+ appearance: clientThreadSectionAppearanceSchema
21666
+ }).nullable(),
21667
+ syncPending: external_exports.boolean()
21668
+ })
21669
+ ]);
21631
21670
  var CLIENT_CHANNEL_METHODS = [
21632
21671
  "codexhost/skills/list",
21633
21672
  "codexhost/voice/status",
@@ -21638,6 +21677,8 @@ var CLIENT_CHANNEL_METHODS = [
21638
21677
  "codexhost/harness/preferences/get",
21639
21678
  "codexhost/harness/preferences/patch",
21640
21679
  "experimentalFeature/list",
21680
+ "collaborationMode/list",
21681
+ "codexhost/thread/collaboration-mode/select",
21641
21682
  "thread/list",
21642
21683
  "thread/metadata/update",
21643
21684
  "codexhost/thread/catalog/read",
@@ -21674,6 +21715,9 @@ var CLIENT_CHANNEL_METHODS = [
21674
21715
  "codexhost/thread/pins/list",
21675
21716
  "codexhost/thread/sections/list",
21676
21717
  "codexhost/thread/sections/move",
21718
+ CLIENT_THREAD_SECTION_MUTATIONS.create.method,
21719
+ CLIENT_THREAD_SECTION_MUTATIONS.update.method,
21720
+ CLIENT_THREAD_SECTION_MUTATIONS.delete.method,
21677
21721
  "codexhost/thread/pins/set",
21678
21722
  "codexhost/harness/plugins/list",
21679
21723
  "codexhost/harness/inspect",
@@ -21724,16 +21768,21 @@ var CLIENT_CHANNEL_METHODS = [
21724
21768
  "codexhost/sessions/loaded/list"
21725
21769
  ];
21726
21770
  var clientThreadSectionsSchema = external_exports.object({
21771
+ [THREAD_SECTION_CAPABILITY]: external_exports.literal(true).optional(),
21772
+ complete: external_exports.literal(false).optional(),
21727
21773
  sections: external_exports.array(external_exports.object({
21728
21774
  id: external_exports.string().min(1),
21729
21775
  name: external_exports.string().min(1),
21776
+ appearance: clientThreadSectionAppearanceSchema.optional(),
21730
21777
  threads: external_exports.array(jsonObjectSchema)
21731
- }).strict())
21732
- }).strict();
21778
+ }))
21779
+ });
21733
21780
  var clientThreadSectionMoveSchema = external_exports.object({
21734
21781
  threadId: external_exports.string().min(1).max(1024),
21735
- sectionId: external_exports.string().min(1).max(1024).nullable()
21736
- }).strict();
21782
+ sectionId: external_exports.string().min(1).max(1024).nullable(),
21783
+ beforeThreadId: external_exports.string().min(1).max(1024).nullable().optional(),
21784
+ expectedSourceSectionId: external_exports.string().min(1).max(1024).optional()
21785
+ }).refine((move) => move.expectedSourceSectionId === void 0 || move.sectionId === null);
21737
21786
  var clientThreadPinsSchema = external_exports.object({ threadIds: external_exports.array(external_exports.string().min(1)) }).strict();
21738
21787
  var clientThreadPinParamsSchema = external_exports.object({ threadId: external_exports.string().min(1).max(1024), pinned: external_exports.boolean() }).strict();
21739
21788
  var clientThreadTreeReadParamsSchema = external_exports.object({}).strict();
@@ -21780,6 +21829,7 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
21780
21829
  harnessId: external_exports.string().min(1)
21781
21830
  }),
21782
21831
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
21832
+ external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
21783
21833
  external_exports.object({
21784
21834
  type: external_exports.literal("preferences-changed"),
21785
21835
  cursor: clientChannelCursorSchema,
@@ -21921,6 +21971,7 @@ var clientThreadSnapshotSchema = external_exports.object({
21921
21971
  nextCursor: external_exports.string().nullable()
21922
21972
  }),
21923
21973
  configuration: external_exports.object({
21974
+ codexCollaborationMode: external_exports.enum(["plan", "default"]).optional(),
21924
21975
  /** Native Codex model names are not external Harness transport refs. */
21925
21976
  native: external_exports.object({
21926
21977
  model: external_exports.string().min(1).max(1024).optional(),
@@ -21946,7 +21997,8 @@ var clientChannelDescriptorSchema = external_exports.object({
21946
21997
  startedAt: external_exports.number(),
21947
21998
  epoch: external_exports.string().uuid(),
21948
21999
  capabilities: external_exports.object({
21949
- peerDelegation: external_exports.literal(1).optional()
22000
+ peerDelegation: external_exports.literal(1).optional(),
22001
+ threadReferenceContext: external_exports.literal(1).optional()
21950
22002
  }).optional()
21951
22003
  });
21952
22004
  var clientChannelResponseSchema = external_exports.object({
@@ -22617,6 +22669,11 @@ var harnessDefaultConfigurationSchema = external_exports.strictObject({
22617
22669
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
22618
22670
  permissionModeId: harnessPermissionModeIdSchema.optional()
22619
22671
  }).refine((value) => Boolean(value.model || value.thinkingOptionId || value.permissionModeId), "A default configuration must contain a preference");
22672
+ var projectHarnessSelectionSchema = external_exports.discriminatedUnion("mode", [
22673
+ external_exports.strictObject({ mode: external_exports.literal("global") }),
22674
+ external_exports.strictObject({ mode: external_exports.literal("last") }),
22675
+ external_exports.strictObject({ mode: external_exports.literal("manual"), harnessId: harnessIdSchema })
22676
+ ]);
22620
22677
  var newThreadDefaultsSchema = external_exports.strictObject({
22621
22678
  lastHarness: harnessIdSchema.optional(),
22622
22679
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
@@ -24849,16 +24906,16 @@ var Diff = class {
24849
24906
  }
24850
24907
  }
24851
24908
  }
24852
- addToPath(path12, added, removed, oldPosInc, options) {
24853
- const last = path12.lastComponent;
24909
+ addToPath(path13, added, removed, oldPosInc, options) {
24910
+ const last = path13.lastComponent;
24854
24911
  if (last && !options.oneChangePerToken && last.added === added && last.removed === removed) {
24855
24912
  return {
24856
- oldPos: path12.oldPos + oldPosInc,
24913
+ oldPos: path13.oldPos + oldPosInc,
24857
24914
  lastComponent: { count: last.count + 1, added, removed, previousComponent: last.previousComponent }
24858
24915
  };
24859
24916
  } else {
24860
24917
  return {
24861
- oldPos: path12.oldPos + oldPosInc,
24918
+ oldPos: path13.oldPos + oldPosInc,
24862
24919
  lastComponent: { count: 1, added, removed, previousComponent: last }
24863
24920
  };
24864
24921
  }
@@ -26117,7 +26174,7 @@ function createCodeBuddyUsageStatistics(environment, profile) {
26117
26174
  import { stat as stat3 } from "node:fs/promises";
26118
26175
 
26119
26176
  // dist/acp-client.js
26120
- import { execFile as execFile2, spawn } from "node:child_process";
26177
+ import { spawn } from "node:child_process";
26121
26178
  import { Readable as Readable2, Writable } from "node:stream";
26122
26179
 
26123
26180
  // ../../../node_modules/@agentclientprotocol/sdk/dist/schema/index.js
@@ -30351,6 +30408,77 @@ var CodeBuddyCopyCleanup = class {
30351
30408
  }
30352
30409
  };
30353
30410
 
30411
+ // dist/process-termination.js
30412
+ import { execFile as execFile2 } from "node:child_process";
30413
+ import path8 from "node:path";
30414
+ var WINDOWS_TASKKILL_TIMEOUT_MS = 45e3;
30415
+ var MAX_DIAGNOSTIC_LENGTH = 400;
30416
+ var taskkillQueue = Promise.resolve();
30417
+ function windowsTaskkillPath(env = process.env) {
30418
+ const root = env.SystemRoot ?? env.SYSTEMROOT;
30419
+ return root && path8.win32.isAbsolute(root) ? path8.win32.join(root, "System32", "taskkill.exe") : "taskkill";
30420
+ }
30421
+ function compactDiagnostic(value) {
30422
+ const sanitized = sanitizeDiagnosticTail(value).replace(/\s+/gu, " ").trim();
30423
+ return sanitized.length <= MAX_DIAGNOSTIC_LENGTH ? sanitized : `${sanitized.slice(0, MAX_DIAGNOSTIC_LENGTH)}...`;
30424
+ }
30425
+ function formatTaskkillError(error62, stderr) {
30426
+ const info = typeof error62 === "object" && error62 !== null ? error62 : {};
30427
+ const parts = [
30428
+ ...info.code != null ? [`code=${String(info.code)}`] : [],
30429
+ ...info.signal ? [`signal=${info.signal}`] : [],
30430
+ `killed=${Boolean(info.killed)}`
30431
+ ];
30432
+ const rawStderr = typeof stderr === "string" ? stderr : Buffer.isBuffer(stderr) ? stderr.toString("utf8") : typeof info.stderr === "string" ? info.stderr : "";
30433
+ const detail = compactDiagnostic(rawStderr);
30434
+ if (detail)
30435
+ parts.push(`stderr=${detail}`);
30436
+ else {
30437
+ const message = compactDiagnostic(error62 instanceof Error ? error62.message : String(error62));
30438
+ if (message)
30439
+ parts.push(`error=${message}`);
30440
+ }
30441
+ return `taskkill failed (${parts.join(", ")})`;
30442
+ }
30443
+ async function terminateWindowsProcessTree(child, exited, timeoutMs = WINDOWS_TASKKILL_TIMEOUT_MS) {
30444
+ const exitedNow = () => child.exitCode !== null || child.signalCode !== null;
30445
+ if (!child.pid || exitedNow())
30446
+ return void 0;
30447
+ const deadline = Date.now() + timeoutMs;
30448
+ const previous = taskkillQueue;
30449
+ const slot = Promise.withResolvers();
30450
+ taskkillQueue = previous.then(() => slot.promise);
30451
+ let timer;
30452
+ const status = await Promise.race([
30453
+ previous.then(() => "ready"),
30454
+ exited.then(() => "exited"),
30455
+ new Promise((resolve) => {
30456
+ timer = setTimeout(() => resolve("timeout"), Math.max(0, deadline - Date.now()));
30457
+ })
30458
+ ]).finally(() => clearTimeout(timer));
30459
+ if (status === "exited" || exitedNow()) {
30460
+ slot.resolve();
30461
+ return void 0;
30462
+ }
30463
+ const remainingMs = deadline - Date.now();
30464
+ if (status === "timeout" || remainingMs <= 0) {
30465
+ slot.resolve();
30466
+ return `taskkill timed out waiting in termination queue after ${timeoutMs}ms`;
30467
+ }
30468
+ const execution = new Promise((resolve) => {
30469
+ try {
30470
+ execFile2(windowsTaskkillPath(), ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: remainingMs }, (error62, _stdout, stderr) => {
30471
+ slot.resolve();
30472
+ resolve(error62 ? formatTaskkillError(error62, stderr) : void 0);
30473
+ });
30474
+ } catch (error62) {
30475
+ slot.resolve();
30476
+ resolve(formatTaskkillError(error62));
30477
+ }
30478
+ });
30479
+ return Promise.race([execution, exited.then(() => void 0)]);
30480
+ }
30481
+
30354
30482
  // dist/acp-client.js
30355
30483
  var sessionEndCarrier = "codexhost.codebuddy/sessionEnd";
30356
30484
  function carrySessionEnd(message) {
@@ -30385,6 +30513,9 @@ var CodeBuddyAcpClient = class {
30385
30513
  #child;
30386
30514
  #connection;
30387
30515
  #exited;
30516
+ #exitedSettled = false;
30517
+ #closeRequested = false;
30518
+ #stdinEnded = false;
30388
30519
  #closing;
30389
30520
  #failure;
30390
30521
  #exitFailure;
@@ -30409,14 +30540,17 @@ var CodeBuddyAcpClient = class {
30409
30540
  windowsVerbatimArguments: invocation.windowsVerbatimArguments,
30410
30541
  detached: process.platform !== "win32"
30411
30542
  });
30412
- this.#exited = new Promise((resolve) => this.#child.once("close", () => resolve()));
30543
+ this.#exited = new Promise((resolve) => this.#child.once("close", () => {
30544
+ this.#exitedSettled = true;
30545
+ resolve();
30546
+ }));
30413
30547
  this.#child.stderr.on("data", () => {
30414
30548
  });
30415
30549
  this.#child.on("error", (error62) => {
30416
30550
  this.#fault(error62);
30417
30551
  });
30418
30552
  this.#child.once("exit", (code, signal) => {
30419
- if (this.#closing || this.#failure)
30553
+ if (this.#closeRequested || this.#failure)
30420
30554
  return;
30421
30555
  const error62 = new CodeBuddyError("processExited", `ACP process exited (${code ?? signal ?? "unknown"})`);
30422
30556
  this.#exitFailure = error62;
@@ -30426,14 +30560,14 @@ var CodeBuddyAcpClient = class {
30426
30560
  });
30427
30561
  this.#connection = new ClientSideConnection(() => ({
30428
30562
  sessionUpdate: async (notification) => {
30429
- if (!this.#closing && !this.#failure)
30563
+ if (!this.#closeRequested && !this.#failure)
30430
30564
  options.handlers.update(restoreSessionEnd(notification));
30431
30565
  },
30432
- requestPermission: (request) => !this.#exitFailure && !this.#closing && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
30566
+ requestPermission: (request) => !this.#exitFailure && !this.#closeRequested && !this.#failure ? options.handlers.permission(request) : Promise.resolve({ outcome: { outcome: "cancelled" } }),
30433
30567
  extMethod: async (method, params) => {
30434
30568
  if (method !== "_codebuddy.ai/question")
30435
30569
  throw RequestError.methodNotFound(method);
30436
- if (this.#exitFailure || this.#closing || this.#failure)
30570
+ if (this.#exitFailure || this.#closeRequested || this.#failure)
30437
30571
  return { outcome: "cancelled" };
30438
30572
  return options.handlers.question(params);
30439
30573
  }
@@ -30456,7 +30590,7 @@ var CodeBuddyAcpClient = class {
30456
30590
  };
30457
30591
  }
30458
30592
  #fault(error62) {
30459
- if (this.#closing || this.#failure)
30593
+ if (this.#closeRequested || this.#failure)
30460
30594
  return;
30461
30595
  clearTimeout(this.#exitDrainTimer);
30462
30596
  this.#failure = error62;
@@ -30470,7 +30604,7 @@ var CodeBuddyAcpClient = class {
30470
30604
  throw this.#failure;
30471
30605
  if (this.#exitFailure)
30472
30606
  throw this.#exitFailure;
30473
- if (this.#closing)
30607
+ if (this.#closeRequested)
30474
30608
  throw new CodeBuddyError("invalidState", "ACP client is closed");
30475
30609
  const work = Promise.race([operation(), this.#failed]);
30476
30610
  return label ? bounded(work, timeout, label, (error62) => this.#fault(error62)) : work;
@@ -30523,16 +30657,29 @@ var CodeBuddyAcpClient = class {
30523
30657
  throw new CodeBuddyError("protocolError", "Native question is no longer pending");
30524
30658
  }
30525
30659
  close() {
30660
+ this.#closeRequested = true;
30526
30661
  clearTimeout(this.#exitDrainTimer);
30527
30662
  this.#rejectFailure(new CodeBuddyError("invalidState", "ACP client is closed"));
30528
- this.#closing ??= this.#closeProcess();
30529
- return this.#closing;
30663
+ if (this.#closing)
30664
+ return this.#closing;
30665
+ const closing = this.#closeProcess().catch((error62) => {
30666
+ if (this.#closing === closing)
30667
+ this.#closing = void 0;
30668
+ throw error62;
30669
+ });
30670
+ this.#closing = closing;
30671
+ return closing;
30530
30672
  }
30531
30673
  async #closeProcess() {
30532
- this.#child.stdin.end();
30533
- const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
30534
- if (exited)
30674
+ if (this.#exitedSettled)
30535
30675
  return;
30676
+ if (!this.#stdinEnded) {
30677
+ this.#stdinEnded = true;
30678
+ this.#child.stdin.end();
30679
+ const exited = await bounded(this.#exited.then(() => true), 1e3, "ACP shutdown").catch(() => false);
30680
+ if (exited)
30681
+ return;
30682
+ }
30536
30683
  if (this.#child.exitCode !== null || this.#child.signalCode !== null) {
30537
30684
  this.#child.stdout.destroy();
30538
30685
  this.#child.stderr.destroy();
@@ -30540,23 +30687,31 @@ var CodeBuddyAcpClient = class {
30540
30687
  return;
30541
30688
  }
30542
30689
  const pid = this.#child.pid;
30690
+ let terminationDetail;
30543
30691
  if (pid && process.platform === "win32") {
30544
- await new Promise((resolve) => execFile2("taskkill", ["/PID", String(pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => resolve()));
30692
+ terminationDetail = await terminateWindowsProcessTree(this.#child, this.#exited);
30545
30693
  } else if (pid) {
30546
30694
  try {
30547
30695
  process.kill(-pid, "SIGKILL");
30548
30696
  } catch {
30549
30697
  }
30550
30698
  }
30551
- await bounded(this.#exited, 3e3, "ACP process exit");
30699
+ try {
30700
+ await bounded(this.#exited, 3e3, "ACP process exit");
30701
+ } catch (error62) {
30702
+ if (terminationDetail && error62 instanceof CodeBuddyError) {
30703
+ throw new CodeBuddyError(error62.code, `${error62.message} (${terminationDetail})`);
30704
+ }
30705
+ throw error62;
30706
+ }
30552
30707
  }
30553
30708
  };
30554
30709
 
30555
30710
  // dist/derivation.js
30556
30711
  import { randomUUID as randomUUID2 } from "node:crypto";
30557
- import { execFile as execFile3, spawn as spawn2 } from "node:child_process";
30712
+ import { spawn as spawn2 } from "node:child_process";
30558
30713
  import { lstat as lstat2, mkdir, readFile as readFile3, realpath as realpath5, unlink, writeFile as writeFile2 } from "node:fs/promises";
30559
- import path8 from "node:path";
30714
+ import path9 from "node:path";
30560
30715
  import { isDeepStrictEqual as isDeepStrictEqual3 } from "node:util";
30561
30716
 
30562
30717
  // dist/child-provenance.js
@@ -30793,8 +30948,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
30793
30948
  windowsVerbatimArguments: invocation.windowsVerbatimArguments,
30794
30949
  detached: process.platform !== "win32"
30795
30950
  });
30951
+ const exited = new Promise((resolve2) => child.once("close", () => resolve2()));
30796
30952
  let output2 = "", bytes = 0, failed = false;
30797
30953
  let termination = Promise.resolve();
30954
+ let terminationDetail;
30798
30955
  const stop = () => {
30799
30956
  if (failed)
30800
30957
  return;
@@ -30803,11 +30960,10 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
30803
30960
  child.stdout.destroy();
30804
30961
  child.stderr.destroy();
30805
30962
  } else if (process.platform === "win32" && child.pid) {
30806
- termination = new Promise((done) => {
30807
- execFile3("taskkill", ["/PID", String(child.pid), "/T", "/F"], { windowsHide: true, timeout: 3e3 }, () => {
30963
+ termination = terminateWindowsProcessTree(child, exited).then((detail) => {
30964
+ terminationDetail = detail;
30965
+ if (child.exitCode === null && child.signalCode === null)
30808
30966
  child.kill();
30809
- done();
30810
- });
30811
30967
  });
30812
30968
  } else if (child.pid) {
30813
30969
  try {
@@ -30837,7 +30993,8 @@ async function copyCodeBuddySession(cwd, sourceId, targetId, environment, signal
30837
30993
  clearTimeout(timer);
30838
30994
  signal.removeEventListener("abort", stop);
30839
30995
  if (failed || signal.aborted || code !== 0) {
30840
- reject(new CodeBuddyError("nativeFailure", "Native history copy failed or was interrupted"));
30996
+ const message = terminationDetail ? `Native history copy failed or was interrupted (${terminationDetail})` : "Native history copy failed or was interrupted";
30997
+ reject(new CodeBuddyError("nativeFailure", message));
30841
30998
  return;
30842
30999
  }
30843
31000
  try {
@@ -30913,14 +31070,14 @@ async function bridgeCopyToTarget(sourceCwd, targetCwd, ref, contents, environme
30913
31070
  const targetFile = codeBuddyPrimaryHistoryPath(targetCwd, ref, environment, profile);
30914
31071
  if (sameResolvedPath(sourceFile, targetFile))
30915
31072
  return void 0;
30916
- const targetDirectory = path8.dirname(targetFile);
30917
- const projectsDirectory = path8.dirname(targetDirectory);
31073
+ const targetDirectory = path9.dirname(targetFile);
31074
+ const projectsDirectory = path9.dirname(targetDirectory);
30918
31075
  await mkdir(targetDirectory, { recursive: true });
30919
31076
  const [realProjects, realTargetDirectory] = await Promise.all([
30920
31077
  realpath5(projectsDirectory),
30921
31078
  realpath5(targetDirectory)
30922
31079
  ]);
30923
- if (!sameResolvedPath(realTargetDirectory, path8.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
31080
+ if (!sameResolvedPath(realTargetDirectory, path9.join(realProjects, codeBuddyProjectSlug(targetCwd, profile))))
30924
31081
  throw new CodeBuddyError("invalidRequest", "Cross-directory history bridge target escaped the native projects root");
30925
31082
  const expected = Buffer.from(contents, "utf8");
30926
31083
  await writeFile2(targetFile, expected, { flag: "wx", mode: 384 });
@@ -31030,7 +31187,7 @@ function assertChildRanges(rows2, child) {
31030
31187
  }
31031
31188
  }
31032
31189
  async function plainDirectory(parent, name) {
31033
- const directory = path8.join(parent, name);
31190
+ const directory = path9.join(parent, name);
31034
31191
  await mkdir(directory, { mode: 448 }).catch((error62) => {
31035
31192
  if (record3(error62).code !== "EEXIST")
31036
31193
  throw error62;
@@ -31076,18 +31233,18 @@ async function copyInheritedChildren(options) {
31076
31233
  if (!references.length)
31077
31234
  return { descriptors: [], created: [] };
31078
31235
  const sourceHistoryFile = await realpath5(options.sourceHistoryFile);
31079
- const sourceProject = path8.dirname(sourceHistoryFile);
31080
- if (!sameResolvedPath(sourceHistoryFile, path8.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
31236
+ const sourceProject = path9.dirname(sourceHistoryFile);
31237
+ if (!sameResolvedPath(sourceHistoryFile, path9.join(sourceProject, `${options.sourceRef.nativeSessionId}.jsonl`)))
31081
31238
  throw new CodeBuddyError("invalidRequest", "Unexpected source history location");
31082
- const sourceDirectory = path8.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
31239
+ const sourceDirectory = path9.join(sourceProject, options.sourceRef.nativeSessionId, "subagents");
31083
31240
  const sourceDirectoryInfo = await lstat2(sourceDirectory);
31084
31241
  if (!sourceDirectoryInfo.isDirectory() || sourceDirectoryInfo.isSymbolicLink())
31085
31242
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
31086
31243
  if (!sameResolvedPath(await realpath5(sourceDirectory), sourceDirectory))
31087
31244
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent directory");
31088
31245
  const targetHistoryFile = await realpath5(options.targetHistoryFile);
31089
- const targetProject = path8.dirname(targetHistoryFile);
31090
- if (!sameResolvedPath(targetHistoryFile, path8.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
31246
+ const targetProject = path9.dirname(targetHistoryFile);
31247
+ if (!sameResolvedPath(targetHistoryFile, path9.join(targetProject, `${options.targetRef.nativeSessionId}.jsonl`)))
31091
31248
  throw new CodeBuddyError("invalidRequest", "Unexpected target history location");
31092
31249
  const targetSessionDirectory = await plainDirectory(targetProject, options.targetRef.nativeSessionId);
31093
31250
  const targetDirectory = await plainDirectory(targetSessionDirectory, "subagents");
@@ -31095,7 +31252,7 @@ async function copyInheritedChildren(options) {
31095
31252
  const created = [];
31096
31253
  try {
31097
31254
  for (const reference of references) {
31098
- const sourceFile = path8.join(sourceDirectory, `${reference.childId}.jsonl`);
31255
+ const sourceFile = path9.join(sourceDirectory, `${reference.childId}.jsonl`);
31099
31256
  const sourceInfo = await lstat2(sourceFile);
31100
31257
  if (!sourceInfo.isFile() || sourceInfo.isSymbolicLink())
31101
31258
  throw new CodeBuddyError("invalidRequest", "Redirected source Subagent transcript");
@@ -31114,7 +31271,7 @@ async function copyInheritedChildren(options) {
31114
31271
  throw new CodeBuddyError("protocolError", "Missing Agent result child range");
31115
31272
  const prefix = await codeBuddyChildPrefixThrough(source.contents, last, validated);
31116
31273
  const expected = Buffer.from(prefix.contents, "utf8");
31117
- const targetFile = path8.join(targetDirectory, `${reference.childId}.jsonl`);
31274
+ const targetFile = path9.join(targetDirectory, `${reference.childId}.jsonl`);
31118
31275
  const copy = await persistChildCopy(targetFile, expected);
31119
31276
  if (copy)
31120
31277
  created.push(copy);
@@ -31354,7 +31511,7 @@ async function deriveCodeBuddySession(options) {
31354
31511
  // dist/session-import.js
31355
31512
  import { createReadStream as createReadStream2 } from "node:fs";
31356
31513
  import { opendir, readFile as readFile4, stat as stat2 } from "node:fs/promises";
31357
- import path9 from "node:path";
31514
+ import path10 from "node:path";
31358
31515
  import { createInterface as createInterface2 } from "node:readline";
31359
31516
 
31360
31517
  // ../../harness-adapter/dist/session-import.js
@@ -31517,7 +31674,7 @@ async function readFacts(file2, signal) {
31517
31674
  return null;
31518
31675
  }
31519
31676
  const row = record3(parsed);
31520
- if (typeof row.cwd === "string" && path9.isAbsolute(row.cwd))
31677
+ if (typeof row.cwd === "string" && path10.isAbsolute(row.cwd))
31521
31678
  cwd ??= row.cwd;
31522
31679
  if (typeof row.timestamp === "number" && Number.isFinite(row.timestamp))
31523
31680
  updatedAt = row.timestamp;
@@ -31590,7 +31747,7 @@ var CodeBuddySessionImport = class {
31590
31747
  /** IDs a live native process registered in `<config>/sessions/<pid>.json`. */
31591
31748
  async #activeSessions(signal) {
31592
31749
  const active2 = /* @__PURE__ */ new Set();
31593
- const directory = path9.join(this.#root(), "sessions");
31750
+ const directory = path10.join(this.#root(), "sessions");
31594
31751
  const markers = await opendir(directory).catch((error62) => {
31595
31752
  if (isMissingFileError(error62) || record3(error62).code === "ENOTDIR")
31596
31753
  return null;
@@ -31603,7 +31760,7 @@ var CodeBuddySessionImport = class {
31603
31760
  if (!marker.isFile() || !marker.name.endsWith(".json"))
31604
31761
  continue;
31605
31762
  try {
31606
- const file2 = path9.join(directory, marker.name);
31763
+ const file2 = path10.join(directory, marker.name);
31607
31764
  if ((await stat2(file2)).size > MAX_MARKER_BYTES)
31608
31765
  continue;
31609
31766
  const entry = record3(JSON.parse(await readFile4(file2, { encoding: "utf8", signal })));
@@ -31619,7 +31776,7 @@ var CodeBuddySessionImport = class {
31619
31776
  }
31620
31777
  /** Session ID to every project file claiming it. Enumerated links are not followed. */
31621
31778
  async #sessionFiles(signal) {
31622
- const root = path9.join(this.#root(), "projects");
31779
+ const root = path10.join(this.#root(), "projects");
31623
31780
  const found = /* @__PURE__ */ new Map();
31624
31781
  const info = await optionalLstat(root);
31625
31782
  if (!info)
@@ -31630,7 +31787,7 @@ var CodeBuddySessionImport = class {
31630
31787
  signal.throwIfAborted();
31631
31788
  if (!project2.isDirectory())
31632
31789
  continue;
31633
- const projectDirectory = path9.join(root, project2.name);
31790
+ const projectDirectory = path10.join(root, project2.name);
31634
31791
  const entries = await opendir(projectDirectory).catch((error62) => {
31635
31792
  if (isMissingFileError(error62))
31636
31793
  return null;
@@ -31644,7 +31801,7 @@ var CodeBuddySessionImport = class {
31644
31801
  if (!nativeSessionId)
31645
31802
  continue;
31646
31803
  const files = found.get(nativeSessionId) ?? [];
31647
- files.push(path9.join(projectDirectory, entry.name));
31804
+ files.push(path10.join(projectDirectory, entry.name));
31648
31805
  found.set(nativeSessionId, files);
31649
31806
  }
31650
31807
  }
@@ -31659,7 +31816,7 @@ var CodeBuddySessionImport = class {
31659
31816
  const facts = await readFacts(file2, signal);
31660
31817
  if (!facts)
31661
31818
  return null;
31662
- const cwd = path9.resolve(facts.cwd);
31819
+ const cwd = path10.resolve(facts.cwd);
31663
31820
  if (!(await stat2(cwd)).isDirectory())
31664
31821
  return null;
31665
31822
  const nativeRef = nativeSessionRefSchema.parse({
@@ -31669,7 +31826,7 @@ var CodeBuddySessionImport = class {
31669
31826
  });
31670
31827
  signal.throwIfAborted();
31671
31828
  const history = await codeBuddyNativeHistory(cwd, nativeRef, this.#environment, this.#profile);
31672
- if (path9.resolve(history.file) !== path9.resolve(file2))
31829
+ if (path10.resolve(history.file) !== path10.resolve(file2))
31673
31830
  return null;
31674
31831
  const candidate = sessionImportCandidate({
31675
31832
  nativeSessionId,
@@ -31952,7 +32109,7 @@ var CodeBuddyInteractions = class {
31952
32109
 
31953
32110
  // dist/subagent-history.js
31954
32111
  import { readdir as readdir3, realpath as realpath6 } from "node:fs/promises";
31955
- import path10 from "node:path";
32112
+ import path11 from "node:path";
31956
32113
  var equalPath2 = (a, b) => process.platform === "win32" ? a.toLowerCase() === b.toLowerCase() : a === b;
31957
32114
  var MAX_CACHED_CHILDREN = 16;
31958
32115
  var CodeBuddyChildObserver = class {
@@ -32016,8 +32173,8 @@ var CodeBuddyChildObserver = class {
32016
32173
  }
32017
32174
  async #directory() {
32018
32175
  const history = await this.#parentHistory();
32019
- const project2 = path10.dirname(await realpath6(history.file));
32020
- const expected = path10.join(project2, this.parent.nativeSessionId, "subagents");
32176
+ const project2 = path11.dirname(await realpath6(history.file));
32177
+ const expected = path11.join(project2, this.parent.nativeSessionId, "subagents");
32021
32178
  const actual = await realpath6(expected);
32022
32179
  this.#assertOpen();
32023
32180
  if (!equalPath2(actual, expected))
@@ -32027,7 +32184,7 @@ var CodeBuddyChildObserver = class {
32027
32184
  async #child(directory, childId) {
32028
32185
  if (!validCodeBuddyChildId(childId))
32029
32186
  throw new CodeBuddyError("invalidRequest", "Invalid native Subagent ID");
32030
- const file2 = path10.join(directory, `${childId}.jsonl`);
32187
+ const file2 = path11.join(directory, `${childId}.jsonl`);
32031
32188
  const before = await codeBuddyFileVersion(file2);
32032
32189
  if (!equalPath2(before.realFile, file2))
32033
32190
  throw new CodeBuddyError("invalidRequest", "Redirected Subagent transcript");
@@ -32354,6 +32511,7 @@ var CodeBuddySession = class {
32354
32511
  #autonomous = new CodeBuddyAutonomousTurns();
32355
32512
  #busy = false;
32356
32513
  #closed = false;
32514
+ #closeNotified = false;
32357
32515
  #closing;
32358
32516
  #fault;
32359
32517
  #hasTurn = false;
@@ -33035,8 +33193,15 @@ var CodeBuddySession = class {
33035
33193
  this.#channel.end();
33036
33194
  }
33037
33195
  close() {
33038
- this.#closing ??= this.#close();
33039
- return this.#closing;
33196
+ if (this.#closing)
33197
+ return this.#closing;
33198
+ const closing = this.#close().catch((error62) => {
33199
+ if (this.#closing === closing)
33200
+ this.#closing = void 0;
33201
+ throw error62;
33202
+ });
33203
+ this.#closing = closing;
33204
+ return closing;
33040
33205
  }
33041
33206
  async #close() {
33042
33207
  this.#closed = true;
@@ -33053,7 +33218,10 @@ var CodeBuddySession = class {
33053
33218
  } finally {
33054
33219
  this.subagents.close();
33055
33220
  this.#channel.end();
33056
- this.onClose();
33221
+ if (!this.#closeNotified) {
33222
+ this.#closeNotified = true;
33223
+ this.onClose();
33224
+ }
33057
33225
  }
33058
33226
  }
33059
33227
  };
@@ -33278,7 +33446,7 @@ function createCodeBuddyInstallation(environment) {
33278
33446
  }
33279
33447
 
33280
33448
  // ../../harness-broker/dist/client.js
33281
- import { execFile as execFile4 } from "node:child_process";
33449
+ import { execFile as execFile3 } from "node:child_process";
33282
33450
  import { randomUUID as randomUUID4 } from "node:crypto";
33283
33451
  import { lstat as lstat4, readFile as readFile5 } from "node:fs/promises";
33284
33452
  import net, {} from "node:net";
@@ -33889,18 +34057,18 @@ function createBrokerSessionImportCapability(input3) {
33889
34057
 
33890
34058
  // ../../harness-broker/dist/paths.js
33891
34059
  import os2 from "node:os";
33892
- import path11 from "node:path";
34060
+ import path12 from "node:path";
33893
34061
  var HARNESS_BROKER_DESCRIPTOR_ENV = "CODEXHOST_CLAUDE_BROKER_DESCRIPTOR";
33894
34062
  var HARNESS_BROKER_DESCRIPTOR_FILE = "claude-code-broker-v1.json";
33895
34063
  function defaultHarnessBrokerDirectory(environment = process.env) {
33896
34064
  const home = environment.HOME || os2.homedir();
33897
- return path11.join(home, ".codexhost", "harness-broker");
34065
+ return path12.join(home, ".codexhost", "harness-broker");
33898
34066
  }
33899
34067
  function defaultHarnessBrokerDescriptorPath(environment = process.env, harnessId = "claude-code") {
33900
34068
  harnessPluginIdSchema.parse(harnessId);
33901
34069
  if (harnessId !== "claude-code")
33902
- return path11.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
33903
- return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path11.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
34070
+ return path12.join(defaultHarnessBrokerDirectory(environment), `${harnessId}-broker-v1.json`);
34071
+ return environment[HARNESS_BROKER_DESCRIPTOR_ENV] ?? path12.join(defaultHarnessBrokerDirectory(environment), HARNESS_BROKER_DESCRIPTOR_FILE);
33904
34072
  }
33905
34073
  function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
33906
34074
  harnessPluginIdSchema.parse(harnessId);
@@ -33908,7 +34076,7 @@ function harnessBrokerLaunchAgentLabel(harnessId = "claude-code") {
33908
34076
  }
33909
34077
  function harnessBrokerLaunchAgentPlistPath(environment = process.env, harnessId = "claude-code") {
33910
34078
  const home = environment.HOME || os2.homedir();
33911
- return path11.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
34079
+ return path12.join(home, "Library", "LaunchAgents", `${harnessBrokerLaunchAgentLabel(harnessId)}.plist`);
33912
34080
  }
33913
34081
 
33914
34082
  // ../../harness-broker/dist/client.js
@@ -34038,7 +34206,7 @@ function describeBrokerFailure(error62, harnessId) {
34038
34206
  }
34039
34207
  function runLaunchctl(arguments_) {
34040
34208
  return new Promise((resolve) => {
34041
- execFile4("/bin/launchctl", arguments_, { timeout: 1e4 }, (error62) => resolve(!error62));
34209
+ execFile3("/bin/launchctl", arguments_, { timeout: 1e4 }, (error62) => resolve(!error62));
34042
34210
  });
34043
34211
  }
34044
34212
  async function startBrokerLaunchAgent(harnessId, environment) {