@qvac/core 0.10.3 → 0.10.4

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 (46) hide show
  1. package/CHANGELOG.md +37 -1
  2. package/dist-lib/lib/assistant/history.js +18 -2
  3. package/dist-lib/lib/assistant/message.d.ts +17 -0
  4. package/dist-lib/lib/assistant/message.js +28 -0
  5. package/dist-lib/lib/assistant/video-budget.d.ts +13 -0
  6. package/dist-lib/lib/assistant/video-budget.js +29 -0
  7. package/dist-lib/lib/assistant.d.ts +22 -2
  8. package/dist-lib/lib/assistant.js +374 -15
  9. package/dist-lib/lib/core/chat-fork.js +1 -0
  10. package/dist-lib/lib/core/chat-search.js +1 -1
  11. package/dist-lib/lib/core/chunk.d.ts +2 -2
  12. package/dist-lib/lib/core/chunk.js +5 -1
  13. package/dist-lib/lib/core/document-attachment.js +3 -0
  14. package/dist-lib/lib/core/files/index.js +4 -4
  15. package/dist-lib/lib/core/files/records/chunks.js +21 -0
  16. package/dist-lib/lib/core/files/records/purge.js +4 -3
  17. package/dist-lib/lib/core/files/records/source.js +3 -5
  18. package/dist-lib/lib/core/files/upload.js +3 -2
  19. package/dist-lib/lib/core/video/attachment.d.ts +1 -0
  20. package/dist-lib/lib/core/video/attachment.js +7 -0
  21. package/dist-lib/lib/core/video/digest.d.ts +16 -0
  22. package/dist-lib/lib/core/video/digest.js +57 -0
  23. package/dist-lib/lib/core/video/frames.d.ts +32 -0
  24. package/dist-lib/lib/core/video/frames.js +224 -0
  25. package/dist-lib/lib/core.js +19 -1
  26. package/dist-lib/lib/credential-pusher.d.ts +5 -0
  27. package/dist-lib/lib/credential-pusher.js +42 -11
  28. package/dist-lib/lib/run-notices.d.ts +1 -0
  29. package/dist-lib/lib/run-notices.js +2 -1
  30. package/dist-lib/lib/task.js +1 -1
  31. package/dist-lib/schema/engine.js +4 -2
  32. package/dist-lib/schema/indexes.js +2 -2
  33. package/dist-lib/schema/qvac.js +4 -2
  34. package/dist-lib/spec/hrpc/messages.js +16 -6
  35. package/dist-lib/spec/hyperschema/index.js +16 -6
  36. package/dist-lib/spec/hyperschema/schema.json +10 -0
  37. package/dist-lib/spec/hyperschema/types.d.ts +2 -0
  38. package/dist-lib/spec/mesh/hyperdb/messages.js +26 -11
  39. package/dist-lib/spec/mesh/hyperdispatch/messages.js +18 -8
  40. package/dist-lib/spec/mesh/hyperschema/index.js +18 -8
  41. package/dist-lib/spec/mesh/hyperschema/schema.json +11 -1
  42. package/dist-lib/spec/mesh/hyperschema/types.d.ts +3 -1
  43. package/package.json +3 -1
  44. package/tui/app.mjs +34 -1
  45. package/tui/lib/render.mjs +5 -0
  46. package/tui/main.mjs +8 -0
package/tui/app.mjs CHANGED
@@ -2206,6 +2206,21 @@ export class ChatApp {
2206
2206
  }
2207
2207
  }
2208
2208
 
2209
+ _reopenMeshes(meshes) {
2210
+ if (!this.engine.openMesh) return null
2211
+
2212
+ return meshes
2213
+ .filter((mesh) => !mesh.open)
2214
+ .map((mesh) => async () => {
2215
+ try {
2216
+ await this.engine.openMesh({ meshId: mesh.meshId })
2217
+ return null
2218
+ } catch (error) {
2219
+ return { type: 'mesh.reopen-failed', meshId: mesh.meshId, error }
2220
+ }
2221
+ })
2222
+ }
2223
+
2209
2224
  // the window's mesh can go without the window doing anything: a kick retires the account
2210
2225
  _watchNextMeshes() {
2211
2226
  if (!this.engine.meshesWatch) return null
@@ -6481,9 +6496,27 @@ export class ChatApp {
6481
6496
  const ids = new Set(msg.meshes.map((mesh) => mesh.meshId))
6482
6497
  // a mesh transition in flight moves the window itself
6483
6498
  const lost = !this._booting && this._meshIds?.has(this.meshId) && !ids.has(this.meshId)
6499
+ // only the startup frame: a later closed mesh was closed on purpose
6500
+ const first = this._meshIds === null
6484
6501
  this._meshIds = ids
6485
6502
 
6486
- return [this, batch(this._watchNextMeshes(), lost ? this._lostMesh(this.meshId) : null)]
6503
+ return [
6504
+ this,
6505
+ batch(
6506
+ this._watchNextMeshes(),
6507
+ lost ? this._lostMesh(this.meshId) : null,
6508
+ first ? this._reopenMeshes(msg.meshes) : null
6509
+ )
6510
+ ]
6511
+ }
6512
+
6513
+ if (msg.type === 'mesh.reopen-failed') {
6514
+ this.status = fg.err.render(
6515
+ `could not reopen mesh ${msg.meshId.slice(0, 8)}: ${msg.error.message}`
6516
+ )
6517
+ this._render()
6518
+
6519
+ return [this, null]
6487
6520
  }
6488
6521
 
6489
6522
  if (msg.type === 'meshes.done') {
@@ -36,6 +36,11 @@ export function turnsFromChunks(chunks) {
36
36
  const turns = []
37
37
  const byRun = new Map()
38
38
  for (const chunk of chunks) {
39
+ // a video's sampled frames belong to the video, not to the reply that stored them
40
+ if (chunk.sourceId) {
41
+ continue
42
+ }
43
+
39
44
  // purely presentational: lets a renderer label the human side per device
40
45
  if (chunk.type === 'user-message') {
41
46
  turns.push({
package/tui/main.mjs CHANGED
@@ -138,6 +138,14 @@ const MIME_TYPES = new Map([
138
138
  ['.heic', 'image/heic'],
139
139
  ['.heif', 'image/heif'],
140
140
  ['.pdf', 'application/pdf'],
141
+ ['.mov', 'video/quicktime'],
142
+ ['.mp4', 'video/mp4'],
143
+ ['.m4v', 'video/x-m4v'],
144
+ ['.webm', 'video/webm'],
145
+ ['.mkv', 'video/x-matroska'],
146
+ ['.m4a', 'audio/mp4'],
147
+ ['.mp3', 'audio/mpeg'],
148
+ ['.wav', 'audio/wav'],
141
149
  ['.txt', 'text/plain'],
142
150
  ['.md', 'text/markdown'],
143
151
  ['.json', 'application/json']