@qvac/sdk 0.8.0 → 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 (588) hide show
  1. package/LICENSE +24 -1
  2. package/README.md +191 -373
  3. package/dist/client/api/cancel.d.ts +4 -13
  4. package/dist/client/api/cancel.js +6 -16
  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 +1 -5
  13. package/dist/client/api/index.js +1 -5
  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 +1 -1
  19. package/dist/client/api/ping.js +2 -3
  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.js +4 -39
  55. package/dist/examples/kv-cache-cleanup.js +2 -1
  56. package/dist/examples/kv-cache-custom-key.js +2 -16
  57. package/dist/examples/kv-cache-example.js +2 -1
  58. package/dist/examples/llamacpp-file-logging.d.ts +2 -0
  59. package/dist/examples/{logging-file-transport.js → llamacpp-file-logging.js} +8 -3
  60. package/dist/examples/llamacpp-filesystem.js +2 -2
  61. package/dist/examples/llamacpp-http.js +1 -0
  62. package/dist/examples/llamacpp-hyperdrive.js +2 -1
  63. package/dist/examples/llamacpp-multimodal.js +4 -3
  64. package/dist/examples/llamacpp-native-tools.js +30 -72
  65. package/dist/examples/multi-model-demo.js +3 -2
  66. package/dist/examples/parallel-download.js +14 -46
  67. package/dist/examples/rag/rag-chromadb.js +1 -0
  68. package/dist/examples/rag/rag-hyperdb-workspaces.d.ts +2 -0
  69. package/dist/examples/rag/rag-hyperdb-workspaces.js +107 -0
  70. package/dist/examples/rag/rag-hyperdb.d.ts +2 -0
  71. package/dist/examples/rag/{rag-hyperdb/ingest.js → rag-hyperdb.js} +5 -10
  72. package/dist/examples/rag/rag-lancedb.js +1 -0
  73. package/dist/examples/rag/rag-sqlite.js +1 -0
  74. package/dist/examples/text-to-speech.d.ts +3 -0
  75. package/dist/examples/{tts/utils.js → text-to-speech.js} +63 -18
  76. package/dist/examples/translation/translation-indic.js +1 -4
  77. package/dist/examples/translation/translation-llm-context.js +1 -0
  78. package/dist/examples/translation/translation-llm.js +2 -2
  79. package/dist/examples/translation/translation-opus.js +3 -6
  80. package/dist/examples/translation/translation-stream.js +3 -3
  81. package/dist/examples/whispercpp-filesystem.js +43 -0
  82. package/dist/examples/{transcription/whispercpp-microphone-record.js → whispercpp-microphone-record.js} +9 -8
  83. package/dist/expo/plugins/index.d.ts +0 -3
  84. package/dist/expo/plugins/index.js +0 -3
  85. package/dist/expo/plugins/withMobileBundle.d.ts +2 -5
  86. package/dist/expo/plugins/withMobileBundle.js +40 -121
  87. package/dist/expo/plugins/withQvacSDK.d.ts +0 -4
  88. package/dist/expo/plugins/withQvacSDK.js +1 -26
  89. package/dist/index.d.ts +4 -9
  90. package/dist/index.js +5 -11
  91. package/dist/logging/base-logger.js +16 -26
  92. package/dist/logging/index.d.ts +1 -7
  93. package/dist/logging/index.js +1 -7
  94. package/dist/logging/logger.d.ts +2 -0
  95. package/dist/logging/logger.js +6 -11
  96. package/dist/logging/stream-logger.d.ts +1 -1
  97. package/dist/logging/stream-logger.js +3 -6
  98. package/dist/logging/transport.js +2 -2
  99. package/dist/logging/types.d.ts +0 -2
  100. package/dist/logging/utils.d.ts +0 -2
  101. package/dist/logging/utils.js +0 -62
  102. package/dist/models/{registry → hyperdrive}/index.js +1 -1
  103. package/dist/models/hyperdrive/models.d.ts +619 -0
  104. package/dist/models/hyperdrive/models.js +693 -0
  105. package/dist/schemas/cancel.d.ts +0 -6
  106. package/dist/schemas/cancel.js +0 -5
  107. package/dist/schemas/common.d.ts +164 -2973
  108. package/dist/schemas/common.js +1 -23
  109. package/dist/schemas/completion-stream.d.ts +60 -31
  110. package/dist/schemas/completion-stream.js +44 -20
  111. package/dist/schemas/delegate.d.ts +0 -1
  112. package/dist/schemas/delegate.js +0 -1
  113. package/dist/schemas/download-asset.d.ts +3 -125
  114. package/dist/schemas/download-asset.js +5 -22
  115. package/dist/schemas/embed.d.ts +3 -3
  116. package/dist/schemas/embed.js +2 -9
  117. package/dist/schemas/index.d.ts +1 -19
  118. package/dist/schemas/index.js +1 -19
  119. package/dist/schemas/llamacpp-config.d.ts +12 -243
  120. package/dist/schemas/llamacpp-config.js +14 -50
  121. package/dist/schemas/load-model.d.ts +893 -14358
  122. package/dist/schemas/load-model.js +72 -325
  123. package/dist/schemas/logging-stream.d.ts +4 -11
  124. package/dist/schemas/logging-stream.js +3 -4
  125. package/dist/schemas/rag.d.ts +52 -183
  126. package/dist/schemas/rag.js +23 -152
  127. package/dist/schemas/text-to-speech.d.ts +1 -692
  128. package/dist/schemas/text-to-speech.js +3 -35
  129. package/dist/schemas/transcription.d.ts +0 -3
  130. package/dist/schemas/transcription.js +0 -1
  131. package/dist/schemas/translate.d.ts +23 -68
  132. package/dist/schemas/translate.js +11 -37
  133. package/dist/schemas/translation-config.d.ts +7 -810
  134. package/dist/schemas/translation-config.js +7 -113
  135. package/dist/schemas/unload-model.d.ts +0 -2
  136. package/dist/schemas/unload-model.js +0 -2
  137. package/dist/schemas/whispercpp-config.d.ts +25 -0
  138. package/dist/schemas/whispercpp-config.js +18 -0
  139. package/dist/server/bare/{ops → addons}/cancel.js +1 -2
  140. package/dist/server/bare/addons/index.d.ts +4 -0
  141. package/dist/server/bare/addons/index.js +3 -0
  142. package/dist/server/bare/addons/llamacpp/create-model.d.ts +5 -0
  143. package/dist/server/bare/addons/llamacpp/create-model.js +67 -0
  144. package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.d.ts +1 -2
  145. package/dist/server/bare/{plugins/llamacpp-completion/ops → addons/llamacpp/handlers}/completion-stream.js +87 -54
  146. package/dist/server/bare/addons/llamacpp/handlers/embed.d.ts +4 -0
  147. package/dist/server/bare/{ops → addons/llamacpp/handlers}/embed.js +7 -22
  148. package/dist/server/bare/addons/llamacpp/index.d.ts +4 -0
  149. package/dist/server/bare/addons/llamacpp/index.js +3 -0
  150. package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.d.ts +1 -4
  151. package/dist/server/bare/{ops → addons/llamacpp}/kv-cache-utils.js +19 -54
  152. package/dist/server/bare/addons/load-model.d.ts +3 -0
  153. package/dist/server/bare/addons/load-model.js +62 -0
  154. package/dist/server/bare/addons/translation/create-model.d.ts +4 -0
  155. package/dist/server/bare/addons/translation/create-model.js +45 -0
  156. package/dist/server/bare/addons/translation/handlers/translate.d.ts +3 -0
  157. package/dist/server/bare/{ops → addons/translation/handlers}/translate.js +14 -47
  158. package/dist/server/bare/addons/translation/index.d.ts +3 -0
  159. package/dist/server/bare/addons/translation/index.js +2 -0
  160. package/dist/server/bare/addons/tts/create-model.d.ts +6 -0
  161. package/dist/server/bare/addons/tts/create-model.js +40 -0
  162. package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.js +3 -25
  163. package/dist/server/bare/addons/tts/index.d.ts +3 -0
  164. package/dist/server/bare/addons/tts/index.js +2 -0
  165. package/dist/server/bare/addons/unload-model.js +20 -0
  166. package/dist/server/bare/addons/whispercpp/create-model.d.ts +6 -0
  167. package/dist/server/bare/addons/whispercpp/create-model.js +55 -0
  168. package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.d.ts +3 -0
  169. package/dist/server/bare/addons/whispercpp/handlers/transcribe-stream.js +48 -0
  170. package/dist/server/bare/addons/whispercpp/index.d.ts +3 -0
  171. package/dist/server/bare/addons/whispercpp/index.js +2 -0
  172. package/dist/server/bare/delegate-rpc-client.d.ts +0 -6
  173. package/dist/server/bare/delegate-rpc-client.js +46 -157
  174. package/dist/server/bare/hyperswarm.d.ts +0 -3
  175. package/dist/server/bare/hyperswarm.js +6 -29
  176. package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.d.ts +1 -1
  177. package/dist/server/bare/rag-hyperdb/handlers/delete-embeddings.js +10 -9
  178. package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.d.ts +4 -7
  179. package/dist/server/bare/rag-hyperdb/handlers/save-embeddings.js +14 -13
  180. package/dist/server/bare/rag-hyperdb/handlers/search.js +10 -10
  181. package/dist/server/bare/rag-hyperdb/index.d.ts +1 -8
  182. package/dist/server/bare/rag-hyperdb/index.js +1 -8
  183. package/dist/server/bare/rag-hyperdb/rag-manager.d.ts +5 -0
  184. package/dist/server/bare/rag-hyperdb/rag-manager.js +65 -0
  185. package/dist/server/bare/registry/logging-stream-registry.d.ts +7 -24
  186. package/dist/server/bare/registry/logging-stream-registry.js +20 -99
  187. package/dist/server/bare/registry/model-registry.d.ts +26 -14
  188. package/dist/server/bare/registry/model-registry.js +12 -32
  189. package/dist/server/error-handlers.d.ts +2 -3
  190. package/dist/server/error-handlers.js +10 -15
  191. package/dist/server/http-server.d.ts +2 -0
  192. package/dist/server/http-server.js +189 -0
  193. package/dist/server/rpc/create-server.js +3 -5
  194. package/dist/server/rpc/handle-request.d.ts +9 -0
  195. package/dist/server/rpc/handle-request.js +242 -92
  196. package/dist/server/rpc/handlers/cancelHandler.js +3 -14
  197. package/dist/server/rpc/handlers/completion-stream-delegated.d.ts +1 -3
  198. package/dist/server/rpc/handlers/completion-stream-delegated.js +6 -18
  199. package/dist/server/rpc/handlers/completion-stream.js +41 -2
  200. package/dist/server/rpc/handlers/delete-cache.js +2 -4
  201. package/dist/server/rpc/handlers/download-asset.js +6 -59
  202. package/dist/server/rpc/handlers/embed.js +19 -2
  203. package/dist/server/rpc/handlers/index.d.ts +0 -13
  204. package/dist/server/rpc/handlers/index.js +0 -13
  205. package/dist/server/rpc/handlers/load-model/download-manager.d.ts +11 -12
  206. package/dist/server/rpc/handlers/load-model/download-manager.js +28 -43
  207. package/dist/server/rpc/handlers/load-model/http.d.ts +1 -2
  208. package/dist/server/rpc/handlers/load-model/http.js +55 -424
  209. package/dist/server/rpc/handlers/load-model/hyperdrive.d.ts +1 -2
  210. package/dist/server/rpc/handlers/load-model/hyperdrive.js +171 -364
  211. package/dist/server/rpc/handlers/load-model/index.d.ts +2 -2
  212. package/dist/server/rpc/handlers/load-model/index.js +2 -2
  213. package/dist/server/rpc/handlers/load-model/resolve.d.ts +1 -3
  214. package/dist/server/rpc/handlers/load-model/resolve.js +29 -110
  215. package/dist/server/rpc/handlers/load-model-delegated.d.ts +2 -6
  216. package/dist/server/rpc/handlers/load-model-delegated.js +21 -59
  217. package/dist/server/rpc/handlers/{load-model/handler.d.ts → load-model.d.ts} +2 -2
  218. package/dist/server/rpc/handlers/load-model.js +57 -0
  219. package/dist/server/rpc/handlers/logging-stream.js +4 -4
  220. package/dist/server/rpc/handlers/provideHandler/connection.js +10 -12
  221. package/dist/server/rpc/handlers/provideHandler/handler.js +17 -20
  222. package/dist/server/rpc/handlers/provideHandler/proxy.js +6 -8
  223. package/dist/server/rpc/handlers/rag.d.ts +2 -2
  224. package/dist/server/rpc/handlers/rag.js +43 -130
  225. package/dist/server/rpc/handlers/stopProvideHandler.js +2 -6
  226. package/dist/server/rpc/handlers/text-to-speech.js +5 -2
  227. package/dist/server/rpc/handlers/transcribe-stream.js +24 -2
  228. package/dist/server/rpc/handlers/translate.js +49 -2
  229. package/dist/server/rpc/handlers/unload-model.js +3 -12
  230. package/dist/server/rpc/index.d.ts +1 -1
  231. package/dist/server/utils/audio/decoder.d.ts +1 -2
  232. package/dist/server/utils/audio/decoder.js +12 -49
  233. package/dist/server/utils/cache.d.ts +8 -19
  234. package/dist/server/utils/cache.js +15 -100
  235. package/dist/server/utils/hash.d.ts +5 -0
  236. package/dist/server/utils/hash.js +11 -0
  237. package/dist/server/utils/index.d.ts +2 -7
  238. package/dist/server/utils/index.js +2 -7
  239. package/dist/server/utils/tool-parser.js +14 -28
  240. package/dist/server/worker.d.ts +5 -4
  241. package/dist/server/worker.js +89 -22
  242. package/package.json +41 -141
  243. package/NOTICE +0 -358
  244. package/bare-imports.json +0 -44
  245. package/dist/client/api/get-model-info.d.ts +0 -36
  246. package/dist/client/api/get-model-info.js +0 -14
  247. package/dist/client/api/invoke-plugin.d.ts +0 -15
  248. package/dist/client/api/invoke-plugin.js +0 -38
  249. package/dist/client/api/ocr.d.ts +0 -31
  250. package/dist/client/api/ocr.js +0 -88
  251. package/dist/client/api/registry.d.ts +0 -14
  252. package/dist/client/api/registry.js +0 -37
  253. package/dist/client/config-loader/config-utils.d.ts +0 -5
  254. package/dist/client/config-loader/config-utils.js +0 -20
  255. package/dist/client/config-loader/resolve-config.bare.d.ts +0 -9
  256. package/dist/client/config-loader/resolve-config.bare.js +0 -87
  257. package/dist/client/config-loader/resolve-config.expo.d.ts +0 -11
  258. package/dist/client/config-loader/resolve-config.expo.js +0 -62
  259. package/dist/client/config-loader/resolve-config.node.d.ts +0 -10
  260. package/dist/client/config-loader/resolve-config.node.js +0 -145
  261. package/dist/client/init-hooks.d.ts +0 -21
  262. package/dist/client/init-hooks.js +0 -66
  263. package/dist/client/rpc/expo-device-info.d.ts +0 -6
  264. package/dist/client/rpc/expo-device-info.js +0 -32
  265. package/dist/client/rpc/profiling/index.d.ts +0 -2
  266. package/dist/client/rpc/profiling/index.js +0 -1
  267. package/dist/client/rpc/profiling/profiler.d.ts +0 -27
  268. package/dist/client/rpc/profiling/profiler.js +0 -139
  269. package/dist/constants/registry.d.ts +0 -2
  270. package/dist/constants/registry.js +0 -1
  271. package/dist/examples/cache-management.d.ts +0 -2
  272. package/dist/examples/cache-management.js +0 -97
  273. package/dist/examples/config/blind-relay/blind-relay.config.d.ts +0 -5
  274. package/dist/examples/config/blind-relay/blind-relay.config.js +0 -7
  275. package/dist/examples/config/default/default.config.d.ts +0 -8
  276. package/dist/examples/config/default/default.config.js +0 -6
  277. package/dist/examples/config/plugins/plugins.config.d.ts +0 -5
  278. package/dist/examples/config/plugins/plugins.config.js +0 -4
  279. package/dist/examples/config-reload.d.ts +0 -2
  280. package/dist/examples/config-reload.js +0 -49
  281. package/dist/examples/default-config-usage.d.ts +0 -17
  282. package/dist/examples/default-config-usage.js +0 -47
  283. package/dist/examples/delegated-inference/consumer-profiled.d.ts +0 -2
  284. package/dist/examples/delegated-inference/consumer-profiled.js +0 -67
  285. package/dist/examples/download-with-blind-relays.d.ts +0 -2
  286. package/dist/examples/download-with-blind-relays.js +0 -49
  287. package/dist/examples/llamacpp-sharded.d.ts +0 -2
  288. package/dist/examples/llamacpp-sharded.js +0 -53
  289. package/dist/examples/logging-file-transport.d.ts +0 -2
  290. package/dist/examples/logging-streaming.d.ts +0 -2
  291. package/dist/examples/logging-streaming.js +0 -75
  292. package/dist/examples/mcp-websearch.d.ts +0 -13
  293. package/dist/examples/mcp-websearch.js +0 -176
  294. package/dist/examples/ocr-fasttext.d.ts +0 -2
  295. package/dist/examples/ocr-fasttext.js +0 -52
  296. package/dist/examples/plugins.d.ts +0 -14
  297. package/dist/examples/plugins.js +0 -129
  298. package/dist/examples/profiling/basic.d.ts +0 -2
  299. package/dist/examples/profiling/basic.js +0 -71
  300. package/dist/examples/profiling/per-call.d.ts +0 -2
  301. package/dist/examples/profiling/per-call.js +0 -30
  302. package/dist/examples/quickstart.d.ts +0 -2
  303. package/dist/examples/quickstart.js +0 -28
  304. package/dist/examples/rag/rag-hyperdb/cancellation.d.ts +0 -2
  305. package/dist/examples/rag/rag-hyperdb/cancellation.js +0 -75
  306. package/dist/examples/rag/rag-hyperdb/ingest.d.ts +0 -2
  307. package/dist/examples/rag/rag-hyperdb/pipeline.d.ts +0 -2
  308. package/dist/examples/rag/rag-hyperdb/pipeline.js +0 -74
  309. package/dist/examples/rag/rag-hyperdb/workspaces.d.ts +0 -2
  310. package/dist/examples/rag/rag-hyperdb/workspaces.js +0 -178
  311. package/dist/examples/registry-query.d.ts +0 -2
  312. package/dist/examples/registry-query.js +0 -87
  313. package/dist/examples/transcription/parakeet-ctc-filesystem.d.ts +0 -2
  314. package/dist/examples/transcription/parakeet-ctc-filesystem.js +0 -40
  315. package/dist/examples/transcription/parakeet-microphone-record.d.ts +0 -2
  316. package/dist/examples/transcription/parakeet-microphone-record.js +0 -95
  317. package/dist/examples/transcription/parakeet-sortformer.d.ts +0 -2
  318. package/dist/examples/transcription/parakeet-sortformer.js +0 -115
  319. package/dist/examples/transcription/parakeet-tdt-filesystem.d.ts +0 -2
  320. package/dist/examples/transcription/parakeet-tdt-filesystem.js +0 -44
  321. package/dist/examples/transcription/whispercpp-filesystem.js +0 -69
  322. package/dist/examples/transcription/whispercpp-prompt.d.ts +0 -2
  323. package/dist/examples/transcription/whispercpp-prompt.js +0 -67
  324. package/dist/examples/translation/translation-bergamot-batch.d.ts +0 -2
  325. package/dist/examples/translation/translation-bergamot-batch.js +0 -49
  326. package/dist/examples/translation/translation-bergamot-pivot.d.ts +0 -2
  327. package/dist/examples/translation/translation-bergamot-pivot.js +0 -73
  328. package/dist/examples/translation/translation-bergamot.d.ts +0 -2
  329. package/dist/examples/translation/translation-bergamot.js +0 -39
  330. package/dist/examples/translation/translation-llm-afriquegemma.d.ts +0 -2
  331. package/dist/examples/translation/translation-llm-afriquegemma.js +0 -39
  332. package/dist/examples/tts/chatterbox.d.ts +0 -2
  333. package/dist/examples/tts/chatterbox.js +0 -59
  334. package/dist/examples/tts/supertonic.d.ts +0 -2
  335. package/dist/examples/tts/supertonic.js +0 -51
  336. package/dist/examples/tts/utils.d.ts +0 -17
  337. package/dist/expo/plugins/resolve-sdk-package-dir.d.ts +0 -15
  338. package/dist/expo/plugins/resolve-sdk-package-dir.js +0 -31
  339. package/dist/expo/plugins/withAndroidArchitecture.d.ts +0 -8
  340. package/dist/expo/plugins/withAndroidArchitecture.js +0 -52
  341. package/dist/expo/plugins/withAndroidNdkVersion.d.ts +0 -8
  342. package/dist/expo/plugins/withAndroidNdkVersion.js +0 -31
  343. package/dist/expo/plugins/withDeviceInfo.d.ts +0 -10
  344. package/dist/expo/plugins/withDeviceInfo.js +0 -48
  345. package/dist/logging/addon.d.ts +0 -6
  346. package/dist/logging/addon.js +0 -75
  347. package/dist/logging/client-logger.d.ts +0 -3
  348. package/dist/logging/client-logger.js +0 -24
  349. package/dist/logging/namespaces.d.ts +0 -6
  350. package/dist/logging/namespaces.js +0 -6
  351. package/dist/logging/registry.d.ts +0 -31
  352. package/dist/logging/registry.js +0 -62
  353. package/dist/logging/server-logger.d.ts +0 -3
  354. package/dist/logging/server-logger.js +0 -16
  355. package/dist/models/registry/models.d.ts +0 -10417
  356. package/dist/models/registry/models.js +0 -10757
  357. package/dist/models/update-models/codegen.d.ts +0 -3
  358. package/dist/models/update-models/codegen.js +0 -135
  359. package/dist/models/update-models/history.d.ts +0 -24
  360. package/dist/models/update-models/history.js +0 -107
  361. package/dist/models/update-models/index.d.ts +0 -2
  362. package/dist/models/update-models/index.js +0 -125
  363. package/dist/models/update-models/naming.d.ts +0 -4
  364. package/dist/models/update-models/naming.js +0 -370
  365. package/dist/models/update-models/processing.d.ts +0 -8
  366. package/dist/models/update-models/processing.js +0 -67
  367. package/dist/models/update-models/registry.d.ts +0 -4
  368. package/dist/models/update-models/registry.js +0 -67
  369. package/dist/models/update-models/shards.d.ts +0 -4
  370. package/dist/models/update-models/shards.js +0 -57
  371. package/dist/models/update-models/types.d.ts +0 -60
  372. package/dist/models/update-models/types.js +0 -1
  373. package/dist/models/update-models/utils.d.ts +0 -3
  374. package/dist/models/update-models/utils.js +0 -21
  375. package/dist/pear/pre.d.ts +0 -18
  376. package/dist/pear/pre.js +0 -433
  377. package/dist/profiling/aggregator.d.ts +0 -15
  378. package/dist/profiling/aggregator.js +0 -100
  379. package/dist/profiling/clock.d.ts +0 -12
  380. package/dist/profiling/clock.js +0 -51
  381. package/dist/profiling/controller.d.ts +0 -33
  382. package/dist/profiling/controller.js +0 -123
  383. package/dist/profiling/envelope.d.ts +0 -10
  384. package/dist/profiling/envelope.js +0 -36
  385. package/dist/profiling/events.d.ts +0 -20
  386. package/dist/profiling/events.js +0 -37
  387. package/dist/profiling/exporters.d.ts +0 -10
  388. package/dist/profiling/exporters.js +0 -236
  389. package/dist/profiling/index.d.ts +0 -36
  390. package/dist/profiling/index.js +0 -31
  391. package/dist/profiling/ring-buffer.d.ts +0 -19
  392. package/dist/profiling/ring-buffer.js +0 -83
  393. package/dist/profiling/types.d.ts +0 -47
  394. package/dist/profiling/types.js +0 -1
  395. package/dist/schemas/archive.d.ts +0 -9
  396. package/dist/schemas/archive.js +0 -17
  397. package/dist/schemas/engine-addon-map.d.ts +0 -5
  398. package/dist/schemas/engine-addon-map.js +0 -52
  399. package/dist/schemas/get-model-info.d.ts +0 -120
  400. package/dist/schemas/get-model-info.js +0 -58
  401. package/dist/schemas/json-schema.d.ts +0 -16
  402. package/dist/schemas/json-schema.js +0 -2
  403. package/dist/schemas/mcp-adapter.d.ts +0 -47
  404. package/dist/schemas/mcp-adapter.js +0 -1
  405. package/dist/schemas/model-src-utils.d.ts +0 -148
  406. package/dist/schemas/model-src-utils.js +0 -35
  407. package/dist/schemas/model-types.d.ts +0 -183
  408. package/dist/schemas/model-types.js +0 -168
  409. package/dist/schemas/ocr.d.ts +0 -125
  410. package/dist/schemas/ocr.js +0 -57
  411. package/dist/schemas/path-validation.d.ts +0 -10
  412. package/dist/schemas/path-validation.js +0 -22
  413. package/dist/schemas/plugin.d.ts +0 -226
  414. package/dist/schemas/plugin.js +0 -158
  415. package/dist/schemas/profiling.d.ts +0 -105
  416. package/dist/schemas/profiling.js +0 -66
  417. package/dist/schemas/registry.d.ts +0 -356
  418. package/dist/schemas/registry.js +0 -93
  419. package/dist/schemas/reload-config.d.ts +0 -476
  420. package/dist/schemas/reload-config.js +0 -44
  421. package/dist/schemas/runtime-context.d.ts +0 -19
  422. package/dist/schemas/runtime-context.js +0 -7
  423. package/dist/schemas/sdk-config.d.ts +0 -2973
  424. package/dist/schemas/sdk-config.js +0 -136
  425. package/dist/schemas/sdk-errors-client.d.ts +0 -31
  426. package/dist/schemas/sdk-errors-client.js +0 -143
  427. package/dist/schemas/sdk-errors-registry.d.ts +0 -6
  428. package/dist/schemas/sdk-errors-registry.js +0 -8
  429. package/dist/schemas/sdk-errors-server.d.ts +0 -89
  430. package/dist/schemas/sdk-errors-server.js +0 -451
  431. package/dist/schemas/shard.d.ts +0 -21
  432. package/dist/schemas/shard.js +0 -17
  433. package/dist/schemas/tools.d.ts +0 -65
  434. package/dist/schemas/tools.js +0 -43
  435. package/dist/schemas/transcription-config.d.ts +0 -383
  436. package/dist/schemas/transcription-config.js +0 -95
  437. package/dist/scripts/run-security-tests-bare.d.ts +0 -2
  438. package/dist/scripts/run-security-tests-bare.js +0 -78
  439. package/dist/scripts/run-security-tests.d.ts +0 -2
  440. package/dist/scripts/run-security-tests.js +0 -22
  441. package/dist/scripts/run-unit-tests.d.ts +0 -2
  442. package/dist/scripts/run-unit-tests.js +0 -17
  443. package/dist/server/bare/ops/embed.d.ts +0 -12
  444. package/dist/server/bare/ops/load-model.d.ts +0 -9
  445. package/dist/server/bare/ops/load-model.js +0 -85
  446. package/dist/server/bare/ops/transcribe.d.ts +0 -3
  447. package/dist/server/bare/ops/transcribe.js +0 -75
  448. package/dist/server/bare/ops/translate.d.ts +0 -5
  449. package/dist/server/bare/ops/unload-model.js +0 -41
  450. package/dist/server/bare/plugins/index.d.ts +0 -8
  451. package/dist/server/bare/plugins/index.js +0 -7
  452. package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.d.ts +0 -6
  453. package/dist/server/bare/plugins/llamacpp-completion/ops/cache-logger.js +0 -34
  454. package/dist/server/bare/plugins/llamacpp-completion/plugin.d.ts +0 -220
  455. package/dist/server/bare/plugins/llamacpp-completion/plugin.js +0 -155
  456. package/dist/server/bare/plugins/llamacpp-embedding/plugin.d.ts +0 -54
  457. package/dist/server/bare/plugins/llamacpp-embedding/plugin.js +0 -87
  458. package/dist/server/bare/plugins/nmtcpp-translation/plugin.d.ts +0 -367
  459. package/dist/server/bare/plugins/nmtcpp-translation/plugin.js +0 -204
  460. package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.d.ts +0 -10
  461. package/dist/server/bare/plugins/onnx-ocr/ops/ocr-stream.js +0 -110
  462. package/dist/server/bare/plugins/onnx-ocr/plugin.d.ts +0 -86
  463. package/dist/server/bare/plugins/onnx-ocr/plugin.js +0 -117
  464. package/dist/server/bare/plugins/onnx-tts/plugin.d.ts +0 -373
  465. package/dist/server/bare/plugins/onnx-tts/plugin.js +0 -182
  466. package/dist/server/bare/plugins/onnx-tts/wav-helper.d.ts +0 -14
  467. package/dist/server/bare/plugins/onnx-tts/wav-helper.js +0 -107
  468. package/dist/server/bare/plugins/parakeet-transcription/plugin.d.ts +0 -317
  469. package/dist/server/bare/plugins/parakeet-transcription/plugin.js +0 -154
  470. package/dist/server/bare/plugins/whispercpp-transcription/plugin.d.ts +0 -237
  471. package/dist/server/bare/plugins/whispercpp-transcription/plugin.js +0 -86
  472. package/dist/server/bare/rag-hyperdb/handlers/chunk.d.ts +0 -3
  473. package/dist/server/bare/rag-hyperdb/handlers/chunk.js +0 -7
  474. package/dist/server/bare/rag-hyperdb/handlers/close-workspace.d.ts +0 -3
  475. package/dist/server/bare/rag-hyperdb/handlers/close-workspace.js +0 -9
  476. package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.d.ts +0 -3
  477. package/dist/server/bare/rag-hyperdb/handlers/delete-workspace.js +0 -14
  478. package/dist/server/bare/rag-hyperdb/handlers/ingest.d.ts +0 -9
  479. package/dist/server/bare/rag-hyperdb/handlers/ingest.js +0 -18
  480. package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.d.ts +0 -3
  481. package/dist/server/bare/rag-hyperdb/handlers/list-workspaces.js +0 -4
  482. package/dist/server/bare/rag-hyperdb/handlers/reindex.d.ts +0 -9
  483. package/dist/server/bare/rag-hyperdb/handlers/reindex.js +0 -16
  484. package/dist/server/bare/rag-hyperdb/rag-operation-manager.d.ts +0 -7
  485. package/dist/server/bare/rag-hyperdb/rag-operation-manager.js +0 -39
  486. package/dist/server/bare/rag-hyperdb/rag-workspace-manager.d.ts +0 -15
  487. package/dist/server/bare/rag-hyperdb/rag-workspace-manager.js +0 -136
  488. package/dist/server/bare/registry/config-registry.d.ts +0 -14
  489. package/dist/server/bare/registry/config-registry.js +0 -82
  490. package/dist/server/bare/registry/model-config-registry.d.ts +0 -4
  491. package/dist/server/bare/registry/model-config-registry.js +0 -15
  492. package/dist/server/bare/registry/model-config-utils.d.ts +0 -15
  493. package/dist/server/bare/registry/model-config-utils.js +0 -112
  494. package/dist/server/bare/registry/registry-client.d.ts +0 -5
  495. package/dist/server/bare/registry/registry-client.js +0 -37
  496. package/dist/server/bare/registry/runtime-context-registry.d.ts +0 -7
  497. package/dist/server/bare/registry/runtime-context-registry.js +0 -26
  498. package/dist/server/bare/utils/audio-input.d.ts +0 -10
  499. package/dist/server/bare/utils/audio-input.js +0 -33
  500. package/dist/server/bare/utils/loader-adapter.d.ts +0 -7
  501. package/dist/server/bare/utils/loader-adapter.js +0 -9
  502. package/dist/server/env.d.ts +0 -22
  503. package/dist/server/env.js +0 -57
  504. package/dist/server/plugins/index.d.ts +0 -2
  505. package/dist/server/plugins/index.js +0 -1
  506. package/dist/server/plugins/registry.d.ts +0 -9
  507. package/dist/server/plugins/registry.js +0 -79
  508. package/dist/server/rpc/delegate-transport.d.ts +0 -19
  509. package/dist/server/rpc/delegate-transport.js +0 -215
  510. package/dist/server/rpc/handler-registry.d.ts +0 -3
  511. package/dist/server/rpc/handler-registry.js +0 -90
  512. package/dist/server/rpc/handler-utils.d.ts +0 -23
  513. package/dist/server/rpc/handler-utils.js +0 -128
  514. package/dist/server/rpc/handlers/get-model-info.d.ts +0 -3
  515. package/dist/server/rpc/handlers/get-model-info.js +0 -164
  516. package/dist/server/rpc/handlers/load-model/download-stats.d.ts +0 -6
  517. package/dist/server/rpc/handlers/load-model/download-stats.js +0 -87
  518. package/dist/server/rpc/handlers/load-model/handler.js +0 -187
  519. package/dist/server/rpc/handlers/load-model/registry.d.ts +0 -11
  520. package/dist/server/rpc/handlers/load-model/registry.js +0 -564
  521. package/dist/server/rpc/handlers/load-model/types.d.ts +0 -29
  522. package/dist/server/rpc/handlers/load-model/types.js +0 -1
  523. package/dist/server/rpc/handlers/ocr-stream.d.ts +0 -3
  524. package/dist/server/rpc/handlers/ocr-stream.js +0 -4
  525. package/dist/server/rpc/handlers/ping.d.ts +0 -3
  526. package/dist/server/rpc/handlers/ping.js +0 -3
  527. package/dist/server/rpc/handlers/plugin-dispatch.d.ts +0 -15
  528. package/dist/server/rpc/handlers/plugin-dispatch.js +0 -59
  529. package/dist/server/rpc/handlers/plugin-invoke.d.ts +0 -4
  530. package/dist/server/rpc/handlers/plugin-invoke.js +0 -92
  531. package/dist/server/rpc/handlers/registry.d.ts +0 -5
  532. package/dist/server/rpc/handlers/registry.js +0 -157
  533. package/dist/server/rpc/handlers/unload-model-delegated.d.ts +0 -3
  534. package/dist/server/rpc/handlers/unload-model-delegated.js +0 -32
  535. package/dist/server/rpc/profiling/context.d.ts +0 -18
  536. package/dist/server/rpc/profiling/context.js +0 -38
  537. package/dist/server/rpc/profiling/delegation-profiler.d.ts +0 -32
  538. package/dist/server/rpc/profiling/delegation-profiler.js +0 -154
  539. package/dist/server/rpc/profiling/index.d.ts +0 -5
  540. package/dist/server/rpc/profiling/index.js +0 -4
  541. package/dist/server/rpc/profiling/operation-metrics.d.ts +0 -25
  542. package/dist/server/rpc/profiling/operation-metrics.js +0 -199
  543. package/dist/server/rpc/profiling/operation-wrappers.d.ts +0 -18
  544. package/dist/server/rpc/profiling/operation-wrappers.js +0 -124
  545. package/dist/server/rpc/profiling/profiler.d.ts +0 -13
  546. package/dist/server/rpc/profiling/profiler.js +0 -97
  547. package/dist/server/utils/archive.d.ts +0 -4
  548. package/dist/server/utils/archive.js +0 -179
  549. package/dist/server/utils/checksum.d.ts +0 -4
  550. package/dist/server/utils/checksum.js +0 -31
  551. package/dist/server/utils/config-transform.d.ts +0 -3
  552. package/dist/server/utils/config-transform.js +0 -23
  553. package/dist/server/utils/formatting.d.ts +0 -19
  554. package/dist/server/utils/formatting.js +0 -61
  555. package/dist/server/utils/gguf-tensor-extractor.d.ts +0 -15
  556. package/dist/server/utils/gguf-tensor-extractor.js +0 -314
  557. package/dist/server/utils/path-security.d.ts +0 -12
  558. package/dist/server/utils/path-security.js +0 -25
  559. package/dist/server/utils/shard-utils.d.ts +0 -48
  560. package/dist/server/utils/shard-utils.js +0 -125
  561. package/dist/server/utils/tool-integration.d.ts +0 -13
  562. package/dist/server/utils/tool-integration.js +0 -43
  563. package/dist/server/worker-core.d.ts +0 -6
  564. package/dist/server/worker-core.js +0 -88
  565. package/dist/utils/errors-base.d.ts +0 -3
  566. package/dist/utils/errors-base.js +0 -13
  567. package/dist/utils/errors-client.d.ts +0 -137
  568. package/dist/utils/errors-client.js +0 -240
  569. package/dist/utils/errors-server.d.ts +0 -236
  570. package/dist/utils/errors-server.js +0 -412
  571. package/dist/utils/global-singleton.d.ts +0 -2
  572. package/dist/utils/global-singleton.js +0 -10
  573. package/dist/utils/mcp-adapter.d.ts +0 -12
  574. package/dist/utils/mcp-adapter.js +0 -103
  575. package/dist/utils/object.d.ts +0 -2
  576. package/dist/utils/object.js +0 -3
  577. package/dist/utils/path-sanitize.d.ts +0 -17
  578. package/dist/utils/path-sanitize.js +0 -54
  579. package/dist/utils/tool-helpers.d.ts +0 -25
  580. package/dist/utils/tool-helpers.js +0 -112
  581. package/expo/plugins/patches/android-link.mjs +0 -63
  582. package/expo/plugins/patches/ios-link.mjs +0 -63
  583. /package/dist/examples/{transcription/whispercpp-filesystem.d.ts → whispercpp-filesystem.d.ts} +0 -0
  584. /package/dist/examples/{transcription/whispercpp-microphone-record.d.ts → whispercpp-microphone-record.d.ts} +0 -0
  585. /package/dist/models/{registry → hyperdrive}/index.d.ts +0 -0
  586. /package/dist/server/bare/{ops → addons}/cancel.d.ts +0 -0
  587. /package/dist/server/bare/{plugins/onnx-tts/ops → addons/tts/handlers}/text-to-speech.d.ts +0 -0
  588. /package/dist/server/bare/{ops → addons}/unload-model.d.ts +0 -0
@@ -1,67 +1,9 @@
1
- import { chunk, ingest, reindex, saveEmbeddings, search, deleteEmbeddings, listWorkspaces, closeWorkspace, deleteWorkspace, DEFAULT_WORKSPACE, registerRagOperation, unregisterRagOperation, } from "../../bare/rag-hyperdb/index.js";
2
- import { profileReplyHandler, registerOperationMetrics, } from "../profiling/index.js";
3
- registerOperationMetrics({
4
- op: "rag",
5
- kind: "handler",
6
- getTags: (req) => {
7
- const tags = {};
8
- if (req.operation)
9
- tags["operation"] = req.operation;
10
- if (req.workspace)
11
- tags["workspace"] = req.workspace;
12
- return tags;
13
- },
14
- fromResult: (res) => {
15
- const gauges = {};
16
- if (res.processed !== undefined)
17
- gauges["processed"] = res.processed.length;
18
- if (res.results !== undefined)
19
- gauges["resultsCount"] = res.results.length;
20
- return Object.keys(gauges).length > 0 ? gauges : undefined;
21
- },
22
- });
23
- function createHandlerOptions(operation, workspace, onProgress) {
24
- const signal = registerRagOperation(workspace, operation);
25
- const options = { signal };
26
- if (onProgress) {
27
- options.onProgress = (stage, current, total) => onProgress({
28
- type: "rag:progress",
29
- operation,
30
- workspace,
31
- stage,
32
- current,
33
- total,
34
- timestamp: Date.now(),
35
- });
36
- }
37
- return options;
38
- }
39
- function omitOnProgress(obj) {
40
- const { onProgress, withProgress, ...rest } = obj;
41
- void onProgress;
42
- void withProgress;
43
- return rest;
44
- }
45
- export async function handleRag(request, onProgress) {
46
- return profileReplyHandler({ op: "rag", request }, async () => handleRagInternal(request, onProgress));
47
- }
48
- async function handleRagInternal(request, onProgress) {
49
- switch (request.operation) {
50
- case "chunk": {
51
- const chunks = await chunk(request);
52
- return {
53
- type: "rag",
54
- operation: request.operation,
55
- success: true,
56
- chunks,
57
- };
58
- }
59
- case "ingest": {
60
- const workspace = request.workspace ?? DEFAULT_WORKSPACE;
61
- const handlerOptions = createHandlerOptions("ingest", workspace, onProgress);
62
- const params = omitOnProgress(request);
63
- try {
64
- const result = await ingest(params, handlerOptions);
1
+ import { saveEmbeddings, search, deleteEmbeddings, } from "../../bare/rag-hyperdb/index.js";
2
+ export async function handleRag(request) {
3
+ try {
4
+ switch (request.operation) {
5
+ case "saveEmbeddings": {
6
+ const result = await saveEmbeddings(request);
65
7
  return {
66
8
  type: "rag",
67
9
  operation: request.operation,
@@ -70,85 +12,56 @@ async function handleRagInternal(request, onProgress) {
70
12
  droppedIndices: result.droppedIndices,
71
13
  };
72
14
  }
73
- finally {
74
- unregisterRagOperation(workspace);
75
- }
76
- }
77
- case "saveEmbeddings": {
78
- const workspace = request.workspace ?? DEFAULT_WORKSPACE;
79
- const handlerOptions = createHandlerOptions("saveEmbeddings", workspace, onProgress);
80
- const params = omitOnProgress(request);
81
- try {
82
- const processed = await saveEmbeddings(params, handlerOptions);
15
+ case "search": {
16
+ const results = await search(request);
83
17
  return {
84
18
  type: "rag",
85
19
  operation: request.operation,
86
20
  success: true,
87
- processed,
21
+ results,
88
22
  };
89
23
  }
90
- finally {
91
- unregisterRagOperation(workspace);
92
- }
93
- }
94
- case "search": {
95
- const results = await search(request);
96
- return {
97
- type: "rag",
98
- operation: request.operation,
99
- success: true,
100
- results,
101
- };
102
- }
103
- case "deleteEmbeddings": {
104
- await deleteEmbeddings(request);
105
- return {
106
- type: "rag",
107
- operation: request.operation,
108
- success: true,
109
- };
110
- }
111
- case "reindex": {
112
- const workspace = request.workspace ?? DEFAULT_WORKSPACE;
113
- const handlerOptions = createHandlerOptions("reindex", workspace, onProgress);
114
- const params = omitOnProgress(request);
115
- try {
116
- const result = await reindex(params, handlerOptions);
24
+ case "deleteEmbeddings": {
25
+ const success = await deleteEmbeddings(request);
117
26
  return {
118
27
  type: "rag",
119
28
  operation: request.operation,
120
- success: true,
121
- result,
29
+ success,
122
30
  };
123
31
  }
124
- finally {
125
- unregisterRagOperation(workspace);
32
+ default: {
33
+ throw new Error(`Unknown RAG operation`);
126
34
  }
127
35
  }
128
- case "listWorkspaces": {
129
- const workspaces = listWorkspaces();
130
- return {
131
- type: "rag",
132
- operation: request.operation,
133
- success: true,
134
- workspaces,
135
- };
136
- }
137
- case "closeWorkspace": {
138
- await closeWorkspace(request);
139
- return {
140
- type: "rag",
141
- operation: request.operation,
142
- success: true,
143
- };
144
- }
145
- case "deleteWorkspace": {
146
- await deleteWorkspace(request);
147
- return {
148
- type: "rag",
149
- operation: request.operation,
150
- success: true,
151
- };
36
+ }
37
+ catch (error) {
38
+ console.error("Error in RAG handler:", error);
39
+ const baseError = {
40
+ type: "rag",
41
+ success: false,
42
+ error: error instanceof Error ? error.message : "Unknown error",
43
+ };
44
+ switch (request.operation) {
45
+ case "saveEmbeddings":
46
+ return {
47
+ ...baseError,
48
+ operation: request.operation,
49
+ processed: [],
50
+ droppedIndices: [],
51
+ };
52
+ case "search":
53
+ return {
54
+ ...baseError,
55
+ operation: request.operation,
56
+ results: [],
57
+ };
58
+ case "deleteEmbeddings":
59
+ return {
60
+ ...baseError,
61
+ operation: request.operation,
62
+ };
63
+ default:
64
+ throw error;
152
65
  }
153
66
  }
154
67
  }
@@ -1,20 +1,16 @@
1
- import { getSwarm, unregisterProviderTopic } from "../../bare/hyperswarm.js";
2
- import { getServerLogger } from "../../../logging/index.js";
3
- const logger = getServerLogger();
1
+ import { getSwarm } from "../../bare/hyperswarm.js";
4
2
  export function stopProvideHandler(request) {
5
3
  const swarm = getSwarm();
6
4
  try {
7
5
  const topic = Buffer.from(request.topic, "hex");
8
- const topicHex = request.topic;
9
6
  swarm.leave(topic);
10
- unregisterProviderTopic(topicHex);
11
7
  return {
12
8
  type: "stopProvide",
13
9
  success: true,
14
10
  };
15
11
  }
16
12
  catch (error) {
17
- logger.error("❌ Error in stop provide handler:", error);
13
+ console.error("❌ Error in stop provide handler:", error);
18
14
  return {
19
15
  type: "stopProvide",
20
16
  success: false,
@@ -1,4 +1,7 @@
1
- import { dispatchPluginStream } from "./plugin-dispatch.js";
1
+ import { textToSpeech } from "../../bare/addons/tts/index.js";
2
2
  export async function* handleTextToSpeech(request) {
3
- yield* dispatchPluginStream(request.modelId, "textToSpeech", request);
3
+ const stream = textToSpeech(request);
4
+ for await (const response of stream) {
5
+ yield response;
6
+ }
4
7
  }
@@ -1,4 +1,26 @@
1
- import { dispatchPluginStream } from "./plugin-dispatch.js";
1
+ import { transcribeStream } from "../../bare/addons/whispercpp/index.js";
2
2
  export async function* handleTranscribeStream(request) {
3
- yield* dispatchPluginStream(request.modelId, "transcribeStream", request);
3
+ const { modelId, audioChunk } = request;
4
+ try {
5
+ // Stream transcription results in real-time
6
+ for await (const textChunk of transcribeStream({ audioChunk, modelId })) {
7
+ yield {
8
+ type: "transcribeStream",
9
+ text: textChunk,
10
+ };
11
+ }
12
+ // Signal completion
13
+ yield {
14
+ type: "transcribeStream",
15
+ done: true,
16
+ };
17
+ }
18
+ catch (error) {
19
+ console.error("Error during transcription:", error);
20
+ yield {
21
+ type: "transcribeStream",
22
+ text: "",
23
+ error: error instanceof Error ? error.message : "Unknown error",
24
+ };
25
+ }
4
26
  }
@@ -1,4 +1,51 @@
1
- import { dispatchPluginStream } from "./plugin-dispatch.js";
1
+ import { translate } from "../../bare/addons/translation/index.js";
2
2
  export async function* handleTranslate(request) {
3
- yield* dispatchPluginStream(request.modelId, "translate", request);
3
+ const { modelId, text, stream, modelType } = request;
4
+ const from = request.modelType === "llm" ? request.from : undefined;
5
+ const to = request.modelType === "llm" ? request.to : undefined;
6
+ const context = request.modelType === "llm" ? request.context : undefined;
7
+ try {
8
+ const generator = translate({
9
+ modelId,
10
+ text,
11
+ from,
12
+ to: to,
13
+ stream,
14
+ modelType,
15
+ context,
16
+ });
17
+ let stats;
18
+ let done = false;
19
+ let buffer = "";
20
+ while (!done) {
21
+ const result = await generator.next();
22
+ if (result.done) {
23
+ stats = result.value;
24
+ done = true;
25
+ }
26
+ else {
27
+ buffer += result.value;
28
+ if (stream) {
29
+ yield {
30
+ type: "translate",
31
+ token: result.value,
32
+ };
33
+ }
34
+ }
35
+ }
36
+ yield {
37
+ type: "translate",
38
+ token: buffer,
39
+ done: true,
40
+ stats,
41
+ };
42
+ }
43
+ catch (error) {
44
+ console.error("Error during translation:", error);
45
+ yield {
46
+ type: "translate",
47
+ token: "",
48
+ error: error instanceof Error ? error.message : "Unknown error",
49
+ };
50
+ }
4
51
  }
@@ -1,25 +1,16 @@
1
- import { unloadModel } from "../../bare/ops/unload-model.js";
2
- import { getRegistryStats } from "../../bare/registry/model-registry.js";
3
- import { hasActiveProviders } from "../../bare/hyperswarm.js";
4
- import { getServerLogger } from "../../../logging/index.js";
5
- const logger = getServerLogger();
1
+ import { unloadModel } from "../../bare/addons/index.js";
6
2
  export async function handleUnloadModel(request) {
7
3
  const { modelId, clearStorage } = request;
8
4
  try {
9
- logger.debug("Unloading model", modelId);
5
+ console.log("Unloading model", modelId);
10
6
  await unloadModel({ modelId, clearStorage });
11
- const stats = getRegistryStats();
12
- const modelsActive = stats.totalModels > 0;
13
- const providersActive = hasActiveProviders();
14
7
  return {
15
8
  type: "unloadModel",
16
9
  success: true,
17
- hasActiveModels: modelsActive,
18
- hasActiveProviders: providersActive,
19
10
  };
20
11
  }
21
12
  catch (error) {
22
- logger.error("Error during model unload:", error);
13
+ console.error("Error during model unload:", error);
23
14
  return {
24
15
  type: "unloadModel",
25
16
  success: false,
@@ -1,3 +1,3 @@
1
1
  export { createBareKitRPCServer, createIPCClient } from "./create-server";
2
- export { handleRequest } from "./handle-request";
2
+ export { handleRequest, type BareRPCRequest } from "./handle-request";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,4 @@
1
1
  import { Readable } from "bare-stream";
2
- import { type AudioFormat } from "../../../schemas/index";
3
2
  export declare function needsDecoding(filePath: string): boolean;
4
- export declare function decodeAudioToStream(inputPath: string, audioFormat?: AudioFormat): Promise<Readable>;
3
+ export declare function decodeAudioToStream(inputPath: string): Promise<Readable>;
5
4
  //# sourceMappingURL=decoder.d.ts.map
@@ -1,20 +1,17 @@
1
1
  import fs from "bare-fs";
2
2
  import path from "bare-path";
3
- import { FFmpegDecoder } from "@qvac/decoder-audio";
4
- import { FORMATS_NEEDING_DECODE } from "@qvac/decoder-audio/constants.js";
3
+ import GSTDecoder from "@qvac/decoder-audio";
5
4
  import { Readable } from "bare-stream";
6
- import { getServerLogger } from "../../../logging/index.js";
7
- import {} from "../../../schemas/index.js";
8
- const logger = getServerLogger();
5
+ import { FORMATS_NEEDING_DECODE } from "../../../constants/audio.js";
9
6
  export function needsDecoding(filePath) {
10
7
  const ext = path.extname(filePath).toLowerCase();
11
8
  return FORMATS_NEEDING_DECODE.includes(ext);
12
9
  }
13
- const DECODER_TIMEOUT_MS = 10000;
14
- export async function decodeAudioToStream(inputPath, audioFormat = "s16le") {
15
- const decoder = new FFmpegDecoder({
16
- config: { audioFormat },
17
- logger,
10
+ export async function decodeAudioToStream(inputPath) {
11
+ const decoder = new GSTDecoder({
12
+ config: {
13
+ audioFormat: "encoded",
14
+ },
18
15
  });
19
16
  try {
20
17
  await decoder.load();
@@ -23,56 +20,22 @@ export async function decodeAudioToStream(inputPath, audioFormat = "s16le") {
23
20
  const outputStream = new Readable({
24
21
  read() { },
25
22
  });
26
- let hasReceivedData = false;
27
- let hasEnded = false;
28
- // Fallback timeout in case the decoder hangs without emitting any events
29
- const timeoutId = setTimeout(() => {
30
- if (!hasEnded) {
31
- hasEnded = true;
32
- const timeoutError = new Error(`Audio decoding timed out after ${DECODER_TIMEOUT_MS}ms for file: ${inputPath}`);
33
- outputStream.destroy(timeoutError);
34
- }
35
- }, DECODER_TIMEOUT_MS);
36
23
  response
37
24
  .onUpdate((output) => {
38
- hasReceivedData = true;
39
25
  const bytes = new Uint8Array(output.outputArray);
40
26
  outputStream.push(Buffer.from(bytes));
41
27
  })
42
28
  .onFinish(() => {
43
- if (!hasEnded) {
44
- hasEnded = true;
45
- clearTimeout(timeoutId);
46
- setImmediate(() => void decoder.unload());
47
- if (!hasReceivedData) {
48
- outputStream.destroy(new Error(`No audio data decoded from file: ${inputPath}`));
49
- }
50
- else {
51
- outputStream.push(null);
52
- }
53
- }
29
+ outputStream.push(null);
54
30
  })
55
- .onError((error) => {
56
- if (!hasEnded) {
57
- hasEnded = true;
58
- clearTimeout(timeoutId);
59
- setImmediate(() => void decoder.unload());
60
- outputStream.destroy(error);
61
- }
62
- });
63
- response.await().catch((error) => {
64
- if (!hasEnded) {
65
- hasEnded = true;
66
- clearTimeout(timeoutId);
67
- setImmediate(() => void decoder.unload());
68
- outputStream.destroy(error instanceof Error ? error : new Error(String(error)));
69
- }
31
+ .await()
32
+ .catch((error) => {
33
+ outputStream.destroy(error instanceof Error ? error : new Error(String(error)));
70
34
  });
71
35
  return outputStream;
72
36
  }
73
37
  catch (error) {
74
- await decoder.unload();
75
- logger.error("Decoding failed:", error instanceof Error ? error.message : String(error));
38
+ console.error("Decoding failed:", error instanceof Error ? error.message : String(error));
76
39
  throw error;
77
40
  }
78
41
  }
@@ -1,26 +1,15 @@
1
- import type { ShardFileMetadata } from "../../schemas/index";
2
- export declare function getCacheDir(subDir: string): string;
3
- export declare function getModelsCacheDir(): string;
4
- export declare function getKVCacheDir(): string;
5
- /**
6
- * Get cache directory for sharded model
7
- * Returns: cache/sharded/<hyperdriveKey>/
8
- */
9
- export declare function getShardedModelCacheDir(hyperdriveKey: string): string;
10
1
  /**
11
- * Get full path to ONNX file in cache
12
- * Returns: cache/onnx/<cacheKey>/<filename>
2
+ * Creates and returns cache directory path for the specified subdirectory
3
+ * @param subDir - Subdirectory name (e.g., "models", "kv-cache")
4
+ * @returns Full path to the cache directory
13
5
  */
14
- export declare function getOnnxModelPath(cacheKey: string, filename: string): string;
6
+ export declare function getCacheDir(subDir: string): string;
15
7
  /**
16
- * Get full path to specific shard file
17
- * Returns: cache/sharded/<hyperdriveKey>/<shardFilename>
8
+ * Legacy function for backward compatibility - gets models cache directory
18
9
  */
19
- export declare function getShardPath(hyperdriveKey: string, shardFilename: string): string;
10
+ export declare function getModelsCacheDir(): string;
20
11
  /**
21
- * Check if all shards exist and are valid (size + checksum check)
22
- * Returns array of missing/invalid shard indices (0-based)
23
- * @param onChecksumTimeMs - Optional callback to report checksum validation time
12
+ * Gets KV cache directory
24
13
  */
25
- export declare function checkShardCompleteness(hyperdriveKey: string, shardFilenames: readonly string[], shardMetadata: readonly ShardFileMetadata[], onChecksumTimeMs?: (ms: number) => void): Promise<number[]>;
14
+ export declare function getKVCacheDir(): string;
26
15
  //# sourceMappingURL=cache.d.ts.map
@@ -1,117 +1,32 @@
1
- import fs, { promises as fsPromises } from "bare-fs";
1
+ import fs from "bare-fs";
2
2
  import path from "bare-path";
3
- import { getEnv } from "../env.js";
4
- import { getConfiguredCacheDir } from "../bare/registry/config-registry.js";
5
- import { calculateFileChecksum } from "./checksum.js";
6
- import { validateAndJoinPath } from "./path-security.js";
7
- import { getServerLogger } from "../../logging/index.js";
8
- import { nowMs } from "../../profiling/index.js";
9
- const logger = getServerLogger();
3
+ import { getEnv } from "../worker.js";
4
+ /**
5
+ * Creates and returns cache directory path for the specified subdirectory
6
+ * @param subDir - Subdirectory name (e.g., "models", "kv-cache")
7
+ * @returns Full path to the cache directory
8
+ */
10
9
  export function getCacheDir(subDir) {
11
10
  const homeDir = getEnv().HOME_DIR;
12
11
  const cacheDir = path.join(homeDir, ".qvac", subDir);
12
+ // Ensure cache directory exists
13
13
  try {
14
14
  fs.mkdirSync(cacheDir, { recursive: true });
15
15
  }
16
16
  catch (error) {
17
- logger.error(`Error creating cache directory (${subDir}):`, error instanceof Error ? error.message : String(error));
17
+ console.error(`Error creating cache directory (${subDir}):`, error instanceof Error ? error.message : String(error));
18
18
  }
19
19
  return cacheDir;
20
20
  }
21
- export function getModelsCacheDir() {
22
- const configuredDir = getConfiguredCacheDir();
23
- try {
24
- fs.mkdirSync(configuredDir, { recursive: true });
25
- }
26
- catch (error) {
27
- logger.error(`Error creating models cache directory:`, error instanceof Error ? error.message : String(error));
28
- }
29
- return configuredDir;
30
- }
31
- export function getKVCacheDir() {
32
- return getCacheDir("kv-cache");
33
- }
34
- /**
35
- * Get cache directory for sharded model
36
- * Returns: cache/sharded/<hyperdriveKey>/
37
- */
38
- export function getShardedModelCacheDir(hyperdriveKey) {
39
- const baseCache = getModelsCacheDir();
40
- const shardDir = path.join(baseCache, "sharded", hyperdriveKey);
41
- try {
42
- fs.mkdirSync(shardDir, { recursive: true });
43
- }
44
- catch (error) {
45
- logger.error(`Error creating sharded model cache directory:`, error instanceof Error ? error.message : String(error));
46
- }
47
- return shardDir;
48
- }
49
- /**
50
- * Get cache directory for ONNX model with external data
51
- * Returns: cache/onnx/<cacheKey>/
52
- */
53
- function getOnnxModelCacheDir(cacheKey) {
54
- const baseCache = getModelsCacheDir();
55
- const onnxDir = validateAndJoinPath(baseCache, "onnx", cacheKey);
56
- try {
57
- fs.mkdirSync(onnxDir, { recursive: true });
58
- }
59
- catch (error) {
60
- logger.error(`Error creating ONNX model cache directory:`, error instanceof Error ? error.message : String(error));
61
- }
62
- return onnxDir;
63
- }
64
- /**
65
- * Get full path to ONNX file in cache
66
- * Returns: cache/onnx/<cacheKey>/<filename>
67
- */
68
- export function getOnnxModelPath(cacheKey, filename) {
69
- const onnxDir = getOnnxModelCacheDir(cacheKey);
70
- return validateAndJoinPath(onnxDir, filename);
71
- }
72
21
  /**
73
- * Get full path to specific shard file
74
- * Returns: cache/sharded/<hyperdriveKey>/<shardFilename>
22
+ * Legacy function for backward compatibility - gets models cache directory
75
23
  */
76
- export function getShardPath(hyperdriveKey, shardFilename) {
77
- const shardDir = getShardedModelCacheDir(hyperdriveKey);
78
- return validateAndJoinPath(shardDir, shardFilename);
24
+ export function getModelsCacheDir() {
25
+ return getCacheDir("models");
79
26
  }
80
27
  /**
81
- * Check if all shards exist and are valid (size + checksum check)
82
- * Returns array of missing/invalid shard indices (0-based)
83
- * @param onChecksumTimeMs - Optional callback to report checksum validation time
28
+ * Gets KV cache directory
84
29
  */
85
- export async function checkShardCompleteness(hyperdriveKey, shardFilenames, shardMetadata, onChecksumTimeMs) {
86
- const invalidIndices = [];
87
- for (let i = 0; i < shardFilenames.length; i++) {
88
- const shardPath = getShardPath(hyperdriveKey, shardFilenames[i]);
89
- const fileMeta = shardMetadata[i];
90
- if (!fileMeta) {
91
- invalidIndices.push(i);
92
- continue;
93
- }
94
- try {
95
- const stats = await fsPromises.stat(shardPath);
96
- if (stats.size !== fileMeta.expectedSize) {
97
- logger.warn(`File ${i + 1} size mismatch: expected ${fileMeta.expectedSize}, got ${stats.size}`);
98
- invalidIndices.push(i);
99
- continue;
100
- }
101
- if (fileMeta.sha256Checksum) {
102
- const start = nowMs();
103
- const actualChecksum = await calculateFileChecksum(shardPath);
104
- onChecksumTimeMs?.(nowMs() - start);
105
- if (actualChecksum !== fileMeta.sha256Checksum) {
106
- logger.warn(`File ${i + 1} checksum mismatch for ${fileMeta.filename}. Expected: ${fileMeta.sha256Checksum}. Actual: ${actualChecksum}. Will re-download.`);
107
- invalidIndices.push(i);
108
- }
109
- }
110
- }
111
- catch {
112
- // File doesn't exist
113
- invalidIndices.push(i);
114
- }
115
- }
116
- return invalidIndices;
30
+ export function getKVCacheDir() {
31
+ return getCacheDir("kv-cache");
117
32
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Generate a short hash (16 characters) from any input string
3
+ */
4
+ export declare function generateShortHash(input: string): string;
5
+ //# sourceMappingURL=hash.d.ts.map
@@ -0,0 +1,11 @@
1
+ import crypto from "bare-crypto";
2
+ /**
3
+ * Generate a short hash (16 characters) from any input string
4
+ */
5
+ export function generateShortHash(input) {
6
+ const hash = crypto
7
+ .createHash("sha256")
8
+ .update(Buffer.from(input, "utf8"))
9
+ .digest("hex");
10
+ return hash.substring(0, 16);
11
+ }
@@ -1,10 +1,5 @@
1
- export * from "./archive";
1
+ export * from "./audio/decoder";
2
2
  export * from "./cache";
3
- export * from "./checksum";
4
- export * from "./config-transform";
5
- export * from "./formatting";
6
- export * from "./gguf-tensor-extractor";
3
+ export * from "./hash";
7
4
  export * from "./model-path";
8
- export * from "./path-security";
9
- export * from "./shard-utils";
10
5
  //# sourceMappingURL=index.d.ts.map
@@ -1,9 +1,4 @@
1
- export * from "./archive.js";
1
+ export * from "./audio/decoder.js";
2
2
  export * from "./cache.js";
3
- export * from "./checksum.js";
4
- export * from "./config-transform.js";
5
- export * from "./formatting.js";
6
- export * from "./gguf-tensor-extractor.js";
3
+ export * from "./hash.js";
7
4
  export * from "./model-path.js";
8
- export * from "./path-security.js";
9
- export * from "./shard-utils.js";