@opencode-ai/cli-darwin-x64 0.0.0-beta-202606070621 → 0.0.0-beta-202606070725

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 (187) hide show
  1. package/bin/{chunk-jfkqg2y4.js.map → chunk-05nepysv.js.map} +1 -1
  2. package/bin/{chunk-xsdvcn6v.js.map → chunk-07m152g3.js.map} +1 -1
  3. package/bin/{chunk-1btww6bw.js.map → chunk-0h23a7y9.js.map} +1 -1
  4. package/bin/chunk-0hw6knq4.js.map +13 -0
  5. package/bin/{chunk-1yyxvqw9.js.map → chunk-0mrc2mg3.js.map} +1 -1
  6. package/bin/{chunk-31ab3ht9.js.map → chunk-0paaeft0.js.map} +1 -1
  7. package/bin/{chunk-h2dnda4d.js.map → chunk-0qga0hbv.js.map} +1 -1
  8. package/bin/{chunk-hra5nhs3.js.map → chunk-1a8qsjj9.js.map} +2 -2
  9. package/bin/{chunk-w2t59bwj.js.map → chunk-1n111v89.js.map} +1 -1
  10. package/bin/{chunk-pcsm2n5f.js.map → chunk-1pr4t7q1.js.map} +1 -1
  11. package/bin/{chunk-btpgrkq6.js.map → chunk-1xnbtmtm.js.map} +1 -1
  12. package/bin/{chunk-z93jensj.js.map → chunk-2nz63b6j.js.map} +2 -2
  13. package/bin/{chunk-sfc8xzmv.js.map → chunk-2pwf1mhm.js.map} +1 -1
  14. package/bin/{chunk-7j6m8b4q.js.map → chunk-2q8jpzfn.js.map} +1 -1
  15. package/bin/{chunk-5n6r19gh.js.map → chunk-2xhv7bwb.js.map} +1 -1
  16. package/bin/{chunk-kr8mp1wy.js.map → chunk-2z35fkzr.js.map} +1 -1
  17. package/bin/{chunk-bhnn1691.js.map → chunk-30yw80hh.js.map} +1 -1
  18. package/bin/{chunk-bjf29a8y.js.map → chunk-381b2j09.js.map} +2 -2
  19. package/bin/{chunk-ws5m6p05.js.map → chunk-3ft127pe.js.map} +1 -1
  20. package/bin/{chunk-xe2n32pr.js.map → chunk-3k30kbd9.js.map} +1 -1
  21. package/bin/{chunk-jf83720m.js.map → chunk-3kjpb3v3.js.map} +1 -1
  22. package/bin/{chunk-9b0ef92v.js.map → chunk-3p5p3nae.js.map} +1 -1
  23. package/bin/{chunk-akgvtcd9.js.map → chunk-44wnjjsc.js.map} +1 -1
  24. package/bin/{chunk-19b0m0ky.js.map → chunk-4n6c7ts6.js.map} +2 -2
  25. package/bin/{chunk-m1przeh1.js.map → chunk-4vsstw6x.js.map} +1 -1
  26. package/bin/{chunk-dwynxw8t.js.map → chunk-50q0tjz5.js.map} +1 -1
  27. package/bin/{chunk-acr6w36h.js.map → chunk-5cgzyybw.js.map} +2 -2
  28. package/bin/{chunk-g97p4qzs.js.map → chunk-5g0bwafa.js.map} +1 -1
  29. package/bin/chunk-5gw08dzg.js.map +22 -0
  30. package/bin/{chunk-3qhwcyq6.js.map → chunk-5seh0nhz.js.map} +1 -1
  31. package/bin/{chunk-c25fj37p.js.map → chunk-5xx71t8z.js.map} +1 -1
  32. package/bin/chunk-60etdgbd.js.map +12 -0
  33. package/bin/{chunk-qwdzfdj2.js.map → chunk-63knpfq1.js.map} +1 -1
  34. package/bin/{chunk-5a0snzf9.js.map → chunk-66byxq9k.js.map} +1 -1
  35. package/bin/{chunk-qrrqmb05.js.map → chunk-69v174p8.js.map} +1 -1
  36. package/bin/chunk-6cb62ch8.js.map +10 -0
  37. package/bin/{chunk-7vtzx4v9.js.map → chunk-6e4sw21w.js.map} +1 -1
  38. package/bin/{chunk-0dfz3rfx.js.map → chunk-6fqjh62z.js.map} +1 -1
  39. package/bin/{chunk-978h2k33.js.map → chunk-6ft5bhb2.js.map} +1 -1
  40. package/bin/{chunk-mphhgn7h.js.map → chunk-6ggvgnwh.js.map} +1 -1
  41. package/bin/chunk-6nvbh08w.js.map +9 -0
  42. package/bin/{chunk-43t6skjx.js.map → chunk-6qe8a762.js.map} +1 -1
  43. package/bin/{chunk-xc9mm9wr.js.map → chunk-71zm581w.js.map} +1 -1
  44. package/bin/{chunk-xfrb0zb6.js.map → chunk-7d6009yk.js.map} +1 -1
  45. package/bin/{chunk-14vmwrn4.js.map → chunk-7jjsnyew.js.map} +1 -1
  46. package/bin/{chunk-v2ptw5k6.js.map → chunk-81qbsn9g.js.map} +1 -1
  47. package/bin/{chunk-wt57cmjq.js.map → chunk-8arnfnw2.js.map} +1 -1
  48. package/bin/chunk-8ehrd2z2.js.map +43 -0
  49. package/bin/{chunk-twx6x0fz.js.map → chunk-8k7t56f3.js.map} +1 -1
  50. package/bin/{chunk-es43e5my.js.map → chunk-8mdnc8m4.js.map} +1 -1
  51. package/bin/chunk-8xcptstn.js.map +9 -0
  52. package/bin/{chunk-q61kxqbe.js.map → chunk-908ng9qg.js.map} +2 -2
  53. package/bin/chunk-90nfrm64.js.map +9 -0
  54. package/bin/{chunk-vk88dwxs.js.map → chunk-9adrvbn6.js.map} +1 -1
  55. package/bin/{chunk-4wpwdxpa.js.map → chunk-9ecqt2ks.js.map} +1 -1
  56. package/bin/{chunk-0z6t0v97.js.map → chunk-9g3q18wt.js.map} +1 -1
  57. package/bin/{chunk-d3pdw16m.js.map → chunk-9hcjy5f4.js.map} +1 -1
  58. package/bin/chunk-aj1e34xj.js.map +9 -0
  59. package/bin/{chunk-4917dwmd.js.map → chunk-at4f25tr.js.map} +1 -1
  60. package/bin/chunk-az7hwa3e.js.map +9 -0
  61. package/bin/{chunk-q00bcy0f.js.map → chunk-b6dc9586.js.map} +1 -1
  62. package/bin/{chunk-t2aa31rp.js.map → chunk-b8cf49k4.js.map} +1 -1
  63. package/bin/chunk-bh2e2q3h.js.map +14 -0
  64. package/bin/{chunk-48q3mrvq.js.map → chunk-bjxnd74r.js.map} +2 -2
  65. package/bin/chunk-bwxwd975.js.map +9 -0
  66. package/bin/{chunk-39gmh462.js.map → chunk-c07gab7c.js.map} +1 -1
  67. package/bin/{chunk-f7yan2vf.js.map → chunk-c9tn4tzh.js.map} +1 -1
  68. package/bin/{chunk-c99gahsy.js.map → chunk-d2t7aagn.js.map} +1 -1
  69. package/bin/{chunk-dtxtc2sy.js.map → chunk-d394zad5.js.map} +1 -1
  70. package/bin/{chunk-jgnjm6y5.js.map → chunk-d8brx98x.js.map} +1 -1
  71. package/bin/{chunk-153vk1m3.js.map → chunk-df3rw1ne.js.map} +2 -2
  72. package/bin/{chunk-k1m7r6tj.js.map → chunk-dgy9xw12.js.map} +1 -1
  73. package/bin/{chunk-v9973v8h.js.map → chunk-dj7zttan.js.map} +1 -1
  74. package/bin/{chunk-gqrkt3a7.js.map → chunk-dnkfwbwg.js.map} +1 -1
  75. package/bin/{chunk-kk1nq2f1.js.map → chunk-dryp63pb.js.map} +3 -3
  76. package/bin/{chunk-bm703r9f.js.map → chunk-dyvep3sh.js.map} +1 -1
  77. package/bin/chunk-dzt8fjgz.js.map +9 -0
  78. package/bin/{chunk-y5245ch7.js.map → chunk-e1z47jyw.js.map} +1 -1
  79. package/bin/{chunk-zvewfgek.js.map → chunk-f99xt0bc.js.map} +1 -1
  80. package/bin/{chunk-pr7kx9ej.js.map → chunk-ffggz7qw.js.map} +1 -1
  81. package/bin/chunk-fks82d7n.js.map +9 -0
  82. package/bin/{chunk-6rtxapab.js.map → chunk-fwn55d8w.js.map} +1 -1
  83. package/bin/{chunk-h6vq83c7.js.map → chunk-fxsm4kgh.js.map} +1 -1
  84. package/bin/{chunk-wcv8z956.js.map → chunk-gdp4wta8.js.map} +1 -1
  85. package/bin/{chunk-hw28zjp5.js.map → chunk-gvf7e487.js.map} +1 -1
  86. package/bin/{chunk-gr4gaegr.js.map → chunk-gxfwkqnv.js.map} +1 -1
  87. package/bin/{chunk-1t20hffk.js.map → chunk-gy5ads9p.js.map} +1 -1
  88. package/bin/{chunk-b4r31cma.js.map → chunk-gyarmpw7.js.map} +1 -1
  89. package/bin/{chunk-yk37gmmn.js.map → chunk-h6b32d43.js.map} +1 -1
  90. package/bin/{chunk-kedzcskc.js.map → chunk-hd5bn2mk.js.map} +2 -2
  91. package/bin/{chunk-qkm5mqf9.js.map → chunk-hm6pq177.js.map} +1 -1
  92. package/bin/{chunk-6avjg6e5.js.map → chunk-hq3d2kgt.js.map} +1 -1
  93. package/bin/{chunk-y157cxe2.js.map → chunk-hrznn6sn.js.map} +2 -2
  94. package/bin/{chunk-9wn3bjxq.js.map → chunk-hzhkheeb.js.map} +1 -1
  95. package/bin/{chunk-bsbg6n7z.js.map → chunk-jk3aqnc8.js.map} +1 -1
  96. package/bin/{chunk-mbg5gncf.js.map → chunk-jqc9qey3.js.map} +1 -1
  97. package/bin/{chunk-qnsg43hx.js.map → chunk-jvgv8ajb.js.map} +1 -1
  98. package/bin/{chunk-pgx96176.js.map → chunk-k4x9m2c5.js.map} +1 -1
  99. package/bin/{chunk-a1fpn07n.js.map → chunk-ka1eaag1.js.map} +7 -58
  100. package/bin/{chunk-cvjeb3xd.js.map → chunk-kgzwrrp5.js.map} +1 -1
  101. package/bin/chunk-m3rn1hsq.js.map +9 -0
  102. package/bin/{chunk-taj5bzcz.js.map → chunk-mjranvm8.js.map} +2 -2
  103. package/bin/{chunk-fmex48bv.js.map → chunk-n3hke128.js.map} +1 -1
  104. package/bin/{chunk-n64t4f4m.js.map → chunk-na2tnz0a.js.map} +2 -2
  105. package/bin/{chunk-qt51te01.js.map → chunk-ndqpbp32.js.map} +1 -1
  106. package/bin/{chunk-pf56x9mm.js.map → chunk-ne5eywh3.js.map} +1 -1
  107. package/bin/{chunk-0kj87vqs.js.map → chunk-nqadg33p.js.map} +1 -1
  108. package/bin/{chunk-v698jxr0.js.map → chunk-nv0t395g.js.map} +1 -1
  109. package/bin/{chunk-k66r62yv.js.map → chunk-p374savw.js.map} +47 -41
  110. package/bin/{chunk-bk9mhkh3.js.map → chunk-p3x9ne5r.js.map} +1 -1
  111. package/bin/chunk-p65bwz8s.js.map +12 -0
  112. package/bin/{chunk-gh9t7d7h.js.map → chunk-p7fa27wc.js.map} +1 -1
  113. package/bin/{chunk-vyacx963.js.map → chunk-pe5nrzx3.js.map} +1 -1
  114. package/bin/{chunk-tby159gz.js.map → chunk-pjmywr55.js.map} +1 -1
  115. package/bin/{chunk-nng8bf3c.js.map → chunk-pmxe1gmf.js.map} +1 -1
  116. package/bin/{chunk-f9tkgqft.js.map → chunk-qcxqmxwq.js.map} +1 -1
  117. package/bin/{chunk-cpf29q6y.js.map → chunk-qjs7zc19.js.map} +5 -14
  118. package/bin/chunk-qjw21x98.js.map +9 -0
  119. package/bin/{chunk-e8xahsbg.js.map → chunk-qnz1bxd8.js.map} +2 -2
  120. package/bin/chunk-qsee8ghh.js.map +9 -0
  121. package/bin/{chunk-d2b3wd2q.js.map → chunk-qt2h927m.js.map} +1 -1
  122. package/bin/{chunk-qfbth2hc.js.map → chunk-qv8tfqzb.js.map} +2 -2
  123. package/bin/{chunk-z8624k76.js.map → chunk-r8y45bpd.js.map} +1 -1
  124. package/bin/{chunk-bv6f8mp7.js.map → chunk-rdvn30xx.js.map} +1 -1
  125. package/bin/{chunk-55n12zjn.js.map → chunk-rem3r2ke.js.map} +2 -2
  126. package/bin/{chunk-8257tbzy.js.map → chunk-rjedvemj.js.map} +2 -2
  127. package/bin/{chunk-6xsfk6xf.js.map → chunk-rx93gb4n.js.map} +3 -6
  128. package/bin/{chunk-b0f9yxmd.js.map → chunk-rys9sxdh.js.map} +2 -2
  129. package/bin/{chunk-ez683gpw.js.map → chunk-s1nnhawg.js.map} +2 -2
  130. package/bin/{chunk-rb8g67rn.js.map → chunk-s5gvmfg3.js.map} +1 -1
  131. package/bin/{chunk-z4pfyvdt.js.map → chunk-sb1p4n26.js.map} +2 -2
  132. package/bin/{chunk-wwqbzm6a.js.map → chunk-stemmahm.js.map} +1 -1
  133. package/bin/{chunk-1v0wx4g7.js.map → chunk-swdswq2s.js.map} +2 -2
  134. package/bin/{chunk-h4a8ncwv.js.map → chunk-sz9sv23a.js.map} +1 -1
  135. package/bin/chunk-t0js2h0x.js.map +9 -0
  136. package/bin/{chunk-svc6b5zz.js.map → chunk-t61xv9gg.js.map} +1 -1
  137. package/bin/{chunk-n6ez4zwv.js.map → chunk-vwcy664j.js.map} +1 -1
  138. package/bin/chunk-w0g55qhh.js.map +9 -0
  139. package/bin/chunk-wfv63d0v.js.map +9 -0
  140. package/bin/{chunk-x1z9q0xt.js.map → chunk-wtbjzm53.js.map} +1 -1
  141. package/bin/{chunk-jb52qddd.js.map → chunk-wybrd18c.js.map} +2 -2
  142. package/bin/{chunk-se8x72p4.js.map → chunk-xcsndda4.js.map} +2 -2
  143. package/bin/{chunk-g8r1za5z.js.map → chunk-xdwr90k4.js.map} +1 -1
  144. package/bin/{chunk-pvs1at3w.js.map → chunk-xhsynmg0.js.map} +1 -1
  145. package/bin/{chunk-48c1x0jv.js.map → chunk-ychv7rak.js.map} +2 -2
  146. package/bin/{chunk-ck4qx8dc.js.map → chunk-yehw6nax.js.map} +1 -1
  147. package/bin/{chunk-dbg8jrjh.js.map → chunk-yghrdbys.js.map} +1 -1
  148. package/bin/{chunk-ak3539e9.js.map → chunk-yqt6henw.js.map} +1 -1
  149. package/bin/chunk-zbjb256b.js.map +9 -0
  150. package/bin/{chunk-2rpcbx8t.js.map → chunk-zgf7kdrj.js.map} +1 -1
  151. package/bin/chunk-zhvcqj0q.js.map +9 -0
  152. package/bin/chunk-zqc04gwf.js.map +60 -0
  153. package/bin/{chunk-2qyrzjxd.js.map → chunk-zvxbwcsb.js.map} +2 -2
  154. package/bin/index.js.map +2 -2
  155. package/bin/lildax +0 -0
  156. package/bin/parser.worker.js.map +1 -1
  157. package/package.json +1 -1
  158. package/bin/chunk-4rxmd0jf.js.map +0 -9
  159. package/bin/chunk-62gzrntd.js.map +0 -9
  160. package/bin/chunk-72k04pp5.js.map +0 -9
  161. package/bin/chunk-789rbqnv.js.map +0 -9
  162. package/bin/chunk-8zfk2s84.js.map +0 -9
  163. package/bin/chunk-cbagtvm0.js.map +0 -9
  164. package/bin/chunk-cn8h4k4c.js.map +0 -9
  165. package/bin/chunk-dbsaw841.js.map +0 -9
  166. package/bin/chunk-hy2fbqh5.js.map +0 -9
  167. package/bin/chunk-jk11w70c.js.map +0 -9
  168. package/bin/chunk-mjgpytxy.js.map +0 -9
  169. package/bin/chunk-s9987b4a.js.map +0 -9
  170. package/bin/chunk-snpj1wx0.js.map +0 -9
  171. package/bin/chunk-tc1dtvdt.js.map +0 -9
  172. package/bin/chunk-vt7s4zqh.js.map +0 -9
  173. package/bin/chunk-vw8t9c6q.js.map +0 -23
  174. /package/bin/{chunk-mmjnd00g.js.map → chunk-0j2z4c6m.js.map} +0 -0
  175. /package/bin/{chunk-hg33f0me.js.map → chunk-3mz1tnad.js.map} +0 -0
  176. /package/bin/{chunk-739rgk4j.js.map → chunk-4bn3kj1m.js.map} +0 -0
  177. /package/bin/{chunk-ceyh19m4.js.map → chunk-70c010v4.js.map} +0 -0
  178. /package/bin/{chunk-0y4mpb71.js.map → chunk-c7hn1ayf.js.map} +0 -0
  179. /package/bin/{chunk-dgbcsqv5.js.map → chunk-ecbk06fn.js.map} +0 -0
  180. /package/bin/{chunk-dfeq3x3s.js.map → chunk-eeqacqws.js.map} +0 -0
  181. /package/bin/{chunk-j0mdv0fg.js.map → chunk-fe5fh1j3.js.map} +0 -0
  182. /package/bin/{chunk-qk4a2yxz.js.map → chunk-kpw1tm9n.js.map} +0 -0
  183. /package/bin/{chunk-xr4xvjwq.js.map → chunk-p2a3txy0.js.map} +0 -0
  184. /package/bin/{chunk-pb2v8f5g.js.map → chunk-qf3xwqzr.js.map} +0 -0
  185. /package/bin/{chunk-08kwcnfp.js.map → chunk-vh7bfqmh.js.map} +0 -0
  186. /package/bin/{chunk-fbpdepn7.js.map → chunk-ypjzed98.js.map} +0 -0
  187. /package/bin/{chunk-rbp7r2yk.js.map → chunk-zrwgc9n7.js.map} +0 -0
@@ -0,0 +1,60 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../node_modules/.bun/ignore@7.0.5/node_modules/ignore/index.js", "../core/src/filesystem.ts", "../core/src/project-reference.ts", "../core/src/config.ts", "../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/scanner.js", "../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/string-intern.js", "../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/impl/parser.js", "../../node_modules/.bun/jsonc-parser@3.3.1/node_modules/jsonc-parser/lib/esm/main.js", "../core/src/util/wildcard.ts", "../core/src/policy.ts", "../core/src/config/provider.ts", "../core/src/config/agent.ts", "../core/src/config/attachments.ts", "../core/src/config/compaction.ts", "../core/src/config/command.ts", "../core/src/effect/keyed-mutex.ts", "../core/src/plugin.ts", "../core/src/catalog.ts", "../core/src/config/experimental.ts", "../core/src/config/formatter.ts", "../core/src/config/lsp.ts", "../core/src/config/mcp.ts", "../core/src/config/plugin.ts", "../core/src/config/reference.ts", "../core/src/config/tool-output.ts", "../core/src/config/watcher.ts", "../core/src/v1/config/permission.ts", "../core/src/v1/config/agent.ts", "../core/src/v1/config/attachment.ts", "../core/src/v1/config/command.ts", "../core/src/v1/config/formatter.ts", "../core/src/v1/config/layout.ts", "../core/src/v1/config/lsp.ts", "../core/src/v1/config/mcp.ts", "../core/src/v1/config/plugin.ts", "../core/src/v1/config/provider.ts", "../core/src/v1/config/reference.ts", "../core/src/v1/config/server.ts", "../core/src/v1/config/skills.ts", "../core/src/v1/config/config.ts", "../core/src/v1/config/provider-options.ts", "../core/src/v1/config/migrate.ts", "../core/src/repository.ts", "../core/src/repository-cache.ts", "../core/src/util/effect-flock.ts", "../core/src/filesystem/protected.ts", "../core/src/filesystem/ripgrep.ts", "../core/src/util/log.ts", "../core/src/util/opencode-process.ts", "../core/src/tool-output-store.ts", "../core/src/image.ts"],
4
+ "sourcesContent": [
5
+ "// A simple implementation of make-array\nfunction makeArray (subject) {\n return Array.isArray(subject)\n ? subject\n : [subject]\n}\n\nconst UNDEFINED = undefined\nconst EMPTY = ''\nconst SPACE = ' '\nconst ESCAPE = '\\\\'\nconst REGEX_TEST_BLANK_LINE = /^\\s+$/\nconst REGEX_INVALID_TRAILING_BACKSLASH = /(?:[^\\\\]|^)\\\\$/\nconst REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION = /^\\\\!/\nconst REGEX_REPLACE_LEADING_EXCAPED_HASH = /^\\\\#/\nconst REGEX_SPLITALL_CRLF = /\\r?\\n/g\n\n// Invalid:\n// - /foo,\n// - ./foo,\n// - ../foo,\n// - .\n// - ..\n// Valid:\n// - .foo\nconst REGEX_TEST_INVALID_PATH = /^\\.{0,2}\\/|^\\.{1,2}$/\n\nconst REGEX_TEST_TRAILING_SLASH = /\\/$/\n\nconst SLASH = '/'\n\n// Do not use ternary expression here, since \"istanbul ignore next\" is buggy\nlet TMP_KEY_IGNORE = 'node-ignore'\n/* istanbul ignore else */\nif (typeof Symbol !== 'undefined') {\n TMP_KEY_IGNORE = Symbol.for('node-ignore')\n}\nconst KEY_IGNORE = TMP_KEY_IGNORE\n\nconst define = (object, key, value) => {\n Object.defineProperty(object, key, {value})\n return value\n}\n\nconst REGEX_REGEXP_RANGE = /([0-z])-([0-z])/g\n\nconst RETURN_FALSE = () => false\n\n// Sanitize the range of a regular expression\n// The cases are complicated, see test cases for details\nconst sanitizeRange = range => range.replace(\n REGEX_REGEXP_RANGE,\n (match, from, to) => from.charCodeAt(0) <= to.charCodeAt(0)\n ? match\n // Invalid range (out of order) which is ok for gitignore rules but\n // fatal for JavaScript regular expression, so eliminate it.\n : EMPTY\n)\n\n// See fixtures #59\nconst cleanRangeBackSlash = slashes => {\n const {length} = slashes\n return slashes.slice(0, length - length % 2)\n}\n\n// > If the pattern ends with a slash,\n// > it is removed for the purpose of the following description,\n// > but it would only find a match with a directory.\n// > In other words, foo/ will match a directory foo and paths underneath it,\n// > but will not match a regular file or a symbolic link foo\n// > (this is consistent with the way how pathspec works in general in Git).\n// '`foo/`' will not match regular file '`foo`' or symbolic link '`foo`'\n// -> ignore-rules will not deal with it, because it costs extra `fs.stat` call\n// you could use option `mark: true` with `glob`\n\n// '`foo/`' should not continue with the '`..`'\nconst REPLACERS = [\n\n [\n // Remove BOM\n // TODO:\n // Other similar zero-width characters?\n /^\\uFEFF/,\n () => EMPTY\n ],\n\n // > Trailing spaces are ignored unless they are quoted with backslash (\"\\\")\n [\n // (a\\ ) -> (a )\n // (a ) -> (a)\n // (a ) -> (a)\n // (a \\ ) -> (a )\n /((?:\\\\\\\\)*?)(\\\\?\\s+)$/,\n (_, m1, m2) => m1 + (\n m2.indexOf('\\\\') === 0\n ? SPACE\n : EMPTY\n )\n ],\n\n // Replace (\\ ) with ' '\n // (\\ ) -> ' '\n // (\\\\ ) -> '\\\\ '\n // (\\\\\\ ) -> '\\\\ '\n [\n /(\\\\+?)\\s/g,\n (_, m1) => {\n const {length} = m1\n return m1.slice(0, length - length % 2) + SPACE\n }\n ],\n\n // Escape metacharacters\n // which is written down by users but means special for regular expressions.\n\n // > There are 12 characters with special meanings:\n // > - the backslash \\,\n // > - the caret ^,\n // > - the dollar sign $,\n // > - the period or dot .,\n // > - the vertical bar or pipe symbol |,\n // > - the question mark ?,\n // > - the asterisk or star *,\n // > - the plus sign +,\n // > - the opening parenthesis (,\n // > - the closing parenthesis ),\n // > - and the opening square bracket [,\n // > - the opening curly brace {,\n // > These special characters are often called \"metacharacters\".\n [\n /[\\\\$.|*+(){^]/g,\n match => `\\\\${match}`\n ],\n\n [\n // > a question mark (?) matches a single character\n /(?!\\\\)\\?/g,\n () => '[^/]'\n ],\n\n // leading slash\n [\n\n // > A leading slash matches the beginning of the pathname.\n // > For example, \"/*.c\" matches \"cat-file.c\" but not \"mozilla-sha1/sha1.c\".\n // A leading slash matches the beginning of the pathname\n /^\\//,\n () => '^'\n ],\n\n // replace special metacharacter slash after the leading slash\n [\n /\\//g,\n () => '\\\\/'\n ],\n\n [\n // > A leading \"**\" followed by a slash means match in all directories.\n // > For example, \"**/foo\" matches file or directory \"foo\" anywhere,\n // > the same as pattern \"foo\".\n // > \"**/foo/bar\" matches file or directory \"bar\" anywhere that is directly\n // > under directory \"foo\".\n // Notice that the '*'s have been replaced as '\\\\*'\n /^\\^*\\\\\\*\\\\\\*\\\\\\//,\n\n // '**/foo' <-> 'foo'\n () => '^(?:.*\\\\/)?'\n ],\n\n // starting\n [\n // there will be no leading '/'\n // (which has been replaced by section \"leading slash\")\n // If starts with '**', adding a '^' to the regular expression also works\n /^(?=[^^])/,\n function startingReplacer () {\n // If has a slash `/` at the beginning or middle\n return !/\\/(?!$)/.test(this)\n // > Prior to 2.22.1\n // > If the pattern does not contain a slash /,\n // > Git treats it as a shell glob pattern\n // Actually, if there is only a trailing slash,\n // git also treats it as a shell glob pattern\n\n // After 2.22.1 (compatible but clearer)\n // > If there is a separator at the beginning or middle (or both)\n // > of the pattern, then the pattern is relative to the directory\n // > level of the particular .gitignore file itself.\n // > Otherwise the pattern may also match at any level below\n // > the .gitignore level.\n ? '(?:^|\\\\/)'\n\n // > Otherwise, Git treats the pattern as a shell glob suitable for\n // > consumption by fnmatch(3)\n : '^'\n }\n ],\n\n // two globstars\n [\n // Use lookahead assertions so that we could match more than one `'/**'`\n /\\\\\\/\\\\\\*\\\\\\*(?=\\\\\\/|$)/g,\n\n // Zero, one or several directories\n // should not use '*', or it will be replaced by the next replacer\n\n // Check if it is not the last `'/**'`\n (_, index, str) => index + 6 < str.length\n\n // case: /**/\n // > A slash followed by two consecutive asterisks then a slash matches\n // > zero or more directories.\n // > For example, \"a/**/b\" matches \"a/b\", \"a/x/b\", \"a/x/y/b\" and so on.\n // '/**/'\n ? '(?:\\\\/[^\\\\/]+)*'\n\n // case: /**\n // > A trailing `\"/**\"` matches everything inside.\n\n // #21: everything inside but it should not include the current folder\n : '\\\\/.+'\n ],\n\n // normal intermediate wildcards\n [\n // Never replace escaped '*'\n // ignore rule '\\*' will match the path '*'\n\n // 'abc.*/' -> go\n // 'abc.*' -> skip this rule,\n // coz trailing single wildcard will be handed by [trailing wildcard]\n /(^|[^\\\\]+)(\\\\\\*)+(?=.+)/g,\n\n // '*.js' matches '.js'\n // '*.js' doesn't match 'abc'\n (_, p1, p2) => {\n // 1.\n // > An asterisk \"*\" matches anything except a slash.\n // 2.\n // > Other consecutive asterisks are considered regular asterisks\n // > and will match according to the previous rules.\n const unescaped = p2.replace(/\\\\\\*/g, '[^\\\\/]*')\n return p1 + unescaped\n }\n ],\n\n [\n // unescape, revert step 3 except for back slash\n // For example, if a user escape a '\\\\*',\n // after step 3, the result will be '\\\\\\\\\\\\*'\n /\\\\\\\\\\\\(?=[$.|*+(){^])/g,\n () => ESCAPE\n ],\n\n [\n // '\\\\\\\\' -> '\\\\'\n /\\\\\\\\/g,\n () => ESCAPE\n ],\n\n [\n // > The range notation, e.g. [a-zA-Z],\n // > can be used to match one of the characters in a range.\n\n // `\\` is escaped by step 3\n /(\\\\)?\\[([^\\]/]*?)(\\\\*)($|\\])/g,\n (match, leadEscape, range, endEscape, close) => leadEscape === ESCAPE\n // '\\\\[bar]' -> '\\\\\\\\[bar\\\\]'\n ? `\\\\[${range}${cleanRangeBackSlash(endEscape)}${close}`\n : close === ']'\n ? endEscape.length % 2 === 0\n // A normal case, and it is a range notation\n // '[bar]'\n // '[bar\\\\\\\\]'\n ? `[${sanitizeRange(range)}${endEscape}]`\n // Invalid range notaton\n // '[bar\\\\]' -> '[bar\\\\\\\\]'\n : '[]'\n : '[]'\n ],\n\n // ending\n [\n // 'js' will not match 'js.'\n // 'ab' will not match 'abc'\n /(?:[^*])$/,\n\n // WTF!\n // https://git-scm.com/docs/gitignore\n // changes in [2.22.1](https://git-scm.com/docs/gitignore/2.22.1)\n // which re-fixes #24, #38\n\n // > If there is a separator at the end of the pattern then the pattern\n // > will only match directories, otherwise the pattern can match both\n // > files and directories.\n\n // 'js*' will not match 'a.js'\n // 'js/' will not match 'a.js'\n // 'js' will match 'a.js' and 'a.js/'\n match => /\\/$/.test(match)\n // foo/ will not match 'foo'\n ? `${match}$`\n // foo matches 'foo' and 'foo/'\n : `${match}(?=$|\\\\/$)`\n ]\n]\n\nconst REGEX_REPLACE_TRAILING_WILDCARD = /(^|\\\\\\/)?\\\\\\*$/\nconst MODE_IGNORE = 'regex'\nconst MODE_CHECK_IGNORE = 'checkRegex'\nconst UNDERSCORE = '_'\n\nconst TRAILING_WILD_CARD_REPLACERS = {\n [MODE_IGNORE] (_, p1) {\n const prefix = p1\n // '\\^':\n // '/*' does not match EMPTY\n // '/*' does not match everything\n\n // '\\\\\\/':\n // 'abc/*' does not match 'abc/'\n ? `${p1}[^/]+`\n\n // 'a*' matches 'a'\n // 'a*' matches 'aa'\n : '[^/]*'\n\n return `${prefix}(?=$|\\\\/$)`\n },\n\n [MODE_CHECK_IGNORE] (_, p1) {\n // When doing `git check-ignore`\n const prefix = p1\n // '\\\\\\/':\n // 'abc/*' DOES match 'abc/' !\n ? `${p1}[^/]*`\n\n // 'a*' matches 'a'\n // 'a*' matches 'aa'\n : '[^/]*'\n\n return `${prefix}(?=$|\\\\/$)`\n }\n}\n\n// @param {pattern}\nconst makeRegexPrefix = pattern => REPLACERS.reduce(\n (prev, [matcher, replacer]) =>\n prev.replace(matcher, replacer.bind(pattern)),\n pattern\n)\n\nconst isString = subject => typeof subject === 'string'\n\n// > A blank line matches no files, so it can serve as a separator for readability.\nconst checkPattern = pattern => pattern\n && isString(pattern)\n && !REGEX_TEST_BLANK_LINE.test(pattern)\n && !REGEX_INVALID_TRAILING_BACKSLASH.test(pattern)\n\n // > A line starting with # serves as a comment.\n && pattern.indexOf('#') !== 0\n\nconst splitPattern = pattern => pattern\n.split(REGEX_SPLITALL_CRLF)\n.filter(Boolean)\n\nclass IgnoreRule {\n constructor (\n pattern,\n mark,\n body,\n ignoreCase,\n negative,\n prefix\n ) {\n this.pattern = pattern\n this.mark = mark\n this.negative = negative\n\n define(this, 'body', body)\n define(this, 'ignoreCase', ignoreCase)\n define(this, 'regexPrefix', prefix)\n }\n\n get regex () {\n const key = UNDERSCORE + MODE_IGNORE\n\n if (this[key]) {\n return this[key]\n }\n\n return this._make(MODE_IGNORE, key)\n }\n\n get checkRegex () {\n const key = UNDERSCORE + MODE_CHECK_IGNORE\n\n if (this[key]) {\n return this[key]\n }\n\n return this._make(MODE_CHECK_IGNORE, key)\n }\n\n _make (mode, key) {\n const str = this.regexPrefix.replace(\n REGEX_REPLACE_TRAILING_WILDCARD,\n\n // It does not need to bind pattern\n TRAILING_WILD_CARD_REPLACERS[mode]\n )\n\n const regex = this.ignoreCase\n ? new RegExp(str, 'i')\n : new RegExp(str)\n\n return define(this, key, regex)\n }\n}\n\nconst createRule = ({\n pattern,\n mark\n}, ignoreCase) => {\n let negative = false\n let body = pattern\n\n // > An optional prefix \"!\" which negates the pattern;\n if (body.indexOf('!') === 0) {\n negative = true\n body = body.substr(1)\n }\n\n body = body\n // > Put a backslash (\"\\\") in front of the first \"!\" for patterns that\n // > begin with a literal \"!\", for example, `\"\\!important!.txt\"`.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_EXCLAMATION, '!')\n // > Put a backslash (\"\\\") in front of the first hash for patterns that\n // > begin with a hash.\n .replace(REGEX_REPLACE_LEADING_EXCAPED_HASH, '#')\n\n const regexPrefix = makeRegexPrefix(body)\n\n return new IgnoreRule(\n pattern,\n mark,\n body,\n ignoreCase,\n negative,\n regexPrefix\n )\n}\n\nclass RuleManager {\n constructor (ignoreCase) {\n this._ignoreCase = ignoreCase\n this._rules = []\n }\n\n _add (pattern) {\n // #32\n if (pattern && pattern[KEY_IGNORE]) {\n this._rules = this._rules.concat(pattern._rules._rules)\n this._added = true\n return\n }\n\n if (isString(pattern)) {\n pattern = {\n pattern\n }\n }\n\n if (checkPattern(pattern.pattern)) {\n const rule = createRule(pattern, this._ignoreCase)\n this._added = true\n this._rules.push(rule)\n }\n }\n\n // @param {Array<string> | string | Ignore} pattern\n add (pattern) {\n this._added = false\n\n makeArray(\n isString(pattern)\n ? splitPattern(pattern)\n : pattern\n ).forEach(this._add, this)\n\n return this._added\n }\n\n // Test one single path without recursively checking parent directories\n //\n // - checkUnignored `boolean` whether should check if the path is unignored,\n // setting `checkUnignored` to `false` could reduce additional\n // path matching.\n // - check `string` either `MODE_IGNORE` or `MODE_CHECK_IGNORE`\n\n // @returns {TestResult} true if a file is ignored\n test (path, checkUnignored, mode) {\n let ignored = false\n let unignored = false\n let matchedRule\n\n this._rules.forEach(rule => {\n const {negative} = rule\n\n // | ignored : unignored\n // -------- | ---------------------------------------\n // negative | 0:0 | 0:1 | 1:0 | 1:1\n // -------- | ------- | ------- | ------- | --------\n // 0 | TEST | TEST | SKIP | X\n // 1 | TESTIF | SKIP | TEST | X\n\n // - SKIP: always skip\n // - TEST: always test\n // - TESTIF: only test if checkUnignored\n // - X: that never happen\n if (\n unignored === negative && ignored !== unignored\n || negative && !ignored && !unignored && !checkUnignored\n ) {\n return\n }\n\n const matched = rule[mode].test(path)\n\n if (!matched) {\n return\n }\n\n ignored = !negative\n unignored = negative\n\n matchedRule = negative\n ? UNDEFINED\n : rule\n })\n\n const ret = {\n ignored,\n unignored\n }\n\n if (matchedRule) {\n ret.rule = matchedRule\n }\n\n return ret\n }\n}\n\nconst throwError = (message, Ctor) => {\n throw new Ctor(message)\n}\n\nconst checkPath = (path, originalPath, doThrow) => {\n if (!isString(path)) {\n return doThrow(\n `path must be a string, but got \\`${originalPath}\\``,\n TypeError\n )\n }\n\n // We don't know if we should ignore EMPTY, so throw\n if (!path) {\n return doThrow(`path must not be empty`, TypeError)\n }\n\n // Check if it is a relative path\n if (checkPath.isNotRelative(path)) {\n const r = '`path.relative()`d'\n return doThrow(\n `path should be a ${r} string, but got \"${originalPath}\"`,\n RangeError\n )\n }\n\n return true\n}\n\nconst isNotRelative = path => REGEX_TEST_INVALID_PATH.test(path)\n\ncheckPath.isNotRelative = isNotRelative\n\n// On windows, the following function will be replaced\n/* istanbul ignore next */\ncheckPath.convert = p => p\n\n\nclass Ignore {\n constructor ({\n ignorecase = true,\n ignoreCase = ignorecase,\n allowRelativePaths = false\n } = {}) {\n define(this, KEY_IGNORE, true)\n\n this._rules = new RuleManager(ignoreCase)\n this._strictPathCheck = !allowRelativePaths\n this._initCache()\n }\n\n _initCache () {\n // A cache for the result of `.ignores()`\n this._ignoreCache = Object.create(null)\n\n // A cache for the result of `.test()`\n this._testCache = Object.create(null)\n }\n\n add (pattern) {\n if (this._rules.add(pattern)) {\n // Some rules have just added to the ignore,\n // making the behavior changed,\n // so we need to re-initialize the result cache\n this._initCache()\n }\n\n return this\n }\n\n // legacy\n addPattern (pattern) {\n return this.add(pattern)\n }\n\n // @returns {TestResult}\n _test (originalPath, cache, checkUnignored, slices) {\n const path = originalPath\n // Supports nullable path\n && checkPath.convert(originalPath)\n\n checkPath(\n path,\n originalPath,\n this._strictPathCheck\n ? throwError\n : RETURN_FALSE\n )\n\n return this._t(path, cache, checkUnignored, slices)\n }\n\n checkIgnore (path) {\n // If the path doest not end with a slash, `.ignores()` is much equivalent\n // to `git check-ignore`\n if (!REGEX_TEST_TRAILING_SLASH.test(path)) {\n return this.test(path)\n }\n\n const slices = path.split(SLASH).filter(Boolean)\n slices.pop()\n\n if (slices.length) {\n const parent = this._t(\n slices.join(SLASH) + SLASH,\n this._testCache,\n true,\n slices\n )\n\n if (parent.ignored) {\n return parent\n }\n }\n\n return this._rules.test(path, false, MODE_CHECK_IGNORE)\n }\n\n _t (\n // The path to be tested\n path,\n\n // The cache for the result of a certain checking\n cache,\n\n // Whether should check if the path is unignored\n checkUnignored,\n\n // The path slices\n slices\n ) {\n if (path in cache) {\n return cache[path]\n }\n\n if (!slices) {\n // path/to/a.js\n // ['path', 'to', 'a.js']\n slices = path.split(SLASH).filter(Boolean)\n }\n\n slices.pop()\n\n // If the path has no parent directory, just test it\n if (!slices.length) {\n return cache[path] = this._rules.test(path, checkUnignored, MODE_IGNORE)\n }\n\n const parent = this._t(\n slices.join(SLASH) + SLASH,\n cache,\n checkUnignored,\n slices\n )\n\n // If the path contains a parent directory, check the parent first\n return cache[path] = parent.ignored\n // > It is not possible to re-include a file if a parent directory of\n // > that file is excluded.\n ? parent\n : this._rules.test(path, checkUnignored, MODE_IGNORE)\n }\n\n ignores (path) {\n return this._test(path, this._ignoreCache, false).ignored\n }\n\n createFilter () {\n return path => !this.ignores(path)\n }\n\n filter (paths) {\n return makeArray(paths).filter(this.createFilter())\n }\n\n // @returns {TestResult}\n test (path) {\n return this._test(path, this._testCache, true)\n }\n}\n\nconst factory = options => new Ignore(options)\n\nconst isPathValid = path =>\n checkPath(path && checkPath.convert(path), path, RETURN_FALSE)\n\n/* istanbul ignore next */\nconst setupWindows = () => {\n /* eslint no-control-regex: \"off\" */\n const makePosix = str => /^\\\\\\\\\\?\\\\/.test(str)\n || /[\"<>|\\u0000-\\u001F]+/u.test(str)\n ? str\n : str.replace(/\\\\/g, '/')\n\n checkPath.convert = makePosix\n\n // 'C:\\\\foo' <- 'C:\\\\foo' has been converted to 'C:/'\n // 'd:\\\\foo'\n const REGEX_TEST_WINDOWS_PATH_ABSOLUTE = /^[a-z]:\\//i\n checkPath.isNotRelative = path =>\n REGEX_TEST_WINDOWS_PATH_ABSOLUTE.test(path)\n || isNotRelative(path)\n}\n\n\n// Windows\n// --------------------------------------------------------------\n/* istanbul ignore next */\nif (\n // Detect `process` so that it can run in browsers.\n typeof process !== 'undefined'\n && process.platform === 'win32'\n) {\n setupWindows()\n}\n\n// COMMONJS_EXPORTS ////////////////////////////////////////////////////////////\n\nmodule.exports = factory\n\n// Although it is an anti-pattern,\n// it is still widely misused by a lot of libraries in github\n// Ref: https://github.com/search?q=ignore.default%28%29&type=code\nfactory.default = factory\n\nmodule.exports.isPathValid = isPathValid\n\n// For testing purposes\ndefine(module.exports, Symbol.for('setupWindows'), setupWindows)\n",
6
+ "export * as FileSystem from \"./filesystem\"\n\nimport path from \"path\"\nimport { pathToFileURL } from \"url\"\nimport fuzzysort from \"fuzzysort\"\nimport ignore from \"ignore\"\nimport { Context, Effect, Layer, Option, Schema, Stream } from \"effect\"\nimport { EventV2 } from \"./event\"\nimport { FSUtil } from \"./fs-util\"\nimport { Global } from \"./global\"\nimport { Location } from \"./location\"\nimport { ProjectReference } from \"./project-reference\"\nimport { NonNegativeInt, PositiveInt, RelativePath } from \"./schema\"\nimport { Protected } from \"./filesystem/protected\"\nimport { Ripgrep } from \"./filesystem/ripgrep\"\nimport { ToolOutputStore } from \"./tool-output-store\"\n\nexport const ReadInput = Schema.Struct({\n path: Schema.String,\n reference: Schema.NonEmptyString.pipe(Schema.optional),\n})\nexport type ReadInput = typeof ReadInput.Type\n\nexport const MAX_READ_LINES = 2_000\nexport const MAX_READ_BYTES = 50 * 1024\nexport const READ_SAMPLE_BYTES = 4 * 1024\nexport const MAX_MEDIA_INGEST_BYTES = 20 * 1024 * 1024\nconst MAX_LINE_LENGTH = 2_000\nconst MAX_LINE_SUFFIX = `... (line truncated to ${MAX_LINE_LENGTH} chars)`\n\nexport class BinaryFileError extends Error {\n constructor(readonly resource: string) {\n super(`Cannot read binary file: ${resource}`)\n this.name = \"BinaryFileError\"\n }\n}\n\nconst BINARY_EXTENSIONS = new Set([\n \".zip\",\n \".tar\",\n \".gz\",\n \".exe\",\n \".dll\",\n \".so\",\n \".class\",\n \".jar\",\n \".war\",\n \".7z\",\n \".doc\",\n \".docx\",\n \".xls\",\n \".xlsx\",\n \".ppt\",\n \".pptx\",\n \".odt\",\n \".ods\",\n \".odp\",\n \".bin\",\n \".dat\",\n \".obj\",\n \".o\",\n \".a\",\n \".lib\",\n \".wasm\",\n \".pyc\",\n \".pyo\",\n])\n\nexport const isBinary = (resource: string, bytes: Uint8Array) => {\n if (BINARY_EXTENSIONS.has(path.extname(resource).toLowerCase())) return true\n if (bytes.length === 0) return false\n let nonPrintable = 0\n for (const byte of bytes) {\n if (byte === 0) return true\n if (byte < 9 || (byte > 13 && byte < 32)) nonPrintable++\n }\n return nonPrintable / bytes.length > 0.3\n}\n\nconst startsWith = (bytes: Uint8Array, prefix: number[]) => prefix.every((value, index) => bytes[index] === value)\nconst supportedImageMime = (bytes: Uint8Array) => {\n if (startsWith(bytes, [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a])) return \"image/png\"\n if (startsWith(bytes, [0xff, 0xd8, 0xff])) return \"image/jpeg\"\n if (startsWith(bytes, [0x47, 0x49, 0x46, 0x38])) return \"image/gif\"\n if (startsWith(bytes, [0x52, 0x49, 0x46, 0x46]) && startsWith(bytes.subarray(8), [0x57, 0x45, 0x42, 0x50]))\n return \"image/webp\"\n}\n\nexport class MediaIngestLimitError extends Error {\n constructor(\n readonly resource: string,\n readonly maximumBytes: number,\n ) {\n super(`Media exceeds ${maximumBytes} byte ingestion limit: ${resource}`)\n this.name = \"MediaIngestLimitError\"\n }\n}\n\nexport class TextContent extends Schema.Class<TextContent>(\"FileSystem.TextContent\")({\n type: Schema.Literal(\"text\"),\n content: Schema.String,\n mime: Schema.String,\n}) {}\n\nexport class BinaryContent extends Schema.Class<BinaryContent>(\"FileSystem.BinaryContent\")({\n type: Schema.Literal(\"binary\"),\n content: Schema.String,\n encoding: Schema.Literal(\"base64\"),\n mime: Schema.String,\n}) {}\n\nexport const Content = Schema.Union([TextContent, BinaryContent]).pipe(Schema.toTaggedUnion(\"type\"))\nexport type Content = typeof Content.Type\n\nexport const TextPageInput = Schema.Struct({\n offset: PositiveInt.pipe(Schema.optional),\n limit: PositiveInt.check(Schema.isLessThanOrEqualTo(MAX_READ_LINES)).pipe(Schema.optional),\n})\nexport type TextPageInput = typeof TextPageInput.Type\n\nexport class TextPage extends Schema.Class<TextPage>(\"FileSystem.TextPage\")({\n type: Schema.Literal(\"text-page\"),\n content: Schema.String,\n mime: Schema.String,\n offset: PositiveInt,\n truncated: Schema.Boolean,\n next: PositiveInt.pipe(Schema.optional),\n}) {}\n\nexport class ReadPath extends Schema.Class<ReadPath>(\"FileSystem.ReadPath\")({\n type: Schema.Literals([\"file\", \"directory\"]),\n resource: Schema.String,\n}) {}\n\nexport const ListInput = Schema.Struct({\n path: Schema.String.pipe(Schema.optional),\n reference: Schema.NonEmptyString.pipe(Schema.optional),\n})\nexport type ListInput = typeof ListInput.Type\n\nexport const ListPageInput = Schema.Struct({\n ...ListInput.fields,\n offset: PositiveInt.pipe(Schema.optional),\n limit: PositiveInt.check(Schema.isLessThanOrEqualTo(2_000)).pipe(Schema.optional),\n})\nexport type ListPageInput = typeof ListPageInput.Type\n\nexport class ListTarget extends Schema.Class<ListTarget>(\"FileSystem.ListTarget\")({\n absolute: Schema.String,\n real: Schema.String,\n directory: Schema.String,\n root: Schema.String,\n resource: Schema.String,\n}) {}\n\n/** Canonical root and permission resource for Location-scoped search. */\nexport class RootTarget extends Schema.Class<RootTarget>(\"FileSystem.RootTarget\")({\n real: Schema.String,\n root: Schema.String,\n resource: Schema.String,\n reference: Schema.NonEmptyString.pipe(Schema.optional),\n type: Schema.Literals([\"file\", \"directory\"]),\n}) {}\n\nexport class Entry extends Schema.Class<Entry>(\"FileSystem.Entry\")({\n path: RelativePath,\n uri: Schema.String,\n type: Schema.Literals([\"file\", \"directory\"]),\n mime: Schema.String,\n}) {}\n\nexport class ListPage extends Schema.Class<ListPage>(\"FileSystem.ListPage\")({\n entries: Schema.Array(Entry),\n truncated: Schema.Boolean,\n next: PositiveInt.pipe(Schema.optional),\n}) {}\n\nexport const FindInput = Schema.Struct({\n query: Schema.String,\n type: Schema.Literals([\"file\", \"directory\"]).pipe(Schema.optional),\n limit: PositiveInt.pipe(Schema.optional),\n})\nexport type FindInput = typeof FindInput.Type\n\nexport const GrepInput = Schema.Struct({\n pattern: Schema.String,\n include: Schema.String.pipe(Schema.optional),\n limit: PositiveInt.pipe(Schema.optional),\n})\nexport type GrepInput = typeof GrepInput.Type\n\nexport class GrepMatch extends Schema.Class<GrepMatch>(\"FileSystem.GrepMatch\")({\n path: RelativePath,\n lines: Schema.String,\n line: PositiveInt,\n offset: NonNegativeInt,\n submatches: Schema.Array(\n Schema.Struct({\n text: Schema.String,\n start: NonNegativeInt,\n end: NonNegativeInt,\n }),\n ),\n}) {}\n\nexport const Event = {\n Edited: EventV2.define({\n type: \"file.edited\",\n schema: {\n file: Schema.String,\n },\n }),\n}\n\nexport interface Interface {\n readonly read: (input: ReadInput) => Effect.Effect<Content>\n readonly resolveReadPath: (input: ReadInput) => Effect.Effect<ReadPath>\n readonly readTool: (input: ReadInput, page?: TextPageInput) => Effect.Effect<Content | TextPage>\n readonly list: (input?: ListInput) => Effect.Effect<Entry[]>\n /** Resolve a contained canonical search root and its permission resource. */\n readonly resolveRoot: (input?: ListInput) => Effect.Effect<RootTarget>\n readonly resolveList: (input?: ListInput) => Effect.Effect<ListTarget>\n readonly listResolved: (target: ListTarget) => Effect.Effect<Entry[]>\n readonly listPage: (input?: ListPageInput) => Effect.Effect<ListPage>\n readonly listPageResolved: (\n target: ListTarget,\n page?: Pick<ListPageInput, \"offset\" | \"limit\">,\n ) => Effect.Effect<ListPage>\n readonly find: (input: FindInput) => Effect.Effect<Entry[]>\n readonly grep: (input: GrepInput) => Effect.Effect<GrepMatch[]>\n readonly isIgnored: (path: RelativePath, type: \"file\" | \"directory\") => boolean\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/v2/FileSystem\") {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FSUtil.Service\n const location = yield* Location.Service\n const global = yield* Effect.serviceOption(Global.Service)\n const references = yield* ProjectReference.Service\n const ripgrep = yield* Ripgrep.Service\n const root = yield* fs.realPath(location.directory).pipe(Effect.orDie)\n const ignored = ignore()\n const gitignore = yield* fs\n .readFileString(path.join(location.project.directory, \".gitignore\"))\n .pipe(Effect.catch(() => Effect.succeed(\"\")))\n if (gitignore) ignored.add(gitignore)\n const ignorefile = yield* fs\n .readFileString(path.join(location.project.directory, \".ignore\"))\n .pipe(Effect.catch(() => Effect.succeed(\"\")))\n if (ignorefile) ignored.add(ignorefile)\n const select = Effect.fnUntraced(function* (reference?: string) {\n if (!reference) return { directory: location.directory, root }\n const resolved = yield* references.get(reference)\n if (!resolved) return yield* Effect.die(new Error(`Unknown project reference: ${reference}`))\n if (resolved.kind === \"invalid\") return yield* Effect.die(new Error(resolved.message))\n if (resolved.kind === \"git\") yield* references.ensurePath(resolved.path).pipe(Effect.orDie)\n return { directory: resolved.path, root: yield* fs.realPath(resolved.path).pipe(Effect.orDie) }\n })\n const resolve = Effect.fnUntraced(function* (input?: string, reference?: string) {\n const managed = path.join(\n Option.match(global, { onNone: () => Global.Path.data, onSome: (value) => value.data }),\n ToolOutputStore.MANAGED_DIRECTORY,\n )\n if (input && path.isAbsolute(input)) {\n if (reference) return yield* Effect.die(new Error(\"Absolute paths cannot use a project reference\"))\n if (path.dirname(input) !== managed || !path.basename(input).startsWith(\"tool_\"))\n return yield* Effect.die(new Error(\"Absolute path is not managed tool output\"))\n const real = yield* fs.realPath(input).pipe(Effect.orDie)\n const managedRoot = yield* fs.realPath(managed).pipe(Effect.orDie)\n if (path.dirname(real) !== managedRoot || !path.basename(real).startsWith(\"tool_\"))\n return yield* Effect.die(new Error(\"Path escapes managed tool output\"))\n return { absolute: input, real, directory: managed, root: managedRoot }\n }\n const selected = yield* select(reference)\n const absolute = path.resolve(selected.directory, input ?? \".\")\n if (!FSUtil.contains(selected.directory, absolute))\n return yield* Effect.die(new Error(\"Path escapes the location\"))\n const real = yield* fs.realPath(absolute).pipe(Effect.orDie)\n if (!FSUtil.contains(selected.root, real)) return yield* Effect.die(new Error(\"Path escapes the location\"))\n return { absolute, real, ...selected }\n })\n const entry = Effect.fnUntraced(function* (absolute: string, selected = { directory: location.directory, root }) {\n const real = yield* fs.realPath(absolute).pipe(Effect.catch(() => Effect.void))\n if (!real) return\n if (!FSUtil.contains(selected.root, real)) return\n const info = yield* fs.stat(real).pipe(Effect.catch(() => Effect.void))\n if (!info) return\n const type = info.type === \"Directory\" ? \"directory\" : info.type === \"File\" ? \"file\" : undefined\n if (!type) return\n return new Entry({\n path: RelativePath.make(path.relative(selected.directory, absolute)),\n uri: pathToFileURL(real).href,\n type,\n mime: type === \"directory\" ? \"application/x-directory\" : FSUtil.mimeType(real),\n })\n })\n\n const scan = Effect.fnUntraced(function* () {\n if (location.directory === Global.Path.home && location.project.id === \"global\") {\n const protectedNames = Protected.names()\n const nested = new Set([\"node_modules\", \"dist\", \"build\", \"target\", \"vendor\"])\n return (yield* Effect.forEach(\n yield* fs.readDirectoryEntries(location.directory).pipe(Effect.orElseSucceed(() => [])),\n (item) =>\n Effect.gen(function* () {\n if (item.type !== \"directory\" || item.name.startsWith(\".\") || protectedNames.has(item.name)) return []\n const directory = path.join(location.directory, item.name)\n return [\n item.name + \"/\",\n ...(yield* fs.readDirectoryEntries(directory).pipe(Effect.orElseSucceed(() => []))).flatMap((child) =>\n child.type === \"directory\" && !child.name.startsWith(\".\") && !nested.has(child.name)\n ? [`${item.name}/${child.name}/`]\n : [],\n ),\n ]\n }),\n )).flat()\n }\n\n const files = Array.from(yield* ripgrep.files({ cwd: location.directory }).pipe(Stream.runCollect, Effect.orDie))\n const dirs = new Set<string>()\n for (const file of files) {\n let current = file\n while (true) {\n const directory = path.dirname(current)\n if (directory === \".\" || directory === current) break\n current = directory\n dirs.add(directory + \"/\")\n }\n }\n return [...files, ...dirs]\n })\n\n const resolveReadPath = Effect.fn(\"FileSystem.resolveReadPath\")(function* (input: ReadInput) {\n const target = yield* resolve(input.path, input.reference)\n const info = yield* fs.stat(target.real).pipe(Effect.orDie)\n const type = info.type === \"File\" ? \"file\" : info.type === \"Directory\" ? \"directory\" : undefined\n if (!type) return yield* Effect.die(new Error(\"Path is not a file or directory\"))\n const relative = path.relative(target.root, target.real).replaceAll(\"\\\\\", \"/\") || \".\"\n return new ReadPath({\n type,\n resource: input.reference === undefined ? relative : `${input.reference}:${relative}`,\n })\n })\n const resolveFile = Effect.fnUntraced(function* (input: ReadInput) {\n const target = yield* resolve(input.path, input.reference)\n const info = yield* fs.stat(target.real).pipe(Effect.orDie)\n if (info.type !== \"File\") return yield* Effect.die(new Error(\"Path is not a file\"))\n const relative = path.relative(target.root, target.real).replaceAll(\"\\\\\", \"/\") || \".\"\n return {\n real: target.real,\n resource: input.reference === undefined ? relative : `${input.reference}:${relative}`,\n }\n })\n const content = (target: { readonly real: string }, bytes: Uint8Array) =>\n Effect.gen(function* () {\n const mime = FSUtil.mimeType(target.real)\n if (!bytes.includes(0)) {\n const content = yield* Effect.sync(() => new TextDecoder(\"utf-8\", { fatal: true }).decode(bytes)).pipe(\n Effect.option,\n )\n if (content._tag === \"Some\") return new TextContent({ type: \"text\", content: content.value, mime })\n }\n return new BinaryContent({\n type: \"binary\",\n content: Buffer.from(bytes).toString(\"base64\"),\n encoding: \"base64\",\n mime,\n })\n })\n const readTool = Effect.fn(\"FileSystem.readTool\")(function* (input: ReadInput, page: TextPageInput = {}) {\n const target = yield* resolveFile(input)\n return yield* Effect.scoped(\n Effect.gen(function* () {\n const file = yield* fs.open(target.real, { flag: \"r\" }).pipe(Effect.orDie)\n const info = yield* file.stat.pipe(Effect.orDie)\n if (info.type !== \"File\") return yield* Effect.die(new Error(\"Path is not a file\"))\n\n const first = Option.getOrElse(\n yield* file.readAlloc(Math.min(64 * 1024, Number(info.size) || READ_SAMPLE_BYTES)).pipe(Effect.orDie),\n () => new Uint8Array(),\n )\n const mime = supportedImageMime(first)\n if (mime) {\n if (info.size > MAX_MEDIA_INGEST_BYTES)\n return yield* Effect.die(new MediaIngestLimitError(target.resource, MAX_MEDIA_INGEST_BYTES))\n const chunks = [first]\n let total = first.length\n while (total <= MAX_MEDIA_INGEST_BYTES) {\n const chunk = yield* file\n .readAlloc(Math.min(64 * 1024, MAX_MEDIA_INGEST_BYTES + 1 - total))\n .pipe(Effect.orDie)\n if (Option.isNone(chunk)) break\n chunks.push(chunk.value)\n total += chunk.value.length\n }\n if (total > MAX_MEDIA_INGEST_BYTES)\n return yield* Effect.die(new MediaIngestLimitError(target.resource, MAX_MEDIA_INGEST_BYTES))\n return new BinaryContent({\n type: \"binary\",\n content: Buffer.concat(\n chunks.map((chunk) => Buffer.from(chunk)),\n total,\n ).toString(\"base64\"),\n encoding: \"base64\",\n mime,\n })\n }\n if (startsWith(first, [0x25, 0x50, 0x44, 0x46]) || isBinary(target.resource, first))\n return yield* Effect.die(new BinaryFileError(target.resource))\n\n const paged = info.size > MAX_READ_BYTES || page.offset !== undefined || page.limit !== undefined\n if (!paged) {\n const decoder = new TextDecoder(\"utf-8\", { fatal: true })\n const text = [yield* Effect.sync(() => decoder.decode(first, { stream: true }))]\n while (true) {\n const chunk = yield* file.readAlloc(64 * 1024).pipe(Effect.orDie)\n if (Option.isNone(chunk)) break\n if (chunk.value.includes(0)) return yield* Effect.die(new BinaryFileError(target.resource))\n text.push(yield* Effect.sync(() => decoder.decode(chunk.value, { stream: true })))\n }\n text.push(yield* Effect.sync(() => decoder.decode()))\n return new TextContent({ type: \"text\", content: text.join(\"\"), mime: FSUtil.mimeType(target.real) })\n }\n\n const offset = page.offset ?? 1\n const limit = Math.min(page.limit ?? MAX_READ_LINES, MAX_READ_LINES)\n const lines: string[] = []\n const decoder = new TextDecoder(\"utf-8\", { fatal: true })\n let pending = \"\"\n let discard = false\n let line = 1\n let bytes = 0\n let found = false\n let truncated = false\n let next: number | undefined\n\n const append = (input: string) => {\n if (line < offset) {\n line++\n return\n }\n if (lines.length >= limit || bytes >= MAX_READ_BYTES) {\n truncated = true\n next ??= line\n line++\n return\n }\n found = true\n const text = input.length > MAX_LINE_LENGTH ? input.slice(0, MAX_LINE_LENGTH) + MAX_LINE_SUFFIX : input\n const size = Buffer.byteLength(text, \"utf-8\") + (lines.length > 0 ? 1 : 0)\n if (bytes + size > MAX_READ_BYTES) {\n truncated = true\n next ??= line\n line++\n return\n }\n lines.push(text)\n bytes += size\n line++\n }\n\n const consume = (chunk: Uint8Array) => {\n if (chunk.includes(0)) throw new BinaryFileError(target.resource)\n let text = decoder.decode(chunk, { stream: true })\n while (true) {\n const index = text.indexOf(\"\\n\")\n if (index === -1) {\n if (!discard) {\n pending += text\n if (pending.length > MAX_LINE_LENGTH) {\n pending = pending.slice(0, MAX_LINE_LENGTH + 1)\n discard = true\n }\n }\n break\n }\n const current = pending + (discard ? \"\" : text.slice(0, index))\n pending = \"\"\n discard = false\n text = text.slice(index + 1)\n append(current.endsWith(\"\\r\") ? current.slice(0, -1) : current)\n }\n }\n\n yield* Effect.sync(() => consume(first))\n while (true) {\n const chunk = yield* file.readAlloc(64 * 1024).pipe(Effect.orDie)\n if (Option.isNone(chunk)) break\n yield* Effect.sync(() => consume(chunk.value))\n }\n const tail = yield* Effect.sync(() => decoder.decode())\n if (!discard) pending += tail\n if (pending) append(pending.endsWith(\"\\r\") ? pending.slice(0, -1) : pending)\n if (!found && offset !== 1) return yield* Effect.die(new Error(`Offset ${offset} is out of range`))\n\n const text = lines.join(\"\\n\")\n return new TextPage({\n type: \"text-page\",\n content: text,\n mime: FSUtil.mimeType(target.real),\n offset,\n truncated,\n ...(next === undefined ? {} : { next }),\n })\n }),\n )\n })\n const resolveList = Effect.fn(\"FileSystem.resolveList\")(function* (input: ListInput = {}) {\n const directory = yield* resolve(input.path, input.reference)\n const info = yield* fs.stat(directory.real).pipe(Effect.orDie)\n if (info.type !== \"Directory\") return yield* Effect.die(new Error(\"Path is not a directory\"))\n const relative = path.relative(directory.root, directory.real).replaceAll(\"\\\\\", \"/\") || \".\"\n return new ListTarget({\n ...directory,\n resource: input.reference === undefined ? relative : `${input.reference}:${relative}`,\n })\n })\n const resolveRoot = Effect.fn(\"FileSystem.resolveRoot\")(function* (input: ListInput = {}) {\n const target = yield* resolve(input.path, input.reference)\n const info = yield* fs.stat(target.real).pipe(Effect.orDie)\n const type = info.type === \"File\" ? \"file\" : info.type === \"Directory\" ? \"directory\" : undefined\n if (!type) return yield* Effect.die(new Error(\"Path is not a file or directory\"))\n const relative = path.relative(target.root, target.real).replaceAll(\"\\\\\", \"/\") || \".\"\n return new RootTarget({\n ...target,\n resource: input.reference === undefined ? relative : `${input.reference}:${relative}`,\n reference: input.reference,\n type,\n })\n })\n const listResolved = Effect.fn(\"FileSystem.listResolved\")(function* (directory: ListTarget) {\n return yield* fs.readDirectoryEntries(directory.real).pipe(\n Effect.orDie,\n Effect.flatMap((items) =>\n Effect.forEach(items, (item) => entry(path.join(directory.absolute, item.name), directory), {\n concurrency: \"unbounded\",\n }),\n ),\n Effect.map((items) =>\n items\n .filter((item): item is Entry => item !== undefined)\n .sort((a, b) => (a.type === b.type ? a.path.localeCompare(b.path) : a.type === \"directory\" ? -1 : 1)),\n ),\n )\n })\n const listPageResolved = Effect.fn(\"FileSystem.listPageResolved\")(function* (\n target: ListTarget,\n page: Pick<ListPageInput, \"offset\" | \"limit\"> = {},\n ) {\n type Candidate = Entry | { readonly name: string; readonly type: \"file\" | \"directory\" }\n const offset = page.offset ?? 1\n const limit = Math.min(page.limit ?? 2_000, 2_000)\n const items = yield* fs.readDirectoryEntries(target.real).pipe(Effect.orDie)\n const candidates = yield* Effect.forEach(\n items,\n (item): Effect.Effect<Candidate | undefined> => {\n if (item.type === \"other\") return Effect.succeed(undefined)\n if (item.type === \"symlink\") return entry(path.join(target.absolute, item.name), target)\n return Effect.succeed({ name: item.name, type: item.type } as const)\n },\n { concurrency: 16 },\n ).pipe(Effect.map((items) => items.filter((item): item is Candidate => item !== undefined)))\n candidates.sort((a, b) => {\n return a.type === b.type\n ? (a instanceof Entry ? a.path : a.name).localeCompare(b instanceof Entry ? b.path : b.name)\n : a.type === \"directory\"\n ? -1\n : 1\n })\n const selected = candidates.slice(offset - 1, offset - 1 + limit)\n const entries = yield* Effect.forEach(\n selected,\n (item) => (item instanceof Entry ? Effect.succeed(item) : entry(path.join(target.absolute, item.name), target)),\n {\n concurrency: 16,\n },\n ).pipe(Effect.map((items) => items.filter((item): item is Entry => item !== undefined)))\n const truncated = offset - 1 + selected.length < candidates.length\n return new ListPage({ entries, truncated, ...(truncated ? { next: offset + selected.length } : {}) })\n })\n\n return Service.of({\n read: Effect.fn(\"FileSystem.read\")(function* (input) {\n const target = yield* resolveFile(input)\n return yield* content(target, yield* fs.readFile(target.real).pipe(Effect.orDie))\n }),\n resolveReadPath,\n readTool,\n list: Effect.fn(\"FileSystem.list\")(function* (input) {\n return yield* listResolved(yield* resolveList(input))\n }),\n resolveRoot,\n resolveList,\n listResolved,\n listPage: Effect.fn(\"FileSystem.listPage\")(function* (input) {\n return yield* listPageResolved(yield* resolveList(input), input)\n }),\n listPageResolved,\n find: Effect.fn(\"FileSystem.find\")(function* (input) {\n const items = (yield* scan()).filter((item) => input.type !== \"file\" || !item.endsWith(\"/\"))\n const filtered = items.filter((item) => input.type !== \"directory\" || item.endsWith(\"/\"))\n const sorted = input.query.trim()\n ? fuzzysort.go(input.query.trim(), filtered, { limit: input.limit ?? 100 }).map((item) => item.target)\n : filtered.slice(0, input.limit)\n return yield* Effect.forEach(sorted, (item) => entry(path.join(location.directory, item))).pipe(\n Effect.map((items) => items.filter((item): item is Entry => item !== undefined)),\n )\n }),\n grep: Effect.fn(\"FileSystem.grep\")(function* (input) {\n return (yield* ripgrep\n .search({\n cwd: location.directory,\n pattern: input.pattern,\n glob: input.include ? [input.include] : undefined,\n limit: input.limit,\n })\n .pipe(Effect.orDie)).items.map(\n (item) =>\n new GrepMatch({\n path: RelativePath.make(item.path.text),\n lines: item.lines.text,\n line: item.line_number,\n offset: item.absolute_offset,\n submatches: item.submatches.map((submatch) => ({\n text: submatch.match.text,\n start: submatch.start,\n end: submatch.end,\n })),\n }),\n )\n }),\n isIgnored: (input, type) =>\n ignored.ignores(\n path.relative(location.project.directory, path.join(location.directory, input)) +\n (type === \"directory\" ? \"/\" : \"\"),\n ),\n })\n }),\n)\n\nexport const locationLayer = layer.pipe(\n Layer.provide(Ripgrep.defaultLayer),\n Layer.provideMerge(ProjectReference.locationLayer),\n)\n",
7
+ "export * as ProjectReference from \"./project-reference\"\n\nimport path from \"path\"\nimport { Context, Effect, Layer } from \"effect\"\nimport { Config } from \"./config\"\nimport { ConfigReference } from \"./config/reference\"\nimport { FSUtil } from \"./fs-util\"\nimport { Flag } from \"./flag/flag\"\nimport { Global } from \"./global\"\nimport { Location } from \"./location\"\nimport { Repository } from \"./repository\"\nimport { RepositoryCache } from \"./repository-cache\"\n\nexport type Resolved =\n | { readonly name: string; readonly kind: \"local\"; readonly path: string }\n | {\n readonly name: string\n readonly kind: \"git\"\n readonly repository: string\n readonly reference: Repository.RemoteReference\n readonly path: string\n readonly branch?: string\n }\n | { readonly name: string; readonly kind: \"invalid\"; readonly repository?: string; readonly message: string }\n\ntype Valid = Exclude<Resolved, { kind: \"invalid\" }>\n\nexport type Mention =\n | {\n readonly name: string\n readonly kind: \"reference\"\n readonly reference: Valid\n readonly target?: string\n readonly path: string\n }\n | { readonly name: string; readonly kind: \"invalid\"; readonly target?: string; readonly message: string }\n | {\n readonly name: string\n readonly kind: \"missing\"\n readonly target: string\n readonly path: string\n readonly message: string\n }\n\nexport interface Interface {\n readonly list: () => Effect.Effect<Resolved[]>\n readonly get: (name: string) => Effect.Effect<Resolved | undefined>\n readonly resolveMention: (value: string) => Effect.Effect<Mention | undefined, RepositoryCache.Error>\n readonly ensurePath: (target?: string) => Effect.Effect<void, RepositoryCache.Error>\n readonly containsManagedPath: (target?: string) => Effect.Effect<boolean>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/ProjectReference\") {}\n\ntype Materializer = {\n readonly name: string\n readonly repository: string\n readonly path: string\n readonly run: Effect.Effect<void, RepositoryCache.Error>\n}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n if (!Flag.OPENCODE_EXPERIMENTAL_REFERENCES) return Service.of(inert)\n\n const config = yield* Config.Service\n const fs = yield* FSUtil.Service\n const global = yield* Global.Service\n const location = yield* Location.Service\n const cache = yield* RepositoryCache.Service\n const references = resolveAll({\n references: ConfigReference.normalize(\n Object.assign(\n {},\n ...(yield* config.entries())\n .filter((entry): entry is Config.Document => entry.type === \"document\")\n .map((document) => document.info.references ?? {}),\n ),\n ),\n directory: location.project.directory,\n home: global.home,\n repos: global.repos,\n })\n const materializers = yield* Effect.forEach(\n uniqueGitReferences(references),\n Effect.fnUntraced(function* (reference) {\n return {\n name: reference.name,\n repository: reference.repository,\n path: reference.path,\n run: yield* Effect.cached(\n cache\n .ensure({ reference: reference.reference, branch: reference.branch, refresh: true })\n .pipe(Effect.asVoid),\n ),\n }\n }),\n )\n\n yield* Effect.forEach(\n materializers,\n (materializer) =>\n materializer.run.pipe(\n Effect.catchCause((cause) =>\n Effect.logWarning(\"failed to materialize project reference\").pipe(\n Effect.annotateLogs({ name: materializer.name, repository: materializer.repository, cause }),\n ),\n ),\n ),\n { concurrency: 4, discard: true },\n ).pipe(Effect.forkScoped)\n\n const ensurePath = Effect.fn(\"ProjectReference.ensurePath\")(function* (target?: string) {\n const normalized = normalizePath(target)\n if (!normalized)\n return yield* Effect.forEach(materializers, (materializer) => materializer.run, { discard: true })\n yield* materializers.find((materializer) => contains(materializer.path, normalized))?.run ?? Effect.void\n })\n\n return Service.of({\n list: Effect.fn(\"ProjectReference.list\")(function* () {\n return references\n }),\n get: Effect.fn(\"ProjectReference.get\")(function* (name: string) {\n return references.find((reference) => reference.name === name)\n }),\n ensurePath,\n containsManagedPath: Effect.fn(\"ProjectReference.containsManagedPath\")(function* (target?: string) {\n const normalized = normalizePath(target)\n return normalized\n ? references.some((reference) => reference.kind === \"git\" && contains(reference.path, normalized))\n : false\n }),\n resolveMention: Effect.fn(\"ProjectReference.resolveMention\")(function* (value: string) {\n const [name, ...rest] = value.split(\"/\")\n const target = rest.length ? rest.join(\"/\") : undefined\n const reference = references.find((reference) => reference.name === name)\n if (!reference) return\n if (reference.kind === \"invalid\") return { name, kind: \"invalid\", target, message: reference.message }\n if (reference.kind === \"git\") yield* ensurePath(reference.path)\n if (!target) return { name, kind: \"reference\", reference, path: reference.path }\n\n const resolved = path.resolve(reference.path, target)\n if (!FSUtil.contains(reference.path, resolved))\n return { name, kind: \"invalid\", target, message: \"Reference target escapes its root\" }\n if (!(yield* fs.existsSafe(resolved)))\n return { name, kind: \"missing\", target, path: resolved, message: \"Reference target does not exist\" }\n return { name, kind: \"reference\", reference, target, path: resolved }\n }),\n })\n }),\n)\n\nexport const locationLayer = layer.pipe(Layer.provideMerge(Config.locationLayer))\n\nconst inert: Interface = {\n list: () => Effect.succeed([]),\n get: () => Effect.succeed(undefined),\n resolveMention: () => Effect.succeed(undefined),\n ensurePath: () => Effect.void,\n containsManagedPath: () => Effect.succeed(false),\n}\n\nexport function resolveAll(input: {\n references: ConfigReference.NormalizedInfo\n directory: string\n home: string\n repos: string\n}) {\n const seen = new Map<string, { name: string; branch?: string }>()\n return Object.entries(input.references).map(([name, reference]): Resolved => {\n const resolved = resolve({ name, reference, directory: input.directory, home: input.home, repos: input.repos })\n if (resolved.kind !== \"git\") return resolved\n const existing = seen.get(resolved.path)\n if (!existing) {\n seen.set(resolved.path, { name, branch: resolved.branch })\n return resolved\n }\n if (existing.branch === resolved.branch) return resolved\n return {\n name,\n kind: \"invalid\",\n repository: resolved.repository,\n message: `Reference conflicts with @${existing.name}: both use ${resolved.path}, but @${existing.name} requests ${existing.branch ?? \"default branch\"} and @${name} requests ${resolved.branch ?? \"default branch\"}`,\n }\n })\n}\n\nexport function resolve(input: {\n name: string\n reference: ConfigReference.NormalizedEntry\n directory: string\n home: string\n repos: string\n}): Resolved {\n if (input.reference.kind === \"invalid\") return { name: input.name, kind: \"invalid\", message: input.reference.message }\n if (input.reference.kind === \"local\") {\n return { name: input.name, kind: \"local\", path: localPath(input.directory, input.home, input.reference.path) }\n }\n const reference = Repository.parse(input.reference.repository)\n if (!reference || !Repository.isRemote(reference)) {\n return {\n name: input.name,\n kind: \"invalid\",\n repository: input.reference.repository,\n message: \"Repository must be a git URL, host/path reference, or GitHub owner/repo shorthand\",\n }\n }\n return {\n name: input.name,\n kind: \"git\",\n repository: input.reference.repository,\n reference,\n path: Repository.cachePath(input.repos, reference),\n branch: input.reference.branch,\n }\n}\n\nfunction localPath(directory: string, home: string, value: string) {\n if (value.startsWith(\"~/\")) return path.join(home, value.slice(2))\n return path.isAbsolute(value) ? value : path.resolve(directory, value)\n}\n\nfunction uniqueGitReferences(references: Resolved[]) {\n const seen = new Set<string>()\n return references.filter((reference): reference is Extract<Resolved, { kind: \"git\" }> => {\n if (reference.kind !== \"git\" || seen.has(reference.path)) return false\n seen.add(reference.path)\n return true\n })\n}\n\nfunction normalizePath(target?: string) {\n if (!target) return\n return process.platform === \"win32\" ? FSUtil.normalizePath(target) : target\n}\n\nfunction contains(parent: string, child: string) {\n return FSUtil.contains(normalizePath(parent) ?? parent, normalizePath(child) ?? child)\n}\n",
8
+ "export * as Config from \"./config\"\n\nimport path from \"path\"\nimport { type ParseError, parse } from \"jsonc-parser\"\nimport { Context, Effect, Layer, Option, Schema } from \"effect\"\nimport { FSUtil } from \"./fs-util\"\nimport { Global } from \"./global\"\nimport { Location } from \"./location\"\nimport { PermissionSchema } from \"./permission/schema\"\nimport { Policy } from \"./policy\"\nimport { AbsolutePath } from \"./schema\"\nimport { ConfigAgent } from \"./config/agent\"\nimport { ConfigAttachments } from \"./config/attachments\"\nimport { ConfigCompaction } from \"./config/compaction\"\nimport { ConfigCommand } from \"./config/command\"\nimport { ConfigExperimental } from \"./config/experimental\"\nimport { ConfigFormatter } from \"./config/formatter\"\nimport { ConfigLSP } from \"./config/lsp\"\nimport { ConfigMCP } from \"./config/mcp\"\nimport { ConfigPlugin } from \"./config/plugin\"\nimport { ConfigProvider } from \"./config/provider\"\nimport { ConfigReference } from \"./config/reference\"\nimport { ConfigToolOutput } from \"./config/tool-output\"\nimport { ConfigWatcher } from \"./config/watcher\"\nimport { ConfigV1 } from \"./v1/config/config\"\nimport { ConfigMigrateV1 } from \"./v1/config/migrate\"\n\nexport class Info extends Schema.Class<Info>(\"Config.Info\")({\n $schema: Schema.optional(Schema.String).annotate({\n description: \"JSON schema reference for configuration validation\",\n }),\n shell: Schema.String.pipe(Schema.optional).annotate({\n description: \"Default shell to use for terminal and shell tool execution\",\n }),\n model: Schema.String.pipe(Schema.optional).annotate({\n description: \"Default model to use when no session or agent model is selected\",\n }),\n default_agent: Schema.String.pipe(Schema.optional).annotate({\n description: \"Default primary agent to use when no session agent is selected\",\n }),\n autoupdate: Schema.Union([Schema.Boolean, Schema.Literal(\"notify\")])\n .pipe(Schema.optional)\n .annotate({\n description: \"Automatically update or notify when a new version is available\",\n }),\n share: Schema.Literals([\"manual\", \"auto\", \"disabled\"]).pipe(Schema.optional).annotate({\n description: \"Control whether sessions may be shared manually, automatically, or not at all\",\n }),\n enterprise: Schema.Struct({\n url: Schema.String.pipe(Schema.optional),\n })\n .pipe(Schema.optional)\n .annotate({\n description: \"Enterprise sharing service configuration\",\n }),\n username: Schema.String.pipe(Schema.optional).annotate({\n description: \"Username displayed in conversations and used for telemetry identity\",\n }),\n permissions: PermissionSchema.Ruleset.pipe(Schema.optional).annotate({\n description: \"Ordered tool permission rules applied to agent tool use\",\n }),\n agents: Schema.Record(Schema.String, ConfigAgent.Info).pipe(Schema.optional).annotate({\n description: \"Named built-in agent overrides and custom agent definitions\",\n }),\n snapshots: Schema.Boolean.pipe(Schema.optional).annotate({\n description: \"Enable snapshots used for undo and revert behavior\",\n }),\n watcher: ConfigWatcher.Info.pipe(Schema.optional).annotate({\n description: \"Filesystem watcher configuration\",\n }),\n formatter: ConfigFormatter.Info.pipe(Schema.optional).annotate({\n description: \"Enable built-in formatters or configure formatter overrides\",\n }),\n lsp: ConfigLSP.Info.pipe(Schema.optional).annotate({\n description: \"Enable built-in language servers or configure server overrides\",\n }),\n attachments: ConfigAttachments.Info.pipe(Schema.optional).annotate({\n description: \"Attachment processing configuration\",\n }),\n tool_output: ConfigToolOutput.Info.pipe(Schema.optional).annotate({\n description: \"Tool output truncation thresholds\",\n }),\n mcp: ConfigMCP.Info.pipe(Schema.optional).annotate({\n description: \"MCP server configuration\",\n }),\n compaction: ConfigCompaction.Info.pipe(Schema.optional).annotate({\n description: \"Conversation compaction behavior\",\n }),\n skills: Schema.String.pipe(Schema.Array, Schema.optional).annotate({\n description: \"Additional paths or URLs to discover skills from\",\n }),\n commands: Schema.Record(Schema.String, ConfigCommand.Info).pipe(Schema.optional).annotate({\n description: \"Named slash command definitions\",\n }),\n instructions: Schema.String.pipe(Schema.Array, Schema.optional).annotate({\n description: \"Additional paths or URLs supplying ambient instructions\",\n }),\n references: ConfigReference.Info.pipe(Schema.optional).annotate({\n description: \"Named local directories or Git repositories available as external context\",\n }),\n plugins: ConfigPlugin.Plugins.pipe(Schema.optional).annotate({\n description: \"Ordered external plugin packages to load\",\n }),\n experimental: ConfigExperimental.Experimental.pipe(Schema.optional),\n providers: Schema.Record(Schema.String, ConfigProvider.Info).pipe(Schema.optional),\n}) {}\n\nexport class Document extends Schema.Class<Document>(\"Config.Document\")({\n type: Schema.Literal(\"document\"),\n path: Schema.String.pipe(Schema.optional),\n info: Info,\n}) {}\n\nexport class Directory extends Schema.Class<Directory>(\"Config.Directory\")({\n type: Schema.Literal(\"directory\"),\n path: AbsolutePath,\n}) {}\n\nexport type Entry = Document | Directory\n\nexport function latest<K extends keyof Info>(entries: readonly Entry[], key: K): Info[K] | undefined {\n return entries\n .filter((entry): entry is Document => entry.type === \"document\")\n .findLast((entry) => entry.info[key] !== undefined)?.info[key]\n}\n\nexport interface Interface {\n /** Returns location config documents and supplemental directories from lowest to highest priority. */\n readonly entries: () => Effect.Effect<Entry[]>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/v2/Config\") {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FSUtil.Service\n const global = yield* Global.Service\n const location = yield* Location.Service\n const policy = yield* Policy.Service\n const names = [\"config.json\", \"opencode.json\", \"opencode.jsonc\"]\n const decodeOptions = { errors: \"all\", onExcessProperty: \"ignore\", propertyOrder: \"original\" } as const\n const decodeInfo = Schema.decodeUnknownOption(Info, decodeOptions)\n const decodeV1Info = Schema.decodeUnknownOption(ConfigV1.Info, decodeOptions)\n\n const loadFile = Effect.fnUntraced(function* (filepath: string) {\n const text = yield* fs.readFileStringSafe(filepath)\n if (!text) return\n\n const errors: ParseError[] = []\n const input: unknown = parse(text, errors, { allowTrailingComma: true })\n if (errors.length) return\n\n const info = Option.getOrUndefined(\n ConfigMigrateV1.isV1(input)\n ? decodeV1Info(input).pipe(Option.map(ConfigMigrateV1.migrate), Option.flatMap(decodeInfo))\n : decodeInfo(input),\n )\n if (!info) return\n return new Document({ type: \"document\", path: filepath, info })\n })\n\n const loadDirectory = Effect.fnUntraced(function* (directory: AbsolutePath) {\n return [\n ...(yield* Effect.forEach(names, (file) => loadFile(path.join(directory, file))).pipe(\n Effect.map((configs) => configs.filter((config): config is Document => config !== undefined)),\n )),\n new Directory({ type: \"directory\", path: directory }),\n ]\n })\n\n const globalDirectory = AbsolutePath.make(global.config)\n const locationIsGlobal = path.resolve(location.directory) === path.resolve(global.config)\n // Read configuration once when this location opens. Later calls reuse these\n // values until the location is reopened.\n const discovered = locationIsGlobal\n ? []\n : yield* fs\n .up({\n targets: [\".opencode\", ...names.toReversed()],\n start: location.directory,\n stop: location.project.directory,\n })\n .pipe(Effect.orDie)\n const directories = [\n globalDirectory,\n ...discovered\n .filter((item) => path.basename(item) === \".opencode\")\n .toReversed()\n .map((directory) => AbsolutePath.make(directory)),\n ]\n // A config closer to the opened directory should win over one higher up.\n // Search starts nearby, so reverse the results before applying them.\n const directPaths = discovered.filter((item) => path.basename(item) !== \".opencode\").toReversed()\n const direct = yield* Effect.forEach(directPaths, loadFile).pipe(\n Effect.orDie,\n Effect.map((configs) => configs.filter((config): config is Document => config !== undefined)),\n )\n const supplementary = yield* Effect.forEach(directories, loadDirectory).pipe(Effect.orDie)\n // Apply general settings first and more specific settings last:\n // global config, project files, then `.opencode` files.\n const configs = [...(supplementary[0] ?? []), ...direct, ...supplementary.slice(1).flat()]\n // Rules use the opposite order so a user-global rule can override a\n // repository rule. Statement order inside each file stays unchanged.\n yield* policy.load(\n configs\n .filter((config): config is Document => config.type === \"document\")\n .toReversed()\n .flatMap((config) => config.info.experimental?.policies ?? []),\n )\n\n return Service.of({\n entries: Effect.fn(\"Config.entries\")(function* () {\n return configs\n }),\n })\n }),\n)\n\nexport const locationLayer = layer.pipe(Layer.provideMerge(Policy.locationLayer))\n",
9
+ "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\n/**\n * Creates a JSON scanner on the given text.\n * If ignoreTrivia is set, whitespaces or comments are ignored.\n */\nexport function createScanner(text, ignoreTrivia = false) {\n const len = text.length;\n let pos = 0, value = '', tokenOffset = 0, token = 16 /* SyntaxKind.Unknown */, lineNumber = 0, lineStartOffset = 0, tokenLineStartOffset = 0, prevTokenLineStartOffset = 0, scanError = 0 /* ScanError.None */;\n function scanHexDigits(count, exact) {\n let digits = 0;\n let value = 0;\n while (digits < count || !exact) {\n let ch = text.charCodeAt(pos);\n if (ch >= 48 /* CharacterCodes._0 */ && ch <= 57 /* CharacterCodes._9 */) {\n value = value * 16 + ch - 48 /* CharacterCodes._0 */;\n }\n else if (ch >= 65 /* CharacterCodes.A */ && ch <= 70 /* CharacterCodes.F */) {\n value = value * 16 + ch - 65 /* CharacterCodes.A */ + 10;\n }\n else if (ch >= 97 /* CharacterCodes.a */ && ch <= 102 /* CharacterCodes.f */) {\n value = value * 16 + ch - 97 /* CharacterCodes.a */ + 10;\n }\n else {\n break;\n }\n pos++;\n digits++;\n }\n if (digits < count) {\n value = -1;\n }\n return value;\n }\n function setPosition(newPosition) {\n pos = newPosition;\n value = '';\n tokenOffset = 0;\n token = 16 /* SyntaxKind.Unknown */;\n scanError = 0 /* ScanError.None */;\n }\n function scanNumber() {\n let start = pos;\n if (text.charCodeAt(pos) === 48 /* CharacterCodes._0 */) {\n pos++;\n }\n else {\n pos++;\n while (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n }\n }\n if (pos < text.length && text.charCodeAt(pos) === 46 /* CharacterCodes.dot */) {\n pos++;\n if (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n while (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n }\n }\n else {\n scanError = 3 /* ScanError.UnexpectedEndOfNumber */;\n return text.substring(start, pos);\n }\n }\n let end = pos;\n if (pos < text.length && (text.charCodeAt(pos) === 69 /* CharacterCodes.E */ || text.charCodeAt(pos) === 101 /* CharacterCodes.e */)) {\n pos++;\n if (pos < text.length && text.charCodeAt(pos) === 43 /* CharacterCodes.plus */ || text.charCodeAt(pos) === 45 /* CharacterCodes.minus */) {\n pos++;\n }\n if (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n while (pos < text.length && isDigit(text.charCodeAt(pos))) {\n pos++;\n }\n end = pos;\n }\n else {\n scanError = 3 /* ScanError.UnexpectedEndOfNumber */;\n }\n }\n return text.substring(start, end);\n }\n function scanString() {\n let result = '', start = pos;\n while (true) {\n if (pos >= len) {\n result += text.substring(start, pos);\n scanError = 2 /* ScanError.UnexpectedEndOfString */;\n break;\n }\n const ch = text.charCodeAt(pos);\n if (ch === 34 /* CharacterCodes.doubleQuote */) {\n result += text.substring(start, pos);\n pos++;\n break;\n }\n if (ch === 92 /* CharacterCodes.backslash */) {\n result += text.substring(start, pos);\n pos++;\n if (pos >= len) {\n scanError = 2 /* ScanError.UnexpectedEndOfString */;\n break;\n }\n const ch2 = text.charCodeAt(pos++);\n switch (ch2) {\n case 34 /* CharacterCodes.doubleQuote */:\n result += '\\\"';\n break;\n case 92 /* CharacterCodes.backslash */:\n result += '\\\\';\n break;\n case 47 /* CharacterCodes.slash */:\n result += '/';\n break;\n case 98 /* CharacterCodes.b */:\n result += '\\b';\n break;\n case 102 /* CharacterCodes.f */:\n result += '\\f';\n break;\n case 110 /* CharacterCodes.n */:\n result += '\\n';\n break;\n case 114 /* CharacterCodes.r */:\n result += '\\r';\n break;\n case 116 /* CharacterCodes.t */:\n result += '\\t';\n break;\n case 117 /* CharacterCodes.u */:\n const ch3 = scanHexDigits(4, true);\n if (ch3 >= 0) {\n result += String.fromCharCode(ch3);\n }\n else {\n scanError = 4 /* ScanError.InvalidUnicode */;\n }\n break;\n default:\n scanError = 5 /* ScanError.InvalidEscapeCharacter */;\n }\n start = pos;\n continue;\n }\n if (ch >= 0 && ch <= 0x1f) {\n if (isLineBreak(ch)) {\n result += text.substring(start, pos);\n scanError = 2 /* ScanError.UnexpectedEndOfString */;\n break;\n }\n else {\n scanError = 6 /* ScanError.InvalidCharacter */;\n // mark as error but continue with string\n }\n }\n pos++;\n }\n return result;\n }\n function scanNext() {\n value = '';\n scanError = 0 /* ScanError.None */;\n tokenOffset = pos;\n lineStartOffset = lineNumber;\n prevTokenLineStartOffset = tokenLineStartOffset;\n if (pos >= len) {\n // at the end\n tokenOffset = len;\n return token = 17 /* SyntaxKind.EOF */;\n }\n let code = text.charCodeAt(pos);\n // trivia: whitespace\n if (isWhiteSpace(code)) {\n do {\n pos++;\n value += String.fromCharCode(code);\n code = text.charCodeAt(pos);\n } while (isWhiteSpace(code));\n return token = 15 /* SyntaxKind.Trivia */;\n }\n // trivia: newlines\n if (isLineBreak(code)) {\n pos++;\n value += String.fromCharCode(code);\n if (code === 13 /* CharacterCodes.carriageReturn */ && text.charCodeAt(pos) === 10 /* CharacterCodes.lineFeed */) {\n pos++;\n value += '\\n';\n }\n lineNumber++;\n tokenLineStartOffset = pos;\n return token = 14 /* SyntaxKind.LineBreakTrivia */;\n }\n switch (code) {\n // tokens: []{}:,\n case 123 /* CharacterCodes.openBrace */:\n pos++;\n return token = 1 /* SyntaxKind.OpenBraceToken */;\n case 125 /* CharacterCodes.closeBrace */:\n pos++;\n return token = 2 /* SyntaxKind.CloseBraceToken */;\n case 91 /* CharacterCodes.openBracket */:\n pos++;\n return token = 3 /* SyntaxKind.OpenBracketToken */;\n case 93 /* CharacterCodes.closeBracket */:\n pos++;\n return token = 4 /* SyntaxKind.CloseBracketToken */;\n case 58 /* CharacterCodes.colon */:\n pos++;\n return token = 6 /* SyntaxKind.ColonToken */;\n case 44 /* CharacterCodes.comma */:\n pos++;\n return token = 5 /* SyntaxKind.CommaToken */;\n // strings\n case 34 /* CharacterCodes.doubleQuote */:\n pos++;\n value = scanString();\n return token = 10 /* SyntaxKind.StringLiteral */;\n // comments\n case 47 /* CharacterCodes.slash */:\n const start = pos - 1;\n // Single-line comment\n if (text.charCodeAt(pos + 1) === 47 /* CharacterCodes.slash */) {\n pos += 2;\n while (pos < len) {\n if (isLineBreak(text.charCodeAt(pos))) {\n break;\n }\n pos++;\n }\n value = text.substring(start, pos);\n return token = 12 /* SyntaxKind.LineCommentTrivia */;\n }\n // Multi-line comment\n if (text.charCodeAt(pos + 1) === 42 /* CharacterCodes.asterisk */) {\n pos += 2;\n const safeLength = len - 1; // For lookahead.\n let commentClosed = false;\n while (pos < safeLength) {\n const ch = text.charCodeAt(pos);\n if (ch === 42 /* CharacterCodes.asterisk */ && text.charCodeAt(pos + 1) === 47 /* CharacterCodes.slash */) {\n pos += 2;\n commentClosed = true;\n break;\n }\n pos++;\n if (isLineBreak(ch)) {\n if (ch === 13 /* CharacterCodes.carriageReturn */ && text.charCodeAt(pos) === 10 /* CharacterCodes.lineFeed */) {\n pos++;\n }\n lineNumber++;\n tokenLineStartOffset = pos;\n }\n }\n if (!commentClosed) {\n pos++;\n scanError = 1 /* ScanError.UnexpectedEndOfComment */;\n }\n value = text.substring(start, pos);\n return token = 13 /* SyntaxKind.BlockCommentTrivia */;\n }\n // just a single slash\n value += String.fromCharCode(code);\n pos++;\n return token = 16 /* SyntaxKind.Unknown */;\n // numbers\n case 45 /* CharacterCodes.minus */:\n value += String.fromCharCode(code);\n pos++;\n if (pos === len || !isDigit(text.charCodeAt(pos))) {\n return token = 16 /* SyntaxKind.Unknown */;\n }\n // found a minus, followed by a number so\n // we fall through to proceed with scanning\n // numbers\n case 48 /* CharacterCodes._0 */:\n case 49 /* CharacterCodes._1 */:\n case 50 /* CharacterCodes._2 */:\n case 51 /* CharacterCodes._3 */:\n case 52 /* CharacterCodes._4 */:\n case 53 /* CharacterCodes._5 */:\n case 54 /* CharacterCodes._6 */:\n case 55 /* CharacterCodes._7 */:\n case 56 /* CharacterCodes._8 */:\n case 57 /* CharacterCodes._9 */:\n value += scanNumber();\n return token = 11 /* SyntaxKind.NumericLiteral */;\n // literals and unknown symbols\n default:\n // is a literal? Read the full word.\n while (pos < len && isUnknownContentCharacter(code)) {\n pos++;\n code = text.charCodeAt(pos);\n }\n if (tokenOffset !== pos) {\n value = text.substring(tokenOffset, pos);\n // keywords: true, false, null\n switch (value) {\n case 'true': return token = 8 /* SyntaxKind.TrueKeyword */;\n case 'false': return token = 9 /* SyntaxKind.FalseKeyword */;\n case 'null': return token = 7 /* SyntaxKind.NullKeyword */;\n }\n return token = 16 /* SyntaxKind.Unknown */;\n }\n // some\n value += String.fromCharCode(code);\n pos++;\n return token = 16 /* SyntaxKind.Unknown */;\n }\n }\n function isUnknownContentCharacter(code) {\n if (isWhiteSpace(code) || isLineBreak(code)) {\n return false;\n }\n switch (code) {\n case 125 /* CharacterCodes.closeBrace */:\n case 93 /* CharacterCodes.closeBracket */:\n case 123 /* CharacterCodes.openBrace */:\n case 91 /* CharacterCodes.openBracket */:\n case 34 /* CharacterCodes.doubleQuote */:\n case 58 /* CharacterCodes.colon */:\n case 44 /* CharacterCodes.comma */:\n case 47 /* CharacterCodes.slash */:\n return false;\n }\n return true;\n }\n function scanNextNonTrivia() {\n let result;\n do {\n result = scanNext();\n } while (result >= 12 /* SyntaxKind.LineCommentTrivia */ && result <= 15 /* SyntaxKind.Trivia */);\n return result;\n }\n return {\n setPosition: setPosition,\n getPosition: () => pos,\n scan: ignoreTrivia ? scanNextNonTrivia : scanNext,\n getToken: () => token,\n getTokenValue: () => value,\n getTokenOffset: () => tokenOffset,\n getTokenLength: () => pos - tokenOffset,\n getTokenStartLine: () => lineStartOffset,\n getTokenStartCharacter: () => tokenOffset - prevTokenLineStartOffset,\n getTokenError: () => scanError,\n };\n}\nfunction isWhiteSpace(ch) {\n return ch === 32 /* CharacterCodes.space */ || ch === 9 /* CharacterCodes.tab */;\n}\nfunction isLineBreak(ch) {\n return ch === 10 /* CharacterCodes.lineFeed */ || ch === 13 /* CharacterCodes.carriageReturn */;\n}\nfunction isDigit(ch) {\n return ch >= 48 /* CharacterCodes._0 */ && ch <= 57 /* CharacterCodes._9 */;\n}\nvar CharacterCodes;\n(function (CharacterCodes) {\n CharacterCodes[CharacterCodes[\"lineFeed\"] = 10] = \"lineFeed\";\n CharacterCodes[CharacterCodes[\"carriageReturn\"] = 13] = \"carriageReturn\";\n CharacterCodes[CharacterCodes[\"space\"] = 32] = \"space\";\n CharacterCodes[CharacterCodes[\"_0\"] = 48] = \"_0\";\n CharacterCodes[CharacterCodes[\"_1\"] = 49] = \"_1\";\n CharacterCodes[CharacterCodes[\"_2\"] = 50] = \"_2\";\n CharacterCodes[CharacterCodes[\"_3\"] = 51] = \"_3\";\n CharacterCodes[CharacterCodes[\"_4\"] = 52] = \"_4\";\n CharacterCodes[CharacterCodes[\"_5\"] = 53] = \"_5\";\n CharacterCodes[CharacterCodes[\"_6\"] = 54] = \"_6\";\n CharacterCodes[CharacterCodes[\"_7\"] = 55] = \"_7\";\n CharacterCodes[CharacterCodes[\"_8\"] = 56] = \"_8\";\n CharacterCodes[CharacterCodes[\"_9\"] = 57] = \"_9\";\n CharacterCodes[CharacterCodes[\"a\"] = 97] = \"a\";\n CharacterCodes[CharacterCodes[\"b\"] = 98] = \"b\";\n CharacterCodes[CharacterCodes[\"c\"] = 99] = \"c\";\n CharacterCodes[CharacterCodes[\"d\"] = 100] = \"d\";\n CharacterCodes[CharacterCodes[\"e\"] = 101] = \"e\";\n CharacterCodes[CharacterCodes[\"f\"] = 102] = \"f\";\n CharacterCodes[CharacterCodes[\"g\"] = 103] = \"g\";\n CharacterCodes[CharacterCodes[\"h\"] = 104] = \"h\";\n CharacterCodes[CharacterCodes[\"i\"] = 105] = \"i\";\n CharacterCodes[CharacterCodes[\"j\"] = 106] = \"j\";\n CharacterCodes[CharacterCodes[\"k\"] = 107] = \"k\";\n CharacterCodes[CharacterCodes[\"l\"] = 108] = \"l\";\n CharacterCodes[CharacterCodes[\"m\"] = 109] = \"m\";\n CharacterCodes[CharacterCodes[\"n\"] = 110] = \"n\";\n CharacterCodes[CharacterCodes[\"o\"] = 111] = \"o\";\n CharacterCodes[CharacterCodes[\"p\"] = 112] = \"p\";\n CharacterCodes[CharacterCodes[\"q\"] = 113] = \"q\";\n CharacterCodes[CharacterCodes[\"r\"] = 114] = \"r\";\n CharacterCodes[CharacterCodes[\"s\"] = 115] = \"s\";\n CharacterCodes[CharacterCodes[\"t\"] = 116] = \"t\";\n CharacterCodes[CharacterCodes[\"u\"] = 117] = \"u\";\n CharacterCodes[CharacterCodes[\"v\"] = 118] = \"v\";\n CharacterCodes[CharacterCodes[\"w\"] = 119] = \"w\";\n CharacterCodes[CharacterCodes[\"x\"] = 120] = \"x\";\n CharacterCodes[CharacterCodes[\"y\"] = 121] = \"y\";\n CharacterCodes[CharacterCodes[\"z\"] = 122] = \"z\";\n CharacterCodes[CharacterCodes[\"A\"] = 65] = \"A\";\n CharacterCodes[CharacterCodes[\"B\"] = 66] = \"B\";\n CharacterCodes[CharacterCodes[\"C\"] = 67] = \"C\";\n CharacterCodes[CharacterCodes[\"D\"] = 68] = \"D\";\n CharacterCodes[CharacterCodes[\"E\"] = 69] = \"E\";\n CharacterCodes[CharacterCodes[\"F\"] = 70] = \"F\";\n CharacterCodes[CharacterCodes[\"G\"] = 71] = \"G\";\n CharacterCodes[CharacterCodes[\"H\"] = 72] = \"H\";\n CharacterCodes[CharacterCodes[\"I\"] = 73] = \"I\";\n CharacterCodes[CharacterCodes[\"J\"] = 74] = \"J\";\n CharacterCodes[CharacterCodes[\"K\"] = 75] = \"K\";\n CharacterCodes[CharacterCodes[\"L\"] = 76] = \"L\";\n CharacterCodes[CharacterCodes[\"M\"] = 77] = \"M\";\n CharacterCodes[CharacterCodes[\"N\"] = 78] = \"N\";\n CharacterCodes[CharacterCodes[\"O\"] = 79] = \"O\";\n CharacterCodes[CharacterCodes[\"P\"] = 80] = \"P\";\n CharacterCodes[CharacterCodes[\"Q\"] = 81] = \"Q\";\n CharacterCodes[CharacterCodes[\"R\"] = 82] = \"R\";\n CharacterCodes[CharacterCodes[\"S\"] = 83] = \"S\";\n CharacterCodes[CharacterCodes[\"T\"] = 84] = \"T\";\n CharacterCodes[CharacterCodes[\"U\"] = 85] = \"U\";\n CharacterCodes[CharacterCodes[\"V\"] = 86] = \"V\";\n CharacterCodes[CharacterCodes[\"W\"] = 87] = \"W\";\n CharacterCodes[CharacterCodes[\"X\"] = 88] = \"X\";\n CharacterCodes[CharacterCodes[\"Y\"] = 89] = \"Y\";\n CharacterCodes[CharacterCodes[\"Z\"] = 90] = \"Z\";\n CharacterCodes[CharacterCodes[\"asterisk\"] = 42] = \"asterisk\";\n CharacterCodes[CharacterCodes[\"backslash\"] = 92] = \"backslash\";\n CharacterCodes[CharacterCodes[\"closeBrace\"] = 125] = \"closeBrace\";\n CharacterCodes[CharacterCodes[\"closeBracket\"] = 93] = \"closeBracket\";\n CharacterCodes[CharacterCodes[\"colon\"] = 58] = \"colon\";\n CharacterCodes[CharacterCodes[\"comma\"] = 44] = \"comma\";\n CharacterCodes[CharacterCodes[\"dot\"] = 46] = \"dot\";\n CharacterCodes[CharacterCodes[\"doubleQuote\"] = 34] = \"doubleQuote\";\n CharacterCodes[CharacterCodes[\"minus\"] = 45] = \"minus\";\n CharacterCodes[CharacterCodes[\"openBrace\"] = 123] = \"openBrace\";\n CharacterCodes[CharacterCodes[\"openBracket\"] = 91] = \"openBracket\";\n CharacterCodes[CharacterCodes[\"plus\"] = 43] = \"plus\";\n CharacterCodes[CharacterCodes[\"slash\"] = 47] = \"slash\";\n CharacterCodes[CharacterCodes[\"formFeed\"] = 12] = \"formFeed\";\n CharacterCodes[CharacterCodes[\"tab\"] = 9] = \"tab\";\n})(CharacterCodes || (CharacterCodes = {}));\n",
10
+ "export const cachedSpaces = new Array(20).fill(0).map((_, index) => {\n return ' '.repeat(index);\n});\nconst maxCachedValues = 200;\nexport const cachedBreakLinesWithSpaces = {\n ' ': {\n '\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\n' + ' '.repeat(index);\n }),\n '\\r': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r' + ' '.repeat(index);\n }),\n '\\r\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r\\n' + ' '.repeat(index);\n }),\n },\n '\\t': {\n '\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\n' + '\\t'.repeat(index);\n }),\n '\\r': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r' + '\\t'.repeat(index);\n }),\n '\\r\\n': new Array(maxCachedValues).fill(0).map((_, index) => {\n return '\\r\\n' + '\\t'.repeat(index);\n }),\n }\n};\nexport const supportedEols = ['\\n', '\\r', '\\r\\n'];\n",
11
+ "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nimport { createScanner } from './scanner';\nvar ParseOptions;\n(function (ParseOptions) {\n ParseOptions.DEFAULT = {\n allowTrailingComma: false\n };\n})(ParseOptions || (ParseOptions = {}));\n/**\n * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.\n */\nexport function getLocation(text, position) {\n const segments = []; // strings or numbers\n const earlyReturnException = new Object();\n let previousNode = undefined;\n const previousNodeInst = {\n value: {},\n offset: 0,\n length: 0,\n type: 'object',\n parent: undefined\n };\n let isAtPropertyKey = false;\n function setPreviousNode(value, offset, length, type) {\n previousNodeInst.value = value;\n previousNodeInst.offset = offset;\n previousNodeInst.length = length;\n previousNodeInst.type = type;\n previousNodeInst.colonOffset = undefined;\n previousNode = previousNodeInst;\n }\n try {\n visit(text, {\n onObjectBegin: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n isAtPropertyKey = position > offset;\n segments.push(''); // push a placeholder (will be replaced)\n },\n onObjectProperty: (name, offset, length) => {\n if (position < offset) {\n throw earlyReturnException;\n }\n setPreviousNode(name, offset, length, 'property');\n segments[segments.length - 1] = name;\n if (position <= offset + length) {\n throw earlyReturnException;\n }\n },\n onObjectEnd: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n segments.pop();\n },\n onArrayBegin: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n segments.push(0);\n },\n onArrayEnd: (offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n previousNode = undefined;\n segments.pop();\n },\n onLiteralValue: (value, offset, length) => {\n if (position < offset) {\n throw earlyReturnException;\n }\n setPreviousNode(value, offset, length, getNodeType(value));\n if (position <= offset + length) {\n throw earlyReturnException;\n }\n },\n onSeparator: (sep, offset, length) => {\n if (position <= offset) {\n throw earlyReturnException;\n }\n if (sep === ':' && previousNode && previousNode.type === 'property') {\n previousNode.colonOffset = offset;\n isAtPropertyKey = false;\n previousNode = undefined;\n }\n else if (sep === ',') {\n const last = segments[segments.length - 1];\n if (typeof last === 'number') {\n segments[segments.length - 1] = last + 1;\n }\n else {\n isAtPropertyKey = true;\n segments[segments.length - 1] = '';\n }\n previousNode = undefined;\n }\n }\n });\n }\n catch (e) {\n if (e !== earlyReturnException) {\n throw e;\n }\n }\n return {\n path: segments,\n previousNode,\n isAtPropertyKey,\n matches: (pattern) => {\n let k = 0;\n for (let i = 0; k < pattern.length && i < segments.length; i++) {\n if (pattern[k] === segments[i] || pattern[k] === '*') {\n k++;\n }\n else if (pattern[k] !== '**') {\n return false;\n }\n }\n return k === pattern.length;\n }\n };\n}\n/**\n * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n * Therefore always check the errors list to find out if the input was valid.\n */\nexport function parse(text, errors = [], options = ParseOptions.DEFAULT) {\n let currentProperty = null;\n let currentParent = [];\n const previousParents = [];\n function onValue(value) {\n if (Array.isArray(currentParent)) {\n currentParent.push(value);\n }\n else if (currentProperty !== null) {\n currentParent[currentProperty] = value;\n }\n }\n const visitor = {\n onObjectBegin: () => {\n const object = {};\n onValue(object);\n previousParents.push(currentParent);\n currentParent = object;\n currentProperty = null;\n },\n onObjectProperty: (name) => {\n currentProperty = name;\n },\n onObjectEnd: () => {\n currentParent = previousParents.pop();\n },\n onArrayBegin: () => {\n const array = [];\n onValue(array);\n previousParents.push(currentParent);\n currentParent = array;\n currentProperty = null;\n },\n onArrayEnd: () => {\n currentParent = previousParents.pop();\n },\n onLiteralValue: onValue,\n onError: (error, offset, length) => {\n errors.push({ error, offset, length });\n }\n };\n visit(text, visitor, options);\n return currentParent[0];\n}\n/**\n * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n */\nexport function parseTree(text, errors = [], options = ParseOptions.DEFAULT) {\n let currentParent = { type: 'array', offset: -1, length: -1, children: [], parent: undefined }; // artificial root\n function ensurePropertyComplete(endOffset) {\n if (currentParent.type === 'property') {\n currentParent.length = endOffset - currentParent.offset;\n currentParent = currentParent.parent;\n }\n }\n function onValue(valueNode) {\n currentParent.children.push(valueNode);\n return valueNode;\n }\n const visitor = {\n onObjectBegin: (offset) => {\n currentParent = onValue({ type: 'object', offset, length: -1, parent: currentParent, children: [] });\n },\n onObjectProperty: (name, offset, length) => {\n currentParent = onValue({ type: 'property', offset, length: -1, parent: currentParent, children: [] });\n currentParent.children.push({ type: 'string', value: name, offset, length, parent: currentParent });\n },\n onObjectEnd: (offset, length) => {\n ensurePropertyComplete(offset + length); // in case of a missing value for a property: make sure property is complete\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onArrayBegin: (offset, length) => {\n currentParent = onValue({ type: 'array', offset, length: -1, parent: currentParent, children: [] });\n },\n onArrayEnd: (offset, length) => {\n currentParent.length = offset + length - currentParent.offset;\n currentParent = currentParent.parent;\n ensurePropertyComplete(offset + length);\n },\n onLiteralValue: (value, offset, length) => {\n onValue({ type: getNodeType(value), offset, length, parent: currentParent, value });\n ensurePropertyComplete(offset + length);\n },\n onSeparator: (sep, offset, length) => {\n if (currentParent.type === 'property') {\n if (sep === ':') {\n currentParent.colonOffset = offset;\n }\n else if (sep === ',') {\n ensurePropertyComplete(offset);\n }\n }\n },\n onError: (error, offset, length) => {\n errors.push({ error, offset, length });\n }\n };\n visit(text, visitor, options);\n const result = currentParent.children[0];\n if (result) {\n delete result.parent;\n }\n return result;\n}\n/**\n * Finds the node at the given path in a JSON DOM.\n */\nexport function findNodeAtLocation(root, path) {\n if (!root) {\n return undefined;\n }\n let node = root;\n for (let segment of path) {\n if (typeof segment === 'string') {\n if (node.type !== 'object' || !Array.isArray(node.children)) {\n return undefined;\n }\n let found = false;\n for (const propertyNode of node.children) {\n if (Array.isArray(propertyNode.children) && propertyNode.children[0].value === segment && propertyNode.children.length === 2) {\n node = propertyNode.children[1];\n found = true;\n break;\n }\n }\n if (!found) {\n return undefined;\n }\n }\n else {\n const index = segment;\n if (node.type !== 'array' || index < 0 || !Array.isArray(node.children) || index >= node.children.length) {\n return undefined;\n }\n node = node.children[index];\n }\n }\n return node;\n}\n/**\n * Gets the JSON path of the given JSON DOM node\n */\nexport function getNodePath(node) {\n if (!node.parent || !node.parent.children) {\n return [];\n }\n const path = getNodePath(node.parent);\n if (node.parent.type === 'property') {\n const key = node.parent.children[0].value;\n path.push(key);\n }\n else if (node.parent.type === 'array') {\n const index = node.parent.children.indexOf(node);\n if (index !== -1) {\n path.push(index);\n }\n }\n return path;\n}\n/**\n * Evaluates the JavaScript object of the given JSON DOM node\n */\nexport function getNodeValue(node) {\n switch (node.type) {\n case 'array':\n return node.children.map(getNodeValue);\n case 'object':\n const obj = Object.create(null);\n for (let prop of node.children) {\n const valueNode = prop.children[1];\n if (valueNode) {\n obj[prop.children[0].value] = getNodeValue(valueNode);\n }\n }\n return obj;\n case 'null':\n case 'string':\n case 'number':\n case 'boolean':\n return node.value;\n default:\n return undefined;\n }\n}\nexport function contains(node, offset, includeRightBound = false) {\n return (offset >= node.offset && offset < (node.offset + node.length)) || includeRightBound && (offset === (node.offset + node.length));\n}\n/**\n * Finds the most inner node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.\n */\nexport function findNodeAtOffset(node, offset, includeRightBound = false) {\n if (contains(node, offset, includeRightBound)) {\n const children = node.children;\n if (Array.isArray(children)) {\n for (let i = 0; i < children.length && children[i].offset <= offset; i++) {\n const item = findNodeAtOffset(children[i], offset, includeRightBound);\n if (item) {\n return item;\n }\n }\n }\n return node;\n }\n return undefined;\n}\n/**\n * Parses the given text and invokes the visitor functions for each object, array and literal reached.\n */\nexport function visit(text, visitor, options = ParseOptions.DEFAULT) {\n const _scanner = createScanner(text, false);\n // Important: Only pass copies of this to visitor functions to prevent accidental modification, and\n // to not affect visitor functions which stored a reference to a previous JSONPath\n const _jsonPath = [];\n // Depth of onXXXBegin() callbacks suppressed. onXXXEnd() decrements this if it isn't 0 already.\n // Callbacks are only called when this value is 0.\n let suppressedCallbacks = 0;\n function toNoArgVisit(visitFunction) {\n return visitFunction ? () => suppressedCallbacks === 0 && visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;\n }\n function toOneArgVisit(visitFunction) {\n return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter()) : () => true;\n }\n function toOneArgVisitWithPath(visitFunction) {\n return visitFunction ? (arg) => suppressedCallbacks === 0 && visitFunction(arg, _scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice()) : () => true;\n }\n function toBeginVisit(visitFunction) {\n return visitFunction ?\n () => {\n if (suppressedCallbacks > 0) {\n suppressedCallbacks++;\n }\n else {\n let cbReturn = visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter(), () => _jsonPath.slice());\n if (cbReturn === false) {\n suppressedCallbacks = 1;\n }\n }\n }\n : () => true;\n }\n function toEndVisit(visitFunction) {\n return visitFunction ?\n () => {\n if (suppressedCallbacks > 0) {\n suppressedCallbacks--;\n }\n if (suppressedCallbacks === 0) {\n visitFunction(_scanner.getTokenOffset(), _scanner.getTokenLength(), _scanner.getTokenStartLine(), _scanner.getTokenStartCharacter());\n }\n }\n : () => true;\n }\n const onObjectBegin = toBeginVisit(visitor.onObjectBegin), onObjectProperty = toOneArgVisitWithPath(visitor.onObjectProperty), onObjectEnd = toEndVisit(visitor.onObjectEnd), onArrayBegin = toBeginVisit(visitor.onArrayBegin), onArrayEnd = toEndVisit(visitor.onArrayEnd), onLiteralValue = toOneArgVisitWithPath(visitor.onLiteralValue), onSeparator = toOneArgVisit(visitor.onSeparator), onComment = toNoArgVisit(visitor.onComment), onError = toOneArgVisit(visitor.onError);\n const disallowComments = options && options.disallowComments;\n const allowTrailingComma = options && options.allowTrailingComma;\n function scanNext() {\n while (true) {\n const token = _scanner.scan();\n switch (_scanner.getTokenError()) {\n case 4 /* ScanError.InvalidUnicode */:\n handleError(14 /* ParseErrorCode.InvalidUnicode */);\n break;\n case 5 /* ScanError.InvalidEscapeCharacter */:\n handleError(15 /* ParseErrorCode.InvalidEscapeCharacter */);\n break;\n case 3 /* ScanError.UnexpectedEndOfNumber */:\n handleError(13 /* ParseErrorCode.UnexpectedEndOfNumber */);\n break;\n case 1 /* ScanError.UnexpectedEndOfComment */:\n if (!disallowComments) {\n handleError(11 /* ParseErrorCode.UnexpectedEndOfComment */);\n }\n break;\n case 2 /* ScanError.UnexpectedEndOfString */:\n handleError(12 /* ParseErrorCode.UnexpectedEndOfString */);\n break;\n case 6 /* ScanError.InvalidCharacter */:\n handleError(16 /* ParseErrorCode.InvalidCharacter */);\n break;\n }\n switch (token) {\n case 12 /* SyntaxKind.LineCommentTrivia */:\n case 13 /* SyntaxKind.BlockCommentTrivia */:\n if (disallowComments) {\n handleError(10 /* ParseErrorCode.InvalidCommentToken */);\n }\n else {\n onComment();\n }\n break;\n case 16 /* SyntaxKind.Unknown */:\n handleError(1 /* ParseErrorCode.InvalidSymbol */);\n break;\n case 15 /* SyntaxKind.Trivia */:\n case 14 /* SyntaxKind.LineBreakTrivia */:\n break;\n default:\n return token;\n }\n }\n }\n function handleError(error, skipUntilAfter = [], skipUntil = []) {\n onError(error);\n if (skipUntilAfter.length + skipUntil.length > 0) {\n let token = _scanner.getToken();\n while (token !== 17 /* SyntaxKind.EOF */) {\n if (skipUntilAfter.indexOf(token) !== -1) {\n scanNext();\n break;\n }\n else if (skipUntil.indexOf(token) !== -1) {\n break;\n }\n token = scanNext();\n }\n }\n }\n function parseString(isValue) {\n const value = _scanner.getTokenValue();\n if (isValue) {\n onLiteralValue(value);\n }\n else {\n onObjectProperty(value);\n // add property name afterwards\n _jsonPath.push(value);\n }\n scanNext();\n return true;\n }\n function parseLiteral() {\n switch (_scanner.getToken()) {\n case 11 /* SyntaxKind.NumericLiteral */:\n const tokenValue = _scanner.getTokenValue();\n let value = Number(tokenValue);\n if (isNaN(value)) {\n handleError(2 /* ParseErrorCode.InvalidNumberFormat */);\n value = 0;\n }\n onLiteralValue(value);\n break;\n case 7 /* SyntaxKind.NullKeyword */:\n onLiteralValue(null);\n break;\n case 8 /* SyntaxKind.TrueKeyword */:\n onLiteralValue(true);\n break;\n case 9 /* SyntaxKind.FalseKeyword */:\n onLiteralValue(false);\n break;\n default:\n return false;\n }\n scanNext();\n return true;\n }\n function parseProperty() {\n if (_scanner.getToken() !== 10 /* SyntaxKind.StringLiteral */) {\n handleError(3 /* ParseErrorCode.PropertyNameExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n return false;\n }\n parseString(false);\n if (_scanner.getToken() === 6 /* SyntaxKind.ColonToken */) {\n onSeparator(':');\n scanNext(); // consume colon\n if (!parseValue()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n }\n else {\n handleError(5 /* ParseErrorCode.ColonExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n _jsonPath.pop(); // remove processed property name\n return true;\n }\n function parseObject() {\n onObjectBegin();\n scanNext(); // consume open brace\n let needsComma = false;\n while (_scanner.getToken() !== 2 /* SyntaxKind.CloseBraceToken */ && _scanner.getToken() !== 17 /* SyntaxKind.EOF */) {\n if (_scanner.getToken() === 5 /* SyntaxKind.CommaToken */) {\n if (!needsComma) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n }\n onSeparator(',');\n scanNext(); // consume comma\n if (_scanner.getToken() === 2 /* SyntaxKind.CloseBraceToken */ && allowTrailingComma) {\n break;\n }\n }\n else if (needsComma) {\n handleError(6 /* ParseErrorCode.CommaExpected */, [], []);\n }\n if (!parseProperty()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], [2 /* SyntaxKind.CloseBraceToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n needsComma = true;\n }\n onObjectEnd();\n if (_scanner.getToken() !== 2 /* SyntaxKind.CloseBraceToken */) {\n handleError(7 /* ParseErrorCode.CloseBraceExpected */, [2 /* SyntaxKind.CloseBraceToken */], []);\n }\n else {\n scanNext(); // consume close brace\n }\n return true;\n }\n function parseArray() {\n onArrayBegin();\n scanNext(); // consume open bracket\n let isFirstElement = true;\n let needsComma = false;\n while (_scanner.getToken() !== 4 /* SyntaxKind.CloseBracketToken */ && _scanner.getToken() !== 17 /* SyntaxKind.EOF */) {\n if (_scanner.getToken() === 5 /* SyntaxKind.CommaToken */) {\n if (!needsComma) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n }\n onSeparator(',');\n scanNext(); // consume comma\n if (_scanner.getToken() === 4 /* SyntaxKind.CloseBracketToken */ && allowTrailingComma) {\n break;\n }\n }\n else if (needsComma) {\n handleError(6 /* ParseErrorCode.CommaExpected */, [], []);\n }\n if (isFirstElement) {\n _jsonPath.push(0);\n isFirstElement = false;\n }\n else {\n _jsonPath[_jsonPath.length - 1]++;\n }\n if (!parseValue()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], [4 /* SyntaxKind.CloseBracketToken */, 5 /* SyntaxKind.CommaToken */]);\n }\n needsComma = true;\n }\n onArrayEnd();\n if (!isFirstElement) {\n _jsonPath.pop(); // remove array index\n }\n if (_scanner.getToken() !== 4 /* SyntaxKind.CloseBracketToken */) {\n handleError(8 /* ParseErrorCode.CloseBracketExpected */, [4 /* SyntaxKind.CloseBracketToken */], []);\n }\n else {\n scanNext(); // consume close bracket\n }\n return true;\n }\n function parseValue() {\n switch (_scanner.getToken()) {\n case 3 /* SyntaxKind.OpenBracketToken */:\n return parseArray();\n case 1 /* SyntaxKind.OpenBraceToken */:\n return parseObject();\n case 10 /* SyntaxKind.StringLiteral */:\n return parseString(true);\n default:\n return parseLiteral();\n }\n }\n scanNext();\n if (_scanner.getToken() === 17 /* SyntaxKind.EOF */) {\n if (options.allowEmptyContent) {\n return true;\n }\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n return false;\n }\n if (!parseValue()) {\n handleError(4 /* ParseErrorCode.ValueExpected */, [], []);\n return false;\n }\n if (_scanner.getToken() !== 17 /* SyntaxKind.EOF */) {\n handleError(9 /* ParseErrorCode.EndOfFileExpected */, [], []);\n }\n return true;\n}\n/**\n * Takes JSON with JavaScript-style comments and remove\n * them. Optionally replaces every none-newline character\n * of comments with a replaceCharacter\n */\nexport function stripComments(text, replaceCh) {\n let _scanner = createScanner(text), parts = [], kind, offset = 0, pos;\n do {\n pos = _scanner.getPosition();\n kind = _scanner.scan();\n switch (kind) {\n case 12 /* SyntaxKind.LineCommentTrivia */:\n case 13 /* SyntaxKind.BlockCommentTrivia */:\n case 17 /* SyntaxKind.EOF */:\n if (offset !== pos) {\n parts.push(text.substring(offset, pos));\n }\n if (replaceCh !== undefined) {\n parts.push(_scanner.getTokenValue().replace(/[^\\r\\n]/g, replaceCh));\n }\n offset = _scanner.getPosition();\n break;\n }\n } while (kind !== 17 /* SyntaxKind.EOF */);\n return parts.join('');\n}\nexport function getNodeType(value) {\n switch (typeof value) {\n case 'boolean': return 'boolean';\n case 'number': return 'number';\n case 'string': return 'string';\n case 'object': {\n if (!value) {\n return 'null';\n }\n else if (Array.isArray(value)) {\n return 'array';\n }\n return 'object';\n }\n default: return 'null';\n }\n}\n",
12
+ "/*---------------------------------------------------------------------------------------------\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for license information.\n *--------------------------------------------------------------------------------------------*/\n'use strict';\nimport * as formatter from './impl/format';\nimport * as edit from './impl/edit';\nimport * as scanner from './impl/scanner';\nimport * as parser from './impl/parser';\n/**\n * Creates a JSON scanner on the given text.\n * If ignoreTrivia is set, whitespaces or comments are ignored.\n */\nexport const createScanner = scanner.createScanner;\nexport var ScanError;\n(function (ScanError) {\n ScanError[ScanError[\"None\"] = 0] = \"None\";\n ScanError[ScanError[\"UnexpectedEndOfComment\"] = 1] = \"UnexpectedEndOfComment\";\n ScanError[ScanError[\"UnexpectedEndOfString\"] = 2] = \"UnexpectedEndOfString\";\n ScanError[ScanError[\"UnexpectedEndOfNumber\"] = 3] = \"UnexpectedEndOfNumber\";\n ScanError[ScanError[\"InvalidUnicode\"] = 4] = \"InvalidUnicode\";\n ScanError[ScanError[\"InvalidEscapeCharacter\"] = 5] = \"InvalidEscapeCharacter\";\n ScanError[ScanError[\"InvalidCharacter\"] = 6] = \"InvalidCharacter\";\n})(ScanError || (ScanError = {}));\nexport var SyntaxKind;\n(function (SyntaxKind) {\n SyntaxKind[SyntaxKind[\"OpenBraceToken\"] = 1] = \"OpenBraceToken\";\n SyntaxKind[SyntaxKind[\"CloseBraceToken\"] = 2] = \"CloseBraceToken\";\n SyntaxKind[SyntaxKind[\"OpenBracketToken\"] = 3] = \"OpenBracketToken\";\n SyntaxKind[SyntaxKind[\"CloseBracketToken\"] = 4] = \"CloseBracketToken\";\n SyntaxKind[SyntaxKind[\"CommaToken\"] = 5] = \"CommaToken\";\n SyntaxKind[SyntaxKind[\"ColonToken\"] = 6] = \"ColonToken\";\n SyntaxKind[SyntaxKind[\"NullKeyword\"] = 7] = \"NullKeyword\";\n SyntaxKind[SyntaxKind[\"TrueKeyword\"] = 8] = \"TrueKeyword\";\n SyntaxKind[SyntaxKind[\"FalseKeyword\"] = 9] = \"FalseKeyword\";\n SyntaxKind[SyntaxKind[\"StringLiteral\"] = 10] = \"StringLiteral\";\n SyntaxKind[SyntaxKind[\"NumericLiteral\"] = 11] = \"NumericLiteral\";\n SyntaxKind[SyntaxKind[\"LineCommentTrivia\"] = 12] = \"LineCommentTrivia\";\n SyntaxKind[SyntaxKind[\"BlockCommentTrivia\"] = 13] = \"BlockCommentTrivia\";\n SyntaxKind[SyntaxKind[\"LineBreakTrivia\"] = 14] = \"LineBreakTrivia\";\n SyntaxKind[SyntaxKind[\"Trivia\"] = 15] = \"Trivia\";\n SyntaxKind[SyntaxKind[\"Unknown\"] = 16] = \"Unknown\";\n SyntaxKind[SyntaxKind[\"EOF\"] = 17] = \"EOF\";\n})(SyntaxKind || (SyntaxKind = {}));\n/**\n * For a given offset, evaluate the location in the JSON document. Each segment in the location path is either a property name or an array index.\n */\nexport const getLocation = parser.getLocation;\n/**\n * Parses the given text and returns the object the JSON content represents. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n * Therefore, always check the errors list to find out if the input was valid.\n */\nexport const parse = parser.parse;\n/**\n * Parses the given text and returns a tree representation the JSON content. On invalid input, the parser tries to be as fault tolerant as possible, but still return a result.\n */\nexport const parseTree = parser.parseTree;\n/**\n * Finds the node at the given path in a JSON DOM.\n */\nexport const findNodeAtLocation = parser.findNodeAtLocation;\n/**\n * Finds the innermost node at the given offset. If includeRightBound is set, also finds nodes that end at the given offset.\n */\nexport const findNodeAtOffset = parser.findNodeAtOffset;\n/**\n * Gets the JSON path of the given JSON DOM node\n */\nexport const getNodePath = parser.getNodePath;\n/**\n * Evaluates the JavaScript object of the given JSON DOM node\n */\nexport const getNodeValue = parser.getNodeValue;\n/**\n * Parses the given text and invokes the visitor functions for each object, array and literal reached.\n */\nexport const visit = parser.visit;\n/**\n * Takes JSON with JavaScript-style comments and remove\n * them. Optionally replaces every none-newline character\n * of comments with a replaceCharacter\n */\nexport const stripComments = parser.stripComments;\nexport var ParseErrorCode;\n(function (ParseErrorCode) {\n ParseErrorCode[ParseErrorCode[\"InvalidSymbol\"] = 1] = \"InvalidSymbol\";\n ParseErrorCode[ParseErrorCode[\"InvalidNumberFormat\"] = 2] = \"InvalidNumberFormat\";\n ParseErrorCode[ParseErrorCode[\"PropertyNameExpected\"] = 3] = \"PropertyNameExpected\";\n ParseErrorCode[ParseErrorCode[\"ValueExpected\"] = 4] = \"ValueExpected\";\n ParseErrorCode[ParseErrorCode[\"ColonExpected\"] = 5] = \"ColonExpected\";\n ParseErrorCode[ParseErrorCode[\"CommaExpected\"] = 6] = \"CommaExpected\";\n ParseErrorCode[ParseErrorCode[\"CloseBraceExpected\"] = 7] = \"CloseBraceExpected\";\n ParseErrorCode[ParseErrorCode[\"CloseBracketExpected\"] = 8] = \"CloseBracketExpected\";\n ParseErrorCode[ParseErrorCode[\"EndOfFileExpected\"] = 9] = \"EndOfFileExpected\";\n ParseErrorCode[ParseErrorCode[\"InvalidCommentToken\"] = 10] = \"InvalidCommentToken\";\n ParseErrorCode[ParseErrorCode[\"UnexpectedEndOfComment\"] = 11] = \"UnexpectedEndOfComment\";\n ParseErrorCode[ParseErrorCode[\"UnexpectedEndOfString\"] = 12] = \"UnexpectedEndOfString\";\n ParseErrorCode[ParseErrorCode[\"UnexpectedEndOfNumber\"] = 13] = \"UnexpectedEndOfNumber\";\n ParseErrorCode[ParseErrorCode[\"InvalidUnicode\"] = 14] = \"InvalidUnicode\";\n ParseErrorCode[ParseErrorCode[\"InvalidEscapeCharacter\"] = 15] = \"InvalidEscapeCharacter\";\n ParseErrorCode[ParseErrorCode[\"InvalidCharacter\"] = 16] = \"InvalidCharacter\";\n})(ParseErrorCode || (ParseErrorCode = {}));\nexport function printParseErrorCode(code) {\n switch (code) {\n case 1 /* ParseErrorCode.InvalidSymbol */: return 'InvalidSymbol';\n case 2 /* ParseErrorCode.InvalidNumberFormat */: return 'InvalidNumberFormat';\n case 3 /* ParseErrorCode.PropertyNameExpected */: return 'PropertyNameExpected';\n case 4 /* ParseErrorCode.ValueExpected */: return 'ValueExpected';\n case 5 /* ParseErrorCode.ColonExpected */: return 'ColonExpected';\n case 6 /* ParseErrorCode.CommaExpected */: return 'CommaExpected';\n case 7 /* ParseErrorCode.CloseBraceExpected */: return 'CloseBraceExpected';\n case 8 /* ParseErrorCode.CloseBracketExpected */: return 'CloseBracketExpected';\n case 9 /* ParseErrorCode.EndOfFileExpected */: return 'EndOfFileExpected';\n case 10 /* ParseErrorCode.InvalidCommentToken */: return 'InvalidCommentToken';\n case 11 /* ParseErrorCode.UnexpectedEndOfComment */: return 'UnexpectedEndOfComment';\n case 12 /* ParseErrorCode.UnexpectedEndOfString */: return 'UnexpectedEndOfString';\n case 13 /* ParseErrorCode.UnexpectedEndOfNumber */: return 'UnexpectedEndOfNumber';\n case 14 /* ParseErrorCode.InvalidUnicode */: return 'InvalidUnicode';\n case 15 /* ParseErrorCode.InvalidEscapeCharacter */: return 'InvalidEscapeCharacter';\n case 16 /* ParseErrorCode.InvalidCharacter */: return 'InvalidCharacter';\n }\n return '<unknown ParseErrorCode>';\n}\n/**\n * Computes the edit operations needed to format a JSON document.\n *\n * @param documentText The input text\n * @param range The range to format or `undefined` to format the full content\n * @param options The formatting options\n * @returns The edit operations describing the formatting changes to the original document following the format described in {@linkcode EditResult}.\n * To apply the edit operations to the input, use {@linkcode applyEdits}.\n */\nexport function format(documentText, range, options) {\n return formatter.format(documentText, range, options);\n}\n/**\n * Computes the edit operations needed to modify a value in the JSON document.\n *\n * @param documentText The input text\n * @param path The path of the value to change. The path represents either to the document root, a property or an array item.\n * If the path points to an non-existing property or item, it will be created.\n * @param value The new value for the specified property or item. If the value is undefined,\n * the property or item will be removed.\n * @param options Options\n * @returns The edit operations describing the changes to the original document, following the format described in {@linkcode EditResult}.\n * To apply the edit operations to the input, use {@linkcode applyEdits}.\n */\nexport function modify(text, path, value, options) {\n return edit.setProperty(text, path, value, options);\n}\n/**\n * Applies edits to an input string.\n * @param text The input text\n * @param edits Edit operations following the format described in {@linkcode EditResult}.\n * @returns The text with the applied edits.\n * @throws An error if the edit operations are not well-formed as described in {@linkcode EditResult}.\n */\nexport function applyEdits(text, edits) {\n let sortedEdits = edits.slice(0).sort((a, b) => {\n const diff = a.offset - b.offset;\n if (diff === 0) {\n return a.length - b.length;\n }\n return diff;\n });\n let lastModifiedOffset = text.length;\n for (let i = sortedEdits.length - 1; i >= 0; i--) {\n let e = sortedEdits[i];\n if (e.offset + e.length <= lastModifiedOffset) {\n text = edit.applyEdit(text, e);\n }\n else {\n throw new Error('Overlapping edit');\n }\n lastModifiedOffset = e.offset;\n }\n return text;\n}\n",
13
+ "export * as Wildcard from \"./wildcard\"\n\nexport function match(input: string, pattern: string) {\n const normalized = input.replaceAll(\"\\\\\", \"/\")\n let escaped = pattern\n .replaceAll(\"\\\\\", \"/\")\n .replace(/[.+^${}()|[\\]\\\\]/g, \"\\\\$&\")\n .replace(/\\*/g, \".*\")\n .replace(/\\?/g, \".\")\n\n if (escaped.endsWith(\" .*\")) escaped = escaped.slice(0, -3) + \"( .*)?\"\n\n return new RegExp(\"^\" + escaped + \"$\", process.platform === \"win32\" ? \"si\" : \"s\").test(normalized)\n}\n",
14
+ "export * as Policy from \"./policy\"\n\nimport { Context, Effect as EffectRuntime, Layer, Schema } from \"effect\"\nimport { Wildcard } from \"./util/wildcard\"\nimport { Location } from \"./location\"\n\nexport const Effect = Schema.Literals([\"allow\", \"deny\"]).annotate({ identifier: \"Policy.Effect\" })\nexport type Effect = typeof Effect.Type\n\nexport class Info extends Schema.Class<Info>(\"Policy.Info\")({\n action: Schema.String,\n effect: Effect,\n resource: Schema.String,\n}) {}\n\nexport interface Interface {\n readonly load: (statements: Info[]) => EffectRuntime.Effect<void>\n readonly evaluate: (action: string, resource: string, fallback: Effect) => EffectRuntime.Effect<Effect>\n readonly hasStatements: () => boolean\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/v2/Policy\") {}\n\nexport const layer = Layer.effect(\n Service,\n EffectRuntime.gen(function* () {\n let statements: Info[] = []\n yield* Location.Service\n\n return Service.of({\n load: EffectRuntime.fn(\"Policy.load\")(function* (input) {\n statements = input\n }),\n hasStatements: () => statements.length > 0,\n evaluate: EffectRuntime.fn(\"Policy.evaluate\")(function* (action, resource, fallback) {\n return (\n statements.findLast(\n (statement) => Wildcard.match(action, statement.action) && Wildcard.match(resource, statement.resource),\n )?.effect ?? fallback\n )\n }),\n })\n }),\n)\n\nexport const locationLayer = layer\n",
15
+ "export * as ConfigProvider from \"./provider\"\n\nimport { Schema } from \"effect\"\nimport { ProviderV2 } from \"../provider\"\nimport { ModelV2 } from \"../model\"\n\nexport class Request extends Schema.Class<Request>(\"ConfigV2.Provider.Request\")({\n headers: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional),\n body: Schema.Record(Schema.String, Schema.Unknown).pipe(Schema.optional),\n}) {}\n\nclass Cache extends Schema.Class<Cache>(\"ConfigV2.Model.Cost.Cache\")({\n read: Schema.Finite.pipe(Schema.optional),\n write: Schema.Finite.pipe(Schema.optional),\n}) {}\n\nclass Cost extends Schema.Class<Cost>(\"ConfigV2.Model.Cost\")({\n tier: Schema.Struct({\n type: Schema.Literal(\"context\"),\n size: Schema.Int,\n }).pipe(Schema.optional),\n input: Schema.Finite,\n output: Schema.Finite,\n cache: Cache.pipe(Schema.optional),\n}) {}\n\nclass Limit extends Schema.Class<Limit>(\"ConfigV2.Model.Limit\")({\n context: Schema.Int.pipe(Schema.optional),\n input: Schema.Int.pipe(Schema.optional),\n output: Schema.Int.pipe(Schema.optional),\n}) {}\n\nconst ModelApi = Schema.Union([\n Schema.Struct({\n id: ModelV2.ID.pipe(Schema.optional),\n ...ProviderV2.AISDK.fields,\n }),\n Schema.Struct({\n id: ModelV2.ID.pipe(Schema.optional),\n ...ProviderV2.Native.fields,\n }),\n Schema.Struct({\n id: ModelV2.ID,\n }),\n])\n\nclass Model extends Schema.Class<Model>(\"ConfigV2.Model\")({\n family: ModelV2.Family.pipe(Schema.optional),\n name: Schema.String.pipe(Schema.optional),\n api: ModelApi.pipe(Schema.optional),\n capabilities: ModelV2.Capabilities.pipe(Schema.optional),\n request: Schema.Struct({\n ...Request.fields,\n variant: Schema.String.pipe(Schema.optional),\n }).pipe(Schema.optional),\n variants: Schema.Struct({\n id: ModelV2.VariantID,\n ...Request.fields,\n }).pipe(Schema.Array, Schema.optional),\n cost: Schema.Union([Cost, Cost.pipe(Schema.Array)]).pipe(Schema.optional),\n disabled: Schema.Boolean.pipe(Schema.optional),\n limit: Limit.pipe(Schema.optional),\n}) {}\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.Provider\")({\n name: Schema.String.pipe(Schema.optional),\n env: Schema.String.pipe(Schema.Array, Schema.optional),\n api: ProviderV2.Api.pipe(Schema.optional),\n request: Request.pipe(Schema.optional),\n models: Schema.Record(Schema.String, Model).pipe(Schema.optional),\n}) {}\n",
16
+ "export * as ConfigAgent from \"./agent\"\n\nimport { Schema } from \"effect\"\nimport { PermissionSchema } from \"../permission/schema\"\nimport { ConfigProvider } from \"./provider\"\nimport { PositiveInt } from \"../schema\"\n\nexport const Color = Schema.Union([\n Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/)),\n Schema.Literals([\"primary\", \"secondary\", \"accent\", \"success\", \"warning\", \"error\", \"info\"]),\n])\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.Agent\")({\n model: Schema.String.pipe(Schema.optional),\n variant: Schema.String.pipe(Schema.optional),\n request: ConfigProvider.Request.pipe(Schema.optional),\n system: Schema.String.pipe(Schema.optional),\n description: Schema.String.pipe(Schema.optional),\n mode: Schema.Literals([\"subagent\", \"primary\", \"all\"]).pipe(Schema.optional),\n hidden: Schema.Boolean.pipe(Schema.optional),\n color: Color.pipe(Schema.optional),\n steps: PositiveInt.pipe(Schema.optional),\n disabled: Schema.Boolean.pipe(Schema.optional),\n permissions: PermissionSchema.Ruleset.pipe(Schema.optional),\n}) {}\n",
17
+ "export * as ConfigAttachments from \"./attachments\"\n\nimport { Schema } from \"effect\"\nimport { PositiveInt } from \"../schema\"\n\nexport class Image extends Schema.Class<Image>(\"ConfigV2.Attachments.Image\")({\n auto_resize: Schema.Boolean.pipe(Schema.optional),\n max_width: PositiveInt.pipe(Schema.optional),\n max_height: PositiveInt.pipe(Schema.optional),\n max_base64_bytes: PositiveInt.pipe(Schema.optional),\n}) {}\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.Attachments\")({\n image: Image.pipe(Schema.optional),\n}) {}\n",
18
+ "export * as ConfigCompaction from \"./compaction\"\n\nimport { Schema } from \"effect\"\nimport { NonNegativeInt } from \"../schema\"\n\nexport class Keep extends Schema.Class<Keep>(\"ConfigV2.Compaction.Keep\")({\n tokens: NonNegativeInt.pipe(Schema.optional),\n}) {}\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.Compaction\")({\n auto: Schema.Boolean.pipe(Schema.optional),\n prune: Schema.Boolean.pipe(Schema.optional),\n keep: Keep.pipe(Schema.optional),\n buffer: NonNegativeInt.pipe(Schema.optional),\n}) {}\n",
19
+ "export * as ConfigCommand from \"./command\"\n\nimport { Schema } from \"effect\"\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.Command\")({\n template: Schema.String,\n description: Schema.String.pipe(Schema.optional),\n agent: Schema.String.pipe(Schema.optional),\n model: Schema.String.pipe(Schema.optional),\n variant: Schema.String.pipe(Schema.optional),\n subtask: Schema.Boolean.pipe(Schema.optional),\n}) {}\n",
20
+ "export * as KeyedMutex from \"./keyed-mutex\"\n\nimport { Effect, Semaphore } from \"effect\"\n\nexport interface KeyedMutex<in Key> {\n readonly size: Effect.Effect<number>\n readonly withLock: (key: Key) => <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R>\n}\n\n/**\n * Creates an in-memory mutex with one lock per key. Entries are removed when no\n * holder or waiter remains.\n *\n * same key -> queue\n * different key -> run independently\n *\n * `users` counts holders and waiters so an entry is not removed while a waiter\n * will reuse it.\n */\nexport const makeUnsafe = <Key>(): KeyedMutex<Key> => {\n const locks = new Map<Key, { readonly semaphore: Semaphore.Semaphore; users: number }>()\n\n const withLock =\n (key: Key) =>\n <A, E, R>(effect: Effect.Effect<A, E, R>) =>\n Effect.suspend(() => {\n const current = locks.get(key)\n const entry = current ?? { semaphore: Semaphore.makeUnsafe(1), users: 0 }\n if (!current) locks.set(key, entry)\n entry.users++\n return entry.semaphore.withPermit(effect).pipe(\n Effect.ensuring(\n Effect.sync(() => {\n entry.users--\n if (entry.users === 0) locks.delete(key)\n }),\n ),\n )\n })\n\n return { size: Effect.sync(() => locks.size), withLock }\n}\n\n/** Creates an in-memory keyed mutex inside an Effect workflow. */\nexport const make = <Key>(): Effect.Effect<KeyedMutex<Key>> => Effect.sync(makeUnsafe<Key>)\n",
21
+ "export * as PluginV2 from \"./plugin\"\n\nimport { createDraft, finishDraft, type Draft } from \"immer\"\nimport type { LanguageModelV3 } from \"@ai-sdk/provider\"\nimport { Context, Effect, Exit, Layer, Schema, Scope } from \"effect\"\nimport type { ModelV2 } from \"./model\"\nimport type { Catalog } from \"./catalog\"\nimport { EventV2 } from \"./event\"\nimport { KeyedMutex } from \"./effect/keyed-mutex\"\n\nexport const ID = Schema.String.pipe(Schema.brand(\"Plugin.ID\"))\nexport type ID = typeof ID.Type\n\nexport const Event = {\n Added: EventV2.define({\n type: \"plugin.added\",\n schema: {\n id: ID,\n },\n }),\n}\n\ntype HookSpec = {\n \"catalog.transform\": {\n input: Catalog.Editor\n output: {}\n }\n \"account.switched\": {\n input: {\n serviceID: import(\"./auth\").Auth.ServiceID\n from?: import(\"./auth\").Auth.ID\n to?: import(\"./auth\").Auth.ID\n }\n output: {}\n }\n \"aisdk.language\": {\n input: {\n model: ModelV2.Info\n sdk: any\n options: Record<string, any>\n }\n output: {\n language?: LanguageModelV3\n }\n }\n \"aisdk.sdk\": {\n input: {\n model: ModelV2.Info\n package: string\n options: Record<string, any>\n }\n output: {\n sdk?: any\n }\n }\n}\n\nexport type Hooks = {\n [Name in keyof HookSpec]: Readonly<HookSpec[Name][\"input\"]> & {\n -readonly [Field in keyof HookSpec[Name][\"output\"]]: HookSpec[Name][\"output\"][Field] extends object\n ? Draft<HookSpec[Name][\"output\"][Field]>\n : HookSpec[Name][\"output\"][Field]\n }\n}\n\nexport type HookFunctions = {\n [key in keyof Hooks]?: (input: Hooks[key]) => Effect.Effect<void>\n}\n\nexport type HookInput<Name extends keyof Hooks> = HookSpec[Name][\"input\"]\nexport type HookOutput<Name extends keyof Hooks> = HookSpec[Name][\"output\"]\n\nexport type Effect<R = never> = Effect.Effect<HookFunctions | void, never, R | Scope.Scope>\n\nexport function define<R>(input: { id: ID; effect: Effect.Effect<HookFunctions | void, never, R> }) {\n return input\n}\n\nexport interface Interface {\n readonly add: (input: {\n id: ID\n effect: Effect.Effect<void | HookFunctions, never, Scope.Scope>\n }) => Effect.Effect<void, never, never>\n readonly remove: (id: ID) => Effect.Effect<void>\n readonly triggerFor: <Name extends keyof Hooks>(\n id: ID,\n name: Name,\n input: HookInput<Name>,\n output: HookOutput<Name>,\n ) => Effect.Effect<HookInput<Name> & HookOutput<Name>>\n readonly trigger: <Name extends keyof Hooks>(\n name: Name,\n input: HookInput<Name>,\n output: HookOutput<Name>,\n ) => Effect.Effect<HookInput<Name> & HookOutput<Name>>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/v2/Plugin\") {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n let hooks: {\n id: ID\n hooks: HookFunctions\n scope: Scope.Closeable\n }[] = []\n const events = yield* EventV2.Service\n const scope = yield* Scope.Scope\n const locks = KeyedMutex.makeUnsafe<ID>()\n\n const svc = Service.of({\n add: Effect.fn(\"Plugin.add\")(function* (input) {\n yield* locks.withLock(input.id)(\n Effect.gen(function* () {\n const existing = hooks.find((item) => item.id === input.id)\n if (existing) yield* Scope.close(existing.scope, Exit.void).pipe(Effect.ignore)\n const childScope = yield* Scope.fork(scope)\n const result = yield* input.effect.pipe(\n Scope.provide(childScope),\n Effect.withSpan(\"Plugin.load\", {\n attributes: {\n \"plugin.id\": input.id,\n },\n }),\n Effect.onExit((exit) => (Exit.isFailure(exit) ? Scope.close(childScope, exit) : Effect.void)),\n )\n hooks = [\n ...hooks.filter((item) => item.id !== input.id),\n {\n id: input.id,\n hooks: result ?? {},\n scope: childScope,\n },\n ]\n yield* events.publish(Event.Added, { id: input.id })\n }),\n )\n }),\n trigger: Effect.fn(\"Plugin.trigger\")(function* (name, input, output) {\n return yield* svc.triggerFor(ID.make(\"*\"), name, input, output)\n }),\n triggerFor: Effect.fn(\"Plugin.triggerFor\")(function* (id, name, input, output) {\n const draftEntries = new Map<string, ReturnType<typeof createDraft>>()\n const event = {\n ...input,\n ...output,\n } as Record<string, unknown>\n\n for (const [field, value] of Object.entries(output)) {\n if (value && typeof value === \"object\") {\n draftEntries.set(field, createDraft(value))\n event[field] = draftEntries.get(field)\n }\n }\n\n for (const item of hooks) {\n if (id !== ID.make(\"*\") && item.id !== id) continue\n const match = item.hooks[name]\n if (!match) continue\n yield* match(event as any).pipe(\n Effect.withSpan(`Plugin.hook.${name}`, {\n attributes: {\n plugin: item.id,\n hook: name,\n },\n }),\n )\n }\n\n for (const [field, draft] of draftEntries) {\n event[field] = finishDraft(draft)\n }\n\n return event as any\n }),\n remove: Effect.fn(\"Plugin.remove\")(function* (id) {\n yield* locks.withLock(id)(\n Effect.gen(function* () {\n const existing = hooks.find((item) => item.id === id)\n hooks = hooks.filter((item) => item.id !== id)\n if (existing) yield* Scope.close(existing.scope, Exit.void).pipe(Effect.ignore)\n }),\n )\n }),\n })\n return svc\n }),\n)\n\nexport const locationLayer = layer\n\n// opencode\n// sdcok\n",
22
+ "export * as Catalog from \"./catalog\"\n\nimport { Context, Effect, Layer, Option, Order, pipe, Schema, Array, Scope, Stream } from \"effect\"\nimport { castDraft, enableMapSet, type Draft } from \"immer\"\nimport { ModelV2 } from \"./model\"\nimport { ModelRequest } from \"./model-request\"\nimport { PluginV2 } from \"./plugin\"\nimport { ProviderV2 } from \"./provider\"\nimport { Location } from \"./location\"\nimport { EventV2 } from \"./event\"\nimport { Policy } from \"./policy\"\nimport { State } from \"./state\"\n\nexport type ProviderRecord = {\n provider: ProviderV2.Info\n models: Map<ModelV2.ID, ModelV2.Info>\n}\n\nexport type DefaultModel = { providerID: ProviderV2.ID; modelID: ModelV2.ID }\n\nexport class ProviderNotFoundError extends Schema.TaggedErrorClass<ProviderNotFoundError>()(\n \"CatalogV2.ProviderNotFound\",\n {\n providerID: ProviderV2.ID,\n },\n) {}\n\nexport class ModelNotFoundError extends Schema.TaggedErrorClass<ModelNotFoundError>()(\"CatalogV2.ModelNotFound\", {\n providerID: ProviderV2.ID,\n modelID: ModelV2.ID,\n}) {}\n\nexport const PolicyActions = Schema.Literals([\"provider.use\"])\n\nexport const Event = {\n ModelUpdated: EventV2.define({\n type: \"catalog.model.updated\",\n schema: {\n model: ModelV2.Info,\n },\n }),\n}\n\ntype Data = {\n providers: Map<ProviderV2.ID, ProviderRecord>\n defaultModel?: DefaultModel\n}\n\nexport type Editor = {\n provider: {\n list: () => readonly ProviderRecord[]\n get: (providerID: ProviderV2.ID) => ProviderRecord | undefined\n update: (providerID: ProviderV2.ID, fn: (provider: Draft<ProviderV2.Info>) => void) => void\n remove: (providerID: ProviderV2.ID) => void\n }\n model: {\n get: (providerID: ProviderV2.ID, modelID: ModelV2.ID) => ModelV2.Info | undefined\n update: (providerID: ProviderV2.ID, modelID: ModelV2.ID, fn: (model: Draft<ModelV2.Info>) => void) => void\n remove: (providerID: ProviderV2.ID, modelID: ModelV2.ID) => void\n default: {\n get: () => DefaultModel | undefined\n set: (providerID: ProviderV2.ID, modelID: ModelV2.ID) => void\n }\n }\n}\n\nexport interface Interface {\n readonly transform: State.Interface<Data, Editor>[\"transform\"]\n readonly provider: {\n readonly get: (providerID: ProviderV2.ID) => Effect.Effect<ProviderV2.Info, ProviderNotFoundError>\n readonly all: () => Effect.Effect<ProviderV2.Info[]>\n readonly available: () => Effect.Effect<ProviderV2.Info[]>\n }\n readonly model: {\n readonly get: (\n providerID: ProviderV2.ID,\n modelID: ModelV2.ID,\n ) => Effect.Effect<ModelV2.Info, ProviderNotFoundError | ModelNotFoundError>\n readonly all: () => Effect.Effect<ModelV2.Info[]>\n readonly available: () => Effect.Effect<ModelV2.Info[]>\n readonly default: () => Effect.Effect<Option.Option<ModelV2.Info>>\n readonly small: (providerID: ProviderV2.ID) => Effect.Effect<Option.Option<ModelV2.Info>>\n }\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/v2/Catalog\") {}\n\nenableMapSet()\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const location = yield* Location.Service\n const plugin = yield* PluginV2.Service\n const events = yield* EventV2.Service\n const policy = yield* Policy.Service\n const scope = yield* Scope.Scope\n\n const resolve = (model: ModelV2.Info) => {\n const provider = state.get().providers.get(model.providerID)!.provider\n const api =\n model.api.type === \"native\" && !model.api.url && Object.keys(model.api.settings).length === 0\n ? { ...provider.api, id: model.api.id }\n : model.api.type === \"aisdk\" && provider.api.type === \"aisdk\" && !model.api.url\n ? { ...model.api, url: provider.api.url, settings: { ...provider.api.settings, ...model.api.settings } }\n : model.api.type === \"aisdk\" && provider.api.type === \"aisdk\"\n ? { ...model.api, settings: { ...provider.api.settings, ...model.api.settings } }\n : model.api\n const request = {\n ...ModelRequest.merge({ ...provider.request, generation: {}, options: {} }, model.request),\n variant: model.request.variant,\n }\n return new ModelV2.Info({\n ...model,\n api,\n request,\n })\n }\n\n function* getRecord(providerID: ProviderV2.ID) {\n const match = state.get().providers.get(providerID)\n if (!match) return yield* new ProviderNotFoundError({ providerID })\n return match\n }\n\n const normalizeApi = (item: Draft<ProviderV2.Info> | Draft<ModelV2.Info>) => {\n if (typeof item.request.body.baseURL !== \"string\") return\n item.api.url = item.request.body.baseURL\n delete item.request.body.baseURL\n }\n\n const state = State.create<Data, Editor>({\n initial: () => ({ providers: new Map() }),\n editor: (draft) => {\n const result: Editor = {\n provider: {\n list: () => Array.fromIterable(draft.providers.values()) as ProviderRecord[],\n get: (providerID) => draft.providers.get(providerID),\n update: (providerID, fn) => {\n let current = draft.providers.get(providerID)\n if (!current) {\n current = castDraft({\n provider: ProviderV2.Info.empty(providerID),\n models: new Map<ModelV2.ID, ModelV2.Info>(),\n })\n draft.providers.set(providerID, current)\n }\n fn(current.provider)\n normalizeApi(current.provider)\n },\n remove: (providerID) => {\n draft.providers.delete(providerID)\n },\n },\n model: {\n get: (providerID, modelID) => draft.providers.get(providerID)?.models.get(modelID),\n update: (providerID, modelID, fn) => {\n let record = draft.providers.get(providerID)\n if (!record) {\n record = castDraft({\n provider: ProviderV2.Info.empty(providerID),\n models: new Map<ModelV2.ID, ModelV2.Info>(),\n })\n draft.providers.set(providerID, record)\n }\n const model = record.models.get(modelID) ?? castDraft(ModelV2.Info.empty(providerID, modelID))\n if (!record.models.has(modelID)) record.models.set(modelID, model)\n fn(model)\n model.id = modelID\n model.providerID = providerID\n normalizeApi(model)\n },\n remove: (providerID, modelID) => {\n draft.providers.get(providerID)?.models.delete(modelID)\n },\n default: {\n get: () => draft.defaultModel,\n set: (providerID, modelID) => {\n draft.defaultModel = { providerID, modelID }\n },\n },\n },\n }\n return result\n },\n finalize: Effect.fn(\"CatalogV2.finalize\")(function* (catalog, reason) {\n if (reason !== \"plugin.added\") yield* plugin.trigger(\"catalog.transform\", catalog, {}).pipe(Effect.asVoid)\n if (!policy.hasStatements()) return\n for (const record of [...catalog.provider.list()]) {\n if ((yield* policy.evaluate(\"provider.use\", record.provider.id, \"allow\")) === \"deny\") {\n catalog.provider.remove(record.provider.id)\n }\n }\n }),\n })\n const available = (model: ModelV2.Info) =>\n state.get().providers.get(model.providerID)?.provider.enabled !== false && model.enabled\n\n yield* events.subscribe(PluginV2.Event.Added).pipe(\n // Plugin registries are location scoped even though the event bus is process scoped.\n Stream.filter(\n (event) =>\n event.location?.directory === location.directory && event.location.workspaceID === location.workspaceID,\n ),\n Stream.runForEach((event) =>\n state.mutate((catalog) => plugin.triggerFor(event.data.id, \"catalog.transform\", catalog, {}), \"plugin.added\"),\n ),\n Effect.forkIn(scope, { startImmediately: true }),\n )\n\n const result: Interface = {\n transform: state.transform,\n\n provider: {\n get: Effect.fn(\"CatalogV2.provider.get\")(function* (providerID) {\n const record = yield* getRecord(providerID)\n return record.provider\n }),\n\n all: Effect.fn(\"CatalogV2.provider.all\")(function* () {\n return Array.fromIterable(state.get().providers.values()).map((record) => record.provider)\n }),\n\n available: Effect.fn(\"CatalogV2.provider.available\")(function* () {\n return Array.fromIterable(state.get().providers.values())\n .map((record) => record.provider)\n .filter((provider) => provider.enabled)\n }),\n },\n\n model: {\n get: Effect.fn(\"CatalogV2.model.get\")(function* (providerID, modelID) {\n const record = yield* getRecord(providerID)\n const model = record.models.get(modelID)\n if (!model) return yield* new ModelNotFoundError({ providerID, modelID })\n return resolve(model)\n }),\n\n all: Effect.fn(\"CatalogV2.model.all\")(function* () {\n return pipe(\n Array.fromIterable(state.get().providers.values()),\n Array.flatMap((record) => Array.fromIterable(record.models.values())),\n Array.map(resolve),\n Array.sortWith((item) => item.time.released.epochMilliseconds, Order.flip(Order.Number)),\n )\n }),\n\n available: Effect.fn(\"CatalogV2.model.available\")(function* () {\n return (yield* result.model.all()).filter(available)\n }),\n\n default: Effect.fn(\"CatalogV2.model.default\")(function* () {\n const defaultModel = state.get().defaultModel\n if (defaultModel) {\n const provider = state.get().providers.get(defaultModel.providerID)?.provider\n if (provider?.enabled !== false) {\n const model = yield* result.model.get(defaultModel.providerID, defaultModel.modelID).pipe(Effect.option)\n if (Option.isSome(model) && available(model.value)) return model\n }\n }\n\n return pipe(\n yield* result.model.available(),\n Array.sortWith((item) => item.time.released.epochMilliseconds, Order.flip(Order.Number)),\n Array.head,\n )\n }),\n\n small: Effect.fn(\"CatalogV2.model.small\")(function* (providerID) {\n const record = state.get().providers.get(providerID)\n if (!record) return Option.none<ModelV2.Info>()\n\n if (providerID === ProviderV2.ID.opencode) {\n const gpt5Nano = record.models.get(ModelV2.ID.make(\"gpt-5-nano\"))\n if (gpt5Nano?.enabled && gpt5Nano.status === \"active\") return Option.some(resolve(gpt5Nano))\n }\n\n const candidates = pipe(\n Array.fromIterable(record.models.values()),\n Array.filter(\n (model) =>\n model.providerID === providerID &&\n model.enabled &&\n model.status === \"active\" &&\n model.capabilities.input.some((item) => item.startsWith(\"text\")) &&\n model.capabilities.output.some((item) => item.startsWith(\"text\")),\n ),\n Array.map((model) => ({\n model,\n cost: model.cost[0] ? model.cost[0].input + model.cost[0].output : 999,\n age: (Date.now() - model.time.released.epochMilliseconds) / (1000 * 60 * 60 * 24 * 30),\n small: SMALL_MODEL_RE.test(`${model.id} ${model.family ?? \"\"} ${model.name}`.toLowerCase()),\n })),\n Array.filter((item) => item.cost > 0 && item.age <= 18),\n )\n\n const pick = (items: typeof candidates) => {\n const maxCost = Math.max(...items.map((item) => item.cost), 0.01)\n const maxAge = Math.max(...items.map((item) => item.age), 0.01)\n return pipe(\n items,\n Array.sortWith((item) => (item.cost / maxCost) * 0.8 + (item.age / maxAge) * 0.2, Order.Number),\n Array.map((item) => resolve(item.model)),\n Array.head,\n )\n }\n\n return pipe(\n candidates,\n Array.filter((item) => item.small),\n (items) => (items.length > 0 ? pick(items) : pick(candidates)),\n )\n }),\n },\n }\n\n return Service.of(result)\n }),\n)\n\nconst SMALL_MODEL_RE = /\\b(nano|flash|lite|mini|haiku|small|fast)\\b/\n\nexport const locationLayer = layer.pipe(\n Layer.provideMerge(PluginV2.locationLayer),\n Layer.provideMerge(Policy.locationLayer),\n)\n",
23
+ "export * as ConfigExperimental from \"./experimental\"\n\nimport { Schema } from \"effect\"\nimport { Catalog } from \"../catalog\"\nimport { Policy as PolicyV2 } from \"../policy\"\n\n// Each core domain exports the policy actions it supports. Adding an action to\n// this union makes it valid in authored config while keeping Policy generic.\nexport const PolicyAction = Schema.Union([Catalog.PolicyActions])\n\nexport class Policy extends Schema.Class<Policy>(\"ConfigV2.Experimental.Policy\")({\n ...PolicyV2.Info.fields,\n action: PolicyAction,\n}) {}\n\nexport class Experimental extends Schema.Class<Experimental>(\"ConfigV2.Experimental\")({\n policies: Policy.pipe(Schema.Array, Schema.optional),\n}) {}\n",
24
+ "export * as ConfigFormatter from \"./formatter\"\n\nimport { Schema } from \"effect\"\n\nexport class Entry extends Schema.Class<Entry>(\"ConfigV2.Formatter.Entry\")({\n disabled: Schema.Boolean.pipe(Schema.optional),\n command: Schema.String.pipe(Schema.Array, Schema.optional),\n environment: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional),\n extensions: Schema.String.pipe(Schema.Array, Schema.optional),\n}) {}\n\nexport const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])\n",
25
+ "export * as ConfigLSP from \"./lsp\"\n\nimport { Schema } from \"effect\"\n\nexport const Disabled = Schema.Struct({\n disabled: Schema.Literal(true),\n})\n\nexport class Server extends Schema.Class<Server>(\"ConfigV2.LSP.Server\")({\n command: Schema.String.pipe(Schema.Array),\n extensions: Schema.String.pipe(Schema.Array, Schema.optional),\n disabled: Schema.Boolean.pipe(Schema.optional),\n env: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional),\n initialization: Schema.Record(Schema.String, Schema.Unknown).pipe(Schema.optional),\n}) {}\n\nexport const Entry = Schema.Union([Disabled, Server])\nexport const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])\n",
26
+ "export * as ConfigMCP from \"./mcp\"\n\nimport { Schema } from \"effect\"\nimport { PositiveInt } from \"../schema\"\n\nexport class Local extends Schema.Class<Local>(\"ConfigV2.MCP.Local\")({\n type: Schema.Literal(\"local\"),\n command: Schema.String.pipe(Schema.Array),\n environment: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional),\n disabled: Schema.Boolean.pipe(Schema.optional),\n timeout: PositiveInt.pipe(Schema.optional),\n}) {}\n\nexport class OAuth extends Schema.Class<OAuth>(\"ConfigV2.MCP.OAuth\")({\n client_id: Schema.String.pipe(Schema.optional),\n client_secret: Schema.String.pipe(Schema.optional),\n scope: Schema.String.pipe(Schema.optional),\n callback_port: Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65535 })).pipe(Schema.optional),\n redirect_uri: Schema.String.pipe(Schema.optional),\n}) {}\n\nexport class Remote extends Schema.Class<Remote>(\"ConfigV2.MCP.Remote\")({\n type: Schema.Literal(\"remote\"),\n url: Schema.String,\n headers: Schema.Record(Schema.String, Schema.String).pipe(Schema.optional),\n oauth: Schema.Union([OAuth, Schema.Literal(false)]).pipe(Schema.optional),\n disabled: Schema.Boolean.pipe(Schema.optional),\n timeout: PositiveInt.pipe(Schema.optional),\n}) {}\n\nexport const Server = Schema.Union([Local, Remote]).pipe(Schema.toTaggedUnion(\"type\"))\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.MCP\")({\n timeout: PositiveInt.pipe(Schema.optional),\n servers: Schema.Record(Schema.String, Server).pipe(Schema.optional),\n}) {}\n",
27
+ "export * as ConfigPlugin from \"./plugin\"\n\nimport { Schema } from \"effect\"\n\nexport class Entry extends Schema.Class<Entry>(\"ConfigV2.Plugin.Entry\")({\n package: Schema.String,\n options: Schema.Record(Schema.String, Schema.Unknown).pipe(Schema.optional),\n}) {}\n\nexport const Plugin = Schema.Union([Schema.String, Entry])\nexport type Plugin = typeof Plugin.Type\n\nexport const Plugins = Plugin.pipe(Schema.Array)\n",
28
+ "export * as ConfigReference from \"./reference\"\n\nimport { Schema } from \"effect\"\n\nexport class Git extends Schema.Class<Git>(\"ConfigV2.Reference.Git\")({\n repository: Schema.String,\n branch: Schema.String.pipe(Schema.optional),\n}) {}\n\nexport class Local extends Schema.Class<Local>(\"ConfigV2.Reference.Local\")({\n path: Schema.String,\n}) {}\n\nexport const Entry = Schema.Union([Schema.String, Git, Local])\nexport type Entry = typeof Entry.Type\n\nexport const Info = Schema.Record(Schema.String, Entry)\nexport type Info = typeof Info.Type\n\nexport type NormalizedEntry =\n | { readonly kind: \"local\"; readonly path: string }\n | { readonly kind: \"git\"; readonly repository: string; readonly branch?: string }\n | { readonly kind: \"invalid\"; readonly message: string }\n\nexport type NormalizedInfo = Record<string, NormalizedEntry>\n\nexport function validateAlias(name: string) {\n if (name.length === 0) return \"Reference alias must not be empty\"\n if (/[\\/\\s`,]/.test(name)) return \"Reference alias must not contain /, whitespace, comma, or backtick\"\n}\n\nexport function normalizeEntry(entry: Entry): NormalizedEntry {\n if (typeof entry === \"string\") {\n if (entry.startsWith(\".\") || entry.startsWith(\"/\") || entry.startsWith(\"~\")) return { kind: \"local\", path: entry }\n return { kind: \"git\", repository: entry }\n }\n if (\"path\" in entry) return { kind: \"local\", path: entry.path }\n return { kind: \"git\", repository: entry.repository, branch: entry.branch }\n}\n\nexport function normalize(info: Info): NormalizedInfo {\n return Object.fromEntries(\n Object.entries(info).map(([name, entry]) => {\n const message = validateAlias(name)\n return [name, message ? { kind: \"invalid\" as const, message } : normalizeEntry(entry)]\n }),\n )\n}\n",
29
+ "export * as ConfigToolOutput from \"./tool-output\"\n\nimport { Schema } from \"effect\"\nimport { PositiveInt } from \"../schema\"\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.ToolOutput\")({\n max_lines: PositiveInt.pipe(Schema.optional),\n max_bytes: PositiveInt.pipe(Schema.optional),\n}) {}\n",
30
+ "export * as ConfigWatcher from \"./watcher\"\n\nimport { Schema } from \"effect\"\n\nexport class Info extends Schema.Class<Info>(\"ConfigV2.Watcher\")({\n ignore: Schema.String.pipe(Schema.Array, Schema.optional),\n}) {}\n",
31
+ "export * as ConfigPermissionV1 from \"./permission\"\n\nimport { Schema, SchemaGetter } from \"effect\"\n\nexport const Action = Schema.Literals([\"ask\", \"allow\", \"deny\"]).annotate({ identifier: \"PermissionActionConfig\" })\nexport type Action = Schema.Schema.Type<typeof Action>\n\nexport const Object = Schema.Record(Schema.String, Action).annotate({ identifier: \"PermissionObjectConfig\" })\nexport type Object = Schema.Schema.Type<typeof Object>\n\nexport const Rule = Schema.Union([Action, Object]).annotate({ identifier: \"PermissionRuleConfig\" })\nexport type Rule = Schema.Schema.Type<typeof Rule>\n\n// Known permission keys get explicit types in the Effect schema for generated\n// docs/types. Runtime config parsing uses Effect's `propertyOrder: \"original\"`\n// parse option so user key order is preserved for permission precedence.\nconst InputObject = Schema.StructWithRest(\n Schema.Struct({\n read: Schema.optional(Rule),\n edit: Schema.optional(Rule),\n glob: Schema.optional(Rule),\n grep: Schema.optional(Rule),\n list: Schema.optional(Rule),\n bash: Schema.optional(Rule),\n task: Schema.optional(Rule),\n external_directory: Schema.optional(Rule),\n todowrite: Schema.optional(Action),\n question: Schema.optional(Action),\n webfetch: Schema.optional(Action),\n websearch: Schema.optional(Action),\n lsp: Schema.optional(Rule),\n doom_loop: Schema.optional(Action),\n skill: Schema.optional(Rule),\n }),\n [Schema.Record(Schema.String, Rule)],\n)\n\nconst InputSchema = Schema.Union([Action, InputObject])\n\nconst normalizeInput = (input: Schema.Schema.Type<typeof InputSchema>): Schema.Schema.Type<typeof InputObject> =>\n typeof input === \"string\" ? { \"*\": input } : input\n\nexport const Info = InputSchema.pipe(\n Schema.decodeTo(InputObject, {\n decode: SchemaGetter.transform(normalizeInput),\n encode: SchemaGetter.passthrough({ strict: false }),\n }),\n).annotate({ identifier: \"PermissionConfig\" })\ntype _Info = Schema.Schema.Type<typeof InputObject>\nexport type Info = { -readonly [K in keyof _Info]: _Info[K] }\n",
32
+ "export * as ConfigAgentV1 from \"./agent\"\n\nimport { Schema, SchemaGetter } from \"effect\"\nimport { PositiveInt } from \"../../schema\"\nimport { ConfigPermissionV1 } from \"./permission\"\n\nconst Color = Schema.Union([\n Schema.String.check(Schema.isPattern(/^#[0-9a-fA-F]{6}$/)),\n Schema.Literals([\"primary\", \"secondary\", \"accent\", \"success\", \"warning\", \"error\", \"info\"]),\n])\n\nconst AgentSchema = Schema.StructWithRest(\n Schema.Struct({\n model: Schema.optional(Schema.String),\n variant: Schema.optional(Schema.String).annotate({\n description: \"Default model variant for this agent (applies only when using the agent's configured model).\",\n }),\n temperature: Schema.optional(Schema.Finite),\n top_p: Schema.optional(Schema.Finite),\n prompt: Schema.optional(Schema.String),\n tools: Schema.optional(Schema.Record(Schema.String, Schema.Boolean)).annotate({\n description: \"@deprecated Use 'permission' field instead\",\n }),\n disable: Schema.optional(Schema.Boolean),\n description: Schema.optional(Schema.String).annotate({ description: \"Description of when to use the agent\" }),\n mode: Schema.optional(Schema.Literals([\"subagent\", \"primary\", \"all\"])),\n hidden: Schema.optional(Schema.Boolean).annotate({\n description: \"Hide this subagent from the @ autocomplete menu (default: false, only applies to mode: subagent)\",\n }),\n options: Schema.optional(Schema.Record(Schema.String, Schema.Any)),\n color: Schema.optional(Color).annotate({\n description: \"Hex color code (e.g., #FF5733) or theme color (e.g., primary)\",\n }),\n steps: Schema.optional(PositiveInt).annotate({\n description: \"Maximum number of agentic iterations before forcing text-only response\",\n }),\n maxSteps: Schema.optional(PositiveInt).annotate({ description: \"@deprecated Use 'steps' field instead.\" }),\n permission: Schema.optional(ConfigPermissionV1.Info),\n }),\n [Schema.Record(Schema.String, Schema.Any)],\n)\n\nconst KNOWN_KEYS = new Set([\n \"name\",\n \"model\",\n \"variant\",\n \"prompt\",\n \"description\",\n \"temperature\",\n \"top_p\",\n \"mode\",\n \"hidden\",\n \"color\",\n \"steps\",\n \"maxSteps\",\n \"options\",\n \"permission\",\n \"disable\",\n \"tools\",\n])\n\nconst normalize = (agent: Schema.Schema.Type<typeof AgentSchema>): Schema.Schema.Type<typeof AgentSchema> => {\n const options: Record<string, unknown> = { ...agent.options }\n for (const [key, value] of Object.entries(agent)) {\n if (!KNOWN_KEYS.has(key)) options[key] = value\n }\n\n const permission: ConfigPermissionV1.Info = {}\n for (const [tool, enabled] of Object.entries(agent.tools ?? {})) {\n const action = enabled ? \"allow\" : \"deny\"\n if (tool === \"write\" || tool === \"edit\" || tool === \"patch\") {\n permission.edit = action\n continue\n }\n permission[tool] = action\n }\n globalThis.Object.assign(permission, agent.permission)\n\n const steps = agent.steps ?? agent.maxSteps\n return { ...agent, options, permission, ...(steps !== undefined ? { steps } : {}) }\n}\n\nexport const Info = AgentSchema.pipe(\n Schema.decodeTo(AgentSchema, {\n decode: SchemaGetter.transform(normalize),\n encode: SchemaGetter.passthrough({ strict: false }),\n }),\n).annotate({ identifier: \"AgentConfig\" })\nexport type Info = Schema.Schema.Type<typeof Info>\n",
33
+ "export * as ConfigAttachmentV1 from \"./attachment\"\n\nimport { Schema } from \"effect\"\nimport { PositiveInt } from \"../../schema\"\n\nexport const Image = Schema.Struct({\n auto_resize: Schema.optional(Schema.Boolean).annotate({\n description: \"Resize images before sending them to the model when they exceed configured limits (default: true)\",\n }),\n max_width: Schema.optional(PositiveInt).annotate({\n description: \"Maximum image width before resizing or rejecting the attachment (default: 2000)\",\n }),\n max_height: Schema.optional(PositiveInt).annotate({\n description: \"Maximum image height before resizing or rejecting the attachment (default: 2000)\",\n }),\n max_base64_bytes: Schema.optional(PositiveInt).annotate({\n description: \"Maximum base64 payload bytes for an image attachment (default: 5242880)\",\n }),\n}).annotate({ identifier: \"ImageAttachmentConfig\" })\nexport type Image = Schema.Schema.Type<typeof Image>\n\nexport const Info = Schema.Struct({\n image: Schema.optional(Image).annotate({ description: \"Image attachment configuration\" }),\n}).annotate({ identifier: \"AttachmentConfig\" })\nexport type Info = Schema.Schema.Type<typeof Info>\n",
34
+ "export * as ConfigCommandV1 from \"./command\"\n\nimport { Schema } from \"effect\"\n\nexport const Info = Schema.Struct({\n template: Schema.String,\n description: Schema.optional(Schema.String),\n agent: Schema.optional(Schema.String),\n model: Schema.optional(Schema.String),\n variant: Schema.optional(Schema.String),\n subtask: Schema.optional(Schema.Boolean),\n})\nexport type Info = Schema.Schema.Type<typeof Info>\n",
35
+ "export * as ConfigFormatterV1 from \"./formatter\"\n\nimport { Schema } from \"effect\"\n\nexport const Entry = Schema.Struct({\n disabled: Schema.optional(Schema.Boolean),\n command: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),\n environment: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n extensions: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),\n})\n\nexport const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])\nexport type Info = Schema.Schema.Type<typeof Info>\n",
36
+ "export * as ConfigLayoutV1 from \"./layout\"\n\nimport { Schema } from \"effect\"\n\nexport const Layout = Schema.Literals([\"auto\", \"stretch\"]).annotate({ identifier: \"LayoutConfig\" })\nexport type Layout = Schema.Schema.Type<typeof Layout>\n",
37
+ "export * as ConfigLSPV1 from \"./lsp\"\n\nimport { Schema } from \"effect\"\n\nexport const Disabled = Schema.Struct({\n disabled: Schema.Literal(true),\n}).pipe((schema) => schema)\n\nexport const Entry = Schema.Union([\n Disabled,\n Schema.Struct({\n command: Schema.mutable(Schema.Array(Schema.String)),\n extensions: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),\n disabled: Schema.optional(Schema.Boolean),\n env: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n initialization: Schema.optional(Schema.Record(Schema.String, Schema.Unknown)),\n }),\n]).pipe((schema) => schema)\n\n// Keep this list aligned with the builtin servers in opencode's LSP runtime.\n// Custom servers must declare extensions because the runtime cannot infer them.\nexport const builtinServerIds = [\n \"deno\",\n \"typescript\",\n \"vue\",\n \"eslint\",\n \"oxlint\",\n \"biome\",\n \"gopls\",\n \"ruby-lsp\",\n \"ty\",\n \"pyright\",\n \"elixir-ls\",\n \"zls\",\n \"csharp\",\n \"razor\",\n \"fsharp\",\n \"sourcekit-lsp\",\n \"rust\",\n \"clangd\",\n \"svelte\",\n \"astro\",\n \"jdtls\",\n \"kotlin-ls\",\n \"yaml-ls\",\n \"lua-ls\",\n \"php intelephense\",\n \"prisma\",\n \"dart\",\n \"ocaml-lsp\",\n \"bash\",\n \"terraform\",\n \"texlab\",\n \"dockerfile\",\n \"gleam\",\n \"clojure-lsp\",\n \"nixd\",\n \"tinymist\",\n \"haskell-language-server\",\n \"julials\",\n]\n\nexport const requiresExtensionsForCustomServers = Schema.makeFilter<\n boolean | Record<string, Schema.Schema.Type<typeof Entry>>\n>((data) => {\n if (typeof data === \"boolean\") return undefined\n const ids = new Set(builtinServerIds)\n const ok = Object.entries(data).every(([id, config]) => {\n if (\"disabled\" in config && config.disabled) return true\n if (ids.has(id)) return true\n return \"extensions\" in config && Boolean(config.extensions)\n })\n return ok ? undefined : \"For custom LSP servers, 'extensions' array is required.\"\n})\n\nexport const Info = Schema.Union([Schema.Boolean, Schema.Record(Schema.String, Entry)])\n .check(requiresExtensionsForCustomServers)\n .pipe((schema) => schema)\n\nexport type Info = Schema.Schema.Type<typeof Info>\n",
38
+ "export * as ConfigMCPV1 from \"./mcp\"\n\nimport { Schema } from \"effect\"\nimport { PositiveInt } from \"../../schema\"\n\nexport const Local = Schema.Struct({\n type: Schema.Literal(\"local\").annotate({ description: \"Type of MCP server connection\" }),\n command: Schema.mutable(Schema.Array(Schema.String)).annotate({\n description: \"Command and arguments to run the MCP server\",\n }),\n environment: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({\n description: \"Environment variables to set when running the MCP server\",\n }),\n enabled: Schema.optional(Schema.Boolean).annotate({\n description: \"Enable or disable the MCP server on startup\",\n }),\n timeout: Schema.optional(PositiveInt).annotate({\n description: \"Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified.\",\n }),\n}).annotate({ identifier: \"McpLocalConfig\" })\nexport type Local = Schema.Schema.Type<typeof Local>\n\nexport const OAuth = Schema.Struct({\n clientId: Schema.optional(Schema.String).annotate({\n description: \"OAuth client ID. If not provided, dynamic client registration (RFC 7591) will be attempted.\",\n }),\n clientSecret: Schema.optional(Schema.String).annotate({\n description: \"OAuth client secret (if required by the authorization server)\",\n }),\n scope: Schema.optional(Schema.String).annotate({ description: \"OAuth scopes to request during authorization\" }),\n callbackPort: Schema.optional(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 65535 }))).annotate({\n description:\n \"Port for the local OAuth callback server (default: 19876). Shorthand for redirectUri when only the port needs changing. Ignored if redirectUri is set.\",\n }),\n redirectUri: Schema.optional(Schema.String).annotate({\n description: \"OAuth redirect URI (default: http://127.0.0.1:19876/mcp/oauth/callback).\",\n }),\n}).annotate({ identifier: \"McpOAuthConfig\" })\nexport type OAuth = Schema.Schema.Type<typeof OAuth>\n\nexport const Remote = Schema.Struct({\n type: Schema.Literal(\"remote\").annotate({ description: \"Type of MCP server connection\" }),\n url: Schema.String.annotate({ description: \"URL of the remote MCP server\" }),\n enabled: Schema.optional(Schema.Boolean).annotate({\n description: \"Enable or disable the MCP server on startup\",\n }),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)).annotate({\n description: \"Headers to send with the request\",\n }),\n oauth: Schema.optional(Schema.Union([OAuth, Schema.Literal(false)])).annotate({\n description: \"OAuth authentication configuration for the MCP server. Set to false to disable OAuth auto-detection.\",\n }),\n timeout: Schema.optional(PositiveInt).annotate({\n description: \"Timeout in ms for MCP server requests. Defaults to 5000 (5 seconds) if not specified.\",\n }),\n}).annotate({ identifier: \"McpRemoteConfig\" })\nexport type Remote = Schema.Schema.Type<typeof Remote>\n\nexport const Info = Schema.Union([Local, Remote]).annotate({ discriminator: \"type\" })\nexport type Info = Schema.Schema.Type<typeof Info>\n",
39
+ "export * as ConfigPluginV1 from \"./plugin\"\n\nimport { Schema } from \"effect\"\n\nexport const Options = Schema.Record(Schema.String, Schema.Unknown)\nexport type Options = Schema.Schema.Type<typeof Options>\n\nexport const Spec = Schema.Union([Schema.String, Schema.mutable(Schema.Tuple([Schema.String, Options]))])\nexport type Spec = Schema.Schema.Type<typeof Spec>\n",
40
+ "export * as ConfigProviderV1 from \"./provider\"\n\nimport { Schema } from \"effect\"\nimport { PositiveInt } from \"../../schema\"\n\nexport const ModelStatus = Schema.Literals([\"alpha\", \"beta\", \"deprecated\", \"active\"])\n\nexport const Model = Schema.Struct({\n id: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n family: Schema.optional(Schema.String),\n release_date: Schema.optional(Schema.String),\n attachment: Schema.optional(Schema.Boolean),\n reasoning: Schema.optional(Schema.Boolean),\n temperature: Schema.optional(Schema.Boolean),\n tool_call: Schema.optional(Schema.Boolean),\n interleaved: Schema.optional(\n Schema.Union([\n Schema.Literal(true),\n Schema.Struct({\n field: Schema.Literals([\"reasoning_content\", \"reasoning_details\"]),\n }),\n ]),\n ),\n cost: Schema.optional(\n Schema.Struct({\n input: Schema.Finite,\n output: Schema.Finite,\n cache_read: Schema.optional(Schema.Finite),\n cache_write: Schema.optional(Schema.Finite),\n context_over_200k: Schema.optional(\n Schema.Struct({\n input: Schema.Finite,\n output: Schema.Finite,\n cache_read: Schema.optional(Schema.Finite),\n cache_write: Schema.optional(Schema.Finite),\n }),\n ),\n }),\n ),\n limit: Schema.optional(\n Schema.Struct({\n context: Schema.Finite,\n input: Schema.optional(Schema.Finite),\n output: Schema.Finite,\n }),\n ),\n modalities: Schema.optional(\n Schema.Struct({\n input: Schema.optional(Schema.mutable(Schema.Array(Schema.Literals([\"text\", \"audio\", \"image\", \"video\", \"pdf\"])))),\n output: Schema.optional(\n Schema.mutable(Schema.Array(Schema.Literals([\"text\", \"audio\", \"image\", \"video\", \"pdf\"]))),\n ),\n }),\n ),\n experimental: Schema.optional(Schema.Boolean),\n status: Schema.optional(ModelStatus),\n provider: Schema.optional(\n Schema.Struct({ npm: Schema.optional(Schema.String), api: Schema.optional(Schema.String) }),\n ),\n options: Schema.optional(Schema.Record(Schema.String, Schema.Any)),\n headers: Schema.optional(Schema.Record(Schema.String, Schema.String)),\n variants: Schema.optional(\n Schema.Record(\n Schema.String,\n Schema.StructWithRest(\n Schema.Struct({\n disabled: Schema.optional(Schema.Boolean).annotate({ description: \"Disable this variant for the model\" }),\n }),\n [Schema.Record(Schema.String, Schema.Any)],\n ),\n ).annotate({ description: \"Variant-specific configuration\" }),\n ),\n})\n\nexport const Info = Schema.Struct({\n api: Schema.optional(Schema.String),\n name: Schema.optional(Schema.String),\n env: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),\n id: Schema.optional(Schema.String),\n npm: Schema.optional(Schema.String),\n whitelist: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),\n blacklist: Schema.optional(Schema.mutable(Schema.Array(Schema.String))),\n options: Schema.optional(\n Schema.StructWithRest(\n Schema.Struct({\n apiKey: Schema.optional(Schema.String),\n baseURL: Schema.optional(Schema.String),\n enterpriseUrl: Schema.optional(Schema.String).annotate({\n description: \"GitHub Enterprise URL for copilot authentication\",\n }),\n setCacheKey: Schema.optional(Schema.Boolean).annotate({\n description: \"Enable promptCacheKey for this provider (default false)\",\n }),\n timeout: Schema.optional(\n Schema.Union([PositiveInt, Schema.Literal(false)]).annotate({\n description: \"Timeout in milliseconds for full requests to this provider. Set to false to disable timeout.\",\n }),\n ).annotate({\n description: \"Timeout in milliseconds for full requests to this provider. Set to false to disable timeout.\",\n }),\n headerTimeout: Schema.optional(\n Schema.Union([PositiveInt, Schema.Literal(false)]).annotate({\n description:\n \"Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout.\",\n }),\n ).annotate({\n description:\n \"Timeout in milliseconds to wait for response headers. Provider integrations may set defaults. Set to false to disable timeout.\",\n }),\n chunkTimeout: Schema.optional(PositiveInt).annotate({\n description:\n \"Timeout in milliseconds between streamed SSE chunks for this provider. If no chunk arrives within this window, the request is aborted.\",\n }),\n }),\n [Schema.Record(Schema.String, Schema.Any)],\n ),\n ),\n models: Schema.optional(Schema.Record(Schema.String, Model)),\n}).annotate({ identifier: \"ProviderConfig\" })\nexport type Info = Schema.Schema.Type<typeof Info>\n",
41
+ "export * as ConfigReferenceV1 from \"./reference\"\n\nimport { Schema } from \"effect\"\n\nconst Git = Schema.Struct({\n repository: Schema.String.annotate({\n description: \"Git repository URL, host/path reference, or GitHub owner/repo shorthand\",\n }),\n branch: Schema.optional(Schema.String).annotate({\n description: \"Branch or ref to clone and inspect\",\n }),\n})\n\nconst Local = Schema.Struct({\n path: Schema.String.annotate({\n description: \"Absolute path, ~/ path, or workspace-relative path to a local reference directory\",\n }),\n})\n\nexport const Entry = Schema.Union([Schema.String, Git, Local]).annotate({ identifier: \"ReferenceConfigEntry\" })\nexport type Entry = Schema.Schema.Type<typeof Entry>\n\nexport const Info = Schema.Record(Schema.String, Entry).annotate({ identifier: \"ReferenceConfig\" })\nexport type Info = Schema.Schema.Type<typeof Info>\n",
42
+ "export * as ConfigServerV1 from \"./server\"\n\nimport { Schema } from \"effect\"\nimport { PositiveInt } from \"../../schema\"\n\nexport const Server = Schema.Struct({\n port: Schema.optional(PositiveInt).annotate({\n description: \"Port to listen on\",\n }),\n hostname: Schema.optional(Schema.String).annotate({ description: \"Hostname to listen on\" }),\n mdns: Schema.optional(Schema.Boolean).annotate({ description: \"Enable mDNS service discovery\" }),\n mdnsDomain: Schema.optional(Schema.String).annotate({\n description: \"Custom domain name for mDNS service (default: opencode.local)\",\n }),\n cors: Schema.optional(Schema.mutable(Schema.Array(Schema.String))).annotate({\n description: \"Additional domains to allow for CORS\",\n }),\n}).annotate({ identifier: \"ServerConfig\" })\nexport type Server = Schema.Schema.Type<typeof Server>\n",
43
+ "export * as ConfigSkillsV1 from \"./skills\"\n\nimport { Schema } from \"effect\"\n\nexport const Info = Schema.Struct({\n paths: Schema.optional(Schema.Array(Schema.String)).annotate({\n description: \"Additional paths to skill folders\",\n }),\n urls: Schema.optional(Schema.Array(Schema.String)).annotate({\n description: \"URLs to fetch skills from (e.g., https://example.com/.well-known/skills/)\",\n }),\n})\nexport type Info = Schema.Schema.Type<typeof Info>\n",
44
+ "export * as ConfigV1 from \"./config\"\n\nimport { Schema } from \"effect\"\nimport { NonNegativeInt, PositiveInt, type DeepMutable } from \"../../schema\"\nimport { ConfigExperimental } from \"../../config/experimental\"\nimport { ConfigAgentV1 } from \"./agent\"\nimport { ConfigAttachmentV1 } from \"./attachment\"\nimport { ConfigCommandV1 } from \"./command\"\nimport { ConfigFormatterV1 } from \"./formatter\"\nimport { ConfigLayoutV1 } from \"./layout\"\nimport { ConfigLSPV1 } from \"./lsp\"\nimport { ConfigMCPV1 } from \"./mcp\"\nimport { ConfigPermissionV1 } from \"./permission\"\nimport { ConfigPluginV1 } from \"./plugin\"\nimport { ConfigProviderV1 } from \"./provider\"\nimport { ConfigReferenceV1 } from \"./reference\"\nimport { ConfigServerV1 } from \"./server\"\nimport { ConfigSkillsV1 } from \"./skills\"\n\nexport type Layout = ConfigLayoutV1.Layout\n\nexport const WellKnown = Schema.Struct({\n config: Schema.optional(Schema.Json),\n remote_config: Schema.optional(Schema.Json),\n})\n\nconst LogLevelRef = Schema.Literals([\"DEBUG\", \"INFO\", \"WARN\", \"ERROR\"]).annotate({\n identifier: \"LogLevel\",\n description: \"Log level\",\n})\n\nexport const Info = Schema.Struct({\n $schema: Schema.optional(Schema.String).annotate({\n description: \"JSON schema reference for configuration validation\",\n }),\n shell: Schema.optional(Schema.String).annotate({ description: \"Default shell to use for terminal and bash tool\" }),\n logLevel: Schema.optional(LogLevelRef).annotate({ description: \"Log level\" }),\n server: Schema.optional(ConfigServerV1.Server).annotate({\n description: \"Server configuration for opencode serve and web commands\",\n }),\n command: Schema.optional(Schema.Record(Schema.String, ConfigCommandV1.Info)).annotate({\n description: \"Command configuration, see https://opencode.ai/docs/commands\",\n }),\n skills: Schema.optional(ConfigSkillsV1.Info).annotate({ description: \"Additional skill folder paths\" }),\n reference: Schema.optional(ConfigReferenceV1.Info).annotate({\n description: \"Named git or local directory references that can be mentioned as @alias or @alias/path\",\n }),\n watcher: Schema.optional(Schema.Struct({ ignore: Schema.optional(Schema.mutable(Schema.Array(Schema.String))) })),\n snapshot: Schema.optional(Schema.Boolean).annotate({\n description:\n \"Enable or disable snapshot tracking. When false, filesystem snapshots are not recorded and undoing or reverting will not undo/redo file changes. Defaults to true.\",\n }),\n plugin: Schema.optional(Schema.mutable(Schema.Array(ConfigPluginV1.Spec))),\n share: Schema.optional(Schema.Literals([\"manual\", \"auto\", \"disabled\"])).annotate({\n description:\n \"Control sharing behavior:'manual' allows manual sharing via commands, 'auto' enables automatic sharing, 'disabled' disables all sharing\",\n }),\n autoshare: Schema.optional(Schema.Boolean).annotate({\n description: \"@deprecated Use 'share' field instead. Share newly created sessions automatically\",\n }),\n autoupdate: Schema.optional(Schema.Union([Schema.Boolean, Schema.Literal(\"notify\")])).annotate({\n description:\n \"Automatically update to the latest version. Set to true to auto-update, false to disable, or 'notify' to show update notifications\",\n }),\n disabled_providers: Schema.optional(Schema.mutable(Schema.Array(Schema.String))).annotate({\n description: \"Disable providers that are loaded automatically\",\n }),\n enabled_providers: Schema.optional(Schema.mutable(Schema.Array(Schema.String))).annotate({\n description: \"When set, ONLY these providers will be enabled. All other providers will be ignored\",\n }),\n model: Schema.optional(Schema.String).annotate({\n description: \"Model to use in the format of provider/model, eg anthropic/claude-2\",\n }),\n small_model: Schema.optional(Schema.String).annotate({\n description: \"Small model to use for tasks like title generation in the format of provider/model\",\n }),\n default_agent: Schema.optional(Schema.String).annotate({\n description:\n \"Default agent to use when none is specified. Must be a primary agent. Falls back to 'build' if not set or if the specified agent is invalid.\",\n }),\n username: Schema.optional(Schema.String).annotate({\n description: \"Custom username to display in conversations instead of system username\",\n }),\n mode: Schema.optional(\n Schema.StructWithRest(\n Schema.Struct({ build: Schema.optional(ConfigAgentV1.Info), plan: Schema.optional(ConfigAgentV1.Info) }),\n [Schema.Record(Schema.String, ConfigAgentV1.Info)],\n ),\n ).annotate({ description: \"@deprecated Use `agent` field instead.\" }),\n agent: Schema.optional(\n Schema.StructWithRest(\n Schema.Struct({\n plan: Schema.optional(ConfigAgentV1.Info),\n build: Schema.optional(ConfigAgentV1.Info),\n general: Schema.optional(ConfigAgentV1.Info),\n explore: Schema.optional(ConfigAgentV1.Info),\n title: Schema.optional(ConfigAgentV1.Info),\n summary: Schema.optional(ConfigAgentV1.Info),\n compaction: Schema.optional(ConfigAgentV1.Info),\n }),\n [Schema.Record(Schema.String, ConfigAgentV1.Info)],\n ),\n ).annotate({ description: \"Agent configuration, see https://opencode.ai/docs/agents\" }),\n provider: Schema.optional(Schema.Record(Schema.String, ConfigProviderV1.Info)).annotate({\n description: \"Custom provider configurations and model overrides\",\n }),\n mcp: Schema.optional(\n Schema.Record(Schema.String, Schema.Union([ConfigMCPV1.Info, Schema.Struct({ enabled: Schema.Boolean })])),\n ).annotate({ description: \"MCP (Model Context Protocol) server configurations\" }),\n formatter: Schema.optional(ConfigFormatterV1.Info).annotate({\n description:\n \"Enable or configure formatters. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides.\",\n }),\n lsp: Schema.optional(ConfigLSPV1.Info).annotate({\n description:\n \"Enable or configure LSP servers. Omit or set to false to disable, true to enable built-ins, or an object to enable built-ins with overrides.\",\n }),\n instructions: Schema.optional(Schema.mutable(Schema.Array(Schema.String))).annotate({\n description: \"Additional instruction files or patterns to include\",\n }),\n layout: Schema.optional(ConfigLayoutV1.Layout).annotate({ description: \"@deprecated Always uses stretch layout.\" }),\n permission: Schema.optional(ConfigPermissionV1.Info),\n tools: Schema.optional(Schema.Record(Schema.String, Schema.Boolean)),\n attachment: Schema.optional(ConfigAttachmentV1.Info).annotate({\n description: \"Attachment processing configuration, including image size limits and resizing behavior\",\n }),\n enterprise: Schema.optional(\n Schema.Struct({ url: Schema.optional(Schema.String).annotate({ description: \"Enterprise URL\" }) }),\n ),\n tool_output: Schema.optional(\n Schema.Struct({\n max_lines: Schema.optional(PositiveInt).annotate({\n description: \"Maximum lines of tool output before it is truncated and saved to disk (default: 2000)\",\n }),\n max_bytes: Schema.optional(PositiveInt).annotate({\n description: \"Maximum bytes of tool output before it is truncated and saved to disk (default: 51200)\",\n }),\n }),\n ).annotate({\n description:\n \"Thresholds for truncating tool output. When output exceeds either limit, the full text is written to the truncation directory and a preview is returned.\",\n }),\n compaction: Schema.optional(\n Schema.Struct({\n auto: Schema.optional(Schema.Boolean).annotate({\n description: \"Enable automatic compaction when context is full (default: true)\",\n }),\n prune: Schema.optional(Schema.Boolean).annotate({\n description: \"Enable pruning of old tool outputs (default: false)\",\n }),\n tail_turns: Schema.optional(NonNegativeInt).annotate({\n description:\n \"Number of recent user turns, including their following assistant/tool responses, to keep verbatim during compaction (default: 2)\",\n }),\n preserve_recent_tokens: Schema.optional(NonNegativeInt).annotate({\n description: \"Maximum number of tokens from recent turns to preserve verbatim after compaction\",\n }),\n reserved: Schema.optional(NonNegativeInt).annotate({\n description: \"Token buffer for compaction. Leaves enough window to avoid overflow during compaction.\",\n }),\n }),\n ),\n experimental: Schema.optional(\n Schema.Struct({\n disable_paste_summary: Schema.optional(Schema.Boolean),\n batch_tool: Schema.optional(Schema.Boolean).annotate({ description: \"Enable the batch tool\" }),\n openTelemetry: Schema.optional(Schema.Boolean).annotate({\n description: \"Enable OpenTelemetry spans for AI SDK calls (using the 'experimental_telemetry' flag)\",\n }),\n primary_tools: Schema.optional(Schema.mutable(Schema.Array(Schema.String))).annotate({\n description: \"Tools that should only be available to primary agents.\",\n }),\n continue_loop_on_deny: Schema.optional(Schema.Boolean).annotate({\n description: \"Continue the agent loop when a tool call is denied\",\n }),\n mcp_timeout: Schema.optional(PositiveInt).annotate({\n description: \"Timeout in milliseconds for model context protocol (MCP) requests\",\n }),\n policies: Schema.optional(Schema.mutable(Schema.Array(ConfigExperimental.Policy))).annotate({\n description: \"Policy statements applied to supported resources, such as provider access\",\n }),\n }),\n ),\n}).annotate({ identifier: \"Config\" })\n\nexport type Info = DeepMutable<Schema.Schema.Type<typeof Info>>\n",
45
+ "export * as ConfigProviderOptionsV1 from \"./provider-options\"\n\ntype Options = Readonly<Record<string, unknown>>\n\nexport interface ProviderResult {\n readonly headers?: Record<string, string>\n readonly body?: Record<string, unknown>\n readonly url?: string\n readonly settings?: Record<string, unknown>\n}\n\nexport interface Lowerer {\n readonly provider: (options: Options) => ProviderResult\n readonly request: (options: Options) => Record<string, unknown>\n}\n\nexport function get(packageName?: string): Lowerer {\n const key = packageName ?? \"\"\n return Object.hasOwn(lowerers, key) ? lowerers[key]! : raw\n}\n\nconst raw: Lowerer = {\n provider(options) {\n return { body: clone(options) }\n },\n request: clone,\n}\n\nconst openai: Lowerer = {\n provider(options) {\n return {\n url: string(options.baseURL),\n headers: compact({\n Authorization: bearer(options.apiKey),\n \"OpenAI-Organization\": string(options.organization),\n \"OpenAI-Project\": string(options.project),\n ...headers(options.headers),\n }),\n body: body(options.body),\n settings: omit(options, [\"apiKey\", \"baseURL\", \"organization\", \"project\", \"headers\", \"body\"]),\n }\n },\n request: snake,\n}\n\nconst anthropic: Lowerer = {\n provider(options) {\n return {\n url: string(options.baseURL),\n headers: compact({\n \"x-api-key\": string(options.apiKey),\n Authorization: options.authToken ? bearer(options.authToken) : undefined,\n ...headers(options.headers),\n }),\n body: body(options.body),\n settings: omit(options, [\"apiKey\", \"authToken\", \"baseURL\", \"headers\", \"body\"]),\n }\n },\n request(options) {\n const result = snake(options)\n if (options.effort !== undefined || options.taskBudget !== undefined) {\n result.output_config = compactUnknown({ effort: options.effort, task_budget: options.taskBudget })\n delete result.effort\n delete result.task_budget\n }\n if (isRecord(options.metadata) && options.metadata.userId !== undefined) {\n result.metadata = { ...(isRecord(result.metadata) ? result.metadata : {}), user_id: options.metadata.userId }\n }\n return result\n },\n}\n\nconst google: Lowerer = {\n provider(options) {\n return {\n url: string(options.baseURL),\n headers: compact({ \"x-goog-api-key\": string(options.apiKey), ...headers(options.headers) }),\n body: body(options.body),\n settings: omit(options, [\"apiKey\", \"baseURL\", \"headers\", \"body\"]),\n }\n },\n request(options) {\n const generationConfig = pick(options, [\"thinkingConfig\", \"responseModalities\", \"mediaResolution\", \"imageConfig\"])\n return {\n ...omit(options, [\"thinkingConfig\", \"responseModalities\", \"mediaResolution\", \"imageConfig\"]),\n ...(Object.keys(generationConfig).length ? { generationConfig } : {}),\n }\n },\n}\n\nconst azure: Lowerer = {\n provider(options) {\n return {\n url: string(options.baseURL),\n headers: compact({ \"api-key\": string(options.apiKey), ...headers(options.headers) }),\n body: body(options.body),\n settings: omit(options, [\"apiKey\", \"baseURL\", \"headers\", \"body\"]),\n }\n },\n request: openai.request,\n}\n\nconst bedrock: Lowerer = {\n provider(options) {\n return direct(options)\n },\n request(options) {\n return { additionalModelRequestFields: clone(options) }\n },\n}\n\nconst openaiCompatible: Lowerer = {\n provider(options) {\n return { ...direct(options, [\"baseURL\"]), url: string(options.baseURL) }\n },\n request(options) {\n const result = clone(options)\n if (options.reasoningEffort !== undefined) {\n result.reasoning_effort = options.reasoningEffort\n delete result.reasoningEffort\n }\n return result\n },\n}\n\nconst lowerers: Readonly<Record<string, Lowerer>> = {\n \"@ai-sdk/openai\": openai,\n \"@ai-sdk/anthropic\": anthropic,\n \"@ai-sdk/google-vertex/anthropic\": anthropic,\n \"@ai-sdk/google\": google,\n \"@ai-sdk/google-vertex\": google,\n \"@ai-sdk/azure\": azure,\n \"@ai-sdk/amazon-bedrock\": bedrock,\n \"@ai-sdk/openai-compatible\": openaiCompatible,\n \"@ai-sdk/cerebras\": openaiCompatible,\n \"@ai-sdk/deepinfra\": openaiCompatible,\n \"@ai-sdk/groq\": openaiCompatible,\n \"@ai-sdk/mistral\": openaiCompatible,\n \"@ai-sdk/togetherai\": openaiCompatible,\n \"@ai-sdk/xai\": openaiCompatible,\n \"@openrouter/ai-sdk-provider\": openaiCompatible,\n \"ai-gateway-provider\": openaiCompatible,\n \"venice-ai-sdk-provider\": openaiCompatible,\n}\n\nfunction direct(options: Options, extraKeys: ReadonlyArray<string> = []): ProviderResult {\n return {\n headers: headers(options.headers),\n body: body(options.body),\n settings: omit(options, [\"headers\", \"body\", ...extraKeys]),\n }\n}\n\nfunction body(input: unknown) {\n if (!isRecord(input)) return undefined\n return { ...input }\n}\n\nfunction snake(options: Options) {\n return Object.fromEntries(Object.entries(options).map(([key, value]) => [snakeKey(key), snakeValue(value)]))\n}\n\nfunction snakeValue(value: unknown): unknown {\n if (Array.isArray(value)) return value.map(snakeValue)\n if (!isRecord(value)) return value\n return Object.fromEntries(Object.entries(value).map(([key, value]) => [snakeKey(key), snakeValue(value)]))\n}\n\nfunction snakeKey(key: string) {\n return key.replace(/[A-Z]/g, (match) => \"_\" + match.toLowerCase())\n}\n\nfunction clone(options: Options) {\n return { ...options }\n}\n\nfunction omit(options: Options, keys: ReadonlyArray<string>) {\n return Object.fromEntries(Object.entries(options).filter(([key]) => !keys.includes(key)))\n}\n\nfunction pick(options: Options, keys: ReadonlyArray<string>) {\n return Object.fromEntries(Object.entries(options).filter(([key]) => keys.includes(key)))\n}\n\nfunction headers(input: unknown) {\n if (!isRecord(input)) return undefined\n return Object.fromEntries(\n Object.entries(input).filter((entry): entry is [string, string] => typeof entry[1] === \"string\"),\n )\n}\n\nfunction compact(input: Record<string, string | undefined>) {\n const entries = Object.entries(input).filter((entry): entry is [string, string] => entry[1] !== undefined)\n return entries.length ? Object.fromEntries(entries) : undefined\n}\n\nfunction compactUnknown(input: Record<string, unknown>) {\n return Object.fromEntries(Object.entries(input).filter((entry) => entry[1] !== undefined))\n}\n\nfunction string(input: unknown) {\n return typeof input === \"string\" && input ? input : undefined\n}\n\nfunction bearer(input: unknown) {\n return typeof input === \"string\" && input ? `Bearer ${input}` : undefined\n}\n\nfunction isRecord(input: unknown): input is Record<string, unknown> {\n return typeof input === \"object\" && input !== null && !Array.isArray(input)\n}\n",
46
+ "export * as ConfigMigrateV1 from \"./migrate\"\n\nimport { ConfigV1 } from \"./config\"\nimport { ConfigAgentV1 } from \"./agent\"\nimport { ConfigMCPV1 } from \"./mcp\"\nimport { ConfigPermissionV1 } from \"./permission\"\nimport { ConfigProviderV1 } from \"./provider\"\nimport { ConfigProviderOptionsV1 } from \"./provider-options\"\nimport { ModelRequest } from \"../../model-request\"\n\nconst keys = new Set([\n \"logLevel\",\n \"server\",\n \"command\",\n \"reference\",\n \"snapshot\",\n \"plugin\",\n \"autoshare\",\n \"disabled_providers\",\n \"enabled_providers\",\n \"small_model\",\n \"mode\",\n \"agent\",\n \"provider\",\n \"permission\",\n \"tools\",\n \"attachment\",\n \"layout\",\n])\n\nexport function isV1(input: unknown) {\n if (typeof input !== \"object\" || input === null || Array.isArray(input)) return false\n return Object.keys(input).some((key) => keys.has(key))\n}\n\nexport function migrate(info: typeof ConfigV1.Info.Type) {\n return {\n $schema: info.$schema,\n shell: info.shell,\n model: info.model,\n default_agent: info.default_agent,\n autoupdate: info.autoupdate,\n share: info.share ?? (info.autoshare ? \"auto\" : undefined),\n enterprise: info.enterprise,\n username: info.username,\n permissions: permissions(info.permission, info.tools),\n agents: agents(info),\n snapshots: info.snapshot,\n watcher: info.watcher,\n formatter: info.formatter,\n lsp: info.lsp,\n attachments: info.attachment,\n tool_output: info.tool_output,\n mcp: mcp(info),\n compaction: info.compaction && {\n auto: info.compaction.auto,\n prune: info.compaction.prune,\n keep: {\n tokens: info.compaction.preserve_recent_tokens,\n },\n buffer: info.compaction.reserved,\n },\n skills: info.skills && [...(info.skills.paths ?? []), ...(info.skills.urls ?? [])],\n commands: info.command,\n instructions: info.instructions,\n references: info.reference,\n plugins: info.plugin?.map((plugin) =>\n typeof plugin === \"string\" ? plugin : { package: plugin[0], options: plugin[1] },\n ),\n experimental: info.experimental?.policies && { policies: info.experimental.policies },\n providers: providers(info.provider),\n }\n}\n\nfunction permissions(info?: ConfigPermissionV1.Info, tools?: Readonly<Record<string, boolean>>) {\n const rules: Array<{ action: string; resource: string; effect: ConfigPermissionV1.Action }> = Object.entries(\n tools ?? {},\n ).map(([action, enabled]) => ({\n action: normalizeAction(action),\n resource: \"*\",\n effect: enabled ? (\"allow\" as const) : (\"deny\" as const),\n }))\n for (const [action, rule] of Object.entries(info ?? {})) {\n if (!rule) continue\n if (typeof rule === \"string\") {\n rules.push({ action, resource: \"*\", effect: rule })\n continue\n }\n rules.push(...Object.entries(rule).map(([resource, effect]) => ({ action, resource, effect })))\n }\n return rules.length ? rules : undefined\n}\n\nfunction normalizeAction(action: string) {\n return action === \"write\" || action === \"patch\" ? \"edit\" : action\n}\n\nfunction agents(info: typeof ConfigV1.Info.Type) {\n const entries = [\n ...Object.entries(info.agent ?? {}),\n ...Object.entries(info.mode ?? {}).map(([name, agent]) => [name, { ...agent, mode: \"primary\" as const }] as const),\n ]\n if (!entries.length) return undefined\n return Object.fromEntries(entries.flatMap(([name, agent]) => (agent ? [[name, migrateAgent(agent)]] : [])))\n}\n\nexport function migrateAgent(info: ConfigAgentV1.Info) {\n const body = {\n ...info.options,\n ...(info.temperature === undefined ? {} : { temperature: info.temperature }),\n ...(info.top_p === undefined ? {} : { top_p: info.top_p }),\n }\n return {\n model: info.model,\n variant: info.variant,\n request: Object.keys(body).length ? { body } : undefined,\n system: info.prompt,\n description: info.description,\n mode: info.mode,\n hidden: info.hidden,\n color: info.color,\n steps: info.steps,\n disabled: info.disable,\n permissions: permissions(info.permission),\n }\n}\n\nfunction mcp(info: typeof ConfigV1.Info.Type) {\n const servers = Object.fromEntries(\n Object.entries(info.mcp ?? {}).flatMap(([name, server]) =>\n \"type\" in server ? [[name, migrateMcp(server)] as const] : [],\n ),\n )\n const timeout = info.experimental?.mcp_timeout\n if (!timeout && !Object.keys(servers).length) return undefined\n return { timeout, servers }\n}\n\nfunction migrateMcp(info: ConfigMCPV1.Info) {\n const disabled = info.enabled === undefined ? undefined : !info.enabled\n if (info.type === \"local\")\n return { type: info.type, command: info.command, environment: info.environment, disabled, timeout: info.timeout }\n return {\n type: info.type,\n url: info.url,\n headers: info.headers,\n oauth: info.oauth && {\n client_id: info.oauth.clientId,\n client_secret: info.oauth.clientSecret,\n scope: info.oauth.scope,\n callback_port: info.oauth.callbackPort,\n redirect_uri: info.oauth.redirectUri,\n },\n disabled,\n timeout: info.timeout,\n }\n}\n\nfunction providers(info?: Readonly<Record<string, ConfigProviderV1.Info>>) {\n if (!info) return undefined\n return Object.fromEntries(Object.entries(info).map(([name, provider]) => [name, migrateProvider(provider)]))\n}\n\nfunction migrateProvider(info: ConfigProviderV1.Info) {\n const lowerer = ConfigProviderOptionsV1.get(info.npm)\n const options = lowerer.provider(info.options ?? {})\n return {\n name: info.name,\n env: info.env,\n api: info.npm\n ? {\n type: \"aisdk\" as const,\n package: info.npm,\n url: info.api ?? options.url,\n settings: options.settings ?? {},\n }\n : undefined,\n request: info.options && { headers: options.headers, body: options.body },\n models:\n info.models &&\n Object.fromEntries(Object.entries(info.models).map(([name, model]) => [name, migrateModel(model, info.npm)])),\n }\n}\n\nfunction migrateModel(info: typeof ConfigProviderV1.Model.Type, packageName?: string) {\n const packageID = info.provider?.npm ?? packageName\n const lowerer = ConfigProviderOptionsV1.get(packageID)\n const ingest = (options: Readonly<Record<string, unknown>>) => {\n const request = ModelRequest.normalizeAiSdkOptions(packageID, options)\n return { ...lowerer.request(request.body), ...request.generation, ...request.options }\n }\n const request = info.options && ingest(info.options)\n const costs = info.cost && [\n {\n input: info.cost.input,\n output: info.cost.output,\n cache: { read: info.cost.cache_read, write: info.cost.cache_write },\n },\n ...(info.cost.context_over_200k\n ? [\n {\n tier: { type: \"context\" as const, size: 200_000 },\n input: info.cost.context_over_200k.input,\n output: info.cost.context_over_200k.output,\n cache: { read: info.cost.context_over_200k.cache_read, write: info.cost.context_over_200k.cache_write },\n },\n ]\n : []),\n ]\n const capabilities =\n info.tool_call !== undefined || info.modalities?.input !== undefined || info.modalities?.output !== undefined\n ? { tools: info.tool_call ?? false, input: info.modalities?.input ?? [], output: info.modalities?.output ?? [] }\n : undefined\n return {\n family: info.family,\n name: info.name,\n api: info.provider?.npm\n ? {\n ...(info.id === undefined ? {} : { id: info.id }),\n type: \"aisdk\" as const,\n package: info.provider.npm,\n url: info.provider.api,\n settings: {},\n }\n : info.id === undefined\n ? undefined\n : { id: info.id },\n capabilities,\n request: (info.headers || request) && {\n headers: info.headers,\n body: request,\n },\n variants:\n info.variants &&\n Object.entries(info.variants).map(([id, options]) => ({\n id,\n body: ingest(options),\n })),\n cost: costs,\n disabled: info.status === \"deprecated\" ? true : undefined,\n limit: info.limit && {\n context: int(info.limit.context),\n input: info.limit.input === undefined ? undefined : int(info.limit.input),\n output: int(info.limit.output),\n },\n }\n}\n\nfunction int(value: number) {\n return Math.max(Number.MIN_SAFE_INTEGER, Math.min(Number.MAX_SAFE_INTEGER, Math.trunc(value)))\n}\n",
47
+ "import path from \"path\"\nimport { fileURLToPath } from \"url\"\nimport { Schema } from \"effect\"\n\ntype BaseReference = {\n readonly host: string\n readonly path: string\n readonly segments: string[]\n readonly owner?: string\n readonly repo: string\n readonly remote: string\n readonly label: string\n}\n\nexport type RemoteReference = BaseReference & {\n readonly protocol?: string\n}\n\nexport type FileReference = BaseReference & {\n readonly host: \"file\"\n readonly protocol: \"file:\"\n}\n\nexport type Reference = RemoteReference | FileReference\n\nexport class InvalidReferenceError extends Schema.TaggedErrorClass<InvalidReferenceError>()(\n \"RepositoryInvalidReferenceError\",\n {\n repository: Schema.String,\n message: Schema.String,\n },\n) {}\n\nexport class UnsupportedLocalRepositoryError extends Schema.TaggedErrorClass<UnsupportedLocalRepositoryError>()(\n \"RepositoryUnsupportedLocalRepositoryError\",\n {\n repository: Schema.String,\n message: Schema.String,\n },\n) {}\n\nexport class InvalidBranchError extends Schema.TaggedErrorClass<InvalidBranchError>()(\"RepositoryInvalidBranchError\", {\n branch: Schema.String,\n message: Schema.String,\n}) {}\n\nexport type Error = InvalidReferenceError | UnsupportedLocalRepositoryError | InvalidBranchError\n\nexport function isError(error: unknown): error is Error {\n return (\n error instanceof InvalidReferenceError ||\n error instanceof UnsupportedLocalRepositoryError ||\n error instanceof InvalidBranchError\n )\n}\n\nexport function parse(input: string): Reference | undefined {\n const cleaned = normalizeInput(input)\n if (!cleaned) return\n\n const githubPrefixed = cleaned.match(/^github:([^/\\s]+)\\/([^/\\s]+)$/)\n if (githubPrefixed) return buildRemote({ host: \"github.com\", segments: [githubPrefixed[1], githubPrefixed[2]] })\n\n if (!cleaned.includes(\"://\")) {\n const scp = cleaned.match(/^(?:[^@/\\s]+@)?([^:/\\s]+):(.+)$/)\n if (scp) return buildRemote({ host: scp[1], segments: parts(scp[2]), remote: cleaned })\n\n const direct = parts(cleaned)\n if (direct.length >= 2 && hostLike(direct[0])) return buildRemote({ host: direct[0], segments: direct.slice(1) })\n if (direct.length === 2) return buildRemote({ host: \"github.com\", segments: direct })\n }\n\n try {\n const url = new URL(cleaned)\n if (url.protocol === \"file:\") return buildFile({ url, remote: cleaned })\n const segments = parts(url.pathname)\n return buildRemote({\n host: url.host,\n segments,\n remote: url.host === \"github.com\" ? githubRemote(segments.join(\"/\")) : cleaned,\n protocol: url.protocol,\n })\n } catch {\n return\n }\n}\n\nexport function parseRemote(input: string): RemoteReference {\n const reference = parse(input)\n if (!reference) {\n throw new InvalidReferenceError({\n repository: input,\n message: \"Repository must be a git URL, host/path reference, or GitHub owner/repo shorthand\",\n })\n }\n if (!isRemote(reference)) {\n throw new UnsupportedLocalRepositoryError({\n repository: input,\n message: \"Local file repositories are not supported\",\n })\n }\n return reference\n}\n\nexport function validateBranch(branch: string): void {\n if (/^[A-Za-z0-9/_.-]+$/.test(branch) && !branch.startsWith(\"-\") && !branch.includes(\"..\")) return\n throw new InvalidBranchError({\n branch,\n message: \"Branch must contain only alphanumeric characters, /, _, ., and -, and cannot start with - or contain ..\",\n })\n}\n\nexport function isFile(reference: Reference): reference is FileReference {\n return reference.protocol === \"file:\"\n}\n\nexport function isRemote(reference: Reference): reference is RemoteReference {\n return !isFile(reference)\n}\n\nexport function cachePath(root: string, reference: Reference): string {\n return path.join(root, ...reference.host.split(\":\"), ...reference.segments)\n}\n\nexport function cacheIdentity(reference: Reference): string {\n return `${reference.host}/${reference.path}`\n}\n\nexport function same(left: Reference, right: Reference): boolean {\n return cacheIdentity(left) === cacheIdentity(right)\n}\n\nfunction normalizeInput(input: string) {\n return input\n .trim()\n .replace(/^git\\+/, \"\")\n .replace(/#.*$/, \"\")\n .replace(/\\/+$/, \"\")\n}\n\nfunction trimGitSuffix(input: string) {\n return input.replace(/\\.git$/, \"\")\n}\n\nfunction parts(input: string) {\n return input\n .split(\"/\")\n .map((item) => trimGitSuffix(item.trim()))\n .filter(Boolean)\n}\n\nfunction safeHost(input: string) {\n return Boolean(input) && !input.startsWith(\"-\") && !/[\\s/\\\\]/.test(input)\n}\n\nfunction safeSegment(input: string) {\n return input !== \".\" && input !== \"..\" && !input.includes(\":\") && !/[\\s/\\\\]/.test(input)\n}\n\nfunction hostLike(input: string) {\n return input.includes(\".\") || input.includes(\":\") || input === \"localhost\"\n}\n\nfunction withSlash(input: string) {\n return input.endsWith(\"/\") ? input : `${input}/`\n}\n\nfunction githubRemote(pathname: string) {\n const base = process.env.OPENCODE_REPO_CLONE_GITHUB_BASE_URL\n if (!base) return `https://github.com/${pathname}.git`\n return new URL(`${pathname}.git`, withSlash(base)).href\n}\n\nfunction buildRemote(input: { host: string; segments: string[]; remote?: string; protocol?: string }) {\n const segments = input.segments.map(trimGitSuffix).filter(Boolean)\n if (!safeHost(input.host) || !segments.length || segments.some((segment) => !safeSegment(segment))) return\n const repositoryPath = segments.join(\"/\")\n const host = input.host.toLowerCase()\n return {\n host,\n path: repositoryPath,\n segments,\n owner: segments.length === 2 ? segments[0] : undefined,\n repo: segments[segments.length - 1],\n remote:\n input.remote ?? (host === \"github.com\" ? githubRemote(repositoryPath) : `https://${host}/${repositoryPath}.git`),\n label: host === \"github.com\" && segments.length === 2 ? repositoryPath : `${host}/${repositoryPath}`,\n protocol: input.protocol,\n } satisfies RemoteReference\n}\n\nfunction buildFile(input: { url: URL; remote: string }) {\n const filePath = path.normalize(fileURLToPath(input.url))\n const segments = filePath.split(/[\\\\/]+/).filter(Boolean)\n if (!segments.length) return\n return {\n host: \"file\",\n path: filePath,\n segments: segments.map((segment) => segment.replace(/:$/, \"\")),\n owner: undefined,\n repo: trimGitSuffix(segments[segments.length - 1]),\n remote: input.remote,\n label: filePath,\n protocol: \"file:\",\n } satisfies FileReference\n}\n\nexport * as Repository from \"./repository\"\n",
48
+ "import path from \"path\"\nimport { Context, Effect, Layer, Schema } from \"effect\"\nimport { FSUtil } from \"./fs-util\"\nimport { Git } from \"./git\"\nimport { Global } from \"./global\"\nimport { Repository } from \"./repository\"\nimport { EffectFlock } from \"./util/effect-flock\"\n\nexport type Result = {\n readonly repository: string\n readonly host: string\n readonly remote: string\n readonly localPath: string\n readonly status: \"cached\" | \"cloned\" | \"refreshed\"\n readonly head?: string\n readonly branch?: string\n}\n\nexport type EnsureInput = {\n readonly reference: Repository.RemoteReference\n readonly refresh?: boolean\n readonly branch?: string\n}\n\nexport class InvalidRepositoryError extends Schema.TaggedErrorClass<InvalidRepositoryError>()(\n \"RepositoryCacheInvalidRepositoryError\",\n {\n repository: Schema.String,\n message: Schema.String,\n },\n) {}\n\nexport class InvalidBranchError extends Schema.TaggedErrorClass<InvalidBranchError>()(\n \"RepositoryCacheInvalidBranchError\",\n {\n branch: Schema.String,\n message: Schema.String,\n },\n) {}\n\nexport class CloneFailedError extends Schema.TaggedErrorClass<CloneFailedError>()(\"RepositoryCacheCloneFailedError\", {\n repository: Schema.String,\n message: Schema.String,\n}) {}\n\nexport class FetchFailedError extends Schema.TaggedErrorClass<FetchFailedError>()(\"RepositoryCacheFetchFailedError\", {\n repository: Schema.String,\n message: Schema.String,\n}) {}\n\nexport class CheckoutFailedError extends Schema.TaggedErrorClass<CheckoutFailedError>()(\n \"RepositoryCacheCheckoutFailedError\",\n {\n repository: Schema.String,\n branch: Schema.String,\n message: Schema.String,\n },\n) {}\n\nexport class ResetFailedError extends Schema.TaggedErrorClass<ResetFailedError>()(\"RepositoryCacheResetFailedError\", {\n repository: Schema.String,\n message: Schema.String,\n}) {}\n\nexport class LockFailedError extends Schema.TaggedErrorClass<LockFailedError>()(\"RepositoryCacheLockFailedError\", {\n localPath: Schema.String,\n message: Schema.String,\n}) {}\n\nexport class CacheOperationError extends Schema.TaggedErrorClass<CacheOperationError>()(\n \"RepositoryCacheOperationError\",\n {\n operation: Schema.String,\n path: Schema.String,\n message: Schema.String,\n },\n) {}\n\nexport type Error =\n | InvalidRepositoryError\n | InvalidBranchError\n | CloneFailedError\n | FetchFailedError\n | CheckoutFailedError\n | ResetFailedError\n | LockFailedError\n | CacheOperationError\n\nexport interface Interface {\n readonly ensure: (input: EnsureInput) => Effect.Effect<Result, Error>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/RepositoryCache\") {}\n\nexport function isError(error: unknown): error is Error {\n return (\n error instanceof InvalidRepositoryError ||\n error instanceof InvalidBranchError ||\n error instanceof CloneFailedError ||\n error instanceof FetchFailedError ||\n error instanceof CheckoutFailedError ||\n error instanceof ResetFailedError ||\n error instanceof LockFailedError ||\n error instanceof CacheOperationError\n )\n}\n\nexport const parseRemote = Effect.fn(\"RepositoryCache.parseRemote\")(function* (repository: string) {\n return yield* Effect.try({\n try: () => Repository.parseRemote(repository),\n catch: (error) => new InvalidRepositoryError({ repository, message: errorMessage(error) }),\n })\n})\n\nexport const validateBranch = Effect.fn(\"RepositoryCache.validateBranch\")(function* (branch: string) {\n return yield* Effect.try({\n try: () => Repository.validateBranch(branch),\n catch: (error) => new InvalidBranchError({ branch, message: errorMessage(error) }),\n })\n})\n\nexport const layer: Layer.Layer<Service, never, FSUtil.Service | Git.Service | EffectFlock.Service | Global.Service> =\n Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FSUtil.Service\n const git = yield* Git.Service\n const flock = yield* EffectFlock.Service\n const global = yield* Global.Service\n\n return Service.of({\n ensure: Effect.fn(\"RepositoryCache.ensure\")(function* (input) {\n if (input.branch) yield* validateBranch(input.branch)\n\n const repository = input.reference.label\n const localPath = Repository.cachePath(global.repos, input.reference)\n const cloneTarget = Repository.parse(input.reference.remote) ?? input.reference\n\n return yield* flock\n .withLock(\n Effect.gen(function* () {\n yield* cacheOperation(fs.ensureDir(path.dirname(localPath)), \"ensure cache directory\", localPath)\n\n const exists = yield* fs.existsSafe(localPath)\n const hasGitDir = yield* fs.existsSafe(path.join(localPath, \".git\"))\n const origin = hasGitDir ? yield* git.origin(localPath) : undefined\n const originReference = origin ? Repository.parse(origin) : undefined\n const reuse = hasGitDir && Boolean(originReference && Repository.same(originReference, cloneTarget))\n if (exists && !reuse) {\n yield* cacheOperation(fs.remove(localPath, { recursive: true }), \"remove stale cache\", localPath)\n }\n\n const currentBranch = reuse ? yield* git.branch(localPath) : undefined\n const status = statusForRepository({\n reuse,\n refresh: input.refresh,\n branchMatches: input.branch ? currentBranch === input.branch : undefined,\n })\n\n if (status === \"cloned\") {\n const result = yield* git\n .clone({ remote: input.reference.remote, target: localPath, branch: input.branch })\n .pipe(\n Effect.mapError((error) => new CloneFailedError({ repository, message: errorMessage(error) })),\n )\n if (result.exitCode !== 0) {\n return yield* new CloneFailedError({\n repository,\n message: resultMessage(result, `Failed to clone ${repository}`),\n })\n }\n }\n\n if (status === \"refreshed\") {\n const fetch = yield* git\n .fetch(localPath)\n .pipe(\n Effect.mapError((error) => new FetchFailedError({ repository, message: errorMessage(error) })),\n )\n if (fetch.exitCode !== 0) {\n return yield* new FetchFailedError({\n repository,\n message: resultMessage(fetch, `Failed to refresh ${repository}`),\n })\n }\n\n if (input.branch) {\n const requestedBranch = input.branch\n const fetchBranch = yield* git\n .fetchBranch(localPath, requestedBranch)\n .pipe(\n Effect.mapError((error) => new FetchFailedError({ repository, message: errorMessage(error) })),\n )\n if (fetchBranch.exitCode !== 0) {\n return yield* new FetchFailedError({\n repository,\n message: resultMessage(fetchBranch, `Failed to fetch ${requestedBranch}`),\n })\n }\n\n const checkout = yield* git.checkout(localPath, requestedBranch).pipe(\n Effect.mapError(\n (error) =>\n new CheckoutFailedError({\n repository,\n branch: requestedBranch,\n message: errorMessage(error),\n }),\n ),\n )\n if (checkout.exitCode !== 0) {\n return yield* new CheckoutFailedError({\n repository,\n branch: requestedBranch,\n message: resultMessage(checkout, `Failed to checkout ${requestedBranch}`),\n })\n }\n }\n\n const reset = yield* git\n .reset(localPath, yield* resetTarget(git, localPath, input.branch))\n .pipe(\n Effect.mapError((error) => new ResetFailedError({ repository, message: errorMessage(error) })),\n )\n if (reset.exitCode !== 0) {\n return yield* new ResetFailedError({\n repository,\n message: resultMessage(reset, `Failed to reset ${repository}`),\n })\n }\n }\n\n return {\n repository,\n host: input.reference.host,\n remote: input.reference.remote,\n localPath,\n status,\n head: yield* git.head(localPath),\n branch: yield* git.branch(localPath),\n } satisfies Result\n }),\n `repository-cache:${localPath}`,\n )\n .pipe(\n Effect.mapError((error) =>\n isError(error) ? error : new LockFailedError({ localPath, message: errorMessage(error) }),\n ),\n )\n }),\n })\n }),\n )\n\nexport const defaultLayer: Layer.Layer<Service> = layer.pipe(\n Layer.provide(EffectFlock.defaultLayer),\n Layer.provide(FSUtil.defaultLayer),\n Layer.provide(Git.defaultLayer),\n Layer.provide(Global.defaultLayer),\n)\n\nfunction statusForRepository(input: { reuse: boolean; refresh?: boolean; branchMatches?: boolean }) {\n if (!input.reuse) return \"cloned\" as const\n if (input.branchMatches === false || input.refresh) return \"refreshed\" as const\n return \"cached\" as const\n}\n\nfunction errorMessage(error: unknown) {\n return error instanceof globalThis.Error ? error.message : String(error)\n}\n\nfunction cacheOperation<A, E, R>(effect: Effect.Effect<A, E, R>, operation: string, target: string) {\n return effect.pipe(\n Effect.mapError((error) => new CacheOperationError({ operation, path: target, message: errorMessage(error) })),\n )\n}\n\nconst resetTarget = Effect.fnUntraced(function* (git: Git.Interface, cwd: string, requestedBranch?: string) {\n if (requestedBranch) return `origin/${requestedBranch}`\n const remoteHead = yield* git.remoteHead(cwd)\n if (remoteHead) return remoteHead\n const currentBranch = yield* git.branch(cwd)\n if (currentBranch) return `origin/${currentBranch}`\n return \"HEAD\"\n})\n\nfunction resultMessage(result: Git.Result, fallback: string) {\n return result.stderr.trim() || result.text.trim() || fallback\n}\n\nexport * as RepositoryCache from \"./repository-cache\"\n",
49
+ "import path from \"path\"\nimport os from \"os\"\nimport { randomUUID } from \"crypto\"\nimport { Context, Effect, Function, Layer, Option, Schedule, Schema } from \"effect\"\nimport type { FileSystem, Scope } from \"effect\"\nimport type { PlatformError } from \"effect/PlatformError\"\nimport { FSUtil } from \"../fs-util\"\nimport { Global } from \"../global\"\nimport { Hash } from \"./hash\"\n\nexport namespace EffectFlock {\n // ---------------------------------------------------------------------------\n // Errors\n // ---------------------------------------------------------------------------\n\n export class LockTimeoutError extends Schema.TaggedErrorClass<LockTimeoutError>()(\"LockTimeoutError\", {\n key: Schema.String,\n }) {}\n\n export class LockCompromisedError extends Schema.TaggedErrorClass<LockCompromisedError>()(\"LockCompromisedError\", {\n detail: Schema.String,\n }) {}\n\n class ReleaseError extends Schema.TaggedErrorClass<ReleaseError>()(\"ReleaseError\", {\n detail: Schema.String,\n cause: Schema.optional(Schema.Defect),\n }) {\n override get message() {\n return this.detail\n }\n }\n\n /** Internal: signals \"lock is held, retry later\". Never leaks to callers. */\n class NotAcquired extends Schema.TaggedErrorClass<NotAcquired>()(\"NotAcquired\", {}) {}\n\n export type LockError = LockTimeoutError | LockCompromisedError\n\n // ---------------------------------------------------------------------------\n // Timing (baked in — no caller ever overrides these)\n // ---------------------------------------------------------------------------\n\n const STALE_MS = 60_000\n const TIMEOUT_MS = 5 * 60_000\n const BASE_DELAY_MS = 100\n const MAX_DELAY_MS = 2_000\n const HEARTBEAT_MS = Math.max(100, Math.floor(STALE_MS / 3))\n\n const retrySchedule = Schedule.exponential(BASE_DELAY_MS, 1.7).pipe(\n Schedule.either(Schedule.spaced(MAX_DELAY_MS)),\n Schedule.jittered,\n Schedule.while((meta) => meta.elapsed < TIMEOUT_MS),\n )\n\n // ---------------------------------------------------------------------------\n // Lock metadata schema\n // ---------------------------------------------------------------------------\n\n const LockMetaJson = Schema.fromJsonString(\n Schema.Struct({\n token: Schema.String,\n pid: Schema.Number,\n hostname: Schema.String,\n createdAt: Schema.String,\n }),\n )\n\n const decodeMeta = Schema.decodeUnknownSync(LockMetaJson)\n const encodeMeta = Schema.encodeSync(LockMetaJson)\n\n // ---------------------------------------------------------------------------\n // Service\n // ---------------------------------------------------------------------------\n\n export interface Interface {\n readonly acquire: (key: string, dir?: string) => Effect.Effect<void, LockError, Scope.Scope>\n readonly withLock: {\n (key: string, dir?: string): <A, E, R>(body: Effect.Effect<A, E, R>) => Effect.Effect<A, E | LockError, R>\n <A, E, R>(body: Effect.Effect<A, E, R>, key: string, dir?: string): Effect.Effect<A, E | LockError, R>\n }\n }\n\n export class Service extends Context.Service<Service, Interface>()(\"EffectFlock\") {}\n\n // ---------------------------------------------------------------------------\n // Layer\n // ---------------------------------------------------------------------------\n\n function wall() {\n return performance.timeOrigin + performance.now()\n }\n\n const mtimeMs = (info: FileSystem.File.Info) => Option.getOrElse(info.mtime, () => new Date(0)).getTime()\n\n const isPathGone = (e: PlatformError) => e.reason._tag === \"NotFound\" || e.reason._tag === \"Unknown\"\n\n export const layer: Layer.Layer<Service, never, Global.Service | FSUtil.Service> = Layer.effect(\n Service,\n Effect.gen(function* () {\n const global = yield* Global.Service\n const fs = yield* FSUtil.Service\n const lockRoot = path.join(global.state, \"locks\")\n const hostname = os.hostname()\n const ensuredDirs = new Set<string>()\n\n // -- helpers (close over fs) --\n\n const safeStat = (file: string) =>\n fs.stat(file).pipe(\n Effect.catchIf(isPathGone, () => Effect.void),\n Effect.orDie,\n )\n\n const forceRemove = (target: string) => fs.remove(target, { recursive: true }).pipe(Effect.ignore)\n\n /** Atomic mkdir — returns true if created, false if already exists, dies on other errors. */\n const atomicMkdir = (dir: string) =>\n fs.makeDirectory(dir, { mode: 0o700 }).pipe(\n Effect.as(true),\n Effect.catchIf(\n (e) => e.reason._tag === \"AlreadyExists\",\n () => Effect.succeed(false),\n ),\n Effect.orDie,\n )\n\n /** Write with exclusive create — compromised error if file already exists. */\n const exclusiveWrite = (filePath: string, content: string, lockDir: string, detail: string) =>\n fs.writeFileString(filePath, content, { flag: \"wx\" }).pipe(\n Effect.catch(() =>\n Effect.gen(function* () {\n yield* forceRemove(lockDir)\n return yield* new LockCompromisedError({ detail })\n }),\n ),\n )\n\n const cleanStaleBreaker = Effect.fnUntraced(function* (breakerPath: string) {\n const bs = yield* safeStat(breakerPath)\n if (bs && wall() - mtimeMs(bs) > STALE_MS) yield* forceRemove(breakerPath)\n return false\n })\n\n const ensureDir = Effect.fnUntraced(function* (dir: string) {\n if (ensuredDirs.has(dir)) return\n yield* fs.makeDirectory(dir, { recursive: true }).pipe(Effect.orDie)\n ensuredDirs.add(dir)\n })\n\n const isStale = Effect.fnUntraced(function* (lockDir: string, heartbeatPath: string, metaPath: string) {\n const now = wall()\n\n const hb = yield* safeStat(heartbeatPath)\n if (hb) return now - mtimeMs(hb) > STALE_MS\n\n const meta = yield* safeStat(metaPath)\n if (meta) return now - mtimeMs(meta) > STALE_MS\n\n const dir = yield* safeStat(lockDir)\n if (!dir) return false\n\n return now - mtimeMs(dir) > STALE_MS\n })\n\n // -- single lock attempt --\n\n type Handle = { token: string; metaPath: string; heartbeatPath: string; lockDir: string }\n\n const tryAcquireLockDir = (lockDir: string, key: string) =>\n Effect.gen(function* () {\n const token = randomUUID()\n const metaPath = path.join(lockDir, \"meta.json\")\n const heartbeatPath = path.join(lockDir, \"heartbeat\")\n\n // Atomic mkdir — the POSIX lock primitive\n const created = yield* atomicMkdir(lockDir)\n\n if (!created) {\n if (!(yield* isStale(lockDir, heartbeatPath, metaPath))) return yield* new NotAcquired()\n\n // Stale — race for breaker ownership\n const breakerPath = lockDir + \".breaker\"\n\n const claimed = yield* fs.makeDirectory(breakerPath, { mode: 0o700 }).pipe(\n Effect.as(true),\n Effect.catchIf(\n (e) => e.reason._tag === \"AlreadyExists\",\n () => cleanStaleBreaker(breakerPath),\n ),\n Effect.catchIf(isPathGone, () => Effect.succeed(false)),\n Effect.orDie,\n )\n\n if (!claimed) return yield* new NotAcquired()\n\n // We own the breaker — double-check staleness, nuke, recreate\n const recreated = yield* Effect.gen(function* () {\n if (!(yield* isStale(lockDir, heartbeatPath, metaPath))) return false\n yield* forceRemove(lockDir)\n return yield* atomicMkdir(lockDir)\n }).pipe(Effect.ensuring(forceRemove(breakerPath)))\n\n if (!recreated) return yield* new NotAcquired()\n }\n\n // We own the lock dir — write heartbeat + meta with exclusive create\n yield* exclusiveWrite(heartbeatPath, \"\", lockDir, \"heartbeat already existed\")\n\n const metaJson = encodeMeta({ token, pid: process.pid, hostname, createdAt: new Date().toISOString() })\n yield* exclusiveWrite(metaPath, metaJson, lockDir, \"meta.json already existed\")\n\n return { token, metaPath, heartbeatPath, lockDir } satisfies Handle\n }).pipe(\n Effect.withSpan(\"EffectFlock.tryAcquire\", {\n attributes: { key },\n }),\n )\n\n // -- retry wrapper (preserves Handle type) --\n\n const acquireHandle = (lockfile: string, key: string): Effect.Effect<Handle, LockError> =>\n tryAcquireLockDir(lockfile, key).pipe(\n Effect.retry({\n while: (err) => err._tag === \"NotAcquired\",\n schedule: retrySchedule,\n }),\n Effect.catchTag(\"NotAcquired\", () => Effect.fail(new LockTimeoutError({ key }))),\n )\n\n // -- release --\n\n const release = (handle: Handle) =>\n Effect.gen(function* () {\n const raw = yield* fs.readFileString(handle.metaPath).pipe(\n Effect.catch((err) => {\n if (isPathGone(err)) return Effect.die(new ReleaseError({ detail: \"metadata missing\" }))\n return Effect.die(err)\n }),\n )\n\n const parsed = yield* Effect.try({\n try: () => decodeMeta(raw),\n catch: (cause) => new ReleaseError({ detail: \"metadata invalid\", cause }),\n }).pipe(Effect.orDie)\n\n if (parsed.token !== handle.token) return yield* Effect.die(new ReleaseError({ detail: \"token mismatch\" }))\n\n yield* forceRemove(handle.lockDir)\n })\n\n // -- build service --\n\n const acquire = Effect.fn(\"EffectFlock.acquire\")(function* (key: string, dir?: string) {\n const lockDir = dir ?? lockRoot\n yield* ensureDir(lockDir)\n\n const lockfile = path.join(lockDir, Hash.fast(key) + \".lock\")\n\n // acquireRelease: acquire is uninterruptible, release is guaranteed\n const handle = yield* Effect.acquireRelease(acquireHandle(lockfile, key), (handle) => release(handle))\n\n // Heartbeat fiber — scoped, so it's interrupted before release runs\n yield* fs\n .utimes(handle.heartbeatPath, new Date(), new Date())\n .pipe(Effect.ignore, Effect.repeat(Schedule.spaced(HEARTBEAT_MS)), Effect.forkScoped)\n })\n\n const withLock: Interface[\"withLock\"] = Function.dual(\n (args) => Effect.isEffect(args[0]),\n <A, E, R>(body: Effect.Effect<A, E, R>, key: string, dir?: string): Effect.Effect<A, E | LockError, R> =>\n Effect.scoped(\n Effect.gen(function* () {\n yield* acquire(key, dir)\n return yield* body\n }),\n ),\n )\n\n return Service.of({ acquire, withLock })\n }),\n )\n\n export const defaultLayer = layer.pipe(Layer.provide(FSUtil.defaultLayer), Layer.provide(Global.layer))\n}\n",
50
+ "import os from \"os\"\nimport path from \"path\"\n\nconst home = os.homedir()\n\nconst DARWIN_HOME = [\n \"Music\",\n \"Pictures\",\n \"Movies\",\n \"Downloads\",\n \"Desktop\",\n \"Documents\",\n \"Public\",\n \"Applications\",\n \"Library\",\n]\n\nconst DARWIN_LIBRARY = [\n \"Application Support/AddressBook\",\n \"Calendars\",\n \"Mail\",\n \"Messages\",\n \"Safari\",\n \"Cookies\",\n \"Application Support/com.apple.TCC\",\n \"PersonalizationPortrait\",\n \"Metadata/CoreSpotlight\",\n \"Suggestions\",\n]\n\nconst DARWIN_ROOT = [\"/.DocumentRevisions-V100\", \"/.Spotlight-V100\", \"/.Trashes\", \"/.fseventsd\"]\nconst WIN32_HOME = [\"AppData\", \"Downloads\", \"Desktop\", \"Documents\", \"Pictures\", \"Music\", \"Videos\", \"OneDrive\"]\n\n/** Directory basenames to skip when scanning the home directory. */\nexport function names(): ReadonlySet<string> {\n if (process.platform === \"darwin\") return new Set(DARWIN_HOME)\n if (process.platform === \"win32\") return new Set(WIN32_HOME)\n return new Set()\n}\n\n/** Absolute paths that should never be watched, stated, or scanned. */\nexport function paths(): string[] {\n if (process.platform === \"darwin\")\n return [\n ...DARWIN_HOME.map((name) => path.join(home, name)),\n ...DARWIN_LIBRARY.map((name) => path.join(home, \"Library\", name)),\n ...DARWIN_ROOT,\n ]\n if (process.platform === \"win32\") return WIN32_HOME.map((name) => path.join(home, name))\n return []\n}\n\nexport * as Protected from \"./protected\"\n",
51
+ "import path from \"path\"\nimport { serviceUse } from \"../effect/service-use\"\nimport { FSUtil } from \"../fs-util\"\nimport { Cause, Context, Effect, Fiber, Layer, Queue, Schema, Stream } from \"effect\"\nimport type { PlatformError } from \"effect/PlatformError\"\nimport { FetchHttpClient, HttpClient, HttpClientRequest } from \"effect/unstable/http\"\nimport { ChildProcess } from \"effect/unstable/process\"\nimport { ChildProcessSpawner } from \"effect/unstable/process/ChildProcessSpawner\"\n\nimport { CrossSpawnSpawner } from \"../cross-spawn-spawner\"\nimport { Global } from \"../global\"\nimport { NonNegativeInt } from \"../schema\"\nimport * as Log from \"../util/log\"\nimport { sanitizedProcessEnv } from \"../util/opencode-process\"\nimport { which } from \"../util/which\"\n\nconst log = Log.create({ service: \"ripgrep\" })\nconst VERSION = \"15.1.0\"\nconst PLATFORM = {\n \"arm64-darwin\": { platform: \"aarch64-apple-darwin\", extension: \"tar.gz\" },\n \"arm64-linux\": { platform: \"aarch64-unknown-linux-gnu\", extension: \"tar.gz\" },\n \"x64-darwin\": { platform: \"x86_64-apple-darwin\", extension: \"tar.gz\" },\n \"x64-linux\": { platform: \"x86_64-unknown-linux-musl\", extension: \"tar.gz\" },\n \"arm64-win32\": { platform: \"aarch64-pc-windows-msvc\", extension: \"zip\" },\n \"ia32-win32\": { platform: \"i686-pc-windows-msvc\", extension: \"zip\" },\n \"x64-win32\": { platform: \"x86_64-pc-windows-msvc\", extension: \"zip\" },\n} as const\n\nconst TimeStats = Schema.Struct({\n secs: NonNegativeInt,\n nanos: NonNegativeInt,\n human: Schema.String,\n})\n\nconst Stats = Schema.Struct({\n elapsed: TimeStats,\n searches: NonNegativeInt,\n searches_with_match: NonNegativeInt,\n bytes_searched: NonNegativeInt,\n bytes_printed: NonNegativeInt,\n matched_lines: NonNegativeInt,\n matches: NonNegativeInt,\n})\n\nconst PathText = Schema.Struct({\n text: Schema.String,\n})\n\nconst Begin = Schema.Struct({\n type: Schema.Literal(\"begin\"),\n data: Schema.Struct({\n path: PathText,\n }),\n})\n\nexport const SearchMatch = Schema.Struct({\n path: PathText,\n lines: Schema.Struct({\n text: Schema.String,\n }),\n line_number: NonNegativeInt,\n absolute_offset: NonNegativeInt,\n submatches: Schema.Array(\n Schema.Struct({\n match: Schema.Struct({\n text: Schema.String,\n }),\n start: NonNegativeInt,\n end: NonNegativeInt,\n }),\n ),\n})\n\nexport const Match = Schema.Struct({\n type: Schema.Literal(\"match\"),\n data: SearchMatch,\n})\n\nconst End = Schema.Struct({\n type: Schema.Literal(\"end\"),\n data: Schema.Struct({\n path: PathText,\n binary_offset: Schema.NullOr(NonNegativeInt),\n stats: Stats,\n }),\n})\n\nconst Summary = Schema.Struct({\n type: Schema.Literal(\"summary\"),\n data: Schema.Struct({\n elapsed_total: TimeStats,\n stats: Stats,\n }),\n})\n\nconst Result = Schema.Union([Begin, Match, End, Summary])\nconst decodeResult = Schema.decodeUnknownEffect(Schema.fromJsonString(Result))\n\nexport type Result = Schema.Schema.Type<typeof Result>\nexport type Match = Schema.Schema.Type<typeof Match>\nexport type Item = Match[\"data\"]\nexport type Begin = Schema.Schema.Type<typeof Begin>\nexport type End = Schema.Schema.Type<typeof End>\nexport type Summary = Schema.Schema.Type<typeof Summary>\nexport type Row = Match[\"data\"]\n\nexport interface SearchResult {\n items: Item[]\n partial: boolean\n}\n\nexport interface FilesInput {\n cwd: string\n glob?: string[]\n hidden?: boolean\n follow?: boolean\n maxDepth?: number\n signal?: AbortSignal\n}\n\nexport interface SearchInput {\n cwd: string\n pattern: string\n glob?: string[]\n limit?: number\n follow?: boolean\n file?: string[]\n signal?: AbortSignal\n}\n\nexport interface TreeInput {\n cwd: string\n limit?: number\n signal?: AbortSignal\n}\n\nexport interface Interface {\n readonly filepath: Effect.Effect<string, Error>\n readonly files: (input: FilesInput) => Stream.Stream<string, PlatformError | Error>\n readonly tree: (input: TreeInput) => Effect.Effect<string, PlatformError | Error>\n readonly search: (input: SearchInput) => Effect.Effect<SearchResult, PlatformError | Error>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/Ripgrep\") {}\n\nexport const use = serviceUse(Service)\n\nfunction env() {\n const env = sanitizedProcessEnv()\n delete env.RIPGREP_CONFIG_PATH\n return env\n}\n\nfunction aborted(signal?: AbortSignal) {\n const err = signal?.reason\n if (err instanceof Error) return err\n const out = new Error(\"Aborted\")\n out.name = \"AbortError\"\n return out\n}\n\nfunction waitForAbort(signal?: AbortSignal) {\n if (!signal) return Effect.never\n if (signal.aborted) return Effect.fail(aborted(signal))\n return Effect.callback<never, Error>((resume) => {\n const onabort = () => resume(Effect.fail(aborted(signal)))\n signal.addEventListener(\"abort\", onabort, { once: true })\n return Effect.sync(() => signal.removeEventListener(\"abort\", onabort))\n })\n}\n\nfunction error(stderr: string, code: number) {\n const err = new Error(stderr.trim() || `ripgrep failed with code ${code}`)\n err.name = \"RipgrepError\"\n return err\n}\n\nfunction clean(file: string) {\n return path.normalize(file.replace(/^\\.[\\\\/]/, \"\"))\n}\n\nfunction row(data: Row): Row {\n return {\n ...data,\n path: {\n ...data.path,\n text: clean(data.path.text),\n },\n }\n}\n\nfunction parse(line: string) {\n return decodeResult(line).pipe(Effect.mapError((cause) => new Error(\"invalid ripgrep output\", { cause })))\n}\n\nfunction fail(queue: Queue.Queue<string, PlatformError | Error | Cause.Done>, err: PlatformError | Error) {\n Queue.failCauseUnsafe(queue, Cause.fail(err))\n}\n\nfunction filesArgs(input: FilesInput) {\n const args = [\"--no-config\", \"--files\", \"--glob=!.git/*\"]\n if (input.follow) args.push(\"--follow\")\n if (input.hidden !== false) args.push(\"--hidden\")\n if (input.hidden === false) args.push(\"--glob=!.*\")\n if (input.maxDepth !== undefined) args.push(`--max-depth=${input.maxDepth}`)\n if (input.glob) {\n for (const glob of input.glob) args.push(`--glob=${glob}`)\n }\n args.push(\".\")\n return args\n}\n\nfunction searchArgs(input: SearchInput) {\n const args = [\"--no-config\", \"--json\", \"--hidden\", \"--glob=!.git/*\", \"--no-messages\"]\n if (input.follow) args.push(\"--follow\")\n if (input.glob) {\n for (const glob of input.glob) args.push(`--glob=${glob}`)\n }\n if (input.limit) args.push(`--max-count=${input.limit}`)\n args.push(\"--\", input.pattern, ...(input.file ?? [\".\"]))\n return args\n}\n\nfunction raceAbort<A, E, R>(effect: Effect.Effect<A, E, R>, signal?: AbortSignal) {\n return signal ? effect.pipe(Effect.raceFirst(waitForAbort(signal))) : effect\n}\n\nexport const layer: Layer.Layer<Service, never, FSUtil.Service | ChildProcessSpawner | HttpClient.HttpClient> =\n Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FSUtil.Service\n const http = HttpClient.filterStatusOk(yield* HttpClient.HttpClient)\n const spawner = yield* ChildProcessSpawner\n\n const run = Effect.fnUntraced(function* (command: string, args: string[], opts?: { cwd?: string }) {\n const handle = yield* spawner.spawn(\n ChildProcess.make(command, args, { cwd: opts?.cwd, extendEnv: true, stdin: \"ignore\" }),\n )\n const [stdout, stderr, code] = yield* Effect.all(\n [\n Stream.mkString(Stream.decodeText(handle.stdout)),\n Stream.mkString(Stream.decodeText(handle.stderr)),\n handle.exitCode,\n ],\n { concurrency: \"unbounded\" },\n )\n return { stdout, stderr, code }\n }, Effect.scoped)\n\n const extract = Effect.fnUntraced(function* (\n archive: string,\n config: (typeof PLATFORM)[keyof typeof PLATFORM],\n target: string,\n ) {\n const dir = yield* fs.makeTempDirectoryScoped({ directory: Global.Path.bin, prefix: \"ripgrep-\" })\n\n if (config.extension === \"zip\") {\n const shell = (yield* Effect.sync(() => which(\"powershell.exe\") ?? which(\"pwsh.exe\"))) ?? \"powershell.exe\"\n const result = yield* run(shell, [\n \"-NoProfile\",\n \"-NonInteractive\",\n \"-Command\",\n `$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -LiteralPath '${archive.replaceAll(\"'\", \"''\")}' -DestinationPath '${dir.replaceAll(\"'\", \"''\")}' -Force`,\n ])\n if (result.code !== 0) {\n return yield* Effect.fail(error(result.stderr || result.stdout, result.code))\n }\n }\n\n if (config.extension === \"tar.gz\") {\n const result = yield* run(\"tar\", [\"-xzf\", archive, \"-C\", dir])\n if (result.code !== 0) {\n return yield* Effect.fail(error(result.stderr || result.stdout, result.code))\n }\n }\n\n const extracted = path.join(\n dir,\n `ripgrep-${VERSION}-${config.platform}`,\n process.platform === \"win32\" ? \"rg.exe\" : \"rg\",\n )\n if (!(yield* fs.isFile(extracted))) {\n return yield* Effect.fail(new Error(`ripgrep archive did not contain executable: ${extracted}`))\n }\n\n yield* fs.copyFile(extracted, target)\n if (process.platform === \"win32\") return\n yield* fs.chmod(target, 0o755)\n }, Effect.scoped)\n\n const filepath = yield* Effect.cached(\n Effect.gen(function* () {\n const system = yield* Effect.sync(() => which(process.platform === \"win32\" ? \"rg.exe\" : \"rg\"))\n if (system && (yield* fs.isFile(system).pipe(Effect.orDie))) return system\n\n const target = path.join(Global.Path.bin, `rg${process.platform === \"win32\" ? \".exe\" : \"\"}`)\n if (yield* fs.isFile(target).pipe(Effect.orDie)) return target\n\n const platformKey = `${process.arch}-${process.platform}` as keyof typeof PLATFORM\n const config = PLATFORM[platformKey]\n if (!config) {\n return yield* Effect.fail(new Error(`unsupported platform for ripgrep: ${platformKey}`))\n }\n\n const filename = `ripgrep-${VERSION}-${config.platform}.${config.extension}`\n const url = `https://github.com/BurntSushi/ripgrep/releases/download/${VERSION}/${filename}`\n const archive = path.join(Global.Path.bin, filename)\n\n log.info(\"downloading ripgrep\", { url })\n yield* fs.ensureDir(Global.Path.bin).pipe(Effect.orDie)\n\n const bytes = yield* HttpClientRequest.get(url).pipe(\n http.execute,\n Effect.flatMap((response) => response.arrayBuffer),\n Effect.mapError((cause) => (cause instanceof Error ? cause : new Error(String(cause)))),\n )\n if (bytes.byteLength === 0) {\n return yield* Effect.fail(new Error(`failed to download ripgrep from ${url}`))\n }\n\n yield* fs.writeWithDirs(archive, new Uint8Array(bytes))\n yield* extract(archive, config, target)\n yield* fs.remove(archive, { force: true }).pipe(Effect.ignore)\n return target\n }),\n )\n\n const check = Effect.fnUntraced(function* (cwd: string) {\n if (yield* fs.isDir(cwd).pipe(Effect.orDie)) return\n return yield* Effect.fail(\n Object.assign(new Error(`No such file or directory: '${cwd}'`), {\n code: \"ENOENT\",\n errno: -2,\n path: cwd,\n }),\n )\n })\n\n const command = Effect.fnUntraced(function* (cwd: string, args: string[]) {\n const binary = yield* filepath\n return ChildProcess.make(binary, args, {\n cwd,\n env: env(),\n extendEnv: true,\n stdin: \"ignore\",\n })\n })\n\n const files: Interface[\"files\"] = (input) =>\n Stream.callback<string, PlatformError | Error>((queue) =>\n Effect.gen(function* () {\n yield* Effect.forkScoped(\n Effect.gen(function* () {\n yield* check(input.cwd)\n const handle = yield* spawner.spawn(yield* command(input.cwd, filesArgs(input)))\n const stderr = yield* Stream.mkString(Stream.decodeText(handle.stderr)).pipe(Effect.forkScoped)\n const stdout = yield* Stream.decodeText(handle.stdout).pipe(\n Stream.splitLines,\n Stream.filter((line) => line.length > 0),\n Stream.runForEach((line) => Effect.sync(() => Queue.offerUnsafe(queue, clean(line)))),\n Effect.forkScoped,\n )\n const code = yield* raceAbort(handle.exitCode, input.signal)\n yield* Fiber.join(stdout)\n if (code === 0 || code === 1) {\n Queue.endUnsafe(queue)\n return\n }\n fail(queue, error(yield* Fiber.join(stderr), code))\n }).pipe(\n Effect.catch((err) =>\n Effect.sync(() => {\n fail(queue, err)\n }),\n ),\n ),\n )\n }),\n )\n\n const search: Interface[\"search\"] = Effect.fn(\"Ripgrep.search\")(function* (input: SearchInput) {\n yield* check(input.cwd)\n\n const program = Effect.scoped(\n Effect.gen(function* () {\n const handle = yield* spawner.spawn(yield* command(input.cwd, searchArgs(input)))\n\n const [items, stderr, code] = yield* Effect.all(\n [\n Stream.decodeText(handle.stdout).pipe(\n Stream.splitLines,\n Stream.filter((line) => line.length > 0),\n Stream.mapEffect(parse),\n Stream.filter((item): item is Match => item.type === \"match\"),\n Stream.map((item) => row(item.data)),\n Stream.runCollect,\n Effect.map((chunk) => [...chunk]),\n ),\n Stream.mkString(Stream.decodeText(handle.stderr)),\n handle.exitCode,\n ],\n { concurrency: \"unbounded\" },\n )\n\n if (code !== 0 && code !== 1 && code !== 2) {\n return yield* Effect.fail(error(stderr, code))\n }\n\n return {\n items: code === 1 ? [] : items,\n partial: code === 2,\n }\n }),\n )\n\n return yield* raceAbort(program, input.signal)\n })\n\n const tree: Interface[\"tree\"] = Effect.fn(\"Ripgrep.tree\")(function* (input: TreeInput) {\n log.info(\"tree\", input)\n const list = Array.from(yield* files({ cwd: input.cwd, signal: input.signal }).pipe(Stream.runCollect))\n\n interface Node {\n name: string\n children: Map<string, Node>\n }\n\n function child(node: Node, name: string) {\n const item = node.children.get(name)\n if (item) return item\n const next = { name, children: new Map() }\n node.children.set(name, next)\n return next\n }\n\n function count(node: Node): number {\n return Array.from(node.children.values()).reduce((sum, child) => sum + 1 + count(child), 0)\n }\n\n const root: Node = { name: \"\", children: new Map() }\n for (const file of list) {\n if (file.includes(\".opencode\")) continue\n const parts = file.split(path.sep)\n if (parts.length < 2) continue\n let node = root\n for (const part of parts.slice(0, -1)) {\n node = child(node, part)\n }\n }\n\n const total = count(root)\n const limit = input.limit ?? total\n const lines: string[] = []\n const queue: Array<{ node: Node; path: string }> = Array.from(root.children.values())\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((node) => ({ node, path: node.name }))\n\n let used = 0\n for (let i = 0; i < queue.length && used < limit; i++) {\n const item = queue[i]\n lines.push(item.path)\n used++\n queue.push(\n ...Array.from(item.node.children.values())\n .sort((a, b) => a.name.localeCompare(b.name))\n .map((node) => ({ node, path: `${item.path}/${node.name}` })),\n )\n }\n\n if (total > used) lines.push(`[${total - used} truncated]`)\n return lines.join(\"\\n\")\n })\n\n return Service.of({ filepath, files, tree, search })\n }),\n )\n\nexport const defaultLayer = layer.pipe(\n Layer.provide(FetchHttpClient.layer),\n Layer.provide(FSUtil.defaultLayer),\n Layer.provide(CrossSpawnSpawner.defaultLayer),\n)\n\nexport * as Ripgrep from \"./ripgrep\"\n",
52
+ "export * as Log from \"./log\"\n\nimport path from \"path\"\nimport fs from \"fs/promises\"\nimport { createWriteStream } from \"fs\"\nimport * as Global from \"../global\"\nimport { Schema } from \"effect\"\nimport { Glob } from \"./glob\"\n\nexport const Level = Schema.Literals([\"DEBUG\", \"INFO\", \"WARN\", \"ERROR\"]).annotate({\n identifier: \"LogLevel\",\n description: \"Log level\",\n})\nexport type Level = Schema.Schema.Type<typeof Level>\n\nconst levelPriority: Record<Level, number> = {\n DEBUG: 0,\n INFO: 1,\n WARN: 2,\n ERROR: 3,\n}\nconst keep = 10\nconst initializedRunID = \"OPENCODE_LOG_INITIALIZED_RUN_ID\"\n\nlet level: Level = \"INFO\"\n\nfunction shouldLog(input: Level): boolean {\n return levelPriority[input] >= levelPriority[level]\n}\n\nexport type Logger = {\n debug(message?: any, extra?: Record<string, any>): void\n info(message?: any, extra?: Record<string, any>): void\n error(message?: any, extra?: Record<string, any>): void\n warn(message?: any, extra?: Record<string, any>): void\n tag(key: string, value: string): Logger\n clone(): Logger\n time(\n message: string,\n extra?: Record<string, any>,\n ): {\n stop(): void\n [Symbol.dispose](): void\n }\n}\n\nconst loggers = new Map<string, Logger>()\n\nexport const Default = create({ service: \"default\" })\n\nexport interface Options {\n print: boolean\n dev?: boolean\n level?: Level\n}\n\nlet logpath = \"\"\nexport function file() {\n return logpath\n}\nexport function getLevel(): Level {\n return level\n}\nlet write = (msg: any) => {\n process.stderr.write(msg)\n return msg.length\n}\n\nexport async function init(options: Options) {\n if (options.level) level = options.level\n void cleanup(Global.Path.log)\n if (options.print) return\n logpath = path.join(\n Global.Path.log,\n options.dev ? \"dev.log\" : new Date().toISOString().split(\".\")[0].replace(/:/g, \"\") + \".log\",\n )\n const runID = process.env.OPENCODE_RUN_ID\n const shouldTruncate = !options.dev || !runID || process.env[initializedRunID] !== runID\n if (shouldTruncate) await fs.truncate(logpath).catch(() => {})\n if (options.dev && runID) process.env[initializedRunID] = runID\n const stream = createWriteStream(logpath, { flags: \"a\" })\n write = async (msg: any) => {\n return new Promise((resolve, reject) => {\n stream.write(msg, (err) => {\n if (err) reject(err)\n else resolve(msg.length)\n })\n })\n }\n}\n\nasync function cleanup(dir: string) {\n const files = (\n await Glob.scan(\"????-??-??T??????.log\", {\n cwd: dir,\n absolute: false,\n include: \"file\",\n }).catch(() => [])\n )\n .filter((file) => path.basename(file) === file)\n .sort()\n if (files.length <= keep) return\n\n const doomed = files.slice(0, -keep)\n await Promise.all(doomed.map((file) => fs.unlink(path.join(dir, file)).catch(() => {})))\n}\n\nfunction formatError(error: Error, depth = 0): string {\n const result = error.message\n return error.cause instanceof Error && depth < 10\n ? result + \" Caused by: \" + formatError(error.cause, depth + 1)\n : result\n}\n\nlet last = Date.now()\nexport function create(tags?: Record<string, any>) {\n tags = tags || {}\n\n const service = tags[\"service\"]\n if (service && typeof service === \"string\") {\n const cached = loggers.get(service)\n if (cached) {\n return cached\n }\n }\n\n function build(message: any, extra?: Record<string, any>) {\n const prefix = Object.entries({\n ...tags,\n ...extra,\n })\n .filter(([_, value]) => value !== undefined && value !== null)\n .map(([key, value]) => {\n const prefix = `${key}=`\n if (value instanceof Error) return prefix + formatError(value)\n if (typeof value === \"object\") return prefix + JSON.stringify(value)\n return prefix + value\n })\n .join(\" \")\n const next = new Date()\n const diff = next.getTime() - last\n last = next.getTime()\n return [next.toISOString().split(\".\")[0], \"+\" + diff + \"ms\", prefix, message].filter(Boolean).join(\" \") + \"\\n\"\n }\n const result: Logger = {\n debug(message?: any, extra?: Record<string, any>) {\n if (shouldLog(\"DEBUG\")) {\n write(\"DEBUG \" + build(message, extra))\n }\n },\n info(message?: any, extra?: Record<string, any>) {\n if (shouldLog(\"INFO\")) {\n write(\"INFO \" + build(message, extra))\n }\n },\n error(message?: any, extra?: Record<string, any>) {\n if (shouldLog(\"ERROR\")) {\n write(\"ERROR \" + build(message, extra))\n }\n },\n warn(message?: any, extra?: Record<string, any>) {\n if (shouldLog(\"WARN\")) {\n write(\"WARN \" + build(message, extra))\n }\n },\n tag(key: string, value: string) {\n if (tags) tags[key] = value\n return result\n },\n clone() {\n return create({ ...tags })\n },\n time(message: string, extra?: Record<string, any>) {\n const now = Date.now()\n result.info(message, { status: \"started\", ...extra })\n function stop() {\n result.info(message, {\n status: \"completed\",\n duration: Date.now() - now,\n ...extra,\n })\n }\n return {\n stop,\n [Symbol.dispose]() {\n stop()\n },\n }\n },\n }\n\n if (service && typeof service === \"string\") {\n loggers.set(service, result)\n }\n\n return result\n}\n",
53
+ "export const OPENCODE_RUN_ID = \"OPENCODE_RUN_ID\"\nexport const OPENCODE_PROCESS_ROLE = \"OPENCODE_PROCESS_ROLE\"\n\nexport function ensureRunID() {\n return (process.env[OPENCODE_RUN_ID] ??= crypto.randomUUID())\n}\n\nexport function ensureProcessRole(fallback: \"main\" | \"worker\") {\n return (process.env[OPENCODE_PROCESS_ROLE] ??= fallback)\n}\n\nexport function ensureProcessMetadata(fallback: \"main\" | \"worker\") {\n return {\n runID: ensureRunID(),\n processRole: ensureProcessRole(fallback),\n }\n}\n\nexport function sanitizedProcessEnv(overrides?: Record<string, string>) {\n const env = Object.fromEntries(\n Object.entries(process.env).filter((entry): entry is [string, string] => entry[1] !== undefined),\n )\n return overrides ? Object.assign(env, overrides) : env\n}\n",
54
+ "export * as ToolOutputStore from \"./tool-output-store\"\n\nimport path from \"path\"\nimport { Context, Duration, Effect, Layer, Option, Schedule, Schema } from \"effect\"\nimport { Config } from \"./config\"\nimport { FSUtil } from \"./fs-util\"\nimport { Global } from \"./global\"\nimport { SessionSchema } from \"./session/schema\"\nimport { Identifier } from \"./util/identifier\"\nimport type { ToolOutput } from \"@opencode-ai/llm\"\n\nexport const MAX_LINES = 2_000\nexport const MAX_BYTES = 50 * 1024\nexport const RETENTION = Duration.days(7)\n\nexport const MANAGED_DIRECTORY = \"tool-output\"\n\nexport interface BoundInput {\n readonly sessionID: SessionSchema.ID\n readonly toolCallID: string\n readonly output: ToolOutput\n}\n\nexport interface BoundResult {\n readonly output: ToolOutput\n readonly outputPaths: ReadonlyArray<string>\n}\n\nexport class StorageError extends Schema.TaggedErrorClass<StorageError>()(\"ToolOutputStore.StorageError\", {\n operation: Schema.Literals([\"encode\", \"write\"]),\n cause: Schema.Defect,\n}) {}\n\nexport type Error = StorageError\n\nexport interface Interface {\n readonly limits: () => Effect.Effect<{ readonly maxLines: number; readonly maxBytes: number }>\n readonly bound: (input: BoundInput) => Effect.Effect<BoundResult, Error>\n readonly cleanup: () => Effect.Effect<void>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/v2/ToolOutputStore\") {}\n\nconst takePrefix = (input: string, maximumBytes: number) => {\n let bytes = 0\n let content = \"\"\n for (const char of input) {\n const size = Buffer.byteLength(char, \"utf-8\")\n if (bytes + size > maximumBytes) break\n content += char\n bytes += size\n }\n return content\n}\n\nconst takeSuffix = (input: string, maximumBytes: number) => {\n let bytes = 0\n const content: string[] = []\n for (const char of Array.from(input).toReversed()) {\n const size = Buffer.byteLength(char, \"utf-8\")\n if (bytes + size > maximumBytes) break\n content.unshift(char)\n bytes += size\n }\n return content.join(\"\")\n}\n\nconst preview = (text: string, maxLines: number, maxBytes: number) => {\n const lines = text.split(\"\\n\")\n const headLines = Math.ceil(maxLines / 2)\n const tailLines = Math.floor(maxLines / 2)\n const sampled =\n lines.length <= maxLines\n ? text\n : [\n lines.slice(0, headLines).join(\"\\n\"),\n ...(tailLines > 0 ? [lines.slice(lines.length - tailLines).join(\"\\n\")] : []),\n ].join(\"\\n\")\n if (Buffer.byteLength(sampled, \"utf-8\") <= maxBytes) {\n return lines.length <= maxLines\n ? { head: sampled, tail: \"\" }\n : {\n head: lines.slice(0, headLines).join(\"\\n\"),\n tail: tailLines > 0 ? lines.slice(lines.length - tailLines).join(\"\\n\") : \"\",\n }\n }\n const headBytes = Math.ceil(maxBytes / 2)\n const tailBytes = Math.floor(maxBytes / 2)\n return { head: takePrefix(sampled, headBytes), tail: takeSuffix(sampled, tailBytes) }\n}\n\nconst boundedPreview = (text: string, marker: string, maxLines: number, maxBytes: number) => {\n const markerOnly = takePrefix(marker, maxBytes).split(\"\\n\").slice(0, maxLines).join(\"\\n\")\n const markerBytes = Buffer.byteLength(marker, \"utf-8\")\n if (maxLines <= 4 || maxBytes <= markerBytes + 4) return markerOnly\n const bounded = preview(text, maxLines - 4, maxBytes - markerBytes - 4)\n return bounded.tail ? `${bounded.head}\\n\\n${marker}\\n\\n${bounded.tail}` : `${bounded.head}\\n\\n${marker}`\n}\n\nconst lineCount = (text: string) => {\n let count = 1\n for (const char of text) if (char === \"\\n\") count++\n return count\n}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const fs = yield* FSUtil.Service\n const global = yield* Global.Service\n const config = yield* Effect.serviceOption(Config.Service)\n const directory = path.join(global.data, MANAGED_DIRECTORY)\n const limits = Effect.fn(\"ToolOutputStore.limits\")(function* () {\n if (Option.isNone(config)) return { maxLines: MAX_LINES, maxBytes: MAX_BYTES }\n const entries = yield* config.value.entries().pipe(Effect.catch(() => Effect.succeed([] as Config.Entry[])))\n const configured = Object.assign(\n {},\n ...entries.flatMap((entry) => (entry.type === \"document\" ? [entry.info.tool_output ?? {}] : [])),\n )\n return { maxLines: configured.max_lines ?? MAX_LINES, maxBytes: configured.max_bytes ?? MAX_BYTES }\n })\n\n const write = Effect.fn(\"ToolOutputStore.write\")(function* (content: string) {\n const file = path.join(directory, `tool_${Identifier.ascending()}`)\n yield* fs.ensureDir(directory).pipe(Effect.mapError((cause) => new StorageError({ operation: \"write\", cause })))\n yield* fs\n .writeFileString(file, content, { flag: \"wx\" })\n .pipe(Effect.mapError((cause) => new StorageError({ operation: \"write\", cause })))\n return file\n })\n\n const bound = Effect.fn(\"ToolOutputStore.bound\")(function* (input: BoundInput) {\n const outputLimits = yield* limits()\n const media = input.output.content.filter((item) => item.type === \"file\")\n const text = input.output.content.filter((item) => item.type === \"text\")\n const contextual =\n input.output.content.length === 0\n ? yield* Effect.try({\n try: () => JSON.stringify(input.output.structured, null, 2) ?? String(input.output.structured),\n catch: (cause) => new StorageError({ operation: \"encode\", cause }),\n })\n : text.map((item) => item.text).join(\"\")\n if (\n lineCount(contextual) <= outputLimits.maxLines &&\n Buffer.byteLength(contextual, \"utf-8\") <= outputLimits.maxBytes\n )\n return {\n output: input.output,\n outputPaths: [],\n }\n\n const outputPath = yield* write(contextual)\n const marker = `... output truncated; full content saved to ${outputPath} ...`\n\n return {\n output: {\n structured: input.output.structured,\n content: [\n {\n type: \"text\" as const,\n text: boundedPreview(contextual, marker, outputLimits.maxLines, outputLimits.maxBytes),\n },\n ...media,\n ],\n },\n outputPaths: [outputPath],\n }\n })\n\n const cleanup = Effect.fn(\"ToolOutputStore.cleanup\")(function* () {\n const entries = yield* fs.readDirectory(directory).pipe(Effect.catch(() => Effect.succeed([])))\n const cutoff = Date.now() - Duration.toMillis(RETENTION)\n for (const entry of entries) {\n if (!entry.startsWith(\"tool_\")) continue\n const file = path.join(directory, entry)\n const info = yield* fs.stat(file).pipe(Effect.catch(() => Effect.void))\n const modified = info?.mtime.pipe(\n Option.map((date) => date.getTime()),\n Option.getOrElse(() => 0),\n )\n if (modified !== undefined && modified < cutoff) yield* fs.remove(file).pipe(Effect.catch(() => Effect.void))\n }\n })\n\n return Service.of({ limits, bound, cleanup })\n }),\n)\n\nexport const defaultLayer = layer.pipe(Layer.provide(FSUtil.defaultLayer), Layer.provide(Global.defaultLayer))\n\n/** Runs retention scanning once globally rather than once per active Location. */\nexport const cleanupLayer = Layer.effectDiscard(\n Effect.gen(function* () {\n const store = yield* Service\n yield* store.cleanup().pipe(Effect.repeat(Schedule.spaced(Duration.hours(1))), Effect.forkScoped)\n }),\n)\n\nexport const defaultCleanupLayer = Layer.merge(defaultLayer, cleanupLayer.pipe(Layer.provide(defaultLayer)))\n",
55
+ "export * as Image from \"./image\"\n\nimport { Context, Effect, Layer, Schema } from \"effect\"\nimport { Config } from \"./config\"\nimport { FileSystem } from \"./filesystem\"\n\nexport class ResizerUnavailableError extends Schema.TaggedErrorClass<ResizerUnavailableError>()(\n \"Image.ResizerUnavailableError\",\n {},\n) {}\n\nexport class DecodeError extends Schema.TaggedErrorClass<DecodeError>()(\"Image.DecodeError\", {\n resource: Schema.String,\n}) {\n override get message() {\n return `Image could not be decoded: ${this.resource}`\n }\n}\n\nexport class SizeError extends Schema.TaggedErrorClass<SizeError>()(\"Image.SizeError\", {\n resource: Schema.String,\n width: Schema.Number,\n height: Schema.Number,\n bytes: Schema.Number,\n maxWidth: Schema.Number,\n maxHeight: Schema.Number,\n maxBytes: Schema.Number,\n}) {\n override get message() {\n return `Image ${this.resource} is ${this.width}x${this.height} with base64 size ${this.bytes}, exceeding configured limits ${this.maxWidth}x${this.maxHeight}/${this.maxBytes} bytes`\n }\n}\n\nexport interface Interface {\n readonly normalize: (\n resource: string,\n content: FileSystem.BinaryContent,\n ) => Effect.Effect<FileSystem.BinaryContent, ResizerUnavailableError | DecodeError | SizeError>\n}\n\nexport class Service extends Context.Service<Service, Interface>()(\"@opencode/Image\") {}\n\nexport const layer = Layer.effect(\n Service,\n Effect.gen(function* () {\n const config = yield* Config.Service\n const loadAdapter = yield* Effect.cached(\n Effect.tryPromise({\n try: () => import(\"./image/photon\"),\n catch: () => new ResizerUnavailableError(),\n }).pipe(Effect.flatMap((adapter) => adapter.make)),\n )\n const normalize = Effect.fn(\"Image.normalize\")(function* (resource: string, content: FileSystem.BinaryContent) {\n const image = Object.assign(\n {},\n ...(yield* config.entries()).flatMap((entry) =>\n entry.type === \"document\" && entry.info.attachments?.image ? [entry.info.attachments.image] : [],\n ),\n )\n const normalize = yield* loadAdapter\n return yield* normalize(resource, content, {\n autoResize: image.auto_resize ?? true,\n maxWidth: image.max_width ?? 2_000,\n maxHeight: image.max_height ?? 2_000,\n maxBase64Bytes: image.max_base64_bytes ?? 5 * 1024 * 1024,\n })\n })\n return Service.of({ normalize })\n }),\n)\n\nexport const locationLayer = layer.pipe(Layer.provide(Config.locationLayer))\n"
56
+ ],
57
+ "mappings": ";2vBACA,cAAS,OAAU,MAAC,OAAS,MAC3B,YAAO,MAAM,QAAQ,CAAO,EACxB,EACA,CAAC,CAAO,EAGd,IAAM,GAAY,OACZ,GAAQ,GACR,GAAQ,IACR,GAAS,KACT,GAAwB,QACxB,GAAmC,iBACnC,GAA4C,OAC5C,GAAqC,OACrC,GAAsB,SAUtB,GAA0B,uBAE1B,GAA4B,MAE5B,GAAQ,IAGV,GAAiB,cAErB,GAAI,OAAO,OAAW,IACpB,GAAiB,OAAO,IAAI,aAAa,EAE3C,IAAM,GAAa,GAEb,GAAS,CAAC,EAAQ,EAAK,IAAU,CAErC,OADA,OAAO,eAAe,EAAQ,EAAK,CAAC,OAAK,CAAC,EACnC,GAGH,GAAqB,mBAErB,GAAe,IAAM,GAIrB,GAAgB,KAAS,EAAM,QACnC,GACA,CAAC,EAAO,EAAM,IAAO,EAAK,WAAW,CAAC,GAAK,EAAG,WAAW,CAAC,EACtD,EAGA,EACN,EAGM,GAAsB,KAAW,CACrC,IAAO,UAAU,EACjB,OAAO,EAAQ,MAAM,EAAG,EAAS,EAAS,CAAC,GAcvC,GAAY,CAEhB,CAIE,UACA,IAAM,EACR,EAGA,CAKE,wBACA,CAAC,EAAG,EAAI,IAAO,GACb,EAAG,QAAQ,IAAI,IAAM,EACjB,GACA,GAER,EAMA,CACE,YACA,CAAC,EAAG,IAAO,CACT,IA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