@athenaintel/sdk 4.3.2250 → 4.3.2252

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 (70) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/workspaces/client/Client.d.ts +57 -0
  3. package/dist/cjs/api/resources/workspaces/client/Client.js +281 -0
  4. package/dist/cjs/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.d.ts +12 -0
  5. package/dist/cjs/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.js +3 -0
  6. package/dist/cjs/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.d.ts +18 -0
  7. package/dist/cjs/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.js +3 -0
  8. package/dist/cjs/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.d.ts +22 -0
  9. package/dist/cjs/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.js +3 -0
  10. package/dist/cjs/api/resources/workspaces/client/requests/index.d.ts +3 -0
  11. package/dist/cjs/api/types/WorkspaceMembershipListResponseOut.d.ts +12 -0
  12. package/dist/cjs/api/types/WorkspaceMembershipListResponseOut.js +3 -0
  13. package/dist/cjs/api/types/WorkspaceMembershipOut.d.ts +18 -0
  14. package/dist/cjs/api/types/WorkspaceMembershipOut.js +3 -0
  15. package/dist/cjs/api/types/WorkspaceUsageComputerOut.d.ts +22 -0
  16. package/dist/cjs/api/types/WorkspaceUsageComputerOut.js +3 -0
  17. package/dist/cjs/api/types/WorkspaceUsageDayOut.d.ts +14 -0
  18. package/dist/cjs/api/types/WorkspaceUsageDayOut.js +3 -0
  19. package/dist/cjs/api/types/WorkspaceUsageResponseOut.d.ts +36 -0
  20. package/dist/cjs/api/types/WorkspaceUsageResponseOut.js +3 -0
  21. package/dist/cjs/api/types/WorkspaceUsageSessionRowOut.d.ts +65 -0
  22. package/dist/cjs/api/types/WorkspaceUsageSessionRowOut.js +3 -0
  23. package/dist/cjs/api/types/WorkspaceUsageSessionsResponseOut.d.ts +13 -0
  24. package/dist/cjs/api/types/WorkspaceUsageSessionsResponseOut.js +3 -0
  25. package/dist/cjs/api/types/WorkspaceUsageTokensOut.d.ts +17 -0
  26. package/dist/cjs/api/types/WorkspaceUsageTokensOut.js +3 -0
  27. package/dist/cjs/api/types/WorkspaceUsageUserOut.d.ts +22 -0
  28. package/dist/cjs/api/types/WorkspaceUsageUserOut.js +3 -0
  29. package/dist/cjs/api/types/WorkspaceUsageWindowOut.d.ts +15 -0
  30. package/dist/cjs/api/types/WorkspaceUsageWindowOut.js +3 -0
  31. package/dist/cjs/api/types/index.d.ts +10 -0
  32. package/dist/cjs/api/types/index.js +10 -0
  33. package/dist/cjs/version.d.ts +1 -1
  34. package/dist/cjs/version.js +1 -1
  35. package/dist/esm/BaseClient.mjs +2 -2
  36. package/dist/esm/api/resources/workspaces/client/Client.d.mts +57 -0
  37. package/dist/esm/api/resources/workspaces/client/Client.mjs +281 -0
  38. package/dist/esm/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.d.mts +12 -0
  39. package/dist/esm/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.mjs +2 -0
  40. package/dist/esm/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.d.mts +18 -0
  41. package/dist/esm/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.mjs +2 -0
  42. package/dist/esm/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.d.mts +22 -0
  43. package/dist/esm/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.mjs +2 -0
  44. package/dist/esm/api/resources/workspaces/client/requests/index.d.mts +3 -0
  45. package/dist/esm/api/types/WorkspaceMembershipListResponseOut.d.mts +12 -0
  46. package/dist/esm/api/types/WorkspaceMembershipListResponseOut.mjs +2 -0
  47. package/dist/esm/api/types/WorkspaceMembershipOut.d.mts +18 -0
  48. package/dist/esm/api/types/WorkspaceMembershipOut.mjs +2 -0
  49. package/dist/esm/api/types/WorkspaceUsageComputerOut.d.mts +22 -0
  50. package/dist/esm/api/types/WorkspaceUsageComputerOut.mjs +2 -0
  51. package/dist/esm/api/types/WorkspaceUsageDayOut.d.mts +14 -0
  52. package/dist/esm/api/types/WorkspaceUsageDayOut.mjs +2 -0
  53. package/dist/esm/api/types/WorkspaceUsageResponseOut.d.mts +36 -0
  54. package/dist/esm/api/types/WorkspaceUsageResponseOut.mjs +2 -0
  55. package/dist/esm/api/types/WorkspaceUsageSessionRowOut.d.mts +65 -0
  56. package/dist/esm/api/types/WorkspaceUsageSessionRowOut.mjs +2 -0
  57. package/dist/esm/api/types/WorkspaceUsageSessionsResponseOut.d.mts +13 -0
  58. package/dist/esm/api/types/WorkspaceUsageSessionsResponseOut.mjs +2 -0
  59. package/dist/esm/api/types/WorkspaceUsageTokensOut.d.mts +17 -0
  60. package/dist/esm/api/types/WorkspaceUsageTokensOut.mjs +2 -0
  61. package/dist/esm/api/types/WorkspaceUsageUserOut.d.mts +22 -0
  62. package/dist/esm/api/types/WorkspaceUsageUserOut.mjs +2 -0
  63. package/dist/esm/api/types/WorkspaceUsageWindowOut.d.mts +15 -0
  64. package/dist/esm/api/types/WorkspaceUsageWindowOut.mjs +2 -0
  65. package/dist/esm/api/types/index.d.mts +10 -0
  66. package/dist/esm/api/types/index.mjs +10 -0
  67. package/dist/esm/version.d.mts +1 -1
  68. package/dist/esm/version.mjs +1 -1
  69. package/package.json +1 -1
  70. package/reference.md +200 -0
@@ -0,0 +1,65 @@
1
+ /**
2
+ * Token usage of one session for one provider/model/status combination.
3
+ */
4
+ export interface WorkspaceUsageSessionRowOut {
5
+ /** AOP asset id when started by an AOP run */
6
+ aop_id: string | null;
7
+ /** Title of that AOP */
8
+ aop_title: string | null;
9
+ /** Billing attribution of the session */
10
+ billed_to: string | null;
11
+ /** Null for an `untracked` row */
12
+ cache_creation_input_tokens: number | null;
13
+ /** Null for an `untracked` row */
14
+ cache_read_input_tokens: number | null;
15
+ /** Earliest model call in the row */
16
+ first_event_at: string | null;
17
+ /** Null for an `untracked` row */
18
+ input_tokens: number | null;
19
+ /** Latest model call in the row */
20
+ last_event_at: string | null;
21
+ /** How the session was started (user_chat, aop_execution, public_api, ...) */
22
+ origin_kind: string | null;
23
+ /** Human label for origin_kind */
24
+ origin_kind_label: string | null;
25
+ /** Null for an `untracked` row */
26
+ output_tokens: number | null;
27
+ /** Project asset id, if any */
28
+ project_id: string | null;
29
+ /** Title of that project */
30
+ project_title: string | null;
31
+ /** LLM provider */
32
+ provider: string;
33
+ /** Null for an `untracked` row */
34
+ reasoning_output_tokens: number | null;
35
+ /** Model the session asked for */
36
+ requested_model: string | null;
37
+ /** Model that actually served the calls */
38
+ resolved_model: string;
39
+ /** Billed cost of this row in USD; safe to sum across rows */
40
+ row_total_cost_usd: number;
41
+ /** Model calls aggregated into this row */
42
+ run_count: number;
43
+ /** When the session was created */
44
+ session_created_at: string;
45
+ /** Session (conversation) asset id */
46
+ session_id: string;
47
+ /** Billed cost of the whole session in USD, carried by the session's first row only and null on its other rows, so summing the column never double-counts (same convention as the CSV export) */
48
+ session_total_cost_usd: number | null;
49
+ /** Outcome of the aggregated calls; `untracked` marks a session metered before token tracking existed, whose token counters are null */
50
+ status: string;
51
+ /** Null for an `untracked` row */
52
+ total_tokens: number | null;
53
+ /** AOP trigger type, if any */
54
+ trigger_type: string | null;
55
+ /** Null for an `untracked` row */
56
+ uncached_input_tokens: number | null;
57
+ /** Window end (exclusive) the row was bounded to */
58
+ usage_period_end_exclusive: string | null;
59
+ /** Window start the row was bounded to */
60
+ usage_period_start: string;
61
+ /** Email of the member who ran the session */
62
+ user_email: string | null;
63
+ /** Display name of that member */
64
+ user_name: string | null;
65
+ }
@@ -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,13 @@
1
+ import type * as AthenaIntelligence from "../index.js";
2
+ /**
3
+ * One page of per-session token usage for a workspace.
4
+ */
5
+ export interface WorkspaceUsageSessionsResponseOut {
6
+ /** Pass as `cursor` to fetch the next page; null when the window is exhausted */
7
+ next_cursor: string | null;
8
+ /** Rows for this page, newest session first */
9
+ sessions: AthenaIntelligence.WorkspaceUsageSessionRowOut[];
10
+ window: AthenaIntelligence.WorkspaceUsageWindowOut;
11
+ /** Workspace the rows belong to */
12
+ workspace_id: string;
13
+ }
@@ -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,17 @@
1
+ /**
2
+ * Token counters summed from the sessions' LLM usage ledgers.
3
+ */
4
+ export interface WorkspaceUsageTokensOut {
5
+ /** Input tokens written to the provider's prompt cache */
6
+ cache_creation_input_tokens: number;
7
+ /** Input tokens served from the provider's prompt cache */
8
+ cache_read_input_tokens: number;
9
+ /** Input (prompt) tokens, including cached reads */
10
+ input_tokens: number;
11
+ /** Output (completion) tokens, including reasoning tokens */
12
+ output_tokens: number;
13
+ /** Output tokens spent on reasoning */
14
+ reasoning_output_tokens: number;
15
+ /** Total tokens (input + output) */
16
+ total_tokens: number;
17
+ }
@@ -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,22 @@
1
+ import type * as AthenaIntelligence from "../index.js";
2
+ /**
3
+ * Usage of one workspace member over the window.
4
+ */
5
+ export interface WorkspaceUsageUserOut {
6
+ /** The user's email */
7
+ email: string;
8
+ /** First name */
9
+ first_name?: string | null;
10
+ /** Last name */
11
+ last_name?: string | null;
12
+ /** When the user's most recent session was created */
13
+ last_session_at?: string | null;
14
+ /** Number of sessions */
15
+ session_count: number;
16
+ /** Token counters across the user's sessions */
17
+ tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
18
+ /** Total LLM cost in USD */
19
+ total_cost_usd: number;
20
+ /** The user ID */
21
+ user_id: string;
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 });
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The reporting window a usage page covers.
3
+ */
4
+ export interface WorkspaceUsageWindowOut {
5
+ /** Number of days the window spans */
6
+ days: number;
7
+ /** Last UTC day (inclusive) of an explicit window; null for a rolling window */
8
+ end_date: string | null;
9
+ /** First UTC day of an explicit `from`/`to` window; null for a rolling window */
10
+ start_date: string | null;
11
+ /** Window end (exclusive); null means 'now' for a rolling window */
12
+ usage_period_end_exclusive: string | null;
13
+ /** Window start (inclusive) */
14
+ usage_period_start: string;
15
+ }
@@ -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 });
@@ -165,7 +165,17 @@ export * from "./WorkspaceDisclaimerOut.js";
165
165
  export * from "./WorkspaceInfoOut.js";
166
166
  export * from "./WorkspaceMemberOut.js";
167
167
  export * from "./WorkspaceMemberSearchResponseOut.js";
168
+ export * from "./WorkspaceMembershipListResponseOut.js";
169
+ export * from "./WorkspaceMembershipOut.js";
168
170
  export * from "./WorkspaceShareAccess.js";
169
171
  export * from "./WorkspaceToolRegistryResponseOut.js";
170
172
  export * from "./WorkspaceToolRegistryToolOut.js";
173
+ export * from "./WorkspaceUsageComputerOut.js";
174
+ export * from "./WorkspaceUsageDayOut.js";
175
+ export * from "./WorkspaceUsageResponseOut.js";
176
+ export * from "./WorkspaceUsageSessionRowOut.js";
177
+ export * from "./WorkspaceUsageSessionsResponseOut.js";
178
+ export * from "./WorkspaceUsageTokensOut.js";
179
+ export * from "./WorkspaceUsageUserOut.js";
180
+ export * from "./WorkspaceUsageWindowOut.js";
171
181
  export * from "./WrapStrategy.js";
@@ -181,7 +181,17 @@ __exportStar(require("./WorkspaceDisclaimerOut.js"), exports);
181
181
  __exportStar(require("./WorkspaceInfoOut.js"), exports);
182
182
  __exportStar(require("./WorkspaceMemberOut.js"), exports);
183
183
  __exportStar(require("./WorkspaceMemberSearchResponseOut.js"), exports);
184
+ __exportStar(require("./WorkspaceMembershipListResponseOut.js"), exports);
185
+ __exportStar(require("./WorkspaceMembershipOut.js"), exports);
184
186
  __exportStar(require("./WorkspaceShareAccess.js"), exports);
185
187
  __exportStar(require("./WorkspaceToolRegistryResponseOut.js"), exports);
186
188
  __exportStar(require("./WorkspaceToolRegistryToolOut.js"), exports);
189
+ __exportStar(require("./WorkspaceUsageComputerOut.js"), exports);
190
+ __exportStar(require("./WorkspaceUsageDayOut.js"), exports);
191
+ __exportStar(require("./WorkspaceUsageResponseOut.js"), exports);
192
+ __exportStar(require("./WorkspaceUsageSessionRowOut.js"), exports);
193
+ __exportStar(require("./WorkspaceUsageSessionsResponseOut.js"), exports);
194
+ __exportStar(require("./WorkspaceUsageTokensOut.js"), exports);
195
+ __exportStar(require("./WorkspaceUsageUserOut.js"), exports);
196
+ __exportStar(require("./WorkspaceUsageWindowOut.js"), exports);
187
197
  __exportStar(require("./WrapStrategy.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "4.3.2250";
1
+ export declare const SDK_VERSION = "4.3.2252";
@@ -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.2250";
4
+ exports.SDK_VERSION = "4.3.2252";
@@ -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.2250",
10
- "User-Agent": "@athenaintel/sdk/4.3.2250",
9
+ "X-Fern-SDK-Version": "4.3.2252",
10
+ "User-Agent": "@athenaintel/sdk/4.3.2252",
11
11
  "X-Fern-Runtime": core.RUNTIME.type,
12
12
  "X-Fern-Runtime-Version": core.RUNTIME.version,
13
13
  "X-Athena-Session-Credential": options === null || options === void 0 ? void 0 : options.sessionCredential,
@@ -65,6 +65,25 @@ export declare class WorkspacesClient {
65
65
  */
66
66
  searchMembers(request: AthenaIntelligence.SearchMembersWorkspacesRequest, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceMemberSearchResponseOut>;
67
67
  private __searchMembers;
68
+ /**
69
+ * The full membership roster of one workspace with each member's user id, name, email, role and join date — built for usage reporting and licence reconciliation, unlike the share-picker search at `GET /workspaces/{workspace_id}/members`. Removed members are left out unless `include_archived=true`. Pages are ordered by user id; `next_cursor` is returned while more remain. Requires workspace owner or manager (or Athena admin) permissions.
70
+ *
71
+ * @param {AthenaIntelligence.ListMembershipsWorkspacesRequest} request
72
+ * @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
73
+ *
74
+ * @throws {@link AthenaIntelligence.ForbiddenError}
75
+ * @throws {@link AthenaIntelligence.NotFoundError}
76
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
77
+ *
78
+ * @example
79
+ * await client.workspaces.listMemberships({
80
+ * workspace_id: "workspace_eb171baf",
81
+ * include_archived: false,
82
+ * limit: 200
83
+ * })
84
+ */
85
+ listMemberships(request: AthenaIntelligence.ListMembershipsWorkspacesRequest, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceMembershipListResponseOut>;
86
+ private __listMemberships;
68
87
  /**
69
88
  * Admin only. Mint a short-lived, read-only Keryx token for a workspace's live presence feed (the awareness room the People page renders). The token is bound to the calling user, so Keryx narrows every frame to the documents that user may open; it can never publish presence or write document content. Requires the presence roster to be enabled for the deployment and opted in for the workspace. Computer-asset sandbox credentials are refused: call with the viewing user's own token.
70
89
  *
@@ -140,4 +159,42 @@ export declare class WorkspacesClient {
140
159
  */
141
160
  updateToolRegistry(request: AthenaIntelligence.UpdateWorkspaceToolRegistryRequestIn, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceToolRegistryResponseOut>;
142
161
  private __updateToolRegistry;
162
+ /**
163
+ * Aggregate LLM token usage (and cost) for one workspace over the last `days` days: workspace totals plus per-member, per-day and per-Computer breakdowns. Token counters are summed from each session's usage ledger; dry-run (test) sessions are reported separately and excluded from the totals. Requires workspace owner or manager (or Athena admin) permissions — the same gate as the in-app Usage page.
164
+ *
165
+ * @param {AthenaIntelligence.GetUsageWorkspacesRequest} request
166
+ * @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
167
+ *
168
+ * @throws {@link AthenaIntelligence.ForbiddenError}
169
+ * @throws {@link AthenaIntelligence.NotFoundError}
170
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
171
+ *
172
+ * @example
173
+ * await client.workspaces.getUsage({
174
+ * workspace_id: "workspace_id",
175
+ * days: 30
176
+ * })
177
+ */
178
+ getUsage(request: AthenaIntelligence.GetUsageWorkspacesRequest, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceUsageResponseOut>;
179
+ private __getUsage;
180
+ /**
181
+ * Per-session LLM token usage for one workspace — the same rows as the workspace usage CSV export, as JSON. Each session yields one row per provider/model/status combination with its token breakdown and billed cost; dry-run (test) sessions are excluded. Pick the window with `from`/`to` (UTC dates, inclusive, at most 365 days) or a rolling `days`. Pages are keyset-paginated newest first: `limit` counts sessions, and `next_cursor` is returned while more sessions remain. Requires workspace owner or manager (or Athena admin) permissions.
182
+ *
183
+ * @param {AthenaIntelligence.ListUsageSessionsWorkspacesRequest} request
184
+ * @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
185
+ *
186
+ * @throws {@link AthenaIntelligence.BadRequestError}
187
+ * @throws {@link AthenaIntelligence.ForbiddenError}
188
+ * @throws {@link AthenaIntelligence.NotFoundError}
189
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
190
+ *
191
+ * @example
192
+ * await client.workspaces.listUsageSessions({
193
+ * workspace_id: "workspace_eb171baf",
194
+ * days: 30,
195
+ * limit: 100
196
+ * })
197
+ */
198
+ listUsageSessions(request: AthenaIntelligence.ListUsageSessionsWorkspacesRequest, requestOptions?: WorkspacesClient.RequestOptions): core.HttpResponsePromise<AthenaIntelligence.WorkspaceUsageSessionsResponseOut>;
199
+ private __listUsageSessions;
143
200
  }
@@ -285,6 +285,99 @@ export class WorkspacesClient {
285
285
  }
286
286
  });
287
287
  }
288
+ /**
289
+ * The full membership roster of one workspace with each member's user id, name, email, role and join date — built for usage reporting and licence reconciliation, unlike the share-picker search at `GET /workspaces/{workspace_id}/members`. Removed members are left out unless `include_archived=true`. Pages are ordered by user id; `next_cursor` is returned while more remain. Requires workspace owner or manager (or Athena admin) permissions.
290
+ *
291
+ * @param {AthenaIntelligence.ListMembershipsWorkspacesRequest} request
292
+ * @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
293
+ *
294
+ * @throws {@link AthenaIntelligence.ForbiddenError}
295
+ * @throws {@link AthenaIntelligence.NotFoundError}
296
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
297
+ *
298
+ * @example
299
+ * await client.workspaces.listMemberships({
300
+ * workspace_id: "workspace_eb171baf",
301
+ * include_archived: false,
302
+ * limit: 200
303
+ * })
304
+ */
305
+ listMemberships(request, requestOptions) {
306
+ return core.HttpResponsePromise.fromPromise(this.__listMemberships(request, requestOptions));
307
+ }
308
+ __listMemberships(request, requestOptions) {
309
+ return __awaiter(this, void 0, void 0, function* () {
310
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
311
+ const { workspace_id: workspaceId, include_archived: includeArchived, cursor, limit } = request;
312
+ const _queryParams = {};
313
+ if (includeArchived != null) {
314
+ _queryParams.include_archived = includeArchived.toString();
315
+ }
316
+ if (cursor !== undefined) {
317
+ _queryParams.cursor = cursor;
318
+ }
319
+ if (limit != null) {
320
+ _queryParams.limit = limit.toString();
321
+ }
322
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
323
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
324
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
325
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
326
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
327
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/workspaces/${core.url.encodePathParam(workspaceId)}/memberships`),
328
+ method: "GET",
329
+ headers: _headers,
330
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
331
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
332
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
333
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
334
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
335
+ logging: this._options.logging,
336
+ });
337
+ if (_response.ok) {
338
+ return {
339
+ data: _response.body,
340
+ rawResponse: _response.rawResponse,
341
+ };
342
+ }
343
+ if (_response.error.reason === "status-code") {
344
+ switch (_response.error.statusCode) {
345
+ case 403:
346
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
347
+ case 404:
348
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
349
+ case 422:
350
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
351
+ default:
352
+ throw new errors.AthenaIntelligenceError({
353
+ statusCode: _response.error.statusCode,
354
+ body: _response.error.body,
355
+ rawResponse: _response.rawResponse,
356
+ });
357
+ }
358
+ }
359
+ switch (_response.error.reason) {
360
+ case "non-json":
361
+ throw new errors.AthenaIntelligenceError({
362
+ statusCode: _response.error.statusCode,
363
+ body: _response.error.rawBody,
364
+ rawResponse: _response.rawResponse,
365
+ });
366
+ case "body-is-null":
367
+ throw new errors.AthenaIntelligenceError({
368
+ statusCode: _response.error.statusCode,
369
+ rawResponse: _response.rawResponse,
370
+ });
371
+ case "timeout":
372
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/memberships.");
373
+ case "unknown":
374
+ throw new errors.AthenaIntelligenceError({
375
+ message: _response.error.errorMessage,
376
+ rawResponse: _response.rawResponse,
377
+ });
378
+ }
379
+ });
380
+ }
288
381
  /**
289
382
  * Admin only. Mint a short-lived, read-only Keryx token for a workspace's live presence feed (the awareness room the People page renders). The token is bound to the calling user, so Keryx narrows every frame to the documents that user may open; it can never publish presence or write document content. Requires the presence roster to be enabled for the deployment and opted in for the workspace. Computer-asset sandbox credentials are refused: call with the viewing user's own token.
290
383
  *
@@ -618,4 +711,192 @@ export class WorkspacesClient {
618
711
  }
619
712
  });
620
713
  }
714
+ /**
715
+ * Aggregate LLM token usage (and cost) for one workspace over the last `days` days: workspace totals plus per-member, per-day and per-Computer breakdowns. Token counters are summed from each session's usage ledger; dry-run (test) sessions are reported separately and excluded from the totals. Requires workspace owner or manager (or Athena admin) permissions — the same gate as the in-app Usage page.
716
+ *
717
+ * @param {AthenaIntelligence.GetUsageWorkspacesRequest} request
718
+ * @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
719
+ *
720
+ * @throws {@link AthenaIntelligence.ForbiddenError}
721
+ * @throws {@link AthenaIntelligence.NotFoundError}
722
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
723
+ *
724
+ * @example
725
+ * await client.workspaces.getUsage({
726
+ * workspace_id: "workspace_id",
727
+ * days: 30
728
+ * })
729
+ */
730
+ getUsage(request, requestOptions) {
731
+ return core.HttpResponsePromise.fromPromise(this.__getUsage(request, requestOptions));
732
+ }
733
+ __getUsage(request, requestOptions) {
734
+ return __awaiter(this, void 0, void 0, function* () {
735
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
736
+ const { workspace_id: workspaceId, days } = request;
737
+ const _queryParams = {};
738
+ if (days != null) {
739
+ _queryParams.days = days.toString();
740
+ }
741
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
742
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
743
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
744
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
745
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
746
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/workspaces/${core.url.encodePathParam(workspaceId)}/usage`),
747
+ method: "GET",
748
+ headers: _headers,
749
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
750
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
751
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
752
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
753
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
754
+ logging: this._options.logging,
755
+ });
756
+ if (_response.ok) {
757
+ return {
758
+ data: _response.body,
759
+ rawResponse: _response.rawResponse,
760
+ };
761
+ }
762
+ if (_response.error.reason === "status-code") {
763
+ switch (_response.error.statusCode) {
764
+ case 403:
765
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
766
+ case 404:
767
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
768
+ case 422:
769
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
770
+ default:
771
+ throw new errors.AthenaIntelligenceError({
772
+ statusCode: _response.error.statusCode,
773
+ body: _response.error.body,
774
+ rawResponse: _response.rawResponse,
775
+ });
776
+ }
777
+ }
778
+ switch (_response.error.reason) {
779
+ case "non-json":
780
+ throw new errors.AthenaIntelligenceError({
781
+ statusCode: _response.error.statusCode,
782
+ body: _response.error.rawBody,
783
+ rawResponse: _response.rawResponse,
784
+ });
785
+ case "body-is-null":
786
+ throw new errors.AthenaIntelligenceError({
787
+ statusCode: _response.error.statusCode,
788
+ rawResponse: _response.rawResponse,
789
+ });
790
+ case "timeout":
791
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/usage.");
792
+ case "unknown":
793
+ throw new errors.AthenaIntelligenceError({
794
+ message: _response.error.errorMessage,
795
+ rawResponse: _response.rawResponse,
796
+ });
797
+ }
798
+ });
799
+ }
800
+ /**
801
+ * Per-session LLM token usage for one workspace — the same rows as the workspace usage CSV export, as JSON. Each session yields one row per provider/model/status combination with its token breakdown and billed cost; dry-run (test) sessions are excluded. Pick the window with `from`/`to` (UTC dates, inclusive, at most 365 days) or a rolling `days`. Pages are keyset-paginated newest first: `limit` counts sessions, and `next_cursor` is returned while more sessions remain. Requires workspace owner or manager (or Athena admin) permissions.
802
+ *
803
+ * @param {AthenaIntelligence.ListUsageSessionsWorkspacesRequest} request
804
+ * @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
805
+ *
806
+ * @throws {@link AthenaIntelligence.BadRequestError}
807
+ * @throws {@link AthenaIntelligence.ForbiddenError}
808
+ * @throws {@link AthenaIntelligence.NotFoundError}
809
+ * @throws {@link AthenaIntelligence.UnprocessableEntityError}
810
+ *
811
+ * @example
812
+ * await client.workspaces.listUsageSessions({
813
+ * workspace_id: "workspace_eb171baf",
814
+ * days: 30,
815
+ * limit: 100
816
+ * })
817
+ */
818
+ listUsageSessions(request, requestOptions) {
819
+ return core.HttpResponsePromise.fromPromise(this.__listUsageSessions(request, requestOptions));
820
+ }
821
+ __listUsageSessions(request, requestOptions) {
822
+ return __awaiter(this, void 0, void 0, function* () {
823
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
824
+ const { workspace_id: workspaceId, from: from_, to, days, cursor, limit } = request;
825
+ const _queryParams = {};
826
+ if (from_ !== undefined) {
827
+ _queryParams.from = from_;
828
+ }
829
+ if (to !== undefined) {
830
+ _queryParams.to = to;
831
+ }
832
+ if (days != null) {
833
+ _queryParams.days = days.toString();
834
+ }
835
+ if (cursor !== undefined) {
836
+ _queryParams.cursor = cursor;
837
+ }
838
+ if (limit != null) {
839
+ _queryParams.limit = limit.toString();
840
+ }
841
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
842
+ const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, mergeOnlyDefinedHeaders({
843
+ "X-Athena-Session-Credential": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.sessionCredential) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.sessionCredential,
844
+ }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
845
+ const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
846
+ url: core.url.join((_f = (_e = (yield core.Supplier.get(this._options.baseUrl))) !== null && _e !== void 0 ? _e : (yield core.Supplier.get(this._options.environment))) !== null && _f !== void 0 ? _f : environments.AthenaIntelligenceEnvironment.Production, `api/v0/workspaces/${core.url.encodePathParam(workspaceId)}/usage/sessions`),
847
+ method: "GET",
848
+ headers: _headers,
849
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
850
+ timeoutMs: ((_j = (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.timeoutInSeconds) !== null && _j !== void 0 ? _j : 60) * 1000,
851
+ maxRetries: (_k = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _k !== void 0 ? _k : (_l = this._options) === null || _l === void 0 ? void 0 : _l.maxRetries,
852
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
853
+ fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
854
+ logging: this._options.logging,
855
+ });
856
+ if (_response.ok) {
857
+ return {
858
+ data: _response.body,
859
+ rawResponse: _response.rawResponse,
860
+ };
861
+ }
862
+ if (_response.error.reason === "status-code") {
863
+ switch (_response.error.statusCode) {
864
+ case 400:
865
+ throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
866
+ case 403:
867
+ throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
868
+ case 404:
869
+ throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
870
+ case 422:
871
+ throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
872
+ default:
873
+ throw new errors.AthenaIntelligenceError({
874
+ statusCode: _response.error.statusCode,
875
+ body: _response.error.body,
876
+ rawResponse: _response.rawResponse,
877
+ });
878
+ }
879
+ }
880
+ switch (_response.error.reason) {
881
+ case "non-json":
882
+ throw new errors.AthenaIntelligenceError({
883
+ statusCode: _response.error.statusCode,
884
+ body: _response.error.rawBody,
885
+ rawResponse: _response.rawResponse,
886
+ });
887
+ case "body-is-null":
888
+ throw new errors.AthenaIntelligenceError({
889
+ statusCode: _response.error.statusCode,
890
+ rawResponse: _response.rawResponse,
891
+ });
892
+ case "timeout":
893
+ throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/usage/sessions.");
894
+ case "unknown":
895
+ throw new errors.AthenaIntelligenceError({
896
+ message: _response.error.errorMessage,
897
+ rawResponse: _response.rawResponse,
898
+ });
899
+ }
900
+ });
901
+ }
621
902
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * workspace_id: "workspace_id",
5
+ * days: 30
6
+ * }
7
+ */
8
+ export interface GetUsageWorkspacesRequest {
9
+ workspace_id: string;
10
+ /** Reporting window in days, ending now (1-365) */
11
+ days?: number;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,18 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * workspace_id: "workspace_eb171baf",
5
+ * include_archived: false,
6
+ * limit: 200
7
+ * }
8
+ */
9
+ export interface ListMembershipsWorkspacesRequest {
10
+ /** Unique identifier of the workspace */
11
+ workspace_id: string;
12
+ /** Also return memberships that were removed from the workspace */
13
+ include_archived?: boolean;
14
+ /** `next_cursor` from the previous page */
15
+ cursor?: string | null;
16
+ /** Maximum memberships per page */
17
+ limit?: number;
18
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};