@vertesia/client 0.80.0-dev-20251118 → 0.80.0

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 (96) hide show
  1. package/README.md +110 -0
  2. package/lib/cjs/InteractionsApi.js +12 -0
  3. package/lib/cjs/InteractionsApi.js.map +1 -1
  4. package/lib/cjs/ProjectsApi.js +6 -2
  5. package/lib/cjs/ProjectsApi.js.map +1 -1
  6. package/lib/cjs/SkillsApi.js +39 -0
  7. package/lib/cjs/SkillsApi.js.map +1 -0
  8. package/lib/cjs/client.js +7 -8
  9. package/lib/cjs/client.js.map +1 -1
  10. package/lib/cjs/index.js +0 -5
  11. package/lib/cjs/index.js.map +1 -1
  12. package/lib/cjs/store/CollectionsApi.js +9 -0
  13. package/lib/cjs/store/CollectionsApi.js.map +1 -1
  14. package/lib/cjs/store/FilesApi.js +78 -1
  15. package/lib/cjs/store/FilesApi.js.map +1 -1
  16. package/lib/cjs/store/ObjectsApi.js +1 -0
  17. package/lib/cjs/store/ObjectsApi.js.map +1 -1
  18. package/lib/cjs/store/index.js +1 -0
  19. package/lib/cjs/store/index.js.map +1 -1
  20. package/lib/esm/InteractionsApi.js +12 -0
  21. package/lib/esm/InteractionsApi.js.map +1 -1
  22. package/lib/esm/ProjectsApi.js +6 -1
  23. package/lib/esm/ProjectsApi.js.map +1 -1
  24. package/lib/esm/SkillsApi.js +36 -0
  25. package/lib/esm/SkillsApi.js.map +1 -0
  26. package/lib/esm/client.js +6 -7
  27. package/lib/esm/client.js.map +1 -1
  28. package/lib/esm/index.js +0 -2
  29. package/lib/esm/index.js.map +1 -1
  30. package/lib/esm/store/CollectionsApi.js +9 -0
  31. package/lib/esm/store/CollectionsApi.js.map +1 -1
  32. package/lib/esm/store/FilesApi.js +76 -0
  33. package/lib/esm/store/FilesApi.js.map +1 -1
  34. package/lib/esm/store/ObjectsApi.js +1 -0
  35. package/lib/esm/store/ObjectsApi.js.map +1 -1
  36. package/lib/esm/store/index.js +1 -0
  37. package/lib/esm/store/index.js.map +1 -1
  38. package/lib/tsconfig.tsbuildinfo +1 -1
  39. package/lib/types/AccountApi.d.ts +0 -1
  40. package/lib/types/AccountsApi.d.ts +0 -1
  41. package/lib/types/AnalyticsApi.d.ts +0 -1
  42. package/lib/types/ApiKeysApi.d.ts +0 -1
  43. package/lib/types/AppsApi.d.ts +0 -1
  44. package/lib/types/CommandsApi.d.ts +0 -1
  45. package/lib/types/EnvironmentsApi.d.ts +0 -1
  46. package/lib/types/GroupsApi.d.ts +0 -1
  47. package/lib/types/IamApi.d.ts +0 -1
  48. package/lib/types/InteractionBase.d.ts +0 -1
  49. package/lib/types/InteractionCatalogApi.d.ts +0 -1
  50. package/lib/types/InteractionOutput.d.ts +0 -1
  51. package/lib/types/InteractionResult.example.d.ts +0 -1
  52. package/lib/types/InteractionsApi.d.ts +7 -2
  53. package/lib/types/InteractionsApi.d.ts.map +1 -1
  54. package/lib/types/ProjectsApi.d.ts +3 -3
  55. package/lib/types/ProjectsApi.d.ts.map +1 -1
  56. package/lib/types/PromptsApi.d.ts +0 -1
  57. package/lib/types/RefsApi.d.ts +0 -1
  58. package/lib/types/RunsApi.d.ts +0 -1
  59. package/lib/types/SkillsApi.d.ts +26 -0
  60. package/lib/types/SkillsApi.d.ts.map +1 -0
  61. package/lib/types/StreamSource.d.ts +0 -1
  62. package/lib/types/TrainingApi.d.ts +0 -1
  63. package/lib/types/UsersApi.d.ts +0 -1
  64. package/lib/types/client.d.ts +4 -3
  65. package/lib/types/client.d.ts.map +1 -1
  66. package/lib/types/execute.d.ts +0 -1
  67. package/lib/types/index.d.ts +2 -5
  68. package/lib/types/index.d.ts.map +1 -1
  69. package/lib/types/nodejs/NodeStreamSource.d.ts +0 -1
  70. package/lib/types/nodejs/index.d.ts +0 -1
  71. package/lib/types/store/AgentsApi.d.ts +0 -1
  72. package/lib/types/store/AnalyzeDocApi.d.ts +0 -1
  73. package/lib/types/store/CollectionsApi.d.ts +11 -3
  74. package/lib/types/store/CollectionsApi.d.ts.map +1 -1
  75. package/lib/types/store/CommandsApi.d.ts +0 -1
  76. package/lib/types/store/EmbeddingsApi.d.ts +0 -1
  77. package/lib/types/store/FilesApi.d.ts +55 -1
  78. package/lib/types/store/FilesApi.d.ts.map +1 -1
  79. package/lib/types/store/ObjectsApi.d.ts +0 -1
  80. package/lib/types/store/ObjectsApi.d.ts.map +1 -1
  81. package/lib/types/store/TypesApi.d.ts +0 -1
  82. package/lib/types/store/WorkflowsApi.d.ts +0 -1
  83. package/lib/types/store/client.d.ts +0 -1
  84. package/lib/types/store/errors.d.ts +0 -1
  85. package/lib/types/store/index.d.ts +1 -1
  86. package/lib/types/store/index.d.ts.map +1 -1
  87. package/lib/types/store/version.d.ts +0 -1
  88. package/lib/vertesia-client.js +1 -1
  89. package/lib/vertesia-client.js.map +1 -1
  90. package/package.json +68 -59
  91. package/src/InteractionsApi.ts +14 -1
  92. package/src/SkillsApi.ts +46 -0
  93. package/src/client.ts +5 -6
  94. package/src/store/FilesApi.ts +93 -0
  95. package/src/store/ObjectsApi.ts +1 -0
  96. package/src/store/index.ts +1 -0
package/src/client.ts CHANGED
@@ -10,6 +10,7 @@ import EnvironmentsApi from "./EnvironmentsApi.js";
10
10
  import { IamApi } from "./IamApi.js";
11
11
  import InteractionsApi from "./InteractionsApi.js";
12
12
  import ProjectsApi from "./ProjectsApi.js";
13
+ import SkillsApi from "./SkillsApi.js";
13
14
  import PromptsApi from "./PromptsApi.js";
14
15
  import { RefsApi } from "./RefsApi.js";
15
16
  import { RunsApi } from "./RunsApi.js";
@@ -138,16 +139,13 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
138
139
  // zeno-server-production.api.vertesia.io -> sts.vertesia.io
139
140
  this.tokenServerUrl = "https://sts.vertesia.io";
140
141
  } else if (url.hostname.includes("-preview.")) {
141
- // zeno-server-preview.api.vertesia.io -> sts-preview.vertesia.io
142
- this.tokenServerUrl = "https://sts-preview.vertesia.io";
142
+ // zeno-server-preview.api.vertesia.io -> sts.vertesia.io
143
+ this.tokenServerUrl = "https://sts.vertesia.io";
143
144
  } else if (url.hostname === "api.vertesia.io") {
144
- // api.vertesia.io -> sts.vertesia.io
145
145
  this.tokenServerUrl = "https://sts.vertesia.io";
146
146
  } else if (url.hostname === "api-preview.vertesia.io") {
147
- // api-preview.vertesia.io -> sts-preview.vertesia.io
148
- this.tokenServerUrl = "https://sts-preview.vertesia.io";
147
+ this.tokenServerUrl = "https://sts.vertesia.io";
149
148
  } else if (url.hostname === "api-staging.vertesia.io") {
150
- // api-staging.vertesia.io -> sts-staging.vertesia.io
151
149
  this.tokenServerUrl = "https://sts-staging.vertesia.io";
152
150
  } else if (url.hostname.startsWith("api")) {
153
151
  // Generic api.* pattern replacement
@@ -310,6 +308,7 @@ export class VertesiaClient extends AbstractFetchClient<VertesiaClient> {
310
308
  projects = new ProjectsApi(this);
311
309
  environments = new EnvironmentsApi(this);
312
310
  interactions = new InteractionsApi(this);
311
+ skills = new SkillsApi(this);
313
312
  prompts = new PromptsApi(this);
314
313
  runs = new RunsApi(this);
315
314
  account = new AccountApi(this);
@@ -3,16 +3,27 @@ import {
3
3
  GetFileUrlPayload,
4
4
  GetFileUrlResponse,
5
5
  GetUploadUrlPayload,
6
+ SetFileMetadataPayload,
6
7
  } from "@vertesia/common";
7
8
  import { StreamSource } from "../StreamSource.js";
8
9
 
9
10
  export const MEMORIES_PREFIX = "memories";
11
+ export const ARTIFACTS_PREFIX = "agents";
10
12
 
11
13
  export function getMemoryFilePath(name: string) {
12
14
  const nameWithExt = name.endsWith(".tar.gz") ? name : name + ".tar.gz";
13
15
  return `${MEMORIES_PREFIX}/${nameWithExt}`;
14
16
  }
15
17
 
18
+ /**
19
+ * Build the storage path for an agent artifact
20
+ * @param runId - The workflow run ID
21
+ * @param name - The artifact filename
22
+ */
23
+ export function getAgentArtifactPath(runId: string, name: string): string {
24
+ return `${ARTIFACTS_PREFIX}/${runId}/${name}`;
25
+ }
26
+
16
27
  export class FilesApi extends ApiTopic {
17
28
  constructor(parent: ClientBase) {
18
29
  super(parent, "/api/v1/files");
@@ -36,6 +47,7 @@ export class FilesApi extends ApiTopic {
36
47
  contentType: string;
37
48
  contentDisposition?: string;
38
49
  etag?: string;
50
+ customMetadata?: Record<string, string>;
39
51
  }> {
40
52
  return this.get("/metadata", {
41
53
  query: {
@@ -44,6 +56,17 @@ export class FilesApi extends ApiTopic {
44
56
  });
45
57
  }
46
58
 
59
+ /**
60
+ * Set custom metadata on a file
61
+ * @param file - The file path or URI
62
+ * @param metadata - Custom metadata key-value pairs
63
+ * @returns Success status
64
+ */
65
+ setFileMetadata(file: string, metadata: Record<string, string>): Promise<{ success: boolean; file: string }> {
66
+ const payload: SetFileMetadataPayload = { file, metadata };
67
+ return this.put("/metadata", { payload });
68
+ }
69
+
47
70
  /**
48
71
  * Get or create a bucket for the project. If the bucket already exists, it does nothing.
49
72
  * The bucket URI is returned.
@@ -179,4 +202,74 @@ export class FilesApi extends ApiTopic {
179
202
  }
180
203
  return stream;
181
204
  }
205
+
206
+ // ==================== Agent Artifact Methods ====================
207
+
208
+ /**
209
+ * List files by prefix
210
+ * @param prefix - Path prefix to filter files
211
+ * @returns Array of file paths matching the prefix
212
+ */
213
+ listByPrefix(prefix: string): Promise<{ files: string[] }> {
214
+ return this.get("/list", { query: { prefix } });
215
+ }
216
+
217
+ /**
218
+ * Upload an artifact for an agent run
219
+ * @param runId - The workflow run ID
220
+ * @param name - Artifact name (e.g., "output.json")
221
+ * @param source - File content source
222
+ * @returns The full path of the uploaded artifact
223
+ */
224
+ async uploadArtifact(runId: string, name: string, source: StreamSource | File): Promise<string> {
225
+ const artifactPath = getAgentArtifactPath(runId, name);
226
+ if (source instanceof File) {
227
+ const file = source as File;
228
+ return this.uploadFile(
229
+ new StreamSource(file.stream(), name, file.type, artifactPath)
230
+ );
231
+ } else {
232
+ return this.uploadFile(
233
+ new StreamSource(source.stream, name, source.type, artifactPath)
234
+ );
235
+ }
236
+ }
237
+
238
+ /**
239
+ * Download an artifact from an agent run
240
+ * @param runId - The workflow run ID
241
+ * @param name - Artifact name
242
+ * @returns ReadableStream of the artifact content
243
+ */
244
+ async downloadArtifact(runId: string, name: string): Promise<ReadableStream<Uint8Array>> {
245
+ const artifactPath = getAgentArtifactPath(runId, name);
246
+ return this.downloadFile(artifactPath);
247
+ }
248
+
249
+ /**
250
+ * Get download URL for an artifact
251
+ * @param runId - The workflow run ID
252
+ * @param name - Artifact name
253
+ * @param disposition - Content disposition (inline or attachment)
254
+ * @returns Signed URL response
255
+ */
256
+ getArtifactDownloadUrl(
257
+ runId: string,
258
+ name: string,
259
+ disposition?: "inline" | "attachment"
260
+ ): Promise<GetFileUrlResponse> {
261
+ const artifactPath = getAgentArtifactPath(runId, name);
262
+ return this.getDownloadUrl(artifactPath, name, disposition);
263
+ }
264
+
265
+ /**
266
+ * List artifacts for an agent run
267
+ * @param runId - The workflow run ID
268
+ * @returns Array of artifact file paths
269
+ */
270
+ async listArtifacts(runId: string): Promise<string[]> {
271
+ const prefix = `${ARTIFACTS_PREFIX}/${runId}/`;
272
+ const result = await this.listByPrefix(prefix);
273
+ return result.files;
274
+ }
182
275
  }
@@ -364,6 +364,7 @@ export class ObjectsApi extends ApiTopic {
364
364
  max_hw: options.max_hw,
365
365
  generate_if_missing: options.generate_if_missing,
366
366
  sign_url: options.sign_url,
367
+ block_on_generation: options.block_on_generation,
367
368
  };
368
369
 
369
370
  return this.get(`/${documentId}/renditions/${options.format}`, {
@@ -1,5 +1,6 @@
1
1
  export * from "./client.js";
2
2
  export * from "./CommandsApi.js";
3
+ export * from "./FilesApi.js";
3
4
  export * from "./ObjectsApi.js";
4
5
  export * from "./TypesApi.js";
5
6
  export * from "./WorkflowsApi.js";