@smthrs/std 1.0.0-rc.7 → 1.0.0-rc.9
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 +14 -0
- package/README.md +40 -36
- package/dist/cjs/Checkpoints.d.ts +37 -0
- package/dist/cjs/Checkpoints.d.ts.map +1 -1
- package/dist/cjs/Checkpoints.js +75 -0
- package/dist/cjs/Checkpoints.js.map +2 -2
- package/dist/cjs/PortableSearch.d.ts +13 -1
- package/dist/cjs/PortableSearch.d.ts.map +1 -1
- package/dist/cjs/PortableSearch.js +8 -1
- package/dist/cjs/PortableSearch.js.map +2 -2
- package/dist/cjs/RemoteSearch.d.ts +54 -0
- package/dist/cjs/RemoteSearch.d.ts.map +1 -0
- package/dist/cjs/RemoteSearch.js +134 -0
- package/dist/cjs/RemoteSearch.js.map +7 -0
- package/dist/cjs/index.d.ts +2 -0
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +2 -0
- package/dist/cjs/index.js.map +2 -2
- package/dist/cjs/internal/EnvelopePrecheck.d.ts +2 -0
- package/dist/cjs/internal/EnvelopePrecheck.d.ts.map +1 -1
- package/dist/cjs/internal/EnvelopePrecheck.js +235 -36
- package/dist/cjs/internal/EnvelopePrecheck.js.map +3 -3
- package/dist/cjs/internal/Exec.d.ts +12 -7
- package/dist/cjs/internal/Exec.d.ts.map +1 -1
- package/dist/cjs/internal/Exec.js +8 -4
- package/dist/cjs/internal/Exec.js.map +2 -2
- package/dist/cjs/internal/RemoteTree.d.ts +60 -0
- package/dist/cjs/internal/RemoteTree.d.ts.map +1 -0
- package/dist/cjs/internal/RemoteTree.js +123 -0
- package/dist/cjs/internal/RemoteTree.js.map +7 -0
- package/dist/cjs/internal/Tar.d.ts +23 -0
- package/dist/cjs/internal/Tar.d.ts.map +1 -0
- package/dist/cjs/internal/Tar.js +86 -0
- package/dist/cjs/internal/Tar.js.map +7 -0
- package/dist/esm/Checkpoints.d.ts +37 -0
- package/dist/esm/Checkpoints.d.ts.map +1 -1
- package/dist/esm/Checkpoints.js +85 -0
- package/dist/esm/Checkpoints.js.map +1 -1
- package/dist/esm/PortableSearch.d.ts +13 -1
- package/dist/esm/PortableSearch.d.ts.map +1 -1
- package/dist/esm/PortableSearch.js +16 -0
- package/dist/esm/PortableSearch.js.map +1 -1
- package/dist/esm/RemoteSearch.d.ts +54 -0
- package/dist/esm/RemoteSearch.d.ts.map +1 -0
- package/dist/esm/RemoteSearch.js +162 -0
- package/dist/esm/RemoteSearch.js.map +1 -0
- package/dist/esm/index.d.ts +2 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal/EnvelopePrecheck.d.ts +2 -0
- package/dist/esm/internal/EnvelopePrecheck.d.ts.map +1 -1
- package/dist/esm/internal/EnvelopePrecheck.js +321 -62
- package/dist/esm/internal/EnvelopePrecheck.js.map +1 -1
- package/dist/esm/internal/Exec.d.ts +12 -7
- package/dist/esm/internal/Exec.d.ts.map +1 -1
- package/dist/esm/internal/Exec.js +30 -9
- package/dist/esm/internal/Exec.js.map +1 -1
- package/dist/esm/internal/RemoteTree.d.ts +60 -0
- package/dist/esm/internal/RemoteTree.d.ts.map +1 -0
- package/dist/esm/internal/RemoteTree.js +132 -0
- package/dist/esm/internal/RemoteTree.js.map +1 -0
- package/dist/esm/internal/Tar.d.ts +23 -0
- package/dist/esm/internal/Tar.d.ts.map +1 -0
- package/dist/esm/internal/Tar.js +97 -0
- package/dist/esm/internal/Tar.js.map +1 -0
- package/docs/README.md +3 -1
- package/docs/api.md +48 -21
- package/docs/concepts/effects-and-capabilities.md +3 -1
- package/docs/guides/bind-the-standard-flows.md +3 -1
- package/docs/guides/pin-a-checkpoint.md +20 -0
- package/docs/guides/run-a-shell-command.md +4 -1
- package/docs/installation.md +13 -9
- package/docs/quickstart.md +1 -1
- package/docs/troubleshooting.md +20 -0
- package/package.json +16 -6
- package/src/Checkpoints.ts +137 -0
- package/src/PortableSearch.ts +20 -0
- package/src/RemoteSearch.ts +199 -0
- package/src/index.ts +3 -0
- package/src/internal/EnvelopePrecheck.ts +320 -64
- package/src/internal/Exec.ts +32 -8
- package/src/internal/RemoteTree.ts +159 -0
- package/src/internal/Tar.ts +95 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteSearch.d.ts","sourceRoot":"","sources":["../../src/RemoteSearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,KAAK,KAAK,mBAAmB,MAAM,oCAAoC,CAAA;AAC9E,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAU,MAAM,QAAQ,CAAA;AASxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAGrC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,QAAQ,QAAoB,CAAA;AA+FzC;;;;;;;;GAQG;AACH,eAAO,MAAM,IAAI,GACf,UAAU,OAAO,CAAC,OAAO,CAAC,mBAAmB,CAAC,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,EAC9E,UAAU;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,KACnD,MAAM,CAAC,MAwCT,CAAA"}
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The search contract for a tree on another machine, in two round trips.
|
|
3
|
+
*
|
|
4
|
+
* `PortableSearch` asks `FileSystem` one question per directory, per entry
|
|
5
|
+
* and per file. On a machine reached through a transport, such as a
|
|
6
|
+
* benchmark's task container behind `docker exec`, every question is a
|
|
7
|
+
* process start, so one `grep` over a 6,000-file repository is some 20,000 of
|
|
8
|
+
* them. This peer asks the machine's own shell twice instead. `find` lists
|
|
9
|
+
* the tree under the root, leaving out the directories every walk skips, and
|
|
10
|
+
* `tar` returns its `.gitignore` files with the listing. The in-process peer
|
|
11
|
+
* then decides which files the search reads, a second `tar` returns exactly
|
|
12
|
+
* those, and `PortableSearch` answers over that copy. Every result, notice,
|
|
13
|
+
* and refusal is therefore the in-process peer's own: this module decides
|
|
14
|
+
* only where the bytes come from.
|
|
15
|
+
*
|
|
16
|
+
* It runs through the machine's own `ChildProcessSpawner`, the one
|
|
17
|
+
* `Sandbox.hostContext` serves beside the machine's `FileSystem`. The machine
|
|
18
|
+
* needs `sh`, `find`, `xargs`, `tar`, `head`, and `base64`; GNU, BusyBox, and
|
|
19
|
+
* BSD userlands all have them. Output crosses as base64, so a transport whose
|
|
20
|
+
* channel carries only text returns it intact. A search reads at most
|
|
21
|
+
* {@link maxBytes} of file content and refuses beyond that, naming the root
|
|
22
|
+
* to narrow.
|
|
23
|
+
*
|
|
24
|
+
* @since 1.0.0-rc.8
|
|
25
|
+
*/
|
|
26
|
+
import * as Path from "@smthrs/kernel/Path";
|
|
27
|
+
import { Context, Effect } from "effect";
|
|
28
|
+
import * as Base64 from "effect/encoding/Base64";
|
|
29
|
+
import * as FileSystem from "effect/FileSystem";
|
|
30
|
+
import * as Result from "effect/Result";
|
|
31
|
+
import * as Exec from "./internal/Exec.js";
|
|
32
|
+
import * as Prune from "./internal/Prune.js";
|
|
33
|
+
import * as RemoteTree from "./internal/RemoteTree.js";
|
|
34
|
+
import * as Tar from "./internal/Tar.js";
|
|
35
|
+
import * as PortableSearch from "./PortableSearch.js";
|
|
36
|
+
import * as Search from "./Search.js";
|
|
37
|
+
import * as StdError from "./StdError.js";
|
|
38
|
+
/**
|
|
39
|
+
* The most file content one search brings back from the machine.
|
|
40
|
+
*
|
|
41
|
+
* The copy is held in memory while the in-process peer reads it, so the
|
|
42
|
+
* bound is on this process's memory rather than on the search: a root that
|
|
43
|
+
* holds more is refused with `response_too_large` and a narrower root or
|
|
44
|
+
* globs answer it.
|
|
45
|
+
*
|
|
46
|
+
* @category constants
|
|
47
|
+
* @since 1.0.0-rc.8
|
|
48
|
+
*/
|
|
49
|
+
export const maxBytes = 256 * 1024 * 1024;
|
|
50
|
+
/** The most a listing, with its `.gitignore` files, may take. */
|
|
51
|
+
const maxListingBytes = 64 * 1024 * 1024;
|
|
52
|
+
const quoted = (value) => `'${value.replaceAll("'", `'\\''`)}'`;
|
|
53
|
+
const pruned = `\\( ${Prune.repositoryDirectories.map((name) => `-name ${quoted(name)}`).join(" -o ")} \\) -prune`;
|
|
54
|
+
/** The refusal for a machine without one of the tools a search runs. */
|
|
55
|
+
const missing = (tool) => `searching this machine needs ${tool}, which it does not have`;
|
|
56
|
+
const requireTools = `for t in find xargs tar head; do command -v "$t" >/dev/null || { ` +
|
|
57
|
+
`echo "${missing("$t")}" >&2; exit 3; }; done`;
|
|
58
|
+
/**
|
|
59
|
+
* `$1` is the root, `$2` the byte bound, and `$3` is `1` to send the
|
|
60
|
+
* `.gitignore` files after the listing. Records are NUL-terminated `<kind><path>`;
|
|
61
|
+
* an `E` record ends the listing, and a tar stream of the ignore files follows.
|
|
62
|
+
*/
|
|
63
|
+
const listing = [
|
|
64
|
+
"set -f",
|
|
65
|
+
requireTools,
|
|
66
|
+
"r=$1",
|
|
67
|
+
"{",
|
|
68
|
+
" if [ -d \"$r\" ]; then if [ -r \"$r\" ] && [ -x \"$r\" ]; then printf 'd%s\\0' \"$r\"; else printf 'u%s\\0' \"$r\"; fi",
|
|
69
|
+
" elif [ -f \"$r\" ]; then printf 'f%s\\0' \"$r\"",
|
|
70
|
+
" elif [ -e \"$r\" ]; then printf 'o%s\\0' \"$r\"",
|
|
71
|
+
" fi",
|
|
72
|
+
// No `-exec … {} +` inside parentheses: BusyBox `find` never runs one there.
|
|
73
|
+
` find -H "$r" -mindepth 1 ${pruned} -o -type d -exec printf 'd%s\\0' {} + ` +
|
|
74
|
+
`-o -type f -exec printf 'f%s\\0' {} + ` +
|
|
75
|
+
`-o -type l -exec sh -c 'for p do if [ -d "$p" ]; then k=D; elif [ -f "$p" ]; then k=F; else k=L; fi; ` +
|
|
76
|
+
`printf "%s%s\\0" "$k" "$p"; done' sh {} + -o -exec printf 'o%s\\0' {} + 2>/dev/null`,
|
|
77
|
+
" printf 'E\\0'",
|
|
78
|
+
` if [ "$3" = 1 ]; then find -H "$r" -mindepth 1 ${pruned} -o -type f -name .gitignore -print0 2>/dev/null | ` +
|
|
79
|
+
"(cd / && COPYFILE_DISABLE=1 xargs -0 -r tar -cf - -- 2>/dev/null); fi",
|
|
80
|
+
"} | head -c \"$2\" | base64"
|
|
81
|
+
].join("\n");
|
|
82
|
+
/** `$1` is the byte bound; standard input is the NUL-terminated absolute paths to send. */
|
|
83
|
+
const fetching = [
|
|
84
|
+
requireTools,
|
|
85
|
+
"cd / && COPYFILE_DISABLE=1 xargs -0 -r tar -chf - -- 2>/dev/null | head -c \"$1\" | base64"
|
|
86
|
+
].join("\n");
|
|
87
|
+
const failed = (root, reason) => new StdError.StdError({
|
|
88
|
+
code: "command_failed",
|
|
89
|
+
message: `Could not search ${root} on this machine: ${reason}`,
|
|
90
|
+
path: root
|
|
91
|
+
});
|
|
92
|
+
const tooLarge = (root, bound) => new StdError.StdError({
|
|
93
|
+
code: "response_too_large",
|
|
94
|
+
message: `The files under ${root} come to more than ${bound} bytes; narrow the root or the globs`,
|
|
95
|
+
path: root
|
|
96
|
+
});
|
|
97
|
+
/**
|
|
98
|
+
* Reads the program from the first line of standard input, as base64, and
|
|
99
|
+
* runs it with the arguments and the rest of standard input. A program in
|
|
100
|
+
* the argv would be quoted once by the spawner and again by the transport,
|
|
101
|
+
* and a sealed host refuses to start a command line past 4,096 characters;
|
|
102
|
+
* this line stays short whatever the program says.
|
|
103
|
+
*/
|
|
104
|
+
const bootstrap = `command -v base64 >/dev/null || { echo "${missing("base64")}" >&2; exit 3; }; ` +
|
|
105
|
+
"IFS= read -r p && p=$(printf %s \"$p\" | base64 -d) && exec sh -c \"$p\" sh \"$@\"";
|
|
106
|
+
/**
|
|
107
|
+
* Runs one script on the machine and decodes the base64 it prints, refusing
|
|
108
|
+
* output that reached `bound`: `head` cut it, so it is not the whole answer.
|
|
109
|
+
*/
|
|
110
|
+
const run = (root, script, args, bound, stdin = "") => Effect.gen(function* () {
|
|
111
|
+
const result = yield* Exec.exec("sh", {
|
|
112
|
+
args: ["-c", bootstrap, "sh", ...args],
|
|
113
|
+
stdin: `${Base64.encode(new TextEncoder().encode(script))}\n${stdin}`
|
|
114
|
+
}).pipe(Effect.mapError((error) => failed(root, error.message)));
|
|
115
|
+
if (result.exitCode !== 0) {
|
|
116
|
+
return yield* Effect.fail(failed(root, result.stderr.trim() || `exit ${result.exitCode}`));
|
|
117
|
+
}
|
|
118
|
+
const decoded = Base64.decode(result.stdout.replaceAll(/\s/g, ""));
|
|
119
|
+
if (Result.isFailure(decoded))
|
|
120
|
+
return yield* Effect.fail(failed(root, "the machine answered with invalid base64"));
|
|
121
|
+
if (decoded.success.length >= bound)
|
|
122
|
+
return yield* Effect.fail(tooLarge(root, bound - 1));
|
|
123
|
+
return decoded.success;
|
|
124
|
+
});
|
|
125
|
+
/**
|
|
126
|
+
* Builds the peer over a machine's spawner and its `Path`, which resolves a
|
|
127
|
+
* relative root where the machine's file operations do. `maxBytes` lowers
|
|
128
|
+
* the bound on the file content one search brings back; the default is
|
|
129
|
+
* {@link maxBytes}.
|
|
130
|
+
*
|
|
131
|
+
* @category constructors
|
|
132
|
+
* @since 1.0.0-rc.8
|
|
133
|
+
*/
|
|
134
|
+
export const make = (services, options) => {
|
|
135
|
+
const path = Context.get(services, Path.Path);
|
|
136
|
+
const contentBound = (options?.maxBytes ?? maxBytes) + 1;
|
|
137
|
+
const copy = (tree) => Context.make(FileSystem.FileSystem, RemoteTree.fileSystem(tree, path)).pipe(Context.add(Path.Path, path));
|
|
138
|
+
const listed = (root, noIgnore) => {
|
|
139
|
+
const resolved = path.resolve(root);
|
|
140
|
+
const bound = maxListingBytes + 1;
|
|
141
|
+
return Effect.flatMap(run(root, listing, [resolved, String(bound), noIgnore === true ? "0" : "1"], bound), (bytes) => {
|
|
142
|
+
const tree = RemoteTree.parse(bytes, resolved, path);
|
|
143
|
+
return tree === undefined ? Effect.fail(failed(root, "the listing came back malformed")) : Effect.succeed(tree);
|
|
144
|
+
});
|
|
145
|
+
};
|
|
146
|
+
return Search.make({
|
|
147
|
+
grep: (input) => Effect.gen(function* () {
|
|
148
|
+
const tree = yield* listed(input.root, input.noIgnore);
|
|
149
|
+
const read = yield* PortableSearch.searched(input).pipe(Effect.provide(copy(tree)));
|
|
150
|
+
const files = [...new Set(read.map((file) => path.resolve(file)))];
|
|
151
|
+
const bytes = files.length === 0 ? new Uint8Array() : yield* run(input.root, fetching, [String(contentBound)], contentBound, files.map((file) => `${file}\0`).join(""));
|
|
152
|
+
// `tar` ends every archive it writes, even one whose files it could not read.
|
|
153
|
+
const members = files.length === 0 || bytes.length > 0 ? Tar.files(bytes) : undefined;
|
|
154
|
+
if (members === undefined)
|
|
155
|
+
return yield* Effect.fail(failed(input.root, "the files came back malformed"));
|
|
156
|
+
const contents = new Map([...tree.contents, ...RemoteTree.absolute(members)]);
|
|
157
|
+
return yield* PortableSearch.make(copy({ ...tree, contents })).grep(input);
|
|
158
|
+
}).pipe(Effect.provide(services)),
|
|
159
|
+
glob: (input) => Effect.flatMap(listed(input.root, input.noIgnore), (tree) => PortableSearch.make(copy(tree)).glob(input)).pipe(Effect.provide(services))
|
|
160
|
+
});
|
|
161
|
+
};
|
|
162
|
+
//# sourceMappingURL=RemoteSearch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RemoteSearch.js","sourceRoot":"","sources":["../../src/RemoteSearch.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAGH,OAAO,KAAK,IAAI,MAAM,qBAAqB,CAAA;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACxC,OAAO,KAAK,MAAM,MAAM,wBAAwB,CAAA;AAChD,OAAO,KAAK,UAAU,MAAM,mBAA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A;QAC5E,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACnC,IAAI,EAAE,CAAC,KAAK,EAAE,EAAE,CACd,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAC5G,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CACzB;KACJ,CAAC,CAAA;AACJ,CAAC,CAAA","sourcesContent":["/**\n * The search contract for a tree on another machine, in two round trips.\n *\n * `PortableSearch` asks `FileSystem` one question per directory, per entry\n * and per file. On a machine reached through a transport, such as a\n * benchmark's task container behind `docker exec`, every question is a\n * process start, so one `grep` over a 6,000-file repository is some 20,000 of\n * them. This peer asks the machine's own shell twice instead. `find` lists\n * the tree under the root, leaving out the directories every walk skips, and\n * `tar` returns its `.gitignore` files with the listing. The in-process peer\n * then decides which files the search reads, a second `tar` returns exactly\n * those, and `PortableSearch` answers over that copy. Every result, notice,\n * and refusal is therefore the in-process peer's own: this module decides\n * only where the bytes come from.\n *\n * It runs through the machine's own `ChildProcessSpawner`, the one\n * `Sandbox.hostContext` serves beside the machine's `FileSystem`. The machine\n * needs `sh`, `find`, `xargs`, `tar`, `head`, and `base64`; GNU, BusyBox, and\n * BSD userlands all have them. Output crosses as base64, so a transport whose\n * channel carries only text returns it intact. A search reads at most\n * {@link maxBytes} of file content and refuses beyond that, naming the root\n * to narrow.\n *\n * @since 1.0.0-rc.8\n */\n\nimport type * as ChildProcessSpawner from \"@smthrs/kernel/ChildProcessSpawner\"\nimport * as Path from \"@smthrs/kernel/Path\"\nimport { Context, Effect } from \"effect\"\nimport * as Base64 from \"effect/encoding/Base64\"\nimport * as FileSystem from \"effect/FileSystem\"\nimport * as Result from \"effect/Result\"\nimport * as Exec from \"./internal/Exec.ts\"\nimport * as Prune from \"./internal/Prune.ts\"\nimport * as RemoteTree from \"./internal/RemoteTree.ts\"\nimport * as Tar from \"./internal/Tar.ts\"\nimport * as PortableSearch from \"./PortableSearch.ts\"\nimport * as Search from \"./Search.ts\"\nimport * as StdError from \"./StdError.ts\"\n\n/**\n * The most file content one search brings back from the machine.\n *\n * The copy is held in memory while the in-process peer reads it, so the\n * bound is on this process's memory rather than on the search: a root that\n * holds more is refused with `response_too_large` and a narrower root or\n * globs answer it.\n *\n * @category constants\n * @since 1.0.0-rc.8\n */\nexport const maxBytes = 256 * 1024 * 1024\n\n/** The most a listing, with its `.gitignore` files, may take. */\nconst maxListingBytes = 64 * 1024 * 1024\n\nconst quoted = (value: string): string => `'${value.replaceAll(\"'\", `'\\\\''`)}'`\n\nconst pruned = `\\\\( ${Prune.repositoryDirectories.map((name) => `-name ${quoted(name)}`).join(\" -o \")} \\\\) -prune`\n\n/** The refusal for a machine without one of the tools a search runs. */\nconst missing = (tool: string) => `searching this machine needs ${tool}, which it does not have`\n\nconst requireTools = `for t in find xargs tar head; do command -v \"$t\" >/dev/null || { ` +\n `echo \"${missing(\"$t\")}\" >&2; exit 3; }; done`\n\n/**\n * `$1` is the root, `$2` the byte bound, and `$3` is `1` to send the\n * `.gitignore` files after the listing. Records are NUL-terminated `<kind><path>`;\n * an `E` record ends the listing, and a tar stream of the ignore files follows.\n */\nconst listing = [\n \"set -f\",\n requireTools,\n \"r=$1\",\n \"{\",\n \" if [ -d \\\"$r\\\" ]; then if [ -r \\\"$r\\\" ] && [ -x \\\"$r\\\" ]; then printf 'd%s\\\\0' \\\"$r\\\"; else printf 'u%s\\\\0' \\\"$r\\\"; fi\",\n \" elif [ -f \\\"$r\\\" ]; then printf 'f%s\\\\0' \\\"$r\\\"\",\n \" elif [ -e \\\"$r\\\" ]; then printf 'o%s\\\\0' \\\"$r\\\"\",\n \" fi\",\n // No `-exec … {} +` inside parentheses: BusyBox `find` never runs one there.\n ` find -H \"$r\" -mindepth 1 ${pruned} -o -type d -exec printf 'd%s\\\\0' {} + ` +\n `-o -type f -exec printf 'f%s\\\\0' {} + ` +\n `-o -type l -exec sh -c 'for p do if [ -d \"$p\" ]; then k=D; elif [ -f \"$p\" ]; then k=F; else k=L; fi; ` +\n `printf \"%s%s\\\\0\" \"$k\" \"$p\"; done' sh {} + -o -exec printf 'o%s\\\\0' {} + 2>/dev/null`,\n \" printf 'E\\\\0'\",\n ` if [ \"$3\" = 1 ]; then find -H \"$r\" -mindepth 1 ${pruned} -o -type f -name .gitignore -print0 2>/dev/null | ` +\n \"(cd / && COPYFILE_DISABLE=1 xargs -0 -r tar -cf - -- 2>/dev/null); fi\",\n \"} | head -c \\\"$2\\\" | base64\"\n].join(\"\\n\")\n\n/** `$1` is the byte bound; standard input is the NUL-terminated absolute paths to send. */\nconst fetching = [\n requireTools,\n \"cd / && COPYFILE_DISABLE=1 xargs -0 -r tar -chf - -- 2>/dev/null | head -c \\\"$1\\\" | base64\"\n].join(\"\\n\")\n\nconst failed = (root: string, reason: string): StdError.StdError =>\n new StdError.StdError({\n code: \"command_failed\",\n message: `Could not search ${root} on this machine: ${reason}`,\n path: root\n })\n\nconst tooLarge = (root: string, bound: number): StdError.StdError =>\n new StdError.StdError({\n code: \"response_too_large\",\n message: `The files under ${root} come to more than ${bound} bytes; narrow the root or the globs`,\n path: root\n })\n\n/**\n * Reads the program from the first line of standard input, as base64, and\n * runs it with the arguments and the rest of standard input. A program in\n * the argv would be quoted once by the spawner and again by the transport,\n * and a sealed host refuses to start a command line past 4,096 characters;\n * this line stays short whatever the program says.\n */\nconst bootstrap = `command -v base64 >/dev/null || { echo \"${missing(\"base64\")}\" >&2; exit 3; }; ` +\n \"IFS= read -r p && p=$(printf %s \\\"$p\\\" | base64 -d) && exec sh -c \\\"$p\\\" sh \\\"$@\\\"\"\n\n/**\n * Runs one script on the machine and decodes the base64 it prints, refusing\n * output that reached `bound`: `head` cut it, so it is not the whole answer.\n */\nconst run = (\n root: string,\n script: string,\n args: ReadonlyArray<string>,\n bound: number,\n stdin = \"\"\n): Effect.Effect<Uint8Array, StdError.StdError, ChildProcessSpawner.ChildProcessSpawner> =>\n Effect.gen(function*() {\n const result = yield* Exec.exec(\"sh\", {\n args: [\"-c\", bootstrap, \"sh\", ...args],\n stdin: `${Base64.encode(new TextEncoder().encode(script))}\\n${stdin}`\n }).pipe(Effect.mapError((error) => failed(root, error.message)))\n if (result.exitCode !== 0) {\n return yield* Effect.fail(failed(root, result.stderr.trim() || `exit ${result.exitCode}`))\n }\n const decoded = Base64.decode(result.stdout.replaceAll(/\\s/g, \"\"))\n if (Result.isFailure(decoded)) return yield* Effect.fail(failed(root, \"the machine answered with invalid base64\"))\n if (decoded.success.length >= bound) return yield* Effect.fail(tooLarge(root, bound - 1))\n return decoded.success\n })\n\n/**\n * Builds the peer over a machine's spawner and its `Path`, which resolves a\n * relative root where the machine's file operations do. `maxBytes` lowers\n * the bound on the file content one search brings back; the default is\n * {@link maxBytes}.\n *\n * @category constructors\n * @since 1.0.0-rc.8\n */\nexport const make = (\n services: Context.Context<ChildProcessSpawner.ChildProcessSpawner | Path.Path>,\n options?: { readonly maxBytes?: number | undefined }\n): Search.Search => {\n const path = Context.get(services, Path.Path)\n const contentBound = (options?.maxBytes ?? maxBytes) + 1\n const copy = (tree: RemoteTree.Tree) =>\n Context.make(FileSystem.FileSystem, RemoteTree.fileSystem(tree, path)).pipe(Context.add(Path.Path, path))\n const listed = (root: string, noIgnore: boolean | undefined) => {\n const resolved = path.resolve(root)\n const bound = maxListingBytes + 1\n return Effect.flatMap(\n run(root, listing, [resolved, String(bound), noIgnore === true ? \"0\" : \"1\"], bound),\n (bytes) => {\n const tree = RemoteTree.parse(bytes, resolved, path)\n return tree === undefined ? Effect.fail(failed(root, \"the listing came back malformed\")) : Effect.succeed(tree)\n }\n )\n }\n return Search.make({\n grep: (input) =>\n Effect.gen(function*() {\n const tree = yield* listed(input.root, input.noIgnore)\n const read = yield* PortableSearch.searched(input).pipe(Effect.provide(copy(tree)))\n const files = [...new Set(read.map((file) => path.resolve(file)))]\n const bytes = files.length === 0 ? new Uint8Array() : yield* run(\n input.root,\n fetching,\n [String(contentBound)],\n contentBound,\n files.map((file) => `${file}\\0`).join(\"\")\n )\n // `tar` ends every archive it writes, even one whose files it could not read.\n const members = files.length === 0 || bytes.length > 0 ? Tar.files(bytes) : undefined\n if (members === undefined) return yield* Effect.fail(failed(input.root, \"the files came back malformed\"))\n const contents = new Map([...tree.contents, ...RemoteTree.absolute(members)])\n return yield* PortableSearch.make(copy({ ...tree, contents })).grep(input)\n }).pipe(Effect.provide(services)),\n glob: (input) =>\n Effect.flatMap(listed(input.root, input.noIgnore), (tree) => PortableSearch.make(copy(tree)).glob(input)).pipe(\n Effect.provide(services)\n )\n })\n}\n"]}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -44,6 +44,8 @@ export * as SearchConformance from "./SearchConformance.ts";
|
|
|
44
44
|
export * as PortableSearch from "./PortableSearch.ts";
|
|
45
45
|
/** @category layers @since 1.0.0 */
|
|
46
46
|
export * as NativeSearch from "./NativeSearch.ts";
|
|
47
|
+
/** @category layers @since 1.0.0-rc.8 */
|
|
48
|
+
export * as RemoteSearch from "./RemoteSearch.ts";
|
|
47
49
|
/**
|
|
48
50
|
* @category flows
|
|
49
51
|
* @since 1.0.0
|
package/dist/esm/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,C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AAQ,MAAM,eAAe,CAAA;AAEzC;;;GAGG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA"}
|
package/dist/esm/index.js
CHANGED
|
@@ -44,6 +44,8 @@ export * as SearchConformance from "./SearchConformance.js";
|
|
|
44
44
|
export * as PortableSearch from "./PortableSearch.js";
|
|
45
45
|
/** @category layers @since 1.0.0 */
|
|
46
46
|
export * as NativeSearch from "./NativeSearch.js";
|
|
47
|
+
/** @category layers @since 1.0.0-rc.8 */
|
|
48
|
+
export * as RemoteSearch from "./RemoteSearch.js";
|
|
47
49
|
/**
|
|
48
50
|
* @category flows
|
|
49
51
|
* @since 1.0.0
|
package/dist/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,sCAAsC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;AAErC,sCAAsC;AACtC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD,yCAAyC;AACzC,OAAO,KAAK,iBAAiB,MAAM,wBAAwB,CAAA;AAE3D,oCAAoC;AACpC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AAErD,oCAAoC;AACpC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AAEjD;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;A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cesContent":["/**\n * `@smthrs/std`: the standard coding tools expressed as flows, the host\n * services they bind, and the one error they share.\n *\n * @since 1.0.0\n */\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Read from \"./Read.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Write from \"./Write.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Edit from \"./Edit.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Ls from \"./Ls.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Glob from \"./Glob.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Grep from \"./Grep.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as Search from \"./Search.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as SearchContract from \"./SearchContract.ts\"\n\n/** @category conformance @since 1.0.0 */\nexport * as SearchConformance from \"./SearchConformance.ts\"\n\n/** @category layers @since 1.0.0 */\nexport * as PortableSearch from \"./PortableSearch.ts\"\n\n/** @category layers @since 1.0.0 */\nexport * as NativeSearch from \"./NativeSearch.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Bash from \"./Bash.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as Container from \"./Container.ts\"\n\n/**\n * @category measurement\n * @since 1.0.0\n */\nexport * as TreeFingerprint from \"./TreeFingerprint.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as Checkpoints from \"./Checkpoints.ts\"\n\n/** @category conversions @since 1.0.0 */\nexport * as Relocate from \"./Relocate.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as TestRun from \"./TestRun.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as TestRunner from \"./TestRunner.ts\"\n\n/**\n * @category classification\n * @since 1.0.0\n */\nexport * as Probe from \"./Probe.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as ApplyPatch from \"./ApplyPatch.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as ShellCommand from \"./ShellCommand.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as UpdatePlan from \"./UpdatePlan.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Fetch from \"./Fetch.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as HttpPost from \"./HttpPost.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Explore from \"./Explore.ts\"\n\n/** @category flows @since 1.0.0 */\nexport * as WebFetch from \"./WebFetch.ts\"\n/** @category flows @since 1.0.0 */\nexport * as WebSearch from \"./WebSearch.ts\"\n/** @category services @since 1.0.0 */\nexport * as ExaWebSearch from \"./ExaWebSearch.ts\"\n/** @category services @since 1.0.0 */\nexport * as LanguageServer from \"./LanguageServer.ts\"\n/** @category layers @since 1.0.0 */\nexport * as NodeLanguageServer from \"./NodeLanguageServer.ts\"\n/** @category flows @since 1.0.0 */\nexport * as Lsp from \"./Lsp.ts\"\n\n/**\n * @category registries\n * @since 1.0.0\n */\nexport * as Manifest from \"./Manifest.ts\"\n\n/**\n * @category errors\n * @since 1.0.0\n */\nexport * as StdError from \"./StdError.ts\"\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,KAAK,MAAM,YAAY,CAAA;AAEnC;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC;;;GAGG;AACH,OAAO,KAAK,IAAI,MAAM,WAAW,CAAA;AAEjC,sCAAsC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAA;A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AAC3C,sCAAsC;AACtC,OAAO,KAAK,YAAY,MAAM,mBAAmB,CAAA;AACjD,sCAAsC;AACtC,OAAO,KAAK,cAAc,MAAM,qBAAqB,CAAA;AACrD,oCAAoC;AACpC,OAAO,KAAK,kBAAkB,MAAM,yBAAyB,CAAA;AAC7D,mCAAmC;AACnC,OAAO,KAAK,GAAG,MAAM,UAAU,CAAA;AAE/B;;;GAGG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA;AAEzC;;;GAGG;AACH,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAA","sourcesContent":["/**\n * `@smthrs/std`: the standard coding tools expressed as flows, the host\n * services they bind, and the one error they share.\n *\n * @since 1.0.0\n */\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Read from \"./Read.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Write from \"./Write.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Edit from \"./Edit.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Ls from \"./Ls.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Glob from \"./Glob.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Grep from \"./Grep.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as Search from \"./Search.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as SearchContract from \"./SearchContract.ts\"\n\n/** @category conformance @since 1.0.0 */\nexport * as SearchConformance from \"./SearchConformance.ts\"\n\n/** @category layers @since 1.0.0 */\nexport * as PortableSearch from \"./PortableSearch.ts\"\n\n/** @category layers @since 1.0.0 */\nexport * as NativeSearch from \"./NativeSearch.ts\"\n\n/** @category layers @since 1.0.0-rc.8 */\nexport * as RemoteSearch from \"./RemoteSearch.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Bash from \"./Bash.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as Container from \"./Container.ts\"\n\n/**\n * @category measurement\n * @since 1.0.0\n */\nexport * as TreeFingerprint from \"./TreeFingerprint.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as Checkpoints from \"./Checkpoints.ts\"\n\n/** @category conversions @since 1.0.0 */\nexport * as Relocate from \"./Relocate.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as TestRun from \"./TestRun.ts\"\n\n/** @category services @since 1.0.0 */\nexport * as TestRunner from \"./TestRunner.ts\"\n\n/**\n * @category classification\n * @since 1.0.0\n */\nexport * as Probe from \"./Probe.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as ApplyPatch from \"./ApplyPatch.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as ShellCommand from \"./ShellCommand.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as UpdatePlan from \"./UpdatePlan.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Fetch from \"./Fetch.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as HttpPost from \"./HttpPost.ts\"\n\n/**\n * @category flows\n * @since 1.0.0\n */\nexport * as Explore from \"./Explore.ts\"\n\n/** @category flows @since 1.0.0 */\nexport * as WebFetch from \"./WebFetch.ts\"\n/** @category flows @since 1.0.0 */\nexport * as WebSearch from \"./WebSearch.ts\"\n/** @category services @since 1.0.0 */\nexport * as ExaWebSearch from \"./ExaWebSearch.ts\"\n/** @category services @since 1.0.0 */\nexport * as LanguageServer from \"./LanguageServer.ts\"\n/** @category layers @since 1.0.0 */\nexport * as NodeLanguageServer from \"./NodeLanguageServer.ts\"\n/** @category flows @since 1.0.0 */\nexport * as Lsp from \"./Lsp.ts\"\n\n/**\n * @category registries\n * @since 1.0.0\n */\nexport * as Manifest from \"./Manifest.ts\"\n\n/**\n * @category errors\n * @since 1.0.0\n */\nexport * as StdError from \"./StdError.ts\"\n"]}
|
|
@@ -52,6 +52,8 @@ export interface PathReference {
|
|
|
52
52
|
/**
|
|
53
53
|
* Every path token the shell text names, one segment at a time.
|
|
54
54
|
*
|
|
55
|
+
* @throws {StdError.StdError} `invalid_input` when substitutions or quotes nest
|
|
56
|
+
* deeper than the scan reads.
|
|
55
57
|
* @category pre-check
|
|
56
58
|
* @since 1.0.0
|
|
57
59
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnvelopePrecheck.d.ts","sourceRoot":"","sources":["../../../src/internal/EnvelopePrecheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAG1C;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;IACrC,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC,MAAM,CAAC,CAAA;CACvC;AAED;;;;;GAKG;AACH,MAAM,MAAM,MAAM,GAAG,MAAM,GAAG,OAAO,CAAA;AAErC;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;
|
|
1
|
+
{"version":3,"file":"EnvelopePrecheck.d.ts","sourceRoot":"","sources":["../../../src/internal/EnvelopePrecheck.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,KAAK,KAAK,IAAI,MAAM,qBAAqB,CAAA;AAChD,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAG1C;;;;;;;;;GASG;AACH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IACjC,QAAQ,CAAC,KAAK,EAAE,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