@codeworksh/harness 0.0.1-dev.20260917115353 → 0.0.1-dev.20260922135939
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 +23 -5
- package/{daytona-jO3_hTRS.mjs → daytona-BAurx6Gp.mjs} +24 -23
- package/daytona-BAurx6Gp.mjs.map +1 -0
- package/effect.d.mts +2438 -3307
- package/effect.mjs +2277 -1267
- package/effect.mjs.map +1 -1
- package/{index-B72Qlv0L.d.mts → index-DIP2u0Pr.d.mts} +4 -4
- package/{index-5Ur9C_De.d.mts → index-DjPzwUHF.d.mts} +4 -4
- package/package.json +17 -13
- package/resource-DFZh0e-s.mjs +35 -0
- package/resource-DFZh0e-s.mjs.map +1 -0
- package/rolldown-runtime-B4FMCO8f.mjs +28 -0
- package/sandbox-BL7BdHZc.d.mts +2 -0
- package/sandbox.d.mts +2 -2
- package/sandbox.mjs +2 -2
- package/sandboxes/daytona/index.d.mts +1 -1
- package/sandboxes/daytona/index.mjs +1 -1
- package/sandboxes/vercel/index.d.mts +1 -1
- package/sandboxes/vercel/index.mjs +1 -1
- package/{vercel-QPuO0iit.mjs → vercel-C0v5nh20.mjs} +25 -24
- package/vercel-C0v5nh20.mjs.map +1 -0
- package/daytona-jO3_hTRS.mjs.map +0 -1
- package/rolldown-runtime-8H4AJuhK.mjs +0 -14
- package/sandbox-DX9mliQs.d.mts +0 -758
- package/sandbox-Dlz9cGeD.mjs +0 -770
- package/sandbox-Dlz9cGeD.mjs.map +0 -1
- package/vercel-QPuO0iit.mjs.map +0 -1
package/sandbox-DX9mliQs.d.mts
DELETED
|
@@ -1,758 +0,0 @@
|
|
|
1
|
-
import { Context, Effect, Layer, Option, Schema, Stream } from "effect";
|
|
2
|
-
declare namespace filesystem_d_exports {
|
|
3
|
-
export { FileStat, FileSystemError, Interface, OperationUnsupportedError, Provider, RmOptions, filesystem_d_exports as SandboxFileSystem, Service$1 as Service, fromProvider, isNotFoundError, realpathScripts, validateRmOptions, withCwd };
|
|
4
|
-
}
|
|
5
|
-
declare const OperationUnsupportedError_base: Schema.Class<OperationUnsupportedError, Schema.TaggedStruct<"OperationUnsupportedError", {
|
|
6
|
-
readonly operation: Schema.String;
|
|
7
|
-
readonly message: Schema.String;
|
|
8
|
-
}>, import("effect/Cause").YieldableError>;
|
|
9
|
-
/**
|
|
10
|
-
* The runtime filesystem contract, independent of any backend.
|
|
11
|
-
*
|
|
12
|
-
* Two surfaces, deliberately:
|
|
13
|
-
* - {@link Provider} is what a backend implements — plain promises that reject,
|
|
14
|
-
* matching every SDK we wrap.
|
|
15
|
-
* - {@link Interface} is what the harness consumes — Effect with a typed error
|
|
16
|
-
* channel and tracing spans. {@link fromProvider} bridges the two exactly
|
|
17
|
-
* once, so no consumer ever writes `Effect.tryPromise` against a filesystem.
|
|
18
|
-
*
|
|
19
|
-
* Implementations:
|
|
20
|
-
* - Local:
|
|
21
|
-
* implement it over a VFS (`./local`);
|
|
22
|
-
* local filesystem use OS primitives; hence have broader filesytem capabilities.
|
|
23
|
-
*
|
|
24
|
-
* - Remote:
|
|
25
|
-
* implement it over a provider (`./remote`).
|
|
26
|
-
* remote filesytems depends on the interface provided by the remote provider; hence can have limited filesytem capabilities.
|
|
27
|
-
*
|
|
28
|
-
* `isFile`/`isDirectory` are required booleans; size, mtime, and isSymbolicLink are omitted when the
|
|
29
|
-
* backend cannot report them — never fabricated.
|
|
30
|
-
*
|
|
31
|
-
* **Paths are POSIX, and the harness is Unix-only (for now!).** Every path uses `/`
|
|
32
|
-
* separators on both the host and inside a sandbox — Windows is not supported,
|
|
33
|
-
* so no translation layer exists. Consumers must use the shared Effect POSIX
|
|
34
|
-
* path implementation, never the platform default, or a host running the harness would
|
|
35
|
-
* impose its own flavour on a remote sandbox's paths. Relative paths resolve
|
|
36
|
-
* against the backend's configured `cwd`.
|
|
37
|
-
*/
|
|
38
|
-
declare class OperationUnsupportedError extends OperationUnsupportedError_base {}
|
|
39
|
-
declare const FileSystemError_base: Schema.Class<FileSystemError, Schema.TaggedStruct<"SandboxFileSystemError", {
|
|
40
|
-
readonly method: Schema.String;
|
|
41
|
-
readonly path: Schema.String;
|
|
42
|
-
readonly cause: Schema.optional<Schema.Defect>;
|
|
43
|
-
}>, import("effect/Cause").YieldableError>;
|
|
44
|
-
/** A backend operation failed. `cause` carries the provider's own rejection. */
|
|
45
|
-
declare class FileSystemError extends FileSystemError_base {}
|
|
46
|
-
interface FileStat {
|
|
47
|
-
readonly isFile: boolean;
|
|
48
|
-
readonly isDirectory: boolean;
|
|
49
|
-
readonly isSymbolicLink?: boolean;
|
|
50
|
-
readonly size?: number;
|
|
51
|
-
readonly mtime?: Date;
|
|
52
|
-
}
|
|
53
|
-
interface RmOptions {
|
|
54
|
-
readonly recursive?: boolean;
|
|
55
|
-
readonly force?: boolean;
|
|
56
|
-
}
|
|
57
|
-
/** Whether a provider failure means the path itself is definitively absent. */
|
|
58
|
-
declare const isNotFoundError: (cause: unknown) => boolean;
|
|
59
|
-
/**
|
|
60
|
-
* Shell forms of `realpath` for backends that only expose a process API.
|
|
61
|
-
* `pwd -P` is the portable primitive: directories resolve directly, anything
|
|
62
|
-
* else resolves its parent and keeps the final name as given. Run as
|
|
63
|
-
* `sh -c <script> _ <path>`; try the first, fall back to the second.
|
|
64
|
-
*/
|
|
65
|
-
declare const realpathScripts: readonly ['cd -- "$1" && pwd -P', 'cd -- "$(dirname -- "$1")" && printf \'%s/%s\' "$(pwd -P)" "$(basename -- "$1")"'];
|
|
66
|
-
/**
|
|
67
|
-
* The backend-facing contract. Backends author plain promises and let them
|
|
68
|
-
* reject; {@link fromProvider} turns rejections into typed failures.
|
|
69
|
-
*/
|
|
70
|
-
interface Provider {
|
|
71
|
-
readonly readFile: (path: string) => Promise<string>;
|
|
72
|
-
readonly readFileBuffer: (path: string) => Promise<Uint8Array>;
|
|
73
|
-
/**
|
|
74
|
-
* Write the file. Parents may be missing — do not create them here;
|
|
75
|
-
* {@link fromProvider} owns that guarantee for every backend.
|
|
76
|
-
*/
|
|
77
|
-
readonly writeFile: (path: string, content: string | Uint8Array) => Promise<void>;
|
|
78
|
-
readonly stat: (path: string) => Promise<FileStat>;
|
|
79
|
-
readonly readdir: (path: string) => Promise<string[]>;
|
|
80
|
-
readonly exists: (path: string) => Promise<boolean>;
|
|
81
|
-
readonly mkdir: (path: string, options?: {
|
|
82
|
-
recursive?: boolean;
|
|
83
|
-
}) => Promise<void>;
|
|
84
|
-
readonly rm: (path: string, options?: RmOptions) => Promise<void>;
|
|
85
|
-
/** Canonical absolute path with symlinks resolved; rejects when the path does not exist. */
|
|
86
|
-
readonly realpath: (path: string) => Promise<string>;
|
|
87
|
-
/**
|
|
88
|
-
* Metadata for the directory entry itself rather than a symlink's target.
|
|
89
|
-
* Optional: a backend whose `stat` has mixed symlink semantics implements it
|
|
90
|
-
* so symlink identity is asked for explicitly, never inferred.
|
|
91
|
-
*/
|
|
92
|
-
readonly lstat?: (path: string) => Promise<FileStat>;
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* The consumer-facing contract. `exists` distinguishes "absent" from "could not
|
|
96
|
-
* tell": a backend failure is a typed failure, not `false`, so a caller acting
|
|
97
|
-
* on absence never acts on a network blip. Use `SandboxFs.existsOrFalse` where
|
|
98
|
-
* a best-effort answer really is wanted.
|
|
99
|
-
*/
|
|
100
|
-
interface Interface {
|
|
101
|
-
readonly readFile: (path: string) => Effect.Effect<string, FileSystemError>;
|
|
102
|
-
readonly readFileBuffer: (path: string) => Effect.Effect<Uint8Array, FileSystemError>;
|
|
103
|
-
/** Creates missing parent directories, on every backend. */
|
|
104
|
-
readonly writeFile: (path: string, content: string | Uint8Array) => Effect.Effect<void, FileSystemError>;
|
|
105
|
-
readonly stat: (path: string) => Effect.Effect<FileStat, FileSystemError>;
|
|
106
|
-
readonly readdir: (path: string) => Effect.Effect<string[], FileSystemError>;
|
|
107
|
-
readonly exists: (path: string) => Effect.Effect<boolean, FileSystemError>;
|
|
108
|
-
readonly mkdir: (path: string, options?: {
|
|
109
|
-
recursive?: boolean;
|
|
110
|
-
}) => Effect.Effect<void, FileSystemError>;
|
|
111
|
-
readonly rm: (path: string, options?: RmOptions) => Effect.Effect<void, FileSystemError | OperationUnsupportedError>;
|
|
112
|
-
/** Canonical absolute path with symlinks resolved; fails when the path does not exist. */
|
|
113
|
-
readonly realpath: (path: string) => Effect.Effect<string, FileSystemError>;
|
|
114
|
-
readonly lstat?: (path: string) => Effect.Effect<FileStat, FileSystemError>;
|
|
115
|
-
}
|
|
116
|
-
declare const Service_base$1: Context.ServiceClass<Service$1, "@codeworksh/harness/sandbox/fs/filesystem/Service", Interface>;
|
|
117
|
-
/** The runtime filesystem service — the live {@link Interface} for the active sandbox. */
|
|
118
|
-
declare class Service$1 extends Service_base$1 {}
|
|
119
|
-
/**
|
|
120
|
-
* Reject `rm` options a provider does not implement, before any mutation. Only
|
|
121
|
-
* `recursive` and `force` are part of the contract; anything else is refused
|
|
122
|
-
* loudly rather than silently ignored.
|
|
123
|
-
*/
|
|
124
|
-
declare const validateRmOptions: (options: RmOptions | undefined, operation?: string) => Effect.Effect<void, OperationUnsupportedError>;
|
|
125
|
-
/**
|
|
126
|
-
* Lift a {@link Provider} into the runtime {@link Interface}: one place that
|
|
127
|
-
* converts rejections into {@link FileSystemError}, validates `rm` options,
|
|
128
|
-
* creates missing parents on write, and names a tracing span per operation.
|
|
129
|
-
*/
|
|
130
|
-
declare const fromProvider: (provider: Provider) => Interface;
|
|
131
|
-
/**
|
|
132
|
-
* Bind a cwd-neutral filesystem to one mount's working directory.
|
|
133
|
-
*
|
|
134
|
-
* The counterpart of `Shell.withCwd`, and the reason relative paths mean the
|
|
135
|
-
* same thing to both: a shared transport stays rooted at the namespace root, so
|
|
136
|
-
* resolution happens here, per mount, rather than inside a VFS whose `chdir` is
|
|
137
|
-
* global state two mounts would fight over.
|
|
138
|
-
*/
|
|
139
|
-
declare const withCwd: (fs: Interface, cwd: string) => Interface;
|
|
140
|
-
//#endregion
|
|
141
|
-
//#region src/sandbox/shell/shell.d.ts
|
|
142
|
-
declare const ShellError_base: Schema.Class<ShellError, Schema.TaggedStruct<"ShellError", {
|
|
143
|
-
readonly command: Schema.String;
|
|
144
|
-
readonly cause: Schema.optional<Schema.Defect>;
|
|
145
|
-
}>, import("effect/Cause").YieldableError>;
|
|
146
|
-
/**
|
|
147
|
-
* The pluggable execution contract. Local sandboxes usually get a Shell through
|
|
148
|
-
* just-bash over the local `Local.Vfs`; remote sandboxes provide their own
|
|
149
|
-
* native Shell. Either way the rest of the harness depends only on this service
|
|
150
|
-
* tag.
|
|
151
|
-
*/
|
|
152
|
-
declare class ShellError extends ShellError_base {}
|
|
153
|
-
interface ExecResult {
|
|
154
|
-
readonly stdout: string;
|
|
155
|
-
readonly stderr: string;
|
|
156
|
-
readonly exitCode: number;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* One options shape for every entry point. `cwd` is the operation-level
|
|
160
|
-
* override: it wins over the mount's working directory, and a relative value
|
|
161
|
-
* resolves against it. Neither mutates shared state, so concurrent commands in
|
|
162
|
-
* one mount can run in different directories.
|
|
163
|
-
*/
|
|
164
|
-
interface ShellOptions {
|
|
165
|
-
readonly env?: Record<string, string>;
|
|
166
|
-
readonly cwd?: string;
|
|
167
|
-
}
|
|
168
|
-
/**
|
|
169
|
-
* A streamed chunk of command output, terminated by a single `exit` carrying the
|
|
170
|
-
* exit code. (A backend-level mirror of the tool layer's event; kept here so
|
|
171
|
-
* `sandbox/` does not depend on `tool/`.)
|
|
172
|
-
*/
|
|
173
|
-
type ExecChunk = {
|
|
174
|
-
readonly _tag: "stdout";
|
|
175
|
-
readonly bytes: Uint8Array;
|
|
176
|
-
} | {
|
|
177
|
-
readonly _tag: "stderr";
|
|
178
|
-
readonly bytes: Uint8Array;
|
|
179
|
-
} | {
|
|
180
|
-
readonly _tag: "exit";
|
|
181
|
-
readonly exitCode: number;
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* The command-execution capability a sandbox exposes. For an in-process
|
|
185
|
-
* backend this is just-bash; for a remote backend it is the sandbox's own
|
|
186
|
-
* shell. The {@link Shell} service tag carries this interface.
|
|
187
|
-
*/
|
|
188
|
-
interface ISandboxExe {
|
|
189
|
-
readonly exec: (command: string, options?: ShellOptions) => Effect.Effect<ExecResult, ShellError>;
|
|
190
|
-
/**
|
|
191
|
-
* Run a program with an explicit argument vector, bypassing shell word
|
|
192
|
-
* splitting. Callers that build commands from untrusted values — branch
|
|
193
|
-
* names, file paths — must use this instead of interpolating into
|
|
194
|
-
* {@link exec}, where a space or `$(…)` would change what runs.
|
|
195
|
-
*
|
|
196
|
-
* Backends whose transport only accepts a string quote the vector with
|
|
197
|
-
* {@link quote}; backends that spawn directly pass it through untouched.
|
|
198
|
-
*/
|
|
199
|
-
readonly execArgv: (argv: ReadonlyArray<string>, options?: ShellOptions) => Effect.Effect<ExecResult, ShellError>;
|
|
200
|
-
/**
|
|
201
|
-
* Optional streaming output: stdout/stderr chunks then a terminal `exit`.
|
|
202
|
-
* Backends that can stream (e.g. Vercel) implement it; `ToolShell.fromSandboxShell`
|
|
203
|
-
* bridges it to `ToolShell.stream` so the bash tool streams over them too.
|
|
204
|
-
*/
|
|
205
|
-
readonly stream?: (command: string, options?: ShellOptions) => Stream.Stream<ExecChunk, ShellError>;
|
|
206
|
-
}
|
|
207
|
-
/**
|
|
208
|
-
* POSIX single-quote escaping: wrap in `'…'` and rewrite each embedded quote as
|
|
209
|
-
* `'\''`. Everything inside single quotes is literal to the shell, so this is
|
|
210
|
-
* safe for arbitrary bytes.
|
|
211
|
-
*/
|
|
212
|
-
declare const quote: (value: string) => string;
|
|
213
|
-
/** Render an argument vector as one shell-safe command string. */
|
|
214
|
-
declare const quoteArgv: (argv: ReadonlyArray<string>) => string;
|
|
215
|
-
/**
|
|
216
|
-
* Complete a string-only backend: `execArgv` quotes the vector and runs it
|
|
217
|
-
* through `exec`. Backends that spawn a real argument vector (Vercel) implement
|
|
218
|
-
* `execArgv` themselves instead, so the args never meet a shell parser at all.
|
|
219
|
-
*
|
|
220
|
-
* `cwd` rides the options rather than a `cd <dir> && …` prefix. Every backend
|
|
221
|
-
* we wrap takes a working directory natively, and the prefix form cannot tell a
|
|
222
|
-
* failed `cd` from a failed command — both arrive as one exit code.
|
|
223
|
-
*/
|
|
224
|
-
declare const fromExec: (backend: Omit<ISandboxExe, "execArgv">) => ISandboxExe;
|
|
225
|
-
declare const Shell_base: Context.ServiceClass<Shell$1, "@codeworksh/harness/sandbox/shell/shell", ISandboxExe>;
|
|
226
|
-
/** Execution service — the live {@link ISandboxExe} for the active sandbox. */
|
|
227
|
-
declare class Shell$1 extends Shell_base {}
|
|
228
|
-
declare namespace errors_d_exports {
|
|
229
|
-
export { Redactor, SandboxBusyError, SandboxCreateError, SandboxDestroyError, SandboxDriverLoadError, SandboxDriverLoadPhase, SandboxDriverNotRegisteredError, SandboxDriverRegistrationError, errors_d_exports as SandboxError, SandboxMountError, SandboxMustBeStoppedError, SandboxNotFoundError, SandboxProviderError, SandboxReadError, SandboxRefreshError, SandboxRegisterError, SandboxRemovedError, SandboxStopError, SandboxTransitionConflictError, SandboxUnavailError, SandboxUnsupportedError, SandboxWakeError, makeRedactor, providerError, providerErrorCause, providerErrorIsNotFound, sanitizeError };
|
|
230
|
-
}
|
|
231
|
-
declare const SandboxNotFoundError_base: Schema.Class<SandboxNotFoundError, Schema.TaggedStruct<"SandboxNotFoundError", {
|
|
232
|
-
readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
233
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
234
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
235
|
-
};
|
|
236
|
-
}>, import("effect/Cause").YieldableError>;
|
|
237
|
-
/**
|
|
238
|
-
* Lifecycle errors are confined to the control plane. Once a mount succeeds,
|
|
239
|
-
* consumers continue to see only FileSystemError and ShellError.
|
|
240
|
-
*/
|
|
241
|
-
declare class SandboxNotFoundError extends SandboxNotFoundError_base {}
|
|
242
|
-
declare const SandboxDriverNotRegisteredError_base: Schema.Class<SandboxDriverNotRegisteredError, Schema.TaggedStruct<"SandboxDriverNotRegisteredError", {
|
|
243
|
-
readonly driver: Schema.String;
|
|
244
|
-
readonly registered: Schema.optional<Schema.$Array<Schema.String>>;
|
|
245
|
-
}>, import("effect/Cause").YieldableError>;
|
|
246
|
-
declare class SandboxDriverNotRegisteredError extends SandboxDriverNotRegisteredError_base {}
|
|
247
|
-
declare const SandboxDriverRegistrationError_base: Schema.Class<SandboxDriverRegistrationError, Schema.TaggedStruct<"SandboxDriverRegistrationError", {
|
|
248
|
-
readonly driver: Schema.String;
|
|
249
|
-
readonly reason: Schema.String;
|
|
250
|
-
}>, import("effect/Cause").YieldableError>;
|
|
251
|
-
declare class SandboxDriverRegistrationError extends SandboxDriverRegistrationError_base {}
|
|
252
|
-
declare const SandboxDriverLoadPhase: Schema.Literals<readonly ["resolve", "import", "module", "api-version", "options", "factory", "registration"]>;
|
|
253
|
-
type SandboxDriverLoadPhase = typeof SandboxDriverLoadPhase.Type;
|
|
254
|
-
declare const SandboxDriverLoadError_base: Schema.Class<SandboxDriverLoadError, Schema.TaggedStruct<"SandboxDriverLoadError", {
|
|
255
|
-
readonly specifier: Schema.String;
|
|
256
|
-
readonly phase: Schema.Literals<readonly ["resolve", "import", "module", "api-version", "options", "factory", "registration"]>;
|
|
257
|
-
readonly driver: Schema.optional<Schema.String>;
|
|
258
|
-
readonly reason: Schema.String;
|
|
259
|
-
}>, import("effect/Cause").YieldableError>;
|
|
260
|
-
declare class SandboxDriverLoadError extends SandboxDriverLoadError_base {}
|
|
261
|
-
declare const SandboxBusyError_base: Schema.Class<SandboxBusyError, Schema.TaggedStruct<"SandboxBusyError", {
|
|
262
|
-
readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
263
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
264
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
265
|
-
};
|
|
266
|
-
readonly refCount: Schema.Int;
|
|
267
|
-
}>, import("effect/Cause").YieldableError>;
|
|
268
|
-
declare class SandboxBusyError extends SandboxBusyError_base {}
|
|
269
|
-
declare const SandboxMustBeStoppedError_base: Schema.Class<SandboxMustBeStoppedError, Schema.TaggedStruct<"SandboxMustBeStoppedError", {
|
|
270
|
-
readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
271
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
272
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
273
|
-
};
|
|
274
|
-
readonly status: Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>;
|
|
275
|
-
}>, import("effect/Cause").YieldableError>;
|
|
276
|
-
declare class SandboxMustBeStoppedError extends SandboxMustBeStoppedError_base {}
|
|
277
|
-
declare const SandboxRemovedError_base: Schema.Class<SandboxRemovedError, Schema.TaggedStruct<"SandboxRemovedError", {
|
|
278
|
-
readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
279
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
280
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
281
|
-
};
|
|
282
|
-
readonly removedAt: Schema.optional<Schema.DateTimeUtc>;
|
|
283
|
-
}>, import("effect/Cause").YieldableError>;
|
|
284
|
-
declare class SandboxRemovedError extends SandboxRemovedError_base {}
|
|
285
|
-
declare const SandboxUnavailError_base: Schema.Class<SandboxUnavailError, Schema.TaggedStruct<"SandboxUnavailError", {
|
|
286
|
-
readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
287
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
288
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
289
|
-
};
|
|
290
|
-
readonly reason: Schema.String;
|
|
291
|
-
}>, import("effect/Cause").YieldableError>;
|
|
292
|
-
declare class SandboxUnavailError extends SandboxUnavailError_base {}
|
|
293
|
-
declare const SandboxUnsupportedError_base: Schema.Class<SandboxUnsupportedError, Schema.TaggedStruct<"SandboxUnsupportedError", {
|
|
294
|
-
readonly id: Schema.optional<Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
295
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
296
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
297
|
-
}>;
|
|
298
|
-
readonly driver: Schema.String;
|
|
299
|
-
readonly operation: Schema.String;
|
|
300
|
-
}>, import("effect/Cause").YieldableError>;
|
|
301
|
-
declare class SandboxUnsupportedError extends SandboxUnsupportedError_base {}
|
|
302
|
-
declare const SandboxTransitionConflictError_base: Schema.Class<SandboxTransitionConflictError, Schema.TaggedStruct<"SandboxTransitionConflictError", {
|
|
303
|
-
readonly id: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
304
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
305
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
306
|
-
};
|
|
307
|
-
readonly expected: Schema.$Array<Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>>;
|
|
308
|
-
readonly actual: Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>;
|
|
309
|
-
}>, import("effect/Cause").YieldableError>;
|
|
310
|
-
declare class SandboxTransitionConflictError extends SandboxTransitionConflictError_base {}
|
|
311
|
-
declare const SandboxProviderError_base: Schema.Class<SandboxProviderError, Schema.TaggedStruct<"SandboxProviderError", {
|
|
312
|
-
readonly driver: Schema.String;
|
|
313
|
-
readonly operation: Schema.String;
|
|
314
|
-
readonly sanitized: Schema.Struct<{
|
|
315
|
-
readonly name: Schema.String;
|
|
316
|
-
readonly message: Schema.String;
|
|
317
|
-
readonly code: Schema.optional<Schema.String>;
|
|
318
|
-
}>;
|
|
319
|
-
}>, import("effect/Cause").YieldableError>;
|
|
320
|
-
/**
|
|
321
|
-
* A lifecycle failure safe to serialize, persist, or log.
|
|
322
|
-
*
|
|
323
|
-
* The raw SDK defect is deliberately absent from the schema. It is retained on
|
|
324
|
-
* a non-enumerable symbol by {@link providerError}, so Effect's default
|
|
325
|
-
* formatting and JSON serialization cannot expose credentials nested in it.
|
|
326
|
-
*/
|
|
327
|
-
declare class SandboxProviderError extends SandboxProviderError_base {}
|
|
328
|
-
declare const providerErrorCause: (error: SandboxProviderError) => unknown;
|
|
329
|
-
declare const providerErrorIsNotFound: (error: SandboxProviderError) => boolean;
|
|
330
|
-
type Redactor = (value: string) => string;
|
|
331
|
-
/**
|
|
332
|
-
* Conservative text redaction shared by every driver sanitizer.
|
|
333
|
-
*
|
|
334
|
-
* Disclaimer: This can really leak. Its never safe
|
|
335
|
-
*
|
|
336
|
-
* Configured secrets are removed exactly. Common authorization/header and URL
|
|
337
|
-
* query shapes are masked as a second line of defence for values the caller did
|
|
338
|
-
* not explicitly seed.
|
|
339
|
-
*
|
|
340
|
-
* Note: add support for diff regex as needed.
|
|
341
|
-
*/
|
|
342
|
-
declare const makeRedactor: (secrets?: Iterable<string>) => Redactor;
|
|
343
|
-
declare const sanitizeError: (cause: unknown, redact?: Redactor) => PersistedError;
|
|
344
|
-
declare const providerError: (input: {
|
|
345
|
-
readonly driver: string;
|
|
346
|
-
readonly operation: string;
|
|
347
|
-
readonly cause: unknown;
|
|
348
|
-
readonly redact?: Redactor;
|
|
349
|
-
readonly sanitize?: (cause: unknown, redact: Redactor) => PersistedError;
|
|
350
|
-
readonly notFound?: boolean;
|
|
351
|
-
}) => SandboxProviderError;
|
|
352
|
-
type SandboxMountError = SandboxNotFoundError | SandboxDriverNotRegisteredError | SandboxUnavailError | SandboxRemovedError | SandboxProviderError;
|
|
353
|
-
type SandboxCreateError = SandboxDriverNotRegisteredError | SandboxDriverRegistrationError | SandboxProviderError;
|
|
354
|
-
type SandboxRegisterError = SandboxDriverNotRegisteredError | SandboxDriverRegistrationError | SandboxUnsupportedError | SandboxProviderError;
|
|
355
|
-
type SandboxReadError = never;
|
|
356
|
-
type SandboxRefreshError = SandboxNotFoundError | SandboxDriverNotRegisteredError | SandboxUnavailError | SandboxUnsupportedError | SandboxProviderError;
|
|
357
|
-
type SandboxWakeError = SandboxRefreshError | SandboxRemovedError;
|
|
358
|
-
type SandboxStopError = SandboxWakeError | SandboxBusyError | SandboxTransitionConflictError;
|
|
359
|
-
type SandboxDestroyError = SandboxStopError | SandboxMustBeStoppedError;
|
|
360
|
-
declare namespace io_d_exports$1 {
|
|
361
|
-
export { Current, FileSystem$1 as FileSystem, Identity, Layer$1 as Layer, Provides, io_d_exports$1 as SandboxIO, Shell, host, hostLayer, identityLayer, mount, remote, resolveMountCwd, virtual };
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* `SandboxIO` is a **mount**: a filesystem, a shell, and the identity and
|
|
365
|
-
* working directory they act on.
|
|
366
|
-
*
|
|
367
|
-
* It is the whole vocabulary a consumer needs. Project, Git, Copy, Location, and
|
|
368
|
-
* every tool ask for `SandboxIO.FileSystem`, `SandboxIO.Shell`, and
|
|
369
|
-
* `SandboxIO.Current` — never for a driver, an address, or a provider SDK — so
|
|
370
|
-
* a host directory, an in-memory VFS, and a remote microVM are interchangeable
|
|
371
|
-
* behind one contract.
|
|
372
|
-
*
|
|
373
|
-
* The mount neither creates nor destroys infrastructure. `SandboxInstance` is
|
|
374
|
-
* the durable namespace it acts on — a device, which exists whether or not
|
|
375
|
-
* anything has it mounted — and `Sandbox.Controller` is the only path that
|
|
376
|
-
* creates, stops, or destroys one.
|
|
377
|
-
*/
|
|
378
|
-
/**
|
|
379
|
-
* The filesystem tag. Re-exported here so consumers import one namespace —
|
|
380
|
-
* Project, Git, Copy, and the runner ask for `SandboxIO.FileSystem`, never for
|
|
381
|
-
* the module that happens to define it. Code *inside* `sandbox/` keeps importing
|
|
382
|
-
* the tag directly, since `io.ts` is built on top of it.
|
|
383
|
-
*/
|
|
384
|
-
declare const FileSystem$1: typeof Service$1;
|
|
385
|
-
type FileSystem$1 = Service$1;
|
|
386
|
-
/** The shell tag. Re-exported here so consumers import one namespace. */
|
|
387
|
-
declare const Shell: typeof Shell$1;
|
|
388
|
-
type Shell = Shell$1;
|
|
389
|
-
/**
|
|
390
|
-
* What a mount sees: immutable identity, plus the working directory resolved for
|
|
391
|
-
* *this* mount.
|
|
392
|
-
*
|
|
393
|
-
* Nothing mutable belongs here. `status`, `usage`, and reference counts all
|
|
394
|
-
* change while a mount is open, so a mount-time snapshot of them would be wrong
|
|
395
|
-
* by construction — runtime code that needs live management state asks the
|
|
396
|
-
* control plane. The driver's own resource locator is likewise absent: consumers
|
|
397
|
-
* never parse a Vercel name or a Daytona id.
|
|
398
|
-
*/
|
|
399
|
-
interface Identity {
|
|
400
|
-
readonly id: ID;
|
|
401
|
-
readonly driver: Name;
|
|
402
|
-
readonly kind: Kind;
|
|
403
|
-
/** Absolute, and always a path in *this* namespace. */
|
|
404
|
-
readonly cwd: string;
|
|
405
|
-
}
|
|
406
|
-
declare const Current_base: Context.ServiceClass<Current, "@codeworksh/harness/sandbox/io/Current", Identity>;
|
|
407
|
-
/** Identity and working directory of the current mount. */
|
|
408
|
-
declare class Current extends Current_base {}
|
|
409
|
-
/** Everything a mount provides. */
|
|
410
|
-
type Provides = Current | Service$1 | Shell$1;
|
|
411
|
-
/** A built mount. */
|
|
412
|
-
type Layer$1<E = never, RIn = never> = Layer.Layer<Provides, E, RIn>;
|
|
413
|
-
/**
|
|
414
|
-
* Resolve a mount's cwd without consulting ambient process state.
|
|
415
|
-
*
|
|
416
|
-
* The default is supplied by the namespace adapter:
|
|
417
|
-
* provider metadata remotely, `/` for a virtual filesystem, and `process.cwd()` for the host adapter.
|
|
418
|
-
* An explicit absolute cwd replaces it; a relative cwd is resolved inside it. The
|
|
419
|
-
* result is therefore always the one concrete absolute path `Current` requires.
|
|
420
|
-
*
|
|
421
|
-
* A non-absolute default throws rather than failing typed. It is the one
|
|
422
|
-
* defect-level guard in this module, and deliberately so:
|
|
423
|
-
* Adapters reading a value from a provider call this inside their own error channel,
|
|
424
|
-
* where the throw becomes their typed failure (see `EnvDaytona.mountCwd`).
|
|
425
|
-
*/
|
|
426
|
-
declare const resolveMountCwd: (defaultCwd: string, cwd?: string) => string;
|
|
427
|
-
/**
|
|
428
|
-
* Bind a cwd-neutral transport to one mount.
|
|
429
|
-
*
|
|
430
|
-
* The transport underneath is shared between
|
|
431
|
-
* mounts and stays rooted at the namespace root, and everything directory-shaped
|
|
432
|
-
* happens here, once per mount. Two mounts of one namespace at different working
|
|
433
|
-
* directories therefore coexist without seeing or moving each other's.
|
|
434
|
-
*
|
|
435
|
-
* It consumes the same two tags it provides — the transport is supplied by the
|
|
436
|
-
* layer this is composed over, not by itself.
|
|
437
|
-
*/
|
|
438
|
-
declare const mount: (identity: Identity) => Layer.Layer<Provides, never, Service$1 | Shell$1>;
|
|
439
|
-
/**
|
|
440
|
-
* Just the identity tag, with no filesystem or shell beneath it. For consumers
|
|
441
|
-
* assembled from stubs — a test that runs `Project` over a fake filesystem still
|
|
442
|
-
* needs to know which namespace it is in.
|
|
443
|
-
*/
|
|
444
|
-
declare const identityLayer: (identity: Identity) => Layer.Layer<Current, never, never>;
|
|
445
|
-
/** The host identity alone. See {@link identityLayer}. */
|
|
446
|
-
declare const hostLayer: (cwd?: string) => Layer.Layer<Current, never, never>;
|
|
447
|
-
/**
|
|
448
|
-
* The host, rooted at `cwd`. Always `SandboxInstance.ID.local`: the working
|
|
449
|
-
* directory selects where relative paths resolve, it does not make a second host
|
|
450
|
-
* namespace — two mounts rooted at different directories still agree on absolute
|
|
451
|
-
* paths.
|
|
452
|
-
*
|
|
453
|
-
* The host adapter defaults to `process.cwd()`, matching the OS process it wraps.
|
|
454
|
-
* This is the one namespace where that coordinate is intrinsically valid; remote
|
|
455
|
-
* and virtual adapters must never inherit it.
|
|
456
|
-
*/
|
|
457
|
-
declare const host: (cwd?: string) => Identity;
|
|
458
|
-
/**
|
|
459
|
-
* A VFS-backed namespace. The id is minted per call unless one is named, because
|
|
460
|
-
* building one of these builds a fresh VFS: N unnamed calls are N distinct
|
|
461
|
-
* namespaces, none of which outlives the process. A file-backed store is the
|
|
462
|
-
* exception — its file is the state, so whoever knows the file supplies the id
|
|
463
|
-
* it was registered under.
|
|
464
|
-
*/
|
|
465
|
-
declare const virtual: (input: {
|
|
466
|
-
readonly driver: string;
|
|
467
|
-
readonly id?: ID;
|
|
468
|
-
readonly defaultCwd?: string;
|
|
469
|
-
readonly cwd?: string;
|
|
470
|
-
}) => Identity;
|
|
471
|
-
/**
|
|
472
|
-
* A provider-hosted namespace. The id is always supplied: a remote resource's
|
|
473
|
-
* durable identity is minted and recorded by whoever provisioned it, never
|
|
474
|
-
* derived here from the provider's own locator.
|
|
475
|
-
*/
|
|
476
|
-
declare const remote: (input: {
|
|
477
|
-
readonly driver: string;
|
|
478
|
-
readonly id: ID;
|
|
479
|
-
/** Namespace-intrinsic default supplied or discovered by the driver. */
|
|
480
|
-
readonly defaultCwd: string;
|
|
481
|
-
readonly cwd?: string;
|
|
482
|
-
}) => Identity;
|
|
483
|
-
declare namespace driver_d_exports$1 {
|
|
484
|
-
export { AbsolutePath, ApiVersion, Capabilities, Definition, Driver, Module, ModuleDefinition, Name, Observed, Provisioned, Registered, Registration, RuntimeConfigBase, RuntimeInput, driver_d_exports$1 as SandboxDriver, Source, apiVersion, driver, erase, defineModule as module, withSource };
|
|
485
|
-
}
|
|
486
|
-
/** Version of the loadable sandbox-driver module ABI. */
|
|
487
|
-
declare const apiVersion: 1;
|
|
488
|
-
type ApiVersion = typeof apiVersion;
|
|
489
|
-
/** Open driver identity. Adding a driver never extends a union in core. */
|
|
490
|
-
declare const Name: Schema.brand<Schema.String, "SandboxDriver.Name">;
|
|
491
|
-
type Name = typeof Name.Type;
|
|
492
|
-
/** A path whose coordinate system is the mounted namespace. */
|
|
493
|
-
declare const AbsolutePath: Schema.brand<Schema.String, "SandboxDriver.AbsolutePath">;
|
|
494
|
-
type AbsolutePath = typeof AbsolutePath.Type;
|
|
495
|
-
declare const RuntimeConfigBase: Schema.Struct<{
|
|
496
|
-
readonly defaultCwd: Schema.brand<Schema.String, "SandboxDriver.AbsolutePath">;
|
|
497
|
-
}>;
|
|
498
|
-
interface RuntimeConfigBase extends Schema.Schema.Type<typeof RuntimeConfigBase> {}
|
|
499
|
-
interface Capabilities {
|
|
500
|
-
readonly inspect: boolean;
|
|
501
|
-
readonly reattach: boolean;
|
|
502
|
-
readonly wake: boolean;
|
|
503
|
-
readonly stop: boolean;
|
|
504
|
-
readonly destroy: boolean;
|
|
505
|
-
readonly cancels: boolean;
|
|
506
|
-
}
|
|
507
|
-
interface Observed {
|
|
508
|
-
readonly status: Status;
|
|
509
|
-
readonly providerStatus?: string | undefined;
|
|
510
|
-
readonly metadata?: Readonly<Record<string, string>> | undefined;
|
|
511
|
-
}
|
|
512
|
-
interface Provisioned<RuntimeConfig extends RuntimeConfigBase> {
|
|
513
|
-
readonly providerResourceId?: string | undefined;
|
|
514
|
-
readonly providerStatus?: string | undefined;
|
|
515
|
-
readonly runtimeConfig: RuntimeConfig;
|
|
516
|
-
readonly metadata?: Readonly<Record<string, string>> | undefined;
|
|
517
|
-
}
|
|
518
|
-
interface RuntimeInput<RuntimeConfig extends RuntimeConfigBase> {
|
|
519
|
-
readonly id: ID;
|
|
520
|
-
readonly providerResourceId: Option.Option<string>;
|
|
521
|
-
readonly runtimeConfig: RuntimeConfig;
|
|
522
|
-
}
|
|
523
|
-
interface Driver<CreateConfig, RuntimeConfig extends RuntimeConfigBase> {
|
|
524
|
-
readonly name: Name;
|
|
525
|
-
readonly kind: Exclude<Kind, "local">;
|
|
526
|
-
readonly capabilities: Capabilities;
|
|
527
|
-
readonly createConfigCodec: Schema.Codec<CreateConfig, unknown>;
|
|
528
|
-
readonly runtimeConfigCodec: Schema.Codec<RuntimeConfig, unknown>;
|
|
529
|
-
readonly create: (input: {
|
|
530
|
-
readonly instanceId: ID;
|
|
531
|
-
readonly config: CreateConfig;
|
|
532
|
-
}) => Effect.Effect<Provisioned<RuntimeConfig>, SandboxProviderError>;
|
|
533
|
-
readonly runtimeConfigFor?: ((input: {
|
|
534
|
-
readonly providerResourceId: string;
|
|
535
|
-
readonly overrides?: Partial<RuntimeConfig> | undefined;
|
|
536
|
-
}) => Effect.Effect<RuntimeConfig, SandboxProviderError>) | undefined;
|
|
537
|
-
readonly attach: (input: RuntimeInput<RuntimeConfig>) => Layer.Layer<FileSystem$1 | Shell, SandboxProviderError>;
|
|
538
|
-
readonly inspect?: (input: RuntimeInput<RuntimeConfig>) => Effect.Effect<Observed, SandboxProviderError>;
|
|
539
|
-
readonly wake?: (input: RuntimeInput<RuntimeConfig>) => Effect.Effect<Observed, SandboxProviderError>;
|
|
540
|
-
readonly stop?: (input: RuntimeInput<RuntimeConfig>) => Effect.Effect<Observed, SandboxProviderError>;
|
|
541
|
-
readonly destroy?: (input: RuntimeInput<RuntimeConfig>) => Effect.Effect<void, SandboxProviderError>;
|
|
542
|
-
}
|
|
543
|
-
type Definition<CreateConfig, RuntimeConfig extends RuntimeConfigBase> = Pick<Driver<CreateConfig, RuntimeConfig>, "name" | "createConfigCodec" | "runtimeConfigCodec">;
|
|
544
|
-
/** Registry-only erased shape. Driver authors construct it via {@link driver}. */
|
|
545
|
-
interface Registered {
|
|
546
|
-
readonly name: Name;
|
|
547
|
-
readonly kind: Exclude<Kind, "local">;
|
|
548
|
-
readonly capabilities: Capabilities;
|
|
549
|
-
readonly createConfigCodec: Schema.Codec<unknown, unknown>;
|
|
550
|
-
readonly runtimeConfigCodec: Schema.Codec<RuntimeConfigBase, unknown>;
|
|
551
|
-
readonly create: (input: {
|
|
552
|
-
readonly instanceId: ID;
|
|
553
|
-
readonly config: unknown;
|
|
554
|
-
}) => Effect.Effect<Provisioned<RuntimeConfigBase>, SandboxProviderError>;
|
|
555
|
-
readonly runtimeConfigFor?: ((input: {
|
|
556
|
-
readonly providerResourceId: string;
|
|
557
|
-
readonly overrides?: Readonly<Record<string, unknown>> | undefined;
|
|
558
|
-
}) => Effect.Effect<RuntimeConfigBase, SandboxProviderError>) | undefined;
|
|
559
|
-
readonly attach: (input: RuntimeInput<RuntimeConfigBase>) => Layer.Layer<FileSystem$1 | Shell, SandboxProviderError>;
|
|
560
|
-
readonly inspect?: (input: RuntimeInput<RuntimeConfigBase>) => Effect.Effect<Observed, SandboxProviderError>;
|
|
561
|
-
readonly wake?: (input: RuntimeInput<RuntimeConfigBase>) => Effect.Effect<Observed, SandboxProviderError>;
|
|
562
|
-
readonly stop?: (input: RuntimeInput<RuntimeConfigBase>) => Effect.Effect<Observed, SandboxProviderError>;
|
|
563
|
-
readonly destroy?: (input: RuntimeInput<RuntimeConfigBase>) => Effect.Effect<void, SandboxProviderError>;
|
|
564
|
-
}
|
|
565
|
-
declare const erase: <CreateConfig, RuntimeConfig extends RuntimeConfigBase>(value: Driver<CreateConfig, RuntimeConfig>) => Registered;
|
|
566
|
-
type Source = "core" | "builtin" | "package" | "file";
|
|
567
|
-
interface Registration {
|
|
568
|
-
readonly registered: Registered;
|
|
569
|
-
readonly apiVersion: ApiVersion;
|
|
570
|
-
readonly source: Source;
|
|
571
|
-
}
|
|
572
|
-
interface Module<Options> {
|
|
573
|
-
readonly apiVersion: ApiVersion;
|
|
574
|
-
readonly name: Name;
|
|
575
|
-
readonly options: Schema.Codec<Options, unknown>;
|
|
576
|
-
readonly make: (options: Options) => Registration;
|
|
577
|
-
}
|
|
578
|
-
interface ModuleDefinition<Options> {
|
|
579
|
-
readonly apiVersion: ApiVersion;
|
|
580
|
-
readonly name: string | Name;
|
|
581
|
-
readonly options: Schema.Codec<Options, unknown>;
|
|
582
|
-
readonly make: (options: Options) => Registration;
|
|
583
|
-
}
|
|
584
|
-
/** Define the default export of a loadable sandbox package. */
|
|
585
|
-
declare const defineModule: <Options>(value: ModuleDefinition<Options>) => Module<Options>;
|
|
586
|
-
/** Construct a driver and its registry contribution. */
|
|
587
|
-
declare const driver: <CreateConfig, RuntimeConfig extends RuntimeConfigBase>(value: Driver<CreateConfig, RuntimeConfig>) => Driver<CreateConfig, RuntimeConfig> & Registration;
|
|
588
|
-
/** Attach trusted origin metadata without changing the driver implementation. */
|
|
589
|
-
declare const withSource: (registration: Registration, source: Source) => Registration;
|
|
590
|
-
declare namespace instance_d_exports {
|
|
591
|
-
export { ID, Info, Kind, Ownership, PersistedError, instance_d_exports as SandboxInstance, Status, Usage, fromColumn, fromField, isMountable, mountable, toColumn, toField };
|
|
592
|
-
}
|
|
593
|
-
/**
|
|
594
|
-
* A Sandbox instance is a **durable filesystem namespace** plus whatever compute
|
|
595
|
-
* acts on it — a device in Unix terms, which exists whether or not anything has
|
|
596
|
-
* it mounted. `Sandbox.Controller` is the only thing that creates,
|
|
597
|
-
* stops, or destroys one; this module is just its identity and state model.
|
|
598
|
-
*
|
|
599
|
-
* The application ID is deliberately separate from the driver's own resource
|
|
600
|
-
* locator: callers never parse a Vercel name or a Daytona ID, driver formats may
|
|
601
|
-
* change, and a destroyed resource must stay identifiable in Project/Session
|
|
602
|
-
* history. A missing resource is never recreated under an existing ID — a new
|
|
603
|
-
* resource is a new namespace and therefore a new ID.
|
|
604
|
-
*/
|
|
605
|
-
declare const ID: Schema.brand<Schema.String, "SandboxInstance.ID"> & {
|
|
606
|
-
/**
|
|
607
|
-
* The host. Reserved, and never written to a column — see {@link toColumn}.
|
|
608
|
-
* It exists at runtime so nothing has to branch on "is this the host": it is
|
|
609
|
-
* what identity reads, what logs show, and what the transport cache keys on.
|
|
610
|
-
*/
|
|
611
|
-
local: string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
612
|
-
/** A fresh identity for a namespace nothing has named yet. */
|
|
613
|
-
create: () => string & import("effect/Brand").Brand<"SandboxInstance.ID">;
|
|
614
|
-
};
|
|
615
|
-
type ID = typeof ID.Type;
|
|
616
|
-
/**
|
|
617
|
-
* The storage boundary for namespace references, in one place.
|
|
618
|
-
*
|
|
619
|
-
* The host filesystem exists whether or not a row describes it, so it gets no
|
|
620
|
-
* row and `NULL` is the only spelling of it — the Unix analogue is exact, since
|
|
621
|
-
* `/` has no entry in the mount table you consult to find other mounts. That
|
|
622
|
-
* makes a session or directory writable before any namespace is registered (the
|
|
623
|
-
* foreign key is skipped on NULL), makes `SET sandbox_instance_id = NULL` a
|
|
624
|
-
* meaningful "revert to the host", and leaves the host impossible to tombstone,
|
|
625
|
-
* collect, or destroy, because there is nothing to point at.
|
|
626
|
-
*
|
|
627
|
-
* Two SQLite consequences ride on this and break correctness silently if missed:
|
|
628
|
-
* unique indexes treat NULLs as distinct, so every uniqueness constraint
|
|
629
|
-
* spanning a namespace column coalesces to `'local'`; and `= NULL` never
|
|
630
|
-
* matches, so namespace-scoped reads use `IS`.
|
|
631
|
-
*/
|
|
632
|
-
declare const toColumn: (id: ID) => string | null;
|
|
633
|
-
declare const fromColumn: (value: string | null) => ID;
|
|
634
|
-
/**
|
|
635
|
-
* The same mapping for row models, whose optional columns are `Option` rather
|
|
636
|
-
* than `null`. Kept beside {@link toColumn} so the boundary stays one place:
|
|
637
|
-
* `toColumn`/`fromColumn` for SQL parameters, these for `Model.FieldOption`.
|
|
638
|
-
*/
|
|
639
|
-
declare const toField: (id: ID) => Option.Option<ID>;
|
|
640
|
-
declare const fromField: (value: Option.Option<ID>) => ID;
|
|
641
|
-
/**
|
|
642
|
-
* Filesystem-class taxonomy, mirroring Unix: disk, tmpfs/procfs, NFS/CIFS.
|
|
643
|
-
* Stored on the row rather than derived from the registered driver, so reading
|
|
644
|
-
* an instance never depends on the registry — which matters most when a driver
|
|
645
|
-
* is *not* configured and you need to list or clean up its rows.
|
|
646
|
-
*/
|
|
647
|
-
declare const Kind: Schema.Literals<readonly ["local", "virtual", "remote"]>;
|
|
648
|
-
type Kind = typeof Kind.Type;
|
|
649
|
-
declare const Ownership: Schema.Literals<readonly ["managed", "external"]>;
|
|
650
|
-
type Ownership = typeof Ownership.Type;
|
|
651
|
-
/**
|
|
652
|
-
* Lifecycle state, in ZFS pool vocabulary. This is the **last observed** value,
|
|
653
|
-
* not live driver truth: Daytona auto-stops and auto-archives, Vercel sandboxes
|
|
654
|
-
* expire on their own timeout, so drift is normal. `stateObservedAt` carries the
|
|
655
|
-
* freshness and `Controller.refresh` updates it without waking anything.
|
|
656
|
-
*
|
|
657
|
-
* `removed` and `unavail` are deliberately distinct. `removed` means we deleted
|
|
658
|
-
* it; `unavail` means the driver claims it is gone. A "not found" is frequently a
|
|
659
|
-
* misclassification — wrong region, wrong API url, a revoked key answering 404,
|
|
660
|
-
* eventual consistency right after create — so it must never be recorded as if we
|
|
661
|
-
* had destroyed the resource ourselves.
|
|
662
|
-
*/
|
|
663
|
-
declare const Status: Schema.Literals<readonly ["provisioning", "online", "offline", "suspending", "removing", "removed", "unavail", "faulted"]>;
|
|
664
|
-
type Status = typeof Status.Type;
|
|
665
|
-
/**
|
|
666
|
-
* The statuses a `mount` may proceed from. This is the predicate every
|
|
667
|
-
* conditional write depends on, so it is enumerated once here rather than
|
|
668
|
-
* restated as prose at each call site.
|
|
669
|
-
*
|
|
670
|
-
* `offline` qualifies because mounting wakes.
|
|
671
|
-
* `faulted` qualifies because a fault is a *usability* condition, not an identity one — see {@link Status}.
|
|
672
|
-
*
|
|
673
|
-
* There is no `resuming`: it would exist to be observed by nothing, since
|
|
674
|
-
* mounting wakes, `offline` is already mountable, and waking is not destructive
|
|
675
|
-
* so it needs no claim. `suspending` and `removing` stay because they *are*
|
|
676
|
-
* compare-and-set claims, blocking a concurrent mount mid-destruction.
|
|
677
|
-
*/
|
|
678
|
-
declare const mountable: ReadonlySet<Status>;
|
|
679
|
-
declare const isMountable: (status: Status) => boolean;
|
|
680
|
-
/**
|
|
681
|
-
* Reference state, derived — never stored. `busy` carries its `umount` meaning:
|
|
682
|
-
* something holds this and destruction must not proceed unforced.
|
|
683
|
-
*
|
|
684
|
-
* `pinned` is the kernel sense of the word: never reclaimable. It short-circuits
|
|
685
|
-
* counting entirely for instances that cannot be stopped or destroyed (the local
|
|
686
|
-
* host), which is what keeps them out of any future collector by construction
|
|
687
|
-
* rather than by an ownership check happening to catch them.
|
|
688
|
-
*/
|
|
689
|
-
declare const Usage: Schema.Literals<readonly ["idle", "busy", "pinned"]>;
|
|
690
|
-
type Usage = typeof Usage.Type;
|
|
691
|
-
/** Sanitized driver failure. The only error shape allowed to be persisted or logged. */
|
|
692
|
-
declare const PersistedError: Schema.Struct<{
|
|
693
|
-
readonly name: Schema.String;
|
|
694
|
-
readonly message: Schema.String;
|
|
695
|
-
readonly code: Schema.optional<Schema.String>;
|
|
696
|
-
}>;
|
|
697
|
-
type PersistedError = typeof PersistedError.Type;
|
|
698
|
-
/** Durable metadata, safe to return and persist. Assembled by the control plane. */
|
|
699
|
-
interface Info {
|
|
700
|
-
readonly id: ID;
|
|
701
|
-
readonly driver: Name;
|
|
702
|
-
readonly kind: Kind;
|
|
703
|
-
readonly providerResourceId: Option.Option<string>;
|
|
704
|
-
readonly ownership: Ownership;
|
|
705
|
-
readonly status: Status;
|
|
706
|
-
readonly usage: Usage;
|
|
707
|
-
/** References held by *this* control plane. Process-local; see the transport cache. */
|
|
708
|
-
readonly refCount: number;
|
|
709
|
-
readonly providerStatus: Option.Option<string>;
|
|
710
|
-
readonly metadata: Readonly<Record<string, string>>;
|
|
711
|
-
readonly lastError: Option.Option<PersistedError>;
|
|
712
|
-
readonly createdAt: Date;
|
|
713
|
-
readonly updatedAt: Date;
|
|
714
|
-
readonly stateObservedAt: Date;
|
|
715
|
-
readonly lastMountedAt: Option.Option<Date>;
|
|
716
|
-
readonly lastUnmountedAt: Option.Option<Date>;
|
|
717
|
-
readonly lastUsedAt: Option.Option<Date>;
|
|
718
|
-
readonly removedAt: Option.Option<Date>;
|
|
719
|
-
}
|
|
720
|
-
declare namespace driver_d_exports {
|
|
721
|
-
export { AbsolutePath, ApiVersion, Capabilities, Definition, Driver, Module, ModuleDefinition, Name, Observed, Provisioned, Registration, RuntimeConfigBase as RuntimeConfig, RuntimeConfigBase, RuntimeInput, driver_d_exports as SandboxDriver, apiVersion, driver, defineModule as module };
|
|
722
|
-
}
|
|
723
|
-
declare namespace io_d_exports {
|
|
724
|
-
export { Current, FileSystem$1 as FileSystem, Identity, Layer$1 as Layer, Provides, io_d_exports as SandboxIO, Shell };
|
|
725
|
-
}
|
|
726
|
-
declare namespace error_d_exports {
|
|
727
|
-
export { Redactor, SandboxProviderError, makeRedactor, providerError, providerErrorCause, providerErrorIsNotFound, sanitizeError };
|
|
728
|
-
}
|
|
729
|
-
declare namespace resource_d_exports {
|
|
730
|
-
export { resource_d_exports as SandboxResource, Service };
|
|
731
|
-
}
|
|
732
|
-
declare const Service_base: Context.ServiceClass<Service, "@codeworksh/harness/sandbox/resource/Service", {
|
|
733
|
-
readonly providerResourceId: string;
|
|
734
|
-
}>;
|
|
735
|
-
/**
|
|
736
|
-
* The driver's own locator for the attached resource — a Vercel sandbox name, a
|
|
737
|
-
* Daytona sandbox id.
|
|
738
|
-
*
|
|
739
|
-
* Deliberately *not* on `SandboxIO.Current`: consumers never parse one,
|
|
740
|
-
* and keeps it separate from the application id precisely so a driver's format can
|
|
741
|
-
* change without touching identity.
|
|
742
|
-
*
|
|
743
|
-
* It exists for the control plane, which records it as `provider_resource_id`,
|
|
744
|
-
* and for tests that reattach to the same resource.
|
|
745
|
-
*
|
|
746
|
-
* One tag for every driver rather than one per driver. A mount has exactly one
|
|
747
|
-
* driver, so there is nothing to disambiguate, and the control plane has to read
|
|
748
|
-
* the locator without knowing which driver produced it — keeps the
|
|
749
|
-
* driver name open, so anything keyed on a closed `"vercel" | "daytona"` set is
|
|
750
|
-
* a bug waiting for the third driver.
|
|
751
|
-
*/
|
|
752
|
-
declare class Service extends Service_base {}
|
|
753
|
-
declare namespace shell_d_exports {
|
|
754
|
-
export { ExecChunk, ExecResult, ISandboxExe, Shell$1 as Shell, ShellError, ShellOptions, fromExec, quote, quoteArgv };
|
|
755
|
-
}
|
|
756
|
-
//#endregion
|
|
757
|
-
export { SandboxDriverLoadError as A, errors_d_exports as B, Current as C, io_d_exports$1 as D, Provides as E, SandboxReadError as F, FileSystemError as H, SandboxRefreshError as I, SandboxRegisterError as L, SandboxDriverRegistrationError as M, SandboxMountError as N, SandboxCreateError as O, SandboxNotFoundError as P, SandboxStopError as R, driver_d_exports$1 as S, Layer$1 as T, Service$1 as U, Shell$1 as V, filesystem_d_exports as W, Name as _, driver_d_exports as a, RuntimeConfigBase as b, Status as c, AbsolutePath as d, ApiVersion as f, Module as g, Driver as h, io_d_exports as i, SandboxDriverNotRegisteredError as j, SandboxDestroyError as k, Usage as l, Definition as m, resource_d_exports as n, ID as o, Capabilities as p, error_d_exports as r, Info as s, shell_d_exports as t, instance_d_exports as u, Registered as v, Identity as w, Source as x, Registration as y, SandboxWakeError as z };
|
|
758
|
-
//# sourceMappingURL=sandbox-DX9mliQs.d.mts.map
|