@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
@@ -49,8 +49,9 @@ export class HostedAgents {
49
49
  if (!(await this._lock.lock()))
50
50
  return;
51
51
  try {
52
- if (!this._closed && !this._mesh.closing)
52
+ if (!this._closed && !this._mesh.closing) {
53
53
  await this._pass();
54
+ }
54
55
  }
55
56
  catch (err) {
56
57
  this._log?.warn(SCOPE, 'hosted agent pass failed', err);
@@ -69,27 +70,31 @@ export class HostedAgents {
69
70
  if (departed.length > 0) {
70
71
  const catalog = await this._catalog();
71
72
  for (const id of departed) {
72
- try {
73
- if (await this._handOver(id, catalog))
74
- holding.delete(id);
75
- }
76
- catch (err) {
73
+ const released = await this._handOver(id, catalog).catch((err) => {
77
74
  this._log?.warn(SCOPE, 'skill values could not follow the agent', err);
75
+ return false;
76
+ });
77
+ if (released) {
78
+ holding.delete(id);
78
79
  }
79
80
  }
80
81
  }
81
- if (!sameIds(held, holding))
82
+ if (!sameIds(held, holding)) {
82
83
  await this._local.set(this._heldKey, [...holding]);
84
+ }
83
85
  }
84
86
  async _handOver(id, catalog) {
85
87
  const agent = await getAgent(this._mesh, id);
86
- if (!agent)
88
+ if (!agent) {
87
89
  return false;
88
- if (agent.deletedAt)
90
+ }
91
+ if (agent.deletedAt) {
89
92
  return true;
93
+ }
90
94
  const stored = await this._stored(agentSkillValues(catalog, agent));
91
- if (stored.length === 0)
95
+ if (stored.length === 0) {
92
96
  return true;
97
+ }
93
98
  for (const [skillName, values] of bySkill(stored)) {
94
99
  await this._send(agent.providerDeviceId, { agentId: id, skillName, values });
95
100
  }
@@ -101,8 +106,9 @@ export class HostedAgents {
101
106
  const stored = [];
102
107
  for (const value of values) {
103
108
  const held = await this._local.get(value.storageKey);
104
- if (typeof held === 'string' && held !== '')
109
+ if (typeof held === 'string' && held !== '') {
105
110
  stored.push({ ...value, value: held });
111
+ }
106
112
  }
107
113
  return stored;
108
114
  }
@@ -112,8 +118,9 @@ export class HostedAgents {
112
118
  const ids = new Set();
113
119
  if (Array.isArray(stored)) {
114
120
  for (const id of stored) {
115
- if (typeof id === 'string')
121
+ if (typeof id === 'string') {
116
122
  ids.add(id);
123
+ }
117
124
  }
118
125
  }
119
126
  return ids;
@@ -1,5 +1,5 @@
1
1
  import b4a from 'b4a';
2
2
  import crypto from 'hypercore-crypto';
3
3
  export function randomId() {
4
- return b4a.toString(crypto.randomBytes(16), 'hex');
4
+ return b4a.toHex(crypto.randomBytes(16));
5
5
  }
@@ -6,8 +6,9 @@ const [CLAIM_NAMESPACE] = crypto.namespace('@qvac/core/member-claim', 1);
6
6
  const [INVITE_NAMESPACE] = crypto.namespace('@qvac/core/device-invite', 1);
7
7
  let loaded = null;
8
8
  async function identityKey() {
9
- if (loaded === null)
9
+ if (loaded === null) {
10
10
  loaded = await import('keet-identity-key');
11
+ }
11
12
  return loaded.default;
12
13
  }
13
14
  export async function generateMnemonic() {
@@ -35,8 +36,9 @@ export async function verifyDeviceProof(proof, expected) {
35
36
  catch {
36
37
  return false;
37
38
  }
38
- if (decoded.data)
39
+ if (decoded.data) {
39
40
  return false;
41
+ }
40
42
  try {
41
43
  const IdentityKey = await identityKey();
42
44
  return !!IdentityKey.verify(proof, null, {
@@ -67,8 +69,9 @@ export async function verifyMemberClaim(proof, expected) {
67
69
  catch {
68
70
  return false;
69
71
  }
70
- if (!decoded.data)
72
+ if (!decoded.data) {
71
73
  return false;
74
+ }
72
75
  try {
73
76
  const IdentityKey = await identityKey();
74
77
  return !!IdentityKey.verify(proof, expected.attestation, {
@@ -1,13 +1,15 @@
1
1
  export declare const IMAGE_CACHE_MAX_BYTES: number;
2
2
  export declare const IMAGE_CACHE_MAX_AGE_MS: number;
3
- export declare function imageCacheName(image: {
4
- blobId: string;
5
- fileName: string;
6
- }): string;
3
+ export interface CachedImage {
4
+ readonly blobId: string;
5
+ readonly fileName: string;
6
+ }
7
+ export declare function imageCacheName(image: CachedImage): string;
7
8
  export declare function imageCacheKey(blobId: string): string;
8
- export declare function sweepImageCache(dir: string, { maxBytes, maxAgeMs, keep, inUse }?: {
9
- maxBytes?: number;
10
- maxAgeMs?: number;
11
- keep?: ReadonlySet<string>;
12
- inUse?: (name: string) => boolean;
13
- }): Promise<void>;
9
+ export interface SweepImageCacheOptions {
10
+ readonly maxBytes?: number;
11
+ readonly maxAgeMs?: number;
12
+ readonly keep?: ReadonlySet<string>;
13
+ readonly inUse?: (name: string) => boolean;
14
+ }
15
+ export declare function sweepImageCache(dir: string, { maxBytes, maxAgeMs, keep, inUse }?: SweepImageCacheOptions): Promise<void>;
@@ -12,19 +12,21 @@ export function imageCacheName(image) {
12
12
  return `${imageCacheKey(image.blobId)}-${name}`;
13
13
  }
14
14
  export function imageCacheKey(blobId) {
15
- return b4a.toHex(crypto.hash(Buffer.from(blobId))).slice(0, CACHE_KEY_CHARS);
15
+ return b4a.toHex(crypto.hash(b4a.from(blobId))).slice(0, CACHE_KEY_CHARS);
16
16
  }
17
17
  export async function sweepImageCache(dir, { maxBytes = IMAGE_CACHE_MAX_BYTES, maxAgeMs = IMAGE_CACHE_MAX_AGE_MS, keep, inUse } = {}) {
18
18
  const names = await fs.promises.readdir(dir).catch(toNull);
19
- if (!names)
19
+ if (!names) {
20
20
  return;
21
+ }
21
22
  const now = Date.now();
22
23
  const entries = [];
23
24
  let total = 0;
24
25
  for (const entry of await liveEntries(dir, names, now)) {
25
26
  total += entry.size;
26
- if (inUse?.(entry.name))
27
+ if (inUse?.(entry.name)) {
27
28
  continue;
29
+ }
28
30
  if (keep && !keep.has(entry.name.slice(0, CACHE_KEY_CHARS))) {
29
31
  await fs.promises.unlink(entry.file).catch(noop);
30
32
  total -= entry.size;
@@ -37,8 +39,9 @@ export async function sweepImageCache(dir, { maxBytes = IMAGE_CACHE_MAX_BYTES, m
37
39
  }
38
40
  entries.push(entry);
39
41
  }
40
- if (total <= maxBytes)
42
+ if (total <= maxBytes) {
41
43
  return;
44
+ }
42
45
  entries.sort((a, b) => a.mtimeMs - b.mtimeMs);
43
46
  for (const entry of entries) {
44
47
  if (total <= maxBytes)
@@ -54,11 +57,13 @@ async function liveEntries(dir, names, now) {
54
57
  for (const name of names) {
55
58
  const file = path.join(dir, name);
56
59
  const stats = await fs.promises.stat(file).catch(toNull);
57
- if (!stats?.isFile())
60
+ if (!stats?.isFile()) {
58
61
  continue;
62
+ }
59
63
  if (STAGING_SUFFIX.test(name)) {
60
- if (now - stats.mtimeMs > STALE_PARTIAL_MS)
64
+ if (now - stats.mtimeMs > STALE_PARTIAL_MS) {
61
65
  await fs.promises.unlink(file).catch(noop);
66
+ }
62
67
  continue;
63
68
  }
64
69
  entries.push({ file, name, size: stats.size, mtimeMs: stats.mtimeMs });
@@ -1,3 +1,9 @@
1
1
  export declare const MAX_IMAGE_WIDTH = 768;
2
2
  export declare const IMAGE_MIMES: Set<string>;
3
3
  export declare function normalizeImageForModel(bytes: Uint8Array): Promise<Uint8Array>;
4
+ export interface Raster {
5
+ readonly width: number;
6
+ readonly height: number;
7
+ readonly data: Uint8Array;
8
+ }
9
+ export declare function rasterToModelJpeg(raster: Raster): Promise<Uint8Array | null>;
@@ -27,8 +27,9 @@ async function loadMedia() {
27
27
  }
28
28
  export async function normalizeImageForModel(bytes) {
29
29
  const mod = await loadMedia();
30
- if (!mod)
30
+ if (!mod) {
31
31
  return bytes;
32
+ }
32
33
  try {
33
34
  const frame = firstFrame(await mod.image.decode(bytes));
34
35
  const oriented = await mod.image.orientate(frame, { file: bytes });
@@ -39,11 +40,20 @@ export async function normalizeImageForModel(bytes) {
39
40
  return bytes;
40
41
  }
41
42
  }
43
+ export async function rasterToModelJpeg(raster) {
44
+ const mod = await loadMedia();
45
+ if (!mod) {
46
+ return null;
47
+ }
48
+ const resized = await mod.image.resize(raster, { maxWidth: MAX_IMAGE_WIDTH });
49
+ return mod.image.encode(resized, { mimetype: 'image/jpeg' });
50
+ }
42
51
  function firstFrame(decoded) {
43
52
  if (!decoded.frames)
44
53
  return decoded;
45
54
  const [first] = decoded.frames;
46
- if (!first)
55
+ if (!first) {
47
56
  throw new Error('decoded image had no frames');
57
+ }
48
58
  return first;
49
59
  }
@@ -15,38 +15,52 @@ export function detectImageMime(bytes) {
15
15
  return 'image/png';
16
16
  if (isJpeg(bytes))
17
17
  return 'image/jpeg';
18
- if (isAvif(bytes))
18
+ if (isAvif(bytes)) {
19
19
  return 'image/avif';
20
- if (isHeif(bytes))
20
+ }
21
+ if (isHeif(bytes)) {
21
22
  return 'image/heic';
22
- if (isWebp(bytes))
23
+ }
24
+ if (isWebp(bytes)) {
23
25
  return 'image/webp';
24
- if (isGif(bytes))
26
+ }
27
+ if (isGif(bytes)) {
25
28
  return 'image/gif';
26
- if (isBmp(bytes))
29
+ }
30
+ if (isBmp(bytes)) {
27
31
  return 'image/bmp';
28
- if (isTiff(bytes))
32
+ }
33
+ if (isTiff(bytes)) {
29
34
  return 'image/tiff';
35
+ }
30
36
  return null;
31
37
  }
32
38
  export function mapDeclaredToSniffed(declared) {
33
39
  const normalized = declared.toLowerCase();
34
- if (normalized === 'image/png')
40
+ if (normalized === 'image/png') {
35
41
  return 'image/png';
36
- if (normalized === 'image/jpeg' || normalized === 'image/jpg')
42
+ }
43
+ if (normalized === 'image/jpeg' || normalized === 'image/jpg') {
37
44
  return 'image/jpeg';
38
- if (normalized === 'image/heic' || normalized === 'image/heif')
45
+ }
46
+ if (normalized === 'image/heic' || normalized === 'image/heif') {
39
47
  return 'image/heic';
40
- if (normalized === 'image/avif')
48
+ }
49
+ if (normalized === 'image/avif') {
41
50
  return 'image/avif';
42
- if (normalized === 'image/webp')
51
+ }
52
+ if (normalized === 'image/webp') {
43
53
  return 'image/webp';
44
- if (normalized === 'image/gif')
54
+ }
55
+ if (normalized === 'image/gif') {
45
56
  return 'image/gif';
46
- if (normalized === 'image/bmp' || normalized === 'image/x-ms-bmp')
57
+ }
58
+ if (normalized === 'image/bmp' || normalized === 'image/x-ms-bmp') {
47
59
  return 'image/bmp';
48
- if (normalized === 'image/tiff' || normalized === 'image/tif')
60
+ }
61
+ if (normalized === 'image/tiff' || normalized === 'image/tif') {
49
62
  return 'image/tiff';
63
+ }
50
64
  return null;
51
65
  }
52
66
  function isPng(bytes) {
@@ -73,8 +87,9 @@ function isHeif(bytes) {
73
87
  const b9 = bytes[9];
74
88
  const b10 = bytes[10];
75
89
  const b11 = bytes[11];
76
- if (b8 === undefined || b9 === undefined || b10 === undefined || b11 === undefined)
90
+ if (b8 === undefined || b9 === undefined || b10 === undefined || b11 === undefined) {
77
91
  return false;
92
+ }
78
93
  const brand = String.fromCharCode(b8, b9, b10, b11).toLowerCase();
79
94
  return HEIF_BRANDS.has(brand);
80
95
  }
@@ -85,13 +100,15 @@ function isAvif(bytes) {
85
100
  return false;
86
101
  }
87
102
  const major = brandAt(bytes, 8);
88
- if (major && AVIF_BRANDS.has(major))
103
+ if (major && AVIF_BRANDS.has(major)) {
89
104
  return true;
105
+ }
90
106
  const end = ftypBoxEnd(bytes);
91
107
  for (let offset = 16; offset + 4 <= end; offset += 4) {
92
108
  const compatible = brandAt(bytes, offset);
93
- if (compatible && AVIF_BRANDS.has(compatible))
109
+ if (compatible && AVIF_BRANDS.has(compatible)) {
94
110
  return true;
111
+ }
95
112
  }
96
113
  return false;
97
114
  }
@@ -100,8 +117,9 @@ function brandAt(bytes, offset) {
100
117
  const b = bytes[offset + 1];
101
118
  const c = bytes[offset + 2];
102
119
  const d = bytes[offset + 3];
103
- if (a === undefined || b === undefined || c === undefined || d === undefined)
120
+ if (a === undefined || b === undefined || c === undefined || d === undefined) {
104
121
  return null;
122
+ }
105
123
  return String.fromCharCode(a, b, c, d).toLowerCase();
106
124
  }
107
125
  function ftypBoxEnd(bytes) {
@@ -131,8 +149,9 @@ function isGif(bytes) {
131
149
  return false;
132
150
  if (bytes[0] !== 0x47 || bytes[1] !== 0x49 || bytes[2] !== 0x46)
133
151
  return false;
134
- if (bytes[3] !== 0x38 || bytes[5] !== 0x61)
152
+ if (bytes[3] !== 0x38 || bytes[5] !== 0x61) {
135
153
  return false;
154
+ }
136
155
  return bytes[4] === 0x37 || bytes[4] === 0x39;
137
156
  }
138
157
  function isBmp(bytes) {
@@ -141,9 +160,11 @@ function isBmp(bytes) {
141
160
  function isTiff(bytes) {
142
161
  if (bytes.length < 4)
143
162
  return false;
144
- if (bytes[0] === 0x49 && bytes[1] === 0x49)
163
+ if (bytes[0] === 0x49 && bytes[1] === 0x49) {
145
164
  return bytes[2] === 0x2a && bytes[3] === 0x00;
146
- if (bytes[0] === 0x4d && bytes[1] === 0x4d)
165
+ }
166
+ if (bytes[0] === 0x4d && bytes[1] === 0x4d) {
147
167
  return bytes[2] === 0x00 && bytes[3] === 0x2a;
168
+ }
148
169
  return false;
149
170
  }
@@ -2,21 +2,24 @@ import b4a from 'b4a';
2
2
  import { getAgent } from './agent.js';
3
3
  import { getChat } from './chat.js';
4
4
  import { NO_SUCH_AGENT, NOT_THE_HOST, SENDER_REVOKED } from './skill-secrets.js';
5
- const DEVICES = '@qvac/devices';
5
+ import { DEVICES } from './collections.js';
6
6
  export const NO_SUCH_CHAT = 'no such chat on the device hosting this agent';
7
7
  export const NO_RECORD_STORE = 'the device hosting this agent is not recording prompts right now';
8
8
  const MAX_ANSWER_BYTES = 2 * 1024 * 1024;
9
9
  export function createInferenceCallsReceiver(opts) {
10
10
  return async (request, fromDeviceId) => {
11
11
  const sender = await opts.mesh.view.get(DEVICES, { id: fromDeviceId });
12
- if (!sender || sender.revoked)
12
+ if (!sender || sender.revoked) {
13
13
  throw new Error(SENDER_REVOKED);
14
+ }
14
15
  const chat = await getChat(opts.mesh, request.chatId);
15
- if (!chat)
16
+ if (!chat) {
16
17
  throw new Error(NO_SUCH_CHAT);
18
+ }
17
19
  const agent = await getAgent(opts.mesh, chat.agentId);
18
- if (!agent)
20
+ if (!agent) {
19
21
  throw new Error(NO_SUCH_AGENT);
22
+ }
20
23
  if (!agent.providerDeviceId || !b4a.equals(agent.providerDeviceId, opts.deviceId)) {
21
24
  throw new Error(NOT_THE_HOST);
22
25
  }
@@ -20,10 +20,12 @@ function inviteClaimMessage(binding) {
20
20
  }
21
21
  export function inviteGrantTermsRefusal(terms, mintedAt) {
22
22
  const { expiresAt, maxUses } = terms;
23
- if (!expiresAt)
23
+ if (!expiresAt) {
24
24
  return INVITE_GRANT_NO_EXPIRY;
25
- if (expiresAt > mintedAt + GRANT_MAX_TTL_MS)
25
+ }
26
+ if (expiresAt > mintedAt + GRANT_MAX_TTL_MS) {
26
27
  return INVITE_GRANT_TOO_LONG;
28
+ }
27
29
  if (!maxUses || !Number.isInteger(maxUses) || maxUses < 1 || maxUses > GRANT_MAX_USES) {
28
30
  return INVITE_GRANT_USES_OUT_OF_RANGE;
29
31
  }
@@ -19,8 +19,9 @@ export function encodeMeshInvite(invite) {
19
19
  }
20
20
  export function decodeMeshInvite(raw) {
21
21
  const value = raw.trim().toLowerCase();
22
- if (!value.startsWith(INVITE_PREFIX))
22
+ if (!value.startsWith(INVITE_PREFIX)) {
23
23
  return null;
24
+ }
24
25
  let payload;
25
26
  try {
26
27
  payload = decodeStruct(INVITE_STRUCT, z32.decode(value.slice(INVITE_PREFIX.length)));
@@ -1,9 +1,5 @@
1
1
  import b4a from 'b4a';
2
- const FILES = '@local/files';
3
- const FILES_BY_BLOB = '@local/files-by-blob';
4
- const RECLAIMABLE_FILES = '@local/reclaimable-files-by-last-accessed';
5
- const LIVE_FILES = '@local/live-files';
6
- const CONFIG = '@local/config';
2
+ import { LOCAL_CONFIG, LOCAL_FILES, LOCAL_FILES_BY_BLOB, LOCAL_LIVE_FILES, LOCAL_RECLAIMABLE_FILES_BY_LAST_ACCESSED } from '../collections.js';
7
3
  const TOUCH_GRAIN_MS = 60 * 60 * 1000;
8
4
  export class LocalFiles {
9
5
  _db;
@@ -59,12 +55,12 @@ export class LocalFiles {
59
55
  const tx = this._db.transaction();
60
56
  let changed = false;
61
57
  for (const file of files) {
62
- const known = await tx.get(FILES, keyOf(file));
58
+ const known = await tx.get(LOCAL_FILES, keyOf(file));
63
59
  const row = next(file, known);
64
60
  if (!row) {
65
61
  continue;
66
62
  }
67
- await tx.insert(FILES, row);
63
+ await tx.insert(LOCAL_FILES, row);
68
64
  changed = true;
69
65
  }
70
66
  if (changed) {
@@ -78,45 +74,50 @@ export class LocalFiles {
78
74
  markCleared(file) {
79
75
  return this._locked(async () => {
80
76
  const tx = this._db.transaction();
81
- const known = await tx.get(FILES, keyOf(file));
77
+ const known = await tx.get(LOCAL_FILES, keyOf(file));
82
78
  if (!known) {
83
79
  await tx.close();
84
80
  return;
85
81
  }
86
- await tx.insert(FILES, { ...known, cleared: true });
82
+ await tx.insert(LOCAL_FILES, { ...known, cleared: true });
87
83
  await tx.flush();
88
84
  });
89
85
  }
90
86
  async meshOf(coreKey, blockOffset) {
91
87
  const key = { coreKey, blockOffset };
92
- const row = await this._db.findOne(FILES_BY_BLOB, { gte: key, lte: key });
88
+ const row = await this._db.findOne(LOCAL_FILES_BY_BLOB, { gte: key, lte: key });
93
89
  return row?.meshKey ?? null;
94
90
  }
95
91
  async backfilled(meshKey) {
96
- return (await this._db.get(CONFIG, { key: backfillKey(meshKey) })) !== null;
92
+ return ((await this._db.get(LOCAL_CONFIG, { key: backfillKey(meshKey) })) !== null);
97
93
  }
98
94
  markBackfilled(meshKey) {
99
95
  return this._locked(async () => {
100
96
  const tx = this._db.transaction();
101
- await tx.insert(CONFIG, { key: backfillKey(meshKey), value: true });
97
+ await tx.insert(LOCAL_CONFIG, { key: backfillKey(meshKey), value: true });
102
98
  await tx.flush();
103
99
  });
104
100
  }
105
101
  list(meshKey) {
106
- return this._db.find(FILES, meshRange(meshKey)).toArray();
102
+ return this._db.find(LOCAL_FILES, meshRange(meshKey)).toArray();
107
103
  }
108
104
  live(meshKey) {
109
- return this._db.find(LIVE_FILES, meshRange(meshKey)).toArray();
105
+ return this._db.find(LOCAL_LIVE_FILES, meshRange(meshKey)).toArray();
110
106
  }
111
107
  stale(cutoff) {
112
- return this._db.find(RECLAIMABLE_FILES, { lt: { lastAccessed: cutoff } }).toArray();
108
+ return this._db
109
+ .find(LOCAL_RECLAIMABLE_FILES_BY_LAST_ACCESSED, { lt: { lastAccessed: cutoff } })
110
+ .toArray();
113
111
  }
114
112
  }
115
113
  export async function dropMeshFiles(tx, meshKey) {
116
- const rows = await tx.find(FILES, { gte: { meshKey }, lte: { meshKey } }).toArray();
117
- for (const row of rows)
118
- await tx.delete(FILES, keyOf(row));
119
- await tx.delete(CONFIG, { key: backfillKey(meshKey) });
114
+ const rows = await tx
115
+ .find(LOCAL_FILES, { gte: { meshKey }, lte: { meshKey } })
116
+ .toArray();
117
+ for (const row of rows) {
118
+ await tx.delete(LOCAL_FILES, keyOf(row));
119
+ }
120
+ await tx.delete(LOCAL_CONFIG, { key: backfillKey(meshKey) });
120
121
  }
121
122
  function meshRange(meshKey) {
122
123
  return meshKey ? { gte: { meshKey }, lte: { meshKey } } : {};