@opencode-ai/core 0.0.0-beta-18593 → 0.0.0-beta-18684

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 (811) hide show
  1. package/dist/account/sql.js +2 -2
  2. package/dist/agent.js +70 -70
  3. package/dist/aisdk-native.js +3 -3
  4. package/dist/aisdk.js +4 -4
  5. package/dist/app.js +2 -2
  6. package/dist/bus.js +68 -68
  7. package/dist/catalog.js +78 -78
  8. package/dist/chunks/{persistent-pty-02dbfq60.js → state-02dbfq60.js} +1 -1
  9. package/dist/chunks/{persistent-pty-h40g2pf4.js → state-0cg1xda9.js} +5 -5
  10. package/dist/chunks/{persistent-pty-0gcqkg3x.js → state-0gcqkg3x.js} +2 -2
  11. package/dist/chunks/{persistent-pty-0kvmztkf.js → state-0kvmztkf.js} +1 -1
  12. package/dist/chunks/{persistent-pty-z3cp4eqm.js → state-0v1esw26.js} +20 -22
  13. package/dist/chunks/{persistent-pty-10p29vm9.js → state-10p29vm9.js} +1 -1
  14. package/dist/chunks/{persistent-pty-15hpbjb6.js → state-15hpbjb6.js} +1 -1
  15. package/dist/chunks/{persistent-pty-18pv8fg3.js → state-18pv8fg3.js} +2 -2
  16. package/dist/chunks/{persistent-pty-vyrk4dbp.js → state-1aq7gkhy.js} +14 -14
  17. package/dist/chunks/{persistent-pty-fck3954k.js → state-1b14nrwf.js} +7 -7
  18. package/dist/chunks/{persistent-pty-264e1nfp.js → state-264e1nfp.js} +2 -2
  19. package/dist/chunks/state-27ykzq5n.js +203 -0
  20. package/dist/chunks/{persistent-pty-2wsc5t7f.js → state-297h3553.js} +3 -5
  21. package/dist/chunks/{persistent-pty-b9k0650j.js → state-2a5pw7n9.js} +3 -3
  22. package/dist/chunks/{persistent-pty-68wbtxd0.js → state-2b3pkve8.js} +154 -154
  23. package/dist/chunks/{persistent-pty-2m0hgr65.js → state-2m0hgr65.js} +1 -1
  24. package/dist/chunks/{persistent-pty-ke19p6qk.js → state-2mrfsm54.js} +3 -3
  25. package/dist/chunks/{persistent-pty-2nmyybe0.js → state-2nmyybe0.js} +1 -1
  26. package/dist/chunks/state-2pd1mgzx.js +95 -0
  27. package/dist/chunks/{persistent-pty-2wds5nk3.js → state-2wds5nk3.js} +1 -1
  28. package/dist/chunks/{persistent-pty-22h5xaqn.js → state-2ygtazh9.js} +3 -3
  29. package/dist/chunks/{persistent-pty-fbnkj2ks.js → state-330v609d.js} +8 -8
  30. package/dist/chunks/{persistent-pty-12pms3sx.js → state-36dfjbwk.js} +5 -5
  31. package/dist/chunks/{persistent-pty-393a352g.js → state-393a352g.js} +2 -2
  32. package/dist/chunks/{persistent-pty-85s0s238.js → state-3atnf4k9.js} +3 -3
  33. package/dist/chunks/{persistent-pty-b11hynfv.js → state-3feq69af.js} +113 -25
  34. package/dist/chunks/{persistent-pty-3g8vftxb.js → state-3g8vftxb.js} +2 -2
  35. package/dist/chunks/{persistent-pty-jm9yfqhv.js → state-3qmndtx9.js} +2 -2
  36. package/dist/chunks/{persistent-pty-3qv8nf0b.js → state-3qv8nf0b.js} +1 -1
  37. package/dist/chunks/{persistent-pty-3thh6229.js → state-3thh6229.js} +2 -2
  38. package/dist/chunks/{persistent-pty-jn3nfbk7.js → state-3yz9d04b.js} +2 -2
  39. package/dist/chunks/{persistent-pty-7khw64yh.js → state-41qzzbpz.js} +3 -2
  40. package/dist/chunks/{persistent-pty-mctnftah.js → state-442jakqw.js} +4 -4
  41. package/dist/chunks/{persistent-pty-4szn0afa.js → state-48kmwd7y.js} +14 -10
  42. package/dist/chunks/{persistent-pty-ww589d89.js → state-4n623fxr.js} +4 -4
  43. package/dist/chunks/{persistent-pty-mjkw59em.js → state-4twq59qz.js} +8 -8
  44. package/dist/chunks/{persistent-pty-ngph9rhx.js → state-4vn652hh.js} +96 -62
  45. package/dist/chunks/{persistent-pty-3x0b9mtx.js → state-4xcc4pxn.js} +8 -20
  46. package/dist/chunks/{persistent-pty-4zzdwbaz.js → state-4zzdwbaz.js} +2 -2
  47. package/dist/chunks/{persistent-pty-50jxp3hw.js → state-50jxp3hw.js} +1 -1
  48. package/dist/chunks/{persistent-pty-q22ck3r9.js → state-546qm8gr.js} +9 -9
  49. package/dist/chunks/{persistent-pty-57ej80dx.js → state-57ej80dx.js} +2 -2
  50. package/dist/chunks/{persistent-pty-rywejs85.js → state-57sfr108.js} +8 -8
  51. package/dist/chunks/{persistent-pty-57tzwnz4.js → state-57tzwnz4.js} +1 -1
  52. package/dist/chunks/{persistent-pty-58xdvehb.js → state-58xdvehb.js} +1 -1
  53. package/dist/chunks/{persistent-pty-a0ys31qc.js → state-5br90a8p.js} +13 -13
  54. package/dist/chunks/{persistent-pty-q3p77hqf.js → state-5efnjspb.js} +5 -5
  55. package/dist/chunks/{persistent-pty-5fe026tx.js → state-5fe026tx.js} +3 -3
  56. package/dist/chunks/{persistent-pty-0dfzjmdz.js → state-5hbk2f5z.js} +25 -25
  57. package/dist/chunks/{persistent-pty-5rs65q6p.js → state-5rs65q6p.js} +1 -1
  58. package/dist/chunks/{persistent-pty-jmntmgq9.js → state-5t7q56hh.js} +15 -15
  59. package/dist/chunks/{persistent-pty-vjsse407.js → state-5th3bkhh.js} +2 -2
  60. package/dist/chunks/{persistent-pty-5vcssjzn.js → state-5vcssjzn.js} +1 -1
  61. package/dist/chunks/{persistent-pty-6272rtjg.js → state-6272rtjg.js} +1 -1
  62. package/dist/chunks/{persistent-pty-vqha1kn3.js → state-62gc4hyq.js} +10 -10
  63. package/dist/chunks/{persistent-pty-5b7b3wgr.js → state-6hrx3qpt.js} +6 -6
  64. package/dist/chunks/{persistent-pty-p91cgptf.js → state-6kt4mxs4.js} +10 -10
  65. package/dist/chunks/{persistent-pty-6ky7rqk7.js → state-6ky7rqk7.js} +1 -1
  66. package/dist/chunks/{persistent-pty-yx19m5fk.js → state-6m6jxvnj.js} +27 -35
  67. package/dist/chunks/{persistent-pty-rjhyt7an.js → state-6vv9vvfs.js} +10 -10
  68. package/dist/chunks/{persistent-pty-6wkzvma0.js → state-6wkzvma0.js} +2 -2
  69. package/dist/chunks/{persistent-pty-ckw7ggwg.js → state-6xryfvfs.js} +16 -22
  70. package/dist/chunks/{persistent-pty-hs1p9dz7.js → state-73zfmg2m.js} +8 -8
  71. package/dist/chunks/{persistent-pty-xkdg511d.js → state-74v4zq76.js} +3 -3
  72. package/dist/chunks/{persistent-pty-f7q7a28y.js → state-7ccgh94t.js} +6 -6
  73. package/dist/chunks/{persistent-pty-wa3apvnh.js → state-7e0e6g4b.js} +6 -6
  74. package/dist/chunks/{persistent-pty-7mrpdsq5.js → state-7mrpdsq5.js} +1 -1
  75. package/dist/chunks/{persistent-pty-yd381zvh.js → state-7rgfq7cg.js} +12 -12
  76. package/dist/chunks/{persistent-pty-7wcmqxrc.js → state-7wcmqxrc.js} +1 -1
  77. package/dist/chunks/{persistent-pty-chdf1j2d.js → state-7xfxj81h.js} +4 -4
  78. package/dist/chunks/{persistent-pty-cznxnepa.js → state-7yxdgcdg.js} +47 -41
  79. package/dist/chunks/{persistent-pty-83ba1yz6.js → state-83ba1yz6.js} +2 -2
  80. package/dist/chunks/{persistent-pty-8a4hfbqs.js → state-8a4hfbqs.js} +4 -4
  81. package/dist/chunks/{persistent-pty-6d0q94xv.js → state-8br4d03d.js} +7 -7
  82. package/dist/chunks/{persistent-pty-xqzpjgmh.js → state-8ee4ayyt.js} +9 -9
  83. package/dist/chunks/{persistent-pty-b1rr41z2.js → state-8gggym7s.js} +13 -12
  84. package/dist/chunks/{persistent-pty-8pngjawd.js → state-8pngjawd.js} +2 -2
  85. package/dist/chunks/{persistent-pty-jrzh7nr2.js → state-8q7v1yfa.js} +4 -4
  86. package/dist/chunks/{persistent-pty-z6p4m7fm.js → state-8qrx9cj0.js} +35 -37
  87. package/dist/chunks/{persistent-pty-ey12fzze.js → state-8y3819y8.js} +3 -3
  88. package/dist/chunks/{persistent-pty-nt76vjs4.js → state-8ya4n8zg.js} +9 -12
  89. package/dist/chunks/{persistent-pty-w4aa5eza.js → state-91jv2dwm.js} +9 -9
  90. package/dist/chunks/{persistent-pty-dmnn2ttb.js → state-9cb4yhpj.js} +17 -12
  91. package/dist/chunks/{persistent-pty-9f0rnpkn.js → state-9f0rnpkn.js} +1 -1
  92. package/dist/chunks/{persistent-pty-9507whzk.js → state-a2jfr9gs.js} +3 -3
  93. package/dist/chunks/state-a7zp47hx.js +31 -0
  94. package/dist/chunks/{persistent-pty-mdbd9v7n.js → state-a9rzcc94.js} +13 -11
  95. package/dist/chunks/{persistent-pty-we6kp80b.js → state-ad3fd695.js} +93 -85
  96. package/dist/chunks/{persistent-pty-g2tg9rrx.js → state-af29esbf.js} +1 -1
  97. package/dist/chunks/{persistent-pty-tg194hwa.js → state-am8nd5ct.js} +4 -4
  98. package/dist/chunks/{persistent-pty-g01v88ve.js → state-amkn3mrf.js} +11 -11
  99. package/dist/chunks/{persistent-pty-6nthn2wf.js → state-amtptj9f.js} +10 -8
  100. package/dist/chunks/{persistent-pty-vh1dz6e7.js → state-aq3jmta4.js} +10 -10
  101. package/dist/chunks/{persistent-pty-6dfpv9a6.js → state-avxxwfmz.js} +3 -3
  102. package/dist/chunks/{persistent-pty-awg5d31a.js → state-awg5d31a.js} +1 -1
  103. package/dist/chunks/{persistent-pty-pp6dntfs.js → state-az57h3s3.js} +9 -14
  104. package/dist/chunks/{persistent-pty-bbhffenw.js → state-bbhffenw.js} +3 -3
  105. package/dist/chunks/{persistent-pty-bh1wr8rq.js → state-bh1wr8rq.js} +2 -2
  106. package/dist/chunks/{persistent-pty-caycsp33.js → state-bktc4s3t.js} +2 -2
  107. package/dist/chunks/{persistent-pty-r5b5j3z1.js → state-bsjatayh.js} +11 -11
  108. package/dist/chunks/{persistent-pty-byab506k.js → state-byab506k.js} +1 -1
  109. package/dist/chunks/{persistent-pty-c4wcb9vc.js → state-c4wcb9vc.js} +2 -2
  110. package/dist/chunks/{persistent-pty-c8ya26sa.js → state-c8ya26sa.js} +2 -2
  111. package/dist/chunks/{persistent-pty-hggmzd1z.js → state-cbp56nj8.js} +11 -11
  112. package/dist/chunks/state-cgqn2mrm.js +147 -0
  113. package/dist/chunks/{persistent-pty-8dqs26x1.js → state-cgy4zpa6.js} +96 -98
  114. package/dist/chunks/{persistent-pty-8n5xz4y2.js → state-cnsekzdm.js} +4 -4
  115. package/dist/chunks/{persistent-pty-4fpv6vze.js → state-cp8v16sk.js} +7 -7
  116. package/dist/chunks/{persistent-pty-37ng30jt.js → state-cpqd33tw.js} +8 -11
  117. package/dist/chunks/state-cr7tbps7.js +34 -0
  118. package/dist/chunks/{persistent-pty-a7xc44k8.js → state-cynvptsh.js} +4 -4
  119. package/dist/chunks/{persistent-pty-d2gk9vpf.js → state-d2gk9vpf.js} +2 -2
  120. package/dist/chunks/{persistent-pty-d4h7vwhh.js → state-d4h7vwhh.js} +2 -2
  121. package/dist/chunks/{persistent-pty-aj48n7zh.js → state-d4zkabyv.js} +3 -3
  122. package/dist/chunks/{persistent-pty-h7dqnnw7.js → state-ddkxdmhk.js} +64 -15
  123. package/dist/chunks/{persistent-pty-dhphtf1x.js → state-dhphtf1x.js} +1 -1
  124. package/dist/chunks/{persistent-pty-68ypegzg.js → state-dhvv2dke.js} +3 -3
  125. package/dist/chunks/{persistent-pty-8a0sxteh.js → state-dstxbc7s.js} +7 -7
  126. package/dist/chunks/{persistent-pty-n8twstac.js → state-dx3ash2a.js} +20 -19
  127. package/dist/chunks/{persistent-pty-kt491qp2.js → state-dyj7wa6j.js} +14 -14
  128. package/dist/chunks/{persistent-pty-e1z9a0ts.js → state-e1z9a0ts.js} +2 -2
  129. package/dist/chunks/{persistent-pty-shjty0r5.js → state-ebnnd043.js} +26 -28
  130. package/dist/chunks/{persistent-pty-ec8vrfw5.js → state-ec8vrfw5.js} +1 -1
  131. package/dist/chunks/{persistent-pty-3mn74f4q.js → state-efb59s13.js} +32 -34
  132. package/dist/chunks/{persistent-pty-enpg66yn.js → state-enpg66yn.js} +1 -1
  133. package/dist/chunks/{persistent-pty-ep35cpen.js → state-ep35cpen.js} +1 -1
  134. package/dist/chunks/{persistent-pty-b4gc6pz2.js → state-epxhfqb6.js} +41 -40
  135. package/dist/chunks/state-etvrgfqj.js +74 -0
  136. package/dist/chunks/{persistent-pty-f9wt0tjw.js → state-f9wt0tjw.js} +2 -2
  137. package/dist/chunks/{persistent-pty-31t50p8f.js → state-fd8j0005.js} +35 -12
  138. package/dist/chunks/{persistent-pty-fgyjabww.js → state-fgyjabww.js} +2 -2
  139. package/dist/chunks/{persistent-pty-fm3b2wbt.js → state-fm3b2wbt.js} +2 -2
  140. package/dist/chunks/{persistent-pty-9kqpqjvx.js → state-fp623900.js} +2 -2
  141. package/dist/chunks/{persistent-pty-5cdnkd94.js → state-fyaxe1pd.js} +4 -6
  142. package/dist/chunks/{persistent-pty-a9vdgkgd.js → state-g23fad86.js} +2 -0
  143. package/dist/chunks/{persistent-pty-75h1hfe2.js → state-g5tvq2z7.js} +3 -3
  144. package/dist/chunks/{persistent-pty-gb1z7yet.js → state-gb1z7yet.js} +2 -2
  145. package/dist/chunks/{persistent-pty-gcay93cp.js → state-gcay93cp.js} +1 -1
  146. package/dist/chunks/{persistent-pty-gd2xppx8.js → state-gd2xppx8.js} +1 -1
  147. package/dist/chunks/state-gpxba9vf.js +120 -0
  148. package/dist/chunks/{persistent-pty-b7tctcvf.js → state-grxebm7t.js} +3 -3
  149. package/dist/chunks/{persistent-pty-kxet89mv.js → state-gysjbt8f.js} +3 -3
  150. package/dist/chunks/{persistent-pty-h12kt9pa.js → state-h12kt9pa.js} +2 -2
  151. package/dist/chunks/{persistent-pty-4s2xwh5d.js → state-h5wnyjzw.js} +4 -21
  152. package/dist/chunks/{persistent-pty-0tya1wfq.js → state-h8499ys5.js} +3 -3
  153. package/dist/chunks/{persistent-pty-h94zdhz8.js → state-h94zdhz8.js} +2 -2
  154. package/dist/chunks/{persistent-pty-tcptxgyq.js → state-hgr9y616.js} +1 -3
  155. package/dist/chunks/{persistent-pty-t4x64zgs.js → state-hjcbr714.js} +12 -4
  156. package/dist/chunks/{persistent-pty-hp6rpdnc.js → state-hp6rpdnc.js} +1 -1
  157. package/dist/chunks/{persistent-pty-ext14ctb.js → state-hptxbmcw.js} +48 -32
  158. package/dist/chunks/{persistent-pty-0687t5rp.js → state-hxcd35r2.js} +6 -6
  159. package/dist/chunks/{persistent-pty-zxcy6vhn.js → state-j0feex7e.js} +2 -2
  160. package/dist/chunks/{persistent-pty-krzvywyt.js → state-j0sncrp4.js} +5 -5
  161. package/dist/chunks/{persistent-pty-t0msbthe.js → state-j281xcgt.js} +3 -3
  162. package/dist/chunks/{persistent-pty-7hq60rpc.js → state-j29rhpt4.js} +10 -10
  163. package/dist/chunks/{persistent-pty-eeta29b7.js → state-k828h0dz.js} +4 -4
  164. package/dist/chunks/{persistent-pty-kg1345f7.js → state-kg1345f7.js} +1 -1
  165. package/dist/chunks/{persistent-pty-kp1t5rcy.js → state-kp1t5rcy.js} +1 -1
  166. package/dist/chunks/{persistent-pty-krsqcmnj.js → state-krsqcmnj.js} +1 -1
  167. package/dist/chunks/{persistent-pty-tayw3q5q.js → state-kse1g3vm.js} +79 -83
  168. package/dist/chunks/{persistent-pty-rttzjz69.js → state-m0t583rx.js} +2 -2
  169. package/dist/chunks/{persistent-pty-m55whf0h.js → state-m55whf0h.js} +2 -2
  170. package/dist/chunks/{persistent-pty-edmk8q4v.js → state-mdr0b99r.js} +8 -5
  171. package/dist/chunks/{persistent-pty-mf0hyk7z.js → state-mf0hyk7z.js} +1 -1
  172. package/dist/chunks/{persistent-pty-513bkrxw.js → state-mg2nmqys.js} +3 -3
  173. package/dist/chunks/{persistent-pty-w6dbrh59.js → state-mhk3rrcb.js} +7 -7
  174. package/dist/chunks/{persistent-pty-mnb85w6b.js → state-mnb85w6b.js} +2 -2
  175. package/dist/chunks/{persistent-pty-bysvf6ep.js → state-mwvdpwcp.js} +38 -44
  176. package/dist/chunks/{persistent-pty-mxjff6xk.js → state-mxjff6xk.js} +4 -4
  177. package/dist/chunks/{persistent-pty-mxvw03gv.js → state-mxvw03gv.js} +1 -1
  178. package/dist/chunks/{persistent-pty-ybp6xw39.js → state-myj58n64.js} +7 -7
  179. package/dist/chunks/{persistent-pty-854jnr3z.js → state-n3j6ek0z.js} +7 -7
  180. package/dist/chunks/{persistent-pty-d2k1eqgv.js → state-n4fxzf0c.js} +6 -6
  181. package/dist/chunks/{persistent-pty-hg1dj728.js → state-n7nsrdbk.js} +3 -3
  182. package/dist/chunks/{persistent-pty-3xa942qf.js → state-nf920z1m.js} +8 -8
  183. package/dist/chunks/{persistent-pty-2knkewgs.js → state-ngz3v23c.js} +3 -3
  184. package/dist/chunks/{persistent-pty-rz6kjcfr.js → state-np2sgr2t.js} +7 -7
  185. package/dist/chunks/{persistent-pty-nr76rjj3.js → state-nr76rjj3.js} +2 -2
  186. package/dist/chunks/{persistent-pty-ns0sdez7.js → state-ns0sdez7.js} +3 -3
  187. package/dist/chunks/{persistent-pty-jp7a1crg.js → state-nsb760q1.js} +6 -6
  188. package/dist/chunks/{persistent-pty-tpzhmg20.js → state-ny5bre0m.js} +6 -6
  189. package/dist/chunks/{persistent-pty-nzrjycs5.js → state-nzrjycs5.js} +1 -1
  190. package/dist/chunks/{persistent-pty-yq3dvva9.js → state-p7bctnjr.js} +4 -4
  191. package/dist/chunks/{persistent-pty-q6qnq55y.js → state-p9c8s57s.js} +3 -3
  192. package/dist/chunks/{persistent-pty-ayrkq19e.js → state-pbrq9pmc.js} +104 -78
  193. package/dist/chunks/{persistent-pty-pq4b4pqk.js → state-pq4b4pqk.js} +2 -2
  194. package/dist/chunks/{persistent-pty-83vcrt0q.js → state-pq4efbwz.js} +9 -9
  195. package/dist/chunks/{persistent-pty-q606pcse.js → state-q606pcse.js} +3 -3
  196. package/dist/chunks/{persistent-pty-qe0d689s.js → state-qe0d689s.js} +2 -2
  197. package/dist/chunks/{persistent-pty-318s80v9.js → state-qjfz0d3t.js} +4 -4
  198. package/dist/chunks/{persistent-pty-02s8hgfb.js → state-qnk6x8hc.js} +5 -5
  199. package/dist/chunks/{persistent-pty-d88p9jy9.js → state-qph0wk53.js} +2 -2
  200. package/dist/chunks/{persistent-pty-j39d0gcp.js → state-qyv2f15b.js} +19 -19
  201. package/dist/chunks/state-qzp632xx.js +483 -0
  202. package/dist/chunks/{persistent-pty-r13w8t0w.js → state-r13w8t0w.js} +2 -2
  203. package/dist/chunks/{persistent-pty-r3k9abhd.js → state-r3k9abhd.js} +2 -2
  204. package/dist/chunks/{persistent-pty-r9d3d23r.js → state-r9d3d23r.js} +1 -1
  205. package/dist/chunks/{persistent-pty-rahat93a.js → state-rahat93a.js} +1 -1
  206. package/dist/chunks/{persistent-pty-rbnp2c85.js → state-rbnp2c85.js} +3 -3
  207. package/dist/chunks/{persistent-pty-aj1419k0.js → state-rf120rew.js} +4 -4
  208. package/dist/chunks/{persistent-pty-j8t12rx3.js → state-rg042c41.js} +5 -5
  209. package/dist/chunks/{persistent-pty-7f6z5n6f.js → state-rg5dm0vs.js} +6 -8
  210. package/dist/chunks/{persistent-pty-bm9ah9hr.js → state-rjawwthv.js} +5 -5
  211. package/dist/chunks/{persistent-pty-8hsta5jz.js → state-rjnf462d.js} +91 -91
  212. package/dist/chunks/{persistent-pty-a25nnbkb.js → state-rrqrf7hs.js} +14 -14
  213. package/dist/chunks/state-rw00p5qk.js +330 -0
  214. package/dist/chunks/{persistent-pty-s2kjqxd3.js → state-s2kjqxd3.js} +1 -1
  215. package/dist/chunks/{persistent-pty-s33fw6zm.js → state-s33fw6zm.js} +1 -1
  216. package/dist/chunks/{persistent-pty-smpeg8c9.js → state-smpeg8c9.js} +2 -2
  217. package/dist/chunks/{persistent-pty-sw84ckhj.js → state-sw84ckhj.js} +1 -1
  218. package/dist/chunks/{persistent-pty-m6kd9m0n.js → state-sw91z7ka.js} +5 -5
  219. package/dist/chunks/{persistent-pty-jmn1sgkw.js → state-sxns5my2.js} +5 -5
  220. package/dist/chunks/{persistent-pty-9xg84z6j.js → state-sz7acswn.js} +4 -4
  221. package/dist/chunks/{persistent-pty-t14kykx1.js → state-t14kykx1.js} +1 -1
  222. package/dist/chunks/{persistent-pty-76wzch5c.js → state-t4jyzchx.js} +35 -35
  223. package/dist/chunks/{persistent-pty-hjndjhyq.js → state-t77pcxaw.js} +3 -3
  224. package/dist/chunks/{persistent-pty-zggp0jtk.js → state-tcxjymvf.js} +61 -61
  225. package/dist/chunks/{persistent-pty-4vx29khk.js → state-temtg8dy.js} +7 -7
  226. package/dist/chunks/{persistent-pty-bk1nj3vy.js → state-tfd8n8cn.js} +7 -7
  227. package/dist/chunks/{persistent-pty-tgbb2ckq.js → state-tgbb2ckq.js} +2 -2
  228. package/dist/chunks/{persistent-pty-thstd87d.js → state-thstd87d.js} +1 -1
  229. package/dist/chunks/{persistent-pty-tjrfm0xh.js → state-tjrfm0xh.js} +2 -2
  230. package/dist/chunks/{persistent-pty-f74fncf5.js → state-tk21pea4.js} +7 -6
  231. package/dist/chunks/{persistent-pty-y85nmh9b.js → state-v16fefw3.js} +11 -11
  232. package/dist/chunks/{persistent-pty-v2wshkax.js → state-v2wshkax.js} +1 -1
  233. package/dist/chunks/{persistent-pty-v80zsxnb.js → state-v80zsxnb.js} +1 -1
  234. package/dist/chunks/{persistent-pty-v972xay6.js → state-v972xay6.js} +1 -1
  235. package/dist/chunks/{persistent-pty-v9bfv94f.js → state-v9bfv94f.js} +1 -1
  236. package/dist/chunks/state-vcw3phwb.js +33 -0
  237. package/dist/chunks/{persistent-pty-vcwr2vpf.js → state-vcwr2vpf.js} +1 -1
  238. package/dist/chunks/{persistent-pty-wpak3cn2.js → state-vhxwmcne.js} +5 -7
  239. package/dist/chunks/{persistent-pty-agy32ytt.js → state-vpac0x8g.js} +5 -5
  240. package/dist/chunks/{persistent-pty-vqbmgfq1.js → state-vqbmgfq1.js} +3 -3
  241. package/dist/chunks/{persistent-pty-0xkrc3c3.js → state-vrg9c9q9.js} +4 -4
  242. package/dist/chunks/{persistent-pty-arfafmgx.js → state-vs78gshx.js} +6 -6
  243. package/dist/chunks/{persistent-pty-4n5anbj9.js → state-vwj18m7v.js} +3 -3
  244. package/dist/chunks/{persistent-pty-vz89hfgr.js → state-vz89hfgr.js} +1 -1
  245. package/dist/chunks/{persistent-pty-q6skr8rp.js → state-wavksq96.js} +8 -8
  246. package/dist/chunks/{persistent-pty-wbkt8qpj.js → state-wbkt8qpj.js} +1 -1
  247. package/dist/chunks/{persistent-pty-wmxdh12w.js → state-wmxdh12w.js} +1 -1
  248. package/dist/chunks/{persistent-pty-wps8gh8n.js → state-wps8gh8n.js} +2 -2
  249. package/dist/chunks/{persistent-pty-egt387mf.js → state-wzks8mfc.js} +5 -5
  250. package/dist/chunks/{persistent-pty-x89rah0x.js → state-x89rah0x.js} +1 -1
  251. package/dist/chunks/{persistent-pty-wr6wwww9.js → state-x9782t8s.js} +9 -9
  252. package/dist/chunks/{persistent-pty-xczfw7dq.js → state-xczfw7dq.js} +1 -1
  253. package/dist/chunks/{persistent-pty-xgv25zxy.js → state-xgv25zxy.js} +1 -1
  254. package/dist/chunks/{persistent-pty-xj0xhwdw.js → state-xj0xhwdw.js} +1 -1
  255. package/dist/chunks/{persistent-pty-wskcpn5r.js → state-xqsjgyve.js} +14 -14
  256. package/dist/chunks/{persistent-pty-xwftk1fd.js → state-xwftk1fd.js} +2 -2
  257. package/dist/chunks/{persistent-pty-xxpvz42q.js → state-xxpvz42q.js} +3 -3
  258. package/dist/chunks/{persistent-pty-y0x38cee.js → state-y0x38cee.js} +1 -1
  259. package/dist/chunks/{persistent-pty-y198y2ra.js → state-y198y2ra.js} +1 -1
  260. package/dist/chunks/{persistent-pty-y67x6rf6.js → state-y67x6rf6.js} +1 -1
  261. package/dist/chunks/{persistent-pty-2kyxeqh2.js → state-y84yndyz.js} +5 -4
  262. package/dist/chunks/{persistent-pty-twtt8bhh.js → state-y8hfmrbz.js} +6 -8
  263. package/dist/chunks/{persistent-pty-cqf8rezx.js → state-yh1c5vjh.js} +8 -8
  264. package/dist/chunks/{persistent-pty-by5251yx.js → state-yhxs0ds9.js} +76 -123
  265. package/dist/chunks/{persistent-pty-yf0knd5z.js → state-yt02w91s.js} +20 -21
  266. package/dist/chunks/{persistent-pty-3sj8e5dd.js → state-ywjbnhwf.js} +6 -6
  267. package/dist/chunks/{persistent-pty-1xq8v1tm.js → state-z2v2g0w5.js} +4 -4
  268. package/dist/chunks/{persistent-pty-zbqqnp0n.js → state-zbqqnp0n.js} +1 -1
  269. package/dist/chunks/{persistent-pty-zdkg1k91.js → state-zdkg1k91.js} +1 -1
  270. package/dist/chunks/{persistent-pty-dssj2s1h.js → state-zmwyjx4d.js} +16 -14
  271. package/dist/chunks/{persistent-pty-ym92bbkh.js → state-zqpaf5g0.js} +5 -5
  272. package/dist/chunks/{persistent-pty-fm2xjscy.js → state-zrdgbthy.js} +15 -15
  273. package/dist/chunks/{persistent-pty-zs1qer6v.js → state-zs1qer6v.js} +2 -2
  274. package/dist/chunks/{persistent-pty-zxe9jjhn.js → state-zxe9jjhn.js} +2 -2
  275. package/dist/chunks/{persistent-pty-mankezgy.js → state-zygzxh1b.js} +16 -6
  276. package/dist/codemode/catalog.js +2 -2
  277. package/dist/codemode/instructions.js +4 -4
  278. package/dist/codemode/tool.js +3 -3
  279. package/dist/command.js +70 -70
  280. package/dist/config/markdown.js +2 -2
  281. package/dist/config/normalize.js +20 -20
  282. package/dist/config/plugin/agent.js +132 -132
  283. package/dist/config/plugin/command.js +118 -118
  284. package/dist/config/plugin/compaction.js +146 -146
  285. package/dist/config/plugin/entry-observer.js +114 -114
  286. package/dist/config/plugin/formatter.js +119 -119
  287. package/dist/config/plugin/image.js +131 -131
  288. package/dist/config/plugin/instruction.js +90 -90
  289. package/dist/config/plugin/location-watcher.js +117 -117
  290. package/dist/config/plugin/mcp.js +127 -127
  291. package/dist/config/plugin/policy.js +116 -116
  292. package/dist/config/plugin/provider.js +115 -115
  293. package/dist/config/plugin/reference.js +119 -119
  294. package/dist/config/plugin/shell.js +118 -118
  295. package/dist/config/plugin/skill-file.js +103 -103
  296. package/dist/config/plugin/skill.js +135 -135
  297. package/dist/config/plugin/snapshot.js +117 -117
  298. package/dist/config/plugin/source.js +114 -114
  299. package/dist/config/plugin/tool-output.js +119 -119
  300. package/dist/config/plugin/websearch.js +115 -115
  301. package/dist/config/variable.js +4 -4
  302. package/dist/config.js +113 -113
  303. package/dist/credential/sql.js +3 -3
  304. package/dist/credential.js +71 -71
  305. package/dist/database/database.js +65 -65
  306. package/dist/database/drizzle/effect-sqlite/driver.js +13 -13
  307. package/dist/database/drizzle/effect-sqlite/index.js +13 -13
  308. package/dist/database/drizzle/effect-sqlite/session.js +12 -12
  309. package/dist/database/drizzle/index.js +14 -14
  310. package/dist/database/drizzle/internal/drizzle-utils.js +2 -2
  311. package/dist/database/drizzle/sqlite-core/effect/count.js +2 -2
  312. package/dist/database/drizzle/sqlite-core/effect/db.js +10 -10
  313. package/dist/database/drizzle/sqlite-core/effect/delete.js +3 -3
  314. package/dist/database/drizzle/sqlite-core/effect/index.js +19 -19
  315. package/dist/database/drizzle/sqlite-core/effect/insert.js +3 -3
  316. package/dist/database/drizzle/sqlite-core/effect/query.js +2 -2
  317. package/dist/database/drizzle/sqlite-core/effect/raw.js +2 -2
  318. package/dist/database/drizzle/sqlite-core/effect/select.js +3 -3
  319. package/dist/database/drizzle/sqlite-core/effect/session.js +11 -11
  320. package/dist/database/drizzle/sqlite-core/effect/update.js +3 -3
  321. package/dist/database/drizzle.js +15 -15
  322. package/dist/database/migration/20260127222353_familiar_lady_ursula.js +2 -2
  323. package/dist/database/migration/20260211171708_add_project_commands.js +2 -2
  324. package/dist/database/migration/20260213144116_wakeful_the_professor.js +2 -2
  325. package/dist/database/migration/20260225215848_workspace.js +2 -2
  326. package/dist/database/migration/20260227213759_add_session_workspace_id.js +2 -2
  327. package/dist/database/migration/20260228203230_blue_harpoon.js +2 -2
  328. package/dist/database/migration/20260303231226_add_workspace_fields.js +2 -2
  329. package/dist/database/migration/20260309230000_move_org_to_state.js +2 -2
  330. package/dist/database/migration/20260312043431_session_message_cursor.js +2 -2
  331. package/dist/database/migration/20260323234822_events.js +2 -2
  332. package/dist/database/migration/20260410174513_workspace-name.js +2 -2
  333. package/dist/database/migration/20260413175956_chief_energizer.js +2 -2
  334. package/dist/database/migration/20260423070820_add_icon_url_override.js +2 -2
  335. package/dist/database/migration/20260427172553_slow_nightmare.js +2 -2
  336. package/dist/database/migration/20260428004200_add_session_path.js +2 -2
  337. package/dist/database/migration/20260501142318_next_venus.js +2 -2
  338. package/dist/database/migration/20260504145000_add_sync_owner.js +2 -2
  339. package/dist/database/migration/20260507164347_add_workspace_time.js +2 -2
  340. package/dist/database/migration/20260510033149_session_usage.js +2 -2
  341. package/dist/database/migration/20260511000411_data_migration_state.js +2 -2
  342. package/dist/database/migration/20260511173437_session-metadata.js +2 -2
  343. package/dist/database/migration/20260601010001_normalize_storage_paths.js +2 -2
  344. package/dist/database/migration/20260601202201_amazing_prowler.js +2 -2
  345. package/dist/database/migration/20260602002951_lowly_union_jack.js +2 -2
  346. package/dist/database/migration/20260602182828_add_project_directories.js +2 -2
  347. package/dist/database/migration/20260603001617_session_message_projection_indexes.js +2 -2
  348. package/dist/database/migration/20260603040000_session_message_projection_order.js +2 -2
  349. package/dist/database/migration/20260603141458_session_input_inbox.js +2 -2
  350. package/dist/database/migration/20260603160727_jittery_ezekiel_stane.js +2 -2
  351. package/dist/database/migration/20260604172448_event_sourced_session_input.js +2 -2
  352. package/dist/database/migration/20260605003541_add_session_context_snapshot.js +2 -2
  353. package/dist/database/migration/20260605042240_add_context_epoch_agent.js +2 -2
  354. package/dist/database/migration/20260611035744_credential.js +2 -2
  355. package/dist/database/migration/20260611192811_lush_chimera.js +2 -2
  356. package/dist/database/migration/20260612174303_project_dir_strategy.js +2 -2
  357. package/dist/database/migration/20260622142730_simplify_session_context_epoch.js +2 -2
  358. package/dist/database/migration/20260622170816_reset_v2_session_state.js +2 -2
  359. package/dist/database/migration/20260622202450_simplify_session_input.js +2 -2
  360. package/dist/database/migration/20260804233008_loose_psylocke.js +2 -2
  361. package/dist/database/migration/20260805200742_import_legacy_credentials.js +2 -2
  362. package/dist/database/migration/20260808023530_workspace_domain.js +2 -2
  363. package/dist/database/migration/20260811161259_execution_claim_attempts.js +2 -2
  364. package/dist/database/migration/20260812181746_session_inbox.js +2 -2
  365. package/dist/database/migration/20260812213948_worktree.js +2 -2
  366. package/dist/database/migration/20260819222447_session_viewed_state.js +2 -2
  367. package/dist/database/migration/20260823191254_nullable_workspace_binding.js +2 -2
  368. package/dist/database/migration.gen.js +48 -48
  369. package/dist/database/migration.js +50 -50
  370. package/dist/database/path.js +3 -3
  371. package/dist/database/schema.gen.js +2 -2
  372. package/dist/database/schema.sql.js +2 -2
  373. package/dist/database/sqlite.bun.js +2 -2
  374. package/dist/database/sqlite.js +2 -2
  375. package/dist/database/sqlite.node.js +2 -2
  376. package/dist/database/sqlite.workerd.js +3 -3
  377. package/dist/database/v1-migration.bun.js +171 -174
  378. package/dist/database/v1-migration.js +2 -2
  379. package/dist/database/v1-migration.noop.js +1 -1
  380. package/dist/effect/app-node-builder.js +339 -333
  381. package/dist/effect/app-node-platform.js +3 -3
  382. package/dist/effect/keyed-mutex.js +2 -2
  383. package/dist/effect/websocket-constructor.js +2 -2
  384. package/dist/environment/driver.js +1 -1
  385. package/dist/environment/environment.js +91 -91
  386. package/dist/environment/exec-defaults.js +3 -3
  387. package/dist/environment/files.js +2 -2
  388. package/dist/environment/index.js +93 -93
  389. package/dist/environment/local.js +3 -3
  390. package/dist/environment/memory.js +3 -3
  391. package/dist/environment/unavailable.js +1 -1
  392. package/dist/event/sql.js +2 -2
  393. package/dist/event-logger.js +68 -68
  394. package/dist/file-mutation.js +92 -92
  395. package/dist/file-retention.js +2 -2
  396. package/dist/file.js +2 -2
  397. package/dist/filesystem/fff.bun.js +2 -2
  398. package/dist/filesystem/fff.js +2 -2
  399. package/dist/filesystem/fff.node.js +2 -2
  400. package/dist/filesystem/fff.workerd.js +2 -2
  401. package/dist/filesystem/ignore.js +1 -1
  402. package/dist/filesystem/location-watcher-policy.js +3 -3
  403. package/dist/filesystem/location-watcher.js +313 -309
  404. package/dist/filesystem/protected.js +2 -2
  405. package/dist/filesystem/search.js +96 -96
  406. package/dist/filesystem/watcher-binding.js +2 -2
  407. package/dist/filesystem/watcher.js +4 -4
  408. package/dist/filesystem.js +97 -97
  409. package/dist/form.js +69 -69
  410. package/dist/formatter/builtins.js +3 -3
  411. package/dist/formatter.js +85 -85
  412. package/dist/generate.js +84 -84
  413. package/dist/git.js +5 -5
  414. package/dist/github-copilot/chat/convert-to-openai-compatible-chat-messages.js +2 -2
  415. package/dist/github-copilot/chat/get-response-metadata.js +2 -2
  416. package/dist/github-copilot/chat/map-openai-compatible-finish-reason.js +2 -2
  417. package/dist/github-copilot/chat/openai-compatible-chat-language-model.js +8 -8
  418. package/dist/github-copilot/chat/openai-compatible-chat-options.js +2 -2
  419. package/dist/github-copilot/chat/openai-compatible-prepare-tools.js +2 -2
  420. package/dist/github-copilot/copilot-provider.js +18 -18
  421. package/dist/github-copilot/models.js +4 -4
  422. package/dist/github-copilot/openai-compatible-error.js +2 -2
  423. package/dist/github-copilot/responses/convert-to-openai-responses-input.js +2 -2
  424. package/dist/github-copilot/responses/map-openai-responses-finish-reason.js +2 -2
  425. package/dist/github-copilot/responses/openai-error.js +2 -2
  426. package/dist/github-copilot/responses/openai-responses-language-model.js +11 -11
  427. package/dist/github-copilot/responses/openai-responses-prepare-tools.js +10 -8
  428. package/dist/github-copilot/responses/tool/code-interpreter.js +2 -2
  429. package/dist/github-copilot/responses/tool/file-search.js +2 -2
  430. package/dist/github-copilot/responses/tool/image-generation.js +2 -2
  431. package/dist/github-copilot/responses/tool/web-search-preview.js +2 -2
  432. package/dist/github-copilot/responses/tool/web-search.js +2 -2
  433. package/dist/id/id.js +2 -2
  434. package/dist/image/photon-wasm.bun.js +1 -1
  435. package/dist/image/photon-wasm.node.js +1 -1
  436. package/dist/image/photon-wasm.workerd.js +1 -1
  437. package/dist/image/photon.js +107 -102
  438. package/dist/image.js +99 -99
  439. package/dist/instance.js +338 -332
  440. package/dist/instruction-discovery.js +72 -72
  441. package/dist/instructions/builtins.js +85 -86
  442. package/dist/instructions/index.js +2 -2
  443. package/dist/integration/connection.js +2 -2
  444. package/dist/integration.js +75 -75
  445. package/dist/job.js +72 -72
  446. package/dist/kv/sql.js +3 -3
  447. package/dist/kv.js +68 -68
  448. package/dist/location-activity.js +85 -85
  449. package/dist/location-mutation.js +84 -84
  450. package/dist/location-service-map.js +84 -84
  451. package/dist/location-services.js +339 -333
  452. package/dist/location.js +83 -83
  453. package/dist/mcp/client.js +97 -93
  454. package/dist/mcp/index.js +98 -98
  455. package/dist/mcp/instructions.js +127 -127
  456. package/dist/mcp/oauth.js +2 -2
  457. package/dist/mcp/stdio.js +92 -92
  458. package/dist/mime.js +2 -2
  459. package/dist/model-resolver.js +81 -81
  460. package/dist/model.js +3 -3
  461. package/dist/models-dev.js +75 -75
  462. package/dist/oauth/page.js +2 -2
  463. package/dist/permission/saved.js +71 -84
  464. package/dist/permission/sql.js +6 -6
  465. package/dist/permission.js +100 -100
  466. package/dist/persistent-pty/binary.bun.js +2 -2
  467. package/dist/persistent-pty/binary.node.js +1 -1
  468. package/dist/persistent-pty/binary.workerd.js +1 -1
  469. package/dist/persistent-pty/daemon.js +2 -2
  470. package/dist/persistent-pty/index.js +73 -73
  471. package/dist/persistent-pty/pty-binding.js +2 -2
  472. package/dist/persistent-pty.js +74 -74
  473. package/dist/plugin/agent.js +101 -101
  474. package/dist/plugin/command.js +99 -99
  475. package/dist/plugin/hooks.js +3 -3
  476. package/dist/plugin/host.js +202 -174
  477. package/dist/plugin/instance.js +2 -2
  478. package/dist/plugin/internal.js +307 -302
  479. package/dist/plugin/mcp-codemode-exclusion.js +2 -2
  480. package/dist/plugin/models-dev.js +76 -76
  481. package/dist/plugin/module.js +3 -3
  482. package/dist/plugin/plan.js +101 -101
  483. package/dist/plugin/promise.js +2 -2
  484. package/dist/plugin/provider/alibaba.js +3 -3
  485. package/dist/plugin/provider/amazon-bedrock.js +3 -3
  486. package/dist/plugin/provider/anthropic.js +3 -3
  487. package/dist/plugin/provider/azure.js +123 -123
  488. package/dist/plugin/provider/cerebras.js +3 -3
  489. package/dist/plugin/provider/cloudflare-ai-gateway.js +122 -122
  490. package/dist/plugin/provider/cloudflare-workers-ai.js +122 -122
  491. package/dist/plugin/provider/cohere.js +3 -3
  492. package/dist/plugin/provider/configured.js +119 -119
  493. package/dist/plugin/provider/dynamic.js +3 -3
  494. package/dist/plugin/provider/factory.js +2 -2
  495. package/dist/plugin/provider/gateway.js +3 -3
  496. package/dist/plugin/provider/github-copilot.js +82 -82
  497. package/dist/plugin/provider/gitlab.js +4 -4
  498. package/dist/plugin/provider/google-vertex.js +3 -3
  499. package/dist/plugin/provider/kilo.js +3 -3
  500. package/dist/plugin/provider/llmgateway.js +77 -77
  501. package/dist/plugin/provider/lmstudio.js +120 -120
  502. package/dist/plugin/provider/mistral.js +3 -3
  503. package/dist/plugin/provider/nvidia.js +3 -3
  504. package/dist/plugin/provider/ollama.js +120 -120
  505. package/dist/plugin/provider/openai-compatible.js +2 -2
  506. package/dist/plugin/provider/openai.js +79 -79
  507. package/dist/plugin/provider/opencode.js +93 -93
  508. package/dist/plugin/provider/openrouter.js +4 -4
  509. package/dist/plugin/provider/perplexity.js +3 -3
  510. package/dist/plugin/provider/sap-ai-core.js +4 -4
  511. package/dist/plugin/provider/sdk-factory.js +2 -2
  512. package/dist/plugin/provider/snowflake-cortex.js +3 -3
  513. package/dist/plugin/provider/venice.js +3 -3
  514. package/dist/plugin/provider/vercel.js +3 -3
  515. package/dist/plugin/provider/vllm.js +120 -120
  516. package/dist/plugin/provider/xai.js +78 -78
  517. package/dist/plugin/provider/zenmux.js +3 -3
  518. package/dist/plugin/provider.js +159 -159
  519. package/dist/plugin/runtime.js +190 -162
  520. package/dist/plugin/sdk.js +69 -69
  521. package/dist/plugin/skill.js +133 -133
  522. package/dist/plugin/source-directory.js +2 -2
  523. package/dist/plugin/supervisor-service.js +2 -2
  524. package/dist/plugin/supervisor.js +312 -308
  525. package/dist/plugin/system-prompt.js +2 -2
  526. package/dist/plugin/variant.js +3 -4
  527. package/dist/plugin/vcs/git.js +87 -85
  528. package/dist/plugin/vcs/hg.js +87 -85
  529. package/dist/plugin/warming.js +114 -115
  530. package/dist/plugin/websearch/exa.js +4 -4
  531. package/dist/plugin/websearch/firecrawl.js +5 -5
  532. package/dist/plugin/websearch/index.js +9 -9
  533. package/dist/plugin/websearch/mcp.js +3 -3
  534. package/dist/plugin/websearch/parallel.js +5 -5
  535. package/dist/plugin/websearch/tavily.js +3 -3
  536. package/dist/plugin.js +203 -175
  537. package/dist/project/markers.js +74 -74
  538. package/dist/project/schema.js +3 -3
  539. package/dist/project/sql.js +5 -5
  540. package/dist/project.js +82 -82
  541. package/dist/provider.js +2 -2
  542. package/dist/pty/protocol.js +1 -1
  543. package/dist/pty/pty.bun.js +1 -1
  544. package/dist/pty/pty.node.js +1 -1
  545. package/dist/pty/pty.workerd.js +1 -1
  546. package/dist/pty/schema.js +2 -2
  547. package/dist/pty/ticket.js +2 -70
  548. package/dist/pty.js +89 -89
  549. package/dist/reference/instructions.js +77 -77
  550. package/dist/reference.js +75 -75
  551. package/dist/repository-cache.js +7 -7
  552. package/dist/repository.js +2 -2
  553. package/dist/ripgrep/binary.js +3 -3
  554. package/dist/ripgrep.js +94 -94
  555. package/dist/schema.js +2 -2
  556. package/dist/session/compaction.js +118 -118
  557. package/dist/session/context.js +322 -318
  558. package/dist/session/environment.js +3 -3
  559. package/dist/session/error.js +26 -4
  560. package/dist/session/event.js +2 -2
  561. package/dist/session/execution/restart.js +201 -183
  562. package/dist/session/execution.js +122 -122
  563. package/dist/session/generate-node.js +323 -319
  564. package/dist/session/generate.js +2 -2
  565. package/dist/session/history.js +77 -77
  566. package/dist/session/inbox.js +86 -90
  567. package/dist/session/info.js +4 -4
  568. package/dist/session/instruction-entry.js +73 -73
  569. package/dist/session/instruction-state.js +10 -10
  570. package/dist/session/instructions.js +94 -94
  571. package/dist/session/message-updater.js +4 -4
  572. package/dist/session/message.js +2 -2
  573. package/dist/session/model-request.js +139 -139
  574. package/dist/session/model-transport.js +5 -5
  575. package/dist/session/projector.js +83 -83
  576. package/dist/session/prompt-node.js +320 -0
  577. package/dist/session/prompt.js +130 -0
  578. package/dist/session/revert-node.js +320 -0
  579. package/dist/session/revert.js +100 -95
  580. package/dist/session/run-coordinator.js +2 -2
  581. package/dist/session/runner/index.js +84 -84
  582. package/dist/session/runner/llm.js +328 -324
  583. package/dist/session/runner/max-steps.js +2 -2
  584. package/dist/session/runner/model.js +83 -83
  585. package/dist/session/runner/publish-llm-event.js +4 -4
  586. package/dist/session/runner/retry.js +74 -74
  587. package/dist/session/runner/step.js +148 -148
  588. package/dist/session/runner/to-llm-message.js +2 -2
  589. package/dist/session/schema.js +2 -2
  590. package/dist/session/session.js +181 -0
  591. package/dist/session/sql.js +6 -6
  592. package/dist/session/stats.js +72 -72
  593. package/dist/session/store.js +79 -79
  594. package/dist/session/subagent-completion.js +9 -0
  595. package/dist/session/system-prompt.js +2 -2
  596. package/dist/session/title.js +323 -319
  597. package/dist/session/to-session-error.js +113 -113
  598. package/dist/session/transfer.js +188 -165
  599. package/dist/session/usage.js +2 -2
  600. package/dist/session.js +196 -168
  601. package/dist/shell/parse.js +7 -7
  602. package/dist/shell/parser-wasm.bun.js +1 -1
  603. package/dist/shell/parser-wasm.node.js +1 -1
  604. package/dist/shell/parser-wasm.workerd.js +1 -1
  605. package/dist/shell/result.js +19 -0
  606. package/dist/shell/scan.js +1 -1
  607. package/dist/shell/select.js +4 -4
  608. package/dist/shell.js +132 -99
  609. package/dist/skill/discovery.js +3 -3
  610. package/dist/skill/instructions.js +102 -102
  611. package/dist/skill.js +101 -101
  612. package/dist/snapshot.js +85 -85
  613. package/dist/state.js +2 -2
  614. package/dist/tool/html-markdown.js +2 -2
  615. package/dist/tool/http-body.js +2 -2
  616. package/dist/tool/mcp.js +126 -126
  617. package/dist/tool/plugin/edit.js +113 -113
  618. package/dist/tool/plugin/file-diff.js +2 -2
  619. package/dist/tool/plugin/glob.js +116 -116
  620. package/dist/tool/plugin/grep.js +116 -116
  621. package/dist/tool/plugin/patch.js +113 -113
  622. package/dist/tool/plugin/question.js +102 -102
  623. package/dist/tool/plugin/read.js +119 -119
  624. package/dist/tool/plugin/shell.js +193 -190
  625. package/dist/tool/plugin/skill.js +102 -102
  626. package/dist/tool/plugin/subagent.js +192 -187
  627. package/dist/tool/plugin/webfetch.js +103 -103
  628. package/dist/tool/plugin/websearch.js +105 -105
  629. package/dist/tool/plugin/write.js +113 -113
  630. package/dist/tool/read-filesystem.js +99 -99
  631. package/dist/tool/runtime.js +2 -2
  632. package/dist/tool-output.js +5 -5
  633. package/dist/tool.js +119 -119
  634. package/dist/types/database/drizzle/effect-sqlite/driver.d.ts +7 -7
  635. package/dist/types/database/drizzle/sqlite-core/effect/insert.d.ts +0 -1
  636. package/dist/types/github-copilot/responses/openai-responses-prepare-tools.d.ts +9 -1
  637. package/dist/types/image/photon.d.ts +2 -7
  638. package/dist/types/instance.d.ts +2 -2
  639. package/dist/types/instructions/builtins.d.ts +2 -2
  640. package/dist/types/location-service-map.d.ts +2 -2
  641. package/dist/types/mcp/client.d.ts +3 -0
  642. package/dist/types/mcp/index.d.ts +2 -0
  643. package/dist/types/persistent-pty/index.d.ts +3 -22
  644. package/dist/types/plugin/host.d.ts +9 -19
  645. package/dist/types/plugin/runtime.d.ts +1 -1
  646. package/dist/types/plugin/variant.d.ts +1 -1
  647. package/dist/types/project.d.ts +1 -0
  648. package/dist/types/pty/ticket.d.ts +1 -1
  649. package/dist/types/session/error.d.ts +115 -0
  650. package/dist/types/session/execution.d.ts +2 -0
  651. package/dist/types/session/inbox.d.ts +557 -176
  652. package/dist/types/session/model-request.d.ts +3 -2
  653. package/dist/types/session/prompt-node.d.ts +3 -0
  654. package/dist/types/session/prompt.d.ts +126 -0
  655. package/dist/types/session/revert-node.d.ts +3 -0
  656. package/dist/types/session/revert.d.ts +24 -29
  657. package/dist/types/session/run-coordinator.d.ts +2 -0
  658. package/dist/types/session/runner/model.d.ts +6 -6
  659. package/dist/types/session/runner/publish-llm-event.d.ts +7 -5
  660. package/dist/types/session/runner/retry.d.ts +28 -4
  661. package/dist/types/session/runner/step.d.ts +21 -17
  662. package/dist/types/session/runner/to-llm-message.d.ts +1 -1
  663. package/dist/types/session/session.d.ts +232 -0
  664. package/dist/types/session/subagent-completion.d.ts +10 -0
  665. package/dist/types/session.d.ts +14 -141
  666. package/dist/types/shell/result.d.ts +54 -0
  667. package/dist/types/shell.d.ts +2 -0
  668. package/dist/types/skill.d.ts +1 -1
  669. package/dist/types/vcs.d.ts +12 -4
  670. package/dist/util/array.js +1 -1
  671. package/dist/util/error.js +2 -2
  672. package/dist/util/identifier.js +1 -1
  673. package/dist/util/iife.js +2 -2
  674. package/dist/util/lazy.js +2 -2
  675. package/dist/util/process-lock-ffi.bun.js +1 -1
  676. package/dist/util/process-lock-ffi.node.js +1 -1
  677. package/dist/util/process-lock-ffi.workerd.js +1 -1
  678. package/dist/util/process-lock.js +1 -1
  679. package/dist/util/slug.js +2 -2
  680. package/dist/util/token.js +2 -2
  681. package/dist/util/which.js +2 -2
  682. package/dist/util/wildcard.js +2 -2
  683. package/dist/v1/config/agent.js +4 -4
  684. package/dist/v1/config/attachment.js +3 -3
  685. package/dist/v1/config/command.js +2 -2
  686. package/dist/v1/config/config.js +15 -15
  687. package/dist/v1/config/error.js +3 -3
  688. package/dist/v1/config/formatter.js +2 -2
  689. package/dist/v1/config/layout.js +2 -2
  690. package/dist/v1/config/lsp.js +2 -2
  691. package/dist/v1/config/mcp.js +3 -3
  692. package/dist/v1/config/migrate.js +19 -19
  693. package/dist/v1/config/permission.js +2 -2
  694. package/dist/v1/config/plugin.js +2 -2
  695. package/dist/v1/config/provider-options.js +2 -2
  696. package/dist/v1/config/provider.js +3 -3
  697. package/dist/v1/config/server.js +3 -3
  698. package/dist/v1/config/skills.js +2 -2
  699. package/dist/v1/permission.js +1 -1
  700. package/dist/vcs/patch.js +2 -2
  701. package/dist/vcs.js +91 -87
  702. package/dist/websearch.js +73 -73
  703. package/dist/wellknown/plugin.js +73 -73
  704. package/dist/wellknown.js +72 -72
  705. package/dist/workspace/driver.js +2 -2
  706. package/dist/workspace/sql.js +2 -2
  707. package/dist/workspace.js +69 -69
  708. package/dist/worktree/directory.js +3 -3
  709. package/dist/worktree/git.js +7 -7
  710. package/dist/worktree/sql.js +6 -6
  711. package/dist/worktree.js +87 -87
  712. package/package.json +7 -7
  713. package/dist/chunks/persistent-pty-f01b69za.js +0 -115
  714. package/dist/chunks/persistent-pty-fb7nfzf2.js +0 -71
  715. package/dist/chunks/persistent-pty-q1jag6n4.js +0 -924
  716. package/dist/chunks/persistent-pty-tqf07m3e.js +0 -62
  717. package/dist/config/file.js +0 -128
  718. package/dist/types/config/file.d.ts +0 -17
  719. /package/dist/chunks/{persistent-pty-0cgt0xh2.js → state-0cgt0xh2.js} +0 -0
  720. /package/dist/chunks/{persistent-pty-0f48qthw.js → state-0f48qthw.js} +0 -0
  721. /package/dist/chunks/{persistent-pty-0zz82cjq.js → state-0zz82cjq.js} +0 -0
  722. /package/dist/chunks/{persistent-pty-1fb7bmpf.js → state-1fb7bmpf.js} +0 -0
  723. /package/dist/chunks/{persistent-pty-1wcz8fvj.js → state-1wcz8fvj.js} +0 -0
  724. /package/dist/chunks/{persistent-pty-29n7vfk2.js → state-29n7vfk2.js} +0 -0
  725. /package/dist/chunks/{persistent-pty-2qdx6zz3.js → state-2qdx6zz3.js} +0 -0
  726. /package/dist/chunks/{persistent-pty-2xb0r1c6.js → state-2xb0r1c6.js} +0 -0
  727. /package/dist/chunks/{persistent-pty-39ktntah.js → state-39ktntah.js} +0 -0
  728. /package/dist/chunks/{persistent-pty-3g3rpp2x.js → state-3g3rpp2x.js} +0 -0
  729. /package/dist/chunks/{persistent-pty-3w3ybtfd.js → state-3w3ybtfd.js} +0 -0
  730. /package/dist/chunks/{persistent-pty-47ty4mvs.js → state-47ty4mvs.js} +0 -0
  731. /package/dist/chunks/{persistent-pty-4b2tz2m9.js → state-4b2tz2m9.js} +0 -0
  732. /package/dist/chunks/{persistent-pty-5a5ch9ts.js → state-5a5ch9ts.js} +0 -0
  733. /package/dist/chunks/{persistent-pty-5va1yh78.js → state-5va1yh78.js} +0 -0
  734. /package/dist/chunks/{persistent-pty-61ek4hj9.js → state-61ek4hj9.js} +0 -0
  735. /package/dist/chunks/{persistent-pty-69qrqpw0.js → state-69qrqpw0.js} +0 -0
  736. /package/dist/chunks/{persistent-pty-6zqxzw0a.js → state-6zqxzw0a.js} +0 -0
  737. /package/dist/chunks/{persistent-pty-7n9qwqk4.js → state-7n9qwqk4.js} +0 -0
  738. /package/dist/chunks/{persistent-pty-8nn8kqcn.js → state-8nn8kqcn.js} +0 -0
  739. /package/dist/chunks/{persistent-pty-8rpfd2h6.js → state-8rpfd2h6.js} +0 -0
  740. /package/dist/chunks/{persistent-pty-8sj3ajy5.js → state-8sj3ajy5.js} +0 -0
  741. /package/dist/chunks/{persistent-pty-8w9tzfz1.js → state-8w9tzfz1.js} +0 -0
  742. /package/dist/chunks/{persistent-pty-906y0b6d.js → state-906y0b6d.js} +0 -0
  743. /package/dist/chunks/{persistent-pty-9dct5xhx.js → state-9dct5xhx.js} +0 -0
  744. /package/dist/chunks/{persistent-pty-9maxscqf.js → state-9maxscqf.js} +0 -0
  745. /package/dist/chunks/{persistent-pty-9sdtsapf.js → state-9sdtsapf.js} +0 -0
  746. /package/dist/chunks/{persistent-pty-a02svayp.js → state-a02svayp.js} +0 -0
  747. /package/dist/chunks/{persistent-pty-a83yvq99.js → state-a83yvq99.js} +0 -0
  748. /package/dist/chunks/{persistent-pty-ayevdmef.js → state-ayevdmef.js} +0 -0
  749. /package/dist/chunks/{persistent-pty-b02txbh8.js → state-b02txbh8.js} +0 -0
  750. /package/dist/chunks/{persistent-pty-bbqs2y60.js → state-bbqs2y60.js} +0 -0
  751. /package/dist/chunks/{persistent-pty-bjwj8hwv.js → state-bjwj8hwv.js} +0 -0
  752. /package/dist/chunks/{persistent-pty-brsh5f65.js → state-brsh5f65.js} +0 -0
  753. /package/dist/chunks/{persistent-pty-bxdhjb3y.js → state-bxdhjb3y.js} +0 -0
  754. /package/dist/chunks/{persistent-pty-c77ad0vh.js → state-c77ad0vh.js} +0 -0
  755. /package/dist/chunks/{persistent-pty-cm67rqy2.js → state-cm67rqy2.js} +0 -0
  756. /package/dist/chunks/{persistent-pty-df3v2q6j.js → state-df3v2q6j.js} +0 -0
  757. /package/dist/chunks/{persistent-pty-dhcq6c44.js → state-dhcq6c44.js} +0 -0
  758. /package/dist/chunks/{persistent-pty-dht5baf0.js → state-dht5baf0.js} +0 -0
  759. /package/dist/chunks/{persistent-pty-dkmkay92.js → state-dkmkay92.js} +0 -0
  760. /package/dist/chunks/{persistent-pty-ehj9csmv.js → state-ehj9csmv.js} +0 -0
  761. /package/dist/chunks/{persistent-pty-em6xpscd.js → state-em6xpscd.js} +0 -0
  762. /package/dist/chunks/{persistent-pty-emmqknsm.js → state-emmqknsm.js} +0 -0
  763. /package/dist/chunks/{persistent-pty-ezs3tagn.js → state-ezs3tagn.js} +0 -0
  764. /package/dist/chunks/{persistent-pty-f14r7hfz.js → state-f14r7hfz.js} +0 -0
  765. /package/dist/chunks/{persistent-pty-f1jj19e8.js → state-f1jj19e8.js} +0 -0
  766. /package/dist/chunks/{persistent-pty-f4cp4g4a.js → state-f4cp4g4a.js} +0 -0
  767. /package/dist/chunks/{persistent-pty-faypg4r1.js → state-faypg4r1.js} +0 -0
  768. /package/dist/chunks/{persistent-pty-fg7fz4q3.js → state-fg7fz4q3.js} +0 -0
  769. /package/dist/chunks/{persistent-pty-fgbfdq62.js → state-fgbfdq62.js} +0 -0
  770. /package/dist/chunks/{persistent-pty-gd5xeqc2.js → state-gd5xeqc2.js} +0 -0
  771. /package/dist/chunks/{persistent-pty-ghm4673n.js → state-ghm4673n.js} +0 -0
  772. /package/dist/chunks/{persistent-pty-ghwjy7my.js → state-ghwjy7my.js} +0 -0
  773. /package/dist/chunks/{persistent-pty-gy500k2r.js → state-gy500k2r.js} +0 -0
  774. /package/dist/chunks/{persistent-pty-hzeg9cfr.js → state-hzeg9cfr.js} +0 -0
  775. /package/dist/chunks/{persistent-pty-j07kk359.js → state-j07kk359.js} +0 -0
  776. /package/dist/chunks/{persistent-pty-j32vdj8r.js → state-j32vdj8r.js} +0 -0
  777. /package/dist/chunks/{persistent-pty-jqms80b0.js → state-jqms80b0.js} +0 -0
  778. /package/dist/chunks/{persistent-pty-jve7t217.js → state-jve7t217.js} +0 -0
  779. /package/dist/chunks/{persistent-pty-k3e42drn.js → state-k3e42drn.js} +0 -0
  780. /package/dist/chunks/{persistent-pty-k8b45nas.js → state-k8b45nas.js} +0 -0
  781. /package/dist/chunks/{persistent-pty-kpdbz7gn.js → state-kpdbz7gn.js} +0 -0
  782. /package/dist/chunks/{persistent-pty-kxy11nzk.js → state-kxy11nzk.js} +0 -0
  783. /package/dist/chunks/{persistent-pty-kyyqvx4s.js → state-kyyqvx4s.js} +0 -0
  784. /package/dist/chunks/{persistent-pty-m8cbvarh.js → state-m8cbvarh.js} +0 -0
  785. /package/dist/chunks/{persistent-pty-ma60vzgv.js → state-ma60vzgv.js} +0 -0
  786. /package/dist/chunks/{persistent-pty-n3m50c2t.js → state-n3m50c2t.js} +0 -0
  787. /package/dist/chunks/{persistent-pty-n6ag8q95.js → state-n6ag8q95.js} +0 -0
  788. /package/dist/chunks/{persistent-pty-nkm1m8dz.js → state-nkm1m8dz.js} +0 -0
  789. /package/dist/chunks/{persistent-pty-nsc0c3zb.js → state-nsc0c3zb.js} +0 -0
  790. /package/dist/chunks/{persistent-pty-qaarhjrp.js → state-qaarhjrp.js} +0 -0
  791. /package/dist/chunks/{persistent-pty-qc167nrn.js → state-qc167nrn.js} +0 -0
  792. /package/dist/chunks/{persistent-pty-qp95y4jb.js → state-qp95y4jb.js} +0 -0
  793. /package/dist/chunks/{persistent-pty-r8f4w671.js → state-r8f4w671.js} +0 -0
  794. /package/dist/chunks/{persistent-pty-rdfev9jy.js → state-rdfev9jy.js} +0 -0
  795. /package/dist/chunks/{persistent-pty-rvfvac9x.js → state-rvfvac9x.js} +0 -0
  796. /package/dist/chunks/{persistent-pty-s7whb9gt.js → state-s7whb9gt.js} +0 -0
  797. /package/dist/chunks/{persistent-pty-se76j685.js → state-se76j685.js} +0 -0
  798. /package/dist/chunks/{persistent-pty-sem2g21k.js → state-sem2g21k.js} +0 -0
  799. /package/dist/chunks/{persistent-pty-sp575ygv.js → state-sp575ygv.js} +0 -0
  800. /package/dist/chunks/{persistent-pty-tmb1f636.js → state-tmb1f636.js} +0 -0
  801. /package/dist/chunks/{persistent-pty-ttxf0gsy.js → state-ttxf0gsy.js} +0 -0
  802. /package/dist/chunks/{persistent-pty-tvmhrvfj.js → state-tvmhrvfj.js} +0 -0
  803. /package/dist/chunks/{persistent-pty-v2adqbbe.js → state-v2adqbbe.js} +0 -0
  804. /package/dist/chunks/{persistent-pty-vac9eqd2.js → state-vac9eqd2.js} +0 -0
  805. /package/dist/chunks/{persistent-pty-wj4sxzqa.js → state-wj4sxzqa.js} +0 -0
  806. /package/dist/chunks/{persistent-pty-wwntjmk1.js → state-wwntjmk1.js} +0 -0
  807. /package/dist/chunks/{persistent-pty-wyqjaaa5.js → state-wyqjaaa5.js} +0 -0
  808. /package/dist/chunks/{persistent-pty-x4q807cx.js → state-x4q807cx.js} +0 -0
  809. /package/dist/chunks/{persistent-pty-yrqrg4vp.js → state-yrqrg4vp.js} +0 -0
  810. /package/dist/chunks/{persistent-pty-z47nswr2.js → state-z47nswr2.js} +0 -0
  811. /package/dist/chunks/{persistent-pty-zsf8rs93.js → state-zsf8rs93.js} +0 -0
@@ -1,924 +0,0 @@
1
- import {
2
- exports_execution
3
- } from "./persistent-pty-dssj2s1h.js";
4
- import {
5
- exports_generate
6
- } from "./persistent-pty-xgv25zxy.js";
7
- import {
8
- exports_revert
9
- } from "./persistent-pty-f01b69za.js";
10
- import {
11
- exports_projector
12
- } from "./persistent-pty-jmntmgq9.js";
13
- import {
14
- exports_instruction_entry
15
- } from "./persistent-pty-8n5xz4y2.js";
16
- import {
17
- exports_inbox
18
- } from "./persistent-pty-ayrkq19e.js";
19
- import {
20
- exports_model_transport
21
- } from "./persistent-pty-tjrfm0xh.js";
22
- import {
23
- exports_supervisor_service
24
- } from "./persistent-pty-s33fw6zm.js";
25
- import {
26
- exports_job
27
- } from "./persistent-pty-rz6kjcfr.js";
28
- import {
29
- Slug
30
- } from "./persistent-pty-df3v2q6j.js";
31
- import {
32
- exports_location_service_map
33
- } from "./persistent-pty-zdkg1k91.js";
34
- import {
35
- exports_mime
36
- } from "./persistent-pty-dhphtf1x.js";
37
- import {
38
- exports_command
39
- } from "./persistent-pty-4n5anbj9.js";
40
- import {
41
- exports_image
42
- } from "./persistent-pty-9kqpqjvx.js";
43
- import {
44
- exports_shell
45
- } from "./persistent-pty-ngph9rhx.js";
46
- import {
47
- exports_environment
48
- } from "./persistent-pty-6ky7rqk7.js";
49
- import {
50
- exports_app
51
- } from "./persistent-pty-50jxp3hw.js";
52
- import {
53
- exports_skill
54
- } from "./persistent-pty-9xg84z6j.js";
55
- import {
56
- exports_store
57
- } from "./persistent-pty-bk1nj3vy.js";
58
- import {
59
- fromRow
60
- } from "./persistent-pty-264e1nfp.js";
61
- import {
62
- exports_history
63
- } from "./persistent-pty-y85nmh9b.js";
64
- import {
65
- exports_instruction_state
66
- } from "./persistent-pty-0687t5rp.js";
67
- import {
68
- ForkEmptyError,
69
- MessageDecodeError,
70
- NotFoundError
71
- } from "./persistent-pty-fb7nfzf2.js";
72
- import {
73
- SessionMessageTable,
74
- SessionTable
75
- } from "./persistent-pty-q606pcse.js";
76
- import {
77
- SessionMessage
78
- } from "./persistent-pty-8rpfd2h6.js";
79
- import {
80
- SessionEvent
81
- } from "./persistent-pty-a83yvq99.js";
82
- import {
83
- exports_hooks
84
- } from "./persistent-pty-v2wshkax.js";
85
- import {
86
- ID,
87
- Info,
88
- SessionSchema
89
- } from "./persistent-pty-bjwj8hwv.js";
90
- import {
91
- exports_location
92
- } from "./persistent-pty-d88p9jy9.js";
93
- import {
94
- exports_project
95
- } from "./persistent-pty-wr6wwww9.js";
96
- import {
97
- upsertProject
98
- } from "./persistent-pty-c8ya26sa.js";
99
- import {
100
- AbsolutePath,
101
- PositiveInt,
102
- RelativePath
103
- } from "./persistent-pty-j07kk359.js";
104
- import {
105
- exports_bus
106
- } from "./persistent-pty-8dqs26x1.js";
107
- import {
108
- exports_database
109
- } from "./persistent-pty-agy32ytt.js";
110
- import {
111
- exports_keyed_mutex
112
- } from "./persistent-pty-0kvmztkf.js";
113
- import {
114
- __export
115
- } from "./persistent-pty-rvfvac9x.js";
116
-
117
- // src/session.ts
118
- var exports_session = {};
119
- __export(exports_session, {
120
- node: () => node,
121
- SyntheticConflictError: () => SyntheticConflictError,
122
- SkillNotFoundError: () => SkillNotFoundError,
123
- SessionSchema: () => SessionSchema,
124
- Session: () => exports_session,
125
- Service: () => Service,
126
- PromptConflictError: () => PromptConflictError,
127
- NotFoundError: () => NotFoundError,
128
- MessageToolIncompleteError: () => MessageToolIncompleteError,
129
- MessageNotFoundError: () => MessageNotFoundError,
130
- MessageNotAssistantError: () => MessageNotAssistantError,
131
- MessageIncompleteError: () => MessageIncompleteError,
132
- MessageDecodeError: () => MessageDecodeError,
133
- ListInput: () => ListInput,
134
- ListAnchor: () => ListAnchor,
135
- Info: () => Info,
136
- InboxConflictError: () => InboxConflictError,
137
- ID: () => ID,
138
- DestinationUnavailableError: () => DestinationUnavailableError,
139
- DestinationNotFoundError: () => DestinationNotFoundError,
140
- DestinationNotDirectoryError: () => DestinationNotDirectoryError,
141
- CompactionConflictError: () => CompactionConflictError,
142
- BusyError: () => BusyError,
143
- AttachmentError: () => AttachmentError
144
- });
145
- import { Cause, Effect, Layer, Schema, Context, RcMap, Stream, Scope } from "effect";
146
- import { ListAnchor } from "@opencode-ai/schema/session";
147
- import { and, asc, desc, eq, gt, isNull, like, lt, or } from "drizzle-orm";
148
- import { Workspace } from "@opencode-ai/schema/workspace";
149
- import { Model } from "@opencode-ai/schema/model";
150
- import { Base64, FileAttachment, Prompt } from "@opencode-ai/schema/prompt";
151
- import path from "path";
152
- import { makeGlobalNode } from "@opencode-ai/util/effect/app-node";
153
- import { FSUtil } from "@opencode-ai/util/fs-util";
154
- import { Event } from "@opencode-ai/schema/event";
155
- import { Global } from "@opencode-ai/util/global";
156
- import { fileURLToPath } from "url";
157
- var ListInputBase = {
158
- workspaceID: Workspace.ID.pipe(Schema.optional),
159
- search: Schema.String.pipe(Schema.optional),
160
- limit: PositiveInt.pipe(Schema.optional),
161
- order: Schema.Literals(["asc", "desc"]).pipe(Schema.optional),
162
- parentID: Schema.NullOr(SessionSchema.ID).pipe(Schema.optional),
163
- anchor: ListAnchor.pipe(Schema.optional)
164
- };
165
- var ListDirectoryInput = Schema.Struct({
166
- ...ListInputBase,
167
- directory: AbsolutePath
168
- });
169
- var ListProjectInput = Schema.Struct({
170
- ...ListInputBase,
171
- project: exports_project.ID,
172
- subpath: RelativePath.pipe(Schema.optional)
173
- });
174
- var ListAllInput = Schema.Struct(ListInputBase);
175
- var ListInput = Schema.Union([ListDirectoryInput, ListProjectInput, ListAllInput]);
176
- class PromptConflictError extends Schema.TaggedError()("Session.PromptConflictError", {
177
- sessionID: SessionSchema.ID,
178
- messageID: SessionMessage.ID
179
- }) {
180
- }
181
-
182
- class SyntheticConflictError extends Schema.TaggedError()("Session.SyntheticConflictError", {
183
- sessionID: SessionSchema.ID,
184
- inputID: SessionMessage.ID
185
- }) {
186
- }
187
-
188
- class AttachmentError extends Schema.TaggedError()("Session.AttachmentError", {
189
- uri: Schema.String,
190
- message: Schema.String
191
- }) {
192
- }
193
-
194
- class CompactionConflictError extends Schema.TaggedError()("Session.CompactionConflictError", {
195
- sessionID: SessionSchema.ID,
196
- inputID: SessionMessage.ID
197
- }) {
198
- }
199
-
200
- class BusyError extends Schema.TaggedError()("Session.BusyError", {
201
- sessionID: SessionSchema.ID
202
- }) {
203
- }
204
-
205
- class MessageNotAssistantError extends Schema.TaggedError()("Session.MessageNotAssistantError", {
206
- sessionID: SessionSchema.ID,
207
- messageID: SessionMessage.ID
208
- }) {
209
- }
210
-
211
- class MessageIncompleteError extends Schema.TaggedError()("Session.MessageIncompleteError", {
212
- sessionID: SessionSchema.ID,
213
- messageID: SessionMessage.ID
214
- }) {
215
- }
216
-
217
- class MessageToolIncompleteError extends Schema.TaggedError()("Session.MessageToolIncompleteError", {
218
- sessionID: SessionSchema.ID,
219
- messageID: SessionMessage.ID
220
- }) {
221
- }
222
-
223
- class InboxConflictError extends Schema.TaggedError()("Session.InboxConflictError", {
224
- sessionID: SessionSchema.ID,
225
- inboxID: SessionMessage.ID
226
- }) {
227
- }
228
-
229
- class SkillNotFoundError extends Schema.TaggedError()("Session.SkillNotFoundError", {
230
- skill: exports_skill.ID
231
- }) {
232
- }
233
-
234
- class DestinationNotFoundError extends Schema.TaggedError()("Session.DestinationNotFoundError", { directory: AbsolutePath }) {
235
- }
236
-
237
- class DestinationNotDirectoryError extends Schema.TaggedError()("Session.DestinationNotDirectoryError", { directory: AbsolutePath }) {
238
- }
239
-
240
- class DestinationUnavailableError extends Schema.TaggedError()("Session.DestinationUnavailableError", { directory: AbsolutePath }) {
241
- }
242
- var MessageNotFoundError = exports_revert.MessageNotFoundError;
243
-
244
- class Service extends Context.Service()("@opencode/Session") {
245
- }
246
- var layer = Layer.effect(Service, Effect.gen(function* () {
247
- const app = yield* exports_app.Metadata;
248
- const database = yield* exports_database.Service;
249
- const db = database.db;
250
- const bus = yield* exports_bus.Service;
251
- const projects = yield* exports_project.Service;
252
- const global = yield* Global.Service;
253
- const execution = yield* exports_execution.Service;
254
- const store = yield* exports_store.Service;
255
- const locations = yield* exports_location_service_map.Service;
256
- const fs = yield* FSUtil.Service;
257
- const jobs = yield* exports_job.Service;
258
- const environments = yield* exports_environment.Service;
259
- const scope = yield* Scope.Scope;
260
- const activeShells = new Set;
261
- const shellLocks = exports_keyed_mutex.makeUnsafe();
262
- const closeTransport = Effect.fn("Session.closeTransport")(function* (session) {
263
- const location = exports_location.Ref.make({
264
- directory: session.location.directory,
265
- workspaceID: session.location.workspaceID
266
- });
267
- if (!(yield* RcMap.has(locations.rcMap, location)))
268
- return;
269
- yield* exports_model_transport.Service.use((transport) => transport.close(session.id)).pipe(Effect.provide(locations.get(location)));
270
- });
271
- const isDurableSessionEvent = Schema.is(SessionEvent.Durable);
272
- const persistProject = (project) => upsertProject(db, project).pipe(Effect.orDie);
273
- const pendingConflict = Effect.fn("Session.pendingConflict")(function* (input) {
274
- yield* result.get(input.sessionID);
275
- return yield* new InboxConflictError(input);
276
- });
277
- const mutatePending = (input, mutation, wake = false) => Effect.uninterruptible(Effect.gen(function* () {
278
- yield* mutation(bus, { sessionID: input.sessionID, id: input.inboxID }).pipe(Effect.catchDefect((defect) => defect instanceof exports_inbox.LifecycleConflict ? pendingConflict(input) : Effect.die(defect)));
279
- if (wake)
280
- yield* execution.wake(input.sessionID);
281
- }));
282
- const result = Service.of({
283
- create: Effect.fn("Session.create")(function* (input) {
284
- const sessionID = input.id ?? SessionSchema.ID.create();
285
- const recorded = yield* store.get(sessionID);
286
- if (recorded)
287
- return recorded;
288
- const parent = input.parentID ? yield* store.get(input.parentID) : undefined;
289
- if (input.parentID && parent === undefined)
290
- return yield* new NotFoundError({ sessionID: input.parentID });
291
- const location = parent?.location ?? input.location;
292
- if (location === undefined)
293
- return yield* Effect.die(new Error("Session.create requires either location or an existing parentID"));
294
- const project = yield* projects.resolve(location.directory);
295
- yield* persistProject(project);
296
- const projected = yield* bus.publish(SessionEvent.Created, {
297
- sessionID,
298
- slug: Slug.create(),
299
- version: app.version,
300
- projectID: project.id,
301
- parentID: input.parentID,
302
- location,
303
- subpath: RelativePath.make(path.relative(project.directory, location.directory).replaceAll("\\", "/")),
304
- title: input.title,
305
- agent: input.agent,
306
- metadata: input.metadata ?? parent?.metadata,
307
- model: input.model ? {
308
- id: Model.ID.make(input.model.id),
309
- providerID: input.model.providerID,
310
- variant: input.model.variant
311
- } : undefined
312
- }, { location }).pipe(Effect.as({ type: "created" }), Effect.catchDefect((defect) => {
313
- if (!(defect instanceof exports_projector.SessionAlreadyProjected)) {
314
- return Effect.die(defect);
315
- }
316
- return store.get(sessionID).pipe(Effect.flatMap((session) => session ? Effect.succeed({ type: "existing", session }) : Effect.die(defect)));
317
- }));
318
- if (projected.type === "existing")
319
- return projected.session;
320
- return yield* result.get(sessionID).pipe(Effect.orDie);
321
- }),
322
- fork: Effect.fn("Session.fork")(function* (input) {
323
- const parent = yield* result.get(input.sessionID);
324
- const boundary = yield* db.select({ id: SessionMessageTable.id }).from(SessionMessageTable).where(and(eq(SessionMessageTable.session_id, input.sessionID), input.boundary.type === "before" ? eq(SessionMessageTable.id, input.boundary.messageID) : undefined)).orderBy(desc(SessionMessageTable.seq)).limit(1).get().pipe(Effect.orDie);
325
- if (!boundary && input.boundary.type === "before")
326
- return yield* new MessageNotFoundError({
327
- sessionID: input.sessionID,
328
- messageID: input.boundary.messageID
329
- });
330
- if (!boundary)
331
- return yield* new ForkEmptyError({ sessionID: input.sessionID });
332
- const sessionID = SessionSchema.ID.create();
333
- const inherited = yield* db.transaction(() => Effect.all({
334
- instructions: exports_instruction_state.current(db, parent.id),
335
- instructionEntries: exports_instruction_entry.snapshot(db, parent.id)
336
- })).pipe(Effect.orDie);
337
- yield* bus.publish(SessionEvent.Forked, {
338
- sessionID,
339
- parentID: parent.id,
340
- boundary: { ...input.boundary, messageID: boundary.id },
341
- ...inherited
342
- });
343
- return yield* result.get(sessionID).pipe(Effect.orDie);
344
- }),
345
- get: Effect.fn("Session.get")(function* (sessionID) {
346
- const session = yield* store.get(sessionID);
347
- if (!session)
348
- return yield* new NotFoundError({ sessionID });
349
- return session;
350
- }),
351
- environment: Effect.fn("Session.environment")(function* (input) {
352
- yield* result.get(input.sessionID);
353
- if (input.variables !== undefined)
354
- yield* environments.set(input.sessionID, input.variables);
355
- return yield* environments.get(input.sessionID);
356
- }),
357
- view: Effect.fn("Session.view")(function* (input) {
358
- const row = yield* db.select({ idle: SessionTable.time_idle, viewed: SessionTable.time_viewed }).from(SessionTable).where(eq(SessionTable.id, input.sessionID)).get().pipe(Effect.orDie);
359
- if (!row)
360
- return yield* new NotFoundError({ sessionID: input.sessionID });
361
- if (row.idle === null || input.idle > row.idle || row.viewed !== null && row.viewed >= input.idle)
362
- return yield* Effect.void;
363
- yield* bus.publish(SessionEvent.Viewed, { sessionID: input.sessionID, idle: input.idle });
364
- }),
365
- remove: Effect.fn("Session.remove")(function* (sessionID) {
366
- const session = yield* result.get(sessionID);
367
- yield* execution.interrupt(sessionID);
368
- yield* execution.awaitIdle(sessionID);
369
- yield* closeTransport(session);
370
- const children = yield* result.list({ parentID: sessionID });
371
- yield* Effect.forEach(children.data, (child) => result.remove(child.id), { concurrency: 1, discard: true });
372
- yield* environments.clear(sessionID);
373
- yield* bus.publish(SessionEvent.Deleted, { sessionID });
374
- yield* bus.remove(sessionID);
375
- }),
376
- list: Effect.fn("Session.list")(function* (input = {}) {
377
- const direction = input.anchor?.direction ?? "next";
378
- const requestedOrder = input.order ?? "desc";
379
- const order = direction === "previous" ? requestedOrder === "asc" ? "desc" : "asc" : requestedOrder;
380
- const sortColumn = SessionTable.time_updated;
381
- const conditions = [];
382
- if ("directory" in input)
383
- conditions.push(eq(SessionTable.directory, input.directory));
384
- if (input.workspaceID)
385
- conditions.push(eq(SessionTable.workspace_id, input.workspaceID));
386
- if ("project" in input)
387
- conditions.push(eq(SessionTable.project_id, input.project));
388
- if ("project" in input && input.subpath !== undefined)
389
- conditions.push(eq(SessionTable.path, input.subpath));
390
- if (input.search)
391
- conditions.push(like(SessionTable.title, `%${input.search}%`));
392
- if (input.parentID !== undefined)
393
- conditions.push(input.parentID === null ? isNull(SessionTable.parent_id) : eq(SessionTable.parent_id, input.parentID));
394
- if (input.anchor) {
395
- conditions.push(order === "asc" ? or(gt(sortColumn, input.anchor.time), and(eq(sortColumn, input.anchor.time), gt(SessionTable.id, input.anchor.id))) : or(lt(sortColumn, input.anchor.time), and(eq(sortColumn, input.anchor.time), lt(SessionTable.id, input.anchor.id))));
396
- }
397
- const query = db.select().from(SessionTable).where(conditions.length > 0 ? and(...conditions) : undefined).orderBy(order === "asc" ? asc(sortColumn) : desc(sortColumn), order === "asc" ? asc(SessionTable.id) : desc(SessionTable.id));
398
- const rows = yield* (input.limit === undefined ? query.all() : query.limit(input.limit).all()).pipe(Effect.orDie);
399
- return { data: (direction === "previous" ? rows.toReversed() : rows).map((row) => fromRow(row)) };
400
- }),
401
- messages: Effect.fn("Session.messages")(function* (input) {
402
- yield* result.get(input.sessionID);
403
- const direction = input.cursor?.direction ?? "next";
404
- const requestedOrder = input.order ?? "desc";
405
- const order = direction === "previous" ? requestedOrder === "asc" ? "desc" : "asc" : requestedOrder;
406
- const anchor = input.cursor ? yield* db.select({ seq: SessionMessageTable.seq }).from(SessionMessageTable).where(and(eq(SessionMessageTable.session_id, input.sessionID), eq(SessionMessageTable.id, input.cursor.id))).get().pipe(Effect.orDie) : undefined;
407
- if (input.cursor && !anchor)
408
- return [];
409
- const boundary = anchor ? order === "asc" ? gt(SessionMessageTable.seq, anchor.seq) : lt(SessionMessageTable.seq, anchor.seq) : undefined;
410
- const where = boundary ? and(eq(SessionMessageTable.session_id, input.sessionID), boundary) : eq(SessionMessageTable.session_id, input.sessionID);
411
- const query = db.select().from(SessionMessageTable).where(where).orderBy(order === "asc" ? asc(SessionMessageTable.seq) : desc(SessionMessageTable.seq));
412
- const rows = yield* (input.limit === undefined ? query.all() : query.limit(input.limit).all()).pipe(Effect.orDie);
413
- return yield* Effect.forEach(direction === "previous" ? rows.toReversed() : rows, exports_history.decodeMessageRow);
414
- }),
415
- message: Effect.fn("Session.message")(function* (input) {
416
- const stored = yield* store.message(input.messageID);
417
- return stored?.sessionID === input.sessionID ? stored.message : undefined;
418
- }),
419
- updateMessage: Effect.fn("Session.updateMessage")(function* (input) {
420
- const ref = { sessionID: input.sessionID, messageID: input.messageID };
421
- yield* result.get(ref.sessionID);
422
- if ((yield* execution.active).has(ref.sessionID))
423
- return yield* new BusyError({ sessionID: ref.sessionID });
424
- const message = yield* result.message(ref);
425
- if (!message)
426
- return yield* new MessageNotFoundError(ref);
427
- if (message.type !== "assistant")
428
- return yield* new MessageNotAssistantError(ref);
429
- if (!message.time.completed)
430
- return yield* new MessageIncompleteError(ref);
431
- if (input.content.some((content) => content.type === "tool" && (content.state.status === "streaming" || content.state.status === "running")))
432
- return yield* new MessageToolIncompleteError(ref);
433
- yield* bus.publish(SessionEvent.MessageContentUpdated, {
434
- ...ref,
435
- content: Schema.encodeSync(Schema.Array(SessionMessage.AssistantContent))(input.content)
436
- });
437
- const updated = yield* result.message(ref);
438
- if (updated?.type !== "assistant")
439
- return yield* new MessageNotFoundError(ref);
440
- return updated;
441
- }),
442
- context: Effect.fn("Session.context")(function* (sessionID) {
443
- yield* result.get(sessionID);
444
- return yield* store.context(sessionID);
445
- }),
446
- inbox: Effect.fn("Session.inbox")(function* (sessionID) {
447
- yield* result.get(sessionID);
448
- return yield* exports_inbox.list(db, sessionID);
449
- }),
450
- cancelInbox: Effect.fn("Session.cancelInbox")((input) => mutatePending(input, exports_inbox.cancel)),
451
- steerInbox: Effect.fn("Session.steerInbox")((input) => mutatePending(input, exports_inbox.steer, true)),
452
- queueInbox: Effect.fn("Session.queueInbox")((input) => mutatePending(input, exports_inbox.queue)),
453
- log: (input) => Stream.unwrap(result.get(input.sessionID).pipe(Effect.as(bus.log({ aggregateID: input.sessionID, after: input.after, follow: input.follow })))).pipe(Stream.filter((item) => exports_bus.isSynced(item) || isDurableSessionEvent(item))),
454
- prompt: Effect.fn("Session.prompt")((input) => Effect.uninterruptibleMask((restore) => Effect.gen(function* () {
455
- const session = yield* result.get(input.sessionID);
456
- const messageID = input.id ?? SessionMessage.ID.create();
457
- const admitted = yield* Effect.gen(function* () {
458
- const existing = yield* exports_inbox.reconcile(db, {
459
- id: messageID,
460
- sessionID: session.id,
461
- delivery: input.delivery ?? "steer"
462
- });
463
- if (existing)
464
- return existing;
465
- const item = yield* restore(preparePrompt(input, messageID).pipe(Effect.provide(locations.get(session.location)), Effect.provideService(FSUtil.Service, fs)));
466
- if (session.revert)
467
- yield* exports_revert.commit(session).pipe(Effect.provideService(exports_bus.Service, bus));
468
- return yield* exports_inbox.admit(db, bus, {
469
- id: messageID,
470
- sessionID: session.id,
471
- item
472
- });
473
- }).pipe(Effect.catchDefect((defect) => defect instanceof exports_inbox.LifecycleConflict ? new PromptConflictError({ sessionID: input.sessionID, messageID }) : Effect.die(defect)));
474
- if (admitted.type !== "user" || admitted.sessionID !== input.sessionID)
475
- return yield* new PromptConflictError({ sessionID: input.sessionID, messageID });
476
- if (input.resume !== false) {
477
- if (activeShells.has(admitted.sessionID))
478
- return admitted;
479
- yield* execution.wake(admitted.sessionID);
480
- }
481
- return admitted;
482
- }))),
483
- generate: Effect.fn("Session.generate")(function* (input) {
484
- const session = yield* result.get(input.sessionID);
485
- const generate = yield* exports_generate.Service.pipe(Effect.provide(locations.get(session.location)));
486
- return yield* generate.generate(input);
487
- }),
488
- command: Effect.fn("Session.command")(function* (input) {
489
- const session = yield* result.get(input.sessionID);
490
- const commands = yield* Effect.gen(function* () {
491
- const plugins = yield* exports_supervisor_service.Service;
492
- yield* plugins.flush;
493
- return yield* exports_command.Service;
494
- }).pipe(Effect.provide(locations.get(session.location)));
495
- const delivery = input.delivery ?? "steer";
496
- yield* commands.execute({
497
- name: input.command,
498
- invocation: {
499
- sessionID: input.sessionID,
500
- prompt: {
501
- text: input.text,
502
- files: input.files,
503
- agents: input.agents,
504
- skills: input.skills
505
- },
506
- delivery
507
- }
508
- });
509
- }),
510
- shell: Effect.fn("Session.shell")(function* (input) {
511
- const session = yield* result.get(input.sessionID);
512
- yield* shellLocks.withLock(input.sessionID)(Effect.gen(function* () {
513
- activeShells.add(input.sessionID);
514
- yield* execution.awaitIdle(input.sessionID);
515
- const started = yield* Effect.gen(function* () {
516
- const plugins = yield* exports_supervisor_service.Service;
517
- yield* plugins.flush;
518
- const shell = yield* exports_shell.Service;
519
- return yield* shell.create({
520
- command: input.command,
521
- cwd: session.location.directory,
522
- timeout: 0,
523
- metadata: { sessionID: input.sessionID }
524
- }).pipe(Effect.orDie);
525
- }).pipe(Effect.provide(locations.get(session.location)));
526
- yield* bus.publish(SessionEvent.Shell.Started, {
527
- sessionID: input.sessionID,
528
- shell: started
529
- }, { id: input.id });
530
- const completed = yield* Effect.gen(function* () {
531
- const shell = yield* exports_shell.Service;
532
- const terminal = yield* shell.wait(started.id).pipe(Effect.map((info) => ({ info, retained: true })), Effect.catchTag("Shell.NotFoundError", () => Effect.succeed({ info: synthesizeTerminalShellInfo(started), retained: false })));
533
- const output = terminal.retained ? yield* shell.output(started.id, { limit: SHELL_MAX_CAPTURE_BYTES }).pipe(Effect.catchTag("Shell.NotFoundError", () => Effect.succeed(missingShellOutput()))) : missingShellOutput();
534
- return { shell: terminal.info, output };
535
- }).pipe(Effect.provide(locations.get(session.location)));
536
- yield* bus.publish(SessionEvent.Shell.Ended, {
537
- sessionID: input.sessionID,
538
- shell: completed.shell,
539
- output: completed.output
540
- });
541
- }).pipe(Effect.ensuring(Effect.gen(function* () {
542
- activeShells.delete(input.sessionID);
543
- yield* execution.wake(input.sessionID);
544
- }))));
545
- }),
546
- skill: Effect.fn("Session.skill")(function* (input) {
547
- const session = yield* result.get(input.sessionID);
548
- const skills = yield* exports_skill.Service.pipe(Effect.provide(locations.get(session.location)));
549
- const skill = yield* skills.get(input.skill);
550
- if (!skill)
551
- return yield* new SkillNotFoundError({ skill: input.skill });
552
- yield* bus.publish(SessionEvent.Skill.Activated, {
553
- sessionID: input.sessionID,
554
- id: skill.id,
555
- name: skill.name,
556
- text: skill.content
557
- }, { id: input.id ? Event.ID.make(input.id.replace(/^msg_/, "evt_")) : undefined });
558
- if (input.resume !== false)
559
- yield* execution.resume(input.sessionID).pipe(Effect.ignore, Effect.forkIn(scope, { startImmediately: true }), Effect.asVoid);
560
- }),
561
- switchAgent: Effect.fn("Session.switchAgent")(function* (input) {
562
- const session = yield* result.get(input.sessionID);
563
- yield* bus.publish(SessionEvent.AgentSelected, {
564
- sessionID: input.sessionID,
565
- agent: input.agent,
566
- previous: session.agent
567
- });
568
- }),
569
- switchModel: Effect.fn("Session.switchModel")(function* (input) {
570
- const session = yield* result.get(input.sessionID);
571
- if (session.model?.providerID === input.model.providerID && session.model.id === input.model.id && (session.model.variant ?? "default") === (input.model.variant ?? "default"))
572
- return;
573
- yield* bus.publish(SessionEvent.ModelSelected, {
574
- sessionID: input.sessionID,
575
- model: input.model,
576
- previous: session.model
577
- });
578
- }),
579
- rename: Effect.fn("Session.rename")(function* (input) {
580
- yield* result.get(input.sessionID);
581
- yield* bus.publish(SessionEvent.Renamed, {
582
- sessionID: input.sessionID,
583
- title: input.title
584
- });
585
- }),
586
- move: Effect.fn("Session.move")(function* (input) {
587
- const current = yield* result.get(input.sessionID);
588
- const value = input.directory.trim();
589
- const expanded = value === "~" ? global.home : value.startsWith("~/") ? path.join(global.home, value.slice(2)) : value;
590
- const directory = AbsolutePath.make(path.resolve(current.location.directory, expanded));
591
- const info = yield* fs.stat(directory).pipe(Effect.orElseSucceed(() => {
592
- return;
593
- }));
594
- if (!info)
595
- return yield* new DestinationNotFoundError({ directory });
596
- if (info.type !== "Directory")
597
- return yield* new DestinationNotDirectoryError({ directory });
598
- const project = yield* projects.resolve(directory);
599
- const payload = {
600
- location: exports_location.Ref.make({ directory, workspaceID: input.workspaceID }),
601
- projectID: project.id,
602
- subpath: RelativePath.make(path.relative(project.directory, directory).replaceAll("\\", "/"))
603
- };
604
- yield* exports_location.Service.pipe(Effect.provide(locations.get(payload.location)), Effect.scoped, Effect.catchCause((cause) => {
605
- if (Cause.hasInterruptsOnly(cause))
606
- return Effect.failCause(cause);
607
- return Effect.logWarning("session move destination unavailable", { directory, cause }).pipe(Effect.andThen(Effect.fail(new DestinationUnavailableError({ directory }))));
608
- }));
609
- yield* persistProject(project);
610
- const item = exports_inbox.Item.make({
611
- type: "move",
612
- payload,
613
- delivery: input.delivery ?? "steer"
614
- });
615
- yield* exports_inbox.serialized(input.sessionID, Effect.gen(function* () {
616
- const latest = yield* result.get(input.sessionID);
617
- const source = yield* fs.stat(latest.location.directory).pipe(Effect.orElseSucceed(() => {
618
- return;
619
- }));
620
- if (!source || source.type !== "Directory") {
621
- const cancellations = (yield* exports_inbox.moveIDs(db, input.sessionID)).map((item2) => [SessionEvent.InboxCancelled, { sessionID: input.sessionID, inboxID: item2.id }]);
622
- const moved = [SessionEvent.Moved, { sessionID: input.sessionID, ...payload }];
623
- const first = cancellations[0];
624
- if (!first)
625
- return yield* bus.publish(...moved).pipe(Effect.asVoid);
626
- return yield* bus.publishAll([first, ...cancellations.slice(1), moved]);
627
- }
628
- yield* exports_inbox.admit(db, bus, {
629
- id: SessionMessage.ID.create(),
630
- sessionID: input.sessionID,
631
- item
632
- });
633
- }));
634
- yield* execution.wake(input.sessionID);
635
- }),
636
- compact: Effect.fn("Session.compact")(function* (input) {
637
- yield* result.get(input.sessionID);
638
- const inputID = input.id ?? SessionMessage.ID.create();
639
- const admitted = yield* exports_inbox.admitCompaction(db, bus, {
640
- id: inputID,
641
- sessionID: input.sessionID,
642
- delivery: input.delivery ?? "steer"
643
- }).pipe(Effect.catchDefect((defect) => defect instanceof exports_inbox.LifecycleConflict ? new CompactionConflictError({ sessionID: input.sessionID, inputID }) : Effect.die(defect)));
644
- yield* execution.wake(input.sessionID);
645
- return admitted;
646
- }),
647
- wait: Effect.fn("Session.wait")(function* (sessionID) {
648
- yield* result.get(sessionID);
649
- yield* execution.awaitIdle(sessionID);
650
- }),
651
- active: execution.active,
652
- background: Effect.fn("Session.background")(function* (sessionID) {
653
- yield* result.get(sessionID);
654
- const backgrounded = yield* jobs.backgroundAll({ sessionID });
655
- if (backgrounded.length === 0)
656
- return;
657
- yield* result.synthetic({
658
- sessionID,
659
- text: [
660
- "User requested that active blocking work be moved to the background.",
661
- "",
662
- "Backgrounded work:",
663
- ...backgrounded.map((job) => `- ${job.type}: ${job.title && job.title.length > 0 ? job.title : job.id}`),
664
- "",
665
- "The backgrounded work is still unfinished. Move on to other work if you can. If there is nothing else useful to do, finish your response. Do not wait, sleep, poll, or report the backgrounded work as complete until a later completion notification is added to the conversation."
666
- ].join(`
667
- `)
668
- }).pipe(Effect.catchTag("Session.SyntheticConflictError", Effect.die));
669
- }),
670
- resume: Effect.fn("Session.resume")(function* (sessionID) {
671
- yield* result.get(sessionID);
672
- yield* execution.resume(sessionID);
673
- }),
674
- synthetic: Effect.fn("Session.synthetic")((input) => Effect.uninterruptible(Effect.gen(function* () {
675
- yield* result.get(input.sessionID);
676
- const inputID = input.id ?? SessionMessage.ID.create();
677
- const admittedInput = exports_inbox.Item.make({
678
- type: "synthetic",
679
- payload: {
680
- text: input.text,
681
- description: input.description,
682
- metadata: input.metadata
683
- },
684
- delivery: input.delivery ?? "steer"
685
- });
686
- const admitted = yield* exports_inbox.admit(db, bus, {
687
- id: inputID,
688
- sessionID: input.sessionID,
689
- item: admittedInput
690
- }).pipe(Effect.catchDefect((defect) => defect instanceof exports_inbox.LifecycleConflict ? new SyntheticConflictError({ sessionID: input.sessionID, inputID }) : Effect.die(defect)));
691
- if (admitted.type !== "synthetic" || admitted.sessionID !== input.sessionID)
692
- return yield* new SyntheticConflictError({ sessionID: input.sessionID, inputID });
693
- if (input.resume !== false && !(yield* result.get(input.sessionID)).revert)
694
- yield* execution.wake(input.sessionID);
695
- return admitted;
696
- }))),
697
- interrupt: Effect.fn("Session.interrupt")((sessionID, options) => Effect.uninterruptible(execution.interrupt(sessionID, options))),
698
- revert: {
699
- stage: Effect.fn("Session.revert.stage")(function* (input) {
700
- const session = yield* result.get(input.sessionID);
701
- if ((yield* execution.active).has(input.sessionID))
702
- return yield* new BusyError({ sessionID: input.sessionID });
703
- return yield* Effect.gen(function* () {
704
- const plugins = yield* exports_supervisor_service.Service;
705
- yield* plugins.flush;
706
- return yield* exports_revert.stage({ session, messageID: input.messageID, files: input.files }).pipe(Effect.provideService(exports_database.Service, database), Effect.provideService(exports_bus.Service, bus));
707
- }).pipe(Effect.provide(locations.get(session.location)));
708
- }),
709
- clear: Effect.fn("Session.revert.clear")(function* (sessionID) {
710
- const session = yield* result.get(sessionID);
711
- if ((yield* execution.active).has(sessionID))
712
- return yield* new BusyError({ sessionID });
713
- const revert = yield* Effect.gen(function* () {
714
- const plugins = yield* exports_supervisor_service.Service;
715
- yield* plugins.flush;
716
- return yield* exports_revert.clear(session).pipe(Effect.provideService(exports_bus.Service, bus));
717
- }).pipe(Effect.provide(locations.get(session.location)));
718
- yield* execution.wake(sessionID);
719
- return revert;
720
- }),
721
- commit: Effect.fn("Session.revert.commit")(function* (sessionID) {
722
- const session = yield* result.get(sessionID);
723
- if ((yield* execution.active).has(sessionID))
724
- return yield* new BusyError({ sessionID });
725
- return yield* exports_revert.commit(session).pipe(Effect.provideService(exports_bus.Service, bus));
726
- })
727
- }
728
- });
729
- return result;
730
- }));
731
- function missingShellOutput() {
732
- const output = "Shell command output is no longer available.";
733
- return {
734
- output,
735
- cursor: Buffer.byteLength(output),
736
- size: Buffer.byteLength(output),
737
- truncated: false
738
- };
739
- }
740
- function synthesizeTerminalShellInfo(started) {
741
- return {
742
- ...started,
743
- status: "killed",
744
- time: { ...started.time, completed: Date.now() }
745
- };
746
- }
747
- var preparePrompt = Effect.fn("Session.preparePrompt")(function* (request, messageID) {
748
- const plugins = yield* exports_supervisor_service.Service;
749
- yield* plugins.flush;
750
- const hooks = yield* exports_hooks.Service;
751
- const event = yield* hooks.trigger("session", "prompt", {
752
- sessionID: request.sessionID,
753
- messageID,
754
- prompt: structuredClone({
755
- text: request.text,
756
- files: request.files?.slice(),
757
- agents: request.agents?.slice(),
758
- skills: request.skills?.slice()
759
- }),
760
- metadata: structuredClone(request.metadata),
761
- delivery: request.delivery ?? "steer"
762
- });
763
- const input = event.prompt;
764
- const fs = yield* FSUtil.Service;
765
- const files = input.files ? yield* Effect.forEach(input.files, (file) => materializeAttachment(fs, file), { concurrency: 8 }) : undefined;
766
- const requested = input.skills;
767
- const selected = yield* Effect.gen(function* () {
768
- if (!requested?.length)
769
- return;
770
- const skillService = yield* exports_skill.Service;
771
- const prepared = new Map;
772
- return yield* Effect.forEach(requested, (attachment) => Effect.gen(function* () {
773
- const name = prepared.get(attachment.id);
774
- if (name !== undefined)
775
- return { id: attachment.id, name, mention: attachment.mention };
776
- const skill = yield* skillService.get(attachment.id);
777
- if (!skill)
778
- return yield* new SkillNotFoundError({ skill: attachment.id });
779
- prepared.set(skill.id, skill.name);
780
- return {
781
- id: skill.id,
782
- name: skill.name,
783
- text: (yield* exports_skill.prepare(fs, skill).pipe(Effect.orDie)).output,
784
- mention: attachment.mention
785
- };
786
- }));
787
- });
788
- return exports_inbox.Item.make({
789
- type: "user",
790
- payload: {
791
- ...Prompt.make({
792
- text: input.text,
793
- agents: input.agents,
794
- files,
795
- skills: selected?.length ? selected : undefined
796
- }),
797
- metadata: event.metadata
798
- },
799
- delivery: event.delivery
800
- });
801
- });
802
- var MAX_ATTACHMENT_BYTES = 20 * 1024 * 1024;
803
- var materializeAttachment = Effect.fn("Session.materializeAttachment")(function* (fs, input) {
804
- const resolved = input.uri.startsWith("data:") ? {
805
- bytes: yield* decodeDataURL(input.uri),
806
- source: { type: "inline" },
807
- start: undefined,
808
- end: undefined,
809
- name: undefined,
810
- mime: undefined
811
- } : yield* readFileAttachment(fs, input.uri);
812
- if (resolved.bytes.byteLength > MAX_ATTACHMENT_BYTES)
813
- return yield* new AttachmentError({
814
- uri: input.uri,
815
- message: `Attachment exceeds the ${MAX_ATTACHMENT_BYTES} byte limit: ${input.uri}`
816
- });
817
- const mime = resolved.mime ?? exports_mime.detect(resolved.bytes);
818
- const content = mime === "text/plain" && resolved.start !== undefined ? Buffer.from(Buffer.from(resolved.bytes).toString("utf8").split(`
819
- `).slice(resolved.start - 1, resolved.end).join(`
820
- `)) : resolved.bytes;
821
- const normalized = yield* normalizeImageAttachment(input, Buffer.from(content).toString("base64"), mime);
822
- return FileAttachment.create({
823
- data: normalized.data,
824
- mime: normalized.mime,
825
- source: resolved.source,
826
- name: input.name ?? resolved.name,
827
- description: input.description,
828
- mention: input.mention
829
- });
830
- });
831
- var normalizeImageAttachment = Effect.fn("Session.normalizeImageAttachment")(function* (input, data, mime) {
832
- if (!mime.startsWith("image/"))
833
- return { data: Base64.make(data), mime };
834
- const service = yield* exports_image.Service;
835
- const label = input.name ?? (input.uri.startsWith("data:") ? "inline attachment" : input.uri);
836
- const content = { uri: label, content: data, encoding: "base64", mime };
837
- const normalized = yield* service.normalize(label, content).pipe(Effect.catchTag("Image.ResizerUnavailableError", () => Effect.succeed(content)), Effect.mapError((error) => new AttachmentError({ uri: label, message: error.message })));
838
- return { data: Base64.make(normalized.content), mime: normalized.mime };
839
- });
840
- var readFileAttachment = Effect.fn("Session.readFileAttachment")(function* (fs, uri) {
841
- const url = yield* Effect.try({
842
- try: () => new URL(uri),
843
- catch: () => new AttachmentError({ uri, message: `Invalid attachment URI: ${uri}` })
844
- });
845
- if (url.protocol !== "file:")
846
- return yield* new AttachmentError({ uri, message: `Unsupported attachment URI: ${uri}` });
847
- const start = positiveInt(url.searchParams.get("start"));
848
- const end = positiveInt(url.searchParams.get("end"));
849
- const target = yield* Effect.try({
850
- try: () => {
851
- url.search = "";
852
- url.hash = "";
853
- return fileURLToPath(url);
854
- },
855
- catch: () => new AttachmentError({ uri, message: `Invalid file URI: ${uri}` })
856
- });
857
- const info = yield* fs.stat(target).pipe(Effect.mapError(() => new AttachmentError({ uri, message: `Unable to read attachment: ${uri}` })));
858
- if (info.type === "Directory") {
859
- const entries = yield* fs.readDirectoryEntries(target).pipe(Effect.mapError(() => new AttachmentError({ uri, message: `Unable to read attachment: ${uri}` })));
860
- return {
861
- bytes: Buffer.from(entries.filter((entry) => entry.type === "file" || entry.type === "directory").sort((a, b) => a.type === b.type ? a.name.localeCompare(b.name) : a.type === "directory" ? -1 : 1).map((entry) => entry.name + (entry.type === "directory" ? path.sep : "")).join(`
862
- `)),
863
- source: { type: "uri", uri },
864
- start: undefined,
865
- end: undefined,
866
- name: path.basename(target),
867
- mime: "application/x-directory"
868
- };
869
- }
870
- if (info.type !== "File")
871
- return yield* new AttachmentError({ uri, message: `Attachment is not a file: ${uri}` });
872
- if (Number(info.size) > MAX_ATTACHMENT_BYTES)
873
- return yield* new AttachmentError({
874
- uri,
875
- message: `Attachment exceeds the ${MAX_ATTACHMENT_BYTES} byte limit: ${uri}`
876
- });
877
- const bytes = yield* fs.readFile(target).pipe(Effect.mapError(() => new AttachmentError({ uri, message: `Unable to read attachment: ${uri}` })));
878
- return { bytes, source: { type: "uri", uri }, start, end, name: path.basename(target), mime: undefined };
879
- });
880
- function decodeDataURL(uri) {
881
- return Effect.try({
882
- try: () => {
883
- const comma = uri.indexOf(",");
884
- if (comma === -1)
885
- throw new Error("Invalid data URL");
886
- const metadata = uri.slice(5, comma);
887
- const payload = uri.slice(comma + 1);
888
- if (!metadata.split(";").some((part) => part.toLowerCase() === "base64"))
889
- return Buffer.from(decodeURIComponent(payload));
890
- const bytes = Buffer.from(payload, "base64");
891
- if (bytes.toString("base64") !== payload)
892
- throw new Error("Non-canonical base64");
893
- return bytes;
894
- },
895
- catch: () => new AttachmentError({ uri, message: "Invalid attachment data URL" })
896
- });
897
- }
898
- function positiveInt(value) {
899
- if (value === null)
900
- return;
901
- const parsed = Number(value);
902
- return Number.isInteger(parsed) && parsed > 0 ? parsed : undefined;
903
- }
904
- var SHELL_MAX_CAPTURE_BYTES = 1024 * 1024;
905
- var node = makeGlobalNode({
906
- service: Service,
907
- layer,
908
- deps: [
909
- exports_job.node,
910
- exports_environment.node,
911
- exports_database.node,
912
- exports_bus.node,
913
- exports_project.node,
914
- exports_execution.node,
915
- exports_store.node,
916
- exports_location_service_map.node,
917
- exports_projector.node,
918
- FSUtil.node,
919
- Global.node,
920
- exports_app.node
921
- ]
922
- });
923
-
924
- export { ListAnchor, ListInput, PromptConflictError, SyntheticConflictError, AttachmentError, CompactionConflictError, BusyError, MessageNotAssistantError, MessageIncompleteError, MessageToolIncompleteError, InboxConflictError, SkillNotFoundError, DestinationNotFoundError, DestinationNotDirectoryError, DestinationUnavailableError, MessageNotFoundError, Service, node, exports_session };