@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,29 @@
|
|
|
1
|
+
import type { PropsInput } from "alchemy/Input";
|
|
2
|
+
import * as Output from "alchemy/Output";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
import type { Providers } from "../Providers.ts";
|
|
6
|
+
type Leaf = string | number | boolean | bigint | symbol | null | undefined | Redacted.Redacted<any> | Uint8Array | Date | ((...args: any[]) => any);
|
|
7
|
+
/**
|
|
8
|
+
* A prop value, or the declaration of a resource that has it: `template: Node`
|
|
9
|
+
* instead of `template: yield* Node`, at any depth.
|
|
10
|
+
*/
|
|
11
|
+
export type Declared<T> = T extends Leaf ? T : T extends Output.Output<any> ? T : T extends ReadonlyArray<infer U> ? Declared<U>[] | Effect.Effect<T, never, Providers> : {
|
|
12
|
+
[K in keyof T]: Declared<T[K]>;
|
|
13
|
+
} | Effect.Effect<T, never, Providers>;
|
|
14
|
+
/** Props where any value may be a resource declaration. */
|
|
15
|
+
export type DeclaredProps<P> = {
|
|
16
|
+
[K in keyof PropsInput<P>]: Declared<PropsInput<P>[K]>;
|
|
17
|
+
};
|
|
18
|
+
/** Yield every declaration in `value`, at any depth. */
|
|
19
|
+
export declare const resolveDeclarations: (value: unknown) => Effect.Effect<unknown, never, Providers>;
|
|
20
|
+
/**
|
|
21
|
+
* Let a resource's props hold declarations of other resources, which are
|
|
22
|
+
* yielded when the resource is: `Boat.Sandbox("Box", { snapshot: Golden })`.
|
|
23
|
+
* Props without declarations are passed through unchanged.
|
|
24
|
+
*/
|
|
25
|
+
export declare const declarable: <R extends {
|
|
26
|
+
readonly Props: any;
|
|
27
|
+
}>() => <C extends object>(resource: C) => C & ((id: string, props: DeclaredProps<R["Props"]>) => Effect.Effect<R, never, Providers>);
|
|
28
|
+
export {};
|
|
29
|
+
//# sourceMappingURL=Declared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declared.d.ts","sources":["../../src/internal/Decl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AM,CAAC,OAAO,EAAE,KAAK,EAAE,SAAS,CAY7D,CAAC;AAEhC;;;;GAIG;AACH,eAAO,MAAM,UAAU,GACpB,CAAC,SAAS;IAAE,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAA;CAAE,QACjC,CAAC,SAAS,MAAM,YACL,CAAC,KACV,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,KAAK,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,CAM/E,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as Output from "alchemy/Output";
|
|
2
|
+
import { isResource } from "alchemy/Resource";
|
|
3
|
+
import * as Effect from "effect/Effect";
|
|
4
|
+
import * as Redacted from "effect/Redacted";
|
|
5
|
+
const isPlain = (value) => typeof value === "object" &&
|
|
6
|
+
value !== null &&
|
|
7
|
+
(Object.getPrototypeOf(value) === Object.prototype || Object.getPrototypeOf(value) === null);
|
|
8
|
+
/** A declaration still to be yielded: an Effect that isn't an Output or a resource. */
|
|
9
|
+
const isDeclaration = (value) => Effect.isEffect(value) && !Output.isOutput(value) && !isResource(value);
|
|
10
|
+
const hasDeclarations = (value) => isDeclaration(value) ||
|
|
11
|
+
(Array.isArray(value) && value.some(hasDeclarations)) ||
|
|
12
|
+
(isPlain(value) && !isResource(value) && Object.values(value).some(hasDeclarations));
|
|
13
|
+
/** Yield every declaration in `value`, at any depth. */
|
|
14
|
+
export const resolveDeclarations = (value) => isDeclaration(value)
|
|
15
|
+
? value
|
|
16
|
+
: Array.isArray(value)
|
|
17
|
+
? Effect.forEach(value, resolveDeclarations)
|
|
18
|
+
: isPlain(value) && !isResource(value) && hasDeclarations(value)
|
|
19
|
+
? Effect.map(Effect.forEach(Object.entries(value), ([key, entry]) => Effect.map(resolveDeclarations(entry), (resolved) => [key, resolved])), Object.fromEntries)
|
|
20
|
+
: Effect.succeed(value);
|
|
21
|
+
/**
|
|
22
|
+
* Let a resource's props hold declarations of other resources, which are
|
|
23
|
+
* yielded when the resource is: `Boat.Sandbox("Box", { snapshot: Golden })`.
|
|
24
|
+
* Props without declarations are passed through unchanged.
|
|
25
|
+
*/
|
|
26
|
+
export const declarable = () => (resource) => new Proxy(resource, {
|
|
27
|
+
apply: (target, self, args) => typeof args[0] === "string" && hasDeclarations(args[1])
|
|
28
|
+
? Reflect.apply(target, self, [args[0], resolveDeclarations(args[1])])
|
|
29
|
+
: Reflect.apply(target, self, args),
|
|
30
|
+
});
|
|
31
|
+
//# sourceMappingURL=Declared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Declared.js","sources":["../../src/internal/Declared.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAC;AA+B5C,MAAM,OAAO,GAAG,CAAC,KAAc,EAAoC,EAAE,CACnE,OAAO,KAAK,KAAK,QAAQ;IACzB,KAAK,KAAK,IAAI;IACd,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,MAAM,CAAC,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAAC;AAE/F,uFAAuF;AACvF,MAAM,aAAa,GAAG,CAAC,KAAc,EAAqD,EAAE,CAC1F,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;AAE1E,MAAM,eAAe,GAAG,CAAC,KAAc,EAAW,EAAE,CAClD,aAAa,CAAC,KAAK,CAAC;IACpB,CAAC,KAAK,CAAC,OAAO,CAA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C,IAAI,CAAC,CAAC,CAAC,CAAC;QACrD,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC;CACxC,CAAU,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as BuildPlan from "@alchemy.run/docker/BuildPlan";
|
|
2
|
+
import * as DockerfileParser from "@alchemy.run/docker/DockerfileParser";
|
|
3
|
+
import * as config from "@distilled.cloud/daytona/config";
|
|
4
|
+
import * as snapshots from "@distilled.cloud/daytona/snapshots";
|
|
5
|
+
import { type MountCapability } from "alchemy/Mount";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
/**
|
|
8
|
+
* INTERNAL — the snapshot a sandbox boots from when its bindings bind
|
|
9
|
+
* `alchemy/Mount` capabilities: `FROM` the base snapshot's image plus the
|
|
10
|
+
* capabilities' install lines, built on Daytona. It is named from the
|
|
11
|
+
* sandbox and a hash of its Dockerfile, belongs to the sandbox, and is
|
|
12
|
+
* deleted with it.
|
|
13
|
+
*/
|
|
14
|
+
/** What Daytona sandboxes provide to mount clients (checked live 2026-11-04). */
|
|
15
|
+
export declare const MOUNT_SUPPORT: {
|
|
16
|
+
readonly fuse: true;
|
|
17
|
+
readonly nfs: false;
|
|
18
|
+
};
|
|
19
|
+
/** A binding entry that is a mount capability (not a volume to mount). */
|
|
20
|
+
export declare const isMountCapability: (entry: unknown) => entry is MountCapability;
|
|
21
|
+
/** The capabilities bound onto a sandbox, de-duplicated in a stable order. */
|
|
22
|
+
export declare const capabilitiesOf: (bindings: ReadonlyArray<{
|
|
23
|
+
readonly data?: {
|
|
24
|
+
readonly mounts?: ReadonlyArray<unknown>;
|
|
25
|
+
};
|
|
26
|
+
}>) => readonly MountCapability[];
|
|
27
|
+
/** The capabilities' install lines; run as root, as `alchemy/Mount` specifies. */
|
|
28
|
+
export declare const installLinesOf: (caps: ReadonlyArray<MountCapability>) => string[];
|
|
29
|
+
/** Fail the plan when a capability needs what a sandbox can't provide. */
|
|
30
|
+
export declare const checkSupport: (caps: ReadonlyArray<MountCapability>) => Effect.Effect<void, never, never> | Effect.Effect<never, import("alchemy/Mount").MountUnsupported, never>;
|
|
31
|
+
/**
|
|
32
|
+
* Build (or reuse) the derived snapshot for a sandbox and return its name.
|
|
33
|
+
*/
|
|
34
|
+
export declare const ensureDerivedSnapshot: (input: {
|
|
35
|
+
readonly sandboxName: string;
|
|
36
|
+
readonly snapshot: string | undefined;
|
|
37
|
+
readonly caps: ReadonlyArray<MountCapability>;
|
|
38
|
+
readonly note: (message: string) => Effect.Effect<void>;
|
|
39
|
+
}) => Effect.Effect<string, import("@alchemy.run/docker/BuildHash").BuildHashInvalidProps | BuildPlan.BuildPlanError | import("alchemy/Bundle/Bundle").BundleError | DockerfileParser.DockerfileSyntaxError | import("@distilled.cloud/daytona/sandbox").GpuCreditsRequired | import("@distilled.cloud/daytona/sandbox").GpuSandboxNotEphemeral | import("@distilled.cloud/daytona/sandbox").NetworkAccessRestricted | import("effect/PlatformError").PlatformError | import("@distilled.cloud/daytona/sandbox").QueueTimeoutNotEnabled | import("@distilled.cloud/daytona/sandbox").SandboxAlreadyExists | import("@distilled.cloud/daytona/sandbox").SandboxNotFound | import("@distilled.cloud/daytona/sandbox").SandboxResourcesFromSnapshot | import("../Snapshot.ts").SnapshotImageTagInvalid | snapshots.SnapshotNotFound | import("../Snapshot.ts").SnapshotRunFailed | import("./Wait.ts").StateFailed | import("./Wait.ts").StateTimeout | BuildPlan.UnsupportedDockerfile | import("@distilled.cloud/daytona/sandbox").WindowsSandboxesUnavailable | config.DaytonaOpError, import("effect/FileSystem").FileSystem | import("effect/Path").Path | config.DaytonaOpContext>;
|
|
40
|
+
//# sourceMappingURL=Derived.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Derived.d.ts","sources":["../../src/internal/Derived.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,gBAAgB,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,MAAM,MAAM,iCAAiC,CAAC;AAC1D,OAAO,KAAK,SAAS,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AASxC;;;;;;GAMG;AAEH,iFAAiF;AACjF,eAAO,MAAM,aAAa;aAExB,IAAI;aAEJ,GAAG;CACK,CAAC;AAEX,0EAA0E;AAC1E,eAAO,MAAM,iBAAiB,UAAW,OAAO,KAAG,KAAK,IAAI,eACwB,CAAC;AAErF,8EAA8E;AAC9E,eAAO,MAAM,cAAc,aACf,aAAa,CAAC;IAAE,QAAQ,CAAC,IAAI,CAAC,EAAE;QAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,CAAC,OAAO,CAAC,CAAA;KAAE,CAAA;CAAE,CAAC,+BAMxF,CAAC;AAEJ,kFAAkF;AAClF,eAAO,MAAM,cAAc,SAAU,aAAa,CAAC,eAAe,CAAC,aACC,CAAC;AAErE,0EAA0E;AAC1E,eAAO,MAAM,YAAY,SAAU,aAAa,CAAC,eAAe,CAAC,8GAGhE,CAAC;AAQF;;GAEG;AACH,eAAO,MAAM,qBAAqB;0BACV,MAAM;uBACT,MAAM,GAAG,SAAS;mBACtB,aAAa,CAAC,eAAe,CAAC;mBAC9B,CAAC,OAAO,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC;qnCAwBvD,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import * as BuildPlan from "@alchemy.run/docker/BuildPlan";
|
|
2
|
+
import * as DockerfileParser from "@alchemy.run/docker/DockerfileParser";
|
|
3
|
+
import * as config from "@distilled.cloud/daytona/config";
|
|
4
|
+
import * as snapshots from "@distilled.cloud/daytona/snapshots";
|
|
5
|
+
import { checkMountSupport, collectMountCapabilities, mountInstallLines, } from "alchemy/Mount";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
import { buildSnapshot, capabilities, deleteSnapshot, getSnapshot, waitForSnapshot, } from "../Snapshot.js";
|
|
8
|
+
/**
|
|
9
|
+
* INTERNAL — the snapshot a sandbox boots from when its bindings bind
|
|
10
|
+
* `alchemy/Mount` capabilities: `FROM` the base snapshot's image plus the
|
|
11
|
+
* capabilities' install lines, built on Daytona. It is named from the
|
|
12
|
+
* sandbox and a hash of its Dockerfile, belongs to the sandbox, and is
|
|
13
|
+
* deleted with it.
|
|
14
|
+
*/
|
|
15
|
+
/** What Daytona sandboxes provide to mount clients (checked live 2026-11-04). */
|
|
16
|
+
export const MOUNT_SUPPORT = {
|
|
17
|
+
// `/dev/fuse` exists and the sandbox has CAP_SYS_ADMIN.
|
|
18
|
+
fuse: true,
|
|
19
|
+
// No NFS client is installed, and `mount -t nfs` was never verified.
|
|
20
|
+
nfs: false,
|
|
21
|
+
};
|
|
22
|
+
/** A binding entry that is a mount capability (not a volume to mount). */
|
|
23
|
+
export const isMountCapability = (entry) => typeof entry === "object" && entry !== null && "install" in entry && "id" in entry;
|
|
24
|
+
/** The capabilities bound onto a sandbox, de-duplicated in a stable order. */
|
|
25
|
+
export const capabilitiesOf = (bindings) => collectMountCapabilities(bindings.map((binding) => ({
|
|
26
|
+
data: { mounts: (binding.data?.mounts ?? []).filter(isMountCapability) },
|
|
27
|
+
})));
|
|
28
|
+
/** The capabilities' install lines; run as root, as `alchemy/Mount` specifies. */
|
|
29
|
+
export const installLinesOf = (caps) => caps.length === 0 ? [] : ["USER root", ...mountInstallLines(caps)];
|
|
30
|
+
/** Fail the plan when a capability needs what a sandbox can't provide. */
|
|
31
|
+
export const checkSupport = (caps) => {
|
|
32
|
+
const unsupported = checkMountSupport("Daytona.Sandbox", caps, MOUNT_SUPPORT);
|
|
33
|
+
return unsupported ? Effect.fail(unsupported) : Effect.void;
|
|
34
|
+
};
|
|
35
|
+
/** The image a snapshot (or, without one, Daytona's default) was made from. */
|
|
36
|
+
const baseImageOf = Effect.fn(function* (snapshot) {
|
|
37
|
+
const name = snapshot ?? (yield* config.getConfigControllerConfig({})).defaultSnapshot;
|
|
38
|
+
return (yield* snapshots.getSnapshot({ id: name })).imageName;
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Build (or reuse) the derived snapshot for a sandbox and return its name.
|
|
42
|
+
*/
|
|
43
|
+
export const ensureDerivedSnapshot = Effect.fn(function* (input) {
|
|
44
|
+
const baseImage = yield* baseImageOf(input.snapshot);
|
|
45
|
+
const plan = yield* BuildPlan.plan({ dockerfile: { content: `FROM ${baseImage}\n` } }, { capabilities, install: installLinesOf(input.caps) });
|
|
46
|
+
const name = `${input.sandboxName.slice(0, 40)}-${plan.hash.slice(0, 12)}`.toLowerCase();
|
|
47
|
+
let existing = yield* getSnapshot(name);
|
|
48
|
+
// A failed build is rebuilt; the name is free once the old one is gone.
|
|
49
|
+
if (existing !== undefined && ["error", "build_failed", "removing"].includes(existing.state)) {
|
|
50
|
+
yield* deleteSnapshot(existing.id);
|
|
51
|
+
existing = undefined;
|
|
52
|
+
}
|
|
53
|
+
if (existing === undefined) {
|
|
54
|
+
yield* buildSnapshot({
|
|
55
|
+
name,
|
|
56
|
+
source: { dockerfile: DockerfileParser.render(plan.dockerfile), run: [] },
|
|
57
|
+
labels: {},
|
|
58
|
+
note: input.note,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
yield* waitForSnapshot(name);
|
|
62
|
+
return name;
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=Derived.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Derived.js","sources":["../../src/internal/Derived.ts"],"names":[],"mappings":"A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,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC;IACzF,IAAI,QAAQ,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IACxC,wEAAwE;IACxE,IAAI,QAAQ,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7F,KAAK,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QACnC,QAAQ,GAAG,SAAS,CAAC;IACvB,CAAC;IACD,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,KAAK,CAAC,CAAC,aAAa,CAAC;YACnB,IAAI;YACJ,MAAM,EAAE,EAAE,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;YACzE,MAAM,EAAE,EAAE;YACV,IAAI,EAAE,KAAK,CAAC,IAAI;SACjB,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC7B,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.d.ts","sources":["../../src/internal/Errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,OAAO,MAAM,kCAAkC,CAAC;AAEjE,kDAAkD;AAClD,MAAM,MAAM,YAAY,GAAG,OAAO,CAAC,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=Errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Errors.js","sources":["../../src/internal/Errors.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
/**
|
|
3
|
+
* Daytona sandbox labels carry alchemy's ownership tags. Tag keys
|
|
4
|
+
* (`alchemy::stack`) are written as `alchemy.stack` to stay within the
|
|
5
|
+
* conservative key alphabet every label API accepts.
|
|
6
|
+
*/
|
|
7
|
+
export declare const ALCHEMY_LABEL_PREFIX = "alchemy.";
|
|
8
|
+
export declare const toLabelKey: (key: string) => string;
|
|
9
|
+
export declare const toLabels: (tags: Record<string, string> | undefined) => Record<string, string>;
|
|
10
|
+
export declare const createInternalLabels: (id: string) => Effect.Effect<Record<string, string>, never, import("alchemy/Stack").Stack | import("alchemy/Stage").Stage>;
|
|
11
|
+
/** A label map as Daytona returns it (values typed optional). */
|
|
12
|
+
export type LabelMap = {
|
|
13
|
+
readonly [key: string]: string | undefined;
|
|
14
|
+
};
|
|
15
|
+
/** Drop undefined values from a label map. */
|
|
16
|
+
export declare const definedLabels: (labels: LabelMap | undefined) => Record<string, string>;
|
|
17
|
+
export declare const hasAlchemyLabels: (id: string, labels: LabelMap | undefined) => Effect.Effect<boolean, never, import("alchemy/Stack").Stack | import("alchemy/Stage").Stage>;
|
|
18
|
+
/** Labels without alchemy's ownership keys: what the user declared. */
|
|
19
|
+
export declare const userLabels: (labels: LabelMap | undefined) => Record<string, string>;
|
|
20
|
+
//# sourceMappingURL=Labels.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Labels.d.ts","sources":["../../src/internal/Labels.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,aAAa,CAAC;AAG/C,eAAO,MAAM,UAAU,QAAS,MAAM,WACuD,CAAC;AAE9F,eAAO,MAAM,QAAQ,SAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CACL,CAAC;AAErF,eAAO,MAAM,oBAAoB,6HAE/B,CAAC;AAEH,iEAAiE;AACjE,MAAM,MAAM,QAAQ,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAEtE,8CAA8C;AAC9C,eAAO,MAAM,aAAa,WAAY,QAAQ,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAG/E,CAAC;AAEJ,eAAO,MAAM,gBAAgB,4IAE3B,CAAC;AAEH,uEAAuE;AACvE,eAAO,MAAM,UAAU,WAAY,QAAQ,GAAG,SAAS,KAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAG5E,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { createInternalTags, hasTags } from "alchemy/Tags";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
/**
|
|
4
|
+
* Daytona sandbox labels carry alchemy's ownership tags. Tag keys
|
|
5
|
+
* (`alchemy::stack`) are written as `alchemy.stack` to stay within the
|
|
6
|
+
* conservative key alphabet every label API accepts.
|
|
7
|
+
*/
|
|
8
|
+
export const ALCHEMY_LABEL_PREFIX = "alchemy.";
|
|
9
|
+
const TAG_PREFIX = "alchemy::";
|
|
10
|
+
export const toLabelKey = (key) => key.startsWith(TAG_PREFIX) ? `${ALCHEMY_LABEL_PREFIX}${key.slice(TAG_PREFIX.length)}` : key;
|
|
11
|
+
export const toLabels = (tags) => Object.fromEntries(Object.entries(tags ?? {}).map(([k, v]) => [toLabelKey(k), v]));
|
|
12
|
+
export const createInternalLabels = Effect.fn(function* (id) {
|
|
13
|
+
return toLabels(yield* createInternalTags(id));
|
|
14
|
+
});
|
|
15
|
+
/** Drop undefined values from a label map. */
|
|
16
|
+
export const definedLabels = (labels) => Object.fromEntries(Object.entries(labels ?? {}).filter((e) => e[1] !== undefined));
|
|
17
|
+
export const hasAlchemyLabels = Effect.fn(function* (id, labels) {
|
|
18
|
+
return hasTags(yield* createInternalLabels(id), definedLabels(labels));
|
|
19
|
+
});
|
|
20
|
+
/** Labels without alchemy's ownership keys: what the user declared. */
|
|
21
|
+
export const userLabels = (labels) => Object.fromEntries(Object.entries(definedLabels(labels)).filter(([k]) => !k.startsWith(ALCHEMY_LABEL_PREFIX)));
|
|
22
|
+
//# sourceMappingURL=Labels.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Labels.js","sources":["../../src/internal/Labels.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;GAIG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,UAAU,CAAC;AAC/C,MAAM,UAAU,GAAG,WAAW,CAAC;AAE/B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAE,EAAE,CACxC,GAAG,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,GAAG,oBAAoB,GAAG,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC;AAE9F,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,IAAwC,EAA0B,EAAE,CAC3F,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAErF,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAU;IACjE,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC;AACjD,CAAC,CAAC,CAAC;AAKH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAA4B,EAA0B,EAAE,CACpF,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAyB,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,CACtF,CAAC;AAEJ,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,EAAU,EAAE,MAA4B;IAC3F,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,oBAAoB,CAAC,EAAE,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACzE,CAAC,CAAC,CAAC;AAEH,uEAAuE;AACvE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAA4B,EAA0B,EAAE,CACjF,MAAM,CAAC,WAAW,CAChB,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,oBAAoB,CAAC,CAAC,CAC3F,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
/**
|
|
3
|
+
* The name alchemy generates for a Daytona object when the user gives none:
|
|
4
|
+
* `<stack>-<id>-<stage>-<suffix>`, lowercase. Daytona volumes, secrets,
|
|
5
|
+
* snapshots and registries have no labels, so this name is also their
|
|
6
|
+
* ownership marker: only alchemy produces the random suffix, so an object
|
|
7
|
+
* with exactly this name was created by this logical id.
|
|
8
|
+
*/
|
|
9
|
+
export declare const physicalName: (id: string, maxLength?: number) => Effect.Effect<string, never, import("alchemy/ResourceContext").ResourceContext | import("alchemy/Stack").Stack | import("alchemy/Stage").Stage>;
|
|
10
|
+
/** The user's name, the name already in state, or the generated name. */
|
|
11
|
+
export declare const resolveName: (id: string, name: string | undefined, existing?: string | undefined, maxLength?: number | undefined) => Effect.Effect<string, never, import("alchemy/ResourceContext").ResourceContext | import("alchemy/Stack").Stack | import("alchemy/Stage").Stage>;
|
|
12
|
+
/**
|
|
13
|
+
* Whether an object found by `name` is ours: a name in state always is; a
|
|
14
|
+
* user-chosen name with no state is not (adopting it needs `--adopt`); a
|
|
15
|
+
* generated name is.
|
|
16
|
+
*/
|
|
17
|
+
export declare const isOwnedName: (id: string, name: string, inState: boolean, maxLength?: number | undefined) => Effect.Effect<boolean, never, import("alchemy/ResourceContext").ResourceContext | import("alchemy/Stack").Stack | import("alchemy/Stage").Stage>;
|
|
18
|
+
//# sourceMappingURL=Names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Names.d.ts","sources":["../../src/internal/Names.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,OAAQ,MAAM,wKACiC,CAAC;AAEzE,yEAAyE;AACzE,eAAO,MAAM,WAAW,0PAOtB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW,kOAQtB,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { createPhysicalName } from "alchemy/PhysicalName";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
/**
|
|
4
|
+
* The name alchemy generates for a Daytona object when the user gives none:
|
|
5
|
+
* `<stack>-<id>-<stage>-<suffix>`, lowercase. Daytona volumes, secrets,
|
|
6
|
+
* snapshots and registries have no labels, so this name is also their
|
|
7
|
+
* ownership marker: only alchemy produces the random suffix, so an object
|
|
8
|
+
* with exactly this name was created by this logical id.
|
|
9
|
+
*/
|
|
10
|
+
export const physicalName = (id, maxLength = 63) => createPhysicalName({ id, maxLength, delimiter: "-", lowercase: true });
|
|
11
|
+
/** The user's name, the name already in state, or the generated name. */
|
|
12
|
+
export const resolveName = Effect.fn(function* (id, name, existing, maxLength) {
|
|
13
|
+
return name ?? existing ?? (yield* physicalName(id, maxLength));
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Whether an object found by `name` is ours: a name in state always is; a
|
|
17
|
+
* user-chosen name with no state is not (adopting it needs `--adopt`); a
|
|
18
|
+
* generated name is.
|
|
19
|
+
*/
|
|
20
|
+
export const isOwnedName = Effect.fn(function* (id, name, inState, maxLength) {
|
|
21
|
+
if (inState)
|
|
22
|
+
return true;
|
|
23
|
+
return name === (yield* physicalName(id, maxLength));
|
|
24
|
+
});
|
|
25
|
+
//# sourceMappingURL=Names.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Names.js","sources":["../../src/internal/Names.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAExC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,EAAU,EAAE,SAAS,GAAG,EAAE,EAAE,EAAE,CACzD,kBAAkB,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;AAEzE,yEAAyE;AACzE,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAC5C,EAAU,EACV,IAAwB,EACxB,QAAiB,EACjB,SAAkB;IAElB,OAAO,IAAI,IAAI,QAAQ,IAAI,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;AAClE,CAAC,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAC5C,EAAU,EACV,IAAY,EACZ,OAAgB,EAChB,SAAkB;IAElB,IAAI,OAAO;QAAE,OAAO,IAAI,CAAC;IACzB,OAAO,IAAI,KAAK,CAAC,KAAK,CAAC,CAAC,YAAY,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as apiKeys from "@distilled.cloud/daytona/api_keys";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { type Ref } from "./Ref.ts";
|
|
4
|
+
declare const OrganizationUnknown_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
5
|
+
readonly _tag: "Daytona.OrganizationUnknown";
|
|
6
|
+
} & Readonly<A>;
|
|
7
|
+
/** The credentials don't name an organization and the API key reports none. */
|
|
8
|
+
export declare class OrganizationUnknown extends OrganizationUnknown_base<{}> {
|
|
9
|
+
get message(): string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The organization the credentials act on: the profile's `organizationId`,
|
|
13
|
+
* else the organization the API key belongs to.
|
|
14
|
+
*/
|
|
15
|
+
export declare const currentOrganizationId: Effect.Effect<string, OrganizationUnknown | apiKeys.DaytonaOpError, apiKeys.DaytonaOpContext>;
|
|
16
|
+
/** An organization, by id. Accepts a `Daytona.Organization` or `{ organizationId }`. */
|
|
17
|
+
export type OrganizationRef = {
|
|
18
|
+
readonly organizationId: string;
|
|
19
|
+
};
|
|
20
|
+
/** The organization a resource acts on: its `organization` prop, else the credentials'. */
|
|
21
|
+
export declare const organizationIdFor: (organization: Ref<OrganizationRef> | undefined) => Effect.Effect<string, OrganizationUnknown | apiKeys.DaytonaOpError, apiKeys.DaytonaOpContext>;
|
|
22
|
+
/** Whether the props now point the resource at a different organization (a replacement). */
|
|
23
|
+
export declare const movesOrganization: (organization: Ref<OrganizationRef> | undefined, output: {
|
|
24
|
+
readonly organizationId: string;
|
|
25
|
+
}) => Effect.Effect<boolean, OrganizationUnknown | apiKeys.DaytonaOpError, apiKeys.DaytonaOpContext>;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=Organization.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Organization.d.ts","sources":["../../src/internal/Organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAG7D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAY,KAAK,GAAG,EAAE,MAAM,UAAU,CAAC;;;;AAE9C,+EAA+E;AAC/E,qBAAa,mBAAoB,SAAQ,yBAAgD,EAAE,CAAC;IAC1F,IAAa,OAAO,WAEnB;CACF;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,+FAOhC,CAAC;AAEH,wFAAwF;AACxF,MAAM,MAAM,eAAe,GAAG;IAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,CAAC;AAElE,2FAA2F;AAC3F,eAAO,MAAM,iBAAiB,iBAAkB,GAAG,CAAC,eAAe,CAAC,GAAG,SAAS,kGAGrB,CAAC;AAE5D,4FAA4F;AAC5F,eAAO,MAAM,iBAAiB,iBACd,GAAG,CAAC,eAAe,CAAC,GAAG,SAAS,UACtC;IAAE,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAAE,mGACyC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import * as apiKeys from "@distilled.cloud/daytona/api_keys";
|
|
2
|
+
import { Credentials } from "@distilled.cloud/daytona/Credentials";
|
|
3
|
+
import * as Data from "effect/Data";
|
|
4
|
+
import * as Effect from "effect/Effect";
|
|
5
|
+
import { resolved } from "./Ref.js";
|
|
6
|
+
/** The credentials don't name an organization and the API key reports none. */
|
|
7
|
+
export class OrganizationUnknown extends Data.TaggedError("Daytona.OrganizationUnknown") {
|
|
8
|
+
get message() {
|
|
9
|
+
return "Could not determine the Daytona organization: set organizationId in the profile or use an organization API key";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* The organization the credentials act on: the profile's `organizationId`,
|
|
14
|
+
* else the organization the API key belongs to.
|
|
15
|
+
*/
|
|
16
|
+
export const currentOrganizationId = Effect.gen(function* () {
|
|
17
|
+
const credentials = yield* Credentials;
|
|
18
|
+
const config = yield* credentials;
|
|
19
|
+
if (config.organizationId)
|
|
20
|
+
return config.organizationId;
|
|
21
|
+
const key = yield* apiKeys.getCurrentApiKey({});
|
|
22
|
+
if (!key.organizationId)
|
|
23
|
+
return yield* new OrganizationUnknown();
|
|
24
|
+
return key.organizationId;
|
|
25
|
+
});
|
|
26
|
+
/** The organization a resource acts on: its `organization` prop, else the credentials'. */
|
|
27
|
+
export const organizationIdFor = (organization) => organization === undefined
|
|
28
|
+
? currentOrganizationId
|
|
29
|
+
: Effect.succeed(resolved(organization).organizationId);
|
|
30
|
+
/** Whether the props now point the resource at a different organization (a replacement). */
|
|
31
|
+
export const movesOrganization = (organization, output) => Effect.map(organizationIdFor(organization), (id) => id !== output.organizationId);
|
|
32
|
+
//# sourceMappingURL=Organization.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Organization.js","sources":["../../src/internal/Organization.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,mCAAmC,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,KAAK,IAAI,MAAM,aAAa,CAAC;AACpC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAY,MAAM,UAAU,CAAC;AAE9C,+EAA+E;AAC/E,MAAM,OAAO,mBAAoB,SAAQ,IAAI,CAAC,WAAW,CAAC,6BAA6B,CAAK;IAC1F,IAAa,OAAO;QAClB,OAAO,gHAAgH,CAAC;IAC1H,CAAC;CACF;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IACvD,MAAM,WAAW,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;IACvC,MAAM,MAAM,GAAG,KAAK,CAAC,CAAC,WAAW,CAAC;IAClC,IAAI,MAAM,CAAC,cAAc;QAAE,OAAO,MAAM,CAAC,cAAc,CAAC;IACxD,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAChD,IAAI,CAAC,GAAG,CAAC,cAAc;QAAE,OAAO,KAAK,CAAC,CAAC,IAAI,mBAAmB,EAAE,CAAC;IACjE,OAAO,GAAG,CAAC,cAAc,CAAC;AAC5B,CAAC,CAAC,CAAC;AAKH,2FAA2F;AAC3F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,YAA8C,EAAE,EAAE,CAClF,YAAY,KAAK,SAAS;IACxB,CAAC,CAAC,qBAAqB;IACvB,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC,cAAc,CAAC,CAAC;AAE5D,4FAA4F;AAC5F,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,YAA8C,EAC9C,MAA2C,EAC3C,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC,iBAAiB,CAAC,YAAY,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,KAAK,MAAM,CAAC,cAAc,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as process from "@distilled.cloud/daytona/process";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
/**
|
|
4
|
+
* Run a shell command in a sandbox through the toolbox. The command is
|
|
5
|
+
* passed base64-encoded to `sh`, as Daytona's own SDKs do, so pipes,
|
|
6
|
+
* quotes and `&&` behave as in a shell.
|
|
7
|
+
*/
|
|
8
|
+
export declare const runCommand: (sandboxId: string, toolboxProxyUrl: string | undefined, request: {
|
|
9
|
+
command: string;
|
|
10
|
+
cwd?: string;
|
|
11
|
+
env?: Record<string, string>;
|
|
12
|
+
timeout?: number;
|
|
13
|
+
}) => Effect.Effect<process.ExecuteResponse, process.DaytonaOpError, process.DaytonaOpContext>;
|
|
14
|
+
//# sourceMappingURL=Process.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Process.d.ts","sources":["../../src/internal/Process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kCAAkC,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC;;;;GAIG;AACH,eAAO,MAAM,UAAU,cACV,MAAM,mBACA,MAAM,GAAG,SAAS,WAC1B;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,6FAYzF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as process from "@distilled.cloud/daytona/process";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import { inSandbox } from "./Toolbox.js";
|
|
4
|
+
/**
|
|
5
|
+
* Run a shell command in a sandbox through the toolbox. The command is
|
|
6
|
+
* passed base64-encoded to `sh`, as Daytona's own SDKs do, so pipes,
|
|
7
|
+
* quotes and `&&` behave as in a shell.
|
|
8
|
+
*/
|
|
9
|
+
export const runCommand = (sandboxId, toolboxProxyUrl, request) => Effect.sync(() => Buffer.from(request.command).toString("base64")).pipe(Effect.flatMap((encoded) => process.executeCommand({
|
|
10
|
+
command: `sh -c "echo '${encoded}' | base64 -d | sh"`,
|
|
11
|
+
cwd: request.cwd,
|
|
12
|
+
envs: request.env,
|
|
13
|
+
timeout: request.timeout,
|
|
14
|
+
})), inSandbox(sandboxId, toolboxProxyUrl));
|
|
15
|
+
//# sourceMappingURL=Process.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Process.js","sources":["../../src/internal/Process.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kCAAkC,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC;;;;GAIG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CACxB,SAAiB,EACjB,eAAmC,EACnC,OAA0F,EAC1F,EAAE,CACF,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CACrE,MAAM,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CACzB,OAAO,CAAC,cAAc,CAAC;IACrB,OAAO,EAAE,gBAAgB,OAAO,qBAAqB;IACrD,GAAG,EAAE,OAAO,CAAC,GAAG;IAChB,IAAI,EAAE,OAAO,CAAC,GAAG;IACjB,OAAO,EAAE,OAAO,CAAC,OAAO;CACzB,CAAC,CACH,EACD,SAAS,CAAC,SAAS,EAAE,eAAe,CAAC,CACtC,CAAC"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as fileSystem from "@distilled.cloud/daytona/file_system";
|
|
2
|
+
import * as process from "@distilled.cloud/daytona/process";
|
|
3
|
+
import * as sandboxes from "@distilled.cloud/daytona/sandbox";
|
|
4
|
+
import * as Toolbox from "@distilled.cloud/daytona/Toolbox";
|
|
5
|
+
import * as Bundle from "alchemy/Bundle/Bundle";
|
|
6
|
+
import * as Effect from "effect/Effect";
|
|
7
|
+
declare const ProgramStartFailed_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
8
|
+
readonly _tag: "Daytona.ProgramStartFailed";
|
|
9
|
+
} & Readonly<A>;
|
|
10
|
+
/**
|
|
11
|
+
* INTERNAL — the program a `Daytona.Sandbox` with `main` runs: bundled with
|
|
12
|
+
* rolldown, uploaded into the sandbox, and run with Node in a session.
|
|
13
|
+
*/
|
|
14
|
+
/** The program didn't come up: it exited, or never listened on its port. */
|
|
15
|
+
export declare class ProgramStartFailed extends ProgramStartFailed_base<{
|
|
16
|
+
readonly message: string;
|
|
17
|
+
readonly stdout: string;
|
|
18
|
+
readonly stderr: string;
|
|
19
|
+
}> {
|
|
20
|
+
}
|
|
21
|
+
/** What a sandbox's program is: the props that shape its bundle. */
|
|
22
|
+
export interface ProgramSource {
|
|
23
|
+
readonly main: string;
|
|
24
|
+
readonly handler?: string;
|
|
25
|
+
readonly isExternal?: boolean;
|
|
26
|
+
readonly build?: Bundle.BundleConfig;
|
|
27
|
+
}
|
|
28
|
+
/** The running program, as recorded in the sandbox's attributes. */
|
|
29
|
+
export interface ProgramState {
|
|
30
|
+
/** Port the program listens on. */
|
|
31
|
+
readonly port: number;
|
|
32
|
+
/** Session the process runs in. */
|
|
33
|
+
readonly sessionId: string;
|
|
34
|
+
/** The session command running the process. */
|
|
35
|
+
readonly commandId: string;
|
|
36
|
+
/** Content hash of the bundled program. */
|
|
37
|
+
readonly codeHash: string;
|
|
38
|
+
/** Hash of the process environment. */
|
|
39
|
+
readonly envHash: string;
|
|
40
|
+
}
|
|
41
|
+
export declare const DEFAULT_PORT = 3000;
|
|
42
|
+
/** The process environment as a shell file, sorted so its hash is stable. */
|
|
43
|
+
export declare const renderEnv: (env: Record<string, unknown>) => string;
|
|
44
|
+
/** Bundle `main` for Node, with the Daytona bootstrap around an Effect program. */
|
|
45
|
+
export declare const bundleProgram: (source: ProgramSource) => Effect.Effect<{
|
|
46
|
+
files: {
|
|
47
|
+
path: string;
|
|
48
|
+
content: Uint8Array<ArrayBufferLike>;
|
|
49
|
+
}[];
|
|
50
|
+
hash: string;
|
|
51
|
+
}, Bundle.BundleError | import("effect/PlatformError").PlatformError, import("effect/FileSystem").FileSystem | import("effect/Path").Path>;
|
|
52
|
+
/** The hash of a process environment. */
|
|
53
|
+
export declare const envHashOf: (env: Record<string, unknown>) => Effect.Effect<string, never, never>;
|
|
54
|
+
/**
|
|
55
|
+
* Whether the program's process still runs. A stopped or deleted sandbox,
|
|
56
|
+
* or a gone session, is not running.
|
|
57
|
+
*/
|
|
58
|
+
export declare const isProgramRunning: (sandboxId: string, state: ProgramState) => Effect.Effect<boolean, never, fileSystem.DaytonaOpContext>;
|
|
59
|
+
/**
|
|
60
|
+
* Upload the bundle and (re)start the process, unless the same bundle and
|
|
61
|
+
* environment already run. Returns the program's state and its URL.
|
|
62
|
+
*/
|
|
63
|
+
export declare const deployProgram: (input: {
|
|
64
|
+
readonly id: string;
|
|
65
|
+
readonly sandboxId: string;
|
|
66
|
+
readonly toolboxProxyUrl: string;
|
|
67
|
+
readonly source: ProgramSource;
|
|
68
|
+
readonly port: number;
|
|
69
|
+
readonly env: Record<string, unknown>;
|
|
70
|
+
readonly previous: ProgramState | undefined;
|
|
71
|
+
readonly note: (message: string) => Effect.Effect<void>;
|
|
72
|
+
}) => Effect.Effect<{
|
|
73
|
+
url: string;
|
|
74
|
+
state: {
|
|
75
|
+
port: number;
|
|
76
|
+
sessionId: string;
|
|
77
|
+
commandId: string;
|
|
78
|
+
codeHash: string;
|
|
79
|
+
envHash: string;
|
|
80
|
+
};
|
|
81
|
+
}, import("@distilled.cloud/core/errors").BadGateway | import("@distilled.cloud/core/errors").BadRequest | Toolbox.BulkTransferFailed | Bundle.BundleError | 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("effect/PlatformError").PlatformError | ProgramStartFailed | sandboxes.SandboxNotFound | import("@distilled.cloud/core/sdk-error").SdkError | import("@distilled.cloud/core/errors").ServiceUnavailable | process.SessionCommandNotFound | process.SessionNotFound | import("@distilled.cloud/core/errors").TooManyRequests | import("@distilled.cloud/core/errors").Unauthorized | import("@distilled.cloud/daytona/Errors").UnknownDaytonaError | import("@distilled.cloud/core/errors").UnprocessableEntity, import("effect/FileSystem").FileSystem | import("effect/Path").Path | fileSystem.DaytonaOpContext>;
|
|
82
|
+
export {};
|
|
83
|
+
//# sourceMappingURL=Program.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Program.d.ts","sources":["../../src/internal/Program.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,UAAU,MAAM,sCAAsC,CAAC;AAEnE,OAAO,KAAK,OAAO,MAAM,kCAAkC,CAAC;AAC5D,OAAO,KAAK,SAAS,MAAM,kCAAkC,CAAC;AAC9D,OAAO,KAAK,OAAO,MAAM,kCAAkC,CAAC;AAC5D,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAIhD,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;;;;AAKxC;;;GAGG;AAEH,4EAA4E;AAC5E,qBAAa,kBAAmB,SAAQ,wBAA+C;IACrF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;CAAG;AAEL,oEAAoE;AACpE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,YAAY,CAAC;CACtC;AAED,oEAAoE;AACpE,MAAM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