@nhtio/adk 1.20260604.0 → 1.20260607.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 (358) hide show
  1. package/CHANGELOG.md +261 -0
  2. package/adk-mcp.mjs +1 -1
  3. package/batteries/embeddings/openai/adapter.cjs +1 -1
  4. package/batteries/embeddings/openai/adapter.mjs +1 -1
  5. package/batteries/embeddings/webllm/adapter.cjs +1 -1
  6. package/batteries/embeddings/webllm/adapter.mjs +1 -1
  7. package/batteries/index.d.ts +1 -0
  8. package/batteries/llm/openai_chat_completions/adapter.cjs +6 -6
  9. package/batteries/llm/openai_chat_completions/adapter.cjs.map +1 -1
  10. package/batteries/llm/openai_chat_completions/adapter.mjs +6 -6
  11. package/batteries/llm/openai_chat_completions/adapter.mjs.map +1 -1
  12. package/batteries/llm/openai_chat_completions/helpers.cjs +2 -2
  13. package/batteries/llm/openai_chat_completions/helpers.mjs +2 -2
  14. package/batteries/llm/openai_chat_completions/validation.cjs +2 -2
  15. package/batteries/llm/openai_chat_completions/validation.cjs.map +1 -1
  16. package/batteries/llm/openai_chat_completions/validation.mjs +2 -2
  17. package/batteries/llm/openai_chat_completions/validation.mjs.map +1 -1
  18. package/batteries/llm/webllm_chat_completions/adapter.cjs +6 -6
  19. package/batteries/llm/webllm_chat_completions/adapter.cjs.map +1 -1
  20. package/batteries/llm/webllm_chat_completions/adapter.mjs +6 -6
  21. package/batteries/llm/webllm_chat_completions/adapter.mjs.map +1 -1
  22. package/batteries/llm/webllm_chat_completions/validation.cjs +2 -2
  23. package/batteries/llm/webllm_chat_completions/validation.cjs.map +1 -1
  24. package/batteries/llm/webllm_chat_completions/validation.mjs +2 -2
  25. package/batteries/llm/webllm_chat_completions/validation.mjs.map +1 -1
  26. package/batteries/storage/flydrive.cjs +1 -1
  27. package/batteries/storage/flydrive.mjs +2 -2
  28. package/batteries/storage/in_memory.cjs +1 -1
  29. package/batteries/storage/in_memory.mjs +1 -1
  30. package/batteries/storage/opfs.cjs +1 -1
  31. package/batteries/storage/opfs.mjs +1 -1
  32. package/batteries/tools/color.cjs +2 -2
  33. package/batteries/tools/color.mjs +2 -2
  34. package/batteries/tools/comparison.cjs +3 -3
  35. package/batteries/tools/comparison.mjs +3 -3
  36. package/batteries/tools/data_structure.cjs +3 -3
  37. package/batteries/tools/data_structure.mjs +3 -3
  38. package/batteries/tools/datetime_extended.cjs +2 -2
  39. package/batteries/tools/datetime_extended.mjs +2 -2
  40. package/batteries/tools/datetime_math.cjs +2 -2
  41. package/batteries/tools/datetime_math.mjs +2 -2
  42. package/batteries/tools/encoding.cjs +3 -3
  43. package/batteries/tools/encoding.mjs +3 -3
  44. package/batteries/tools/formatting.cjs +3 -3
  45. package/batteries/tools/formatting.mjs +3 -3
  46. package/batteries/tools/geo_basics.cjs +2 -2
  47. package/batteries/tools/geo_basics.mjs +2 -2
  48. package/batteries/tools/math/index.d.ts +16 -5
  49. package/batteries/tools/math.cjs +340 -22
  50. package/batteries/tools/math.cjs.map +1 -1
  51. package/batteries/tools/math.mjs +338 -21
  52. package/batteries/tools/math.mjs.map +1 -1
  53. package/batteries/tools/memory.cjs +5 -5
  54. package/batteries/tools/memory.mjs +5 -5
  55. package/batteries/tools/parsing.cjs +4 -4
  56. package/batteries/tools/parsing.mjs +4 -4
  57. package/batteries/tools/retrievables.cjs +4 -4
  58. package/batteries/tools/retrievables.mjs +4 -4
  59. package/batteries/tools/standing_instructions.cjs +4 -4
  60. package/batteries/tools/standing_instructions.mjs +4 -4
  61. package/batteries/tools/statistics.cjs +4 -4
  62. package/batteries/tools/statistics.mjs +4 -4
  63. package/batteries/tools/string_processing.cjs +3 -3
  64. package/batteries/tools/string_processing.mjs +3 -3
  65. package/batteries/tools/structured_data.cjs +3 -3
  66. package/batteries/tools/structured_data.mjs +3 -3
  67. package/batteries/tools/text_analysis.cjs +3 -3
  68. package/batteries/tools/text_analysis.mjs +3 -3
  69. package/batteries/tools/text_comparison.cjs +2 -2
  70. package/batteries/tools/text_comparison.mjs +2 -2
  71. package/batteries/tools/time.cjs +2 -2
  72. package/batteries/tools/time.mjs +2 -2
  73. package/batteries/tools/unit_conversion.cjs +2 -2
  74. package/batteries/tools/unit_conversion.mjs +2 -2
  75. package/batteries/vector/arangodb/index.d.ts +38 -0
  76. package/batteries/vector/arangodb.cjs +257 -0
  77. package/batteries/vector/arangodb.cjs.map +1 -0
  78. package/batteries/vector/arangodb.mjs +255 -0
  79. package/batteries/vector/arangodb.mjs.map +1 -0
  80. package/batteries/vector/builder.cjs +297 -0
  81. package/batteries/vector/builder.cjs.map +1 -0
  82. package/batteries/vector/builder.d.ts +87 -0
  83. package/batteries/vector/builder.mjs +294 -0
  84. package/batteries/vector/builder.mjs.map +1 -0
  85. package/batteries/vector/chroma/index.d.ts +32 -0
  86. package/batteries/vector/chroma.cjs +305 -0
  87. package/batteries/vector/chroma.cjs.map +1 -0
  88. package/batteries/vector/chroma.mjs +302 -0
  89. package/batteries/vector/chroma.mjs.map +1 -0
  90. package/batteries/vector/clickhouse/index.d.ts +39 -0
  91. package/batteries/vector/clickhouse.cjs +246 -0
  92. package/batteries/vector/clickhouse.cjs.map +1 -0
  93. package/batteries/vector/clickhouse.mjs +244 -0
  94. package/batteries/vector/clickhouse.mjs.map +1 -0
  95. package/batteries/vector/cloudflare/index.d.ts +43 -0
  96. package/batteries/vector/cloudflare.cjs +397 -0
  97. package/batteries/vector/cloudflare.cjs.map +1 -0
  98. package/batteries/vector/cloudflare.mjs +395 -0
  99. package/batteries/vector/cloudflare.mjs.map +1 -0
  100. package/batteries/vector/conformance/index.d.ts +15 -0
  101. package/batteries/vector/conformance.cjs +209 -0
  102. package/batteries/vector/conformance.cjs.map +1 -0
  103. package/batteries/vector/conformance.mjs +205 -0
  104. package/batteries/vector/conformance.mjs.map +1 -0
  105. package/batteries/vector/contract.cjs +42 -0
  106. package/batteries/vector/contract.cjs.map +1 -0
  107. package/batteries/vector/contract.d.ts +39 -0
  108. package/batteries/vector/contract.mjs +40 -0
  109. package/batteries/vector/contract.mjs.map +1 -0
  110. package/batteries/vector/couchbase/index.d.ts +49 -0
  111. package/batteries/vector/couchbase.cjs +401 -0
  112. package/batteries/vector/couchbase.cjs.map +1 -0
  113. package/batteries/vector/couchbase.mjs +399 -0
  114. package/batteries/vector/couchbase.mjs.map +1 -0
  115. package/batteries/vector/duckdb/index.d.ts +33 -0
  116. package/batteries/vector/duckdb.cjs +218 -0
  117. package/batteries/vector/duckdb.cjs.map +1 -0
  118. package/batteries/vector/duckdb.mjs +216 -0
  119. package/batteries/vector/duckdb.mjs.map +1 -0
  120. package/batteries/vector/elasticsearch/index.d.ts +43 -0
  121. package/batteries/vector/elasticsearch.cjs +306 -0
  122. package/batteries/vector/elasticsearch.cjs.map +1 -0
  123. package/batteries/vector/elasticsearch.mjs +303 -0
  124. package/batteries/vector/elasticsearch.mjs.map +1 -0
  125. package/batteries/vector/exceptions.cjs +126 -0
  126. package/batteries/vector/exceptions.cjs.map +1 -0
  127. package/batteries/vector/exceptions.d.ts +142 -0
  128. package/batteries/vector/exceptions.mjs +107 -0
  129. package/batteries/vector/exceptions.mjs.map +1 -0
  130. package/batteries/vector/factory.cjs +28 -0
  131. package/batteries/vector/factory.cjs.map +1 -0
  132. package/batteries/vector/factory.d.ts +38 -0
  133. package/batteries/vector/factory.mjs +25 -0
  134. package/batteries/vector/factory.mjs.map +1 -0
  135. package/batteries/vector/filters.cjs +107 -0
  136. package/batteries/vector/filters.cjs.map +1 -0
  137. package/batteries/vector/filters.d.ts +34 -0
  138. package/batteries/vector/filters.mjs +99 -0
  139. package/batteries/vector/filters.mjs.map +1 -0
  140. package/batteries/vector/helpers.cjs +23 -0
  141. package/batteries/vector/helpers.cjs.map +1 -0
  142. package/batteries/vector/helpers.d.ts +12 -0
  143. package/batteries/vector/helpers.mjs +17 -0
  144. package/batteries/vector/helpers.mjs.map +1 -0
  145. package/batteries/vector/hnswlib/index.d.ts +35 -0
  146. package/batteries/vector/hnswlib.cjs +237 -0
  147. package/batteries/vector/hnswlib.cjs.map +1 -0
  148. package/batteries/vector/hnswlib.mjs +235 -0
  149. package/batteries/vector/hnswlib.mjs.map +1 -0
  150. package/batteries/vector/in_memory/index.d.ts +23 -0
  151. package/batteries/vector/in_memory.cjs +178 -0
  152. package/batteries/vector/in_memory.cjs.map +1 -0
  153. package/batteries/vector/in_memory.mjs +176 -0
  154. package/batteries/vector/in_memory.mjs.map +1 -0
  155. package/batteries/vector/index.d.ts +18 -0
  156. package/batteries/vector/lancedb/index.d.ts +34 -0
  157. package/batteries/vector/lancedb.cjs +224 -0
  158. package/batteries/vector/lancedb.cjs.map +1 -0
  159. package/batteries/vector/lancedb.mjs +222 -0
  160. package/batteries/vector/lancedb.mjs.map +1 -0
  161. package/batteries/vector/mariadb/index.d.ts +39 -0
  162. package/batteries/vector/mariadb.cjs +228 -0
  163. package/batteries/vector/mariadb.cjs.map +1 -0
  164. package/batteries/vector/mariadb.mjs +226 -0
  165. package/batteries/vector/mariadb.mjs.map +1 -0
  166. package/batteries/vector/meilisearch/index.d.ts +36 -0
  167. package/batteries/vector/meilisearch.cjs +242 -0
  168. package/batteries/vector/meilisearch.cjs.map +1 -0
  169. package/batteries/vector/meilisearch.mjs +240 -0
  170. package/batteries/vector/meilisearch.mjs.map +1 -0
  171. package/batteries/vector/migrate.cjs +54 -0
  172. package/batteries/vector/migrate.cjs.map +1 -0
  173. package/batteries/vector/migrate.d.ts +30 -0
  174. package/batteries/vector/migrate.mjs +52 -0
  175. package/batteries/vector/migrate.mjs.map +1 -0
  176. package/batteries/vector/milvus/index.d.ts +35 -0
  177. package/batteries/vector/milvus.cjs +357 -0
  178. package/batteries/vector/milvus.cjs.map +1 -0
  179. package/batteries/vector/milvus.mjs +354 -0
  180. package/batteries/vector/milvus.mjs.map +1 -0
  181. package/batteries/vector/mongodb/index.d.ts +46 -0
  182. package/batteries/vector/mongodb.cjs +270 -0
  183. package/batteries/vector/mongodb.cjs.map +1 -0
  184. package/batteries/vector/mongodb.mjs +268 -0
  185. package/batteries/vector/mongodb.mjs.map +1 -0
  186. package/batteries/vector/neo4j/index.d.ts +38 -0
  187. package/batteries/vector/neo4j.cjs +231 -0
  188. package/batteries/vector/neo4j.cjs.map +1 -0
  189. package/batteries/vector/neo4j.mjs +229 -0
  190. package/batteries/vector/neo4j.mjs.map +1 -0
  191. package/batteries/vector/opensearch/index.d.ts +46 -0
  192. package/batteries/vector/opensearch.cjs +316 -0
  193. package/batteries/vector/opensearch.cjs.map +1 -0
  194. package/batteries/vector/opensearch.mjs +313 -0
  195. package/batteries/vector/opensearch.mjs.map +1 -0
  196. package/batteries/vector/oracle23ai/index.d.ts +45 -0
  197. package/batteries/vector/oracle23ai.cjs +340 -0
  198. package/batteries/vector/oracle23ai.cjs.map +1 -0
  199. package/batteries/vector/oracle23ai.mjs +338 -0
  200. package/batteries/vector/oracle23ai.mjs.map +1 -0
  201. package/batteries/vector/orama/index.d.ts +23 -0
  202. package/batteries/vector/orama.cjs +272 -0
  203. package/batteries/vector/orama.cjs.map +1 -0
  204. package/batteries/vector/orama.mjs +270 -0
  205. package/batteries/vector/orama.mjs.map +1 -0
  206. package/batteries/vector/pgvector/index.d.ts +43 -0
  207. package/batteries/vector/pgvector.cjs +411 -0
  208. package/batteries/vector/pgvector.cjs.map +1 -0
  209. package/batteries/vector/pgvector.mjs +408 -0
  210. package/batteries/vector/pgvector.mjs.map +1 -0
  211. package/batteries/vector/pinecone/index.d.ts +38 -0
  212. package/batteries/vector/pinecone.cjs +415 -0
  213. package/batteries/vector/pinecone.cjs.map +1 -0
  214. package/batteries/vector/pinecone.mjs +412 -0
  215. package/batteries/vector/pinecone.mjs.map +1 -0
  216. package/batteries/vector/plan.cjs +2 -0
  217. package/batteries/vector/plan.d.ts +65 -0
  218. package/batteries/vector/plan.mjs +0 -0
  219. package/batteries/vector/qdrant/index.d.ts +34 -0
  220. package/batteries/vector/qdrant.cjs +286 -0
  221. package/batteries/vector/qdrant.cjs.map +1 -0
  222. package/batteries/vector/qdrant.mjs +284 -0
  223. package/batteries/vector/qdrant.mjs.map +1 -0
  224. package/batteries/vector/redis/index.d.ts +44 -0
  225. package/batteries/vector/redis.cjs +391 -0
  226. package/batteries/vector/redis.cjs.map +1 -0
  227. package/batteries/vector/redis.mjs +388 -0
  228. package/batteries/vector/redis.mjs.map +1 -0
  229. package/batteries/vector/retrievable.cjs +69 -0
  230. package/batteries/vector/retrievable.cjs.map +1 -0
  231. package/batteries/vector/retrievable.mjs +67 -0
  232. package/batteries/vector/retrievable.mjs.map +1 -0
  233. package/batteries/vector/retrievable_glue.d.ts +24 -0
  234. package/batteries/vector/s3vectors/index.d.ts +52 -0
  235. package/batteries/vector/s3vectors.cjs +438 -0
  236. package/batteries/vector/s3vectors.cjs.map +1 -0
  237. package/batteries/vector/s3vectors.mjs +436 -0
  238. package/batteries/vector/s3vectors.mjs.map +1 -0
  239. package/batteries/vector/schema.cjs +96 -0
  240. package/batteries/vector/schema.cjs.map +1 -0
  241. package/batteries/vector/schema.d.ts +40 -0
  242. package/batteries/vector/schema.mjs +93 -0
  243. package/batteries/vector/schema.mjs.map +1 -0
  244. package/batteries/vector/solr/index.d.ts +36 -0
  245. package/batteries/vector/solr.cjs +230 -0
  246. package/batteries/vector/solr.cjs.map +1 -0
  247. package/batteries/vector/solr.mjs +228 -0
  248. package/batteries/vector/solr.mjs.map +1 -0
  249. package/batteries/vector/sqlite_vec/index.d.ts +30 -0
  250. package/batteries/vector/sqlite_vec.cjs +318 -0
  251. package/batteries/vector/sqlite_vec.cjs.map +1 -0
  252. package/batteries/vector/sqlite_vec.mjs +316 -0
  253. package/batteries/vector/sqlite_vec.mjs.map +1 -0
  254. package/batteries/vector/surrealdb/index.d.ts +37 -0
  255. package/batteries/vector/surrealdb.cjs +230 -0
  256. package/batteries/vector/surrealdb.cjs.map +1 -0
  257. package/batteries/vector/surrealdb.mjs +228 -0
  258. package/batteries/vector/surrealdb.mjs.map +1 -0
  259. package/batteries/vector/types.cjs +2 -0
  260. package/batteries/vector/types.d.ts +100 -0
  261. package/batteries/vector/types.mjs +0 -0
  262. package/batteries/vector/typesense/index.d.ts +38 -0
  263. package/batteries/vector/typesense.cjs +272 -0
  264. package/batteries/vector/typesense.cjs.map +1 -0
  265. package/batteries/vector/typesense.mjs +270 -0
  266. package/batteries/vector/typesense.mjs.map +1 -0
  267. package/batteries/vector/validation.cjs +90 -0
  268. package/batteries/vector/validation.cjs.map +1 -0
  269. package/batteries/vector/validation.d.ts +18 -0
  270. package/batteries/vector/validation.mjs +83 -0
  271. package/batteries/vector/validation.mjs.map +1 -0
  272. package/batteries/vector/vector_store_constructor.cjs +56 -0
  273. package/batteries/vector/vector_store_constructor.cjs.map +1 -0
  274. package/batteries/vector/vector_store_constructor.d.ts +30 -0
  275. package/batteries/vector/vector_store_constructor.mjs +53 -0
  276. package/batteries/vector/vector_store_constructor.mjs.map +1 -0
  277. package/batteries/vector/vespa/index.d.ts +39 -0
  278. package/batteries/vector/vespa.cjs +423 -0
  279. package/batteries/vector/vespa.cjs.map +1 -0
  280. package/batteries/vector/vespa.mjs +421 -0
  281. package/batteries/vector/vespa.mjs.map +1 -0
  282. package/batteries/vector/weaviate/index.d.ts +57 -0
  283. package/batteries/vector/weaviate.cjs +325 -0
  284. package/batteries/vector/weaviate.cjs.map +1 -0
  285. package/batteries/vector/weaviate.mjs +322 -0
  286. package/batteries/vector/weaviate.mjs.map +1 -0
  287. package/batteries/vector.cjs +63 -0
  288. package/batteries/vector.mjs +14 -0
  289. package/batteries.cjs +62 -0
  290. package/batteries.mjs +15 -1
  291. package/{chunk-kRvK8_k2.mjs → chunk-Bpcn9VDT.mjs} +5 -1
  292. package/{common-lMrnzoyn.mjs → common-BT0nfCi9.mjs} +8 -8
  293. package/{common-lMrnzoyn.mjs.map → common-BT0nfCi9.mjs.map} +1 -1
  294. package/{common-D_e5zYsG.js → common-Cj8TaQ9U.js} +8 -8
  295. package/{common-D_e5zYsG.js.map → common-Cj8TaQ9U.js.map} +1 -1
  296. package/common.cjs +7 -7
  297. package/common.mjs +7 -7
  298. package/{dispatch_runner-CpuyATj1.js → dispatch_runner-BHBNupqp.js} +2 -2
  299. package/dispatch_runner-BHBNupqp.js.map +1 -0
  300. package/{dispatch_runner-CDF3X0nv.mjs → dispatch_runner-DPcS7Y_M.mjs} +2 -2
  301. package/dispatch_runner-DPcS7Y_M.mjs.map +1 -0
  302. package/dispatch_runner.cjs +1 -1
  303. package/dispatch_runner.mjs +1 -1
  304. package/forge.cjs +4 -4
  305. package/forge.mjs +4 -4
  306. package/guards.cjs +8 -8
  307. package/guards.mjs +8 -8
  308. package/index.cjs +12 -12
  309. package/index.mjs +12 -12
  310. package/lib/classes/tool_registry.d.ts +70 -4
  311. package/mcp/adk-docs-corpus.json +1 -1
  312. package/package.json +424 -88
  313. package/skills/adk-assembly/SKILL.md +2 -2
  314. package/{spooled_artifact-B8gIIn9h.js → spooled_artifact-BTq6Nzfy.js} +4 -4
  315. package/spooled_artifact-BTq6Nzfy.js.map +1 -0
  316. package/{spooled_artifact-CWoKUDEm.mjs → spooled_artifact-CHoZgWwI.mjs} +4 -4
  317. package/spooled_artifact-CHoZgWwI.mjs.map +1 -0
  318. package/spooled_artifact.cjs +2 -2
  319. package/spooled_artifact.mjs +2 -2
  320. package/{spooled_markdown_artifact-DQX0RCdI.js → spooled_markdown_artifact-CALSDxIx.js} +3 -3
  321. package/{spooled_markdown_artifact-DQX0RCdI.js.map → spooled_markdown_artifact-CALSDxIx.js.map} +1 -1
  322. package/{spooled_markdown_artifact-CNle4jXN.mjs → spooled_markdown_artifact-Ci5UL7l4.mjs} +3 -3
  323. package/{spooled_markdown_artifact-CNle4jXN.mjs.map → spooled_markdown_artifact-Ci5UL7l4.mjs.map} +1 -1
  324. package/src/types/evaluatex.d.ts +31 -0
  325. package/{thought-BD6AkkOr.js → thought-BbwhJ1wb.js} +4 -4
  326. package/thought-BbwhJ1wb.js.map +1 -0
  327. package/{thought-B_P8LiB6.mjs → thought-D34QQZZ9.mjs} +4 -4
  328. package/thought-D34QQZZ9.mjs.map +1 -0
  329. package/{tool-CRZSUcdP.mjs → tool-CMhaDRNd.mjs} +3 -3
  330. package/tool-CMhaDRNd.mjs.map +1 -0
  331. package/{tool-CX9vNHAw.js → tool-CVyZkFC7.js} +3 -3
  332. package/tool-CVyZkFC7.js.map +1 -0
  333. package/{tool_call-BUeMuCc6.mjs → tool_call-CV5qVNlb.mjs} +3 -3
  334. package/{tool_call-BUeMuCc6.mjs.map → tool_call-CV5qVNlb.mjs.map} +1 -1
  335. package/{tool_call--7ti-frB.js → tool_call-Db68hB7y.js} +3 -3
  336. package/{tool_call--7ti-frB.js.map → tool_call-Db68hB7y.js.map} +1 -1
  337. package/{tool_registry-BGHg6KTq.mjs → tool_registry-D1pSSlsd.mjs} +109 -22
  338. package/tool_registry-D1pSSlsd.mjs.map +1 -0
  339. package/{tool_registry-CtCQ4Xoz.js → tool_registry-DYUYqXvo.js} +109 -22
  340. package/tool_registry-DYUYqXvo.js.map +1 -0
  341. package/{turn_runner-BJTtAORU.js → turn_runner-DqWHNP80.js} +5 -5
  342. package/turn_runner-DqWHNP80.js.map +1 -0
  343. package/{turn_runner-C02LZHjt.mjs → turn_runner-fg1Wc3dK.mjs} +5 -5
  344. package/turn_runner-fg1Wc3dK.mjs.map +1 -0
  345. package/turn_runner.cjs +1 -1
  346. package/turn_runner.mjs +1 -1
  347. package/dispatch_runner-CDF3X0nv.mjs.map +0 -1
  348. package/dispatch_runner-CpuyATj1.js.map +0 -1
  349. package/spooled_artifact-B8gIIn9h.js.map +0 -1
  350. package/spooled_artifact-CWoKUDEm.mjs.map +0 -1
  351. package/thought-BD6AkkOr.js.map +0 -1
  352. package/thought-B_P8LiB6.mjs.map +0 -1
  353. package/tool-CRZSUcdP.mjs.map +0 -1
  354. package/tool-CX9vNHAw.js.map +0 -1
  355. package/tool_registry-BGHg6KTq.mjs.map +0 -1
  356. package/tool_registry-CtCQ4Xoz.js.map +0 -1
  357. package/turn_runner-BJTtAORU.js.map +0 -1
  358. package/turn_runner-C02LZHjt.mjs.map +0 -1
@@ -0,0 +1,354 @@
1
+ import { isFilterCondition, isFilterGroup, isRawFilter } from "./filters.mjs";
2
+ import { normalizeScore } from "./helpers.mjs";
3
+ import { E_VECTOR_STORE_COLLECTION_FAILED, E_VECTOR_STORE_CONNECTION_FAILED, E_VECTOR_STORE_DELETE_FAILED, E_VECTOR_STORE_DIMENSION_MISMATCH, E_VECTOR_STORE_DRIVER_UNAVAILABLE, E_VECTOR_STORE_SEARCH_FAILED, E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR, E_VECTOR_STORE_UPSERT_FAILED } from "./exceptions.mjs";
4
+ import { BaseVectorStore } from "./contract.mjs";
5
+ import { validateRecords } from "./validation.mjs";
6
+ //#region src/batteries/vector/milvus/index.ts
7
+ /**
8
+ * @module @nhtio/adk/batteries/vector/milvus
9
+ */
10
+ var getMilvusClient = async () => {
11
+ try {
12
+ return (await import("@zilliz/milvus2-sdk-node")).MilvusClient;
13
+ } catch {
14
+ throw new E_VECTOR_STORE_DRIVER_UNAVAILABLE(["@zilliz/milvus2-sdk-node"]);
15
+ }
16
+ };
17
+ var getDataType = async () => {
18
+ try {
19
+ return (await import("@zilliz/milvus2-sdk-node")).DataType;
20
+ } catch {
21
+ throw new E_VECTOR_STORE_DRIVER_UNAVAILABLE(["@zilliz/milvus2-sdk-node"]);
22
+ }
23
+ };
24
+ var mapMetricToMilvus = (metric) => {
25
+ if (metric === "cosine") return "COSINE";
26
+ if (metric === "dot") return "IP";
27
+ if (metric === "euclidean") return "L2";
28
+ return "COSINE";
29
+ };
30
+ var MilvusVectorStore = class extends BaseVectorStore {
31
+ capabilities = {
32
+ transactions: false,
33
+ namedVectors: false,
34
+ rename: true,
35
+ rawSql: false,
36
+ builtInEncoding: false,
37
+ consistency: {
38
+ configurable: false,
39
+ default: "strong",
40
+ modes: ["strong"]
41
+ }
42
+ };
43
+ #client = null;
44
+ #dims = /* @__PURE__ */ new Map();
45
+ get #opts() {
46
+ return this.options;
47
+ }
48
+ static isAvailable() {
49
+ return typeof process !== "undefined";
50
+ }
51
+ isAvailable() {
52
+ return typeof process !== "undefined";
53
+ }
54
+ async connect() {
55
+ if (this.#client) return;
56
+ const MilvusClient = await getMilvusClient();
57
+ const c = this.#opts.connection || {};
58
+ let address = c.address;
59
+ if (!address && c.url) try {
60
+ const url = new URL(c.url);
61
+ address = `${url.hostname}:${url.port || (url.protocol === "https:" ? "443" : "19530")}`;
62
+ } catch {
63
+ throw new E_VECTOR_STORE_CONNECTION_FAILED(["Invalid connection URL"]);
64
+ }
65
+ if (!address) address = "localhost:19530";
66
+ try {
67
+ this.#client = new MilvusClient({
68
+ address,
69
+ token: c.token,
70
+ username: c.username,
71
+ password: c.password,
72
+ ssl: c.ssl
73
+ });
74
+ } catch (err) {
75
+ throw new E_VECTOR_STORE_CONNECTION_FAILED([String(err)]);
76
+ }
77
+ }
78
+ async close() {
79
+ if (this.#client) {
80
+ await this.#client.closeConnection?.();
81
+ this.#client = null;
82
+ }
83
+ }
84
+ async createCollection(spec, ifNotExists) {
85
+ const client = this.#client || (await this.connect(), this.#client);
86
+ const collectionName = spec.collection;
87
+ const metric = spec.vector.metric ?? "cosine";
88
+ const dim = spec.vector.dimensions;
89
+ if (ifNotExists && await this.hasCollection(collectionName)) return;
90
+ try {
91
+ const has = await client.hasCollection({ collection_name: collectionName });
92
+ if (has.value && !ifNotExists) throw new E_VECTOR_STORE_COLLECTION_FAILED(["create", "collection exists"]);
93
+ if (has.value && ifNotExists) return;
94
+ const DataType = await getDataType();
95
+ await client.createCollection({
96
+ collection_name: collectionName,
97
+ fields: [
98
+ {
99
+ name: "id",
100
+ data_type: DataType.VarChar,
101
+ is_primary_key: true,
102
+ max_length: 512
103
+ },
104
+ {
105
+ name: "vector",
106
+ data_type: DataType.FloatVector,
107
+ dim
108
+ },
109
+ {
110
+ name: "document",
111
+ data_type: DataType.VarChar,
112
+ max_length: 65535
113
+ },
114
+ {
115
+ name: "metadata",
116
+ data_type: DataType.JSON
117
+ }
118
+ ]
119
+ });
120
+ const indexType = "AUTOINDEX";
121
+ const metricType = mapMetricToMilvus(metric);
122
+ await client.createIndex({
123
+ collection_name: collectionName,
124
+ field_name: "vector",
125
+ index_type: indexType,
126
+ metric_type: metricType
127
+ });
128
+ await client.loadCollectionSync({ collection_name: collectionName });
129
+ this.#dims.set(collectionName, dim);
130
+ } catch (err) {
131
+ throw new E_VECTOR_STORE_COLLECTION_FAILED(["createCollection", String(err)]);
132
+ }
133
+ }
134
+ async dropCollection(collection, ifExists) {
135
+ const client = this.#client || (await this.connect(), this.#client);
136
+ if (ifExists && !await this.hasCollection(collection)) return;
137
+ try {
138
+ if (!(await client.hasCollection({ collection_name: collection })).value && !ifExists) throw new E_VECTOR_STORE_COLLECTION_FAILED(["drop", "collection does not exist"]);
139
+ await client.dropCollection({ collection_name: collection });
140
+ this.#dims.delete(collection);
141
+ } catch (err) {
142
+ throw new E_VECTOR_STORE_COLLECTION_FAILED(["dropCollection", String(err)]);
143
+ }
144
+ }
145
+ async hasCollection(collection) {
146
+ const client = this.#client || (await this.connect(), this.#client);
147
+ try {
148
+ return !!(await client.hasCollection({ collection_name: collection })).value;
149
+ } catch {
150
+ return false;
151
+ }
152
+ }
153
+ async renameCollection(from, to) {
154
+ const client = this.#client || (await this.connect(), this.#client);
155
+ try {
156
+ await client.renameCollection({
157
+ old_collection_name: from,
158
+ new_collection_name: to
159
+ });
160
+ if (this.#dims.has(from)) {
161
+ this.#dims.set(to, this.#dims.get(from));
162
+ this.#dims.delete(from);
163
+ }
164
+ } catch (err) {
165
+ throw new E_VECTOR_STORE_COLLECTION_FAILED(["renameCollection", String(err)]);
166
+ }
167
+ }
168
+ async executeUpsert(plan) {
169
+ if (plan.records.length === 0) return;
170
+ validateRecords(plan.records);
171
+ const client = this.#client || (await this.connect(), this.#client);
172
+ const collectionName = plan.collection;
173
+ const dim = this.#dims.get(collectionName);
174
+ const rows = [];
175
+ for (const r of plan.records) {
176
+ let vector = r.vector;
177
+ if (!vector && r.document) {
178
+ const [v] = await this.encode([r.document], "document");
179
+ vector = v;
180
+ }
181
+ if (!vector) throw new E_VECTOR_STORE_UPSERT_FAILED(["Record missing vector and document"]);
182
+ if (dim !== void 0 && vector.length !== dim) throw new E_VECTOR_STORE_DIMENSION_MISMATCH([dim, vector.length]);
183
+ rows.push({
184
+ id: r.id,
185
+ vector,
186
+ document: r.document ?? "",
187
+ metadata: r.metadata ?? {}
188
+ });
189
+ }
190
+ try {
191
+ await client.upsert({
192
+ collection_name: collectionName,
193
+ data: rows
194
+ });
195
+ await client.flushSync({ collection_names: [collectionName] });
196
+ } catch (err) {
197
+ throw new E_VECTOR_STORE_UPSERT_FAILED([String(err)]);
198
+ }
199
+ }
200
+ async executeSearch(plan) {
201
+ const client = this.#client || (await this.connect(), this.#client);
202
+ const metric = this.#opts.metric ?? "cosine";
203
+ let queryVector;
204
+ if (plan.near) {
205
+ if ("vector" in plan.near) queryVector = plan.near.vector;
206
+ else if ("serverText" in plan.near) {
207
+ const [v] = await this.encode([plan.near.serverText], "query");
208
+ queryVector = v;
209
+ } else if ("id" in plan.near) {
210
+ const res = await client.query({
211
+ collection_name: plan.collection,
212
+ filter: `id == "${plan.near.id}"`,
213
+ output_fields: ["vector"]
214
+ });
215
+ if (res.data.length === 0) throw new E_VECTOR_STORE_SEARCH_FAILED(["Referenced id not found: " + plan.near.id]);
216
+ queryVector = res.data[0].vector;
217
+ }
218
+ }
219
+ const outputFields = [
220
+ "id",
221
+ "document",
222
+ "metadata"
223
+ ];
224
+ if (plan.projection.vector) outputFields.push("vector");
225
+ const milvusFilter = translateMilvusFilter(plan.filter);
226
+ let results;
227
+ if (queryVector) results = await client.search({
228
+ collection_name: plan.collection,
229
+ data: [queryVector],
230
+ limit: plan.topK,
231
+ offset: plan.offset,
232
+ filter: milvusFilter,
233
+ output_fields: outputFields,
234
+ consistency_level: "Strong"
235
+ });
236
+ else results = await client.query({
237
+ collection_name: plan.collection,
238
+ filter: milvusFilter || "",
239
+ limit: plan.topK,
240
+ offset: plan.offset,
241
+ output_fields: outputFields,
242
+ consistency_level: "Strong"
243
+ });
244
+ const hitList = results.results || results.data || [];
245
+ const proj = plan.projection;
246
+ return hitList.map((hit) => this.projectHit(hit, proj, metric));
247
+ }
248
+ async executeDelete(plan) {
249
+ const client = this.#client || (await this.connect(), this.#client);
250
+ try {
251
+ const collectionName = plan.collection;
252
+ if (plan.ids) {
253
+ const filter = `id in [${plan.ids.map((i) => JSON.stringify(i)).join(",")}]`;
254
+ await client.delete({
255
+ collection_name: collectionName,
256
+ filter
257
+ });
258
+ } else if (plan.filter) {
259
+ const filter = translateMilvusFilter(plan.filter);
260
+ await client.delete({
261
+ collection_name: collectionName,
262
+ filter
263
+ });
264
+ } else await client.delete({
265
+ collection_name: collectionName,
266
+ filter: "id != \"\""
267
+ });
268
+ } catch (err) {
269
+ throw new E_VECTOR_STORE_DELETE_FAILED([String(err)]);
270
+ }
271
+ }
272
+ projectHit(hit, projection, metric) {
273
+ const out = {};
274
+ if (projection.id) out.id = hit.id;
275
+ if (projection.vector && "vector" in hit) out.vector = hit.vector;
276
+ if (projection.document) out.document = hit.document;
277
+ if (projection.metadata) out.metadata = hit.metadata;
278
+ if ("score" in hit && hit.score !== void 0) {
279
+ const kind = metric === "euclidean" ? "distance" : "similarity";
280
+ out.score = normalizeScore(hit.score, metric, kind);
281
+ }
282
+ return out;
283
+ }
284
+ translateMilvusFilter(filter) {
285
+ return translateMilvusFilter(filter);
286
+ }
287
+ };
288
+ var translateMilvusFilter = (filter) => {
289
+ if (!filter) return "";
290
+ if (isRawFilter(filter)) {
291
+ if (filter.$dialect === "milvus" && typeof filter.$raw === "string") return filter.$raw;
292
+ throw new E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR(["milvus", String(filter.$dialect)]);
293
+ }
294
+ if (isFilterCondition(filter)) {
295
+ const { field, op, value } = filter;
296
+ const jsonField = `metadata["${field}"]`;
297
+ if (value === void 0) {
298
+ if (op === "exists") return `exists ${jsonField}`;
299
+ throw new E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR(["milvus", op]);
300
+ }
301
+ const toJsonValue = (v) => {
302
+ if (typeof v === "string") return JSON.stringify(v);
303
+ if (typeof v === "number" || typeof v === "boolean") return String(v);
304
+ if (Array.isArray(v)) return `[${v.map(toJsonValue).join(",")}]`;
305
+ return JSON.stringify(v);
306
+ };
307
+ if (op === "eq") return `${jsonField} == ${toJsonValue(value)}`;
308
+ if (op === "ne") return `${jsonField} != ${toJsonValue(value)}`;
309
+ if (op === "gt") return `${jsonField} > ${toJsonValue(value)}`;
310
+ if (op === "gte") return `${jsonField} >= ${toJsonValue(value)}`;
311
+ if (op === "lt") return `${jsonField} < ${toJsonValue(value)}`;
312
+ if (op === "lte") return `${jsonField} <= ${toJsonValue(value)}`;
313
+ if (op === "in") {
314
+ if (!Array.isArray(value)) return "";
315
+ return `${jsonField} in [${value.map(toJsonValue).join(",")}]`;
316
+ }
317
+ if (op === "nin") {
318
+ if (!Array.isArray(value)) return "";
319
+ return `${jsonField} not in [${value.map(toJsonValue).join(",")}]`;
320
+ }
321
+ if (op === "exists") return `exists ${jsonField}`;
322
+ if (op === "contains") return `json_contains(${jsonField}, ${toJsonValue(value)})`;
323
+ throw new E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR(["milvus", op]);
324
+ }
325
+ if (isFilterGroup(filter)) {
326
+ const { and, or, not } = filter;
327
+ const parts = [];
328
+ if (and) {
329
+ const children = and.map((f) => translateMilvusFilter(f)).filter((c) => c !== "");
330
+ if (children.length === 0) return "";
331
+ if (children.length === 1) return children[0];
332
+ parts.push(`(${children.join(" && ")})`);
333
+ }
334
+ if (or) {
335
+ const children = or.map((f) => translateMilvusFilter(f)).filter((c) => c !== "");
336
+ if (children.length === 0) return "";
337
+ if (children.length === 1) return children[0];
338
+ parts.push(`(${children.join(" || ")})`);
339
+ }
340
+ if (not) {
341
+ const child = translateMilvusFilter(not);
342
+ if (child === "") return "";
343
+ parts.push(`!(${child})`);
344
+ }
345
+ if (parts.length === 0) return "";
346
+ if (parts.length === 1) return parts[0];
347
+ return parts.join(" && ");
348
+ }
349
+ return "";
350
+ };
351
+ //#endregion
352
+ export { MilvusVectorStore, translateMilvusFilter };
353
+
354
+ //# sourceMappingURL=milvus.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"milvus.mjs","names":["#opts","#client","#dims"],"sources":["../../../src/batteries/vector/milvus/index.ts"],"sourcesContent":["/**\n * @module @nhtio/adk/batteries/vector/milvus\n */\n\nimport { normalizeScore } from '../helpers'\nimport { BaseVectorStore } from '../contract'\nimport { validateRecords } from '../validation'\nimport { isFilterCondition, isRawFilter, isFilterGroup } from '../filters'\nimport {\n E_VECTOR_STORE_DRIVER_UNAVAILABLE,\n E_VECTOR_STORE_COLLECTION_FAILED,\n E_VECTOR_STORE_UPSERT_FAILED,\n E_VECTOR_STORE_SEARCH_FAILED,\n E_VECTOR_STORE_DELETE_FAILED,\n E_VECTOR_STORE_DIMENSION_MISMATCH,\n E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR,\n E_VECTOR_STORE_CONNECTION_FAILED,\n} from '../exceptions'\nimport type { VectorFilter } from '../filters'\nimport type { SearchPlan, UpsertPlan, DeletePlan, CollectionSpec } from '../plan'\nimport type { VectorMatch, VectorStoreCapabilities, BaseVectorStoreOptions } from '../types'\n\nexport interface MilvusVectorStoreOptions extends BaseVectorStoreOptions {\n connection?: {\n address?: string\n url?: string\n token?: string\n username?: string\n password?: string\n ssl?: boolean\n }\n}\n\nconst getMilvusClient = async () => {\n try {\n const mod = await import('@zilliz/milvus2-sdk-node')\n return mod.MilvusClient\n } catch {\n throw new E_VECTOR_STORE_DRIVER_UNAVAILABLE(['@zilliz/milvus2-sdk-node'])\n }\n}\n\nconst getDataType = async () => {\n try {\n const mod = await import('@zilliz/milvus2-sdk-node')\n return mod.DataType\n } catch {\n throw new E_VECTOR_STORE_DRIVER_UNAVAILABLE(['@zilliz/milvus2-sdk-node'])\n }\n}\n\nconst mapMetricToMilvus = (metric: string): string => {\n if (metric === 'cosine') return 'COSINE'\n if (metric === 'dot') return 'IP'\n if (metric === 'euclidean') return 'L2'\n return 'COSINE'\n}\n\nexport class MilvusVectorStore extends BaseVectorStore {\n readonly capabilities: VectorStoreCapabilities = {\n transactions: false,\n namedVectors: false,\n rename: true,\n rawSql: false,\n builtInEncoding: false,\n // Strongly consistent (search/query use consistency_level 'Strong'); the option is a no-op.\n consistency: { configurable: false, default: 'strong', modes: ['strong'] },\n }\n #client: any | null = null\n #dims: Map<string, number> = new Map()\n get #opts() {\n return this.options as MilvusVectorStoreOptions\n }\n static isAvailable(): boolean {\n return typeof process !== 'undefined'\n }\n isAvailable(): boolean {\n return typeof process !== 'undefined'\n }\n async connect(): Promise<void> {\n if (this.#client) return\n const MilvusClient = await getMilvusClient()\n const c = this.#opts.connection || {}\n let address = c.address\n if (!address && c.url) {\n try {\n const url = new URL(c.url)\n const host = url.hostname\n const port = url.port || (url.protocol === 'https:' ? '443' : '19530')\n address = `${host}:${port}`\n } catch {\n throw new E_VECTOR_STORE_CONNECTION_FAILED(['Invalid connection URL'])\n }\n }\n if (!address) {\n address = 'localhost:19530'\n }\n try {\n this.#client = new MilvusClient({\n address,\n token: c.token,\n username: c.username,\n password: c.password,\n ssl: c.ssl,\n })\n } catch (err) {\n throw new E_VECTOR_STORE_CONNECTION_FAILED([String(err)])\n }\n }\n async close(): Promise<void> {\n if (this.#client) {\n await this.#client.closeConnection?.()\n this.#client = null\n }\n }\n async createCollection(spec: CollectionSpec, ifNotExists: boolean): Promise<void> {\n const client = this.#client || (await this.connect(), this.#client!)\n const collectionName = spec.collection\n const metric = spec.vector.metric ?? 'cosine'\n const dim = spec.vector.dimensions\n if (ifNotExists && (await this.hasCollection(collectionName))) return\n try {\n const has = await client.hasCollection({ collection_name: collectionName })\n if (has.value && !ifNotExists) {\n throw new E_VECTOR_STORE_COLLECTION_FAILED(['create', 'collection exists'])\n }\n if (has.value && ifNotExists) return\n const DataType = await getDataType()\n await client.createCollection({\n collection_name: collectionName,\n fields: [\n { name: 'id', data_type: DataType.VarChar, is_primary_key: true, max_length: 512 },\n { name: 'vector', data_type: DataType.FloatVector, dim },\n { name: 'document', data_type: DataType.VarChar, max_length: 65535 },\n { name: 'metadata', data_type: DataType.JSON },\n ],\n })\n const indexType = 'AUTOINDEX'\n const metricType = mapMetricToMilvus(metric)\n await client.createIndex({\n collection_name: collectionName,\n field_name: 'vector',\n index_type: indexType,\n metric_type: metricType,\n })\n await client.loadCollectionSync({ collection_name: collectionName })\n this.#dims.set(collectionName, dim)\n } catch (err) {\n throw new E_VECTOR_STORE_COLLECTION_FAILED(['createCollection', String(err)])\n }\n }\n async dropCollection(collection: string, ifExists: boolean): Promise<void> {\n const client = this.#client || (await this.connect(), this.#client!)\n if (ifExists && !(await this.hasCollection(collection))) return\n try {\n const has = await client.hasCollection({ collection_name: collection })\n if (!has.value && !ifExists) {\n throw new E_VECTOR_STORE_COLLECTION_FAILED(['drop', 'collection does not exist'])\n }\n await client.dropCollection({ collection_name: collection })\n this.#dims.delete(collection)\n } catch (err) {\n throw new E_VECTOR_STORE_COLLECTION_FAILED(['dropCollection', String(err)])\n }\n }\n async hasCollection(collection: string): Promise<boolean> {\n const client = this.#client || (await this.connect(), this.#client!)\n try {\n const r = await client.hasCollection({ collection_name: collection })\n return !!r.value\n } catch {\n return false\n }\n }\n async renameCollection(from: string, to: string): Promise<void> {\n const client = this.#client || (await this.connect(), this.#client!)\n try {\n await client.renameCollection({ old_collection_name: from, new_collection_name: to })\n if (this.#dims.has(from)) {\n this.#dims.set(to, this.#dims.get(from)!)\n this.#dims.delete(from)\n }\n } catch (err) {\n throw new E_VECTOR_STORE_COLLECTION_FAILED(['renameCollection', String(err)])\n }\n }\n async executeUpsert(plan: UpsertPlan): Promise<void> {\n if (plan.records.length === 0) return\n validateRecords(plan.records)\n const client = this.#client || (await this.connect(), this.#client!)\n const collectionName = plan.collection\n const dim = this.#dims.get(collectionName)\n const rows: any[] = []\n for (const r of plan.records) {\n let vector = r.vector\n if (!vector && r.document) {\n const [v] = await this.encode([r.document], 'document')\n vector = v\n }\n if (!vector) {\n throw new E_VECTOR_STORE_UPSERT_FAILED(['Record missing vector and document'])\n }\n if (dim !== undefined && vector.length !== dim) {\n throw new E_VECTOR_STORE_DIMENSION_MISMATCH([dim, vector.length])\n }\n rows.push({\n id: r.id,\n vector,\n document: r.document ?? '',\n metadata: r.metadata ?? {},\n })\n }\n try {\n await client.upsert({ collection_name: collectionName, data: rows })\n await client.flushSync({ collection_names: [collectionName] })\n } catch (err) {\n throw new E_VECTOR_STORE_UPSERT_FAILED([String(err)])\n }\n }\n async executeSearch(plan: SearchPlan): Promise<VectorMatch[]> {\n const client = this.#client || (await this.connect(), this.#client!)\n const metric = this.#opts.metric ?? 'cosine'\n let queryVector: number[] | undefined\n if (plan.near) {\n if ('vector' in plan.near) {\n queryVector = plan.near.vector\n } else if ('serverText' in plan.near) {\n const [v] = await this.encode([plan.near.serverText], 'query')\n queryVector = v\n } else if ('id' in plan.near) {\n const res = await client.query({\n collection_name: plan.collection,\n filter: `id == \"${plan.near.id}\"`,\n output_fields: ['vector'],\n })\n if (res.data.length === 0) {\n throw new E_VECTOR_STORE_SEARCH_FAILED(['Referenced id not found: ' + plan.near.id])\n }\n queryVector = res.data[0].vector as number[]\n }\n }\n const outputFields = ['id', 'document', 'metadata']\n if (plan.projection.vector) {\n outputFields.push('vector')\n }\n const milvusFilter = translateMilvusFilter(plan.filter)\n let results: any\n if (queryVector) {\n results = await client.search({\n collection_name: plan.collection,\n data: [queryVector],\n limit: plan.topK,\n offset: plan.offset,\n filter: milvusFilter,\n output_fields: outputFields,\n consistency_level: 'Strong',\n })\n } else {\n results = await client.query({\n collection_name: plan.collection,\n filter: milvusFilter || '',\n limit: plan.topK,\n offset: plan.offset,\n output_fields: outputFields,\n consistency_level: 'Strong',\n })\n }\n const hitList = results.results || results.data || []\n const proj = plan.projection\n return hitList.map((hit: any) => this.projectHit(hit, proj, metric))\n }\n async executeDelete(plan: DeletePlan): Promise<void> {\n const client = this.#client || (await this.connect(), this.#client!)\n try {\n const collectionName = plan.collection\n if (plan.ids) {\n const filter = `id in [${plan.ids.map((i) => JSON.stringify(i)).join(',')}]`\n await client.delete({ collection_name: collectionName, filter })\n } else if (plan.filter) {\n const filter = translateMilvusFilter(plan.filter)\n await client.delete({ collection_name: collectionName, filter })\n } else {\n await client.delete({ collection_name: collectionName, filter: 'id != \"\"' })\n }\n } catch (err) {\n throw new E_VECTOR_STORE_DELETE_FAILED([String(err)])\n }\n }\n projectHit(hit: any, projection: any, metric: string): VectorMatch {\n const out: VectorMatch = {}\n if (projection.id) {\n out.id = hit.id\n }\n if (projection.vector && 'vector' in hit) {\n out.vector = hit.vector\n }\n if (projection.document) {\n out.document = hit.document\n }\n if (projection.metadata) {\n out.metadata = hit.metadata\n }\n if ('score' in hit && hit.score !== undefined) {\n const kind = metric === 'euclidean' ? 'distance' : 'similarity'\n out.score = normalizeScore(hit.score as number, metric as any, kind)\n }\n return out\n }\n translateMilvusFilter(filter?: VectorFilter): string {\n return translateMilvusFilter(filter)\n }\n}\n\nexport const translateMilvusFilter = (filter?: VectorFilter): string => {\n if (!filter) return ''\n if (isRawFilter(filter)) {\n if (filter.$dialect === 'milvus' && typeof filter.$raw === 'string') {\n return filter.$raw\n }\n throw new E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR(['milvus', String(filter.$dialect)])\n }\n if (isFilterCondition(filter)) {\n const { field, op, value } = filter\n const jsonField = `metadata[\"${field}\"]`\n if (value === undefined) {\n if (op === 'exists') {\n return `exists ${jsonField}`\n }\n throw new E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR(['milvus', op])\n }\n const toJsonValue = (v: unknown): string => {\n if (typeof v === 'string') return JSON.stringify(v)\n if (typeof v === 'number' || typeof v === 'boolean') return String(v)\n if (Array.isArray(v)) {\n return `[${v.map(toJsonValue).join(',')}]`\n }\n return JSON.stringify(v)\n }\n if (op === 'eq') return `${jsonField} == ${toJsonValue(value)}`\n if (op === 'ne') return `${jsonField} != ${toJsonValue(value)}`\n if (op === 'gt') return `${jsonField} > ${toJsonValue(value)}`\n if (op === 'gte') return `${jsonField} >= ${toJsonValue(value)}`\n if (op === 'lt') return `${jsonField} < ${toJsonValue(value)}`\n if (op === 'lte') return `${jsonField} <= ${toJsonValue(value)}`\n if (op === 'in') {\n if (!Array.isArray(value)) return ''\n return `${jsonField} in [${value.map(toJsonValue).join(',')}]`\n }\n if (op === 'nin') {\n if (!Array.isArray(value)) return ''\n return `${jsonField} not in [${value.map(toJsonValue).join(',')}]`\n }\n if (op === 'exists') {\n return `exists ${jsonField}`\n }\n if (op === 'contains') {\n return `json_contains(${jsonField}, ${toJsonValue(value)})`\n }\n throw new E_VECTOR_STORE_UNSUPPORTED_FILTER_OPERATOR(['milvus', op])\n }\n if (isFilterGroup(filter)) {\n const { and, or, not } = filter\n const parts: string[] = []\n if (and) {\n const children = and.map((f) => translateMilvusFilter(f)).filter((c) => c !== '')\n if (children.length === 0) return ''\n if (children.length === 1) return children[0]\n parts.push(`(${children.join(' && ')})`)\n }\n if (or) {\n const children = or.map((f) => translateMilvusFilter(f)).filter((c) => c !== '')\n if (children.length === 0) return ''\n if (children.length === 1) return children[0]\n parts.push(`(${children.join(' || ')})`)\n }\n if (not) {\n const child = translateMilvusFilter(not)\n if (child === '') return ''\n parts.push(`!(${child})`)\n }\n if (parts.length === 0) return ''\n if (parts.length === 1) return parts[0]\n return parts.join(' && ')\n }\n return ''\n}\n"],"mappings":";;;;;;;;;AAiCA,IAAM,kBAAkB,YAAY;CAClC,IAAI;EAEF,QAAO,MADW,OAAO,6BACd;CACb,QAAQ;EACN,MAAM,IAAI,kCAAkC,CAAC,0BAA0B,CAAC;CAC1E;AACF;AAEA,IAAM,cAAc,YAAY;CAC9B,IAAI;EAEF,QAAO,MADW,OAAO,6B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AsB,CAAC,CAAC,EAAE,QAAQ,MAAM,MAAM,EAAE;GAC/E,IAAI,SAAS,WAAW,GAAG,OAAO;GAClC,IAAI,SAAS,WAAW,GAAG,OAAO,SAAS;GAC3C,MAAM,KAAK,IAAI,SAAS,KAAK,MAAM,EAAE,EAAE;EACzC;EACA,IAAI,KAAK;GACP,MAAM,QAAQ,sBAAsB,GAAG;GACvC,IAAI,UAAU,IAAI,OAAO;GACzB,MAAM,KAAK,KAAK,MAAM,EAAE;EAC1B;EACA,IAAI,MAAM,WAAW,GAAG,OAAO;EAC/B,IAAI,MAAM,WAAW,GAAG,OAAO,MAAM;EACrC,OAAO,MAAM,KAAK,MAAM;CAC1B;CACA,OAAO;AACT"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * @module @nhtio/adk/batteries/vector/mongodb
3
+ *
4
+ * MongoDB Atlas Vector Search adapter. Each collection is a MongoDB collection with an Atlas
5
+ * `vectorSearch` index on `vec`; KNN uses the `$vectorSearch` aggregation stage (cosine
6
+ * `vectorSearchScore`, [0,1]). Metadata is a JSON string field filtered with the neutral filter
7
+ * tree's JS reference evaluator for cross-adapter parity.
8
+ *
9
+ * Consistency note: the *document* collection is strongly consistent, but the Atlas vector
10
+ * *index* updates asynchronously after a write (~1s). So filter-scans, fetch-by-id and the
11
+ * delete read-back use a plain `find()` (immediate), and only KNN goes through `$vectorSearch` —
12
+ * after which the adapter polls until the just-inserted ids are index-visible (strong mode).
13
+ *
14
+ * Driver: `mongodb`. Works against `mongodb/mongodb-atlas-local` or a real Atlas cluster.
15
+ */
16
+ import { BaseVectorStore } from "../contract";
17
+ import type { SearchPlan, UpsertPlan, DeletePlan, CollectionSpec } from "../plan";
18
+ import type { VectorMatch, VectorStoreCapabilities, BaseVectorStoreOptions } from "../types";
19
+ export interface MongoDBVectorStoreOptions extends BaseVectorStoreOptions {
20
+ connection: {
21
+ url: string;
22
+ database?: string;
23
+ /**
24
+ * When set, the physical MongoDB collection becomes `${collectionPrefix}${collection}`. The
25
+ * logical collection the builder/base see is unchanged. Lets callers (and the test suite)
26
+ * isolate otherwise identically-named collections — useful because the Atlas vectorSearch
27
+ * index builds asynchronously, so a fresh collection per use avoids drop+rebuild churn.
28
+ */
29
+ collectionPrefix?: string;
30
+ };
31
+ }
32
+ export declare class MongoDBVectorStore extends BaseVectorStore {
33
+ #private;
34
+ readonly capabilities: VectorStoreCapabilities;
35
+ static isAvailable(): boolean;
36
+ isAvailable(): boolean;
37
+ connect(): Promise<void>;
38
+ close(): Promise<void>;
39
+ createCollection(spec: CollectionSpec, ifNotExists: boolean): Promise<void>;
40
+ dropCollection(collection: string, ifExists: boolean): Promise<void>;
41
+ hasCollection(collection: string): Promise<boolean>;
42
+ renameCollection(_from: string, _to: string): Promise<void>;
43
+ executeUpsert(plan: UpsertPlan): Promise<void>;
44
+ executeSearch(plan: SearchPlan): Promise<VectorMatch[]>;
45
+ executeDelete(plan: DeletePlan): Promise<void>;
46
+ }