@qvac/core 0.5.0 → 0.6.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 (383) hide show
  1. package/CHANGELOG.md +75 -1
  2. package/dist-lib/lib/api/agents.js +3 -2
  3. package/dist-lib/lib/api/app-config.d.ts +1 -1
  4. package/dist-lib/lib/api/app-config.js +54 -15
  5. package/dist-lib/lib/api/attachments.d.ts +6 -5
  6. package/dist-lib/lib/api/attachments.js +4 -2
  7. package/dist-lib/lib/api/chat.d.ts +7 -3
  8. package/dist-lib/lib/api/chat.js +4 -4
  9. package/dist-lib/lib/api/chunks.js +3 -3
  10. package/dist-lib/lib/api/config.js +2 -2
  11. package/dist-lib/lib/api/current-mesh.d.ts +3 -4
  12. package/dist-lib/lib/api/current-mesh.js +9 -4
  13. package/dist-lib/lib/api/custom-models.d.ts +8 -1
  14. package/dist-lib/lib/api/custom-models.js +53 -16
  15. package/dist-lib/lib/api/devices.d.ts +14 -5
  16. package/dist-lib/lib/api/devices.js +13 -8
  17. package/dist-lib/lib/api/diagnostics.d.ts +1 -0
  18. package/dist-lib/lib/api/diagnostics.js +1 -1
  19. package/dist-lib/lib/api/effective-ctx-size.d.ts +6 -1
  20. package/dist-lib/lib/api/effective-ctx-size.js +5 -3
  21. package/dist-lib/lib/api/execution.js +2 -1
  22. package/dist-lib/lib/api/files.js +2 -1
  23. package/dist-lib/lib/api/index.d.ts +5 -1
  24. package/dist-lib/lib/api/index.js +101 -102
  25. package/dist-lib/lib/api/instrument.js +29 -20
  26. package/dist-lib/lib/api/knowledge.d.ts +6 -5
  27. package/dist-lib/lib/api/knowledge.js +8 -6
  28. package/dist-lib/lib/api/local-files.js +1 -1
  29. package/dist-lib/lib/api/logs.js +6 -3
  30. package/dist-lib/lib/api/members.js +22 -13
  31. package/dist-lib/lib/api/mesh.js +3 -3
  32. package/dist-lib/lib/api/model-download.js +1 -1
  33. package/dist-lib/lib/api/network.d.ts +1 -0
  34. package/dist-lib/lib/api/network.js +1 -1
  35. package/dist-lib/lib/api/notifications.js +23 -13
  36. package/dist-lib/lib/api/rag.d.ts +6 -1
  37. package/dist-lib/lib/api/rag.js +20 -11
  38. package/dist-lib/lib/api/range.d.ts +2 -2
  39. package/dist-lib/lib/api/sync.js +1 -1
  40. package/dist-lib/lib/api/tool-activity.js +7 -3
  41. package/dist-lib/lib/api/tool-configs.js +2 -4
  42. package/dist-lib/lib/api/upload-frames.d.ts +7 -8
  43. package/dist-lib/lib/api/upload-frames.js +2 -1
  44. package/dist-lib/lib/api/watchable.d.ts +6 -1
  45. package/dist-lib/lib/api/watchable.js +23 -14
  46. package/dist-lib/lib/assistant/fetch-body.js +4 -2
  47. package/dist-lib/lib/assistant/harness.d.ts +48 -27
  48. package/dist-lib/lib/assistant/harness.js +40 -16
  49. package/dist-lib/lib/assistant/history.d.ts +9 -7
  50. package/dist-lib/lib/assistant/history.js +77 -42
  51. package/dist-lib/lib/assistant/message.d.ts +5 -3
  52. package/dist-lib/lib/assistant/message.js +4 -2
  53. package/dist-lib/lib/assistant/skill-encode.d.ts +3 -1
  54. package/dist-lib/lib/assistant/skill-encode.js +52 -62
  55. package/dist-lib/lib/assistant-client.js +7 -4
  56. package/dist-lib/lib/assistant-tree.js +27 -11
  57. package/dist-lib/lib/assistant.d.ts +30 -11
  58. package/dist-lib/lib/assistant.js +824 -378
  59. package/dist-lib/lib/audio-format.d.ts +1 -1
  60. package/dist-lib/lib/audio-format.js +1 -1
  61. package/dist-lib/lib/chat-title.js +9 -4
  62. package/dist-lib/lib/client.js +3 -2
  63. package/dist-lib/lib/collabora/convert.d.ts +2 -2
  64. package/dist-lib/lib/collabora/convert.js +6 -3
  65. package/dist-lib/lib/collabora/entry.js +9 -5
  66. package/dist-lib/lib/collabora/protocol.d.ts +2 -2
  67. package/dist-lib/lib/collabora/protocol.js +14 -7
  68. package/dist-lib/lib/collabora/worker.js +14 -7
  69. package/dist-lib/lib/compaction.d.ts +5 -6
  70. package/dist-lib/lib/compaction.js +14 -7
  71. package/dist-lib/lib/core/account-recovery.d.ts +4 -3
  72. package/dist-lib/lib/core/account-recovery.js +7 -4
  73. package/dist-lib/lib/core/agent.js +17 -15
  74. package/dist-lib/lib/core/approval-rules.d.ts +7 -6
  75. package/dist-lib/lib/core/approval-rules.js +12 -6
  76. package/dist-lib/lib/core/archived-mesh.d.ts +7 -5
  77. package/dist-lib/lib/core/archived-mesh.js +25 -22
  78. package/dist-lib/lib/core/async-iterable.js +10 -5
  79. package/dist-lib/lib/core/attachment-link.d.ts +2 -2
  80. package/dist-lib/lib/core/audio-attachment.js +1 -1
  81. package/dist-lib/lib/core/blind-peers.d.ts +2 -2
  82. package/dist-lib/lib/core/chat-activity.d.ts +2 -2
  83. package/dist-lib/lib/core/chat-activity.js +42 -21
  84. package/dist-lib/lib/core/chat-group.d.ts +8 -6
  85. package/dist-lib/lib/core/chat-group.js +17 -10
  86. package/dist-lib/lib/core/chat-order.d.ts +11 -9
  87. package/dist-lib/lib/core/chat-order.js +1 -3
  88. package/dist-lib/lib/core/chat-search.d.ts +4 -4
  89. package/dist-lib/lib/core/chat-search.js +38 -24
  90. package/dist-lib/lib/core/chat.d.ts +20 -14
  91. package/dist-lib/lib/core/chat.js +42 -28
  92. package/dist-lib/lib/core/chunk.d.ts +19 -23
  93. package/dist-lib/lib/core/chunk.js +27 -21
  94. package/dist-lib/lib/core/collections.d.ts +69 -0
  95. package/dist-lib/lib/core/collections.js +69 -0
  96. package/dist-lib/lib/core/contract/activity.d.ts +6 -2
  97. package/dist-lib/lib/core/contract/activity.js +15 -12
  98. package/dist-lib/lib/core/contract/agents.js +3 -2
  99. package/dist-lib/lib/core/contract/approval-rules.js +1 -1
  100. package/dist-lib/lib/core/contract/attestations.js +1 -1
  101. package/dist-lib/lib/core/contract/chat-group.js +1 -1
  102. package/dist-lib/lib/core/contract/chat.js +1 -1
  103. package/dist-lib/lib/core/contract/chunks.js +10 -9
  104. package/dist-lib/lib/core/contract/compute.js +2 -1
  105. package/dist-lib/lib/core/contract/devices.js +6 -5
  106. package/dist-lib/lib/core/contract/grant-order.js +5 -6
  107. package/dist-lib/lib/core/contract/index.js +4 -2
  108. package/dist-lib/lib/core/contract/indexing.js +3 -3
  109. package/dist-lib/lib/core/contract/invites.d.ts +8 -3
  110. package/dist-lib/lib/core/contract/invites.js +52 -26
  111. package/dist-lib/lib/core/contract/joined-meshes.js +3 -3
  112. package/dist-lib/lib/core/contract/knowledge.js +5 -5
  113. package/dist-lib/lib/core/contract/members.d.ts +13 -2
  114. package/dist-lib/lib/core/contract/members.js +46 -25
  115. package/dist-lib/lib/core/contract/mesh-kind.js +9 -8
  116. package/dist-lib/lib/core/contract/seal.js +1 -1
  117. package/dist-lib/lib/core/contract/seed-defaults.js +1 -3
  118. package/dist-lib/lib/core/contract/tool-activity.js +5 -5
  119. package/dist-lib/lib/core/contract/tool-configs.js +1 -2
  120. package/dist-lib/lib/core/contract/writers.d.ts +6 -1
  121. package/dist-lib/lib/core/contract/writers.js +55 -34
  122. package/dist-lib/lib/core/departures.js +16 -8
  123. package/dist-lib/lib/core/device-invites.js +3 -2
  124. package/dist-lib/lib/core/devices.js +6 -3
  125. package/dist-lib/lib/core/document-attachment.d.ts +20 -11
  126. package/dist-lib/lib/core/document-attachment.js +10 -5
  127. package/dist-lib/lib/core/files/attachments.d.ts +2 -5
  128. package/dist-lib/lib/core/files/attachments.js +6 -3
  129. package/dist-lib/lib/core/files/index.d.ts +44 -52
  130. package/dist-lib/lib/core/files/index.js +142 -93
  131. package/dist-lib/lib/core/files/knowledge.d.ts +2 -5
  132. package/dist-lib/lib/core/files/local-index.js +9 -5
  133. package/dist-lib/lib/core/files/preview/image.d.ts +0 -1
  134. package/dist-lib/lib/core/files/preview/image.js +9 -6
  135. package/dist-lib/lib/core/files/preview/index.d.ts +8 -11
  136. package/dist-lib/lib/core/files/preview/index.js +20 -15
  137. package/dist-lib/lib/core/files/processing/claims.d.ts +6 -5
  138. package/dist-lib/lib/core/files/processing/claims.js +16 -8
  139. package/dist-lib/lib/core/files/processing/document.d.ts +21 -50
  140. package/dist-lib/lib/core/files/processing/index.d.ts +18 -13
  141. package/dist-lib/lib/core/files/processing/index.js +65 -37
  142. package/dist-lib/lib/core/files/processing/ownership.d.ts +8 -1
  143. package/dist-lib/lib/core/files/processing/ownership.js +1 -1
  144. package/dist-lib/lib/core/files/processing/protocol.d.ts +19 -19
  145. package/dist-lib/lib/core/files/processing/protocol.js +5 -5
  146. package/dist-lib/lib/core/files/processing/settle.d.ts +10 -7
  147. package/dist-lib/lib/core/files/processing/settle.js +22 -11
  148. package/dist-lib/lib/core/files/processing/source.js +14 -8
  149. package/dist-lib/lib/core/files/processing/state.d.ts +13 -11
  150. package/dist-lib/lib/core/files/processing/state.js +19 -12
  151. package/dist-lib/lib/core/files/rag/build.d.ts +2 -2
  152. package/dist-lib/lib/core/files/rag/build.js +2 -1
  153. package/dist-lib/lib/core/files/rag/document-types.d.ts +4 -6
  154. package/dist-lib/lib/core/files/rag/index.d.ts +10 -13
  155. package/dist-lib/lib/core/files/rag/index.js +3 -2
  156. package/dist-lib/lib/core/files/rag/load.d.ts +10 -9
  157. package/dist-lib/lib/core/files/rag/load.js +26 -13
  158. package/dist-lib/lib/core/files/rag/policy.js +2 -1
  159. package/dist-lib/lib/core/files/rag/produce.js +33 -19
  160. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +5 -3
  161. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +30 -10
  162. package/dist-lib/lib/core/files/records/chunks.js +4 -2
  163. package/dist-lib/lib/core/files/records/knowledge.d.ts +10 -11
  164. package/dist-lib/lib/core/files/records/knowledge.js +9 -8
  165. package/dist-lib/lib/core/files/records/linkage.js +6 -3
  166. package/dist-lib/lib/core/files/records/output.d.ts +5 -4
  167. package/dist-lib/lib/core/files/records/output.js +8 -4
  168. package/dist-lib/lib/core/files/records/reclaim.js +41 -25
  169. package/dist-lib/lib/core/files/records/routing.d.ts +4 -6
  170. package/dist-lib/lib/core/files/records/routing.js +15 -8
  171. package/dist-lib/lib/core/files/records/source.d.ts +5 -4
  172. package/dist-lib/lib/core/files/records/source.js +20 -14
  173. package/dist-lib/lib/core/files/records/sweep.js +1 -3
  174. package/dist-lib/lib/core/files/store/blob.d.ts +10 -10
  175. package/dist-lib/lib/core/files/store/blob.js +25 -19
  176. package/dist-lib/lib/core/files/store/index.d.ts +1 -6
  177. package/dist-lib/lib/core/files/store/index.js +4 -4
  178. package/dist-lib/lib/core/files/store/inline.d.ts +2 -2
  179. package/dist-lib/lib/core/files/store/inline.js +6 -3
  180. package/dist-lib/lib/core/files/store/reference.d.ts +6 -9
  181. package/dist-lib/lib/core/files/store/reference.js +25 -17
  182. package/dist-lib/lib/core/files/store/server.d.ts +7 -6
  183. package/dist-lib/lib/core/files/store/server.js +22 -11
  184. package/dist-lib/lib/core/files/store/sweep.js +13 -7
  185. package/dist-lib/lib/core/files/upload-input.d.ts +4 -12
  186. package/dist-lib/lib/core/files/upload-input.js +10 -5
  187. package/dist-lib/lib/core/files/upload.d.ts +27 -24
  188. package/dist-lib/lib/core/files/upload.js +74 -51
  189. package/dist-lib/lib/core/fs-drives.js +4 -2
  190. package/dist-lib/lib/core/grant-expiry.js +12 -7
  191. package/dist-lib/lib/core/handoff-channel.js +27 -13
  192. package/dist-lib/lib/core/harness-loan.js +35 -17
  193. package/dist-lib/lib/core/helpers/index.js +6 -2
  194. package/dist-lib/lib/core/hosted-agents.js +19 -12
  195. package/dist-lib/lib/core/id.js +1 -1
  196. package/dist-lib/lib/core/identity.js +6 -3
  197. package/dist-lib/lib/core/image/cache-sweep.d.ts +12 -10
  198. package/dist-lib/lib/core/image/cache-sweep.js +11 -6
  199. package/dist-lib/lib/core/image/normalize.d.ts +6 -0
  200. package/dist-lib/lib/core/image/normalize.js +12 -2
  201. package/dist-lib/lib/core/image/sniff.js +42 -21
  202. package/dist-lib/lib/core/inference-calls-receiver.js +7 -4
  203. package/dist-lib/lib/core/invite-grants.js +4 -2
  204. package/dist-lib/lib/core/invite.js +2 -1
  205. package/dist-lib/lib/core/local/files.js +20 -19
  206. package/dist-lib/lib/core/local/index.d.ts +69 -46
  207. package/dist-lib/lib/core/local/index.js +146 -129
  208. package/dist-lib/lib/core/membership.d.ts +12 -2
  209. package/dist-lib/lib/core/membership.js +55 -33
  210. package/dist-lib/lib/core/mesh-seed-handoff.js +7 -1
  211. package/dist-lib/lib/core/mesh.d.ts +37 -27
  212. package/dist-lib/lib/core/mesh.js +131 -73
  213. package/dist-lib/lib/core/migrations/agent-catalog.js +3 -2
  214. package/dist-lib/lib/core/migrations/agent-indexes.js +3 -3
  215. package/dist-lib/lib/core/migrations/file-index.js +7 -4
  216. package/dist-lib/lib/core/migrations/index.d.ts +4 -3
  217. package/dist-lib/lib/core/migrations/membership.js +9 -4
  218. package/dist-lib/lib/core/migrations/seal.js +3 -2
  219. package/dist-lib/lib/core/min-version.js +4 -2
  220. package/dist-lib/lib/core/next-frame.d.ts +5 -4
  221. package/dist-lib/lib/core/next-frame.js +6 -3
  222. package/dist-lib/lib/core/notification.d.ts +5 -1
  223. package/dist-lib/lib/core/notification.js +89 -77
  224. package/dist-lib/lib/core/ota-config.js +2 -1
  225. package/dist-lib/lib/core/pdf/rasterize.d.ts +18 -0
  226. package/dist-lib/lib/core/pdf/rasterize.js +57 -0
  227. package/dist-lib/lib/core/prompt-history.js +4 -2
  228. package/dist-lib/lib/core/range.d.ts +4 -4
  229. package/dist-lib/lib/core/range.js +12 -6
  230. package/dist-lib/lib/core/rank.d.ts +5 -4
  231. package/dist-lib/lib/core/rank.js +2 -1
  232. package/dist-lib/lib/core/send.d.ts +4 -4
  233. package/dist-lib/lib/core/send.js +6 -3
  234. package/dist-lib/lib/core/skill-overlay-receiver.js +7 -4
  235. package/dist-lib/lib/core/skill-secrets.js +16 -9
  236. package/dist-lib/lib/core/sync/chunks.js +2 -1
  237. package/dist-lib/lib/core/sync/devices.js +3 -1
  238. package/dist-lib/lib/core/sync/files.d.ts +2 -4
  239. package/dist-lib/lib/core/sync/files.js +28 -20
  240. package/dist-lib/lib/core/sync/index.d.ts +2 -5
  241. package/dist-lib/lib/core/sync/index.js +20 -15
  242. package/dist-lib/lib/core/sync-status.js +10 -7
  243. package/dist-lib/lib/core/system-info.js +4 -2
  244. package/dist-lib/lib/core/tool-activity.d.ts +4 -3
  245. package/dist-lib/lib/core/tool-activity.js +1 -1
  246. package/dist-lib/lib/core/tool-configs.js +12 -7
  247. package/dist-lib/lib/core.d.ts +38 -26
  248. package/dist-lib/lib/core.js +987 -539
  249. package/dist-lib/lib/credential-pusher.d.ts +12 -17
  250. package/dist-lib/lib/credential-pusher.js +61 -42
  251. package/dist-lib/lib/custom-model-pusher.d.ts +7 -3
  252. package/dist-lib/lib/custom-model-pusher.js +15 -7
  253. package/dist-lib/lib/custom-model-task.d.ts +1 -0
  254. package/dist-lib/lib/custom-model-task.js +12 -0
  255. package/dist-lib/lib/deadline.js +4 -2
  256. package/dist-lib/lib/diagnostics.d.ts +1 -5
  257. package/dist-lib/lib/frame-readable.d.ts +3 -0
  258. package/dist-lib/lib/frame-readable.js +3 -0
  259. package/dist-lib/lib/fs-drive-bridge.js +24 -14
  260. package/dist-lib/lib/fs-grants.js +13 -8
  261. package/dist-lib/lib/guards.d.ts +3 -0
  262. package/dist-lib/lib/guards.js +9 -0
  263. package/dist-lib/lib/inference-calls.d.ts +28 -23
  264. package/dist-lib/lib/inference-calls.js +25 -13
  265. package/dist-lib/lib/integrations/mcp-providers.d.ts +2 -2
  266. package/dist-lib/lib/integrations/setup-routes.d.ts +2 -2
  267. package/dist-lib/lib/knowledge-search.d.ts +6 -5
  268. package/dist-lib/lib/knowledge-search.js +26 -18
  269. package/dist-lib/lib/kv-cache-reclaim.js +4 -2
  270. package/dist-lib/lib/kv-cache.js +8 -4
  271. package/dist-lib/lib/legacy-core-domain.d.ts +42 -42
  272. package/dist-lib/lib/log-buffer.js +2 -1
  273. package/dist-lib/lib/log.js +25 -15
  274. package/dist-lib/lib/mesh-scoped-engine.js +12 -4
  275. package/dist-lib/lib/model-catalog-revision.js +6 -3
  276. package/dist-lib/lib/model-clamp.js +6 -3
  277. package/dist-lib/lib/model-context.d.ts +8 -3
  278. package/dist-lib/lib/model-context.js +13 -5
  279. package/dist-lib/lib/model-download-status.js +4 -2
  280. package/dist-lib/lib/model-download.d.ts +12 -4
  281. package/dist-lib/lib/model-download.js +200 -103
  282. package/dist-lib/lib/model-idle-pusher.d.ts +2 -2
  283. package/dist-lib/lib/model-idle-pusher.js +3 -4
  284. package/dist-lib/lib/oauth/browser-connect.d.ts +10 -8
  285. package/dist-lib/lib/oauth/browser-connect.js +33 -20
  286. package/dist-lib/lib/oauth/client.d.ts +2 -2
  287. package/dist-lib/lib/oauth/flow-core.js +23 -9
  288. package/dist-lib/lib/oauth/flow.d.ts +1 -3
  289. package/dist-lib/lib/oauth/flow.js +9 -5
  290. package/dist-lib/lib/oauth/keys.d.ts +4 -4
  291. package/dist-lib/lib/oauth/keys.js +18 -12
  292. package/dist-lib/lib/oauth/loopback.d.ts +2 -2
  293. package/dist-lib/lib/oauth/loopback.js +147 -107
  294. package/dist-lib/lib/oauth/loopback.stub.d.ts +2 -2
  295. package/dist-lib/lib/oauth/loopback.stub.js +1 -1
  296. package/dist-lib/lib/oauth/pkce.d.ts +4 -2
  297. package/dist-lib/lib/oauth/pkce.js +10 -0
  298. package/dist-lib/lib/oauth/providers.js +5 -5
  299. package/dist-lib/lib/oauth/redirect-types.d.ts +12 -7
  300. package/dist-lib/lib/oauth/register.js +3 -2
  301. package/dist-lib/lib/oauth/registry.d.ts +2 -2
  302. package/dist-lib/lib/oauth/registry.js +2 -1
  303. package/dist-lib/lib/oauth/resolve.d.ts +30 -10
  304. package/dist-lib/lib/oauth/resolve.js +12 -6
  305. package/dist-lib/lib/oauth/token-exchange-core.d.ts +12 -4
  306. package/dist-lib/lib/oauth/token-exchange-core.js +1 -1
  307. package/dist-lib/lib/oauth/types.d.ts +12 -12
  308. package/dist-lib/lib/oauth.d.ts +4 -5
  309. package/dist-lib/lib/oauth.js +2 -3
  310. package/dist-lib/lib/reconnecting-watch.d.ts +1 -1
  311. package/dist-lib/lib/reconnecting-watch.js +6 -6
  312. package/dist-lib/lib/retry-budget.js +6 -3
  313. package/dist-lib/lib/run-notices.d.ts +1 -0
  314. package/dist-lib/lib/run-notices.js +5 -2
  315. package/dist-lib/lib/run-transcript.d.ts +2 -4
  316. package/dist-lib/lib/run-transcript.js +4 -2
  317. package/dist-lib/lib/skill-readiness.js +4 -2
  318. package/dist-lib/lib/skill-types.d.ts +16 -16
  319. package/dist-lib/lib/suspend-lifecycle.d.ts +4 -4
  320. package/dist-lib/lib/suspend-lifecycle.js +10 -5
  321. package/dist-lib/lib/task.js +22 -12
  322. package/dist-lib/lib/unref.d.ts +3 -2
  323. package/dist-lib/lib/unref.js +2 -1
  324. package/dist-lib/lib/wav-duration.js +10 -5
  325. package/dist-lib/lib/write-queue.d.ts +5 -4
  326. package/dist-lib/lib/write-queue.js +2 -1
  327. package/dist-lib/schema/build.js +10 -6
  328. package/dist-lib/schema/config.d.ts +2 -3
  329. package/dist-lib/schema/content.d.ts +17 -2
  330. package/dist-lib/schema/content.js +2 -1
  331. package/dist-lib/schema/engine.d.ts +3 -2
  332. package/dist-lib/schema/engine.js +95 -6
  333. package/dist-lib/schema/field-order.js +22 -11
  334. package/dist-lib/schema/indexes.d.ts +22 -0
  335. package/dist-lib/schema/{helpers.js → indexes.js} +14 -57
  336. package/dist-lib/schema/local.d.ts +3 -2
  337. package/dist-lib/schema/local.js +7 -2
  338. package/dist-lib/schema/media-kind.d.ts +8 -0
  339. package/dist-lib/schema/media-kind.js +52 -0
  340. package/dist-lib/schema/qvac.d.ts +12 -9
  341. package/dist-lib/schema/qvac.js +8 -4
  342. package/dist-lib/spec/bind.js +12 -0
  343. package/dist-lib/spec/calls.js +4 -0
  344. package/dist-lib/spec/capabilities.d.ts +12 -4
  345. package/dist-lib/spec/hrpc/hrpc.json +54 -2
  346. package/dist-lib/spec/hrpc/index.js +53 -5
  347. package/dist-lib/spec/hrpc/messages.js +783 -494
  348. package/dist-lib/spec/hyperschema/index.js +783 -494
  349. package/dist-lib/spec/hyperschema/schema.json +247 -1
  350. package/dist-lib/spec/hyperschema/types.d.ts +69 -1
  351. package/dist-lib/spec/local/hyperdb/index.js +1 -1
  352. package/dist-lib/spec/local/hyperdb/messages.js +82 -14
  353. package/dist-lib/spec/local/hyperschema/index.js +42 -8
  354. package/dist-lib/spec/local/hyperschema/schema.json +27 -1
  355. package/dist-lib/spec/local/hyperschema/types.d.ts +6 -1
  356. package/dist-lib/spec/mesh/hyperdb/index.js +1 -1
  357. package/package.json +7 -3
  358. package/tui/app.mjs +2424 -941
  359. package/tui/boot.mjs +17 -46
  360. package/tui/index.mjs +10 -5
  361. package/tui/lib/boot-timing.mjs +8 -8
  362. package/tui/lib/busy-words.mjs +21 -22
  363. package/tui/lib/export.mjs +100 -32
  364. package/tui/lib/knowledge-command.mjs +64 -19
  365. package/tui/lib/knowledge-import.mjs +52 -18
  366. package/tui/lib/render.mjs +65 -33
  367. package/tui/lib/save-file.mjs +30 -13
  368. package/tui/lib/select.mjs +23 -5
  369. package/tui/lib/selection.mjs +6 -4
  370. package/tui/lib/setup.mjs +11 -19
  371. package/tui/lib/sidebar.mjs +23 -13
  372. package/tui/lib/splash.mjs +6 -7
  373. package/tui/lib/upload-frames.mjs +1 -2
  374. package/tui/lib/usage.mjs +13 -9
  375. package/tui/lib/wrap.mjs +35 -6
  376. package/tui/main.mjs +54 -78
  377. package/worker/assistant-sidecar.mjs +5 -10
  378. package/worker/stow-entry.mjs +7 -4
  379. package/dist-lib/lib/custom-model-source.d.ts +0 -15
  380. package/dist-lib/lib/custom-model-source.js +0 -46
  381. package/dist-lib/lib/oauth/common.d.ts +0 -38
  382. package/dist-lib/lib/oauth/common.js +0 -34
  383. package/dist-lib/schema/helpers.d.ts +0 -33
@@ -1,20 +1,14 @@
1
1
  import crypto from 'hypercore-crypto';
2
2
  import { parseBlobReferenceCoreKey } from './files/index.js';
3
3
  import { Mesh } from './mesh.js';
4
- const AGENTS = '@qvac/agents';
5
- const ACTIVE_AGENTS = '@qvac/active-agents';
6
- const ACTIVE_CHATS = '@qvac/active-chats';
7
- const ACTIVE_CHAT_GROUPS = '@qvac/active-chat-groups';
8
- const ACTIVE_TOOL_CONFIGS_BY_AGENT = '@qvac/active-tool-configs-by-agent';
9
- const CHUNKS = '@qvac/chunks';
10
- const CHUNKS_BY_CHAT = '@qvac/chunks-by-chat';
11
- const KNOWLEDGE = '@qvac/knowledge';
4
+ import { ACTIVE_AGENTS, ACTIVE_CHATS, ACTIVE_CHAT_GROUPS, ACTIVE_TOOL_CONFIGS_BY_AGENT, AGENTS, CHUNKS, CHUNKS_BY_CHAT, KNOWLEDGE } from './collections.js';
12
5
  const MIGRATED_SUFFIX = ' (migrated)';
13
6
  export const NO_ARCHIVE_HELD = 'No archive is held for this mesh';
14
- export async function withArchivedMesh(store, row, opts, fn) {
15
- if (!(await opts.storage.hasCore(crypto.discoveryKey(row.key))))
7
+ export async function withArchivedMesh(row, opts, fn) {
8
+ if (!(await opts.storage.hasCore(crypto.discoveryKey(row.key)))) {
16
9
  throw new Error(NO_ARCHIVE_HELD);
17
- const mesh = new Mesh(store, {
10
+ }
11
+ const mesh = new Mesh(opts.store, {
18
12
  seed: row.seed,
19
13
  key: row.key,
20
14
  deviceId: opts.deviceId,
@@ -23,8 +17,9 @@ export async function withArchivedMesh(store, row, opts, fn) {
23
17
  });
24
18
  await mesh.ready();
25
19
  try {
26
- if (mesh.localLength === 0)
20
+ if (mesh.localLength === 0) {
27
21
  throw new Error(NO_ARCHIVE_HELD);
22
+ }
28
23
  await mesh.autobee.update();
29
24
  return await fn(mesh);
30
25
  }
@@ -46,12 +41,14 @@ export async function countContents(mesh, into) {
46
41
  }
47
42
  }
48
43
  async function countAgents(snap, into) {
49
- if (!into)
44
+ if (!into) {
50
45
  return count(snap.find(ACTIVE_AGENTS));
46
+ }
51
47
  let appendable = 0;
52
48
  for (const row of await snap.find(ACTIVE_AGENTS).toArray()) {
53
- if (!(await alreadyHeld(into, row)))
49
+ if (!(await alreadyHeld(into, row))) {
54
50
  appendable++;
51
+ }
55
52
  }
56
53
  return appendable;
57
54
  }
@@ -63,13 +60,16 @@ export async function migrateContents(from, into) {
63
60
  const knowledge = await liveKnowledge(snap);
64
61
  const batch = into.batch();
65
62
  const agents = await migrateAgents(snap, into, batch);
66
- for (const group of groups)
63
+ for (const group of groups) {
67
64
  batch.dispatch('put-chat-group', { group: stripped(group) });
68
- for (const chat of chats)
65
+ }
66
+ for (const chat of chats) {
69
67
  batch.dispatch('put-chat', { chat: stripped(chat) });
68
+ }
70
69
  await batch.flush();
71
- for (const chat of chats)
72
- await migrateChunks(snap, from, into, chat.id);
70
+ for (const chat of chats) {
71
+ await migrateChunks(snap, chat.id, { from, into });
72
+ }
73
73
  let carried = 0;
74
74
  for (const row of knowledge) {
75
75
  if (await into.view.get(KNOWLEDGE, { id: row.id })) {
@@ -77,8 +77,9 @@ export async function migrateContents(from, into) {
77
77
  continue;
78
78
  }
79
79
  const blobId = await copyBlob(from, into, row.blobId);
80
- if (!blobId)
80
+ if (!blobId) {
81
81
  continue;
82
+ }
82
83
  batch.dispatch('add-knowledge', { knowledge: { ...stripped(row), blobId } });
83
84
  await batch.flush();
84
85
  carried++;
@@ -113,7 +114,7 @@ async function migrateAgents(snap, into, batch) {
113
114
  async function alreadyHeld(into, row) {
114
115
  return !!(await into.view.get(AGENTS, { id: row.id }));
115
116
  }
116
- async function migrateChunks(snap, from, into, chatId) {
117
+ async function migrateChunks(snap, chatId, { from, into }) {
117
118
  const chunks = await snap
118
119
  .find(CHUNKS_BY_CHAT, { gte: { chatId }, lte: { chatId } })
119
120
  .toArray();
@@ -127,8 +128,9 @@ async function migrateChunks(snap, from, into, chatId) {
127
128
  continue;
128
129
  }
129
130
  const blobId = await copyBlob(from, into, attachment.blobId);
130
- if (!blobId)
131
+ if (!blobId) {
131
132
  continue;
133
+ }
132
134
  batch.dispatch('append-chunk', { ...op, attachment: { ...attachment, blobId } });
133
135
  await batch.flush();
134
136
  await into.fileIndex?.record([{ ...chunk, attachment: { ...attachment, blobId } }]);
@@ -157,7 +159,8 @@ async function liveKnowledge(snap) {
157
159
  }
158
160
  async function count(stream) {
159
161
  let total = 0;
160
- for await (const _row of stream)
162
+ for await (const _row of stream) {
161
163
  total++;
164
+ }
162
165
  return total;
163
166
  }
@@ -48,14 +48,19 @@ export function toAsyncIterable(streamOrIterable) {
48
48
  return { done: true, value: undefined };
49
49
  },
50
50
  next() {
51
- if (!queue.length && !ended && !error)
51
+ if (!queue.length && !ended && !error) {
52
52
  stream.resume?.();
53
- if (queue.length)
54
- return Promise.resolve({ value: queue.shift(), done: false });
55
- if (ended)
53
+ }
54
+ if (queue.length) {
55
+ const [value] = queue.splice(0, 1);
56
+ return Promise.resolve({ value, done: false });
57
+ }
58
+ if (ended) {
56
59
  return Promise.resolve({ value: undefined, done: true });
57
- if (error)
60
+ }
61
+ if (error) {
58
62
  return Promise.reject(error);
63
+ }
59
64
  return new Promise((resolve, reject) => {
60
65
  waiting = { resolve, reject };
61
66
  });
@@ -1,7 +1,7 @@
1
- export type LinkableAttachment = {
1
+ export interface LinkableAttachment {
2
2
  readonly blobId: string;
3
3
  readonly mimeType: string;
4
4
  readonly deletedAt?: number;
5
- };
5
+ }
6
6
  export type AttachmentUrl = (attachment: LinkableAttachment) => string | null;
7
7
  export declare function linkAttachment<T extends LinkableAttachment>(mint: AttachmentUrl | null, attachment: T): T;
@@ -1,4 +1,4 @@
1
- import { mediaKindOf } from '../../schema/helpers.js';
1
+ import { mediaKindOf } from '../../schema/media-kind.js';
2
2
  export function isAudioAttachment(fileName, mimeType) {
3
3
  return mediaKindOf(mimeType, fileName) === 'audio';
4
4
  }
@@ -1,6 +1,6 @@
1
- export type BlindPeeringOpts = {
1
+ export interface BlindPeeringOpts {
2
2
  readonly batchIdleWait?: number;
3
3
  readonly batchMaxWait?: number;
4
- };
4
+ }
5
5
  export declare const BLIND_RELAY_KEYS: ReadonlyArray<Buffer>;
6
6
  export declare const BLIND_PEER_KEYS: ReadonlyArray<Buffer>;
@@ -1,7 +1,7 @@
1
1
  import type { Mesh } from './mesh.ts';
2
2
  export type ChatActivityState = 'queued' | 'running' | 'generating-image' | 'generating-audio' | 'transcribing-audio' | 'awaiting-approval';
3
- export type ChatActivityRow = {
3
+ export interface ChatActivityRow {
4
4
  readonly id: string;
5
5
  readonly activityState: ChatActivityState;
6
- };
6
+ }
7
7
  export declare function listChatActivity(store: Mesh, chatIds?: ReadonlyArray<string>): Promise<ChatActivityRow[]>;
@@ -1,7 +1,6 @@
1
1
  import ScopeLock from 'scope-lock';
2
2
  import { findChunksOfType } from './chunk.js';
3
- const ACTIVE_CHATS = '@qvac/active-chats';
4
- const CHUNKS = '@qvac/chunks';
3
+ import { ACTIVE_CHATS, CHUNKS } from './collections.js';
5
4
  const TERMINAL_RUN_STATES = new Set(['completed', 'failed', 'canceled']);
6
5
  const ACTIVITY_CHUNK_TYPES = [
7
6
  'run-request',
@@ -44,7 +43,7 @@ class ChatActivityCatalog {
44
43
  return [...this._states()]
45
44
  .filter(([id]) => !window || window.has(id))
46
45
  .map(([id, activityState]) => ({ id, activityState }))
47
- .sort((left, right) => (left.id < right.id ? -1 : left.id > right.id ? 1 : 0));
46
+ .sort((left, right) => compareIds(left.id, right.id));
48
47
  }
49
48
  finally {
50
49
  await snap.close();
@@ -69,26 +68,30 @@ class ChatActivityCatalog {
69
68
  }
70
69
  async _rebuild(snap, activeChatIds) {
71
70
  this._chats.clear();
72
- for (const chatId of activeChatIds)
71
+ for (const chatId of activeChatIds) {
73
72
  await this._loadChat(snap, chatId);
73
+ }
74
74
  }
75
75
  _prune(activeChatIds) {
76
76
  for (const chatId of this._chats.keys()) {
77
- if (!activeChatIds.has(chatId))
77
+ if (!activeChatIds.has(chatId)) {
78
78
  this._chats.delete(chatId);
79
+ }
79
80
  }
80
81
  }
81
82
  async _loadMissing(snap, activeChatIds) {
82
83
  for (const chatId of activeChatIds) {
83
- if (!this._chats.has(chatId))
84
+ if (!this._chats.has(chatId)) {
84
85
  await this._loadChat(snap, chatId);
86
+ }
85
87
  }
86
88
  }
87
89
  async _loadChat(snap, chatId) {
88
90
  const activity = { runs: new Map() };
89
91
  this._chats.set(chatId, activity);
90
- for (const chunk of await activityChunks(snap, chatId))
92
+ for (const chunk of await activityChunks(snap, chatId)) {
91
93
  applyChunk(activity, chunk);
94
+ }
92
95
  }
93
96
  async _applyChanges(snap, from, activeChatIds) {
94
97
  const chunksByChat = new Map();
@@ -97,19 +100,22 @@ class ChatActivityCatalog {
97
100
  continue;
98
101
  if (change.type === 'delete')
99
102
  return false;
100
- if (!activeChatIds.has(change.value.chatId))
103
+ if (!activeChatIds.has(change.value.chatId)) {
101
104
  continue;
105
+ }
102
106
  const chunks = chunksByChat.get(change.value.chatId) ?? [];
103
107
  chunks.push(change.value);
104
108
  chunksByChat.set(change.value.chatId, chunks);
105
109
  }
106
110
  for (const [chatId, chunks] of chunksByChat) {
107
111
  const activity = this._chats.get(chatId);
108
- if (!activity)
112
+ if (!activity) {
109
113
  continue;
114
+ }
110
115
  chunks.sort((left, right) => left.seq - right.seq);
111
- for (const chunk of chunks)
116
+ for (const chunk of chunks) {
112
117
  applyChunk(activity, chunk);
118
+ }
113
119
  }
114
120
  return true;
115
121
  }
@@ -117,19 +123,22 @@ class ChatActivityCatalog {
117
123
  const states = new Map();
118
124
  for (const [chatId, { runs }] of this._chats) {
119
125
  const active = [...runs.values()];
120
- if (active.length === 0)
126
+ if (active.length === 0) {
121
127
  continue;
128
+ }
122
129
  states.set(chatId, activityState(active));
123
130
  }
124
131
  return states;
125
132
  }
126
133
  }
127
134
  function activityState(runs) {
128
- if (runs.some((run) => run.pendingApprovals.size > 0))
135
+ if (runs.some((run) => run.pendingApprovals.size > 0)) {
129
136
  return 'awaiting-approval';
137
+ }
130
138
  const started = runs.filter((run) => run.started);
131
- if (started.length === 0)
139
+ if (started.length === 0) {
132
140
  return 'queued';
141
+ }
133
142
  return mediaState(latestRun(started)) ?? 'running';
134
143
  }
135
144
  function mediaState(run) {
@@ -137,14 +146,16 @@ function mediaState(run) {
137
146
  const tool = latestTool(run.tools);
138
147
  return tool && AUDIO_TOOLS.has(tool.name) ? 'generating-audio' : 'generating-image';
139
148
  }
140
- if (run.progress === 'transcribing')
149
+ if (run.progress === 'transcribing') {
141
150
  return 'transcribing-audio';
151
+ }
142
152
  return null;
143
153
  }
144
154
  function applyChunk(activity, chunk) {
145
155
  const runId = chunk.runId;
146
- if (!runId)
156
+ if (!runId) {
147
157
  return;
158
+ }
148
159
  if (chunk.type === 'run-request') {
149
160
  const existing = activity.runs.get(runId);
150
161
  if (existing) {
@@ -155,8 +166,9 @@ function applyChunk(activity, chunk) {
155
166
  return;
156
167
  }
157
168
  const run = activity.runs.get(runId);
158
- if (!run)
169
+ if (!run) {
159
170
  return;
171
+ }
160
172
  run.started = true;
161
173
  if (run.seen.has(chunk.id)) {
162
174
  applyMutableChunk(run, chunk);
@@ -180,12 +192,14 @@ function applyChunk(activity, chunk) {
180
192
  applyApproval(run, chunk);
181
193
  return;
182
194
  }
183
- if (chunk.seq <= run.attemptSeq)
195
+ if (chunk.seq <= run.attemptSeq) {
184
196
  return;
197
+ }
185
198
  if (chunk.type === 'tool-call') {
186
199
  const name = chunk.toolCall?.name;
187
- if (name && MEDIA_TOOLS.has(name))
200
+ if (name && MEDIA_TOOLS.has(name)) {
188
201
  run.tools.push({ name, seq: chunk.seq });
202
+ }
189
203
  }
190
204
  else if (chunk.type === 'tool-result') {
191
205
  settleTool(run.tools, chunk.toolResult?.name ?? '');
@@ -213,13 +227,15 @@ function applyMutableChunk(run, chunk) {
213
227
  }
214
228
  }
215
229
  function applyApproval(run, chunk) {
216
- if (chunk.approvalRequest?.status === 'pending')
230
+ if (chunk.approvalRequest?.status === 'pending') {
217
231
  run.pendingApprovals.add(chunk.id);
218
- else
232
+ }
233
+ else {
219
234
  run.pendingApprovals.delete(chunk.id);
235
+ }
220
236
  }
221
237
  async function activityChunks(snap, chatId) {
222
- const groups = await Promise.all(ACTIVITY_CHUNK_TYPES.map((type) => findChunksOfType(snap, chatId, type)));
238
+ const groups = await Promise.all(ACTIVITY_CHUNK_TYPES.map((type) => findChunksOfType(snap, { chatId, type })));
223
239
  return groups.flat().sort((left, right) => left.seq - right.seq);
224
240
  }
225
241
  function settleTool(tools, name) {
@@ -236,3 +252,8 @@ function latestTool(tools) {
236
252
  function latestRun(runs) {
237
253
  return runs.reduce((latest, run) => (run.requestSeq > latest.requestSeq ? run : latest));
238
254
  }
255
+ function compareIds(left, right) {
256
+ if (left < right)
257
+ return -1;
258
+ return left > right ? 1 : 0;
259
+ }
@@ -8,12 +8,14 @@ export declare function listChatGroups(store: Mesh): Promise<QvacChatGroup[]>;
8
8
  export declare function getChatGroup(store: Mesh, id: string): Promise<QvacChatGroup | null>;
9
9
  export declare function mustGetChatGroup(store: Mesh, id: string): Promise<QvacChatGroup>;
10
10
  export declare function mustGetActiveChatGroup(store: Mesh, id: string): Promise<QvacChatGroup>;
11
- export declare function createChatGroup(store: Mesh, input: {
12
- name: string;
13
- }): Promise<QvacChatGroup>;
11
+ export interface CreateChatGroupInput {
12
+ readonly name: string;
13
+ }
14
+ export declare function createChatGroup(store: Mesh, input: CreateChatGroupInput): Promise<QvacChatGroup>;
14
15
  export declare function renameChatGroup(store: Mesh, id: string, name: string): Promise<QvacChatGroup>;
15
- export declare function moveChatGroup(store: Mesh, id: string, { afterId }: {
16
- afterId?: string | null;
17
- }): Promise<QvacChatGroup>;
16
+ export interface MoveChatGroupOptions {
17
+ readonly afterId?: string | null;
18
+ }
19
+ export declare function moveChatGroup(store: Mesh, id: string, { afterId }: MoveChatGroupOptions): Promise<QvacChatGroup>;
18
20
  export declare function sortChatGroupsByName(store: Mesh): Promise<QvacChatGroup[]>;
19
21
  export declare function deleteChatGroup(store: Mesh, id: string): Promise<QvacChatGroup>;
@@ -1,19 +1,20 @@
1
1
  import { randomId } from './id.js';
2
2
  import { place } from './rank.js';
3
- const CHAT_GROUPS = '@qvac/chat-groups';
4
- const ACTIVE_CHAT_GROUPS = '@qvac/active-chat-groups';
3
+ import { ACTIVE_CHAT_GROUPS, CHAT_GROUPS } from './collections.js';
5
4
  const NAME_MAX_LENGTH = 100;
6
5
  export function groupSortKey(group) {
7
6
  return group.rank || 0;
8
7
  }
9
8
  export function byGroupOrder(a, b) {
10
9
  const ranked = groupSortKey(b) - groupSortKey(a);
11
- if (ranked)
10
+ if (ranked) {
12
11
  return ranked;
12
+ }
13
13
  const an = a.name.toLowerCase();
14
14
  const bn = b.name.toLowerCase();
15
- if (an !== bn)
15
+ if (an !== bn) {
16
16
  return an < bn ? -1 : 1;
17
+ }
17
18
  return a.id < b.id ? -1 : 1;
18
19
  }
19
20
  export async function listChatGroupsIn(snap) {
@@ -41,20 +42,23 @@ export async function getChatGroup(store, id) {
41
42
  }
42
43
  export async function mustGetChatGroup(store, id) {
43
44
  const group = await getChatGroup(store, id);
44
- if (!group)
45
+ if (!group) {
45
46
  throw new Error(`chat group not found: ${id}`);
47
+ }
46
48
  return group;
47
49
  }
48
50
  export async function mustGetActiveChatGroup(store, id) {
49
51
  const group = await mustGetChatGroup(store, id);
50
- if (group.deletedAt)
52
+ if (group.deletedAt) {
51
53
  throw new Error(`chat group not found: ${id}`);
54
+ }
52
55
  return group;
53
56
  }
54
57
  function assertGroupName(name) {
55
58
  const trimmed = name.trim();
56
- if (!trimmed)
59
+ if (!trimmed) {
57
60
  throw new Error('chat group name is required');
61
+ }
58
62
  if (trimmed.length > NAME_MAX_LENGTH) {
59
63
  throw new Error(`chat group name exceeds ${NAME_MAX_LENGTH} characters`);
60
64
  }
@@ -83,23 +87,26 @@ export async function renameChatGroup(store, id, name) {
83
87
  }
84
88
  export async function moveChatGroup(store, id, { afterId }) {
85
89
  const anchor = afterId || undefined;
86
- if (anchor === id)
90
+ if (anchor === id) {
87
91
  throw new Error(`a chat group cannot be placed after itself: ${id}`);
92
+ }
88
93
  const now = Date.now();
89
94
  const snap = store.view.snapshot();
90
95
  let current;
91
96
  let placement;
92
97
  try {
93
98
  const group = await snap.get(CHAT_GROUPS, { id });
94
- if (!group || group.deletedAt)
99
+ if (!group || group.deletedAt) {
95
100
  throw new Error(`chat group not found: ${id}`);
101
+ }
96
102
  current = group;
97
103
  const siblings = (await listChatGroupsIn(snap)).filter((sibling) => sibling.id !== id);
98
104
  let at = -1;
99
105
  if (anchor) {
100
106
  at = siblings.findIndex((sibling) => sibling.id === anchor);
101
- if (at === -1)
107
+ if (at === -1) {
102
108
  throw new Error(`chat group not found: ${anchor}`);
109
+ }
103
110
  }
104
111
  placement = place(siblings, groupSortKey, { at, now });
105
112
  }
@@ -2,19 +2,21 @@ import { type Sidebar } from './chat.ts';
2
2
  import type { openLocalStore } from './local/index.ts';
3
3
  import type { Mesh } from './mesh.ts';
4
4
  type LocalStore = ReturnType<typeof openLocalStore>;
5
- export declare function chatSortKey(chat: {
6
- rank?: number;
7
- rankedAt?: number;
8
- lastActivityAt: number;
9
- }): number;
5
+ export interface RankedChat {
6
+ readonly rank?: number;
7
+ readonly rankedAt?: number;
8
+ readonly lastActivityAt: number;
9
+ }
10
+ export declare function chatSortKey(chat: RankedChat): number;
10
11
  export declare function sortKeyBytes(value: number): Buffer;
11
12
  export declare function refreshChatOrder(mesh: Mesh, local: LocalStore, chatIds: Iterable<string>): Promise<void>;
12
13
  export declare function rebuildChatOrder(mesh: Mesh, local: LocalStore): Promise<void>;
13
14
  export interface ChatPage extends Sidebar {
14
15
  readonly nextCursor?: string;
15
16
  }
16
- export declare function listChatPage(mesh: Mesh, local: LocalStore, { limit, cursor }?: {
17
- limit?: number;
18
- cursor?: string;
19
- }): Promise<ChatPage>;
17
+ export interface ListChatPageOptions {
18
+ readonly limit?: number;
19
+ readonly cursor?: string;
20
+ }
21
+ export declare function listChatPage(mesh: Mesh, local: LocalStore, { limit, cursor }?: ListChatPageOptions): Promise<ChatPage>;
20
22
  export {};
@@ -1,9 +1,7 @@
1
1
  import b4a from 'b4a';
2
2
  import { enrichAll } from './chat.js';
3
3
  import { listChatGroupsIn } from './chat-group.js';
4
- const CHATS = '@qvac/chats';
5
- const ACTIVE_CHATS = '@qvac/active-chats';
6
- const CHUNK_COUNTERS = '@qvac/chunk-counters';
4
+ import { ACTIVE_CHATS, CHATS, CHUNK_COUNTERS } from './collections.js';
7
5
  export function chatSortKey(chat) {
8
6
  return chat.rank && (chat.rankedAt ?? 0) >= chat.lastActivityAt ? chat.rank : chat.lastActivityAt;
9
7
  }
@@ -2,16 +2,16 @@ import type { AbortSignal } from 'bare-abort-controller';
2
2
  import { type ChatListing } from './chat.ts';
3
3
  import type { Mesh } from './mesh.ts';
4
4
  export type ChatSearchMatch = 'title' | 'content';
5
- export type ChatSearchHit = {
5
+ export interface ChatSearchHit {
6
6
  readonly chat: ChatListing;
7
7
  readonly match: ChatSearchMatch;
8
8
  readonly snippet: string;
9
9
  readonly chunkId: string;
10
10
  readonly runId: string;
11
- };
12
- export type ChatSearchInput = {
11
+ }
12
+ export interface ChatSearchInput {
13
13
  readonly query: string;
14
14
  readonly limit?: number;
15
15
  readonly signal?: AbortSignal;
16
- };
16
+ }
17
17
  export declare function searchChats(store: Mesh, input: ChatSearchInput): Promise<ReadonlyArray<ChatSearchHit>>;