@codexhost/cli-win32-x64 0.32.0 → 0.33.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 (150) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +589 -30
  4. package/app/console-web.js +558 -30
  5. package/app/desktop-controller.mjs +883 -150
  6. package/app/host-runtime.mjs +8165 -3548
  7. package/app/plugins/antigravity/plugin.mjs +493 -55
  8. package/app/plugins/claude-code/assets/icon.svg +1 -1
  9. package/app/plugins/claude-code/manifest.json +1 -1
  10. package/app/plugins/claude-code/plugin.mjs +1106 -193
  11. package/app/plugins/codebuddy/plugin.mjs +465 -27
  12. package/app/plugins/codex-usage/plugin.mjs +367 -7
  13. package/app/plugins/copilot/assets/icon.svg +1 -1
  14. package/app/plugins/copilot/manifest.json +1 -1
  15. package/app/plugins/copilot/plugin.mjs +369 -9
  16. package/app/plugins/cursor-cli/plugin.mjs +367 -7
  17. package/app/plugins/deepseek-harness/assets/icon.svg +1 -1
  18. package/app/plugins/deepseek-harness/manifest.json +1 -1
  19. package/app/plugins/deepseek-harness/plugin.mjs +806 -148
  20. package/app/plugins/devin/assets/icon.svg +1 -1
  21. package/app/plugins/devin/manifest.json +1 -1
  22. package/app/plugins/devin/plugin.mjs +369 -8
  23. package/app/plugins/grok/plugin.mjs +367 -7
  24. package/app/plugins/hermes/plugin.mjs +367 -7
  25. package/app/plugins/kimi-code/plugin.mjs +367 -7
  26. package/app/plugins/kiro-cli/plugin.mjs +367 -7
  27. package/app/plugins/omp/assets/icon.svg +1 -1
  28. package/app/plugins/omp/plugin.mjs +393 -7
  29. package/app/plugins/opencode/plugin.mjs +371 -8
  30. package/app/plugins/pi/assets/icon.svg +1 -1
  31. package/app/plugins/pi/manifest.json +1 -1
  32. package/app/plugins/pi/plugin.mjs +395 -9
  33. package/app/plugins/qoder/assets/icon.svg +1 -1
  34. package/app/plugins/qoder/plugin.mjs +393 -7
  35. package/app/plugins/qoder-cn/assets/icon.svg +1 -1
  36. package/app/plugins/qoder-cn/plugin.mjs +393 -7
  37. package/app/plugins/qwen-code/assets/icon.svg +1 -1
  38. package/app/plugins/qwen-code/plugin.mjs +396 -7
  39. package/app/plugins/workbuddy/plugin.mjs +465 -27
  40. package/app/plugins/zcode/plugin.mjs +387 -14
  41. package/app/renderer-extension.js +581 -41
  42. package/app/web/assets/{abnfDiagram-XWFEHMT6-CnJyN70L.js → abnfDiagram-XWFEHMT6-VnfRaHM6.js} +1 -1
  43. package/app/web/assets/{architectureDiagram-CSQXQB3N-DH0ITYVE.js → architectureDiagram-CSQXQB3N-BA1ehtvi.js} +1 -1
  44. package/app/web/assets/{blockDiagram-BEDRHYPZ-WL3ZKoKg.js → blockDiagram-BEDRHYPZ-31BZSfd4.js} +1 -1
  45. package/app/web/assets/{c4Diagram-M2UUVUY5-XwSPKj5H.js → c4Diagram-M2UUVUY5-CNzGWc5k.js} +1 -1
  46. package/app/web/assets/{chunk-2Q5K7J3B-CKEzexjg.js → chunk-2Q5K7J3B-ahAIR-NM.js} +1 -1
  47. package/app/web/assets/{chunk-3GCGMST5-BdEgLpab.js → chunk-3GCGMST5-BIV5YeRJ.js} +1 -1
  48. package/app/web/assets/{chunk-5VM5RSS4-DyxL5-Ts.js → chunk-5VM5RSS4-CluTMPJG.js} +1 -1
  49. package/app/web/assets/{chunk-7U7NFRK5-FXLb4tYa.js → chunk-7U7NFRK5-4NIQuFbE.js} +1 -1
  50. package/app/web/assets/{chunk-CNRTWJTD-DcdC1OYr.js → chunk-CNRTWJTD-_0bEfGn3.js} +1 -1
  51. package/app/web/assets/{chunk-D5HYT7QG-BOz9vBX9.js → chunk-D5HYT7QG-_kTC6f8F.js} +1 -1
  52. package/app/web/assets/{chunk-EBZ3SEQC-Dmc_Z53x.js → chunk-EBZ3SEQC-CykaYOrL.js} +2 -2
  53. package/app/web/assets/{chunk-JWPE2WC7-CrFwSwYi.js → chunk-JWPE2WC7-3vVOQ_py.js} +1 -1
  54. package/app/web/assets/{chunk-KTR4FSNJ-BY3AzFaI.js → chunk-KTR4FSNJ-aVg5vgrm.js} +1 -1
  55. package/app/web/assets/{chunk-XXDRQBXY-CHgNy82n.js → chunk-XXDRQBXY-_gVwGeSp.js} +1 -1
  56. package/app/web/assets/{classDiagram-v2-KXABOMEV-ClM3-y5Z.js → classDiagram-v2-KXABOMEV-fI1LfeBf.js} +1 -1
  57. package/app/web/assets/{cose-bilkent-JH36ORCC-I7nd8GgO.js → cose-bilkent-JH36ORCC-DFXMlWov.js} +1 -1
  58. package/app/web/assets/{cynefin-EF2NZ3EQ-DzsXmyBH.js → cynefin-EF2NZ3EQ-lZy7X6FO.js} +1 -1
  59. package/app/web/assets/{cynefinDiagram-NJNITYFG-DLHq6igy.js → cynefinDiagram-NJNITYFG-N4DwFSW1.js} +1 -1
  60. package/app/web/assets/{dagre-KIHZ2IZ3-BK991Mno.js → dagre-KIHZ2IZ3-B7-8baTH.js} +1 -1
  61. package/app/web/assets/{diagram-7YQZDPLS-C4qiWdQU.js → diagram-7YQZDPLS-DLfjiBXV.js} +1 -1
  62. package/app/web/assets/{diagram-QBROCOUO-C_ZyBohC.js → diagram-QBROCOUO-CQnRzSTi.js} +1 -1
  63. package/app/web/assets/{diagram-RJJCUUZO-C5Aezm94.js → diagram-RJJCUUZO-DPnxazRT.js} +1 -1
  64. package/app/web/assets/{diagram-WERXNKYE-Ckc_umlF.js → diagram-WERXNKYE-BBuEFRvD.js} +1 -1
  65. package/app/web/assets/{diagram-YHHI257C-BHjReoZZ.js → diagram-YHHI257C-BQ92JNJs.js} +1 -1
  66. package/app/web/assets/{diagram-YR4HJLHV-DVTGi_y9.js → diagram-YR4HJLHV-Ce6BQO3J.js} +1 -1
  67. package/app/web/assets/{ebnfDiagram-N527522P-getuz1AR.js → ebnfDiagram-N527522P-DYknE2Jy.js} +1 -1
  68. package/app/web/assets/{elk-O5DQBFGD-C7mhTIuK.js → elk-O5DQBFGD-4S6_JJFF.js} +1 -1
  69. package/app/web/assets/{erDiagram-K3K3BIDK-sV-HZvUV.js → erDiagram-K3K3BIDK-DRtF7JVQ.js} +1 -1
  70. package/app/web/assets/{flowDiagram-Z6JWZHQI-D0L4wXUs.js → flowDiagram-Z6JWZHQI-7Ho8CyR9.js} +1 -1
  71. package/app/web/assets/{ganttDiagram-3PRQTZWP-BNt9Bjjo.js → ganttDiagram-3PRQTZWP-CW8Ig5y4.js} +1 -1
  72. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-BABZzhHw.js → gitGraphDiagram-VXDFKS5L-CzS8Xg2D.js} +1 -1
  73. package/app/web/assets/{grid-E2QIVN74-DLe2FQ_d.js → grid-E2QIVN74-Cq284lCe.js} +1 -1
  74. package/app/web/assets/index-CINZ6P-q.css +1 -0
  75. package/app/web/assets/index-CvV6veuY.js +208 -0
  76. package/app/web/assets/{infoDiagram-EZ3ZOAHP-BKDuUqcr.js → infoDiagram-EZ3ZOAHP-BZgN6qlY.js} +1 -1
  77. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-C75EGghg.js → ishikawaDiagram-S3EKX5GW-BH9YHc-1.js} +1 -1
  78. package/app/web/assets/{journeyDiagram-POQNLL5X-q7Obruqa.js → journeyDiagram-POQNLL5X-D50KYOLe.js} +1 -1
  79. package/app/web/assets/{kanban-definition-BH5XI6FM-CzAqhFED.js → kanban-definition-BH5XI6FM-Crw_5mMP.js} +1 -1
  80. package/app/web/assets/langs/{graphql-D6Z3qcRW.js → graphql-2R4AZ1iu.js} +1 -1
  81. package/app/web/assets/langs/{http-XiU9G9In.js → http-q2Qm0vBh.js} +1 -1
  82. package/app/web/assets/langs/{php-DL3xwS-7.js → php-Cz2gDBnd.js} +1 -1
  83. package/app/web/assets/langs/{rst-DudRVJ9g.js → rst-_9muvx-X.js} +1 -1
  84. package/app/web/assets/langs/{ruby-_FqsfqJi.js → ruby-cn7REk4H.js} +1 -1
  85. package/app/web/assets/langs/{svelte-ClsVJoBT.js → svelte-CPnL2mcy.js} +1 -1
  86. package/app/web/assets/langs/{vue-BiKMXCyK.js → vue-DO0YwyVz.js} +1 -1
  87. package/app/web/assets/{mermaid.core-Bysx44LR.js → mermaid.core-o2Qjrppc.js} +5 -5
  88. package/app/web/assets/{mindmap-definition-WVAN44T4-Ds5rXTrF.js → mindmap-definition-WVAN44T4-B_bEbpAH.js} +1 -1
  89. package/app/web/assets/{pegDiagram-D4NLKWP3-hmdERwtT.js → pegDiagram-D4NLKWP3-VecAHoyw.js} +1 -1
  90. package/app/web/assets/{pieDiagram-36ENHN4W-DfTnyG8D.js → pieDiagram-36ENHN4W-o3ei2T-6.js} +1 -1
  91. package/app/web/assets/{quadrantDiagram-ZQUDMS73-CreQWjZQ.js → quadrantDiagram-ZQUDMS73-DHndOAcn.js} +1 -1
  92. package/app/web/assets/{railroadDiagram-JIZHGYPL-Bhc_eO9G.js → railroadDiagram-JIZHGYPL-DRd_lfii.js} +1 -1
  93. package/app/web/assets/{render-VIF2ZAQL-BS1Zgk8K.js → render-VIF2ZAQL-awM3hUqB.js} +2 -2
  94. package/app/web/assets/{requirementDiagram-AXW2TVFA-Dlp7d6QT.js → requirementDiagram-AXW2TVFA-Ce1ePsOe.js} +1 -1
  95. package/app/web/assets/{sankeyDiagram-FBCJTAIF-DGBchL30.js → sankeyDiagram-FBCJTAIF-cP-LtgW-.js} +1 -1
  96. package/app/web/assets/{sequenceDiagram-3LA2ROMG-DauFg5_R.js → sequenceDiagram-3LA2ROMG-C3JStTuW.js} +1 -1
  97. package/app/web/assets/{sizeCapture-2Q2CQKSF-DR-zy7an.js → sizeCapture-2Q2CQKSF-Dyyelr9K.js} +1 -1
  98. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-BSRBSGUi.js → stateDiagram-v2-ATKHQDJO-DkYRBVTd.js} +1 -1
  99. package/app/web/assets/{swimlanes-YQL5WMAO-BwzOr5Dv.js → swimlanes-YQL5WMAO-B2FwJU5_.js} +1 -1
  100. package/app/web/assets/swimlanesDiagram-UCCPES4V-BkMsxCPb.js +8 -0
  101. package/app/web/assets/{timeline-definition-7Z437IG3-BoZ-mNKc.js → timeline-definition-7Z437IG3-Di-qRIIi.js} +1 -1
  102. package/app/web/assets/{usecaseDiagram-RDK6N6HP-DikhgH2m.js → usecaseDiagram-RDK6N6HP-yAImn62t.js} +1 -1
  103. package/app/web/assets/{vendor-BKfNgqAm.js → vendor-BMCjWFMy.js} +20 -20
  104. package/app/web/assets/{vennDiagram-SHRQU5PJ-DY_oIxwl.js → vennDiagram-SHRQU5PJ-BEv8jpfv.js} +1 -1
  105. package/app/web/assets/{wardleyDiagram-F3OXNVQS-DrRIiB_M.js → wardleyDiagram-F3OXNVQS-7irksA0b.js} +1 -1
  106. package/app/web/assets/{xychartDiagram-GDYJKCDI-CzSPgHV7.js → xychartDiagram-GDYJKCDI-BokJGG2y.js} +1 -1
  107. package/app/web/codex-agent.png +0 -0
  108. package/app/web/codex.png +0 -0
  109. package/app/web/codexhost-settings.js +66 -66
  110. package/app/web/index.html +3 -3
  111. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +65 -65
  112. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +69 -69
  113. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  114. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  115. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +78 -73
  116. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +92 -92
  117. package/app/web/plugins/deepseek-ai__dsh-client-ui-input-trigger/client.js +1 -1
  118. package/app/web/plugins/deepseek-ai__dsh-client-ui-model-selection/client.js +114 -2
  119. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  120. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +79 -79
  121. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  122. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +70 -70
  123. package/app/web/role-avatars/builtin/architect-otter.webp +0 -0
  124. package/app/web/role-avatars/builtin/audio-otter.webp +0 -0
  125. package/app/web/role-avatars/builtin/backend-otter.webp +0 -0
  126. package/app/web/role-avatars/builtin/classic-otter.webp +0 -0
  127. package/app/web/role-avatars/builtin/data-otter.webp +0 -0
  128. package/app/web/role-avatars/builtin/debugger-otter.webp +0 -0
  129. package/app/web/role-avatars/builtin/frontend-otter.webp +0 -0
  130. package/app/web/role-avatars/builtin/idea-otter.webp +0 -0
  131. package/app/web/role-avatars/builtin/ops-otter.webp +0 -0
  132. package/app/web/role-avatars/builtin/pm-otter.webp +0 -0
  133. package/app/web/role-avatars/builtin/researcher-otter.webp +0 -0
  134. package/app/web/role-avatars/builtin/reviewer-otter.webp +0 -0
  135. package/app/web/role-avatars/builtin/scholar-otter.webp +0 -0
  136. package/app/web/role-avatars/builtin/security-otter.webp +0 -0
  137. package/app/web/role-avatars/builtin/tester-otter.webp +0 -0
  138. package/app/web/role-avatars/builtin/writer-otter.webp +0 -0
  139. package/app/web-modules/node_modules/@deepseek-ai/dsh-host-webserver/index.js +7 -1
  140. package/app/web-modules/server.mjs +1324 -252
  141. package/bin/codexhost.exe +0 -0
  142. package/libexec/codexhost-node-repl.exe +0 -0
  143. package/libexec/codexhost-screenshot.exe +0 -0
  144. package/libexec/codexhost-shell.exe +0 -0
  145. package/libexec/codexhost-shim.exe +0 -0
  146. package/libexec/codexhost-updater.exe +0 -0
  147. package/package.json +1 -1
  148. package/app/web/assets/index-BLmkBEoq.js +0 -205
  149. package/app/web/assets/index-Dwdnvinl.css +0 -1
  150. package/app/web/assets/swimlanesDiagram-UCCPES4V-CNV63-us.js +0 -8
@@ -99,14 +99,14 @@ var require_polyfills = __commonJS({
99
99
  fs2.fstatSync = statFixSync(fs2.fstatSync);
100
100
  fs2.lstatSync = statFixSync(fs2.lstatSync);
101
101
  if (fs2.chmod && !fs2.lchmod) {
102
- fs2.lchmod = function(path6, mode, cb) {
102
+ fs2.lchmod = function(path7, mode, cb) {
103
103
  if (cb) process.nextTick(cb);
104
104
  };
105
105
  fs2.lchmodSync = function() {
106
106
  };
107
107
  }
108
108
  if (fs2.chown && !fs2.lchown) {
109
- fs2.lchown = function(path6, uid, gid, cb) {
109
+ fs2.lchown = function(path7, uid, gid, cb) {
110
110
  if (cb) process.nextTick(cb);
111
111
  };
112
112
  fs2.lchownSync = function() {
@@ -114,7 +114,7 @@ var require_polyfills = __commonJS({
114
114
  }
115
115
  if (platform === "win32") {
116
116
  fs2.rename = typeof fs2.rename !== "function" ? fs2.rename : (function(fs$rename) {
117
- function rename3(from, to2, cb) {
117
+ function rename4(from, to2, cb) {
118
118
  var start = Date.now();
119
119
  var backoff = 0;
120
120
  fs$rename(from, to2, function CB(er2) {
@@ -134,8 +134,8 @@ var require_polyfills = __commonJS({
134
134
  if (cb) cb(er2);
135
135
  });
136
136
  }
137
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename3, fs$rename);
138
- return rename3;
137
+ if (Object.setPrototypeOf) Object.setPrototypeOf(rename4, fs$rename);
138
+ return rename4;
139
139
  })(fs2.rename);
140
140
  }
141
141
  fs2.read = typeof fs2.read !== "function" ? fs2.read : (function(fs$read) {
@@ -173,9 +173,9 @@ var require_polyfills = __commonJS({
173
173
  };
174
174
  })(fs2.readSync);
175
175
  function patchLchmod(fs3) {
176
- fs3.lchmod = function(path6, mode, callback) {
176
+ fs3.lchmod = function(path7, mode, callback) {
177
177
  fs3.open(
178
- path6,
178
+ path7,
179
179
  constants2.O_WRONLY | constants2.O_SYMLINK,
180
180
  mode,
181
181
  function(err, fd2) {
@@ -191,8 +191,8 @@ var require_polyfills = __commonJS({
191
191
  }
192
192
  );
193
193
  };
194
- fs3.lchmodSync = function(path6, mode) {
195
- var fd2 = fs3.openSync(path6, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
194
+ fs3.lchmodSync = function(path7, mode) {
195
+ var fd2 = fs3.openSync(path7, constants2.O_WRONLY | constants2.O_SYMLINK, mode);
196
196
  var threw = true;
197
197
  var ret;
198
198
  try {
@@ -213,8 +213,8 @@ var require_polyfills = __commonJS({
213
213
  }
214
214
  function patchLutimes(fs3) {
215
215
  if (constants2.hasOwnProperty("O_SYMLINK") && fs3.futimes) {
216
- fs3.lutimes = function(path6, at2, mt2, cb) {
217
- fs3.open(path6, constants2.O_SYMLINK, function(er2, fd2) {
216
+ fs3.lutimes = function(path7, at2, mt2, cb) {
217
+ fs3.open(path7, constants2.O_SYMLINK, function(er2, fd2) {
218
218
  if (er2) {
219
219
  if (cb) cb(er2);
220
220
  return;
@@ -226,8 +226,8 @@ var require_polyfills = __commonJS({
226
226
  });
227
227
  });
228
228
  };
229
- fs3.lutimesSync = function(path6, at2, mt2) {
230
- var fd2 = fs3.openSync(path6, constants2.O_SYMLINK);
229
+ fs3.lutimesSync = function(path7, at2, mt2) {
230
+ var fd2 = fs3.openSync(path7, constants2.O_SYMLINK);
231
231
  var ret;
232
232
  var threw = true;
233
233
  try {
@@ -345,11 +345,11 @@ var require_legacy_streams = __commonJS({
345
345
  ReadStream,
346
346
  WriteStream
347
347
  };
348
- function ReadStream(path6, options) {
349
- if (!(this instanceof ReadStream)) return new ReadStream(path6, options);
348
+ function ReadStream(path7, options) {
349
+ if (!(this instanceof ReadStream)) return new ReadStream(path7, options);
350
350
  Stream.call(this);
351
351
  var self2 = this;
352
- this.path = path6;
352
+ this.path = path7;
353
353
  this.fd = null;
354
354
  this.readable = true;
355
355
  this.paused = false;
@@ -394,10 +394,10 @@ var require_legacy_streams = __commonJS({
394
394
  self2._read();
395
395
  });
396
396
  }
397
- function WriteStream(path6, options) {
398
- if (!(this instanceof WriteStream)) return new WriteStream(path6, options);
397
+ function WriteStream(path7, options) {
398
+ if (!(this instanceof WriteStream)) return new WriteStream(path7, options);
399
399
  Stream.call(this);
400
- this.path = path6;
400
+ this.path = path7;
401
401
  this.fd = null;
402
402
  this.writable = true;
403
403
  this.flags = "w";
@@ -539,15 +539,15 @@ var require_graceful_fs = __commonJS({
539
539
  fs3.createReadStream = createReadStream;
540
540
  fs3.createWriteStream = createWriteStream;
541
541
  var fs$readFile = fs3.readFile;
542
- fs3.readFile = readFile2;
543
- function readFile2(path6, options, cb) {
542
+ fs3.readFile = readFile3;
543
+ function readFile3(path7, options, cb) {
544
544
  if (typeof options === "function")
545
545
  cb = options, options = null;
546
- return go$readFile(path6, options, cb);
547
- function go$readFile(path7, options2, cb2, startTime) {
548
- return fs$readFile(path7, options2, function(err) {
546
+ return go$readFile(path7, options, cb);
547
+ function go$readFile(path8, options2, cb2, startTime) {
548
+ return fs$readFile(path8, options2, function(err) {
549
549
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
550
- enqueue([go$readFile, [path7, options2, cb2], err, startTime || Date.now(), Date.now()]);
550
+ enqueue([go$readFile, [path8, options2, cb2], err, startTime || Date.now(), Date.now()]);
551
551
  else {
552
552
  if (typeof cb2 === "function")
553
553
  cb2.apply(this, arguments);
@@ -556,15 +556,15 @@ var require_graceful_fs = __commonJS({
556
556
  }
557
557
  }
558
558
  var fs$writeFile = fs3.writeFile;
559
- fs3.writeFile = writeFile5;
560
- function writeFile5(path6, data, options, cb) {
559
+ fs3.writeFile = writeFile6;
560
+ function writeFile6(path7, data, options, cb) {
561
561
  if (typeof options === "function")
562
562
  cb = options, options = null;
563
- return go$writeFile(path6, data, options, cb);
564
- function go$writeFile(path7, data2, options2, cb2, startTime) {
565
- return fs$writeFile(path7, data2, options2, function(err) {
563
+ return go$writeFile(path7, data, options, cb);
564
+ function go$writeFile(path8, data2, options2, cb2, startTime) {
565
+ return fs$writeFile(path8, data2, options2, function(err) {
566
566
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
567
- enqueue([go$writeFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
567
+ enqueue([go$writeFile, [path8, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
568
568
  else {
569
569
  if (typeof cb2 === "function")
570
570
  cb2.apply(this, arguments);
@@ -575,14 +575,14 @@ var require_graceful_fs = __commonJS({
575
575
  var fs$appendFile = fs3.appendFile;
576
576
  if (fs$appendFile)
577
577
  fs3.appendFile = appendFile;
578
- function appendFile(path6, data, options, cb) {
578
+ function appendFile(path7, data, options, cb) {
579
579
  if (typeof options === "function")
580
580
  cb = options, options = null;
581
- return go$appendFile(path6, data, options, cb);
582
- function go$appendFile(path7, data2, options2, cb2, startTime) {
583
- return fs$appendFile(path7, data2, options2, function(err) {
581
+ return go$appendFile(path7, data, options, cb);
582
+ function go$appendFile(path8, data2, options2, cb2, startTime) {
583
+ return fs$appendFile(path8, data2, options2, function(err) {
584
584
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
585
- enqueue([go$appendFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
585
+ enqueue([go$appendFile, [path8, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
586
586
  else {
587
587
  if (typeof cb2 === "function")
588
588
  cb2.apply(this, arguments);
@@ -613,31 +613,31 @@ var require_graceful_fs = __commonJS({
613
613
  var fs$readdir = fs3.readdir;
614
614
  fs3.readdir = readdir2;
615
615
  var noReaddirOptionVersions = /^v[0-5]\./;
616
- function readdir2(path6, options, cb) {
616
+ function readdir2(path7, options, cb) {
617
617
  if (typeof options === "function")
618
618
  cb = options, options = null;
619
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path7, options2, cb2, startTime) {
620
- return fs$readdir(path7, fs$readdirCallback(
621
- path7,
619
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path8, options2, cb2, startTime) {
620
+ return fs$readdir(path8, fs$readdirCallback(
621
+ path8,
622
622
  options2,
623
623
  cb2,
624
624
  startTime
625
625
  ));
626
- } : function go$readdir2(path7, options2, cb2, startTime) {
627
- return fs$readdir(path7, options2, fs$readdirCallback(
628
- path7,
626
+ } : function go$readdir2(path8, options2, cb2, startTime) {
627
+ return fs$readdir(path8, options2, fs$readdirCallback(
628
+ path8,
629
629
  options2,
630
630
  cb2,
631
631
  startTime
632
632
  ));
633
633
  };
634
- return go$readdir(path6, options, cb);
635
- function fs$readdirCallback(path7, options2, cb2, startTime) {
634
+ return go$readdir(path7, options, cb);
635
+ function fs$readdirCallback(path8, options2, cb2, startTime) {
636
636
  return function(err, files) {
637
637
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
638
638
  enqueue([
639
639
  go$readdir,
640
- [path7, options2, cb2],
640
+ [path8, options2, cb2],
641
641
  err,
642
642
  startTime || Date.now(),
643
643
  Date.now()
@@ -708,7 +708,7 @@ var require_graceful_fs = __commonJS({
708
708
  enumerable: true,
709
709
  configurable: true
710
710
  });
711
- function ReadStream(path6, options) {
711
+ function ReadStream(path7, options) {
712
712
  if (this instanceof ReadStream)
713
713
  return fs$ReadStream.apply(this, arguments), this;
714
714
  else
@@ -728,7 +728,7 @@ var require_graceful_fs = __commonJS({
728
728
  }
729
729
  });
730
730
  }
731
- function WriteStream(path6, options) {
731
+ function WriteStream(path7, options) {
732
732
  if (this instanceof WriteStream)
733
733
  return fs$WriteStream.apply(this, arguments), this;
734
734
  else
@@ -746,22 +746,22 @@ var require_graceful_fs = __commonJS({
746
746
  }
747
747
  });
748
748
  }
749
- function createReadStream(path6, options) {
750
- return new fs3.ReadStream(path6, options);
749
+ function createReadStream(path7, options) {
750
+ return new fs3.ReadStream(path7, options);
751
751
  }
752
- function createWriteStream(path6, options) {
753
- return new fs3.WriteStream(path6, options);
752
+ function createWriteStream(path7, options) {
753
+ return new fs3.WriteStream(path7, options);
754
754
  }
755
755
  var fs$open = fs3.open;
756
756
  fs3.open = open3;
757
- function open3(path6, flags, mode, cb) {
757
+ function open3(path7, flags, mode, cb) {
758
758
  if (typeof mode === "function")
759
759
  cb = mode, mode = null;
760
- return go$open(path6, flags, mode, cb);
761
- function go$open(path7, flags2, mode2, cb2, startTime) {
762
- return fs$open(path7, flags2, mode2, function(err, fd2) {
760
+ return go$open(path7, flags, mode, cb);
761
+ function go$open(path8, flags2, mode2, cb2, startTime) {
762
+ return fs$open(path8, flags2, mode2, function(err, fd2) {
763
763
  if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
764
- enqueue([go$open, [path7, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
764
+ enqueue([go$open, [path8, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
765
765
  else {
766
766
  if (typeof cb2 === "function")
767
767
  cb2.apply(this, arguments);
@@ -1252,11 +1252,11 @@ var require_mtime_precision = __commonJS({
1252
1252
  function probe(file2, fs2, callback) {
1253
1253
  const cachedPrecision = fs2[cacheSymbol];
1254
1254
  if (cachedPrecision) {
1255
- return fs2.stat(file2, (err, stat) => {
1255
+ return fs2.stat(file2, (err, stat2) => {
1256
1256
  if (err) {
1257
1257
  return callback(err);
1258
1258
  }
1259
- callback(null, stat.mtime, cachedPrecision);
1259
+ callback(null, stat2.mtime, cachedPrecision);
1260
1260
  });
1261
1261
  }
1262
1262
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
@@ -1264,13 +1264,13 @@ var require_mtime_precision = __commonJS({
1264
1264
  if (err) {
1265
1265
  return callback(err);
1266
1266
  }
1267
- fs2.stat(file2, (err2, stat) => {
1267
+ fs2.stat(file2, (err2, stat2) => {
1268
1268
  if (err2) {
1269
1269
  return callback(err2);
1270
1270
  }
1271
- const precision = stat.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1271
+ const precision = stat2.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1272
1272
  Object.defineProperty(fs2, cacheSymbol, { value: precision });
1273
- callback(null, stat.mtime, precision);
1273
+ callback(null, stat2.mtime, precision);
1274
1274
  });
1275
1275
  });
1276
1276
  }
@@ -1290,7 +1290,7 @@ var require_mtime_precision = __commonJS({
1290
1290
  var require_lockfile = __commonJS({
1291
1291
  "node_modules/proper-lockfile/lib/lockfile.js"(exports, module) {
1292
1292
  "use strict";
1293
- var path6 = __require("path");
1293
+ var path7 = __require("path");
1294
1294
  var fs2 = require_graceful_fs();
1295
1295
  var retry = require_retry2();
1296
1296
  var onExit = require_signal_exit();
@@ -1301,7 +1301,7 @@ var require_lockfile = __commonJS({
1301
1301
  }
1302
1302
  function resolveCanonicalPath(file2, options, callback) {
1303
1303
  if (!options.realpath) {
1304
- return callback(null, path6.resolve(file2));
1304
+ return callback(null, path7.resolve(file2));
1305
1305
  }
1306
1306
  options.fs.realpath(file2, callback);
1307
1307
  }
@@ -1324,14 +1324,14 @@ var require_lockfile = __commonJS({
1324
1324
  if (options.stale <= 0) {
1325
1325
  return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
1326
1326
  }
1327
- options.fs.stat(lockfilePath, (err2, stat) => {
1327
+ options.fs.stat(lockfilePath, (err2, stat2) => {
1328
1328
  if (err2) {
1329
1329
  if (err2.code === "ENOENT") {
1330
1330
  return acquireLock(file2, { ...options, stale: 0 }, callback);
1331
1331
  }
1332
1332
  return callback(err2);
1333
1333
  }
1334
- if (!isLockStale(stat, options)) {
1334
+ if (!isLockStale(stat2, options)) {
1335
1335
  return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
1336
1336
  }
1337
1337
  removeLock(file2, options, (err3) => {
@@ -1343,8 +1343,8 @@ var require_lockfile = __commonJS({
1343
1343
  });
1344
1344
  });
1345
1345
  }
1346
- function isLockStale(stat, options) {
1347
- return stat.mtime.getTime() < Date.now() - options.stale;
1346
+ function isLockStale(stat2, options) {
1347
+ return stat2.mtime.getTime() < Date.now() - options.stale;
1348
1348
  }
1349
1349
  function removeLock(file2, options, callback) {
1350
1350
  options.fs.rmdir(getLockFile(file2, options), (err) => {
@@ -1362,7 +1362,7 @@ var require_lockfile = __commonJS({
1362
1362
  lock2.updateDelay = lock2.updateDelay || options.update;
1363
1363
  lock2.updateTimeout = setTimeout(() => {
1364
1364
  lock2.updateTimeout = null;
1365
- options.fs.stat(lock2.lockfilePath, (err, stat) => {
1365
+ options.fs.stat(lock2.lockfilePath, (err, stat2) => {
1366
1366
  const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
1367
1367
  if (err) {
1368
1368
  if (err.code === "ENOENT" || isOverThreshold) {
@@ -1371,7 +1371,7 @@ var require_lockfile = __commonJS({
1371
1371
  lock2.updateDelay = 1e3;
1372
1372
  return updateLock(file2, options);
1373
1373
  }
1374
- const isMtimeOurs = lock2.mtime.getTime() === stat.mtime.getTime();
1374
+ const isMtimeOurs = lock2.mtime.getTime() === stat2.mtime.getTime();
1375
1375
  if (!isMtimeOurs) {
1376
1376
  return setLockAsCompromised(
1377
1377
  file2,
@@ -1496,11 +1496,11 @@ var require_lockfile = __commonJS({
1496
1496
  if (err) {
1497
1497
  return callback(err);
1498
1498
  }
1499
- options.fs.stat(getLockFile(file3, options), (err2, stat) => {
1499
+ options.fs.stat(getLockFile(file3, options), (err2, stat2) => {
1500
1500
  if (err2) {
1501
1501
  return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
1502
1502
  }
1503
- return callback(null, !isLockStale(stat, options));
1503
+ return callback(null, !isLockStale(stat2, options));
1504
1504
  });
1505
1505
  });
1506
1506
  }
@@ -11405,8 +11405,8 @@ function controllerLifecycle(key, context, stop2) {
11405
11405
  }
11406
11406
 
11407
11407
  // packages/desktop-control/src/production-controller.ts
11408
- import { readFile } from "node:fs/promises";
11409
- import path5 from "node:path";
11408
+ import { readFile as readFile2 } from "node:fs/promises";
11409
+ import path6 from "node:path";
11410
11410
 
11411
11411
  // packages/desktop-control/src/renderer-local-page.ts
11412
11412
  import { randomUUID } from "node:crypto";
@@ -13190,10 +13190,10 @@ function mergeDefs(...defs) {
13190
13190
  function cloneDef(schema) {
13191
13191
  return mergeDefs(schema._zod.def);
13192
13192
  }
13193
- function getElementAtPath(obj, path6) {
13194
- if (!path6)
13193
+ function getElementAtPath(obj, path7) {
13194
+ if (!path7)
13195
13195
  return obj;
13196
- return path6.reduce((acc, key) => acc?.[key], obj);
13196
+ return path7.reduce((acc, key) => acc?.[key], obj);
13197
13197
  }
13198
13198
  function promiseAllObject(promisesObj) {
13199
13199
  const keys = Object.keys(promisesObj);
@@ -13533,11 +13533,11 @@ function explicitlyAborted(x2, startIndex = 0) {
13533
13533
  }
13534
13534
  return false;
13535
13535
  }
13536
- function prefixIssues(path6, issues) {
13536
+ function prefixIssues(path7, issues) {
13537
13537
  return issues.map((iss) => {
13538
13538
  var _a4;
13539
13539
  (_a4 = iss).path ?? (_a4.path = []);
13540
- iss.path.unshift(path6);
13540
+ iss.path.unshift(path7);
13541
13541
  return iss;
13542
13542
  });
13543
13543
  }
@@ -13999,16 +13999,16 @@ function flattenError(error62, mapper = (issue2) => issue2.message) {
13999
13999
  }
14000
14000
  function formatError(error62, mapper = (issue2) => issue2.message) {
14001
14001
  const fieldErrors = { _errors: [] };
14002
- const processError = (error63, path6 = []) => {
14002
+ const processError = (error63, path7 = []) => {
14003
14003
  for (const issue2 of error63.issues) {
14004
14004
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14005
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
14005
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
14006
14006
  } else if (issue2.code === "invalid_key") {
14007
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14007
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14008
14008
  } else if (issue2.code === "invalid_element") {
14009
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14009
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14010
14010
  } else {
14011
- const fullpath = [...path6, ...issue2.path];
14011
+ const fullpath = [...path7, ...issue2.path];
14012
14012
  if (fullpath.length === 0) {
14013
14013
  fieldErrors._errors.push(mapper(issue2));
14014
14014
  } else {
@@ -14047,17 +14047,17 @@ function formatError(error62, mapper = (issue2) => issue2.message) {
14047
14047
  }
14048
14048
  function treeifyError(error62, mapper = (issue2) => issue2.message) {
14049
14049
  const result = { errors: [] };
14050
- const processError = (error63, path6 = []) => {
14050
+ const processError = (error63, path7 = []) => {
14051
14051
  var _a4;
14052
14052
  for (const issue2 of error63.issues) {
14053
14053
  if (issue2.code === "invalid_union" && issue2.errors.length) {
14054
- issue2.errors.map((issues) => processError({ issues }, [...path6, ...issue2.path]));
14054
+ issue2.errors.map((issues) => processError({ issues }, [...path7, ...issue2.path]));
14055
14055
  } else if (issue2.code === "invalid_key") {
14056
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14056
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14057
14057
  } else if (issue2.code === "invalid_element") {
14058
- processError({ issues: issue2.issues }, [...path6, ...issue2.path]);
14058
+ processError({ issues: issue2.issues }, [...path7, ...issue2.path]);
14059
14059
  } else {
14060
- const fullpath = [...path6, ...issue2.path];
14060
+ const fullpath = [...path7, ...issue2.path];
14061
14061
  if (fullpath.length === 0) {
14062
14062
  result.errors.push(mapper(issue2));
14063
14063
  continue;
@@ -14096,8 +14096,8 @@ function treeifyError(error62, mapper = (issue2) => issue2.message) {
14096
14096
  }
14097
14097
  function toDotPath(_path) {
14098
14098
  const segs = [];
14099
- const path6 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14100
- for (const seg of path6) {
14099
+ const path7 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
14100
+ for (const seg of path7) {
14101
14101
  if (typeof seg === "number")
14102
14102
  segs.push(`[${seg}]`);
14103
14103
  else if (typeof seg === "symbol")
@@ -31235,13 +31235,13 @@ function resolveRef(ref, ctx) {
31235
31235
  if (!ref.startsWith("#")) {
31236
31236
  throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
31237
31237
  }
31238
- const path6 = ref.slice(1).split("/").filter(Boolean);
31239
- if (path6.length === 0) {
31238
+ const path7 = ref.slice(1).split("/").filter(Boolean);
31239
+ if (path7.length === 0) {
31240
31240
  return ctx.rootSchema;
31241
31241
  }
31242
31242
  const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
31243
- if (path6[0] === defsKey) {
31244
- const key = path6[1] === void 0 ? void 0 : decodeJSONPointerSegment(path6[1]);
31243
+ if (path7[0] === defsKey) {
31244
+ const key = path7[1] === void 0 ? void 0 : decodeJSONPointerSegment(path7[1]);
31245
31245
  if (!key || !ctx.defs[key]) {
31246
31246
  throw new Error(`Reference not found: ${ref}`);
31247
31247
  }
@@ -32177,6 +32177,8 @@ var harnessIdSchema = opaqueIdSchema.brand();
32177
32177
  var hostThreadIdSchema = opaqueIdSchema.brand();
32178
32178
  var hostTurnIdSchema = opaqueIdSchema.brand();
32179
32179
  var hostItemIdSchema = opaqueIdSchema.brand();
32180
+ var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
32181
+ var harnessThinkingOptionIdSchema = opaqueIdSchema.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
32180
32182
  var hostInteractionIdSchema = opaqueIdSchema.brand();
32181
32183
 
32182
32184
  // packages/shared-contracts/dist/harness-permission-modes.js
@@ -32258,6 +32260,122 @@ var threadHandoffResultSchema = external_exports.object({
32258
32260
  handoff: threadHandoffMetadataSchema
32259
32261
  }).strict();
32260
32262
 
32263
+ // packages/shared-contracts/dist/agent-role.js
32264
+ var roleSlugSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9-]{0,63}$/u);
32265
+ var roleModelSchema = external_exports.string().min(1).max(512).refine((value) => !new RegExp("\\p{Cc}", "u").test(value), "Role model must not contain control characters");
32266
+ var roleAccentColorSchema = external_exports.enum(["stone", "rose", "mist", "sage", "amber", "aqua"]);
32267
+ var BUILTIN_ROLE_AVATAR_IDS = [
32268
+ "pm-otter",
32269
+ "frontend-otter",
32270
+ "backend-otter",
32271
+ "reviewer-otter",
32272
+ "idea-otter",
32273
+ "researcher-otter",
32274
+ "writer-otter",
32275
+ "architect-otter",
32276
+ "debugger-otter",
32277
+ "tester-otter",
32278
+ "classic-otter",
32279
+ "ops-otter",
32280
+ "security-otter",
32281
+ "audio-otter",
32282
+ "scholar-otter",
32283
+ "data-otter"
32284
+ ];
32285
+ var builtinRoleAvatarSchema = external_exports.templateLiteral([
32286
+ "builtin:",
32287
+ external_exports.enum(BUILTIN_ROLE_AVATAR_IDS)
32288
+ ]);
32289
+ var ROLE_AVATAR_FILENAME_PATTERN = /^[a-zA-Z0-9_-]{1,64}\.(png|jpg|jpeg|webp)$/u;
32290
+ var customRoleAvatarSchema = external_exports.templateLiteral([
32291
+ "custom:",
32292
+ external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
32293
+ ]);
32294
+ var catalogRoleAvatarSchema = external_exports.templateLiteral([
32295
+ "catalog:",
32296
+ external_exports.string().regex(ROLE_AVATAR_FILENAME_PATTERN)
32297
+ ]);
32298
+ var roleAvatarSchema = external_exports.union([builtinRoleAvatarSchema, customRoleAvatarSchema]);
32299
+ var roleCatalogAvatarSchema = external_exports.union([builtinRoleAvatarSchema, catalogRoleAvatarSchema]);
32300
+ var saveRoleAvatarSchema = external_exports.union([roleAvatarSchema, catalogRoleAvatarSchema]);
32301
+ var httpsUrlSchema = external_exports.string().url().max(2048).refine((value) => /^https:\/\//i.test(value), "URL must use https://");
32302
+ var localizedRoleTextSchema = external_exports.object({
32303
+ en: external_exports.string().trim().min(1).max(2e3),
32304
+ "zh-CN": external_exports.string().trim().min(1).max(2e3)
32305
+ });
32306
+ var roleCatalogEntrySchema = external_exports.object({
32307
+ slug: roleSlugSchema,
32308
+ name: localizedRoleTextSchema,
32309
+ description: localizedRoleTextSchema,
32310
+ avatar: roleCatalogAvatarSchema,
32311
+ accentColor: roleAccentColorSchema,
32312
+ recommendedHarnessId: harnessIdSchema.optional(),
32313
+ author: external_exports.string().trim().min(1).max(128),
32314
+ authorUrl: httpsUrlSchema.optional(),
32315
+ sourceUrl: httpsUrlSchema.optional(),
32316
+ license: external_exports.string().trim().min(1).max(64).optional(),
32317
+ official: external_exports.boolean().optional(),
32318
+ instructions: external_exports.string().trim().min(1).max(1e5),
32319
+ updatedAt: external_exports.iso.datetime()
32320
+ });
32321
+ var roleCatalogDocumentSchema = external_exports.object({
32322
+ formatVersion: external_exports.literal(1),
32323
+ generatedAt: external_exports.iso.datetime(),
32324
+ roles: external_exports.array(roleCatalogEntrySchema)
32325
+ });
32326
+ var roleIdentitySchema = external_exports.object({
32327
+ slug: roleSlugSchema,
32328
+ name: external_exports.string().refine((name) => name.trim().length > 0),
32329
+ avatar: roleAvatarSchema,
32330
+ accentColor: roleAccentColorSchema
32331
+ });
32332
+ var threadRoleSnapshotSchema = roleIdentitySchema.readonly();
32333
+ var agentRoleSchema = roleIdentitySchema.extend({
32334
+ description: external_exports.string(),
32335
+ harnessId: harnessIdSchema,
32336
+ model: roleModelSchema.optional(),
32337
+ thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
32338
+ instructions: external_exports.string(),
32339
+ updatedAt: external_exports.iso.datetime()
32340
+ });
32341
+ var saveAgentRoleInputSchema = agentRoleSchema.omit({ updatedAt: true, avatar: true }).extend({ avatar: saveRoleAvatarSchema }).partial({ slug: true });
32342
+ var ROLES_LIST_METHOD = "codexhost/roles/list";
32343
+ var ROLES_GET_METHOD = "codexhost/roles/get";
32344
+ var ROLES_SAVE_METHOD = "codexhost/roles/save";
32345
+ var ROLES_DELETE_METHOD = "codexhost/roles/delete";
32346
+ var ROLES_CATALOG_METHOD = "codexhost/roles/catalog";
32347
+ var ROLES_LIKE_METHOD = "codexhost/roles/like";
32348
+ var ROLE_LIKES_MAX_PER_ROLE = 5;
32349
+ var rolesListParamsSchema = external_exports.object({
32350
+ locale: external_exports.string().trim().min(1).max(64).optional()
32351
+ });
32352
+ var rolesListResultSchema = external_exports.object({ roles: external_exports.array(agentRoleSchema) });
32353
+ var rolesGetParamsSchema = external_exports.object({ slug: roleSlugSchema });
32354
+ var rolesGetResultSchema = external_exports.object({ role: agentRoleSchema.nullable() });
32355
+ var rolesSaveResultSchema = external_exports.object({ role: agentRoleSchema });
32356
+ var rolesDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
32357
+ var rolesCatalogParamsSchema = external_exports.object({
32358
+ refresh: external_exports.boolean().optional()
32359
+ });
32360
+ var rolesCatalogResultSchema = external_exports.object({
32361
+ roles: external_exports.array(roleCatalogEntrySchema),
32362
+ fetchedAt: external_exports.iso.datetime(),
32363
+ likes: external_exports.record(roleSlugSchema, external_exports.number().int().nonnegative()).optional(),
32364
+ myLikes: external_exports.record(roleSlugSchema, external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE)).optional(),
32365
+ stale: external_exports.boolean().optional(),
32366
+ error: external_exports.string().optional()
32367
+ });
32368
+ var rolesLikeParamsSchema = external_exports.object({
32369
+ slug: roleSlugSchema
32370
+ });
32371
+ var rolesLikeResultSchema = external_exports.object({
32372
+ slug: roleSlugSchema,
32373
+ likes: external_exports.number().int().nonnegative(),
32374
+ myLikes: external_exports.number().int().min(0).max(ROLE_LIKES_MAX_PER_ROLE),
32375
+ maxLikes: external_exports.literal(ROLE_LIKES_MAX_PER_ROLE),
32376
+ limitReached: external_exports.boolean().optional()
32377
+ });
32378
+
32261
32379
  // packages/shared-contracts/dist/thread-usage.js
32262
32380
  var nonNegativeSafeIntegerSchema = external_exports.number().int().safe().nonnegative();
32263
32381
  var finiteNonNegativeNumberSchema = external_exports.number().finite().nonnegative();
@@ -32439,7 +32557,6 @@ var threadUsageInspectionSchema = external_exports.object({
32439
32557
  // packages/shared-contracts/dist/harness-models.js
32440
32558
  var HARNESS_MODEL_REF_MAX_LENGTH = 512;
32441
32559
  var HARNESS_MODEL_LABEL_MAX_LENGTH = 256;
32442
- var HARNESS_THINKING_OPTION_ID_MAX_LENGTH = 128;
32443
32560
  var THREAD_OWNERSHIP_LIST_MAX_LENGTH = 100;
32444
32561
  var nonBlankTextSchema3 = external_exports.string().refine((value) => value.trim().length > 0, {
32445
32562
  message: "Value must not be empty or whitespace"
@@ -32453,7 +32570,6 @@ var harnessModelRefSchema = external_exports.object({
32453
32570
  function sameHarnessModelRef(left, right) {
32454
32571
  return left?.id === right?.id && left?.serviceTier === right?.serviceTier;
32455
32572
  }
32456
- var harnessThinkingOptionIdSchema = nonBlankTextSchema3.max(HARNESS_THINKING_OPTION_ID_MAX_LENGTH).regex(/^[A-Za-z0-9._~-]+$/u, "Thinking option ID must use transport-safe characters").brand();
32457
32573
  var harnessResolvedModelLabelSchema = nonBlankTextSchema3.max(HARNESS_MODEL_LABEL_MAX_LENGTH);
32458
32574
  var harnessThinkingOptionSchema = external_exports.object({
32459
32575
  id: harnessThinkingOptionIdSchema,
@@ -32666,8 +32782,10 @@ var codexThreadInspectionSchema = external_exports.object({
32666
32782
  effectivePermissionModeId: harnessPermissionModeIdSchema.optional(),
32667
32783
  history: harnessHistoryCapabilitiesSchema.optional(),
32668
32784
  supportsThreadReferences: external_exports.literal(true).optional(),
32669
- handoff: threadHandoffMetadataSchema.optional()
32670
- }).strict();
32785
+ handoff: threadHandoffMetadataSchema.optional(),
32786
+ roleSnapshot: threadRoleSnapshotSchema.optional(),
32787
+ nativeSessionRef: external_exports.never().optional()
32788
+ });
32671
32789
  var externalThreadInspectionSchema = external_exports.object({
32672
32790
  owner: external_exports.literal("external"),
32673
32791
  harnessId: nonBlankTextSchema3.max(256),
@@ -32682,8 +32800,10 @@ var externalThreadInspectionSchema = external_exports.object({
32682
32800
  history: harnessHistoryCapabilitiesSchema,
32683
32801
  usage: threadUsageSnapshotSchema.optional(),
32684
32802
  handoff: threadHandoffMetadataSchema.optional(),
32803
+ roleSnapshot: threadRoleSnapshotSchema.optional(),
32804
+ nativeSessionRef: external_exports.never().optional(),
32685
32805
  locked: external_exports.literal(true)
32686
- }).strict();
32806
+ });
32687
32807
  var threadInspectionSchema = external_exports.discriminatedUnion("owner", [
32688
32808
  codexThreadInspectionSchema,
32689
32809
  externalThreadInspectionSchema
@@ -32926,7 +33046,7 @@ var desktopExtensionSettingFieldSchema = external_exports.discriminatedUnion("ty
32926
33046
  default: external_exports.string().optional()
32927
33047
  })
32928
33048
  ]).superRefine((field2, ctx) => {
32929
- const issue2 = (path6, message) => ctx.addIssue({ code: "custom", path: [path6], message });
33049
+ const issue2 = (path7, message) => ctx.addIssue({ code: "custom", path: [path7], message });
32930
33050
  if (field2.type === "number" || field2.type === "range") {
32931
33051
  const { min = -Infinity, max = Infinity, default: value } = field2;
32932
33052
  if (min > max)
@@ -33065,18 +33185,18 @@ var hostExtensionIdSchema = desktopExtensionIdSchema.refine((id3) => !reservedNa
33065
33185
  var hostExtensionTargetSchema = external_exports.enum(["desktop", "web"]);
33066
33186
  var hostExtensionDigestSchema = desktopExtensionHashSchema;
33067
33187
  var hostExtensionActivationIdSchema = external_exports.uuid();
33068
- 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((path6) => path6.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
33188
+ 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((path7) => path7.split("/").length <= 32, "Extension resources may be at most 32 segments deep");
33069
33189
  var legacy = desktopExtensionManifestSchema.shape;
33070
33190
  var localized = (max, min = 0) => external_exports.strictObject({
33071
33191
  en: external_exports.string().trim().min(min).max(max),
33072
33192
  "zh-CN": external_exports.string().trim().min(min).max(max)
33073
33193
  });
33074
- var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path6) => path6.endsWith(suffix), `Expected a ${suffix} file`);
33194
+ var resourceWithSuffix = (suffix) => hostExtensionResourcePathSchema.refine((path7) => path7.endsWith(suffix), `Expected a ${suffix} file`);
33075
33195
  var moduleEntry = resourceWithSuffix(".mjs");
33076
33196
  var style = resourceWithSuffix(".css").optional();
33077
- var hostExtensionCanonicalPath = (path6) => path6.normalize("NFC").toLowerCase();
33078
- function hostExtensionStaticAssetMimeType(path6) {
33079
- switch (/\.([^./]+)$/u.exec(path6)?.[1]?.toLowerCase()) {
33197
+ var hostExtensionCanonicalPath = (path7) => path7.normalize("NFC").toLowerCase();
33198
+ function hostExtensionStaticAssetMimeType(path7) {
33199
+ switch (/\.([^./]+)$/u.exec(path7)?.[1]?.toLowerCase()) {
33080
33200
  case "png":
33081
33201
  return "image/png";
33082
33202
  case "jpg":
@@ -33103,8 +33223,8 @@ var hostExtensionManifestV2Schema = external_exports.strictObject({
33103
33223
  details: localized(16384).optional(),
33104
33224
  author: legacy.author,
33105
33225
  repository: legacy.repository,
33106
- icon: legacy.icon.refine((path6) => path6 === void 0 || hostExtensionResourcePathSchema.safeParse(path6).success),
33107
- screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path6) => hostExtensionResourcePathSchema.safeParse(path6).success)),
33226
+ icon: legacy.icon.refine((path7) => path7 === void 0 || hostExtensionResourcePathSchema.safeParse(path7).success),
33227
+ screenshots: legacy.screenshots.refine((paths) => paths === void 0 || paths.every((path7) => hostExtensionResourcePathSchema.safeParse(path7).success)),
33108
33228
  categories: legacy.categories,
33109
33229
  settingsSchema: legacy.settingsSchema,
33110
33230
  slots: legacy.slots.removeDefault().optional(),
@@ -33168,6 +33288,9 @@ var hostExtensionBackendMethodSchema = desktopExtensionBackendMethodSchema;
33168
33288
  // packages/shared-contracts/dist/thread-tree-watch.js
33169
33289
  var THREAD_TREE_MAX_NODES = 5e3;
33170
33290
  var threadTreeStatusSchema = external_exports.enum(["running", "waiting", "idle", "unknown"]);
33291
+ var threadTreeDelegationSchema = external_exports.object({
33292
+ createdAtMs: external_exports.number().int().nonnegative()
33293
+ });
33171
33294
  var threadTreeHandoffSchema = external_exports.strictObject({
33172
33295
  sourceThreadId: hostThreadIdSchema,
33173
33296
  createdAtMs: external_exports.number().int().nonnegative()
@@ -33179,13 +33302,14 @@ var threadTreeNodeSchema = external_exports.strictObject({
33179
33302
  archived: external_exports.boolean(),
33180
33303
  updatedAtMs: external_exports.number().int().nonnegative().optional()
33181
33304
  });
33182
- var threadTreeSnapshotSchema = external_exports.strictObject({
33305
+ var threadTreeSnapshotSchema = external_exports.object({
33183
33306
  revision: external_exports.int().nonnegative(),
33184
33307
  parents: external_exports.record(hostThreadIdSchema, hostThreadIdSchema),
33308
+ delegations: external_exports.record(hostThreadIdSchema, threadTreeDelegationSchema).optional(),
33185
33309
  handoffs: external_exports.record(hostThreadIdSchema, threadTreeHandoffSchema).optional(),
33186
33310
  nodes: external_exports.record(hostThreadIdSchema, threadTreeNodeSchema),
33187
33311
  truncated: external_exports.boolean()
33188
- }).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, handoffs, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)) && Object.entries(handoffs ?? {}).every(([target2, { sourceThreadId }]) => Object.hasOwn(nodes, target2) && Object.hasOwn(nodes, sourceThreadId)), "Missing Thread tree node");
33312
+ }).refine((snapshot) => Object.keys(snapshot.nodes).length <= THREAD_TREE_MAX_NODES, "Too many Thread tree nodes").refine(({ parents, handoffs, nodes }) => Object.entries(parents).every(([child, parent]) => Object.hasOwn(nodes, child) && Object.hasOwn(nodes, parent)) && Object.entries(handoffs ?? {}).every(([target2, { sourceThreadId }]) => Object.hasOwn(nodes, target2) && Object.hasOwn(nodes, sourceThreadId)), "Missing Thread tree node").refine(({ parents, delegations }) => Object.keys(delegations ?? {}).every((child) => Object.hasOwn(parents, child)), "Delegation metadata requires a matching parent edge");
33189
33313
  var subscriptionId = external_exports.string().min(1).max(128);
33190
33314
  var threadTreeWatchParamsSchema = external_exports.strictObject({});
33191
33315
  var threadTreeUnwatchParamsSchema = external_exports.strictObject({ subscriptionId });
@@ -33256,7 +33380,7 @@ var active = {
33256
33380
  digest: hostExtensionDigestSchema
33257
33381
  };
33258
33382
  var optionalActivation = { ...id, activationId: active.activationId.optional() };
33259
- var filePath = external_exports.string().min(1).max(4096).refine((path6) => /^(?:\/|[a-z]:[/\\])/iu.test(path6) && !path6.includes("\0") && !path6.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
33383
+ var filePath = external_exports.string().min(1).max(4096).refine((path7) => /^(?:\/|[a-z]:[/\\])/iu.test(path7) && !path7.includes("\0") && !path7.split(/[/\\]/u).some((part) => part === "." || part === ".."), "Expected an absolute local path without dot segments");
33260
33384
  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");
33261
33385
  function base643(maxBytes) {
33262
33386
  return external_exports.string().max(4 * Math.ceil(maxBytes / 3)).refine((value) => {
@@ -33332,6 +33456,7 @@ var HOST_EXTENSIONS_RPC = {
33332
33456
  snapshot: "codexhost/extensions/snapshot",
33333
33457
  catalog: "codexhost/extensions/catalog",
33334
33458
  catalogIcon: "codexhost/extensions/catalogIcon",
33459
+ catalogScreenshot: "codexhost/extensions/catalogScreenshot",
33335
33460
  install: "codexhost/extensions/install",
33336
33461
  update: "codexhost/extensions/update",
33337
33462
  enable: "codexhost/extensions/enable",
@@ -33368,6 +33493,11 @@ var hostExtensionsCatalogIconResultSchema = external_exports.strictObject({
33368
33493
  mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
33369
33494
  base64: base643(DESKTOP_EXTENSION_ICON_MAX_BYTES)
33370
33495
  });
33496
+ var hostExtensionCatalogScreenshotIndexSchema = external_exports.int().min(0).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT - 1);
33497
+ var hostExtensionsCatalogScreenshotResultSchema = external_exports.strictObject({
33498
+ mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
33499
+ base64: base643(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)
33500
+ });
33371
33501
  var hostExtensionSettingsSchema = external_exports.strictObject({
33372
33502
  settingsRevision: hostExtensionRevisionSchema,
33373
33503
  values: jsonObjectSchema
@@ -33386,6 +33516,10 @@ var hostExtensionsRpcSchemas = {
33386
33516
  params: external_exports.strictObject({ ...id }),
33387
33517
  result: hostExtensionsCatalogIconResultSchema
33388
33518
  },
33519
+ [HOST_EXTENSIONS_RPC.catalogScreenshot]: {
33520
+ params: external_exports.strictObject({ ...id, index: hostExtensionCatalogScreenshotIndexSchema }),
33521
+ result: hostExtensionsCatalogScreenshotResultSchema
33522
+ },
33389
33523
  [HOST_EXTENSIONS_RPC.install]: {
33390
33524
  params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
33391
33525
  result: installationResult
@@ -33443,6 +33577,206 @@ var hostExtensionsRpcSchemas = {
33443
33577
  }
33444
33578
  };
33445
33579
 
33580
+ // packages/shared-contracts/dist/group-chat.js
33581
+ var DEFAULT_GROUP_MAX_AGENT_HOPS = 5;
33582
+ var MAX_GROUP_AGENT_HOPS = 20;
33583
+ var remoteGroupRoomIdSchema = external_exports.string().regex(/^remote:[A-Za-z0-9_-]{8,512}$/u);
33584
+ var groupRoomIdSchema = external_exports.union([external_exports.uuidv4(), remoteGroupRoomIdSchema]);
33585
+ var groupMemberIdSchema = external_exports.uuidv4();
33586
+ var groupMemberHandleSchema = external_exports.string().regex(/^[a-z0-9][a-z0-9_-]{0,47}$/u);
33587
+ var groupUnmentionedPolicySchema = external_exports.enum(["none", "last_speaker", "all"]);
33588
+ var groupMemberStatusSchema = external_exports.enum(["active", "muted", "removed"]);
33589
+ var nonnegativeInteger = external_exports.int().nonnegative();
33590
+ var positiveInteger = external_exports.int().positive();
33591
+ var maxAgentHopsSchema = positiveInteger.max(MAX_GROUP_AGENT_HOPS);
33592
+ var nonblankString = external_exports.string().refine((value) => value.trim().length > 0);
33593
+ var timestamp = external_exports.iso.datetime();
33594
+ var optionalMemberEdits = {
33595
+ handle: groupMemberHandleSchema.optional(),
33596
+ displayName: nonblankString.optional(),
33597
+ note: external_exports.string().optional()
33598
+ };
33599
+ var groupMemberSchema = external_exports.object({
33600
+ memberId: groupMemberIdSchema,
33601
+ threadId: hostThreadIdSchema,
33602
+ handle: groupMemberHandleSchema,
33603
+ displayName: nonblankString,
33604
+ note: external_exports.string().optional(),
33605
+ roleSlug: roleSlugSchema.optional(),
33606
+ roleSnapshot: threadRoleSnapshotSchema.optional(),
33607
+ harnessId: harnessIdSchema,
33608
+ status: groupMemberStatusSchema,
33609
+ joinedAtSeq: nonnegativeInteger,
33610
+ lastDeliveredSeq: nonnegativeInteger,
33611
+ lastRosterVersion: nonnegativeInteger,
33612
+ createdAt: timestamp
33613
+ });
33614
+ var groupRoomRemoteHostSchema = external_exports.object({
33615
+ hostId: nonblankString,
33616
+ displayName: nonblankString,
33617
+ state: nonblankString.optional(),
33618
+ color: external_exports.string().optional(),
33619
+ filePreview: external_exports.boolean().optional()
33620
+ });
33621
+ var groupRoomSchema = external_exports.object({
33622
+ roomId: groupRoomIdSchema,
33623
+ title: nonblankString,
33624
+ defaultCwd: nonblankString,
33625
+ unmentionedPolicy: groupUnmentionedPolicySchema.default("none"),
33626
+ allowAgentMentions: external_exports.boolean().default(true),
33627
+ maxAgentHops: maxAgentHopsSchema.default(DEFAULT_GROUP_MAX_AGENT_HOPS),
33628
+ lastSeq: nonnegativeInteger,
33629
+ lastSpeakerMemberId: groupMemberIdSchema.optional(),
33630
+ rosterVersion: nonnegativeInteger,
33631
+ humanEpoch: nonnegativeInteger,
33632
+ relayPaused: external_exports.boolean(),
33633
+ pinned: external_exports.boolean(),
33634
+ createdAt: timestamp,
33635
+ updatedAt: timestamp,
33636
+ members: external_exports.array(groupMemberSchema),
33637
+ remote: groupRoomRemoteHostSchema.optional()
33638
+ }).superRefine(({ members: members2 }, context) => {
33639
+ const handles = /* @__PURE__ */ new Set();
33640
+ for (const [index, { handle, status }] of members2.entries()) {
33641
+ if (status === "removed")
33642
+ continue;
33643
+ if (handles.has(handle)) {
33644
+ context.addIssue({
33645
+ code: "custom",
33646
+ path: ["members", index, "handle"],
33647
+ message: "Handle must be unique among non-removed members"
33648
+ });
33649
+ }
33650
+ handles.add(handle);
33651
+ }
33652
+ });
33653
+ var groupAttachmentSchema = external_exports.object({
33654
+ kind: external_exports.enum(["image", "file"]),
33655
+ attachmentId: nonblankString.max(256),
33656
+ name: nonblankString.max(256),
33657
+ path: nonblankString.max(4096),
33658
+ bytes: nonnegativeInteger,
33659
+ mediaType: nonblankString.max(128).optional(),
33660
+ width: positiveInteger.optional(),
33661
+ height: positiveInteger.optional()
33662
+ });
33663
+ var groupMessageSchema = external_exports.object({
33664
+ roomId: groupRoomIdSchema,
33665
+ seq: positiveInteger,
33666
+ messageId: nonblankString,
33667
+ senderType: external_exports.enum(["user", "agent", "system"]),
33668
+ senderMemberId: groupMemberIdSchema.optional(),
33669
+ senderHandle: groupMemberHandleSchema.optional(),
33670
+ senderName: external_exports.string().optional(),
33671
+ senderThreadId: hostThreadIdSchema.optional(),
33672
+ sourceTurnId: nonblankString.optional(),
33673
+ replyToSeq: positiveInteger.optional(),
33674
+ content: external_exports.string(),
33675
+ attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
33676
+ mentionedMemberIds: external_exports.array(groupMemberIdSchema),
33677
+ mentionAll: external_exports.boolean().optional(),
33678
+ hopCount: nonnegativeInteger,
33679
+ createdAt: timestamp
33680
+ });
33681
+ var newThreadOptions = {
33682
+ ...optionalMemberEdits,
33683
+ model: roleModelSchema.optional(),
33684
+ thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
33685
+ worktree: external_exports.boolean().optional()
33686
+ };
33687
+ var groupCreateMemberInputSchema = external_exports.discriminatedUnion("kind", [
33688
+ external_exports.strictObject({ kind: external_exports.literal("role"), roleSlug: roleSlugSchema, ...newThreadOptions }),
33689
+ external_exports.strictObject({ kind: external_exports.literal("harness"), harnessId: harnessIdSchema, ...newThreadOptions }),
33690
+ external_exports.strictObject({
33691
+ kind: external_exports.literal("existing"),
33692
+ threadId: hostThreadIdSchema,
33693
+ ...optionalMemberEdits,
33694
+ includeRecentHistory: external_exports.boolean().default(true).optional()
33695
+ })
33696
+ ]);
33697
+ var GROUPS_LIST_METHOD = "codexhost/groups/list";
33698
+ var GROUPS_GET_METHOD = "codexhost/groups/get";
33699
+ var GROUPS_CREATE_METHOD = "codexhost/groups/create";
33700
+ var GROUPS_UPDATE_METHOD = "codexhost/groups/update";
33701
+ var GROUPS_DELETE_METHOD = "codexhost/groups/delete";
33702
+ var GROUPS_ADD_MEMBER_METHOD = "codexhost/groups/member/add";
33703
+ var GROUPS_UPDATE_MEMBER_METHOD = "codexhost/groups/member/update";
33704
+ var GROUPS_REMOVE_MEMBER_METHOD = "codexhost/groups/member/remove";
33705
+ var GROUPS_POST_MESSAGE_METHOD = "codexhost/groups/message/post";
33706
+ var GROUPS_READ_MESSAGES_METHOD = "codexhost/groups/messages/read";
33707
+ var roomIdentity = { roomId: groupRoomIdSchema };
33708
+ var memberIdentity = { ...roomIdentity, memberId: groupMemberIdSchema };
33709
+ var roomEdits = {
33710
+ title: nonblankString.optional(),
33711
+ unmentionedPolicy: groupUnmentionedPolicySchema.optional(),
33712
+ allowAgentMentions: external_exports.boolean().optional(),
33713
+ maxAgentHops: maxAgentHopsSchema.optional()
33714
+ };
33715
+ var groupsListParamsSchema = external_exports.strictObject({});
33716
+ var groupsListResultSchema = external_exports.object({ rooms: external_exports.array(groupRoomSchema) });
33717
+ var groupsGetParamsSchema = external_exports.strictObject({
33718
+ ...roomIdentity,
33719
+ limit: positiveInteger.optional(),
33720
+ beforeSeq: positiveInteger.optional()
33721
+ });
33722
+ var groupsGetResultSchema = external_exports.object({
33723
+ room: groupRoomSchema.nullable(),
33724
+ messages: external_exports.array(groupMessageSchema),
33725
+ hasMore: external_exports.boolean()
33726
+ });
33727
+ var groupsCreateParamsSchema = external_exports.strictObject({
33728
+ ...roomEdits,
33729
+ defaultCwd: nonblankString,
33730
+ members: external_exports.array(groupCreateMemberInputSchema)
33731
+ });
33732
+ var groupsCreateResultSchema = external_exports.object({ room: groupRoomSchema });
33733
+ var groupsUpdateParamsSchema = external_exports.strictObject({
33734
+ ...roomIdentity,
33735
+ ...roomEdits,
33736
+ pinned: external_exports.boolean().optional(),
33737
+ relayPaused: external_exports.boolean().optional()
33738
+ });
33739
+ var groupsDeleteParamsSchema = external_exports.strictObject(roomIdentity);
33740
+ var groupsDeleteResultSchema = external_exports.object({ deleted: external_exports.boolean() });
33741
+ var groupsAddMemberParamsSchema = external_exports.strictObject({
33742
+ ...roomIdentity,
33743
+ member: groupCreateMemberInputSchema
33744
+ });
33745
+ var groupsAddMemberResultSchema = external_exports.object({
33746
+ room: groupRoomSchema,
33747
+ member: groupMemberSchema
33748
+ });
33749
+ var groupsUpdateMemberParamsSchema = external_exports.strictObject({
33750
+ ...memberIdentity,
33751
+ ...optionalMemberEdits,
33752
+ status: groupMemberStatusSchema.optional()
33753
+ });
33754
+ var groupsRemoveMemberParamsSchema = external_exports.strictObject(memberIdentity);
33755
+ var groupsPostMessageParamsSchema = external_exports.strictObject({
33756
+ ...roomIdentity,
33757
+ content: external_exports.string().max(64e3),
33758
+ attachments: external_exports.array(groupAttachmentSchema).max(12).optional(),
33759
+ replyToSeq: positiveInteger.optional(),
33760
+ targetMemberIds: external_exports.array(groupMemberIdSchema).optional(),
33761
+ mentionAll: external_exports.boolean().optional()
33762
+ }).refine((value) => value.content.trim().length > 0 || (value.attachments?.length ?? 0) > 0, "Message content or at least one attachment is required");
33763
+ var groupsPostMessageResultSchema = external_exports.object({
33764
+ room: groupRoomSchema,
33765
+ message: groupMessageSchema,
33766
+ awakenedMemberIds: external_exports.array(groupMemberIdSchema)
33767
+ });
33768
+ var groupsReadMessagesParamsSchema = external_exports.strictObject({
33769
+ ...roomIdentity,
33770
+ fromSeq: positiveInteger.optional(),
33771
+ toSeq: positiveInteger.optional(),
33772
+ limit: positiveInteger.optional()
33773
+ });
33774
+ var groupsReadMessagesResultSchema = external_exports.object({
33775
+ ...roomIdentity,
33776
+ messages: external_exports.array(groupMessageSchema),
33777
+ totalSeq: nonnegativeInteger
33778
+ });
33779
+
33446
33780
  // packages/shared-contracts/dist/thread-archive-confirm.js
33447
33781
  var THREAD_ARCHIVE_CONFIRM_METHOD = "codexhost/thread/archive/confirm";
33448
33782
  var threadArchiveConfirmParamsSchema = external_exports.object({ threadId: hostThreadIdSchema }).strict();
@@ -33613,6 +33947,22 @@ var clientThreadSectionMutationResultSchema = external_exports.discriminatedUnio
33613
33947
  ]);
33614
33948
  var CLIENT_CHANNEL_METHODS = [
33615
33949
  "codexhost/skills/list",
33950
+ ROLES_LIST_METHOD,
33951
+ ROLES_GET_METHOD,
33952
+ ROLES_SAVE_METHOD,
33953
+ ROLES_DELETE_METHOD,
33954
+ ROLES_CATALOG_METHOD,
33955
+ ROLES_LIKE_METHOD,
33956
+ GROUPS_LIST_METHOD,
33957
+ GROUPS_GET_METHOD,
33958
+ GROUPS_CREATE_METHOD,
33959
+ GROUPS_UPDATE_METHOD,
33960
+ GROUPS_DELETE_METHOD,
33961
+ GROUPS_ADD_MEMBER_METHOD,
33962
+ GROUPS_UPDATE_MEMBER_METHOD,
33963
+ GROUPS_REMOVE_MEMBER_METHOD,
33964
+ GROUPS_POST_MESSAGE_METHOD,
33965
+ GROUPS_READ_MESSAGES_METHOD,
33616
33966
  "codexhost/voice/status",
33617
33967
  "codexhost/voice/transcribe",
33618
33968
  "codexhost/harness/display-settings/get",
@@ -33774,6 +34124,11 @@ var clientChannelEventSchema = external_exports.discriminatedUnion("type", [
33774
34124
  }),
33775
34125
  external_exports.object({ type: external_exports.literal("display-settings-changed"), cursor: clientChannelCursorSchema }),
33776
34126
  external_exports.object({ type: external_exports.literal("sections-changed"), cursor: clientChannelCursorSchema }),
34127
+ external_exports.object({
34128
+ type: external_exports.literal("groups-changed"),
34129
+ cursor: clientChannelCursorSchema,
34130
+ roomId: external_exports.string().optional()
34131
+ }),
33777
34132
  external_exports.object({
33778
34133
  type: external_exports.literal("preferences-changed"),
33779
34134
  cursor: clientChannelCursorSchema,
@@ -33907,6 +34262,7 @@ var clientThreadSnapshotSchema = external_exports.object({
33907
34262
  status: external_exports.object({ type: external_exports.string() }).passthrough(),
33908
34263
  name: external_exports.string().nullable().optional(),
33909
34264
  preview: external_exports.string().optional(),
34265
+ roleSnapshot: threadRoleSnapshotSchema.optional(),
33910
34266
  codexhostImportSource: clientThreadImportSourceSchema.optional(),
33911
34267
  turns: external_exports.array(clientTurnSchema).length(0)
33912
34268
  }).passthrough(),
@@ -34935,6 +35291,10 @@ var webToolOutputPreviewSchema = external_exports.object({
34935
35291
  bytes: external_exports.number().int().nonnegative()
34936
35292
  });
34937
35293
 
35294
+ // packages/shared-contracts/dist/desktop-shell.js
35295
+ var desktopShellOpenParamsSchema = external_exports.strictObject({});
35296
+ var desktopShellOpenResultSchema = external_exports.strictObject({});
35297
+
34938
35298
  // packages/shared-contracts/dist/console.js
34939
35299
  var consoleAnnouncementSchema = external_exports.strictObject({
34940
35300
  title: external_exports.string().trim().min(1).max(200),
@@ -36111,13 +36471,13 @@ function committedReactAncestors(value) {
36111
36471
  const current2 = fiber(rootState.current);
36112
36472
  if (!current2) return [];
36113
36473
  const alternate = fiber(first.alternate);
36114
- const path6 = [current2];
36474
+ const path7 = [current2];
36115
36475
  seen.clear();
36116
36476
  seen.add(current2);
36117
36477
  for (let index = previous.length - 2; index >= 0; index -= 1) {
36118
36478
  const expected = previous[index];
36119
36479
  const expectedAlternate = fiber(expected?.alternate);
36120
- let child = fiber(path6.at(-1)?.child);
36480
+ let child = fiber(path7.at(-1)?.child);
36121
36481
  let matched = false;
36122
36482
  while (child && !seen.has(child) && seen.size < MAX_VISITED_FIBERS) {
36123
36483
  seen.add(child);
@@ -36128,10 +36488,10 @@ function committedReactAncestors(value) {
36128
36488
  child = fiber(child.sibling);
36129
36489
  }
36130
36490
  if (!matched || !child) break;
36131
- path6.push(child);
36491
+ path7.push(child);
36132
36492
  }
36133
- if (path6.length === previous.length && (path6.at(-1) === first || path6.at(-1) === alternate)) {
36134
- return path6.reverse();
36493
+ if (path7.length === previous.length && (path7.at(-1) === first || path7.at(-1) === alternate)) {
36494
+ return path7.reverse();
36135
36495
  }
36136
36496
  const stack = [{ node: current2, parent: null }];
36137
36497
  seen.clear();
@@ -37313,25 +37673,25 @@ function installRendererHostRpcRouting(root, target2, dependencies) {
37313
37673
  const expression = message[1];
37314
37674
  if (!Array.isArray(expression) || expression.length !== 4 || expression[0] !== "pipeline")
37315
37675
  return message;
37316
- const [, importId, path6, args] = expression;
37317
- if (!Array.isArray(path6) || path6.length !== 1 || !Array.isArray(args)) return message;
37676
+ const [, importId, path7, args] = expression;
37677
+ if (!Array.isArray(path7) || path7.length !== 1 || !Array.isArray(args)) return message;
37318
37678
  const [input3, options] = args;
37319
37679
  if (!isRecord3(input3) || !isRecord3(input3.collaborationMode)) return message;
37320
37680
  const settings = input3.collaborationMode.settings;
37321
37681
  if (!isRecord3(settings)) return message;
37322
37682
  const nativeModel = typeof settings.model === "string" ? settings.model : null;
37323
37683
  let model2 = null;
37324
- if (path6[0] === "startConversation") {
37684
+ if (path7[0] === "startConversation") {
37325
37685
  const draftId = isRecord3(options) ? options.clientThreadId : null;
37326
37686
  model2 = typeof draftId === "string" ? externalDrafts.get(draftId)?.model ?? null : null;
37327
- } else if (path6[0] === "prewarmConversation") {
37687
+ } else if (path7[0] === "prewarmConversation") {
37328
37688
  if (input3.ephemeral !== true) publishDraftWorkspace("local", input3.cwd);
37329
37689
  const selected = selectedModels.get("local") ?? null;
37330
37690
  const carrier = nativeModel?.startsWith("codexhost/") ? nativeModel : selected;
37331
37691
  model2 = carrier ? prewarmCarrier(carrier) : null;
37332
37692
  }
37333
37693
  if (!model2) return message;
37334
- if (path6[0] === "startConversation" && nativeModel?.startsWith("codexhost/"))
37694
+ if (path7[0] === "startConversation" && nativeModel?.startsWith("codexhost/"))
37335
37695
  model2 = nativeModel;
37336
37696
  const config2 = input3.config == null ? { model: model2 } : isRecord3(input3.config) ? { model: model2, ...input3.config } : input3.config;
37337
37697
  return [
@@ -37339,11 +37699,11 @@ function installRendererHostRpcRouting(root, target2, dependencies) {
37339
37699
  [
37340
37700
  "pipeline",
37341
37701
  importId,
37342
- path6,
37702
+ path7,
37343
37703
  [
37344
37704
  {
37345
37705
  ...input3,
37346
- ...path6[0] === "startConversation" ? { config: config2 } : {},
37706
+ ...path7[0] === "startConversation" ? { config: config2 } : {},
37347
37707
  collaborationMode: { ...input3.collaborationMode, settings: { ...settings, model: model2 } }
37348
37708
  },
37349
37709
  ...args.slice(1)
@@ -38615,8 +38975,8 @@ async function installRendererRpcSteeringDirect(client, now = Date.now) {
38615
38975
  return true;
38616
38976
  } catch (error62) {
38617
38977
  const attempts = (retry?.attempts ?? 0) + 1;
38618
- const delay = Math.min(RETRY_BASE_MS * 2 ** (attempts - 1), RETRY_MAX_MS);
38619
- retries.set(client, { attempts, nextAt: now() + delay });
38978
+ const delay3 = Math.min(RETRY_BASE_MS * 2 ** (attempts - 1), RETRY_MAX_MS);
38979
+ retries.set(client, { attempts, nextAt: now() + delay3 });
38620
38980
  console.error(
38621
38981
  `codexhost native steering discovery failed (attempt ${attempts}):`,
38622
38982
  error62 instanceof Error ? error62.message : String(error62)
@@ -39047,8 +39407,8 @@ function installRendererCdpControlSession(options) {
39047
39407
  // packages/desktop-control/src/renderer-desktop-extensions.ts
39048
39408
  import { createHash as createHash3, randomUUID as randomUUID2 } from "node:crypto";
39049
39409
  import { watch } from "node:fs";
39050
- import { mkdir as mkdir4, rename as rename2, rm as rm4, writeFile as writeFile4 } from "node:fs/promises";
39051
- import path4 from "node:path";
39410
+ import { mkdir as mkdir5, rename as rename3, rm as rm4, writeFile as writeFile5 } from "node:fs/promises";
39411
+ import path5 from "node:path";
39052
39412
  import { Script as Script2 } from "node:vm";
39053
39413
 
39054
39414
  // packages/harness-plugin-files/dist/host-extension-io.js
@@ -39056,6 +39416,27 @@ var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
39056
39416
  import { constants } from "node:fs";
39057
39417
  import { lstat, mkdir as mkdir2, open as open2, realpath, rm as rm2, writeFile as writeFile2 } from "node:fs/promises";
39058
39418
  import path2 from "node:path";
39419
+
39420
+ // packages/harness-plugin-files/dist/rename-with-windows-retry.js
39421
+ import { rename as rename2 } from "node:fs/promises";
39422
+ import { setTimeout as delay } from "node:timers/promises";
39423
+ var WINDOWS_RENAME_DELAYS_MS = [10, 30, 70, 150, 300];
39424
+ async function renameWithWindowsRetry(temporary, destination) {
39425
+ for (let attempt = 0; ; attempt++) {
39426
+ try {
39427
+ await rename2(temporary, destination);
39428
+ return;
39429
+ } catch (error62) {
39430
+ const wait = WINDOWS_RENAME_DELAYS_MS[attempt];
39431
+ const code = error62.code;
39432
+ if (process.platform !== "win32" || wait === void 0 || !["EPERM", "EACCES", "EBUSY"].includes(code ?? ""))
39433
+ throw error62;
39434
+ await delay(wait);
39435
+ }
39436
+ }
39437
+ }
39438
+
39439
+ // packages/harness-plugin-files/dist/host-extension-io.js
39059
39440
  function desktopExtensionsStatusPath(dataDirectory) {
39060
39441
  return path2.join(dataDirectory, "diagnostics", "desktop-extensions-v1.json");
39061
39442
  }
@@ -39146,6 +39527,142 @@ var jpegSignature = Buffer.from([255, 216, 255]);
39146
39527
  var riffSignature = Buffer.from("RIFF");
39147
39528
  var webpSignature = Buffer.from("WEBP");
39148
39529
 
39530
+ // packages/harness-plugin-files/dist/desktop-extension-download.js
39531
+ import { setTimeout as delay2 } from "node:timers/promises";
39532
+ var githubHeaders = {
39533
+ accept: "application/vnd.github+json",
39534
+ "user-agent": "codexhost-desktop-extensions"
39535
+ };
39536
+ var DEFAULT_TIMEOUT_MS = 12e3;
39537
+ var DEFAULT_RETRY_BASE_DELAY_MS = 400;
39538
+ var RETRYABLE_HTTP_STATUSES = /* @__PURE__ */ new Set([408, 429, 500, 502, 503, 504]);
39539
+ var ExtensionDownloadError = class extends Error {
39540
+ };
39541
+ var ExtensionHttpError = class extends ExtensionDownloadError {
39542
+ status;
39543
+ constructor(status) {
39544
+ super(`Download returned HTTP ${status}`);
39545
+ this.status = status;
39546
+ }
39547
+ };
39548
+ function isRetryableDownloadError(error62) {
39549
+ if (error62 instanceof ExtensionHttpError)
39550
+ return RETRYABLE_HTTP_STATUSES.has(error62.status);
39551
+ return !(error62 instanceof ExtensionDownloadError);
39552
+ }
39553
+ async function downloadExtensionBytes(url2, limit, headers, { signal: callerSignal, allowUrl, allowContentType, timeoutMs = DEFAULT_TIMEOUT_MS, idleTimeoutMs, retries: retries2 = 0, retryBaseDelayMs = DEFAULT_RETRY_BASE_DELAY_MS }) {
39554
+ const parsed = desktopExtensionHttpUrlSchema.safeParse(url2);
39555
+ if (!parsed.success)
39556
+ throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
39557
+ const initialTarget = new URL(parsed.data);
39558
+ const requestHeaders = headers ?? (isGitHubDesktopExtensionZipballUrl(initialTarget) ? githubHeaders : void 0);
39559
+ const effectiveIdleMs = Math.min(idleTimeoutMs ?? timeoutMs, timeoutMs);
39560
+ const totalTimeout = AbortSignal.timeout(timeoutMs);
39561
+ const overallSignal = callerSignal ? AbortSignal.any([totalTimeout, callerSignal]) : totalTimeout;
39562
+ for (let attempt = 0; ; attempt++) {
39563
+ if (callerSignal?.aborted)
39564
+ throw new ExtensionDownloadError("Download aborted", { cause: callerSignal.reason });
39565
+ if (totalTimeout.aborted)
39566
+ throw new ExtensionDownloadError("Download timed out", { cause: totalTimeout.reason });
39567
+ const attemptController = new AbortController();
39568
+ const signal = AbortSignal.any([overallSignal, attemptController.signal]);
39569
+ let idleTimedOut = false;
39570
+ let idleTimer;
39571
+ const resetIdle = () => {
39572
+ if (idleTimer !== void 0)
39573
+ clearTimeout(idleTimer);
39574
+ idleTimer = setTimeout(() => {
39575
+ idleTimedOut = true;
39576
+ attemptController.abort(new Error("Download timed out"));
39577
+ }, effectiveIdleMs);
39578
+ };
39579
+ const clearIdle = () => {
39580
+ if (idleTimer !== void 0) {
39581
+ clearTimeout(idleTimer);
39582
+ idleTimer = void 0;
39583
+ }
39584
+ };
39585
+ try {
39586
+ let target2 = new URL(initialTarget.href);
39587
+ let response;
39588
+ for (let redirects = 0; ; redirects++) {
39589
+ if (!allowUrl(target2) || target2.username || target2.password)
39590
+ throw new ExtensionDownloadError("Unsafe download URL");
39591
+ resetIdle();
39592
+ response = await fetch(target2.href, {
39593
+ signal,
39594
+ redirect: "manual",
39595
+ ...requestHeaders ? { headers: requestHeaders } : {}
39596
+ });
39597
+ const location = response.headers.get("location");
39598
+ if (!location || ![301, 302, 303, 307, 308].includes(response.status))
39599
+ break;
39600
+ await response.body?.cancel().catch(() => void 0);
39601
+ if (redirects >= 4)
39602
+ throw new ExtensionDownloadError("Too many download redirects");
39603
+ try {
39604
+ target2 = new URL(location, target2);
39605
+ } catch {
39606
+ throw new ExtensionDownloadError("Invalid download redirect URL");
39607
+ }
39608
+ }
39609
+ const body = response.body;
39610
+ if (!response.ok || !body || Number(response.headers.get("content-length")) > limit) {
39611
+ await body?.cancel().catch(() => void 0);
39612
+ if (!response.ok)
39613
+ throw new ExtensionHttpError(response.status);
39614
+ throw new ExtensionDownloadError("Download is empty or exceeds the size limit");
39615
+ }
39616
+ if (allowContentType && !allowContentType(response.headers.get("content-type"))) {
39617
+ await body.cancel().catch(() => void 0);
39618
+ throw new ExtensionDownloadError("Unsupported download content type");
39619
+ }
39620
+ const reader = body.getReader();
39621
+ const chunks = [];
39622
+ let size = 0;
39623
+ try {
39624
+ for (; ; ) {
39625
+ resetIdle();
39626
+ const { done, value } = await reader.read();
39627
+ if (done)
39628
+ break;
39629
+ size += value.byteLength;
39630
+ if (size > limit)
39631
+ throw new ExtensionDownloadError("Download exceeds the size limit");
39632
+ chunks.push(value);
39633
+ }
39634
+ } finally {
39635
+ clearIdle();
39636
+ await reader.cancel().catch(() => void 0);
39637
+ }
39638
+ return Buffer.concat(chunks, size);
39639
+ } catch (error62) {
39640
+ clearIdle();
39641
+ if (callerSignal?.aborted)
39642
+ throw new ExtensionDownloadError("Download aborted", { cause: callerSignal.reason });
39643
+ if (totalTimeout.aborted)
39644
+ throw new ExtensionDownloadError("Download timed out", { cause: totalTimeout.reason });
39645
+ if (attempt < retries2 && isRetryableDownloadError(error62)) {
39646
+ const waitMs = retryBaseDelayMs * 2 ** attempt;
39647
+ try {
39648
+ if (waitMs > 0)
39649
+ await delay2(waitMs, void 0, { signal: overallSignal });
39650
+ } catch (delayError) {
39651
+ if (callerSignal?.aborted)
39652
+ throw new ExtensionDownloadError("Download aborted", { cause: callerSignal.reason });
39653
+ throw new ExtensionDownloadError("Download timed out", { cause: delayError });
39654
+ }
39655
+ continue;
39656
+ }
39657
+ if (error62 instanceof ExtensionDownloadError)
39658
+ throw error62;
39659
+ throw new ExtensionDownloadError(idleTimedOut ? "Download timed out" : "Download failed", {
39660
+ cause: error62
39661
+ });
39662
+ }
39663
+ }
39664
+ }
39665
+
39149
39666
  // packages/harness-plugin-files/dist/host-extension-package.js
39150
39667
  import { createHash as createHash2 } from "node:crypto";
39151
39668
  import path3 from "node:path";
@@ -39382,6 +39899,11 @@ async function readHostExtensionAsset({ dataDir, id: id3, path: resource, ...exp
39382
39899
  // packages/harness-plugin-files/dist/host-extension-default-seeds.js
39383
39900
  var MAX_DEFAULT_SEEDS_BYTES = 32 * 1024;
39384
39901
 
39902
+ // packages/harness-plugin-files/dist/host-extension-sources.js
39903
+ import { lstat as lstat2, mkdir as mkdir4, readFile, realpath as realpath2, stat, unlink, writeFile as writeFile4 } from "node:fs/promises";
39904
+ import { isIP } from "node:net";
39905
+ import path4 from "node:path";
39906
+
39385
39907
  // packages/harness-plugin-files/dist/extension-zip.js
39386
39908
  import { promisify } from "node:util";
39387
39909
  import { crc32, inflateRaw, inflateRawSync } from "node:zlib";
@@ -39394,11 +39916,222 @@ var inflate = promisify(inflateRaw);
39394
39916
  var TTL = 5 * 60 * 1e3;
39395
39917
  var STALE_FALLBACK_MAX_AGE_MS = 30 * 60 * 1e3;
39396
39918
  var DISK_CATALOG_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
39919
+ var ICON_TIMEOUT_MS = 12e3;
39920
+ var ICON_RETRIES = 1;
39921
+ var ICON_MEMORY_LIMIT = 200;
39922
+ var SCREENSHOT_TIMEOUT_MS = 15e3;
39923
+ var SCREENSHOT_RETRIES = 1;
39924
+ var SCREENSHOT_MEMORY_LIMIT = 64;
39925
+ var IMAGE_FAIL_BACKOFF_MS = 6e4;
39397
39926
  var STATS_MAX_BYTES = 256 * 1024;
39927
+ var httpsDownload = (url2) => url2.protocol === "https:" && !url2.username && !url2.password;
39928
+ function isPrivateOrLoopbackIPv4(a2, b2) {
39929
+ return a2 === 0 || a2 === 10 || a2 === 127 || a2 === 169 && b2 === 254 || a2 === 172 && b2 >= 16 && b2 <= 31 || a2 === 192 && b2 === 168;
39930
+ }
39931
+ function parseIPv6Groups(host) {
39932
+ let normalized = host;
39933
+ const lastColon = normalized.lastIndexOf(":");
39934
+ if (lastColon !== -1 && normalized.slice(lastColon + 1).includes(".")) {
39935
+ const ipv4Parts = normalized.slice(lastColon + 1).split(".").map(Number);
39936
+ if (ipv4Parts.length !== 4 || ipv4Parts.some((n2) => !Number.isInteger(n2) || n2 < 0 || n2 > 255))
39937
+ return null;
39938
+ const high = (ipv4Parts[0] << 8 | ipv4Parts[1]).toString(16);
39939
+ const low = (ipv4Parts[2] << 8 | ipv4Parts[3]).toString(16);
39940
+ normalized = `${normalized.slice(0, lastColon + 1)}${high}:${low}`;
39941
+ }
39942
+ const parts = normalized.split("::");
39943
+ if (parts.length > 2)
39944
+ return null;
39945
+ const parseSide = (side) => side ? side.split(":").map((segment) => Number.parseInt(segment, 16)) : [];
39946
+ const left = parseSide(parts[0]);
39947
+ const right = parts.length === 2 ? parseSide(parts[1]) : [];
39948
+ if ([...left, ...right].some((n2) => !Number.isInteger(n2) || n2 < 0 || n2 > 65535))
39949
+ return null;
39950
+ if (parts.length === 1)
39951
+ return left.length === 8 ? left : null;
39952
+ const missing = 8 - left.length - right.length;
39953
+ if (missing < 1)
39954
+ return null;
39955
+ return [...left, ...Array(missing).fill(0), ...right];
39956
+ }
39957
+ function isPrivateOrLoopbackHostname(rawHostname) {
39958
+ const unbracketed = rawHostname.startsWith("[") && rawHostname.endsWith("]") ? rawHostname.slice(1, -1) : rawHostname;
39959
+ const host = unbracketed.toLowerCase().replace(/\.+$/u, "");
39960
+ if (!host || host === "localhost" || host.endsWith(".localhost"))
39961
+ return true;
39962
+ const ipVersion = isIP(host);
39963
+ if (ipVersion === 4) {
39964
+ const octets = host.split(".").map(Number);
39965
+ return octets.length !== 4 || isPrivateOrLoopbackIPv4(octets[0], octets[1]);
39966
+ }
39967
+ if (ipVersion === 6) {
39968
+ const groups = parseIPv6Groups(host);
39969
+ if (!groups)
39970
+ return true;
39971
+ const isZeroPrefix7 = groups.slice(0, 7).every((g2) => g2 === 0);
39972
+ if (isZeroPrefix7 && (groups[7] === 0 || groups[7] === 1))
39973
+ return true;
39974
+ if ((groups[0] & 65024) === 64512)
39975
+ return true;
39976
+ if ((groups[0] & 65472) === 65152)
39977
+ return true;
39978
+ if (groups.slice(0, 5).every((g2) => g2 === 0) && groups[5] === 65535) {
39979
+ return isPrivateOrLoopbackIPv4(groups[6] >> 8, groups[6] & 255);
39980
+ }
39981
+ }
39982
+ return false;
39983
+ }
39984
+ var publicHttpsDownload = (url2) => httpsDownload(url2) && !isPrivateOrLoopbackHostname(url2.hostname);
39398
39985
  var PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
39399
39986
  var JPEG_SIG = Buffer.from([255, 216, 255]);
39400
39987
  var RIFF_SIG = Buffer.from("RIFF");
39401
39988
  var WEBP_SIG = Buffer.from("WEBP");
39989
+ var ALLOWED_CATALOG_IMAGE_CONTENT_TYPES = /* @__PURE__ */ new Set([
39990
+ "image/png",
39991
+ "image/jpeg",
39992
+ "image/webp",
39993
+ "application/octet-stream"
39994
+ ]);
39995
+ function isAllowedCatalogImageContentType(contentType) {
39996
+ if (!contentType)
39997
+ return true;
39998
+ const mediaType = contentType.split(";", 1)[0]?.trim().toLowerCase();
39999
+ return !mediaType || ALLOWED_CATALOG_IMAGE_CONTENT_TYPES.has(mediaType);
40000
+ }
40001
+ function detectRasterMimeType(bytes) {
40002
+ if (bytes.length >= 8 && bytes.subarray(0, 8).equals(PNG_SIG))
40003
+ return "image/png";
40004
+ if (bytes.length >= 3 && bytes.subarray(0, 3).equals(JPEG_SIG))
40005
+ return "image/jpeg";
40006
+ if (bytes.length >= 12 && bytes.subarray(0, 4).equals(RIFF_SIG) && bytes.subarray(8, 12).equals(WEBP_SIG)) {
40007
+ return "image/webp";
40008
+ }
40009
+ return null;
40010
+ }
40011
+ function createCatalogImageCache({ cacheSubdir, maxBytes, memoryLimit, label, timeoutMs, retries: retries2, allowContentType }) {
40012
+ const memoryCache = /* @__PURE__ */ new Map();
40013
+ const pendingDownloads = /* @__PURE__ */ new Map();
40014
+ const retryAt = /* @__PURE__ */ new Map();
40015
+ const remember = (hash2, image2) => {
40016
+ memoryCache.delete(hash2);
40017
+ memoryCache.set(hash2, image2);
40018
+ if (memoryCache.size > memoryLimit) {
40019
+ const oldest = memoryCache.keys().next().value;
40020
+ if (oldest !== void 0)
40021
+ memoryCache.delete(oldest);
40022
+ }
40023
+ return image2;
40024
+ };
40025
+ return async function fetchCachedImage({ dataDir, url: url2, signal }) {
40026
+ const parsedUrl = desktopExtensionHttpUrlSchema.safeParse(url2);
40027
+ if (!parsedUrl.success) {
40028
+ throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
40029
+ }
40030
+ const targetUrl = new URL(parsedUrl.data);
40031
+ if (!httpsDownload(targetUrl)) {
40032
+ throw new ExtensionDownloadError(`Catalog ${label} must use HTTPS`);
40033
+ }
40034
+ if (isPrivateOrLoopbackHostname(targetUrl.hostname)) {
40035
+ throw new ExtensionDownloadError("Unsafe download URL");
40036
+ }
40037
+ const hash2 = sha256(Buffer.from(targetUrl.href, "utf8"));
40038
+ const memoryHit = memoryCache.get(hash2);
40039
+ if (memoryHit) {
40040
+ return remember(hash2, memoryHit);
40041
+ }
40042
+ const diskFile = path4.join(dataDir, "cache", cacheSubdir, `${hash2}.img`);
40043
+ const diskInfo = await stat(diskFile).catch(() => void 0);
40044
+ if (diskInfo?.isFile() && diskInfo.size > 0 && diskInfo.size <= maxBytes) {
40045
+ const diskBytes = await readFile(diskFile).catch(() => void 0);
40046
+ if (diskBytes && diskBytes.length <= maxBytes) {
40047
+ const mimeType = detectRasterMimeType(diskBytes);
40048
+ if (mimeType) {
40049
+ return remember(hash2, { mimeType, bytes: diskBytes });
40050
+ }
40051
+ }
40052
+ }
40053
+ const retryUntil = retryAt.get(hash2);
40054
+ if (retryUntil !== void 0 && Date.now() < retryUntil) {
40055
+ throw new ExtensionDownloadError(`Catalog ${label} temporarily unavailable`);
40056
+ }
40057
+ let flight = pendingDownloads.get(hash2);
40058
+ if (!flight) {
40059
+ const created = (async () => {
40060
+ try {
40061
+ const bytes = await downloadExtensionBytes(targetUrl.href, maxBytes, { accept: "image/webp,image/png,image/jpeg,*/*;q=0.5" }, {
40062
+ allowUrl: publicHttpsDownload,
40063
+ allowContentType,
40064
+ timeoutMs,
40065
+ retries: retries2
40066
+ });
40067
+ const mimeType = detectRasterMimeType(bytes);
40068
+ if (!mimeType) {
40069
+ throw new ExtensionDownloadError(`Unsupported catalog ${label} image signature`);
40070
+ }
40071
+ retryAt.delete(hash2);
40072
+ const entry = remember(hash2, { mimeType, bytes });
40073
+ await atomicWriteFile(diskFile, bytes).catch(() => void 0);
40074
+ return entry;
40075
+ } catch (error62) {
40076
+ retryAt.set(hash2, Date.now() + IMAGE_FAIL_BACKOFF_MS);
40077
+ throw error62;
40078
+ }
40079
+ })().finally(() => {
40080
+ if (pendingDownloads.get(hash2) === created)
40081
+ pendingDownloads.delete(hash2);
40082
+ });
40083
+ created.catch(() => void 0);
40084
+ pendingDownloads.set(hash2, created);
40085
+ flight = created;
40086
+ }
40087
+ return raceWithSignal(flight, signal);
40088
+ };
40089
+ }
40090
+ var fetchCatalogIconImage = createCatalogImageCache({
40091
+ cacheSubdir: "extension-icons",
40092
+ maxBytes: DESKTOP_EXTENSION_ICON_MAX_BYTES,
40093
+ memoryLimit: ICON_MEMORY_LIMIT,
40094
+ label: "icon",
40095
+ timeoutMs: ICON_TIMEOUT_MS,
40096
+ retries: ICON_RETRIES
40097
+ });
40098
+ var fetchCatalogScreenshotImage = createCatalogImageCache({
40099
+ cacheSubdir: "extension-screenshots",
40100
+ maxBytes: DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES,
40101
+ memoryLimit: SCREENSHOT_MEMORY_LIMIT,
40102
+ label: "screenshot",
40103
+ timeoutMs: SCREENSHOT_TIMEOUT_MS,
40104
+ retries: SCREENSHOT_RETRIES,
40105
+ allowContentType: isAllowedCatalogImageContentType
40106
+ });
40107
+ async function atomicWriteFile(filePath2, data) {
40108
+ const dir = path4.dirname(filePath2);
40109
+ const tempPath = `${filePath2}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
40110
+ try {
40111
+ await mkdir4(dir, { recursive: true });
40112
+ await writeFile4(tempPath, data);
40113
+ await renameWithWindowsRetry(tempPath, filePath2);
40114
+ } catch {
40115
+ await unlink(tempPath).catch(() => void 0);
40116
+ }
40117
+ }
40118
+ function raceWithSignal(promise2, signal) {
40119
+ if (!signal)
40120
+ return promise2;
40121
+ if (signal.aborted)
40122
+ return Promise.reject(new ExtensionDownloadError("Download aborted", { cause: signal.reason }));
40123
+ return new Promise((resolve, reject) => {
40124
+ const onAbort = () => reject(new ExtensionDownloadError("Download aborted", { cause: signal.reason }));
40125
+ signal.addEventListener("abort", onAbort, { once: true });
40126
+ promise2.then((value) => {
40127
+ signal.removeEventListener("abort", onAbort);
40128
+ resolve(value);
40129
+ }, (error62) => {
40130
+ signal.removeEventListener("abort", onAbort);
40131
+ reject(error62);
40132
+ });
40133
+ });
40134
+ }
39402
40135
 
39403
40136
  // packages/desktop-control/src/renderer-extension-module.ts
39404
40137
  import { posix } from "node:path";
@@ -39439,12 +40172,12 @@ async function linkRendererExtensionModule(dataDir, { id: id3, activationId, dig
39439
40172
  name: "host-extension-assets",
39440
40173
  resolveId(source, importer) {
39441
40174
  try {
39442
- const path6 = importer ? resolveModule(importer.slice(VIRTUAL.length), source) : entry;
39443
- if (!path6.endsWith(".mjs")) throw new Error(`Expected a .mjs module: ${source}`);
39444
- hostExtensionResourcePathSchema.parse(path6);
39445
- if (hostExtensionCanonicalPath(path6) === backend)
39446
- throw new Error(`Cannot import backend.entry: ${path6}`);
39447
- return VIRTUAL + path6;
40175
+ const path7 = importer ? resolveModule(importer.slice(VIRTUAL.length), source) : entry;
40176
+ if (!path7.endsWith(".mjs")) throw new Error(`Expected a .mjs module: ${source}`);
40177
+ hostExtensionResourcePathSchema.parse(path7);
40178
+ if (hostExtensionCanonicalPath(path7) === backend)
40179
+ throw new Error(`Cannot import backend.entry: ${path7}`);
40180
+ return VIRTUAL + path7;
39448
40181
  } catch (error62) {
39449
40182
  throw new Error(
39450
40183
  `${importer?.slice(VIRTUAL.length) ?? entry}: ${error62 instanceof Error ? error62.message : String(error62)}`
@@ -39457,9 +40190,9 @@ async function linkRendererExtensionModule(dataDir, { id: id3, activationId, dig
39457
40190
  );
39458
40191
  },
39459
40192
  async load(moduleId) {
39460
- const path6 = moduleId.slice(VIRTUAL.length);
40193
+ const path7 = moduleId.slice(VIRTUAL.length);
39461
40194
  if (++count2 > MAX_MODULES2) throw new Error(`Module graph exceeds ${MAX_MODULES2} files`);
39462
- const asset = await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path: path6 });
40195
+ const asset = await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path: path7 });
39463
40196
  const buffer = Buffer.from(asset.base64, "base64");
39464
40197
  bytes += buffer.length;
39465
40198
  if (bytes > DESKTOP_EXTENSION_SNAPSHOT_MAX_BYTES)
@@ -39480,9 +40213,9 @@ async function linkRendererExtensionModule(dataDir, { id: id3, activationId, dig
39480
40213
  if (warning.code !== "CIRCULAR_DEPENDENCY") warn(warning);
39481
40214
  }
39482
40215
  }).catch((error62) => {
39483
- const path6 = error62.id?.startsWith(VIRTUAL) ? error62.id.slice(VIRTUAL.length) : entry;
40216
+ const path7 = error62.id?.startsWith(VIRTUAL) ? error62.id.slice(VIRTUAL.length) : entry;
39484
40217
  const loc = error62.loc ? `:${error62.loc.line}:${error62.loc.column + 1}` : "";
39485
- throw new Error(`${path6}${loc}: ${error62.message}`, { cause: error62 });
40218
+ throw new Error(`${path7}${loc}: ${error62.message}`, { cause: error62 });
39486
40219
  });
39487
40220
  try {
39488
40221
  const { output: output2 } = await bundle.generate({ format: "system", compact: true });
@@ -39532,8 +40265,8 @@ async function application(dataDir, item) {
39532
40265
  try {
39533
40266
  const desktop = manifest.desktop;
39534
40267
  if (!desktop) throw new Error("Missing desktop manifest entry");
39535
- const read = async (path6) => Buffer.from(
39536
- (await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path: path6 })).base64,
40268
+ const read = async (path7) => Buffer.from(
40269
+ (await readHostExtensionAsset({ dataDir, id: id3, activationId, digest, path: path7 })).base64,
39537
40270
  "base64"
39538
40271
  ).toString("utf8");
39539
40272
  const [script, style2] = await Promise.all([
@@ -39568,14 +40301,14 @@ async function surfaceApplication(dataDir, item, kind) {
39568
40301
  const hash2 = renderHash(item);
39569
40302
  const surface = manifest[kind];
39570
40303
  if (!surface) throw new Error(`Missing ${kind} manifest entry`);
39571
- const path6 = surface.entry;
39572
- const reference = JSON.stringify({ id: id3, activationId, digest, hash: hash2, kind, path: path6 });
40304
+ const path7 = surface.entry;
40305
+ const reference = JSON.stringify({ id: id3, activationId, digest, hash: hash2, kind, path: path7 });
39573
40306
  const identity2 = { id: `${id3}:${kind}`, hash: hash2, reference };
39574
40307
  try {
39575
- const factory = await linkRendererExtensionModule(dataDir, item, path6);
40308
+ const factory = await linkRendererExtensionModule(dataDir, item, path7);
39576
40309
  return { ...identity2, expression: `{...${reference}, create: ${factory}}` };
39577
40310
  } catch (cause) {
39578
- const error62 = (cause instanceof Error ? cause.message : `${path6}: ${String(cause)}`).slice(
40311
+ const error62 = (cause instanceof Error ? cause.message : `${path7}: ${String(cause)}`).slice(
39579
40312
  0,
39580
40313
  2048
39581
40314
  );
@@ -39919,11 +40652,11 @@ var RendererDesktopExtensions = class {
39919
40652
  extensions: target2.extensions,
39920
40653
  ...Object.keys(target2.surfaces).length ? { surfaces: target2.surfaces } : {}
39921
40654
  };
39922
- await mkdir4(path4.dirname(this.#statusPath), { recursive: true, mode: 448 });
40655
+ await mkdir5(path5.dirname(this.#statusPath), { recursive: true, mode: 448 });
39923
40656
  const temporary = `${this.#statusPath}.${randomUUID2()}.tmp`;
39924
40657
  try {
39925
- await writeFile4(temporary, JSON.stringify(doc), { mode: 384, flag: "wx" });
39926
- await rename2(temporary, this.#statusPath);
40658
+ await writeFile5(temporary, JSON.stringify(doc), { mode: 384, flag: "wx" });
40659
+ await rename3(temporary, this.#statusPath);
39927
40660
  } finally {
39928
40661
  await rm4(temporary, { force: true });
39929
40662
  }
@@ -39972,7 +40705,7 @@ function serializeDesktopControllerReadiness(readiness) {
39972
40705
  return line;
39973
40706
  }
39974
40707
  var defaultDependencies = {
39975
- readRenderer: (filePath2) => readFile(filePath2, "utf8"),
40708
+ readRenderer: (filePath2) => readFile2(filePath2, "utf8"),
39976
40709
  install: installRendererCdpControlSession,
39977
40710
  startAttachmentServer: startControllerAttachmentServer,
39978
40711
  ready: (readiness) => {
@@ -40010,8 +40743,8 @@ function parseDesktopControllerArguments(arguments_) {
40010
40743
  if (argument === "--renderer") {
40011
40744
  if (rendererPath !== void 0) throw new Error("--renderer may only be provided once");
40012
40745
  if (!value) throw new Error("--renderer requires a value");
40013
- if (!path5.isAbsolute(value)) throw new Error("--renderer must be an absolute path");
40014
- rendererPath = path5.normalize(value);
40746
+ if (!path6.isAbsolute(value)) throw new Error("--renderer must be an absolute path");
40747
+ rendererPath = path6.normalize(value);
40015
40748
  index += 1;
40016
40749
  continue;
40017
40750
  }
@@ -40080,7 +40813,7 @@ async function installProductionSession(options, dependencies) {
40080
40813
  async function runDesktopController(options, signal, dependencies = defaultDependencies, lifecycle) {
40081
40814
  const now = dependencies.now ?? Date.now;
40082
40815
  const desktopExtensions = dependencies === defaultDependencies ? new RendererDesktopExtensions(
40083
- path5.dirname(path5.dirname(defaultControllerStatusPath())),
40816
+ path6.dirname(path6.dirname(defaultControllerStatusPath())),
40084
40817
  (error62) => {
40085
40818
  process.stderr.write(`codexhost Desktop extensions: ${String(error62)}
40086
40819
  `);