@vertesia/client 1.0.0-dev.20260203.130115Z → 1.0.0-dev.20260227.104700Z

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 (337) hide show
  1. package/lib/cjs/AccountApi.js +85 -0
  2. package/lib/cjs/AccountApi.js.map +1 -0
  3. package/lib/cjs/AccountsApi.js +16 -0
  4. package/lib/cjs/AccountsApi.js.map +1 -0
  5. package/lib/cjs/AnalyticsApi.js +41 -0
  6. package/lib/cjs/AnalyticsApi.js.map +1 -0
  7. package/lib/cjs/ApiKeysApi.js +63 -0
  8. package/lib/cjs/ApiKeysApi.js.map +1 -0
  9. package/lib/cjs/AppsApi.js +119 -0
  10. package/lib/cjs/AppsApi.js.map +1 -0
  11. package/lib/cjs/AuditTrailApi.js +35 -0
  12. package/lib/cjs/AuditTrailApi.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 +96 -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 +108 -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 +19 -0
  48. package/lib/cjs/UsersApi.js.map +1 -0
  49. package/lib/cjs/client.js +362 -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/HiveMemoryApi.js +174 -0
  77. package/lib/cjs/store/HiveMemoryApi.js.map +1 -0
  78. package/lib/cjs/store/IndexingApi.js +207 -0
  79. package/lib/cjs/store/IndexingApi.js.map +1 -0
  80. package/lib/cjs/store/ObjectsApi.js +316 -0
  81. package/lib/cjs/store/ObjectsApi.js.map +1 -0
  82. package/lib/cjs/store/PendingAsksApi.js +43 -0
  83. package/lib/cjs/store/PendingAsksApi.js.map +1 -0
  84. package/lib/cjs/store/QueryApi.js +67 -0
  85. package/lib/cjs/store/QueryApi.js.map +1 -0
  86. package/lib/cjs/store/RenderingApi.js +84 -0
  87. package/lib/cjs/store/RenderingApi.js.map +1 -0
  88. package/lib/cjs/store/SchedulesApi.js +103 -0
  89. package/lib/cjs/store/SchedulesApi.js.map +1 -0
  90. package/lib/cjs/store/ToolsApi.js +21 -0
  91. package/lib/cjs/store/ToolsApi.js.map +1 -0
  92. package/lib/cjs/store/TypeCatalogApi.js +50 -0
  93. package/lib/cjs/store/TypeCatalogApi.js.map +1 -0
  94. package/lib/cjs/store/TypesApi.js +60 -0
  95. package/lib/cjs/store/TypesApi.js.map +1 -0
  96. package/lib/cjs/store/WorkersApi.js +16 -0
  97. package/lib/cjs/store/WorkersApi.js.map +1 -0
  98. package/lib/cjs/store/WorkflowsApi.js +604 -0
  99. package/lib/cjs/store/WorkflowsApi.js.map +1 -0
  100. package/lib/cjs/store/client.js +89 -0
  101. package/lib/cjs/store/client.js.map +1 -0
  102. package/lib/cjs/store/errors.js +11 -0
  103. package/lib/cjs/store/errors.js.map +1 -0
  104. package/lib/cjs/store/index.js +33 -0
  105. package/lib/cjs/store/index.js.map +1 -0
  106. package/lib/cjs/store/version.js +6 -0
  107. package/lib/cjs/store/version.js.map +1 -0
  108. package/lib/esm/AccountApi.js +82 -0
  109. package/lib/esm/AccountApi.js.map +1 -0
  110. package/lib/esm/AccountsApi.js +13 -0
  111. package/lib/esm/AccountsApi.js.map +1 -0
  112. package/lib/esm/AnalyticsApi.js +38 -0
  113. package/lib/esm/AnalyticsApi.js.map +1 -0
  114. package/lib/esm/ApiKeysApi.js +59 -0
  115. package/lib/esm/ApiKeysApi.js.map +1 -0
  116. package/lib/esm/AppsApi.js +116 -0
  117. package/lib/esm/AppsApi.js.map +1 -0
  118. package/lib/esm/AuditTrailApi.js +32 -0
  119. package/lib/esm/AuditTrailApi.js.map +1 -0
  120. package/lib/esm/CommandsApi.js +16 -0
  121. package/lib/esm/CommandsApi.js.map +1 -0
  122. package/lib/esm/EnvironmentsApi.js +69 -0
  123. package/lib/esm/EnvironmentsApi.js.map +1 -0
  124. package/lib/esm/GroupsApi.js +74 -0
  125. package/lib/esm/GroupsApi.js.map +1 -0
  126. package/lib/esm/IamApi.js +47 -0
  127. package/lib/esm/IamApi.js.map +1 -0
  128. package/lib/esm/InteractionBase.js +40 -0
  129. package/lib/esm/InteractionBase.js.map +1 -0
  130. package/lib/esm/InteractionCatalogApi.js +60 -0
  131. package/lib/esm/InteractionCatalogApi.js.map +1 -0
  132. package/lib/esm/InteractionOutput.js +293 -0
  133. package/lib/esm/InteractionOutput.js.map +1 -0
  134. package/lib/esm/InteractionResult.example.js +55 -0
  135. package/lib/esm/InteractionResult.example.js.map +1 -0
  136. package/lib/esm/InteractionsApi.js +259 -0
  137. package/lib/esm/InteractionsApi.js.map +1 -0
  138. package/lib/esm/MCPOAuthApi.js +59 -0
  139. package/lib/esm/MCPOAuthApi.js.map +1 -0
  140. package/lib/esm/ProjectsApi.js +93 -0
  141. package/lib/esm/ProjectsApi.js.map +1 -0
  142. package/lib/esm/PromptsApi.js +130 -0
  143. package/lib/esm/PromptsApi.js.map +1 -0
  144. package/lib/esm/RefsApi.js +10 -0
  145. package/lib/esm/RefsApi.js.map +1 -0
  146. package/lib/esm/RunsApi.js +104 -0
  147. package/lib/esm/RunsApi.js.map +1 -0
  148. package/lib/esm/SkillsApi.js +36 -0
  149. package/lib/esm/SkillsApi.js.map +1 -0
  150. package/lib/esm/StreamSource.js +13 -0
  151. package/lib/esm/StreamSource.js.map +1 -0
  152. package/lib/esm/TrainingApi.js +51 -0
  153. package/lib/esm/TrainingApi.js.map +1 -0
  154. package/lib/esm/UsersApi.js +16 -0
  155. package/lib/esm/UsersApi.js.map +1 -0
  156. package/lib/esm/client.js +353 -0
  157. package/lib/esm/client.js.map +1 -0
  158. package/lib/esm/execute.js +118 -0
  159. package/lib/esm/execute.js.map +1 -0
  160. package/lib/esm/index.js +6 -0
  161. package/lib/esm/index.js.map +1 -0
  162. package/lib/esm/nodejs/NodeStreamSource.js +41 -0
  163. package/lib/esm/nodejs/NodeStreamSource.js.map +1 -0
  164. package/lib/esm/nodejs/index.js +2 -0
  165. package/lib/esm/nodejs/index.js.map +1 -0
  166. package/lib/esm/store/AnalyzeDocApi.js +52 -0
  167. package/lib/esm/store/AnalyzeDocApi.js.map +1 -0
  168. package/lib/esm/store/CollectionsApi.js +127 -0
  169. package/lib/esm/store/CollectionsApi.js.map +1 -0
  170. package/lib/esm/store/CommandsApi.js +13 -0
  171. package/lib/esm/store/CommandsApi.js.map +1 -0
  172. package/lib/esm/store/DashboardApi.js +178 -0
  173. package/lib/esm/store/DashboardApi.js.map +1 -0
  174. package/lib/esm/store/DataApi.js +429 -0
  175. package/lib/esm/store/DataApi.js.map +1 -0
  176. package/lib/esm/store/EmailApi.js +99 -0
  177. package/lib/esm/store/EmailApi.js.map +1 -0
  178. package/lib/esm/store/EmbeddingsApi.js +25 -0
  179. package/lib/esm/store/EmbeddingsApi.js.map +1 -0
  180. package/lib/esm/store/FilesApi.js +231 -0
  181. package/lib/esm/store/FilesApi.js.map +1 -0
  182. package/lib/esm/store/HiveMemoryApi.js +170 -0
  183. package/lib/esm/store/HiveMemoryApi.js.map +1 -0
  184. package/lib/esm/store/IndexingApi.js +203 -0
  185. package/lib/esm/store/IndexingApi.js.map +1 -0
  186. package/lib/esm/store/ObjectsApi.js +311 -0
  187. package/lib/esm/store/ObjectsApi.js.map +1 -0
  188. package/lib/esm/store/PendingAsksApi.js +39 -0
  189. package/lib/esm/store/PendingAsksApi.js.map +1 -0
  190. package/lib/esm/store/QueryApi.js +63 -0
  191. package/lib/esm/store/QueryApi.js.map +1 -0
  192. package/lib/esm/store/RenderingApi.js +80 -0
  193. package/lib/esm/store/RenderingApi.js.map +1 -0
  194. package/lib/esm/store/SchedulesApi.js +99 -0
  195. package/lib/esm/store/SchedulesApi.js.map +1 -0
  196. package/lib/esm/store/ToolsApi.js +17 -0
  197. package/lib/esm/store/ToolsApi.js.map +1 -0
  198. package/lib/esm/store/TypeCatalogApi.js +46 -0
  199. package/lib/esm/store/TypeCatalogApi.js.map +1 -0
  200. package/lib/esm/store/TypesApi.js +56 -0
  201. package/lib/esm/store/TypesApi.js.map +1 -0
  202. package/lib/esm/store/WorkersApi.js +12 -0
  203. package/lib/esm/store/WorkersApi.js.map +1 -0
  204. package/lib/esm/store/WorkflowsApi.js +598 -0
  205. package/lib/esm/store/WorkflowsApi.js.map +1 -0
  206. package/lib/esm/store/client.js +85 -0
  207. package/lib/esm/store/client.js.map +1 -0
  208. package/lib/esm/store/errors.js +7 -0
  209. package/lib/esm/store/errors.js.map +1 -0
  210. package/lib/esm/store/index.js +17 -0
  211. package/lib/esm/store/index.js.map +1 -0
  212. package/lib/esm/store/version.js +3 -0
  213. package/lib/esm/store/version.js.map +1 -0
  214. package/lib/tsconfig.tsbuildinfo +1 -0
  215. package/lib/types/AccountApi.d.ts +59 -0
  216. package/lib/types/AccountApi.d.ts.map +1 -0
  217. package/lib/types/AccountsApi.d.ts +7 -0
  218. package/lib/types/AccountsApi.d.ts.map +1 -0
  219. package/lib/types/AnalyticsApi.d.ts +11 -0
  220. package/lib/types/AnalyticsApi.d.ts.map +1 -0
  221. package/lib/types/ApiKeysApi.d.ts +42 -0
  222. package/lib/types/ApiKeysApi.d.ts.map +1 -0
  223. package/lib/types/AppsApi.d.ts +65 -0
  224. package/lib/types/AppsApi.d.ts.map +1 -0
  225. package/lib/types/AuditTrailApi.d.ts +6 -0
  226. package/lib/types/AuditTrailApi.d.ts.map +1 -0
  227. package/lib/types/CommandsApi.d.ts +10 -0
  228. package/lib/types/CommandsApi.d.ts.map +1 -0
  229. package/lib/types/EnvironmentsApi.d.ts +40 -0
  230. package/lib/types/EnvironmentsApi.d.ts.map +1 -0
  231. package/lib/types/GroupsApi.d.ts +65 -0
  232. package/lib/types/GroupsApi.d.ts.map +1 -0
  233. package/lib/types/IamApi.d.ts +41 -0
  234. package/lib/types/IamApi.d.ts.map +1 -0
  235. package/lib/types/InteractionBase.d.ts +22 -0
  236. package/lib/types/InteractionBase.d.ts.map +1 -0
  237. package/lib/types/InteractionCatalogApi.d.ts +36 -0
  238. package/lib/types/InteractionCatalogApi.d.ts.map +1 -0
  239. package/lib/types/InteractionOutput.d.ts +174 -0
  240. package/lib/types/InteractionOutput.d.ts.map +1 -0
  241. package/lib/types/InteractionResult.example.d.ts +6 -0
  242. package/lib/types/InteractionResult.example.d.ts.map +1 -0
  243. package/lib/types/InteractionsApi.d.ts +183 -0
  244. package/lib/types/InteractionsApi.d.ts.map +1 -0
  245. package/lib/types/MCPOAuthApi.d.ts +45 -0
  246. package/lib/types/MCPOAuthApi.d.ts.map +1 -0
  247. package/lib/types/ProjectsApi.d.ts +34 -0
  248. package/lib/types/ProjectsApi.d.ts.map +1 -0
  249. package/lib/types/PromptsApi.d.ts +106 -0
  250. package/lib/types/PromptsApi.d.ts.map +1 -0
  251. package/lib/types/RefsApi.d.ts +6 -0
  252. package/lib/types/RefsApi.d.ts.map +1 -0
  253. package/lib/types/RunsApi.d.ts +78 -0
  254. package/lib/types/RunsApi.d.ts.map +1 -0
  255. package/lib/types/SkillsApi.d.ts +26 -0
  256. package/lib/types/SkillsApi.d.ts.map +1 -0
  257. package/lib/types/StreamSource.d.ts +7 -0
  258. package/lib/types/StreamSource.d.ts.map +1 -0
  259. package/lib/types/TrainingApi.d.ts +27 -0
  260. package/lib/types/TrainingApi.d.ts.map +1 -0
  261. package/lib/types/UsersApi.d.ts +10 -0
  262. package/lib/types/UsersApi.d.ts.map +1 -0
  263. package/lib/types/client.d.ts +138 -0
  264. package/lib/types/client.d.ts.map +1 -0
  265. package/lib/types/execute.d.ts +37 -0
  266. package/lib/types/execute.d.ts.map +1 -0
  267. package/lib/types/index.d.ts +10 -0
  268. package/lib/types/index.d.ts.map +1 -0
  269. package/lib/types/nodejs/NodeStreamSource.d.ts +9 -0
  270. package/lib/types/nodejs/NodeStreamSource.d.ts.map +1 -0
  271. package/lib/types/nodejs/index.d.ts +1 -0
  272. package/lib/types/nodejs/index.d.ts.map +1 -0
  273. package/lib/types/store/AnalyzeDocApi.d.ts +17 -0
  274. package/lib/types/store/AnalyzeDocApi.d.ts.map +1 -0
  275. package/lib/types/store/CollectionsApi.d.ts +82 -0
  276. package/lib/types/store/CollectionsApi.d.ts.map +1 -0
  277. package/lib/types/store/CommandsApi.d.ts +10 -0
  278. package/lib/types/store/CommandsApi.d.ts.map +1 -0
  279. package/lib/types/store/DashboardApi.d.ts +149 -0
  280. package/lib/types/store/DashboardApi.d.ts.map +1 -0
  281. package/lib/types/store/DataApi.d.ts +392 -0
  282. package/lib/types/store/DataApi.d.ts.map +1 -0
  283. package/lib/types/store/EmailApi.d.ts +185 -0
  284. package/lib/types/store/EmailApi.d.ts.map +1 -0
  285. package/lib/types/store/EmbeddingsApi.d.ts +12 -0
  286. package/lib/types/store/EmbeddingsApi.d.ts.map +1 -0
  287. package/lib/types/store/FilesApi.d.ts +110 -0
  288. package/lib/types/store/FilesApi.d.ts.map +1 -0
  289. package/lib/types/store/HiveMemoryApi.d.ts +160 -0
  290. package/lib/types/store/HiveMemoryApi.d.ts.map +1 -0
  291. package/lib/types/store/IndexingApi.d.ts +140 -0
  292. package/lib/types/store/IndexingApi.d.ts.map +1 -0
  293. package/lib/types/store/ObjectsApi.d.ts +141 -0
  294. package/lib/types/store/ObjectsApi.d.ts.map +1 -0
  295. package/lib/types/store/PendingAsksApi.d.ts +79 -0
  296. package/lib/types/store/PendingAsksApi.d.ts.map +1 -0
  297. package/lib/types/store/QueryApi.d.ts +99 -0
  298. package/lib/types/store/QueryApi.d.ts.map +1 -0
  299. package/lib/types/store/RenderingApi.d.ts +34 -0
  300. package/lib/types/store/RenderingApi.d.ts.map +1 -0
  301. package/lib/types/store/SchedulesApi.d.ts +89 -0
  302. package/lib/types/store/SchedulesApi.d.ts.map +1 -0
  303. package/lib/types/store/ToolsApi.d.ts +13 -0
  304. package/lib/types/store/ToolsApi.d.ts.map +1 -0
  305. package/lib/types/store/TypeCatalogApi.d.ts +39 -0
  306. package/lib/types/store/TypeCatalogApi.d.ts.map +1 -0
  307. package/lib/types/store/TypesApi.d.ts +25 -0
  308. package/lib/types/store/TypesApi.d.ts.map +1 -0
  309. package/lib/types/store/WorkersApi.d.ts +6 -0
  310. package/lib/types/store/WorkersApi.d.ts.map +1 -0
  311. package/lib/types/store/WorkflowsApi.d.ts +170 -0
  312. package/lib/types/store/WorkflowsApi.d.ts.map +1 -0
  313. package/lib/types/store/client.d.ts +53 -0
  314. package/lib/types/store/client.d.ts.map +1 -0
  315. package/lib/types/store/errors.d.ts +4 -0
  316. package/lib/types/store/errors.d.ts.map +1 -0
  317. package/lib/types/store/index.d.ts +16 -0
  318. package/lib/types/store/index.d.ts.map +1 -0
  319. package/lib/types/store/version.d.ts +2 -0
  320. package/lib/types/store/version.d.ts.map +1 -0
  321. package/lib/vertesia-client.js +2 -0
  322. package/lib/vertesia-client.js.map +1 -0
  323. package/package.json +6 -6
  324. package/src/AuditTrailApi.ts +25 -0
  325. package/src/ProjectsApi.ts +31 -1
  326. package/src/RunsApi.ts +0 -7
  327. package/src/UsersApi.ts +9 -5
  328. package/src/client.ts +2 -0
  329. package/src/store/IndexingApi.ts +190 -2
  330. package/src/store/ObjectsApi.ts +12 -8
  331. package/src/store/RenderingApi.ts +105 -0
  332. package/src/store/TypeCatalogApi.ts +53 -0
  333. package/src/store/TypesApi.ts +3 -0
  334. package/src/store/client.ts +3 -3
  335. package/src/store/index.ts +2 -1
  336. package/src/store/version.ts +1 -1
  337. package/src/store/IndexingAdminApi.ts +0 -336
@@ -0,0 +1,231 @@
1
+ import { ApiTopic } from "@vertesia/api-fetch-client";
2
+ import { StreamSource } from "../StreamSource.js";
3
+ export const MEMORIES_PREFIX = "memories";
4
+ export const ARTIFACTS_PREFIX = "agents";
5
+ export function getMemoryFilePath(name) {
6
+ const nameWithExt = name.endsWith(".tar.gz") ? name : name + ".tar.gz";
7
+ return `${MEMORIES_PREFIX}/${nameWithExt}`;
8
+ }
9
+ /**
10
+ * Build the storage path for an agent artifact
11
+ * @param runId - The workflow run ID
12
+ * @param name - The artifact filename
13
+ */
14
+ export function getAgentArtifactPath(runId, name) {
15
+ return `${ARTIFACTS_PREFIX}/${runId}/${name}`;
16
+ }
17
+ export class FilesApi extends ApiTopic {
18
+ constructor(parent) {
19
+ super(parent, "/api/v1/files");
20
+ }
21
+ async deleteFile(path, prefix) {
22
+ const res = await this.delete(`/${path}`, { query: { prefix } });
23
+ return res.count;
24
+ }
25
+ /**
26
+ * get the metadata of a blob given its URI. Supported URI are:
27
+ * starting with s3:// and gs://.
28
+ * For s3 blobs use #region to specify the region. Ex: s3://bucket/key#us-west-2
29
+ * @param uri
30
+ * @returns
31
+ */
32
+ getMetadata(uri) {
33
+ return this.get("/metadata", {
34
+ query: {
35
+ file: uri,
36
+ },
37
+ });
38
+ }
39
+ /**
40
+ * Set custom metadata on a file
41
+ * @param file - The file path or URI
42
+ * @param metadata - Custom metadata key-value pairs
43
+ * @returns Success status
44
+ */
45
+ setFileMetadata(file, metadata) {
46
+ const payload = { file, metadata };
47
+ return this.put("/metadata", { payload });
48
+ }
49
+ /**
50
+ * Get or create a bucket for the project. If the bucket already exists, it does nothing.
51
+ * The bucket URI is returned.
52
+ * @returns
53
+ */
54
+ getOrCreateBucket() {
55
+ return this.post("/bucket");
56
+ }
57
+ getUploadUrl(payload) {
58
+ return this.post("/upload-url", {
59
+ payload,
60
+ });
61
+ }
62
+ // Strictly typed: provide either simple args or a full payload via a separate method
63
+ getDownloadUrl(file, name, disposition) {
64
+ const payload = { file, name, disposition };
65
+ return this.post("/download-url", { payload });
66
+ }
67
+ getDownloadUrlWithOptions(payload) {
68
+ return this.post("/download-url", { payload });
69
+ }
70
+ /**
71
+ * Upload content to a file and return the full path (including bucket name) of the uploaded file
72
+ * @param source
73
+ * @returns
74
+ */
75
+ async uploadFile(source) {
76
+ const isStream = source instanceof StreamSource;
77
+ const { url, id, path } = await this.getUploadUrl(source);
78
+ await fetch(url, {
79
+ method: "PUT",
80
+ body: isStream ? source.stream : source,
81
+ //@ts-ignore: duplex is not in the types. See https://github.com/node-fetch/node-fetch/issues/1769
82
+ duplex: isStream ? "half" : undefined,
83
+ headers: {
84
+ "Content-Type": source.type || "application/gzip",
85
+ },
86
+ })
87
+ .then((res) => {
88
+ if (res.ok) {
89
+ return res;
90
+ }
91
+ else {
92
+ console.log(res);
93
+ throw new Error(`Failed to upload file: ${res.statusText}`);
94
+ }
95
+ })
96
+ .catch((err) => {
97
+ console.error("Failed to upload file", { err, url, id, path });
98
+ throw err;
99
+ });
100
+ return id;
101
+ }
102
+ /**
103
+ *
104
+ * @param location can be a relative path in the project, a reference to a cloud storage, or a accessible HTTPS URL (typically signed URL)
105
+ * @returns ReadableStream
106
+ */
107
+ async downloadFile(location) {
108
+ //if start with HTTPS, no download url needed - assume it's signed already
109
+ const needSign = !location.startsWith("https:");
110
+ const { url } = needSign
111
+ ? await this.getDownloadUrl(location)
112
+ : { url: location };
113
+ const res = await fetch(url, {
114
+ method: "GET",
115
+ })
116
+ .then((res) => {
117
+ if (res.ok) {
118
+ return res;
119
+ }
120
+ else if (res.status === 404) {
121
+ throw new Error(`File at ${url} not found`); //TODO: type fetch error better with a fetch error class
122
+ }
123
+ else if (res.status === 403) {
124
+ throw new Error(`File at ${url} is forbidden`);
125
+ }
126
+ else {
127
+ console.log(res);
128
+ throw new Error(`Failed to download file ${location}: ${res.statusText}`);
129
+ }
130
+ })
131
+ .catch((err) => {
132
+ console.error(`Failed to download file ${location}.`, err);
133
+ throw err;
134
+ });
135
+ if (!res.body) {
136
+ throw new Error(`No body in response while downloading file ${location}`);
137
+ }
138
+ return res.body;
139
+ }
140
+ /**
141
+ * Copy a file to a new destination within the same bucket.
142
+ * @param source - Source file path (relative to project bucket)
143
+ * @param dest - Destination file path (relative to project bucket)
144
+ * @returns The destination file URI
145
+ */
146
+ async copyFile(source, dest) {
147
+ const response = await this.post("/copy", {
148
+ payload: { source, dest },
149
+ });
150
+ return response.dest;
151
+ }
152
+ async uploadMemoryPack(source) {
153
+ const fileId = getMemoryFilePath(source.name);
154
+ const nameWithExt = source.name.endsWith(".tar.gz")
155
+ ? source.name
156
+ : source.name + ".tar.gz";
157
+ if (source instanceof File) {
158
+ let file = source;
159
+ return this.uploadFile(new StreamSource(file.stream(), nameWithExt, file.type, fileId));
160
+ }
161
+ else {
162
+ return this.uploadFile(new StreamSource(source.stream, nameWithExt, source.type, fileId));
163
+ }
164
+ }
165
+ async downloadMemoryPack(name, gunzip = false) {
166
+ let stream = await this.downloadFile(getMemoryFilePath(name));
167
+ if (gunzip) {
168
+ const ds = new DecompressionStream("gzip");
169
+ stream = stream.pipeThrough(ds);
170
+ }
171
+ return stream;
172
+ }
173
+ // ==================== Agent Artifact Methods ====================
174
+ /**
175
+ * List files by prefix
176
+ * @param prefix - Path prefix to filter files
177
+ * @returns Array of file paths matching the prefix
178
+ */
179
+ listByPrefix(prefix) {
180
+ return this.get("/list", { query: { prefix } });
181
+ }
182
+ /**
183
+ * Upload an artifact for an agent run
184
+ * @param runId - The workflow run ID
185
+ * @param name - Artifact name (e.g., "output.json")
186
+ * @param source - File content source
187
+ * @returns The full path of the uploaded artifact
188
+ */
189
+ async uploadArtifact(runId, name, source) {
190
+ const artifactPath = getAgentArtifactPath(runId, name);
191
+ if (source instanceof File) {
192
+ const file = source;
193
+ return this.uploadFile(new StreamSource(file.stream(), name, file.type, artifactPath));
194
+ }
195
+ else {
196
+ return this.uploadFile(new StreamSource(source.stream, name, source.type, artifactPath));
197
+ }
198
+ }
199
+ /**
200
+ * Download an artifact from an agent run
201
+ * @param runId - The workflow run ID
202
+ * @param name - Artifact name
203
+ * @returns ReadableStream of the artifact content
204
+ */
205
+ async downloadArtifact(runId, name) {
206
+ const artifactPath = getAgentArtifactPath(runId, name);
207
+ return this.downloadFile(artifactPath);
208
+ }
209
+ /**
210
+ * Get download URL for an artifact
211
+ * @param runId - The workflow run ID
212
+ * @param name - Artifact name
213
+ * @param disposition - Content disposition (inline or attachment)
214
+ * @returns Signed URL response
215
+ */
216
+ getArtifactDownloadUrl(runId, name, disposition) {
217
+ const artifactPath = getAgentArtifactPath(runId, name);
218
+ return this.getDownloadUrl(artifactPath, name, disposition);
219
+ }
220
+ /**
221
+ * List artifacts for an agent run
222
+ * @param runId - The workflow run ID
223
+ * @returns Array of artifact file paths
224
+ */
225
+ async listArtifacts(runId) {
226
+ const prefix = `${ARTIFACTS_PREFIX}/${runId}/`;
227
+ const result = await this.listByPrefix(prefix);
228
+ return result.files;
229
+ }
230
+ }
231
+ //# sourceMappingURL=FilesApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FilesApi.js","sourceRoot":"","sources":["../../../src/store/FilesApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAOlE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,CAAC,MAAM,eAAe,GAAG,UAAU,CAAC;AAC1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,QAAQ,CAAC;AAEzC,MAAM,UAAU,iBAAiB,CAAC,IAAY;IAC1C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sBAAsB,CAClB,KAAa,EACb,IAAY,EACZ,WAAqC;QAErC,MAAM,YAAY,GAAG,oBAAoB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACvD,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC;IAChE,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,aAAa,CAAC,KAAa;QAC7B,MAAM,MAAM,GAAG,GAAG,gBAAgB,IAAI,KAAK,GAAG,CAAC;QAC/C,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO,MAAM,CAAC,KAAK,CAAC;IACxB,CAAC;CACJ"}
@@ -0,0 +1,170 @@
1
+ import { ApiTopic } from "@vertesia/api-fetch-client";
2
+ /**
3
+ * Client API for managing hive memories.
4
+ *
5
+ * Hive memory is a system for storing and retrieving agent learnings,
6
+ * enabling agents to learn from past runs and share knowledge.
7
+ */
8
+ export class HiveMemoryApi extends ApiTopic {
9
+ constructor(parent) {
10
+ super(parent, "/api/v1/hive-memory");
11
+ }
12
+ /**
13
+ * List memories in the project.
14
+ *
15
+ * @param options - Optional filters and pagination
16
+ */
17
+ list(options) {
18
+ const params = new URLSearchParams();
19
+ if (options?.category)
20
+ params.set('category', options.category);
21
+ if (options?.scope)
22
+ params.set('scope', options.scope);
23
+ if (options?.limit)
24
+ params.set('limit', String(options.limit));
25
+ if (options?.offset)
26
+ params.set('offset', String(options.offset));
27
+ const queryString = params.toString();
28
+ return this.get(queryString ? `/?${queryString}` : '/');
29
+ }
30
+ /**
31
+ * Retrieve a memory by ID.
32
+ */
33
+ retrieve(id) {
34
+ return this.get(`/${id}`);
35
+ }
36
+ /**
37
+ * Create a new hive memory.
38
+ *
39
+ * @param payload - Memory content including category, summary, and learnings
40
+ */
41
+ create(payload) {
42
+ return this.post("/", { payload });
43
+ }
44
+ /**
45
+ * Update an existing memory with new learnings.
46
+ *
47
+ * This merges new learnings with existing ones rather than replacing them.
48
+ *
49
+ * @param id - Memory ID
50
+ * @param payload - Fields to update/merge
51
+ */
52
+ update(id, payload) {
53
+ return this.put(`/${id}`, { payload });
54
+ }
55
+ /**
56
+ * Delete a memory.
57
+ *
58
+ * @param id - Memory ID
59
+ */
60
+ delete(id) {
61
+ return this.del(`/${id}`);
62
+ }
63
+ /**
64
+ * Search memories using semantic and keyword search.
65
+ *
66
+ * @param params - Search parameters including query, filters, and pagination
67
+ */
68
+ search(params) {
69
+ return this.post("/search", { payload: params });
70
+ }
71
+ /**
72
+ * Recall memories for an agent.
73
+ *
74
+ * This is the primary method for agents to retrieve relevant learnings.
75
+ * It searches for memories matching the task description and returns
76
+ * them formatted for agent consumption.
77
+ *
78
+ * @param taskDescription - Description of the current task
79
+ * @param options - Optional filters
80
+ *
81
+ * @example
82
+ * ```typescript
83
+ * const result = await client.hiveMemory.recall(
84
+ * "Extract financial data from PDF documents",
85
+ * {
86
+ * tools: ["extract_text", "analyze_document"],
87
+ * maxResults: 5
88
+ * }
89
+ * );
90
+ * ```
91
+ */
92
+ recall(taskDescription, options) {
93
+ return this.post("/recall", {
94
+ payload: {
95
+ task_description: taskDescription,
96
+ tools: options?.tools,
97
+ category: options?.category,
98
+ max_results: options?.maxResults,
99
+ }
100
+ });
101
+ }
102
+ /**
103
+ * Get a memory formatted for agent consumption.
104
+ *
105
+ * @param id - Memory ID
106
+ */
107
+ getFormatted(id) {
108
+ return this.get(`/${id}/formatted`);
109
+ }
110
+ /**
111
+ * Record that a memory was used.
112
+ *
113
+ * This increments the usage count and helps track memory effectiveness.
114
+ *
115
+ * @param id - Memory ID
116
+ */
117
+ recordUsage(id) {
118
+ return this.post(`/${id}/usage`, {});
119
+ }
120
+ /**
121
+ * Get memories by category.
122
+ *
123
+ * @param category - Task category (e.g., "document-analysis", "data-extraction")
124
+ * @param options - Pagination options
125
+ */
126
+ getByCategory(category, options) {
127
+ const params = new URLSearchParams();
128
+ if (options?.limit)
129
+ params.set('limit', String(options.limit));
130
+ if (options?.offset)
131
+ params.set('offset', String(options.offset));
132
+ const queryString = params.toString();
133
+ return this.get(`/category/${category}${queryString ? `?${queryString}` : ''}`);
134
+ }
135
+ /**
136
+ * Get memory statistics for the project.
137
+ */
138
+ getStats() {
139
+ return this.get("/stats");
140
+ }
141
+ /**
142
+ * Apply confidence decay to unused memories.
143
+ *
144
+ * Admin operation that reduces confidence scores for memories
145
+ * that haven't been used recently.
146
+ *
147
+ * @param options - Decay parameters
148
+ */
149
+ applyDecay(options) {
150
+ return this.post("/admin/decay", {
151
+ payload: {
152
+ days_threshold: options?.daysThreshold,
153
+ decay_rate: options?.decayRate,
154
+ }
155
+ });
156
+ }
157
+ /**
158
+ * Archive memories with low confidence scores.
159
+ *
160
+ * Admin operation that removes memories below a confidence threshold.
161
+ *
162
+ * @param threshold - Confidence threshold (0-1), default 0.2
163
+ */
164
+ archiveLowConfidence(threshold) {
165
+ return this.post("/admin/archive", {
166
+ payload: { threshold }
167
+ });
168
+ }
169
+ }
170
+ //# sourceMappingURL=HiveMemoryApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"HiveMemoryApi.js","sourceRoot":"","sources":["../../../src/store/HiveMemoryApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAoClE;;;;;GAKG;AACH,MAAM,OAAO,aAAc,SAAQ,QAAQ;IACvC,YAAY,MAAkB;QAC1B,KAAK,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAED;;;;OAIG;IACH,IAAI,CAAC,OAKJ;QACG,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;QACrC,IAAI,OAAO,EAAE,QAAQ;YAAE,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,OAAO,CAAC,QAAQ,CAAC,CAAC;QAChE,IAAI,OAAO,EAAE,KAAK;YAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,OAAO,CAAC,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E,OAAO,EAAE,SAAS;aACjC;SACJ,CAAC,CAAC;IACP,CAAC;IAED;;;;;;OAMG;IACH,oBAAoB,CAAC,SAAkB;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;YAC/B,OAAO,EAAE,EAAE,SAAS,EAAE;SACzB,CAAC,CAAC;IACP,CAAC;CACJ"}
@@ -0,0 +1,203 @@
1
+ import { ApiTopic } from "@vertesia/api-fetch-client";
2
+ /**
3
+ * API for indexing operations on content objects.
4
+ * Provides status, reindex, and configuration management.
5
+ *
6
+ * Internal endpoints (prefixed with /internal/) are used by Temporal workflow activities
7
+ * and require content_admin permission.
8
+ */
9
+ export class IndexingApi extends ApiTopic {
10
+ constructor(parent, basePath = "/api/v1/indexing") {
11
+ super(parent, basePath);
12
+ }
13
+ // ========================================================================
14
+ // User-facing endpoints
15
+ // ========================================================================
16
+ /**
17
+ * Get Elasticsearch status for the current project
18
+ */
19
+ async status() {
20
+ return this.get("/status");
21
+ }
22
+ /**
23
+ * Trigger a full reindex of all documents
24
+ * @param recreateIndex If true, drops and recreates the index before reindexing
25
+ */
26
+ async reindex(recreateIndex) {
27
+ return this.post("/reindex", { payload: { recreateIndex } });
28
+ }
29
+ /**
30
+ * Enable indexing for this project
31
+ */
32
+ async enableIndexing() {
33
+ return this.post("/enable-indexing");
34
+ }
35
+ /**
36
+ * Disable indexing for this project
37
+ */
38
+ async disableIndexing() {
39
+ return this.post("/disable-indexing");
40
+ }
41
+ /**
42
+ * Enable index-based queries for this project
43
+ * @deprecated Queries are now automatically enabled when indexing is enabled
44
+ */
45
+ async enableQueries() {
46
+ return this.post("/enable-queries");
47
+ }
48
+ /**
49
+ * Disable index-based queries for this project
50
+ * @deprecated Queries are now automatically enabled when indexing is enabled
51
+ */
52
+ async disableQueries() {
53
+ return this.post("/disable-queries");
54
+ }
55
+ // ========================================================================
56
+ // Internal endpoints - called by Temporal workflow activities
57
+ // ========================================================================
58
+ /**
59
+ * Index a single document to Elasticsearch
60
+ */
61
+ index(objectId, document) {
62
+ return this.post("/internal/index", {
63
+ payload: { objectId, document },
64
+ });
65
+ }
66
+ /**
67
+ * Delete a document from Elasticsearch
68
+ */
69
+ delete(objectId) {
70
+ return this.post("/internal/delete", {
71
+ payload: { objectId },
72
+ });
73
+ }
74
+ /**
75
+ * Bulk index multiple documents to Elasticsearch
76
+ *
77
+ * @param documents Array of documents to index
78
+ * @param targetIndex Optional explicit index name for zero-downtime reindexing
79
+ */
80
+ bulkIndex(documents, targetIndex) {
81
+ return this.post("/internal/bulk-index", {
82
+ payload: { documents, targetIndex },
83
+ });
84
+ }
85
+ /**
86
+ * Ensure Elasticsearch index exists for the project
87
+ *
88
+ * @param recreate If true, drops and recreates the index
89
+ */
90
+ ensureIndex(recreate) {
91
+ return this.post("/internal/ensure-index", {
92
+ payload: { recreate },
93
+ });
94
+ }
95
+ /**
96
+ * Create a new versioned index for reindexing (without alias)
97
+ * The alias will be swapped after reindexing completes via swapAlias
98
+ */
99
+ createReindexTarget() {
100
+ return this.post("/internal/create-reindex-target", {
101
+ payload: {},
102
+ });
103
+ }
104
+ /**
105
+ * Atomically swap the alias from old index to new index
106
+ *
107
+ * @param newIndexName The new index to point the alias to
108
+ * @param deleteOld If true, deletes the old index after swapping
109
+ */
110
+ swapAlias(newIndexName, deleteOld) {
111
+ return this.post("/internal/swap-alias", {
112
+ payload: { newIndexName, deleteOld },
113
+ });
114
+ }
115
+ /**
116
+ * Get Elasticsearch index statistics for the project
117
+ */
118
+ getStats() {
119
+ return this.post("/internal/stats", {
120
+ payload: {},
121
+ });
122
+ }
123
+ /**
124
+ * Get the _id range for reindexing (first, last, count)
125
+ * Used by workflow to set up cursor-based pagination
126
+ */
127
+ getReindexRange() {
128
+ return this.post("/internal/reindex-range", {
129
+ payload: {},
130
+ });
131
+ }
132
+ /**
133
+ * Fetch a batch of documents from MongoDB (without indexing)
134
+ * Used by pipeline approach: fetch next batch while indexing current
135
+ *
136
+ * @param cursor Cursor from previous batch (null for first batch)
137
+ * @param limit Maximum documents to fetch (default: 500)
138
+ */
139
+ fetchBatch(cursor, limit) {
140
+ return this.post("/internal/fetch-batch", {
141
+ payload: { cursor, limit },
142
+ });
143
+ }
144
+ /**
145
+ * Fetch and index a batch of documents (server-side)
146
+ * Uses cursor-based pagination for reliability
147
+ *
148
+ * @param cursor Cursor from previous batch (null for first batch)
149
+ * @param limit Maximum documents to process (default: 500)
150
+ * @param targetIndex Optional explicit index name for zero-downtime reindexing
151
+ * @param since Only index docs with updated_at >= this ISO timestamp (for catch-up after reindex)
152
+ */
153
+ indexBatch(cursor, limit, targetIndex, since) {
154
+ return this.post("/internal/index-batch", {
155
+ payload: { cursor, limit, targetIndex, since },
156
+ });
157
+ }
158
+ /**
159
+ * Trigger a reindex operation via Temporal workflow (internal version with more options)
160
+ *
161
+ * @param fullReindex If true, reindexes all documents in the project
162
+ * @param objectIds Specific object IDs to reindex (if not fullReindex)
163
+ * @param recreateIndex If true, recreates the index before reindexing
164
+ */
165
+ triggerReindex(options) {
166
+ return this.post("/internal/trigger-reindex", {
167
+ payload: options ?? {},
168
+ });
169
+ }
170
+ /**
171
+ * Fetch documents by their IDs from MongoDB (for retry workflow)
172
+ * Returns documents ready for bulk indexing
173
+ *
174
+ * @param objectIds Array of object IDs to fetch
175
+ */
176
+ fetchDocumentsByIds(objectIds) {
177
+ return this.post("/internal/fetch-by-ids", {
178
+ payload: { objectIds },
179
+ });
180
+ }
181
+ /**
182
+ * Bulk delete documents from Elasticsearch
183
+ *
184
+ * @param objectIds Array of object IDs to delete
185
+ */
186
+ bulkDelete(objectIds) {
187
+ return this.post("/internal/bulk-delete", {
188
+ payload: { objectIds },
189
+ });
190
+ }
191
+ /**
192
+ * Get detailed index configuration for the project
193
+ *
194
+ * Returns comprehensive information about the Elasticsearch index including
195
+ * status, embedding dimensions, field mappings, and project configuration.
196
+ */
197
+ getConfiguration() {
198
+ return this.post("/internal/configuration", {
199
+ payload: {},
200
+ });
201
+ }
202
+ }
203
+ //# sourceMappingURL=IndexingApi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IndexingApi.js","sourceRoot":"","sources":["../../../src/store/IndexingApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAc,MAAM,4BAA4B,CAAC;AAmBlE;;;;;;GAMG;AACH,MAAM,OAAO,WAAY,SAAQ,QAAQ;IAErC,YAAY,MAAkB,EAAE,WAAmB,kBAAkB;QACjE,KAAK,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC5B,CAAC;IAED,2EAA2E;IAC3E,wBAAwB;IACxB,2EAA2E;IAE3E;;OAEG;IACH,KAAK,CAAC,MAAM;QACR,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,OAAO,CAAC,aAAuB;QACjC,OAAO,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,cAAc;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACzC,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,eAAe;QACjB,OAAO,IAAI,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC;IAC1C,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,aAAa;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC;IACxC,CAAC;IAED;;;OAGG;IACH,KAAK,CAAC,cAAc;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;IACzC,CAAC;IAED,2EAA2E;IAC3E,8DAA8D;IAC9D,2EAA2E;IAE3E;;OAEG;IACH,KAAK,CAAC,QAAgB,EAAE,QAAmC;QACvD,OAAO,IAAI,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAChC,OAAO,EAAE,EAAE,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