@alchemy.run/daytona 0.0.0-stage → 2.0.0-beta.86
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/LICENSE +201 -0
- package/README.md +80 -2
- package/lib/ApiKey.d.ts +99 -0
- package/lib/ApiKey.d.ts.map +1 -0
- package/lib/ApiKey.js +152 -0
- package/lib/ApiKey.js.map +1 -0
- package/lib/AuthProvider.d.ts +55 -0
- package/lib/AuthProvider.d.ts.map +1 -0
- package/lib/AuthProvider.js +280 -0
- package/lib/AuthProvider.js.map +1 -0
- package/lib/Bootstrap.d.ts +8 -0
- package/lib/Bootstrap.d.ts.map +1 -0
- package/lib/Bootstrap.js +28 -0
- package/lib/Bootstrap.js.map +1 -0
- package/lib/ConnectSandbox.d.ts +72 -0
- package/lib/ConnectSandbox.d.ts.map +1 -0
- package/lib/ConnectSandbox.js +3 -0
- package/lib/ConnectSandbox.js.map +1 -0
- package/lib/ConnectSandboxHttp.d.ts +5 -0
- package/lib/ConnectSandboxHttp.d.ts.map +1 -0
- package/lib/ConnectSandboxHttp.js +22 -0
- package/lib/ConnectSandboxHttp.js.map +1 -0
- package/lib/Contributions.d.ts +7 -0
- package/lib/Contributions.d.ts.map +1 -0
- package/lib/Contributions.js +6 -0
- package/lib/Contributions.js.map +1 -0
- package/lib/CreateSandbox.d.ts +86 -0
- package/lib/CreateSandbox.d.ts.map +1 -0
- package/lib/CreateSandbox.js +3 -0
- package/lib/CreateSandbox.js.map +1 -0
- package/lib/CreateSandboxHttp.d.ts +5 -0
- package/lib/CreateSandboxHttp.d.ts.map +1 -0
- package/lib/CreateSandboxHttp.js +65 -0
- package/lib/CreateSandboxHttp.js.map +1 -0
- package/lib/CreateSecret.d.ts +56 -0
- package/lib/CreateSecret.d.ts.map +1 -0
- package/lib/CreateSecret.js +3 -0
- package/lib/CreateSecret.js.map +1 -0
- package/lib/CreateSecretHttp.d.ts +5 -0
- package/lib/CreateSecretHttp.d.ts.map +1 -0
- package/lib/CreateSecretHttp.js +39 -0
- package/lib/CreateSecretHttp.js.map +1 -0
- package/lib/CreateSnapshot.d.ts +80 -0
- package/lib/CreateSnapshot.d.ts.map +1 -0
- package/lib/CreateSnapshot.js +3 -0
- package/lib/CreateSnapshot.js.map +1 -0
- package/lib/CreateSnapshotHttp.d.ts +5 -0
- package/lib/CreateSnapshotHttp.d.ts.map +1 -0
- package/lib/CreateSnapshotHttp.js +47 -0
- package/lib/CreateSnapshotHttp.js.map +1 -0
- package/lib/CreateVolume.d.ts +81 -0
- package/lib/CreateVolume.d.ts.map +1 -0
- package/lib/CreateVolume.js +10 -0
- package/lib/CreateVolume.js.map +1 -0
- package/lib/CreateVolumeHttp.d.ts +5 -0
- package/lib/CreateVolumeHttp.d.ts.map +1 -0
- package/lib/CreateVolumeHttp.js +31 -0
- package/lib/CreateVolumeHttp.js.map +1 -0
- package/lib/Credentials.d.ts +9 -0
- package/lib/Credentials.d.ts.map +1 -0
- package/lib/Credentials.js +18 -0
- package/lib/Credentials.js.map +1 -0
- package/lib/DaytonaBindings.d.ts +51 -0
- package/lib/DaytonaBindings.d.ts.map +1 -0
- package/lib/DaytonaBindings.js +61 -0
- package/lib/DaytonaBindings.js.map +1 -0
- package/lib/IdentityProvider.d.ts +80 -0
- package/lib/IdentityProvider.d.ts.map +1 -0
- package/lib/IdentityProvider.js +111 -0
- package/lib/IdentityProvider.js.map +1 -0
- package/lib/MountVolume.d.ts +86 -0
- package/lib/MountVolume.d.ts.map +1 -0
- package/lib/MountVolume.js +27 -0
- package/lib/MountVolume.js.map +1 -0
- package/lib/OAuthClient.d.ts +14 -0
- package/lib/OAuthClient.d.ts.map +1 -0
- package/lib/OAuthClient.js +23 -0
- package/lib/OAuthClient.js.map +1 -0
- package/lib/Organization.d.ts +40 -0
- package/lib/Organization.d.ts.map +1 -0
- package/lib/Organization.js +80 -0
- package/lib/Organization.js.map +1 -0
- package/lib/OrganizationInvitation.d.ts +70 -0
- package/lib/OrganizationInvitation.d.ts.map +1 -0
- package/lib/OrganizationInvitation.js +109 -0
- package/lib/OrganizationInvitation.js.map +1 -0
- package/lib/OrganizationMember.d.ts +86 -0
- package/lib/OrganizationMember.d.ts.map +1 -0
- package/lib/OrganizationMember.js +109 -0
- package/lib/OrganizationMember.js.map +1 -0
- package/lib/OrganizationOtelConfig.d.ts +59 -0
- package/lib/OrganizationOtelConfig.d.ts.map +1 -0
- package/lib/OrganizationOtelConfig.js +87 -0
- package/lib/OrganizationOtelConfig.js.map +1 -0
- package/lib/OrganizationRole.d.ts +66 -0
- package/lib/OrganizationRole.d.ts.map +1 -0
- package/lib/OrganizationRole.js +106 -0
- package/lib/OrganizationRole.js.map +1 -0
- package/lib/OrganizationSettings.d.ts +76 -0
- package/lib/OrganizationSettings.d.ts.map +1 -0
- package/lib/OrganizationSettings.js +107 -0
- package/lib/OrganizationSettings.js.map +1 -0
- package/lib/Providers.d.ts +14 -0
- package/lib/Providers.d.ts.map +1 -0
- package/lib/Providers.js +53 -0
- package/lib/Providers.js.map +1 -0
- package/lib/ReadAuditLogs.d.ts +30 -0
- package/lib/ReadAuditLogs.d.ts.map +1 -0
- package/lib/ReadAuditLogs.js +17 -0
- package/lib/ReadAuditLogs.js.map +1 -0
- package/lib/ReadOrganization.d.ts +39 -0
- package/lib/ReadOrganization.d.ts.map +1 -0
- package/lib/ReadOrganization.js +39 -0
- package/lib/ReadOrganization.js.map +1 -0
- package/lib/ReadUsage.d.ts +31 -0
- package/lib/ReadUsage.d.ts.map +1 -0
- package/lib/ReadUsage.js +17 -0
- package/lib/ReadUsage.js.map +1 -0
- package/lib/Region.d.ts +78 -0
- package/lib/Region.d.ts.map +1 -0
- package/lib/Region.js +169 -0
- package/lib/Region.js.map +1 -0
- package/lib/Registry.d.ts +84 -0
- package/lib/Registry.d.ts.map +1 -0
- package/lib/Registry.js +97 -0
- package/lib/Registry.js.map +1 -0
- package/lib/Runner.d.ts +66 -0
- package/lib/Runner.d.ts.map +1 -0
- package/lib/Runner.js +116 -0
- package/lib/Runner.js.map +1 -0
- package/lib/Sandbox.d.ts +376 -0
- package/lib/Sandbox.d.ts.map +1 -0
- package/lib/Sandbox.js +565 -0
- package/lib/Sandbox.js.map +1 -0
- package/lib/SandboxClient.d.ts +258 -0
- package/lib/SandboxClient.d.ts.map +1 -0
- package/lib/SandboxClient.js +233 -0
- package/lib/SandboxClient.js.map +1 -0
- package/lib/Secret.d.ts +93 -0
- package/lib/Secret.d.ts.map +1 -0
- package/lib/Secret.js +130 -0
- package/lib/Secret.js.map +1 -0
- package/lib/Snapshot.d.ts +327 -0
- package/lib/Snapshot.d.ts.map +1 -0
- package/lib/Snapshot.js +447 -0
- package/lib/Snapshot.js.map +1 -0
- package/lib/Volume.d.ts +99 -0
- package/lib/Volume.d.ts.map +1 -0
- package/lib/Volume.js +152 -0
- package/lib/Volume.js.map +1 -0
- package/lib/WarmPool.d.ts +61 -0
- package/lib/WarmPool.d.ts.map +1 -0
- package/lib/WarmPool.js +81 -0
- package/lib/WarmPool.js.map +1 -0
- package/lib/Webhooks.d.ts +58 -0
- package/lib/Webhooks.d.ts.map +1 -0
- package/lib/Webhooks.js +75 -0
- package/lib/Webhooks.js.map +1 -0
- package/lib/index.d.ts +37 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +36 -0
- package/lib/index.js.map +1 -0
- package/lib/internal/BuildContext.d.ts +16 -0
- package/lib/internal/BuildContext.d.ts.map +1 -0
- package/lib/internal/BuildContext.js +50 -0
- package/lib/internal/BuildContext.js.map +1 -0
- package/lib/internal/Declared.d.ts +29 -0
- package/lib/internal/Declared.d.ts.map +1 -0
- package/lib/internal/Declared.js +31 -0
- package/lib/internal/Declared.js.map +1 -0
- package/lib/internal/Derived.d.ts +40 -0
- package/lib/internal/Derived.d.ts.map +1 -0
- package/lib/internal/Derived.js +64 -0
- package/lib/internal/Derived.js.map +1 -0
- package/lib/internal/Errors.d.ts +4 -0
- package/lib/internal/Errors.d.ts.map +1 -0
- package/lib/internal/Errors.js +1 -0
- package/lib/internal/Errors.js.map +1 -0
- package/lib/internal/Labels.d.ts +20 -0
- package/lib/internal/Labels.d.ts.map +1 -0
- package/lib/internal/Labels.js +22 -0
- package/lib/internal/Labels.js.map +1 -0
- package/lib/internal/Names.d.ts +18 -0
- package/lib/internal/Names.d.ts.map +1 -0
- package/lib/internal/Names.js +25 -0
- package/lib/internal/Names.js.map +1 -0
- package/lib/internal/Organization.d.ts +27 -0
- package/lib/internal/Organization.d.ts.map +1 -0
- package/lib/internal/Organization.js +32 -0
- package/lib/internal/Organization.js.map +1 -0
- package/lib/internal/Process.d.ts +14 -0
- package/lib/internal/Process.d.ts.map +1 -0
- package/lib/internal/Process.js +15 -0
- package/lib/internal/Process.js.map +1 -0
- package/lib/internal/Program.d.ts +83 -0
- package/lib/internal/Program.d.ts.map +1 -0
- package/lib/internal/Program.js +169 -0
- package/lib/internal/Program.js.map +1 -0
- package/lib/internal/Ref.d.ts +14 -0
- package/lib/internal/Ref.d.ts.map +1 -0
- package/lib/internal/Ref.js +7 -0
- package/lib/internal/Ref.js.map +1 -0
- package/lib/internal/Scoped.d.ts +31 -0
- package/lib/internal/Scoped.d.ts.map +1 -0
- package/lib/internal/Scoped.js +48 -0
- package/lib/internal/Scoped.js.map +1 -0
- package/lib/internal/Tar.d.ts +13 -0
- package/lib/internal/Tar.d.ts.map +1 -0
- package/lib/internal/Tar.js +62 -0
- package/lib/internal/Tar.js.map +1 -0
- package/lib/internal/Toolbox.d.ts +11 -0
- package/lib/internal/Toolbox.d.ts.map +1 -0
- package/lib/internal/Toolbox.js +20 -0
- package/lib/internal/Toolbox.js.map +1 -0
- package/lib/internal/Wait.d.ts +49 -0
- package/lib/internal/Wait.d.ts.map +1 -0
- package/lib/internal/Wait.js +57 -0
- package/lib/internal/Wait.js.map +1 -0
- package/package.json +79 -3
- package/src/ApiKey.ts +221 -0
- package/src/AuthProvider.ts +406 -0
- package/src/Bootstrap.ts +55 -0
- package/src/ConnectSandbox.ts +76 -0
- package/src/ConnectSandboxHttp.ts +26 -0
- package/src/Contributions.ts +9 -0
- package/src/CreateSandbox.ts +107 -0
- package/src/CreateSandboxHttp.ts +97 -0
- package/src/CreateSecret.ts +73 -0
- package/src/CreateSecretHttp.ts +58 -0
- package/src/CreateSnapshot.ts +133 -0
- package/src/CreateSnapshotHttp.ts +77 -0
- package/src/CreateVolume.ts +104 -0
- package/src/CreateVolumeHttp.ts +50 -0
- package/src/Credentials.ts +37 -0
- package/src/DaytonaBindings.ts +111 -0
- package/src/IdentityProvider.ts +181 -0
- package/src/MountVolume.ts +122 -0
- package/src/OAuthClient.ts +27 -0
- package/src/Organization.ts +121 -0
- package/src/OrganizationInvitation.ts +174 -0
- package/src/OrganizationMember.ts +174 -0
- package/src/OrganizationOtelConfig.ts +138 -0
- package/src/OrganizationRole.ts +167 -0
- package/src/OrganizationSettings.ts +187 -0
- package/src/Providers.ts +93 -0
- package/src/ReadAuditLogs.ts +50 -0
- package/src/ReadOrganization.ts +83 -0
- package/src/ReadUsage.ts +51 -0
- package/src/Region.ts +226 -0
- package/src/Registry.ts +164 -0
- package/src/Runner.ts +166 -0
- package/src/Sandbox.ts +927 -0
- package/src/SandboxClient.ts +625 -0
- package/src/Secret.ts +203 -0
- package/src/Snapshot.ts +685 -0
- package/src/Volume.ts +229 -0
- package/src/WarmPool.ts +128 -0
- package/src/Webhooks.ts +121 -0
- package/src/globals.d.ts +2 -0
- package/src/index.ts +46 -0
- package/src/internal/BuildContext.ts +62 -0
- package/src/internal/Declared.ts +80 -0
- package/src/internal/Derived.ts +97 -0
- package/src/internal/Errors.ts +4 -0
- package/src/internal/Labels.ts +39 -0
- package/src/internal/Names.ts +37 -0
- package/src/internal/Organization.ts +40 -0
- package/src/internal/Process.ts +25 -0
- package/src/internal/Program.ts +239 -0
- package/src/internal/Ref.ts +15 -0
- package/src/internal/Scoped.ts +102 -0
- package/src/internal/Tar.ts +72 -0
- package/src/internal/Toolbox.ts +27 -0
- package/src/internal/Wait.ts +105 -0
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import * as computerUse from "@distilled.cloud/daytona/computer_use";
|
|
2
|
+
import type { Credentials } from "@distilled.cloud/daytona/Credentials";
|
|
3
|
+
import * as fileSystem from "@distilled.cloud/daytona/file_system";
|
|
4
|
+
import * as git from "@distilled.cloud/daytona/git";
|
|
5
|
+
import * as info from "@distilled.cloud/daytona/info";
|
|
6
|
+
import * as interpreter from "@distilled.cloud/daytona/interpreter";
|
|
7
|
+
import * as lsp from "@distilled.cloud/daytona/lsp";
|
|
8
|
+
import * as port from "@distilled.cloud/daytona/port";
|
|
9
|
+
import * as process from "@distilled.cloud/daytona/process";
|
|
10
|
+
import type { DaytonaOpError } from "@distilled.cloud/daytona/Protocol";
|
|
11
|
+
import * as sandboxes from "@distilled.cloud/daytona/sandbox";
|
|
12
|
+
import * as server from "@distilled.cloud/daytona/server";
|
|
13
|
+
import * as system from "@distilled.cloud/daytona/system";
|
|
14
|
+
import * as telemetry from "@distilled.cloud/daytona/telemetry";
|
|
15
|
+
import * as toolboxStreams from "@distilled.cloud/daytona/Toolbox";
|
|
16
|
+
import type { RuntimeContext } from "alchemy/RuntimeContext";
|
|
17
|
+
import * as Sandbox from "alchemy/Sandbox";
|
|
18
|
+
import * as Effect from "effect/Effect";
|
|
19
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
20
|
+
import type * as HttpClientError from "effect/http/HttpClientError";
|
|
21
|
+
import * as Redacted from "effect/Redacted";
|
|
22
|
+
import type * as Scope from "effect/Scope";
|
|
23
|
+
import * as Stream from "effect/Stream";
|
|
24
|
+
import { type ScopedModule } from "./internal/Scoped.ts";
|
|
25
|
+
/** Operations of the sandbox service that act on one sandbox. */
|
|
26
|
+
declare const SANDBOX_OPERATIONS: readonly ["getSandbox", "deleteSandbox", "startSandbox", "stopSandbox", "pauseSandbox", "archiveSandbox", "recoverSandbox", "resizeSandbox", "replaceLabels", "setAutostopInterval", "setAutoPauseInterval", "setAutoArchiveInterval", "setAutoDeleteInterval", "setTtl", "updateNetworkSettings", "updatePublicStatus", "updateSandboxSecrets", "createSandboxSnapshot", "forkSandbox", "getSandboxForks", "getSandboxParent", "getSandboxAncestors", "getRegionQuotaBySandboxId", "getPortPreviewUrl", "getSignedPortPreviewUrl", "expireSignedPortPreviewUrl", "getBuildLogsUrl", "createSshAccess", "revokeSshAccess", "getSandboxSigningKey", "rotateSigningKey", "getSandboxLogs", "getSandboxTraces", "getSandboxTraceSpans", "getSandboxMetrics"];
|
|
27
|
+
type SandboxOperations = Pick<typeof sandboxes, (typeof SANDBOX_OPERATIONS)[number]>;
|
|
28
|
+
/**
|
|
29
|
+
* Every error a handle's shared calls (`exec`, `start`, `files`, `pty`,
|
|
30
|
+
* `fetch`) can fail with.
|
|
31
|
+
*/
|
|
32
|
+
export type DaytonaError = DaytonaOpError | process.SessionNotFound | process.SessionCommandNotFound | process.SessionInputNotReady | sandboxes.SandboxNotFound | toolboxStreams.PtyError | toolboxStreams.ToolboxSocketError | HttpClientError.HttpClientError;
|
|
33
|
+
/**
|
|
34
|
+
* What `exec` returns. Daytona runs a command with stdout and stderr on one
|
|
35
|
+
* stream, so the output is combined in `result`, as Daytona names it.
|
|
36
|
+
*/
|
|
37
|
+
export interface ExecResult {
|
|
38
|
+
readonly exitCode: number;
|
|
39
|
+
readonly result: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* `exec` and `start` options. Daytona's command API takes no stdin, so
|
|
43
|
+
* there is no `stdin` option: `start` a process and `write` to it instead.
|
|
44
|
+
*/
|
|
45
|
+
export type ExecOptions = Omit<Sandbox.ExecOptions, "stdin">;
|
|
46
|
+
/** A command, as a shell line or as an argument vector run without a shell. */
|
|
47
|
+
export type Command = Sandbox.Command;
|
|
48
|
+
/**
|
|
49
|
+
* A command started with `start`, running in its own Daytona session.
|
|
50
|
+
* Its `id` is the session's; `kill` deletes the session, which ends the
|
|
51
|
+
* command whatever the signal (Daytona takes no signal).
|
|
52
|
+
*/
|
|
53
|
+
export interface SandboxProcess extends Sandbox.Process<DaytonaError> {
|
|
54
|
+
/** The session the command runs in (also its `id`). */
|
|
55
|
+
readonly sessionId: string;
|
|
56
|
+
/** The command's ID in that session. */
|
|
57
|
+
readonly commandId: string;
|
|
58
|
+
}
|
|
59
|
+
/** Files in the sandbox, over Daytona's file API; entries are Daytona's `FileInfo`. */
|
|
60
|
+
export interface SandboxFiles extends Sandbox.Files<DaytonaError, fileSystem.FileInfo> {
|
|
61
|
+
/** Delete a file, or a directory (and what it holds). */
|
|
62
|
+
remove(path: string): Effect.Effect<void, DaytonaError, RuntimeContext>;
|
|
63
|
+
/** Create a directory and its parents, with `mode` (octal). */
|
|
64
|
+
makeDir(path: string, options?: {
|
|
65
|
+
readonly mode?: string;
|
|
66
|
+
}): Effect.Effect<void, DaytonaError, RuntimeContext>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* `pty.open` options. Daytona starts the user's shell and takes no
|
|
70
|
+
* command, so there is no `command`: type it into the terminal.
|
|
71
|
+
*/
|
|
72
|
+
export interface PtyOpenOptions {
|
|
73
|
+
/** Session ID. @default a generated one */
|
|
74
|
+
readonly id?: string;
|
|
75
|
+
/** @default 80 */
|
|
76
|
+
readonly cols?: number;
|
|
77
|
+
/** @default 24 */
|
|
78
|
+
readonly rows?: number;
|
|
79
|
+
/** Working directory. */
|
|
80
|
+
readonly cwd?: string;
|
|
81
|
+
/** Environment variables for the shell. */
|
|
82
|
+
readonly env?: Readonly<Record<string, string>>;
|
|
83
|
+
}
|
|
84
|
+
/** An open terminal, with Daytona's `kill` and `exit` next to the shared calls. */
|
|
85
|
+
export interface PtyConnection extends Sandbox.PtyConnection<DaytonaError> {
|
|
86
|
+
/** Kill the terminal's session. */
|
|
87
|
+
readonly kill: Effect.Effect<void, DaytonaError, RuntimeContext>;
|
|
88
|
+
/** Wait for the shell to exit. */
|
|
89
|
+
readonly exit: Effect.Effect<toolboxStreams.PtyExit, DaytonaError, RuntimeContext>;
|
|
90
|
+
}
|
|
91
|
+
/** Terminals. */
|
|
92
|
+
export interface SandboxPty extends Sandbox.Pty<DaytonaError, PtyOpenOptions | undefined> {
|
|
93
|
+
open(options?: PtyOpenOptions): Effect.Effect<PtyConnection, DaytonaError, RuntimeContext | Scope.Scope>;
|
|
94
|
+
/** Connect to a terminal that already runs. */
|
|
95
|
+
connect(sessionId: string): Effect.Effect<PtyConnection, DaytonaError, RuntimeContext | Scope.Scope>;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Terminals and followed logs: the process calls that stream over a
|
|
99
|
+
* WebSocket.
|
|
100
|
+
*/
|
|
101
|
+
export interface SandboxProcessStreams {
|
|
102
|
+
/**
|
|
103
|
+
* Create a terminal session and connect to it. The connection closes
|
|
104
|
+
* with the scope; the session keeps running until it exits or is
|
|
105
|
+
* killed.
|
|
106
|
+
*/
|
|
107
|
+
createPty(request: toolboxStreams.CreatePtyRequest): Effect.Effect<toolboxStreams.PtyConnection, toolboxStreams.PtyError, RuntimeContext | Scope.Scope>;
|
|
108
|
+
/** Connect to an existing terminal session. The connection closes with the scope. */
|
|
109
|
+
connectPty(request: {
|
|
110
|
+
readonly sessionId: string;
|
|
111
|
+
}): Effect.Effect<toolboxStreams.PtyConnection, toolboxStreams.PtyError, RuntimeContext | Scope.Scope>;
|
|
112
|
+
/**
|
|
113
|
+
* Follow a session command's output while it runs, as stdout and
|
|
114
|
+
* stderr pieces. The stream ends when the command exits.
|
|
115
|
+
*/
|
|
116
|
+
followSessionCommandLogs(request: {
|
|
117
|
+
readonly sessionId: string;
|
|
118
|
+
readonly commandId: string;
|
|
119
|
+
}): Stream.Stream<toolboxStreams.LogOutput, toolboxStreams.ToolboxSocketOpenError, RuntimeContext>;
|
|
120
|
+
/** Follow the entrypoint's output. The stream ends when the entrypoint exits. */
|
|
121
|
+
followEntrypointLogs(): Stream.Stream<toolboxStreams.LogOutput, toolboxStreams.ToolboxSocketOpenError, RuntimeContext>;
|
|
122
|
+
}
|
|
123
|
+
/** Code runs in an interpreter context, streamed over a WebSocket. */
|
|
124
|
+
export interface SandboxInterpreterRuns {
|
|
125
|
+
/**
|
|
126
|
+
* Run code and wait for it: its stdout, stderr and the exception it
|
|
127
|
+
* raised, if any.
|
|
128
|
+
*/
|
|
129
|
+
executeInterpreterCode(request: toolboxStreams.InterpreterCodeRequest): Effect.Effect<toolboxStreams.InterpreterResult, toolboxStreams.InterpreterCodeError, RuntimeContext>;
|
|
130
|
+
/** Run code and stream its output as it is produced. */
|
|
131
|
+
streamInterpreterCode(request: toolboxStreams.InterpreterCodeRequest): Stream.Stream<toolboxStreams.InterpreterOutput, toolboxStreams.InterpreterCodeError, RuntimeContext>;
|
|
132
|
+
}
|
|
133
|
+
/** Several files in one request. */
|
|
134
|
+
export interface SandboxBulkFiles {
|
|
135
|
+
/** Upload several files. Existing files are overwritten; parent directories are created. */
|
|
136
|
+
uploadFiles(request: {
|
|
137
|
+
readonly files: ReadonlyArray<toolboxStreams.UploadFileEntry>;
|
|
138
|
+
}): Effect.Effect<toolboxStreams.UploadFilesResult, toolboxStreams.BulkTransferError, RuntimeContext>;
|
|
139
|
+
/** Download several files. A path that can't be read is reported in `errors`. */
|
|
140
|
+
downloadFiles(request: {
|
|
141
|
+
readonly paths: ReadonlyArray<string>;
|
|
142
|
+
}): Effect.Effect<toolboxStreams.DownloadFilesResult, toolboxStreams.BulkTransferError, RuntimeContext>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* One Daytona sandbox, as a runtime client. Every Daytona operation that
|
|
146
|
+
* acts on a sandbox is a method here, with Daytona's own parameters and
|
|
147
|
+
* typed errors and the sandbox filled in: lifecycle on the handle itself
|
|
148
|
+
* (`startSandbox`, `forkSandbox`, `createSandboxSnapshot`,
|
|
149
|
+
* `getSignedPortPreviewUrl`, …) and the in-sandbox toolbox under
|
|
150
|
+
* `process`, `fs`, `git`, `lsp`, `interpreter`, `computerUse`, `ports`,
|
|
151
|
+
* `info`, `system` and `server`. Telemetry from Daytona's analytics API is
|
|
152
|
+
* under `telemetry`.
|
|
153
|
+
*
|
|
154
|
+
* Every method needs `RuntimeContext`: it runs in a deployed runtime, with
|
|
155
|
+
* the API key its binding minted.
|
|
156
|
+
*/
|
|
157
|
+
export interface DaytonaSandbox extends ScopedModule<SandboxOperations>, Sandbox.SandboxExec<DaytonaError, ExecResult, ExecOptions>, Sandbox.SandboxProcesses<DaytonaError, ExecOptions>, Sandbox.SandboxFiles<DaytonaError, fileSystem.FileInfo>, Sandbox.SandboxPty<DaytonaError, PtyOpenOptions | undefined>, Sandbox.SandboxPorts<DaytonaError, SandboxPort> {
|
|
158
|
+
/** Sandbox ID. */
|
|
159
|
+
readonly sandboxId: string;
|
|
160
|
+
/** Sandbox name. */
|
|
161
|
+
readonly name: string;
|
|
162
|
+
/** The sandbox's toolbox proxy. */
|
|
163
|
+
readonly toolboxProxyUrl: string;
|
|
164
|
+
/** Processes, sessions, terminals and code runs. */
|
|
165
|
+
readonly process: ScopedModule<typeof process> & SandboxProcessStreams;
|
|
166
|
+
/** Files: read, write, list, search, replace, permissions, bulk transfer. */
|
|
167
|
+
readonly fs: ScopedModule<typeof fileSystem> & SandboxBulkFiles;
|
|
168
|
+
/** Git: clone, branch, commit, push, pull, status. */
|
|
169
|
+
readonly git: ScopedModule<typeof git>;
|
|
170
|
+
/** Language servers: start, completions, symbols. */
|
|
171
|
+
readonly lsp: ScopedModule<typeof lsp>;
|
|
172
|
+
/** Stateful code interpreter contexts, and code runs in them. */
|
|
173
|
+
readonly interpreter: ScopedModule<typeof interpreter> & SandboxInterpreterRuns;
|
|
174
|
+
/** Desktop control: screenshots, mouse, keyboard, recordings, accessibility. */
|
|
175
|
+
readonly computerUse: ScopedModule<typeof computerUse>;
|
|
176
|
+
/** Listening ports. */
|
|
177
|
+
readonly ports: ScopedModule<typeof port>;
|
|
178
|
+
/** Home and working directory, daemon version. */
|
|
179
|
+
readonly info: ScopedModule<typeof info>;
|
|
180
|
+
/** System metrics. */
|
|
181
|
+
readonly system: ScopedModule<typeof system>;
|
|
182
|
+
/** Daemon environment. */
|
|
183
|
+
readonly server: ScopedModule<typeof server>;
|
|
184
|
+
/** Logs, traces and metrics the sandbox exported. */
|
|
185
|
+
readonly telemetry: ScopedModule<typeof telemetry>;
|
|
186
|
+
/**
|
|
187
|
+
* Run a command and wait for it. A string runs in a shell (pipes, quotes
|
|
188
|
+
* and `&&` work); an array runs as an argument vector. A non-zero exit
|
|
189
|
+
* is returned, not failed.
|
|
190
|
+
*/
|
|
191
|
+
exec(command: Command, options?: ExecOptions): Effect.Effect<ExecResult, DaytonaError, RuntimeContext>;
|
|
192
|
+
/**
|
|
193
|
+
* Start a command in its own session and return it while it runs. Closing
|
|
194
|
+
* the scope detaches; the command keeps running until it exits or is killed.
|
|
195
|
+
*/
|
|
196
|
+
start(command: Command, options?: ExecOptions): Effect.Effect<SandboxProcess, DaytonaError, RuntimeContext | Scope.Scope>;
|
|
197
|
+
/** Files: read, write, list, stat, remove, make directories. */
|
|
198
|
+
readonly files: SandboxFiles;
|
|
199
|
+
/** Terminals. */
|
|
200
|
+
readonly pty: SandboxPty;
|
|
201
|
+
/**
|
|
202
|
+
* A port in the sandbox, reached through its preview URL. `fetch` sends
|
|
203
|
+
* a client request (its URL is a path on the port) or proxies a server
|
|
204
|
+
* request, with the preview token.
|
|
205
|
+
*/
|
|
206
|
+
getTcpPort(port: number): Effect.Effect<SandboxPort, DaytonaError, RuntimeContext>;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* A port in a Daytona sandbox, as its preview URL serves it. `fetch` sends
|
|
210
|
+
* the preview token for you; use `url` and `token` to reach it any other
|
|
211
|
+
* way (a browser needs `getSignedPortPreviewUrl` instead).
|
|
212
|
+
*/
|
|
213
|
+
export interface SandboxPort extends Sandbox.SandboxPort<DaytonaError> {
|
|
214
|
+
/** The port number. */
|
|
215
|
+
readonly port: number;
|
|
216
|
+
/** Preview URL of the port, as Daytona names it. */
|
|
217
|
+
readonly url: string;
|
|
218
|
+
/**
|
|
219
|
+
* Preview token, sent as `X-Daytona-Preview-Token`. A `public` sandbox's
|
|
220
|
+
* previews don't need it.
|
|
221
|
+
*/
|
|
222
|
+
readonly token: Redacted.Redacted<string>;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The handle {@link ConnectSandbox} returns for a sandbox declared at
|
|
226
|
+
* deploy. Its methods are the same as {@link DaytonaSandbox}'s; its
|
|
227
|
+
* identity resolves at runtime, so `sandboxId`, `name` and
|
|
228
|
+
* `toolboxProxyUrl` are Effects.
|
|
229
|
+
*/
|
|
230
|
+
export interface ConnectedSandbox extends Omit<DaytonaSandbox, "sandboxId" | "name" | "toolboxProxyUrl"> {
|
|
231
|
+
/** Sandbox ID. */
|
|
232
|
+
readonly sandboxId: Effect.Effect<string, never, RuntimeContext>;
|
|
233
|
+
/** Sandbox name. */
|
|
234
|
+
readonly name: Effect.Effect<string, never, RuntimeContext>;
|
|
235
|
+
/** The sandbox's toolbox proxy. */
|
|
236
|
+
readonly toolboxProxyUrl: Effect.Effect<string, never, RuntimeContext>;
|
|
237
|
+
}
|
|
238
|
+
/** What a binding needs to build a handle. */
|
|
239
|
+
export interface SandboxIdentity {
|
|
240
|
+
readonly id: string;
|
|
241
|
+
readonly name: string;
|
|
242
|
+
readonly toolboxProxyUrl: string;
|
|
243
|
+
}
|
|
244
|
+
type Runner = <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, Credentials | HttpClient.HttpClient> | RuntimeContext>;
|
|
245
|
+
/** Everything on a handle but its identity. */
|
|
246
|
+
export type SandboxMethods = Omit<DaytonaSandbox, "sandboxId" | "name" | "toolboxProxyUrl">;
|
|
247
|
+
/**
|
|
248
|
+
* Build the methods for one sandbox. `identity` resolves the sandbox (at
|
|
249
|
+
* runtime for a sandbox declared at deploy); `run` supplies the binding's
|
|
250
|
+
* credentials, and toolbox calls are additionally scoped to the sandbox.
|
|
251
|
+
*/
|
|
252
|
+
export declare const makeSandboxMethods: (identity: Effect.Effect<SandboxIdentity, never, RuntimeContext>, organizationId: Effect.Effect<string, never, RuntimeContext>, run: Runner) => SandboxMethods;
|
|
253
|
+
/** The handle for a sandbox whose identity is known (one just created or listed). */
|
|
254
|
+
export declare const makeSandboxClient: (sandbox: SandboxIdentity, organizationId: Effect.Effect<string, never, RuntimeContext>, run: Runner) => DaytonaSandbox;
|
|
255
|
+
/** The handle for a sandbox declared at deploy, whose identity resolves at runtime. */
|
|
256
|
+
export declare const makeConnectedSandbox: (identity: Effect.Effect<SandboxIdentity, never, RuntimeContext>, organizationId: Effect.Effect<string, never, RuntimeContext>, run: Runner) => ConnectedSandbox;
|
|
257
|
+
export {};
|
|
258
|
+
//# sourceMappingURL=SandboxClient.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxClient.d.ts","sources":["../src/SandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,uCAAuC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,KAAK,UAAU,MAAM,sCAAsC,CAAC;AACnE,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,WAAW,MAAM,sCAAsC,CAAC;AACpE,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,OAAO,MAAM,kCAAkC,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAC1D,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAC1D,OAAO,KAAK,SAAS,MAAM,oCAAoC,CAAC;AACh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AAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,OACvD,MAAM,KACV,cAkMF,CAAC;AAEF,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,YACnB,eAAe,kBACR,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,OACvD,MAAM,KACV,cAKD,CAAC;AAEH,uFAAuF;AACvF,eAAO,MAAM,oBAAoB,aACrB,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,EAAE,cAAc,CAAC,kBAC/C,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,EAAE,cAAc,CAAC,OACvD,MAAM,KACV,gBAKD,CAAC"}
|
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
import * as computerUse from "@distilled.cloud/daytona/computer_use";
|
|
2
|
+
import * as fileSystem from "@distilled.cloud/daytona/file_system";
|
|
3
|
+
import * as git from "@distilled.cloud/daytona/git";
|
|
4
|
+
import * as info from "@distilled.cloud/daytona/info";
|
|
5
|
+
import * as interpreter from "@distilled.cloud/daytona/interpreter";
|
|
6
|
+
import * as lsp from "@distilled.cloud/daytona/lsp";
|
|
7
|
+
import * as port from "@distilled.cloud/daytona/port";
|
|
8
|
+
import * as process from "@distilled.cloud/daytona/process";
|
|
9
|
+
import * as sandboxes from "@distilled.cloud/daytona/sandbox";
|
|
10
|
+
import * as server from "@distilled.cloud/daytona/server";
|
|
11
|
+
import * as system from "@distilled.cloud/daytona/system";
|
|
12
|
+
import * as telemetry from "@distilled.cloud/daytona/telemetry";
|
|
13
|
+
import * as toolboxStreams from "@distilled.cloud/daytona/Toolbox";
|
|
14
|
+
import * as Sandbox from "alchemy/Sandbox";
|
|
15
|
+
import * as SecureRandom from "effect/crypto/SecureRandom";
|
|
16
|
+
import * as Effect from "effect/Effect";
|
|
17
|
+
import * as HttpClient from "effect/http/HttpClient";
|
|
18
|
+
import * as HttpClientRequest from "effect/http/HttpClientRequest";
|
|
19
|
+
import * as Redacted from "effect/Redacted";
|
|
20
|
+
import * as Schedule from "effect/Schedule";
|
|
21
|
+
import * as Socket from "effect/socket/Socket";
|
|
22
|
+
import * as Stream from "effect/Stream";
|
|
23
|
+
import { pick, scopeModule } from "./internal/Scoped.js";
|
|
24
|
+
import { inSandbox } from "./internal/Toolbox.js";
|
|
25
|
+
import { toSeconds } from "./internal/Wait.js";
|
|
26
|
+
/** Operations of the sandbox service that act on one sandbox. */
|
|
27
|
+
const SANDBOX_OPERATIONS = [
|
|
28
|
+
"getSandbox",
|
|
29
|
+
"deleteSandbox",
|
|
30
|
+
"startSandbox",
|
|
31
|
+
"stopSandbox",
|
|
32
|
+
"pauseSandbox",
|
|
33
|
+
"archiveSandbox",
|
|
34
|
+
"recoverSandbox",
|
|
35
|
+
"resizeSandbox",
|
|
36
|
+
"replaceLabels",
|
|
37
|
+
"setAutostopInterval",
|
|
38
|
+
"setAutoPauseInterval",
|
|
39
|
+
"setAutoArchiveInterval",
|
|
40
|
+
"setAutoDeleteInterval",
|
|
41
|
+
"setTtl",
|
|
42
|
+
"updateNetworkSettings",
|
|
43
|
+
"updatePublicStatus",
|
|
44
|
+
"updateSandboxSecrets",
|
|
45
|
+
"createSandboxSnapshot",
|
|
46
|
+
"forkSandbox",
|
|
47
|
+
"getSandboxForks",
|
|
48
|
+
"getSandboxParent",
|
|
49
|
+
"getSandboxAncestors",
|
|
50
|
+
"getRegionQuotaBySandboxId",
|
|
51
|
+
"getPortPreviewUrl",
|
|
52
|
+
"getSignedPortPreviewUrl",
|
|
53
|
+
"expireSignedPortPreviewUrl",
|
|
54
|
+
"getBuildLogsUrl",
|
|
55
|
+
"createSshAccess",
|
|
56
|
+
"revokeSshAccess",
|
|
57
|
+
"getSandboxSigningKey",
|
|
58
|
+
"rotateSigningKey",
|
|
59
|
+
"getSandboxLogs",
|
|
60
|
+
"getSandboxTraces",
|
|
61
|
+
"getSandboxTraceSpans",
|
|
62
|
+
"getSandboxMetrics",
|
|
63
|
+
];
|
|
64
|
+
/** POSIX single-quote one argument. */
|
|
65
|
+
const quote = (arg) => /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", `'\\''`)}'`;
|
|
66
|
+
/** A shell line for a command: a string as is, an argument vector quoted. */
|
|
67
|
+
const shellLine = (command) => typeof command === "string" ? command : command.map(quote).join(" ");
|
|
68
|
+
/** Run a shell line without quoting problems: pass it base64-encoded. */
|
|
69
|
+
const viaShell = (line) => Effect.sync(() => `sh -c "echo '${Buffer.from(line).toString("base64")}' | base64 -d | sh"`);
|
|
70
|
+
/** A fresh session ID, from WebCrypto (every runtime a handle runs on has it). */
|
|
71
|
+
const newSessionId = (prefix) => Effect.gen(function* () {
|
|
72
|
+
const random = yield* SecureRandom.SecureRandom;
|
|
73
|
+
return `${prefix}-${yield* random.uuidV4()}`;
|
|
74
|
+
}).pipe(Effect.provide(SecureRandom.layerWebCrypto));
|
|
75
|
+
/**
|
|
76
|
+
* Build the methods for one sandbox. `identity` resolves the sandbox (at
|
|
77
|
+
* runtime for a sandbox declared at deploy); `run` supplies the binding's
|
|
78
|
+
* credentials, and toolbox calls are additionally scoped to the sandbox.
|
|
79
|
+
*/
|
|
80
|
+
export const makeSandboxMethods = (identity, organizationId, run) => {
|
|
81
|
+
const fixed = Effect.all({ id: identity, organizationId }).pipe(Effect.map(({ id, organizationId }) => ({
|
|
82
|
+
sandboxIdOrName: id.id,
|
|
83
|
+
sandboxId: id.id,
|
|
84
|
+
organizationId,
|
|
85
|
+
})));
|
|
86
|
+
const toolbox = (effect) => Effect.flatMap(identity, (sandbox) => run(inSandbox(sandbox.id, sandbox.toolboxProxyUrl)(effect)));
|
|
87
|
+
// Sockets dial with the runtime's global WebSocket (Workers, Node 22+, Bun, Deno).
|
|
88
|
+
const socket = (effect) => toolbox(Effect.provide(effect, Socket.layerWebSocketConstructorGlobal));
|
|
89
|
+
const stream = (body) => Effect.context().pipe(Effect.map((context) => Stream.provideContext(body, context)), socket, Stream.unwrap);
|
|
90
|
+
const exec = Effect.fn(function* (command, options) {
|
|
91
|
+
const response = yield* toolbox(process.executeCommand({
|
|
92
|
+
command: yield* viaShell(shellLine(command)),
|
|
93
|
+
cwd: options?.cwd,
|
|
94
|
+
envs: options?.env,
|
|
95
|
+
timeout: toSeconds(options?.timeout),
|
|
96
|
+
}));
|
|
97
|
+
return { exitCode: response.exitCode ?? 0, result: response.result };
|
|
98
|
+
});
|
|
99
|
+
const start = Effect.fn(function* (command, options) {
|
|
100
|
+
const sessionId = yield* newSessionId("alchemy");
|
|
101
|
+
const env = Object.entries(options?.env ?? {})
|
|
102
|
+
.map(([key, value]) => `export ${key}=${quote(value)}`)
|
|
103
|
+
.join("; ");
|
|
104
|
+
const line = [env, options?.cwd ? `cd ${quote(options.cwd)}` : "", `exec ${shellLine(command)}`]
|
|
105
|
+
.filter(Boolean)
|
|
106
|
+
.join("; ");
|
|
107
|
+
yield* toolbox(process.createSession({ sessionId }));
|
|
108
|
+
// Quoted, not piped in: the command's stdin is the session's input.
|
|
109
|
+
const begun = yield* toolbox(process.sessionExecuteCommand({
|
|
110
|
+
sessionId,
|
|
111
|
+
command: `sh -c ${quote(line)}`,
|
|
112
|
+
runAsync: true,
|
|
113
|
+
suppressInputEcho: true,
|
|
114
|
+
}));
|
|
115
|
+
const commandId = begun.cmdId;
|
|
116
|
+
const encoder = new TextEncoder();
|
|
117
|
+
return {
|
|
118
|
+
id: sessionId,
|
|
119
|
+
sessionId,
|
|
120
|
+
commandId,
|
|
121
|
+
output: stream(toolboxStreams.followSessionCommandLogs({ sessionId, commandId })).pipe(Stream.map((piece) => ({ fd: piece.stream, data: encoder.encode(piece.text) }))),
|
|
122
|
+
write: (data) => toolbox(process.sendInput({
|
|
123
|
+
sessionId,
|
|
124
|
+
commandId,
|
|
125
|
+
data: typeof data === "string" ? data : new TextDecoder().decode(data),
|
|
126
|
+
})).pipe(
|
|
127
|
+
// The daemon creates the command's input pipe just after it starts.
|
|
128
|
+
Effect.retry({
|
|
129
|
+
while: (e) => e._tag === "SessionInputNotReady",
|
|
130
|
+
schedule: Schedule.spaced("250 millis"),
|
|
131
|
+
times: 20,
|
|
132
|
+
}), Effect.asVoid),
|
|
133
|
+
// Daytona takes no signal: deleting the session ends the command.
|
|
134
|
+
kill: () => toolbox(process.deleteSession({ sessionId })).pipe(Effect.asVoid),
|
|
135
|
+
wait: toolbox(process.getSessionCommand({ sessionId, commandId })).pipe(Effect.repeat({
|
|
136
|
+
schedule: Schedule.spaced("1 second"),
|
|
137
|
+
until: (c) => c.exitCode !== undefined,
|
|
138
|
+
}), Effect.map((c) => ({ exitCode: c.exitCode ?? 0 }))),
|
|
139
|
+
};
|
|
140
|
+
});
|
|
141
|
+
const files = {
|
|
142
|
+
read: (path) => toolbox(fileSystem.downloadFile({ path })),
|
|
143
|
+
readText: (path) => toolbox(fileSystem.downloadFile({ path })).pipe(Effect.map((bytes) => new TextDecoder().decode(bytes))),
|
|
144
|
+
write: (path, content) => toolbox(fileSystem.uploadFile({ path, body: content })).pipe(Effect.asVoid),
|
|
145
|
+
list: (path) => toolbox(fileSystem.listFiles({ path })),
|
|
146
|
+
stat: (path) => toolbox(fileSystem.getFileInfo({ path })),
|
|
147
|
+
remove: (path) => toolbox(fileSystem.deleteFile({ path, recursive: true })).pipe(Effect.asVoid),
|
|
148
|
+
makeDir: (path, options) => toolbox(fileSystem.createFolder({ path, mode: options?.mode ?? "755" })).pipe(Effect.asVoid),
|
|
149
|
+
};
|
|
150
|
+
/** The shared terminal shape over Daytona's connection. */
|
|
151
|
+
const terminal = (connection) => ({
|
|
152
|
+
id: connection.sessionId,
|
|
153
|
+
output: connection.output,
|
|
154
|
+
write: connection.write,
|
|
155
|
+
resize: ({ cols, rows }) => toolbox(connection.resize(cols, rows)),
|
|
156
|
+
kill: toolbox(connection.kill),
|
|
157
|
+
exit: connection.exit,
|
|
158
|
+
});
|
|
159
|
+
const pty = {
|
|
160
|
+
open: (options) => Effect.flatMap(options?.id ? Effect.succeed(options.id) : newSessionId("alchemy-pty"), (id) => socket(toolboxStreams.createPty({
|
|
161
|
+
id,
|
|
162
|
+
cols: options?.cols,
|
|
163
|
+
rows: options?.rows,
|
|
164
|
+
cwd: options?.cwd,
|
|
165
|
+
envs: options?.env,
|
|
166
|
+
})).pipe(Effect.map(terminal))),
|
|
167
|
+
connect: (sessionId) => socket(toolboxStreams.connectPty({ sessionId })).pipe(Effect.map(terminal)),
|
|
168
|
+
};
|
|
169
|
+
const getTcpPort = (port) => Effect.flatMap(fixed, ({ sandboxIdOrName }) => run(Effect.gen(function* () {
|
|
170
|
+
const preview = yield* sandboxes.getPortPreviewUrl({ sandboxIdOrName, port });
|
|
171
|
+
const client = yield* HttpClient.HttpClient;
|
|
172
|
+
const base = preview.url.replace(/\/$/, "");
|
|
173
|
+
return {
|
|
174
|
+
port,
|
|
175
|
+
url: preview.url,
|
|
176
|
+
token: Redacted.make(preview.token),
|
|
177
|
+
fetch: Sandbox.portFetch((request) => Effect.suspend(() => {
|
|
178
|
+
// Only the path and query reach the port: a proxied server
|
|
179
|
+
// request carries its own absolute URL.
|
|
180
|
+
const target = new URL(request.url, "http://port");
|
|
181
|
+
return client.execute(request.pipe(HttpClientRequest.setUrl(`${base}${target.pathname}${target.search}`), HttpClientRequest.setHeader("X-Daytona-Preview-Token", preview.token)));
|
|
182
|
+
})),
|
|
183
|
+
};
|
|
184
|
+
})));
|
|
185
|
+
return {
|
|
186
|
+
...scopeModule(pick(sandboxes, SANDBOX_OPERATIONS), fixed, run),
|
|
187
|
+
process: {
|
|
188
|
+
...scopeModule(process, {}, toolbox),
|
|
189
|
+
createPty: (request) => socket(toolboxStreams.createPty(request)),
|
|
190
|
+
connectPty: (request) => socket(toolboxStreams.connectPty(request)),
|
|
191
|
+
followSessionCommandLogs: (request) => stream(toolboxStreams.followSessionCommandLogs(request)),
|
|
192
|
+
followEntrypointLogs: () => stream(toolboxStreams.followEntrypointLogs()),
|
|
193
|
+
},
|
|
194
|
+
fs: {
|
|
195
|
+
...scopeModule(fileSystem, {}, toolbox),
|
|
196
|
+
uploadFiles: (request) => toolbox(toolboxStreams.uploadFiles(request)),
|
|
197
|
+
downloadFiles: (request) => toolbox(toolboxStreams.downloadFiles(request)),
|
|
198
|
+
},
|
|
199
|
+
git: scopeModule(git, {}, toolbox),
|
|
200
|
+
lsp: scopeModule(lsp, {}, toolbox),
|
|
201
|
+
interpreter: {
|
|
202
|
+
...scopeModule(interpreter, {}, toolbox),
|
|
203
|
+
executeInterpreterCode: (request) => socket(toolboxStreams.executeInterpreterCode(request)),
|
|
204
|
+
streamInterpreterCode: (request) => stream(toolboxStreams.streamInterpreterCode(request)),
|
|
205
|
+
},
|
|
206
|
+
computerUse: scopeModule(computerUse, {}, toolbox),
|
|
207
|
+
ports: scopeModule(port, {}, toolbox),
|
|
208
|
+
info: scopeModule(info, {}, toolbox),
|
|
209
|
+
system: scopeModule(system, {}, toolbox),
|
|
210
|
+
server: scopeModule(server, {}, toolbox),
|
|
211
|
+
telemetry: scopeModule(telemetry, fixed, run),
|
|
212
|
+
exec,
|
|
213
|
+
start,
|
|
214
|
+
files,
|
|
215
|
+
pty,
|
|
216
|
+
getTcpPort,
|
|
217
|
+
};
|
|
218
|
+
};
|
|
219
|
+
/** The handle for a sandbox whose identity is known (one just created or listed). */
|
|
220
|
+
export const makeSandboxClient = (sandbox, organizationId, run) => ({
|
|
221
|
+
...makeSandboxMethods(Effect.succeed(sandbox), organizationId, run),
|
|
222
|
+
sandboxId: sandbox.id,
|
|
223
|
+
name: sandbox.name,
|
|
224
|
+
toolboxProxyUrl: sandbox.toolboxProxyUrl,
|
|
225
|
+
});
|
|
226
|
+
/** The handle for a sandbox declared at deploy, whose identity resolves at runtime. */
|
|
227
|
+
export const makeConnectedSandbox = (identity, organizationId, run) => ({
|
|
228
|
+
...makeSandboxMethods(identity, organizationId, run),
|
|
229
|
+
sandboxId: Effect.map(identity, (s) => s.id),
|
|
230
|
+
name: Effect.map(identity, (s) => s.name),
|
|
231
|
+
toolboxProxyUrl: Effect.map(identity, (s) => s.toolboxProxyUrl),
|
|
232
|
+
});
|
|
233
|
+
//# sourceMappingURL=SandboxClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SandboxClient.js","sources":["../src/SandboxClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,uCAAuC,CAAC;AAErE,OAAO,KAAK,UAAU,MAAM,sCAAsC,CAAC;AACnE,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,WAAW,MAAM,sCAAsC,CAAC;AACpE,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,+BAA+B,CAAC;AACtD,OAAO,KAAK,OAAO,MAAM,kCAAkC,CAAC;AAE5D,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAC1D,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAC1D,OAAO,KAAK,SAAS,MAAM,oCAAoC,CAAC;AAChE,OAAO,KAAK,cAAc,MAAM,kCAAkC,CAAC;AAEnE,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAC3C,OAAO,KAAK,YAAY,MAAM,4BAA4B,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,UAAU,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,IAAI,EAAE,WAAW,EAAqB,MAAM,sBAA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,GAAG;QACH,UAAU;KACX,CAAC;AACJ,CAAC,CAAC;AAEF,qFAAqF;AACrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,OAAwB,EACxB,cAA4D,EAC5D,GAAW,EACK,EAAE,CAAC,CAAC;IACpB,GAAG,kBAAkB,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,cAAc,EAAE,GAAG,CAAC;IACnE,SAAS,EAAE,OAAO,CAAC,EAAE;IACrB,IAAI,EAAE,OAAO,CAAC,IAAI;IAClB,eAAe,EAAE,OAAO,CAAC,eAAe;CACzC,CAAC,CAAC;AAEH,uFAAuF;AACvF,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,QAA+D,EAC/D,cAA4D,EAC5D,GAAW,EACO,EAAE,CAAC,CAAC;IACtB,GAAG,kBAAkB,CAAC,QAAQ,EAAE,cAAc,EAAE,GAAG,CAAC;IACpD,SAAS,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;IACzC,eAAe,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC;CAChE,CAAC,CAAC"}
|
package/lib/Secret.d.ts
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import * as secrets from "@distilled.cloud/daytona/secret";
|
|
2
|
+
import * as Provider from "alchemy/Provider";
|
|
3
|
+
import { Resource } from "alchemy/Resource";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import * as Redacted from "effect/Redacted";
|
|
6
|
+
import type { Providers } from "./Providers.ts";
|
|
7
|
+
export interface SecretProps {
|
|
8
|
+
/**
|
|
9
|
+
* Secret name, unique in the organization (letters, digits, `-`, `_`).
|
|
10
|
+
* If omitted, a unique name is generated from the stack, stage and
|
|
11
|
+
* logical ID. Changing it replaces the secret.
|
|
12
|
+
*/
|
|
13
|
+
name?: string;
|
|
14
|
+
/** The secret value. Changing it updates the secret in place. */
|
|
15
|
+
value: string | Redacted.Redacted<string>;
|
|
16
|
+
/** What the secret is for. */
|
|
17
|
+
description?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The only hosts Daytona will send the real value to. A sandbox sees a
|
|
20
|
+
* placeholder in its environment; Daytona's egress proxy swaps in the
|
|
21
|
+
* value on requests to these hosts. Omit to allow any host.
|
|
22
|
+
*/
|
|
23
|
+
hosts?: string[];
|
|
24
|
+
}
|
|
25
|
+
export interface SecretAttributes {
|
|
26
|
+
/** Secret ID. */
|
|
27
|
+
secretId: string;
|
|
28
|
+
/** Secret name. */
|
|
29
|
+
name: string;
|
|
30
|
+
/**
|
|
31
|
+
* The placeholder a sandbox sees instead of the value. Put it in a
|
|
32
|
+
* sandbox's env (`env: { NPM_TOKEN: secret.placeholder }`) or pass the
|
|
33
|
+
* secret in `secrets`.
|
|
34
|
+
*/
|
|
35
|
+
placeholder: string;
|
|
36
|
+
/** Hosts the value may be sent to. */
|
|
37
|
+
hosts: string[];
|
|
38
|
+
/** Description, if any. */
|
|
39
|
+
description: string | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* SHA-256 of the value last written. Daytona never returns a secret's
|
|
42
|
+
* value, so this is how reconcile knows whether to write it again.
|
|
43
|
+
*/
|
|
44
|
+
valueHash: string;
|
|
45
|
+
}
|
|
46
|
+
export type Secret = Resource<"Daytona.Secret", SecretProps, SecretAttributes, never, Providers>;
|
|
47
|
+
/**
|
|
48
|
+
* A secret stored in Daytona. A sandbox gets a placeholder in place of
|
|
49
|
+
* the value, and Daytona's egress proxy substitutes the real value only on
|
|
50
|
+
* requests to the secret's `hosts`, so code in the sandbox (or an agent
|
|
51
|
+
* running there) can use a credential without being able to read it.
|
|
52
|
+
*
|
|
53
|
+
* Declare a secret here for credentials the whole app shares. For a secret
|
|
54
|
+
* per user, create it at runtime with {@link CreateSecret}.
|
|
55
|
+
* @see https://www.daytona.io/docs/en/secrets/
|
|
56
|
+
*
|
|
57
|
+
* ### Creating a Secret
|
|
58
|
+
* **Example:** An npm token only sent to the registry
|
|
59
|
+
* ```typescript
|
|
60
|
+
* export const NpmToken = Daytona.Secret("NpmToken", {
|
|
61
|
+
* value: Config.Redacted("NPM_TOKEN"),
|
|
62
|
+
* hosts: ["registry.npmjs.org"],
|
|
63
|
+
* });
|
|
64
|
+
* ```
|
|
65
|
+
*
|
|
66
|
+
* ### Using a Secret in a Sandbox
|
|
67
|
+
* **Example:** Expose it to a sandbox as an environment variable
|
|
68
|
+
* ```typescript
|
|
69
|
+
* export const DevBox = Daytona.Sandbox("DevBox", {
|
|
70
|
+
* snapshot: Base,
|
|
71
|
+
* secrets: { NPM_TOKEN: NpmToken },
|
|
72
|
+
* });
|
|
73
|
+
* ```
|
|
74
|
+
*
|
|
75
|
+
* @resource
|
|
76
|
+
* @product Secret
|
|
77
|
+
*/
|
|
78
|
+
export declare const Secret: import("alchemy/Resource").ResourceClass<Secret>;
|
|
79
|
+
export declare const hashSecretValue: (value: string | Redacted.Redacted<string>) => Effect.Effect<string, never, never>;
|
|
80
|
+
export declare const toSecretAttributes: (s: secrets.Secret2, valueHash: string) => SecretAttributes;
|
|
81
|
+
export declare const getSecretById: (secretId: string) => Effect.Effect<secrets.Secret2 | undefined, secrets.DaytonaOpError, secrets.DaytonaOpContext>;
|
|
82
|
+
/** Exact-name lookup over the paginated list (its `name` filter is a substring match). */
|
|
83
|
+
export declare const findSecretByName: (name: string) => Effect.Effect<secrets.Secret2 | undefined, secrets.DaytonaOpError, secrets.DaytonaOpContext>;
|
|
84
|
+
export declare const ensureSecret: (input: {
|
|
85
|
+
readonly name: string;
|
|
86
|
+
readonly value: string | Redacted.Redacted<string>;
|
|
87
|
+
readonly description?: string | undefined;
|
|
88
|
+
readonly hosts?: string[] | undefined;
|
|
89
|
+
readonly existing?: secrets.Secret2 | undefined;
|
|
90
|
+
readonly knownHash?: string | undefined;
|
|
91
|
+
}) => Effect.Effect<SecretAttributes, import("@distilled.cloud/core/errors").BadGateway | import("@distilled.cloud/core/errors").BadRequest | import("@distilled.cloud/core/config").ConfigError | import("@distilled.cloud/core/errors").Conflict | import("@distilled.cloud/daytona/Errors").DaytonaParseError | import("@distilled.cloud/core/errors").Forbidden | import("@distilled.cloud/core/errors").GatewayTimeout | import("effect/http/HttpClientError").HttpClientError | import("@distilled.cloud/core/errors").InternalServerError | import("@distilled.cloud/core/protocol-http").InvalidInput | import("@distilled.cloud/core/errors").Locked | import("@distilled.cloud/core/errors").NotFound | import("@distilled.cloud/core/sdk-error").SdkError | secrets.SecretNotFound | import("@distilled.cloud/core/errors").ServiceUnavailable | import("@distilled.cloud/core/errors").TooManyRequests | import("@distilled.cloud/core/errors").Unauthorized | import("@distilled.cloud/daytona/Errors").UnknownDaytonaError | import("@distilled.cloud/core/errors").UnprocessableEntity, secrets.DaytonaOpContext>;
|
|
92
|
+
export declare const SecretProvider: () => import("effect/Layer").Layer<Provider.Provider<Secret>, never, import("alchemy/Stack").Stack | import("alchemy/Stage").Stage | secrets.DaytonaOpContext>;
|
|
93
|
+
//# sourceMappingURL=Secret.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Secret.d.ts","sources":["../src/Secret.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,OAAO,MAAM,iCAAiC,CAAC;AAG3D,OAAO,KAAK,QAAQ,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AAG5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD,MAAM,WAAW,WAAW;IA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