@codexhost/cli-win32-x64 0.31.0 → 0.32.1

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 (114) hide show
  1. package/README.md +1 -1
  2. package/app/codexhost-distribution.json +1 -1
  3. package/app/console-server.mjs +225 -20
  4. package/app/console-web.js +285 -25
  5. package/app/desktop-controller.mjs +534 -143
  6. package/app/host-runtime.mjs +2651 -913
  7. package/app/plugins/antigravity/plugin.mjs +20 -22
  8. package/app/plugins/claude-code/plugin.mjs +21 -0
  9. package/app/plugins/codebuddy/plugin.mjs +29 -2
  10. package/app/plugins/codex-usage/plugin.mjs +18 -0
  11. package/app/plugins/copilot/plugin.mjs +18 -0
  12. package/app/plugins/cursor-cli/plugin.mjs +18 -0
  13. package/app/plugins/deepseek-harness/plugin.mjs +18 -0
  14. package/app/plugins/devin/plugin.mjs +18 -0
  15. package/app/plugins/grok/plugin.mjs +18 -0
  16. package/app/plugins/hermes/plugin.mjs +18 -0
  17. package/app/plugins/kimi-code/plugin.mjs +18 -0
  18. package/app/plugins/kiro-cli/plugin.mjs +18 -0
  19. package/app/plugins/omp/plugin.mjs +18 -0
  20. package/app/plugins/opencode/plugin.mjs +18 -0
  21. package/app/plugins/pi/plugin.mjs +18 -0
  22. package/app/plugins/qoder/plugin.mjs +18 -0
  23. package/app/plugins/qoder-cn/plugin.mjs +18 -0
  24. package/app/plugins/qwen-code/plugin.mjs +18 -0
  25. package/app/plugins/workbuddy/plugin.mjs +29 -2
  26. package/app/plugins/zcode/plugin.mjs +18 -0
  27. package/app/renderer-extension.js +424 -129
  28. package/app/web/assets/{abnfDiagram-XWFEHMT6-Bqy7uOSy.js → abnfDiagram-XWFEHMT6-7XITZmBH.js} +1 -1
  29. package/app/web/assets/{architectureDiagram-CSQXQB3N-6aaP1YoM.js → architectureDiagram-CSQXQB3N-C8Usdzd8.js} +1 -1
  30. package/app/web/assets/{blockDiagram-BEDRHYPZ-B4QSFXe0.js → blockDiagram-BEDRHYPZ-CyN9yE_Q.js} +1 -1
  31. package/app/web/assets/{c4Diagram-M2UUVUY5-BYE-C8Gq.js → c4Diagram-M2UUVUY5-CjhY1l3g.js} +1 -1
  32. package/app/web/assets/{chunk-2Q5K7J3B-CiEM-GTd.js → chunk-2Q5K7J3B-o24_rh4_.js} +1 -1
  33. package/app/web/assets/{chunk-3GCGMST5-hzY9BiB1.js → chunk-3GCGMST5-D7bw3E1a.js} +1 -1
  34. package/app/web/assets/{chunk-5VM5RSS4-DYXznY0H.js → chunk-5VM5RSS4-D0v4acf7.js} +1 -1
  35. package/app/web/assets/{chunk-7U7NFRK5-Bzw5MDPr.js → chunk-7U7NFRK5-CYJxP4rV.js} +1 -1
  36. package/app/web/assets/{chunk-CNRTWJTD-DMbxMfi3.js → chunk-CNRTWJTD-DTgCtcCl.js} +1 -1
  37. package/app/web/assets/{chunk-D5HYT7QG-By0ZVBtD.js → chunk-D5HYT7QG-qRNelehW.js} +1 -1
  38. package/app/web/assets/{chunk-EBZ3SEQC-Yyu_sMV7.js → chunk-EBZ3SEQC-BgJPPYdu.js} +2 -2
  39. package/app/web/assets/{chunk-JWPE2WC7-DDzqxIPT.js → chunk-JWPE2WC7-C50ZnSQQ.js} +1 -1
  40. package/app/web/assets/{chunk-KTR4FSNJ-GlKqhtpl.js → chunk-KTR4FSNJ-Cifh4XHc.js} +1 -1
  41. package/app/web/assets/{chunk-XXDRQBXY-DNc-CvYu.js → chunk-XXDRQBXY-D23WAHPW.js} +1 -1
  42. package/app/web/assets/{classDiagram-v2-KXABOMEV-4_PFS2N_.js → classDiagram-v2-KXABOMEV-B3cezFGj.js} +1 -1
  43. package/app/web/assets/{cose-bilkent-JH36ORCC-BE3foHUY.js → cose-bilkent-JH36ORCC-VSMi4La2.js} +1 -1
  44. package/app/web/assets/{cynefin-EF2NZ3EQ-D2PqrYZ3.js → cynefin-EF2NZ3EQ-qQnfHq16.js} +1 -1
  45. package/app/web/assets/{cynefinDiagram-NJNITYFG-DOObpTbq.js → cynefinDiagram-NJNITYFG-BJELApXD.js} +1 -1
  46. package/app/web/assets/{dagre-KIHZ2IZ3-Znm2jin9.js → dagre-KIHZ2IZ3-C8B5ZMVs.js} +1 -1
  47. package/app/web/assets/{diagram-7YQZDPLS-ByZMD-uA.js → diagram-7YQZDPLS-HIWoNpzV.js} +1 -1
  48. package/app/web/assets/{diagram-QBROCOUO-BiRShpnN.js → diagram-QBROCOUO-3_vS1jbp.js} +1 -1
  49. package/app/web/assets/{diagram-RJJCUUZO-D9wLVoK2.js → diagram-RJJCUUZO-C_Kndn_e.js} +1 -1
  50. package/app/web/assets/{diagram-WERXNKYE-BSbIh-yC.js → diagram-WERXNKYE-BLWdOwya.js} +1 -1
  51. package/app/web/assets/{diagram-YHHI257C-DMWrHMc8.js → diagram-YHHI257C-DJeOs6eS.js} +1 -1
  52. package/app/web/assets/{diagram-YR4HJLHV-C4sBAFb1.js → diagram-YR4HJLHV-BKNULu-g.js} +1 -1
  53. package/app/web/assets/{ebnfDiagram-N527522P-BZLloaoQ.js → ebnfDiagram-N527522P-Bu8aReoF.js} +1 -1
  54. package/app/web/assets/{elk-O5DQBFGD-Da3e5tn5.js → elk-O5DQBFGD-CIp7Z0ER.js} +1 -1
  55. package/app/web/assets/{erDiagram-K3K3BIDK-B2lKAIZF.js → erDiagram-K3K3BIDK-BTsor1Lp.js} +1 -1
  56. package/app/web/assets/{flowDiagram-Z6JWZHQI-q2EY_kmB.js → flowDiagram-Z6JWZHQI-p_h5PKQr.js} +1 -1
  57. package/app/web/assets/{ganttDiagram-3PRQTZWP-BGrNZ20b.js → ganttDiagram-3PRQTZWP-DKjfPPJ1.js} +1 -1
  58. package/app/web/assets/{gitGraphDiagram-VXDFKS5L-DIZNXREy.js → gitGraphDiagram-VXDFKS5L-RnPOf2fj.js} +1 -1
  59. package/app/web/assets/{grid-E2QIVN74-0cUkPG69.js → grid-E2QIVN74-C96GnBO1.js} +1 -1
  60. package/app/web/assets/{index-PN7K-15_.js → index-CDRWzs-u.js} +99 -99
  61. package/app/web/assets/index-Dwdnvinl.css +1 -0
  62. package/app/web/assets/{infoDiagram-EZ3ZOAHP-BHhUTQCn.js → infoDiagram-EZ3ZOAHP-B68eZHsb.js} +1 -1
  63. package/app/web/assets/{ishikawaDiagram-S3EKX5GW-DPOxtl4c.js → ishikawaDiagram-S3EKX5GW-BLj7PFLt.js} +1 -1
  64. package/app/web/assets/{journeyDiagram-POQNLL5X-D8RyXckG.js → journeyDiagram-POQNLL5X-Bo-_In0d.js} +1 -1
  65. package/app/web/assets/{kanban-definition-BH5XI6FM-COJv3Hyh.js → kanban-definition-BH5XI6FM-BpHvxprW.js} +1 -1
  66. package/app/web/assets/{mermaid.core-DYdcDKIt.js → mermaid.core-COb9i2Gl.js} +4 -4
  67. package/app/web/assets/{mindmap-definition-WVAN44T4-DnYIM4ja.js → mindmap-definition-WVAN44T4-DG15AlXd.js} +1 -1
  68. package/app/web/assets/{pegDiagram-D4NLKWP3-Ds3GAEJ6.js → pegDiagram-D4NLKWP3-GMBk8RM6.js} +1 -1
  69. package/app/web/assets/{pieDiagram-36ENHN4W-BhLUJGEB.js → pieDiagram-36ENHN4W-BzeJgVnn.js} +1 -1
  70. package/app/web/assets/{quadrantDiagram-ZQUDMS73-DwtX-IxK.js → quadrantDiagram-ZQUDMS73-C--Kif6a.js} +1 -1
  71. package/app/web/assets/{railroadDiagram-JIZHGYPL-D2vmTTnJ.js → railroadDiagram-JIZHGYPL-NPLVu_R7.js} +1 -1
  72. package/app/web/assets/{render-VIF2ZAQL-DGU1ql-Z.js → render-VIF2ZAQL-DdpQ8E0J.js} +2 -2
  73. package/app/web/assets/{requirementDiagram-AXW2TVFA-u3j1sKkI.js → requirementDiagram-AXW2TVFA-WWRwRbkA.js} +1 -1
  74. package/app/web/assets/{sankeyDiagram-FBCJTAIF-k-An9VHW.js → sankeyDiagram-FBCJTAIF-hBr6pZ0V.js} +1 -1
  75. package/app/web/assets/{sequenceDiagram-3LA2ROMG-DUjbYb4R.js → sequenceDiagram-3LA2ROMG-DvzZWy5J.js} +1 -1
  76. package/app/web/assets/{sizeCapture-2Q2CQKSF-DATTL7FZ.js → sizeCapture-2Q2CQKSF-C2B86W70.js} +1 -1
  77. package/app/web/assets/{stateDiagram-v2-ATKHQDJO-cCJX5M2u.js → stateDiagram-v2-ATKHQDJO-Jwj3XqMx.js} +1 -1
  78. package/app/web/assets/{swimlanes-YQL5WMAO-B7grWEWt.js → swimlanes-YQL5WMAO-DxI0hC09.js} +1 -1
  79. package/app/web/assets/swimlanesDiagram-UCCPES4V-CR0nv8kJ.js +8 -0
  80. package/app/web/assets/{timeline-definition-7Z437IG3-BhsLa6l1.js → timeline-definition-7Z437IG3-m8Ew8iuN.js} +1 -1
  81. package/app/web/assets/{usecaseDiagram-RDK6N6HP-CkPQYmQw.js → usecaseDiagram-RDK6N6HP-BsiPSzIT.js} +1 -1
  82. package/app/web/assets/{vennDiagram-SHRQU5PJ-CufZSwvw.js → vennDiagram-SHRQU5PJ-yYfXhiGp.js} +1 -1
  83. package/app/web/assets/{wardleyDiagram-F3OXNVQS-CSkfpFOA.js → wardleyDiagram-F3OXNVQS-DHLEfnsg.js} +1 -1
  84. package/app/web/assets/{xychartDiagram-GDYJKCDI-BhZf9scK.js → xychartDiagram-GDYJKCDI-Drn_UxYt.js} +1 -1
  85. package/app/web/codexhost-settings.js +123 -55
  86. package/app/web/index.html +2 -2
  87. package/app/web/plugins/deepseek-ai__dsh-api-gateway/client.js +1 -1
  88. package/app/web/plugins/deepseek-ai__dsh-api-remotes/client.js +1 -1
  89. package/app/web/plugins/deepseek-ai__dsh-api-session-controller/client.js +8 -8
  90. package/app/web/plugins/deepseek-ai__dsh-client-locale/client.js +1 -1
  91. package/app/web/plugins/deepseek-ai__dsh-client-ui-attachment/client.js +1 -1
  92. package/app/web/plugins/deepseek-ai__dsh-client-ui-chat/client.js +75 -75
  93. package/app/web/plugins/deepseek-ai__dsh-client-ui-codexhost/client.js +65 -65
  94. package/app/web/plugins/deepseek-ai__dsh-client-ui-commands/client.js +1 -1
  95. package/app/web/plugins/deepseek-ai__dsh-client-ui-conversation/client.js +18 -18
  96. package/app/web/plugins/deepseek-ai__dsh-client-ui-plan/client.js +1 -1
  97. package/app/web/plugins/deepseek-ai__dsh-client-ui-settings-general/client.js +1 -1
  98. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-documentpreview/client.js +7 -7
  99. package/app/web/plugins/deepseek-ai__dsh-client-ui-sidebar-right/client.js +2 -2
  100. package/app/web/plugins/deepseek-ai__dsh-client-ui-tool/client.js +18 -18
  101. package/app/web/plugins/deepseek-ai__dsh-client-ui-user-questions/client.js +1 -1
  102. package/app/web/plugins/deepseek-ai__dsh-client-ui-workspace/client.js +69 -69
  103. package/app/web/sw.js +230 -16
  104. package/app/web-modules/node_modules/@deepseek-ai/dsh-client-modules/index.js +7 -7
  105. package/app/web-modules/server.mjs +1144 -185
  106. package/bin/codexhost.exe +0 -0
  107. package/libexec/codexhost-node-repl.exe +0 -0
  108. package/libexec/codexhost-screenshot.exe +0 -0
  109. package/libexec/codexhost-shell.exe +0 -0
  110. package/libexec/codexhost-shim.exe +0 -0
  111. package/libexec/codexhost-updater.exe +0 -0
  112. package/package.json +1 -1
  113. package/app/web/assets/index-BbmB5VLj.css +0 -1
  114. package/app/web/assets/swimlanesDiagram-UCCPES4V-B8Jem9gq.js +0 -8
package/README.md CHANGED
@@ -7,7 +7,7 @@ Run Pi and Claude Code as first-class external harnesses inside Codex Desktop.
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- npm install -g @codexhost/cli@0.31.0
10
+ npm install -g @codexhost/cli@0.32.1
11
11
  ```
12
12
 
13
13
  Do not install this package directly. npm selects it through the optional dependencies of `@codexhost/cli`.
@@ -1 +1 @@
1
- {"schemaVersion":1,"version":"0.31.0","distribution":"npm","target":"windows-x64"}
1
+ {"schemaVersion":1,"version":"0.32.1","distribution":"npm","target":"windows-x64"}
@@ -1244,11 +1244,11 @@ var require_mtime_precision = __commonJS({
1244
1244
  function probe(file2, fs, callback) {
1245
1245
  const cachedPrecision = fs[cacheSymbol];
1246
1246
  if (cachedPrecision) {
1247
- return fs.stat(file2, (err, stat5) => {
1247
+ return fs.stat(file2, (err, stat6) => {
1248
1248
  if (err) {
1249
1249
  return callback(err);
1250
1250
  }
1251
- callback(null, stat5.mtime, cachedPrecision);
1251
+ callback(null, stat6.mtime, cachedPrecision);
1252
1252
  });
1253
1253
  }
1254
1254
  const mtime = new Date(Math.ceil(Date.now() / 1e3) * 1e3 + 5);
@@ -1256,13 +1256,13 @@ var require_mtime_precision = __commonJS({
1256
1256
  if (err) {
1257
1257
  return callback(err);
1258
1258
  }
1259
- fs.stat(file2, (err2, stat5) => {
1259
+ fs.stat(file2, (err2, stat6) => {
1260
1260
  if (err2) {
1261
1261
  return callback(err2);
1262
1262
  }
1263
- const precision = stat5.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1263
+ const precision = stat6.mtime.getTime() % 1e3 === 0 ? "s" : "ms";
1264
1264
  Object.defineProperty(fs, cacheSymbol, { value: precision });
1265
- callback(null, stat5.mtime, precision);
1265
+ callback(null, stat6.mtime, precision);
1266
1266
  });
1267
1267
  });
1268
1268
  }
@@ -1316,14 +1316,14 @@ var require_lockfile = __commonJS({
1316
1316
  if (options.stale <= 0) {
1317
1317
  return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
1318
1318
  }
1319
- options.fs.stat(lockfilePath, (err2, stat5) => {
1319
+ options.fs.stat(lockfilePath, (err2, stat6) => {
1320
1320
  if (err2) {
1321
1321
  if (err2.code === "ENOENT") {
1322
1322
  return acquireLock(file2, { ...options, stale: 0 }, callback);
1323
1323
  }
1324
1324
  return callback(err2);
1325
1325
  }
1326
- if (!isLockStale(stat5, options)) {
1326
+ if (!isLockStale(stat6, options)) {
1327
1327
  return callback(Object.assign(new Error("Lock file is already being held"), { code: "ELOCKED", file: file2 }));
1328
1328
  }
1329
1329
  removeLock(file2, options, (err3) => {
@@ -1335,8 +1335,8 @@ var require_lockfile = __commonJS({
1335
1335
  });
1336
1336
  });
1337
1337
  }
1338
- function isLockStale(stat5, options) {
1339
- return stat5.mtime.getTime() < Date.now() - options.stale;
1338
+ function isLockStale(stat6, options) {
1339
+ return stat6.mtime.getTime() < Date.now() - options.stale;
1340
1340
  }
1341
1341
  function removeLock(file2, options, callback) {
1342
1342
  options.fs.rmdir(getLockFile(file2, options), (err) => {
@@ -1354,7 +1354,7 @@ var require_lockfile = __commonJS({
1354
1354
  lock2.updateDelay = lock2.updateDelay || options.update;
1355
1355
  lock2.updateTimeout = setTimeout(() => {
1356
1356
  lock2.updateTimeout = null;
1357
- options.fs.stat(lock2.lockfilePath, (err, stat5) => {
1357
+ options.fs.stat(lock2.lockfilePath, (err, stat6) => {
1358
1358
  const isOverThreshold = lock2.lastUpdate + options.stale < Date.now();
1359
1359
  if (err) {
1360
1360
  if (err.code === "ENOENT" || isOverThreshold) {
@@ -1363,7 +1363,7 @@ var require_lockfile = __commonJS({
1363
1363
  lock2.updateDelay = 1e3;
1364
1364
  return updateLock(file2, options);
1365
1365
  }
1366
- const isMtimeOurs = lock2.mtime.getTime() === stat5.mtime.getTime();
1366
+ const isMtimeOurs = lock2.mtime.getTime() === stat6.mtime.getTime();
1367
1367
  if (!isMtimeOurs) {
1368
1368
  return setLockAsCompromised(
1369
1369
  file2,
@@ -1488,11 +1488,11 @@ var require_lockfile = __commonJS({
1488
1488
  if (err) {
1489
1489
  return callback(err);
1490
1490
  }
1491
- options.fs.stat(getLockFile(file3, options), (err2, stat5) => {
1491
+ options.fs.stat(getLockFile(file3, options), (err2, stat6) => {
1492
1492
  if (err2) {
1493
1493
  return err2.code === "ENOENT" ? callback(null, false) : callback(err2);
1494
1494
  }
1495
- return callback(null, !isLockStale(stat5, options));
1495
+ return callback(null, !isLockStale(stat6, options));
1496
1496
  });
1497
1497
  });
1498
1498
  }
@@ -22570,6 +22570,7 @@ var HOST_EXTENSIONS_RPC = {
22570
22570
  snapshot: "codexhost/extensions/snapshot",
22571
22571
  catalog: "codexhost/extensions/catalog",
22572
22572
  catalogIcon: "codexhost/extensions/catalogIcon",
22573
+ catalogScreenshot: "codexhost/extensions/catalogScreenshot",
22573
22574
  install: "codexhost/extensions/install",
22574
22575
  update: "codexhost/extensions/update",
22575
22576
  enable: "codexhost/extensions/enable",
@@ -22606,6 +22607,11 @@ var hostExtensionsCatalogIconResultSchema = external_exports.strictObject({
22606
22607
  mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
22607
22608
  base64: base643(DESKTOP_EXTENSION_ICON_MAX_BYTES)
22608
22609
  });
22610
+ var hostExtensionCatalogScreenshotIndexSchema = external_exports.int().min(0).max(DESKTOP_EXTENSION_SCREENSHOT_LIMIT - 1);
22611
+ var hostExtensionsCatalogScreenshotResultSchema = external_exports.strictObject({
22612
+ mimeType: external_exports.enum(["image/png", "image/jpeg", "image/webp"]),
22613
+ base64: base643(DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES)
22614
+ });
22609
22615
  var hostExtensionSettingsSchema = external_exports.strictObject({
22610
22616
  settingsRevision: hostExtensionRevisionSchema,
22611
22617
  values: jsonObjectSchema
@@ -22624,6 +22630,10 @@ var hostExtensionsRpcSchemas = {
22624
22630
  params: external_exports.strictObject({ ...id }),
22625
22631
  result: hostExtensionsCatalogIconResultSchema
22626
22632
  },
22633
+ [HOST_EXTENSIONS_RPC.catalogScreenshot]: {
22634
+ params: external_exports.strictObject({ ...id, index: hostExtensionCatalogScreenshotIndexSchema }),
22635
+ result: hostExtensionsCatalogScreenshotResultSchema
22636
+ },
22627
22637
  [HOST_EXTENSIONS_RPC.install]: {
22628
22638
  params: external_exports.strictObject({ source: hostExtensionInstallSourceSchema }),
22629
22639
  result: installationResult
@@ -22859,6 +22869,8 @@ var CLIENT_CHANNEL_METHODS = [
22859
22869
  "codexhost/harness/preferences/get",
22860
22870
  "codexhost/harness/preferences/patch",
22861
22871
  "experimentalFeature/list",
22872
+ "collaborationMode/list",
22873
+ "codexhost/thread/collaboration-mode/select",
22862
22874
  "thread/list",
22863
22875
  "thread/metadata/update",
22864
22876
  "codexhost/thread/catalog/read",
@@ -23151,6 +23163,7 @@ var clientThreadSnapshotSchema = external_exports.object({
23151
23163
  nextCursor: external_exports.string().nullable()
23152
23164
  }),
23153
23165
  configuration: external_exports.object({
23166
+ codexCollaborationMode: external_exports.enum(["plan", "default"]).optional(),
23154
23167
  /** Native Codex model names are not external Harness transport refs. */
23155
23168
  native: external_exports.object({
23156
23169
  model: external_exports.string().min(1).max(1024).optional(),
@@ -23848,6 +23861,11 @@ var harnessDefaultConfigurationSchema = external_exports.strictObject({
23848
23861
  thinkingOptionId: harnessThinkingOptionIdSchema.optional(),
23849
23862
  permissionModeId: harnessPermissionModeIdSchema.optional()
23850
23863
  }).refine((value) => Boolean(value.model || value.thinkingOptionId || value.permissionModeId), "A default configuration must contain a preference");
23864
+ var projectHarnessSelectionSchema = external_exports.discriminatedUnion("mode", [
23865
+ external_exports.strictObject({ mode: external_exports.literal("global") }),
23866
+ external_exports.strictObject({ mode: external_exports.literal("last") }),
23867
+ external_exports.strictObject({ mode: external_exports.literal("manual"), harnessId: harnessIdSchema })
23868
+ ]);
23851
23869
  var newThreadDefaultsSchema = external_exports.strictObject({
23852
23870
  lastHarness: harnessIdSchema.optional(),
23853
23871
  byHarness: external_exports.record(preferenceHarnessKey, harnessDefaultConfigurationSchema)
@@ -27335,7 +27353,7 @@ function isRetryableDownloadError(error62) {
27335
27353
  return RETRYABLE_HTTP_STATUSES.has(error62.status);
27336
27354
  return !(error62 instanceof ExtensionDownloadError);
27337
27355
  }
27338
- async function downloadExtensionBytes(url2, limit, headers, { signal: callerSignal, allowUrl, timeoutMs = DEFAULT_TIMEOUT_MS, idleTimeoutMs, retries = 0, retryBaseDelayMs = DEFAULT_RETRY_BASE_DELAY_MS }) {
27356
+ async function downloadExtensionBytes(url2, limit, headers, { signal: callerSignal, allowUrl, allowContentType, timeoutMs = DEFAULT_TIMEOUT_MS, idleTimeoutMs, retries = 0, retryBaseDelayMs = DEFAULT_RETRY_BASE_DELAY_MS }) {
27339
27357
  const parsed = desktopExtensionHttpUrlSchema.safeParse(url2);
27340
27358
  if (!parsed.success)
27341
27359
  throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
@@ -27398,6 +27416,10 @@ async function downloadExtensionBytes(url2, limit, headers, { signal: callerSign
27398
27416
  throw new ExtensionHttpError(response.status);
27399
27417
  throw new ExtensionDownloadError("Download is empty or exceeds the size limit");
27400
27418
  }
27419
+ if (allowContentType && !allowContentType(response.headers.get("content-type"))) {
27420
+ await body.cancel().catch(() => void 0);
27421
+ throw new ExtensionDownloadError("Unsupported download content type");
27422
+ }
27401
27423
  const reader = body.getReader();
27402
27424
  const chunks = [];
27403
27425
  let size = 0;
@@ -27639,7 +27661,8 @@ async function discoverHostExtensions(dataDir, options = {}) {
27639
27661
  var MAX_DEFAULT_SEEDS_BYTES = 32 * 1024;
27640
27662
 
27641
27663
  // packages/harness-plugin-files/dist/host-extension-sources.js
27642
- import { lstat as lstat7, mkdir as mkdir7, readFile as readFile7, realpath as realpath6, unlink, writeFile as writeFile7 } from "node:fs/promises";
27664
+ import { lstat as lstat7, mkdir as mkdir7, readFile as readFile7, realpath as realpath6, stat as stat3, unlink, writeFile as writeFile7 } from "node:fs/promises";
27665
+ import { isIP } from "node:net";
27643
27666
  import path13 from "node:path";
27644
27667
 
27645
27668
  // packages/harness-plugin-files/dist/extension-zip.js
@@ -27656,10 +27679,74 @@ var STALE_FALLBACK_MAX_AGE_MS = 30 * 60 * 1e3;
27656
27679
  var DISK_CATALOG_MAX_AGE_MS = 7 * 24 * 60 * 60 * 1e3;
27657
27680
  var CATALOG_TIMEOUT_MS = 12e3;
27658
27681
  var CATALOG_RETRIES = 1;
27682
+ var ICON_TIMEOUT_MS = 12e3;
27683
+ var ICON_RETRIES = 1;
27684
+ var ICON_MEMORY_LIMIT = 200;
27685
+ var SCREENSHOT_TIMEOUT_MS = 15e3;
27686
+ var SCREENSHOT_RETRIES = 1;
27687
+ var SCREENSHOT_MEMORY_LIMIT = 64;
27688
+ var IMAGE_FAIL_BACKOFF_MS = 6e4;
27659
27689
  var STATS_MAX_BYTES = 256 * 1024;
27660
27690
  var STATS_TIMEOUT_MS = 2e3;
27661
27691
  var STATS_INLINE_GRACE_MS = 600;
27662
27692
  var httpsDownload = (url2) => url2.protocol === "https:" && !url2.username && !url2.password;
27693
+ function isPrivateOrLoopbackIPv4(a, b) {
27694
+ return a === 0 || a === 10 || a === 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 168;
27695
+ }
27696
+ function parseIPv6Groups(host) {
27697
+ let normalized = host;
27698
+ const lastColon = normalized.lastIndexOf(":");
27699
+ if (lastColon !== -1 && normalized.slice(lastColon + 1).includes(".")) {
27700
+ const ipv4Parts = normalized.slice(lastColon + 1).split(".").map(Number);
27701
+ if (ipv4Parts.length !== 4 || ipv4Parts.some((n) => !Number.isInteger(n) || n < 0 || n > 255))
27702
+ return null;
27703
+ const high = (ipv4Parts[0] << 8 | ipv4Parts[1]).toString(16);
27704
+ const low = (ipv4Parts[2] << 8 | ipv4Parts[3]).toString(16);
27705
+ normalized = `${normalized.slice(0, lastColon + 1)}${high}:${low}`;
27706
+ }
27707
+ const parts = normalized.split("::");
27708
+ if (parts.length > 2)
27709
+ return null;
27710
+ const parseSide = (side) => side ? side.split(":").map((segment) => Number.parseInt(segment, 16)) : [];
27711
+ const left = parseSide(parts[0]);
27712
+ const right = parts.length === 2 ? parseSide(parts[1]) : [];
27713
+ if ([...left, ...right].some((n) => !Number.isInteger(n) || n < 0 || n > 65535))
27714
+ return null;
27715
+ if (parts.length === 1)
27716
+ return left.length === 8 ? left : null;
27717
+ const missing = 8 - left.length - right.length;
27718
+ if (missing < 1)
27719
+ return null;
27720
+ return [...left, ...Array(missing).fill(0), ...right];
27721
+ }
27722
+ function isPrivateOrLoopbackHostname(rawHostname) {
27723
+ const unbracketed = rawHostname.startsWith("[") && rawHostname.endsWith("]") ? rawHostname.slice(1, -1) : rawHostname;
27724
+ const host = unbracketed.toLowerCase().replace(/\.+$/u, "");
27725
+ if (!host || host === "localhost" || host.endsWith(".localhost"))
27726
+ return true;
27727
+ const ipVersion = isIP(host);
27728
+ if (ipVersion === 4) {
27729
+ const octets = host.split(".").map(Number);
27730
+ return octets.length !== 4 || isPrivateOrLoopbackIPv4(octets[0], octets[1]);
27731
+ }
27732
+ if (ipVersion === 6) {
27733
+ const groups = parseIPv6Groups(host);
27734
+ if (!groups)
27735
+ return true;
27736
+ const isZeroPrefix7 = groups.slice(0, 7).every((g) => g === 0);
27737
+ if (isZeroPrefix7 && (groups[7] === 0 || groups[7] === 1))
27738
+ return true;
27739
+ if ((groups[0] & 65024) === 64512)
27740
+ return true;
27741
+ if ((groups[0] & 65472) === 65152)
27742
+ return true;
27743
+ if (groups.slice(0, 5).every((g) => g === 0) && groups[5] === 65535) {
27744
+ return isPrivateOrLoopbackIPv4(groups[6] >> 8, groups[6] & 255);
27745
+ }
27746
+ }
27747
+ return false;
27748
+ }
27749
+ var publicHttpsDownload = (url2) => httpsDownload(url2) && !isPrivateOrLoopbackHostname(url2.hostname);
27663
27750
  var cache;
27664
27751
  var pending;
27665
27752
  var catalogGeneration = 0;
@@ -27669,6 +27756,124 @@ var PNG_SIG = Buffer.from([137, 80, 78, 71, 13, 10, 26, 10]);
27669
27756
  var JPEG_SIG = Buffer.from([255, 216, 255]);
27670
27757
  var RIFF_SIG = Buffer.from("RIFF");
27671
27758
  var WEBP_SIG = Buffer.from("WEBP");
27759
+ var ALLOWED_CATALOG_IMAGE_CONTENT_TYPES = /* @__PURE__ */ new Set([
27760
+ "image/png",
27761
+ "image/jpeg",
27762
+ "image/webp",
27763
+ "application/octet-stream"
27764
+ ]);
27765
+ function isAllowedCatalogImageContentType(contentType) {
27766
+ if (!contentType)
27767
+ return true;
27768
+ const mediaType = contentType.split(";", 1)[0]?.trim().toLowerCase();
27769
+ return !mediaType || ALLOWED_CATALOG_IMAGE_CONTENT_TYPES.has(mediaType);
27770
+ }
27771
+ function detectRasterMimeType(bytes) {
27772
+ if (bytes.length >= 8 && bytes.subarray(0, 8).equals(PNG_SIG))
27773
+ return "image/png";
27774
+ if (bytes.length >= 3 && bytes.subarray(0, 3).equals(JPEG_SIG))
27775
+ return "image/jpeg";
27776
+ if (bytes.length >= 12 && bytes.subarray(0, 4).equals(RIFF_SIG) && bytes.subarray(8, 12).equals(WEBP_SIG)) {
27777
+ return "image/webp";
27778
+ }
27779
+ return null;
27780
+ }
27781
+ function createCatalogImageCache({ cacheSubdir, maxBytes, memoryLimit, label, timeoutMs, retries, allowContentType }) {
27782
+ const memoryCache = /* @__PURE__ */ new Map();
27783
+ const pendingDownloads = /* @__PURE__ */ new Map();
27784
+ const retryAt = /* @__PURE__ */ new Map();
27785
+ const remember = (hash2, image2) => {
27786
+ memoryCache.delete(hash2);
27787
+ memoryCache.set(hash2, image2);
27788
+ if (memoryCache.size > memoryLimit) {
27789
+ const oldest = memoryCache.keys().next().value;
27790
+ if (oldest !== void 0)
27791
+ memoryCache.delete(oldest);
27792
+ }
27793
+ return image2;
27794
+ };
27795
+ return async function fetchCachedImage({ dataDir, url: url2, signal }) {
27796
+ const parsedUrl = desktopExtensionHttpUrlSchema.safeParse(url2);
27797
+ if (!parsedUrl.success) {
27798
+ throw new ExtensionDownloadError("Expected a credential-free HTTP(S) URL");
27799
+ }
27800
+ const targetUrl = new URL(parsedUrl.data);
27801
+ if (!httpsDownload(targetUrl)) {
27802
+ throw new ExtensionDownloadError(`Catalog ${label} must use HTTPS`);
27803
+ }
27804
+ if (isPrivateOrLoopbackHostname(targetUrl.hostname)) {
27805
+ throw new ExtensionDownloadError("Unsafe download URL");
27806
+ }
27807
+ const hash2 = sha256(Buffer.from(targetUrl.href, "utf8"));
27808
+ const memoryHit = memoryCache.get(hash2);
27809
+ if (memoryHit) {
27810
+ return remember(hash2, memoryHit);
27811
+ }
27812
+ const diskFile = path13.join(dataDir, "cache", cacheSubdir, `${hash2}.img`);
27813
+ const diskInfo = await stat3(diskFile).catch(() => void 0);
27814
+ if (diskInfo?.isFile() && diskInfo.size > 0 && diskInfo.size <= maxBytes) {
27815
+ const diskBytes = await readFile7(diskFile).catch(() => void 0);
27816
+ if (diskBytes && diskBytes.length <= maxBytes) {
27817
+ const mimeType = detectRasterMimeType(diskBytes);
27818
+ if (mimeType) {
27819
+ return remember(hash2, { mimeType, bytes: diskBytes });
27820
+ }
27821
+ }
27822
+ }
27823
+ const retryUntil = retryAt.get(hash2);
27824
+ if (retryUntil !== void 0 && Date.now() < retryUntil) {
27825
+ throw new ExtensionDownloadError(`Catalog ${label} temporarily unavailable`);
27826
+ }
27827
+ let flight = pendingDownloads.get(hash2);
27828
+ if (!flight) {
27829
+ const created = (async () => {
27830
+ try {
27831
+ const bytes = await downloadExtensionBytes(targetUrl.href, maxBytes, { accept: "image/webp,image/png,image/jpeg,*/*;q=0.5" }, {
27832
+ allowUrl: publicHttpsDownload,
27833
+ allowContentType,
27834
+ timeoutMs,
27835
+ retries
27836
+ });
27837
+ const mimeType = detectRasterMimeType(bytes);
27838
+ if (!mimeType) {
27839
+ throw new ExtensionDownloadError(`Unsupported catalog ${label} image signature`);
27840
+ }
27841
+ retryAt.delete(hash2);
27842
+ const entry = remember(hash2, { mimeType, bytes });
27843
+ await atomicWriteFile(diskFile, bytes).catch(() => void 0);
27844
+ return entry;
27845
+ } catch (error62) {
27846
+ retryAt.set(hash2, Date.now() + IMAGE_FAIL_BACKOFF_MS);
27847
+ throw error62;
27848
+ }
27849
+ })().finally(() => {
27850
+ if (pendingDownloads.get(hash2) === created)
27851
+ pendingDownloads.delete(hash2);
27852
+ });
27853
+ created.catch(() => void 0);
27854
+ pendingDownloads.set(hash2, created);
27855
+ flight = created;
27856
+ }
27857
+ return raceWithSignal(flight, signal);
27858
+ };
27859
+ }
27860
+ var fetchCatalogIconImage = createCatalogImageCache({
27861
+ cacheSubdir: "extension-icons",
27862
+ maxBytes: DESKTOP_EXTENSION_ICON_MAX_BYTES,
27863
+ memoryLimit: ICON_MEMORY_LIMIT,
27864
+ label: "icon",
27865
+ timeoutMs: ICON_TIMEOUT_MS,
27866
+ retries: ICON_RETRIES
27867
+ });
27868
+ var fetchCatalogScreenshotImage = createCatalogImageCache({
27869
+ cacheSubdir: "extension-screenshots",
27870
+ maxBytes: DESKTOP_EXTENSION_SCREENSHOT_MAX_BYTES,
27871
+ memoryLimit: SCREENSHOT_MEMORY_LIMIT,
27872
+ label: "screenshot",
27873
+ timeoutMs: SCREENSHOT_TIMEOUT_MS,
27874
+ retries: SCREENSHOT_RETRIES,
27875
+ allowContentType: isAllowedCatalogImageContentType
27876
+ });
27672
27877
  async function atomicWriteFile(filePath2, data) {
27673
27878
  const dir = path13.dirname(filePath2);
27674
27879
  const tempPath = `${filePath2}.tmp-${process.pid}-${Math.random().toString(36).slice(2, 10)}`;
@@ -28047,14 +28252,14 @@ import { readdir as readdir6, readFile as readFile9, realpath as realpath7, rm a
28047
28252
  import path17 from "node:path";
28048
28253
 
28049
28254
  // packages/console-server/src/diagnostics.ts
28050
- import { open as open7, readdir as readdir5, readFile as readFile8, stat as stat3 } from "node:fs/promises";
28255
+ import { open as open7, readdir as readdir5, readFile as readFile8, stat as stat4 } from "node:fs/promises";
28051
28256
  import path16 from "node:path";
28052
28257
  var MAX_DIAGNOSTIC_FILE_BYTES = 256 * 1024;
28053
28258
  var MAX_LOG_TAIL_BYTES = 256 * 1024;
28054
28259
  var LOG_FILE_PATTERN = /^host-runtime-\d{1,10}\.log(?:\.1)?$/u;
28055
28260
  async function readBoundedJson(filePath2) {
28056
28261
  try {
28057
- const metadata = await stat3(filePath2);
28262
+ const metadata = await stat4(filePath2);
28058
28263
  if (!metadata.isFile() || metadata.size > MAX_DIAGNOSTIC_FILE_BYTES) return null;
28059
28264
  return JSON.parse(await readFile8(filePath2, "utf8"));
28060
28265
  } catch {
@@ -28127,7 +28332,7 @@ async function listLogFiles(logsDirectory) {
28127
28332
  const entries = await Promise.all(
28128
28333
  names.filter(isLogFileName).map(async (name) => {
28129
28334
  try {
28130
- const metadata = await stat3(path16.join(logsDirectory, name));
28335
+ const metadata = await stat4(path16.join(logsDirectory, name));
28131
28336
  return metadata.isFile() ? { name, size: metadata.size, modifiedAt: metadata.mtimeMs } : null;
28132
28337
  } catch {
28133
28338
  return null;
@@ -28389,7 +28594,7 @@ function launchCommand(installation, environment = process.env) {
28389
28594
 
28390
28595
  // packages/console-server/src/open.ts
28391
28596
  import { spawn as spawn4 } from "node:child_process";
28392
- import { stat as stat4 } from "node:fs/promises";
28597
+ import { stat as stat5 } from "node:fs/promises";
28393
28598
  import path23 from "node:path";
28394
28599
 
28395
28600
  // packages/console-server/src/page.ts
@@ -29647,7 +29852,7 @@ async function consoleBuildId(entryPath2, environment = process.env) {
29647
29852
  const files = [entryPath2, ...consoleBundleCandidates(path23.dirname(entryPath2))];
29648
29853
  const parts = [];
29649
29854
  for (const file2 of files) {
29650
- const metadata = await stat4(file2).catch(() => null);
29855
+ const metadata = await stat5(file2).catch(() => null);
29651
29856
  if (metadata) parts.push(`${Math.trunc(metadata.mtimeMs)}-${metadata.size}`);
29652
29857
  }
29653
29858
  const runtime = await readRuntimeMetadata(entryPath2, environment).catch(() => null);