@vertesia/client 1.5.0-dev.20260804.124748Z → 1.5.0-dev.20260807.073259Z

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 (119) hide show
  1. package/lib/AccountApi.d.ts.map +1 -1
  2. package/lib/AccountApi.js.map +1 -1
  3. package/lib/AccountsApi.d.ts.map +1 -1
  4. package/lib/AnalyticsApi.d.ts.map +1 -1
  5. package/lib/ApiKeysApi.d.ts.map +1 -1
  6. package/lib/ApiKeysApi.js.map +1 -1
  7. package/lib/AppsApi.d.ts +12 -2
  8. package/lib/AppsApi.d.ts.map +1 -1
  9. package/lib/AppsApi.js +20 -1
  10. package/lib/AppsApi.js.map +1 -1
  11. package/lib/AuditTrailApi.d.ts.map +1 -1
  12. package/lib/CommandsApi.d.ts.map +1 -1
  13. package/lib/EnvironmentsApi.d.ts.map +1 -1
  14. package/lib/EnvironmentsApi.js.map +1 -1
  15. package/lib/GroupsApi.d.ts.map +1 -1
  16. package/lib/IamApi.d.ts.map +1 -1
  17. package/lib/InteractionBase.d.ts +195 -171
  18. package/lib/InteractionBase.d.ts.map +1 -1
  19. package/lib/InteractionBase.js.map +1 -1
  20. package/lib/InteractionCatalogApi.d.ts.map +1 -1
  21. package/lib/InteractionCatalogApi.js.map +1 -1
  22. package/lib/InteractionOutput.d.ts.map +1 -1
  23. package/lib/InteractionOutput.js.map +1 -1
  24. package/lib/InteractionsApi.d.ts.map +1 -1
  25. package/lib/InteractionsApi.js.map +1 -1
  26. package/lib/InternalSecretsApi.d.ts.map +1 -1
  27. package/lib/OAuthClientsApi.d.ts.map +1 -1
  28. package/lib/OAuthGrantsApi.d.ts.map +1 -1
  29. package/lib/OAuthProvidersApi.d.ts.map +1 -1
  30. package/lib/OAuthServerApi.d.ts.map +1 -1
  31. package/lib/OAuthServerApi.js.map +1 -1
  32. package/lib/ProjectsApi.d.ts.map +1 -1
  33. package/lib/PromptsApi.d.ts.map +1 -1
  34. package/lib/PromptsApi.js.map +1 -1
  35. package/lib/QuotaApi.d.ts.map +1 -1
  36. package/lib/RefsApi.d.ts.map +1 -1
  37. package/lib/RemoteMcpConnectionsApi.d.ts.map +1 -1
  38. package/lib/RunsApi.d.ts.map +1 -1
  39. package/lib/SecretsApi.d.ts.map +1 -1
  40. package/lib/SkillsApi.d.ts.map +1 -1
  41. package/lib/StreamSource.d.ts.map +1 -1
  42. package/lib/StreamSource.js.map +1 -1
  43. package/lib/ToolsApi.d.ts.map +1 -1
  44. package/lib/TrainingApi.d.ts.map +1 -1
  45. package/lib/TrainingApi.js.map +1 -1
  46. package/lib/UsersApi.d.ts.map +1 -1
  47. package/lib/ViewsApi.d.ts.map +1 -1
  48. package/lib/ViewsApi.js.map +1 -1
  49. package/lib/client.d.ts +1 -1
  50. package/lib/client.d.ts.map +1 -1
  51. package/lib/client.js +1 -0
  52. package/lib/client.js.map +1 -1
  53. package/lib/execute.js.map +1 -1
  54. package/lib/managed-sse.js +1 -1
  55. package/lib/managed-sse.js.map +1 -1
  56. package/lib/nodejs/NodeStreamSource.d.ts.map +1 -1
  57. package/lib/store/AgentsApi.d.ts.map +1 -1
  58. package/lib/store/AgentsApi.js.map +1 -1
  59. package/lib/store/AnalyzeDocApi.d.ts.map +1 -1
  60. package/lib/store/AnalyzeDocApi.js.map +1 -1
  61. package/lib/store/CollectionsApi.d.ts.map +1 -1
  62. package/lib/store/CollectionsApi.js.map +1 -1
  63. package/lib/store/CostApi.d.ts.map +1 -1
  64. package/lib/store/CostApi.js.map +1 -1
  65. package/lib/store/DashboardApi.d.ts.map +1 -1
  66. package/lib/store/DataApi.d.ts.map +1 -1
  67. package/lib/store/EmailApi.d.ts.map +1 -1
  68. package/lib/store/EmbeddingsApi.d.ts.map +1 -1
  69. package/lib/store/EmbeddingsApi.js.map +1 -1
  70. package/lib/store/EventIngestChannelsApi.d.ts.map +1 -1
  71. package/lib/store/EventSubscriptionsApi.d.ts.map +1 -1
  72. package/lib/store/EventsApi.d.ts +2 -1
  73. package/lib/store/EventsApi.d.ts.map +1 -1
  74. package/lib/store/EventsApi.js +3 -0
  75. package/lib/store/EventsApi.js.map +1 -1
  76. package/lib/store/FilesApi.d.ts +4 -0
  77. package/lib/store/FilesApi.d.ts.map +1 -1
  78. package/lib/store/FilesApi.js +48 -23
  79. package/lib/store/FilesApi.js.map +1 -1
  80. package/lib/store/HiveMemoryApi.d.ts.map +1 -1
  81. package/lib/store/IndexingApi.d.ts.map +1 -1
  82. package/lib/store/IndexingApi.js.map +1 -1
  83. package/lib/store/ObjectsApi.d.ts.map +1 -1
  84. package/lib/store/ObjectsApi.js.map +1 -1
  85. package/lib/store/PendingAsksApi.d.ts.map +1 -1
  86. package/lib/store/ProcessApi.d.ts.map +1 -1
  87. package/lib/store/QueryApi.d.ts.map +1 -1
  88. package/lib/store/QueryApi.js.map +1 -1
  89. package/lib/store/RenderingApi.d.ts.map +1 -1
  90. package/lib/store/RenderingApi.js.map +1 -1
  91. package/lib/store/SchedulesApi.d.ts.map +1 -1
  92. package/lib/store/TaskApi.d.ts.map +1 -1
  93. package/lib/store/TaskApi.js.map +1 -1
  94. package/lib/store/TypeCatalogApi.d.ts.map +1 -1
  95. package/lib/store/TypeCatalogApi.js.map +1 -1
  96. package/lib/store/TypesApi.d.ts.map +1 -1
  97. package/lib/store/TypesApi.js.map +1 -1
  98. package/lib/store/ViewsApi.d.ts.map +1 -1
  99. package/lib/store/ViewsApi.js.map +1 -1
  100. package/lib/store/WorkflowsApi.d.ts.map +1 -1
  101. package/lib/store/WorkflowsApi.js.map +1 -1
  102. package/lib/store/client.d.ts.map +1 -1
  103. package/lib/store/client.js.map +1 -1
  104. package/lib/store/errors.d.ts.map +1 -1
  105. package/lib/store/signed-url.js.map +1 -1
  106. package/lib/store/version.d.ts +1 -2
  107. package/lib/store/version.d.ts.map +1 -1
  108. package/lib/store/version.js +3 -4
  109. package/lib/store/version.js.map +1 -1
  110. package/lib/vertesia-client.js +10 -10
  111. package/lib/vertesia-client.js.map +1 -1
  112. package/package.json +6 -6
  113. package/src/AppsApi.ts +26 -0
  114. package/src/client.test.ts +16 -0
  115. package/src/client.ts +1 -0
  116. package/src/store/EventsApi.ts +8 -0
  117. package/src/store/FilesApi.test.ts +37 -1
  118. package/src/store/FilesApi.ts +49 -20
  119. package/src/store/version.ts +7 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/client",
3
- "version": "1.5.0-dev.20260804.124748Z",
3
+ "version": "1.5.0-dev.20260807.073259Z",
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.20260804.122431Z",
23
- "@vertesia/common": "1.5.0-dev.20260804.124748Z",
24
- "@vertesia/api-fetch-client": "1.5.0-dev.20260804.124748Z"
22
+ "@vertesia/api-fetch-client": "1.5.0-dev.20260807.073259Z",
23
+ "@vertesia/common": "1.5.0-dev.20260807.073259Z",
24
+ "@llumiverse/common": "1.5.0-dev.20260807.072147Z"
25
25
  },
26
26
  "exports": {
27
27
  ".": {
@@ -48,7 +48,7 @@
48
48
  "ai",
49
49
  "typescript"
50
50
  ],
51
- "gitHead": "87ac9166db2b38bd1be6e37adf0414ea83e402ee",
51
+ "gitHead": "e6ebc1482ad6c4df965d74c79f82eb25fc6e2ce3",
52
52
  "scripts": {
53
53
  "lint": "biome lint src",
54
54
  "clean:lib": "rimraf ./lib ./tsconfig.tsbuildinfo",
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
  }
@@ -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 {
@@ -1,5 +1,7 @@
1
1
  import { ApiTopic, type ClientBase } from '@vertesia/api-fetch-client';
2
2
  import type {
3
+ CancelEventDeliveryIntentsPayload,
4
+ CancelEventDeliveryIntentsResponse,
3
5
  EventDeliveryQueueSummaryPayload,
4
6
  EventDeliveryQueueSummaryResponse,
5
7
  EventDeliveryStreamEnvelope,
@@ -46,6 +48,12 @@ export class EventsApi extends ApiTopic {
46
48
  return this.post('/deliveries/queue-summary', { payload });
47
49
  }
48
50
 
51
+ cancelQueuedDeliveries(
52
+ payload: CancelEventDeliveryIntentsPayload = {},
53
+ ): Promise<CancelEventDeliveryIntentsResponse> {
54
+ return this.post('/deliveries/cancel', { payload });
55
+ }
56
+
49
57
  subscribeDeliveries(options: SubscribeEventDeliveriesOptions): ManagedEventSourceConnection {
50
58
  const { signal, max_reconnect_attempts, on_snapshot, on_delivery, on_envelope, on_error, on_status, ...query } =
51
59
  options;
@@ -1,7 +1,12 @@
1
- import { describe, expect, it } from 'vitest';
1
+ import { afterEach, describe, expect, it, vi } from 'vitest';
2
2
  import { ZenoClient } from './client.js';
3
3
 
4
4
  describe('FilesApi', () => {
5
+ afterEach(() => {
6
+ vi.restoreAllMocks();
7
+ vi.unstubAllGlobals();
8
+ });
9
+
5
10
  it('retries signed upload URL creation after a transient connection failure', async () => {
6
11
  let attempts = 0;
7
12
  const fetchSignedUploadUrl = async (): Promise<Response> => {
@@ -66,4 +71,35 @@ describe('FilesApi', () => {
66
71
  expect(result).toEqual({ id: 'file-1', path: 'agents/run/conversation.json', url: 'https://signed' });
67
72
  expect(attempts).toBe(2);
68
73
  });
74
+
75
+ it('does not expose a signed URL when a file download returns 404', async () => {
76
+ const signedUrl =
77
+ 'https://storage.googleapis.com/test-bucket/agents/run/files/missing.png?X-Goog-Credential=secret&X-Goog-Signature=do-not-log';
78
+ const fetchDownloadUrl = (): Promise<Response> =>
79
+ Promise.resolve(
80
+ new Response(JSON.stringify({ url: signedUrl }), {
81
+ status: 200,
82
+ headers: { 'content-type': 'application/json' },
83
+ }),
84
+ );
85
+ vi.stubGlobal('fetch', vi.fn().mockResolvedValue(new Response(null, { status: 404, statusText: 'Not Found' })));
86
+ const consoleError = vi.spyOn(console, 'error').mockImplementation(() => undefined);
87
+ const client = new ZenoClient({
88
+ serverUrl: 'https://store.test',
89
+ apikey: 'token',
90
+ fetch: fetchDownloadUrl,
91
+ });
92
+
93
+ const error = await client.files.downloadFile('agents/run/files/missing.png').catch((cause: unknown) => cause);
94
+
95
+ expect(error).toMatchObject({
96
+ name: 'FileDownloadError',
97
+ status: 404,
98
+ message: 'File download not found: agents/run/files/missing.png',
99
+ });
100
+ expect(String(error)).not.toContain('X-Goog-Credential');
101
+ expect(String(error)).not.toContain('X-Goog-Signature');
102
+ expect(String(error)).not.toContain('do-not-log');
103
+ expect(consoleError).not.toHaveBeenCalled();
104
+ });
69
105
  });
@@ -28,6 +28,44 @@ const FILE_SIGNING_RETRY_POLICY: IRequestRetryPolicy = {
28
28
  statuses: [502, 503, 504],
29
29
  };
30
30
 
31
+ function fileLocationForError(location: string): string {
32
+ try {
33
+ const url = new URL(location);
34
+ return `${url.protocol}//${url.host}${url.pathname}`;
35
+ } catch {
36
+ return location.split(/[?#]/, 1)[0] || 'unknown file';
37
+ }
38
+ }
39
+
40
+ function sanitizedErrorCause(error: unknown): Error | undefined {
41
+ if (!(error instanceof Error)) {
42
+ return undefined;
43
+ }
44
+ const message = error.message.replace(/https?:\/\/[^\s)\]}>"']+/g, (url) => fileLocationForError(url));
45
+ const cause = new Error(message);
46
+ cause.name = error.name;
47
+ return cause;
48
+ }
49
+
50
+ function fileDownloadFailureReason(status?: number, statusText?: string): string {
51
+ if (status === 404) return 'not found';
52
+ if (status === 403) return 'forbidden';
53
+ if (status) return `failed with status ${status}${statusText ? ` ${statusText}` : ''}`;
54
+ return 'failed';
55
+ }
56
+
57
+ export class FileDownloadError extends Error {
58
+ readonly status?: number;
59
+
60
+ constructor(location: string, status?: number, statusText?: string, cause?: unknown) {
61
+ const safeLocation = fileLocationForError(location);
62
+ const reason = fileDownloadFailureReason(status, statusText);
63
+ super(`File download ${reason}: ${safeLocation}`, { cause: sanitizedErrorCause(cause) });
64
+ this.name = 'FileDownloadError';
65
+ this.status = status;
66
+ }
67
+ }
68
+
31
69
  export function getMemoryFilePath(name: string) {
32
70
  const nameWithExt = name.endsWith('.tar.gz') ? name : `${name}.tar.gz`;
33
71
  return `${MEMORIES_PREFIX}/${nameWithExt}`;
@@ -229,28 +267,19 @@ export class FilesApi extends ApiTopic {
229
267
  const needSign = !location.startsWith('https:');
230
268
  const { url } = needSign ? await this.getDownloadUrl(location) : { url: location };
231
269
 
232
- const res = await fetchSignedUrl(url, {
233
- method: 'GET',
234
- })
235
- .then((res: Response) => {
236
- if (res.ok) {
237
- return res;
238
- } else if (res.status === 404) {
239
- throw new Error(`File at ${url} not found`); //TODO: type fetch error better with a fetch error class
240
- } else if (res.status === 403) {
241
- throw new Error(`File at ${url} is forbidden`);
242
- } else {
243
- console.log(res);
244
- throw new Error(`Failed to download file ${location}: ${res.statusText}`);
245
- }
246
- })
247
- .catch((err) => {
248
- console.error(`Failed to download file ${location}.`, err);
249
- throw err;
250
- });
270
+ let res: Response;
271
+ try {
272
+ res = await fetchSignedUrl(url, { method: 'GET' });
273
+ } catch (error: unknown) {
274
+ throw new FileDownloadError(location, undefined, undefined, error);
275
+ }
276
+
277
+ if (!res.ok) {
278
+ throw new FileDownloadError(location, res.status, res.statusText);
279
+ }
251
280
 
252
281
  if (!res.body) {
253
- throw new Error(`No body in response while downloading file ${location}`);
282
+ throw new FileDownloadError(location);
254
283
  }
255
284
 
256
285
  return res.body;
@@ -1,4 +1,7 @@
1
- export const VERSION = '20260319'; // YYYYMMDD, client versioning for API endpoints. Increment manually for breaking changes
2
- // Re-exported, not redeclared: the servers read the same constant when deciding how strictly to
3
- // hold a request to its schema, so a name only this side knew could not stay a negotiation.
4
- export { APP_VERSION_HEADER, VERSION_HEADER } from '@vertesia/common';
1
+ // Preserve the public client export while sourcing its value from the same module as the servers
2
+ // and OpenAPI generator.
3
+ export {
4
+ APP_VERSION_HEADER,
5
+ CURRENT_API_VERSION_HEADER_VALUE as VERSION,
6
+ VERSION_HEADER,
7
+ } from '@vertesia/common';