@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.
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/workspaces/client/Client.d.ts +57 -0
- package/dist/cjs/api/resources/workspaces/client/Client.js +281 -0
- package/dist/cjs/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.d.ts +12 -0
- package/dist/cjs/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.js +3 -0
- package/dist/cjs/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.d.ts +18 -0
- package/dist/cjs/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.js +3 -0
- package/dist/cjs/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.d.ts +22 -0
- package/dist/cjs/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.js +3 -0
- package/dist/cjs/api/resources/workspaces/client/requests/index.d.ts +3 -0
- package/dist/cjs/api/types/WorkspaceMembershipListResponseOut.d.ts +12 -0
- package/dist/cjs/api/types/WorkspaceMembershipListResponseOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceMembershipOut.d.ts +18 -0
- package/dist/cjs/api/types/WorkspaceMembershipOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageComputerOut.d.ts +22 -0
- package/dist/cjs/api/types/WorkspaceUsageComputerOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageDayOut.d.ts +14 -0
- package/dist/cjs/api/types/WorkspaceUsageDayOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageResponseOut.d.ts +36 -0
- package/dist/cjs/api/types/WorkspaceUsageResponseOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageSessionRowOut.d.ts +65 -0
- package/dist/cjs/api/types/WorkspaceUsageSessionRowOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageSessionsResponseOut.d.ts +13 -0
- package/dist/cjs/api/types/WorkspaceUsageSessionsResponseOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageTokensOut.d.ts +17 -0
- package/dist/cjs/api/types/WorkspaceUsageTokensOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageUserOut.d.ts +22 -0
- package/dist/cjs/api/types/WorkspaceUsageUserOut.js +3 -0
- package/dist/cjs/api/types/WorkspaceUsageWindowOut.d.ts +15 -0
- package/dist/cjs/api/types/WorkspaceUsageWindowOut.js +3 -0
- package/dist/cjs/api/types/index.d.ts +10 -0
- package/dist/cjs/api/types/index.js +10 -0
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/workspaces/client/Client.d.mts +57 -0
- package/dist/esm/api/resources/workspaces/client/Client.mjs +281 -0
- package/dist/esm/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.d.mts +12 -0
- package/dist/esm/api/resources/workspaces/client/requests/GetUsageWorkspacesRequest.mjs +2 -0
- package/dist/esm/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.d.mts +18 -0
- package/dist/esm/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.mjs +2 -0
- package/dist/esm/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.d.mts +22 -0
- package/dist/esm/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.mjs +2 -0
- package/dist/esm/api/resources/workspaces/client/requests/index.d.mts +3 -0
- package/dist/esm/api/types/WorkspaceMembershipListResponseOut.d.mts +12 -0
- package/dist/esm/api/types/WorkspaceMembershipListResponseOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceMembershipOut.d.mts +18 -0
- package/dist/esm/api/types/WorkspaceMembershipOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageComputerOut.d.mts +22 -0
- package/dist/esm/api/types/WorkspaceUsageComputerOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageDayOut.d.mts +14 -0
- package/dist/esm/api/types/WorkspaceUsageDayOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageResponseOut.d.mts +36 -0
- package/dist/esm/api/types/WorkspaceUsageResponseOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageSessionRowOut.d.mts +65 -0
- package/dist/esm/api/types/WorkspaceUsageSessionRowOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageSessionsResponseOut.d.mts +13 -0
- package/dist/esm/api/types/WorkspaceUsageSessionsResponseOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageTokensOut.d.mts +17 -0
- package/dist/esm/api/types/WorkspaceUsageTokensOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageUserOut.d.mts +22 -0
- package/dist/esm/api/types/WorkspaceUsageUserOut.mjs +2 -0
- package/dist/esm/api/types/WorkspaceUsageWindowOut.d.mts +15 -0
- package/dist/esm/api/types/WorkspaceUsageWindowOut.mjs +2 -0
- package/dist/esm/api/types/index.d.mts +10 -0
- package/dist/esm/api/types/index.mjs +10 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +200 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -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.
|
|
47
|
-
"User-Agent": "@athenaintel/sdk/4.3.
|
|
46
|
+
"X-Fern-SDK-Version": "4.3.2252",
|
|
47
|
+
"User-Agent": "@athenaintel/sdk/4.3.2252",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
"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
|
}
|
|
@@ -321,6 +321,99 @@ class WorkspacesClient {
|
|
|
321
321
|
}
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
|
+
/**
|
|
325
|
+
* 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.
|
|
326
|
+
*
|
|
327
|
+
* @param {AthenaIntelligence.ListMembershipsWorkspacesRequest} request
|
|
328
|
+
* @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
329
|
+
*
|
|
330
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
331
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
332
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
333
|
+
*
|
|
334
|
+
* @example
|
|
335
|
+
* await client.workspaces.listMemberships({
|
|
336
|
+
* workspace_id: "workspace_eb171baf",
|
|
337
|
+
* include_archived: false,
|
|
338
|
+
* limit: 200
|
|
339
|
+
* })
|
|
340
|
+
*/
|
|
341
|
+
listMemberships(request, requestOptions) {
|
|
342
|
+
return core.HttpResponsePromise.fromPromise(this.__listMemberships(request, requestOptions));
|
|
343
|
+
}
|
|
344
|
+
__listMemberships(request, requestOptions) {
|
|
345
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
346
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
347
|
+
const { workspace_id: workspaceId, include_archived: includeArchived, cursor, limit } = request;
|
|
348
|
+
const _queryParams = {};
|
|
349
|
+
if (includeArchived != null) {
|
|
350
|
+
_queryParams.include_archived = includeArchived.toString();
|
|
351
|
+
}
|
|
352
|
+
if (cursor !== undefined) {
|
|
353
|
+
_queryParams.cursor = cursor;
|
|
354
|
+
}
|
|
355
|
+
if (limit != null) {
|
|
356
|
+
_queryParams.limit = limit.toString();
|
|
357
|
+
}
|
|
358
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
359
|
+
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)({
|
|
360
|
+
"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,
|
|
361
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
362
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
363
|
+
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`),
|
|
364
|
+
method: "GET",
|
|
365
|
+
headers: _headers,
|
|
366
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
367
|
+
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,
|
|
368
|
+
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,
|
|
369
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
370
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
371
|
+
logging: this._options.logging,
|
|
372
|
+
});
|
|
373
|
+
if (_response.ok) {
|
|
374
|
+
return {
|
|
375
|
+
data: _response.body,
|
|
376
|
+
rawResponse: _response.rawResponse,
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
if (_response.error.reason === "status-code") {
|
|
380
|
+
switch (_response.error.statusCode) {
|
|
381
|
+
case 403:
|
|
382
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
383
|
+
case 404:
|
|
384
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
385
|
+
case 422:
|
|
386
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
387
|
+
default:
|
|
388
|
+
throw new errors.AthenaIntelligenceError({
|
|
389
|
+
statusCode: _response.error.statusCode,
|
|
390
|
+
body: _response.error.body,
|
|
391
|
+
rawResponse: _response.rawResponse,
|
|
392
|
+
});
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
switch (_response.error.reason) {
|
|
396
|
+
case "non-json":
|
|
397
|
+
throw new errors.AthenaIntelligenceError({
|
|
398
|
+
statusCode: _response.error.statusCode,
|
|
399
|
+
body: _response.error.rawBody,
|
|
400
|
+
rawResponse: _response.rawResponse,
|
|
401
|
+
});
|
|
402
|
+
case "body-is-null":
|
|
403
|
+
throw new errors.AthenaIntelligenceError({
|
|
404
|
+
statusCode: _response.error.statusCode,
|
|
405
|
+
rawResponse: _response.rawResponse,
|
|
406
|
+
});
|
|
407
|
+
case "timeout":
|
|
408
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/memberships.");
|
|
409
|
+
case "unknown":
|
|
410
|
+
throw new errors.AthenaIntelligenceError({
|
|
411
|
+
message: _response.error.errorMessage,
|
|
412
|
+
rawResponse: _response.rawResponse,
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
});
|
|
416
|
+
}
|
|
324
417
|
/**
|
|
325
418
|
* 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.
|
|
326
419
|
*
|
|
@@ -654,5 +747,193 @@ class WorkspacesClient {
|
|
|
654
747
|
}
|
|
655
748
|
});
|
|
656
749
|
}
|
|
750
|
+
/**
|
|
751
|
+
* 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.
|
|
752
|
+
*
|
|
753
|
+
* @param {AthenaIntelligence.GetUsageWorkspacesRequest} request
|
|
754
|
+
* @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
755
|
+
*
|
|
756
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
757
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
758
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
759
|
+
*
|
|
760
|
+
* @example
|
|
761
|
+
* await client.workspaces.getUsage({
|
|
762
|
+
* workspace_id: "workspace_id",
|
|
763
|
+
* days: 30
|
|
764
|
+
* })
|
|
765
|
+
*/
|
|
766
|
+
getUsage(request, requestOptions) {
|
|
767
|
+
return core.HttpResponsePromise.fromPromise(this.__getUsage(request, requestOptions));
|
|
768
|
+
}
|
|
769
|
+
__getUsage(request, requestOptions) {
|
|
770
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
771
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
772
|
+
const { workspace_id: workspaceId, days } = request;
|
|
773
|
+
const _queryParams = {};
|
|
774
|
+
if (days != null) {
|
|
775
|
+
_queryParams.days = days.toString();
|
|
776
|
+
}
|
|
777
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
778
|
+
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)({
|
|
779
|
+
"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,
|
|
780
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
781
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
782
|
+
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`),
|
|
783
|
+
method: "GET",
|
|
784
|
+
headers: _headers,
|
|
785
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
786
|
+
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,
|
|
787
|
+
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,
|
|
788
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
789
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
790
|
+
logging: this._options.logging,
|
|
791
|
+
});
|
|
792
|
+
if (_response.ok) {
|
|
793
|
+
return {
|
|
794
|
+
data: _response.body,
|
|
795
|
+
rawResponse: _response.rawResponse,
|
|
796
|
+
};
|
|
797
|
+
}
|
|
798
|
+
if (_response.error.reason === "status-code") {
|
|
799
|
+
switch (_response.error.statusCode) {
|
|
800
|
+
case 403:
|
|
801
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
802
|
+
case 404:
|
|
803
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
804
|
+
case 422:
|
|
805
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
806
|
+
default:
|
|
807
|
+
throw new errors.AthenaIntelligenceError({
|
|
808
|
+
statusCode: _response.error.statusCode,
|
|
809
|
+
body: _response.error.body,
|
|
810
|
+
rawResponse: _response.rawResponse,
|
|
811
|
+
});
|
|
812
|
+
}
|
|
813
|
+
}
|
|
814
|
+
switch (_response.error.reason) {
|
|
815
|
+
case "non-json":
|
|
816
|
+
throw new errors.AthenaIntelligenceError({
|
|
817
|
+
statusCode: _response.error.statusCode,
|
|
818
|
+
body: _response.error.rawBody,
|
|
819
|
+
rawResponse: _response.rawResponse,
|
|
820
|
+
});
|
|
821
|
+
case "body-is-null":
|
|
822
|
+
throw new errors.AthenaIntelligenceError({
|
|
823
|
+
statusCode: _response.error.statusCode,
|
|
824
|
+
rawResponse: _response.rawResponse,
|
|
825
|
+
});
|
|
826
|
+
case "timeout":
|
|
827
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/usage.");
|
|
828
|
+
case "unknown":
|
|
829
|
+
throw new errors.AthenaIntelligenceError({
|
|
830
|
+
message: _response.error.errorMessage,
|
|
831
|
+
rawResponse: _response.rawResponse,
|
|
832
|
+
});
|
|
833
|
+
}
|
|
834
|
+
});
|
|
835
|
+
}
|
|
836
|
+
/**
|
|
837
|
+
* 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.
|
|
838
|
+
*
|
|
839
|
+
* @param {AthenaIntelligence.ListUsageSessionsWorkspacesRequest} request
|
|
840
|
+
* @param {WorkspacesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
841
|
+
*
|
|
842
|
+
* @throws {@link AthenaIntelligence.BadRequestError}
|
|
843
|
+
* @throws {@link AthenaIntelligence.ForbiddenError}
|
|
844
|
+
* @throws {@link AthenaIntelligence.NotFoundError}
|
|
845
|
+
* @throws {@link AthenaIntelligence.UnprocessableEntityError}
|
|
846
|
+
*
|
|
847
|
+
* @example
|
|
848
|
+
* await client.workspaces.listUsageSessions({
|
|
849
|
+
* workspace_id: "workspace_eb171baf",
|
|
850
|
+
* days: 30,
|
|
851
|
+
* limit: 100
|
|
852
|
+
* })
|
|
853
|
+
*/
|
|
854
|
+
listUsageSessions(request, requestOptions) {
|
|
855
|
+
return core.HttpResponsePromise.fromPromise(this.__listUsageSessions(request, requestOptions));
|
|
856
|
+
}
|
|
857
|
+
__listUsageSessions(request, requestOptions) {
|
|
858
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
859
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
860
|
+
const { workspace_id: workspaceId, from: from_, to, days, cursor, limit } = request;
|
|
861
|
+
const _queryParams = {};
|
|
862
|
+
if (from_ !== undefined) {
|
|
863
|
+
_queryParams.from = from_;
|
|
864
|
+
}
|
|
865
|
+
if (to !== undefined) {
|
|
866
|
+
_queryParams.to = to;
|
|
867
|
+
}
|
|
868
|
+
if (days != null) {
|
|
869
|
+
_queryParams.days = days.toString();
|
|
870
|
+
}
|
|
871
|
+
if (cursor !== undefined) {
|
|
872
|
+
_queryParams.cursor = cursor;
|
|
873
|
+
}
|
|
874
|
+
if (limit != null) {
|
|
875
|
+
_queryParams.limit = limit.toString();
|
|
876
|
+
}
|
|
877
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
878
|
+
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)({
|
|
879
|
+
"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,
|
|
880
|
+
}), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
881
|
+
const _response = yield ((_d = this._options.fetcher) !== null && _d !== void 0 ? _d : core.fetcher)({
|
|
882
|
+
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`),
|
|
883
|
+
method: "GET",
|
|
884
|
+
headers: _headers,
|
|
885
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
886
|
+
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,
|
|
887
|
+
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,
|
|
888
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
889
|
+
fetchFn: (_m = this._options) === null || _m === void 0 ? void 0 : _m.fetch,
|
|
890
|
+
logging: this._options.logging,
|
|
891
|
+
});
|
|
892
|
+
if (_response.ok) {
|
|
893
|
+
return {
|
|
894
|
+
data: _response.body,
|
|
895
|
+
rawResponse: _response.rawResponse,
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
if (_response.error.reason === "status-code") {
|
|
899
|
+
switch (_response.error.statusCode) {
|
|
900
|
+
case 400:
|
|
901
|
+
throw new AthenaIntelligence.BadRequestError(_response.error.body, _response.rawResponse);
|
|
902
|
+
case 403:
|
|
903
|
+
throw new AthenaIntelligence.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
904
|
+
case 404:
|
|
905
|
+
throw new AthenaIntelligence.NotFoundError(_response.error.body, _response.rawResponse);
|
|
906
|
+
case 422:
|
|
907
|
+
throw new AthenaIntelligence.UnprocessableEntityError(_response.error.body, _response.rawResponse);
|
|
908
|
+
default:
|
|
909
|
+
throw new errors.AthenaIntelligenceError({
|
|
910
|
+
statusCode: _response.error.statusCode,
|
|
911
|
+
body: _response.error.body,
|
|
912
|
+
rawResponse: _response.rawResponse,
|
|
913
|
+
});
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
switch (_response.error.reason) {
|
|
917
|
+
case "non-json":
|
|
918
|
+
throw new errors.AthenaIntelligenceError({
|
|
919
|
+
statusCode: _response.error.statusCode,
|
|
920
|
+
body: _response.error.rawBody,
|
|
921
|
+
rawResponse: _response.rawResponse,
|
|
922
|
+
});
|
|
923
|
+
case "body-is-null":
|
|
924
|
+
throw new errors.AthenaIntelligenceError({
|
|
925
|
+
statusCode: _response.error.statusCode,
|
|
926
|
+
rawResponse: _response.rawResponse,
|
|
927
|
+
});
|
|
928
|
+
case "timeout":
|
|
929
|
+
throw new errors.AthenaIntelligenceTimeoutError("Timeout exceeded when calling GET /api/v0/workspaces/{workspace_id}/usage/sessions.");
|
|
930
|
+
case "unknown":
|
|
931
|
+
throw new errors.AthenaIntelligenceError({
|
|
932
|
+
message: _response.error.errorMessage,
|
|
933
|
+
rawResponse: _response.rawResponse,
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
});
|
|
937
|
+
}
|
|
657
938
|
}
|
|
658
939
|
exports.WorkspacesClient = WorkspacesClient;
|
package/dist/cjs/api/resources/workspaces/client/requests/ListMembershipsWorkspacesRequest.d.ts
ADDED
|
@@ -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
|
+
}
|
package/dist/cjs/api/resources/workspaces/client/requests/ListUsageSessionsWorkspacesRequest.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @example
|
|
3
|
+
* {
|
|
4
|
+
* workspace_id: "workspace_eb171baf",
|
|
5
|
+
* days: 30,
|
|
6
|
+
* limit: 100
|
|
7
|
+
* }
|
|
8
|
+
*/
|
|
9
|
+
export interface ListUsageSessionsWorkspacesRequest {
|
|
10
|
+
/** Unique identifier of the workspace */
|
|
11
|
+
workspace_id: string;
|
|
12
|
+
/** First UTC day of the window (YYYY-MM-DD); requires `to` */
|
|
13
|
+
from?: string | null;
|
|
14
|
+
/** Last UTC day of the window, inclusive (YYYY-MM-DD); requires `from` */
|
|
15
|
+
to?: string | null;
|
|
16
|
+
/** Rolling window in days ending now; ignored when `from`/`to` are given */
|
|
17
|
+
days?: number;
|
|
18
|
+
/** `next_cursor` from the previous page */
|
|
19
|
+
cursor?: string | null;
|
|
20
|
+
/** Maximum sessions per page (each may yield several rows) */
|
|
21
|
+
limit?: number;
|
|
22
|
+
}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export type { CreatePresenceTokenWorkspacesRequest } from "./CreatePresenceTokenWorkspacesRequest.js";
|
|
2
2
|
export type { GetConfigurationWorkspacesRequest } from "./GetConfigurationWorkspacesRequest.js";
|
|
3
3
|
export type { GetToolRegistryWorkspacesRequest } from "./GetToolRegistryWorkspacesRequest.js";
|
|
4
|
+
export type { GetUsageWorkspacesRequest } from "./GetUsageWorkspacesRequest.js";
|
|
5
|
+
export type { ListMembershipsWorkspacesRequest } from "./ListMembershipsWorkspacesRequest.js";
|
|
6
|
+
export type { ListUsageSessionsWorkspacesRequest } from "./ListUsageSessionsWorkspacesRequest.js";
|
|
4
7
|
export type { PresenceResolveRequestIn } from "./PresenceResolveRequestIn.js";
|
|
5
8
|
export type { SearchMembersWorkspacesRequest } from "./SearchMembersWorkspacesRequest.js";
|
|
6
9
|
export type { UpdateWorkspaceConfigurationRequestIn } from "./UpdateWorkspaceConfigurationRequestIn.js";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* One page of a workspace's membership roster.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceMembershipListResponseOut {
|
|
6
|
+
/** Memberships for this page, ordered by user id */
|
|
7
|
+
memberships: AthenaIntelligence.WorkspaceMembershipOut[];
|
|
8
|
+
/** Pass as `cursor` to fetch the next page; null on the last page */
|
|
9
|
+
next_cursor: string | null;
|
|
10
|
+
/** Workspace the roster belongs to */
|
|
11
|
+
workspace_id: string;
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One member of a workspace and their role.
|
|
3
|
+
*/
|
|
4
|
+
export interface WorkspaceMembershipOut {
|
|
5
|
+
email: string;
|
|
6
|
+
first_name: string | null;
|
|
7
|
+
/** Membership has been removed from the workspace */
|
|
8
|
+
is_archived: boolean;
|
|
9
|
+
/** The user account is suspended deployment-wide */
|
|
10
|
+
is_suspended: boolean;
|
|
11
|
+
/** When the membership was created */
|
|
12
|
+
joined_at: string;
|
|
13
|
+
last_name: string | null;
|
|
14
|
+
/** Workspace role: owner, manager or user */
|
|
15
|
+
role: string;
|
|
16
|
+
/** User id, stable across workspaces */
|
|
17
|
+
user_id: string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Usage attributed to one Computer asset over the window.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageComputerOut {
|
|
6
|
+
/** The Computer asset ID */
|
|
7
|
+
computer_asset_id: string;
|
|
8
|
+
/** Whether the Computer is archived */
|
|
9
|
+
is_archived: boolean;
|
|
10
|
+
/** When the most recent usage session was created */
|
|
11
|
+
last_session_at?: string | null;
|
|
12
|
+
/** Number of successful model calls */
|
|
13
|
+
request_count: number;
|
|
14
|
+
/** Number of usage sessions */
|
|
15
|
+
session_count: number;
|
|
16
|
+
/** The Computer's title */
|
|
17
|
+
title?: string | null;
|
|
18
|
+
/** Token counters behind this Computer's usage */
|
|
19
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
20
|
+
/** Total LLM cost in USD */
|
|
21
|
+
total_cost_usd: number;
|
|
22
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Usage of the workspace on one UTC day.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageDayOut {
|
|
6
|
+
/** Date in YYYY-MM-DD format (UTC) */
|
|
7
|
+
date: string;
|
|
8
|
+
/** Number of sessions created on the day */
|
|
9
|
+
session_count: number;
|
|
10
|
+
/** Token counters for the day */
|
|
11
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
12
|
+
/** Total LLM cost in USD for the day */
|
|
13
|
+
total_cost_usd: number;
|
|
14
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type * as AthenaIntelligence from "../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Aggregated LLM token and cost usage for one workspace.
|
|
4
|
+
*/
|
|
5
|
+
export interface WorkspaceUsageResponseOut {
|
|
6
|
+
/** Users with at least one session */
|
|
7
|
+
active_users: number;
|
|
8
|
+
/** Portion of total_cost_usd produced by Computers */
|
|
9
|
+
computer_cost_usd: number;
|
|
10
|
+
/** Number of Computer usage sessions */
|
|
11
|
+
computer_sessions: number;
|
|
12
|
+
/** Portion of tokens produced by Computers' LLM usage (already included in tokens, never additive) */
|
|
13
|
+
computer_tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
14
|
+
/** Per-day breakdown, oldest first */
|
|
15
|
+
daily: AthenaIntelligence.WorkspaceUsageDayOut[];
|
|
16
|
+
/** Length of the reporting window in days */
|
|
17
|
+
days: number;
|
|
18
|
+
/** Cost of dry-run (test) sessions */
|
|
19
|
+
dry_run_cost_usd: number;
|
|
20
|
+
/** Number of dry-run (test) sessions */
|
|
21
|
+
dry_run_sessions: number;
|
|
22
|
+
/** Token counters from dry-run (test) sessions, excluded from tokens */
|
|
23
|
+
dry_run_tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
24
|
+
/** Per-Computer breakdown, highest cost first */
|
|
25
|
+
per_computer: AthenaIntelligence.WorkspaceUsageComputerOut[];
|
|
26
|
+
/** Per-member breakdown, highest cost first */
|
|
27
|
+
per_user: AthenaIntelligence.WorkspaceUsageUserOut[];
|
|
28
|
+
/** Token counters across the workspace's sessions in the window, excluding dry-run (test) sessions */
|
|
29
|
+
tokens: AthenaIntelligence.WorkspaceUsageTokensOut;
|
|
30
|
+
/** Total LLM cost in USD */
|
|
31
|
+
total_cost_usd: number;
|
|
32
|
+
/** Number of sessions in the window */
|
|
33
|
+
total_sessions: number;
|
|
34
|
+
/** The workspace ID */
|
|
35
|
+
workspace_id: string;
|
|
36
|
+
}
|