@opencode/core 0.0.0-dev-20738 → 0.0.0-dev-20747

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 (785) hide show
  1. package/dist/account/sql.js +1 -1
  2. package/dist/agent.js +82 -82
  3. package/dist/aisdk-native.js +90 -90
  4. package/dist/aisdk.js +95 -95
  5. package/dist/app.js +7 -7
  6. package/dist/bus.js +70 -70
  7. package/dist/chunks/{kv-dkhgx6kw.js → persistent-pty-07j4p7xr.js} +5 -5
  8. package/dist/chunks/{kv-d1me7hxe.js → persistent-pty-0dgnvyav.js} +13 -13
  9. package/dist/chunks/{kv-vxepadaa.js → persistent-pty-0frbsszj.js} +5 -5
  10. package/dist/chunks/{kv-9ae44cfy.js → persistent-pty-0hf9g8pg.js} +6 -6
  11. package/dist/chunks/{kv-0paq2nw3.js → persistent-pty-0paq2nw3.js} +1 -1
  12. package/dist/chunks/{kv-t6ymfg4y.js → persistent-pty-0t67e6aq.js} +18 -18
  13. package/dist/chunks/{kv-0vbcp93d.js → persistent-pty-0vbcp93d.js} +2 -2
  14. package/dist/chunks/{kv-ys3pca7w.js → persistent-pty-0vyhe54f.js} +11 -11
  15. package/dist/chunks/{kv-1cgd7pha.js → persistent-pty-10544tvr.js} +14 -14
  16. package/dist/chunks/{kv-1dazxqgg.js → persistent-pty-1dazxqgg.js} +2 -2
  17. package/dist/chunks/{kv-1dvck2a7.js → persistent-pty-1dvck2a7.js} +2 -2
  18. package/dist/chunks/{kv-r8pf2rje.js → persistent-pty-1f9aggj6.js} +23 -23
  19. package/dist/chunks/{kv-vyrrmp6x.js → persistent-pty-1z0qe0de.js} +11 -11
  20. package/dist/chunks/{kv-7wgvetf0.js → persistent-pty-246p6v4n.js} +18 -18
  21. package/dist/chunks/{kv-n4r13bs7.js → persistent-pty-294dxt6s.js} +24 -24
  22. package/dist/chunks/{kv-2a5m3afh.js → persistent-pty-2a5m3afh.js} +1 -1
  23. package/dist/chunks/{kv-mae2kdyr.js → persistent-pty-2a5r5kzg.js} +17 -17
  24. package/dist/chunks/{kv-nv1zm4pp.js → persistent-pty-2wv1r8xa.js} +113 -35
  25. package/dist/chunks/{kv-35a7vcrd.js → persistent-pty-2xsz0vfe.js} +3 -3
  26. package/dist/chunks/{kv-7ghw0wmm.js → persistent-pty-2zfembs1.js} +5 -5
  27. package/dist/chunks/{kv-4g1zz2v1.js → persistent-pty-33g5rmys.js} +8 -8
  28. package/dist/chunks/{kv-1ygqh575.js → persistent-pty-33w4ejhs.js} +6 -6
  29. package/dist/chunks/{kv-s4h2qwma.js → persistent-pty-34q6evc7.js} +6 -6
  30. package/dist/chunks/{kv-wjxa98ap.js → persistent-pty-3932bm6w.js} +43 -43
  31. package/dist/chunks/{kv-fhpe866r.js → persistent-pty-3d9da72j.js} +9 -9
  32. package/dist/chunks/{kv-3fc6dm20.js → persistent-pty-3fc6dm20.js} +1 -1
  33. package/dist/chunks/{kv-e5tewtqz.js → persistent-pty-3fm4gsbd.js} +5 -5
  34. package/dist/chunks/{kv-3hepkmqq.js → persistent-pty-3hepkmqq.js} +1 -1
  35. package/dist/chunks/{kv-rty6w89f.js → persistent-pty-3hepmaxp.js} +2 -2
  36. package/dist/chunks/{kv-nxe4pcap.js → persistent-pty-3sj8yt8v.js} +4 -4
  37. package/dist/chunks/{kv-3smtnn6g.js → persistent-pty-3smtnn6g.js} +1 -1
  38. package/dist/chunks/{kv-ykgnqdw6.js → persistent-pty-3t58r30e.js} +9 -9
  39. package/dist/chunks/{kv-3tvqynh2.js → persistent-pty-3tvqynh2.js} +1 -1
  40. package/dist/chunks/{kv-930gsck4.js → persistent-pty-3vvm55qk.js} +16 -16
  41. package/dist/chunks/{kv-yc7nxbe2.js → persistent-pty-3w9mrsnt.js} +174 -174
  42. package/dist/chunks/{kv-3zsf4n22.js → persistent-pty-3zsf4n22.js} +1 -1
  43. package/dist/chunks/{kv-n2kj1sg0.js → persistent-pty-452d3xjs.js} +22 -22
  44. package/dist/chunks/{kv-fmgcz1aj.js → persistent-pty-4ejbdg5p.js} +11 -11
  45. package/dist/chunks/persistent-pty-4hytf82j.js +253 -0
  46. package/dist/chunks/{kv-bydnjh3t.js → persistent-pty-4jyvzrab.js} +2 -2
  47. package/dist/chunks/{kv-z182drtd.js → persistent-pty-4n6aeebd.js} +20 -20
  48. package/dist/chunks/{kv-84wpbtae.js → persistent-pty-4paq57hf.js} +15 -15
  49. package/dist/chunks/{kv-xayvb0hr.js → persistent-pty-4rnf1fga.js} +6 -6
  50. package/dist/chunks/{kv-4ts7tf6z.js → persistent-pty-4ts7tf6z.js} +2 -2
  51. package/dist/chunks/{kv-54ma36ye.js → persistent-pty-54ma36ye.js} +1 -1
  52. package/dist/chunks/{kv-2579kh9d.js → persistent-pty-56y8pkfk.js} +7 -7
  53. package/dist/chunks/{kv-g0yaekcy.js → persistent-pty-5706e983.js} +26 -26
  54. package/dist/chunks/{kv-vy7h43fk.js → persistent-pty-59f1da7z.js} +12 -12
  55. package/dist/chunks/{kv-0v09vagk.js → persistent-pty-5c29pvm2.js} +13 -13
  56. package/dist/chunks/{kv-amf37a4y.js → persistent-pty-5m1y6tht.js} +3 -3
  57. package/dist/chunks/{kv-5m9w47nd.js → persistent-pty-5m9w47nd.js} +1 -1
  58. package/dist/chunks/{kv-j2h4gsx3.js → persistent-pty-5nqjp53p.js} +15 -15
  59. package/dist/chunks/{kv-5t3nmthw.js → persistent-pty-5t3nmthw.js} +2 -2
  60. package/dist/chunks/{kv-acvt02vq.js → persistent-pty-5tw36xmv.js} +8 -8
  61. package/dist/chunks/{kv-6xcvt31d.js → persistent-pty-5w9yjztw.js} +1 -1
  62. package/dist/chunks/{kv-d6mdrvww.js → persistent-pty-5yp2r36g.js} +20 -20
  63. package/dist/chunks/{kv-8gqa7j8v.js → persistent-pty-5ytnddsz.js} +7 -7
  64. package/dist/chunks/{kv-ctgn3mrz.js → persistent-pty-60p1jfrx.js} +16 -16
  65. package/dist/chunks/{kv-808z5t55.js → persistent-pty-64va9agc.js} +3 -3
  66. package/dist/chunks/{kv-rvkykd53.js → persistent-pty-66fjaabt.js} +21 -21
  67. package/dist/chunks/{kv-qcmtpxqx.js → persistent-pty-6h9jd8xm.js} +13 -13
  68. package/dist/chunks/{kv-mgt2meas.js → persistent-pty-6m3pxvzn.js} +1 -1
  69. package/dist/chunks/{kv-3bh97vej.js → persistent-pty-6mhqdab4.js} +22 -22
  70. package/dist/chunks/{kv-39eerbas.js → persistent-pty-6styks70.js} +39 -39
  71. package/dist/chunks/{kv-6t5kp9rh.js → persistent-pty-6wm4d0bn.js} +11 -11
  72. package/dist/chunks/{kv-6xb47vfp.js → persistent-pty-6xb47vfp.js} +1 -1
  73. package/dist/chunks/{kv-71az546q.js → persistent-pty-71az546q.js} +2 -2
  74. package/dist/chunks/{kv-6g5spzhr.js → persistent-pty-71cxckq4.js} +25 -25
  75. package/dist/chunks/{kv-qq1s2205.js → persistent-pty-74q28yk0.js} +11 -11
  76. package/dist/chunks/{kv-ssabpyyc.js → persistent-pty-77f241gp.js} +11 -11
  77. package/dist/chunks/{kv-78wqg8jh.js → persistent-pty-79sjm6pt.js} +8 -8
  78. package/dist/chunks/{kv-7bmhse3q.js → persistent-pty-7bmhse3q.js} +1 -1
  79. package/dist/chunks/{kv-rns5tpwh.js → persistent-pty-7efngqr9.js} +11 -11
  80. package/dist/chunks/{kv-qq0p66nj.js → persistent-pty-7f56anht.js} +11 -11
  81. package/dist/chunks/{kv-f96bhag2.js → persistent-pty-7ffm7kw8.js} +32 -32
  82. package/dist/chunks/{kv-69apea2v.js → persistent-pty-7j2qha59.js} +8 -8
  83. package/dist/chunks/{kv-sajthb1z.js → persistent-pty-7ps108p2.js} +14 -14
  84. package/dist/chunks/{kv-vkfdnwpx.js → persistent-pty-80scg3y3.js} +4 -4
  85. package/dist/chunks/{kv-84txncab.js → persistent-pty-84txncab.js} +1 -1
  86. package/dist/chunks/{kv-ddcxhxh9.js → persistent-pty-8d6z1td2.js} +24 -24
  87. package/dist/chunks/{kv-8d7r5vzw.js → persistent-pty-8d7r5vzw.js} +1 -1
  88. package/dist/chunks/{kv-8m6m0r52.js → persistent-pty-8m6m0r52.js} +1 -1
  89. package/dist/chunks/{kv-c27esgm9.js → persistent-pty-8mbscqky.js} +8 -8
  90. package/dist/chunks/{kv-bgj4gnp0.js → persistent-pty-8rz84ek2.js} +18 -18
  91. package/dist/chunks/{kv-ecfxfkv3.js → persistent-pty-8wnx5jkb.js} +9 -9
  92. package/dist/chunks/{kv-47mf4edr.js → persistent-pty-90y6s5gw.js} +16 -16
  93. package/dist/chunks/{kv-bj94ydjv.js → persistent-pty-9144esny.js} +5 -5
  94. package/dist/chunks/{kv-syzt422z.js → persistent-pty-99zegn8n.js} +9 -9
  95. package/dist/chunks/{kv-n57qrn3a.js → persistent-pty-9cva8bgq.js} +6 -6
  96. package/dist/chunks/{kv-9e5bzkjp.js → persistent-pty-9e5bzkjp.js} +3 -3
  97. package/dist/chunks/{kv-jsqb560b.js → persistent-pty-9mtr07j4.js} +22 -22
  98. package/dist/chunks/{kv-cvv2w4hc.js → persistent-pty-9zee5fs2.js} +16 -16
  99. package/dist/chunks/{kv-k25jt64g.js → persistent-pty-a4y9yw62.js} +4 -4
  100. package/dist/chunks/{kv-f3wh3a97.js → persistent-pty-a68ybyfr.js} +9 -9
  101. package/dist/chunks/{kv-366ph4b8.js → persistent-pty-a6mcp28b.js} +11 -11
  102. package/dist/chunks/{kv-qne4kd6g.js → persistent-pty-a98w2xn9.js} +24 -24
  103. package/dist/chunks/{kv-brhts8he.js → persistent-pty-a9f75xna.js} +9 -9
  104. package/dist/chunks/{kv-aaet6srn.js → persistent-pty-aaet6srn.js} +2 -2
  105. package/dist/chunks/{kv-rszma2xn.js → persistent-pty-abvg2g3b.js} +4 -4
  106. package/dist/chunks/{kv-fwnbcsnm.js → persistent-pty-acmc0np2.js} +8 -8
  107. package/dist/chunks/{kv-t82wkkdn.js → persistent-pty-acvbq3eb.js} +9 -9
  108. package/dist/chunks/{kv-x661k3y3.js → persistent-pty-addxnjmp.js} +4 -4
  109. package/dist/chunks/{kv-gejbtgaw.js → persistent-pty-agk8v0ng.js} +20 -20
  110. package/dist/chunks/{kv-qygbw77c.js → persistent-pty-b3f8fkhc.js} +5 -5
  111. package/dist/chunks/{kv-b6gygkdw.js → persistent-pty-b6gygkdw.js} +2 -2
  112. package/dist/chunks/{kv-jgegdacd.js → persistent-pty-bhr47zss.js} +49 -49
  113. package/dist/chunks/{kv-13bwbegs.js → persistent-pty-brp8zeym.js} +6 -6
  114. package/dist/chunks/{kv-4ckpdmry.js → persistent-pty-bs615f2f.js} +28 -28
  115. package/dist/chunks/{kv-h6310vsd.js → persistent-pty-btbmdjwj.js} +4 -4
  116. package/dist/chunks/{kv-ygdna4kr.js → persistent-pty-bx0gyb4h.js} +5 -5
  117. package/dist/chunks/{kv-vg59hbfz.js → persistent-pty-bxn9kzm3.js} +2 -2
  118. package/dist/chunks/{kv-77pjx4k4.js → persistent-pty-c2dj01cg.js} +22 -22
  119. package/dist/chunks/{kv-x6byvdkw.js → persistent-pty-c9w4s4wj.js} +3 -3
  120. package/dist/chunks/{kv-py3kkmfq.js → persistent-pty-cfsekr6v.js} +2 -2
  121. package/dist/chunks/{kv-2sejkfem.js → persistent-pty-cwa6csj7.js} +9 -9
  122. package/dist/chunks/{kv-dphc24b4.js → persistent-pty-cyf4hc4a.js} +20 -20
  123. package/dist/chunks/{kv-6fddr8vc.js → persistent-pty-d4wtke4k.js} +4 -4
  124. package/dist/chunks/{kv-pkq59grd.js → persistent-pty-d5end4r0.js} +38 -38
  125. package/dist/chunks/{kv-3k6tstd2.js → persistent-pty-dcq95y2f.js} +32 -32
  126. package/dist/chunks/{kv-tsaxfawh.js → persistent-pty-de9gfr1m.js} +4 -4
  127. package/dist/chunks/{kv-7k3bpw74.js → persistent-pty-dnjek89v.js} +21 -21
  128. package/dist/chunks/{kv-ytyv5eys.js → persistent-pty-dr7bzdbp.js} +31 -31
  129. package/dist/chunks/{kv-7n34cqd6.js → persistent-pty-dt81nn0a.js} +11 -11
  130. package/dist/chunks/{kv-vw57tvh8.js → persistent-pty-dz8kt8cs.js} +40 -40
  131. package/dist/chunks/{kv-vqhvr9h8.js → persistent-pty-e875qc4w.js} +7 -4
  132. package/dist/chunks/{kv-ef5x83kb.js → persistent-pty-ef5x83kb.js} +1 -1
  133. package/dist/chunks/{kv-984x661q.js → persistent-pty-ekgbms86.js} +18 -18
  134. package/dist/chunks/persistent-pty-em9fqdhz.js +26 -0
  135. package/dist/chunks/{kv-k2271zhj.js → persistent-pty-enbmzra5.js} +31 -31
  136. package/dist/chunks/{kv-ang9sdtn.js → persistent-pty-esvm55dh.js} +8 -8
  137. package/dist/chunks/{kv-etq0c3wd.js → persistent-pty-etq0c3wd.js} +1 -1
  138. package/dist/chunks/{kv-8me8kj13.js → persistent-pty-f21pkny0.js} +8 -8
  139. package/dist/chunks/{kv-6cdytb58.js → persistent-pty-f2tgbz6g.js} +11 -11
  140. package/dist/chunks/{kv-42t96xj3.js → persistent-pty-f6yrfa37.js} +21 -21
  141. package/dist/chunks/{kv-ch3jzc50.js → persistent-pty-f8jd5471.js} +31 -31
  142. package/dist/chunks/{kv-th451jzy.js → persistent-pty-ffs2e08n.js} +46 -46
  143. package/dist/chunks/{kv-ncsnqhtp.js → persistent-pty-fkxkd9y2.js} +18 -18
  144. package/dist/chunks/{kv-3hxhjqkg.js → persistent-pty-frac477b.js} +13 -13
  145. package/dist/chunks/{kv-azh8f6zy.js → persistent-pty-frs7w0sc.js} +20 -20
  146. package/dist/chunks/{kv-w3zwv4wx.js → persistent-pty-fxzv5hcv.js} +5 -5
  147. package/dist/chunks/{kv-9jzm7v48.js → persistent-pty-fypvnyj1.js} +4 -4
  148. package/dist/chunks/{kv-mj4srff6.js → persistent-pty-fzvyqwy2.js} +11 -11
  149. package/dist/chunks/{kv-nphwcreh.js → persistent-pty-g59hsv3e.js} +27 -27
  150. package/dist/chunks/{kv-xfkkasph.js → persistent-pty-g5w8qwbj.js} +4 -4
  151. package/dist/chunks/{kv-fx0gd3c1.js → persistent-pty-g64e51y2.js} +3 -3
  152. package/dist/chunks/{kv-5evczv99.js → persistent-pty-gae362ez.js} +11 -11
  153. package/dist/chunks/{kv-67d2xr1y.js → persistent-pty-gasqarw7.js} +13 -13
  154. package/dist/chunks/{kv-gd4qta3r.js → persistent-pty-gd4qta3r.js} +1 -1
  155. package/dist/chunks/{kv-4drgpw32.js → persistent-pty-gebtr55s.js} +5 -5
  156. package/dist/chunks/{kv-05xfxpq7.js → persistent-pty-gft05b0a.js} +5 -5
  157. package/dist/chunks/{kv-6rxsm8b2.js → persistent-pty-gpe2knh0.js} +23 -23
  158. package/dist/chunks/{kv-q9pqtv1v.js → persistent-pty-h20gnzmc.js} +16 -16
  159. package/dist/chunks/{kv-h2b79v29.js → persistent-pty-h2b79v29.js} +2 -2
  160. package/dist/chunks/{kv-gmdr493m.js → persistent-pty-h4gx7g90.js} +31 -31
  161. package/dist/chunks/{kv-6evx7sdp.js → persistent-pty-h4yj3hfn.js} +9 -9
  162. package/dist/chunks/{kv-h6vf3j39.js → persistent-pty-h6vf3j39.js} +1 -1
  163. package/dist/chunks/{kv-qkybe0c6.js → persistent-pty-hgbx6y65.js} +25 -25
  164. package/dist/chunks/{kv-a4r3dq2k.js → persistent-pty-hz8hz416.js} +13 -13
  165. package/dist/chunks/{kv-j56e64zr.js → persistent-pty-j56e64zr.js} +1 -1
  166. package/dist/chunks/{kv-25py64se.js → persistent-pty-j95ptk0s.js} +21 -21
  167. package/dist/chunks/persistent-pty-jqh9b0xq.js +18 -0
  168. package/dist/chunks/{kv-a5pr435h.js → persistent-pty-jqmrr43j.js} +39 -30
  169. package/dist/chunks/{kv-nnnd3cph.js → persistent-pty-jvtb2vkm.js} +79 -79
  170. package/dist/chunks/{kv-6dtqx3zc.js → persistent-pty-jw3c4zpw.js} +10 -10
  171. package/dist/chunks/{kv-xpcvy2br.js → persistent-pty-jx91nfq8.js} +13 -13
  172. package/dist/chunks/{kv-0re18gy8.js → persistent-pty-k3tzam8s.js} +11 -11
  173. package/dist/chunks/{kv-t2az9yje.js → persistent-pty-k76fn4kw.js} +4 -4
  174. package/dist/chunks/{kv-3801kdgp.js → persistent-pty-k8hpw67k.js} +5 -5
  175. package/dist/chunks/{kv-6zz3m0fh.js → persistent-pty-kn76agft.js} +11 -11
  176. package/dist/chunks/{kv-45595hde.js → persistent-pty-krfd5zbt.js} +17 -17
  177. package/dist/chunks/persistent-pty-kxa68w8a.js +507 -0
  178. package/dist/chunks/{kv-m3fdjcah.js → persistent-pty-m3fdjcah.js} +1 -1
  179. package/dist/chunks/{kv-a68x47kk.js → persistent-pty-m57p7dy9.js} +24 -24
  180. package/dist/chunks/{kv-0p15mrma.js → persistent-pty-m9jge9he.js} +40 -40
  181. package/dist/chunks/{kv-m9w0rfyh.js → persistent-pty-m9w0rfyh.js} +1 -1
  182. package/dist/chunks/{kv-007agb8z.js → persistent-pty-mbnxefga.js} +2 -2
  183. package/dist/chunks/{kv-9x77fmbz.js → persistent-pty-mhgx8wws.js} +4 -4
  184. package/dist/chunks/{kv-mhkvc446.js → persistent-pty-mhkvc446.js} +1 -1
  185. package/dist/chunks/{kv-zszxba2s.js → persistent-pty-mhmqmh3t.js} +20 -20
  186. package/dist/chunks/{kv-e9ra3rc2.js → persistent-pty-mjc7kzsv.js} +30 -30
  187. package/dist/chunks/{kv-nrdmrqsx.js → persistent-pty-mjymc32g.js} +4 -4
  188. package/dist/chunks/{kv-5epaq3n7.js → persistent-pty-mkcqfmf9.js} +21 -21
  189. package/dist/chunks/{kv-1vq0vbyf.js → persistent-pty-mq2s0m0j.js} +18 -18
  190. package/dist/chunks/{kv-snaz9310.js → persistent-pty-mqjweymz.js} +7 -7
  191. package/dist/chunks/{kv-8n5pds5p.js → persistent-pty-mrvgqbj6.js} +18 -18
  192. package/dist/chunks/{kv-3vxensx3.js → persistent-pty-mvbwjcmq.js} +13 -13
  193. package/dist/chunks/{kv-ws4sjaxf.js → persistent-pty-n91836cy.js} +5 -5
  194. package/dist/chunks/{kv-rqyrrfya.js → persistent-pty-nkzrceyp.js} +20 -20
  195. package/dist/chunks/{kv-n3ph6zq5.js → persistent-pty-nt5zybzt.js} +27 -27
  196. package/dist/chunks/{kv-dpkg50ah.js → persistent-pty-nxm207yx.js} +4 -4
  197. package/dist/chunks/{kv-cy4egse2.js → persistent-pty-p22s9xh3.js} +7 -7
  198. package/dist/chunks/{kv-rbknh4pb.js → persistent-pty-p5ccpjke.js} +4 -4
  199. package/dist/chunks/{kv-cp7jndq9.js → persistent-pty-p8xb6st8.js} +6 -6
  200. package/dist/chunks/{kv-wehq120m.js → persistent-pty-p9mp4ezq.js} +10 -10
  201. package/dist/chunks/{kv-9p5sgrfb.js → persistent-pty-p9rzmxqj.js} +82 -82
  202. package/dist/chunks/{kv-cdj8tbqs.js → persistent-pty-pd8w2hzr.js} +4 -4
  203. package/dist/chunks/{kv-pjvnvgmy.js → persistent-pty-pjvnvgmy.js} +1 -1
  204. package/dist/chunks/{kv-pknna89w.js → persistent-pty-pknna89w.js} +1 -1
  205. package/dist/chunks/{kv-xdfad79h.js → persistent-pty-pz6e2333.js} +38 -38
  206. package/dist/chunks/{kv-q0xm7vwc.js → persistent-pty-q0xm7vwc.js} +2 -2
  207. package/dist/chunks/{kv-mwb2myx2.js → persistent-pty-qabhdn7r.js} +8 -8
  208. package/dist/chunks/{kv-rck9djz0.js → persistent-pty-qam9v5v6.js} +16 -16
  209. package/dist/chunks/{kv-a998vwew.js → persistent-pty-qanbtx8r.js} +5 -5
  210. package/dist/chunks/{kv-s8g2njyt.js → persistent-pty-qcb4xgkg.js} +32 -32
  211. package/dist/chunks/{kv-bfvwgmyn.js → persistent-pty-qe9h9j2v.js} +8 -8
  212. package/dist/chunks/{kv-at2kzgpx.js → persistent-pty-qf44y2mr.js} +20 -20
  213. package/dist/chunks/persistent-pty-qffxxdg5.js +806 -0
  214. package/dist/chunks/{kv-qgn6gcr1.js → persistent-pty-qgn6gcr1.js} +1 -1
  215. package/dist/chunks/{kv-yjkarpge.js → persistent-pty-qhq1qkp9.js} +13 -13
  216. package/dist/chunks/{kv-fb8mpv19.js → persistent-pty-qja65tr3.js} +6 -6
  217. package/dist/chunks/{kv-10h2grd6.js → persistent-pty-qkpjj9ac.js} +11 -11
  218. package/dist/chunks/{kv-qnc92qwc.js → persistent-pty-qnc92qwc.js} +1 -1
  219. package/dist/chunks/{kv-b45880ax.js → persistent-pty-qpnhhads.js} +33 -33
  220. package/dist/chunks/{kv-qsdy395h.js → persistent-pty-qsdy395h.js} +1 -1
  221. package/dist/chunks/{kv-qxjc9qry.js → persistent-pty-qxjc9qry.js} +3 -3
  222. package/dist/chunks/{kv-6w7198b7.js → persistent-pty-r21g991y.js} +6 -6
  223. package/dist/chunks/{kv-rdw6cm16.js → persistent-pty-rdw6cm16.js} +1 -1
  224. package/dist/chunks/{kv-yp2x3t23.js → persistent-pty-rhraev7y.js} +4 -4
  225. package/dist/chunks/{kv-kyeq8fzm.js → persistent-pty-rp3v7rzg.js} +18 -18
  226. package/dist/chunks/{kv-tpsfpmb6.js → persistent-pty-rpdsffkf.js} +9 -9
  227. package/dist/chunks/{kv-sjgsw2hk.js → persistent-pty-rrt0a0ha.js} +2 -2
  228. package/dist/chunks/{kv-hndwyk0r.js → persistent-pty-s2tvcjnh.js} +44 -44
  229. package/dist/chunks/{kv-mm9h18qq.js → persistent-pty-s478zet3.js} +6 -6
  230. package/dist/chunks/{kv-s8d7rejh.js → persistent-pty-s8d7rejh.js} +1 -1
  231. package/dist/chunks/{kv-3ptewvj2.js → persistent-pty-sg0z4cbk.js} +43 -43
  232. package/dist/chunks/{kv-srq8z0b0.js → persistent-pty-srq8z0b0.js} +2 -2
  233. package/dist/chunks/{kv-k7gjbccb.js → persistent-pty-svq9n8fc.js} +22 -22
  234. package/dist/chunks/{kv-pbfwh0cy.js → persistent-pty-t2fc4mz5.js} +7 -7
  235. package/dist/chunks/{kv-0jck1kcq.js → persistent-pty-t6x8032s.js} +10 -10
  236. package/dist/chunks/{kv-ajzsbz6h.js → persistent-pty-tag6x3x4.js} +9 -9
  237. package/dist/chunks/{kv-tazgh4e4.js → persistent-pty-tazgh4e4.js} +1 -1
  238. package/dist/chunks/{kv-tcezcvh9.js → persistent-pty-tcezcvh9.js} +1 -1
  239. package/dist/chunks/{kv-tdstcens.js → persistent-pty-tdstcens.js} +1 -1
  240. package/dist/chunks/{kv-79r4g3vq.js → persistent-pty-tej6jj18.js} +1 -1
  241. package/dist/chunks/{kv-ys2gqn7k.js → persistent-pty-tgxmpcwb.js} +24 -24
  242. package/dist/chunks/{kv-54fe0yvq.js → persistent-pty-tk4fwett.js} +7 -7
  243. package/dist/chunks/{kv-wdp4gayr.js → persistent-pty-tkjmd8ah.js} +9 -9
  244. package/dist/chunks/{kv-cmwkp3r5.js → persistent-pty-tpw6cwsb.js} +8 -8
  245. package/dist/chunks/{kv-h7696n0v.js → persistent-pty-tr0vwqfg.js} +22 -17
  246. package/dist/chunks/{kv-v0es1rhs.js → persistent-pty-v0es1rhs.js} +2 -2
  247. package/dist/chunks/{kv-enf12tk9.js → persistent-pty-v2dgrqw5.js} +5 -5
  248. package/dist/chunks/{kv-39259x0v.js → persistent-pty-v2s7p60s.js} +13 -13
  249. package/dist/chunks/{kv-d20y7eht.js → persistent-pty-v6w1ycpy.js} +17 -17
  250. package/dist/chunks/{kv-npfvvr87.js → persistent-pty-va0yvadb.js} +17 -17
  251. package/dist/chunks/{kv-h7bdckh5.js → persistent-pty-vc6ttyax.js} +26 -26
  252. package/dist/chunks/{kv-veqvce7d.js → persistent-pty-veqvce7d.js} +1 -1
  253. package/dist/chunks/{kv-bxkg5nem.js → persistent-pty-vq7qj473.js} +13 -13
  254. package/dist/chunks/{kv-2nyjj8hd.js → persistent-pty-vy5bmntt.js} +11 -11
  255. package/dist/chunks/{kv-vzs5sf6e.js → persistent-pty-vzs5sf6e.js} +1 -1
  256. package/dist/chunks/{kv-xmd9wz50.js → persistent-pty-w2vs668w.js} +4 -4
  257. package/dist/chunks/{kv-w3wsvvr9.js → persistent-pty-w3wsvvr9.js} +1 -1
  258. package/dist/chunks/{kv-bfkzbq3x.js → persistent-pty-w57dmcrw.js} +35 -35
  259. package/dist/chunks/{kv-fkz2j366.js → persistent-pty-w7e5sy50.js} +58 -58
  260. package/dist/chunks/{kv-rjgdgsdr.js → persistent-pty-wakgm00q.js} +13 -13
  261. package/dist/chunks/{kv-ftkcznmp.js → persistent-pty-wd489eb9.js} +4 -4
  262. package/dist/chunks/{kv-wd87259q.js → persistent-pty-wd87259q.js} +1 -1
  263. package/dist/chunks/{kv-948csc8n.js → persistent-pty-wfh6bfqk.js} +12 -12
  264. package/dist/chunks/{kv-dssbfrwz.js → persistent-pty-wh6zw745.js} +5 -5
  265. package/dist/chunks/{kv-4ddjjg0p.js → persistent-pty-x1aggpc5.js} +26 -26
  266. package/dist/chunks/{kv-mnm8ds97.js → persistent-pty-x2v10rcr.js} +31 -31
  267. package/dist/chunks/{kv-xkntkrq7.js → persistent-pty-xkntkrq7.js} +2 -2
  268. package/dist/chunks/{kv-g3a7jf08.js → persistent-pty-y01hq6fz.js} +12 -12
  269. package/dist/chunks/{kv-y1fvbwt7.js → persistent-pty-y1fvbwt7.js} +1 -1
  270. package/dist/chunks/{kv-12a3t8vh.js → persistent-pty-ydfvykp3.js} +41 -41
  271. package/dist/chunks/{kv-ja01233w.js → persistent-pty-yq69kk6a.js} +10 -10
  272. package/dist/chunks/{kv-wemkyzrv.js → persistent-pty-ys4q2a0p.js} +7 -7
  273. package/dist/chunks/{kv-h22y87dx.js → persistent-pty-yw99rzrh.js} +23 -23
  274. package/dist/chunks/{kv-z0bkrqjs.js → persistent-pty-z0bkrqjs.js} +1 -1
  275. package/dist/chunks/{kv-rcmda6tc.js → persistent-pty-z3b9gz9j.js} +5 -5
  276. package/dist/chunks/{kv-cekf18da.js → persistent-pty-z8aq2wwt.js} +23 -23
  277. package/dist/chunks/{kv-d737nyfv.js → persistent-pty-zab19jja.js} +9 -9
  278. package/dist/chunks/{kv-mb87pwt1.js → persistent-pty-zdd0mkhs.js} +8 -8
  279. package/dist/chunks/{kv-zfs8ae4p.js → persistent-pty-zfs8ae4p.js} +4 -4
  280. package/dist/chunks/{kv-etag6te0.js → persistent-pty-zn647a2n.js} +12 -12
  281. package/dist/chunks/{kv-zr2ceqn5.js → persistent-pty-zr2ceqn5.js} +1 -1
  282. package/dist/chunks/{kv-zxq2ej10.js → persistent-pty-zxq2ej10.js} +1 -1
  283. package/dist/chunks/{kv-5ymsght2.js → persistent-pty-zyt2xg97.js} +10 -10
  284. package/dist/codemode/catalog.js +1 -1
  285. package/dist/codemode/instructions.js +7 -7
  286. package/dist/codemode/tool.js +3 -3
  287. package/dist/codemode/web.js +1 -1
  288. package/dist/command.js +86 -86
  289. package/dist/config/discovery.js +83 -83
  290. package/dist/config/markdown.js +1 -1
  291. package/dist/config/normalize.js +100 -100
  292. package/dist/config/plugin/agent.js +117 -117
  293. package/dist/config/plugin/command.js +206 -206
  294. package/dist/config/plugin/compaction.js +155 -155
  295. package/dist/config/plugin/compatibility.js +135 -135
  296. package/dist/config/plugin/entry-observer.js +1 -1
  297. package/dist/config/plugin/formatter.js +118 -118
  298. package/dist/config/plugin/image.js +115 -115
  299. package/dist/config/plugin/instruction.js +91 -91
  300. package/dist/config/plugin/location-watcher.js +119 -119
  301. package/dist/config/plugin/mcp.js +124 -124
  302. package/dist/config/plugin/policy.js +118 -118
  303. package/dist/config/plugin/provider.js +117 -117
  304. package/dist/config/plugin/reference.js +119 -119
  305. package/dist/config/plugin/shell.js +117 -117
  306. package/dist/config/plugin/skill-file.js +103 -103
  307. package/dist/config/plugin/skill.js +136 -136
  308. package/dist/config/plugin/snapshot.js +117 -117
  309. package/dist/config/plugin/source.js +118 -118
  310. package/dist/config/plugin/tool-output.js +118 -118
  311. package/dist/config/plugin/websearch.js +116 -116
  312. package/dist/config/plugin/worktree.js +119 -119
  313. package/dist/config/variable.js +3 -3
  314. package/dist/config/watch.js +1 -1
  315. package/dist/config.js +122 -122
  316. package/dist/credential/sql.js +2 -2
  317. package/dist/credential.js +82 -82
  318. package/dist/database/database.js +67 -67
  319. package/dist/database/drizzle/effect-sqlite/driver.js +14 -14
  320. package/dist/database/drizzle/effect-sqlite/index.js +14 -14
  321. package/dist/database/drizzle/effect-sqlite/session.js +11 -11
  322. package/dist/database/drizzle/index.js +15 -15
  323. package/dist/database/drizzle/internal/drizzle-utils.js +1 -1
  324. package/dist/database/drizzle/sqlite-core/effect/count.js +1 -1
  325. package/dist/database/drizzle/sqlite-core/effect/db.js +9 -9
  326. package/dist/database/drizzle/sqlite-core/effect/delete.js +2 -2
  327. package/dist/database/drizzle/sqlite-core/effect/index.js +10 -10
  328. package/dist/database/drizzle/sqlite-core/effect/insert.js +2 -2
  329. package/dist/database/drizzle/sqlite-core/effect/query.js +1 -1
  330. package/dist/database/drizzle/sqlite-core/effect/raw.js +1 -1
  331. package/dist/database/drizzle/sqlite-core/effect/select.js +2 -2
  332. package/dist/database/drizzle/sqlite-core/effect/session.js +10 -10
  333. package/dist/database/drizzle/sqlite-core/effect/update.js +2 -2
  334. package/dist/database/drizzle.js +16 -16
  335. package/dist/database/migration/20260127222353_familiar_lady_ursula.js +1 -1
  336. package/dist/database/migration/20260211171708_add_project_commands.js +1 -1
  337. package/dist/database/migration/20260213144116_wakeful_the_professor.js +1 -1
  338. package/dist/database/migration/20260225215848_workspace.js +1 -1
  339. package/dist/database/migration/20260227213759_add_session_workspace_id.js +1 -1
  340. package/dist/database/migration/20260228203230_blue_harpoon.js +1 -1
  341. package/dist/database/migration/20260303231226_add_workspace_fields.js +1 -1
  342. package/dist/database/migration/20260309230000_move_org_to_state.js +1 -1
  343. package/dist/database/migration/20260312043431_session_message_cursor.js +1 -1
  344. package/dist/database/migration/20260323234822_events.js +1 -1
  345. package/dist/database/migration/20260410174513_workspace-name.js +1 -1
  346. package/dist/database/migration/20260413175956_chief_energizer.js +1 -1
  347. package/dist/database/migration/20260423070820_add_icon_url_override.js +1 -1
  348. package/dist/database/migration/20260427172553_slow_nightmare.js +1 -1
  349. package/dist/database/migration/20260428004200_add_session_path.js +1 -1
  350. package/dist/database/migration/20260501142318_next_venus.js +1 -1
  351. package/dist/database/migration/20260504145000_add_sync_owner.js +1 -1
  352. package/dist/database/migration/20260507164347_add_workspace_time.js +1 -1
  353. package/dist/database/migration/20260510033149_session_usage.js +1 -1
  354. package/dist/database/migration/20260511000411_data_migration_state.js +1 -1
  355. package/dist/database/migration/20260511173437_session-metadata.js +1 -1
  356. package/dist/database/migration/20260601010001_normalize_storage_paths.js +1 -1
  357. package/dist/database/migration/20260601202201_amazing_prowler.js +1 -1
  358. package/dist/database/migration/20260602002951_lowly_union_jack.js +1 -1
  359. package/dist/database/migration/20260602182828_add_project_directories.js +1 -1
  360. package/dist/database/migration/20260603001617_session_message_projection_indexes.js +1 -1
  361. package/dist/database/migration/20260603040000_session_message_projection_order.js +1 -1
  362. package/dist/database/migration/20260603141458_session_input_inbox.js +1 -1
  363. package/dist/database/migration/20260603160727_jittery_ezekiel_stane.js +1 -1
  364. package/dist/database/migration/20260604172448_event_sourced_session_input.js +1 -1
  365. package/dist/database/migration/20260605003541_add_session_context_snapshot.js +1 -1
  366. package/dist/database/migration/20260605042240_add_context_epoch_agent.js +1 -1
  367. package/dist/database/migration/20260611035744_credential.js +1 -1
  368. package/dist/database/migration/20260611192811_lush_chimera.js +1 -1
  369. package/dist/database/migration/20260612174303_project_dir_strategy.js +1 -1
  370. package/dist/database/migration/20260622142730_simplify_session_context_epoch.js +1 -1
  371. package/dist/database/migration/20260622170816_reset_v2_session_state.js +1 -1
  372. package/dist/database/migration/20260622202450_simplify_session_input.js +1 -1
  373. package/dist/database/migration/20260804233008_loose_psylocke.js +1 -1
  374. package/dist/database/migration/20260805200742_import_legacy_credentials.js +1 -1
  375. package/dist/database/migration/20260808023530_workspace_domain.js +1 -1
  376. package/dist/database/migration/20260811161259_execution_claim_attempts.js +1 -1
  377. package/dist/database/migration/20260812181746_session_inbox.js +1 -1
  378. package/dist/database/migration/20260812213948_worktree.js +1 -1
  379. package/dist/database/migration/20260819222447_session_viewed_state.js +1 -1
  380. package/dist/database/migration/20260823191254_nullable_workspace_binding.js +1 -1
  381. package/dist/database/migration/20260910120000_clear_v1_session_permission.js +1 -1
  382. package/dist/database/migration/20260923013825_project_time_active.js +1 -1
  383. package/dist/database/migration/20261007190000_azure_cli_external_credential.js +1 -1
  384. package/dist/database/migration.gen.js +50 -50
  385. package/dist/database/migration.js +52 -52
  386. package/dist/database/path.js +2 -2
  387. package/dist/database/schema.gen.js +1 -1
  388. package/dist/database/schema.sql.js +1 -1
  389. package/dist/database/sqlite.bun.js +1 -1
  390. package/dist/database/sqlite.js +1 -1
  391. package/dist/database/sqlite.node.js +1 -1
  392. package/dist/database/sqlite.workerd.js +1 -1
  393. package/dist/database/v1-migration.bun.js +77 -77
  394. package/dist/database/v1-migration.js +1 -1
  395. package/dist/effect/app-node-builder.js +364 -364
  396. package/dist/effect/app-node-platform.js +2 -2
  397. package/dist/effect/keyed-mutex.js +3 -3
  398. package/dist/effect/websocket-constructor.js +1 -1
  399. package/dist/environment/driver.js +1 -1
  400. package/dist/environment/environment.js +94 -94
  401. package/dist/environment/exec-defaults.js +2 -2
  402. package/dist/environment/files.js +1 -1
  403. package/dist/environment/index.js +96 -96
  404. package/dist/environment/local.js +2 -2
  405. package/dist/environment/memory.js +2 -2
  406. package/dist/environment/unavailable.js +1 -1
  407. package/dist/event/sql.js +1 -1
  408. package/dist/event-logger.js +71 -71
  409. package/dist/file-access.js +105 -105
  410. package/dist/file-mutation.js +95 -95
  411. package/dist/file-retention.js +1 -1
  412. package/dist/filesystem/fff.bun.js +2 -2
  413. package/dist/filesystem/fff.js +1 -1
  414. package/dist/filesystem/fff.node.js +2 -2
  415. package/dist/filesystem/fff.workerd.js +2 -2
  416. package/dist/filesystem/location-watcher-policy.js +6 -6
  417. package/dist/filesystem/location-watcher.js +221 -221
  418. package/dist/filesystem/protected.js +1 -1
  419. package/dist/filesystem/search.js +104 -104
  420. package/dist/filesystem/watcher-binding.js +1 -1
  421. package/dist/filesystem/watcher.js +15 -15
  422. package/dist/filesystem.js +101 -101
  423. package/dist/form.js +83 -83
  424. package/dist/formatter/builtins.js +2 -2
  425. package/dist/formatter.js +88 -88
  426. package/dist/generate.js +104 -104
  427. package/dist/git.js +6 -6
  428. package/dist/github-copilot/chat/convert-to-openai-compatible-chat-messages.js +1 -1
  429. package/dist/github-copilot/chat/get-response-metadata.js +1 -1
  430. package/dist/github-copilot/chat/map-openai-compatible-finish-reason.js +1 -1
  431. package/dist/github-copilot/chat/openai-compatible-chat-language-model.js +7 -7
  432. package/dist/github-copilot/chat/openai-compatible-chat-options.js +1 -1
  433. package/dist/github-copilot/chat/openai-compatible-prepare-tools.js +1 -1
  434. package/dist/github-copilot/copilot-provider.js +17 -17
  435. package/dist/github-copilot/models.js +92 -92
  436. package/dist/github-copilot/openai-compatible-error.js +1 -1
  437. package/dist/github-copilot/responses/convert-to-openai-responses-input.js +1 -1
  438. package/dist/github-copilot/responses/map-openai-responses-finish-reason.js +1 -1
  439. package/dist/github-copilot/responses/openai-error.js +1 -1
  440. package/dist/github-copilot/responses/openai-responses-language-model.js +10 -10
  441. package/dist/github-copilot/responses/openai-responses-prepare-tools.js +6 -6
  442. package/dist/github-copilot/responses/tool/code-interpreter.js +1 -1
  443. package/dist/github-copilot/responses/tool/file-search.js +1 -1
  444. package/dist/github-copilot/responses/tool/image-generation.js +1 -1
  445. package/dist/github-copilot/responses/tool/web-search-preview.js +1 -1
  446. package/dist/github-copilot/responses/tool/web-search.js +1 -1
  447. package/dist/image/photon.js +2 -2
  448. package/dist/image.js +6 -6
  449. package/dist/instance/service.js +5 -5
  450. package/dist/instance.js +355 -355
  451. package/dist/instruction-discovery.js +86 -86
  452. package/dist/instructions/builtins.js +88 -88
  453. package/dist/instructions/index.js +1 -1
  454. package/dist/integration/connection.js +3 -3
  455. package/dist/integration.js +86 -86
  456. package/dist/job.js +77 -77
  457. package/dist/kv/sql.js +2 -2
  458. package/dist/kv.js +74 -74
  459. package/dist/location-activity.js +129 -129
  460. package/dist/location-lifecycle.js +108 -108
  461. package/dist/location-service-map.js +87 -87
  462. package/dist/location-services.js +352 -352
  463. package/dist/location.js +82 -82
  464. package/dist/managed-policy.js +8 -8
  465. package/dist/mcp/client.js +92 -92
  466. package/dist/mcp/index.js +104 -104
  467. package/dist/mcp/instructions.js +128 -128
  468. package/dist/mcp/oauth.js +79 -79
  469. package/dist/mcp/stdio.js +91 -91
  470. package/dist/mime.js +1 -1
  471. package/dist/modal/models.js +92 -92
  472. package/dist/model-resolver.js +97 -97
  473. package/dist/model.js +99 -99
  474. package/dist/models-dev.js +108 -108
  475. package/dist/oauth/page.js +1 -1
  476. package/dist/permission/saved.js +77 -77
  477. package/dist/permission/sql.js +5 -5
  478. package/dist/permission.js +104 -104
  479. package/dist/persistent-pty/binary.bun.js +1 -1
  480. package/dist/persistent-pty/daemon.js +1 -1
  481. package/dist/persistent-pty/index.js +85 -85
  482. package/dist/persistent-pty/pty-binding.js +1 -1
  483. package/dist/persistent-pty.js +76 -76
  484. package/dist/plugin/agent.js +75 -75
  485. package/dist/plugin/command.js +101 -101
  486. package/dist/plugin/hooks.js +5 -5
  487. package/dist/plugin/host.js +212 -212
  488. package/dist/plugin/identity.js +3 -3
  489. package/dist/plugin/instance.js +5 -5
  490. package/dist/plugin/internal.js +327 -327
  491. package/dist/plugin/mcp-codemode-defaults.js +3 -3
  492. package/dist/plugin/models-dev.js +97 -97
  493. package/dist/plugin/module.js +116 -116
  494. package/dist/plugin/optimize.js +2 -2
  495. package/dist/plugin/plan.js +103 -103
  496. package/dist/plugin/promise.js +1 -1
  497. package/dist/plugin/provider/amazon-bedrock.js +91 -91
  498. package/dist/plugin/provider/azure.js +118 -118
  499. package/dist/plugin/provider/cerebras.js +1 -1
  500. package/dist/plugin/provider/chatgpt.js +95 -95
  501. package/dist/plugin/provider/cloudflare-ai-gateway.js +114 -114
  502. package/dist/plugin/provider/cloudflare-workers-ai.js +115 -115
  503. package/dist/plugin/provider/cohere.js +2 -2
  504. package/dist/plugin/provider/configured.js +113 -113
  505. package/dist/plugin/provider/digitalocean.js +94 -94
  506. package/dist/plugin/provider/dynamic.js +2 -2
  507. package/dist/plugin/provider/factory.js +1 -1
  508. package/dist/plugin/provider/github-copilot.js +96 -96
  509. package/dist/plugin/provider/gitlab.js +94 -94
  510. package/dist/plugin/provider/google-vertex.js +91 -91
  511. package/dist/plugin/provider/kilo.js +1 -1
  512. package/dist/plugin/provider/llmgateway.js +79 -79
  513. package/dist/plugin/provider/lmstudio.js +117 -117
  514. package/dist/plugin/provider/local.js +114 -114
  515. package/dist/plugin/provider/modal.js +93 -93
  516. package/dist/plugin/provider/nvidia.js +1 -1
  517. package/dist/plugin/provider/ollama.js +117 -117
  518. package/dist/plugin/provider/openai.js +94 -94
  519. package/dist/plugin/provider/opencode.js +98 -98
  520. package/dist/plugin/provider/openrouter.js +92 -92
  521. package/dist/plugin/provider/perplexity.js +2 -2
  522. package/dist/plugin/provider/poe.js +80 -80
  523. package/dist/plugin/provider/prompt-cache-key.js +91 -91
  524. package/dist/plugin/provider/sap-ai-core.js +92 -92
  525. package/dist/plugin/provider/sdk-factory.js +1 -1
  526. package/dist/plugin/provider/snowflake-cortex.js +116 -116
  527. package/dist/plugin/provider/vercel.js +91 -91
  528. package/dist/plugin/provider/vllm.js +117 -117
  529. package/dist/plugin/provider/xai.js +92 -92
  530. package/dist/plugin/provider/zenmux.js +1 -1
  531. package/dist/plugin/provider.js +157 -157
  532. package/dist/plugin/sdk.js +75 -75
  533. package/dist/plugin/service.js +3 -3
  534. package/dist/plugin/skill.js +135 -135
  535. package/dist/plugin/source-directory.js +1 -1
  536. package/dist/plugin/supervisor.js +344 -344
  537. package/dist/plugin/tool-input-repair.js +4 -4
  538. package/dist/plugin/update.js +2 -2
  539. package/dist/plugin/vcs/git.js +87 -87
  540. package/dist/plugin/vcs/hg.js +87 -87
  541. package/dist/plugin/verbosity.js +94 -94
  542. package/dist/plugin/warming.js +115 -115
  543. package/dist/plugin/websearch/exa.js +5 -5
  544. package/dist/plugin/websearch/firecrawl.js +8 -8
  545. package/dist/plugin/websearch/index.js +9 -9
  546. package/dist/plugin/websearch/mcp.js +4 -4
  547. package/dist/plugin/websearch/parallel.js +8 -8
  548. package/dist/plugin/websearch/tavily.js +6 -6
  549. package/dist/plugin/websearch/tinyfish.js +8 -8
  550. package/dist/plugin.js +219 -219
  551. package/dist/project/schema.js +2 -2
  552. package/dist/project/sql.js +4 -4
  553. package/dist/project.js +81 -81
  554. package/dist/provider.js +98 -98
  555. package/dist/pty/protocol.js +1 -1
  556. package/dist/pty/ticket.js +1 -1
  557. package/dist/pty.js +90 -90
  558. package/dist/reference/instructions.js +90 -90
  559. package/dist/reference.js +92 -92
  560. package/dist/repository-cache.js +82 -82
  561. package/dist/repository.js +1 -1
  562. package/dist/ripgrep/binary.js +2 -2
  563. package/dist/ripgrep.js +98 -98
  564. package/dist/rpc.js +87 -87
  565. package/dist/schema.js +1 -1
  566. package/dist/session/affinity.js +1 -1
  567. package/dist/session/command.js +75 -75
  568. package/dist/session/compaction.js +134 -134
  569. package/dist/session/context.js +154 -154
  570. package/dist/session/diff.js +89 -89
  571. package/dist/session/environment.js +5 -5
  572. package/dist/session/error.js +5 -5
  573. package/dist/session/event.js +1 -1
  574. package/dist/session/execution/restart.js +212 -212
  575. package/dist/session/execution.js +126 -126
  576. package/dist/session/generate.js +155 -155
  577. package/dist/session/history.js +13 -13
  578. package/dist/session/inbox.js +89 -89
  579. package/dist/session/info.js +3 -3
  580. package/dist/session/instruction-entry.js +80 -80
  581. package/dist/session/instruction-state.js +8 -8
  582. package/dist/session/instructions.js +98 -98
  583. package/dist/session/message-updater.js +2 -2
  584. package/dist/session/message.js +1 -1
  585. package/dist/session/model-request.js +121 -121
  586. package/dist/session/model-transport.js +9 -9
  587. package/dist/session/move.js +130 -130
  588. package/dist/session/projector.js +87 -87
  589. package/dist/session/prompt.js +106 -106
  590. package/dist/session/provider-context.js +3 -3
  591. package/dist/session/revert.js +91 -91
  592. package/dist/session/run-coordinator.js +3 -3
  593. package/dist/session/runner/index.js +3 -3
  594. package/dist/session/runner/llm.js +223 -223
  595. package/dist/session/runner/max-steps.js +1 -1
  596. package/dist/session/runner/model.js +99 -99
  597. package/dist/session/runner/publish-llm-event.js +114 -114
  598. package/dist/session/runner/retry.js +4 -4
  599. package/dist/session/runner/step.js +124 -124
  600. package/dist/session/runner/to-llm-message.js +2 -2
  601. package/dist/session/schema.js +3 -3
  602. package/dist/session/session.js +165 -165
  603. package/dist/session/shell.js +131 -131
  604. package/dist/session/skill.js +104 -104
  605. package/dist/session/sql.js +5 -5
  606. package/dist/session/stats.js +74 -74
  607. package/dist/session/store.js +82 -82
  608. package/dist/session/subagent-completion.js +1 -1
  609. package/dist/session/subagent-job.js +204 -204
  610. package/dist/session/system-prompt.js +3 -3
  611. package/dist/session/title.js +152 -152
  612. package/dist/session/to-session-error.js +112 -112
  613. package/dist/session/transfer.js +208 -208
  614. package/dist/session/usage.js +1 -1
  615. package/dist/session.js +208 -208
  616. package/dist/shell/parse.js +6 -6
  617. package/dist/shell/result.js +1 -1
  618. package/dist/shell/scan.js +1 -1
  619. package/dist/shell/select.js +9 -9
  620. package/dist/shell.js +133 -133
  621. package/dist/skill/discovery.js +2 -2
  622. package/dist/skill/instructions.js +108 -108
  623. package/dist/skill.js +113 -113
  624. package/dist/snapshot.js +92 -92
  625. package/dist/state.js +1 -1
  626. package/dist/tool/html-markdown.js +1 -1
  627. package/dist/tool/http-body.js +1 -1
  628. package/dist/tool/mcp.js +127 -127
  629. package/dist/tool/plugin/edit.js +121 -121
  630. package/dist/tool/plugin/file-diff.js +1 -1
  631. package/dist/tool/plugin/glob.js +125 -125
  632. package/dist/tool/plugin/grep.js +125 -125
  633. package/dist/tool/plugin/mcp-resource.js +118 -118
  634. package/dist/tool/plugin/opencode.js +3 -3
  635. package/dist/tool/plugin/patch.js +123 -123
  636. package/dist/tool/plugin/question.js +104 -104
  637. package/dist/tool/plugin/read.js +126 -126
  638. package/dist/tool/plugin/shell.js +209 -209
  639. package/dist/tool/plugin/skill.js +114 -114
  640. package/dist/tool/plugin/subagent.js +211 -211
  641. package/dist/tool/plugin/webfetch.js +113 -113
  642. package/dist/tool/plugin/websearch.js +111 -111
  643. package/dist/tool/plugin/write.js +121 -121
  644. package/dist/tool/read-filesystem.js +101 -101
  645. package/dist/tool/runtime.js +1 -1
  646. package/dist/tool-output.js +7 -7
  647. package/dist/tool.js +12 -12
  648. package/dist/types/git.d.ts +23 -10
  649. package/dist/types/session/runner/publish-llm-event.d.ts +2 -1
  650. package/dist/util/error-summary.js +1 -1
  651. package/dist/util/error.js +1 -1
  652. package/dist/util/git-executable.js +2 -2
  653. package/dist/util/iife.js +1 -1
  654. package/dist/util/lazy.js +1 -1
  655. package/dist/util/slug.js +1 -1
  656. package/dist/util/token.js +1 -1
  657. package/dist/util/which.js +1 -1
  658. package/dist/util/wildcard.js +1 -1
  659. package/dist/v1/config/agent.js +5 -5
  660. package/dist/v1/config/command.js +5 -5
  661. package/dist/v1/config/error.js +2 -2
  662. package/dist/v1/config/mcp.js +4 -4
  663. package/dist/v1/config/migrate.js +93 -93
  664. package/dist/v1/config/permission.js +3 -3
  665. package/dist/v1/config/plugin.js +1 -1
  666. package/dist/v1/config/provider-options.js +1 -1
  667. package/dist/v1/config/provider.js +4 -4
  668. package/dist/variant.js +94 -94
  669. package/dist/vcs/patch.js +1 -1
  670. package/dist/vcs.js +90 -90
  671. package/dist/websearch.js +83 -83
  672. package/dist/wellknown/plugin.js +75 -75
  673. package/dist/wellknown.js +82 -82
  674. package/dist/workspace/driver.js +5 -5
  675. package/dist/workspace/sql.js +1 -1
  676. package/dist/workspace.js +81 -81
  677. package/dist/worktree/directory.js +2 -2
  678. package/dist/worktree/git.js +10 -10
  679. package/dist/worktree/sql.js +5 -5
  680. package/dist/worktree/strategies.js +90 -90
  681. package/dist/worktree.js +97 -97
  682. package/package.json +8 -8
  683. package/dist/chunks/kv-7gbq6z1m.js +0 -26
  684. package/dist/chunks/kv-jb1p813v.js +0 -253
  685. package/dist/chunks/kv-p87d201m.js +0 -507
  686. package/dist/chunks/kv-phz3h32g.js +0 -18
  687. package/dist/chunks/kv-zc5g640q.js +0 -466
  688. /package/dist/chunks/{kv-0qkdqm5v.js → persistent-pty-0qkdqm5v.js} +0 -0
  689. /package/dist/chunks/{kv-0zkw76rk.js → persistent-pty-0zkw76rk.js} +0 -0
  690. /package/dist/chunks/{kv-17cy0kzp.js → persistent-pty-17cy0kzp.js} +0 -0
  691. /package/dist/chunks/{kv-1cnp2v09.js → persistent-pty-1cnp2v09.js} +0 -0
  692. /package/dist/chunks/{kv-1kg9ymc8.js → persistent-pty-1kg9ymc8.js} +0 -0
  693. /package/dist/chunks/{kv-24dcb14g.js → persistent-pty-24dcb14g.js} +0 -0
  694. /package/dist/chunks/{kv-2710q6r3.js → persistent-pty-2710q6r3.js} +0 -0
  695. /package/dist/chunks/{kv-2axfhc9x.js → persistent-pty-2axfhc9x.js} +0 -0
  696. /package/dist/chunks/{kv-2c3vjs8z.js → persistent-pty-2c3vjs8z.js} +0 -0
  697. /package/dist/chunks/{kv-34c7v6d4.js → persistent-pty-34c7v6d4.js} +0 -0
  698. /package/dist/chunks/{kv-359p4xyc.js → persistent-pty-359p4xyc.js} +0 -0
  699. /package/dist/chunks/{kv-3asan66x.js → persistent-pty-3asan66x.js} +0 -0
  700. /package/dist/chunks/{kv-3t0ybcrp.js → persistent-pty-3t0ybcrp.js} +0 -0
  701. /package/dist/chunks/{kv-3v8g72cx.js → persistent-pty-3v8g72cx.js} +0 -0
  702. /package/dist/chunks/{kv-3w5fmr99.js → persistent-pty-3w5fmr99.js} +0 -0
  703. /package/dist/chunks/{kv-3wcehsnq.js → persistent-pty-3wcehsnq.js} +0 -0
  704. /package/dist/chunks/{kv-43n2bw4t.js → persistent-pty-43n2bw4t.js} +0 -0
  705. /package/dist/chunks/{kv-4knz6hnm.js → persistent-pty-4knz6hnm.js} +0 -0
  706. /package/dist/chunks/{kv-4vcrnpx2.js → persistent-pty-4vcrnpx2.js} +0 -0
  707. /package/dist/chunks/{kv-4y7fprxs.js → persistent-pty-4y7fprxs.js} +0 -0
  708. /package/dist/chunks/{kv-53557ph1.js → persistent-pty-53557ph1.js} +0 -0
  709. /package/dist/chunks/{kv-550bvhaj.js → persistent-pty-550bvhaj.js} +0 -0
  710. /package/dist/chunks/{kv-5qd3pb7m.js → persistent-pty-5qd3pb7m.js} +0 -0
  711. /package/dist/chunks/{kv-6prwharc.js → persistent-pty-6prwharc.js} +0 -0
  712. /package/dist/chunks/{kv-6q2bdcd1.js → persistent-pty-6q2bdcd1.js} +0 -0
  713. /package/dist/chunks/{kv-7akdwqpd.js → persistent-pty-7akdwqpd.js} +0 -0
  714. /package/dist/chunks/{kv-7m9af43g.js → persistent-pty-7m9af43g.js} +0 -0
  715. /package/dist/chunks/{kv-822emrt2.js → persistent-pty-822emrt2.js} +0 -0
  716. /package/dist/chunks/{kv-84wd9syh.js → persistent-pty-84wd9syh.js} +0 -0
  717. /package/dist/chunks/{kv-88xbtdfr.js → persistent-pty-88xbtdfr.js} +0 -0
  718. /package/dist/chunks/{kv-8n3pysct.js → persistent-pty-8n3pysct.js} +0 -0
  719. /package/dist/chunks/{kv-8wj87zfr.js → persistent-pty-8wj87zfr.js} +0 -0
  720. /package/dist/chunks/{kv-9a4afbnw.js → persistent-pty-9a4afbnw.js} +0 -0
  721. /package/dist/chunks/{kv-9rqn6x4v.js → persistent-pty-9rqn6x4v.js} +0 -0
  722. /package/dist/chunks/{kv-a6k6eb26.js → persistent-pty-a6k6eb26.js} +0 -0
  723. /package/dist/chunks/{kv-af5trqkr.js → persistent-pty-af5trqkr.js} +0 -0
  724. /package/dist/chunks/{kv-afrmfg78.js → persistent-pty-afrmfg78.js} +0 -0
  725. /package/dist/chunks/{kv-aqzs7mqg.js → persistent-pty-aqzs7mqg.js} +0 -0
  726. /package/dist/chunks/{kv-atq7p7m5.js → persistent-pty-atq7p7m5.js} +0 -0
  727. /package/dist/chunks/{kv-bkyjaxrp.js → persistent-pty-bkyjaxrp.js} +0 -0
  728. /package/dist/chunks/{kv-bmr6ed5q.js → persistent-pty-bmr6ed5q.js} +0 -0
  729. /package/dist/chunks/{kv-cf4snx6d.js → persistent-pty-cf4snx6d.js} +0 -0
  730. /package/dist/chunks/{kv-cvy3z8tj.js → persistent-pty-cvy3z8tj.js} +0 -0
  731. /package/dist/chunks/{kv-d9fn303g.js → persistent-pty-d9fn303g.js} +0 -0
  732. /package/dist/chunks/{kv-d9jj8t3e.js → persistent-pty-d9jj8t3e.js} +0 -0
  733. /package/dist/chunks/{kv-dajrwvna.js → persistent-pty-dajrwvna.js} +0 -0
  734. /package/dist/chunks/{kv-dap0rakb.js → persistent-pty-dap0rakb.js} +0 -0
  735. /package/dist/chunks/{kv-df08tz66.js → persistent-pty-df08tz66.js} +0 -0
  736. /package/dist/chunks/{kv-dy18nga0.js → persistent-pty-dy18nga0.js} +0 -0
  737. /package/dist/chunks/{kv-e5kj55wp.js → persistent-pty-e5kj55wp.js} +0 -0
  738. /package/dist/chunks/{kv-e73j6tqm.js → persistent-pty-e73j6tqm.js} +0 -0
  739. /package/dist/chunks/{kv-ec1grn59.js → persistent-pty-ec1grn59.js} +0 -0
  740. /package/dist/chunks/{kv-eh3zwz77.js → persistent-pty-eh3zwz77.js} +0 -0
  741. /package/dist/chunks/{kv-emrn6kk6.js → persistent-pty-emrn6kk6.js} +0 -0
  742. /package/dist/chunks/{kv-f0mxakyp.js → persistent-pty-f0mxakyp.js} +0 -0
  743. /package/dist/chunks/{kv-f6n9ztr4.js → persistent-pty-f6n9ztr4.js} +0 -0
  744. /package/dist/chunks/{kv-faypxj3z.js → persistent-pty-faypxj3z.js} +0 -0
  745. /package/dist/chunks/{kv-fd410y7t.js → persistent-pty-fd410y7t.js} +0 -0
  746. /package/dist/chunks/{kv-fxgpk5d8.js → persistent-pty-fxgpk5d8.js} +0 -0
  747. /package/dist/chunks/{kv-g4wezp1m.js → persistent-pty-g4wezp1m.js} +0 -0
  748. /package/dist/chunks/{kv-g86h250q.js → persistent-pty-g86h250q.js} +0 -0
  749. /package/dist/chunks/{kv-gebd4c9n.js → persistent-pty-gebd4c9n.js} +0 -0
  750. /package/dist/chunks/{kv-gftt206x.js → persistent-pty-gftt206x.js} +0 -0
  751. /package/dist/chunks/{kv-hk9envan.js → persistent-pty-hk9envan.js} +0 -0
  752. /package/dist/chunks/{kv-j2ntwpah.js → persistent-pty-j2ntwpah.js} +0 -0
  753. /package/dist/chunks/{kv-j5zkgpj8.js → persistent-pty-j5zkgpj8.js} +0 -0
  754. /package/dist/chunks/{kv-jjkms2e6.js → persistent-pty-jjkms2e6.js} +0 -0
  755. /package/dist/chunks/{kv-jr7sbwjy.js → persistent-pty-jr7sbwjy.js} +0 -0
  756. /package/dist/chunks/{kv-jwfs4k6c.js → persistent-pty-jwfs4k6c.js} +0 -0
  757. /package/dist/chunks/{kv-jzg6c2d5.js → persistent-pty-jzg6c2d5.js} +0 -0
  758. /package/dist/chunks/{kv-mp448xyj.js → persistent-pty-mp448xyj.js} +0 -0
  759. /package/dist/chunks/{kv-msx8hqn2.js → persistent-pty-msx8hqn2.js} +0 -0
  760. /package/dist/chunks/{kv-n05xt0ee.js → persistent-pty-n05xt0ee.js} +0 -0
  761. /package/dist/chunks/{kv-n3j8tn72.js → persistent-pty-n3j8tn72.js} +0 -0
  762. /package/dist/chunks/{kv-njntx4h6.js → persistent-pty-njntx4h6.js} +0 -0
  763. /package/dist/chunks/{kv-q3sfg36h.js → persistent-pty-q3sfg36h.js} +0 -0
  764. /package/dist/chunks/{kv-q74kybfr.js → persistent-pty-q74kybfr.js} +0 -0
  765. /package/dist/chunks/{kv-qaymkmh1.js → persistent-pty-qaymkmh1.js} +0 -0
  766. /package/dist/chunks/{kv-qb87gjwd.js → persistent-pty-qb87gjwd.js} +0 -0
  767. /package/dist/chunks/{kv-qfa1cgps.js → persistent-pty-qfa1cgps.js} +0 -0
  768. /package/dist/chunks/{kv-qg3g05ea.js → persistent-pty-qg3g05ea.js} +0 -0
  769. /package/dist/chunks/{kv-qrg20bc0.js → persistent-pty-qrg20bc0.js} +0 -0
  770. /package/dist/chunks/{kv-rcb2kzg1.js → persistent-pty-rcb2kzg1.js} +0 -0
  771. /package/dist/chunks/{kv-sdp7kfr6.js → persistent-pty-sdp7kfr6.js} +0 -0
  772. /package/dist/chunks/{kv-ssg3fenm.js → persistent-pty-ssg3fenm.js} +0 -0
  773. /package/dist/chunks/{kv-w803qqfp.js → persistent-pty-w803qqfp.js} +0 -0
  774. /package/dist/chunks/{kv-wc3fc9cn.js → persistent-pty-wc3fc9cn.js} +0 -0
  775. /package/dist/chunks/{kv-wer8tq1h.js → persistent-pty-wer8tq1h.js} +0 -0
  776. /package/dist/chunks/{kv-wtztk69x.js → persistent-pty-wtztk69x.js} +0 -0
  777. /package/dist/chunks/{kv-x0ckcb58.js → persistent-pty-x0ckcb58.js} +0 -0
  778. /package/dist/chunks/{kv-x61499pn.js → persistent-pty-x61499pn.js} +0 -0
  779. /package/dist/chunks/{kv-y44na4kk.js → persistent-pty-y44na4kk.js} +0 -0
  780. /package/dist/chunks/{kv-y8cydn3q.js → persistent-pty-y8cydn3q.js} +0 -0
  781. /package/dist/chunks/{kv-y8f7s663.js → persistent-pty-y8f7s663.js} +0 -0
  782. /package/dist/chunks/{kv-ygaqb7jw.js → persistent-pty-ygaqb7jw.js} +0 -0
  783. /package/dist/chunks/{kv-ym463w8f.js → persistent-pty-ym463w8f.js} +0 -0
  784. /package/dist/chunks/{kv-z5v4ffb3.js → persistent-pty-z5v4ffb3.js} +0 -0
  785. /package/dist/chunks/{kv-z9919s4g.js → persistent-pty-z9919s4g.js} +0 -0
@@ -0,0 +1,806 @@
1
+ import {
2
+ AbsolutePath2,
3
+ RelativePath2
4
+ } from "./persistent-pty-z5v4ffb3.js";
5
+ import {
6
+ makeUnsafe2
7
+ } from "./persistent-pty-nxm207yx.js";
8
+ import {
9
+ MAX_TOTAL_PATCH_BYTES2,
10
+ emptyPatch2,
11
+ chunksByFile2
12
+ } from "./persistent-pty-tazgh4e4.js";
13
+ import {
14
+ gitExecutable2
15
+ } from "./persistent-pty-ef5x83kb.js";
16
+ import {
17
+ __export
18
+ } from "./persistent-pty-9rqn6x4v.js";
19
+
20
+ // src/git.ts
21
+ var exports_git3 = {};
22
+ __export(exports_git3, {
23
+ Git: () => exports_git3,
24
+ OperationError: () => OperationError3,
25
+ Repository: () => Repository2,
26
+ Service: () => Service82,
27
+ TreeID: () => TreeID2,
28
+ Worktree: () => Worktree2,
29
+ WorktreeError: () => WorktreeError2,
30
+ node: () => node86
31
+ });
32
+ import path from "path";
33
+ import { Cause, Context, Effect, Exit, Layer, Option, Schedule, Schema } from "effect";
34
+ import { ChildProcess } from "effect/unstable/process";
35
+ import { FSUtil } from "@opencode/util/fs-util";
36
+ import { AppProcess } from "@opencode/util/process";
37
+ import { makeGlobalNode } from "@opencode/util/effect/app-node";
38
+ class Repository2 extends Schema.Class("Git.Repository")({
39
+ worktree: AbsolutePath2,
40
+ gitDirectory: AbsolutePath2,
41
+ commonDirectory: AbsolutePath2
42
+ }) {
43
+ }
44
+ var snapshotConfigFile = "opencode.gitconfig";
45
+ var snapshotConfigInclude = `[include]
46
+ path = ${snapshotConfigFile}
47
+ `;
48
+ var snapshotConfig = `[core]
49
+ autocrlf = false
50
+ longpaths = true
51
+ symlinks = true
52
+ fsmonitor = false
53
+ untrackedCache = true
54
+ # A split index cannot name its shared file once manyFiles skips index checksums.
55
+ splitIndex = false
56
+ [feature]
57
+ manyFiles = true
58
+ [index]
59
+ version = 4
60
+ threads = true
61
+ `;
62
+ var TreeID2 = Schema.String.pipe(Schema.brand("Git.TreeID"));
63
+ var temporaryIndexPrefix = "index.opencode-";
64
+ var argumentBudget = 24000;
65
+ var looseObjectLimit = 2048;
66
+ var packCountLimit = 16;
67
+
68
+ class OperationError3 extends Schema.TaggedError()("Git.OperationError", {
69
+ operation: Schema.Literals([
70
+ "clone",
71
+ "fetch",
72
+ "checkout",
73
+ "reset",
74
+ "create",
75
+ "refresh",
76
+ "write_tree",
77
+ "list_files",
78
+ "diff",
79
+ "restore",
80
+ "pack"
81
+ ]),
82
+ message: Schema.String,
83
+ directory: Schema.optional(AbsolutePath2),
84
+ cause: Schema.optional(Schema.Defect())
85
+ }) {
86
+ }
87
+
88
+ class Worktree2 extends Schema.Class("Git.Worktree")({
89
+ directory: AbsolutePath2,
90
+ kind: Schema.Literals(["main", "linked"])
91
+ }) {
92
+ }
93
+
94
+ class WorktreeError2 extends Schema.TaggedError()("Git.WorktreeError", {
95
+ operation: Schema.Literals(["create", "remove", "list"]),
96
+ message: Schema.String,
97
+ directory: Schema.optional(AbsolutePath2),
98
+ forceRequired: Schema.optional(Schema.Boolean),
99
+ cause: Schema.optional(Schema.Defect())
100
+ }) {
101
+ }
102
+
103
+ class Service82 extends Context.Service()("@opencode/Git") {
104
+ }
105
+ var layer = Layer.effect(Service82, Effect.gen(function* () {
106
+ const fs = yield* FSUtil.Service;
107
+ const proc = yield* AppProcess.Service;
108
+ const locks = makeUnsafe2();
109
+ const locked = (repository, effect) => locks.withLock(repository.gitDirectory)(effect);
110
+ const discover = Effect.fn("Git.repo.discover")(function* (input) {
111
+ const dotgit = yield* fs.up({ targets: [".git"], start: input, mode: "first" }).pipe(Effect.map((matches) => matches[0]), Effect.orElseSucceed(() => {
112
+ return;
113
+ }));
114
+ if (!dotgit)
115
+ return;
116
+ const cwd = path.dirname(dotgit);
117
+ const result = yield* run(cwd, proc, ["rev-parse", "--git-dir", "--git-common-dir", "--show-toplevel"]);
118
+ const [gitDir, commonDir, topLevel] = result.text.split(/\r?\n/);
119
+ if (!gitDir || !commonDir)
120
+ return;
121
+ return new Repository2({
122
+ worktree: AbsolutePath2.make(topLevel ? resolvePath(cwd, topLevel) : cwd),
123
+ gitDirectory: AbsolutePath2.make(resolvePath(cwd, gitDir)),
124
+ commonDirectory: AbsolutePath2.make(resolvePath(cwd, commonDir))
125
+ });
126
+ });
127
+ const remote = Effect.fn("Git.remote.get")(function* (repository, name = "origin") {
128
+ const result = yield* run(repository.worktree, proc, ["remote", "get-url", name]);
129
+ if (result.exitCode !== 0)
130
+ return;
131
+ return result.text.trim() || undefined;
132
+ });
133
+ const roots = Effect.fn("Git.history.rootCommits")(function* (repository) {
134
+ const result = yield* run(repository.worktree, proc, ["rev-list", "--max-parents=0", "HEAD"]);
135
+ if (result.exitCode !== 0)
136
+ return [];
137
+ return result.text.split(`
138
+ `).map((item) => item.trim()).filter(Boolean).toSorted();
139
+ });
140
+ const head = Effect.fn("Git.history.head")(function* (repository) {
141
+ const result = yield* run(repository.worktree, proc, ["rev-parse", "HEAD"]);
142
+ if (result.exitCode !== 0)
143
+ return;
144
+ return result.text.trim() || undefined;
145
+ });
146
+ const branch = Effect.fn("Git.history.branch")(function* (repository) {
147
+ const result = yield* run(repository.worktree, proc, ["symbolic-ref", "--quiet", "--short", "HEAD"]);
148
+ if (result.exitCode !== 0)
149
+ return;
150
+ return result.text.trim() || undefined;
151
+ });
152
+ const remoteHead = Effect.fn("Git.history.defaultRemoteBranch")(function* (repository, remoteName = "origin") {
153
+ const result = yield* run(repository.worktree, proc, ["symbolic-ref", `refs/remotes/${remoteName}/HEAD`]);
154
+ if (result.exitCode !== 0)
155
+ return;
156
+ return result.text.trim().replace(new RegExp(`^refs/remotes/${remoteName}/`), "") || undefined;
157
+ });
158
+ const operation = Effect.fnUntraced(function* (operation, directory, args) {
159
+ const result = yield* execute(directory, proc, args).pipe(Effect.mapError((cause) => new OperationError3({ operation, directory, message: cause.message, cause })));
160
+ if (result.exitCode === 0)
161
+ return;
162
+ return yield* new OperationError3({
163
+ operation,
164
+ directory,
165
+ message: result.stderr.trim() || result.text.trim() || `Git ${operation} failed`
166
+ });
167
+ });
168
+ const clone = Effect.fn("Git.repo.clone")(function* (input) {
169
+ yield* operation("clone", AbsolutePath2.make(path.dirname(input.directory)), [
170
+ "clone",
171
+ "--depth",
172
+ String(input.depth ?? 100),
173
+ ...input.branch ? ["--branch", input.branch] : [],
174
+ "--",
175
+ input.remote,
176
+ input.directory
177
+ ]);
178
+ const repository = yield* discover(input.directory);
179
+ if (repository)
180
+ return repository;
181
+ return yield* new OperationError3({
182
+ operation: "clone",
183
+ directory: input.directory,
184
+ message: "Cloned repository could not be opened"
185
+ });
186
+ });
187
+ const fetch = Effect.fn("Git.sync.fetchRemotes")(function* (repository, input = {}) {
188
+ yield* operation("fetch", repository.worktree, ["fetch", "--all", ...input.prune === false ? [] : ["--prune"]]);
189
+ });
190
+ const fetchBranch = Effect.fn("Git.sync.fetchBranch")(function* (repository, input) {
191
+ const remoteName = input.remote ?? "origin";
192
+ const spec = `refs/heads/${input.branch}:refs/remotes/${remoteName}/${input.branch}`;
193
+ yield* operation("fetch", repository.worktree, ["fetch", remoteName, input.force === false ? spec : `+${spec}`]);
194
+ });
195
+ const checkout = Effect.fn("Git.sync.checkoutRemoteBranch")(function* (repository, input) {
196
+ const remoteName = input.remote ?? "origin";
197
+ yield* operation("checkout", repository.worktree, [
198
+ "checkout",
199
+ ...input.reset === false ? [input.branch] : ["-B", input.branch, `${remoteName}/${input.branch}`]
200
+ ]);
201
+ });
202
+ const reset = Effect.fn("Git.sync.resetHard")(function* (repository, revision) {
203
+ yield* operation("reset", repository.worktree, ["reset", "--hard", revision]);
204
+ });
205
+ const repositoryArgs = (repository, args) => [
206
+ "--git-dir",
207
+ repository.gitDirectory,
208
+ "--work-tree",
209
+ repository.worktree,
210
+ ...args
211
+ ];
212
+ const repositoryOperation = Effect.fnUntraced(function* (operationName, repository, args, options) {
213
+ const result = yield* proc.run(ChildProcess.make(gitExecutable2, repositoryArgs(repository, args), {
214
+ cwd: repository.worktree,
215
+ env: options?.index ? { ...options.env, GIT_INDEX_FILE: options.index } : options?.env,
216
+ extendEnv: true
217
+ }), { stdin: options?.stdin, maxOutputBytes: options?.maxOutputBytes }).pipe(Effect.mapError((cause) => new OperationError3({
218
+ operation: operationName,
219
+ directory: repository.worktree,
220
+ message: cause.message,
221
+ cause
222
+ })));
223
+ const text = result.stdout.toString("utf8");
224
+ if (result.exitCode === 0)
225
+ return { text, stderr: result.stderr.toString("utf8"), truncated: result.stdoutTruncated };
226
+ return yield* new OperationError3({
227
+ operation: operationName,
228
+ directory: repository.worktree,
229
+ message: result.stderr.toString("utf8").trim() || text.trim() || `Git ${operationName} failed`
230
+ });
231
+ });
232
+ const create = Effect.fn("Git.repo.create")(function* (input) {
233
+ const repository = new Repository2({
234
+ worktree: input.worktree,
235
+ gitDirectory: input.gitDirectory,
236
+ commonDirectory: input.gitDirectory
237
+ });
238
+ if (yield* fs.existsSafe(path.join(input.gitDirectory, "HEAD"))) {
239
+ yield* initRepository({ ...input, directory: input.gitDirectory });
240
+ return repository;
241
+ }
242
+ const temporaryDirectory = AbsolutePath2.make(`${input.gitDirectory}.init-${uniqueSuffix()}`);
243
+ yield* Effect.gen(function* () {
244
+ yield* initRepository({ ...input, directory: temporaryDirectory });
245
+ const renamed = yield* fs.rename(temporaryDirectory, input.gitDirectory).pipe(Effect.exit);
246
+ if (Exit.isSuccess(renamed) || (yield* fs.existsSafe(path.join(input.gitDirectory, "HEAD"))))
247
+ return;
248
+ return yield* new OperationError3({
249
+ operation: "create",
250
+ directory: input.gitDirectory,
251
+ message: "Failed to move Git storage into place",
252
+ cause: Cause.squash(renamed.cause)
253
+ });
254
+ }).pipe(Effect.ensuring(fs.remove(temporaryDirectory, { recursive: true, force: true }).pipe(Effect.ignore)));
255
+ return repository;
256
+ });
257
+ const initRepository = Effect.fnUntraced(function* (input) {
258
+ const operationError = (message) => (cause) => new OperationError3({ operation: "create", directory: input.gitDirectory, message, cause });
259
+ yield* fs.ensureDir(input.directory).pipe(Effect.mapError(operationError("Failed to create Git storage")));
260
+ yield* repositoryOperation("create", new Repository2({ worktree: input.worktree, gitDirectory: input.directory, commonDirectory: input.directory }), ["init"]);
261
+ yield* Effect.gen(function* () {
262
+ yield* fs.writeFileString(path.join(input.directory, snapshotConfigFile), snapshotConfig);
263
+ const config = path.join(input.directory, "config");
264
+ const current = yield* fs.readFileString(config);
265
+ if (current.includes(snapshotConfigInclude))
266
+ return;
267
+ yield* fs.writeFileString(config, `${current.endsWith(`
268
+ `) ? `
269
+ ` : `
270
+
271
+ `}${snapshotConfigInclude}`, {
272
+ flag: "a"
273
+ });
274
+ }).pipe(Effect.mapError(operationError("Failed to configure Git storage")));
275
+ if (!input.seed)
276
+ return;
277
+ yield* fs.ensureDir(path.join(input.directory, "objects", "info")).pipe(Effect.mapError(operationError("Failed to configure shared Git objects")));
278
+ yield* fs.writeFileString(path.join(input.directory, "objects", "info", "alternates"), path.join(input.seed.commonDirectory, "objects") + `
279
+ `).pipe(Effect.mapError(operationError("Failed to configure shared Git objects")));
280
+ yield* fs.copyFile(path.join(input.seed.gitDirectory, "index"), path.join(input.directory, "index")).pipe(Effect.ignore);
281
+ });
282
+ const listChanges = Effect.fnUntraced(function* (repository, scope, index) {
283
+ const list = (args) => repositoryOperation("refresh", repository, args, { index }).pipe(Effect.map((result) => nuls(result.text).map((file) => RelativePath2.make(file.replace(/\/$/, "")))));
284
+ const [tracked, untracked] = yield* Effect.all([
285
+ list(["diff-files", "--name-only", "-z", "--", literalPathspec(scope)]),
286
+ list(["ls-files", "--others", "--exclude-standard", "-z", "--", literalPathspec(scope)])
287
+ ], { concurrency: 2 });
288
+ return { tracked, untracked };
289
+ });
290
+ const updateIndex = Effect.fnUntraced(function* (input) {
291
+ const candidates = [...input.changes.tracked, ...input.changes.untracked];
292
+ if (!candidates.length)
293
+ return { skipped: [] };
294
+ const excluded = input.excluded ?? (input.ignores ? yield* ignored({ repository: input.ignores, paths: candidates }) : new Set);
295
+ const maximum = input.maximumUntrackedFileBytes;
296
+ const skipped = maximum ? (yield* Effect.forEach(input.changes.untracked.filter((item) => !excluded.has(item)), (item) => fs.stat(path.join(input.repository.worktree, item)).pipe(Effect.map((info) => info.type === "File" && Number(info.size) > maximum ? item : undefined), Effect.orElseSucceed(() => {
297
+ return;
298
+ })), { concurrency: 8 })).filter((item) => item !== undefined) : [];
299
+ const skip = new Set(skipped);
300
+ const added = candidates.filter((item) => !excluded.has(item) && !skip.has(item));
301
+ const removed = input.changes.tracked.filter((item) => excluded.has(item));
302
+ if (removed.length)
303
+ yield* repositoryOperation("refresh", input.repository, ["update-index", "--force-remove", "-z", "--stdin"], {
304
+ stdin: removed.join("\x00") + "\x00",
305
+ index: input.index
306
+ });
307
+ const embedded = (yield* Effect.forEach(input.changes.tracked.filter((item) => !excluded.has(item)), (item) => fs.existsSafe(path.join(input.repository.worktree, item, ".git")).pipe(Effect.map((found) => found ? item : undefined)), { concurrency: 8 })).filter((item) => item !== undefined);
308
+ if (added.length)
309
+ yield* repositoryOperation("refresh", input.repository, ["update-index", "--add", "--remove", "--replace", "-z", "--stdin"], { stdin: [...added, ...embedded].join("\x00") + "\x00", index: input.index });
310
+ return { skipped };
311
+ });
312
+ const refresh = Effect.fn("Git.index.refresh")(function* (input) {
313
+ return yield* updateIndex({ ...input, changes: yield* listChanges(input.repository, input.scope) });
314
+ });
315
+ const ignored = Effect.fn("Git.index.ignored")(function* (input) {
316
+ if (!input.paths.length)
317
+ return new Set;
318
+ const result = yield* proc.run(ChildProcess.make(gitExecutable2, repositoryArgs(input.repository, ["check-ignore", "--no-index", "--stdin", "-z"]), {
319
+ cwd: input.repository.worktree,
320
+ extendEnv: true
321
+ }), { stdin: input.paths.join("\x00") + "\x00" }).pipe(Effect.mapError((cause) => new OperationError3({
322
+ operation: "list_files",
323
+ directory: input.repository.worktree,
324
+ message: cause.message,
325
+ cause
326
+ })));
327
+ if (result.exitCode !== 0 && result.exitCode !== 1)
328
+ return yield* new OperationError3({
329
+ operation: "list_files",
330
+ directory: input.repository.worktree,
331
+ message: result.stderr.toString("utf8").trim() || "Failed to check ignored paths"
332
+ });
333
+ return new Set(nuls(result.stdout.toString("utf8")).map((file) => RelativePath2.make(file)));
334
+ });
335
+ const writeTree = Effect.fn("Git.tree.write")(function* (repository, index) {
336
+ const tree = (yield* repositoryOperation("write_tree", repository, ["write-tree"], { index })).text.trim();
337
+ if (/^[0-9a-f]{40,64}$/.test(tree))
338
+ return TreeID2.make(tree);
339
+ return yield* new OperationError3({
340
+ operation: "write_tree",
341
+ directory: repository.worktree,
342
+ message: `Invalid tree ID: ${tree}`
343
+ });
344
+ });
345
+ const indexFile = (repository) => path.join(repository.gitDirectory, "index");
346
+ const indexFingerprint = (file) => fs.stat(file).pipe(Effect.map((info) => [Option.getOrUndefined(info.ino), info.size, Option.getOrUndefined(info.mtime)?.getTime()].join(":")), Effect.orElseSucceed(() => {
347
+ return;
348
+ }));
349
+ const copyIndex = Effect.fnUntraced(function* (from, to) {
350
+ const info = yield* fs.stat(from);
351
+ yield* fs.copyFile(from, to);
352
+ const mtime = Option.getOrUndefined(info.mtime);
353
+ if (mtime)
354
+ yield* fs.utimes(to, Option.getOrElse(info.atime, () => mtime), mtime).pipe(Effect.ignore);
355
+ });
356
+ const withTemporaryIndex = (repository, use) => Effect.acquireUseRelease(Effect.gen(function* () {
357
+ const current = indexFile(repository);
358
+ const index = temporaryIndex(repository);
359
+ if (!(yield* fs.existsSafe(current)))
360
+ return index;
361
+ const linked = yield* fs.link(current, index).pipe(Effect.as(true), Effect.orElseSucceed(() => false));
362
+ if (linked)
363
+ return index;
364
+ yield* copyIndex(current, index).pipe(Effect.mapError((cause) => new OperationError3({
365
+ operation: "refresh",
366
+ directory: repository.gitDirectory,
367
+ message: "Failed to prepare a temporary index",
368
+ cause
369
+ })));
370
+ return index;
371
+ }), (index) => Effect.gen(function* () {
372
+ const value = yield* use(index);
373
+ const installed = yield* Effect.uninterruptible(Effect.gen(function* () {
374
+ const fingerprint = yield* indexFingerprint(index);
375
+ const renamed = yield* fs.rename(index, indexFile(repository)).pipe(Effect.retry({ times: 3, schedule: Schedule.spaced("20 millis") }), Effect.as(true), Effect.orElseSucceed(() => false));
376
+ return renamed ? fingerprint : undefined;
377
+ }));
378
+ return { value, installed };
379
+ }), (index) => fs.remove(index, { force: true }).pipe(Effect.ignore));
380
+ const lastCaptures = new Map;
381
+ const preparedStores = new Set;
382
+ const attemptCapture = Effect.fnUntraced(function* (input) {
383
+ const result = yield* withTemporaryIndex(input.repository, (index) => Effect.gen(function* () {
384
+ const scanned = yield* indexFingerprint(index);
385
+ const changes = yield* Effect.forEach(input.scopes, (scope) => listChanges(input.repository, scope, index), {
386
+ concurrency: "unbounded"
387
+ });
388
+ const last = lastCaptures.get(input.repository.gitDirectory);
389
+ const untracked = changes.flatMap((change) => change.untracked);
390
+ const excluded = scanned && last?.fingerprint === scanned && changes.every((change) => !change.tracked.length) ? input.ignores ? yield* ignored({ repository: input.ignores, paths: untracked }) : new Set : undefined;
391
+ if (last && excluded && untracked.every((file) => excluded.has(file)))
392
+ return last.tree;
393
+ yield* Effect.forEach(changes, (change) => updateIndex({ ...input, changes: change, index, excluded }), {
394
+ discard: true
395
+ });
396
+ return yield* writeTree(input.repository, index);
397
+ }));
398
+ if (result.installed)
399
+ lastCaptures.set(input.repository.gitDirectory, { fingerprint: result.installed, tree: result.value });
400
+ if (!result.installed)
401
+ lastCaptures.delete(input.repository.gitDirectory);
402
+ return result.value;
403
+ });
404
+ const captureTree = Effect.fn("Git.tree.capture")((input) => locked(input.repository, Effect.gen(function* () {
405
+ if (!preparedStores.has(input.repository.gitDirectory)) {
406
+ preparedStores.add(input.repository.gitDirectory);
407
+ yield* sweepTemporaryIndexes(input.repository);
408
+ yield* ensureSnapshotConfig(input.repository);
409
+ }
410
+ return yield* attemptCapture(input).pipe(Effect.catch((error) => Effect.gen(function* () {
411
+ if (!(yield* isIndexUnreadable(input.repository)))
412
+ return yield* error;
413
+ yield* Effect.logWarning("rebuilding unreadable snapshot index", {
414
+ directory: input.repository.gitDirectory,
415
+ message: error.message
416
+ });
417
+ yield* rebuildIndex(input.repository, input.ignores);
418
+ return yield* attemptCapture(input);
419
+ })));
420
+ })));
421
+ const isIndexUnreadable = Effect.fnUntraced(function* (repository) {
422
+ if (!(yield* fs.existsSafe(indexFile(repository))))
423
+ return false;
424
+ return yield* repositoryOperation("refresh", repository, [
425
+ "ls-files",
426
+ "-z",
427
+ "--",
428
+ literalPathspec(".opencode-probe")
429
+ ]).pipe(Effect.match({ onSuccess: () => false, onFailure: (error) => error.cause === undefined }));
430
+ });
431
+ const rebuildIndex = Effect.fnUntraced(function* (repository, source) {
432
+ lastCaptures.delete(repository.gitDirectory);
433
+ const temporary = temporaryIndex(repository);
434
+ const copied = source ? yield* copyIndex(path.join(source.gitDirectory, "index"), temporary).pipe(Effect.as(true), Effect.orElseSucceed(() => false)) : false;
435
+ yield* (copied ? fs.rename(temporary, indexFile(repository)) : fs.remove(indexFile(repository), { force: true })).pipe(Effect.ignore, Effect.ensuring(fs.remove(temporary, { force: true }).pipe(Effect.ignore)));
436
+ });
437
+ const ensureSnapshotConfig = Effect.fnUntraced(function* (repository) {
438
+ const file = path.join(repository.gitDirectory, snapshotConfigFile);
439
+ const current = yield* fs.readFileStringSafe(file).pipe(Effect.orElseSucceed(() => {
440
+ return;
441
+ }));
442
+ if (current === undefined || current === snapshotConfig)
443
+ return;
444
+ const temporary = `${file}.${uniqueSuffix()}`;
445
+ yield* fs.writeFileString(temporary, snapshotConfig).pipe(Effect.andThen(fs.rename(temporary, file)), Effect.ignore, Effect.ensuring(fs.remove(temporary, { force: true }).pipe(Effect.ignore)));
446
+ });
447
+ const temporaryIndex = (repository) => path.join(repository.gitDirectory, `${temporaryIndexPrefix}${Date.now()}-${uniqueSuffix()}`);
448
+ const sweepTemporaryIndexes = Effect.fnUntraced(function* (repository) {
449
+ const cutoff = Date.now() - 60 * 60 * 1000;
450
+ const entries = yield* fs.readDirectory(repository.gitDirectory).pipe(Effect.orElseSucceed(() => []));
451
+ yield* Effect.forEach(entries.filter((entry) => entry.startsWith(temporaryIndexPrefix) && Number(entry.slice(temporaryIndexPrefix.length).split("-")[0]) < cutoff), (entry) => fs.remove(path.join(repository.gitDirectory, entry), { force: true }).pipe(Effect.ignore), { discard: true });
452
+ });
453
+ const treeFiles = Effect.fn("Git.tree.files")(function* (input) {
454
+ return nuls((yield* repositoryOperation("list_files", input.repository, [
455
+ "diff",
456
+ "--name-only",
457
+ "--no-renames",
458
+ "-z",
459
+ input.from,
460
+ input.to
461
+ ])).text).map((file) => RelativePath2.make(file));
462
+ });
463
+ const treeDiff = Effect.fn("Git.tree.diff")(function* (input) {
464
+ if (input.paths?.length === 0)
465
+ return [];
466
+ const groups = input.paths ? pathGroups(input.paths) : [undefined];
467
+ const diffs = [];
468
+ let patchBudget = MAX_TOTAL_PATCH_BYTES2;
469
+ for (const paths of groups) {
470
+ const group = yield* diffGroup({ ...input, paths }, patchBudget);
471
+ diffs.push(...group.diffs);
472
+ patchBudget = group.truncated ? 0 : patchBudget - group.patchBytes;
473
+ }
474
+ return diffs;
475
+ });
476
+ const diffGroup = Effect.fnUntraced(function* (input, patchBudget) {
477
+ const args = ["--no-renames", input.from, input.to, "--", ...input.paths ?? []];
478
+ const [names, numbers, patch] = yield* Effect.all([
479
+ repositoryOperation("diff", input.repository, [
480
+ "--literal-pathspecs",
481
+ "diff",
482
+ "--name-status",
483
+ "-z",
484
+ ...args
485
+ ]),
486
+ repositoryOperation("diff", input.repository, ["--literal-pathspecs", "diff", "--numstat", "-z", ...args]),
487
+ patchBudget > 0 ? repositoryOperation("diff", input.repository, [
488
+ "--literal-pathspecs",
489
+ "-c",
490
+ "core.quotepath=false",
491
+ "diff",
492
+ "--no-ext-diff",
493
+ `--unified=${input.context ?? 3}`,
494
+ ...args
495
+ ], { maxOutputBytes: patchBudget }) : Effect.succeed({ text: "", stderr: "", truncated: true })
496
+ ], { concurrency: 3 });
497
+ const statuses = nuls(names.text);
498
+ const files = statuses.flatMap((code, index) => {
499
+ const file = statuses[index + 1];
500
+ if (index % 2 !== 0 || !file)
501
+ return [];
502
+ return [
503
+ {
504
+ file: RelativePath2.make(file),
505
+ status: code.startsWith("A") ? "added" : code.startsWith("D") ? "deleted" : "modified"
506
+ }
507
+ ];
508
+ });
509
+ const stats = new Map(nuls(numbers.text).flatMap((line) => {
510
+ const [additions, deletions, ...file] = line.split("\t");
511
+ if (!additions || !deletions || file.length === 0)
512
+ return [];
513
+ return [
514
+ [
515
+ file.join("\t"),
516
+ additions === "-" || deletions === "-" ? { binary: true, additions: 0, deletions: 0 } : { binary: false, additions: Number(additions), deletions: Number(deletions) }
517
+ ]
518
+ ];
519
+ }));
520
+ const patches = chunksByFile2(patch, (index) => files[index]?.file);
521
+ return {
522
+ diffs: files.map((entry) => {
523
+ const stat = stats.get(entry.file);
524
+ return {
525
+ ...entry,
526
+ additions: stat?.additions ?? 0,
527
+ deletions: stat?.deletions ?? 0,
528
+ patch: stat?.binary ? "" : patches.get(entry.file) ?? emptyPatch2(entry.file)
529
+ };
530
+ }),
531
+ patchBytes: Buffer.byteLength(patch.text),
532
+ truncated: patch.truncated
533
+ };
534
+ });
535
+ const hasEntry = Effect.fnUntraced(function* (repository, tree, file) {
536
+ const text = (yield* repositoryOperation("restore", repository, [
537
+ "ls-tree",
538
+ "-z",
539
+ tree,
540
+ "--",
541
+ literalPathspec(file)
542
+ ])).text.replace(/\0$/, "");
543
+ if (!text)
544
+ return false;
545
+ if (!/^\d+\s+\w+\s+[0-9a-f]+\t/.test(text))
546
+ return yield* new OperationError3({
547
+ operation: "restore",
548
+ directory: repository.worktree,
549
+ message: `Invalid tree entry for ${file}`
550
+ });
551
+ return true;
552
+ });
553
+ const removePath = (repository, file) => fs.remove(path.join(repository.worktree, file), { recursive: true, force: true }).pipe(Effect.mapError((cause) => new OperationError3({
554
+ operation: "restore",
555
+ directory: repository.worktree,
556
+ message: `Failed to remove ${file}`,
557
+ cause
558
+ })));
559
+ const pathsInTree = Effect.fnUntraced(function* (repository, tree, files) {
560
+ const pathspecs = files.map(literalPathspec);
561
+ const fits = pathspecs.reduce((length, pathspec) => length + pathspec.length + 1, 0) <= argumentBudget;
562
+ const result = yield* repositoryOperation("restore", repository, fits ? ["ls-tree", "-z", tree, "--", ...pathspecs] : ["ls-tree", "-r", "-t", "-z", "--full-tree", tree]);
563
+ const listed = yield* Effect.forEach(nuls(result.text), (record) => {
564
+ const match = /^\d+ \w+ [0-9a-f]+\t(.*)$/s.exec(record);
565
+ if (match)
566
+ return Effect.succeed(RelativePath2.make(match[1]));
567
+ return Effect.fail(new OperationError3({
568
+ operation: "restore",
569
+ directory: repository.worktree,
570
+ message: `Invalid tree entry: ${record}`
571
+ }));
572
+ });
573
+ return new Set(listed);
574
+ });
575
+ const restore = Effect.fn("Git.tree.restore")((input) => locked(input.repository, Effect.gen(function* () {
576
+ if (!input.files.size)
577
+ return;
578
+ if (!canBatchRestore([...input.files.keys()]))
579
+ return yield* Effect.forEach(input.files, ([file, tree]) => Effect.gen(function* () {
580
+ if (!(yield* hasEntry(input.repository, tree, file)))
581
+ return yield* removePath(input.repository, file);
582
+ yield* withTemporaryIndex(input.repository, (index) => repositoryOperation("restore", input.repository, ["checkout", tree, "--", literalPathspec(file)], {
583
+ index
584
+ }));
585
+ }), { discard: true });
586
+ const groups = new Map;
587
+ input.files.forEach((tree, file) => groups.set(tree, [...groups.get(tree) ?? [], file]));
588
+ const plan = yield* Effect.forEach(groups, ([tree, files]) => pathsInTree(input.repository, tree, files).pipe(Effect.map((present) => ({
589
+ tree,
590
+ present: files.filter((file) => present.has(file)),
591
+ absent: files.filter((file) => !present.has(file))
592
+ }))));
593
+ const checkouts = plan.filter((item) => item.present.length);
594
+ if (checkouts.length)
595
+ yield* withTemporaryIndex(input.repository, (index) => Effect.forEach(checkouts, (item) => repositoryOperation("restore", input.repository, ["checkout", item.tree, "--pathspec-from-file=-", "--pathspec-file-nul"], { stdin: item.present.map(literalPathspec).join("\x00") + "\x00", index }), { discard: true }));
596
+ yield* Effect.forEach(plan.flatMap((item) => item.absent), (file) => removePath(input.repository, file), { concurrency: 16, discard: true });
597
+ })));
598
+ const packObjects = Effect.fn("Git.objects.pack")(function* (repository) {
599
+ const objects = path.join(repository.gitDirectory, "objects");
600
+ const packDirectory = path.join(objects, "pack");
601
+ const loose = yield* looseObjects(objects);
602
+ const packs = yield* localPacks(packDirectory);
603
+ const combinePacks = packs.length >= packCountLimit;
604
+ if (loose.length < looseObjectLimit && !combinePacks)
605
+ return;
606
+ yield* withPackLock(repository, Effect.gen(function* () {
607
+ yield* sweepTemporaryPacks(packDirectory);
608
+ const combined = combinePacks ? yield* Effect.forEach(packs, (pack) => packIndex(repository, path.join(packDirectory, `${pack}.idx`)).pipe(Effect.map((oids) => ({ pack, oids })))) : [];
609
+ const objectIds = [...new Set([...loose.map((item) => item.oid), ...combined.flatMap((item) => item.oids)])];
610
+ if (!objectIds.length)
611
+ return;
612
+ const newPacks = (yield* repositoryOperation("pack", repository, [
613
+ "-c",
614
+ "pack.threads=2",
615
+ "-c",
616
+ "pack.windowMemory=64m",
617
+ "pack-objects",
618
+ "-q",
619
+ "--non-empty",
620
+ path.join(packDirectory, "pack")
621
+ ], { stdin: objectIds.join(`
622
+ `) + `
623
+ ` })).text.split(`
624
+ `).map((line) => line.trim()).filter(Boolean);
625
+ const packedIds = new Set((yield* Effect.forEach(newPacks, (name) => packIndex(repository, path.join(packDirectory, `pack-${name}.idx`)))).flat());
626
+ const missing = objectIds.filter((oid) => !packedIds.has(oid));
627
+ if (missing.length)
628
+ return yield* new OperationError3({
629
+ operation: "pack",
630
+ directory: repository.gitDirectory,
631
+ message: `Packed ${packedIds.size} objects but ${missing.length} are missing; nothing was removed`
632
+ });
633
+ yield* Effect.uninterruptible(Effect.gen(function* () {
634
+ yield* Effect.forEach(loose, (item) => fs.remove(item.file, { force: true }).pipe(Effect.ignore), {
635
+ concurrency: 16,
636
+ discard: true
637
+ });
638
+ const newPackNames = new Set(newPacks.map((name) => `pack-${name}`));
639
+ yield* Effect.forEach(combined.filter((item) => !newPackNames.has(item.pack)), (item) => Effect.forEach([".idx", ".pack", ".rev", ".bitmap", ".mtimes"], (extension) => fs.remove(path.join(packDirectory, `${item.pack}${extension}`), { force: true }).pipe(Effect.ignore), { discard: true }), { discard: true });
640
+ }));
641
+ }));
642
+ });
643
+ const looseObjects = Effect.fnUntraced(function* (objects) {
644
+ const fanout = (yield* fs.readDirectory(objects).pipe(Effect.orElseSucceed(() => []))).filter((entry) => /^[0-9a-f]{2}$/.test(entry));
645
+ const listed = yield* Effect.forEach(fanout, (prefix) => fs.readDirectory(path.join(objects, prefix)).pipe(Effect.orElseSucceed(() => []), Effect.map((entries) => entries.filter((entry) => /^[0-9a-f]{38}$|^[0-9a-f]{62}$/.test(entry)).map((entry) => ({ oid: prefix + entry, file: path.join(objects, prefix, entry) })))), { concurrency: 16 });
646
+ return listed.flat();
647
+ });
648
+ const localPacks = Effect.fnUntraced(function* (directory) {
649
+ const entries = new Set(yield* fs.readDirectory(directory).pipe(Effect.orElseSucceed(() => [])));
650
+ return [...entries].filter((entry) => entry.startsWith("pack-") && entry.endsWith(".pack")).map((entry) => entry.slice(0, -".pack".length)).filter((pack) => entries.has(`${pack}.idx`) && !entries.has(`${pack}.keep`) && !entries.has(`${pack}.promisor`));
651
+ });
652
+ const packIndex = Effect.fnUntraced(function* (repository, file) {
653
+ const bytes = yield* fs.readFile(file).pipe(Effect.mapError((cause) => new OperationError3({
654
+ operation: "pack",
655
+ directory: repository.gitDirectory,
656
+ message: `Failed to read ${file}`,
657
+ cause
658
+ })));
659
+ const parsed = packIndexObjectIDs(bytes);
660
+ if (parsed)
661
+ return parsed;
662
+ const result = yield* repositoryOperation("pack", repository, ["show-index"], { stdin: bytes });
663
+ return result.text.split(`
664
+ `).flatMap((line) => {
665
+ const oid = line.split(" ")[1];
666
+ return oid ? [oid] : [];
667
+ });
668
+ });
669
+ const sweepTemporaryPacks = Effect.fnUntraced(function* (directory) {
670
+ const cutoff = Date.now() - 60 * 60 * 1000;
671
+ const entries = yield* fs.readDirectory(directory).pipe(Effect.orElseSucceed(() => []));
672
+ const indexed = new Set(entries.filter((entry) => entry.endsWith(".idx")).map((entry) => entry.slice(0, -4)));
673
+ yield* Effect.forEach(entries.filter((entry) => entry.startsWith("tmp_") || entry.startsWith("pack-") && entry.endsWith(".pack") && !indexed.has(entry.slice(0, -5))), (entry) => fs.stat(path.join(directory, entry)).pipe(Effect.flatMap((info) => (Option.getOrUndefined(info.mtime)?.getTime() ?? 0) < cutoff ? fs.remove(path.join(directory, entry), { force: true }) : Effect.void), Effect.ignore), { discard: true });
674
+ });
675
+ const withPackLock = (repository, effect) => {
676
+ const file = path.join(repository.gitDirectory, "opencode-pack.lock");
677
+ return Effect.gen(function* () {
678
+ const stale = yield* fs.stat(file).pipe(Effect.map((info) => (Option.getOrUndefined(info.mtime)?.getTime() ?? 0) < Date.now() - 60 * 60 * 1000), Effect.orElseSucceed(() => false));
679
+ if (stale)
680
+ yield* fs.remove(file, { force: true }).pipe(Effect.ignore);
681
+ const acquired = yield* fs.writeFileString(file, String(process.pid), { flag: "wx" }).pipe(Effect.as(true), Effect.orElseSucceed(() => false));
682
+ if (!acquired)
683
+ return;
684
+ yield* effect.pipe(Effect.ensuring(fs.remove(file, { force: true }).pipe(Effect.ignore)));
685
+ });
686
+ };
687
+ const worktreeRun = Effect.fnUntraced(function* (operation, repository, args, worktreeDirectory, cwd = repository.worktree) {
688
+ const result = yield* proc.run(ChildProcess.make(gitExecutable2, args, { cwd, extendEnv: true, stdin: "ignore" })).pipe(Effect.mapError((cause) => new WorktreeError2({ operation, directory: worktreeDirectory, message: cause.message, cause })));
689
+ if (result.exitCode === 0)
690
+ return result.stdout.toString("utf8");
691
+ const message = result.stderr.toString("utf8").trim() || result.stdout.toString("utf8").trim() || "Git failed";
692
+ return yield* new WorktreeError2({
693
+ operation,
694
+ directory: worktreeDirectory,
695
+ message,
696
+ forceRequired: operation === "remove" && /contains modified or untracked files|is dirty/i.test(message)
697
+ });
698
+ });
699
+ const worktreeCreate = Effect.fn("Git.worktree.create")(function* (input) {
700
+ yield* worktreeRun("create", input.repository, ["worktree", "add", "--detach", "--", input.directory, input.ref ?? "HEAD"], input.directory);
701
+ const repository = yield* discover(input.directory);
702
+ if (repository)
703
+ return repository;
704
+ return yield* new WorktreeError2({
705
+ operation: "create",
706
+ directory: input.directory,
707
+ message: "Created worktree could not be opened"
708
+ });
709
+ });
710
+ const worktreeRemove = Effect.fn("Git.worktree.remove")(function* (input) {
711
+ yield* worktreeRun("remove", input.repository, ["worktree", "remove", ...input.force ? ["--force"] : [], input.directory], input.directory, input.repository.commonDirectory);
712
+ });
713
+ const worktreeList = Effect.fn("Git.worktree.list")(function* (repository) {
714
+ return (yield* worktreeRun("list", repository, ["worktree", "list", "--porcelain"])).split(`
715
+ `).filter((line) => line.startsWith("worktree ")).map((line, index) => new Worktree2({
716
+ directory: AbsolutePath2.make(resolvePath(repository.worktree, line.slice("worktree ".length).trim())),
717
+ kind: index === 0 ? "main" : "linked"
718
+ }));
719
+ });
720
+ return Service82.of({
721
+ repo: { discover, clone, create },
722
+ remote: { get: remote },
723
+ history: { head, branch, defaultRemoteBranch: remoteHead, rootCommits: roots },
724
+ sync: { fetchRemotes: fetch, fetchBranch, checkoutRemoteBranch: checkout, resetHard: reset },
725
+ worktree: { create: worktreeCreate, remove: worktreeRemove, list: worktreeList },
726
+ index: { refresh, ignored },
727
+ tree: {
728
+ capture: captureTree,
729
+ write: (repository) => writeTree(repository),
730
+ files: treeFiles,
731
+ diff: treeDiff,
732
+ restore
733
+ },
734
+ objects: { pack: packObjects }
735
+ });
736
+ }));
737
+ var node86 = makeGlobalNode({ service: Service82, layer, deps: [FSUtil.node, AppProcess.node] });
738
+ function run(cwd, proc, args) {
739
+ return execute(cwd, proc, args).pipe(Effect.orElseSucceed(() => ({ exitCode: 1, text: "", stderr: "" })));
740
+ }
741
+ function execute(cwd, proc, args) {
742
+ return proc.run(ChildProcess.make(gitExecutable2, args, {
743
+ cwd,
744
+ extendEnv: true,
745
+ stdin: "ignore"
746
+ })).pipe(Effect.map((result) => ({
747
+ exitCode: result.exitCode,
748
+ text: result.stdout.toString("utf8"),
749
+ stderr: result.stderr.toString("utf8")
750
+ })));
751
+ }
752
+ function nuls(text) {
753
+ return text.split("\x00").filter(Boolean);
754
+ }
755
+ function literalPathspec(file) {
756
+ return `:(literal)${file}`;
757
+ }
758
+ function canBatchRestore(files) {
759
+ const canonical = files.every((file) => file.split("/").every((part) => /^[\x20-\x7e]+$/.test(part) && !/[\\:]/.test(part) && !/[. ]$/.test(part)));
760
+ if (!canonical)
761
+ return false;
762
+ const folded = new Set(files.map((file) => file.toLowerCase()));
763
+ if (folded.size !== files.length)
764
+ return false;
765
+ return files.every((file) => {
766
+ const parts = file.toLowerCase().split("/");
767
+ return parts.slice(1).every((_, index) => !folded.has(parts.slice(0, index + 1).join("/")));
768
+ });
769
+ }
770
+ function packIndexObjectIDs(bytes) {
771
+ const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
772
+ if (bytes.length < 1032 || view.getUint32(0) !== 4285812579 || view.getUint32(4) !== 2)
773
+ return;
774
+ const count = view.getUint32(8 + 255 * 4);
775
+ const hash = (bytes.length - 1032 - 8 * count) / (count + 2);
776
+ if (hash !== 20 && hash !== 32)
777
+ return;
778
+ return Array.from({ length: count }, (_, index) => Buffer.from(bytes.subarray(1032 + index * hash, 1032 + (index + 1) * hash)).toString("hex"));
779
+ }
780
+ function pathGroups(paths) {
781
+ if (process.platform !== "win32")
782
+ return [paths];
783
+ return paths.toSorted((left, right) => Buffer.compare(Buffer.from(left), Buffer.from(right))).reduce((state, file) => {
784
+ const cost = file.length + 3;
785
+ const current = state.groups.at(-1);
786
+ if (current && state.length + cost <= argumentBudget) {
787
+ current.push(file);
788
+ return { groups: state.groups, length: state.length + cost };
789
+ }
790
+ return { groups: [...state.groups, [file]], length: cost };
791
+ }, { groups: [], length: 0 }).groups;
792
+ }
793
+ function uniqueSuffix() {
794
+ return `${process.pid}-${Math.random().toString(36).slice(2)}`;
795
+ }
796
+ function resolvePath(cwd, value) {
797
+ const trimmed = value.replace(/[\r\n]+$/, "");
798
+ if (!trimmed)
799
+ return cwd;
800
+ const normalized = FSUtil.windowsPath(trimmed);
801
+ if (path.isAbsolute(normalized))
802
+ return path.normalize(normalized);
803
+ return path.resolve(cwd, normalized);
804
+ }
805
+
806
+ export { Repository2, TreeID2, OperationError3, Worktree2, WorktreeError2, Service82, node86, exports_git3 };