@qvac/core 0.0.0 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (586) hide show
  1. package/LICENSE.md +198 -0
  2. package/NOTICE.md +13 -0
  3. package/README.md +694 -0
  4. package/SECURITY.md +6 -0
  5. package/dist/assistant.bundle +47256 -0
  6. package/dist/assistant.cjs +18 -0
  7. package/dist/assistant.d.ts +8 -0
  8. package/dist/prebuilds-manifest.json +380 -0
  9. package/dist-lib/client.d.ts +2 -0
  10. package/dist-lib/client.js +1 -0
  11. package/dist-lib/index.d.ts +13 -0
  12. package/dist-lib/index.js +10 -0
  13. package/dist-lib/lib/agent-icons.d.ts +3 -0
  14. package/dist-lib/lib/agent-icons.js +1 -0
  15. package/dist-lib/lib/api/agents.d.ts +5 -0
  16. package/dist-lib/lib/api/agents.js +38 -0
  17. package/dist-lib/lib/api/app-config.d.ts +5 -0
  18. package/dist-lib/lib/api/app-config.js +108 -0
  19. package/dist-lib/lib/api/approval-rules.d.ts +3 -0
  20. package/dist-lib/lib/api/approval-rules.js +9 -0
  21. package/dist-lib/lib/api/attachments.d.ts +8 -0
  22. package/dist-lib/lib/api/attachments.js +15 -0
  23. package/dist-lib/lib/api/chat-groups.d.ts +5 -0
  24. package/dist-lib/lib/api/chat-groups.js +12 -0
  25. package/dist-lib/lib/api/chat.d.ts +5 -0
  26. package/dist-lib/lib/api/chat.js +38 -0
  27. package/dist-lib/lib/api/chunks.d.ts +5 -0
  28. package/dist-lib/lib/api/chunks.js +61 -0
  29. package/dist-lib/lib/api/config.d.ts +5 -0
  30. package/dist-lib/lib/api/config.js +15 -0
  31. package/dist-lib/lib/api/current-mesh.d.ts +5 -0
  32. package/dist-lib/lib/api/current-mesh.js +12 -0
  33. package/dist-lib/lib/api/custom-models.d.ts +5 -0
  34. package/dist-lib/lib/api/custom-models.js +45 -0
  35. package/dist-lib/lib/api/devices.d.ts +8 -0
  36. package/dist-lib/lib/api/devices.js +125 -0
  37. package/dist-lib/lib/api/diagnostics.d.ts +7 -0
  38. package/dist-lib/lib/api/diagnostics.js +7 -0
  39. package/dist-lib/lib/api/effective-ctx-size.d.ts +2 -0
  40. package/dist-lib/lib/api/effective-ctx-size.js +10 -0
  41. package/dist-lib/lib/api/execution.d.ts +3 -0
  42. package/dist-lib/lib/api/execution.js +45 -0
  43. package/dist-lib/lib/api/files.d.ts +3 -0
  44. package/dist-lib/lib/api/files.js +48 -0
  45. package/dist-lib/lib/api/index.d.ts +62 -0
  46. package/dist-lib/lib/api/index.js +172 -0
  47. package/dist-lib/lib/api/instrument.d.ts +2 -0
  48. package/dist-lib/lib/api/instrument.js +86 -0
  49. package/dist-lib/lib/api/knowledge.d.ts +8 -0
  50. package/dist-lib/lib/api/knowledge.js +26 -0
  51. package/dist-lib/lib/api/logs.d.ts +14 -0
  52. package/dist-lib/lib/api/logs.js +116 -0
  53. package/dist-lib/lib/api/mesh.d.ts +13 -0
  54. package/dist-lib/lib/api/mesh.js +25 -0
  55. package/dist-lib/lib/api/model-download.d.ts +5 -0
  56. package/dist-lib/lib/api/model-download.js +47 -0
  57. package/dist-lib/lib/api/network.d.ts +8 -0
  58. package/dist-lib/lib/api/network.js +6 -0
  59. package/dist-lib/lib/api/notifications.d.ts +21 -0
  60. package/dist-lib/lib/api/notifications.js +108 -0
  61. package/dist-lib/lib/api/rag.d.ts +7 -0
  62. package/dist-lib/lib/api/rag.js +216 -0
  63. package/dist-lib/lib/api/sync.d.ts +3 -0
  64. package/dist-lib/lib/api/sync.js +6 -0
  65. package/dist-lib/lib/api/tool-activity.d.ts +5 -0
  66. package/dist-lib/lib/api/tool-activity.js +53 -0
  67. package/dist-lib/lib/api/tool-configs.d.ts +6 -0
  68. package/dist-lib/lib/api/tool-configs.js +27 -0
  69. package/dist-lib/lib/api/watchable.d.ts +12 -0
  70. package/dist-lib/lib/api/watchable.js +121 -0
  71. package/dist-lib/lib/assistant-client.d.ts +21 -0
  72. package/dist-lib/lib/assistant-client.js +52 -0
  73. package/dist-lib/lib/assistant-tree.d.ts +50 -0
  74. package/dist-lib/lib/assistant-tree.js +184 -0
  75. package/dist-lib/lib/assistant.d.ts +425 -0
  76. package/dist-lib/lib/assistant.js +2706 -0
  77. package/dist-lib/lib/audio-format.d.ts +4 -0
  78. package/dist-lib/lib/audio-format.js +4 -0
  79. package/dist-lib/lib/chat-title.d.ts +5 -0
  80. package/dist-lib/lib/chat-title.js +58 -0
  81. package/dist-lib/lib/client.d.ts +25 -0
  82. package/dist-lib/lib/client.js +53 -0
  83. package/dist-lib/lib/collabora/convert.d.ts +9 -0
  84. package/dist-lib/lib/collabora/convert.js +62 -0
  85. package/dist-lib/lib/collabora/entry.d.ts +1 -0
  86. package/dist-lib/lib/collabora/entry.js +44 -0
  87. package/dist-lib/lib/collabora/protocol.d.ts +15 -0
  88. package/dist-lib/lib/collabora/protocol.js +24 -0
  89. package/dist-lib/lib/collabora/worker.d.ts +5 -0
  90. package/dist-lib/lib/collabora/worker.js +111 -0
  91. package/dist-lib/lib/compaction.d.ts +30 -0
  92. package/dist-lib/lib/compaction.js +95 -0
  93. package/dist-lib/lib/constants.d.ts +4 -0
  94. package/dist-lib/lib/constants.js +4 -0
  95. package/dist-lib/lib/core/agent.d.ts +15 -0
  96. package/dist-lib/lib/core/agent.js +149 -0
  97. package/dist-lib/lib/core/app-build.d.ts +7 -0
  98. package/dist-lib/lib/core/app-build.js +1 -0
  99. package/dist-lib/lib/core/approval-rules.d.ts +15 -0
  100. package/dist-lib/lib/core/approval-rules.js +41 -0
  101. package/dist-lib/lib/core/async-iterable.d.ts +13 -0
  102. package/dist-lib/lib/core/async-iterable.js +65 -0
  103. package/dist-lib/lib/core/attachment-link.d.ts +7 -0
  104. package/dist-lib/lib/core/attachment-link.js +6 -0
  105. package/dist-lib/lib/core/audio-attachment.d.ts +1 -0
  106. package/dist-lib/lib/core/audio-attachment.js +4 -0
  107. package/dist-lib/lib/core/blind-peers.d.ts +6 -0
  108. package/dist-lib/lib/core/blind-peers.js +13 -0
  109. package/dist-lib/lib/core/chat-activity.d.ts +7 -0
  110. package/dist-lib/lib/core/chat-activity.js +244 -0
  111. package/dist-lib/lib/core/chat-group.d.ts +14 -0
  112. package/dist-lib/lib/core/chat-group.js +79 -0
  113. package/dist-lib/lib/core/chat-search.d.ts +17 -0
  114. package/dist-lib/lib/core/chat-search.js +199 -0
  115. package/dist-lib/lib/core/chat.d.ts +37 -0
  116. package/dist-lib/lib/core/chat.js +196 -0
  117. package/dist-lib/lib/core/chunk.d.ts +61 -0
  118. package/dist-lib/lib/core/chunk.js +212 -0
  119. package/dist-lib/lib/core/contract/activity.d.ts +11 -0
  120. package/dist-lib/lib/core/contract/activity.js +45 -0
  121. package/dist-lib/lib/core/contract/agents.d.ts +2 -0
  122. package/dist-lib/lib/core/contract/agents.js +29 -0
  123. package/dist-lib/lib/core/contract/approval-rules.d.ts +2 -0
  124. package/dist-lib/lib/core/contract/approval-rules.js +14 -0
  125. package/dist-lib/lib/core/contract/attestations.d.ts +2 -0
  126. package/dist-lib/lib/core/contract/attestations.js +14 -0
  127. package/dist-lib/lib/core/contract/chat-group.d.ts +2 -0
  128. package/dist-lib/lib/core/contract/chat-group.js +20 -0
  129. package/dist-lib/lib/core/contract/chat.d.ts +2 -0
  130. package/dist-lib/lib/core/contract/chat.js +18 -0
  131. package/dist-lib/lib/core/contract/chunks.d.ts +2 -0
  132. package/dist-lib/lib/core/contract/chunks.js +156 -0
  133. package/dist-lib/lib/core/contract/devices.d.ts +2 -0
  134. package/dist-lib/lib/core/contract/devices.js +110 -0
  135. package/dist-lib/lib/core/contract/index.d.ts +2 -0
  136. package/dist-lib/lib/core/contract/index.js +30 -0
  137. package/dist-lib/lib/core/contract/indexing.d.ts +4 -0
  138. package/dist-lib/lib/core/contract/indexing.js +82 -0
  139. package/dist-lib/lib/core/contract/knowledge.d.ts +2 -0
  140. package/dist-lib/lib/core/contract/knowledge.js +55 -0
  141. package/dist-lib/lib/core/contract/members.d.ts +2 -0
  142. package/dist-lib/lib/core/contract/members.js +96 -0
  143. package/dist-lib/lib/core/contract/seed-defaults.d.ts +2 -0
  144. package/dist-lib/lib/core/contract/seed-defaults.js +29 -0
  145. package/dist-lib/lib/core/contract/tool-activity.d.ts +2 -0
  146. package/dist-lib/lib/core/contract/tool-activity.js +25 -0
  147. package/dist-lib/lib/core/contract/tool-configs.d.ts +2 -0
  148. package/dist-lib/lib/core/contract/tool-configs.js +50 -0
  149. package/dist-lib/lib/core/contract/types.d.ts +11 -0
  150. package/dist-lib/lib/core/contract/types.js +1 -0
  151. package/dist-lib/lib/core/contract/writers.d.ts +2 -0
  152. package/dist-lib/lib/core/contract/writers.js +112 -0
  153. package/dist-lib/lib/core/cpu-info-node.d.ts +3 -0
  154. package/dist-lib/lib/core/cpu-info-node.js +2 -0
  155. package/dist-lib/lib/core/departures.d.ts +41 -0
  156. package/dist-lib/lib/core/departures.js +145 -0
  157. package/dist-lib/lib/core/device-attestation.d.ts +6 -0
  158. package/dist-lib/lib/core/device-attestation.js +12 -0
  159. package/dist-lib/lib/core/devices.d.ts +14 -0
  160. package/dist-lib/lib/core/devices.js +11 -0
  161. package/dist-lib/lib/core/document-attachment.d.ts +22 -0
  162. package/dist-lib/lib/core/document-attachment.js +35 -0
  163. package/dist-lib/lib/core/files/attachments.d.ts +8 -0
  164. package/dist-lib/lib/core/files/attachments.js +50 -0
  165. package/dist-lib/lib/core/files/index.d.ts +133 -0
  166. package/dist-lib/lib/core/files/index.js +585 -0
  167. package/dist-lib/lib/core/files/knowledge.d.ts +9 -0
  168. package/dist-lib/lib/core/files/knowledge.js +31 -0
  169. package/dist-lib/lib/core/files/preview/image.d.ts +4 -0
  170. package/dist-lib/lib/core/files/preview/image.js +42 -0
  171. package/dist-lib/lib/core/files/preview/index.d.ts +33 -0
  172. package/dist-lib/lib/core/files/preview/index.js +161 -0
  173. package/dist-lib/lib/core/files/processing/claims.d.ts +26 -0
  174. package/dist-lib/lib/core/files/processing/claims.js +89 -0
  175. package/dist-lib/lib/core/files/processing/document.d.ts +100 -0
  176. package/dist-lib/lib/core/files/processing/document.js +101 -0
  177. package/dist-lib/lib/core/files/processing/index.d.ts +75 -0
  178. package/dist-lib/lib/core/files/processing/index.js +295 -0
  179. package/dist-lib/lib/core/files/processing/ownership.d.ts +11 -0
  180. package/dist-lib/lib/core/files/processing/ownership.js +41 -0
  181. package/dist-lib/lib/core/files/processing/protocol.d.ts +29 -0
  182. package/dist-lib/lib/core/files/processing/protocol.js +70 -0
  183. package/dist-lib/lib/core/files/processing/settle.d.ts +10 -0
  184. package/dist-lib/lib/core/files/processing/settle.js +75 -0
  185. package/dist-lib/lib/core/files/processing/source.d.ts +36 -0
  186. package/dist-lib/lib/core/files/processing/source.js +96 -0
  187. package/dist-lib/lib/core/files/processing/state.d.ts +64 -0
  188. package/dist-lib/lib/core/files/processing/state.js +118 -0
  189. package/dist-lib/lib/core/files/rag/artifact/codec.d.ts +3 -0
  190. package/dist-lib/lib/core/files/rag/artifact/codec.js +172 -0
  191. package/dist-lib/lib/core/files/rag/artifact/id.d.ts +10 -0
  192. package/dist-lib/lib/core/files/rag/artifact/id.js +39 -0
  193. package/dist-lib/lib/core/files/rag/artifact/types.d.ts +24 -0
  194. package/dist-lib/lib/core/files/rag/artifact/types.js +41 -0
  195. package/dist-lib/lib/core/files/rag/build.d.ts +25 -0
  196. package/dist-lib/lib/core/files/rag/build.js +60 -0
  197. package/dist-lib/lib/core/files/rag/chunk/chunking.d.ts +12 -0
  198. package/dist-lib/lib/core/files/rag/chunk/chunking.js +117 -0
  199. package/dist-lib/lib/core/files/rag/chunk/metadata.d.ts +30 -0
  200. package/dist-lib/lib/core/files/rag/chunk/metadata.js +89 -0
  201. package/dist-lib/lib/core/files/rag/chunk/tokenizer.d.ts +7 -0
  202. package/dist-lib/lib/core/files/rag/chunk/tokenizer.js +18 -0
  203. package/dist-lib/lib/core/files/rag/document-types.d.ts +11 -0
  204. package/dist-lib/lib/core/files/rag/document-types.js +94 -0
  205. package/dist-lib/lib/core/files/rag/extract/csv-text.d.ts +1 -0
  206. package/dist-lib/lib/core/files/rag/extract/csv-text.js +117 -0
  207. package/dist-lib/lib/core/files/rag/extract/document-types.d.ts +22 -0
  208. package/dist-lib/lib/core/files/rag/extract/document-types.js +152 -0
  209. package/dist-lib/lib/core/files/rag/extract/extract.d.ts +17 -0
  210. package/dist-lib/lib/core/files/rag/extract/extract.js +81 -0
  211. package/dist-lib/lib/core/files/rag/extract/html-table-text.d.ts +1 -0
  212. package/dist-lib/lib/core/files/rag/extract/html-table-text.js +125 -0
  213. package/dist-lib/lib/core/files/rag/extract/html-text.d.ts +1 -0
  214. package/dist-lib/lib/core/files/rag/extract/html-text.js +132 -0
  215. package/dist-lib/lib/core/files/rag/extract/office-collabora.d.ts +2 -0
  216. package/dist-lib/lib/core/files/rag/extract/office-collabora.js +8 -0
  217. package/dist-lib/lib/core/files/rag/extract/pdf-platform.d.ts +17 -0
  218. package/dist-lib/lib/core/files/rag/extract/pdf-platform.js +141 -0
  219. package/dist-lib/lib/core/files/rag/extract/pdf-text.d.ts +12 -0
  220. package/dist-lib/lib/core/files/rag/extract/pdf-text.js +43 -0
  221. package/dist-lib/lib/core/files/rag/extract/rtf-text.d.ts +1 -0
  222. package/dist-lib/lib/core/files/rag/extract/rtf-text.js +15 -0
  223. package/dist-lib/lib/core/files/rag/extract/text-decoding.d.ts +1 -0
  224. package/dist-lib/lib/core/files/rag/extract/text-decoding.js +91 -0
  225. package/dist-lib/lib/core/files/rag/extract/types.d.ts +36 -0
  226. package/dist-lib/lib/core/files/rag/extract/types.js +12 -0
  227. package/dist-lib/lib/core/files/rag/extract/utf.d.ts +2 -0
  228. package/dist-lib/lib/core/files/rag/extract/utf.js +18 -0
  229. package/dist-lib/lib/core/files/rag/index.d.ts +54 -0
  230. package/dist-lib/lib/core/files/rag/index.js +79 -0
  231. package/dist-lib/lib/core/files/rag/limits.d.ts +2 -0
  232. package/dist-lib/lib/core/files/rag/limits.js +2 -0
  233. package/dist-lib/lib/core/files/rag/load.d.ts +28 -0
  234. package/dist-lib/lib/core/files/rag/load.js +250 -0
  235. package/dist-lib/lib/core/files/rag/models.d.ts +1 -0
  236. package/dist-lib/lib/core/files/rag/models.js +1 -0
  237. package/dist-lib/lib/core/files/rag/policy.d.ts +2 -0
  238. package/dist-lib/lib/core/files/rag/policy.js +23 -0
  239. package/dist-lib/lib/core/files/rag/produce.d.ts +21 -0
  240. package/dist-lib/lib/core/files/rag/produce.js +214 -0
  241. package/dist-lib/lib/core/files/rag/retrieval/citation-match.d.ts +2 -0
  242. package/dist-lib/lib/core/files/rag/retrieval/citation-match.js +16 -0
  243. package/dist-lib/lib/core/files/rag/retrieval/coverage.d.ts +4 -0
  244. package/dist-lib/lib/core/files/rag/retrieval/coverage.js +48 -0
  245. package/dist-lib/lib/core/files/rag/retrieval/diversity.d.ts +10 -0
  246. package/dist-lib/lib/core/files/rag/retrieval/diversity.js +37 -0
  247. package/dist-lib/lib/core/files/rag/retrieval/floor.d.ts +5 -0
  248. package/dist-lib/lib/core/files/rag/retrieval/floor.js +21 -0
  249. package/dist-lib/lib/core/files/rag/retrieval/format.d.ts +6 -0
  250. package/dist-lib/lib/core/files/rag/retrieval/format.js +21 -0
  251. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +22 -0
  252. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +137 -0
  253. package/dist-lib/lib/core/files/rag/retrieval/knowledge.d.ts +2 -0
  254. package/dist-lib/lib/core/files/rag/retrieval/knowledge.js +53 -0
  255. package/dist-lib/lib/core/files/rag/retrieval/notices.d.ts +16 -0
  256. package/dist-lib/lib/core/files/rag/retrieval/notices.js +27 -0
  257. package/dist-lib/lib/core/files/rag/retrieval/scoring.d.ts +8 -0
  258. package/dist-lib/lib/core/files/rag/retrieval/scoring.js +82 -0
  259. package/dist-lib/lib/core/files/rag/retrieval/search.d.ts +3 -0
  260. package/dist-lib/lib/core/files/rag/retrieval/search.js +46 -0
  261. package/dist-lib/lib/core/files/rag/retrieval/selection.d.ts +10 -0
  262. package/dist-lib/lib/core/files/rag/retrieval/selection.js +63 -0
  263. package/dist-lib/lib/core/files/rag/retrieval/source-tag-filter.d.ts +6 -0
  264. package/dist-lib/lib/core/files/rag/retrieval/source-tag-filter.js +79 -0
  265. package/dist-lib/lib/core/files/rag/retrieval/sources.d.ts +13 -0
  266. package/dist-lib/lib/core/files/rag/retrieval/sources.js +20 -0
  267. package/dist-lib/lib/core/files/rag/retrieval/target.d.ts +13 -0
  268. package/dist-lib/lib/core/files/rag/retrieval/target.js +89 -0
  269. package/dist-lib/lib/core/files/rag/retrieval/terms.d.ts +8 -0
  270. package/dist-lib/lib/core/files/rag/retrieval/terms.js +70 -0
  271. package/dist-lib/lib/core/files/rag/retrieval/types.d.ts +28 -0
  272. package/dist-lib/lib/core/files/rag/retrieval/types.js +1 -0
  273. package/dist-lib/lib/core/files/rag/retrieval/web-sources.d.ts +8 -0
  274. package/dist-lib/lib/core/files/rag/retrieval/web-sources.js +41 -0
  275. package/dist-lib/lib/core/files/rag/retrieval/whole-document-query.d.ts +1 -0
  276. package/dist-lib/lib/core/files/rag/retrieval/whole-document-query.js +96 -0
  277. package/dist-lib/lib/core/files/rag/vector/memory.d.ts +15 -0
  278. package/dist-lib/lib/core/files/rag/vector/memory.js +135 -0
  279. package/dist-lib/lib/core/files/rag/vector/types.d.ts +28 -0
  280. package/dist-lib/lib/core/files/rag/vector/types.js +1 -0
  281. package/dist-lib/lib/core/files/records/chunks.d.ts +3 -0
  282. package/dist-lib/lib/core/files/records/chunks.js +12 -0
  283. package/dist-lib/lib/core/files/records/index.d.ts +10 -0
  284. package/dist-lib/lib/core/files/records/index.js +8 -0
  285. package/dist-lib/lib/core/files/records/knowledge.d.ts +22 -0
  286. package/dist-lib/lib/core/files/records/knowledge.js +105 -0
  287. package/dist-lib/lib/core/files/records/linkage.d.ts +11 -0
  288. package/dist-lib/lib/core/files/records/linkage.js +27 -0
  289. package/dist-lib/lib/core/files/records/output.d.ts +8 -0
  290. package/dist-lib/lib/core/files/records/output.js +38 -0
  291. package/dist-lib/lib/core/files/records/reclaim.d.ts +5 -0
  292. package/dist-lib/lib/core/files/records/reclaim.js +73 -0
  293. package/dist-lib/lib/core/files/records/routing.d.ts +23 -0
  294. package/dist-lib/lib/core/files/records/routing.js +62 -0
  295. package/dist-lib/lib/core/files/records/source.d.ts +16 -0
  296. package/dist-lib/lib/core/files/records/source.js +70 -0
  297. package/dist-lib/lib/core/files/records/sweep.d.ts +2 -0
  298. package/dist-lib/lib/core/files/records/sweep.js +30 -0
  299. package/dist-lib/lib/core/files/store/blob.d.ts +29 -0
  300. package/dist-lib/lib/core/files/store/blob.js +98 -0
  301. package/dist-lib/lib/core/files/store/index.d.ts +36 -0
  302. package/dist-lib/lib/core/files/store/index.js +89 -0
  303. package/dist-lib/lib/core/files/store/inline.d.ts +8 -0
  304. package/dist-lib/lib/core/files/store/inline.js +38 -0
  305. package/dist-lib/lib/core/files/store/reference.d.ts +27 -0
  306. package/dist-lib/lib/core/files/store/reference.js +168 -0
  307. package/dist-lib/lib/core/files/store/server.d.ts +27 -0
  308. package/dist-lib/lib/core/files/store/server.js +114 -0
  309. package/dist-lib/lib/core/files/store/sweep.d.ts +2 -0
  310. package/dist-lib/lib/core/files/store/sweep.js +45 -0
  311. package/dist-lib/lib/core/files/upload-input.d.ts +27 -0
  312. package/dist-lib/lib/core/files/upload-input.js +52 -0
  313. package/dist-lib/lib/core/files/upload.d.ts +32 -0
  314. package/dist-lib/lib/core/files/upload.js +201 -0
  315. package/dist-lib/lib/core/fs-drives.d.ts +18 -0
  316. package/dist-lib/lib/core/fs-drives.js +58 -0
  317. package/dist-lib/lib/core/gpu-info-node.d.ts +3 -0
  318. package/dist-lib/lib/core/gpu-info-node.js +2 -0
  319. package/dist-lib/lib/core/handoff-channel.d.ts +46 -0
  320. package/dist-lib/lib/core/handoff-channel.js +102 -0
  321. package/dist-lib/lib/core/health-assistant.d.ts +7 -0
  322. package/dist-lib/lib/core/health-assistant.js +24 -0
  323. package/dist-lib/lib/core/helpers/index.d.ts +5 -0
  324. package/dist-lib/lib/core/helpers/index.js +74 -0
  325. package/dist-lib/lib/core/hosted-agents.d.ts +36 -0
  326. package/dist-lib/lib/core/hosted-agents.js +127 -0
  327. package/dist-lib/lib/core/id.d.ts +1 -0
  328. package/dist-lib/lib/core/id.js +5 -0
  329. package/dist-lib/lib/core/identity.d.ts +14 -0
  330. package/dist-lib/lib/core/identity.js +45 -0
  331. package/dist-lib/lib/core/image/cache-sweep.d.ts +12 -0
  332. package/dist-lib/lib/core/image/cache-sweep.js +67 -0
  333. package/dist-lib/lib/core/image/normalize.d.ts +3 -0
  334. package/dist-lib/lib/core/image/normalize.js +49 -0
  335. package/dist-lib/lib/core/image/sniff.d.ts +3 -0
  336. package/dist-lib/lib/core/image/sniff.js +149 -0
  337. package/dist-lib/lib/core/invite.d.ts +14 -0
  338. package/dist-lib/lib/core/invite.js +36 -0
  339. package/dist-lib/lib/core/local/index.d.ts +71 -0
  340. package/dist-lib/lib/core/local/index.js +391 -0
  341. package/dist-lib/lib/core/membership.d.ts +15 -0
  342. package/dist-lib/lib/core/membership.js +40 -0
  343. package/dist-lib/lib/core/mesh.d.ts +153 -0
  344. package/dist-lib/lib/core/mesh.js +509 -0
  345. package/dist-lib/lib/core/migrations/agent-catalog.d.ts +6 -0
  346. package/dist-lib/lib/core/migrations/agent-catalog.js +17 -0
  347. package/dist-lib/lib/core/migrations/index.d.ts +5 -0
  348. package/dist-lib/lib/core/migrations/index.js +7 -0
  349. package/dist-lib/lib/core/migrations/membership.d.ts +11 -0
  350. package/dist-lib/lib/core/migrations/membership.js +26 -0
  351. package/dist-lib/lib/core/min-version.d.ts +6 -0
  352. package/dist-lib/lib/core/min-version.js +31 -0
  353. package/dist-lib/lib/core/next-frame.d.ts +6 -0
  354. package/dist-lib/lib/core/next-frame.js +27 -0
  355. package/dist-lib/lib/core/notification.d.ts +6 -0
  356. package/dist-lib/lib/core/notification.js +162 -0
  357. package/dist-lib/lib/core/ota-config.d.ts +19 -0
  358. package/dist-lib/lib/core/ota-config.js +44 -0
  359. package/dist-lib/lib/core/prompt-history.d.ts +12 -0
  360. package/dist-lib/lib/core/prompt-history.js +40 -0
  361. package/dist-lib/lib/core/search-fold.d.ts +1 -0
  362. package/dist-lib/lib/core/search-fold.js +4 -0
  363. package/dist-lib/lib/core/secret-handoff.d.ts +17 -0
  364. package/dist-lib/lib/core/secret-handoff.js +29 -0
  365. package/dist-lib/lib/core/send.d.ts +18 -0
  366. package/dist-lib/lib/core/send.js +46 -0
  367. package/dist-lib/lib/core/skill-overlay-handoff.d.ts +25 -0
  368. package/dist-lib/lib/core/skill-overlay-handoff.js +50 -0
  369. package/dist-lib/lib/core/skill-overlay-receiver.d.ts +8 -0
  370. package/dist-lib/lib/core/skill-overlay-receiver.js +20 -0
  371. package/dist-lib/lib/core/skill-secrets.d.ts +25 -0
  372. package/dist-lib/lib/core/skill-secrets.js +79 -0
  373. package/dist-lib/lib/core/sync/chats.d.ts +3 -0
  374. package/dist-lib/lib/core/sync/chats.js +5 -0
  375. package/dist-lib/lib/core/sync/chunks.d.ts +9 -0
  376. package/dist-lib/lib/core/sync/chunks.js +16 -0
  377. package/dist-lib/lib/core/sync/devices.d.ts +4 -0
  378. package/dist-lib/lib/core/sync/devices.js +12 -0
  379. package/dist-lib/lib/core/sync/files.d.ts +16 -0
  380. package/dist-lib/lib/core/sync/files.js +109 -0
  381. package/dist-lib/lib/core/sync/index.d.ts +5 -0
  382. package/dist-lib/lib/core/sync/index.js +63 -0
  383. package/dist-lib/lib/core/sync-status.d.ts +17 -0
  384. package/dist-lib/lib/core/sync-status.js +129 -0
  385. package/dist-lib/lib/core/system-info.d.ts +24 -0
  386. package/dist-lib/lib/core/system-info.js +66 -0
  387. package/dist-lib/lib/core/tool-activity.d.ts +22 -0
  388. package/dist-lib/lib/core/tool-activity.js +39 -0
  389. package/dist-lib/lib/core/tool-configs.d.ts +13 -0
  390. package/dist-lib/lib/core/tool-configs.js +141 -0
  391. package/dist-lib/lib/core.d.ts +291 -0
  392. package/dist-lib/lib/core.js +2126 -0
  393. package/dist-lib/lib/credential-pusher.d.ts +67 -0
  394. package/dist-lib/lib/credential-pusher.js +290 -0
  395. package/dist-lib/lib/custom-model-pusher.d.ts +9 -0
  396. package/dist-lib/lib/custom-model-pusher.js +42 -0
  397. package/dist-lib/lib/custom-model-source.d.ts +15 -0
  398. package/dist-lib/lib/custom-model-source.js +46 -0
  399. package/dist-lib/lib/deadline.d.ts +9 -0
  400. package/dist-lib/lib/deadline.js +31 -0
  401. package/dist-lib/lib/diagnostics.d.ts +35 -0
  402. package/dist-lib/lib/diagnostics.js +14 -0
  403. package/dist-lib/lib/fetch-node.d.ts +1 -0
  404. package/dist-lib/lib/fetch-node.js +1 -0
  405. package/dist-lib/lib/fs-drive-bridge.d.ts +12 -0
  406. package/dist-lib/lib/fs-drive-bridge.js +186 -0
  407. package/dist-lib/lib/fs-grant-keys.d.ts +2 -0
  408. package/dist-lib/lib/fs-grant-keys.js +6 -0
  409. package/dist-lib/lib/fs-grants.d.ts +10 -0
  410. package/dist-lib/lib/fs-grants.js +44 -0
  411. package/dist-lib/lib/image-cache-dir.d.ts +1 -0
  412. package/dist-lib/lib/image-cache-dir.js +5 -0
  413. package/dist-lib/lib/integrations/index.d.ts +4 -0
  414. package/dist-lib/lib/integrations/index.js +3 -0
  415. package/dist-lib/lib/integrations/mcp-providers.d.ts +12 -0
  416. package/dist-lib/lib/integrations/mcp-providers.js +22 -0
  417. package/dist-lib/lib/integrations/oauth-providers.d.ts +14 -0
  418. package/dist-lib/lib/integrations/oauth-providers.js +116 -0
  419. package/dist-lib/lib/integrations/setup-routes.d.ts +12 -0
  420. package/dist-lib/lib/integrations/setup-routes.js +114 -0
  421. package/dist-lib/lib/knowledge-search.d.ts +7 -0
  422. package/dist-lib/lib/knowledge-search.js +53 -0
  423. package/dist-lib/lib/kv-cache-reclaim.d.ts +5 -0
  424. package/dist-lib/lib/kv-cache-reclaim.js +29 -0
  425. package/dist-lib/lib/kv-cache.d.ts +18 -0
  426. package/dist-lib/lib/kv-cache.js +33 -0
  427. package/dist-lib/lib/legacy-core-domain.d.ts +258 -0
  428. package/dist-lib/lib/legacy-core-domain.js +1 -0
  429. package/dist-lib/lib/llm-model-names.d.ts +1 -0
  430. package/dist-lib/lib/llm-model-names.js +1 -0
  431. package/dist-lib/lib/log-buffer.d.ts +7 -0
  432. package/dist-lib/lib/log-buffer.js +16 -0
  433. package/dist-lib/lib/log-levels.d.ts +7 -0
  434. package/dist-lib/lib/log-levels.js +1 -0
  435. package/dist-lib/lib/log.d.ts +60 -0
  436. package/dist-lib/lib/log.js +149 -0
  437. package/dist-lib/lib/logger-type.d.ts +13 -0
  438. package/dist-lib/lib/logger-type.js +1 -0
  439. package/dist-lib/lib/logger.d.ts +5 -0
  440. package/dist-lib/lib/logger.js +18 -0
  441. package/dist-lib/lib/model-catalog-revision.d.ts +9 -0
  442. package/dist-lib/lib/model-catalog-revision.js +65 -0
  443. package/dist-lib/lib/model-clamp.d.ts +6 -0
  444. package/dist-lib/lib/model-clamp.js +20 -0
  445. package/dist-lib/lib/model-context.d.ts +13 -0
  446. package/dist-lib/lib/model-context.js +71 -0
  447. package/dist-lib/lib/model-download-status.d.ts +29 -0
  448. package/dist-lib/lib/model-download-status.js +56 -0
  449. package/dist-lib/lib/model-download.d.ts +191 -0
  450. package/dist-lib/lib/model-download.js +787 -0
  451. package/dist-lib/lib/oauth/asana.d.ts +35 -0
  452. package/dist-lib/lib/oauth/asana.js +71 -0
  453. package/dist-lib/lib/oauth/browser-connect.d.ts +22 -0
  454. package/dist-lib/lib/oauth/browser-connect.js +83 -0
  455. package/dist-lib/lib/oauth/client.d.ts +9 -0
  456. package/dist-lib/lib/oauth/client.js +9 -0
  457. package/dist-lib/lib/oauth/common.d.ts +38 -0
  458. package/dist-lib/lib/oauth/common.js +36 -0
  459. package/dist-lib/lib/oauth/crypto.d.ts +3 -0
  460. package/dist-lib/lib/oauth/crypto.js +25 -0
  461. package/dist-lib/lib/oauth/fetch-platform.d.ts +1 -0
  462. package/dist-lib/lib/oauth/fetch-platform.js +1 -0
  463. package/dist-lib/lib/oauth/flow-core.d.ts +6 -0
  464. package/dist-lib/lib/oauth/flow-core.js +37 -0
  465. package/dist-lib/lib/oauth/flow.d.ts +3 -0
  466. package/dist-lib/lib/oauth/flow.js +24 -0
  467. package/dist-lib/lib/oauth/google.d.ts +37 -0
  468. package/dist-lib/lib/oauth/google.js +77 -0
  469. package/dist-lib/lib/oauth/host.d.ts +5 -0
  470. package/dist-lib/lib/oauth/host.js +3 -0
  471. package/dist-lib/lib/oauth/keys.d.ts +25 -0
  472. package/dist-lib/lib/oauth/keys.js +93 -0
  473. package/dist-lib/lib/oauth/loopback.d.ts +3 -0
  474. package/dist-lib/lib/oauth/loopback.js +119 -0
  475. package/dist-lib/lib/oauth/loopback.stub.d.ts +3 -0
  476. package/dist-lib/lib/oauth/loopback.stub.js +6 -0
  477. package/dist-lib/lib/oauth/notion.d.ts +34 -0
  478. package/dist-lib/lib/oauth/notion.js +82 -0
  479. package/dist-lib/lib/oauth/pkce-runtime.d.ts +3 -0
  480. package/dist-lib/lib/oauth/pkce-runtime.js +5 -0
  481. package/dist-lib/lib/oauth/pkce.d.ts +8 -0
  482. package/dist-lib/lib/oauth/pkce.js +6 -0
  483. package/dist-lib/lib/oauth/providers.d.ts +5 -0
  484. package/dist-lib/lib/oauth/providers.js +73 -0
  485. package/dist-lib/lib/oauth/redirect-types.d.ts +19 -0
  486. package/dist-lib/lib/oauth/redirect-types.js +1 -0
  487. package/dist-lib/lib/oauth/register.d.ts +3 -0
  488. package/dist-lib/lib/oauth/register.js +34 -0
  489. package/dist-lib/lib/oauth/resolve.d.ts +17 -0
  490. package/dist-lib/lib/oauth/resolve.js +57 -0
  491. package/dist-lib/lib/oauth/spotify.d.ts +32 -0
  492. package/dist-lib/lib/oauth/spotify.js +73 -0
  493. package/dist-lib/lib/oauth/token-exchange-core.d.ts +6 -0
  494. package/dist-lib/lib/oauth/token-exchange-core.js +97 -0
  495. package/dist-lib/lib/oauth/token-exchange.d.ts +5 -0
  496. package/dist-lib/lib/oauth/token-exchange.js +9 -0
  497. package/dist-lib/lib/oauth/types.d.ts +54 -0
  498. package/dist-lib/lib/oauth/types.js +1 -0
  499. package/dist-lib/lib/oauth.client.d.ts +5 -0
  500. package/dist-lib/lib/oauth.client.js +2 -0
  501. package/dist-lib/lib/oauth.d.ts +14 -0
  502. package/dist-lib/lib/oauth.js +12 -0
  503. package/dist-lib/lib/obsidian-key.d.ts +1 -0
  504. package/dist-lib/lib/obsidian-key.js +1 -0
  505. package/dist-lib/lib/race-resource.d.ts +5 -0
  506. package/dist-lib/lib/race-resource.js +25 -0
  507. package/dist-lib/lib/reconnecting-watch.d.ts +2 -0
  508. package/dist-lib/lib/reconnecting-watch.js +78 -0
  509. package/dist-lib/lib/retry-budget.d.ts +14 -0
  510. package/dist-lib/lib/retry-budget.js +39 -0
  511. package/dist-lib/lib/run-notices.d.ts +23 -0
  512. package/dist-lib/lib/run-notices.js +33 -0
  513. package/dist-lib/lib/run-transcript.d.ts +35 -0
  514. package/dist-lib/lib/run-transcript.js +106 -0
  515. package/dist-lib/lib/skill-readiness.d.ts +2 -0
  516. package/dist-lib/lib/skill-readiness.js +21 -0
  517. package/dist-lib/lib/skill-types.d.ts +70 -0
  518. package/dist-lib/lib/skill-types.js +1 -0
  519. package/dist-lib/lib/spec-loader.d.ts +14 -0
  520. package/dist-lib/lib/spec-loader.js +9 -0
  521. package/dist-lib/lib/suspend-lifecycle.d.ts +17 -0
  522. package/dist-lib/lib/suspend-lifecycle.js +33 -0
  523. package/dist-lib/lib/task.d.ts +26 -0
  524. package/dist-lib/lib/task.js +69 -0
  525. package/dist-lib/lib/unref.d.ts +3 -0
  526. package/dist-lib/lib/unref.js +4 -0
  527. package/dist-lib/lib/wav-duration.d.ts +1 -0
  528. package/dist-lib/lib/wav-duration.js +53 -0
  529. package/dist-lib/lib/write-queue.d.ts +22 -0
  530. package/dist-lib/lib/write-queue.js +39 -0
  531. package/dist-lib/schema/build.d.ts +1 -0
  532. package/dist-lib/schema/build.js +120 -0
  533. package/dist-lib/schema/config.d.ts +4 -0
  534. package/dist-lib/schema/config.js +7 -0
  535. package/dist-lib/schema/content.d.ts +20 -0
  536. package/dist-lib/schema/content.js +122 -0
  537. package/dist-lib/schema/engine.d.ts +2 -0
  538. package/dist-lib/schema/engine.js +2013 -0
  539. package/dist-lib/schema/field-order.d.ts +1 -0
  540. package/dist-lib/schema/field-order.js +95 -0
  541. package/dist-lib/schema/local.d.ts +2 -0
  542. package/dist-lib/schema/local.js +133 -0
  543. package/dist-lib/schema/qvac.d.ts +22 -0
  544. package/dist-lib/schema/qvac.js +722 -0
  545. package/dist-lib/spec/bind.d.ts +2 -0
  546. package/dist-lib/spec/bind.js +520 -0
  547. package/dist-lib/spec/calls.d.ts +3 -0
  548. package/dist-lib/spec/calls.js +129 -0
  549. package/dist-lib/spec/capabilities.d.ts +263 -0
  550. package/dist-lib/spec/config/hyperconf/index.d.ts +15 -0
  551. package/dist-lib/spec/config/hyperconf/index.js +24 -0
  552. package/dist-lib/spec/config/hyperconf/package.json +3 -0
  553. package/dist-lib/spec/config/hyperschema/index.js +81 -0
  554. package/dist-lib/spec/config/hyperschema/schema.json +19 -0
  555. package/dist-lib/spec/hrpc/hrpc.json +1500 -0
  556. package/dist-lib/spec/hrpc/index.d.ts +3 -0
  557. package/dist-lib/spec/hrpc/index.js +1545 -0
  558. package/dist-lib/spec/hrpc/messages.d.ts +4 -0
  559. package/dist-lib/spec/hrpc/messages.js +8373 -0
  560. package/dist-lib/spec/hyperschema/index.d.ts +20 -0
  561. package/dist-lib/spec/hyperschema/index.js +8373 -0
  562. package/dist-lib/spec/hyperschema/schema.json +6202 -0
  563. package/dist-lib/spec/hyperschema/types.d.ts +1545 -0
  564. package/dist-lib/spec/index.d.ts +36 -0
  565. package/dist-lib/spec/index.js +6 -0
  566. package/dist-lib/spec/local/hyperdb/db.json +186 -0
  567. package/dist-lib/spec/local/hyperdb/index.d.ts +9 -0
  568. package/dist-lib/spec/local/hyperdb/index.js +855 -0
  569. package/dist-lib/spec/local/hyperdb/messages.js +2189 -0
  570. package/dist-lib/spec/local/hyperschema/index.js +1208 -0
  571. package/dist-lib/spec/local/hyperschema/schema.json +639 -0
  572. package/dist-lib/spec/local/hyperschema/types.d.ts +159 -0
  573. package/dist-lib/spec/mesh/hyperdb/db.json +702 -0
  574. package/dist-lib/spec/mesh/hyperdb/index.d.ts +9 -0
  575. package/dist-lib/spec/mesh/hyperdb/index.js +2260 -0
  576. package/dist-lib/spec/mesh/hyperdb/messages.js +7453 -0
  577. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +174 -0
  578. package/dist-lib/spec/mesh/hyperdispatch/index.d.ts +13 -0
  579. package/dist-lib/spec/mesh/hyperdispatch/index.js +566 -0
  580. package/dist-lib/spec/mesh/hyperdispatch/messages.js +5713 -0
  581. package/dist-lib/spec/mesh/hyperschema/index.d.ts +14 -0
  582. package/dist-lib/spec/mesh/hyperschema/index.js +5713 -0
  583. package/dist-lib/spec/mesh/hyperschema/schema.json +3142 -0
  584. package/dist-lib/spec/mesh/hyperschema/types.d.ts +754 -0
  585. package/ducks.png +0 -0
  586. package/package.json +332 -1
@@ -0,0 +1,149 @@
1
+ const HEIF_BRANDS = new Set([
2
+ 'heic',
3
+ 'heix',
4
+ 'heim',
5
+ 'heis',
6
+ 'hevc',
7
+ 'hevm',
8
+ 'hevs',
9
+ 'mif1',
10
+ 'msf1'
11
+ ]);
12
+ const AVIF_BRANDS = new Set(['avif', 'avis']);
13
+ export function detectImageMime(bytes) {
14
+ if (isPng(bytes))
15
+ return 'image/png';
16
+ if (isJpeg(bytes))
17
+ return 'image/jpeg';
18
+ if (isAvif(bytes))
19
+ return 'image/avif';
20
+ if (isHeif(bytes))
21
+ return 'image/heic';
22
+ if (isWebp(bytes))
23
+ return 'image/webp';
24
+ if (isGif(bytes))
25
+ return 'image/gif';
26
+ if (isBmp(bytes))
27
+ return 'image/bmp';
28
+ if (isTiff(bytes))
29
+ return 'image/tiff';
30
+ return null;
31
+ }
32
+ export function mapDeclaredToSniffed(declared) {
33
+ const normalized = declared.toLowerCase();
34
+ if (normalized === 'image/png')
35
+ return 'image/png';
36
+ if (normalized === 'image/jpeg' || normalized === 'image/jpg')
37
+ return 'image/jpeg';
38
+ if (normalized === 'image/heic' || normalized === 'image/heif')
39
+ return 'image/heic';
40
+ if (normalized === 'image/avif')
41
+ return 'image/avif';
42
+ if (normalized === 'image/webp')
43
+ return 'image/webp';
44
+ if (normalized === 'image/gif')
45
+ return 'image/gif';
46
+ if (normalized === 'image/bmp' || normalized === 'image/x-ms-bmp')
47
+ return 'image/bmp';
48
+ if (normalized === 'image/tiff' || normalized === 'image/tif')
49
+ return 'image/tiff';
50
+ return null;
51
+ }
52
+ function isPng(bytes) {
53
+ return (bytes.length >= 8 &&
54
+ bytes[0] === 0x89 &&
55
+ bytes[1] === 0x50 &&
56
+ bytes[2] === 0x4e &&
57
+ bytes[3] === 0x47 &&
58
+ bytes[4] === 0x0d &&
59
+ bytes[5] === 0x0a &&
60
+ bytes[6] === 0x1a &&
61
+ bytes[7] === 0x0a);
62
+ }
63
+ function isJpeg(bytes) {
64
+ return bytes.length >= 3 && bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff;
65
+ }
66
+ function isHeif(bytes) {
67
+ if (bytes.length < 12)
68
+ return false;
69
+ if (bytes[4] !== 0x66 || bytes[5] !== 0x74 || bytes[6] !== 0x79 || bytes[7] !== 0x70) {
70
+ return false;
71
+ }
72
+ const b8 = bytes[8];
73
+ const b9 = bytes[9];
74
+ const b10 = bytes[10];
75
+ const b11 = bytes[11];
76
+ if (b8 === undefined || b9 === undefined || b10 === undefined || b11 === undefined)
77
+ return false;
78
+ const brand = String.fromCharCode(b8, b9, b10, b11).toLowerCase();
79
+ return HEIF_BRANDS.has(brand);
80
+ }
81
+ function isAvif(bytes) {
82
+ if (bytes.length < 12)
83
+ return false;
84
+ if (bytes[4] !== 0x66 || bytes[5] !== 0x74 || bytes[6] !== 0x79 || bytes[7] !== 0x70) {
85
+ return false;
86
+ }
87
+ const major = brandAt(bytes, 8);
88
+ if (major && AVIF_BRANDS.has(major))
89
+ return true;
90
+ const end = ftypBoxEnd(bytes);
91
+ for (let offset = 16; offset + 4 <= end; offset += 4) {
92
+ const compatible = brandAt(bytes, offset);
93
+ if (compatible && AVIF_BRANDS.has(compatible))
94
+ return true;
95
+ }
96
+ return false;
97
+ }
98
+ function brandAt(bytes, offset) {
99
+ const a = bytes[offset];
100
+ const b = bytes[offset + 1];
101
+ const c = bytes[offset + 2];
102
+ const d = bytes[offset + 3];
103
+ if (a === undefined || b === undefined || c === undefined || d === undefined)
104
+ return null;
105
+ return String.fromCharCode(a, b, c, d).toLowerCase();
106
+ }
107
+ function ftypBoxEnd(bytes) {
108
+ const s0 = bytes[0];
109
+ const s1 = bytes[1];
110
+ const s2 = bytes[2];
111
+ const s3 = bytes[3];
112
+ if (s0 === undefined || s1 === undefined || s2 === undefined || s3 === undefined) {
113
+ return bytes.length;
114
+ }
115
+ const declared = s0 * 0x1000000 + (s1 << 16) + (s2 << 8) + s3;
116
+ return declared > 8 && declared <= bytes.length ? declared : bytes.length;
117
+ }
118
+ function isWebp(bytes) {
119
+ return (bytes.length >= 12 &&
120
+ bytes[0] === 0x52 &&
121
+ bytes[1] === 0x49 &&
122
+ bytes[2] === 0x46 &&
123
+ bytes[3] === 0x46 &&
124
+ bytes[8] === 0x57 &&
125
+ bytes[9] === 0x45 &&
126
+ bytes[10] === 0x42 &&
127
+ bytes[11] === 0x50);
128
+ }
129
+ function isGif(bytes) {
130
+ if (bytes.length < 6)
131
+ return false;
132
+ if (bytes[0] !== 0x47 || bytes[1] !== 0x49 || bytes[2] !== 0x46)
133
+ return false;
134
+ if (bytes[3] !== 0x38 || bytes[5] !== 0x61)
135
+ return false;
136
+ return bytes[4] === 0x37 || bytes[4] === 0x39;
137
+ }
138
+ function isBmp(bytes) {
139
+ return bytes.length >= 2 && bytes[0] === 0x42 && bytes[1] === 0x4d;
140
+ }
141
+ function isTiff(bytes) {
142
+ if (bytes.length < 4)
143
+ return false;
144
+ if (bytes[0] === 0x49 && bytes[1] === 0x49)
145
+ return bytes[2] === 0x2a && bytes[3] === 0x00;
146
+ if (bytes[0] === 0x4d && bytes[1] === 0x4d)
147
+ return bytes[2] === 0x00 && bytes[3] === 0x2a;
148
+ return false;
149
+ }
@@ -0,0 +1,14 @@
1
+ import type { QvacAutobeeHead } from '../../spec/mesh/hyperschema/types.d.ts';
2
+ export interface MeshInviteNode {
3
+ readonly host: string;
4
+ readonly port: number;
5
+ }
6
+ export interface MeshInvite {
7
+ readonly baseKey: Buffer;
8
+ readonly seed: Buffer;
9
+ readonly fastForward: QvacAutobeeHead | null;
10
+ readonly additionalNodes?: ReadonlyArray<MeshInviteNode>;
11
+ readonly blindPeers?: ReadonlyArray<Buffer>;
12
+ }
13
+ export declare function encodeMeshInvite(invite: MeshInvite): string;
14
+ export declare function decodeMeshInvite(raw: string): MeshInvite | null;
@@ -0,0 +1,36 @@
1
+ import * as z32 from 'z32';
2
+ import { decode as decodeStruct, encode as encodeStruct } from '../../spec/mesh/hyperschema/index.js';
3
+ const INVITE_STRUCT = '@qvac/mesh-invite';
4
+ const INVITE_PREFIX = 'qvac://mesh/';
5
+ export function encodeMeshInvite(invite) {
6
+ const payload = {
7
+ meshKey: invite.baseKey,
8
+ seed: invite.seed,
9
+ fastForward: invite.fastForward,
10
+ additionalNodes: [...(invite.additionalNodes ?? [])],
11
+ blindPeers: [...(invite.blindPeers ?? [])]
12
+ };
13
+ return INVITE_PREFIX + z32.encode(encodeStruct(INVITE_STRUCT, payload));
14
+ }
15
+ export function decodeMeshInvite(raw) {
16
+ const value = raw.trim().toLowerCase();
17
+ if (!value.startsWith(INVITE_PREFIX))
18
+ return null;
19
+ let payload;
20
+ try {
21
+ payload = decodeStruct(INVITE_STRUCT, z32.decode(value.slice(INVITE_PREFIX.length)));
22
+ }
23
+ catch {
24
+ return null;
25
+ }
26
+ return {
27
+ baseKey: payload.meshKey,
28
+ seed: payload.seed,
29
+ fastForward: payload.fastForward ? payload.fastForward : null,
30
+ additionalNodes: (payload.additionalNodes ?? []).map((node) => ({
31
+ host: node.host,
32
+ port: node.port
33
+ })),
34
+ blindPeers: payload.blindPeers ?? []
35
+ };
36
+ }
@@ -0,0 +1,71 @@
1
+ import CorestoreStorage from 'hypercore-storage';
2
+ import HyperDB from 'hyperdb';
3
+ import type { LocalAppConfig, LocalCapabilityProfile, LocalChatNotify, LocalCustomModel, LocalIdentity, LocalMembership, LocalMeshDeparture, LocalModelDownload, LocalModelNotify } from '../../../spec/local/hyperschema/types.d.ts';
4
+ import type { DeviceMetadata } from '../mesh.ts';
5
+ export interface ResolvedSession {
6
+ readonly seed: Buffer;
7
+ readonly baseKey: Buffer | undefined;
8
+ readonly writerSeed: string | undefined;
9
+ readonly creator: boolean;
10
+ }
11
+ export declare function openLocalStore(storage: CorestoreStorage): LocalStore;
12
+ declare class LocalStore {
13
+ private readonly _db;
14
+ private readonly _writeLock;
15
+ constructor(db: HyperDB);
16
+ private _locked;
17
+ get(key: string): Promise<unknown>;
18
+ set(key: string, value: unknown): Promise<void>;
19
+ setAll(entries: ReadonlyArray<{
20
+ readonly key: string;
21
+ readonly value: unknown;
22
+ }>): Promise<void>;
23
+ deleteAll(keys: ReadonlyArray<string>): Promise<void>;
24
+ getAppConfigRow(): Promise<LocalAppConfig | null>;
25
+ updateAppConfigRow(mutate: (current: LocalAppConfig | null) => Omit<LocalAppConfig, 'id'>): Promise<LocalAppConfig>;
26
+ getChatNotify(chatId: string): Promise<LocalChatNotify | null>;
27
+ ackChatNotify(chatId: string, seq: number): Promise<void>;
28
+ clearChatNotify(chatId: string): Promise<void>;
29
+ beginModelTransfer(name: string, { transferred }?: {
30
+ transferred?: boolean;
31
+ }): Promise<LocalModelNotify>;
32
+ completeModelTransfer({ name, transferId, downloaded }: {
33
+ name: string;
34
+ transferId: string;
35
+ downloaded?: boolean;
36
+ }): Promise<void>;
37
+ getModelNotifications(): Promise<LocalModelNotify[]>;
38
+ ackModelNotification(notificationId: string): Promise<void>;
39
+ getModelDownloadRows(): Promise<LocalModelDownload[]>;
40
+ putModelDownloadRow(row: LocalModelDownload): Promise<void>;
41
+ deleteModelDownloadRow(name: string): Promise<void>;
42
+ getCustomModelRows(): Promise<LocalCustomModel[]>;
43
+ putCustomModelRow(row: LocalCustomModel): Promise<void>;
44
+ deleteCustomModelRow(name: string): Promise<void>;
45
+ ensureDevice(publicKey: Buffer, seed?: DeviceMetadata): Promise<DeviceMetadata | null>;
46
+ renameDevice(publicKey: Buffer, name: string): Promise<void>;
47
+ saveDeviceProfile(publicKey: Buffer, capabilityProfile: LocalCapabilityProfile, recommendedModelName: string, platform?: string): Promise<void>;
48
+ readIdentity(): Promise<LocalIdentity | null>;
49
+ readMembership(): Promise<LocalMembership | null>;
50
+ recordMembership(link: Omit<LocalMembership, 'id'>): Promise<void>;
51
+ ensureIdentity(devicePublicKey: Buffer, createdAt: number): Promise<{
52
+ identity: LocalIdentity;
53
+ mnemonic: string | null;
54
+ }>;
55
+ resolveSession(deviceId: Buffer, opts?: {
56
+ seed?: Buffer;
57
+ baseKey?: Buffer;
58
+ new?: boolean;
59
+ writerSeed?: string;
60
+ creator?: boolean;
61
+ }): Promise<ResolvedSession>;
62
+ createCandidateSession(seed: Buffer, baseKey: Buffer): ResolvedSession;
63
+ recordMesh(deviceId: Buffer, key: Buffer, seed: Buffer, creator: boolean, writerSeed: string | undefined): Promise<void>;
64
+ recordDeparture(key: Buffer): Promise<void>;
65
+ departures(): Promise<LocalMeshDeparture[]>;
66
+ deleteDeparture(key: Buffer): Promise<void>;
67
+ watch(listener: () => void): void;
68
+ unwatch(listener: () => void): void;
69
+ close(): Promise<void>;
70
+ }
71
+ export {};
@@ -0,0 +1,391 @@
1
+ import CorestoreStorage from 'hypercore-storage';
2
+ import HyperDB from 'hyperdb';
3
+ import crypto from 'hypercore-crypto';
4
+ import ScopeLock from 'scope-lock';
5
+ import { generateMnemonic, mintIdentity } from "../identity.js";
6
+ import LocalDatabaseSpec from '../../../spec/local/hyperdb/index.js';
7
+ const CONFIG = '@local/config';
8
+ const MESH_SESSION = '@local/mesh-session';
9
+ const MESH_HISTORY = '@local/mesh-history';
10
+ const MESH_DEPARTURE = '@local/mesh-departure';
11
+ const DEVICE = '@local/device';
12
+ const APP_CONFIG = '@local/app-config';
13
+ const MODEL_DOWNLOAD = '@local/model-download';
14
+ const CUSTOM_MODEL = '@local/custom-model';
15
+ const IDENTITY = '@local/identity';
16
+ const IDENTITY_ID = 'identity';
17
+ const MEMBERSHIP = '@local/membership';
18
+ const MEMBERSHIP_ID = 'membership';
19
+ const CHAT_NOTIFY = '@local/chat-notify';
20
+ const MODEL_NOTIFY = '@local/model-notify';
21
+ const APP_CONFIG_ID = 'default';
22
+ function freshWriterSeed() {
23
+ return `local-${crypto.randomBytes(8).toString('hex')}`;
24
+ }
25
+ export function openLocalStore(storage) {
26
+ const db = HyperDB.rocks(storage.rocks.columnFamily('assistant/local'), LocalDatabaseSpec);
27
+ return new LocalStore(db);
28
+ }
29
+ class LocalStore {
30
+ _db;
31
+ _writeLock = new ScopeLock();
32
+ constructor(db) {
33
+ this._db = db;
34
+ }
35
+ async _locked(fn) {
36
+ await this._writeLock.lock();
37
+ try {
38
+ return await fn();
39
+ }
40
+ finally {
41
+ this._writeLock.unlock();
42
+ }
43
+ }
44
+ async get(key) {
45
+ const row = await this._db.get(CONFIG, { key });
46
+ return row ? row.value : null;
47
+ }
48
+ set(key, value) {
49
+ return this._locked(async () => {
50
+ const tx = this._db.transaction();
51
+ await tx.insert(CONFIG, { key, value });
52
+ await tx.flush();
53
+ });
54
+ }
55
+ setAll(entries) {
56
+ return this._locked(async () => {
57
+ const tx = this._db.transaction();
58
+ for (const { key, value } of entries)
59
+ await tx.insert(CONFIG, { key, value });
60
+ await tx.flush();
61
+ });
62
+ }
63
+ deleteAll(keys) {
64
+ return this._locked(async () => {
65
+ const tx = this._db.transaction();
66
+ for (const key of keys)
67
+ await tx.delete(CONFIG, { key });
68
+ await tx.flush();
69
+ });
70
+ }
71
+ getAppConfigRow() {
72
+ return this._db.get(APP_CONFIG, { id: APP_CONFIG_ID });
73
+ }
74
+ updateAppConfigRow(mutate) {
75
+ return this._locked(async () => {
76
+ const tx = this._db.transaction();
77
+ const current = await tx.get(APP_CONFIG, { id: APP_CONFIG_ID });
78
+ const next = { id: APP_CONFIG_ID, ...mutate(current) };
79
+ await tx.insert(APP_CONFIG, next);
80
+ await tx.flush();
81
+ return next;
82
+ });
83
+ }
84
+ getChatNotify(chatId) {
85
+ return this._locked(() => this._db.get(CHAT_NOTIFY, { chatId }));
86
+ }
87
+ ackChatNotify(chatId, seq) {
88
+ return this._locked(async () => {
89
+ const tx = this._db.transaction();
90
+ const current = await tx.get(CHAT_NOTIFY, { chatId });
91
+ const ackedThrough = Math.max(current?.ackedThrough ?? 0, seq + 1);
92
+ await tx.insert(CHAT_NOTIFY, { chatId, ackedThrough });
93
+ await tx.flush();
94
+ });
95
+ }
96
+ clearChatNotify(chatId) {
97
+ return this._locked(async () => {
98
+ const tx = this._db.transaction();
99
+ await tx.delete(CHAT_NOTIFY, { chatId });
100
+ await tx.flush();
101
+ });
102
+ }
103
+ beginModelTransfer(name, { transferred = false } = {}) {
104
+ return this._locked(async () => {
105
+ const current = await this._db.get(MODEL_NOTIFY, { name });
106
+ const pending = current && current.transferId !== current.notificationId;
107
+ if (pending && (!transferred || current.transferred))
108
+ return current;
109
+ const next = {
110
+ name,
111
+ transferId: pending ? current.transferId : crypto.randomBytes(16).toString('hex'),
112
+ notificationId: current?.notificationId,
113
+ completedAt: current?.completedAt,
114
+ acknowledged: current?.acknowledged,
115
+ transferred
116
+ };
117
+ const tx = this._db.transaction();
118
+ await tx.insert(MODEL_NOTIFY, next);
119
+ await tx.flush();
120
+ return next;
121
+ });
122
+ }
123
+ completeModelTransfer({ name, transferId, downloaded = true }) {
124
+ return this._locked(async () => {
125
+ const current = await this._db.get(MODEL_NOTIFY, { name });
126
+ if (!current || current.transferId !== transferId || current.notificationId === transferId) {
127
+ return;
128
+ }
129
+ if (!downloaded && !current.transferred)
130
+ return;
131
+ const tx = this._db.transaction();
132
+ await tx.insert(MODEL_NOTIFY, {
133
+ name,
134
+ transferId,
135
+ notificationId: transferId,
136
+ completedAt: Date.now(),
137
+ acknowledged: false,
138
+ transferred: true
139
+ });
140
+ await tx.flush();
141
+ });
142
+ }
143
+ getModelNotifications() {
144
+ return this._locked(() => this._db.find(MODEL_NOTIFY).toArray());
145
+ }
146
+ ackModelNotification(notificationId) {
147
+ return this._locked(async () => {
148
+ const rows = await this._db.find(MODEL_NOTIFY).toArray();
149
+ const current = rows.find((row) => row.notificationId === notificationId);
150
+ if (!current || current.acknowledged)
151
+ return;
152
+ const tx = this._db.transaction();
153
+ await tx.insert(MODEL_NOTIFY, {
154
+ name: current.name,
155
+ transferId: current.transferId,
156
+ notificationId: current.notificationId,
157
+ completedAt: current.completedAt,
158
+ transferred: current.transferred,
159
+ acknowledged: true
160
+ });
161
+ await tx.flush();
162
+ });
163
+ }
164
+ async getModelDownloadRows() {
165
+ const rows = [];
166
+ for await (const row of this._db.find(MODEL_DOWNLOAD))
167
+ rows.push(row);
168
+ return rows;
169
+ }
170
+ putModelDownloadRow(row) {
171
+ return this._locked(async () => {
172
+ const tx = this._db.transaction();
173
+ await tx.insert(MODEL_DOWNLOAD, row);
174
+ await tx.flush();
175
+ });
176
+ }
177
+ deleteModelDownloadRow(name) {
178
+ return this._locked(async () => {
179
+ const tx = this._db.transaction();
180
+ await tx.delete(MODEL_DOWNLOAD, { name });
181
+ await tx.flush();
182
+ });
183
+ }
184
+ async getCustomModelRows() {
185
+ const rows = [];
186
+ for await (const row of this._db.find(CUSTOM_MODEL))
187
+ rows.push(row);
188
+ return rows;
189
+ }
190
+ putCustomModelRow(row) {
191
+ return this._locked(async () => {
192
+ const tx = this._db.transaction();
193
+ await tx.insert(CUSTOM_MODEL, row);
194
+ await tx.flush();
195
+ });
196
+ }
197
+ deleteCustomModelRow(name) {
198
+ return this._locked(async () => {
199
+ const tx = this._db.transaction();
200
+ await tx.delete(CUSTOM_MODEL, { name });
201
+ await tx.flush();
202
+ });
203
+ }
204
+ ensureDevice(publicKey, seed) {
205
+ return this._locked(async () => {
206
+ const existing = await this._db.get(DEVICE, { publicKey });
207
+ if (existing) {
208
+ return {
209
+ name: existing.name,
210
+ capabilityProfile: existing.capabilityProfile,
211
+ recommendedModelName: existing.recommendedModelName,
212
+ platform: existing.platform ?? undefined
213
+ };
214
+ }
215
+ if (!seed)
216
+ return null;
217
+ const tx = this._db.transaction();
218
+ await tx.insert(DEVICE, { publicKey, ...seed });
219
+ await tx.flush();
220
+ return seed;
221
+ });
222
+ }
223
+ renameDevice(publicKey, name) {
224
+ return this._locked(async () => {
225
+ const existing = await this._db.get(DEVICE, { publicKey });
226
+ if (!existing)
227
+ return;
228
+ const tx = this._db.transaction();
229
+ await tx.insert(DEVICE, { ...existing, name });
230
+ await tx.flush();
231
+ });
232
+ }
233
+ saveDeviceProfile(publicKey, capabilityProfile, recommendedModelName, platform) {
234
+ return this._locked(async () => {
235
+ const existing = await this._db.get(DEVICE, { publicKey });
236
+ if (!existing)
237
+ return;
238
+ const tx = this._db.transaction();
239
+ await tx.insert(DEVICE, {
240
+ ...existing,
241
+ capabilityProfile,
242
+ recommendedModelName,
243
+ platform: platform ?? existing.platform
244
+ });
245
+ await tx.flush();
246
+ });
247
+ }
248
+ readIdentity() {
249
+ return this._db.get(IDENTITY, { id: IDENTITY_ID });
250
+ }
251
+ readMembership() {
252
+ return this._db.get(MEMBERSHIP, { id: MEMBERSHIP_ID });
253
+ }
254
+ recordMembership(link) {
255
+ return this._locked(async () => {
256
+ const existing = await this._db.get(MEMBERSHIP, { id: MEMBERSHIP_ID });
257
+ if (existing && existing.attestedAt >= link.attestedAt)
258
+ return;
259
+ const tx = this._db.transaction();
260
+ await tx.insert(MEMBERSHIP, { id: MEMBERSHIP_ID, ...link });
261
+ await tx.flush();
262
+ });
263
+ }
264
+ ensureIdentity(devicePublicKey, createdAt) {
265
+ return this._locked(async () => {
266
+ const existing = await this._db.get(IDENTITY, { id: IDENTITY_ID });
267
+ if (existing)
268
+ return { identity: existing, mnemonic: null };
269
+ const mnemonic = await generateMnemonic();
270
+ const minted = await mintIdentity(mnemonic, devicePublicKey);
271
+ const identity = {
272
+ id: IDENTITY_ID,
273
+ publicKey: minted.publicKey,
274
+ proof: minted.proof,
275
+ createdAt
276
+ };
277
+ const tx = this._db.transaction();
278
+ await tx.insert(IDENTITY, identity);
279
+ await tx.flush();
280
+ return { identity, mnemonic };
281
+ });
282
+ }
283
+ resolveSession(deviceId, opts = {}) {
284
+ return this._locked(async () => {
285
+ const tx = this._db.transaction();
286
+ const session = await tx.get(MESH_SESSION, { deviceId });
287
+ const sameSeed = Boolean(opts.seed && session?.meshSeed?.equals(opts.seed));
288
+ if (opts.seed && !sameSeed) {
289
+ await tx.insert(MESH_SESSION, {
290
+ deviceId,
291
+ meshSeed: opts.seed,
292
+ meshKey: opts.baseKey ?? null,
293
+ meshCreator: opts.creator ?? false
294
+ });
295
+ await tx.flush();
296
+ return {
297
+ seed: opts.seed,
298
+ baseKey: opts.baseKey,
299
+ writerSeed: opts.writerSeed ?? freshWriterSeed(),
300
+ creator: opts.creator ?? false
301
+ };
302
+ }
303
+ if (session?.meshSeed && !opts.new) {
304
+ const baseKey = !session.meshCreator && session.meshKey ? session.meshKey : undefined;
305
+ const history = await tx.findOne(MESH_HISTORY);
306
+ await tx.close();
307
+ return {
308
+ seed: session.meshSeed,
309
+ baseKey,
310
+ writerSeed: history?.writerSeed ?? undefined,
311
+ creator: session.meshCreator ?? false
312
+ };
313
+ }
314
+ const seed = crypto.randomBytes(32);
315
+ await tx.insert(MESH_SESSION, {
316
+ deviceId,
317
+ meshSeed: seed,
318
+ meshKey: null,
319
+ meshCreator: true
320
+ });
321
+ await tx.flush();
322
+ return { seed, baseKey: undefined, writerSeed: undefined, creator: true };
323
+ });
324
+ }
325
+ createCandidateSession(seed, baseKey) {
326
+ return {
327
+ seed,
328
+ baseKey,
329
+ writerSeed: freshWriterSeed(),
330
+ creator: false
331
+ };
332
+ }
333
+ recordMesh(deviceId, key, seed, creator, writerSeed) {
334
+ return this._locked(async () => {
335
+ const tx = this._db.transaction();
336
+ const current = await tx.findOne(MESH_HISTORY);
337
+ if (current && !current.key.equals(key)) {
338
+ await tx.delete(MESH_HISTORY, { key: current.key });
339
+ }
340
+ await tx.insert(MESH_HISTORY, { key, seed, creator, writerSeed });
341
+ const session = await tx.get(MESH_SESSION, { deviceId });
342
+ await tx.insert(MESH_SESSION, {
343
+ ...session,
344
+ deviceId,
345
+ meshSeed: seed,
346
+ meshKey: key,
347
+ meshCreator: creator
348
+ });
349
+ await tx.flush();
350
+ });
351
+ }
352
+ recordDeparture(key) {
353
+ return this._locked(async () => {
354
+ const tx = this._db.transaction();
355
+ const history = await tx.get(MESH_HISTORY, { key });
356
+ if (!history) {
357
+ await tx.close();
358
+ return;
359
+ }
360
+ await tx.insert(MESH_DEPARTURE, {
361
+ key: history.key,
362
+ seed: history.seed,
363
+ creator: history.creator,
364
+ writerSeed: history.writerSeed
365
+ });
366
+ await tx.flush();
367
+ });
368
+ }
369
+ async departures() {
370
+ const rows = [];
371
+ for await (const row of this._db.find(MESH_DEPARTURE))
372
+ rows.push(row);
373
+ return rows;
374
+ }
375
+ deleteDeparture(key) {
376
+ return this._locked(async () => {
377
+ const tx = this._db.transaction();
378
+ await tx.delete(MESH_DEPARTURE, { key });
379
+ await tx.flush();
380
+ });
381
+ }
382
+ watch(listener) {
383
+ this._db.watch(listener);
384
+ }
385
+ unwatch(listener) {
386
+ this._db.unwatch(listener);
387
+ }
388
+ async close() {
389
+ await this._locked(() => this._db.close());
390
+ }
391
+ }
@@ -0,0 +1,15 @@
1
+ import type { KeyPair } from 'hyperswarm';
2
+ import type { Logger } from '../../index.ts';
3
+ import type { QvacDevice } from '../../spec/mesh/hyperschema/types.d.ts';
4
+ import type { Mesh } from './mesh.ts';
5
+ export interface MembershipView {
6
+ readonly members: number;
7
+ readonly own: QvacDevice | null;
8
+ readonly unattested: ReadonlyArray<Buffer>;
9
+ }
10
+ export interface MembershipContext {
11
+ readonly deviceKeyPair: KeyPair;
12
+ readonly log: Logger | null;
13
+ }
14
+ export declare function membershipView(mesh: Mesh, deviceId: Buffer): Promise<MembershipView>;
15
+ export declare function attestUnattestedDevices(mesh: Mesh, { deviceKeyPair, log }: MembershipContext): Promise<void>;