langsmith 0.8.12 → 0.10.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.
Files changed (56) hide show
  1. package/dist/_openapi_client/client.cjs +1 -1
  2. package/dist/_openapi_client/client.d.ts +2 -2
  3. package/dist/_openapi_client/client.js +1 -1
  4. package/dist/_openapi_client/internal/detect-platform.cjs +1 -1
  5. package/dist/_openapi_client/internal/detect-platform.js +1 -1
  6. package/dist/_openapi_client/resources/annotation-queues/annotation-queues.d.ts +1 -0
  7. package/dist/_openapi_client/resources/index.d.ts +1 -1
  8. package/dist/_openapi_client/resources/issues.cjs +1 -1
  9. package/dist/_openapi_client/resources/issues.d.ts +18 -1
  10. package/dist/_openapi_client/resources/issues.js +1 -1
  11. package/dist/_openapi_client/resources/online-evaluators.d.ts +2 -2
  12. package/dist/_openapi_client/resources/sandboxes/boxes.cjs +20 -3
  13. package/dist/_openapi_client/resources/sandboxes/boxes.d.ts +40 -9
  14. package/dist/_openapi_client/resources/sandboxes/boxes.js +20 -3
  15. package/dist/_openapi_client/resources/sandboxes/sandboxes.d.ts +46 -3
  16. package/dist/_openapi_client/resources/sandboxes/snapshots.cjs +6 -2
  17. package/dist/_openapi_client/resources/sandboxes/snapshots.d.ts +16 -6
  18. package/dist/_openapi_client/resources/sandboxes/snapshots.js +6 -2
  19. package/dist/client.cjs +56 -83
  20. package/dist/client.d.ts +16 -14
  21. package/dist/client.js +56 -83
  22. package/dist/env.cjs +14 -1
  23. package/dist/env.d.ts +9 -0
  24. package/dist/env.js +12 -0
  25. package/dist/evaluation/evaluate_comparative.cjs +2 -0
  26. package/dist/evaluation/evaluate_comparative.js +2 -0
  27. package/dist/experimental/vercel/telemetry.cjs +19 -6
  28. package/dist/experimental/vercel/telemetry.js +17 -4
  29. package/dist/index.cjs +1 -1
  30. package/dist/index.d.ts +1 -1
  31. package/dist/index.js +1 -1
  32. package/dist/run_trees.cjs +19 -2
  33. package/dist/run_trees.d.ts +12 -0
  34. package/dist/run_trees.js +19 -2
  35. package/dist/schemas.d.ts +2 -0
  36. package/dist/singletons/constants.cjs +7 -1
  37. package/dist/singletons/constants.d.ts +3 -0
  38. package/dist/singletons/constants.js +5 -0
  39. package/dist/traceable.cjs +46 -15
  40. package/dist/traceable.js +48 -17
  41. package/dist/utils/_uuid.cjs +11 -19
  42. package/dist/utils/_uuid.d.ts +7 -7
  43. package/dist/utils/_uuid.js +11 -19
  44. package/dist/utils/env.cjs +18 -7
  45. package/dist/utils/env.js +18 -7
  46. package/dist/utils/redaction.cjs +38 -0
  47. package/dist/utils/redaction.d.ts +10 -0
  48. package/dist/utils/redaction.js +33 -0
  49. package/dist/utils/sampling.cjs +34 -0
  50. package/dist/utils/sampling.d.ts +10 -0
  51. package/dist/utils/sampling.js +30 -0
  52. package/dist/wrappers/anthropic.cjs +21 -24
  53. package/dist/wrappers/anthropic.js +21 -24
  54. package/dist/wrappers/openai_agents.cjs +2 -1
  55. package/dist/wrappers/openai_agents.js +2 -1
  56. package/package.json +1 -1
@@ -229,7 +229,7 @@ class Langsmith {
229
229
  baseURL: baseURL || `https://api.smith.langchain.com/`,
230
230
  };
231
231
  this.baseURL = options.baseURL;
232
- this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1.5 minutes */;
232
+ this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT; /* 1.5 minutes */
233
233
  this.logger = options.logger ?? console;
234
234
  const defaultLogLevel = 'warn';
235
235
  // Set default logLevel early so that we can log a warning in parseLogLevel.
@@ -17,7 +17,7 @@ import { AnnotationQueueAnnotationQueuesParams, AnnotationQueueCreateRunStatusPa
17
17
  import { DataType, Dataset, DatasetTransformation, DatasetVersion, Datasets, FeedbackCreateCoreSchema, Missing, SortByDatasetColumn } from './resources/datasets/datasets.js';
18
18
  import { Public } from './resources/public/public.js';
19
19
  import { ResponseBodyForRunsGenerateQuery, Run, RunGetURLParams, RunGetURLResponse, RunIngest, RunQueryParams, RunQueryV2Params, RunRetrieveParams, RunRetrieveV2Params, RunSchema, RunSelectField, RunStatsQueryParams, RunType, RunTypeEnum, Runs, RunsFilterDataSourceTypeEnum, RunsItemsCursorPostPagination } from './resources/runs/runs.js';
20
- import { SandboxListResponse, SandboxResponse, SandboxStatusResponse, Sandboxes, ServiceURLResponse, SnapshotListResponse, SnapshotResponse } from './resources/sandboxes/sandboxes.js';
20
+ import { DownloadURLResponse, SandboxListResponse, SandboxResponse, SandboxStatusResponse, Sandboxes, ServiceURLResponse, SnapshotListResponse, SnapshotResponse } from './resources/sandboxes/sandboxes.js';
21
21
  import { type Fetch } from './internal/builtin-types.js';
22
22
  import { HeadersLike, NullableHeaders } from './internal/headers.js';
23
23
  import { FinalRequestOptions, RequestOptions } from './internal/request-options.js';
@@ -230,5 +230,5 @@ export declare namespace Langsmith {
230
230
  export { AnnotationQueues as AnnotationQueues, type AnnotationQueueRubricItemSchema as AnnotationQueueRubricItemSchema, type AnnotationQueueSchema as AnnotationQueueSchema, type AnnotationQueueSizeSchema as AnnotationQueueSizeSchema, type RunSchemaWithAnnotationQueueInfo as RunSchemaWithAnnotationQueueInfo, type AnnotationQueueRetrieveResponse as AnnotationQueueRetrieveResponse, type AnnotationQueueUpdateResponse as AnnotationQueueUpdateResponse, type AnnotationQueueDeleteResponse as AnnotationQueueDeleteResponse, type AnnotationQueueCreateRunStatusResponse as AnnotationQueueCreateRunStatusResponse, type AnnotationQueueExportResponse as AnnotationQueueExportResponse, type AnnotationQueuePopulateResponse as AnnotationQueuePopulateResponse, type AnnotationQueueRetrieveAnnotationQueuesResponse as AnnotationQueueRetrieveAnnotationQueuesResponse, type AnnotationQueueRetrieveQueuesResponse as AnnotationQueueRetrieveQueuesResponse, type AnnotationQueueRetrieveAnnotationQueuesResponsesOffsetPaginationTopLevelArray as AnnotationQueueRetrieveAnnotationQueuesResponsesOffsetPaginationTopLevelArray, type AnnotationQueueUpdateParams as AnnotationQueueUpdateParams, type AnnotationQueueAnnotationQueuesParams as AnnotationQueueAnnotationQueuesParams, type AnnotationQueueCreateRunStatusParams as AnnotationQueueCreateRunStatusParams, type AnnotationQueueExportParams as AnnotationQueueExportParams, type AnnotationQueuePopulateParams as AnnotationQueuePopulateParams, type AnnotationQueueRetrieveAnnotationQueuesParams as AnnotationQueueRetrieveAnnotationQueuesParams, type AnnotationQueueRetrieveRunParams as AnnotationQueueRetrieveRunParams, type AnnotationQueueRetrieveSizeParams as AnnotationQueueRetrieveSizeParams, type AnnotationQueueRetrieveTotalArchivedParams as AnnotationQueueRetrieveTotalArchivedParams, };
231
231
  export { Info as Info, type InfoListResponse as InfoListResponse };
232
232
  export { Issues as Issues, type Issue as Issue, type IssuesOffsetPaginationIssues as IssuesOffsetPaginationIssues, type IssueListParams as IssueListParams, };
233
- export { Sandboxes as Sandboxes, type SandboxListResponse as SandboxListResponse, type SandboxResponse as SandboxResponse, type SandboxStatusResponse as SandboxStatusResponse, type ServiceURLResponse as ServiceURLResponse, type SnapshotListResponse as SnapshotListResponse, type SnapshotResponse as SnapshotResponse, };
233
+ export { Sandboxes as Sandboxes, type DownloadURLResponse as DownloadURLResponse, type SandboxListResponse as SandboxListResponse, type SandboxResponse as SandboxResponse, type SandboxStatusResponse as SandboxStatusResponse, type ServiceURLResponse as ServiceURLResponse, type SnapshotListResponse as SnapshotListResponse, type SnapshotResponse as SnapshotResponse, };
234
234
  }
@@ -193,7 +193,7 @@ export class Langsmith {
193
193
  baseURL: baseURL || `https://api.smith.langchain.com/`,
194
194
  };
195
195
  this.baseURL = options.baseURL;
196
- this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT /* 1.5 minutes */;
196
+ this.timeout = options.timeout ?? _a.DEFAULT_TIMEOUT; /* 1.5 minutes */
197
197
  this.logger = options.logger ?? console;
198
198
  const defaultLogLevel = 'warn';
199
199
  // Set default logLevel early so that we can log a warning in parseLogLevel.
@@ -38,7 +38,7 @@ const getPlatformProperties = () => {
38
38
  'X-Stainless-OS': normalizePlatform(Deno.build.os),
39
39
  'X-Stainless-Arch': normalizeArch(Deno.build.arch),
40
40
  'X-Stainless-Runtime': 'deno',
41
- 'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
41
+ 'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : (Deno.version?.deno ?? 'unknown'),
42
42
  };
43
43
  }
44
44
  if (typeof EdgeRuntime !== 'undefined') {
@@ -34,7 +34,7 @@ const getPlatformProperties = () => {
34
34
  'X-Stainless-OS': normalizePlatform(Deno.build.os),
35
35
  'X-Stainless-Arch': normalizeArch(Deno.build.arch),
36
36
  'X-Stainless-Runtime': 'deno',
37
- 'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : Deno.version?.deno ?? 'unknown',
37
+ 'X-Stainless-Runtime-Version': typeof Deno.version === 'string' ? Deno.version : (Deno.version?.deno ?? 'unknown'),
38
38
  };
39
39
  }
40
40
  if (typeof EdgeRuntime !== 'undefined') {
@@ -80,6 +80,7 @@ export interface AnnotationQueueRubricItemSchema {
80
80
  description?: string | null;
81
81
  is_assertion?: boolean | null;
82
82
  is_required?: boolean | null;
83
+ regex_validator?: string | DatasetsAPI.Missing | null;
83
84
  score_descriptions?: {
84
85
  [key: string]: string;
85
86
  } | null;
@@ -5,6 +5,6 @@ export { Issues, type Issue, type IssueListParams, type IssuesOffsetPaginationIs
5
5
  export { OnlineEvaluators, type BulkDeleteEvaluatorFailedItem, type BulkDeleteEvaluatorsResponse, type CreateOnlineCodeEvaluatorRequest, type CreateOnlineEvaluatorRequest, type CreateOnlineEvaluatorResponse, type CreateOnlineLlmEvaluatorRequest, type GetOnlineEvaluatorSpendResponse, type OnlineCodeEvaluator, type OnlineEvaluator, type OnlineEvaluatorRunRule, type OnlineEvaluatorSpendDay, type OnlineEvaluatorSpendGroup, type OnlineEvaluatorType, type OnlineLlmEvaluator, type OnlineSpendLimit, type UpdateOnlineCodeEvaluatorRequest, type UpdateOnlineEvaluatorRequest, type UpdateOnlineEvaluatorResponse, type UpdateOnlineLlmEvaluatorRequest, type OnlineEvaluatorCreateParams, type OnlineEvaluatorUpdateParams, type OnlineEvaluatorListParams, type OnlineEvaluatorDeleteParams, type OnlineEvaluatorBulkDeleteParams, type OnlineEvaluatorSpendParams, type OnlineEvaluatorsOffsetPaginationOnlineEvaluators, } from './online-evaluators.js';
6
6
  export { Public } from './public/public.js';
7
7
  export { Runs, type ResponseBodyForRunsGenerateQuery, type Run, type RunIngest, type RunSchema, type RunSelectField, type RunStatsQueryParams, type RunType, type RunTypeEnum, type RunsFilterDataSourceTypeEnum, type RunGetURLResponse, type RunGetURLParams, type RunQueryV2Params, type RunRetrieveV2Params, type RunRetrieveParams, type RunQueryParams, type RunsItemsCursorPostPagination, } from './runs/runs.js';
8
- export { Sandboxes, type SandboxListResponse, type SandboxResponse, type SandboxStatusResponse, type ServiceURLResponse, type SnapshotListResponse, type SnapshotResponse, } from './sandboxes/sandboxes.js';
8
+ export { Sandboxes, type DownloadURLResponse, type SandboxListResponse, type SandboxResponse, type SandboxStatusResponse, type ServiceURLResponse, type SnapshotListResponse, type SnapshotResponse, type SandboxResponsesItemsCursorGetPagination, type SnapshotResponsesItemsCursorGetPagination, } from './sandboxes/sandboxes.js';
9
9
  export { Threads, type Thread, type ThreadStats, type ThreadTrace, type ThreadListTracesParams, type ThreadQueryParams, type ThreadStatsParams, type ThreadTracesItemsCursorGetPagination, type ThreadsItemsCursorPostPagination, } from './threads.js';
10
10
  export { Traces, type Trace, type TraceAggregates, type TraceListRunsResponse, type TraceListRunsParams, type TraceQueryParams, type TracesItemsCursorPostPagination, } from './traces.js';
@@ -19,7 +19,7 @@ class Issues extends resource_js_1.APIResource {
19
19
  * **Beta:** This endpoint is in active development and may change without notice.
20
20
  *
21
21
  * Returns issues for the authenticated tenant, optionally filtered by session,
22
- * status, severity, tag, or last modified time.
22
+ * status, severity, tag, linked trace, or last modified time.
23
23
  */
24
24
  list(query = {}, options) {
25
25
  return this._client.getAPIList('/api/v1/platform/issues', (pagination_js_1.OffsetPaginationIssues), {
@@ -13,7 +13,7 @@ export declare class Issues extends APIResource {
13
13
  * **Beta:** This endpoint is in active development and may change without notice.
14
14
  *
15
15
  * Returns issues for the authenticated tenant, optionally filtered by session,
16
- * status, severity, tag, or last modified time.
16
+ * status, severity, tag, linked trace, or last modified time.
17
17
  */
18
18
  list(query?: IssueListParams | null | undefined, options?: RequestOptions): PagePromise<IssuesOffsetPaginationIssues, Issue>;
19
19
  }
@@ -36,6 +36,7 @@ export interface Issue {
36
36
  fix_prompt?: string;
37
37
  fix_verification?: unknown;
38
38
  last_seen_at?: string;
39
+ linear_sync?: Issue.LinearSync;
39
40
  name?: string;
40
41
  proposed_context_fixes?: Array<unknown>;
41
42
  proposed_examples?: Array<unknown>;
@@ -55,6 +56,18 @@ export interface Issue {
55
56
  updated_at?: string;
56
57
  watching_since?: string;
57
58
  }
59
+ export declare namespace Issue {
60
+ interface LinearSync {
61
+ identifier?: string;
62
+ issue_id?: string;
63
+ last_attempted_at?: string;
64
+ last_error?: string;
65
+ last_synced_at?: string;
66
+ linear_issue_id?: string;
67
+ state?: 'pending' | 'synced' | 'failed' | 'auth_required' | 'paused';
68
+ url?: string;
69
+ }
70
+ }
58
71
  export interface IssueListParams extends OffsetPaginationIssuesParams {
59
72
  /**
60
73
  * Filter by session ID (UUID)
@@ -80,6 +93,10 @@ export interface IssueListParams extends OffsetPaginationIssuesParams {
80
93
  * Filter by tag (exact match)
81
94
  */
82
95
  tag?: string;
96
+ /**
97
+ * Return only issues with a linked run in this trace
98
+ */
99
+ trace_id?: string;
83
100
  /**
84
101
  * Return only issues updated at or after this RFC3339 timestamp
85
102
  */
@@ -16,7 +16,7 @@ export class Issues extends APIResource {
16
16
  * **Beta:** This endpoint is in active development and may change without notice.
17
17
  *
18
18
  * Returns issues for the authenticated tenant, optionally filtered by session,
19
- * status, severity, tag, or last modified time.
19
+ * status, severity, tag, linked trace, or last modified time.
20
20
  */
21
21
  list(query = {}, options) {
22
22
  return this._client.getAPIList('/api/v1/platform/issues', (OffsetPaginationIssues), {
@@ -93,8 +93,8 @@ export interface OnlineEvaluator {
93
93
  created_by?: string;
94
94
  feedback_keys?: Array<string>;
95
95
  /**
96
- * IsManaged marks a LangChain-managed evaluator (currently the managed Perceived
97
- * Error judge). NULL in the DB is read as false via COALESCE.
96
+ * IsManaged marks a LangChain Tuned Evaluator (currently the tuned Perceived Error
97
+ * judge). NULL in the DB is read as false via COALESCE.
98
98
  */
99
99
  is_managed?: boolean;
100
100
  /**
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.Boxes = void 0;
6
6
  const resource_js_1 = require("../../core/resource.cjs");
7
+ const pagination_js_1 = require("../../core/pagination.cjs");
7
8
  const headers_js_1 = require("../../internal/headers.cjs");
8
9
  const path_js_1 = require("../../internal/utils/path.cjs");
9
10
  class Boxes extends resource_js_1.APIResource {
@@ -23,17 +24,22 @@ class Boxes extends resource_js_1.APIResource {
23
24
  return this._client.get((0, path_js_1.path) `/api/v2/sandboxes/boxes/${name}`, options);
24
25
  }
25
26
  /**
26
- * Update a sandbox's display name. The name must be unique within the tenant.
27
+ * Update a sandbox's display name, retention, resources, tags, or proxy
28
+ * configuration. The name must be unique within the tenant. Proxy configuration
29
+ * sent to a sandbox that is not running is stored and applied when it next starts.
27
30
  */
28
31
  update(name, body, options) {
29
32
  return this._client.patch((0, path_js_1.path) `/api/v2/sandboxes/boxes/${name}`, { body, ...options });
30
33
  }
31
34
  /**
32
35
  * List sandboxes for the authenticated tenant, with optional filtering, sorting,
33
- * and pagination.
36
+ * and pagination. Page with page_size and cursor: replay the response's
37
+ * next_cursor until it comes back null, which is the only signal that no pages
38
+ * remain. Cursors are opaque and only valid on this endpoint; do not parse or
39
+ * construct one.
34
40
  */
35
41
  list(query = {}, options) {
36
- return this._client.get('/api/v2/sandboxes/boxes', { query, ...options });
42
+ return this._client.getAPIList('/api/v2/sandboxes/boxes', (pagination_js_1.ItemsCursorGetPagination), { query, ...options });
37
43
  }
38
44
  /**
39
45
  * Delete a sandbox by name or UUID. Tears down the sandbox runtime and removes the
@@ -52,6 +58,17 @@ class Boxes extends resource_js_1.APIResource {
52
58
  createSnapshot(name, body, options) {
53
59
  return this._client.post((0, path_js_1.path) `/api/v2/sandboxes/boxes/${name}/snapshot`, { body, ...options });
54
60
  }
61
+ /**
62
+ * Generate a tokenized link that downloads a single file from a sandbox with no
63
+ * further authentication. This mints a token rather than creating an addressable
64
+ * resource, so it returns 200 with no Location header. The token pins the sandbox,
65
+ * the file path, and the response content type and disposition, so a link cannot
66
+ * be repointed at another file. Links never expire unless expires_in_seconds is
67
+ * set. The link is served from the sandbox service domain, not the API host.
68
+ */
69
+ generateDownloadURL(name, body, options) {
70
+ return this._client.post((0, path_js_1.path) `/api/v2/sandboxes/boxes/${name}/download-url`, { body, ...options });
71
+ }
55
72
  /**
56
73
  * Create a short-lived JWT for accessing an HTTP service running on a specific
57
74
  * port inside a sandbox. Returns a browser_url (sets auth cookie via redirect), a
@@ -1,6 +1,8 @@
1
1
  import { APIResource } from '../../core/resource.js';
2
2
  import * as SandboxesAPI from './sandboxes.js';
3
+ import { SandboxResponsesItemsCursorGetPagination } from './sandboxes.js';
3
4
  import { APIPromise } from '../../core/api-promise.js';
5
+ import { type ItemsCursorGetPaginationParams, PagePromise } from '../../core/pagination.js';
4
6
  import { RequestOptions } from '../../internal/request-options.js';
5
7
  export declare class Boxes extends APIResource {
6
8
  /**
@@ -15,14 +17,19 @@ export declare class Boxes extends APIResource {
15
17
  */
16
18
  retrieve(name: string, options?: RequestOptions): APIPromise<SandboxesAPI.SandboxResponse>;
17
19
  /**
18
- * Update a sandbox's display name. The name must be unique within the tenant.
20
+ * Update a sandbox's display name, retention, resources, tags, or proxy
21
+ * configuration. The name must be unique within the tenant. Proxy configuration
22
+ * sent to a sandbox that is not running is stored and applied when it next starts.
19
23
  */
20
24
  update(name: string, body: BoxUpdateParams, options?: RequestOptions): APIPromise<SandboxesAPI.SandboxResponse>;
21
25
  /**
22
26
  * List sandboxes for the authenticated tenant, with optional filtering, sorting,
23
- * and pagination.
27
+ * and pagination. Page with page_size and cursor: replay the response's
28
+ * next_cursor until it comes back null, which is the only signal that no pages
29
+ * remain. Cursors are opaque and only valid on this endpoint; do not parse or
30
+ * construct one.
24
31
  */
25
- list(query?: BoxListParams | null | undefined, options?: RequestOptions): APIPromise<SandboxesAPI.SandboxListResponse>;
32
+ list(query?: BoxListParams | null | undefined, options?: RequestOptions): PagePromise<SandboxResponsesItemsCursorGetPagination, SandboxesAPI.SandboxResponse>;
26
33
  /**
27
34
  * Delete a sandbox by name or UUID. Tears down the sandbox runtime and removes the
28
35
  * DB record.
@@ -33,6 +40,15 @@ export declare class Boxes extends APIResource {
33
40
  * existing checkpoint.
34
41
  */
35
42
  createSnapshot(name: string, body: BoxCreateSnapshotParams, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotResponse>;
43
+ /**
44
+ * Generate a tokenized link that downloads a single file from a sandbox with no
45
+ * further authentication. This mints a token rather than creating an addressable
46
+ * resource, so it returns 200 with no Location header. The token pins the sandbox,
47
+ * the file path, and the response content type and disposition, so a link cannot
48
+ * be repointed at another file. Links never expire unless expires_in_seconds is
49
+ * set. The link is served from the sandbox service domain, not the API host.
50
+ */
51
+ generateDownloadURL(name: string, body: BoxGenerateDownloadURLParams, options?: RequestOptions): APIPromise<SandboxesAPI.DownloadURLResponse>;
36
52
  /**
37
53
  * Create a short-lived JWT for accessing an HTTP service running on a specific
38
54
  * port inside a sandbox. Returns a browser_url (sets auth cookie via redirect), a
@@ -555,7 +571,7 @@ export declare namespace BoxUpdateParams {
555
571
  }
556
572
  }
557
573
  }
558
- export interface BoxListParams {
574
+ export interface BoxListParams extends ItemsCursorGetPaginationParams {
559
575
  /**
560
576
  * Filter by creator identity. Only 'me' is supported.
561
577
  */
@@ -566,7 +582,7 @@ export interface BoxListParams {
566
582
  */
567
583
  label?: Array<string>;
568
584
  /**
569
- * Maximum number of results
585
+ * Deprecated: use page_size. Maximum number of results
570
586
  */
571
587
  limit?: number;
572
588
  /**
@@ -574,17 +590,22 @@ export interface BoxListParams {
574
590
  */
575
591
  name_contains?: string;
576
592
  /**
577
- * Pagination offset
593
+ * Deprecated: use cursor. Pagination offset
578
594
  */
579
595
  offset?: number;
580
596
  /**
581
- * Sort column (name, status, created_at)
597
+ * Sort column (name, status, created_at, stopped_at, idle_ttl_seconds,
598
+ * delete_after_stop_seconds)
582
599
  */
583
600
  sort_by?: string;
584
601
  /**
585
- * Sort direction (asc, desc)
602
+ * Deprecated: use sort_order. Sort direction (asc, desc)
586
603
  */
587
604
  sort_direction?: string;
605
+ /**
606
+ * Sort direction (asc, desc)
607
+ */
608
+ sort_order?: string;
588
609
  /**
589
610
  * Filter by status (provisioning, ready, failed, stopped, deleting)
590
611
  */
@@ -622,10 +643,20 @@ export interface BoxCreateSnapshotParams {
622
643
  */
623
644
  tag?: string;
624
645
  }
646
+ export interface BoxGenerateDownloadURLParams {
647
+ path: string;
648
+ content_disposition?: string;
649
+ content_type?: string;
650
+ /**
651
+ * ExpiresInSeconds is optional; a link with no expiry never expires.
652
+ */
653
+ expires_in_seconds?: number;
654
+ }
625
655
  export interface BoxGenerateServiceURLParams {
626
656
  expires_in_seconds?: number;
627
657
  port?: number;
628
658
  }
629
659
  export declare namespace Boxes {
630
- export { type BoxCreateParams as BoxCreateParams, type BoxUpdateParams as BoxUpdateParams, type BoxListParams as BoxListParams, type BoxCreateSnapshotParams as BoxCreateSnapshotParams, type BoxGenerateServiceURLParams as BoxGenerateServiceURLParams, };
660
+ export { type BoxCreateParams as BoxCreateParams, type BoxUpdateParams as BoxUpdateParams, type BoxListParams as BoxListParams, type BoxCreateSnapshotParams as BoxCreateSnapshotParams, type BoxGenerateDownloadURLParams as BoxGenerateDownloadURLParams, type BoxGenerateServiceURLParams as BoxGenerateServiceURLParams, };
631
661
  }
662
+ export { type SandboxResponsesItemsCursorGetPagination };
@@ -1,6 +1,7 @@
1
1
  // @ts-nocheck
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  import { APIResource } from '../../core/resource.js';
4
+ import { ItemsCursorGetPagination, } from '../../core/pagination.js';
4
5
  import { buildHeaders } from '../../internal/headers.js';
5
6
  import { path } from '../../internal/utils/path.js';
6
7
  export class Boxes extends APIResource {
@@ -20,17 +21,22 @@ export class Boxes extends APIResource {
20
21
  return this._client.get(path `/api/v2/sandboxes/boxes/${name}`, options);
21
22
  }
22
23
  /**
23
- * Update a sandbox's display name. The name must be unique within the tenant.
24
+ * Update a sandbox's display name, retention, resources, tags, or proxy
25
+ * configuration. The name must be unique within the tenant. Proxy configuration
26
+ * sent to a sandbox that is not running is stored and applied when it next starts.
24
27
  */
25
28
  update(name, body, options) {
26
29
  return this._client.patch(path `/api/v2/sandboxes/boxes/${name}`, { body, ...options });
27
30
  }
28
31
  /**
29
32
  * List sandboxes for the authenticated tenant, with optional filtering, sorting,
30
- * and pagination.
33
+ * and pagination. Page with page_size and cursor: replay the response's
34
+ * next_cursor until it comes back null, which is the only signal that no pages
35
+ * remain. Cursors are opaque and only valid on this endpoint; do not parse or
36
+ * construct one.
31
37
  */
32
38
  list(query = {}, options) {
33
- return this._client.get('/api/v2/sandboxes/boxes', { query, ...options });
39
+ return this._client.getAPIList('/api/v2/sandboxes/boxes', (ItemsCursorGetPagination), { query, ...options });
34
40
  }
35
41
  /**
36
42
  * Delete a sandbox by name or UUID. Tears down the sandbox runtime and removes the
@@ -49,6 +55,17 @@ export class Boxes extends APIResource {
49
55
  createSnapshot(name, body, options) {
50
56
  return this._client.post(path `/api/v2/sandboxes/boxes/${name}/snapshot`, { body, ...options });
51
57
  }
58
+ /**
59
+ * Generate a tokenized link that downloads a single file from a sandbox with no
60
+ * further authentication. This mints a token rather than creating an addressable
61
+ * resource, so it returns 200 with no Location header. The token pins the sandbox,
62
+ * the file path, and the response content type and disposition, so a link cannot
63
+ * be repointed at another file. Links never expire unless expires_in_seconds is
64
+ * set. The link is served from the sandbox service domain, not the API host.
65
+ */
66
+ generateDownloadURL(name, body, options) {
67
+ return this._client.post(path `/api/v2/sandboxes/boxes/${name}/download-url`, { body, ...options });
68
+ }
52
69
  /**
53
70
  * Create a short-lived JWT for accessing an HTTP service running on a specific
54
71
  * port inside a sandbox. Returns a browser_url (sets auth cookie via redirect), a
@@ -1,17 +1,44 @@
1
1
  import { APIResource } from '../../core/resource.js';
2
2
  import * as BoxesAPI from './boxes.js';
3
- import { BoxCreateParams, BoxCreateSnapshotParams, BoxGenerateServiceURLParams, BoxListParams, BoxUpdateParams, Boxes } from './boxes.js';
3
+ import { BoxCreateParams, BoxCreateSnapshotParams, BoxGenerateDownloadURLParams, BoxGenerateServiceURLParams, BoxListParams, BoxUpdateParams, Boxes } from './boxes.js';
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
7
  import { SnapshotCreateParams, SnapshotListParams, SnapshotRetrieveByNameResponse, Snapshots } from './snapshots.js';
8
+ import { ItemsCursorGetPagination } from '../../core/pagination.js';
8
9
  export declare class Sandboxes extends APIResource {
9
10
  boxes: BoxesAPI.Boxes;
10
11
  registries: RegistriesAPI.Registries;
11
12
  snapshots: SnapshotsAPI.Snapshots;
12
13
  }
14
+ export type SandboxResponsesItemsCursorGetPagination = ItemsCursorGetPagination<SandboxResponse>;
15
+ export type SnapshotResponsesItemsCursorGetPagination = ItemsCursorGetPagination<SnapshotResponse>;
16
+ export interface DownloadURLResponse {
17
+ token: string;
18
+ download_url: string;
19
+ /**
20
+ * ExpiresAt is null for a link that never expires.
21
+ */
22
+ expires_at?: string | null;
23
+ }
13
24
  export interface SandboxListResponse {
25
+ /**
26
+ * This page of sandboxes.
27
+ */
28
+ items?: Array<SandboxResponse>;
29
+ /**
30
+ * Cursor for the next page, or null on the last page. A non-null value is the only
31
+ * signal that more pages exist. Treat it as opaque.
32
+ */
33
+ next_cursor?: string;
34
+ /**
35
+ * Deprecated: use next_cursor. Offset to request for the next page, or 0 when no
36
+ * pages remain.
37
+ */
14
38
  offset?: number;
39
+ /**
40
+ * Deprecated: use items. Duplicates items.
41
+ */
15
42
  sandboxes?: Array<SandboxResponse>;
16
43
  }
17
44
  export interface SandboxResponse {
@@ -386,7 +413,23 @@ export interface ServiceURLResponse {
386
413
  service_url?: string;
387
414
  }
388
415
  export interface SnapshotListResponse {
416
+ /**
417
+ * This page of snapshots.
418
+ */
419
+ items?: Array<SnapshotResponse>;
420
+ /**
421
+ * Cursor for the next page, or null on the last page. A non-null value is the only
422
+ * signal that more pages exist. Treat it as opaque.
423
+ */
424
+ next_cursor?: string;
425
+ /**
426
+ * Deprecated: use next_cursor. Offset to request for the next page, or 0 when no
427
+ * pages remain.
428
+ */
389
429
  offset?: number;
430
+ /**
431
+ * Deprecated: use items. Duplicates items.
432
+ */
390
433
  snapshots?: Array<SnapshotResponse>;
391
434
  }
392
435
  export interface SnapshotResponse {
@@ -419,8 +462,8 @@ export interface SnapshotResponse {
419
462
  updated_at?: string;
420
463
  }
421
464
  export declare namespace Sandboxes {
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, };
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, };
465
+ export { type DownloadURLResponse as DownloadURLResponse, type SandboxListResponse as SandboxListResponse, type SandboxResponse as SandboxResponse, type SandboxStatusResponse as SandboxStatusResponse, type ServiceURLResponse as ServiceURLResponse, type SnapshotListResponse as SnapshotListResponse, type SnapshotResponse as SnapshotResponse, };
466
+ export { Boxes as Boxes, type BoxCreateParams as BoxCreateParams, type BoxUpdateParams as BoxUpdateParams, type BoxListParams as BoxListParams, type BoxCreateSnapshotParams as BoxCreateSnapshotParams, type BoxGenerateDownloadURLParams as BoxGenerateDownloadURLParams, type BoxGenerateServiceURLParams as BoxGenerateServiceURLParams, };
424
467
  export { Registries as Registries, type RegistryListResponse as RegistryListResponse, type RegistryResponse as RegistryResponse, type RegistryCreateParams as RegistryCreateParams, type RegistryUpdateParams as RegistryUpdateParams, type RegistryListParams as RegistryListParams, };
425
468
  export { Snapshots as Snapshots, type SnapshotRetrieveByNameResponse as SnapshotRetrieveByNameResponse, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
426
469
  }
@@ -4,6 +4,7 @@
4
4
  Object.defineProperty(exports, "__esModule", { value: true });
5
5
  exports.Snapshots = void 0;
6
6
  const resource_js_1 = require("../../core/resource.cjs");
7
+ const pagination_js_1 = require("../../core/pagination.cjs");
7
8
  const headers_js_1 = require("../../internal/headers.cjs");
8
9
  const path_js_1 = require("../../internal/utils/path.cjs");
9
10
  class Snapshots extends resource_js_1.APIResource {
@@ -23,10 +24,13 @@ class Snapshots extends resource_js_1.APIResource {
23
24
  }
24
25
  /**
25
26
  * List sandbox snapshots for the authenticated tenant, with optional filtering,
26
- * sorting, and pagination.
27
+ * sorting, and pagination. Page with page_size and cursor: replay the response's
28
+ * next_cursor until it comes back null, which is the only signal that no pages
29
+ * remain. Cursors are opaque and only valid on this endpoint; do not parse or
30
+ * construct one.
27
31
  */
28
32
  list(query = {}, options) {
29
- return this._client.get('/api/v2/sandboxes/snapshots', { query, ...options });
33
+ return this._client.getAPIList('/api/v2/sandboxes/snapshots', (pagination_js_1.ItemsCursorGetPagination), { query, ...options });
30
34
  }
31
35
  /**
32
36
  * Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
@@ -1,6 +1,8 @@
1
1
  import { APIResource } from '../../core/resource.js';
2
2
  import * as SandboxesAPI from './sandboxes.js';
3
+ import { SnapshotResponsesItemsCursorGetPagination } from './sandboxes.js';
3
4
  import { APIPromise } from '../../core/api-promise.js';
5
+ import { type ItemsCursorGetPaginationParams, PagePromise } from '../../core/pagination.js';
4
6
  import { RequestOptions } from '../../internal/request-options.js';
5
7
  export declare class Snapshots extends APIResource {
6
8
  /**
@@ -15,9 +17,12 @@ export declare class Snapshots extends APIResource {
15
17
  retrieve(snapshotID: string, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotResponse>;
16
18
  /**
17
19
  * List sandbox snapshots for the authenticated tenant, with optional filtering,
18
- * sorting, and pagination.
20
+ * sorting, and pagination. Page with page_size and cursor: replay the response's
21
+ * next_cursor until it comes back null, which is the only signal that no pages
22
+ * remain. Cursors are opaque and only valid on this endpoint; do not parse or
23
+ * construct one.
19
24
  */
20
- list(query?: SnapshotListParams | null | undefined, options?: RequestOptions): APIPromise<SandboxesAPI.SnapshotListResponse>;
25
+ list(query?: SnapshotListParams | null | undefined, options?: RequestOptions): PagePromise<SnapshotResponsesItemsCursorGetPagination, SandboxesAPI.SnapshotResponse>;
21
26
  /**
22
27
  * Delete a snapshot by ID or by a Docker-style name[:tag] reference. The
23
28
  * underlying storage is reclaimed asynchronously.
@@ -56,7 +61,7 @@ export interface SnapshotCreateParams {
56
61
  */
57
62
  tag?: string;
58
63
  }
59
- export interface SnapshotListParams {
64
+ export interface SnapshotListParams extends ItemsCursorGetPaginationParams {
60
65
  /**
61
66
  * Filter by creator identity. Only 'me' is supported.
62
67
  */
@@ -67,7 +72,7 @@ export interface SnapshotListParams {
67
72
  */
68
73
  label?: Array<string>;
69
74
  /**
70
- * Maximum number of results
75
+ * Deprecated: use page_size. Maximum number of results
71
76
  */
72
77
  limit?: number;
73
78
  /**
@@ -75,7 +80,7 @@ export interface SnapshotListParams {
75
80
  */
76
81
  name_contains?: string;
77
82
  /**
78
- * Pagination offset
83
+ * Deprecated: use cursor. Pagination offset
79
84
  */
80
85
  offset?: number;
81
86
  /**
@@ -83,9 +88,13 @@ export interface SnapshotListParams {
83
88
  */
84
89
  sort_by?: string;
85
90
  /**
86
- * Sort direction (asc, desc)
91
+ * Deprecated: use sort_order. Sort direction (asc, desc)
87
92
  */
88
93
  sort_direction?: string;
94
+ /**
95
+ * Sort direction (asc, desc)
96
+ */
97
+ sort_order?: string;
89
98
  /**
90
99
  * Filter by status (building, ready, failed, deleting)
91
100
  */
@@ -94,3 +103,4 @@ export interface SnapshotListParams {
94
103
  export declare namespace Snapshots {
95
104
  export { type SnapshotRetrieveByNameResponse as SnapshotRetrieveByNameResponse, type SnapshotCreateParams as SnapshotCreateParams, type SnapshotListParams as SnapshotListParams, };
96
105
  }
106
+ export { type SnapshotResponsesItemsCursorGetPagination };
@@ -1,6 +1,7 @@
1
1
  // @ts-nocheck
2
2
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
3
  import { APIResource } from '../../core/resource.js';
4
+ import { ItemsCursorGetPagination, } from '../../core/pagination.js';
4
5
  import { buildHeaders } from '../../internal/headers.js';
5
6
  import { path } from '../../internal/utils/path.js';
6
7
  export class Snapshots extends APIResource {
@@ -20,10 +21,13 @@ export class Snapshots extends APIResource {
20
21
  }
21
22
  /**
22
23
  * List sandbox snapshots for the authenticated tenant, with optional filtering,
23
- * sorting, and pagination.
24
+ * sorting, and pagination. Page with page_size and cursor: replay the response's
25
+ * next_cursor until it comes back null, which is the only signal that no pages
26
+ * remain. Cursors are opaque and only valid on this endpoint; do not parse or
27
+ * construct one.
24
28
  */
25
29
  list(query = {}, options) {
26
- return this._client.get('/api/v2/sandboxes/snapshots', { query, ...options });
30
+ return this._client.getAPIList('/api/v2/sandboxes/snapshots', (ItemsCursorGetPagination), { query, ...options });
27
31
  }
28
32
  /**
29
33
  * Delete a snapshot by ID or by a Docker-style name[:tag] reference. The