@smthrs/std 0.0.0-stage → 1.0.0-rc.12

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 (582) hide show
  1. package/CHANGELOG.md +148 -0
  2. package/LICENSE +21 -0
  3. package/README.md +156 -2
  4. package/dist/cjs/ApplyPatch.d.ts +174 -0
  5. package/dist/cjs/ApplyPatch.d.ts.map +1 -0
  6. package/dist/cjs/ApplyPatch.js +309 -0
  7. package/dist/cjs/ApplyPatch.js.map +7 -0
  8. package/dist/cjs/Bash.d.ts +390 -0
  9. package/dist/cjs/Bash.d.ts.map +1 -0
  10. package/dist/cjs/Bash.js +333 -0
  11. package/dist/cjs/Bash.js.map +7 -0
  12. package/dist/cjs/Checkpoints.d.ts +322 -0
  13. package/dist/cjs/Checkpoints.d.ts.map +1 -0
  14. package/dist/cjs/Checkpoints.js +233 -0
  15. package/dist/cjs/Checkpoints.js.map +7 -0
  16. package/dist/cjs/Container.d.ts +132 -0
  17. package/dist/cjs/Container.d.ts.map +1 -0
  18. package/dist/cjs/Container.js +113 -0
  19. package/dist/cjs/Container.js.map +7 -0
  20. package/dist/cjs/Edit.d.ts +203 -0
  21. package/dist/cjs/Edit.d.ts.map +1 -0
  22. package/dist/cjs/Edit.js +258 -0
  23. package/dist/cjs/Edit.js.map +7 -0
  24. package/dist/cjs/ExaWebSearch.d.ts +22 -0
  25. package/dist/cjs/ExaWebSearch.d.ts.map +1 -0
  26. package/dist/cjs/ExaWebSearch.js +138 -0
  27. package/dist/cjs/ExaWebSearch.js.map +7 -0
  28. package/dist/cjs/Explore.d.ts +328 -0
  29. package/dist/cjs/Explore.d.ts.map +1 -0
  30. package/dist/cjs/Explore.js +90 -0
  31. package/dist/cjs/Explore.js.map +7 -0
  32. package/dist/cjs/Fetch.d.ts +130 -0
  33. package/dist/cjs/Fetch.d.ts.map +1 -0
  34. package/dist/cjs/Fetch.js +64 -0
  35. package/dist/cjs/Fetch.js.map +7 -0
  36. package/dist/cjs/Glob.d.ts +204 -0
  37. package/dist/cjs/Glob.d.ts.map +1 -0
  38. package/dist/cjs/Glob.js +94 -0
  39. package/dist/cjs/Glob.js.map +7 -0
  40. package/dist/cjs/Grep.d.ts +347 -0
  41. package/dist/cjs/Grep.d.ts.map +1 -0
  42. package/dist/cjs/Grep.js +181 -0
  43. package/dist/cjs/Grep.js.map +7 -0
  44. package/dist/cjs/HttpPost.d.ts +130 -0
  45. package/dist/cjs/HttpPost.d.ts.map +1 -0
  46. package/dist/cjs/HttpPost.js +72 -0
  47. package/dist/cjs/HttpPost.js.map +7 -0
  48. package/dist/cjs/LanguageServer.d.ts +90 -0
  49. package/dist/cjs/LanguageServer.d.ts.map +1 -0
  50. package/dist/cjs/LanguageServer.js +60 -0
  51. package/dist/cjs/LanguageServer.js.map +7 -0
  52. package/dist/cjs/Ls.d.ts +164 -0
  53. package/dist/cjs/Ls.d.ts.map +1 -0
  54. package/dist/cjs/Ls.js +136 -0
  55. package/dist/cjs/Ls.js.map +7 -0
  56. package/dist/cjs/Lsp.d.ts +125 -0
  57. package/dist/cjs/Lsp.d.ts.map +1 -0
  58. package/dist/cjs/Lsp.js +137 -0
  59. package/dist/cjs/Lsp.js.map +7 -0
  60. package/dist/cjs/Manifest.d.ts +918 -0
  61. package/dist/cjs/Manifest.d.ts.map +1 -0
  62. package/dist/cjs/Manifest.js +144 -0
  63. package/dist/cjs/Manifest.js.map +7 -0
  64. package/dist/cjs/NativeSearch.d.ts +38 -0
  65. package/dist/cjs/NativeSearch.d.ts.map +1 -0
  66. package/dist/cjs/NativeSearch.js +326 -0
  67. package/dist/cjs/NativeSearch.js.map +7 -0
  68. package/dist/cjs/NodeLanguageServer.d.ts +128 -0
  69. package/dist/cjs/NodeLanguageServer.d.ts.map +1 -0
  70. package/dist/cjs/NodeLanguageServer.js +796 -0
  71. package/dist/cjs/NodeLanguageServer.js.map +7 -0
  72. package/dist/cjs/PortableSearch.d.ts +36 -0
  73. package/dist/cjs/PortableSearch.d.ts.map +1 -0
  74. package/dist/cjs/PortableSearch.js +240 -0
  75. package/dist/cjs/PortableSearch.js.map +7 -0
  76. package/dist/cjs/Probe.d.ts +193 -0
  77. package/dist/cjs/Probe.d.ts.map +1 -0
  78. package/dist/cjs/Probe.js +134 -0
  79. package/dist/cjs/Probe.js.map +7 -0
  80. package/dist/cjs/Read.d.ts +189 -0
  81. package/dist/cjs/Read.d.ts.map +1 -0
  82. package/dist/cjs/Read.js +223 -0
  83. package/dist/cjs/Read.js.map +7 -0
  84. package/dist/cjs/Relocate.d.ts +73 -0
  85. package/dist/cjs/Relocate.d.ts.map +1 -0
  86. package/dist/cjs/Relocate.js +72 -0
  87. package/dist/cjs/Relocate.js.map +7 -0
  88. package/dist/cjs/RemoteSearch.d.ts +54 -0
  89. package/dist/cjs/RemoteSearch.d.ts.map +1 -0
  90. package/dist/cjs/RemoteSearch.js +134 -0
  91. package/dist/cjs/RemoteSearch.js.map +7 -0
  92. package/dist/cjs/Search.d.ts +163 -0
  93. package/dist/cjs/Search.d.ts.map +1 -0
  94. package/dist/cjs/Search.js +51 -0
  95. package/dist/cjs/Search.js.map +7 -0
  96. package/dist/cjs/SearchConformance.d.ts +115 -0
  97. package/dist/cjs/SearchConformance.d.ts.map +1 -0
  98. package/dist/cjs/SearchConformance.js +172 -0
  99. package/dist/cjs/SearchConformance.js.map +7 -0
  100. package/dist/cjs/SearchContract.d.ts +114 -0
  101. package/dist/cjs/SearchContract.d.ts.map +1 -0
  102. package/dist/cjs/SearchContract.js +339 -0
  103. package/dist/cjs/SearchContract.js.map +7 -0
  104. package/dist/cjs/ShellCommand.d.ts +164 -0
  105. package/dist/cjs/ShellCommand.d.ts.map +1 -0
  106. package/dist/cjs/ShellCommand.js +102 -0
  107. package/dist/cjs/ShellCommand.js.map +7 -0
  108. package/dist/cjs/StdError.d.ts +55 -0
  109. package/dist/cjs/StdError.d.ts.map +1 -0
  110. package/dist/cjs/StdError.js +74 -0
  111. package/dist/cjs/StdError.js.map +7 -0
  112. package/dist/cjs/TestRun.d.ts +311 -0
  113. package/dist/cjs/TestRun.d.ts.map +1 -0
  114. package/dist/cjs/TestRun.js +228 -0
  115. package/dist/cjs/TestRun.js.map +7 -0
  116. package/dist/cjs/TestRunner.d.ts +102 -0
  117. package/dist/cjs/TestRunner.d.ts.map +1 -0
  118. package/dist/cjs/TestRunner.js +54 -0
  119. package/dist/cjs/TestRunner.js.map +7 -0
  120. package/dist/cjs/TreeFingerprint.d.ts +140 -0
  121. package/dist/cjs/TreeFingerprint.d.ts.map +1 -0
  122. package/dist/cjs/TreeFingerprint.js +87 -0
  123. package/dist/cjs/TreeFingerprint.js.map +7 -0
  124. package/dist/cjs/UpdatePlan.d.ts +152 -0
  125. package/dist/cjs/UpdatePlan.d.ts.map +1 -0
  126. package/dist/cjs/UpdatePlan.js +87 -0
  127. package/dist/cjs/UpdatePlan.js.map +7 -0
  128. package/dist/cjs/WebFetch.d.ts +134 -0
  129. package/dist/cjs/WebFetch.d.ts.map +1 -0
  130. package/dist/cjs/WebFetch.js +140 -0
  131. package/dist/cjs/WebFetch.js.map +7 -0
  132. package/dist/cjs/WebSearch.d.ts +181 -0
  133. package/dist/cjs/WebSearch.d.ts.map +1 -0
  134. package/dist/cjs/WebSearch.js +86 -0
  135. package/dist/cjs/WebSearch.js.map +7 -0
  136. package/dist/cjs/Write.d.ts +147 -0
  137. package/dist/cjs/Write.d.ts.map +1 -0
  138. package/dist/cjs/Write.js +122 -0
  139. package/dist/cjs/Write.js.map +7 -0
  140. package/dist/cjs/index.d.ts +129 -0
  141. package/dist/cjs/index.d.ts.map +1 -0
  142. package/dist/cjs/index.js +101 -0
  143. package/dist/cjs/index.js.map +7 -0
  144. package/dist/cjs/internal/ApplyPatch.d.ts +145 -0
  145. package/dist/cjs/internal/ApplyPatch.d.ts.map +1 -0
  146. package/dist/cjs/internal/ApplyPatch.js +462 -0
  147. package/dist/cjs/internal/ApplyPatch.js.map +7 -0
  148. package/dist/cjs/internal/CodexText.d.ts +73 -0
  149. package/dist/cjs/internal/CodexText.d.ts.map +1 -0
  150. package/dist/cjs/internal/CodexText.js +108 -0
  151. package/dist/cjs/internal/CodexText.js.map +7 -0
  152. package/dist/cjs/internal/Declaration.d.ts +49 -0
  153. package/dist/cjs/internal/Declaration.d.ts.map +1 -0
  154. package/dist/cjs/internal/Declaration.js +46 -0
  155. package/dist/cjs/internal/Declaration.js.map +7 -0
  156. package/dist/cjs/internal/Diagnostics.d.ts +77 -0
  157. package/dist/cjs/internal/Diagnostics.d.ts.map +1 -0
  158. package/dist/cjs/internal/Diagnostics.js +89 -0
  159. package/dist/cjs/internal/Diagnostics.js.map +7 -0
  160. package/dist/cjs/internal/EnvelopePrecheck.d.ts +69 -0
  161. package/dist/cjs/internal/EnvelopePrecheck.d.ts.map +1 -0
  162. package/dist/cjs/internal/EnvelopePrecheck.js +323 -0
  163. package/dist/cjs/internal/EnvelopePrecheck.js.map +7 -0
  164. package/dist/cjs/internal/Exec.d.ts +151 -0
  165. package/dist/cjs/internal/Exec.d.ts.map +1 -0
  166. package/dist/cjs/internal/Exec.js +207 -0
  167. package/dist/cjs/internal/Exec.js.map +7 -0
  168. package/dist/cjs/internal/FileMutation.d.ts +109 -0
  169. package/dist/cjs/internal/FileMutation.d.ts.map +1 -0
  170. package/dist/cjs/internal/FileMutation.js +116 -0
  171. package/dist/cjs/internal/FileMutation.js.map +7 -0
  172. package/dist/cjs/internal/FsFailure.d.ts +38 -0
  173. package/dist/cjs/internal/FsFailure.d.ts.map +1 -0
  174. package/dist/cjs/internal/FsFailure.js +40 -0
  175. package/dist/cjs/internal/FsFailure.js.map +7 -0
  176. package/dist/cjs/internal/GitWorktree.d.ts +108 -0
  177. package/dist/cjs/internal/GitWorktree.d.ts.map +1 -0
  178. package/dist/cjs/internal/GitWorktree.js +276 -0
  179. package/dist/cjs/internal/GitWorktree.js.map +7 -0
  180. package/dist/cjs/internal/Grouping.d.ts +51 -0
  181. package/dist/cjs/internal/Grouping.d.ts.map +1 -0
  182. package/dist/cjs/internal/Grouping.js +83 -0
  183. package/dist/cjs/internal/Grouping.js.map +7 -0
  184. package/dist/cjs/internal/Html.d.ts +20 -0
  185. package/dist/cjs/internal/Html.d.ts.map +1 -0
  186. package/dist/cjs/internal/Html.js +81 -0
  187. package/dist/cjs/internal/Html.js.map +7 -0
  188. package/dist/cjs/internal/Http.d.ts +95 -0
  189. package/dist/cjs/internal/Http.d.ts.map +1 -0
  190. package/dist/cjs/internal/Http.js +153 -0
  191. package/dist/cjs/internal/Http.js.map +7 -0
  192. package/dist/cjs/internal/HttpNetwork.d.ts +27 -0
  193. package/dist/cjs/internal/HttpNetwork.d.ts.map +1 -0
  194. package/dist/cjs/internal/HttpNetwork.js +146 -0
  195. package/dist/cjs/internal/HttpNetwork.js.map +7 -0
  196. package/dist/cjs/internal/Ignore.d.ts +37 -0
  197. package/dist/cjs/internal/Ignore.d.ts.map +1 -0
  198. package/dist/cjs/internal/Ignore.js +100 -0
  199. package/dist/cjs/internal/Ignore.js.map +7 -0
  200. package/dist/cjs/internal/LinearRegex.d.ts +19 -0
  201. package/dist/cjs/internal/LinearRegex.d.ts.map +1 -0
  202. package/dist/cjs/internal/LinearRegex.js +166 -0
  203. package/dist/cjs/internal/LinearRegex.js.map +7 -0
  204. package/dist/cjs/internal/Match.d.ts +85 -0
  205. package/dist/cjs/internal/Match.d.ts.map +1 -0
  206. package/dist/cjs/internal/Match.js +99 -0
  207. package/dist/cjs/internal/Match.js.map +7 -0
  208. package/dist/cjs/internal/Paths.d.ts +23 -0
  209. package/dist/cjs/internal/Paths.d.ts.map +1 -0
  210. package/dist/cjs/internal/Paths.js +52 -0
  211. package/dist/cjs/internal/Paths.js.map +7 -0
  212. package/dist/cjs/internal/Preserve.d.ts +25 -0
  213. package/dist/cjs/internal/Preserve.d.ts.map +1 -0
  214. package/dist/cjs/internal/Preserve.js +88 -0
  215. package/dist/cjs/internal/Preserve.js.map +7 -0
  216. package/dist/cjs/internal/Prune.d.ts +35 -0
  217. package/dist/cjs/internal/Prune.d.ts.map +1 -0
  218. package/dist/cjs/internal/Prune.js +54 -0
  219. package/dist/cjs/internal/Prune.js.map +7 -0
  220. package/dist/cjs/internal/RemoteTree.d.ts +60 -0
  221. package/dist/cjs/internal/RemoteTree.d.ts.map +1 -0
  222. package/dist/cjs/internal/RemoteTree.js +123 -0
  223. package/dist/cjs/internal/RemoteTree.js.map +7 -0
  224. package/dist/cjs/internal/SearchContract.d.ts +63 -0
  225. package/dist/cjs/internal/SearchContract.d.ts.map +1 -0
  226. package/dist/cjs/internal/SearchContract.js +46 -0
  227. package/dist/cjs/internal/SearchContract.js.map +7 -0
  228. package/dist/cjs/internal/Symbols.d.ts +39 -0
  229. package/dist/cjs/internal/Symbols.d.ts.map +1 -0
  230. package/dist/cjs/internal/Symbols.js +59 -0
  231. package/dist/cjs/internal/Symbols.js.map +7 -0
  232. package/dist/cjs/internal/Tar.d.ts +23 -0
  233. package/dist/cjs/internal/Tar.d.ts.map +1 -0
  234. package/dist/cjs/internal/Tar.js +86 -0
  235. package/dist/cjs/internal/Tar.js.map +7 -0
  236. package/dist/cjs/internal/TestReport.d.ts +52 -0
  237. package/dist/cjs/internal/TestReport.d.ts.map +1 -0
  238. package/dist/cjs/internal/TestReport.js +131 -0
  239. package/dist/cjs/internal/TestReport.js.map +7 -0
  240. package/dist/cjs/internal/Text.d.ts +125 -0
  241. package/dist/cjs/internal/Text.d.ts.map +1 -0
  242. package/dist/cjs/internal/Text.js +85 -0
  243. package/dist/cjs/internal/Text.js.map +7 -0
  244. package/dist/cjs/internal/Url.d.ts +13 -0
  245. package/dist/cjs/internal/Url.d.ts.map +1 -0
  246. package/dist/cjs/internal/Url.js +35 -0
  247. package/dist/cjs/internal/Url.js.map +7 -0
  248. package/dist/cjs/internal/Walk.d.ts +72 -0
  249. package/dist/cjs/internal/Walk.d.ts.map +1 -0
  250. package/dist/cjs/internal/Walk.js +108 -0
  251. package/dist/cjs/internal/Walk.js.map +7 -0
  252. package/dist/cjs/package.json +1 -0
  253. package/dist/esm/ApplyPatch.d.ts +174 -0
  254. package/dist/esm/ApplyPatch.d.ts.map +1 -0
  255. package/dist/esm/ApplyPatch.js +346 -0
  256. package/dist/esm/ApplyPatch.js.map +1 -0
  257. package/dist/esm/Bash.d.ts +390 -0
  258. package/dist/esm/Bash.d.ts.map +1 -0
  259. package/dist/esm/Bash.js +514 -0
  260. package/dist/esm/Bash.js.map +1 -0
  261. package/dist/esm/Checkpoints.d.ts +322 -0
  262. package/dist/esm/Checkpoints.d.ts.map +1 -0
  263. package/dist/esm/Checkpoints.js +396 -0
  264. package/dist/esm/Checkpoints.js.map +1 -0
  265. package/dist/esm/Container.d.ts +132 -0
  266. package/dist/esm/Container.d.ts.map +1 -0
  267. package/dist/esm/Container.js +151 -0
  268. package/dist/esm/Container.js.map +1 -0
  269. package/dist/esm/Edit.d.ts +203 -0
  270. package/dist/esm/Edit.d.ts.map +1 -0
  271. package/dist/esm/Edit.js +296 -0
  272. package/dist/esm/Edit.js.map +1 -0
  273. package/dist/esm/ExaWebSearch.d.ts +22 -0
  274. package/dist/esm/ExaWebSearch.d.ts.map +1 -0
  275. package/dist/esm/ExaWebSearch.js +107 -0
  276. package/dist/esm/ExaWebSearch.js.map +1 -0
  277. package/dist/esm/Explore.d.ts +328 -0
  278. package/dist/esm/Explore.d.ts.map +1 -0
  279. package/dist/esm/Explore.js +106 -0
  280. package/dist/esm/Explore.js.map +1 -0
  281. package/dist/esm/Fetch.d.ts +130 -0
  282. package/dist/esm/Fetch.d.ts.map +1 -0
  283. package/dist/esm/Fetch.js +91 -0
  284. package/dist/esm/Fetch.js.map +1 -0
  285. package/dist/esm/Glob.d.ts +204 -0
  286. package/dist/esm/Glob.d.ts.map +1 -0
  287. package/dist/esm/Glob.js +177 -0
  288. package/dist/esm/Glob.js.map +1 -0
  289. package/dist/esm/Grep.d.ts +347 -0
  290. package/dist/esm/Grep.d.ts.map +1 -0
  291. package/dist/esm/Grep.js +289 -0
  292. package/dist/esm/Grep.js.map +1 -0
  293. package/dist/esm/HttpPost.d.ts +130 -0
  294. package/dist/esm/HttpPost.d.ts.map +1 -0
  295. package/dist/esm/HttpPost.js +89 -0
  296. package/dist/esm/HttpPost.js.map +1 -0
  297. package/dist/esm/LanguageServer.d.ts +90 -0
  298. package/dist/esm/LanguageServer.d.ts.map +1 -0
  299. package/dist/esm/LanguageServer.js +57 -0
  300. package/dist/esm/LanguageServer.js.map +1 -0
  301. package/dist/esm/Ls.d.ts +164 -0
  302. package/dist/esm/Ls.d.ts.map +1 -0
  303. package/dist/esm/Ls.js +178 -0
  304. package/dist/esm/Ls.js.map +1 -0
  305. package/dist/esm/Lsp.d.ts +125 -0
  306. package/dist/esm/Lsp.d.ts.map +1 -0
  307. package/dist/esm/Lsp.js +165 -0
  308. package/dist/esm/Lsp.js.map +1 -0
  309. package/dist/esm/Manifest.d.ts +918 -0
  310. package/dist/esm/Manifest.d.ts.map +1 -0
  311. package/dist/esm/Manifest.js +153 -0
  312. package/dist/esm/Manifest.js.map +1 -0
  313. package/dist/esm/NativeSearch.d.ts +38 -0
  314. package/dist/esm/NativeSearch.d.ts.map +1 -0
  315. package/dist/esm/NativeSearch.js +378 -0
  316. package/dist/esm/NativeSearch.js.map +1 -0
  317. package/dist/esm/NodeLanguageServer.d.ts +128 -0
  318. package/dist/esm/NodeLanguageServer.d.ts.map +1 -0
  319. package/dist/esm/NodeLanguageServer.js +843 -0
  320. package/dist/esm/NodeLanguageServer.js.map +1 -0
  321. package/dist/esm/PortableSearch.d.ts +36 -0
  322. package/dist/esm/PortableSearch.d.ts.map +1 -0
  323. package/dist/esm/PortableSearch.js +256 -0
  324. package/dist/esm/PortableSearch.js.map +1 -0
  325. package/dist/esm/Probe.d.ts +193 -0
  326. package/dist/esm/Probe.d.ts.map +1 -0
  327. package/dist/esm/Probe.js +225 -0
  328. package/dist/esm/Probe.js.map +1 -0
  329. package/dist/esm/Read.d.ts +189 -0
  330. package/dist/esm/Read.d.ts.map +1 -0
  331. package/dist/esm/Read.js +300 -0
  332. package/dist/esm/Read.js.map +1 -0
  333. package/dist/esm/Relocate.d.ts +73 -0
  334. package/dist/esm/Relocate.d.ts.map +1 -0
  335. package/dist/esm/Relocate.js +153 -0
  336. package/dist/esm/Relocate.js.map +1 -0
  337. package/dist/esm/RemoteSearch.d.ts +54 -0
  338. package/dist/esm/RemoteSearch.d.ts.map +1 -0
  339. package/dist/esm/RemoteSearch.js +162 -0
  340. package/dist/esm/RemoteSearch.js.map +1 -0
  341. package/dist/esm/Search.d.ts +163 -0
  342. package/dist/esm/Search.d.ts.map +1 -0
  343. package/dist/esm/Search.js +47 -0
  344. package/dist/esm/Search.js.map +1 -0
  345. package/dist/esm/SearchConformance.d.ts +115 -0
  346. package/dist/esm/SearchConformance.d.ts.map +1 -0
  347. package/dist/esm/SearchConformance.js +193 -0
  348. package/dist/esm/SearchConformance.js.map +1 -0
  349. package/dist/esm/SearchContract.d.ts +114 -0
  350. package/dist/esm/SearchContract.d.ts.map +1 -0
  351. package/dist/esm/SearchContract.js +461 -0
  352. package/dist/esm/SearchContract.js.map +1 -0
  353. package/dist/esm/ShellCommand.d.ts +164 -0
  354. package/dist/esm/ShellCommand.d.ts.map +1 -0
  355. package/dist/esm/ShellCommand.js +159 -0
  356. package/dist/esm/ShellCommand.js.map +1 -0
  357. package/dist/esm/StdError.d.ts +55 -0
  358. package/dist/esm/StdError.d.ts.map +1 -0
  359. package/dist/esm/StdError.js +71 -0
  360. package/dist/esm/StdError.js.map +1 -0
  361. package/dist/esm/TestRun.d.ts +311 -0
  362. package/dist/esm/TestRun.d.ts.map +1 -0
  363. package/dist/esm/TestRun.js +316 -0
  364. package/dist/esm/TestRun.js.map +1 -0
  365. package/dist/esm/TestRunner.d.ts +102 -0
  366. package/dist/esm/TestRunner.d.ts.map +1 -0
  367. package/dist/esm/TestRunner.js +68 -0
  368. package/dist/esm/TestRunner.js.map +1 -0
  369. package/dist/esm/TreeFingerprint.d.ts +140 -0
  370. package/dist/esm/TreeFingerprint.d.ts.map +1 -0
  371. package/dist/esm/TreeFingerprint.js +170 -0
  372. package/dist/esm/TreeFingerprint.js.map +1 -0
  373. package/dist/esm/UpdatePlan.d.ts +152 -0
  374. package/dist/esm/UpdatePlan.d.ts.map +1 -0
  375. package/dist/esm/UpdatePlan.js +129 -0
  376. package/dist/esm/UpdatePlan.js.map +1 -0
  377. package/dist/esm/WebFetch.d.ts +134 -0
  378. package/dist/esm/WebFetch.d.ts.map +1 -0
  379. package/dist/esm/WebFetch.js +151 -0
  380. package/dist/esm/WebFetch.js.map +1 -0
  381. package/dist/esm/WebSearch.d.ts +181 -0
  382. package/dist/esm/WebSearch.d.ts.map +1 -0
  383. package/dist/esm/WebSearch.js +134 -0
  384. package/dist/esm/WebSearch.js.map +1 -0
  385. package/dist/esm/Write.d.ts +147 -0
  386. package/dist/esm/Write.d.ts.map +1 -0
  387. package/dist/esm/Write.js +144 -0
  388. package/dist/esm/Write.js.map +1 -0
  389. package/dist/esm/index.d.ts +129 -0
  390. package/dist/esm/index.d.ts.map +1 -0
  391. package/dist/esm/index.js +129 -0
  392. package/dist/esm/index.js.map +1 -0
  393. package/dist/esm/internal/ApplyPatch.d.ts +145 -0
  394. package/dist/esm/internal/ApplyPatch.d.ts.map +1 -0
  395. package/dist/esm/internal/ApplyPatch.js +489 -0
  396. package/dist/esm/internal/ApplyPatch.js.map +1 -0
  397. package/dist/esm/internal/CodexText.d.ts +73 -0
  398. package/dist/esm/internal/CodexText.d.ts.map +1 -0
  399. package/dist/esm/internal/CodexText.js +156 -0
  400. package/dist/esm/internal/CodexText.js.map +1 -0
  401. package/dist/esm/internal/Declaration.d.ts +49 -0
  402. package/dist/esm/internal/Declaration.d.ts.map +1 -0
  403. package/dist/esm/internal/Declaration.js +42 -0
  404. package/dist/esm/internal/Declaration.js.map +1 -0
  405. package/dist/esm/internal/Diagnostics.d.ts +77 -0
  406. package/dist/esm/internal/Diagnostics.d.ts.map +1 -0
  407. package/dist/esm/internal/Diagnostics.js +99 -0
  408. package/dist/esm/internal/Diagnostics.js.map +1 -0
  409. package/dist/esm/internal/EnvelopePrecheck.d.ts +69 -0
  410. package/dist/esm/internal/EnvelopePrecheck.d.ts.map +1 -0
  411. package/dist/esm/internal/EnvelopePrecheck.js +426 -0
  412. package/dist/esm/internal/EnvelopePrecheck.js.map +1 -0
  413. package/dist/esm/internal/Exec.d.ts +151 -0
  414. package/dist/esm/internal/Exec.d.ts.map +1 -0
  415. package/dist/esm/internal/Exec.js +285 -0
  416. package/dist/esm/internal/Exec.js.map +1 -0
  417. package/dist/esm/internal/FileMutation.d.ts +109 -0
  418. package/dist/esm/internal/FileMutation.d.ts.map +1 -0
  419. package/dist/esm/internal/FileMutation.js +123 -0
  420. package/dist/esm/internal/FileMutation.js.map +1 -0
  421. package/dist/esm/internal/FsFailure.d.ts +38 -0
  422. package/dist/esm/internal/FsFailure.d.ts.map +1 -0
  423. package/dist/esm/internal/FsFailure.js +39 -0
  424. package/dist/esm/internal/FsFailure.js.map +1 -0
  425. package/dist/esm/internal/GitWorktree.d.ts +108 -0
  426. package/dist/esm/internal/GitWorktree.d.ts.map +1 -0
  427. package/dist/esm/internal/GitWorktree.js +352 -0
  428. package/dist/esm/internal/GitWorktree.js.map +1 -0
  429. package/dist/esm/internal/Grouping.d.ts +51 -0
  430. package/dist/esm/internal/Grouping.d.ts.map +1 -0
  431. package/dist/esm/internal/Grouping.js +99 -0
  432. package/dist/esm/internal/Grouping.js.map +1 -0
  433. package/dist/esm/internal/Html.d.ts +20 -0
  434. package/dist/esm/internal/Html.d.ts.map +1 -0
  435. package/dist/esm/internal/Html.js +70 -0
  436. package/dist/esm/internal/Html.js.map +1 -0
  437. package/dist/esm/internal/Http.d.ts +95 -0
  438. package/dist/esm/internal/Http.d.ts.map +1 -0
  439. package/dist/esm/internal/Http.js +154 -0
  440. package/dist/esm/internal/Http.js.map +1 -0
  441. package/dist/esm/internal/HttpNetwork.d.ts +27 -0
  442. package/dist/esm/internal/HttpNetwork.d.ts.map +1 -0
  443. package/dist/esm/internal/HttpNetwork.js +114 -0
  444. package/dist/esm/internal/HttpNetwork.js.map +1 -0
  445. package/dist/esm/internal/Ignore.d.ts +37 -0
  446. package/dist/esm/internal/Ignore.d.ts.map +1 -0
  447. package/dist/esm/internal/Ignore.js +128 -0
  448. package/dist/esm/internal/Ignore.js.map +1 -0
  449. package/dist/esm/internal/LinearRegex.d.ts +19 -0
  450. package/dist/esm/internal/LinearRegex.d.ts.map +1 -0
  451. package/dist/esm/internal/LinearRegex.js +176 -0
  452. package/dist/esm/internal/LinearRegex.js.map +1 -0
  453. package/dist/esm/internal/Match.d.ts +85 -0
  454. package/dist/esm/internal/Match.d.ts.map +1 -0
  455. package/dist/esm/internal/Match.js +142 -0
  456. package/dist/esm/internal/Match.js.map +1 -0
  457. package/dist/esm/internal/Paths.d.ts +23 -0
  458. package/dist/esm/internal/Paths.d.ts.map +1 -0
  459. package/dist/esm/internal/Paths.js +40 -0
  460. package/dist/esm/internal/Paths.js.map +1 -0
  461. package/dist/esm/internal/Preserve.d.ts +25 -0
  462. package/dist/esm/internal/Preserve.d.ts.map +1 -0
  463. package/dist/esm/internal/Preserve.js +70 -0
  464. package/dist/esm/internal/Preserve.js.map +1 -0
  465. package/dist/esm/internal/Prune.d.ts +35 -0
  466. package/dist/esm/internal/Prune.d.ts.map +1 -0
  467. package/dist/esm/internal/Prune.js +60 -0
  468. package/dist/esm/internal/Prune.js.map +1 -0
  469. package/dist/esm/internal/RemoteTree.d.ts +60 -0
  470. package/dist/esm/internal/RemoteTree.d.ts.map +1 -0
  471. package/dist/esm/internal/RemoteTree.js +132 -0
  472. package/dist/esm/internal/RemoteTree.js.map +1 -0
  473. package/dist/esm/internal/SearchContract.d.ts +63 -0
  474. package/dist/esm/internal/SearchContract.d.ts.map +1 -0
  475. package/dist/esm/internal/SearchContract.js +66 -0
  476. package/dist/esm/internal/SearchContract.js.map +1 -0
  477. package/dist/esm/internal/Symbols.d.ts +39 -0
  478. package/dist/esm/internal/Symbols.d.ts.map +1 -0
  479. package/dist/esm/internal/Symbols.js +79 -0
  480. package/dist/esm/internal/Symbols.js.map +1 -0
  481. package/dist/esm/internal/Tar.d.ts +23 -0
  482. package/dist/esm/internal/Tar.d.ts.map +1 -0
  483. package/dist/esm/internal/Tar.js +97 -0
  484. package/dist/esm/internal/Tar.js.map +1 -0
  485. package/dist/esm/internal/TestReport.d.ts +52 -0
  486. package/dist/esm/internal/TestReport.d.ts.map +1 -0
  487. package/dist/esm/internal/TestReport.js +172 -0
  488. package/dist/esm/internal/TestReport.js.map +1 -0
  489. package/dist/esm/internal/Text.d.ts +125 -0
  490. package/dist/esm/internal/Text.d.ts.map +1 -0
  491. package/dist/esm/internal/Text.js +141 -0
  492. package/dist/esm/internal/Text.js.map +1 -0
  493. package/dist/esm/internal/Url.d.ts +13 -0
  494. package/dist/esm/internal/Url.d.ts.map +1 -0
  495. package/dist/esm/internal/Url.js +27 -0
  496. package/dist/esm/internal/Url.js.map +1 -0
  497. package/dist/esm/internal/Walk.d.ts +72 -0
  498. package/dist/esm/internal/Walk.d.ts.map +1 -0
  499. package/dist/esm/internal/Walk.js +126 -0
  500. package/dist/esm/internal/Walk.js.map +1 -0
  501. package/docs/README.md +119 -0
  502. package/docs/api.md +499 -0
  503. package/docs/concepts/effects-and-capabilities.md +138 -0
  504. package/docs/concepts/flows-and-handlers.md +115 -0
  505. package/docs/concepts/limits-and-disclosure.md +105 -0
  506. package/docs/concepts/search-contract.md +182 -0
  507. package/docs/guides/bind-the-standard-flows.md +116 -0
  508. package/docs/guides/implement-a-search-peer.md +133 -0
  509. package/docs/guides/pin-a-checkpoint.md +161 -0
  510. package/docs/guides/query-a-language-server.md +257 -0
  511. package/docs/guides/reach-the-network.md +141 -0
  512. package/docs/guides/read-and-edit-a-file.md +240 -0
  513. package/docs/guides/run-a-shell-command.md +236 -0
  514. package/docs/guides/run-the-test-suite.md +154 -0
  515. package/docs/guides/search-a-workspace.md +148 -0
  516. package/docs/installation.md +115 -0
  517. package/docs/quickstart.md +125 -0
  518. package/docs/reference/flows.md +556 -0
  519. package/docs/troubleshooting.md +347 -0
  520. package/package.json +449 -3
  521. package/src/ApplyPatch.ts +458 -0
  522. package/src/Bash.ts +619 -0
  523. package/src/Checkpoints.ts +589 -0
  524. package/src/Container.ts +212 -0
  525. package/src/Edit.ts +366 -0
  526. package/src/ExaWebSearch.ts +145 -0
  527. package/src/Explore.ts +139 -0
  528. package/src/Fetch.ts +117 -0
  529. package/src/Glob.ts +200 -0
  530. package/src/Grep.ts +320 -0
  531. package/src/HttpPost.ts +120 -0
  532. package/src/LanguageServer.ts +110 -0
  533. package/src/Ls.ts +228 -0
  534. package/src/Lsp.ts +184 -0
  535. package/src/Manifest.ts +162 -0
  536. package/src/NativeSearch.ts +457 -0
  537. package/src/NodeLanguageServer.ts +1148 -0
  538. package/src/PortableSearch.ts +284 -0
  539. package/src/Probe.ts +284 -0
  540. package/src/Read.ts +359 -0
  541. package/src/Relocate.ts +166 -0
  542. package/src/RemoteSearch.ts +199 -0
  543. package/src/Search.ts +185 -0
  544. package/src/SearchConformance.ts +288 -0
  545. package/src/SearchContract.ts +489 -0
  546. package/src/ShellCommand.ts +201 -0
  547. package/src/StdError.ts +80 -0
  548. package/src/TestRun.ts +401 -0
  549. package/src/TestRunner.ts +119 -0
  550. package/src/TreeFingerprint.ts +200 -0
  551. package/src/UpdatePlan.ts +171 -0
  552. package/src/WebFetch.ts +194 -0
  553. package/src/WebSearch.ts +165 -0
  554. package/src/Write.ts +195 -0
  555. package/src/index.ts +157 -0
  556. package/src/internal/ApplyPatch.ts +601 -0
  557. package/src/internal/CodexText.ts +182 -0
  558. package/src/internal/Declaration.ts +60 -0
  559. package/src/internal/Diagnostics.ts +134 -0
  560. package/src/internal/EnvelopePrecheck.ts +489 -0
  561. package/src/internal/Exec.ts +427 -0
  562. package/src/internal/FileMutation.ts +231 -0
  563. package/src/internal/FsFailure.ts +51 -0
  564. package/src/internal/GitWorktree.ts +491 -0
  565. package/src/internal/Grouping.ts +106 -0
  566. package/src/internal/Html.ts +87 -0
  567. package/src/internal/Http.ts +209 -0
  568. package/src/internal/HttpNetwork.ts +153 -0
  569. package/src/internal/Ignore.ts +135 -0
  570. package/src/internal/LinearRegex.ts +173 -0
  571. package/src/internal/Match.ts +172 -0
  572. package/src/internal/Paths.ts +42 -0
  573. package/src/internal/Preserve.ts +108 -0
  574. package/src/internal/Prune.ts +62 -0
  575. package/src/internal/RemoteTree.ts +159 -0
  576. package/src/internal/SearchContract.ts +77 -0
  577. package/src/internal/Symbols.ts +88 -0
  578. package/src/internal/Tar.ts +95 -0
  579. package/src/internal/TestReport.ts +194 -0
  580. package/src/internal/Text.ts +185 -0
  581. package/src/internal/Url.ts +23 -0
  582. package/src/internal/Walk.ts +176 -0
@@ -0,0 +1,181 @@
1
+ /**
2
+ * The `websearch` flow and the provider seam it runs through.
3
+ *
4
+ * The flow is provider-neutral: it hands the query to the bound
5
+ * {@link WebSearch} service and returns normalized results. A host binds a
6
+ * provider such as `ExaWebSearch.layer`; {@link layerNoop} fails every search
7
+ * with `provider_unavailable`.
8
+ *
9
+ * @since 1.0.0
10
+ */
11
+ import { Context, Effect, Layer, Schema } from "effect";
12
+ import * as StdError from "./StdError.ts";
13
+ /**
14
+ * The registry name of the `websearch` flow.
15
+ *
16
+ * @category identifiers
17
+ * @since 1.0.0
18
+ */
19
+ export declare const name = "websearch";
20
+ /**
21
+ * The one-line description the model sees for the `websearch` flow.
22
+ *
23
+ * @category descriptions
24
+ * @since 1.0.0
25
+ */
26
+ export declare const description = "Search the web through a configured provider and return normalized results.";
27
+ /**
28
+ * What the `websearch` flow accepts.
29
+ *
30
+ * @category schemas
31
+ * @since 1.0.0
32
+ */
33
+ export declare const Input: Schema.Struct<{
34
+ readonly query: Schema.NonEmptyString;
35
+ readonly numResults: Schema.optional<Schema.Int>;
36
+ readonly freshness: Schema.optional<Schema.Literals<readonly ["day", "week", "month", "year"]>>;
37
+ }>;
38
+ /**
39
+ * Decoded input accepted by the `websearch` flow.
40
+ *
41
+ * @category models
42
+ * @since 1.0.0
43
+ */
44
+ export type Input = typeof Input.Type;
45
+ /**
46
+ * One search hit, normalized across providers.
47
+ *
48
+ * @category schemas
49
+ * @since 1.0.0
50
+ */
51
+ export declare const Result: Schema.Struct<{
52
+ readonly title: Schema.String;
53
+ readonly url: Schema.String;
54
+ readonly snippet: Schema.String;
55
+ readonly publishedAt: Schema.optional<Schema.String>;
56
+ }>;
57
+ /**
58
+ * What the `websearch` flow returns.
59
+ *
60
+ * @category schemas
61
+ * @since 1.0.0
62
+ */
63
+ export declare const Output: Schema.Struct<{
64
+ readonly results: Schema.$Array<Schema.Struct<{
65
+ readonly title: Schema.String;
66
+ readonly url: Schema.String;
67
+ readonly snippet: Schema.String;
68
+ readonly publishedAt: Schema.optional<Schema.String>;
69
+ }>>;
70
+ }>;
71
+ /**
72
+ * Decoded output returned by the `websearch` flow.
73
+ *
74
+ * @category models
75
+ * @since 1.0.0
76
+ */
77
+ export type Output = typeof Output.Type;
78
+ /**
79
+ * The declared effect envelope of the `websearch` flow, before any input is known.
80
+ *
81
+ * @category effects
82
+ * @since 1.0.0
83
+ */
84
+ export declare const effects: import("@smthrs/plan/Effects").Declaration;
85
+ /**
86
+ * Narrows {@link effects} to what this particular input actually touches.
87
+ *
88
+ * @category effects
89
+ * @since 1.0.0
90
+ */
91
+ export declare const effectsFor: (_input: typeof Input.Type) => import("@smthrs/plan/Effects").Declaration;
92
+ /**
93
+ * The authority the `websearch` flow requires.
94
+ *
95
+ * @category capabilities
96
+ * @since 1.0.0
97
+ */
98
+ export declare const capabilities: string[];
99
+ /**
100
+ * The `websearch` flow declaration: schemas, capabilities, and effects, with the
101
+ * implementation attached separately.
102
+ *
103
+ * @category flows
104
+ * @since 1.0.0
105
+ */
106
+ export declare const flow: {
107
+ readonly name: "websearch";
108
+ readonly description: "Search the web through a configured provider and return normalized results.";
109
+ readonly input: Schema.Struct<{
110
+ readonly query: Schema.NonEmptyString;
111
+ readonly numResults: Schema.optional<Schema.Int>;
112
+ readonly freshness: Schema.optional<Schema.Literals<readonly ["day", "week", "month", "year"]>>;
113
+ }>;
114
+ readonly output: Schema.Struct<{
115
+ readonly results: Schema.$Array<Schema.Struct<{
116
+ readonly title: Schema.String;
117
+ readonly url: Schema.String;
118
+ readonly snippet: Schema.String;
119
+ readonly publishedAt: Schema.optional<Schema.String>;
120
+ }>>;
121
+ }>;
122
+ readonly capabilities: string[];
123
+ readonly effects: import("@smthrs/plan/Effects").Declaration;
124
+ };
125
+ /**
126
+ * The provider seam a web search is served through.
127
+ *
128
+ * @category services
129
+ * @since 1.0.0
130
+ */
131
+ export interface WebSearch {
132
+ readonly search: (input: typeof Input.Type) => Effect.Effect<typeof Output.Type, StdError.StdError>;
133
+ }
134
+ /**
135
+ * The {@link WebSearch} service tag.
136
+ *
137
+ * @category services
138
+ * @since 1.0.0
139
+ */
140
+ export declare const WebSearch: Context.Service<WebSearch, WebSearch>;
141
+ /**
142
+ * Builds a {@link WebSearch} from an implementation of its one method.
143
+ *
144
+ * @category constructors
145
+ * @since 1.0.0
146
+ */
147
+ export declare const make: (service: WebSearch) => WebSearch;
148
+ /**
149
+ * A {@link WebSearch} that fails every search with `provider_unavailable`,
150
+ * for an environment with no provider configured.
151
+ *
152
+ * @category constructors
153
+ * @since 1.0.0
154
+ */
155
+ export declare const makeNoop: () => WebSearch;
156
+ /**
157
+ * Provides {@link makeNoop}.
158
+ *
159
+ * @category layers
160
+ * @since 1.0.0
161
+ */
162
+ export declare const layerNoop: Layer.Layer<WebSearch>;
163
+ /**
164
+ * Runs the `websearch` flow: searches the web through the configured provider.
165
+ *
166
+ * @category handlers
167
+ * @since 1.0.0
168
+ */
169
+ export declare const run: (input: {
170
+ readonly query: string;
171
+ readonly numResults?: number | undefined;
172
+ readonly freshness?: "day" | "week" | "month" | "year" | undefined;
173
+ }) => Effect.Effect<{
174
+ readonly results: readonly {
175
+ readonly title: string;
176
+ readonly url: string;
177
+ readonly snippet: string;
178
+ readonly publishedAt?: string | undefined;
179
+ }[];
180
+ }, StdError.StdError, WebSearch>;
181
+ //# sourceMappingURL=WebSearch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSearch.d.ts","sourceRoot":"","sources":["../../src/WebSearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEvD,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,cAAc,CAAA;AAC/B;;;;;GAKG;AACH,eAAO,MAAM,WAAW,gFAAgF,CAAA;AACxG;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;;EAQhB,CAAA;AACF;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AACrC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;EAOjB,CAAA;AACF;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;;;;EAAmD,CAAA;AACtE;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AACvC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,4CAAwE,CAAA;AAC5F;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,QAAQ,OAAO,KAAK,CAAC,IAAI,+CAAY,CAAA;AAChE;;;;;GAKG;AACH,eAAO,MAAM,YAAY,UAAgC,CAAA;AACzD;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;CAAsF,CAAA;AAEvG;;;;;GAKG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,CAAC,IAAI,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;CACpG;AACD;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,OAAO,CAAC,SAAS,EAAE,SAAS,CAA4C,CAAA;AACxG;;;;;GAKG;AACH,eAAO,MAAM,IAAI,GAAI,SAAS,SAAS,KAAG,SAAkC,CAAA;AAC5E;;;;;;GAMG;AACH,eAAO,MAAM,QAAQ,QAAO,SAMxB,CAAA;AACJ;;;;;GAKG;AACH,eAAO,MAAM,SAAS,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,CAAwC,CAAA;AACrF;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;;;;;gCAKd,CAAA"}
@@ -0,0 +1,134 @@
1
+ /**
2
+ * The `websearch` flow and the provider seam it runs through.
3
+ *
4
+ * The flow is provider-neutral: it hands the query to the bound
5
+ * {@link WebSearch} service and returns normalized results. A host binds a
6
+ * provider such as `ExaWebSearch.layer`; {@link layerNoop} fails every search
7
+ * with `provider_unavailable`.
8
+ *
9
+ * @since 1.0.0
10
+ */
11
+ import { Context, Effect, Layer, Schema } from "effect";
12
+ import { capability, envelope } from "./internal/Declaration.js";
13
+ import * as StdError from "./StdError.js";
14
+ /**
15
+ * The registry name of the `websearch` flow.
16
+ *
17
+ * @category identifiers
18
+ * @since 1.0.0
19
+ */
20
+ export const name = "websearch";
21
+ /**
22
+ * The one-line description the model sees for the `websearch` flow.
23
+ *
24
+ * @category descriptions
25
+ * @since 1.0.0
26
+ */
27
+ export const description = "Search the web through a configured provider and return normalized results.";
28
+ /**
29
+ * What the `websearch` flow accepts.
30
+ *
31
+ * @category schemas
32
+ * @since 1.0.0
33
+ */
34
+ export const Input = Schema.Struct({
35
+ query: Schema.NonEmptyString.annotate({ description: "Search query" }),
36
+ numResults: Schema.optional(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 20 }))).annotate({
37
+ description: "Maximum number of results, from 1 through 20; defaults to 8"
38
+ }),
39
+ freshness: Schema.optional(Schema.Literals(["day", "week", "month", "year"])).annotate({
40
+ description: "Optional age limit for published results"
41
+ })
42
+ });
43
+ /**
44
+ * One search hit, normalized across providers.
45
+ *
46
+ * @category schemas
47
+ * @since 1.0.0
48
+ */
49
+ export const Result = Schema.Struct({
50
+ title: Schema.String.annotate({ description: "Result title" }),
51
+ url: Schema.String.annotate({ description: "Absolute result URL" }),
52
+ snippet: Schema.String.annotate({ description: "Provider-normalized result excerpt" }),
53
+ publishedAt: Schema.optional(Schema.String).annotate({
54
+ description: "Provider publication timestamp when available"
55
+ })
56
+ });
57
+ /**
58
+ * What the `websearch` flow returns.
59
+ *
60
+ * @category schemas
61
+ * @since 1.0.0
62
+ */
63
+ export const Output = Schema.Struct({ results: Schema.Array(Result) });
64
+ /**
65
+ * The declared effect envelope of the `websearch` flow, before any input is known.
66
+ *
67
+ * @category effects
68
+ * @since 1.0.0
69
+ */
70
+ export const effects = envelope({ tier: "sealed", mode: "expected", reads: [], writes: [] });
71
+ /**
72
+ * Narrows {@link effects} to what this particular input actually touches.
73
+ *
74
+ * @category effects
75
+ * @since 1.0.0
76
+ */
77
+ export const effectsFor = (_input) => effects;
78
+ /**
79
+ * The authority the `websearch` flow requires.
80
+ *
81
+ * @category capabilities
82
+ * @since 1.0.0
83
+ */
84
+ export const capabilities = [capability("net:post", "*")];
85
+ /**
86
+ * The `websearch` flow declaration: schemas, capabilities, and effects, with the
87
+ * implementation attached separately.
88
+ *
89
+ * @category flows
90
+ * @since 1.0.0
91
+ */
92
+ export const flow = { name, description, input: Input, output: Output, capabilities, effects };
93
+ /**
94
+ * The {@link WebSearch} service tag.
95
+ *
96
+ * @category services
97
+ * @since 1.0.0
98
+ */
99
+ export const WebSearch = Context.Service("@smthrs/std/WebSearch");
100
+ /**
101
+ * Builds a {@link WebSearch} from an implementation of its one method.
102
+ *
103
+ * @category constructors
104
+ * @since 1.0.0
105
+ */
106
+ export const make = (service) => WebSearch.of(service);
107
+ /**
108
+ * A {@link WebSearch} that fails every search with `provider_unavailable`,
109
+ * for an environment with no provider configured.
110
+ *
111
+ * @category constructors
112
+ * @since 1.0.0
113
+ */
114
+ export const makeNoop = () => make({
115
+ search: () => Effect.fail(new StdError.StdError({ code: "provider_unavailable", message: "No web search provider is configured" }))
116
+ });
117
+ /**
118
+ * Provides {@link makeNoop}.
119
+ *
120
+ * @category layers
121
+ * @since 1.0.0
122
+ */
123
+ export const layerNoop = Layer.succeed(WebSearch, makeNoop());
124
+ /**
125
+ * Runs the `websearch` flow: searches the web through the configured provider.
126
+ *
127
+ * @category handlers
128
+ * @since 1.0.0
129
+ */
130
+ export const run = Effect.fn("WebSearch.run")(function* (input) {
131
+ const provider = yield* WebSearch;
132
+ return yield* provider.search(input);
133
+ });
134
+ //# sourceMappingURL=WebSearch.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WebSearch.js","sourceRoot":"","sources":["../../src/WebSearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,WAAW,CAAA;AAC/B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,6EAA6E,CAAA;AACxG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,WAAW,EAAE,cAAc,EAAE,CAAC;IACtE,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE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A;AAChE;;;;;GAKG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAU,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAA;AACzD;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,OAAO,EAAW,CAAA;AAWvG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAA0C,OAAO,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAA;AACxG;;;;;GAKG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,OAAkB,EAAa,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,CAAC,CAAA;AAC5E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAG,GAAc,EAAE,CACtC,IAAI,CAAC;IACH,MAAM,EAAE,GAAG,EAAE,CACX,MAAM,CAAC,IAAI,CACT,IAAI,QAAQ,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,sBAAsB,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAAC,CACzG;CACJ,CAAC,CAAA;AACJ;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAA2B,KAAK,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,EAAE,CAAC,CAAA;AACrF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,GAAG,GAAG,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,EACrD,KAAwB;IAExB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,SAAS,CAAA;IACjC,OAAO,KAAK,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AACtC,CAAC,CAAC,CAAA","sourcesContent":["/**\n * The `websearch` flow and the provider seam it runs through.\n *\n * The flow is provider-neutral: it hands the query to the bound\n * {@link WebSearch} service and returns normalized results. A host binds a\n * provider such as `ExaWebSearch.layer`; {@link layerNoop} fails every search\n * with `provider_unavailable`.\n *\n * @since 1.0.0\n */\n\nimport { Context, Effect, Layer, Schema } from \"effect\"\nimport { capability, envelope } from \"./internal/Declaration.ts\"\nimport * as StdError from \"./StdError.ts\"\n\n/**\n * The registry name of the `websearch` flow.\n *\n * @category identifiers\n * @since 1.0.0\n */\nexport const name = \"websearch\"\n/**\n * The one-line description the model sees for the `websearch` flow.\n *\n * @category descriptions\n * @since 1.0.0\n */\nexport const description = \"Search the web through a configured provider and return normalized results.\"\n/**\n * What the `websearch` flow accepts.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Input = Schema.Struct({\n query: Schema.NonEmptyString.annotate({ description: \"Search query\" }),\n numResults: Schema.optional(Schema.Int.check(Schema.isBetween({ minimum: 1, maximum: 20 }))).annotate({\n description: \"Maximum number of results, from 1 through 20; defaults to 8\"\n }),\n freshness: Schema.optional(Schema.Literals([\"day\", \"week\", \"month\", \"year\"])).annotate({\n description: \"Optional age limit for published results\"\n })\n})\n/**\n * Decoded input accepted by the `websearch` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Input = typeof Input.Type\n/**\n * One search hit, normalized across providers.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Result = Schema.Struct({\n title: Schema.String.annotate({ description: \"Result title\" }),\n url: Schema.String.annotate({ description: \"Absolute result URL\" }),\n snippet: Schema.String.annotate({ description: \"Provider-normalized result excerpt\" }),\n publishedAt: Schema.optional(Schema.String).annotate({\n description: \"Provider publication timestamp when available\"\n })\n})\n/**\n * What the `websearch` flow returns.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Output = Schema.Struct({ results: Schema.Array(Result) })\n/**\n * Decoded output returned by the `websearch` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Output = typeof Output.Type\n/**\n * The declared effect envelope of the `websearch` flow, before any input is known.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effects = envelope({ tier: \"sealed\", mode: \"expected\", reads: [], writes: [] })\n/**\n * Narrows {@link effects} to what this particular input actually touches.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effectsFor = (_input: typeof Input.Type) => effects\n/**\n * The authority the `websearch` flow requires.\n *\n * @category capabilities\n * @since 1.0.0\n */\nexport const capabilities = [capability(\"net:post\", \"*\")]\n/**\n * The `websearch` flow declaration: schemas, capabilities, and effects, with the\n * implementation attached separately.\n *\n * @category flows\n * @since 1.0.0\n */\nexport const flow = { name, description, input: Input, output: Output, capabilities, effects } as const\n\n/**\n * The provider seam a web search is served through.\n *\n * @category services\n * @since 1.0.0\n */\nexport interface WebSearch {\n readonly search: (input: typeof Input.Type) => Effect.Effect<typeof Output.Type, StdError.StdError>\n}\n/**\n * The {@link WebSearch} service tag.\n *\n * @category services\n * @since 1.0.0\n */\nexport const WebSearch: Context.Service<WebSearch, WebSearch> = Context.Service(\"@smthrs/std/WebSearch\")\n/**\n * Builds a {@link WebSearch} from an implementation of its one method.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const make = (service: WebSearch): WebSearch => WebSearch.of(service)\n/**\n * A {@link WebSearch} that fails every search with `provider_unavailable`,\n * for an environment with no provider configured.\n *\n * @category constructors\n * @since 1.0.0\n */\nexport const makeNoop = (): WebSearch =>\n make({\n search: () =>\n Effect.fail(\n new StdError.StdError({ code: \"provider_unavailable\", message: \"No web search provider is configured\" })\n )\n })\n/**\n * Provides {@link makeNoop}.\n *\n * @category layers\n * @since 1.0.0\n */\nexport const layerNoop: Layer.Layer<WebSearch> = Layer.succeed(WebSearch, makeNoop())\n/**\n * Runs the `websearch` flow: searches the web through the configured provider.\n *\n * @category handlers\n * @since 1.0.0\n */\nexport const run = Effect.fn(\"WebSearch.run\")(function*(\n input: typeof Input.Type\n): Effect.fn.Return<typeof Output.Type, StdError.StdError, WebSearch> {\n const provider = yield* WebSearch\n return yield* provider.search(input)\n})\n"]}
@@ -0,0 +1,147 @@
1
+ /**
2
+ * Write flow declaration and portable handler.
3
+ *
4
+ * @since 1.0.0
5
+ */
6
+ import * as Effect from "effect/Effect";
7
+ import * as FileSystem from "effect/FileSystem";
8
+ import * as Schema from "effect/Schema";
9
+ import * as StdError from "./StdError.ts";
10
+ /**
11
+ * Registry name for the write flow.
12
+ *
13
+ * @category identifiers
14
+ * @since 1.0.0
15
+ */
16
+ export declare const name = "write";
17
+ /**
18
+ * Model-facing description of the write flow.
19
+ *
20
+ * @category descriptions
21
+ * @since 1.0.0
22
+ */
23
+ export declare const description = "Write UTF-8 text to a path, replacing any existing file; parent directories are created. Prefer edit for targeted changes.";
24
+ /**
25
+ * Input schema for the write flow.
26
+ *
27
+ * @category schemas
28
+ * @since 1.0.0
29
+ */
30
+ export declare const Input: Schema.Struct<{
31
+ readonly path: Schema.String;
32
+ readonly content: Schema.String;
33
+ }>;
34
+ /**
35
+ * Decoded input accepted by the `write` flow.
36
+ *
37
+ * @category models
38
+ * @since 1.0.0
39
+ */
40
+ export type Input = typeof Input.Type;
41
+ /**
42
+ * Output schema for the write flow.
43
+ *
44
+ * @category schemas
45
+ * @since 1.0.0
46
+ */
47
+ export declare const Output: Schema.Struct<{
48
+ readonly path: Schema.String;
49
+ readonly bytesWritten: Schema.Number;
50
+ readonly created: Schema.Boolean;
51
+ }>;
52
+ /**
53
+ * Decoded output returned by the `write` flow.
54
+ *
55
+ * @category models
56
+ * @since 1.0.0
57
+ */
58
+ export type Output = typeof Output.Type;
59
+ /**
60
+ * Static conservative effect envelope for the write flow.
61
+ *
62
+ * @category effects
63
+ * @since 1.0.0
64
+ */
65
+ export declare const effects: import("@smthrs/plan/Effects").Declaration;
66
+ /**
67
+ * Narrows the write effect envelope to one input path.
68
+ *
69
+ * @category effects
70
+ * @since 1.0.0
71
+ */
72
+ export declare const effectsFor: (input: typeof Input.Type) => import("@smthrs/plan/Effects").Declaration;
73
+ /**
74
+ * Capabilities required by the write flow.
75
+ *
76
+ * @category capabilities
77
+ * @since 1.0.0
78
+ */
79
+ export declare const capabilities: string[];
80
+ /**
81
+ * Declaration-only write flow.
82
+ *
83
+ * @category flows
84
+ * @since 1.0.0
85
+ */
86
+ export declare const flow: {
87
+ readonly name: "write";
88
+ readonly description: "Write UTF-8 text to a path, replacing any existing file; parent directories are created. Prefer edit for targeted changes.";
89
+ readonly input: Schema.Struct<{
90
+ readonly path: Schema.String;
91
+ readonly content: Schema.String;
92
+ }>;
93
+ readonly output: Schema.Struct<{
94
+ readonly path: Schema.String;
95
+ readonly bytesWritten: Schema.Number;
96
+ readonly created: Schema.Boolean;
97
+ }>;
98
+ readonly capabilities: string[];
99
+ readonly effects: import("@smthrs/plan/Effects").Declaration;
100
+ };
101
+ /**
102
+ * What a call to this flow does, for a reader of a run.
103
+ *
104
+ * Display metadata only. `@smthrs/registry` `Descriptor.FlowActivity` is the
105
+ * governing vocabulary and `StandardFlows` binds this value onto the flow's
106
+ * descriptor, where the binding site checks it. `declarationDigest` excludes
107
+ * it, so declaring it cannot invalidate a call identity or a cached prompt.
108
+ *
109
+ * @category presentation
110
+ * @since 1.0.0-rc.0
111
+ */
112
+ export declare const activity: "writes";
113
+ /**
114
+ * How one recorded call to this flow reads: the verb for each settlement, the
115
+ * input field that is its subject, and the measured output fields a one-line
116
+ * summary may count.
117
+ *
118
+ * Display metadata only, governed by `@smthrs/registry`
119
+ * `Descriptor.CallPresentation` and checked where `StandardFlows` binds it.
120
+ *
121
+ * @category presentation
122
+ * @since 1.0.0-rc.0
123
+ */
124
+ export declare const presentation: {
125
+ readonly verb: {
126
+ readonly pending: "writing";
127
+ readonly success: "wrote";
128
+ readonly failure: "failed to write";
129
+ };
130
+ readonly subject: "path";
131
+ readonly result: "write";
132
+ };
133
+ /**
134
+ * Replaces a file's contents through the permission-aware kernel filesystem.
135
+ *
136
+ * @category handlers
137
+ * @since 1.0.0
138
+ */
139
+ export declare const run: (input: {
140
+ readonly path: string;
141
+ readonly content: string;
142
+ }) => Effect.Effect<{
143
+ readonly path: string;
144
+ readonly bytesWritten: number;
145
+ readonly created: boolean;
146
+ }, StdError.StdError, import("effect/Path").Path | FileSystem.FileSystem>;
147
+ //# sourceMappingURL=Write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Write.d.ts","sourceRoot":"","sources":["../../src/Write.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAMvC,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;;;;GAKG;AACH,eAAO,MAAM,IAAI,UAAU,CAAA;AAE3B;;;;;GAKG;AACH,eAAO,MAAM,WAAW,+HACsG,CAAA;AAE9H;;;;;GAKG;AACH,eAAO,MAAM,KAAK;;;EAGhB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAErC;;;;;GAKG;AACH,eAAO,MAAM,MAAM;;;;EAIjB,CAAA;AAEF;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,OAAO,MAAM,CAAC,IAAI,CAAA;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,OAAO,4CAAuF,CAAA;AAE3G;;;;;GAKG;AACH,eAAO,MAAM,UAAU,GAAI,OAAO,OAAO,KAAK,CAAC,IAAI,+CAC6C,CAAA;AAEhG;;;;;GAKG;AACH,eAAO,MAAM,YAAY,UAAgE,CAAA;AAEzF;;;;;GAKG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;CAAsF,CAAA;AAEvG;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,EAAG,QAAiB,CAAA;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,YAAY;;;;;;;;CAIf,CAAA;AAKV;;;;;GAKG;AACH,eAAO,MAAM,GAAG;;;;;;;yEAiDd,CAAA"}
@@ -0,0 +1,144 @@
1
+ /**
2
+ * Write flow declaration and portable handler.
3
+ *
4
+ * @since 1.0.0
5
+ */
6
+ import * as Path from "@smthrs/kernel/Path";
7
+ import * as Effect from "effect/Effect";
8
+ import * as FileSystem from "effect/FileSystem";
9
+ import * as Schema from "effect/Schema";
10
+ import { capability, envelope } from "./internal/Declaration.js";
11
+ import * as Diagnostics from "./internal/Diagnostics.js";
12
+ import * as FileMutation from "./internal/FileMutation.js";
13
+ import * as FsFailure from "./internal/FsFailure.js";
14
+ import * as Preserve from "./internal/Preserve.js";
15
+ import * as StdError from "./StdError.js";
16
+ /**
17
+ * Registry name for the write flow.
18
+ *
19
+ * @category identifiers
20
+ * @since 1.0.0
21
+ */
22
+ export const name = "write";
23
+ /**
24
+ * Model-facing description of the write flow.
25
+ *
26
+ * @category descriptions
27
+ * @since 1.0.0
28
+ */
29
+ export const description = "Write UTF-8 text to a path, replacing any existing file; parent directories are created. Prefer edit for targeted changes.";
30
+ /**
31
+ * Input schema for the write flow.
32
+ *
33
+ * @category schemas
34
+ * @since 1.0.0
35
+ */
36
+ export const Input = Schema.Struct({
37
+ path: Schema.String.annotate({ description: "Path of the file to write" }),
38
+ content: Schema.String.annotate({ description: "Complete UTF-8 file contents" })
39
+ });
40
+ /**
41
+ * Output schema for the write flow.
42
+ *
43
+ * @category schemas
44
+ * @since 1.0.0
45
+ */
46
+ export const Output = Schema.Struct({
47
+ path: Schema.String.annotate({ description: "Path that was written" }),
48
+ bytesWritten: Schema.Number.annotate({ description: "Number of UTF-8 bytes written" }),
49
+ created: Schema.Boolean.annotate({ description: "Whether the file did not previously exist" })
50
+ });
51
+ /**
52
+ * Static conservative effect envelope for the write flow.
53
+ *
54
+ * @category effects
55
+ * @since 1.0.0
56
+ */
57
+ export const effects = envelope({ tier: "compensable", mode: "hermetic", reads: ["/**"], writes: ["/**"] });
58
+ /**
59
+ * Narrows the write effect envelope to one input path.
60
+ *
61
+ * @category effects
62
+ * @since 1.0.0
63
+ */
64
+ export const effectsFor = (input) => envelope({ tier: "compensable", mode: "hermetic", reads: [input.path], writes: [input.path] });
65
+ /**
66
+ * Capabilities required by the write flow.
67
+ *
68
+ * @category capabilities
69
+ * @since 1.0.0
70
+ */
71
+ export const capabilities = [capability("fs:read", "/**"), capability("fs:write", "/**")];
72
+ /**
73
+ * Declaration-only write flow.
74
+ *
75
+ * @category flows
76
+ * @since 1.0.0
77
+ */
78
+ export const flow = { name, description, input: Input, output: Output, capabilities, effects };
79
+ /**
80
+ * What a call to this flow does, for a reader of a run.
81
+ *
82
+ * Display metadata only. `@smthrs/registry` `Descriptor.FlowActivity` is the
83
+ * governing vocabulary and `StandardFlows` binds this value onto the flow's
84
+ * descriptor, where the binding site checks it. `declarationDigest` excludes
85
+ * it, so declaring it cannot invalidate a call identity or a cached prompt.
86
+ *
87
+ * @category presentation
88
+ * @since 1.0.0-rc.0
89
+ */
90
+ export const activity = "writes";
91
+ /**
92
+ * How one recorded call to this flow reads: the verb for each settlement, the
93
+ * input field that is its subject, and the measured output fields a one-line
94
+ * summary may count.
95
+ *
96
+ * Display metadata only, governed by `@smthrs/registry`
97
+ * `Descriptor.CallPresentation` and checked where `StandardFlows` binds it.
98
+ *
99
+ * @category presentation
100
+ * @since 1.0.0-rc.0
101
+ */
102
+ export const presentation = {
103
+ verb: { pending: "writing", success: "wrote", failure: "failed to write" },
104
+ subject: "path",
105
+ result: "write"
106
+ };
107
+ const writeError = (path, message) => new StdError.StdError({ code: "command_failed", message, path });
108
+ /**
109
+ * Replaces a file's contents through the permission-aware kernel filesystem.
110
+ *
111
+ * @category handlers
112
+ * @since 1.0.0
113
+ */
114
+ export const run = Effect.fn("Write.run")(function* (input) {
115
+ const fileSystem = yield* FileSystem.FileSystem;
116
+ const path = yield* Path.Path;
117
+ yield* FileMutation.validate(fileSystem, [input.path]);
118
+ if (!FileMutation.isVersioned(fileSystem)) {
119
+ yield* fileSystem.makeDirectory(path.dirname(input.path), { recursive: true }).pipe(Effect.mapError(FsFailure.denied(input.path, () => writeError(input.path, `Could not create the parent directory of ${input.path}`))));
120
+ }
121
+ return yield* Effect.scoped(Effect.gen(function* () {
122
+ const mutation = yield* FileMutation.acquire(fileSystem, [input.path], path);
123
+ const existed = yield* fileSystem.exists(input.path).pipe(Effect.orElseSucceed(() => false));
124
+ if (existed) {
125
+ const info = yield* fileSystem.stat(input.path).pipe(Effect.mapError(FsFailure.denied(input.path, () => writeError(input.path, `Could not inspect ${input.path} before writing`))));
126
+ if (info.type === "Directory") {
127
+ return yield* Effect.fail(writeError(input.path, `Cannot write a file over directory ${input.path}`));
128
+ }
129
+ }
130
+ yield* mutation.commit([{
131
+ path: input.path,
132
+ content: new TextEncoder().encode(input.content)
133
+ }], Preserve.writeFileString(fileSystem, input.path, input.content).pipe(Effect.mapError((error) => error.reason.method === "chmod"
134
+ ? writeError(input.path, `Could not preserve the mode of ${input.path} before replacement by chmod`)
135
+ : FsFailure.denied(input.path, () => writeError(input.path, `Could not write ${input.path}`))(error))));
136
+ yield* Diagnostics.sync(path.resolve(input.path), input.content);
137
+ return {
138
+ path: input.path,
139
+ bytesWritten: new TextEncoder().encode(input.content).byteLength,
140
+ created: !existed
141
+ };
142
+ }));
143
+ });
144
+ //# sourceMappingURL=Write.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Write.js","sourceRoot":"","sources":["../../src/Write.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAA;AAChE,OAAO,KAAK,WAAW,MAAM,2BAA2B,CAAA;AACxD,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAA;AAC1D,OAAO,KAAK,SAAS,MAAM,yBAAyB,CAAA;AACpD,OAAO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.0\n */\n\nimport * as Path from \"@smthrs/kernel/Path\"\nimport * as Effect from \"effect/Effect\"\nimport * as FileSystem from \"effect/FileSystem\"\nimport * as Schema from \"effect/Schema\"\nimport { capability, envelope } from \"./internal/Declaration.ts\"\nimport * as Diagnostics from \"./internal/Diagnostics.ts\"\nimport * as FileMutation from \"./internal/FileMutation.ts\"\nimport * as FsFailure from \"./internal/FsFailure.ts\"\nimport * as Preserve from \"./internal/Preserve.ts\"\nimport * as StdError from \"./StdError.ts\"\n\n/**\n * Registry name for the write flow.\n *\n * @category identifiers\n * @since 1.0.0\n */\nexport const name = \"write\"\n\n/**\n * Model-facing description of the write flow.\n *\n * @category descriptions\n * @since 1.0.0\n */\nexport const description =\n \"Write UTF-8 text to a path, replacing any existing file; parent directories are created. Prefer edit for targeted changes.\"\n\n/**\n * Input schema for the write flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Input = Schema.Struct({\n path: Schema.String.annotate({ description: \"Path of the file to write\" }),\n content: Schema.String.annotate({ description: \"Complete UTF-8 file contents\" })\n})\n\n/**\n * Decoded input accepted by the `write` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Input = typeof Input.Type\n\n/**\n * Output schema for the write flow.\n *\n * @category schemas\n * @since 1.0.0\n */\nexport const Output = Schema.Struct({\n path: Schema.String.annotate({ description: \"Path that was written\" }),\n bytesWritten: Schema.Number.annotate({ description: \"Number of UTF-8 bytes written\" }),\n created: Schema.Boolean.annotate({ description: \"Whether the file did not previously exist\" })\n})\n\n/**\n * Decoded output returned by the `write` flow.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Output = typeof Output.Type\n\n/**\n * Static conservative effect envelope for the write flow.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effects = envelope({ tier: \"compensable\", mode: \"hermetic\", reads: [\"/**\"], writes: [\"/**\"] })\n\n/**\n * Narrows the write effect envelope to one input path.\n *\n * @category effects\n * @since 1.0.0\n */\nexport const effectsFor = (input: typeof Input.Type) =>\n envelope({ tier: \"compensable\", mode: \"hermetic\", reads: [input.path], writes: [input.path] })\n\n/**\n * Capabilities required by the write flow.\n *\n * @category capabilities\n * @since 1.0.0\n */\nexport const capabilities = [capability(\"fs:read\", \"/**\"), capability(\"fs:write\", \"/**\")]\n\n/**\n * Declaration-only write flow.\n *\n * @category flows\n * @since 1.0.0\n */\nexport const flow = { name, description, input: Input, output: Output, capabilities, effects } as const\n\n/**\n * What a call to this flow does, for a reader of a run.\n *\n * Display metadata only. `@smthrs/registry` `Descriptor.FlowActivity` is the\n * governing vocabulary and `StandardFlows` binds this value onto the flow's\n * descriptor, where the binding site checks it. `declarationDigest` excludes\n * it, so declaring it cannot invalidate a call identity or a cached prompt.\n *\n * @category presentation\n * @since 1.0.0-rc.0\n */\nexport const activity = \"writes\" as const\n\n/**\n * How one recorded call to this flow reads: the verb for each settlement, the\n * input field that is its subject, and the measured output fields a one-line\n * summary may count.\n *\n * Display metadata only, governed by `@smthrs/registry`\n * `Descriptor.CallPresentation` and checked where `StandardFlows` binds it.\n *\n * @category presentation\n * @since 1.0.0-rc.0\n */\nexport const presentation = {\n verb: { pending: \"writing\", success: \"wrote\", failure: \"failed to write\" },\n subject: \"path\",\n result: \"write\"\n} as const\n\nconst writeError = (path: string, message: string): StdError.StdError =>\n new StdError.StdError({ code: \"command_failed\", message, path })\n\n/**\n * Replaces a file's contents through the permission-aware kernel filesystem.\n *\n * @category handlers\n * @since 1.0.0\n */\nexport const run = Effect.fn(\"Write.run\")(function*(\n input: typeof Input.Type\n): Effect.fn.Return<typeof Output.Type, StdError.StdError, FileSystem.FileSystem | Path.Path> {\n const fileSystem = yield* FileSystem.FileSystem\n const path = yield* Path.Path\n yield* FileMutation.validate(fileSystem, [input.path])\n if (!FileMutation.isVersioned(fileSystem)) {\n yield* fileSystem.makeDirectory(path.dirname(input.path), { recursive: true }).pipe(\n Effect.mapError(\n FsFailure.denied(\n input.path,\n () => writeError(input.path, `Could not create the parent directory of ${input.path}`)\n )\n )\n )\n }\n return yield* Effect.scoped(Effect.gen(function*() {\n const mutation = yield* FileMutation.acquire(fileSystem, [input.path], path)\n const existed = yield* fileSystem.exists(input.path).pipe(Effect.orElseSucceed(() => false))\n if (existed) {\n const info = yield* fileSystem.stat(input.path).pipe(\n Effect.mapError(\n FsFailure.denied(input.path, () => writeError(input.path, `Could not inspect ${input.path} before writing`))\n )\n )\n if (info.type === \"Directory\") {\n return yield* Effect.fail(writeError(input.path, `Cannot write a file over directory ${input.path}`))\n }\n }\n yield* mutation.commit(\n [{\n path: input.path,\n content: new TextEncoder().encode(input.content)\n }],\n Preserve.writeFileString(fileSystem, input.path, input.content).pipe(\n Effect.mapError((error) =>\n error.reason.method === \"chmod\"\n ? writeError(input.path, `Could not preserve the mode of ${input.path} before replacement by chmod`)\n : FsFailure.denied(input.path, () => writeError(input.path, `Could not write ${input.path}`))(error)\n )\n )\n )\n yield* Diagnostics.sync(path.resolve(input.path), input.content)\n return {\n path: input.path,\n bytesWritten: new TextEncoder().encode(input.content).byteLength,\n created: !existed\n }\n }))\n})\n"]}