@smthrs/std 0.0.0-stage → 1.0.0-rc.4
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 +380 -0
- package/dist/cjs/Bash.d.ts.map +1 -0
- package/dist/cjs/Bash.js +332 -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 +108 -0
- package/dist/cjs/internal/GitWorktree.d.ts.map +1 -0
- package/dist/cjs/internal/GitWorktree.js +276 -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 +380 -0
- package/dist/esm/Bash.d.ts.map +1 -0
- package/dist/esm/Bash.js +505 -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 +108 -0
- package/dist/esm/internal/GitWorktree.d.ts.map +1 -0
- package/dist/esm/internal/GitWorktree.js +352 -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 +607 -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 +491 -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
package/docs/api.md
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "API reference"
|
|
3
|
+
description: "Every module and every public export of @smthrs/std: the flow modules, the six injectable services, their implementations, the search contract, the registries, and the error type."
|
|
4
|
+
sidebar:
|
|
5
|
+
order: 1
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
The package exports 32 modules. Each is reachable from the root entry point as a
|
|
9
|
+
namespace and from its own subpath:
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { Read } from "@smthrs/std"
|
|
13
|
+
import * as Read from "@smthrs/std/Read"
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
`@smthrs/std/internal/*` and `@smthrs/std/<Module>/index` are not public.
|
|
17
|
+
|
|
18
|
+
Host child processes receive only `PATH`, `HOME`, `USER`, `LANG`, `LC_*`,
|
|
19
|
+
`TERM`, `TMPDIR`, and `SHELL` from the Smithers process, plus names explicitly
|
|
20
|
+
declared by the caller. Credential-shaped ambient names are withheld; an
|
|
21
|
+
explicit declaration is applied last and therefore opts that name in.
|
|
22
|
+
|
|
23
|
+
For the input and output fields of each flow, see the
|
|
24
|
+
[Flow reference](./reference/flows.md). This page is the module and export
|
|
25
|
+
surface.
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { NodeServices } from "@effect/platform-node"
|
|
31
|
+
import * as Read from "@smthrs/std/Read"
|
|
32
|
+
|
|
33
|
+
const page = await Effect.runPromise(
|
|
34
|
+
Effect.provide(Read.run({ path: "./README.md", limit: 20 }), NodeServices.layer)
|
|
35
|
+
)
|
|
36
|
+
console.log(page.content, page.totalLines, page.truncated)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## The flow modules
|
|
40
|
+
|
|
41
|
+
Seventeen modules declare a flow. Every one of them exports the same names:
|
|
42
|
+
|
|
43
|
+
| Export | Type | Meaning |
|
|
44
|
+
| -------------- | ---------------------------------------- | ---------------------------------------- |
|
|
45
|
+
| `name` | string literal | The registry name. |
|
|
46
|
+
| `description` | string | The one line the model sees. |
|
|
47
|
+
| `Input` | `Schema` and the decoded type | The input schema. |
|
|
48
|
+
| `Output` | `Schema` and the decoded type | The output schema. |
|
|
49
|
+
| `effects` | `Effects.Declaration` | The declared envelope, before any input. |
|
|
50
|
+
| `effectsFor` | `(input) => Effects.Declaration` | The envelope narrowed to one input. |
|
|
51
|
+
| `capabilities` | `ReadonlyArray<string>` | `action:resource` strings. |
|
|
52
|
+
| `flow` | `Flow` | The declaration, built by `Flow.make`. |
|
|
53
|
+
| `run` | `(input) => Effect<Output, StdError, R>` | The handler. |
|
|
54
|
+
|
|
55
|
+
The modules are `ApplyPatch`, `Bash`, `Edit`, `Explore`, `Fetch`, `Glob`,
|
|
56
|
+
`Grep`, `HttpPost`, `Ls`, `Lsp`, `Read`, `ShellCommand`, `TestRun`,
|
|
57
|
+
`UpdatePlan`, `WebFetch`, `WebSearch`, and `Write`.
|
|
58
|
+
|
|
59
|
+
Some of them export more than the common nine:
|
|
60
|
+
|
|
61
|
+
| Module | Additional exports |
|
|
62
|
+
| -------------- | ------------------------------------------------------------------------------------------- |
|
|
63
|
+
| `Bash` | `DEFAULT_TIMEOUT_MS` |
|
|
64
|
+
| `Explore` | `make(options: { model?: string })`, and no `run` |
|
|
65
|
+
| `Grep` | `ContextLine`, `Symbol`, `Match` schemas |
|
|
66
|
+
| `Read` | `MAX_READ_FILE_BYTES`, the 64 MiB bound past which `read` refuses a file |
|
|
67
|
+
| `ShellCommand` | `DEFAULT_TIMEOUT_MS`, `MAX_CAPTURE_BYTES`, `DEFAULT_MAX_OUTPUT_TOKENS`, `TIMEOUT_EXIT_CODE` |
|
|
68
|
+
| `TestRun` | `scratchDirectory`, `DEFAULT_TIMEOUT_MS`, `MAX_CAPTURE_BYTES`, `Outcome` |
|
|
69
|
+
| `UpdatePlan` | `StepStatus`, `Plan` |
|
|
70
|
+
| `WebSearch` | the `WebSearch` service, `make`, `makeNoop`, `layerNoop` |
|
|
71
|
+
|
|
72
|
+
A runner declared with `baseline: false` refuses `against: "base"` before
|
|
73
|
+
running any process. The native CLI sets this flag until an isolated staging
|
|
74
|
+
provider is available ([#3234](https://github.com/smithersai/smithers/issues/3234)). Workspace tests still use the confined runner. Library
|
|
75
|
+
hosts that omit the flag keep baseline Git on their caller-provided spawner.
|
|
76
|
+
The runner wrapper uses `bash -c` and does not execute host login profiles.
|
|
77
|
+
|
|
78
|
+
## Manifest
|
|
79
|
+
|
|
80
|
+
The whole library keyed by registry name. Every registry is frozen.
|
|
81
|
+
|
|
82
|
+
| Export | Type | Meaning |
|
|
83
|
+
| ------------ | ------------------------------------ | ------------------------------------------ |
|
|
84
|
+
| `flows` | record of name to declaration | All 17 declarations. |
|
|
85
|
+
| `handlers` | record of name to handler | The 16 that have one; `explore` is absent. |
|
|
86
|
+
| `effectsFor` | record of name to narrowing function | All 17, including `explore`. |
|
|
87
|
+
| `names` | readonly tuple of 17 names | Registry order. |
|
|
88
|
+
| `readOnly` | readonly tuple of 8 names | The read-only projection. |
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
import * as Manifest from "@smthrs/std/Manifest"
|
|
92
|
+
|
|
93
|
+
Manifest.names // ["read", "write", "edit", "ls", "glob", "grep", "bash", ...]
|
|
94
|
+
Manifest.readOnly // ["read", "ls", "glob", "grep", "fetch", "explore", "webfetch", "lsp"]
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## StdError
|
|
98
|
+
|
|
99
|
+
The single typed failure every handler uses.
|
|
100
|
+
|
|
101
|
+
| Export | Type | Meaning |
|
|
102
|
+
| ---------- | --------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------ |
|
|
103
|
+
| `Code` | `Schema.Literals` and the matching type | The closed list of failure codes. |
|
|
104
|
+
| `StdError` | `Schema.TaggedError` class | `{ code, message, path?, base_digest?, current_digest?, method?, rpcError?, stderr?, limitMillis? }`, tagged `@smthrs/std/StdError`. |
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
import * as StdError from "@smthrs/std/StdError"
|
|
108
|
+
|
|
109
|
+
const failure = new StdError.StdError({
|
|
110
|
+
code: "not_found",
|
|
111
|
+
message: "File not found: /workspace/missing.ts",
|
|
112
|
+
path: "/workspace/missing.ts"
|
|
113
|
+
})
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
The codes are listed in the [Flow reference](./reference/flows.md#failures).
|
|
117
|
+
|
|
118
|
+
Every service key, error tag, and class identifier in this package is
|
|
119
|
+
`@smthrs/std/<Name>`, so `Effect.catchTag("@smthrs/std/StdError", ...)` catches
|
|
120
|
+
every handler failure.
|
|
121
|
+
|
|
122
|
+
## Probe
|
|
123
|
+
|
|
124
|
+
Telling an invalid probe from a failing check. A non-zero exit is a runner's
|
|
125
|
+
verdict about the code it ran, not about the command it was handed.
|
|
126
|
+
|
|
127
|
+
| Export | Type | Meaning |
|
|
128
|
+
| ------------------ | -------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
129
|
+
| `key` | `"invalidProbe"` | The reserved output key a flow reports one under. |
|
|
130
|
+
| `Reason` | `Schema.Literals` and the matching type | `unknown-command`, `unknown-test`, `unknown-path`, `unknown-module`, `unknown-environment`. |
|
|
131
|
+
| `InvalidProbe` | `Schema.Struct` and the matching type | `{ reason, evidence, message }`. |
|
|
132
|
+
| `Attribution` | `{ to, executed?, invalidProbe? }` | What one result was attributed to: the tree, or one of the five. |
|
|
133
|
+
| `CONFIDENCE_FLOOR` | `0.7` | The confidence an attribution needs before it outranks the tree. |
|
|
134
|
+
| `MAX_OUTPUT_BYTES` | `32768` | The most output bytes one judgment carries, newest kept. |
|
|
135
|
+
| `probeAttribution` | `Classifier` `probe/attribution` | The classifier `classify` asks: `attribution` choice, `executed` boolean. |
|
|
136
|
+
| `classify` | `(result: { command, exitCode, output }) => Effect<Attribution, ClassifierError, Evaluator>` | Attributes one command result, with Jev. |
|
|
137
|
+
| `unjudged` | `(error: ClassifierError) => StdError` | The standard-flow failure a judge that did not answer is. |
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
import * as Probe from "@smthrs/std/Probe"
|
|
141
|
+
|
|
142
|
+
const attribution = yield * Probe.classify({ command: "pytest tests/x.py::nope", exitCode: 4, output })
|
|
143
|
+
// { to: "unknown-test", executed: false, invalidProbe: { reason: "unknown-test", ... } }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
The attribution is Jev's: `classify` asks `probeAttribution`, the exported
|
|
147
|
+
`probe/attribution` declaration, through the `Evaluator` service of
|
|
148
|
+
[`@smthrs/model`](/api/model), so a host needs a bound evaluator on a
|
|
149
|
+
subscription seat. A zero exit is attributed to the tree without the judge. All non-zero exits,
|
|
150
|
+
including 126 and 127, need attribution: a runner can choose those codes after
|
|
151
|
+
executing a check. An answer below
|
|
152
|
+
`CONFIDENCE_FLOOR` is the tree's failure, which leaves a genuine reproduction
|
|
153
|
+
intact. There is no third path: when the judge does not answer, `unjudged`
|
|
154
|
+
turns its failure into the caller's typed failure rather than a guess.
|
|
155
|
+
|
|
156
|
+
## Search
|
|
157
|
+
|
|
158
|
+
The implementation seam behind `grep` and `glob`.
|
|
159
|
+
|
|
160
|
+
| Export | Type | Meaning |
|
|
161
|
+
| ------------- | ----------------------------------- | ---------------------------------------------------------------------------- |
|
|
162
|
+
| `Search` | interface and `Context.Service` tag | `{ grep, glob }`. |
|
|
163
|
+
| `make` | `(service: Search) => Search` | Builds a peer from its two operations. |
|
|
164
|
+
| `makeNoop` | `() => Search` | Fails both calls with `provider_unavailable`. |
|
|
165
|
+
| `layerNoop` | `Layer<Search>` | Provides `makeNoop`. |
|
|
166
|
+
| `GrepInput` | interface | Normalized grep input, with every option resolved. |
|
|
167
|
+
| `GrepOutput` | interface | `matches`, `files`, `filesSearched`, `skippedBinary`, `truncated`, `notice`. |
|
|
168
|
+
| `GrepLine` | interface | One row a peer produces before grouping: `file`, `line`, `text`, `kind`. |
|
|
169
|
+
| `GrepMatch` | interface | One hit with its `before`, `after`, and `symbol`. |
|
|
170
|
+
| `ContextLine` | interface | `line`, `text`. |
|
|
171
|
+
| `Symbol` | interface | `kind`, `name`, `startLine`, `endLine`. |
|
|
172
|
+
| `GlobInput` | interface | `pattern`, `root`, `hidden`, `limit`. |
|
|
173
|
+
| `GlobOutput` | interface | `paths`, `total`, `truncated`, `notice`. |
|
|
174
|
+
|
|
175
|
+
Both operations return `Effect<_, StdError>` with no requirement, so a peer
|
|
176
|
+
resolves its own services when it is built.
|
|
177
|
+
|
|
178
|
+
## PortableSearch
|
|
179
|
+
|
|
180
|
+
The in-process peer. Walks the injected `FileSystem`, so it needs no external
|
|
181
|
+
binary and is browser-safe.
|
|
182
|
+
|
|
183
|
+
| Export | Type |
|
|
184
|
+
| ------- | ---------------------------------------------------------- |
|
|
185
|
+
| `make` | `(services: Context<FileSystem \| Path>) => Search.Search` |
|
|
186
|
+
| `layer` | `Layer<Search.Search, never, FileSystem \| Path>` |
|
|
187
|
+
|
|
188
|
+
## NativeSearch
|
|
189
|
+
|
|
190
|
+
The peer that drives the `rg` executable through the permission-aware spawner.
|
|
191
|
+
|
|
192
|
+
| Export | Type | Meaning |
|
|
193
|
+
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
|
|
194
|
+
| `MAX_CAPTURE_BYTES` | `67_108_864` | Bytes captured from either `rg` stream before the call is refused. |
|
|
195
|
+
| `make` | `(services: Context<FileSystem \| Path \| ChildProcessSpawner>, environment?: Readonly<Record<string, string>>) => Search.Search` | |
|
|
196
|
+
| `layer` | `Layer<Search.Search, never, FileSystem \| Path \| ChildProcessSpawner>` | |
|
|
197
|
+
|
|
198
|
+
An overflow is `command_failed` rather than a truncation, because a partial
|
|
199
|
+
ripgrep stream could make this peer disagree with the portable one. A failure to
|
|
200
|
+
start `rg` is `provider_unavailable`. The default layer uses the host environment
|
|
201
|
+
allowlist. `make` accepts explicit environment declarations as its second
|
|
202
|
+
argument; those names override the allowlist.
|
|
203
|
+
|
|
204
|
+
## SearchContract
|
|
205
|
+
|
|
206
|
+
The validation and matching rules both peers build on, exported so a third peer
|
|
207
|
+
cannot drift on what a pattern means.
|
|
208
|
+
|
|
209
|
+
| Export | Type | Meaning |
|
|
210
|
+
| --------------------- | ------------------------------------------------------------------------------------- | ------------------------------------------------ |
|
|
211
|
+
| `validatePattern` | `(pattern: string, fixedStrings: boolean) => StdError \| undefined` | Checks Smithers Ripgrep ASCII v1. |
|
|
212
|
+
| `validateGlob` | `(glob: string) => StdError \| undefined` | Checks the glob grammar. |
|
|
213
|
+
| `canonicalGlob` | `(glob: string) => string` | The one spelling both peers match against. |
|
|
214
|
+
| `matchesGlob` | `(pattern: string, relative: string, basename: string) => boolean` | One glob against one candidate. |
|
|
215
|
+
| `includedByGlobs` | `(globs: ReadonlyArray<string>, relative: string, basename: string) => boolean` | Ordered include and exclude. |
|
|
216
|
+
| `expression` | `(pattern: string, fixedStrings: boolean, insensitive: boolean) => RegExp` | Compiles a validated pattern. |
|
|
217
|
+
| `unsatisfiableNotice` | `(options: { fileSystem, path, root, globs, hidden }) => Effect<string \| undefined>` | Explains globs no file under the root can match. |
|
|
218
|
+
| `isContractRejection` | `(error: StdError) => boolean` | Whether this contract wrote the rejection. |
|
|
219
|
+
|
|
220
|
+
## SearchConformance
|
|
221
|
+
|
|
222
|
+
A differential kit that reports where two `Search` peers disagree.
|
|
223
|
+
|
|
224
|
+
| Export | Type | Meaning |
|
|
225
|
+
| --------------- | ------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
|
226
|
+
| `GeneratedFile` | interface | `path` relative to the tree root, and `content`. |
|
|
227
|
+
| `Plan` | interface | `seed`, `root`, `files`, `grep`, `glob`. |
|
|
228
|
+
| `Divergence` | interface | `call`, `input`, `subject`, `reference`. |
|
|
229
|
+
| `plan` | `(options: { seed, root, files?, calls? }) => Plan` | Builds a reproducible tree and call batch. Defaults are 12 files and 12 calls. |
|
|
230
|
+
| `materialize` | `(plan: Plan) => Effect<void, never, FileSystem \| Path>` | Writes the tree. |
|
|
231
|
+
| `compare` | `(options: { plan, subject, reference }) => Effect<ReadonlyArray<Divergence>>` | Runs every call through both peers. |
|
|
232
|
+
| `report` | `(divergences: ReadonlyArray<Divergence>) => string` | Renders them as a failing run's output. |
|
|
233
|
+
|
|
234
|
+
## Container
|
|
235
|
+
|
|
236
|
+
The host's route into a named container, as an injected transport. Nothing here
|
|
237
|
+
spawns: it only decides an argv, which `bash` then spawns through the same
|
|
238
|
+
permission-aware spawner as everything else.
|
|
239
|
+
|
|
240
|
+
| Export | Type | Meaning |
|
|
241
|
+
| -------------- | ------------------------------------------------------ | -------------------------------------------------------------------------- |
|
|
242
|
+
| `Container` | interface and `Context.Service` tag | `{ exec: (request: Request) => Effect<Plan, StdError> }`. |
|
|
243
|
+
| `Request` | interface | `container`, `file`, `args`, `cwd?`, `env?`, `stdin`. |
|
|
244
|
+
| `Plan` | interface | `file`, `args`, `env?`: argv and environment overrides for the host spawn. |
|
|
245
|
+
| `make` | `(service: Container) => Container` | |
|
|
246
|
+
| `unavailable` | `(container: string) => StdError` | The refusal a host with no route answers with. |
|
|
247
|
+
| `makeNoop` | `() => Container` | Fails every request with `unavailable`. |
|
|
248
|
+
| `layerNoop` | `Layer<Container>` | |
|
|
249
|
+
| `makeCommand` | `(options?: { program?: string }) => Container` | A `docker exec` compatible CLI. Defaults to `docker`. |
|
|
250
|
+
| `layerCommand` | `(options?: { program?: string }) => Layer<Container>` | |
|
|
251
|
+
|
|
252
|
+
`makeCommand` attaches `-i` only when the payload arrives on standard input,
|
|
253
|
+
because a container CLI holding stdin open for a command that never reads it
|
|
254
|
+
makes that command hang. A container name that is empty or starts with `-` is
|
|
255
|
+
`invalid_input`, and so is an environment name that is not a POSIX shell name.
|
|
256
|
+
A requested variable never reaches the host transport process under its own
|
|
257
|
+
name, so `PATH`, `LD_PRELOAD`, or `DOCKER_HOST` cannot choose what runs on the
|
|
258
|
+
host: `Plan.env` carries each value as `SMITHERS_CONTAINER_ENV_KEY`, argv
|
|
259
|
+
carries only `-e SMITHERS_CONTAINER_ENV_KEY`, and an `sh -c` inside the
|
|
260
|
+
container renames it to `KEY` before `exec`ing the program. A request that
|
|
261
|
+
carries `env` therefore requires `sh` on the container's `PATH`; an image
|
|
262
|
+
without one (distroless, `scratch`) fails every such request, and a request
|
|
263
|
+
without `env` runs the program directly. Supply a custom transport for such an
|
|
264
|
+
image. Custom transports return any host process environment overrides in
|
|
265
|
+
`Plan.env`.
|
|
266
|
+
|
|
267
|
+
## TreeFingerprint
|
|
268
|
+
|
|
269
|
+
The identity of one directory tree, measured where the tree is. The host's
|
|
270
|
+
workspace walk cannot see a container's filesystem, so `bash` runs this
|
|
271
|
+
script through the container transport before and after a containerised
|
|
272
|
+
command and reports whether the two answers differ under the reserved
|
|
273
|
+
`mutated` key. The harness reads `true` as a measured write, the way it reads
|
|
274
|
+
`invalidProbe` as a measured refusal.
|
|
275
|
+
|
|
276
|
+
| Export | Type | Meaning |
|
|
277
|
+
| ----------------------- | --------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
278
|
+
| `key` | `"mutated"` | The reserved output key a flow reports a measured write under. |
|
|
279
|
+
| `defaultPrune` | `ReadonlyArray<string>` | Directory names never descended into: every name the search walk skips, including both scratch checkout directories, plus `venv` and `target`. |
|
|
280
|
+
| `defaultIgnoreSuffixes` | `ReadonlyArray<string>` | Name suffixes left out, compiled output above all. |
|
|
281
|
+
| `maxPaths` | `50000` | The bound past which a listing is a prefix and reports `complete: false`. |
|
|
282
|
+
| `Measurement` | interface | `{ digest, paths, complete }`. |
|
|
283
|
+
| `script` | `(options?: { prune?, ignoreSuffixes? }) => string` | The POSIX shell script: sorted `find` + `stat -c` listing, `cksum`, count. |
|
|
284
|
+
| `parse` | `(stdout: string) => Measurement \| undefined` | Reads one measurement; anything malformed is unmeasured, never unchanged. |
|
|
285
|
+
| `moved` | `(before?, after?) => boolean \| undefined` | `true`/`false` from two complete measurements; `undefined` from anything less. |
|
|
286
|
+
|
|
287
|
+
Identity, not content: size and mtime per file, so a rewrite that restores
|
|
288
|
+
both is invisible, exactly as it is to the host walk. Every tool the script
|
|
289
|
+
needs is POSIX or busybox; a container without one exits non-zero and `bash`
|
|
290
|
+
reports no `mutated` at all.
|
|
291
|
+
|
|
292
|
+
## TestRunner
|
|
293
|
+
|
|
294
|
+
How the project under test runs its suite, declared once by the host.
|
|
295
|
+
|
|
296
|
+
| Export | Type | Meaning |
|
|
297
|
+
| ------------- | --------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
298
|
+
| `captureBase` | `"refs/flows/capture-base"` | The default ref naming the pristine tree. |
|
|
299
|
+
| `Runner` | interface | `command`, `cwd?`, `root?`, `container?`, `env?`, `baseRef?`, `baseline?: false`, `timeoutMs?`. |
|
|
300
|
+
| `TestRunner` | interface and `Context.Service` tag | `{ declared: Effect<Runner, StdError> }`. |
|
|
301
|
+
| `make` | `(runner: Runner) => TestRunner` | |
|
|
302
|
+
| `makeNoop` | `() => TestRunner` | Declares that this host knows of no runner. |
|
|
303
|
+
| `layer` | `(runner: Runner) => Layer<TestRunner>` | |
|
|
304
|
+
| `layerNoop` | `Layer<TestRunner>` | |
|
|
305
|
+
|
|
306
|
+
## Checkpoints
|
|
307
|
+
|
|
308
|
+
Pinned trees, and the scratch checkouts a call runs against.
|
|
309
|
+
|
|
310
|
+
| Export | Type | Meaning |
|
|
311
|
+
| ------------------ | -------------------------------------------------------------------------- | ---------------------------------------------------------------- |
|
|
312
|
+
| `Checkpoints` | interface and `Context.Service` tag | `{ capture, materialize }`. |
|
|
313
|
+
| `Snapshot` | `Schema.Class` | `{ id, ref }`, identified as `@smthrs/std/Checkpoints/Snapshot`. |
|
|
314
|
+
| `Materialized` | interface | `id`, `host`, `guest`, `root`, `guestRoot`. |
|
|
315
|
+
| `baseId` | `"base"` | The id naming the tree the run opened on. |
|
|
316
|
+
| `scratchDirectory` | `".flows-checkpoints"` | Where a checkpoint is materialized, relative to the root. |
|
|
317
|
+
| `configSection` | `"flows-checkpoint"` | The git-config section minted checkpoints are recorded under. |
|
|
318
|
+
| `make` | `(service: Checkpoints) => Checkpoints` | |
|
|
319
|
+
| `unavailable` | `(id: string) => StdError` | The refusal a host that pins nothing answers with. |
|
|
320
|
+
| `makeNoop` | `() => Checkpoints` | Fails both calls with `unavailable`. |
|
|
321
|
+
| `layerNoop` | `Layer<Checkpoints>` | |
|
|
322
|
+
| `GitOptions` | interface | `root`, `cwd?`, `baseRef?`. |
|
|
323
|
+
| `makeGit` | `(options: GitOptions) => Effect<Checkpoints, never, ChildProcessSpawner>` | |
|
|
324
|
+
| `layerGit` | `(options: GitOptions) => Layer<Checkpoints, never, ChildProcessSpawner>` | |
|
|
325
|
+
| `Relocation` | tagged union | `Relocated`, `UnsupportedFlow`, `AbsolutePath`, `OutsideTree`. |
|
|
326
|
+
| `relocate` | `(flow: string, input: Json, materialized: Materialized) => Relocation` | Rewrites one call's input onto a checkpoint. |
|
|
327
|
+
|
|
328
|
+
`capture(id)` returns a `Snapshot`. `materialize(id, use)` is scoped: it hands
|
|
329
|
+
the tree to `use` and removes the checkout however that effect ends. Host git
|
|
330
|
+
never runs with the workspace's `.git` as its `GIT_DIR`: it records and checks
|
|
331
|
+
out through a temporary shadow repository that shares only the workspace's
|
|
332
|
+
objects, with host config files switched off. A hook, `core.fsmonitor` command,
|
|
333
|
+
filter driver or `info/attributes` entry written into the workspace's `.git`
|
|
334
|
+
therefore does not run on the host. The workspace is still read for refs, its
|
|
335
|
+
index, its config file (as a file) and a few `core.*` hashing settings. A
|
|
336
|
+
checkout gets its own standalone `.git`, so a container can run git in it.
|
|
337
|
+
|
|
338
|
+
A materialize never has host git write into an agent-writable directory. It
|
|
339
|
+
writes the checkout and its `.git` into a staging directory the agent cannot
|
|
340
|
+
reach, inside the temporary shadow or, when the host's temporary directory is
|
|
341
|
+
another filesystem, a `.smithers-checkout-<uuid>` directory beside the
|
|
342
|
+
workspace root, or `checkout-<uuid>` under `$XDG_CACHE_HOME/smithers` (default
|
|
343
|
+
`~/.cache/smithers`) when the root's parent is not writable. One `rename` then
|
|
344
|
+
gives the finished directory its name under the workspace. A checkout name the
|
|
345
|
+
agent swaps for a symlink fails the call before anything is written through
|
|
346
|
+
it. The rename runs from inside the checkout's parent, entered by its physical
|
|
347
|
+
path, and a parent that resolves outside the workspace root's real path fails
|
|
348
|
+
the call before the rename. When no staging directory shares the checkout's
|
|
349
|
+
filesystem, the materialize is refused rather than copied, and the refusal
|
|
350
|
+
names each candidate, including a root parent that is not writable.
|
|
351
|
+
|
|
352
|
+
Two data-write residuals remain, neither of which runs a program. First, host
|
|
353
|
+
writes into agent-writable `.git` paths (new objects, the checkpoint's config
|
|
354
|
+
entry) follow a symlink the agent races into place. Second, the repository is
|
|
355
|
+
whatever `git rev-parse --git-common-dir` names: a `.git` gitfile
|
|
356
|
+
(`gitdir: <path>`) or an `objects/info/alternates` entry can point it at
|
|
357
|
+
another git directory on the host. Captures then write objects and the config
|
|
358
|
+
entry into that directory, a checkpoint id edited in `.git/config` can name a
|
|
359
|
+
commit from it, and read-tree resolves object ids across the alternate store,
|
|
360
|
+
so a materialize can write another host repository's files into the checkout.
|
|
361
|
+
Both residuals apply whenever the agent can write the workspace, including its
|
|
362
|
+
`.git` through a container bind mount; creating `.git` in the harness does not
|
|
363
|
+
help, because the agent can rewrite it afterwards. The only mitigation is a
|
|
364
|
+
`.git` and checkout path the agent cannot write, such as a read-only mount of
|
|
365
|
+
`.git`, or running captures and checkouts against a git directory the harness
|
|
366
|
+
keeps outside the mount.
|
|
367
|
+
|
|
368
|
+
## Relocate
|
|
369
|
+
|
|
370
|
+
What can be pointed at a checkpoint, and what cannot.
|
|
371
|
+
|
|
372
|
+
| Export | Type | Meaning |
|
|
373
|
+
| ------------ | ----------------------------------------------------------------------- | -------------------------------------------------------------- |
|
|
374
|
+
| `Relocation` | tagged union | `Relocated`, `UnsupportedFlow`, `AbsolutePath`, `OutsideTree`. |
|
|
375
|
+
| `relocate` | `(flow: string, input: Json, materialized: Materialized) => Relocation` | Rewrites one call's input onto a checkpoint. |
|
|
376
|
+
|
|
377
|
+
`relocate` knows the field each supported flow names a location in: `cwd` for
|
|
378
|
+
`bash`, `path` for `read` and `ls`, `root` for `grep` and `glob`. Every other
|
|
379
|
+
flow answers `UnsupportedFlow`. Both names are re-exported from `Checkpoints`,
|
|
380
|
+
which is how the harness reaches them.
|
|
381
|
+
|
|
382
|
+
## LanguageServer
|
|
383
|
+
|
|
384
|
+
The code-intelligence seam.
|
|
385
|
+
|
|
386
|
+
| Export | Type | Meaning |
|
|
387
|
+
| ---------------- | --------------------------------------------- | ------------------------------------------------------------------- |
|
|
388
|
+
| `Position` | interface | `path`, `line`, `character`, in the protocol's 0-based coordinates. |
|
|
389
|
+
| `LanguageServer` | interface and `Context.Service` tag | Ten queries, `sync`, `close`, and `refresh`. |
|
|
390
|
+
| `make` | `(service: LanguageServer) => LanguageServer` | |
|
|
391
|
+
| `makeNoop` | `() => LanguageServer` | Answers `unsupported` for every request. |
|
|
392
|
+
| `layerNoop` | `Layer<LanguageServer>` | |
|
|
393
|
+
|
|
394
|
+
The queries are `hover`, `definition`, `references`, `implementation`,
|
|
395
|
+
`documentSymbols`, `workspaceSymbols`, `prepareCallHierarchy`,
|
|
396
|
+
`callHierarchyIncoming`, `callHierarchyOutgoing`, and `diagnostics`, each
|
|
397
|
+
returning `Effect<unknown, StdError>`. `sync(path, text)` sends a file's new
|
|
398
|
+
text, `close(path)` says it is gone, and `refresh` re-reads every synced file
|
|
399
|
+
from disk, resending changed ones and closing deleted ones.
|
|
400
|
+
|
|
401
|
+
## NodeLanguageServer
|
|
402
|
+
|
|
403
|
+
A host LSP client over the permission-checked process spawner, speaking framed
|
|
404
|
+
JSON-RPC on ordinary stdio pipes.
|
|
405
|
+
|
|
406
|
+
| Export | Type | Meaning |
|
|
407
|
+
| ---------------------- | ------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------- |
|
|
408
|
+
| `Config` | interface | `command`, `args?`, `cwd`, `extensions?`, `environment?`, `initializationOptions?`, `timeoutMs?`, `settleMs?`, `quietMs?`. |
|
|
409
|
+
| `MAX_QUEUED_FRAMES` | `256` | Frames buffered for the server's standard input. |
|
|
410
|
+
| `MAX_PENDING_REQUESTS` | `512` | Concurrent in-flight requests. |
|
|
411
|
+
| `make` | `(config: Config) => Effect<LanguageServer, StdError, ChildProcessSpawner \| Scope>` | |
|
|
412
|
+
| `makeLazy` | `(config: Config) => Effect<LanguageServer, StdError, ChildProcessSpawner \| Scope>` | Starts each server on the first request for one of its files. |
|
|
413
|
+
| `layer` | `(config: Config) => Layer<LanguageServer, StdError, ChildProcessSpawner>` | |
|
|
414
|
+
| `layerLazy` | `(config: Config) => Layer<LanguageServer, StdError, ChildProcessSpawner>` | Provides `makeLazy`. |
|
|
415
|
+
|
|
416
|
+
`make` sends `initialize` with `cwd` as the root URI and then `initialized`, so
|
|
417
|
+
the service is ready when it resolves. `timeoutMs` defaults to 30,000 and bounds
|
|
418
|
+
every request and every write. A frame body may be 8 MiB and its headers 8 KiB.
|
|
419
|
+
The child receives the host environment allowlist plus `Config.environment`.
|
|
420
|
+
`initializationOptions` is sent on `initialize` unchanged.
|
|
421
|
+
|
|
422
|
+
The server runs on the host as the host user. `make` fails with
|
|
423
|
+
`permission_denied`, before spawning, when the program it would execute lies
|
|
424
|
+
under `cwd`: a relative or absolute command there, a bare name found through a
|
|
425
|
+
`PATH` entry there, or a workspace symlink to a host binary. An argument, or
|
|
426
|
+
the value after `=` in one, that names an existing file or directory under
|
|
427
|
+
`cwd` is refused the same way; `node <dir>` runs that directory's `index.js` or
|
|
428
|
+
package `main`. A launcher is refused outright, because its arguments are code or
|
|
429
|
+
package names the file check cannot see: a shell (`sh -c`, `bash`, `zsh`),
|
|
430
|
+
`env`, a package runner (`npx`, `pnpm`, `npm`, `yarn`, `bunx`, `bun x`,
|
|
431
|
+
`deno`), or `node` and `bun` given inline code or a preload (`-e`, `--eval`,
|
|
432
|
+
`-p`, `-r`, `--require`, `--import`, `--loader`). Name the server's own host
|
|
433
|
+
binary, or an interpreter and a host script file. What the server loads after it starts is not checked: by default
|
|
434
|
+
typescript-language-server runs the workspace's `node_modules/typescript`,
|
|
435
|
+
tsserver with `--allowLocalPluginLoads` loads `tsconfig` plugins from the
|
|
436
|
+
project, and rust-analyzer runs build scripts and proc macros. Pin those to
|
|
437
|
+
host copies through `initializationOptions` or the server's own flags (for
|
|
438
|
+
typescript-language-server, `{ tsserver: { path: "<host>/tsserver.js" } }`),
|
|
439
|
+
or run the server in a sandbox.
|
|
440
|
+
Request failures include `method`. JSON-RPC refusals retain `rpcError` with the
|
|
441
|
+
server's numeric `code`, `message`, and optional `data`, bounded by the 8 MiB
|
|
442
|
+
frame limit. Failures attach the latest stderr tail when present, capturing at
|
|
443
|
+
most 64 KiB. On stdout closure or process exit, draining stderr gets a bounded
|
|
444
|
+
100 ms grace before pending requests fail.
|
|
445
|
+
|
|
446
|
+
## ExaWebSearch
|
|
447
|
+
|
|
448
|
+
A `WebSearch` provider backed by the Exa API.
|
|
449
|
+
|
|
450
|
+
| Export | Type |
|
|
451
|
+
| ------- | --------------------------------------------------------------------------------------- |
|
|
452
|
+
| `layer` | `(credentialId: string) => Layer<WebSearch.WebSearch, never, Credential \| HttpClient>` |
|
|
453
|
+
|
|
454
|
+
The key is read from the named credential through
|
|
455
|
+
[`@smthrs/control`](/api/control) rather than from the environment. See
|
|
456
|
+
[Reach the network](./guides/reach-the-network.md#search-the-web) for the status
|
|
457
|
+
mapping.
|
|
458
|
+
|
|
459
|
+
## Runtime notes
|
|
460
|
+
|
|
461
|
+
The root entry point is Node-only: it re-exports `NodeLanguageServer`, which
|
|
462
|
+
imports `node:url`. The four browser-safe subpaths are `@smthrs/std/Grep`,
|
|
463
|
+
`@smthrs/std/Glob`, `@smthrs/std/Search`, and `@smthrs/std/PortableSearch`.
|
|
464
|
+
Nothing any of the four imports reaches a Node built-in.
|
|
465
|
+
|
|
466
|
+
The model behind this surface has its own pages:
|
|
467
|
+
|
|
468
|
+
- [Limits are disclosed, never silent](./concepts/limits-and-disclosure.md) for
|
|
469
|
+
every cap and how it is reported.
|
|
470
|
+
- [Effects and capabilities](./concepts/effects-and-capabilities.md) for the
|
|
471
|
+
declared envelopes, the narrowing, and why hermetic mode is a pre-check rather
|
|
472
|
+
than a sandbox.
|
|
@@ -0,0 +1,136 @@
|
|
|
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, classifies each path token
|
|
116
|
+
as a read or a write from the command that governs it, resolves both the token
|
|
117
|
+
and every declaration to a canonical absolute path, and refuses the call with
|
|
118
|
+
`outside_declared_reads` or `outside_declared_writes` when one falls outside.
|
|
119
|
+
Paths under `/dev/` are exempt, because `2>/dev/null` is process plumbing rather
|
|
120
|
+
than a filesystem access.
|
|
121
|
+
|
|
122
|
+
Then it starts an ordinary host process. Shell expansion, subprocesses, and
|
|
123
|
+
paths computed at runtime are not observed. So the check bounds **what a caller
|
|
124
|
+
declared it would do**, not what the process can do. A host that needs
|
|
125
|
+
confinement supplies a sandbox or an access-reporting boundary; this check alone
|
|
126
|
+
cannot prove hermetic execution.
|
|
127
|
+
|
|
128
|
+
Two inputs are refused rather than pre-checked, for the same reason:
|
|
129
|
+
|
|
130
|
+
- A hermetic call that also names a `container`. A container has its own
|
|
131
|
+
filesystem, so declared host paths cannot describe it.
|
|
132
|
+
- A hermetic `script` whose `interpreter` is not a shell. The pre-check reads
|
|
133
|
+
shell text, and Python is not shell text.
|
|
134
|
+
|
|
135
|
+
Both refusals arrive as `invalid_input` with a message naming the alternative.
|
|
136
|
+
See [Run a shell command](../guides/run-a-shell-command.md).
|