@open-insight/core 0.0.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.
@@ -0,0 +1,725 @@
1
+ import { Context, Crypto, Effect, FileSystem, Layer, Path, PlatformError, Schema, Scope, Stream } from "effect";
2
+ import { HttpClient } from "effect/unstable/http";
3
+ import { ChildProcessHandle, ChildProcessSpawner, ExitCode } from "effect/unstable/process/ChildProcessSpawner";
4
+ import { ChildProcess } from "effect/unstable/process";
5
+ import { AiError, Prompt, Response } from "effect/unstable/ai";
6
+ import { AssistantMessage, Message, Prompt as Prompt$1, Prompt as Trajectory, SystemMessage, ToolMessage, UserMessage } from "effect/unstable/ai/Prompt";
7
+ import { Command } from "effect/unstable/process/ChildProcess";
8
+
9
+ //#region src/sandbox/snapshot/schema.d.ts
10
+ /**
11
+ * OCI image reference (e.g. `docker.io/library/node:18-alpine`).
12
+ */
13
+ declare const Image: Schema.String;
14
+ type Image = Schema.Schema.Type<typeof Image>;
15
+ declare const Snapshot_base: Schema.Class<Snapshot, Schema.Struct<{
16
+ readonly image: Schema.String;
17
+ readonly instructions: Schema.$Array<Schema.TaggedUnion<{
18
+ readonly Cmd: Schema.TaggedStruct<"Cmd", {
19
+ readonly cmd: Schema.$Array<Schema.String>;
20
+ }>;
21
+ readonly Copy: Schema.TaggedStruct<"Copy", {
22
+ readonly src: Schema.$Array<Schema.String>;
23
+ readonly dest: Schema.String;
24
+ }>;
25
+ readonly Entrypoint: Schema.TaggedStruct<"Entrypoint", {
26
+ readonly cmd: Schema.$Array<Schema.String>;
27
+ }>;
28
+ readonly Env: Schema.TaggedStruct<"Env", {
29
+ readonly env: Schema.$Record<Schema.String, Schema.String>;
30
+ }>;
31
+ readonly Run: Schema.TaggedStruct<"Run", {
32
+ readonly cmd: Schema.String;
33
+ }>;
34
+ readonly User: Schema.TaggedStruct<"User", {
35
+ readonly user: Schema.String;
36
+ }>;
37
+ readonly Workdir: Schema.TaggedStruct<"Workdir", {
38
+ readonly path: Schema.String;
39
+ }>;
40
+ }>>;
41
+ }>, {}>;
42
+ declare class Snapshot extends Snapshot_base {}
43
+ /**
44
+ * The name of the snapshot.
45
+ *
46
+ * Each snapshot must use this name and mapped to different hash tags.
47
+ */
48
+ declare const SNAPSHOT_NAME = "open-insight-snapshot";
49
+ declare const make$3: typeof Snapshot.make;
50
+ //#endregion
51
+ //#region src/sandbox/snapshot/decode.d.ts
52
+ declare const Containerfile: Schema.decodeTo<typeof Snapshot, Schema.String, never, never>;
53
+ declare const encode: (snapshot: Snapshot) => Effect.Effect<string, Schema.SchemaError, never>;
54
+ declare const decode: (containerfile: string) => Effect.Effect<Snapshot, Schema.SchemaError, never>;
55
+ declare namespace instruction_d_exports {
56
+ export { Instruction, Instructions, assert, available, cmd, copy, entrypoint, env, make$2 as make, run, user, workdir };
57
+ }
58
+ declare const Instruction: Schema.TaggedUnion<{
59
+ readonly Cmd: Schema.TaggedStruct<"Cmd", {
60
+ readonly cmd: Schema.$Array<Schema.String>;
61
+ }>;
62
+ readonly Copy: Schema.TaggedStruct<"Copy", {
63
+ readonly src: Schema.$Array<Schema.String>;
64
+ readonly dest: Schema.String;
65
+ }>;
66
+ readonly Entrypoint: Schema.TaggedStruct<"Entrypoint", {
67
+ readonly cmd: Schema.$Array<Schema.String>;
68
+ }>;
69
+ readonly Env: Schema.TaggedStruct<"Env", {
70
+ readonly env: Schema.$Record<Schema.String, Schema.String>;
71
+ }>;
72
+ readonly Run: Schema.TaggedStruct<"Run", {
73
+ readonly cmd: Schema.String;
74
+ }>;
75
+ readonly User: Schema.TaggedStruct<"User", {
76
+ /**
77
+ * Accepts either `"user"` or `"user:group"`.
78
+ */
79
+ readonly user: Schema.String;
80
+ }>;
81
+ readonly Workdir: Schema.TaggedStruct<"Workdir", {
82
+ readonly path: Schema.String;
83
+ }>;
84
+ }>;
85
+ type Instruction = Schema.Schema.Type<typeof Instruction>;
86
+ declare const workdir: (workdir: string) => Instruction;
87
+ declare const user: (user: string) => Instruction;
88
+ declare const run: (cmd: string) => Instruction;
89
+ declare const assert: (...cmd: string[]) => Instruction;
90
+ declare const available: (...program: string[]) => Instruction;
91
+ declare const env: (env: Record<string, string>) => Instruction;
92
+ declare const copy: (src: string[], dest: string) => Instruction;
93
+ declare const cmd: (cmd: string[]) => Instruction;
94
+ declare const entrypoint: (cmd: string[]) => Instruction;
95
+ declare const Instructions: Schema.$Array<Schema.TaggedUnion<{
96
+ readonly Cmd: Schema.TaggedStruct<"Cmd", {
97
+ readonly cmd: Schema.$Array<Schema.String>;
98
+ }>;
99
+ readonly Copy: Schema.TaggedStruct<"Copy", {
100
+ readonly src: Schema.$Array<Schema.String>;
101
+ readonly dest: Schema.String;
102
+ }>;
103
+ readonly Entrypoint: Schema.TaggedStruct<"Entrypoint", {
104
+ readonly cmd: Schema.$Array<Schema.String>;
105
+ }>;
106
+ readonly Env: Schema.TaggedStruct<"Env", {
107
+ readonly env: Schema.$Record<Schema.String, Schema.String>;
108
+ }>;
109
+ readonly Run: Schema.TaggedStruct<"Run", {
110
+ readonly cmd: Schema.String;
111
+ }>;
112
+ readonly User: Schema.TaggedStruct<"User", {
113
+ /**
114
+ * Accepts either `"user"` or `"user:group"`.
115
+ */
116
+ readonly user: Schema.String;
117
+ }>;
118
+ readonly Workdir: Schema.TaggedStruct<"Workdir", {
119
+ readonly path: Schema.String;
120
+ }>;
121
+ }>>;
122
+ type Instructions = Schema.Schema.Type<typeof Instructions>;
123
+ declare const make$2: (...instructions: Instruction[]) => Instructions;
124
+ //#endregion
125
+ //#region src/sandbox/snapshot/derive.d.ts
126
+ declare const hash: (snapshot: Snapshot) => Effect.Effect<string, import("effect/PlatformError").PlatformError | import("effect/Schema").SchemaError, Crypto.Crypto>;
127
+ /**
128
+ * Get the name of a snapshot. The built snapshot must be tagged with this name.
129
+ *
130
+ * - The name of a snapshot is always `open-insight-snapshot`.
131
+ * - The tag of a snapshot is the SHA-256 hash of the snapshot's content.
132
+ */
133
+ declare const makeName$1: (snapshot: Snapshot) => Effect.Effect<string, import("effect/PlatformError").PlatformError | import("effect/Schema").SchemaError, Crypto.Crypto>;
134
+ /**
135
+ * Create a snapshot from an OCI image reference.
136
+ */
137
+ declare const fromImage: (image: Image) => Snapshot;
138
+ /**
139
+ * Extend an existing snapshot with a set of new instructions, without changing the base image.
140
+ */
141
+ declare const extend: ({
142
+ snapshot,
143
+ instructions
144
+ }: {
145
+ snapshot: Snapshot;
146
+ instructions: Instructions;
147
+ }) => Snapshot;
148
+ /**
149
+ * Derive a new snapshot from an existing snapshot with a set of new instructions.
150
+ *
151
+ * Note that the base image of the given snapshot must exist.
152
+ */
153
+ declare const derive: (args_0: {
154
+ snapshot: Snapshot;
155
+ instructions: Instructions;
156
+ }) => Effect.Effect<Snapshot, import("effect/PlatformError").PlatformError | import("effect/Schema").SchemaError, Crypto.Crypto>;
157
+ //#endregion
158
+ //#region src/sandbox/context/schema.d.ts
159
+ declare const DistFileType: Schema.Literal<".tar.gz">;
160
+ type DistFileType = Schema.Schema.Type<typeof DistFileType>;
161
+ declare const ModeSchema: Schema.TaggedUnion<{
162
+ readonly Cwd: Schema.TaggedStruct<"Cwd", {}>;
163
+ readonly Dir: Schema.TaggedStruct<"Dir", {
164
+ readonly path: Schema.String;
165
+ }>;
166
+ readonly Dist: Schema.TaggedStruct<"Dist", {
167
+ readonly url: Schema.String;
168
+ readonly fileType: Schema.Literal<".tar.gz">;
169
+ }>;
170
+ readonly Script: Schema.TaggedStruct<"Script", {}>;
171
+ }>;
172
+ type Mode = Schema.Schema.Type<typeof ModeSchema>;
173
+ /**
174
+ * Context dir for snapshot update operations.
175
+ *
176
+ * Any file operations (e.g. COPY) must be resolved relative to this path.
177
+ */
178
+ declare const ContextSchema: Schema.String;
179
+ type Context$1 = Schema.Schema.Type<typeof ContextSchema>;
180
+ declare namespace index_d_exports$4 {
181
+ export { Context$1 as Context, ContextSchema, Cwd, DistFileType, Mode, ModeSchema, Script, make$1 as make, makeDir, makeDist, resolve };
182
+ }
183
+ declare const resolve: (mode: import("effect/Schema").Struct.ReadonlySide<{
184
+ readonly _tag: import("effect/Schema").tag<"Cwd">;
185
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
186
+ readonly _tag: import("effect/Schema").tag<"Dir">;
187
+ readonly path: import("effect/Schema").String;
188
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
189
+ readonly _tag: import("effect/Schema").tag<"Dist">;
190
+ readonly url: import("effect/Schema").String;
191
+ readonly fileType: import("effect/Schema").Literal<".tar.gz">;
192
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
193
+ readonly _tag: import("effect/Schema").tag<"Script">;
194
+ }, "Type">) => Effect.Effect<string, SandboxError, ChildProcessSpawner | FileSystem.FileSystem | HttpClient.HttpClient | Path.Path>;
195
+ declare const make$1: typeof ModeSchema.make;
196
+ /**
197
+ * Indicates that the context should be a specific directory.
198
+ */
199
+ declare const makeDir: (path: string) => import("effect/Schema").Struct.ReadonlySide<{
200
+ readonly _tag: import("effect/Schema").tag<"Cwd">;
201
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
202
+ readonly _tag: import("effect/Schema").tag<"Dir">;
203
+ readonly path: import("effect/Schema").String;
204
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
205
+ readonly _tag: import("effect/Schema").tag<"Dist">;
206
+ readonly url: import("effect/Schema").String;
207
+ readonly fileType: import("effect/Schema").Literal<".tar.gz">;
208
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
209
+ readonly _tag: import("effect/Schema").tag<"Script">;
210
+ }, "Type">;
211
+ /**
212
+ * Indicates that the context should be downloaded from a distribution archive.
213
+ */
214
+ declare const makeDist: ({
215
+ url,
216
+ fileType
217
+ }: {
218
+ url: string;
219
+ fileType: DistFileType;
220
+ }) => import("effect/Schema").Struct.ReadonlySide<{
221
+ readonly _tag: import("effect/Schema").tag<"Cwd">;
222
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
223
+ readonly _tag: import("effect/Schema").tag<"Dir">;
224
+ readonly path: import("effect/Schema").String;
225
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
226
+ readonly _tag: import("effect/Schema").tag<"Dist">;
227
+ readonly url: import("effect/Schema").String;
228
+ readonly fileType: import("effect/Schema").Literal<".tar.gz">;
229
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
230
+ readonly _tag: import("effect/Schema").tag<"Script">;
231
+ }, "Type">;
232
+ /**
233
+ * Indicates that the context should be the script's directory.
234
+ * This is useful for resolving relative paths in scripts.
235
+ */
236
+ declare const Script: import("effect/Schema").Struct.ReadonlySide<{
237
+ readonly _tag: import("effect/Schema").tag<"Cwd">;
238
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
239
+ readonly _tag: import("effect/Schema").tag<"Dir">;
240
+ readonly path: import("effect/Schema").String;
241
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
242
+ readonly _tag: import("effect/Schema").tag<"Dist">;
243
+ readonly url: import("effect/Schema").String;
244
+ readonly fileType: import("effect/Schema").Literal<".tar.gz">;
245
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
246
+ readonly _tag: import("effect/Schema").tag<"Script">;
247
+ }, "Type">;
248
+ /**
249
+ * Indicates that the context should be the current working directory.
250
+ */
251
+ declare const Cwd: import("effect/Schema").Struct.ReadonlySide<{
252
+ readonly _tag: import("effect/Schema").tag<"Cwd">;
253
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
254
+ readonly _tag: import("effect/Schema").tag<"Dir">;
255
+ readonly path: import("effect/Schema").String;
256
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
257
+ readonly _tag: import("effect/Schema").tag<"Dist">;
258
+ readonly url: import("effect/Schema").String;
259
+ readonly fileType: import("effect/Schema").Literal<".tar.gz">;
260
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
261
+ readonly _tag: import("effect/Schema").tag<"Script">;
262
+ }, "Type">;
263
+ //#endregion
264
+ //#region src/sandbox/snapshot/build.d.ts
265
+ declare const fromContainerfile: (args_0: {
266
+ context: Mode;
267
+ filePath: string;
268
+ }) => Effect.Effect<Snapshot, import("effect/PlatformError").PlatformError | SandboxError | import("effect/Schema").SchemaError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner | FileSystem.FileSystem | import("effect/unstable/http/HttpClient").HttpClient | Path.Path>;
269
+ declare namespace index_d_exports$3 {
270
+ export { Containerfile, Image, instruction_d_exports as Inst, SNAPSHOT_NAME, Snapshot, decode, derive, encode, extend, fromContainerfile, fromImage, hash, make$3 as make, makeName$1 as makeName };
271
+ }
272
+ declare namespace error_d_exports {
273
+ export { ContextResolveError, InstructionUnsupportedError, ProviderError, SandboxError, SandboxErrorReason, SandboxExecError, SandboxExposeError, SnapshotError, SnapshotUnsupportedError };
274
+ }
275
+ declare const ContextResolveError_base: Schema.Class<ContextResolveError, Schema.TaggedStruct<"ContextResolveError", {
276
+ readonly mode: Schema.TaggedUnion<{
277
+ readonly Cwd: Schema.TaggedStruct<"Cwd", {}>;
278
+ readonly Dir: Schema.TaggedStruct<"Dir", {
279
+ readonly path: Schema.String;
280
+ }>;
281
+ readonly Dist: Schema.TaggedStruct<"Dist", {
282
+ readonly url: Schema.String;
283
+ readonly fileType: Schema.Literal<".tar.gz">;
284
+ }>;
285
+ readonly Script: Schema.TaggedStruct<"Script", {}>;
286
+ }>;
287
+ readonly cause: Schema.Defect;
288
+ }>, import("effect/Cause").YieldableError>;
289
+ declare class ContextResolveError extends ContextResolveError_base {}
290
+ declare const SnapshotError_base: Schema.Class<SnapshotError, Schema.TaggedStruct<"SnapshotError", {
291
+ readonly kind: Schema.Union<readonly [Schema.Literal<"build">, Schema.Literal<"use">]>;
292
+ readonly snapshot: typeof Snapshot;
293
+ readonly cause: Schema.Defect;
294
+ readonly message: Schema.optional<Schema.String>;
295
+ }>, import("effect/Cause").YieldableError>;
296
+ declare class SnapshotError extends SnapshotError_base {}
297
+ declare const ProviderError_base: Schema.Class<ProviderError, Schema.TaggedStruct<"ProviderError", {
298
+ readonly name: Schema.String;
299
+ readonly cause: Schema.Defect;
300
+ }>, import("effect/Cause").YieldableError>;
301
+ declare class ProviderError extends ProviderError_base {}
302
+ declare const SandboxExecError_base: Schema.Class<SandboxExecError, Schema.TaggedStruct<"SandboxExecError", {
303
+ readonly name: Schema.String;
304
+ readonly operation: Schema.String;
305
+ readonly cause: Schema.Defect;
306
+ }>, import("effect/Cause").YieldableError>;
307
+ declare class SandboxExecError extends SandboxExecError_base {}
308
+ declare const SandboxExposeError_base: Schema.Class<SandboxExposeError, Schema.TaggedStruct<"SandboxExposeError", {
309
+ readonly name: Schema.String;
310
+ readonly sandboxPort: Schema.Number;
311
+ readonly hostPort: Schema.Number;
312
+ readonly cause: Schema.Defect;
313
+ }>, import("effect/Cause").YieldableError>;
314
+ declare class SandboxExposeError extends SandboxExposeError_base {}
315
+ declare const SnapshotUnsupportedError_base: Schema.Class<SnapshotUnsupportedError, Schema.TaggedStruct<"SnapshotUnsupportedError", {
316
+ readonly name: Schema.String;
317
+ readonly snapshot: typeof Snapshot;
318
+ readonly cause: Schema.Defect;
319
+ }>, import("effect/Cause").YieldableError>;
320
+ declare class SnapshotUnsupportedError extends SnapshotUnsupportedError_base {}
321
+ declare const InstructionUnsupportedError_base: Schema.Class<InstructionUnsupportedError, Schema.TaggedStruct<"InstructionUnsupportedError", {
322
+ readonly name: Schema.String;
323
+ readonly snapshot: typeof Snapshot;
324
+ readonly instruction: Schema.TaggedUnion<{
325
+ readonly Cmd: Schema.TaggedStruct<"Cmd", {
326
+ readonly cmd: Schema.$Array<Schema.String>;
327
+ }>;
328
+ readonly Copy: Schema.TaggedStruct<"Copy", {
329
+ readonly src: Schema.$Array<Schema.String>;
330
+ readonly dest: Schema.String;
331
+ }>;
332
+ readonly Entrypoint: Schema.TaggedStruct<"Entrypoint", {
333
+ readonly cmd: Schema.$Array<Schema.String>;
334
+ }>;
335
+ readonly Env: Schema.TaggedStruct<"Env", {
336
+ readonly env: Schema.$Record<Schema.String, Schema.String>;
337
+ }>;
338
+ readonly Run: Schema.TaggedStruct<"Run", {
339
+ readonly cmd: Schema.String;
340
+ }>;
341
+ readonly User: Schema.TaggedStruct<"User", {
342
+ readonly user: Schema.String;
343
+ }>;
344
+ readonly Workdir: Schema.TaggedStruct<"Workdir", {
345
+ readonly path: Schema.String;
346
+ }>;
347
+ }>;
348
+ }>, import("effect/Cause").YieldableError>;
349
+ declare class InstructionUnsupportedError extends InstructionUnsupportedError_base {}
350
+ declare const SandboxErrorReason: Schema.Union<readonly [typeof ContextResolveError, typeof ProviderError, typeof SnapshotError, typeof SandboxExecError, typeof SandboxExposeError, typeof SnapshotUnsupportedError, typeof InstructionUnsupportedError]>;
351
+ declare const SandboxError_base: Schema.Class<SandboxError, Schema.TaggedStruct<"SandboxError", {
352
+ readonly reason: Schema.Union<readonly [typeof ContextResolveError, typeof ProviderError, typeof SnapshotError, typeof SandboxExecError, typeof SandboxExposeError, typeof SnapshotUnsupportedError, typeof InstructionUnsupportedError]>;
353
+ }>, import("effect/Cause").YieldableError>;
354
+ declare class SandboxError extends SandboxError_base {
355
+ static contextResolve: (mode: Mode) => (cause: unknown) => SandboxError;
356
+ static provider: (name: string) => (cause: unknown) => SandboxError;
357
+ static snapshotBuild: (snapshot: Snapshot) => (cause: unknown) => SandboxError;
358
+ static snapshotUsage: (snapshot: Snapshot) => (cause: unknown) => SandboxError;
359
+ static sandboxExec: ({
360
+ name,
361
+ operation
362
+ }: {
363
+ name: string;
364
+ operation: string;
365
+ }) => (cause: unknown) => SandboxError;
366
+ static sandboxExpose: ({
367
+ name,
368
+ sandboxPort,
369
+ hostPort
370
+ }: {
371
+ name: string;
372
+ sandboxPort: number;
373
+ hostPort: number;
374
+ }) => (cause: unknown) => SandboxError;
375
+ static snapshotUnsupported: (name: string, snapshot: Snapshot) => (cause: unknown) => SandboxError;
376
+ static instructionUnsupported: (name: string, snapshot: Snapshot, instruction: Instruction) => SandboxError;
377
+ }
378
+ //#endregion
379
+ //#region src/sandbox/resource.d.ts
380
+ declare const ResourceLimitsSchema: Schema.Struct<{
381
+ readonly numCPUs: Schema.optionalKey<Schema.Number>;
382
+ readonly numGPUs: Schema.optionalKey<Schema.Int>;
383
+ readonly memoryMiB: Schema.optionalKey<Schema.Int>;
384
+ readonly diskMiB: Schema.optionalKey<Schema.Int>;
385
+ }>;
386
+ type ResourceLimits = Schema.Schema.Type<typeof ResourceLimitsSchema>;
387
+ //#endregion
388
+ //#region ../utils/dist/index.d.mts
389
+ //#region src/spawn.d.ts
390
+ declare namespace spawn_d_exports {
391
+ export { SpawnError, SpawnErrorReason, SpawnExitCodeError, SpawnService };
392
+ }
393
+ declare const SpawnExitCodeError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
394
+ readonly _tag: "SpawnExitCodeError";
395
+ } & Readonly<A>;
396
+ declare class SpawnExitCodeError extends SpawnExitCodeError_base<{
397
+ readonly exitCode: ExitCode;
398
+ readonly stdout: string;
399
+ readonly stderr: string;
400
+ }> {
401
+ get message(): string;
402
+ }
403
+ type SpawnErrorReason = PlatformError.PlatformError | SpawnExitCodeError;
404
+ declare const SpawnError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P] }>) => import("effect/Cause").YieldableError & {
405
+ readonly _tag: "SpawnError";
406
+ } & Readonly<A>;
407
+ declare class SpawnError extends SpawnError_base<{
408
+ readonly reason: SpawnErrorReason;
409
+ }> {
410
+ get message(): string;
411
+ static platform: (err: PlatformError.PlatformError) => SpawnError;
412
+ static exit: ({
413
+ exitCode,
414
+ stdout,
415
+ stderr
416
+ }: {
417
+ exitCode: ExitCode;
418
+ stdout: string;
419
+ stderr: string;
420
+ }) => SpawnError;
421
+ }
422
+ declare const SpawnService_base: Context.ServiceClass<SpawnService, "packages/utils/SpawnService", {
423
+ spawn(command: Command): Effect.Effect<ChildProcessHandle, SpawnError, Scope.Scope>;
424
+ exitCode(command: Command): Effect.Effect<ExitCode, SpawnError>;
425
+ streamString(command: Command, options?: {
426
+ readonly includeStderr?: boolean | undefined;
427
+ }): Stream.Stream<string, SpawnError>;
428
+ streamLines(command: Command, options?: {
429
+ readonly includeStderr?: boolean | undefined;
430
+ }): Stream.Stream<string, SpawnError>;
431
+ string(command: Command, options?: {
432
+ readonly includeStderr?: boolean | undefined;
433
+ }): Effect.Effect<string, SpawnError>;
434
+ lines(command: Command, options?: {
435
+ readonly includeStderr?: boolean | undefined;
436
+ }): Effect.Effect<ReadonlyArray<string>, SpawnError>;
437
+ }>;
438
+ declare class SpawnService extends SpawnService_base {
439
+ static readonly layer: Layer.Layer<SpawnService, never, ChildProcessSpawner>;
440
+ }
441
+ //#endregion
442
+ //#region src/sandbox/sandbox/promise.d.ts
443
+ type SandboxPromise = {
444
+ $(options: {
445
+ command: string;
446
+ args?: string[];
447
+ env?: Record<string, string>;
448
+ cwd?: string;
449
+ }): Promise<string>;
450
+ readFile(options: Readonly<{
451
+ sandboxPath: string;
452
+ }>): Promise<string>;
453
+ writeFile(options: Readonly<{
454
+ sandboxPath: string;
455
+ content: string;
456
+ }>): Promise<void>;
457
+ download(options: Readonly<{
458
+ sandboxPath: string;
459
+ hostPath: string;
460
+ }>): Promise<void>;
461
+ upload(options: Readonly<{
462
+ sandboxPath: string;
463
+ hostPath: string;
464
+ }>): Promise<void>;
465
+ expose(options: Readonly<{
466
+ sandboxPort: number;
467
+ hostPort: number;
468
+ }>): Promise<{
469
+ hostUrl: string;
470
+ }>;
471
+ };
472
+ declare const asPromise: (_sandbox: Sandbox) => SandboxPromise;
473
+ //#endregion
474
+ //#region src/sandbox/sandbox/index.d.ts
475
+ declare const SANDBOX_NAME = "open-insight-sandbox";
476
+ declare const makeName: (snapshot: Snapshot) => Effect.Effect<string, import("effect/PlatformError").PlatformError | import("effect/Schema").SchemaError, Crypto.Crypto>;
477
+ type Sandbox = Readonly<{
478
+ $(process: ChildProcess.Command): Effect.Effect<string, SandboxError>;
479
+ readFile(options: Readonly<{
480
+ sandboxPath: string;
481
+ }>): Effect.Effect<string, SandboxError>;
482
+ writeFile(options: Readonly<{
483
+ sandboxPath: string;
484
+ content: string;
485
+ }>): Effect.Effect<void, SandboxError>;
486
+ download(options: Readonly<{
487
+ sandboxPath: string;
488
+ hostPath: string;
489
+ }>): Effect.Effect<void, SandboxError>;
490
+ upload(options: Readonly<{
491
+ sandboxPath: string;
492
+ hostPath: string;
493
+ }>): Effect.Effect<void, SandboxError>;
494
+ expose(options: Readonly<{
495
+ sandboxPort: number;
496
+ hostPort: number;
497
+ }>): Effect.Effect<{
498
+ hostUrl: string;
499
+ }, SandboxError>;
500
+ }>;
501
+ type MakeSandboxOptions = Readonly<{
502
+ $(process: ChildProcess.StandardCommand, stdin?: string): Effect.Effect<string, SandboxError>;
503
+ expose: Sandbox["expose"];
504
+ download: Sandbox["download"] | "rsync";
505
+ upload: Sandbox["upload"] | "rsync";
506
+ readFile: Sandbox["readFile"] | "cat";
507
+ writeFile: Sandbox["writeFile"] | "tee";
508
+ }>;
509
+ declare const make: (args_0: Readonly<{
510
+ $(process: ChildProcess.StandardCommand, stdin?: string): Effect.Effect<string, SandboxError>;
511
+ expose: Sandbox["expose"];
512
+ download: Sandbox["download"] | "rsync";
513
+ upload: Sandbox["upload"] | "rsync";
514
+ readFile: Sandbox["readFile"] | "cat";
515
+ writeFile: Sandbox["writeFile"] | "tee";
516
+ }>) => Effect.Effect<Readonly<{
517
+ $(process: ChildProcess.Command): Effect.Effect<string, SandboxError>;
518
+ readFile(options: Readonly<{
519
+ sandboxPath: string;
520
+ }>): Effect.Effect<string, SandboxError>;
521
+ writeFile(options: Readonly<{
522
+ sandboxPath: string;
523
+ content: string;
524
+ }>): Effect.Effect<void, SandboxError>;
525
+ download(options: Readonly<{
526
+ sandboxPath: string;
527
+ hostPath: string;
528
+ }>): Effect.Effect<void, SandboxError>;
529
+ upload(options: Readonly<{
530
+ sandboxPath: string;
531
+ hostPath: string;
532
+ }>): Effect.Effect<void, SandboxError>;
533
+ expose(options: Readonly<{
534
+ sandboxPort: number;
535
+ hostPort: number;
536
+ }>): Effect.Effect<{
537
+ hostUrl: string;
538
+ }, SandboxError>;
539
+ }>, SandboxError, spawn_d_exports.SpawnService>;
540
+ //#endregion
541
+ //#region src/sandbox/provider/service.d.ts
542
+ type Provider$1 = Readonly<{
543
+ /**
544
+ * Ensure that the given snapshot exists in the provider's storage.
545
+ *
546
+ * The snapshot must be indexed with the hash of the snapshot's containerfile.
547
+ */
548
+ ensureSnapshot(options: Readonly<{
549
+ snapshot: Snapshot;
550
+ context: Mode;
551
+ }>): Effect.Effect<void, SandboxError>;
552
+ /**
553
+ * Derive a new snapshot from an existing snapshot and a set of instructions.
554
+ *
555
+ * The new snapshot must be indexed with the hash of the derived snapshot's containerfile.
556
+ */
557
+ deriveSnapshot(options: Readonly<{
558
+ snapshot: Snapshot;
559
+ context: Mode;
560
+ instructions: Instructions;
561
+ }>): Effect.Effect<void, SandboxError>;
562
+ /**
563
+ * Remove a snapshot from the provider's storage.
564
+ */
565
+ removeSnapshot(options: Readonly<{
566
+ snapshot: Snapshot;
567
+ }>): Effect.Effect<void, SandboxError>;
568
+ /**
569
+ * Run a sandbox with the given snapshot.
570
+ *
571
+ * The sandbox is scoped and will be automatically cleaned up.
572
+ */
573
+ runSandbox(options: Readonly<{
574
+ snapshot: Snapshot;
575
+ resources: ResourceLimits | null;
576
+ }>): Effect.Effect<Sandbox, SandboxError, Scope.Scope>;
577
+ }>;
578
+ declare const ProviderService_base$1: Context.ServiceClass<ProviderService$1, "sandbox/ProviderService", Readonly<{
579
+ /**
580
+ * Ensure that the given snapshot exists in the provider's storage.
581
+ *
582
+ * The snapshot must be indexed with the hash of the snapshot's containerfile.
583
+ */
584
+ ensureSnapshot(options: Readonly<{
585
+ snapshot: Snapshot;
586
+ context: import("effect/Schema").Struct.ReadonlySide<{
587
+ readonly _tag: import("effect/Schema").tag<"Cwd">;
588
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
589
+ readonly _tag: import("effect/Schema").tag<"Dir">;
590
+ readonly path: import("effect/Schema").String;
591
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
592
+ readonly _tag: import("effect/Schema").tag<"Dist">;
593
+ readonly url: import("effect/Schema").String;
594
+ readonly fileType: import("effect/Schema").Literal<".tar.gz">;
595
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
596
+ readonly _tag: import("effect/Schema").tag<"Script">;
597
+ }, "Type">;
598
+ }>): Effect.Effect<void, SandboxError>;
599
+ /**
600
+ * Derive a new snapshot from an existing snapshot and a set of instructions.
601
+ *
602
+ * The new snapshot must be indexed with the hash of the derived snapshot's containerfile.
603
+ */
604
+ deriveSnapshot(options: Readonly<{
605
+ snapshot: Snapshot;
606
+ context: import("effect/Schema").Struct.ReadonlySide<{
607
+ readonly _tag: import("effect/Schema").tag<"Cwd">;
608
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
609
+ readonly _tag: import("effect/Schema").tag<"Dir">;
610
+ readonly path: import("effect/Schema").String;
611
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
612
+ readonly _tag: import("effect/Schema").tag<"Dist">;
613
+ readonly url: import("effect/Schema").String;
614
+ readonly fileType: import("effect/Schema").Literal<".tar.gz">;
615
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
616
+ readonly _tag: import("effect/Schema").tag<"Script">;
617
+ }, "Type">;
618
+ instructions: readonly (import("effect/Schema").Struct.ReadonlySide<{
619
+ readonly _tag: import("effect/Schema").tag<"Cmd">;
620
+ readonly cmd: import("effect/Schema").$Array<import("effect/Schema").String>;
621
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
622
+ readonly _tag: import("effect/Schema").tag<"Copy">;
623
+ readonly src: import("effect/Schema").$Array<import("effect/Schema").String>;
624
+ readonly dest: import("effect/Schema").String;
625
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
626
+ readonly _tag: import("effect/Schema").tag<"Entrypoint">;
627
+ readonly cmd: import("effect/Schema").$Array<import("effect/Schema").String>;
628
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
629
+ readonly _tag: import("effect/Schema").tag<"Env">;
630
+ readonly env: import("effect/Schema").$Record<import("effect/Schema").String, import("effect/Schema").String>;
631
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
632
+ readonly _tag: import("effect/Schema").tag<"Run">;
633
+ readonly cmd: import("effect/Schema").String;
634
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
635
+ readonly _tag: import("effect/Schema").tag<"User">;
636
+ readonly user: import("effect/Schema").String;
637
+ }, "Type"> | import("effect/Schema").Struct.ReadonlySide<{
638
+ readonly _tag: import("effect/Schema").tag<"Workdir">;
639
+ readonly path: import("effect/Schema").String;
640
+ }, "Type">)[];
641
+ }>): Effect.Effect<void, SandboxError>;
642
+ /**
643
+ * Remove a snapshot from the provider's storage.
644
+ */
645
+ removeSnapshot(options: Readonly<{
646
+ snapshot: Snapshot;
647
+ }>): Effect.Effect<void, SandboxError>;
648
+ /**
649
+ * Run a sandbox with the given snapshot.
650
+ *
651
+ * The sandbox is scoped and will be automatically cleaned up.
652
+ */
653
+ runSandbox(options: Readonly<{
654
+ snapshot: Snapshot;
655
+ resources: {
656
+ readonly numCPUs?: number | undefined;
657
+ readonly numGPUs?: number | undefined;
658
+ readonly memoryMiB?: number | undefined;
659
+ readonly diskMiB?: number | undefined;
660
+ } | null;
661
+ }>): Effect.Effect<Sandbox, SandboxError, Scope.Scope>;
662
+ }>>;
663
+ declare class ProviderService$1 extends ProviderService_base$1 {}
664
+ //#endregion
665
+ //#region src/sandbox/provider/utils.d.ts
666
+ declare const bashQuote: (value: string) => string;
667
+ declare const formatBash: (command: ChildProcess.StandardCommand) => string;
668
+ declare namespace index_d_exports$2 {
669
+ export { Provider$1 as Provider, ProviderService$1 as ProviderService, bashQuote, formatBash };
670
+ }
671
+ //#endregion
672
+ //#region src/sandbox/config.d.ts
673
+ type Config = Readonly<{
674
+ cacheSnapshot?: boolean;
675
+ }>;
676
+ //#endregion
677
+ //#region src/agent/error.d.ts
678
+ declare const StreamError_base: Schema.Class<StreamError, Schema.TaggedStruct<"StreamError", {
679
+ readonly cause: Schema.Defect;
680
+ }>, import("effect/Cause").YieldableError>;
681
+ declare class StreamError extends StreamError_base {}
682
+ declare const AgentErrorReason: Schema.Union<readonly [typeof StreamError]>;
683
+ declare const AgentError_base: Schema.Class<AgentError, Schema.TaggedStruct<"AgentError", {
684
+ readonly reason: Schema.Union<readonly [typeof StreamError]>;
685
+ }>, import("effect/Cause").YieldableError>;
686
+ declare class AgentError extends AgentError_base {
687
+ static stream: (error: AiError.AiError) => AgentError;
688
+ }
689
+ declare namespace index_d_exports$1 {
690
+ export { Config, index_d_exports$4 as Context, ContextResolveError, error_d_exports as Error, InstructionUnsupportedError, MakeSandboxOptions, Provider$1 as Provider, ProviderError, ProviderService$1 as ProviderService, ResourceLimits, ResourceLimitsSchema, SANDBOX_NAME, Sandbox, SandboxError, SandboxErrorReason, SandboxExecError, SandboxExposeError, SandboxPromise, index_d_exports$3 as Snapshot, SnapshotError, SnapshotUnsupportedError, asPromise, bashQuote, formatBash, make, makeName };
691
+ }
692
+ //#endregion
693
+ //#region src/agent/service.d.ts
694
+ type Agent = Readonly<{
695
+ trajectory(): Effect.Effect<Prompt$1, AgentError>;
696
+ prompt(options: {
697
+ prompt: ReadonlyArray<Prompt.UserMessage>;
698
+ }): Effect.Effect<Stream.Stream<Response.StreamPart<any>, AgentError>>;
699
+ }>;
700
+ type Provider = Readonly<{
701
+ deriveSnapshot: (options: Readonly<{
702
+ snapshot: Snapshot;
703
+ context: Mode;
704
+ }>) => Effect.Effect<Snapshot, AgentError>;
705
+ runSession(options: Readonly<{
706
+ sandbox: Sandbox;
707
+ }>): Effect.Effect<Agent, AgentError>;
708
+ }>;
709
+ declare const ProviderService_base: Context.ServiceClass<ProviderService, "agent/AgentService", Readonly<{
710
+ deriveSnapshot: (options: Readonly<{
711
+ snapshot: Snapshot;
712
+ context: Mode;
713
+ }>) => Effect.Effect<Snapshot, AgentError>;
714
+ runSession(options: Readonly<{
715
+ sandbox: Sandbox;
716
+ }>): Effect.Effect<Agent, AgentError>;
717
+ }>>;
718
+ declare class ProviderService extends ProviderService_base {}
719
+ declare namespace index_d_exports {
720
+ export { Agent, AgentError, AgentErrorReason, AssistantMessage, Message, Provider, ProviderService, StreamError, SystemMessage, ToolMessage, Trajectory, UserMessage };
721
+ }
722
+ import * as import_effect_unstable_ai from "effect/unstable/ai";
723
+ //#endregion
724
+ export { makeDir as A, makeName$1 as B, ResourceLimits as C, Cwd as D, index_d_exports$3 as E, ModeSchema as F, Snapshot as G, Instructions as H, derive as I, make$3 as K, extend as L, Context$1 as M, ContextSchema as N, Script as O, Mode as P, fromImage as R, asPromise as S, SandboxError as T, instruction_d_exports as U, Instruction as V, Image as W, Provider$1 as _, Trajectory as a, make as b, Agent as c, index_d_exports$1 as d, AgentError as f, formatBash as g, bashQuote as h, ToolMessage as i, makeDist as j, make$1 as k, Provider as l, index_d_exports$2 as m, Message as n, UserMessage as o, Config as p, SystemMessage as r, index_d_exports as s, AssistantMessage as t, ProviderService as u, ProviderService$1 as v, ResourceLimitsSchema as w, SandboxPromise as x, Sandbox as y, hash as z };
725
+ //# sourceMappingURL=index-CmxU7-9a.d.mts.map