anchorbrowser 0.16.3 → 1.0.0-dev.1

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 (90) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/client.d.mts +3 -3
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -3
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -3
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -3
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +1 -1
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +1 -1
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +3 -3
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +1 -1
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/sessions/sessions.d.mts +46 -0
  20. package/resources/sessions/sessions.d.mts.map +1 -1
  21. package/resources/sessions/sessions.d.ts +46 -0
  22. package/resources/sessions/sessions.d.ts.map +1 -1
  23. package/resources/sessions/sessions.js.map +1 -1
  24. package/resources/sessions/sessions.mjs.map +1 -1
  25. package/resources/tasks/generations.d.mts +42 -0
  26. package/resources/tasks/generations.d.mts.map +1 -0
  27. package/resources/tasks/generations.d.ts +42 -0
  28. package/resources/tasks/generations.d.ts.map +1 -0
  29. package/resources/tasks/generations.js +24 -0
  30. package/resources/tasks/generations.js.map +1 -0
  31. package/resources/tasks/generations.mjs +20 -0
  32. package/resources/tasks/generations.mjs.map +1 -0
  33. package/resources/tasks/index.d.mts +4 -0
  34. package/resources/tasks/index.d.mts.map +1 -0
  35. package/resources/tasks/index.d.ts +4 -0
  36. package/resources/tasks/index.d.ts.map +1 -0
  37. package/resources/tasks/index.js +11 -0
  38. package/resources/tasks/index.js.map +1 -0
  39. package/resources/tasks/index.mjs +5 -0
  40. package/resources/tasks/index.mjs.map +1 -0
  41. package/resources/tasks/runs.d.mts +42 -0
  42. package/resources/tasks/runs.d.mts.map +1 -0
  43. package/resources/tasks/runs.d.ts +42 -0
  44. package/resources/tasks/runs.d.ts.map +1 -0
  45. package/resources/tasks/runs.js +21 -0
  46. package/resources/tasks/runs.js.map +1 -0
  47. package/resources/tasks/runs.mjs +17 -0
  48. package/resources/tasks/runs.mjs.map +1 -0
  49. package/resources/tasks/tasks.d.mts +310 -0
  50. package/resources/tasks/tasks.d.mts.map +1 -0
  51. package/resources/tasks/tasks.d.ts +310 -0
  52. package/resources/tasks/tasks.d.ts.map +1 -0
  53. package/resources/tasks/tasks.js +80 -0
  54. package/resources/tasks/tasks.js.map +1 -0
  55. package/resources/tasks/tasks.mjs +75 -0
  56. package/resources/tasks/tasks.mjs.map +1 -0
  57. package/resources/tasks.d.mts +2 -0
  58. package/resources/tasks.d.mts.map +1 -0
  59. package/resources/tasks.d.ts +2 -0
  60. package/resources/tasks.d.ts.map +1 -0
  61. package/resources/tasks.js +6 -0
  62. package/resources/tasks.js.map +1 -0
  63. package/resources/tasks.mjs +3 -0
  64. package/resources/tasks.mjs.map +1 -0
  65. package/src/client.ts +12 -20
  66. package/src/resources/index.ts +4 -8
  67. package/src/resources/sessions/sessions.ts +51 -0
  68. package/src/resources/tasks/generations.ts +52 -0
  69. package/src/resources/tasks/index.ts +11 -0
  70. package/src/resources/tasks/runs.ts +51 -0
  71. package/src/resources/tasks/tasks.ts +518 -0
  72. package/src/resources/tasks.ts +3 -0
  73. package/src/version.ts +1 -1
  74. package/version.d.mts +1 -1
  75. package/version.d.mts.map +1 -1
  76. package/version.d.ts +1 -1
  77. package/version.d.ts.map +1 -1
  78. package/version.js +1 -1
  79. package/version.js.map +1 -1
  80. package/version.mjs +1 -1
  81. package/version.mjs.map +1 -1
  82. package/resources/task.d.mts +0 -735
  83. package/resources/task.d.mts.map +0 -1
  84. package/resources/task.d.ts +0 -735
  85. package/resources/task.d.ts.map +0 -1
  86. package/resources/task.js +0 -78
  87. package/resources/task.js.map +0 -1
  88. package/resources/task.mjs +0 -74
  89. package/resources/task.mjs.map +0 -1
  90. package/src/resources/task.ts +0 -1480
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Tasks = void 0;
5
+ const tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const GenerationsAPI = tslib_1.__importStar(require("./generations.js"));
8
+ const generations_1 = require("./generations.js");
9
+ const RunsAPI = tslib_1.__importStar(require("./runs.js"));
10
+ const runs_1 = require("./runs.js");
11
+ const path_1 = require("../../internal/utils/path.js");
12
+ class Tasks extends resource_1.APIResource {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.runs = new RunsAPI.Runs(this._client);
16
+ this.generations = new GenerationsAPI.Generations(this._client);
17
+ }
18
+ /**
19
+ * Initiates asynchronous task generation. Use the returned task ID to poll for
20
+ * completion, then execute the task.
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const response = await client.tasks.generate({
25
+ * description: 'Download a specific file from a URL',
26
+ * name: 'file-downloader',
27
+ * user_task: 'Create a task that downloads a specific file from a given URL.',
28
+ * input_schema: [
29
+ * {
30
+ * display_name: 'URL',
31
+ * type: 'string',
32
+ * required: true,
33
+ * description: 'URL of the file to download',
34
+ * },
35
+ * {
36
+ * display_name: 'File Name',
37
+ * type: 'string',
38
+ * required: true,
39
+ * description: 'Name of the file to download',
40
+ * },
41
+ * ],
42
+ * output_schema: [
43
+ * {
44
+ * display_name: 'Success',
45
+ * type: 'boolean',
46
+ * description: 'Whether the download succeeded',
47
+ * },
48
+ * {
49
+ * display_name: 'Message',
50
+ * type: 'string',
51
+ * description: 'Status or error message',
52
+ * },
53
+ * ],
54
+ * });
55
+ * ```
56
+ */
57
+ generate(body, options) {
58
+ return this._client.post('/v2/tasks/generate', { body, ...options });
59
+ }
60
+ /**
61
+ * Triggers execution of a task by ID using the V2 tasks API.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const response = await client.tasks.run('taskId', {
66
+ * input_params: {
67
+ * 'File Name': 'invoice-2026-02.pdf',
68
+ * Operation: 'extract_text',
69
+ * },
70
+ * });
71
+ * ```
72
+ */
73
+ run(taskID, body, options) {
74
+ return this._client.post((0, path_1.path) `/v2/tasks/${taskID}/run`, { body, ...options });
75
+ }
76
+ }
77
+ exports.Tasks = Tasks;
78
+ Tasks.Runs = runs_1.Runs;
79
+ Tasks.Generations = generations_1.Generations;
80
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.js","sourceRoot":"","sources":["../../src/resources/tasks/tasks.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,yEAAgD;AAChD,kDAAyE;AACzE,2DAAkC;AAClC,oCAAoD;AAGpD,uDAAiD;AAEjD,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,gBAAW,GAA+B,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6DzF,CAAC;IA3DC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,QAAQ,CAAC,IAAwB,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,MAAc,EAAE,IAAmB,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,aAAa,MAAM,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AA/DD,sBA+DC;AA6aD,KAAK,CAAC,IAAI,GAAG,WAAI,CAAC;AAClB,KAAK,CAAC,WAAW,GAAG,yBAAW,CAAC"}
@@ -0,0 +1,75 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as GenerationsAPI from "./generations.mjs";
4
+ import { Generations } from "./generations.mjs";
5
+ import * as RunsAPI from "./runs.mjs";
6
+ import { Runs } from "./runs.mjs";
7
+ import { path } from "../../internal/utils/path.mjs";
8
+ export class Tasks extends APIResource {
9
+ constructor() {
10
+ super(...arguments);
11
+ this.runs = new RunsAPI.Runs(this._client);
12
+ this.generations = new GenerationsAPI.Generations(this._client);
13
+ }
14
+ /**
15
+ * Initiates asynchronous task generation. Use the returned task ID to poll for
16
+ * completion, then execute the task.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * const response = await client.tasks.generate({
21
+ * description: 'Download a specific file from a URL',
22
+ * name: 'file-downloader',
23
+ * user_task: 'Create a task that downloads a specific file from a given URL.',
24
+ * input_schema: [
25
+ * {
26
+ * display_name: 'URL',
27
+ * type: 'string',
28
+ * required: true,
29
+ * description: 'URL of the file to download',
30
+ * },
31
+ * {
32
+ * display_name: 'File Name',
33
+ * type: 'string',
34
+ * required: true,
35
+ * description: 'Name of the file to download',
36
+ * },
37
+ * ],
38
+ * output_schema: [
39
+ * {
40
+ * display_name: 'Success',
41
+ * type: 'boolean',
42
+ * description: 'Whether the download succeeded',
43
+ * },
44
+ * {
45
+ * display_name: 'Message',
46
+ * type: 'string',
47
+ * description: 'Status or error message',
48
+ * },
49
+ * ],
50
+ * });
51
+ * ```
52
+ */
53
+ generate(body, options) {
54
+ return this._client.post('/v2/tasks/generate', { body, ...options });
55
+ }
56
+ /**
57
+ * Triggers execution of a task by ID using the V2 tasks API.
58
+ *
59
+ * @example
60
+ * ```ts
61
+ * const response = await client.tasks.run('taskId', {
62
+ * input_params: {
63
+ * 'File Name': 'invoice-2026-02.pdf',
64
+ * Operation: 'extract_text',
65
+ * },
66
+ * });
67
+ * ```
68
+ */
69
+ run(taskID, body, options) {
70
+ return this._client.post(path `/v2/tasks/${taskID}/run`, { body, ...options });
71
+ }
72
+ }
73
+ Tasks.Runs = Runs;
74
+ Tasks.Generations = Generations;
75
+ //# sourceMappingURL=tasks.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.mjs","sourceRoot":"","sources":["../../src/resources/tasks/tasks.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,cAAc;OACnB,EAA+B,WAAW,EAAE;OAC5C,KAAK,OAAO;OACZ,EAAwB,IAAI,EAAE;OAG9B,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,KAAM,SAAQ,WAAW;IAAtC;;QACE,SAAI,GAAiB,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACpD,gBAAW,GAA+B,IAAI,cAAc,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6DzF,CAAC;IA3DC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAsCG;IACH,QAAQ,CAAC,IAAwB,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,GAAG,CAAC,MAAc,EAAE,IAAmB,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,aAAa,MAAM,MAAM,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChF,CAAC;CACF;AA6aD,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC;AAClB,KAAK,CAAC,WAAW,GAAG,WAAW,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from "./tasks/index.mjs";
2
+ //# sourceMappingURL=tasks.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.mts","sourceRoot":"","sources":["../src/resources/tasks.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export * from "./tasks/index.js";
2
+ //# sourceMappingURL=tasks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.ts","sourceRoot":"","sources":["../src/resources/tasks.ts"],"names":[],"mappings":""}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ const tslib_1 = require("../internal/tslib.js");
5
+ tslib_1.__exportStar(require("./tasks/index.js"), exports);
6
+ //# sourceMappingURL=tasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.js","sourceRoot":"","sources":["../src/resources/tasks.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,2DAA8B"}
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export * from "./tasks/index.mjs";
3
+ //# sourceMappingURL=tasks.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.mjs","sourceRoot":"","sources":["../src/resources/tasks.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
package/src/client.ts CHANGED
@@ -35,17 +35,6 @@ import {
35
35
  ProfileRetrieveResponse,
36
36
  Profiles,
37
37
  } from './resources/profiles';
38
- import {
39
- Task,
40
- TaskCreateParams,
41
- TaskCreateResponse,
42
- TaskListParams,
43
- TaskListResponse,
44
- TaskRetrieveExecutionResultParams,
45
- TaskRetrieveExecutionResultResponse,
46
- TaskRunParams,
47
- TaskRunResponse,
48
- } from './resources/task';
49
38
  import {
50
39
  ToolFetchWebpageParams,
51
40
  ToolFetchWebpageResponse,
@@ -83,6 +72,13 @@ import {
83
72
  SessionUploadFileResponse,
84
73
  Sessions,
85
74
  } from './resources/sessions/sessions';
75
+ import {
76
+ TaskGenerateParams,
77
+ TaskGenerateResponse,
78
+ TaskRunParams,
79
+ TaskRunResponse,
80
+ Tasks,
81
+ } from './resources/tasks/tasks';
86
82
  import { type Fetch } from './internal/builtin-types';
87
83
  import { HeadersLike, NullableHeaders, buildHeaders } from './internal/headers';
88
84
  import { FinalRequestOptions, RequestOptions } from './internal/request-options';
@@ -792,7 +788,7 @@ export class Anchorbrowser {
792
788
  browser: API.Browser = new API.Browser(this);
793
789
  agent: API.Agent = new API.Agent(this);
794
790
  events: API.Events = new API.Events(this);
795
- task: API.Task = new API.Task(this);
791
+ tasks: API.Tasks = new API.Tasks(this);
796
792
  identities: API.Identities = new API.Identities(this);
797
793
  applications: API.Applications = new API.Applications(this);
798
794
  }
@@ -802,7 +798,7 @@ Anchorbrowser.Sessions = Sessions;
802
798
  Anchorbrowser.Tools = Tools;
803
799
  Anchorbrowser.Extensions = Extensions;
804
800
  Anchorbrowser.Events = Events;
805
- Anchorbrowser.Task = Task;
801
+ Anchorbrowser.Tasks = Tasks;
806
802
  Anchorbrowser.Identities = Identities;
807
803
  Anchorbrowser.Applications = Applications;
808
804
 
@@ -856,14 +852,10 @@ export declare namespace Anchorbrowser {
856
852
  };
857
853
 
858
854
  export {
859
- Task as Task,
860
- type TaskCreateResponse as TaskCreateResponse,
861
- type TaskListResponse as TaskListResponse,
862
- type TaskRetrieveExecutionResultResponse as TaskRetrieveExecutionResultResponse,
855
+ Tasks as Tasks,
856
+ type TaskGenerateResponse as TaskGenerateResponse,
863
857
  type TaskRunResponse as TaskRunResponse,
864
- type TaskCreateParams as TaskCreateParams,
865
- type TaskListParams as TaskListParams,
866
- type TaskRetrieveExecutionResultParams as TaskRetrieveExecutionResultParams,
858
+ type TaskGenerateParams as TaskGenerateParams,
867
859
  type TaskRunParams as TaskRunParams,
868
860
  };
869
861
 
@@ -48,16 +48,12 @@ export {
48
48
  type SessionUploadFileParams,
49
49
  } from './sessions/sessions';
50
50
  export {
51
- Task,
52
- type TaskCreateResponse,
53
- type TaskListResponse,
54
- type TaskRetrieveExecutionResultResponse,
51
+ Tasks,
52
+ type TaskGenerateResponse,
55
53
  type TaskRunResponse,
56
- type TaskCreateParams,
57
- type TaskListParams,
58
- type TaskRetrieveExecutionResultParams,
54
+ type TaskGenerateParams,
59
55
  type TaskRunParams,
60
- } from './task';
56
+ } from './tasks/tasks';
61
57
  export {
62
58
  Tools,
63
59
  type ToolFetchWebpageResponse,
@@ -490,6 +490,13 @@ export namespace SessionCreateParams {
490
490
  */
491
491
  profile?: Browser.Profile;
492
492
 
493
+ /**
494
+ * Automatically detects and masks sensitive data (passwords, emails, phone
495
+ * numbers, credit card fields, tokens) in web pages. Supports custom CSS selectors
496
+ * globally or per site, and custom regex patterns.
497
+ */
498
+ sensitive_data_mask?: Browser.SensitiveDataMask;
499
+
493
500
  /**
494
501
  * Configuration for the browser's viewport size.
495
502
  */
@@ -623,6 +630,50 @@ export namespace SessionCreateParams {
623
630
  persist?: boolean;
624
631
  }
625
632
 
633
+ /**
634
+ * Automatically detects and masks sensitive data (passwords, emails, phone
635
+ * numbers, credit card fields, tokens) in web pages. Supports custom CSS selectors
636
+ * globally or per site, and custom regex patterns.
637
+ */
638
+ export interface SensitiveDataMask {
639
+ /**
640
+ * Enable or disable sensitive data masking. Defaults to `false`.
641
+ */
642
+ active?: boolean;
643
+
644
+ /**
645
+ * Custom regex patterns to detect and mask additional sensitive data types.
646
+ */
647
+ custom_patterns?: Array<SensitiveDataMask.CustomPattern>;
648
+
649
+ /**
650
+ * Additional CSS selectors to mask globally across all sites. Matched elements
651
+ * will be blurred.
652
+ */
653
+ custom_selectors?: Array<string>;
654
+
655
+ /**
656
+ * Per-site CSS selectors. Keys are hostnames (supports wildcard prefix like
657
+ * `*.bank.com`), values are arrays of CSS selectors. Matched elements will be
658
+ * blurred.
659
+ */
660
+ site_selectors?: { [key: string]: Array<string> };
661
+ }
662
+
663
+ export namespace SensitiveDataMask {
664
+ export interface CustomPattern {
665
+ /**
666
+ * Replacement string for matched text. Defaults to `****`.
667
+ */
668
+ mask?: string;
669
+
670
+ /**
671
+ * Regular expression pattern to match sensitive data.
672
+ */
673
+ regex?: string;
674
+ }
675
+ }
676
+
626
677
  /**
627
678
  * Configuration for the browser's viewport size.
628
679
  */
@@ -0,0 +1,52 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
7
+
8
+ export class Generations extends APIResource {
9
+ /**
10
+ * Returns the current status of asynchronous task generation. Poll this endpoint
11
+ * after generating a task until status is ready or failed.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const response = await client.tasks.generations.getStatus(
16
+ * 'taskId',
17
+ * );
18
+ * ```
19
+ */
20
+ getStatus(taskID: string, options?: RequestOptions): APIPromise<GenerationGetStatusResponse> {
21
+ return this._client.get(path`/v2/tasks/${taskID}/generation-status`, options);
22
+ }
23
+ }
24
+
25
+ /**
26
+ * Current status of asynchronous task generation.
27
+ */
28
+ export interface GenerationGetStatusResponse {
29
+ /**
30
+ * The task ID
31
+ */
32
+ id: string;
33
+
34
+ /**
35
+ * Whether the task is still generating, ready to run, or failed.
36
+ */
37
+ status: 'generating' | 'ready' | 'failed';
38
+
39
+ /**
40
+ * Error message when status is failed
41
+ */
42
+ error?: string;
43
+
44
+ /**
45
+ * Optional internal project state
46
+ */
47
+ project_state?: string;
48
+ }
49
+
50
+ export declare namespace Generations {
51
+ export { type GenerationGetStatusResponse as GenerationGetStatusResponse };
52
+ }
@@ -0,0 +1,11 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ export { Generations, type GenerationGetStatusResponse } from './generations';
4
+ export { Runs, type RunGetStatusResponse } from './runs';
5
+ export {
6
+ Tasks,
7
+ type TaskGenerateResponse,
8
+ type TaskRunResponse,
9
+ type TaskGenerateParams,
10
+ type TaskRunParams,
11
+ } from './tasks';
@@ -0,0 +1,51 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../../core/resource';
4
+ import { APIPromise } from '../../core/api-promise';
5
+ import { RequestOptions } from '../../internal/request-options';
6
+ import { path } from '../../internal/utils/path';
7
+
8
+ export class Runs extends APIResource {
9
+ /**
10
+ * Retrieves the current status and result of a task run in the V2 tasks API.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const response = await client.tasks.runs.getStatus('runId');
15
+ * ```
16
+ */
17
+ getStatus(runID: string, options?: RequestOptions): APIPromise<RunGetStatusResponse> {
18
+ return this._client.get(path`/v2/tasks/runs/${runID}/status`, options);
19
+ }
20
+ }
21
+
22
+ export interface RunGetStatusResponse {
23
+ /**
24
+ * The ID of the task run
25
+ */
26
+ run_id: string;
27
+
28
+ /**
29
+ * Current task run status
30
+ */
31
+ status: 'queued' | 'running' | 'success' | 'failure' | 'timeout' | 'cancelled';
32
+
33
+ /**
34
+ * Error message when the run fails
35
+ */
36
+ error?: string;
37
+
38
+ /**
39
+ * Task output when available
40
+ */
41
+ result?: { [key: string]: unknown };
42
+
43
+ /**
44
+ * Session ID used for this task run
45
+ */
46
+ session_id?: string;
47
+ }
48
+
49
+ export declare namespace Runs {
50
+ export { type RunGetStatusResponse as RunGetStatusResponse };
51
+ }