langsmith 0.5.19 → 0.6.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/client.cjs +460 -22
- package/dist/client.d.ts +165 -1
- package/dist/client.js +464 -26
- package/dist/evaluation/_runner.cjs +4 -7
- package/dist/evaluation/_runner.js +2 -5
- package/dist/evaluation/evaluate_comparative.cjs +10 -10
- package/dist/evaluation/evaluate_comparative.js +1 -1
- package/dist/evaluation/evaluator.cjs +2 -2
- package/dist/evaluation/evaluator.js +1 -1
- package/dist/experimental/anthropic/context.cjs +419 -49
- package/dist/experimental/anthropic/context.js +420 -50
- package/dist/experimental/anthropic/index.cjs +78 -10
- package/dist/experimental/anthropic/index.js +80 -12
- package/dist/experimental/anthropic/messages.cjs +53 -0
- package/dist/experimental/anthropic/messages.d.ts +6 -0
- package/dist/experimental/anthropic/messages.js +52 -0
- package/dist/experimental/anthropic/transcripts.cjs +144 -0
- package/dist/experimental/anthropic/transcripts.d.ts +22 -0
- package/dist/experimental/anthropic/transcripts.js +141 -0
- package/dist/experimental/anthropic/types.d.ts +1 -0
- package/dist/experimental/anthropic/usage.cjs +19 -20
- package/dist/experimental/anthropic/usage.d.ts +2 -1
- package/dist/experimental/anthropic/usage.js +18 -20
- package/dist/experimental/opencode/index.cjs +36 -0
- package/dist/experimental/opencode/index.d.ts +3 -0
- package/dist/experimental/opencode/index.js +32 -0
- package/dist/experimental/opencode/tracer.cjs +389 -0
- package/dist/experimental/opencode/tracer.d.ts +30 -0
- package/dist/experimental/opencode/tracer.js +385 -0
- package/dist/experimental/otel/setup.cjs +1 -1
- package/dist/experimental/otel/setup.js +1 -1
- package/dist/experimental/sandbox/client.cjs +308 -409
- package/dist/experimental/sandbox/client.d.ts +136 -157
- package/dist/experimental/sandbox/client.js +310 -411
- package/dist/experimental/sandbox/errors.cjs +1 -2
- package/dist/experimental/sandbox/errors.d.ts +1 -2
- package/dist/experimental/sandbox/errors.js +1 -2
- package/dist/experimental/sandbox/helpers.cjs +8 -98
- package/dist/experimental/sandbox/helpers.d.ts +0 -29
- package/dist/experimental/sandbox/helpers.js +9 -95
- package/dist/experimental/sandbox/index.cjs +6 -1
- package/dist/experimental/sandbox/index.d.ts +7 -2
- package/dist/experimental/sandbox/index.js +6 -1
- package/dist/experimental/sandbox/sandbox.cjs +71 -13
- package/dist/experimental/sandbox/sandbox.d.ts +39 -9
- package/dist/experimental/sandbox/sandbox.js +71 -13
- package/dist/experimental/sandbox/types.d.ts +147 -137
- package/dist/experimental/vercel/index.cjs +1 -1
- package/dist/experimental/vercel/index.js +1 -1
- package/dist/experimental/vercel/middleware.cjs +2 -1
- package/dist/experimental/vercel/middleware.js +2 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/run_trees.cjs +8 -7
- package/dist/run_trees.d.ts +7 -0
- package/dist/run_trees.js +7 -6
- package/dist/schemas.d.ts +58 -0
- package/dist/singletons/otel.cjs +3 -2
- package/dist/singletons/otel.js +4 -3
- package/dist/singletons/traceable.cjs +1 -3
- package/dist/singletons/traceable.js +1 -3
- package/dist/traceable.cjs +2 -5
- package/dist/traceable.js +2 -5
- package/dist/utils/_git.cjs +2 -2
- package/dist/utils/_git.js +2 -2
- package/dist/utils/_uuid.cjs +2 -2
- package/dist/utils/_uuid.js +1 -1
- package/dist/utils/env.cjs +35 -2
- package/dist/utils/env.d.ts +9 -0
- package/dist/utils/env.js +34 -2
- package/dist/utils/error.cjs +9 -2
- package/dist/utils/error.d.ts +1 -0
- package/dist/utils/error.js +8 -2
- package/dist/utils/fast-safe-stringify/index.cjs +203 -0
- package/dist/utils/fast-safe-stringify/index.d.ts +46 -0
- package/dist/utils/fast-safe-stringify/index.js +202 -0
- package/dist/utils/jestlike/index.cjs +5 -5
- package/dist/utils/jestlike/index.js +1 -1
- package/dist/utils/jestlike/reporter.cjs +1 -1
- package/dist/utils/jestlike/reporter.js +1 -1
- package/dist/utils/jestlike/vendor/chain.cjs +2 -3
- package/dist/utils/jestlike/vendor/chain.js +2 -3
- package/dist/utils/jestlike/vendor/evaluatedBy.cjs +3 -3
- package/dist/utils/jestlike/vendor/evaluatedBy.js +1 -1
- package/dist/utils/prompts.cjs +7 -2
- package/dist/utils/prompts.d.ts +6 -1
- package/dist/utils/prompts.js +6 -1
- package/dist/utils/serialize_worker.cjs +388 -0
- package/dist/utils/serialize_worker.d.ts +66 -0
- package/dist/utils/serialize_worker.js +382 -0
- package/dist/utils/uuid/src/index.cjs +24 -0
- package/dist/utils/uuid/src/index.d.ts +10 -0
- package/dist/utils/uuid/src/index.js +9 -0
- package/dist/utils/uuid/src/max.cjs +3 -0
- package/dist/utils/uuid/src/max.d.ts +2 -0
- package/dist/utils/uuid/src/max.js +1 -0
- package/dist/utils/uuid/src/nil.cjs +3 -0
- package/dist/utils/uuid/src/nil.d.ts +2 -0
- package/dist/utils/uuid/src/nil.js +1 -0
- package/dist/utils/uuid/src/parse.cjs +23 -0
- package/dist/utils/uuid/src/parse.d.ts +3 -0
- package/dist/utils/uuid/src/parse.js +18 -0
- package/dist/utils/uuid/src/regex.cjs +3 -0
- package/dist/utils/uuid/src/regex.d.ts +2 -0
- package/dist/utils/uuid/src/regex.js +1 -0
- package/dist/utils/uuid/src/rng.cjs +10 -0
- package/dist/utils/uuid/src/rng.d.ts +1 -0
- package/dist/utils/uuid/src/rng.js +7 -0
- package/dist/utils/uuid/src/sha1.cjs +75 -0
- package/dist/utils/uuid/src/sha1.d.ts +2 -0
- package/dist/utils/uuid/src/sha1.js +73 -0
- package/dist/utils/uuid/src/stringify.cjs +55 -0
- package/dist/utils/uuid/src/stringify.d.ts +3 -0
- package/dist/utils/uuid/src/stringify.js +49 -0
- package/dist/utils/uuid/src/types.cjs +2 -0
- package/dist/utils/uuid/src/types.d.ts +22 -0
- package/dist/utils/uuid/src/types.js +1 -0
- package/dist/utils/uuid/src/v35.cjs +52 -0
- package/dist/utils/uuid/src/v35.d.ts +7 -0
- package/dist/utils/uuid/src/v35.js +44 -0
- package/dist/utils/uuid/src/v4.cjs +40 -0
- package/dist/utils/uuid/src/v4.d.ts +4 -0
- package/dist/utils/uuid/src/v4.js +35 -0
- package/dist/utils/uuid/src/v5.cjs +50 -0
- package/dist/utils/uuid/src/v5.d.ts +9 -0
- package/dist/utils/uuid/src/v5.js +9 -0
- package/dist/utils/uuid/src/v7.cjs +88 -0
- package/dist/utils/uuid/src/v7.d.ts +9 -0
- package/dist/utils/uuid/src/v7.js +82 -0
- package/dist/utils/uuid/src/validate.cjs +10 -0
- package/dist/utils/uuid/src/validate.d.ts +2 -0
- package/dist/utils/uuid/src/validate.js +5 -0
- package/dist/utils/uuid/src/version.cjs +13 -0
- package/dist/utils/uuid/src/version.d.ts +2 -0
- package/dist/utils/uuid/src/version.js +8 -0
- package/dist/utils/worker_threads.browser.cjs +16 -0
- package/dist/utils/worker_threads.browser.d.ts +14 -0
- package/dist/utils/worker_threads.browser.js +13 -0
- package/dist/utils/worker_threads.cjs +16 -0
- package/dist/utils/worker_threads.d.ts +13 -0
- package/dist/utils/worker_threads.js +13 -0
- package/dist/uuid.cjs +2 -2
- package/dist/uuid.js +1 -1
- package/dist/vitest/utils/esm.mjs +4 -4
- package/dist/wrappers/gemini.cjs +1 -1
- package/dist/wrappers/gemini.js +1 -1
- package/dist/wrappers/openai.cjs +2 -6
- package/dist/wrappers/openai.js +2 -6
- package/dist/wrappers/openai_agents.cjs +849 -0
- package/dist/wrappers/openai_agents.d.ts +92 -0
- package/dist/wrappers/openai_agents.js +845 -0
- package/experimental/opencode.cjs +1 -0
- package/experimental/opencode.d.cts +1 -0
- package/experimental/opencode.d.ts +1 -0
- package/experimental/opencode.js +1 -0
- package/package.json +47 -25
- package/wrappers/openai_agents.cjs +1 -0
- package/wrappers/openai_agents.d.cts +1 -0
- package/wrappers/openai_agents.d.ts +1 -0
- package/wrappers/openai_agents.js +1 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Sandbox class for interacting with a specific sandbox instance.
|
|
3
3
|
*/
|
|
4
|
-
import type { ExecutionResult, RunOptions } from "./types.js";
|
|
4
|
+
import type { CaptureSnapshotOptions, ExecutionResult, RunOptions, Snapshot, StartSandboxOptions } from "./types.js";
|
|
5
5
|
import { CommandHandle } from "./command_handle.js";
|
|
6
6
|
/**
|
|
7
7
|
* Represents an active sandbox for running commands and file operations.
|
|
@@ -12,7 +12,7 @@ import { CommandHandle } from "./command_handle.js";
|
|
|
12
12
|
*
|
|
13
13
|
* @example
|
|
14
14
|
* ```typescript
|
|
15
|
-
* const sandbox = await client.createSandbox(
|
|
15
|
+
* const sandbox = await client.createSandbox(snapshot.id);
|
|
16
16
|
* try {
|
|
17
17
|
* const result = await sandbox.run("python --version");
|
|
18
18
|
* console.log(result.stdout);
|
|
@@ -26,12 +26,10 @@ import { CommandHandle } from "./command_handle.js";
|
|
|
26
26
|
export declare class Sandbox {
|
|
27
27
|
/** Display name (can be updated). */
|
|
28
28
|
readonly name: string;
|
|
29
|
-
/** Name of the template used to create this sandbox. */
|
|
30
|
-
readonly template_name: string;
|
|
31
29
|
/** URL for data plane operations (file I/O, command execution). */
|
|
32
|
-
|
|
33
|
-
/** Provisioning status ("provisioning", "ready", "failed"). */
|
|
34
|
-
|
|
30
|
+
dataplane_url?: string;
|
|
31
|
+
/** Provisioning status ("provisioning", "ready", "failed", "stopped"). */
|
|
32
|
+
status?: string;
|
|
35
33
|
/** Human-readable status message (e.g., error details when failed). */
|
|
36
34
|
readonly status_message?: string;
|
|
37
35
|
/** Unique identifier (UUID). Remains constant even if name changes. */
|
|
@@ -42,10 +40,22 @@ export declare class Sandbox {
|
|
|
42
40
|
readonly updated_at?: string;
|
|
43
41
|
/** Maximum lifetime TTL in seconds (`0` means disabled). */
|
|
44
42
|
readonly ttl_seconds?: number;
|
|
45
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Idle timeout TTL in seconds (`0` means disabled).
|
|
45
|
+
* New sandboxes receive a server-side default of `600` seconds (10 minutes)
|
|
46
|
+
* when the caller did not set `idleTtlSeconds` explicitly.
|
|
47
|
+
*/
|
|
46
48
|
readonly idle_ttl_seconds?: number;
|
|
47
49
|
/** Computed expiration timestamp when a TTL is active. */
|
|
48
50
|
readonly expires_at?: string;
|
|
51
|
+
/** Snapshot ID used to create this sandbox. */
|
|
52
|
+
readonly snapshot_id?: string;
|
|
53
|
+
/** Number of vCPUs allocated. */
|
|
54
|
+
readonly vCpus?: number;
|
|
55
|
+
/** Memory allocation in bytes. */
|
|
56
|
+
readonly mem_bytes?: number;
|
|
57
|
+
/** Root filesystem capacity in bytes. */
|
|
58
|
+
readonly fs_capacity_bytes?: number;
|
|
49
59
|
private _client;
|
|
50
60
|
/**
|
|
51
61
|
* Validate and return the dataplane URL.
|
|
@@ -138,7 +148,7 @@ export declare class Sandbox {
|
|
|
138
148
|
*
|
|
139
149
|
* @example
|
|
140
150
|
* ```typescript
|
|
141
|
-
* const sandbox = await client.createSandbox(
|
|
151
|
+
* const sandbox = await client.createSandbox(snapshot.id);
|
|
142
152
|
* try {
|
|
143
153
|
* await sandbox.run("echo hello");
|
|
144
154
|
* } finally {
|
|
@@ -147,4 +157,24 @@ export declare class Sandbox {
|
|
|
147
157
|
* ```
|
|
148
158
|
*/
|
|
149
159
|
delete(): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* Start a stopped sandbox and wait until ready.
|
|
162
|
+
*
|
|
163
|
+
* Updates this sandbox's status and dataplane_url in place.
|
|
164
|
+
*
|
|
165
|
+
* @param timeout - Timeout in seconds when waiting for ready. Default: 120.
|
|
166
|
+
*/
|
|
167
|
+
start(options?: StartSandboxOptions): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Stop a running sandbox (preserves sandbox files for later restart).
|
|
170
|
+
*/
|
|
171
|
+
stop(): Promise<void>;
|
|
172
|
+
/**
|
|
173
|
+
* Capture a snapshot from this sandbox.
|
|
174
|
+
*
|
|
175
|
+
* @param name - Snapshot name.
|
|
176
|
+
* @param options - Capture options (timeout).
|
|
177
|
+
* @returns Snapshot in "ready" status.
|
|
178
|
+
*/
|
|
179
|
+
captureSnapshot(name: string, options?: CaptureSnapshotOptions): Promise<Snapshot>;
|
|
150
180
|
}
|
|
@@ -14,7 +14,7 @@ import { reconnectWsStream, runWsStream } from "./ws_execute.js";
|
|
|
14
14
|
*
|
|
15
15
|
* @example
|
|
16
16
|
* ```typescript
|
|
17
|
-
* const sandbox = await client.createSandbox(
|
|
17
|
+
* const sandbox = await client.createSandbox(snapshot.id);
|
|
18
18
|
* try {
|
|
19
19
|
* const result = await sandbox.run("python --version");
|
|
20
20
|
* console.log(result.stdout);
|
|
@@ -35,13 +35,6 @@ export class Sandbox {
|
|
|
35
35
|
writable: true,
|
|
36
36
|
value: void 0
|
|
37
37
|
});
|
|
38
|
-
/** Name of the template used to create this sandbox. */
|
|
39
|
-
Object.defineProperty(this, "template_name", {
|
|
40
|
-
enumerable: true,
|
|
41
|
-
configurable: true,
|
|
42
|
-
writable: true,
|
|
43
|
-
value: void 0
|
|
44
|
-
});
|
|
45
38
|
/** URL for data plane operations (file I/O, command execution). */
|
|
46
39
|
Object.defineProperty(this, "dataplane_url", {
|
|
47
40
|
enumerable: true,
|
|
@@ -49,7 +42,7 @@ export class Sandbox {
|
|
|
49
42
|
writable: true,
|
|
50
43
|
value: void 0
|
|
51
44
|
});
|
|
52
|
-
/** Provisioning status ("provisioning", "ready", "failed"). */
|
|
45
|
+
/** Provisioning status ("provisioning", "ready", "failed", "stopped"). */
|
|
53
46
|
Object.defineProperty(this, "status", {
|
|
54
47
|
enumerable: true,
|
|
55
48
|
configurable: true,
|
|
@@ -91,7 +84,11 @@ export class Sandbox {
|
|
|
91
84
|
writable: true,
|
|
92
85
|
value: void 0
|
|
93
86
|
});
|
|
94
|
-
/**
|
|
87
|
+
/**
|
|
88
|
+
* Idle timeout TTL in seconds (`0` means disabled).
|
|
89
|
+
* New sandboxes receive a server-side default of `600` seconds (10 minutes)
|
|
90
|
+
* when the caller did not set `idleTtlSeconds` explicitly.
|
|
91
|
+
*/
|
|
95
92
|
Object.defineProperty(this, "idle_ttl_seconds", {
|
|
96
93
|
enumerable: true,
|
|
97
94
|
configurable: true,
|
|
@@ -105,6 +102,34 @@ export class Sandbox {
|
|
|
105
102
|
writable: true,
|
|
106
103
|
value: void 0
|
|
107
104
|
});
|
|
105
|
+
/** Snapshot ID used to create this sandbox. */
|
|
106
|
+
Object.defineProperty(this, "snapshot_id", {
|
|
107
|
+
enumerable: true,
|
|
108
|
+
configurable: true,
|
|
109
|
+
writable: true,
|
|
110
|
+
value: void 0
|
|
111
|
+
});
|
|
112
|
+
/** Number of vCPUs allocated. */
|
|
113
|
+
Object.defineProperty(this, "vCpus", {
|
|
114
|
+
enumerable: true,
|
|
115
|
+
configurable: true,
|
|
116
|
+
writable: true,
|
|
117
|
+
value: void 0
|
|
118
|
+
});
|
|
119
|
+
/** Memory allocation in bytes. */
|
|
120
|
+
Object.defineProperty(this, "mem_bytes", {
|
|
121
|
+
enumerable: true,
|
|
122
|
+
configurable: true,
|
|
123
|
+
writable: true,
|
|
124
|
+
value: void 0
|
|
125
|
+
});
|
|
126
|
+
/** Root filesystem capacity in bytes. */
|
|
127
|
+
Object.defineProperty(this, "fs_capacity_bytes", {
|
|
128
|
+
enumerable: true,
|
|
129
|
+
configurable: true,
|
|
130
|
+
writable: true,
|
|
131
|
+
value: void 0
|
|
132
|
+
});
|
|
108
133
|
Object.defineProperty(this, "_client", {
|
|
109
134
|
enumerable: true,
|
|
110
135
|
configurable: true,
|
|
@@ -112,7 +137,6 @@ export class Sandbox {
|
|
|
112
137
|
value: void 0
|
|
113
138
|
});
|
|
114
139
|
this.name = data.name;
|
|
115
|
-
this.template_name = data.template_name;
|
|
116
140
|
this.dataplane_url = data.dataplane_url;
|
|
117
141
|
this.status = data.status;
|
|
118
142
|
this.status_message = data.status_message;
|
|
@@ -122,6 +146,10 @@ export class Sandbox {
|
|
|
122
146
|
this.ttl_seconds = data.ttl_seconds;
|
|
123
147
|
this.idle_ttl_seconds = data.idle_ttl_seconds;
|
|
124
148
|
this.expires_at = data.expires_at;
|
|
149
|
+
this.snapshot_id = data.snapshot_id;
|
|
150
|
+
this.vCpus = data.vcpus;
|
|
151
|
+
this.mem_bytes = data.mem_bytes;
|
|
152
|
+
this.fs_capacity_bytes = data.fs_capacity_bytes;
|
|
125
153
|
this._client = client;
|
|
126
154
|
}
|
|
127
155
|
/**
|
|
@@ -174,7 +202,7 @@ export class Sandbox {
|
|
|
174
202
|
catch (e) {
|
|
175
203
|
// Fall back to HTTP on connection errors or missing ws package
|
|
176
204
|
const name = e != null && typeof e === "object" ? e.name : "";
|
|
177
|
-
const message = e != null && typeof e === "object" ? e.message ?? "" : "";
|
|
205
|
+
const message = e != null && typeof e === "object" ? (e.message ?? "") : "";
|
|
178
206
|
if (name === "LangSmithSandboxConnectionError" ||
|
|
179
207
|
name === "LangSmithSandboxServerReloadError" ||
|
|
180
208
|
message.includes("'ws' package")) {
|
|
@@ -325,7 +353,7 @@ export class Sandbox {
|
|
|
325
353
|
*
|
|
326
354
|
* @example
|
|
327
355
|
* ```typescript
|
|
328
|
-
* const sandbox = await client.createSandbox(
|
|
356
|
+
* const sandbox = await client.createSandbox(snapshot.id);
|
|
329
357
|
* try {
|
|
330
358
|
* await sandbox.run("echo hello");
|
|
331
359
|
* } finally {
|
|
@@ -336,4 +364,34 @@ export class Sandbox {
|
|
|
336
364
|
async delete() {
|
|
337
365
|
await this._client.deleteSandbox(this.name);
|
|
338
366
|
}
|
|
367
|
+
/**
|
|
368
|
+
* Start a stopped sandbox and wait until ready.
|
|
369
|
+
*
|
|
370
|
+
* Updates this sandbox's status and dataplane_url in place.
|
|
371
|
+
*
|
|
372
|
+
* @param timeout - Timeout in seconds when waiting for ready. Default: 120.
|
|
373
|
+
*/
|
|
374
|
+
async start(options = {}) {
|
|
375
|
+
const refreshed = await this._client.startSandbox(this.name, options);
|
|
376
|
+
this.status = refreshed.status;
|
|
377
|
+
this.dataplane_url = refreshed.dataplane_url;
|
|
378
|
+
}
|
|
379
|
+
/**
|
|
380
|
+
* Stop a running sandbox (preserves sandbox files for later restart).
|
|
381
|
+
*/
|
|
382
|
+
async stop() {
|
|
383
|
+
await this._client.stopSandbox(this.name);
|
|
384
|
+
this.status = "stopped";
|
|
385
|
+
this.dataplane_url = undefined;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Capture a snapshot from this sandbox.
|
|
389
|
+
*
|
|
390
|
+
* @param name - Snapshot name.
|
|
391
|
+
* @param options - Capture options (timeout).
|
|
392
|
+
* @returns Snapshot in "ready" status.
|
|
393
|
+
*/
|
|
394
|
+
async captureSnapshot(name, options = {}) {
|
|
395
|
+
return this._client.captureSnapshot(this.name, name, options);
|
|
396
|
+
}
|
|
339
397
|
}
|
|
@@ -12,66 +12,35 @@ export interface ExecutionResult {
|
|
|
12
12
|
exit_code: number;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
export interface ResourceSpec {
|
|
18
|
-
cpu?: string;
|
|
19
|
-
memory?: string;
|
|
20
|
-
storage?: string;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Specification for mounting a volume in a sandbox template.
|
|
24
|
-
*/
|
|
25
|
-
export interface VolumeMountSpec {
|
|
26
|
-
volume_name: string;
|
|
27
|
-
mount_path: string;
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Represents a persistent volume.
|
|
31
|
-
*/
|
|
32
|
-
export interface Volume {
|
|
33
|
-
id?: string;
|
|
34
|
-
name: string;
|
|
35
|
-
size: string;
|
|
36
|
-
storage_class: string;
|
|
37
|
-
created_at?: string;
|
|
38
|
-
updated_at?: string;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Represents a SandboxTemplate.
|
|
42
|
-
*
|
|
43
|
-
* Templates define the image, resource limits, and volume mounts for sandboxes.
|
|
15
|
+
* Lightweight provisioning status for any async-created resource.
|
|
44
16
|
*/
|
|
45
|
-
export interface
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
volume_mounts?: VolumeMountSpec[];
|
|
51
|
-
created_at?: string;
|
|
52
|
-
updated_at?: string;
|
|
17
|
+
export interface ResourceStatus {
|
|
18
|
+
/** One of "provisioning", "ready", "failed". */
|
|
19
|
+
status: string;
|
|
20
|
+
/** Human-readable details when failed. */
|
|
21
|
+
status_message?: string;
|
|
53
22
|
}
|
|
54
23
|
/**
|
|
55
|
-
* Represents a
|
|
24
|
+
* Represents a sandbox snapshot.
|
|
56
25
|
*
|
|
57
|
-
*
|
|
26
|
+
* Snapshots are built from Docker images or captured from running sandboxes.
|
|
27
|
+
* They are used to create new sandboxes.
|
|
58
28
|
*/
|
|
59
|
-
export interface
|
|
60
|
-
id
|
|
29
|
+
export interface Snapshot {
|
|
30
|
+
id: string;
|
|
61
31
|
name: string;
|
|
62
|
-
|
|
63
|
-
replicas: number;
|
|
64
|
-
created_at?: string;
|
|
65
|
-
updated_at?: string;
|
|
66
|
-
}
|
|
67
|
-
/**
|
|
68
|
-
* Lightweight provisioning status for any async-created resource.
|
|
69
|
-
*/
|
|
70
|
-
export interface ResourceStatus {
|
|
71
|
-
/** One of "provisioning", "ready", "failed". */
|
|
32
|
+
/** One of "building", "ready", "failed". */
|
|
72
33
|
status: string;
|
|
73
|
-
|
|
34
|
+
fs_capacity_bytes: number;
|
|
35
|
+
docker_image?: string;
|
|
36
|
+
image_digest?: string;
|
|
37
|
+
source_sandbox_id?: string;
|
|
74
38
|
status_message?: string;
|
|
39
|
+
fs_used_bytes?: number;
|
|
40
|
+
created_by?: string;
|
|
41
|
+
registry_id?: string;
|
|
42
|
+
created_at?: string;
|
|
43
|
+
updated_at?: string;
|
|
75
44
|
}
|
|
76
45
|
/**
|
|
77
46
|
* Data representing a sandbox instance from the API.
|
|
@@ -79,7 +48,6 @@ export interface ResourceStatus {
|
|
|
79
48
|
export interface SandboxData {
|
|
80
49
|
id?: string;
|
|
81
50
|
name: string;
|
|
82
|
-
template_name: string;
|
|
83
51
|
dataplane_url?: string;
|
|
84
52
|
status?: string;
|
|
85
53
|
status_message?: string;
|
|
@@ -91,6 +59,14 @@ export interface SandboxData {
|
|
|
91
59
|
idle_ttl_seconds?: number;
|
|
92
60
|
/** Computed expiration timestamp when a TTL is active, else omitted/`undefined`. */
|
|
93
61
|
expires_at?: string;
|
|
62
|
+
/** Snapshot ID used to create this sandbox. */
|
|
63
|
+
snapshot_id?: string;
|
|
64
|
+
/** Number of vCPUs allocated. */
|
|
65
|
+
vcpus?: number;
|
|
66
|
+
/** Memory allocation in bytes. */
|
|
67
|
+
mem_bytes?: number;
|
|
68
|
+
/** Root filesystem capacity in bytes. */
|
|
69
|
+
fs_capacity_bytes?: number;
|
|
94
70
|
}
|
|
95
71
|
/**
|
|
96
72
|
* Configuration options for the SandboxClient.
|
|
@@ -235,10 +211,43 @@ export interface RunOptions {
|
|
|
235
211
|
*/
|
|
236
212
|
pty?: boolean;
|
|
237
213
|
}
|
|
214
|
+
/**
|
|
215
|
+
* Network access-control rules for a sandbox's proxy sidecar.
|
|
216
|
+
*
|
|
217
|
+
* Supported pattern types: exact domains, globs (e.g. `*.example.com`),
|
|
218
|
+
* IPs, CIDR ranges (e.g. `10.0.0.0/8`), and regex (`~pattern`).
|
|
219
|
+
*
|
|
220
|
+
* Only one of `allow_list` and `deny_list` may be populated.
|
|
221
|
+
*/
|
|
222
|
+
export interface SandboxAccessControl {
|
|
223
|
+
/** Hosts the sandbox is allowed to reach. */
|
|
224
|
+
allow_list?: string[];
|
|
225
|
+
/** Hosts the sandbox is blocked from reaching. */
|
|
226
|
+
deny_list?: string[];
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Full proxy configuration forwarded to the sandbox server as-is (snake_case
|
|
230
|
+
* so it's wire-compatible with the backend). Mirrors the server's
|
|
231
|
+
* `ProxyConfig` type.
|
|
232
|
+
*/
|
|
233
|
+
export interface SandboxProxyConfig {
|
|
234
|
+
/** Header-injection rules keyed by host pattern. */
|
|
235
|
+
rules?: unknown[];
|
|
236
|
+
/** Hosts that bypass the proxy entirely. */
|
|
237
|
+
no_proxy?: string[];
|
|
238
|
+
/** Allow/deny list enforced at the proxy sidecar. */
|
|
239
|
+
access_control?: SandboxAccessControl;
|
|
240
|
+
}
|
|
238
241
|
/**
|
|
239
242
|
* Options for creating a sandbox.
|
|
240
243
|
*/
|
|
241
244
|
export interface CreateSandboxOptions {
|
|
245
|
+
/**
|
|
246
|
+
* Snapshot name to boot from. Mutually exclusive with the positional
|
|
247
|
+
* `snapshotId` argument on `createSandbox`; exactly one must be provided.
|
|
248
|
+
* Resolved server-side to a snapshot owned by the caller's tenant.
|
|
249
|
+
*/
|
|
250
|
+
snapshotName?: string;
|
|
242
251
|
/**
|
|
243
252
|
* Optional sandbox name (auto-generated if not provided).
|
|
244
253
|
*/
|
|
@@ -261,128 +270,129 @@ export interface CreateSandboxOptions {
|
|
|
261
270
|
ttlSeconds?: number;
|
|
262
271
|
/**
|
|
263
272
|
* Idle timeout in seconds. The sandbox is deleted after this much inactivity.
|
|
264
|
-
* Must be a multiple of 60
|
|
265
|
-
|
|
266
|
-
idleTtlSeconds?: number;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Options for updating a sandbox (name and/or TTL).
|
|
270
|
-
*/
|
|
271
|
-
export interface UpdateSandboxOptions {
|
|
272
|
-
/** New display name. */
|
|
273
|
-
newName?: string;
|
|
274
|
-
/**
|
|
275
|
-
* Maximum lifetime in seconds from creation. Must be a multiple of 60.
|
|
276
|
-
* Pass `0` to disable absolute TTL.
|
|
277
|
-
*/
|
|
278
|
-
ttlSeconds?: number;
|
|
279
|
-
/**
|
|
280
|
-
* Idle timeout in seconds. Must be a multiple of 60. Pass `0` to disable.
|
|
273
|
+
* Must be a multiple of 60. Pass `0` to explicitly disable the idle timeout.
|
|
274
|
+
* When omitted, the server applies a default of `600` seconds (10 minutes).
|
|
281
275
|
*/
|
|
282
276
|
idleTtlSeconds?: number;
|
|
277
|
+
/** Number of vCPUs. */
|
|
278
|
+
vCpus?: number;
|
|
279
|
+
/** Memory in bytes. */
|
|
280
|
+
memBytes?: number;
|
|
281
|
+
/** Root filesystem capacity in bytes. */
|
|
282
|
+
fsCapacityBytes?: number;
|
|
283
|
+
/**
|
|
284
|
+
* Per-sandbox proxy configuration. Use
|
|
285
|
+
* `{ access_control: { allow_list: ["github.com", "*.example.com"] } }`
|
|
286
|
+
* to restrict outbound HTTPS to a set of host patterns. Forwarded to the
|
|
287
|
+
* server as-is on the wire.
|
|
288
|
+
*/
|
|
289
|
+
proxyConfig?: SandboxProxyConfig;
|
|
283
290
|
}
|
|
284
291
|
/**
|
|
285
|
-
* Options for
|
|
292
|
+
* Options for creating a snapshot from a Docker image.
|
|
286
293
|
*/
|
|
287
|
-
export interface
|
|
288
|
-
/**
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
294
|
+
export interface CreateSnapshotOptions {
|
|
295
|
+
/** Private registry ID (alternative to URL/credentials). */
|
|
296
|
+
registryId?: string;
|
|
297
|
+
/** Registry URL for private images. */
|
|
298
|
+
registryUrl?: string;
|
|
299
|
+
/** Registry username. */
|
|
300
|
+
registryUsername?: string;
|
|
301
|
+
/** Registry password. */
|
|
302
|
+
registryPassword?: string;
|
|
303
|
+
/** Timeout in seconds when waiting for ready. Default: 60. */
|
|
292
304
|
timeout?: number;
|
|
293
|
-
/**
|
|
294
|
-
|
|
295
|
-
* Default: 1.0.
|
|
296
|
-
*/
|
|
297
|
-
pollInterval?: number;
|
|
305
|
+
/** AbortSignal for cancellation. */
|
|
306
|
+
signal?: AbortSignal;
|
|
298
307
|
}
|
|
299
308
|
/**
|
|
300
|
-
* Options for
|
|
309
|
+
* Options for capturing a snapshot from a running sandbox.
|
|
301
310
|
*/
|
|
302
|
-
export interface
|
|
303
|
-
/**
|
|
304
|
-
* Storage size (e.g., "1Gi", "10Gi").
|
|
305
|
-
*/
|
|
306
|
-
size: string;
|
|
307
|
-
/**
|
|
308
|
-
* Timeout in seconds when waiting for volume to be ready. Default: 60.
|
|
309
|
-
*/
|
|
311
|
+
export interface CaptureSnapshotOptions {
|
|
312
|
+
/** Timeout in seconds when waiting for ready. Default: 60. */
|
|
310
313
|
timeout?: number;
|
|
314
|
+
/** AbortSignal for cancellation. */
|
|
315
|
+
signal?: AbortSignal;
|
|
311
316
|
}
|
|
312
317
|
/**
|
|
313
|
-
* Options for
|
|
318
|
+
* Options for listing snapshots. All fields are optional and independent.
|
|
319
|
+
*
|
|
320
|
+
* The backend always paginates: when `limit` is omitted the server applies
|
|
321
|
+
* a default page size (currently 50), so a single call will not necessarily
|
|
322
|
+
* return every snapshot visible to the caller's tenant.
|
|
314
323
|
*/
|
|
315
|
-
export interface
|
|
316
|
-
/**
|
|
317
|
-
* Container image (e.g., "python:3.12-slim", "node:20-slim").
|
|
318
|
-
*/
|
|
319
|
-
image: string;
|
|
324
|
+
export interface ListSnapshotsOptions {
|
|
320
325
|
/**
|
|
321
|
-
*
|
|
326
|
+
* Case-insensitive substring filter applied server-side to snapshot
|
|
327
|
+
* names.
|
|
322
328
|
*/
|
|
323
|
-
|
|
329
|
+
nameContains?: string;
|
|
324
330
|
/**
|
|
325
|
-
*
|
|
331
|
+
* Maximum number of snapshots to return for a single request. Must be
|
|
332
|
+
* between 1 and 500 (inclusive); the server rejects values outside that
|
|
333
|
+
* range. Defaults to 50 server-side when omitted.
|
|
326
334
|
*/
|
|
327
|
-
|
|
335
|
+
limit?: number;
|
|
328
336
|
/**
|
|
329
|
-
*
|
|
337
|
+
* Number of snapshots to skip before returning results. Must be `>= 0`.
|
|
338
|
+
* Useful for paginating through large result sets in combination with
|
|
339
|
+
* `limit`.
|
|
330
340
|
*/
|
|
331
|
-
|
|
332
|
-
/**
|
|
333
|
-
|
|
334
|
-
*/
|
|
335
|
-
volumeMounts?: VolumeMountSpec[];
|
|
341
|
+
offset?: number;
|
|
342
|
+
/** AbortSignal for cancellation. */
|
|
343
|
+
signal?: AbortSignal;
|
|
336
344
|
}
|
|
337
345
|
/**
|
|
338
|
-
* Options for
|
|
346
|
+
* Options for waiting for a snapshot to become ready.
|
|
339
347
|
*/
|
|
340
|
-
export interface
|
|
341
|
-
/**
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
348
|
+
export interface WaitForSnapshotOptions {
|
|
349
|
+
/** Maximum time in seconds to wait. Default: 300. */
|
|
350
|
+
timeout?: number;
|
|
351
|
+
/** Time in seconds between status polls. Default: 2.0. */
|
|
352
|
+
pollInterval?: number;
|
|
353
|
+
/** AbortSignal for cancellation. */
|
|
354
|
+
signal?: AbortSignal;
|
|
345
355
|
}
|
|
346
356
|
/**
|
|
347
|
-
* Options for
|
|
357
|
+
* Options for starting a stopped sandbox.
|
|
348
358
|
*/
|
|
349
|
-
export interface
|
|
350
|
-
/**
|
|
351
|
-
* Name of the template to use for sandboxes in this pool.
|
|
352
|
-
*/
|
|
353
|
-
templateName: string;
|
|
354
|
-
/**
|
|
355
|
-
* Number of pre-warmed sandboxes to maintain (0-100).
|
|
356
|
-
*/
|
|
357
|
-
replicas: number;
|
|
358
|
-
/**
|
|
359
|
-
* Timeout in seconds when waiting for pool to be ready. Default: 30.
|
|
360
|
-
*/
|
|
359
|
+
export interface StartSandboxOptions {
|
|
360
|
+
/** Timeout in seconds when waiting for ready. Default: 120. */
|
|
361
361
|
timeout?: number;
|
|
362
|
+
/** AbortSignal for cancellation. */
|
|
363
|
+
signal?: AbortSignal;
|
|
362
364
|
}
|
|
363
365
|
/**
|
|
364
|
-
* Options for updating a
|
|
366
|
+
* Options for updating a sandbox (name and/or TTL).
|
|
365
367
|
*/
|
|
366
|
-
export interface
|
|
368
|
+
export interface UpdateSandboxOptions {
|
|
369
|
+
/** New display name. */
|
|
370
|
+
newName?: string;
|
|
367
371
|
/**
|
|
368
|
-
*
|
|
372
|
+
* Maximum lifetime in seconds from creation. Must be a multiple of 60.
|
|
373
|
+
* Pass `0` to disable absolute TTL.
|
|
369
374
|
*/
|
|
370
|
-
|
|
375
|
+
ttlSeconds?: number;
|
|
371
376
|
/**
|
|
372
|
-
*
|
|
377
|
+
* Idle timeout in seconds. Must be a multiple of 60. Pass `0` to disable.
|
|
378
|
+
* Omit (or pass `undefined`) to leave the existing value unchanged.
|
|
373
379
|
*/
|
|
374
|
-
|
|
380
|
+
idleTtlSeconds?: number;
|
|
375
381
|
}
|
|
376
382
|
/**
|
|
377
|
-
* Options for
|
|
383
|
+
* Options for waiting for a sandbox to become ready.
|
|
378
384
|
*/
|
|
379
|
-
export interface
|
|
385
|
+
export interface WaitForSandboxOptions {
|
|
380
386
|
/**
|
|
381
|
-
*
|
|
387
|
+
* Maximum time in seconds to wait for the sandbox to become ready.
|
|
388
|
+
* Default: 120.
|
|
382
389
|
*/
|
|
383
|
-
|
|
390
|
+
timeout?: number;
|
|
384
391
|
/**
|
|
385
|
-
*
|
|
392
|
+
* Time in seconds between status polls.
|
|
393
|
+
* Default: 1.0.
|
|
386
394
|
*/
|
|
387
|
-
|
|
395
|
+
pollInterval?: number;
|
|
396
|
+
/** AbortSignal for cancellation. */
|
|
397
|
+
signal?: AbortSignal;
|
|
388
398
|
}
|
|
@@ -191,7 +191,7 @@ const _getGenerateTextWrapperConfig = ({ model, runName, aiSdkMethodName, resolv
|
|
|
191
191
|
return (0, utils_js_1.convertMessageToTracedFormat)({
|
|
192
192
|
content: content ?? outputs.outputs.text,
|
|
193
193
|
role: "assistant",
|
|
194
|
-
}, resolvedLsConfig?.traceResponseMetadata ?? traceResponseMetadata
|
|
194
|
+
}, (resolvedLsConfig?.traceResponseMetadata ?? traceResponseMetadata)
|
|
195
195
|
? { steps }
|
|
196
196
|
: undefined);
|
|
197
197
|
}
|
|
@@ -187,7 +187,7 @@ const _getGenerateTextWrapperConfig = ({ model, runName, aiSdkMethodName, resolv
|
|
|
187
187
|
return convertMessageToTracedFormat({
|
|
188
188
|
content: content ?? outputs.outputs.text,
|
|
189
189
|
role: "assistant",
|
|
190
|
-
}, resolvedLsConfig?.traceResponseMetadata ?? traceResponseMetadata
|
|
190
|
+
}, (resolvedLsConfig?.traceResponseMetadata ?? traceResponseMetadata)
|
|
191
191
|
? { steps }
|
|
192
192
|
: undefined);
|
|
193
193
|
}
|
|
@@ -280,7 +280,8 @@ function LangSmithMiddleware(config) {
|
|
|
280
280
|
}
|
|
281
281
|
let formattedOutputs;
|
|
282
282
|
if (lsConfig?.processOutputs) {
|
|
283
|
-
formattedOutputs =
|
|
283
|
+
formattedOutputs =
|
|
284
|
+
await lsConfig.processOutputs(outputForTracing);
|
|
284
285
|
}
|
|
285
286
|
else {
|
|
286
287
|
formattedOutputs = _formatTracedOutputs(outputForTracing, lsConfig?.traceRawHttp);
|
|
@@ -277,7 +277,8 @@ export function LangSmithMiddleware(config) {
|
|
|
277
277
|
}
|
|
278
278
|
let formattedOutputs;
|
|
279
279
|
if (lsConfig?.processOutputs) {
|
|
280
|
-
formattedOutputs =
|
|
280
|
+
formattedOutputs =
|
|
281
|
+
await lsConfig.processOutputs(outputForTracing);
|
|
281
282
|
}
|
|
282
283
|
else {
|
|
283
284
|
formattedOutputs = _formatTracedOutputs(outputForTracing, lsConfig?.traceRawHttp);
|
package/dist/index.cjs
CHANGED
|
@@ -18,4 +18,4 @@ Object.defineProperty(exports, "PromptCache", { enumerable: true, get: function
|
|
|
18
18
|
Object.defineProperty(exports, "configureGlobalPromptCache", { enumerable: true, get: function () { return index_js_1.configureGlobalPromptCache; } });
|
|
19
19
|
Object.defineProperty(exports, "promptCacheSingleton", { enumerable: true, get: function () { return index_js_1.promptCacheSingleton; } });
|
|
20
20
|
// Update using pnpm bump-version
|
|
21
|
-
exports.__version__ = "0.
|
|
21
|
+
exports.__version__ = "0.6.0";
|
package/dist/index.d.ts
CHANGED
|
@@ -5,4 +5,4 @@ export { overrideFetchImplementation } from "./singletons/fetch.js";
|
|
|
5
5
|
export { getDefaultProjectName } from "./utils/project.js";
|
|
6
6
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
7
7
|
export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
8
|
-
export declare const __version__ = "0.
|
|
8
|
+
export declare const __version__ = "0.6.0";
|
package/dist/index.js
CHANGED
|
@@ -5,4 +5,4 @@ export { getDefaultProjectName } from "./utils/project.js";
|
|
|
5
5
|
export { uuid7, uuid7FromTime } from "./uuid.js";
|
|
6
6
|
export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
|
|
7
7
|
// Update using pnpm bump-version
|
|
8
|
-
export const __version__ = "0.
|
|
8
|
+
export const __version__ = "0.6.0";
|