@namzu/cli 35.0.0 → 36.1.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 (1309) hide show
  1. package/CHANGELOG.md +764 -0
  2. package/README.md +160 -394
  3. package/assets/pal-blender-mcp.py +123 -0
  4. package/assets/pal-godot-mcp-pin.json +135 -0
  5. package/assets/pal-godot-mcp.cjs +418 -0
  6. package/dist/bin-main.d.ts +3 -0
  7. package/dist/bin-main.d.ts.map +1 -0
  8. package/dist/bin.d.ts +2 -1
  9. package/dist/bin.d.ts.map +1 -1
  10. package/dist/bin.js +85 -23
  11. package/dist/bin.js.map +6 -1
  12. package/dist/boot-narrative.d.ts +16 -0
  13. package/dist/boot-narrative.d.ts.map +1 -0
  14. package/dist/checkpoints/manifest.d.ts +107 -0
  15. package/dist/checkpoints/manifest.d.ts.map +1 -0
  16. package/dist/checkpoints/store.d.ts +280 -40
  17. package/dist/checkpoints/store.d.ts.map +1 -1
  18. package/dist/checkpoints/undo-plan.d.ts +83 -0
  19. package/dist/checkpoints/undo-plan.d.ts.map +1 -0
  20. package/dist/checkpoints/wrap.d.ts +4 -0
  21. package/dist/checkpoints/wrap.d.ts.map +1 -1
  22. package/dist/chunks/acp-5CWS2GLJ.js +13448 -0
  23. package/dist/chunks/acp-5CWS2GLJ.js.map +6 -0
  24. package/dist/chunks/activity-command-HK7YJTXV.js +262 -0
  25. package/dist/chunks/activity-command-HK7YJTXV.js.map +6 -0
  26. package/dist/chunks/add-ULH5DUNX.js +712 -0
  27. package/dist/chunks/add-ULH5DUNX.js.map +6 -0
  28. package/dist/chunks/agent-UEK2U3RE.js +87 -0
  29. package/dist/chunks/agent-UEK2U3RE.js.map +6 -0
  30. package/dist/chunks/agent-session-V7JRTODS.js +46 -0
  31. package/dist/chunks/agent-session-V7JRTODS.js.map +6 -0
  32. package/dist/chunks/archive-C4A3HPLF.js +84 -0
  33. package/dist/chunks/archive-C4A3HPLF.js.map +6 -0
  34. package/dist/chunks/bin-main-EEJHRDIC.js +126 -0
  35. package/dist/chunks/bin-main-EEJHRDIC.js.map +6 -0
  36. package/dist/chunks/browser-CRX4HM4C.js +31 -0
  37. package/dist/chunks/browser-CRX4HM4C.js.map +6 -0
  38. package/dist/chunks/chat-FVBATC4E.js +101 -0
  39. package/dist/chunks/chat-FVBATC4E.js.map +6 -0
  40. package/dist/chunks/chunk-2A37JQKY.js +1355 -0
  41. package/dist/chunks/chunk-2A37JQKY.js.map +6 -0
  42. package/dist/chunks/chunk-2NJ2XUXJ.js +283 -0
  43. package/dist/chunks/chunk-2NJ2XUXJ.js.map +6 -0
  44. package/dist/chunks/chunk-4HAE7PYX.js +74 -0
  45. package/dist/chunks/chunk-4HAE7PYX.js.map +6 -0
  46. package/dist/chunks/chunk-5GRV6P5C.js +69 -0
  47. package/dist/chunks/chunk-5GRV6P5C.js.map +6 -0
  48. package/dist/chunks/chunk-5PQVJBIO.js +168 -0
  49. package/dist/chunks/chunk-5PQVJBIO.js.map +6 -0
  50. package/dist/chunks/chunk-62I7HLAP.js +1142 -0
  51. package/dist/chunks/chunk-62I7HLAP.js.map +6 -0
  52. package/dist/chunks/chunk-63CGV3XY.js +161 -0
  53. package/dist/chunks/chunk-63CGV3XY.js.map +6 -0
  54. package/dist/chunks/chunk-6LLJQ3KY.js +225 -0
  55. package/dist/chunks/chunk-6LLJQ3KY.js.map +6 -0
  56. package/dist/chunks/chunk-6YG7D7U4.js +159 -0
  57. package/dist/chunks/chunk-6YG7D7U4.js.map +6 -0
  58. package/dist/chunks/chunk-76FLAFCG.js +51 -0
  59. package/dist/chunks/chunk-76FLAFCG.js.map +6 -0
  60. package/dist/chunks/chunk-7WJOQ6EA.js +106 -0
  61. package/dist/chunks/chunk-7WJOQ6EA.js.map +6 -0
  62. package/dist/chunks/chunk-A22MBIYU.js +42 -0
  63. package/dist/chunks/chunk-A22MBIYU.js.map +6 -0
  64. package/dist/chunks/chunk-A5DWGNGR.js +73 -0
  65. package/dist/chunks/chunk-A5DWGNGR.js.map +6 -0
  66. package/dist/chunks/chunk-A5UXODFL.js +76 -0
  67. package/dist/chunks/chunk-A5UXODFL.js.map +6 -0
  68. package/dist/chunks/chunk-AHIDYIRB.js +329 -0
  69. package/dist/chunks/chunk-AHIDYIRB.js.map +6 -0
  70. package/dist/chunks/chunk-AIY4PCDR.js +164 -0
  71. package/dist/chunks/chunk-AIY4PCDR.js.map +6 -0
  72. package/dist/chunks/chunk-AK2U3N2A.js +31 -0
  73. package/dist/chunks/chunk-AK2U3N2A.js.map +6 -0
  74. package/dist/chunks/chunk-AN7FO7NS.js +247 -0
  75. package/dist/chunks/chunk-AN7FO7NS.js.map +6 -0
  76. package/dist/chunks/chunk-AXIGFKJF.js +34 -0
  77. package/dist/chunks/chunk-AXIGFKJF.js.map +6 -0
  78. package/dist/chunks/chunk-C5WBEO3X.js +46 -0
  79. package/dist/chunks/chunk-C5WBEO3X.js.map +6 -0
  80. package/dist/chunks/chunk-C5XYHYMX.js +675 -0
  81. package/dist/chunks/chunk-C5XYHYMX.js.map +6 -0
  82. package/dist/chunks/chunk-CG65NUSJ.js +115 -0
  83. package/dist/chunks/chunk-CG65NUSJ.js.map +6 -0
  84. package/dist/chunks/chunk-CHIEVVQ2.js +32 -0
  85. package/dist/chunks/chunk-CHIEVVQ2.js.map +6 -0
  86. package/dist/chunks/chunk-E5VLANCO.js +101 -0
  87. package/dist/chunks/chunk-E5VLANCO.js.map +6 -0
  88. package/dist/chunks/chunk-EBOHVFOB.js +648 -0
  89. package/dist/chunks/chunk-EBOHVFOB.js.map +6 -0
  90. package/dist/chunks/chunk-EEDZOGV4.js +47 -0
  91. package/dist/chunks/chunk-EEDZOGV4.js.map +6 -0
  92. package/dist/chunks/chunk-EIYM6TY7.js +1479 -0
  93. package/dist/chunks/chunk-EIYM6TY7.js.map +6 -0
  94. package/dist/chunks/chunk-EWKJGHRO.js +82559 -0
  95. package/dist/chunks/chunk-EWKJGHRO.js.map +6 -0
  96. package/dist/chunks/chunk-EY7UNVER.js +311 -0
  97. package/dist/chunks/chunk-EY7UNVER.js.map +6 -0
  98. package/dist/chunks/chunk-FTMTO72X.js +95 -0
  99. package/dist/chunks/chunk-FTMTO72X.js.map +6 -0
  100. package/dist/chunks/chunk-FXS3AG6B.js +25326 -0
  101. package/dist/chunks/chunk-FXS3AG6B.js.map +6 -0
  102. package/dist/chunks/chunk-GIXSS6KW.js +2228 -0
  103. package/dist/chunks/chunk-GIXSS6KW.js.map +6 -0
  104. package/dist/chunks/chunk-GMCOZ3CU.js +245 -0
  105. package/dist/chunks/chunk-GMCOZ3CU.js.map +6 -0
  106. package/dist/chunks/chunk-GNBMKISG.js +19 -0
  107. package/dist/chunks/chunk-GNBMKISG.js.map +6 -0
  108. package/dist/chunks/chunk-GWQEMJFS.js +28 -0
  109. package/dist/chunks/chunk-GWQEMJFS.js.map +6 -0
  110. package/dist/chunks/chunk-H6B6AROX.js +151 -0
  111. package/dist/chunks/chunk-H6B6AROX.js.map +6 -0
  112. package/dist/chunks/chunk-HBBB2CAC.js +75 -0
  113. package/dist/chunks/chunk-HBBB2CAC.js.map +6 -0
  114. package/dist/chunks/chunk-HE7WUOX2.js +26 -0
  115. package/dist/chunks/chunk-HE7WUOX2.js.map +6 -0
  116. package/dist/chunks/chunk-HFJHHCTY.js +303 -0
  117. package/dist/chunks/chunk-HFJHHCTY.js.map +6 -0
  118. package/dist/chunks/chunk-HPMWYIBY.js +773 -0
  119. package/dist/chunks/chunk-HPMWYIBY.js.map +6 -0
  120. package/dist/chunks/chunk-HQM2WSQT.js +106 -0
  121. package/dist/chunks/chunk-HQM2WSQT.js.map +6 -0
  122. package/dist/chunks/chunk-ITZK4B66.js +787 -0
  123. package/dist/chunks/chunk-ITZK4B66.js.map +6 -0
  124. package/dist/chunks/chunk-J72CRUNX.js +154 -0
  125. package/dist/chunks/chunk-J72CRUNX.js.map +6 -0
  126. package/dist/chunks/chunk-JORONMD3.js +18 -0
  127. package/dist/chunks/chunk-JORONMD3.js.map +6 -0
  128. package/dist/chunks/chunk-JPPC4LJF.js +271 -0
  129. package/dist/chunks/chunk-JPPC4LJF.js.map +6 -0
  130. package/dist/chunks/chunk-JV3LONAU.js +76 -0
  131. package/dist/chunks/chunk-JV3LONAU.js.map +6 -0
  132. package/dist/chunks/chunk-K76WV7TN.js +71 -0
  133. package/dist/chunks/chunk-K76WV7TN.js.map +6 -0
  134. package/dist/chunks/chunk-KCWUQRZV.js +828 -0
  135. package/dist/chunks/chunk-KCWUQRZV.js.map +6 -0
  136. package/dist/chunks/chunk-KONYGNG6.js +7661 -0
  137. package/dist/chunks/chunk-KONYGNG6.js.map +6 -0
  138. package/dist/chunks/chunk-KU3W6IHV.js +109 -0
  139. package/dist/chunks/chunk-KU3W6IHV.js.map +6 -0
  140. package/dist/chunks/chunk-LQMHASKR.js +171 -0
  141. package/dist/chunks/chunk-LQMHASKR.js.map +6 -0
  142. package/dist/chunks/chunk-LXB3S4IC.js +19 -0
  143. package/dist/chunks/chunk-LXB3S4IC.js.map +6 -0
  144. package/dist/chunks/chunk-MZP6SH3M.js +3497 -0
  145. package/dist/chunks/chunk-MZP6SH3M.js.map +6 -0
  146. package/dist/chunks/chunk-N5IF64K3.js +1858 -0
  147. package/dist/chunks/chunk-N5IF64K3.js.map +6 -0
  148. package/dist/chunks/chunk-NADQQMMG.js +46 -0
  149. package/dist/chunks/chunk-NADQQMMG.js.map +6 -0
  150. package/dist/chunks/chunk-NQY5P2EB.js +20 -0
  151. package/dist/chunks/chunk-NQY5P2EB.js.map +6 -0
  152. package/dist/chunks/chunk-NUGPLXVK.js +228 -0
  153. package/dist/chunks/chunk-NUGPLXVK.js.map +6 -0
  154. package/dist/chunks/chunk-O7DBCVNY.js +110 -0
  155. package/dist/chunks/chunk-O7DBCVNY.js.map +6 -0
  156. package/dist/chunks/chunk-OEW7CJKK.js +140 -0
  157. package/dist/chunks/chunk-OEW7CJKK.js.map +6 -0
  158. package/dist/chunks/chunk-OH6TB27S.js +111 -0
  159. package/dist/chunks/chunk-OH6TB27S.js.map +6 -0
  160. package/dist/chunks/chunk-OLPOM3DR.js +127 -0
  161. package/dist/chunks/chunk-OLPOM3DR.js.map +6 -0
  162. package/dist/chunks/chunk-PYG7DZ2D.js +380 -0
  163. package/dist/chunks/chunk-PYG7DZ2D.js.map +6 -0
  164. package/dist/chunks/chunk-Q24K7536.js +661 -0
  165. package/dist/chunks/chunk-Q24K7536.js.map +6 -0
  166. package/dist/chunks/chunk-Q5YM2GCX.js +283 -0
  167. package/dist/chunks/chunk-Q5YM2GCX.js.map +6 -0
  168. package/dist/chunks/chunk-R7DCDBRN.js +106 -0
  169. package/dist/chunks/chunk-R7DCDBRN.js.map +6 -0
  170. package/dist/chunks/chunk-RC6X3ZY6.js +1439 -0
  171. package/dist/chunks/chunk-RC6X3ZY6.js.map +6 -0
  172. package/dist/chunks/chunk-SGS435PR.js +11111 -0
  173. package/dist/chunks/chunk-SGS435PR.js.map +6 -0
  174. package/dist/chunks/chunk-SKKWMMFP.js +474 -0
  175. package/dist/chunks/chunk-SKKWMMFP.js.map +6 -0
  176. package/dist/chunks/chunk-SRU3MDHZ.js +75 -0
  177. package/dist/chunks/chunk-SRU3MDHZ.js.map +6 -0
  178. package/dist/chunks/chunk-TBIX6JRE.js +24 -0
  179. package/dist/chunks/chunk-TBIX6JRE.js.map +6 -0
  180. package/dist/chunks/chunk-THNCQJ33.js +11265 -0
  181. package/dist/chunks/chunk-THNCQJ33.js.map +6 -0
  182. package/dist/chunks/chunk-THZXXVHM.js +2953 -0
  183. package/dist/chunks/chunk-THZXXVHM.js.map +6 -0
  184. package/dist/chunks/chunk-TIGWWAJI.js +765 -0
  185. package/dist/chunks/chunk-TIGWWAJI.js.map +6 -0
  186. package/dist/chunks/chunk-UDBEU2FR.js +97 -0
  187. package/dist/chunks/chunk-UDBEU2FR.js.map +6 -0
  188. package/dist/chunks/chunk-UOOQPODR.js +257 -0
  189. package/dist/chunks/chunk-UOOQPODR.js.map +6 -0
  190. package/dist/chunks/chunk-US5ZFPAU.js +400 -0
  191. package/dist/chunks/chunk-US5ZFPAU.js.map +6 -0
  192. package/dist/chunks/chunk-UWWGSDZ5.js +134 -0
  193. package/dist/chunks/chunk-UWWGSDZ5.js.map +6 -0
  194. package/dist/chunks/chunk-UXVYJWN5.js +1373 -0
  195. package/dist/chunks/chunk-UXVYJWN5.js.map +6 -0
  196. package/dist/chunks/chunk-V7TQR6AR.js +818 -0
  197. package/dist/chunks/chunk-V7TQR6AR.js.map +6 -0
  198. package/dist/chunks/chunk-VRL2WNQN.js +7534 -0
  199. package/dist/chunks/chunk-VRL2WNQN.js.map +6 -0
  200. package/dist/chunks/chunk-WATMFOHB.js +319 -0
  201. package/dist/chunks/chunk-WATMFOHB.js.map +6 -0
  202. package/dist/chunks/chunk-WHODOMXA.js +132 -0
  203. package/dist/chunks/chunk-WHODOMXA.js.map +6 -0
  204. package/dist/chunks/chunk-WM2JEUGV.js +207 -0
  205. package/dist/chunks/chunk-WM2JEUGV.js.map +6 -0
  206. package/dist/chunks/chunk-XEUQN4JC.js +54 -0
  207. package/dist/chunks/chunk-XEUQN4JC.js.map +6 -0
  208. package/dist/chunks/chunk-XHOD3RDN.js +517 -0
  209. package/dist/chunks/chunk-XHOD3RDN.js.map +6 -0
  210. package/dist/chunks/chunk-Y7B67G22.js +26 -0
  211. package/dist/chunks/chunk-Y7B67G22.js.map +6 -0
  212. package/dist/chunks/chunk-ZKEWE6K4.js +399 -0
  213. package/dist/chunks/chunk-ZKEWE6K4.js.map +6 -0
  214. package/dist/chunks/chunk-ZPR4IMRT.js +36 -0
  215. package/dist/chunks/chunk-ZPR4IMRT.js.map +6 -0
  216. package/dist/chunks/chunk-ZWA2JRJV.js +45 -0
  217. package/dist/chunks/chunk-ZWA2JRJV.js.map +6 -0
  218. package/dist/chunks/cli-runtime-7YAOEJGS.js +129 -0
  219. package/dist/chunks/cli-runtime-7YAOEJGS.js.map +6 -0
  220. package/dist/chunks/commands-QPVRB3RK.js +21 -0
  221. package/dist/chunks/commands-QPVRB3RK.js.map +6 -0
  222. package/dist/chunks/computer-GXDY4H35.js +493 -0
  223. package/dist/chunks/computer-GXDY4H35.js.map +6 -0
  224. package/dist/chunks/crash-report-S3BTEPYR.js +21 -0
  225. package/dist/chunks/crash-report-S3BTEPYR.js.map +6 -0
  226. package/dist/chunks/devtools-LBE4PAQN.js +3851 -0
  227. package/dist/chunks/devtools-LBE4PAQN.js.map +6 -0
  228. package/dist/chunks/dist-3GJFRS2X.js +520 -0
  229. package/dist/chunks/dist-3GJFRS2X.js.map +6 -0
  230. package/dist/chunks/dist-BFC7XUCT.js +555 -0
  231. package/dist/chunks/dist-BFC7XUCT.js.map +6 -0
  232. package/dist/chunks/dist-ERN5DRKK.js +1415 -0
  233. package/dist/chunks/dist-ERN5DRKK.js.map +6 -0
  234. package/dist/chunks/dist-EY3OJBQH.js +1339 -0
  235. package/dist/chunks/dist-EY3OJBQH.js.map +6 -0
  236. package/dist/chunks/dist-G42HPNIE.js +514 -0
  237. package/dist/chunks/dist-G42HPNIE.js.map +6 -0
  238. package/dist/chunks/dist-SKRHHPUR.js +1018 -0
  239. package/dist/chunks/dist-SKRHHPUR.js.map +6 -0
  240. package/dist/chunks/dist-Z47L7ZAJ.js +40654 -0
  241. package/dist/chunks/dist-Z47L7ZAJ.js.map +6 -0
  242. package/dist/chunks/doctor-IE3PLXZK.js +28 -0
  243. package/dist/chunks/doctor-IE3PLXZK.js.map +6 -0
  244. package/dist/chunks/drain-ESXUKOE6.js +471 -0
  245. package/dist/chunks/drain-ESXUKOE6.js.map +6 -0
  246. package/dist/chunks/endpoint-M2DDENPP.js +15 -0
  247. package/dist/chunks/endpoint-M2DDENPP.js.map +6 -0
  248. package/dist/chunks/eval-53UONRWR.js +187 -0
  249. package/dist/chunks/eval-53UONRWR.js.map +6 -0
  250. package/dist/chunks/exec-COV235L5.js +1284 -0
  251. package/dist/chunks/exec-COV235L5.js.map +6 -0
  252. package/dist/chunks/home-QS7RBP34.js +16 -0
  253. package/dist/chunks/home-QS7RBP34.js.map +6 -0
  254. package/dist/chunks/host-queries-LDEBHKBX.js +152 -0
  255. package/dist/chunks/host-queries-LDEBHKBX.js.map +6 -0
  256. package/dist/chunks/lib-KXZZJJG2.js +2657 -0
  257. package/dist/chunks/lib-KXZZJJG2.js.map +6 -0
  258. package/dist/chunks/lifecycle-6NF6NJNV.js +63 -0
  259. package/dist/chunks/lifecycle-6NF6NJNV.js.map +6 -0
  260. package/dist/chunks/list-DQZU7NEF.js +293 -0
  261. package/dist/chunks/list-DQZU7NEF.js.map +6 -0
  262. package/dist/chunks/login-IQGNP5XY.js +29 -0
  263. package/dist/chunks/login-IQGNP5XY.js.map +6 -0
  264. package/dist/chunks/logs-KSG7SFAB.js +116 -0
  265. package/dist/chunks/logs-KSG7SFAB.js.map +6 -0
  266. package/dist/chunks/mcp-WFXKXGNM.js +763 -0
  267. package/dist/chunks/mcp-WFXKXGNM.js.map +6 -0
  268. package/dist/chunks/message-command-O7ZH4I4C.js +170 -0
  269. package/dist/chunks/message-command-O7ZH4I4C.js.map +6 -0
  270. package/dist/chunks/node-QB2FA2ZB.js +916 -0
  271. package/dist/chunks/node-QB2FA2ZB.js.map +6 -0
  272. package/dist/chunks/operator-tools-LTPV3CH5.js +115 -0
  273. package/dist/chunks/operator-tools-LTPV3CH5.js.map +6 -0
  274. package/dist/chunks/output-schema-UM3P5AOR.js +11 -0
  275. package/dist/chunks/output-schema-UM3P5AOR.js.map +6 -0
  276. package/dist/chunks/pal-GBYJHBP3.js +200 -0
  277. package/dist/chunks/pal-GBYJHBP3.js.map +6 -0
  278. package/dist/chunks/paths-DXYFKIJU.js +10 -0
  279. package/dist/chunks/paths-DXYFKIJU.js.map +6 -0
  280. package/dist/chunks/pica-WNHDDIFX.js +1736 -0
  281. package/dist/chunks/pica-WNHDDIFX.js.map +6 -0
  282. package/dist/chunks/providers-J42J2PDA.js +160 -0
  283. package/dist/chunks/providers-J42J2PDA.js.map +6 -0
  284. package/dist/chunks/resident-7D6IM5LP.js +1314 -0
  285. package/dist/chunks/resident-7D6IM5LP.js.map +6 -0
  286. package/dist/chunks/resume-command-XZWGUXRK.js +22 -0
  287. package/dist/chunks/resume-command-XZWGUXRK.js.map +6 -0
  288. package/dist/chunks/schedule-JLIOF3MS.js +143 -0
  289. package/dist/chunks/schedule-JLIOF3MS.js.map +6 -0
  290. package/dist/chunks/serve-S7UWNIR3.js +21 -0
  291. package/dist/chunks/serve-S7UWNIR3.js.map +6 -0
  292. package/dist/chunks/service-YBU5VTKQ.js +1633 -0
  293. package/dist/chunks/service-YBU5VTKQ.js.map +6 -0
  294. package/dist/chunks/session-step-2HJSIJNN.js +26 -0
  295. package/dist/chunks/session-step-2HJSIJNN.js.map +6 -0
  296. package/dist/chunks/skills-HV2MOBEW.js +282 -0
  297. package/dist/chunks/skills-HV2MOBEW.js.map +6 -0
  298. package/dist/chunks/state-6HV3D3O4.js +717 -0
  299. package/dist/chunks/state-6HV3D3O4.js.map +6 -0
  300. package/dist/chunks/store-6J2MUGON.js +82 -0
  301. package/dist/chunks/store-6J2MUGON.js.map +6 -0
  302. package/dist/chunks/store-GDP2EW27.js +34 -0
  303. package/dist/chunks/store-GDP2EW27.js.map +6 -0
  304. package/dist/chunks/store-VXNKMMNW.js +42 -0
  305. package/dist/chunks/store-VXNKMMNW.js.map +6 -0
  306. package/dist/chunks/tui-DDWX2WYH.js +56903 -0
  307. package/dist/chunks/tui-DDWX2WYH.js.map +6 -0
  308. package/dist/chunks/upgrade-MC5JB7DK.js +315 -0
  309. package/dist/chunks/upgrade-MC5JB7DK.js.map +6 -0
  310. package/dist/chunks/webapi-6HUHZUAH.js +2715 -0
  311. package/dist/chunks/webapi-6HUHZUAH.js.map +6 -0
  312. package/dist/chunks/worktree-6YPRX6SU.js +116 -0
  313. package/dist/chunks/worktree-6YPRX6SU.js.map +6 -0
  314. package/dist/cli-runtime.d.ts +19 -0
  315. package/dist/cli-runtime.d.ts.map +1 -0
  316. package/dist/cli.d.ts +0 -15
  317. package/dist/cli.d.ts.map +1 -1
  318. package/dist/commands/acp-harness.d.ts +64 -0
  319. package/dist/commands/acp-harness.d.ts.map +1 -0
  320. package/dist/commands/acp-provider-retry.d.ts +27 -0
  321. package/dist/commands/acp-provider-retry.d.ts.map +1 -0
  322. package/dist/commands/acp.d.ts +134 -3
  323. package/dist/commands/acp.d.ts.map +1 -1
  324. package/dist/commands/computer.d.ts +3 -0
  325. package/dist/commands/computer.d.ts.map +1 -0
  326. package/dist/commands/desktop-host-changes.d.ts +65 -0
  327. package/dist/commands/desktop-host-changes.d.ts.map +1 -0
  328. package/dist/commands/desktop-host-header.d.ts +30 -0
  329. package/dist/commands/desktop-host-header.d.ts.map +1 -0
  330. package/dist/commands/desktop-host.d.ts +354 -0
  331. package/dist/commands/desktop-host.d.ts.map +1 -0
  332. package/dist/commands/desktop-model-catalogue.d.ts +25 -0
  333. package/dist/commands/desktop-model-catalogue.d.ts.map +1 -0
  334. package/dist/commands/effort-levels.d.ts +3 -0
  335. package/dist/commands/effort-levels.d.ts.map +1 -0
  336. package/dist/commands/exec-flags.d.ts +4 -0
  337. package/dist/commands/exec-flags.d.ts.map +1 -1
  338. package/dist/commands/exec.d.ts.map +1 -1
  339. package/dist/commands/lazy.d.ts +20 -0
  340. package/dist/commands/lazy.d.ts.map +1 -0
  341. package/dist/commands/manifest.d.ts +33 -0
  342. package/dist/commands/manifest.d.ts.map +1 -0
  343. package/dist/commands/pal.d.ts +5 -0
  344. package/dist/commands/pal.d.ts.map +1 -0
  345. package/dist/commands/permission-preview.d.ts +38 -0
  346. package/dist/commands/permission-preview.d.ts.map +1 -0
  347. package/dist/commands/registry.d.ts +10 -0
  348. package/dist/commands/registry.d.ts.map +1 -1
  349. package/dist/commands/serve.d.ts +1 -12
  350. package/dist/commands/serve.d.ts.map +1 -1
  351. package/dist/commands/stdin.d.ts.map +1 -1
  352. package/dist/commands/upgrade.d.ts +14 -0
  353. package/dist/commands/upgrade.d.ts.map +1 -1
  354. package/dist/compile-cache-enable.d.ts +2 -0
  355. package/dist/compile-cache-enable.d.ts.map +1 -0
  356. package/dist/compile-cache.d.ts +53 -0
  357. package/dist/compile-cache.d.ts.map +1 -0
  358. package/dist/computer/bundle.d.ts +18 -0
  359. package/dist/computer/bundle.d.ts.map +1 -0
  360. package/dist/computer/run.d.ts +26 -0
  361. package/dist/computer/run.d.ts.map +1 -0
  362. package/dist/computer/sentences.d.ts +30 -0
  363. package/dist/computer/sentences.d.ts.map +1 -0
  364. package/dist/config/load.d.ts +10 -1
  365. package/dist/config/load.d.ts.map +1 -1
  366. package/dist/context/capabilities.d.ts +25 -2
  367. package/dist/context/capabilities.d.ts.map +1 -1
  368. package/dist/context/runtime-message.d.ts.map +1 -1
  369. package/dist/crash-report.d.ts +22 -0
  370. package/dist/crash-report.d.ts.map +1 -0
  371. package/dist/debug-requested.d.ts +7 -0
  372. package/dist/debug-requested.d.ts.map +1 -0
  373. package/dist/doctor/checks/credentials.d.ts.map +1 -1
  374. package/dist/exit-codes.d.ts +9 -1
  375. package/dist/exit-codes.d.ts.map +1 -1
  376. package/dist/index.js +105 -17
  377. package/dist/index.js.map +6 -1
  378. package/dist/integrations/harness/claude-adapter.d.ts +20 -0
  379. package/dist/integrations/harness/claude-adapter.d.ts.map +1 -0
  380. package/dist/integrations/harness/claude-protocol.d.ts +67 -0
  381. package/dist/integrations/harness/claude-protocol.d.ts.map +1 -0
  382. package/dist/integrations/harness/codex-adapter.d.ts +80 -0
  383. package/dist/integrations/harness/codex-adapter.d.ts.map +1 -0
  384. package/dist/integrations/harness/codex-protocol.d.ts +22 -0
  385. package/dist/integrations/harness/codex-protocol.d.ts.map +1 -0
  386. package/dist/integrations/harness/model-cache.d.ts +16 -0
  387. package/dist/integrations/harness/model-cache.d.ts.map +1 -0
  388. package/dist/integrations/harness/native-executable.d.ts +8 -0
  389. package/dist/integrations/harness/native-executable.d.ts.map +1 -0
  390. package/dist/integrations/harness/process.d.ts +25 -0
  391. package/dist/integrations/harness/process.d.ts.map +1 -0
  392. package/dist/integrations/peers/runtime.d.ts +64 -0
  393. package/dist/integrations/peers/runtime.d.ts.map +1 -0
  394. package/dist/integrations/plugins/inventory.d.ts +27 -0
  395. package/dist/integrations/plugins/inventory.d.ts.map +1 -0
  396. package/dist/integrations/providers/composer-settings.d.ts +33 -0
  397. package/dist/integrations/providers/composer-settings.d.ts.map +1 -0
  398. package/dist/integrations/providers/connections.d.ts +37 -0
  399. package/dist/integrations/providers/connections.d.ts.map +1 -0
  400. package/dist/integrations/providers/credential-store.d.ts +35 -0
  401. package/dist/integrations/providers/credential-store.d.ts.map +1 -1
  402. package/dist/integrations/providers/discover.d.ts +27 -1
  403. package/dist/integrations/providers/discover.d.ts.map +1 -1
  404. package/dist/integrations/providers/index.d.ts +2 -2
  405. package/dist/integrations/providers/index.d.ts.map +1 -1
  406. package/dist/integrations/providers/picker-operation.d.ts +6 -0
  407. package/dist/integrations/providers/picker-operation.d.ts.map +1 -0
  408. package/dist/integrations/providers/setup.d.ts +16 -1
  409. package/dist/integrations/providers/setup.d.ts.map +1 -1
  410. package/dist/integrations/resident/runner-worker.js +190 -161
  411. package/dist/integrations/resident/runner-worker.js.map +6 -1
  412. package/dist/integrations/sessions/display-title.d.ts +8 -0
  413. package/dist/integrations/sessions/display-title.d.ts.map +1 -1
  414. package/dist/integrations/sessions/store.d.ts +23 -9
  415. package/dist/integrations/sessions/store.d.ts.map +1 -1
  416. package/dist/integrations/sessions/task-context.d.ts +1 -1
  417. package/dist/integrations/sessions/task-context.d.ts.map +1 -1
  418. package/dist/integrations/sessions/transcript-export.d.ts.map +1 -1
  419. package/dist/integrations/subagents/activity.d.ts +9 -6
  420. package/dist/integrations/subagents/activity.d.ts.map +1 -1
  421. package/dist/integrations/subagents/operator-journal.d.ts +20 -0
  422. package/dist/integrations/subagents/operator-journal.d.ts.map +1 -0
  423. package/dist/integrations/subagents/runtime.d.ts +11 -0
  424. package/dist/integrations/subagents/runtime.d.ts.map +1 -1
  425. package/dist/integrations/trust/store.d.ts +14 -0
  426. package/dist/integrations/trust/store.d.ts.map +1 -1
  427. package/dist/integrations/web/search.d.ts +1 -1
  428. package/dist/pals/actions.d.ts +57 -0
  429. package/dist/pals/actions.d.ts.map +1 -0
  430. package/dist/pals/activity-command.d.ts +3 -0
  431. package/dist/pals/activity-command.d.ts.map +1 -0
  432. package/dist/pals/activity.d.ts +18 -0
  433. package/dist/pals/activity.d.ts.map +1 -0
  434. package/dist/pals/agent-session.d.ts +19 -0
  435. package/dist/pals/agent-session.d.ts.map +1 -0
  436. package/dist/pals/channel-actions.d.ts +5 -0
  437. package/dist/pals/channel-actions.d.ts.map +1 -0
  438. package/dist/pals/channel-local.d.ts +7 -0
  439. package/dist/pals/channel-local.d.ts.map +1 -0
  440. package/dist/pals/channel.d.ts +20 -0
  441. package/dist/pals/channel.d.ts.map +1 -0
  442. package/dist/pals/chat.d.ts +6 -0
  443. package/dist/pals/chat.d.ts.map +1 -0
  444. package/dist/pals/communication.d.ts +47 -0
  445. package/dist/pals/communication.d.ts.map +1 -0
  446. package/dist/pals/conversations.d.ts +26 -0
  447. package/dist/pals/conversations.d.ts.map +1 -0
  448. package/dist/pals/desktop-communication.d.ts +111 -0
  449. package/dist/pals/desktop-communication.d.ts.map +1 -0
  450. package/dist/pals/dispatch.d.ts +13 -0
  451. package/dist/pals/dispatch.d.ts.map +1 -0
  452. package/dist/pals/environment.d.ts +103 -0
  453. package/dist/pals/environment.d.ts.map +1 -0
  454. package/dist/pals/guest-mcp-transport.d.ts +28 -0
  455. package/dist/pals/guest-mcp-transport.d.ts.map +1 -0
  456. package/dist/pals/guest-mcp.d.ts +22 -0
  457. package/dist/pals/guest-mcp.d.ts.map +1 -0
  458. package/dist/pals/inbox-start.d.ts +35 -0
  459. package/dist/pals/inbox-start.d.ts.map +1 -0
  460. package/dist/pals/message-command.d.ts +3 -0
  461. package/dist/pals/message-command.d.ts.map +1 -0
  462. package/dist/pals/operator-tools.d.ts +23 -0
  463. package/dist/pals/operator-tools.d.ts.map +1 -0
  464. package/dist/pals/public-transcript.d.ts +4 -0
  465. package/dist/pals/public-transcript.d.ts.map +1 -0
  466. package/dist/pals/review.d.ts +16 -0
  467. package/dist/pals/review.d.ts.map +1 -0
  468. package/dist/pals/store.d.ts +16 -0
  469. package/dist/pals/store.d.ts.map +1 -0
  470. package/dist/pals/tui-session.d.ts +11 -0
  471. package/dist/pals/tui-session.d.ts.map +1 -0
  472. package/dist/permissions/mode-names.d.ts +2 -0
  473. package/dist/permissions/mode-names.d.ts.map +1 -0
  474. package/dist/resume-invocation.d.ts +1 -1
  475. package/dist/resume-invocation.d.ts.map +1 -1
  476. package/dist/resume-shell.d.ts +8 -0
  477. package/dist/resume-shell.d.ts.map +1 -0
  478. package/dist/schedule/build.d.ts +12 -3
  479. package/dist/schedule/build.d.ts.map +1 -1
  480. package/dist/schedule/commands/add.d.ts +1 -1
  481. package/dist/schedule/commands/add.d.ts.map +1 -1
  482. package/dist/schedule/commands/lifecycle.d.ts.map +1 -1
  483. package/dist/schedule/commands/list.d.ts +3 -1
  484. package/dist/schedule/commands/list.d.ts.map +1 -1
  485. package/dist/schedule/daemon/daemon.d.ts +2 -0
  486. package/dist/schedule/daemon/daemon.d.ts.map +1 -1
  487. package/dist/schedule/delivery.d.ts +66 -0
  488. package/dist/schedule/delivery.d.ts.map +1 -0
  489. package/dist/schedule/fire/fire.d.ts +1 -1
  490. package/dist/schedule/fire/fire.d.ts.map +1 -1
  491. package/dist/schedule/fire/run-script.d.ts +2 -2
  492. package/dist/schedule/fire/run-script.d.ts.map +1 -1
  493. package/dist/schedule/fire/script-report.d.ts +31 -0
  494. package/dist/schedule/fire/script-report.d.ts.map +1 -0
  495. package/dist/schedule/floor.d.ts +1 -1
  496. package/dist/schedule/floor.d.ts.map +1 -1
  497. package/dist/schedule/folder.d.ts +6 -0
  498. package/dist/schedule/folder.d.ts.map +1 -1
  499. package/dist/schedule/resume-command.d.ts +3 -3
  500. package/dist/schedule/resume-command.d.ts.map +1 -1
  501. package/dist/schedule/store/history.d.ts.map +1 -1
  502. package/dist/schedule/store/jobs.d.ts +6 -6
  503. package/dist/schedule/store/jobs.d.ts.map +1 -1
  504. package/dist/schedule/store/script-state.d.ts +31 -0
  505. package/dist/schedule/store/script-state.d.ts.map +1 -0
  506. package/dist/schedule/store/state.d.ts +4 -2
  507. package/dist/schedule/store/state.d.ts.map +1 -1
  508. package/dist/schedule/types.d.ts +61 -16
  509. package/dist/schedule/types.d.ts.map +1 -1
  510. package/dist/skills/store.d.ts.map +1 -1
  511. package/dist/terminal/host.d.ts +22 -0
  512. package/dist/terminal/host.d.ts.map +1 -0
  513. package/dist/terminal/manager.d.ts +124 -0
  514. package/dist/terminal/manager.d.ts.map +1 -0
  515. package/dist/terminal/protocol.d.ts +162 -0
  516. package/dist/terminal/protocol.d.ts.map +1 -0
  517. package/dist/terminal/pty.d.ts +85 -0
  518. package/dist/terminal/pty.d.ts.map +1 -0
  519. package/dist/terminal/ring.d.ts +23 -0
  520. package/dist/terminal/ring.d.ts.map +1 -0
  521. package/dist/terminal/screen.d.ts +31 -0
  522. package/dist/terminal/screen.d.ts.map +1 -0
  523. package/dist/termination-state.d.ts +19 -0
  524. package/dist/termination-state.d.ts.map +1 -0
  525. package/dist/termination.d.ts +2 -9
  526. package/dist/termination.d.ts.map +1 -1
  527. package/dist/tui/AgentExplorer.d.ts +4 -1
  528. package/dist/tui/AgentExplorer.d.ts.map +1 -1
  529. package/dist/tui/App.d.ts.map +1 -1
  530. package/dist/tui/BackgroundJobsPanel.d.ts.map +1 -1
  531. package/dist/tui/BrandHeader.d.ts.map +1 -1
  532. package/dist/tui/ChildComposer.d.ts +22 -0
  533. package/dist/tui/ChildComposer.d.ts.map +1 -0
  534. package/dist/tui/ChoicePicker.d.ts.map +1 -1
  535. package/dist/tui/Composer.d.ts +21 -3
  536. package/dist/tui/Composer.d.ts.map +1 -1
  537. package/dist/tui/ComposerFrame.d.ts.map +1 -1
  538. package/dist/tui/CopyPicker.d.ts.map +1 -1
  539. package/dist/tui/EditPromptPicker.d.ts.map +1 -1
  540. package/dist/tui/EffortSlider.d.ts.map +1 -1
  541. package/dist/tui/LiveActivity.d.ts +7 -1
  542. package/dist/tui/LiveActivity.d.ts.map +1 -1
  543. package/dist/tui/Markdown.d.ts.map +1 -1
  544. package/dist/tui/PendingInputPanel.d.ts.map +1 -1
  545. package/dist/tui/PermissionOverlay.d.ts.map +1 -1
  546. package/dist/tui/Picker.d.ts.map +1 -1
  547. package/dist/tui/ProviderSetup.d.ts.map +1 -1
  548. package/dist/tui/ResumePicker.d.ts.map +1 -1
  549. package/dist/tui/SaveSkillOverlay.d.ts.map +1 -1
  550. package/dist/tui/ScheduleReviewOverlay.d.ts +1 -1
  551. package/dist/tui/ScheduleReviewOverlay.d.ts.map +1 -1
  552. package/dist/tui/StatusBar.d.ts +7 -1
  553. package/dist/tui/StatusBar.d.ts.map +1 -1
  554. package/dist/tui/StatusPanel.d.ts.map +1 -1
  555. package/dist/tui/TextPrompt.d.ts.map +1 -1
  556. package/dist/tui/ToolOutputViewer.d.ts.map +1 -1
  557. package/dist/tui/Transcript.d.ts +3 -0
  558. package/dist/tui/Transcript.d.ts.map +1 -1
  559. package/dist/tui/TranscriptScrollView.d.ts +23 -0
  560. package/dist/tui/TranscriptScrollView.d.ts.map +1 -0
  561. package/dist/tui/TrustPrompt.d.ts +8 -0
  562. package/dist/tui/TrustPrompt.d.ts.map +1 -1
  563. package/dist/tui/agent.d.ts +125 -3
  564. package/dist/tui/agent.d.ts.map +1 -1
  565. package/dist/tui/browser-notices.d.ts.map +1 -1
  566. package/dist/tui/capability-notice.d.ts +38 -0
  567. package/dist/tui/capability-notice.d.ts.map +1 -0
  568. package/dist/tui/console-input.d.ts +31 -0
  569. package/dist/tui/console-input.d.ts.map +1 -0
  570. package/dist/tui/conversation-evidence-view.d.ts.map +1 -1
  571. package/dist/tui/credential-entry.d.ts.map +1 -1
  572. package/dist/tui/exit-summary.d.ts +9 -1
  573. package/dist/tui/exit-summary.d.ts.map +1 -1
  574. package/dist/tui/external-editor.d.ts.map +1 -1
  575. package/dist/tui/index.d.ts.map +1 -1
  576. package/dist/tui/key-hints.d.ts +51 -0
  577. package/dist/tui/key-hints.d.ts.map +1 -0
  578. package/dist/tui/launch-settings.d.ts +34 -0
  579. package/dist/tui/launch-settings.d.ts.map +1 -0
  580. package/dist/tui/log-pane.d.ts.map +1 -1
  581. package/dist/tui/model-choices.d.ts +39 -1
  582. package/dist/tui/model-choices.d.ts.map +1 -1
  583. package/dist/tui/model-search.d.ts +4 -1
  584. package/dist/tui/model-search.d.ts.map +1 -1
  585. package/dist/tui/output-size-watch.d.ts +32 -0
  586. package/dist/tui/output-size-watch.d.ts.map +1 -0
  587. package/dist/tui/permission-review.d.ts.map +1 -1
  588. package/dist/tui/person-terms.d.ts +58 -0
  589. package/dist/tui/person-terms.d.ts.map +1 -0
  590. package/dist/tui/plain-failure.d.ts +27 -0
  591. package/dist/tui/plain-failure.d.ts.map +1 -0
  592. package/dist/tui/plain-interruption.d.ts +46 -0
  593. package/dist/tui/plain-interruption.d.ts.map +1 -0
  594. package/dist/tui/provider-list.d.ts.map +1 -1
  595. package/dist/tui/render-mode.d.ts +19 -0
  596. package/dist/tui/render-mode.d.ts.map +1 -0
  597. package/dist/tui/schedule/host-commands.d.ts +2 -9
  598. package/dist/tui/schedule/host-commands.d.ts.map +1 -1
  599. package/dist/tui/schedule/integration.d.ts +8 -0
  600. package/dist/tui/schedule/integration.d.ts.map +1 -1
  601. package/dist/tui/schedule/source-deliveries.d.ts +37 -0
  602. package/dist/tui/schedule/source-deliveries.d.ts.map +1 -0
  603. package/dist/tui/schedule/startup.d.ts.map +1 -1
  604. package/dist/tui/schedule/tool-host.d.ts +3 -1
  605. package/dist/tui/schedule/tool-host.d.ts.map +1 -1
  606. package/dist/tui/setup-text.d.ts +14 -0
  607. package/dist/tui/setup-text.d.ts.map +1 -0
  608. package/dist/tui/shell-escape.d.ts.map +1 -1
  609. package/dist/tui/skills/suggest-setting.d.ts.map +1 -1
  610. package/dist/tui/slashCommands.d.ts +4 -1
  611. package/dist/tui/slashCommands.d.ts.map +1 -1
  612. package/dist/tui/terminal-choice-text.d.ts +7 -0
  613. package/dist/tui/terminal-choice-text.d.ts.map +1 -1
  614. package/dist/tui/tidy-tool-output.d.ts +83 -0
  615. package/dist/tui/tidy-tool-output.d.ts.map +1 -0
  616. package/dist/tui/tool-presentation.d.ts +6 -0
  617. package/dist/tui/tool-presentation.d.ts.map +1 -0
  618. package/dist/tui/transcript-scroll.d.ts +73 -0
  619. package/dist/tui/transcript-scroll.d.ts.map +1 -0
  620. package/dist/tui/triggers/copy.d.ts.map +1 -1
  621. package/dist/tui/triggers/setting.d.ts.map +1 -1
  622. package/dist/tui/turn-interruption.d.ts +1 -1
  623. package/dist/tui/turn-interruption.d.ts.map +1 -1
  624. package/dist/tui/turn-limits-settings.d.ts +4 -4
  625. package/dist/tui/turn-limits-settings.d.ts.map +1 -1
  626. package/dist/tui/types.d.ts +10 -0
  627. package/dist/tui/types.d.ts.map +1 -1
  628. package/dist/tui/web-activity.d.ts +3 -2
  629. package/dist/tui/web-activity.d.ts.map +1 -1
  630. package/dist/tui/zen-free-refusal.d.ts +17 -0
  631. package/dist/tui/zen-free-refusal.d.ts.map +1 -0
  632. package/dist/usage-error.d.ts +15 -0
  633. package/dist/usage-error.d.ts.map +1 -0
  634. package/dist/warning-filter.d.ts +30 -0
  635. package/dist/warning-filter.d.ts.map +1 -0
  636. package/package.json +21 -10
  637. package/skills/schedule-task/SKILL.md +74 -20
  638. package/dist/browser/commands.js +0 -365
  639. package/dist/browser/commands.js.map +0 -1
  640. package/dist/browser/control.js +0 -140
  641. package/dist/browser/control.js.map +0 -1
  642. package/dist/browser/describe.js +0 -27
  643. package/dist/browser/describe.js.map +0 -1
  644. package/dist/checkpoints/store.js +0 -192
  645. package/dist/checkpoints/store.js.map +0 -1
  646. package/dist/checkpoints/wrap.js +0 -37
  647. package/dist/checkpoints/wrap.js.map +0 -1
  648. package/dist/cli.js +0 -602
  649. package/dist/cli.js.map +0 -1
  650. package/dist/commands/acp.js +0 -388
  651. package/dist/commands/acp.js.map +0 -1
  652. package/dist/commands/archive.js +0 -65
  653. package/dist/commands/archive.js.map +0 -1
  654. package/dist/commands/browser.js +0 -16
  655. package/dist/commands/browser.js.map +0 -1
  656. package/dist/commands/doctor.js +0 -267
  657. package/dist/commands/doctor.js.map +0 -1
  658. package/dist/commands/drain.js +0 -498
  659. package/dist/commands/drain.js.map +0 -1
  660. package/dist/commands/eval.js +0 -237
  661. package/dist/commands/eval.js.map +0 -1
  662. package/dist/commands/exec-flags.js +0 -334
  663. package/dist/commands/exec-flags.js.map +0 -1
  664. package/dist/commands/exec-json.js +0 -497
  665. package/dist/commands/exec-json.js.map +0 -1
  666. package/dist/commands/exec.js +0 -688
  667. package/dist/commands/exec.js.map +0 -1
  668. package/dist/commands/host-queries.js +0 -156
  669. package/dist/commands/host-queries.js.map +0 -1
  670. package/dist/commands/login.js +0 -315
  671. package/dist/commands/login.js.map +0 -1
  672. package/dist/commands/mcp-oauth-login.js +0 -213
  673. package/dist/commands/mcp-oauth-login.js.map +0 -1
  674. package/dist/commands/mcp.js +0 -461
  675. package/dist/commands/mcp.js.map +0 -1
  676. package/dist/commands/prior-messages.js +0 -329
  677. package/dist/commands/prior-messages.js.map +0 -1
  678. package/dist/commands/provider-wait.js +0 -65
  679. package/dist/commands/provider-wait.js.map +0 -1
  680. package/dist/commands/registry.js +0 -40
  681. package/dist/commands/registry.js.map +0 -1
  682. package/dist/commands/resident-flags.js +0 -193
  683. package/dist/commands/resident-flags.js.map +0 -1
  684. package/dist/commands/resident-learning.js +0 -293
  685. package/dist/commands/resident-learning.js.map +0 -1
  686. package/dist/commands/resident.js +0 -419
  687. package/dist/commands/resident.js.map +0 -1
  688. package/dist/commands/resume.js +0 -109
  689. package/dist/commands/resume.js.map +0 -1
  690. package/dist/commands/schedule.js +0 -131
  691. package/dist/commands/schedule.js.map +0 -1
  692. package/dist/commands/serve.js +0 -21
  693. package/dist/commands/serve.js.map +0 -1
  694. package/dist/commands/skills.js +0 -178
  695. package/dist/commands/skills.js.map +0 -1
  696. package/dist/commands/state.js +0 -110
  697. package/dist/commands/state.js.map +0 -1
  698. package/dist/commands/stdin.js +0 -69
  699. package/dist/commands/stdin.js.map +0 -1
  700. package/dist/commands/types.js +0 -2
  701. package/dist/commands/types.js.map +0 -1
  702. package/dist/commands/upgrade-progress.js +0 -54
  703. package/dist/commands/upgrade-progress.js.map +0 -1
  704. package/dist/commands/upgrade.js +0 -232
  705. package/dist/commands/upgrade.js.map +0 -1
  706. package/dist/commands/worktree.js +0 -86
  707. package/dist/commands/worktree.js.map +0 -1
  708. package/dist/config/composer-triggers.js +0 -80
  709. package/dist/config/composer-triggers.js.map +0 -1
  710. package/dist/config/debug.js +0 -126
  711. package/dist/config/debug.js.map +0 -1
  712. package/dist/config/load.js +0 -1208
  713. package/dist/config/load.js.map +0 -1
  714. package/dist/config/schema.js +0 -13
  715. package/dist/config/schema.js.map +0 -1
  716. package/dist/config/tool-result-screens.js +0 -104
  717. package/dist/config/tool-result-screens.js.map +0 -1
  718. package/dist/config/trusted-project-context.js +0 -28
  719. package/dist/config/trusted-project-context.js.map +0 -1
  720. package/dist/config/turn-guards.js +0 -46
  721. package/dist/config/turn-guards.js.map +0 -1
  722. package/dist/config/user-config.js +0 -118
  723. package/dist/config/user-config.js.map +0 -1
  724. package/dist/context/capabilities.js +0 -164
  725. package/dist/context/capabilities.js.map +0 -1
  726. package/dist/context/directories.js +0 -69
  727. package/dist/context/directories.js.map +0 -1
  728. package/dist/context/doctrine.js +0 -24
  729. package/dist/context/doctrine.js.map +0 -1
  730. package/dist/context/environment.js +0 -255
  731. package/dist/context/environment.js.map +0 -1
  732. package/dist/context/project-path.js +0 -16
  733. package/dist/context/project-path.js.map +0 -1
  734. package/dist/context/project-tracker.js +0 -217
  735. package/dist/context/project-tracker.js.map +0 -1
  736. package/dist/context/project.js +0 -256
  737. package/dist/context/project.js.map +0 -1
  738. package/dist/context/runtime-message.js +0 -30
  739. package/dist/context/runtime-message.js.map +0 -1
  740. package/dist/context/sandbox.js +0 -114
  741. package/dist/context/sandbox.js.map +0 -1
  742. package/dist/context/turn-snapshot.js +0 -122
  743. package/dist/context/turn-snapshot.js.map +0 -1
  744. package/dist/doctor/checks/browser.js +0 -63
  745. package/dist/doctor/checks/browser.js.map +0 -1
  746. package/dist/doctor/checks/chain.js +0 -211
  747. package/dist/doctor/checks/chain.js.map +0 -1
  748. package/dist/doctor/checks/credentials.js +0 -98
  749. package/dist/doctor/checks/credentials.js.map +0 -1
  750. package/dist/doctor/checks/index.js +0 -72
  751. package/dist/doctor/checks/index.js.map +0 -1
  752. package/dist/doctor/checks/invariants.js +0 -79
  753. package/dist/doctor/checks/invariants.js.map +0 -1
  754. package/dist/doctor/checks/logging.js +0 -69
  755. package/dist/doctor/checks/logging.js.map +0 -1
  756. package/dist/doctor/checks/providers.js +0 -30
  757. package/dist/doctor/checks/providers.js.map +0 -1
  758. package/dist/doctor/checks/runtime.js +0 -40
  759. package/dist/doctor/checks/runtime.js.map +0 -1
  760. package/dist/doctor/checks/sandbox.js +0 -76
  761. package/dist/doctor/checks/sandbox.js.map +0 -1
  762. package/dist/doctor/checks/scheduler.js +0 -74
  763. package/dist/doctor/checks/scheduler.js.map +0 -1
  764. package/dist/doctor/checks/session-export.js +0 -62
  765. package/dist/doctor/checks/session-export.js.map +0 -1
  766. package/dist/doctor/checks/telemetry.js +0 -58
  767. package/dist/doctor/checks/telemetry.js.map +0 -1
  768. package/dist/doctor/checks/vault.js +0 -67
  769. package/dist/doctor/checks/vault.js.map +0 -1
  770. package/dist/doctor/index.js +0 -3
  771. package/dist/doctor/index.js.map +0 -1
  772. package/dist/doctor/registry.js +0 -230
  773. package/dist/doctor/registry.js.map +0 -1
  774. package/dist/exit-codes.js +0 -62
  775. package/dist/exit-codes.js.map +0 -1
  776. package/dist/installation.js +0 -48
  777. package/dist/installation.js.map +0 -1
  778. package/dist/integrations/clipboard/image.js +0 -119
  779. package/dist/integrations/clipboard/image.js.map +0 -1
  780. package/dist/integrations/clipboard/text.js +0 -43
  781. package/dist/integrations/clipboard/text.js.map +0 -1
  782. package/dist/integrations/files/attachment-store.js +0 -86
  783. package/dist/integrations/files/attachment-store.js.map +0 -1
  784. package/dist/integrations/mcp/oauth-store.js +0 -549
  785. package/dist/integrations/mcp/oauth-store.js.map +0 -1
  786. package/dist/integrations/mcp/servers.js +0 -611
  787. package/dist/integrations/mcp/servers.js.map +0 -1
  788. package/dist/integrations/mcp/user-config.js +0 -92
  789. package/dist/integrations/mcp/user-config.js.map +0 -1
  790. package/dist/integrations/notifications/desktop/freedesktop.js +0 -33
  791. package/dist/integrations/notifications/desktop/freedesktop.js.map +0 -1
  792. package/dist/integrations/notifications/desktop/macos.js +0 -17
  793. package/dist/integrations/notifications/desktop/macos.js.map +0 -1
  794. package/dist/integrations/notifications/desktop/sanitize.js +0 -49
  795. package/dist/integrations/notifications/desktop/sanitize.js.map +0 -1
  796. package/dist/integrations/notifications/desktop/throttle.js +0 -39
  797. package/dist/integrations/notifications/desktop/throttle.js.map +0 -1
  798. package/dist/integrations/notifications/desktop/windows-toast.js +0 -56
  799. package/dist/integrations/notifications/desktop/windows-toast.js.map +0 -1
  800. package/dist/integrations/notifications/desktop.js +0 -199
  801. package/dist/integrations/notifications/desktop.js.map +0 -1
  802. package/dist/integrations/notifications/terminal.js +0 -46
  803. package/dist/integrations/notifications/terminal.js.map +0 -1
  804. package/dist/integrations/npm-invocation.js +0 -23
  805. package/dist/integrations/npm-invocation.js.map +0 -1
  806. package/dist/integrations/plugins/runtime.js +0 -189
  807. package/dist/integrations/plugins/runtime.js.map +0 -1
  808. package/dist/integrations/plugins/settings.js +0 -106
  809. package/dist/integrations/plugins/settings.js.map +0 -1
  810. package/dist/integrations/providers/access.js +0 -23
  811. package/dist/integrations/providers/access.js.map +0 -1
  812. package/dist/integrations/providers/chain-capabilities.js +0 -211
  813. package/dist/integrations/providers/chain-capabilities.js.map +0 -1
  814. package/dist/integrations/providers/codex-device-login.js +0 -195
  815. package/dist/integrations/providers/codex-device-login.js.map +0 -1
  816. package/dist/integrations/providers/codex-oauth.js +0 -95
  817. package/dist/integrations/providers/codex-oauth.js.map +0 -1
  818. package/dist/integrations/providers/credential-provider.js +0 -74
  819. package/dist/integrations/providers/credential-provider.js.map +0 -1
  820. package/dist/integrations/providers/credential-store.js +0 -657
  821. package/dist/integrations/providers/credential-store.js.map +0 -1
  822. package/dist/integrations/providers/current-credential.js +0 -45
  823. package/dist/integrations/providers/current-credential.js.map +0 -1
  824. package/dist/integrations/providers/discover.js +0 -313
  825. package/dist/integrations/providers/discover.js.map +0 -1
  826. package/dist/integrations/providers/gemini-credentials.js +0 -148
  827. package/dist/integrations/providers/gemini-credentials.js.map +0 -1
  828. package/dist/integrations/providers/harness-credentials.js +0 -344
  829. package/dist/integrations/providers/harness-credentials.js.map +0 -1
  830. package/dist/integrations/providers/identity.js +0 -64
  831. package/dist/integrations/providers/identity.js.map +0 -1
  832. package/dist/integrations/providers/index.js +0 -14
  833. package/dist/integrations/providers/index.js.map +0 -1
  834. package/dist/integrations/providers/keychain.js +0 -78
  835. package/dist/integrations/providers/keychain.js.map +0 -1
  836. package/dist/integrations/providers/model-reasoning.js +0 -51
  837. package/dist/integrations/providers/model-reasoning.js.map +0 -1
  838. package/dist/integrations/providers/oauth.js +0 -302
  839. package/dist/integrations/providers/oauth.js.map +0 -1
  840. package/dist/integrations/providers/preferences.js +0 -287
  841. package/dist/integrations/providers/preferences.js.map +0 -1
  842. package/dist/integrations/providers/register.js +0 -154
  843. package/dist/integrations/providers/register.js.map +0 -1
  844. package/dist/integrations/providers/registry.js +0 -289
  845. package/dist/integrations/providers/registry.js.map +0 -1
  846. package/dist/integrations/providers/setup.js +0 -158
  847. package/dist/integrations/providers/setup.js.map +0 -1
  848. package/dist/integrations/providers/subscription-login.js +0 -328
  849. package/dist/integrations/providers/subscription-login.js.map +0 -1
  850. package/dist/integrations/providers/zen-catalogue.js +0 -196
  851. package/dist/integrations/providers/zen-catalogue.js.map +0 -1
  852. package/dist/integrations/resident/foreground.js +0 -95
  853. package/dist/integrations/resident/foreground.js.map +0 -1
  854. package/dist/integrations/resident/inspection.js +0 -282
  855. package/dist/integrations/resident/inspection.js.map +0 -1
  856. package/dist/integrations/resident/learning-sources.js +0 -79
  857. package/dist/integrations/resident/learning-sources.js.map +0 -1
  858. package/dist/integrations/resident/learning-storage.js +0 -55
  859. package/dist/integrations/resident/learning-storage.js.map +0 -1
  860. package/dist/integrations/resident/lifecycle-errors.js +0 -15
  861. package/dist/integrations/resident/lifecycle-errors.js.map +0 -1
  862. package/dist/integrations/resident/owned-runner.js +0 -91
  863. package/dist/integrations/resident/owned-runner.js.map +0 -1
  864. package/dist/integrations/resident/runner-control.js +0 -238
  865. package/dist/integrations/resident/runner-control.js.map +0 -1
  866. package/dist/integrations/resident/runner-launch.js +0 -142
  867. package/dist/integrations/resident/runner-launch.js.map +0 -1
  868. package/dist/integrations/resident/runner-store.js +0 -284
  869. package/dist/integrations/resident/runner-store.js.map +0 -1
  870. package/dist/integrations/resident/session-log-reads.js +0 -125
  871. package/dist/integrations/resident/session-log-reads.js.map +0 -1
  872. package/dist/integrations/resident/session-step.js +0 -476
  873. package/dist/integrations/resident/session-step.js.map +0 -1
  874. package/dist/integrations/resident/storage.js +0 -183
  875. package/dist/integrations/resident/storage.js.map +0 -1
  876. package/dist/integrations/resident/tool-evidence.js +0 -123
  877. package/dist/integrations/resident/tool-evidence.js.map +0 -1
  878. package/dist/integrations/resident/verification.js +0 -109
  879. package/dist/integrations/resident/verification.js.map +0 -1
  880. package/dist/integrations/sessions/checkpoint-view.js +0 -48
  881. package/dist/integrations/sessions/checkpoint-view.js.map +0 -1
  882. package/dist/integrations/sessions/context-inventory.js +0 -44
  883. package/dist/integrations/sessions/context-inventory.js.map +0 -1
  884. package/dist/integrations/sessions/conversation-search.js +0 -572
  885. package/dist/integrations/sessions/conversation-search.js.map +0 -1
  886. package/dist/integrations/sessions/display-title.js +0 -5
  887. package/dist/integrations/sessions/display-title.js.map +0 -1
  888. package/dist/integrations/sessions/evidence-page-validation.js +0 -74
  889. package/dist/integrations/sessions/evidence-page-validation.js.map +0 -1
  890. package/dist/integrations/sessions/evidence-recall.js +0 -117
  891. package/dist/integrations/sessions/evidence-recall.js.map +0 -1
  892. package/dist/integrations/sessions/store.js +0 -780
  893. package/dist/integrations/sessions/store.js.map +0 -1
  894. package/dist/integrations/sessions/task-context.js +0 -96
  895. package/dist/integrations/sessions/task-context.js.map +0 -1
  896. package/dist/integrations/sessions/transcript-export.js +0 -342
  897. package/dist/integrations/sessions/transcript-export.js.map +0 -1
  898. package/dist/integrations/state/home.js +0 -17
  899. package/dist/integrations/state/home.js.map +0 -1
  900. package/dist/integrations/state/identity.js +0 -49
  901. package/dist/integrations/state/identity.js.map +0 -1
  902. package/dist/integrations/state/immutable-json.js +0 -38
  903. package/dist/integrations/state/immutable-json.js.map +0 -1
  904. package/dist/integrations/state/private-directory.js +0 -43
  905. package/dist/integrations/state/private-directory.js.map +0 -1
  906. package/dist/integrations/state/project.js +0 -13
  907. package/dist/integrations/state/project.js.map +0 -1
  908. package/dist/integrations/state/report.js +0 -626
  909. package/dist/integrations/state/report.js.map +0 -1
  910. package/dist/integrations/state/retention.js +0 -18
  911. package/dist/integrations/state/retention.js.map +0 -1
  912. package/dist/integrations/subagents/NamzuCliAgent.js +0 -9
  913. package/dist/integrations/subagents/NamzuCliAgent.js.map +0 -1
  914. package/dist/integrations/subagents/activity.js +0 -759
  915. package/dist/integrations/subagents/activity.js.map +0 -1
  916. package/dist/integrations/subagents/batches.js +0 -172
  917. package/dist/integrations/subagents/batches.js.map +0 -1
  918. package/dist/integrations/subagents/definitions.js +0 -26
  919. package/dist/integrations/subagents/definitions.js.map +0 -1
  920. package/dist/integrations/subagents/model-effort.js +0 -12
  921. package/dist/integrations/subagents/model-effort.js.map +0 -1
  922. package/dist/integrations/subagents/parent.js +0 -47
  923. package/dist/integrations/subagents/parent.js.map +0 -1
  924. package/dist/integrations/subagents/policy.js +0 -3
  925. package/dist/integrations/subagents/policy.js.map +0 -1
  926. package/dist/integrations/subagents/replay.js +0 -295
  927. package/dist/integrations/subagents/replay.js.map +0 -1
  928. package/dist/integrations/subagents/runtime.js +0 -1317
  929. package/dist/integrations/subagents/runtime.js.map +0 -1
  930. package/dist/integrations/subagents/saved-agents.js +0 -102
  931. package/dist/integrations/subagents/saved-agents.js.map +0 -1
  932. package/dist/integrations/subagents/slash.js +0 -45
  933. package/dist/integrations/subagents/slash.js.map +0 -1
  934. package/dist/integrations/subagents/worktree-driver.js +0 -72
  935. package/dist/integrations/subagents/worktree-driver.js.map +0 -1
  936. package/dist/integrations/telemetry/session-export.js +0 -119
  937. package/dist/integrations/telemetry/session-export.js.map +0 -1
  938. package/dist/integrations/trust/store.js +0 -73
  939. package/dist/integrations/trust/store.js.map +0 -1
  940. package/dist/integrations/updates.js +0 -115
  941. package/dist/integrations/updates.js.map +0 -1
  942. package/dist/integrations/web/exa-search.js +0 -154
  943. package/dist/integrations/web/exa-search.js.map +0 -1
  944. package/dist/integrations/web/open-url.js +0 -73
  945. package/dist/integrations/web/open-url.js.map +0 -1
  946. package/dist/integrations/web/search.js +0 -68
  947. package/dist/integrations/web/search.js.map +0 -1
  948. package/dist/integrations/worktrees/managed.js +0 -231
  949. package/dist/integrations/worktrees/managed.js.map +0 -1
  950. package/dist/logging.js +0 -115
  951. package/dist/logging.js.map +0 -1
  952. package/dist/memory/io.js +0 -177
  953. package/dist/memory/io.js.map +0 -1
  954. package/dist/memory/presentation.js +0 -76
  955. package/dist/memory/presentation.js.map +0 -1
  956. package/dist/memory/store.js +0 -180
  957. package/dist/memory/store.js.map +0 -1
  958. package/dist/memory/typed.js +0 -336
  959. package/dist/memory/typed.js.map +0 -1
  960. package/dist/output/formatter.js +0 -16
  961. package/dist/output/formatter.js.map +0 -1
  962. package/dist/output/index.js +0 -22
  963. package/dist/output/index.js.map +0 -1
  964. package/dist/output/json.js +0 -51
  965. package/dist/output/json.js.map +0 -1
  966. package/dist/output/text.js +0 -50
  967. package/dist/output/text.js.map +0 -1
  968. package/dist/output/yaml.js +0 -26
  969. package/dist/output/yaml.js.map +0 -1
  970. package/dist/output-schema.js +0 -18
  971. package/dist/output-schema.js.map +0 -1
  972. package/dist/permissions/browser-sites.js +0 -270
  973. package/dist/permissions/browser-sites.js.map +0 -1
  974. package/dist/permissions/canonical-project.js +0 -13
  975. package/dist/permissions/canonical-project.js.map +0 -1
  976. package/dist/permissions/checks.js +0 -128
  977. package/dist/permissions/checks.js.map +0 -1
  978. package/dist/permissions/headless-trust.js +0 -86
  979. package/dist/permissions/headless-trust.js.map +0 -1
  980. package/dist/permissions/live-mode.js +0 -62
  981. package/dist/permissions/live-mode.js.map +0 -1
  982. package/dist/permissions/mode.js +0 -65
  983. package/dist/permissions/mode.js.map +0 -1
  984. package/dist/permissions/rules.js +0 -358
  985. package/dist/permissions/rules.js.map +0 -1
  986. package/dist/release-notes.js +0 -64
  987. package/dist/release-notes.js.map +0 -1
  988. package/dist/resume-invocation.js +0 -24
  989. package/dist/resume-invocation.js.map +0 -1
  990. package/dist/schedule/build.js +0 -374
  991. package/dist/schedule/build.js.map +0 -1
  992. package/dist/schedule/changes.js +0 -78
  993. package/dist/schedule/changes.js.map +0 -1
  994. package/dist/schedule/commands/add.js +0 -603
  995. package/dist/schedule/commands/add.js.map +0 -1
  996. package/dist/schedule/commands/args.js +0 -80
  997. package/dist/schedule/commands/args.js.map +0 -1
  998. package/dist/schedule/commands/confirm-prompt.js +0 -21
  999. package/dist/schedule/commands/confirm-prompt.js.map +0 -1
  1000. package/dist/schedule/commands/lifecycle.js +0 -586
  1001. package/dist/schedule/commands/lifecycle.js.map +0 -1
  1002. package/dist/schedule/commands/list.js +0 -260
  1003. package/dist/schedule/commands/list.js.map +0 -1
  1004. package/dist/schedule/commands/logs.js +0 -106
  1005. package/dist/schedule/commands/logs.js.map +0 -1
  1006. package/dist/schedule/commands/service.js +0 -458
  1007. package/dist/schedule/commands/service.js.map +0 -1
  1008. package/dist/schedule/daemon/daemon.js +0 -1265
  1009. package/dist/schedule/daemon/daemon.js.map +0 -1
  1010. package/dist/schedule/daemon/endpoint.js +0 -158
  1011. package/dist/schedule/daemon/endpoint.js.map +0 -1
  1012. package/dist/schedule/daemon/exit.js +0 -8
  1013. package/dist/schedule/daemon/exit.js.map +0 -1
  1014. package/dist/schedule/daemon/log.js +0 -53
  1015. package/dist/schedule/daemon/log.js.map +0 -1
  1016. package/dist/schedule/daemon/notify.js +0 -158
  1017. package/dist/schedule/daemon/notify.js.map +0 -1
  1018. package/dist/schedule/daemon/retention.js +0 -46
  1019. package/dist/schedule/daemon/retention.js.map +0 -1
  1020. package/dist/schedule/daemon/sessions.js +0 -52
  1021. package/dist/schedule/daemon/sessions.js.map +0 -1
  1022. package/dist/schedule/env.js +0 -106
  1023. package/dist/schedule/env.js.map +0 -1
  1024. package/dist/schedule/fire/browser-preflight.js +0 -73
  1025. package/dist/schedule/fire/browser-preflight.js.map +0 -1
  1026. package/dist/schedule/fire/calls.js +0 -114
  1027. package/dist/schedule/fire/calls.js.map +0 -1
  1028. package/dist/schedule/fire/fire.js +0 -681
  1029. package/dist/schedule/fire/fire.js.map +0 -1
  1030. package/dist/schedule/fire/result.js +0 -19
  1031. package/dist/schedule/fire/result.js.map +0 -1
  1032. package/dist/schedule/fire/run-script.js +0 -81
  1033. package/dist/schedule/fire/run-script.js.map +0 -1
  1034. package/dist/schedule/fire/unattended-note.js +0 -51
  1035. package/dist/schedule/fire/unattended-note.js.map +0 -1
  1036. package/dist/schedule/fire/wake-gate.js +0 -90
  1037. package/dist/schedule/fire/wake-gate.js.map +0 -1
  1038. package/dist/schedule/floor.js +0 -1561
  1039. package/dist/schedule/floor.js.map +0 -1
  1040. package/dist/schedule/folder.js +0 -84
  1041. package/dist/schedule/folder.js.map +0 -1
  1042. package/dist/schedule/paths.js +0 -53
  1043. package/dist/schedule/paths.js.map +0 -1
  1044. package/dist/schedule/policy.js +0 -414
  1045. package/dist/schedule/policy.js.map +0 -1
  1046. package/dist/schedule/resume-command.js +0 -72
  1047. package/dist/schedule/resume-command.js.map +0 -1
  1048. package/dist/schedule/script-check.js +0 -146
  1049. package/dist/schedule/script-check.js.map +0 -1
  1050. package/dist/schedule/script-shell.js +0 -5
  1051. package/dist/schedule/script-shell.js.map +0 -1
  1052. package/dist/schedule/service/detect.js +0 -29
  1053. package/dist/schedule/service/detect.js.map +0 -1
  1054. package/dist/schedule/service/index.js +0 -361
  1055. package/dist/schedule/service/index.js.map +0 -1
  1056. package/dist/schedule/service/launchd.js +0 -84
  1057. package/dist/schedule/service/launchd.js.map +0 -1
  1058. package/dist/schedule/service/manifest.js +0 -16
  1059. package/dist/schedule/service/manifest.js.map +0 -1
  1060. package/dist/schedule/service/names.js +0 -22
  1061. package/dist/schedule/service/names.js.map +0 -1
  1062. package/dist/schedule/service/quote.js +0 -64
  1063. package/dist/schedule/service/quote.js.map +0 -1
  1064. package/dist/schedule/service/runner.js +0 -31
  1065. package/dist/schedule/service/runner.js.map +0 -1
  1066. package/dist/schedule/service/systemd.js +0 -96
  1067. package/dist/schedule/service/systemd.js.map +0 -1
  1068. package/dist/schedule/service/windows-task.js +0 -199
  1069. package/dist/schedule/service/windows-task.js.map +0 -1
  1070. package/dist/schedule/service/wsl.js +0 -121
  1071. package/dist/schedule/service/wsl.js.map +0 -1
  1072. package/dist/schedule/store/atomic.js +0 -138
  1073. package/dist/schedule/store/atomic.js.map +0 -1
  1074. package/dist/schedule/store/claims.js +0 -57
  1075. package/dist/schedule/store/claims.js.map +0 -1
  1076. package/dist/schedule/store/digest.js +0 -139
  1077. package/dist/schedule/store/digest.js.map +0 -1
  1078. package/dist/schedule/store/history.js +0 -117
  1079. package/dist/schedule/store/history.js.map +0 -1
  1080. package/dist/schedule/store/jobs.js +0 -277
  1081. package/dist/schedule/store/jobs.js.map +0 -1
  1082. package/dist/schedule/store/state.js +0 -38
  1083. package/dist/schedule/store/state.js.map +0 -1
  1084. package/dist/schedule/types.js +0 -33
  1085. package/dist/schedule/types.js.map +0 -1
  1086. package/dist/schedule/visible-source.js +0 -59
  1087. package/dist/schedule/visible-source.js.map +0 -1
  1088. package/dist/skills/audit.js +0 -75
  1089. package/dist/skills/audit.js.map +0 -1
  1090. package/dist/skills/catalog.js +0 -226
  1091. package/dist/skills/catalog.js.map +0 -1
  1092. package/dist/skills/directory.js +0 -51
  1093. package/dist/skills/directory.js.map +0 -1
  1094. package/dist/skills/save.js +0 -344
  1095. package/dist/skills/save.js.map +0 -1
  1096. package/dist/skills/store.js +0 -351
  1097. package/dist/skills/store.js.map +0 -1
  1098. package/dist/termination.js +0 -143
  1099. package/dist/termination.js.map +0 -1
  1100. package/dist/test-support/toolset.js +0 -27
  1101. package/dist/test-support/toolset.js.map +0 -1
  1102. package/dist/tui/AgentExplorer.js +0 -789
  1103. package/dist/tui/AgentExplorer.js.map +0 -1
  1104. package/dist/tui/App.js +0 -8499
  1105. package/dist/tui/App.js.map +0 -1
  1106. package/dist/tui/BackgroundJobsPanel.js +0 -129
  1107. package/dist/tui/BackgroundJobsPanel.js.map +0 -1
  1108. package/dist/tui/BrandHeader.js +0 -14
  1109. package/dist/tui/BrandHeader.js.map +0 -1
  1110. package/dist/tui/Checklist.js +0 -90
  1111. package/dist/tui/Checklist.js.map +0 -1
  1112. package/dist/tui/ChoicePicker.js +0 -64
  1113. package/dist/tui/ChoicePicker.js.map +0 -1
  1114. package/dist/tui/Composer.js +0 -939
  1115. package/dist/tui/Composer.js.map +0 -1
  1116. package/dist/tui/ComposerFrame.js +0 -79
  1117. package/dist/tui/ComposerFrame.js.map +0 -1
  1118. package/dist/tui/CopyPicker.js +0 -19
  1119. package/dist/tui/CopyPicker.js.map +0 -1
  1120. package/dist/tui/EditPromptPicker.js +0 -17
  1121. package/dist/tui/EditPromptPicker.js.map +0 -1
  1122. package/dist/tui/EffortSlider.js +0 -134
  1123. package/dist/tui/EffortSlider.js.map +0 -1
  1124. package/dist/tui/LiveActivity.js +0 -89
  1125. package/dist/tui/LiveActivity.js.map +0 -1
  1126. package/dist/tui/Markdown.js +0 -137
  1127. package/dist/tui/Markdown.js.map +0 -1
  1128. package/dist/tui/PendingInputPanel.js +0 -108
  1129. package/dist/tui/PendingInputPanel.js.map +0 -1
  1130. package/dist/tui/PermissionOverlay.js +0 -278
  1131. package/dist/tui/PermissionOverlay.js.map +0 -1
  1132. package/dist/tui/Picker.js +0 -1310
  1133. package/dist/tui/Picker.js.map +0 -1
  1134. package/dist/tui/ProviderSetup.js +0 -125
  1135. package/dist/tui/ProviderSetup.js.map +0 -1
  1136. package/dist/tui/ResumePicker.js +0 -34
  1137. package/dist/tui/ResumePicker.js.map +0 -1
  1138. package/dist/tui/SaveSkillOverlay.js +0 -118
  1139. package/dist/tui/SaveSkillOverlay.js.map +0 -1
  1140. package/dist/tui/ScheduleReviewOverlay.js +0 -166
  1141. package/dist/tui/ScheduleReviewOverlay.js.map +0 -1
  1142. package/dist/tui/StatusBar.js +0 -182
  1143. package/dist/tui/StatusBar.js.map +0 -1
  1144. package/dist/tui/StatusPanel.js +0 -11
  1145. package/dist/tui/StatusPanel.js.map +0 -1
  1146. package/dist/tui/TaskList.js +0 -43
  1147. package/dist/tui/TaskList.js.map +0 -1
  1148. package/dist/tui/TextPrompt.js +0 -185
  1149. package/dist/tui/TextPrompt.js.map +0 -1
  1150. package/dist/tui/ToolOutputViewer.js +0 -39
  1151. package/dist/tui/ToolOutputViewer.js.map +0 -1
  1152. package/dist/tui/Transcript.js +0 -235
  1153. package/dist/tui/Transcript.js.map +0 -1
  1154. package/dist/tui/TrustPrompt.js +0 -13
  1155. package/dist/tui/TrustPrompt.js.map +0 -1
  1156. package/dist/tui/ViewportBound.js +0 -55
  1157. package/dist/tui/ViewportBound.js.map +0 -1
  1158. package/dist/tui/agent-transcript-rows.js +0 -115
  1159. package/dist/tui/agent-transcript-rows.js.map +0 -1
  1160. package/dist/tui/agent.js +0 -4301
  1161. package/dist/tui/agent.js.map +0 -1
  1162. package/dist/tui/browser-notices.js +0 -107
  1163. package/dist/tui/browser-notices.js.map +0 -1
  1164. package/dist/tui/choice-selection.js +0 -38
  1165. package/dist/tui/choice-selection.js.map +0 -1
  1166. package/dist/tui/compact-transcript.js +0 -46
  1167. package/dist/tui/compact-transcript.js.map +0 -1
  1168. package/dist/tui/consent-timing.js +0 -48
  1169. package/dist/tui/consent-timing.js.map +0 -1
  1170. package/dist/tui/conversation-evidence-view.js +0 -96
  1171. package/dist/tui/conversation-evidence-view.js.map +0 -1
  1172. package/dist/tui/conversation-history.js +0 -33
  1173. package/dist/tui/conversation-history.js.map +0 -1
  1174. package/dist/tui/copy-targets.js +0 -189
  1175. package/dist/tui/copy-targets.js.map +0 -1
  1176. package/dist/tui/credential-entry.js +0 -134
  1177. package/dist/tui/credential-entry.js.map +0 -1
  1178. package/dist/tui/edit-prompts.js +0 -35
  1179. package/dist/tui/edit-prompts.js.map +0 -1
  1180. package/dist/tui/exit-summary.js +0 -30
  1181. package/dist/tui/exit-summary.js.map +0 -1
  1182. package/dist/tui/external-editor.js +0 -169
  1183. package/dist/tui/external-editor.js.map +0 -1
  1184. package/dist/tui/hypermode.js +0 -58
  1185. package/dist/tui/hypermode.js.map +0 -1
  1186. package/dist/tui/index.js +0 -81
  1187. package/dist/tui/index.js.map +0 -1
  1188. package/dist/tui/live-window.js +0 -281
  1189. package/dist/tui/live-window.js.map +0 -1
  1190. package/dist/tui/log-pane.js +0 -100
  1191. package/dist/tui/log-pane.js.map +0 -1
  1192. package/dist/tui/login-prompt.js +0 -105
  1193. package/dist/tui/login-prompt.js.map +0 -1
  1194. package/dist/tui/logo.js +0 -9
  1195. package/dist/tui/logo.js.map +0 -1
  1196. package/dist/tui/markdown-block-cache.js +0 -76
  1197. package/dist/tui/markdown-block-cache.js.map +0 -1
  1198. package/dist/tui/markdown-table.js +0 -175
  1199. package/dist/tui/markdown-table.js.map +0 -1
  1200. package/dist/tui/markdown-wrap.js +0 -189
  1201. package/dist/tui/markdown-wrap.js.map +0 -1
  1202. package/dist/tui/markdownParser.js +0 -237
  1203. package/dist/tui/markdownParser.js.map +0 -1
  1204. package/dist/tui/mentions.js +0 -150
  1205. package/dist/tui/mentions.js.map +0 -1
  1206. package/dist/tui/model-catalogue-view.js +0 -75
  1207. package/dist/tui/model-catalogue-view.js.map +0 -1
  1208. package/dist/tui/model-choices.js +0 -157
  1209. package/dist/tui/model-choices.js.map +0 -1
  1210. package/dist/tui/model-search.js +0 -28
  1211. package/dist/tui/model-search.js.map +0 -1
  1212. package/dist/tui/model-selection-intent.js +0 -96
  1213. package/dist/tui/model-selection-intent.js.map +0 -1
  1214. package/dist/tui/model-switch-tool.js +0 -74
  1215. package/dist/tui/model-switch-tool.js.map +0 -1
  1216. package/dist/tui/model-switch.js +0 -106
  1217. package/dist/tui/model-switch.js.map +0 -1
  1218. package/dist/tui/notices.js +0 -27
  1219. package/dist/tui/notices.js.map +0 -1
  1220. package/dist/tui/open-browser.js +0 -147
  1221. package/dist/tui/open-browser.js.map +0 -1
  1222. package/dist/tui/permission-review.js +0 -858
  1223. package/dist/tui/permission-review.js.map +0 -1
  1224. package/dist/tui/plugin-view.js +0 -59
  1225. package/dist/tui/plugin-view.js.map +0 -1
  1226. package/dist/tui/provider-list.js +0 -327
  1227. package/dist/tui/provider-list.js.map +0 -1
  1228. package/dist/tui/provider-selection.js +0 -16
  1229. package/dist/tui/provider-selection.js.map +0 -1
  1230. package/dist/tui/schedule/host-commands.js +0 -428
  1231. package/dist/tui/schedule/host-commands.js.map +0 -1
  1232. package/dist/tui/schedule/integration.js +0 -150
  1233. package/dist/tui/schedule/integration.js.map +0 -1
  1234. package/dist/tui/schedule/loop-host.js +0 -153
  1235. package/dist/tui/schedule/loop-host.js.map +0 -1
  1236. package/dist/tui/schedule/resume.js +0 -333
  1237. package/dist/tui/schedule/resume.js.map +0 -1
  1238. package/dist/tui/schedule/startup.js +0 -121
  1239. package/dist/tui/schedule/startup.js.map +0 -1
  1240. package/dist/tui/schedule/tool-host.js +0 -619
  1241. package/dist/tui/schedule/tool-host.js.map +0 -1
  1242. package/dist/tui/selection-window.js +0 -37
  1243. package/dist/tui/selection-window.js.map +0 -1
  1244. package/dist/tui/shell-escape.js +0 -110
  1245. package/dist/tui/shell-escape.js.map +0 -1
  1246. package/dist/tui/skills/learning.js +0 -131
  1247. package/dist/tui/skills/learning.js.map +0 -1
  1248. package/dist/tui/skills/suggest-setting.js +0 -55
  1249. package/dist/tui/skills/suggest-setting.js.map +0 -1
  1250. package/dist/tui/skills/suggestion-ledger.js +0 -52
  1251. package/dist/tui/skills/suggestion-ledger.js.map +0 -1
  1252. package/dist/tui/slashCommands.js +0 -1588
  1253. package/dist/tui/slashCommands.js.map +0 -1
  1254. package/dist/tui/status-card.js +0 -30
  1255. package/dist/tui/status-card.js.map +0 -1
  1256. package/dist/tui/status-panel-layout.js +0 -42
  1257. package/dist/tui/status-panel-layout.js.map +0 -1
  1258. package/dist/tui/stream-blocks.js +0 -187
  1259. package/dist/tui/stream-blocks.js.map +0 -1
  1260. package/dist/tui/task-activity.js +0 -157
  1261. package/dist/tui/task-activity.js.map +0 -1
  1262. package/dist/tui/terminal-choice-text.js +0 -118
  1263. package/dist/tui/terminal-choice-text.js.map +0 -1
  1264. package/dist/tui/terminal-display.js +0 -65
  1265. package/dist/tui/terminal-display.js.map +0 -1
  1266. package/dist/tui/terminal-hyperlinks.js +0 -70
  1267. package/dist/tui/terminal-hyperlinks.js.map +0 -1
  1268. package/dist/tui/theme.js +0 -34
  1269. package/dist/tui/theme.js.map +0 -1
  1270. package/dist/tui/triggers/analyze.js +0 -221
  1271. package/dist/tui/triggers/analyze.js.map +0 -1
  1272. package/dist/tui/triggers/context-text.js +0 -44
  1273. package/dist/tui/triggers/context-text.js.map +0 -1
  1274. package/dist/tui/triggers/copy.js +0 -163
  1275. package/dist/tui/triggers/copy.js.map +0 -1
  1276. package/dist/tui/triggers/detect.js +0 -295
  1277. package/dist/tui/triggers/detect.js.map +0 -1
  1278. package/dist/tui/triggers/fold.js +0 -44
  1279. package/dist/tui/triggers/fold.js.map +0 -1
  1280. package/dist/tui/triggers/pattern.js +0 -243
  1281. package/dist/tui/triggers/pattern.js.map +0 -1
  1282. package/dist/tui/triggers/provenance.js +0 -98
  1283. package/dist/tui/triggers/provenance.js.map +0 -1
  1284. package/dist/tui/triggers/registry.js +0 -164
  1285. package/dist/tui/triggers/registry.js.map +0 -1
  1286. package/dist/tui/triggers/setting.js +0 -61
  1287. package/dist/tui/triggers/setting.js.map +0 -1
  1288. package/dist/tui/triggers/verbs.js +0 -140
  1289. package/dist/tui/triggers/verbs.js.map +0 -1
  1290. package/dist/tui/turn-interruption.js +0 -160
  1291. package/dist/tui/turn-interruption.js.map +0 -1
  1292. package/dist/tui/turn-limits-settings.js +0 -88
  1293. package/dist/tui/turn-limits-settings.js.map +0 -1
  1294. package/dist/tui/types.js +0 -7
  1295. package/dist/tui/types.js.map +0 -1
  1296. package/dist/tui/units.js +0 -20
  1297. package/dist/tui/units.js.map +0 -1
  1298. package/dist/tui/use-selection-index.js +0 -13
  1299. package/dist/tui/use-selection-index.js.map +0 -1
  1300. package/dist/tui/web-activity.js +0 -105
  1301. package/dist/tui/web-activity.js.map +0 -1
  1302. package/dist/tui/workspace-diff.js +0 -101
  1303. package/dist/tui/workspace-diff.js.map +0 -1
  1304. package/dist/tui/workspace-review.js +0 -67
  1305. package/dist/tui/workspace-review.js.map +0 -1
  1306. package/dist/user-commands/store.js +0 -235
  1307. package/dist/user-commands/store.js.map +0 -1
  1308. package/dist/version.js +0 -23
  1309. package/dist/version.js.map +0 -1
@@ -0,0 +1,3851 @@
1
+ import { createRequire as __namzuCreateRequire } from 'node:module';
2
+ const require = __namzuCreateRequire(import.meta.url);
3
+ import {
4
+ __commonJS,
5
+ __name,
6
+ __require,
7
+ __toESM
8
+ } from "./chunk-76FLAFCG.js";
9
+
10
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js
11
+ var require_constants = __commonJS({
12
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/constants.js"(exports, module) {
13
+ "use strict";
14
+ var BINARY_TYPES = ["nodebuffer", "arraybuffer", "fragments"];
15
+ var hasBlob = typeof Blob !== "undefined";
16
+ if (hasBlob) BINARY_TYPES.push("blob");
17
+ module.exports = {
18
+ BINARY_TYPES,
19
+ CLOSE_TIMEOUT: 3e4,
20
+ EMPTY_BUFFER: Buffer.alloc(0),
21
+ GUID: "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
22
+ hasBlob,
23
+ kForOnEventAttribute: /* @__PURE__ */ Symbol("kIsForOnEventAttribute"),
24
+ kListener: /* @__PURE__ */ Symbol("kListener"),
25
+ kStatusCode: /* @__PURE__ */ Symbol("status-code"),
26
+ kWebSocket: /* @__PURE__ */ Symbol("websocket"),
27
+ NOOP: /* @__PURE__ */ __name(() => {
28
+ }, "NOOP")
29
+ };
30
+ }
31
+ });
32
+
33
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js
34
+ var require_buffer_util = __commonJS({
35
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/buffer-util.js"(exports, module) {
36
+ "use strict";
37
+ var { EMPTY_BUFFER } = require_constants();
38
+ var FastBuffer = Buffer[Symbol.species];
39
+ function concat(list, totalLength) {
40
+ if (list.length === 0) return EMPTY_BUFFER;
41
+ if (list.length === 1) return list[0];
42
+ const target = Buffer.allocUnsafe(totalLength);
43
+ let offset = 0;
44
+ for (let i = 0; i < list.length; i++) {
45
+ const buf = list[i];
46
+ target.set(buf, offset);
47
+ offset += buf.length;
48
+ }
49
+ if (offset < totalLength) {
50
+ return new FastBuffer(target.buffer, target.byteOffset, offset);
51
+ }
52
+ return target;
53
+ }
54
+ __name(concat, "concat");
55
+ function _mask(source, mask, output, offset, length) {
56
+ for (let i = 0; i < length; i++) {
57
+ output[offset + i] = source[i] ^ mask[i & 3];
58
+ }
59
+ }
60
+ __name(_mask, "_mask");
61
+ function _unmask(buffer, mask) {
62
+ for (let i = 0; i < buffer.length; i++) {
63
+ buffer[i] ^= mask[i & 3];
64
+ }
65
+ }
66
+ __name(_unmask, "_unmask");
67
+ function toArrayBuffer(buf) {
68
+ if (buf.length === buf.buffer.byteLength) {
69
+ return buf.buffer;
70
+ }
71
+ return buf.buffer.slice(buf.byteOffset, buf.byteOffset + buf.length);
72
+ }
73
+ __name(toArrayBuffer, "toArrayBuffer");
74
+ function toBuffer(data) {
75
+ toBuffer.readOnly = true;
76
+ if (Buffer.isBuffer(data)) return data;
77
+ let buf;
78
+ if (data instanceof ArrayBuffer) {
79
+ buf = new FastBuffer(data);
80
+ } else if (ArrayBuffer.isView(data)) {
81
+ buf = new FastBuffer(data.buffer, data.byteOffset, data.byteLength);
82
+ } else {
83
+ buf = Buffer.from(data);
84
+ toBuffer.readOnly = false;
85
+ }
86
+ return buf;
87
+ }
88
+ __name(toBuffer, "toBuffer");
89
+ module.exports = {
90
+ concat,
91
+ mask: _mask,
92
+ toArrayBuffer,
93
+ toBuffer,
94
+ unmask: _unmask
95
+ };
96
+ if (!process.env.WS_NO_BUFFER_UTIL) {
97
+ try {
98
+ const bufferUtil = __require("bufferutil");
99
+ module.exports.mask = function(source, mask, output, offset, length) {
100
+ if (length < 48) _mask(source, mask, output, offset, length);
101
+ else bufferUtil.mask(source, mask, output, offset, length);
102
+ };
103
+ module.exports.unmask = function(buffer, mask) {
104
+ if (buffer.length < 32) _unmask(buffer, mask);
105
+ else bufferUtil.unmask(buffer, mask);
106
+ };
107
+ } catch (e) {
108
+ }
109
+ }
110
+ }
111
+ });
112
+
113
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js
114
+ var require_limiter = __commonJS({
115
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/limiter.js"(exports, module) {
116
+ "use strict";
117
+ var kDone = /* @__PURE__ */ Symbol("kDone");
118
+ var kRun = /* @__PURE__ */ Symbol("kRun");
119
+ var Limiter = class {
120
+ static {
121
+ __name(this, "Limiter");
122
+ }
123
+ /**
124
+ * Creates a new `Limiter`.
125
+ *
126
+ * @param {Number} [concurrency=Infinity] The maximum number of jobs allowed
127
+ * to run concurrently
128
+ */
129
+ constructor(concurrency) {
130
+ this[kDone] = () => {
131
+ this.pending--;
132
+ this[kRun]();
133
+ };
134
+ this.concurrency = concurrency || Infinity;
135
+ this.jobs = [];
136
+ this.pending = 0;
137
+ }
138
+ /**
139
+ * Adds a job to the queue.
140
+ *
141
+ * @param {Function} job The job to run
142
+ * @public
143
+ */
144
+ add(job) {
145
+ this.jobs.push(job);
146
+ this[kRun]();
147
+ }
148
+ /**
149
+ * Removes a job from the queue and runs it if possible.
150
+ *
151
+ * @private
152
+ */
153
+ [kRun]() {
154
+ if (this.pending === this.concurrency) return;
155
+ if (this.jobs.length) {
156
+ const job = this.jobs.shift();
157
+ this.pending++;
158
+ job(this[kDone]);
159
+ }
160
+ }
161
+ };
162
+ module.exports = Limiter;
163
+ }
164
+ });
165
+
166
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js
167
+ var require_permessage_deflate = __commonJS({
168
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/permessage-deflate.js"(exports, module) {
169
+ "use strict";
170
+ var zlib = __require("zlib");
171
+ var bufferUtil = require_buffer_util();
172
+ var Limiter = require_limiter();
173
+ var { kStatusCode } = require_constants();
174
+ var FastBuffer = Buffer[Symbol.species];
175
+ var TRAILER = Buffer.from([0, 0, 255, 255]);
176
+ var kPerMessageDeflate = /* @__PURE__ */ Symbol("permessage-deflate");
177
+ var kTotalLength = /* @__PURE__ */ Symbol("total-length");
178
+ var kCallback = /* @__PURE__ */ Symbol("callback");
179
+ var kBuffers = /* @__PURE__ */ Symbol("buffers");
180
+ var kError = /* @__PURE__ */ Symbol("error");
181
+ var zlibLimiter;
182
+ var PerMessageDeflate2 = class {
183
+ static {
184
+ __name(this, "PerMessageDeflate");
185
+ }
186
+ /**
187
+ * Creates a PerMessageDeflate instance.
188
+ *
189
+ * @param {Object} [options] Configuration options
190
+ * @param {(Boolean|Number)} [options.clientMaxWindowBits] Advertise support
191
+ * for, or request, a custom client window size
192
+ * @param {Boolean} [options.clientNoContextTakeover=false] Advertise/
193
+ * acknowledge disabling of client context takeover
194
+ * @param {Number} [options.concurrencyLimit=10] The number of concurrent
195
+ * calls to zlib
196
+ * @param {Boolean} [options.isServer=false] Create the instance in either
197
+ * server or client mode
198
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
199
+ * @param {(Boolean|Number)} [options.serverMaxWindowBits] Request/confirm the
200
+ * use of a custom server window size
201
+ * @param {Boolean} [options.serverNoContextTakeover=false] Request/accept
202
+ * disabling of server context takeover
203
+ * @param {Number} [options.threshold=1024] Size (in bytes) below which
204
+ * messages should not be compressed if context takeover is disabled
205
+ * @param {Object} [options.zlibDeflateOptions] Options to pass to zlib on
206
+ * deflate
207
+ * @param {Object} [options.zlibInflateOptions] Options to pass to zlib on
208
+ * inflate
209
+ */
210
+ constructor(options) {
211
+ this._options = options || {};
212
+ this._threshold = this._options.threshold !== void 0 ? this._options.threshold : 1024;
213
+ this._maxPayload = this._options.maxPayload | 0;
214
+ this._isServer = !!this._options.isServer;
215
+ this._deflate = null;
216
+ this._inflate = null;
217
+ this.params = null;
218
+ if (!zlibLimiter) {
219
+ const concurrency = this._options.concurrencyLimit !== void 0 ? this._options.concurrencyLimit : 10;
220
+ zlibLimiter = new Limiter(concurrency);
221
+ }
222
+ }
223
+ /**
224
+ * @type {String}
225
+ */
226
+ static get extensionName() {
227
+ return "permessage-deflate";
228
+ }
229
+ /**
230
+ * Create an extension negotiation offer.
231
+ *
232
+ * @return {Object} Extension parameters
233
+ * @public
234
+ */
235
+ offer() {
236
+ const params = {};
237
+ if (this._options.serverNoContextTakeover) {
238
+ params.server_no_context_takeover = true;
239
+ }
240
+ if (this._options.clientNoContextTakeover) {
241
+ params.client_no_context_takeover = true;
242
+ }
243
+ if (this._options.serverMaxWindowBits) {
244
+ params.server_max_window_bits = this._options.serverMaxWindowBits;
245
+ }
246
+ if (this._options.clientMaxWindowBits) {
247
+ params.client_max_window_bits = this._options.clientMaxWindowBits;
248
+ } else if (this._options.clientMaxWindowBits == null) {
249
+ params.client_max_window_bits = true;
250
+ }
251
+ return params;
252
+ }
253
+ /**
254
+ * Accept an extension negotiation offer/response.
255
+ *
256
+ * @param {Array} configurations The extension negotiation offers/reponse
257
+ * @return {Object} Accepted configuration
258
+ * @public
259
+ */
260
+ accept(configurations) {
261
+ configurations = this.normalizeParams(configurations);
262
+ this.params = this._isServer ? this.acceptAsServer(configurations) : this.acceptAsClient(configurations);
263
+ return this.params;
264
+ }
265
+ /**
266
+ * Releases all resources used by the extension.
267
+ *
268
+ * @public
269
+ */
270
+ cleanup() {
271
+ if (this._inflate) {
272
+ this._inflate.close();
273
+ this._inflate = null;
274
+ }
275
+ if (this._deflate) {
276
+ const callback = this._deflate[kCallback];
277
+ this._deflate.close();
278
+ this._deflate = null;
279
+ if (callback) {
280
+ callback(
281
+ new Error(
282
+ "The deflate stream was closed while data was being processed"
283
+ )
284
+ );
285
+ }
286
+ }
287
+ }
288
+ /**
289
+ * Accept an extension negotiation offer.
290
+ *
291
+ * @param {Array} offers The extension negotiation offers
292
+ * @return {Object} Accepted configuration
293
+ * @private
294
+ */
295
+ acceptAsServer(offers) {
296
+ const opts = this._options;
297
+ const accepted = offers.find((params) => {
298
+ if (opts.serverNoContextTakeover === false && params.server_no_context_takeover || params.server_max_window_bits && (opts.serverMaxWindowBits === false || typeof opts.serverMaxWindowBits === "number" && opts.serverMaxWindowBits > params.server_max_window_bits) || typeof opts.clientMaxWindowBits === "number" && (typeof params.client_max_window_bits === "number" ? opts.clientMaxWindowBits > params.client_max_window_bits : !params.client_max_window_bits)) {
299
+ return false;
300
+ }
301
+ return true;
302
+ });
303
+ if (!accepted) {
304
+ throw new Error("None of the extension offers can be accepted");
305
+ }
306
+ if (opts.serverNoContextTakeover) {
307
+ accepted.server_no_context_takeover = true;
308
+ }
309
+ if (opts.clientNoContextTakeover) {
310
+ accepted.client_no_context_takeover = true;
311
+ }
312
+ if (typeof opts.serverMaxWindowBits === "number") {
313
+ accepted.server_max_window_bits = opts.serverMaxWindowBits;
314
+ }
315
+ if (typeof opts.clientMaxWindowBits === "number") {
316
+ accepted.client_max_window_bits = opts.clientMaxWindowBits;
317
+ } else if (accepted.client_max_window_bits === true || opts.clientMaxWindowBits === false) {
318
+ delete accepted.client_max_window_bits;
319
+ }
320
+ return accepted;
321
+ }
322
+ /**
323
+ * Accept the extension negotiation response.
324
+ *
325
+ * @param {Array} response The extension negotiation response
326
+ * @return {Object} Accepted configuration
327
+ * @private
328
+ */
329
+ acceptAsClient(response) {
330
+ const params = response[0];
331
+ if (this._options.clientNoContextTakeover === false && params.client_no_context_takeover) {
332
+ throw new Error('Unexpected parameter "client_no_context_takeover"');
333
+ }
334
+ if (!params.client_max_window_bits) {
335
+ if (typeof this._options.clientMaxWindowBits === "number") {
336
+ params.client_max_window_bits = this._options.clientMaxWindowBits;
337
+ }
338
+ } else if (this._options.clientMaxWindowBits === false || typeof this._options.clientMaxWindowBits === "number" && params.client_max_window_bits > this._options.clientMaxWindowBits) {
339
+ throw new Error(
340
+ 'Unexpected or invalid parameter "client_max_window_bits"'
341
+ );
342
+ }
343
+ return params;
344
+ }
345
+ /**
346
+ * Normalize parameters.
347
+ *
348
+ * @param {Array} configurations The extension negotiation offers/reponse
349
+ * @return {Array} The offers/response with normalized parameters
350
+ * @private
351
+ */
352
+ normalizeParams(configurations) {
353
+ configurations.forEach((params) => {
354
+ Object.keys(params).forEach((key) => {
355
+ let value = params[key];
356
+ if (value.length > 1) {
357
+ throw new Error(`Parameter "${key}" must have only a single value`);
358
+ }
359
+ value = value[0];
360
+ if (key === "client_max_window_bits") {
361
+ if (value !== true) {
362
+ const num = +value;
363
+ if (!Number.isInteger(num) || num < 8 || num > 15) {
364
+ throw new TypeError(
365
+ `Invalid value for parameter "${key}": ${value}`
366
+ );
367
+ }
368
+ value = num;
369
+ } else if (!this._isServer) {
370
+ throw new TypeError(
371
+ `Invalid value for parameter "${key}": ${value}`
372
+ );
373
+ }
374
+ } else if (key === "server_max_window_bits") {
375
+ const num = +value;
376
+ if (!Number.isInteger(num) || num < 8 || num > 15) {
377
+ throw new TypeError(
378
+ `Invalid value for parameter "${key}": ${value}`
379
+ );
380
+ }
381
+ value = num;
382
+ } else if (key === "client_no_context_takeover" || key === "server_no_context_takeover") {
383
+ if (value !== true) {
384
+ throw new TypeError(
385
+ `Invalid value for parameter "${key}": ${value}`
386
+ );
387
+ }
388
+ } else {
389
+ throw new Error(`Unknown parameter "${key}"`);
390
+ }
391
+ params[key] = value;
392
+ });
393
+ });
394
+ return configurations;
395
+ }
396
+ /**
397
+ * Decompress data. Concurrency limited.
398
+ *
399
+ * @param {Buffer} data Compressed data
400
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
401
+ * @param {Function} callback Callback
402
+ * @public
403
+ */
404
+ decompress(data, fin, callback) {
405
+ zlibLimiter.add((done) => {
406
+ this._decompress(data, fin, (err, result) => {
407
+ done();
408
+ callback(err, result);
409
+ });
410
+ });
411
+ }
412
+ /**
413
+ * Compress data. Concurrency limited.
414
+ *
415
+ * @param {(Buffer|String)} data Data to compress
416
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
417
+ * @param {Function} callback Callback
418
+ * @public
419
+ */
420
+ compress(data, fin, callback) {
421
+ zlibLimiter.add((done) => {
422
+ this._compress(data, fin, (err, result) => {
423
+ done();
424
+ callback(err, result);
425
+ });
426
+ });
427
+ }
428
+ /**
429
+ * Decompress data.
430
+ *
431
+ * @param {Buffer} data Compressed data
432
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
433
+ * @param {Function} callback Callback
434
+ * @private
435
+ */
436
+ _decompress(data, fin, callback) {
437
+ const endpoint = this._isServer ? "client" : "server";
438
+ if (!this._inflate) {
439
+ const key = `${endpoint}_max_window_bits`;
440
+ const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
441
+ this._inflate = zlib.createInflateRaw({
442
+ ...this._options.zlibInflateOptions,
443
+ windowBits
444
+ });
445
+ this._inflate[kPerMessageDeflate] = this;
446
+ this._inflate[kTotalLength] = 0;
447
+ this._inflate[kBuffers] = [];
448
+ this._inflate.on("error", inflateOnError);
449
+ this._inflate.on("data", inflateOnData);
450
+ }
451
+ this._inflate[kCallback] = callback;
452
+ this._inflate.write(data);
453
+ if (fin) this._inflate.write(TRAILER);
454
+ this._inflate.flush(() => {
455
+ const err = this._inflate[kError];
456
+ if (err) {
457
+ this._inflate.close();
458
+ this._inflate = null;
459
+ callback(err);
460
+ return;
461
+ }
462
+ const data2 = bufferUtil.concat(
463
+ this._inflate[kBuffers],
464
+ this._inflate[kTotalLength]
465
+ );
466
+ if (this._inflate._readableState.endEmitted) {
467
+ this._inflate.close();
468
+ this._inflate = null;
469
+ } else {
470
+ this._inflate[kTotalLength] = 0;
471
+ this._inflate[kBuffers] = [];
472
+ if (fin && this.params[`${endpoint}_no_context_takeover`]) {
473
+ this._inflate.reset();
474
+ }
475
+ }
476
+ callback(null, data2);
477
+ });
478
+ }
479
+ /**
480
+ * Compress data.
481
+ *
482
+ * @param {(Buffer|String)} data Data to compress
483
+ * @param {Boolean} fin Specifies whether or not this is the last fragment
484
+ * @param {Function} callback Callback
485
+ * @private
486
+ */
487
+ _compress(data, fin, callback) {
488
+ const endpoint = this._isServer ? "server" : "client";
489
+ if (!this._deflate) {
490
+ const key = `${endpoint}_max_window_bits`;
491
+ const windowBits = typeof this.params[key] !== "number" ? zlib.Z_DEFAULT_WINDOWBITS : this.params[key];
492
+ this._deflate = zlib.createDeflateRaw({
493
+ ...this._options.zlibDeflateOptions,
494
+ windowBits
495
+ });
496
+ this._deflate[kTotalLength] = 0;
497
+ this._deflate[kBuffers] = [];
498
+ this._deflate.on("data", deflateOnData);
499
+ }
500
+ this._deflate[kCallback] = callback;
501
+ this._deflate.write(data);
502
+ this._deflate.flush(zlib.Z_SYNC_FLUSH, () => {
503
+ if (!this._deflate) {
504
+ return;
505
+ }
506
+ let data2 = bufferUtil.concat(
507
+ this._deflate[kBuffers],
508
+ this._deflate[kTotalLength]
509
+ );
510
+ if (fin) {
511
+ data2 = new FastBuffer(data2.buffer, data2.byteOffset, data2.length - 4);
512
+ }
513
+ this._deflate[kCallback] = null;
514
+ this._deflate[kTotalLength] = 0;
515
+ this._deflate[kBuffers] = [];
516
+ if (fin && this.params[`${endpoint}_no_context_takeover`]) {
517
+ this._deflate.reset();
518
+ }
519
+ callback(null, data2);
520
+ });
521
+ }
522
+ };
523
+ module.exports = PerMessageDeflate2;
524
+ function deflateOnData(chunk) {
525
+ this[kBuffers].push(chunk);
526
+ this[kTotalLength] += chunk.length;
527
+ }
528
+ __name(deflateOnData, "deflateOnData");
529
+ function inflateOnData(chunk) {
530
+ this[kTotalLength] += chunk.length;
531
+ if (this[kPerMessageDeflate]._maxPayload < 1 || this[kTotalLength] <= this[kPerMessageDeflate]._maxPayload) {
532
+ this[kBuffers].push(chunk);
533
+ return;
534
+ }
535
+ this[kError] = new RangeError("Max payload size exceeded");
536
+ this[kError].code = "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH";
537
+ this[kError][kStatusCode] = 1009;
538
+ this.removeListener("data", inflateOnData);
539
+ this.reset();
540
+ }
541
+ __name(inflateOnData, "inflateOnData");
542
+ function inflateOnError(err) {
543
+ this[kPerMessageDeflate]._inflate = null;
544
+ if (this[kError]) {
545
+ this[kCallback](this[kError]);
546
+ return;
547
+ }
548
+ err[kStatusCode] = 1007;
549
+ this[kCallback](err);
550
+ }
551
+ __name(inflateOnError, "inflateOnError");
552
+ }
553
+ });
554
+
555
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js
556
+ var require_validation = __commonJS({
557
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/validation.js"(exports, module) {
558
+ "use strict";
559
+ var { isUtf8 } = __require("buffer");
560
+ var { hasBlob } = require_constants();
561
+ var tokenChars = [
562
+ 0,
563
+ 0,
564
+ 0,
565
+ 0,
566
+ 0,
567
+ 0,
568
+ 0,
569
+ 0,
570
+ 0,
571
+ 0,
572
+ 0,
573
+ 0,
574
+ 0,
575
+ 0,
576
+ 0,
577
+ 0,
578
+ // 0 - 15
579
+ 0,
580
+ 0,
581
+ 0,
582
+ 0,
583
+ 0,
584
+ 0,
585
+ 0,
586
+ 0,
587
+ 0,
588
+ 0,
589
+ 0,
590
+ 0,
591
+ 0,
592
+ 0,
593
+ 0,
594
+ 0,
595
+ // 16 - 31
596
+ 0,
597
+ 1,
598
+ 0,
599
+ 1,
600
+ 1,
601
+ 1,
602
+ 1,
603
+ 1,
604
+ 0,
605
+ 0,
606
+ 1,
607
+ 1,
608
+ 0,
609
+ 1,
610
+ 1,
611
+ 0,
612
+ // 32 - 47
613
+ 1,
614
+ 1,
615
+ 1,
616
+ 1,
617
+ 1,
618
+ 1,
619
+ 1,
620
+ 1,
621
+ 1,
622
+ 1,
623
+ 0,
624
+ 0,
625
+ 0,
626
+ 0,
627
+ 0,
628
+ 0,
629
+ // 48 - 63
630
+ 0,
631
+ 1,
632
+ 1,
633
+ 1,
634
+ 1,
635
+ 1,
636
+ 1,
637
+ 1,
638
+ 1,
639
+ 1,
640
+ 1,
641
+ 1,
642
+ 1,
643
+ 1,
644
+ 1,
645
+ 1,
646
+ // 64 - 79
647
+ 1,
648
+ 1,
649
+ 1,
650
+ 1,
651
+ 1,
652
+ 1,
653
+ 1,
654
+ 1,
655
+ 1,
656
+ 1,
657
+ 1,
658
+ 0,
659
+ 0,
660
+ 0,
661
+ 1,
662
+ 1,
663
+ // 80 - 95
664
+ 1,
665
+ 1,
666
+ 1,
667
+ 1,
668
+ 1,
669
+ 1,
670
+ 1,
671
+ 1,
672
+ 1,
673
+ 1,
674
+ 1,
675
+ 1,
676
+ 1,
677
+ 1,
678
+ 1,
679
+ 1,
680
+ // 96 - 111
681
+ 1,
682
+ 1,
683
+ 1,
684
+ 1,
685
+ 1,
686
+ 1,
687
+ 1,
688
+ 1,
689
+ 1,
690
+ 1,
691
+ 1,
692
+ 0,
693
+ 1,
694
+ 0,
695
+ 1,
696
+ 0
697
+ // 112 - 127
698
+ ];
699
+ function isValidStatusCode(code) {
700
+ return code >= 1e3 && code <= 1014 && code !== 1004 && code !== 1005 && code !== 1006 || code >= 3e3 && code <= 4999;
701
+ }
702
+ __name(isValidStatusCode, "isValidStatusCode");
703
+ function _isValidUTF8(buf) {
704
+ const len = buf.length;
705
+ let i = 0;
706
+ while (i < len) {
707
+ if ((buf[i] & 128) === 0) {
708
+ i++;
709
+ } else if ((buf[i] & 224) === 192) {
710
+ if (i + 1 === len || (buf[i + 1] & 192) !== 128 || (buf[i] & 254) === 192) {
711
+ return false;
712
+ }
713
+ i += 2;
714
+ } else if ((buf[i] & 240) === 224) {
715
+ if (i + 2 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || buf[i] === 224 && (buf[i + 1] & 224) === 128 || // Overlong
716
+ buf[i] === 237 && (buf[i + 1] & 224) === 160) {
717
+ return false;
718
+ }
719
+ i += 3;
720
+ } else if ((buf[i] & 248) === 240) {
721
+ if (i + 3 >= len || (buf[i + 1] & 192) !== 128 || (buf[i + 2] & 192) !== 128 || (buf[i + 3] & 192) !== 128 || buf[i] === 240 && (buf[i + 1] & 240) === 128 || // Overlong
722
+ buf[i] === 244 && buf[i + 1] > 143 || buf[i] > 244) {
723
+ return false;
724
+ }
725
+ i += 4;
726
+ } else {
727
+ return false;
728
+ }
729
+ }
730
+ return true;
731
+ }
732
+ __name(_isValidUTF8, "_isValidUTF8");
733
+ function isBlob(value) {
734
+ return hasBlob && typeof value === "object" && typeof value.arrayBuffer === "function" && typeof value.type === "string" && typeof value.stream === "function" && (value[Symbol.toStringTag] === "Blob" || value[Symbol.toStringTag] === "File");
735
+ }
736
+ __name(isBlob, "isBlob");
737
+ module.exports = {
738
+ isBlob,
739
+ isValidStatusCode,
740
+ isValidUTF8: _isValidUTF8,
741
+ tokenChars
742
+ };
743
+ if (isUtf8) {
744
+ module.exports.isValidUTF8 = function(buf) {
745
+ return buf.length < 24 ? _isValidUTF8(buf) : isUtf8(buf);
746
+ };
747
+ } else if (!process.env.WS_NO_UTF_8_VALIDATE) {
748
+ try {
749
+ const isValidUTF8 = __require("utf-8-validate");
750
+ module.exports.isValidUTF8 = function(buf) {
751
+ return buf.length < 32 ? _isValidUTF8(buf) : isValidUTF8(buf);
752
+ };
753
+ } catch (e) {
754
+ }
755
+ }
756
+ }
757
+ });
758
+
759
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js
760
+ var require_receiver = __commonJS({
761
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/receiver.js"(exports, module) {
762
+ "use strict";
763
+ var { Writable } = __require("stream");
764
+ var PerMessageDeflate2 = require_permessage_deflate();
765
+ var {
766
+ BINARY_TYPES,
767
+ EMPTY_BUFFER,
768
+ kStatusCode,
769
+ kWebSocket
770
+ } = require_constants();
771
+ var { concat, toArrayBuffer, unmask } = require_buffer_util();
772
+ var { isValidStatusCode, isValidUTF8 } = require_validation();
773
+ var FastBuffer = Buffer[Symbol.species];
774
+ var GET_INFO = 0;
775
+ var GET_PAYLOAD_LENGTH_16 = 1;
776
+ var GET_PAYLOAD_LENGTH_64 = 2;
777
+ var GET_MASK = 3;
778
+ var GET_DATA = 4;
779
+ var INFLATING = 5;
780
+ var DEFER_EVENT = 6;
781
+ var Receiver2 = class extends Writable {
782
+ static {
783
+ __name(this, "Receiver");
784
+ }
785
+ /**
786
+ * Creates a Receiver instance.
787
+ *
788
+ * @param {Object} [options] Options object
789
+ * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
790
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
791
+ * multiple times in the same tick
792
+ * @param {String} [options.binaryType=nodebuffer] The type for binary data
793
+ * @param {Object} [options.extensions] An object containing the negotiated
794
+ * extensions
795
+ * @param {Boolean} [options.isServer=false] Specifies whether to operate in
796
+ * client or server mode
797
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
798
+ * buffered data chunks
799
+ * @param {Number} [options.maxFragments=0] The maximum number of message
800
+ * fragments
801
+ * @param {Number} [options.maxPayload=0] The maximum allowed message length
802
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
803
+ * not to skip UTF-8 validation for text and close messages
804
+ */
805
+ constructor(options = {}) {
806
+ super();
807
+ this._allowSynchronousEvents = options.allowSynchronousEvents !== void 0 ? options.allowSynchronousEvents : true;
808
+ this._binaryType = options.binaryType || BINARY_TYPES[0];
809
+ this._extensions = options.extensions || {};
810
+ this._isServer = !!options.isServer;
811
+ this._maxBufferedChunks = options.maxBufferedChunks | 0;
812
+ this._maxFragments = options.maxFragments | 0;
813
+ this._maxPayload = options.maxPayload | 0;
814
+ this._skipUTF8Validation = !!options.skipUTF8Validation;
815
+ this[kWebSocket] = void 0;
816
+ this._bufferedBytes = 0;
817
+ this._buffers = [];
818
+ this._compressed = false;
819
+ this._payloadLength = 0;
820
+ this._mask = void 0;
821
+ this._fragmented = 0;
822
+ this._masked = false;
823
+ this._fin = false;
824
+ this._opcode = 0;
825
+ this._totalPayloadLength = 0;
826
+ this._messageLength = 0;
827
+ this._numFragments = 0;
828
+ this._fragments = [];
829
+ this._errored = false;
830
+ this._loop = false;
831
+ this._state = GET_INFO;
832
+ }
833
+ /**
834
+ * Implements `Writable.prototype._write()`.
835
+ *
836
+ * @param {Buffer} chunk The chunk of data to write
837
+ * @param {String} encoding The character encoding of `chunk`
838
+ * @param {Function} cb Callback
839
+ * @private
840
+ */
841
+ _write(chunk, encoding, cb) {
842
+ if (this._opcode === 8 && this._state == GET_INFO) return cb();
843
+ if (this._maxBufferedChunks > 0 && this._buffers.length >= this._maxBufferedChunks) {
844
+ cb(
845
+ this.createError(
846
+ RangeError,
847
+ "Too many buffered chunks",
848
+ false,
849
+ 1008,
850
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
851
+ )
852
+ );
853
+ return;
854
+ }
855
+ this._bufferedBytes += chunk.length;
856
+ this._buffers.push(chunk);
857
+ this.startLoop(cb);
858
+ }
859
+ /**
860
+ * Consumes `n` bytes from the buffered data.
861
+ *
862
+ * @param {Number} n The number of bytes to consume
863
+ * @return {Buffer} The consumed bytes
864
+ * @private
865
+ */
866
+ consume(n) {
867
+ this._bufferedBytes -= n;
868
+ if (n === this._buffers[0].length) return this._buffers.shift();
869
+ if (n < this._buffers[0].length) {
870
+ const buf = this._buffers[0];
871
+ this._buffers[0] = new FastBuffer(
872
+ buf.buffer,
873
+ buf.byteOffset + n,
874
+ buf.length - n
875
+ );
876
+ return new FastBuffer(buf.buffer, buf.byteOffset, n);
877
+ }
878
+ const dst = Buffer.allocUnsafe(n);
879
+ do {
880
+ const buf = this._buffers[0];
881
+ const offset = dst.length - n;
882
+ if (n >= buf.length) {
883
+ dst.set(this._buffers.shift(), offset);
884
+ } else {
885
+ dst.set(new Uint8Array(buf.buffer, buf.byteOffset, n), offset);
886
+ this._buffers[0] = new FastBuffer(
887
+ buf.buffer,
888
+ buf.byteOffset + n,
889
+ buf.length - n
890
+ );
891
+ }
892
+ n -= buf.length;
893
+ } while (n > 0);
894
+ return dst;
895
+ }
896
+ /**
897
+ * Starts the parsing loop.
898
+ *
899
+ * @param {Function} cb Callback
900
+ * @private
901
+ */
902
+ startLoop(cb) {
903
+ this._loop = true;
904
+ do {
905
+ switch (this._state) {
906
+ case GET_INFO:
907
+ this.getInfo(cb);
908
+ break;
909
+ case GET_PAYLOAD_LENGTH_16:
910
+ this.getPayloadLength16(cb);
911
+ break;
912
+ case GET_PAYLOAD_LENGTH_64:
913
+ this.getPayloadLength64(cb);
914
+ break;
915
+ case GET_MASK:
916
+ this.getMask();
917
+ break;
918
+ case GET_DATA:
919
+ this.getData(cb);
920
+ break;
921
+ case INFLATING:
922
+ case DEFER_EVENT:
923
+ this._loop = false;
924
+ return;
925
+ }
926
+ } while (this._loop);
927
+ if (!this._errored) cb();
928
+ }
929
+ /**
930
+ * Reads the first two bytes of a frame.
931
+ *
932
+ * @param {Function} cb Callback
933
+ * @private
934
+ */
935
+ getInfo(cb) {
936
+ if (this._bufferedBytes < 2) {
937
+ this._loop = false;
938
+ return;
939
+ }
940
+ const buf = this.consume(2);
941
+ if ((buf[0] & 48) !== 0) {
942
+ const error = this.createError(
943
+ RangeError,
944
+ "RSV2 and RSV3 must be clear",
945
+ true,
946
+ 1002,
947
+ "WS_ERR_UNEXPECTED_RSV_2_3"
948
+ );
949
+ cb(error);
950
+ return;
951
+ }
952
+ const compressed = (buf[0] & 64) === 64;
953
+ if (compressed && !this._extensions[PerMessageDeflate2.extensionName]) {
954
+ const error = this.createError(
955
+ RangeError,
956
+ "RSV1 must be clear",
957
+ true,
958
+ 1002,
959
+ "WS_ERR_UNEXPECTED_RSV_1"
960
+ );
961
+ cb(error);
962
+ return;
963
+ }
964
+ this._fin = (buf[0] & 128) === 128;
965
+ this._opcode = buf[0] & 15;
966
+ this._payloadLength = buf[1] & 127;
967
+ if (this._opcode === 0) {
968
+ if (compressed) {
969
+ const error = this.createError(
970
+ RangeError,
971
+ "RSV1 must be clear",
972
+ true,
973
+ 1002,
974
+ "WS_ERR_UNEXPECTED_RSV_1"
975
+ );
976
+ cb(error);
977
+ return;
978
+ }
979
+ if (!this._fragmented) {
980
+ const error = this.createError(
981
+ RangeError,
982
+ "invalid opcode 0",
983
+ true,
984
+ 1002,
985
+ "WS_ERR_INVALID_OPCODE"
986
+ );
987
+ cb(error);
988
+ return;
989
+ }
990
+ this._opcode = this._fragmented;
991
+ } else if (this._opcode === 1 || this._opcode === 2) {
992
+ if (this._fragmented) {
993
+ const error = this.createError(
994
+ RangeError,
995
+ `invalid opcode ${this._opcode}`,
996
+ true,
997
+ 1002,
998
+ "WS_ERR_INVALID_OPCODE"
999
+ );
1000
+ cb(error);
1001
+ return;
1002
+ }
1003
+ this._compressed = compressed;
1004
+ } else if (this._opcode > 7 && this._opcode < 11) {
1005
+ if (!this._fin) {
1006
+ const error = this.createError(
1007
+ RangeError,
1008
+ "FIN must be set",
1009
+ true,
1010
+ 1002,
1011
+ "WS_ERR_EXPECTED_FIN"
1012
+ );
1013
+ cb(error);
1014
+ return;
1015
+ }
1016
+ if (compressed) {
1017
+ const error = this.createError(
1018
+ RangeError,
1019
+ "RSV1 must be clear",
1020
+ true,
1021
+ 1002,
1022
+ "WS_ERR_UNEXPECTED_RSV_1"
1023
+ );
1024
+ cb(error);
1025
+ return;
1026
+ }
1027
+ if (this._payloadLength > 125 || this._opcode === 8 && this._payloadLength === 1) {
1028
+ const error = this.createError(
1029
+ RangeError,
1030
+ `invalid payload length ${this._payloadLength}`,
1031
+ true,
1032
+ 1002,
1033
+ "WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH"
1034
+ );
1035
+ cb(error);
1036
+ return;
1037
+ }
1038
+ } else {
1039
+ const error = this.createError(
1040
+ RangeError,
1041
+ `invalid opcode ${this._opcode}`,
1042
+ true,
1043
+ 1002,
1044
+ "WS_ERR_INVALID_OPCODE"
1045
+ );
1046
+ cb(error);
1047
+ return;
1048
+ }
1049
+ if (!this._fin && !this._fragmented) this._fragmented = this._opcode;
1050
+ this._masked = (buf[1] & 128) === 128;
1051
+ if (this._isServer) {
1052
+ if (!this._masked) {
1053
+ const error = this.createError(
1054
+ RangeError,
1055
+ "MASK must be set",
1056
+ true,
1057
+ 1002,
1058
+ "WS_ERR_EXPECTED_MASK"
1059
+ );
1060
+ cb(error);
1061
+ return;
1062
+ }
1063
+ } else if (this._masked) {
1064
+ const error = this.createError(
1065
+ RangeError,
1066
+ "MASK must be clear",
1067
+ true,
1068
+ 1002,
1069
+ "WS_ERR_UNEXPECTED_MASK"
1070
+ );
1071
+ cb(error);
1072
+ return;
1073
+ }
1074
+ if (this._payloadLength === 126) this._state = GET_PAYLOAD_LENGTH_16;
1075
+ else if (this._payloadLength === 127) this._state = GET_PAYLOAD_LENGTH_64;
1076
+ else this.haveLength(cb);
1077
+ }
1078
+ /**
1079
+ * Gets extended payload length (7+16).
1080
+ *
1081
+ * @param {Function} cb Callback
1082
+ * @private
1083
+ */
1084
+ getPayloadLength16(cb) {
1085
+ if (this._bufferedBytes < 2) {
1086
+ this._loop = false;
1087
+ return;
1088
+ }
1089
+ this._payloadLength = this.consume(2).readUInt16BE(0);
1090
+ this.haveLength(cb);
1091
+ }
1092
+ /**
1093
+ * Gets extended payload length (7+64).
1094
+ *
1095
+ * @param {Function} cb Callback
1096
+ * @private
1097
+ */
1098
+ getPayloadLength64(cb) {
1099
+ if (this._bufferedBytes < 8) {
1100
+ this._loop = false;
1101
+ return;
1102
+ }
1103
+ const buf = this.consume(8);
1104
+ const num = buf.readUInt32BE(0);
1105
+ if (num > Math.pow(2, 53 - 32) - 1) {
1106
+ const error = this.createError(
1107
+ RangeError,
1108
+ "Unsupported WebSocket frame: payload length > 2^53 - 1",
1109
+ false,
1110
+ 1009,
1111
+ "WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH"
1112
+ );
1113
+ cb(error);
1114
+ return;
1115
+ }
1116
+ this._payloadLength = num * Math.pow(2, 32) + buf.readUInt32BE(4);
1117
+ this.haveLength(cb);
1118
+ }
1119
+ /**
1120
+ * Payload length has been read.
1121
+ *
1122
+ * @param {Function} cb Callback
1123
+ * @private
1124
+ */
1125
+ haveLength(cb) {
1126
+ if (this._payloadLength && this._opcode < 8) {
1127
+ this._totalPayloadLength += this._payloadLength;
1128
+ if (this._totalPayloadLength > this._maxPayload && this._maxPayload > 0) {
1129
+ const error = this.createError(
1130
+ RangeError,
1131
+ "Max payload size exceeded",
1132
+ false,
1133
+ 1009,
1134
+ "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
1135
+ );
1136
+ cb(error);
1137
+ return;
1138
+ }
1139
+ }
1140
+ if (this._masked) this._state = GET_MASK;
1141
+ else this._state = GET_DATA;
1142
+ }
1143
+ /**
1144
+ * Reads mask bytes.
1145
+ *
1146
+ * @private
1147
+ */
1148
+ getMask() {
1149
+ if (this._bufferedBytes < 4) {
1150
+ this._loop = false;
1151
+ return;
1152
+ }
1153
+ this._mask = this.consume(4);
1154
+ this._state = GET_DATA;
1155
+ }
1156
+ /**
1157
+ * Reads data bytes.
1158
+ *
1159
+ * @param {Function} cb Callback
1160
+ * @private
1161
+ */
1162
+ getData(cb) {
1163
+ let data = EMPTY_BUFFER;
1164
+ if (this._payloadLength) {
1165
+ if (this._bufferedBytes < this._payloadLength) {
1166
+ this._loop = false;
1167
+ return;
1168
+ }
1169
+ data = this.consume(this._payloadLength);
1170
+ if (this._masked && (this._mask[0] | this._mask[1] | this._mask[2] | this._mask[3]) !== 0) {
1171
+ unmask(data, this._mask);
1172
+ }
1173
+ }
1174
+ if (this._opcode > 7) {
1175
+ this.controlMessage(data, cb);
1176
+ return;
1177
+ }
1178
+ if (this._maxFragments > 0 && ++this._numFragments > this._maxFragments) {
1179
+ const error = this.createError(
1180
+ RangeError,
1181
+ "Too many message fragments",
1182
+ false,
1183
+ 1008,
1184
+ "WS_ERR_TOO_MANY_BUFFERED_PARTS"
1185
+ );
1186
+ cb(error);
1187
+ return;
1188
+ }
1189
+ if (this._compressed) {
1190
+ this._state = INFLATING;
1191
+ this.decompress(data, cb);
1192
+ return;
1193
+ }
1194
+ if (data.length) {
1195
+ this._messageLength = this._totalPayloadLength;
1196
+ this._fragments.push(data);
1197
+ }
1198
+ this.dataMessage(cb);
1199
+ }
1200
+ /**
1201
+ * Decompresses data.
1202
+ *
1203
+ * @param {Buffer} data Compressed data
1204
+ * @param {Function} cb Callback
1205
+ * @private
1206
+ */
1207
+ decompress(data, cb) {
1208
+ const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
1209
+ perMessageDeflate.decompress(data, this._fin, (err, buf) => {
1210
+ if (err) return cb(err);
1211
+ if (buf.length) {
1212
+ this._messageLength += buf.length;
1213
+ if (this._messageLength > this._maxPayload && this._maxPayload > 0) {
1214
+ const error = this.createError(
1215
+ RangeError,
1216
+ "Max payload size exceeded",
1217
+ false,
1218
+ 1009,
1219
+ "WS_ERR_UNSUPPORTED_MESSAGE_LENGTH"
1220
+ );
1221
+ cb(error);
1222
+ return;
1223
+ }
1224
+ this._fragments.push(buf);
1225
+ }
1226
+ this.dataMessage(cb);
1227
+ if (this._state === GET_INFO) this.startLoop(cb);
1228
+ });
1229
+ }
1230
+ /**
1231
+ * Handles a data message.
1232
+ *
1233
+ * @param {Function} cb Callback
1234
+ * @private
1235
+ */
1236
+ dataMessage(cb) {
1237
+ if (!this._fin) {
1238
+ this._state = GET_INFO;
1239
+ return;
1240
+ }
1241
+ const messageLength = this._messageLength;
1242
+ const fragments = this._fragments;
1243
+ this._totalPayloadLength = 0;
1244
+ this._messageLength = 0;
1245
+ this._fragmented = 0;
1246
+ this._numFragments = 0;
1247
+ this._fragments = [];
1248
+ if (this._opcode === 2) {
1249
+ let data;
1250
+ if (this._binaryType === "nodebuffer") {
1251
+ data = concat(fragments, messageLength);
1252
+ } else if (this._binaryType === "arraybuffer") {
1253
+ data = toArrayBuffer(concat(fragments, messageLength));
1254
+ } else if (this._binaryType === "blob") {
1255
+ data = new Blob(fragments);
1256
+ } else {
1257
+ data = fragments;
1258
+ }
1259
+ if (this._allowSynchronousEvents) {
1260
+ this.emit("message", data, true);
1261
+ this._state = GET_INFO;
1262
+ } else {
1263
+ this._state = DEFER_EVENT;
1264
+ setImmediate(() => {
1265
+ this.emit("message", data, true);
1266
+ this._state = GET_INFO;
1267
+ this.startLoop(cb);
1268
+ });
1269
+ }
1270
+ } else {
1271
+ const buf = concat(fragments, messageLength);
1272
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
1273
+ const error = this.createError(
1274
+ Error,
1275
+ "invalid UTF-8 sequence",
1276
+ true,
1277
+ 1007,
1278
+ "WS_ERR_INVALID_UTF8"
1279
+ );
1280
+ cb(error);
1281
+ return;
1282
+ }
1283
+ if (this._state === INFLATING || this._allowSynchronousEvents) {
1284
+ this.emit("message", buf, false);
1285
+ this._state = GET_INFO;
1286
+ } else {
1287
+ this._state = DEFER_EVENT;
1288
+ setImmediate(() => {
1289
+ this.emit("message", buf, false);
1290
+ this._state = GET_INFO;
1291
+ this.startLoop(cb);
1292
+ });
1293
+ }
1294
+ }
1295
+ }
1296
+ /**
1297
+ * Handles a control message.
1298
+ *
1299
+ * @param {Buffer} data Data to handle
1300
+ * @return {(Error|RangeError|undefined)} A possible error
1301
+ * @private
1302
+ */
1303
+ controlMessage(data, cb) {
1304
+ if (this._opcode === 8) {
1305
+ if (data.length === 0) {
1306
+ this._loop = false;
1307
+ this.emit("conclude", 1005, EMPTY_BUFFER);
1308
+ this.end();
1309
+ } else {
1310
+ const code = data.readUInt16BE(0);
1311
+ if (!isValidStatusCode(code)) {
1312
+ const error = this.createError(
1313
+ RangeError,
1314
+ `invalid status code ${code}`,
1315
+ true,
1316
+ 1002,
1317
+ "WS_ERR_INVALID_CLOSE_CODE"
1318
+ );
1319
+ cb(error);
1320
+ return;
1321
+ }
1322
+ const buf = new FastBuffer(
1323
+ data.buffer,
1324
+ data.byteOffset + 2,
1325
+ data.length - 2
1326
+ );
1327
+ if (!this._skipUTF8Validation && !isValidUTF8(buf)) {
1328
+ const error = this.createError(
1329
+ Error,
1330
+ "invalid UTF-8 sequence",
1331
+ true,
1332
+ 1007,
1333
+ "WS_ERR_INVALID_UTF8"
1334
+ );
1335
+ cb(error);
1336
+ return;
1337
+ }
1338
+ this._loop = false;
1339
+ this.emit("conclude", code, buf);
1340
+ this.end();
1341
+ }
1342
+ this._state = GET_INFO;
1343
+ return;
1344
+ }
1345
+ if (this._allowSynchronousEvents) {
1346
+ this.emit(this._opcode === 9 ? "ping" : "pong", data);
1347
+ this._state = GET_INFO;
1348
+ } else {
1349
+ this._state = DEFER_EVENT;
1350
+ setImmediate(() => {
1351
+ this.emit(this._opcode === 9 ? "ping" : "pong", data);
1352
+ this._state = GET_INFO;
1353
+ this.startLoop(cb);
1354
+ });
1355
+ }
1356
+ }
1357
+ /**
1358
+ * Builds an error object.
1359
+ *
1360
+ * @param {function(new:Error|RangeError)} ErrorCtor The error constructor
1361
+ * @param {String} message The error message
1362
+ * @param {Boolean} prefix Specifies whether or not to add a default prefix to
1363
+ * `message`
1364
+ * @param {Number} statusCode The status code
1365
+ * @param {String} errorCode The exposed error code
1366
+ * @return {(Error|RangeError)} The error
1367
+ * @private
1368
+ */
1369
+ createError(ErrorCtor, message, prefix, statusCode, errorCode) {
1370
+ this._loop = false;
1371
+ this._errored = true;
1372
+ const err = new ErrorCtor(
1373
+ prefix ? `Invalid WebSocket frame: ${message}` : message
1374
+ );
1375
+ Error.captureStackTrace(err, this.createError);
1376
+ err.code = errorCode;
1377
+ err[kStatusCode] = statusCode;
1378
+ return err;
1379
+ }
1380
+ };
1381
+ module.exports = Receiver2;
1382
+ }
1383
+ });
1384
+
1385
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js
1386
+ var require_sender = __commonJS({
1387
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/sender.js"(exports, module) {
1388
+ "use strict";
1389
+ var { Duplex } = __require("stream");
1390
+ var { randomFillSync } = __require("crypto");
1391
+ var {
1392
+ types: { isUint8Array }
1393
+ } = __require("util");
1394
+ var PerMessageDeflate2 = require_permessage_deflate();
1395
+ var { EMPTY_BUFFER, kWebSocket, NOOP } = require_constants();
1396
+ var { isBlob, isValidStatusCode } = require_validation();
1397
+ var { mask: applyMask, toBuffer } = require_buffer_util();
1398
+ var kByteLength = /* @__PURE__ */ Symbol("kByteLength");
1399
+ var maskBuffer = Buffer.alloc(4);
1400
+ var RANDOM_POOL_SIZE = 8 * 1024;
1401
+ var randomPool;
1402
+ var randomPoolPointer = RANDOM_POOL_SIZE;
1403
+ var DEFAULT = 0;
1404
+ var DEFLATING = 1;
1405
+ var GET_BLOB_DATA = 2;
1406
+ var Sender2 = class _Sender {
1407
+ static {
1408
+ __name(this, "Sender");
1409
+ }
1410
+ /**
1411
+ * Creates a Sender instance.
1412
+ *
1413
+ * @param {Duplex} socket The connection socket
1414
+ * @param {Object} [extensions] An object containing the negotiated extensions
1415
+ * @param {Function} [generateMask] The function used to generate the masking
1416
+ * key
1417
+ */
1418
+ constructor(socket, extensions, generateMask) {
1419
+ this._extensions = extensions || {};
1420
+ if (generateMask) {
1421
+ this._generateMask = generateMask;
1422
+ this._maskBuffer = Buffer.alloc(4);
1423
+ }
1424
+ this._socket = socket;
1425
+ this._firstFragment = true;
1426
+ this._compress = false;
1427
+ this._bufferedBytes = 0;
1428
+ this._queue = [];
1429
+ this._state = DEFAULT;
1430
+ this.onerror = NOOP;
1431
+ this[kWebSocket] = void 0;
1432
+ }
1433
+ /**
1434
+ * Frames a piece of data according to the HyBi WebSocket protocol.
1435
+ *
1436
+ * @param {(Buffer|String)} data The data to frame
1437
+ * @param {Object} options Options object
1438
+ * @param {Boolean} [options.fin=false] Specifies whether or not to set the
1439
+ * FIN bit
1440
+ * @param {Function} [options.generateMask] The function used to generate the
1441
+ * masking key
1442
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1443
+ * `data`
1444
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
1445
+ * key
1446
+ * @param {Number} options.opcode The opcode
1447
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
1448
+ * modified
1449
+ * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
1450
+ * RSV1 bit
1451
+ * @return {(Buffer|String)[]} The framed data
1452
+ * @public
1453
+ */
1454
+ static frame(data, options) {
1455
+ let mask;
1456
+ let merge = false;
1457
+ let offset = 2;
1458
+ let skipMasking = false;
1459
+ if (options.mask) {
1460
+ mask = options.maskBuffer || maskBuffer;
1461
+ if (options.generateMask) {
1462
+ options.generateMask(mask);
1463
+ } else {
1464
+ if (randomPoolPointer === RANDOM_POOL_SIZE) {
1465
+ if (randomPool === void 0) {
1466
+ randomPool = Buffer.alloc(RANDOM_POOL_SIZE);
1467
+ }
1468
+ randomFillSync(randomPool, 0, RANDOM_POOL_SIZE);
1469
+ randomPoolPointer = 0;
1470
+ }
1471
+ mask[0] = randomPool[randomPoolPointer++];
1472
+ mask[1] = randomPool[randomPoolPointer++];
1473
+ mask[2] = randomPool[randomPoolPointer++];
1474
+ mask[3] = randomPool[randomPoolPointer++];
1475
+ }
1476
+ skipMasking = (mask[0] | mask[1] | mask[2] | mask[3]) === 0;
1477
+ offset = 6;
1478
+ }
1479
+ let dataLength;
1480
+ if (typeof data === "string") {
1481
+ if ((!options.mask || skipMasking) && options[kByteLength] !== void 0) {
1482
+ dataLength = options[kByteLength];
1483
+ } else {
1484
+ data = Buffer.from(data);
1485
+ dataLength = data.length;
1486
+ }
1487
+ } else {
1488
+ dataLength = data.length;
1489
+ merge = options.mask && options.readOnly && !skipMasking;
1490
+ }
1491
+ let payloadLength = dataLength;
1492
+ if (dataLength >= 65536) {
1493
+ offset += 8;
1494
+ payloadLength = 127;
1495
+ } else if (dataLength > 125) {
1496
+ offset += 2;
1497
+ payloadLength = 126;
1498
+ }
1499
+ const target = Buffer.allocUnsafe(merge ? dataLength + offset : offset);
1500
+ target[0] = options.fin ? options.opcode | 128 : options.opcode;
1501
+ if (options.rsv1) target[0] |= 64;
1502
+ target[1] = payloadLength;
1503
+ if (payloadLength === 126) {
1504
+ target.writeUInt16BE(dataLength, 2);
1505
+ } else if (payloadLength === 127) {
1506
+ target[2] = target[3] = 0;
1507
+ target.writeUIntBE(dataLength, 4, 6);
1508
+ }
1509
+ if (!options.mask) return [target, data];
1510
+ target[1] |= 128;
1511
+ target[offset - 4] = mask[0];
1512
+ target[offset - 3] = mask[1];
1513
+ target[offset - 2] = mask[2];
1514
+ target[offset - 1] = mask[3];
1515
+ if (skipMasking) return [target, data];
1516
+ if (merge) {
1517
+ applyMask(data, mask, target, offset, dataLength);
1518
+ return [target];
1519
+ }
1520
+ applyMask(data, mask, data, 0, dataLength);
1521
+ return [target, data];
1522
+ }
1523
+ /**
1524
+ * Sends a close message to the other peer.
1525
+ *
1526
+ * @param {Number} [code] The status code component of the body
1527
+ * @param {(String|Buffer)} [data] The message component of the body
1528
+ * @param {Boolean} [mask=false] Specifies whether or not to mask the message
1529
+ * @param {Function} [cb] Callback
1530
+ * @public
1531
+ */
1532
+ close(code, data, mask, cb) {
1533
+ let buf;
1534
+ if (code === void 0) {
1535
+ buf = EMPTY_BUFFER;
1536
+ } else if (typeof code !== "number" || !isValidStatusCode(code)) {
1537
+ throw new TypeError("First argument must be a valid error code number");
1538
+ } else if (data === void 0 || !data.length) {
1539
+ buf = Buffer.allocUnsafe(2);
1540
+ buf.writeUInt16BE(code, 0);
1541
+ } else {
1542
+ const length = Buffer.byteLength(data);
1543
+ if (length > 123) {
1544
+ throw new RangeError("The message must not be greater than 123 bytes");
1545
+ }
1546
+ buf = Buffer.allocUnsafe(2 + length);
1547
+ buf.writeUInt16BE(code, 0);
1548
+ if (typeof data === "string") {
1549
+ buf.write(data, 2);
1550
+ } else if (isUint8Array(data)) {
1551
+ buf.set(data, 2);
1552
+ } else {
1553
+ throw new TypeError("Second argument must be a string or a Uint8Array");
1554
+ }
1555
+ }
1556
+ const options = {
1557
+ [kByteLength]: buf.length,
1558
+ fin: true,
1559
+ generateMask: this._generateMask,
1560
+ mask,
1561
+ maskBuffer: this._maskBuffer,
1562
+ opcode: 8,
1563
+ readOnly: false,
1564
+ rsv1: false
1565
+ };
1566
+ if (this._state !== DEFAULT) {
1567
+ this.enqueue([this.dispatch, buf, false, options, cb]);
1568
+ } else {
1569
+ this.sendFrame(_Sender.frame(buf, options), cb);
1570
+ }
1571
+ }
1572
+ /**
1573
+ * Sends a ping message to the other peer.
1574
+ *
1575
+ * @param {*} data The message to send
1576
+ * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
1577
+ * @param {Function} [cb] Callback
1578
+ * @public
1579
+ */
1580
+ ping(data, mask, cb) {
1581
+ let byteLength;
1582
+ let readOnly;
1583
+ if (typeof data === "string") {
1584
+ byteLength = Buffer.byteLength(data);
1585
+ readOnly = false;
1586
+ } else if (isBlob(data)) {
1587
+ byteLength = data.size;
1588
+ readOnly = false;
1589
+ } else {
1590
+ data = toBuffer(data);
1591
+ byteLength = data.length;
1592
+ readOnly = toBuffer.readOnly;
1593
+ }
1594
+ if (byteLength > 125) {
1595
+ throw new RangeError("The data size must not be greater than 125 bytes");
1596
+ }
1597
+ const options = {
1598
+ [kByteLength]: byteLength,
1599
+ fin: true,
1600
+ generateMask: this._generateMask,
1601
+ mask,
1602
+ maskBuffer: this._maskBuffer,
1603
+ opcode: 9,
1604
+ readOnly,
1605
+ rsv1: false
1606
+ };
1607
+ if (isBlob(data)) {
1608
+ if (this._state !== DEFAULT) {
1609
+ this.enqueue([this.getBlobData, data, false, options, cb]);
1610
+ } else {
1611
+ this.getBlobData(data, false, options, cb);
1612
+ }
1613
+ } else if (this._state !== DEFAULT) {
1614
+ this.enqueue([this.dispatch, data, false, options, cb]);
1615
+ } else {
1616
+ this.sendFrame(_Sender.frame(data, options), cb);
1617
+ }
1618
+ }
1619
+ /**
1620
+ * Sends a pong message to the other peer.
1621
+ *
1622
+ * @param {*} data The message to send
1623
+ * @param {Boolean} [mask=false] Specifies whether or not to mask `data`
1624
+ * @param {Function} [cb] Callback
1625
+ * @public
1626
+ */
1627
+ pong(data, mask, cb) {
1628
+ let byteLength;
1629
+ let readOnly;
1630
+ if (typeof data === "string") {
1631
+ byteLength = Buffer.byteLength(data);
1632
+ readOnly = false;
1633
+ } else if (isBlob(data)) {
1634
+ byteLength = data.size;
1635
+ readOnly = false;
1636
+ } else {
1637
+ data = toBuffer(data);
1638
+ byteLength = data.length;
1639
+ readOnly = toBuffer.readOnly;
1640
+ }
1641
+ if (byteLength > 125) {
1642
+ throw new RangeError("The data size must not be greater than 125 bytes");
1643
+ }
1644
+ const options = {
1645
+ [kByteLength]: byteLength,
1646
+ fin: true,
1647
+ generateMask: this._generateMask,
1648
+ mask,
1649
+ maskBuffer: this._maskBuffer,
1650
+ opcode: 10,
1651
+ readOnly,
1652
+ rsv1: false
1653
+ };
1654
+ if (isBlob(data)) {
1655
+ if (this._state !== DEFAULT) {
1656
+ this.enqueue([this.getBlobData, data, false, options, cb]);
1657
+ } else {
1658
+ this.getBlobData(data, false, options, cb);
1659
+ }
1660
+ } else if (this._state !== DEFAULT) {
1661
+ this.enqueue([this.dispatch, data, false, options, cb]);
1662
+ } else {
1663
+ this.sendFrame(_Sender.frame(data, options), cb);
1664
+ }
1665
+ }
1666
+ /**
1667
+ * Sends a data message to the other peer.
1668
+ *
1669
+ * @param {*} data The message to send
1670
+ * @param {Object} options Options object
1671
+ * @param {Boolean} [options.binary=false] Specifies whether `data` is binary
1672
+ * or text
1673
+ * @param {Boolean} [options.compress=false] Specifies whether or not to
1674
+ * compress `data`
1675
+ * @param {Boolean} [options.fin=false] Specifies whether the fragment is the
1676
+ * last one
1677
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1678
+ * `data`
1679
+ * @param {Function} [cb] Callback
1680
+ * @public
1681
+ */
1682
+ send(data, options, cb) {
1683
+ const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
1684
+ let opcode = options.binary ? 2 : 1;
1685
+ let rsv1 = options.compress;
1686
+ let byteLength;
1687
+ let readOnly;
1688
+ if (typeof data === "string") {
1689
+ byteLength = Buffer.byteLength(data);
1690
+ readOnly = false;
1691
+ } else if (isBlob(data)) {
1692
+ byteLength = data.size;
1693
+ readOnly = false;
1694
+ } else {
1695
+ data = toBuffer(data);
1696
+ byteLength = data.length;
1697
+ readOnly = toBuffer.readOnly;
1698
+ }
1699
+ if (this._firstFragment) {
1700
+ this._firstFragment = false;
1701
+ if (rsv1 && perMessageDeflate && perMessageDeflate.params[perMessageDeflate._isServer ? "server_no_context_takeover" : "client_no_context_takeover"]) {
1702
+ rsv1 = byteLength >= perMessageDeflate._threshold;
1703
+ }
1704
+ this._compress = rsv1;
1705
+ } else {
1706
+ rsv1 = false;
1707
+ opcode = 0;
1708
+ }
1709
+ if (options.fin) this._firstFragment = true;
1710
+ const opts = {
1711
+ [kByteLength]: byteLength,
1712
+ fin: options.fin,
1713
+ generateMask: this._generateMask,
1714
+ mask: options.mask,
1715
+ maskBuffer: this._maskBuffer,
1716
+ opcode,
1717
+ readOnly,
1718
+ rsv1
1719
+ };
1720
+ if (isBlob(data)) {
1721
+ if (this._state !== DEFAULT) {
1722
+ this.enqueue([this.getBlobData, data, this._compress, opts, cb]);
1723
+ } else {
1724
+ this.getBlobData(data, this._compress, opts, cb);
1725
+ }
1726
+ } else if (this._state !== DEFAULT) {
1727
+ this.enqueue([this.dispatch, data, this._compress, opts, cb]);
1728
+ } else {
1729
+ this.dispatch(data, this._compress, opts, cb);
1730
+ }
1731
+ }
1732
+ /**
1733
+ * Gets the contents of a blob as binary data.
1734
+ *
1735
+ * @param {Blob} blob The blob
1736
+ * @param {Boolean} [compress=false] Specifies whether or not to compress
1737
+ * the data
1738
+ * @param {Object} options Options object
1739
+ * @param {Boolean} [options.fin=false] Specifies whether or not to set the
1740
+ * FIN bit
1741
+ * @param {Function} [options.generateMask] The function used to generate the
1742
+ * masking key
1743
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1744
+ * `data`
1745
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
1746
+ * key
1747
+ * @param {Number} options.opcode The opcode
1748
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
1749
+ * modified
1750
+ * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
1751
+ * RSV1 bit
1752
+ * @param {Function} [cb] Callback
1753
+ * @private
1754
+ */
1755
+ getBlobData(blob, compress, options, cb) {
1756
+ this._bufferedBytes += options[kByteLength];
1757
+ this._state = GET_BLOB_DATA;
1758
+ blob.arrayBuffer().then((arrayBuffer) => {
1759
+ if (this._socket.destroyed) {
1760
+ const err = new Error(
1761
+ "The socket was closed while the blob was being read"
1762
+ );
1763
+ process.nextTick(callCallbacks, this, err, cb);
1764
+ return;
1765
+ }
1766
+ this._bufferedBytes -= options[kByteLength];
1767
+ const data = toBuffer(arrayBuffer);
1768
+ if (!compress) {
1769
+ this._state = DEFAULT;
1770
+ this.sendFrame(_Sender.frame(data, options), cb);
1771
+ this.dequeue();
1772
+ } else {
1773
+ this.dispatch(data, compress, options, cb);
1774
+ }
1775
+ }).catch((err) => {
1776
+ process.nextTick(onError, this, err, cb);
1777
+ });
1778
+ }
1779
+ /**
1780
+ * Dispatches a message.
1781
+ *
1782
+ * @param {(Buffer|String)} data The message to send
1783
+ * @param {Boolean} [compress=false] Specifies whether or not to compress
1784
+ * `data`
1785
+ * @param {Object} options Options object
1786
+ * @param {Boolean} [options.fin=false] Specifies whether or not to set the
1787
+ * FIN bit
1788
+ * @param {Function} [options.generateMask] The function used to generate the
1789
+ * masking key
1790
+ * @param {Boolean} [options.mask=false] Specifies whether or not to mask
1791
+ * `data`
1792
+ * @param {Buffer} [options.maskBuffer] The buffer used to store the masking
1793
+ * key
1794
+ * @param {Number} options.opcode The opcode
1795
+ * @param {Boolean} [options.readOnly=false] Specifies whether `data` can be
1796
+ * modified
1797
+ * @param {Boolean} [options.rsv1=false] Specifies whether or not to set the
1798
+ * RSV1 bit
1799
+ * @param {Function} [cb] Callback
1800
+ * @private
1801
+ */
1802
+ dispatch(data, compress, options, cb) {
1803
+ if (!compress) {
1804
+ this.sendFrame(_Sender.frame(data, options), cb);
1805
+ return;
1806
+ }
1807
+ const perMessageDeflate = this._extensions[PerMessageDeflate2.extensionName];
1808
+ this._bufferedBytes += options[kByteLength];
1809
+ this._state = DEFLATING;
1810
+ perMessageDeflate.compress(data, options.fin, (_, buf) => {
1811
+ if (this._socket.destroyed) {
1812
+ const err = new Error(
1813
+ "The socket was closed while data was being compressed"
1814
+ );
1815
+ callCallbacks(this, err, cb);
1816
+ return;
1817
+ }
1818
+ this._bufferedBytes -= options[kByteLength];
1819
+ this._state = DEFAULT;
1820
+ options.readOnly = false;
1821
+ this.sendFrame(_Sender.frame(buf, options), cb);
1822
+ this.dequeue();
1823
+ });
1824
+ }
1825
+ /**
1826
+ * Executes queued send operations.
1827
+ *
1828
+ * @private
1829
+ */
1830
+ dequeue() {
1831
+ while (this._state === DEFAULT && this._queue.length) {
1832
+ const params = this._queue.shift();
1833
+ this._bufferedBytes -= params[3][kByteLength];
1834
+ Reflect.apply(params[0], this, params.slice(1));
1835
+ }
1836
+ }
1837
+ /**
1838
+ * Enqueues a send operation.
1839
+ *
1840
+ * @param {Array} params Send operation parameters.
1841
+ * @private
1842
+ */
1843
+ enqueue(params) {
1844
+ this._bufferedBytes += params[3][kByteLength];
1845
+ this._queue.push(params);
1846
+ }
1847
+ /**
1848
+ * Sends a frame.
1849
+ *
1850
+ * @param {(Buffer | String)[]} list The frame to send
1851
+ * @param {Function} [cb] Callback
1852
+ * @private
1853
+ */
1854
+ sendFrame(list, cb) {
1855
+ if (list.length === 2) {
1856
+ this._socket.cork();
1857
+ this._socket.write(list[0]);
1858
+ this._socket.write(list[1], cb);
1859
+ this._socket.uncork();
1860
+ } else {
1861
+ this._socket.write(list[0], cb);
1862
+ }
1863
+ }
1864
+ };
1865
+ module.exports = Sender2;
1866
+ function callCallbacks(sender, err, cb) {
1867
+ if (typeof cb === "function") cb(err);
1868
+ for (let i = 0; i < sender._queue.length; i++) {
1869
+ const params = sender._queue[i];
1870
+ const callback = params[params.length - 1];
1871
+ if (typeof callback === "function") callback(err);
1872
+ }
1873
+ }
1874
+ __name(callCallbacks, "callCallbacks");
1875
+ function onError(sender, err, cb) {
1876
+ callCallbacks(sender, err, cb);
1877
+ sender.onerror(err);
1878
+ }
1879
+ __name(onError, "onError");
1880
+ }
1881
+ });
1882
+
1883
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js
1884
+ var require_event_target = __commonJS({
1885
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/event-target.js"(exports, module) {
1886
+ "use strict";
1887
+ var { kForOnEventAttribute, kListener } = require_constants();
1888
+ var kCode = /* @__PURE__ */ Symbol("kCode");
1889
+ var kData = /* @__PURE__ */ Symbol("kData");
1890
+ var kError = /* @__PURE__ */ Symbol("kError");
1891
+ var kMessage = /* @__PURE__ */ Symbol("kMessage");
1892
+ var kReason = /* @__PURE__ */ Symbol("kReason");
1893
+ var kTarget = /* @__PURE__ */ Symbol("kTarget");
1894
+ var kType = /* @__PURE__ */ Symbol("kType");
1895
+ var kWasClean = /* @__PURE__ */ Symbol("kWasClean");
1896
+ var Event = class {
1897
+ static {
1898
+ __name(this, "Event");
1899
+ }
1900
+ /**
1901
+ * Create a new `Event`.
1902
+ *
1903
+ * @param {String} type The name of the event
1904
+ * @throws {TypeError} If the `type` argument is not specified
1905
+ */
1906
+ constructor(type) {
1907
+ this[kTarget] = null;
1908
+ this[kType] = type;
1909
+ }
1910
+ /**
1911
+ * @type {*}
1912
+ */
1913
+ get target() {
1914
+ return this[kTarget];
1915
+ }
1916
+ /**
1917
+ * @type {String}
1918
+ */
1919
+ get type() {
1920
+ return this[kType];
1921
+ }
1922
+ };
1923
+ Object.defineProperty(Event.prototype, "target", { enumerable: true });
1924
+ Object.defineProperty(Event.prototype, "type", { enumerable: true });
1925
+ var CloseEvent = class extends Event {
1926
+ static {
1927
+ __name(this, "CloseEvent");
1928
+ }
1929
+ /**
1930
+ * Create a new `CloseEvent`.
1931
+ *
1932
+ * @param {String} type The name of the event
1933
+ * @param {Object} [options] A dictionary object that allows for setting
1934
+ * attributes via object members of the same name
1935
+ * @param {Number} [options.code=0] The status code explaining why the
1936
+ * connection was closed
1937
+ * @param {String} [options.reason=''] A human-readable string explaining why
1938
+ * the connection was closed
1939
+ * @param {Boolean} [options.wasClean=false] Indicates whether or not the
1940
+ * connection was cleanly closed
1941
+ */
1942
+ constructor(type, options = {}) {
1943
+ super(type);
1944
+ this[kCode] = options.code === void 0 ? 0 : options.code;
1945
+ this[kReason] = options.reason === void 0 ? "" : options.reason;
1946
+ this[kWasClean] = options.wasClean === void 0 ? false : options.wasClean;
1947
+ }
1948
+ /**
1949
+ * @type {Number}
1950
+ */
1951
+ get code() {
1952
+ return this[kCode];
1953
+ }
1954
+ /**
1955
+ * @type {String}
1956
+ */
1957
+ get reason() {
1958
+ return this[kReason];
1959
+ }
1960
+ /**
1961
+ * @type {Boolean}
1962
+ */
1963
+ get wasClean() {
1964
+ return this[kWasClean];
1965
+ }
1966
+ };
1967
+ Object.defineProperty(CloseEvent.prototype, "code", { enumerable: true });
1968
+ Object.defineProperty(CloseEvent.prototype, "reason", { enumerable: true });
1969
+ Object.defineProperty(CloseEvent.prototype, "wasClean", { enumerable: true });
1970
+ var ErrorEvent = class extends Event {
1971
+ static {
1972
+ __name(this, "ErrorEvent");
1973
+ }
1974
+ /**
1975
+ * Create a new `ErrorEvent`.
1976
+ *
1977
+ * @param {String} type The name of the event
1978
+ * @param {Object} [options] A dictionary object that allows for setting
1979
+ * attributes via object members of the same name
1980
+ * @param {*} [options.error=null] The error that generated this event
1981
+ * @param {String} [options.message=''] The error message
1982
+ */
1983
+ constructor(type, options = {}) {
1984
+ super(type);
1985
+ this[kError] = options.error === void 0 ? null : options.error;
1986
+ this[kMessage] = options.message === void 0 ? "" : options.message;
1987
+ }
1988
+ /**
1989
+ * @type {*}
1990
+ */
1991
+ get error() {
1992
+ return this[kError];
1993
+ }
1994
+ /**
1995
+ * @type {String}
1996
+ */
1997
+ get message() {
1998
+ return this[kMessage];
1999
+ }
2000
+ };
2001
+ Object.defineProperty(ErrorEvent.prototype, "error", { enumerable: true });
2002
+ Object.defineProperty(ErrorEvent.prototype, "message", { enumerable: true });
2003
+ var MessageEvent = class extends Event {
2004
+ static {
2005
+ __name(this, "MessageEvent");
2006
+ }
2007
+ /**
2008
+ * Create a new `MessageEvent`.
2009
+ *
2010
+ * @param {String} type The name of the event
2011
+ * @param {Object} [options] A dictionary object that allows for setting
2012
+ * attributes via object members of the same name
2013
+ * @param {*} [options.data=null] The message content
2014
+ */
2015
+ constructor(type, options = {}) {
2016
+ super(type);
2017
+ this[kData] = options.data === void 0 ? null : options.data;
2018
+ }
2019
+ /**
2020
+ * @type {*}
2021
+ */
2022
+ get data() {
2023
+ return this[kData];
2024
+ }
2025
+ };
2026
+ Object.defineProperty(MessageEvent.prototype, "data", { enumerable: true });
2027
+ var EventTarget = {
2028
+ /**
2029
+ * Register an event listener.
2030
+ *
2031
+ * @param {String} type A string representing the event type to listen for
2032
+ * @param {(Function|Object)} handler The listener to add
2033
+ * @param {Object} [options] An options object specifies characteristics about
2034
+ * the event listener
2035
+ * @param {Boolean} [options.once=false] A `Boolean` indicating that the
2036
+ * listener should be invoked at most once after being added. If `true`,
2037
+ * the listener would be automatically removed when invoked.
2038
+ * @public
2039
+ */
2040
+ addEventListener(type, handler, options = {}) {
2041
+ for (const listener of this.listeners(type)) {
2042
+ if (!options[kForOnEventAttribute] && listener[kListener] === handler && !listener[kForOnEventAttribute]) {
2043
+ return;
2044
+ }
2045
+ }
2046
+ let wrapper;
2047
+ if (type === "message") {
2048
+ wrapper = /* @__PURE__ */ __name(function onMessage(data, isBinary) {
2049
+ const event = new MessageEvent("message", {
2050
+ data: isBinary ? data : data.toString()
2051
+ });
2052
+ event[kTarget] = this;
2053
+ callListener(handler, this, event);
2054
+ }, "onMessage");
2055
+ } else if (type === "close") {
2056
+ wrapper = /* @__PURE__ */ __name(function onClose(code, message) {
2057
+ const event = new CloseEvent("close", {
2058
+ code,
2059
+ reason: message.toString(),
2060
+ wasClean: this._closeFrameReceived && this._closeFrameSent
2061
+ });
2062
+ event[kTarget] = this;
2063
+ callListener(handler, this, event);
2064
+ }, "onClose");
2065
+ } else if (type === "error") {
2066
+ wrapper = /* @__PURE__ */ __name(function onError(error) {
2067
+ const event = new ErrorEvent("error", {
2068
+ error,
2069
+ message: error.message
2070
+ });
2071
+ event[kTarget] = this;
2072
+ callListener(handler, this, event);
2073
+ }, "onError");
2074
+ } else if (type === "open") {
2075
+ wrapper = /* @__PURE__ */ __name(function onOpen() {
2076
+ const event = new Event("open");
2077
+ event[kTarget] = this;
2078
+ callListener(handler, this, event);
2079
+ }, "onOpen");
2080
+ } else {
2081
+ return;
2082
+ }
2083
+ wrapper[kForOnEventAttribute] = !!options[kForOnEventAttribute];
2084
+ wrapper[kListener] = handler;
2085
+ if (options.once) {
2086
+ this.once(type, wrapper);
2087
+ } else {
2088
+ this.on(type, wrapper);
2089
+ }
2090
+ },
2091
+ /**
2092
+ * Remove an event listener.
2093
+ *
2094
+ * @param {String} type A string representing the event type to remove
2095
+ * @param {(Function|Object)} handler The listener to remove
2096
+ * @public
2097
+ */
2098
+ removeEventListener(type, handler) {
2099
+ for (const listener of this.listeners(type)) {
2100
+ if (listener[kListener] === handler && !listener[kForOnEventAttribute]) {
2101
+ this.removeListener(type, listener);
2102
+ break;
2103
+ }
2104
+ }
2105
+ }
2106
+ };
2107
+ module.exports = {
2108
+ CloseEvent,
2109
+ ErrorEvent,
2110
+ Event,
2111
+ EventTarget,
2112
+ MessageEvent
2113
+ };
2114
+ function callListener(listener, thisArg, event) {
2115
+ if (typeof listener === "object" && listener.handleEvent) {
2116
+ listener.handleEvent.call(listener, event);
2117
+ } else {
2118
+ listener.call(thisArg, event);
2119
+ }
2120
+ }
2121
+ __name(callListener, "callListener");
2122
+ }
2123
+ });
2124
+
2125
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js
2126
+ var require_extension = __commonJS({
2127
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/extension.js"(exports, module) {
2128
+ "use strict";
2129
+ var { tokenChars } = require_validation();
2130
+ function push(dest, name, elem) {
2131
+ if (dest[name] === void 0) dest[name] = [elem];
2132
+ else dest[name].push(elem);
2133
+ }
2134
+ __name(push, "push");
2135
+ function parse(header) {
2136
+ const offers = /* @__PURE__ */ Object.create(null);
2137
+ let params = /* @__PURE__ */ Object.create(null);
2138
+ let mustUnescape = false;
2139
+ let isEscaping = false;
2140
+ let inQuotes = false;
2141
+ let extensionName;
2142
+ let paramName;
2143
+ let start = -1;
2144
+ let code = -1;
2145
+ let end = -1;
2146
+ let i = 0;
2147
+ for (; i < header.length; i++) {
2148
+ code = header.charCodeAt(i);
2149
+ if (extensionName === void 0) {
2150
+ if (end === -1 && tokenChars[code] === 1) {
2151
+ if (start === -1) start = i;
2152
+ } else if (i !== 0 && (code === 32 || code === 9)) {
2153
+ if (end === -1 && start !== -1) end = i;
2154
+ } else if (code === 59 || code === 44) {
2155
+ if (start === -1) {
2156
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2157
+ }
2158
+ if (end === -1) end = i;
2159
+ const name = header.slice(start, end);
2160
+ if (code === 44) {
2161
+ push(offers, name, params);
2162
+ params = /* @__PURE__ */ Object.create(null);
2163
+ } else {
2164
+ extensionName = name;
2165
+ }
2166
+ start = end = -1;
2167
+ } else {
2168
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2169
+ }
2170
+ } else if (paramName === void 0) {
2171
+ if (end === -1 && tokenChars[code] === 1) {
2172
+ if (start === -1) start = i;
2173
+ } else if (code === 32 || code === 9) {
2174
+ if (end === -1 && start !== -1) end = i;
2175
+ } else if (code === 59 || code === 44) {
2176
+ if (start === -1) {
2177
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2178
+ }
2179
+ if (end === -1) end = i;
2180
+ push(params, header.slice(start, end), true);
2181
+ if (code === 44) {
2182
+ push(offers, extensionName, params);
2183
+ params = /* @__PURE__ */ Object.create(null);
2184
+ extensionName = void 0;
2185
+ }
2186
+ start = end = -1;
2187
+ } else if (code === 61 && start !== -1 && end === -1) {
2188
+ paramName = header.slice(start, i);
2189
+ start = end = -1;
2190
+ } else {
2191
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2192
+ }
2193
+ } else {
2194
+ if (isEscaping) {
2195
+ if (tokenChars[code] !== 1) {
2196
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2197
+ }
2198
+ if (start === -1) start = i;
2199
+ else if (!mustUnescape) mustUnescape = true;
2200
+ isEscaping = false;
2201
+ } else if (inQuotes) {
2202
+ if (tokenChars[code] === 1) {
2203
+ if (start === -1) start = i;
2204
+ } else if (code === 34 && start !== -1) {
2205
+ inQuotes = false;
2206
+ end = i;
2207
+ } else if (code === 92) {
2208
+ isEscaping = true;
2209
+ } else {
2210
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2211
+ }
2212
+ } else if (code === 34 && header.charCodeAt(i - 1) === 61) {
2213
+ inQuotes = true;
2214
+ } else if (end === -1 && tokenChars[code] === 1) {
2215
+ if (start === -1) start = i;
2216
+ } else if (start !== -1 && (code === 32 || code === 9)) {
2217
+ if (end === -1) end = i;
2218
+ } else if (code === 59 || code === 44) {
2219
+ if (start === -1) {
2220
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2221
+ }
2222
+ if (end === -1) end = i;
2223
+ let value = header.slice(start, end);
2224
+ if (mustUnescape) {
2225
+ value = value.replace(/\\/g, "");
2226
+ mustUnescape = false;
2227
+ }
2228
+ push(params, paramName, value);
2229
+ if (code === 44) {
2230
+ push(offers, extensionName, params);
2231
+ params = /* @__PURE__ */ Object.create(null);
2232
+ extensionName = void 0;
2233
+ }
2234
+ paramName = void 0;
2235
+ start = end = -1;
2236
+ } else {
2237
+ throw new SyntaxError(`Unexpected character at index ${i}`);
2238
+ }
2239
+ }
2240
+ }
2241
+ if (start === -1 || inQuotes || code === 32 || code === 9) {
2242
+ throw new SyntaxError("Unexpected end of input");
2243
+ }
2244
+ if (end === -1) end = i;
2245
+ const token = header.slice(start, end);
2246
+ if (extensionName === void 0) {
2247
+ push(offers, token, params);
2248
+ } else {
2249
+ if (paramName === void 0) {
2250
+ push(params, token, true);
2251
+ } else if (mustUnescape) {
2252
+ push(params, paramName, token.replace(/\\/g, ""));
2253
+ } else {
2254
+ push(params, paramName, token);
2255
+ }
2256
+ push(offers, extensionName, params);
2257
+ }
2258
+ return offers;
2259
+ }
2260
+ __name(parse, "parse");
2261
+ function format(extensions) {
2262
+ return Object.keys(extensions).map((extension2) => {
2263
+ let configurations = extensions[extension2];
2264
+ if (!Array.isArray(configurations)) configurations = [configurations];
2265
+ return configurations.map((params) => {
2266
+ return [extension2].concat(
2267
+ Object.keys(params).map((k) => {
2268
+ let values = params[k];
2269
+ if (!Array.isArray(values)) values = [values];
2270
+ return values.map((v) => v === true ? k : `${k}=${v}`).join("; ");
2271
+ })
2272
+ ).join("; ");
2273
+ }).join(", ");
2274
+ }).join(", ");
2275
+ }
2276
+ __name(format, "format");
2277
+ module.exports = { format, parse };
2278
+ }
2279
+ });
2280
+
2281
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js
2282
+ var require_websocket = __commonJS({
2283
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket.js"(exports, module) {
2284
+ "use strict";
2285
+ var EventEmitter = __require("events");
2286
+ var https = __require("https");
2287
+ var http = __require("http");
2288
+ var net = __require("net");
2289
+ var tls = __require("tls");
2290
+ var { randomBytes, createHash } = __require("crypto");
2291
+ var { Duplex, Readable } = __require("stream");
2292
+ var { URL } = __require("url");
2293
+ var PerMessageDeflate2 = require_permessage_deflate();
2294
+ var Receiver2 = require_receiver();
2295
+ var Sender2 = require_sender();
2296
+ var { isBlob } = require_validation();
2297
+ var {
2298
+ BINARY_TYPES,
2299
+ CLOSE_TIMEOUT,
2300
+ EMPTY_BUFFER,
2301
+ GUID,
2302
+ kForOnEventAttribute,
2303
+ kListener,
2304
+ kStatusCode,
2305
+ kWebSocket,
2306
+ NOOP
2307
+ } = require_constants();
2308
+ var {
2309
+ EventTarget: { addEventListener, removeEventListener }
2310
+ } = require_event_target();
2311
+ var { format, parse } = require_extension();
2312
+ var { toBuffer } = require_buffer_util();
2313
+ var kAborted = /* @__PURE__ */ Symbol("kAborted");
2314
+ var protocolVersions = [8, 13];
2315
+ var readyStates = ["CONNECTING", "OPEN", "CLOSING", "CLOSED"];
2316
+ var subprotocolRegex = /^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;
2317
+ var WebSocket2 = class _WebSocket extends EventEmitter {
2318
+ static {
2319
+ __name(this, "WebSocket");
2320
+ }
2321
+ /**
2322
+ * Create a new `WebSocket`.
2323
+ *
2324
+ * @param {(String|URL)} address The URL to which to connect
2325
+ * @param {(String|String[])} [protocols] The subprotocols
2326
+ * @param {Object} [options] Connection options
2327
+ */
2328
+ constructor(address, protocols, options) {
2329
+ super();
2330
+ this._binaryType = BINARY_TYPES[0];
2331
+ this._closeCode = 1006;
2332
+ this._closeFrameReceived = false;
2333
+ this._closeFrameSent = false;
2334
+ this._closeMessage = EMPTY_BUFFER;
2335
+ this._closeTimer = null;
2336
+ this._errorEmitted = false;
2337
+ this._extensions = {};
2338
+ this._paused = false;
2339
+ this._protocol = "";
2340
+ this._readyState = _WebSocket.CONNECTING;
2341
+ this._receiver = null;
2342
+ this._sender = null;
2343
+ this._socket = null;
2344
+ if (address !== null) {
2345
+ this._bufferedAmount = 0;
2346
+ this._isServer = false;
2347
+ this._redirects = 0;
2348
+ if (protocols === void 0) {
2349
+ protocols = [];
2350
+ } else if (!Array.isArray(protocols)) {
2351
+ if (typeof protocols === "object" && protocols !== null) {
2352
+ options = protocols;
2353
+ protocols = [];
2354
+ } else {
2355
+ protocols = [protocols];
2356
+ }
2357
+ }
2358
+ initAsClient(this, address, protocols, options);
2359
+ } else {
2360
+ this._autoPong = options.autoPong;
2361
+ this._closeTimeout = options.closeTimeout;
2362
+ this._isServer = true;
2363
+ }
2364
+ }
2365
+ /**
2366
+ * For historical reasons, the custom "nodebuffer" type is used by the default
2367
+ * instead of "blob".
2368
+ *
2369
+ * @type {String}
2370
+ */
2371
+ get binaryType() {
2372
+ return this._binaryType;
2373
+ }
2374
+ set binaryType(type) {
2375
+ if (!BINARY_TYPES.includes(type)) return;
2376
+ this._binaryType = type;
2377
+ if (this._receiver) this._receiver._binaryType = type;
2378
+ }
2379
+ /**
2380
+ * @type {Number}
2381
+ */
2382
+ get bufferedAmount() {
2383
+ if (!this._socket) return this._bufferedAmount;
2384
+ return this._socket._writableState.length + this._sender._bufferedBytes;
2385
+ }
2386
+ /**
2387
+ * @type {String}
2388
+ */
2389
+ get extensions() {
2390
+ return Object.keys(this._extensions).join();
2391
+ }
2392
+ /**
2393
+ * @type {Boolean}
2394
+ */
2395
+ get isPaused() {
2396
+ return this._paused;
2397
+ }
2398
+ /**
2399
+ * @type {Function}
2400
+ */
2401
+ /* istanbul ignore next */
2402
+ get onclose() {
2403
+ return null;
2404
+ }
2405
+ /**
2406
+ * @type {Function}
2407
+ */
2408
+ /* istanbul ignore next */
2409
+ get onerror() {
2410
+ return null;
2411
+ }
2412
+ /**
2413
+ * @type {Function}
2414
+ */
2415
+ /* istanbul ignore next */
2416
+ get onopen() {
2417
+ return null;
2418
+ }
2419
+ /**
2420
+ * @type {Function}
2421
+ */
2422
+ /* istanbul ignore next */
2423
+ get onmessage() {
2424
+ return null;
2425
+ }
2426
+ /**
2427
+ * @type {String}
2428
+ */
2429
+ get protocol() {
2430
+ return this._protocol;
2431
+ }
2432
+ /**
2433
+ * @type {Number}
2434
+ */
2435
+ get readyState() {
2436
+ return this._readyState;
2437
+ }
2438
+ /**
2439
+ * @type {String}
2440
+ */
2441
+ get url() {
2442
+ return this._url;
2443
+ }
2444
+ /**
2445
+ * Set up the socket and the internal resources.
2446
+ *
2447
+ * @param {Duplex} socket The network socket between the server and client
2448
+ * @param {Buffer} head The first packet of the upgraded stream
2449
+ * @param {Object} options Options object
2450
+ * @param {Boolean} [options.allowSynchronousEvents=false] Specifies whether
2451
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
2452
+ * multiple times in the same tick
2453
+ * @param {Function} [options.generateMask] The function used to generate the
2454
+ * masking key
2455
+ * @param {Number} [options.maxBufferedChunks=0] The maximum number of
2456
+ * buffered data chunks
2457
+ * @param {Number} [options.maxFragments=0] The maximum number of message
2458
+ * fragments
2459
+ * @param {Number} [options.maxPayload=0] The maximum allowed message size
2460
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
2461
+ * not to skip UTF-8 validation for text and close messages
2462
+ * @private
2463
+ */
2464
+ setSocket(socket, head, options) {
2465
+ const receiver = new Receiver2({
2466
+ allowSynchronousEvents: options.allowSynchronousEvents,
2467
+ binaryType: this.binaryType,
2468
+ extensions: this._extensions,
2469
+ isServer: this._isServer,
2470
+ maxBufferedChunks: options.maxBufferedChunks,
2471
+ maxFragments: options.maxFragments,
2472
+ maxPayload: options.maxPayload,
2473
+ skipUTF8Validation: options.skipUTF8Validation
2474
+ });
2475
+ const sender = new Sender2(socket, this._extensions, options.generateMask);
2476
+ this._receiver = receiver;
2477
+ this._sender = sender;
2478
+ this._socket = socket;
2479
+ receiver[kWebSocket] = this;
2480
+ sender[kWebSocket] = this;
2481
+ socket[kWebSocket] = this;
2482
+ receiver.on("conclude", receiverOnConclude);
2483
+ receiver.on("drain", receiverOnDrain);
2484
+ receiver.on("error", receiverOnError);
2485
+ receiver.on("message", receiverOnMessage);
2486
+ receiver.on("ping", receiverOnPing);
2487
+ receiver.on("pong", receiverOnPong);
2488
+ sender.onerror = senderOnError;
2489
+ if (socket.setTimeout) socket.setTimeout(0);
2490
+ if (socket.setNoDelay) socket.setNoDelay();
2491
+ if (head.length > 0) socket.unshift(head);
2492
+ socket.on("close", socketOnClose);
2493
+ socket.on("data", socketOnData);
2494
+ socket.on("end", socketOnEnd);
2495
+ socket.on("error", socketOnError);
2496
+ this._readyState = _WebSocket.OPEN;
2497
+ this.emit("open");
2498
+ }
2499
+ /**
2500
+ * Emit the `'close'` event.
2501
+ *
2502
+ * @private
2503
+ */
2504
+ emitClose() {
2505
+ if (!this._socket) {
2506
+ this._readyState = _WebSocket.CLOSED;
2507
+ this.emit("close", this._closeCode, this._closeMessage);
2508
+ return;
2509
+ }
2510
+ if (this._extensions[PerMessageDeflate2.extensionName]) {
2511
+ this._extensions[PerMessageDeflate2.extensionName].cleanup();
2512
+ }
2513
+ this._receiver.removeAllListeners();
2514
+ this._readyState = _WebSocket.CLOSED;
2515
+ this.emit("close", this._closeCode, this._closeMessage);
2516
+ }
2517
+ /**
2518
+ * Start a closing handshake.
2519
+ *
2520
+ * +----------+ +-----------+ +----------+
2521
+ * - - -|ws.close()|-->|close frame|-->|ws.close()|- - -
2522
+ * | +----------+ +-----------+ +----------+ |
2523
+ * +----------+ +-----------+ |
2524
+ * CLOSING |ws.close()|<--|close frame|<--+-----+ CLOSING
2525
+ * +----------+ +-----------+ |
2526
+ * | | | +---+ |
2527
+ * +------------------------+-->|fin| - - - -
2528
+ * | +---+ | +---+
2529
+ * - - - - -|fin|<---------------------+
2530
+ * +---+
2531
+ *
2532
+ * @param {Number} [code] Status code explaining why the connection is closing
2533
+ * @param {(String|Buffer)} [data] The reason why the connection is
2534
+ * closing
2535
+ * @public
2536
+ */
2537
+ close(code, data) {
2538
+ if (this.readyState === _WebSocket.CLOSED) return;
2539
+ if (this.readyState === _WebSocket.CONNECTING) {
2540
+ const msg = "WebSocket was closed before the connection was established";
2541
+ abortHandshake(this, this._req, msg);
2542
+ return;
2543
+ }
2544
+ if (this.readyState === _WebSocket.CLOSING) {
2545
+ if (this._closeFrameSent && (this._closeFrameReceived || this._receiver._writableState.errorEmitted)) {
2546
+ this._socket.end();
2547
+ }
2548
+ return;
2549
+ }
2550
+ this._readyState = _WebSocket.CLOSING;
2551
+ this._sender.close(code, data, !this._isServer, (err) => {
2552
+ if (err) return;
2553
+ this._closeFrameSent = true;
2554
+ if (this._closeFrameReceived || this._receiver._writableState.errorEmitted) {
2555
+ this._socket.end();
2556
+ }
2557
+ });
2558
+ setCloseTimer(this);
2559
+ }
2560
+ /**
2561
+ * Pause the socket.
2562
+ *
2563
+ * @public
2564
+ */
2565
+ pause() {
2566
+ if (this.readyState === _WebSocket.CONNECTING || this.readyState === _WebSocket.CLOSED) {
2567
+ return;
2568
+ }
2569
+ this._paused = true;
2570
+ this._socket.pause();
2571
+ }
2572
+ /**
2573
+ * Send a ping.
2574
+ *
2575
+ * @param {*} [data] The data to send
2576
+ * @param {Boolean} [mask] Indicates whether or not to mask `data`
2577
+ * @param {Function} [cb] Callback which is executed when the ping is sent
2578
+ * @public
2579
+ */
2580
+ ping(data, mask, cb) {
2581
+ if (this.readyState === _WebSocket.CONNECTING) {
2582
+ throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2583
+ }
2584
+ if (typeof data === "function") {
2585
+ cb = data;
2586
+ data = mask = void 0;
2587
+ } else if (typeof mask === "function") {
2588
+ cb = mask;
2589
+ mask = void 0;
2590
+ }
2591
+ if (typeof data === "number") data = data.toString();
2592
+ if (this.readyState !== _WebSocket.OPEN) {
2593
+ sendAfterClose(this, data, cb);
2594
+ return;
2595
+ }
2596
+ if (mask === void 0) mask = !this._isServer;
2597
+ this._sender.ping(data || EMPTY_BUFFER, mask, cb);
2598
+ }
2599
+ /**
2600
+ * Send a pong.
2601
+ *
2602
+ * @param {*} [data] The data to send
2603
+ * @param {Boolean} [mask] Indicates whether or not to mask `data`
2604
+ * @param {Function} [cb] Callback which is executed when the pong is sent
2605
+ * @public
2606
+ */
2607
+ pong(data, mask, cb) {
2608
+ if (this.readyState === _WebSocket.CONNECTING) {
2609
+ throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2610
+ }
2611
+ if (typeof data === "function") {
2612
+ cb = data;
2613
+ data = mask = void 0;
2614
+ } else if (typeof mask === "function") {
2615
+ cb = mask;
2616
+ mask = void 0;
2617
+ }
2618
+ if (typeof data === "number") data = data.toString();
2619
+ if (this.readyState !== _WebSocket.OPEN) {
2620
+ sendAfterClose(this, data, cb);
2621
+ return;
2622
+ }
2623
+ if (mask === void 0) mask = !this._isServer;
2624
+ this._sender.pong(data || EMPTY_BUFFER, mask, cb);
2625
+ }
2626
+ /**
2627
+ * Resume the socket.
2628
+ *
2629
+ * @public
2630
+ */
2631
+ resume() {
2632
+ if (this.readyState === _WebSocket.CONNECTING || this.readyState === _WebSocket.CLOSED) {
2633
+ return;
2634
+ }
2635
+ this._paused = false;
2636
+ if (!this._receiver._writableState.needDrain) this._socket.resume();
2637
+ }
2638
+ /**
2639
+ * Send a data message.
2640
+ *
2641
+ * @param {*} data The message to send
2642
+ * @param {Object} [options] Options object
2643
+ * @param {Boolean} [options.binary] Specifies whether `data` is binary or
2644
+ * text
2645
+ * @param {Boolean} [options.compress] Specifies whether or not to compress
2646
+ * `data`
2647
+ * @param {Boolean} [options.fin=true] Specifies whether the fragment is the
2648
+ * last one
2649
+ * @param {Boolean} [options.mask] Specifies whether or not to mask `data`
2650
+ * @param {Function} [cb] Callback which is executed when data is written out
2651
+ * @public
2652
+ */
2653
+ send(data, options, cb) {
2654
+ if (this.readyState === _WebSocket.CONNECTING) {
2655
+ throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");
2656
+ }
2657
+ if (typeof options === "function") {
2658
+ cb = options;
2659
+ options = {};
2660
+ }
2661
+ if (typeof data === "number") data = data.toString();
2662
+ if (this.readyState !== _WebSocket.OPEN) {
2663
+ sendAfterClose(this, data, cb);
2664
+ return;
2665
+ }
2666
+ const opts = {
2667
+ binary: typeof data !== "string",
2668
+ mask: !this._isServer,
2669
+ compress: true,
2670
+ fin: true,
2671
+ ...options
2672
+ };
2673
+ if (!this._extensions[PerMessageDeflate2.extensionName]) {
2674
+ opts.compress = false;
2675
+ }
2676
+ this._sender.send(data || EMPTY_BUFFER, opts, cb);
2677
+ }
2678
+ /**
2679
+ * Forcibly close the connection.
2680
+ *
2681
+ * @public
2682
+ */
2683
+ terminate() {
2684
+ if (this.readyState === _WebSocket.CLOSED) return;
2685
+ if (this.readyState === _WebSocket.CONNECTING) {
2686
+ const msg = "WebSocket was closed before the connection was established";
2687
+ abortHandshake(this, this._req, msg);
2688
+ return;
2689
+ }
2690
+ if (this._socket) {
2691
+ this._readyState = _WebSocket.CLOSING;
2692
+ this._socket.destroy();
2693
+ }
2694
+ }
2695
+ };
2696
+ Object.defineProperty(WebSocket2, "CONNECTING", {
2697
+ enumerable: true,
2698
+ value: readyStates.indexOf("CONNECTING")
2699
+ });
2700
+ Object.defineProperty(WebSocket2.prototype, "CONNECTING", {
2701
+ enumerable: true,
2702
+ value: readyStates.indexOf("CONNECTING")
2703
+ });
2704
+ Object.defineProperty(WebSocket2, "OPEN", {
2705
+ enumerable: true,
2706
+ value: readyStates.indexOf("OPEN")
2707
+ });
2708
+ Object.defineProperty(WebSocket2.prototype, "OPEN", {
2709
+ enumerable: true,
2710
+ value: readyStates.indexOf("OPEN")
2711
+ });
2712
+ Object.defineProperty(WebSocket2, "CLOSING", {
2713
+ enumerable: true,
2714
+ value: readyStates.indexOf("CLOSING")
2715
+ });
2716
+ Object.defineProperty(WebSocket2.prototype, "CLOSING", {
2717
+ enumerable: true,
2718
+ value: readyStates.indexOf("CLOSING")
2719
+ });
2720
+ Object.defineProperty(WebSocket2, "CLOSED", {
2721
+ enumerable: true,
2722
+ value: readyStates.indexOf("CLOSED")
2723
+ });
2724
+ Object.defineProperty(WebSocket2.prototype, "CLOSED", {
2725
+ enumerable: true,
2726
+ value: readyStates.indexOf("CLOSED")
2727
+ });
2728
+ [
2729
+ "binaryType",
2730
+ "bufferedAmount",
2731
+ "extensions",
2732
+ "isPaused",
2733
+ "protocol",
2734
+ "readyState",
2735
+ "url"
2736
+ ].forEach((property) => {
2737
+ Object.defineProperty(WebSocket2.prototype, property, { enumerable: true });
2738
+ });
2739
+ ["open", "error", "close", "message"].forEach((method) => {
2740
+ Object.defineProperty(WebSocket2.prototype, `on${method}`, {
2741
+ enumerable: true,
2742
+ get() {
2743
+ for (const listener of this.listeners(method)) {
2744
+ if (listener[kForOnEventAttribute]) return listener[kListener];
2745
+ }
2746
+ return null;
2747
+ },
2748
+ set(handler) {
2749
+ for (const listener of this.listeners(method)) {
2750
+ if (listener[kForOnEventAttribute]) {
2751
+ this.removeListener(method, listener);
2752
+ break;
2753
+ }
2754
+ }
2755
+ if (typeof handler !== "function") return;
2756
+ this.addEventListener(method, handler, {
2757
+ [kForOnEventAttribute]: true
2758
+ });
2759
+ }
2760
+ });
2761
+ });
2762
+ WebSocket2.prototype.addEventListener = addEventListener;
2763
+ WebSocket2.prototype.removeEventListener = removeEventListener;
2764
+ module.exports = WebSocket2;
2765
+ function initAsClient(websocket, address, protocols, options) {
2766
+ const opts = {
2767
+ allowSynchronousEvents: true,
2768
+ autoPong: true,
2769
+ closeTimeout: CLOSE_TIMEOUT,
2770
+ protocolVersion: protocolVersions[1],
2771
+ maxBufferedChunks: 256 * 1024,
2772
+ maxFragments: 16 * 1024,
2773
+ maxPayload: 100 * 1024 * 1024,
2774
+ skipUTF8Validation: false,
2775
+ perMessageDeflate: true,
2776
+ followRedirects: false,
2777
+ maxRedirects: 10,
2778
+ ...options,
2779
+ socketPath: void 0,
2780
+ hostname: void 0,
2781
+ protocol: void 0,
2782
+ timeout: void 0,
2783
+ method: "GET",
2784
+ host: void 0,
2785
+ path: void 0,
2786
+ port: void 0
2787
+ };
2788
+ websocket._autoPong = opts.autoPong;
2789
+ websocket._closeTimeout = opts.closeTimeout;
2790
+ if (!protocolVersions.includes(opts.protocolVersion)) {
2791
+ throw new RangeError(
2792
+ `Unsupported protocol version: ${opts.protocolVersion} (supported versions: ${protocolVersions.join(", ")})`
2793
+ );
2794
+ }
2795
+ let parsedUrl;
2796
+ if (address instanceof URL) {
2797
+ parsedUrl = address;
2798
+ } else {
2799
+ try {
2800
+ parsedUrl = new URL(address);
2801
+ } catch {
2802
+ throw new SyntaxError(`Invalid URL: ${address}`);
2803
+ }
2804
+ }
2805
+ if (parsedUrl.protocol === "http:") {
2806
+ parsedUrl.protocol = "ws:";
2807
+ } else if (parsedUrl.protocol === "https:") {
2808
+ parsedUrl.protocol = "wss:";
2809
+ }
2810
+ websocket._url = parsedUrl.href;
2811
+ const isSecure = parsedUrl.protocol === "wss:";
2812
+ const isIpcUrl = parsedUrl.protocol === "ws+unix:";
2813
+ let invalidUrlMessage;
2814
+ if (parsedUrl.protocol !== "ws:" && !isSecure && !isIpcUrl) {
2815
+ invalidUrlMessage = `The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`;
2816
+ } else if (isIpcUrl && !parsedUrl.pathname) {
2817
+ invalidUrlMessage = "The URL's pathname is empty";
2818
+ } else if (parsedUrl.hash) {
2819
+ invalidUrlMessage = "The URL contains a fragment identifier";
2820
+ }
2821
+ if (invalidUrlMessage) {
2822
+ const err = new SyntaxError(invalidUrlMessage);
2823
+ if (websocket._redirects === 0) {
2824
+ throw err;
2825
+ } else {
2826
+ emitErrorAndClose(websocket, err);
2827
+ return;
2828
+ }
2829
+ }
2830
+ const defaultPort = isSecure ? 443 : 80;
2831
+ const key = randomBytes(16).toString("base64");
2832
+ const request = isSecure ? https.request : http.request;
2833
+ const protocolSet = /* @__PURE__ */ new Set();
2834
+ let perMessageDeflate;
2835
+ opts.createConnection = opts.createConnection || (isSecure ? tlsConnect : netConnect);
2836
+ opts.defaultPort = opts.defaultPort || defaultPort;
2837
+ opts.port = parsedUrl.port || defaultPort;
2838
+ opts.host = parsedUrl.hostname.startsWith("[") ? parsedUrl.hostname.slice(1, -1) : parsedUrl.hostname;
2839
+ opts.headers = {
2840
+ ...opts.headers,
2841
+ "Sec-WebSocket-Version": opts.protocolVersion,
2842
+ "Sec-WebSocket-Key": key,
2843
+ Connection: "Upgrade",
2844
+ Upgrade: "websocket"
2845
+ };
2846
+ opts.path = parsedUrl.pathname + parsedUrl.search;
2847
+ opts.timeout = opts.handshakeTimeout;
2848
+ if (opts.perMessageDeflate) {
2849
+ perMessageDeflate = new PerMessageDeflate2({
2850
+ ...opts.perMessageDeflate,
2851
+ isServer: false,
2852
+ maxPayload: opts.maxPayload
2853
+ });
2854
+ opts.headers["Sec-WebSocket-Extensions"] = format({
2855
+ [PerMessageDeflate2.extensionName]: perMessageDeflate.offer()
2856
+ });
2857
+ }
2858
+ if (protocols.length) {
2859
+ for (const protocol of protocols) {
2860
+ if (typeof protocol !== "string" || !subprotocolRegex.test(protocol) || protocolSet.has(protocol)) {
2861
+ throw new SyntaxError(
2862
+ "An invalid or duplicated subprotocol was specified"
2863
+ );
2864
+ }
2865
+ protocolSet.add(protocol);
2866
+ }
2867
+ opts.headers["Sec-WebSocket-Protocol"] = protocols.join(",");
2868
+ }
2869
+ if (opts.origin) {
2870
+ if (opts.protocolVersion < 13) {
2871
+ opts.headers["Sec-WebSocket-Origin"] = opts.origin;
2872
+ } else {
2873
+ opts.headers.Origin = opts.origin;
2874
+ }
2875
+ }
2876
+ if (parsedUrl.username || parsedUrl.password) {
2877
+ opts.auth = `${parsedUrl.username}:${parsedUrl.password}`;
2878
+ }
2879
+ if (isIpcUrl) {
2880
+ const parts = opts.path.split(":");
2881
+ opts.socketPath = parts[0];
2882
+ opts.path = parts[1];
2883
+ }
2884
+ let req;
2885
+ if (opts.followRedirects) {
2886
+ if (websocket._redirects === 0) {
2887
+ websocket._originalIpc = isIpcUrl;
2888
+ websocket._originalSecure = isSecure;
2889
+ websocket._originalHostOrSocketPath = isIpcUrl ? opts.socketPath : parsedUrl.host;
2890
+ const headers = options && options.headers;
2891
+ options = { ...options, headers: {} };
2892
+ if (headers) {
2893
+ for (const [key2, value] of Object.entries(headers)) {
2894
+ options.headers[key2.toLowerCase()] = value;
2895
+ }
2896
+ }
2897
+ } else if (websocket.listenerCount("redirect") === 0) {
2898
+ const isSameHost = isIpcUrl ? websocket._originalIpc ? opts.socketPath === websocket._originalHostOrSocketPath : false : websocket._originalIpc ? false : parsedUrl.host === websocket._originalHostOrSocketPath;
2899
+ if (!isSameHost || websocket._originalSecure && !isSecure) {
2900
+ delete opts.headers.authorization;
2901
+ delete opts.headers.cookie;
2902
+ if (!isSameHost) delete opts.headers.host;
2903
+ opts.auth = void 0;
2904
+ }
2905
+ }
2906
+ if (opts.auth && !options.headers.authorization) {
2907
+ options.headers.authorization = "Basic " + Buffer.from(opts.auth).toString("base64");
2908
+ }
2909
+ req = websocket._req = request(opts);
2910
+ if (websocket._redirects) {
2911
+ websocket.emit("redirect", websocket.url, req);
2912
+ }
2913
+ } else {
2914
+ req = websocket._req = request(opts);
2915
+ }
2916
+ if (opts.timeout) {
2917
+ req.on("timeout", () => {
2918
+ abortHandshake(websocket, req, "Opening handshake has timed out");
2919
+ });
2920
+ }
2921
+ req.on("error", (err) => {
2922
+ if (req === null || req[kAborted]) return;
2923
+ req = websocket._req = null;
2924
+ emitErrorAndClose(websocket, err);
2925
+ });
2926
+ req.on("response", (res) => {
2927
+ const location = res.headers.location;
2928
+ const statusCode = res.statusCode;
2929
+ if (location && opts.followRedirects && statusCode >= 300 && statusCode < 400) {
2930
+ if (++websocket._redirects > opts.maxRedirects) {
2931
+ abortHandshake(websocket, req, "Maximum redirects exceeded");
2932
+ return;
2933
+ }
2934
+ req.abort();
2935
+ let addr;
2936
+ try {
2937
+ addr = new URL(location, address);
2938
+ } catch (e) {
2939
+ const err = new SyntaxError(`Invalid URL: ${location}`);
2940
+ emitErrorAndClose(websocket, err);
2941
+ return;
2942
+ }
2943
+ initAsClient(websocket, addr, protocols, options);
2944
+ } else if (!websocket.emit("unexpected-response", req, res)) {
2945
+ abortHandshake(
2946
+ websocket,
2947
+ req,
2948
+ `Unexpected server response: ${res.statusCode}`
2949
+ );
2950
+ }
2951
+ });
2952
+ req.on("upgrade", (res, socket, head) => {
2953
+ websocket.emit("upgrade", res);
2954
+ if (websocket.readyState !== WebSocket2.CONNECTING) return;
2955
+ req = websocket._req = null;
2956
+ const upgrade = res.headers.upgrade;
2957
+ if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
2958
+ abortHandshake(websocket, socket, "Invalid Upgrade header");
2959
+ return;
2960
+ }
2961
+ const digest = createHash("sha1").update(key + GUID).digest("base64");
2962
+ if (res.headers["sec-websocket-accept"] !== digest) {
2963
+ abortHandshake(websocket, socket, "Invalid Sec-WebSocket-Accept header");
2964
+ return;
2965
+ }
2966
+ const serverProt = res.headers["sec-websocket-protocol"];
2967
+ let protError;
2968
+ if (serverProt !== void 0) {
2969
+ if (!protocolSet.size) {
2970
+ protError = "Server sent a subprotocol but none was requested";
2971
+ } else if (!protocolSet.has(serverProt)) {
2972
+ protError = "Server sent an invalid subprotocol";
2973
+ }
2974
+ } else if (protocolSet.size) {
2975
+ protError = "Server sent no subprotocol";
2976
+ }
2977
+ if (protError) {
2978
+ abortHandshake(websocket, socket, protError);
2979
+ return;
2980
+ }
2981
+ if (serverProt) websocket._protocol = serverProt;
2982
+ const secWebSocketExtensions = res.headers["sec-websocket-extensions"];
2983
+ if (secWebSocketExtensions !== void 0) {
2984
+ if (!perMessageDeflate) {
2985
+ const message = "Server sent a Sec-WebSocket-Extensions header but no extension was requested";
2986
+ abortHandshake(websocket, socket, message);
2987
+ return;
2988
+ }
2989
+ let extensions;
2990
+ try {
2991
+ extensions = parse(secWebSocketExtensions);
2992
+ } catch (err) {
2993
+ const message = "Invalid Sec-WebSocket-Extensions header";
2994
+ abortHandshake(websocket, socket, message);
2995
+ return;
2996
+ }
2997
+ const extensionNames = Object.keys(extensions);
2998
+ if (extensionNames.length !== 1 || extensionNames[0] !== PerMessageDeflate2.extensionName) {
2999
+ const message = "Server indicated an extension that was not requested";
3000
+ abortHandshake(websocket, socket, message);
3001
+ return;
3002
+ }
3003
+ try {
3004
+ perMessageDeflate.accept(extensions[PerMessageDeflate2.extensionName]);
3005
+ } catch (err) {
3006
+ const message = "Invalid Sec-WebSocket-Extensions header";
3007
+ abortHandshake(websocket, socket, message);
3008
+ return;
3009
+ }
3010
+ websocket._extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
3011
+ }
3012
+ websocket.setSocket(socket, head, {
3013
+ allowSynchronousEvents: opts.allowSynchronousEvents,
3014
+ generateMask: opts.generateMask,
3015
+ maxBufferedChunks: opts.maxBufferedChunks,
3016
+ maxFragments: opts.maxFragments,
3017
+ maxPayload: opts.maxPayload,
3018
+ skipUTF8Validation: opts.skipUTF8Validation
3019
+ });
3020
+ });
3021
+ if (opts.finishRequest) {
3022
+ opts.finishRequest(req, websocket);
3023
+ } else {
3024
+ req.end();
3025
+ }
3026
+ }
3027
+ __name(initAsClient, "initAsClient");
3028
+ function emitErrorAndClose(websocket, err) {
3029
+ websocket._readyState = WebSocket2.CLOSING;
3030
+ websocket._errorEmitted = true;
3031
+ websocket.emit("error", err);
3032
+ websocket.emitClose();
3033
+ }
3034
+ __name(emitErrorAndClose, "emitErrorAndClose");
3035
+ function netConnect(options) {
3036
+ options.path = options.socketPath;
3037
+ return net.connect(options);
3038
+ }
3039
+ __name(netConnect, "netConnect");
3040
+ function tlsConnect(options) {
3041
+ options.path = void 0;
3042
+ if (!options.servername && options.servername !== "") {
3043
+ options.servername = net.isIP(options.host) ? "" : options.host;
3044
+ }
3045
+ return tls.connect(options);
3046
+ }
3047
+ __name(tlsConnect, "tlsConnect");
3048
+ function abortHandshake(websocket, stream, message) {
3049
+ websocket._readyState = WebSocket2.CLOSING;
3050
+ const err = new Error(message);
3051
+ Error.captureStackTrace(err, abortHandshake);
3052
+ if (stream.setHeader) {
3053
+ stream[kAborted] = true;
3054
+ stream.abort();
3055
+ if (stream.socket && !stream.socket.destroyed) {
3056
+ stream.socket.destroy();
3057
+ }
3058
+ process.nextTick(emitErrorAndClose, websocket, err);
3059
+ } else {
3060
+ stream.destroy(err);
3061
+ stream.once("error", websocket.emit.bind(websocket, "error"));
3062
+ stream.once("close", websocket.emitClose.bind(websocket));
3063
+ }
3064
+ }
3065
+ __name(abortHandshake, "abortHandshake");
3066
+ function sendAfterClose(websocket, data, cb) {
3067
+ if (data) {
3068
+ const length = isBlob(data) ? data.size : toBuffer(data).length;
3069
+ if (websocket._socket) websocket._sender._bufferedBytes += length;
3070
+ else websocket._bufferedAmount += length;
3071
+ }
3072
+ if (cb) {
3073
+ const err = new Error(
3074
+ `WebSocket is not open: readyState ${websocket.readyState} (${readyStates[websocket.readyState]})`
3075
+ );
3076
+ process.nextTick(cb, err);
3077
+ }
3078
+ }
3079
+ __name(sendAfterClose, "sendAfterClose");
3080
+ function receiverOnConclude(code, reason) {
3081
+ const websocket = this[kWebSocket];
3082
+ websocket._closeFrameReceived = true;
3083
+ websocket._closeMessage = reason;
3084
+ websocket._closeCode = code;
3085
+ if (websocket._socket[kWebSocket] === void 0) return;
3086
+ websocket._socket.removeListener("data", socketOnData);
3087
+ process.nextTick(resume, websocket._socket);
3088
+ if (code === 1005) websocket.close();
3089
+ else websocket.close(code, reason);
3090
+ }
3091
+ __name(receiverOnConclude, "receiverOnConclude");
3092
+ function receiverOnDrain() {
3093
+ const websocket = this[kWebSocket];
3094
+ if (!websocket.isPaused) websocket._socket.resume();
3095
+ }
3096
+ __name(receiverOnDrain, "receiverOnDrain");
3097
+ function receiverOnError(err) {
3098
+ const websocket = this[kWebSocket];
3099
+ if (websocket._socket[kWebSocket] !== void 0) {
3100
+ websocket._socket.removeListener("data", socketOnData);
3101
+ process.nextTick(resume, websocket._socket);
3102
+ websocket.close(err[kStatusCode]);
3103
+ }
3104
+ if (!websocket._errorEmitted) {
3105
+ websocket._errorEmitted = true;
3106
+ websocket.emit("error", err);
3107
+ }
3108
+ }
3109
+ __name(receiverOnError, "receiverOnError");
3110
+ function receiverOnFinish() {
3111
+ this[kWebSocket].emitClose();
3112
+ }
3113
+ __name(receiverOnFinish, "receiverOnFinish");
3114
+ function receiverOnMessage(data, isBinary) {
3115
+ this[kWebSocket].emit("message", data, isBinary);
3116
+ }
3117
+ __name(receiverOnMessage, "receiverOnMessage");
3118
+ function receiverOnPing(data) {
3119
+ const websocket = this[kWebSocket];
3120
+ if (websocket._autoPong) websocket.pong(data, !this._isServer, NOOP);
3121
+ websocket.emit("ping", data);
3122
+ }
3123
+ __name(receiverOnPing, "receiverOnPing");
3124
+ function receiverOnPong(data) {
3125
+ this[kWebSocket].emit("pong", data);
3126
+ }
3127
+ __name(receiverOnPong, "receiverOnPong");
3128
+ function resume(stream) {
3129
+ stream.resume();
3130
+ }
3131
+ __name(resume, "resume");
3132
+ function senderOnError(err) {
3133
+ const websocket = this[kWebSocket];
3134
+ if (websocket.readyState === WebSocket2.CLOSED) return;
3135
+ if (websocket.readyState === WebSocket2.OPEN) {
3136
+ websocket._readyState = WebSocket2.CLOSING;
3137
+ setCloseTimer(websocket);
3138
+ }
3139
+ this._socket.end();
3140
+ if (!websocket._errorEmitted) {
3141
+ websocket._errorEmitted = true;
3142
+ websocket.emit("error", err);
3143
+ }
3144
+ }
3145
+ __name(senderOnError, "senderOnError");
3146
+ function setCloseTimer(websocket) {
3147
+ websocket._closeTimer = setTimeout(
3148
+ websocket._socket.destroy.bind(websocket._socket),
3149
+ websocket._closeTimeout
3150
+ );
3151
+ }
3152
+ __name(setCloseTimer, "setCloseTimer");
3153
+ function socketOnClose() {
3154
+ const websocket = this[kWebSocket];
3155
+ this.removeListener("close", socketOnClose);
3156
+ this.removeListener("data", socketOnData);
3157
+ this.removeListener("end", socketOnEnd);
3158
+ websocket._readyState = WebSocket2.CLOSING;
3159
+ if (!this._readableState.endEmitted && !websocket._closeFrameReceived && !websocket._receiver._writableState.errorEmitted && this._readableState.length !== 0) {
3160
+ const chunk = this.read(this._readableState.length);
3161
+ websocket._receiver.write(chunk);
3162
+ }
3163
+ websocket._receiver.end();
3164
+ this[kWebSocket] = void 0;
3165
+ clearTimeout(websocket._closeTimer);
3166
+ if (websocket._receiver._writableState.finished || websocket._receiver._writableState.errorEmitted) {
3167
+ websocket.emitClose();
3168
+ } else {
3169
+ websocket._receiver.on("error", receiverOnFinish);
3170
+ websocket._receiver.on("finish", receiverOnFinish);
3171
+ }
3172
+ }
3173
+ __name(socketOnClose, "socketOnClose");
3174
+ function socketOnData(chunk) {
3175
+ if (!this[kWebSocket]._receiver.write(chunk)) {
3176
+ this.pause();
3177
+ }
3178
+ }
3179
+ __name(socketOnData, "socketOnData");
3180
+ function socketOnEnd() {
3181
+ const websocket = this[kWebSocket];
3182
+ websocket._readyState = WebSocket2.CLOSING;
3183
+ websocket._receiver.end();
3184
+ this.end();
3185
+ }
3186
+ __name(socketOnEnd, "socketOnEnd");
3187
+ function socketOnError() {
3188
+ const websocket = this[kWebSocket];
3189
+ this.removeListener("error", socketOnError);
3190
+ this.on("error", NOOP);
3191
+ if (websocket) {
3192
+ websocket._readyState = WebSocket2.CLOSING;
3193
+ this.destroy();
3194
+ }
3195
+ }
3196
+ __name(socketOnError, "socketOnError");
3197
+ }
3198
+ });
3199
+
3200
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js
3201
+ var require_stream = __commonJS({
3202
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/stream.js"(exports, module) {
3203
+ "use strict";
3204
+ var WebSocket2 = require_websocket();
3205
+ var { Duplex } = __require("stream");
3206
+ function emitClose(stream) {
3207
+ stream.emit("close");
3208
+ }
3209
+ __name(emitClose, "emitClose");
3210
+ function duplexOnEnd() {
3211
+ if (!this.destroyed && this._writableState.finished) {
3212
+ this.destroy();
3213
+ }
3214
+ }
3215
+ __name(duplexOnEnd, "duplexOnEnd");
3216
+ function duplexOnError(err) {
3217
+ this.removeListener("error", duplexOnError);
3218
+ this.destroy();
3219
+ if (this.listenerCount("error") === 0) {
3220
+ this.emit("error", err);
3221
+ }
3222
+ }
3223
+ __name(duplexOnError, "duplexOnError");
3224
+ function createWebSocketStream2(ws, options) {
3225
+ let terminateOnDestroy = true;
3226
+ const duplex = new Duplex({
3227
+ ...options,
3228
+ autoDestroy: false,
3229
+ emitClose: false,
3230
+ objectMode: false,
3231
+ writableObjectMode: false
3232
+ });
3233
+ ws.on("message", /* @__PURE__ */ __name(function message(msg, isBinary) {
3234
+ const data = !isBinary && duplex._readableState.objectMode ? msg.toString() : msg;
3235
+ if (!duplex.push(data)) ws.pause();
3236
+ }, "message"));
3237
+ ws.once("error", /* @__PURE__ */ __name(function error(err) {
3238
+ if (duplex.destroyed) return;
3239
+ terminateOnDestroy = false;
3240
+ duplex.destroy(err);
3241
+ }, "error"));
3242
+ ws.once("close", /* @__PURE__ */ __name(function close() {
3243
+ if (duplex.destroyed) return;
3244
+ duplex.push(null);
3245
+ }, "close"));
3246
+ duplex._destroy = function(err, callback) {
3247
+ if (ws.readyState === ws.CLOSED) {
3248
+ callback(err);
3249
+ process.nextTick(emitClose, duplex);
3250
+ return;
3251
+ }
3252
+ let called = false;
3253
+ ws.once("error", /* @__PURE__ */ __name(function error(err2) {
3254
+ called = true;
3255
+ callback(err2);
3256
+ }, "error"));
3257
+ ws.once("close", /* @__PURE__ */ __name(function close() {
3258
+ if (!called) callback(err);
3259
+ process.nextTick(emitClose, duplex);
3260
+ }, "close"));
3261
+ if (terminateOnDestroy) ws.terminate();
3262
+ };
3263
+ duplex._final = function(callback) {
3264
+ if (ws.readyState === ws.CONNECTING) {
3265
+ ws.once("open", /* @__PURE__ */ __name(function open() {
3266
+ duplex._final(callback);
3267
+ }, "open"));
3268
+ return;
3269
+ }
3270
+ if (ws._socket === null) return;
3271
+ if (ws._socket._writableState.finished) {
3272
+ callback();
3273
+ if (duplex._readableState.endEmitted) duplex.destroy();
3274
+ } else {
3275
+ ws._socket.once("finish", /* @__PURE__ */ __name(function finish() {
3276
+ callback();
3277
+ }, "finish"));
3278
+ ws.close();
3279
+ }
3280
+ };
3281
+ duplex._read = function() {
3282
+ if (ws.isPaused) ws.resume();
3283
+ };
3284
+ duplex._write = function(chunk, encoding, callback) {
3285
+ if (ws.readyState === ws.CONNECTING) {
3286
+ ws.once("open", /* @__PURE__ */ __name(function open() {
3287
+ duplex._write(chunk, encoding, callback);
3288
+ }, "open"));
3289
+ return;
3290
+ }
3291
+ ws.send(chunk, callback);
3292
+ };
3293
+ duplex.on("end", duplexOnEnd);
3294
+ duplex.on("error", duplexOnError);
3295
+ return duplex;
3296
+ }
3297
+ __name(createWebSocketStream2, "createWebSocketStream");
3298
+ module.exports = createWebSocketStream2;
3299
+ }
3300
+ });
3301
+
3302
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js
3303
+ var require_subprotocol = __commonJS({
3304
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/subprotocol.js"(exports, module) {
3305
+ "use strict";
3306
+ var { tokenChars } = require_validation();
3307
+ function parse(header) {
3308
+ const protocols = /* @__PURE__ */ new Set();
3309
+ let start = -1;
3310
+ let end = -1;
3311
+ let i = 0;
3312
+ for (i; i < header.length; i++) {
3313
+ const code = header.charCodeAt(i);
3314
+ if (end === -1 && tokenChars[code] === 1) {
3315
+ if (start === -1) start = i;
3316
+ } else if (i !== 0 && (code === 32 || code === 9)) {
3317
+ if (end === -1 && start !== -1) end = i;
3318
+ } else if (code === 44) {
3319
+ if (start === -1) {
3320
+ throw new SyntaxError(`Unexpected character at index ${i}`);
3321
+ }
3322
+ if (end === -1) end = i;
3323
+ const protocol2 = header.slice(start, end);
3324
+ if (protocols.has(protocol2)) {
3325
+ throw new SyntaxError(`The "${protocol2}" subprotocol is duplicated`);
3326
+ }
3327
+ protocols.add(protocol2);
3328
+ start = end = -1;
3329
+ } else {
3330
+ throw new SyntaxError(`Unexpected character at index ${i}`);
3331
+ }
3332
+ }
3333
+ if (start === -1 || end !== -1) {
3334
+ throw new SyntaxError("Unexpected end of input");
3335
+ }
3336
+ const protocol = header.slice(start, i);
3337
+ if (protocols.has(protocol)) {
3338
+ throw new SyntaxError(`The "${protocol}" subprotocol is duplicated`);
3339
+ }
3340
+ protocols.add(protocol);
3341
+ return protocols;
3342
+ }
3343
+ __name(parse, "parse");
3344
+ module.exports = { parse };
3345
+ }
3346
+ });
3347
+
3348
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js
3349
+ var require_websocket_server = __commonJS({
3350
+ "../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/lib/websocket-server.js"(exports, module) {
3351
+ "use strict";
3352
+ var EventEmitter = __require("events");
3353
+ var http = __require("http");
3354
+ var { Duplex } = __require("stream");
3355
+ var { createHash } = __require("crypto");
3356
+ var extension2 = require_extension();
3357
+ var PerMessageDeflate2 = require_permessage_deflate();
3358
+ var subprotocol2 = require_subprotocol();
3359
+ var WebSocket2 = require_websocket();
3360
+ var { CLOSE_TIMEOUT, GUID, kWebSocket } = require_constants();
3361
+ var keyRegex = /^[+/0-9A-Za-z]{22}==$/;
3362
+ var RUNNING = 0;
3363
+ var CLOSING = 1;
3364
+ var CLOSED = 2;
3365
+ var WebSocketServer2 = class extends EventEmitter {
3366
+ static {
3367
+ __name(this, "WebSocketServer");
3368
+ }
3369
+ /**
3370
+ * Create a `WebSocketServer` instance.
3371
+ *
3372
+ * @param {Object} options Configuration options
3373
+ * @param {Boolean} [options.allowSynchronousEvents=true] Specifies whether
3374
+ * any of the `'message'`, `'ping'`, and `'pong'` events can be emitted
3375
+ * multiple times in the same tick
3376
+ * @param {Boolean} [options.autoPong=true] Specifies whether or not to
3377
+ * automatically send a pong in response to a ping
3378
+ * @param {Number} [options.backlog=511] The maximum length of the queue of
3379
+ * pending connections
3380
+ * @param {Boolean} [options.clientTracking=true] Specifies whether or not to
3381
+ * track clients
3382
+ * @param {Number} [options.closeTimeout=30000] Duration in milliseconds to
3383
+ * wait for the closing handshake to finish after `websocket.close()` is
3384
+ * called
3385
+ * @param {Function} [options.handleProtocols] A hook to handle protocols
3386
+ * @param {String} [options.host] The hostname where to bind the server
3387
+ * @param {Number} [options.maxBufferedChunks=262144] The maximum number of
3388
+ * buffered data chunks
3389
+ * @param {Number} [options.maxFragments=16384] The maximum number of message
3390
+ * fragments
3391
+ * @param {Number} [options.maxPayload=104857600] The maximum allowed message
3392
+ * size
3393
+ * @param {Boolean} [options.noServer=false] Enable no server mode
3394
+ * @param {String} [options.path] Accept only connections matching this path
3395
+ * @param {(Boolean|Object)} [options.perMessageDeflate=false] Enable/disable
3396
+ * permessage-deflate
3397
+ * @param {Number} [options.port] The port where to bind the server
3398
+ * @param {(http.Server|https.Server)} [options.server] A pre-created HTTP/S
3399
+ * server to use
3400
+ * @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
3401
+ * not to skip UTF-8 validation for text and close messages
3402
+ * @param {Function} [options.verifyClient] A hook to reject connections
3403
+ * @param {Function} [options.WebSocket=WebSocket] Specifies the `WebSocket`
3404
+ * class to use. It must be the `WebSocket` class or class that extends it
3405
+ * @param {Function} [callback] A listener for the `listening` event
3406
+ */
3407
+ constructor(options, callback) {
3408
+ super();
3409
+ options = {
3410
+ allowSynchronousEvents: true,
3411
+ autoPong: true,
3412
+ maxBufferedChunks: 256 * 1024,
3413
+ maxFragments: 16 * 1024,
3414
+ maxPayload: 100 * 1024 * 1024,
3415
+ skipUTF8Validation: false,
3416
+ perMessageDeflate: false,
3417
+ handleProtocols: null,
3418
+ clientTracking: true,
3419
+ closeTimeout: CLOSE_TIMEOUT,
3420
+ verifyClient: null,
3421
+ noServer: false,
3422
+ backlog: null,
3423
+ // use default (511 as implemented in net.js)
3424
+ server: null,
3425
+ host: null,
3426
+ path: null,
3427
+ port: null,
3428
+ WebSocket: WebSocket2,
3429
+ ...options
3430
+ };
3431
+ if (options.port == null && !options.server && !options.noServer || options.port != null && (options.server || options.noServer) || options.server && options.noServer) {
3432
+ throw new TypeError(
3433
+ 'One and only one of the "port", "server", or "noServer" options must be specified'
3434
+ );
3435
+ }
3436
+ if (options.port != null) {
3437
+ this._server = http.createServer((req, res) => {
3438
+ const body = http.STATUS_CODES[426];
3439
+ res.writeHead(426, {
3440
+ "Content-Length": body.length,
3441
+ "Content-Type": "text/plain"
3442
+ });
3443
+ res.end(body);
3444
+ });
3445
+ this._server.listen(
3446
+ options.port,
3447
+ options.host,
3448
+ options.backlog,
3449
+ callback
3450
+ );
3451
+ } else if (options.server) {
3452
+ this._server = options.server;
3453
+ }
3454
+ if (this._server) {
3455
+ const emitConnection = this.emit.bind(this, "connection");
3456
+ this._removeListeners = addListeners(this._server, {
3457
+ listening: this.emit.bind(this, "listening"),
3458
+ error: this.emit.bind(this, "error"),
3459
+ upgrade: /* @__PURE__ */ __name((req, socket, head) => {
3460
+ this.handleUpgrade(req, socket, head, emitConnection);
3461
+ }, "upgrade")
3462
+ });
3463
+ }
3464
+ if (options.perMessageDeflate === true) options.perMessageDeflate = {};
3465
+ if (options.clientTracking) {
3466
+ this.clients = /* @__PURE__ */ new Set();
3467
+ this._shouldEmitClose = false;
3468
+ }
3469
+ this.options = options;
3470
+ this._state = RUNNING;
3471
+ }
3472
+ /**
3473
+ * Returns the bound address, the address family name, and port of the server
3474
+ * as reported by the operating system if listening on an IP socket.
3475
+ * If the server is listening on a pipe or UNIX domain socket, the name is
3476
+ * returned as a string.
3477
+ *
3478
+ * @return {(Object|String|null)} The address of the server
3479
+ * @public
3480
+ */
3481
+ address() {
3482
+ if (this.options.noServer) {
3483
+ throw new Error('The server is operating in "noServer" mode');
3484
+ }
3485
+ if (!this._server) return null;
3486
+ return this._server.address();
3487
+ }
3488
+ /**
3489
+ * Stop the server from accepting new connections and emit the `'close'` event
3490
+ * when all existing connections are closed.
3491
+ *
3492
+ * @param {Function} [cb] A one-time listener for the `'close'` event
3493
+ * @public
3494
+ */
3495
+ close(cb) {
3496
+ if (this._state === CLOSED) {
3497
+ if (cb) {
3498
+ this.once("close", () => {
3499
+ cb(new Error("The server is not running"));
3500
+ });
3501
+ }
3502
+ process.nextTick(emitClose, this);
3503
+ return;
3504
+ }
3505
+ if (cb) this.once("close", cb);
3506
+ if (this._state === CLOSING) return;
3507
+ this._state = CLOSING;
3508
+ if (this.options.noServer || this.options.server) {
3509
+ if (this._server) {
3510
+ this._removeListeners();
3511
+ this._removeListeners = this._server = null;
3512
+ }
3513
+ if (this.clients) {
3514
+ if (!this.clients.size) {
3515
+ process.nextTick(emitClose, this);
3516
+ } else {
3517
+ this._shouldEmitClose = true;
3518
+ }
3519
+ } else {
3520
+ process.nextTick(emitClose, this);
3521
+ }
3522
+ } else {
3523
+ const server = this._server;
3524
+ this._removeListeners();
3525
+ this._removeListeners = this._server = null;
3526
+ server.close(() => {
3527
+ emitClose(this);
3528
+ });
3529
+ }
3530
+ }
3531
+ /**
3532
+ * See if a given request should be handled by this server instance.
3533
+ *
3534
+ * @param {http.IncomingMessage} req Request object to inspect
3535
+ * @return {Boolean} `true` if the request is valid, else `false`
3536
+ * @public
3537
+ */
3538
+ shouldHandle(req) {
3539
+ if (this.options.path) {
3540
+ const index = req.url.indexOf("?");
3541
+ const pathname = index !== -1 ? req.url.slice(0, index) : req.url;
3542
+ if (pathname !== this.options.path) return false;
3543
+ }
3544
+ return true;
3545
+ }
3546
+ /**
3547
+ * Handle a HTTP Upgrade request.
3548
+ *
3549
+ * @param {http.IncomingMessage} req The request object
3550
+ * @param {Duplex} socket The network socket between the server and client
3551
+ * @param {Buffer} head The first packet of the upgraded stream
3552
+ * @param {Function} cb Callback
3553
+ * @public
3554
+ */
3555
+ handleUpgrade(req, socket, head, cb) {
3556
+ socket.on("error", socketOnError);
3557
+ const key = req.headers["sec-websocket-key"];
3558
+ const upgrade = req.headers.upgrade;
3559
+ const version = +req.headers["sec-websocket-version"];
3560
+ if (req.method !== "GET") {
3561
+ const message = "Invalid HTTP method";
3562
+ abortHandshakeOrEmitwsClientError(this, req, socket, 405, message);
3563
+ return;
3564
+ }
3565
+ if (upgrade === void 0 || upgrade.toLowerCase() !== "websocket") {
3566
+ const message = "Invalid Upgrade header";
3567
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
3568
+ return;
3569
+ }
3570
+ if (key === void 0 || !keyRegex.test(key)) {
3571
+ const message = "Missing or invalid Sec-WebSocket-Key header";
3572
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
3573
+ return;
3574
+ }
3575
+ if (version !== 13 && version !== 8) {
3576
+ const message = "Missing or invalid Sec-WebSocket-Version header";
3577
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message, {
3578
+ "Sec-WebSocket-Version": "13, 8"
3579
+ });
3580
+ return;
3581
+ }
3582
+ if (!this.shouldHandle(req)) {
3583
+ abortHandshake(socket, 400);
3584
+ return;
3585
+ }
3586
+ const secWebSocketProtocol = req.headers["sec-websocket-protocol"];
3587
+ let protocols = /* @__PURE__ */ new Set();
3588
+ if (secWebSocketProtocol !== void 0) {
3589
+ try {
3590
+ protocols = subprotocol2.parse(secWebSocketProtocol);
3591
+ } catch (err) {
3592
+ const message = "Invalid Sec-WebSocket-Protocol header";
3593
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
3594
+ return;
3595
+ }
3596
+ }
3597
+ const secWebSocketExtensions = req.headers["sec-websocket-extensions"];
3598
+ const extensions = {};
3599
+ if (this.options.perMessageDeflate && secWebSocketExtensions !== void 0) {
3600
+ const perMessageDeflate = new PerMessageDeflate2({
3601
+ ...this.options.perMessageDeflate,
3602
+ isServer: true,
3603
+ maxPayload: this.options.maxPayload
3604
+ });
3605
+ try {
3606
+ const offers = extension2.parse(secWebSocketExtensions);
3607
+ if (offers[PerMessageDeflate2.extensionName]) {
3608
+ perMessageDeflate.accept(offers[PerMessageDeflate2.extensionName]);
3609
+ extensions[PerMessageDeflate2.extensionName] = perMessageDeflate;
3610
+ }
3611
+ } catch (err) {
3612
+ const message = "Invalid or unacceptable Sec-WebSocket-Extensions header";
3613
+ abortHandshakeOrEmitwsClientError(this, req, socket, 400, message);
3614
+ return;
3615
+ }
3616
+ }
3617
+ if (this.options.verifyClient) {
3618
+ const info = {
3619
+ origin: req.headers[`${version === 8 ? "sec-websocket-origin" : "origin"}`],
3620
+ secure: !!(req.socket.authorized || req.socket.encrypted),
3621
+ req
3622
+ };
3623
+ if (this.options.verifyClient.length === 2) {
3624
+ this.options.verifyClient(info, (verified, code, message, headers) => {
3625
+ if (!verified) {
3626
+ return abortHandshake(socket, code || 401, message, headers);
3627
+ }
3628
+ this.completeUpgrade(
3629
+ extensions,
3630
+ key,
3631
+ protocols,
3632
+ req,
3633
+ socket,
3634
+ head,
3635
+ cb
3636
+ );
3637
+ });
3638
+ return;
3639
+ }
3640
+ if (!this.options.verifyClient(info)) return abortHandshake(socket, 401);
3641
+ }
3642
+ this.completeUpgrade(extensions, key, protocols, req, socket, head, cb);
3643
+ }
3644
+ /**
3645
+ * Upgrade the connection to WebSocket.
3646
+ *
3647
+ * @param {Object} extensions The accepted extensions
3648
+ * @param {String} key The value of the `Sec-WebSocket-Key` header
3649
+ * @param {Set} protocols The subprotocols
3650
+ * @param {http.IncomingMessage} req The request object
3651
+ * @param {Duplex} socket The network socket between the server and client
3652
+ * @param {Buffer} head The first packet of the upgraded stream
3653
+ * @param {Function} cb Callback
3654
+ * @throws {Error} If called more than once with the same socket
3655
+ * @private
3656
+ */
3657
+ completeUpgrade(extensions, key, protocols, req, socket, head, cb) {
3658
+ if (!socket.readable || !socket.writable) return socket.destroy();
3659
+ if (socket[kWebSocket]) {
3660
+ throw new Error(
3661
+ "server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration"
3662
+ );
3663
+ }
3664
+ if (this._state > RUNNING) return abortHandshake(socket, 503);
3665
+ const digest = createHash("sha1").update(key + GUID).digest("base64");
3666
+ const headers = [
3667
+ "HTTP/1.1 101 Switching Protocols",
3668
+ "Upgrade: websocket",
3669
+ "Connection: Upgrade",
3670
+ `Sec-WebSocket-Accept: ${digest}`
3671
+ ];
3672
+ const ws = new this.options.WebSocket(null, void 0, this.options);
3673
+ if (protocols.size) {
3674
+ const protocol = this.options.handleProtocols ? this.options.handleProtocols(protocols, req) : protocols.values().next().value;
3675
+ if (protocol) {
3676
+ headers.push(`Sec-WebSocket-Protocol: ${protocol}`);
3677
+ ws._protocol = protocol;
3678
+ }
3679
+ }
3680
+ if (extensions[PerMessageDeflate2.extensionName]) {
3681
+ const params = extensions[PerMessageDeflate2.extensionName].params;
3682
+ const value = extension2.format({
3683
+ [PerMessageDeflate2.extensionName]: [params]
3684
+ });
3685
+ headers.push(`Sec-WebSocket-Extensions: ${value}`);
3686
+ ws._extensions = extensions;
3687
+ }
3688
+ this.emit("headers", headers, req);
3689
+ socket.write(headers.concat("\r\n").join("\r\n"));
3690
+ socket.removeListener("error", socketOnError);
3691
+ ws.setSocket(socket, head, {
3692
+ allowSynchronousEvents: this.options.allowSynchronousEvents,
3693
+ maxBufferedChunks: this.options.maxBufferedChunks,
3694
+ maxFragments: this.options.maxFragments,
3695
+ maxPayload: this.options.maxPayload,
3696
+ skipUTF8Validation: this.options.skipUTF8Validation
3697
+ });
3698
+ if (this.clients) {
3699
+ this.clients.add(ws);
3700
+ ws.on("close", () => {
3701
+ this.clients.delete(ws);
3702
+ if (this._shouldEmitClose && !this.clients.size) {
3703
+ process.nextTick(emitClose, this);
3704
+ }
3705
+ });
3706
+ }
3707
+ cb(ws, req);
3708
+ }
3709
+ };
3710
+ module.exports = WebSocketServer2;
3711
+ function addListeners(server, map) {
3712
+ for (const event of Object.keys(map)) server.on(event, map[event]);
3713
+ return /* @__PURE__ */ __name(function removeListeners() {
3714
+ for (const event of Object.keys(map)) {
3715
+ server.removeListener(event, map[event]);
3716
+ }
3717
+ }, "removeListeners");
3718
+ }
3719
+ __name(addListeners, "addListeners");
3720
+ function emitClose(server) {
3721
+ server._state = CLOSED;
3722
+ server.emit("close");
3723
+ }
3724
+ __name(emitClose, "emitClose");
3725
+ function socketOnError() {
3726
+ this.destroy();
3727
+ }
3728
+ __name(socketOnError, "socketOnError");
3729
+ function abortHandshake(socket, code, message, headers) {
3730
+ message = message || http.STATUS_CODES[code];
3731
+ headers = {
3732
+ Connection: "close",
3733
+ "Content-Type": "text/html",
3734
+ "Content-Length": Buffer.byteLength(message),
3735
+ ...headers
3736
+ };
3737
+ socket.once("finish", socket.destroy);
3738
+ socket.end(
3739
+ `HTTP/1.1 ${code} ${http.STATUS_CODES[code]}\r
3740
+ ` + Object.keys(headers).map((h) => `${h}: ${headers[h]}`).join("\r\n") + "\r\n\r\n" + message
3741
+ );
3742
+ }
3743
+ __name(abortHandshake, "abortHandshake");
3744
+ function abortHandshakeOrEmitwsClientError(server, req, socket, code, message, headers) {
3745
+ if (server.listenerCount("wsClientError")) {
3746
+ const err = new Error(message);
3747
+ Error.captureStackTrace(err, abortHandshakeOrEmitwsClientError);
3748
+ server.emit("wsClientError", err, socket, req);
3749
+ } else {
3750
+ abortHandshake(socket, code, message, headers);
3751
+ }
3752
+ }
3753
+ __name(abortHandshakeOrEmitwsClientError, "abortHandshakeOrEmitwsClientError");
3754
+ }
3755
+ });
3756
+
3757
+ // ../../node_modules/.pnpm/ws@8.21.3/node_modules/ws/wrapper.mjs
3758
+ var import_stream = __toESM(require_stream(), 1);
3759
+ var import_extension = __toESM(require_extension(), 1);
3760
+ var import_permessage_deflate = __toESM(require_permessage_deflate(), 1);
3761
+ var import_receiver = __toESM(require_receiver(), 1);
3762
+ var import_sender = __toESM(require_sender(), 1);
3763
+ var import_subprotocol = __toESM(require_subprotocol(), 1);
3764
+ var import_websocket = __toESM(require_websocket(), 1);
3765
+ var import_websocket_server = __toESM(require_websocket_server(), 1);
3766
+ var wrapper_default = import_websocket.default;
3767
+
3768
+ // ../../node_modules/.pnpm/ink@7.0.3_@types+react@19.2.15_react@19.2.6/node_modules/ink/build/devtools-window-polyfill.js
3769
+ var customGlobal = globalThis;
3770
+ customGlobal.WebSocket ||= wrapper_default;
3771
+ customGlobal.window ||= globalThis;
3772
+ customGlobal.self ||= globalThis;
3773
+ customGlobal.window.__REACT_DEVTOOLS_COMPONENT_FILTERS__ = [
3774
+ {
3775
+ // ComponentFilterElementType
3776
+ type: 1,
3777
+ // ElementTypeHostComponent
3778
+ value: 7,
3779
+ isEnabled: true
3780
+ },
3781
+ {
3782
+ // ComponentFilterDisplayName
3783
+ type: 2,
3784
+ value: "InternalApp",
3785
+ isEnabled: true,
3786
+ isValid: true
3787
+ },
3788
+ {
3789
+ // ComponentFilterDisplayName
3790
+ type: 2,
3791
+ value: "InternalAppContext",
3792
+ isEnabled: true,
3793
+ isValid: true
3794
+ },
3795
+ {
3796
+ // ComponentFilterDisplayName
3797
+ type: 2,
3798
+ value: "InternalStdoutContext",
3799
+ isEnabled: true,
3800
+ isValid: true
3801
+ },
3802
+ {
3803
+ // ComponentFilterDisplayName
3804
+ type: 2,
3805
+ value: "InternalStderrContext",
3806
+ isEnabled: true,
3807
+ isValid: true
3808
+ },
3809
+ {
3810
+ // ComponentFilterDisplayName
3811
+ type: 2,
3812
+ value: "InternalStdinContext",
3813
+ isEnabled: true,
3814
+ isValid: true
3815
+ },
3816
+ {
3817
+ // ComponentFilterDisplayName
3818
+ type: 2,
3819
+ value: "InternalFocusContext",
3820
+ isEnabled: true,
3821
+ isValid: true
3822
+ }
3823
+ ];
3824
+
3825
+ // ../../node_modules/.pnpm/ink@7.0.3_@types+react@19.2.15_react@19.2.6/node_modules/ink/build/devtools.js
3826
+ import devtools from "react-devtools-core";
3827
+ var isDevToolsReachable = /* @__PURE__ */ __name(async () => new Promise((resolve) => {
3828
+ const socket = new wrapper_default("ws://localhost:8097");
3829
+ const timeout = setTimeout(() => {
3830
+ socket.terminate();
3831
+ resolve(false);
3832
+ }, 2e3);
3833
+ timeout.unref();
3834
+ socket.on("open", () => {
3835
+ clearTimeout(timeout);
3836
+ socket.terminate();
3837
+ resolve(true);
3838
+ });
3839
+ socket.on("error", () => {
3840
+ clearTimeout(timeout);
3841
+ socket.terminate();
3842
+ resolve(false);
3843
+ });
3844
+ }), "isDevToolsReachable");
3845
+ if (await isDevToolsReachable()) {
3846
+ devtools.initialize();
3847
+ devtools.connectToDevTools();
3848
+ } else {
3849
+ console.warn("DEV is set to true, but the React DevTools server is not running. Start it with:\n\n$ npx react-devtools\n");
3850
+ }
3851
+ //# sourceMappingURL=devtools-LBE4PAQN.js.map