@revealui/ai 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (397) hide show
  1. package/LICENSE +22 -0
  2. package/LICENSE.commercial +112 -0
  3. package/README.md +314 -0
  4. package/dist/a2a/card.d.ts +26 -0
  5. package/dist/a2a/card.d.ts.map +1 -0
  6. package/dist/a2a/card.js +173 -0
  7. package/dist/a2a/handler.d.ts +26 -0
  8. package/dist/a2a/handler.d.ts.map +1 -0
  9. package/dist/a2a/handler.js +170 -0
  10. package/dist/a2a/index.d.ts +10 -0
  11. package/dist/a2a/index.d.ts.map +1 -0
  12. package/dist/a2a/index.js +9 -0
  13. package/dist/a2a/task-store.d.ts +42 -0
  14. package/dist/a2a/task-store.d.ts.map +1 -0
  15. package/dist/a2a/task-store.js +99 -0
  16. package/dist/audit/emitter.d.ts +34 -0
  17. package/dist/audit/emitter.d.ts.map +1 -0
  18. package/dist/audit/emitter.js +34 -0
  19. package/dist/audit/index.d.ts +44 -0
  20. package/dist/audit/index.d.ts.map +1 -0
  21. package/dist/audit/index.js +48 -0
  22. package/dist/audit/observer.d.ts +108 -0
  23. package/dist/audit/observer.d.ts.map +1 -0
  24. package/dist/audit/observer.js +271 -0
  25. package/dist/audit/policy.d.ts +70 -0
  26. package/dist/audit/policy.d.ts.map +1 -0
  27. package/dist/audit/policy.js +209 -0
  28. package/dist/audit/store.d.ts +42 -0
  29. package/dist/audit/store.d.ts.map +1 -0
  30. package/dist/audit/store.js +80 -0
  31. package/dist/audit/types.d.ts +169 -0
  32. package/dist/audit/types.d.ts.map +1 -0
  33. package/dist/audit/types.js +80 -0
  34. package/dist/client/hooks/index.d.ts +22 -0
  35. package/dist/client/hooks/index.d.ts.map +1 -0
  36. package/dist/client/hooks/index.js +21 -0
  37. package/dist/client/hooks/useAgentContext.d.ts +30 -0
  38. package/dist/client/hooks/useAgentContext.d.ts.map +1 -0
  39. package/dist/client/hooks/useAgentContext.js +161 -0
  40. package/dist/client/hooks/useAgentEvents.d.ts +126 -0
  41. package/dist/client/hooks/useAgentEvents.d.ts.map +1 -0
  42. package/dist/client/hooks/useAgentEvents.js +232 -0
  43. package/dist/client/hooks/useAgentStream.d.ts +44 -0
  44. package/dist/client/hooks/useAgentStream.d.ts.map +1 -0
  45. package/dist/client/hooks/useAgentStream.js +101 -0
  46. package/dist/client/hooks/useEpisodicMemory.d.ts +25 -0
  47. package/dist/client/hooks/useEpisodicMemory.d.ts.map +1 -0
  48. package/dist/client/hooks/useEpisodicMemory.js +174 -0
  49. package/dist/client/hooks/useWorkingMemory.d.ts +57 -0
  50. package/dist/client/hooks/useWorkingMemory.d.ts.map +1 -0
  51. package/dist/client/hooks/useWorkingMemory.js +276 -0
  52. package/dist/client/index.d.ts +14 -0
  53. package/dist/client/index.d.ts.map +1 -0
  54. package/dist/client/index.js +13 -0
  55. package/dist/embeddings/index.d.ts +51 -0
  56. package/dist/embeddings/index.d.ts.map +1 -0
  57. package/dist/embeddings/index.js +73 -0
  58. package/dist/index.d.ts +83 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +103 -0
  61. package/dist/inference/context-assembly.d.ts +27 -0
  62. package/dist/inference/context-assembly.d.ts.map +1 -0
  63. package/dist/inference/context-assembly.js +81 -0
  64. package/dist/inference/overflow-compressor.d.ts +17 -0
  65. package/dist/inference/overflow-compressor.d.ts.map +1 -0
  66. package/dist/inference/overflow-compressor.js +40 -0
  67. package/dist/inference/runRag.d.ts +35 -0
  68. package/dist/inference/runRag.d.ts.map +1 -0
  69. package/dist/inference/runRag.js +53 -0
  70. package/dist/ingestion/bm25.d.ts +29 -0
  71. package/dist/ingestion/bm25.d.ts.map +1 -0
  72. package/dist/ingestion/bm25.js +161 -0
  73. package/dist/ingestion/cms-indexer.d.ts +39 -0
  74. package/dist/ingestion/cms-indexer.d.ts.map +1 -0
  75. package/dist/ingestion/cms-indexer.js +74 -0
  76. package/dist/ingestion/file-parsers.d.ts +51 -0
  77. package/dist/ingestion/file-parsers.d.ts.map +1 -0
  78. package/dist/ingestion/file-parsers.js +247 -0
  79. package/dist/ingestion/hybrid-search.d.ts +22 -0
  80. package/dist/ingestion/hybrid-search.d.ts.map +1 -0
  81. package/dist/ingestion/hybrid-search.js +63 -0
  82. package/dist/ingestion/index.d.ts +9 -0
  83. package/dist/ingestion/index.d.ts.map +1 -0
  84. package/dist/ingestion/index.js +8 -0
  85. package/dist/ingestion/pipeline.d.ts +35 -0
  86. package/dist/ingestion/pipeline.d.ts.map +1 -0
  87. package/dist/ingestion/pipeline.js +114 -0
  88. package/dist/ingestion/rag-vector-service.d.ts +34 -0
  89. package/dist/ingestion/rag-vector-service.d.ts.map +1 -0
  90. package/dist/ingestion/rag-vector-service.js +98 -0
  91. package/dist/ingestion/reranker.d.ts +10 -0
  92. package/dist/ingestion/reranker.d.ts.map +1 -0
  93. package/dist/ingestion/reranker.js +41 -0
  94. package/dist/ingestion/text-splitter.d.ts +25 -0
  95. package/dist/ingestion/text-splitter.d.ts.map +1 -0
  96. package/dist/ingestion/text-splitter.js +119 -0
  97. package/dist/llm/cache-utils.d.ts +146 -0
  98. package/dist/llm/cache-utils.d.ts.map +1 -0
  99. package/dist/llm/cache-utils.js +204 -0
  100. package/dist/llm/client.d.ts +134 -0
  101. package/dist/llm/client.d.ts.map +1 -0
  102. package/dist/llm/client.js +497 -0
  103. package/dist/llm/key-validator.d.ts +25 -0
  104. package/dist/llm/key-validator.d.ts.map +1 -0
  105. package/dist/llm/key-validator.js +101 -0
  106. package/dist/llm/provider-health.d.ts +40 -0
  107. package/dist/llm/provider-health.d.ts.map +1 -0
  108. package/dist/llm/provider-health.js +97 -0
  109. package/dist/llm/providers/anthropic.d.ts +31 -0
  110. package/dist/llm/providers/anthropic.d.ts.map +1 -0
  111. package/dist/llm/providers/anthropic.js +248 -0
  112. package/dist/llm/providers/base.d.ts +111 -0
  113. package/dist/llm/providers/base.d.ts.map +1 -0
  114. package/dist/llm/providers/base.js +6 -0
  115. package/dist/llm/providers/groq.d.ts +23 -0
  116. package/dist/llm/providers/groq.d.ts.map +1 -0
  117. package/dist/llm/providers/groq.js +27 -0
  118. package/dist/llm/providers/ollama.d.ts +27 -0
  119. package/dist/llm/providers/ollama.d.ts.map +1 -0
  120. package/dist/llm/providers/ollama.js +48 -0
  121. package/dist/llm/providers/openai.d.ts +19 -0
  122. package/dist/llm/providers/openai.d.ts.map +1 -0
  123. package/dist/llm/providers/openai.js +245 -0
  124. package/dist/llm/providers/vultr.d.ts +18 -0
  125. package/dist/llm/providers/vultr.d.ts.map +1 -0
  126. package/dist/llm/providers/vultr.js +168 -0
  127. package/dist/llm/response-cache.d.ts +166 -0
  128. package/dist/llm/response-cache.d.ts.map +1 -0
  129. package/dist/llm/response-cache.js +233 -0
  130. package/dist/llm/semantic-cache.d.ts +179 -0
  131. package/dist/llm/semantic-cache.d.ts.map +1 -0
  132. package/dist/llm/semantic-cache.js +306 -0
  133. package/dist/llm/server.d.ts +14 -0
  134. package/dist/llm/server.d.ts.map +1 -0
  135. package/dist/llm/server.js +15 -0
  136. package/dist/llm/token-counter.d.ts +48 -0
  137. package/dist/llm/token-counter.d.ts.map +1 -0
  138. package/dist/llm/token-counter.js +77 -0
  139. package/dist/llm/workspace-provider-config.d.ts +38 -0
  140. package/dist/llm/workspace-provider-config.d.ts.map +1 -0
  141. package/dist/llm/workspace-provider-config.js +47 -0
  142. package/dist/memory/agent/context-manager.d.ts +148 -0
  143. package/dist/memory/agent/context-manager.d.ts.map +1 -0
  144. package/dist/memory/agent/context-manager.js +284 -0
  145. package/dist/memory/agent/index.d.ts +7 -0
  146. package/dist/memory/agent/index.d.ts.map +1 -0
  147. package/dist/memory/agent/index.js +6 -0
  148. package/dist/memory/crdt/index.d.ts +13 -0
  149. package/dist/memory/crdt/index.d.ts.map +1 -0
  150. package/dist/memory/crdt/index.js +12 -0
  151. package/dist/memory/crdt/lww-register.d.ts +108 -0
  152. package/dist/memory/crdt/lww-register.d.ts.map +1 -0
  153. package/dist/memory/crdt/lww-register.js +169 -0
  154. package/dist/memory/crdt/or-set.d.ts +141 -0
  155. package/dist/memory/crdt/or-set.d.ts.map +1 -0
  156. package/dist/memory/crdt/or-set.js +291 -0
  157. package/dist/memory/crdt/pn-counter.d.ts +116 -0
  158. package/dist/memory/crdt/pn-counter.d.ts.map +1 -0
  159. package/dist/memory/crdt/pn-counter.js +174 -0
  160. package/dist/memory/crdt/vector-clock.d.ts +115 -0
  161. package/dist/memory/crdt/vector-clock.d.ts.map +1 -0
  162. package/dist/memory/crdt/vector-clock.js +179 -0
  163. package/dist/memory/errors/index.d.ts +56 -0
  164. package/dist/memory/errors/index.d.ts.map +1 -0
  165. package/dist/memory/errors/index.js +85 -0
  166. package/dist/memory/index.d.ts +21 -0
  167. package/dist/memory/index.d.ts.map +1 -0
  168. package/dist/memory/index.js +20 -0
  169. package/dist/memory/persistence/crdt-persistence.d.ts +85 -0
  170. package/dist/memory/persistence/crdt-persistence.d.ts.map +1 -0
  171. package/dist/memory/persistence/crdt-persistence.js +204 -0
  172. package/dist/memory/persistence/index.d.ts +7 -0
  173. package/dist/memory/persistence/index.d.ts.map +1 -0
  174. package/dist/memory/persistence/index.js +6 -0
  175. package/dist/memory/preferences/index.d.ts +7 -0
  176. package/dist/memory/preferences/index.d.ts.map +1 -0
  177. package/dist/memory/preferences/index.js +6 -0
  178. package/dist/memory/preferences/user-preferences-manager.d.ts +133 -0
  179. package/dist/memory/preferences/user-preferences-manager.d.ts.map +1 -0
  180. package/dist/memory/preferences/user-preferences-manager.js +342 -0
  181. package/dist/memory/services/index.d.ts +8 -0
  182. package/dist/memory/services/index.d.ts.map +1 -0
  183. package/dist/memory/services/index.js +6 -0
  184. package/dist/memory/services/node-id-service.d.ts +75 -0
  185. package/dist/memory/services/node-id-service.d.ts.map +1 -0
  186. package/dist/memory/services/node-id-service.js +190 -0
  187. package/dist/memory/stores/episodic-memory.d.ts +182 -0
  188. package/dist/memory/stores/episodic-memory.d.ts.map +1 -0
  189. package/dist/memory/stores/episodic-memory.js +378 -0
  190. package/dist/memory/stores/index.d.ts +16 -0
  191. package/dist/memory/stores/index.d.ts.map +1 -0
  192. package/dist/memory/stores/index.js +15 -0
  193. package/dist/memory/stores/procedural-memory.d.ts +89 -0
  194. package/dist/memory/stores/procedural-memory.d.ts.map +1 -0
  195. package/dist/memory/stores/procedural-memory.js +152 -0
  196. package/dist/memory/stores/semantic-memory.d.ts +92 -0
  197. package/dist/memory/stores/semantic-memory.d.ts.map +1 -0
  198. package/dist/memory/stores/semantic-memory.js +155 -0
  199. package/dist/memory/stores/working-memory.d.ts +225 -0
  200. package/dist/memory/stores/working-memory.d.ts.map +1 -0
  201. package/dist/memory/stores/working-memory.js +336 -0
  202. package/dist/memory/utils/deep-clone.d.ts +10 -0
  203. package/dist/memory/utils/deep-clone.d.ts.map +1 -0
  204. package/dist/memory/utils/deep-clone.js +9 -0
  205. package/dist/memory/utils/index.d.ts +8 -0
  206. package/dist/memory/utils/index.d.ts.map +1 -0
  207. package/dist/memory/utils/index.js +7 -0
  208. package/dist/memory/utils/logger.d.ts +21 -0
  209. package/dist/memory/utils/logger.d.ts.map +1 -0
  210. package/dist/memory/utils/logger.js +62 -0
  211. package/dist/memory/utils/sql-helpers.d.ts +97 -0
  212. package/dist/memory/utils/sql-helpers.d.ts.map +1 -0
  213. package/dist/memory/utils/sql-helpers.js +214 -0
  214. package/dist/memory/utils/validation.d.ts +62 -0
  215. package/dist/memory/utils/validation.d.ts.map +1 -0
  216. package/dist/memory/utils/validation.js +244 -0
  217. package/dist/memory/vector/index.d.ts +12 -0
  218. package/dist/memory/vector/index.d.ts.map +1 -0
  219. package/dist/memory/vector/index.js +14 -0
  220. package/dist/memory/vector/vector-memory-service.d.ts +88 -0
  221. package/dist/memory/vector/vector-memory-service.d.ts.map +1 -0
  222. package/dist/memory/vector/vector-memory-service.js +335 -0
  223. package/dist/observability/logger.d.ts +79 -0
  224. package/dist/observability/logger.d.ts.map +1 -0
  225. package/dist/observability/logger.js +165 -0
  226. package/dist/observability/metrics.d.ts +43 -0
  227. package/dist/observability/metrics.d.ts.map +1 -0
  228. package/dist/observability/metrics.js +197 -0
  229. package/dist/observability/query.d.ts +150 -0
  230. package/dist/observability/query.d.ts.map +1 -0
  231. package/dist/observability/query.js +339 -0
  232. package/dist/observability/types.d.ts +140 -0
  233. package/dist/observability/types.d.ts.map +1 -0
  234. package/dist/observability/types.js +6 -0
  235. package/dist/orchestration/agent.d.ts +98 -0
  236. package/dist/orchestration/agent.d.ts.map +1 -0
  237. package/dist/orchestration/agent.js +6 -0
  238. package/dist/orchestration/defaults.d.ts +21 -0
  239. package/dist/orchestration/defaults.d.ts.map +1 -0
  240. package/dist/orchestration/defaults.js +22 -0
  241. package/dist/orchestration/memory-integration.d.ts +58 -0
  242. package/dist/orchestration/memory-integration.d.ts.map +1 -0
  243. package/dist/orchestration/memory-integration.js +130 -0
  244. package/dist/orchestration/orchestrator.d.ts +67 -0
  245. package/dist/orchestration/orchestrator.d.ts.map +1 -0
  246. package/dist/orchestration/orchestrator.js +174 -0
  247. package/dist/orchestration/runtime.d.ts +82 -0
  248. package/dist/orchestration/runtime.d.ts.map +1 -0
  249. package/dist/orchestration/runtime.js +251 -0
  250. package/dist/orchestration/streaming-runtime.d.ts +36 -0
  251. package/dist/orchestration/streaming-runtime.d.ts.map +1 -0
  252. package/dist/orchestration/streaming-runtime.js +175 -0
  253. package/dist/orchestration/ticket-agent.d.ts +70 -0
  254. package/dist/orchestration/ticket-agent.d.ts.map +1 -0
  255. package/dist/orchestration/ticket-agent.js +146 -0
  256. package/dist/skills/activation/index.d.ts +7 -0
  257. package/dist/skills/activation/index.d.ts.map +1 -0
  258. package/dist/skills/activation/index.js +6 -0
  259. package/dist/skills/activation/skill-activator.d.ts +68 -0
  260. package/dist/skills/activation/skill-activator.d.ts.map +1 -0
  261. package/dist/skills/activation/skill-activator.js +224 -0
  262. package/dist/skills/catalog/catalog-search.d.ts +55 -0
  263. package/dist/skills/catalog/catalog-search.d.ts.map +1 -0
  264. package/dist/skills/catalog/catalog-search.js +111 -0
  265. package/dist/skills/catalog/catalog-types.d.ts +81 -0
  266. package/dist/skills/catalog/catalog-types.d.ts.map +1 -0
  267. package/dist/skills/catalog/catalog-types.js +66 -0
  268. package/dist/skills/catalog/index.d.ts +9 -0
  269. package/dist/skills/catalog/index.d.ts.map +1 -0
  270. package/dist/skills/catalog/index.js +7 -0
  271. package/dist/skills/catalog/vercel-catalog.d.ts +42 -0
  272. package/dist/skills/catalog/vercel-catalog.d.ts.map +1 -0
  273. package/dist/skills/catalog/vercel-catalog.js +189 -0
  274. package/dist/skills/compat/index.d.ts +9 -0
  275. package/dist/skills/compat/index.d.ts.map +1 -0
  276. package/dist/skills/compat/index.js +8 -0
  277. package/dist/skills/compat/skill-enhancer.d.ts +37 -0
  278. package/dist/skills/compat/skill-enhancer.d.ts.map +1 -0
  279. package/dist/skills/compat/skill-enhancer.js +76 -0
  280. package/dist/skills/compat/tool-mapper.d.ts +61 -0
  281. package/dist/skills/compat/tool-mapper.d.ts.map +1 -0
  282. package/dist/skills/compat/tool-mapper.js +168 -0
  283. package/dist/skills/compat/vercel-compat.d.ts +33 -0
  284. package/dist/skills/compat/vercel-compat.d.ts.map +1 -0
  285. package/dist/skills/compat/vercel-compat.js +132 -0
  286. package/dist/skills/index.d.ts +40 -0
  287. package/dist/skills/index.d.ts.map +1 -0
  288. package/dist/skills/index.js +47 -0
  289. package/dist/skills/integration/agent-skill-provider.d.ts +94 -0
  290. package/dist/skills/integration/agent-skill-provider.d.ts.map +1 -0
  291. package/dist/skills/integration/agent-skill-provider.js +161 -0
  292. package/dist/skills/integration/index.d.ts +7 -0
  293. package/dist/skills/integration/index.d.ts.map +1 -0
  294. package/dist/skills/integration/index.js +6 -0
  295. package/dist/skills/loader/github-loader.d.ts +61 -0
  296. package/dist/skills/loader/github-loader.d.ts.map +1 -0
  297. package/dist/skills/loader/github-loader.js +176 -0
  298. package/dist/skills/loader/index.d.ts +10 -0
  299. package/dist/skills/loader/index.d.ts.map +1 -0
  300. package/dist/skills/loader/index.js +9 -0
  301. package/dist/skills/loader/local-loader.d.ts +56 -0
  302. package/dist/skills/loader/local-loader.d.ts.map +1 -0
  303. package/dist/skills/loader/local-loader.js +186 -0
  304. package/dist/skills/loader/vercel-loader.d.ts +64 -0
  305. package/dist/skills/loader/vercel-loader.d.ts.map +1 -0
  306. package/dist/skills/loader/vercel-loader.js +313 -0
  307. package/dist/skills/loader/vercel-types.d.ts +64 -0
  308. package/dist/skills/loader/vercel-types.d.ts.map +1 -0
  309. package/dist/skills/loader/vercel-types.js +55 -0
  310. package/dist/skills/parser/index.d.ts +7 -0
  311. package/dist/skills/parser/index.d.ts.map +1 -0
  312. package/dist/skills/parser/index.js +6 -0
  313. package/dist/skills/parser/skill-md-parser.d.ts +64 -0
  314. package/dist/skills/parser/skill-md-parser.d.ts.map +1 -0
  315. package/dist/skills/parser/skill-md-parser.js +242 -0
  316. package/dist/skills/registry/index.d.ts +7 -0
  317. package/dist/skills/registry/index.d.ts.map +1 -0
  318. package/dist/skills/registry/index.js +6 -0
  319. package/dist/skills/registry/skill-registry.d.ts +133 -0
  320. package/dist/skills/registry/skill-registry.d.ts.map +1 -0
  321. package/dist/skills/registry/skill-registry.js +373 -0
  322. package/dist/skills/types.d.ts +216 -0
  323. package/dist/skills/types.d.ts.map +1 -0
  324. package/dist/skills/types.js +176 -0
  325. package/dist/templates/agent-spec.d.ts +138 -0
  326. package/dist/templates/agent-spec.d.ts.map +1 -0
  327. package/dist/templates/agent-spec.js +138 -0
  328. package/dist/templates/index.d.ts +56 -0
  329. package/dist/templates/index.d.ts.map +1 -0
  330. package/dist/templates/index.js +58 -0
  331. package/dist/templates/prompt-spec.d.ts +140 -0
  332. package/dist/templates/prompt-spec.d.ts.map +1 -0
  333. package/dist/templates/prompt-spec.js +210 -0
  334. package/dist/templates/skill-spec.d.ts +106 -0
  335. package/dist/templates/skill-spec.d.ts.map +1 -0
  336. package/dist/templates/skill-spec.js +119 -0
  337. package/dist/tools/base.d.ts +74 -0
  338. package/dist/tools/base.d.ts.map +1 -0
  339. package/dist/tools/base.js +6 -0
  340. package/dist/tools/cms/collection-tools.d.ts +36 -0
  341. package/dist/tools/cms/collection-tools.d.ts.map +1 -0
  342. package/dist/tools/cms/collection-tools.js +178 -0
  343. package/dist/tools/cms/factory.d.ts +89 -0
  344. package/dist/tools/cms/factory.d.ts.map +1 -0
  345. package/dist/tools/cms/factory.js +462 -0
  346. package/dist/tools/cms/global-tools.d.ts +21 -0
  347. package/dist/tools/cms/global-tools.d.ts.map +1 -0
  348. package/dist/tools/cms/global-tools.js +92 -0
  349. package/dist/tools/cms/index.d.ts +11 -0
  350. package/dist/tools/cms/index.d.ts.map +1 -0
  351. package/dist/tools/cms/index.js +11 -0
  352. package/dist/tools/cms/media-tools.d.ts +31 -0
  353. package/dist/tools/cms/media-tools.d.ts.map +1 -0
  354. package/dist/tools/cms/media-tools.js +140 -0
  355. package/dist/tools/cms/user-tools.d.ts +31 -0
  356. package/dist/tools/cms/user-tools.d.ts.map +1 -0
  357. package/dist/tools/cms/user-tools.js +135 -0
  358. package/dist/tools/deduplicator.d.ts +19 -0
  359. package/dist/tools/deduplicator.d.ts.map +1 -0
  360. package/dist/tools/deduplicator.js +53 -0
  361. package/dist/tools/document-summarizer.d.ts +11 -0
  362. package/dist/tools/document-summarizer.d.ts.map +1 -0
  363. package/dist/tools/document-summarizer.js +82 -0
  364. package/dist/tools/mcp-adapter.d.ts +66 -0
  365. package/dist/tools/mcp-adapter.d.ts.map +1 -0
  366. package/dist/tools/mcp-adapter.js +152 -0
  367. package/dist/tools/memory/index.d.ts +3 -0
  368. package/dist/tools/memory/index.d.ts.map +1 -0
  369. package/dist/tools/memory/index.js +1 -0
  370. package/dist/tools/memory/store-memory.d.ts +39 -0
  371. package/dist/tools/memory/store-memory.d.ts.map +1 -0
  372. package/dist/tools/memory/store-memory.js +94 -0
  373. package/dist/tools/registry.d.ts +14 -0
  374. package/dist/tools/registry.d.ts.map +1 -0
  375. package/dist/tools/registry.js +48 -0
  376. package/dist/tools/ticket-tools.d.ts +31 -0
  377. package/dist/tools/ticket-tools.d.ts.map +1 -0
  378. package/dist/tools/ticket-tools.js +74 -0
  379. package/dist/tools/web/duck-duck-go.d.ts +52 -0
  380. package/dist/tools/web/duck-duck-go.d.ts.map +1 -0
  381. package/dist/tools/web/duck-duck-go.js +202 -0
  382. package/dist/tools/web/exa.d.ts +34 -0
  383. package/dist/tools/web/exa.d.ts.map +1 -0
  384. package/dist/tools/web/exa.js +80 -0
  385. package/dist/tools/web/index.d.ts +6 -0
  386. package/dist/tools/web/index.d.ts.map +1 -0
  387. package/dist/tools/web/index.js +4 -0
  388. package/dist/tools/web/scraper.d.ts +9 -0
  389. package/dist/tools/web/scraper.d.ts.map +1 -0
  390. package/dist/tools/web/scraper.js +118 -0
  391. package/dist/tools/web/tavily.d.ts +32 -0
  392. package/dist/tools/web/tavily.d.ts.map +1 -0
  393. package/dist/tools/web/tavily.js +73 -0
  394. package/dist/tools/web/types.d.ts +31 -0
  395. package/dist/tools/web/types.d.ts.map +1 -0
  396. package/dist/tools/web/types.js +9 -0
  397. package/package.json +143 -0
@@ -0,0 +1,214 @@
1
+ /**
2
+ * SQL Helper Utilities
3
+ *
4
+ * Provides type-safe raw SQL query helpers to work around Neon HTTP driver
5
+ * compatibility issues with Drizzle's relational query builder.
6
+ *
7
+ * These helpers use Drizzle's sql tagged template for type safety and
8
+ * SQL injection prevention.
9
+ */
10
+ import { sql } from 'drizzle-orm';
11
+ const getRows = (result) => {
12
+ if (Array.isArray(result)) {
13
+ return result;
14
+ }
15
+ if (result && typeof result === 'object' && Array.isArray(result.rows)) {
16
+ return result.rows;
17
+ }
18
+ return [];
19
+ };
20
+ // =============================================================================
21
+ // Node ID Mappings Queries
22
+ // =============================================================================
23
+ /**
24
+ * Finds a node ID mapping by hash (primary key).
25
+ *
26
+ * @param db - Database client
27
+ * @param hash - SHA-256 hash of entity ID
28
+ * @returns Node ID mapping or undefined if not found
29
+ */
30
+ export async function findNodeIdMappingByHash(db, hash) {
31
+ const result = await db.execute(sql `SELECT id, entity_type, entity_id, node_id, created_at, updated_at
32
+ FROM node_id_mappings
33
+ WHERE id = ${hash}
34
+ LIMIT 1`);
35
+ // Handle different result formats (Neon HTTP vs direct Postgres)
36
+ const rows = getRows(result);
37
+ if (!rows[0])
38
+ return undefined;
39
+ // Transform snake_case to camelCase to match NodeIdMappingsRow type
40
+ const row = rows[0];
41
+ return {
42
+ id: row.id,
43
+ entityType: row.entity_type,
44
+ entityId: row.entity_id,
45
+ nodeId: row.node_id,
46
+ createdAt: row.created_at,
47
+ updatedAt: row.updated_at,
48
+ };
49
+ }
50
+ /**
51
+ * Finds a node ID mapping by entity ID and type.
52
+ *
53
+ * @param db - Database client
54
+ * @param entityType - Type of entity ('session' or 'user')
55
+ * @param entityId - Entity identifier
56
+ * @returns Node ID mapping or undefined if not found
57
+ */
58
+ export async function findNodeIdMappingByEntity(db, entityType, entityId) {
59
+ const result = await db.execute(sql `SELECT id, entity_type, entity_id, node_id, created_at, updated_at
60
+ FROM node_id_mappings
61
+ WHERE entity_type = ${entityType} AND entity_id = ${entityId}
62
+ LIMIT 1`);
63
+ const rows = getRows(result);
64
+ if (!rows[0])
65
+ return undefined;
66
+ // Transform snake_case to camelCase to match NodeIdMappingsRow type
67
+ const row = rows[0];
68
+ return {
69
+ id: row.id,
70
+ entityType: row.entity_type,
71
+ entityId: row.entity_id,
72
+ nodeId: row.node_id,
73
+ createdAt: row.created_at,
74
+ updatedAt: row.updated_at,
75
+ };
76
+ }
77
+ // =============================================================================
78
+ // Agent Memories Queries
79
+ // =============================================================================
80
+ /**
81
+ * Finds an agent memory by ID (returns raw database record format).
82
+ *
83
+ * @deprecated Use VectorMemoryService.getById() instead. This function queries
84
+ * agent_memories which is now in the vector database (Supabase), not REST database.
85
+ * If you need to query memories, use VectorMemoryService which uses the correct database.
86
+ *
87
+ * @param db - Database client (NOTE: Should be vector client, but type doesn't enforce this)
88
+ * @param memoryId - Memory identifier
89
+ * @returns Raw database memory record or undefined if not found
90
+ */
91
+ export async function findAgentMemoryById(db, memoryId) {
92
+ // NOTE: This queries agent_memories which is in vector database
93
+ // Using raw SQL so it works, but caller must use vector client
94
+ const result = await db.execute(sql `SELECT id, version, content, type, source, embedding, embedding_metadata,
95
+ metadata, access_count, accessed_at, verified, verified_by,
96
+ verified_at, site_id, agent_id, created_at, expires_at
97
+ FROM agent_memories
98
+ WHERE id = ${memoryId}
99
+ LIMIT 1`);
100
+ const rows = getRows(result);
101
+ if (!rows[0])
102
+ return undefined;
103
+ const row = rows[0];
104
+ return {
105
+ id: row.id,
106
+ version: row.version || 1,
107
+ content: row.content,
108
+ type: row.type,
109
+ source: row.source,
110
+ embedding: row.embedding,
111
+ embeddingMetadata: row.embedding_metadata,
112
+ metadata: row.metadata,
113
+ accessCount: row.access_count,
114
+ accessedAt: row.accessed_at,
115
+ verified: row.verified,
116
+ createdAt: row.created_at,
117
+ expiresAt: row.expires_at,
118
+ };
119
+ }
120
+ /**
121
+ * Finds agent memories by user ID.
122
+ *
123
+ * @deprecated Use VectorMemoryService.searchSimilar() or VectorMemoryService with filters instead.
124
+ * This function queries agent_memories which is now in the vector database (Supabase).
125
+ * If you need to query memories, use VectorMemoryService which uses the correct database.
126
+ *
127
+ * @param db - Database client (NOTE: Should be vector client, but type doesn't enforce this)
128
+ * @param userId - User identifier
129
+ * @returns Array of agent memories
130
+ */
131
+ export async function findAgentMemoriesByUserId(db, userId) {
132
+ const result = await db.execute(sql `SELECT id, version, content, type, source, embedding, embedding_metadata,
133
+ metadata, access_count, accessed_at, verified, verified_by,
134
+ verified_at, site_id, agent_id, created_at, expires_at
135
+ FROM agent_memories
136
+ WHERE (source->>'id')::text = ${userId}
137
+ ORDER BY created_at DESC`);
138
+ const rows = getRows(result);
139
+ return rows.map((row) => {
140
+ const record = row;
141
+ const metadata = record.embedding_metadata;
142
+ return {
143
+ id: record.id,
144
+ version: record.version || 1,
145
+ content: record.content,
146
+ type: record.type,
147
+ source: record.source,
148
+ embedding: metadata
149
+ ? {
150
+ model: metadata.model,
151
+ vector: record.embedding || metadata.vector,
152
+ dimension: metadata.dimension,
153
+ generatedAt: metadata.generatedAt,
154
+ }
155
+ : undefined,
156
+ metadata: (record.metadata || {}),
157
+ accessedAt: record.accessed_at?.toISOString() || new Date().toISOString(),
158
+ accessCount: record.access_count || 0,
159
+ verified: record.verified ?? false,
160
+ createdAt: record.created_at,
161
+ expiresAt: record.expires_at,
162
+ };
163
+ });
164
+ }
165
+ // =============================================================================
166
+ // Agent Contexts Queries
167
+ // =============================================================================
168
+ /**
169
+ * Finds an agent context by CRDT ID (returns raw database record format).
170
+ *
171
+ * @param db - Database client
172
+ * @param crdtId - CRDT identifier (format: sessionId:agentId)
173
+ * @returns Raw database context record or undefined if not found
174
+ */
175
+ export async function findAgentContextById(db, crdtId) {
176
+ const result = await db.execute(sql `SELECT id, version, session_id, agent_id, context, priority,
177
+ embedding, created_at, updated_at
178
+ FROM agent_contexts
179
+ WHERE id = ${crdtId}
180
+ LIMIT 1`);
181
+ const rows = getRows(result);
182
+ if (!rows[0])
183
+ return undefined;
184
+ const row = rows[0];
185
+ return {
186
+ id: row.id,
187
+ version: row.version || 1,
188
+ sessionId: row.session_id,
189
+ agentId: row.agent_id,
190
+ context: row.context || {},
191
+ priority: row.priority || 0.5,
192
+ embedding: row.embedding,
193
+ createdAt: row.created_at,
194
+ updatedAt: row.updated_at,
195
+ };
196
+ }
197
+ // =============================================================================
198
+ // Users Queries
199
+ // =============================================================================
200
+ /**
201
+ * Finds a user by ID.
202
+ *
203
+ * @param db - Database client
204
+ * @param userId - User identifier
205
+ * @returns User record or undefined if not found
206
+ */
207
+ export async function findUserById(db, userId) {
208
+ const result = await db.execute(sql `SELECT id, preferences
209
+ FROM users
210
+ WHERE id = ${userId}
211
+ LIMIT 1`);
212
+ const rows = getRows(result);
213
+ return rows[0];
214
+ }
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Validation Utilities
3
+ *
4
+ * Provides validation functions for context keys, values, and objects
5
+ * to prevent security vulnerabilities and performance issues.
6
+ */
7
+ /**
8
+ * Validates that a context key is safe to use.
9
+ *
10
+ * @param key - The key to validate
11
+ * @throws ValidationError if key is dangerous or invalid
12
+ */
13
+ export declare function validateContextKey(key: string): void;
14
+ /**
15
+ * Validates that a context value is safe to store.
16
+ *
17
+ * @param value - The value to validate
18
+ * @param key - The key this value is associated with (for error messages)
19
+ * @throws ValidationError if value is invalid
20
+ */
21
+ export declare function validateContextValue(value: unknown, key: string): void;
22
+ /**
23
+ * Validates the depth of a nested object structure.
24
+ *
25
+ * @param obj - The object to check
26
+ * @param maxDepth - Maximum allowed depth (default: MAX_OBJECT_DEPTH)
27
+ * @returns The actual depth of the object
28
+ * @throws Error if depth exceeds maximum
29
+ */
30
+ export declare function validateObjectDepth(obj: unknown, maxDepth?: number): number;
31
+ /**
32
+ * Estimates the approximate size of an object in bytes.
33
+ * This is a rough estimate for validation purposes.
34
+ *
35
+ * @param obj - The object to measure
36
+ * @returns Approximate size in bytes
37
+ */
38
+ export declare function estimateObjectSize(obj: unknown): number;
39
+ /**
40
+ * Validates that a context object is within size limits.
41
+ *
42
+ * @param context - The context object to validate
43
+ * @throws Error if context exceeds size limits
44
+ */
45
+ export declare function validateContextSize(context: Record<string, unknown>): void;
46
+ /**
47
+ * Validates a complete context object (keys, values, depth, size).
48
+ *
49
+ * @param context - The context object to validate
50
+ * @throws Error if any validation fails
51
+ */
52
+ export declare function validateContext(context: Record<string, unknown>): void;
53
+ /**
54
+ * Checks if an object contains circular references.
55
+ * This is a lightweight check that doesn't throw on circular refs,
56
+ * but can be used to detect them before operations that would fail.
57
+ *
58
+ * @param obj - The object to check
59
+ * @returns true if circular references are detected
60
+ */
61
+ export declare function hasCircularReference(obj: unknown): boolean;
62
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../../src/memory/utils/validation.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAmCH;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAkBpD;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI,CAYtE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,OAAO,EAAE,QAAQ,SAAmB,GAAG,MAAM,CA4BrF;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAwCvD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAY1E;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAsCtE;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,OAAO,GAAG,OAAO,CAkC1D"}
@@ -0,0 +1,244 @@
1
+ /**
2
+ * Validation Utilities
3
+ *
4
+ * Provides validation functions for context keys, values, and objects
5
+ * to prevent security vulnerabilities and performance issues.
6
+ */
7
+ import { ValidationError } from '../errors/index.js';
8
+ /**
9
+ * Dangerous keys that could lead to prototype pollution or other security issues
10
+ */
11
+ const DANGEROUS_KEYS = new Set([
12
+ '__proto__',
13
+ 'constructor',
14
+ 'prototype',
15
+ 'hasOwnProperty',
16
+ 'isPrototypeOf',
17
+ 'propertyIsEnumerable',
18
+ 'toLocaleString',
19
+ 'toString',
20
+ 'valueOf',
21
+ ]);
22
+ /**
23
+ * Maximum allowed depth for nested objects (prevents stack overflow)
24
+ */
25
+ const MAX_OBJECT_DEPTH = 100;
26
+ /**
27
+ * Maximum allowed size for context objects (in bytes, approximate)
28
+ * This prevents memory exhaustion attacks
29
+ */
30
+ const MAX_CONTEXT_SIZE = 10 * 1024 * 1024; // 10MB
31
+ /**
32
+ * Maximum number of keys in a context object
33
+ */
34
+ const MAX_CONTEXT_KEYS = 10000;
35
+ /**
36
+ * Validates that a context key is safe to use.
37
+ *
38
+ * @param key - The key to validate
39
+ * @throws ValidationError if key is dangerous or invalid
40
+ */
41
+ export function validateContextKey(key) {
42
+ if (typeof key !== 'string') {
43
+ throw new ValidationError(`Context key must be a string, got: ${typeof key}`);
44
+ }
45
+ if (key.length === 0) {
46
+ throw new ValidationError('Context key cannot be empty');
47
+ }
48
+ if (key.length > 256) {
49
+ throw new ValidationError(`Context key too long: ${key.length} characters (max 256)`);
50
+ }
51
+ if (DANGEROUS_KEYS.has(key)) {
52
+ throw new ValidationError(`Dangerous context key detected: ${key}. This key is not allowed for security reasons.`);
53
+ }
54
+ }
55
+ /**
56
+ * Validates that a context value is safe to store.
57
+ *
58
+ * @param value - The value to validate
59
+ * @param key - The key this value is associated with (for error messages)
60
+ * @throws ValidationError if value is invalid
61
+ */
62
+ export function validateContextValue(value, key) {
63
+ if (value === undefined) {
64
+ throw new ValidationError(`Context values cannot be undefined. Key: ${key}`);
65
+ }
66
+ if (typeof value === 'function') {
67
+ throw new ValidationError(`Context values cannot be functions. Key: ${key}`);
68
+ }
69
+ if (typeof value === 'symbol') {
70
+ throw new ValidationError(`Context values cannot be symbols. Key: ${key}`);
71
+ }
72
+ }
73
+ /**
74
+ * Validates the depth of a nested object structure.
75
+ *
76
+ * @param obj - The object to check
77
+ * @param maxDepth - Maximum allowed depth (default: MAX_OBJECT_DEPTH)
78
+ * @returns The actual depth of the object
79
+ * @throws Error if depth exceeds maximum
80
+ */
81
+ export function validateObjectDepth(obj, maxDepth = MAX_OBJECT_DEPTH) {
82
+ if (obj === null || typeof obj !== 'object') {
83
+ return 0;
84
+ }
85
+ if (Array.isArray(obj)) {
86
+ if (maxDepth <= 0) {
87
+ throw new ValidationError(`Object depth exceeds maximum of ${MAX_OBJECT_DEPTH}`);
88
+ }
89
+ let maxChildDepth = 0;
90
+ for (const item of obj) {
91
+ const childDepth = validateObjectDepth(item, maxDepth - 1);
92
+ maxChildDepth = Math.max(maxChildDepth, childDepth);
93
+ }
94
+ return maxChildDepth + 1;
95
+ }
96
+ if (maxDepth <= 0) {
97
+ throw new ValidationError(`Object depth exceeds maximum of ${MAX_OBJECT_DEPTH}`);
98
+ }
99
+ let maxChildDepth = 0;
100
+ const record = obj;
101
+ for (const value of Object.values(record)) {
102
+ const childDepth = validateObjectDepth(value, maxDepth - 1);
103
+ maxChildDepth = Math.max(maxChildDepth, childDepth);
104
+ }
105
+ return maxChildDepth + 1;
106
+ }
107
+ /**
108
+ * Estimates the approximate size of an object in bytes.
109
+ * This is a rough estimate for validation purposes.
110
+ *
111
+ * @param obj - The object to measure
112
+ * @returns Approximate size in bytes
113
+ */
114
+ export function estimateObjectSize(obj) {
115
+ if (obj === null || obj === undefined) {
116
+ return 8; // null/undefined overhead
117
+ }
118
+ const type = typeof obj;
119
+ if (type === 'string') {
120
+ // UTF-16 char units × 2 bytes each. This over-estimates multi-byte UTF-8 code
121
+ // points but is intentionally conservative — the limit stays tighter than the
122
+ // real in-process memory cost, which is what we want for a safety bound.
123
+ return obj.length * 2 + 8;
124
+ }
125
+ if (type === 'number') {
126
+ return 8; // 64-bit float
127
+ }
128
+ if (type === 'boolean') {
129
+ return 4;
130
+ }
131
+ if (Array.isArray(obj)) {
132
+ let size = 8; // array overhead
133
+ for (const item of obj) {
134
+ size += estimateObjectSize(item);
135
+ }
136
+ return size;
137
+ }
138
+ if (type === 'object') {
139
+ let size = 8; // object overhead
140
+ const record = obj;
141
+ for (const [key, value] of Object.entries(record)) {
142
+ size += key.length * 2 + 8; // key size
143
+ size += estimateObjectSize(value);
144
+ }
145
+ return size;
146
+ }
147
+ return 8; // fallback
148
+ }
149
+ /**
150
+ * Validates that a context object is within size limits.
151
+ *
152
+ * @param context - The context object to validate
153
+ * @throws Error if context exceeds size limits
154
+ */
155
+ export function validateContextSize(context) {
156
+ const keyCount = Object.keys(context).length;
157
+ if (keyCount > MAX_CONTEXT_KEYS) {
158
+ throw new ValidationError(`Context has too many keys: ${keyCount} (max ${MAX_CONTEXT_KEYS})`);
159
+ }
160
+ const estimatedSize = estimateObjectSize(context);
161
+ if (estimatedSize > MAX_CONTEXT_SIZE) {
162
+ throw new ValidationError(`Context too large: ~${Math.round(estimatedSize / 1024)}KB (max ${Math.round(MAX_CONTEXT_SIZE / 1024)}KB)`);
163
+ }
164
+ }
165
+ /**
166
+ * Validates a complete context object (keys, values, depth, size).
167
+ *
168
+ * @param context - The context object to validate
169
+ * @throws Error if any validation fails
170
+ */
171
+ export function validateContext(context) {
172
+ // Validate size first (fast check)
173
+ validateContextSize(context);
174
+ // Validate each key-value pair
175
+ // Use Object.getOwnPropertyNames() to catch non-enumerable properties like __proto__
176
+ // when set via Object.defineProperty() or similar
177
+ const allKeys = Object.getOwnPropertyNames(context);
178
+ for (const key of allKeys) {
179
+ // Skip non-enumerable properties that aren't dangerous (like length on arrays)
180
+ // But always check dangerous keys even if non-enumerable
181
+ if (DANGEROUS_KEYS.has(key)) {
182
+ validateContextKey(key);
183
+ const value = context[key];
184
+ validateContextValue(value, key);
185
+ }
186
+ else {
187
+ // For enumerable properties, validate normally
188
+ const descriptor = Object.getOwnPropertyDescriptor(context, key);
189
+ if (descriptor?.enumerable) {
190
+ validateContextKey(key);
191
+ const value = context[key];
192
+ validateContextValue(value, key);
193
+ }
194
+ }
195
+ }
196
+ // Also check if __proto__ exists as a property (even if not enumerable)
197
+ // This catches cases where __proto__ is set via Object.defineProperty()
198
+ if (Object.hasOwn(context, '__proto__')) {
199
+ validateContextKey('__proto__');
200
+ const protoDescriptor = Object.getOwnPropertyDescriptor(context, '__proto__');
201
+ const value = protoDescriptor && 'value' in protoDescriptor ? protoDescriptor.value : undefined;
202
+ validateContextValue(value, '__proto__');
203
+ }
204
+ // Validate depth
205
+ validateObjectDepth(context);
206
+ }
207
+ /**
208
+ * Checks if an object contains circular references.
209
+ * This is a lightweight check that doesn't throw on circular refs,
210
+ * but can be used to detect them before operations that would fail.
211
+ *
212
+ * @param obj - The object to check
213
+ * @returns true if circular references are detected
214
+ */
215
+ export function hasCircularReference(obj) {
216
+ const visited = new WeakSet();
217
+ function check(value) {
218
+ if (value === null || typeof value !== 'object') {
219
+ return false;
220
+ }
221
+ const current = value;
222
+ if (visited.has(current)) {
223
+ return true; // Circular reference detected
224
+ }
225
+ visited.add(current);
226
+ if (Array.isArray(value)) {
227
+ for (const item of value) {
228
+ if (check(item)) {
229
+ return true;
230
+ }
231
+ }
232
+ }
233
+ else {
234
+ const record = value;
235
+ for (const item of Object.values(record)) {
236
+ if (check(item)) {
237
+ return true;
238
+ }
239
+ }
240
+ }
241
+ return false;
242
+ }
243
+ return check(obj);
244
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Vector Search implementations
3
+ *
4
+ * Semantic search capabilities using pgvector:
5
+ * - Embedding generation (OpenAI, local models)
6
+ * - Similarity search
7
+ * - Hybrid search (vector + metadata)
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export { VectorMemoryService, type VectorSearchOptions, type VectorSearchResult, } from './vector-memory-service.js';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/memory/vector/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,GACxB,MAAM,4BAA4B,CAAA"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Vector Search implementations
3
+ *
4
+ * Semantic search capabilities using pgvector:
5
+ * - Embedding generation (OpenAI, local models)
6
+ * - Similarity search
7
+ * - Hybrid search (vector + metadata)
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export { VectorMemoryService, } from './vector-memory-service.js';
12
+ // Vector implementations will be added here
13
+ // export { generateEmbedding, type EmbeddingOptions } from './embeddings.js'
14
+ // export { semanticSearch, hybridSearch, type SearchOptions } from './search.js'
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Vector Memory Service
3
+ *
4
+ * Service for managing agent memories in Supabase with vector search capabilities.
5
+ * Uses pgvector for semantic similarity search.
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { VectorMemoryService } from '@revealui/ai/memory/vector/vector-memory-service'
10
+ *
11
+ * const service = new VectorMemoryService()
12
+ * const memories = await service.searchSimilar(embedding, { siteId: 'site-123', limit: 10 })
13
+ * ```
14
+ */
15
+ import type { AgentMemory } from '@revealui/contracts/agents';
16
+ export interface VectorSearchOptions {
17
+ userId?: string;
18
+ siteId?: string;
19
+ agentId?: string;
20
+ type?: string;
21
+ limit?: number;
22
+ threshold?: number;
23
+ }
24
+ export interface VectorSearchResult {
25
+ memory: AgentMemory;
26
+ similarity: number;
27
+ }
28
+ /**
29
+ * Vector Memory Service for semantic search operations.
30
+ */
31
+ export declare class VectorMemoryService {
32
+ private _db;
33
+ /**
34
+ * Lazy-load database client to avoid connection initialization at module import time.
35
+ * This allows the module to be imported in test environments without triggering database connections.
36
+ */
37
+ private get db();
38
+ /**
39
+ * Search for similar memories using vector similarity.
40
+ *
41
+ * @param queryEmbedding - Query embedding vector (768 dimensions — Ollama nomic-embed-text)
42
+ * @param options - Search options (filtering, limits, etc.)
43
+ * @returns Array of memories with similarity scores, sorted by similarity (highest first)
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * const embedding = await generateEmbedding('user prefers dark theme')
48
+ * const results = await service.searchSimilar(embedding, {
49
+ * siteId: 'site-123',
50
+ * limit: 10,
51
+ * threshold: 0.7
52
+ * })
53
+ * ```
54
+ */
55
+ searchSimilar(queryEmbedding: number[], options?: VectorSearchOptions): Promise<VectorSearchResult[]>;
56
+ /**
57
+ * Create a new memory in the vector database.
58
+ *
59
+ * @param memory - Memory to create (without id, createdAt, accessedAt)
60
+ * @returns Created memory with generated id and timestamps
61
+ */
62
+ create(memory: Omit<AgentMemory, 'id' | 'createdAt' | 'accessedAt'> & {
63
+ id?: string;
64
+ }): Promise<AgentMemory>;
65
+ /**
66
+ * Update an existing memory.
67
+ *
68
+ * @param id - Memory ID
69
+ * @param updates - Partial memory updates
70
+ * @returns Updated memory
71
+ */
72
+ update(id: string, updates: Partial<Omit<AgentMemory, 'id' | 'createdAt'>>): Promise<AgentMemory>;
73
+ /**
74
+ * Delete a memory by ID.
75
+ *
76
+ * @param id - Memory ID to delete
77
+ * @returns true if memory was deleted
78
+ */
79
+ delete(id: string): Promise<boolean>;
80
+ /**
81
+ * Get a memory by ID.
82
+ *
83
+ * @param id - Memory ID
84
+ * @returns Memory if found, null otherwise
85
+ */
86
+ getById(id: string): Promise<AgentMemory | null>;
87
+ }
88
+ //# sourceMappingURL=vector-memory-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vector-memory-service.d.ts","sourceRoot":"","sources":["../../../src/memory/vector/vector-memory-service.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAK7D,MAAM,WAAW,mBAAmB;IAClC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,MAAM,EAAE,WAAW,CAAA;IACnB,UAAU,EAAE,MAAM,CAAA;CACnB;AAED;;GAEG;AACH,qBAAa,mBAAmB;IAC9B,OAAO,CAAC,GAAG,CAAkD;IAE7D;;;OAGG;IACH,OAAO,KAAK,EAAE,GAKb;IAED;;;;;;;;;;;;;;;;OAgBG;IACG,aAAa,CACjB,cAAc,EAAE,MAAM,EAAE,EACxB,OAAO,GAAE,mBAAwB,GAChC,OAAO,CAAC,kBAAkB,EAAE,CAAC;IA2GhC;;;;;OAKG;IACG,MAAM,CACV,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,WAAW,GAAG,YAAY,CAAC,GAAG;QAC7D,EAAE,CAAC,EAAE,MAAM,CAAA;KACZ,GACA,OAAO,CAAC,WAAW,CAAC;IAmEvB;;;;;;OAMG;IACG,MAAM,CACV,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,WAAW,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,GACtD,OAAO,CAAC,WAAW,CAAC;IAyEvB;;;;;OAKG;IACG,MAAM,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAK1C;;;;;OAKG;IACG,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;CA8CvD"}