@athenaintel/sdk 4.3.2167 → 4.3.2168

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 (48) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/aop/client/Client.d.ts +15 -12
  3. package/dist/cjs/api/resources/aop/client/Client.js +19 -13
  4. package/dist/cjs/api/resources/aop/client/requests/ExecuteAsyncAopRequest.d.ts +22 -0
  5. package/dist/cjs/api/resources/aop/client/requests/ExecuteAsyncAopRequest.js +3 -0
  6. package/dist/cjs/api/resources/aop/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/threads/client/Client.d.ts +17 -0
  8. package/dist/cjs/api/resources/threads/client/Client.js +81 -0
  9. package/dist/cjs/api/resources/threads/client/requests/ThreadStatusBatchRequestIn.d.ts +10 -0
  10. package/dist/cjs/api/resources/threads/client/requests/ThreadStatusBatchRequestIn.js +3 -0
  11. package/dist/cjs/api/resources/threads/client/requests/index.d.ts +1 -0
  12. package/dist/cjs/api/types/AopAsyncExecuteResponseOut.d.ts +2 -0
  13. package/dist/cjs/api/types/AopBatchExecuteResponseOut.d.ts +2 -0
  14. package/dist/cjs/api/types/AopBatchRunIn.d.ts +3 -1
  15. package/dist/cjs/api/types/AopBatchRunLaunchOut.d.ts +2 -0
  16. package/dist/cjs/api/types/ThreadStatusBatchItemOut.d.ts +27 -0
  17. package/dist/cjs/api/types/ThreadStatusBatchItemOut.js +3 -0
  18. package/dist/cjs/api/types/ThreadStatusBatchResponseOut.d.ts +20 -0
  19. package/dist/cjs/api/types/ThreadStatusBatchResponseOut.js +3 -0
  20. package/dist/cjs/api/types/index.d.ts +2 -0
  21. package/dist/cjs/api/types/index.js +2 -0
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/BaseClient.mjs +2 -2
  25. package/dist/esm/api/resources/aop/client/Client.d.mts +15 -12
  26. package/dist/esm/api/resources/aop/client/Client.mjs +20 -14
  27. package/dist/esm/api/resources/aop/client/requests/ExecuteAsyncAopRequest.d.mts +22 -0
  28. package/dist/esm/api/resources/aop/client/requests/ExecuteAsyncAopRequest.mjs +2 -0
  29. package/dist/esm/api/resources/aop/client/requests/index.d.mts +1 -0
  30. package/dist/esm/api/resources/threads/client/Client.d.mts +17 -0
  31. package/dist/esm/api/resources/threads/client/Client.mjs +81 -0
  32. package/dist/esm/api/resources/threads/client/requests/ThreadStatusBatchRequestIn.d.mts +10 -0
  33. package/dist/esm/api/resources/threads/client/requests/ThreadStatusBatchRequestIn.mjs +2 -0
  34. package/dist/esm/api/resources/threads/client/requests/index.d.mts +1 -0
  35. package/dist/esm/api/types/AopAsyncExecuteResponseOut.d.mts +2 -0
  36. package/dist/esm/api/types/AopBatchExecuteResponseOut.d.mts +2 -0
  37. package/dist/esm/api/types/AopBatchRunIn.d.mts +3 -1
  38. package/dist/esm/api/types/AopBatchRunLaunchOut.d.mts +2 -0
  39. package/dist/esm/api/types/ThreadStatusBatchItemOut.d.mts +27 -0
  40. package/dist/esm/api/types/ThreadStatusBatchItemOut.mjs +2 -0
  41. package/dist/esm/api/types/ThreadStatusBatchResponseOut.d.mts +20 -0
  42. package/dist/esm/api/types/ThreadStatusBatchResponseOut.mjs +2 -0
  43. package/dist/esm/api/types/index.d.mts +2 -0
  44. package/dist/esm/api/types/index.mjs +2 -0
  45. package/dist/esm/version.d.mts +1 -1
  46. package/dist/esm/version.mjs +1 -1
  47. package/package.json +1 -1
  48. package/reference.md +78 -11
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
43
43
  const headers = (0, headers_js_1.mergeHeaders)({
44
44
  "X-Fern-Language": "JavaScript",
45
45
  "X-Fern-SDK-Name": "@athenaintel/sdk",
46
- "X-Fern-SDK-Version": "4.3.2167",
47
- "User-Agent": "@athenaintel/sdk/4.3.2167",
46
+ "X-Fern-SDK-Version": "4.3.2168",
47
+ "User-Agent": "@athenaintel/sdk/4.3.2168",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -85,34 +85,37 @@ export declare class AopClient {
85
85
  execute(request: AthenaIntelligence.AopExecuteRequestIn, requestOptions?: AopClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AopExecuteResponseOut>;
86
86
  private __execute;
87
87
  /**
88
- * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
88
+ * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion. Send an `Idempotency-Key` header to make the launch safe to retry: if the response is lost, repeating the identical request with the same key returns the original `thread_id` (with `deduplicated: true`) instead of starting a second run. Keys are private to your account; reusing a key with different parameters is rejected with 422, and a retry that races the first attempt gets 409.
89
89
  *
90
- * @param {AthenaIntelligence.AopExecuteRequestIn} request
90
+ * @param {AthenaIntelligence.ExecuteAsyncAopRequest} request
91
91
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
92
92
  *
93
93
  * @throws {@link AthenaIntelligence.BadRequestError}
94
94
  * @throws {@link AthenaIntelligence.UnauthorizedError}
95
95
  * @throws {@link AthenaIntelligence.NotFoundError}
96
+ * @throws {@link AthenaIntelligence.ConflictError}
96
97
  * @throws {@link AthenaIntelligence.UnprocessableEntityError}
97
98
  * @throws {@link AthenaIntelligence.InternalServerError}
98
99
  *
99
100
  * @example
100
101
  * await client.aop.executeAsync({
101
- * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
102
- * run_budget: {
103
- * max_cost_usd: 30,
104
- * max_model_calls: 80
105
- * },
106
- * user_inputs: {
107
- * "company": "Acme Corp",
108
- * "quarter": "Q1 2024"
102
+ * body: {
103
+ * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
104
+ * run_budget: {
105
+ * max_cost_usd: 30,
106
+ * max_model_calls: 80
107
+ * },
108
+ * user_inputs: {
109
+ * "company": "Acme Corp",
110
+ * "quarter": "Q1 2024"
111
+ * }
109
112
  * }
110
113
  * })
111
114
  */
112
- executeAsync(request: AthenaIntelligence.AopExecuteRequestIn, requestOptions?: AopClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AopAsyncExecuteResponseOut>;
115
+ executeAsync(request: AthenaIntelligence.ExecuteAsyncAopRequest, requestOptions?: AopClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AopAsyncExecuteResponseOut>;
113
116
  private __executeAsync;
114
117
  /**
115
- * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others.
118
+ * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others. Runs are idempotent within a batch: a run whose `idempotency_key` (or, when omitted, `client_ref`) was already launched into the same batch with the same parameters is not started again; its original outcome is replayed with `deduplicated: true`.
116
119
  *
117
120
  * @param {AthenaIntelligence.AopBatchExecuteRequestIn} request
118
121
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -349,27 +349,30 @@ class AopClient {
349
349
  });
350
350
  }
351
351
  /**
352
- * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
352
+ * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion. Send an `Idempotency-Key` header to make the launch safe to retry: if the response is lost, repeating the identical request with the same key returns the original `thread_id` (with `deduplicated: true`) instead of starting a second run. Keys are private to your account; reusing a key with different parameters is rejected with 422, and a retry that races the first attempt gets 409.
353
353
  *
354
- * @param {AthenaIntelligence.AopExecuteRequestIn} request
354
+ * @param {AthenaIntelligence.ExecuteAsyncAopRequest} request
355
355
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
356
356
  *
357
357
  * @throws {@link AthenaIntelligence.BadRequestError}
358
358
  * @throws {@link AthenaIntelligence.UnauthorizedError}
359
359
  * @throws {@link AthenaIntelligence.NotFoundError}
360
+ * @throws {@link AthenaIntelligence.ConflictError}
360
361
  * @throws {@link AthenaIntelligence.UnprocessableEntityError}
361
362
  * @throws {@link AthenaIntelligence.InternalServerError}
362
363
  *
363
364
  * @example
364
365
  * await client.aop.executeAsync({
365
- * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
366
- * run_budget: {
367
- * max_cost_usd: 30,
368
- * max_model_calls: 80
369
- * },
370
- * user_inputs: {
371
- * "company": "Acme Corp",
372
- * "quarter": "Q1 2024"
366
+ * body: {
367
+ * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
368
+ * run_budget: {
369
+ * max_cost_usd: 30,
370
+ * max_model_calls: 80
371
+ * },
372
+ * user_inputs: {
373
+ * "company": "Acme Corp",
374
+ * "quarter": "Q1 2024"
375
+ * }
373
376
  * }
374
377
  * })
375
378
  */
@@ -379,8 +382,9 @@ class AopClient {
379
382
  __executeAsync(request, requestOptions) {
380
383
  return __awaiter(this, void 0, void 0, function* () {
381
384
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
385
+ const { "Idempotency-Key": idempotencyKey, body: _body } = request;
382
386
  const _authRequest = yield this._options.authProvider.getAuthRequest();
383
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
387
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Idempotency-Key": idempotencyKey !== undefined ? idempotencyKey : undefined }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
384
388
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
385
389
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/aop/execute-async"),
386
390
  method: "POST",
@@ -388,7 +392,7 @@ class AopClient {
388
392
  contentType: "application/json",
389
393
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
390
394
  requestType: "json",
391
- body: request,
395
+ body: _body,
392
396
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
393
397
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
394
398
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -409,6 +413,8 @@ class AopClient {
409
413
  throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
410
414
  case 404:
411
415
  throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
416
+ case 409:
417
+ throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
412
418
  case 422:
413
419
  throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
414
420
  case 500:
@@ -444,7 +450,7 @@ class AopClient {
444
450
  });
445
451
  }
446
452
  /**
447
- * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others.
453
+ * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others. Runs are idempotent within a batch: a run whose `idempotency_key` (or, when omitted, `client_ref`) was already launched into the same batch with the same parameters is not started again; its original outcome is replayed with `deduplicated: true`.
448
454
  *
449
455
  * @param {AthenaIntelligence.AopBatchExecuteRequestIn} request
450
456
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -0,0 +1,22 @@
1
+ import type * as AthenaIntelligence from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * body: {
6
+ * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
7
+ * run_budget: {
8
+ * max_cost_usd: 30,
9
+ * max_model_calls: 80
10
+ * },
11
+ * user_inputs: {
12
+ * "company": "Acme Corp",
13
+ * "quarter": "Q1 2024"
14
+ * }
15
+ * }
16
+ * }
17
+ */
18
+ export interface ExecuteAsyncAopRequest {
19
+ /** Optional caller-chosen key that makes this launch safe to retry. Repeating the identical request with the same key replays the original response instead of starting another run. */
20
+ "Idempotency-Key"?: string | null;
21
+ body: AthenaIntelligence.AopExecuteRequestIn;
22
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,5 +1,6 @@
1
1
  export type { AopBatchExecuteRequestIn } from "./AopBatchExecuteRequestIn.js";
2
2
  export type { AopConfigUpdateRequestIn } from "./AopConfigUpdateRequestIn.js";
3
3
  export type { AopCreateRequestIn } from "./AopCreateRequestIn.js";
4
+ export type { ExecuteAsyncAopRequest } from "./ExecuteAsyncAopRequest.js";
4
5
  export type { GetBatchStatusAopRequest } from "./GetBatchStatusAopRequest.js";
5
6
  export type { GetConfigAopRequest } from "./GetConfigAopRequest.js";
@@ -28,6 +28,23 @@ export declare class ThreadsClient {
28
28
  */
29
29
  batchStopByAssetId(request: AthenaIntelligence.ThreadBatchStopRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.ThreadBatchStopResponseOut>;
30
30
  private __batchStopByAssetId;
31
+ /**
32
+ * Read the lifecycle status of up to 200 threads in one call, whether they were started by `POST /aop/execute-async` or `POST /aop/execute-batch`. Returns aggregate counts plus one compact entry per thread (status, terminal flag, output availability, timestamps) without loading any messages; fetch results with `GET /threads/{thread_id}/status` once `output_available` is true. Only threads you launched are returned: unknown IDs and other users' threads are listed in `not_found` and are indistinguishable.
33
+ *
34
+ * @param {AthenaIntelligence.ThreadStatusBatchRequestIn} request
35
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
38
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
39
+ * @throws {@link AthenaIntelligence.InternalServerError}
40
+ *
41
+ * @example
42
+ * await client.threads.getStatusBatch({
43
+ * thread_ids: ["thread_12345-6789-abcd-efgh", "thread_22345-6789-abcd-efgh"]
44
+ * })
45
+ */
46
+ getStatusBatch(request: AthenaIntelligence.ThreadStatusBatchRequestIn, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.ThreadStatusBatchResponseOut>;
47
+ private __getStatusBatch;
31
48
  /**
32
49
  * Stop multiple running thread executions in a single request. This endpoint accepts thread IDs (the same IDs used with the single-thread stop endpoint). Each thread is stopped independently - failures for individual threads do not affect other threads in the batch.
33
50
  *
@@ -135,6 +135,87 @@ class ThreadsClient {
135
135
  }
136
136
  });
137
137
  }
138
+ /**
139
+ * Read the lifecycle status of up to 200 threads in one call, whether they were started by `POST /aop/execute-async` or `POST /aop/execute-batch`. Returns aggregate counts plus one compact entry per thread (status, terminal flag, output availability, timestamps) without loading any messages; fetch results with `GET /threads/{thread_id}/status` once `output_available` is true. Only threads you launched are returned: unknown IDs and other users' threads are listed in `not_found` and are indistinguishable.
140
+ *
141
+ * @param {AthenaIntelligence.ThreadStatusBatchRequestIn} request
142
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
143
+ *
144
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
145
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
146
+ * @throws {@link AthenaIntelligence.InternalServerError}
147
+ *
148
+ * @example
149
+ * await client.threads.getStatusBatch({
150
+ * thread_ids: ["thread_12345-6789-abcd-efgh", "thread_22345-6789-abcd-efgh"]
151
+ * })
152
+ */
153
+ getStatusBatch(request, requestOptions) {
154
+ return core.HttpResponsePromise.fromPromise(this.__getStatusBatch(request, requestOptions));
155
+ }
156
+ __getStatusBatch(request, requestOptions) {
157
+ return __awaiter(this, void 0, void 0, function* () {
158
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
159
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
160
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
161
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
162
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/threads/status-batch"),
163
+ method: "POST",
164
+ headers: _headers,
165
+ contentType: "application/json",
166
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
167
+ requestType: "json",
168
+ body: request,
169
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
170
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
171
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
172
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
173
+ logging: this._options.logging,
174
+ });
175
+ if (_response.ok) {
176
+ return {
177
+ data: _response.body,
178
+ rawResponse: _response.rawResponse,
179
+ };
180
+ }
181
+ if (_response.error.reason === "status-code") {
182
+ switch (_response.error.statusCode) {
183
+ case 401:
184
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
185
+ case 422:
186
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
187
+ case 500:
188
+ throw new AthenaIntelligence.InternalServerError(_response.error.body, _response.rawResponse);
189
+ default:
190
+ throw new errors.AthenaIntelligenceError({
191
+ statusCode: _response.error.statusCode,
192
+ body: _response.error.body,
193
+ rawResponse: _response.rawResponse,
194
+ });
195
+ }
196
+ }
197
+ switch (_response.error.reason) {
198
+ case "non-json":
199
+ throw new errors.AthenaIntelligenceError({
200
+ statusCode: _response.error.statusCode,
201
+ body: _response.error.rawBody,
202
+ rawResponse: _response.rawResponse,
203
+ });
204
+ case "body-is-null":
205
+ throw new errors.AthenaIntelligenceError({
206
+ statusCode: _response.error.statusCode,
207
+ rawResponse: _response.rawResponse,
208
+ });
209
+ case "timeout":
210
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/threads/status-batch.");
211
+ case "unknown":
212
+ throw new errors.AthenaIntelligenceError({
213
+ message: _response.error.errorMessage,
214
+ rawResponse: _response.rawResponse,
215
+ });
216
+ }
217
+ });
218
+ }
138
219
  /**
139
220
  * Stop multiple running thread executions in a single request. This endpoint accepts thread IDs (the same IDs used with the single-thread stop endpoint). Each thread is stopped independently - failures for individual threads do not affect other threads in the batch.
140
221
  *
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * thread_ids: ["thread_12345-6789-abcd-efgh", "thread_22345-6789-abcd-efgh"]
5
+ * }
6
+ */
7
+ export interface ThreadStatusBatchRequestIn {
8
+ /** Thread IDs to check (1-200 per request), from `POST /aop/execute-async` or `POST /aop/execute-batch`. Duplicates are collapsed. */
9
+ thread_ids: string[];
10
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,2 +1,3 @@
1
1
  export type { GetStatusThreadsRequest } from "./GetStatusThreadsRequest.js";
2
2
  export type { StopThreadsRequest } from "./StopThreadsRequest.js";
3
+ export type { ThreadStatusBatchRequestIn } from "./ThreadStatusBatchRequestIn.js";
@@ -10,6 +10,8 @@ export interface AopAsyncExecuteResponseOut {
10
10
  aop_title: string;
11
11
  /** Base prompt of the AOP before user inputs were added */
12
12
  base_prompt: string;
13
+ /** True when this response replays an earlier launch with the same `Idempotency-Key`; no new run was started. */
14
+ deduplicated?: boolean;
13
15
  /** Final prompt used for execution including user inputs */
14
16
  final_prompt: string;
15
17
  /** Status message about the async execution */
@@ -5,6 +5,8 @@ import type * as AthenaIntelligence from "../index.js";
5
5
  export interface AopBatchExecuteResponseOut {
6
6
  /** Batch handle. Poll `GET /aop/batches/{batch_id}` for the whole batch instead of every thread, and pass it back to `POST /aop/execute-batch` to append more runs. Null when a new batch launched no runs: there is nothing to poll or append to, so no handle is issued. */
7
7
  batch_id?: string | null;
8
+ /** Runs in this request that replayed an earlier launch (same `idempotency_key` / `client_ref` in this batch) instead of starting */
9
+ deduplicated?: number;
8
10
  /** Runs in this request that could not be launched */
9
11
  failed: number;
10
12
  /** Runs accepted and queued in this request */
@@ -4,8 +4,10 @@
4
4
  export interface AopBatchRunIn {
5
5
  /** ID of the AOP asset to execute for this run. Defaults to the batch-level `asset_id` when omitted. */
6
6
  asset_id?: string | null;
7
- /** Caller-supplied correlation key (e.g. a row id) echoed back on the run in the batch status response. */
7
+ /** Caller-supplied correlation key (e.g. a row id) echoed back on the run in the batch status response. Unique within a batch: a later run with the same `client_ref` in the same batch is not launched again; its outcome is replayed with `deduplicated: true`. */
8
8
  client_ref?: string | null;
9
+ /** Optional per-run idempotency key, scoped to your account and the batch. Repeating a run with the same key (and same parameters) replays the original launch outcome instead of starting a duplicate. Defaults to `client_ref` when omitted. */
10
+ idempotency_key?: string | null;
9
11
  /** Optional user inputs to append to the AOP's prompt as key-value pairs */
10
12
  user_inputs?: Record<string, string | null> | null;
11
13
  }
@@ -6,6 +6,8 @@ export interface AopBatchRunLaunchOut {
6
6
  aop_asset_id?: string | null;
7
7
  /** Caller-supplied correlation key from the request */
8
8
  client_ref?: string | null;
9
+ /** True when this run replays an earlier launch with the same `idempotency_key` / `client_ref` in this batch; no new run was started. */
10
+ deduplicated?: boolean;
9
11
  /** Why the run could not be launched; null on success */
10
12
  error?: string | null;
11
13
  /** Position of the run in the request's `runs` list */
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Lifecycle status of one thread (no messages).
3
+ */
4
+ export interface ThreadStatusBatchItemOut {
5
+ /** ID of the AOP asset the run executes */
6
+ aop_asset_id?: string | null;
7
+ /** Batch handle when the thread was launched via execute-batch */
8
+ batch_id?: string | null;
9
+ /** Caller-supplied correlation key from the launch request */
10
+ client_ref?: string | null;
11
+ /** ISO timestamp when the run reached a terminal state */
12
+ completed_at?: string | null;
13
+ /** When the run was queued */
14
+ created_at?: string | null;
15
+ /** Error message when the run failed */
16
+ error?: string | null;
17
+ /** True once the run is completed, failed or canceled */
18
+ is_terminal: boolean;
19
+ /** True once the run completed successfully and its result can be read from `GET /threads/{thread_id}/status` */
20
+ output_available: boolean;
21
+ /** Canonical run status: scheduled, queued, running, needs_input, completed, failed or canceled */
22
+ status: string;
23
+ /** Thread ID; use `GET /threads/{thread_id}/status` for the result */
24
+ thread_id: string;
25
+ /** When the thread's lifecycle state last changed */
26
+ updated_at?: string | null;
27
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,20 @@
1
+ import type * as AthenaIntelligence from "../index.js";
2
+ /**
3
+ * Response model for the status of many threads.
4
+ */
5
+ export interface ThreadStatusBatchResponseOut {
6
+ /** Found threads per canonical status */
7
+ counts: AthenaIntelligence.AopBatchStatusCountsOut;
8
+ /** Requested threads that exist and belong to you */
9
+ found: number;
10
+ /** True when every found thread has finished */
11
+ is_complete: boolean;
12
+ /** Requested thread IDs that do not exist or are not yours; the two cases are indistinguishable */
13
+ not_found: string[];
14
+ /** Distinct thread IDs in the request */
15
+ requested: number;
16
+ /** Found threads that have finished (completed + failed + canceled) */
17
+ terminal: number;
18
+ /** One entry per found thread, in request order */
19
+ threads: AthenaIntelligence.ThreadStatusBatchItemOut[];
20
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -125,6 +125,8 @@ export * from "./ThinkingContent.js";
125
125
  export * from "./ThreadBatchStopRequest.js";
126
126
  export * from "./ThreadBatchStopResponseOut.js";
127
127
  export * from "./ThreadBatchStopResultItem.js";
128
+ export * from "./ThreadStatusBatchItemOut.js";
129
+ export * from "./ThreadStatusBatchResponseOut.js";
128
130
  export * from "./ThreadStatusResponseOut.js";
129
131
  export * from "./ThreadStopResponseOut.js";
130
132
  export * from "./ToolResultContent.js";
@@ -141,6 +141,8 @@ __exportStar(require("./ThinkingContent.js"), exports);
141
141
  __exportStar(require("./ThreadBatchStopRequest.js"), exports);
142
142
  __exportStar(require("./ThreadBatchStopResponseOut.js"), exports);
143
143
  __exportStar(require("./ThreadBatchStopResultItem.js"), exports);
144
+ __exportStar(require("./ThreadStatusBatchItemOut.js"), exports);
145
+ __exportStar(require("./ThreadStatusBatchResponseOut.js"), exports);
144
146
  __exportStar(require("./ThreadStatusResponseOut.js"), exports);
145
147
  __exportStar(require("./ThreadStopResponseOut.js"), exports);
146
148
  __exportStar(require("./ToolResultContent.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.3.2167";
1
+ export declare const SDK_VERSION = "4.3.2168";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "4.3.2167";
4
+ exports.SDK_VERSION = "4.3.2168";
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
8
  "X-Fern-SDK-Name": "@athenaintel/sdk",
9
- "X-Fern-SDK-Version": "4.3.2167",
10
- "User-Agent": "@athenaintel/sdk/4.3.2167",
9
+ "X-Fern-SDK-Version": "4.3.2168",
10
+ "User-Agent": "@athenaintel/sdk/4.3.2168",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  }, options === null || options === void 0 ? void 0 : options.headers);
@@ -85,34 +85,37 @@ export declare class AopClient {
85
85
  execute(request: AthenaIntelligence.AopExecuteRequestIn, requestOptions?: AopClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AopExecuteResponseOut>;
86
86
  private __execute;
87
87
  /**
88
- * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
88
+ * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion. Send an `Idempotency-Key` header to make the launch safe to retry: if the response is lost, repeating the identical request with the same key returns the original `thread_id` (with `deduplicated: true`) instead of starting a second run. Keys are private to your account; reusing a key with different parameters is rejected with 422, and a retry that races the first attempt gets 409.
89
89
  *
90
- * @param {AthenaIntelligence.AopExecuteRequestIn} request
90
+ * @param {AthenaIntelligence.ExecuteAsyncAopRequest} request
91
91
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
92
92
  *
93
93
  * @throws {@link AthenaIntelligence.BadRequestError}
94
94
  * @throws {@link AthenaIntelligence.UnauthorizedError}
95
95
  * @throws {@link AthenaIntelligence.NotFoundError}
96
+ * @throws {@link AthenaIntelligence.ConflictError}
96
97
  * @throws {@link AthenaIntelligence.UnprocessableEntityError}
97
98
  * @throws {@link AthenaIntelligence.InternalServerError}
98
99
  *
99
100
  * @example
100
101
  * await client.aop.executeAsync({
101
- * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
102
- * run_budget: {
103
- * max_cost_usd: 30,
104
- * max_model_calls: 80
105
- * },
106
- * user_inputs: {
107
- * "company": "Acme Corp",
108
- * "quarter": "Q1 2024"
102
+ * body: {
103
+ * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
104
+ * run_budget: {
105
+ * max_cost_usd: 30,
106
+ * max_model_calls: 80
107
+ * },
108
+ * user_inputs: {
109
+ * "company": "Acme Corp",
110
+ * "quarter": "Q1 2024"
111
+ * }
109
112
  * }
110
113
  * })
111
114
  */
112
- executeAsync(request: AthenaIntelligence.AopExecuteRequestIn, requestOptions?: AopClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AopAsyncExecuteResponseOut>;
115
+ executeAsync(request: AthenaIntelligence.ExecuteAsyncAopRequest, requestOptions?: AopClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.AopAsyncExecuteResponseOut>;
113
116
  private __executeAsync;
114
117
  /**
115
- * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others.
118
+ * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others. Runs are idempotent within a batch: a run whose `idempotency_key` (or, when omitted, `client_ref`) was already launched into the same batch with the same parameters is not started again; its original outcome is replayed with `deduplicated: true`.
116
119
  *
117
120
  * @param {AthenaIntelligence.AopBatchExecuteRequestIn} request
118
121
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -20,7 +20,7 @@ var __rest = (this && this.__rest) || function (s, e) {
20
20
  return t;
21
21
  };
22
22
  import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.mjs";
23
- import { mergeHeaders } from "../../../../core/headers.mjs";
23
+ import { mergeHeaders, mergeOnlyDefinedHeaders } from "../../../../core/headers.mjs";
24
24
  import * as core from "../../../../core/index.mjs";
25
25
  import * as environments from "../../../../environments.mjs";
26
26
  import * as errors from "../../../../errors/index.mjs";
@@ -313,27 +313,30 @@ export class AopClient {
313
313
  });
314
314
  }
315
315
  /**
316
- * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
316
+ * Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion. Send an `Idempotency-Key` header to make the launch safe to retry: if the response is lost, repeating the identical request with the same key returns the original `thread_id` (with `deduplicated: true`) instead of starting a second run. Keys are private to your account; reusing a key with different parameters is rejected with 422, and a retry that races the first attempt gets 409.
317
317
  *
318
- * @param {AthenaIntelligence.AopExecuteRequestIn} request
318
+ * @param {AthenaIntelligence.ExecuteAsyncAopRequest} request
319
319
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
320
320
  *
321
321
  * @throws {@link AthenaIntelligence.BadRequestError}
322
322
  * @throws {@link AthenaIntelligence.UnauthorizedError}
323
323
  * @throws {@link AthenaIntelligence.NotFoundError}
324
+ * @throws {@link AthenaIntelligence.ConflictError}
324
325
  * @throws {@link AthenaIntelligence.UnprocessableEntityError}
325
326
  * @throws {@link AthenaIntelligence.InternalServerError}
326
327
  *
327
328
  * @example
328
329
  * await client.aop.executeAsync({
329
- * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
330
- * run_budget: {
331
- * max_cost_usd: 30,
332
- * max_model_calls: 80
333
- * },
334
- * user_inputs: {
335
- * "company": "Acme Corp",
336
- * "quarter": "Q1 2024"
330
+ * body: {
331
+ * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
332
+ * run_budget: {
333
+ * max_cost_usd: 30,
334
+ * max_model_calls: 80
335
+ * },
336
+ * user_inputs: {
337
+ * "company": "Acme Corp",
338
+ * "quarter": "Q1 2024"
339
+ * }
337
340
  * }
338
341
  * })
339
342
  */
@@ -343,8 +346,9 @@ export class AopClient {
343
346
  __executeAsync(request, requestOptions) {
344
347
  return __awaiter(this, void 0, void 0, function* () {
345
348
  var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
349
+ const { "Idempotency-Key": idempotencyKey, body: _body } = request;
346
350
  const _authRequest = yield this._options.authProvider.getAuthRequest();
347
- const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
351
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({ "Idempotency-Key": idempotencyKey !== undefined ? idempotencyKey : undefined }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
348
352
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
349
353
  url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/aop/execute-async"),
350
354
  method: "POST",
@@ -352,7 +356,7 @@ export class AopClient {
352
356
  contentType: "application/json",
353
357
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
354
358
  requestType: "json",
355
- body: request,
359
+ body: _body,
356
360
  timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
357
361
  maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
358
362
  abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
@@ -373,6 +377,8 @@ export class AopClient {
373
377
  throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
374
378
  case 404:
375
379
  throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
380
+ case 409:
381
+ throw new AthenaIntelligence.ConflictError(_response.error.body, _response.rawResponse);
376
382
  case 422:
377
383
  throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
378
384
  case 500:
@@ -408,7 +414,7 @@ export class AopClient {
408
414
  });
409
415
  }
410
416
  /**
411
- * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others.
417
+ * Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others. Runs are idempotent within a batch: a run whose `idempotency_key` (or, when omitted, `client_ref`) was already launched into the same batch with the same parameters is not started again; its original outcome is replayed with `deduplicated: true`.
412
418
  *
413
419
  * @param {AthenaIntelligence.AopBatchExecuteRequestIn} request
414
420
  * @param {AopClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -0,0 +1,22 @@
1
+ import type * as AthenaIntelligence from "../../../../index.mjs";
2
+ /**
3
+ * @example
4
+ * {
5
+ * body: {
6
+ * asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
7
+ * run_budget: {
8
+ * max_cost_usd: 30,
9
+ * max_model_calls: 80
10
+ * },
11
+ * user_inputs: {
12
+ * "company": "Acme Corp",
13
+ * "quarter": "Q1 2024"
14
+ * }
15
+ * }
16
+ * }
17
+ */
18
+ export interface ExecuteAsyncAopRequest {
19
+ /** Optional caller-chosen key that makes this launch safe to retry. Repeating the identical request with the same key replays the original response instead of starting another run. */
20
+ "Idempotency-Key"?: string | null;
21
+ body: AthenaIntelligence.AopExecuteRequestIn;
22
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,5 +1,6 @@
1
1
  export type { AopBatchExecuteRequestIn } from "./AopBatchExecuteRequestIn.mjs";
2
2
  export type { AopConfigUpdateRequestIn } from "./AopConfigUpdateRequestIn.mjs";
3
3
  export type { AopCreateRequestIn } from "./AopCreateRequestIn.mjs";
4
+ export type { ExecuteAsyncAopRequest } from "./ExecuteAsyncAopRequest.mjs";
4
5
  export type { GetBatchStatusAopRequest } from "./GetBatchStatusAopRequest.mjs";
5
6
  export type { GetConfigAopRequest } from "./GetConfigAopRequest.mjs";
@@ -28,6 +28,23 @@ export declare class ThreadsClient {
28
28
  */
29
29
  batchStopByAssetId(request: AthenaIntelligence.ThreadBatchStopRequest, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.ThreadBatchStopResponseOut>;
30
30
  private __batchStopByAssetId;
31
+ /**
32
+ * Read the lifecycle status of up to 200 threads in one call, whether they were started by `POST /aop/execute-async` or `POST /aop/execute-batch`. Returns aggregate counts plus one compact entry per thread (status, terminal flag, output availability, timestamps) without loading any messages; fetch results with `GET /threads/{thread_id}/status` once `output_available` is true. Only threads you launched are returned: unknown IDs and other users' threads are listed in `not_found` and are indistinguishable.
33
+ *
34
+ * @param {AthenaIntelligence.ThreadStatusBatchRequestIn} request
35
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
38
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
39
+ * @throws {@link AthenaIntelligence.InternalServerError}
40
+ *
41
+ * @example
42
+ * await client.threads.getStatusBatch({
43
+ * thread_ids: ["thread_12345-6789-abcd-efgh", "thread_22345-6789-abcd-efgh"]
44
+ * })
45
+ */
46
+ getStatusBatch(request: AthenaIntelligence.ThreadStatusBatchRequestIn, requestOptions?: ThreadsClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.ThreadStatusBatchResponseOut>;
47
+ private __getStatusBatch;
31
48
  /**
32
49
  * Stop multiple running thread executions in a single request. This endpoint accepts thread IDs (the same IDs used with the single-thread stop endpoint). Each thread is stopped independently - failures for individual threads do not affect other threads in the batch.
33
50
  *
@@ -99,6 +99,87 @@ export class ThreadsClient {
99
99
  }
100
100
  });
101
101
  }
102
+ /**
103
+ * Read the lifecycle status of up to 200 threads in one call, whether they were started by `POST /aop/execute-async` or `POST /aop/execute-batch`. Returns aggregate counts plus one compact entry per thread (status, terminal flag, output availability, timestamps) without loading any messages; fetch results with `GET /threads/{thread_id}/status` once `output_available` is true. Only threads you launched are returned: unknown IDs and other users' threads are listed in `not_found` and are indistinguishable.
104
+ *
105
+ * @param {AthenaIntelligence.ThreadStatusBatchRequestIn} request
106
+ * @param {ThreadsClient.RequestOptions} requestOptions - Request-specific configuration.
107
+ *
108
+ * @throws {@link AthenaIntelligence.UnauthorizedError}
109
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
110
+ * @throws {@link AthenaIntelligence.InternalServerError}
111
+ *
112
+ * @example
113
+ * await client.threads.getStatusBatch({
114
+ * thread_ids: ["thread_12345-6789-abcd-efgh", "thread_22345-6789-abcd-efgh"]
115
+ * })
116
+ */
117
+ getStatusBatch(request, requestOptions) {
118
+ return core.HttpResponsePromise.fromPromise(this.__getStatusBatch(request, requestOptions));
119
+ }
120
+ __getStatusBatch(request, requestOptions) {
121
+ return __awaiter(this, void 0, void 0, function* () {
122
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
123
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
124
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
125
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
126
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.AthenaIntelligenceEnvironment.Production, "api/v0/threads/status-batch"),
127
+ method: "POST",
128
+ headers: _headers,
129
+ contentType: "application/json",
130
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
131
+ requestType: "json",
132
+ body: request,
133
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
134
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
135
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
136
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
137
+ logging: this._options.logging,
138
+ });
139
+ if (_response.ok) {
140
+ return {
141
+ data: _response.body,
142
+ rawResponse: _response.rawResponse,
143
+ };
144
+ }
145
+ if (_response.error.reason === "status-code") {
146
+ switch (_response.error.statusCode) {
147
+ case 401:
148
+ throw new AthenaIntelligence.UnauthorizedError(_response.error.body, _response.rawResponse);
149
+ case 422:
150
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
151
+ case 500:
152
+ throw new AthenaIntelligence.InternalServerError(_response.error.body, _response.rawResponse);
153
+ default:
154
+ throw new errors.AthenaIntelligenceError({
155
+ statusCode: _response.error.statusCode,
156
+ body: _response.error.body,
157
+ rawResponse: _response.rawResponse,
158
+ });
159
+ }
160
+ }
161
+ switch (_response.error.reason) {
162
+ case "non-json":
163
+ throw new errors.AthenaIntelligenceError({
164
+ statusCode: _response.error.statusCode,
165
+ body: _response.error.rawBody,
166
+ rawResponse: _response.rawResponse,
167
+ });
168
+ case "body-is-null":
169
+ throw new errors.AthenaIntelligenceError({
170
+ statusCode: _response.error.statusCode,
171
+ rawResponse: _response.rawResponse,
172
+ });
173
+ case "timeout":
174
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling POST /api/v0/threads/status-batch.");
175
+ case "unknown":
176
+ throw new errors.AthenaIntelligenceError({
177
+ message: _response.error.errorMessage,
178
+ rawResponse: _response.rawResponse,
179
+ });
180
+ }
181
+ });
182
+ }
102
183
  /**
103
184
  * Stop multiple running thread executions in a single request. This endpoint accepts thread IDs (the same IDs used with the single-thread stop endpoint). Each thread is stopped independently - failures for individual threads do not affect other threads in the batch.
104
185
  *
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * thread_ids: ["thread_12345-6789-abcd-efgh", "thread_22345-6789-abcd-efgh"]
5
+ * }
6
+ */
7
+ export interface ThreadStatusBatchRequestIn {
8
+ /** Thread IDs to check (1-200 per request), from `POST /aop/execute-async` or `POST /aop/execute-batch`. Duplicates are collapsed. */
9
+ thread_ids: string[];
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,2 +1,3 @@
1
1
  export type { GetStatusThreadsRequest } from "./GetStatusThreadsRequest.mjs";
2
2
  export type { StopThreadsRequest } from "./StopThreadsRequest.mjs";
3
+ export type { ThreadStatusBatchRequestIn } from "./ThreadStatusBatchRequestIn.mjs";
@@ -10,6 +10,8 @@ export interface AopAsyncExecuteResponseOut {
10
10
  aop_title: string;
11
11
  /** Base prompt of the AOP before user inputs were added */
12
12
  base_prompt: string;
13
+ /** True when this response replays an earlier launch with the same `Idempotency-Key`; no new run was started. */
14
+ deduplicated?: boolean;
13
15
  /** Final prompt used for execution including user inputs */
14
16
  final_prompt: string;
15
17
  /** Status message about the async execution */
@@ -5,6 +5,8 @@ import type * as AthenaIntelligence from "../index.mjs";
5
5
  export interface AopBatchExecuteResponseOut {
6
6
  /** Batch handle. Poll `GET /aop/batches/{batch_id}` for the whole batch instead of every thread, and pass it back to `POST /aop/execute-batch` to append more runs. Null when a new batch launched no runs: there is nothing to poll or append to, so no handle is issued. */
7
7
  batch_id?: string | null;
8
+ /** Runs in this request that replayed an earlier launch (same `idempotency_key` / `client_ref` in this batch) instead of starting */
9
+ deduplicated?: number;
8
10
  /** Runs in this request that could not be launched */
9
11
  failed: number;
10
12
  /** Runs accepted and queued in this request */
@@ -4,8 +4,10 @@
4
4
  export interface AopBatchRunIn {
5
5
  /** ID of the AOP asset to execute for this run. Defaults to the batch-level `asset_id` when omitted. */
6
6
  asset_id?: string | null;
7
- /** Caller-supplied correlation key (e.g. a row id) echoed back on the run in the batch status response. */
7
+ /** Caller-supplied correlation key (e.g. a row id) echoed back on the run in the batch status response. Unique within a batch: a later run with the same `client_ref` in the same batch is not launched again; its outcome is replayed with `deduplicated: true`. */
8
8
  client_ref?: string | null;
9
+ /** Optional per-run idempotency key, scoped to your account and the batch. Repeating a run with the same key (and same parameters) replays the original launch outcome instead of starting a duplicate. Defaults to `client_ref` when omitted. */
10
+ idempotency_key?: string | null;
9
11
  /** Optional user inputs to append to the AOP's prompt as key-value pairs */
10
12
  user_inputs?: Record<string, string | null> | null;
11
13
  }
@@ -6,6 +6,8 @@ export interface AopBatchRunLaunchOut {
6
6
  aop_asset_id?: string | null;
7
7
  /** Caller-supplied correlation key from the request */
8
8
  client_ref?: string | null;
9
+ /** True when this run replays an earlier launch with the same `idempotency_key` / `client_ref` in this batch; no new run was started. */
10
+ deduplicated?: boolean;
9
11
  /** Why the run could not be launched; null on success */
10
12
  error?: string | null;
11
13
  /** Position of the run in the request's `runs` list */
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Lifecycle status of one thread (no messages).
3
+ */
4
+ export interface ThreadStatusBatchItemOut {
5
+ /** ID of the AOP asset the run executes */
6
+ aop_asset_id?: string | null;
7
+ /** Batch handle when the thread was launched via execute-batch */
8
+ batch_id?: string | null;
9
+ /** Caller-supplied correlation key from the launch request */
10
+ client_ref?: string | null;
11
+ /** ISO timestamp when the run reached a terminal state */
12
+ completed_at?: string | null;
13
+ /** When the run was queued */
14
+ created_at?: string | null;
15
+ /** Error message when the run failed */
16
+ error?: string | null;
17
+ /** True once the run is completed, failed or canceled */
18
+ is_terminal: boolean;
19
+ /** True once the run completed successfully and its result can be read from `GET /threads/{thread_id}/status` */
20
+ output_available: boolean;
21
+ /** Canonical run status: scheduled, queued, running, needs_input, completed, failed or canceled */
22
+ status: string;
23
+ /** Thread ID; use `GET /threads/{thread_id}/status` for the result */
24
+ thread_id: string;
25
+ /** When the thread's lifecycle state last changed */
26
+ updated_at?: string | null;
27
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,20 @@
1
+ import type * as AthenaIntelligence from "../index.mjs";
2
+ /**
3
+ * Response model for the status of many threads.
4
+ */
5
+ export interface ThreadStatusBatchResponseOut {
6
+ /** Found threads per canonical status */
7
+ counts: AthenaIntelligence.AopBatchStatusCountsOut;
8
+ /** Requested threads that exist and belong to you */
9
+ found: number;
10
+ /** True when every found thread has finished */
11
+ is_complete: boolean;
12
+ /** Requested thread IDs that do not exist or are not yours; the two cases are indistinguishable */
13
+ not_found: string[];
14
+ /** Distinct thread IDs in the request */
15
+ requested: number;
16
+ /** Found threads that have finished (completed + failed + canceled) */
17
+ terminal: number;
18
+ /** One entry per found thread, in request order */
19
+ threads: AthenaIntelligence.ThreadStatusBatchItemOut[];
20
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -125,6 +125,8 @@ export * from "./ThinkingContent.mjs";
125
125
  export * from "./ThreadBatchStopRequest.mjs";
126
126
  export * from "./ThreadBatchStopResponseOut.mjs";
127
127
  export * from "./ThreadBatchStopResultItem.mjs";
128
+ export * from "./ThreadStatusBatchItemOut.mjs";
129
+ export * from "./ThreadStatusBatchResponseOut.mjs";
128
130
  export * from "./ThreadStatusResponseOut.mjs";
129
131
  export * from "./ThreadStopResponseOut.mjs";
130
132
  export * from "./ToolResultContent.mjs";
@@ -125,6 +125,8 @@ export * from "./ThinkingContent.mjs";
125
125
  export * from "./ThreadBatchStopRequest.mjs";
126
126
  export * from "./ThreadBatchStopResponseOut.mjs";
127
127
  export * from "./ThreadBatchStopResultItem.mjs";
128
+ export * from "./ThreadStatusBatchItemOut.mjs";
129
+ export * from "./ThreadStatusBatchResponseOut.mjs";
128
130
  export * from "./ThreadStatusResponseOut.mjs";
129
131
  export * from "./ThreadStopResponseOut.mjs";
130
132
  export * from "./ToolResultContent.mjs";
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.3.2167";
1
+ export declare const SDK_VERSION = "4.3.2168";
@@ -1 +1 @@
1
- export const SDK_VERSION = "4.3.2167";
1
+ export const SDK_VERSION = "4.3.2168";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@athenaintel/sdk",
3
- "version": "4.3.2167",
3
+ "version": "4.3.2168",
4
4
  "private": false,
5
5
  "repository": "github:Athena-Intel/athena-typescript",
6
6
  "type": "commonjs",
package/reference.md CHANGED
@@ -224,7 +224,7 @@ await client.aop.execute({
224
224
  <dl>
225
225
  <dd>
226
226
 
227
- Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion.
227
+ Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Returns immediately with a thread_id for tracking execution progress without waiting for completion. Send an `Idempotency-Key` header to make the launch safe to retry: if the response is lost, repeating the identical request with the same key returns the original `thread_id` (with `deduplicated: true`) instead of starting a second run. Keys are private to your account; reusing a key with different parameters is rejected with 422, and a retry that races the first attempt gets 409.
228
228
  </dd>
229
229
  </dl>
230
230
  </dd>
@@ -240,14 +240,16 @@ Start execution of an Agent Operating Procedure (AOP) asset asynchronously. Retu
240
240
 
241
241
  ```typescript
242
242
  await client.aop.executeAsync({
243
- asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
244
- run_budget: {
245
- max_cost_usd: 30,
246
- max_model_calls: 80
247
- },
248
- user_inputs: {
249
- "company": "Acme Corp",
250
- "quarter": "Q1 2024"
243
+ body: {
244
+ asset_id: "asset_9249292-d118-42d3-95b4-00eccfe0754f",
245
+ run_budget: {
246
+ max_cost_usd: 30,
247
+ max_model_calls: 80
248
+ },
249
+ user_inputs: {
250
+ "company": "Acme Corp",
251
+ "quarter": "Q1 2024"
252
+ }
251
253
  }
252
254
  });
253
255
 
@@ -265,7 +267,7 @@ await client.aop.executeAsync({
265
267
  <dl>
266
268
  <dd>
267
269
 
268
- **request:** `AthenaIntelligence.AopExecuteRequestIn`
270
+ **request:** `AthenaIntelligence.ExecuteAsyncAopRequest`
269
271
 
270
272
  </dd>
271
273
  </dl>
@@ -297,7 +299,7 @@ await client.aop.executeAsync({
297
299
  <dl>
298
300
  <dd>
299
301
 
300
- Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others.
302
+ Start many Agent Operating Procedure (AOP) runs under one batch handle. Each run is queued exactly like `POST /aop/execute-async`; the response returns a `batch_id` so the caller polls `GET /aop/batches/{batch_id}` once per batch instead of once per thread. Pass the `batch_id` back to append more runs to the same batch. Runs are launched independently: a run that fails to launch is reported with an error and does not stop the others. Runs are idempotent within a batch: a run whose `idempotency_key` (or, when omitted, `client_ref`) was already launched into the same batch with the same parameters is not started again; its original outcome is replayed with `deduplicated: true`.
301
303
  </dd>
302
304
  </dl>
303
305
  </dd>
@@ -3874,6 +3876,71 @@ await client.threads.batchStopByAssetId({
3874
3876
  </dl>
3875
3877
 
3876
3878
 
3879
+ </dd>
3880
+ </dl>
3881
+ </details>
3882
+
3883
+ <details><summary><code>client.threads.<a href="/src/api/resources/threads/client/Client.ts">getStatusBatch</a>({ ...params }) -> AthenaIntelligence.ThreadStatusBatchResponseOut</code></summary>
3884
+ <dl>
3885
+ <dd>
3886
+
3887
+ #### 📝 Description
3888
+
3889
+ <dl>
3890
+ <dd>
3891
+
3892
+ <dl>
3893
+ <dd>
3894
+
3895
+ Read the lifecycle status of up to 200 threads in one call, whether they were started by `POST /aop/execute-async` or `POST /aop/execute-batch`. Returns aggregate counts plus one compact entry per thread (status, terminal flag, output availability, timestamps) without loading any messages; fetch results with `GET /threads/{thread_id}/status` once `output_available` is true. Only threads you launched are returned: unknown IDs and other users' threads are listed in `not_found` and are indistinguishable.
3896
+ </dd>
3897
+ </dl>
3898
+ </dd>
3899
+ </dl>
3900
+
3901
+ #### 🔌 Usage
3902
+
3903
+ <dl>
3904
+ <dd>
3905
+
3906
+ <dl>
3907
+ <dd>
3908
+
3909
+ ```typescript
3910
+ await client.threads.getStatusBatch({
3911
+ thread_ids: ["thread_12345-6789-abcd-efgh", "thread_22345-6789-abcd-efgh"]
3912
+ });
3913
+
3914
+ ```
3915
+ </dd>
3916
+ </dl>
3917
+ </dd>
3918
+ </dl>
3919
+
3920
+ #### ⚙️ Parameters
3921
+
3922
+ <dl>
3923
+ <dd>
3924
+
3925
+ <dl>
3926
+ <dd>
3927
+
3928
+ **request:** `AthenaIntelligence.ThreadStatusBatchRequestIn`
3929
+
3930
+ </dd>
3931
+ </dl>
3932
+
3933
+ <dl>
3934
+ <dd>
3935
+
3936
+ **requestOptions:** `ThreadsClient.RequestOptions`
3937
+
3938
+ </dd>
3939
+ </dl>
3940
+ </dd>
3941
+ </dl>
3942
+
3943
+
3877
3944
  </dd>
3878
3945
  </dl>
3879
3946
  </details>