@caspian2026/agent-sdk 0.0.25 → 0.0.26

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 (362) hide show
  1. package/dist/gateway/index.js +98 -22
  2. package/dist/gateway/worker.js +86 -41
  3. package/dist/sdk/query.cjs +2 -362
  4. package/dist/sdk/query.js +2 -367
  5. package/package.json +4 -6
  6. package/dist/chunk-04n4fe72.js +0 -107
  7. package/dist/chunk-04ys66ej.js +0 -344
  8. package/dist/chunk-07069jq1.js +0 -30
  9. package/dist/chunk-0731m51q.js +0 -8
  10. package/dist/chunk-086x4ct4.js +0 -26
  11. package/dist/chunk-0btqb97n.js +0 -295
  12. package/dist/chunk-0paqc2yw.js +0 -15
  13. package/dist/chunk-0r1rjydx.js +0 -145
  14. package/dist/chunk-0r5bb9j4.js +0 -477
  15. package/dist/chunk-0t81d427.js +0 -41
  16. package/dist/chunk-0teq2mz0.js +0 -420
  17. package/dist/chunk-0vkfrmqm.js +0 -690
  18. package/dist/chunk-0vp3wfab.js +0 -12
  19. package/dist/chunk-0warp8dx.js +0 -253
  20. package/dist/chunk-0xjaqda8.js +0 -1124
  21. package/dist/chunk-10gzv316.js +0 -62
  22. package/dist/chunk-11pq9n08.js +0 -168
  23. package/dist/chunk-1ae3nt9j.js +0 -31
  24. package/dist/chunk-1fmb0njn.js +0 -396
  25. package/dist/chunk-1gx78081.js +0 -66
  26. package/dist/chunk-1h2famwb.js +0 -49
  27. package/dist/chunk-1ng8xwxz.js +0 -276
  28. package/dist/chunk-1v7jp29h.js +0 -206
  29. package/dist/chunk-1xxy5zhb.js +0 -673
  30. package/dist/chunk-20b73w7w.js +0 -117
  31. package/dist/chunk-20qxd83a.js +0 -1161
  32. package/dist/chunk-2239ny9q.js +0 -90
  33. package/dist/chunk-22d4rnef.js +0 -226
  34. package/dist/chunk-26wtxbdc.js +0 -13870
  35. package/dist/chunk-27225bjh.js +0 -618
  36. package/dist/chunk-2b0e32an.js +0 -5822
  37. package/dist/chunk-2bfa9w1y.js +0 -323
  38. package/dist/chunk-2epq04w1.js +0 -63
  39. package/dist/chunk-2fwze72g.js +0 -24
  40. package/dist/chunk-2gzv8nrw.js +0 -205
  41. package/dist/chunk-2mexte1r.js +0 -349
  42. package/dist/chunk-2mzaqh5g.js +0 -338
  43. package/dist/chunk-2tb6mzfc.js +0 -81
  44. package/dist/chunk-2xq0g43w.js +0 -558
  45. package/dist/chunk-334aeqg9.js +0 -90
  46. package/dist/chunk-34jx4rjd.js +0 -995
  47. package/dist/chunk-35w5nhex.js +0 -132
  48. package/dist/chunk-3c25bcsw.js +0 -17
  49. package/dist/chunk-3eaxj8dg.js +0 -151
  50. package/dist/chunk-3fdgrwd2.js +0 -111
  51. package/dist/chunk-3jw0r58d.js +0 -121
  52. package/dist/chunk-3mgywd32.js +0 -8
  53. package/dist/chunk-3nk79af8.js +0 -8
  54. package/dist/chunk-3vy1jt9p.js +0 -1010
  55. package/dist/chunk-3x78pd4j.js +0 -153
  56. package/dist/chunk-47x3dsmn.js +0 -95
  57. package/dist/chunk-49pqt48n.js +0 -108
  58. package/dist/chunk-4f7m9fjw.js +0 -317
  59. package/dist/chunk-4jm600zv.js +0 -13
  60. package/dist/chunk-4k9d7gxv.js +0 -118
  61. package/dist/chunk-4net8san.js +0 -155
  62. package/dist/chunk-4pbx3g7s.js +0 -26
  63. package/dist/chunk-4v125j4z.js +0 -58
  64. package/dist/chunk-4vxkv5vz.js +0 -1438
  65. package/dist/chunk-51fqpjy3.js +0 -121
  66. package/dist/chunk-52e64f2h.js +0 -439
  67. package/dist/chunk-52e9mdjv.js +0 -684
  68. package/dist/chunk-55raexh7.js +0 -14358
  69. package/dist/chunk-59pq5122.js +0 -269
  70. package/dist/chunk-5bsj67v1.js +0 -349
  71. package/dist/chunk-5ccdsxgy.js +0 -74
  72. package/dist/chunk-5ekyhb1w.js +0 -422
  73. package/dist/chunk-5gcqdn8x.js +0 -867
  74. package/dist/chunk-5h5kx2jd.js +0 -34
  75. package/dist/chunk-5hf3werb.js +0 -193
  76. package/dist/chunk-5n1jc02d.js +0 -87
  77. package/dist/chunk-5wfxvxm8.js +0 -127
  78. package/dist/chunk-5wjebwmn.js +0 -89
  79. package/dist/chunk-5z28bqne.js +0 -6748
  80. package/dist/chunk-5zwsxpjn.js +0 -671
  81. package/dist/chunk-60phw466.js +0 -29
  82. package/dist/chunk-64c1avct.js +0 -13
  83. package/dist/chunk-64r16v22.js +0 -162
  84. package/dist/chunk-65t1r7zs.js +0 -418
  85. package/dist/chunk-66zry909.js +0 -11
  86. package/dist/chunk-67hxjjgc.js +0 -731
  87. package/dist/chunk-68ffk5qa.js +0 -14
  88. package/dist/chunk-69dr6rrd.js +0 -177
  89. package/dist/chunk-69n11zng.js +0 -436
  90. package/dist/chunk-6dj5t602.js +0 -341
  91. package/dist/chunk-6dngjwkh.js +0 -63
  92. package/dist/chunk-6dp8sz55.js +0 -3561
  93. package/dist/chunk-6hqgg0sv.js +0 -103
  94. package/dist/chunk-6nsd9606.js +0 -790
  95. package/dist/chunk-6p0hbwz3.js +0 -65
  96. package/dist/chunk-6ywdv5vg.js +0 -97
  97. package/dist/chunk-6zc758qw.js +0 -640
  98. package/dist/chunk-7aw745vx.js +0 -40175
  99. package/dist/chunk-7fxaphbq.js +0 -116
  100. package/dist/chunk-7sgtxrsc.js +0 -1059
  101. package/dist/chunk-7wm5s02e.js +0 -216
  102. package/dist/chunk-7xdk4109.js +0 -442
  103. package/dist/chunk-7xyswgjh.js +0 -8
  104. package/dist/chunk-83hfzbx3.js +0 -10
  105. package/dist/chunk-87m69h0v.js +0 -219
  106. package/dist/chunk-8g5pe1gr.js +0 -37
  107. package/dist/chunk-8jbw0fnf.js +0 -167
  108. package/dist/chunk-8jf9se66.js +0 -321
  109. package/dist/chunk-8p65embj.js +0 -875
  110. package/dist/chunk-8qrmaff1.js +0 -2669
  111. package/dist/chunk-8r975mwc.js +0 -93
  112. package/dist/chunk-8yhf030a.js +0 -69
  113. package/dist/chunk-93emz367.js +0 -107
  114. package/dist/chunk-948mn975.js +0 -460
  115. package/dist/chunk-99chkt7r.js +0 -54
  116. package/dist/chunk-9f7c1hzz.js +0 -50
  117. package/dist/chunk-9fk9ps1g.js +0 -178
  118. package/dist/chunk-9rh0k0aq.js +0 -90
  119. package/dist/chunk-9x5zgy22.js +0 -12
  120. package/dist/chunk-a0k2vj5b.js +0 -460
  121. package/dist/chunk-a0m57ssq.js +0 -325
  122. package/dist/chunk-a0nsmmz1.js +0 -133
  123. package/dist/chunk-a25jh1v4.js +0 -105
  124. package/dist/chunk-a4j5ekv0.js +0 -83
  125. package/dist/chunk-a8k3zf58.js +0 -313
  126. package/dist/chunk-ah0zarbq.js +0 -260
  127. package/dist/chunk-ase86y73.js +0 -15
  128. package/dist/chunk-b0kf00ff.js +0 -637
  129. package/dist/chunk-b1kcd3ss.js +0 -27
  130. package/dist/chunk-b8kcqqds.js +0 -93
  131. package/dist/chunk-bg4x9ex0.js +0 -21
  132. package/dist/chunk-bh5zqvyc.js +0 -36
  133. package/dist/chunk-bqrkfekw.js +0 -267
  134. package/dist/chunk-brjd9zmk.js +0 -42
  135. package/dist/chunk-byfawrfx.js +0 -121
  136. package/dist/chunk-c6sjhj89.js +0 -1284
  137. package/dist/chunk-c7e5yv0q.js +0 -212
  138. package/dist/chunk-c7jwbe76.js +0 -29030
  139. package/dist/chunk-cb5v8w7k.js +0 -289
  140. package/dist/chunk-cdef9v7b.js +0 -27
  141. package/dist/chunk-cdz5yb0r.js +0 -57
  142. package/dist/chunk-cgfdkzhb.js +0 -12
  143. package/dist/chunk-cgqw4x5z.js +0 -155
  144. package/dist/chunk-cnsj3vq2.js +0 -35
  145. package/dist/chunk-cqxm7ggc.js +0 -123
  146. package/dist/chunk-cxrktb5g.js +0 -51
  147. package/dist/chunk-d089t7dk.js +0 -312
  148. package/dist/chunk-d1z934cp.js +0 -71
  149. package/dist/chunk-d4mdda98.js +0 -94
  150. package/dist/chunk-d7xw8v91.js +0 -332
  151. package/dist/chunk-dc06c3rw.js +0 -1154
  152. package/dist/chunk-ddsjkqs4.js +0 -39
  153. package/dist/chunk-dfzkwynj.js +0 -5368
  154. package/dist/chunk-dnmp7s85.js +0 -20
  155. package/dist/chunk-dqqwjkv3.js +0 -8583
  156. package/dist/chunk-dt2mr4vf.js +0 -2962
  157. package/dist/chunk-dztm97gg.js +0 -150
  158. package/dist/chunk-e0abab5b.js +0 -445
  159. package/dist/chunk-e0ragz46.js +0 -209386
  160. package/dist/chunk-e9w9zc0g.js +0 -392
  161. package/dist/chunk-ebwskmsr.js +0 -107
  162. package/dist/chunk-efztk52j.js +0 -114
  163. package/dist/chunk-ehd8wacx.js +0 -40
  164. package/dist/chunk-ehtwnxpg.js +0 -1591
  165. package/dist/chunk-eqp1rfft.js +0 -17
  166. package/dist/chunk-etdt1xz3.js +0 -19
  167. package/dist/chunk-eva785x8.js +0 -88
  168. package/dist/chunk-ewadzrm8.js +0 -103
  169. package/dist/chunk-f2ajmcav.js +0 -92
  170. package/dist/chunk-fajg8x36.js +0 -8158
  171. package/dist/chunk-fbv4apne.js +0 -51
  172. package/dist/chunk-fcynwjpm.js +0 -1072
  173. package/dist/chunk-fev86f95.js +0 -1052
  174. package/dist/chunk-feyzykye.js +0 -10
  175. package/dist/chunk-ff85rwvc.js +0 -180
  176. package/dist/chunk-fk6ktvg2.js +0 -275
  177. package/dist/chunk-fqak69ft.js +0 -458
  178. package/dist/chunk-fqwas4jk.js +0 -281
  179. package/dist/chunk-fs35fdpj.js +0 -439
  180. package/dist/chunk-fvr3f9s3.js +0 -55
  181. package/dist/chunk-fyc5fepv.js +0 -10
  182. package/dist/chunk-g2g9cwt9.js +0 -54
  183. package/dist/chunk-g4znz46v.js +0 -2335
  184. package/dist/chunk-g5ts4e6k.js +0 -697
  185. package/dist/chunk-g6een9wr.js +0 -654
  186. package/dist/chunk-g7cmtx8r.js +0 -77
  187. package/dist/chunk-g9f19ttm.js +0 -15
  188. package/dist/chunk-gc7ap41t.js +0 -516
  189. package/dist/chunk-gdwdqewd.js +0 -19
  190. package/dist/chunk-gg14h3n4.js +0 -131
  191. package/dist/chunk-gg55fns0.js +0 -6440
  192. package/dist/chunk-gq7zab4e.js +0 -418
  193. package/dist/chunk-gydw3qy3.js +0 -169
  194. package/dist/chunk-gz1e8y1w.js +0 -33
  195. package/dist/chunk-h19r628d.js +0 -91
  196. package/dist/chunk-h2k8mt3z.js +0 -329
  197. package/dist/chunk-h9n54swm.js +0 -27
  198. package/dist/chunk-hakdhagh.js +0 -16606
  199. package/dist/chunk-hc2chp3g.js +0 -308
  200. package/dist/chunk-hemcv9t7.js +0 -153
  201. package/dist/chunk-hm62ntv3.js +0 -20
  202. package/dist/chunk-hmq09ytj.js +0 -100
  203. package/dist/chunk-hmv4hhqt.js +0 -2718
  204. package/dist/chunk-hwfknpxv.js +0 -39
  205. package/dist/chunk-j5bth84e.js +0 -97
  206. package/dist/chunk-j64ga6ta.js +0 -8035
  207. package/dist/chunk-j6v3w4yf.js +0 -244
  208. package/dist/chunk-jc29d2nm.js +0 -130
  209. package/dist/chunk-jd32zbps.js +0 -15
  210. package/dist/chunk-jd4sx4wh.js +0 -594
  211. package/dist/chunk-jha8n8b9.js +0 -33118
  212. package/dist/chunk-jj71qx7m.js +0 -122
  213. package/dist/chunk-jka9vpak.js +0 -114
  214. package/dist/chunk-jkf6ayv0.js +0 -32
  215. package/dist/chunk-jpz6t2tt.js +0 -61
  216. package/dist/chunk-jqt3sw12.js +0 -9114
  217. package/dist/chunk-jswd1q63.js +0 -101
  218. package/dist/chunk-jtc4aa2y.js +0 -1543
  219. package/dist/chunk-jyx3h86z.js +0 -635
  220. package/dist/chunk-jzthz1bx.js +0 -15
  221. package/dist/chunk-k0p9w03v.js +0 -4957
  222. package/dist/chunk-k6x3s7x5.js +0 -211
  223. package/dist/chunk-k7kmvnnx.js +0 -942
  224. package/dist/chunk-k8vp0atq.js +0 -2331
  225. package/dist/chunk-k9vm6x6z.js +0 -257
  226. package/dist/chunk-kb1edvhs.js +0 -120
  227. package/dist/chunk-kbhbe33q.js +0 -113
  228. package/dist/chunk-kgcgpp7z.js +0 -140
  229. package/dist/chunk-kvywbvqs.js +0 -261
  230. package/dist/chunk-kwekc97v.js +0 -18
  231. package/dist/chunk-kwyk9zp1.js +0 -74
  232. package/dist/chunk-ky1z78ve.js +0 -119
  233. package/dist/chunk-mcws22k3.js +0 -42
  234. package/dist/chunk-mr2z79r3.js +0 -1385
  235. package/dist/chunk-mst9nmns.js +0 -642
  236. package/dist/chunk-mswx2nma.js +0 -103
  237. package/dist/chunk-n1e3fjpz.js +0 -266
  238. package/dist/chunk-n6vjp9yg.js +0 -138
  239. package/dist/chunk-n84tqtvv.js +0 -120
  240. package/dist/chunk-n8ssddbw.js +0 -105
  241. package/dist/chunk-na35whkd.js +0 -227
  242. package/dist/chunk-netzwgv1.js +0 -154
  243. package/dist/chunk-ng7j0yy1.js +0 -100
  244. package/dist/chunk-nmgj86tt.js +0 -24
  245. package/dist/chunk-ns7x6xam.js +0 -22820
  246. package/dist/chunk-p7vkh4wx.js +0 -15
  247. package/dist/chunk-p8na2wwp.js +0 -14
  248. package/dist/chunk-pe3rkfp2.js +0 -74
  249. package/dist/chunk-pf0152j3.js +0 -40
  250. package/dist/chunk-pgtnj1mt.js +0 -705
  251. package/dist/chunk-ppwjyveh.js +0 -8
  252. package/dist/chunk-pq5qp2y4.js +0 -388
  253. package/dist/chunk-pqqxdk5f.js +0 -543
  254. package/dist/chunk-ps49ymvj.js +0 -43
  255. package/dist/chunk-pws8gq7m.js +0 -7422
  256. package/dist/chunk-pwwa7s62.js +0 -11
  257. package/dist/chunk-pyq0fabn.js +0 -860
  258. package/dist/chunk-q0p1m40t.js +0 -79
  259. package/dist/chunk-q0vhv550.js +0 -393
  260. package/dist/chunk-q7r0kt08.js +0 -1809
  261. package/dist/chunk-qajrkk97.js +0 -298
  262. package/dist/chunk-qatfdxvd.js +0 -34
  263. package/dist/chunk-qb6k2afy.js +0 -153
  264. package/dist/chunk-qg2qgx8h.js +0 -266
  265. package/dist/chunk-qkczt8cr.js +0 -24
  266. package/dist/chunk-qnfx3qtx.js +0 -617
  267. package/dist/chunk-qp2qdcda.js +0 -100
  268. package/dist/chunk-qtwgzej9.js +0 -85
  269. package/dist/chunk-r1dh0ymt.js +0 -91
  270. package/dist/chunk-r36xvgvv.js +0 -407
  271. package/dist/chunk-r48he8g3.js +0 -251
  272. package/dist/chunk-r63tqmtk.js +0 -146
  273. package/dist/chunk-rbdd3q5k.js +0 -101
  274. package/dist/chunk-rmbbmd3s.js +0 -68
  275. package/dist/chunk-rn0v1hk8.js +0 -34
  276. package/dist/chunk-rnxctq9p.js +0 -1646
  277. package/dist/chunk-rrs2mchs.js +0 -183
  278. package/dist/chunk-rtrybvnp.js +0 -209
  279. package/dist/chunk-rw2wkn45.js +0 -494
  280. package/dist/chunk-s4kzkdhd.js +0 -847
  281. package/dist/chunk-s7a0zn7b.js +0 -55
  282. package/dist/chunk-s8gy4ky9.js +0 -122
  283. package/dist/chunk-s8kj6ajy.js +0 -32
  284. package/dist/chunk-sag785ad.js +0 -283
  285. package/dist/chunk-scqjyben.js +0 -174
  286. package/dist/chunk-sd36yzx8.js +0 -954
  287. package/dist/chunk-sdtqm0nm.js +0 -374
  288. package/dist/chunk-sg60xg0x.js +0 -52
  289. package/dist/chunk-sgpmpn90.js +0 -35
  290. package/dist/chunk-sh02d2qn.js +0 -38
  291. package/dist/chunk-sz9y6z13.js +0 -61
  292. package/dist/chunk-szj5wvdy.js +0 -28
  293. package/dist/chunk-t29a6zb5.js +0 -45
  294. package/dist/chunk-t2b49hcf.js +0 -87
  295. package/dist/chunk-t2wqdppz.js +0 -445
  296. package/dist/chunk-t4khqff1.js +0 -16
  297. package/dist/chunk-t70t2gne.js +0 -121
  298. package/dist/chunk-t9p85zff.js +0 -24
  299. package/dist/chunk-tkrstmwz.js +0 -94
  300. package/dist/chunk-tnyb4exc.js +0 -74
  301. package/dist/chunk-tpn8jsvw.js +0 -71
  302. package/dist/chunk-tt7x5j1q.js +0 -111
  303. package/dist/chunk-tw1p628z.js +0 -984
  304. package/dist/chunk-twvdafcz.js +0 -528
  305. package/dist/chunk-tzwjafgn.js +0 -24
  306. package/dist/chunk-v140t8ay.js +0 -152
  307. package/dist/chunk-v1kzp02e.js +0 -785
  308. package/dist/chunk-v4t6dyyh.js +0 -9076
  309. package/dist/chunk-v78fj8by.js +0 -145
  310. package/dist/chunk-v8kjswxt.js +0 -61
  311. package/dist/chunk-v9smspw2.js +0 -4301
  312. package/dist/chunk-vcfbjkk9.js +0 -201
  313. package/dist/chunk-ve167rcs.js +0 -148
  314. package/dist/chunk-vf612n57.js +0 -472
  315. package/dist/chunk-vhffyae8.js +0 -895
  316. package/dist/chunk-vkhrrvfq.js +0 -44
  317. package/dist/chunk-vybkmfhf.js +0 -91
  318. package/dist/chunk-vyjeh50y.js +0 -2149
  319. package/dist/chunk-w6m6trzq.js +0 -58
  320. package/dist/chunk-w9b6kngq.js +0 -234
  321. package/dist/chunk-wa8yn2p0.js +0 -2007
  322. package/dist/chunk-wanceff6.js +0 -2840
  323. package/dist/chunk-wcze2nea.js +0 -336
  324. package/dist/chunk-wgk9sxk7.js +0 -329
  325. package/dist/chunk-wnxcgfsd.js +0 -253
  326. package/dist/chunk-wyjerrr6.js +0 -565
  327. package/dist/chunk-wz9brkq5.js +0 -60
  328. package/dist/chunk-x47h283a.js +0 -56
  329. package/dist/chunk-x59j3x9c.js +0 -98
  330. package/dist/chunk-x6r4v44b.js +0 -8
  331. package/dist/chunk-x7fdwq3d.js +0 -33
  332. package/dist/chunk-x8d2ehd7.js +0 -19
  333. package/dist/chunk-xeb6075z.js +0 -3435
  334. package/dist/chunk-xfw2pxwd.js +0 -223
  335. package/dist/chunk-xh06jc72.js +0 -200
  336. package/dist/chunk-xhfmdq1y.js +0 -147
  337. package/dist/chunk-xkwyg1d2.js +0 -195
  338. package/dist/chunk-xv3era3s.js +0 -8
  339. package/dist/chunk-xyapc58m.js +0 -87
  340. package/dist/chunk-xzgnc76g.js +0 -107
  341. package/dist/chunk-y1784krc.js +0 -19
  342. package/dist/chunk-y4ca9kqz.js +0 -3830
  343. package/dist/chunk-y9bhjjdz.js +0 -145
  344. package/dist/chunk-yb3bxv3w.js +0 -30
  345. package/dist/chunk-yddek6xk.js +0 -146
  346. package/dist/chunk-ypaq3d12.js +0 -4265
  347. package/dist/chunk-yq8z040g.js +0 -111
  348. package/dist/chunk-yqs481qq.js +0 -1163
  349. package/dist/chunk-ys9a9c9h.js +0 -105
  350. package/dist/chunk-yyex5gsf.js +0 -269
  351. package/dist/chunk-yzn396hn.js +0 -89
  352. package/dist/chunk-z2dp53wn.js +0 -17
  353. package/dist/chunk-zay4xp4n.js +0 -251
  354. package/dist/chunk-zc8bwy57.js +0 -212
  355. package/dist/chunk-zhx88cfx.js +0 -97
  356. package/dist/chunk-zkh6f4ct.js +0 -385
  357. package/dist/chunk-zq56gcca.js +0 -206
  358. package/dist/chunk-zrkefd22.js +0 -490
  359. package/dist/chunk-zs5p0yq1.js +0 -1030
  360. package/dist/chunk-zxh62ved.js +0 -31
  361. package/dist/chunk-zzm33q8x.js +0 -8
  362. package/dist/cli.js +0 -220
@@ -14,6 +14,9 @@ function parseJsonRpc(line) {
14
14
  try {
15
15
  const obj = JSON.parse(line);
16
16
  if (obj && typeof obj === "object" && typeof obj.method === "string") {
17
+ if (typeof obj.params !== "object" || obj.params === null || Array.isArray(obj.params)) {
18
+ return null;
19
+ }
17
20
  return obj;
18
21
  }
19
22
  } catch {}
@@ -55,7 +58,11 @@ class SessionRouter {
55
58
  if (this.sessions.size >= this.maxSessions) {
56
59
  process.stderr.write(`[SessionRouter] Max sessions reached, evicting LRU session
57
60
  `);
58
- this.evictLRU();
61
+ const evicted = await this.evictLRU();
62
+ if (!evicted) {
63
+ process.stderr.write(`[SessionRouter] No idle session evictable (all busy), allowing ${this.sessions.size + 1} sessions
64
+ `);
65
+ }
59
66
  }
60
67
  process.stderr.write(`[SessionRouter] Creating worker for session: ${sessionKey}
61
68
  `);
@@ -68,7 +75,8 @@ class SessionRouter {
68
75
  sessionId: null,
69
76
  lastActive: new Date,
70
77
  created: new Date,
71
- destroyed: false
78
+ destroyed: false,
79
+ busy: false
72
80
  };
73
81
  worker.on("message", (msg) => {
74
82
  if (msg.type === "ready") {
@@ -80,11 +88,18 @@ class SessionRouter {
80
88
  this.pendingUpdate.get(sessionKey)?.resolve();
81
89
  this.pendingUpdate.delete(sessionKey);
82
90
  }
91
+ if (msg.type === "complete" || msg.type === "error" || msg.type === "updated") {
92
+ entry.busy = false;
93
+ }
83
94
  entry.lastActive = new Date;
84
95
  this.onWorkerMessage(sessionKey, msg);
85
96
  });
86
97
  worker.on("exit", (code) => {
87
98
  this.sessions.delete(sessionKey);
99
+ this.pendingReady.get(sessionKey)?.reject(new Error(`Worker exited with code ${code}`));
100
+ this.pendingReady.delete(sessionKey);
101
+ this.pendingUpdate.get(sessionKey)?.reject(new Error(`Worker exited with code ${code}`));
102
+ this.pendingUpdate.delete(sessionKey);
88
103
  if (!entry.destroyed) {
89
104
  process.stderr.write(`[SessionRouter] Worker exited unexpectedly for session: ${sessionKey}, code: ${code}
90
105
  `);
@@ -98,6 +113,10 @@ class SessionRouter {
98
113
  const errMsg = err instanceof Error ? err.message : String(err);
99
114
  process.stderr.write(`[SessionRouter] Worker thread error for session: ${sessionKey} - ${errMsg}
100
115
  `);
116
+ this.pendingReady.get(sessionKey)?.reject(new Error(`Worker thread error: ${errMsg}`));
117
+ this.pendingReady.delete(sessionKey);
118
+ this.pendingUpdate.get(sessionKey)?.reject(new Error(`Worker thread error: ${errMsg}`));
119
+ this.pendingUpdate.delete(sessionKey);
101
120
  this.onWorkerMessage(sessionKey, {
102
121
  type: "error",
103
122
  session_key: sessionKey,
@@ -117,6 +136,10 @@ class SessionRouter {
117
136
  if (!entry)
118
137
  throw new Error(`Session not found: ${sessionKey}`);
119
138
  entry.lastActive = new Date;
139
+ const msgType = msg.type;
140
+ if (msgType === "prompt" || msgType === "update") {
141
+ entry.busy = true;
142
+ }
120
143
  entry.worker.postMessage(msg);
121
144
  }
122
145
  async destroy(sessionKey) {
@@ -195,7 +218,7 @@ class SessionRouter {
195
218
  const now = Date.now();
196
219
  const toEvict = [];
197
220
  for (const [key, entry] of this.sessions) {
198
- if (this.pendingReady.has(key))
221
+ if (this.pendingReady.has(key) || entry.busy)
199
222
  continue;
200
223
  if (now - entry.lastActive.getTime() > this.idleTtlMs) {
201
224
  toEvict.push(key);
@@ -209,11 +232,11 @@ class SessionRouter {
209
232
  this.destroy(key).catch(() => {});
210
233
  }
211
234
  }
212
- evictLRU() {
235
+ async evictLRU() {
213
236
  let oldest = null;
214
237
  let oldestTime = Infinity;
215
238
  for (const [key, entry] of this.sessions) {
216
- if (this.pendingReady.has(key))
239
+ if (this.pendingReady.has(key) || entry.busy)
217
240
  continue;
218
241
  if (entry.lastActive.getTime() < oldestTime) {
219
242
  oldestTime = entry.lastActive.getTime();
@@ -223,16 +246,18 @@ class SessionRouter {
223
246
  if (oldest) {
224
247
  process.stderr.write(`[SessionRouter] Evicting LRU session: ${oldest}
225
248
  `);
226
- this.destroy(oldest).catch(() => {});
249
+ await this.destroy(oldest);
250
+ return true;
227
251
  }
252
+ return false;
228
253
  }
229
254
  }
230
255
 
231
256
  // src/entrypoints/gateway/index.ts
232
257
  var __dirname2 = dirname(fileURLToPath(import.meta.url));
233
258
  var WORKER_PATH = resolve(__dirname2, "worker.js");
234
- var outputBuffer = "";
235
- var drainResolve = null;
259
+ var outputQueue = "";
260
+ var outputBlocked = false;
236
261
  var MAX_OUTPUT_BUFFER_SIZE = 10 * 1024 * 1024;
237
262
  var lastWorkerErrors = new Map;
238
263
  function notify(msg) {
@@ -244,25 +269,34 @@ function notify(msg) {
244
269
  `);
245
270
  return;
246
271
  }
247
- if (outputBuffer.length + line.length > MAX_OUTPUT_BUFFER_SIZE) {
248
- process.stderr.write(`Output buffer overflow, dropping notification
272
+ if (outputQueue.length + line.length > MAX_OUTPUT_BUFFER_SIZE) {
273
+ process.stderr.write(`[Gateway] Output buffer overflow (${outputQueue.length + line.length} > ${MAX_OUTPUT_BUFFER_SIZE}), dropping ${msg.method}
249
274
  `);
275
+ const sessionKey = msg.params?.session_key;
276
+ if (sessionKey && msg.method !== "session.error") {
277
+ try {
278
+ outputQueue += writeJsonRpc({
279
+ method: "session.error",
280
+ params: { session_key: sessionKey, error: "Gateway output buffer overflow, message dropped" }
281
+ });
282
+ } catch {}
283
+ }
250
284
  return;
251
285
  }
252
- outputBuffer += line;
286
+ outputQueue += line;
253
287
  flushOutput();
254
288
  }
255
289
  function flushOutput() {
256
- if (!outputBuffer)
290
+ if (outputBlocked || !outputQueue)
257
291
  return;
258
- const canContinue = process.stdout.write(outputBuffer);
259
- outputBuffer = "";
260
- if (!canContinue && !drainResolve) {
261
- drainResolve = () => {
262
- drainResolve = null;
292
+ const canContinue = process.stdout.write(outputQueue);
293
+ outputQueue = "";
294
+ if (!canContinue) {
295
+ outputBlocked = true;
296
+ process.stdout.once("drain", () => {
297
+ outputBlocked = false;
263
298
  flushOutput();
264
- };
265
- process.stdout.once("drain", drainResolve);
299
+ });
266
300
  }
267
301
  }
268
302
  var router = new SessionRouter({
@@ -272,7 +306,19 @@ var router = new SessionRouter({
272
306
  case "ready":
273
307
  process.stderr.write(`[Gateway] Session ready: ${sessionKey}, sessionId: ${msg.session_id}
274
308
  `);
275
- notify({ method: "session.ready", params: { session_key: msg.session_key, session_id: msg.session_id, state_session_id: msg.state_session_id } });
309
+ if (msg.mcp_degraded?.length) {
310
+ process.stderr.write(`[Gateway] Session ready with degraded MCP servers: ${msg.mcp_degraded.join(", ")}
311
+ `);
312
+ }
313
+ notify({
314
+ method: "session.ready",
315
+ params: {
316
+ session_key: msg.session_key,
317
+ session_id: msg.session_id,
318
+ state_session_id: msg.state_session_id,
319
+ ...msg.mcp_degraded?.length ? { mcp_degraded: msg.mcp_degraded } : {}
320
+ }
321
+ });
276
322
  break;
277
323
  case "stream":
278
324
  notify({ method: "session.stream", params: { session_key: msg.session_key, data: msg.data } });
@@ -397,13 +443,43 @@ async function main() {
397
443
  const rl = createInterface({ input: process.stdin });
398
444
  for await (const line of rl) {
399
445
  if (line.length > 1024 * 1024) {
400
- process.stderr.write(`Line too long (${line.length} bytes), skipping
446
+ let sessionKey = "(unknown)";
447
+ try {
448
+ const obj = JSON.parse(line);
449
+ if (typeof obj?.params?.session_key === "string") {
450
+ sessionKey = obj.params.session_key;
451
+ }
452
+ } catch {}
453
+ process.stderr.write(`[Gateway] Line too long (${line.length} bytes), rejecting
401
454
  `);
455
+ notify({
456
+ method: "session.error",
457
+ params: { session_key: sessionKey, error: `Request line exceeds 1MB limit (${line.length} bytes) and was rejected` }
458
+ });
402
459
  continue;
403
460
  }
404
461
  const req = parseJsonRpc(line);
405
462
  if (req) {
406
- await handleRequest(req);
463
+ try {
464
+ await handleRequest(req);
465
+ } catch (err) {
466
+ const errMsg = err instanceof Error ? err.message : String(err);
467
+ const sessionKey = req.params?.session_key ?? "(unknown)";
468
+ process.stderr.write(`[Gateway] Request handler error (${req.method}): ${errMsg}
469
+ `);
470
+ notify({ method: "session.error", params: { session_key: sessionKey, error: `Handler error in ${req.method}: ${errMsg}` } });
471
+ }
472
+ } else if (line.trim()) {
473
+ try {
474
+ const obj = JSON.parse(line);
475
+ if (obj && typeof obj === "object" && typeof obj.method === "string") {
476
+ const sessionKey = typeof obj.params?.session_key === "string" ? obj.params.session_key : "(unknown)";
477
+ notify({
478
+ method: "session.error",
479
+ params: { session_key: sessionKey, error: `Invalid JSON-RPC request: params must be an object (method: ${obj.method})` }
480
+ });
481
+ }
482
+ } catch {}
407
483
  }
408
484
  }
409
485
  await router.destroyAll();
@@ -53934,7 +53934,7 @@ var init_auth = __esm(() => {
53934
53934
 
53935
53935
  // src/utils/userAgent.ts
53936
53936
  function getClaudeCodeUserAgent() {
53937
- return `claude-code/${"0.0.25"}`;
53937
+ return `claude-code/${"0.0.26"}`;
53938
53938
  }
53939
53939
 
53940
53940
  // src/utils/workloadContext.ts
@@ -53953,7 +53953,7 @@ function getUserAgent() {
53953
53953
  const clientApp = process.env.CLAUDE_AGENT_SDK_CLIENT_APP ? `, client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}` : "";
53954
53954
  const workload = getWorkload();
53955
53955
  const workloadSuffix = workload ? `, workload/${workload}` : "";
53956
- return `claude-cli/${"0.0.25"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
53956
+ return `claude-cli/${"0.0.26"} (${process.env.USER_TYPE}, ${process.env.CLAUDE_CODE_ENTRYPOINT ?? "cli"}${agentSdkVersion}${clientApp}${workloadSuffix})`;
53957
53957
  }
53958
53958
  function getMCPUserAgent() {
53959
53959
  const parts = [];
@@ -53967,7 +53967,7 @@ function getMCPUserAgent() {
53967
53967
  parts.push(`client-app/${process.env.CLAUDE_AGENT_SDK_CLIENT_APP}`);
53968
53968
  }
53969
53969
  const suffix = parts.length > 0 ? ` (${parts.join(", ")})` : "";
53970
- return `claude-code/${"0.0.25"}${suffix}`;
53970
+ return `claude-code/${"0.0.26"}${suffix}`;
53971
53971
  }
53972
53972
  function getWebFetchUserAgent() {
53973
53973
  return `Claude-User (${getClaudeCodeUserAgent()}; +https://support.anthropic.com/)`;
@@ -54041,7 +54041,7 @@ var init_user = __esm(() => {
54041
54041
  deviceId,
54042
54042
  sessionId: getSessionId(),
54043
54043
  email: getEmail(),
54044
- appVersion: "0.0.25",
54044
+ appVersion: "0.0.26",
54045
54045
  platform: getHostPlatformForAnalytics(),
54046
54046
  organizationUuid,
54047
54047
  accountUuid,
@@ -88407,7 +88407,7 @@ function getAttributionHeader(fingerprint) {
88407
88407
  if (baseUrl && !baseUrl.includes("anthropic.com")) {
88408
88408
  return "";
88409
88409
  }
88410
- const version2 = `${"0.0.25"}.${fingerprint}`;
88410
+ const version2 = `${"0.0.26"}.${fingerprint}`;
88411
88411
  const entrypoint = process.env.CLAUDE_CODE_ENTRYPOINT ?? "unknown";
88412
88412
  const cch = "";
88413
88413
  const workload = getWorkload();
@@ -116159,7 +116159,7 @@ var init_metadata = __esm(() => {
116159
116159
  COMPOUND_OPERATOR_REGEX = /\s*(?:&&|\|\||[;|])\s*/;
116160
116160
  WHITESPACE_REGEX = /\s+/;
116161
116161
  getVersionBase = memoize_default(() => {
116162
- const match = "0.0.25".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
116162
+ const match = "0.0.26".match(/^\d+\.\d+\.\d+(?:-[a-z]+)?/);
116163
116163
  return match ? match[0] : undefined;
116164
116164
  });
116165
116165
  buildEnvContext = memoize_default(async () => {
@@ -116199,9 +116199,9 @@ var init_metadata = __esm(() => {
116199
116199
  isGithubAction: isEnvTruthy(process.env.GITHUB_ACTIONS),
116200
116200
  isClaudeCodeAction: isEnvTruthy(process.env.CLAUDE_CODE_ACTION),
116201
116201
  isClaudeAiAuth: false,
116202
- version: "0.0.25",
116202
+ version: "0.0.26",
116203
116203
  versionBase: getVersionBase(),
116204
- buildTime: "2026-08-20T02:48:15.082Z",
116204
+ buildTime: "2026-08-28T09:09:40.635Z",
116205
116205
  deploymentEnvironment: env3.detectDeploymentEnvironment(),
116206
116206
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
116207
116207
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -268995,7 +268995,7 @@ function getTelemetryAttributes() {
268995
268995
  attributes["session.id"] = sessionId;
268996
268996
  }
268997
268997
  if (shouldIncludeAttribute("OTEL_METRICS_INCLUDE_VERSION")) {
268998
- attributes["app.version"] = "0.0.25";
268998
+ attributes["app.version"] = "0.0.26";
268999
268999
  }
269000
269000
  const oauthAccount = getOauthAccountInfo2();
269001
269001
  if (oauthAccount) {
@@ -311575,7 +311575,7 @@ function computeFingerprint(messageText, version2) {
311575
311575
  }
311576
311576
  function computeFingerprintFromMessages(messages) {
311577
311577
  const firstMessageText = extractFirstMessageText(messages);
311578
- return computeFingerprint(firstMessageText, "0.0.25");
311578
+ return computeFingerprint(firstMessageText, "0.0.26");
311579
311579
  }
311580
311580
  var FINGERPRINT_SALT = "59cf53e54c78";
311581
311581
  var init_fingerprint = () => {};
@@ -311764,7 +311764,7 @@ async function sideQuery(opts) {
311764
311764
  betas.push(STRUCTURED_OUTPUTS_BETA_HEADER);
311765
311765
  }
311766
311766
  const messageText = extractFirstUserMessageText(messages);
311767
- const fingerprint = computeFingerprint(messageText, "0.0.25");
311767
+ const fingerprint = computeFingerprint(messageText, "0.0.26");
311768
311768
  const attributionHeader = getAttributionHeader(fingerprint);
311769
311769
  const systemBlocks = [
311770
311770
  attributionHeader ? { type: "text", text: attributionHeader } : null,
@@ -313235,7 +313235,7 @@ async function setupSdkMcpClients(sdkMcpConfigs, sendMcpMessage) {
313235
313235
  const client2 = new Client({
313236
313236
  name: "claude-code",
313237
313237
  title: "Claude Code",
313238
- version: "0.0.25",
313238
+ version: "0.0.26",
313239
313239
  description: "Anthropic's agentic coding tool",
313240
313240
  websiteUrl: PRODUCT_URL
313241
313241
  }, {
@@ -313566,7 +313566,7 @@ var init_client7 = __esm(() => {
313566
313566
  const client2 = new Client({
313567
313567
  name: "claude-code",
313568
313568
  title: "Claude Code",
313569
- version: "0.0.25",
313569
+ version: "0.0.26",
313570
313570
  description: "Anthropic's agentic coding tool",
313571
313571
  websiteUrl: PRODUCT_URL
313572
313572
  }, {
@@ -392224,7 +392224,7 @@ function getAnthropicEnvMetadata() {
392224
392224
  function getBuildAgeMinutes() {
392225
392225
  if (false)
392226
392226
  ;
392227
- const buildTime = new Date("2026-08-20T02:48:15.082Z").getTime();
392227
+ const buildTime = new Date("2026-08-28T09:09:40.635Z").getTime();
392228
392228
  if (isNaN(buildTime))
392229
392229
  return;
392230
392230
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -394477,8 +394477,9 @@ function getBaseContextWindow(model) {
394477
394477
  return contextWindow;
394478
394478
  }
394479
394479
  function getEffectiveContextWindowSize(model) {
394480
- const reservedTokensForSummary = Math.min(getMaxOutputTokensForModel(model), MAX_OUTPUT_TOKENS_FOR_SUMMARY);
394481
- return getBaseContextWindow(model) - reservedTokensForSummary;
394480
+ const baseWindow = getBaseContextWindow(model);
394481
+ const reservedTokensForSummary = Math.min(getMaxOutputTokensForModel(model), MAX_OUTPUT_TOKENS_FOR_SUMMARY, Math.round(baseWindow * 0.1));
394482
+ return baseWindow - reservedTokensForSummary;
394482
394483
  }
394483
394484
  function getAutoCompactThreshold(model) {
394484
394485
  const baseWindow = getBaseContextWindow(model);
@@ -414324,7 +414325,7 @@ function Feedback({
414324
414325
  platform: env3.platform,
414325
414326
  gitRepo: envInfo.isGit,
414326
414327
  terminal: env3.terminal,
414327
- version: "0.0.25",
414328
+ version: "0.0.26",
414328
414329
  transcript: normalizeMessagesForAPI(messages),
414329
414330
  errors: sanitizedErrors,
414330
414331
  lastApiRequest: getLastAPIRequest(),
@@ -414509,7 +414510,7 @@ function Feedback({
414509
414510
  ", ",
414510
414511
  env3.terminal,
414511
414512
  ", v",
414512
- "0.0.25"
414513
+ "0.0.26"
414513
414514
  ]
414514
414515
  }, undefined, true, undefined, this)
414515
414516
  ]
@@ -414615,7 +414616,7 @@ ${sanitizedDescription}
414615
414616
  ` + `**Environment Info**
414616
414617
  ` + `- Platform: ${env3.platform}
414617
414618
  ` + `- Terminal: ${env3.terminal}
414618
- ` + `- Version: ${"0.0.25"}
414619
+ ` + `- Version: ${"0.0.26"}
414619
414620
  ` + `- Feedback ID: ${feedbackId}
414620
414621
  ` + `
414621
414622
  **Errors**
@@ -417581,7 +417582,7 @@ function detectLinuxGlobPatternWarnings() {
417581
417582
  }
417582
417583
  async function getDoctorDiagnostic() {
417583
417584
  const installationType = await getCurrentInstallationType();
417584
- const version2 = typeof MACRO !== "undefined" ? "0.0.25" : "unknown";
417585
+ const version2 = typeof MACRO !== "undefined" ? "0.0.26" : "unknown";
417585
417586
  const installationPath = await getInstallationPath();
417586
417587
  const invokedBinary = getInvokedBinary();
417587
417588
  const multipleInstallations = await detectMultipleInstallations();
@@ -418370,7 +418371,7 @@ function buildPrimarySection() {
418370
418371
  children: "/rename to add a name"
418371
418372
  }, undefined, false, undefined, this);
418372
418373
  return [
418373
- { label: "Version", value: "0.0.25" },
418374
+ { label: "Version", value: "0.0.26" },
418374
418375
  { label: "Session name", value: nameValue },
418375
418376
  { label: "Session ID", value: sessionId },
418376
418377
  { label: "cwd", value: getCwd() },
@@ -421451,7 +421452,7 @@ function Config({
421451
421452
  }
421452
421453
  }, undefined, false, undefined, this)
421453
421454
  }, undefined, false, undefined, this) : showSubmenu === "ChannelDowngrade" ? /* @__PURE__ */ jsx_dev_runtime173.jsxDEV(ChannelDowngradeDialog, {
421454
- currentVersion: "0.0.25",
421455
+ currentVersion: "0.0.26",
421455
421456
  onChoice: (choice) => {
421456
421457
  setShowSubmenu(null);
421457
421458
  setTabsHidden(false);
@@ -421463,7 +421464,7 @@ function Config({
421463
421464
  autoUpdatesChannel: "stable"
421464
421465
  };
421465
421466
  if (choice === "stay") {
421466
- newSettings.minimumVersion = "0.0.25";
421467
+ newSettings.minimumVersion = "0.0.26";
421467
421468
  }
421468
421469
  updateSettingsForSource("userSettings", newSettings);
421469
421470
  setSettingsData((prev) => ({
@@ -426778,7 +426779,7 @@ function HelpV2({ onClose, commands }) {
426778
426779
  color: "professionalBlue",
426779
426780
  children: [
426780
426781
  /* @__PURE__ */ jsx_dev_runtime199.jsxDEV(Tabs, {
426781
- title: process.env.USER_TYPE === "ant" ? "/help" : `Claude Code v${"0.0.25"}`,
426782
+ title: process.env.USER_TYPE === "ant" ? "/help" : `Claude Code v${"0.0.26"}`,
426782
426783
  color: "professionalBlue",
426783
426784
  defaultTab: "general",
426784
426785
  children: tabs
@@ -439196,7 +439197,7 @@ function getAllReleaseNotes(changelogContent = getStoredChangelogFromMemory()) {
439196
439197
  return [];
439197
439198
  }
439198
439199
  }
439199
- function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "0.0.25") {
439200
+ function checkForReleaseNotesSync(lastSeenVersion, currentVersion = "0.0.26") {
439200
439201
  if (process.env.USER_TYPE === "ant") {
439201
439202
  const changelog = "";
439202
439203
  if (changelog) {
@@ -441231,7 +441232,7 @@ function getRecentActivitySync() {
441231
441232
  return cachedActivity;
441232
441233
  }
441233
441234
  function getLogoDisplayData() {
441234
- const version2 = process.env.DEMO_VERSION ?? "0.0.25";
441235
+ const version2 = process.env.DEMO_VERSION ?? "0.0.26";
441235
441236
  const serverUrl = getDirectConnectServerUrl();
441236
441237
  const displayPath = process.env.DEMO_VERSION ? "/code/claude" : getDisplayPath(getCwd());
441237
441238
  const cwd2 = serverUrl ? `${displayPath} in ${serverUrl.replace(/^https?:\/\//, "")}` : displayPath;
@@ -442139,13 +442140,13 @@ function LogoV2() {
442139
442140
  const { hasReleaseNotes } = checkForReleaseNotesSync(config5.lastReleaseNotesSeen);
442140
442141
  import_react159.useEffect(() => {
442141
442142
  const currentConfig = getGlobalConfig();
442142
- if (currentConfig.lastReleaseNotesSeen === "0.0.25") {
442143
+ if (currentConfig.lastReleaseNotesSeen === "0.0.26") {
442143
442144
  return;
442144
442145
  }
442145
442146
  saveGlobalConfig((current) => {
442146
- if (current.lastReleaseNotesSeen === "0.0.25")
442147
+ if (current.lastReleaseNotesSeen === "0.0.26")
442147
442148
  return current;
442148
- return { ...current, lastReleaseNotesSeen: "0.0.25" };
442149
+ return { ...current, lastReleaseNotesSeen: "0.0.26" };
442149
442150
  });
442150
442151
  if (showOnboarding) {
442151
442152
  incrementProjectOnboardingSeenCount();
@@ -458857,7 +458858,7 @@ async function captureMemoryDiagnostics(trigger, dumpNumber = 0) {
458857
458858
  smapsRollup,
458858
458859
  platform: process.platform,
458859
458860
  nodeVersion: process.version,
458860
- ccVersion: "0.0.25"
458861
+ ccVersion: "0.0.26"
458861
458862
  };
458862
458863
  }
458863
458864
  async function performHeapDump(trigger = "manual", dumpNumber = 0) {
@@ -459119,7 +459120,7 @@ var init_bridge_kick = __esm(() => {
459119
459120
  var call54 = async () => {
459120
459121
  return {
459121
459122
  type: "text",
459122
- value: `${"0.0.25"} (built ${"2026-08-20T02:48:15.082Z"})`
459123
+ value: `${"0.0.26"} (built ${"2026-08-28T09:09:40.635Z"})`
459123
459124
  };
459124
459125
  }, version2, version_default;
459125
459126
  var init_version = __esm(() => {
@@ -466388,7 +466389,7 @@ function generateHtmlReport(data, insights) {
466388
466389
  </html>`;
466389
466390
  }
466390
466391
  function buildExportData(data, insights, facets, remoteStats) {
466391
- const version3 = typeof MACRO !== "undefined" ? "0.0.25" : "unknown";
466392
+ const version3 = typeof MACRO !== "undefined" ? "0.0.26" : "unknown";
466392
466393
  const remote_hosts_collected = remoteStats?.hosts.filter((h2) => h2.sessionCount > 0).map((h2) => h2.name);
466393
466394
  const facets_summary = {
466394
466395
  total: facets.size,
@@ -470515,7 +470516,7 @@ var init_sessionStorage = __esm(() => {
470515
470516
  init_settings2();
470516
470517
  init_slowOperations();
470517
470518
  init_uuid();
470518
- VERSION6 = typeof MACRO !== "undefined" ? "0.0.25" : "unknown";
470519
+ VERSION6 = typeof MACRO !== "undefined" ? "0.0.26" : "unknown";
470519
470520
  MAX_TOMBSTONE_REWRITE_BYTES = 50 * 1024 * 1024;
470520
470521
  SKIP_FIRST_PROMPT_PATTERN2 = /^(?:\s*<[a-z][\w-]*[\s>]|\[Request interrupted by user[^\]]*\])/;
470521
470522
  EPHEMERAL_PROGRESS_TYPES = new Set([
@@ -471709,7 +471710,7 @@ var init_filesystem = __esm(() => {
471709
471710
  });
471710
471711
  getBundledSkillsRoot = memoize_default(function getBundledSkillsRoot2() {
471711
471712
  const nonce = randomBytes16(16).toString("hex");
471712
- return join128(getClaudeTempDir(), "bundled-skills", "0.0.25", nonce);
471713
+ return join128(getClaudeTempDir(), "bundled-skills", "0.0.26", nonce);
471713
471714
  });
471714
471715
  getResolvedWorkingDirPaths = memoize_default(getPathsForPermissionCheck);
471715
471716
  });
@@ -481939,7 +481940,7 @@ function buildSystemInitMessage(inputs) {
481939
481940
  slash_commands: inputs.commands.filter((c6) => c6.userInvocable !== false).map((c6) => c6.name),
481940
481941
  apiKeySource: getAnthropicApiKeyWithSource().source,
481941
481942
  betas: getSdkBetas(),
481942
- claude_code_version: "0.0.25",
481943
+ claude_code_version: "0.0.26",
481943
481944
  output_style: outputStyle2,
481944
481945
  agents: inputs.agents.map((agent) => agent.agentType),
481945
481946
  skills: inputs.skills.filter((s) => s.userInvocable !== false).map((skill) => skill.name),
@@ -483412,6 +483413,8 @@ class Session {
483412
483413
  changes.push(`mcpClients: ${config5.mcpClients.length} clients`);
483413
483414
  }
483414
483415
  if (config5.additionalDirectories) {
483416
+ const { setAdditionalDirectoriesForClaudeMd: setAdditionalDirectoriesForClaudeMd2 } = await Promise.resolve().then(() => (init_state(), exports_state));
483417
+ setAdditionalDirectoriesForClaudeMd2(config5.additionalDirectories);
483415
483418
  changes.push(`additionalDirectories: ${config5.additionalDirectories.length} dirs`);
483416
483419
  }
483417
483420
  if (config5.env) {
@@ -483531,11 +483534,6 @@ class Session {
483531
483534
  getStateHistory() {
483532
483535
  return this.sm.history;
483533
483536
  }
483534
- static resume(sessionId, config5, permissionHandler) {
483535
- const session2 = new Session(config5 ?? {}, permissionHandler ?? {});
483536
- session2.sessionId = sessionId;
483537
- return session2;
483538
- }
483539
483537
  static async list(options) {
483540
483538
  const { listSessionsImpl: listSessionsImpl2 } = await Promise.resolve().then(() => (init_listSessionsImpl(), exports_listSessionsImpl));
483541
483539
  return listSessionsImpl2(options);
@@ -483548,6 +483546,7 @@ class Session {
483548
483546
  }
483549
483547
 
483550
483548
  // src/entrypoints/gateway/worker.ts
483549
+ init_envUtils();
483551
483550
  var config5 = workerData;
483552
483551
  var { sessionKey } = config5;
483553
483552
  var PERMISSION_TIMEOUT_MS = 60000;
@@ -483581,12 +483580,39 @@ async function connectMcpServers(mcpServers) {
483581
483580
  const { clients, tools: mcpTools } = await prefetchAllMcpResources2(mcpConfigs);
483582
483581
  return { clients, mcpTools };
483583
483582
  }
483583
+ var ANTHROPIC_PROVIDER_ENV_KEYS = [
483584
+ "ANTHROPIC_API_KEY",
483585
+ "ANTHROPIC_AUTH_TOKEN",
483586
+ "ANTHROPIC_BASE_URL",
483587
+ "ANTHROPIC_MODEL",
483588
+ "ANTHROPIC_DEFAULT_OPUS_MODEL",
483589
+ "ANTHROPIC_DEFAULT_SONNET_MODEL",
483590
+ "ANTHROPIC_DEFAULT_HAIKU_MODEL",
483591
+ "ANTHROPIC_CUSTOM_HEADERS"
483592
+ ];
483593
+ var OPENAI_PROVIDER_ENV_KEYS = [
483594
+ "CLAUDE_CODE_USE_OPENAI",
483595
+ "OPENAI_API_KEY",
483596
+ "OPENAI_BASE_URL",
483597
+ "OPENAI_MODEL",
483598
+ "OPENAI_DEFAULT_OPUS_MODEL",
483599
+ "OPENAI_DEFAULT_SONNET_MODEL",
483600
+ "OPENAI_DEFAULT_HAIKU_MODEL",
483601
+ "OPENAI_CUSTOM_HEADERS"
483602
+ ];
483603
+ function sanitizeProviderEnv() {
483604
+ const keysToRemove = isEnvTruthy(process.env.CLAUDE_CODE_USE_OPENAI) ? ANTHROPIC_PROVIDER_ENV_KEYS : OPENAI_PROVIDER_ENV_KEYS;
483605
+ for (const name of keysToRemove) {
483606
+ delete process.env[name];
483607
+ }
483608
+ }
483584
483609
  async function start() {
483585
483610
  process.stderr.write(`[Worker ${sessionKey}] Starting worker
483586
483611
  `);
483587
483612
  if (config5.env) {
483588
483613
  Object.assign(process.env, config5.env);
483589
483614
  }
483615
+ sanitizeProviderEnv();
483590
483616
  const { enableConfigs: enableConfigs2 } = await Promise.resolve().then(() => (init_config(), exports_config));
483591
483617
  enableConfigs2();
483592
483618
  let initialMessages;
@@ -483620,13 +483646,18 @@ async function start() {
483620
483646
  }
483621
483647
  let mcpClients = [];
483622
483648
  let initialMcpTools = [];
483649
+ let mcpDegraded;
483623
483650
  try {
483624
483651
  const result = await connectMcpServers(config5.session.mcpServers);
483625
483652
  mcpClients = result.clients;
483626
483653
  initialMcpTools = result.mcpTools;
483654
+ const failed = mcpClients.filter((c6) => c6.type === "failed").map((c6) => c6.name);
483655
+ if (failed.length > 0)
483656
+ mcpDegraded = failed;
483627
483657
  } catch (err2) {
483628
483658
  process.stderr.write(`[Worker ${sessionKey}] Initial MCP connection failed, continuing without MCP: ${err2 instanceof Error ? err2.message : String(err2)}
483629
483659
  `);
483660
+ mcpDegraded = Object.keys(config5.session.mcpServers ?? {});
483630
483661
  }
483631
483662
  const sessionExtraOptions = {};
483632
483663
  if (mcpClients.length > 0)
@@ -483671,7 +483702,8 @@ async function start() {
483671
483702
  type: "ready",
483672
483703
  session_key: sessionKey,
483673
483704
  session_id: session2.sessionId,
483674
- state_session_id: getSessionId3()
483705
+ state_session_id: getSessionId3(),
483706
+ ...mcpDegraded?.length ? { mcp_degraded: mcpDegraded } : {}
483675
483707
  });
483676
483708
  parentPort.on("message", (msg) => {
483677
483709
  switch (msg.type) {
@@ -483769,14 +483801,17 @@ async function handleUpdate(updateConfig2) {
483769
483801
  }
483770
483802
  logState("session.update starting");
483771
483803
  const changes = [];
483804
+ let newMcpClients = null;
483772
483805
  try {
483773
483806
  if (updateConfig2.env) {
483774
483807
  Object.assign(process.env, updateConfig2.env);
483808
+ sanitizeProviderEnv();
483775
483809
  changes.push("env");
483776
483810
  }
483777
483811
  const batchUpdate = {};
483778
483812
  if (updateConfig2.mcp_servers !== undefined) {
483779
483813
  const { clients, mcpTools } = await connectMcpServers(updateConfig2.mcp_servers);
483814
+ newMcpClients = clients;
483780
483815
  batchUpdate.mcpClients = clients;
483781
483816
  batchUpdate.mcpTools = mcpTools;
483782
483817
  changes.push(`mcpServers: ${clients.length} clients`);
@@ -483830,6 +483865,15 @@ async function handleUpdate(updateConfig2) {
483830
483865
  const errorMsg = err2 instanceof Error ? err2.message : String(err2);
483831
483866
  process.stderr.write(`[Worker ${sessionKey}] Update failed: ${errorMsg}
483832
483867
  `);
483868
+ if (newMcpClients) {
483869
+ for (const client2 of newMcpClients) {
483870
+ if (client2.type === "connected" && client2.cleanup) {
483871
+ try {
483872
+ await client2.cleanup();
483873
+ } catch {}
483874
+ }
483875
+ }
483876
+ }
483833
483877
  send({ type: "error", session_key: sessionKey, error: errorMsg });
483834
483878
  } finally {
483835
483879
  logState("update done");
@@ -483867,6 +483911,7 @@ start().catch((err2) => {
483867
483911
  session_key: sessionKey,
483868
483912
  error: err2 instanceof Error ? err2.message : String(err2)
483869
483913
  });
483914
+ setTimeout(() => process.exit(1), 100);
483870
483915
  });
483871
483916
  process.on("uncaughtException", (err2) => {
483872
483917
  const errorDetails = err2 instanceof Error ? err2.stack || err2.message : String(err2);