@tangle-network/sandbox 0.0.0-develop.20260514223840.b2abd84
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 +11 -0
- package/README.md +736 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.js +1 -0
- package/dist/client-CO5cnRwn.js +1 -0
- package/dist/collaboration/index.d.ts +2 -0
- package/dist/collaboration/index.js +1 -0
- package/dist/collaboration-CRyb5e8F.js +1 -0
- package/dist/core.d.ts +3 -0
- package/dist/core.js +1 -0
- package/dist/errors-CljiGR__.js +1 -0
- package/dist/errors-Cy5W2uYq.d.ts +1116 -0
- package/dist/index-CCsA3S0D.d.ts +136 -0
- package/dist/index-Cka6RuZB.d.ts +371 -0
- package/dist/index-Dpj1oB5i.d.ts +220 -0
- package/dist/index.d.ts +555 -0
- package/dist/index.js +1 -0
- package/dist/openai/index.d.ts +642 -0
- package/dist/openai/index.js +1 -0
- package/dist/platform-integrations.d.ts +2 -0
- package/dist/platform-integrations.js +1 -0
- package/dist/sandbox-193cSjQB.js +1 -0
- package/dist/sandbox-CTe9fN5m.d.ts +4857 -0
- package/dist/session-gateway/index.d.ts +448 -0
- package/dist/session-gateway/index.js +1 -0
- package/dist/tangle/index.d.ts +2 -0
- package/dist/tangle/index.js +1 -0
- package/dist/tangle-B4_UoyBS.js +1 -0
- package/package.json +105 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,555 @@
|
|
|
1
|
+
import { d as AnyTokenPayload, h as IssueCollaborationTokenOptions, m as CollaborationTokenPayload, p as CollaborationAccess } from "./index-Dpj1oB5i.js";
|
|
2
|
+
import { _ as CollaborationTransportConfig, a as CollaborationClient, c as CollaborationClientConfig, d as CollaborationDocumentRef, f as CollaborationFileBridgeOptions, g as CollaborationTokenRefreshResponse, h as CollaborationTokenRefreshRequest, i as parseCollaborationDocumentId, l as CollaborationDocumentAdapter, m as CollaborationPermissions, n as buildCollaborationDocumentId, o as CollaborationBootstrapRequest, p as CollaborationFileEvent, r as normalizeCollaborationPath, s as CollaborationBootstrapResponse, t as CollaborationFileBridge, u as CollaborationDocumentChange, v as SaveCollaborationSnapshotRequest, y as SaveCollaborationSnapshotResponse } from "./index-CCsA3S0D.js";
|
|
3
|
+
import { A as IntegrationActionKind, B as TriggerWithSecret, C as CreateEndpointInput, D as EndpointWithSecret, E as EndpointInfo, F as IntegrationVerificationKind, G as parseSSEStream, H as SandboxFleetClient, I as IntegrationsManager, L as RecipeManifest, M as IntegrationPrincipalType, N as IntegrationProvider, O as InstallRecipeInput, P as IntegrationScope, R as TriggerInfo, S as CreateAutomationInput, T as DeliveryAttempt, U as ParseSSEStreamOptions, V as SandboxFleet, W as ParsedSSEEvent, _ as Team, a as PartialFailureError, b as AutomationInfo, c as SandboxErrorJson, d as StateError, f as TimeoutError, g as SandboxClient, h as InviteTeamMemberOptions, i as NotFoundError, j as IntegrationDeliveryStatus, k as IntegrationAction, l as SandboxFailureDetail, m as CreateTeamOptions, n as CapabilityError, o as QuotaError, p as ValidationError, r as NetworkError, s as SandboxError, t as AuthError, u as ServerError, v as TeamInvitation, w as CreateTriggerInput, x as ConnectionInfo, y as TeamMember, z as TriggerRun } from "./errors-Cy5W2uYq.js";
|
|
4
|
+
import { $ as FleetExecDispatchOptions, $n as StorageConfig, $t as SandboxClientConfig, An as SandboxInfo, Ar as defineInlineResource, At as ProcessLogEntry, B as DownloadProgress, Bn as ScopedToken, Bt as ProvisionStatus, C as BatchResult, Cn as SandboxFleetTraceExport, Cr as AgentProfileResourceRef, Ct as NetworkManager, D as CheckpointOptions, Dn as SandboxFleetWorkspaceReconcileResult, Dr as AgentSubagentProfile, Dt as PreviewLinkManager, E as CheckpointInfo, En as SandboxFleetWorkspace, Er as AgentProfileValidationResult, Et as PreviewLinkInfo, F as DeleteOptions, Fn as SandboxTraceBundle, Fr as SandboxMcpEndpoint, G as ExecOptions, Gn as SecretsManager, Gt as PublishPublicTemplateVersionOptions, H as DriverInfo, Hn as SearchMatch, Ht as PublicTemplateInfo, I as DirectoryPermission, In as SandboxTraceEvent, Ir as SandboxMcpServerEntry, It as PromptOptions, J as FileSystem, Jn as SessionListOptions, Jt as ReconcileSandboxFleetsOptions, K as ExecResult, Kn as SessionEventStreamOptions, Kt as ReapExpiredSandboxFleetsOptions, L as DispatchPromptOptions, Ln as SandboxTraceExport, Lr as buildSandboxMcpConfig, Lt as PromptResult, Mn as SandboxPermissionsConfig, Mr as BuildSandboxMcpConfigOptions, Mt as ProcessSignal, N as CreateSandboxFleetWithCoordinatorOptions, Nn as SandboxResources, Nr as SANDBOX_MCP_SERVER_NAME, Nt as ProcessSpawnOptions, O as CheckpointResult, On as SandboxFleetWorkspaceRestoreResult, Or as defineAgentProfile, Ot as Process, P as CreateSandboxOptions, Pn as SandboxStatus, Pr as SandboxMcpConfig, Pt as ProcessStatus, Q as FleetDispatchStreamOptions, Qn as SnapshotResult, Qt as SSHCredentials, R as DispatchedSession, Rn as SandboxTraceOptions, Rt as ProvisionEvent, S as BatchOptions, Sn as SandboxFleetTraceEvent, Sr as AgentProfilePrompt, St as NetworkConfig, T as BatchTaskResult, Tn as SandboxFleetUsage, Tr as AgentProfileValidationIssue, Tt as PermissionsManager, U as DriverType, Un as SearchOptions, Ut as PublicTemplateVersionInfo, V as DriverConfig, Vn as ScopedTokenScope, Vt as ProvisionStep, W as EventStreamOptions, Wn as SecretInfo, Wt as PublishPublicTemplateOptions, X as FleetDispatchResultBuffer, Xn as SnapshotInfo, Xt as RunCodeOptions, Y as FleetDispatchCancelResult, Yn as SessionStatus, Yt as ReconcileSandboxFleetsResult, Z as FleetDispatchResultBufferOptions, Zn as SnapshotOptions, Zt as SSHCommandDescriptor, _ as BackendInfo, _n as SandboxFleetManifestMachine, _r as AgentProfileConfidential, _t as ListSandboxFleetOptions, a as TraceExportSink, an as SandboxFleetCostEstimate, ar as TeeAttestationResponse, at as ForkResult, b as BackendType, bn as SandboxFleetToken, br as AgentProfileModelHints, bt as MintScopedTokenOptions, c as otelTraceIdForTangleTrace, cn as SandboxFleetDriverCapability, cr as TokenRefreshHandler, ct as GitCommit, d as AcceleratorKind, dn as SandboxFleetIntelligenceEnvelope, dr as UploadOptions, dt as GitStatus, en as SandboxConnection, er as SubscriptionInfo, f as AccessPolicyRule, fn as SandboxFleetMachine, fr as UploadProgress, ft as GpuType, g as BackendConfig, gn as SandboxFleetManifest, gr as AgentProfileCapabilities, gt as ListOptions, h as BackendCapabilities, hn as SandboxFleetMachineSpec, hr as AgentProfile, i as TraceExportResult, in as SandboxFleetArtifactSpec, ir as TeeAttestationReport, it as ForkOptions, j as CreateSandboxFleetOptions, jn as SandboxIntelligenceEnvelope, jr as mergeAgentProfiles, jt as ProcessManager, k as CodeResult, kn as SandboxFleetWorkspaceSnapshotResult, kr as defineGitHubResource, kt as ProcessInfo, l as toOtelJson, ln as SandboxFleetDriverTimings, lr as ToolsConfig, lt as GitConfig, m as AttachSandboxFleetMachineOptions, mn as SandboxFleetMachineRecord, mr as WaitForOptions, n as SandboxInstance, nn as SandboxEvent, nr as TaskResult, nt as FleetPromptDispatchOptions, o as buildTraceExportPayload, on as SandboxFleetDispatchFailureClass, or as TeePublicKey, ot as GitAuth, p as AddUserOptions, pn as SandboxFleetMachineMeteredUsage, pr as UsageInfo, pt as InstalledTool, q as FileInfo, qn as SessionInfo, qt as ReapExpiredSandboxFleetsResult, r as TraceExportFormat, rn as SandboxFleetArtifact, rr as TeeAttestationOptions, s as exportTraceBundle, sn as SandboxFleetDispatchResponse, sr as TeePublicKeyResponse, st as GitBranch, tn as SandboxEnvironment, tr as TaskOptions, tt as FleetMachineId, u as SandboxSession, un as SandboxFleetInfo, ur as UpdateUserOptions, ut as GitDiff, v as BackendManager, vn as SandboxFleetOperationsSummary, vr as AgentProfileFileMount, vt as ListSandboxOptions, w as BatchTask, wn as SandboxFleetTraceOptions, wr as AgentProfileResources, wt as PermissionLevel, x as BatchEvent, xn as SandboxFleetTraceBundle, xr as AgentProfilePermissionValue, xt as MkdirOptions, y as BackendStatus, yn as SandboxFleetPolicy, yr as AgentProfileMcpServer, yt as McpServerConfig, z as DownloadOptions, zn as SandboxUser, zt as ProvisionResult } from "./sandbox-CTe9fN5m.js";
|
|
5
|
+
import { IntegrationActor, IntegrationManifest, IntegrationRequirement } from "./platform-integrations.js";
|
|
6
|
+
import { s as TangleSandboxClientConfig, t as TangleSandboxClient } from "./index-Cka6RuZB.js";
|
|
7
|
+
|
|
8
|
+
//#region src/attestation-heartbeat.d.ts
|
|
9
|
+
interface TeeAttestationHeartbeatSample {
|
|
10
|
+
sequence: number;
|
|
11
|
+
nonce: string;
|
|
12
|
+
response: TeeAttestationResponse;
|
|
13
|
+
checkedAt: Date;
|
|
14
|
+
}
|
|
15
|
+
interface TeeAttestationHeartbeatOptions {
|
|
16
|
+
/** Cadence for automatic re-attestation. Default: 60 seconds. */
|
|
17
|
+
intervalMs?: number;
|
|
18
|
+
/** Abort signal used to stop the heartbeat. */
|
|
19
|
+
signal?: AbortSignal;
|
|
20
|
+
/** Start the first check immediately. Default: true. */
|
|
21
|
+
immediate?: boolean;
|
|
22
|
+
/** Keep running after a failed check. Default: false. */
|
|
23
|
+
continueOnFailure?: boolean;
|
|
24
|
+
/** Optional caller verification hook, e.g. tcloud-attestation policy checks. */
|
|
25
|
+
verify?: (sample: TeeAttestationHeartbeatSample) => void | Promise<void>;
|
|
26
|
+
onSuccess?: (sample: TeeAttestationHeartbeatSample) => void;
|
|
27
|
+
onFailure?: (error: unknown) => void;
|
|
28
|
+
}
|
|
29
|
+
interface TeeAttestationHeartbeat {
|
|
30
|
+
stop(): void;
|
|
31
|
+
ping(): Promise<TeeAttestationHeartbeatSample>;
|
|
32
|
+
readonly stopped: boolean;
|
|
33
|
+
readonly failures: number;
|
|
34
|
+
readonly latest: TeeAttestationHeartbeatSample | undefined;
|
|
35
|
+
readonly done: Promise<void>;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Periodically requests nonce-bound TEE attestations for a running sandbox.
|
|
39
|
+
*
|
|
40
|
+
* This proves freshness/liveness of the attested sandbox endpoint. It does not
|
|
41
|
+
* by itself sign every computation result; callers that need result binding
|
|
42
|
+
* should include a result/session digest in the nonce preimage before asking
|
|
43
|
+
* the runtime for a quote.
|
|
44
|
+
*/
|
|
45
|
+
declare function startTeeAttestationHeartbeat(sandbox: Pick<SandboxInstance, "getTeeAttestation">, options?: TeeAttestationHeartbeatOptions): TeeAttestationHeartbeat;
|
|
46
|
+
//#endregion
|
|
47
|
+
//#region src/confidential.d.ts
|
|
48
|
+
type SandboxCreator = {
|
|
49
|
+
create(options?: CreateSandboxOptions): Promise<SandboxInstance>;
|
|
50
|
+
};
|
|
51
|
+
type ConfidentialTeeType = NonNullable<AgentProfileConfidential["tee"]>;
|
|
52
|
+
interface CreateConfidentialSandboxOptions extends Omit<CreateSandboxOptions, "confidential"> {
|
|
53
|
+
confidential: AgentProfileConfidential & {
|
|
54
|
+
tee: ConfidentialTeeType;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* Deploy-time attestation challenge. Use "auto" to generate a 32-byte nonce.
|
|
58
|
+
*/
|
|
59
|
+
attestationNonce?: string | "auto";
|
|
60
|
+
/**
|
|
61
|
+
* Require attestation evidence to be present before returning.
|
|
62
|
+
*
|
|
63
|
+
* Hardware-root verification is intentionally not performed here. Pass the
|
|
64
|
+
* returned attestation to a verifier such as `@tangle-network/tcloud/attestation`.
|
|
65
|
+
*/
|
|
66
|
+
requireAttestation?: boolean;
|
|
67
|
+
}
|
|
68
|
+
interface ConfidentialSandboxResult {
|
|
69
|
+
sandbox: SandboxInstance;
|
|
70
|
+
attestation?: TeeAttestationReport;
|
|
71
|
+
attestationNonce?: string;
|
|
72
|
+
}
|
|
73
|
+
declare function generateAttestationNonce(bytes?: number): string;
|
|
74
|
+
declare function createConfidentialSandbox(client: SandboxCreator, options: CreateConfidentialSandboxOptions): Promise<ConfidentialSandboxResult>;
|
|
75
|
+
//#endregion
|
|
76
|
+
//#region src/image.d.ts
|
|
77
|
+
/**
|
|
78
|
+
* Image Builder for Sandbox SDK
|
|
79
|
+
*
|
|
80
|
+
* Provides a chainable API for building custom container images.
|
|
81
|
+
*
|
|
82
|
+
* @example Basic usage
|
|
83
|
+
* ```typescript
|
|
84
|
+
* import { Image, Sandbox } from "@tangle-network/sandbox";
|
|
85
|
+
*
|
|
86
|
+
* const client = new Sandbox({ apiKey: "sk_sandbox_...", baseUrl: "https://your-sandbox-api.example.com" });
|
|
87
|
+
*
|
|
88
|
+
* const image = await Image.create()
|
|
89
|
+
* .python("3.11")
|
|
90
|
+
* .addPackages(["numpy", "pandas"])
|
|
91
|
+
* .addCommands(["apt-get update && apt-get install -y ffmpeg"])
|
|
92
|
+
* .withSecrets(["HF_TOKEN"])
|
|
93
|
+
* .build({ client });
|
|
94
|
+
*
|
|
95
|
+
* const box = await client.create({ image: image.id });
|
|
96
|
+
* ```
|
|
97
|
+
*/
|
|
98
|
+
/**
|
|
99
|
+
* Image specification for building a custom container image.
|
|
100
|
+
*/
|
|
101
|
+
interface ImageSpec {
|
|
102
|
+
/** Base Docker image (default: "ubuntu:22.04") */
|
|
103
|
+
baseImage: string;
|
|
104
|
+
/** Python version to install */
|
|
105
|
+
pythonVersion?: string;
|
|
106
|
+
/** Python packages to install via pip */
|
|
107
|
+
packages?: string[];
|
|
108
|
+
/** Shell commands to run during build */
|
|
109
|
+
commands?: string[];
|
|
110
|
+
/** Environment variables */
|
|
111
|
+
env?: Record<string, string>;
|
|
112
|
+
/** Secret names to inject during build */
|
|
113
|
+
secrets?: string[];
|
|
114
|
+
/** Custom Dockerfile content or path */
|
|
115
|
+
dockerfile?: string;
|
|
116
|
+
/** Build context directory */
|
|
117
|
+
dockerContext?: string;
|
|
118
|
+
/** Conda environment configuration */
|
|
119
|
+
conda?: {
|
|
120
|
+
packages: string[];
|
|
121
|
+
channels?: string[];
|
|
122
|
+
};
|
|
123
|
+
/** System packages to install via apt-get */
|
|
124
|
+
aptPackages?: string[];
|
|
125
|
+
/** Working directory */
|
|
126
|
+
workdir?: string;
|
|
127
|
+
/** User to run as */
|
|
128
|
+
user?: string;
|
|
129
|
+
/** Build arguments */
|
|
130
|
+
buildArgs?: Record<string, string>;
|
|
131
|
+
/** Image labels */
|
|
132
|
+
labels?: Record<string, string>;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Build result for an image.
|
|
136
|
+
*/
|
|
137
|
+
interface ImageBuildResult {
|
|
138
|
+
/** Content-addressed image ID */
|
|
139
|
+
id: string;
|
|
140
|
+
/** Image tag */
|
|
141
|
+
tag: string;
|
|
142
|
+
/** Image size in bytes */
|
|
143
|
+
size: number;
|
|
144
|
+
/** Build time in milliseconds */
|
|
145
|
+
buildTimeMs: number;
|
|
146
|
+
/** Whether served from cache */
|
|
147
|
+
cached: boolean;
|
|
148
|
+
/** Creation timestamp */
|
|
149
|
+
createdAt: Date;
|
|
150
|
+
/** Original build spec */
|
|
151
|
+
spec: ImageSpec;
|
|
152
|
+
/** Image digest */
|
|
153
|
+
digest: string;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Progress event during image build.
|
|
157
|
+
*/
|
|
158
|
+
interface BuildProgressEvent {
|
|
159
|
+
/** Current build step */
|
|
160
|
+
step: string;
|
|
161
|
+
/** Progress percentage (0-100) */
|
|
162
|
+
progress?: number;
|
|
163
|
+
/** Human-readable message */
|
|
164
|
+
message: string;
|
|
165
|
+
/** Whether step is complete */
|
|
166
|
+
complete: boolean;
|
|
167
|
+
/** Whether step used cache */
|
|
168
|
+
cached?: boolean;
|
|
169
|
+
/** Error message if failed */
|
|
170
|
+
error?: string;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Options for building an image.
|
|
174
|
+
*/
|
|
175
|
+
interface ImageBuildOptions {
|
|
176
|
+
/** Progress callback */
|
|
177
|
+
onProgress?: (event: BuildProgressEvent) => void;
|
|
178
|
+
/** Build timeout in milliseconds */
|
|
179
|
+
timeout?: number;
|
|
180
|
+
/** Force rebuild ignoring cache */
|
|
181
|
+
noCache?: boolean;
|
|
182
|
+
/** Target platform */
|
|
183
|
+
platform?: string;
|
|
184
|
+
/** Custom tag for the image */
|
|
185
|
+
tag?: string;
|
|
186
|
+
/** Sandbox client for API access */
|
|
187
|
+
client?: {
|
|
188
|
+
baseUrl: string;
|
|
189
|
+
apiKey: string;
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Represents a built or existing container image.
|
|
194
|
+
*/
|
|
195
|
+
declare class Image {
|
|
196
|
+
/** Unique image identifier (content-addressed) */
|
|
197
|
+
readonly id: string;
|
|
198
|
+
/** Full image tag */
|
|
199
|
+
readonly tag: string;
|
|
200
|
+
/** Image digest */
|
|
201
|
+
readonly digest: string;
|
|
202
|
+
/** Original build spec */
|
|
203
|
+
readonly spec?: ImageSpec | undefined;
|
|
204
|
+
private constructor();
|
|
205
|
+
/**
|
|
206
|
+
* Start building a new image.
|
|
207
|
+
*
|
|
208
|
+
* @param baseImage Base Docker image (default: "ubuntu:22.04")
|
|
209
|
+
* @returns A new ImageBuilder instance
|
|
210
|
+
*
|
|
211
|
+
* @example
|
|
212
|
+
* ```typescript
|
|
213
|
+
* const builder = Image.create("python:3.11-slim");
|
|
214
|
+
* ```
|
|
215
|
+
*/
|
|
216
|
+
static create(baseImage?: string): ImageBuilder;
|
|
217
|
+
/**
|
|
218
|
+
* Reference an existing image by ID.
|
|
219
|
+
*
|
|
220
|
+
* @param imageId The image ID
|
|
221
|
+
* @returns An Image instance
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* const image = Image.fromId("sha256:abc123...");
|
|
226
|
+
* const box = await client.create({ image: image.id });
|
|
227
|
+
* ```
|
|
228
|
+
*/
|
|
229
|
+
static fromId(imageId: string): Image;
|
|
230
|
+
/**
|
|
231
|
+
* Create an image builder from a Dockerfile.
|
|
232
|
+
*
|
|
233
|
+
* @param dockerfile Dockerfile path or content
|
|
234
|
+
* @param context Build context directory
|
|
235
|
+
* @returns A new ImageBuilder instance
|
|
236
|
+
*
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const builder = Image.fromDockerfile("./Dockerfile", "./");
|
|
240
|
+
* ```
|
|
241
|
+
*/
|
|
242
|
+
static fromDockerfile(dockerfile: string, context?: string): ImageBuilder;
|
|
243
|
+
/**
|
|
244
|
+
* Create an Image from a build result.
|
|
245
|
+
* @internal
|
|
246
|
+
*/
|
|
247
|
+
static fromBuildResult(result: ImageBuildResult): Image;
|
|
248
|
+
/**
|
|
249
|
+
* Convert to JSON.
|
|
250
|
+
*/
|
|
251
|
+
toJSON(): {
|
|
252
|
+
id: string;
|
|
253
|
+
tag: string;
|
|
254
|
+
digest: string;
|
|
255
|
+
spec?: ImageSpec;
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
/**
|
|
259
|
+
* Chainable builder for constructing custom container images.
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* ```typescript
|
|
263
|
+
* const image = await Image.create()
|
|
264
|
+
* .python("3.11")
|
|
265
|
+
* .addPackages(["torch", "transformers"])
|
|
266
|
+
* .addCommands(["apt-get install -y ffmpeg"])
|
|
267
|
+
* .withEnv({ HF_HOME: "/models" })
|
|
268
|
+
* .withSecrets(["HF_TOKEN"])
|
|
269
|
+
* .build({ client });
|
|
270
|
+
* ```
|
|
271
|
+
*/
|
|
272
|
+
declare class ImageBuilder {
|
|
273
|
+
private spec;
|
|
274
|
+
private clientConfig?;
|
|
275
|
+
/** @internal */
|
|
276
|
+
constructor(initialSpec: Partial<ImageSpec>);
|
|
277
|
+
/**
|
|
278
|
+
* Configure Python version.
|
|
279
|
+
*
|
|
280
|
+
* @param version Python version (e.g., "3.11", "3.10")
|
|
281
|
+
*/
|
|
282
|
+
python(version: string): this;
|
|
283
|
+
/**
|
|
284
|
+
* Add Python packages via pip.
|
|
285
|
+
*
|
|
286
|
+
* @param packages Package names with optional versions
|
|
287
|
+
*
|
|
288
|
+
* @example
|
|
289
|
+
* ```typescript
|
|
290
|
+
* .addPackages(["numpy>=1.21", "pandas", "scikit-learn"])
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
addPackages(packages: string[]): this;
|
|
294
|
+
/**
|
|
295
|
+
* Add packages from requirements file.
|
|
296
|
+
*
|
|
297
|
+
* @param requirementsPath Path to requirements.txt
|
|
298
|
+
*/
|
|
299
|
+
addPackagesFromFile(requirementsPath: string): this;
|
|
300
|
+
/**
|
|
301
|
+
* Add shell commands to run during build.
|
|
302
|
+
*
|
|
303
|
+
* @param commands Commands to execute
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```typescript
|
|
307
|
+
* .addCommands([
|
|
308
|
+
* "apt-get update",
|
|
309
|
+
* "apt-get install -y ffmpeg libsm6"
|
|
310
|
+
* ])
|
|
311
|
+
* ```
|
|
312
|
+
*/
|
|
313
|
+
addCommands(commands: string[]): this;
|
|
314
|
+
/**
|
|
315
|
+
* Add system packages via apt-get.
|
|
316
|
+
*
|
|
317
|
+
* @param packages Package names
|
|
318
|
+
*/
|
|
319
|
+
addAptPackages(packages: string[]): this;
|
|
320
|
+
/**
|
|
321
|
+
* Set environment variables.
|
|
322
|
+
*
|
|
323
|
+
* @param env Key-value pairs
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* ```typescript
|
|
327
|
+
* .withEnv({ HF_HOME: "/models", PYTHONUNBUFFERED: "1" })
|
|
328
|
+
* ```
|
|
329
|
+
*/
|
|
330
|
+
withEnv(env: Record<string, string>): this;
|
|
331
|
+
/**
|
|
332
|
+
* Inject secrets during build.
|
|
333
|
+
* Secrets are retrieved from the secret store.
|
|
334
|
+
*
|
|
335
|
+
* @param secretNames Names of secrets to inject
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* .withSecrets(["HF_TOKEN", "AWS_ACCESS_KEY"])
|
|
340
|
+
* ```
|
|
341
|
+
*/
|
|
342
|
+
withSecrets(secretNames: string[]): this;
|
|
343
|
+
/**
|
|
344
|
+
* Configure conda environment.
|
|
345
|
+
*
|
|
346
|
+
* @param packages Conda packages
|
|
347
|
+
* @param channels Conda channels (default: ["conda-forge"])
|
|
348
|
+
*
|
|
349
|
+
* @example
|
|
350
|
+
* ```typescript
|
|
351
|
+
* .conda(["pytorch", "torchvision"], ["pytorch", "conda-forge"])
|
|
352
|
+
* ```
|
|
353
|
+
*/
|
|
354
|
+
conda(packages: string[], channels?: string[]): this;
|
|
355
|
+
/**
|
|
356
|
+
* Set working directory.
|
|
357
|
+
*
|
|
358
|
+
* @param dir Working directory path
|
|
359
|
+
*/
|
|
360
|
+
workdir(dir: string): this;
|
|
361
|
+
/**
|
|
362
|
+
* Set user to run as.
|
|
363
|
+
*
|
|
364
|
+
* @param user Username or UID
|
|
365
|
+
*/
|
|
366
|
+
user(user: string): this;
|
|
367
|
+
/**
|
|
368
|
+
* Add build arguments.
|
|
369
|
+
*
|
|
370
|
+
* @param args Build arguments
|
|
371
|
+
*/
|
|
372
|
+
buildArgs(args: Record<string, string>): this;
|
|
373
|
+
/**
|
|
374
|
+
* Add image labels.
|
|
375
|
+
*
|
|
376
|
+
* @param labels Image labels
|
|
377
|
+
*/
|
|
378
|
+
labels(labels: Record<string, string>): this;
|
|
379
|
+
/**
|
|
380
|
+
* Get the image specification without building.
|
|
381
|
+
*
|
|
382
|
+
* @returns The current ImageSpec
|
|
383
|
+
*/
|
|
384
|
+
toSpec(): ImageSpec;
|
|
385
|
+
/**
|
|
386
|
+
* Compute the content-addressed ID for this spec.
|
|
387
|
+
*
|
|
388
|
+
* Uses Web Crypto when available (browsers and Node 22+), falling
|
|
389
|
+
* back to a lazy `import("node:crypto")` on older server runtimes.
|
|
390
|
+
* Works in every JavaScript environment the SDK supports.
|
|
391
|
+
*
|
|
392
|
+
* @returns SHA-256 hash of the normalized spec as a hex string.
|
|
393
|
+
*
|
|
394
|
+
* **Breaking change (v0.0.3):** `computeId()` was previously
|
|
395
|
+
* synchronous. Callers must now `await` the result. A Node-only sync
|
|
396
|
+
* variant was considered and dropped: it would have either required
|
|
397
|
+
* Node 22.3+ (breaking Node 18/20 consumers) or re-introduced the
|
|
398
|
+
* top-level `node:crypto` import that blanks every browser page
|
|
399
|
+
* transitively importing the SDK root. If you genuinely need the
|
|
400
|
+
* hash synchronously in a Node-only context, compute it yourself
|
|
401
|
+
* from `builder.toSpec()` with `JSON.stringify(spec, Object.keys(spec).sort())`.
|
|
402
|
+
*/
|
|
403
|
+
computeId(): Promise<string>;
|
|
404
|
+
/**
|
|
405
|
+
* Configure client for API access.
|
|
406
|
+
* @internal
|
|
407
|
+
*/
|
|
408
|
+
withClient(config: {
|
|
409
|
+
baseUrl: string;
|
|
410
|
+
apiKey: string;
|
|
411
|
+
}): this;
|
|
412
|
+
/**
|
|
413
|
+
* Build the image.
|
|
414
|
+
*
|
|
415
|
+
* @param options Build options including client config
|
|
416
|
+
* @returns The built Image instance
|
|
417
|
+
*
|
|
418
|
+
* @example
|
|
419
|
+
* ```typescript
|
|
420
|
+
* const image = await Image.create()
|
|
421
|
+
* .python("3.11")
|
|
422
|
+
* .addPackages(["numpy"])
|
|
423
|
+
* .build({
|
|
424
|
+
* client: { baseUrl, apiKey },
|
|
425
|
+
* onProgress: (e) => console.log(e.message),
|
|
426
|
+
* });
|
|
427
|
+
*
|
|
428
|
+
* const box = await client.create({ image: image.id });
|
|
429
|
+
* ```
|
|
430
|
+
*/
|
|
431
|
+
build(options?: ImageBuildOptions): Promise<Image>;
|
|
432
|
+
/**
|
|
433
|
+
* Generate Dockerfile from the current spec.
|
|
434
|
+
* Useful for debugging or manual builds.
|
|
435
|
+
*
|
|
436
|
+
* @returns Dockerfile content
|
|
437
|
+
*/
|
|
438
|
+
generateDockerfile(): string;
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* Generate a Dockerfile from an ImageSpec.
|
|
442
|
+
*
|
|
443
|
+
* @param spec The image specification
|
|
444
|
+
* @returns Dockerfile content
|
|
445
|
+
*/
|
|
446
|
+
declare function generateDockerfile(spec: ImageSpec): string;
|
|
447
|
+
//#endregion
|
|
448
|
+
//#region src/manage-sandboxes.d.ts
|
|
449
|
+
declare const MANAGE_SANDBOXES_TOOL_NAME = "manageSandboxes";
|
|
450
|
+
type ManageSandboxesInput = {
|
|
451
|
+
action: "capabilities";
|
|
452
|
+
} | {
|
|
453
|
+
action: "create";
|
|
454
|
+
options: CreateSandboxFleetOptions;
|
|
455
|
+
} | {
|
|
456
|
+
action: "createWithCoordinator";
|
|
457
|
+
options: CreateSandboxFleetWithCoordinatorOptions;
|
|
458
|
+
} | {
|
|
459
|
+
action: "list";
|
|
460
|
+
fleetId: string;
|
|
461
|
+
} | {
|
|
462
|
+
action: "delete";
|
|
463
|
+
fleetId: string;
|
|
464
|
+
} | {
|
|
465
|
+
action: "attachMachine";
|
|
466
|
+
fleetId: string;
|
|
467
|
+
machine: AttachSandboxFleetMachineOptions;
|
|
468
|
+
} | {
|
|
469
|
+
action: "detachMachine";
|
|
470
|
+
fleetId: string;
|
|
471
|
+
machineId: FleetMachineId;
|
|
472
|
+
} | {
|
|
473
|
+
action: "manifest";
|
|
474
|
+
fleetId: string;
|
|
475
|
+
} | {
|
|
476
|
+
action: "usage";
|
|
477
|
+
fleetId: string;
|
|
478
|
+
} | {
|
|
479
|
+
action: "trace";
|
|
480
|
+
fleetId: string;
|
|
481
|
+
} | {
|
|
482
|
+
action: "intelligence";
|
|
483
|
+
fleetId: string;
|
|
484
|
+
} | {
|
|
485
|
+
action: "cost";
|
|
486
|
+
fleetId: string;
|
|
487
|
+
} | {
|
|
488
|
+
action: "createWorkspaceSnapshot";
|
|
489
|
+
fleetId: string;
|
|
490
|
+
} | {
|
|
491
|
+
action: "restoreWorkspaceSnapshot";
|
|
492
|
+
fleetId: string;
|
|
493
|
+
snapshotId: string;
|
|
494
|
+
} | {
|
|
495
|
+
action: "reconcileWorkspace";
|
|
496
|
+
fleetId: string;
|
|
497
|
+
};
|
|
498
|
+
interface ManageSandboxesTool {
|
|
499
|
+
name: typeof MANAGE_SANDBOXES_TOOL_NAME;
|
|
500
|
+
description: string;
|
|
501
|
+
parameters: Record<string, unknown>;
|
|
502
|
+
execute(input: ManageSandboxesInput | Record<string, unknown>): Promise<unknown>;
|
|
503
|
+
}
|
|
504
|
+
interface ManageSandboxesToolOptions {
|
|
505
|
+
/**
|
|
506
|
+
* Host-owned caps applied to every create action. The model must not be
|
|
507
|
+
* allowed to choose its own spend, driver, accelerator, or scale policy.
|
|
508
|
+
*/
|
|
509
|
+
policy?: SandboxFleetPolicy;
|
|
510
|
+
}
|
|
511
|
+
declare function createManageSandboxesTool(client: SandboxClient, options?: ManageSandboxesToolOptions): ManageSandboxesTool;
|
|
512
|
+
declare const MANAGE_SANDBOXES_PARAMETERS: {
|
|
513
|
+
readonly type: "object";
|
|
514
|
+
readonly additionalProperties: false;
|
|
515
|
+
readonly required: readonly ["action"];
|
|
516
|
+
readonly properties: {
|
|
517
|
+
readonly action: {
|
|
518
|
+
readonly type: "string";
|
|
519
|
+
readonly enum: readonly ["capabilities", "create", "createWithCoordinator", "list", "delete", "attachMachine", "detachMachine", "manifest", "usage", "trace", "intelligence", "cost", "createWorkspaceSnapshot", "restoreWorkspaceSnapshot", "reconcileWorkspace"];
|
|
520
|
+
};
|
|
521
|
+
readonly fleetId: {
|
|
522
|
+
type: string;
|
|
523
|
+
pattern: string;
|
|
524
|
+
};
|
|
525
|
+
readonly machineId: {
|
|
526
|
+
type: string;
|
|
527
|
+
pattern: string;
|
|
528
|
+
};
|
|
529
|
+
readonly snapshotId: {
|
|
530
|
+
readonly type: "string";
|
|
531
|
+
readonly minLength: 1;
|
|
532
|
+
};
|
|
533
|
+
readonly options: {
|
|
534
|
+
readonly type: "object";
|
|
535
|
+
};
|
|
536
|
+
readonly machine: {
|
|
537
|
+
readonly type: "object";
|
|
538
|
+
readonly required: readonly ["machineId", "sandboxId"];
|
|
539
|
+
readonly additionalProperties: true;
|
|
540
|
+
readonly properties: {
|
|
541
|
+
readonly machineId: {
|
|
542
|
+
type: string;
|
|
543
|
+
pattern: string;
|
|
544
|
+
};
|
|
545
|
+
readonly sandboxId: {
|
|
546
|
+
readonly type: "string";
|
|
547
|
+
readonly minLength: 1;
|
|
548
|
+
readonly maxLength: 128;
|
|
549
|
+
};
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
};
|
|
553
|
+
};
|
|
554
|
+
//#endregion
|
|
555
|
+
export { type AcceleratorKind, type AccessPolicyRule, type AddUserOptions, type AgentProfile, type AgentProfileCapabilities, type AgentProfileFileMount, type AgentProfileMcpServer, type AgentProfileModelHints, type AgentProfilePermissionValue, type AgentProfilePrompt, type AgentProfileResourceRef, type AgentProfileResources, type AgentProfileValidationIssue, type AgentProfileValidationResult, type AgentSubagentProfile, type AnyTokenPayload, type AttachSandboxFleetMachineOptions, AuthError, type AutomationInfo, type BackendCapabilities, type BackendConfig, type BackendInfo, type BackendManager, type BackendStatus, type BackendType, type BatchEvent, type BatchOptions, type BatchResult, type BatchTask, type BatchTaskResult, type BuildProgressEvent, type BuildSandboxMcpConfigOptions, CapabilityError, type CheckpointInfo, type CheckpointOptions, type CheckpointResult, type CodeResult, type CollaborationAccess, type CollaborationBootstrapRequest, type CollaborationBootstrapResponse, CollaborationClient, type CollaborationClientConfig, type CollaborationDocumentAdapter, type CollaborationDocumentChange, type CollaborationDocumentRef, CollaborationFileBridge, type CollaborationFileBridgeOptions, type CollaborationFileEvent, type CollaborationPermissions, type CollaborationTokenPayload, type CollaborationTokenRefreshRequest, type CollaborationTokenRefreshResponse, type CollaborationTransportConfig, type ConfidentialSandboxResult, type ConfidentialTeeType, type ConnectionInfo, type CreateAutomationInput, type CreateConfidentialSandboxOptions, type CreateEndpointInput, type CreateSandboxFleetOptions, type CreateSandboxFleetWithCoordinatorOptions, type CreateSandboxOptions, type CreateTeamOptions, type CreateTriggerInput, type DeleteOptions, type DeliveryAttempt, type DirectoryPermission, type DispatchPromptOptions, type DispatchedSession, type DownloadOptions, type DownloadProgress, type DriverConfig, type DriverInfo, type DriverType, type EndpointInfo, type EndpointWithSecret, type EventStreamOptions, type ExecOptions, type ExecResult, type FileInfo, type FileSystem, type FleetDispatchCancelResult, type FleetDispatchResultBuffer, type FleetDispatchResultBufferOptions, type FleetDispatchStreamOptions, type FleetExecDispatchOptions, type FleetMachineId, type FleetPromptDispatchOptions, type ForkOptions, type ForkResult, type GitAuth, type GitBranch, type GitCommit, type GitConfig, type GitDiff, type GitStatus, type GpuType, Image, type ImageBuildOptions, type ImageBuildResult, ImageBuilder, type ImageSpec, type InstallRecipeInput, type InstalledTool, type IntegrationAction, type IntegrationActionKind, type IntegrationActor, type IntegrationDeliveryStatus, type IntegrationManifest, type IntegrationPrincipalType, type IntegrationProvider, type IntegrationRequirement, type IntegrationScope, type IntegrationVerificationKind, IntegrationsManager, type RecipeManifest as IntegrationsRecipeManifest, type InviteTeamMemberOptions, type IssueCollaborationTokenOptions, type ListOptions, type ListSandboxFleetOptions, type ListSandboxOptions, MANAGE_SANDBOXES_PARAMETERS, MANAGE_SANDBOXES_TOOL_NAME, type ManageSandboxesInput, type ManageSandboxesTool, type ManageSandboxesToolOptions, type McpServerConfig, type MintScopedTokenOptions, type MkdirOptions, type NetworkConfig, NetworkError, type NetworkManager, NotFoundError, type ParseSSEStreamOptions, type ParsedSSEEvent, PartialFailureError, type PermissionLevel, type PermissionsManager, type PreviewLinkInfo, type PreviewLinkManager, type Process, type ProcessInfo, type ProcessLogEntry, type ProcessManager, type ProcessSignal, type ProcessSpawnOptions, type ProcessStatus, type PromptOptions, type PromptResult, type ProvisionEvent, type ProvisionResult, type ProvisionStatus, type ProvisionStep, type PublicTemplateInfo, type PublicTemplateVersionInfo, type PublishPublicTemplateOptions, type PublishPublicTemplateVersionOptions, QuotaError, type ReapExpiredSandboxFleetsOptions, type ReapExpiredSandboxFleetsResult, type ReconcileSandboxFleetsOptions, type ReconcileSandboxFleetsResult, type RunCodeOptions, SANDBOX_MCP_SERVER_NAME, type SSHCommandDescriptor, type SSHCredentials, SandboxClient as Sandbox, SandboxClient, type SandboxClientConfig, type SandboxConnection, type SandboxEnvironment, SandboxError, type SandboxErrorJson, type SandboxEvent, type SandboxFailureDetail, SandboxFleet, type SandboxFleetArtifact, type SandboxFleetArtifactSpec, SandboxFleetClient, type SandboxFleetCostEstimate, type SandboxFleetDispatchFailureClass, type SandboxFleetDispatchResponse, type SandboxFleetDriverCapability, type SandboxFleetDriverTimings, type SandboxFleetInfo, type SandboxFleetIntelligenceEnvelope, type SandboxFleetMachine, type SandboxFleetMachineMeteredUsage, type SandboxFleetMachineRecord, type SandboxFleetMachineSpec, type SandboxFleetManifest, type SandboxFleetManifestMachine, type SandboxFleetOperationsSummary, type SandboxFleetPolicy, type SandboxFleetToken, type SandboxFleetTraceBundle, type SandboxFleetTraceEvent, type SandboxFleetTraceExport, type SandboxFleetTraceOptions, type SandboxFleetUsage, type SandboxFleetWorkspace, type SandboxFleetWorkspaceReconcileResult, type SandboxFleetWorkspaceRestoreResult, type SandboxFleetWorkspaceSnapshotResult, type SandboxInfo, SandboxInstance, type SandboxIntelligenceEnvelope, type SandboxMcpConfig, type SandboxMcpEndpoint, type SandboxMcpServerEntry, type SandboxPermissionsConfig, type SandboxResources, SandboxSession, type SandboxStatus, type SandboxTraceBundle, type SandboxTraceEvent, type SandboxTraceExport, type SandboxTraceOptions, type SandboxUser, type SaveCollaborationSnapshotRequest, type SaveCollaborationSnapshotResponse, type ScopedToken, type ScopedTokenScope, type SearchMatch, type SearchOptions, type SecretInfo, type SecretsManager, ServerError, type SessionEventStreamOptions, type SessionInfo, type SessionListOptions, type SessionStatus, type SnapshotInfo, type SnapshotOptions, type SnapshotResult, StateError, type StorageConfig, type SubscriptionInfo, TangleSandboxClient, type TangleSandboxClientConfig, type TaskOptions, type TaskResult, type Team, type TeamInvitation, type TeamMember, type TeeAttestationHeartbeat, type TeeAttestationHeartbeatOptions, type TeeAttestationHeartbeatSample, type TeeAttestationOptions, type TeeAttestationReport, type TeeAttestationResponse, type TeePublicKey, type TeePublicKeyResponse, TimeoutError, type TokenRefreshHandler, type ToolsConfig, type TraceExportFormat, type TraceExportResult, type TraceExportSink, type TriggerInfo, type TriggerRun, type TriggerWithSecret, type UpdateUserOptions, type UploadOptions, type UploadProgress, type UsageInfo, ValidationError, type WaitForOptions, buildCollaborationDocumentId, buildSandboxMcpConfig, buildTraceExportPayload, createConfidentialSandbox, createManageSandboxesTool, defineAgentProfile, defineGitHubResource, defineInlineResource, exportTraceBundle, generateAttestationNonce, generateDockerfile, mergeAgentProfiles, normalizeCollaborationPath, otelTraceIdForTangleTrace, parseCollaborationDocumentId, parseSSEStream, startTeeAttestationHeartbeat, toOtelJson };
|