@vertesia/client 1.5.0-dev.20260725.083715Z → 1.5.0-dev.20260806.125520Z

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 (154) hide show
  1. package/lib/AccountApi.d.ts +10 -7
  2. package/lib/AccountApi.d.ts.map +1 -1
  3. package/lib/AccountApi.js +7 -4
  4. package/lib/AccountApi.js.map +1 -1
  5. package/lib/AccountsApi.d.ts.map +1 -1
  6. package/lib/AnalyticsApi.d.ts.map +1 -1
  7. package/lib/ApiKeysApi.d.ts +3 -3
  8. package/lib/ApiKeysApi.d.ts.map +1 -1
  9. package/lib/ApiKeysApi.js.map +1 -1
  10. package/lib/AppsApi.d.ts +12 -2
  11. package/lib/AppsApi.d.ts.map +1 -1
  12. package/lib/AppsApi.js +20 -1
  13. package/lib/AppsApi.js.map +1 -1
  14. package/lib/AuditTrailApi.d.ts.map +1 -1
  15. package/lib/CommandsApi.d.ts.map +1 -1
  16. package/lib/EnvironmentsApi.d.ts +3 -6
  17. package/lib/EnvironmentsApi.d.ts.map +1 -1
  18. package/lib/EnvironmentsApi.js.map +1 -1
  19. package/lib/GroupsApi.d.ts +2 -0
  20. package/lib/GroupsApi.d.ts.map +1 -1
  21. package/lib/GroupsApi.js.map +1 -1
  22. package/lib/IamApi.d.ts.map +1 -1
  23. package/lib/InteractionBase.d.ts +686 -2
  24. package/lib/InteractionBase.d.ts.map +1 -1
  25. package/lib/InteractionBase.js.map +1 -1
  26. package/lib/InteractionCatalogApi.d.ts.map +1 -1
  27. package/lib/InteractionCatalogApi.js.map +1 -1
  28. package/lib/InteractionOutput.d.ts.map +1 -1
  29. package/lib/InteractionOutput.js.map +1 -1
  30. package/lib/InteractionsApi.d.ts.map +1 -1
  31. package/lib/InteractionsApi.js.map +1 -1
  32. package/lib/InternalSecretsApi.d.ts.map +1 -1
  33. package/lib/OAuthClientsApi.d.ts.map +1 -1
  34. package/lib/OAuthGrantsApi.d.ts +2 -4
  35. package/lib/OAuthGrantsApi.d.ts.map +1 -1
  36. package/lib/OAuthGrantsApi.js.map +1 -1
  37. package/lib/OAuthProvidersApi.d.ts +6 -1
  38. package/lib/OAuthProvidersApi.d.ts.map +1 -1
  39. package/lib/OAuthProvidersApi.js +5 -0
  40. package/lib/OAuthProvidersApi.js.map +1 -1
  41. package/lib/OAuthServerApi.d.ts.map +1 -1
  42. package/lib/OAuthServerApi.js.map +1 -1
  43. package/lib/ProjectsApi.d.ts.map +1 -1
  44. package/lib/PromptsApi.d.ts +19 -30
  45. package/lib/PromptsApi.d.ts.map +1 -1
  46. package/lib/PromptsApi.js +1 -1
  47. package/lib/PromptsApi.js.map +1 -1
  48. package/lib/QuotaApi.d.ts.map +1 -1
  49. package/lib/RefsApi.d.ts.map +1 -1
  50. package/lib/RemoteMcpConnectionsApi.d.ts.map +1 -1
  51. package/lib/RunsApi.d.ts.map +1 -1
  52. package/lib/SecretsApi.d.ts.map +1 -1
  53. package/lib/SkillsApi.d.ts.map +1 -1
  54. package/lib/StreamSource.d.ts.map +1 -1
  55. package/lib/StreamSource.js.map +1 -1
  56. package/lib/ToolsApi.d.ts.map +1 -1
  57. package/lib/TrainingApi.d.ts.map +1 -1
  58. package/lib/TrainingApi.js.map +1 -1
  59. package/lib/UsersApi.d.ts.map +1 -1
  60. package/lib/ViewsApi.d.ts.map +1 -1
  61. package/lib/ViewsApi.js.map +1 -1
  62. package/lib/client.d.ts +10 -2
  63. package/lib/client.d.ts.map +1 -1
  64. package/lib/client.js +1 -0
  65. package/lib/client.js.map +1 -1
  66. package/lib/execute.js.map +1 -1
  67. package/lib/managed-sse.js +1 -1
  68. package/lib/managed-sse.js.map +1 -1
  69. package/lib/nodejs/NodeStreamSource.d.ts.map +1 -1
  70. package/lib/store/AgentsApi.d.ts.map +1 -1
  71. package/lib/store/AgentsApi.js +121 -77
  72. package/lib/store/AgentsApi.js.map +1 -1
  73. package/lib/store/AnalyzeDocApi.d.ts.map +1 -1
  74. package/lib/store/AnalyzeDocApi.js.map +1 -1
  75. package/lib/store/CollectionsApi.d.ts.map +1 -1
  76. package/lib/store/CollectionsApi.js.map +1 -1
  77. package/lib/store/CostApi.d.ts.map +1 -1
  78. package/lib/store/CostApi.js.map +1 -1
  79. package/lib/store/DashboardApi.d.ts.map +1 -1
  80. package/lib/store/DataApi.d.ts.map +1 -1
  81. package/lib/store/EmailApi.d.ts.map +1 -1
  82. package/lib/store/EmbeddingsApi.d.ts.map +1 -1
  83. package/lib/store/EmbeddingsApi.js.map +1 -1
  84. package/lib/store/EventIngestChannelsApi.d.ts.map +1 -1
  85. package/lib/store/EventSubscriptionsApi.d.ts.map +1 -1
  86. package/lib/store/EventsApi.d.ts +2 -1
  87. package/lib/store/EventsApi.d.ts.map +1 -1
  88. package/lib/store/EventsApi.js +3 -0
  89. package/lib/store/EventsApi.js.map +1 -1
  90. package/lib/store/FilesApi.d.ts +4 -0
  91. package/lib/store/FilesApi.d.ts.map +1 -1
  92. package/lib/store/FilesApi.js +48 -23
  93. package/lib/store/FilesApi.js.map +1 -1
  94. package/lib/store/HiveMemoryApi.d.ts.map +1 -1
  95. package/lib/store/IndexingApi.d.ts.map +1 -1
  96. package/lib/store/IndexingApi.js.map +1 -1
  97. package/lib/store/ObjectsApi.d.ts +3 -8
  98. package/lib/store/ObjectsApi.d.ts.map +1 -1
  99. package/lib/store/ObjectsApi.js +2 -2
  100. package/lib/store/ObjectsApi.js.map +1 -1
  101. package/lib/store/PendingAsksApi.d.ts.map +1 -1
  102. package/lib/store/ProcessApi.d.ts.map +1 -1
  103. package/lib/store/QueryApi.d.ts.map +1 -1
  104. package/lib/store/QueryApi.js.map +1 -1
  105. package/lib/store/RenderingApi.d.ts.map +1 -1
  106. package/lib/store/RenderingApi.js.map +1 -1
  107. package/lib/store/SchedulesApi.d.ts.map +1 -1
  108. package/lib/store/TaskApi.d.ts +9 -0
  109. package/lib/store/TaskApi.d.ts.map +1 -1
  110. package/lib/store/TaskApi.js +11 -16
  111. package/lib/store/TaskApi.js.map +1 -1
  112. package/lib/store/TypeCatalogApi.d.ts +21 -7
  113. package/lib/store/TypeCatalogApi.d.ts.map +1 -1
  114. package/lib/store/TypeCatalogApi.js +16 -2
  115. package/lib/store/TypeCatalogApi.js.map +1 -1
  116. package/lib/store/TypesApi.d.ts +2 -2
  117. package/lib/store/TypesApi.d.ts.map +1 -1
  118. package/lib/store/TypesApi.js.map +1 -1
  119. package/lib/store/ViewsApi.d.ts.map +1 -1
  120. package/lib/store/ViewsApi.js.map +1 -1
  121. package/lib/store/WorkflowsApi.d.ts.map +1 -1
  122. package/lib/store/WorkflowsApi.js.map +1 -1
  123. package/lib/store/client.d.ts.map +1 -1
  124. package/lib/store/client.js.map +1 -1
  125. package/lib/store/errors.d.ts.map +1 -1
  126. package/lib/store/signed-url.js.map +1 -1
  127. package/lib/store/version.d.ts +1 -3
  128. package/lib/store/version.d.ts.map +1 -1
  129. package/lib/store/version.js +3 -3
  130. package/lib/store/version.js.map +1 -1
  131. package/lib/vertesia-client.js +10 -10
  132. package/lib/vertesia-client.js.map +1 -1
  133. package/package.json +6 -6
  134. package/src/AccountApi.test.ts +30 -0
  135. package/src/AccountApi.ts +10 -8
  136. package/src/ApiKeysApi.ts +4 -3
  137. package/src/AppsApi.ts +26 -0
  138. package/src/EnvironmentsApi.ts +3 -11
  139. package/src/GroupsApi.ts +2 -0
  140. package/src/OAuthGrantsApi.ts +2 -1
  141. package/src/OAuthProvidersApi.ts +6 -1
  142. package/src/PromptsApi.ts +22 -25
  143. package/src/client.test.ts +16 -0
  144. package/src/client.ts +1 -0
  145. package/src/store/AgentsApi.stream.test.ts +298 -0
  146. package/src/store/AgentsApi.ts +120 -68
  147. package/src/store/EventsApi.ts +8 -0
  148. package/src/store/FilesApi.test.ts +37 -1
  149. package/src/store/FilesApi.ts +49 -20
  150. package/src/store/ObjectsApi.ts +8 -8
  151. package/src/store/TaskApi.ts +11 -11
  152. package/src/store/TypeCatalogApi.ts +21 -7
  153. package/src/store/TypesApi.ts +2 -1
  154. package/src/store/version.ts +7 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/client",
3
- "version": "1.5.0-dev.20260725.083715Z",
3
+ "version": "1.5.0-dev.20260806.125520Z",
4
4
  "type": "module",
5
5
  "main": "./lib/index.js",
6
6
  "types": "./lib/index.d.ts",
@@ -13,15 +13,15 @@
13
13
  "devDependencies": {
14
14
  "@types/node": "^24.13.3",
15
15
  "rolldown": "1.2.0",
16
- "typescript": "^6.0.3",
16
+ "typescript": "7.0.2",
17
17
  "vitest": "^4.1.10",
18
18
  "@vertesia/tsconfig": "0.1.0"
19
19
  },
20
20
  "dependencies": {
21
21
  "eventsource": "^4.1.0",
22
- "@llumiverse/common": "1.5.0-dev.20260725.065646Z",
23
- "@vertesia/api-fetch-client": "1.5.0-dev.20260725.083715Z",
24
- "@vertesia/common": "1.5.0-dev.20260725.083715Z"
22
+ "@llumiverse/common": "1.5.0-dev.20260806.124634Z",
23
+ "@vertesia/common": "1.5.0-dev.20260806.125520Z",
24
+ "@vertesia/api-fetch-client": "1.5.0-dev.20260806.125520Z"
25
25
  },
26
26
  "exports": {
27
27
  ".": {
@@ -48,7 +48,7 @@
48
48
  "ai",
49
49
  "typescript"
50
50
  ],
51
- "gitHead": "57bcc2f27dd17b3387f27c18e89329c4c37f98ac",
51
+ "gitHead": "416423ef4182d8668809604902a871ca79629298",
52
52
  "scripts": {
53
53
  "lint": "biome lint src",
54
54
  "clean:lib": "rimraf ./lib ./tsconfig.tsbuildinfo",
@@ -0,0 +1,30 @@
1
+ import { describe, expect, it, vi } from 'vitest';
2
+ import { VertesiaClient } from './client.js';
3
+
4
+ describe('AccountApi', () => {
5
+ it('returns onboarding.completed_at as the ISO string received over JSON', async () => {
6
+ const completedAt = '2026-07-29T10:00:00.000Z';
7
+ const fetchMock = vi.fn(async () => {
8
+ return new Response(
9
+ JSON.stringify({
10
+ id: 'account-id',
11
+ onboarding: { completed: true, completed_at: completedAt },
12
+ }),
13
+ {
14
+ status: 200,
15
+ headers: { 'content-type': 'application/json' },
16
+ },
17
+ );
18
+ });
19
+ const client = new VertesiaClient({
20
+ serverUrl: 'https://api.example.com',
21
+ storeUrl: 'https://api.example.com',
22
+ fetch: fetchMock,
23
+ });
24
+
25
+ const account = await client.account.info();
26
+
27
+ expect(account.onboarding.completed_at).toBe(completedAt);
28
+ expect(account.onboarding.completed_at).not.toBeInstanceOf(Date);
29
+ });
30
+ });
package/src/AccountApi.ts CHANGED
@@ -9,10 +9,9 @@ import type {
9
9
  OnboardingProgress,
10
10
  ProjectRef,
11
11
  StripeBillingStatusResponse,
12
- TransientToken,
13
12
  UpdateAccountPayload,
14
13
  User,
15
- UserInviteTokenData,
14
+ UserInviteToken,
16
15
  } from '@vertesia/common';
17
16
 
18
17
  export default class AccountApi extends ApiTopic {
@@ -56,17 +55,20 @@ export default class AccountApi extends ApiTopic {
56
55
 
57
56
  /**
58
57
  * Fetch Invites for Principal
59
- * @returns UserInviteTokenData[]
60
- * */
61
- listInvites(): Promise<TransientToken<UserInviteTokenData>[]> {
58
+ *
59
+ * Returns `UserInviteToken[]`, not `TransientToken<UserInviteTokenData>[]`. The latter declared
60
+ * `Date` for `expires`, `created_at` and `updated_at`, which no HTTP response can carry — the
61
+ * client hands back whatever `JSON.parse` produced, so those three were always strings. It now
62
+ * says so.
63
+ */
64
+ listInvites(): Promise<UserInviteToken[]> {
62
65
  return this.get('/invites');
63
66
  }
64
67
  /**
65
68
  * Fetch Invites for specific account or project
66
69
  * @param type Filter for the type of invitation, either "project" or "account"
67
- * @returns UserInviteTokenData[]
68
- * */
69
- listInvitation(type: 'project' | 'account' = 'project'): Promise<TransientToken<UserInviteTokenData>[]> {
70
+ */
71
+ listInvitation(type: 'project' | 'account' = 'project'): Promise<UserInviteToken[]> {
70
72
  return this.get(`/invites/${type}`);
71
73
  }
72
74
 
package/src/ApiKeysApi.ts CHANGED
@@ -4,9 +4,10 @@ import type {
4
4
  ApiKeyReadResponse,
5
5
  ApiKeyWithValue,
6
6
  AuthTokenResponse,
7
- CreateOrUpdateApiKeyPayload,
7
+ CreateApiKeyPayload,
8
8
  CreatePublicKeyPayload,
9
9
  DeleteOperationResult,
10
+ UpdateApiKeyPayload,
10
11
  } from '@vertesia/common';
11
12
 
12
13
  export class ApiKeysApi extends ApiTopic {
@@ -28,7 +29,7 @@ export class ApiKeysApi extends ApiTopic {
28
29
  * ALL REQUESTS ARE LOGGED IN SECURITY AUDIT LOG
29
30
  * @returns ApiKeyWithValue
30
31
  */
31
- create(payload: CreateOrUpdateApiKeyPayload): Promise<ApiKeyWithValue> {
32
+ create(payload: CreateApiKeyPayload): Promise<ApiKeyWithValue> {
32
33
  return this.post('/', { payload });
33
34
  }
34
35
 
@@ -36,7 +37,7 @@ export class ApiKeysApi extends ApiTopic {
36
37
  * Update an existing ApiKey for account
37
38
  * @returns ApiKey
38
39
  */
39
- update(id: string, payload: CreateOrUpdateApiKeyPayload): Promise<ApiKey> {
40
+ update(id: string, payload: UpdateApiKeyPayload): Promise<ApiKey> {
40
41
  return this.put(`/${id}`, { payload });
41
42
  }
42
43
 
package/src/AppsApi.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ApiTopic, type ClientBase, type ServerError } from '@vertesia/api-fetch-client';
2
2
  import type {
3
+ AppApiKeyCollectionParams,
3
4
  AppBuildProgress,
4
5
  AppDeleteSummary,
5
6
  AppDevelopmentTaskDetails,
@@ -26,9 +27,11 @@ import type {
26
27
  CountResult,
27
28
  CreateAppRepoBranchRequest,
28
29
  DeleteAppVersionResponse,
30
+ McpApiKeyStatus,
29
31
  ProjectRef,
30
32
  PromoteAppVersionResponse,
31
33
  RequireAtLeastOne,
34
+ SetMcpApiKeyRequest,
32
35
  StartAppBuildRequest,
33
36
  StartAppBuildResponse,
34
37
  StartAppScaffoldRequest,
@@ -64,6 +67,27 @@ export default class AppsApi extends ApiTopic {
64
67
  return this.del(`/${id}`);
65
68
  }
66
69
 
70
+ /**
71
+ * Store the API key of an MCP tool collection declared with `auth: 'api_key'`.
72
+ * The key is write-only: it is encrypted server-side and never returned by any endpoint,
73
+ * so the response carries only the configured flag and a masked hint.
74
+ */
75
+ setMcpCollectionApiKey(appId: string, collectionId: string, apiKey: string): Promise<McpApiKeyStatus> {
76
+ return this.put(`/${encodeURIComponent(appId)}/collections/${encodeURIComponent(collectionId)}/api-key`, {
77
+ payload: { api_key: apiKey } satisfies SetMcpApiKeyRequest,
78
+ });
79
+ }
80
+
81
+ /** Whether an MCP tool collection has an API key stored, with a masked hint for display. */
82
+ getMcpCollectionApiKeyStatus(appId: string, collectionId: string): Promise<McpApiKeyStatus> {
83
+ return this.get(`/${encodeURIComponent(appId)}/collections/${encodeURIComponent(collectionId)}/api-key`);
84
+ }
85
+
86
+ /** Remove the stored API key of an MCP tool collection. */
87
+ deleteMcpCollectionApiKey(appId: string, collectionId: string): Promise<McpApiKeyStatus> {
88
+ return this.del(`/${encodeURIComponent(appId)}/collections/${encodeURIComponent(collectionId)}/api-key`);
89
+ }
90
+
67
91
  /**
68
92
  * Cascade-delete an app and everything attached to it (versions,
69
93
  * installations + ACEs, git repo on the app-git server). Pass through
@@ -288,6 +312,7 @@ export default class AppsApi extends ApiTopic {
288
312
  settings?: Record<string, unknown>,
289
313
  oauthParams?: Record<string, { client_id?: string; client_secret?: string; scopes?: string[] }>,
290
314
  oauthProviderParams?: Record<string, { client_id?: string; client_secret?: string; scopes?: string[] }>,
315
+ apiKeyParams?: AppApiKeyCollectionParams,
291
316
  ): Promise<AppInstallation> {
292
317
  return this.post(`/install`, {
293
318
  payload: {
@@ -295,6 +320,7 @@ export default class AppsApi extends ApiTopic {
295
320
  settings,
296
321
  oauth_params: oauthParams,
297
322
  oauth_provider_params: oauthProviderParams,
323
+ api_key_params: apiKeyParams,
298
324
  } satisfies AppInstallationPayload,
299
325
  });
300
326
  }
@@ -5,11 +5,9 @@ import type {
5
5
  EmbeddingsApiResult,
6
6
  EnableEnvironmentModelPayload,
7
7
  ExecutionEnvironment,
8
+ ExecutionEnvironmentConfigUpdatePayload,
8
9
  ExecutionEnvironmentCreatePayload,
9
- ExecutionEnvironmentRef,
10
10
  ExecutionEnvironmentUpdatePayload,
11
- LoadBalancingEnvConfig,
12
- MediatorEnvConfig,
13
11
  MigrateInteractionsPayload,
14
12
  MigrateInteractionsResult,
15
13
  } from '@vertesia/common';
@@ -23,7 +21,7 @@ export default class EnvironmentsApi extends ApiTopic {
23
21
  * List all environments for the current project
24
22
  * @param all if true, list all environments, otherwise only the ones for the current project
25
23
  */
26
- list(all: boolean = false): Promise<ExecutionEnvironmentRef[]> {
24
+ list(all: boolean = false): Promise<ExecutionEnvironment[]> {
27
25
  const query = all ? { all: true } : undefined;
28
26
 
29
27
  return this.get('/', { query });
@@ -54,13 +52,7 @@ export default class EnvironmentsApi extends ApiTopic {
54
52
  * @param payload
55
53
  * @returns
56
54
  */
57
- updateConfig(
58
- id: string,
59
- payload: {
60
- enabled_models?: AIModel[];
61
- config?: MediatorEnvConfig | LoadBalancingEnvConfig;
62
- },
63
- ): Promise<ExecutionEnvironment> {
55
+ updateConfig(id: string, payload: ExecutionEnvironmentConfigUpdatePayload): Promise<ExecutionEnvironment> {
64
56
  return this.put(`/${id}/config`, {
65
57
  payload,
66
58
  });
package/src/GroupsApi.ts CHANGED
@@ -12,6 +12,8 @@ export interface GroupsQueryOptions {
12
12
  tags?: string[];
13
13
  limit?: number;
14
14
  offset?: number;
15
+ /** Only return groups usable in this project (org-wide + restricted-to-this-project). */
16
+ project?: string;
15
17
  [key: string]: string | string[] | number | undefined;
16
18
  }
17
19
 
@@ -5,6 +5,7 @@ import type {
5
5
  OAuthGrant,
6
6
  OAuthGrantListResponse,
7
7
  OAuthGrantRevokeResponse,
8
+ RevokeOAuthGrantQuery,
8
9
  } from '@vertesia/common';
9
10
 
10
11
  function toQueryRecord(query?: ListOAuthGrantsQuery): Record<string, string> | undefined {
@@ -32,7 +33,7 @@ export default class OAuthGrantsApi extends ApiTopic {
32
33
  return this.get(`/${grantId}`);
33
34
  }
34
35
 
35
- revoke(grantId: string, query?: { include_consent?: boolean }): Promise<OAuthGrantRevokeResponse> {
36
+ revoke(grantId: string, query?: RevokeOAuthGrantQuery): Promise<OAuthGrantRevokeResponse> {
36
37
  return this.del(`/${grantId}`, { query });
37
38
  }
38
39
 
@@ -30,7 +30,12 @@ export default class OAuthProvidersApi extends ApiTopic {
30
30
  return this.put(`/${id}`, { payload });
31
31
  }
32
32
 
33
- remove(id: string): Promise<void> {
33
+ /**
34
+ * `SuccessResponse`, not `void`: the endpoint has always returned `{ success: true }` and the
35
+ * document has always published it. Typing it as `void` meant a caller could not read the one
36
+ * field it sends without casting.
37
+ */
38
+ remove(id: string): Promise<SuccessResponse> {
34
39
  return this.del(`/${id}`);
35
40
  }
36
41
 
package/src/PromptsApi.ts CHANGED
@@ -1,29 +1,28 @@
1
- import type { PromptRole } from '@llumiverse/common';
2
1
  import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
3
2
  import type {
3
+ ComputedFacetResponse,
4
4
  ComputePromptFacetPayload,
5
5
  PromptSearchPayload,
6
6
  PromptSearchQuery,
7
7
  PromptTemplate,
8
8
  PromptTemplateCreatePayload,
9
9
  PromptTemplateForkPayload,
10
+ PromptTemplateInteractionsResponse,
10
11
  PromptTemplateRef,
11
12
  PromptTemplateUpdatePayload,
12
- TemplateType,
13
+ RenderPromptPayload,
14
+ RenderPromptResponse,
13
15
  } from '@vertesia/common';
14
16
 
15
- export interface ComputePromptFacetsResponse {
16
- role?: { _id: string; count: number }[];
17
- total?: { count: number }[];
18
- }
17
+ /**
18
+ * @deprecated Use `ComputedFacetResponse` from `@vertesia/common`, which is what the endpoint
19
+ * publishes. This restated the facet buckets in their pre-collapse shape: `total` is a number by
20
+ * the time the response is written, not a one-element array.
21
+ */
22
+ export type ComputePromptFacetsResponse = ComputedFacetResponse;
19
23
 
20
- export interface PromptRenderResponse {
21
- id: string;
22
- name: string;
23
- role: PromptRole;
24
- content_type: TemplateType;
25
- rendered: string;
26
- }
24
+ /** @deprecated Use `RenderPromptResponse` from `@vertesia/common`. */
25
+ export type PromptRenderResponse = RenderPromptResponse;
27
26
 
28
27
  export default class PromptsApi extends ApiTopic {
29
28
  constructor(parent: ClientBase) {
@@ -48,9 +47,9 @@ export default class PromptsApi extends ApiTopic {
48
47
  /**
49
48
  * Get the list of all prompt facets
50
49
  * @param payload query payload to filter facet search
51
- * @returns ComputePromptFacetsResponse[]
50
+ * @returns ComputedFacetResponse
52
51
  **/
53
- computeFacets(query: ComputePromptFacetPayload): Promise<ComputePromptFacetsResponse> {
52
+ computeFacets(query: ComputePromptFacetPayload): Promise<ComputedFacetResponse> {
54
53
  return this.post('/facets', {
55
54
  payload: query,
56
55
  });
@@ -125,7 +124,7 @@ export default class PromptsApi extends ApiTopic {
125
124
  * @throws 404 if not found
126
125
  * @throws 403 if the prompt is not in the current project
127
126
  */
128
- render(id: string, payload: object): Promise<PromptRenderResponse> {
127
+ render(id: string, payload: RenderPromptPayload): Promise<RenderPromptResponse> {
129
128
  return this.post(`/${id}/render`, {
130
129
  payload,
131
130
  });
@@ -153,7 +152,7 @@ export default class PromptsApi extends ApiTopic {
153
152
  /**
154
153
  * Retrieve list of interactions that use the prompt template
155
154
  */
156
- listInteractions(id: string): Promise<ListInteractionsResponse> {
155
+ listInteractions(id: string): Promise<PromptTemplateInteractionsResponse> {
157
156
  return this.get(`/${id}/interactions`);
158
157
  }
159
158
 
@@ -167,11 +166,9 @@ export default class PromptsApi extends ApiTopic {
167
166
  }
168
167
  }
169
168
 
170
- export interface ListInteractionsResponse {
171
- prompt: string;
172
- interactions: {
173
- id: string;
174
- name: string;
175
- versions: string[];
176
- }[];
177
- }
169
+ /**
170
+ * @deprecated Use `PromptTemplateInteractionsResponse` from `@vertesia/common`, which is what the
171
+ * endpoint publishes. This declared `versions: string[]`; the endpoint has always sent
172
+ * `[{ version: number }]`.
173
+ */
174
+ export type ListInteractionsResponse = PromptTemplateInteractionsResponse;
@@ -1,3 +1,4 @@
1
+ import { APP_VERSION_HEADER } from '@vertesia/common';
1
2
  import { afterEach, beforeEach, describe, expect, test, vi } from 'vitest';
2
3
  import { isTokenExpired, VertesiaClient } from './client.js';
3
4
 
@@ -145,6 +146,21 @@ describe('Test Vertesia Client', () => {
145
146
  expect(client.baseUrl).toBe('https://studio-server-production.api.becomposable.com');
146
147
  expect(client.storeUrl).toBe('https://zeno-server-production.api.becomposable.com');
147
148
  });
149
+
150
+ test('withAppVersion keeps Studio and Store requests pinned together', () => {
151
+ const client = new VertesiaClient({
152
+ serverUrl: 'https://studio-server-production.api.becomposable.com',
153
+ storeUrl: 'https://zeno-server-production.api.becomposable.com',
154
+ });
155
+
156
+ expect(client.withAppVersion('candidate-v1')).toBe(client);
157
+ expect(client.headers[APP_VERSION_HEADER]).toBe('candidate-v1');
158
+ expect(client.store.headers[APP_VERSION_HEADER]).toBe('candidate-v1');
159
+
160
+ client.withAppVersion(null);
161
+ expect(client.headers[APP_VERSION_HEADER]).toBeUndefined();
162
+ expect(client.store.headers[APP_VERSION_HEADER]).toBeUndefined();
163
+ });
148
164
  });
149
165
 
150
166
  describe('isTokenExpired', () => {
package/src/client.ts CHANGED
@@ -248,6 +248,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
248
248
  * exact built version instead of the promoted version. Pass null/empty to clear (→ promoted).
249
249
  */
250
250
  withAppVersion(version: string | null | undefined) {
251
+ this.store.withAppVersion(version);
251
252
  if (!version) {
252
253
  delete this.headers[APP_VERSION_HEADER];
253
254
  } else {