@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.
Files changed (77) hide show
  1. package/README.md +3 -3
  2. package/dist/{SandboxProvider-YCL97qco.d.ts → SandboxProvider-CwRLxIXZ.d.ts} +5 -41
  3. package/dist/{chunk-XCYK7I45.js → chunk-4BB7DNPW.js} +3 -3
  4. package/dist/chunk-4BB7DNPW.js.map +1 -0
  5. package/dist/chunk-4GZMUHVO.js +60 -0
  6. package/dist/chunk-4GZMUHVO.js.map +1 -0
  7. package/dist/{chunk-A4C2FG74.js → chunk-7JUTKCHL.js} +43 -42
  8. package/dist/chunk-7JUTKCHL.js.map +1 -0
  9. package/dist/chunk-7PHPLDVS.js +284 -0
  10. package/dist/chunk-7PHPLDVS.js.map +1 -0
  11. package/dist/{chunk-NMQ5Z6YG.js → chunk-BXLS4HRY.js} +15 -4
  12. package/dist/chunk-BXLS4HRY.js.map +1 -0
  13. package/dist/chunk-EM4QNWKF.js +3161 -0
  14. package/dist/chunk-EM4QNWKF.js.map +1 -0
  15. package/dist/chunk-EXYXBRCX.js +60 -0
  16. package/dist/chunk-EXYXBRCX.js.map +1 -0
  17. package/dist/{chunk-LWNC4UTZ.js → chunk-JEQ4IVQM.js} +1520 -5375
  18. package/dist/chunk-JEQ4IVQM.js.map +1 -0
  19. package/dist/{chunk-XCWKLDH4.js → chunk-L3BU47F6.js} +3 -3
  20. package/dist/{chunk-XCWKLDH4.js.map → chunk-L3BU47F6.js.map} +1 -1
  21. package/dist/{chunk-7N7AMUYA.js → chunk-PTJEKJPQ.js} +7 -5
  22. package/dist/chunk-PTJEKJPQ.js.map +1 -0
  23. package/dist/chunk-SAQXFLO2.js +1268 -0
  24. package/dist/chunk-SAQXFLO2.js.map +1 -0
  25. package/dist/{chunk-767EAJVT.js → chunk-TBVRAXYF.js} +3 -3
  26. package/dist/{chunk-767EAJVT.js.map → chunk-TBVRAXYF.js.map} +1 -1
  27. package/dist/{chunk-J5J5YJ5S.js → chunk-VUOXFCWO.js} +3 -3
  28. package/dist/{chunk-J5J5YJ5S.js.map → chunk-VUOXFCWO.js.map} +1 -1
  29. package/dist/{chunk-U42XXICG.js → chunk-WYOGXC72.js} +47 -82
  30. package/dist/chunk-WYOGXC72.js.map +1 -0
  31. package/dist/chunk-YDQW5IOY.js +799 -0
  32. package/dist/chunk-YDQW5IOY.js.map +1 -0
  33. package/dist/index.d.ts +51 -4
  34. package/dist/index.js +892 -2018
  35. package/dist/index.js.map +1 -1
  36. package/dist/main.js +322 -251
  37. package/dist/main.js.map +1 -1
  38. package/dist/sandboxes/bwrap.d.ts +1 -1
  39. package/dist/sandboxes/bwrap.js +9 -14
  40. package/dist/sandboxes/bwrap.js.map +1 -1
  41. package/dist/sandboxes/daytona.d.ts +1 -1
  42. package/dist/sandboxes/daytona.js +183 -136
  43. package/dist/sandboxes/daytona.js.map +1 -1
  44. package/dist/sandboxes/docker.d.ts +23 -1
  45. package/dist/sandboxes/docker.js +7 -3
  46. package/dist/sandboxes/e2b.d.ts +41 -0
  47. package/dist/sandboxes/e2b.js +202 -0
  48. package/dist/sandboxes/e2b.js.map +1 -0
  49. package/dist/sandboxes/modal.d.ts +78 -0
  50. package/dist/sandboxes/modal.js +171 -0
  51. package/dist/sandboxes/modal.js.map +1 -0
  52. package/dist/sandboxes/no-sandbox.d.ts +1 -1
  53. package/dist/sandboxes/no-sandbox.js +1 -1
  54. package/dist/sandboxes/podman.d.ts +27 -4
  55. package/dist/sandboxes/podman.js +19 -43
  56. package/dist/sandboxes/podman.js.map +1 -1
  57. package/dist/sandboxes/seatbelt.d.ts +2 -2
  58. package/dist/sandboxes/seatbelt.js +10 -7
  59. package/dist/sandboxes/seatbelt.js.map +1 -1
  60. package/dist/sandboxes/sprites.d.ts +54 -0
  61. package/dist/sandboxes/sprites.js +219 -0
  62. package/dist/sandboxes/sprites.js.map +1 -0
  63. package/dist/sandboxes/vercel.d.ts +10 -1
  64. package/dist/sandboxes/vercel.js +74 -46
  65. package/dist/sandboxes/vercel.js.map +1 -1
  66. package/dist/templates/parallel-planner/main.mts +43 -21
  67. package/dist/templates/parallel-planner-with-review/main.mts +55 -27
  68. package/dist/templates/sequential-reviewer/main.mts +1 -1
  69. package/package.json +36 -4
  70. package/dist/chunk-4EIVTSOZ.js +0 -93
  71. package/dist/chunk-4EIVTSOZ.js.map +0 -1
  72. package/dist/chunk-7N7AMUYA.js.map +0 -1
  73. package/dist/chunk-A4C2FG74.js.map +0 -1
  74. package/dist/chunk-LWNC4UTZ.js.map +0 -1
  75. package/dist/chunk-NMQ5Z6YG.js.map +0 -1
  76. package/dist/chunk-U42XXICG.js.map +0 -1
  77. package/dist/chunk-XCYK7I45.js.map +0 -1
@@ -0,0 +1,799 @@
1
+ import { createRequire } from 'node:module';
2
+ import { GenericTag, flatMap3, try_, pipe, map4, forEach2, unwrapScoped2, identity, tap, unwrapScoped, tryMap, as, catchTag, succeed2, fail3, fail4, fail5, _void, die, succeed3, bufferChunks, fromChannel, nominal, tagged, Tag, BaseProto, TaggedError2, Defect, Literal, Cause, encodeSync, decodeSync, Data_exports, String$, optional, void_2, flatMap4, match, write, of2, Union, Number$, runCollect, toArray, run, scoped, foldLeftChunks, reduce2, appendAll2, dual, async, isEffect, runFork, tapErrorCause, isInterruptedOnly, logError, TaggedError, effect, gen, Effect_exports, Duration_exports, splitLines, mapChunks, map3, uninterruptibleMask, scope, addFinalizer, sync, runtime, updateContext, omit, Scope, make9, runFork2, unsafeAdd, join2, getOrDefault, currentLoggers, has, defaultLogger, updateAs, remove, add, prettyLoggerDefault, isFailure, make5 as make5$1, complete, onError, forEach, DeferredTypeId, failCause, logWarning, retry, spaced, annotateLogs, interruptible, forkScoped, addFinalizer2, zipRight, interrupt, suspend, fail2, succeed, _await, mapError, pipeArguments, acquireUseRelease, acquireUseRelease2, make8, toChannel, withFiberRuntime, currentContext, getOption, ParentSpan, filter, catchAllCause, isMailbox, orDie, provideService } from './chunk-JEQ4IVQM.js';
3
+ import { __export } from './chunk-6NQPCXSG.js';
4
+ import { resolve } from 'path';
5
+
6
+ createRequire(import.meta.url);
7
+
8
+ // node_modules/@effect/platform/dist/esm/FileSystem.js
9
+ var FileSystem_exports = {};
10
+ __export(FileSystem_exports, {
11
+ FileDescriptor: () => FileDescriptor,
12
+ FileSystem: () => FileSystem,
13
+ FileTypeId: () => FileTypeId,
14
+ GiB: () => GiB2,
15
+ KiB: () => KiB2,
16
+ MiB: () => MiB2,
17
+ PiB: () => PiB2,
18
+ Size: () => Size2,
19
+ TiB: () => TiB2,
20
+ WatchBackend: () => WatchBackend,
21
+ WatchEventCreate: () => WatchEventCreate,
22
+ WatchEventRemove: () => WatchEventRemove,
23
+ WatchEventUpdate: () => WatchEventUpdate,
24
+ isFile: () => isFile,
25
+ layerNoop: () => layerNoop2,
26
+ make: () => make5,
27
+ makeNoop: () => makeNoop2
28
+ });
29
+
30
+ // node_modules/@effect/platform/dist/esm/Error.js
31
+ var TypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Error");
32
+ var Module = /* @__PURE__ */ Literal("Clipboard", "Command", "FileSystem", "KeyValueStore", "Path", "Stream", "Terminal");
33
+ var BadArgument = class extends (/* @__PURE__ */ TaggedError2("@effect/platform/Error/BadArgument")("BadArgument", {
34
+ module: Module,
35
+ method: String$,
36
+ description: /* @__PURE__ */ optional(String$),
37
+ cause: /* @__PURE__ */ optional(Defect)
38
+ })) {
39
+ /**
40
+ * @since 1.0.0
41
+ */
42
+ [TypeId] = TypeId;
43
+ /**
44
+ * @since 1.0.0
45
+ */
46
+ get message() {
47
+ return `${this.module}.${this.method}${this.description ? `: ${this.description}` : ""}`;
48
+ }
49
+ };
50
+ var SystemErrorReason = /* @__PURE__ */ Literal("AlreadyExists", "BadResource", "Busy", "InvalidData", "NotFound", "PermissionDenied", "TimedOut", "UnexpectedEof", "Unknown", "WouldBlock", "WriteZero");
51
+ var SystemError = class extends (/* @__PURE__ */ TaggedError2("@effect/platform/Error/SystemError")("SystemError", {
52
+ reason: SystemErrorReason,
53
+ module: Module,
54
+ method: String$,
55
+ description: /* @__PURE__ */ optional(String$),
56
+ syscall: /* @__PURE__ */ optional(String$),
57
+ pathOrDescriptor: /* @__PURE__ */ optional(/* @__PURE__ */ Union(String$, Number$)),
58
+ cause: /* @__PURE__ */ optional(Defect)
59
+ })) {
60
+ /**
61
+ * @since 1.0.0
62
+ */
63
+ [TypeId] = TypeId;
64
+ /**
65
+ * @since 1.0.0
66
+ */
67
+ get message() {
68
+ return `${this.reason}: ${this.module}.${this.method}${this.pathOrDescriptor !== void 0 ? ` (${this.pathOrDescriptor})` : ""}${this.description ? `: ${this.description}` : ""}`;
69
+ }
70
+ };
71
+
72
+ // node_modules/@effect/platform/dist/esm/internal/fileSystem.js
73
+ var tag = /* @__PURE__ */ GenericTag("@effect/platform/FileSystem");
74
+ var Size = (bytes) => typeof bytes === "bigint" ? bytes : BigInt(bytes);
75
+ var KiB = (n) => Size(n * 1024);
76
+ var MiB = (n) => Size(n * 1024 * 1024);
77
+ var GiB = (n) => Size(n * 1024 * 1024 * 1024);
78
+ var TiB = (n) => Size(n * 1024 * 1024 * 1024 * 1024);
79
+ var bigint1024 = /* @__PURE__ */ BigInt(1024);
80
+ var bigintPiB = bigint1024 * bigint1024 * bigint1024 * bigint1024 * bigint1024;
81
+ var PiB = (n) => Size(BigInt(n) * bigintPiB);
82
+ var make4 = (impl) => {
83
+ return tag.of({
84
+ ...impl,
85
+ exists: (path) => pipe(impl.access(path), as(true), catchTag("SystemError", (e) => e.reason === "NotFound" ? succeed2(false) : fail3(e))),
86
+ readFileString: (path, encoding) => tryMap(impl.readFile(path), {
87
+ try: (_) => new TextDecoder(encoding).decode(_),
88
+ catch: (cause) => new BadArgument({
89
+ module: "FileSystem",
90
+ method: "readFileString",
91
+ description: "invalid encoding",
92
+ cause
93
+ })
94
+ }),
95
+ stream: (path, options) => pipe(impl.open(path, {
96
+ flag: "r"
97
+ }), options?.offset ? tap((file) => file.seek(options.offset, "start")) : identity, map4((file) => stream(file, options)), unwrapScoped),
98
+ sink: (path, options) => pipe(impl.open(path, {
99
+ flag: "w",
100
+ ...options
101
+ }), map4((file) => forEach2((_) => file.writeAll(_))), unwrapScoped2),
102
+ writeFileString: (path, data, options) => flatMap3(try_({
103
+ try: () => new TextEncoder().encode(data),
104
+ catch: (cause) => new BadArgument({
105
+ module: "FileSystem",
106
+ method: "writeFileString",
107
+ description: "could not encode string",
108
+ cause
109
+ })
110
+ }), (_) => impl.writeFile(path, _, options))
111
+ });
112
+ };
113
+ var notFound = (method, path) => new SystemError({
114
+ module: "FileSystem",
115
+ method,
116
+ reason: "NotFound",
117
+ description: "No such file or directory",
118
+ pathOrDescriptor: path
119
+ });
120
+ var makeNoop = (fileSystem) => {
121
+ return {
122
+ access(path) {
123
+ return fail3(notFound("access", path));
124
+ },
125
+ chmod(path) {
126
+ return fail3(notFound("chmod", path));
127
+ },
128
+ chown(path) {
129
+ return fail3(notFound("chown", path));
130
+ },
131
+ copy(path) {
132
+ return fail3(notFound("copy", path));
133
+ },
134
+ copyFile(path) {
135
+ return fail3(notFound("copyFile", path));
136
+ },
137
+ exists() {
138
+ return succeed2(false);
139
+ },
140
+ link(path) {
141
+ return fail3(notFound("link", path));
142
+ },
143
+ makeDirectory() {
144
+ return die("not implemented");
145
+ },
146
+ makeTempDirectory() {
147
+ return die("not implemented");
148
+ },
149
+ makeTempDirectoryScoped() {
150
+ return die("not implemented");
151
+ },
152
+ makeTempFile() {
153
+ return die("not implemented");
154
+ },
155
+ makeTempFileScoped() {
156
+ return die("not implemented");
157
+ },
158
+ open(path) {
159
+ return fail3(notFound("open", path));
160
+ },
161
+ readDirectory(path) {
162
+ return fail3(notFound("readDirectory", path));
163
+ },
164
+ readFile(path) {
165
+ return fail3(notFound("readFile", path));
166
+ },
167
+ readFileString(path) {
168
+ return fail3(notFound("readFileString", path));
169
+ },
170
+ readLink(path) {
171
+ return fail3(notFound("readLink", path));
172
+ },
173
+ realPath(path) {
174
+ return fail3(notFound("realPath", path));
175
+ },
176
+ remove() {
177
+ return _void;
178
+ },
179
+ rename(oldPath) {
180
+ return fail3(notFound("rename", oldPath));
181
+ },
182
+ sink(path) {
183
+ return fail5(notFound("sink", path));
184
+ },
185
+ stat(path) {
186
+ return fail3(notFound("stat", path));
187
+ },
188
+ stream(path) {
189
+ return fail4(notFound("stream", path));
190
+ },
191
+ symlink(fromPath) {
192
+ return fail3(notFound("symlink", fromPath));
193
+ },
194
+ truncate(path) {
195
+ return fail3(notFound("truncate", path));
196
+ },
197
+ utimes(path) {
198
+ return fail3(notFound("utimes", path));
199
+ },
200
+ watch(path) {
201
+ return fail4(notFound("watch", path));
202
+ },
203
+ writeFile(path) {
204
+ return fail3(notFound("writeFile", path));
205
+ },
206
+ writeFileString(path) {
207
+ return fail3(notFound("writeFileString", path));
208
+ },
209
+ ...fileSystem
210
+ };
211
+ };
212
+ var layerNoop = (fileSystem) => succeed3(tag, makeNoop(fileSystem));
213
+ var stream = (file, {
214
+ bufferSize = 16,
215
+ bytesToRead: bytesToRead_,
216
+ chunkSize: chunkSize_ = Size(64 * 1024)
217
+ } = {}) => {
218
+ const bytesToRead = bytesToRead_ !== void 0 ? Size(bytesToRead_) : void 0;
219
+ const chunkSize = Size(chunkSize_);
220
+ function loop(totalBytesRead) {
221
+ if (bytesToRead !== void 0 && bytesToRead <= totalBytesRead) {
222
+ return void_2;
223
+ }
224
+ const toRead = bytesToRead !== void 0 && bytesToRead - totalBytesRead < chunkSize ? bytesToRead - totalBytesRead : chunkSize;
225
+ return flatMap4(file.readAlloc(toRead), match({
226
+ onNone: () => void_2,
227
+ onSome: (buf) => flatMap4(write(of2(buf)), (_) => loop(totalBytesRead + BigInt(buf.length)))
228
+ }));
229
+ }
230
+ return bufferChunks(fromChannel(loop(BigInt(0))), {
231
+ capacity: bufferSize
232
+ });
233
+ };
234
+
235
+ // node_modules/@effect/platform/dist/esm/FileSystem.js
236
+ var Size2 = Size;
237
+ var KiB2 = KiB;
238
+ var MiB2 = MiB;
239
+ var GiB2 = GiB;
240
+ var TiB2 = TiB;
241
+ var PiB2 = PiB;
242
+ var FileSystem = tag;
243
+ var make5 = make4;
244
+ var makeNoop2 = makeNoop;
245
+ var layerNoop2 = layerNoop;
246
+ var FileTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/FileSystem/File");
247
+ var isFile = (u) => typeof u === "object" && u !== null && FileTypeId in u;
248
+ var FileDescriptor = /* @__PURE__ */ nominal();
249
+ var WatchEventCreate = /* @__PURE__ */ tagged("Create");
250
+ var WatchEventUpdate = /* @__PURE__ */ tagged("Update");
251
+ var WatchEventRemove = /* @__PURE__ */ tagged("Remove");
252
+ var WatchBackend = class extends (/* @__PURE__ */ Tag("@effect/platform/FileSystem/WatchBackend")()) {
253
+ };
254
+
255
+ // node_modules/@effect/platform/dist/esm/internal/commandExecutor.js
256
+ var TypeId2 = /* @__PURE__ */ Symbol.for("@effect/platform/CommandExecutor");
257
+ var ProcessTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Process");
258
+ var ExitCode = /* @__PURE__ */ nominal();
259
+ var ProcessId = /* @__PURE__ */ nominal();
260
+ var CommandExecutor = /* @__PURE__ */ GenericTag("@effect/platform/CommandExecutor");
261
+ var makeExecutor = (start2) => {
262
+ const stream3 = (command) => unwrapScoped(map4(start2(command), (process2) => process2.stdout));
263
+ const streamLines2 = (command, encoding) => {
264
+ const decoder = new TextDecoder(encoding);
265
+ return splitLines(mapChunks(stream3(command), map3((bytes) => decoder.decode(bytes))));
266
+ };
267
+ return {
268
+ [TypeId2]: TypeId2,
269
+ start: start2,
270
+ exitCode: (command) => scoped(flatMap3(start2(command), (process2) => process2.exitCode)),
271
+ stream: stream3,
272
+ string: (command, encoding = "utf-8") => {
273
+ const decoder = new TextDecoder(encoding);
274
+ return pipe(start2(command), flatMap3((process2) => run(process2.stdout, collectUint8Array)), map4((bytes) => decoder.decode(bytes)), scoped);
275
+ },
276
+ lines: (command, encoding = "utf-8") => {
277
+ return pipe(streamLines2(command, encoding), runCollect, map4(toArray));
278
+ },
279
+ streamLines: streamLines2
280
+ };
281
+ };
282
+ var collectUint8Array = /* @__PURE__ */ foldLeftChunks(/* @__PURE__ */ new Uint8Array(), (bytes, chunk) => reduce2(chunk, bytes, (acc, curr) => {
283
+ const newArray = new Uint8Array(acc.length + curr.length);
284
+ newArray.set(acc);
285
+ newArray.set(curr, acc.length);
286
+ return newArray;
287
+ }));
288
+
289
+ // node_modules/@effect/platform/dist/esm/internal/command.js
290
+ var CommandTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Command");
291
+ var flatten = (self) => Array.from(flattenLoop(self));
292
+ var flattenLoop = (self) => {
293
+ switch (self._tag) {
294
+ case "StandardCommand": {
295
+ return of2(self);
296
+ }
297
+ case "PipedCommand": {
298
+ return appendAll2(flattenLoop(self.left), flattenLoop(self.right));
299
+ }
300
+ }
301
+ };
302
+ var Proto = {
303
+ [CommandTypeId]: CommandTypeId,
304
+ pipe() {
305
+ return pipeArguments(this, arguments);
306
+ },
307
+ ...BaseProto
308
+ };
309
+ var StandardProto = {
310
+ ...Proto,
311
+ _tag: "StandardCommand",
312
+ toJSON() {
313
+ return {
314
+ _id: "@effect/platform/Command",
315
+ _tag: this._tag,
316
+ command: this.command,
317
+ args: this.args,
318
+ env: Object.fromEntries(this.env),
319
+ cwd: this.cwd.toJSON(),
320
+ shell: this.shell,
321
+ gid: this.gid.toJSON(),
322
+ uid: this.uid.toJSON()
323
+ };
324
+ }
325
+ };
326
+ var makeStandard = (options) => Object.assign(Object.create(StandardProto), options);
327
+ var PipedProto = {
328
+ ...Proto,
329
+ _tag: "PipedCommand",
330
+ toJSON() {
331
+ return {
332
+ _id: "@effect/platform/Command",
333
+ _tag: this._tag,
334
+ left: this.left.toJSON(),
335
+ right: this.right.toJSON()
336
+ };
337
+ }
338
+ };
339
+ var makePiped = (options) => Object.assign(Object.create(PipedProto), options);
340
+ var stdin = /* @__PURE__ */ dual(2, (self, input) => {
341
+ switch (self._tag) {
342
+ case "StandardCommand": {
343
+ return makeStandard({
344
+ ...self,
345
+ stdin: input
346
+ });
347
+ }
348
+ // For piped commands it only makes sense to provide `stdin` for the
349
+ // left-most command as the rest will be piped in.
350
+ case "PipedCommand": {
351
+ return makePiped({
352
+ ...self,
353
+ left: stdin(self.left, input)
354
+ });
355
+ }
356
+ }
357
+ });
358
+
359
+ // node_modules/@effect/platform/dist/esm/Command.js
360
+ var flatten2 = flatten;
361
+ var stdin2 = stdin;
362
+
363
+ // node_modules/@effect/platform/dist/esm/CommandExecutor.js
364
+ var CommandExecutor2 = CommandExecutor;
365
+ var ProcessTypeId2 = ProcessTypeId;
366
+ var ExitCode2 = ExitCode;
367
+ var ProcessId2 = ProcessId;
368
+ var makeExecutor2 = makeExecutor;
369
+
370
+ // node_modules/@effect/platform/dist/esm/internal/effectify.js
371
+ var effectify = (fn, onError2, onSyncError) => (...args) => async((resume) => {
372
+ try {
373
+ fn(...args, (err, result) => {
374
+ if (err) {
375
+ resume(fail3(onError2 ? onError2(err, args) : err));
376
+ } else {
377
+ resume(succeed2(result));
378
+ }
379
+ });
380
+ } catch (err) {
381
+ resume(onSyncError ? fail3(onSyncError(err, args)) : die(err));
382
+ }
383
+ });
384
+
385
+ // node_modules/@effect/platform/dist/esm/Effectify.js
386
+ var effectify2 = effectify;
387
+
388
+ // node_modules/@effect/platform/dist/esm/internal/path.js
389
+ var TypeId3 = /* @__PURE__ */ Symbol.for("@effect/platform/Path");
390
+ var Path = /* @__PURE__ */ GenericTag("@effect/platform/Path");
391
+
392
+ // node_modules/@effect/platform/dist/esm/Path.js
393
+ var TypeId4 = TypeId3;
394
+ var Path2 = Path;
395
+
396
+ // node_modules/@effect/platform/dist/esm/Runtime.js
397
+ var defaultTeardown = (exit, onExit) => {
398
+ onExit(isFailure(exit) && !isInterruptedOnly(exit.cause) ? 1 : 0);
399
+ };
400
+ var addPrettyLogger = (refs, fiberId) => {
401
+ const loggers = getOrDefault(refs, currentLoggers);
402
+ if (!has(loggers, defaultLogger)) {
403
+ return refs;
404
+ }
405
+ return updateAs(refs, {
406
+ fiberId,
407
+ fiberRef: currentLoggers,
408
+ value: loggers.pipe(remove(defaultLogger), add(prettyLoggerDefault))
409
+ });
410
+ };
411
+ var makeRunMain = (f) => dual((args) => isEffect(args[0]), (effect2, options) => {
412
+ const fiber = options?.disableErrorReporting === true ? runFork(effect2, {
413
+ updateRefs: options?.disablePrettyLogger === true ? void 0 : addPrettyLogger
414
+ }) : runFork(tapErrorCause(effect2, (cause) => {
415
+ if (isInterruptedOnly(cause)) {
416
+ return _void;
417
+ }
418
+ return logError(cause);
419
+ }), {
420
+ updateRefs: options?.disablePrettyLogger === true ? void 0 : addPrettyLogger
421
+ });
422
+ const teardown = options?.teardown ?? defaultTeardown;
423
+ return f({
424
+ fiber,
425
+ teardown
426
+ });
427
+ });
428
+
429
+ // node_modules/@effect/platform/dist/esm/internal/terminal.js
430
+ var tag2 = /* @__PURE__ */ GenericTag("@effect/platform/Terminal");
431
+
432
+ // node_modules/@effect/platform/dist/esm/Terminal.js
433
+ var QuitException = class extends (/* @__PURE__ */ TaggedError("QuitException")) {
434
+ };
435
+ var isQuitException = (u) => typeof u === "object" && u != null && "_tag" in u && u._tag === "QuitException";
436
+ var Terminal = tag2;
437
+
438
+ // node_modules/@effect/platform/dist/esm/Transferable.js
439
+ var Collector = class extends (/* @__PURE__ */ Tag("@effect/platform/Transferable/Collector")()) {
440
+ };
441
+ var unsafeMakeCollector = () => {
442
+ let tranferables = [];
443
+ const unsafeAddAll = (transfers) => {
444
+ tranferables.push(...transfers);
445
+ };
446
+ const unsafeRead = () => tranferables;
447
+ const unsafeClear = () => {
448
+ const prev = tranferables;
449
+ tranferables = [];
450
+ return prev;
451
+ };
452
+ return Collector.of({
453
+ unsafeAddAll,
454
+ addAll: (transferables) => sync(() => unsafeAddAll(transferables)),
455
+ unsafeRead,
456
+ read: sync(unsafeRead),
457
+ unsafeClear,
458
+ clear: sync(unsafeClear)
459
+ });
460
+ };
461
+
462
+ // node_modules/@effect/platform/dist/esm/internal/workerError.js
463
+ var WorkerErrorTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/WorkerError");
464
+
465
+ // node_modules/@effect/platform/dist/esm/WorkerError.js
466
+ var WorkerErrorTypeId2 = WorkerErrorTypeId;
467
+ var WorkerError = class extends (/* @__PURE__ */ TaggedError2()("WorkerError", {
468
+ reason: /* @__PURE__ */ Literal("spawn", "decode", "send", "unknown", "encode"),
469
+ cause: Defect
470
+ })) {
471
+ /**
472
+ * @since 1.0.0
473
+ */
474
+ [WorkerErrorTypeId2] = WorkerErrorTypeId2;
475
+ /**
476
+ * @since 1.0.0
477
+ */
478
+ static Cause = /* @__PURE__ */ Cause({
479
+ error: this,
480
+ defect: Defect
481
+ });
482
+ /**
483
+ * @since 1.0.0
484
+ */
485
+ static encodeCause = /* @__PURE__ */ encodeSync(this.Cause);
486
+ /**
487
+ * @since 1.0.0
488
+ */
489
+ static decodeCause = /* @__PURE__ */ decodeSync(this.Cause);
490
+ /**
491
+ * @since 1.0.0
492
+ */
493
+ get message() {
494
+ switch (this.reason) {
495
+ case "send":
496
+ return "An error occurred calling .postMessage";
497
+ case "spawn":
498
+ return "An error occurred while spawning a worker";
499
+ case "decode":
500
+ return "An error occurred during decoding";
501
+ case "encode":
502
+ return "An error occurred during encoding";
503
+ case "unknown":
504
+ return "An unexpected error occurred";
505
+ }
506
+ }
507
+ };
508
+
509
+ // node_modules/@effect/platform/dist/esm/internal/worker.js
510
+ var PlatformWorkerTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Worker/PlatformWorker");
511
+ var PlatformWorker = /* @__PURE__ */ GenericTag("@effect/platform/Worker/PlatformWorker");
512
+ var WorkerManagerTypeId = /* @__PURE__ */ Symbol.for("@effect/platform/Worker/WorkerManager");
513
+ var WorkerManager = /* @__PURE__ */ GenericTag("@effect/platform/Worker/WorkerManager");
514
+ var Spawner = /* @__PURE__ */ GenericTag("@effect/platform/Worker/Spawner");
515
+ var makeManager = /* @__PURE__ */ gen(function* () {
516
+ const platform = yield* PlatformWorker;
517
+ let idCounter = 0;
518
+ return WorkerManager.of({
519
+ [WorkerManagerTypeId]: WorkerManagerTypeId,
520
+ spawn({
521
+ encode,
522
+ initialMessage
523
+ }) {
524
+ return gen(function* () {
525
+ const id = idCounter++;
526
+ let requestIdCounter = 0;
527
+ const requestMap = /* @__PURE__ */ new Map();
528
+ const collector = unsafeMakeCollector();
529
+ const wrappedEncode = encode ? (message) => zipRight(collector.clear, provideService(encode(message), Collector, collector)) : succeed2;
530
+ const readyLatch = yield* make5$1();
531
+ const backing = yield* platform.spawn(id);
532
+ yield* backing.run((message) => {
533
+ if (message[0] === 0) {
534
+ return complete(readyLatch, _void);
535
+ }
536
+ return handleMessage(message[1]);
537
+ }).pipe(onError((cause) => forEach(requestMap.values(), (mailbox) => DeferredTypeId in mailbox ? failCause(mailbox, cause) : mailbox.failCause(cause))), tapErrorCause(logWarning), retry(spaced(1e3)), annotateLogs({
538
+ package: "@effect/platform",
539
+ module: "Worker"
540
+ }), interruptible, forkScoped);
541
+ yield* addFinalizer2(() => zipRight(forEach(requestMap.values(), (mailbox) => DeferredTypeId in mailbox ? interrupt(mailbox) : mailbox.end, {
542
+ discard: true
543
+ }), sync(() => requestMap.clear())));
544
+ const handleMessage = (response) => suspend(() => {
545
+ const mailbox = requestMap.get(response[0]);
546
+ if (!mailbox) return _void;
547
+ switch (response[1]) {
548
+ // data
549
+ case 0: {
550
+ return DeferredTypeId in mailbox ? succeed(mailbox, response[2][0]) : mailbox.offerAll(response[2]);
551
+ }
552
+ // end
553
+ case 1: {
554
+ if (response.length === 2) {
555
+ return DeferredTypeId in mailbox ? interrupt(mailbox) : mailbox.end;
556
+ }
557
+ return DeferredTypeId in mailbox ? succeed(mailbox, response[2][0]) : zipRight(mailbox.offerAll(response[2]), mailbox.end);
558
+ }
559
+ // error / defect
560
+ case 2:
561
+ case 3: {
562
+ if (response[1] === 2) {
563
+ return DeferredTypeId in mailbox ? fail2(mailbox, response[2]) : mailbox.fail(response[2]);
564
+ }
565
+ const cause = WorkerError.decodeCause(response[2]);
566
+ return DeferredTypeId in mailbox ? failCause(mailbox, cause) : mailbox.failCause(cause);
567
+ }
568
+ }
569
+ });
570
+ const executeAcquire = (request, makeMailbox) => withFiberRuntime((fiber) => {
571
+ const context = fiber.getFiberRef(currentContext);
572
+ const span = getOption(context, ParentSpan).pipe(filter((span2) => span2._tag === "Span"));
573
+ const id2 = requestIdCounter++;
574
+ return makeMailbox.pipe(tap((mailbox) => {
575
+ requestMap.set(id2, mailbox);
576
+ return wrappedEncode(request).pipe(tap((payload) => backing.send([id2, 0, payload, span._tag === "Some" ? [span.value.traceId, span.value.spanId, span.value.sampled] : void 0], collector.unsafeRead())), catchAllCause((cause) => isMailbox(mailbox) ? mailbox.failCause(cause) : failCause(mailbox, cause)));
577
+ }), map4((mailbox) => ({
578
+ id: id2,
579
+ mailbox
580
+ })));
581
+ });
582
+ const executeRelease = ({
583
+ id: id2
584
+ }, exit) => {
585
+ const release = sync(() => requestMap.delete(id2));
586
+ return isFailure(exit) ? zipRight(orDie(backing.send([id2, 1])), release) : release;
587
+ };
588
+ const execute = (request) => fromChannel(acquireUseRelease2(executeAcquire(request, make8()), ({
589
+ mailbox
590
+ }) => toChannel(mailbox), executeRelease));
591
+ const executeEffect = (request) => acquireUseRelease(executeAcquire(request, make5$1()), ({
592
+ mailbox
593
+ }) => _await(mailbox), executeRelease);
594
+ yield* _await(readyLatch);
595
+ if (initialMessage) {
596
+ yield* sync(initialMessage).pipe(flatMap3(executeEffect), mapError((cause) => new WorkerError({
597
+ reason: "spawn",
598
+ cause
599
+ })));
600
+ }
601
+ return {
602
+ id,
603
+ execute,
604
+ executeEffect
605
+ };
606
+ });
607
+ }
608
+ });
609
+ });
610
+ var layerManager = /* @__PURE__ */ effect(WorkerManager, makeManager);
611
+ var makePlatform = () => (options) => PlatformWorker.of({
612
+ [PlatformWorkerTypeId]: PlatformWorkerTypeId,
613
+ spawn(id) {
614
+ return gen(function* () {
615
+ const spawn = yield* Spawner;
616
+ let currentPort;
617
+ const buffer = [];
618
+ const run2 = (handler) => uninterruptibleMask((restore) => gen(function* () {
619
+ const scope2 = yield* scope;
620
+ const port = yield* options.setup({
621
+ worker: spawn(id),
622
+ scope: scope2
623
+ });
624
+ currentPort = port;
625
+ yield* addFinalizer(scope2, sync(() => {
626
+ currentPort = void 0;
627
+ }));
628
+ const runtime2 = (yield* runtime()).pipe(updateContext(omit(Scope)));
629
+ const fiberSet = yield* make9();
630
+ const runFork3 = runFork2(runtime2);
631
+ yield* options.listen({
632
+ port,
633
+ scope: scope2,
634
+ emit(data) {
635
+ unsafeAdd(fiberSet, runFork3(handler(data)));
636
+ },
637
+ deferred: fiberSet.deferred
638
+ });
639
+ if (buffer.length > 0) {
640
+ for (const [message, transfers] of buffer) {
641
+ port.postMessage([0, message], transfers);
642
+ }
643
+ buffer.length = 0;
644
+ }
645
+ return yield* restore(join2(fiberSet));
646
+ }).pipe(scoped));
647
+ const send = (message, transfers) => try_({
648
+ try: () => {
649
+ if (currentPort === void 0) {
650
+ buffer.push([message, transfers]);
651
+ } else {
652
+ currentPort.postMessage([0, message], transfers);
653
+ }
654
+ },
655
+ catch: (cause) => new WorkerError({
656
+ reason: "send",
657
+ cause
658
+ })
659
+ });
660
+ return {
661
+ run: run2,
662
+ send
663
+ };
664
+ });
665
+ }
666
+ });
667
+
668
+ // node_modules/@effect/platform/dist/esm/Worker.js
669
+ var makePlatform2 = makePlatform;
670
+ var PlatformWorker2 = PlatformWorker;
671
+ var layerManager2 = layerManager;
672
+ var CwdError = class extends Data_exports.TaggedError("CwdError") {
673
+ };
674
+ var resolveCwd = (cwd) => Effect_exports.gen(function* () {
675
+ const resolved = cwd === void 0 ? resolve(process.cwd()) : resolve(process.cwd(), cwd);
676
+ const fs = yield* FileSystem_exports.FileSystem;
677
+ const stat = yield* fs.stat(resolved).pipe(
678
+ Effect_exports.mapError(
679
+ () => new CwdError({
680
+ message: `cwd does not exist: ${resolved}`,
681
+ cwd: resolved
682
+ })
683
+ )
684
+ );
685
+ if (stat.type !== "Directory") {
686
+ return yield* new CwdError({
687
+ message: `cwd is not a directory: ${resolved}`,
688
+ cwd: resolved
689
+ });
690
+ }
691
+ return yield* fs.realPath(resolved).pipe(
692
+ Effect_exports.mapError(
693
+ () => new CwdError({
694
+ message: `cwd could not be resolved: ${resolved}`,
695
+ cwd: resolved
696
+ })
697
+ )
698
+ );
699
+ });
700
+
701
+ // src/errors.ts
702
+ var ExecError = class extends Data_exports.TaggedError("ExecError") {
703
+ };
704
+ (class extends Data_exports.TaggedError("ExecHostError") {
705
+ });
706
+ var CopyError = class extends Data_exports.TaggedError("CopyError") {
707
+ };
708
+ var BwrapError = class extends Data_exports.TaggedError("BwrapError") {
709
+ };
710
+ var SeatbeltError = class extends Data_exports.TaggedError("SeatbeltError") {
711
+ };
712
+ var DockerError = class extends Data_exports.TaggedError("DockerError") {
713
+ };
714
+ var PodmanError = class extends Data_exports.TaggedError("PodmanError") {
715
+ };
716
+ var ImageNotFoundError = class extends Data_exports.TaggedError("ImageNotFoundError") {
717
+ };
718
+ var SyncError = class extends Data_exports.TaggedError("SyncError") {
719
+ };
720
+ var SyncOutPathError = class extends Data_exports.TaggedError("SyncOutPathError") {
721
+ };
722
+ var NativeInteractiveNotSupportedError = class extends Data_exports.TaggedError(
723
+ "NativeInteractiveNotSupportedError"
724
+ ) {
725
+ };
726
+ var NativeSandboxUnavailableError = class extends Data_exports.TaggedError(
727
+ "NativeSandboxUnavailableError"
728
+ ) {
729
+ };
730
+ var HostGitError = class extends Data_exports.TaggedError("HostGitError") {
731
+ };
732
+ var WorktreeError = class extends Data_exports.TaggedError("WorktreeError") {
733
+ };
734
+ var PromptError = class extends Data_exports.TaggedError("PromptError") {
735
+ };
736
+ var AgentError = class extends Data_exports.TaggedError("AgentError") {
737
+ };
738
+ var ConfigDirError = class extends Data_exports.TaggedError("ConfigDirError") {
739
+ };
740
+ var InitError = class extends Data_exports.TaggedError("InitError") {
741
+ };
742
+ var AgentIdleTimeoutError = class extends Data_exports.TaggedError(
743
+ "AgentIdleTimeoutError"
744
+ ) {
745
+ };
746
+ var WorktreeTimeoutError = class extends Data_exports.TaggedError(
747
+ "WorktreeTimeoutError"
748
+ ) {
749
+ };
750
+ var ContainerStartTimeoutError = class extends Data_exports.TaggedError(
751
+ "ContainerStartTimeoutError"
752
+ ) {
753
+ };
754
+ var CopyToWorktreeTimeoutError = class extends Data_exports.TaggedError(
755
+ "CopyToWorktreeTimeoutError"
756
+ ) {
757
+ };
758
+ var CopyToWorktreeError = class extends Data_exports.TaggedError(
759
+ "CopyToWorktreeError"
760
+ ) {
761
+ };
762
+ var SyncInTimeoutError = class extends Data_exports.TaggedError("SyncInTimeoutError") {
763
+ };
764
+ var HookTimeoutError = class extends Data_exports.TaggedError("HookTimeoutError") {
765
+ };
766
+ var GitSetupTimeoutError = class extends Data_exports.TaggedError(
767
+ "GitSetupTimeoutError"
768
+ ) {
769
+ };
770
+ var PromptExpansionTimeoutError = class extends Data_exports.TaggedError(
771
+ "PromptExpansionTimeoutError"
772
+ ) {
773
+ };
774
+ var CommitCollectionTimeoutError = class extends Data_exports.TaggedError(
775
+ "CommitCollectionTimeoutError"
776
+ ) {
777
+ };
778
+ var MergeToHostTimeoutError = class extends Data_exports.TaggedError(
779
+ "MergeToHostTimeoutError"
780
+ ) {
781
+ };
782
+ var withTimeout = (timeoutMs, onTimeout) => (effect2) => effect2.pipe(
783
+ Effect_exports.timeoutFail({
784
+ duration: Duration_exports.millis(timeoutMs),
785
+ onTimeout
786
+ })
787
+ );
788
+ var ForkNotSupportedError = class extends Data_exports.TaggedError(
789
+ "ForkNotSupportedError"
790
+ ) {
791
+ };
792
+ var SessionCaptureError = class extends Data_exports.TaggedError(
793
+ "SessionCaptureError"
794
+ ) {
795
+ };
796
+
797
+ export { AgentError, AgentIdleTimeoutError, BadArgument, BwrapError, CommandExecutor2 as CommandExecutor, CommitCollectionTimeoutError, ConfigDirError, ContainerStartTimeoutError, CopyError, CopyToWorktreeError, CopyToWorktreeTimeoutError, CwdError, DockerError, ExecError, ExitCode2 as ExitCode, FileDescriptor, FileSystem, FileSystem_exports, FileTypeId, ForkNotSupportedError, GitSetupTimeoutError, HookTimeoutError, HostGitError, ImageNotFoundError, InitError, MergeToHostTimeoutError, NativeInteractiveNotSupportedError, NativeSandboxUnavailableError, Path2 as Path, PlatformWorker2 as PlatformWorker, PodmanError, ProcessId2 as ProcessId, ProcessTypeId2 as ProcessTypeId, PromptError, PromptExpansionTimeoutError, QuitException, SeatbeltError, SessionCaptureError, Size2 as Size, SyncError, SyncInTimeoutError, SyncOutPathError, SystemError, Terminal, TypeId4 as TypeId, WatchBackend, WatchEventCreate, WatchEventRemove, WatchEventUpdate, WorkerError, WorktreeError, WorktreeTimeoutError, effectify2 as effectify, flatten2 as flatten, isQuitException, layerManager2 as layerManager, make5 as make, makeExecutor2 as makeExecutor, makePlatform2 as makePlatform, makeRunMain, resolveCwd, stdin2 as stdin, withTimeout };
798
+ //# sourceMappingURL=chunk-YDQW5IOY.js.map
799
+ //# sourceMappingURL=chunk-YDQW5IOY.js.map