@qvac/sdk 0.8.1 → 1.0.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 (608) hide show
  1. package/LICENSE +24 -1
  2. package/README.md +191 -373
  3. package/dist/client/api/cancel.d.ts +4 -22
  4. package/dist/client/api/cancel.js +6 -25
  5. package/dist/client/api/completion-stream.d.ts +30 -24
  6. package/dist/client/api/completion-stream.js +70 -121
  7. package/dist/client/api/delete-cache.js +2 -3
  8. package/dist/client/api/download-asset.d.ts +5 -6
  9. package/dist/client/api/download-asset.js +20 -16
  10. package/dist/client/api/embed.d.ts +4 -21
  11. package/dist/client/api/embed.js +14 -4
  12. package/dist/client/api/index.d.ts +2 -6
  13. package/dist/client/api/index.js +2 -6
  14. package/dist/client/api/load-model.d.ts +21 -49
  15. package/dist/client/api/load-model.js +134 -40
  16. package/dist/client/api/logging-stream.d.ts +4 -7
  17. package/dist/client/api/logging-stream.js +5 -9
  18. package/dist/client/api/ping.d.ts +11 -0
  19. package/dist/client/api/ping.js +18 -0
  20. package/dist/client/api/provide.d.ts +1 -1
  21. package/dist/client/api/provide.js +3 -4
  22. package/dist/client/api/rag.d.ts +21 -216
  23. package/dist/client/api/rag.js +36 -396
  24. package/dist/client/api/stop-provider.d.ts +1 -1
  25. package/dist/client/api/stop-provider.js +3 -4
  26. package/dist/client/api/text-to-speech.d.ts +2 -2
  27. package/dist/client/api/text-to-speech.js +3 -3
  28. package/dist/client/api/transcribe.d.ts +5 -9
  29. package/dist/client/api/transcribe.js +9 -11
  30. package/dist/client/api/translate.d.ts +3 -3
  31. package/dist/client/api/translate.js +15 -15
  32. package/dist/client/api/unload-model.d.ts +1 -5
  33. package/dist/client/api/unload-model.js +4 -17
  34. package/dist/client/index.d.ts +1 -1
  35. package/dist/client/index.js +1 -1
  36. package/dist/client/logging-stream-registry.d.ts +1 -1
  37. package/dist/client/logging-stream-registry.js +13 -14
  38. package/dist/client/rpc/bare-client.d.ts +139 -3
  39. package/dist/client/rpc/bare-client.js +16 -117
  40. package/dist/client/rpc/bare-rpc-client.d.ts +4 -0
  41. package/dist/client/rpc/bare-rpc-client.js +87 -0
  42. package/dist/client/rpc/expo-rpc-client.d.ts +1 -2
  43. package/dist/client/rpc/expo-rpc-client.js +14 -57
  44. package/dist/client/rpc/node-rpc-client.d.ts +8 -3
  45. package/dist/client/rpc/node-rpc-client.js +62 -218
  46. package/dist/client/rpc/rpc-client.d.ts +2 -3
  47. package/dist/client/rpc/rpc-client.js +49 -184
  48. package/dist/constants/audio.d.ts +2 -1
  49. package/dist/constants/audio.js +17 -1
  50. package/dist/constants/index.d.ts +0 -1
  51. package/dist/constants/index.js +0 -1
  52. package/dist/examples/delegated-inference/consumer.js +2 -3
  53. package/dist/examples/download-with-cancel.js +4 -3
  54. package/dist/examples/embed-hyperdrive.d.ts +2 -0
  55. package/dist/examples/embed-hyperdrive.js +19 -0
  56. package/dist/examples/kv-cache-cleanup.js +2 -1
  57. package/dist/examples/kv-cache-custom-key.js +2 -16
  58. package/dist/examples/kv-cache-example.js +2 -1
  59. package/dist/examples/llamacpp-file-logging.d.ts +2 -0
  60. package/dist/examples/{logging-file-transport.js → llamacpp-file-logging.js} +8 -3
  61. package/dist/examples/llamacpp-filesystem.js +2 -2
  62. package/dist/examples/llamacpp-http.js +1 -0
  63. package/dist/examples/llamacpp-hyperdrive.d.ts +2 -0
  64. package/dist/examples/{llamacpp-p2p.js → llamacpp-hyperdrive.js} +2 -1
  65. package/dist/examples/llamacpp-multimodal.js +4 -3
  66. package/dist/examples/llamacpp-native-tools.js +30 -72
  67. package/dist/examples/multi-model-demo.js +3 -2
  68. package/dist/examples/parallel-download.js +14 -46
  69. package/dist/examples/rag/rag-chromadb.js +1 -0
  70. package/dist/examples/rag/rag-hyperdb-workspaces.d.ts +2 -0
  71. package/dist/examples/rag/rag-hyperdb-workspaces.js +107 -0
  72. package/dist/examples/rag/rag-hyperdb.d.ts +2 -0
  73. package/dist/examples/rag/{rag-hyperdb/ingest.js → rag-hyperdb.js} +5 -10
  74. package/dist/examples/rag/rag-lancedb.js +1 -0
  75. package/dist/examples/rag/rag-sqlite.js +1 -0
  76. package/dist/examples/seed-hyperdrive.d.ts +2 -0
  77. package/dist/examples/text-to-speech.d.ts +3 -0
  78. package/dist/examples/{tts/utils.js → text-to-speech.js} +63 -18
  79. package/dist/examples/translation/translation-indic.js +1 -4
  80. package/dist/examples/translation/translation-llm-context.js +1 -0
  81. package/dist/examples/translation/translation-llm.js +2 -2
  82. package/dist/examples/translation/translation-opus.js +3 -6
  83. package/dist/examples/translation/translation-stream.js +3 -3
  84. package/dist/examples/whispercpp-filesystem.js +43 -0
  85. package/dist/examples/{transcription/whispercpp-microphone-record.js → whispercpp-microphone-record.js} +9 -8
  86. package/dist/expo/plugins/index.d.ts +0 -3
  87. package/dist/expo/plugins/index.js +0 -3
  88. package/dist/expo/plugins/withMobileBundle.d.ts +2 -5
  89. package/dist/expo/plugins/withMobileBundle.js +40 -121
  90. package/dist/expo/plugins/withQvacSDK.d.ts +0 -4
  91. package/dist/expo/plugins/withQvacSDK.js +1 -26
  92. package/dist/index.d.ts +4 -9
  93. package/dist/index.js +5 -11
  94. package/dist/logging/base-logger.js +16 -26
  95. package/dist/logging/index.d.ts +1 -7
  96. package/dist/logging/index.js +1 -7
  97. package/dist/logging/logger.d.ts +2 -0
  98. package/dist/logging/logger.js +6 -11
  99. package/dist/logging/stream-logger.d.ts +1 -1
  100. package/dist/logging/stream-logger.js +3 -6
  101. package/dist/logging/transport.js +2 -2
  102. package/dist/logging/types.d.ts +0 -2
  103. package/dist/logging/utils.d.ts +0 -2
  104. package/dist/logging/utils.js +0 -62
  105. package/dist/models/{registry → hyperdrive}/index.js +1 -1
  106. package/dist/models/hyperdrive/models.d.ts +619 -0
  107. package/dist/models/hyperdrive/models.js +693 -0
  108. package/dist/schemas/cancel.d.ts +0 -18
  109. package/dist/schemas/cancel.js +0 -7
  110. package/dist/schemas/common.d.ts +166 -3012
  111. package/dist/schemas/common.js +4 -27
  112. package/dist/schemas/completion-stream.d.ts +60 -31
  113. package/dist/schemas/completion-stream.js +44 -20
  114. package/dist/schemas/delegate.d.ts +0 -9
  115. package/dist/schemas/delegate.js +2 -6
  116. package/dist/schemas/download-asset.d.ts +3 -125
  117. package/dist/schemas/download-asset.js +5 -22
  118. package/dist/schemas/embed.d.ts +3 -3
  119. package/dist/schemas/embed.js +2 -9
  120. package/dist/schemas/index.d.ts +2 -20
  121. package/dist/schemas/index.js +2 -20
  122. package/dist/schemas/llamacpp-config.d.ts +12 -243
  123. package/dist/schemas/llamacpp-config.js +14 -50
  124. package/dist/schemas/load-model.d.ts +893 -14471
  125. package/dist/schemas/load-model.js +72 -325
  126. package/dist/schemas/logging-stream.d.ts +4 -11
  127. package/dist/schemas/logging-stream.js +3 -4
  128. package/dist/schemas/ping.d.ts +11 -0
  129. package/dist/schemas/ping.js +8 -0
  130. package/dist/schemas/rag.d.ts +52 -183
  131. package/dist/schemas/rag.js +23 -152
  132. package/dist/schemas/text-to-speech.d.ts +1 -692
  133. package/dist/schemas/text-to-speech.js +3 -35
  134. package/dist/schemas/transcription.d.ts +0 -3
  135. package/dist/schemas/transcription.js +0 -1
  136. package/dist/schemas/translate.d.ts +23 -68
  137. package/dist/schemas/translate.js +11 -37
  138. package/dist/schemas/translation-config.d.ts +7 -810
  139. package/dist/schemas/translation-config.js +7 -113
  140. package/dist/schemas/unload-model.d.ts +0 -2
  141. package/dist/schemas/unload-model.js +0 -2
  142. package/dist/schemas/whispercpp-config.d.ts +25 -0
  143. package/dist/schemas/whispercpp-config.js +18 -0
  144. package/dist/server/bare/{ops → addons}/cancel.js +1 -2
  145. package/dist/server/bare/addons/index.d.ts +4 -0
  146. package/dist/server/bare/addons/index.js +3 -0
  147. package/dist/server/bare/addons/llamacpp/create-model.d.ts +5 -0
  148. package/dist/server/bare/addons/llamacpp/create-model.js +67 -0
  149. package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.d.ts +1 -2
  150. package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.js +87 -54
  151. package/dist/server/bare/addons/llamacpp/handlers/embed.d.ts +4 -0
  152. package/dist/server/bare/{ops → addons/llamacpp/handlers}/embed.js +7 -22
  153. package/dist/server/bare/addons/llamacpp/index.d.ts +4 -0
  154. package/dist/server/bare/addons/llamacpp/index.js +3 -0
  155. package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.d.ts +1 -4
  156. package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.js +19 -54
  157. package/dist/server/bare/addons/load-model.d.ts +3 -0
  158. package/dist/server/bare/addons/load-model.js +62 -0
  159. package/dist/server/bare/addons/translation/create-model.d.ts +4 -0
  160. package/dist/server/bare/addons/translation/create-model.js +45 -0
  161. package/dist/server/bare/addons/translation/handlers/translate.d.ts +3 -0
  162. package/dist/server/bare/{ops → addons/translation/handlers}/translate.js +14 -47
  163. package/dist/server/bare/addons/translation/index.d.ts +3 -0
  164. package/dist/server/bare/addons/translation/index.js +2 -0
  165. package/dist/server/bare/addons/tts/create-model.d.ts +6 -0
  166. package/dist/server/bare/addons/tts/create-model.js +40 -0
  167. package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.js +3 -25
  168. package/dist/server/bare/addons/tts/index.d.ts +3 -0
  169. package/dist/server/bare/addons/tts/index.js +2 -0
  170. package/dist/server/bare/addons/unload-model.js +20 -0
  171. package/dist/server/bare/addons/whispercpp/create-model.d.ts +6 -0
  172. package/dist/server/bare/addons/whispercpp/create-model.js +55 -0
  173. package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.d.ts +3 -0
  174. package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.js +48 -0
  175. package/dist/server/bare/addons/whispercpp/index.d.ts +3 -0
  176. package/dist/server/bare/addons/whispercpp/index.js +2 -0
  177. package/dist/server/bare/delegate-rpc-client.d.ts +0 -6
  178. package/dist/server/bare/delegate-rpc-client.js +45 -187
  179. package/dist/server/bare/hyperswarm.d.ts +0 -3
  180. package/dist/server/bare/hyperswarm.js +6 -29
  181. package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +1 -1
  182. package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +10 -9
  183. package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +4 -7
  184. package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +14 -13
  185. package/dist/server/bare/rag-hyperdb/handlers/search.js +10 -10
  186. package/dist/server/bare/rag-hyperdb/index.d.ts +1 -8
  187. package/dist/server/bare/rag-hyperdb/index.js +1 -8
  188. package/dist/server/bare/rag-hyperdb/rag-manager.d.ts +5 -0
  189. package/dist/server/bare/rag-hyperdb/rag-manager.js +65 -0
  190. package/dist/server/bare/registry/logging-stream-registry.d.ts +7 -24
  191. package/dist/server/bare/registry/logging-stream-registry.js +20 -99
  192. package/dist/server/bare/registry/model-registry.d.ts +26 -16
  193. package/dist/server/bare/registry/model-registry.js +13 -34
  194. package/dist/server/error-handlers.d.ts +2 -3
  195. package/dist/server/error-handlers.js +10 -15
  196. package/dist/server/http-server.d.ts +2 -0
  197. package/dist/server/http-server.js +189 -0
  198. package/dist/server/rpc/create-server.js +3 -5
  199. package/dist/server/rpc/handle-request.d.ts +9 -0
  200. package/dist/server/rpc/handle-request.js +242 -92
  201. package/dist/server/rpc/handlers/cancelHandler.js +3 -14
  202. package/dist/server/rpc/handlers/completion-stream-delegated.d.ts +1 -3
  203. package/dist/server/rpc/handlers/completion-stream-delegated.js +8 -20
  204. package/dist/server/rpc/handlers/completion-stream.js +41 -2
  205. package/dist/server/rpc/handlers/delete-cache.js +2 -4
  206. package/dist/server/rpc/handlers/download-asset.js +6 -59
  207. package/dist/server/rpc/handlers/embed.js +19 -2
  208. package/dist/server/rpc/handlers/index.d.ts +0 -13
  209. package/dist/server/rpc/handlers/index.js +0 -13
  210. package/dist/server/rpc/handlers/load-model/download-manager.d.ts +11 -12
  211. package/dist/server/rpc/handlers/load-model/download-manager.js +28 -43
  212. package/dist/server/rpc/handlers/load-model/http.d.ts +1 -2
  213. package/dist/server/rpc/handlers/load-model/http.js +55 -424
  214. package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +1 -2
  215. package/dist/server/rpc/handlers/load-model/hyperdrive.js +171 -364
  216. package/dist/server/rpc/handlers/load-model/index.d.ts +2 -2
  217. package/dist/server/rpc/handlers/load-model/index.js +2 -2
  218. package/dist/server/rpc/handlers/load-model/resolve.d.ts +1 -3
  219. package/dist/server/rpc/handlers/load-model/resolve.js +29 -110
  220. package/dist/server/rpc/handlers/load-model-delegated.d.ts +2 -6
  221. package/dist/server/rpc/handlers/load-model-delegated.js +20 -60
  222. package/dist/server/rpc/handlers/{load-model/handler.d.ts → load-model.d.ts} +2 -2
  223. package/dist/server/rpc/handlers/load-model.js +57 -0
  224. package/dist/server/rpc/handlers/logging-stream.js +4 -4
  225. package/dist/server/rpc/handlers/provideHandler/connection.js +10 -12
  226. package/dist/server/rpc/handlers/provideHandler/handler.js +17 -20
  227. package/dist/server/rpc/handlers/provideHandler/proxy.js +6 -8
  228. package/dist/server/rpc/handlers/rag.d.ts +2 -2
  229. package/dist/server/rpc/handlers/rag.js +43 -130
  230. package/dist/server/rpc/handlers/stopProvideHandler.js +2 -6
  231. package/dist/server/rpc/handlers/text-to-speech.js +5 -2
  232. package/dist/server/rpc/handlers/transcribe-stream.js +24 -2
  233. package/dist/server/rpc/handlers/translate.js +49 -2
  234. package/dist/server/rpc/handlers/unload-model.js +3 -12
  235. package/dist/server/rpc/index.d.ts +1 -1
  236. package/dist/server/utils/audio/decoder.d.ts +1 -2
  237. package/dist/server/utils/audio/decoder.js +12 -49
  238. package/dist/server/utils/cache.d.ts +8 -19
  239. package/dist/server/utils/cache.js +15 -100
  240. package/dist/server/utils/hash.d.ts +5 -0
  241. package/dist/server/utils/hash.js +11 -0
  242. package/dist/server/utils/index.d.ts +2 -7
  243. package/dist/server/utils/index.js +2 -7
  244. package/dist/server/utils/tool-parser.js +14 -28
  245. package/dist/server/worker.d.ts +5 -4
  246. package/dist/server/worker.js +89 -22
  247. package/package.json +41 -148
  248. package/NOTICE +0 -695
  249. package/bare-imports.json +0 -44
  250. package/dist/client/api/get-model-info.d.ts +0 -36
  251. package/dist/client/api/get-model-info.js +0 -14
  252. package/dist/client/api/heartbeat.d.ts +0 -30
  253. package/dist/client/api/heartbeat.js +0 -38
  254. package/dist/client/api/invoke-plugin.d.ts +0 -15
  255. package/dist/client/api/invoke-plugin.js +0 -38
  256. package/dist/client/api/ocr.d.ts +0 -31
  257. package/dist/client/api/ocr.js +0 -88
  258. package/dist/client/api/registry.d.ts +0 -14
  259. package/dist/client/api/registry.js +0 -37
  260. package/dist/client/config-loader/config-utils.d.ts +0 -5
  261. package/dist/client/config-loader/config-utils.js +0 -20
  262. package/dist/client/config-loader/resolve-config.bare.d.ts +0 -9
  263. package/dist/client/config-loader/resolve-config.bare.js +0 -87
  264. package/dist/client/config-loader/resolve-config.expo.d.ts +0 -11
  265. package/dist/client/config-loader/resolve-config.expo.js +0 -62
  266. package/dist/client/config-loader/resolve-config.node.d.ts +0 -10
  267. package/dist/client/config-loader/resolve-config.node.js +0 -145
  268. package/dist/client/init-hooks.d.ts +0 -21
  269. package/dist/client/init-hooks.js +0 -66
  270. package/dist/client/rpc/expo-device-info.d.ts +0 -6
  271. package/dist/client/rpc/expo-device-info.js +0 -32
  272. package/dist/client/rpc/profiling/index.d.ts +0 -2
  273. package/dist/client/rpc/profiling/index.js +0 -1
  274. package/dist/client/rpc/profiling/profiler.d.ts +0 -27
  275. package/dist/client/rpc/profiling/profiler.js +0 -139
  276. package/dist/constants/registry.d.ts +0 -2
  277. package/dist/constants/registry.js +0 -1
  278. package/dist/examples/cache-management.d.ts +0 -2
  279. package/dist/examples/cache-management.js +0 -97
  280. package/dist/examples/config/blind-relay/blind-relay.config.d.ts +0 -5
  281. package/dist/examples/config/blind-relay/blind-relay.config.js +0 -7
  282. package/dist/examples/config/default/default.config.d.ts +0 -8
  283. package/dist/examples/config/default/default.config.js +0 -6
  284. package/dist/examples/config/plugins/plugins.config.d.ts +0 -5
  285. package/dist/examples/config/plugins/plugins.config.js +0 -4
  286. package/dist/examples/config-reload.d.ts +0 -2
  287. package/dist/examples/config-reload.js +0 -49
  288. package/dist/examples/default-config-usage.d.ts +0 -17
  289. package/dist/examples/default-config-usage.js +0 -47
  290. package/dist/examples/delegated-inference/consumer-profiled.d.ts +0 -2
  291. package/dist/examples/delegated-inference/consumer-profiled.js +0 -67
  292. package/dist/examples/download-with-blind-relays.d.ts +0 -2
  293. package/dist/examples/download-with-blind-relays.js +0 -49
  294. package/dist/examples/embed-p2p.d.ts +0 -2
  295. package/dist/examples/embed-p2p.js +0 -54
  296. package/dist/examples/llamacpp-p2p.d.ts +0 -2
  297. package/dist/examples/llamacpp-sharded.d.ts +0 -2
  298. package/dist/examples/llamacpp-sharded.js +0 -53
  299. package/dist/examples/logging-file-transport.d.ts +0 -2
  300. package/dist/examples/logging-streaming.d.ts +0 -2
  301. package/dist/examples/logging-streaming.js +0 -75
  302. package/dist/examples/mcp-websearch.d.ts +0 -13
  303. package/dist/examples/mcp-websearch.js +0 -176
  304. package/dist/examples/ocr-fasttext.d.ts +0 -2
  305. package/dist/examples/ocr-fasttext.js +0 -52
  306. package/dist/examples/plugins.d.ts +0 -14
  307. package/dist/examples/plugins.js +0 -129
  308. package/dist/examples/profiling/basic.d.ts +0 -2
  309. package/dist/examples/profiling/basic.js +0 -71
  310. package/dist/examples/profiling/per-call.d.ts +0 -2
  311. package/dist/examples/profiling/per-call.js +0 -30
  312. package/dist/examples/quickstart.d.ts +0 -2
  313. package/dist/examples/quickstart.js +0 -28
  314. package/dist/examples/rag/rag-hyperdb/cancellation.d.ts +0 -2
  315. package/dist/examples/rag/rag-hyperdb/cancellation.js +0 -75
  316. package/dist/examples/rag/rag-hyperdb/ingest.d.ts +0 -2
  317. package/dist/examples/rag/rag-hyperdb/pipeline.d.ts +0 -2
  318. package/dist/examples/rag/rag-hyperdb/pipeline.js +0 -74
  319. package/dist/examples/rag/rag-hyperdb/workspaces.d.ts +0 -2
  320. package/dist/examples/rag/rag-hyperdb/workspaces.js +0 -178
  321. package/dist/examples/registry-query.d.ts +0 -2
  322. package/dist/examples/registry-query.js +0 -87
  323. package/dist/examples/seed-p2p.d.ts +0 -2
  324. package/dist/examples/transcription/parakeet-ctc-filesystem.d.ts +0 -2
  325. package/dist/examples/transcription/parakeet-ctc-filesystem.js +0 -40
  326. package/dist/examples/transcription/parakeet-microphone-record.d.ts +0 -2
  327. package/dist/examples/transcription/parakeet-microphone-record.js +0 -95
  328. package/dist/examples/transcription/parakeet-sortformer.d.ts +0 -2
  329. package/dist/examples/transcription/parakeet-sortformer.js +0 -115
  330. package/dist/examples/transcription/parakeet-tdt-filesystem.d.ts +0 -2
  331. package/dist/examples/transcription/parakeet-tdt-filesystem.js +0 -44
  332. package/dist/examples/transcription/whispercpp-filesystem.js +0 -69
  333. package/dist/examples/transcription/whispercpp-prompt.d.ts +0 -2
  334. package/dist/examples/transcription/whispercpp-prompt.js +0 -67
  335. package/dist/examples/translation/translation-bergamot-batch.d.ts +0 -2
  336. package/dist/examples/translation/translation-bergamot-batch.js +0 -49
  337. package/dist/examples/translation/translation-bergamot-pivot.d.ts +0 -2
  338. package/dist/examples/translation/translation-bergamot-pivot.js +0 -73
  339. package/dist/examples/translation/translation-bergamot.d.ts +0 -2
  340. package/dist/examples/translation/translation-bergamot.js +0 -39
  341. package/dist/examples/translation/translation-llm-afriquegemma.d.ts +0 -2
  342. package/dist/examples/translation/translation-llm-afriquegemma.js +0 -39
  343. package/dist/examples/tts/chatterbox.d.ts +0 -2
  344. package/dist/examples/tts/chatterbox.js +0 -59
  345. package/dist/examples/tts/supertonic.d.ts +0 -2
  346. package/dist/examples/tts/supertonic.js +0 -51
  347. package/dist/examples/tts/utils.d.ts +0 -17
  348. package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +0 -15
  349. package/dist/expo/plugins/resolve-sdk-package-dir.js +0 -31
  350. package/dist/expo/plugins/withAndroidArchitecture.d.ts +0 -8
  351. package/dist/expo/plugins/withAndroidArchitecture.js +0 -52
  352. package/dist/expo/plugins/withAndroidNdkVersion.d.ts +0 -8
  353. package/dist/expo/plugins/withAndroidNdkVersion.js +0 -31
  354. package/dist/expo/plugins/withDeviceInfo.d.ts +0 -10
  355. package/dist/expo/plugins/withDeviceInfo.js +0 -48
  356. package/dist/logging/addon.d.ts +0 -6
  357. package/dist/logging/addon.js +0 -75
  358. package/dist/logging/client-logger.d.ts +0 -3
  359. package/dist/logging/client-logger.js +0 -24
  360. package/dist/logging/namespaces.d.ts +0 -6
  361. package/dist/logging/namespaces.js +0 -6
  362. package/dist/logging/registry.d.ts +0 -31
  363. package/dist/logging/registry.js +0 -62
  364. package/dist/logging/server-logger.d.ts +0 -3
  365. package/dist/logging/server-logger.js +0 -16
  366. package/dist/models/registry/models.d.ts +0 -10417
  367. package/dist/models/registry/models.js +0 -10757
  368. package/dist/models/update-models/codegen.d.ts +0 -3
  369. package/dist/models/update-models/codegen.js +0 -135
  370. package/dist/models/update-models/history.d.ts +0 -24
  371. package/dist/models/update-models/history.js +0 -107
  372. package/dist/models/update-models/index.d.ts +0 -2
  373. package/dist/models/update-models/index.js +0 -125
  374. package/dist/models/update-models/naming.d.ts +0 -4
  375. package/dist/models/update-models/naming.js +0 -370
  376. package/dist/models/update-models/processing.d.ts +0 -8
  377. package/dist/models/update-models/processing.js +0 -67
  378. package/dist/models/update-models/registry.d.ts +0 -4
  379. package/dist/models/update-models/registry.js +0 -67
  380. package/dist/models/update-models/shards.d.ts +0 -4
  381. package/dist/models/update-models/shards.js +0 -57
  382. package/dist/models/update-models/types.d.ts +0 -60
  383. package/dist/models/update-models/types.js +0 -1
  384. package/dist/models/update-models/utils.d.ts +0 -3
  385. package/dist/models/update-models/utils.js +0 -21
  386. package/dist/pear/pre.d.ts +0 -18
  387. package/dist/pear/pre.js +0 -433
  388. package/dist/profiling/aggregator.d.ts +0 -15
  389. package/dist/profiling/aggregator.js +0 -100
  390. package/dist/profiling/clock.d.ts +0 -12
  391. package/dist/profiling/clock.js +0 -51
  392. package/dist/profiling/controller.d.ts +0 -33
  393. package/dist/profiling/controller.js +0 -123
  394. package/dist/profiling/envelope.d.ts +0 -10
  395. package/dist/profiling/envelope.js +0 -36
  396. package/dist/profiling/events.d.ts +0 -20
  397. package/dist/profiling/events.js +0 -37
  398. package/dist/profiling/exporters.d.ts +0 -10
  399. package/dist/profiling/exporters.js +0 -236
  400. package/dist/profiling/index.d.ts +0 -36
  401. package/dist/profiling/index.js +0 -31
  402. package/dist/profiling/ring-buffer.d.ts +0 -19
  403. package/dist/profiling/ring-buffer.js +0 -83
  404. package/dist/profiling/types.d.ts +0 -47
  405. package/dist/profiling/types.js +0 -1
  406. package/dist/schemas/archive.d.ts +0 -9
  407. package/dist/schemas/archive.js +0 -17
  408. package/dist/schemas/engine-addon-map.d.ts +0 -5
  409. package/dist/schemas/engine-addon-map.js +0 -52
  410. package/dist/schemas/get-model-info.d.ts +0 -120
  411. package/dist/schemas/get-model-info.js +0 -58
  412. package/dist/schemas/heartbeat.d.ts +0 -17
  413. package/dist/schemas/heartbeat.js +0 -10
  414. package/dist/schemas/json-schema.d.ts +0 -16
  415. package/dist/schemas/json-schema.js +0 -2
  416. package/dist/schemas/mcp-adapter.d.ts +0 -47
  417. package/dist/schemas/mcp-adapter.js +0 -1
  418. package/dist/schemas/model-src-utils.d.ts +0 -148
  419. package/dist/schemas/model-src-utils.js +0 -35
  420. package/dist/schemas/model-types.d.ts +0 -183
  421. package/dist/schemas/model-types.js +0 -168
  422. package/dist/schemas/ocr.d.ts +0 -125
  423. package/dist/schemas/ocr.js +0 -57
  424. package/dist/schemas/path-validation.d.ts +0 -10
  425. package/dist/schemas/path-validation.js +0 -22
  426. package/dist/schemas/plugin.d.ts +0 -226
  427. package/dist/schemas/plugin.js +0 -158
  428. package/dist/schemas/profiling.d.ts +0 -105
  429. package/dist/schemas/profiling.js +0 -66
  430. package/dist/schemas/registry.d.ts +0 -356
  431. package/dist/schemas/registry.js +0 -93
  432. package/dist/schemas/reload-config.d.ts +0 -476
  433. package/dist/schemas/reload-config.js +0 -44
  434. package/dist/schemas/runtime-context.d.ts +0 -19
  435. package/dist/schemas/runtime-context.js +0 -7
  436. package/dist/schemas/sdk-config.d.ts +0 -2973
  437. package/dist/schemas/sdk-config.js +0 -136
  438. package/dist/schemas/sdk-errors-client.d.ts +0 -31
  439. package/dist/schemas/sdk-errors-client.js +0 -143
  440. package/dist/schemas/sdk-errors-registry.d.ts +0 -6
  441. package/dist/schemas/sdk-errors-registry.js +0 -8
  442. package/dist/schemas/sdk-errors-server.d.ts +0 -89
  443. package/dist/schemas/sdk-errors-server.js +0 -451
  444. package/dist/schemas/shard.d.ts +0 -21
  445. package/dist/schemas/shard.js +0 -17
  446. package/dist/schemas/tools.d.ts +0 -65
  447. package/dist/schemas/tools.js +0 -43
  448. package/dist/schemas/transcription-config.d.ts +0 -383
  449. package/dist/schemas/transcription-config.js +0 -95
  450. package/dist/scripts/run-security-tests-bare.d.ts +0 -2
  451. package/dist/scripts/run-security-tests-bare.js +0 -78
  452. package/dist/scripts/run-security-tests.d.ts +0 -2
  453. package/dist/scripts/run-security-tests.js +0 -22
  454. package/dist/scripts/run-unit-tests.d.ts +0 -2
  455. package/dist/scripts/run-unit-tests.js +0 -17
  456. package/dist/server/bare/ops/embed.d.ts +0 -12
  457. package/dist/server/bare/ops/load-model.d.ts +0 -9
  458. package/dist/server/bare/ops/load-model.js +0 -85
  459. package/dist/server/bare/ops/transcribe.d.ts +0 -3
  460. package/dist/server/bare/ops/transcribe.js +0 -75
  461. package/dist/server/bare/ops/translate.d.ts +0 -5
  462. package/dist/server/bare/ops/unload-model.js +0 -41
  463. package/dist/server/bare/plugins/index.d.ts +0 -8
  464. package/dist/server/bare/plugins/index.js +0 -7
  465. package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +0 -6
  466. package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +0 -34
  467. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +0 -220
  468. package/dist/server/bare/plugins/llamacpp-completion/plugin.js +0 -155
  469. package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +0 -54
  470. package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +0 -87
  471. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +0 -367
  472. package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +0 -201
  473. package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.d.ts +0 -10
  474. package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.js +0 -110
  475. package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +0 -86
  476. package/dist/server/bare/plugins/onnx-ocr/plugin.js +0 -117
  477. package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -373
  478. package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -182
  479. package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
  480. package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
  481. package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +0 -317
  482. package/dist/server/bare/plugins/parakeet-transcription/plugin.js +0 -154
  483. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +0 -237
  484. package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +0 -86
  485. package/dist/server/bare/rag-hyperdb/handlers/chunk.d.ts +0 -3
  486. package/dist/server/bare/rag-hyperdb/handlers/chunk.js +0 -7
  487. package/dist/server/bare/rag-hyperdb/handlers/close-workspace.d.ts +0 -3
  488. package/dist/server/bare/rag-hyperdb/handlers/close-workspace.js +0 -9
  489. package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.d.ts +0 -3
  490. package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.js +0 -14
  491. package/dist/server/bare/rag-hyperdb/handlers/ingest.d.ts +0 -9
  492. package/dist/server/bare/rag-hyperdb/handlers/ingest.js +0 -18
  493. package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.d.ts +0 -3
  494. package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.js +0 -4
  495. package/dist/server/bare/rag-hyperdb/handlers/reindex.d.ts +0 -9
  496. package/dist/server/bare/rag-hyperdb/handlers/reindex.js +0 -16
  497. package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +0 -7
  498. package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +0 -39
  499. package/dist/server/bare/rag-hyperdb/rag-workspace-manager.d.ts +0 -15
  500. package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +0 -136
  501. package/dist/server/bare/registry/config-registry.d.ts +0 -14
  502. package/dist/server/bare/registry/config-registry.js +0 -82
  503. package/dist/server/bare/registry/model-config-registry.d.ts +0 -4
  504. package/dist/server/bare/registry/model-config-registry.js +0 -15
  505. package/dist/server/bare/registry/model-config-utils.d.ts +0 -15
  506. package/dist/server/bare/registry/model-config-utils.js +0 -112
  507. package/dist/server/bare/registry/registry-client.d.ts +0 -5
  508. package/dist/server/bare/registry/registry-client.js +0 -37
  509. package/dist/server/bare/registry/runtime-context-registry.d.ts +0 -7
  510. package/dist/server/bare/registry/runtime-context-registry.js +0 -26
  511. package/dist/server/bare/utils/audio-input.d.ts +0 -10
  512. package/dist/server/bare/utils/audio-input.js +0 -33
  513. package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
  514. package/dist/server/bare/utils/loader-adapter.js +0 -9
  515. package/dist/server/env.d.ts +0 -22
  516. package/dist/server/env.js +0 -57
  517. package/dist/server/plugins/index.d.ts +0 -2
  518. package/dist/server/plugins/index.js +0 -1
  519. package/dist/server/plugins/registry.d.ts +0 -9
  520. package/dist/server/plugins/registry.js +0 -79
  521. package/dist/server/rpc/delegate-transport.d.ts +0 -19
  522. package/dist/server/rpc/delegate-transport.js +0 -236
  523. package/dist/server/rpc/delegate-utils.d.ts +0 -2
  524. package/dist/server/rpc/delegate-utils.js +0 -5
  525. package/dist/server/rpc/handler-registry.d.ts +0 -3
  526. package/dist/server/rpc/handler-registry.js +0 -113
  527. package/dist/server/rpc/handler-utils.d.ts +0 -23
  528. package/dist/server/rpc/handler-utils.js +0 -170
  529. package/dist/server/rpc/handlers/cancel-delegated.d.ts +0 -4
  530. package/dist/server/rpc/handlers/cancel-delegated.js +0 -71
  531. package/dist/server/rpc/handlers/get-model-info.d.ts +0 -3
  532. package/dist/server/rpc/handlers/get-model-info.js +0 -164
  533. package/dist/server/rpc/handlers/heartbeat-delegated.d.ts +0 -4
  534. package/dist/server/rpc/handlers/heartbeat-delegated.js +0 -32
  535. package/dist/server/rpc/handlers/heartbeat.d.ts +0 -3
  536. package/dist/server/rpc/handlers/heartbeat.js +0 -3
  537. package/dist/server/rpc/handlers/load-model/download-stats.d.ts +0 -6
  538. package/dist/server/rpc/handlers/load-model/download-stats.js +0 -87
  539. package/dist/server/rpc/handlers/load-model/handler.js +0 -187
  540. package/dist/server/rpc/handlers/load-model/registry.d.ts +0 -11
  541. package/dist/server/rpc/handlers/load-model/registry.js +0 -548
  542. package/dist/server/rpc/handlers/load-model/types.d.ts +0 -29
  543. package/dist/server/rpc/handlers/load-model/types.js +0 -1
  544. package/dist/server/rpc/handlers/ocr-stream.d.ts +0 -3
  545. package/dist/server/rpc/handlers/ocr-stream.js +0 -4
  546. package/dist/server/rpc/handlers/plugin-dispatch.d.ts +0 -15
  547. package/dist/server/rpc/handlers/plugin-dispatch.js +0 -59
  548. package/dist/server/rpc/handlers/plugin-invoke.d.ts +0 -4
  549. package/dist/server/rpc/handlers/plugin-invoke.js +0 -92
  550. package/dist/server/rpc/handlers/registry.d.ts +0 -5
  551. package/dist/server/rpc/handlers/registry.js +0 -157
  552. package/dist/server/rpc/handlers/unload-model-delegated.d.ts +0 -3
  553. package/dist/server/rpc/handlers/unload-model-delegated.js +0 -32
  554. package/dist/server/rpc/profiling/context.d.ts +0 -18
  555. package/dist/server/rpc/profiling/context.js +0 -38
  556. package/dist/server/rpc/profiling/delegation-profiler.d.ts +0 -32
  557. package/dist/server/rpc/profiling/delegation-profiler.js +0 -154
  558. package/dist/server/rpc/profiling/index.d.ts +0 -5
  559. package/dist/server/rpc/profiling/index.js +0 -4
  560. package/dist/server/rpc/profiling/operation-metrics.d.ts +0 -25
  561. package/dist/server/rpc/profiling/operation-metrics.js +0 -199
  562. package/dist/server/rpc/profiling/operation-wrappers.d.ts +0 -18
  563. package/dist/server/rpc/profiling/operation-wrappers.js +0 -124
  564. package/dist/server/rpc/profiling/profiler.d.ts +0 -13
  565. package/dist/server/rpc/profiling/profiler.js +0 -97
  566. package/dist/server/utils/archive.d.ts +0 -4
  567. package/dist/server/utils/archive.js +0 -179
  568. package/dist/server/utils/checksum.d.ts +0 -4
  569. package/dist/server/utils/checksum.js +0 -31
  570. package/dist/server/utils/config-transform.d.ts +0 -3
  571. package/dist/server/utils/config-transform.js +0 -23
  572. package/dist/server/utils/formatting.d.ts +0 -19
  573. package/dist/server/utils/formatting.js +0 -61
  574. package/dist/server/utils/gguf-tensor-extractor.d.ts +0 -15
  575. package/dist/server/utils/gguf-tensor-extractor.js +0 -314
  576. package/dist/server/utils/path-security.d.ts +0 -12
  577. package/dist/server/utils/path-security.js +0 -25
  578. package/dist/server/utils/shard-utils.d.ts +0 -48
  579. package/dist/server/utils/shard-utils.js +0 -125
  580. package/dist/server/utils/tool-integration.d.ts +0 -13
  581. package/dist/server/utils/tool-integration.js +0 -43
  582. package/dist/server/worker-core.d.ts +0 -6
  583. package/dist/server/worker-core.js +0 -88
  584. package/dist/utils/errors-base.d.ts +0 -3
  585. package/dist/utils/errors-base.js +0 -13
  586. package/dist/utils/errors-client.d.ts +0 -137
  587. package/dist/utils/errors-client.js +0 -240
  588. package/dist/utils/errors-server.d.ts +0 -236
  589. package/dist/utils/errors-server.js +0 -412
  590. package/dist/utils/global-singleton.d.ts +0 -2
  591. package/dist/utils/global-singleton.js +0 -10
  592. package/dist/utils/mcp-adapter.d.ts +0 -12
  593. package/dist/utils/mcp-adapter.js +0 -103
  594. package/dist/utils/object.d.ts +0 -2
  595. package/dist/utils/object.js +0 -3
  596. package/dist/utils/path-sanitize.d.ts +0 -17
  597. package/dist/utils/path-sanitize.js +0 -54
  598. package/dist/utils/tool-helpers.d.ts +0 -25
  599. package/dist/utils/tool-helpers.js +0 -112
  600. package/expo/plugins/patches/android-link.mjs +0 -63
  601. package/expo/plugins/patches/ios-link.mjs +0 -63
  602. /package/dist/examples/{seed-p2p.js → seed-hyperdrive.js} +0 -0
  603. /package/dist/examples/{transcription/whispercpp-filesystem.d.ts → whispercpp-filesystem.d.ts} +0 -0
  604. /package/dist/examples/{transcription/whispercpp-microphone-record.d.ts → whispercpp-microphone-record.d.ts} +0 -0
  605. /package/dist/models/{registry → hyperdrive}/index.d.ts +0 -0
  606. /package/dist/server/bare/{ops → addons}/cancel.d.ts +0 -0
  607. /package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.d.ts +0 -0
  608. /package/dist/server/bare/{ops → addons}/unload-model.d.ts +0 -0
@@ -1,103 +0,0 @@
1
- import { mapValues } from "./object.js";
2
- const VALID_TYPES = [
3
- "string",
4
- "number",
5
- "integer",
6
- "boolean",
7
- "object",
8
- "array",
9
- ];
10
- function isValidType(value) {
11
- return typeof value === "string" && VALID_TYPES.includes(value);
12
- }
13
- function convertMcpToolToTool(mcpTool) {
14
- const inputSchema = mcpTool.inputSchema;
15
- const properties = inputSchema.properties ?? {};
16
- const required = inputSchema.required ?? [];
17
- const convertedProperties = mapValues(properties, (prop) => {
18
- const { type, description, enum: enumVal } = prop;
19
- return {
20
- type: isValidType(type) ? type : "string",
21
- ...(description && { description }),
22
- ...(enumVal && { enum: enumVal }),
23
- };
24
- });
25
- return {
26
- type: "function",
27
- name: mcpTool.name,
28
- description: mcpTool.description ?? "",
29
- parameters: {
30
- type: "object",
31
- properties: convertedProperties,
32
- required: required.length > 0 ? required : undefined,
33
- },
34
- };
35
- }
36
- function createMcpToolHandler(client, toolName) {
37
- return async (args) => {
38
- return client.callTool({ name: toolName, arguments: args });
39
- };
40
- }
41
- export async function getMcpToolsWithHandlers(clients) {
42
- const allTools = [];
43
- const handlers = new Map();
44
- for (const { client, includeResources } of clients) {
45
- const { tools: mcpTools } = await client.listTools();
46
- for (const mcpTool of mcpTools) {
47
- allTools.push(convertMcpToolToTool(mcpTool));
48
- handlers.set(mcpTool.name, createMcpToolHandler(client, mcpTool.name));
49
- }
50
- if (includeResources !== false && client.listResources) {
51
- allTools.push({
52
- type: "function",
53
- name: "list_resources",
54
- description: "List available resources from MCP server",
55
- parameters: {
56
- type: "object",
57
- properties: {},
58
- },
59
- });
60
- handlers.set("list_resources", async () => {
61
- if (!client.listResources) {
62
- return { resources: [] };
63
- }
64
- const result = await client.listResources();
65
- return {
66
- type: "text",
67
- text: JSON.stringify(result.resources, null, 2),
68
- };
69
- });
70
- if (client.readResource) {
71
- allTools.push({
72
- type: "function",
73
- name: "read_resource",
74
- description: "Read content of a specific resource by URI",
75
- parameters: {
76
- type: "object",
77
- properties: {
78
- uri: {
79
- type: "string",
80
- description: "The URI of the resource to read",
81
- },
82
- },
83
- required: ["uri"],
84
- },
85
- });
86
- handlers.set("read_resource", async (args) => {
87
- if (!client.readResource) {
88
- return { error: "readResource not available" };
89
- }
90
- const result = await client.readResource({
91
- uri: args["uri"],
92
- });
93
- return result.contents[0];
94
- });
95
- }
96
- }
97
- }
98
- return { tools: allTools, handlers };
99
- }
100
- export async function getMcpTools(clients) {
101
- const { tools } = await getMcpToolsWithHandlers(clients);
102
- return tools;
103
- }
@@ -1,2 +0,0 @@
1
- export declare function mapValues<T, U>(obj: Record<string, T>, fn: (value: T, key: string) => U): Record<string, U>;
2
- //# sourceMappingURL=object.d.ts.map
@@ -1,3 +0,0 @@
1
- export function mapValues(obj, fn) {
2
- return Object.fromEntries(Object.entries(obj).map(([key, value]) => [key, fn(value, key)]));
3
- }
@@ -1,17 +0,0 @@
1
- /**
2
- * Pure string sanitization for path components. No runtime-specific dependencies.
3
- * Safe to import from both Bare (server) and Bun/Node (tests, client).
4
- */
5
- /**
6
- * Sanitize a path component that will be joined to a base directory.
7
- * Strips traversal sequences, absolute prefixes, and normalizes separators.
8
- *
9
- * Throws on null bytes (literal or URL-encoded).
10
- */
11
- export declare function sanitizePathComponent(component: string): string;
12
- /**
13
- * Check whether a resolved target path is contained within a base directory.
14
- * Portable — caller provides the resolve function and separator for their runtime.
15
- */
16
- export declare function checkPathWithinBase(basePath: string, targetPath: string, resolveFn: (...args: string[]) => string, sep: string): boolean;
17
- //# sourceMappingURL=path-sanitize.d.ts.map
@@ -1,54 +0,0 @@
1
- /**
2
- * Pure string sanitization for path components. No runtime-specific dependencies.
3
- * Safe to import from both Bare (server) and Bun/Node (tests, client).
4
- */
5
- /**
6
- * Sanitize a path component that will be joined to a base directory.
7
- * Strips traversal sequences, absolute prefixes, and normalizes separators.
8
- *
9
- * Throws on null bytes (literal or URL-encoded).
10
- */
11
- export function sanitizePathComponent(component) {
12
- if (component === "")
13
- return "";
14
- // Reject null bytes (literal and URL-encoded)
15
- if (component.includes("\0") || component.includes("%00")) {
16
- throw new Error(`Path component contains null byte: ${component}`);
17
- }
18
- let sanitized = component;
19
- // Decode common URL-encoded traversal sequences
20
- sanitized = sanitized
21
- .replace(/%2e/gi, ".")
22
- .replace(/%2f/gi, "/")
23
- .replace(/%5c/gi, "\\");
24
- // Normalize backslashes to forward slashes
25
- sanitized = sanitized.replace(/\\/g, "/");
26
- // Strip Windows drive letter prefixes (C:/, D:/, etc.)
27
- sanitized = sanitized.replace(/^[A-Za-z]:\//, "");
28
- // Strip leading slashes (absolute path prefixes)
29
- sanitized = sanitized.replace(/^\/+/, "");
30
- // Remove all ".." segments (start, middle, end) iteratively until stable
31
- let prev = "";
32
- while (prev !== sanitized) {
33
- prev = sanitized;
34
- sanitized = sanitized.replace(/^\.\.\//g, "");
35
- sanitized = sanitized.replace(/\/\.\.$/g, "");
36
- sanitized = sanitized.replace(/\/\.\.\//g, "/");
37
- if (sanitized === "..")
38
- sanitized = "";
39
- }
40
- // Strip any remaining leading slashes produced by stripping
41
- sanitized = sanitized.replace(/^\/+/, "");
42
- return sanitized;
43
- }
44
- /**
45
- * Check whether a resolved target path is contained within a base directory.
46
- * Portable — caller provides the resolve function and separator for their runtime.
47
- */
48
- export function checkPathWithinBase(basePath, targetPath, resolveFn, sep) {
49
- const resolvedBase = resolveFn(basePath);
50
- const resolvedTarget = resolveFn(targetPath);
51
- if (resolvedTarget === resolvedBase)
52
- return true;
53
- return resolvedTarget.startsWith(resolvedBase + sep);
54
- }
@@ -1,25 +0,0 @@
1
- import type { z } from "zod";
2
- import { type Tool, type ToolCall, type ToolCallWithCall } from "../schemas/tools";
3
- type ZodObjectType = z.ZodObject<z.ZodRawShape>;
4
- export type ToolHandler = (args: Record<string, unknown>) => Promise<unknown>;
5
- export type ToolInput<T extends ZodObjectType = ZodObjectType> = {
6
- name: string;
7
- description: string;
8
- parameters: T;
9
- handler?: ToolHandler;
10
- };
11
- export declare function convertToolInput(input: ToolInput): Tool;
12
- export declare function convertTools(inputs: ToolInput[]): Tool[];
13
- /**
14
- * Validates and converts tools from either ToolInput (with Zod schemas) or full Tool format.
15
- * Returns validated Tool[] array.
16
- */
17
- export type ToolHandlerMap = Map<string, ToolHandler>;
18
- export type ValidateToolsResult = {
19
- tools: Tool[];
20
- handlers: ToolHandlerMap;
21
- };
22
- export declare function validateTools(tools: Tool[] | ToolInput[]): ValidateToolsResult;
23
- export declare function attachHandlersToToolCalls(toolCalls: ToolCall[], handlers: ToolHandlerMap): ToolCallWithCall[];
24
- export {};
25
- //# sourceMappingURL=tool-helpers.d.ts.map
@@ -1,112 +0,0 @@
1
- import { toolSchema, } from "../schemas/tools.js";
2
- import { InvalidToolsArrayError, InvalidToolSchemaError, } from "./errors-client.js";
3
- function zodTypeToJsonSchemaType(type) {
4
- switch (type) {
5
- case "string":
6
- return "string";
7
- case "number":
8
- return "number";
9
- case "boolean":
10
- return "boolean";
11
- case "object":
12
- return "object";
13
- case "array":
14
- return "array";
15
- case "optional":
16
- default:
17
- return "string";
18
- }
19
- }
20
- export function convertToolInput(input) {
21
- const zodSchema = input.parameters;
22
- // Try both shape and def.shape for Zod v4 compatibility
23
- const shape = zodSchema.shape ||
24
- (typeof zodSchema.def?.shape === "object" ? zodSchema.def.shape : {});
25
- const properties = {};
26
- const required = [];
27
- for (const [key, value] of Object.entries(shape)) {
28
- const field = value;
29
- const fieldType = field.type || field.def?.type || "string";
30
- const isOptional = fieldType === "optional";
31
- let actualType = isOptional ? "string" : fieldType;
32
- let actualDescription = field.description;
33
- if (isOptional && field.def?.innerType) {
34
- const innerType = field.def.innerType;
35
- actualType = innerType.type || innerType.def?.type || "string";
36
- // Get description from inner type if not on wrapper
37
- if (!actualDescription && innerType.description) {
38
- actualDescription = innerType.description;
39
- }
40
- }
41
- properties[key] = {
42
- type: zodTypeToJsonSchemaType(actualType),
43
- };
44
- if (actualDescription) {
45
- properties[key].description = actualDescription;
46
- }
47
- if (field.def?.values) {
48
- properties[key].enum = field.def.values;
49
- }
50
- if (!isOptional) {
51
- required.push(key);
52
- }
53
- }
54
- const tool = {
55
- type: "function",
56
- name: input.name,
57
- description: input.description,
58
- parameters: {
59
- type: "object",
60
- properties,
61
- required: required.length > 0 ? required : undefined,
62
- },
63
- };
64
- return toolSchema.parse(tool);
65
- }
66
- export function convertTools(inputs) {
67
- return inputs.map(convertToolInput);
68
- }
69
- export function validateTools(tools) {
70
- if (tools.length === 0) {
71
- return { tools: [], handlers: new Map() };
72
- }
73
- const firstTool = tools[0];
74
- if (!firstTool) {
75
- throw new InvalidToolsArrayError();
76
- }
77
- const handlers = new Map();
78
- const parseResult = toolSchema.safeParse(firstTool);
79
- if (parseResult.success) {
80
- const validatedTools = [];
81
- for (const tool of tools) {
82
- const result = toolSchema.safeParse(tool);
83
- if (!result.success) {
84
- throw new InvalidToolSchemaError(result.error.message, result.error);
85
- }
86
- validatedTools.push(result.data);
87
- }
88
- return { tools: validatedTools, handlers };
89
- }
90
- else {
91
- const toolInputs = tools;
92
- const convertedTools = convertTools(toolInputs);
93
- for (const toolInput of toolInputs) {
94
- if (toolInput.handler) {
95
- handlers.set(toolInput.name, toolInput.handler);
96
- }
97
- }
98
- return { tools: convertedTools, handlers };
99
- }
100
- }
101
- export function attachHandlersToToolCalls(toolCalls, handlers) {
102
- return toolCalls.map((toolCall) => {
103
- const handler = handlers.get(toolCall.name);
104
- if (handler) {
105
- return {
106
- ...toolCall,
107
- invoke: async () => await handler(toolCall.arguments),
108
- };
109
- }
110
- return toolCall;
111
- });
112
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * Patched android/link.mjs for manifest-aware native addon linking.
3
- *
4
- * If qvac/addons.manifest.json exists, only links the allowlisted addons.
5
- * Otherwise, falls back to linking all installed addons.
6
- *
7
- * This file is copied over react-native-bare-kit/android/link.mjs
8
- * by withMobileBundle.ts during expo prebuild.
9
- */
10
- import fs from "fs";
11
- import path from "path";
12
- import { fileURLToPath } from "url";
13
- import link from "bare-link";
14
-
15
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
16
- const projectRoot = path.join(__dirname, "..", "..", "..");
17
- const addonsDir = path.join(__dirname, "src", "main", "addons");
18
-
19
- if (fs.existsSync(addonsDir)) {
20
- console.log("[QVAC] Cleaning existing addons directory...");
21
- fs.rmSync(addonsDir, { recursive: true, force: true });
22
- }
23
-
24
- const manifestPath = path.join(projectRoot, "qvac", "addons.manifest.json");
25
-
26
- let pkg = null;
27
- if (fs.existsSync(manifestPath)) {
28
- try {
29
- const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
30
- const addons = Array.isArray(manifest.addons) ? manifest.addons : [];
31
-
32
- if (addons.length > 0) {
33
- console.log(
34
- `[QVAC] Using addons manifest (${addons.length} addons): ${addons.join(", ")}`,
35
- );
36
- pkg = {
37
- name: "qvac-addon-linker",
38
- version: "0.0.0",
39
- dependencies: Object.fromEntries(addons.map((name) => [name, "*"])),
40
- };
41
- } else {
42
- console.log("[QVAC] Addons manifest is empty, linking all addons");
43
- }
44
- } catch (err) {
45
- console.warn(
46
- "[QVAC] Failed to parse addons manifest, linking all addons:",
47
- err.message,
48
- );
49
- }
50
- } else {
51
- console.log("[QVAC] No addons manifest found, linking all addons");
52
- }
53
-
54
- for await (const resource of link(
55
- projectRoot,
56
- {
57
- target: ["android-arm64", "android-arm", "android-ia32", "android-x64"],
58
- out: addonsDir,
59
- },
60
- pkg,
61
- )) {
62
- console.log("Wrote", resource);
63
- }
@@ -1,63 +0,0 @@
1
- /**
2
- * Patched ios/link.mjs for manifest-aware native addon linking.
3
- *
4
- * If qvac/addons.manifest.json exists, only links the allowlisted addons.
5
- * Otherwise, falls back to linking all installed addons.
6
- *
7
- * This file is copied over react-native-bare-kit/ios/link.mjs
8
- * by withMobileBundle.ts during expo prebuild.
9
- */
10
- import fs from "fs";
11
- import path from "path";
12
- import { fileURLToPath } from "url";
13
- import link from "bare-link";
14
-
15
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
16
- const projectRoot = path.join(__dirname, "..", "..", "..");
17
- const addonsDir = path.join(__dirname, "addons");
18
-
19
- if (fs.existsSync(addonsDir)) {
20
- console.log("[QVAC] Cleaning existing addons directory...");
21
- fs.rmSync(addonsDir, { recursive: true, force: true });
22
- }
23
-
24
- const manifestPath = path.join(projectRoot, "qvac", "addons.manifest.json");
25
-
26
- let pkg = null;
27
- if (fs.existsSync(manifestPath)) {
28
- try {
29
- const manifest = JSON.parse(fs.readFileSync(manifestPath, "utf8"));
30
- const addons = Array.isArray(manifest.addons) ? manifest.addons : [];
31
-
32
- if (addons.length > 0) {
33
- console.log(
34
- `[QVAC] Using addons manifest (${addons.length} addons): ${addons.join(", ")}`,
35
- );
36
- pkg = {
37
- name: "qvac-addon-linker",
38
- version: "0.0.0",
39
- dependencies: Object.fromEntries(addons.map((name) => [name, "*"])),
40
- };
41
- } else {
42
- console.log("[QVAC] Addons manifest is empty, linking all addons");
43
- }
44
- } catch (err) {
45
- console.warn(
46
- "[QVAC] Failed to parse addons manifest, linking all addons:",
47
- err.message,
48
- );
49
- }
50
- } else {
51
- console.log("[QVAC] No addons manifest found, linking all addons");
52
- }
53
-
54
- for await (const resource of link(
55
- projectRoot,
56
- {
57
- target: ["ios-arm64", "ios-arm64-simulator", "ios-x64-simulator"],
58
- out: addonsDir,
59
- },
60
- pkg,
61
- )) {
62
- console.log("Wrote", resource);
63
- }
File without changes
File without changes