@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
package/src/Ls.ts ADDED
@@ -0,0 +1,228 @@
1
+ /**
2
+ * Directory listing flow declaration and portable handler.
3
+ *
4
+ * @since 1.0.0
5
+ */
6
+
7
+ import * as Path from "@smthrs/kernel/Path"
8
+ import * as Effect from "effect/Effect"
9
+ import * as FileSystem from "effect/FileSystem"
10
+ import * as Schema from "effect/Schema"
11
+ import { capability, envelope } from "./internal/Declaration.ts"
12
+ import * as FsFailure from "./internal/FsFailure.ts"
13
+ import { DEFAULT_READ_LIMIT, MAX_ENTRIES, notice } from "./internal/Text.ts"
14
+ import * as StdError from "./StdError.ts"
15
+
16
+ /**
17
+ * The registry name of the `ls` flow.
18
+ *
19
+ * @category identifiers
20
+ * @since 1.0.0
21
+ */
22
+ export const name = "ls"
23
+
24
+ /**
25
+ * The one-line description the model sees for the `ls` flow.
26
+ *
27
+ * @category descriptions
28
+ * @since 1.0.0
29
+ */
30
+ export const description =
31
+ "List a directory with directories first, trailing /, and locale-independent UTF-16 code-unit ordering; use 1-based offset and limit to page large listings."
32
+
33
+ /**
34
+ * What the `ls` flow accepts.
35
+ *
36
+ * @category schemas
37
+ * @since 1.0.0
38
+ */
39
+ export const Input = Schema.Struct({
40
+ path: Schema.String.annotate({ description: "Directory path to list" }),
41
+ offset: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))).annotate({
42
+ description: "1-based entry offset"
43
+ }),
44
+ limit: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))).annotate({
45
+ description: "Maximum entries to return"
46
+ })
47
+ })
48
+
49
+ /**
50
+ * Decoded input accepted by the `ls` flow.
51
+ *
52
+ * @category models
53
+ * @since 1.0.0
54
+ */
55
+ export type Input = typeof Input.Type
56
+
57
+ /**
58
+ * What the `ls` flow returns.
59
+ *
60
+ * @category schemas
61
+ * @since 1.0.0
62
+ */
63
+ export const Output = Schema.Struct({
64
+ entries: Schema.Array(Schema.Struct({
65
+ name: Schema.String.annotate({ description: "Entry name; directories end in /" }),
66
+ kind: Schema.Literals(["file", "directory"]).annotate({ description: "Entry kind" })
67
+ })),
68
+ total: Schema.Number.annotate({ description: "Total entries before paging" }),
69
+ truncated: Schema.Boolean.annotate({ description: "Whether more entries remain" }),
70
+ notice: Schema.optional(Schema.String.annotate({ description: "Truncation disclosure" }))
71
+ })
72
+
73
+ /**
74
+ * Decoded output returned by the `ls` flow.
75
+ *
76
+ * @category models
77
+ * @since 1.0.0
78
+ */
79
+ export type Output = typeof Output.Type
80
+
81
+ /**
82
+ * The declared effect envelope of the `ls` flow, before any input is known.
83
+ *
84
+ * @category effects
85
+ * @since 1.0.0
86
+ */
87
+ export const effects = envelope({ tier: "sealed", mode: "hermetic", reads: ["/**"], writes: [] })
88
+
89
+ /**
90
+ * Narrows {@link effects} to what this particular input actually touches.
91
+ *
92
+ * @category effects
93
+ * @since 1.0.0
94
+ */
95
+ export const effectsFor = (input: typeof Input.Type) =>
96
+ envelope({ tier: "sealed", mode: "hermetic", reads: [input.path], writes: [] })
97
+
98
+ /**
99
+ * The authority the `ls` flow requires.
100
+ *
101
+ * @category capabilities
102
+ * @since 1.0.0
103
+ */
104
+ export const capabilities = [capability("fs:read", "/**")]
105
+
106
+ /**
107
+ * The `ls` flow declaration: schemas, capabilities, and effects, with the
108
+ * implementation attached separately.
109
+ *
110
+ * @category flows
111
+ * @since 1.0.0
112
+ */
113
+ export const flow = { name, description, input: Input, output: Output, capabilities, effects } as const
114
+
115
+ /**
116
+ * What a call to this flow does, for a reader of a run.
117
+ *
118
+ * Display metadata only. `@smthrs/registry` `Descriptor.FlowActivity` is the
119
+ * governing vocabulary and `StandardFlows` binds this value onto the flow's
120
+ * descriptor, where the binding site checks it. `declarationDigest` excludes
121
+ * it, so declaring it cannot invalidate a call identity or a cached prompt.
122
+ *
123
+ * @category presentation
124
+ * @since 1.0.0-rc.0
125
+ */
126
+ export const activity = "reads" as const
127
+
128
+ /**
129
+ * How one recorded call to this flow reads: the verb for each settlement, the
130
+ * input field that is its subject, and the measured output fields a one-line
131
+ * summary may count.
132
+ *
133
+ * Display metadata only, governed by `@smthrs/registry`
134
+ * `Descriptor.CallPresentation` and checked where `StandardFlows` binds it.
135
+ *
136
+ * @category presentation
137
+ * @since 1.0.0-rc.0
138
+ */
139
+ export const presentation = {
140
+ verb: { pending: "listing", success: "listed", failure: "failed to list" },
141
+ subject: "path",
142
+ result: "entries"
143
+ } as const
144
+
145
+ // localeCompare changes with host locale and ICU data. Code-unit comparisons
146
+ // keep journalled directory listings identical on every host.
147
+ const byText = (left: string, right: string): number => (left < right ? -1 : Number(left > right))
148
+
149
+ /**
150
+ * Lists a directory deterministically. A file supplied as `path` is reported
151
+ * as `not_a_directory`.
152
+ *
153
+ * @category handlers
154
+ * @since 1.0.0
155
+ */
156
+ export const run = Effect.fn("Ls.run")(function*(
157
+ input: typeof Input.Type
158
+ ): Effect.fn.Return<typeof Output.Type, StdError.StdError, FileSystem.FileSystem | Path.Path> {
159
+ const fileSystem = yield* FileSystem.FileSystem
160
+ const path = yield* Path.Path
161
+ const info = yield* fileSystem.stat(input.path).pipe(
162
+ Effect.mapError(FsFailure.reading(input.path, `Directory not found: ${input.path}`))
163
+ )
164
+ if (info.type !== "Directory") {
165
+ return yield* Effect.fail(
166
+ new StdError.StdError({
167
+ code: "not_a_directory",
168
+ message: `Cannot list a file: ${input.path}`,
169
+ path: input.path
170
+ })
171
+ )
172
+ }
173
+ const names = yield* fileSystem.readDirectory(input.path).pipe(
174
+ Effect.mapError(FsFailure.reading(input.path, `Directory not found: ${input.path}`))
175
+ )
176
+ const sortedNames = [...names].sort(byText)
177
+ const offset = input.offset ?? 1
178
+ // An empty directory is not an out-of-range listing: the caller asked for
179
+ // the first page and there is nothing on it. This matches `read`, which
180
+ // answers an empty page for an empty file and refuses only a real overshoot.
181
+ if (offset > Math.max(sortedNames.length, 1)) {
182
+ return yield* Effect.fail(
183
+ new StdError.StdError({
184
+ code: "offset_out_of_range",
185
+ message: `Entry offset ${offset} is outside ${input.path}, which has ${sortedNames.length} entries`,
186
+ path: input.path
187
+ })
188
+ )
189
+ }
190
+ const limit = Math.min(input.limit ?? DEFAULT_READ_LIMIT, MAX_ENTRIES)
191
+ // Every entry is described before the page is cut, because the order the
192
+ // description promises is directories first and a kind is a stat away.
193
+ // Statting only the page and ordering inside it made the order local to the
194
+ // page: a directory `zdir/` beside a file `a.txt` came back as
195
+ // `[zdir/, a.txt]` unpaged and as `[a.txt]` then `[zdir/]` at `limit: 1`, so
196
+ // `offset` addressed a different listing at every page size and an agent
197
+ // paging a large directory could see one entry twice and another never.
198
+ //
199
+ // A per-entry stat can fail on a name the directory legitimately
200
+ // contains — a dangling symlink, or a file the guarded filesystem refuses
201
+ // to describe. The name is still real (readDirectory returned it), so the
202
+ // listing reports it as a plain entry instead of dying: one broken link in
203
+ // a repository root used to fail the whole `ls` and cost the agent a frame
204
+ // per attempt.
205
+ const described = yield* Effect.forEach(
206
+ sortedNames,
207
+ (entry) =>
208
+ fileSystem.stat(path.join(input.path, entry)).pipe(
209
+ Effect.map((entryInfo) => ({
210
+ name: entryInfo.type === "Directory" ? `${entry}/` : entry,
211
+ kind: entryInfo.type === "Directory" ? "directory" as const : "file" as const
212
+ })),
213
+ Effect.catch(() => Effect.succeed({ name: entry, kind: "file" as const }))
214
+ ),
215
+ { concurrency: 16 }
216
+ )
217
+ const ordered = [...described].sort((left, right) =>
218
+ left.kind === right.kind ? byText(left.name, right.name) : left.kind === "directory" ? -1 : 1
219
+ )
220
+ const selected = ordered.slice(offset - 1, offset - 1 + limit)
221
+ const truncated = offset - 1 + selected.length < ordered.length
222
+ return {
223
+ entries: selected,
224
+ total: ordered.length,
225
+ truncated,
226
+ ...(truncated ? { notice: notice("entries", selected.length, ordered.length) } : {})
227
+ }
228
+ })
package/src/Lsp.ts ADDED
@@ -0,0 +1,184 @@
1
+ /**
2
+ * The `lsp` flow: one code-intelligence query per call.
3
+ *
4
+ * The handler checks the path and 1-based position each operation needs,
5
+ * authorizes the path as a read through the guarded `FileSystem` (the server
6
+ * process reads the file on its own), forwards the query to the bound
7
+ * `LanguageServer`, and returns the server's answer unchanged in `result`.
8
+ *
9
+ * @since 1.0.0
10
+ */
11
+
12
+ import * as Effect from "effect/Effect"
13
+ import * as FileSystem from "effect/FileSystem"
14
+ import * as Schema from "effect/Schema"
15
+ import { capability, envelope } from "./internal/Declaration.ts"
16
+ import * as FsFailure from "./internal/FsFailure.ts"
17
+ import * as LanguageServer from "./LanguageServer.ts"
18
+ import * as StdError from "./StdError.ts"
19
+
20
+ /**
21
+ * The registry name of the `lsp` flow.
22
+ *
23
+ * @category identifiers
24
+ * @since 1.0.0
25
+ */
26
+ export const name = "lsp"
27
+ /**
28
+ * The one-line description the model sees for the `lsp` flow.
29
+ *
30
+ * @category descriptions
31
+ * @since 1.0.0
32
+ */
33
+ export const description = "Inspect code intelligence through the configured language server."
34
+ /**
35
+ * What the `lsp` flow accepts.
36
+ *
37
+ * @category schemas
38
+ * @since 1.0.0
39
+ */
40
+ export const Input = Schema.Struct({
41
+ operation: Schema.Literals([
42
+ "hover",
43
+ "definition",
44
+ "references",
45
+ "implementation",
46
+ "documentSymbols",
47
+ "workspaceSymbols",
48
+ "prepareCallHierarchy",
49
+ "callHierarchyIncoming",
50
+ "callHierarchyOutgoing",
51
+ "diagnostics"
52
+ ]).annotate({
53
+ description:
54
+ "The query to run; workspaceSymbols takes query, documentSymbols and diagnostics take path, the rest take path with line and character"
55
+ }),
56
+ path: Schema.optional(Schema.String).annotate({
57
+ description: "Absolute path of the file to query; required by every operation except workspaceSymbols"
58
+ }),
59
+ line: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))).annotate({
60
+ description: "1-based line of the position to query, as read and grep report it"
61
+ }),
62
+ character: Schema.optional(Schema.Int.check(Schema.isGreaterThanOrEqualTo(1))).annotate({
63
+ description: "1-based character offset within the line"
64
+ }),
65
+ query: Schema.optional(Schema.String).annotate({
66
+ description: "Symbol text to search the workspace for; workspaceSymbols only"
67
+ })
68
+ })
69
+ /**
70
+ * Decoded input accepted by the `lsp` flow.
71
+ *
72
+ * @category models
73
+ * @since 1.0.0
74
+ */
75
+ export type Input = typeof Input.Type
76
+ /**
77
+ * What the `lsp` flow returns.
78
+ *
79
+ * @category schemas
80
+ * @since 1.0.0
81
+ */
82
+ export const Output = Schema.Struct({
83
+ result: Schema.Unknown.annotate({
84
+ description: "The language server's answer for this operation, passed through in the server's own shape"
85
+ })
86
+ })
87
+ /**
88
+ * Decoded output returned by the `lsp` flow.
89
+ *
90
+ * @category models
91
+ * @since 1.0.0
92
+ */
93
+ export type Output = typeof Output.Type
94
+ /**
95
+ * The declared effect envelope of the `lsp` flow, before any input is known.
96
+ *
97
+ * @category effects
98
+ * @since 1.0.0
99
+ */
100
+ export const effects = envelope({
101
+ tier: "sealed",
102
+ mode: "hermetic",
103
+ reads: ["/**"],
104
+ writes: []
105
+ })
106
+ /**
107
+ * Returns the workspace-wide envelope every language-server query needs.
108
+ *
109
+ * @category effects
110
+ * @since 1.0.0
111
+ */
112
+ export const effectsFor = (_input: typeof Input.Type) => effects
113
+ /**
114
+ * The authority the `lsp` flow requires.
115
+ *
116
+ * @category capabilities
117
+ * @since 1.0.0
118
+ */
119
+ export const capabilities = [capability("fs:read", "/**")]
120
+ /**
121
+ * The `lsp` flow declaration: schemas, capabilities, and effects, with the
122
+ * implementation attached separately.
123
+ *
124
+ * @category flows
125
+ * @since 1.0.0
126
+ */
127
+ export const flow = {
128
+ name,
129
+ description,
130
+ input: Input,
131
+ output: Output,
132
+ capabilities,
133
+ effects
134
+ } as const
135
+ const isAbsolutePath = (path: string): boolean => path.startsWith("/") || /^[A-Za-z]:[\\/]/.test(path)
136
+ /**
137
+ * Runs the `lsp` flow: queries the configured language server.
138
+ *
139
+ * @category handlers
140
+ * @since 1.0.0
141
+ */
142
+ export const run = Effect.fn("Lsp.run")(function*(
143
+ input: typeof Input.Type
144
+ ): Effect.fn.Return<typeof Output.Type, StdError.StdError, LanguageServer.LanguageServer | FileSystem.FileSystem> {
145
+ const server = yield* LanguageServer.LanguageServer
146
+ const path = input.path
147
+ const position = path === undefined || input.line === undefined || input.character === undefined
148
+ ? undefined
149
+ : { path, line: input.line - 1, character: input.character - 1 }
150
+ if ((input.operation === "workspaceSymbols")) return { result: yield* server.workspaceSymbols(input.query ?? "") }
151
+ if (path === undefined || !isAbsolutePath(path)) {
152
+ return yield* Effect.fail(
153
+ new StdError.StdError({ code: "invalid_input", message: "A normalized absolute path is required" })
154
+ )
155
+ }
156
+ // The server reads the file itself, outside the guarded filesystem, so the
157
+ // path is authorized here: a read the caller could not make through `read`
158
+ // is not made through the language server either.
159
+ const fileSystem = yield* FileSystem.FileSystem
160
+ yield* fileSystem.stat(path).pipe(Effect.mapError(FsFailure.reading(path, `File not found: ${path}`)))
161
+ if (input.operation === "documentSymbols") return { result: yield* server.documentSymbols(path) }
162
+ if (input.operation === "diagnostics") return { result: yield* server.diagnostics(path) }
163
+ if (position === undefined) {
164
+ return yield* Effect.fail(
165
+ new StdError.StdError({ code: "invalid_input", message: "1-based line and character are required" })
166
+ )
167
+ }
168
+ switch (input.operation) {
169
+ case "hover":
170
+ return { result: yield* server.hover(position) }
171
+ case "definition":
172
+ return { result: yield* server.definition(position) }
173
+ case "references":
174
+ return { result: yield* server.references(position) }
175
+ case "implementation":
176
+ return { result: yield* server.implementation(position) }
177
+ case "prepareCallHierarchy":
178
+ return { result: yield* server.prepareCallHierarchy(position) }
179
+ case "callHierarchyIncoming":
180
+ return { result: yield* server.callHierarchyIncoming(position) }
181
+ case "callHierarchyOutgoing":
182
+ return { result: yield* server.callHierarchyOutgoing(position) }
183
+ }
184
+ })
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Built-in flow declarations and their separately supplied handlers.
3
+ *
4
+ * @since 1.0.0
5
+ */
6
+
7
+ import * as ApplyPatch from "./ApplyPatch.ts"
8
+ import * as Bash from "./Bash.ts"
9
+ import * as Edit from "./Edit.ts"
10
+ import * as Explore from "./Explore.ts"
11
+ import * as Fetch from "./Fetch.ts"
12
+ import * as Glob from "./Glob.ts"
13
+ import * as Grep from "./Grep.ts"
14
+ import * as HttpPost from "./HttpPost.ts"
15
+ import * as Ls from "./Ls.ts"
16
+ import * as Lsp from "./Lsp.ts"
17
+ import * as Read from "./Read.ts"
18
+ import * as ShellCommand from "./ShellCommand.ts"
19
+ import * as TestRun from "./TestRun.ts"
20
+ import * as UpdatePlan from "./UpdatePlan.ts"
21
+ import * as WebFetch from "./WebFetch.ts"
22
+ import * as WebSearch from "./WebSearch.ts"
23
+ import * as Write from "./Write.ts"
24
+
25
+ /**
26
+ * Frozen name-to-declaration registry for every standard flow.
27
+ *
28
+ * @category registries
29
+ * @since 1.0.0
30
+ */
31
+ export const flows = Object.freeze({
32
+ [Read.name]: Read.flow,
33
+ [Write.name]: Write.flow,
34
+ [Edit.name]: Edit.flow,
35
+ [Ls.name]: Ls.flow,
36
+ [Glob.name]: Glob.flow,
37
+ [Grep.name]: Grep.flow,
38
+ [Bash.name]: Bash.flow,
39
+ [TestRun.name]: TestRun.flow,
40
+ [ShellCommand.name]: ShellCommand.flow,
41
+ [ApplyPatch.name]: ApplyPatch.flow,
42
+ [UpdatePlan.name]: UpdatePlan.flow,
43
+ [Fetch.name]: Fetch.flow,
44
+ [HttpPost.name]: HttpPost.flow,
45
+ [Explore.name]: Explore.flow,
46
+ [WebFetch.name]: WebFetch.flow,
47
+ [WebSearch.name]: WebSearch.flow,
48
+ [Lsp.name]: Lsp.flow
49
+ })
50
+
51
+ /**
52
+ * Frozen name-to-handler registry for executable standard flows.
53
+ *
54
+ * Explore is dynamic and therefore has no handler entry.
55
+ *
56
+ * @category registries
57
+ * @since 1.0.0
58
+ */
59
+ export const handlers = Object.freeze({
60
+ [Read.name]: Read.run,
61
+ [Write.name]: Write.run,
62
+ [Edit.name]: Edit.run,
63
+ [Ls.name]: Ls.run,
64
+ [Glob.name]: Glob.run,
65
+ [Grep.name]: Grep.run,
66
+ [Bash.name]: Bash.run,
67
+ [TestRun.name]: TestRun.run,
68
+ [ShellCommand.name]: ShellCommand.run,
69
+ [ApplyPatch.name]: ApplyPatch.run,
70
+ [UpdatePlan.name]: UpdatePlan.run,
71
+ [Fetch.name]: Fetch.run,
72
+ [HttpPost.name]: HttpPost.run,
73
+ [WebFetch.name]: WebFetch.run,
74
+ [WebSearch.name]: WebSearch.run,
75
+ [Lsp.name]: Lsp.run
76
+ })
77
+
78
+ /**
79
+ * Frozen name-to-narrowing registry: the entry point for `effectsFor`.
80
+ *
81
+ * Every flow declares a registry-time worst case in `flow.effects`, and every
82
+ * module also narrows that declaration for one decoded input. Without this map
83
+ * a host holding a flow name and a decoded input has no generic way to reach
84
+ * the narrowing, so it would have to serialize conflicts against the worst case
85
+ * for every call. Explore is included even though it has no handler entry: it
86
+ * is a declaration a seat can be offered, and its envelope narrows the same way.
87
+ *
88
+ * @category registries
89
+ * @since 1.0.0
90
+ */
91
+ export const effectsFor = Object.freeze({
92
+ [Read.name]: Read.effectsFor,
93
+ [Write.name]: Write.effectsFor,
94
+ [Edit.name]: Edit.effectsFor,
95
+ [Ls.name]: Ls.effectsFor,
96
+ [Glob.name]: Glob.effectsFor,
97
+ [Grep.name]: Grep.effectsFor,
98
+ [Bash.name]: Bash.effectsFor,
99
+ [TestRun.name]: TestRun.effectsFor,
100
+ [ShellCommand.name]: ShellCommand.effectsFor,
101
+ [ApplyPatch.name]: ApplyPatch.effectsFor,
102
+ [UpdatePlan.name]: UpdatePlan.effectsFor,
103
+ [Fetch.name]: Fetch.effectsFor,
104
+ [HttpPost.name]: HttpPost.effectsFor,
105
+ [Explore.name]: Explore.effectsFor,
106
+ [WebFetch.name]: WebFetch.effectsFor,
107
+ [WebSearch.name]: WebSearch.effectsFor,
108
+ [Lsp.name]: Lsp.effectsFor
109
+ })
110
+
111
+ /**
112
+ * Frozen standard flow names in registry order.
113
+ *
114
+ * @category metadata
115
+ * @since 1.0.0
116
+ */
117
+ export const names = Object.freeze(
118
+ [
119
+ Read.name,
120
+ Write.name,
121
+ Edit.name,
122
+ Ls.name,
123
+ Glob.name,
124
+ Grep.name,
125
+ Bash.name,
126
+ TestRun.name,
127
+ ShellCommand.name,
128
+ ApplyPatch.name,
129
+ UpdatePlan.name,
130
+ Fetch.name,
131
+ HttpPost.name,
132
+ Explore.name,
133
+ WebFetch.name,
134
+ WebSearch.name,
135
+ Lsp.name
136
+ ] as const
137
+ )
138
+
139
+ /**
140
+ * Frozen names visible to a seat restricted to read-only flows.
141
+ *
142
+ * Seat policies consume this list instead of duplicating name checks.
143
+ *
144
+ * `websearch` is deliberately absent: its provider contract requires
145
+ * `net:post` authority, which is mutating under the kernel capability
146
+ * taxonomy, so it cannot ride in a read-only seat.
147
+ *
148
+ * @category visibility
149
+ * @since 1.0.0
150
+ */
151
+ export const readOnly = Object.freeze(
152
+ [
153
+ Read.name,
154
+ Ls.name,
155
+ Glob.name,
156
+ Grep.name,
157
+ Fetch.name,
158
+ Explore.name,
159
+ WebFetch.name,
160
+ Lsp.name
161
+ ] as const
162
+ )