@langchain/deno 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { Sandbox } from "@deno/sandbox";
1
+ import { Memory, Region, Sandbox, SecretConfig, SnapshotId, SnapshotSlug, VolumeId, VolumeSlug } from "@deno/sandbox";
2
2
  import { BackendFactory, BaseSandbox, ExecuteResponse, FileDownloadResponse, FileUploadResponse, SandboxError, SandboxErrorCode } from "deepagents";
3
3
 
4
4
  //#region src/types.d.ts
@@ -9,23 +9,35 @@ import { BackendFactory, BaseSandbox, ExecuteResponse, FileDownloadResponse, Fil
9
9
  * - `ams`: Amsterdam
10
10
  * - `ord`: Chicago
11
11
  */
12
- type DenoSandboxRegion = "ams" | "ord";
12
+ type DenoSandboxRegion = Region;
13
13
  /**
14
14
  * Sandbox lifetime configuration.
15
15
  *
16
+ * @deprecated Use {@link SandboxTimeout} instead. This type will be removed in a future release.
17
+ *
16
18
  * - `"session"`: Sandbox shuts down when you close/dispose the client (default)
17
19
  * - Duration string: Keep sandbox alive for a specific time (e.g., "5m", "30s")
18
20
  */
19
21
  type SandboxLifetime = "session" | `${number}s` | `${number}m`;
22
+ /**
23
+ * Sandbox timeout configuration.
24
+ *
25
+ * - `"session"`: Sandbox shuts down when the primary client disconnects (default)
26
+ * - Duration string: Keep sandbox alive for a specific time (e.g., "600s", "20m")
27
+ *
28
+ * Note: when using a duration, the sandbox will be terminated after the specified
29
+ * time even if clients are still connected.
30
+ */
31
+ type SandboxTimeout = "session" | `${number}s` | `${number}m`;
20
32
  /**
21
33
  * Configuration options for creating a Deno Sandbox.
22
34
  *
23
35
  * @example
24
36
  * ```typescript
25
37
  * const options: DenoSandboxOptions = {
26
- * memoryMb: 1024, // 1GB memory
27
- * lifetime: "5m", // 5 minutes
28
- * region: "iad", // US East
38
+ * memory: "1GiB", // 1GB memory
39
+ * timeout: "5m", // 5 minutes
40
+ * region: "ord", // Chicago
29
41
  * };
30
42
  * ```
31
43
  */
@@ -33,6 +45,8 @@ interface DenoSandboxOptions {
33
45
  /**
34
46
  * Amount of memory allocated to the sandbox in megabytes.
35
47
  *
48
+ * @deprecated Use {@link DenoSandboxOptions.memory} instead. This option will be removed in a future release.
49
+ *
36
50
  * Memory limits:
37
51
  * - Minimum: 768MB
38
52
  * - Maximum: 4096MB
@@ -40,9 +54,24 @@ interface DenoSandboxOptions {
40
54
  * @default 768
41
55
  */
42
56
  memoryMb?: number;
57
+ /**
58
+ * The memory size of the sandbox. Supports plain numbers (interpreted as bytes)
59
+ * and human-readable strings with binary (GiB, MiB, KiB) or decimal (GB, MB, kB)
60
+ * units.
61
+ *
62
+ * Takes precedence over the deprecated `memoryMb` option.
63
+ *
64
+ * @example 1342177280
65
+ * @example "1GiB"
66
+ * @example "1280MiB"
67
+ * @default "1280MiB"
68
+ */
69
+ memory?: Memory;
43
70
  /**
44
71
  * Sandbox lifetime configuration.
45
72
  *
73
+ * @deprecated Use {@link DenoSandboxOptions.timeout} instead. This option will be removed in a future release.
74
+ *
46
75
  * - `"session"`: Sandbox shuts down when you close/dispose the client (default)
47
76
  * - Duration string: Keep sandbox alive for a specific time (e.g., "5m", "30s")
48
77
  *
@@ -51,6 +80,22 @@ interface DenoSandboxOptions {
51
80
  * @default "session"
52
81
  */
53
82
  lifetime?: SandboxLifetime;
83
+ /**
84
+ * The timeout of the sandbox. When not specified, it defaults to `"session"`.
85
+ *
86
+ * Takes precedence over the deprecated `lifetime` option.
87
+ *
88
+ * - `"session"`: Sandbox is destroyed when the primary client disconnects.
89
+ * - Duration string: Keep sandbox alive for a specific time (e.g., "600s", "20m").
90
+ * Note that when this duration has passed, the sandbox will be terminated even
91
+ * if there are still clients connected to it.
92
+ *
93
+ * @example "session"
94
+ * @example "600s"
95
+ * @example "20m"
96
+ * @default "session"
97
+ */
98
+ timeout?: SandboxTimeout;
54
99
  /**
55
100
  * Region where the sandbox will be created.
56
101
  *
@@ -69,7 +114,7 @@ interface DenoSandboxOptions {
69
114
  * @example
70
115
  * ```typescript
71
116
  * const options: DenoSandboxOptions = {
72
- * memoryMb: 1024,
117
+ * memory: "1GiB",
73
118
  * initialFiles: {
74
119
  * "/home/app/index.js": "console.log('Hello')",
75
120
  * "/home/app/package.json": '{"name": "test"}',
@@ -81,6 +126,9 @@ interface DenoSandboxOptions {
81
126
  /**
82
127
  * Authentication configuration for Deno Deploy API.
83
128
  *
129
+ * @deprecated Use the top-level {@link DenoSandboxOptions.token} and {@link DenoSandboxOptions.org} options instead.
130
+ * This option will be removed in a future release.
131
+ *
84
132
  * ### Environment Variable Setup
85
133
  *
86
134
  * ```bash
@@ -98,6 +146,148 @@ interface DenoSandboxOptions {
98
146
  */
99
147
  token?: string;
100
148
  };
149
+ /**
150
+ * The Deno Deploy access token that should be used to authenticate requests.
151
+ *
152
+ * - When passing an organization token (starts with `ddo_`), no further
153
+ * organization information is required.
154
+ * - When passing a personal token (starts with `ddp_`), the `org` option
155
+ * must also be provided.
156
+ *
157
+ * If not provided, the `DENO_DEPLOY_TOKEN` environment variable will be used.
158
+ *
159
+ * Takes precedence over the deprecated `auth.token` option.
160
+ */
161
+ token?: string;
162
+ /**
163
+ * The Deno Deploy organization slug to operate within.
164
+ *
165
+ * This is required when using a personal access token (starts with `ddp_`).
166
+ * If not provided, the `DENO_DEPLOY_ORG` environment variable will be used.
167
+ */
168
+ org?: string;
169
+ /**
170
+ * Environment variables to start the sandbox with, in addition to the default
171
+ * environment variables such as `DENO_DEPLOY_ORGANIZATION_ID`.
172
+ */
173
+ env?: Record<string, string>;
174
+ /**
175
+ * Whether to enable debug logging.
176
+ *
177
+ * @default false
178
+ */
179
+ debug?: boolean;
180
+ /**
181
+ * Labels to set on the sandbox. Up to 5 labels can be specified.
182
+ * Each label key must be at most 64 bytes, and each label value
183
+ * must be at most 128 bytes.
184
+ */
185
+ labels?: Record<string, string>;
186
+ /**
187
+ * A volume or snapshot to use as the root filesystem of the sandbox.
188
+ *
189
+ * If not specified, the default base image will be used. The volume or
190
+ * snapshot must be bootable.
191
+ *
192
+ * - Volumes will be mounted read-write (writes are persisted).
193
+ * - Snapshots will be mounted read-only (writes are not persisted).
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * const options: DenoSandboxOptions = {
198
+ * root: "my-volume-slug",
199
+ * };
200
+ * ```
201
+ */
202
+ root?: VolumeId | VolumeSlug | SnapshotId | SnapshotSlug;
203
+ /**
204
+ * Volumes to mount on the sandbox.
205
+ *
206
+ * The key is the mount path inside the sandbox, and the value is the
207
+ * volume ID or slug.
208
+ *
209
+ * @example
210
+ * ```typescript
211
+ * const options: DenoSandboxOptions = {
212
+ * volumes: {
213
+ * "/data/volume1": "volume-slug-or-id-1",
214
+ * },
215
+ * };
216
+ * ```
217
+ */
218
+ volumes?: Record<string, VolumeId | VolumeSlug>;
219
+ /**
220
+ * List of hostnames / IP addresses with optional port numbers that the
221
+ * sandbox can make outbound network requests to.
222
+ *
223
+ * If not specified, no network restrictions are applied.
224
+ *
225
+ * @example []
226
+ * @example ["example.com"]
227
+ * @example ["*.example.com"]
228
+ * @example ["example.com:443"]
229
+ */
230
+ allowNet?: string[];
231
+ /**
232
+ * Secret environment variables that are never exposed to sandbox code.
233
+ * The real secret values are injected on the wire when the sandbox makes
234
+ * HTTPS requests to the specified hosts.
235
+ *
236
+ * The key is the environment variable name.
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * const options: DenoSandboxOptions = {
241
+ * secrets: {
242
+ * OPENAI_API_KEY: {
243
+ * hosts: ["api.openai.com"],
244
+ * value: "sk-proj-your-real-key",
245
+ * },
246
+ * },
247
+ * };
248
+ * ```
249
+ */
250
+ secrets?: Record<string, SecretConfig>;
251
+ /**
252
+ * Whether to expose SSH access to the sandbox. If true, the sandbox's
253
+ * `ssh` property will be populated once the sandbox is ready.
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * const sandbox = await DenoSandbox.create({ ssh: true });
258
+ * console.log(sandbox.instance.ssh);
259
+ * // => { username: "...", hostname: "..." }
260
+ * ```
261
+ */
262
+ ssh?: boolean;
263
+ /**
264
+ * The port number to expose for HTTP access. If specified, the sandbox's
265
+ * `url` property will be populated once the sandbox is ready, and can
266
+ * be used to access the sandbox over HTTP.
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const sandbox = await DenoSandbox.create({ port: 8080 });
271
+ * console.log(sandbox.instance.url);
272
+ * // => "http://..."
273
+ * ```
274
+ */
275
+ port?: number;
276
+ /**
277
+ * Override the Sandbox API endpoint URL to use to create and communicate
278
+ * with the sandboxes.
279
+ *
280
+ * The default can also be overridden by setting the `DENO_SANDBOX_ENDPOINT`
281
+ * or `DENO_SANDBOX_BASE_DOMAIN` environment variables.
282
+ */
283
+ sandboxEndpoint?: string | ((region: string) => string);
284
+ /**
285
+ * Override the API endpoint to use to connect to Deno Deploy.
286
+ *
287
+ * The default can also be overridden by setting the `DENO_DEPLOY_ENDPOINT`
288
+ * environment variable.
289
+ */
290
+ apiEndpoint?: string;
101
291
  }
102
292
  /**
103
293
  * Error codes for Deno Sandbox operations.
@@ -171,8 +361,8 @@ declare class DenoSandboxError extends SandboxError {
171
361
  *
172
362
  * // Create and initialize a sandbox
173
363
  * const sandbox = await DenoSandbox.create({
174
- * memoryMb: 1024,
175
- * lifetime: "5m",
364
+ * memory: "1GiB",
365
+ * timeout: "5m",
176
366
  * });
177
367
  *
178
368
  * try {
@@ -236,11 +426,11 @@ declare class DenoSandbox extends BaseSandbox {
236
426
  * @example
237
427
  * ```typescript
238
428
  * // Two-step initialization
239
- * const sandbox = new DenoSandbox({ memoryMb: 1024 });
429
+ * const sandbox = new DenoSandbox({ memory: "1GiB" });
240
430
  * await sandbox.initialize();
241
431
  *
242
432
  * // Or use the factory method
243
- * const sandbox = await DenoSandbox.create({ memoryMb: 1024 });
433
+ * const sandbox = await DenoSandbox.create({ memory: "1GiB" });
244
434
  * ```
245
435
  */
246
436
  constructor(options?: DenoSandboxOptions);
@@ -365,9 +555,9 @@ declare class DenoSandbox extends BaseSandbox {
365
555
  * @example
366
556
  * ```typescript
367
557
  * const sandbox = await DenoSandbox.create({
368
- * memoryMb: 1024,
369
- * lifetime: "10m",
370
- * region: "iad",
558
+ * memory: "1GiB",
559
+ * timeout: "10m",
560
+ * region: "ord",
371
561
  * });
372
562
  * ```
373
563
  */
@@ -389,7 +579,7 @@ declare class DenoSandbox extends BaseSandbox {
389
579
  * const result = await sandbox.execute("ls -la");
390
580
  * ```
391
581
  */
392
- static fromId(id: string, options?: Pick<DenoSandboxOptions, "auth">): Promise<DenoSandbox>;
582
+ static fromId(id: string, options?: Pick<DenoSandboxOptions, "auth" | "token" | "org" | "apiEndpoint">): Promise<DenoSandbox>;
393
583
  }
394
584
  /**
395
585
  * Async factory function type for creating Deno Sandbox instances.
@@ -417,7 +607,7 @@ type AsyncDenoSandboxFactory = () => Promise<DenoSandbox>;
417
607
  * import { DenoSandbox, createDenoSandboxFactory } from "@langchain/deno";
418
608
  *
419
609
  * // Create a factory for new sandboxes
420
- * const factory = createDenoSandboxFactory({ memoryMb: 1024 });
610
+ * const factory = createDenoSandboxFactory({ memory: "1GiB" });
421
611
  *
422
612
  * // Each call creates a new sandbox
423
613
  * const sandbox1 = await factory();
@@ -450,7 +640,7 @@ declare function createDenoSandboxFactory(options?: DenoSandboxOptions): AsyncDe
450
640
  * import { DenoSandbox, createDenoSandboxFactoryFromSandbox } from "@langchain/deno";
451
641
  *
452
642
  * // Create and initialize a sandbox
453
- * const sandbox = await DenoSandbox.create({ memoryMb: 1024 });
643
+ * const sandbox = await DenoSandbox.create({ memory: "1GiB" });
454
644
  *
455
645
  * try {
456
646
  * const agent = createDeepAgent({
@@ -499,7 +689,7 @@ interface DenoCredentials {
499
689
  *
500
690
  * @param options - Optional authentication configuration from DenoSandboxOptions
501
691
  * @returns The authentication token string
502
- * @throws {Error} If no authentication token is available
692
+ * @throws {DenoSandboxError} If no authentication token is available
503
693
  *
504
694
  * @example
505
695
  * ```typescript
@@ -524,9 +714,9 @@ declare function getAuthToken(options?: DenoSandboxOptions["auth"]): string;
524
714
  *
525
715
  * @param options - Optional authentication configuration from DenoSandboxOptions
526
716
  * @returns Complete authentication credentials
527
- * @throws {Error} If no authentication token is available
717
+ * @throws {DenoSandboxError} If no authentication token is available
528
718
  */
529
719
  declare function getAuthCredentials(options?: DenoSandboxOptions["auth"]): DenoCredentials;
530
720
  //#endregion
531
- export { type AsyncDenoSandboxFactory, type DenoCredentials, DenoSandbox, DenoSandboxError, type DenoSandboxErrorCode, type DenoSandboxOptions, type DenoSandboxRegion, type SandboxLifetime, createDenoSandboxFactory, createDenoSandboxFactoryFromSandbox, getAuthCredentials, getAuthToken };
721
+ export { type AsyncDenoSandboxFactory, type DenoCredentials, DenoSandbox, DenoSandboxError, type DenoSandboxErrorCode, type DenoSandboxOptions, type DenoSandboxRegion, type SandboxLifetime, type SandboxTimeout, createDenoSandboxFactory, createDenoSandboxFactoryFromSandbox, getAuthCredentials, getAuthToken };
532
722
  //# sourceMappingURL=index.d.cts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Sandbox } from "@deno/sandbox";
1
+ import { Memory, Region, Sandbox, SecretConfig, SnapshotId, SnapshotSlug, VolumeId, VolumeSlug } from "@deno/sandbox";
2
2
  import { BackendFactory, BaseSandbox, ExecuteResponse, FileDownloadResponse, FileUploadResponse, SandboxError, SandboxErrorCode } from "deepagents";
3
3
 
4
4
  //#region src/types.d.ts
@@ -9,23 +9,35 @@ import { BackendFactory, BaseSandbox, ExecuteResponse, FileDownloadResponse, Fil
9
9
  * - `ams`: Amsterdam
10
10
  * - `ord`: Chicago
11
11
  */
12
- type DenoSandboxRegion = "ams" | "ord";
12
+ type DenoSandboxRegion = Region;
13
13
  /**
14
14
  * Sandbox lifetime configuration.
15
15
  *
16
+ * @deprecated Use {@link SandboxTimeout} instead. This type will be removed in a future release.
17
+ *
16
18
  * - `"session"`: Sandbox shuts down when you close/dispose the client (default)
17
19
  * - Duration string: Keep sandbox alive for a specific time (e.g., "5m", "30s")
18
20
  */
19
21
  type SandboxLifetime = "session" | `${number}s` | `${number}m`;
22
+ /**
23
+ * Sandbox timeout configuration.
24
+ *
25
+ * - `"session"`: Sandbox shuts down when the primary client disconnects (default)
26
+ * - Duration string: Keep sandbox alive for a specific time (e.g., "600s", "20m")
27
+ *
28
+ * Note: when using a duration, the sandbox will be terminated after the specified
29
+ * time even if clients are still connected.
30
+ */
31
+ type SandboxTimeout = "session" | `${number}s` | `${number}m`;
20
32
  /**
21
33
  * Configuration options for creating a Deno Sandbox.
22
34
  *
23
35
  * @example
24
36
  * ```typescript
25
37
  * const options: DenoSandboxOptions = {
26
- * memoryMb: 1024, // 1GB memory
27
- * lifetime: "5m", // 5 minutes
28
- * region: "iad", // US East
38
+ * memory: "1GiB", // 1GB memory
39
+ * timeout: "5m", // 5 minutes
40
+ * region: "ord", // Chicago
29
41
  * };
30
42
  * ```
31
43
  */
@@ -33,6 +45,8 @@ interface DenoSandboxOptions {
33
45
  /**
34
46
  * Amount of memory allocated to the sandbox in megabytes.
35
47
  *
48
+ * @deprecated Use {@link DenoSandboxOptions.memory} instead. This option will be removed in a future release.
49
+ *
36
50
  * Memory limits:
37
51
  * - Minimum: 768MB
38
52
  * - Maximum: 4096MB
@@ -40,9 +54,24 @@ interface DenoSandboxOptions {
40
54
  * @default 768
41
55
  */
42
56
  memoryMb?: number;
57
+ /**
58
+ * The memory size of the sandbox. Supports plain numbers (interpreted as bytes)
59
+ * and human-readable strings with binary (GiB, MiB, KiB) or decimal (GB, MB, kB)
60
+ * units.
61
+ *
62
+ * Takes precedence over the deprecated `memoryMb` option.
63
+ *
64
+ * @example 1342177280
65
+ * @example "1GiB"
66
+ * @example "1280MiB"
67
+ * @default "1280MiB"
68
+ */
69
+ memory?: Memory;
43
70
  /**
44
71
  * Sandbox lifetime configuration.
45
72
  *
73
+ * @deprecated Use {@link DenoSandboxOptions.timeout} instead. This option will be removed in a future release.
74
+ *
46
75
  * - `"session"`: Sandbox shuts down when you close/dispose the client (default)
47
76
  * - Duration string: Keep sandbox alive for a specific time (e.g., "5m", "30s")
48
77
  *
@@ -51,6 +80,22 @@ interface DenoSandboxOptions {
51
80
  * @default "session"
52
81
  */
53
82
  lifetime?: SandboxLifetime;
83
+ /**
84
+ * The timeout of the sandbox. When not specified, it defaults to `"session"`.
85
+ *
86
+ * Takes precedence over the deprecated `lifetime` option.
87
+ *
88
+ * - `"session"`: Sandbox is destroyed when the primary client disconnects.
89
+ * - Duration string: Keep sandbox alive for a specific time (e.g., "600s", "20m").
90
+ * Note that when this duration has passed, the sandbox will be terminated even
91
+ * if there are still clients connected to it.
92
+ *
93
+ * @example "session"
94
+ * @example "600s"
95
+ * @example "20m"
96
+ * @default "session"
97
+ */
98
+ timeout?: SandboxTimeout;
54
99
  /**
55
100
  * Region where the sandbox will be created.
56
101
  *
@@ -69,7 +114,7 @@ interface DenoSandboxOptions {
69
114
  * @example
70
115
  * ```typescript
71
116
  * const options: DenoSandboxOptions = {
72
- * memoryMb: 1024,
117
+ * memory: "1GiB",
73
118
  * initialFiles: {
74
119
  * "/home/app/index.js": "console.log('Hello')",
75
120
  * "/home/app/package.json": '{"name": "test"}',
@@ -81,6 +126,9 @@ interface DenoSandboxOptions {
81
126
  /**
82
127
  * Authentication configuration for Deno Deploy API.
83
128
  *
129
+ * @deprecated Use the top-level {@link DenoSandboxOptions.token} and {@link DenoSandboxOptions.org} options instead.
130
+ * This option will be removed in a future release.
131
+ *
84
132
  * ### Environment Variable Setup
85
133
  *
86
134
  * ```bash
@@ -98,6 +146,148 @@ interface DenoSandboxOptions {
98
146
  */
99
147
  token?: string;
100
148
  };
149
+ /**
150
+ * The Deno Deploy access token that should be used to authenticate requests.
151
+ *
152
+ * - When passing an organization token (starts with `ddo_`), no further
153
+ * organization information is required.
154
+ * - When passing a personal token (starts with `ddp_`), the `org` option
155
+ * must also be provided.
156
+ *
157
+ * If not provided, the `DENO_DEPLOY_TOKEN` environment variable will be used.
158
+ *
159
+ * Takes precedence over the deprecated `auth.token` option.
160
+ */
161
+ token?: string;
162
+ /**
163
+ * The Deno Deploy organization slug to operate within.
164
+ *
165
+ * This is required when using a personal access token (starts with `ddp_`).
166
+ * If not provided, the `DENO_DEPLOY_ORG` environment variable will be used.
167
+ */
168
+ org?: string;
169
+ /**
170
+ * Environment variables to start the sandbox with, in addition to the default
171
+ * environment variables such as `DENO_DEPLOY_ORGANIZATION_ID`.
172
+ */
173
+ env?: Record<string, string>;
174
+ /**
175
+ * Whether to enable debug logging.
176
+ *
177
+ * @default false
178
+ */
179
+ debug?: boolean;
180
+ /**
181
+ * Labels to set on the sandbox. Up to 5 labels can be specified.
182
+ * Each label key must be at most 64 bytes, and each label value
183
+ * must be at most 128 bytes.
184
+ */
185
+ labels?: Record<string, string>;
186
+ /**
187
+ * A volume or snapshot to use as the root filesystem of the sandbox.
188
+ *
189
+ * If not specified, the default base image will be used. The volume or
190
+ * snapshot must be bootable.
191
+ *
192
+ * - Volumes will be mounted read-write (writes are persisted).
193
+ * - Snapshots will be mounted read-only (writes are not persisted).
194
+ *
195
+ * @example
196
+ * ```typescript
197
+ * const options: DenoSandboxOptions = {
198
+ * root: "my-volume-slug",
199
+ * };
200
+ * ```
201
+ */
202
+ root?: VolumeId | VolumeSlug | SnapshotId | SnapshotSlug;
203
+ /**
204
+ * Volumes to mount on the sandbox.
205
+ *
206
+ * The key is the mount path inside the sandbox, and the value is the
207
+ * volume ID or slug.
208
+ *
209
+ * @example
210
+ * ```typescript
211
+ * const options: DenoSandboxOptions = {
212
+ * volumes: {
213
+ * "/data/volume1": "volume-slug-or-id-1",
214
+ * },
215
+ * };
216
+ * ```
217
+ */
218
+ volumes?: Record<string, VolumeId | VolumeSlug>;
219
+ /**
220
+ * List of hostnames / IP addresses with optional port numbers that the
221
+ * sandbox can make outbound network requests to.
222
+ *
223
+ * If not specified, no network restrictions are applied.
224
+ *
225
+ * @example []
226
+ * @example ["example.com"]
227
+ * @example ["*.example.com"]
228
+ * @example ["example.com:443"]
229
+ */
230
+ allowNet?: string[];
231
+ /**
232
+ * Secret environment variables that are never exposed to sandbox code.
233
+ * The real secret values are injected on the wire when the sandbox makes
234
+ * HTTPS requests to the specified hosts.
235
+ *
236
+ * The key is the environment variable name.
237
+ *
238
+ * @example
239
+ * ```typescript
240
+ * const options: DenoSandboxOptions = {
241
+ * secrets: {
242
+ * OPENAI_API_KEY: {
243
+ * hosts: ["api.openai.com"],
244
+ * value: "sk-proj-your-real-key",
245
+ * },
246
+ * },
247
+ * };
248
+ * ```
249
+ */
250
+ secrets?: Record<string, SecretConfig>;
251
+ /**
252
+ * Whether to expose SSH access to the sandbox. If true, the sandbox's
253
+ * `ssh` property will be populated once the sandbox is ready.
254
+ *
255
+ * @example
256
+ * ```typescript
257
+ * const sandbox = await DenoSandbox.create({ ssh: true });
258
+ * console.log(sandbox.instance.ssh);
259
+ * // => { username: "...", hostname: "..." }
260
+ * ```
261
+ */
262
+ ssh?: boolean;
263
+ /**
264
+ * The port number to expose for HTTP access. If specified, the sandbox's
265
+ * `url` property will be populated once the sandbox is ready, and can
266
+ * be used to access the sandbox over HTTP.
267
+ *
268
+ * @example
269
+ * ```typescript
270
+ * const sandbox = await DenoSandbox.create({ port: 8080 });
271
+ * console.log(sandbox.instance.url);
272
+ * // => "http://..."
273
+ * ```
274
+ */
275
+ port?: number;
276
+ /**
277
+ * Override the Sandbox API endpoint URL to use to create and communicate
278
+ * with the sandboxes.
279
+ *
280
+ * The default can also be overridden by setting the `DENO_SANDBOX_ENDPOINT`
281
+ * or `DENO_SANDBOX_BASE_DOMAIN` environment variables.
282
+ */
283
+ sandboxEndpoint?: string | ((region: string) => string);
284
+ /**
285
+ * Override the API endpoint to use to connect to Deno Deploy.
286
+ *
287
+ * The default can also be overridden by setting the `DENO_DEPLOY_ENDPOINT`
288
+ * environment variable.
289
+ */
290
+ apiEndpoint?: string;
101
291
  }
102
292
  /**
103
293
  * Error codes for Deno Sandbox operations.
@@ -171,8 +361,8 @@ declare class DenoSandboxError extends SandboxError {
171
361
  *
172
362
  * // Create and initialize a sandbox
173
363
  * const sandbox = await DenoSandbox.create({
174
- * memoryMb: 1024,
175
- * lifetime: "5m",
364
+ * memory: "1GiB",
365
+ * timeout: "5m",
176
366
  * });
177
367
  *
178
368
  * try {
@@ -236,11 +426,11 @@ declare class DenoSandbox extends BaseSandbox {
236
426
  * @example
237
427
  * ```typescript
238
428
  * // Two-step initialization
239
- * const sandbox = new DenoSandbox({ memoryMb: 1024 });
429
+ * const sandbox = new DenoSandbox({ memory: "1GiB" });
240
430
  * await sandbox.initialize();
241
431
  *
242
432
  * // Or use the factory method
243
- * const sandbox = await DenoSandbox.create({ memoryMb: 1024 });
433
+ * const sandbox = await DenoSandbox.create({ memory: "1GiB" });
244
434
  * ```
245
435
  */
246
436
  constructor(options?: DenoSandboxOptions);
@@ -365,9 +555,9 @@ declare class DenoSandbox extends BaseSandbox {
365
555
  * @example
366
556
  * ```typescript
367
557
  * const sandbox = await DenoSandbox.create({
368
- * memoryMb: 1024,
369
- * lifetime: "10m",
370
- * region: "iad",
558
+ * memory: "1GiB",
559
+ * timeout: "10m",
560
+ * region: "ord",
371
561
  * });
372
562
  * ```
373
563
  */
@@ -389,7 +579,7 @@ declare class DenoSandbox extends BaseSandbox {
389
579
  * const result = await sandbox.execute("ls -la");
390
580
  * ```
391
581
  */
392
- static fromId(id: string, options?: Pick<DenoSandboxOptions, "auth">): Promise<DenoSandbox>;
582
+ static fromId(id: string, options?: Pick<DenoSandboxOptions, "auth" | "token" | "org" | "apiEndpoint">): Promise<DenoSandbox>;
393
583
  }
394
584
  /**
395
585
  * Async factory function type for creating Deno Sandbox instances.
@@ -417,7 +607,7 @@ type AsyncDenoSandboxFactory = () => Promise<DenoSandbox>;
417
607
  * import { DenoSandbox, createDenoSandboxFactory } from "@langchain/deno";
418
608
  *
419
609
  * // Create a factory for new sandboxes
420
- * const factory = createDenoSandboxFactory({ memoryMb: 1024 });
610
+ * const factory = createDenoSandboxFactory({ memory: "1GiB" });
421
611
  *
422
612
  * // Each call creates a new sandbox
423
613
  * const sandbox1 = await factory();
@@ -450,7 +640,7 @@ declare function createDenoSandboxFactory(options?: DenoSandboxOptions): AsyncDe
450
640
  * import { DenoSandbox, createDenoSandboxFactoryFromSandbox } from "@langchain/deno";
451
641
  *
452
642
  * // Create and initialize a sandbox
453
- * const sandbox = await DenoSandbox.create({ memoryMb: 1024 });
643
+ * const sandbox = await DenoSandbox.create({ memory: "1GiB" });
454
644
  *
455
645
  * try {
456
646
  * const agent = createDeepAgent({
@@ -499,7 +689,7 @@ interface DenoCredentials {
499
689
  *
500
690
  * @param options - Optional authentication configuration from DenoSandboxOptions
501
691
  * @returns The authentication token string
502
- * @throws {Error} If no authentication token is available
692
+ * @throws {DenoSandboxError} If no authentication token is available
503
693
  *
504
694
  * @example
505
695
  * ```typescript
@@ -524,9 +714,9 @@ declare function getAuthToken(options?: DenoSandboxOptions["auth"]): string;
524
714
  *
525
715
  * @param options - Optional authentication configuration from DenoSandboxOptions
526
716
  * @returns Complete authentication credentials
527
- * @throws {Error} If no authentication token is available
717
+ * @throws {DenoSandboxError} If no authentication token is available
528
718
  */
529
719
  declare function getAuthCredentials(options?: DenoSandboxOptions["auth"]): DenoCredentials;
530
720
  //#endregion
531
- export { type AsyncDenoSandboxFactory, type DenoCredentials, DenoSandbox, DenoSandboxError, type DenoSandboxErrorCode, type DenoSandboxOptions, type DenoSandboxRegion, type SandboxLifetime, createDenoSandboxFactory, createDenoSandboxFactoryFromSandbox, getAuthCredentials, getAuthToken };
721
+ export { type AsyncDenoSandboxFactory, type DenoCredentials, DenoSandbox, DenoSandboxError, type DenoSandboxErrorCode, type DenoSandboxOptions, type DenoSandboxRegion, type SandboxLifetime, type SandboxTimeout, createDenoSandboxFactory, createDenoSandboxFactoryFromSandbox, getAuthCredentials, getAuthToken };
532
722
  //# sourceMappingURL=index.d.ts.map