@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,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/EnvelopePrecheck.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * The hermetic pre-check: a lexical scan of shell text for the paths it names,\n * and the refusal when one of them falls outside the declared envelope.\n *\n * The scan is fail-closed over explicit path tokens and nothing more. It\n * cannot prove confinement \u2014 a shell can name a path no lexer sees, through a\n * variable, a substitution, or a program that opens a file of its own \u2014 so a\n * kernel or host sandbox must eventually enforce and report the complete read\n * and write sets.\n *\n * It lives beside the flow rather than inside it because it is its own\n * concept, with its own vocabulary (Access, PathReference) and its own\n * security history: three independent bypasses, each sufficient on its own to\n * defeat it, are closed here.\n *\n * @since 1.0.0\n */\n\nimport type * as Path from \"@smthrs/kernel/Path\"\nimport * as StdError from \"../StdError.ts\"\nimport { withinEnvelope } from \"./Paths.ts\"\n\n/**\n * The filesystem envelope one invocation declared.\n *\n * Structural rather than the hermetic `Bash.Input` itself: the scan needs the\n * three fields and none of the rest, and depending on the flow module would\n * make the flow and its pre-check import each other.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Envelope {\n readonly cwd?: string | undefined\n readonly reads: ReadonlyArray<string>\n readonly writes: ReadonlyArray<string>\n}\n\n/**\n * How a command touches a path it names.\n *\n * @category models\n * @since 1.0.0\n */\nexport type Access = \"read\" | \"write\"\n\n/**\n * One path a command names, and how it touches it.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface PathReference {\n readonly access: Access\n readonly value: string\n}\n\nconst commandSeparators = new Set([\"&&\", \"||\", \";\", \"|\", \"&\", \"\\n\"])\nconst redirections = new Set([\">\", \">>\", \"<\", \"<<\"])\nconst writeCommands = new Set([\"chmod\", \"chown\", \"mkdir\", \"rm\", \"rmdir\", \"tee\", \"touch\", \"truncate\", \"unlink\"])\nconst destinationCommands = new Set([\"cp\", \"install\", \"mv\"])\nconst prefixWrappers = new Set([\"env\", \"nice\", \"time\", \"sudo\", \"nohup\", \"xargs\", \"command\", \"exec\"])\n\n// Shell spaces may disappear, but a physical line ends one command. Retaining\n// LF prevents a command on line one from classifying every later line's paths.\n//\n// A word is one or more runs of bare characters and quoted sections, not a\n// bare run alone: `FOO=\"a b\" rm /work/target` used to tokenize as `FOO=\"a`,\n// `b\"`, `rm`, `/work/target`, and since only the first token carried an `=`\n// the command was read as `b\"` rather than `rm` \u2014 so the delete was\n// classified as a read and a hermetic call with `writes: []` spawned. The\n// quoted alternatives come first inside the group so a quoted span is taken\n// whole; the bare class excludes quotes so the branches cannot overlap.\nconst tokenize = (command: string): ReadonlyArray<string> =>\n command.match(/\\n|>>|<<|&&|\\|\\||[<>;|&]|(?:\"(?:\\\\.|[^\"\\\\])*\"|'[^']*'|[^\\s<>;|&\"']+)+/g) ?? []\n\nconst unquote = (token: string): string => {\n const first = token[0]\n const last = token[token.length - 1]\n return token.length >= 2 && (first === \"'\" || first === \"\\\"\") && last === first\n ? token.slice(1, -1)\n : token\n}\n\nconst pathValue = (token: string): string =>\n unquote(token)\n .replace(/^\\$\\(+/, \"\")\n .replace(/[),]+$/, \"\")\n\nconst isPathToken = (path: Path.Path, token: string): boolean =>\n token === \".\" ||\n token === \"..\" ||\n token.startsWith(\"./\") ||\n token.startsWith(\"../\") ||\n path.isAbsolute(token) ||\n /^[A-Za-z]:[\\\\/]/.test(token) ||\n token.includes(\"/\")\n\nconst segmentReferences = (path: Path.Path, tokens: ReadonlyArray<string>): ReadonlyArray<PathReference> => {\n const commentIndex = tokens.findIndex((token) => token.startsWith(\"#\"))\n const active = commentIndex === -1 ? tokens : tokens.slice(0, commentIndex)\n const hasWrapper = active.some((token) => prefixWrappers.has(path.basename(pathValue(token))))\n let commandIndex = active.findIndex((token) =>\n !redirections.has(token) &&\n !token.includes(\"=\") &&\n !prefixWrappers.has(path.basename(pathValue(token))) &&\n !token.startsWith(\"-\") &&\n token !== \"\"\n )\n if (hasWrapper) {\n // Wrapper options can carry their own values. Prefer a later known\n // mutating command so an option value cannot lend it a read classification.\n const mutatingIndex = active.findIndex((token) => {\n const command = path.basename(pathValue(token))\n return writeCommands.has(command) || destinationCommands.has(command)\n })\n if (mutatingIndex !== -1) commandIndex = mutatingIndex\n }\n if (commandIndex === -1) return []\n\n const command = path.basename(pathValue(active[commandIndex]!))\n const candidates: Array<{ readonly index: number; readonly value: string }> = []\n for (let index = 0; index < active.length; index++) {\n const token = active[index]!\n if (index === commandIndex || redirections.has(token) || token.startsWith(\"-\")) continue\n const value = pathValue(token)\n if (value !== \"\" && isPathToken(path, value)) candidates.push({ index, value })\n }\n\n const destinationIndex = destinationCommands.has(command)\n ? candidates[candidates.length - 1]?.index\n : undefined\n\n return candidates.map(({ index, value }) => {\n const previous = active[index - 1]\n const access: Access = previous === \">\" || previous === \">>\" ||\n writeCommands.has(command) || destinationIndex === index\n ? \"write\"\n : \"read\"\n return { access, value }\n })\n}\n\n/**\n * Every path token the shell text names, one segment at a time.\n *\n * @category pre-check\n * @since 1.0.0\n */\nexport const commandReferences = (path: Path.Path, command: string): ReadonlyArray<PathReference> => {\n const references: Array<PathReference> = []\n let segment: Array<string> = []\n for (const token of tokenize(command)) {\n if (commandSeparators.has(token)) {\n references.push(...segmentReferences(path, segment))\n segment = []\n } else {\n segment.push(token)\n }\n }\n references.push(...segmentReferences(path, segment))\n return references\n}\n\nconst resolvePath = (\n path: Path.Path,\n cwd: string,\n value: string\n): string => path.isAbsolute(value) ? path.normalize(value) : path.resolve(cwd, value)\n\nconst isDeclared = (\n path: Path.Path,\n cwd: string,\n declared: ReadonlyArray<string>,\n source: string\n): boolean =>\n withinEnvelope(\n declared.map((entry) => resolvePath(path, cwd, entry)),\n resolvePath(path, cwd, source)\n )\n\n/**\n * The refusal shell text earns by naming a path outside its declared\n * envelope, or `undefined` when every path it names is declared.\n *\n * @category pre-check\n * @since 1.0.0\n */\nexport const outsideEnvelope = (\n input: Envelope,\n text: string,\n path: Path.Path\n): StdError.StdError | undefined => {\n const base = path.resolve(\".\")\n const cwd = path.resolve(input.cwd ?? \".\")\n // Passing the default explicitly is not a declaration the caller owes. A\n // working directory is where the command runs, not a file it reads, and\n // `cwd: \".\"` names exactly what omitting `cwd` names \u2014 so refusing it asked\n // the caller to list the workspace root among its reads to say nothing at\n // all. Agents hit this constantly: one SWE-bench run spent ten of its\n // forty-eight tool calls re-issuing the same command after\n // \"Working directory is outside declared reads: <the workspace root>\". A\n // cwd that points somewhere else is still declared or refused.\n if (input.cwd !== undefined && cwd !== base && !isDeclared(path, cwd, input.reads, cwd)) {\n return new StdError.StdError({\n code: \"outside_declared_reads\",\n message: `Working directory is outside declared reads: ${cwd}`,\n path: cwd\n })\n }\n\n // The Shell contract currently has no sandbox or access-reporting surface.\n // This lexical scan is intentionally only a fail-closed pre-check for\n // explicit path tokens. It cannot prove confinement; a kernel/host sandbox\n // must eventually enforce and report the complete read and write sets.\n for (const reference of commandReferences(path, text)) {\n const resolved = resolvePath(path, cwd, reference.value)\n // /dev/* is the process plumbing every shell one-liner leans on:\n // `2>/dev/null`, `cat /dev/stdin`. Normalize first so a dot-dot segment\n // cannot disguise an ordinary filesystem path as process plumbing.\n if (resolved.startsWith(\"/dev/\")) continue\n const declared = reference.access === \"write\" ? input.writes : input.reads\n if (!isDeclared(path, cwd, declared, resolved)) {\n const code = reference.access === \"write\" ? \"outside_declared_writes\" : \"outside_declared_reads\"\n return new StdError.StdError({\n code,\n message: `Command path is outside declared ${reference.access}s: ${resolved}`,\n path: resolved\n })\n }\n }\n return undefined\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBA,eAA0B;AAC1B,mBAA+B;AAqC/B,MAAM,oBAAoB,oBAAI,IAAI,CAAC,MAAM,MAAM,KAAK,KAAK,KAAK,IAAI,CAAC;AACnE,MAAM,eAAe,oBAAI,IAAI,CAAC,KAAK,MAAM,KAAK,IAAI,CAAC;AACnD,MAAM,gBAAgB,oBAAI,IAAI,CAAC,SAAS,SAAS,SAAS,MAAM,SAAS,OAAO,SAAS,YAAY,QAAQ,CAAC;AAC9G,MAAM,sBAAsB,oBAAI,IAAI,CAAC,MAAM,WAAW,IAAI,CAAC;AAC3D,MAAM,iBAAiB,oBAAI,IAAI,CAAC,OAAO,QAAQ,QAAQ,QAAQ,SAAS,SAAS,WAAW,MAAM,CAAC;AAYnG,MAAM,WAAW,CAAC,YAChB,QAAQ,MAAM,wEAAwE,KAAK,CAAC;AAE9F,MAAM,UAAU,CAAC,UAA0B;AACzC,QAAM,QAAQ,MAAM,CAAC;AACrB,QAAM,OAAO,MAAM,MAAM,SAAS,CAAC;AACnC,SAAO,MAAM,UAAU,MAAM,UAAU,OAAO,UAAU,QAAS,SAAS,QACtE,MAAM,MAAM,GAAG,EAAE,IACjB;AACN;AAEA,MAAM,YAAY,CAAC,UACjB,QAA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I,MAAM,QAAQ,UAAa,QAAQ,QAAQ,CAAC,WAAW,MAAM,KAAK,MAAM,OAAO,GAAG,GAAG;AACvF,WAAO,IAAI,SAAS,SAAS;AAAA,MAC3B,MAAM;AAAA,MACN,SAAS,gDAAgD,GAAG;AAAA,MAC5D,MAAM;AAAA,IACR,CAAC;AAAA,EACH;AAMA,aAAW,aAAa,kBAAkB,MAAM,IAAI,GAAG;AACrD,UAAM,WAAW,YAAY,MAAM,KAAK,UAAU,KAAK;AAIvD,QAAI,SAAS,WAAW,OAAO,EAAG;AAClC,UAAM,WAAW,UAAU,WAAW,UAAU,MAAM,SAAS,MAAM;AACrE,QAAI,CAAC,WAAW,MAAM,KAAK,UAAU,QAAQ,GAAG;AAC9C,YAAM,OAAO,UAAU,WAAW,UAAU,4BAA4B;AACxE,aAAO,IAAI,SAAS,SAAS;AAAA,QAC3B;AAAA,QACA,SAAS,oCAAoC,UAAU,MAAM,MAAM,QAAQ;AAAA,QAC3E,MAAM;AAAA,MACR,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;",
|
|
6
|
+
"names": ["command"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Buffered shell execution over the permission-aware process spawner.
|
|
3
|
+
*
|
|
4
|
+
* `@smthrs/kernel` used to expose a `Shell` service whose `exec` returned a
|
|
5
|
+
* buffered `{ stdout, stderr, exitCode }`. The kernel replaced it with
|
|
6
|
+
* `ChildProcessSpawner`, Effect's own process boundary, which streams and has
|
|
7
|
+
* no buffered form. This module is the buffered form the shell flows still
|
|
8
|
+
* want, expressed in terms of the spawner so the `proc:spawn` capability check
|
|
9
|
+
* and the command-line resource stay exactly where the kernel put them.
|
|
10
|
+
*
|
|
11
|
+
* Commands run through the platform shell (`shell: true`), matching the old
|
|
12
|
+
* service: the flows take a command *line*, not an argv.
|
|
13
|
+
*
|
|
14
|
+
* @since 1.0.0
|
|
15
|
+
*/
|
|
16
|
+
import * as ChildProcessSpawner from "@smthrs/kernel/ChildProcessSpawner";
|
|
17
|
+
import * as Effect from "effect/Effect";
|
|
18
|
+
import * as Schema from "effect/Schema";
|
|
19
|
+
import * as StdError from "../StdError.ts";
|
|
20
|
+
/**
|
|
21
|
+
* Failure codes a buffered execution can report, matching the codes the
|
|
22
|
+
* removed kernel `Shell` used so handler-level mapping is unchanged.
|
|
23
|
+
*
|
|
24
|
+
* @category models
|
|
25
|
+
* @since 1.0.0
|
|
26
|
+
*/
|
|
27
|
+
export declare const ExecErrorCode: Schema.Literals<readonly ["timeout", "spawn_error", "capture_overflow"]>;
|
|
28
|
+
/**
|
|
29
|
+
* Failure codes a buffered execution can report.
|
|
30
|
+
*
|
|
31
|
+
* @category models
|
|
32
|
+
* @since 1.0.0
|
|
33
|
+
*/
|
|
34
|
+
export type ExecErrorCode = typeof ExecErrorCode.Type;
|
|
35
|
+
declare const ExecError_base: Schema.Class<ExecError, Schema.TaggedStruct<"@smthrs/std/ExecError", {
|
|
36
|
+
readonly code: Schema.Literals<readonly ["timeout", "spawn_error", "capture_overflow"]>;
|
|
37
|
+
readonly message: Schema.String;
|
|
38
|
+
/** The limit a `timeout` ran past, in milliseconds. */
|
|
39
|
+
readonly limitMillis: Schema.optional<Schema.Number>;
|
|
40
|
+
}>, import("effect/Cause").YieldableError>;
|
|
41
|
+
/**
|
|
42
|
+
* A command that never produced an exit code.
|
|
43
|
+
*
|
|
44
|
+
* A non-zero exit is a successful {@link ExecResult}, not a failure; this
|
|
45
|
+
* error is reserved for a command that could not start or was cut off by its
|
|
46
|
+
* timeout, or whose captured output exceeded a refusing capture bound.
|
|
47
|
+
*
|
|
48
|
+
* @category errors
|
|
49
|
+
* @since 1.0.0
|
|
50
|
+
*/
|
|
51
|
+
export declare class ExecError extends ExecError_base {
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The buffered result of one command.
|
|
55
|
+
*
|
|
56
|
+
* @category models
|
|
57
|
+
* @since 1.0.0
|
|
58
|
+
*/
|
|
59
|
+
export interface ExecResult {
|
|
60
|
+
readonly stdout: string;
|
|
61
|
+
readonly stderr: string;
|
|
62
|
+
readonly exitCode: number;
|
|
63
|
+
/** UTF-8 bytes dropped from the head of stdout to stay inside the capture bound. */
|
|
64
|
+
readonly stdoutDroppedBytes: number;
|
|
65
|
+
/** UTF-8 bytes dropped from the head of stderr to stay inside the capture bound. */
|
|
66
|
+
readonly stderrDroppedBytes: number;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Options accepted by {@link exec}.
|
|
70
|
+
*
|
|
71
|
+
* @category models
|
|
72
|
+
* @since 1.0.0
|
|
73
|
+
*/
|
|
74
|
+
export interface ExecOptions {
|
|
75
|
+
readonly cwd?: string | undefined;
|
|
76
|
+
readonly env?: Readonly<Record<string, string>> | undefined;
|
|
77
|
+
readonly timeoutMs?: number | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* The program's arguments. Present means an argv, absent means a command
|
|
80
|
+
* line for the platform shell. An argv is how a payload reaches a program
|
|
81
|
+
* without being quoted into a string: nothing between here and `execve`
|
|
82
|
+
* re-parses it.
|
|
83
|
+
*/
|
|
84
|
+
readonly args?: ReadonlyArray<string> | undefined;
|
|
85
|
+
/**
|
|
86
|
+
* Text written to the program's standard input, as data. A script delivered
|
|
87
|
+
* this way is never quoted, escaped, or heredoc-terminated, which is the
|
|
88
|
+
* whole point: quoting corruption cost the measured SWE-bench program twelve
|
|
89
|
+
* probe failures and one instance's most expensive frame.
|
|
90
|
+
*/
|
|
91
|
+
readonly stdin?: string | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Bytes retained per captured stream. A stream that prints more keeps its
|
|
94
|
+
* tail and reports what it dropped, so a command printing gigabytes costs a
|
|
95
|
+
* bounded amount of memory rather than the whole of what it printed.
|
|
96
|
+
*
|
|
97
|
+
* Absent means unbounded, which is what a caller wants when it needs every
|
|
98
|
+
* byte a tool produced (`rg --files`, `git worktree list`).
|
|
99
|
+
*/
|
|
100
|
+
readonly maxCaptureBytes?: number | undefined;
|
|
101
|
+
/** Defaults to `tail`; `refuse` fails if either stream exceeds the bound. */
|
|
102
|
+
readonly overflow?: "tail" | "refuse" | undefined;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Runs a command line through the platform shell and buffers its output.
|
|
106
|
+
*
|
|
107
|
+
* Cancellation is scope closure: the spawn is scoped, so an interrupted fiber
|
|
108
|
+
* — including the one a `timeoutMs` interrupts — terminates the process rather
|
|
109
|
+
* than leaking it.
|
|
110
|
+
*
|
|
111
|
+
* @category execution
|
|
112
|
+
* @since 1.0.0
|
|
113
|
+
*/
|
|
114
|
+
export declare const exec: (command: string, options?: ExecOptions) => Effect.Effect<ExecResult, ExecError, ChildProcessSpawner.ChildProcessSpawner>;
|
|
115
|
+
/**
|
|
116
|
+
* The model-facing failure code a command that never produced an exit code
|
|
117
|
+
* carries.
|
|
118
|
+
*
|
|
119
|
+
* A timeout keeps its own code, because "the command never finished" and "the
|
|
120
|
+
* command never started" are different things to a caller deciding whether to
|
|
121
|
+
* retry. Every other way of producing no exit code is a host failure.
|
|
122
|
+
*
|
|
123
|
+
* @category errors
|
|
124
|
+
* @since 1.0.0
|
|
125
|
+
*/
|
|
126
|
+
export declare const toStdErrorCode: (error: ExecError) => StdError.Code;
|
|
127
|
+
/**
|
|
128
|
+
* The model-facing failure one execution error becomes.
|
|
129
|
+
*
|
|
130
|
+
* A timeout names the command, which is what the caller asked for and all a
|
|
131
|
+
* timeout has to say. Any other failure carries the message the execution
|
|
132
|
+
* produced, which already names the command.
|
|
133
|
+
*
|
|
134
|
+
* @category errors
|
|
135
|
+
* @since 1.0.0
|
|
136
|
+
*/
|
|
137
|
+
export declare const toStdError: (command: string, error: ExecError) => StdError.StdError;
|
|
138
|
+
export {};
|
|
139
|
+
//# sourceMappingURL=Exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Exec.d.ts","sourceRoot":"","sources":["../../../src/internal/Exec.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AAE,MAAM,GAAG,SAAS,CAAA;IAC7C,6EAA6E;IAC7E,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAAA;CAClD;AAiJD;;;;;;;;;GASG;AACH,eAAO,MAAM,IAAI,GACf,SAAS,MAAM,EACf,UAAS,WAAgB,KACxB,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,SAAS,EAAE,mBAAmB,CAAC,mBAAmB,CAazE,CAAA;AAEN;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,GAAI,OAAO,SAAS,KAAG,QAAQ,CAAC,IACF,CAAA;AAEzD;;;;;;;;;GASG;AACH,eAAO,MAAM,UAAU,GAAI,SAAS,MAAM,EAAE,OAAO,SAAS,KAAG,QAAQ,CAAC,QAOpE,CAAA"}
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var Exec_exports = {};
|
|
30
|
+
__export(Exec_exports, {
|
|
31
|
+
ExecError: () => ExecError,
|
|
32
|
+
ExecErrorCode: () => ExecErrorCode,
|
|
33
|
+
exec: () => exec,
|
|
34
|
+
toStdError: () => toStdError,
|
|
35
|
+
toStdErrorCode: () => toStdErrorCode
|
|
36
|
+
});
|
|
37
|
+
module.exports = __toCommonJS(Exec_exports);
|
|
38
|
+
var ChildProcessEnvironment = __toESM(require("@smthrs/kernel/ChildProcessEnvironment"), 1);
|
|
39
|
+
var ChildProcessSpawner = __toESM(require("@smthrs/kernel/ChildProcessSpawner"), 1);
|
|
40
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
41
|
+
var Schema = __toESM(require("effect/Schema"), 1);
|
|
42
|
+
var Stream = __toESM(require("effect/Stream"), 1);
|
|
43
|
+
var ChildProcess = __toESM(require("effect/unstable/process/ChildProcess"), 1);
|
|
44
|
+
var StdError = __toESM(require("../StdError.js"), 1);
|
|
45
|
+
const ExecErrorCode = Schema.Literals(["timeout", "spawn_error", "capture_overflow"]);
|
|
46
|
+
class ExecError extends Schema.TaggedError()("@smthrs/std/ExecError", {
|
|
47
|
+
code: ExecErrorCode,
|
|
48
|
+
message: Schema.String,
|
|
49
|
+
/** The limit a `timeout` ran past, in milliseconds. */
|
|
50
|
+
limitMillis: Schema.optional(Schema.Number)
|
|
51
|
+
}) {
|
|
52
|
+
}
|
|
53
|
+
const decoder = new TextDecoder("utf-8");
|
|
54
|
+
const decodeTail = (state) => {
|
|
55
|
+
const bytes = new Uint8Array(state.bytes);
|
|
56
|
+
let offset = 0;
|
|
57
|
+
for (const chunk of state.chunks) {
|
|
58
|
+
bytes.set(chunk, offset);
|
|
59
|
+
offset += chunk.byteLength;
|
|
60
|
+
}
|
|
61
|
+
if (state.dropped === 0) return { text: decoder.decode(bytes), droppedBytes: 0 };
|
|
62
|
+
let start = 0;
|
|
63
|
+
while (start < bytes.byteLength && start < 3 && (bytes[start] & 192) === 128) start++;
|
|
64
|
+
return { text: decoder.decode(bytes.subarray(start)), droppedBytes: state.dropped + start };
|
|
65
|
+
};
|
|
66
|
+
const boundedTail = (stream, maxBytes, overflow) => Stream.runFold(
|
|
67
|
+
stream,
|
|
68
|
+
() => ({ chunks: [], bytes: 0, dropped: 0 }),
|
|
69
|
+
(state, chunk) => {
|
|
70
|
+
if (chunk.byteLength === 0) return state;
|
|
71
|
+
state.chunks.push(chunk);
|
|
72
|
+
state.bytes += chunk.byteLength;
|
|
73
|
+
while (state.bytes > maxBytes && state.chunks.length > 0) {
|
|
74
|
+
const excess = state.bytes - maxBytes;
|
|
75
|
+
const first = state.chunks[0];
|
|
76
|
+
if (first.byteLength <= excess) {
|
|
77
|
+
state.chunks.shift();
|
|
78
|
+
state.bytes -= first.byteLength;
|
|
79
|
+
state.dropped += first.byteLength;
|
|
80
|
+
} else {
|
|
81
|
+
state.chunks[0] = first.subarray(excess);
|
|
82
|
+
state.bytes -= excess;
|
|
83
|
+
state.dropped += excess;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return state;
|
|
87
|
+
}
|
|
88
|
+
).pipe(Effect.map(
|
|
89
|
+
(state) => overflow === "refuse" && state.dropped > 0 ? { text: "", droppedBytes: state.dropped } : decodeTail(state)
|
|
90
|
+
));
|
|
91
|
+
const capture = (stream, maxBytes, overflow) => maxBytes === void 0 ? Effect.map(Stream.mkString(Stream.decodeText(stream)), (text) => ({ text, droppedBytes: 0 })) : boundedTail(stream, maxBytes, overflow);
|
|
92
|
+
const unbounded = (command, options) => Effect.gen(function* () {
|
|
93
|
+
const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
|
|
94
|
+
const settings = {
|
|
95
|
+
...options.args === void 0 ? { shell: true } : {},
|
|
96
|
+
...options.cwd === void 0 ? {} : { cwd: options.cwd },
|
|
97
|
+
env: ChildProcessEnvironment.make(process.env, options.env),
|
|
98
|
+
extendEnv: false,
|
|
99
|
+
...options.stdin === void 0 ? {} : { stdin: Stream.make(new TextEncoder().encode(options.stdin)) }
|
|
100
|
+
};
|
|
101
|
+
const handle = yield* spawner.spawn(
|
|
102
|
+
options.args === void 0 ? ChildProcess.make(command, settings) : ChildProcess.make(command, [...options.args], settings)
|
|
103
|
+
);
|
|
104
|
+
const [stdout, stderr, exitCode] = yield* Effect.all(
|
|
105
|
+
[
|
|
106
|
+
capture(handle.stdout, options.maxCaptureBytes, options.overflow),
|
|
107
|
+
capture(handle.stderr, options.maxCaptureBytes, options.overflow),
|
|
108
|
+
handle.exitCode
|
|
109
|
+
],
|
|
110
|
+
{ concurrency: "unbounded" }
|
|
111
|
+
);
|
|
112
|
+
if (options.overflow === "refuse") {
|
|
113
|
+
const overflowed = [
|
|
114
|
+
stdout.droppedBytes > 0 ? "stdout" : void 0,
|
|
115
|
+
stderr.droppedBytes > 0 ? "stderr" : void 0
|
|
116
|
+
].filter((stream) => stream !== void 0);
|
|
117
|
+
if (overflowed.length > 0) {
|
|
118
|
+
return yield* Effect.fail(
|
|
119
|
+
new ExecError({
|
|
120
|
+
code: "capture_overflow",
|
|
121
|
+
message: `${command} ${overflowed.join(" and ")} exceeded the ${options.maxCaptureBytes}-byte capture cap; refusing partial output`
|
|
122
|
+
})
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
return {
|
|
127
|
+
stdout: stdout.text,
|
|
128
|
+
stderr: stderr.text,
|
|
129
|
+
exitCode,
|
|
130
|
+
stdoutDroppedBytes: stdout.droppedBytes,
|
|
131
|
+
stderrDroppedBytes: stderr.droppedBytes
|
|
132
|
+
};
|
|
133
|
+
}).pipe(
|
|
134
|
+
Effect.scoped,
|
|
135
|
+
Effect.mapError(
|
|
136
|
+
(error) => error instanceof ExecError ? error : new ExecError({
|
|
137
|
+
code: "spawn_error",
|
|
138
|
+
message: `exec: ${command}: ${error.message}`
|
|
139
|
+
})
|
|
140
|
+
)
|
|
141
|
+
);
|
|
142
|
+
const exec = (command, options = {}) => options.timeoutMs === void 0 ? unbounded(command, options) : Effect.timeoutOrElse(unbounded(command, options), {
|
|
143
|
+
duration: options.timeoutMs,
|
|
144
|
+
orElse: () => Effect.fail(
|
|
145
|
+
new ExecError({
|
|
146
|
+
code: "timeout",
|
|
147
|
+
message: `exec: \`${command}\` exceeded ${options.timeoutMs}ms`,
|
|
148
|
+
limitMillis: options.timeoutMs
|
|
149
|
+
})
|
|
150
|
+
)
|
|
151
|
+
});
|
|
152
|
+
const toStdErrorCode = (error) => error.code === "timeout" ? "timeout" : "command_failed";
|
|
153
|
+
const toStdError = (command, error) => new StdError.StdError({
|
|
154
|
+
code: toStdErrorCode(error),
|
|
155
|
+
message: error.code === "timeout" ? `Command timed out: ${command}` : `Command failed to start: ${error.message}`,
|
|
156
|
+
...error.limitMillis === void 0 ? {} : { limitMillis: error.limitMillis }
|
|
157
|
+
});
|
|
158
|
+
//# sourceMappingURL=Exec.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/Exec.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Buffered shell execution over the permission-aware process spawner.\n *\n * `@smthrs/kernel` used to expose a `Shell` service whose `exec` returned a\n * buffered `{ stdout, stderr, exitCode }`. The kernel replaced it with\n * `ChildProcessSpawner`, Effect's own process boundary, which streams and has\n * no buffered form. This module is the buffered form the shell flows still\n * want, expressed in terms of the spawner so the `proc:spawn` capability check\n * and the command-line resource stay exactly where the kernel put them.\n *\n * Commands run through the platform shell (`shell: true`), matching the old\n * service: the flows take a command *line*, not an argv.\n *\n * @since 1.0.0\n */\n\nimport * as ChildProcessEnvironment from \"@smthrs/kernel/ChildProcessEnvironment\"\nimport * as ChildProcessSpawner from \"@smthrs/kernel/ChildProcessSpawner\"\nimport * as Effect from \"effect/Effect\"\nimport * as Schema from \"effect/Schema\"\nimport * as Stream from \"effect/Stream\"\nimport * as ChildProcess from \"effect/unstable/process/ChildProcess\"\nimport * as StdError from \"../StdError.ts\"\n\n/**\n * Failure codes a buffered execution can report, matching the codes the\n * removed kernel `Shell` used so handler-level mapping is unchanged.\n *\n * @category models\n * @since 1.0.0\n */\nexport const ExecErrorCode = Schema.Literals([\"timeout\", \"spawn_error\", \"capture_overflow\"])\n\n/**\n * Failure codes a buffered execution can report.\n *\n * @category models\n * @since 1.0.0\n */\nexport type ExecErrorCode = typeof ExecErrorCode.Type\n\n/**\n * A command that never produced an exit code.\n *\n * A non-zero exit is a successful {@link ExecResult}, not a failure; this\n * error is reserved for a command that could not start or was cut off by its\n * timeout, or whose captured output exceeded a refusing capture bound.\n *\n * @category errors\n * @since 1.0.0\n */\nexport class ExecError extends Schema.TaggedError<ExecError>()(\"@smthrs/std/ExecError\", {\n code: ExecErrorCode,\n message: Schema.String,\n /** The limit a `timeout` ran past, in milliseconds. */\n limitMillis: Schema.optional(Schema.Number)\n}) {}\n\n/**\n * The buffered result of one command.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface ExecResult {\n readonly stdout: string\n readonly stderr: string\n readonly exitCode: number\n /** UTF-8 bytes dropped from the head of stdout to stay inside the capture bound. */\n readonly stdoutDroppedBytes: number\n /** UTF-8 bytes dropped from the head of stderr to stay inside the capture bound. */\n readonly stderrDroppedBytes: number\n}\n\n/**\n * Options accepted by {@link exec}.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface ExecOptions {\n readonly cwd?: string | undefined\n readonly env?: Readonly<Record<string, string>> | undefined\n readonly timeoutMs?: number | undefined\n /**\n * The program's arguments. Present means an argv, absent means a command\n * line for the platform shell. An argv is how a payload reaches a program\n * without being quoted into a string: nothing between here and `execve`\n * re-parses it.\n */\n readonly args?: ReadonlyArray<string> | undefined\n /**\n * Text written to the program's standard input, as data. A script delivered\n * this way is never quoted, escaped, or heredoc-terminated, which is the\n * whole point: quoting corruption cost the measured SWE-bench program twelve\n * probe failures and one instance's most expensive frame.\n */\n readonly stdin?: string | undefined\n /**\n * Bytes retained per captured stream. A stream that prints more keeps its\n * tail and reports what it dropped, so a command printing gigabytes costs a\n * bounded amount of memory rather than the whole of what it printed.\n *\n * Absent means unbounded, which is what a caller wants when it needs every\n * byte a tool produced (`rg --files`, `git worktree list`).\n */\n readonly maxCaptureBytes?: number | undefined\n /** Defaults to `tail`; `refuse` fails if either stream exceeds the bound. */\n readonly overflow?: \"tail\" | \"refuse\" | undefined\n}\n\n/** One captured stream: the text kept, and the bytes dropped to keep it bounded. */\ninterface Capture {\n readonly text: string\n readonly droppedBytes: number\n}\n\ninterface Tail {\n chunks: Array<Uint8Array>\n bytes: number\n dropped: number\n}\n\nconst decoder = new TextDecoder(\"utf-8\")\n\n/**\n * Joins the retained chunks and decodes them, skipping the partial code point a\n * dropped head can leave behind.\n *\n * A UTF-8 continuation byte is `10xxxxxx`, and a code point is at most four\n * bytes, so at most three leading continuation bytes can precede the first\n * whole character. Skipping them is counted as dropped rather than decoded to a\n * replacement character the process never printed.\n */\nconst decodeTail = (state: Tail): Capture => {\n const bytes = new Uint8Array(state.bytes)\n let offset = 0\n for (const chunk of state.chunks) {\n bytes.set(chunk, offset)\n offset += chunk.byteLength\n }\n if (state.dropped === 0) return { text: decoder.decode(bytes), droppedBytes: 0 }\n let start = 0\n while (start < bytes.byteLength && start < 3 && (bytes[start]! & 0b1100_0000) === 0b1000_0000) start++\n return { text: decoder.decode(bytes.subarray(start)), droppedBytes: state.dropped + start }\n}\n\nconst boundedTail = <E>(\n stream: Stream.Stream<Uint8Array, E>,\n maxBytes: number,\n overflow: \"tail\" | \"refuse\" | undefined\n): Effect.Effect<Capture, E> =>\n Stream.runFold(\n stream,\n (): Tail => ({ chunks: [], bytes: 0, dropped: 0 }),\n (state, chunk) => {\n if (chunk.byteLength === 0) return state\n state.chunks.push(chunk)\n state.bytes += chunk.byteLength\n while (state.bytes > maxBytes && state.chunks.length > 0) {\n const excess = state.bytes - maxBytes\n const first = state.chunks[0]!\n if (first.byteLength <= excess) {\n state.chunks.shift()\n state.bytes -= first.byteLength\n state.dropped += first.byteLength\n } else {\n state.chunks[0] = first.subarray(excess)\n state.bytes -= excess\n state.dropped += excess\n }\n }\n return state\n }\n ).pipe(Effect.map((state) =>\n overflow === \"refuse\" && state.dropped > 0\n ? { text: \"\", droppedBytes: state.dropped }\n : decodeTail(state)\n ))\n\nconst capture = <E>(\n stream: Stream.Stream<Uint8Array, E>,\n maxBytes: number | undefined,\n overflow: \"tail\" | \"refuse\" | undefined\n): Effect.Effect<Capture, E> =>\n maxBytes === undefined\n ? Effect.map(Stream.mkString(Stream.decodeText(stream)), (text) => ({ text, droppedBytes: 0 }))\n : boundedTail(stream, maxBytes, overflow)\n\nconst unbounded = (\n command: string,\n options: ExecOptions\n): Effect.Effect<ExecResult, ExecError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function*() {\n const spawner = yield* ChildProcessSpawner.ChildProcessSpawner\n const settings: ChildProcess.CommandOptions = {\n ...(options.args === undefined ? { shell: true } : {}),\n ...(options.cwd === undefined ? {} : { cwd: options.cwd }),\n env: ChildProcessEnvironment.make(process.env, options.env),\n extendEnv: false,\n ...(options.stdin === undefined\n ? {}\n : { stdin: Stream.make(new TextEncoder().encode(options.stdin)) })\n }\n const handle = yield* spawner.spawn(\n options.args === undefined\n ? ChildProcess.make(command, settings)\n : ChildProcess.make(command, [...options.args], settings)\n )\n // stdout, stderr, and the exit code have to be consumed concurrently: a\n // command that fills a pipe blocks until the pipe is drained, so waiting\n // for exit first would deadlock on any output larger than the buffer.\n const [stdout, stderr, exitCode] = yield* Effect.all(\n [\n capture(handle.stdout, options.maxCaptureBytes, options.overflow),\n capture(handle.stderr, options.maxCaptureBytes, options.overflow),\n handle.exitCode\n ],\n { concurrency: \"unbounded\" }\n )\n if (options.overflow === \"refuse\") {\n const overflowed = [\n stdout.droppedBytes > 0 ? \"stdout\" : undefined,\n stderr.droppedBytes > 0 ? \"stderr\" : undefined\n ]\n .filter((stream): stream is string => stream !== undefined)\n if (overflowed.length > 0) {\n return yield* Effect.fail(\n new ExecError({\n code: \"capture_overflow\",\n message: `${command} ${\n overflowed.join(\" and \")\n } exceeded the ${options.maxCaptureBytes}-byte capture cap; refusing partial output`\n })\n )\n }\n }\n return {\n stdout: stdout.text,\n stderr: stderr.text,\n exitCode,\n stdoutDroppedBytes: stdout.droppedBytes,\n stderrDroppedBytes: stderr.droppedBytes\n }\n }).pipe(\n Effect.scoped,\n Effect.mapError((error) =>\n error instanceof ExecError ? error : new ExecError({\n code: \"spawn_error\",\n message: `exec: ${command}: ${error.message}`\n })\n )\n )\n\n/**\n * Runs a command line through the platform shell and buffers its output.\n *\n * Cancellation is scope closure: the spawn is scoped, so an interrupted fiber\n * \u2014 including the one a `timeoutMs` interrupts \u2014 terminates the process rather\n * than leaking it.\n *\n * @category execution\n * @since 1.0.0\n */\nexport const exec = (\n command: string,\n options: ExecOptions = {}\n): Effect.Effect<ExecResult, ExecError, ChildProcessSpawner.ChildProcessSpawner> =>\n options.timeoutMs === undefined\n ? unbounded(command, options)\n : Effect.timeoutOrElse(unbounded(command, options), {\n duration: options.timeoutMs,\n orElse: () =>\n Effect.fail(\n new ExecError({\n code: \"timeout\",\n message: `exec: \\`${command}\\` exceeded ${options.timeoutMs}ms`,\n limitMillis: options.timeoutMs\n })\n )\n })\n\n/**\n * The model-facing failure code a command that never produced an exit code\n * carries.\n *\n * A timeout keeps its own code, because \"the command never finished\" and \"the\n * command never started\" are different things to a caller deciding whether to\n * retry. Every other way of producing no exit code is a host failure.\n *\n * @category errors\n * @since 1.0.0\n */\nexport const toStdErrorCode = (error: ExecError): StdError.Code =>\n error.code === \"timeout\" ? \"timeout\" : \"command_failed\"\n\n/**\n * The model-facing failure one execution error becomes.\n *\n * A timeout names the command, which is what the caller asked for and all a\n * timeout has to say. Any other failure carries the message the execution\n * produced, which already names the command.\n *\n * @category errors\n * @since 1.0.0\n */\nexport const toStdError = (command: string, error: ExecError): StdError.StdError =>\n new StdError.StdError({\n code: toStdErrorCode(error),\n message: error.code === \"timeout\"\n ? `Command timed out: ${command}`\n : `Command failed to start: ${error.message}`,\n ...(error.limitMillis === undefined ? {} : { limitMillis: error.limitMillis })\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,8BAAyC;AACzC,0BAAqC;AACrC,aAAwB;AACxB,aAAwB;AACxB,aAAwB;AACxB,mBAA8B;AAC9B,eAA0B;AASnB,MAAM,gBAAgB,OAAO,SAAS,CAAC,WAAW,eAAe,kBAAkB,CAAC;AAoBpF,MAAM,kBAAkB,OAAO,YAAuB,EAAE,yBAAyB;AAAA,EACtF,MAAM;AAAA,EACN,SAAS,OAAO;AAAA;AAAA,EAEhB,aAAa,OAAO,SAAS,OAAO,MAAM;AAC5C,CAAC,EAAE;AAAC;AAmEJ,MAAM,UAAU,IAAI,YAAY,OAAO;AAWvC,MAAM,aAAa,CAAC,UAAyB;AAC3C,QAAM,QAAQ,IAAI,WAAW,MAAM,KAAK;AACxC,MAAI,SAAS;AACb,aAAW,SAAS,MAAM,QAAQ;AAChC,UAAM,IAAI,OAAO,MAAM;AACvB,cAAU,MAAM;AAAA,EAClB;AACA,MAAI,MAAM,YAAY,EAAG,QAAO,EAAE,MAAM,QAAQ,OAAO,KAAK,GAAG,cAAc,EAAE;AAC/E,MAAI,QAAQ;AACZ,SAAO,QAAQ,MAAM,cAAc,QAAQ,MAAM,MAAM,KAAK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oB,OAAO;AAAA,EAC7B;AACF,CAAC,EAAE;AAAA,EACD,OAAO;AAAA,EACP,OAAO;AAAA,IAAS,CAAC,UACf,iBAAiB,YAAY,QAAQ,IAAI,UAAU;AAAA,MACjD,MAAM;AAAA,MACN,SAAS,SAAS,OAAO,KAAK,MAAM,OAAO;AAAA,IAC7C,CAAC;AAAA,EACH;AACF;AAYK,MAAM,OAAO,CAClB,SACA,UAAuB,CAAC,MAExB,QAAQ,cAAc,SAClB,UAAU,SAAS,OAAO,IAC1B,OAAO,cAAc,UAAU,SAAS,OAAO,GAAG;AAAA,EAClD,UAAU,QAAQ;AAAA,EAClB,QAAQ,MACN,OAAO;AAAA,IACL,IAAI,UAAU;AAAA,MACZ,MAAM;AAAA,MACN,SAAS,WAAW,OAAO,eAAe,QAAQ,SAAS;AAAA,MAC3D,aAAa,QAAQ;AAAA,IACvB,CAAC;AAAA,EACH;AACJ,CAAC;AAaE,MAAM,iBAAiB,CAAC,UAC7B,MAAM,SAAS,YAAY,YAAY;AAYlC,MAAM,aAAa,CAAC,SAAiB,UAC1C,IAAI,SAAS,SAAS;AAAA,EACpB,MAAM,eAAe,KAAK;AAAA,EAC1B,SAAS,MAAM,SAAS,YACpB,sBAAsB,OAAO,KAC7B,4BAA4B,MAAM,OAAO;AAAA,EAC7C,GAAI,MAAM,gBAAgB,SAAY,CAAC,IAAI,EAAE,aAAa,MAAM,YAAY;AAC9E,CAAC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mutation preparation for versioned hosts and cooperative locks for ordinary hosts.
|
|
3
|
+
* Ordinary locks fail closed after process death; they are never stolen on a timer.
|
|
4
|
+
*
|
|
5
|
+
* @since 1.0.0
|
|
6
|
+
*/
|
|
7
|
+
import * as Context from "effect/Context";
|
|
8
|
+
import * as Effect from "effect/Effect";
|
|
9
|
+
import type * as FileSystem from "effect/FileSystem";
|
|
10
|
+
import type * as Path from "effect/Path";
|
|
11
|
+
import type * as Scope from "effect/Scope";
|
|
12
|
+
import * as StdError from "../StdError.ts";
|
|
13
|
+
/**
|
|
14
|
+
* Authenticated standard-flow call session; absent callers cannot borrow another run's base.
|
|
15
|
+
*
|
|
16
|
+
* @category context
|
|
17
|
+
* @since 1.0.0
|
|
18
|
+
*/
|
|
19
|
+
export declare const ReadSession: Context.Reference<string | undefined>;
|
|
20
|
+
/**
|
|
21
|
+
* The coding host attaches one run-scoped precondition policy to its guarded filesystem.
|
|
22
|
+
*
|
|
23
|
+
* @category identifiers
|
|
24
|
+
* @since 1.0.0
|
|
25
|
+
*/
|
|
26
|
+
export declare const Preconditions: unique symbol;
|
|
27
|
+
/**
|
|
28
|
+
* One prepared file change; moves include a write and a guarded source removal.
|
|
29
|
+
*
|
|
30
|
+
* @category models
|
|
31
|
+
* @since 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
export interface Change {
|
|
34
|
+
readonly path: string;
|
|
35
|
+
/** Null removes a file. Writes preserve existing metadata; new files use host defaults. */
|
|
36
|
+
readonly content: Uint8Array | null;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A per-invocation provider receipt boundary, with immutable captured read bases.
|
|
40
|
+
*
|
|
41
|
+
* @category models
|
|
42
|
+
* @since 1.0.0
|
|
43
|
+
*/
|
|
44
|
+
export interface Prepared {
|
|
45
|
+
/** Return bytes matching the captured base, never an unchecked current read. */
|
|
46
|
+
readonly read: (path: string) => Effect.Effect<Uint8Array, StdError.StdError>;
|
|
47
|
+
readonly commit: (changes: ReadonlyArray<Change>) => Effect.Effect<void, StdError.StdError>;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Read records only successful model-facing reads; mutation-internal reads never refresh a base.
|
|
51
|
+
*
|
|
52
|
+
* @category models
|
|
53
|
+
* @since 1.0.0
|
|
54
|
+
*/
|
|
55
|
+
export interface VersionedFileSystem extends FileSystem.FileSystem {
|
|
56
|
+
readonly [Preconditions]?: {
|
|
57
|
+
readonly record: (path: string, bytes: Uint8Array, session: string | undefined) => Effect.Effect<void, StdError.StdError>;
|
|
58
|
+
readonly validate: (paths: ReadonlyArray<string>, session: string | undefined) => Effect.Effect<void, StdError.StdError>;
|
|
59
|
+
/** Capture this invocation's bases from the existing ledger before tool-internal
|
|
60
|
+
* reads. The returned commit must compare them again inside the provider, then
|
|
61
|
+
* settle the entire batch before advancing the ledger. Concurrent reads or
|
|
62
|
+
* commits must never replace these captured bases. Preparation does not freeze
|
|
63
|
+
* callers; only the complete commit may acquire guest-wide exclusion.
|
|
64
|
+
*/
|
|
65
|
+
readonly prepare?: (paths: ReadonlyArray<string>, session: string | undefined) => Effect.Effect<Prepared, StdError.StdError>;
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Versioned hosts own parent creation and locking inside their atomic commit.
|
|
70
|
+
*
|
|
71
|
+
* @category guards
|
|
72
|
+
* @since 1.0.0
|
|
73
|
+
*/
|
|
74
|
+
export declare const isVersioned: (fs: FileSystem.FileSystem) => boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Record the entire original file, before pagination, through the host's existing policy.
|
|
77
|
+
*
|
|
78
|
+
* @category filesystem
|
|
79
|
+
* @since 1.0.0
|
|
80
|
+
*/
|
|
81
|
+
export declare const recordRead: (fs: FileSystem.FileSystem, path: string, bytes: Uint8Array) => Effect.Effect<void, StdError.StdError, never>;
|
|
82
|
+
/**
|
|
83
|
+
* Refuse an unqualified provider before creating any parent or lock directories.
|
|
84
|
+
*
|
|
85
|
+
* @category filesystem
|
|
86
|
+
* @since 1.0.0
|
|
87
|
+
*/
|
|
88
|
+
export declare const validate: (fs: FileSystem.FileSystem, paths: ReadonlyArray<string>) => Effect.Effect<undefined, StdError.StdError, never>;
|
|
89
|
+
/**
|
|
90
|
+
* The portable body is used only for an ordinary, unversioned filesystem.
|
|
91
|
+
*
|
|
92
|
+
* @category models
|
|
93
|
+
* @since 1.0.0
|
|
94
|
+
*/
|
|
95
|
+
export interface Mutation {
|
|
96
|
+
readonly read: (path: string, ordinary: Effect.Effect<Uint8Array, StdError.StdError>) => Effect.Effect<Uint8Array, StdError.StdError>;
|
|
97
|
+
readonly commit: (changes: ReadonlyArray<Change>, ordinary: Effect.Effect<void, StdError.StdError>) => Effect.Effect<void, StdError.StdError>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Versioned hosts capture bases under a local semaphore until scope exit.
|
|
101
|
+
* Ordinary hosts hold all named files using exclusive mkdir, so independently
|
|
102
|
+
* composed hosts and processes agree.
|
|
103
|
+
* A hash collision only refuses an unrelated edit; it cannot lose exclusion.
|
|
104
|
+
*
|
|
105
|
+
* @private
|
|
106
|
+
* @since 1.0.0
|
|
107
|
+
*/
|
|
108
|
+
export declare const acquire: (fileSystem: FileSystem.FileSystem, paths: ReadonlyArray<string>, creationPaths?: Path.Path) => Effect.Effect<Mutation, StdError.StdError, Scope.Scope>;
|
|
109
|
+
//# sourceMappingURL=FileMutation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FileMutation.d.ts","sourceRoot":"","sources":["../../../src/internal/FileMutation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AACzC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,UAAU,MAAM,mBAAmB,CAAA;AACpD,OAAO,KAAK,KAAK,IAAI,MAAM,aAAa,CAAA;AACxC,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAE1C,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAG1C;;;;;GAKG;AACH,eAAO,MAAM,WAAW,uCAEtB,CAAA;AAEF;;;;;GAKG;AACH,eAAO,MAAM,aAAa,eAA+C,CAAA;AAEzE;;;;;GAKG;AACH,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,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G;AACH,eAAO,MAAM,UAAU,GAAI,IAAI,UAAU,CAAC,UAAU,EAAE,MAAM,MAAM,EAAE,OAAO,UAAU,kDAIlF,CAAA;AAEH;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAI,IAAI,UAAU,CAAC,UAAU,EAAE,OAAO,aAAa,CAAC,MAAM,CAAC,uDAO5E,CAAA;AAEJ;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,CACb,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,KACnD,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;IACjD,QAAQ,CAAC,MAAM,EAAE,CACf,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,EAC9B,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,KAC7C,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAA;CAC5C;AAoBD;;;;;;;;GAQG;AACH,eAAO,MAAM,OAAO,GAClB,YAAY,UAAU,CAAC,UAAU,EACjC,OAAO,aAAa,CAAC,MAAM,CAAC,EAC5B,gBAAgB,IAAI,CAAC,IAAI,KACxB,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,KAAK,CAkDrD,CAAA"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var FileMutation_exports = {};
|
|
30
|
+
__export(FileMutation_exports, {
|
|
31
|
+
Preconditions: () => Preconditions,
|
|
32
|
+
ReadSession: () => ReadSession,
|
|
33
|
+
acquire: () => acquire,
|
|
34
|
+
isVersioned: () => isVersioned,
|
|
35
|
+
recordRead: () => recordRead,
|
|
36
|
+
validate: () => validate
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(FileMutation_exports);
|
|
39
|
+
var Context = __toESM(require("effect/Context"), 1);
|
|
40
|
+
var Effect = __toESM(require("effect/Effect"), 1);
|
|
41
|
+
var Semaphore = __toESM(require("effect/Semaphore"), 1);
|
|
42
|
+
var StdError = __toESM(require("../StdError.js"), 1);
|
|
43
|
+
var FsFailure = __toESM(require("./FsFailure.js"), 1);
|
|
44
|
+
const ReadSession = Context.Reference("@smthrs/std/ReadSession", {
|
|
45
|
+
defaultValue: () => void 0
|
|
46
|
+
});
|
|
47
|
+
const Preconditions = /* @__PURE__ */ Symbol.for("@smthrs/std/file-preconditions");
|
|
48
|
+
const unavailable = () => Effect.fail(
|
|
49
|
+
new StdError.StdError({
|
|
50
|
+
code: "provider_unavailable",
|
|
51
|
+
message: "Authenticated atomic file mutation provider unavailable"
|
|
52
|
+
})
|
|
53
|
+
);
|
|
54
|
+
const isVersioned = (fs) => fs[Preconditions] !== void 0;
|
|
55
|
+
const recordRead = (fs, path, bytes) => Effect.flatMap(
|
|
56
|
+
ReadSession,
|
|
57
|
+
(session) => fs[Preconditions]?.record(path, bytes, session) ?? Effect.void
|
|
58
|
+
);
|
|
59
|
+
const validate = (fs, paths) => Effect.gen(function* () {
|
|
60
|
+
const policy = fs[Preconditions];
|
|
61
|
+
if (policy === void 0) return;
|
|
62
|
+
const session = yield* ReadSession;
|
|
63
|
+
yield* policy.validate(paths, session);
|
|
64
|
+
if (policy.prepare === void 0) return yield* unavailable();
|
|
65
|
+
});
|
|
66
|
+
const hostLocks = /* @__PURE__ */ new WeakMap();
|
|
67
|
+
const lockHash = (value) => {
|
|
68
|
+
value = value.normalize("NFC").toUpperCase();
|
|
69
|
+
let hash = 5381;
|
|
70
|
+
for (let index = 0; index < value.length; index++) hash = hash * 33 ^ value.charCodeAt(index);
|
|
71
|
+
return (hash >>> 0).toString(16);
|
|
72
|
+
};
|
|
73
|
+
const parent = (path) => path.slice(0, path.lastIndexOf(path.startsWith("/") ? "/" : "\\") + 1);
|
|
74
|
+
const acquire = (fileSystem, paths, creationPaths) => Effect.gen(function* () {
|
|
75
|
+
yield* validate(fileSystem, paths);
|
|
76
|
+
const policy = fileSystem[Preconditions];
|
|
77
|
+
if (policy !== void 0) {
|
|
78
|
+
let lock = hostLocks.get(policy);
|
|
79
|
+
if (lock === void 0) {
|
|
80
|
+
lock = Semaphore.makeUnsafe(1);
|
|
81
|
+
hostLocks.set(policy, lock);
|
|
82
|
+
}
|
|
83
|
+
const held = lock;
|
|
84
|
+
yield* Effect.acquireRelease(held.take(1), () => held.release(1), { interruptible: true });
|
|
85
|
+
const session = yield* ReadSession;
|
|
86
|
+
const prepared = yield* policy.prepare(paths, session);
|
|
87
|
+
return { read: (path) => prepared.read(path), commit: (changes) => prepared.commit(changes) };
|
|
88
|
+
}
|
|
89
|
+
const locks = /* @__PURE__ */ new Map();
|
|
90
|
+
for (const path of paths) {
|
|
91
|
+
const destination = yield* fileSystem.realPath(path).pipe(
|
|
92
|
+
Effect.catch(
|
|
93
|
+
(error) => error.reason._tag === "NotFound" && creationPaths !== void 0 ? fileSystem.realPath(creationPaths.dirname(path)).pipe(
|
|
94
|
+
Effect.map((directory) => creationPaths.join(directory, creationPaths.basename(path)))
|
|
95
|
+
) : Effect.fail(error)
|
|
96
|
+
),
|
|
97
|
+
Effect.mapError(FsFailure.reading(path, `File not found: ${path}`))
|
|
98
|
+
);
|
|
99
|
+
const lock = `${parent(destination)}.smithers-${lockHash(destination)}.lock`;
|
|
100
|
+
locks.set(lock, path);
|
|
101
|
+
}
|
|
102
|
+
for (const [lock, path] of [...locks].sort(([left], [right]) => left.localeCompare(right))) {
|
|
103
|
+
yield* Effect.acquireRelease(
|
|
104
|
+
fileSystem.makeDirectory(lock, { mode: 448 }).pipe(
|
|
105
|
+
Effect.mapError(FsFailure.denied(path, (error) => new StdError.StdError({
|
|
106
|
+
code: error.reason._tag === "AlreadyExists" ? "no_match" : "command_failed",
|
|
107
|
+
message: error.reason._tag === "AlreadyExists" ? `Concurrent mutation of ${path}: lock ${lock} is held. Re-read and retry after the other writer finishes; a stopped writer's lock requires explicit recovery.` : `Could not lock ${path} for mutation`,
|
|
108
|
+
path
|
|
109
|
+
})))
|
|
110
|
+
),
|
|
111
|
+
() => fileSystem.remove(lock, { recursive: true }).pipe(Effect.orDie)
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
return { read: (_path, ordinary) => ordinary, commit: (_changes, ordinary) => ordinary };
|
|
115
|
+
});
|
|
116
|
+
//# sourceMappingURL=FileMutation.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/internal/FileMutation.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * Mutation preparation for versioned hosts and cooperative locks for ordinary hosts.\n * Ordinary locks fail closed after process death; they are never stolen on a timer.\n *\n * @since 1.0.0\n */\n\nimport * as Context from \"effect/Context\"\nimport * as Effect from \"effect/Effect\"\nimport type * as FileSystem from \"effect/FileSystem\"\nimport type * as Path from \"effect/Path\"\nimport type * as Scope from \"effect/Scope\"\nimport * as Semaphore from \"effect/Semaphore\"\nimport * as StdError from \"../StdError.ts\"\nimport * as FsFailure from \"./FsFailure.ts\"\n\n/**\n * Authenticated standard-flow call session; absent callers cannot borrow another run's base.\n *\n * @category context\n * @since 1.0.0\n */\nexport const ReadSession = Context.Reference<string | undefined>(\"@smthrs/std/ReadSession\", {\n defaultValue: () => undefined\n})\n\n/**\n * The coding host attaches one run-scoped precondition policy to its guarded filesystem.\n *\n * @category identifiers\n * @since 1.0.0\n */\nexport const Preconditions = Symbol.for(\"@smthrs/std/file-preconditions\")\n\n/**\n * One prepared file change; moves include a write and a guarded source removal.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Change {\n readonly path: string\n /** Null removes a file. Writes preserve existing metadata; new files use host defaults. */\n readonly content: Uint8Array | null\n}\n\n/**\n * A per-invocation provider receipt boundary, with immutable captured read bases.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Prepared {\n /** Return bytes matching the captured base, never an unchecked current read. */\n readonly read: (path: string) => Effect.Effect<Uint8Array, StdError.StdError>\n readonly commit: (changes: ReadonlyArray<Change>) => Effect.Effect<void, StdError.StdError>\n}\n\n/**\n * Read records only successful model-facing reads; mutation-internal reads never refresh a base.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface VersionedFileSystem extends FileSystem.FileSystem {\n readonly [Preconditions]?: {\n readonly record: (\n path: string,\n bytes: Uint8Array,\n session: string | undefined\n ) => Effect.Effect<void, StdError.StdError>\n readonly validate: (\n paths: ReadonlyArray<string>,\n session: string | undefined\n ) => Effect.Effect<void, StdError.StdError>\n /** Capture this invocation's bases from the existing ledger before tool-internal\n * reads. The returned commit must compare them again inside the provider, then\n * settle the entire batch before advancing the ledger. Concurrent reads or\n * commits must never replace these captured bases. Preparation does not freeze\n * callers; only the complete commit may acquire guest-wide exclusion.\n */\n readonly prepare?: (\n paths: ReadonlyArray<string>,\n session: string | undefined\n ) => Effect.Effect<Prepared, StdError.StdError>\n }\n}\n\nconst unavailable = () =>\n Effect.fail(\n new StdError.StdError({\n code: \"provider_unavailable\",\n message: \"Authenticated atomic file mutation provider unavailable\"\n })\n )\n\n/**\n * Versioned hosts own parent creation and locking inside their atomic commit.\n *\n * @category guards\n * @since 1.0.0\n */\nexport const isVersioned = (fs: FileSystem.FileSystem): boolean =>\n (fs as VersionedFileSystem)[Preconditions] !== undefined\n\n/**\n * Record the entire original file, before pagination, through the host's existing policy.\n *\n * @category filesystem\n * @since 1.0.0\n */\nexport const recordRead = (fs: FileSystem.FileSystem, path: string, bytes: Uint8Array) =>\n Effect.flatMap(\n ReadSession,\n (session) => (fs as VersionedFileSystem)[Preconditions]?.record(path, bytes, session) ?? Effect.void\n )\n\n/**\n * Refuse an unqualified provider before creating any parent or lock directories.\n *\n * @category filesystem\n * @since 1.0.0\n */\nexport const validate = (fs: FileSystem.FileSystem, paths: ReadonlyArray<string>) =>\n Effect.gen(function*() {\n const policy = (fs as VersionedFileSystem)[Preconditions]\n if (policy === undefined) return\n const session = yield* ReadSession\n yield* policy.validate(paths, session)\n if (policy.prepare === undefined) return yield* unavailable()\n })\n\n/**\n * The portable body is used only for an ordinary, unversioned filesystem.\n *\n * @category models\n * @since 1.0.0\n */\nexport interface Mutation {\n readonly read: (\n path: string,\n ordinary: Effect.Effect<Uint8Array, StdError.StdError>\n ) => Effect.Effect<Uint8Array, StdError.StdError>\n readonly commit: (\n changes: ReadonlyArray<Change>,\n ordinary: Effect.Effect<void, StdError.StdError>\n ) => Effect.Effect<void, StdError.StdError>\n}\n\n// This serializes one host's preparation, ledger and diagnostic ordering only.\n// It is NOT the guest's outside-writer exclusion or its atomic commit boundary.\nconst hostLocks = new WeakMap<object, Semaphore.Semaphore>()\n\n// The on-disk lock protocol owns this hash; dependency upgrades must not\n// change the name and let two versions acquire different locks for one file.\n// Case/normalization aliases deliberately share a lock, including on hosts\n// whose realPath preserves caller casing. Case-sensitive hosts may refuse a\n// simultaneous change to a distinct case variant; that is safe contention.\nconst lockHash = (value: string): string => {\n value = value.normalize(\"NFC\").toUpperCase()\n let hash = 5381\n for (let index = 0; index < value.length; index++) hash = (hash * 33) ^ value.charCodeAt(index)\n return (hash >>> 0).toString(16)\n}\n\nconst parent = (path: string) => path.slice(0, path.lastIndexOf(path.startsWith(\"/\") ? \"/\" : \"\\\\\") + 1)\n\n/**\n * Versioned hosts capture bases under a local semaphore until scope exit.\n * Ordinary hosts hold all named files using exclusive mkdir, so independently\n * composed hosts and processes agree.\n * A hash collision only refuses an unrelated edit; it cannot lose exclusion.\n *\n * @private\n * @since 1.0.0\n */\nexport const acquire = (\n fileSystem: FileSystem.FileSystem,\n paths: ReadonlyArray<string>,\n creationPaths?: Path.Path\n): Effect.Effect<Mutation, StdError.StdError, Scope.Scope> =>\n Effect.gen(function*() {\n // Unavailable coding providers refuse before acquiring even protocol state.\n // The versioned provider owns exclusion and revalidation at its commit;\n // cooperative caller-side locks cannot exclude terminal or SSH writers.\n yield* validate(fileSystem, paths)\n const policy = (fileSystem as VersionedFileSystem)[Preconditions]\n if (policy !== undefined) {\n let lock = hostLocks.get(policy)\n if (lock === undefined) {\n lock = Semaphore.makeUnsafe(1)\n hostLocks.set(policy, lock)\n }\n const held = lock\n yield* Effect.acquireRelease(held.take(1), () => held.release(1), { interruptible: true })\n const session = yield* ReadSession\n const prepared = yield* policy.prepare!(paths, session)\n return { read: (path) => prepared.read(path), commit: (changes) => prepared.commit(changes) }\n }\n const locks = new Map<string, string>()\n for (const path of paths) {\n const destination = yield* fileSystem.realPath(path).pipe(\n Effect.catch((error) =>\n error.reason._tag === \"NotFound\" && creationPaths !== undefined\n ? fileSystem.realPath(creationPaths.dirname(path)).pipe(\n Effect.map((directory) => creationPaths.join(directory, creationPaths.basename(path)))\n )\n : Effect.fail(error)\n ),\n Effect.mapError(FsFailure.reading(path, `File not found: ${path}`))\n )\n const lock = `${parent(destination)}.smithers-${lockHash(destination)}.lock`\n locks.set(lock, path)\n }\n for (const [lock, path] of [...locks].sort(([left], [right]) => left.localeCompare(right))) {\n yield* Effect.acquireRelease(\n fileSystem.makeDirectory(lock, { mode: 0o700 }).pipe(\n Effect.mapError(FsFailure.denied(path, (error) =>\n new StdError.StdError({\n code: error.reason._tag === \"AlreadyExists\" ? \"no_match\" : \"command_failed\",\n message: error.reason._tag === \"AlreadyExists\"\n ? `Concurrent mutation of ${path}: lock ${lock} is held. Re-read and retry after the other writer finishes; a stopped writer's lock requires explicit recovery.`\n : `Could not lock ${path} for mutation`,\n path\n })))\n ),\n () => fileSystem.remove(lock, { recursive: true }).pipe(Effect.orDie)\n )\n }\n return { read: (_path, ordinary) => ordinary, commit: (_changes, ordinary) => ordinary }\n })\n"],
|
|
5
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,cAAyB;AACzB,aAAwB;AAIxB,gBAA2B;AAC3B,eAA0B;AAC1B,gBAA2B;AAQpB,MAAM,cAAc,QAAQ,UAA8B,2BAA2B;AAAA,EAC1F,cAAc,MAAM;AACtB,CAAC;AAQM,MAAM,gBAAgB,uBAAO,IAAI,gCAAgC;AAwDxE,MAAM,cAAc,MAClB,OAAO;AAAA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