@ai-hero/sandcastle 0.13.0 → 0.14.1
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/README.md +3 -3
- package/dist/{SandboxProvider-YCL97qco.d.ts → SandboxProvider-CwRLxIXZ.d.ts} +5 -41
- package/dist/{chunk-XCYK7I45.js → chunk-4BB7DNPW.js} +3 -3
- package/dist/chunk-4BB7DNPW.js.map +1 -0
- package/dist/chunk-4GZMUHVO.js +60 -0
- package/dist/chunk-4GZMUHVO.js.map +1 -0
- package/dist/{chunk-A4C2FG74.js → chunk-7JUTKCHL.js} +43 -42
- package/dist/chunk-7JUTKCHL.js.map +1 -0
- package/dist/chunk-7PHPLDVS.js +284 -0
- package/dist/chunk-7PHPLDVS.js.map +1 -0
- package/dist/{chunk-NMQ5Z6YG.js → chunk-BXLS4HRY.js} +15 -4
- package/dist/chunk-BXLS4HRY.js.map +1 -0
- package/dist/chunk-EM4QNWKF.js +3161 -0
- package/dist/chunk-EM4QNWKF.js.map +1 -0
- package/dist/chunk-EXYXBRCX.js +60 -0
- package/dist/chunk-EXYXBRCX.js.map +1 -0
- package/dist/{chunk-LWNC4UTZ.js → chunk-JEQ4IVQM.js} +1520 -5375
- package/dist/chunk-JEQ4IVQM.js.map +1 -0
- package/dist/{chunk-XCWKLDH4.js → chunk-L3BU47F6.js} +3 -3
- package/dist/{chunk-XCWKLDH4.js.map → chunk-L3BU47F6.js.map} +1 -1
- package/dist/{chunk-7N7AMUYA.js → chunk-PTJEKJPQ.js} +7 -5
- package/dist/chunk-PTJEKJPQ.js.map +1 -0
- package/dist/chunk-SAQXFLO2.js +1268 -0
- package/dist/chunk-SAQXFLO2.js.map +1 -0
- package/dist/{chunk-767EAJVT.js → chunk-TBVRAXYF.js} +3 -3
- package/dist/{chunk-767EAJVT.js.map → chunk-TBVRAXYF.js.map} +1 -1
- package/dist/{chunk-J5J5YJ5S.js → chunk-VUOXFCWO.js} +3 -3
- package/dist/{chunk-J5J5YJ5S.js.map → chunk-VUOXFCWO.js.map} +1 -1
- package/dist/{chunk-U42XXICG.js → chunk-WYOGXC72.js} +47 -82
- package/dist/chunk-WYOGXC72.js.map +1 -0
- package/dist/chunk-YDQW5IOY.js +799 -0
- package/dist/chunk-YDQW5IOY.js.map +1 -0
- package/dist/index.d.ts +51 -4
- package/dist/index.js +892 -2018
- package/dist/index.js.map +1 -1
- package/dist/main.js +322 -251
- package/dist/main.js.map +1 -1
- package/dist/sandboxes/bwrap.d.ts +1 -1
- package/dist/sandboxes/bwrap.js +9 -14
- package/dist/sandboxes/bwrap.js.map +1 -1
- package/dist/sandboxes/daytona.d.ts +1 -1
- package/dist/sandboxes/daytona.js +183 -136
- package/dist/sandboxes/daytona.js.map +1 -1
- package/dist/sandboxes/docker.d.ts +23 -1
- package/dist/sandboxes/docker.js +7 -3
- package/dist/sandboxes/e2b.d.ts +41 -0
- package/dist/sandboxes/e2b.js +202 -0
- package/dist/sandboxes/e2b.js.map +1 -0
- package/dist/sandboxes/modal.d.ts +78 -0
- package/dist/sandboxes/modal.js +171 -0
- package/dist/sandboxes/modal.js.map +1 -0
- package/dist/sandboxes/no-sandbox.d.ts +1 -1
- package/dist/sandboxes/no-sandbox.js +1 -1
- package/dist/sandboxes/podman.d.ts +27 -4
- package/dist/sandboxes/podman.js +19 -43
- package/dist/sandboxes/podman.js.map +1 -1
- package/dist/sandboxes/seatbelt.d.ts +2 -2
- package/dist/sandboxes/seatbelt.js +10 -7
- package/dist/sandboxes/seatbelt.js.map +1 -1
- package/dist/sandboxes/sprites.d.ts +54 -0
- package/dist/sandboxes/sprites.js +219 -0
- package/dist/sandboxes/sprites.js.map +1 -0
- package/dist/sandboxes/vercel.d.ts +10 -1
- package/dist/sandboxes/vercel.js +74 -46
- package/dist/sandboxes/vercel.js.map +1 -1
- package/dist/templates/parallel-planner/main.mts +43 -21
- package/dist/templates/parallel-planner-with-review/main.mts +55 -27
- package/dist/templates/sequential-reviewer/main.mts +1 -1
- package/package.json +36 -4
- package/dist/chunk-4EIVTSOZ.js +0 -93
- package/dist/chunk-4EIVTSOZ.js.map +0 -1
- package/dist/chunk-7N7AMUYA.js.map +0 -1
- package/dist/chunk-A4C2FG74.js.map +0 -1
- package/dist/chunk-LWNC4UTZ.js.map +0 -1
- package/dist/chunk-NMQ5Z6YG.js.map +0 -1
- package/dist/chunk-U42XXICG.js.map +0 -1
- package/dist/chunk-XCYK7I45.js.map +0 -1
package/README.md
CHANGED
|
@@ -14,11 +14,11 @@ A TypeScript library for orchestrating AI coding agents in isolated sandboxes:
|
|
|
14
14
|
2. Sandcastle handles sandboxing the agent with a configurable branch strategy.
|
|
15
15
|
3. The commits made on the branches get merged back.
|
|
16
16
|
|
|
17
|
-
Sandcastle is provider-agnostic. It ships with native sandboxes that use your OS's own process sandbox (Bubblewrap on Linux and WSL2, Seatbelt on macOS), image-based providers for Docker and Podman, and cloud providers for
|
|
17
|
+
Sandcastle is provider-agnostic. It ships with native sandboxes that use your OS's own process sandbox (Bubblewrap on Linux and WSL2, Seatbelt on macOS), image-based providers for Docker and Podman, and cloud providers for Daytona, E2B, Fly.io Sprites, Modal and Vercel, and you can create your own. Great for parallelizing multiple AFK agents, creating review pipelines, or even just orchestrating your own agents.
|
|
18
18
|
|
|
19
19
|
## Documentation
|
|
20
20
|
|
|
21
|
-
The docs live in [`docs/guide`](./docs/guide), one page per
|
|
21
|
+
The docs live in [`docs/guide`](./docs/guide), one page per major term, with every term defined in the [Glossary](./docs/guide/glossary.md), and are published at [aihero.dev/sandcastle](https://www.aihero.dev/sandcastle).
|
|
22
22
|
|
|
23
23
|
- [Getting started](./docs/guide/getting-started.md): prerequisites and a quick start
|
|
24
24
|
- Core: [Core concepts](./docs/guide/core-concepts.md)
|
|
@@ -30,7 +30,7 @@ The docs live in [`docs/guide`](./docs/guide), one page per glossary term (see [
|
|
|
30
30
|
- Hooks: [Hooks](./docs/guide/hooks.md)
|
|
31
31
|
- Init: [Init](./docs/guide/init.md)
|
|
32
32
|
- Display: [Run logs](./docs/guide/run-logs.md)
|
|
33
|
-
- Reference: [`run()` and `createSandbox()`](./docs/guide/run.md), [CLI commands](./docs/guide/cli.md)
|
|
33
|
+
- Reference: [`run()` and `createSandbox()`](./docs/guide/run.md), [CLI commands](./docs/guide/cli.md), [Glossary](./docs/guide/glossary.md)
|
|
34
34
|
|
|
35
35
|
## Development
|
|
36
36
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Provider authors implement a small Promise-based interface. Sandcastle
|
|
5
5
|
* handles worktree creation, git mount resolution, and commit extraction.
|
|
6
6
|
*/
|
|
7
|
+
|
|
7
8
|
/** Result of executing a command inside a sandbox. */
|
|
8
9
|
interface ExecResult {
|
|
9
10
|
readonly stdout: string;
|
|
@@ -111,8 +112,9 @@ interface IsolatedSandboxHandle {
|
|
|
111
112
|
readonly worktreePath: string;
|
|
112
113
|
/**
|
|
113
114
|
* The vendor's id for the sandbox, so a supervisor outside this process can
|
|
114
|
-
* address it with the vendor's own CLI or API, e.g. `vercel()
|
|
115
|
-
* `daytona()` set it to the Vercel and
|
|
115
|
+
* address it with the vendor's own CLI or API, e.g. `vercel()`,
|
|
116
|
+
* `daytona()` and `modal()` set it to the Vercel, Daytona and Modal sandbox
|
|
117
|
+
* ids. Surfaced as
|
|
116
118
|
* `Sandbox.sandboxId`. Omit it when the provider has no such id.
|
|
117
119
|
*/
|
|
118
120
|
readonly sandboxId?: string;
|
|
@@ -219,34 +221,6 @@ interface NoSandboxProvider {
|
|
|
219
221
|
/** Environment variables injected by this provider. */
|
|
220
222
|
readonly env: Record<string, string>;
|
|
221
223
|
}
|
|
222
|
-
/** Head strategy: agent writes directly to host working directory. Bind-mount only. */
|
|
223
|
-
interface HeadBranchStrategy {
|
|
224
|
-
readonly type: "head";
|
|
225
|
-
}
|
|
226
|
-
/** Merge-to-head strategy: temp branch, merge back to HEAD, delete temp branch. */
|
|
227
|
-
interface MergeToHeadBranchStrategy {
|
|
228
|
-
readonly type: "merge-to-head";
|
|
229
|
-
}
|
|
230
|
-
/** Branch strategy: commits land on an explicit named branch. */
|
|
231
|
-
interface NamedBranchStrategy {
|
|
232
|
-
readonly type: "branch";
|
|
233
|
-
readonly branch: string;
|
|
234
|
-
/**
|
|
235
|
-
* Git ref to use as the starting point when creating a new branch.
|
|
236
|
-
* Only used when the branch doesn't already exist — ignored otherwise.
|
|
237
|
-
* Callers are responsible for ensuring the ref is current (e.g. `git fetch`).
|
|
238
|
-
* Defaults to `HEAD` when omitted.
|
|
239
|
-
*/
|
|
240
|
-
readonly baseBranch?: string;
|
|
241
|
-
}
|
|
242
|
-
/** Branch strategy for bind-mount providers (all three variants). */
|
|
243
|
-
type BindMountBranchStrategy = HeadBranchStrategy | MergeToHeadBranchStrategy | NamedBranchStrategy;
|
|
244
|
-
/** Branch strategy for isolated providers (no head — can't write to host). */
|
|
245
|
-
type IsolatedBranchStrategy = MergeToHeadBranchStrategy | NamedBranchStrategy;
|
|
246
|
-
/** Branch strategy for no-sandbox providers (all three — same as bind-mount). */
|
|
247
|
-
type NoSandboxBranchStrategy = HeadBranchStrategy | MergeToHeadBranchStrategy | NamedBranchStrategy;
|
|
248
|
-
/** Union of all branch strategy variants. */
|
|
249
|
-
type BranchStrategy = BindMountBranchStrategy | IsolatedBranchStrategy | NoSandboxBranchStrategy;
|
|
250
224
|
/**
|
|
251
225
|
* A sandbox provider — the pluggable unit that `run()`, `interactive()`, and
|
|
252
226
|
* `createSandbox()` accept. Tagged for internal dispatch: "bind-mount",
|
|
@@ -256,15 +230,5 @@ type BranchStrategy = BindMountBranchStrategy | IsolatedBranchStrategy | NoSandb
|
|
|
256
230
|
type SandboxProvider = BindMountSandboxProvider | IsolatedSandboxProvider | NoSandboxProvider;
|
|
257
231
|
/** @deprecated Use `SandboxProvider` — it now includes `NoSandboxProvider`. */
|
|
258
232
|
type AnySandboxProvider = SandboxProvider;
|
|
259
|
-
/**
|
|
260
|
-
* Create a bind-mount sandbox provider from a config object.
|
|
261
|
-
* The returned provider can be passed to `run()` or `createSandbox()`.
|
|
262
|
-
*/
|
|
263
|
-
declare const createBindMountSandboxProvider: (config: BindMountSandboxProviderConfig) => BindMountSandboxProvider;
|
|
264
|
-
/**
|
|
265
|
-
* Create an isolated sandbox provider from a config object.
|
|
266
|
-
* The returned provider can be passed to `run()` or `createSandbox()`.
|
|
267
|
-
*/
|
|
268
|
-
declare const createIsolatedSandboxProvider: (config: IsolatedSandboxProviderConfig) => IsolatedSandboxProvider;
|
|
269
233
|
|
|
270
|
-
export {
|
|
234
|
+
export type { AnySandboxProvider as A, BindMountSandboxProvider as B, ExecResult as E, IsolatedSandboxProvider as I, NoSandboxProvider as N, SandboxProvider as S, BindMountSandboxProviderConfig as a, IsolatedSandboxProviderConfig as b, BindMountSandboxHandle as c, BindMountCreateOptions as d, InteractiveExecOptions as e, IsolatedCreateOptions as f, IsolatedSandboxHandle as g, NoSandboxHandle as h };
|
|
@@ -2,7 +2,7 @@ import { createRequire } from 'node:module';
|
|
|
2
2
|
|
|
3
3
|
createRequire(import.meta.url);
|
|
4
4
|
|
|
5
|
-
// src/
|
|
5
|
+
// src/createSandboxProvider.ts
|
|
6
6
|
var createBindMountSandboxProvider = (config) => ({
|
|
7
7
|
tag: "bind-mount",
|
|
8
8
|
name: config.name,
|
|
@@ -18,5 +18,5 @@ var createIsolatedSandboxProvider = (config) => ({
|
|
|
18
18
|
});
|
|
19
19
|
|
|
20
20
|
export { createBindMountSandboxProvider, createIsolatedSandboxProvider };
|
|
21
|
-
//# sourceMappingURL=chunk-
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
21
|
+
//# sourceMappingURL=chunk-4BB7DNPW.js.map
|
|
22
|
+
//# sourceMappingURL=chunk-4BB7DNPW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/createSandboxProvider.ts"],"names":[],"mappings":";;;;;AAWO,IAAM,8BAAA,GAAiC,CAC5C,MAAA,MAC8B;AAAA,EAC9B,GAAA,EAAK,YAAA;AAAA,EACL,MAAM,MAAA,CAAO,IAAA;AAAA,EACb,GAAA,EAAK,MAAA,CAAO,GAAA,IAAO,EAAC;AAAA,EACpB,gBAAgB,MAAA,CAAO,cAAA;AAAA,EACvB,QAAQ,MAAA,CAAO;AACjB,CAAA;AAMO,IAAM,6BAAA,GAAgC,CAC3C,MAAA,MAC6B;AAAA,EAC7B,GAAA,EAAK,UAAA;AAAA,EACL,MAAM,MAAA,CAAO,IAAA;AAAA,EACb,GAAA,EAAK,MAAA,CAAO,GAAA,IAAO,EAAC;AAAA,EACpB,QAAQ,MAAA,CAAO;AACjB,CAAA","file":"chunk-4BB7DNPW.js","sourcesContent":["import type {\n BindMountSandboxProvider,\n BindMountSandboxProviderConfig,\n IsolatedSandboxProvider,\n IsolatedSandboxProviderConfig,\n} from \"./SandboxProvider.js\";\n\n/**\n * Create a bind-mount sandbox provider from a config object.\n * The returned provider can be passed to `run()` or `createSandbox()`.\n */\nexport const createBindMountSandboxProvider = (\n config: BindMountSandboxProviderConfig,\n): BindMountSandboxProvider => ({\n tag: \"bind-mount\",\n name: config.name,\n env: config.env ?? {},\n sandboxHomedir: config.sandboxHomedir,\n create: config.create,\n});\n\n/**\n * Create an isolated sandbox provider from a config object.\n * The returned provider can be passed to `run()` or `createSandbox()`.\n */\nexport const createIsolatedSandboxProvider = (\n config: IsolatedSandboxProviderConfig,\n): IsolatedSandboxProvider => ({\n tag: \"isolated\",\n name: config.name,\n env: config.env ?? {},\n create: config.create,\n});\n"]}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createRequire } from 'node:module';
|
|
2
|
+
import { BoundedTail } from './chunk-6NQPCXSG.js';
|
|
3
|
+
import { createInterface } from 'readline';
|
|
4
|
+
|
|
5
|
+
createRequire(import.meta.url);
|
|
6
|
+
var SENTINEL = "__SANDCASTLE_EXIT_STATUS=";
|
|
7
|
+
var WRAPPER = [
|
|
8
|
+
'__sandcastle_cmd=$1; shift; (eval "unset __sandcastle_cmd',
|
|
9
|
+
"$__sandcastle_cmd",
|
|
10
|
+
`"); __sandcastle_status=$?; printf '\\n${SENTINEL}%s\\n' "$__sandcastle_status" >&2; exit "$__sandcastle_status"`
|
|
11
|
+
].join("\n");
|
|
12
|
+
var shellArgsReportingExit = (command) => [
|
|
13
|
+
"sh",
|
|
14
|
+
"-c",
|
|
15
|
+
WRAPPER,
|
|
16
|
+
"sh",
|
|
17
|
+
command
|
|
18
|
+
];
|
|
19
|
+
var SENTINEL_LINE = new RegExp(`\\n${SENTINEL}(\\d+)\\n$`, "u");
|
|
20
|
+
var resolveEngineExit = (stderr, cliCode) => {
|
|
21
|
+
const match = SENTINEL_LINE.exec(stderr);
|
|
22
|
+
if (match !== null) {
|
|
23
|
+
return {
|
|
24
|
+
stderr: stderr.slice(0, match.index),
|
|
25
|
+
exitCode: Number(match[1])
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
return { stderr, exitCode: cliCode === null || cliCode === 0 ? 1 : cliCode };
|
|
29
|
+
};
|
|
30
|
+
var collectEngineExec = (proc, {
|
|
31
|
+
onLine,
|
|
32
|
+
maxOutputTailChars
|
|
33
|
+
}, done) => {
|
|
34
|
+
const maxChars = onLine === void 0 ? Number.POSITIVE_INFINITY : maxOutputTailChars;
|
|
35
|
+
const stderr = new BoundedTail(maxChars, "");
|
|
36
|
+
proc.stderr.on("data", (chunk) => {
|
|
37
|
+
stderr.push(chunk.toString());
|
|
38
|
+
});
|
|
39
|
+
const stdout = new BoundedTail(maxChars, onLine === void 0 ? "" : "\n");
|
|
40
|
+
if (onLine === void 0) {
|
|
41
|
+
proc.stdout.on("data", (chunk) => {
|
|
42
|
+
stdout.push(chunk.toString());
|
|
43
|
+
});
|
|
44
|
+
} else {
|
|
45
|
+
createInterface({ input: proc.stdout }).on("line", (line) => {
|
|
46
|
+
stdout.push(line);
|
|
47
|
+
onLine(line);
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
proc.on("close", (code) => {
|
|
51
|
+
done({
|
|
52
|
+
stdout: stdout.toString(),
|
|
53
|
+
...resolveEngineExit(stderr.toString(), code)
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export { collectEngineExec, shellArgsReportingExit };
|
|
59
|
+
//# sourceMappingURL=chunk-4GZMUHVO.js.map
|
|
60
|
+
//# sourceMappingURL=chunk-4GZMUHVO.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/sandboxes/engineExitStatus.ts"],"names":[],"mappings":";;;;;AAiBA,IAAM,QAAA,GAAW,2BAAA;AAQjB,IAAM,OAAA,GAAU;AAAA,EACd,2DAAA;AAAA,EACA,mBAAA;AAAA,EACA,0CAA0C,QAAQ,CAAA,8DAAA;AACpD,CAAA,CAAE,KAAK,IAAI,CAAA;AAGJ,IAAM,sBAAA,GAAyB,CAAC,OAAA,KAA8B;AAAA,EACnE,IAAA;AAAA,EACA,IAAA;AAAA,EACA,OAAA;AAAA,EACA,IAAA;AAAA,EACA;AACF;AAEA,IAAM,gBAAgB,IAAI,MAAA,CAAO,CAAA,GAAA,EAAM,QAAQ,cAAc,GAAG,CAAA;AAOhE,IAAM,iBAAA,GAAoB,CACxB,MAAA,EACA,OAAA,KAC2D;AAC3D,EAAA,MAAM,KAAA,GAAQ,aAAA,CAAc,IAAA,CAAK,MAAM,CAAA;AACvC,EAAA,IAAI,UAAU,IAAA,EAAM;AAClB,IAAA,OAAO;AAAA,MACL,MAAA,EAAQ,MAAA,CAAO,KAAA,CAAM,CAAA,EAAG,MAAM,KAAK,CAAA;AAAA,MACnC,QAAA,EAAU,MAAA,CAAO,KAAA,CAAM,CAAC,CAAC;AAAA,KAC3B;AAAA,EACF;AACA,EAAA,OAAO,EAAE,QAAQ,QAAA,EAAU,OAAA,KAAY,QAAQ,OAAA,KAAY,CAAA,GAAI,IAAI,OAAA,EAAQ;AAC7E,CAAA;AAcO,IAAM,iBAAA,GAAoB,CAC/B,IAAA,EACA;AAAA,EACE,MAAA;AAAA,EACA;AACF,CAAA,EAIA,IAAA,KACS;AAET,EAAA,MAAM,QAAA,GACJ,MAAA,KAAW,MAAA,GAAY,MAAA,CAAO,iBAAA,GAAoB,kBAAA;AACpD,EAAA,MAAM,MAAA,GAAS,IAAI,WAAA,CAAY,QAAA,EAAU,EAAE,CAAA;AAC3C,EAAA,IAAA,CAAK,MAAA,CAAO,EAAA,CAAG,MAAA,EAAQ,CAAC,KAAA,KAAkB;AACxC,IAAA,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,QAAA,EAAU,CAAA;AAAA,EAC9B,CAAC,CAAA;AACD,EAAA,MAAM,SAAS,IAAI,WAAA,CAAY,UAAU,MAAA,KAAW,MAAA,GAAY,KAAK,IAAI,CAAA;AACzE,EAAA,IAAI,WAAW,MAAA,EAAW;AACxB,IAAA,IAAA,CAAK,MAAA,CAAO,EAAA,CAAG,MAAA,EAAQ,CAAC,KAAA,KAAkB;AACxC,MAAA,MAAA,CAAO,IAAA,CAAK,KAAA,CAAM,QAAA,EAAU,CAAA;AAAA,IAC9B,CAAC,CAAA;AAAA,EACH,CAAA,MAAO;AACL,IAAA,eAAA,CAAgB,EAAE,OAAO,IAAA,CAAK,MAAA,EAAQ,CAAA,CAAE,EAAA,CAAG,MAAA,EAAQ,CAAC,IAAA,KAAS;AAC3D,MAAA,MAAA,CAAO,KAAK,IAAI,CAAA;AAChB,MAAA,MAAA,CAAO,IAAI,CAAA;AAAA,IACb,CAAC,CAAA;AAAA,EACH;AACA,EAAA,IAAA,CAAK,EAAA,CAAG,OAAA,EAAS,CAAC,IAAA,KAAwB;AACxC,IAAA,IAAA,CAAK;AAAA,MACH,MAAA,EAAQ,OAAO,QAAA,EAAS;AAAA,MACxB,GAAG,iBAAA,CAAkB,MAAA,CAAO,QAAA,IAAY,IAAI;AAAA,KAC7C,CAAA;AAAA,EACH,CAAC,CAAA;AACH","file":"chunk-4GZMUHVO.js","sourcesContent":["/**\n * @internal The exit status of a command run with `docker exec` or\n * `podman exec`, reported by the command's own shell in the container.\n *\n * The engine CLI's exit code can't be trusted on its own: the real `docker`\n * and `podman` CLIs trap SIGTERM (docker also SIGINT) and exit 0, so a CLI\n * killed while its command still runs looks like a success. So the command\n * runs in a subshell of a wrapper that prints its status as a last stderr\n * line once it ends. A missing line means the command never finished.\n */\n\nimport type { ChildProcessByStdio } from \"node:child_process\";\nimport { createInterface } from \"node:readline\";\nimport type { Readable, Writable } from \"node:stream\";\nimport { BoundedTail } from \"../boundedTail.js\";\nimport type { ExecResult } from \"../SandboxProvider.js\";\n\nconst SENTINEL = \"__SANDCASTLE_EXIT_STATUS=\";\n\n/**\n * Runs the command in a subshell, so its `exit` ends only the subshell, then\n * prints the status. The command arrives as `$1` and is cleared from the\n * shell's arguments and variables first, so it sees what `sh -c <command>`\n * would: `$0` is `sh`, with no arguments.\n */\nconst WRAPPER = [\n '__sandcastle_cmd=$1; shift; (eval \"unset __sandcastle_cmd',\n \"$__sandcastle_cmd\",\n `\"); __sandcastle_status=$?; printf '\\\\n${SENTINEL}%s\\\\n' \"$__sandcastle_status\" >&2; exit \"$__sandcastle_status\"`,\n].join(\"\\n\");\n\n/** The `sh -c` argv that runs `command` in the container and reports its status. */\nexport const shellArgsReportingExit = (command: string): string[] => [\n \"sh\",\n \"-c\",\n WRAPPER,\n \"sh\",\n command,\n];\n\nconst SENTINEL_LINE = new RegExp(`\\\\n${SENTINEL}(\\\\d+)\\\\n$`, \"u\");\n\n/**\n * The command's stderr without the status line, and its exit code: the\n * status it reported, else the CLI's own non-zero code, else 1. A CLI that\n * exits 0 without the status line was interrupted before the command ended.\n */\nconst resolveEngineExit = (\n stderr: string,\n cliCode: number | null,\n): { readonly stderr: string; readonly exitCode: number } => {\n const match = SENTINEL_LINE.exec(stderr);\n if (match !== null) {\n return {\n stderr: stderr.slice(0, match.index),\n exitCode: Number(match[1]),\n };\n }\n return { stderr, exitCode: cliCode === null || cliCode === 0 ? 1 : cliCode };\n};\n\n/** A spawned `<engine> exec`, with stdout and stderr piped. */\ntype EngineExecProcess = ChildProcessByStdio<\n Writable | null,\n Readable,\n Readable\n>;\n\n/**\n * Collects an `<engine> exec`'s output, streaming stdout lines to `onLine`\n * when given (keeping bounded tails), and calls `done` with the result once\n * the CLI closes.\n */\nexport const collectEngineExec = (\n proc: EngineExecProcess,\n {\n onLine,\n maxOutputTailChars,\n }: {\n readonly onLine: ((line: string) => void) | undefined;\n readonly maxOutputTailChars: number;\n },\n done: (result: ExecResult) => void,\n): void => {\n // Only a streamed exec keeps bounded tails; a buffered one keeps it all.\n const maxChars =\n onLine === undefined ? Number.POSITIVE_INFINITY : maxOutputTailChars;\n const stderr = new BoundedTail(maxChars, \"\");\n proc.stderr.on(\"data\", (chunk: Buffer) => {\n stderr.push(chunk.toString());\n });\n const stdout = new BoundedTail(maxChars, onLine === undefined ? \"\" : \"\\n\");\n if (onLine === undefined) {\n proc.stdout.on(\"data\", (chunk: Buffer) => {\n stdout.push(chunk.toString());\n });\n } else {\n createInterface({ input: proc.stdout }).on(\"line\", (line) => {\n stdout.push(line);\n onLine(line);\n });\n }\n proc.on(\"close\", (code: number | null) => {\n done({\n stdout: stdout.toString(),\n ...resolveEngineExit(stderr.toString(), code),\n });\n });\n};\n"]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import {
|
|
2
|
+
import { FileSystem, Path, TypeId, makeRunMain, WatchBackend, make, BadArgument, CommandExecutor, makeExecutor, Terminal, layerManager, flatten, stdin, ExitCode, ProcessId, ProcessTypeId, PlatformWorker, SystemError, effectify, Size, FileDescriptor, WatchEventUpdate, WatchEventRemove, WatchEventCreate, makePlatform, WorkerError, FileTypeId, NativeSandboxUnavailableError } from './chunk-YDQW5IOY.js';
|
|
3
|
+
import { effect, BaseProto, succeed3, pipe, mergeAll, provideMerge, constVoid, map4, serviceOption, try_, scoped2, provide2, async, fail3, _void, succeed2, tryPromise, acquireRelease, orDie, flatMap, getOrElse, unwrap, unwrapScoped, flatMap3, make5, constUndefined, unsafeDone, sync, match, zipRight, isDone, orElse2, _await, ignore, negate, transduce, drain, identity, tap, forkDaemon, run, fnUntraced, make6 as make6$1, gen, get3, make8, addFinalizer2, scoped, fromNullable, map, zip, suspend, asyncScoped, matchEffect, fromChannel2, fromChannel, asVoid, void_, uninterruptible, as, addFinalizer, interruptible, timeout, catchAllCause, flatMap4, embedInput, complete, failCause, suspend2, make2, unsafeMakeSemaphore, none, some, ensuring, void_2, unsafeMakeLatch, fromEffect, write, unsafeFromArray, ensuring2, fail } from './chunk-JEQ4IVQM.js';
|
|
3
4
|
import { __commonJS, __require, __export, __toESM, __reExport } from './chunk-6NQPCXSG.js';
|
|
4
5
|
import * as Crypto from 'crypto';
|
|
5
6
|
import * as NFS from 'fs';
|
|
@@ -24739,7 +24740,7 @@ var makeTempDirectoryScoped = /* @__PURE__ */ (() => {
|
|
|
24739
24740
|
var openFactory = (method) => {
|
|
24740
24741
|
const nodeOpen = effectify(NFS.open, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
24741
24742
|
const nodeClose = effectify(NFS.close, handleErrnoException("FileSystem", method), handleBadArgument(method));
|
|
24742
|
-
return (path, options) => pipe(acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => orDie(nodeClose(fd))),
|
|
24743
|
+
return (path, options) => pipe(acquireRelease(nodeOpen(path, options?.flag ?? "r", options?.mode), (fd) => orDie(nodeClose(fd))), map4((fd) => makeFile(FileDescriptor(fd), options?.flag?.startsWith("a") ?? false)));
|
|
24743
24744
|
};
|
|
24744
24745
|
var open2 = /* @__PURE__ */ openFactory("open");
|
|
24745
24746
|
var makeFile = /* @__PURE__ */ (() => {
|
|
@@ -24764,7 +24765,7 @@ var makeFile = /* @__PURE__ */ (() => {
|
|
|
24764
24765
|
this[FileTypeId] = FileTypeId;
|
|
24765
24766
|
}
|
|
24766
24767
|
get stat() {
|
|
24767
|
-
return
|
|
24768
|
+
return map4(nodeStat(this.fd), makeFileInfo);
|
|
24768
24769
|
}
|
|
24769
24770
|
get sync() {
|
|
24770
24771
|
return nodeSync(this.fd);
|
|
@@ -24781,7 +24782,7 @@ var makeFile = /* @__PURE__ */ (() => {
|
|
|
24781
24782
|
}));
|
|
24782
24783
|
}
|
|
24783
24784
|
read(buffer) {
|
|
24784
|
-
return this.semaphore.withPermits(1)(
|
|
24785
|
+
return this.semaphore.withPermits(1)(map4(suspend(() => nodeRead(this.fd, {
|
|
24785
24786
|
buffer,
|
|
24786
24787
|
position: this.position
|
|
24787
24788
|
})), (bytesRead) => {
|
|
@@ -24792,7 +24793,7 @@ var makeFile = /* @__PURE__ */ (() => {
|
|
|
24792
24793
|
}
|
|
24793
24794
|
readAlloc(size) {
|
|
24794
24795
|
const sizeNumber = Number(size);
|
|
24795
|
-
return this.semaphore.withPermits(1)(flatMap3(sync(() => Buffer.allocUnsafeSlow(sizeNumber)), (buffer) =>
|
|
24796
|
+
return this.semaphore.withPermits(1)(flatMap3(sync(() => Buffer.allocUnsafeSlow(sizeNumber)), (buffer) => map4(nodeReadAlloc(this.fd, {
|
|
24796
24797
|
buffer,
|
|
24797
24798
|
position: this.position
|
|
24798
24799
|
}), (bytesRead) => {
|
|
@@ -24809,7 +24810,7 @@ var makeFile = /* @__PURE__ */ (() => {
|
|
|
24809
24810
|
})));
|
|
24810
24811
|
}
|
|
24811
24812
|
truncate(length) {
|
|
24812
|
-
return this.semaphore.withPermits(1)(
|
|
24813
|
+
return this.semaphore.withPermits(1)(map4(nodeTruncate(this.fd, length ? Number(length) : void 0), () => {
|
|
24813
24814
|
if (!this.append) {
|
|
24814
24815
|
const len = BigInt(length ?? 0);
|
|
24815
24816
|
if (this.position > len) {
|
|
@@ -24819,7 +24820,7 @@ var makeFile = /* @__PURE__ */ (() => {
|
|
|
24819
24820
|
}));
|
|
24820
24821
|
}
|
|
24821
24822
|
write(buffer) {
|
|
24822
|
-
return this.semaphore.withPermits(1)(
|
|
24823
|
+
return this.semaphore.withPermits(1)(map4(suspend(() => nodeWrite(this.fd, buffer, void 0, void 0, this.append ? void 0 : Number(this.position))), (bytesWritten) => {
|
|
24823
24824
|
const sizeWritten = Size(bytesWritten);
|
|
24824
24825
|
if (!this.append) {
|
|
24825
24826
|
this.position = this.position + sizeWritten;
|
|
@@ -24830,7 +24831,7 @@ var makeFile = /* @__PURE__ */ (() => {
|
|
|
24830
24831
|
writeAllChunk(buffer) {
|
|
24831
24832
|
return flatMap3(suspend(() => nodeWriteAll(this.fd, buffer, void 0, void 0, this.append ? void 0 : Number(this.position))), (bytesWritten) => {
|
|
24832
24833
|
if (bytesWritten === 0) {
|
|
24833
|
-
return
|
|
24834
|
+
return fail3(new SystemError({
|
|
24834
24835
|
module: "FileSystem",
|
|
24835
24836
|
method: "writeAll",
|
|
24836
24837
|
reason: "WriteZero",
|
|
@@ -24854,7 +24855,7 @@ var makeTempFileFactory = (method) => {
|
|
|
24854
24855
|
const makeDirectory2 = makeTempDirectoryFactory(method);
|
|
24855
24856
|
const open3 = openFactory(method);
|
|
24856
24857
|
const randomHexString = (bytes) => sync(() => Crypto.randomBytes(bytes).toString("hex"));
|
|
24857
|
-
return (options) => pipe(zip(makeDirectory2(options), randomHexString(6)),
|
|
24858
|
+
return (options) => pipe(zip(makeDirectory2(options), randomHexString(6)), map4(([directory, random]) => Path2.join(directory, random + (options?.suffix ?? ""))), tap((path) => scoped(open3(path, {
|
|
24858
24859
|
flag: "w+"
|
|
24859
24860
|
}))));
|
|
24860
24861
|
};
|
|
@@ -24876,13 +24877,13 @@ var readFile2 = (path) => async((resume, signal) => {
|
|
|
24876
24877
|
signal
|
|
24877
24878
|
}, (err, data) => {
|
|
24878
24879
|
if (err) {
|
|
24879
|
-
resume(
|
|
24880
|
+
resume(fail3(handleErrnoException("FileSystem", "readFile")(err, [path])));
|
|
24880
24881
|
} else {
|
|
24881
|
-
resume(
|
|
24882
|
+
resume(succeed2(data));
|
|
24882
24883
|
}
|
|
24883
24884
|
});
|
|
24884
24885
|
} catch (err) {
|
|
24885
|
-
resume(
|
|
24886
|
+
resume(fail3(handleBadArgument("readFile")(err)));
|
|
24886
24887
|
}
|
|
24887
24888
|
});
|
|
24888
24889
|
var readLink = /* @__PURE__ */ (() => {
|
|
@@ -24915,7 +24916,7 @@ var makeFileInfo = (stat3) => ({
|
|
|
24915
24916
|
});
|
|
24916
24917
|
var stat2 = /* @__PURE__ */ (() => {
|
|
24917
24918
|
const nodeStat = /* @__PURE__ */ effectify(NFS.stat, /* @__PURE__ */ handleErrnoException("FileSystem", "stat"), /* @__PURE__ */ handleBadArgument("stat"));
|
|
24918
|
-
return (path) =>
|
|
24919
|
+
return (path) => map4(nodeStat(path), makeFileInfo);
|
|
24919
24920
|
})();
|
|
24920
24921
|
var symlink2 = /* @__PURE__ */ (() => {
|
|
24921
24922
|
const nodeSymlink = /* @__PURE__ */ effectify(NFS.symlink, /* @__PURE__ */ handleErrnoException("FileSystem", "symlink"), /* @__PURE__ */ handleBadArgument("symlink"));
|
|
@@ -24937,12 +24938,12 @@ var watchNode = (path, options) => asyncScoped((emit) => acquireRelease(sync(()
|
|
|
24937
24938
|
switch (event) {
|
|
24938
24939
|
case "rename": {
|
|
24939
24940
|
emit.fromEffect(matchEffect(stat2(path2), {
|
|
24940
|
-
onSuccess: (_) =>
|
|
24941
|
+
onSuccess: (_) => succeed2(WatchEventCreate({
|
|
24941
24942
|
path: path2
|
|
24942
24943
|
})),
|
|
24943
|
-
onFailure: (err) => err._tag === "SystemError" && err.reason === "NotFound" ?
|
|
24944
|
+
onFailure: (err) => err._tag === "SystemError" && err.reason === "NotFound" ? succeed2(WatchEventRemove({
|
|
24944
24945
|
path: path2
|
|
24945
|
-
})) :
|
|
24946
|
+
})) : fail3(err)
|
|
24946
24947
|
}));
|
|
24947
24948
|
return;
|
|
24948
24949
|
}
|
|
@@ -24968,7 +24969,7 @@ var watchNode = (path, options) => asyncScoped((emit) => acquireRelease(sync(()
|
|
|
24968
24969
|
});
|
|
24969
24970
|
return watcher;
|
|
24970
24971
|
}), (watcher) => sync(() => watcher.close())));
|
|
24971
|
-
var watch2 = (backend, path, options) => stat2(path).pipe(
|
|
24972
|
+
var watch2 = (backend, path, options) => stat2(path).pipe(map4((stat3) => backend.pipe(flatMap((_) => _.register(path, stat3, options)), getOrElse(() => watchNode(path, options)))), unwrap);
|
|
24972
24973
|
var writeFile2 = (path, data, options) => async((resume, signal) => {
|
|
24973
24974
|
try {
|
|
24974
24975
|
NFS.writeFile(path, data, {
|
|
@@ -24977,16 +24978,16 @@ var writeFile2 = (path, data, options) => async((resume, signal) => {
|
|
|
24977
24978
|
mode: options?.mode
|
|
24978
24979
|
}, (err) => {
|
|
24979
24980
|
if (err) {
|
|
24980
|
-
resume(
|
|
24981
|
+
resume(fail3(handleErrnoException("FileSystem", "writeFile")(err, [path])));
|
|
24981
24982
|
} else {
|
|
24982
24983
|
resume(_void);
|
|
24983
24984
|
}
|
|
24984
24985
|
});
|
|
24985
24986
|
} catch (err) {
|
|
24986
|
-
resume(
|
|
24987
|
+
resume(fail3(handleBadArgument("writeFile")(err)));
|
|
24987
24988
|
}
|
|
24988
24989
|
});
|
|
24989
|
-
var makeFileSystem = /* @__PURE__ */
|
|
24990
|
+
var makeFileSystem = /* @__PURE__ */ map4(/* @__PURE__ */ serviceOption(WatchBackend), (backend) => make({
|
|
24990
24991
|
access: access2,
|
|
24991
24992
|
chmod: chmod2,
|
|
24992
24993
|
chown: chown2,
|
|
@@ -25119,7 +25120,7 @@ var fromWritable = (evaluate, onError, options) => fromChannel2(fromWritableChan
|
|
|
25119
25120
|
var fromWritableChannel = (writable, onError, options) => flatMap4(zip(sync(() => writable()), make5()), ([writable2, deferred]) => embedInput(writableOutput(writable2, deferred, onError), writeInput(writable2, (cause) => failCause(deferred, cause), options, complete(deferred, _void))));
|
|
25120
25121
|
var writableOutput = (writable, deferred, onError) => suspend(() => {
|
|
25121
25122
|
function handleError(err) {
|
|
25122
|
-
unsafeDone(deferred,
|
|
25123
|
+
unsafeDone(deferred, fail3(onError(err)));
|
|
25123
25124
|
}
|
|
25124
25125
|
writable.on("error", handleError);
|
|
25125
25126
|
return ensuring(_await(deferred), sync(() => {
|
|
@@ -25132,7 +25133,7 @@ var inputToStdioOption = (stdin2) => typeof stdin2 === "string" ? stdin2 : "pipe
|
|
|
25132
25133
|
var outputToStdioOption = (output) => typeof output === "string" ? output : "pipe";
|
|
25133
25134
|
var toError = (err) => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
|
|
25134
25135
|
var toPlatformError = (method, error, command) => {
|
|
25135
|
-
const flattened =
|
|
25136
|
+
const flattened = flatten(command).reduce((acc, curr) => {
|
|
25136
25137
|
const command2 = `${curr.command} ${curr.args.join(" ")}`;
|
|
25137
25138
|
return acc.length === 0 ? command2 : `${acc} | ${command2}`;
|
|
25138
25139
|
}, "");
|
|
@@ -25163,13 +25164,13 @@ var runCommand = (fileSystem) => (command) => {
|
|
|
25163
25164
|
detached: process.platform !== "win32"
|
|
25164
25165
|
});
|
|
25165
25166
|
handle.on("error", (err) => {
|
|
25166
|
-
resume(
|
|
25167
|
+
resume(fail3(toPlatformError("spawn", err, command)));
|
|
25167
25168
|
});
|
|
25168
25169
|
handle.on("exit", (...args) => {
|
|
25169
|
-
unsafeDone(exitCode,
|
|
25170
|
+
unsafeDone(exitCode, succeed2(args));
|
|
25170
25171
|
});
|
|
25171
25172
|
handle.on("spawn", () => {
|
|
25172
|
-
resume(
|
|
25173
|
+
resume(succeed2([handle, exitCode]));
|
|
25173
25174
|
});
|
|
25174
25175
|
return sync(() => {
|
|
25175
25176
|
handle.kill("SIGTERM");
|
|
@@ -25178,7 +25179,7 @@ var runCommand = (fileSystem) => (command) => {
|
|
|
25178
25179
|
const killProcessGroup = process.platform === "win32" ? (handle, _) => async((resume) => {
|
|
25179
25180
|
ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, (error) => {
|
|
25180
25181
|
if (error) {
|
|
25181
|
-
resume(
|
|
25182
|
+
resume(fail3(toPlatformError("kill", toError(error), command)));
|
|
25182
25183
|
} else {
|
|
25183
25184
|
resume(_void);
|
|
25184
25185
|
}
|
|
@@ -25187,7 +25188,7 @@ var runCommand = (fileSystem) => (command) => {
|
|
|
25187
25188
|
try: () => process.kill(-handle.pid, signal),
|
|
25188
25189
|
catch: (error) => toPlatformError("kill", toError(error), command)
|
|
25189
25190
|
});
|
|
25190
|
-
const killProcess = (handle, signal) => suspend(() => handle.kill(signal) ? _void :
|
|
25191
|
+
const killProcess = (handle, signal) => suspend(() => handle.kill(signal) ? _void : fail3(toPlatformError("kill", new globalThis.Error("Failed to kill process"), command)));
|
|
25191
25192
|
return pipe(
|
|
25192
25193
|
// Validate that the directory is accessible
|
|
25193
25194
|
match(command.cwd, {
|
|
@@ -25205,16 +25206,16 @@ var runCommand = (fileSystem) => (command) => {
|
|
|
25205
25206
|
return _void;
|
|
25206
25207
|
});
|
|
25207
25208
|
}))),
|
|
25208
|
-
|
|
25209
|
+
map4(([handle, exitCodeDeferred]) => {
|
|
25209
25210
|
let stdin2 = drain;
|
|
25210
25211
|
if (handle.stdin !== null) {
|
|
25211
25212
|
stdin2 = fromWritable(() => handle.stdin, (err) => toPlatformError("toWritable", toError(err), command));
|
|
25212
25213
|
}
|
|
25213
25214
|
const exitCode = flatMap3(_await(exitCodeDeferred), ([code, signal]) => {
|
|
25214
25215
|
if (code !== null) {
|
|
25215
|
-
return
|
|
25216
|
+
return succeed2(ExitCode(code));
|
|
25216
25217
|
}
|
|
25217
|
-
return
|
|
25218
|
+
return fail3(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));
|
|
25218
25219
|
});
|
|
25219
25220
|
const isRunning = negate(isDone(exitCodeDeferred));
|
|
25220
25221
|
const kill = (signal = "SIGTERM") => killProcessGroup(handle, signal).pipe(orElse2(() => killProcess(handle, signal)), zipRight(asVoid(_await(exitCodeDeferred))));
|
|
@@ -25238,7 +25239,7 @@ var runCommand = (fileSystem) => (command) => {
|
|
|
25238
25239
|
);
|
|
25239
25240
|
}
|
|
25240
25241
|
case "PipedCommand": {
|
|
25241
|
-
const flattened =
|
|
25242
|
+
const flattened = flatten(command);
|
|
25242
25243
|
if (flattened.length === 1) {
|
|
25243
25244
|
return pipe(flattened[0], runCommand(fileSystem));
|
|
25244
25245
|
}
|
|
@@ -25246,12 +25247,12 @@ var runCommand = (fileSystem) => (command) => {
|
|
|
25246
25247
|
const tail = flattened.slice(1);
|
|
25247
25248
|
const initial = tail.slice(0, tail.length - 1);
|
|
25248
25249
|
const last = tail[tail.length - 1];
|
|
25249
|
-
const stream = initial.reduce((stdin2, command2) => pipe(stdin(command2, stdin2), runCommand(fileSystem),
|
|
25250
|
+
const stream = initial.reduce((stdin2, command2) => pipe(stdin(command2, stdin2), runCommand(fileSystem), map4((process2) => process2.stdout), unwrapScoped), pipe(runCommand(fileSystem)(head), map4((process2) => process2.stdout), unwrapScoped));
|
|
25250
25251
|
return pipe(stdin(last, stream), runCommand(fileSystem));
|
|
25251
25252
|
}
|
|
25252
25253
|
}
|
|
25253
25254
|
};
|
|
25254
|
-
var layer4 = /* @__PURE__ */ effect(CommandExecutor, /* @__PURE__ */ pipe(FileSystem, /* @__PURE__ */
|
|
25255
|
+
var layer4 = /* @__PURE__ */ effect(CommandExecutor, /* @__PURE__ */ pipe(FileSystem, /* @__PURE__ */ map4((fileSystem) => makeExecutor(runCommand(fileSystem)))));
|
|
25255
25256
|
|
|
25256
25257
|
// node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
|
|
25257
25258
|
var layer5 = layer4;
|
|
@@ -25273,19 +25274,19 @@ var toFileUrl = (path) => try_({
|
|
|
25273
25274
|
cause: error
|
|
25274
25275
|
})
|
|
25275
25276
|
});
|
|
25276
|
-
/* @__PURE__ */
|
|
25277
|
+
/* @__PURE__ */ succeed3(Path, /* @__PURE__ */ Path.of({
|
|
25277
25278
|
[TypeId]: TypeId,
|
|
25278
25279
|
...Path2.posix,
|
|
25279
25280
|
fromFileUrl,
|
|
25280
25281
|
toFileUrl
|
|
25281
25282
|
}));
|
|
25282
|
-
/* @__PURE__ */
|
|
25283
|
+
/* @__PURE__ */ succeed3(Path, /* @__PURE__ */ Path.of({
|
|
25283
25284
|
[TypeId]: TypeId,
|
|
25284
25285
|
...Path2.win32,
|
|
25285
25286
|
fromFileUrl,
|
|
25286
25287
|
toFileUrl
|
|
25287
25288
|
}));
|
|
25288
|
-
var layer6 = /* @__PURE__ */
|
|
25289
|
+
var layer6 = /* @__PURE__ */ succeed3(Path, /* @__PURE__ */ Path.of({
|
|
25289
25290
|
[TypeId]: TypeId,
|
|
25290
25291
|
...Path2,
|
|
25291
25292
|
fromFileUrl,
|
|
@@ -25321,7 +25322,7 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
|
|
|
25321
25322
|
const isTTY = sync(() => Boolean(stdout.isTTY));
|
|
25322
25323
|
const readInput = gen(function* () {
|
|
25323
25324
|
yield* get3(rlRef);
|
|
25324
|
-
const mailbox = yield*
|
|
25325
|
+
const mailbox = yield* make8();
|
|
25325
25326
|
const handleKeypress = (s, k) => {
|
|
25326
25327
|
const userInput = {
|
|
25327
25328
|
input: fromNullable(s),
|
|
@@ -25342,12 +25343,12 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
|
|
|
25342
25343
|
return mailbox;
|
|
25343
25344
|
});
|
|
25344
25345
|
const readLine = get3(rlRef).pipe(flatMap3((readlineInterface) => async((resume) => {
|
|
25345
|
-
const onLine = (line) => resume(
|
|
25346
|
+
const onLine = (line) => resume(succeed2(line));
|
|
25346
25347
|
readlineInterface.once("line", onLine);
|
|
25347
25348
|
return sync(() => readlineInterface.off("line", onLine));
|
|
25348
25349
|
})), scoped);
|
|
25349
25350
|
const display = (prompt) => uninterruptible(async((resume) => {
|
|
25350
|
-
stdout.write(prompt, (err) => err ? resume(
|
|
25351
|
+
stdout.write(prompt, (err) => err ? resume(fail3(new BadArgument({
|
|
25351
25352
|
module: "Terminal",
|
|
25352
25353
|
method: "display",
|
|
25353
25354
|
description: "Failed to write prompt to stdout",
|
|
@@ -25426,7 +25427,7 @@ var platformWorkerImpl = /* @__PURE__ */ makePlatform()({
|
|
|
25426
25427
|
return _void;
|
|
25427
25428
|
}
|
|
25428
25429
|
});
|
|
25429
|
-
var layerWorker = /* @__PURE__ */
|
|
25430
|
+
var layerWorker = /* @__PURE__ */ succeed3(PlatformWorker, platformWorkerImpl);
|
|
25430
25431
|
var layerManager2 = /* @__PURE__ */ provide2(layerManager, layerWorker);
|
|
25431
25432
|
|
|
25432
25433
|
// node_modules/@effect/platform-node/dist/esm/NodeWorker.js
|
|
@@ -25496,5 +25497,5 @@ undici/lib/web/websocket/frame.js:
|
|
|
25496
25497
|
*/
|
|
25497
25498
|
|
|
25498
25499
|
export { NativeSandboxUnavailableError2 as NativeSandboxUnavailableError, NodeContext_exports, NodeFileSystem_exports, NodeRuntime_exports };
|
|
25499
|
-
//# sourceMappingURL=chunk-
|
|
25500
|
-
//# sourceMappingURL=chunk-
|
|
25500
|
+
//# sourceMappingURL=chunk-7JUTKCHL.js.map
|
|
25501
|
+
//# sourceMappingURL=chunk-7JUTKCHL.js.map
|