@onkernel/sdk 0.148.0 → 0.149.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 (97) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/client.d.mts +18 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +18 -0
  5. package/client.d.ts.map +1 -1
  6. package/client.js +18 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +18 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/index.d.mts +3 -0
  12. package/resources/index.d.mts.map +1 -1
  13. package/resources/index.d.ts +3 -0
  14. package/resources/index.d.ts.map +1 -1
  15. package/resources/index.js +7 -1
  16. package/resources/index.js.map +1 -1
  17. package/resources/index.mjs +3 -0
  18. package/resources/index.mjs.map +1 -1
  19. package/resources/report-types/index.d.mts +3 -0
  20. package/resources/report-types/index.d.mts.map +1 -0
  21. package/resources/report-types/index.d.ts +3 -0
  22. package/resources/report-types/index.d.ts.map +1 -0
  23. package/resources/report-types/index.js +9 -0
  24. package/resources/report-types/index.js.map +1 -0
  25. package/resources/report-types/index.mjs +4 -0
  26. package/resources/report-types/index.mjs.map +1 -0
  27. package/resources/report-types/report-types.d.mts +98 -0
  28. package/resources/report-types/report-types.d.mts.map +1 -0
  29. package/resources/report-types/report-types.d.ts +98 -0
  30. package/resources/report-types/report-types.d.ts.map +1 -0
  31. package/resources/report-types/report-types.js +38 -0
  32. package/resources/report-types/report-types.js.map +1 -0
  33. package/resources/report-types/report-types.mjs +33 -0
  34. package/resources/report-types/report-types.mjs.map +1 -0
  35. package/resources/report-types/versions.d.mts +47 -0
  36. package/resources/report-types/versions.d.mts.map +1 -0
  37. package/resources/report-types/versions.d.ts +47 -0
  38. package/resources/report-types/versions.d.ts.map +1 -0
  39. package/resources/report-types/versions.js +20 -0
  40. package/resources/report-types/versions.js.map +1 -0
  41. package/resources/report-types/versions.mjs +16 -0
  42. package/resources/report-types/versions.mjs.map +1 -0
  43. package/resources/report-types.d.mts +2 -0
  44. package/resources/report-types.d.mts.map +1 -0
  45. package/resources/report-types.d.ts +2 -0
  46. package/resources/report-types.d.ts.map +1 -0
  47. package/resources/report-types.js +6 -0
  48. package/resources/report-types.js.map +1 -0
  49. package/resources/report-types.mjs +3 -0
  50. package/resources/report-types.mjs.map +1 -0
  51. package/resources/reports.d.mts +136 -0
  52. package/resources/reports.d.mts.map +1 -0
  53. package/resources/reports.d.ts +136 -0
  54. package/resources/reports.d.ts.map +1 -0
  55. package/resources/reports.js +58 -0
  56. package/resources/reports.js.map +1 -0
  57. package/resources/reports.mjs +54 -0
  58. package/resources/reports.mjs.map +1 -0
  59. package/resources/tasks.d.mts +144 -0
  60. package/resources/tasks.d.mts.map +1 -0
  61. package/resources/tasks.d.ts +144 -0
  62. package/resources/tasks.d.ts.map +1 -0
  63. package/resources/tasks.js +67 -0
  64. package/resources/tasks.js.map +1 -0
  65. package/resources/tasks.mjs +63 -0
  66. package/resources/tasks.mjs.map +1 -0
  67. package/resources/vaults/items.d.mts +61 -10
  68. package/resources/vaults/items.d.mts.map +1 -1
  69. package/resources/vaults/items.d.ts +61 -10
  70. package/resources/vaults/items.d.ts.map +1 -1
  71. package/resources/vaults/items.js +4 -0
  72. package/resources/vaults/items.js.map +1 -1
  73. package/resources/vaults/items.mjs +4 -0
  74. package/resources/vaults/items.mjs.map +1 -1
  75. package/resources/vaults/vaults.d.mts +4 -1
  76. package/resources/vaults/vaults.d.mts.map +1 -1
  77. package/resources/vaults/vaults.d.ts +4 -1
  78. package/resources/vaults/vaults.d.ts.map +1 -1
  79. package/resources/vaults/vaults.js +4 -1
  80. package/resources/vaults/vaults.js.map +1 -1
  81. package/resources/vaults/vaults.mjs +4 -1
  82. package/resources/vaults/vaults.mjs.map +1 -1
  83. package/src/client.ts +66 -0
  84. package/src/resources/index.ts +24 -0
  85. package/src/resources/report-types/index.ts +11 -0
  86. package/src/resources/report-types/report-types.ts +137 -0
  87. package/src/resources/report-types/versions.ts +61 -0
  88. package/src/resources/report-types.ts +3 -0
  89. package/src/resources/reports.ts +166 -0
  90. package/src/resources/tasks.ts +183 -0
  91. package/src/resources/vaults/items.ts +64 -2
  92. package/src/resources/vaults/vaults.ts +4 -1
  93. package/src/version.ts +1 -1
  94. package/version.d.mts +1 -1
  95. package/version.d.ts +1 -1
  96. package/version.js +1 -1
  97. package/version.mjs +1 -1
@@ -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("./report-types/index.js"), exports);
6
+ //# sourceMappingURL=report-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-types.js","sourceRoot":"","sources":["../src/resources/report-types.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kEAAqC"}
@@ -0,0 +1,3 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export * from "./report-types/index.mjs";
3
+ //# sourceMappingURL=report-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"report-types.mjs","sourceRoot":"","sources":["../src/resources/report-types.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,yCAAqC"}
@@ -0,0 +1,136 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from "../core/pagination.mjs";
4
+ import { RequestOptions } from "../internal/request-options.mjs";
5
+ /**
6
+ * Discover report types and submit typed reports against tasks.
7
+ */
8
+ export declare class Reports extends APIResource {
9
+ /**
10
+ * Submit a typed report against a task. The data is validated against the report
11
+ * type's schema; a validation failure returns 400 with one detail per invalid
12
+ * field. A task can have at most 500 reports.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const report = await client.reports.create({
17
+ * data: { result: 'bar', evidence: 'bar' },
18
+ * task_id: 'x',
19
+ * type: 'task.result',
20
+ * });
21
+ * ```
22
+ */
23
+ create(body: ReportCreateParams, options?: RequestOptions): APIPromise<Report>;
24
+ /**
25
+ * Retrieve a report.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const report = await client.reports.retrieve('id');
30
+ * ```
31
+ */
32
+ retrieve(id: string, options?: RequestOptions): APIPromise<Report>;
33
+ /**
34
+ * List a task's reports in the order they were submitted, oldest first.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * // Automatically fetches more pages as needed.
39
+ * for await (const report of client.reports.list({
40
+ * task_id: 'task_id',
41
+ * })) {
42
+ * // ...
43
+ * }
44
+ * ```
45
+ */
46
+ list(query: ReportListParams, options?: RequestOptions): PagePromise<ReportsOffsetPagination, Report>;
47
+ }
48
+ export type ReportsOffsetPagination = OffsetPagination<Report>;
49
+ /**
50
+ * A typed, schema-validated report an agent submitted against a task. Reports are
51
+ * immutable.
52
+ */
53
+ export interface Report {
54
+ /**
55
+ * Unique identifier for the report
56
+ */
57
+ id: string;
58
+ /**
59
+ * When the report was submitted
60
+ */
61
+ created_at: string;
62
+ /**
63
+ * Report data, matching the report type's schema
64
+ */
65
+ data: {
66
+ [key: string]: unknown;
67
+ };
68
+ /**
69
+ * When the reported event happened
70
+ */
71
+ occurred_at: string;
72
+ /**
73
+ * Version of the report type's schema that data was validated against
74
+ */
75
+ schema_version: number;
76
+ /**
77
+ * ID of the task the report belongs to
78
+ */
79
+ task_id: string;
80
+ /**
81
+ * Report type name
82
+ */
83
+ type: string;
84
+ /**
85
+ * ID of the browser the report was observed in, if any
86
+ */
87
+ session_id?: string | null;
88
+ }
89
+ export interface ReportCreateParams {
90
+ /**
91
+ * Report data. It must match the schema of the report type's version and encode to
92
+ * at most 16 KB of JSON.
93
+ */
94
+ data: {
95
+ [key: string]: unknown;
96
+ };
97
+ /**
98
+ * ID of the task to report against.
99
+ */
100
+ task_id: string;
101
+ /**
102
+ * Report type name. List report types to see the available types and their
103
+ * schemas.
104
+ */
105
+ type: string;
106
+ /**
107
+ * When the reported event happened. Defaults to the time the report is submitted.
108
+ * Must be no more than 5 minutes in the future or 30 days in the past.
109
+ */
110
+ occurred_at?: string;
111
+ /**
112
+ * Version of the report type's schema to validate data against. Defaults to the
113
+ * type's latest version, which the response returns.
114
+ */
115
+ schema_version?: number;
116
+ /**
117
+ * ID of the browser the report was observed in. It must belong to the task's
118
+ * project; deleted browsers are accepted. The browser is linked to the task if it
119
+ * is not already.
120
+ */
121
+ session_id?: string;
122
+ }
123
+ export interface ReportListParams extends OffsetPaginationParams {
124
+ /**
125
+ * Task whose reports to list.
126
+ */
127
+ task_id: string;
128
+ /**
129
+ * Only return reports of this type.
130
+ */
131
+ type?: string;
132
+ }
133
+ export declare namespace Reports {
134
+ export { type Report as Report, type ReportsOffsetPagination as ReportsOffsetPagination, type ReportCreateParams as ReportCreateParams, type ReportListParams as ReportListParams, };
135
+ }
136
+ //# sourceMappingURL=reports.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reports.d.mts","sourceRoot":"","sources":["../src/resources/reports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,WAAW,EAAE,+BAA2B;AAChG,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D;;GAEG;AACH,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAI9E;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAIlE;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,KAA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,EACvD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -0,0 +1,136 @@
1
+ import { APIResource } from "../core/resource.js";
2
+ import { APIPromise } from "../core/api-promise.js";
3
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from "../core/pagination.js";
4
+ import { RequestOptions } from "../internal/request-options.js";
5
+ /**
6
+ * Discover report types and submit typed reports against tasks.
7
+ */
8
+ export declare class Reports extends APIResource {
9
+ /**
10
+ * Submit a typed report against a task. The data is validated against the report
11
+ * type's schema; a validation failure returns 400 with one detail per invalid
12
+ * field. A task can have at most 500 reports.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const report = await client.reports.create({
17
+ * data: { result: 'bar', evidence: 'bar' },
18
+ * task_id: 'x',
19
+ * type: 'task.result',
20
+ * });
21
+ * ```
22
+ */
23
+ create(body: ReportCreateParams, options?: RequestOptions): APIPromise<Report>;
24
+ /**
25
+ * Retrieve a report.
26
+ *
27
+ * @example
28
+ * ```ts
29
+ * const report = await client.reports.retrieve('id');
30
+ * ```
31
+ */
32
+ retrieve(id: string, options?: RequestOptions): APIPromise<Report>;
33
+ /**
34
+ * List a task's reports in the order they were submitted, oldest first.
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * // Automatically fetches more pages as needed.
39
+ * for await (const report of client.reports.list({
40
+ * task_id: 'task_id',
41
+ * })) {
42
+ * // ...
43
+ * }
44
+ * ```
45
+ */
46
+ list(query: ReportListParams, options?: RequestOptions): PagePromise<ReportsOffsetPagination, Report>;
47
+ }
48
+ export type ReportsOffsetPagination = OffsetPagination<Report>;
49
+ /**
50
+ * A typed, schema-validated report an agent submitted against a task. Reports are
51
+ * immutable.
52
+ */
53
+ export interface Report {
54
+ /**
55
+ * Unique identifier for the report
56
+ */
57
+ id: string;
58
+ /**
59
+ * When the report was submitted
60
+ */
61
+ created_at: string;
62
+ /**
63
+ * Report data, matching the report type's schema
64
+ */
65
+ data: {
66
+ [key: string]: unknown;
67
+ };
68
+ /**
69
+ * When the reported event happened
70
+ */
71
+ occurred_at: string;
72
+ /**
73
+ * Version of the report type's schema that data was validated against
74
+ */
75
+ schema_version: number;
76
+ /**
77
+ * ID of the task the report belongs to
78
+ */
79
+ task_id: string;
80
+ /**
81
+ * Report type name
82
+ */
83
+ type: string;
84
+ /**
85
+ * ID of the browser the report was observed in, if any
86
+ */
87
+ session_id?: string | null;
88
+ }
89
+ export interface ReportCreateParams {
90
+ /**
91
+ * Report data. It must match the schema of the report type's version and encode to
92
+ * at most 16 KB of JSON.
93
+ */
94
+ data: {
95
+ [key: string]: unknown;
96
+ };
97
+ /**
98
+ * ID of the task to report against.
99
+ */
100
+ task_id: string;
101
+ /**
102
+ * Report type name. List report types to see the available types and their
103
+ * schemas.
104
+ */
105
+ type: string;
106
+ /**
107
+ * When the reported event happened. Defaults to the time the report is submitted.
108
+ * Must be no more than 5 minutes in the future or 30 days in the past.
109
+ */
110
+ occurred_at?: string;
111
+ /**
112
+ * Version of the report type's schema to validate data against. Defaults to the
113
+ * type's latest version, which the response returns.
114
+ */
115
+ schema_version?: number;
116
+ /**
117
+ * ID of the browser the report was observed in. It must belong to the task's
118
+ * project; deleted browsers are accepted. The browser is linked to the task if it
119
+ * is not already.
120
+ */
121
+ session_id?: string;
122
+ }
123
+ export interface ReportListParams extends OffsetPaginationParams {
124
+ /**
125
+ * Task whose reports to list.
126
+ */
127
+ task_id: string;
128
+ /**
129
+ * Only return reports of this type.
130
+ */
131
+ type?: string;
132
+ }
133
+ export declare namespace Reports {
134
+ export { type Report as Report, type ReportsOffsetPagination as ReportsOffsetPagination, type ReportCreateParams as ReportCreateParams, type ReportListParams as ReportListParams, };
135
+ }
136
+ //# sourceMappingURL=reports.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../src/resources/reports.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,4BAAyB;AA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IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC9D;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,CAAC,OAAO,WAAW,OAAO,CAAC;IAC/B,OAAO,EACL,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,uBAAuB,IAAI,uBAAuB,EACvD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;CACH"}
@@ -0,0 +1,58 @@
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.Reports = void 0;
5
+ const resource_1 = require("../core/resource.js");
6
+ const pagination_1 = require("../core/pagination.js");
7
+ const path_1 = require("../internal/utils/path.js");
8
+ /**
9
+ * Discover report types and submit typed reports against tasks.
10
+ */
11
+ class Reports extends resource_1.APIResource {
12
+ /**
13
+ * Submit a typed report against a task. The data is validated against the report
14
+ * type's schema; a validation failure returns 400 with one detail per invalid
15
+ * field. A task can have at most 500 reports.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const report = await client.reports.create({
20
+ * data: { result: 'bar', evidence: 'bar' },
21
+ * task_id: 'x',
22
+ * type: 'task.result',
23
+ * });
24
+ * ```
25
+ */
26
+ create(body, options) {
27
+ return this._client.post('/reports', { body, ...options });
28
+ }
29
+ /**
30
+ * Retrieve a report.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const report = await client.reports.retrieve('id');
35
+ * ```
36
+ */
37
+ retrieve(id, options) {
38
+ return this._client.get((0, path_1.path) `/reports/${id}`, options);
39
+ }
40
+ /**
41
+ * List a task's reports in the order they were submitted, oldest first.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * // Automatically fetches more pages as needed.
46
+ * for await (const report of client.reports.list({
47
+ * task_id: 'task_id',
48
+ * })) {
49
+ * // ...
50
+ * }
51
+ * ```
52
+ */
53
+ list(query, options) {
54
+ return this._client.getAPIList('/reports', (pagination_1.OffsetPagination), { query, ...options });
55
+ }
56
+ }
57
+ exports.Reports = Reports;
58
+ //# sourceMappingURL=reports.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reports.js","sourceRoot":"","sources":["../src/resources/reports.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAAgG;AAEhG,oDAA8C;AAE9C;;GAEG;AACH,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,KAAuB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAA,6BAAwB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;CACF;AA/CD,0BA+CC"}
@@ -0,0 +1,54 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ import { APIResource } from "../core/resource.mjs";
3
+ import { OffsetPagination } from "../core/pagination.mjs";
4
+ import { path } from "../internal/utils/path.mjs";
5
+ /**
6
+ * Discover report types and submit typed reports against tasks.
7
+ */
8
+ export class Reports extends APIResource {
9
+ /**
10
+ * Submit a typed report against a task. The data is validated against the report
11
+ * type's schema; a validation failure returns 400 with one detail per invalid
12
+ * field. A task can have at most 500 reports.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const report = await client.reports.create({
17
+ * data: { result: 'bar', evidence: 'bar' },
18
+ * task_id: 'x',
19
+ * type: 'task.result',
20
+ * });
21
+ * ```
22
+ */
23
+ create(body, options) {
24
+ return this._client.post('/reports', { body, ...options });
25
+ }
26
+ /**
27
+ * Retrieve a report.
28
+ *
29
+ * @example
30
+ * ```ts
31
+ * const report = await client.reports.retrieve('id');
32
+ * ```
33
+ */
34
+ retrieve(id, options) {
35
+ return this._client.get(path `/reports/${id}`, options);
36
+ }
37
+ /**
38
+ * List a task's reports in the order they were submitted, oldest first.
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * // Automatically fetches more pages as needed.
43
+ * for await (const report of client.reports.list({
44
+ * task_id: 'task_id',
45
+ * })) {
46
+ * // ...
47
+ * }
48
+ * ```
49
+ */
50
+ list(query, options) {
51
+ return this._client.getAPIList('/reports', (OffsetPagination), { query, ...options });
52
+ }
53
+ }
54
+ //# sourceMappingURL=reports.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reports.mjs","sourceRoot":"","sources":["../src/resources/reports.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAE/C,OAAO,EAAE,gBAAgB,EAA4C,+BAA2B;AAEhG,OAAO,EAAE,IAAI,EAAE,mCAA+B;AAE9C;;GAEG;AACH,MAAM,OAAO,OAAQ,SAAQ,WAAW;IACtC;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7D,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,YAAY,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,CAAC,KAAuB,EAAE,OAAwB;QACpD,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,UAAU,EAAE,CAAA,gBAAwB,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC9F,CAAC;CACF"}
@@ -0,0 +1,144 @@
1
+ import { APIResource } from "../core/resource.mjs";
2
+ import { APIPromise } from "../core/api-promise.mjs";
3
+ import { OffsetPagination, type OffsetPaginationParams, PagePromise } from "../core/pagination.mjs";
4
+ import { RequestOptions } from "../internal/request-options.mjs";
5
+ /**
6
+ * Define tasks that agents work toward and link the browsers they use.
7
+ */
8
+ export declare class Tasks extends APIResource {
9
+ /**
10
+ * Define a task before or while an agent works on it, optionally linking the
11
+ * browsers it uses. Submit reports against the returned task ID.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const task = await client.tasks.create({
16
+ * description: 'Book a hotel room for two nights',
17
+ * });
18
+ * ```
19
+ */
20
+ create(body: TaskCreateParams, options?: RequestOptions): APIPromise<Task>;
21
+ /**
22
+ * Retrieve a task and the IDs of its linked browsers.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const task = await client.tasks.retrieve('id');
27
+ * ```
28
+ */
29
+ retrieve(id: string, options?: RequestOptions): APIPromise<Task>;
30
+ /**
31
+ * List tasks in the request's project, newest first.
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * // Automatically fetches more pages as needed.
36
+ * for await (const task of client.tasks.list()) {
37
+ * // ...
38
+ * }
39
+ * ```
40
+ */
41
+ list(query?: TaskListParams | null | undefined, options?: RequestOptions): PagePromise<TasksOffsetPagination, Task>;
42
+ /**
43
+ * Link browsers to an existing task. Linking a browser that is already linked has
44
+ * no effect, so the call is safe to retry. Returns the updated task.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * const task = await client.tasks.linkBrowsers('id', {
49
+ * session_ids: ['x'],
50
+ * });
51
+ * ```
52
+ */
53
+ linkBrowsers(id: string, body: TaskLinkBrowsersParams, options?: RequestOptions): APIPromise<Task>;
54
+ }
55
+ export type TasksOffsetPagination = OffsetPagination<Task>;
56
+ /**
57
+ * A goal an agent works toward. Reports are submitted against a task, and browsers
58
+ * can be linked to it. Tasks are immutable apart from added browser links.
59
+ */
60
+ export interface Task {
61
+ /**
62
+ * Unique identifier for the task
63
+ */
64
+ id: string;
65
+ /**
66
+ * When the task was created
67
+ */
68
+ created_at: string;
69
+ /**
70
+ * What the task is meant to accomplish
71
+ */
72
+ description: string;
73
+ /**
74
+ * Caller-defined string key-value pairs for grouping and filtering tasks, such as
75
+ * a user or thread ID. At most 20 keys; keys are 1-64 characters, values at most
76
+ * 256 characters, and keys and values together at most 4 KB.
77
+ */
78
+ metadata: TaskMetadata;
79
+ /**
80
+ * IDs of browsers linked to the task, oldest link first. Linked browsers may since
81
+ * have been deleted.
82
+ */
83
+ session_ids: Array<string>;
84
+ /**
85
+ * When work on the task started
86
+ */
87
+ started_at: string;
88
+ /**
89
+ * Hostname of the website the task targets
90
+ */
91
+ target_website?: string | null;
92
+ }
93
+ /**
94
+ * Caller-defined string key-value pairs for grouping and filtering tasks, such as
95
+ * a user or thread ID. At most 20 keys; keys are 1-64 characters, values at most
96
+ * 256 characters, and keys and values together at most 4 KB.
97
+ */
98
+ export type TaskMetadata = {
99
+ [key: string]: string;
100
+ };
101
+ export interface TaskCreateParams {
102
+ /**
103
+ * What the task is meant to accomplish, at most 4 KB.
104
+ */
105
+ description: string;
106
+ /**
107
+ * Caller-defined string key-value pairs for grouping and filtering tasks, such as
108
+ * a user or thread ID. At most 20 keys; keys are 1-64 characters, values at most
109
+ * 256 characters, and keys and values together at most 4 KB.
110
+ */
111
+ metadata?: TaskMetadata;
112
+ /**
113
+ * IDs of browsers to link to the task. Each must belong to the request's project;
114
+ * deleted browsers can be linked.
115
+ */
116
+ session_ids?: Array<string>;
117
+ /**
118
+ * When work on the task started. Defaults to the time the task is created. Must be
119
+ * no more than 5 minutes in the future or 30 days in the past.
120
+ */
121
+ started_at?: string;
122
+ /**
123
+ * Hostname of the website the task targets, without a scheme or path.
124
+ */
125
+ target_website?: string;
126
+ }
127
+ export interface TaskListParams extends OffsetPaginationParams {
128
+ /**
129
+ * Only return tasks linked to this browser ID.
130
+ */
131
+ session_id?: string;
132
+ }
133
+ export interface TaskLinkBrowsersParams {
134
+ /**
135
+ * IDs of browsers to link. Each must belong to the task's project; deleted
136
+ * browsers can be linked. Browsers already linked are ignored. A task can have at
137
+ * most 100 linked browsers.
138
+ */
139
+ session_ids: Array<string>;
140
+ }
141
+ export declare namespace Tasks {
142
+ export { type Task as Task, type TaskMetadata as TaskMetadata, type TasksOffsetPagination as TasksOffsetPagination, type TaskCreateParams as TaskCreateParams, type TaskListParams as TaskListParams, type TaskLinkBrowsersParams as TaskLinkBrowsersParams, };
143
+ }
144
+ //# sourceMappingURL=tasks.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tasks.d.mts","sourceRoot":"","sources":["../src/resources/tasks.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,6BAAyB;AAC/C,OAAO,EAAE,UAAU,EAAE,gCAA4B;AACjD,OAAO,EAAE,gBAAgB,EAAE,KAAK,sBAAsB,EAAE,WAAW,EAAE,+BAA2B;AAChG,OAAO,EAAE,cAAc,EAAE,wCAAoC;AAG7D;;GAEG;AACH,qBAAa,KAAM,SAAQ,WAAW;IACpC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,gBA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