@qvac/core 0.4.1 → 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 (417) hide show
  1. package/CHANGELOG.md +262 -1
  2. package/README.md +1 -1
  3. package/dist-lib/lib/api/agents.js +3 -2
  4. package/dist-lib/lib/api/app-config.d.ts +1 -1
  5. package/dist-lib/lib/api/app-config.js +54 -15
  6. package/dist-lib/lib/api/attachments.d.ts +6 -5
  7. package/dist-lib/lib/api/attachments.js +4 -2
  8. package/dist-lib/lib/api/chat.d.ts +7 -3
  9. package/dist-lib/lib/api/chat.js +4 -4
  10. package/dist-lib/lib/api/chunks.js +3 -3
  11. package/dist-lib/lib/api/config.js +2 -2
  12. package/dist-lib/lib/api/current-mesh.d.ts +3 -4
  13. package/dist-lib/lib/api/current-mesh.js +9 -4
  14. package/dist-lib/lib/api/custom-models.d.ts +8 -1
  15. package/dist-lib/lib/api/custom-models.js +53 -16
  16. package/dist-lib/lib/api/devices.d.ts +14 -5
  17. package/dist-lib/lib/api/devices.js +14 -9
  18. package/dist-lib/lib/api/diagnostics.d.ts +1 -0
  19. package/dist-lib/lib/api/diagnostics.js +1 -1
  20. package/dist-lib/lib/api/effective-ctx-size.d.ts +6 -1
  21. package/dist-lib/lib/api/effective-ctx-size.js +5 -3
  22. package/dist-lib/lib/api/execution.js +9 -2
  23. package/dist-lib/lib/api/files.js +2 -1
  24. package/dist-lib/lib/api/index.d.ts +7 -1
  25. package/dist-lib/lib/api/index.js +101 -101
  26. package/dist-lib/lib/api/instrument.js +29 -20
  27. package/dist-lib/lib/api/knowledge.d.ts +6 -5
  28. package/dist-lib/lib/api/knowledge.js +8 -6
  29. package/dist-lib/lib/api/local-files.js +1 -1
  30. package/dist-lib/lib/api/logs.js +6 -3
  31. package/dist-lib/lib/api/members.js +22 -13
  32. package/dist-lib/lib/api/mesh.d.ts +7 -2
  33. package/dist-lib/lib/api/mesh.js +10 -5
  34. package/dist-lib/lib/api/model-download.js +1 -1
  35. package/dist-lib/lib/api/network.d.ts +1 -0
  36. package/dist-lib/lib/api/network.js +1 -1
  37. package/dist-lib/lib/api/notifications.js +23 -13
  38. package/dist-lib/lib/api/rag.d.ts +6 -1
  39. package/dist-lib/lib/api/rag.js +20 -11
  40. package/dist-lib/lib/api/range.d.ts +2 -2
  41. package/dist-lib/lib/api/sync.js +1 -1
  42. package/dist-lib/lib/api/tool-activity.js +7 -3
  43. package/dist-lib/lib/api/tool-configs.js +2 -4
  44. package/dist-lib/lib/api/upload-frames.d.ts +7 -8
  45. package/dist-lib/lib/api/upload-frames.js +2 -1
  46. package/dist-lib/lib/api/watchable.d.ts +6 -1
  47. package/dist-lib/lib/api/watchable.js +23 -14
  48. package/dist-lib/lib/assistant/fetch-body.js +4 -2
  49. package/dist-lib/lib/assistant/harness.d.ts +72 -24
  50. package/dist-lib/lib/assistant/harness.js +53 -15
  51. package/dist-lib/lib/assistant/history.d.ts +9 -7
  52. package/dist-lib/lib/assistant/history.js +77 -42
  53. package/dist-lib/lib/assistant/message.d.ts +5 -3
  54. package/dist-lib/lib/assistant/message.js +4 -2
  55. package/dist-lib/lib/assistant/skill-encode.d.ts +3 -1
  56. package/dist-lib/lib/assistant/skill-encode.js +52 -62
  57. package/dist-lib/lib/assistant-client.js +7 -4
  58. package/dist-lib/lib/assistant-tree.js +36 -11
  59. package/dist-lib/lib/assistant.d.ts +37 -12
  60. package/dist-lib/lib/assistant.js +977 -373
  61. package/dist-lib/lib/audio-format.d.ts +1 -1
  62. package/dist-lib/lib/audio-format.js +1 -1
  63. package/dist-lib/lib/chat-title.js +9 -4
  64. package/dist-lib/lib/client.js +3 -2
  65. package/dist-lib/lib/collabora/convert.d.ts +2 -2
  66. package/dist-lib/lib/collabora/convert.js +6 -3
  67. package/dist-lib/lib/collabora/entry.js +9 -5
  68. package/dist-lib/lib/collabora/protocol.d.ts +2 -2
  69. package/dist-lib/lib/collabora/protocol.js +14 -7
  70. package/dist-lib/lib/collabora/worker.js +14 -7
  71. package/dist-lib/lib/compaction.d.ts +5 -6
  72. package/dist-lib/lib/compaction.js +14 -7
  73. package/dist-lib/lib/constants.d.ts +2 -0
  74. package/dist-lib/lib/constants.js +4 -0
  75. package/dist-lib/lib/core/account-recovery.d.ts +4 -3
  76. package/dist-lib/lib/core/account-recovery.js +7 -4
  77. package/dist-lib/lib/core/agent.d.ts +0 -1
  78. package/dist-lib/lib/core/agent.js +18 -16
  79. package/dist-lib/lib/core/approval-rules.d.ts +7 -6
  80. package/dist-lib/lib/core/approval-rules.js +12 -6
  81. package/dist-lib/lib/core/archived-mesh.d.ts +7 -5
  82. package/dist-lib/lib/core/archived-mesh.js +25 -22
  83. package/dist-lib/lib/core/async-iterable.js +10 -5
  84. package/dist-lib/lib/core/attachment-link.d.ts +2 -2
  85. package/dist-lib/lib/core/audio-attachment.js +1 -1
  86. package/dist-lib/lib/core/blind-peers.d.ts +2 -2
  87. package/dist-lib/lib/core/chat-activity.d.ts +2 -2
  88. package/dist-lib/lib/core/chat-activity.js +42 -21
  89. package/dist-lib/lib/core/chat-group.d.ts +8 -6
  90. package/dist-lib/lib/core/chat-group.js +17 -10
  91. package/dist-lib/lib/core/chat-order.d.ts +11 -9
  92. package/dist-lib/lib/core/chat-order.js +1 -3
  93. package/dist-lib/lib/core/chat-search.d.ts +4 -4
  94. package/dist-lib/lib/core/chat-search.js +38 -24
  95. package/dist-lib/lib/core/chat.d.ts +20 -14
  96. package/dist-lib/lib/core/chat.js +42 -28
  97. package/dist-lib/lib/core/chunk.d.ts +20 -24
  98. package/dist-lib/lib/core/chunk.js +34 -22
  99. package/dist-lib/lib/core/collections.d.ts +69 -0
  100. package/dist-lib/lib/core/collections.js +69 -0
  101. package/dist-lib/lib/core/contract/activity.d.ts +8 -2
  102. package/dist-lib/lib/core/contract/activity.js +39 -11
  103. package/dist-lib/lib/core/contract/agents.js +3 -2
  104. package/dist-lib/lib/core/contract/approval-rules.js +1 -1
  105. package/dist-lib/lib/core/contract/attestations.js +1 -1
  106. package/dist-lib/lib/core/contract/chat-group.js +1 -1
  107. package/dist-lib/lib/core/contract/chat.js +1 -1
  108. package/dist-lib/lib/core/contract/chunks.js +16 -9
  109. package/dist-lib/lib/core/contract/compute.js +2 -1
  110. package/dist-lib/lib/core/contract/devices.js +10 -6
  111. package/dist-lib/lib/core/contract/grant-order.d.ts +5 -0
  112. package/dist-lib/lib/core/contract/grant-order.js +20 -0
  113. package/dist-lib/lib/core/contract/index.d.ts +1 -1
  114. package/dist-lib/lib/core/contract/index.js +27 -2
  115. package/dist-lib/lib/core/contract/indexing.js +3 -3
  116. package/dist-lib/lib/core/contract/invites.d.ts +16 -0
  117. package/dist-lib/lib/core/contract/invites.js +256 -0
  118. package/dist-lib/lib/core/contract/joined-meshes.js +22 -22
  119. package/dist-lib/lib/core/contract/knowledge.js +5 -5
  120. package/dist-lib/lib/core/contract/members.d.ts +15 -0
  121. package/dist-lib/lib/core/contract/members.js +116 -31
  122. package/dist-lib/lib/core/contract/mesh-kind.d.ts +6 -0
  123. package/dist-lib/lib/core/contract/mesh-kind.js +49 -0
  124. package/dist-lib/lib/core/contract/seal.js +1 -1
  125. package/dist-lib/lib/core/contract/seed-defaults.js +1 -3
  126. package/dist-lib/lib/core/contract/tool-activity.js +5 -5
  127. package/dist-lib/lib/core/contract/tool-configs.js +1 -2
  128. package/dist-lib/lib/core/contract/writers.d.ts +13 -0
  129. package/dist-lib/lib/core/contract/writers.js +181 -24
  130. package/dist-lib/lib/core/departures.js +16 -8
  131. package/dist-lib/lib/core/device-attestation.d.ts +5 -0
  132. package/dist-lib/lib/core/device-attestation.js +24 -0
  133. package/dist-lib/lib/core/device-invites.d.ts +2 -0
  134. package/dist-lib/lib/core/device-invites.js +29 -7
  135. package/dist-lib/lib/core/devices.d.ts +2 -1
  136. package/dist-lib/lib/core/devices.js +52 -2
  137. package/dist-lib/lib/core/document-attachment.d.ts +20 -11
  138. package/dist-lib/lib/core/document-attachment.js +10 -5
  139. package/dist-lib/lib/core/files/attachments.d.ts +2 -5
  140. package/dist-lib/lib/core/files/attachments.js +6 -3
  141. package/dist-lib/lib/core/files/index.d.ts +44 -52
  142. package/dist-lib/lib/core/files/index.js +142 -93
  143. package/dist-lib/lib/core/files/knowledge.d.ts +2 -5
  144. package/dist-lib/lib/core/files/local-index.js +9 -5
  145. package/dist-lib/lib/core/files/preview/image.d.ts +0 -1
  146. package/dist-lib/lib/core/files/preview/image.js +9 -6
  147. package/dist-lib/lib/core/files/preview/index.d.ts +8 -11
  148. package/dist-lib/lib/core/files/preview/index.js +20 -15
  149. package/dist-lib/lib/core/files/processing/claims.d.ts +6 -5
  150. package/dist-lib/lib/core/files/processing/claims.js +16 -8
  151. package/dist-lib/lib/core/files/processing/document.d.ts +21 -50
  152. package/dist-lib/lib/core/files/processing/index.d.ts +18 -13
  153. package/dist-lib/lib/core/files/processing/index.js +65 -37
  154. package/dist-lib/lib/core/files/processing/ownership.d.ts +8 -1
  155. package/dist-lib/lib/core/files/processing/ownership.js +1 -1
  156. package/dist-lib/lib/core/files/processing/protocol.d.ts +19 -19
  157. package/dist-lib/lib/core/files/processing/protocol.js +5 -5
  158. package/dist-lib/lib/core/files/processing/settle.d.ts +10 -7
  159. package/dist-lib/lib/core/files/processing/settle.js +22 -11
  160. package/dist-lib/lib/core/files/processing/source.js +14 -8
  161. package/dist-lib/lib/core/files/processing/state.d.ts +13 -11
  162. package/dist-lib/lib/core/files/processing/state.js +19 -12
  163. package/dist-lib/lib/core/files/rag/build.d.ts +2 -2
  164. package/dist-lib/lib/core/files/rag/build.js +2 -1
  165. package/dist-lib/lib/core/files/rag/document-types.d.ts +4 -6
  166. package/dist-lib/lib/core/files/rag/index.d.ts +10 -13
  167. package/dist-lib/lib/core/files/rag/index.js +3 -2
  168. package/dist-lib/lib/core/files/rag/load.d.ts +10 -9
  169. package/dist-lib/lib/core/files/rag/load.js +26 -13
  170. package/dist-lib/lib/core/files/rag/policy.js +2 -1
  171. package/dist-lib/lib/core/files/rag/produce.js +33 -19
  172. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +5 -3
  173. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +30 -10
  174. package/dist-lib/lib/core/files/records/chunks.js +4 -2
  175. package/dist-lib/lib/core/files/records/knowledge.d.ts +10 -11
  176. package/dist-lib/lib/core/files/records/knowledge.js +9 -8
  177. package/dist-lib/lib/core/files/records/linkage.js +6 -3
  178. package/dist-lib/lib/core/files/records/output.d.ts +5 -4
  179. package/dist-lib/lib/core/files/records/output.js +8 -4
  180. package/dist-lib/lib/core/files/records/reclaim.js +41 -25
  181. package/dist-lib/lib/core/files/records/routing.d.ts +4 -6
  182. package/dist-lib/lib/core/files/records/routing.js +15 -8
  183. package/dist-lib/lib/core/files/records/source.d.ts +5 -4
  184. package/dist-lib/lib/core/files/records/source.js +20 -14
  185. package/dist-lib/lib/core/files/records/sweep.js +1 -3
  186. package/dist-lib/lib/core/files/store/blob.d.ts +10 -10
  187. package/dist-lib/lib/core/files/store/blob.js +25 -19
  188. package/dist-lib/lib/core/files/store/index.d.ts +1 -6
  189. package/dist-lib/lib/core/files/store/index.js +4 -4
  190. package/dist-lib/lib/core/files/store/inline.d.ts +2 -2
  191. package/dist-lib/lib/core/files/store/inline.js +6 -3
  192. package/dist-lib/lib/core/files/store/reference.d.ts +6 -9
  193. package/dist-lib/lib/core/files/store/reference.js +25 -17
  194. package/dist-lib/lib/core/files/store/server.d.ts +7 -6
  195. package/dist-lib/lib/core/files/store/server.js +22 -11
  196. package/dist-lib/lib/core/files/store/sweep.js +13 -7
  197. package/dist-lib/lib/core/files/upload-input.d.ts +4 -12
  198. package/dist-lib/lib/core/files/upload-input.js +10 -5
  199. package/dist-lib/lib/core/files/upload.d.ts +27 -24
  200. package/dist-lib/lib/core/files/upload.js +74 -51
  201. package/dist-lib/lib/core/fs-drives.js +4 -2
  202. package/dist-lib/lib/core/grant-expiry.d.ts +11 -0
  203. package/dist-lib/lib/core/grant-expiry.js +66 -0
  204. package/dist-lib/lib/core/handoff-channel.d.ts +2 -1
  205. package/dist-lib/lib/core/handoff-channel.js +36 -15
  206. package/dist-lib/lib/core/harness-loan.js +35 -17
  207. package/dist-lib/lib/core/helpers/index.d.ts +2 -1
  208. package/dist-lib/lib/core/helpers/index.js +11 -6
  209. package/dist-lib/lib/core/hosted-agents.js +19 -12
  210. package/dist-lib/lib/core/id.js +1 -1
  211. package/dist-lib/lib/core/identity.d.ts +1 -0
  212. package/dist-lib/lib/core/identity.js +11 -3
  213. package/dist-lib/lib/core/image/cache-sweep.d.ts +12 -10
  214. package/dist-lib/lib/core/image/cache-sweep.js +11 -6
  215. package/dist-lib/lib/core/image/normalize.d.ts +6 -0
  216. package/dist-lib/lib/core/image/normalize.js +12 -2
  217. package/dist-lib/lib/core/image/sniff.js +42 -21
  218. package/dist-lib/lib/core/inference-calls-receiver.js +7 -4
  219. package/dist-lib/lib/core/invite-grants.d.ts +20 -0
  220. package/dist-lib/lib/core/invite-grants.js +46 -0
  221. package/dist-lib/lib/core/invite.d.ts +3 -0
  222. package/dist-lib/lib/core/invite.js +6 -3
  223. package/dist-lib/lib/core/local/files.js +20 -19
  224. package/dist-lib/lib/core/local/index.d.ts +70 -45
  225. package/dist-lib/lib/core/local/index.js +157 -126
  226. package/dist-lib/lib/core/membership.d.ts +15 -2
  227. package/dist-lib/lib/core/membership.js +95 -20
  228. package/dist-lib/lib/core/mesh-seed-handoff.d.ts +12 -4
  229. package/dist-lib/lib/core/mesh-seed-handoff.js +23 -5
  230. package/dist-lib/lib/core/mesh.d.ts +57 -30
  231. package/dist-lib/lib/core/mesh.js +232 -78
  232. package/dist-lib/lib/core/migrations/agent-catalog.js +3 -2
  233. package/dist-lib/lib/core/migrations/agent-indexes.js +3 -3
  234. package/dist-lib/lib/core/migrations/device-indexes.d.ts +2 -0
  235. package/dist-lib/lib/core/migrations/device-indexes.js +7 -0
  236. package/dist-lib/lib/core/migrations/file-index.js +7 -4
  237. package/dist-lib/lib/core/migrations/index.d.ts +4 -3
  238. package/dist-lib/lib/core/migrations/index.js +3 -1
  239. package/dist-lib/lib/core/migrations/membership.js +9 -4
  240. package/dist-lib/lib/core/migrations/seal.js +3 -2
  241. package/dist-lib/lib/core/min-version.js +4 -2
  242. package/dist-lib/lib/core/next-frame.d.ts +5 -4
  243. package/dist-lib/lib/core/next-frame.js +6 -3
  244. package/dist-lib/lib/core/notification.d.ts +5 -1
  245. package/dist-lib/lib/core/notification.js +89 -77
  246. package/dist-lib/lib/core/ota-config.js +2 -1
  247. package/dist-lib/lib/core/pdf/rasterize.d.ts +18 -0
  248. package/dist-lib/lib/core/pdf/rasterize.js +57 -0
  249. package/dist-lib/lib/core/prompt-history.js +4 -2
  250. package/dist-lib/lib/core/range.d.ts +4 -4
  251. package/dist-lib/lib/core/range.js +12 -6
  252. package/dist-lib/lib/core/rank.d.ts +5 -4
  253. package/dist-lib/lib/core/rank.js +2 -1
  254. package/dist-lib/lib/core/send.d.ts +8 -5
  255. package/dist-lib/lib/core/send.js +9 -3
  256. package/dist-lib/lib/core/skill-overlay-receiver.js +7 -4
  257. package/dist-lib/lib/core/skill-secrets.js +16 -9
  258. package/dist-lib/lib/core/sync/chunks.js +2 -1
  259. package/dist-lib/lib/core/sync/devices.js +3 -1
  260. package/dist-lib/lib/core/sync/files.d.ts +2 -4
  261. package/dist-lib/lib/core/sync/files.js +28 -20
  262. package/dist-lib/lib/core/sync/index.d.ts +2 -5
  263. package/dist-lib/lib/core/sync/index.js +33 -17
  264. package/dist-lib/lib/core/sync-status.js +10 -7
  265. package/dist-lib/lib/core/system-info.js +4 -2
  266. package/dist-lib/lib/core/tool-activity.d.ts +4 -3
  267. package/dist-lib/lib/core/tool-activity.js +1 -1
  268. package/dist-lib/lib/core/tool-configs.js +12 -7
  269. package/dist-lib/lib/core.d.ts +107 -45
  270. package/dist-lib/lib/core.js +1765 -595
  271. package/dist-lib/lib/credential-pusher.d.ts +12 -17
  272. package/dist-lib/lib/credential-pusher.js +61 -42
  273. package/dist-lib/lib/custom-model-pusher.d.ts +7 -3
  274. package/dist-lib/lib/custom-model-pusher.js +15 -7
  275. package/dist-lib/lib/custom-model-task.d.ts +1 -0
  276. package/dist-lib/lib/custom-model-task.js +12 -0
  277. package/dist-lib/lib/deadline.js +4 -2
  278. package/dist-lib/lib/diagnostics.d.ts +1 -5
  279. package/dist-lib/lib/frame-readable.d.ts +3 -0
  280. package/dist-lib/lib/frame-readable.js +3 -0
  281. package/dist-lib/lib/fs-drive-bridge.js +24 -14
  282. package/dist-lib/lib/fs-grants.js +13 -8
  283. package/dist-lib/lib/guards.d.ts +3 -0
  284. package/dist-lib/lib/guards.js +9 -0
  285. package/dist-lib/lib/inference-calls.d.ts +28 -23
  286. package/dist-lib/lib/inference-calls.js +25 -13
  287. package/dist-lib/lib/integrations/mcp-providers.d.ts +2 -2
  288. package/dist-lib/lib/integrations/setup-routes.d.ts +2 -2
  289. package/dist-lib/lib/knowledge-search.d.ts +6 -5
  290. package/dist-lib/lib/knowledge-search.js +26 -18
  291. package/dist-lib/lib/kv-cache-reclaim.js +4 -2
  292. package/dist-lib/lib/kv-cache.js +8 -4
  293. package/dist-lib/lib/legacy-core-domain.d.ts +42 -42
  294. package/dist-lib/lib/log-buffer.js +2 -1
  295. package/dist-lib/lib/log.js +25 -15
  296. package/dist-lib/lib/mesh-scoped-engine.js +14 -4
  297. package/dist-lib/lib/model-catalog-revision.js +6 -3
  298. package/dist-lib/lib/model-clamp.js +6 -3
  299. package/dist-lib/lib/model-context.d.ts +8 -3
  300. package/dist-lib/lib/model-context.js +13 -5
  301. package/dist-lib/lib/model-download-status.js +4 -2
  302. package/dist-lib/lib/model-download.d.ts +12 -4
  303. package/dist-lib/lib/model-download.js +200 -103
  304. package/dist-lib/lib/model-idle-pusher.d.ts +10 -0
  305. package/dist-lib/lib/model-idle-pusher.js +41 -0
  306. package/dist-lib/lib/oauth/browser-connect.d.ts +10 -8
  307. package/dist-lib/lib/oauth/browser-connect.js +33 -20
  308. package/dist-lib/lib/oauth/client.d.ts +2 -2
  309. package/dist-lib/lib/oauth/flow-core.js +23 -9
  310. package/dist-lib/lib/oauth/flow.d.ts +1 -3
  311. package/dist-lib/lib/oauth/flow.js +9 -5
  312. package/dist-lib/lib/oauth/keys.d.ts +4 -4
  313. package/dist-lib/lib/oauth/keys.js +18 -12
  314. package/dist-lib/lib/oauth/loopback.d.ts +2 -2
  315. package/dist-lib/lib/oauth/loopback.js +147 -107
  316. package/dist-lib/lib/oauth/loopback.stub.d.ts +2 -2
  317. package/dist-lib/lib/oauth/loopback.stub.js +1 -1
  318. package/dist-lib/lib/oauth/pkce.d.ts +4 -2
  319. package/dist-lib/lib/oauth/pkce.js +10 -0
  320. package/dist-lib/lib/oauth/providers.js +5 -5
  321. package/dist-lib/lib/oauth/redirect-types.d.ts +12 -7
  322. package/dist-lib/lib/oauth/register.js +3 -2
  323. package/dist-lib/lib/oauth/registry.d.ts +2 -2
  324. package/dist-lib/lib/oauth/registry.js +2 -1
  325. package/dist-lib/lib/oauth/resolve.d.ts +30 -10
  326. package/dist-lib/lib/oauth/resolve.js +12 -6
  327. package/dist-lib/lib/oauth/token-exchange-core.d.ts +12 -4
  328. package/dist-lib/lib/oauth/token-exchange-core.js +1 -1
  329. package/dist-lib/lib/oauth/types.d.ts +12 -12
  330. package/dist-lib/lib/oauth.d.ts +4 -5
  331. package/dist-lib/lib/oauth.js +2 -3
  332. package/dist-lib/lib/reconnecting-watch.d.ts +1 -1
  333. package/dist-lib/lib/reconnecting-watch.js +6 -6
  334. package/dist-lib/lib/retry-budget.js +6 -3
  335. package/dist-lib/lib/run-notices.d.ts +2 -0
  336. package/dist-lib/lib/run-notices.js +7 -3
  337. package/dist-lib/lib/run-transcript.d.ts +2 -4
  338. package/dist-lib/lib/run-transcript.js +4 -2
  339. package/dist-lib/lib/skill-readiness.d.ts +1 -0
  340. package/dist-lib/lib/skill-readiness.js +17 -2
  341. package/dist-lib/lib/skill-types.d.ts +16 -16
  342. package/dist-lib/lib/suspend-lifecycle.d.ts +4 -4
  343. package/dist-lib/lib/suspend-lifecycle.js +10 -5
  344. package/dist-lib/lib/task.d.ts +5 -1
  345. package/dist-lib/lib/task.js +29 -12
  346. package/dist-lib/lib/unref.d.ts +3 -2
  347. package/dist-lib/lib/unref.js +2 -1
  348. package/dist-lib/lib/wav-duration.js +10 -5
  349. package/dist-lib/lib/write-queue.d.ts +5 -4
  350. package/dist-lib/lib/write-queue.js +2 -1
  351. package/dist-lib/schema/build.js +16 -8
  352. package/dist-lib/schema/config.d.ts +3 -4
  353. package/dist-lib/schema/config.js +1 -1
  354. package/dist-lib/schema/content.d.ts +18 -2
  355. package/dist-lib/schema/content.js +4 -1
  356. package/dist-lib/schema/engine.d.ts +3 -2
  357. package/dist-lib/schema/engine.js +192 -12
  358. package/dist-lib/schema/field-order.js +22 -11
  359. package/dist-lib/schema/indexes.d.ts +22 -0
  360. package/dist-lib/schema/{helpers.js → indexes.js} +19 -57
  361. package/dist-lib/schema/local.d.ts +3 -2
  362. package/dist-lib/schema/local.js +9 -3
  363. package/dist-lib/schema/media-kind.d.ts +8 -0
  364. package/dist-lib/schema/media-kind.js +52 -0
  365. package/dist-lib/schema/qvac.d.ts +12 -9
  366. package/dist-lib/schema/qvac.js +132 -7
  367. package/dist-lib/spec/bind.js +21 -0
  368. package/dist-lib/spec/calls.js +7 -0
  369. package/dist-lib/spec/capabilities.d.ts +18 -4
  370. package/dist-lib/spec/config/hyperconf/index.js +1 -1
  371. package/dist-lib/spec/hrpc/hrpc.json +93 -2
  372. package/dist-lib/spec/hrpc/index.js +89 -5
  373. package/dist-lib/spec/hrpc/messages.js +1568 -941
  374. package/dist-lib/spec/hyperschema/index.js +1568 -941
  375. package/dist-lib/spec/hyperschema/schema.json +531 -1
  376. package/dist-lib/spec/hyperschema/types.d.ts +145 -1
  377. package/dist-lib/spec/local/hyperdb/index.js +1 -1
  378. package/dist-lib/spec/local/hyperdb/messages.js +92 -20
  379. package/dist-lib/spec/local/hyperschema/index.js +47 -11
  380. package/dist-lib/spec/local/hyperschema/schema.json +32 -1
  381. package/dist-lib/spec/local/hyperschema/types.d.ts +7 -1
  382. package/dist-lib/spec/mesh/hyperdb/db.json +131 -3
  383. package/dist-lib/spec/mesh/hyperdb/index.js +548 -5
  384. package/dist-lib/spec/mesh/hyperdb/messages.js +2444 -893
  385. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +37 -1
  386. package/dist-lib/spec/mesh/hyperdispatch/index.js +104 -2
  387. package/dist-lib/spec/mesh/hyperdispatch/messages.js +1035 -11
  388. package/dist-lib/spec/mesh/hyperschema/index.js +1035 -11
  389. package/dist-lib/spec/mesh/hyperschema/schema.json +553 -1
  390. package/dist-lib/spec/mesh/hyperschema/types.d.ts +143 -1
  391. package/package.json +11 -5
  392. package/tui/app.mjs +2624 -986
  393. package/tui/boot.mjs +17 -46
  394. package/tui/index.mjs +10 -5
  395. package/tui/lib/boot-timing.mjs +8 -8
  396. package/tui/lib/busy-words.mjs +21 -22
  397. package/tui/lib/export.mjs +100 -32
  398. package/tui/lib/knowledge-command.mjs +64 -19
  399. package/tui/lib/knowledge-import.mjs +52 -18
  400. package/tui/lib/render.mjs +65 -33
  401. package/tui/lib/save-file.mjs +30 -13
  402. package/tui/lib/select.mjs +23 -5
  403. package/tui/lib/selection.mjs +6 -4
  404. package/tui/lib/setup.mjs +11 -19
  405. package/tui/lib/sidebar.mjs +23 -13
  406. package/tui/lib/splash.mjs +6 -7
  407. package/tui/lib/upload-frames.mjs +1 -2
  408. package/tui/lib/usage.mjs +13 -9
  409. package/tui/lib/wrap.mjs +35 -6
  410. package/tui/main.mjs +54 -78
  411. package/worker/assistant-sidecar.mjs +5 -10
  412. package/worker/stow-entry.mjs +7 -4
  413. package/dist-lib/lib/custom-model-source.d.ts +0 -15
  414. package/dist-lib/lib/custom-model-source.js +0 -46
  415. package/dist-lib/lib/oauth/common.d.ts +0 -38
  416. package/dist-lib/lib/oauth/common.js +0 -34
  417. package/dist-lib/schema/helpers.d.ts +0 -32
package/CHANGELOG.md CHANGED
@@ -13,6 +13,219 @@ release.
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.6.0] - 2026-09-28
17
+
18
+ ### Added
19
+
20
+ - Loading and unloading a model by hand, for a Models screen. `loadModel` loads
21
+ a downloaded model under the settings of the agent on this device that runs
22
+ it, so that agent's next reply finds it loaded; it never downloads, and returns
23
+ `loaded: false` with `reason: 'memory'` when it would not fit beside what is
24
+ loaded. Chat models loaded this way stay loaded side by side. `unloadModel`
25
+ puts a reply this device is generating with the model back in the queue, and it
26
+ completes once the model has been loaded again. Both bump `modelCatalogWatch`,
27
+ and `isLoaded` in `listModels` is right for chat, embedding, speech and
28
+ transcription models. A harness older than `@qvac/harness` 0.6 refuses both.
29
+
30
+ ```js
31
+ const { loaded, reason } = await engine.loadModel({ name: 'Qwen3.5-4B-Q4_K_M' })
32
+ await engine.unloadModel({ name: 'Qwen3.5-4B-Q4_K_M' })
33
+ ```
34
+
35
+ (#242)
36
+
37
+ - `previewCustomModel` checks a link or path through the harness before
38
+ anything is added, and returns the resolved link, size, context window,
39
+ architecture, size label, task type, license and fit, a file list for a
40
+ repository with several weights, or a refusal with its reason.
41
+ `customModelsWatch` rows carry `contextLength`, `taskType`, `license` and
42
+ `label`. (#215)
43
+ - An attached PDF's scanned, figure and text-less pages reach a vision model as
44
+ images, at most 10 per message, alongside the PDF as a document. A PDF whose
45
+ pages rendered is no longer reported as unread. Core now depends on
46
+ `bare-pdfium`. (#94)
47
+ - `setModelReleased({ name, released })` and `releasedModels` on the app
48
+ config: the models this device does not fetch ahead of need. (#189)
49
+
50
+ ### Changed
51
+
52
+ - A custom model is named by an id derived from its file (`custom:…`), not by
53
+ what the caller typed. `addCustomModel` takes a `label` in place of `name` and
54
+ returns `{ id }`, and `removeCustomModel`, `deleteModel` and an agent's
55
+ `modelName` take that id. `addCustomModel` runs the preview first and rejects
56
+ a refused source, a multi-weight repository or a model that is not a text
57
+ model, storing nothing; with no harness that can preview, it rejects.
58
+ `removeCustomModel` also frees the downloaded copy and answers with the
59
+ `deleteModel` summary in place of `{ ok }`. Needs `@qvac/harness` 0.6. See
60
+ [custom models](docs/api/custom-models.md). (#215)
61
+
62
+ ```js
63
+ // 0.5.0
64
+ await engine.addCustomModel({ name: 'Qwen3 small', src })
65
+ await engine.removeCustomModel({ name: 'Qwen3 small' })
66
+ // 0.6.0
67
+ const { id } = await engine.addCustomModel({ label: 'Qwen3 small', src })
68
+ await engine.removeCustomModel({ name: id })
69
+ ```
70
+
71
+ - `deleteModel` no longer has the model downloaded again straight away. It
72
+ stops an in-flight transfer and releases the model, which is fetched again
73
+ only when a run needs it or on `retryModelDownload`. (#189)
74
+ - `@qvac/harness` 0.6.0, with `@qvac/inference` 0.20.0. (#215)
75
+ - For a host embedding Core, `startOAuthLoopback` is now
76
+ `openOAuthLoopback(port, { credentialKey, state })`, and `waitForCode` no
77
+ longer takes the state. One server per fixed port is shared by every flow
78
+ redirecting to it. (#181)
79
+
80
+ ### Fixed
81
+
82
+ - Two OAuth flows landing on the same loopback port superseded each other, so
83
+ sibling skills of one provider could not connect at the same time. A callback
84
+ is now routed to the flow whose `state` it carries. (#181)
85
+ - `networkWatch` and `diagnosticsWatch` logged two churn lines a second on an
86
+ idle device. A sampled watch that wakes with the same answer is no longer
87
+ counted as churn, and a real burst is reported once per window. (#145)
88
+
89
+ ## [0.5.0] - 2026-09-26
90
+
91
+ ### Added
92
+
93
+ - "Free up memory when idle" reaches the harness. A device's choice lives under
94
+ the device-local config key `model.idleUnloadMinutes` (`MODEL_IDLE_UNLOAD_KEY`
95
+ from `@qvac/core/constants`), as one of `MODEL_IDLE_UNLOAD_MINUTES`: 15, 30,
96
+ 60, 120, 240, 480, 720 or 1440. The assistant pushes it to the harness as
97
+ `setModelIdleTimeout`, which unloads every idle model once the device has had
98
+ no request for that long. An absent key, `0` or any other value is Never,
99
+ today's behaviour. A harness older than `@qvac/harness` 0.5 ignores it. (#241)
100
+
101
+ ```js
102
+ await engine.configSet({ key: MODEL_IDLE_UNLOAD_KEY, value: 30 })
103
+ ```
104
+
105
+ - `previewMeshInvite` reads whether an invite adds a device to an existing
106
+ member or mints a new person, without joining. A device invite now carries
107
+ `inviterName`, the minting member's display name, which the preview returns.
108
+ An invite that does not decode is refused with `Invalid mesh invite`. (#194)
109
+
110
+ - `createMesh` mints a shared mesh, optionally a compute one. It takes
111
+ `{ config: { compute } }`, typed `AssistantMeshConfig`, and returns
112
+ `{ meshId }`, as `createRoom` did. (#198)
113
+
114
+ ```js
115
+ const { meshId } = await engine.createMesh({})
116
+ const compute = await engine.createMesh({ config: { compute: true } })
117
+ ```
118
+
119
+ - A run can invoke a harness capability without loading a model. `runAgent`,
120
+ `sendMessage` and `runTask` take `capability`, `capabilityArgs` and
121
+ `enhance` (`never`, the default, or `auto`). The run is claimed, stopped and
122
+ reports progress like any other, and a capability the executing device's
123
+ harness does not know fails the run with a notice. `runTask` returns
124
+ `metrics`. See `examples/mesh-capability-run.mjs`. (#162)
125
+ - `detectLanguage`: the language a piece of text is in, ranked. Device-local
126
+ and synchronous; the classifier ships in the harness bundle, so it needs no
127
+ model. (#162)
128
+ - `meshEntry.reason` and `meshEntry.awaitingFrom`: a mesh this device was never
129
+ admitted to reports `awaiting-admission` and names the one device that can
130
+ admit it. (#174)
131
+
132
+ ### Changed
133
+
134
+ - The consensus floor, `VENDORED_MIN_SUPPORTED_VERSION`, is `>=0.19.0`. This
135
+ release sends dispatch routes 28 to 37, which app 0.18.x (`@qvac/core` 0.1.x)
136
+ cannot route, and a device that cannot route an op halts apply. Route 34
137
+ writes the account seal on its first settle, so an un-upgraded device of that
138
+ account halts at once. Ship the 0.19 app before publishing this floor to the
139
+ lane cores. A host embedding this release that reports an app version below
140
+ 0.19.0 is withheld from its meshes as needing an upgrade; a prerelease such as
141
+ `0.19.0-dev` counts as 0.19.0, and a host that reports none is not gated.
142
+ (#196)
143
+ - A shared mesh admits a writer only through an invite grant or a live
144
+ device's vouch. `meshInvite` with `member: true` puts a single-use grant
145
+ behind the link that expires after 48 hours, and every call mints a fresh
146
+ one, so each person needs their own link. An invite minted before grants
147
+ leaves the joiner a reader, and `joinMesh` fails after 60 seconds.
148
+ (#171, #199, #225)
149
+ - `joinMesh` fails with `This invite was revoked`, `This invite has expired` or
150
+ `This invite has already been used` when the device can already see why, and
151
+ a member or device invite join that is not admitted within 60 seconds fails
152
+ instead of waiting forever. Only `recoverAccount` still waits unbounded.
153
+ (#171, #229)
154
+ - A device invite expires after 48 hours, a device keeps at most five
155
+ outstanding, and one minted before this release no longer redeems. The
156
+ joining device no longer appends its own join: it sends a signed claim to the
157
+ inviting device, which writes the admission. The link format is unchanged.
158
+ (#229)
159
+ - An account is sealed the first time a device on this release settles it, and
160
+ from then on refuses the bare seed `@qvac/join`, invite grants and
161
+ `@qvac/add-writer`: pairing and `recoverAccount` are the only ways in.
162
+ Booting with another account's `meshSeed` and `meshKey` leaves the device a
163
+ reader, with a `meshStatusWatch` error saying to pair it with a device
164
+ invite. A host that boots every device on one configured `meshSeed` is
165
+ unaffected until it pairs a device in. (#229)
166
+ - `recoverAccount` joins through `@qvac/recover-device`, on a proof the
167
+ phrase's identity signs, and is refused in a shared mesh and for a device
168
+ another writer removed. `publishAccountRecovery` refuses a phrase that names
169
+ no member of the account. (#200, #225)
170
+ - A shared mesh takes its member from the account, so every device of one
171
+ person is the same member in it. `createMesh`, and a member `meshInvite` that
172
+ mints the shared mesh, refuse with "This device is not part of its account
173
+ yet" until the account row names that member. A sibling that follows a
174
+ shared mesh opens it read-only until a live device of the same member admits
175
+ it. A shared mesh refuses `@qvac/join-member` and a self-signed
176
+ `@qvac/attest-member-device`, so a member link there comes only with
177
+ admission. (#174, #226, #227)
178
+ - A shared mesh starts with no agent and no chat, both when it is created and
179
+ when a member joins. Read `agents` after a join as possibly empty rather than
180
+ taking `agents[0]`. The account still starts with its default agent and a
181
+ first chat. (#188)
182
+ - A device's build and inventory go only to its own account. In a shared mesh
183
+ `appVersion`, `appBuild` and `appChannel` are withheld, the installed and
184
+ cached inventory is reported empty, and `readySkillNames` carries only the
185
+ agents the device hosts there. Read another device's tools and skills off the
186
+ account's roster. (#173)
187
+ - Removing a device or a member revokes the live invite grants it minted, a
188
+ kick lands even after the device moved to a new writer key, and a device row
189
+ that moves to a new writer removes the one it moved off. Consensus changes,
190
+ covered by the `>=0.19.0` floor. (#226)
191
+ - Revoking another writer takes standing: `removeDevice` and `removeMember` are
192
+ refused in apply unless the author is a live device of a member of the mesh.
193
+ Any admitted writer could revoke any other before, including a device paired
194
+ in by invite that a sibling has not yet attested. A refusal leaves the writer
195
+ set untouched. A consensus change, covered by the `>=0.19.0` floor. (#170)
196
+ - Notice and error text says "mesh" where it said "room". A member `meshInvite`
197
+ into a mesh that already holds another member or a message returns the
198
+ `notice` "this mesh is not empty: everyone in it will see the newcomer arrive,
199
+ and the newcomer replays the whole history of the mesh, including what earlier
200
+ members wrote", and a member `meshInvite` naming a mesh only another of your
201
+ devices can open refuses with "Another of your devices holds this mesh: bring
202
+ that device online, or invite from it instead". Code matching on the old text
203
+ has to match the new. (#198)
204
+ - `autobee` 2.11.8. A member whose view was never written now maps through the
205
+ reindex, and the fast-forward search follows signalled trusted heads and only
206
+ moves forward. (#249)
207
+
208
+ ### Removed
209
+
210
+ - `createRoom`. It stays on the wire because it shipped, and now refuses with
211
+ `createRoom is retired: call createMesh with the same input`. For a host
212
+ embedding Core, `Core.createRoom` and `Core.sharedRoom` are renamed
213
+ `createMesh` and `sharedMesh`. (#198)
214
+
215
+ ### Fixed
216
+
217
+ - A mesh a device learned of from a sibling was followed once, ever: one
218
+ refused seed request or failed open stranded it for good, with nothing
219
+ logged. A failed open now unwinds, the reason is logged, and a follow that
220
+ failed for a reason that can change is retried on every sync pass until the
221
+ mesh opens. A refusal is not retried. (#172, #201)
222
+ - `removeDevice` on one of your own devices revoked it only in the account, so
223
+ it stayed a live writer, and a live voucher, in every other mesh. It is now
224
+ revoked in each mesh this device holds, and in any other as soon as it
225
+ opens. Whether a sibling may follow our meshes is read off the account alone,
226
+ so one revoked by another member in a single mesh is no longer refused the
227
+ seed of all of them. (#228)
228
+
16
229
  ## [0.4.1] - 2026-09-25
17
230
 
18
231
  ### Changed
@@ -213,6 +426,38 @@ release.
213
426
  request carried a non-native `AbortSignal`. Calendar, Spotify and other
214
427
  connected skills stopped working an hour after connecting. (#207)
215
428
 
429
+ ## [0.3.5] - 2026-09-25
430
+
431
+ ### Changed
432
+
433
+ - `autobee` 2.11.4 with `strictReindex`: the boot reindex rewrites views still
434
+ on a version 1 manifest, which autobee 2.11 will no longer append to.
435
+ `corestore` 7.12.6 and `hypercore` 11.37. (#205)
436
+
437
+ ### Fixed
438
+
439
+ - A React Native app could not bundle `@qvac/core/oauth/client`: Metro rejects
440
+ this package's imports map, so `#abort-controller` did not resolve. Token
441
+ refresh now uses the runtime's own `AbortController`, and
442
+ `bare-abort-controller` only on Bare, which has none. React Native's `fetch`
443
+ gets a native signal too. (#231)
444
+
445
+ ```js
446
+ // mobile: bundles again, nothing else changes
447
+ import { createOAuthClient } from '@qvac/core/oauth/client'
448
+
449
+ const oauth = createOAuthClient({ fetch, randomBase64Url, sha256Base64Url })
450
+ const tokens = await oauth.refreshOAuthTokens(config, refreshToken)
451
+ ```
452
+
453
+ ## [0.3.4] - 2026-09-24
454
+
455
+ ### Fixed
456
+
457
+ - OAuth token refresh failed on Node 24, including Electron 42, because the
458
+ request carried a non-native `AbortSignal`. Calendar, Spotify and other
459
+ connected skills stopped working an hour after connecting. (#207)
460
+
216
461
  ## [0.3.3] - 2026-09-24
217
462
 
218
463
  ### Changed
@@ -639,6 +884,17 @@ release.
639
884
  minted. Leaving or being kicked archives a mesh instead of deleting it, so
640
885
  its seed survives. (#56)
641
886
 
887
+ ## [0.1.8] - 2026-09-26
888
+
889
+ Published under the `release-0.1` dist-tag.
890
+
891
+ ### Changed
892
+
893
+ - `autobee` 2.11.8, backported from 0.5.0, with the `strictReindex` that 0.4.0
894
+ brought in. A mesh opened by 0.1.7 reindexes its views on first open.
895
+ `hyperbee2` 2.18, `hypercore` 11.37, `corestore` 7.12.6, `hyperschema` 1.26.2
896
+ and `hyperdb` 6.9; the wire format is unchanged. (#250)
897
+
642
898
  ## [0.1.7] - 2026-09-17
643
899
 
644
900
  Published under the `release-0.1` dist-tag.
@@ -780,9 +1036,13 @@ Published under the `release-0.1` dist-tag.
780
1036
  await assistant.ready()
781
1037
  ```
782
1038
 
783
- [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.4.1...HEAD
1039
+ [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.6.0...HEAD
1040
+ [0.6.0]: https://github.com/tetherto/qvac-core/compare/v0.5.0...v0.6.0
1041
+ [0.5.0]: https://github.com/tetherto/qvac-core/compare/v0.4.1...v0.5.0
784
1042
  [0.4.1]: https://github.com/tetherto/qvac-core/compare/v0.4.0...v0.4.1
785
1043
  [0.4.0]: https://github.com/tetherto/qvac-core/compare/v0.3.3...v0.4.0
1044
+ [0.3.5]: https://github.com/tetherto/qvac-core/compare/v0.3.4...v0.3.5
1045
+ [0.3.4]: https://github.com/tetherto/qvac-core/compare/v0.3.3...v0.3.4
786
1046
  [0.3.3]: https://github.com/tetherto/qvac-core/compare/v0.3.2...v0.3.3
787
1047
  [0.3.2]: https://github.com/tetherto/qvac-core/compare/v0.3.1...v0.3.2
788
1048
  [0.3.1]: https://github.com/tetherto/qvac-core/compare/v0.3.0...v0.3.1
@@ -790,6 +1050,7 @@ Published under the `release-0.1` dist-tag.
790
1050
  [0.2.2]: https://github.com/tetherto/qvac-core/compare/v0.2.1...v0.2.2
791
1051
  [0.2.1]: https://github.com/tetherto/qvac-core/compare/v0.2.0...v0.2.1
792
1052
  [0.2.0]: https://github.com/tetherto/qvac-core/compare/v0.1.5...v0.2.0
1053
+ [0.1.8]: https://github.com/tetherto/qvac-core/compare/v0.1.7...v0.1.8
793
1054
  [0.1.7]: https://github.com/tetherto/qvac-core/compare/v0.1.6...v0.1.7
794
1055
  [0.1.6]: https://github.com/tetherto/qvac-core/compare/v0.1.5...v0.1.6
795
1056
  [0.1.5]: https://github.com/tetherto/qvac-core/compare/v0.1.4...v0.1.5
package/README.md CHANGED
@@ -85,7 +85,7 @@ Wire it up — prod shape, Core in its own Bare sidecar process:
85
85
  import { QvacAssistant, AssistantClient } from 'qvac-core'
86
86
 
87
87
  // Spawns the bundled Core sidecar for free — ready() boots it, close()
88
- // tears it down. Joining a mesh: pass meshSeed/meshKey from a decoded invite.
88
+ // tears it down. Joining an account: redeem a device invite with joinMesh.
89
89
  const engine = new AssistantClient({
90
90
  storagePath: '/path/to/state',
91
91
  device: { name: 'my-device', capabilityProfile: 'mid', recommendedModelName: 'Qwen3.5-9B' }
@@ -32,8 +32,9 @@ export function createAgentsApi(pool, deviceId, computeLender = null) {
32
32
  getDefaultAgent: async ({ meshId, providerDeviceId }) => {
33
33
  const mesh = await requireMesh(pool, meshId);
34
34
  const agent = await getDefaultAgent(mesh, providerDeviceId ?? undefined);
35
- if (!agent)
35
+ if (!agent) {
36
36
  return {};
37
+ }
37
38
  return { agent: await withOrphaned(mesh, agent) };
38
39
  },
39
40
  updateAgent: async ({ agentId, meshId, config }) => {
@@ -44,6 +45,6 @@ export function createAgentsApi(pool, deviceId, computeLender = null) {
44
45
  const mesh = await requireMesh(pool, meshId);
45
46
  return withOrphaned(mesh, await deleteAgent(mesh, deviceId, agentId));
46
47
  },
47
- agentsWatch: meshWatchable('agentsWatch', pool, (request, mesh) => list(mesh, request.providerDeviceId ?? undefined))
48
+ agentsWatch: meshWatchable(pool, (request, mesh) => list(mesh, request.providerDeviceId ?? undefined), { name: 'agentsWatch' })
48
49
  };
49
50
  }
@@ -1,5 +1,5 @@
1
1
  import type { openLocalStore } from '../core/local/index.ts';
2
2
  import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
3
3
  type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
4
- export declare function createAppConfigApi(state: LocalStore): Pick<CapabilityHandlers, 'getConfig' | 'setConfig' | 'setModelPaused' | 'configWatchTyped'>;
4
+ export declare function createAppConfigApi(state: LocalStore): Pick<CapabilityHandlers, 'getConfig' | 'setConfig' | 'setModelPaused' | 'setModelReleased' | 'configWatchTyped'>;
5
5
  export {};
@@ -1,3 +1,4 @@
1
+ import * as z from 'zod';
1
2
  import { watchable } from './watchable.js';
2
3
  const EMPTY_CAPABILITIES = {
3
4
  chat: false,
@@ -20,14 +21,30 @@ const DEFAULT_CONFIG = {
20
21
  lastModelName: null,
21
22
  onboardingCompleted: false,
22
23
  delegation: EMPTY_DELEGATION,
23
- pausedModels: []
24
+ pausedModels: [],
25
+ releasedModels: []
24
26
  };
27
+ const DelegationSchema = z.object({
28
+ enabled: z.boolean().optional(),
29
+ targetDeviceId: z.string().nullish(),
30
+ targetAgentId: z.string().nullish(),
31
+ capabilities: z
32
+ .object({
33
+ chat: z.boolean().optional(),
34
+ transcription: z.boolean().optional(),
35
+ tts: z.boolean().optional(),
36
+ embeddings: z.boolean().optional(),
37
+ knowledge: z.boolean().optional()
38
+ })
39
+ .nullish()
40
+ });
25
41
  function normalizeDelegation(raw) {
26
- if (!raw || typeof raw !== 'object') {
42
+ const parsed = DelegationSchema.safeParse(raw);
43
+ if (!parsed.success) {
27
44
  return { ...EMPTY_DELEGATION, capabilities: { ...EMPTY_CAPABILITIES } };
28
45
  }
29
- const d = raw;
30
- const c = (d.capabilities ?? {});
46
+ const d = parsed.data;
47
+ const c = d.capabilities ?? EMPTY_CAPABILITIES;
31
48
  return {
32
49
  enabled: d.enabled ?? false,
33
50
  targetDeviceId: d.targetDeviceId ?? null,
@@ -42,8 +59,9 @@ function normalizeDelegation(raw) {
42
59
  };
43
60
  }
44
61
  function toConfig(row) {
45
- if (!row)
62
+ if (!row) {
46
63
  return { ...DEFAULT_CONFIG, delegation: normalizeDelegation(null) };
64
+ }
47
65
  return {
48
66
  activeAgentId: row.activeAgentId ?? null,
49
67
  activeChatId: row.activeChatId ?? null,
@@ -52,7 +70,8 @@ function toConfig(row) {
52
70
  lastModelName: row.lastModelName ?? null,
53
71
  onboardingCompleted: row.onboardingCompleted ?? false,
54
72
  delegation: normalizeDelegation(row.delegation),
55
- pausedModels: row.pausedModels ?? []
73
+ pausedModels: row.pausedModels ?? [],
74
+ releasedModels: row.releasedModels ?? []
56
75
  };
57
76
  }
58
77
  function applyWrite(current, update) {
@@ -64,9 +83,20 @@ function applyWrite(current, update) {
64
83
  lastModelName: current.lastModelName,
65
84
  onboardingCompleted: update.onboardingCompleted ?? false,
66
85
  delegation: normalizeDelegation(update.delegation),
67
- pausedModels: current.pausedModels
86
+ pausedModels: current.pausedModels,
87
+ releasedModels: current.releasedModels
68
88
  };
69
89
  }
90
+ function toggled(names, name, on) {
91
+ const set = new Set(names);
92
+ if (on) {
93
+ set.add(name);
94
+ }
95
+ else {
96
+ set.delete(name);
97
+ }
98
+ return [...set];
99
+ }
70
100
  async function readConfig(state) {
71
101
  return toConfig(await state.getAppConfigRow());
72
102
  }
@@ -79,7 +109,8 @@ function toRow(config) {
79
109
  lastModelName: config.lastModelName,
80
110
  onboardingCompleted: config.onboardingCompleted,
81
111
  delegation: config.delegation,
82
- pausedModels: config.pausedModels
112
+ pausedModels: config.pausedModels,
113
+ releasedModels: config.releasedModels
83
114
  };
84
115
  }
85
116
  export function createAppConfigApi(state) {
@@ -94,15 +125,23 @@ export function createAppConfigApi(state) {
94
125
  async setModelPaused(input) {
95
126
  const row = await state.updateAppConfigRow((current) => {
96
127
  const config = toConfig(current);
97
- const paused = new Set(config.pausedModels);
98
- if (input.paused)
99
- paused.add(input.name);
100
- else
101
- paused.delete(input.name);
102
- return toRow({ ...config, pausedModels: [...paused] });
128
+ return toRow({
129
+ ...config,
130
+ pausedModels: toggled(config.pausedModels ?? [], input.name, input.paused ?? false)
131
+ });
132
+ });
133
+ return toConfig(row);
134
+ },
135
+ async setModelReleased(input) {
136
+ const row = await state.updateAppConfigRow((current) => {
137
+ const config = toConfig(current);
138
+ return toRow({
139
+ ...config,
140
+ releasedModels: toggled(config.releasedModels ?? [], input.name, input.released ?? false)
141
+ });
103
142
  });
104
143
  return toConfig(row);
105
144
  },
106
- configWatchTyped: watchable('configWatchTyped', () => state, () => readConfig(state))
145
+ configWatchTyped: watchable(() => state, () => readConfig(state), { name: 'configWatchTyped' })
107
146
  };
108
147
  }
@@ -1,8 +1,9 @@
1
1
  import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
2
2
  import { type MeshPool } from './current-mesh.ts';
3
3
  export { MAX_ATTACHMENT_BYTES } from '../core/files/attachments.ts';
4
- export declare function createAttachmentsApi(pool: MeshPool, options?: {
5
- maxBytes?: number;
6
- deviceId?: Buffer | null;
7
- inactivityMs?: number;
8
- }): Pick<CapabilityHandlers, 'uploadAttachment' | 'downloadAttachment' | 'deleteAttachment'>;
4
+ export interface CreateAttachmentsApiOptions {
5
+ readonly maxBytes?: number;
6
+ readonly deviceId?: Buffer | null;
7
+ readonly inactivityMs?: number;
8
+ }
9
+ export declare function createAttachmentsApi(pool: MeshPool, options?: CreateAttachmentsApiOptions): Pick<CapabilityHandlers, 'uploadAttachment' | 'downloadAttachment' | 'deleteAttachment'>;
@@ -5,10 +5,12 @@ export function createAttachmentsApi(pool, options = {}) {
5
5
  return {
6
6
  async *uploadAttachment(frames) {
7
7
  const upload = await openUpload(frames);
8
- if (!upload)
8
+ if (!upload) {
9
9
  return;
10
- if (!upload.first.meshId)
10
+ }
11
+ if (!upload.first.meshId) {
11
12
  throw new Error(UPLOAD_NAMES_NO_MESH);
13
+ }
12
14
  const mesh = await requireMesh(pool, upload.first.meshId);
13
15
  yield* mesh.files.attachments(options).uploadAttachment(upload.rest);
14
16
  },
@@ -3,7 +3,11 @@ import type { openLocalStore } from '../core/local/index.ts';
3
3
  import { type MeshPool } from './current-mesh.ts';
4
4
  type LocalStore = ReturnType<typeof openLocalStore>;
5
5
  type ChatCapabilities = Pick<CapabilityHandlers, 'createChat' | 'listChats' | 'getChat' | 'renameChat' | 'setChatRagEnabled' | 'setChatWebSearchEnabled' | 'deleteChat' | 'chatsWatch' | 'listChatActivity' | 'chatActivityWatch' | 'searchChats'>;
6
- export declare function createChatApi(pool: MeshPool, deviceId: Buffer | null, local: LocalStore, inferenceCalls?: {
7
- forget(chatId: string): Promise<void>;
8
- } | null): ChatCapabilities;
6
+ export interface CreateChatApiOptions {
7
+ readonly deviceId: Buffer | null;
8
+ readonly inferenceCalls?: {
9
+ forget(chatId: string): Promise<void>;
10
+ } | null;
11
+ }
12
+ export declare function createChatApi(pool: MeshPool, local: LocalStore, { deviceId, inferenceCalls }: CreateChatApiOptions): ChatCapabilities;
9
13
  export {};
@@ -5,7 +5,7 @@ import { listChatPage } from '../core/chat-order.js';
5
5
  import { searchChats } from '../core/chat-search.js';
6
6
  import { meshWatchable, requireMesh } from './current-mesh.js';
7
7
  const SEARCH_SUPERSEDED_ABORT = 'superseded by a newer chat search';
8
- export function createChatApi(pool, deviceId, local, inferenceCalls = null) {
8
+ export function createChatApi(pool, local, { deviceId, inferenceCalls = null }) {
9
9
  let searchAbort = null;
10
10
  const chatList = (mesh, { limit, cursor }) => listChatPage(mesh, local, { limit: limit || undefined, cursor: cursor ?? undefined });
11
11
  const chatActivity = (mesh, chatIds) => listChatActivity(mesh, chatIds ?? undefined).then((activities) => ({ activities }));
@@ -14,16 +14,16 @@ export function createChatApi(pool, deviceId, local, inferenceCalls = null) {
14
14
  listChats: async (request) => chatList(await requireMesh(pool, request.meshId), request),
15
15
  getChat: async ({ chatId, meshId }) => mustGetActiveChatListing(await requireMesh(pool, meshId), chatId),
16
16
  renameChat: async ({ chatId, meshId, config }) => renameChat(await requireMesh(pool, meshId), chatId, config.title),
17
- setChatRagEnabled: async ({ chatId, enabled, meshId }) => setChatRagEnabled(await requireMesh(pool, meshId), chatId, enabled ?? false),
17
+ setChatRagEnabled: async ({ chatId, enabled, meshId }) => setChatRagEnabled(await requireMesh(pool, meshId), chatId, { ragEnabled: enabled ?? false }),
18
18
  setChatWebSearchEnabled: async ({ chatId, enabled, meshId }) => setChatWebSearchEnabled(await requireMesh(pool, meshId), chatId, enabled ?? false),
19
19
  deleteChat: async ({ chatId, meshId }) => {
20
20
  const deleted = await deleteChat(await requireMesh(pool, meshId), deviceId, chatId);
21
21
  await inferenceCalls?.forget(chatId);
22
22
  return deleted;
23
23
  },
24
- chatsWatch: meshWatchable('chatsWatch', pool, (request, store) => chatList(store, request), local),
24
+ chatsWatch: meshWatchable(pool, (request, store) => chatList(store, request), { name: 'chatsWatch', changes: local }),
25
25
  listChatActivity: async (input) => chatActivity(await requireMesh(pool, input.meshId), input.chatIds),
26
- chatActivityWatch: meshWatchable('chatActivityWatch', pool, (request, store) => chatActivity(store, request.chatIds)),
26
+ chatActivityWatch: meshWatchable(pool, (request, store) => chatActivity(store, request.chatIds), { name: 'chatActivityWatch' }),
27
27
  searchChats: async (input) => {
28
28
  searchAbort?.abort(SEARCH_SUPERSEDED_ABORT);
29
29
  const controller = new AbortController();
@@ -31,10 +31,10 @@ export function createChunksApi(pool, deviceId) {
31
31
  });
32
32
  return { chunks: await recordLinks(mesh, chunks) };
33
33
  },
34
- chunksWatch: meshWatchable('chunksWatch', pool, async ({ meshId, ...input }, mesh) => ({
34
+ chunksWatch: meshWatchable(pool, async ({ meshId, ...input }, mesh) => ({
35
35
  chunks: await recordLinks(mesh, await listChunks(mesh, chunkSelection(input)))
36
- })),
37
- runRequestsWatch: meshWatchable('runRequestsWatch', pool, async (_request, mesh) => ({ chunks: await listRunRequests(mesh, deviceId) }))
36
+ }), { name: 'chunksWatch' }),
37
+ runRequestsWatch: meshWatchable(pool, async (_request, mesh) => ({ chunks: await listRunRequests(mesh, deviceId) }), { name: 'runRequestsWatch' })
38
38
  };
39
39
  }
40
40
  function chunkSelection({ chatId, type, types, ...rest }) {
@@ -8,8 +8,8 @@ export function createConfigApi(state) {
8
8
  await state.set(key, value);
9
9
  return { ok: true };
10
10
  },
11
- configWatch: watchable('configWatch', () => state, async ({ key }) => ({
11
+ configWatch: watchable(() => state, async ({ key }) => ({
12
12
  value: await state.get(key)
13
- }))
13
+ }), { name: 'configWatch' })
14
14
  };
15
15
  }
@@ -1,12 +1,11 @@
1
+ import type { Readable } from 'streamx';
1
2
  import type { Mesh } from '../core/mesh.ts';
3
+ import { type WatchableOptions } from './watchable.ts';
2
4
  export type MeshPool = (meshId: string) => Mesh | null | Promise<Mesh | null>;
3
5
  export declare const NO_SUCH_MESH = "no such mesh";
4
6
  export declare function requireMesh(pool: MeshPool, meshId: string): Promise<Mesh>;
5
7
  export declare function isMissingMesh(err: unknown): boolean;
6
- export declare function meshWatchable<TRequest extends MeshScoped, TResult>(name: string, pool: MeshPool, query: (request: TRequest, mesh: Mesh) => Promise<TResult>, changes?: {
7
- watch(listener: () => void): void;
8
- unwatch(listener: () => void): void;
9
- }): (request: TRequest) => import("streamx").Readable<import("streamx").ReadableEvents> & AsyncIterable<TResult>;
8
+ export declare function meshWatchable<TRequest extends MeshScoped, TResult>(pool: MeshPool, query: (request: TRequest, mesh: Mesh) => Promise<TResult>, { name, changes }: WatchableOptions): (request: TRequest) => Readable & AsyncIterable<TResult>;
10
9
  interface MeshScoped {
11
10
  readonly meshId: string;
12
11
  }
@@ -2,15 +2,20 @@ import { watchable } from './watchable.js';
2
2
  export const NO_SUCH_MESH = 'no such mesh';
3
3
  export async function requireMesh(pool, meshId) {
4
4
  const mesh = await pool(meshId);
5
- if (!mesh)
5
+ if (!mesh) {
6
6
  throw new Error(`${NO_SUCH_MESH}: ${meshId}`);
7
- if (!mesh.opened)
7
+ }
8
+ if (!mesh.opened) {
8
9
  await mesh.ready();
10
+ }
9
11
  return mesh;
10
12
  }
11
13
  export function isMissingMesh(err) {
12
14
  return err instanceof Error && err.message.startsWith(`${NO_SUCH_MESH}: `);
13
15
  }
14
- export function meshWatchable(name, pool, query, changes) {
15
- return watchable(name, (request) => requireMesh(pool, request.meshId), query, changes);
16
+ export function meshWatchable(pool, query, { name, changes }) {
17
+ return watchable((request) => requireMesh(pool, request.meshId), query, {
18
+ name,
19
+ changes
20
+ });
16
21
  }
@@ -1,5 +1,12 @@
1
+ import type { AssistantCustomModelPreview, AssistantDeleteModelResponse, AssistantPreviewCustomModelRequest } from '../../spec/hyperschema/types.d.ts';
1
2
  import type { openLocalStore } from '../core/local/index.ts';
2
3
  import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
3
4
  type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
4
- export declare function createCustomModelApi(state: LocalStore): Pick<CapabilityHandlers, 'customModelsWatch' | 'addCustomModel' | 'removeCustomModel'>;
5
+ export declare const CUSTOM_MODEL_ID_PREFIX = "custom:";
6
+ export declare function customModelId(src: string): string;
7
+ export type CustomModelFileDelete = (request: {
8
+ name: string;
9
+ }) => Promise<AssistantDeleteModelResponse>;
10
+ export type CustomModelPreviewSource = (request: AssistantPreviewCustomModelRequest) => Promise<AssistantCustomModelPreview>;
11
+ export declare function createCustomModelApi(state: LocalStore, preview: CustomModelPreviewSource | null, deleteFiles?: CustomModelFileDelete | null): Pick<CapabilityHandlers, 'customModelsWatch' | 'addCustomModel' | 'removeCustomModel' | 'previewCustomModel'>;
5
12
  export {};