@qvac/core 1.0.0-rc.2 → 1.0.0-rc.5

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 (213) hide show
  1. package/CHANGELOG.md +238 -12
  2. package/dist-lib/index.d.ts +3 -1
  3. package/dist-lib/index.js +1 -0
  4. package/dist-lib/lib/api/approval-rules.d.ts +1 -1
  5. package/dist-lib/lib/api/approval-rules.js +5 -1
  6. package/dist-lib/lib/api/chunk-delta.d.ts +7 -2
  7. package/dist-lib/lib/api/chunk-delta.js +89 -7
  8. package/dist-lib/lib/api/chunks.js +14 -8
  9. package/dist-lib/lib/api/config.d.ts +10 -3
  10. package/dist-lib/lib/api/config.js +51 -6
  11. package/dist-lib/lib/api/custom-models.js +3 -5
  12. package/dist-lib/lib/api/devices.js +3 -1
  13. package/dist-lib/lib/api/files.d.ts +1 -1
  14. package/dist-lib/lib/api/files.js +65 -8
  15. package/dist-lib/lib/api/index.d.ts +12 -2
  16. package/dist-lib/lib/api/index.js +6 -1
  17. package/dist-lib/lib/api/instrument.js +12 -4
  18. package/dist-lib/lib/api/members.js +7 -13
  19. package/dist-lib/lib/api/mesh.d.ts +1 -3
  20. package/dist-lib/lib/api/mesh.js +2 -2
  21. package/dist-lib/lib/api/notifications.js +8 -4
  22. package/dist-lib/lib/api/projects.js +5 -1
  23. package/dist-lib/lib/api/rag.js +32 -19
  24. package/dist-lib/lib/api/served.js +2 -1
  25. package/dist-lib/lib/api/workspace.js +0 -1
  26. package/dist-lib/lib/assistant/harness.d.ts +8 -2
  27. package/dist-lib/lib/assistant/harness.js +17 -4
  28. package/dist-lib/lib/assistant/history.d.ts +1 -1
  29. package/dist-lib/lib/assistant/history.js +19 -13
  30. package/dist-lib/lib/assistant/message.d.ts +6 -1
  31. package/dist-lib/lib/assistant/message.js +22 -2
  32. package/dist-lib/lib/assistant/model-round.d.ts +5 -0
  33. package/dist-lib/lib/assistant/model-round.js +47 -19
  34. package/dist-lib/lib/assistant/pdf-budget.d.ts +10 -2
  35. package/dist-lib/lib/assistant/pdf-budget.js +10 -11
  36. package/dist-lib/lib/assistant/pdf-pages.d.ts +25 -0
  37. package/dist-lib/lib/assistant/pdf-pages.js +75 -0
  38. package/dist-lib/lib/assistant/round-host.js +5 -3
  39. package/dist-lib/lib/assistant-client.d.ts +2 -1
  40. package/dist-lib/lib/assistant-client.js +24 -6
  41. package/dist-lib/lib/assistant-tree.d.ts +2 -0
  42. package/dist-lib/lib/assistant-tree.js +8 -5
  43. package/dist-lib/lib/assistant.d.ts +21 -7
  44. package/dist-lib/lib/assistant.js +481 -244
  45. package/dist-lib/lib/client.js +10 -1
  46. package/dist-lib/lib/compaction.d.ts +3 -1
  47. package/dist-lib/lib/compaction.js +18 -4
  48. package/dist-lib/lib/constants.d.ts +3 -0
  49. package/dist-lib/lib/constants.js +3 -0
  50. package/dist-lib/lib/core/agent-copies.js +7 -1
  51. package/dist-lib/lib/core/agent.js +1 -0
  52. package/dist-lib/lib/core/approval-rules.d.ts +5 -1
  53. package/dist-lib/lib/core/approval-rules.js +16 -1
  54. package/dist-lib/lib/core/chat-activity.js +13 -16
  55. package/dist-lib/lib/core/chat-copy.js +1 -1
  56. package/dist-lib/lib/core/chat-fork.js +2 -1
  57. package/dist-lib/lib/core/chat-move.d.ts +4 -0
  58. package/dist-lib/lib/core/chat-move.js +42 -11
  59. package/dist-lib/lib/core/chat.d.ts +0 -1
  60. package/dist-lib/lib/core/chat.js +1 -1
  61. package/dist-lib/lib/core/chunk.d.ts +14 -3
  62. package/dist-lib/lib/core/chunk.js +116 -25
  63. package/dist-lib/lib/core/collections.d.ts +12 -1
  64. package/dist-lib/lib/core/collections.js +12 -1
  65. package/dist-lib/lib/core/config-value.d.ts +7 -0
  66. package/dist-lib/lib/core/config-value.js +15 -0
  67. package/dist-lib/lib/core/contract/activity.d.ts +3 -2
  68. package/dist-lib/lib/core/contract/activity.js +39 -21
  69. package/dist-lib/lib/core/contract/agent-join.js +15 -19
  70. package/dist-lib/lib/core/contract/agents.js +8 -7
  71. package/dist-lib/lib/core/contract/chat.d.ts +3 -0
  72. package/dist-lib/lib/core/contract/chat.js +12 -1
  73. package/dist-lib/lib/core/contract/chunks.js +16 -6
  74. package/dist-lib/lib/core/contract/devices.js +6 -4
  75. package/dist-lib/lib/core/contract/index.js +2 -1
  76. package/dist-lib/lib/core/contract/invites.js +12 -31
  77. package/dist-lib/lib/core/contract/joined-meshes.js +2 -1
  78. package/dist-lib/lib/core/contract/mesh-rules.js +4 -0
  79. package/dist-lib/lib/core/contract/model-requests.js +7 -6
  80. package/dist-lib/lib/core/contract/project-device-keys.js +15 -6
  81. package/dist-lib/lib/core/contract/project-host-keys.js +5 -4
  82. package/dist-lib/lib/core/contract/projects.js +12 -13
  83. package/dist-lib/lib/core/contract/public-seeds.js +5 -5
  84. package/dist-lib/lib/core/contract/roles.js +2 -1
  85. package/dist-lib/lib/core/contract/run-requests.d.ts +1 -1
  86. package/dist-lib/lib/core/contract/run-requests.js +19 -13
  87. package/dist-lib/lib/core/contract/shipped-rows.d.ts +2 -0
  88. package/dist-lib/lib/core/contract/shipped-rows.js +22 -0
  89. package/dist-lib/lib/core/contract/workspace.js +6 -12
  90. package/dist-lib/lib/core/contract/writers.js +20 -6
  91. package/dist-lib/lib/core/deleted-agent-runs.d.ts +7 -0
  92. package/dist-lib/lib/core/deleted-agent-runs.js +46 -0
  93. package/dist-lib/lib/core/devices.d.ts +2 -1
  94. package/dist-lib/lib/core/devices.js +4 -2
  95. package/dist-lib/lib/core/document-attachment.d.ts +6 -3
  96. package/dist-lib/lib/core/document-attachment.js +10 -5
  97. package/dist-lib/lib/core/files/attachments.js +3 -3
  98. package/dist-lib/lib/core/files/index.d.ts +8 -5
  99. package/dist-lib/lib/core/files/index.js +111 -18
  100. package/dist-lib/lib/core/files/processing/index.d.ts +1 -1
  101. package/dist-lib/lib/core/files/processing/index.js +8 -2
  102. package/dist-lib/lib/core/files/processing/source.d.ts +1 -0
  103. package/dist-lib/lib/core/files/processing/source.js +3 -0
  104. package/dist-lib/lib/core/files/processing/state.d.ts +1 -0
  105. package/dist-lib/lib/core/files/processing/state.js +7 -0
  106. package/dist-lib/lib/core/files/rag/build.d.ts +1 -0
  107. package/dist-lib/lib/core/files/rag/build.js +14 -1
  108. package/dist-lib/lib/core/files/rag/index.d.ts +1 -1
  109. package/dist-lib/lib/core/files/rag/index.js +1 -1
  110. package/dist-lib/lib/core/files/rag/produce.js +1 -0
  111. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +2 -0
  112. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +7 -1
  113. package/dist-lib/lib/core/first-event.d.ts +6 -0
  114. package/dist-lib/lib/core/first-event.js +13 -0
  115. package/dist-lib/lib/core/invite.d.ts +2 -2
  116. package/dist-lib/lib/core/invite.js +5 -4
  117. package/dist-lib/lib/core/local/index.d.ts +16 -1
  118. package/dist-lib/lib/core/local/index.js +119 -10
  119. package/dist-lib/lib/core/mesh.d.ts +14 -3
  120. package/dist-lib/lib/core/mesh.js +127 -54
  121. package/dist-lib/lib/core/migrations/chat-chunks.d.ts +4 -0
  122. package/dist-lib/lib/core/migrations/chat-chunks.js +47 -0
  123. package/dist-lib/lib/core/migrations/file-index.d.ts +1 -1
  124. package/dist-lib/lib/core/migrations/file-index.js +6 -2
  125. package/dist-lib/lib/core/migrations/index.d.ts +2 -1
  126. package/dist-lib/lib/core/migrations/index.js +66 -9
  127. package/dist-lib/lib/core/notification.js +96 -23
  128. package/dist-lib/lib/core/pdf/figure.d.ts +22 -0
  129. package/dist-lib/lib/core/pdf/figure.js +64 -0
  130. package/dist-lib/lib/core/pdf/rasterize.d.ts +10 -1
  131. package/dist-lib/lib/core/pdf/rasterize.js +72 -22
  132. package/dist-lib/lib/core/peer-duplex.js +57 -5
  133. package/dist-lib/lib/core/public-mesh.js +8 -2
  134. package/dist-lib/lib/core/run-requests.js +2 -3
  135. package/dist-lib/lib/core/senders.d.ts +7 -6
  136. package/dist-lib/lib/core/senders.js +23 -30
  137. package/dist-lib/lib/core/shared-agents.d.ts +1 -0
  138. package/dist-lib/lib/core/shared-agents.js +47 -19
  139. package/dist-lib/lib/core/skill-secrets.d.ts +3 -2
  140. package/dist-lib/lib/core/skill-secrets.js +4 -1
  141. package/dist-lib/lib/core/sync/background.d.ts +3 -15
  142. package/dist-lib/lib/core/sync/background.js +25 -102
  143. package/dist-lib/lib/core/sync/devices.js +6 -3
  144. package/dist-lib/lib/core/sync/index.js +25 -3
  145. package/dist-lib/lib/core/sync-status.js +3 -3
  146. package/dist-lib/lib/core/vault-managed-skills.d.ts +18 -0
  147. package/dist-lib/lib/core/vault-managed-skills.js +105 -0
  148. package/dist-lib/lib/core.d.ts +66 -10
  149. package/dist-lib/lib/core.js +768 -179
  150. package/dist-lib/lib/credential-pusher.d.ts +11 -7
  151. package/dist-lib/lib/credential-pusher.js +40 -8
  152. package/dist-lib/lib/device-tree.d.ts +18 -0
  153. package/dist-lib/lib/device-tree.js +32 -0
  154. package/dist-lib/lib/doctor/redact.js +1 -1
  155. package/dist-lib/lib/errors.d.ts +12 -0
  156. package/dist-lib/lib/errors.js +12 -0
  157. package/dist-lib/lib/fs-drive-bridge.d.ts +7 -0
  158. package/dist-lib/lib/fs-drive-bridge.js +308 -30
  159. package/dist-lib/lib/integrations/setup-routes.js +7 -5
  160. package/dist-lib/lib/knowledge-search.d.ts +1 -1
  161. package/dist-lib/lib/knowledge-search.js +5 -46
  162. package/dist-lib/lib/kv-cache-retention.d.ts +35 -0
  163. package/dist-lib/lib/kv-cache-retention.js +98 -0
  164. package/dist-lib/lib/latest-frame.d.ts +10 -0
  165. package/dist-lib/lib/latest-frame.js +48 -0
  166. package/dist-lib/lib/mesh-scoped-engine.js +1 -0
  167. package/dist-lib/lib/model-download.d.ts +6 -1
  168. package/dist-lib/lib/model-download.js +32 -17
  169. package/dist-lib/lib/oauth/resolve.js +13 -5
  170. package/dist-lib/lib/reconnecting-watch.js +19 -11
  171. package/dist-lib/lib/run-notices.d.ts +2 -0
  172. package/dist-lib/lib/run-notices.js +5 -0
  173. package/dist-lib/lib/run-replay.d.ts +13 -1
  174. package/dist-lib/lib/run-replay.js +58 -21
  175. package/dist-lib/schema/build.js +66 -57
  176. package/dist-lib/schema/config.d.ts +1 -1
  177. package/dist-lib/schema/config.js +1 -1
  178. package/dist-lib/schema/content.js +2 -1
  179. package/dist-lib/schema/engine.js +70 -6
  180. package/dist-lib/schema/field-order.js +7 -1
  181. package/dist-lib/schema/indexes.d.ts +4 -0
  182. package/dist-lib/schema/indexes.js +18 -0
  183. package/dist-lib/schema/local.js +9 -2
  184. package/dist-lib/schema/qvac.js +116 -6
  185. package/dist-lib/spec/bind.js +15 -0
  186. package/dist-lib/spec/calls.js +5 -0
  187. package/dist-lib/spec/capabilities.d.ts +10 -0
  188. package/dist-lib/spec/config/hyperconf/index.js +1 -1
  189. package/dist-lib/spec/hrpc/hrpc.json +65 -0
  190. package/dist-lib/spec/hrpc/index.js +63 -3
  191. package/dist-lib/spec/hrpc/messages.js +1537 -1395
  192. package/dist-lib/spec/hyperschema/index.js +1537 -1395
  193. package/dist-lib/spec/hyperschema/schema.json +126 -1
  194. package/dist-lib/spec/hyperschema/types.d.ts +33 -1
  195. package/dist-lib/spec/local/hyperdb/messages.js +110 -54
  196. package/dist-lib/spec/local/hyperschema/index.js +56 -28
  197. package/dist-lib/spec/local/hyperschema/schema.json +55 -20
  198. package/dist-lib/spec/local/hyperschema/types.d.ts +8 -1
  199. package/dist-lib/spec/mesh/hyperdb/db.json +255 -51
  200. package/dist-lib/spec/mesh/hyperdb/index.js +1063 -404
  201. package/dist-lib/spec/mesh/hyperdb/messages.js +1673 -1202
  202. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +62 -56
  203. package/dist-lib/spec/mesh/hyperdispatch/index.js +156 -139
  204. package/dist-lib/spec/mesh/hyperdispatch/messages.js +809 -632
  205. package/dist-lib/spec/mesh/hyperschema/index.js +809 -632
  206. package/dist-lib/spec/mesh/hyperschema/schema.json +293 -174
  207. package/dist-lib/spec/mesh/hyperschema/types.d.ts +31 -1
  208. package/package.json +32 -26
  209. package/worker/assistant-sidecar.mjs +3 -0
  210. package/dist-lib/lib/core/files/processing/settle.d.ts +0 -13
  211. package/dist-lib/lib/core/files/processing/settle.js +0 -86
  212. package/dist-lib/lib/core/migrations/device-indexes.d.ts +0 -2
  213. package/dist-lib/lib/core/migrations/device-indexes.js +0 -7
package/CHANGELOG.md CHANGED
@@ -15,6 +15,23 @@ release.
15
15
 
16
16
  ### Added
17
17
 
18
+ - A completed run that primed the chat cache after Core deleted it says so on its
19
+ `run-status.metrics`: `cacheRebuild` carries Core's deletion reason and the prompt tokens of the
20
+ run's first round on the key, as its `metrics.rounds` counts them, null when that round has no
21
+ count. A run whose first round was taken on another device reports nothing, since that device
22
+ keeps its own cache. A run that reused the cache carries no key.
23
+
24
+ ```js
25
+ const { runStatus } = chunk
26
+ if (runStatus.state === 'completed' && runStatus.metrics?.cacheRebuild) {
27
+ const { reason, tokens } = runStatus.metrics.cacheRebuild
28
+ }
29
+ ```
30
+
31
+ - The last agent to stop running a loaded model on a device — deleted, moved to another device or
32
+ switched to another model — unloads it there, so the memory is freed without waiting for the idle
33
+ sweep. A model loaded by hand that no agent runs stays loaded.
34
+
18
35
  - `@qvac/core/sidecar-entry` names the script a host spawns as Core's sidecar, so a host
19
36
  resolves it by name instead of a path into the package. `test/basic/entry-weight.ts` holds
20
37
  every named entry to a ceiling on the files importing it loads, so an app that imports a
@@ -52,20 +69,34 @@ release.
52
69
 
53
70
  ### Changed
54
71
 
55
- - Core depends on `@qvac/harness` 1.0.0-rc.8 from npm instead of a git commit, so a consumer installs
56
- the published harness with its named entries.
72
+ - The KV cache retention sweep runs every 12 hours instead of every hour, besides when a mesh opens
73
+ and when `kvCache.retentionDays` changes, so a cache can outlive its retention by up to 12 hours
74
+ on a host that stays up. ([config.md](docs/api/config.md#kv-cache-retention))
57
75
 
58
- - The baked version floor is `>=0.21.0`: one build per mesh, since v0.21 changes
59
- what apply admits. Each mesh now holds a rules row, `@qvac/mesh-rules`, first
60
- in a new mesh's genesis and appended once when this build first holds an
61
- existing mesh writable, and apply holds new rules to ops after it only. A
62
- 0.7.x replica that applies the row halts into its update prompt.
76
+ - Core depends on `@qvac/harness` 1.0.0-rc.16 from npm instead of a git commit, so a consumer installs
77
+ the published harness with its named entries.
63
78
 
64
- **Operator step:** publish `>=0.21.0` with `qvac-app → scripts/ota-config.mjs`
65
- on each lane (dev, staging, prod) only once app 0.21 is live on that lane, and
79
+ - Wipe a store written by 1.0.0-rc.0 to rc.2 before running this build. The collection, route and
80
+ field ids those prereleases gave the 1.0 additions moved up by one to keep 0.11.1's in place, so
81
+ this build misreads their rows without an error. A store from 0.11.1 or earlier upgrades as is.
82
+ Nor does the wipe carry over a mesh an rc wrote to, minted there or a 0.11 mesh an rc device
83
+ held writable, since an rc raises the rules on each: other peers and the blind peers still hold
84
+ its rc-numbered ops, so a device that rejoins it, by a recovery from the phrase too, misreads
85
+ them again. Start a new account on this build instead.
86
+
87
+ - The baked version floor is `>=0.22.0`: one build per mesh, since this release
88
+ changes what apply admits and app 0.22 is the first to ship it. Each mesh now
89
+ holds a rules row, `@qvac/mesh-rules`, first in a new mesh's genesis and
90
+ appended once when this build first holds an existing mesh writable, and apply
91
+ holds new rules to ops after it only. A 0.7.x or 0.11.x replica that applies
92
+ the row halts into its update prompt.
93
+
94
+ **Operator step:** publish `>=0.22.0` with `qvac-app → scripts/ota-config.mjs`
95
+ on each lane (dev, staging, prod) only once app 0.22 is live on that lane, and
66
96
  never before: a floor above the installed release withholds every device on
67
- the lane. Until it is published, an old replica that fast-forwards past the row
68
- applies later ops under the old rules.
97
+ the lane. Not `>=0.21.0`, which admits app 0.21 and its core 0.11.1, from
98
+ before the row. Until it is published, an old replica that fast-forwards past
99
+ the row applies later ops under the old rules.
69
100
 
70
101
  - A rules row raised above the rules this build knows halts apply into its
71
102
  update prompt with the code `MESH_RULES_FROM_A_NEWER_BUILD`, instead of being
@@ -80,6 +111,197 @@ release.
80
111
  - A resume whose announce reached no DHT node retries that topic within
81
112
  seconds, instead of leaving the device unfindable for ten minutes.
82
113
 
114
+ ## [0.11.4] - 2026-10-30
115
+
116
+ ### Changed
117
+
118
+ - A `mesh write` or `mesh drain` stall now keeps reporting while it lasts (#649). Each `… still pending`
119
+ line carries `reports` (1, 2, 3 …), and the wait doubles between reports. It also names:
120
+ - `fastForwarding`: the head a fast-forward is booting onto, with how much of that core this
121
+ device and its peers hold, or `null`.
122
+ - `peerLength` and `peerHeld` on every `missing` core: how far the furthest connected peer
123
+ knows that core, and how much of it that peer holds from block 0.
124
+ - `writers` on a mesh still joining: each writer it knows, with the same holdings.
125
+ - The logs now name the build and what an open did to an older mesh (#650):
126
+ - `core opening` is the first line of a launch. It names the app's `version`, `build` and
127
+ `channel`, and the mesh `schema` this core applies. A mesh's own `opening` line names the
128
+ `schema` too.
129
+ - `migrations ran` follows each pass on open. It lists the steps that wrote, each step's `ms`,
130
+ and the step that threw as `failed`. A pass still going after 15 s logs
131
+ `migrations still running` with its current step, again after 30 s, 60 s, and so on.
132
+ - `copied chats into chat-chunks` and `recorded the files the mesh already held` give each
133
+ backfill's count and `ms`.
134
+
135
+ ### Fixed
136
+
137
+ - The assistant no longer logs `saveDeviceCapabilities failed` while the account mesh is still
138
+ joining. Core refuses the report with `MESH_STILL_JOINING` until this device is a writer, and the
139
+ assistant already reports again once the account turns writable, so the refusal was never a
140
+ failure. (#648)
141
+
142
+ ## [0.11.3] - 2026-10-28
143
+
144
+ ### Added
145
+
146
+ - The first run to complete stores which pictures of a PDF it sent, as an attachment chunk whose
147
+ `sourceId` is the PDF's attachment id, so later turns and other devices send the same ones. Do
148
+ not render an attachment chunk that carries a `sourceId`. (#640)
149
+
150
+ ### Changed
151
+
152
+ - A PDF's pictures reach a vision model cut to each figure and its caption, named by page and
153
+ figure, instead of as whole pages, and white pages are no longer sent. The PDF's text and its
154
+ pictures now share half the context window, less what the chat already holds, where each took
155
+ half before: a PDF whose whole text fit filled the window and compacted on the next message.
156
+ (#640)
157
+ - `bare-pdfium` is required at `^1.8.0`, for `imageBounds` and `pageBox`; a host that packages the
158
+ addon ships that version. (#640)
159
+
160
+ ## [0.11.2] - 2026-10-28
161
+
162
+ ### Added
163
+
164
+ - A chat's KV cache is deleted once the chat has been idle for the retention, so a device no
165
+ longer keeps the cache of every chat it ever ran. The chat itself is untouched; its next message
166
+ primes from history. An app sets its default with `kvCacheRetentionMs` on `assistantChild` (14
167
+ days without it, `0` for Never), and a device overrides it with `kvCache.retentionDays`. (#589)
168
+
169
+ ```js
170
+ import { assistantChild } from '@qvac/core'
171
+ import { KV_CACHE_RETENTION_KEY } from '@qvac/core/constants'
172
+
173
+ assistantChild({ harness, kvCacheRetentionMs: 30 * 24 * 60 * 60_000 })
174
+ await engine.configSet({ key: KV_CACHE_RETENTION_KEY, value: 7 })
175
+ ```
176
+
177
+ - Every credential a skill declares is pushed to the harness, not only the built-in keys and
178
+ OAuth tokens, so a skill with its own key no longer reads needs-setup for good and needs no core
179
+ release. Where a value may be sent is unchanged, and an overlay skill gets no credential. (#596)
180
+ - A credential with no setup block and no token provider gets a one-field token route named after
181
+ its key, so any setup UI can set it. (#591)
182
+ - `duck` sets a skill up through one sheet, opened by `/skill <name>`. (#592)
183
+
184
+ ### Changed
185
+
186
+ - `toolResult.result` is required on the wire, so a tool result of `false`, `0` or `''` reads
187
+ back as written from `listChunks` and `chunksWatch` instead of `null`. A device on 0.11.0 or
188
+ earlier, and a result one of those releases wrote, still read `null`. (#559)
189
+
190
+ ```js
191
+ // 0.11.1
192
+ { type: 'tool-result', toolResult: { name } }
193
+ // 0.11.2
194
+ { type: 'tool-result', toolResult: { name, result: null } }
195
+ ```
196
+
197
+ ### Removed
198
+
199
+ - `duck`'s `/cred`: every value is set through its skill's sheet. (#593)
200
+
201
+ ### Fixed
202
+
203
+ - Chat activity no longer diffs across a fast-forward it has not counted yet. It
204
+ dropped its cached view head only once `fastForwards` moved, which can be
205
+ after the view has landed on another core, and a diff from the old head read
206
+ every node of the new view. It now drops the head whenever the view is on
207
+ another core, as `chunksDeltaWatch` does. (#623)
208
+ - A device that does not hold a mesh no longer downloads most of it to show chat
209
+ activity and notifications. Both read a few chunk types per chat, each through
210
+ its type index and then row by row from `@qvac/chunks`; they now read the
211
+ chat's range of `@qvac/chat-chunks` once and keep those types, where that
212
+ range is whole. A member joining a 170-chat mesh with both open downloaded
213
+ about 39,000 blocks (155 MB) instead of 258,000 (640 MB), and on a device that
214
+ holds the mesh their first frames take 2.2 s and 3.7 s instead of 5.8 s and
215
+ 9.8 s. (#624)
216
+ - `compactChat` folds whole turns, so a chat whose messages were queued no longer keeps answers
217
+ without their questions. (#607)
218
+ - A run whose injected excerpts overflow the model window, with no older turns to fold, is retried
219
+ with half the excerpts instead of failing. (#599)
220
+ - `ragSearch` on a remote agent host waits for an attached file still replicating to it instead of
221
+ answering that the file is still being indexed. (#562)
222
+ - A chat whose first message carries a document is titled from the words the user typed, not the
223
+ document text. (#516)
224
+ - A re-homed agent's skill values are retried until the new host takes them; a host that refused
225
+ before it replicated the re-home left them unset. (#478)
226
+
227
+ ## [0.11.1] - 2026-10-26
228
+
229
+ ### Added
230
+
231
+ - `deviceTree(transport, { core, assistant, office, logger })` boots Core and
232
+ the assistant under one supervisor, the way the app does. (#544)
233
+ - The `reindex-chat-chunks` op copies a chat written before this release into
234
+ `@qvac/chat-chunks`. A build older than this one halts on it, so a device
235
+ sends it only once the published version floor shuts out every app release
236
+ before 0.21.0, the first whose core applies it. A build under the floor opens
237
+ no mesh, so none can halt on it; publish `>=0.21.0` once that release is in
238
+ both stores. (#491)
239
+ - A device's row in the account carries `customModels`: the label, task type
240
+ and size of each custom model it has. A paired desktop showed a custom model
241
+ added on the phone by its `custom:…` id, as Other and of unknown size, and
242
+ counted it outside the phone's LLMs. `saveDeviceCapabilities` takes the field,
243
+ and the assistant reports it again when a custom model is renamed. (#556)
244
+
245
+ ### Changed
246
+
247
+ - `chunksDeltaWatch` reads only the rows that changed after its opening reset,
248
+ so an update no longer costs the whole chat. Frames are unchanged; a
249
+ selection with `limit` is still read whole. (#538)
250
+ - Injection-mode `ragSearch` sizes its excerpts to a quarter of the agent's
251
+ context window, capped at the 3072-token default, so a small window gets
252
+ fewer excerpts instead of overflowing. (#588)
253
+ - `hypercore` 11.39 and `hypercore-storage` 3.4, for a working purge. (#539)
254
+ - `hypercore-blob-server` 1.15.1 keeps its socket listening across a suspend,
255
+ so resume keeps the port and every minted link, and replaces the local patch.
256
+ (#561)
257
+
258
+ ### Fixed
259
+
260
+ - A member whose only device in a shared mesh comes back far behind
261
+ fast-forwards instead of replaying everything it missed (183 s to 3.9 s on a
262
+ mesh about 6,900 flushes ahead): a shared mesh trusts every member's live
263
+ devices, not only this member's own, and never a device admitted unlinked. A
264
+ compute mesh still trusts only its own member's devices. (#492)
265
+ - Opening a chat on a device that does not hold the mesh no longer downloads most
266
+ of the mesh. Each chunk is also kept in `@qvac/chat-chunks`, keyed by chat and
267
+ `seq`, and a chat read is one range of it: a 1,100-chunk chat fetched about
268
+ 1,000 blocks instead of 100,000. Once the published floor is at app 0.21.0 or
269
+ later, the chats written before this release are copied in the background, one
270
+ op per chat; until then, or while an older build still writes to a chat, it
271
+ reads the way it did before. A chat an older build purged also loses the rows
272
+ that build left in `@qvac/chat-chunks`. (#490, #491)
273
+ - `configGet` and `configWatch` return a stored `false`, `0` or `''` as written
274
+ instead of `null`. A device on 0.11.0 or earlier, a value one of those
275
+ releases wrote, and a downgrade to one still read them as `null`. (#546)
276
+ - A message's audio attachment is presented to the model as a transcript of its
277
+ speech only, so a tool that reads the audio itself, such as music
278
+ transcription, is used again. (#337)
279
+ - The assistant reports an agent it hosts in a shared mesh as soon as this
280
+ device has joined it. A device still joining had its report refused and never
281
+ reported again. (#324)
282
+ - `removeDevice` on the account revokes the device in a shared mesh whose row
283
+ for it arrives after the removal. Before, it stayed a writer there. (#547)
284
+ - `inferenceCalls` and the skill routes (`pushSkillSecret`,
285
+ `listManagedSkills`, `readSkillFile`, `writeSkillFile`, `copySkillForEdit`,
286
+ `deleteOverlaySkill`) from a device that has just paired no longer fail with
287
+ `PEER_SENDER_REVOKED`: the host waits up to 30 s for the new device's row.
288
+ (#544)
289
+ - Core no longer dies of an unhandled `REQUEST_CANCELLED` when a fast-forward
290
+ cancels the read that follows a joined mesh's shared meshes. (#474)
291
+ - A device restarted while its `joinMesh` is still `joining` boots the mesh
292
+ from the head its invite carried, instead of replaying it from its first
293
+ block, which on a big mesh took minutes. (#515)
294
+ - `meshInvite` on a device that just recovered with `recoverAccount` waits for
295
+ its member link instead of failing with "This device cannot reach its account
296
+ to check". (#540)
297
+ - A question sent while the previous run was still answering is shown to the
298
+ model after that answer, not before it, once compaction folds the earlier
299
+ turns. The run's reply and its file turns were sorted behind the new question,
300
+ and the model answered as if they came later (QVAC-24502). A file a run
301
+ produced is now replayed right behind that run's answer instead of at the end
302
+ of the chat; an existing chat with such a turn re-reads once after the update.
303
+ (#584)
304
+
83
305
  ## [0.11.0] - 2026-10-23
84
306
 
85
307
  ### Added
@@ -1992,7 +2214,11 @@ Published under the `release-0.1` dist-tag.
1992
2214
  await assistant.ready()
1993
2215
  ```
1994
2216
 
1995
- [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.11.0...HEAD
2217
+ [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.11.4...HEAD
2218
+ [0.11.4]: https://github.com/tetherto/qvac-core/compare/v0.11.3...v0.11.4
2219
+ [0.11.3]: https://github.com/tetherto/qvac-core/compare/v0.11.2...v0.11.3
2220
+ [0.11.2]: https://github.com/tetherto/qvac-core/compare/v0.11.1...v0.11.2
2221
+ [0.11.1]: https://github.com/tetherto/qvac-core/compare/v0.11.0...v0.11.1
1996
2222
  [0.11.0]: https://github.com/tetherto/qvac-core/compare/v0.10.4...v0.11.0
1997
2223
  [0.10.4]: https://github.com/tetherto/qvac-core/compare/v0.10.3...v0.10.4
1998
2224
  [0.10.3]: https://github.com/tetherto/qvac-core/compare/v0.10.2...v0.10.3
@@ -1,10 +1,12 @@
1
1
  export type { AssistantAgent, AssistantAgentList, AssistantConfigValue } from './spec/hyperschema/types.d.ts';
2
2
  export type { Logger } from './lib/logger-type.ts';
3
- export { Core } from './lib/core.ts';
3
+ export { Core, type CoreOptions } from './lib/core.ts';
4
+ export type { VaultManagedSkillField, VaultManagedSkills } from './lib/core/vault-managed-skills.ts';
4
5
  export { Client } from './lib/client.ts';
5
6
  export { AssistantClient } from './lib/assistant-client.ts';
6
7
  export { harnessDeleteModel, harnessListModels, harnessSkillCatalog, harnessTools, QvacAssistant, type Harness, type ListModelsOptions, type ModelInfo, type ModelType, type Skill, type ToolCatalogEntry } from './lib/assistant.ts';
7
8
  export { assistantChild, assistantTree, type AssistantChildOptions, type AssistantTreeOptions, type EmbedderFactory, type HarnessContext, type HarnessFactory } from './lib/assistant-tree.ts';
9
+ export { deviceTree, type DeviceTree, type DeviceTreeOptions } from './lib/device-tree.ts';
8
10
  export { ASSISTANT_WAKEUP_LINGER_MS, createAssistantSuspendLifecycle, type AssistantSuspendLifecycleOptions } from './lib/suspend-lifecycle.ts';
9
11
  export { default as Supervisor } from 'bare-supervisor';
10
12
  export type { AssistantDiagnostics, DiagnosticsSlice, HarnessDiagnostics, RunSummary } from './lib/diagnostics.ts';
package/dist-lib/index.js CHANGED
@@ -3,6 +3,7 @@ export { Client } from './lib/client.js';
3
3
  export { AssistantClient } from './lib/assistant-client.js';
4
4
  export { harnessDeleteModel, harnessListModels, harnessSkillCatalog, harnessTools, QvacAssistant } from './lib/assistant.js';
5
5
  export { assistantChild, assistantTree } from './lib/assistant-tree.js';
6
+ export { deviceTree } from './lib/device-tree.js';
6
7
  export { ASSISTANT_WAKEUP_LINGER_MS, createAssistantSuspendLifecycle } from './lib/suspend-lifecycle.js';
7
8
  export { default as Supervisor } from 'bare-supervisor';
8
9
  export { clientSessions, duplexPair } from '@qvac/harness/transport';
@@ -1,3 +1,3 @@
1
1
  import { type MeshPool } from './current-mesh.ts';
2
2
  import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
3
- export declare function createApprovalRulesApi(pool: MeshPool): Pick<CapabilityHandlers, 'listApprovalRules'>;
3
+ export declare function createApprovalRulesApi(pool: MeshPool): Pick<CapabilityHandlers, 'listApprovalRules' | 'removeApprovalRule'>;
@@ -1,4 +1,4 @@
1
- import { listApprovalRules } from '../core/approval-rules.js';
1
+ import { listApprovalRules, removeApprovalRule } from '../core/approval-rules.js';
2
2
  import { requireMesh } from './current-mesh.js';
3
3
  export function createApprovalRulesApi(pool) {
4
4
  return {
@@ -8,6 +8,10 @@ export function createApprovalRulesApi(pool) {
8
8
  rules: await listApprovalRules(mesh),
9
9
  ourMemberId: mesh.ourMemberId ?? undefined
10
10
  };
11
+ },
12
+ removeApprovalRule: async ({ meshId, ruleId }) => {
13
+ await removeApprovalRule(await requireMesh(pool, meshId, { route: 'put-approval-rule' }), ruleId);
14
+ return { ok: true };
11
15
  }
12
16
  };
13
17
  }
@@ -1,7 +1,12 @@
1
1
  import { type Readable } from 'streamx';
2
- import type { AssistantChunk, AssistantChunkDelta, AssistantChunkList } from '../../spec/hyperschema/types.d.ts';
2
+ import type { LoggerInterface } from '@qvac/logging';
3
+ import type { AssistantChunk, AssistantChunkDelta } from '../../spec/hyperschema/types.d.ts';
3
4
  import type { WatchStream } from '../../spec/capabilities.d.ts';
5
+ import { type ListChunksInput } from '../core/chunk.ts';
6
+ import type { Mesh } from '../core/mesh.ts';
7
+ import { type Senders } from '../core/senders.ts';
4
8
  type Rows = ReadonlyMap<string, AssistantChunk>;
5
9
  export declare function chunkDelta(prev: Rows | null, next: ReadonlyArray<AssistantChunk>): AssistantChunkDelta;
6
- export declare function chunkDeltaStream(lists: Readable & AsyncIterable<AssistantChunkList>): Readable & WatchStream<AssistantChunkDelta>;
10
+ export declare function chunkDeltas(selection: ListChunksInput, log: LoggerInterface | null, lookup?: () => Promise<Senders | null>): (mesh: Mesh) => Promise<AssistantChunkDelta>;
11
+ export declare function chunkDeltaStream(frames: Readable & AsyncIterable<AssistantChunkDelta>): Readable & WatchStream<AssistantChunkDelta>;
7
12
  export {};
@@ -1,4 +1,8 @@
1
+ import b4a from 'b4a';
1
2
  import { pipeline, Transform } from 'streamx';
3
+ import { linkChunks, listChunks, recordLinks, selectsChunk } from '../core/chunk.js';
4
+ import { CHUNKS } from '../core/collections.js';
5
+ import { withSenders } from '../core/senders.js';
2
6
  import { frameReadable } from '../frame-readable.js';
3
7
  import { snapshotEquals } from './watchable.js';
4
8
  export function chunkDelta(prev, next) {
@@ -14,13 +18,91 @@ export function chunkDelta(prev, next) {
14
18
  }
15
19
  return { reset: false, chunks: upserts, removed, count };
16
20
  }
17
- export function chunkDeltaStream(lists) {
18
- let prev = null;
21
+ export function chunkDeltas(selection, log, lookup = async () => null) {
22
+ let rows = null;
23
+ let head = null;
24
+ let named = null;
25
+ return async (mesh) => {
26
+ const current = mesh.view.db.head();
27
+ const from = head && current && b4a.equals(head.key, current.key) ? head : null;
28
+ head = current;
29
+ const senders = await lookup();
30
+ const renamed = (await sendersKey(senders, rows)) !== named;
31
+ const changed = rows && from && !renamed && selection.limit === undefined
32
+ ? await changedRows(mesh, { from, selection, rows, log })
33
+ : null;
34
+ if (rows === null || changed === null) {
35
+ const next = await withSenders(await listChunks(mesh, selection), senders);
36
+ const delta = chunkDelta(rows, next);
37
+ const sent = new Set(delta.chunks?.map((chunk) => chunk.id));
38
+ rows = new Map(next.map((chunk) => [chunk.id, chunk]));
39
+ named = await sendersKey(senders, rows);
40
+ await recordLinks(mesh, next.filter((chunk) => sent.has(chunk.id)));
41
+ return delta;
42
+ }
43
+ const upserts = await withSenders(changed.upserts, senders);
44
+ const delta = applyChanged(rows, { ...changed, upserts }, selection.reverse === true);
45
+ named = await sendersKey(senders, rows);
46
+ await recordLinks(mesh, delta.chunks);
47
+ return delta;
48
+ };
49
+ }
50
+ async function sendersKey(senders, rows) {
51
+ if (!senders || !rows) {
52
+ return null;
53
+ }
54
+ const ids = new Set();
55
+ for (const chunk of rows.values()) {
56
+ const id = chunk.type === 'user-message' ? (chunk.senderMemberId ?? chunk.requesterMemberId) : null;
57
+ if (id) {
58
+ ids.add(b4a.toHex(id));
59
+ }
60
+ }
61
+ return JSON.stringify(await Promise.all([...ids].sort().map((hex) => senders(b4a.from(hex, 'hex')))));
62
+ }
63
+ function applyChanged(rows, { upserts, removed }, reverse) {
64
+ for (const id of removed) {
65
+ rows.delete(id);
66
+ }
67
+ for (const chunk of upserts) {
68
+ rows.set(chunk.id, chunk);
69
+ }
70
+ const count = rows.size;
71
+ const reset = upserts.length + removed.length > count / 2;
72
+ const chunks = (reset ? [...rows.values()] : upserts).sort((a, b) => reverse ? b.seq - a.seq : a.seq - b.seq);
73
+ return { reset, chunks, removed: reset ? [] : removed, count };
74
+ }
75
+ async function changedRows(mesh, { from, selection, rows, log }) {
76
+ const snap = mesh.view.snapshot();
77
+ const upserts = [];
78
+ const removed = [];
79
+ try {
80
+ for await (const change of snap.changes({ from })) {
81
+ if (change.collection !== CHUNKS)
82
+ continue;
83
+ if (change.type === 'insert' && selectsChunk(selection, change.value)) {
84
+ upserts.push(change.value);
85
+ }
86
+ else if (rows.has(change.value.id)) {
87
+ removed.push(change.value.id);
88
+ }
89
+ }
90
+ }
91
+ catch (err) {
92
+ log?.warn(['api', 'watch'], 'chunk diff from the held head failed, reading in full', err);
93
+ return null;
94
+ }
95
+ finally {
96
+ await snap.close();
97
+ }
98
+ return {
99
+ upserts: linkChunks(mesh, upserts).filter((chunk) => !snapshotEquals(chunk, rows.get(chunk.id))),
100
+ removed
101
+ };
102
+ }
103
+ export function chunkDeltaStream(frames) {
19
104
  const deltas = new Transform({
20
- transform(list, cb) {
21
- const next = list.chunks ?? [];
22
- const delta = chunkDelta(prev, next);
23
- prev = new Map(next.map((chunk) => [chunk.id, chunk]));
105
+ transform(delta, cb) {
24
106
  if (!delta.reset && delta.chunks?.length === 0 && delta.removed?.length === 0) {
25
107
  cb(null);
26
108
  return;
@@ -28,6 +110,6 @@ export function chunkDeltaStream(lists) {
28
110
  cb(null, delta);
29
111
  }
30
112
  });
31
- return frameReadable(pipeline(lists, deltas, noop));
113
+ return frameReadable(pipeline(frames, deltas, noop));
32
114
  }
33
115
  function noop() { }
@@ -1,8 +1,8 @@
1
- import { answersRound, appendChunk, listAttachmentsByKind, listChunks, listRunRequests, othersApproval, recordLinks, requireChatIn, requireOwnRun, requireProjectMember, resolveApproval, updateChunk } from '../core/chunk.js';
1
+ import { answersRound, appendChunk, listAttachmentsByKind, listChunks, listRunRequests, othersApproval, readChunk, recordLinks, requireChatIn, requireOwnRun, requireProjectMember, resolveApproval, updateChunk } from '../core/chunk.js';
2
2
  import { cancelModelRequest, listModelRequests, reopenModelRequest, settleModelRequest, takeModelRequest } from '../core/model-requests.js';
3
3
  import { takeRunRequest } from '../core/run-requests.js';
4
4
  import { accountPicks } from '../core/shared-agents.js';
5
- import { chunkDeltaStream } from './chunk-delta.js';
5
+ import { chunkDeltaStream, chunkDeltas } from './chunk-delta.js';
6
6
  import { ourSenderName, withSenders } from '../core/senders.js';
7
7
  import { meshWatchable, requireMesh } from './current-mesh.js';
8
8
  import { bounds } from './range.js';
@@ -14,7 +14,7 @@ export function createChunksApi(pool, deviceId, { log, account = null, agents =
14
14
  listChunks(mesh, chunkSelection(input)),
15
15
  senders?.lookup(meshId) ?? null
16
16
  ]);
17
- return { chunks: withSenders(await recordLinks(mesh, chunks), named) };
17
+ return { chunks: await withSenders(await recordLinks(mesh, chunks), named) };
18
18
  };
19
19
  const chunksWatch = meshWatchable(pool, transcript, { name: 'chunksWatch', log, changes: senders?.changes });
20
20
  return {
@@ -61,9 +61,15 @@ export function createChunksApi(pool, deviceId, { log, account = null, agents =
61
61
  return { chunks: await recordLinks(mesh, chunks) };
62
62
  },
63
63
  chunksWatch,
64
- chunksDeltaWatch: (request) => chunkDeltaStream(chunksWatch(request)),
65
- runRequestsWatch: meshWatchable(pool, async (_request, mesh) => ({ chunks: await listRunRequests(mesh, deviceId) }), { name: 'runRequestsWatch', log }),
66
- takeModelRequest: async ({ meshId, chunkId }) => takeModelRequest(await requireMesh(pool, meshId, { chunkId }), chunkId),
64
+ chunksDeltaWatch: (request) => {
65
+ const deltas = chunkDeltas(chunkSelection(request), log, async () => senders ? senders.lookup(request.meshId) : null);
66
+ const watch = meshWatchable(pool, (_request, mesh) => deltas(mesh), { name: 'chunksDeltaWatch', log, changes: senders?.changes });
67
+ return chunkDeltaStream(watch(request));
68
+ },
69
+ runRequestsWatch: meshWatchable(pool, async (_request, mesh) => ({
70
+ chunks: (await listRunRequests(mesh, deviceId)).map(readChunk)
71
+ }), { name: 'runRequestsWatch', log }),
72
+ takeModelRequest: async ({ meshId, chunkId }) => readChunk(await takeModelRequest(await requireMesh(pool, meshId, { chunkId }), chunkId)),
67
73
  settleModelRequest: async ({ meshId, chunkId, state, result, reason }) => {
68
74
  if (state !== 'done' && state !== 'failed') {
69
75
  throw new CoreError('CHUNK_PAYLOAD_INVALID', ['a model-request settles done or failed']);
@@ -84,8 +90,8 @@ export function createChunksApi(pool, deviceId, { log, account = null, agents =
84
90
  await reopenModelRequest(await requireMesh(pool, meshId, { chunkId }), chunkId);
85
91
  return { ok: true };
86
92
  },
87
- modelRequestsWatch: meshWatchable(pool, async (_request, mesh) => ({ chunks: await listModelRequests(mesh) }), { name: 'modelRequestsWatch', log }),
88
- takeRunRequest: async ({ meshId, chunkId }) => takeRunRequest(await requireMesh(pool, meshId), chunkId)
93
+ modelRequestsWatch: meshWatchable(pool, async (_request, mesh) => ({ chunks: (await listModelRequests(mesh)).map(readChunk) }), { name: 'modelRequestsWatch', log }),
94
+ takeRunRequest: async ({ meshId, chunkId }) => readChunk(await takeRunRequest(await requireMesh(pool, meshId), chunkId))
89
95
  };
90
96
  }
91
97
  function chunkSelection({ chatId, type, types, ...rest }) {
@@ -1,6 +1,13 @@
1
1
  import type { LoggerInterface } from '@qvac/logging';
2
- import type { openLocalStore } from '../core/local/index.ts';
3
- import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
2
+ import type { AssistantConfigValue } from '../../spec/hyperschema/types.d.ts';
3
+ import type { ConfigEntry, openLocalStore } from '../core/local/index.ts';
4
+ import type { CapabilityHandlers, WatchStream } from '../../spec/capabilities.d.ts';
4
5
  type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
5
- export declare function createConfigApi(state: LocalStore, log: LoggerInterface | null, onset?: ((key: string) => void) | null): Pick<CapabilityHandlers, 'configGet' | 'configSet' | 'configWatch'>;
6
+ export declare function readConfigAnswer(answer: AssistantConfigValue): AssistantConfigValue;
7
+ export declare function readConfigFrames(source: WatchStream<AssistantConfigValue>): WatchStream<AssistantConfigValue>;
8
+ interface ConfigWriteHooks {
9
+ readonly onset?: ((entry: ConfigEntry) => void | Promise<void>) | null;
10
+ readonly beforeSet?: ((entry: ConfigEntry) => void) | null;
11
+ }
12
+ export declare function createConfigApi(state: LocalStore, log: LoggerInterface | null, { onset, beforeSet }?: ConfigWriteHooks): Pick<CapabilityHandlers, 'configGet' | 'configSet' | 'configWatch'>;
6
13
  export {};
@@ -1,16 +1,61 @@
1
+ import { Readable } from 'streamx';
1
2
  import { watchable } from './watchable.js';
2
- export function createConfigApi(state, log, onset = null) {
3
+ import { frameReadable } from '../frame-readable.js';
4
+ import { latestFrame } from '../latest-frame.js';
5
+ import { QUARANTINE_PREFIX, configValue, readConfigValue } from '../core/config-value.js';
6
+ function readable(state, key) {
7
+ return key.startsWith(QUARANTINE_PREFIX) ? Promise.resolve(null) : state.get(key);
8
+ }
9
+ export function readConfigAnswer(answer) {
10
+ return { value: readConfigValue(answer) };
11
+ }
12
+ export function readConfigFrames(source) {
13
+ let stopped = false;
14
+ let output;
15
+ const frames = latestFrame((frame) => output.push(frame));
16
+ const onData = (frame) => frames.offer(readConfigAnswer(frame));
17
+ const onError = (err) => output.destroy(err);
18
+ const onEnd = () => frames.end();
19
+ const stop = () => {
20
+ if (stopped)
21
+ return;
22
+ stopped = true;
23
+ source.off('data', onData);
24
+ source.off('error', onError);
25
+ source.off('end', onEnd);
26
+ source.off('close', onEnd);
27
+ source.destroy();
28
+ frames.release();
29
+ };
30
+ output = new Readable({
31
+ read(callback) {
32
+ frames.read(callback);
33
+ },
34
+ predestroy: stop,
35
+ destroy(cb) {
36
+ stop();
37
+ cb(null);
38
+ }
39
+ });
40
+ output.on('error', noop);
41
+ source.on('data', onData);
42
+ source.on('error', onError);
43
+ source.on('end', onEnd);
44
+ source.on('close', onEnd);
45
+ return frameReadable(output);
46
+ }
47
+ export function createConfigApi(state, log, { onset = null, beforeSet = null } = {}) {
3
48
  return {
4
49
  async configGet({ key }) {
5
- return { value: await state.get(key) };
50
+ return configValue(await readable(state, key));
6
51
  },
7
52
  async configSet({ key, value }) {
53
+ beforeSet?.({ key, value });
8
54
  await state.set(key, value);
9
- onset?.(key);
55
+ await onset?.({ key, value });
10
56
  return { ok: true };
11
57
  },
12
- configWatch: watchable(() => state, async ({ key }) => ({
13
- value: await state.get(key)
14
- }), { name: 'configWatch', log })
58
+ configWatch: watchable(() => state, async ({ key }) => configValue(await readable(state, key)), { name: 'configWatch', log })
15
59
  };
16
60
  }
61
+ function noop() { }
@@ -50,10 +50,6 @@ export function createCustomModelApi(state, { preview, deleteFiles, log }) {
50
50
  }
51
51
  const id = customModelId(checked.src);
52
52
  const label = input.label.trim();
53
- const taken = (await state.getCustomModelRows()).find((row) => (row.label || row.name) === label && row.name !== id);
54
- if (taken) {
55
- throw new CoreError('CUSTOM_MODEL_LABEL_TAKEN', [label]);
56
- }
57
53
  const row = {
58
54
  name: id,
59
55
  label,
@@ -70,7 +66,9 @@ export function createCustomModelApi(state, { preview, deleteFiles, log }) {
70
66
  taskType: checked.taskType ?? null,
71
67
  license: checked.license ?? null
72
68
  };
73
- await state.putCustomModelRow(row);
69
+ if (!(await state.putCustomModelRowIfLabelAvailable(row))) {
70
+ throw new CoreError('CUSTOM_MODEL_LABEL_TAKEN', [label]);
71
+ }
74
72
  return { id };
75
73
  },
76
74
  removeCustomModel: async ({ name }) => {
@@ -16,6 +16,7 @@ function toEngineDevice(device, overrides = {}) {
16
16
  installedSkillNames: device.installedSkillNames ?? [],
17
17
  readySkillNames: device.readySkillNames,
18
18
  toolCatalog: device.toolCatalog,
19
+ customModels: device.customModels,
19
20
  installedModelNames: device.installedModelNames ?? [],
20
21
  cachedModelNames: device.cachedModelNames ?? [],
21
22
  capabilityProfile: device.capabilityProfile,
@@ -68,7 +69,8 @@ export function createDevicesApi(pool, { deviceId, log, removeWriter, renameLoca
68
69
  installedModelNames: input.installedModelNames ?? [],
69
70
  cachedModelNames: input.cachedModelNames ?? [],
70
71
  readySkillNames: input.readySkillNames ?? null,
71
- toolCatalog: input.toolCatalog ?? null
72
+ toolCatalog: input.toolCatalog ?? null,
73
+ customModels: input.customModels ?? null
72
74
  }, isAccount);
73
75
  return { ok: true };
74
76
  },
@@ -1,3 +1,3 @@
1
1
  import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
2
2
  import { type MeshPool } from './current-mesh.ts';
3
- export declare function createFilesApi(pool: MeshPool): Pick<CapabilityHandlers, 'fileRead' | 'filePreview' | 'fileRetry'>;
3
+ export declare function createFilesApi(pool: MeshPool): Pick<CapabilityHandlers, 'fileRead' | 'filePreview' | 'fileRetry' | 'filesReady'>;