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

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 (293) hide show
  1. package/package.json +4 -4
  2. package/src/store/HiveMemoryApi.ts +231 -0
  3. package/src/store/IndexingAdminApi.ts +336 -0
  4. package/src/store/IndexingApi.ts +62 -0
  5. package/src/store/QueryApi.ts +110 -0
  6. package/src/store/client.ts +8 -0
  7. package/src/store/index.ts +5 -0
  8. package/lib/cjs/AccountApi.js +0 -85
  9. package/lib/cjs/AccountApi.js.map +0 -1
  10. package/lib/cjs/AccountsApi.js +0 -16
  11. package/lib/cjs/AccountsApi.js.map +0 -1
  12. package/lib/cjs/AnalyticsApi.js +0 -41
  13. package/lib/cjs/AnalyticsApi.js.map +0 -1
  14. package/lib/cjs/ApiKeysApi.js +0 -63
  15. package/lib/cjs/ApiKeysApi.js.map +0 -1
  16. package/lib/cjs/AppsApi.js +0 -119
  17. package/lib/cjs/AppsApi.js.map +0 -1
  18. package/lib/cjs/CommandsApi.js +0 -19
  19. package/lib/cjs/CommandsApi.js.map +0 -1
  20. package/lib/cjs/EnvironmentsApi.js +0 -72
  21. package/lib/cjs/EnvironmentsApi.js.map +0 -1
  22. package/lib/cjs/GroupsApi.js +0 -78
  23. package/lib/cjs/GroupsApi.js.map +0 -1
  24. package/lib/cjs/IamApi.js +0 -53
  25. package/lib/cjs/IamApi.js.map +0 -1
  26. package/lib/cjs/InteractionBase.js +0 -44
  27. package/lib/cjs/InteractionBase.js.map +0 -1
  28. package/lib/cjs/InteractionCatalogApi.js +0 -64
  29. package/lib/cjs/InteractionCatalogApi.js.map +0 -1
  30. package/lib/cjs/InteractionOutput.js +0 -300
  31. package/lib/cjs/InteractionOutput.js.map +0 -1
  32. package/lib/cjs/InteractionResult.example.js +0 -57
  33. package/lib/cjs/InteractionResult.example.js.map +0 -1
  34. package/lib/cjs/InteractionsApi.js +0 -262
  35. package/lib/cjs/InteractionsApi.js.map +0 -1
  36. package/lib/cjs/MCPOAuthApi.js +0 -62
  37. package/lib/cjs/MCPOAuthApi.js.map +0 -1
  38. package/lib/cjs/ProjectsApi.js +0 -72
  39. package/lib/cjs/ProjectsApi.js.map +0 -1
  40. package/lib/cjs/PromptsApi.js +0 -133
  41. package/lib/cjs/PromptsApi.js.map +0 -1
  42. package/lib/cjs/RefsApi.js +0 -14
  43. package/lib/cjs/RefsApi.js.map +0 -1
  44. package/lib/cjs/RunsApi.js +0 -113
  45. package/lib/cjs/RunsApi.js.map +0 -1
  46. package/lib/cjs/SkillsApi.js +0 -39
  47. package/lib/cjs/SkillsApi.js.map +0 -1
  48. package/lib/cjs/StreamSource.js +0 -17
  49. package/lib/cjs/StreamSource.js.map +0 -1
  50. package/lib/cjs/TrainingApi.js +0 -54
  51. package/lib/cjs/TrainingApi.js.map +0 -1
  52. package/lib/cjs/UsersApi.js +0 -13
  53. package/lib/cjs/UsersApi.js.map +0 -1
  54. package/lib/cjs/client.js +0 -360
  55. package/lib/cjs/client.js.map +0 -1
  56. package/lib/cjs/execute.js +0 -158
  57. package/lib/cjs/execute.js.map +0 -1
  58. package/lib/cjs/index.js +0 -22
  59. package/lib/cjs/index.js.map +0 -1
  60. package/lib/cjs/nodejs/NodeStreamSource.js +0 -45
  61. package/lib/cjs/nodejs/NodeStreamSource.js.map +0 -1
  62. package/lib/cjs/nodejs/index.js +0 -18
  63. package/lib/cjs/nodejs/index.js.map +0 -1
  64. package/lib/cjs/package.json +0 -3
  65. package/lib/cjs/store/AnalyzeDocApi.js +0 -56
  66. package/lib/cjs/store/AnalyzeDocApi.js.map +0 -1
  67. package/lib/cjs/store/CollectionsApi.js +0 -131
  68. package/lib/cjs/store/CollectionsApi.js.map +0 -1
  69. package/lib/cjs/store/CommandsApi.js +0 -17
  70. package/lib/cjs/store/CommandsApi.js.map +0 -1
  71. package/lib/cjs/store/DashboardApi.js +0 -182
  72. package/lib/cjs/store/DashboardApi.js.map +0 -1
  73. package/lib/cjs/store/DataApi.js +0 -433
  74. package/lib/cjs/store/DataApi.js.map +0 -1
  75. package/lib/cjs/store/EmailApi.js +0 -103
  76. package/lib/cjs/store/EmailApi.js.map +0 -1
  77. package/lib/cjs/store/EmbeddingsApi.js +0 -29
  78. package/lib/cjs/store/EmbeddingsApi.js.map +0 -1
  79. package/lib/cjs/store/FilesApi.js +0 -237
  80. package/lib/cjs/store/FilesApi.js.map +0 -1
  81. package/lib/cjs/store/ObjectsApi.js +0 -314
  82. package/lib/cjs/store/ObjectsApi.js.map +0 -1
  83. package/lib/cjs/store/PendingAsksApi.js +0 -43
  84. package/lib/cjs/store/PendingAsksApi.js.map +0 -1
  85. package/lib/cjs/store/SchedulesApi.js +0 -103
  86. package/lib/cjs/store/SchedulesApi.js.map +0 -1
  87. package/lib/cjs/store/ToolsApi.js +0 -21
  88. package/lib/cjs/store/ToolsApi.js.map +0 -1
  89. package/lib/cjs/store/TypesApi.js +0 -57
  90. package/lib/cjs/store/TypesApi.js.map +0 -1
  91. package/lib/cjs/store/WorkersApi.js +0 -16
  92. package/lib/cjs/store/WorkersApi.js.map +0 -1
  93. package/lib/cjs/store/WorkflowsApi.js +0 -604
  94. package/lib/cjs/store/WorkflowsApi.js.map +0 -1
  95. package/lib/cjs/store/client.js +0 -81
  96. package/lib/cjs/store/client.js.map +0 -1
  97. package/lib/cjs/store/errors.js +0 -11
  98. package/lib/cjs/store/errors.js.map +0 -1
  99. package/lib/cjs/store/index.js +0 -27
  100. package/lib/cjs/store/index.js.map +0 -1
  101. package/lib/cjs/store/version.js +0 -6
  102. package/lib/cjs/store/version.js.map +0 -1
  103. package/lib/esm/AccountApi.js +0 -82
  104. package/lib/esm/AccountApi.js.map +0 -1
  105. package/lib/esm/AccountsApi.js +0 -13
  106. package/lib/esm/AccountsApi.js.map +0 -1
  107. package/lib/esm/AnalyticsApi.js +0 -38
  108. package/lib/esm/AnalyticsApi.js.map +0 -1
  109. package/lib/esm/ApiKeysApi.js +0 -59
  110. package/lib/esm/ApiKeysApi.js.map +0 -1
  111. package/lib/esm/AppsApi.js +0 -116
  112. package/lib/esm/AppsApi.js.map +0 -1
  113. package/lib/esm/CommandsApi.js +0 -16
  114. package/lib/esm/CommandsApi.js.map +0 -1
  115. package/lib/esm/EnvironmentsApi.js +0 -69
  116. package/lib/esm/EnvironmentsApi.js.map +0 -1
  117. package/lib/esm/GroupsApi.js +0 -74
  118. package/lib/esm/GroupsApi.js.map +0 -1
  119. package/lib/esm/IamApi.js +0 -47
  120. package/lib/esm/IamApi.js.map +0 -1
  121. package/lib/esm/InteractionBase.js +0 -40
  122. package/lib/esm/InteractionBase.js.map +0 -1
  123. package/lib/esm/InteractionCatalogApi.js +0 -60
  124. package/lib/esm/InteractionCatalogApi.js.map +0 -1
  125. package/lib/esm/InteractionOutput.js +0 -293
  126. package/lib/esm/InteractionOutput.js.map +0 -1
  127. package/lib/esm/InteractionResult.example.js +0 -55
  128. package/lib/esm/InteractionResult.example.js.map +0 -1
  129. package/lib/esm/InteractionsApi.js +0 -259
  130. package/lib/esm/InteractionsApi.js.map +0 -1
  131. package/lib/esm/MCPOAuthApi.js +0 -59
  132. package/lib/esm/MCPOAuthApi.js.map +0 -1
  133. package/lib/esm/ProjectsApi.js +0 -69
  134. package/lib/esm/ProjectsApi.js.map +0 -1
  135. package/lib/esm/PromptsApi.js +0 -130
  136. package/lib/esm/PromptsApi.js.map +0 -1
  137. package/lib/esm/RefsApi.js +0 -10
  138. package/lib/esm/RefsApi.js.map +0 -1
  139. package/lib/esm/RunsApi.js +0 -109
  140. package/lib/esm/RunsApi.js.map +0 -1
  141. package/lib/esm/SkillsApi.js +0 -36
  142. package/lib/esm/SkillsApi.js.map +0 -1
  143. package/lib/esm/StreamSource.js +0 -13
  144. package/lib/esm/StreamSource.js.map +0 -1
  145. package/lib/esm/TrainingApi.js +0 -51
  146. package/lib/esm/TrainingApi.js.map +0 -1
  147. package/lib/esm/UsersApi.js +0 -10
  148. package/lib/esm/UsersApi.js.map +0 -1
  149. package/lib/esm/client.js +0 -351
  150. package/lib/esm/client.js.map +0 -1
  151. package/lib/esm/execute.js +0 -118
  152. package/lib/esm/execute.js.map +0 -1
  153. package/lib/esm/index.js +0 -6
  154. package/lib/esm/index.js.map +0 -1
  155. package/lib/esm/nodejs/NodeStreamSource.js +0 -41
  156. package/lib/esm/nodejs/NodeStreamSource.js.map +0 -1
  157. package/lib/esm/nodejs/index.js +0 -2
  158. package/lib/esm/nodejs/index.js.map +0 -1
  159. package/lib/esm/store/AnalyzeDocApi.js +0 -52
  160. package/lib/esm/store/AnalyzeDocApi.js.map +0 -1
  161. package/lib/esm/store/CollectionsApi.js +0 -127
  162. package/lib/esm/store/CollectionsApi.js.map +0 -1
  163. package/lib/esm/store/CommandsApi.js +0 -13
  164. package/lib/esm/store/CommandsApi.js.map +0 -1
  165. package/lib/esm/store/DashboardApi.js +0 -178
  166. package/lib/esm/store/DashboardApi.js.map +0 -1
  167. package/lib/esm/store/DataApi.js +0 -429
  168. package/lib/esm/store/DataApi.js.map +0 -1
  169. package/lib/esm/store/EmailApi.js +0 -99
  170. package/lib/esm/store/EmailApi.js.map +0 -1
  171. package/lib/esm/store/EmbeddingsApi.js +0 -25
  172. package/lib/esm/store/EmbeddingsApi.js.map +0 -1
  173. package/lib/esm/store/FilesApi.js +0 -231
  174. package/lib/esm/store/FilesApi.js.map +0 -1
  175. package/lib/esm/store/ObjectsApi.js +0 -309
  176. package/lib/esm/store/ObjectsApi.js.map +0 -1
  177. package/lib/esm/store/PendingAsksApi.js +0 -39
  178. package/lib/esm/store/PendingAsksApi.js.map +0 -1
  179. package/lib/esm/store/SchedulesApi.js +0 -99
  180. package/lib/esm/store/SchedulesApi.js.map +0 -1
  181. package/lib/esm/store/ToolsApi.js +0 -17
  182. package/lib/esm/store/ToolsApi.js.map +0 -1
  183. package/lib/esm/store/TypesApi.js +0 -53
  184. package/lib/esm/store/TypesApi.js.map +0 -1
  185. package/lib/esm/store/WorkersApi.js +0 -12
  186. package/lib/esm/store/WorkersApi.js.map +0 -1
  187. package/lib/esm/store/WorkflowsApi.js +0 -598
  188. package/lib/esm/store/WorkflowsApi.js.map +0 -1
  189. package/lib/esm/store/client.js +0 -77
  190. package/lib/esm/store/client.js.map +0 -1
  191. package/lib/esm/store/errors.js +0 -7
  192. package/lib/esm/store/errors.js.map +0 -1
  193. package/lib/esm/store/index.js +0 -11
  194. package/lib/esm/store/index.js.map +0 -1
  195. package/lib/esm/store/version.js +0 -3
  196. package/lib/esm/store/version.js.map +0 -1
  197. package/lib/tsconfig.tsbuildinfo +0 -1
  198. package/lib/types/AccountApi.d.ts +0 -59
  199. package/lib/types/AccountApi.d.ts.map +0 -1
  200. package/lib/types/AccountsApi.d.ts +0 -7
  201. package/lib/types/AccountsApi.d.ts.map +0 -1
  202. package/lib/types/AnalyticsApi.d.ts +0 -11
  203. package/lib/types/AnalyticsApi.d.ts.map +0 -1
  204. package/lib/types/ApiKeysApi.d.ts +0 -42
  205. package/lib/types/ApiKeysApi.d.ts.map +0 -1
  206. package/lib/types/AppsApi.d.ts +0 -65
  207. package/lib/types/AppsApi.d.ts.map +0 -1
  208. package/lib/types/CommandsApi.d.ts +0 -10
  209. package/lib/types/CommandsApi.d.ts.map +0 -1
  210. package/lib/types/EnvironmentsApi.d.ts +0 -40
  211. package/lib/types/EnvironmentsApi.d.ts.map +0 -1
  212. package/lib/types/GroupsApi.d.ts +0 -65
  213. package/lib/types/GroupsApi.d.ts.map +0 -1
  214. package/lib/types/IamApi.d.ts +0 -41
  215. package/lib/types/IamApi.d.ts.map +0 -1
  216. package/lib/types/InteractionBase.d.ts +0 -22
  217. package/lib/types/InteractionBase.d.ts.map +0 -1
  218. package/lib/types/InteractionCatalogApi.d.ts +0 -36
  219. package/lib/types/InteractionCatalogApi.d.ts.map +0 -1
  220. package/lib/types/InteractionOutput.d.ts +0 -174
  221. package/lib/types/InteractionOutput.d.ts.map +0 -1
  222. package/lib/types/InteractionResult.example.d.ts +0 -6
  223. package/lib/types/InteractionResult.example.d.ts.map +0 -1
  224. package/lib/types/InteractionsApi.d.ts +0 -183
  225. package/lib/types/InteractionsApi.d.ts.map +0 -1
  226. package/lib/types/MCPOAuthApi.d.ts +0 -45
  227. package/lib/types/MCPOAuthApi.d.ts.map +0 -1
  228. package/lib/types/ProjectsApi.d.ts +0 -28
  229. package/lib/types/ProjectsApi.d.ts.map +0 -1
  230. package/lib/types/PromptsApi.d.ts +0 -106
  231. package/lib/types/PromptsApi.d.ts.map +0 -1
  232. package/lib/types/RefsApi.d.ts +0 -6
  233. package/lib/types/RefsApi.d.ts.map +0 -1
  234. package/lib/types/RunsApi.d.ts +0 -79
  235. package/lib/types/RunsApi.d.ts.map +0 -1
  236. package/lib/types/SkillsApi.d.ts +0 -26
  237. package/lib/types/SkillsApi.d.ts.map +0 -1
  238. package/lib/types/StreamSource.d.ts +0 -7
  239. package/lib/types/StreamSource.d.ts.map +0 -1
  240. package/lib/types/TrainingApi.d.ts +0 -27
  241. package/lib/types/TrainingApi.d.ts.map +0 -1
  242. package/lib/types/UsersApi.d.ts +0 -6
  243. package/lib/types/UsersApi.d.ts.map +0 -1
  244. package/lib/types/client.d.ts +0 -136
  245. package/lib/types/client.d.ts.map +0 -1
  246. package/lib/types/execute.d.ts +0 -37
  247. package/lib/types/execute.d.ts.map +0 -1
  248. package/lib/types/index.d.ts +0 -10
  249. package/lib/types/index.d.ts.map +0 -1
  250. package/lib/types/nodejs/NodeStreamSource.d.ts +0 -9
  251. package/lib/types/nodejs/NodeStreamSource.d.ts.map +0 -1
  252. package/lib/types/nodejs/index.d.ts +0 -1
  253. package/lib/types/nodejs/index.d.ts.map +0 -1
  254. package/lib/types/store/AnalyzeDocApi.d.ts +0 -17
  255. package/lib/types/store/AnalyzeDocApi.d.ts.map +0 -1
  256. package/lib/types/store/CollectionsApi.d.ts +0 -82
  257. package/lib/types/store/CollectionsApi.d.ts.map +0 -1
  258. package/lib/types/store/CommandsApi.d.ts +0 -10
  259. package/lib/types/store/CommandsApi.d.ts.map +0 -1
  260. package/lib/types/store/DashboardApi.d.ts +0 -149
  261. package/lib/types/store/DashboardApi.d.ts.map +0 -1
  262. package/lib/types/store/DataApi.d.ts +0 -392
  263. package/lib/types/store/DataApi.d.ts.map +0 -1
  264. package/lib/types/store/EmailApi.d.ts +0 -185
  265. package/lib/types/store/EmailApi.d.ts.map +0 -1
  266. package/lib/types/store/EmbeddingsApi.d.ts +0 -12
  267. package/lib/types/store/EmbeddingsApi.d.ts.map +0 -1
  268. package/lib/types/store/FilesApi.d.ts +0 -110
  269. package/lib/types/store/FilesApi.d.ts.map +0 -1
  270. package/lib/types/store/ObjectsApi.d.ts +0 -139
  271. package/lib/types/store/ObjectsApi.d.ts.map +0 -1
  272. package/lib/types/store/PendingAsksApi.d.ts +0 -79
  273. package/lib/types/store/PendingAsksApi.d.ts.map +0 -1
  274. package/lib/types/store/SchedulesApi.d.ts +0 -89
  275. package/lib/types/store/SchedulesApi.d.ts.map +0 -1
  276. package/lib/types/store/ToolsApi.d.ts +0 -13
  277. package/lib/types/store/ToolsApi.d.ts.map +0 -1
  278. package/lib/types/store/TypesApi.d.ts +0 -23
  279. package/lib/types/store/TypesApi.d.ts.map +0 -1
  280. package/lib/types/store/WorkersApi.d.ts +0 -6
  281. package/lib/types/store/WorkersApi.d.ts.map +0 -1
  282. package/lib/types/store/WorkflowsApi.d.ts +0 -170
  283. package/lib/types/store/WorkflowsApi.d.ts.map +0 -1
  284. package/lib/types/store/client.d.ts +0 -45
  285. package/lib/types/store/client.d.ts.map +0 -1
  286. package/lib/types/store/errors.d.ts +0 -4
  287. package/lib/types/store/errors.d.ts.map +0 -1
  288. package/lib/types/store/index.d.ts +0 -10
  289. package/lib/types/store/index.d.ts.map +0 -1
  290. package/lib/types/store/version.d.ts +0 -2
  291. package/lib/types/store/version.d.ts.map +0 -1
  292. package/lib/vertesia-client.js +0 -2
  293. package/lib/vertesia-client.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertesia/client",
3
- "version": "1.0.0-dev.20260128.144200",
3
+ "version": "1.0.0-dev.20260203.130115Z",
4
4
  "type": "module",
5
5
  "types": "./lib/types/index.d.ts",
6
6
  "files": [
@@ -22,9 +22,9 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "eventsource": "^3.0.6",
25
- "@vertesia/api-fetch-client": "1.0.0-dev.20260128.144200",
26
- "@vertesia/common": "1.0.0-dev.20260128.144200",
27
- "@llumiverse/common": "1.0.0-dev.20260128.144200"
25
+ "@vertesia/api-fetch-client": "1.0.0-dev.20260203.130115Z",
26
+ "@llumiverse/common": "1.0.0-dev.20260202.145450Z",
27
+ "@vertesia/common": "1.0.0-dev.20260203.130115Z"
28
28
  },
29
29
  "ts_dual_module": {
30
30
  "outDir": "lib"
@@ -0,0 +1,231 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import {
3
+ CreateHiveMemoryPayload,
4
+ FormattedMemoryForAgent,
5
+ HiveMemory,
6
+ HiveMemorySearchParams,
7
+ HiveMemorySearchResult,
8
+ UpdateHiveMemoryPayload,
9
+ } from "@vertesia/common";
10
+
11
+ /**
12
+ * Statistics about hive memories in the project
13
+ */
14
+ export interface HiveMemoryStats {
15
+ total_memories: number;
16
+ by_category: Array<{
17
+ category: string;
18
+ count: number;
19
+ avg_confidence: number;
20
+ total_usage: number;
21
+ }>;
22
+ overall: {
23
+ avgConfidence: number;
24
+ avgUsage: number;
25
+ totalContributions: number;
26
+ };
27
+ }
28
+
29
+ /**
30
+ * Result from recall endpoint
31
+ */
32
+ export interface RecallResult {
33
+ memories: FormattedMemoryForAgent[];
34
+ count: number;
35
+ }
36
+
37
+ /**
38
+ * Client API for managing hive memories.
39
+ *
40
+ * Hive memory is a system for storing and retrieving agent learnings,
41
+ * enabling agents to learn from past runs and share knowledge.
42
+ */
43
+ export class HiveMemoryApi extends ApiTopic {
44
+ constructor(parent: ClientBase) {
45
+ super(parent, "/api/v1/hive-memory");
46
+ }
47
+
48
+ /**
49
+ * List memories in the project.
50
+ *
51
+ * @param options - Optional filters and pagination
52
+ */
53
+ list(options?: {
54
+ category?: string;
55
+ scope?: string;
56
+ limit?: number;
57
+ offset?: number;
58
+ }): Promise<HiveMemory[]> {
59
+ const params = new URLSearchParams();
60
+ if (options?.category) params.set('category', options.category);
61
+ if (options?.scope) params.set('scope', options.scope);
62
+ if (options?.limit) params.set('limit', String(options.limit));
63
+ if (options?.offset) params.set('offset', String(options.offset));
64
+
65
+ const queryString = params.toString();
66
+ return this.get(queryString ? `/?${queryString}` : '/');
67
+ }
68
+
69
+ /**
70
+ * Retrieve a memory by ID.
71
+ */
72
+ retrieve(id: string): Promise<HiveMemory> {
73
+ return this.get(`/${id}`);
74
+ }
75
+
76
+ /**
77
+ * Create a new hive memory.
78
+ *
79
+ * @param payload - Memory content including category, summary, and learnings
80
+ */
81
+ create(payload: CreateHiveMemoryPayload): Promise<HiveMemory> {
82
+ return this.post("/", { payload });
83
+ }
84
+
85
+ /**
86
+ * Update an existing memory with new learnings.
87
+ *
88
+ * This merges new learnings with existing ones rather than replacing them.
89
+ *
90
+ * @param id - Memory ID
91
+ * @param payload - Fields to update/merge
92
+ */
93
+ update(id: string, payload: UpdateHiveMemoryPayload): Promise<HiveMemory> {
94
+ return this.put(`/${id}`, { payload });
95
+ }
96
+
97
+ /**
98
+ * Delete a memory.
99
+ *
100
+ * @param id - Memory ID
101
+ */
102
+ delete(id: string): Promise<{ id: string; deleted: boolean }> {
103
+ return this.del(`/${id}`);
104
+ }
105
+
106
+ /**
107
+ * Search memories using semantic and keyword search.
108
+ *
109
+ * @param params - Search parameters including query, filters, and pagination
110
+ */
111
+ search(params: HiveMemorySearchParams): Promise<HiveMemorySearchResult> {
112
+ return this.post("/search", { payload: params });
113
+ }
114
+
115
+ /**
116
+ * Recall memories for an agent.
117
+ *
118
+ * This is the primary method for agents to retrieve relevant learnings.
119
+ * It searches for memories matching the task description and returns
120
+ * them formatted for agent consumption.
121
+ *
122
+ * @param taskDescription - Description of the current task
123
+ * @param options - Optional filters
124
+ *
125
+ * @example
126
+ * ```typescript
127
+ * const result = await client.hiveMemory.recall(
128
+ * "Extract financial data from PDF documents",
129
+ * {
130
+ * tools: ["extract_text", "analyze_document"],
131
+ * maxResults: 5
132
+ * }
133
+ * );
134
+ * ```
135
+ */
136
+ recall(
137
+ taskDescription: string,
138
+ options?: {
139
+ tools?: string[];
140
+ category?: string;
141
+ maxResults?: number;
142
+ }
143
+ ): Promise<RecallResult> {
144
+ return this.post("/recall", {
145
+ payload: {
146
+ task_description: taskDescription,
147
+ tools: options?.tools,
148
+ category: options?.category,
149
+ max_results: options?.maxResults,
150
+ }
151
+ });
152
+ }
153
+
154
+ /**
155
+ * Get a memory formatted for agent consumption.
156
+ *
157
+ * @param id - Memory ID
158
+ */
159
+ getFormatted(id: string): Promise<FormattedMemoryForAgent> {
160
+ return this.get(`/${id}/formatted`);
161
+ }
162
+
163
+ /**
164
+ * Record that a memory was used.
165
+ *
166
+ * This increments the usage count and helps track memory effectiveness.
167
+ *
168
+ * @param id - Memory ID
169
+ */
170
+ recordUsage(id: string): Promise<{ success: boolean }> {
171
+ return this.post(`/${id}/usage`, {});
172
+ }
173
+
174
+ /**
175
+ * Get memories by category.
176
+ *
177
+ * @param category - Task category (e.g., "document-analysis", "data-extraction")
178
+ * @param options - Pagination options
179
+ */
180
+ getByCategory(
181
+ category: string,
182
+ options?: { limit?: number; offset?: number }
183
+ ): Promise<HiveMemory[]> {
184
+ const params = new URLSearchParams();
185
+ if (options?.limit) params.set('limit', String(options.limit));
186
+ if (options?.offset) params.set('offset', String(options.offset));
187
+
188
+ const queryString = params.toString();
189
+ return this.get(`/category/${category}${queryString ? `?${queryString}` : ''}`);
190
+ }
191
+
192
+ /**
193
+ * Get memory statistics for the project.
194
+ */
195
+ getStats(): Promise<HiveMemoryStats> {
196
+ return this.get("/stats");
197
+ }
198
+
199
+ /**
200
+ * Apply confidence decay to unused memories.
201
+ *
202
+ * Admin operation that reduces confidence scores for memories
203
+ * that haven't been used recently.
204
+ *
205
+ * @param options - Decay parameters
206
+ */
207
+ applyDecay(options?: {
208
+ daysThreshold?: number;
209
+ decayRate?: number;
210
+ }): Promise<{ modified_count: number }> {
211
+ return this.post("/admin/decay", {
212
+ payload: {
213
+ days_threshold: options?.daysThreshold,
214
+ decay_rate: options?.decayRate,
215
+ }
216
+ });
217
+ }
218
+
219
+ /**
220
+ * Archive memories with low confidence scores.
221
+ *
222
+ * Admin operation that removes memories below a confidence threshold.
223
+ *
224
+ * @param threshold - Confidence threshold (0-1), default 0.2
225
+ */
226
+ archiveLowConfidence(threshold?: number): Promise<{ archived_count: number }> {
227
+ return this.post("/admin/archive", {
228
+ payload: { threshold }
229
+ });
230
+ }
231
+ }
@@ -0,0 +1,336 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+
3
+ /**
4
+ * Document data structure for Elasticsearch indexing
5
+ */
6
+ export interface ElasticsearchDocumentData {
7
+ name?: string;
8
+ text?: string;
9
+ properties?: Record<string, unknown>;
10
+ status?: string;
11
+ type?: {
12
+ id?: string;
13
+ name?: string;
14
+ };
15
+ security?: {
16
+ 'content:read'?: string[];
17
+ 'content:write'?: string[];
18
+ 'content:delete'?: string[];
19
+ };
20
+ revision?: {
21
+ head?: boolean;
22
+ root?: string;
23
+ };
24
+ embeddings_text?: number[];
25
+ embeddings_image?: number[];
26
+ embeddings_properties?: number[];
27
+ created_at?: Date | string;
28
+ updated_at?: Date | string;
29
+ }
30
+
31
+ /**
32
+ * Result from bulk indexing
33
+ */
34
+ export interface BulkIndexResult {
35
+ successful: number;
36
+ failed: number;
37
+ }
38
+
39
+ /**
40
+ * Result from creating a reindex target
41
+ */
42
+ export interface CreateReindexTargetResult {
43
+ created: boolean;
44
+ indexName: string;
45
+ aliasName: string;
46
+ version: number;
47
+ }
48
+
49
+ /**
50
+ * Result from getting reindex range
51
+ */
52
+ export interface ReindexRangeResult {
53
+ first: string | null;
54
+ last: string | null;
55
+ count: number;
56
+ }
57
+
58
+ /**
59
+ * Result from fetching a batch
60
+ */
61
+ export interface FetchBatchResult {
62
+ documents: Array<{
63
+ id: string;
64
+ document: ElasticsearchDocumentData;
65
+ }>;
66
+ nextCursor: string | null;
67
+ done: boolean;
68
+ }
69
+
70
+ /**
71
+ * Result from indexing a batch
72
+ */
73
+ export interface IndexBatchResult {
74
+ successful: number;
75
+ failed: number;
76
+ processed: number;
77
+ nextCursor: string | null;
78
+ done: boolean;
79
+ }
80
+
81
+ /**
82
+ * Result from triggering a reindex
83
+ */
84
+ export interface TriggerReindexResult {
85
+ status: string;
86
+ workflow?: string;
87
+ workflowId?: string;
88
+ runId?: string;
89
+ objectCount?: number;
90
+ reason?: string;
91
+ enabled?: boolean;
92
+ }
93
+
94
+ /**
95
+ * Elasticsearch index statistics
96
+ */
97
+ export interface ElasticsearchIndexStats {
98
+ enabled: boolean;
99
+ exists?: boolean;
100
+ documentCount?: number;
101
+ sizeInBytes?: number;
102
+ indexName?: string;
103
+ aliasName?: string;
104
+ }
105
+
106
+ /**
107
+ * Embedding configuration for a single type
108
+ */
109
+ export interface EmbeddingTypeConfig {
110
+ environment?: string;
111
+ dimensions?: number;
112
+ model?: string;
113
+ provider?: string;
114
+ enabled?: boolean;
115
+ }
116
+
117
+ /**
118
+ * Detailed index configuration
119
+ */
120
+ export interface IndexConfiguration {
121
+ enabled: boolean;
122
+ exists?: boolean;
123
+ indexName?: string;
124
+ aliasName?: string;
125
+ version?: number;
126
+ documentCount?: number;
127
+ sizeInBytes?: number;
128
+ embeddingDimensions?: {
129
+ text?: number;
130
+ image?: number;
131
+ properties?: number;
132
+ };
133
+ fieldMappings?: Record<string, unknown>;
134
+ projectEmbeddingsConfig?: {
135
+ text?: EmbeddingTypeConfig;
136
+ image?: EmbeddingTypeConfig;
137
+ properties?: EmbeddingTypeConfig;
138
+ };
139
+ createdAt?: Date | null;
140
+ }
141
+
142
+ /**
143
+ * Result from fetching documents by IDs
144
+ */
145
+ export interface FetchDocumentsByIdsResult {
146
+ documents: Array<{
147
+ id: string;
148
+ document: ElasticsearchDocumentData;
149
+ }>;
150
+ notFound: string[];
151
+ }
152
+
153
+ /**
154
+ * Result from bulk delete
155
+ */
156
+ export interface BulkDeleteResult {
157
+ successful: number;
158
+ failed: number;
159
+ }
160
+
161
+ /**
162
+ * Admin API for Elasticsearch operations
163
+ *
164
+ * These methods are called by Temporal workflow activities to perform
165
+ * Elasticsearch operations. They require content admin permissions.
166
+ */
167
+ export class IndexingAdminApi extends ApiTopic {
168
+
169
+ constructor(parent: ClientBase, basePath: string = "/admin/elasticsearch") {
170
+ super(parent, basePath);
171
+ }
172
+
173
+ /**
174
+ * Index a single document to Elasticsearch
175
+ */
176
+ index(objectId: string, document: ElasticsearchDocumentData): Promise<{ status: string; objectId: string }> {
177
+ return this.post("/index", {
178
+ payload: { objectId, document },
179
+ });
180
+ }
181
+
182
+ /**
183
+ * Delete a document from Elasticsearch
184
+ */
185
+ delete(objectId: string): Promise<{ status: string; objectId: string }> {
186
+ return this.post("/delete", {
187
+ payload: { objectId },
188
+ });
189
+ }
190
+
191
+ /**
192
+ * Bulk index multiple documents to Elasticsearch
193
+ *
194
+ * @param documents Array of documents to index
195
+ * @param targetIndex Optional explicit index name for zero-downtime reindexing
196
+ */
197
+ bulkIndex(
198
+ documents: Array<{ id: string; document: ElasticsearchDocumentData }>,
199
+ targetIndex?: string
200
+ ): Promise<BulkIndexResult> {
201
+ return this.post("/bulk-index", {
202
+ payload: { documents, targetIndex },
203
+ });
204
+ }
205
+
206
+ /**
207
+ * Ensure Elasticsearch index exists for the project
208
+ *
209
+ * @param recreate If true, drops and recreates the index
210
+ */
211
+ ensureIndex(recreate?: boolean): Promise<{ created: boolean; recreated?: boolean; existed?: boolean }> {
212
+ return this.post("/ensure-index", {
213
+ payload: { recreate },
214
+ });
215
+ }
216
+
217
+ /**
218
+ * Create a new versioned index for reindexing (without alias)
219
+ * The alias will be swapped after reindexing completes via swapAlias
220
+ */
221
+ createReindexTarget(): Promise<CreateReindexTargetResult> {
222
+ return this.post("/create-reindex-target", {
223
+ payload: {},
224
+ });
225
+ }
226
+
227
+ /**
228
+ * Atomically swap the alias from old index to new index
229
+ *
230
+ * @param newIndexName The new index to point the alias to
231
+ * @param deleteOld If true, deletes the old index after swapping
232
+ */
233
+ swapAlias(newIndexName: string, deleteOld?: boolean): Promise<{ swapped: boolean; aliasName?: string; newIndexName?: string }> {
234
+ return this.post("/swap-alias", {
235
+ payload: { newIndexName, deleteOld },
236
+ });
237
+ }
238
+
239
+ /**
240
+ * Get Elasticsearch index statistics for the project
241
+ */
242
+ getStats(): Promise<ElasticsearchIndexStats> {
243
+ return this.post("/stats", {
244
+ payload: {},
245
+ });
246
+ }
247
+
248
+ /**
249
+ * Get the _id range for reindexing (first, last, count)
250
+ * Used by workflow to set up cursor-based pagination
251
+ */
252
+ getReindexRange(): Promise<ReindexRangeResult> {
253
+ return this.post("/reindex-range", {
254
+ payload: {},
255
+ });
256
+ }
257
+
258
+ /**
259
+ * Fetch a batch of documents from MongoDB (without indexing)
260
+ * Used by pipeline approach: fetch next batch while indexing current
261
+ *
262
+ * @param cursor Cursor from previous batch (null for first batch)
263
+ * @param limit Maximum documents to fetch (default: 500)
264
+ */
265
+ fetchBatch(cursor?: string | null, limit?: number): Promise<FetchBatchResult> {
266
+ return this.post("/fetch-batch", {
267
+ payload: { cursor, limit },
268
+ });
269
+ }
270
+
271
+ /**
272
+ * Fetch and index a batch of documents (server-side)
273
+ * Uses cursor-based pagination for reliability
274
+ *
275
+ * @param cursor Cursor from previous batch (null for first batch)
276
+ * @param limit Maximum documents to process (default: 500)
277
+ * @param targetIndex Optional explicit index name for zero-downtime reindexing
278
+ */
279
+ indexBatch(cursor?: string | null, limit?: number, targetIndex?: string): Promise<IndexBatchResult> {
280
+ return this.post("/index-batch", {
281
+ payload: { cursor, limit, targetIndex },
282
+ });
283
+ }
284
+
285
+ /**
286
+ * Trigger a reindex operation via Temporal workflow
287
+ *
288
+ * @param fullReindex If true, reindexes all documents in the project
289
+ * @param objectIds Specific object IDs to reindex (if not fullReindex)
290
+ * @param recreateIndex If true, recreates the index before reindexing
291
+ */
292
+ triggerReindex(options?: {
293
+ fullReindex?: boolean;
294
+ objectIds?: string[];
295
+ recreateIndex?: boolean;
296
+ }): Promise<TriggerReindexResult> {
297
+ return this.post("/reindex", {
298
+ payload: options ?? {},
299
+ });
300
+ }
301
+
302
+ /**
303
+ * Fetch documents by their IDs from MongoDB (for retry workflow)
304
+ * Returns documents ready for bulk indexing
305
+ *
306
+ * @param objectIds Array of object IDs to fetch
307
+ */
308
+ fetchDocumentsByIds(objectIds: string[]): Promise<FetchDocumentsByIdsResult> {
309
+ return this.post("/fetch-by-ids", {
310
+ payload: { objectIds },
311
+ });
312
+ }
313
+
314
+ /**
315
+ * Bulk delete documents from Elasticsearch
316
+ *
317
+ * @param objectIds Array of object IDs to delete
318
+ */
319
+ bulkDelete(objectIds: string[]): Promise<BulkDeleteResult> {
320
+ return this.post("/bulk-delete", {
321
+ payload: { objectIds },
322
+ });
323
+ }
324
+
325
+ /**
326
+ * Get detailed index configuration for the project
327
+ *
328
+ * Returns comprehensive information about the Elasticsearch index including
329
+ * status, embedding dimensions, field mappings, and project configuration.
330
+ */
331
+ getConfiguration(): Promise<IndexConfiguration> {
332
+ return this.post("/configuration", {
333
+ payload: {},
334
+ });
335
+ }
336
+ }
@@ -0,0 +1,62 @@
1
+ import { ApiTopic, ClientBase } from "@vertesia/api-fetch-client";
2
+ import {
3
+ IndexingStatusResponse,
4
+ GenericCommandResponse,
5
+ } from "@vertesia/common";
6
+
7
+ /**
8
+ * API for indexing operations on content objects.
9
+ * Provides status, reindex, and configuration management.
10
+ */
11
+ export class IndexingApi extends ApiTopic {
12
+
13
+ constructor(parent: ClientBase, basePath: string = "/api/v1/indexing") {
14
+ super(parent, basePath);
15
+ }
16
+
17
+ /**
18
+ * Get Elasticsearch status for the current project
19
+ */
20
+ async status(): Promise<IndexingStatusResponse> {
21
+ return this.get("/status");
22
+ }
23
+
24
+ /**
25
+ * Trigger a full reindex of all documents
26
+ * @param recreateIndex If true, drops and recreates the index before reindexing
27
+ */
28
+ async reindex(recreateIndex?: boolean): Promise<GenericCommandResponse> {
29
+ return this.post("/reindex", { payload: { recreateIndex } });
30
+ }
31
+
32
+ /**
33
+ * Enable indexing for this project
34
+ */
35
+ async enableIndexing(): Promise<GenericCommandResponse> {
36
+ return this.post("/enable-indexing");
37
+ }
38
+
39
+ /**
40
+ * Disable indexing for this project
41
+ */
42
+ async disableIndexing(): Promise<GenericCommandResponse> {
43
+ return this.post("/disable-indexing");
44
+ }
45
+
46
+ /**
47
+ * Enable index-based queries for this project
48
+ * (routes searches to index instead of Atlas Search)
49
+ */
50
+ async enableQueries(): Promise<GenericCommandResponse> {
51
+ return this.post("/enable-queries");
52
+ }
53
+
54
+ /**
55
+ * Disable index-based queries for this project
56
+ * (routes searches back to Atlas Search)
57
+ */
58
+ async disableQueries(): Promise<GenericCommandResponse> {
59
+ return this.post("/disable-queries");
60
+ }
61
+
62
+ }