@opencode/core 0.0.0-beta-19275

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 (1228) hide show
  1. package/README.md +3 -0
  2. package/dist/account/sql.js +34 -0
  3. package/dist/agent.js +90 -0
  4. package/dist/aisdk-native.js +9 -0
  5. package/dist/aisdk.js +15 -0
  6. package/dist/app.js +18 -0
  7. package/dist/bus.js +92 -0
  8. package/dist/catalog.js +88 -0
  9. package/dist/chunks/worktree-047x8f8f.js +226 -0
  10. package/dist/chunks/worktree-062zp4xz.js +77 -0
  11. package/dist/chunks/worktree-0bc6jdbc.js +145 -0
  12. package/dist/chunks/worktree-0k40b2vq.js +211 -0
  13. package/dist/chunks/worktree-0khbs0qs.js +71 -0
  14. package/dist/chunks/worktree-0mesazry.js +4 -0
  15. package/dist/chunks/worktree-0paq2nw3.js +28 -0
  16. package/dist/chunks/worktree-0q0f95c6.js +37 -0
  17. package/dist/chunks/worktree-0qkdqm5v.js +12 -0
  18. package/dist/chunks/worktree-0tg2xvbt.js +198 -0
  19. package/dist/chunks/worktree-0zkw76rk.js +0 -0
  20. package/dist/chunks/worktree-10fngwpd.js +184 -0
  21. package/dist/chunks/worktree-11zk2b76.js +338 -0
  22. package/dist/chunks/worktree-120qrk2e.js +190 -0
  23. package/dist/chunks/worktree-13bmfrpk.js +114 -0
  24. package/dist/chunks/worktree-146a62k1.js +768 -0
  25. package/dist/chunks/worktree-16cax9zb.js +74 -0
  26. package/dist/chunks/worktree-17cy0kzp.js +17 -0
  27. package/dist/chunks/worktree-18bdr5q6.js +101 -0
  28. package/dist/chunks/worktree-1cgg357y.js +55 -0
  29. package/dist/chunks/worktree-1cnp2v09.js +25 -0
  30. package/dist/chunks/worktree-1dazxqgg.js +154 -0
  31. package/dist/chunks/worktree-1dfhrqqs.js +388 -0
  32. package/dist/chunks/worktree-1e9w7pgh.js +453 -0
  33. package/dist/chunks/worktree-1j00hnwg.js +38 -0
  34. package/dist/chunks/worktree-1jhga1v4.js +38 -0
  35. package/dist/chunks/worktree-1kg9ymc8.js +6 -0
  36. package/dist/chunks/worktree-1x11rq2a.js +18 -0
  37. package/dist/chunks/worktree-21r38tys.js +14 -0
  38. package/dist/chunks/worktree-2402vzrj.js +175 -0
  39. package/dist/chunks/worktree-249ffbnn.js +271 -0
  40. package/dist/chunks/worktree-255fqtq1.js +71 -0
  41. package/dist/chunks/worktree-26tj7vag.js +116 -0
  42. package/dist/chunks/worktree-2710q6r3.js +20 -0
  43. package/dist/chunks/worktree-2a4f6v5q.js +83 -0
  44. package/dist/chunks/worktree-2a5m3afh.js +36 -0
  45. package/dist/chunks/worktree-2axfhc9x.js +49 -0
  46. package/dist/chunks/worktree-2c3vjs8z.js +17 -0
  47. package/dist/chunks/worktree-2f04pwep.js +7 -0
  48. package/dist/chunks/worktree-2hcp0bjx.js +42 -0
  49. package/dist/chunks/worktree-2qnjyx3m.js +193 -0
  50. package/dist/chunks/worktree-2t421ajn.js +210 -0
  51. package/dist/chunks/worktree-2y34zzjz.js +21 -0
  52. package/dist/chunks/worktree-34gk67xh.js +61 -0
  53. package/dist/chunks/worktree-359p4xyc.js +25 -0
  54. package/dist/chunks/worktree-3asan66x.js +19 -0
  55. package/dist/chunks/worktree-3bgy0jaw.js +131 -0
  56. package/dist/chunks/worktree-3fc6dm20.js +151 -0
  57. package/dist/chunks/worktree-3hepkmqq.js +13 -0
  58. package/dist/chunks/worktree-3q1qkym4.js +247 -0
  59. package/dist/chunks/worktree-3qdzwhqx.js +184 -0
  60. package/dist/chunks/worktree-3smtnn6g.js +45 -0
  61. package/dist/chunks/worktree-3tvqynh2.js +14 -0
  62. package/dist/chunks/worktree-3v8g72cx.js +28 -0
  63. package/dist/chunks/worktree-3w5fmr99.js +214 -0
  64. package/dist/chunks/worktree-3wcehsnq.js +17 -0
  65. package/dist/chunks/worktree-410w4w39.js +381 -0
  66. package/dist/chunks/worktree-43n2bw4t.js +30 -0
  67. package/dist/chunks/worktree-44gvr517.js +123 -0
  68. package/dist/chunks/worktree-4knz6hnm.js +22 -0
  69. package/dist/chunks/worktree-4m55frd1.js +89 -0
  70. package/dist/chunks/worktree-4ph0a4gn.js +207 -0
  71. package/dist/chunks/worktree-4vfmzcq2.js +328 -0
  72. package/dist/chunks/worktree-4y7fprxs.js +22 -0
  73. package/dist/chunks/worktree-4zbdsexc.js +113 -0
  74. package/dist/chunks/worktree-52fpbh6z.js +31 -0
  75. package/dist/chunks/worktree-53557ph1.js +15 -0
  76. package/dist/chunks/worktree-550bvhaj.js +17 -0
  77. package/dist/chunks/worktree-567g6dh9.js +105 -0
  78. package/dist/chunks/worktree-56gdpj1q.js +64 -0
  79. package/dist/chunks/worktree-5c4hm403.js +114 -0
  80. package/dist/chunks/worktree-5daktx2q.js +50 -0
  81. package/dist/chunks/worktree-5g57spxg.js +481 -0
  82. package/dist/chunks/worktree-5jbb3qyd.js +22 -0
  83. package/dist/chunks/worktree-5k6pxcn0.js +194 -0
  84. package/dist/chunks/worktree-5t3nmthw.js +32 -0
  85. package/dist/chunks/worktree-5xgydngh.js +51 -0
  86. package/dist/chunks/worktree-5xw7cgsj.js +74 -0
  87. package/dist/chunks/worktree-5ycqwtsz.js +117 -0
  88. package/dist/chunks/worktree-608jf46e.js +462 -0
  89. package/dist/chunks/worktree-669tq793.js +15 -0
  90. package/dist/chunks/worktree-6jnybvqn.js +155 -0
  91. package/dist/chunks/worktree-6msgmcgs.js +75 -0
  92. package/dist/chunks/worktree-6pbkbdfq.js +158 -0
  93. package/dist/chunks/worktree-6prwharc.js +16 -0
  94. package/dist/chunks/worktree-6pxb6e41.js +201 -0
  95. package/dist/chunks/worktree-6rrtkcjf.js +35 -0
  96. package/dist/chunks/worktree-7003dbs4.js +279 -0
  97. package/dist/chunks/worktree-710w2ech.js +24 -0
  98. package/dist/chunks/worktree-71q4at8m.js +15 -0
  99. package/dist/chunks/worktree-76j77zm8.js +44 -0
  100. package/dist/chunks/worktree-7akdwqpd.js +16 -0
  101. package/dist/chunks/worktree-7bmhse3q.js +118 -0
  102. package/dist/chunks/worktree-7c3npc5w.js +335 -0
  103. package/dist/chunks/worktree-7hhzr64w.js +115 -0
  104. package/dist/chunks/worktree-7m9af43g.js +16 -0
  105. package/dist/chunks/worktree-7rtqyxd7.js +109 -0
  106. package/dist/chunks/worktree-7vcja736.js +121 -0
  107. package/dist/chunks/worktree-80aa9epv.js +41 -0
  108. package/dist/chunks/worktree-822emrt2.js +31 -0
  109. package/dist/chunks/worktree-85x45c9n.js +38 -0
  110. package/dist/chunks/worktree-88xbtdfr.js +14 -0
  111. package/dist/chunks/worktree-8d7r5vzw.js +106 -0
  112. package/dist/chunks/worktree-8mvsftc3.js +96 -0
  113. package/dist/chunks/worktree-8n3pysct.js +27 -0
  114. package/dist/chunks/worktree-8qk9tw02.js +35 -0
  115. package/dist/chunks/worktree-8qnjnss5.js +74 -0
  116. package/dist/chunks/worktree-8t34d1ka.js +201 -0
  117. package/dist/chunks/worktree-922hggd3.js +21 -0
  118. package/dist/chunks/worktree-923hzxn9.js +49 -0
  119. package/dist/chunks/worktree-97y4vk9t.js +228 -0
  120. package/dist/chunks/worktree-9a4afbnw.js +17 -0
  121. package/dist/chunks/worktree-9qn3qky1.js +164 -0
  122. package/dist/chunks/worktree-9rqn6x4v.js +16 -0
  123. package/dist/chunks/worktree-9w3hzb16.js +37 -0
  124. package/dist/chunks/worktree-a1tpkmh4.js +668 -0
  125. package/dist/chunks/worktree-a4r18kjz.js +341 -0
  126. package/dist/chunks/worktree-a6ftqyym.js +104 -0
  127. package/dist/chunks/worktree-a6k6eb26.js +105 -0
  128. package/dist/chunks/worktree-a8mtf1n7.js +282 -0
  129. package/dist/chunks/worktree-a9ab9jmj.js +97 -0
  130. package/dist/chunks/worktree-aaet6srn.js +170 -0
  131. package/dist/chunks/worktree-adeb4z1j.js +40 -0
  132. package/dist/chunks/worktree-af5trqkr.js +10 -0
  133. package/dist/chunks/worktree-afrmfg78.js +16 -0
  134. package/dist/chunks/worktree-amn7rrmc.js +151 -0
  135. package/dist/chunks/worktree-aqzs7mqg.js +13 -0
  136. package/dist/chunks/worktree-asseqh46.js +24 -0
  137. package/dist/chunks/worktree-atq7p7m5.js +35 -0
  138. package/dist/chunks/worktree-aw84nbjy.js +170 -0
  139. package/dist/chunks/worktree-b1x7x3xx.js +814 -0
  140. package/dist/chunks/worktree-b29mbqx6.js +185 -0
  141. package/dist/chunks/worktree-b6gygkdw.js +83 -0
  142. package/dist/chunks/worktree-bkyjaxrp.js +32 -0
  143. package/dist/chunks/worktree-bmr6ed5q.js +26 -0
  144. package/dist/chunks/worktree-c3w8vk9m.js +48 -0
  145. package/dist/chunks/worktree-c5gn303e.js +37 -0
  146. package/dist/chunks/worktree-ca7w653e.js +18 -0
  147. package/dist/chunks/worktree-cbmq2pzd.js +82 -0
  148. package/dist/chunks/worktree-ccrec4q8.js +190 -0
  149. package/dist/chunks/worktree-cf4snx6d.js +107 -0
  150. package/dist/chunks/worktree-cnd7bjr1.js +157 -0
  151. package/dist/chunks/worktree-cvy3z8tj.js +15 -0
  152. package/dist/chunks/worktree-cyhn230w.js +173 -0
  153. package/dist/chunks/worktree-d3p6gjbn.js +145 -0
  154. package/dist/chunks/worktree-d57x1pyx.js +137 -0
  155. package/dist/chunks/worktree-d6hfhc31.js +38 -0
  156. package/dist/chunks/worktree-d9fn303g.js +29 -0
  157. package/dist/chunks/worktree-d9jj8t3e.js +14 -0
  158. package/dist/chunks/worktree-dajrwvna.js +6 -0
  159. package/dist/chunks/worktree-dap0rakb.js +14 -0
  160. package/dist/chunks/worktree-df08tz66.js +13 -0
  161. package/dist/chunks/worktree-dj2t23y0.js +41 -0
  162. package/dist/chunks/worktree-dmvhv66c.js +105 -0
  163. package/dist/chunks/worktree-dvgvg99t.js +231 -0
  164. package/dist/chunks/worktree-dvh2p5hy.js +592 -0
  165. package/dist/chunks/worktree-dx2tycek.js +59 -0
  166. package/dist/chunks/worktree-dy18nga0.js +0 -0
  167. package/dist/chunks/worktree-e3fx731j.js +192 -0
  168. package/dist/chunks/worktree-e54b9byn.js +633 -0
  169. package/dist/chunks/worktree-e5kj55wp.js +13 -0
  170. package/dist/chunks/worktree-e73j6tqm.js +38 -0
  171. package/dist/chunks/worktree-ead3g9p8.js +69 -0
  172. package/dist/chunks/worktree-eaj1djv9.js +196 -0
  173. package/dist/chunks/worktree-ec1grn59.js +5 -0
  174. package/dist/chunks/worktree-ecj1wrg9.js +82 -0
  175. package/dist/chunks/worktree-edbbhmy9.js +36 -0
  176. package/dist/chunks/worktree-egz44y69.js +141 -0
  177. package/dist/chunks/worktree-eh3zwz77.js +31 -0
  178. package/dist/chunks/worktree-emrn6kk6.js +100 -0
  179. package/dist/chunks/worktree-emzfq4f9.js +260 -0
  180. package/dist/chunks/worktree-esam66tc.js +49 -0
  181. package/dist/chunks/worktree-etq0c3wd.js +65 -0
  182. package/dist/chunks/worktree-eynwqhf0.js +351 -0
  183. package/dist/chunks/worktree-ezy2bptn.js +49 -0
  184. package/dist/chunks/worktree-f0mxakyp.js +32 -0
  185. package/dist/chunks/worktree-f41x9hg9.js +88 -0
  186. package/dist/chunks/worktree-f6n9ztr4.js +58 -0
  187. package/dist/chunks/worktree-f8jtvgnz.js +179 -0
  188. package/dist/chunks/worktree-fa0cr6zp.js +51 -0
  189. package/dist/chunks/worktree-faypxj3z.js +11 -0
  190. package/dist/chunks/worktree-fd410y7t.js +13 -0
  191. package/dist/chunks/worktree-ffx4mq6v.js +32 -0
  192. package/dist/chunks/worktree-fjttjfbj.js +374 -0
  193. package/dist/chunks/worktree-fm2qvscf.js +21 -0
  194. package/dist/chunks/worktree-frwpyczr.js +77 -0
  195. package/dist/chunks/worktree-ftevhb49.js +470 -0
  196. package/dist/chunks/worktree-fvanntqq.js +84 -0
  197. package/dist/chunks/worktree-fvhg6c42.js +72 -0
  198. package/dist/chunks/worktree-fxbjtjnd.js +74 -0
  199. package/dist/chunks/worktree-fxgpk5d8.js +146 -0
  200. package/dist/chunks/worktree-g0he3e83.js +574 -0
  201. package/dist/chunks/worktree-g190xswt.js +41 -0
  202. package/dist/chunks/worktree-g4wezp1m.js +14 -0
  203. package/dist/chunks/worktree-g86h250q.js +17 -0
  204. package/dist/chunks/worktree-gbzh5ddg.js +75 -0
  205. package/dist/chunks/worktree-gd4qta3r.js +25 -0
  206. package/dist/chunks/worktree-gebd4c9n.js +77 -0
  207. package/dist/chunks/worktree-gftt206x.js +6 -0
  208. package/dist/chunks/worktree-gnx4ytbv.js +173 -0
  209. package/dist/chunks/worktree-h03wrkyp.js +492 -0
  210. package/dist/chunks/worktree-h3njrwgg.js +111 -0
  211. package/dist/chunks/worktree-h6vf3j39.js +14 -0
  212. package/dist/chunks/worktree-hcaepy0h.js +118 -0
  213. package/dist/chunks/worktree-hdnk95c8.js +18 -0
  214. package/dist/chunks/worktree-hed2586q.js +283 -0
  215. package/dist/chunks/worktree-hekpxy8z.js +31 -0
  216. package/dist/chunks/worktree-hjbc5kem.js +13 -0
  217. package/dist/chunks/worktree-hk9envan.js +25 -0
  218. package/dist/chunks/worktree-hrnqkpcd.js +20 -0
  219. package/dist/chunks/worktree-j0y65r11.js +43 -0
  220. package/dist/chunks/worktree-j2c7enbf.js +80 -0
  221. package/dist/chunks/worktree-j2ntwpah.js +28 -0
  222. package/dist/chunks/worktree-j56e64zr.js +40 -0
  223. package/dist/chunks/worktree-j5j8hrgx.js +119 -0
  224. package/dist/chunks/worktree-j5zkgpj8.js +226 -0
  225. package/dist/chunks/worktree-jgrg7y22.js +208 -0
  226. package/dist/chunks/worktree-jjc9qbmx.js +182 -0
  227. package/dist/chunks/worktree-jr7sbwjy.js +15 -0
  228. package/dist/chunks/worktree-jrra6jmc.js +42 -0
  229. package/dist/chunks/worktree-jvt1mp6m.js +93 -0
  230. package/dist/chunks/worktree-jwd18bs2.js +304 -0
  231. package/dist/chunks/worktree-jwfs4k6c.js +41 -0
  232. package/dist/chunks/worktree-jzg6c2d5.js +109 -0
  233. package/dist/chunks/worktree-k56d8zdx.js +294 -0
  234. package/dist/chunks/worktree-k65ezx0v.js +117 -0
  235. package/dist/chunks/worktree-k7d0894y.js +147 -0
  236. package/dist/chunks/worktree-k8wahcmx.js +33 -0
  237. package/dist/chunks/worktree-kbmmzrfa.js +32 -0
  238. package/dist/chunks/worktree-kg06axw8.js +162 -0
  239. package/dist/chunks/worktree-km7f0hwj.js +86 -0
  240. package/dist/chunks/worktree-kpf3cvbv.js +176 -0
  241. package/dist/chunks/worktree-kvezfmw3.js +138 -0
  242. package/dist/chunks/worktree-kxzh2p20.js +49 -0
  243. package/dist/chunks/worktree-m0jqrx5p.js +17 -0
  244. package/dist/chunks/worktree-m63snmdm.js +182 -0
  245. package/dist/chunks/worktree-m6vfy410.js +104 -0
  246. package/dist/chunks/worktree-m9hyszwm.js +341 -0
  247. package/dist/chunks/worktree-m9w0rfyh.js +123 -0
  248. package/dist/chunks/worktree-madgwgkk.js +56 -0
  249. package/dist/chunks/worktree-mfxgaa47.js +137 -0
  250. package/dist/chunks/worktree-mj1ykd8q.js +39 -0
  251. package/dist/chunks/worktree-mkcjrzeh.js +15 -0
  252. package/dist/chunks/worktree-mp448xyj.js +23 -0
  253. package/dist/chunks/worktree-mp9h7a8n.js +161 -0
  254. package/dist/chunks/worktree-msx8hqn2.js +14 -0
  255. package/dist/chunks/worktree-mvfsc1pv.js +264 -0
  256. package/dist/chunks/worktree-n05xt0ee.js +19 -0
  257. package/dist/chunks/worktree-n1s6t8b2.js +191 -0
  258. package/dist/chunks/worktree-n3j8tn72.js +13 -0
  259. package/dist/chunks/worktree-n679sgpe.js +1419 -0
  260. package/dist/chunks/worktree-neswnnnm.js +131 -0
  261. package/dist/chunks/worktree-nhy5jxhy.js +50 -0
  262. package/dist/chunks/worktree-njntx4h6.js +31 -0
  263. package/dist/chunks/worktree-nkn58an9.js +80 -0
  264. package/dist/chunks/worktree-nqyaavw9.js +341 -0
  265. package/dist/chunks/worktree-nrs7ag5n.js +287 -0
  266. package/dist/chunks/worktree-nsx3nvvw.js +63 -0
  267. package/dist/chunks/worktree-nze8c8vz.js +46 -0
  268. package/dist/chunks/worktree-nzwzy72p.js +81 -0
  269. package/dist/chunks/worktree-p0cja4mf.js +35 -0
  270. package/dist/chunks/worktree-p72z5xx6.js +64 -0
  271. package/dist/chunks/worktree-p9690q97.js +335 -0
  272. package/dist/chunks/worktree-paphc93g.js +9 -0
  273. package/dist/chunks/worktree-pcpv7kp0.js +140 -0
  274. package/dist/chunks/worktree-pjmw00w1.js +31 -0
  275. package/dist/chunks/worktree-pjvnvgmy.js +229 -0
  276. package/dist/chunks/worktree-pknna89w.js +18 -0
  277. package/dist/chunks/worktree-pr7ch8ks.js +76 -0
  278. package/dist/chunks/worktree-q18k77y0.js +156 -0
  279. package/dist/chunks/worktree-q3ac6zk1.js +121 -0
  280. package/dist/chunks/worktree-q3sfg36h.js +13 -0
  281. package/dist/chunks/worktree-q74kybfr.js +18 -0
  282. package/dist/chunks/worktree-qaymkmh1.js +14 -0
  283. package/dist/chunks/worktree-qb87gjwd.js +15 -0
  284. package/dist/chunks/worktree-qfa1cgps.js +8 -0
  285. package/dist/chunks/worktree-qgn6gcr1.js +16 -0
  286. package/dist/chunks/worktree-qn0ybd26.js +55 -0
  287. package/dist/chunks/worktree-qr42g2ex.js +148 -0
  288. package/dist/chunks/worktree-qrg20bc0.js +26 -0
  289. package/dist/chunks/worktree-qsdy395h.js +20 -0
  290. package/dist/chunks/worktree-qt1vhyrn.js +61 -0
  291. package/dist/chunks/worktree-qwyrfpbr.js +226 -0
  292. package/dist/chunks/worktree-r05k2dy1.js +61 -0
  293. package/dist/chunks/worktree-r82b328h.js +254 -0
  294. package/dist/chunks/worktree-r98e92ep.js +21 -0
  295. package/dist/chunks/worktree-rcb2kzg1.js +21 -0
  296. package/dist/chunks/worktree-rfnzy394.js +257 -0
  297. package/dist/chunks/worktree-rjbw5qw4.js +310 -0
  298. package/dist/chunks/worktree-rn1y5g26.js +163 -0
  299. package/dist/chunks/worktree-rp98wqty.js +326 -0
  300. package/dist/chunks/worktree-rqsgeg7f.js +148 -0
  301. package/dist/chunks/worktree-rxv654xr.js +114 -0
  302. package/dist/chunks/worktree-s4cjsff2.js +460 -0
  303. package/dist/chunks/worktree-s7xtjryh.js +28 -0
  304. package/dist/chunks/worktree-say7pt71.js +207 -0
  305. package/dist/chunks/worktree-sdm808jd.js +277 -0
  306. package/dist/chunks/worktree-sdp7kfr6.js +153 -0
  307. package/dist/chunks/worktree-seak0fhn.js +193 -0
  308. package/dist/chunks/worktree-sj6racd4.js +82 -0
  309. package/dist/chunks/worktree-sk3qaz4a.js +511 -0
  310. package/dist/chunks/worktree-skcgd3vv.js +190 -0
  311. package/dist/chunks/worktree-ssg3fenm.js +22 -0
  312. package/dist/chunks/worktree-sw2yvvap.js +317 -0
  313. package/dist/chunks/worktree-t0fxg8b9.js +34 -0
  314. package/dist/chunks/worktree-t2pd0szj.js +145 -0
  315. package/dist/chunks/worktree-t3vqhd9s.js +90 -0
  316. package/dist/chunks/worktree-t9e6e84n.js +32 -0
  317. package/dist/chunks/worktree-tazgh4e4.js +116 -0
  318. package/dist/chunks/worktree-tcezcvh9.js +63 -0
  319. package/dist/chunks/worktree-tdstcens.js +51 -0
  320. package/dist/chunks/worktree-th5km1p3.js +25 -0
  321. package/dist/chunks/worktree-tjsj89dc.js +54 -0
  322. package/dist/chunks/worktree-tm64n74p.js +272 -0
  323. package/dist/chunks/worktree-tvtrv512.js +51 -0
  324. package/dist/chunks/worktree-tvvzt9x6.js +603 -0
  325. package/dist/chunks/worktree-twg0f83k.js +261 -0
  326. package/dist/chunks/worktree-twy35tz0.js +53 -0
  327. package/dist/chunks/worktree-tzjcchbs.js +605 -0
  328. package/dist/chunks/worktree-v5yv7hbv.js +184 -0
  329. package/dist/chunks/worktree-vece14gy.js +329 -0
  330. package/dist/chunks/worktree-veqvce7d.js +15 -0
  331. package/dist/chunks/worktree-vkez6a4k.js +20 -0
  332. package/dist/chunks/worktree-vp47j2z8.js +170 -0
  333. package/dist/chunks/worktree-vq45zjjz.js +226 -0
  334. package/dist/chunks/worktree-vrm5r67w.js +544 -0
  335. package/dist/chunks/worktree-vvscj02x.js +96 -0
  336. package/dist/chunks/worktree-vzcthcp8.js +21 -0
  337. package/dist/chunks/worktree-w1k39n5e.js +55 -0
  338. package/dist/chunks/worktree-w2jjwenf.js +34 -0
  339. package/dist/chunks/worktree-w3wsvvr9.js +80 -0
  340. package/dist/chunks/worktree-w55j1d38.js +213 -0
  341. package/dist/chunks/worktree-w803qqfp.js +16 -0
  342. package/dist/chunks/worktree-wad31dta.js +604 -0
  343. package/dist/chunks/worktree-wbkyxrgf.js +98 -0
  344. package/dist/chunks/worktree-wd87259q.js +102 -0
  345. package/dist/chunks/worktree-wer8tq1h.js +13 -0
  346. package/dist/chunks/worktree-wg42tg3h.js +425 -0
  347. package/dist/chunks/worktree-wpdyyhk3.js +95 -0
  348. package/dist/chunks/worktree-wtztk69x.js +24 -0
  349. package/dist/chunks/worktree-x0ckcb58.js +54 -0
  350. package/dist/chunks/worktree-x1ezjp6w.js +39 -0
  351. package/dist/chunks/worktree-x1xcpfha.js +130 -0
  352. package/dist/chunks/worktree-x43y2vfs.js +263 -0
  353. package/dist/chunks/worktree-x61499pn.js +18 -0
  354. package/dist/chunks/worktree-xmc8nah8.js +69 -0
  355. package/dist/chunks/worktree-xrd4famk.js +35 -0
  356. package/dist/chunks/worktree-xwc0gsaj.js +197 -0
  357. package/dist/chunks/worktree-y1fvbwt7.js +19 -0
  358. package/dist/chunks/worktree-y44na4kk.js +19 -0
  359. package/dist/chunks/worktree-y5h7afh3.js +325 -0
  360. package/dist/chunks/worktree-y71avatq.js +31 -0
  361. package/dist/chunks/worktree-y8cydn3q.js +68 -0
  362. package/dist/chunks/worktree-yfjv9t1g.js +82 -0
  363. package/dist/chunks/worktree-ygaqb7jw.js +25 -0
  364. package/dist/chunks/worktree-ym463w8f.js +17 -0
  365. package/dist/chunks/worktree-yp2x3t23.js +92 -0
  366. package/dist/chunks/worktree-yrhqyw5v.js +15 -0
  367. package/dist/chunks/worktree-yrznvahk.js +60 -0
  368. package/dist/chunks/worktree-z0bkrqjs.js +15 -0
  369. package/dist/chunks/worktree-z0kan0ff.js +118 -0
  370. package/dist/chunks/worktree-z63w68vq.js +46 -0
  371. package/dist/chunks/worktree-z82wee6n.js +43 -0
  372. package/dist/chunks/worktree-z9919s4g.js +16 -0
  373. package/dist/chunks/worktree-zeh9ct20.js +29 -0
  374. package/dist/chunks/worktree-zf4nb4wp.js +272 -0
  375. package/dist/chunks/worktree-zjffjh2a.js +66 -0
  376. package/dist/chunks/worktree-zjhmce52.js +79 -0
  377. package/dist/chunks/worktree-zr2ceqn5.js +13 -0
  378. package/dist/chunks/worktree-zxgnc9zk.js +33 -0
  379. package/dist/chunks/worktree-zxq2ej10.js +34 -0
  380. package/dist/chunks/worktree-zycny061.js +128 -0
  381. package/dist/codemode/catalog.js +14 -0
  382. package/dist/codemode/instructions.js +14 -0
  383. package/dist/codemode/tool.js +11 -0
  384. package/dist/command.js +88 -0
  385. package/dist/config/discovery.js +86 -0
  386. package/dist/config/markdown.js +12 -0
  387. package/dist/config/normalize.js +26 -0
  388. package/dist/config/plugin/agent.js +120 -0
  389. package/dist/config/plugin/command.js +212 -0
  390. package/dist/config/plugin/compaction.js +160 -0
  391. package/dist/config/plugin/entry-observer.js +8 -0
  392. package/dist/config/plugin/formatter.js +122 -0
  393. package/dist/config/plugin/image.js +120 -0
  394. package/dist/config/plugin/instruction.js +90 -0
  395. package/dist/config/plugin/location-watcher.js +120 -0
  396. package/dist/config/plugin/mcp.js +131 -0
  397. package/dist/config/plugin/policy.js +119 -0
  398. package/dist/config/plugin/provider.js +118 -0
  399. package/dist/config/plugin/reference.js +122 -0
  400. package/dist/config/plugin/shell.js +121 -0
  401. package/dist/config/plugin/skill-file.js +104 -0
  402. package/dist/config/plugin/skill.js +139 -0
  403. package/dist/config/plugin/snapshot.js +120 -0
  404. package/dist/config/plugin/source.js +124 -0
  405. package/dist/config/plugin/tool-output.js +122 -0
  406. package/dist/config/plugin/websearch.js +118 -0
  407. package/dist/config/plugin/worktree.js +123 -0
  408. package/dist/config/variable.js +10 -0
  409. package/dist/config/watch.js +8 -0
  410. package/dist/config.js +130 -0
  411. package/dist/credential/sql.js +7 -0
  412. package/dist/credential.js +92 -0
  413. package/dist/database/database.js +83 -0
  414. package/dist/database/drizzle/effect-sqlite/driver.js +23 -0
  415. package/dist/database/drizzle/effect-sqlite/index.js +34 -0
  416. package/dist/database/drizzle/effect-sqlite/session.js +20 -0
  417. package/dist/database/drizzle/index.js +36 -0
  418. package/dist/database/drizzle/internal/drizzle-utils.js +20 -0
  419. package/dist/database/drizzle/sqlite-core/effect/count.js +6 -0
  420. package/dist/database/drizzle/sqlite-core/effect/db.js +14 -0
  421. package/dist/database/drizzle/sqlite-core/effect/delete.js +7 -0
  422. package/dist/database/drizzle/sqlite-core/effect/index.js +51 -0
  423. package/dist/database/drizzle/sqlite-core/effect/insert.js +9 -0
  424. package/dist/database/drizzle/sqlite-core/effect/query.js +8 -0
  425. package/dist/database/drizzle/sqlite-core/effect/raw.js +6 -0
  426. package/dist/database/drizzle/sqlite-core/effect/select.js +9 -0
  427. package/dist/database/drizzle/sqlite-core/effect/session.js +19 -0
  428. package/dist/database/drizzle/sqlite-core/effect/update.js +9 -0
  429. package/dist/database/drizzle.js +37 -0
  430. package/dist/database/migration/20260127222353_familiar_lady_ursula.js +6 -0
  431. package/dist/database/migration/20260211171708_add_project_commands.js +6 -0
  432. package/dist/database/migration/20260213144116_wakeful_the_professor.js +6 -0
  433. package/dist/database/migration/20260225215848_workspace.js +6 -0
  434. package/dist/database/migration/20260227213759_add_session_workspace_id.js +6 -0
  435. package/dist/database/migration/20260228203230_blue_harpoon.js +6 -0
  436. package/dist/database/migration/20260303231226_add_workspace_fields.js +6 -0
  437. package/dist/database/migration/20260309230000_move_org_to_state.js +6 -0
  438. package/dist/database/migration/20260312043431_session_message_cursor.js +6 -0
  439. package/dist/database/migration/20260323234822_events.js +6 -0
  440. package/dist/database/migration/20260410174513_workspace-name.js +6 -0
  441. package/dist/database/migration/20260413175956_chief_energizer.js +6 -0
  442. package/dist/database/migration/20260423070820_add_icon_url_override.js +6 -0
  443. package/dist/database/migration/20260427172553_slow_nightmare.js +6 -0
  444. package/dist/database/migration/20260428004200_add_session_path.js +6 -0
  445. package/dist/database/migration/20260501142318_next_venus.js +6 -0
  446. package/dist/database/migration/20260504145000_add_sync_owner.js +6 -0
  447. package/dist/database/migration/20260507164347_add_workspace_time.js +6 -0
  448. package/dist/database/migration/20260510033149_session_usage.js +6 -0
  449. package/dist/database/migration/20260511000411_data_migration_state.js +6 -0
  450. package/dist/database/migration/20260511173437_session-metadata.js +6 -0
  451. package/dist/database/migration/20260601010001_normalize_storage_paths.js +6 -0
  452. package/dist/database/migration/20260601202201_amazing_prowler.js +6 -0
  453. package/dist/database/migration/20260602002951_lowly_union_jack.js +6 -0
  454. package/dist/database/migration/20260602182828_add_project_directories.js +6 -0
  455. package/dist/database/migration/20260603001617_session_message_projection_indexes.js +6 -0
  456. package/dist/database/migration/20260603040000_session_message_projection_order.js +6 -0
  457. package/dist/database/migration/20260603141458_session_input_inbox.js +6 -0
  458. package/dist/database/migration/20260603160727_jittery_ezekiel_stane.js +6 -0
  459. package/dist/database/migration/20260604172448_event_sourced_session_input.js +6 -0
  460. package/dist/database/migration/20260605003541_add_session_context_snapshot.js +6 -0
  461. package/dist/database/migration/20260605042240_add_context_epoch_agent.js +6 -0
  462. package/dist/database/migration/20260611035744_credential.js +6 -0
  463. package/dist/database/migration/20260611192811_lush_chimera.js +6 -0
  464. package/dist/database/migration/20260612174303_project_dir_strategy.js +6 -0
  465. package/dist/database/migration/20260622142730_simplify_session_context_epoch.js +6 -0
  466. package/dist/database/migration/20260622170816_reset_v2_session_state.js +6 -0
  467. package/dist/database/migration/20260622202450_simplify_session_input.js +6 -0
  468. package/dist/database/migration/20260804233008_loose_psylocke.js +6 -0
  469. package/dist/database/migration/20260805200742_import_legacy_credentials.js +8 -0
  470. package/dist/database/migration/20260808023530_workspace_domain.js +6 -0
  471. package/dist/database/migration/20260811161259_execution_claim_attempts.js +6 -0
  472. package/dist/database/migration/20260812181746_session_inbox.js +6 -0
  473. package/dist/database/migration/20260812213948_worktree.js +6 -0
  474. package/dist/database/migration/20260819222447_session_viewed_state.js +6 -0
  475. package/dist/database/migration/20260823191254_nullable_workspace_binding.js +6 -0
  476. package/dist/database/migration.gen.js +52 -0
  477. package/dist/database/migration.js +58 -0
  478. package/dist/database/path.js +13 -0
  479. package/dist/database/schema.gen.js +6 -0
  480. package/dist/database/schema.sql.js +6 -0
  481. package/dist/database/sqlite.bun.js +79 -0
  482. package/dist/database/sqlite.js +12 -0
  483. package/dist/database/sqlite.node.js +75 -0
  484. package/dist/database/sqlite.workerd.js +108 -0
  485. package/dist/database/v1-migration.bun.js +795 -0
  486. package/dist/database/v1-migration.js +6 -0
  487. package/dist/database/v1-migration.noop.js +14 -0
  488. package/dist/effect/app-node-builder.js +390 -0
  489. package/dist/effect/app-node-platform.js +13 -0
  490. package/dist/effect/keyed-mutex.js +10 -0
  491. package/dist/effect/websocket-constructor.js +6 -0
  492. package/dist/environment/driver.js +12 -0
  493. package/dist/environment/environment.js +93 -0
  494. package/dist/environment/exec-defaults.js +9 -0
  495. package/dist/environment/files.js +16 -0
  496. package/dist/environment/index.js +113 -0
  497. package/dist/environment/local.js +9 -0
  498. package/dist/environment/memory.js +9 -0
  499. package/dist/environment/unavailable.js +25 -0
  500. package/dist/event/sql.js +8 -0
  501. package/dist/event-logger.js +95 -0
  502. package/dist/file-access.js +112 -0
  503. package/dist/file-mutation.js +98 -0
  504. package/dist/file-retention.js +8 -0
  505. package/dist/file.js +16 -0
  506. package/dist/filesystem/fff.bun.js +23 -0
  507. package/dist/filesystem/fff.js +6 -0
  508. package/dist/filesystem/fff.node.js +23 -0
  509. package/dist/filesystem/fff.workerd.js +22 -0
  510. package/dist/filesystem/ignore.js +58 -0
  511. package/dist/filesystem/location-watcher-policy.js +11 -0
  512. package/dist/filesystem/location-watcher.js +225 -0
  513. package/dist/filesystem/protected.js +12 -0
  514. package/dist/filesystem/search.js +108 -0
  515. package/dist/filesystem/watcher-binding.js +6 -0
  516. package/dist/filesystem/watcher.js +32 -0
  517. package/dist/filesystem.js +123 -0
  518. package/dist/form.js +111 -0
  519. package/dist/formatter/builtins.js +7 -0
  520. package/dist/formatter.js +87 -0
  521. package/dist/generate.js +98 -0
  522. package/dist/git.js +22 -0
  523. package/dist/github-copilot/chat/convert-to-openai-compatible-chat-messages.js +6 -0
  524. package/dist/github-copilot/chat/get-response-metadata.js +6 -0
  525. package/dist/github-copilot/chat/map-openai-compatible-finish-reason.js +6 -0
  526. package/dist/github-copilot/chat/openai-compatible-api-types.js +0 -0
  527. package/dist/github-copilot/chat/openai-compatible-chat-language-model.js +12 -0
  528. package/dist/github-copilot/chat/openai-compatible-chat-options.js +6 -0
  529. package/dist/github-copilot/chat/openai-compatible-metadata-extractor.js +0 -0
  530. package/dist/github-copilot/chat/openai-compatible-prepare-tools.js +6 -0
  531. package/dist/github-copilot/copilot-provider.js +65 -0
  532. package/dist/github-copilot/models.js +10 -0
  533. package/dist/github-copilot/openai-compatible-error.js +8 -0
  534. package/dist/github-copilot/responses/convert-to-openai-responses-input.js +6 -0
  535. package/dist/github-copilot/responses/map-openai-responses-finish-reason.js +6 -0
  536. package/dist/github-copilot/responses/openai-config.js +0 -0
  537. package/dist/github-copilot/responses/openai-error.js +8 -0
  538. package/dist/github-copilot/responses/openai-responses-api-types.js +0 -0
  539. package/dist/github-copilot/responses/openai-responses-language-model.js +15 -0
  540. package/dist/github-copilot/responses/openai-responses-prepare-tools.js +13 -0
  541. package/dist/github-copilot/responses/openai-responses-settings.js +0 -0
  542. package/dist/github-copilot/responses/tool/code-interpreter.js +14 -0
  543. package/dist/github-copilot/responses/tool/file-search.js +10 -0
  544. package/dist/github-copilot/responses/tool/image-generation.js +8 -0
  545. package/dist/github-copilot/responses/tool/web-search-preview.js +6 -0
  546. package/dist/github-copilot/responses/tool/web-search.js +6 -0
  547. package/dist/id/id.js +14 -0
  548. package/dist/image/photon-wasm.bun.js +6 -0
  549. package/dist/image/photon-wasm.node.js +6 -0
  550. package/dist/image/photon-wasm.workerd.js +5 -0
  551. package/dist/image/photon.js +93 -0
  552. package/dist/image.js +17 -0
  553. package/dist/instance/service.js +10 -0
  554. package/dist/instance.js +362 -0
  555. package/dist/instruction-discovery.js +90 -0
  556. package/dist/instructions/builtins.js +87 -0
  557. package/dist/instructions/index.js +42 -0
  558. package/dist/integration/connection.js +22 -0
  559. package/dist/integration.js +117 -0
  560. package/dist/job.js +82 -0
  561. package/dist/kv/sql.js +7 -0
  562. package/dist/kv.js +76 -0
  563. package/dist/location-activity.js +218 -0
  564. package/dist/location-mutation.js +113 -0
  565. package/dist/location-service-map.js +88 -0
  566. package/dist/location-services.js +357 -0
  567. package/dist/location.js +93 -0
  568. package/dist/mcp/client.js +365 -0
  569. package/dist/mcp/index.js +144 -0
  570. package/dist/mcp/instructions.js +125 -0
  571. package/dist/mcp/oauth.js +262 -0
  572. package/dist/mcp/stdio.js +92 -0
  573. package/dist/mime.js +8 -0
  574. package/dist/modal/models.js +10 -0
  575. package/dist/model-resolver.js +107 -0
  576. package/dist/model.js +29 -0
  577. package/dist/models-dev.js +95 -0
  578. package/dist/oauth/page.js +12 -0
  579. package/dist/permission/saved.js +87 -0
  580. package/dist/permission/sql.js +10 -0
  581. package/dist/permission.js +137 -0
  582. package/dist/persistent-pty/binary.bun.js +88 -0
  583. package/dist/persistent-pty/binary.node.js +7 -0
  584. package/dist/persistent-pty/binary.workerd.js +7 -0
  585. package/dist/persistent-pty/daemon.js +12 -0
  586. package/dist/persistent-pty/index.js +93 -0
  587. package/dist/persistent-pty/pty-binding.js +6 -0
  588. package/dist/persistent-pty.js +78 -0
  589. package/dist/plugin/agent.js +102 -0
  590. package/dist/plugin/command.js +99 -0
  591. package/dist/plugin/hooks.js +10 -0
  592. package/dist/plugin/host.js +224 -0
  593. package/dist/plugin/instance.js +12 -0
  594. package/dist/plugin/internal.js +332 -0
  595. package/dist/plugin/mcp-codemode-exclusion.js +8 -0
  596. package/dist/plugin/models-dev.js +80 -0
  597. package/dist/plugin/module.js +14 -0
  598. package/dist/plugin/optimize.js +21 -0
  599. package/dist/plugin/plan.js +102 -0
  600. package/dist/plugin/promise.js +8 -0
  601. package/dist/plugin/provider/alibaba.js +7 -0
  602. package/dist/plugin/provider/amazon-bedrock.js +7 -0
  603. package/dist/plugin/provider/anthropic.js +7 -0
  604. package/dist/plugin/provider/azure.js +123 -0
  605. package/dist/plugin/provider/cerebras.js +7 -0
  606. package/dist/plugin/provider/cloudflare-ai-gateway.js +122 -0
  607. package/dist/plugin/provider/cloudflare-workers-ai.js +122 -0
  608. package/dist/plugin/provider/cohere.js +7 -0
  609. package/dist/plugin/provider/configured.js +121 -0
  610. package/dist/plugin/provider/digitalocean.js +84 -0
  611. package/dist/plugin/provider/dynamic.js +7 -0
  612. package/dist/plugin/provider/factory.js +6 -0
  613. package/dist/plugin/provider/gateway.js +7 -0
  614. package/dist/plugin/provider/github-copilot.js +93 -0
  615. package/dist/plugin/provider/gitlab.js +8 -0
  616. package/dist/plugin/provider/google-vertex.js +7 -0
  617. package/dist/plugin/provider/kilo.js +7 -0
  618. package/dist/plugin/provider/llmgateway.js +81 -0
  619. package/dist/plugin/provider/lmstudio.js +122 -0
  620. package/dist/plugin/provider/mistral.js +7 -0
  621. package/dist/plugin/provider/modal.js +84 -0
  622. package/dist/plugin/provider/nvidia.js +7 -0
  623. package/dist/plugin/provider/ollama.js +122 -0
  624. package/dist/plugin/provider/openai-compatible.js +6 -0
  625. package/dist/plugin/provider/openai.js +83 -0
  626. package/dist/plugin/provider/opencode.js +81 -0
  627. package/dist/plugin/provider/openrouter.js +8 -0
  628. package/dist/plugin/provider/perplexity.js +7 -0
  629. package/dist/plugin/provider/sap-ai-core.js +8 -0
  630. package/dist/plugin/provider/sdk-factory.js +6 -0
  631. package/dist/plugin/provider/snowflake-cortex.js +9 -0
  632. package/dist/plugin/provider/venice.js +7 -0
  633. package/dist/plugin/provider/vercel.js +7 -0
  634. package/dist/plugin/provider/vllm.js +122 -0
  635. package/dist/plugin/provider/xai.js +82 -0
  636. package/dist/plugin/provider/zenmux.js +7 -0
  637. package/dist/plugin/provider.js +161 -0
  638. package/dist/plugin/sdk.js +81 -0
  639. package/dist/plugin/service.js +10 -0
  640. package/dist/plugin/skill.js +142 -0
  641. package/dist/plugin/source-directory.js +10 -0
  642. package/dist/plugin/supervisor.js +347 -0
  643. package/dist/plugin/update.js +11 -0
  644. package/dist/plugin/variant.js +11 -0
  645. package/dist/plugin/vcs/git.js +87 -0
  646. package/dist/plugin/vcs/hg.js +87 -0
  647. package/dist/plugin/warming.js +117 -0
  648. package/dist/plugin/websearch/exa.js +12 -0
  649. package/dist/plugin/websearch/firecrawl.js +13 -0
  650. package/dist/plugin/websearch/index.js +13 -0
  651. package/dist/plugin/websearch/mcp.js +13 -0
  652. package/dist/plugin/websearch/parallel.js +13 -0
  653. package/dist/plugin/websearch/tavily.js +11 -0
  654. package/dist/plugin.js +236 -0
  655. package/dist/project/schema.js +19 -0
  656. package/dist/project/sql.js +13 -0
  657. package/dist/project.js +98 -0
  658. package/dist/provider.js +30 -0
  659. package/dist/pty/protocol.js +45 -0
  660. package/dist/pty/pty.bun.js +39 -0
  661. package/dist/pty/pty.js +0 -0
  662. package/dist/pty/pty.node.js +28 -0
  663. package/dist/pty/pty.workerd.js +7 -0
  664. package/dist/pty/schema.js +6 -0
  665. package/dist/pty/ticket.js +49 -0
  666. package/dist/pty.js +103 -0
  667. package/dist/reference/instructions.js +87 -0
  668. package/dist/reference.js +95 -0
  669. package/dist/repository-cache.js +99 -0
  670. package/dist/repository.js +28 -0
  671. package/dist/ripgrep/binary.js +7 -0
  672. package/dist/ripgrep.js +100 -0
  673. package/dist/rpc.js +88 -0
  674. package/dist/schema.js +20 -0
  675. package/dist/session/command.js +79 -0
  676. package/dist/session/compaction.js +144 -0
  677. package/dist/session/context.js +152 -0
  678. package/dist/session/environment.js +10 -0
  679. package/dist/session/error.js +42 -0
  680. package/dist/session/event.js +6 -0
  681. package/dist/session/execution/restart.js +356 -0
  682. package/dist/session/execution.js +131 -0
  683. package/dist/session/generate.js +153 -0
  684. package/dist/session/history.js +30 -0
  685. package/dist/session/inbox.js +135 -0
  686. package/dist/session/info.js +8 -0
  687. package/dist/session/instruction-entry.js +94 -0
  688. package/dist/session/instruction-state.js +33 -0
  689. package/dist/session/instructions.js +97 -0
  690. package/dist/session/message-updater.js +9 -0
  691. package/dist/session/message.js +6 -0
  692. package/dist/session/model-request.js +124 -0
  693. package/dist/session/model-transport.js +16 -0
  694. package/dist/session/move.js +137 -0
  695. package/dist/session/projector.js +91 -0
  696. package/dist/session/prompt.js +107 -0
  697. package/dist/session/provider-context.js +20 -0
  698. package/dist/session/revert.js +99 -0
  699. package/dist/session/run-coordinator.js +8 -0
  700. package/dist/session/runner/index.js +10 -0
  701. package/dist/session/runner/llm.js +230 -0
  702. package/dist/session/runner/max-steps.js +6 -0
  703. package/dist/session/runner/model.js +105 -0
  704. package/dist/session/runner/publish-llm-event.js +8 -0
  705. package/dist/session/runner/retry.js +121 -0
  706. package/dist/session/runner/step.js +128 -0
  707. package/dist/session/runner/to-llm-message.js +7 -0
  708. package/dist/session/schema.js +10 -0
  709. package/dist/session/session.js +174 -0
  710. package/dist/session/shell.js +138 -0
  711. package/dist/session/skill.js +105 -0
  712. package/dist/session/sql.js +22 -0
  713. package/dist/session/stats.js +369 -0
  714. package/dist/session/store.js +90 -0
  715. package/dist/session/subagent-completion.js +12 -0
  716. package/dist/session/subagent-job.js +210 -0
  717. package/dist/session/system-prompt.js +10 -0
  718. package/dist/session/title.js +158 -0
  719. package/dist/session/to-session-error.js +112 -0
  720. package/dist/session/transfer.js +502 -0
  721. package/dist/session/usage.js +14 -0
  722. package/dist/session.js +255 -0
  723. package/dist/shell/parse.js +15 -0
  724. package/dist/shell/parser-wasm.bun.js +8 -0
  725. package/dist/shell/parser-wasm.node.js +11 -0
  726. package/dist/shell/parser-wasm.workerd.js +5 -0
  727. package/dist/shell/result.js +18 -0
  728. package/dist/shell/scan.js +1480 -0
  729. package/dist/shell/select.js +32 -0
  730. package/dist/shell.js +144 -0
  731. package/dist/skill/discovery.js +11 -0
  732. package/dist/skill/instructions.js +105 -0
  733. package/dist/skill.js +126 -0
  734. package/dist/snapshot.js +93 -0
  735. package/dist/state.js +18 -0
  736. package/dist/tool/html-markdown.js +8 -0
  737. package/dist/tool/http-body.js +6 -0
  738. package/dist/tool/mcp.js +128 -0
  739. package/dist/tool/plugin/edit.js +120 -0
  740. package/dist/tool/plugin/file-diff.js +6 -0
  741. package/dist/tool/plugin/glob.js +125 -0
  742. package/dist/tool/plugin/grep.js +125 -0
  743. package/dist/tool/plugin/opencode.js +12 -0
  744. package/dist/tool/plugin/patch.js +124 -0
  745. package/dist/tool/plugin/question.js +115 -0
  746. package/dist/tool/plugin/read.js +126 -0
  747. package/dist/tool/plugin/shell.js +217 -0
  748. package/dist/tool/plugin/skill.js +113 -0
  749. package/dist/tool/plugin/subagent.js +219 -0
  750. package/dist/tool/plugin/webfetch.js +121 -0
  751. package/dist/tool/plugin/websearch.js +114 -0
  752. package/dist/tool/plugin/write.js +122 -0
  753. package/dist/tool/read-filesystem.js +129 -0
  754. package/dist/tool/runtime.js +14 -0
  755. package/dist/tool-output.js +21 -0
  756. package/dist/tool.js +28 -0
  757. package/dist/types/account/sql.d.ts +325 -0
  758. package/dist/types/agent.d.ts +119 -0
  759. package/dist/types/aisdk-native.d.ts +14 -0
  760. package/dist/types/aisdk.d.ts +52 -0
  761. package/dist/types/app.d.ts +13 -0
  762. package/dist/types/bus.d.ts +101 -0
  763. package/dist/types/catalog.d.ts +49 -0
  764. package/dist/types/codemode/catalog.d.ts +47 -0
  765. package/dist/types/codemode/instructions.d.ts +6 -0
  766. package/dist/types/codemode/tool.d.ts +66 -0
  767. package/dist/types/command.d.ts +52 -0
  768. package/dist/types/config/discovery.d.ts +35 -0
  769. package/dist/types/config/markdown.d.ts +5 -0
  770. package/dist/types/config/normalize.d.ts +15 -0
  771. package/dist/types/config/plugin/agent.d.ts +5 -0
  772. package/dist/types/config/plugin/command.d.ts +9 -0
  773. package/dist/types/config/plugin/compaction.d.ts +4 -0
  774. package/dist/types/config/plugin/entry-observer.d.ts +7 -0
  775. package/dist/types/config/plugin/formatter.d.ts +9 -0
  776. package/dist/types/config/plugin/image.d.ts +4 -0
  777. package/dist/types/config/plugin/instruction.d.ts +7 -0
  778. package/dist/types/config/plugin/location-watcher.d.ts +4 -0
  779. package/dist/types/config/plugin/mcp.d.ts +8 -0
  780. package/dist/types/config/plugin/policy.d.ts +3 -0
  781. package/dist/types/config/plugin/provider.d.ts +3 -0
  782. package/dist/types/config/plugin/reference.d.ts +5 -0
  783. package/dist/types/config/plugin/shell.d.ts +4 -0
  784. package/dist/types/config/plugin/skill-file.d.ts +15 -0
  785. package/dist/types/config/plugin/skill.d.ts +8 -0
  786. package/dist/types/config/plugin/snapshot.d.ts +4 -0
  787. package/dist/types/config/plugin/source.d.ts +25 -0
  788. package/dist/types/config/plugin/tool-output.d.ts +4 -0
  789. package/dist/types/config/plugin/websearch.d.ts +3 -0
  790. package/dist/types/config/plugin/worktree.d.ts +6 -0
  791. package/dist/types/config/variable.d.ts +60 -0
  792. package/dist/types/config/watch.d.ts +11 -0
  793. package/dist/types/config.d.ts +45 -0
  794. package/dist/types/credential/sql.d.ts +169 -0
  795. package/dist/types/credential.d.ts +237 -0
  796. package/dist/types/database/database.d.ts +25 -0
  797. package/dist/types/database/drizzle/effect-sqlite/driver.d.ts +43 -0
  798. package/dist/types/database/drizzle/effect-sqlite/index.d.ts +3 -0
  799. package/dist/types/database/drizzle/effect-sqlite/session.d.ts +57 -0
  800. package/dist/types/database/drizzle/index.d.ts +4 -0
  801. package/dist/types/database/drizzle/internal/drizzle-utils.d.ts +21 -0
  802. package/dist/types/database/drizzle/sqlite-core/effect/count.d.ts +20 -0
  803. package/dist/types/database/drizzle/sqlite-core/effect/db.d.ts +77 -0
  804. package/dist/types/database/drizzle/sqlite-core/effect/delete.d.ts +69 -0
  805. package/dist/types/database/drizzle/sqlite-core/effect/index.d.ts +9 -0
  806. package/dist/types/database/drizzle/sqlite-core/effect/insert.d.ts +95 -0
  807. package/dist/types/database/drizzle/sqlite-core/effect/query.d.ts +63 -0
  808. package/dist/types/database/drizzle/sqlite-core/effect/raw.d.ts +32 -0
  809. package/dist/types/database/drizzle/sqlite-core/effect/select.d.ts +64 -0
  810. package/dist/types/database/drizzle/sqlite-core/effect/session.d.ts +82 -0
  811. package/dist/types/database/drizzle/sqlite-core/effect/update.d.ts +90 -0
  812. package/dist/types/database/drizzle.d.ts +1 -0
  813. package/dist/types/database/migration/20260127222353_familiar_lady_ursula.d.ts +3 -0
  814. package/dist/types/database/migration/20260211171708_add_project_commands.d.ts +3 -0
  815. package/dist/types/database/migration/20260213144116_wakeful_the_professor.d.ts +3 -0
  816. package/dist/types/database/migration/20260225215848_workspace.d.ts +3 -0
  817. package/dist/types/database/migration/20260227213759_add_session_workspace_id.d.ts +3 -0
  818. package/dist/types/database/migration/20260228203230_blue_harpoon.d.ts +3 -0
  819. package/dist/types/database/migration/20260303231226_add_workspace_fields.d.ts +3 -0
  820. package/dist/types/database/migration/20260309230000_move_org_to_state.d.ts +3 -0
  821. package/dist/types/database/migration/20260312043431_session_message_cursor.d.ts +3 -0
  822. package/dist/types/database/migration/20260323234822_events.d.ts +3 -0
  823. package/dist/types/database/migration/20260410174513_workspace-name.d.ts +3 -0
  824. package/dist/types/database/migration/20260413175956_chief_energizer.d.ts +3 -0
  825. package/dist/types/database/migration/20260423070820_add_icon_url_override.d.ts +3 -0
  826. package/dist/types/database/migration/20260427172553_slow_nightmare.d.ts +3 -0
  827. package/dist/types/database/migration/20260428004200_add_session_path.d.ts +3 -0
  828. package/dist/types/database/migration/20260501142318_next_venus.d.ts +3 -0
  829. package/dist/types/database/migration/20260504145000_add_sync_owner.d.ts +3 -0
  830. package/dist/types/database/migration/20260507164347_add_workspace_time.d.ts +3 -0
  831. package/dist/types/database/migration/20260510033149_session_usage.d.ts +3 -0
  832. package/dist/types/database/migration/20260511000411_data_migration_state.d.ts +3 -0
  833. package/dist/types/database/migration/20260511173437_session-metadata.d.ts +3 -0
  834. package/dist/types/database/migration/20260601010001_normalize_storage_paths.d.ts +3 -0
  835. package/dist/types/database/migration/20260601202201_amazing_prowler.d.ts +3 -0
  836. package/dist/types/database/migration/20260602002951_lowly_union_jack.d.ts +3 -0
  837. package/dist/types/database/migration/20260602182828_add_project_directories.d.ts +3 -0
  838. package/dist/types/database/migration/20260603001617_session_message_projection_indexes.d.ts +3 -0
  839. package/dist/types/database/migration/20260603040000_session_message_projection_order.d.ts +3 -0
  840. package/dist/types/database/migration/20260603141458_session_input_inbox.d.ts +3 -0
  841. package/dist/types/database/migration/20260603160727_jittery_ezekiel_stane.d.ts +3 -0
  842. package/dist/types/database/migration/20260604172448_event_sourced_session_input.d.ts +3 -0
  843. package/dist/types/database/migration/20260605003541_add_session_context_snapshot.d.ts +3 -0
  844. package/dist/types/database/migration/20260605042240_add_context_epoch_agent.d.ts +3 -0
  845. package/dist/types/database/migration/20260611035744_credential.d.ts +3 -0
  846. package/dist/types/database/migration/20260611192811_lush_chimera.d.ts +3 -0
  847. package/dist/types/database/migration/20260612174303_project_dir_strategy.d.ts +3 -0
  848. package/dist/types/database/migration/20260622142730_simplify_session_context_epoch.d.ts +3 -0
  849. package/dist/types/database/migration/20260622170816_reset_v2_session_state.d.ts +3 -0
  850. package/dist/types/database/migration/20260622202450_simplify_session_input.d.ts +3 -0
  851. package/dist/types/database/migration/20260804233008_loose_psylocke.d.ts +3 -0
  852. package/dist/types/database/migration/20260805200742_import_legacy_credentials.d.ts +5 -0
  853. package/dist/types/database/migration/20260808023530_workspace_domain.d.ts +3 -0
  854. package/dist/types/database/migration/20260811161259_execution_claim_attempts.d.ts +3 -0
  855. package/dist/types/database/migration/20260812181746_session_inbox.d.ts +3 -0
  856. package/dist/types/database/migration/20260812213948_worktree.d.ts +3 -0
  857. package/dist/types/database/migration/20260819222447_session_viewed_state.d.ts +3 -0
  858. package/dist/types/database/migration/20260823191254_nullable_workspace_binding.d.ts +3 -0
  859. package/dist/types/database/migration.d.ts +13 -0
  860. package/dist/types/database/migration.gen.d.ts +2 -0
  861. package/dist/types/database/path.d.ts +68 -0
  862. package/dist/types/database/schema.gen.d.ts +3 -0
  863. package/dist/types/database/schema.sql.d.ts +4 -0
  864. package/dist/types/database/sqlite.bun.d.ts +14 -0
  865. package/dist/types/database/sqlite.d.ts +20 -0
  866. package/dist/types/database/sqlite.node.d.ts +16 -0
  867. package/dist/types/database/sqlite.workerd.d.ts +29 -0
  868. package/dist/types/database/v1-migration.bun.d.ts +71 -0
  869. package/dist/types/database/v1-migration.d.ts +2 -0
  870. package/dist/types/database/v1-migration.noop.d.ts +11 -0
  871. package/dist/types/effect/app-node-builder.d.ts +4 -0
  872. package/dist/types/effect/app-node-platform.d.ts +6 -0
  873. package/dist/types/effect/keyed-mutex.d.ts +19 -0
  874. package/dist/types/effect/websocket-constructor.d.ts +8 -0
  875. package/dist/types/environment/driver.d.ts +7 -0
  876. package/dist/types/environment/environment.d.ts +12 -0
  877. package/dist/types/environment/exec-defaults.d.ts +4 -0
  878. package/dist/types/environment/files.d.ts +60 -0
  879. package/dist/types/environment/index.d.ts +10 -0
  880. package/dist/types/environment/local.d.ts +13 -0
  881. package/dist/types/environment/memory.d.ts +8 -0
  882. package/dist/types/environment/unavailable.d.ts +20 -0
  883. package/dist/types/event/sql.d.ts +158 -0
  884. package/dist/types/event-logger.d.ts +5 -0
  885. package/dist/types/file-access.d.ts +52 -0
  886. package/dist/types/file-mutation.d.ts +38 -0
  887. package/dist/types/file-retention.d.ts +4 -0
  888. package/dist/types/file.d.ts +9 -0
  889. package/dist/types/filesystem/fff.bun.d.ts +7 -0
  890. package/dist/types/filesystem/fff.d.ts +60 -0
  891. package/dist/types/filesystem/fff.node.d.ts +4 -0
  892. package/dist/types/filesystem/fff.workerd.d.ts +4 -0
  893. package/dist/types/filesystem/ignore.d.ts +2 -0
  894. package/dist/types/filesystem/location-watcher-policy.d.ts +15 -0
  895. package/dist/types/filesystem/location-watcher.d.ts +8 -0
  896. package/dist/types/filesystem/protected.d.ts +6 -0
  897. package/dist/types/filesystem/search.d.ts +20 -0
  898. package/dist/types/filesystem/watcher-binding.d.ts +1 -0
  899. package/dist/types/filesystem/watcher.d.ts +109 -0
  900. package/dist/types/filesystem.d.ts +133 -0
  901. package/dist/types/form.d.ts +449 -0
  902. package/dist/types/formatter/builtins.d.ts +18 -0
  903. package/dist/types/formatter.d.ts +15 -0
  904. package/dist/types/generate.d.ts +28 -0
  905. package/dist/types/git.d.ts +134 -0
  906. package/dist/types/github-copilot/chat/convert-to-openai-compatible-chat-messages.d.ts +3 -0
  907. package/dist/types/github-copilot/chat/get-response-metadata.d.ts +9 -0
  908. package/dist/types/github-copilot/chat/map-openai-compatible-finish-reason.d.ts +2 -0
  909. package/dist/types/github-copilot/chat/openai-compatible-api-types.d.ts +48 -0
  910. package/dist/types/github-copilot/chat/openai-compatible-chat-language-model.d.ts +135 -0
  911. package/dist/types/github-copilot/chat/openai-compatible-chat-options.d.ts +9 -0
  912. package/dist/types/github-copilot/chat/openai-compatible-metadata-extractor.d.ts +43 -0
  913. package/dist/types/github-copilot/chat/openai-compatible-prepare-tools.d.ts +21 -0
  914. package/dist/types/github-copilot/copilot-provider.d.ts +36 -0
  915. package/dist/types/github-copilot/models.d.ts +3 -0
  916. package/dist/types/github-copilot/openai-compatible-error.d.ts +16 -0
  917. package/dist/types/github-copilot/responses/convert-to-openai-responses-input.d.ts +18 -0
  918. package/dist/types/github-copilot/responses/map-openai-responses-finish-reason.d.ts +5 -0
  919. package/dist/types/github-copilot/responses/openai-config.d.ts +20 -0
  920. package/dist/types/github-copilot/responses/openai-error.d.ts +11 -0
  921. package/dist/types/github-copilot/responses/openai-responses-api-types.d.ts +165 -0
  922. package/dist/types/github-copilot/responses/openai-responses-language-model.d.ts +205 -0
  923. package/dist/types/github-copilot/responses/openai-responses-prepare-tools.d.ts +32 -0
  924. package/dist/types/github-copilot/responses/openai-responses-settings.d.ts +1 -0
  925. package/dist/types/github-copilot/responses/tool/code-interpreter.d.ts +86 -0
  926. package/dist/types/github-copilot/responses/tool/file-search.d.ts +95 -0
  927. package/dist/types/github-copilot/responses/tool/image-generation.d.ts +42 -0
  928. package/dist/types/github-copilot/responses/tool/web-search-preview.d.ts +15 -0
  929. package/dist/types/github-copilot/responses/tool/web-search.d.ts +18 -0
  930. package/dist/types/id/id.d.ts +19 -0
  931. package/dist/types/image/photon-wasm.bun.d.ts +2 -0
  932. package/dist/types/image/photon-wasm.node.d.ts +2 -0
  933. package/dist/types/image/photon-wasm.workerd.d.ts +2 -0
  934. package/dist/types/image/photon.d.ts +19 -0
  935. package/dist/types/image.d.ts +45 -0
  936. package/dist/types/instance/service.d.ts +14 -0
  937. package/dist/types/instance.d.ts +60 -0
  938. package/dist/types/instruction-discovery.d.ts +75 -0
  939. package/dist/types/instructions/builtins.d.ts +11 -0
  940. package/dist/types/instructions/index.d.ts +87 -0
  941. package/dist/types/integration/connection.d.ts +26 -0
  942. package/dist/types/integration.d.ts +1652 -0
  943. package/dist/types/job.d.ts +103 -0
  944. package/dist/types/kv/sql.d.ts +71 -0
  945. package/dist/types/kv.d.ts +26 -0
  946. package/dist/types/location-activity.d.ts +14 -0
  947. package/dist/types/location-mutation.d.ts +3 -0
  948. package/dist/types/location-service-map.d.ts +15 -0
  949. package/dist/types/location-services.d.ts +8 -0
  950. package/dist/types/location.d.ts +16 -0
  951. package/dist/types/mcp/client.d.ts +285 -0
  952. package/dist/types/mcp/index.d.ts +270 -0
  953. package/dist/types/mcp/instructions.d.ts +13 -0
  954. package/dist/types/mcp/oauth.d.ts +101 -0
  955. package/dist/types/mcp/stdio.d.ts +29 -0
  956. package/dist/types/mime.d.ts +2 -0
  957. package/dist/types/modal/models.d.ts +3 -0
  958. package/dist/types/model-resolver.d.ts +125 -0
  959. package/dist/types/model.d.ts +233 -0
  960. package/dist/types/models-dev.d.ts +34 -0
  961. package/dist/types/oauth/page.d.ts +15 -0
  962. package/dist/types/permission/saved.d.ts +40 -0
  963. package/dist/types/permission/sql.d.ts +103 -0
  964. package/dist/types/permission.d.ts +127 -0
  965. package/dist/types/persistent-pty/binary.bun.d.ts +1 -0
  966. package/dist/types/persistent-pty/binary.node.d.ts +1 -0
  967. package/dist/types/persistent-pty/binary.workerd.d.ts +1 -0
  968. package/dist/types/persistent-pty/daemon.d.ts +782 -0
  969. package/dist/types/persistent-pty/index.d.ts +84 -0
  970. package/dist/types/persistent-pty/pty-binding.d.ts +6 -0
  971. package/dist/types/persistent-pty.d.ts +1 -0
  972. package/dist/types/plugin/agent.d.ts +2 -0
  973. package/dist/types/plugin/command.d.ts +5 -0
  974. package/dist/types/plugin/hooks.d.ts +36 -0
  975. package/dist/types/plugin/host.d.ts +30 -0
  976. package/dist/types/plugin/instance.d.ts +24 -0
  977. package/dist/types/plugin/internal.d.ts +56 -0
  978. package/dist/types/plugin/mcp-codemode-exclusion.d.ts +2 -0
  979. package/dist/types/plugin/models-dev.d.ts +3 -0
  980. package/dist/types/plugin/module.d.ts +44 -0
  981. package/dist/types/plugin/optimize.d.ts +8 -0
  982. package/dist/types/plugin/plan.d.ts +3 -0
  983. package/dist/types/plugin/promise.d.ts +2 -0
  984. package/dist/types/plugin/provider/alibaba.d.ts +1 -0
  985. package/dist/types/plugin/provider/amazon-bedrock.d.ts +1 -0
  986. package/dist/types/plugin/provider/anthropic.d.ts +1 -0
  987. package/dist/types/plugin/provider/azure.d.ts +3 -0
  988. package/dist/types/plugin/provider/cerebras.d.ts +1 -0
  989. package/dist/types/plugin/provider/cloudflare-ai-gateway.d.ts +1 -0
  990. package/dist/types/plugin/provider/cloudflare-workers-ai.d.ts +1 -0
  991. package/dist/types/plugin/provider/cohere.d.ts +1 -0
  992. package/dist/types/plugin/provider/configured.d.ts +10 -0
  993. package/dist/types/plugin/provider/digitalocean.d.ts +3 -0
  994. package/dist/types/plugin/provider/dynamic.d.ts +2 -0
  995. package/dist/types/plugin/provider/factory.d.ts +6 -0
  996. package/dist/types/plugin/provider/gateway.d.ts +1 -0
  997. package/dist/types/plugin/provider/github-copilot.d.ts +14 -0
  998. package/dist/types/plugin/provider/gitlab.d.ts +1 -0
  999. package/dist/types/plugin/provider/google-vertex.d.ts +1 -0
  1000. package/dist/types/plugin/provider/kilo.d.ts +1 -0
  1001. package/dist/types/plugin/provider/llmgateway.d.ts +2 -0
  1002. package/dist/types/plugin/provider/lmstudio.d.ts +5 -0
  1003. package/dist/types/plugin/provider/mistral.d.ts +1 -0
  1004. package/dist/types/plugin/provider/modal.d.ts +3 -0
  1005. package/dist/types/plugin/provider/nvidia.d.ts +1 -0
  1006. package/dist/types/plugin/provider/ollama.d.ts +5 -0
  1007. package/dist/types/plugin/provider/openai-compatible.d.ts +1 -0
  1008. package/dist/types/plugin/provider/openai.d.ts +2 -0
  1009. package/dist/types/plugin/provider/opencode.d.ts +4 -0
  1010. package/dist/types/plugin/provider/openrouter.d.ts +1 -0
  1011. package/dist/types/plugin/provider/perplexity.d.ts +1 -0
  1012. package/dist/types/plugin/provider/sap-ai-core.d.ts +2 -0
  1013. package/dist/types/plugin/provider/sdk-factory.d.ts +3 -0
  1014. package/dist/types/plugin/provider/snowflake-cortex.d.ts +4 -0
  1015. package/dist/types/plugin/provider/venice.d.ts +1 -0
  1016. package/dist/types/plugin/provider/vercel.d.ts +1 -0
  1017. package/dist/types/plugin/provider/vllm.d.ts +5 -0
  1018. package/dist/types/plugin/provider/xai.d.ts +2 -0
  1019. package/dist/types/plugin/provider/zenmux.d.ts +1 -0
  1020. package/dist/types/plugin/provider.d.ts +2 -0
  1021. package/dist/types/plugin/sdk.d.ts +57 -0
  1022. package/dist/types/plugin/service.d.ts +32 -0
  1023. package/dist/types/plugin/skill.d.ts +6 -0
  1024. package/dist/types/plugin/source-directory.d.ts +5 -0
  1025. package/dist/types/plugin/supervisor.d.ts +10 -0
  1026. package/dist/types/plugin/update.d.ts +20 -0
  1027. package/dist/types/plugin/variant.d.ts +10 -0
  1028. package/dist/types/plugin/vcs/git.d.ts +4 -0
  1029. package/dist/types/plugin/vcs/hg.d.ts +5 -0
  1030. package/dist/types/plugin/warming.d.ts +4 -0
  1031. package/dist/types/plugin/websearch/exa.d.ts +5 -0
  1032. package/dist/types/plugin/websearch/firecrawl.d.ts +5 -0
  1033. package/dist/types/plugin/websearch/index.d.ts +1 -0
  1034. package/dist/types/plugin/websearch/mcp.d.ts +9 -0
  1035. package/dist/types/plugin/websearch/parallel.d.ts +5 -0
  1036. package/dist/types/plugin/websearch/tavily.d.ts +5 -0
  1037. package/dist/types/plugin.d.ts +8 -0
  1038. package/dist/types/project/schema.d.ts +247 -0
  1039. package/dist/types/project/sql.d.ts +300 -0
  1040. package/dist/types/project.d.ts +101 -0
  1041. package/dist/types/provider.d.ts +111 -0
  1042. package/dist/types/pty/protocol.d.ts +5 -0
  1043. package/dist/types/pty/pty.bun.d.ts +4 -0
  1044. package/dist/types/pty/pty.d.ts +22 -0
  1045. package/dist/types/pty/pty.node.d.ts +4 -0
  1046. package/dist/types/pty/pty.workerd.d.ts +3 -0
  1047. package/dist/types/pty/schema.d.ts +1 -0
  1048. package/dist/types/pty/ticket.d.ts +24 -0
  1049. package/dist/types/pty.d.ts +80 -0
  1050. package/dist/types/reference/instructions.d.ts +10 -0
  1051. package/dist/types/reference.d.ts +65 -0
  1052. package/dist/types/repository-cache.d.ts +72 -0
  1053. package/dist/types/repository.d.ts +50 -0
  1054. package/dist/types/ripgrep/binary.d.ts +11 -0
  1055. package/dist/types/ripgrep.d.ts +52 -0
  1056. package/dist/types/rpc.d.ts +15 -0
  1057. package/dist/types/schema.d.ts +45 -0
  1058. package/dist/types/session/command.d.ts +16 -0
  1059. package/dist/types/session/compaction.d.ts +64 -0
  1060. package/dist/types/session/context.d.ts +53 -0
  1061. package/dist/types/session/environment.d.ts +13 -0
  1062. package/dist/types/session/error.d.ts +171 -0
  1063. package/dist/types/session/event.d.ts +2 -0
  1064. package/dist/types/session/execution/restart.d.ts +48 -0
  1065. package/dist/types/session/execution.d.ts +56 -0
  1066. package/dist/types/session/generate.d.ts +15 -0
  1067. package/dist/types/session/history.d.ts +1546 -0
  1068. package/dist/types/session/inbox.d.ts +971 -0
  1069. package/dist/types/session/info.d.ts +3 -0
  1070. package/dist/types/session/instruction-entry.d.ts +52 -0
  1071. package/dist/types/session/instruction-state.d.ts +48 -0
  1072. package/dist/types/session/instructions.d.ts +15 -0
  1073. package/dist/types/session/message-updater.d.ts +18 -0
  1074. package/dist/types/session/message.d.ts +2 -0
  1075. package/dist/types/session/model-request.d.ts +87 -0
  1076. package/dist/types/session/model-transport.d.ts +16 -0
  1077. package/dist/types/session/move.d.ts +34 -0
  1078. package/dist/types/session/projector.d.ts +4 -0
  1079. package/dist/types/session/prompt.d.ts +66 -0
  1080. package/dist/types/session/provider-context.d.ts +46 -0
  1081. package/dist/types/session/revert.d.ts +27 -0
  1082. package/dist/types/session/run-coordinator.d.ts +47 -0
  1083. package/dist/types/session/runner/index.d.ts +81 -0
  1084. package/dist/types/session/runner/llm.d.ts +3 -0
  1085. package/dist/types/session/runner/max-steps.d.ts +1 -0
  1086. package/dist/types/session/runner/model.d.ts +61 -0
  1087. package/dist/types/session/runner/publish-llm-event.d.ts +74 -0
  1088. package/dist/types/session/runner/retry.d.ts +50 -0
  1089. package/dist/types/session/runner/step.d.ts +185 -0
  1090. package/dist/types/session/runner/to-llm-message.d.ts +5 -0
  1091. package/dist/types/session/schema.d.ts +181 -0
  1092. package/dist/types/session/session.d.ts +246 -0
  1093. package/dist/types/session/shell.d.ts +13 -0
  1094. package/dist/types/session/skill.d.ts +10 -0
  1095. package/dist/types/session/sql.d.ts +1194 -0
  1096. package/dist/types/session/stats.d.ts +82 -0
  1097. package/dist/types/session/store.d.ts +119 -0
  1098. package/dist/types/session/subagent-completion.d.ts +13 -0
  1099. package/dist/types/session/subagent-job.d.ts +13 -0
  1100. package/dist/types/session/system-prompt.d.ts +3 -0
  1101. package/dist/types/session/title.d.ts +17 -0
  1102. package/dist/types/session/to-session-error.d.ts +2 -0
  1103. package/dist/types/session/transfer.d.ts +869 -0
  1104. package/dist/types/session/usage.d.ts +13 -0
  1105. package/dist/types/session.d.ts +226 -0
  1106. package/dist/types/shell/parse.d.ts +13 -0
  1107. package/dist/types/shell/parser-wasm.bun.d.ts +5 -0
  1108. package/dist/types/shell/parser-wasm.node.d.ts +5 -0
  1109. package/dist/types/shell/parser-wasm.workerd.d.ts +5 -0
  1110. package/dist/types/shell/result.d.ts +54 -0
  1111. package/dist/types/shell/scan.d.ts +20 -0
  1112. package/dist/types/shell/select.d.ts +39 -0
  1113. package/dist/types/shell.d.ts +44 -0
  1114. package/dist/types/skill/discovery.d.ts +10 -0
  1115. package/dist/types/skill/instructions.d.ts +11 -0
  1116. package/dist/types/skill.d.ts +90 -0
  1117. package/dist/types/snapshot.d.ts +57 -0
  1118. package/dist/types/state.d.ts +73 -0
  1119. package/dist/types/tool/html-markdown.d.ts +2 -0
  1120. package/dist/types/tool/http-body.d.ts +3 -0
  1121. package/dist/types/tool/mcp.d.ts +20 -0
  1122. package/dist/types/tool/plugin/edit.d.ts +38 -0
  1123. package/dist/types/tool/plugin/file-diff.d.ts +2 -0
  1124. package/dist/types/tool/plugin/glob.d.ts +27 -0
  1125. package/dist/types/tool/plugin/grep.d.ts +39 -0
  1126. package/dist/types/tool/plugin/opencode.d.ts +21 -0
  1127. package/dist/types/tool/plugin/patch.d.ts +38 -0
  1128. package/dist/types/tool/plugin/question.d.ts +32 -0
  1129. package/dist/types/tool/plugin/read.d.ts +35 -0
  1130. package/dist/types/tool/plugin/shell.d.ts +23 -0
  1131. package/dist/types/tool/plugin/skill.d.ts +21 -0
  1132. package/dist/types/tool/plugin/subagent.d.ts +32 -0
  1133. package/dist/types/tool/plugin/webfetch.d.ts +22 -0
  1134. package/dist/types/tool/plugin/websearch.d.ts +16 -0
  1135. package/dist/types/tool/plugin/write.d.ts +32 -0
  1136. package/dist/types/tool/read-filesystem.d.ts +103 -0
  1137. package/dist/types/tool/runtime.d.ts +28 -0
  1138. package/dist/types/tool-output.d.ts +24 -0
  1139. package/dist/types/tool.d.ts +54 -0
  1140. package/dist/types/util/array.d.ts +1 -0
  1141. package/dist/types/util/error-summary.d.ts +7 -0
  1142. package/dist/types/util/error.d.ts +269 -0
  1143. package/dist/types/util/identifier.d.ts +1 -0
  1144. package/dist/types/util/iife.d.ts +1 -0
  1145. package/dist/types/util/lazy.d.ts +1 -0
  1146. package/dist/types/util/process-lock-ffi.bun.d.ts +12 -0
  1147. package/dist/types/util/process-lock-ffi.node.d.ts +12 -0
  1148. package/dist/types/util/process-lock-ffi.workerd.d.ts +12 -0
  1149. package/dist/types/util/process-lock.d.ts +20 -0
  1150. package/dist/types/util/slug.d.ts +3 -0
  1151. package/dist/types/util/token.d.ts +2 -0
  1152. package/dist/types/util/which.d.ts +1 -0
  1153. package/dist/types/util/wildcard.d.ts +2 -0
  1154. package/dist/types/v1/config/agent.d.ts +96 -0
  1155. package/dist/types/v1/config/attachment.d.ts +18 -0
  1156. package/dist/types/v1/config/command.d.ts +11 -0
  1157. package/dist/types/v1/config/config.d.ts +1243 -0
  1158. package/dist/types/v1/config/error.d.ts +1773 -0
  1159. package/dist/types/v1/config/formatter.d.ts +15 -0
  1160. package/dist/types/v1/config/layout.d.ts +4 -0
  1161. package/dist/types/v1/config/lsp.d.ts +38 -0
  1162. package/dist/types/v1/config/mcp.d.ts +56 -0
  1163. package/dist/types/v1/config/migrate.d.ts +442 -0
  1164. package/dist/types/v1/config/permission.d.ts +59 -0
  1165. package/dist/types/v1/config/plugin.d.ts +6 -0
  1166. package/dist/types/v1/config/provider-options.d.ts +11 -0
  1167. package/dist/types/v1/config/provider.d.ts +112 -0
  1168. package/dist/types/v1/config/server.d.ts +10 -0
  1169. package/dist/types/v1/config/skills.d.ts +7 -0
  1170. package/dist/types/v1/permission.d.ts +27 -0
  1171. package/dist/types/vcs/patch.d.ts +21 -0
  1172. package/dist/types/vcs.d.ts +34 -0
  1173. package/dist/types/websearch.d.ts +74 -0
  1174. package/dist/types/wellknown/plugin.d.ts +4 -0
  1175. package/dist/types/wellknown.d.ts +106 -0
  1176. package/dist/types/workspace/driver.d.ts +72 -0
  1177. package/dist/types/workspace/sql.d.ts +89 -0
  1178. package/dist/types/workspace.d.ts +61 -0
  1179. package/dist/types/worktree/directory.d.ts +9 -0
  1180. package/dist/types/worktree/git.d.ts +23 -0
  1181. package/dist/types/worktree/refresh.d.ts +2 -0
  1182. package/dist/types/worktree/sql.d.ts +71 -0
  1183. package/dist/types/worktree.d.ts +319 -0
  1184. package/dist/util/array.js +12 -0
  1185. package/dist/util/error-summary.js +8 -0
  1186. package/dist/util/error.js +6 -0
  1187. package/dist/util/identifier.js +5 -0
  1188. package/dist/util/iife.js +6 -0
  1189. package/dist/util/lazy.js +6 -0
  1190. package/dist/util/process-lock-ffi.bun.js +51 -0
  1191. package/dist/util/process-lock-ffi.node.js +44 -0
  1192. package/dist/util/process-lock-ffi.workerd.js +10 -0
  1193. package/dist/util/process-lock.js +121 -0
  1194. package/dist/util/slug.js +6 -0
  1195. package/dist/util/token.js +8 -0
  1196. package/dist/util/which.js +6 -0
  1197. package/dist/util/wildcard.js +8 -0
  1198. package/dist/v1/config/agent.js +10 -0
  1199. package/dist/v1/config/attachment.js +11 -0
  1200. package/dist/v1/config/command.js +8 -0
  1201. package/dist/v1/config/config.js +23 -0
  1202. package/dist/v1/config/error.js +17 -0
  1203. package/dist/v1/config/formatter.js +10 -0
  1204. package/dist/v1/config/layout.js +8 -0
  1205. package/dist/v1/config/lsp.js +16 -0
  1206. package/dist/v1/config/mcp.js +15 -0
  1207. package/dist/v1/config/migrate.js +23 -0
  1208. package/dist/v1/config/permission.js +14 -0
  1209. package/dist/v1/config/plugin.js +10 -0
  1210. package/dist/v1/config/provider-options.js +10 -0
  1211. package/dist/v1/config/provider.js +13 -0
  1212. package/dist/v1/config/server.js +9 -0
  1213. package/dist/v1/config/skills.js +8 -0
  1214. package/dist/v1/permission.js +51 -0
  1215. package/dist/vcs/patch.js +26 -0
  1216. package/dist/vcs.js +100 -0
  1217. package/dist/websearch.js +105 -0
  1218. package/dist/wellknown/plugin.js +79 -0
  1219. package/dist/wellknown.js +94 -0
  1220. package/dist/workspace/driver.js +22 -0
  1221. package/dist/workspace/sql.js +6 -0
  1222. package/dist/workspace.js +87 -0
  1223. package/dist/worktree/directory.js +11 -0
  1224. package/dist/worktree/git.js +12 -0
  1225. package/dist/worktree/refresh.js +346 -0
  1226. package/dist/worktree/sql.js +10 -0
  1227. package/dist/worktree.js +121 -0
  1228. package/package.json +154 -0
@@ -0,0 +1,795 @@
1
+ import {
2
+ exports_v1_migration
3
+ } from "../chunks/worktree-3tvqynh2.js";
4
+ import"../chunks/worktree-f0mxakyp.js";
5
+ import"../chunks/worktree-emrn6kk6.js";
6
+ import"../chunks/worktree-w3wsvvr9.js";
7
+ import"../chunks/worktree-7bmhse3q.js";
8
+ import"../chunks/worktree-cf4snx6d.js";
9
+ import"../chunks/worktree-822emrt2.js";
10
+ import"../chunks/worktree-wd87259q.js";
11
+ import"../chunks/worktree-m9w0rfyh.js";
12
+ import"../chunks/worktree-d57x1pyx.js";
13
+ import"../chunks/worktree-qwyrfpbr.js";
14
+ import"../chunks/worktree-zjhmce52.js";
15
+ import"../chunks/worktree-jrra6jmc.js";
16
+ import"../chunks/worktree-hekpxy8z.js";
17
+ import"../chunks/worktree-0zkw76rk.js";
18
+ import"../chunks/worktree-jzg6c2d5.js";
19
+ import"../chunks/worktree-q3sfg36h.js";
20
+ import"../chunks/worktree-1cnp2v09.js";
21
+ import"../chunks/worktree-rcb2kzg1.js";
22
+ import"../chunks/worktree-msx8hqn2.js";
23
+ import"../chunks/worktree-bkyjaxrp.js";
24
+ import"../chunks/worktree-g86h250q.js";
25
+ import"../chunks/worktree-jr7sbwjy.js";
26
+ import"../chunks/worktree-7m9af43g.js";
27
+ import"../chunks/worktree-j2ntwpah.js";
28
+ import"../chunks/worktree-njntx4h6.js";
29
+ import"../chunks/worktree-qrg20bc0.js";
30
+ import"../chunks/worktree-z9919s4g.js";
31
+ import"../chunks/worktree-43n2bw4t.js";
32
+ import"../chunks/worktree-n3j8tn72.js";
33
+ import"../chunks/worktree-d9jj8t3e.js";
34
+ import"../chunks/worktree-fd410y7t.js";
35
+ import"../chunks/worktree-e5kj55wp.js";
36
+ import"../chunks/worktree-f6n9ztr4.js";
37
+ import"../chunks/worktree-q74kybfr.js";
38
+ import"../chunks/worktree-53557ph1.js";
39
+ import"../chunks/worktree-7akdwqpd.js";
40
+ import"../chunks/worktree-wer8tq1h.js";
41
+ import"../chunks/worktree-wtztk69x.js";
42
+ import"../chunks/worktree-ssg3fenm.js";
43
+ import"../chunks/worktree-2c3vjs8z.js";
44
+ import"../chunks/worktree-17cy0kzp.js";
45
+ import"../chunks/worktree-hk9envan.js";
46
+ import"../chunks/worktree-w803qqfp.js";
47
+ import"../chunks/worktree-jwfs4k6c.js";
48
+ import"../chunks/worktree-mp448xyj.js";
49
+ import"../chunks/worktree-aqzs7mqg.js";
50
+ import"../chunks/worktree-ygaqb7jw.js";
51
+ import"../chunks/worktree-8n3pysct.js";
52
+ import"../chunks/worktree-d9fn303g.js";
53
+ import"../chunks/worktree-cvy3z8tj.js";
54
+ import"../chunks/worktree-9a4afbnw.js";
55
+ import"../chunks/worktree-n05xt0ee.js";
56
+ import"../chunks/worktree-sdp7kfr6.js";
57
+ import"../chunks/worktree-a6k6eb26.js";
58
+ import"../chunks/worktree-4knz6hnm.js";
59
+ import"../chunks/worktree-df08tz66.js";
60
+ import"../chunks/worktree-bmr6ed5q.js";
61
+ import"../chunks/worktree-atq7p7m5.js";
62
+ import"../chunks/worktree-qb87gjwd.js";
63
+ import"../chunks/worktree-359p4xyc.js";
64
+ import"../chunks/worktree-120qrk2e.js";
65
+ import"../chunks/worktree-twg0f83k.js";
66
+ import"../chunks/worktree-a6ftqyym.js";
67
+ import {
68
+ Service80
69
+ } from "../chunks/worktree-ecj1wrg9.js";
70
+ import"../chunks/worktree-922hggd3.js";
71
+ import"../chunks/worktree-6msgmcgs.js";
72
+ import"../chunks/worktree-qfa1cgps.js";
73
+ import"../chunks/worktree-dj2t23y0.js";
74
+ import {
75
+ SessionTable2,
76
+ SessionMessageTable2
77
+ } from "../chunks/worktree-5c4hm403.js";
78
+ import {
79
+ SessionMessage2
80
+ } from "../chunks/worktree-gftt206x.js";
81
+ import {
82
+ SessionSchema2
83
+ } from "../chunks/worktree-2f04pwep.js";
84
+ import {
85
+ KVTable2
86
+ } from "../chunks/worktree-3hepkmqq.js";
87
+ import {
88
+ EventSequenceTable2
89
+ } from "../chunks/worktree-2710q6r3.js";
90
+
91
+ // src/database/v1-migration.bun.ts
92
+ import { Cause, Effect, Layer, Option, Schema, Semaphore } from "effect";
93
+ import { SessionV1 } from "@opencode/schema/session-v1";
94
+ import { eq, sql } from "drizzle-orm";
95
+ import { Global } from "@opencode/util/global";
96
+ import { existsSync } from "node:fs";
97
+ import path from "node:path";
98
+ import { Project } from "@opencode/schema/project";
99
+ var NEXT_PROJECT_COLUMNS = {
100
+ id: "required",
101
+ worktree: "required",
102
+ vcs: "nullable",
103
+ name: "nullable",
104
+ icon_url: "nullable",
105
+ icon_url_override: { fallback: "icon_url" },
106
+ icon_color: "nullable",
107
+ time_created: "required",
108
+ time_updated: "required",
109
+ time_initialized: "nullable",
110
+ sandboxes: "required",
111
+ commands: "nullable"
112
+ };
113
+ var NEXT_SESSION_COLUMNS = {
114
+ id: "required",
115
+ project_id: "required",
116
+ workspace_id: "nullable",
117
+ parent_id: "nullable",
118
+ fork_session_id: "nullable",
119
+ fork_boundary: "nullable",
120
+ slug: "required",
121
+ directory: "required",
122
+ path: "nullable",
123
+ title: "nullable",
124
+ version: "required",
125
+ share_url: "nullable",
126
+ summary_additions: "nullable",
127
+ summary_deletions: "nullable",
128
+ summary_files: "nullable",
129
+ summary_diffs: "nullable",
130
+ metadata: "nullable",
131
+ cost: "required",
132
+ tokens_input: "required",
133
+ tokens_output: "required",
134
+ tokens_reasoning: "required",
135
+ tokens_cache_read: "required",
136
+ tokens_cache_write: "required",
137
+ revert: "nullable",
138
+ permission: "nullable",
139
+ agent: "nullable",
140
+ model: "nullable",
141
+ time_created: "required",
142
+ time_updated: "required",
143
+ time_compacting: "nullable",
144
+ time_archived: "nullable",
145
+ time_suspended: "nullable"
146
+ };
147
+ var lock = Semaphore.makeUnsafe(1);
148
+ var MIGRATION_STATE_KEY = "migration.v1-v2";
149
+ var EVENT_DELETE_BATCH_SIZE = 1000;
150
+ var decodeJson = Schema.decodeUnknownOption(Schema.fromJsonString(Schema.Unknown));
151
+ var decodeMessage = Schema.decodeUnknownOption(SessionV1.Info);
152
+ var decodePart = Schema.decodeUnknownOption(SessionV1.Part);
153
+ var runtimeState = { status: "idle" };
154
+ function transformSession(input) {
155
+ const warnings = [];
156
+ const messages = input.messages.map((row) => {
157
+ const value = Option.getOrUndefined(decodeJson(row.data));
158
+ const decoded = value && typeof value === "object" ? Option.getOrUndefined(decodeMessage({ ...value, id: row.id, sessionID: row.session_id })) : undefined;
159
+ if (decoded)
160
+ return { row, value: decoded };
161
+ warnings.push({ reason: "invalid-message", sessionID: input.session.id, messageID: row.id });
162
+ return;
163
+ }).filter((item) => item !== undefined).sort((a, b) => a.row.time_created - b.row.time_created || a.row.id.localeCompare(b.row.id));
164
+ const messageIDs = new Set(input.messages.map((row) => row.id));
165
+ const parts = input.parts.map((row) => {
166
+ const value = Option.getOrUndefined(decodeJson(row.data));
167
+ const observedType = value && typeof value === "object" && "type" in value ? String(value.type) : undefined;
168
+ if (!messageIDs.has(row.message_id)) {
169
+ warnings.push({
170
+ reason: "orphan-part",
171
+ sessionID: input.session.id,
172
+ messageID: row.message_id,
173
+ partID: row.id,
174
+ observedType
175
+ });
176
+ return;
177
+ }
178
+ const decoded = value && typeof value === "object" ? Option.getOrUndefined(decodePart({ ...value, id: row.id, messageID: row.message_id, sessionID: row.session_id })) : undefined;
179
+ if (decoded)
180
+ return { row, value: decoded };
181
+ warnings.push({
182
+ reason: "invalid-part",
183
+ sessionID: input.session.id,
184
+ messageID: row.message_id,
185
+ partID: row.id,
186
+ observedType
187
+ });
188
+ return;
189
+ }).filter((item) => item !== undefined).sort((a, b) => a.row.id.localeCompare(b.row.id));
190
+ const byMessage = Map.groupBy(parts, (item) => item.row.message_id);
191
+ const paired = new Set;
192
+ const used = new Set(messages.map((item) => item.row.id));
193
+ const projected = messages.flatMap((item) => {
194
+ if (paired.has(item.row.id))
195
+ return [];
196
+ const owned = byMessage.get(item.row.id)?.map((part) => part.value) ?? [];
197
+ if (item.value.role === "user") {
198
+ const compaction = owned.find((part) => part.type === "compaction");
199
+ if (compaction) {
200
+ const pairedSummary = messages.find((candidate) => candidate.value.role === "assistant" && candidate.value.parentID === item.row.id && candidate.value.summary === true);
201
+ if (!pairedSummary)
202
+ return [];
203
+ paired.add(pairedSummary.row.id);
204
+ if (pairedSummary.value.error || pairedSummary.value.time.completed === undefined)
205
+ return [];
206
+ const summary = pairedSummary;
207
+ const summaryText = (byMessage.get(summary.row.id) ?? []).map((part) => part.value).filter((part) => part.type === "text" && part.text.length > 0).map((part) => part.text).join(`
208
+
209
+ `);
210
+ const tailIndex = compaction.tail_start_id ? messages.findIndex((candidate) => candidate.row.id === compaction.tail_start_id) : -1;
211
+ const compactionIndex = messages.findIndex((candidate) => candidate.row.id === item.row.id);
212
+ const tail = tailIndex < 0 ? [] : messages.slice(tailIndex, compactionIndex);
213
+ return [
214
+ row({ ...item.row, time_updated: Math.max(item.row.time_updated, summary.row.time_updated) }, {
215
+ id: item.row.id,
216
+ type: "compaction",
217
+ status: "completed",
218
+ reason: compaction.auto ? "auto" : "manual",
219
+ summary: summaryText,
220
+ recent: serializeRecent(tail, byMessage),
221
+ time: { created: item.row.time_created }
222
+ })
223
+ ];
224
+ }
225
+ const subtasks = owned.filter((part) => part.type === "subtask");
226
+ const visible = owned.filter((part) => part.type === "text" && !part.ignored);
227
+ const files = owned.filter((part) => part.type === "file");
228
+ const agents = owned.filter((part) => part.type === "agent");
229
+ if (subtasks.length > 0 && visible.length === 0 && files.length === 0 && agents.length === 0)
230
+ return [];
231
+ const ordinary = visible.filter((part) => !part.synthetic);
232
+ const synthetic = visible.filter((part) => part.synthetic);
233
+ const attachments = files.flatMap((part) => migrateFile(part));
234
+ const unavailable = files.flatMap((part) => !part.url.startsWith("data:") ? [unavailableFile(part)] : []);
235
+ const text = owned.flatMap((part) => {
236
+ if (part.type === "text" && !part.ignored && !part.synthetic)
237
+ return [part.text];
238
+ if (part.type === "file" && !part.url.startsWith("data:"))
239
+ return [unavailableFile(part)];
240
+ return [];
241
+ }).join(`
242
+
243
+ `);
244
+ const agentAttachments = agents.map((part) => ({
245
+ name: part.name,
246
+ ...part.source ? { mention: { text: part.source.value, start: part.source.start, end: part.source.end } } : {}
247
+ }));
248
+ if (ordinary.length === 0 && unavailable.length === 0 && synthetic.length > 0 && attachments.length === 0 && agentAttachments.length === 0)
249
+ return [
250
+ row(item.row, {
251
+ id: item.row.id,
252
+ type: "synthetic",
253
+ text: synthetic.map((part) => part.text).join(`
254
+
255
+ `),
256
+ time: { created: item.row.time_created }
257
+ })
258
+ ];
259
+ const user = row(item.row, {
260
+ id: item.row.id,
261
+ type: "user",
262
+ text,
263
+ ...attachments.length ? { files: attachments } : {},
264
+ ...agentAttachments.length ? { agents: agentAttachments } : {},
265
+ time: { created: item.row.time_created }
266
+ });
267
+ if (synthetic.length === 0)
268
+ return [user];
269
+ return [
270
+ user,
271
+ row(item.row, {
272
+ id: syntheticID(item.row.id, used),
273
+ type: "synthetic",
274
+ text: synthetic.map((part) => part.text).join(`
275
+
276
+ `),
277
+ time: { created: item.row.time_created }
278
+ })
279
+ ];
280
+ }
281
+ if (item.value.role !== "assistant")
282
+ return [];
283
+ const assistant = item.value;
284
+ const parent = messages.find((candidate) => candidate.row.id === assistant.parentID);
285
+ const parentParts = parent ? byMessage.get(parent.row.id)?.map((part) => part.value) ?? [] : [];
286
+ if (parentParts.some((part) => part.type === "subtask") && owned.some((part) => part.type === "tool" && part.tool === "task"))
287
+ return [];
288
+ const content = owned.flatMap((part) => {
289
+ if (part.type === "text")
290
+ return [{ type: "text", text: part.text, ...part.metadata ? { state: part.metadata } : {} }];
291
+ if (part.type === "reasoning")
292
+ return [
293
+ {
294
+ type: "reasoning",
295
+ text: part.text,
296
+ ...part.metadata ? { state: part.metadata } : {},
297
+ time: { created: part.time.start, ...part.time.end === undefined ? {} : { completed: part.time.end } }
298
+ }
299
+ ];
300
+ if (part.type !== "tool")
301
+ return [];
302
+ return [migrateTool(part, item.row.time_created)];
303
+ });
304
+ const start = owned.flatMap((part) => part.type === "step-start" && part.snapshot ? [part.snapshot] : [])[0] ?? owned.flatMap((part) => part.type === "snapshot" ? [part.snapshot] : [])[0] ?? owned.flatMap((part) => part.type === "patch" ? [part.hash] : [])[0];
305
+ const end = owned.flatMap((part) => part.type === "step-finish" && part.snapshot ? [part.snapshot] : []).at(-1);
306
+ const snapshotFiles = Array.from(new Set(owned.flatMap((part) => part.type === "patch" ? part.files : [])));
307
+ const finish = normalizeFinish(assistant.finish);
308
+ return [
309
+ row(item.row, {
310
+ id: item.row.id,
311
+ type: "assistant",
312
+ agent: assistant.agent,
313
+ model: {
314
+ providerID: assistant.providerID,
315
+ id: assistant.modelID,
316
+ variant: assistant.variant ?? "default"
317
+ },
318
+ content,
319
+ ...start || end || snapshotFiles.length ? {
320
+ snapshot: {
321
+ ...start ? { start } : {},
322
+ ...end ? { end } : {},
323
+ ...snapshotFiles.length ? { files: snapshotFiles } : {}
324
+ }
325
+ } : {},
326
+ ...finish ? { finish } : {},
327
+ cost: assistant.cost,
328
+ tokens: {
329
+ input: assistant.tokens.input,
330
+ output: assistant.tokens.output,
331
+ reasoning: assistant.tokens.reasoning,
332
+ cache: assistant.tokens.cache
333
+ },
334
+ ...assistant.error ? { error: migrateError(assistant.error) } : {},
335
+ time: {
336
+ created: item.row.time_created,
337
+ ...assistant.time.completed === undefined ? {} : { completed: item.row.time_updated }
338
+ }
339
+ })
340
+ ];
341
+ }).map((item, seq) => ({ ...item, seq }));
342
+ const assistants = messages.map((item) => item.value).filter((item) => item.role === "assistant");
343
+ const latestUser = messages.findLast((item) => {
344
+ if (item.value.role !== "user")
345
+ return false;
346
+ const owned = byMessage.get(item.row.id) ?? [];
347
+ if (owned.some((part) => part.value.type === "compaction"))
348
+ return false;
349
+ return !owned.some((part) => part.value.type === "subtask") || !owned.every((part) => part.value.type === "subtask");
350
+ });
351
+ return {
352
+ messages: projected,
353
+ session: {
354
+ agent: input.session.agent ?? (latestUser?.value.role === "user" ? latestUser.value.agent : null),
355
+ model: input.session.model ?? (latestUser?.value.role === "user" ? {
356
+ id: latestUser.value.model.modelID,
357
+ providerID: latestUser.value.model.providerID,
358
+ variant: latestUser.value.model.variant ?? "default"
359
+ } : null),
360
+ cost: assistants.reduce((total, item) => total + item.cost, 0),
361
+ tokens_input: assistants.reduce((total, item) => total + item.tokens.input, 0),
362
+ tokens_output: assistants.reduce((total, item) => total + item.tokens.output, 0),
363
+ tokens_reasoning: assistants.reduce((total, item) => total + item.tokens.reasoning, 0),
364
+ tokens_cache_read: assistants.reduce((total, item) => total + item.tokens.cache.read, 0),
365
+ tokens_cache_write: assistants.reduce((total, item) => total + item.tokens.cache.write, 0),
366
+ revert: null,
367
+ time_compacting: null
368
+ },
369
+ watermark: projected.length - 1,
370
+ warnings
371
+ };
372
+ }
373
+ function status() {
374
+ return Effect.gen(function* () {
375
+ const db = (yield* Service80).db;
376
+ if (!(yield* hasLegacySessions(db)))
377
+ return { status: "completed" };
378
+ const state = yield* readState(db);
379
+ if (runtimeState.status === "running")
380
+ return runtimeState;
381
+ if (runtimeState.status === "error")
382
+ return runtimeState;
383
+ if (state?.phase === "completed")
384
+ return { status: "completed" };
385
+ return { status: "required" };
386
+ });
387
+ }
388
+ var layer = Layer.effectDiscard(Effect.gen(function* () {
389
+ runtimeState = { status: "running", progress: { label: "Clearing old events" } };
390
+ yield* run().pipe(Effect.matchCauseEffect({
391
+ onFailure: (cause) => Effect.sync(() => {
392
+ runtimeState = { status: "error", error: errorText(Cause.squash(cause)) };
393
+ }).pipe(Effect.andThen(Effect.logError("V1 migration failed", { cause }))),
394
+ onSuccess: () => Effect.sync(() => {
395
+ runtimeState = { status: "idle" };
396
+ })
397
+ }), Effect.forkScoped({ startImmediately: true }));
398
+ }));
399
+ function errorText(input) {
400
+ if (!(input instanceof Error))
401
+ return String(input);
402
+ const cause = input.cause;
403
+ return cause === undefined ? input.message : `${input.message}
404
+ Caused by: ${errorText(cause)}`;
405
+ }
406
+ function updateProgress(progress) {
407
+ if (runtimeState.status === "running")
408
+ runtimeState = { status: "running", progress };
409
+ }
410
+ function run(options = {}) {
411
+ return lock.withPermit(Effect.gen(function* () {
412
+ const db = (yield* Service80).db;
413
+ const global = yield* Global.Service;
414
+ const state = yield* readState(db);
415
+ if (state?.phase === "completed")
416
+ return { status: "completed" };
417
+ if (!(yield* hasLegacySessions(db)))
418
+ return { status: "completed" };
419
+ const now = Date.now();
420
+ yield* db.run(sql`
421
+ INSERT OR IGNORE INTO project (id, worktree, time_created, time_updated, sandboxes)
422
+ VALUES (${Project.ID.global}, ${path.parse(global.data).root}, ${now}, ${now}, '[]')
423
+ `);
424
+ if (state === undefined)
425
+ yield* db.transaction((tx) => Effect.gen(function* () {
426
+ while (true) {
427
+ yield* tx.run(sql`
428
+ DELETE FROM event
429
+ WHERE rowid IN (SELECT rowid FROM event LIMIT ${EVENT_DELETE_BATCH_SIZE})
430
+ `);
431
+ const deleted = (yield* tx.get(sql`SELECT changes() AS value`))?.value ?? 0;
432
+ if (deleted < EVENT_DELETE_BATCH_SIZE)
433
+ break;
434
+ yield* Effect.yieldNow;
435
+ }
436
+ yield* tx.insert(KVTable2).values({ key: MIGRATION_STATE_KEY, value: { phase: "sessions" } }).run();
437
+ })).pipe(Effect.orDie);
438
+ const sourceTotal = yield* countNextSessions(nextPath(options, global.data));
439
+ const legacyTotal = (yield* db.get(sql`SELECT COUNT(*) AS value FROM session`))?.value ?? 0;
440
+ const cursor = state?.phase === "sessions" ? state.cursor : undefined;
441
+ const migrated = cursor !== undefined ? (yield* db.get(sql`SELECT COUNT(*) AS value FROM session WHERE id >= ${cursor}`))?.value ?? 0 : 0;
442
+ const denominator = sourceTotal + legacyTotal;
443
+ updateProgress({ label: "Migrating sessions", numerator: migrated, denominator });
444
+ yield* importNextDatabase(db, nextPath(options, global.data), (completed) => {
445
+ updateProgress({ label: "Migrating sessions", numerator: migrated + completed, denominator });
446
+ });
447
+ updateProgress({ label: "Migrating sessions", numerator: migrated + sourceTotal, denominator });
448
+ const projects = new Set((yield* db.all(sql`SELECT id FROM project`)).map((project) => project.id));
449
+ while (true) {
450
+ const state = yield* readState(db);
451
+ const cursorValue = state?.phase === "sessions" ? state.cursor : undefined;
452
+ const nextID = yield* db.get(cursorValue === undefined ? sql`SELECT id, project_id FROM session ORDER BY id DESC LIMIT 1` : sql`SELECT id, project_id FROM session WHERE id < ${cursorValue} ORDER BY id DESC LIMIT 1`);
453
+ if (!nextID)
454
+ break;
455
+ yield* db.transaction((tx) => Effect.gen(function* () {
456
+ yield* tx.insert(KVTable2).values({ key: MIGRATION_STATE_KEY, value: { phase: "sessions", cursor: nextID.id } }).onConflictDoUpdate({
457
+ target: KVTable2.key,
458
+ set: { value: { phase: "sessions", cursor: nextID.id }, time_updated: Date.now() }
459
+ }).run();
460
+ const projectID = projects.has(nextID.project_id) ? nextID.project_id : Project.ID.global;
461
+ if (projectID !== nextID.project_id)
462
+ yield* Effect.logWarning("Reassigned V1 session with missing project", {
463
+ sessionID: nextID.id,
464
+ projectID: nextID.project_id
465
+ });
466
+ yield* tx.run(sql`
467
+ INSERT OR IGNORE INTO session_v2 (
468
+ id, project_id, workspace_id, parent_id, slug, directory, path, title, version, share_url,
469
+ summary_additions, summary_deletions, summary_files, summary_diffs, metadata, cost,
470
+ tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write,
471
+ revert, permission, agent, model, time_created, time_updated, time_compacting, time_archived
472
+ )
473
+ SELECT
474
+ id, ${projectID}, workspace_id, parent_id, slug, directory, path, title, version, share_url,
475
+ summary_additions, summary_deletions, summary_files, summary_diffs, metadata, cost,
476
+ tokens_input, tokens_output, tokens_reasoning, tokens_cache_read, tokens_cache_write,
477
+ revert, permission, agent, model, time_created, time_updated, time_compacting, time_archived
478
+ FROM session
479
+ WHERE id = ${nextID.id}
480
+ `);
481
+ const next = yield* tx.select().from(SessionTable2).where(eq(SessionTable2.id, SessionSchema2.ID.make(nextID.id))).get();
482
+ if (!next)
483
+ return yield* Effect.die(new Error(`Failed to copy V1 session ${nextID.id}`));
484
+ const sourceMessages = yield* tx.all(sql`SELECT id, session_id, time_created, time_updated, data FROM message WHERE session_id = ${next.id}`);
485
+ const sourceParts = yield* tx.all(sql`SELECT id, message_id, session_id, time_created, time_updated, data FROM part WHERE session_id = ${next.id}`);
486
+ const transformed = transformSession({ session: next, messages: sourceMessages, parts: sourceParts });
487
+ yield* Effect.forEach(transformed.warnings, (warning) => Effect.logWarning("Skipped V1 migration row", warning));
488
+ yield* tx.delete(SessionMessageTable2).where(eq(SessionMessageTable2.session_id, next.id)).run();
489
+ yield* Effect.forEach(transformed.messages, (message) => tx.insert(SessionMessageTable2).values({
490
+ id: SessionMessage2.ID.make(message.id),
491
+ session_id: SessionSchema2.ID.make(message.session_id),
492
+ type: message.type,
493
+ seq: message.seq,
494
+ time_created: message.time_created,
495
+ time_updated: message.time_updated,
496
+ data: sql`${JSON.stringify(message.data)}`
497
+ }).run());
498
+ yield* tx.update(SessionTable2).set({ ...transformed.session, time_updated: next.time_updated }).where(eq(SessionTable2.id, next.id)).run();
499
+ yield* tx.insert(EventSequenceTable2).values({ aggregate_id: next.id, seq: transformed.watermark }).onConflictDoUpdate({
500
+ target: EventSequenceTable2.aggregate_id,
501
+ set: { seq: transformed.watermark, owner_id: null }
502
+ }).run();
503
+ })).pipe(Effect.orDie);
504
+ if (runtimeState.status === "running")
505
+ runtimeState = {
506
+ status: "running",
507
+ progress: {
508
+ label: "Migrating sessions",
509
+ numerator: (runtimeState.progress.numerator ?? 0) + 1,
510
+ denominator
511
+ }
512
+ };
513
+ yield* Effect.yieldNow;
514
+ }
515
+ yield* db.transaction((tx) => Effect.gen(function* () {
516
+ yield* tx.insert(KVTable2).values({ key: MIGRATION_STATE_KEY, value: { phase: "completed" } }).onConflictDoUpdate({
517
+ target: KVTable2.key,
518
+ set: { value: { phase: "completed" }, time_updated: Date.now() }
519
+ }).run();
520
+ })).pipe(Effect.orDie);
521
+ return { status: "completed" };
522
+ }).pipe(Effect.orDie));
523
+ }
524
+ function nextPath(options, data) {
525
+ if (options.nextDatabasePath)
526
+ return options.nextDatabasePath;
527
+ if (process.env.OPENCODE_DB === ":memory:")
528
+ return;
529
+ return path.join(data, "opencode-next.db");
530
+ }
531
+ function openNextDatabase(sourcePath) {
532
+ return Effect.acquireRelease(Effect.gen(function* () {
533
+ const sqlite = yield* Effect.promise(() => import("bun:sqlite"));
534
+ return new sqlite.Database(sourcePath, { readonly: true, strict: true });
535
+ }), (source) => Effect.sync(() => source.close()));
536
+ }
537
+ function countNextSessions(sourcePath) {
538
+ if (!sourcePath || !existsSync(sourcePath))
539
+ return Effect.succeed(0);
540
+ return Effect.scoped(Effect.gen(function* () {
541
+ const source = yield* openNextDatabase(sourcePath);
542
+ if (!isNextDatabase(source))
543
+ return 0;
544
+ return source.query("SELECT COUNT(*) AS value FROM session").get()?.value ?? 0;
545
+ }));
546
+ }
547
+ function importNextDatabase(db, sourcePath, onProgress) {
548
+ if (!sourcePath || !existsSync(sourcePath))
549
+ return Effect.void;
550
+ return Effect.scoped(Effect.gen(function* () {
551
+ const source = yield* openNextDatabase(sourcePath);
552
+ if (!isNextDatabase(source)) {
553
+ yield* Effect.logWarning("Skipped incompatible opencode-next.db", { path: sourcePath });
554
+ return;
555
+ }
556
+ source.run("BEGIN");
557
+ yield* Effect.addFinalizer(() => Effect.sync(() => {
558
+ if (source.inTransaction)
559
+ source.run("ROLLBACK");
560
+ }));
561
+ const projects = new Map(selectNextRows(source, "project", NEXT_PROJECT_COLUMNS).map((project) => [project.id, project]));
562
+ const sessions = selectNextRows(source, "session", NEXT_SESSION_COLUMNS);
563
+ for (const [index, session] of sessions.entries()) {
564
+ const project = projects.get(session.project_id);
565
+ const projectID = project ? session.project_id : Project.ID.global;
566
+ if (!project) {
567
+ yield* Effect.logWarning("Reassigned previous V2 session with missing project", {
568
+ sessionID: session.id,
569
+ projectID: session.project_id
570
+ });
571
+ }
572
+ const messages = source.query("SELECT id, session_id, type, seq, time_created, time_updated, data FROM session_message WHERE session_id = ? ORDER BY seq").all(session.id);
573
+ yield* db.transaction((tx) => Effect.gen(function* () {
574
+ if (project)
575
+ yield* tx.run(sql`
576
+ INSERT OR IGNORE INTO project (
577
+ id, worktree, vcs, name, icon_url, icon_url_override, icon_color,
578
+ time_created, time_updated, time_initialized, sandboxes, commands
579
+ ) VALUES (
580
+ ${project.id}, ${project.worktree}, ${project.vcs}, ${project.name}, ${project.icon_url},
581
+ ${project.icon_url_override}, ${project.icon_color}, ${project.time_created}, ${project.time_updated},
582
+ ${project.time_initialized}, ${project.sandboxes}, ${project.commands}
583
+ )
584
+ `);
585
+ const existing = yield* tx.select({ id: SessionTable2.id }).from(SessionTable2).where(eq(SessionTable2.id, SessionSchema2.ID.make(session.id))).get();
586
+ if (existing)
587
+ return;
588
+ yield* tx.run(sql`
589
+ INSERT INTO session_v2 (
590
+ id, project_id, workspace_id, parent_id, fork_session_id, fork_boundary, slug, directory,
591
+ path, title, version, share_url, summary_additions, summary_deletions, summary_files,
592
+ summary_diffs, metadata, cost, tokens_input, tokens_output, tokens_reasoning, tokens_cache_read,
593
+ tokens_cache_write, revert, permission, agent, model, time_created, time_updated, time_compacting,
594
+ time_archived, time_suspended
595
+ ) VALUES (
596
+ ${session.id}, ${projectID}, ${session.workspace_id}, ${session.parent_id},
597
+ ${session.fork_session_id}, ${session.fork_boundary}, ${session.slug}, ${session.directory},
598
+ ${session.path}, ${session.title}, ${session.version}, ${session.share_url},
599
+ ${session.summary_additions}, ${session.summary_deletions}, ${session.summary_files},
600
+ ${session.summary_diffs}, ${session.metadata}, ${session.cost}, ${session.tokens_input},
601
+ ${session.tokens_output}, ${session.tokens_reasoning}, ${session.tokens_cache_read},
602
+ ${session.tokens_cache_write}, ${session.revert}, ${session.permission}, ${session.agent},
603
+ ${session.model}, ${session.time_created}, ${session.time_updated}, ${session.time_compacting},
604
+ ${session.time_archived}, ${session.time_suspended}
605
+ )
606
+ `);
607
+ yield* Effect.forEach(messages, (message) => tx.insert(SessionMessageTable2).values({
608
+ id: SessionMessage2.ID.make(message.id),
609
+ session_id: SessionSchema2.ID.make(message.session_id),
610
+ type: message.type,
611
+ seq: message.seq,
612
+ time_created: message.time_created,
613
+ time_updated: message.time_updated,
614
+ data: sql`${message.data}`
615
+ }).run());
616
+ yield* tx.insert(EventSequenceTable2).values({ aggregate_id: session.id, seq: messages.at(-1)?.seq ?? -1 }).onConflictDoUpdate({
617
+ target: EventSequenceTable2.aggregate_id,
618
+ set: { seq: messages.at(-1)?.seq ?? -1, owner_id: null }
619
+ }).run();
620
+ })).pipe(Effect.orDie);
621
+ onProgress(index + 1);
622
+ yield* Effect.yieldNow;
623
+ }
624
+ source.run("COMMIT");
625
+ }));
626
+ }
627
+ function isNextDatabase(source) {
628
+ const tables = new Set(source.query("SELECT name FROM sqlite_master WHERE type = 'table'").all().map((table) => table.name));
629
+ return tables.has("project") && tables.has("session") && tables.has("session_message");
630
+ }
631
+ function selectNextRows(source, table, definition) {
632
+ const columns = new Set(source.query("SELECT name FROM pragma_table_info(?)").all(table).map((column) => column.name));
633
+ const missing = Object.entries(definition).filter(([column, strategy]) => strategy === "required" && !columns.has(column)).map(([column]) => column);
634
+ if (missing.length)
635
+ throw new Error(`Incompatible opencode-next.db: ${table} is missing required columns: ${missing.join(", ")}`);
636
+ const projection = Object.entries(definition).map(([column, strategy]) => {
637
+ if (columns.has(column))
638
+ return `"${column}"`;
639
+ if (typeof strategy === "object" && strategy !== null && "fallback" in strategy && typeof strategy.fallback === "string" && columns.has(strategy.fallback))
640
+ return `"${strategy.fallback}" AS "${column}"`;
641
+ return `NULL AS "${column}"`;
642
+ });
643
+ return source.query(`SELECT ${projection.join(", ")} FROM "${table}"${table === "session" ? ' ORDER BY "id" DESC' : ""}`).all();
644
+ }
645
+ function row(source, message) {
646
+ const { id, type, ...data } = message;
647
+ return {
648
+ id,
649
+ session_id: source.session_id,
650
+ type,
651
+ seq: 0,
652
+ time_created: source.time_created,
653
+ time_updated: source.time_updated,
654
+ data
655
+ };
656
+ }
657
+ function migrateTool(part, fallback) {
658
+ const base = {
659
+ type: "tool",
660
+ id: part.callID,
661
+ name: part.tool,
662
+ ...part.metadata ? { providerState: part.metadata } : {}
663
+ };
664
+ if (part.state.status === "completed")
665
+ return {
666
+ ...base,
667
+ state: {
668
+ status: "completed",
669
+ input: part.state.input,
670
+ content: part.state.time.compacted === undefined ? [
671
+ { type: "text", text: part.state.output },
672
+ ...(part.state.attachments ?? []).map((file) => ({
673
+ type: "file",
674
+ uri: file.url,
675
+ mime: file.mime,
676
+ ...file.filename ? { name: file.filename } : {}
677
+ }))
678
+ ] : [{ type: "text", text: "[Old tool result content cleared]" }],
679
+ metadata: part.state.metadata
680
+ },
681
+ time: { created: part.state.time.start, completed: part.state.time.end }
682
+ };
683
+ if (part.state.status === "error")
684
+ return {
685
+ ...base,
686
+ state: {
687
+ status: "error",
688
+ input: part.state.input,
689
+ error: { type: "tool.execution", message: part.state.error },
690
+ ...typeof part.state.metadata?.output === "string" ? { content: [{ type: "text", text: part.state.metadata.output }] } : {},
691
+ ...part.state.metadata ? { metadata: part.state.metadata } : {}
692
+ },
693
+ time: { created: part.state.time.start, completed: part.state.time.end }
694
+ };
695
+ return {
696
+ ...base,
697
+ state: {
698
+ status: "error",
699
+ input: part.state.input,
700
+ error: { type: "tool.interrupted", message: "Tool execution was interrupted before V2 migration" },
701
+ ...part.state.status === "running" && part.state.metadata ? { metadata: part.state.metadata } : {}
702
+ },
703
+ time: { created: part.state.status === "running" ? part.state.time.start : fallback }
704
+ };
705
+ }
706
+ function migrateError(error) {
707
+ const message = "message" in error.data ? error.data.message : error.name === "MessageOutputLengthError" ? "The model exceeded its output limit" : error.name;
708
+ const type = error.name === "ProviderAuthError" ? "provider.auth" : error.name === "ContentFilterError" ? "provider.content-filter" : error.name === "ContextOverflowError" ? "provider.invalid-request" : error.name === "StructuredOutputError" || error.name === "MessageOutputLengthError" ? "provider.invalid-output" : error.name === "MessageAbortedError" ? "aborted" : error.name === "APIError" ? "provider.error" : "unknown";
709
+ return { type, message };
710
+ }
711
+ function normalizeFinish(finish) {
712
+ if (!finish)
713
+ return;
714
+ return ["stop", "length", "tool-calls", "content-filter", "error", "unknown"].find((value) => value === finish) ?? "unknown";
715
+ }
716
+ function migrateFile(part) {
717
+ if (!part.url.startsWith("data:"))
718
+ return [];
719
+ const comma = part.url.indexOf(",");
720
+ if (comma < 0)
721
+ return [];
722
+ const header = part.url.slice(0, comma);
723
+ const payload = part.url.slice(comma + 1);
724
+ const data = header.endsWith(";base64") ? Buffer.from(payload, "base64").toString("base64") : Buffer.from(decodeURIComponent(payload)).toString("base64");
725
+ return [
726
+ {
727
+ data,
728
+ mime: part.mime,
729
+ source: part.source?.type === "resource" ? { type: "uri", uri: part.source.uri } : { type: "inline" },
730
+ ...part.filename ? { name: part.filename } : {},
731
+ ...part.source ? { mention: { text: part.source.text.value, start: part.source.text.start, end: part.source.text.end } } : {}
732
+ }
733
+ ];
734
+ }
735
+ function unavailableFile(part) {
736
+ const label = part.filename ?? (part.source?.type === "resource" ? part.source.uri : part.url);
737
+ return `[Attachment unavailable after migration: ${label} (${part.mime})]`;
738
+ }
739
+ function syntheticID(source, used) {
740
+ const prefix = source.slice(0, 16);
741
+ const alphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
742
+ for (let salt = 0;; salt++) {
743
+ const hex = new Bun.CryptoHasher("sha256").update(`v1-synthetic:${source}${salt ? `:${salt}` : ""}`).digest("hex");
744
+ let value = BigInt(`0x${hex}`);
745
+ let suffix = "";
746
+ while (suffix.length < 14) {
747
+ suffix = alphabet[Number(value % 62n)] + suffix;
748
+ value /= 62n;
749
+ }
750
+ const id = prefix + suffix;
751
+ if (used.has(id))
752
+ continue;
753
+ used.add(id);
754
+ return id;
755
+ }
756
+ }
757
+ function serializeRecent(messages, parts) {
758
+ return messages.flatMap((message) => {
759
+ const owned = parts.get(message.row.id)?.map((part) => part.value) ?? [];
760
+ if (message.value.role === "user")
761
+ return [
762
+ `[User]: ${owned.filter((part) => part.type === "text" && !part.ignored).map((part) => part.type === "text" ? part.text : "").join(`
763
+
764
+ `)}`
765
+ ];
766
+ return owned.flatMap((part) => part.type === "text" ? [`[Assistant]: ${part.text}`] : part.type === "reasoning" && part.text ? [`[Assistant reasoning]: ${part.text}`] : []);
767
+ }).join(`
768
+
769
+ `);
770
+ }
771
+ function readState(db) {
772
+ return db.select({ value: KVTable2.value }).from(KVTable2).where(eq(KVTable2.key, MIGRATION_STATE_KEY)).get().pipe(Effect.map((row) => parseState(row?.value)), Effect.orDie);
773
+ }
774
+ function parseState(input) {
775
+ if (!input || typeof input !== "object" || !("phase" in input))
776
+ return;
777
+ if (input.phase === "completed")
778
+ return { phase: "completed" };
779
+ if (input.phase !== "sessions")
780
+ return;
781
+ if (!("cursor" in input) || input.cursor === undefined)
782
+ return { phase: "sessions" };
783
+ if (typeof input.cursor === "string")
784
+ return { phase: "sessions", cursor: input.cursor };
785
+ }
786
+ function hasLegacySessions(db) {
787
+ return db.get(sql`SELECT name FROM sqlite_master WHERE type = 'table' AND name = 'session'`).pipe(Effect.map((row) => row !== undefined), Effect.orDie);
788
+ }
789
+ export {
790
+ exports_v1_migration as V1Migration,
791
+ layer,
792
+ run,
793
+ status,
794
+ transformSession
795
+ };