@qvac/core 0.6.7 → 0.7.1
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.
- package/CHANGELOG.md +211 -1
- package/README.md +2 -0
- package/dist-lib/lib/api/app-config.d.ts +3 -1
- package/dist-lib/lib/api/app-config.js +15 -4
- package/dist-lib/lib/api/chat.d.ts +1 -1
- package/dist-lib/lib/api/chat.js +9 -0
- package/dist-lib/lib/api/index.d.ts +2 -1
- package/dist-lib/lib/api/index.js +2 -1
- package/dist-lib/lib/api/network.d.ts +8 -1
- package/dist-lib/lib/api/network.js +6 -0
- package/dist-lib/lib/assistant/fake-models.d.ts +22 -0
- package/dist-lib/lib/assistant/fake-models.js +112 -0
- package/dist-lib/lib/assistant/harness.d.ts +12 -0
- package/dist-lib/lib/assistant/harness.js +26 -0
- package/dist-lib/lib/assistant/history.d.ts +5 -1
- package/dist-lib/lib/assistant/history.js +14 -2
- package/dist-lib/lib/assistant-tree.d.ts +4 -0
- package/dist-lib/lib/assistant-tree.js +45 -7
- package/dist-lib/lib/assistant.d.ts +15 -2
- package/dist-lib/lib/assistant.js +181 -42
- package/dist-lib/lib/constants.d.ts +6 -0
- package/dist-lib/lib/constants.js +6 -0
- package/dist-lib/lib/core/agent.d.ts +2 -0
- package/dist-lib/lib/core/agent.js +16 -5
- package/dist-lib/lib/core/blind-peers.d.ts +4 -0
- package/dist-lib/lib/core/blind-peers.js +1 -0
- package/dist-lib/lib/core/chat-activity.d.ts +1 -1
- package/dist-lib/lib/core/chat-activity.js +3 -0
- package/dist-lib/lib/core/chat-copy.d.ts +4 -0
- package/dist-lib/lib/core/chat-copy.js +1 -1
- package/dist-lib/lib/core/chat-fork.d.ts +21 -0
- package/dist-lib/lib/core/chat-fork.js +245 -0
- package/dist-lib/lib/core/chat-move.js +1 -4
- package/dist-lib/lib/core/chat.d.ts +1 -0
- package/dist-lib/lib/core/chat.js +1 -1
- package/dist-lib/lib/core/collections.d.ts +1 -0
- package/dist-lib/lib/core/collections.js +1 -0
- package/dist-lib/lib/core/contract/compute.d.ts +1 -1
- package/dist-lib/lib/core/contract/compute.js +2 -1
- package/dist-lib/lib/core/contract/index.js +6 -1
- package/dist-lib/lib/core/contract/invites.d.ts +1 -11
- package/dist-lib/lib/core/contract/invites.js +3 -3
- package/dist-lib/lib/core/contract/mesh-seeds.d.ts +2 -0
- package/dist-lib/lib/core/contract/mesh-seeds.js +26 -0
- package/dist-lib/lib/core/contract/open-join.d.ts +2 -0
- package/dist-lib/lib/core/contract/open-join.js +57 -0
- package/dist-lib/lib/core/departures.d.ts +8 -1
- package/dist-lib/lib/core/departures.js +59 -2
- package/dist-lib/lib/core/fs-drives.d.ts +8 -1
- package/dist-lib/lib/core/fs-drives.js +47 -15
- package/dist-lib/lib/core/harness-loan.d.ts +4 -20
- package/dist-lib/lib/core/harness-loan.js +7 -184
- package/dist-lib/lib/core/id.d.ts +1 -0
- package/dist-lib/lib/core/id.js +3 -0
- package/dist-lib/lib/core/identity.d.ts +1 -1
- package/dist-lib/lib/core/identity.js +6 -4
- package/dist-lib/lib/core/invite.d.ts +2 -0
- package/dist-lib/lib/core/invite.js +6 -2
- package/dist-lib/lib/core/membership.d.ts +1 -12
- package/dist-lib/lib/core/membership.js +1 -94
- package/dist-lib/lib/core/mesh.d.ts +11 -15
- package/dist-lib/lib/core/mesh.js +52 -88
- package/dist-lib/lib/core/migrations/agent-tools-scope.d.ts +2 -0
- package/dist-lib/lib/core/migrations/agent-tools-scope.js +24 -0
- package/dist-lib/lib/core/migrations/index.js +3 -1
- package/dist-lib/lib/core/peer-duplex.d.ts +32 -0
- package/dist-lib/lib/core/peer-duplex.js +207 -0
- package/dist-lib/lib/core/sync/index.js +2 -16
- package/dist-lib/lib/core.d.ts +47 -50
- package/dist-lib/lib/core.js +524 -878
- package/dist-lib/lib/diagnostics.d.ts +7 -0
- package/dist-lib/lib/diagnostics.js +22 -0
- package/dist-lib/lib/doctor/checks.d.ts +15 -0
- package/dist-lib/lib/doctor/checks.js +272 -0
- package/dist-lib/lib/doctor/redact.d.ts +4 -0
- package/dist-lib/lib/doctor/redact.js +31 -0
- package/dist-lib/lib/doctor/render.d.ts +8 -0
- package/dist-lib/lib/doctor/render.js +83 -0
- package/dist-lib/lib/doctor/tree.d.ts +5 -0
- package/dist-lib/lib/doctor/tree.js +167 -0
- package/dist-lib/lib/downloads-allowed-pusher.d.ts +10 -0
- package/dist-lib/lib/downloads-allowed-pusher.js +37 -0
- package/dist-lib/lib/guards.d.ts +1 -0
- package/dist-lib/lib/guards.js +4 -0
- package/dist-lib/lib/inference-calls.js +1 -5
- package/dist-lib/lib/kv-cache-reclaim.d.ts +2 -1
- package/dist-lib/lib/kv-cache-reclaim.js +24 -0
- package/dist-lib/lib/mesh-scoped-engine.js +4 -0
- package/dist-lib/lib/model-download-status.d.ts +1 -1
- package/dist-lib/lib/model-download.d.ts +9 -10
- package/dist-lib/lib/model-download.js +49 -16
- package/dist-lib/lib/model-memory-cap.d.ts +29 -0
- package/dist-lib/lib/model-memory-cap.js +69 -0
- package/dist-lib/lib/models-watch.d.ts +1 -1
- package/dist-lib/lib/models-watch.js +4 -4
- package/dist-lib/lib/oauth/flow.js +1 -1
- package/dist-lib/lib/oauth/loopback.js +16 -2
- package/dist-lib/lib/oauth/redirect-types.d.ts +1 -0
- package/dist-lib/lib/run-replay.d.ts +26 -0
- package/dist-lib/lib/run-replay.js +107 -0
- package/dist-lib/schema/config.d.ts +1 -1
- package/dist-lib/schema/config.js +1 -1
- package/dist-lib/schema/content.js +9 -1
- package/dist-lib/schema/engine.js +75 -6
- package/dist-lib/schema/field-order.js +1 -1
- package/dist-lib/schema/local.js +3 -2
- package/dist-lib/schema/qvac.js +28 -2
- package/dist-lib/spec/bind.js +17 -0
- package/dist-lib/spec/calls.js +4 -0
- package/dist-lib/spec/capabilities.d.ts +8 -0
- package/dist-lib/spec/config/hyperconf/index.js +1 -1
- package/dist-lib/spec/hrpc/hrpc.json +52 -0
- package/dist-lib/spec/hrpc/index.js +53 -4
- package/dist-lib/spec/hrpc/messages.js +1498 -1278
- package/dist-lib/spec/hyperschema/index.js +1498 -1278
- package/dist-lib/spec/hyperschema/schema.json +182 -0
- package/dist-lib/spec/hyperschema/types.d.ts +49 -3
- package/dist-lib/spec/local/hyperdb/messages.js +22 -10
- package/dist-lib/spec/local/hyperschema/index.js +16 -7
- package/dist-lib/spec/local/hyperschema/schema.json +10 -1
- package/dist-lib/spec/local/hyperschema/types.d.ts +3 -2
- package/dist-lib/spec/mesh/hyperdb/db.json +16 -1
- package/dist-lib/spec/mesh/hyperdb/index.js +71 -2
- package/dist-lib/spec/mesh/hyperdb/messages.js +530 -246
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +13 -1
- package/dist-lib/spec/mesh/hyperdispatch/index.js +35 -1
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +223 -10
- package/dist-lib/spec/mesh/hyperschema/index.js +223 -10
- package/dist-lib/spec/mesh/hyperschema/schema.json +128 -1
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +34 -2
- package/package.json +14 -19
- package/tui/README.md +7 -1
- package/tui/app.mjs +366 -78
- package/tui/boot.mjs +1 -0
- package/tui/index.mjs +1 -0
- package/tui/lib/fork-command.mjs +43 -0
- package/tui/lib/render.mjs +25 -1
- package/worker/assistant-sidecar.mjs +5 -2
- package/dist-lib/lib/core/device-invites.d.ts +0 -11
- package/dist-lib/lib/core/device-invites.js +0 -63
- package/dist-lib/lib/core/grant-expiry.d.ts +0 -11
- package/dist-lib/lib/core/grant-expiry.js +0 -66
- package/dist-lib/lib/core/mesh-seed-handoff.d.ts +0 -27
- package/dist-lib/lib/core/mesh-seed-handoff.js +0 -53
- package/dist-lib/lib/oauth/loopback.stub.d.ts +0 -3
- package/dist-lib/lib/oauth/loopback.stub.js +0 -6
package/CHANGELOG.md
CHANGED
|
@@ -13,10 +13,218 @@ release.
|
|
|
13
13
|
|
|
14
14
|
## [Unreleased]
|
|
15
15
|
|
|
16
|
+
## [0.7.1] - 2026-10-12
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- `forkChat` copies a chat into a new one, through a turn or just before it, in
|
|
21
|
+
the same mesh or another (QVAC-26722). The source stays as it was, the fork
|
|
22
|
+
lands on top of its list with ids of its own, and `AssistantChat` names where
|
|
23
|
+
it came from in `forkedFrom`. Its files are its own copies, so removing one
|
|
24
|
+
in either chat leaves the other's, and into another mesh it needs one of that
|
|
25
|
+
mesh's agents. (#346)
|
|
26
|
+
|
|
27
|
+
```js
|
|
28
|
+
const fork = await engine.forkChat({ meshId, chatId, runId: reply.runId })
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- `setBlindPeering` and `blindPeeringWatch` turn every blind peering on this
|
|
32
|
+
device off or back on, kept across restarts, for reproducing sync with no
|
|
33
|
+
mirror in the middle. `diagnostics` reports it as `stats.mesh.blindPeering`,
|
|
34
|
+
and a `recoveryPublish` made while it is off does not mark the account
|
|
35
|
+
recoverable. (#334)
|
|
36
|
+
|
|
37
|
+
```js
|
|
38
|
+
await engine.setBlindPeering({ enabled: false })
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Changed
|
|
42
|
+
|
|
43
|
+
- `@qvac/harness` is `^0.8.7` and `@qvac/skills` 0.1.14, which bring the
|
|
44
|
+
`browser` skill. Every run now hands the harness its chat as `session`, with
|
|
45
|
+
or without a cache key, so a skill whose manifest declares
|
|
46
|
+
`${session}` in its `env` keeps one resource per chat, such as the browser
|
|
47
|
+
the `browser` skill drives. (#369)
|
|
48
|
+
- `createAgent` and `updateAgent` ignore `toolsScope` and `enabledTools` and
|
|
49
|
+
always store `toolsScope: 'all'`, leaving `disabledToolsets` as the only
|
|
50
|
+
per-agent gate on tools. Each mesh rewrites its stored `selected` agents to
|
|
51
|
+
`all` once on open, so an agent saved with an empty list runs with its tools
|
|
52
|
+
again. (#363)
|
|
53
|
+
|
|
54
|
+
### Fixed
|
|
55
|
+
|
|
56
|
+
- The harness is handed the turn as typed, so a skill mention or a search ask
|
|
57
|
+
is read from what the user wrote, not from attached documents, knowledge or
|
|
58
|
+
sender lines wrapped around it (QVAC-24963). Before,
|
|
59
|
+
`@pdf Summarize these docs` with a PDF attached could load
|
|
60
|
+
`image-generation`, and a document saying "search the web" went out as the
|
|
61
|
+
search query. (#347)
|
|
62
|
+
- The model downloader picks the text-to-speech model for the profile the
|
|
63
|
+
hardware probe found, the same one speaking asks for (QVAC-25679). Before, a
|
|
64
|
+
new device could plan its downloads while its row still held the host's seed
|
|
65
|
+
profile and keep that for the session, so a "mid" or higher device fetched
|
|
66
|
+
`Supertonic3-Q4_0` while read aloud waited for `Supertonic3-FP16` and stayed
|
|
67
|
+
disabled until a restart. If the probe fails, it plans for "low", the voice
|
|
68
|
+
the harness then speaks with. (#367)
|
|
69
|
+
- A device dials the other devices of its account by key as well as finding
|
|
70
|
+
them on the mesh topic, and dials them again on resume. Before, a topic
|
|
71
|
+
refresh that missed after a suspend or a network change left a phone without
|
|
72
|
+
its Mac for ten minutes or more, so a chat with an agent the Mac hosted sat
|
|
73
|
+
on "waiting to reconnect" though both were online. (#327)
|
|
74
|
+
- `removeDevice` on a device of our own member moves the agents it hosted to
|
|
75
|
+
the device that removed it, in that mesh and, for a removal from the account,
|
|
76
|
+
in every shared mesh of ours it is revoked in, so a run waiting on the removed
|
|
77
|
+
device runs there; a removal made on an earlier build is caught up on the
|
|
78
|
+
next boot. Before, the agents stayed orphaned and the chat waited forever.
|
|
79
|
+
(#327)
|
|
80
|
+
|
|
81
|
+
## [0.7.0] - 2026-10-09
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
- Model downloads can wait to be asked for, so a phone on cellular does not
|
|
86
|
+
fetch gigabytes on its own. Pass `autoDownloadModels: false` to the Core
|
|
87
|
+
constructor so it holds from the first boot, or toggle it later. A run that
|
|
88
|
+
needs a missing model then waits as `awaiting-download` instead of fetching it,
|
|
89
|
+
and so do image, music, transcription, speech and embedding loads in the
|
|
90
|
+
harness (#332, #333):
|
|
91
|
+
|
|
92
|
+
```js
|
|
93
|
+
await engine.setAutoDownloadModels({ enabled: false })
|
|
94
|
+
for await (const { downloads } of engine.modelDownloadsWatch({})) {
|
|
95
|
+
const held = (downloads ?? []).find((row) => row.phase === 'held')
|
|
96
|
+
if (held) {
|
|
97
|
+
await engine.retryModelDownload({ name: held.name })
|
|
98
|
+
break
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- The OAuth loopback serves callbacks under Bare too, so a mobile worklet can
|
|
104
|
+
complete sign-in on the same `127.0.0.1` redirect desktop registers. (#329)
|
|
105
|
+
- `openOAuthLoopback` takes an optional `returnTo`: the callback redirects the
|
|
106
|
+
browser there instead of showing the done page. (#329)
|
|
107
|
+
- Several models stay loaded when memory allows (QVAC-25735). On desktop the
|
|
108
|
+
assistant pushes `model.memoryCapPercent` to the harness: loaded models may
|
|
109
|
+
fill that share of the memory usable for models, 85% by default, so two chat
|
|
110
|
+
models that fit stay loaded and switching chats between them loads neither
|
|
111
|
+
again. A load that would not fit unloads idle models one at a time, other
|
|
112
|
+
kinds before chat models and the least recently used first. It applies with
|
|
113
|
+
no restart; the minimum keeps one chat model loaded, and a mobile device
|
|
114
|
+
always does. `listModels` and `modelsWatch` carry the device's `memory`
|
|
115
|
+
(`usableBytes`, `capPercent`, `capBytes`, `usedBytes`, and `overCap` when a
|
|
116
|
+
model larger than the cap loaded anyway) and each loaded row its
|
|
117
|
+
`memoryBytes`, so a Models screen shows used against the cap. Needs the
|
|
118
|
+
`@qvac/harness` release with `setModelMemoryCap` and `memoryUsage`; an older
|
|
119
|
+
one keeps one chat model loaded and lists no `memory`. (#343)
|
|
120
|
+
|
|
121
|
+
```js
|
|
122
|
+
import { MODEL_MEMORY_CAP_KEY } from '@qvac/core/constants'
|
|
123
|
+
|
|
124
|
+
await engine.configSet({ key: MODEL_MEMORY_CAP_KEY, value: 70 })
|
|
125
|
+
const { memory } = await engine.listModels({ cachedOnly: true })
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- A device pairs and follows its member with no other device online. A device
|
|
129
|
+
invite carries a keypair attested into the inviter's member, so the joiner
|
|
130
|
+
links itself, and the account holds every shared mesh's seed (the new
|
|
131
|
+
`@qvac/put-mesh-seed` route), so a new device opens them all from a blind
|
|
132
|
+
peer alone. A device invite minted by 0.6.6 still admits a device but no
|
|
133
|
+
longer links it into the member. `meshInvite` refuses a device invite from a
|
|
134
|
+
device whose proof chain is too long to extend, naming another device or the
|
|
135
|
+
phrase instead. (#342)
|
|
136
|
+
- `diagnostics` carries `backendUse`: per tool, the backends its recent runs
|
|
137
|
+
on this device reported, newest last. A run that asked for the gpu and ran
|
|
138
|
+
on the cpu is the fallback to look for. (#22)
|
|
139
|
+
|
|
140
|
+
```js
|
|
141
|
+
const { stats } = await engine.diagnostics({})
|
|
142
|
+
stats.backendUse.generate_music.at(-1)
|
|
143
|
+
// { requestedGpu: true, device: 'cpu', backend: 'cpu' }
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
- `duck`: `/doctor` checks this device (hardware, engine, model backends, mesh,
|
|
147
|
+
network) and `/doctor debug` shows the raw diagnostics frame behind it.
|
|
148
|
+
`ctrl+y` copies either as plain text, with the mesh seed and any invite
|
|
149
|
+
redacted and keys truncated. (#22)
|
|
150
|
+
|
|
151
|
+
### Changed
|
|
152
|
+
|
|
153
|
+
- An invite is a password again, as it was before 0.5.0. A member invite mints
|
|
154
|
+
no grant and a device invite no expiring token: either link is the mesh
|
|
155
|
+
seed, reusable for good, and the joining device admits itself with the new
|
|
156
|
+
`@qvac/open-join` route; `joinMesh` and `recoverAccount` return once the
|
|
157
|
+
join is recorded, appending it in the background, with the account reporting
|
|
158
|
+
`joining` until the mesh reaches it. A device invite pairs with the inviting
|
|
159
|
+
device offline, and `recoverAccount` needs no other device online. A removed
|
|
160
|
+
device comes back the next time it joins. Every route that shipped keeps its
|
|
161
|
+
0.6.6 meaning, and a 0.6.6 or 0.6.7 replica halts on the new one, so this
|
|
162
|
+
raises the floor to `>=0.19.1`. (#342)
|
|
163
|
+
|
|
164
|
+
```js
|
|
165
|
+
const { invite } = await engine.meshInvite({ member: true })
|
|
166
|
+
await engine.joinMesh({ invite }) // any number of times, by anyone holding it
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
- `joinMesh` and `recoverAccount` fail with "This device has no device
|
|
170
|
+
details: pass `device` when creating Core" on a Core created without
|
|
171
|
+
`device` and with none stored, and a `meshSeed` boot reports it as its
|
|
172
|
+
status error: a mesh admits only a device it can list and remove. (#342)
|
|
173
|
+
|
|
174
|
+
- A mesh still `joining` refuses a write into it at once with "This mesh is
|
|
175
|
+
still joining: it accepts writes once it is joined", since nothing written
|
|
176
|
+
there reaches disk until a peer serves the mesh. Reads keep working; retry
|
|
177
|
+
the write once the mesh lists `joined`. (#342)
|
|
178
|
+
|
|
179
|
+
- `listMeshes` and `meshesWatch` rows no longer set `reason` or
|
|
180
|
+
`awaitingFrom`: no other device admits a joining one any more. Read
|
|
181
|
+
`state: 'joining'` alone. (#342)
|
|
182
|
+
|
|
183
|
+
### Deprecated
|
|
184
|
+
|
|
185
|
+
- `meshEntry.reason` and `meshEntry.awaitingFrom`, which are never set. (#342)
|
|
186
|
+
|
|
187
|
+
### Removed
|
|
188
|
+
|
|
189
|
+
- The `grantWritableMs`, `grantVisibleMs` and `accountWritableMs` Core options.
|
|
190
|
+
Nothing on a join, a mint or a logout waits for a mesh to go writable any
|
|
191
|
+
more: a departure the mesh cannot take yet is revoked by the departures
|
|
192
|
+
outbox once it can, and a mesh minted before the account can write is
|
|
193
|
+
registered there once it can. (#342)
|
|
194
|
+
|
|
195
|
+
### Fixed
|
|
196
|
+
|
|
197
|
+
- A chat's KV cache no longer grows by duplicated history: each run is replayed
|
|
198
|
+
to the model exactly as it was sent. (#338)
|
|
199
|
+
- A chat handed to another agent on the same device, by `setChatAgent` or a
|
|
200
|
+
`sendMessage` naming another `agentId`, no longer leaves the old agent's KV
|
|
201
|
+
cache file on disk until the chat is deleted. (#330)
|
|
202
|
+
- Reopening the account mesh after its local database died clears "the local
|
|
203
|
+
database died" error once the reopened mesh is healthy. (#340)
|
|
204
|
+
- `duck`: `/agent new` gives the new agent a real model in a mesh with no agent
|
|
205
|
+
yet, and `/agent use` hands the open chat to the agent it selects. (#348, #331)
|
|
206
|
+
|
|
16
207
|
## [0.6.7] - 2026-10-06
|
|
17
208
|
|
|
18
209
|
### Added
|
|
19
210
|
|
|
211
|
+
- A `quack` model for testing mesh, sync and chat flows without inference. An
|
|
212
|
+
agent on it replies with `quack` repeated 1 to 500 times, counted from a hash
|
|
213
|
+
of the last user turn, so the same prompt always gets the same reply. Every
|
|
214
|
+
other model still runs on the real harness. The device-local
|
|
215
|
+
`debug.fakeModels` key (`FAKE_MODELS_KEY` in `@qvac/core/constants`, beside the `QUACK_MODEL` name) turns it
|
|
216
|
+
on and off live, which is what an app's Debug toggle writes. `assistantChild`
|
|
217
|
+
and `assistantTree` take `fakeModels: true` to force it on, which is what duck
|
|
218
|
+
does with its `--fake-models` flag or `QVAC_FAKE_MODELS=1`.
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
await engine.configSet({ key: FAKE_MODELS_KEY, value: true })
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```sh
|
|
225
|
+
QVAC_MODEL=quack duck --temp --fake-models
|
|
226
|
+
```
|
|
227
|
+
|
|
20
228
|
- `Core` accepts `store`, `swarm` and `wakeup`, so a host that is already a
|
|
21
229
|
peer-to-peer application passes the ones it runs rather than having Core
|
|
22
230
|
stand up a second of each. Core never closes, destroys or suspends what it
|
|
@@ -1273,7 +1481,9 @@ Published under the `release-0.1` dist-tag.
|
|
|
1273
1481
|
await assistant.ready()
|
|
1274
1482
|
```
|
|
1275
1483
|
|
|
1276
|
-
[Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.
|
|
1484
|
+
[Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.7.1...HEAD
|
|
1485
|
+
[0.7.1]: https://github.com/tetherto/qvac-core/compare/v0.7.0...v0.7.1
|
|
1486
|
+
[0.7.0]: https://github.com/tetherto/qvac-core/compare/v0.6.7...v0.7.0
|
|
1277
1487
|
[0.6.7]: https://github.com/tetherto/qvac-core/compare/v0.6.6...v0.6.7
|
|
1278
1488
|
[0.6.6]: https://github.com/tetherto/qvac-core/compare/v0.6.5...v0.6.6
|
|
1279
1489
|
[0.6.5]: https://github.com/tetherto/qvac-core/compare/v0.6.4...v0.6.5
|
package/README.md
CHANGED
|
@@ -279,6 +279,8 @@ replicated runs:
|
|
|
279
279
|
- `generating-image` / `generating-audio` / `transcribing-audio` — the active run
|
|
280
280
|
refined by the media it is producing.
|
|
281
281
|
- `awaiting-approval` — the active run paused on the user.
|
|
282
|
+
- `awaiting-download` — the active run waits for a model the user has not let
|
|
283
|
+
download yet (`autoDownloadModels` is off).
|
|
282
284
|
|
|
283
285
|
Every value is a mutually-exclusive state, not a parallel flag. Runs serialize
|
|
284
286
|
per chat, so at most one is executing. The list carries only active chats — a
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import type { AssistantAppConfig } 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
|
|
5
|
+
export declare function writeAutoDownloadModels(state: LocalStore, enabled: boolean): Promise<AssistantAppConfig>;
|
|
6
|
+
export declare function createAppConfigApi(state: LocalStore): Pick<CapabilityHandlers, 'getConfig' | 'setConfig' | 'setModelPaused' | 'setModelReleased' | 'setAutoDownloadModels' | 'configWatchTyped'>;
|
|
5
7
|
export {};
|
|
@@ -22,7 +22,8 @@ const DEFAULT_CONFIG = {
|
|
|
22
22
|
onboardingCompleted: false,
|
|
23
23
|
delegation: EMPTY_DELEGATION,
|
|
24
24
|
pausedModels: [],
|
|
25
|
-
releasedModels: []
|
|
25
|
+
releasedModels: [],
|
|
26
|
+
autoDownloadModels: true
|
|
26
27
|
};
|
|
27
28
|
const DelegationSchema = z.object({
|
|
28
29
|
enabled: z.boolean().optional(),
|
|
@@ -71,7 +72,8 @@ function toConfig(row) {
|
|
|
71
72
|
onboardingCompleted: row.onboardingCompleted ?? false,
|
|
72
73
|
delegation: normalizeDelegation(row.delegation),
|
|
73
74
|
pausedModels: row.pausedModels ?? [],
|
|
74
|
-
releasedModels: row.releasedModels ?? []
|
|
75
|
+
releasedModels: row.releasedModels ?? [],
|
|
76
|
+
autoDownloadModels: !row.manualModelDownloads
|
|
75
77
|
};
|
|
76
78
|
}
|
|
77
79
|
function applyWrite(current, update) {
|
|
@@ -84,7 +86,8 @@ function applyWrite(current, update) {
|
|
|
84
86
|
onboardingCompleted: update.onboardingCompleted ?? false,
|
|
85
87
|
delegation: normalizeDelegation(update.delegation),
|
|
86
88
|
pausedModels: current.pausedModels,
|
|
87
|
-
releasedModels: current.releasedModels
|
|
89
|
+
releasedModels: current.releasedModels,
|
|
90
|
+
autoDownloadModels: current.autoDownloadModels
|
|
88
91
|
};
|
|
89
92
|
}
|
|
90
93
|
function toggled(names, name, on) {
|
|
@@ -110,9 +113,14 @@ function toRow(config) {
|
|
|
110
113
|
onboardingCompleted: config.onboardingCompleted,
|
|
111
114
|
delegation: config.delegation,
|
|
112
115
|
pausedModels: config.pausedModels,
|
|
113
|
-
releasedModels: config.releasedModels
|
|
116
|
+
releasedModels: config.releasedModels,
|
|
117
|
+
manualModelDownloads: !config.autoDownloadModels
|
|
114
118
|
};
|
|
115
119
|
}
|
|
120
|
+
export async function writeAutoDownloadModels(state, enabled) {
|
|
121
|
+
const row = await state.updateAppConfigRow((current) => toRow({ ...toConfig(current), autoDownloadModels: enabled }));
|
|
122
|
+
return toConfig(row);
|
|
123
|
+
}
|
|
116
124
|
export function createAppConfigApi(state) {
|
|
117
125
|
return {
|
|
118
126
|
getConfig(_) {
|
|
@@ -142,6 +150,9 @@ export function createAppConfigApi(state) {
|
|
|
142
150
|
});
|
|
143
151
|
return toConfig(row);
|
|
144
152
|
},
|
|
153
|
+
setAutoDownloadModels(input) {
|
|
154
|
+
return writeAutoDownloadModels(state, input.enabled ?? false);
|
|
155
|
+
},
|
|
145
156
|
configWatchTyped: watchable(() => state, () => readConfig(state), { name: 'configWatchTyped' })
|
|
146
157
|
};
|
|
147
158
|
}
|
|
@@ -2,7 +2,7 @@ import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
|
2
2
|
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
|
-
type ChatCapabilities = Pick<CapabilityHandlers, 'createChat' | 'listChats' | 'getChat' | 'renameChat' | 'markChatRead' | 'setChatAgent' | 'setChatRagEnabled' | 'setChatWebSearchEnabled' | 'deleteChat' | 'chatsWatch' | 'listChatActivity' | 'chatActivityWatch' | 'searchChats'>;
|
|
5
|
+
type ChatCapabilities = Pick<CapabilityHandlers, 'createChat' | 'listChats' | 'getChat' | 'renameChat' | 'markChatRead' | 'setChatAgent' | 'forkChat' | 'setChatRagEnabled' | 'setChatWebSearchEnabled' | 'deleteChat' | 'chatsWatch' | 'listChatActivity' | 'chatActivityWatch' | 'searchChats'>;
|
|
6
6
|
export interface CreateChatApiOptions {
|
|
7
7
|
readonly deviceId: Buffer | null;
|
|
8
8
|
readonly inferenceCalls?: {
|
package/dist-lib/lib/api/chat.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { AbortController } from 'bare-abort-controller';
|
|
2
2
|
import { createChat, deleteChat, markChatRead, mustGetActiveChatListing, renameChat, setChatAgent, setChatRagEnabled, setChatWebSearchEnabled } from '../core/chat.js';
|
|
3
3
|
import { listChatActivity } from '../core/chat-activity.js';
|
|
4
|
+
import { forkChat } from '../core/chat-fork.js';
|
|
4
5
|
import { listChatPage } from '../core/chat-order.js';
|
|
5
6
|
import { searchChats } from '../core/chat-search.js';
|
|
6
7
|
import { meshWatchable, requireMesh } from './current-mesh.js';
|
|
7
8
|
const SEARCH_SUPERSEDED_ABORT = 'superseded by a newer chat search';
|
|
9
|
+
const NO_DEVICE = 'this device has no identity yet, so it cannot write a fork';
|
|
8
10
|
export function createChatApi(pool, local, { deviceId, inferenceCalls = null }) {
|
|
9
11
|
let searchAbort = null;
|
|
10
12
|
const chatList = (mesh, { limit, cursor }) => listChatPage(mesh, local, { limit: limit || undefined, cursor: cursor ?? undefined });
|
|
@@ -16,6 +18,13 @@ export function createChatApi(pool, local, { deviceId, inferenceCalls = null })
|
|
|
16
18
|
renameChat: async ({ chatId, meshId, config }) => renameChat(await requireMesh(pool, meshId), chatId, config.title),
|
|
17
19
|
markChatRead: async ({ chatId, meshId }) => markChatRead(await requireMesh(pool, meshId), chatId),
|
|
18
20
|
setChatAgent: async ({ chatId, agentId, meshId }) => setChatAgent(await requireMesh(pool, meshId), chatId, agentId),
|
|
21
|
+
forkChat: async ({ meshId, targetMeshId, config, ...cut }) => {
|
|
22
|
+
if (!deviceId)
|
|
23
|
+
throw new Error(NO_DEVICE);
|
|
24
|
+
const from = await requireMesh(pool, meshId);
|
|
25
|
+
const into = targetMeshId ? await requireMesh(pool, targetMeshId) : from;
|
|
26
|
+
return forkChat({ from, into }, { ...cut, title: config?.title, originDeviceId: deviceId });
|
|
27
|
+
},
|
|
19
28
|
setChatRagEnabled: async ({ chatId, enabled, meshId }) => setChatRagEnabled(await requireMesh(pool, meshId), chatId, { ragEnabled: enabled ?? false }),
|
|
20
29
|
setChatWebSearchEnabled: async ({ chatId, enabled, meshId }) => setChatWebSearchEnabled(await requireMesh(pool, meshId), chatId, enabled ?? false),
|
|
21
30
|
deleteChat: async ({ chatId, meshId }) => {
|
|
@@ -8,7 +8,7 @@ import { type DiagnosticsSource } from './diagnostics.ts';
|
|
|
8
8
|
import { type InferenceCallReader } from './inference-calls.ts';
|
|
9
9
|
import { type LogSource } from './logs.ts';
|
|
10
10
|
import { type MeshStatusSource } from './mesh.ts';
|
|
11
|
-
import { type NetworkSource } from './network.ts';
|
|
11
|
+
import { type BlindPeeringSource, type NetworkSource } from './network.ts';
|
|
12
12
|
import { type CustomModelPreviewSource } from './custom-models.ts';
|
|
13
13
|
import type { IndexingEmbedder, VectorIndex } from '../core/files/index.ts';
|
|
14
14
|
interface ApiDeps {
|
|
@@ -16,6 +16,7 @@ interface ApiDeps {
|
|
|
16
16
|
mesh?: MeshPool | null;
|
|
17
17
|
meshStatus?: MeshStatusSource | null;
|
|
18
18
|
network?: NetworkSource | null;
|
|
19
|
+
blindPeering?: BlindPeeringSource | null;
|
|
19
20
|
diagnostics?: DiagnosticsSource | null;
|
|
20
21
|
inferenceCalls?: InferenceCallReader | null;
|
|
21
22
|
chatMoves?: ChatMoves | null;
|
|
@@ -22,7 +22,7 @@ import { instrument } from './instrument.js';
|
|
|
22
22
|
import { watchable } from './watchable.js';
|
|
23
23
|
import { createMembersApi } from './members.js';
|
|
24
24
|
import { createMeshApi } from './mesh.js';
|
|
25
|
-
import { createNetworkApi } from './network.js';
|
|
25
|
+
import { createBlindPeeringApi, createNetworkApi } from './network.js';
|
|
26
26
|
import { createNotificationsApi } from './notifications.js';
|
|
27
27
|
import { createModelDownloadApi } from './model-download.js';
|
|
28
28
|
import { createCustomModelApi } from './custom-models.js';
|
|
@@ -87,6 +87,7 @@ export function createApi(deps = {}) {
|
|
|
87
87
|
...members,
|
|
88
88
|
...(deps.meshStatus && members ? createMeshApi(deps.meshStatus, members.updateMember) : null),
|
|
89
89
|
...(deps.network ? createNetworkApi(deps.network) : null),
|
|
90
|
+
...(deps.blindPeering ? createBlindPeeringApi(deps.blindPeering) : null),
|
|
90
91
|
...(deps.diagnostics ? createDiagnosticsApi(deps.diagnostics) : null),
|
|
91
92
|
...(deps.inferenceCalls ? createInferenceCallsApi(deps.inferenceCalls) : null),
|
|
92
93
|
...(deps.logs ? createLogsApi(deps.logs) : null),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AssistantNetworkStatus } from '../../spec/hyperschema/types.d.ts';
|
|
1
|
+
import type { AssistantBlindPeering, AssistantNetworkStatus } from '../../spec/hyperschema/types.d.ts';
|
|
2
2
|
import type { CapabilityHandlers } from '../../spec/capabilities.d.ts';
|
|
3
3
|
export interface NetworkSource {
|
|
4
4
|
watch(listener: () => void): void;
|
|
@@ -6,4 +6,11 @@ export interface NetworkSource {
|
|
|
6
6
|
snapshot(): AssistantNetworkStatus;
|
|
7
7
|
readonly sampled: true;
|
|
8
8
|
}
|
|
9
|
+
export interface BlindPeeringSource {
|
|
10
|
+
watch(listener: () => void): void;
|
|
11
|
+
unwatch(listener: () => void): void;
|
|
12
|
+
snapshot(): AssistantBlindPeering;
|
|
13
|
+
set(enabled: boolean): Promise<AssistantBlindPeering>;
|
|
14
|
+
}
|
|
9
15
|
export declare function createNetworkApi(source: NetworkSource): Pick<CapabilityHandlers, 'networkWatch'>;
|
|
16
|
+
export declare function createBlindPeeringApi(source: BlindPeeringSource): Pick<CapabilityHandlers, 'setBlindPeering' | 'blindPeeringWatch'>;
|
|
@@ -4,3 +4,9 @@ export function createNetworkApi(source) {
|
|
|
4
4
|
networkWatch: watchable(() => source, async () => source.snapshot(), { name: 'networkWatch' })
|
|
5
5
|
};
|
|
6
6
|
}
|
|
7
|
+
export function createBlindPeeringApi(source) {
|
|
8
|
+
return {
|
|
9
|
+
setBlindPeering: ({ enabled }) => source.set(enabled === true),
|
|
10
|
+
blindPeeringWatch: watchable(() => source, async () => source.snapshot(), { name: 'blindPeeringWatch' })
|
|
11
|
+
};
|
|
12
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { openLocalStore } from '../core/local/index.ts';
|
|
2
|
+
import type { Harness } from './harness.ts';
|
|
3
|
+
export declare const MAX_QUACKS = 500;
|
|
4
|
+
type LocalStore = Awaited<ReturnType<typeof openLocalStore>>;
|
|
5
|
+
export type FakeModelsSource = Pick<LocalStore, 'get' | 'watch' | 'unwatch'>;
|
|
6
|
+
interface Logger {
|
|
7
|
+
warn(...args: unknown[]): void;
|
|
8
|
+
}
|
|
9
|
+
export interface FakeModelsOptions {
|
|
10
|
+
enabled?: () => boolean;
|
|
11
|
+
paceMs?: number;
|
|
12
|
+
}
|
|
13
|
+
export declare function quackCount(prompt: string): number;
|
|
14
|
+
export declare function readFakeModels(state: Pick<FakeModelsSource, 'get'>): Promise<boolean>;
|
|
15
|
+
export interface FakeModelsWatchOptions {
|
|
16
|
+
initial: boolean;
|
|
17
|
+
onChange: (enabled: boolean) => void;
|
|
18
|
+
logger?: Logger | null;
|
|
19
|
+
}
|
|
20
|
+
export declare function watchFakeModels(state: FakeModelsSource, opts: FakeModelsWatchOptions): () => Promise<void>;
|
|
21
|
+
export declare function withFakeModels(harness: Harness, opts?: FakeModelsOptions): Harness;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import b4a from 'b4a';
|
|
2
|
+
import crypto from 'hypercore-crypto';
|
|
3
|
+
import ScopeLock from 'scope-lock';
|
|
4
|
+
import { FAKE_MODELS_KEY, QUACK_MODEL } from '../constants.js';
|
|
5
|
+
import { errorMessage } from '../guards.js';
|
|
6
|
+
export const MAX_QUACKS = 500;
|
|
7
|
+
const QUACK_ROW = {
|
|
8
|
+
name: QUACK_MODEL,
|
|
9
|
+
type: 'llm',
|
|
10
|
+
taskType: 'llm',
|
|
11
|
+
registryPath: QUACK_MODEL,
|
|
12
|
+
registrySource: 'fake',
|
|
13
|
+
isCached: true,
|
|
14
|
+
isLoaded: true,
|
|
15
|
+
expectedSize: 0,
|
|
16
|
+
supportsImages: false
|
|
17
|
+
};
|
|
18
|
+
export function quackCount(prompt) {
|
|
19
|
+
return 1 + (b4a.readUInt32LE(crypto.hash(b4a.from(prompt)), 0) % MAX_QUACKS);
|
|
20
|
+
}
|
|
21
|
+
export async function readFakeModels(state) {
|
|
22
|
+
return (await state.get(FAKE_MODELS_KEY)) === true;
|
|
23
|
+
}
|
|
24
|
+
export function watchFakeModels(state, opts) {
|
|
25
|
+
const { onChange, logger } = opts;
|
|
26
|
+
const lock = new ScopeLock({ debounce: true });
|
|
27
|
+
let disposed = false;
|
|
28
|
+
let reported = opts.initial;
|
|
29
|
+
const schedule = async () => {
|
|
30
|
+
if (disposed || !(await lock.lock()))
|
|
31
|
+
return;
|
|
32
|
+
try {
|
|
33
|
+
const enabled = await readFakeModels(state);
|
|
34
|
+
if (!disposed && enabled !== reported) {
|
|
35
|
+
reported = enabled;
|
|
36
|
+
onChange(enabled);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
catch (err) {
|
|
40
|
+
logger?.warn('fake-models', 'reading the switch failed', errorMessage(err));
|
|
41
|
+
}
|
|
42
|
+
finally {
|
|
43
|
+
lock.unlock();
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
const listener = () => void schedule();
|
|
47
|
+
state.watch(listener);
|
|
48
|
+
return async () => {
|
|
49
|
+
disposed = true;
|
|
50
|
+
state.unwatch(listener);
|
|
51
|
+
lock.destroy();
|
|
52
|
+
await lock.flush();
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
export function withFakeModels(harness, opts = {}) {
|
|
56
|
+
const { enabled = () => true, paceMs = 10 } = opts;
|
|
57
|
+
const isQuack = (model) => model === QUACK_MODEL && enabled();
|
|
58
|
+
const quacking = {
|
|
59
|
+
...modelCalls(harness, isQuack),
|
|
60
|
+
completion: (context) => isQuack(context.model) ? quack(context, paceMs) : harness.completion(context)
|
|
61
|
+
};
|
|
62
|
+
return new Proxy(harness, {
|
|
63
|
+
get(target, key) {
|
|
64
|
+
if (Object.hasOwn(quacking, key)) {
|
|
65
|
+
return Reflect.get(quacking, key);
|
|
66
|
+
}
|
|
67
|
+
const value = Reflect.get(target, key);
|
|
68
|
+
return typeof value === 'function' ? value.bind(target) : value;
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function modelCalls(harness, isQuack) {
|
|
73
|
+
const list = harness.list?.bind(harness);
|
|
74
|
+
const warmModel = harness.warmModel?.bind(harness);
|
|
75
|
+
const loadModel = harness.loadModel?.bind(harness);
|
|
76
|
+
const unloadModel = harness.unloadModel?.bind(harness);
|
|
77
|
+
const deleteModel = harness.deleteModel?.bind(harness);
|
|
78
|
+
return {
|
|
79
|
+
list: list &&
|
|
80
|
+
(async (options) => {
|
|
81
|
+
const rows = await list(options);
|
|
82
|
+
return isQuack(QUACK_MODEL) ? withQuackRow(rows, options?.type) : rows;
|
|
83
|
+
}),
|
|
84
|
+
warmModel: warmModel && ((context) => (isQuack(context.model) ? Promise.resolve() : warmModel(context))),
|
|
85
|
+
loadModel: loadModel &&
|
|
86
|
+
((context) => isQuack(context.model) ? Promise.resolve({ loaded: true }) : loadModel(context)),
|
|
87
|
+
unloadModel: unloadModel &&
|
|
88
|
+
((context) => isQuack(context.model) ? Promise.resolve({ unloaded: true }) : unloadModel(context)),
|
|
89
|
+
deleteModel: deleteModel &&
|
|
90
|
+
((name) => isQuack(name) ? Promise.resolve({ name, removed: 0, freedBytes: 0 }) : deleteModel(name))
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function withQuackRow(rows, type) {
|
|
94
|
+
return type && type !== 'llm' ? rows : [...rows, QUACK_ROW];
|
|
95
|
+
}
|
|
96
|
+
async function* quack(context, paceMs) {
|
|
97
|
+
const prompt = context.messages.findLast((turn) => turn.role === 'user')?.content ?? '';
|
|
98
|
+
const count = quackCount(prompt);
|
|
99
|
+
for (let i = 0; i < count; i++) {
|
|
100
|
+
if (i > 0) {
|
|
101
|
+
await pace(paceMs);
|
|
102
|
+
}
|
|
103
|
+
if (context.signal?.aborted) {
|
|
104
|
+
yield { type: 'aborted' };
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
yield { type: 'content', text: i === 0 ? 'quack' : ' quack' };
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
function pace(ms) {
|
|
111
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
112
|
+
}
|
|
@@ -49,6 +49,7 @@ export interface ModelInfo {
|
|
|
49
49
|
expectedSize: number;
|
|
50
50
|
actualSize?: number;
|
|
51
51
|
taskType?: string;
|
|
52
|
+
memoryBytes?: number;
|
|
52
53
|
}
|
|
53
54
|
export interface ListModelsOptions {
|
|
54
55
|
type?: ModelType;
|
|
@@ -85,7 +86,9 @@ export interface Harness {
|
|
|
85
86
|
model: string;
|
|
86
87
|
agent: AssistantAgent;
|
|
87
88
|
messages: ChatMessage[];
|
|
89
|
+
typedText?: string;
|
|
88
90
|
cacheKey?: string;
|
|
91
|
+
session?: string;
|
|
89
92
|
thinkingDefault?: string;
|
|
90
93
|
toolConfigs?: Record<string, Record<string, unknown>>;
|
|
91
94
|
captureInferenceCalls?: boolean;
|
|
@@ -220,6 +223,13 @@ export interface Harness {
|
|
|
220
223
|
contextLength?: number;
|
|
221
224
|
}>): void | Promise<void>;
|
|
222
225
|
setModelIdleTimeout?(ms: number): void | Promise<void>;
|
|
226
|
+
setModelMemoryCap?(percent: number): void | Promise<void>;
|
|
227
|
+
memoryUsage?(): Promise<{
|
|
228
|
+
usedBytes: number;
|
|
229
|
+
}>;
|
|
230
|
+
setDownloadsAllowed?(request: {
|
|
231
|
+
allowed: boolean;
|
|
232
|
+
}): void | Promise<void>;
|
|
223
233
|
previewModelSource?(input: PreviewModelSourceContext): Promise<ModelSourcePreview>;
|
|
224
234
|
on?(event: 'model' | 'status', listener: (...args: never[]) => void): unknown;
|
|
225
235
|
off?(event: 'model' | 'status', listener: (...args: never[]) => void): unknown;
|
|
@@ -271,4 +281,6 @@ export declare function harnessSpeakStream(harness: Pick<Harness, 'speakStream'>
|
|
|
271
281
|
export declare function harnessDeathReason(status: unknown): string;
|
|
272
282
|
export declare function harnessDied(status: unknown): boolean;
|
|
273
283
|
export declare function modelCatalogChanged(state: unknown): boolean;
|
|
284
|
+
export declare function heldLoadModel(state: unknown): string | null;
|
|
285
|
+
export declare function droppedHeldLoadModel(state: unknown): string | null;
|
|
274
286
|
export declare function imageDownloadProgress(state: unknown): ImageDownloadObservation | null;
|
|
@@ -164,6 +164,32 @@ export function harnessDied(status) {
|
|
|
164
164
|
export function modelCatalogChanged(state) {
|
|
165
165
|
return isRecord(state) && state.catalogChanged === true;
|
|
166
166
|
}
|
|
167
|
+
export function heldLoadModel(state) {
|
|
168
|
+
if (typeof state !== 'object' ||
|
|
169
|
+
state === null ||
|
|
170
|
+
!('status' in state) ||
|
|
171
|
+
state.status !== 'held' ||
|
|
172
|
+
!('model' in state) ||
|
|
173
|
+
typeof state.model !== 'string') {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
return state.model;
|
|
177
|
+
}
|
|
178
|
+
export function droppedHeldLoadModel(state) {
|
|
179
|
+
if (typeof state !== 'object' ||
|
|
180
|
+
state === null ||
|
|
181
|
+
!('status' in state) ||
|
|
182
|
+
state.status !== 'error' ||
|
|
183
|
+
!('message' in state) ||
|
|
184
|
+
state.message !== 'aborted' ||
|
|
185
|
+
!('addon' in state) ||
|
|
186
|
+
typeof state.addon !== 'string' ||
|
|
187
|
+
!('model' in state) ||
|
|
188
|
+
typeof state.model !== 'string') {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
return state.model;
|
|
192
|
+
}
|
|
167
193
|
export function imageDownloadProgress(state) {
|
|
168
194
|
if (typeof state !== 'object' ||
|
|
169
195
|
state === null ||
|
|
@@ -34,7 +34,11 @@ export interface SenderDevice {
|
|
|
34
34
|
}
|
|
35
35
|
export declare function senderNamesFrom(chunks: ReadonlyArray<AssistantChunk>, members: ReadonlyArray<SenderMember>, devices: ReadonlyArray<SenderDevice>): ReadonlyMap<string, string>;
|
|
36
36
|
export declare function senderAttribution(names: ReadonlyMap<string, string>): string;
|
|
37
|
-
export
|
|
37
|
+
export interface HistoryReplay {
|
|
38
|
+
readonly senderNames?: ReadonlyMap<string, string>;
|
|
39
|
+
readonly sentRuns?: ReadonlyMap<string, ReadonlyArray<ChatMessage>>;
|
|
40
|
+
}
|
|
41
|
+
export declare function historyFromChunks(chunks: ReadonlyArray<AssistantChunk>, stale?: Partial<StaleToolRuns>, { senderNames, sentRuns }?: HistoryReplay): ChatMessage[];
|
|
38
42
|
export declare function inputAvailableToRun(chunk: AssistantChunk, requestSeq: number): boolean;
|
|
39
43
|
export declare function normalizeQuestion(text: string): string;
|
|
40
44
|
export declare const GENERIC_ACKNOWLEDGEMENTS: Set<string>;
|