@ai-hero/sandcastle 0.12.0 → 0.13.0
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 +15 -1368
- package/dist/LinuxCapability-B_PQfsY_.d.ts +32 -0
- package/dist/{SandboxProvider-EkSMuBp8.d.ts → SandboxProvider-YCL97qco.d.ts} +30 -3
- package/dist/chunk-4EIVTSOZ.js +93 -0
- package/dist/chunk-4EIVTSOZ.js.map +1 -0
- package/dist/{chunk-NGBM7T3E.js → chunk-6NQPCXSG.js} +5 -2
- package/dist/chunk-6NQPCXSG.js.map +1 -0
- package/dist/chunk-767EAJVT.js +112 -0
- package/dist/chunk-767EAJVT.js.map +1 -0
- package/dist/chunk-7N7AMUYA.js +353 -0
- package/dist/chunk-7N7AMUYA.js.map +1 -0
- package/dist/{chunk-DJRHWPEH.js → chunk-A4C2FG74.js} +258 -327
- package/dist/chunk-A4C2FG74.js.map +1 -0
- package/dist/chunk-J5J5YJ5S.js +50 -0
- package/dist/chunk-J5J5YJ5S.js.map +1 -0
- package/dist/{chunk-VOG34SRF.js → chunk-LWNC4UTZ.js} +13702 -4881
- package/dist/chunk-LWNC4UTZ.js.map +1 -0
- package/dist/chunk-NMQ5Z6YG.js +148 -0
- package/dist/chunk-NMQ5Z6YG.js.map +1 -0
- package/dist/{chunk-CP3TYXZA.js → chunk-U42XXICG.js} +92 -85
- package/dist/chunk-U42XXICG.js.map +1 -0
- package/dist/chunk-XCWKLDH4.js +24 -0
- package/dist/chunk-XCWKLDH4.js.map +1 -0
- package/dist/{chunk-BIWNFKGV.js → chunk-XCYK7I45.js} +2 -2
- package/dist/chunk-XCYK7I45.js.map +1 -0
- package/dist/index.d.ts +237 -26
- package/dist/index.js +2789 -2169
- package/dist/index.js.map +1 -1
- package/dist/main.js +1004 -625
- package/dist/main.js.map +1 -1
- package/dist/sandboxes/bwrap.d.ts +58 -0
- package/dist/sandboxes/bwrap.js +293 -0
- package/dist/sandboxes/bwrap.js.map +1 -0
- package/dist/sandboxes/daytona.d.ts +1 -1
- package/dist/sandboxes/daytona.js +78 -17
- package/dist/sandboxes/daytona.js.map +1 -1
- package/dist/sandboxes/docker.d.ts +18 -4
- package/dist/sandboxes/docker.js +4 -4
- package/dist/sandboxes/no-sandbox.d.ts +1 -1
- package/dist/sandboxes/no-sandbox.js +2 -2
- package/dist/sandboxes/podman.d.ts +18 -4
- package/dist/sandboxes/podman.js +69 -56
- package/dist/sandboxes/podman.js.map +1 -1
- package/dist/sandboxes/seatbelt.d.ts +65 -0
- package/dist/sandboxes/seatbelt.js +422 -0
- package/dist/sandboxes/seatbelt.js.map +1 -0
- package/dist/sandboxes/vercel.d.ts +12 -5
- package/dist/sandboxes/vercel.js +195 -126
- package/dist/sandboxes/vercel.js.map +1 -1
- package/dist/templates/parallel-planner/main.mts +13 -22
- package/dist/templates/parallel-planner-with-review/main.mts +13 -15
- package/package.json +34 -10
- package/dist/chunk-62WN33RK.js +0 -104
- package/dist/chunk-62WN33RK.js.map +0 -1
- package/dist/chunk-BIWNFKGV.js.map +0 -1
- package/dist/chunk-CP3TYXZA.js.map +0 -1
- package/dist/chunk-DJRHWPEH.js.map +0 -1
- package/dist/chunk-NGBM7T3E.js.map +0 -1
- package/dist/chunk-VOG34SRF.js.map +0 -1
- package/dist/mountUtils-CCA-bbpK.d.ts +0 -25
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import { BaseProto, succeed2, Path, TypeId, pipe, mergeAll, provideMerge, makeRunMain, constVoid,
|
|
3
|
-
import { __commonJS, __require, __export, __toESM, __reExport } from './chunk-
|
|
4
|
-
import * as ChildProcess from 'child_process';
|
|
5
|
-
import 'stream';
|
|
2
|
+
import { effect, FileSystem, BaseProto, succeed2, Path, TypeId, pipe, mergeAll, provideMerge, makeRunMain, constVoid, map3, serviceOption, WatchBackend, make8, try_, BadArgument, CommandExecutor, makeExecutor, scoped2, Terminal, provide2, layerManager, async, fail2, _void, succeed, tryPromise, acquireRelease, orDie, flatMap, getOrElse, unwrap, flatten2, stdin, unwrapScoped, flatMap3, make5, constUndefined, unsafeDone, sync, match, zipRight, isDone, orElse2, _await, ignore, ExitCode, negate, ProcessId, transduce, ProcessTypeId, drain, identity, tap, forkDaemon, run, fnUntraced, make6 as make6$1, gen, get3, make9, addFinalizer2, scoped, PlatformWorker, SystemError, effectify, fromNullable, map, Size, FileDescriptor, zip, suspend, asyncScoped, WatchEventUpdate, matchEffect, WatchEventRemove, WatchEventCreate, fromChannel2, fromChannel, asVoid, void_, uninterruptible, makePlatform, WorkerError, as, addFinalizer, interruptible, timeout, catchAllCause, flatMap4, embedInput, complete, failCause, suspend2, make2, FileTypeId, unsafeMakeSemaphore, none, some, ensuring, void_2, unsafeMakeLatch, fromEffect, write, unsafeFromArray, ensuring2, fail, NativeSandboxUnavailableError } from './chunk-LWNC4UTZ.js';
|
|
3
|
+
import { __commonJS, __require, __export, __toESM, __reExport } from './chunk-6NQPCXSG.js';
|
|
6
4
|
import * as Crypto from 'crypto';
|
|
7
5
|
import * as NFS from 'fs';
|
|
8
6
|
import * as OS from 'os';
|
|
9
7
|
import * as Path2 from 'path';
|
|
8
|
+
import * as ChildProcess from 'child_process';
|
|
9
|
+
import 'stream';
|
|
10
10
|
import * as NodeUrl from 'url';
|
|
11
11
|
import * as readline from 'readline';
|
|
12
12
|
|
|
@@ -24619,10 +24619,10 @@ ${captureLines}` : capture.stack;
|
|
|
24619
24619
|
}
|
|
24620
24620
|
});
|
|
24621
24621
|
|
|
24622
|
-
// node_modules/@effect/platform-node/dist/esm/
|
|
24623
|
-
var
|
|
24624
|
-
__export(
|
|
24625
|
-
layer: () =>
|
|
24622
|
+
// node_modules/@effect/platform-node/dist/esm/NodeFileSystem.js
|
|
24623
|
+
var NodeFileSystem_exports = {};
|
|
24624
|
+
__export(NodeFileSystem_exports, {
|
|
24625
|
+
layer: () => layer3
|
|
24626
24626
|
});
|
|
24627
24627
|
|
|
24628
24628
|
// node_modules/@effect/platform-node-shared/dist/esm/internal/error.js
|
|
@@ -24661,234 +24661,8 @@ var handleErrnoException = (module, method) => (err, [path]) => {
|
|
|
24661
24661
|
cause: err
|
|
24662
24662
|
});
|
|
24663
24663
|
};
|
|
24664
|
-
var fromReadable = (evaluate, onError, options) => fromChannel(fromReadableChannel(evaluate, onError));
|
|
24665
|
-
var fromReadableChannel = (evaluate, onError, options) => suspend2(() => unsafeReadableRead(evaluate(), onError, make2(void 0)));
|
|
24666
|
-
var writeInput = (writable, onFailure, {
|
|
24667
|
-
encoding,
|
|
24668
|
-
endOnDone = true
|
|
24669
|
-
} = {}, onDone = _void) => {
|
|
24670
|
-
const write3 = writeEffect(writable, encoding);
|
|
24671
|
-
const close2 = endOnDone ? async((resume) => {
|
|
24672
|
-
if ("closed" in writable && writable.closed) {
|
|
24673
|
-
resume(_void);
|
|
24674
|
-
} else {
|
|
24675
|
-
writable.once("finish", () => resume(_void));
|
|
24676
|
-
writable.end();
|
|
24677
|
-
}
|
|
24678
|
-
}) : _void;
|
|
24679
|
-
return {
|
|
24680
|
-
awaitRead: () => _void,
|
|
24681
|
-
emit: write3,
|
|
24682
|
-
error: (cause) => zipRight(close2, onFailure(cause)),
|
|
24683
|
-
done: (_) => zipRight(close2, onDone)
|
|
24684
|
-
};
|
|
24685
|
-
};
|
|
24686
|
-
var writeEffect = (writable, encoding) => (chunk) => chunk.length === 0 ? _void : async((resume) => {
|
|
24687
|
-
const iterator = chunk[Symbol.iterator]();
|
|
24688
|
-
let next = iterator.next();
|
|
24689
|
-
function loop() {
|
|
24690
|
-
const item = next;
|
|
24691
|
-
next = iterator.next();
|
|
24692
|
-
const success = writable.write(item.value, encoding);
|
|
24693
|
-
if (next.done) {
|
|
24694
|
-
resume(_void);
|
|
24695
|
-
} else if (success) {
|
|
24696
|
-
loop();
|
|
24697
|
-
} else {
|
|
24698
|
-
writable.once("drain", loop);
|
|
24699
|
-
}
|
|
24700
|
-
}
|
|
24701
|
-
loop();
|
|
24702
|
-
});
|
|
24703
|
-
var unsafeReadableRead = (readable, onError, exit, options) => {
|
|
24704
|
-
if (!readable.readable) {
|
|
24705
|
-
return void_2;
|
|
24706
|
-
}
|
|
24707
|
-
const latch = unsafeMakeLatch(false);
|
|
24708
|
-
function onReadable() {
|
|
24709
|
-
latch.unsafeOpen();
|
|
24710
|
-
}
|
|
24711
|
-
function onErr(err) {
|
|
24712
|
-
exit.current = fail(onError(err));
|
|
24713
|
-
latch.unsafeOpen();
|
|
24714
|
-
}
|
|
24715
|
-
function onEnd() {
|
|
24716
|
-
exit.current = void_;
|
|
24717
|
-
latch.unsafeOpen();
|
|
24718
|
-
}
|
|
24719
|
-
readable.on("readable", onReadable);
|
|
24720
|
-
readable.on("error", onErr);
|
|
24721
|
-
readable.on("end", onEnd);
|
|
24722
|
-
const chunkSize = void 0;
|
|
24723
|
-
const read2 = suspend2(function loop() {
|
|
24724
|
-
let item = readable.read(chunkSize);
|
|
24725
|
-
if (item === null) {
|
|
24726
|
-
if (exit.current) {
|
|
24727
|
-
return fromEffect(exit.current);
|
|
24728
|
-
}
|
|
24729
|
-
latch.unsafeClose();
|
|
24730
|
-
return flatMap4(latch.await, loop);
|
|
24731
|
-
}
|
|
24732
|
-
const arr = [item];
|
|
24733
|
-
while (true) {
|
|
24734
|
-
item = readable.read(chunkSize);
|
|
24735
|
-
if (item === null) {
|
|
24736
|
-
return flatMap4(write(unsafeFromArray(arr)), loop);
|
|
24737
|
-
}
|
|
24738
|
-
arr.push(item);
|
|
24739
|
-
}
|
|
24740
|
-
});
|
|
24741
|
-
return ensuring2(read2, sync(() => {
|
|
24742
|
-
readable.off("readable", onReadable);
|
|
24743
|
-
readable.off("error", onErr);
|
|
24744
|
-
readable.off("end", onEnd);
|
|
24745
|
-
if ("closed" in readable && !readable.closed) {
|
|
24746
|
-
readable.destroy();
|
|
24747
|
-
}
|
|
24748
|
-
}));
|
|
24749
|
-
};
|
|
24750
|
-
|
|
24751
|
-
// node_modules/@effect/platform-node-shared/dist/esm/internal/sink.js
|
|
24752
|
-
var fromWritable = (evaluate, onError, options) => fromChannel2(fromWritableChannel(evaluate, onError, options));
|
|
24753
|
-
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))));
|
|
24754
|
-
var writableOutput = (writable, deferred, onError) => suspend(() => {
|
|
24755
|
-
function handleError(err) {
|
|
24756
|
-
unsafeDone(deferred, fail2(onError(err)));
|
|
24757
|
-
}
|
|
24758
|
-
writable.on("error", handleError);
|
|
24759
|
-
return ensuring(_await(deferred), sync(() => {
|
|
24760
|
-
writable.removeListener("error", handleError);
|
|
24761
|
-
}));
|
|
24762
|
-
});
|
|
24763
24664
|
|
|
24764
|
-
// node_modules/@effect/platform-node-shared/dist/esm/internal/
|
|
24765
|
-
var inputToStdioOption = (stdin2) => typeof stdin2 === "string" ? stdin2 : "pipe";
|
|
24766
|
-
var outputToStdioOption = (output) => typeof output === "string" ? output : "pipe";
|
|
24767
|
-
var toError = (err) => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
|
|
24768
|
-
var toPlatformError = (method, error, command) => {
|
|
24769
|
-
const flattened = flatten2(command).reduce((acc, curr) => {
|
|
24770
|
-
const command2 = `${curr.command} ${curr.args.join(" ")}`;
|
|
24771
|
-
return acc.length === 0 ? command2 : `${acc} | ${command2}`;
|
|
24772
|
-
}, "");
|
|
24773
|
-
return handleErrnoException("Command", method)(error, [flattened]);
|
|
24774
|
-
};
|
|
24775
|
-
var ProcessProto = {
|
|
24776
|
-
[ProcessTypeId]: ProcessTypeId,
|
|
24777
|
-
...BaseProto,
|
|
24778
|
-
toJSON() {
|
|
24779
|
-
return {
|
|
24780
|
-
_id: "@effect/platform/CommandExecutor/Process",
|
|
24781
|
-
pid: this.pid
|
|
24782
|
-
};
|
|
24783
|
-
}
|
|
24784
|
-
};
|
|
24785
|
-
var runCommand = (fileSystem) => (command) => {
|
|
24786
|
-
switch (command._tag) {
|
|
24787
|
-
case "StandardCommand": {
|
|
24788
|
-
const spawn2 = flatMap3(make5(), (exitCode) => async((resume) => {
|
|
24789
|
-
const handle = ChildProcess.spawn(command.command, command.args, {
|
|
24790
|
-
stdio: [inputToStdioOption(command.stdin), outputToStdioOption(command.stdout), outputToStdioOption(command.stderr)],
|
|
24791
|
-
cwd: getOrElse(command.cwd, constUndefined),
|
|
24792
|
-
shell: command.shell,
|
|
24793
|
-
env: {
|
|
24794
|
-
...process.env,
|
|
24795
|
-
...Object.fromEntries(command.env)
|
|
24796
|
-
},
|
|
24797
|
-
detached: process.platform !== "win32"
|
|
24798
|
-
});
|
|
24799
|
-
handle.on("error", (err) => {
|
|
24800
|
-
resume(fail2(toPlatformError("spawn", err, command)));
|
|
24801
|
-
});
|
|
24802
|
-
handle.on("exit", (...args) => {
|
|
24803
|
-
unsafeDone(exitCode, succeed(args));
|
|
24804
|
-
});
|
|
24805
|
-
handle.on("spawn", () => {
|
|
24806
|
-
resume(succeed([handle, exitCode]));
|
|
24807
|
-
});
|
|
24808
|
-
return sync(() => {
|
|
24809
|
-
handle.kill("SIGTERM");
|
|
24810
|
-
});
|
|
24811
|
-
}));
|
|
24812
|
-
const killProcessGroup = process.platform === "win32" ? (handle, _) => async((resume) => {
|
|
24813
|
-
ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, (error) => {
|
|
24814
|
-
if (error) {
|
|
24815
|
-
resume(fail2(toPlatformError("kill", toError(error), command)));
|
|
24816
|
-
} else {
|
|
24817
|
-
resume(_void);
|
|
24818
|
-
}
|
|
24819
|
-
});
|
|
24820
|
-
}) : (handle, signal) => try_({
|
|
24821
|
-
try: () => process.kill(-handle.pid, signal),
|
|
24822
|
-
catch: (error) => toPlatformError("kill", toError(error), command)
|
|
24823
|
-
});
|
|
24824
|
-
const killProcess = (handle, signal) => suspend(() => handle.kill(signal) ? _void : fail2(toPlatformError("kill", new globalThis.Error("Failed to kill process"), command)));
|
|
24825
|
-
return pipe(
|
|
24826
|
-
// Validate that the directory is accessible
|
|
24827
|
-
match(command.cwd, {
|
|
24828
|
-
onNone: () => _void,
|
|
24829
|
-
onSome: (dir) => fileSystem.access(dir)
|
|
24830
|
-
}),
|
|
24831
|
-
zipRight(acquireRelease(spawn2, ([handle, exitCode]) => flatMap3(isDone(exitCode), (done) => {
|
|
24832
|
-
if (!done) {
|
|
24833
|
-
return killProcessGroup(handle, "SIGTERM").pipe(orElse2(() => killProcess(handle, "SIGTERM")), zipRight(_await(exitCode)), ignore);
|
|
24834
|
-
}
|
|
24835
|
-
return flatMap3(_await(exitCode), ([code]) => {
|
|
24836
|
-
if (code !== 0 && code !== null) {
|
|
24837
|
-
return killProcessGroup(handle, "SIGTERM").pipe(ignore);
|
|
24838
|
-
}
|
|
24839
|
-
return _void;
|
|
24840
|
-
});
|
|
24841
|
-
}))),
|
|
24842
|
-
map3(([handle, exitCodeDeferred]) => {
|
|
24843
|
-
let stdin2 = drain;
|
|
24844
|
-
if (handle.stdin !== null) {
|
|
24845
|
-
stdin2 = fromWritable(() => handle.stdin, (err) => toPlatformError("toWritable", toError(err), command));
|
|
24846
|
-
}
|
|
24847
|
-
const exitCode = flatMap3(_await(exitCodeDeferred), ([code, signal]) => {
|
|
24848
|
-
if (code !== null) {
|
|
24849
|
-
return succeed(ExitCode(code));
|
|
24850
|
-
}
|
|
24851
|
-
return fail2(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));
|
|
24852
|
-
});
|
|
24853
|
-
const isRunning = negate(isDone(exitCodeDeferred));
|
|
24854
|
-
const kill = (signal = "SIGTERM") => killProcessGroup(handle, signal).pipe(orElse2(() => killProcess(handle, signal)), zipRight(asVoid(_await(exitCodeDeferred))));
|
|
24855
|
-
const pid = ProcessId(handle.pid);
|
|
24856
|
-
const stderr = fromReadable(() => handle.stderr, (err) => toPlatformError("fromReadable(stderr)", toError(err), command));
|
|
24857
|
-
let stdout = fromReadable(() => handle.stdout, (err) => toPlatformError("fromReadable(stdout)", toError(err), command));
|
|
24858
|
-
if (typeof command.stdout !== "string") {
|
|
24859
|
-
stdout = transduce(stdout, command.stdout);
|
|
24860
|
-
}
|
|
24861
|
-
return Object.assign(Object.create(ProcessProto), {
|
|
24862
|
-
pid,
|
|
24863
|
-
exitCode,
|
|
24864
|
-
isRunning,
|
|
24865
|
-
kill,
|
|
24866
|
-
stdin: stdin2,
|
|
24867
|
-
stderr,
|
|
24868
|
-
stdout
|
|
24869
|
-
});
|
|
24870
|
-
}),
|
|
24871
|
-
typeof command.stdin === "string" ? identity : tap((process2) => forkDaemon(run(command.stdin, process2.stdin)))
|
|
24872
|
-
);
|
|
24873
|
-
}
|
|
24874
|
-
case "PipedCommand": {
|
|
24875
|
-
const flattened = flatten2(command);
|
|
24876
|
-
if (flattened.length === 1) {
|
|
24877
|
-
return pipe(flattened[0], runCommand(fileSystem));
|
|
24878
|
-
}
|
|
24879
|
-
const head = flattened[0];
|
|
24880
|
-
const tail = flattened.slice(1);
|
|
24881
|
-
const initial = tail.slice(0, tail.length - 1);
|
|
24882
|
-
const last = tail[tail.length - 1];
|
|
24883
|
-
const stream = initial.reduce((stdin2, command2) => pipe(stdin(command2, stdin2), runCommand(fileSystem), map3((process2) => process2.stdout), unwrapScoped), pipe(runCommand(fileSystem)(head), map3((process2) => process2.stdout), unwrapScoped));
|
|
24884
|
-
return pipe(stdin(last, stream), runCommand(fileSystem));
|
|
24885
|
-
}
|
|
24886
|
-
}
|
|
24887
|
-
};
|
|
24888
|
-
var layer = /* @__PURE__ */ effect(CommandExecutor, /* @__PURE__ */ pipe(FileSystem, /* @__PURE__ */ map3((fileSystem) => makeExecutor(runCommand(fileSystem)))));
|
|
24889
|
-
|
|
24890
|
-
// node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
|
|
24891
|
-
var layer2 = layer;
|
|
24665
|
+
// node_modules/@effect/platform-node-shared/dist/esm/internal/fileSystem.js
|
|
24892
24666
|
var handleBadArgument = (method) => (cause) => new BadArgument({
|
|
24893
24667
|
module: "FileSystem",
|
|
24894
24668
|
method,
|
|
@@ -25240,10 +25014,247 @@ var makeFileSystem = /* @__PURE__ */ map3(/* @__PURE__ */ serviceOption(WatchBac
|
|
|
25240
25014
|
},
|
|
25241
25015
|
writeFile: writeFile2
|
|
25242
25016
|
}));
|
|
25243
|
-
var
|
|
25017
|
+
var layer = /* @__PURE__ */ effect(FileSystem, makeFileSystem);
|
|
25244
25018
|
|
|
25245
25019
|
// node_modules/@effect/platform-node-shared/dist/esm/NodeFileSystem.js
|
|
25246
|
-
var
|
|
25020
|
+
var layer2 = layer;
|
|
25021
|
+
|
|
25022
|
+
// node_modules/@effect/platform-node/dist/esm/NodeFileSystem.js
|
|
25023
|
+
var layer3 = layer2;
|
|
25024
|
+
|
|
25025
|
+
// node_modules/@effect/platform-node/dist/esm/NodeContext.js
|
|
25026
|
+
var NodeContext_exports = {};
|
|
25027
|
+
__export(NodeContext_exports, {
|
|
25028
|
+
layer: () => layer11
|
|
25029
|
+
});
|
|
25030
|
+
var fromReadable = (evaluate, onError, options) => fromChannel(fromReadableChannel(evaluate, onError));
|
|
25031
|
+
var fromReadableChannel = (evaluate, onError, options) => suspend2(() => unsafeReadableRead(evaluate(), onError, make2(void 0)));
|
|
25032
|
+
var writeInput = (writable, onFailure, {
|
|
25033
|
+
encoding,
|
|
25034
|
+
endOnDone = true
|
|
25035
|
+
} = {}, onDone = _void) => {
|
|
25036
|
+
const write3 = writeEffect(writable, encoding);
|
|
25037
|
+
const close2 = endOnDone ? async((resume) => {
|
|
25038
|
+
if ("closed" in writable && writable.closed) {
|
|
25039
|
+
resume(_void);
|
|
25040
|
+
} else {
|
|
25041
|
+
writable.once("finish", () => resume(_void));
|
|
25042
|
+
writable.end();
|
|
25043
|
+
}
|
|
25044
|
+
}) : _void;
|
|
25045
|
+
return {
|
|
25046
|
+
awaitRead: () => _void,
|
|
25047
|
+
emit: write3,
|
|
25048
|
+
error: (cause) => zipRight(close2, onFailure(cause)),
|
|
25049
|
+
done: (_) => zipRight(close2, onDone)
|
|
25050
|
+
};
|
|
25051
|
+
};
|
|
25052
|
+
var writeEffect = (writable, encoding) => (chunk) => chunk.length === 0 ? _void : async((resume) => {
|
|
25053
|
+
const iterator = chunk[Symbol.iterator]();
|
|
25054
|
+
let next = iterator.next();
|
|
25055
|
+
function loop() {
|
|
25056
|
+
const item = next;
|
|
25057
|
+
next = iterator.next();
|
|
25058
|
+
const success = writable.write(item.value, encoding);
|
|
25059
|
+
if (next.done) {
|
|
25060
|
+
resume(_void);
|
|
25061
|
+
} else if (success) {
|
|
25062
|
+
loop();
|
|
25063
|
+
} else {
|
|
25064
|
+
writable.once("drain", loop);
|
|
25065
|
+
}
|
|
25066
|
+
}
|
|
25067
|
+
loop();
|
|
25068
|
+
});
|
|
25069
|
+
var unsafeReadableRead = (readable, onError, exit, options) => {
|
|
25070
|
+
if (!readable.readable) {
|
|
25071
|
+
return void_2;
|
|
25072
|
+
}
|
|
25073
|
+
const latch = unsafeMakeLatch(false);
|
|
25074
|
+
function onReadable() {
|
|
25075
|
+
latch.unsafeOpen();
|
|
25076
|
+
}
|
|
25077
|
+
function onErr(err) {
|
|
25078
|
+
exit.current = fail(onError(err));
|
|
25079
|
+
latch.unsafeOpen();
|
|
25080
|
+
}
|
|
25081
|
+
function onEnd() {
|
|
25082
|
+
exit.current = void_;
|
|
25083
|
+
latch.unsafeOpen();
|
|
25084
|
+
}
|
|
25085
|
+
readable.on("readable", onReadable);
|
|
25086
|
+
readable.on("error", onErr);
|
|
25087
|
+
readable.on("end", onEnd);
|
|
25088
|
+
const chunkSize = void 0;
|
|
25089
|
+
const read2 = suspend2(function loop() {
|
|
25090
|
+
let item = readable.read(chunkSize);
|
|
25091
|
+
if (item === null) {
|
|
25092
|
+
if (exit.current) {
|
|
25093
|
+
return fromEffect(exit.current);
|
|
25094
|
+
}
|
|
25095
|
+
latch.unsafeClose();
|
|
25096
|
+
return flatMap4(latch.await, loop);
|
|
25097
|
+
}
|
|
25098
|
+
const arr = [item];
|
|
25099
|
+
while (true) {
|
|
25100
|
+
item = readable.read(chunkSize);
|
|
25101
|
+
if (item === null) {
|
|
25102
|
+
return flatMap4(write(unsafeFromArray(arr)), loop);
|
|
25103
|
+
}
|
|
25104
|
+
arr.push(item);
|
|
25105
|
+
}
|
|
25106
|
+
});
|
|
25107
|
+
return ensuring2(read2, sync(() => {
|
|
25108
|
+
readable.off("readable", onReadable);
|
|
25109
|
+
readable.off("error", onErr);
|
|
25110
|
+
readable.off("end", onEnd);
|
|
25111
|
+
if ("closed" in readable && !readable.closed) {
|
|
25112
|
+
readable.destroy();
|
|
25113
|
+
}
|
|
25114
|
+
}));
|
|
25115
|
+
};
|
|
25116
|
+
|
|
25117
|
+
// node_modules/@effect/platform-node-shared/dist/esm/internal/sink.js
|
|
25118
|
+
var fromWritable = (evaluate, onError, options) => fromChannel2(fromWritableChannel(evaluate, onError, options));
|
|
25119
|
+
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
|
+
var writableOutput = (writable, deferred, onError) => suspend(() => {
|
|
25121
|
+
function handleError(err) {
|
|
25122
|
+
unsafeDone(deferred, fail2(onError(err)));
|
|
25123
|
+
}
|
|
25124
|
+
writable.on("error", handleError);
|
|
25125
|
+
return ensuring(_await(deferred), sync(() => {
|
|
25126
|
+
writable.removeListener("error", handleError);
|
|
25127
|
+
}));
|
|
25128
|
+
});
|
|
25129
|
+
|
|
25130
|
+
// node_modules/@effect/platform-node-shared/dist/esm/internal/commandExecutor.js
|
|
25131
|
+
var inputToStdioOption = (stdin2) => typeof stdin2 === "string" ? stdin2 : "pipe";
|
|
25132
|
+
var outputToStdioOption = (output) => typeof output === "string" ? output : "pipe";
|
|
25133
|
+
var toError = (err) => err instanceof globalThis.Error ? err : new globalThis.Error(String(err));
|
|
25134
|
+
var toPlatformError = (method, error, command) => {
|
|
25135
|
+
const flattened = flatten2(command).reduce((acc, curr) => {
|
|
25136
|
+
const command2 = `${curr.command} ${curr.args.join(" ")}`;
|
|
25137
|
+
return acc.length === 0 ? command2 : `${acc} | ${command2}`;
|
|
25138
|
+
}, "");
|
|
25139
|
+
return handleErrnoException("Command", method)(error, [flattened]);
|
|
25140
|
+
};
|
|
25141
|
+
var ProcessProto = {
|
|
25142
|
+
[ProcessTypeId]: ProcessTypeId,
|
|
25143
|
+
...BaseProto,
|
|
25144
|
+
toJSON() {
|
|
25145
|
+
return {
|
|
25146
|
+
_id: "@effect/platform/CommandExecutor/Process",
|
|
25147
|
+
pid: this.pid
|
|
25148
|
+
};
|
|
25149
|
+
}
|
|
25150
|
+
};
|
|
25151
|
+
var runCommand = (fileSystem) => (command) => {
|
|
25152
|
+
switch (command._tag) {
|
|
25153
|
+
case "StandardCommand": {
|
|
25154
|
+
const spawn2 = flatMap3(make5(), (exitCode) => async((resume) => {
|
|
25155
|
+
const handle = ChildProcess.spawn(command.command, command.args, {
|
|
25156
|
+
stdio: [inputToStdioOption(command.stdin), outputToStdioOption(command.stdout), outputToStdioOption(command.stderr)],
|
|
25157
|
+
cwd: getOrElse(command.cwd, constUndefined),
|
|
25158
|
+
shell: command.shell,
|
|
25159
|
+
env: {
|
|
25160
|
+
...process.env,
|
|
25161
|
+
...Object.fromEntries(command.env)
|
|
25162
|
+
},
|
|
25163
|
+
detached: process.platform !== "win32"
|
|
25164
|
+
});
|
|
25165
|
+
handle.on("error", (err) => {
|
|
25166
|
+
resume(fail2(toPlatformError("spawn", err, command)));
|
|
25167
|
+
});
|
|
25168
|
+
handle.on("exit", (...args) => {
|
|
25169
|
+
unsafeDone(exitCode, succeed(args));
|
|
25170
|
+
});
|
|
25171
|
+
handle.on("spawn", () => {
|
|
25172
|
+
resume(succeed([handle, exitCode]));
|
|
25173
|
+
});
|
|
25174
|
+
return sync(() => {
|
|
25175
|
+
handle.kill("SIGTERM");
|
|
25176
|
+
});
|
|
25177
|
+
}));
|
|
25178
|
+
const killProcessGroup = process.platform === "win32" ? (handle, _) => async((resume) => {
|
|
25179
|
+
ChildProcess.exec(`taskkill /pid ${handle.pid} /T /F`, (error) => {
|
|
25180
|
+
if (error) {
|
|
25181
|
+
resume(fail2(toPlatformError("kill", toError(error), command)));
|
|
25182
|
+
} else {
|
|
25183
|
+
resume(_void);
|
|
25184
|
+
}
|
|
25185
|
+
});
|
|
25186
|
+
}) : (handle, signal) => try_({
|
|
25187
|
+
try: () => process.kill(-handle.pid, signal),
|
|
25188
|
+
catch: (error) => toPlatformError("kill", toError(error), command)
|
|
25189
|
+
});
|
|
25190
|
+
const killProcess = (handle, signal) => suspend(() => handle.kill(signal) ? _void : fail2(toPlatformError("kill", new globalThis.Error("Failed to kill process"), command)));
|
|
25191
|
+
return pipe(
|
|
25192
|
+
// Validate that the directory is accessible
|
|
25193
|
+
match(command.cwd, {
|
|
25194
|
+
onNone: () => _void,
|
|
25195
|
+
onSome: (dir) => fileSystem.access(dir)
|
|
25196
|
+
}),
|
|
25197
|
+
zipRight(acquireRelease(spawn2, ([handle, exitCode]) => flatMap3(isDone(exitCode), (done) => {
|
|
25198
|
+
if (!done) {
|
|
25199
|
+
return killProcessGroup(handle, "SIGTERM").pipe(orElse2(() => killProcess(handle, "SIGTERM")), zipRight(_await(exitCode)), ignore);
|
|
25200
|
+
}
|
|
25201
|
+
return flatMap3(_await(exitCode), ([code]) => {
|
|
25202
|
+
if (code !== 0 && code !== null) {
|
|
25203
|
+
return killProcessGroup(handle, "SIGTERM").pipe(ignore);
|
|
25204
|
+
}
|
|
25205
|
+
return _void;
|
|
25206
|
+
});
|
|
25207
|
+
}))),
|
|
25208
|
+
map3(([handle, exitCodeDeferred]) => {
|
|
25209
|
+
let stdin2 = drain;
|
|
25210
|
+
if (handle.stdin !== null) {
|
|
25211
|
+
stdin2 = fromWritable(() => handle.stdin, (err) => toPlatformError("toWritable", toError(err), command));
|
|
25212
|
+
}
|
|
25213
|
+
const exitCode = flatMap3(_await(exitCodeDeferred), ([code, signal]) => {
|
|
25214
|
+
if (code !== null) {
|
|
25215
|
+
return succeed(ExitCode(code));
|
|
25216
|
+
}
|
|
25217
|
+
return fail2(toPlatformError("exitCode", new globalThis.Error(`Process interrupted due to receipt of signal: ${signal}`), command));
|
|
25218
|
+
});
|
|
25219
|
+
const isRunning = negate(isDone(exitCodeDeferred));
|
|
25220
|
+
const kill = (signal = "SIGTERM") => killProcessGroup(handle, signal).pipe(orElse2(() => killProcess(handle, signal)), zipRight(asVoid(_await(exitCodeDeferred))));
|
|
25221
|
+
const pid = ProcessId(handle.pid);
|
|
25222
|
+
const stderr = fromReadable(() => handle.stderr, (err) => toPlatformError("fromReadable(stderr)", toError(err), command));
|
|
25223
|
+
let stdout = fromReadable(() => handle.stdout, (err) => toPlatformError("fromReadable(stdout)", toError(err), command));
|
|
25224
|
+
if (typeof command.stdout !== "string") {
|
|
25225
|
+
stdout = transduce(stdout, command.stdout);
|
|
25226
|
+
}
|
|
25227
|
+
return Object.assign(Object.create(ProcessProto), {
|
|
25228
|
+
pid,
|
|
25229
|
+
exitCode,
|
|
25230
|
+
isRunning,
|
|
25231
|
+
kill,
|
|
25232
|
+
stdin: stdin2,
|
|
25233
|
+
stderr,
|
|
25234
|
+
stdout
|
|
25235
|
+
});
|
|
25236
|
+
}),
|
|
25237
|
+
typeof command.stdin === "string" ? identity : tap((process2) => forkDaemon(run(command.stdin, process2.stdin)))
|
|
25238
|
+
);
|
|
25239
|
+
}
|
|
25240
|
+
case "PipedCommand": {
|
|
25241
|
+
const flattened = flatten2(command);
|
|
25242
|
+
if (flattened.length === 1) {
|
|
25243
|
+
return pipe(flattened[0], runCommand(fileSystem));
|
|
25244
|
+
}
|
|
25245
|
+
const head = flattened[0];
|
|
25246
|
+
const tail = flattened.slice(1);
|
|
25247
|
+
const initial = tail.slice(0, tail.length - 1);
|
|
25248
|
+
const last = tail[tail.length - 1];
|
|
25249
|
+
const stream = initial.reduce((stdin2, command2) => pipe(stdin(command2, stdin2), runCommand(fileSystem), map3((process2) => process2.stdout), unwrapScoped), pipe(runCommand(fileSystem)(head), map3((process2) => process2.stdout), unwrapScoped));
|
|
25250
|
+
return pipe(stdin(last, stream), runCommand(fileSystem));
|
|
25251
|
+
}
|
|
25252
|
+
}
|
|
25253
|
+
};
|
|
25254
|
+
var layer4 = /* @__PURE__ */ effect(CommandExecutor, /* @__PURE__ */ pipe(FileSystem, /* @__PURE__ */ map3((fileSystem) => makeExecutor(runCommand(fileSystem)))));
|
|
25255
|
+
|
|
25256
|
+
// node_modules/@effect/platform-node-shared/dist/esm/NodeCommandExecutor.js
|
|
25257
|
+
var layer5 = layer4;
|
|
25247
25258
|
var fromFileUrl = (url) => try_({
|
|
25248
25259
|
try: () => NodeUrl.fileURLToPath(url),
|
|
25249
25260
|
catch: (error) => new BadArgument({
|
|
@@ -25274,7 +25285,7 @@ var toFileUrl = (path) => try_({
|
|
|
25274
25285
|
fromFileUrl,
|
|
25275
25286
|
toFileUrl
|
|
25276
25287
|
}));
|
|
25277
|
-
var
|
|
25288
|
+
var layer6 = /* @__PURE__ */ succeed2(Path, /* @__PURE__ */ Path.of({
|
|
25278
25289
|
[TypeId]: TypeId,
|
|
25279
25290
|
...Path2,
|
|
25280
25291
|
fromFileUrl,
|
|
@@ -25282,7 +25293,7 @@ var layer5 = /* @__PURE__ */ succeed2(Path, /* @__PURE__ */ Path.of({
|
|
|
25282
25293
|
}));
|
|
25283
25294
|
|
|
25284
25295
|
// node_modules/@effect/platform-node-shared/dist/esm/NodePath.js
|
|
25285
|
-
var
|
|
25296
|
+
var layer7 = layer6;
|
|
25286
25297
|
var defaultShouldQuit = (input) => input.key.ctrl && (input.key.name === "c" || input.key.name === "d");
|
|
25287
25298
|
var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit) {
|
|
25288
25299
|
const stdin2 = process.stdin;
|
|
@@ -25352,10 +25363,10 @@ var make6 = /* @__PURE__ */ fnUntraced(function* (shouldQuit = defaultShouldQuit
|
|
|
25352
25363
|
display
|
|
25353
25364
|
});
|
|
25354
25365
|
});
|
|
25355
|
-
var
|
|
25366
|
+
var layer8 = /* @__PURE__ */ scoped2(Terminal, /* @__PURE__ */ make6(defaultShouldQuit));
|
|
25356
25367
|
|
|
25357
25368
|
// node_modules/@effect/platform-node-shared/dist/esm/NodeTerminal.js
|
|
25358
|
-
var
|
|
25369
|
+
var layer9 = layer8;
|
|
25359
25370
|
|
|
25360
25371
|
// node_modules/@effect/platform-node/dist/esm/internal/worker.js
|
|
25361
25372
|
var platformWorkerImpl = /* @__PURE__ */ makePlatform()({
|
|
@@ -25422,7 +25433,7 @@ var layerManager2 = /* @__PURE__ */ provide2(layerManager, layerWorker);
|
|
|
25422
25433
|
var layerManager3 = layerManager2;
|
|
25423
25434
|
|
|
25424
25435
|
// node_modules/@effect/platform-node/dist/esm/NodeContext.js
|
|
25425
|
-
var
|
|
25436
|
+
var layer11 = /* @__PURE__ */ pipe(/* @__PURE__ */ mergeAll(layer7, layer5, layer9, layerManager3), /* @__PURE__ */ provideMerge(layer2));
|
|
25426
25437
|
|
|
25427
25438
|
// node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
|
|
25428
25439
|
var NodeRuntime_exports = {};
|
|
@@ -25465,13 +25476,6 @@ var runMain2 = runMain;
|
|
|
25465
25476
|
// node_modules/@effect/platform-node/dist/esm/NodeRuntime.js
|
|
25466
25477
|
var runMain3 = runMain2;
|
|
25467
25478
|
|
|
25468
|
-
// node_modules/@effect/platform-node/dist/esm/NodeFileSystem.js
|
|
25469
|
-
var NodeFileSystem_exports2 = {};
|
|
25470
|
-
__export(NodeFileSystem_exports2, {
|
|
25471
|
-
layer: () => layer11
|
|
25472
|
-
});
|
|
25473
|
-
var layer11 = layer4;
|
|
25474
|
-
|
|
25475
25479
|
// node_modules/@effect/platform-node/dist/esm/Undici.js
|
|
25476
25480
|
var Undici_exports = {};
|
|
25477
25481
|
__export(Undici_exports, {
|
|
@@ -25480,81 +25484,8 @@ __export(Undici_exports, {
|
|
|
25480
25484
|
var import_undici = __toESM(require_undici(), 1);
|
|
25481
25485
|
__reExport(Undici_exports, __toESM(require_undici(), 1));
|
|
25482
25486
|
|
|
25483
|
-
// src/
|
|
25484
|
-
var
|
|
25485
|
-
switch (error._tag) {
|
|
25486
|
-
case "ExecError":
|
|
25487
|
-
return `Command failed in sandbox (${error.command}): ${error.message}`;
|
|
25488
|
-
case "ExecHostError":
|
|
25489
|
-
return `Command failed on host (${error.command}): ${error.message}`;
|
|
25490
|
-
case "CopyError":
|
|
25491
|
-
return `File copy failed: ${error.message}`;
|
|
25492
|
-
case "DockerError":
|
|
25493
|
-
return `Docker operation failed: ${error.message}. Is Docker running?`;
|
|
25494
|
-
case "PodmanError":
|
|
25495
|
-
return `Podman operation failed: ${error.message}. Is Podman running?`;
|
|
25496
|
-
case "SyncError":
|
|
25497
|
-
return `Git sync failed: ${error.message}`;
|
|
25498
|
-
case "WorktreeError":
|
|
25499
|
-
return `Git worktree operation failed: ${error.message}`;
|
|
25500
|
-
case "PromptError":
|
|
25501
|
-
return `Failed to resolve prompt: ${error.message}`;
|
|
25502
|
-
case "AgentError":
|
|
25503
|
-
return `Agent invocation failed: ${error.message}`;
|
|
25504
|
-
case "ConfigDirError":
|
|
25505
|
-
return `${error.message}`;
|
|
25506
|
-
case "InitError":
|
|
25507
|
-
return `${error.message}`;
|
|
25508
|
-
case "AgentIdleTimeoutError":
|
|
25509
|
-
case "WorktreeTimeoutError":
|
|
25510
|
-
case "ContainerStartTimeoutError":
|
|
25511
|
-
case "CopyToWorktreeTimeoutError":
|
|
25512
|
-
case "CopyToWorktreeError":
|
|
25513
|
-
case "SyncInTimeoutError":
|
|
25514
|
-
case "HookTimeoutError":
|
|
25515
|
-
case "GitSetupTimeoutError":
|
|
25516
|
-
case "PromptExpansionTimeoutError":
|
|
25517
|
-
case "CommitCollectionTimeoutError":
|
|
25518
|
-
case "MergeToHostTimeoutError":
|
|
25519
|
-
case "SessionCaptureError":
|
|
25520
|
-
case "CwdError":
|
|
25521
|
-
return error.message;
|
|
25522
|
-
}
|
|
25523
|
-
};
|
|
25524
|
-
var showErrorAndExit = (error) => Effect_exports.gen(function* () {
|
|
25525
|
-
const d = yield* Display;
|
|
25526
|
-
yield* d.status(formatErrorMessage(error), "error");
|
|
25527
|
-
return yield* Effect_exports.sync(() => process.exit(1));
|
|
25528
|
-
});
|
|
25529
|
-
var withFriendlyErrors = (effect2) => (
|
|
25530
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25531
|
-
Effect_exports.catchTags(effect2, {
|
|
25532
|
-
ExecError: showErrorAndExit,
|
|
25533
|
-
ExecHostError: showErrorAndExit,
|
|
25534
|
-
CopyError: showErrorAndExit,
|
|
25535
|
-
DockerError: showErrorAndExit,
|
|
25536
|
-
PodmanError: showErrorAndExit,
|
|
25537
|
-
SyncError: showErrorAndExit,
|
|
25538
|
-
WorktreeError: showErrorAndExit,
|
|
25539
|
-
PromptError: showErrorAndExit,
|
|
25540
|
-
AgentError: showErrorAndExit,
|
|
25541
|
-
ConfigDirError: showErrorAndExit,
|
|
25542
|
-
InitError: showErrorAndExit,
|
|
25543
|
-
AgentIdleTimeoutError: showErrorAndExit,
|
|
25544
|
-
WorktreeTimeoutError: showErrorAndExit,
|
|
25545
|
-
ContainerStartTimeoutError: showErrorAndExit,
|
|
25546
|
-
CopyToWorktreeTimeoutError: showErrorAndExit,
|
|
25547
|
-
CopyToWorktreeError: showErrorAndExit,
|
|
25548
|
-
SyncInTimeoutError: showErrorAndExit,
|
|
25549
|
-
HookTimeoutError: showErrorAndExit,
|
|
25550
|
-
GitSetupTimeoutError: showErrorAndExit,
|
|
25551
|
-
PromptExpansionTimeoutError: showErrorAndExit,
|
|
25552
|
-
CommitCollectionTimeoutError: showErrorAndExit,
|
|
25553
|
-
MergeToHostTimeoutError: showErrorAndExit,
|
|
25554
|
-
SessionCaptureError: showErrorAndExit,
|
|
25555
|
-
CwdError: showErrorAndExit
|
|
25556
|
-
})
|
|
25557
|
-
);
|
|
25487
|
+
// src/NativeSandboxUnavailableError.ts
|
|
25488
|
+
var NativeSandboxUnavailableError2 = NativeSandboxUnavailableError;
|
|
25558
25489
|
/*! Bundled license information:
|
|
25559
25490
|
|
|
25560
25491
|
undici/lib/web/fetch/body.js:
|
|
@@ -25564,6 +25495,6 @@ undici/lib/web/websocket/frame.js:
|
|
|
25564
25495
|
(*! ws. MIT License. Einar Otto Stangvik <einaros@gmail.com> *)
|
|
25565
25496
|
*/
|
|
25566
25497
|
|
|
25567
|
-
export {
|
|
25568
|
-
//# sourceMappingURL=chunk-
|
|
25569
|
-
//# sourceMappingURL=chunk-
|
|
25498
|
+
export { NativeSandboxUnavailableError2 as NativeSandboxUnavailableError, NodeContext_exports, NodeFileSystem_exports, NodeRuntime_exports };
|
|
25499
|
+
//# sourceMappingURL=chunk-A4C2FG74.js.map
|
|
25500
|
+
//# sourceMappingURL=chunk-A4C2FG74.js.map
|