@effect-uai/core 0.5.2 → 0.7.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 +1 -1
- package/dist/{Audio-BfCTGnH3.d.mts → Audio-DPlTsNdz.d.mts} +3 -2
- package/dist/Audio-DPlTsNdz.d.mts.map +1 -0
- package/dist/{Items-BH8xUkoR.d.mts → Items-D8UaXQx_.d.mts} +15 -15
- package/dist/Items-D8UaXQx_.d.mts.map +1 -0
- package/dist/SandboxError-BvKypkJm.d.mts +158 -0
- package/dist/SandboxError-BvKypkJm.d.mts.map +1 -0
- package/dist/{Tool-87ViKCCO.d.mts → Tool-CiFXYjmR.d.mts} +11 -11
- package/dist/{Tool-87ViKCCO.d.mts.map → Tool-CiFXYjmR.d.mts.map} +1 -1
- package/dist/capabilities/Capabilities.d.mts +78 -0
- package/dist/capabilities/Capabilities.d.mts.map +1 -0
- package/dist/capabilities/Capabilities.mjs +65 -0
- package/dist/capabilities/Capabilities.mjs.map +1 -0
- package/dist/domain/Audio.d.mts +1 -1
- package/dist/domain/Audio.mjs.map +1 -1
- package/dist/domain/Items.d.mts +2 -2
- package/dist/domain/Items.mjs +15 -15
- package/dist/domain/Items.mjs.map +1 -1
- package/dist/domain/Music.d.mts +131 -72
- package/dist/domain/Music.d.mts.map +1 -1
- package/dist/domain/Music.mjs +36 -9
- package/dist/domain/Music.mjs.map +1 -1
- package/dist/domain/Transcript.d.mts +8 -2
- package/dist/domain/Transcript.d.mts.map +1 -1
- package/dist/domain/Transcript.mjs.map +1 -1
- package/dist/domain/Turn.d.mts +388 -2
- package/dist/domain/Turn.d.mts.map +1 -0
- package/dist/domain/Turn.mjs +13 -13
- package/dist/domain/Turn.mjs.map +1 -1
- package/dist/embedding-model/Embedding.d.mts +12 -2
- package/dist/embedding-model/Embedding.d.mts.map +1 -1
- package/dist/embedding-model/Embedding.mjs.map +1 -1
- package/dist/embedding-model/EmbeddingModel.d.mts +36 -23
- package/dist/embedding-model/EmbeddingModel.d.mts.map +1 -1
- package/dist/embedding-model/EmbeddingModel.mjs +20 -1
- package/dist/embedding-model/EmbeddingModel.mjs.map +1 -1
- package/dist/embedding-model/EmbeddingModel.test.mjs +15 -3
- package/dist/embedding-model/EmbeddingModel.test.mjs.map +1 -1
- package/dist/index.d.mts +13 -7
- package/dist/index.mjs +9 -3
- package/dist/language-model/LanguageModel.d.mts +5 -5
- package/dist/language-model/LanguageModel.d.mts.map +1 -1
- package/dist/language-model/LanguageModel.mjs.map +1 -1
- package/dist/loop/Loop.d.mts +37 -90
- package/dist/loop/Loop.d.mts.map +1 -1
- package/dist/loop/Loop.mjs +39 -93
- package/dist/loop/Loop.mjs.map +1 -1
- package/dist/loop/Loop.test.mjs +46 -54
- package/dist/loop/Loop.test.mjs.map +1 -1
- package/dist/music-generator/MusicGenerator.d.mts +48 -25
- package/dist/music-generator/MusicGenerator.d.mts.map +1 -1
- package/dist/music-generator/MusicGenerator.mjs +17 -9
- package/dist/music-generator/MusicGenerator.mjs.map +1 -1
- package/dist/music-generator/MusicGenerator.test.mjs +81 -56
- package/dist/music-generator/MusicGenerator.test.mjs.map +1 -1
- package/dist/sandbox/Memory.d.mts +53 -0
- package/dist/sandbox/Memory.d.mts.map +1 -0
- package/dist/sandbox/Memory.mjs +68 -0
- package/dist/sandbox/Memory.mjs.map +1 -0
- package/dist/sandbox/Sandbox.d.mts +717 -0
- package/dist/sandbox/Sandbox.d.mts.map +1 -0
- package/dist/sandbox/Sandbox.mjs +192 -0
- package/dist/sandbox/Sandbox.mjs.map +1 -0
- package/dist/sandbox/SandboxError.d.mts +2 -0
- package/dist/sandbox/SandboxError.mjs +89 -0
- package/dist/sandbox/SandboxError.mjs.map +1 -0
- package/dist/sandbox/SandboxImage.d.mts +28 -0
- package/dist/sandbox/SandboxImage.d.mts.map +1 -0
- package/dist/sandbox/SandboxImage.mjs +32 -0
- package/dist/sandbox/SandboxImage.mjs.map +1 -0
- package/dist/sandbox/SandboxNetwork.d.mts +34 -0
- package/dist/sandbox/SandboxNetwork.d.mts.map +1 -0
- package/dist/sandbox/SandboxNetwork.mjs +36 -0
- package/dist/sandbox/SandboxNetwork.mjs.map +1 -0
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts +84 -3
- package/dist/speech-synthesizer/SpeechSynthesizer.d.mts.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs +32 -2
- package/dist/speech-synthesizer/SpeechSynthesizer.mjs.map +1 -1
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs +59 -5
- package/dist/speech-synthesizer/SpeechSynthesizer.test.mjs.map +1 -1
- package/dist/testing/MockMusicGenerator.d.mts +12 -7
- package/dist/testing/MockMusicGenerator.d.mts.map +1 -1
- package/dist/testing/MockMusicGenerator.mjs +4 -3
- package/dist/testing/MockMusicGenerator.mjs.map +1 -1
- package/dist/testing/MockProvider.d.mts +3 -3
- package/dist/testing/MockProvider.d.mts.map +1 -1
- package/dist/testing/MockProvider.mjs.map +1 -1
- package/dist/testing/MockSandbox.d.mts +604 -0
- package/dist/testing/MockSandbox.d.mts.map +1 -0
- package/dist/testing/MockSandbox.mjs +160 -0
- package/dist/testing/MockSandbox.mjs.map +1 -0
- package/dist/testing/MockSpeechSynthesizer.d.mts +27 -12
- package/dist/testing/MockSpeechSynthesizer.d.mts.map +1 -1
- package/dist/testing/MockSpeechSynthesizer.mjs +75 -51
- package/dist/testing/MockSpeechSynthesizer.mjs.map +1 -1
- package/dist/tool/{Resolvers.d.mts → Approval.d.mts} +27 -27
- package/dist/tool/Approval.d.mts.map +1 -0
- package/dist/tool/{Resolvers.mjs → Approval.mjs} +18 -18
- package/dist/tool/Approval.mjs.map +1 -0
- package/dist/tool/{Resolvers.test.mjs → Approval.test.mjs} +40 -40
- package/dist/tool/Approval.test.mjs.map +1 -0
- package/dist/tool/HistoryCheck.d.mts +6 -6
- package/dist/tool/HistoryCheck.d.mts.map +1 -1
- package/dist/tool/HistoryCheck.mjs +5 -5
- package/dist/tool/HistoryCheck.mjs.map +1 -1
- package/dist/tool/Tool.d.mts +2 -2
- package/dist/tool/Tool.mjs +4 -4
- package/dist/tool/Tool.mjs.map +1 -1
- package/dist/tool/ToolEvent.d.mts +19 -19
- package/dist/tool/ToolEvent.d.mts.map +1 -1
- package/dist/tool/ToolEvent.mjs +8 -8
- package/dist/tool/ToolEvent.mjs.map +1 -1
- package/dist/tool/{Outcome.d.mts → ToolResult.d.mts} +29 -29
- package/dist/tool/ToolResult.d.mts.map +1 -0
- package/dist/tool/ToolResult.mjs +61 -0
- package/dist/tool/ToolResult.mjs.map +1 -0
- package/dist/tool/Toolkit.d.mts +58 -26
- package/dist/tool/Toolkit.d.mts.map +1 -1
- package/dist/tool/Toolkit.mjs +62 -34
- package/dist/tool/Toolkit.mjs.map +1 -1
- package/dist/tool/Toolkit.test.mjs +13 -13
- package/dist/tool/Toolkit.test.mjs.map +1 -1
- package/dist/transcriber/Transcriber.d.mts +11 -10
- package/dist/transcriber/Transcriber.d.mts.map +1 -1
- package/dist/transcriber/Transcriber.mjs.map +1 -1
- package/dist/transcriber/Transcriber.test.mjs +3 -3
- package/dist/transcriber/Transcriber.test.mjs.map +1 -1
- package/package.json +35 -7
- package/src/capabilities/Capabilities.ts +81 -0
- package/src/domain/Audio.ts +2 -1
- package/src/domain/Items.ts +9 -9
- package/src/domain/Music.ts +142 -68
- package/src/domain/Transcript.ts +7 -1
- package/src/domain/Turn.ts +16 -16
- package/src/embedding-model/Embedding.ts +11 -0
- package/src/embedding-model/EmbeddingModel.test.ts +15 -4
- package/src/embedding-model/EmbeddingModel.ts +48 -21
- package/src/index.ts +8 -2
- package/src/language-model/LanguageModel.ts +3 -3
- package/src/loop/Loop.test.ts +93 -91
- package/src/loop/Loop.ts +72 -170
- package/src/music-generator/MusicGenerator.test.ts +78 -53
- package/src/music-generator/MusicGenerator.ts +65 -24
- package/src/sandbox/Memory.ts +128 -0
- package/src/sandbox/Sandbox.ts +639 -0
- package/src/sandbox/SandboxError.ts +140 -0
- package/src/sandbox/SandboxImage.ts +26 -0
- package/src/sandbox/SandboxNetwork.ts +34 -0
- package/src/speech-synthesizer/SpeechSynthesizer.test.ts +92 -3
- package/src/speech-synthesizer/SpeechSynthesizer.ts +109 -0
- package/src/testing/MockMusicGenerator.ts +28 -18
- package/src/testing/MockProvider.ts +21 -20
- package/src/testing/MockSandbox.ts +342 -0
- package/src/testing/MockSpeechSynthesizer.ts +137 -77
- package/src/tool/{Resolvers.test.ts → Approval.test.ts} +45 -54
- package/src/tool/{Resolvers.ts → Approval.ts} +25 -25
- package/src/tool/HistoryCheck.ts +10 -13
- package/src/tool/Tool.ts +13 -15
- package/src/tool/ToolEvent.ts +7 -7
- package/src/tool/{Outcome.ts → ToolResult.ts} +20 -20
- package/src/tool/Toolkit.test.ts +13 -13
- package/src/tool/Toolkit.ts +97 -73
- package/src/transcriber/Transcriber.test.ts +3 -3
- package/src/transcriber/Transcriber.ts +10 -7
- package/dist/Audio-BfCTGnH3.d.mts.map +0 -1
- package/dist/Items-BH8xUkoR.d.mts.map +0 -1
- package/dist/Turn-0CwCAyVe.d.mts +0 -388
- package/dist/Turn-0CwCAyVe.d.mts.map +0 -1
- package/dist/tool/Outcome.d.mts.map +0 -1
- package/dist/tool/Outcome.mjs +0 -61
- package/dist/tool/Outcome.mjs.map +0 -1
- package/dist/tool/Resolvers.d.mts.map +0 -1
- package/dist/tool/Resolvers.mjs.map +0 -1
- package/dist/tool/Resolvers.test.mjs.map +0 -1
- /package/dist/tool/{Resolvers.test.d.mts → Approval.test.d.mts} +0 -0
|
@@ -0,0 +1,717 @@
|
|
|
1
|
+
import { a as SandboxError } from "../SandboxError-BvKypkJm.mjs";
|
|
2
|
+
import { Brand, Context, Data, Duration, Effect, Redacted, Scope, Stream } from "effect";
|
|
3
|
+
import * as _$effect_Unify0 from "effect/Unify";
|
|
4
|
+
|
|
5
|
+
//#region src/sandbox/Sandbox.d.ts
|
|
6
|
+
declare namespace Sandbox_d_exports {
|
|
7
|
+
export { BoundSecret, CommonCreateRequest, CommonExecRequest, CommonSpawnRequest, ExecEvent, ExecResult, FileEntry, FileEntryKind, ImageRef, NetworkPolicy, ProcessHandle, Sandbox, SandboxCustomImage, SandboxFilesystem, SandboxHostnameAllowlist, SandboxId, SandboxInstance, SandboxKernelSession, SandboxPauseResume, SandboxPortExposure, SandboxPortsApi, SandboxPty, SandboxRef, SandboxSecretInjection, SandboxService, SandboxSnapshots, SandboxSnapshotsApi, SandboxVolumes, SandboxVolumesApi, SnapshotId, VolumeId, VolumeMount, attach, create, createVolume, destroy, destroySnapshot, destroyVolume, exposePort, list, listSnapshots, listVolumes, snapshot };
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Sandbox identifier. Branded `string` so providers don't accidentally
|
|
11
|
+
* accept a raw user-supplied id. Each provider mints these per its own
|
|
12
|
+
* naming scheme (uuid for E2B/Vercel, user-supplied name for
|
|
13
|
+
* Microsandbox/Modal, …); the core code treats them opaquely.
|
|
14
|
+
*
|
|
15
|
+
* Mint via the value-level `SandboxId(...)` smart constructor instead
|
|
16
|
+
* of `as SandboxId` casts.
|
|
17
|
+
*/
|
|
18
|
+
type SandboxId = Brand.Branded<string, "SandboxId">;
|
|
19
|
+
declare const SandboxId: Brand.Constructor<SandboxId>;
|
|
20
|
+
/**
|
|
21
|
+
* Reference returned by `list`. Carries just enough to call `attach` —
|
|
22
|
+
* provider-specific metadata (createdAt, region, tags, …) lives on the
|
|
23
|
+
* narrowed per-provider ref.
|
|
24
|
+
*/
|
|
25
|
+
type SandboxRef = {
|
|
26
|
+
readonly id: SandboxId;
|
|
27
|
+
readonly name?: string;
|
|
28
|
+
};
|
|
29
|
+
type VolumeId = Brand.Branded<string, "VolumeId">;
|
|
30
|
+
declare const VolumeId: Brand.Constructor<VolumeId>;
|
|
31
|
+
type SnapshotId = Brand.Branded<string, "SnapshotId">;
|
|
32
|
+
declare const SnapshotId: Brand.Constructor<SnapshotId>;
|
|
33
|
+
/**
|
|
34
|
+
* What runtime / filesystem to boot the sandbox from.
|
|
35
|
+
*
|
|
36
|
+
* - `Default` — provider picks its house image (Vercel: Amazon Linux
|
|
37
|
+
* 2023; Microsandbox: requires user image but a builder default may
|
|
38
|
+
* apply, …). Use when you don't care what's pre-installed.
|
|
39
|
+
* - `Registry` — an OCI image reference. Supported by every provider
|
|
40
|
+
* except those with a fixed base (Vercel ignores this and the
|
|
41
|
+
* request-schema rejects at decode).
|
|
42
|
+
* - `Snapshot` — restore from a captured state. Gated by
|
|
43
|
+
* {@link SandboxSnapshots} at the call site — the marker is provided
|
|
44
|
+
* by adapters whose provider supports snapshot-as-image.
|
|
45
|
+
* - `Dockerfile` — provider builds a custom image from a Dockerfile.
|
|
46
|
+
* Gated by {@link SandboxCustomImage}.
|
|
47
|
+
*/
|
|
48
|
+
type ImageRef = Data.TaggedEnum<{
|
|
49
|
+
Default: {};
|
|
50
|
+
Registry: {
|
|
51
|
+
readonly ref: string;
|
|
52
|
+
};
|
|
53
|
+
Snapshot: {
|
|
54
|
+
readonly id: SnapshotId;
|
|
55
|
+
};
|
|
56
|
+
Dockerfile: {
|
|
57
|
+
readonly contents: string;
|
|
58
|
+
};
|
|
59
|
+
}>;
|
|
60
|
+
declare const ImageRef: {
|
|
61
|
+
readonly Default: Data.TaggedEnum.ConstructorFrom<{
|
|
62
|
+
readonly _tag: "Default";
|
|
63
|
+
}, "_tag">;
|
|
64
|
+
readonly Registry: Data.TaggedEnum.ConstructorFrom<{
|
|
65
|
+
readonly _tag: "Registry";
|
|
66
|
+
readonly ref: string;
|
|
67
|
+
}, "_tag">;
|
|
68
|
+
readonly Snapshot: Data.TaggedEnum.ConstructorFrom<{
|
|
69
|
+
readonly _tag: "Snapshot";
|
|
70
|
+
readonly id: SnapshotId;
|
|
71
|
+
}, "_tag">;
|
|
72
|
+
readonly Dockerfile: Data.TaggedEnum.ConstructorFrom<{
|
|
73
|
+
readonly _tag: "Dockerfile";
|
|
74
|
+
readonly contents: string;
|
|
75
|
+
}, "_tag">;
|
|
76
|
+
readonly $is: <Tag extends "Default" | "Registry" | "Snapshot" | "Dockerfile">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
77
|
+
readonly _tag: "Default";
|
|
78
|
+
}, {
|
|
79
|
+
readonly _tag: Tag;
|
|
80
|
+
}> | Extract<{
|
|
81
|
+
readonly _tag: "Registry";
|
|
82
|
+
readonly ref: string;
|
|
83
|
+
}, {
|
|
84
|
+
readonly _tag: Tag;
|
|
85
|
+
}> | Extract<{
|
|
86
|
+
readonly _tag: "Snapshot";
|
|
87
|
+
readonly id: SnapshotId;
|
|
88
|
+
}, {
|
|
89
|
+
readonly _tag: Tag;
|
|
90
|
+
}> | Extract<{
|
|
91
|
+
readonly _tag: "Dockerfile";
|
|
92
|
+
readonly contents: string;
|
|
93
|
+
}, {
|
|
94
|
+
readonly _tag: Tag;
|
|
95
|
+
}>;
|
|
96
|
+
readonly $match: {
|
|
97
|
+
<Cases extends {
|
|
98
|
+
readonly Default: (args: {
|
|
99
|
+
readonly _tag: "Default";
|
|
100
|
+
}) => any;
|
|
101
|
+
readonly Registry: (args: {
|
|
102
|
+
readonly _tag: "Registry";
|
|
103
|
+
readonly ref: string;
|
|
104
|
+
}) => any;
|
|
105
|
+
readonly Snapshot: (args: {
|
|
106
|
+
readonly _tag: "Snapshot";
|
|
107
|
+
readonly id: SnapshotId;
|
|
108
|
+
}) => any;
|
|
109
|
+
readonly Dockerfile: (args: {
|
|
110
|
+
readonly _tag: "Dockerfile";
|
|
111
|
+
readonly contents: string;
|
|
112
|
+
}) => any;
|
|
113
|
+
}>(cases: Cases): (value: {
|
|
114
|
+
readonly _tag: "Default";
|
|
115
|
+
} | {
|
|
116
|
+
readonly _tag: "Registry";
|
|
117
|
+
readonly ref: string;
|
|
118
|
+
} | {
|
|
119
|
+
readonly _tag: "Snapshot";
|
|
120
|
+
readonly id: SnapshotId;
|
|
121
|
+
} | {
|
|
122
|
+
readonly _tag: "Dockerfile";
|
|
123
|
+
readonly contents: string;
|
|
124
|
+
}) => _$effect_Unify0.Unify<ReturnType<Cases["Default" | "Registry" | "Snapshot" | "Dockerfile"]>>;
|
|
125
|
+
<Cases extends {
|
|
126
|
+
readonly Default: (args: {
|
|
127
|
+
readonly _tag: "Default";
|
|
128
|
+
}) => any;
|
|
129
|
+
readonly Registry: (args: {
|
|
130
|
+
readonly _tag: "Registry";
|
|
131
|
+
readonly ref: string;
|
|
132
|
+
}) => any;
|
|
133
|
+
readonly Snapshot: (args: {
|
|
134
|
+
readonly _tag: "Snapshot";
|
|
135
|
+
readonly id: SnapshotId;
|
|
136
|
+
}) => any;
|
|
137
|
+
readonly Dockerfile: (args: {
|
|
138
|
+
readonly _tag: "Dockerfile";
|
|
139
|
+
readonly contents: string;
|
|
140
|
+
}) => any;
|
|
141
|
+
}>(value: {
|
|
142
|
+
readonly _tag: "Default";
|
|
143
|
+
} | {
|
|
144
|
+
readonly _tag: "Registry";
|
|
145
|
+
readonly ref: string;
|
|
146
|
+
} | {
|
|
147
|
+
readonly _tag: "Snapshot";
|
|
148
|
+
readonly id: SnapshotId;
|
|
149
|
+
} | {
|
|
150
|
+
readonly _tag: "Dockerfile";
|
|
151
|
+
readonly contents: string;
|
|
152
|
+
}, cases: Cases): _$effect_Unify0.Unify<ReturnType<Cases["Default" | "Registry" | "Snapshot" | "Dockerfile"]>>;
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Outbound network policy for a sandbox.
|
|
157
|
+
*
|
|
158
|
+
* - `Open` — no egress restriction. The provider's defaults apply
|
|
159
|
+
* (e.g. Microsandbox's "public-only" still blocks private ranges).
|
|
160
|
+
* - `Blocked` — fully airgapped, no outbound connectivity at all.
|
|
161
|
+
* - `Allowlist` — only the listed hosts / CIDRs may be reached.
|
|
162
|
+
*
|
|
163
|
+
* Providers vary in what they honour: hostname-allowlist requires
|
|
164
|
+
* {@link SandboxHostnameAllowlist}; CIDR-only providers ignore `hosts`
|
|
165
|
+
* and the adapter rejects at decode if `hosts` is non-empty.
|
|
166
|
+
*/
|
|
167
|
+
type NetworkPolicy = Data.TaggedEnum<{
|
|
168
|
+
Open: {};
|
|
169
|
+
Blocked: {};
|
|
170
|
+
Allowlist: {
|
|
171
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
172
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
173
|
+
};
|
|
174
|
+
}>;
|
|
175
|
+
declare const NetworkPolicy: {
|
|
176
|
+
readonly Open: Data.TaggedEnum.ConstructorFrom<{
|
|
177
|
+
readonly _tag: "Open";
|
|
178
|
+
}, "_tag">;
|
|
179
|
+
readonly Blocked: Data.TaggedEnum.ConstructorFrom<{
|
|
180
|
+
readonly _tag: "Blocked";
|
|
181
|
+
}, "_tag">;
|
|
182
|
+
readonly Allowlist: Data.TaggedEnum.ConstructorFrom<{
|
|
183
|
+
readonly _tag: "Allowlist";
|
|
184
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
185
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
186
|
+
}, "_tag">;
|
|
187
|
+
readonly $is: <Tag extends "Open" | "Blocked" | "Allowlist">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
188
|
+
readonly _tag: "Open";
|
|
189
|
+
}, {
|
|
190
|
+
readonly _tag: Tag;
|
|
191
|
+
}> | Extract<{
|
|
192
|
+
readonly _tag: "Blocked";
|
|
193
|
+
}, {
|
|
194
|
+
readonly _tag: Tag;
|
|
195
|
+
}> | Extract<{
|
|
196
|
+
readonly _tag: "Allowlist";
|
|
197
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
198
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
199
|
+
}, {
|
|
200
|
+
readonly _tag: Tag;
|
|
201
|
+
}>;
|
|
202
|
+
readonly $match: {
|
|
203
|
+
<Cases extends {
|
|
204
|
+
readonly Open: (args: {
|
|
205
|
+
readonly _tag: "Open";
|
|
206
|
+
}) => any;
|
|
207
|
+
readonly Blocked: (args: {
|
|
208
|
+
readonly _tag: "Blocked";
|
|
209
|
+
}) => any;
|
|
210
|
+
readonly Allowlist: (args: {
|
|
211
|
+
readonly _tag: "Allowlist";
|
|
212
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
213
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
214
|
+
}) => any;
|
|
215
|
+
}>(cases: Cases): (value: {
|
|
216
|
+
readonly _tag: "Open";
|
|
217
|
+
} | {
|
|
218
|
+
readonly _tag: "Blocked";
|
|
219
|
+
} | {
|
|
220
|
+
readonly _tag: "Allowlist";
|
|
221
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
222
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
223
|
+
}) => _$effect_Unify0.Unify<ReturnType<Cases["Open" | "Blocked" | "Allowlist"]>>;
|
|
224
|
+
<Cases extends {
|
|
225
|
+
readonly Open: (args: {
|
|
226
|
+
readonly _tag: "Open";
|
|
227
|
+
}) => any;
|
|
228
|
+
readonly Blocked: (args: {
|
|
229
|
+
readonly _tag: "Blocked";
|
|
230
|
+
}) => any;
|
|
231
|
+
readonly Allowlist: (args: {
|
|
232
|
+
readonly _tag: "Allowlist";
|
|
233
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
234
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
235
|
+
}) => any;
|
|
236
|
+
}>(value: {
|
|
237
|
+
readonly _tag: "Open";
|
|
238
|
+
} | {
|
|
239
|
+
readonly _tag: "Blocked";
|
|
240
|
+
} | {
|
|
241
|
+
readonly _tag: "Allowlist";
|
|
242
|
+
readonly hosts?: ReadonlyArray<string>;
|
|
243
|
+
readonly cidrs?: ReadonlyArray<string>;
|
|
244
|
+
}, cases: Cases): _$effect_Unify0.Unify<ReturnType<Cases["Open" | "Blocked" | "Allowlist"]>>;
|
|
245
|
+
};
|
|
246
|
+
};
|
|
247
|
+
/**
|
|
248
|
+
* A secret bound to a sandbox at create time. The code inside the
|
|
249
|
+
* sandbox sees only a placeholder (`$MSB_<NAME>` for Microsandbox,
|
|
250
|
+
* `{name}` for Vercel header-injection, etc.); the real `value` lives
|
|
251
|
+
* on the provider's proxy and is substituted on outbound HTTPS to
|
|
252
|
+
* `hosts`.
|
|
253
|
+
*
|
|
254
|
+
* Requires the {@link SandboxSecretInjection} capability marker —
|
|
255
|
+
* provider Layers without proxy-layer secret rewriting do not ship the
|
|
256
|
+
* marker and consumer code fails at `Effect.provide` with a type
|
|
257
|
+
* error.
|
|
258
|
+
*
|
|
259
|
+
* `header` is the request header to inject (default
|
|
260
|
+
* `"Authorization: Bearer <value>"`). Providers that do not let
|
|
261
|
+
* callers pick the header (Microsandbox's `secretEnv` shorthand)
|
|
262
|
+
* silently ignore this field; providers that require an explicit
|
|
263
|
+
* header (Vercel's `transform.headers`) fail at decode if it's absent.
|
|
264
|
+
*/
|
|
265
|
+
type BoundSecret = {
|
|
266
|
+
readonly name: string;
|
|
267
|
+
readonly value: Redacted.Redacted<string>;
|
|
268
|
+
readonly hosts: ReadonlyArray<string>;
|
|
269
|
+
readonly header?: string;
|
|
270
|
+
};
|
|
271
|
+
type VolumeMount = {
|
|
272
|
+
readonly id: VolumeId;
|
|
273
|
+
readonly mountPath: string;
|
|
274
|
+
readonly readonly?: boolean;
|
|
275
|
+
};
|
|
276
|
+
/**
|
|
277
|
+
* Cross-provider create request. Provider-specific knobs (region,
|
|
278
|
+
* cpus, memory, template id, …) live on each provider's narrowed
|
|
279
|
+
* request type which extends this.
|
|
280
|
+
*
|
|
281
|
+
* Fields a provider can't honour fail at **decode time** (per the
|
|
282
|
+
* per-provider request schema), not silently at runtime. The
|
|
283
|
+
* ComputeSDK anti-pattern of "drop unsupported fields" is the
|
|
284
|
+
* footgun we're avoiding.
|
|
285
|
+
*/
|
|
286
|
+
type CommonCreateRequest = {
|
|
287
|
+
/** Image / snapshot to boot from. Omit for the provider's default. */readonly image?: ImageRef;
|
|
288
|
+
/**
|
|
289
|
+
* Idle / hard timeout. Accepts a number (millis), a string like
|
|
290
|
+
* `"30 seconds"`, or a `Duration`. Providers default differently.
|
|
291
|
+
*/
|
|
292
|
+
readonly timeout?: Duration.Input;
|
|
293
|
+
/**
|
|
294
|
+
* Env vars exposed to the sandbox. NOT for secrets you want hidden
|
|
295
|
+
* from the running code — use {@link BoundSecret} instead.
|
|
296
|
+
*/
|
|
297
|
+
readonly env?: Readonly<Record<string, string>>; /** Outbound network policy. */
|
|
298
|
+
readonly network?: NetworkPolicy;
|
|
299
|
+
/**
|
|
300
|
+
* Bound secrets — code inside the sandbox sees a placeholder; the
|
|
301
|
+
* proxy substitutes the real value on outbound HTTPS to listed hosts.
|
|
302
|
+
* Capability-gated on {@link SandboxSecretInjection}.
|
|
303
|
+
*/
|
|
304
|
+
readonly secrets?: ReadonlyArray<BoundSecret>;
|
|
305
|
+
/**
|
|
306
|
+
* Persistent volumes to mount. Volumes are created via
|
|
307
|
+
* `Sandbox.volumes.create` and survive sandbox lifetime.
|
|
308
|
+
* Capability-gated on {@link SandboxVolumes}.
|
|
309
|
+
*/
|
|
310
|
+
readonly volumes?: ReadonlyArray<VolumeMount>;
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Cross-provider exec request. Background / long-running processes
|
|
314
|
+
* use `spawn` instead of `exec`; the semantics differ enough that
|
|
315
|
+
* overloading `exec` with a `detached` flag was rejected during
|
|
316
|
+
* design.
|
|
317
|
+
*/
|
|
318
|
+
type CommonExecRequest = {
|
|
319
|
+
/**
|
|
320
|
+
* Argv-style command. Pass a string for "run this through the
|
|
321
|
+
* shell" semantics (provider-dependent — most use `sh -c`); pass
|
|
322
|
+
* an array for direct argv with no shell parsing.
|
|
323
|
+
*/
|
|
324
|
+
readonly cmd: string | ReadonlyArray<string>;
|
|
325
|
+
readonly cwd?: string;
|
|
326
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
327
|
+
readonly stdin?: string | Uint8Array;
|
|
328
|
+
/**
|
|
329
|
+
* Per-exec timeout. Accepts a number (millis), a string like
|
|
330
|
+
* `"5 seconds"`, or a `Duration`.
|
|
331
|
+
*/
|
|
332
|
+
readonly timeout?: Duration.Input;
|
|
333
|
+
};
|
|
334
|
+
/**
|
|
335
|
+
* Spawn request — extends {@link CommonExecRequest} with the option
|
|
336
|
+
* to provide stdin as a `Stream<Uint8Array>`. The provider takes one
|
|
337
|
+
* chunk at a time and sends EOF when the stream completes. Useful
|
|
338
|
+
* for piping LLM output into a sandboxed process, or feeding stdin
|
|
339
|
+
* from another stream source. `exec` does not accept streams.
|
|
340
|
+
*/
|
|
341
|
+
type CommonSpawnRequest = Omit<CommonExecRequest, "stdin"> & {
|
|
342
|
+
readonly stdin?: string | Uint8Array | Stream.Stream<Uint8Array, never, never>;
|
|
343
|
+
};
|
|
344
|
+
type ExecResult = {
|
|
345
|
+
readonly exitCode: number;
|
|
346
|
+
readonly stdout: string;
|
|
347
|
+
readonly stderr: string;
|
|
348
|
+
readonly durationMs: number;
|
|
349
|
+
};
|
|
350
|
+
/**
|
|
351
|
+
* Streaming exec output. `Complete` is terminal — the stream
|
|
352
|
+
* completes after emitting it.
|
|
353
|
+
*/
|
|
354
|
+
type ExecEvent = Data.TaggedEnum<{
|
|
355
|
+
Stdout: {
|
|
356
|
+
readonly chunk: Uint8Array;
|
|
357
|
+
};
|
|
358
|
+
Stderr: {
|
|
359
|
+
readonly chunk: Uint8Array;
|
|
360
|
+
};
|
|
361
|
+
Complete: {
|
|
362
|
+
readonly exitCode: number;
|
|
363
|
+
readonly durationMs: number;
|
|
364
|
+
};
|
|
365
|
+
}>;
|
|
366
|
+
declare const ExecEvent: {
|
|
367
|
+
readonly Stdout: Data.TaggedEnum.ConstructorFrom<{
|
|
368
|
+
readonly _tag: "Stdout";
|
|
369
|
+
readonly chunk: Uint8Array;
|
|
370
|
+
}, "_tag">;
|
|
371
|
+
readonly Stderr: Data.TaggedEnum.ConstructorFrom<{
|
|
372
|
+
readonly _tag: "Stderr";
|
|
373
|
+
readonly chunk: Uint8Array;
|
|
374
|
+
}, "_tag">;
|
|
375
|
+
readonly Complete: Data.TaggedEnum.ConstructorFrom<{
|
|
376
|
+
readonly _tag: "Complete";
|
|
377
|
+
readonly exitCode: number;
|
|
378
|
+
readonly durationMs: number;
|
|
379
|
+
}, "_tag">;
|
|
380
|
+
readonly $is: <Tag extends "Stdout" | "Stderr" | "Complete">(tag: Tag) => (u: unknown) => u is Extract<{
|
|
381
|
+
readonly _tag: "Stdout";
|
|
382
|
+
readonly chunk: Uint8Array;
|
|
383
|
+
}, {
|
|
384
|
+
readonly _tag: Tag;
|
|
385
|
+
}> | Extract<{
|
|
386
|
+
readonly _tag: "Stderr";
|
|
387
|
+
readonly chunk: Uint8Array;
|
|
388
|
+
}, {
|
|
389
|
+
readonly _tag: Tag;
|
|
390
|
+
}> | Extract<{
|
|
391
|
+
readonly _tag: "Complete";
|
|
392
|
+
readonly exitCode: number;
|
|
393
|
+
readonly durationMs: number;
|
|
394
|
+
}, {
|
|
395
|
+
readonly _tag: Tag;
|
|
396
|
+
}>;
|
|
397
|
+
readonly $match: {
|
|
398
|
+
<Cases extends {
|
|
399
|
+
readonly Stdout: (args: {
|
|
400
|
+
readonly _tag: "Stdout";
|
|
401
|
+
readonly chunk: Uint8Array;
|
|
402
|
+
}) => any;
|
|
403
|
+
readonly Stderr: (args: {
|
|
404
|
+
readonly _tag: "Stderr";
|
|
405
|
+
readonly chunk: Uint8Array;
|
|
406
|
+
}) => any;
|
|
407
|
+
readonly Complete: (args: {
|
|
408
|
+
readonly _tag: "Complete";
|
|
409
|
+
readonly exitCode: number;
|
|
410
|
+
readonly durationMs: number;
|
|
411
|
+
}) => any;
|
|
412
|
+
}>(cases: Cases): (value: {
|
|
413
|
+
readonly _tag: "Stdout";
|
|
414
|
+
readonly chunk: Uint8Array;
|
|
415
|
+
} | {
|
|
416
|
+
readonly _tag: "Stderr";
|
|
417
|
+
readonly chunk: Uint8Array;
|
|
418
|
+
} | {
|
|
419
|
+
readonly _tag: "Complete";
|
|
420
|
+
readonly exitCode: number;
|
|
421
|
+
readonly durationMs: number;
|
|
422
|
+
}) => _$effect_Unify0.Unify<ReturnType<Cases["Stdout" | "Stderr" | "Complete"]>>;
|
|
423
|
+
<Cases extends {
|
|
424
|
+
readonly Stdout: (args: {
|
|
425
|
+
readonly _tag: "Stdout";
|
|
426
|
+
readonly chunk: Uint8Array;
|
|
427
|
+
}) => any;
|
|
428
|
+
readonly Stderr: (args: {
|
|
429
|
+
readonly _tag: "Stderr";
|
|
430
|
+
readonly chunk: Uint8Array;
|
|
431
|
+
}) => any;
|
|
432
|
+
readonly Complete: (args: {
|
|
433
|
+
readonly _tag: "Complete";
|
|
434
|
+
readonly exitCode: number;
|
|
435
|
+
readonly durationMs: number;
|
|
436
|
+
}) => any;
|
|
437
|
+
}>(value: {
|
|
438
|
+
readonly _tag: "Stdout";
|
|
439
|
+
readonly chunk: Uint8Array;
|
|
440
|
+
} | {
|
|
441
|
+
readonly _tag: "Stderr";
|
|
442
|
+
readonly chunk: Uint8Array;
|
|
443
|
+
} | {
|
|
444
|
+
readonly _tag: "Complete";
|
|
445
|
+
readonly exitCode: number;
|
|
446
|
+
readonly durationMs: number;
|
|
447
|
+
}, cases: Cases): _$effect_Unify0.Unify<ReturnType<Cases["Stdout" | "Stderr" | "Complete"]>>;
|
|
448
|
+
};
|
|
449
|
+
};
|
|
450
|
+
type FileEntryKind = "file" | "directory" | "symlink" | "other";
|
|
451
|
+
type FileEntry = {
|
|
452
|
+
readonly path: string;
|
|
453
|
+
readonly kind: FileEntryKind;
|
|
454
|
+
};
|
|
455
|
+
type SandboxFilesystem = {
|
|
456
|
+
readonly read: (path: string) => Effect.Effect<Uint8Array, SandboxError>;
|
|
457
|
+
readonly write: (path: string, contents: Uint8Array | string) => Effect.Effect<void, SandboxError>;
|
|
458
|
+
readonly remove: (path: string) => Effect.Effect<void, SandboxError>;
|
|
459
|
+
readonly mkdir: (path: string) => Effect.Effect<void, SandboxError>;
|
|
460
|
+
readonly list: (path: string) => Effect.Effect<ReadonlyArray<FileEntry>, SandboxError>;
|
|
461
|
+
readonly exists: (path: string) => Effect.Effect<boolean, SandboxError>;
|
|
462
|
+
};
|
|
463
|
+
/**
|
|
464
|
+
* Long-running process handle. Returned by `spawn` in a `Scope.Scope`
|
|
465
|
+
* — the process is killed on scope close. To outlive the calling
|
|
466
|
+
* scope, do `Effect.forkScoped` against a wider scope or use
|
|
467
|
+
* `attach`-style reconnection per the provider's escape hatch.
|
|
468
|
+
*/
|
|
469
|
+
type ProcessHandle = {
|
|
470
|
+
readonly pid: number;
|
|
471
|
+
readonly events: Stream.Stream<ExecEvent, SandboxError>;
|
|
472
|
+
readonly kill: Effect.Effect<void, SandboxError>;
|
|
473
|
+
readonly exit: Effect.Effect<{
|
|
474
|
+
readonly exitCode: number;
|
|
475
|
+
}, SandboxError>;
|
|
476
|
+
};
|
|
477
|
+
/**
|
|
478
|
+
* Live sandbox handle. Methods are plain `Effect` / `Stream` values
|
|
479
|
+
* — no nullary thunks (`destroy()`, `pause()`) — to match Effect's
|
|
480
|
+
* `Queue.shutdown` / `Fiber.interrupt` style. Destruction is the
|
|
481
|
+
* scope finalizer, not a method here; for the rare "kill from
|
|
482
|
+
* another fiber" case use the service-level escape hatch
|
|
483
|
+
* `Sandbox.destroy(id)`.
|
|
484
|
+
*/
|
|
485
|
+
type SandboxInstance = {
|
|
486
|
+
readonly id: SandboxId;
|
|
487
|
+
readonly exec: (request: CommonExecRequest) => Effect.Effect<ExecResult, SandboxError>;
|
|
488
|
+
readonly execStream: (request: CommonExecRequest) => Stream.Stream<ExecEvent, SandboxError>;
|
|
489
|
+
/**
|
|
490
|
+
* Spawn a background / long-running process. The returned handle is
|
|
491
|
+
* scoped — the process is killed on scope close. Use this for
|
|
492
|
+
* "dev server / watcher / tail -f" workloads. For one-shot
|
|
493
|
+
* commands prefer `exec`.
|
|
494
|
+
*/
|
|
495
|
+
readonly spawn: (request: CommonSpawnRequest) => Effect.Effect<ProcessHandle, SandboxError, Scope.Scope>;
|
|
496
|
+
readonly files: SandboxFilesystem;
|
|
497
|
+
};
|
|
498
|
+
type SandboxSnapshotsApi = {
|
|
499
|
+
readonly create: (from: SandboxInstance, name?: string) => Effect.Effect<SnapshotId, SandboxError>;
|
|
500
|
+
readonly destroy: (id: SnapshotId) => Effect.Effect<void, SandboxError>;
|
|
501
|
+
readonly list: Effect.Effect<ReadonlyArray<{
|
|
502
|
+
readonly id: SnapshotId;
|
|
503
|
+
readonly name?: string;
|
|
504
|
+
}>, SandboxError>;
|
|
505
|
+
};
|
|
506
|
+
type SandboxVolumesApi = {
|
|
507
|
+
readonly create: (name: string, options?: {
|
|
508
|
+
readonly quotaBytes?: number;
|
|
509
|
+
}) => Effect.Effect<VolumeId, SandboxError>;
|
|
510
|
+
readonly destroy: (id: VolumeId) => Effect.Effect<void, SandboxError>;
|
|
511
|
+
readonly list: Effect.Effect<ReadonlyArray<{
|
|
512
|
+
readonly id: VolumeId;
|
|
513
|
+
readonly name: string;
|
|
514
|
+
}>, SandboxError>;
|
|
515
|
+
};
|
|
516
|
+
type SandboxPortsApi = {
|
|
517
|
+
/**
|
|
518
|
+
* Expose an internal sandbox port as a publicly reachable URL.
|
|
519
|
+
* Gated by {@link SandboxPortExposure} on the free helper; adapters
|
|
520
|
+
* that don't ship the marker leave this sub-API out of the public
|
|
521
|
+
* surface entirely (callers can't construct an Effect against it).
|
|
522
|
+
*/
|
|
523
|
+
readonly expose: (instance: SandboxInstance, port: number) => Effect.Effect<{
|
|
524
|
+
readonly url: string;
|
|
525
|
+
}, SandboxError>;
|
|
526
|
+
};
|
|
527
|
+
/**
|
|
528
|
+
* Cross-provider sandbox service.
|
|
529
|
+
*
|
|
530
|
+
* Lifetime model: `create` returns a sandbox handle in `Scope.Scope`.
|
|
531
|
+
* The scope finalizer destroys the sandbox. Use `Effect.scoped` to
|
|
532
|
+
* bound a sandbox's lifetime to a single Effect, or manage the scope
|
|
533
|
+
* explicitly via `Scope.make` for sandboxes that span many calls.
|
|
534
|
+
* This is why there's no `destroy()` method on `SandboxInstance` —
|
|
535
|
+
* the scope is the lifecycle handle.
|
|
536
|
+
*
|
|
537
|
+
* `snapshots` and `volumes` sub-APIs are present on the service but
|
|
538
|
+
* are still capability-gated: provider Layers that don't support
|
|
539
|
+
* them ship implementations that always fail with
|
|
540
|
+
* `SandboxUnsupported`. The free helpers ({@link snapshot},
|
|
541
|
+
* {@link createVolume}) additionally require the corresponding
|
|
542
|
+
* capability marker on R, so misuses surface as type errors at
|
|
543
|
+
* `Effect.provide`, not as runtime failures.
|
|
544
|
+
*/
|
|
545
|
+
type SandboxService = {
|
|
546
|
+
/**
|
|
547
|
+
* Provision a new sandbox. The returned handle's lifetime is
|
|
548
|
+
* bound to the caller's scope; the sandbox is destroyed on scope
|
|
549
|
+
* close. To survive the scope, use `attach`-style reconnection or
|
|
550
|
+
* promote into a wider scope.
|
|
551
|
+
*/
|
|
552
|
+
readonly create: (request: CommonCreateRequest) => Effect.Effect<SandboxInstance, SandboxError, Scope.Scope>;
|
|
553
|
+
/**
|
|
554
|
+
* Re-acquire an existing sandbox by id. The returned handle is
|
|
555
|
+
* scope-bound but the finalizer is "detach" (no destroy) —
|
|
556
|
+
* appropriate for paused / detached / persistent sandboxes that
|
|
557
|
+
* outlive any single agent run.
|
|
558
|
+
*/
|
|
559
|
+
readonly attach: (id: SandboxId) => Effect.Effect<SandboxInstance, SandboxError, Scope.Scope>;
|
|
560
|
+
/**
|
|
561
|
+
* Enumerate sandboxes visible to the configured account / project.
|
|
562
|
+
*/
|
|
563
|
+
readonly list: Effect.Effect<ReadonlyArray<SandboxRef>, SandboxError>;
|
|
564
|
+
/**
|
|
565
|
+
* Escape hatch for destroying a sandbox from outside its owning
|
|
566
|
+
* scope. Most callers should let the scope finalizer handle this.
|
|
567
|
+
*/
|
|
568
|
+
readonly destroy: (id: SandboxId) => Effect.Effect<void, SandboxError>; /** Snapshot management. Capability-gated on {@link SandboxSnapshots}. */
|
|
569
|
+
readonly snapshots: SandboxSnapshotsApi; /** Volume management. Capability-gated on {@link SandboxVolumes}. */
|
|
570
|
+
readonly volumes: SandboxVolumesApi; /** Port exposure. Capability-gated on {@link SandboxPortExposure}. */
|
|
571
|
+
readonly ports: SandboxPortsApi;
|
|
572
|
+
};
|
|
573
|
+
declare const Sandbox_base: Context.ServiceClass<Sandbox, "@betalyra/effect-uai/Sandbox", SandboxService>;
|
|
574
|
+
declare class Sandbox extends Sandbox_base {}
|
|
575
|
+
declare const SandboxHostnameAllowlist_base: Context.ServiceClass<SandboxHostnameAllowlist, "@betalyra/effect-uai/capability/SandboxHostnameAllowlist", void>;
|
|
576
|
+
/**
|
|
577
|
+
* Capability marker — provided by adapter Layers whose provider
|
|
578
|
+
* supports a hostname-level egress allowlist (matching against host
|
|
579
|
+
* names / wildcards, not just CIDRs). Vercel, Cloudflare, Deno,
|
|
580
|
+
* Microsandbox, Runloop, Anthropic srt ship this marker; Modal and
|
|
581
|
+
* Daytona (CIDR-only) do not.
|
|
582
|
+
*
|
|
583
|
+
* Phantom — the value is `void`; adapters register with
|
|
584
|
+
* `Layer.succeed(SandboxHostnameAllowlist, undefined)`.
|
|
585
|
+
*/
|
|
586
|
+
declare class SandboxHostnameAllowlist extends SandboxHostnameAllowlist_base {}
|
|
587
|
+
declare const SandboxSecretInjection_base: Context.ServiceClass<SandboxSecretInjection, "@betalyra/effect-uai/capability/SandboxSecretInjection", void>;
|
|
588
|
+
/**
|
|
589
|
+
* Capability marker — adapter's provider supports proxy-layer
|
|
590
|
+
* secret rewriting (header injection on outbound HTTPS to bound
|
|
591
|
+
* hosts; the running code never sees the real value). Deno,
|
|
592
|
+
* Cloudflare, E2B, Vercel (firewall transform), Microsandbox,
|
|
593
|
+
* Runloop (Agent Gateway) ship this. Modal, Daytona, CodeSandbox
|
|
594
|
+
* do not.
|
|
595
|
+
*/
|
|
596
|
+
declare class SandboxSecretInjection extends SandboxSecretInjection_base {}
|
|
597
|
+
declare const SandboxSnapshots_base: Context.ServiceClass<SandboxSnapshots, "@betalyra/effect-uai/capability/SandboxSnapshots", void>;
|
|
598
|
+
/**
|
|
599
|
+
* Capability marker — adapter supports snapshot-as-new-sandbox
|
|
600
|
+
* (capture state, restore as a derived sandbox with a fresh id).
|
|
601
|
+
* Distinct from {@link SandboxPauseResume}, which preserves the
|
|
602
|
+
* same id and resumes in place.
|
|
603
|
+
*/
|
|
604
|
+
declare class SandboxSnapshots extends SandboxSnapshots_base {}
|
|
605
|
+
declare const SandboxPauseResume_base: Context.ServiceClass<SandboxPauseResume, "@betalyra/effect-uai/capability/SandboxPauseResume", void>;
|
|
606
|
+
/**
|
|
607
|
+
* Capability marker — adapter supports in-place pause and resume on
|
|
608
|
+
* the same sandbox id (E2B, CodeSandbox). Memory + processes are
|
|
609
|
+
* preserved across the pause boundary. Most providers without this
|
|
610
|
+
* marker offer {@link SandboxSnapshots} instead.
|
|
611
|
+
*/
|
|
612
|
+
declare class SandboxPauseResume extends SandboxPauseResume_base {}
|
|
613
|
+
declare const SandboxVolumes_base: Context.ServiceClass<SandboxVolumes, "@betalyra/effect-uai/capability/SandboxVolumes", void>;
|
|
614
|
+
/**
|
|
615
|
+
* Capability marker — adapter manages named persistent volumes
|
|
616
|
+
* outside any single sandbox lifecycle (Modal Volume, Daytona,
|
|
617
|
+
* Microsandbox, BoxLite). Providers without this marker leave
|
|
618
|
+
* `Sandbox.volumes.*` returning `SandboxUnsupported`; the free
|
|
619
|
+
* helpers ({@link createVolume}, {@link destroyVolume}) additionally
|
|
620
|
+
* require this marker on R so misuses become a type error.
|
|
621
|
+
*/
|
|
622
|
+
declare class SandboxVolumes extends SandboxVolumes_base {}
|
|
623
|
+
declare const SandboxKernelSession_base: Context.ServiceClass<SandboxKernelSession, "@betalyra/effect-uai/capability/SandboxKernelSession", void>;
|
|
624
|
+
/**
|
|
625
|
+
* Capability marker — adapter supports a stateful kernel session
|
|
626
|
+
* (Jupyter-style: persistent Python / JS context that returns rich
|
|
627
|
+
* outputs across many `runCode` calls). Cloudflare Code Interpreter
|
|
628
|
+
* and E2B ship this; everyone else expects you to write your own
|
|
629
|
+
* script and `exec` it.
|
|
630
|
+
*
|
|
631
|
+
* The actual `runCode` helper lives separately (not on
|
|
632
|
+
* `SandboxInstance`) because the return shape is different — rich
|
|
633
|
+
* outputs with images/tables, not buffered stdout strings.
|
|
634
|
+
*/
|
|
635
|
+
declare class SandboxKernelSession extends SandboxKernelSession_base {}
|
|
636
|
+
declare const SandboxPty_base: Context.ServiceClass<SandboxPty, "@betalyra/effect-uai/capability/SandboxPty", void>;
|
|
637
|
+
/**
|
|
638
|
+
* Capability marker — adapter exposes an interactive PTY session
|
|
639
|
+
* (Runloop, Cloudflare terminal). Distinct from `execStream` which
|
|
640
|
+
* is byte-oriented and one-shot.
|
|
641
|
+
*/
|
|
642
|
+
declare class SandboxPty extends SandboxPty_base {}
|
|
643
|
+
declare const SandboxCustomImage_base: Context.ServiceClass<SandboxCustomImage, "@betalyra/effect-uai/capability/SandboxCustomImage", void>;
|
|
644
|
+
/**
|
|
645
|
+
* Capability marker — adapter accepts a user-supplied Dockerfile (or
|
|
646
|
+
* OCI image build) instead of just a registry reference. Vercel does
|
|
647
|
+
* not ship this (fixed AL2023). Deno does not (snapshots only).
|
|
648
|
+
* Most others do.
|
|
649
|
+
*/
|
|
650
|
+
declare class SandboxCustomImage extends SandboxCustomImage_base {}
|
|
651
|
+
declare const SandboxPortExposure_base: Context.ServiceClass<SandboxPortExposure, "@betalyra/effect-uai/capability/SandboxPortExposure", void>;
|
|
652
|
+
/**
|
|
653
|
+
* Capability marker — adapter can expose an internal port as a
|
|
654
|
+
* publicly reachable URL. Most cloud providers ship this; local
|
|
655
|
+
* providers (Microsandbox, BoxLite) typically only support
|
|
656
|
+
* host-side port forwarding (handled by ignoring this marker and
|
|
657
|
+
* documenting via the per-provider request type).
|
|
658
|
+
*/
|
|
659
|
+
declare class SandboxPortExposure extends SandboxPortExposure_base {}
|
|
660
|
+
/**
|
|
661
|
+
* Provision a sandbox bound to the caller's scope. Drop the
|
|
662
|
+
* `Scope.Scope` requirement with `Effect.scoped`.
|
|
663
|
+
*/
|
|
664
|
+
declare const create: (request: CommonCreateRequest) => Effect.Effect<SandboxInstance, SandboxError, Sandbox | Scope.Scope>;
|
|
665
|
+
/**
|
|
666
|
+
* Re-acquire an existing sandbox by id. Same scope semantics as
|
|
667
|
+
* `create`, but the finalizer detaches rather than destroying.
|
|
668
|
+
*/
|
|
669
|
+
declare const attach: (id: SandboxId) => Effect.Effect<SandboxInstance, SandboxError, Sandbox | Scope.Scope>;
|
|
670
|
+
/** Enumerate sandboxes for the configured account / project. */
|
|
671
|
+
declare const list: Effect.Effect<ReadonlyArray<SandboxRef>, SandboxError, Sandbox>;
|
|
672
|
+
/**
|
|
673
|
+
* Escape hatch for destroying a sandbox from outside its owning
|
|
674
|
+
* scope. Most callers should let the scope finalizer handle this
|
|
675
|
+
* automatically.
|
|
676
|
+
*/
|
|
677
|
+
declare const destroy: (id: SandboxId) => Effect.Effect<void, SandboxError, Sandbox>;
|
|
678
|
+
/**
|
|
679
|
+
* Create a snapshot of a live sandbox. Requires
|
|
680
|
+
* {@link SandboxSnapshots} on the R channel — adapters whose
|
|
681
|
+
* provider doesn't support snapshot-as-new-sandbox don't ship the
|
|
682
|
+
* marker and calls fail at `Effect.provide` with a type error.
|
|
683
|
+
*/
|
|
684
|
+
declare const snapshot: (from: SandboxInstance, name?: string) => Effect.Effect<SnapshotId, SandboxError, Sandbox | SandboxSnapshots>;
|
|
685
|
+
/**
|
|
686
|
+
* Create a named persistent volume. Requires {@link SandboxVolumes}.
|
|
687
|
+
*/
|
|
688
|
+
declare const createVolume: (name: string, options?: {
|
|
689
|
+
readonly quotaBytes?: number;
|
|
690
|
+
}) => Effect.Effect<VolumeId, SandboxError, Sandbox | SandboxVolumes>;
|
|
691
|
+
/** Destroy a named volume. Requires {@link SandboxVolumes}. */
|
|
692
|
+
declare const destroyVolume: (id: VolumeId) => Effect.Effect<void, SandboxError, Sandbox | SandboxVolumes>;
|
|
693
|
+
/** Enumerate persistent volumes. Requires {@link SandboxVolumes}. */
|
|
694
|
+
declare const listVolumes: Effect.Effect<ReadonlyArray<{
|
|
695
|
+
readonly id: VolumeId;
|
|
696
|
+
readonly name: string;
|
|
697
|
+
}>, SandboxError, Sandbox | SandboxVolumes>;
|
|
698
|
+
/** Destroy a snapshot. Requires {@link SandboxSnapshots}. */
|
|
699
|
+
declare const destroySnapshot: (id: SnapshotId) => Effect.Effect<void, SandboxError, Sandbox | SandboxSnapshots>;
|
|
700
|
+
/** Enumerate snapshots. Requires {@link SandboxSnapshots}. */
|
|
701
|
+
declare const listSnapshots: Effect.Effect<ReadonlyArray<{
|
|
702
|
+
readonly id: SnapshotId;
|
|
703
|
+
readonly name?: string;
|
|
704
|
+
}>, SandboxError, Sandbox | SandboxSnapshots>;
|
|
705
|
+
/**
|
|
706
|
+
* Expose an internal port of a live sandbox as a publicly reachable
|
|
707
|
+
* URL. Requires {@link SandboxPortExposure} — adapters whose provider
|
|
708
|
+
* doesn't support runtime port exposure (e.g. Microsandbox, which
|
|
709
|
+
* forwards at create time only) don't ship the marker, and calls
|
|
710
|
+
* fail at `Effect.provide` with a type error.
|
|
711
|
+
*/
|
|
712
|
+
declare const exposePort: (instance: SandboxInstance, port: number) => Effect.Effect<{
|
|
713
|
+
readonly url: string;
|
|
714
|
+
}, SandboxError, Sandbox | SandboxPortExposure>;
|
|
715
|
+
//#endregion
|
|
716
|
+
export { BoundSecret, CommonCreateRequest, CommonExecRequest, CommonSpawnRequest, ExecEvent, ExecResult, FileEntry, FileEntryKind, ImageRef, NetworkPolicy, ProcessHandle, Sandbox, SandboxCustomImage, SandboxFilesystem, SandboxHostnameAllowlist, SandboxId, SandboxInstance, SandboxKernelSession, SandboxPauseResume, SandboxPortExposure, SandboxPortsApi, SandboxPty, SandboxRef, SandboxSecretInjection, SandboxService, SandboxSnapshots, SandboxSnapshotsApi, SandboxVolumes, SandboxVolumesApi, SnapshotId, VolumeId, VolumeMount, attach, create, createVolume, destroy, destroySnapshot, destroyVolume, exposePort, list, listSnapshots, listVolumes, snapshot, Sandbox_d_exports as t };
|
|
717
|
+
//# sourceMappingURL=Sandbox.d.mts.map
|