@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,138 @@
1
+ ---
2
+ title: "Effects and capabilities"
3
+ description: "What each flow declares before it runs, how effectsFor narrows that declaration to one call, and why hermetic mode is a lexical pre-check rather than a sandbox."
4
+ sidebar:
5
+ order: 2
6
+ ---
7
+
8
+ Every declaration carries two statements about what running it would do: an
9
+ **effect envelope** and a list of **capabilities**. A scheduler reads the first
10
+ to decide what may run beside what. A permission kernel reads the second to
11
+ decide whether it may run at all.
12
+
13
+ ## The envelope
14
+
15
+ An envelope has four parts:
16
+
17
+ - `tier` is how reversible the effect is: `sealed` (observes only),
18
+ `compensable` (can be undone), or `irreversible` (cannot).
19
+ - `mode` is `hermetic` when the flow declares the paths it touches, and
20
+ `expected` when it does not.
21
+ - `reads` and `writes` are path globs.
22
+ - `onConflict` is `serialize` for every flow in this package. The library owns
23
+ no lane partitioning of its own, so the conservative choice is the safe one.
24
+
25
+ Here is what each flow declares at registry time, before any input is known:
26
+
27
+ | Flow | Tier | Mode | Declared reads and writes | Capabilities |
28
+ | --------------- | -------------- | ---------- | ------------------------- | ----------------------------- |
29
+ | `read` | `sealed` | `hermetic` | reads `/**` | `fs:read:/**` |
30
+ | `ls` | `sealed` | `hermetic` | reads `/**` | `fs:read:/**` |
31
+ | `glob` | `sealed` | `hermetic` | reads `/**` | `fs:read:/**` |
32
+ | `grep` | `sealed` | `hermetic` | reads `/**` | `fs:read:/**` |
33
+ | `explore` | `sealed` | `hermetic` | reads `/**` | `fs:read:/**` |
34
+ | `lsp` | `sealed` | `hermetic` | reads `/**` | `fs:read:/**` |
35
+ | `write` | `compensable` | `hermetic` | writes `/**` | `fs:write:/**` |
36
+ | `edit` | `compensable` | `hermetic` | reads and writes `/**` | `fs:read:/**`, `fs:write:/**` |
37
+ | `apply_patch` | `compensable` | `hermetic` | reads and writes `/**` | `fs:read:/**`, `fs:write:/**` |
38
+ | `update_plan` | `sealed` | `hermetic` | nothing | none |
39
+ | `fetch` | `sealed` | `expected` | nothing | `net:get:*` |
40
+ | `webfetch` | `sealed` | `expected` | nothing | `net:get:*` |
41
+ | `websearch` | `sealed` | `expected` | nothing | `net:post:*` |
42
+ | `http-post` | `irreversible` | `expected` | nothing | `net:post:*` |
43
+ | `bash` | `irreversible` | `expected` | nothing | `proc:spawn:*` |
44
+ | `test` | `irreversible` | `expected` | nothing | `proc:spawn:*` |
45
+ | `shell_command` | `irreversible` | `expected` | nothing | `proc:spawn:*` |
46
+
47
+ `fetch` is `sealed` even though it leaves the machine, because a retrieval
48
+ leaves no durable state behind. `http-post` is `irreversible` because the
49
+ remote side may already have acted.
50
+
51
+ ## Narrowing to one call
52
+
53
+ The declared envelope is the registry-time worst case. It has to be, because the
54
+ declaration exists before any input does. `effectsFor` is the other half: hand
55
+ it one decoded input and it returns the envelope that call actually needs.
56
+
57
+ ```ts
58
+ import * as Read from "@smthrs/std/Read"
59
+
60
+ Read.effects // reads: ["/**"]
61
+ Read.effectsFor({ path: "/workspace/notes.md" }) // reads: ["/workspace/notes.md"]
62
+ ```
63
+
64
+ That is the difference between serializing every read in the workspace and
65
+ serializing the two calls that touch one file. Seven flows narrow to something
66
+ smaller than their declaration:
67
+
68
+ | Flow | What the narrowing says |
69
+ | -------------- | --------------------------------------------------------------------------------------------------------------------------- |
70
+ | `read`, `ls` | reads the one `path` the input names |
71
+ | `write` | writes the one `path` the input names |
72
+ | `edit` | reads and writes the one `path` the input names |
73
+ | `glob`, `grep` | reads the `root` subtree, or `/**` when no root is given |
74
+ | `bash` | in `hermetic` mode, `compensable` with the caller's own `reads` and `writes`; in `unhermetic` mode, the declared worst case |
75
+
76
+ The other ten return their static envelope, and each says why in its own doc
77
+ comment. `apply_patch` is the interesting one: a patch names its files inside
78
+ its own text rather than in a decoded field, and the parse that finds them is
79
+ the parse that can fail, so the static envelope is the honest answer.
80
+
81
+ `Manifest.effectsFor` reaches the same functions by flow name, which is what a
82
+ host needs when it holds a name and a decoded input rather than a module:
83
+
84
+ ```ts
85
+ import * as Manifest from "@smthrs/std/Manifest"
86
+
87
+ const narrow = Manifest.effectsFor["read"]
88
+ ```
89
+
90
+ ## Capabilities
91
+
92
+ A capability is an `action:resource` string on the declaration, and the
93
+ permission kernel decides whether the call is allowed to hold it. This package
94
+ uses five:
95
+
96
+ | Capability | Flows |
97
+ | -------------- | --------------------------------------------------------------------- |
98
+ | `fs:read:/**` | `read`, `ls`, `glob`, `grep`, `edit`, `apply_patch`, `explore`, `lsp` |
99
+ | `fs:write:/**` | `write`, `edit`, `apply_patch` |
100
+ | `proc:spawn:*` | `bash`, `test`, `shell_command` |
101
+ | `net:get:*` | `fetch`, `webfetch` |
102
+ | `net:post:*` | `http-post`, `websearch` |
103
+
104
+ `explore` declares the union of the capabilities of the four flows it composes
105
+ from, sorted and deduplicated, so a model offered `explore` is offered exactly
106
+ the authority its readers need.
107
+
108
+ ## Hermetic mode is a pre-check, not a sandbox
109
+
110
+ `bash` accepts `mode: "hermetic"` with explicit `reads` and `writes`, and the
111
+ handler checks the command against them before spawning anything. Read what the
112
+ check does, because the name promises more than it delivers.
113
+
114
+ The check is **lexical**. It tokenizes the command line, keeping quoted spans
115
+ whole, treats each physical line as its own command, reads the body of a
116
+ command substitution, the argument of a shell's `-c` flag, and the arguments of
117
+ `eval` as commands of their own, classifies each path token
118
+ as a read or a write from the command that governs it, resolves both the token
119
+ and every declaration to a canonical absolute path, and refuses the call with
120
+ `outside_declared_reads` or `outside_declared_writes` when one falls outside.
121
+ Paths under `/dev/` are exempt, because `2>/dev/null` is process plumbing rather
122
+ than a filesystem access.
123
+
124
+ Then it starts an ordinary host process. Shell expansion, subprocesses, and
125
+ paths computed at runtime are not observed. So the check bounds **what a caller
126
+ declared it would do**, not what the process can do. A host that needs
127
+ confinement supplies a sandbox or an access-reporting boundary; this check alone
128
+ cannot prove hermetic execution.
129
+
130
+ Two inputs are refused rather than pre-checked, for the same reason:
131
+
132
+ - A hermetic call that also names a `container`. A container has its own
133
+ filesystem, so declared host paths cannot describe it.
134
+ - A hermetic `script` whose `interpreter` is not a shell. The pre-check reads
135
+ shell text, and Python is not shell text.
136
+
137
+ Both refusals arrive as `invalid_input` with a message naming the alternative.
138
+ See [Run a shell command](../guides/run-a-shell-command.md).
@@ -0,0 +1,115 @@
1
+ ---
2
+ title: "Flows and handlers"
3
+ description: "Every tool in this package is a portable declaration plus a separately supplied handler, and the Manifest registries are how a host reaches both halves by name."
4
+ sidebar:
5
+ order: 1
6
+ ---
7
+
8
+ A tool in this package is two halves that ship apart.
9
+
10
+ The **declaration** is data. It carries `name`, `description`, `Input`,
11
+ `Output`, `capabilities`, and `effects`, and it reaches nothing: no filesystem,
12
+ no process, no network. That is what makes it safe to hand to a model, safe to
13
+ put in a registry, and safe to plan against before a single call runs.
14
+
15
+ The **handler** is the executable half. It is an ordinary Effect whose
16
+ requirement names the host services it needs, so the host decides what `read`
17
+ actually reads from.
18
+
19
+ ## The module shape
20
+
21
+ Every flow module exports the same names, which is what lets a host treat all 17
22
+ uniformly:
23
+
24
+ | Export | What it is |
25
+ | -------------- | -------------------------------------------------------------- |
26
+ | `name` | The registry name, such as `"read"`. |
27
+ | `description` | The one line the model sees. |
28
+ | `Input` | The input schema. |
29
+ | `Output` | The output schema. |
30
+ | `effects` | The declared effect envelope, before any input is known. |
31
+ | `effectsFor` | The same envelope narrowed to one decoded input. |
32
+ | `capabilities` | The authority the flow requires, as `action:resource` strings. |
33
+ | `flow` | The declaration itself, built by `Flow.make`. |
34
+ | `run` | The handler. |
35
+
36
+ `Explore` is the one exception: it has no `run`, because it is a dynamic flow
37
+ composed from other flows rather than a handler.
38
+
39
+ ## Naming a declaration from another flow
40
+
41
+ Because the declaration is data, a larger flow can name it and inherit both its
42
+ capabilities and its effect envelope, without importing the handler at all:
43
+
44
+ ```ts
45
+ import * as Read from "@smthrs/std/Read"
46
+ import * as Schema from "effect/Schema"
47
+
48
+ /** A step that reads a file. It declares what `read` declares. */
49
+ export const ReadTarget = {
50
+ name: "read-target",
51
+ input: Schema.Struct({ path: Schema.String }),
52
+ output: Read.Output,
53
+ capabilities: Read.capabilities,
54
+ effects: Read.effects,
55
+ flows: [Read.flow]
56
+ }
57
+ ```
58
+
59
+ A planner reading `ReadTarget` can see that the step reads and does not write,
60
+ before anything runs. That is the same property a review gate or an approval
61
+ prompt needs.
62
+
63
+ ## The registries
64
+
65
+ `Manifest` is the whole library keyed by name, so a host binds all of it without
66
+ writing 17 imports:
67
+
68
+ ```ts
69
+ import * as Manifest from "@smthrs/std/Manifest"
70
+
71
+ Manifest.names // the 17 names, in registry order
72
+ Manifest.flows // name -> declaration, all 17
73
+ Manifest.handlers // name -> handler, the 16 that have one
74
+ Manifest.effectsFor // name -> narrowing function, all 17
75
+ Manifest.readOnly // the 8 names a read-only tool surface may see
76
+ ```
77
+
78
+ Every registry is frozen. `Manifest.handlers` omits `explore` because a dynamic
79
+ flow has no handler; `Manifest.effectsFor` includes it, because a model can
80
+ still be offered the declaration and its envelope still narrows.
81
+
82
+ `Manifest.readOnly` is `read`, `ls`, `glob`, `grep`, `fetch`, `explore`,
83
+ `webfetch`, and `lsp`. `websearch` is deliberately absent: its provider contract
84
+ requires `net:post` authority, which is mutating under the kernel capability
85
+ taxonomy, so it cannot ride in a read-only tool surface.
86
+
87
+ ## The services a host binds
88
+
89
+ Most handlers ask only for platform services such as `FileSystem` or
90
+ `ChildProcessSpawner`. Six ask for a service this package defines, because the
91
+ answer is a host decision rather than a platform one:
92
+
93
+ | Service | The flows that need it | What it decides |
94
+ | ---------------- | ----------------------- | -------------------------------------------------- |
95
+ | `Search` | `grep`, `glob` | Whether searching runs in process or through `rg`. |
96
+ | `Container` | `bash`, `test` | How a command reaches a named container. |
97
+ | `TestRunner` | `test` | How the project under test runs its suite. |
98
+ | `Checkpoints` | agent-side tree pinning | Where a pinned tree is recorded and checked out. |
99
+ | `WebSearch` | `websearch` | Which search provider answers. |
100
+ | `LanguageServer` | `lsp` | Which language server answers. |
101
+
102
+ Each one ships a refusal implementation, and binding it is the honest way to say
103
+ "this host cannot do that". A `makeNoop` service fails the call with
104
+ `provider_unavailable` and a message naming what to do instead. Refusing loudly
105
+ is the contract: a flow that appears to work while doing nothing costs a model
106
+ the frames it takes to notice.
107
+
108
+ ## What stays in the success channel
109
+
110
+ A handler fails only when a model must see a failure. A non-zero exit code, an
111
+ empty match set, and an HTTP 500 are all ordinary values, returned in the
112
+ success channel with the fields that describe them. `StdError` carries the rest,
113
+ under a closed list of codes. See
114
+ [Failures](../reference/flows.md#failures) for the list and
115
+ [Troubleshooting](../troubleshooting.md) for what each one means in practice.
@@ -0,0 +1,105 @@
1
+ ---
2
+ title: "Limits are disclosed, never silent"
3
+ description: "Every cap in this package is a display budget the result declares, plus the truncation flags the harness reads to refuse writing a fragment back to a file."
4
+ sidebar:
5
+ order: 3
6
+ ---
7
+
8
+ Every limit here is a display budget, not a policy limit. Exceeding one is
9
+ always stated in the result, because a silent cut is how a caller comes to
10
+ believe it has seen a whole file, a whole listing, or a whole match set when it
11
+ has not.
12
+
13
+ Three disclosure shapes cover the library:
14
+
15
+ - `truncated` plus an optional `notice` string, on the paged and HTTP flows.
16
+ The notice reads `Showing 3 of 40 lines; output was truncated.`, or
17
+ `Showing 60000 of 1048576 bytes; output was truncated.` on the HTTP flows.
18
+ - `<stream>Truncated` plus `<stream>DroppedBytes`, on the flows that capture a
19
+ process.
20
+ - A typed refusal, where handing back a fragment would be worse than answering
21
+ nothing. `webfetch` and `fetch` refuse a response past 5 MiB with
22
+ `response_too_large`; `NativeSearch` refuses an `rg` stream past its capture
23
+ bound rather than risk disagreeing with the in-process peer.
24
+
25
+ ## The caps
26
+
27
+ These values are fixed in the package and are not exported. They are what the
28
+ handlers apply:
29
+
30
+ | Cap | Value | Applies to |
31
+ | --------------------- | --------------------------- | ---------------------------------------------------------- |
32
+ | Default `read` page | 2,000 lines | one `read` call with no `limit` |
33
+ | Displayed line | 2,000 Unicode scalar values | one line of a `read` page |
34
+ | Entries per page | 1,000 | one `ls` or `glob` page |
35
+ | Matches per call | 200 | one `grep` call |
36
+ | Match line preview | 500 characters | one `grep` match or context line |
37
+ | Rendered text payload | 60,000 bytes | one `read` page, `fetch`/`http-post` body, `webfetch` page |
38
+ | Shell stream capture | 30,000 bytes | each captured `bash` stream |
39
+ | HTTP response body | 5 MiB | `fetch`, `http-post`, and `webfetch`, refused past the cap |
40
+ | Redirects | 10 | one `webfetch` call |
41
+ | Language-server frame | 8 MiB body, 8 KiB header | one JSON-RPC frame |
42
+
43
+ These are exported constants, so a host can read them and a caller can raise or
44
+ lower what it passes:
45
+
46
+ | Constant | Value | Applies to |
47
+ | ----------------------------------------- | ---------- | ----------------------------------------------------------- |
48
+ | `Bash.DEFAULT_TIMEOUT_MS` | 600,000 | one `bash` call with no `timeoutMs` |
49
+ | `TestRun.DEFAULT_TIMEOUT_MS` | 600,000 | one `test` call with no `timeoutMs` |
50
+ | `TestRun.MAX_CAPTURE_BYTES` | 8,000,000 | runner output one `test` call holds in memory |
51
+ | `ShellCommand.DEFAULT_TIMEOUT_MS` | 10,000 | one `shell_command` call with no `timeout_ms` |
52
+ | `ShellCommand.MAX_CAPTURE_BYTES` | 8,000,000 | command output one `shell_command` call holds in memory |
53
+ | `ShellCommand.DEFAULT_MAX_OUTPUT_TOKENS` | 10,000 | the Codex token budget the output is shaped to |
54
+ | `ShellCommand.TIMEOUT_EXIT_CODE` | 124 | the exit code a timed-out `shell_command` reports |
55
+ | `NativeSearch.MAX_CAPTURE_BYTES` | 67,108,864 | one `rg` invocation's captured output, refused past the cap |
56
+ | `NodeLanguageServer.MAX_QUEUED_FRAMES` | 256 | frames buffered for one server's standard input |
57
+ | `NodeLanguageServer.MAX_PENDING_REQUESTS` | 512 | concurrent in-flight requests to one server |
58
+
59
+ ## A page ends on a whole line
60
+
61
+ A byte budget cuts mid-line, and a partial line reads like an anchor and is not
62
+ one. So a `read` page truncated by bytes ends at the last whole line it could
63
+ afford, and `endLine` counts only the lines it actually returned. A line clipped
64
+ by the 2,000-character display cap is called out in the notice by name, because
65
+ such a line cannot be used as an `edit` anchor either.
66
+
67
+ ## A limit counts matches, not rows
68
+
69
+ `grep` returns match-centric results, which is how `rg --json` groups its own
70
+ output. `limit` counts matches, each match carries the context lines that belong
71
+ to it, and every context line belongs to exactly one match. A budget that
72
+ counted rows could spend itself on context and drop the hit, which is a result
73
+ that shows the lines around a match and not the match.
74
+
75
+ ## A listing is ordered before it is paged
76
+
77
+ `ls` describes every entry before it cuts the page, because the order it
78
+ promises is directories first and a kind costs a stat. Ordering inside the page
79
+ instead would make `offset` address a different listing at every page size, so a
80
+ caller paging a large directory could see one entry twice and another never.
81
+
82
+ ## Truncation flags are a wire contract
83
+
84
+ `stdoutTruncated`, `stderrTruncated`, and `tailTruncated` are not display
85
+ details. A truncated capture is a fragment of what the process printed, and
86
+ [`@smthrs/harness`](/api/harness) reads these flags to refuse a later write of
87
+ those exact bytes: writing a captured fragment over a file replaces the file
88
+ with a piece of a log. Read the flag before writing captured output anywhere, and set
89
+ it in your own handler whenever you cut a capture: a consumer that cannot tell a
90
+ fragment from the whole writes the fragment.
91
+
92
+ `stdoutDroppedBytes`, `stderrDroppedBytes`, and `tailDroppedBytes` count what
93
+ the process actually produced beyond the capture. Capture is bounded where the
94
+ stream is read rather than after it is read, so a command that prints gigabytes
95
+ costs the bound instead of the whole of what it printed. `bash` keeps the
96
+ first and last 15,000 bytes of each stream and puts one line such as
97
+ `[10025 bytes omitted]` where the middle was, because a search prints its
98
+ matches first and a failing command prints its verdict last. Its dropped-bytes
99
+ count is the size of that middle. `test` keeps the tail; `read`, `fetch`, and
100
+ `http-post` keep the head.
101
+
102
+ Every caller-supplied command (`bash`, `test`, `shell_command`) passes a capture
103
+ bound. The internal `git` plumbing behind `Checkpoints` and `TestRun`'s baseline
104
+ does not, because a listing read for its content is useless with its head
105
+ missing.
@@ -0,0 +1,182 @@
1
+ ---
2
+ title: "The search contract"
3
+ description: "Smithers Ripgrep Subset v1: what grep and glob support, how patterns and globs are read relative to the search root, and how two peer implementations are held to one answer."
4
+ sidebar:
5
+ order: 4
6
+ ---
7
+
8
+ `grep` and `glob` are two projections of one contract, Smithers Ripgrep Subset
9
+ v1. The contract exists because the package ships two implementations of it, and
10
+ a caller must not be able to tell which one answered.
11
+
12
+ - `PortableSearch` walks the injected `FileSystem` in process. It needs no
13
+ external binary, so it is the peer a browser host and a test host use.
14
+ - `NativeSearch` drives the `rg` executable through the permission-aware
15
+ spawner.
16
+
17
+ Both are bound to the `Search` service, and `Grep.run` and `Glob.run` call
18
+ whichever one the host provided. Neither module knows which peer is in play.
19
+
20
+ ## What v1 supports
21
+
22
+ `grep` corresponds to a bounded subset of ripgrep's flags:
23
+
24
+ | Input field | Ripgrep flag |
25
+ | ------------------------------------------ | ----------------------------------------- |
26
+ | `fixedStrings` | `-F` |
27
+ | `ignoreCase` | `-i` |
28
+ | `smartCase` | `-S` |
29
+ | `globs` | ordered `-g` include and exclude patterns |
30
+ | `beforeContext`, `afterContext`, `context` | `-B`, `-A`, `-C` |
31
+ | `maxCount` | `--max-count`, per file |
32
+ | `filesWithMatches` | `--files-with-matches` |
33
+ | `hidden` | `--hidden` |
34
+ | `noIgnore` | `--no-ignore` |
35
+ | `limit` | the global result budget, capped at 200 |
36
+
37
+ `glob` corresponds to `rg --files -g <pattern>`.
38
+
39
+ `noIgnore` is an optional boolean defaulting to `false`. Both flows apply
40
+ `.gitignore` rules from the search root and nested directories, even outside
41
+ Git repositories. Set `noIgnore: true` to include ignored paths. Parent and
42
+ global ignore rules, `.ignore`, `.rgignore`, and `.git/info/exclude` do not
43
+ participate. Hidden-file and fixed directory skips still apply.
44
+
45
+ File-type registries are not supported, so there is no `types` field to pass.
46
+ `-i` and `-S` together, and `-C` combined with `-A` or `-B`, are `invalid_input`,
47
+ because ripgrep's own precedence for those combinations is not a thing two peers
48
+ should each guess at.
49
+
50
+ ## The pattern grammar
51
+
52
+ Smithers Ripgrep ASCII v1 is deliberately the intersection of Rust's regex crate
53
+ and JavaScript's `RegExp`, so both peers compile the same pattern to the same
54
+ meaning. A pattern is rejected with `invalid_pattern` when it:
55
+
56
+ - contains anything outside printable ASCII, or exceeds 4,096 bytes;
57
+ - opens a special group with `(?`, which covers lookaround and named groups;
58
+ - escapes an alphanumeric, which covers backreferences, shorthand classes such
59
+ as `\d`, and encoded escapes;
60
+ - nests a character class, leaves one empty, or uses a class set operation
61
+ (`&&`, `--`, `~~`);
62
+ - names a counted repetition above 1,000;
63
+ - exceeds 128 nested groups or 8,192 compiled states after repetition expansion;
64
+ - fails to compile as a JavaScript regular expression.
65
+
66
+ `fixedStrings: true` skips the grammar entirely except for the ASCII and length
67
+ checks, because a literal is escaped rather than compiled.
68
+
69
+ Inside the shared compiler, `.` matches any character except a newline and `$`
70
+ anchors at the end of the whole input, which is what makes a line-oriented
71
+ search behave the same in both peers.
72
+
73
+ Portable grep evaluates this grammar with a Thompson state machine. Matching
74
+ work is linear in line length times the bounded state count, including nested
75
+ quantifiers and ambiguous alternatives. It yields every 4,096 state visits so
76
+ host timers and Effect interruption can run during a long match. JavaScript
77
+ regular expressions are used only for individual character predicates.
78
+
79
+ The portable scan reads files in chunks and counts overflow without retaining
80
+ all hits. It keeps the first `limit` hits and their context, plus one boundary
81
+ hit to preserve context ownership at truncation. Symbol source is loaded only
82
+ for files with returned hits and released after annotating each file. Memory
83
+ still includes the current line and, with `symbols: true`, one retained hit's
84
+ source file; `limit` is a result budget, not a byte limit on that source.
85
+
86
+ ## Globs are relative to the root, never absolute
87
+
88
+ This is the rule that most often surprises a caller, and getting it wrong is
89
+ silent: an absolute pattern matches nothing at all, forever.
90
+
91
+ A candidate is matched by the path it has **relative to the search root**. Three
92
+ consequences, and both peers implement all three identically:
93
+
94
+ - A pattern with no `/` matches the **basename** at any depth. `*.py` finds
95
+ every Python file in the subtree.
96
+ - A pattern containing `/` is matched against the root-relative path and is
97
+ anchored at the root. `tests/*.py` matches `<root>/tests/a.py` and not
98
+ `<root>/src/tests/a.py`.
99
+ - A leading `/` is that same anchor spelled explicitly, not a filesystem
100
+ absolute path. `/a.py` matches only `<root>/a.py`, where bare `a.py` would
101
+ match any `a.py` in the subtree. A leading `./` means the same anchor.
102
+
103
+ `**` crosses directory boundaries; `*` and `?` stay inside one segment; `?`
104
+ consumes one UTF-8 byte. Brace alternatives expand, up to 256 patterns. Glob
105
+ escapes and character classes are not supported. Trailing spaces are not part of
106
+ a pattern, because `rg` reads `-g` by gitignore's rules and drops them, and a
107
+ pattern left blank by that is rejected rather than read as no filter at all.
108
+
109
+ Ordered include and exclude globs work like ripgrep's: with no positive glob
110
+ everything is included, and the last pattern to match a candidate decides, with
111
+ `!` marking an exclusion.
112
+
113
+ So `/home/repo/tests/**` passed against a root of `/home/repo` is read as the
114
+ root-relative path `home/repo/tests/**`, which nothing under that root can
115
+ match. That answer is never silent: a positive glob no file under the root could
116
+ match is explained through `notice`, naming the reason (a missing directory, a
117
+ skipped directory, a hidden path with `hidden` left false) and, where it applies,
118
+ the root-relative pattern the caller probably meant.
119
+
120
+ A `root` that names one file is that file. It is reported whatever the pattern
121
+ says, because `rg` searches a path given on its command line without consulting
122
+ `-g`.
123
+
124
+ ## What a walk skips
125
+
126
+ Repository internals, dependency trees, caches, and worktrees are never
127
+ descended into. This includes `.artifacts`, `.backend-go-modcache`,
128
+ `.pnpm-store`, `.worktrees`, and `worktrees`. Skipping applies to descent and
129
+ never to what the caller named, so naming one of them as the `root` still
130
+ searches it.
131
+
132
+ A walk also skips what it cannot read: a dangling symlink, a link cycle, a
133
+ directory the process may not list. One unreadable entry never fails the call,
134
+ which is what `rg --no-messages` does with the same tree. Only the root the
135
+ caller named can fail the walk.
136
+
137
+ Files with a NUL byte are skipped and counted in `skippedBinary`. Invalid UTF-8
138
+ in a searched file is replacement-decoded rather than refused.
139
+
140
+ ## Two properties that belong to the contract, not to a peer
141
+
142
+ Both are computed in shared code, so neither peer can drift on them:
143
+
144
+ - **Each hit carries its enclosing definition.** A line number is not a read
145
+ window. When a file's shape says plainly which definition a hit sits in, the
146
+ match carries `symbol` with that definition's `kind`, `name`, `startLine`, and
147
+ `endLine`, so the follow-up `read` is a fact rather than a guess. The
148
+ heuristic answers nothing rather than guessing when the shape is not plain.
149
+ - **A metacharacter pattern that finds nothing is retried literally.** If a
150
+ pattern containing regex metacharacters produces no matches and no files, the
151
+ search runs again with `fixedStrings: true`. When that finds something, the
152
+ result carries `retriedAsLiteral: true` and says so in `notice`. A search that
153
+ found nothing because the caller wrote a literal containing `(` is the most
154
+ common way a search lies.
155
+
156
+ ## Proving a third peer
157
+
158
+ `Search` is a public seam: a host may bind its own implementation. Two modules
159
+ exist so that a new peer can be held to the same contract as the shipped ones.
160
+
161
+ `SearchContract` exports the matcher both peers build on, so a third peer reuses
162
+ the meaning of a pattern instead of reimplementing it:
163
+
164
+ ```ts
165
+ import * as SearchContract from "@smthrs/std/SearchContract"
166
+
167
+ SearchContract.validatePattern("foo.*bar", false) // undefined, or a StdError
168
+ SearchContract.validateGlob("src/**/*.ts") // undefined, or a StdError
169
+ SearchContract.canonicalGlob("./src/**/*.ts ") // "/src/**/*.ts"
170
+ SearchContract.matchesGlob("*.ts", "src/widen.ts", "widen.ts") // true
171
+ SearchContract.includedByGlobs(["**/*.ts", "!**/*.d.ts"], "src/a.d.ts", "a.d.ts") // false
172
+ ```
173
+
174
+ `SearchConformance` is the differential kit: it generates a tree and a batch of
175
+ calls from a seed, runs them through two implementations, and reports every
176
+ answer that differs. It knows nothing about which peer is right; a divergence is
177
+ the finding. It found two real drifts between the peers shipped here, one in how
178
+ `maxCount` interacts with context lines and one in how `ignoreCase` and
179
+ `smartCase` combine.
180
+
181
+ The walkthrough is
182
+ [Implement your own search peer](../guides/implement-a-search-peer.md).
@@ -0,0 +1,116 @@
1
+ ---
2
+ title: "Bind the standard flows into a host"
3
+ description: "Compose the platform and service layers the handlers require, offer the declarations to a model, and use the read-only projection for a restricted tool surface."
4
+ sidebar:
5
+ order: 1
6
+ ---
7
+
8
+ A host does two things with this package: it offers declarations to a model, and
9
+ it runs the matching handlers when a call arrives. This guide covers the
10
+ composition both halves need.
11
+
12
+ ## Compose the host layer
13
+
14
+ Start with a platform layer, then add one layer per service a flow needs:
15
+
16
+ ```ts
17
+ import { NodeServices } from "@effect/platform-node"
18
+ import * as Container from "@smthrs/std/Container"
19
+ import * as NativeSearch from "@smthrs/std/NativeSearch"
20
+ import * as TestRunner from "@smthrs/std/TestRunner"
21
+ import * as Layer from "effect/Layer"
22
+
23
+ /** FileSystem, Path, and ChildProcessSpawner. */
24
+ const platform = NodeServices.layer
25
+
26
+ const host = Layer.mergeAll(
27
+ platform,
28
+ // grep and glob, through the rg executable.
29
+ NativeSearch.layer.pipe(Layer.provide(platform)),
30
+ // bash and test, when a call names a container.
31
+ Container.layerCommand({ program: "docker" }),
32
+ // test: how the project under test runs its suite.
33
+ TestRunner.layer({ command: "pnpm vitest run", cwd: "/workspace" })
34
+ )
35
+ ```
36
+
37
+ Swap `NativeSearch.layer` for `PortableSearch.layer` to search in process with
38
+ no external binary. Both satisfy the same `Search` service, and nothing above
39
+ the layer changes. When the files live on another machine, such as a container
40
+ or a sandbox machine, `RemoteSearch.make` over that machine's spawner and `Path`
41
+ answers in two round trips where the portable peer would ask once per file.
42
+
43
+ A host that cannot serve a service binds its refusal layer instead of leaving it
44
+ out, so the failure names the missing service rather than a missing context:
45
+
46
+ ```ts
47
+ import * as Checkpoints from "@smthrs/std/Checkpoints"
48
+ import * as LanguageServer from "@smthrs/std/LanguageServer"
49
+ import * as WebSearch from "@smthrs/std/WebSearch"
50
+
51
+ const unavailable = Layer.mergeAll(
52
+ WebSearch.layerNoop, // websearch fails with provider_unavailable
53
+ LanguageServer.layerNoop, // lsp fails with unsupported
54
+ Checkpoints.layerNoop // pinning fails with provider_unavailable
55
+ )
56
+ ```
57
+
58
+ ## Run one handler
59
+
60
+ A handler is an ordinary Effect. Provide the composed host and run it:
61
+
62
+ ```ts
63
+ import * as Grep from "@smthrs/std/Grep"
64
+ import * as Effect from "effect/Effect"
65
+
66
+ const hits = Effect.provide(
67
+ Grep.run({ pattern: "TODO", root: "/workspace", globs: ["*.ts"] }),
68
+ host
69
+ )
70
+ ```
71
+
72
+ ## Offer the declarations
73
+
74
+ `Manifest.flows` is the declaration registry, keyed by the same names a model
75
+ calls. Offering all 17 is one expression:
76
+
77
+ ```ts
78
+ import * as Manifest from "@smthrs/std/Manifest"
79
+
80
+ const offered = Manifest.names.map((name) => Manifest.flows[name])
81
+ ```
82
+
83
+ For a tool surface that must not change anything, use the read-only projection
84
+ instead of filtering by hand:
85
+
86
+ ```ts
87
+ const readOnly = Manifest.readOnly.map((name) => Manifest.flows[name])
88
+ ```
89
+
90
+ `Manifest.readOnly` is `read`, `ls`, `glob`, `grep`, `fetch`, `explore`,
91
+ `webfetch`, and `lsp`. `websearch` is not in it: its provider contract requires
92
+ `net:post` authority, which is mutating under the kernel capability taxonomy.
93
+
94
+ ## Narrow the envelope for one call
95
+
96
+ When a call arrives, narrow its declared envelope to what that input actually
97
+ touches before scheduling it. `Manifest.effectsFor` reaches the narrowing by
98
+ name:
99
+
100
+ ```ts
101
+ const narrowed = Manifest.effectsFor["read"]({ path: "/workspace/notes.md" })
102
+ // reads: ["/workspace/notes.md"], instead of the declared ["/**"]
103
+ ```
104
+
105
+ Without this, two reads of two different files serialize against each other. See
106
+ [Effects and capabilities](../concepts/effects-and-capabilities.md).
107
+
108
+ ## The production path
109
+
110
+ [`@smthrs/agent`](/api/agent) already does all of this. Its `StandardFlows`
111
+ module pairs each declaration with its handler through
112
+ [`@smthrs/harness`](/api/harness)'s `FlowBinding` contract, and groups them by
113
+ the slice of host services they need: `filesystem` binds `read`, `write`,
114
+ `edit`, `apply_patch`, `ls`, `glob`, and `grep`; `shell` binds `bash`; `tests`
115
+ binds `test`. If you are building an agent rather than a tool host, start there:
116
+ [Give a run capabilities](/pkg/agent/guides/capabilities).