@vertesia/client 1.6.0-dev.20261022.120426Z → 1.6.0-dev.20261120.123957Z

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 (183) hide show
  1. package/lib/AccountApi.d.ts +2 -0
  2. package/lib/AccountApi.d.ts.map +1 -1
  3. package/lib/AccountApi.js +3 -0
  4. package/lib/AccountApi.js.map +1 -1
  5. package/lib/AccountRolesApi.d.ts +11 -0
  6. package/lib/AccountRolesApi.d.ts.map +1 -0
  7. package/lib/AccountRolesApi.js +22 -0
  8. package/lib/AccountRolesApi.js.map +1 -0
  9. package/lib/AppsApi.d.ts +18 -3
  10. package/lib/AppsApi.d.ts.map +1 -1
  11. package/lib/AppsApi.js +34 -4
  12. package/lib/AppsApi.js.map +1 -1
  13. package/lib/AuditTrailApi.d.ts +6 -1
  14. package/lib/AuditTrailApi.d.ts.map +1 -1
  15. package/lib/AuditTrailApi.js +8 -0
  16. package/lib/AuditTrailApi.js.map +1 -1
  17. package/lib/IamApi.d.ts +1 -1
  18. package/lib/IamApi.js +1 -1
  19. package/lib/InteractionCatalogApi.d.ts +19 -1
  20. package/lib/InteractionCatalogApi.d.ts.map +1 -1
  21. package/lib/InteractionCatalogApi.js +30 -0
  22. package/lib/InteractionCatalogApi.js.map +1 -1
  23. package/lib/InteractionsApi.d.ts +3 -12
  24. package/lib/InteractionsApi.d.ts.map +1 -1
  25. package/lib/InteractionsApi.js +2 -23
  26. package/lib/InteractionsApi.js.map +1 -1
  27. package/lib/OAuthClientsApi.d.ts +3 -1
  28. package/lib/OAuthClientsApi.d.ts.map +1 -1
  29. package/lib/OAuthClientsApi.js +4 -0
  30. package/lib/OAuthClientsApi.js.map +1 -1
  31. package/lib/OAuthProvidersApi.d.ts +6 -2
  32. package/lib/OAuthProvidersApi.d.ts.map +1 -1
  33. package/lib/OAuthProvidersApi.js +6 -2
  34. package/lib/OAuthProvidersApi.js.map +1 -1
  35. package/lib/StreamSource.d.ts +19 -1
  36. package/lib/StreamSource.d.ts.map +1 -1
  37. package/lib/StreamSource.js +31 -1
  38. package/lib/StreamSource.js.map +1 -1
  39. package/lib/UsersApi.d.ts +7 -1
  40. package/lib/UsersApi.d.ts.map +1 -1
  41. package/lib/UsersApi.js +8 -0
  42. package/lib/UsersApi.js.map +1 -1
  43. package/lib/client.d.ts +14 -2
  44. package/lib/client.d.ts.map +1 -1
  45. package/lib/client.js +55 -8
  46. package/lib/client.js.map +1 -1
  47. package/lib/execute.d.ts.map +1 -1
  48. package/lib/execute.js +4 -2
  49. package/lib/execute.js.map +1 -1
  50. package/lib/idempotency-key.d.ts +19 -0
  51. package/lib/idempotency-key.d.ts.map +1 -0
  52. package/lib/idempotency-key.js +34 -0
  53. package/lib/idempotency-key.js.map +1 -0
  54. package/lib/nodejs/NodeStreamSource.d.ts +10 -1
  55. package/lib/nodejs/NodeStreamSource.d.ts.map +1 -1
  56. package/lib/nodejs/NodeStreamSource.js +40 -2
  57. package/lib/nodejs/NodeStreamSource.js.map +1 -1
  58. package/lib/store/AgentsApi.d.ts.map +1 -1
  59. package/lib/store/AgentsApi.js +5 -2
  60. package/lib/store/AgentsApi.js.map +1 -1
  61. package/lib/store/ContentSourcesApi.d.ts +52 -0
  62. package/lib/store/ContentSourcesApi.d.ts.map +1 -0
  63. package/lib/store/ContentSourcesApi.js +85 -0
  64. package/lib/store/ContentSourcesApi.js.map +1 -0
  65. package/lib/store/CostApi.d.ts +6 -1
  66. package/lib/store/CostApi.d.ts.map +1 -1
  67. package/lib/store/CostApi.js +7 -0
  68. package/lib/store/CostApi.js.map +1 -1
  69. package/lib/store/DashboardApi.d.ts +61 -19
  70. package/lib/store/DashboardApi.d.ts.map +1 -1
  71. package/lib/store/DashboardApi.js +75 -19
  72. package/lib/store/DashboardApi.js.map +1 -1
  73. package/lib/store/DataApi.d.ts +9 -9
  74. package/lib/store/DataApi.d.ts.map +1 -1
  75. package/lib/store/DataApi.js +14 -10
  76. package/lib/store/DataApi.js.map +1 -1
  77. package/lib/store/FilesApi.d.ts +15 -1
  78. package/lib/store/FilesApi.d.ts.map +1 -1
  79. package/lib/store/FilesApi.js +54 -75
  80. package/lib/store/FilesApi.js.map +1 -1
  81. package/lib/store/NotificationsApi.d.ts +39 -0
  82. package/lib/store/NotificationsApi.d.ts.map +1 -0
  83. package/lib/store/NotificationsApi.js +68 -0
  84. package/lib/store/NotificationsApi.js.map +1 -0
  85. package/lib/store/ObjectsApi.d.ts +6 -1
  86. package/lib/store/ObjectsApi.d.ts.map +1 -1
  87. package/lib/store/ObjectsApi.js +23 -30
  88. package/lib/store/ObjectsApi.js.map +1 -1
  89. package/lib/store/RenderingApi.d.ts.map +1 -1
  90. package/lib/store/RenderingApi.js +1 -0
  91. package/lib/store/RenderingApi.js.map +1 -1
  92. package/lib/store/WorkflowsApi.d.ts +19 -1
  93. package/lib/store/WorkflowsApi.d.ts.map +1 -1
  94. package/lib/store/WorkflowsApi.js +21 -0
  95. package/lib/store/WorkflowsApi.js.map +1 -1
  96. package/lib/store/chunked-upload.d.ts +71 -0
  97. package/lib/store/chunked-upload.d.ts.map +1 -0
  98. package/lib/store/chunked-upload.js +206 -0
  99. package/lib/store/chunked-upload.js.map +1 -0
  100. package/lib/store/client.d.ts +9 -1
  101. package/lib/store/client.d.ts.map +1 -1
  102. package/lib/store/client.js +15 -1
  103. package/lib/store/client.js.map +1 -1
  104. package/lib/store/index.d.ts +3 -0
  105. package/lib/store/index.d.ts.map +1 -1
  106. package/lib/store/index.js +3 -0
  107. package/lib/store/index.js.map +1 -1
  108. package/lib/store/node-request.browser.d.ts +14 -0
  109. package/lib/store/node-request.browser.d.ts.map +1 -0
  110. package/lib/store/node-request.browser.js +20 -0
  111. package/lib/store/node-request.browser.js.map +1 -0
  112. package/lib/store/node-request.d.ts +20 -0
  113. package/lib/store/node-request.d.ts.map +1 -0
  114. package/lib/store/node-request.js +116 -0
  115. package/lib/store/node-request.js.map +1 -0
  116. package/lib/store/node-sessions.browser.d.ts +3 -0
  117. package/lib/store/node-sessions.browser.d.ts.map +1 -0
  118. package/lib/store/node-sessions.browser.js +15 -0
  119. package/lib/store/node-sessions.browser.js.map +1 -0
  120. package/lib/store/node-sessions.d.ts +14 -0
  121. package/lib/store/node-sessions.d.ts.map +1 -0
  122. package/lib/store/node-sessions.js +88 -0
  123. package/lib/store/node-sessions.js.map +1 -0
  124. package/lib/store/signed-url.d.ts +12 -16
  125. package/lib/store/signed-url.d.ts.map +1 -1
  126. package/lib/store/signed-url.js +111 -71
  127. package/lib/store/signed-url.js.map +1 -1
  128. package/lib/store/stream-bytes.d.ts +16 -0
  129. package/lib/store/stream-bytes.d.ts.map +1 -0
  130. package/lib/store/stream-bytes.js +70 -0
  131. package/lib/store/stream-bytes.js.map +1 -0
  132. package/lib/store/upload-body.d.ts +21 -0
  133. package/lib/store/upload-body.d.ts.map +1 -0
  134. package/lib/store/upload-body.js +32 -0
  135. package/lib/store/upload-body.js.map +1 -0
  136. package/lib/store/upload-content.d.ts +21 -0
  137. package/lib/store/upload-content.d.ts.map +1 -0
  138. package/lib/store/upload-content.js +113 -0
  139. package/lib/store/upload-content.js.map +1 -0
  140. package/lib/store/upload-runtime.d.ts +21 -0
  141. package/lib/store/upload-runtime.d.ts.map +1 -0
  142. package/lib/store/upload-runtime.js +40 -0
  143. package/lib/store/upload-runtime.js.map +1 -0
  144. package/lib/vertesia-client.js +10 -9
  145. package/lib/vertesia-client.js.map +1 -1
  146. package/package.json +35 -11
  147. package/src/AccountApi.ts +3 -0
  148. package/src/AccountRolesApi.ts +29 -0
  149. package/src/AppsApi.ts +58 -4
  150. package/src/AuditTrailApi.ts +11 -0
  151. package/src/IamApi.ts +1 -1
  152. package/src/InteractionCatalogApi.ts +44 -1
  153. package/src/InteractionsApi.ts +2 -31
  154. package/src/OAuthClientsApi.ts +6 -0
  155. package/src/OAuthProvidersApi.ts +7 -2
  156. package/src/StreamSource.ts +29 -0
  157. package/src/UsersApi.ts +10 -1
  158. package/src/client.ts +72 -8
  159. package/src/execute.ts +4 -2
  160. package/src/idempotency-key.ts +34 -0
  161. package/src/nodejs/NodeStreamSource.ts +37 -2
  162. package/src/store/AgentsApi.ts +5 -2
  163. package/src/store/ContentSourcesApi.ts +126 -0
  164. package/src/store/CostApi.ts +10 -0
  165. package/src/store/DashboardApi.ts +93 -18
  166. package/src/store/DataApi.ts +14 -10
  167. package/src/store/FilesApi.ts +84 -78
  168. package/src/store/NotificationsApi.ts +103 -0
  169. package/src/store/ObjectsApi.ts +30 -34
  170. package/src/store/RenderingApi.ts +1 -0
  171. package/src/store/WorkflowsApi.ts +25 -0
  172. package/src/store/chunked-upload.ts +272 -0
  173. package/src/store/client.ts +21 -1
  174. package/src/store/index.ts +3 -0
  175. package/src/store/node-request.browser.ts +22 -0
  176. package/src/store/node-request.ts +120 -0
  177. package/src/store/node-sessions.browser.ts +16 -0
  178. package/src/store/node-sessions.ts +109 -0
  179. package/src/store/signed-url.ts +126 -72
  180. package/src/store/stream-bytes.ts +79 -0
  181. package/src/store/upload-body.ts +37 -0
  182. package/src/store/upload-content.ts +129 -0
  183. package/src/store/upload-runtime.ts +42 -0
package/package.json CHANGED
@@ -1,9 +1,13 @@
1
1
  {
2
2
  "name": "@vertesia/client",
3
- "version": "1.6.0-dev.20261022.120426Z",
3
+ "version": "1.6.0-dev.20261120.123957Z",
4
4
  "type": "module",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
7
+ "browser": {
8
+ "./lib/store/node-request.js": "./lib/store/node-request.browser.js",
9
+ "./lib/store/node-sessions.js": "./lib/store/node-sessions.browser.js"
10
+ },
7
11
  "files": [
8
12
  "lib",
9
13
  "src",
@@ -12,17 +16,37 @@
12
16
  ],
13
17
  "license": "Apache-2.0",
14
18
  "devDependencies": {
19
+ "@azure/storage-blob": "^12.34.0",
20
+ "@google-cloud/storage": "^8.4.0",
15
21
  "@types/node": "^24.19.2",
16
22
  "@vertesia/tsconfig": "0.1.0",
17
- "rolldown": "1.2.14",
23
+ "google-auth-library": "^11.3.2",
24
+ "rolldown": "1.2.16",
18
25
  "typescript": "7.0.2",
19
- "vitest": "5.0.4"
26
+ "vitest": "5.1.0"
20
27
  },
21
28
  "dependencies": {
22
- "@llumiverse/common": "1.6.0-dev.20261022.120426Z",
23
- "@vertesia/api-fetch-client": "1.6.0-dev.20261022.120426Z",
24
- "@vertesia/common": "1.6.0-dev.20261022.120426Z",
25
- "eventsource": "^5.1.2"
29
+ "@llumiverse/common": "1.6.0-dev.20261120.123957Z",
30
+ "@vertesia/api-fetch-client": "1.6.0-dev.20261120.123957Z",
31
+ "@vertesia/common": "1.6.0-dev.20261120.123957Z",
32
+ "@vertesia/studio-utils": "1.6.0-dev.20261120.123957Z",
33
+ "eventsource": "^5.1.4"
34
+ },
35
+ "peerDependencies": {
36
+ "@azure/storage-blob": "^12.34.0",
37
+ "@google-cloud/storage": ">=8.4.0",
38
+ "google-auth-library": ">=11.3.2"
39
+ },
40
+ "peerDependenciesMeta": {
41
+ "@azure/storage-blob": {
42
+ "optional": true
43
+ },
44
+ "@google-cloud/storage": {
45
+ "optional": true
46
+ },
47
+ "google-auth-library": {
48
+ "optional": true
49
+ }
26
50
  },
27
51
  "exports": {
28
52
  ".": {
@@ -49,11 +73,11 @@
49
73
  "ai",
50
74
  "typescript"
51
75
  ],
52
- "gitHead": "bcaa7879b601ce9ccc394bcd3257822da13869cd",
76
+ "gitHead": "175a3f272cae5dc0273eff3fd198463106331045",
53
77
  "releaseIdentity": {
54
- "source_sha": "bcaa7879b601ce9ccc394bcd3257822da13869cd",
55
- "dependency_sha": "93466e47b06db23ac3c800e248d170afe65e5006",
56
- "lock_sha256": "117e1c8068aa07d59117323a51ceccfc96cab543e50c03eb7efc19709d6f5e6b"
78
+ "source_sha": "175a3f272cae5dc0273eff3fd198463106331045",
79
+ "dependency_sha": "b44c036a234f16aeba50fd4fb810121ac7dbf59f",
80
+ "lock_sha256": "e43dc89b7d72f8da4ece104946da392bfbb1376c67a47c4ab03a11eda2946ba8"
57
81
  },
58
82
  "scripts": {
59
83
  "lint": "biome lint src",
package/src/AccountApi.ts CHANGED
@@ -14,13 +14,16 @@ import type {
14
14
  UserInviteToken,
15
15
  } from '@vertesia/common';
16
16
  import AccountApiKeysApi from './AccountApiKeysApi.js';
17
+ import AccountRolesApi from './AccountRolesApi.js';
17
18
 
18
19
  export default class AccountApi extends ApiTopic {
19
20
  readonly apikeys: AccountApiKeysApi;
21
+ readonly roles: AccountRolesApi;
20
22
 
21
23
  constructor(parent: ClientBase) {
22
24
  super(parent, '/api/v1/account');
23
25
  this.apikeys = new AccountApiKeysApi(parent);
26
+ this.roles = new AccountRolesApi(parent);
24
27
  }
25
28
 
26
29
  /**
@@ -0,0 +1,29 @@
1
+ import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
2
+ import type {
3
+ CreateCustomRolePayload,
4
+ CustomRoleDefinition,
5
+ DeleteOperationResult,
6
+ Permission,
7
+ UpdateCustomRolePayload,
8
+ } from '@vertesia/common';
9
+
10
+ export default class AccountRolesApi extends ApiTopic {
11
+ constructor(parent: ClientBase) {
12
+ super(parent, '/api/v1/account/roles');
13
+ }
14
+ list(): Promise<CustomRoleDefinition[]> {
15
+ return this.get('/');
16
+ }
17
+ permissions(): Promise<Permission[]> {
18
+ return this.get('/permissions');
19
+ }
20
+ create(payload: CreateCustomRolePayload): Promise<CustomRoleDefinition> {
21
+ return this.post('/', { payload });
22
+ }
23
+ update(name: string, payload: UpdateCustomRolePayload): Promise<CustomRoleDefinition> {
24
+ return this.put(`/${encodeURIComponent(name)}`, { payload });
25
+ }
26
+ delete(name: string): Promise<DeleteOperationResult> {
27
+ return this.del(`/${encodeURIComponent(name)}`);
28
+ }
29
+ }
package/src/AppsApi.ts CHANGED
@@ -28,13 +28,17 @@ import type {
28
28
  AppScaffoldProgress,
29
29
  AppsQuery,
30
30
  AppToolCollection,
31
+ AppVersionLaunchTarget,
31
32
  AppVersionListQuery,
32
33
  AppVersionRecord,
33
34
  CountResult,
34
35
  CreateAppRepoBranchRequest,
36
+ CreateAppVersionLaunchRequest,
37
+ CreateAppVersionLaunchResponse,
35
38
  DeleteAppVersionResponse,
36
39
  ExchangeAppGithubAuthorizationResponse,
37
40
  McpApiKeyStatus,
41
+ OAuthClient,
38
42
  ProjectRef,
39
43
  PromoteAppVersionResponse,
40
44
  RequireAtLeastOne,
@@ -47,6 +51,7 @@ import type {
47
51
  StartAppScaffoldResponse,
48
52
  UpdateAppInstallationOAuthApprovalPayload,
49
53
  UpdateAppInstallationToolAllowlistPayload,
54
+ UpdateAppInstallationToolPermissionsPayload,
50
55
  UpdateAppPayload,
51
56
  UpsertAppVersionRequest,
52
57
  ValidateUrlRequest,
@@ -60,6 +65,11 @@ export default class AppsApi extends ApiTopic {
60
65
  super(parent, '/api/v1/apps');
61
66
  }
62
67
 
68
+ /** The publisher-managed OAuth registration shared by all installations of an app. */
69
+ getOAuthClient(appId: string): Promise<OAuthClient> {
70
+ return this.get(`/${encodeURIComponent(appId)}/oauth-client`);
71
+ }
72
+
63
73
  create(manifest: AppManifestData): Promise<AppManifest> {
64
74
  return this.post('/', { payload: manifest });
65
75
  }
@@ -150,6 +160,29 @@ export default class AppsApi extends ApiTopic {
150
160
  return this.post(`/versions/${recordId}/promote`);
151
161
  }
152
162
 
163
+ /** Create an ephemeral launch of an immutable version with temporary installation settings. */
164
+ createVersionLaunch(
165
+ recordId: string,
166
+ payload: CreateAppVersionLaunchRequest,
167
+ ): Promise<CreateAppVersionLaunchResponse> {
168
+ return this.post(`/versions/${recordId}/launches`, { payload });
169
+ }
170
+
171
+ /** List accessible projects where this app is installed and can host a temporary launch. */
172
+ listVersionLaunchTargets(recordId: string): Promise<AppVersionLaunchTarget[]> {
173
+ return this.get(`/versions/${recordId}/launch-targets`);
174
+ }
175
+
176
+ /** Assign or move a stable deployment alias to an immutable app version. */
177
+ assignVersionAlias(recordId: string, alias: string): Promise<AppVersionRecord> {
178
+ return this.put(`/versions/${recordId}/aliases/${encodeURIComponent(alias)}`);
179
+ }
180
+
181
+ /** Remove an alias only when it still points to the specified app version. */
182
+ removeVersionAlias(recordId: string, alias: string): Promise<AppVersionRecord> {
183
+ return this.del(`/versions/${recordId}/aliases/${encodeURIComponent(alias)}`);
184
+ }
185
+
153
186
  rebuildVersion(recordId: string): Promise<StartAppBuildResponse> {
154
187
  return this.post(`/versions/${recordId}/rebuild`);
155
188
  }
@@ -364,9 +397,16 @@ export default class AppsApi extends ApiTopic {
364
397
  * package-resolved (no per-id route), so this is how a client reads the full definition — type
365
398
  * schema, interaction prompt, process definition, dashboard spec — to visualize an exposed id.
366
399
  */
367
- getAppPackage(appIdOrName: string, scope: AppPackageScope | AppPackageScope[] = 'all'): Promise<AppPackage> {
400
+ getAppPackage(
401
+ appIdOrName: string,
402
+ scope: AppPackageScope | AppPackageScope[] = 'all',
403
+ deploymentAlias?: string,
404
+ ): Promise<AppPackage> {
368
405
  return this.get(`/${encodeURIComponent(appIdOrName)}/package`, {
369
- query: { scope: Array.isArray(scope) ? scope.join(',') : scope },
406
+ query: {
407
+ scope: Array.isArray(scope) ? scope.join(',') : scope,
408
+ ...(deploymentAlias ? { deployment_alias: deploymentAlias } : {}),
409
+ },
370
410
  });
371
411
  }
372
412
 
@@ -414,12 +454,15 @@ export default class AppsApi extends ApiTopic {
414
454
  apiKeyParams?: AppApiKeyCollectionParams,
415
455
  mcpParameters?: AppInstallationPayload['mcp_parameters'],
416
456
  mcpSharedParameters?: AppInstallationPayload['mcp_shared_parameters'],
417
- instance?: Pick<AppInstallationPayload, 'instance_key' | 'display_name' | 'namespace_overrides'>,
457
+ installation?: Pick<
458
+ AppInstallationPayload,
459
+ 'approved_scopes' | 'deployment_alias' | 'instance_key' | 'display_name' | 'namespace_overrides'
460
+ >,
418
461
  ): Promise<AppInstallation> {
419
462
  return this.post(`/install`, {
420
463
  payload: {
421
464
  app_id: appId,
422
- ...instance,
465
+ ...installation,
423
466
  settings,
424
467
  oauth_params: oauthParams,
425
468
  oauth_provider_params: oauthProviderParams,
@@ -556,6 +599,17 @@ export default class AppsApi extends ApiTopic {
556
599
  });
557
600
  }
558
601
 
602
+ /**
603
+ * Update the tool allowlist and the tools requiring human approval of an app installation in one atomic write.
604
+ * Omit a field to leave it unchanged; pass null to clear it.
605
+ */
606
+ updateToolPermissions(
607
+ installId: string,
608
+ payload: UpdateAppInstallationToolPermissionsPayload,
609
+ ): Promise<AppInstallationWithManifest> {
610
+ return this.put(`/installations/${installId}/tool-permissions`, { payload });
611
+ }
612
+
559
613
  /**
560
614
  * Validate that a URL is safe to use as a remote tool/activity endpoint.
561
615
  * Throws a ServerError(400) if the URL is blocked (SSRF protection).
@@ -2,6 +2,8 @@ import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
2
2
  import type {
3
3
  AuditAdoptionQuery,
4
4
  AuditAdoptionResponse,
5
+ AuditAggregationBatchQuery,
6
+ AuditAggregationBatchResponse,
5
7
  AuditAggregationQuery,
6
8
  AuditAggregationResponse,
7
9
  AuditTrailQuery,
@@ -38,6 +40,15 @@ export default class AuditTrailApi extends ApiTopic {
38
40
  return this.post('/aggregate', { payload: query });
39
41
  }
40
42
 
43
+ /**
44
+ * Run several aggregations in one request. `results[i]` is what `aggregate(queries[i])` returns; the server
45
+ * computes the queries that share a scope, time range and filter in one pass over the audit events.
46
+ */
47
+ aggregateBatch(queries: AuditAggregationQuery[]): Promise<AuditAggregationBatchResponse> {
48
+ const payload: AuditAggregationBatchQuery = { queries };
49
+ return this.post('/aggregate/batch', { payload });
50
+ }
51
+
41
52
  adoption(query: AuditAdoptionQuery = {}): Promise<AuditAdoptionResponse> {
42
53
  return this.post('/adoption', { payload: query });
43
54
  }
package/src/IamApi.ts CHANGED
@@ -51,7 +51,7 @@ export class RolesApi extends ApiTopic {
51
51
  /**
52
52
  * List system-domain roles only. Permissions are tightly typed as `Permission[]` —
53
53
  * suited for client-side permission gating (button visibility, route guards).
54
- * ABAC roles are excluded and must be consumed via the JWT `content_security` claim.
54
+ * ABAC roles are excluded and must be consumed via the JWT `abac` claim.
55
55
  */
56
56
  listSystem(options?: IRequestParams): Promise<SystemRoleDefinition[]> {
57
57
  return this.get('/system', options);
@@ -1,5 +1,12 @@
1
1
  import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
2
- import type { CatalogInteractionRef, InteractionStatus, ResolvedCatalogInteraction } from '@vertesia/common';
2
+ import type {
3
+ CatalogAgentSearchQuery,
4
+ CatalogCallSearchQuery,
5
+ CatalogInteractionRef,
6
+ CatalogSearchResult,
7
+ InteractionStatus,
8
+ ResolvedCatalogInteraction,
9
+ } from '@vertesia/common';
3
10
 
4
11
  export class InteractionCatalogApi extends ApiTopic {
5
12
  constructor(parent: ClientBase) {
@@ -35,6 +42,42 @@ export class InteractionCatalogApi extends ApiTopic {
35
42
  });
36
43
  }
37
44
 
45
+ /**
46
+ * Search the stored agents of the project: the interactions configured as agents
47
+ * (`agent_runner_options.is_agent`), in their draft version.
48
+ */
49
+ listStoredAgents(query: CatalogAgentSearchQuery = {}): Promise<CatalogSearchResult> {
50
+ return this.get('/agents/stored', { query });
51
+ }
52
+
53
+ /** Search the system agents, which are defined in code by the platform. */
54
+ listSystemAgents(query: CatalogAgentSearchQuery = {}): Promise<CatalogSearchResult> {
55
+ return this.get('/agents/system', { query });
56
+ }
57
+
58
+ /** Search the agents provided by an app. The app is asked for its interactions, so this can be slow. */
59
+ listAppAgents(appName: string, query: CatalogAgentSearchQuery = {}): Promise<CatalogSearchResult> {
60
+ return this.get(`/agents/apps/${encodeURIComponent(appName)}`, { query });
61
+ }
62
+
63
+ /**
64
+ * Search the stored calls of the project: the interactions that are not agents (basic, tool and skill calls),
65
+ * in their draft version.
66
+ */
67
+ listStoredCalls(query: CatalogCallSearchQuery = {}): Promise<CatalogSearchResult> {
68
+ return this.get('/calls/stored', { query });
69
+ }
70
+
71
+ /** Search the system calls, which are defined in code by the platform. */
72
+ listSystemCalls(query: CatalogCallSearchQuery = {}): Promise<CatalogSearchResult> {
73
+ return this.get('/calls/system', { query });
74
+ }
75
+
76
+ /** Search the calls provided by an app. The app is asked for its interactions, so this can be slow. */
77
+ listAppCalls(appName: string, query: CatalogCallSearchQuery = {}): Promise<CatalogSearchResult> {
78
+ return this.get(`/calls/apps/${encodeURIComponent(appName)}`, { query });
79
+ }
80
+
38
81
  /**
39
82
  * List sys interactions
40
83
  */
@@ -5,12 +5,8 @@ import type {
5
5
  ComputedFacetResponse,
6
6
  ComputeInteractionFacetPayload,
7
7
  DeleteByIdResult,
8
- GeneratedInteractionDefinition,
9
8
  GeneratedTestDataRecord,
10
- GenerateInteractionPayload,
11
9
  GenerateTestDataPayload,
12
- ImprovePromptPayload,
13
- ImprovePromptPayloadConfig,
14
10
  Interaction,
15
11
  InteractionCreatePayload,
16
12
  InteractionDeletePayload,
@@ -26,7 +22,6 @@ import type {
26
22
  InteractionsExportPayload,
27
23
  InteractionTags,
28
24
  InteractionUpdatePayload,
29
- PromptImprovementResponse,
30
25
  RateLimitRequestPayload,
31
26
  RateLimitRequestResponse,
32
27
  ResolvedInteractionExecutionInfo,
@@ -274,15 +269,6 @@ export default class InteractionsApi extends ApiTopic {
274
269
  });
275
270
  }
276
271
 
277
- /**
278
- * Generate Composable definition of an interaction
279
- **/
280
- generateInteraction(id: string, payload: GenerateInteractionPayload): Promise<GeneratedInteractionDefinition[]> {
281
- return this.post(`${id}/generate-interaction`, {
282
- payload,
283
- });
284
- }
285
-
286
272
  /**
287
273
  * Generate Test Data for an interaction
288
274
  **/
@@ -292,22 +278,6 @@ export default class InteractionsApi extends ApiTopic {
292
278
  });
293
279
  }
294
280
 
295
- /**
296
- * Suggest Improvement for a prompt
297
- * @deprecated use suggestPromptImprovements instead
298
- */
299
- suggestImprovements(id: string, payload: ImprovePromptPayloadConfig): Promise<PromptImprovementResponse> {
300
- return this.post(`${id}/suggest-prompt-improvements`, {
301
- payload,
302
- });
303
- }
304
-
305
- suggestPromptImprovements(payload: ImprovePromptPayload): Promise<PromptImprovementResponse> {
306
- return this.post(`/improve`, {
307
- payload,
308
- });
309
- }
310
-
311
281
  /**
312
282
  * List the versions of the interaction. Returns an empty array if no versions are found
313
283
  * @param id
@@ -329,7 +299,8 @@ export default class InteractionsApi extends ApiTopic {
329
299
  /**
330
300
  * Request a time slot to execute an interaction with a given environment / model
331
301
  * @param payload RateLimitRequestPayload
332
- * @returns RateLimitRequestResponse with delay_ms
302
+ * @returns RateLimitRequestResponse with delay_ms and, when the request holds a slot, its rate_limit_grant.
303
+ * Once admitted (delay_ms is 0), send the grant back as `workflow.rate_limit_id` when executing
333
304
  */
334
305
  requestSlot(payload: RateLimitRequestPayload): Promise<RateLimitRequestResponse> {
335
306
  return checkRateLimit(this.client as VertesiaClient, payload);
@@ -6,6 +6,7 @@ import type {
6
6
  OAuthClientScopeMetadata,
7
7
  SuccessResponse,
8
8
  UpdateOAuthClientPayload,
9
+ UpdateOAuthClientStatusPayload,
9
10
  } from '@vertesia/common';
10
11
 
11
12
  export default class OAuthClientsApi extends ApiTopic {
@@ -33,6 +34,11 @@ export default class OAuthClientsApi extends ApiTopic {
33
34
  return this.put(`/${clientId}`, { payload });
34
35
  }
35
36
 
37
+ /** Enable or disable sign-in without changing application-managed configuration. */
38
+ setStatus(clientId: string, payload: UpdateOAuthClientStatusPayload): Promise<OAuthClient> {
39
+ return this.put(`/${encodeURIComponent(clientId)}/status`, { payload });
40
+ }
41
+
36
42
  remove(clientId: string): Promise<SuccessResponse> {
37
43
  return this.del(`/${clientId}`);
38
44
  }
@@ -5,6 +5,7 @@ import type {
5
5
  OAuthProviderAccessTokenResponse,
6
6
  OAuthProviderAuthorizeResponse,
7
7
  OAuthProviderAuthStatus,
8
+ OAuthProviderTokenRequest,
8
9
  SuccessResponse,
9
10
  UpdateOAuthProviderPayload,
10
11
  } from '@vertesia/common';
@@ -55,8 +56,12 @@ export default class OAuthProvidersApi extends ApiTopic {
55
56
  return this.post(`/${id}/connect`, { payload: {} });
56
57
  }
57
58
 
58
- getToken(id: string): Promise<OAuthProviderAccessTokenResponse> {
59
- return this.post(`/${id}/token`, { payload: {} });
59
+ /**
60
+ * Get an access token from the provider. With `scope`, asks for those scopes instead of the provider's default
61
+ * scopes; each must be in the provider's `default_scopes` or `allowed_scopes` (client_credentials providers only).
62
+ */
63
+ getToken(id: string, request: OAuthProviderTokenRequest = {}): Promise<OAuthProviderAccessTokenResponse> {
64
+ return this.post(`/${id}/token`, { payload: request });
60
65
  }
61
66
 
62
67
  disconnect(id: string): Promise<SuccessResponse> {
@@ -1,8 +1,37 @@
1
1
  export class StreamSource {
2
+ /**
3
+ * @param size the stream's length in bytes, when it is known in advance (e.g. from a response's declared
4
+ * length, see {@link responseBodyLength}). An upload then streams the content with that `Content-Length`
5
+ * instead of buffering it, and fails if the stream ends short of it or runs past it.
6
+ */
2
7
  constructor(
3
8
  public stream: ReadableStream,
4
9
  public name: string,
5
10
  public type?: string,
6
11
  public id?: string,
12
+ public size?: number,
7
13
  ) {}
14
+
15
+ /**
16
+ * The same content as a `Blob` that can be sent more than once without being held in memory, such as a
17
+ * blob backed by a local file. Uploads send it instead of {@link stream} when there is one, so a failed
18
+ * transfer can be retried. A plain stream source has none.
19
+ */
20
+ replayableBody(): Promise<Blob | undefined> {
21
+ return Promise.resolve(undefined);
22
+ }
23
+ }
24
+
25
+ /**
26
+ * The length of a response body as it will be read, from its `Content-Length`: undefined when the header is
27
+ * missing or invalid, or when the body is content-encoded, since `fetch` decodes it and the bytes read then differ
28
+ * from the declared length.
29
+ */
30
+ export function responseBodyLength(response: Response): number | undefined {
31
+ const encoding = response.headers.get('content-encoding')?.trim().toLowerCase();
32
+ if (encoding && encoding !== 'identity') return undefined;
33
+ const header = response.headers.get('content-length');
34
+ if (header === null || !/^\d+$/.test(header.trim())) return undefined;
35
+ const length = Number(header.trim());
36
+ return Number.isSafeInteger(length) ? length : undefined;
8
37
  }
package/src/UsersApi.ts CHANGED
@@ -1,11 +1,20 @@
1
1
  import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
2
- import type { DeleteByIdResult, UpdateUserPayload, User } from '@vertesia/common';
2
+ import type { CreateUserPayload, DeleteByIdResult, UpdateUserPayload, User } from '@vertesia/common';
3
3
 
4
4
  export default class UsersApi extends ApiTopic {
5
5
  constructor(parent: ClientBase) {
6
6
  super(parent, '/api/v1/users');
7
7
  }
8
8
 
9
+ /**
10
+ * Add a user to the current account with the member role, without sending an invitation.
11
+ * Creates the user when no user has the address; otherwise adds the existing one, leaving its
12
+ * profile unchanged. Repeating the call returns the same user.
13
+ */
14
+ create(payload: CreateUserPayload): Promise<User> {
15
+ return this.post('', { payload });
16
+ }
17
+
9
18
  retrieve(userId: string): Promise<User> {
10
19
  return this.get(`/${userId}`);
11
20
  }
package/src/client.ts CHANGED
@@ -1,6 +1,18 @@
1
- import { AbstractFetchClient, type FETCH_FN, type IRequestRetryPolicy } from '@vertesia/api-fetch-client';
1
+ import {
2
+ AbstractFetchClient,
3
+ type FETCH_FN,
4
+ type IPacingRetryPolicy,
5
+ type IRequestRetryPolicy,
6
+ type RequestIdentityProvider,
7
+ } from '@vertesia/api-fetch-client';
2
8
  import type { AppSessionTokenRequest, AppSessionTokenResponse } from '@vertesia/common';
3
- import { APP_VERSION_HEADER, type AuthTokenPayload, type AuthTokenResponse } from '@vertesia/common';
9
+ import {
10
+ APP_VERSION_HEADER,
11
+ type AuthTokenPayload,
12
+ type AuthTokenResponse,
13
+ type ContentSecurity,
14
+ } from '@vertesia/common';
15
+ import { resolveAbacClaim, TokenClaimReferenceError } from '@vertesia/studio-utils/token-claims';
4
16
  import AccountApi from './AccountApi.js';
5
17
  import AccountsApi from './AccountsApi.js';
6
18
  import AnalyticsApi from './AnalyticsApi.js';
@@ -68,10 +80,14 @@ export type VertesiaClientProps = {
68
80
  storeUrl?: string;
69
81
  tokenServerUrl?: string;
70
82
  apikey?: string;
83
+ /** Supplies the complete Authorization header; takes precedence over apikey. */
84
+ authCallback?: () => Promise<string>;
71
85
  sessionTags?: string | string[];
86
+ requestIdentity?: RequestIdentityProvider;
72
87
  onRequest?: (request: Request) => void;
73
88
  onResponse?: (response: Response) => void;
74
89
  retryPolicy?: IRequestRetryPolicy;
90
+ pacingRetry?: IPacingRetryPolicy | false;
75
91
  /**
76
92
  * Default request timeout in ms applied to every request (studio + store) unless overridden
77
93
  * per-request via `timeoutMs`. `false`/`null`/`0` disables it. Aborts the whole request
@@ -92,10 +108,13 @@ const KNOWN_CLIENT_OPTIONS: Record<keyof Required<VertesiaClientProps>, true> =
92
108
  storeUrl: true,
93
109
  tokenServerUrl: true,
94
110
  apikey: true,
111
+ authCallback: true,
95
112
  sessionTags: true,
113
+ requestIdentity: true,
96
114
  onRequest: true,
97
115
  onResponse: true,
98
116
  retryPolicy: true,
117
+ pacingRetry: true,
99
118
  timeout: true,
100
119
  fetch: true,
101
120
  };
@@ -105,6 +124,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
105
124
  * The JWT token linked to the API KEY (sk or pk)
106
125
  */
107
126
  _jwt: string | null = null;
127
+ private abacResolution?: { jwt: string; value: Promise<ContentSecurity | undefined> };
108
128
 
109
129
  /**
110
130
  * The store client
@@ -230,9 +250,12 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
230
250
  serverUrl: zenoServerUrl,
231
251
  tokenServerUrl: this.tokenServerUrl,
232
252
  apikey: opts.apikey,
253
+ authCallback: opts.authCallback,
254
+ requestIdentity: opts.requestIdentity,
233
255
  onRequest: opts.onRequest,
234
256
  onResponse: opts.onResponse,
235
257
  retryPolicy: opts.retryPolicy,
258
+ pacingRetry: opts.pacingRetry,
236
259
  timeout: opts.timeout,
237
260
  fetch: opts.fetch,
238
261
  });
@@ -242,14 +265,21 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
242
265
  this.withRetryPolicy(opts.retryPolicy);
243
266
  }
244
267
 
268
+ if (opts.pacingRetry !== undefined) {
269
+ this.withPacingRetry(opts.pacingRetry);
270
+ }
271
+
245
272
  if (opts.timeout !== undefined) {
246
273
  this.withTimeout(opts.timeout);
247
274
  }
248
275
 
249
- if (opts.apikey) {
276
+ if (opts.authCallback) {
277
+ this.withAuthCallback(opts.authCallback);
278
+ } else if (opts.apikey) {
250
279
  void this.withApiKey(opts.apikey);
251
280
  }
252
281
 
282
+ this.requestIdentity = opts.requestIdentity;
253
283
  this.onRequest = opts.onRequest;
254
284
  this.onResponse = opts.onResponse;
255
285
  this.sessionTags = opts.sessionTags;
@@ -325,12 +355,9 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
325
355
  }
326
356
 
327
357
  async getRawJWT() {
328
- if (!this._jwt && this._auth) {
358
+ if (this._auth) {
329
359
  const auth = await this._auth();
330
- if (!this._jwt) {
331
- // the _jwt may be set by the auth callback
332
- this._jwt = auth.trim().split(' ')[1]; // remove Bearer prefix
333
- }
360
+ this._jwt = auth.trim().split(' ')[1]; // remove Bearer prefix
334
361
  }
335
362
  return this._jwt || null;
336
363
  }
@@ -340,6 +367,38 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
340
367
  return jwt ? decodeJWT(jwt) : null;
341
368
  }
342
369
 
370
+ /**
371
+ * Resolve ABAC only when it is needed. JWT decoding alone deliberately keeps opaque claim
372
+ * references intact. The existing STS validation endpoint verifies the complete bearer before
373
+ * loading Redis; knowing a reference alone never authorizes reading its policy.
374
+ */
375
+ async getAbac(): Promise<ContentSecurity | undefined> {
376
+ const jwt = await this.getRawJWT();
377
+ if (!jwt) return undefined;
378
+ if (this.abacResolution?.jwt === jwt) return this.abacResolution.value;
379
+
380
+ const payload = decodeJWT(jwt);
381
+ const value = resolveAbacClaim(payload.abac ?? payload.content_security, async () => {
382
+ const response = await this.post<{ valid: boolean; payload?: AuthTokenPayload }>(
383
+ new URL('/validate', this.tokenServerUrl).toString(),
384
+ { payload: { token: jwt } },
385
+ );
386
+ const abac = response.payload?.abac;
387
+ if (!response.valid || !abac || typeof abac !== 'object' || Array.isArray(abac)) {
388
+ throw new TokenClaimReferenceError('STS could not resolve token authorization context');
389
+ }
390
+ return { abac };
391
+ });
392
+ const entry = { jwt, value };
393
+ this.abacResolution = entry;
394
+ try {
395
+ return await value;
396
+ } catch (error: unknown) {
397
+ if (this.abacResolution === entry) this.abacResolution = undefined;
398
+ throw error;
399
+ }
400
+ }
401
+
343
402
  async getProject() {
344
403
  const jwt = await this.getDecodedJWT();
345
404
  return jwt?.project || null;
@@ -375,6 +434,10 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
375
434
  return this.store.files;
376
435
  }
377
436
 
437
+ get contentSources() {
438
+ return this.store.contentSources;
439
+ }
440
+
378
441
  get processes() {
379
442
  return this.store.processes;
380
443
  }
@@ -507,6 +570,7 @@ export function decodeJWT(jwt: string): AuthTokenPayload {
507
570
  throw new Error(`Invalid auth token: payload segment is not base64url (${(err as Error).message})`);
508
571
  }
509
572
 
573
+ // Decoding is not authentication; servers verify the signature and permission contract.
510
574
  try {
511
575
  return JSON.parse(decodedJson);
512
576
  } catch {