@vertesia/client 0.24.0-dev.202601221707

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 (339) hide show
  1. package/LICENSE +13 -0
  2. package/README.md +110 -0
  3. package/lib/cjs/AccountApi.js +85 -0
  4. package/lib/cjs/AccountApi.js.map +1 -0
  5. package/lib/cjs/AccountsApi.js +16 -0
  6. package/lib/cjs/AccountsApi.js.map +1 -0
  7. package/lib/cjs/AnalyticsApi.js +41 -0
  8. package/lib/cjs/AnalyticsApi.js.map +1 -0
  9. package/lib/cjs/ApiKeysApi.js +63 -0
  10. package/lib/cjs/ApiKeysApi.js.map +1 -0
  11. package/lib/cjs/AppsApi.js +119 -0
  12. package/lib/cjs/AppsApi.js.map +1 -0
  13. package/lib/cjs/CommandsApi.js +19 -0
  14. package/lib/cjs/CommandsApi.js.map +1 -0
  15. package/lib/cjs/EnvironmentsApi.js +72 -0
  16. package/lib/cjs/EnvironmentsApi.js.map +1 -0
  17. package/lib/cjs/GroupsApi.js +78 -0
  18. package/lib/cjs/GroupsApi.js.map +1 -0
  19. package/lib/cjs/IamApi.js +53 -0
  20. package/lib/cjs/IamApi.js.map +1 -0
  21. package/lib/cjs/InteractionBase.js +44 -0
  22. package/lib/cjs/InteractionBase.js.map +1 -0
  23. package/lib/cjs/InteractionCatalogApi.js +64 -0
  24. package/lib/cjs/InteractionCatalogApi.js.map +1 -0
  25. package/lib/cjs/InteractionOutput.js +300 -0
  26. package/lib/cjs/InteractionOutput.js.map +1 -0
  27. package/lib/cjs/InteractionResult.example.js +57 -0
  28. package/lib/cjs/InteractionResult.example.js.map +1 -0
  29. package/lib/cjs/InteractionsApi.js +262 -0
  30. package/lib/cjs/InteractionsApi.js.map +1 -0
  31. package/lib/cjs/MCPOAuthApi.js +62 -0
  32. package/lib/cjs/MCPOAuthApi.js.map +1 -0
  33. package/lib/cjs/ProjectsApi.js +72 -0
  34. package/lib/cjs/ProjectsApi.js.map +1 -0
  35. package/lib/cjs/PromptsApi.js +133 -0
  36. package/lib/cjs/PromptsApi.js.map +1 -0
  37. package/lib/cjs/RefsApi.js +14 -0
  38. package/lib/cjs/RefsApi.js.map +1 -0
  39. package/lib/cjs/RunsApi.js +113 -0
  40. package/lib/cjs/RunsApi.js.map +1 -0
  41. package/lib/cjs/SkillsApi.js +39 -0
  42. package/lib/cjs/SkillsApi.js.map +1 -0
  43. package/lib/cjs/StreamSource.js +17 -0
  44. package/lib/cjs/StreamSource.js.map +1 -0
  45. package/lib/cjs/TrainingApi.js +54 -0
  46. package/lib/cjs/TrainingApi.js.map +1 -0
  47. package/lib/cjs/UsersApi.js +13 -0
  48. package/lib/cjs/UsersApi.js.map +1 -0
  49. package/lib/cjs/client.js +360 -0
  50. package/lib/cjs/client.js.map +1 -0
  51. package/lib/cjs/execute.js +158 -0
  52. package/lib/cjs/execute.js.map +1 -0
  53. package/lib/cjs/index.js +22 -0
  54. package/lib/cjs/index.js.map +1 -0
  55. package/lib/cjs/nodejs/NodeStreamSource.js +45 -0
  56. package/lib/cjs/nodejs/NodeStreamSource.js.map +1 -0
  57. package/lib/cjs/nodejs/index.js +18 -0
  58. package/lib/cjs/nodejs/index.js.map +1 -0
  59. package/lib/cjs/package.json +3 -0
  60. package/lib/cjs/store/AnalyzeDocApi.js +56 -0
  61. package/lib/cjs/store/AnalyzeDocApi.js.map +1 -0
  62. package/lib/cjs/store/CollectionsApi.js +131 -0
  63. package/lib/cjs/store/CollectionsApi.js.map +1 -0
  64. package/lib/cjs/store/CommandsApi.js +17 -0
  65. package/lib/cjs/store/CommandsApi.js.map +1 -0
  66. package/lib/cjs/store/DashboardApi.js +182 -0
  67. package/lib/cjs/store/DashboardApi.js.map +1 -0
  68. package/lib/cjs/store/DataApi.js +433 -0
  69. package/lib/cjs/store/DataApi.js.map +1 -0
  70. package/lib/cjs/store/EmailApi.js +103 -0
  71. package/lib/cjs/store/EmailApi.js.map +1 -0
  72. package/lib/cjs/store/EmbeddingsApi.js +29 -0
  73. package/lib/cjs/store/EmbeddingsApi.js.map +1 -0
  74. package/lib/cjs/store/FilesApi.js +237 -0
  75. package/lib/cjs/store/FilesApi.js.map +1 -0
  76. package/lib/cjs/store/ObjectsApi.js +314 -0
  77. package/lib/cjs/store/ObjectsApi.js.map +1 -0
  78. package/lib/cjs/store/PendingAsksApi.js +43 -0
  79. package/lib/cjs/store/PendingAsksApi.js.map +1 -0
  80. package/lib/cjs/store/SchedulesApi.js +103 -0
  81. package/lib/cjs/store/SchedulesApi.js.map +1 -0
  82. package/lib/cjs/store/ToolsApi.js +21 -0
  83. package/lib/cjs/store/ToolsApi.js.map +1 -0
  84. package/lib/cjs/store/TypesApi.js +57 -0
  85. package/lib/cjs/store/TypesApi.js.map +1 -0
  86. package/lib/cjs/store/WorkersApi.js +16 -0
  87. package/lib/cjs/store/WorkersApi.js.map +1 -0
  88. package/lib/cjs/store/WorkflowsApi.js +596 -0
  89. package/lib/cjs/store/WorkflowsApi.js.map +1 -0
  90. package/lib/cjs/store/client.js +81 -0
  91. package/lib/cjs/store/client.js.map +1 -0
  92. package/lib/cjs/store/errors.js +11 -0
  93. package/lib/cjs/store/errors.js.map +1 -0
  94. package/lib/cjs/store/index.js +27 -0
  95. package/lib/cjs/store/index.js.map +1 -0
  96. package/lib/cjs/store/version.js +6 -0
  97. package/lib/cjs/store/version.js.map +1 -0
  98. package/lib/esm/AccountApi.js +82 -0
  99. package/lib/esm/AccountApi.js.map +1 -0
  100. package/lib/esm/AccountsApi.js +13 -0
  101. package/lib/esm/AccountsApi.js.map +1 -0
  102. package/lib/esm/AnalyticsApi.js +38 -0
  103. package/lib/esm/AnalyticsApi.js.map +1 -0
  104. package/lib/esm/ApiKeysApi.js +59 -0
  105. package/lib/esm/ApiKeysApi.js.map +1 -0
  106. package/lib/esm/AppsApi.js +116 -0
  107. package/lib/esm/AppsApi.js.map +1 -0
  108. package/lib/esm/CommandsApi.js +16 -0
  109. package/lib/esm/CommandsApi.js.map +1 -0
  110. package/lib/esm/EnvironmentsApi.js +69 -0
  111. package/lib/esm/EnvironmentsApi.js.map +1 -0
  112. package/lib/esm/GroupsApi.js +74 -0
  113. package/lib/esm/GroupsApi.js.map +1 -0
  114. package/lib/esm/IamApi.js +47 -0
  115. package/lib/esm/IamApi.js.map +1 -0
  116. package/lib/esm/InteractionBase.js +40 -0
  117. package/lib/esm/InteractionBase.js.map +1 -0
  118. package/lib/esm/InteractionCatalogApi.js +60 -0
  119. package/lib/esm/InteractionCatalogApi.js.map +1 -0
  120. package/lib/esm/InteractionOutput.js +293 -0
  121. package/lib/esm/InteractionOutput.js.map +1 -0
  122. package/lib/esm/InteractionResult.example.js +55 -0
  123. package/lib/esm/InteractionResult.example.js.map +1 -0
  124. package/lib/esm/InteractionsApi.js +259 -0
  125. package/lib/esm/InteractionsApi.js.map +1 -0
  126. package/lib/esm/MCPOAuthApi.js +59 -0
  127. package/lib/esm/MCPOAuthApi.js.map +1 -0
  128. package/lib/esm/ProjectsApi.js +69 -0
  129. package/lib/esm/ProjectsApi.js.map +1 -0
  130. package/lib/esm/PromptsApi.js +130 -0
  131. package/lib/esm/PromptsApi.js.map +1 -0
  132. package/lib/esm/RefsApi.js +10 -0
  133. package/lib/esm/RefsApi.js.map +1 -0
  134. package/lib/esm/RunsApi.js +109 -0
  135. package/lib/esm/RunsApi.js.map +1 -0
  136. package/lib/esm/SkillsApi.js +36 -0
  137. package/lib/esm/SkillsApi.js.map +1 -0
  138. package/lib/esm/StreamSource.js +13 -0
  139. package/lib/esm/StreamSource.js.map +1 -0
  140. package/lib/esm/TrainingApi.js +51 -0
  141. package/lib/esm/TrainingApi.js.map +1 -0
  142. package/lib/esm/UsersApi.js +10 -0
  143. package/lib/esm/UsersApi.js.map +1 -0
  144. package/lib/esm/client.js +351 -0
  145. package/lib/esm/client.js.map +1 -0
  146. package/lib/esm/execute.js +118 -0
  147. package/lib/esm/execute.js.map +1 -0
  148. package/lib/esm/index.js +6 -0
  149. package/lib/esm/index.js.map +1 -0
  150. package/lib/esm/nodejs/NodeStreamSource.js +41 -0
  151. package/lib/esm/nodejs/NodeStreamSource.js.map +1 -0
  152. package/lib/esm/nodejs/index.js +2 -0
  153. package/lib/esm/nodejs/index.js.map +1 -0
  154. package/lib/esm/store/AnalyzeDocApi.js +52 -0
  155. package/lib/esm/store/AnalyzeDocApi.js.map +1 -0
  156. package/lib/esm/store/CollectionsApi.js +127 -0
  157. package/lib/esm/store/CollectionsApi.js.map +1 -0
  158. package/lib/esm/store/CommandsApi.js +13 -0
  159. package/lib/esm/store/CommandsApi.js.map +1 -0
  160. package/lib/esm/store/DashboardApi.js +178 -0
  161. package/lib/esm/store/DashboardApi.js.map +1 -0
  162. package/lib/esm/store/DataApi.js +429 -0
  163. package/lib/esm/store/DataApi.js.map +1 -0
  164. package/lib/esm/store/EmailApi.js +99 -0
  165. package/lib/esm/store/EmailApi.js.map +1 -0
  166. package/lib/esm/store/EmbeddingsApi.js +25 -0
  167. package/lib/esm/store/EmbeddingsApi.js.map +1 -0
  168. package/lib/esm/store/FilesApi.js +231 -0
  169. package/lib/esm/store/FilesApi.js.map +1 -0
  170. package/lib/esm/store/ObjectsApi.js +309 -0
  171. package/lib/esm/store/ObjectsApi.js.map +1 -0
  172. package/lib/esm/store/PendingAsksApi.js +39 -0
  173. package/lib/esm/store/PendingAsksApi.js.map +1 -0
  174. package/lib/esm/store/SchedulesApi.js +99 -0
  175. package/lib/esm/store/SchedulesApi.js.map +1 -0
  176. package/lib/esm/store/ToolsApi.js +17 -0
  177. package/lib/esm/store/ToolsApi.js.map +1 -0
  178. package/lib/esm/store/TypesApi.js +53 -0
  179. package/lib/esm/store/TypesApi.js.map +1 -0
  180. package/lib/esm/store/WorkersApi.js +12 -0
  181. package/lib/esm/store/WorkersApi.js.map +1 -0
  182. package/lib/esm/store/WorkflowsApi.js +590 -0
  183. package/lib/esm/store/WorkflowsApi.js.map +1 -0
  184. package/lib/esm/store/client.js +77 -0
  185. package/lib/esm/store/client.js.map +1 -0
  186. package/lib/esm/store/errors.js +7 -0
  187. package/lib/esm/store/errors.js.map +1 -0
  188. package/lib/esm/store/index.js +11 -0
  189. package/lib/esm/store/index.js.map +1 -0
  190. package/lib/esm/store/version.js +3 -0
  191. package/lib/esm/store/version.js.map +1 -0
  192. package/lib/tsconfig.tsbuildinfo +1 -0
  193. package/lib/types/AccountApi.d.ts +59 -0
  194. package/lib/types/AccountApi.d.ts.map +1 -0
  195. package/lib/types/AccountsApi.d.ts +7 -0
  196. package/lib/types/AccountsApi.d.ts.map +1 -0
  197. package/lib/types/AnalyticsApi.d.ts +11 -0
  198. package/lib/types/AnalyticsApi.d.ts.map +1 -0
  199. package/lib/types/ApiKeysApi.d.ts +42 -0
  200. package/lib/types/ApiKeysApi.d.ts.map +1 -0
  201. package/lib/types/AppsApi.d.ts +65 -0
  202. package/lib/types/AppsApi.d.ts.map +1 -0
  203. package/lib/types/CommandsApi.d.ts +10 -0
  204. package/lib/types/CommandsApi.d.ts.map +1 -0
  205. package/lib/types/EnvironmentsApi.d.ts +40 -0
  206. package/lib/types/EnvironmentsApi.d.ts.map +1 -0
  207. package/lib/types/GroupsApi.d.ts +65 -0
  208. package/lib/types/GroupsApi.d.ts.map +1 -0
  209. package/lib/types/IamApi.d.ts +41 -0
  210. package/lib/types/IamApi.d.ts.map +1 -0
  211. package/lib/types/InteractionBase.d.ts +22 -0
  212. package/lib/types/InteractionBase.d.ts.map +1 -0
  213. package/lib/types/InteractionCatalogApi.d.ts +36 -0
  214. package/lib/types/InteractionCatalogApi.d.ts.map +1 -0
  215. package/lib/types/InteractionOutput.d.ts +174 -0
  216. package/lib/types/InteractionOutput.d.ts.map +1 -0
  217. package/lib/types/InteractionResult.example.d.ts +6 -0
  218. package/lib/types/InteractionResult.example.d.ts.map +1 -0
  219. package/lib/types/InteractionsApi.d.ts +183 -0
  220. package/lib/types/InteractionsApi.d.ts.map +1 -0
  221. package/lib/types/MCPOAuthApi.d.ts +45 -0
  222. package/lib/types/MCPOAuthApi.d.ts.map +1 -0
  223. package/lib/types/ProjectsApi.d.ts +28 -0
  224. package/lib/types/ProjectsApi.d.ts.map +1 -0
  225. package/lib/types/PromptsApi.d.ts +106 -0
  226. package/lib/types/PromptsApi.d.ts.map +1 -0
  227. package/lib/types/RefsApi.d.ts +6 -0
  228. package/lib/types/RefsApi.d.ts.map +1 -0
  229. package/lib/types/RunsApi.d.ts +79 -0
  230. package/lib/types/RunsApi.d.ts.map +1 -0
  231. package/lib/types/SkillsApi.d.ts +26 -0
  232. package/lib/types/SkillsApi.d.ts.map +1 -0
  233. package/lib/types/StreamSource.d.ts +7 -0
  234. package/lib/types/StreamSource.d.ts.map +1 -0
  235. package/lib/types/TrainingApi.d.ts +27 -0
  236. package/lib/types/TrainingApi.d.ts.map +1 -0
  237. package/lib/types/UsersApi.d.ts +6 -0
  238. package/lib/types/UsersApi.d.ts.map +1 -0
  239. package/lib/types/client.d.ts +136 -0
  240. package/lib/types/client.d.ts.map +1 -0
  241. package/lib/types/execute.d.ts +37 -0
  242. package/lib/types/execute.d.ts.map +1 -0
  243. package/lib/types/index.d.ts +10 -0
  244. package/lib/types/index.d.ts.map +1 -0
  245. package/lib/types/nodejs/NodeStreamSource.d.ts +9 -0
  246. package/lib/types/nodejs/NodeStreamSource.d.ts.map +1 -0
  247. package/lib/types/nodejs/index.d.ts +1 -0
  248. package/lib/types/nodejs/index.d.ts.map +1 -0
  249. package/lib/types/store/AnalyzeDocApi.d.ts +17 -0
  250. package/lib/types/store/AnalyzeDocApi.d.ts.map +1 -0
  251. package/lib/types/store/CollectionsApi.d.ts +82 -0
  252. package/lib/types/store/CollectionsApi.d.ts.map +1 -0
  253. package/lib/types/store/CommandsApi.d.ts +10 -0
  254. package/lib/types/store/CommandsApi.d.ts.map +1 -0
  255. package/lib/types/store/DashboardApi.d.ts +149 -0
  256. package/lib/types/store/DashboardApi.d.ts.map +1 -0
  257. package/lib/types/store/DataApi.d.ts +392 -0
  258. package/lib/types/store/DataApi.d.ts.map +1 -0
  259. package/lib/types/store/EmailApi.d.ts +185 -0
  260. package/lib/types/store/EmailApi.d.ts.map +1 -0
  261. package/lib/types/store/EmbeddingsApi.d.ts +12 -0
  262. package/lib/types/store/EmbeddingsApi.d.ts.map +1 -0
  263. package/lib/types/store/FilesApi.d.ts +110 -0
  264. package/lib/types/store/FilesApi.d.ts.map +1 -0
  265. package/lib/types/store/ObjectsApi.d.ts +139 -0
  266. package/lib/types/store/ObjectsApi.d.ts.map +1 -0
  267. package/lib/types/store/PendingAsksApi.d.ts +79 -0
  268. package/lib/types/store/PendingAsksApi.d.ts.map +1 -0
  269. package/lib/types/store/SchedulesApi.d.ts +89 -0
  270. package/lib/types/store/SchedulesApi.d.ts.map +1 -0
  271. package/lib/types/store/ToolsApi.d.ts +13 -0
  272. package/lib/types/store/ToolsApi.d.ts.map +1 -0
  273. package/lib/types/store/TypesApi.d.ts +23 -0
  274. package/lib/types/store/TypesApi.d.ts.map +1 -0
  275. package/lib/types/store/WorkersApi.d.ts +6 -0
  276. package/lib/types/store/WorkersApi.d.ts.map +1 -0
  277. package/lib/types/store/WorkflowsApi.d.ts +167 -0
  278. package/lib/types/store/WorkflowsApi.d.ts.map +1 -0
  279. package/lib/types/store/client.d.ts +45 -0
  280. package/lib/types/store/client.d.ts.map +1 -0
  281. package/lib/types/store/errors.d.ts +4 -0
  282. package/lib/types/store/errors.d.ts.map +1 -0
  283. package/lib/types/store/index.d.ts +10 -0
  284. package/lib/types/store/index.d.ts.map +1 -0
  285. package/lib/types/store/version.d.ts +2 -0
  286. package/lib/types/store/version.d.ts.map +1 -0
  287. package/lib/vertesia-client.js +2 -0
  288. package/lib/vertesia-client.js.map +1 -0
  289. package/package.json +71 -0
  290. package/src/AccountApi.ts +96 -0
  291. package/src/AccountsApi.ts +22 -0
  292. package/src/AnalyticsApi.ts +36 -0
  293. package/src/ApiKeysApi.ts +67 -0
  294. package/src/AppsApi.ts +134 -0
  295. package/src/CommandsApi.ts +23 -0
  296. package/src/EnvironmentsApi.ts +94 -0
  297. package/src/GroupsApi.ts +92 -0
  298. package/src/IamApi.ts +70 -0
  299. package/src/InteractionBase.ts +44 -0
  300. package/src/InteractionCatalogApi.ts +72 -0
  301. package/src/InteractionOutput.test.ts +305 -0
  302. package/src/InteractionOutput.ts +328 -0
  303. package/src/InteractionResult.example.ts +72 -0
  304. package/src/InteractionsApi.ts +308 -0
  305. package/src/MCPOAuthApi.ts +67 -0
  306. package/src/ProjectsApi.ts +85 -0
  307. package/src/PromptsApi.ts +160 -0
  308. package/src/RefsApi.ts +18 -0
  309. package/src/RunsApi.ts +151 -0
  310. package/src/SkillsApi.ts +46 -0
  311. package/src/StreamSource.ts +3 -0
  312. package/src/TrainingApi.ts +71 -0
  313. package/src/UsersApi.ts +18 -0
  314. package/src/client.test.ts +99 -0
  315. package/src/client.ts +419 -0
  316. package/src/execute.ts +126 -0
  317. package/src/index.ts +10 -0
  318. package/src/nodejs/NodeStreamSource.ts +43 -0
  319. package/src/nodejs/index.ts +1 -0
  320. package/src/store/AnalyzeDocApi.ts +61 -0
  321. package/src/store/CollectionsApi.ts +166 -0
  322. package/src/store/CommandsApi.ts +15 -0
  323. package/src/store/DashboardApi.ts +216 -0
  324. package/src/store/DataApi.ts +516 -0
  325. package/src/store/EmailApi.ts +211 -0
  326. package/src/store/EmbeddingsApi.ts +39 -0
  327. package/src/store/FilesApi.ts +288 -0
  328. package/src/store/ObjectsApi.ts +432 -0
  329. package/src/store/PendingAsksApi.ts +98 -0
  330. package/src/store/SchedulesApi.ts +114 -0
  331. package/src/store/ToolsApi.ts +19 -0
  332. package/src/store/TypesApi.ts +65 -0
  333. package/src/store/WorkersApi.ts +17 -0
  334. package/src/store/WorkflowsApi.ts +752 -0
  335. package/src/store/client.ts +95 -0
  336. package/src/store/errors.ts +7 -0
  337. package/src/store/index.ts +11 -0
  338. package/src/store/version.ts +2 -0
  339. package/tsconfig.dist.json +20 -0
@@ -0,0 +1,432 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import {
3
+ canGenerateRendition,
4
+ ContentObjectApiHeaders,
5
+ ComplexSearchPayload,
6
+ ComputeObjectFacetPayload,
7
+ ContentObject,
8
+ ContentObjectItem,
9
+ ContentObjectProcessingPriority,
10
+ ContentSource,
11
+ CreateContentObjectPayload,
12
+ Embedding,
13
+ ExportPropertiesPayload,
14
+ ExportPropertiesResponse,
15
+ FindPayload,
16
+ GetFileUrlPayload,
17
+ GetFileUrlResponse,
18
+ GetRenditionParams,
19
+ GetRenditionResponse,
20
+ getSupportedRenditionFormats,
21
+ GetUploadUrlPayload,
22
+ ListWorkflowRunsResponse,
23
+ ObjectSearchPayload,
24
+ ObjectSearchQuery,
25
+ SupportedEmbeddingTypes,
26
+ supportsVisualRendition,
27
+ } from "@vertesia/common";
28
+
29
+ // Re-export rendition utilities for consumers
30
+ export { canGenerateRendition, getSupportedRenditionFormats, supportsVisualRendition };
31
+
32
+ import { StreamSource } from "../StreamSource.js";
33
+ import { AnalyzeDocApi } from "./AnalyzeDocApi.js";
34
+ import { ZenoClient } from "./client.js";
35
+
36
+ export interface ComputeFacetsResponse {
37
+ type?: { _id: string; count: number }[];
38
+ location?: { _id: string; count: number }[];
39
+ status?: { _id: string; count: number }[];
40
+ total?: number;
41
+ }
42
+
43
+ export interface SearchResponse {
44
+ results: ContentObjectItem[];
45
+ facets: ComputeFacetsResponse;
46
+ }
47
+
48
+ export class ObjectsApi extends ApiTopic {
49
+ constructor(parent: ClientBase) {
50
+ super(parent, "/api/v1/objects");
51
+ }
52
+
53
+ analyze(objectId: string) {
54
+ return new AnalyzeDocApi(this, objectId);
55
+ }
56
+
57
+ getUploadUrl(payload: GetUploadUrlPayload): Promise<GetFileUrlResponse> {
58
+ return this.post("/upload-url", {
59
+ payload,
60
+ });
61
+ }
62
+
63
+ getDownloadUrl(fileUri: string, name?: string, disposition?: "inline" | "attachment"): Promise<{ url: string }> {
64
+ return this.post("/download-url", {
65
+ payload: { file: fileUri, name, disposition } satisfies GetFileUrlPayload,
66
+ });
67
+ }
68
+
69
+ getDownloadUrlWithOptions(payload: GetFileUrlPayload): Promise<{ url: string }> {
70
+ return this.post("/download-url", { payload });
71
+ }
72
+
73
+ getContentSource(objectId: string): Promise<ContentSource> {
74
+ return this.get(`/${objectId}/content-source`);
75
+ }
76
+
77
+ /**
78
+ * List objects with revision filtering options
79
+ *
80
+ * @param payload Search/filter parameters
81
+ * @returns Matching content objects
82
+ */
83
+ list<T = any>(
84
+ payload: ObjectSearchPayload = {},
85
+ ): Promise<ContentObjectItem<T>[]> {
86
+ const limit = payload.limit || 100;
87
+ const offset = payload.offset || 0;
88
+ const query = payload.query || ({} as ObjectSearchQuery);
89
+
90
+ return this.get("/", {
91
+ query: {
92
+ limit,
93
+ offset,
94
+ ...query,
95
+ all_revisions: payload.all_revisions,
96
+ from_root: payload.from_root || undefined,
97
+ },
98
+ });
99
+ }
100
+
101
+ computeFacets(
102
+ query: ComputeObjectFacetPayload,
103
+ ): Promise<ComputeFacetsResponse> {
104
+ return this.post("/facets", {
105
+ payload: query,
106
+ });
107
+ }
108
+
109
+ listFolders(path: string = "/") {
110
+ path; //TODO
111
+ }
112
+
113
+ /** Find object based on query */
114
+ find(payload: FindPayload): Promise<ContentObject[]> {
115
+ return this.post("/find", {
116
+ payload,
117
+ });
118
+ }
119
+
120
+ /** Count number of objects matching this query */
121
+ count(payload: FindPayload): Promise<{ count: number }> {
122
+ return this.post("/count", {
123
+ payload,
124
+ });
125
+ }
126
+
127
+ /** Search object — different from find because allow full text search */
128
+ search(payload: ComplexSearchPayload): Promise<SearchResponse> {
129
+ return this.post("/search", {
130
+ payload,
131
+ });
132
+ }
133
+
134
+ retrieve(id: string, select?: string): Promise<ContentObject> {
135
+ return this.get(`/${id}`, {
136
+ query: {
137
+ select,
138
+ },
139
+ });
140
+ }
141
+
142
+ getObjectText(id: string): Promise<{ text: string }> {
143
+ return this.get(`/${id}/text`);
144
+ }
145
+
146
+ async upload(source: StreamSource | File) {
147
+ const isStream = source instanceof StreamSource;
148
+ // get a signed URL to upload the file a computed mimeType and the file object id.
149
+ const { url, id, mime_type } = await this.getUploadUrl({
150
+ id: isStream ? source.id : undefined,
151
+ name: source.name,
152
+ mime_type: source.type,
153
+ });
154
+
155
+ // upload the file content to the signed URL
156
+ /*const res = await this.fetch(url, {
157
+ method: 'PUT',
158
+ //@ts-ignore: duplex is not in the types. See https://github.com/node-fetch/node-fetch/issues/1769
159
+ duplex: isStream ? "half" : undefined,
160
+ body: isStream ? source.stream : source,
161
+ headers: {
162
+ 'Content-Type': mime_type || 'application/octet-stream'
163
+ }
164
+ }).then((res: Response) => {
165
+ if (res.ok) {
166
+ return res;
167
+ } else {
168
+ console.log(res);
169
+ throw new Error(`Failed to upload file: ${res.statusText}`);
170
+ }
171
+ });*/
172
+
173
+ const res = await fetch(url, {
174
+ method: "PUT",
175
+ body: isStream ? source.stream : source,
176
+ //@ts-ignore: duplex is not in the types. See https://github.com/node-fetch/node-fetch/issues/1769
177
+ duplex: isStream ? "half" : undefined,
178
+ headers: {
179
+ "Content-Type": mime_type || "application/octet-stream",
180
+ },
181
+ })
182
+ .then((res: Response) => {
183
+ if (res.ok) {
184
+ return res;
185
+ } else {
186
+ console.log(res);
187
+ throw new Error(`Failed to upload file: ${res.statusText}`);
188
+ }
189
+ })
190
+ .catch((err) => {
191
+ console.error("Failed to upload file", err);
192
+ throw err;
193
+ });
194
+
195
+ //Etag need to be unquoted
196
+ //When a server returns an ETag header, it includes the quotes around the actual hash value.
197
+ //This is part of the HTTP specification (RFC 7232), which states that ETags should be
198
+ //enclosed in double quotes.
199
+ const etag = res.headers.get("etag")?.replace(/^"(.*)"$/, "$1");
200
+
201
+ return {
202
+ source: id,
203
+ name: source.name,
204
+ type: mime_type,
205
+ etag,
206
+ };
207
+ }
208
+
209
+ async create(
210
+ payload: CreateContentObjectPayload,
211
+ options?: {
212
+ collection_id?: string;
213
+ processing_priority?: ContentObjectProcessingPriority;
214
+ },
215
+ ): Promise<ContentObject> {
216
+ const createPayload: CreateContentObjectPayload = {
217
+ ...payload,
218
+ };
219
+ if (
220
+ payload.content instanceof StreamSource ||
221
+ payload.content instanceof File
222
+ ) {
223
+ createPayload.content = await this.upload(payload.content);
224
+ }
225
+
226
+ const headers: Record<string, string> = {};
227
+ if (options?.processing_priority) {
228
+ headers[ContentObjectApiHeaders.PROCESSING_PRIORITY] = options.processing_priority;
229
+ }
230
+ if (options?.collection_id) {
231
+ headers[ContentObjectApiHeaders.COLLECTION_ID] = options.collection_id;
232
+ }
233
+
234
+ return await this.post("/", {
235
+ payload: createPayload,
236
+ headers: headers,
237
+ });
238
+ }
239
+
240
+ /**
241
+ * Create an object which holds a reference to an external blob (i.e. not in the project bucket)
242
+ * The uri should starts either with gs:// or s3://. Not other protocols are supported yet.
243
+ * For the s3 blobs you must use a hash with the blob #region. Ex: s3://bucket/path/to/file#us-east-1
244
+ * @param uri
245
+ * @param payload
246
+ * @param options
247
+ * @returns
248
+ */
249
+ async createFromExternalSource(
250
+ uri: string,
251
+ payload: CreateContentObjectPayload = {},
252
+ options?: {
253
+ collection_id?: string;
254
+ processing_priority?: ContentObjectProcessingPriority;
255
+ },
256
+ ): Promise<ContentObject> {
257
+ const metadata = await (this.client as ZenoClient).files.getMetadata(
258
+ uri,
259
+ );
260
+ const createPayload: CreateContentObjectPayload = {
261
+ ...payload,
262
+ content: {
263
+ source: uri,
264
+ name: metadata.name,
265
+ type: metadata.contentType,
266
+ etag: metadata.etag,
267
+ },
268
+ };
269
+
270
+ const headers: Record<string, string> = {};
271
+ if (options?.processing_priority) {
272
+ headers[ContentObjectApiHeaders.PROCESSING_PRIORITY] = options.processing_priority;
273
+ }
274
+ if (options?.collection_id) {
275
+ headers[ContentObjectApiHeaders.COLLECTION_ID] = options.collection_id;
276
+ }
277
+
278
+ return await this.post("/", {
279
+ payload: createPayload,
280
+ headers: headers,
281
+ });
282
+ }
283
+
284
+ /**
285
+ * Updates an existing object or creates a new revision
286
+ * Handles file uploads similar to the create method
287
+ *
288
+ * @param id The ID of the object to update
289
+ * @param payload The changes to apply
290
+ * @param options Additional options
291
+ * @param options.createRevision Whether to create a new revision instead of updating in place
292
+ * @param options.revisionLabel Optional label for the revision (e.g., "v1.2")
293
+ * @param options.suppressWorkflows When true, prevents this update from triggering workflow rules
294
+ * @returns The updated object or newly created revision
295
+ */
296
+ async update(
297
+ id: string,
298
+ payload: Partial<CreateContentObjectPayload>,
299
+ options?: {
300
+ createRevision?: boolean;
301
+ revisionLabel?: string;
302
+ processing_priority?: ContentObjectProcessingPriority;
303
+ suppressWorkflows?: boolean;
304
+ },
305
+ ): Promise<ContentObject> {
306
+ const updatePayload: Partial<CreateContentObjectPayload> = {
307
+ ...payload,
308
+ };
309
+
310
+ // Handle file upload if content is provided as File or StreamSource
311
+ if (
312
+ payload.content instanceof StreamSource ||
313
+ payload.content instanceof File
314
+ ) {
315
+ updatePayload.content = await this.upload(payload.content);
316
+ }
317
+
318
+ const headers: Record<string, string> = {};
319
+ if (options?.processing_priority) {
320
+ headers[ContentObjectApiHeaders.PROCESSING_PRIORITY] = options.processing_priority;
321
+ }
322
+ if (options?.createRevision) {
323
+ headers[ContentObjectApiHeaders.CREATE_REVISION] = "true";
324
+ if (options.revisionLabel) {
325
+ headers[ContentObjectApiHeaders.REVISION_LABEL] = options.revisionLabel;
326
+ }
327
+ }
328
+ if (options?.suppressWorkflows) {
329
+ headers[ContentObjectApiHeaders.SUPPRESS_WORKFLOWS] = "true";
330
+ }
331
+
332
+ return this.put(`/${id}`, {
333
+ payload: updatePayload,
334
+ headers,
335
+ });
336
+ }
337
+
338
+ /**
339
+ * Retrieves all revisions of a content object
340
+ *
341
+ * @param id The ID of any revision in the object's history
342
+ * @returns Array of all revisions sharing the same root
343
+ */
344
+ getRevisions(id: string): Promise<ContentObjectItem[]> {
345
+ return this.get(`/${id}/revisions`);
346
+ }
347
+
348
+ /**
349
+ * Retrieves all collections that contain a specific object
350
+ *
351
+ * @param id The ID of the object
352
+ * @returns Array of collections containing this object (both static and dynamic)
353
+ */
354
+ getCollections(id: string): Promise<any[]> {
355
+ return this.get(`/${id}/collections`);
356
+ }
357
+
358
+ delete(id: string): Promise<{ id: string }> {
359
+ return this.del(`/${id}`);
360
+ }
361
+
362
+ listWorkflowRuns(documentId: string): Promise<ListWorkflowRunsResponse> {
363
+ return this.get(`/${documentId}/workflow-runs`);
364
+ }
365
+
366
+ listRenditions(documentId: string): Promise<ContentObjectItem[]> {
367
+ return this.get(`/${documentId}/renditions`);
368
+ }
369
+
370
+ getRendition(
371
+ documentId: string,
372
+ options: GetRenditionParams,
373
+ ): Promise<GetRenditionResponse> {
374
+ const query = {
375
+ max_hw: options.max_hw,
376
+ generate_if_missing: options.generate_if_missing,
377
+ sign_url: options.sign_url,
378
+ block_on_generation: options.block_on_generation,
379
+ };
380
+
381
+ return this.get(`/${documentId}/renditions/${options.format}`, {
382
+ query,
383
+ });
384
+ }
385
+
386
+ /**
387
+ * Get rendition with pre-validation of content type compatibility.
388
+ * Returns null instead of throwing if the format is not supported for the content type.
389
+ *
390
+ * @param documentId - The document ID
391
+ * @param contentType - The content type of the document (e.g., 'image/png', 'text/markdown')
392
+ * @param options - Rendition options including format
393
+ * @returns The rendition response, or null if format is not supported for the content type
394
+ *
395
+ * @example
396
+ * const rendition = await client.objects.getRenditionSafe(docId, doc.content?.type, {
397
+ * format: ImageRenditionFormat.jpeg,
398
+ * generate_if_missing: true
399
+ * });
400
+ * if (!rendition) {
401
+ * console.log('Document does not support JPEG renditions');
402
+ * }
403
+ */
404
+ getRenditionSafe(
405
+ documentId: string,
406
+ contentType: string | undefined,
407
+ options: GetRenditionParams,
408
+ ): Promise<GetRenditionResponse | null> {
409
+ if (!canGenerateRendition(contentType, options.format)) {
410
+ return Promise.resolve(null);
411
+ }
412
+ return this.getRendition(documentId, options);
413
+ }
414
+
415
+ exportProperties(
416
+ payload: ExportPropertiesPayload,
417
+ ): Promise<ExportPropertiesResponse> {
418
+ return this.post("/export", {
419
+ payload,
420
+ });
421
+ }
422
+
423
+ setEmbedding(
424
+ id: string,
425
+ type: SupportedEmbeddingTypes,
426
+ payload: Embedding,
427
+ ): Promise<Record<SupportedEmbeddingTypes, Embedding>> {
428
+ return this.put(`/${id}/embeddings/${type}`, {
429
+ payload,
430
+ });
431
+ }
432
+ }
@@ -0,0 +1,98 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import { ListPendingAsksResponse, PendingAskData, UserChannel } from "@vertesia/common";
3
+
4
+ /**
5
+ * Request to register a pending ask.
6
+ */
7
+ export interface RegisterPendingAskRequest {
8
+ /** Temporal workflow run ID */
9
+ runId: string;
10
+ /** Temporal workflow ID */
11
+ workflowId: string;
12
+ /** Name of the agent/interaction */
13
+ agentName: string;
14
+ /** Questions asked by the agent */
15
+ questions: string[];
16
+ /** Timeout in hours (default 48) */
17
+ timeoutHours?: number;
18
+ /** User communication channels */
19
+ userChannels: UserChannel[];
20
+ }
21
+
22
+ /**
23
+ * Response from registering a pending ask.
24
+ */
25
+ export interface RegisterPendingAskResponse {
26
+ /** Whether registration succeeded */
27
+ success: boolean;
28
+ /** Generated ask ID */
29
+ askId?: string;
30
+ /** Whether webhook was sent */
31
+ webhookSent?: boolean;
32
+ /** Error message if failed */
33
+ error?: string;
34
+ }
35
+
36
+ /**
37
+ * Request to resolve a pending ask.
38
+ */
39
+ export interface ResolvePendingAskRequest {
40
+ /** User's response */
41
+ response: string;
42
+ }
43
+
44
+ /**
45
+ * Response from resolving a pending ask.
46
+ */
47
+ export interface ResolvePendingAskResponse {
48
+ /** Whether resolution succeeded */
49
+ success: boolean;
50
+ /** Whether webhook was sent */
51
+ webhookSent?: boolean;
52
+ /** How long the user took to respond (ms) */
53
+ waitDurationMs?: number;
54
+ /** Error message if failed */
55
+ error?: string;
56
+ }
57
+
58
+ /**
59
+ * Pending Asks API for tracking ask_user requests.
60
+ * Handles registration, resolution, and listing of pending asks.
61
+ */
62
+ export class PendingAsksApi extends ApiTopic {
63
+ constructor(parent: ClientBase) {
64
+ super(parent, "/api/v1/pending-asks");
65
+ }
66
+
67
+ /**
68
+ * Register a new pending ask.
69
+ * Called when an agent calls ask_user.
70
+ * Stores in Redis and sends webhook if configured.
71
+ */
72
+ register(request: RegisterPendingAskRequest): Promise<RegisterPendingAskResponse> {
73
+ return this.post("/", { payload: request });
74
+ }
75
+
76
+ /**
77
+ * Resolve a pending ask with the user's response.
78
+ * Called when a user responds to an ask.
79
+ * Updates Redis and sends webhook if configured.
80
+ */
81
+ resolve(askId: string, request: ResolvePendingAskRequest): Promise<ResolvePendingAskResponse> {
82
+ return this.post(`/${askId}/resolve`, { payload: request });
83
+ }
84
+
85
+ /**
86
+ * List all pending asks for the current project.
87
+ */
88
+ list(): Promise<ListPendingAsksResponse> {
89
+ return this.get("/");
90
+ }
91
+
92
+ /**
93
+ * Get a specific pending ask by ID.
94
+ */
95
+ retrieve(askId: string): Promise<PendingAskData> {
96
+ return this.get(`/${askId}`);
97
+ }
98
+ }
@@ -0,0 +1,114 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import {
3
+ AgentSchedule,
4
+ AgentScheduleWithTemporalInfo,
5
+ CreateSchedulePayload,
6
+ ScheduleListItem,
7
+ UpdateSchedulePayload,
8
+ } from "@vertesia/common";
9
+
10
+ /**
11
+ * Client API for managing agent schedules.
12
+ *
13
+ * Schedules allow agents to run on a recurring basis using cron expressions.
14
+ */
15
+ export class SchedulesApi extends ApiTopic {
16
+ constructor(parent: ClientBase) {
17
+ super(parent, "/api/v1/schedules");
18
+ }
19
+
20
+ /**
21
+ * List all schedules in the project.
22
+ */
23
+ list(): Promise<ScheduleListItem[]> {
24
+ return this.get("/");
25
+ }
26
+
27
+ /**
28
+ * Retrieve a schedule by ID.
29
+ * Includes Temporal execution info if available.
30
+ */
31
+ retrieve(id: string): Promise<AgentScheduleWithTemporalInfo> {
32
+ return this.get(`/${id}`);
33
+ }
34
+
35
+ /**
36
+ * Create a new schedule.
37
+ *
38
+ * @param payload - Schedule configuration including name, interaction, and cron expression
39
+ * @returns The created schedule
40
+ *
41
+ * @example
42
+ * ```typescript
43
+ * const schedule = await client.schedules.create({
44
+ * name: 'Weekly Report',
45
+ * interaction: 'WeeklyReportAgent',
46
+ * cron_expression: '0 9 * * MON', // Every Monday at 9am
47
+ * timezone: 'America/New_York',
48
+ * vars: { reportType: 'summary' }
49
+ * });
50
+ * ```
51
+ */
52
+ create(payload: CreateSchedulePayload): Promise<AgentSchedule> {
53
+ return this.post("/", { payload });
54
+ }
55
+
56
+ /**
57
+ * Update an existing schedule.
58
+ *
59
+ * @param id - Schedule ID
60
+ * @param payload - Fields to update
61
+ * @returns The updated schedule
62
+ */
63
+ update(id: string, payload: UpdateSchedulePayload): Promise<AgentSchedule> {
64
+ return this.put(`/${id}`, { payload });
65
+ }
66
+
67
+ /**
68
+ * Delete a schedule.
69
+ *
70
+ * This also removes the corresponding Temporal schedule.
71
+ *
72
+ * @param id - Schedule ID
73
+ * @returns Object with the deleted schedule ID
74
+ */
75
+ delete(id: string): Promise<{ id: string }> {
76
+ return this.del(`/${id}`);
77
+ }
78
+
79
+ /**
80
+ * Trigger an immediate execution of the scheduled agent.
81
+ *
82
+ * This runs the agent immediately without waiting for the next scheduled time.
83
+ *
84
+ * @param id - Schedule ID
85
+ * @returns Success message
86
+ */
87
+ trigger(id: string): Promise<{ message: string }> {
88
+ return this.post(`/${id}/trigger`, {});
89
+ }
90
+
91
+ /**
92
+ * Pause a schedule.
93
+ *
94
+ * The schedule will not run until resumed.
95
+ *
96
+ * @param id - Schedule ID
97
+ * @param note - Optional note explaining why the schedule was paused
98
+ * @returns Success message
99
+ */
100
+ pause(id: string, note?: string): Promise<{ message: string }> {
101
+ return this.post(`/${id}/pause`, { payload: { note } });
102
+ }
103
+
104
+ /**
105
+ * Resume a paused schedule.
106
+ *
107
+ * @param id - Schedule ID
108
+ * @param note - Optional note explaining why the schedule was resumed
109
+ * @returns Success message
110
+ */
111
+ resume(id: string, note?: string): Promise<{ message: string }> {
112
+ return this.post(`/${id}/resume`, { payload: { note } });
113
+ }
114
+ }
@@ -0,0 +1,19 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import type { BuiltinToolsCatalogResponse } from "@vertesia/common";
3
+
4
+ /**
5
+ * API for accessing the builtin tools catalog
6
+ */
7
+ export class ToolsApi extends ApiTopic {
8
+ constructor(parent: ClientBase) {
9
+ super(parent, "/api/v1/tools");
10
+ }
11
+
12
+ /**
13
+ * Get the builtin tools catalog
14
+ * @returns List of all available builtin tools with their descriptions and parameter schemas
15
+ */
16
+ getBuiltinCatalog(): Promise<BuiltinToolsCatalogResponse> {
17
+ return this.get('/');
18
+ }
19
+ }