langsmith 0.8.10 → 0.8.12

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.
Files changed (43) hide show
  1. package/dist/_openapi_client/resources/issues.d.ts +6 -0
  2. package/dist/_openapi_client/resources/online-evaluators.cjs +2 -2
  3. package/dist/_openapi_client/resources/online-evaluators.d.ts +7 -2
  4. package/dist/_openapi_client/resources/online-evaluators.js +2 -2
  5. package/dist/_openapi_client/resources/public/runs.d.ts +1 -1
  6. package/dist/_openapi_client/resources/sandboxes/boxes.cjs +2 -0
  7. package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +25 -0
  8. package/dist/_openapi_client/resources/sandboxes/boxes.js +2 -0
  9. package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +7 -2
  10. package/dist/_openapi_client/resources/sandboxes/sandboxes.js +1 -1
  11. package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +12 -2
  12. package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +25 -3
  13. package/dist/_openapi_client/resources/sandboxes/snapshots.js +12 -2
  14. package/dist/_openapi_client/resources/threads.cjs +1 -1
  15. package/dist/_openapi_client/resources/threads.d.ts +26 -1
  16. package/dist/_openapi_client/resources/threads.js +1 -1
  17. package/dist/index.cjs +1 -1
  18. package/dist/index.d.ts +1 -1
  19. package/dist/index.js +1 -1
  20. package/dist/sandbox/client.cjs +66 -12
  21. package/dist/sandbox/client.d.ts +31 -5
  22. package/dist/sandbox/client.js +66 -12
  23. package/dist/sandbox/errors.cjs +17 -6
  24. package/dist/sandbox/errors.d.ts +12 -5
  25. package/dist/sandbox/errors.js +15 -5
  26. package/dist/sandbox/index.cjs +3 -1
  27. package/dist/sandbox/index.d.ts +3 -3
  28. package/dist/sandbox/index.js +2 -2
  29. package/dist/sandbox/mounts.cjs +25 -2
  30. package/dist/sandbox/mounts.d.ts +12 -1
  31. package/dist/sandbox/mounts.js +24 -2
  32. package/dist/sandbox/proxy_config.cjs +28 -4
  33. package/dist/sandbox/proxy_config.d.ts +4 -2
  34. package/dist/sandbox/proxy_config.js +28 -4
  35. package/dist/sandbox/sandbox.cjs +27 -1
  36. package/dist/sandbox/sandbox.d.ts +25 -1
  37. package/dist/sandbox/sandbox.js +28 -2
  38. package/dist/sandbox/types.d.ts +71 -1
  39. package/dist/sandbox/ws_execute.cjs +7 -3
  40. package/dist/sandbox/ws_execute.js +8 -4
  41. package/dist/wrappers/anthropic.cjs +39 -6
  42. package/dist/wrappers/anthropic.js +39 -6
  43. package/package.json +12 -2
@@ -21,6 +21,12 @@ export type IssuesOffsetPaginationIssues = OffsetPaginationIssues<Issue>;
21
21
  export interface Issue {
22
22
  id?: string;
23
23
  actions?: unknown;
24
+ auto_resolution_evidence?: unknown;
25
+ /**
26
+ * Nil unless eligible: "auto_close" or "prompt". Evidence carries the deciding
27
+ * gate.
28
+ */
29
+ auto_resolution_state?: string;
24
30
  created_at?: string;
25
31
  description?: string;
26
32
  first_seen_at?: string;
@@ -60,8 +60,8 @@ class OnlineEvaluators extends resource_js_1.APIResource {
60
60
  /**
61
61
  * Returns per-day LLM evaluator spend for the requested 7-day period, grouped by
62
62
  * evaluator, resource, or run rule. Exactly one of group_by, evaluator_id,
63
- * session_id, or dataset_id is required. resource_id, type, and feedback_key may
64
- * be supplied with group_by to narrow listing aggregations.
63
+ * session_id, or dataset_id is required. resource_id, type, feedback_key, and
64
+ * tag_value_id may be supplied with group_by to narrow listing aggregations.
65
65
  */
66
66
  spend(query, options) {
67
67
  return this._client.get('/api/v1/platform/evaluators/spend', { query, ...options });
@@ -34,8 +34,8 @@ export declare class OnlineEvaluators extends APIResource {
34
34
  /**
35
35
  * Returns per-day LLM evaluator spend for the requested 7-day period, grouped by
36
36
  * evaluator, resource, or run rule. Exactly one of group_by, evaluator_id,
37
- * session_id, or dataset_id is required. resource_id, type, and feedback_key may
38
- * be supplied with group_by to narrow listing aggregations.
37
+ * session_id, or dataset_id is required. resource_id, type, feedback_key, and
38
+ * tag_value_id may be supplied with group_by to narrow listing aggregations.
39
39
  */
40
40
  spend(query: OnlineEvaluatorSpendParams, options?: RequestOptions): APIPromise<GetOnlineEvaluatorSpendResponse>;
41
41
  }
@@ -286,6 +286,11 @@ export interface OnlineEvaluatorSpendParams {
286
286
  * Filter to a specific project (UUID). Mutually exclusive with group_by.
287
287
  */
288
288
  session_id?: string;
289
+ /**
290
+ * Filter grouped results to evaluators, projects, or datasets tagged with all
291
+ * supplied tag value IDs. Only valid with group_by.
292
+ */
293
+ tag_value_id?: Array<string>;
289
294
  /**
290
295
  * Filter grouped results by evaluator type: 'llm' or 'code'. Only valid with
291
296
  * group_by.
@@ -57,8 +57,8 @@ export class OnlineEvaluators extends APIResource {
57
57
  /**
58
58
  * Returns per-day LLM evaluator spend for the requested 7-day period, grouped by
59
59
  * evaluator, resource, or run rule. Exactly one of group_by, evaluator_id,
60
- * session_id, or dataset_id is required. resource_id, type, and feedback_key may
61
- * be supplied with group_by to narrow listing aggregations.
60
+ * session_id, or dataset_id is required. resource_id, type, feedback_key, and
61
+ * tag_value_id may be supplied with group_by to narrow listing aggregations.
62
62
  */
63
63
  spend(query, options) {
64
64
  return this._client.get('/api/v1/platform/evaluators/spend', { query, ...options });
@@ -69,7 +69,7 @@ export interface RunQueryParams {
69
69
  */
70
70
  selects?: Array<'ID' | 'NAME' | 'RUN_TYPE' | 'STATUS' | 'START_TIME' | 'END_TIME' | 'LATENCY_SECONDS' | 'FIRST_TOKEN_TIME' | 'ERROR' | 'ERROR_PREVIEW' | 'EXTRA' | 'METADATA' | 'INPUTS_PREVIEW' | 'OUTPUTS_PREVIEW' | 'PARENT_RUN_ID' | 'PARENT_RUN_IDS' | 'PROJECT_ID' | 'TRACE_ID' | 'THREAD_ID' | 'DOTTED_ORDER' | 'IS_ROOT' | 'REFERENCE_DATASET_ID' | 'TOTAL_TOKENS' | 'PROMPT_TOKENS' | 'COMPLETION_TOKENS' | 'TOTAL_COST' | 'PROMPT_COST' | 'COMPLETION_COST' | 'PROMPT_TOKEN_DETAILS' | 'COMPLETION_TOKEN_DETAILS' | 'PROMPT_COST_DETAILS' | 'COMPLETION_COST_DETAILS' | 'PRICE_MODEL_ID' | 'TAGS' | 'THREAD_EVALUATION_TIME' | 'FEEDBACK_STATS'>;
71
71
  /**
72
- * Header param: application/json
72
+ * Header param: application/json or text/event-stream
73
73
  */
74
74
  Accept?: string;
75
75
  }
@@ -10,6 +10,8 @@ class Boxes extends resource_js_1.APIResource {
10
10
  /**
11
11
  * Create a new sandbox from a snapshot. Provide at most one of `snapshot_id` or
12
12
  * `snapshot_name`; if neither is provided, the server uses the default snapshot.
13
+ * `snapshot_name` accepts a Docker-style `name` or `name:tag` reference (a bare
14
+ * name resolves to `name:latest`).
13
15
  */
14
16
  create(body, options) {
15
17
  return this._client.post('/api/v2/sandboxes/boxes', { body, ...options });
@@ -6,6 +6,8 @@ export declare class Boxes extends APIResource {
6
6
  /**
7
7
  * Create a new sandbox from a snapshot. Provide at most one of `snapshot_id` or
8
8
  * `snapshot_name`; if neither is provided, the server uses the default snapshot.
9
+ * `snapshot_name` accepts a Docker-style `name` or `name:tag` reference (a bare
10
+ * name resolves to `name:latest`).
9
11
  */
10
12
  create(body: BoxCreateParams, options?: RequestOptions): APIPromise<SandboxesAPI.SandboxResponse>;
11
13
  /**
@@ -72,6 +74,12 @@ export interface BoxCreateParams {
72
74
  labels?: {
73
75
  [key: string]: string;
74
76
  };
77
+ /**
78
+ * Memory for the sandbox, in bytes. Memory is tied to CPU at 4 GiB per vCPU: omit
79
+ * it and it follows that ratio; set it and it must stay within 50% of the ratio
80
+ * for the requested CPU, so a 1 vCPU sandbox accepts 2-6 GiB. Setting memory
81
+ * without CPU derives the CPU from the same ratio. Maximum 64 GiB.
82
+ */
75
83
  mem_bytes?: number;
76
84
  mount_config?: BoxCreateParams.MountConfig;
77
85
  name?: string;
@@ -94,7 +102,16 @@ export interface BoxCreateParams {
94
102
  * Applies to this request only.
95
103
  */
96
104
  restore_memory?: boolean;
105
+ /**
106
+ * Snapshot is a Docker-style name or name:tag reference to boot from. A bare name
107
+ * resolves to name:latest.
108
+ */
109
+ snapshot?: string;
97
110
  snapshot_id?: string;
111
+ /**
112
+ * SnapshotName is a synonym for Snapshot, accepted for compatibility with clients
113
+ * that predate it. Set one or the other.
114
+ */
98
115
  snapshot_name?: string;
99
116
  tag_value_ids?: Array<string>;
100
117
  vcpus?: number;
@@ -439,6 +456,10 @@ export interface BoxUpdateParams {
439
456
  delete_after_stop_seconds?: number;
440
457
  fs_capacity_bytes?: number;
441
458
  idle_ttl_seconds?: number;
459
+ /**
460
+ * New memory for the sandbox, in bytes. The 4 GiB per vCPU ratio applies when the
461
+ * sandbox is created; a resize enforces only the maximum of 64 GiB.
462
+ */
442
463
  mem_bytes?: number;
443
464
  name?: string;
444
465
  proxy_config?: BoxUpdateParams.ProxyConfig;
@@ -596,6 +617,10 @@ export interface BoxCreateSnapshotParams {
596
617
  labels?: {
597
618
  [key: string]: string;
598
619
  };
620
+ /**
621
+ * mutable Docker-style tag; defaults to "latest"
622
+ */
623
+ tag?: string;
599
624
  }
600
625
  export interface BoxGenerateServiceURLParams {
601
626
  expires_in_seconds?: number;
@@ -7,6 +7,8 @@ export class Boxes extends APIResource {
7
7
  /**
8
8
  * Create a new sandbox from a snapshot. Provide at most one of `snapshot_id` or
9
9
  * `snapshot_name`; if neither is provided, the server uses the default snapshot.
10
+ * `snapshot_name` accepts a Docker-style `name` or `name:tag` reference (a bare
11
+ * name resolves to `name:latest`).
10
12
  */
11
13
  create(body, options) {
12
14
  return this._client.post('/api/v2/sandboxes/boxes', { body, ...options });
@@ -4,7 +4,7 @@ import { BoxCreateParams, BoxCreateSnapshotParams, BoxGenerateServiceURLParams,
4
4
  import * as RegistriesAPI from './registries.js';
5
5
  import { Registries, RegistryCreateParams, RegistryListParams, RegistryListResponse, RegistryResponse, RegistryUpdateParams } from './registries.js';
6
6
  import * as SnapshotsAPI from './snapshots.js';
7
- import { SnapshotCreateParams, SnapshotListParams, Snapshots } from './snapshots.js';
7
+ import { SnapshotCreateParams, SnapshotListParams, SnapshotRetrieveByNameResponse, Snapshots } from './snapshots.js';
8
8
  export declare class Sandboxes extends APIResource {
9
9
  boxes: BoxesAPI.Boxes;
10
10
  registries: RegistriesAPI.Registries;
@@ -411,11 +411,16 @@ export interface SnapshotResponse {
411
411
  source_sandbox_id?: string;
412
412
  status?: string;
413
413
  status_message?: string;
414
+ /**
415
+ * Tags currently resolving to this snapshot, under Name. A snapshot with no tags
416
+ * is dangling — addressable only by id.
417
+ */
418
+ tags?: Array<string>;
414
419
  updated_at?: string;
415
420
  }
416
421
  export declare namespace Sandboxes {
417
422
  export { type SandboxListResponse as SandboxListResponse, type SandboxResponse as SandboxResponse, type SandboxStatusResponse as SandboxStatusResponse, type ServiceURLResponse as ServiceURLResponse, type SnapshotListResponse as SnapshotListResponse, type SnapshotResponse as SnapshotResponse, };
418
423
  export { Boxes as Boxes, type BoxCreateParams as BoxCreateParams, type BoxUpdateParams as BoxUpdateParams, type BoxListParams as BoxListParams, type BoxCreateSnapshotParams as BoxCreateSnapshotParams, type BoxGenerateServiceURLParams as BoxGenerateServiceURLParams, };
419
424
  export { Registries as Registries, type RegistryListResponse as RegistryListResponse, type RegistryResponse as RegistryResponse, type RegistryCreateParams as RegistryCreateParams, type RegistryUpdateParams as RegistryUpdateParams, type RegistryListParams as RegistryListParams, };
420
- export { Snapshots as Snapshots, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
425
+ export { Snapshots as Snapshots, type SnapshotRetrieveByNameResponse as SnapshotRetrieveByNameResponse, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
421
426
  }
@@ -6,7 +6,7 @@ import { Boxes, } from './boxes.js';
6
6
  import * as RegistriesAPI from './registries.js';
7
7
  import { Registries, } from './registries.js';
8
8
  import * as SnapshotsAPI from './snapshots.js';
9
- import { Snapshots } from './snapshots.js';
9
+ import { Snapshots, } from './snapshots.js';
10
10
  export class Sandboxes extends APIResource {
11
11
  constructor() {
12
12
  super(...arguments);
@@ -14,7 +14,9 @@ class Snapshots extends resource_js_1.APIResource {
14
14
  return this._client.post('/api/v2/sandboxes/snapshots', { body, ...options });
15
15
  }
16
16
  /**
17
- * Get a sandbox snapshot by ID.
17
+ * Get a sandbox snapshot by ID or by a Docker-style reference. A bare name means
18
+ * name:latest, falling back to the newest ready untagged snapshot of that name. To
19
+ * list the tags under a name, use /api/v2/sandboxes/snapshots-by-name/{name}.
18
20
  */
19
21
  retrieve(snapshotID, options) {
20
22
  return this._client.get((0, path_js_1.path) `/api/v2/sandboxes/snapshots/${snapshotID}`, options);
@@ -27,7 +29,8 @@ class Snapshots extends resource_js_1.APIResource {
27
29
  return this._client.get('/api/v2/sandboxes/snapshots', { query, ...options });
28
30
  }
29
31
  /**
30
- * Delete a snapshot by ID. The underlying storage is reclaimed asynchronously.
32
+ * Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
33
+ * underlying storage is reclaimed asynchronously.
31
34
  */
32
35
  delete(snapshotID, options) {
33
36
  return this._client.delete((0, path_js_1.path) `/api/v2/sandboxes/snapshots/${snapshotID}`, {
@@ -35,5 +38,12 @@ class Snapshots extends resource_js_1.APIResource {
35
38
  headers: (0, headers_js_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
36
39
  });
37
40
  }
41
+ /**
42
+ * Get a snapshot name and every tag under it, with the snapshot each tag resolves
43
+ * to. To fetch one snapshot, use /api/v2/sandboxes/snapshots/{snapshot_id}.
44
+ */
45
+ retrieveByName(name, options) {
46
+ return this._client.get((0, path_js_1.path) `/api/v2/sandboxes/snapshots-by-name/${name}`, options);
47
+ }
38
48
  }
39
49
  exports.Snapshots = Snapshots;
@@ -8,7 +8,9 @@ export declare class Snapshots extends APIResource {
8
8
  */
9
9
  create(body: SnapshotCreateParams, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotResponse>;
10
10
  /**
11
- * Get a sandbox snapshot by ID.
11
+ * Get a sandbox snapshot by ID or by a Docker-style reference. A bare name means
12
+ * name:latest, falling back to the newest ready untagged snapshot of that name. To
13
+ * list the tags under a name, use /api/v2/sandboxes/snapshots-by-name/{name}.
12
14
  */
13
15
  retrieve(snapshotID: string, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotResponse>;
14
16
  /**
@@ -17,9 +19,25 @@ export declare class Snapshots extends APIResource {
17
19
  */
18
20
  list(query?: SnapshotListParams | null | undefined, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotListResponse>;
19
21
  /**
20
- * Delete a snapshot by ID. The underlying storage is reclaimed asynchronously.
22
+ * Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
23
+ * underlying storage is reclaimed asynchronously.
21
24
  */
22
25
  delete(snapshotID: string, options?: RequestOptions): APIPromise<void>;
26
+ /**
27
+ * Get a snapshot name and every tag under it, with the snapshot each tag resolves
28
+ * to. To fetch one snapshot, use /api/v2/sandboxes/snapshots/{snapshot_id}.
29
+ */
30
+ retrieveByName(name: string, options?: RequestOptions): APIPromise<SnapshotRetrieveByNameResponse>;
31
+ }
32
+ export interface SnapshotRetrieveByNameResponse {
33
+ name?: string;
34
+ tags?: Array<SnapshotRetrieveByNameResponse.Tag>;
35
+ }
36
+ export declare namespace SnapshotRetrieveByNameResponse {
37
+ interface Tag {
38
+ snapshot_id?: string;
39
+ tag?: string;
40
+ }
23
41
  }
24
42
  export interface SnapshotCreateParams {
25
43
  docker_image: string;
@@ -33,6 +51,10 @@ export interface SnapshotCreateParams {
33
51
  [key: string]: string;
34
52
  };
35
53
  registry_id?: string;
54
+ /**
55
+ * mutable Docker-style tag; defaults to "latest"
56
+ */
57
+ tag?: string;
36
58
  }
37
59
  export interface SnapshotListParams {
38
60
  /**
@@ -70,5 +92,5 @@ export interface SnapshotListParams {
70
92
  status?: string;
71
93
  }
72
94
  export declare namespace Snapshots {
73
- export { type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams };
95
+ export { type SnapshotRetrieveByNameResponse as SnapshotRetrieveByNameResponse, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
74
96
  }
@@ -11,7 +11,9 @@ export class Snapshots extends APIResource {
11
11
  return this._client.post('/api/v2/sandboxes/snapshots', { body, ...options });
12
12
  }
13
13
  /**
14
- * Get a sandbox snapshot by ID.
14
+ * Get a sandbox snapshot by ID or by a Docker-style reference. A bare name means
15
+ * name:latest, falling back to the newest ready untagged snapshot of that name. To
16
+ * list the tags under a name, use /api/v2/sandboxes/snapshots-by-name/{name}.
15
17
  */
16
18
  retrieve(snapshotID, options) {
17
19
  return this._client.get(path `/api/v2/sandboxes/snapshots/${snapshotID}`, options);
@@ -24,7 +26,8 @@ export class Snapshots extends APIResource {
24
26
  return this._client.get('/api/v2/sandboxes/snapshots', { query, ...options });
25
27
  }
26
28
  /**
27
- * Delete a snapshot by ID. The underlying storage is reclaimed asynchronously.
29
+ * Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
30
+ * underlying storage is reclaimed asynchronously.
28
31
  */
29
32
  delete(snapshotID, options) {
30
33
  return this._client.delete(path `/api/v2/sandboxes/snapshots/${snapshotID}`, {
@@ -32,4 +35,11 @@ export class Snapshots extends APIResource {
32
35
  headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
33
36
  });
34
37
  }
38
+ /**
39
+ * Get a snapshot name and every tag under it, with the snapshot each tag resolves
40
+ * to. To fetch one snapshot, use /api/v2/sandboxes/snapshots/{snapshot_id}.
41
+ */
42
+ retrieveByName(name, options) {
43
+ return this._client.get(path `/api/v2/sandboxes/snapshots-by-name/${name}`, options);
44
+ }
35
45
  }
@@ -28,7 +28,7 @@ class Threads extends resource_js_1.APIResource {
28
28
  }
29
29
  /**
30
30
  * Query threads within a project (session), with cursor-based pagination. Returns
31
- * threads matching the given time range and optional filter.
31
+ * threads matching the given time range and optional filters.
32
32
  *
33
33
  * Self-hosted deployments require LangSmith `v0.16` or later.
34
34
  *
@@ -22,7 +22,7 @@ export declare class Threads extends APIResource {
22
22
  listTraces(threadID: string, query: ThreadListTracesParams, options?: RequestOptions): PagePromise<ThreadTracesItemsCursorGetPagination, ThreadTrace>;
23
23
  /**
24
24
  * Query threads within a project (session), with cursor-based pagination. Returns
25
- * threads matching the given time range and optional filter.
25
+ * threads matching the given time range and optional filters.
26
26
  *
27
27
  * Self-hosted deployments require LangSmith `v0.16` or later.
28
28
  *
@@ -658,6 +658,31 @@ export interface ThreadQueryParams extends ItemsCursorPostPaginationParams {
658
658
  * `project_id` is the tracing project UUID.
659
659
  */
660
660
  project_id?: string;
661
+ /**
662
+ * `thread_filter` narrows results using a LangSmith filter expression evaluated
663
+ * against each complete thread summary. Self-hosted deployments require LangSmith
664
+ * v0.17 or later; unsupported deployments return 501. See
665
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
666
+ * for syntax.
667
+ */
668
+ thread_filter?: string;
669
+ /**
670
+ * `trace_filter` narrows results to threads containing at least one trace whose
671
+ * root run matches this LangSmith filter expression. Trace-level aggregate fields
672
+ * are evaluated using the complete trace summary. Self-hosted deployments require
673
+ * LangSmith v0.17 or later; unsupported deployments return 501. See
674
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
675
+ * for syntax.
676
+ */
677
+ trace_filter?: string;
678
+ /**
679
+ * `tree_filter` narrows results to threads containing at least one trace with a
680
+ * matching run anywhere in its run tree. Self-hosted deployments require LangSmith
681
+ * v0.17 or later; unsupported deployments return 501. See
682
+ * https://docs.langchain.com/langsmith/trace-query-syntax#filter-query-language
683
+ * for syntax.
684
+ */
685
+ tree_filter?: string;
661
686
  }
662
687
  export interface ThreadStatsParams {
663
688
  /**
@@ -25,7 +25,7 @@ export class Threads extends APIResource {
25
25
  }
26
26
  /**
27
27
  * Query threads within a project (session), with cursor-based pagination. Returns
28
- * threads matching the given time range and optional filter.
28
+ * threads matching the given time range and optional filters.
29
29
  *
30
30
  * Self-hosted deployments require LangSmith `v0.16` or later.
31
31
  *
package/dist/index.cjs CHANGED
@@ -35,6 +35,6 @@ Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, g
35
35
  Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return error_js_1.RateLimitError; } });
36
36
  Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_js_1.InternalServerError; } });
37
37
  // Update using pnpm bump-version
38
- exports.__version__ = "0.8.10";
38
+ exports.__version__ = "0.8.12";
39
39
  // Metadata key to hide a traced run from LangSmith's Messages View.
40
40
  exports.LS_MESSAGE_VIEW_EXCLUDE = "ls_message_view_exclude";
package/dist/index.d.ts CHANGED
@@ -7,5 +7,5 @@ export { computeRunIdForSecondaryReplica, uuid7, uuid7FromTime, } from "./uuid.j
7
7
  export { isTracingEnabled } from "./utils/guard.js";
8
8
  export { Cache, PromptCache, type CacheConfig, type CacheMetrics, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
9
9
  export { LangsmithError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from "./_openapi_client/core/error.js";
10
- export declare const __version__ = "0.8.10";
10
+ export declare const __version__ = "0.8.12";
11
11
  export declare const LS_MESSAGE_VIEW_EXCLUDE: "ls_message_view_exclude";
package/dist/index.js CHANGED
@@ -7,6 +7,6 @@ export { isTracingEnabled } from "./utils/guard.js";
7
7
  export { Cache, PromptCache, configureGlobalPromptCache, promptCacheSingleton, } from "./utils/prompt_cache/index.js";
8
8
  export { LangsmithError, APIError, APIUserAbortError, APIConnectionError, APIConnectionTimeoutError, BadRequestError, AuthenticationError, PermissionDeniedError, NotFoundError, ConflictError, UnprocessableEntityError, RateLimitError, InternalServerError, } from "./_openapi_client/core/error.js";
9
9
  // Update using pnpm bump-version
10
- export const __version__ = "0.8.10";
10
+ export const __version__ = "0.8.12";
11
11
  // Metadata key to hide a traced run from LangSmith's Messages View.
12
12
  export const LS_MESSAGE_VIEW_EXCLUDE = "ls_message_view_exclude";
@@ -403,6 +403,10 @@ class SandboxClient {
403
403
  * Callers can add specific status checks (e.g. 404) before calling this.
404
404
  * @internal
405
405
  */
406
+ _boxUrl(name, ...segments) {
407
+ const suffix = segments.length ? `/${segments.join("/")}` : "";
408
+ return `${this._baseUrl}/boxes/${encodeURIComponent(name)}${suffix}`;
409
+ }
406
410
  async _postJson(url, body, options) {
407
411
  const response = await this._fetch(url, {
408
412
  method: "POST",
@@ -487,7 +491,7 @@ class SandboxClient {
487
491
  * @throws LangSmithResourceNotFoundError if sandbox not found.
488
492
  */
489
493
  async getSandbox(name, options) {
490
- const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}`;
494
+ const url = this._boxUrl(name);
491
495
  const response = await this._fetch(url, { signal: options?.signal });
492
496
  if (!response.ok) {
493
497
  if (response.status === 404) {
@@ -527,7 +531,7 @@ class SandboxClient {
527
531
  deleteAfterStopSeconds === undefined) {
528
532
  return this.getSandbox(name);
529
533
  }
530
- const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}`;
534
+ const url = this._boxUrl(name);
531
535
  const payload = {};
532
536
  if (newName !== undefined) {
533
537
  payload.name = newName;
@@ -564,7 +568,7 @@ class SandboxClient {
564
568
  * @throws LangSmithResourceNotFoundError if sandbox not found.
565
569
  */
566
570
  async deleteSandbox(name) {
567
- const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}`;
571
+ const url = this._boxUrl(name);
568
572
  const response = await this._fetch(url, { method: "DELETE" });
569
573
  if (!response.ok) {
570
574
  if (response.status === 404) {
@@ -584,7 +588,7 @@ class SandboxClient {
584
588
  * @throws LangSmithResourceNotFoundError if sandbox not found.
585
589
  */
586
590
  async getSandboxStatus(name, options) {
587
- const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}/status`;
591
+ const url = this._boxUrl(name, "status");
588
592
  const response = await this._fetch(url, { signal: options?.signal });
589
593
  if (!response.ok) {
590
594
  if (response.status === 404) {
@@ -647,17 +651,61 @@ class SandboxClient {
647
651
  */
648
652
  async startSandbox(name, options = {}) {
649
653
  const { timeout = 120, signal } = options;
650
- const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}/start`;
654
+ const url = this._boxUrl(name, "start");
651
655
  await this._postJson(url, {}, { signal });
652
656
  return this.waitForSandbox(name, { timeout, signal });
653
657
  }
658
+ /**
659
+ * Create a link that downloads one file from a sandbox.
660
+ *
661
+ * The link carries its own token, so anyone holding the URL can fetch that
662
+ * one file without a LangSmith credential. It is pinned to the sandbox and
663
+ * the exact path and cannot be repointed at another file. Fetching wakes a
664
+ * stopped sandbox.
665
+ *
666
+ * Do not modify the file after minting a link for it. The link is pinned to
667
+ * a path, not to a snapshot of the contents, so a later write to that path
668
+ * may or may not be reflected in what the link serves. Write a new file and
669
+ * mint a new link when the contents change.
670
+ *
671
+ * @param name - Sandbox name.
672
+ * @param path - File path inside the sandbox.
673
+ * @param options - Expiry and response header overrides.
674
+ * @returns The link and its expiry, if any.
675
+ *
676
+ * @example
677
+ * ```typescript
678
+ * const link = await client.generateDownloadURL("my-vm", "/tmp/report.pdf");
679
+ * console.log(link.download_url);
680
+ * ```
681
+ */
682
+ async generateDownloadURL(name, path, options = {}) {
683
+ const { expiresInSeconds, contentType, contentDisposition, signal } = options;
684
+ if (expiresInSeconds !== undefined && expiresInSeconds < 1) {
685
+ throw new errors_js_1.LangSmithValidationError(`expiresInSeconds must be greater than 0 (got ${expiresInSeconds}); ` +
686
+ `omit it for a link that never expires`);
687
+ }
688
+ const url = this._boxUrl(name, "download-url");
689
+ const payload = { path };
690
+ if (expiresInSeconds !== undefined) {
691
+ payload.expires_in_seconds = expiresInSeconds;
692
+ }
693
+ if (contentType !== undefined) {
694
+ payload.content_type = contentType;
695
+ }
696
+ if (contentDisposition !== undefined) {
697
+ payload.content_disposition = contentDisposition;
698
+ }
699
+ const response = await this._postJson(url, payload, { signal });
700
+ return (await response.json());
701
+ }
654
702
  /**
655
703
  * Stop a running sandbox (preserves sandbox files for later restart).
656
704
  *
657
705
  * @param name - Sandbox name.
658
706
  */
659
707
  async stopSandbox(name) {
660
- const url = `${this._baseUrl}/boxes/${encodeURIComponent(name)}/stop`;
708
+ const url = this._boxUrl(name, "stop");
661
709
  await this._postJson(url, {});
662
710
  }
663
711
  // =========================================================================
@@ -698,13 +746,19 @@ class SandboxClient {
698
746
  *
699
747
  * @param name - Snapshot name.
700
748
  * @param dockerfile - Local Dockerfile path, relative to context by default.
701
- * @param fsCapacityBytes - Filesystem capacity in bytes.
702
- * @param options - Build context, args, target, build log callback, builder
703
- * vCPUs/memory, timeout.
749
+ * @param fsCapacityBytesOrOptions - Optional filesystem capacity in bytes, or
750
+ * build options. When omitted, the server applies its default capacity.
751
+ * @param options - Build options when capacity is passed separately.
704
752
  * @returns Snapshot in "ready" status.
705
753
  */
706
- async createSnapshotFromDockerfile(name, dockerfile, fsCapacityBytes, options = {}) {
707
- const { context = ".", buildArgs, target, onBuildLog, vCpus, memBytes, timeout = 60, } = options;
754
+ async createSnapshotFromDockerfile(name, dockerfile, fsCapacityBytesOrOptions, options = {}) {
755
+ const fsCapacityBytes = typeof fsCapacityBytesOrOptions === "number"
756
+ ? fsCapacityBytesOrOptions
757
+ : undefined;
758
+ const resolvedOptions = typeof fsCapacityBytesOrOptions === "number"
759
+ ? options
760
+ : (fsCapacityBytesOrOptions ?? options);
761
+ const { context = ".", buildArgs, target, onBuildLog, vCpus, memBytes, timeout = 60, } = resolvedOptions;
708
762
  const { contextPath, dockerfileRel } = await resolveDockerfileContext(dockerfile, context);
709
763
  const builderName = `snapshot-builder-${(0, index_js_2.v4)().replace(/-/g, "").slice(0, 12)}`;
710
764
  // Stage the build on the capacity-backed root filesystem, not /tmp.
@@ -772,7 +826,7 @@ class SandboxClient {
772
826
  */
773
827
  async captureSnapshot(sandboxName, name, options = {}) {
774
828
  const { dockerImage, fsCapacityBytes, timeout = 60, signal } = options;
775
- const url = `${this._baseUrl}/boxes/${encodeURIComponent(sandboxName)}/snapshot`;
829
+ const url = this._boxUrl(sandboxName, "snapshot");
776
830
  const payload = { name };
777
831
  if (dockerImage !== undefined) {
778
832
  payload.docker_image = dockerImage;
@@ -2,7 +2,7 @@
2
2
  * Main SandboxClient class for interacting with the sandbox server API.
3
3
  */
4
4
  import { Registries } from "../_openapi_client/resources/sandboxes/registries.js";
5
- import type { CaptureSnapshotOptions, CreateDockerfileSnapshotOptions, CreateSandboxOptions, CreateSnapshotOptions, ListSnapshotsOptions, ResourceStatus, SandboxClientConfig, Snapshot, StartSandboxOptions, UpdateSandboxOptions, WaitForSandboxOptions, WaitForSnapshotOptions } from "./types.js";
5
+ import type { CaptureSnapshotOptions, CreateDockerfileSnapshotOptions, CreateSandboxOptions, CreateSnapshotOptions, DownloadURL, GenerateDownloadURLOptions, ListSnapshotsOptions, ResourceStatus, SandboxClientConfig, Snapshot, StartSandboxOptions, UpdateSandboxOptions, WaitForSandboxOptions, WaitForSnapshotOptions } from "./types.js";
6
6
  import { Sandbox } from "./sandbox.js";
7
7
  /**
8
8
  * Client for interacting with the Sandbox Server API.
@@ -64,6 +64,7 @@ export declare class SandboxClient {
64
64
  * ```
65
65
  */
66
66
  get registries(): Registries;
67
+ private _postJson;
67
68
  /**
68
69
  * Create a new Sandbox.
69
70
  *
@@ -181,6 +182,31 @@ export declare class SandboxClient {
181
182
  * @returns Sandbox in "ready" status.
182
183
  */
183
184
  startSandbox(name: string, options?: StartSandboxOptions): Promise<Sandbox>;
185
+ /**
186
+ * Create a link that downloads one file from a sandbox.
187
+ *
188
+ * The link carries its own token, so anyone holding the URL can fetch that
189
+ * one file without a LangSmith credential. It is pinned to the sandbox and
190
+ * the exact path and cannot be repointed at another file. Fetching wakes a
191
+ * stopped sandbox.
192
+ *
193
+ * Do not modify the file after minting a link for it. The link is pinned to
194
+ * a path, not to a snapshot of the contents, so a later write to that path
195
+ * may or may not be reflected in what the link serves. Write a new file and
196
+ * mint a new link when the contents change.
197
+ *
198
+ * @param name - Sandbox name.
199
+ * @param path - File path inside the sandbox.
200
+ * @param options - Expiry and response header overrides.
201
+ * @returns The link and its expiry, if any.
202
+ *
203
+ * @example
204
+ * ```typescript
205
+ * const link = await client.generateDownloadURL("my-vm", "/tmp/report.pdf");
206
+ * console.log(link.download_url);
207
+ * ```
208
+ */
209
+ generateDownloadURL(name: string, path: string, options?: GenerateDownloadURLOptions): Promise<DownloadURL>;
184
210
  /**
185
211
  * Stop a running sandbox (preserves sandbox files for later restart).
186
212
  *
@@ -208,12 +234,12 @@ export declare class SandboxClient {
208
234
  *
209
235
  * @param name - Snapshot name.
210
236
  * @param dockerfile - Local Dockerfile path, relative to context by default.
211
- * @param fsCapacityBytes - Filesystem capacity in bytes.
212
- * @param options - Build context, args, target, build log callback, builder
213
- * vCPUs/memory, timeout.
237
+ * @param fsCapacityBytesOrOptions - Optional filesystem capacity in bytes, or
238
+ * build options. When omitted, the server applies its default capacity.
239
+ * @param options - Build options when capacity is passed separately.
214
240
  * @returns Snapshot in "ready" status.
215
241
  */
216
- createSnapshotFromDockerfile(name: string, dockerfile: string, fsCapacityBytes: number, options?: CreateDockerfileSnapshotOptions): Promise<Snapshot>;
242
+ createSnapshotFromDockerfile(name: string, dockerfile: string, fsCapacityBytesOrOptions?: number | CreateDockerfileSnapshotOptions, options?: CreateDockerfileSnapshotOptions): Promise<Snapshot>;
217
243
  /**
218
244
  * Capture a snapshot from a running sandbox.
219
245
  *