@smthrs/std 0.0.0-stage → 1.0.0-rc.3
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.
- package/CHANGELOG.md +130 -0
- package/LICENSE +21 -0
- package/README.md +152 -2
- package/dist/cjs/ApplyPatch.d.ts +174 -0
- package/dist/cjs/ApplyPatch.d.ts.map +1 -0
- package/dist/cjs/ApplyPatch.js +309 -0
- package/dist/cjs/ApplyPatch.js.map +7 -0
- package/dist/cjs/Bash.d.ts +304 -0
- package/dist/cjs/Bash.d.ts.map +1 -0
- package/dist/cjs/Bash.js +321 -0
- package/dist/cjs/Bash.js.map +7 -0
- package/dist/cjs/Checkpoints.d.ts +279 -0
- package/dist/cjs/Checkpoints.d.ts.map +1 -0
- package/dist/cjs/Checkpoints.js +145 -0
- package/dist/cjs/Checkpoints.js.map +7 -0
- package/dist/cjs/Container.d.ts +132 -0
- package/dist/cjs/Container.d.ts.map +1 -0
- package/dist/cjs/Container.js +113 -0
- package/dist/cjs/Container.js.map +7 -0
- package/dist/cjs/Edit.d.ts +203 -0
- package/dist/cjs/Edit.d.ts.map +1 -0
- package/dist/cjs/Edit.js +258 -0
- package/dist/cjs/Edit.js.map +7 -0
- package/dist/cjs/ExaWebSearch.d.ts +22 -0
- package/dist/cjs/ExaWebSearch.d.ts.map +1 -0
- package/dist/cjs/ExaWebSearch.js +138 -0
- package/dist/cjs/ExaWebSearch.js.map +7 -0
- package/dist/cjs/Explore.d.ts +328 -0
- package/dist/cjs/Explore.d.ts.map +1 -0
- package/dist/cjs/Explore.js +90 -0
- package/dist/cjs/Explore.js.map +7 -0
- package/dist/cjs/Fetch.d.ts +130 -0
- package/dist/cjs/Fetch.d.ts.map +1 -0
- package/dist/cjs/Fetch.js +64 -0
- package/dist/cjs/Fetch.js.map +7 -0
- package/dist/cjs/Glob.d.ts +204 -0
- package/dist/cjs/Glob.d.ts.map +1 -0
- package/dist/cjs/Glob.js +94 -0
- package/dist/cjs/Glob.js.map +7 -0
- package/dist/cjs/Grep.d.ts +347 -0
- package/dist/cjs/Grep.d.ts.map +1 -0
- package/dist/cjs/Grep.js +181 -0
- package/dist/cjs/Grep.js.map +7 -0
- package/dist/cjs/HttpPost.d.ts +130 -0
- package/dist/cjs/HttpPost.d.ts.map +1 -0
- package/dist/cjs/HttpPost.js +72 -0
- package/dist/cjs/HttpPost.js.map +7 -0
- package/dist/cjs/LanguageServer.d.ts +90 -0
- package/dist/cjs/LanguageServer.d.ts.map +1 -0
- package/dist/cjs/LanguageServer.js +60 -0
- package/dist/cjs/LanguageServer.js.map +7 -0
- package/dist/cjs/Ls.d.ts +164 -0
- package/dist/cjs/Ls.d.ts.map +1 -0
- package/dist/cjs/Ls.js +136 -0
- package/dist/cjs/Ls.js.map +7 -0
- package/dist/cjs/Lsp.d.ts +125 -0
- package/dist/cjs/Lsp.d.ts.map +1 -0
- package/dist/cjs/Lsp.js +137 -0
- package/dist/cjs/Lsp.js.map +7 -0
- package/dist/cjs/Manifest.d.ts +918 -0
- package/dist/cjs/Manifest.d.ts.map +1 -0
- package/dist/cjs/Manifest.js +144 -0
- package/dist/cjs/Manifest.js.map +7 -0
- package/dist/cjs/NativeSearch.d.ts +38 -0
- package/dist/cjs/NativeSearch.d.ts.map +1 -0
- package/dist/cjs/NativeSearch.js +326 -0
- package/dist/cjs/NativeSearch.js.map +7 -0
- package/dist/cjs/NodeLanguageServer.d.ts +128 -0
- package/dist/cjs/NodeLanguageServer.d.ts.map +1 -0
- package/dist/cjs/NodeLanguageServer.js +796 -0
- package/dist/cjs/NodeLanguageServer.js.map +7 -0
- package/dist/cjs/PortableSearch.d.ts +24 -0
- package/dist/cjs/PortableSearch.d.ts.map +1 -0
- package/dist/cjs/PortableSearch.js +233 -0
- package/dist/cjs/PortableSearch.js.map +7 -0
- package/dist/cjs/Probe.d.ts +193 -0
- package/dist/cjs/Probe.d.ts.map +1 -0
- package/dist/cjs/Probe.js +134 -0
- package/dist/cjs/Probe.js.map +7 -0
- package/dist/cjs/Read.d.ts +189 -0
- package/dist/cjs/Read.d.ts.map +1 -0
- package/dist/cjs/Read.js +223 -0
- package/dist/cjs/Read.js.map +7 -0
- package/dist/cjs/Relocate.d.ts +73 -0
- package/dist/cjs/Relocate.d.ts.map +1 -0
- package/dist/cjs/Relocate.js +72 -0
- package/dist/cjs/Relocate.js.map +7 -0
- package/dist/cjs/Search.d.ts +163 -0
- package/dist/cjs/Search.d.ts.map +1 -0
- package/dist/cjs/Search.js +51 -0
- package/dist/cjs/Search.js.map +7 -0
- package/dist/cjs/SearchConformance.d.ts +115 -0
- package/dist/cjs/SearchConformance.d.ts.map +1 -0
- package/dist/cjs/SearchConformance.js +172 -0
- package/dist/cjs/SearchConformance.js.map +7 -0
- package/dist/cjs/SearchContract.d.ts +114 -0
- package/dist/cjs/SearchContract.d.ts.map +1 -0
- package/dist/cjs/SearchContract.js +339 -0
- package/dist/cjs/SearchContract.js.map +7 -0
- package/dist/cjs/ShellCommand.d.ts +164 -0
- package/dist/cjs/ShellCommand.d.ts.map +1 -0
- package/dist/cjs/ShellCommand.js +102 -0
- package/dist/cjs/ShellCommand.js.map +7 -0
- package/dist/cjs/StdError.d.ts +55 -0
- package/dist/cjs/StdError.d.ts.map +1 -0
- package/dist/cjs/StdError.js +74 -0
- package/dist/cjs/StdError.js.map +7 -0
- package/dist/cjs/TestRun.d.ts +311 -0
- package/dist/cjs/TestRun.d.ts.map +1 -0
- package/dist/cjs/TestRun.js +228 -0
- package/dist/cjs/TestRun.js.map +7 -0
- package/dist/cjs/TestRunner.d.ts +102 -0
- package/dist/cjs/TestRunner.d.ts.map +1 -0
- package/dist/cjs/TestRunner.js +54 -0
- package/dist/cjs/TestRunner.js.map +7 -0
- package/dist/cjs/TreeFingerprint.d.ts +140 -0
- package/dist/cjs/TreeFingerprint.d.ts.map +1 -0
- package/dist/cjs/TreeFingerprint.js +87 -0
- package/dist/cjs/TreeFingerprint.js.map +7 -0
- package/dist/cjs/UpdatePlan.d.ts +152 -0
- package/dist/cjs/UpdatePlan.d.ts.map +1 -0
- package/dist/cjs/UpdatePlan.js +87 -0
- package/dist/cjs/UpdatePlan.js.map +7 -0
- package/dist/cjs/WebFetch.d.ts +134 -0
- package/dist/cjs/WebFetch.d.ts.map +1 -0
- package/dist/cjs/WebFetch.js +140 -0
- package/dist/cjs/WebFetch.js.map +7 -0
- package/dist/cjs/WebSearch.d.ts +181 -0
- package/dist/cjs/WebSearch.d.ts.map +1 -0
- package/dist/cjs/WebSearch.js +86 -0
- package/dist/cjs/WebSearch.js.map +7 -0
- package/dist/cjs/Write.d.ts +147 -0
- package/dist/cjs/Write.d.ts.map +1 -0
- package/dist/cjs/Write.js +122 -0
- package/dist/cjs/Write.js.map +7 -0
- package/dist/cjs/index.d.ts +127 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +99 -0
- package/dist/cjs/index.js.map +7 -0
- package/dist/cjs/internal/ApplyPatch.d.ts +145 -0
- package/dist/cjs/internal/ApplyPatch.d.ts.map +1 -0
- package/dist/cjs/internal/ApplyPatch.js +462 -0
- package/dist/cjs/internal/ApplyPatch.js.map +7 -0
- package/dist/cjs/internal/CodexText.d.ts +73 -0
- package/dist/cjs/internal/CodexText.d.ts.map +1 -0
- package/dist/cjs/internal/CodexText.js +108 -0
- package/dist/cjs/internal/CodexText.js.map +7 -0
- package/dist/cjs/internal/Declaration.d.ts +49 -0
- package/dist/cjs/internal/Declaration.d.ts.map +1 -0
- package/dist/cjs/internal/Declaration.js +46 -0
- package/dist/cjs/internal/Declaration.js.map +7 -0
- package/dist/cjs/internal/Diagnostics.d.ts +77 -0
- package/dist/cjs/internal/Diagnostics.d.ts.map +1 -0
- package/dist/cjs/internal/Diagnostics.js +89 -0
- package/dist/cjs/internal/Diagnostics.js.map +7 -0
- package/dist/cjs/internal/EnvelopePrecheck.d.ts +67 -0
- package/dist/cjs/internal/EnvelopePrecheck.d.ts.map +1 -0
- package/dist/cjs/internal/EnvelopePrecheck.js +124 -0
- package/dist/cjs/internal/EnvelopePrecheck.js.map +7 -0
- package/dist/cjs/internal/Exec.d.ts +139 -0
- package/dist/cjs/internal/Exec.d.ts.map +1 -0
- package/dist/cjs/internal/Exec.js +158 -0
- package/dist/cjs/internal/Exec.js.map +7 -0
- package/dist/cjs/internal/FileMutation.d.ts +109 -0
- package/dist/cjs/internal/FileMutation.d.ts.map +1 -0
- package/dist/cjs/internal/FileMutation.js +116 -0
- package/dist/cjs/internal/FileMutation.js.map +7 -0
- package/dist/cjs/internal/FsFailure.d.ts +38 -0
- package/dist/cjs/internal/FsFailure.d.ts.map +1 -0
- package/dist/cjs/internal/FsFailure.js +40 -0
- package/dist/cjs/internal/FsFailure.js.map +7 -0
- package/dist/cjs/internal/GitWorktree.d.ts +98 -0
- package/dist/cjs/internal/GitWorktree.d.ts.map +1 -0
- package/dist/cjs/internal/GitWorktree.js +270 -0
- package/dist/cjs/internal/GitWorktree.js.map +7 -0
- package/dist/cjs/internal/Grouping.d.ts +51 -0
- package/dist/cjs/internal/Grouping.d.ts.map +1 -0
- package/dist/cjs/internal/Grouping.js +83 -0
- package/dist/cjs/internal/Grouping.js.map +7 -0
- package/dist/cjs/internal/Html.d.ts +20 -0
- package/dist/cjs/internal/Html.d.ts.map +1 -0
- package/dist/cjs/internal/Html.js +81 -0
- package/dist/cjs/internal/Html.js.map +7 -0
- package/dist/cjs/internal/Http.d.ts +95 -0
- package/dist/cjs/internal/Http.d.ts.map +1 -0
- package/dist/cjs/internal/Http.js +153 -0
- package/dist/cjs/internal/Http.js.map +7 -0
- package/dist/cjs/internal/HttpNetwork.d.ts +27 -0
- package/dist/cjs/internal/HttpNetwork.d.ts.map +1 -0
- package/dist/cjs/internal/HttpNetwork.js +146 -0
- package/dist/cjs/internal/HttpNetwork.js.map +7 -0
- package/dist/cjs/internal/Ignore.d.ts +37 -0
- package/dist/cjs/internal/Ignore.d.ts.map +1 -0
- package/dist/cjs/internal/Ignore.js +100 -0
- package/dist/cjs/internal/Ignore.js.map +7 -0
- package/dist/cjs/internal/LinearRegex.d.ts +19 -0
- package/dist/cjs/internal/LinearRegex.d.ts.map +1 -0
- package/dist/cjs/internal/LinearRegex.js +166 -0
- package/dist/cjs/internal/LinearRegex.js.map +7 -0
- package/dist/cjs/internal/Match.d.ts +85 -0
- package/dist/cjs/internal/Match.d.ts.map +1 -0
- package/dist/cjs/internal/Match.js +99 -0
- package/dist/cjs/internal/Match.js.map +7 -0
- package/dist/cjs/internal/Paths.d.ts +23 -0
- package/dist/cjs/internal/Paths.d.ts.map +1 -0
- package/dist/cjs/internal/Paths.js +52 -0
- package/dist/cjs/internal/Paths.js.map +7 -0
- package/dist/cjs/internal/Preserve.d.ts +25 -0
- package/dist/cjs/internal/Preserve.d.ts.map +1 -0
- package/dist/cjs/internal/Preserve.js +88 -0
- package/dist/cjs/internal/Preserve.js.map +7 -0
- package/dist/cjs/internal/Prune.d.ts +35 -0
- package/dist/cjs/internal/Prune.d.ts.map +1 -0
- package/dist/cjs/internal/Prune.js +54 -0
- package/dist/cjs/internal/Prune.js.map +7 -0
- package/dist/cjs/internal/SearchContract.d.ts +63 -0
- package/dist/cjs/internal/SearchContract.d.ts.map +1 -0
- package/dist/cjs/internal/SearchContract.js +46 -0
- package/dist/cjs/internal/SearchContract.js.map +7 -0
- package/dist/cjs/internal/Symbols.d.ts +39 -0
- package/dist/cjs/internal/Symbols.d.ts.map +1 -0
- package/dist/cjs/internal/Symbols.js +59 -0
- package/dist/cjs/internal/Symbols.js.map +7 -0
- package/dist/cjs/internal/TestReport.d.ts +52 -0
- package/dist/cjs/internal/TestReport.d.ts.map +1 -0
- package/dist/cjs/internal/TestReport.js +131 -0
- package/dist/cjs/internal/TestReport.js.map +7 -0
- package/dist/cjs/internal/Text.d.ts +114 -0
- package/dist/cjs/internal/Text.d.ts.map +1 -0
- package/dist/cjs/internal/Text.js +82 -0
- package/dist/cjs/internal/Text.js.map +7 -0
- package/dist/cjs/internal/Url.d.ts +13 -0
- package/dist/cjs/internal/Url.d.ts.map +1 -0
- package/dist/cjs/internal/Url.js +35 -0
- package/dist/cjs/internal/Url.js.map +7 -0
- package/dist/cjs/internal/Walk.d.ts +72 -0
- package/dist/cjs/internal/Walk.d.ts.map +1 -0
- package/dist/cjs/internal/Walk.js +108 -0
- package/dist/cjs/internal/Walk.js.map +7 -0
- package/dist/cjs/package.json +1 -0
- package/dist/esm/ApplyPatch.d.ts +174 -0
- package/dist/esm/ApplyPatch.d.ts.map +1 -0
- package/dist/esm/ApplyPatch.js +346 -0
- package/dist/esm/ApplyPatch.js.map +1 -0
- package/dist/esm/Bash.d.ts +304 -0
- package/dist/esm/Bash.d.ts.map +1 -0
- package/dist/esm/Bash.js +469 -0
- package/dist/esm/Bash.js.map +1 -0
- package/dist/esm/Checkpoints.d.ts +279 -0
- package/dist/esm/Checkpoints.d.ts.map +1 -0
- package/dist/esm/Checkpoints.js +298 -0
- package/dist/esm/Checkpoints.js.map +1 -0
- package/dist/esm/Container.d.ts +132 -0
- package/dist/esm/Container.d.ts.map +1 -0
- package/dist/esm/Container.js +151 -0
- package/dist/esm/Container.js.map +1 -0
- package/dist/esm/Edit.d.ts +203 -0
- package/dist/esm/Edit.d.ts.map +1 -0
- package/dist/esm/Edit.js +296 -0
- package/dist/esm/Edit.js.map +1 -0
- package/dist/esm/ExaWebSearch.d.ts +22 -0
- package/dist/esm/ExaWebSearch.d.ts.map +1 -0
- package/dist/esm/ExaWebSearch.js +107 -0
- package/dist/esm/ExaWebSearch.js.map +1 -0
- package/dist/esm/Explore.d.ts +328 -0
- package/dist/esm/Explore.d.ts.map +1 -0
- package/dist/esm/Explore.js +106 -0
- package/dist/esm/Explore.js.map +1 -0
- package/dist/esm/Fetch.d.ts +130 -0
- package/dist/esm/Fetch.d.ts.map +1 -0
- package/dist/esm/Fetch.js +91 -0
- package/dist/esm/Fetch.js.map +1 -0
- package/dist/esm/Glob.d.ts +204 -0
- package/dist/esm/Glob.d.ts.map +1 -0
- package/dist/esm/Glob.js +177 -0
- package/dist/esm/Glob.js.map +1 -0
- package/dist/esm/Grep.d.ts +347 -0
- package/dist/esm/Grep.d.ts.map +1 -0
- package/dist/esm/Grep.js +289 -0
- package/dist/esm/Grep.js.map +1 -0
- package/dist/esm/HttpPost.d.ts +130 -0
- package/dist/esm/HttpPost.d.ts.map +1 -0
- package/dist/esm/HttpPost.js +89 -0
- package/dist/esm/HttpPost.js.map +1 -0
- package/dist/esm/LanguageServer.d.ts +90 -0
- package/dist/esm/LanguageServer.d.ts.map +1 -0
- package/dist/esm/LanguageServer.js +57 -0
- package/dist/esm/LanguageServer.js.map +1 -0
- package/dist/esm/Ls.d.ts +164 -0
- package/dist/esm/Ls.d.ts.map +1 -0
- package/dist/esm/Ls.js +178 -0
- package/dist/esm/Ls.js.map +1 -0
- package/dist/esm/Lsp.d.ts +125 -0
- package/dist/esm/Lsp.d.ts.map +1 -0
- package/dist/esm/Lsp.js +165 -0
- package/dist/esm/Lsp.js.map +1 -0
- package/dist/esm/Manifest.d.ts +918 -0
- package/dist/esm/Manifest.d.ts.map +1 -0
- package/dist/esm/Manifest.js +153 -0
- package/dist/esm/Manifest.js.map +1 -0
- package/dist/esm/NativeSearch.d.ts +38 -0
- package/dist/esm/NativeSearch.d.ts.map +1 -0
- package/dist/esm/NativeSearch.js +378 -0
- package/dist/esm/NativeSearch.js.map +1 -0
- package/dist/esm/NodeLanguageServer.d.ts +128 -0
- package/dist/esm/NodeLanguageServer.d.ts.map +1 -0
- package/dist/esm/NodeLanguageServer.js +843 -0
- package/dist/esm/NodeLanguageServer.js.map +1 -0
- package/dist/esm/PortableSearch.d.ts +24 -0
- package/dist/esm/PortableSearch.d.ts.map +1 -0
- package/dist/esm/PortableSearch.js +240 -0
- package/dist/esm/PortableSearch.js.map +1 -0
- package/dist/esm/Probe.d.ts +193 -0
- package/dist/esm/Probe.d.ts.map +1 -0
- package/dist/esm/Probe.js +225 -0
- package/dist/esm/Probe.js.map +1 -0
- package/dist/esm/Read.d.ts +189 -0
- package/dist/esm/Read.d.ts.map +1 -0
- package/dist/esm/Read.js +300 -0
- package/dist/esm/Read.js.map +1 -0
- package/dist/esm/Relocate.d.ts +73 -0
- package/dist/esm/Relocate.d.ts.map +1 -0
- package/dist/esm/Relocate.js +153 -0
- package/dist/esm/Relocate.js.map +1 -0
- package/dist/esm/Search.d.ts +163 -0
- package/dist/esm/Search.d.ts.map +1 -0
- package/dist/esm/Search.js +47 -0
- package/dist/esm/Search.js.map +1 -0
- package/dist/esm/SearchConformance.d.ts +115 -0
- package/dist/esm/SearchConformance.d.ts.map +1 -0
- package/dist/esm/SearchConformance.js +193 -0
- package/dist/esm/SearchConformance.js.map +1 -0
- package/dist/esm/SearchContract.d.ts +114 -0
- package/dist/esm/SearchContract.d.ts.map +1 -0
- package/dist/esm/SearchContract.js +461 -0
- package/dist/esm/SearchContract.js.map +1 -0
- package/dist/esm/ShellCommand.d.ts +164 -0
- package/dist/esm/ShellCommand.d.ts.map +1 -0
- package/dist/esm/ShellCommand.js +159 -0
- package/dist/esm/ShellCommand.js.map +1 -0
- package/dist/esm/StdError.d.ts +55 -0
- package/dist/esm/StdError.d.ts.map +1 -0
- package/dist/esm/StdError.js +71 -0
- package/dist/esm/StdError.js.map +1 -0
- package/dist/esm/TestRun.d.ts +311 -0
- package/dist/esm/TestRun.d.ts.map +1 -0
- package/dist/esm/TestRun.js +316 -0
- package/dist/esm/TestRun.js.map +1 -0
- package/dist/esm/TestRunner.d.ts +102 -0
- package/dist/esm/TestRunner.d.ts.map +1 -0
- package/dist/esm/TestRunner.js +68 -0
- package/dist/esm/TestRunner.js.map +1 -0
- package/dist/esm/TreeFingerprint.d.ts +140 -0
- package/dist/esm/TreeFingerprint.d.ts.map +1 -0
- package/dist/esm/TreeFingerprint.js +170 -0
- package/dist/esm/TreeFingerprint.js.map +1 -0
- package/dist/esm/UpdatePlan.d.ts +152 -0
- package/dist/esm/UpdatePlan.d.ts.map +1 -0
- package/dist/esm/UpdatePlan.js +129 -0
- package/dist/esm/UpdatePlan.js.map +1 -0
- package/dist/esm/WebFetch.d.ts +134 -0
- package/dist/esm/WebFetch.d.ts.map +1 -0
- package/dist/esm/WebFetch.js +151 -0
- package/dist/esm/WebFetch.js.map +1 -0
- package/dist/esm/WebSearch.d.ts +181 -0
- package/dist/esm/WebSearch.d.ts.map +1 -0
- package/dist/esm/WebSearch.js +134 -0
- package/dist/esm/WebSearch.js.map +1 -0
- package/dist/esm/Write.d.ts +147 -0
- package/dist/esm/Write.d.ts.map +1 -0
- package/dist/esm/Write.js +144 -0
- package/dist/esm/Write.js.map +1 -0
- package/dist/esm/index.d.ts +127 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +127 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/internal/ApplyPatch.d.ts +145 -0
- package/dist/esm/internal/ApplyPatch.d.ts.map +1 -0
- package/dist/esm/internal/ApplyPatch.js +489 -0
- package/dist/esm/internal/ApplyPatch.js.map +1 -0
- package/dist/esm/internal/CodexText.d.ts +73 -0
- package/dist/esm/internal/CodexText.d.ts.map +1 -0
- package/dist/esm/internal/CodexText.js +156 -0
- package/dist/esm/internal/CodexText.js.map +1 -0
- package/dist/esm/internal/Declaration.d.ts +49 -0
- package/dist/esm/internal/Declaration.d.ts.map +1 -0
- package/dist/esm/internal/Declaration.js +42 -0
- package/dist/esm/internal/Declaration.js.map +1 -0
- package/dist/esm/internal/Diagnostics.d.ts +77 -0
- package/dist/esm/internal/Diagnostics.d.ts.map +1 -0
- package/dist/esm/internal/Diagnostics.js +99 -0
- package/dist/esm/internal/Diagnostics.js.map +1 -0
- package/dist/esm/internal/EnvelopePrecheck.d.ts +67 -0
- package/dist/esm/internal/EnvelopePrecheck.d.ts.map +1 -0
- package/dist/esm/internal/EnvelopePrecheck.js +167 -0
- package/dist/esm/internal/EnvelopePrecheck.js.map +1 -0
- package/dist/esm/internal/Exec.d.ts +139 -0
- package/dist/esm/internal/Exec.d.ts.map +1 -0
- package/dist/esm/internal/Exec.js +193 -0
- package/dist/esm/internal/Exec.js.map +1 -0
- package/dist/esm/internal/FileMutation.d.ts +109 -0
- package/dist/esm/internal/FileMutation.d.ts.map +1 -0
- package/dist/esm/internal/FileMutation.js +123 -0
- package/dist/esm/internal/FileMutation.js.map +1 -0
- package/dist/esm/internal/FsFailure.d.ts +38 -0
- package/dist/esm/internal/FsFailure.d.ts.map +1 -0
- package/dist/esm/internal/FsFailure.js +39 -0
- package/dist/esm/internal/FsFailure.js.map +1 -0
- package/dist/esm/internal/GitWorktree.d.ts +98 -0
- package/dist/esm/internal/GitWorktree.d.ts.map +1 -0
- package/dist/esm/internal/GitWorktree.js +345 -0
- package/dist/esm/internal/GitWorktree.js.map +1 -0
- package/dist/esm/internal/Grouping.d.ts +51 -0
- package/dist/esm/internal/Grouping.d.ts.map +1 -0
- package/dist/esm/internal/Grouping.js +99 -0
- package/dist/esm/internal/Grouping.js.map +1 -0
- package/dist/esm/internal/Html.d.ts +20 -0
- package/dist/esm/internal/Html.d.ts.map +1 -0
- package/dist/esm/internal/Html.js +70 -0
- package/dist/esm/internal/Html.js.map +1 -0
- package/dist/esm/internal/Http.d.ts +95 -0
- package/dist/esm/internal/Http.d.ts.map +1 -0
- package/dist/esm/internal/Http.js +154 -0
- package/dist/esm/internal/Http.js.map +1 -0
- package/dist/esm/internal/HttpNetwork.d.ts +27 -0
- package/dist/esm/internal/HttpNetwork.d.ts.map +1 -0
- package/dist/esm/internal/HttpNetwork.js +114 -0
- package/dist/esm/internal/HttpNetwork.js.map +1 -0
- package/dist/esm/internal/Ignore.d.ts +37 -0
- package/dist/esm/internal/Ignore.d.ts.map +1 -0
- package/dist/esm/internal/Ignore.js +128 -0
- package/dist/esm/internal/Ignore.js.map +1 -0
- package/dist/esm/internal/LinearRegex.d.ts +19 -0
- package/dist/esm/internal/LinearRegex.d.ts.map +1 -0
- package/dist/esm/internal/LinearRegex.js +176 -0
- package/dist/esm/internal/LinearRegex.js.map +1 -0
- package/dist/esm/internal/Match.d.ts +85 -0
- package/dist/esm/internal/Match.d.ts.map +1 -0
- package/dist/esm/internal/Match.js +142 -0
- package/dist/esm/internal/Match.js.map +1 -0
- package/dist/esm/internal/Paths.d.ts +23 -0
- package/dist/esm/internal/Paths.d.ts.map +1 -0
- package/dist/esm/internal/Paths.js +40 -0
- package/dist/esm/internal/Paths.js.map +1 -0
- package/dist/esm/internal/Preserve.d.ts +25 -0
- package/dist/esm/internal/Preserve.d.ts.map +1 -0
- package/dist/esm/internal/Preserve.js +70 -0
- package/dist/esm/internal/Preserve.js.map +1 -0
- package/dist/esm/internal/Prune.d.ts +35 -0
- package/dist/esm/internal/Prune.d.ts.map +1 -0
- package/dist/esm/internal/Prune.js +60 -0
- package/dist/esm/internal/Prune.js.map +1 -0
- package/dist/esm/internal/SearchContract.d.ts +63 -0
- package/dist/esm/internal/SearchContract.d.ts.map +1 -0
- package/dist/esm/internal/SearchContract.js +66 -0
- package/dist/esm/internal/SearchContract.js.map +1 -0
- package/dist/esm/internal/Symbols.d.ts +39 -0
- package/dist/esm/internal/Symbols.d.ts.map +1 -0
- package/dist/esm/internal/Symbols.js +79 -0
- package/dist/esm/internal/Symbols.js.map +1 -0
- package/dist/esm/internal/TestReport.d.ts +52 -0
- package/dist/esm/internal/TestReport.d.ts.map +1 -0
- package/dist/esm/internal/TestReport.js +172 -0
- package/dist/esm/internal/TestReport.js.map +1 -0
- package/dist/esm/internal/Text.d.ts +114 -0
- package/dist/esm/internal/Text.d.ts.map +1 -0
- package/dist/esm/internal/Text.js +130 -0
- package/dist/esm/internal/Text.js.map +1 -0
- package/dist/esm/internal/Url.d.ts +13 -0
- package/dist/esm/internal/Url.d.ts.map +1 -0
- package/dist/esm/internal/Url.js +27 -0
- package/dist/esm/internal/Url.js.map +1 -0
- package/dist/esm/internal/Walk.d.ts +72 -0
- package/dist/esm/internal/Walk.d.ts.map +1 -0
- package/dist/esm/internal/Walk.js +126 -0
- package/dist/esm/internal/Walk.js.map +1 -0
- package/docs/README.md +117 -0
- package/docs/api.md +472 -0
- package/docs/concepts/effects-and-capabilities.md +136 -0
- package/docs/concepts/flows-and-handlers.md +115 -0
- package/docs/concepts/limits-and-disclosure.md +102 -0
- package/docs/concepts/search-contract.md +182 -0
- package/docs/guides/bind-the-standard-flows.md +114 -0
- package/docs/guides/implement-a-search-peer.md +133 -0
- package/docs/guides/pin-a-checkpoint.md +141 -0
- package/docs/guides/query-a-language-server.md +257 -0
- package/docs/guides/reach-the-network.md +141 -0
- package/docs/guides/read-and-edit-a-file.md +240 -0
- package/docs/guides/run-a-shell-command.md +215 -0
- package/docs/guides/run-the-test-suite.md +154 -0
- package/docs/guides/search-a-workspace.md +148 -0
- package/docs/installation.md +111 -0
- package/docs/quickstart.md +125 -0
- package/docs/reference/flows.md +556 -0
- package/docs/troubleshooting.md +322 -0
- package/package.json +439 -3
- package/src/ApplyPatch.ts +458 -0
- package/src/Bash.ts +549 -0
- package/src/Checkpoints.ts +422 -0
- package/src/Container.ts +212 -0
- package/src/Edit.ts +366 -0
- package/src/ExaWebSearch.ts +145 -0
- package/src/Explore.ts +139 -0
- package/src/Fetch.ts +117 -0
- package/src/Glob.ts +200 -0
- package/src/Grep.ts +320 -0
- package/src/HttpPost.ts +120 -0
- package/src/LanguageServer.ts +110 -0
- package/src/Ls.ts +228 -0
- package/src/Lsp.ts +184 -0
- package/src/Manifest.ts +162 -0
- package/src/NativeSearch.ts +457 -0
- package/src/NodeLanguageServer.ts +1148 -0
- package/src/PortableSearch.ts +264 -0
- package/src/Probe.ts +284 -0
- package/src/Read.ts +359 -0
- package/src/Relocate.ts +166 -0
- package/src/Search.ts +185 -0
- package/src/SearchConformance.ts +288 -0
- package/src/SearchContract.ts +489 -0
- package/src/ShellCommand.ts +201 -0
- package/src/StdError.ts +80 -0
- package/src/TestRun.ts +401 -0
- package/src/TestRunner.ts +119 -0
- package/src/TreeFingerprint.ts +200 -0
- package/src/UpdatePlan.ts +171 -0
- package/src/WebFetch.ts +194 -0
- package/src/WebSearch.ts +165 -0
- package/src/Write.ts +195 -0
- package/src/index.ts +154 -0
- package/src/internal/ApplyPatch.ts +601 -0
- package/src/internal/CodexText.ts +182 -0
- package/src/internal/Declaration.ts +60 -0
- package/src/internal/Diagnostics.ts +134 -0
- package/src/internal/EnvelopePrecheck.ts +233 -0
- package/src/internal/Exec.ts +314 -0
- package/src/internal/FileMutation.ts +231 -0
- package/src/internal/FsFailure.ts +51 -0
- package/src/internal/GitWorktree.ts +473 -0
- package/src/internal/Grouping.ts +106 -0
- package/src/internal/Html.ts +87 -0
- package/src/internal/Http.ts +209 -0
- package/src/internal/HttpNetwork.ts +153 -0
- package/src/internal/Ignore.ts +135 -0
- package/src/internal/LinearRegex.ts +173 -0
- package/src/internal/Match.ts +172 -0
- package/src/internal/Paths.ts +42 -0
- package/src/internal/Preserve.ts +108 -0
- package/src/internal/Prune.ts +62 -0
- package/src/internal/SearchContract.ts +77 -0
- package/src/internal/Symbols.ts +88 -0
- package/src/internal/TestReport.ts +194 -0
- package/src/internal/Text.ts +170 -0
- package/src/internal/Url.ts +23 -0
- package/src/internal/Walk.ts +176 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The in-process implementation of the ripgrep search contract.
|
|
3
|
+
*
|
|
4
|
+
* @since 1.0.0
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as Path from "@smthrs/kernel/Path"
|
|
8
|
+
import { type Context, Effect, Layer, Stream } from "effect"
|
|
9
|
+
import * as FileSystem from "effect/FileSystem"
|
|
10
|
+
import * as Grouping from "./internal/Grouping.ts"
|
|
11
|
+
import * as LinearRegex from "./internal/LinearRegex.ts"
|
|
12
|
+
import { escapeRegex } from "./internal/SearchContract.ts"
|
|
13
|
+
import { notice, truncateBytes } from "./internal/Text.ts"
|
|
14
|
+
import * as Walk from "./internal/Walk.ts"
|
|
15
|
+
import * as Search from "./Search.ts"
|
|
16
|
+
import * as Contract from "./SearchContract.ts"
|
|
17
|
+
import * as StdError from "./StdError.ts"
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Narrows a walk to the files a search reports.
|
|
21
|
+
*
|
|
22
|
+
* A root that names one file is that file: `rg` searches a path given on the
|
|
23
|
+
* command line whatever `-g` says, and follows it even when it is a symlink.
|
|
24
|
+
* Everything a walk found is filtered by the globs first and probed for
|
|
25
|
+
* symlinks second, so the probe runs over the far smaller included set.
|
|
26
|
+
*/
|
|
27
|
+
const candidates = (
|
|
28
|
+
fileSystem: FileSystem.FileSystem,
|
|
29
|
+
path: Path.Path,
|
|
30
|
+
walked: Walk.Walked,
|
|
31
|
+
root: string,
|
|
32
|
+
globs: ReadonlyArray<string>
|
|
33
|
+
): Effect.Effect<ReadonlyArray<string>> =>
|
|
34
|
+
Effect.gen(function*() {
|
|
35
|
+
if (walked.explicitFile) return walked.files
|
|
36
|
+
const included = walked.files.filter((file) =>
|
|
37
|
+
Contract.includedByGlobs(globs, Walk.relativeForPattern(path, root, file), path.basename(file))
|
|
38
|
+
)
|
|
39
|
+
const links = yield* Walk.symbolicLinks(fileSystem, included)
|
|
40
|
+
return included.filter((_, index) => links[index] !== true)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const preview = (line: string): string => {
|
|
44
|
+
let head = ""
|
|
45
|
+
let length = 0
|
|
46
|
+
for (const character of line) {
|
|
47
|
+
if (length++ === 500) break
|
|
48
|
+
head += character
|
|
49
|
+
}
|
|
50
|
+
return truncateBytes(head, 500, { keep: "head" }).text
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const grep = (
|
|
54
|
+
input: Search.GrepInput
|
|
55
|
+
): Effect.Effect<Search.GrepOutput, StdError.StdError, FileSystem.FileSystem | Path.Path> =>
|
|
56
|
+
Effect.gen(function*() {
|
|
57
|
+
const fileSystem = yield* FileSystem.FileSystem
|
|
58
|
+
const path = yield* Path.Path
|
|
59
|
+
const includedByGlobs = (relative: string, basename: string) =>
|
|
60
|
+
Contract.includedByGlobs(input.globs, relative, basename)
|
|
61
|
+
const walked = yield* Walk.files(fileSystem, path, input.root, input.hidden, input.noIgnore, includedByGlobs)
|
|
62
|
+
const insensitive = input.ignoreCase || (input.smartCase && !/[A-Z]/.test(input.pattern))
|
|
63
|
+
const regex = LinearRegex.compile(
|
|
64
|
+
input.fixedStrings ? escapeRegex(input.pattern) : input.pattern,
|
|
65
|
+
insensitive
|
|
66
|
+
)
|
|
67
|
+
const shownMatches: Array<Search.GrepMatch> = []
|
|
68
|
+
const shownFiles: Array<string> = []
|
|
69
|
+
let total = 0
|
|
70
|
+
let filesSearched = 0
|
|
71
|
+
let skippedBinary = 0
|
|
72
|
+
|
|
73
|
+
const included = yield* candidates(fileSystem, path, walked, input.root, input.globs)
|
|
74
|
+
for (const file of included) {
|
|
75
|
+
// Count every admitted file, including unreadable files and binaries.
|
|
76
|
+
filesSearched++
|
|
77
|
+
const remaining = input.filesWithMatches ? 0 : input.limit - shownMatches.length
|
|
78
|
+
const matched: Array<number> = []
|
|
79
|
+
const selected = new Map<number, Search.GrepLine>()
|
|
80
|
+
const recent = new Map<number, Search.GrepLine>()
|
|
81
|
+
let count = 0
|
|
82
|
+
let lineNumber = 0
|
|
83
|
+
let through = 0
|
|
84
|
+
const scanLine = (text: string) =>
|
|
85
|
+
Effect.gen(function*() {
|
|
86
|
+
lineNumber++
|
|
87
|
+
let matches = false
|
|
88
|
+
if (input.maxCount === undefined || count < input.maxCount) {
|
|
89
|
+
const evaluation = regex.test(text)
|
|
90
|
+
let step = evaluation.next()
|
|
91
|
+
while (!step.done) {
|
|
92
|
+
yield* Effect.yieldNow
|
|
93
|
+
step = evaluation.next()
|
|
94
|
+
}
|
|
95
|
+
matches = step.value
|
|
96
|
+
}
|
|
97
|
+
if (matches) count++
|
|
98
|
+
if (remaining <= 0) return
|
|
99
|
+
// The first overflow hit is a boundary: context nearest to it must
|
|
100
|
+
// not migrate to the last retained hit when the limit is applied.
|
|
101
|
+
const retain = matches && matched.length < remaining + 1
|
|
102
|
+
const awaiting = matched.length < remaining + 1
|
|
103
|
+
if (retain || lineNumber <= through || (awaiting && input.beforeContext > 0)) {
|
|
104
|
+
const row: Search.GrepLine = {
|
|
105
|
+
file,
|
|
106
|
+
line: lineNumber,
|
|
107
|
+
text: preview(text),
|
|
108
|
+
kind: retain ? "match" : "context"
|
|
109
|
+
}
|
|
110
|
+
if (retain) {
|
|
111
|
+
matched.push(lineNumber)
|
|
112
|
+
for (const [number, context] of recent) selected.set(number, context)
|
|
113
|
+
through = lineNumber + input.afterContext
|
|
114
|
+
}
|
|
115
|
+
if (retain || lineNumber <= through) selected.set(lineNumber, row)
|
|
116
|
+
if (awaiting && input.beforeContext > 0) recent.set(lineNumber, row)
|
|
117
|
+
}
|
|
118
|
+
recent.delete(lineNumber - input.beforeContext)
|
|
119
|
+
if (matched.length >= remaining + 1) recent.clear()
|
|
120
|
+
})
|
|
121
|
+
// Split only on LF (stripping a preceding CR), just like sourceLines.
|
|
122
|
+
// Stream.splitLines also treats a standalone CR as a delimiter.
|
|
123
|
+
const decoder = new TextDecoder()
|
|
124
|
+
let fragments: Array<string> = []
|
|
125
|
+
const consume = (chunk: string) =>
|
|
126
|
+
Effect.gen(function*() {
|
|
127
|
+
let from = 0
|
|
128
|
+
let newline = chunk.indexOf("\n")
|
|
129
|
+
while (newline >= 0) {
|
|
130
|
+
fragments.push(chunk.slice(from, newline))
|
|
131
|
+
const line = fragments.join("")
|
|
132
|
+
fragments = []
|
|
133
|
+
yield* scanLine(line.endsWith("\r") ? line.slice(0, -1) : line)
|
|
134
|
+
from = newline + 1
|
|
135
|
+
newline = chunk.indexOf("\n", from)
|
|
136
|
+
}
|
|
137
|
+
if (from < chunk.length) fragments.push(chunk.slice(from))
|
|
138
|
+
})
|
|
139
|
+
const scanned = yield* Effect.gen(function*() {
|
|
140
|
+
let started = false
|
|
141
|
+
// A guarded disk host can safely expose atomic reads while refusing
|
|
142
|
+
// open streaming handles. Retry through that same filesystem service
|
|
143
|
+
// only before any bytes arrive, so a failed partial stream is never
|
|
144
|
+
// combined with a second reading of a file that may have changed.
|
|
145
|
+
yield* fileSystem.stream(file).pipe(
|
|
146
|
+
Stream.catch((error) => started ? Stream.fail(error) : Stream.fromEffect(fileSystem.readFile(file))),
|
|
147
|
+
Stream.runForEach((bytes) => {
|
|
148
|
+
started = true
|
|
149
|
+
if (bytes.includes(0)) {
|
|
150
|
+
return Effect.fail(
|
|
151
|
+
new StdError.StdError({
|
|
152
|
+
code: "binary_file",
|
|
153
|
+
message: `Cannot search binary file: ${file}`,
|
|
154
|
+
path: file
|
|
155
|
+
})
|
|
156
|
+
)
|
|
157
|
+
}
|
|
158
|
+
return consume(decoder.decode(bytes, { stream: true }))
|
|
159
|
+
})
|
|
160
|
+
)
|
|
161
|
+
yield* consume(decoder.decode())
|
|
162
|
+
if (fragments.length > 0) yield* scanLine(fragments.join(""))
|
|
163
|
+
return true
|
|
164
|
+
}).pipe(Effect.catch((error) => {
|
|
165
|
+
if (error instanceof StdError.StdError) {
|
|
166
|
+
if (walked.explicitFile) return Effect.fail(error)
|
|
167
|
+
skippedBinary++
|
|
168
|
+
}
|
|
169
|
+
return Effect.succeed(false)
|
|
170
|
+
}))
|
|
171
|
+
if (!scanned || count === 0) continue
|
|
172
|
+
total += input.filesWithMatches ? 1 : count
|
|
173
|
+
if (input.filesWithMatches) {
|
|
174
|
+
if (shownFiles.length < input.limit) shownFiles.push(file)
|
|
175
|
+
continue
|
|
176
|
+
}
|
|
177
|
+
if (matched.length === 0) continue
|
|
178
|
+
const grouped = Grouping.group([...selected.values()].sort((left, right) => left.line - right.line))
|
|
179
|
+
.slice(0, remaining)
|
|
180
|
+
// Source is needed only for returned symbols, and is released before
|
|
181
|
+
// moving to the next file. Overflow files never load symbol source.
|
|
182
|
+
const contents = new Map<string, ReadonlyArray<string>>()
|
|
183
|
+
if (input.symbols) {
|
|
184
|
+
const source = yield* fileSystem.readFileString(file).pipe(Effect.orElseSucceed(() => undefined))
|
|
185
|
+
if (source !== undefined) contents.set(file, Grouping.sourceLines(source))
|
|
186
|
+
}
|
|
187
|
+
shownMatches.push(...Grouping.annotate(grouped, contents))
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
const truncated = total > input.limit
|
|
191
|
+
const unsatisfiable = total > 0 ? undefined : yield* Contract.unsatisfiableNotice({
|
|
192
|
+
fileSystem,
|
|
193
|
+
path,
|
|
194
|
+
root: input.root,
|
|
195
|
+
globs: input.globs,
|
|
196
|
+
hidden: input.hidden,
|
|
197
|
+
noIgnore: input.noIgnore,
|
|
198
|
+
ignored: walked.ignored
|
|
199
|
+
})
|
|
200
|
+
return {
|
|
201
|
+
matches: shownMatches,
|
|
202
|
+
files: shownFiles,
|
|
203
|
+
filesSearched,
|
|
204
|
+
skippedBinary,
|
|
205
|
+
truncated,
|
|
206
|
+
...(truncated
|
|
207
|
+
? { notice: notice(input.filesWithMatches ? "files" : "matches", input.limit, total) }
|
|
208
|
+
: {}),
|
|
209
|
+
...(unsatisfiable === undefined ? {} : { notice: unsatisfiable })
|
|
210
|
+
}
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
const glob = (
|
|
214
|
+
input: Search.GlobInput
|
|
215
|
+
): Effect.Effect<Search.GlobOutput, StdError.StdError, FileSystem.FileSystem | Path.Path> =>
|
|
216
|
+
Effect.gen(function*() {
|
|
217
|
+
const fileSystem = yield* FileSystem.FileSystem
|
|
218
|
+
const path = yield* Path.Path
|
|
219
|
+
const includedByGlobs = (relative: string, basename: string) =>
|
|
220
|
+
Contract.includedByGlobs([input.pattern], relative, basename)
|
|
221
|
+
const walked = yield* Walk.files(fileSystem, path, input.root, input.hidden, input.noIgnore, includedByGlobs)
|
|
222
|
+
const included = yield* candidates(fileSystem, path, walked, input.root, [input.pattern])
|
|
223
|
+
const matching = [...included].sort()
|
|
224
|
+
const paths = matching.slice(0, input.limit)
|
|
225
|
+
const unsatisfiable = matching.length > 0 ? undefined : yield* Contract.unsatisfiableNotice({
|
|
226
|
+
fileSystem,
|
|
227
|
+
path,
|
|
228
|
+
root: input.root,
|
|
229
|
+
globs: [input.pattern],
|
|
230
|
+
hidden: input.hidden,
|
|
231
|
+
noIgnore: input.noIgnore,
|
|
232
|
+
ignored: walked.ignored
|
|
233
|
+
})
|
|
234
|
+
return {
|
|
235
|
+
paths,
|
|
236
|
+
total: matching.length,
|
|
237
|
+
truncated: matching.length > input.limit,
|
|
238
|
+
...(matching.length > input.limit ? { notice: notice("entries", paths.length, matching.length) } : {}),
|
|
239
|
+
...(unsatisfiable === undefined ? {} : { notice: unsatisfiable })
|
|
240
|
+
}
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* Captures filesystem and path services in the portable peer.
|
|
245
|
+
*
|
|
246
|
+
* @category constructors
|
|
247
|
+
* @since 1.0.0
|
|
248
|
+
*/
|
|
249
|
+
export const make = (services: Context.Context<FileSystem.FileSystem | Path.Path>): Search.Search =>
|
|
250
|
+
Search.make({
|
|
251
|
+
grep: (input) => Effect.provide(grep(input), services),
|
|
252
|
+
glob: (input) => Effect.provide(glob(input), services)
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
/**
|
|
256
|
+
* Provides the in-process peer.
|
|
257
|
+
*
|
|
258
|
+
* @category layers
|
|
259
|
+
* @since 1.0.0
|
|
260
|
+
*/
|
|
261
|
+
export const layer: Layer.Layer<Search.Search, never, FileSystem.FileSystem | Path.Path> = Layer.effect(
|
|
262
|
+
Search.Search,
|
|
263
|
+
Effect.map(Effect.context<FileSystem.FileSystem | Path.Path>(), make)
|
|
264
|
+
)
|
package/src/Probe.ts
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telling an invalid probe from a failing check.
|
|
3
|
+
*
|
|
4
|
+
* A non-zero exit is a runner's verdict about the code it ran. It is not the
|
|
5
|
+
* runner's verdict about the command it was handed. When an invocation names a
|
|
6
|
+
* test, a file, a module, an environment, or a program that does not exist, the
|
|
7
|
+
* runner never reaches any code and still exits non-zero — and at the tool
|
|
8
|
+
* boundary that is indistinguishable from the bug reproducing. A SWE-bench run
|
|
9
|
+
* lost thirty-nine frames to exactly that: the reproduction named a test method
|
|
10
|
+
* the class does not define, so it read `exitCode: 1` before the edit and
|
|
11
|
+
* `exitCode: 1` after it, and the agent could not tell it had already won.
|
|
12
|
+
*
|
|
13
|
+
* This module names that class. The taxonomy is one idea — *the invocation
|
|
14
|
+
* named something that does not exist* — and {@link Reason} enumerates the five
|
|
15
|
+
* things that something can be. An enumerated answer over prose is a judgment,
|
|
16
|
+
* so Jev makes it: {@link classify} asks the `probe/attribution` classifier
|
|
17
|
+
* whether this exit describes the tree or one of the five, and whether a runner
|
|
18
|
+
* ran anything at all. Nothing here reads the output itself. The judgment used
|
|
19
|
+
* to be nine regexes over runner wording, vetoed by two more over runner
|
|
20
|
+
* tallies, and every phrase they matched is also printed by genuine failures —
|
|
21
|
+
* a bug that *is* an import error, a test that asserts on a shell message — so
|
|
22
|
+
* precision cost recall and both cost maintenance.
|
|
23
|
+
*
|
|
24
|
+
* A zero exit needs no judgment: it belongs to the tree, whatever it printed.
|
|
25
|
+
* A non-zero exit, including 126 or 127, needs attribution. A runner can
|
|
26
|
+
* execute its tests and return either status, so neither proves that the shell
|
|
27
|
+
* refused to launch the check.
|
|
28
|
+
*
|
|
29
|
+
* There is no third path. When the judge does not answer, {@link unjudged}
|
|
30
|
+
* turns its failure into the caller's typed failure: a guess about whether a
|
|
31
|
+
* reproduction reproduced is worth less than nothing, and the caller can say
|
|
32
|
+
* that a result was not judged where it cannot say that a guess was wrong.
|
|
33
|
+
*
|
|
34
|
+
* A flow that can tell the difference reports it under the reserved output key
|
|
35
|
+
* {@link key}. The harness reads that key off an otherwise opaque call result
|
|
36
|
+
* and refuses to count such a result as evidence that anything about the tree
|
|
37
|
+
* changed, which is what stops a broken probe from being cited as a
|
|
38
|
+
* reproduction.
|
|
39
|
+
*
|
|
40
|
+
* @since 1.0.0
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
import * as Classifier from "@smthrs/model/Classifier"
|
|
44
|
+
import type * as Evaluator from "@smthrs/model/Evaluator"
|
|
45
|
+
import * as Effect from "effect/Effect"
|
|
46
|
+
import * as Option from "effect/Option"
|
|
47
|
+
import * as Schema from "effect/Schema"
|
|
48
|
+
import { truncateBytes } from "./internal/Text.ts"
|
|
49
|
+
import * as StdError from "./StdError.ts"
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* The reserved output key a flow reports an invalid probe under.
|
|
53
|
+
*
|
|
54
|
+
* Stated as a constant because it is a wire contract with the harness rather
|
|
55
|
+
* than a shared type: `@smthrs/harness` reads this key off a `Schema.Json`
|
|
56
|
+
* result and must not depend on the tool library to do it.
|
|
57
|
+
*
|
|
58
|
+
* @category identifiers
|
|
59
|
+
* @since 1.0.0
|
|
60
|
+
*/
|
|
61
|
+
export const key = "invalidProbe"
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* What the invocation named that does not exist.
|
|
65
|
+
*
|
|
66
|
+
* Five members, and the classifier offers exactly these five beside `tree`.
|
|
67
|
+
*
|
|
68
|
+
* @category schemas
|
|
69
|
+
* @since 1.0.0
|
|
70
|
+
*/
|
|
71
|
+
export const Reason = Schema.Literals([
|
|
72
|
+
"unknown-command",
|
|
73
|
+
"unknown-test",
|
|
74
|
+
"unknown-path",
|
|
75
|
+
"unknown-module",
|
|
76
|
+
"unknown-environment"
|
|
77
|
+
])
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* What the invocation named that does not exist.
|
|
81
|
+
*
|
|
82
|
+
* @category models
|
|
83
|
+
* @since 1.0.0
|
|
84
|
+
*/
|
|
85
|
+
export type Reason = typeof Reason.Type
|
|
86
|
+
|
|
87
|
+
/**
|
|
88
|
+
* One command's failure, attributed to the command rather than to the tree.
|
|
89
|
+
*
|
|
90
|
+
* @category schemas
|
|
91
|
+
* @since 1.0.0
|
|
92
|
+
*/
|
|
93
|
+
export const InvalidProbe = Schema.Struct({
|
|
94
|
+
reason: Reason.annotate({ description: "Which kind of name the command could not resolve" }),
|
|
95
|
+
evidence: Schema.String.annotate({
|
|
96
|
+
description: "What this attribution rests on: the shell's own exit code, or the judge's reading and how sure it is"
|
|
97
|
+
}),
|
|
98
|
+
message: Schema.String.annotate({ description: "What the failure does and does not prove, stated for the caller" })
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* One command's failure, attributed to the command rather than to the tree.
|
|
103
|
+
*
|
|
104
|
+
* @category models
|
|
105
|
+
* @since 1.0.0
|
|
106
|
+
*/
|
|
107
|
+
export type InvalidProbe = typeof InvalidProbe.Type
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* What one command's exit code was attributed to.
|
|
111
|
+
*
|
|
112
|
+
* `to` is the tree, or the kind of name the command could not resolve, and
|
|
113
|
+
* `invalidProbe` is present in exactly the second case, ready to report under
|
|
114
|
+
* {@link key}. `executed` is the judge's separate reading of whether a runner
|
|
115
|
+
* ran any test, absent when nothing was asked.
|
|
116
|
+
*
|
|
117
|
+
* @category models
|
|
118
|
+
* @since 1.0.0
|
|
119
|
+
*/
|
|
120
|
+
export interface Attribution {
|
|
121
|
+
readonly to: "tree" | Reason
|
|
122
|
+
readonly executed?: boolean
|
|
123
|
+
readonly invalidProbe?: InvalidProbe
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/**
|
|
127
|
+
* The confidence an attribution needs before it outranks the tree.
|
|
128
|
+
*
|
|
129
|
+
* Below it the failure is the tree's, which is the reading that leaves the
|
|
130
|
+
* caller the output it would have had anyway. A missed invalid probe costs a
|
|
131
|
+
* reader nothing it had; a false one tells it its reproduction proved nothing.
|
|
132
|
+
*
|
|
133
|
+
* @category constants
|
|
134
|
+
* @since 1.0.0
|
|
135
|
+
*/
|
|
136
|
+
export const CONFIDENCE_FLOOR = 0.7
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* The most output bytes one judgment carries, newest kept.
|
|
140
|
+
*
|
|
141
|
+
* A runner prints its refusal last, and the classifier's whole state is held
|
|
142
|
+
* to 32 KiB.
|
|
143
|
+
*
|
|
144
|
+
* @category constants
|
|
145
|
+
* @since 1.0.0
|
|
146
|
+
*/
|
|
147
|
+
export const MAX_OUTPUT_BYTES = 32 * 1024
|
|
148
|
+
|
|
149
|
+
/** What each reason means, in the second half of one sentence. */
|
|
150
|
+
const named: Record<Reason, string> = {
|
|
151
|
+
"unknown-command": "the shell could not find the program it was asked to run",
|
|
152
|
+
"unknown-test": "the test runner could not find the test that was named",
|
|
153
|
+
"unknown-path": "the file or directory that was named does not exist",
|
|
154
|
+
"unknown-module": "the module that was imported does not exist here",
|
|
155
|
+
"unknown-environment": "the runner has no environment by that name"
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const explain = (reason: Reason): string =>
|
|
159
|
+
`This command never ran a check: ${
|
|
160
|
+
named[reason]
|
|
161
|
+
}. The non-zero exit describes the command, not the code under test, so it is not a reproduction and reads the same before and after a correct fix. Find the real names, repair the command, and run it again before drawing any conclusion from it.`
|
|
162
|
+
|
|
163
|
+
const invalid = (reason: Reason, evidence: string): InvalidProbe => ({
|
|
164
|
+
reason,
|
|
165
|
+
evidence,
|
|
166
|
+
message: explain(reason)
|
|
167
|
+
})
|
|
168
|
+
|
|
169
|
+
/** How the judge's own reading is quoted back to the caller. */
|
|
170
|
+
const judged = (reason: Reason, confidence: number, executed: boolean): string =>
|
|
171
|
+
`the judge read this output as ${reason} at confidence ${confidence.toFixed(2)}${
|
|
172
|
+
executed ? ", although the runner also reported that it ran tests" : ""
|
|
173
|
+
}`
|
|
174
|
+
|
|
175
|
+
/** Which typed failure each way the judge can fail to answer is. */
|
|
176
|
+
const unjudgedCode: Record<Evaluator.EvaluatorErrorCode, StdError.Code> = {
|
|
177
|
+
unconfigured: "provider_unavailable",
|
|
178
|
+
unreachable: "provider_unavailable",
|
|
179
|
+
refused: "provider_unavailable",
|
|
180
|
+
empty: "provider_unavailable",
|
|
181
|
+
timeout: "timeout",
|
|
182
|
+
invalid_answer: "request_failed",
|
|
183
|
+
invalid_question: "request_failed"
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* The standard-flow failure a judge that did not answer is.
|
|
188
|
+
*
|
|
189
|
+
* A handler that cannot say whether a failing command failed about itself has
|
|
190
|
+
* no result to return: reporting the exit code alone is the reading that lost
|
|
191
|
+
* the thirty-nine frames. So the call fails, the code names which way the
|
|
192
|
+
* gateway went wrong, and the message says what is missing and how a host
|
|
193
|
+
* supplies it.
|
|
194
|
+
*
|
|
195
|
+
* @category errors
|
|
196
|
+
* @since 1.0.0
|
|
197
|
+
*/
|
|
198
|
+
export const unjudged = (error: Classifier.ClassifierError): StdError.StdError =>
|
|
199
|
+
new StdError.StdError({
|
|
200
|
+
code: unjudgedCode[error.code],
|
|
201
|
+
message:
|
|
202
|
+
`This result was not judged: the attribution judge answered ${error.code}. ${error.message} Nothing here says whether the non-zero exit is the code's failure or the command's, and a guess at that is worth less than no answer. Connect a subscription seat for the evaluator, then run the command again.`
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
/**
|
|
206
|
+
* What one failed command's exit code describes: the tree, or a name the
|
|
207
|
+
* command could not resolve.
|
|
208
|
+
*
|
|
209
|
+
* No cell calls this classifier. {@link classify} asks it on behalf of the
|
|
210
|
+
* `test` flow, which has the command and its output and has no task to judge
|
|
211
|
+
* them against, so the state is the three facts of the run and the questions
|
|
212
|
+
* carry every criterion themselves. It is declared here rather than in a
|
|
213
|
+
* catalog a host binds: a door for the model to ask this would be a door onto
|
|
214
|
+
* a judgment the flow has already made.
|
|
215
|
+
*
|
|
216
|
+
* @category classifiers
|
|
217
|
+
* @since 1.0.0
|
|
218
|
+
*/
|
|
219
|
+
export const probeAttribution = Classifier.make("probe/attribution", {
|
|
220
|
+
description:
|
|
221
|
+
"Judge one failed command: whether it ran the tests it named and failed about the code, or never resolved a name it was given.",
|
|
222
|
+
state: Schema.Struct({
|
|
223
|
+
command: Schema.String.annotate({ description: "The command that ran" }),
|
|
224
|
+
exitCode: Schema.Int.annotate({ description: "Its exit code, which is not zero" }),
|
|
225
|
+
output: Schema.String.annotate({ description: "Its captured stdout and stderr, newest bytes when clipped" })
|
|
226
|
+
}),
|
|
227
|
+
questions: {
|
|
228
|
+
attribution: Classifier.choice({
|
|
229
|
+
instructions: "What does this non-zero exit describe?",
|
|
230
|
+
criteria: {
|
|
231
|
+
tree: "the command ran the intended tests and the failure is the code's",
|
|
232
|
+
"unknown-command": "the shell could not find the program it was asked to run",
|
|
233
|
+
"unknown-test": "the test runner could not find the test that was named",
|
|
234
|
+
"unknown-path": "the file or directory that was named does not exist",
|
|
235
|
+
"unknown-module": "the module that was imported does not exist here",
|
|
236
|
+
"unknown-environment": "the runner has no environment by that name"
|
|
237
|
+
}
|
|
238
|
+
}),
|
|
239
|
+
executed: Classifier.boolean({
|
|
240
|
+
instructions: "Did a test runner actually run tests?",
|
|
241
|
+
criteria: {
|
|
242
|
+
true: "the runner reported its own tally of tests that ran, such as a count of passes or failures",
|
|
243
|
+
false: "nothing in the output reports that any test was executed"
|
|
244
|
+
}
|
|
245
|
+
})
|
|
246
|
+
}
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Attributes one command result to the tree, or to a name the command could
|
|
251
|
+
* not resolve.
|
|
252
|
+
*
|
|
253
|
+
* A zero exit needs no judgment. Every non-zero exit, including 126 and 127,
|
|
254
|
+
* goes through the attribution classifier: a runner may choose either code
|
|
255
|
+
* after executing tests. An answer under {@link CONFIDENCE_FLOOR} is the tree's
|
|
256
|
+
* failure, reported with the `executed` reading beside it.
|
|
257
|
+
*
|
|
258
|
+
* Pass the text the caller will actually return, so the judgment is made on
|
|
259
|
+
* the output the reader can see.
|
|
260
|
+
*
|
|
261
|
+
* @category classification
|
|
262
|
+
* @since 1.0.0
|
|
263
|
+
*/
|
|
264
|
+
export const classify = Effect.fn("Probe.classify")(function*(result: {
|
|
265
|
+
readonly command: string
|
|
266
|
+
readonly exitCode: number
|
|
267
|
+
readonly output: string
|
|
268
|
+
}): Effect.fn.Return<Attribution, Classifier.ClassifierError, Evaluator.Evaluator> {
|
|
269
|
+
if (result.exitCode === 0) return { to: "tree" }
|
|
270
|
+
const answers = yield* probeAttribution.evaluate({
|
|
271
|
+
command: result.command,
|
|
272
|
+
exitCode: result.exitCode,
|
|
273
|
+
output: truncateBytes(result.output, MAX_OUTPUT_BYTES, { keep: "tail" }).text
|
|
274
|
+
})
|
|
275
|
+
const executed = answers.executed.value
|
|
276
|
+
const decided = Option.getOrUndefined(Classifier.confident(answers.attribution, CONFIDENCE_FLOOR))
|
|
277
|
+
return decided === undefined || decided === "tree"
|
|
278
|
+
? { to: "tree", executed }
|
|
279
|
+
: {
|
|
280
|
+
to: decided,
|
|
281
|
+
executed,
|
|
282
|
+
invalidProbe: invalid(decided, judged(decided, answers.attribution.confidence, executed))
|
|
283
|
+
}
|
|
284
|
+
})
|