@qvac/core 1.0.0-rc.8 → 1.0.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.
Files changed (226) hide show
  1. package/CHANGELOG.md +243 -3
  2. package/README.md +1 -0
  3. package/dist-lib/lib/api/attachments.d.ts +1 -1
  4. package/dist-lib/lib/api/attachments.js +11 -0
  5. package/dist-lib/lib/api/chunks.d.ts +4 -2
  6. package/dist-lib/lib/api/chunks.js +6 -3
  7. package/dist-lib/lib/api/devices.js +6 -18
  8. package/dist-lib/lib/api/execution.d.ts +6 -2
  9. package/dist-lib/lib/api/execution.js +29 -3
  10. package/dist-lib/lib/api/host-run-log.d.ts +7 -1
  11. package/dist-lib/lib/api/host-run-log.js +3 -1
  12. package/dist-lib/lib/api/index.d.ts +3 -1
  13. package/dist-lib/lib/api/index.js +17 -6
  14. package/dist-lib/lib/api/members.js +13 -29
  15. package/dist-lib/lib/api/mesh.d.ts +2 -1
  16. package/dist-lib/lib/api/projects.d.ts +1 -1
  17. package/dist-lib/lib/api/projects.js +9 -5
  18. package/dist-lib/lib/api/rag-label.d.ts +4 -0
  19. package/dist-lib/lib/api/rag-label.js +21 -0
  20. package/dist-lib/lib/api/rag-lexical.d.ts +22 -0
  21. package/dist-lib/lib/api/rag-lexical.js +1058 -0
  22. package/dist-lib/lib/api/rag-manifest.d.ts +13 -0
  23. package/dist-lib/lib/api/rag-manifest.js +46 -0
  24. package/dist-lib/lib/api/rag-outline.d.ts +36 -0
  25. package/dist-lib/lib/api/rag-outline.js +426 -0
  26. package/dist-lib/lib/api/rag-plugin.d.ts +20 -0
  27. package/dist-lib/lib/api/rag-plugin.js +70 -0
  28. package/dist-lib/lib/api/rag-synthesis.d.ts +7 -0
  29. package/dist-lib/lib/api/rag-synthesis.js +102 -0
  30. package/dist-lib/lib/api/rag-targets.d.ts +23 -0
  31. package/dist-lib/lib/api/rag-targets.js +215 -0
  32. package/dist-lib/lib/api/rag-window.d.ts +5 -0
  33. package/dist-lib/lib/api/rag-window.js +46 -0
  34. package/dist-lib/lib/api/rag.d.ts +3 -2
  35. package/dist-lib/lib/api/rag.js +421 -181
  36. package/dist-lib/lib/api/served.js +8 -14
  37. package/dist-lib/lib/api/workspace.d.ts +8 -1
  38. package/dist-lib/lib/api/workspace.js +27 -13
  39. package/dist-lib/lib/assistant/harness.d.ts +9 -1
  40. package/dist-lib/lib/assistant/history.d.ts +11 -2
  41. package/dist-lib/lib/assistant/history.js +74 -4
  42. package/dist-lib/lib/assistant/media-round.d.ts +61 -0
  43. package/dist-lib/lib/assistant/media-round.js +111 -0
  44. package/dist-lib/lib/assistant/message.d.ts +7 -0
  45. package/dist-lib/lib/assistant/model-round.d.ts +12 -0
  46. package/dist-lib/lib/assistant/model-round.js +130 -17
  47. package/dist-lib/lib/assistant/pdf-pages.d.ts +16 -1
  48. package/dist-lib/lib/assistant/pdf-pages.js +67 -3
  49. package/dist-lib/lib/assistant/round-host.d.ts +22 -0
  50. package/dist-lib/lib/assistant/round-host.js +142 -8
  51. package/dist-lib/lib/assistant/upload.d.ts +12 -0
  52. package/dist-lib/lib/assistant/upload.js +36 -0
  53. package/dist-lib/lib/assistant-client.d.ts +1 -0
  54. package/dist-lib/lib/assistant-client.js +40 -19
  55. package/dist-lib/lib/assistant-tree.d.ts +2 -0
  56. package/dist-lib/lib/assistant-tree.js +41 -1
  57. package/dist-lib/lib/assistant.d.ts +15 -0
  58. package/dist-lib/lib/assistant.js +474 -89
  59. package/dist-lib/lib/client.d.ts +1 -0
  60. package/dist-lib/lib/client.js +4 -1
  61. package/dist-lib/lib/compaction.js +2 -2
  62. package/dist-lib/lib/core/agent.js +12 -45
  63. package/dist-lib/lib/core/approval-rules.js +1 -8
  64. package/dist-lib/lib/core/archived-mesh.d.ts +2 -1
  65. package/dist-lib/lib/core/archived-mesh.js +12 -8
  66. package/dist-lib/lib/core/chat-copy.d.ts +18 -3
  67. package/dist-lib/lib/core/chat-copy.js +74 -25
  68. package/dist-lib/lib/core/chat-fork.js +15 -6
  69. package/dist-lib/lib/core/chat-group.js +16 -24
  70. package/dist-lib/lib/core/chat-move.d.ts +9 -0
  71. package/dist-lib/lib/core/chat-move.js +94 -3
  72. package/dist-lib/lib/core/chat-order.js +12 -18
  73. package/dist-lib/lib/core/chat.js +38 -31
  74. package/dist-lib/lib/core/chunk.d.ts +2 -2
  75. package/dist-lib/lib/core/chunk.js +18 -25
  76. package/dist-lib/lib/core/collections.d.ts +2 -0
  77. package/dist-lib/lib/core/collections.js +2 -0
  78. package/dist-lib/lib/core/contract/activity.d.ts +4 -0
  79. package/dist-lib/lib/core/contract/activity.js +34 -4
  80. package/dist-lib/lib/core/contract/chat-group.d.ts +1 -0
  81. package/dist-lib/lib/core/contract/chat-group.js +21 -1
  82. package/dist-lib/lib/core/contract/chat.d.ts +9 -0
  83. package/dist-lib/lib/core/contract/chat.js +127 -5
  84. package/dist-lib/lib/core/contract/chunks.d.ts +1 -0
  85. package/dist-lib/lib/core/contract/chunks.js +37 -6
  86. package/dist-lib/lib/core/contract/features.d.ts +21 -0
  87. package/dist-lib/lib/core/contract/features.js +22 -0
  88. package/dist-lib/lib/core/contract/index.js +2 -0
  89. package/dist-lib/lib/core/contract/indexing.js +4 -2
  90. package/dist-lib/lib/core/contract/knowledge.js +5 -4
  91. package/dist-lib/lib/core/contract/members.js +16 -10
  92. package/dist-lib/lib/core/contract/mesh-kind.d.ts +1 -0
  93. package/dist-lib/lib/core/contract/mesh-kind.js +3 -1
  94. package/dist-lib/lib/core/contract/projects.d.ts +5 -0
  95. package/dist-lib/lib/core/contract/projects.js +13 -5
  96. package/dist-lib/lib/core/contract/roles.js +32 -4
  97. package/dist-lib/lib/core/contract/run-requests.d.ts +1 -0
  98. package/dist-lib/lib/core/contract/run-requests.js +35 -2
  99. package/dist-lib/lib/core/contract/seed-defaults.js +2 -2
  100. package/dist-lib/lib/core/contract/tool-configs.js +3 -2
  101. package/dist-lib/lib/core/contract/workspace.d.ts +2 -0
  102. package/dist-lib/lib/core/contract/workspace.js +40 -7
  103. package/dist-lib/lib/core/contract/writers.js +2 -2
  104. package/dist-lib/lib/core/departures.d.ts +3 -1
  105. package/dist-lib/lib/core/departures.js +3 -0
  106. package/dist-lib/lib/core/devices.js +1 -8
  107. package/dist-lib/lib/core/files/attachments.d.ts +2 -0
  108. package/dist-lib/lib/core/files/attachments.js +19 -1
  109. package/dist-lib/lib/core/files/index.d.ts +20 -4
  110. package/dist-lib/lib/core/files/index.js +132 -21
  111. package/dist-lib/lib/core/files/processing/document.d.ts +4 -0
  112. package/dist-lib/lib/core/files/processing/document.js +7 -0
  113. package/dist-lib/lib/core/files/processing/index.d.ts +13 -0
  114. package/dist-lib/lib/core/files/processing/index.js +144 -12
  115. package/dist-lib/lib/core/files/processing/protocol.js +13 -34
  116. package/dist-lib/lib/core/files/processing/state.d.ts +2 -0
  117. package/dist-lib/lib/core/files/rag/build.d.ts +19 -2
  118. package/dist-lib/lib/core/files/rag/build.js +123 -19
  119. package/dist-lib/lib/core/files/rag/failure.js +2 -1
  120. package/dist-lib/lib/core/files/rag/index.d.ts +11 -3
  121. package/dist-lib/lib/core/files/rag/index.js +13 -1
  122. package/dist-lib/lib/core/files/rag/load.d.ts +6 -3
  123. package/dist-lib/lib/core/files/rag/load.js +27 -6
  124. package/dist-lib/lib/core/files/rag/plugin-index.d.ts +32 -0
  125. package/dist-lib/lib/core/files/rag/plugin-index.js +127 -0
  126. package/dist-lib/lib/core/files/rag/produce.d.ts +5 -3
  127. package/dist-lib/lib/core/files/rag/produce.js +104 -16
  128. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +3 -1
  129. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +62 -13
  130. package/dist-lib/lib/core/files/rag/text-cache.d.ts +28 -0
  131. package/dist-lib/lib/core/files/rag/text-cache.js +141 -0
  132. package/dist-lib/lib/core/files/records/knowledge.d.ts +1 -3
  133. package/dist-lib/lib/core/files/records/knowledge.js +7 -40
  134. package/dist-lib/lib/core/files/records/reclaim.js +5 -10
  135. package/dist-lib/lib/core/files/upload.js +68 -41
  136. package/dist-lib/lib/core/fs-drives.js +14 -26
  137. package/dist-lib/lib/core/invite.d.ts +1 -0
  138. package/dist-lib/lib/core/invite.js +4 -2
  139. package/dist-lib/lib/core/local/files.d.ts +1 -1
  140. package/dist-lib/lib/core/local/files.js +5 -5
  141. package/dist-lib/lib/core/local/index.d.ts +13 -6
  142. package/dist-lib/lib/core/local/index.js +103 -69
  143. package/dist-lib/lib/core/local/run-logs.d.ts +1 -1
  144. package/dist-lib/lib/core/local/run-logs.js +5 -5
  145. package/dist-lib/lib/core/mesh-processor.d.ts +19 -0
  146. package/dist-lib/lib/core/mesh-processor.js +87 -0
  147. package/dist-lib/lib/core/mesh.d.ts +48 -5
  148. package/dist-lib/lib/core/mesh.js +318 -129
  149. package/dist-lib/lib/core/migrations/agent-catalog.js +2 -8
  150. package/dist-lib/lib/core/migrations/agent-tools-scope.js +5 -11
  151. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.d.ts +88 -0
  152. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.js +731 -0
  153. package/dist-lib/lib/core/migrations/writer-links.d.ts +2 -0
  154. package/dist-lib/lib/core/migrations/writer-links.js +32 -0
  155. package/dist-lib/lib/core/project-keys.d.ts +6 -0
  156. package/dist-lib/lib/core/project-keys.js +11 -0
  157. package/dist-lib/lib/core/public-mesh.d.ts +3 -0
  158. package/dist-lib/lib/core/public-mesh.js +10 -8
  159. package/dist-lib/lib/core/run-requests.d.ts +3 -0
  160. package/dist-lib/lib/core/run-requests.js +21 -1
  161. package/dist-lib/lib/core/skill-availability.d.ts +33 -0
  162. package/dist-lib/lib/core/skill-availability.js +67 -0
  163. package/dist-lib/lib/core/sync/background.d.ts +0 -1
  164. package/dist-lib/lib/core/sync/background.js +2 -1
  165. package/dist-lib/lib/core/sync/changed.d.ts +4 -2
  166. package/dist-lib/lib/core/sync/changed.js +1 -1
  167. package/dist-lib/lib/core/sync/index.js +52 -10
  168. package/dist-lib/lib/core/sync/view-updates.d.ts +18 -12
  169. package/dist-lib/lib/core/sync/view-updates.js +82 -91
  170. package/dist-lib/lib/core/sync-status.js +97 -41
  171. package/dist-lib/lib/core/tool-activity.js +6 -12
  172. package/dist-lib/lib/core/tool-configs.js +17 -29
  173. package/dist-lib/lib/core/upgrade-summary.d.ts +19 -0
  174. package/dist-lib/lib/core/upgrade-summary.js +67 -0
  175. package/dist-lib/lib/core/view-read.d.ts +4 -0
  176. package/dist-lib/lib/core/view-read.js +23 -0
  177. package/dist-lib/lib/core/workspace-upgrade.d.ts +7 -0
  178. package/dist-lib/lib/core/workspace-upgrade.js +27 -16
  179. package/dist-lib/lib/core.d.ts +39 -42
  180. package/dist-lib/lib/core.js +661 -639
  181. package/dist-lib/lib/errors.d.ts +20 -0
  182. package/dist-lib/lib/errors.js +20 -0
  183. package/dist-lib/lib/llm-model-names.d.ts +1 -1
  184. package/dist-lib/lib/llm-model-names.js +1 -1
  185. package/dist-lib/lib/mesh-scoped-engine.js +4 -0
  186. package/dist-lib/lib/model-context.js +1 -2
  187. package/dist-lib/lib/probe-rounds.d.ts +7 -2
  188. package/dist-lib/lib/probe-rounds.js +6 -1
  189. package/dist-lib/lib/run-transcript.d.ts +4 -1
  190. package/dist-lib/lib/run-transcript.js +15 -6
  191. package/dist-lib/schema/engine.js +83 -6
  192. package/dist-lib/schema/indexes.d.ts +3 -0
  193. package/dist-lib/schema/indexes.js +5 -0
  194. package/dist-lib/schema/local.js +11 -2
  195. package/dist-lib/schema/qvac.js +49 -5
  196. package/dist-lib/spec/bind.js +34 -0
  197. package/dist-lib/spec/calls.js +5 -0
  198. package/dist-lib/spec/capabilities.d.ts +17 -0
  199. package/dist-lib/spec/hrpc/hrpc.json +65 -0
  200. package/dist-lib/spec/hrpc/index.js +68 -5
  201. package/dist-lib/spec/hrpc/messages.js +260 -23
  202. package/dist-lib/spec/hyperschema/index.js +260 -23
  203. package/dist-lib/spec/hyperschema/schema.json +181 -0
  204. package/dist-lib/spec/hyperschema/types.d.ts +48 -0
  205. package/dist-lib/spec/local/hyperdb/messages.js +270 -224
  206. package/dist-lib/spec/local/hyperschema/index.js +73 -38
  207. package/dist-lib/spec/local/hyperschema/schema.json +31 -0
  208. package/dist-lib/spec/local/hyperschema/types.d.ts +8 -0
  209. package/dist-lib/spec/mesh/hyperdb/db.json +39 -2
  210. package/dist-lib/spec/mesh/hyperdb/index.js +120 -3
  211. package/dist-lib/spec/mesh/hyperdb/messages.js +1328 -838
  212. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +30 -0
  213. package/dist-lib/spec/mesh/hyperdispatch/index.js +86 -1
  214. package/dist-lib/spec/mesh/hyperdispatch/messages.js +682 -287
  215. package/dist-lib/spec/mesh/hyperschema/index.js +682 -287
  216. package/dist-lib/spec/mesh/hyperschema/schema.json +201 -0
  217. package/dist-lib/spec/mesh/hyperschema/types.d.ts +52 -0
  218. package/package.json +75 -70
  219. package/tui/README.md +2 -1
  220. package/tui/app.mjs +28 -7
  221. package/tui/boot.mjs +5 -1
  222. package/tui/lib/attachment-files.mjs +82 -0
  223. package/tui/lib/reopen-meshes.mjs +15 -0
  224. package/tui/main.mjs +4 -43
  225. package/worker/assistant-sidecar.mjs +10 -3
  226. package/worker/stow-entry.mjs +3 -52
@@ -1231,7 +1231,8 @@ const encoding29 = {
1231
1231
  ((version >= 13 && m.joinedAt) ? 1024 : 0) |
1232
1232
  ((version >= 13 && m.kicked) ? 2048 : 0) |
1233
1233
  ((version >= 13 && m.retiredUnder) ? 4096 : 0) |
1234
- ((version >= 13 && m.initial) ? 8192 : 0)
1234
+ ((version >= 13 && m.initial) ? 8192 : 0) |
1235
+ ((version >= 13 && m.joinHeads) ? 16384 : 0)
1235
1236
 
1236
1237
  c.fixed32.preencode(state, m.key)
1237
1238
  c.fixed32.preencode(state, m.seed)
@@ -1246,6 +1247,7 @@ const encoding29 = {
1246
1247
  if (version >= 13 && m.workspaceKey) c.fixed32.preencode(state, m.workspaceKey)
1247
1248
  if (version >= 13 && m.joinedAt) c.uint.preencode(state, m.joinedAt)
1248
1249
  if (version >= 13 && m.retiredUnder) c.fixed32.preencode(state, m.retiredUnder)
1250
+ if (version >= 13 && m.joinHeads) encoding29_16.preencode(state, m.joinHeads)
1249
1251
  },
1250
1252
  encode(state, m) {
1251
1253
  const flags =
@@ -1262,7 +1264,8 @@ const encoding29 = {
1262
1264
  ((version >= 13 && m.joinedAt) ? 1024 : 0) |
1263
1265
  ((version >= 13 && m.kicked) ? 2048 : 0) |
1264
1266
  ((version >= 13 && m.retiredUnder) ? 4096 : 0) |
1265
- ((version >= 13 && m.initial) ? 8192 : 0)
1267
+ ((version >= 13 && m.initial) ? 8192 : 0) |
1268
+ ((version >= 13 && m.joinHeads) ? 16384 : 0)
1266
1269
 
1267
1270
  c.fixed32.encode(state, m.key)
1268
1271
  c.fixed32.encode(state, m.seed)
@@ -1277,6 +1280,7 @@ const encoding29 = {
1277
1280
  if (version >= 13 && m.workspaceKey) c.fixed32.encode(state, m.workspaceKey)
1278
1281
  if (version >= 13 && m.joinedAt) c.uint.encode(state, m.joinedAt)
1279
1282
  if (version >= 13 && m.retiredUnder) c.fixed32.encode(state, m.retiredUnder)
1283
+ if (version >= 13 && m.joinHeads) encoding29_16.encode(state, m.joinHeads)
1280
1284
  },
1281
1285
  decode(state) {
1282
1286
  const r0 = c.fixed32.decode(state)
@@ -1300,7 +1304,8 @@ const encoding29 = {
1300
1304
  joinedAt: (version >= 13 && (flags & 1024) !== 0) ? c.uint.decode(state) : 0,
1301
1305
  kicked: (version >= 13 && (flags & 2048) !== 0),
1302
1306
  retiredUnder: (version >= 13 && (flags & 4096) !== 0) ? c.fixed32.decode(state) : null,
1303
- initial: (version >= 13 && (flags & 8192) !== 0)
1307
+ initial: (version >= 13 && (flags & 8192) !== 0),
1308
+ joinHeads: (version >= 13 && (flags & 16384) !== 0) ? encoding29_16.decode(state) : null
1304
1309
  }
1305
1310
  }
1306
1311
  }
@@ -1779,22 +1784,25 @@ const encoding40 = {
1779
1784
  const encoding41 = {
1780
1785
  preencode(state, m) {
1781
1786
  c.fixed32.preencode(state, m.meshKey)
1782
- state.end++ // max flag is 4 so always one byte
1787
+ state.end++ // max flag is 8 so always one byte
1783
1788
 
1784
1789
  if (version >= 11 && m.fromKey) c.fixed32.preencode(state, m.fromKey)
1785
1790
  if (version >= 11 && m.fromLength) c.uint.preencode(state, m.fromLength)
1791
+ if (version >= 13 && m.toLength) c.uint.preencode(state, m.toLength)
1786
1792
  },
1787
1793
  encode(state, m) {
1788
1794
  const flags =
1789
1795
  ((version >= 11 && m.fromKey) ? 1 : 0) |
1790
1796
  ((version >= 11 && m.fromLength) ? 2 : 0) |
1791
- ((version >= 11 && m.incremental) ? 4 : 0)
1797
+ ((version >= 11 && m.incremental) ? 4 : 0) |
1798
+ ((version >= 13 && m.toLength) ? 8 : 0)
1792
1799
 
1793
1800
  c.fixed32.encode(state, m.meshKey)
1794
1801
  c.uint.encode(state, flags)
1795
1802
 
1796
1803
  if (version >= 11 && m.fromKey) c.fixed32.encode(state, m.fromKey)
1797
1804
  if (version >= 11 && m.fromLength) c.uint.encode(state, m.fromLength)
1805
+ if (version >= 13 && m.toLength) c.uint.encode(state, m.toLength)
1798
1806
  },
1799
1807
  decode(state) {
1800
1808
  const r0 = c.fixed32.decode(state)
@@ -1805,7 +1813,8 @@ const encoding41 = {
1805
1813
  meshKey: r0,
1806
1814
  fromKey: (version >= 11 && (flags & 1) !== 0) ? c.fixed32.decode(state) : null,
1807
1815
  fromLength: (version >= 11 && (flags & 2) !== 0) ? c.uint.decode(state) : 0,
1808
- incremental: (version >= 11 && (flags & 4) !== 0)
1816
+ incremental: (version >= 11 && (flags & 4) !== 0),
1817
+ toLength: (version >= 13 && (flags & 8) !== 0) ? c.uint.decode(state) : 0
1809
1818
  }
1810
1819
  }
1811
1820
  }
@@ -1851,16 +1860,37 @@ const encoding42 = {
1851
1860
  }
1852
1861
  }
1853
1862
 
1863
+ // @local/join-head
1864
+ const encoding43 = {
1865
+ preencode(state, m) {
1866
+ c.fixed32.preencode(state, m.key)
1867
+ c.uint.preencode(state, m.length)
1868
+ },
1869
+ encode(state, m) {
1870
+ c.fixed32.encode(state, m.key)
1871
+ c.uint.encode(state, m.length)
1872
+ },
1873
+ decode(state) {
1874
+ const r0 = c.fixed32.decode(state)
1875
+ const r1 = c.uint.decode(state)
1876
+
1877
+ return {
1878
+ key: r0,
1879
+ length: r1
1880
+ }
1881
+ }
1882
+ }
1883
+
1854
1884
  // @local/mesh-purge-v1.cores
1855
- const encoding43_1 = c.array(c.fixed32)
1885
+ const encoding44_1 = c.array(c.fixed32)
1856
1886
 
1857
1887
  // @local/mesh-purge-v1
1858
- const encoding43 = {
1888
+ const encoding44 = {
1859
1889
  preencode(state, m) {
1860
1890
  c.fixed32.preencode(state, m.key)
1861
1891
  state.end++ // max flag is 1 so always one byte
1862
1892
 
1863
- if (version >= 13 && m.cores) encoding43_1.preencode(state, m.cores)
1893
+ if (version >= 13 && m.cores) encoding44_1.preencode(state, m.cores)
1864
1894
  },
1865
1895
  encode(state, m) {
1866
1896
  const flags = (version >= 13 && m.cores) ? 1 : 0
@@ -1868,7 +1898,7 @@ const encoding43 = {
1868
1898
  c.fixed32.encode(state, m.key)
1869
1899
  c.uint.encode(state, flags)
1870
1900
 
1871
- if (version >= 13 && m.cores) encoding43_1.encode(state, m.cores)
1901
+ if (version >= 13 && m.cores) encoding44_1.encode(state, m.cores)
1872
1902
  },
1873
1903
  decode(state) {
1874
1904
  const r0 = c.fixed32.decode(state)
@@ -1877,20 +1907,20 @@ const encoding43 = {
1877
1907
  return {
1878
1908
  version: 0,
1879
1909
  key: r0,
1880
- cores: (version >= 13 && (flags & 1) !== 0) ? encoding43_1.decode(state) : null
1910
+ cores: (version >= 13 && (flags & 1) !== 0) ? encoding44_1.decode(state) : null
1881
1911
  }
1882
1912
  }
1883
1913
  }
1884
1914
 
1885
1915
  // @local/mesh-purge
1886
- const encoding44 = {
1916
+ const encoding45 = {
1887
1917
  preencode(state, m) {
1888
1918
  const v = m.version ?? 1
1889
1919
  c.uint.preencode(state, v)
1890
1920
  switch (v) {
1891
1921
  case 0:
1892
1922
  case 1:
1893
- encoding43.preencode(state, m)
1923
+ encoding44.preencode(state, m)
1894
1924
  break
1895
1925
  default:
1896
1926
  throw new Error('Unsupported version')
@@ -1902,7 +1932,7 @@ const encoding44 = {
1902
1932
  switch (v) {
1903
1933
  case 0:
1904
1934
  case 1:
1905
- encoding43.encode(state, m)
1935
+ encoding44.encode(state, m)
1906
1936
  break
1907
1937
  default:
1908
1938
  throw new Error('Unsupported version')
@@ -1913,7 +1943,7 @@ const encoding44 = {
1913
1943
  switch (v) {
1914
1944
  case 0:
1915
1945
  case 1: {
1916
- const decoded = encoding43.decode(state)
1946
+ const decoded = encoding44.decode(state)
1917
1947
  decoded.version = v
1918
1948
  return decoded
1919
1949
  }
@@ -1924,7 +1954,7 @@ const encoding44 = {
1924
1954
  }
1925
1955
 
1926
1956
  // @local/mesh-name-v1
1927
- const encoding45 = {
1957
+ const encoding46 = {
1928
1958
  preencode(state, m) {
1929
1959
  c.fixed32.preencode(state, m.meshKey)
1930
1960
  c.string.preencode(state, m.name)
@@ -1950,14 +1980,14 @@ const encoding45 = {
1950
1980
  }
1951
1981
 
1952
1982
  // @local/mesh-name
1953
- const encoding46 = {
1983
+ const encoding47 = {
1954
1984
  preencode(state, m) {
1955
1985
  const v = m.version ?? 1
1956
1986
  c.uint.preencode(state, v)
1957
1987
  switch (v) {
1958
1988
  case 0:
1959
1989
  case 1:
1960
- encoding45.preencode(state, m)
1990
+ encoding46.preencode(state, m)
1961
1991
  break
1962
1992
  default:
1963
1993
  throw new Error('Unsupported version')
@@ -1969,7 +1999,7 @@ const encoding46 = {
1969
1999
  switch (v) {
1970
2000
  case 0:
1971
2001
  case 1:
1972
- encoding45.encode(state, m)
2002
+ encoding46.encode(state, m)
1973
2003
  break
1974
2004
  default:
1975
2005
  throw new Error('Unsupported version')
@@ -1980,7 +2010,7 @@ const encoding46 = {
1980
2010
  switch (v) {
1981
2011
  case 0:
1982
2012
  case 1: {
1983
- const decoded = encoding45.decode(state)
2013
+ const decoded = encoding46.decode(state)
1984
2014
  decoded.version = v
1985
2015
  return decoded
1986
2016
  }
@@ -1991,7 +2021,7 @@ const encoding46 = {
1991
2021
  }
1992
2022
 
1993
2023
  // @local/run-log-v1
1994
- const encoding47 = {
2024
+ const encoding48 = {
1995
2025
  preencode(state, m) {
1996
2026
  c.fixed32.preencode(state, m.meshKey)
1997
2027
  c.string.preencode(state, m.runId)
@@ -2035,14 +2065,14 @@ const encoding47 = {
2035
2065
  }
2036
2066
 
2037
2067
  // @local/run-log
2038
- const encoding48 = {
2068
+ const encoding49 = {
2039
2069
  preencode(state, m) {
2040
2070
  const v = m.version ?? 1
2041
2071
  c.uint.preencode(state, v)
2042
2072
  switch (v) {
2043
2073
  case 0:
2044
2074
  case 1:
2045
- encoding47.preencode(state, m)
2075
+ encoding48.preencode(state, m)
2046
2076
  break
2047
2077
  default:
2048
2078
  throw new Error('Unsupported version')
@@ -2054,7 +2084,7 @@ const encoding48 = {
2054
2084
  switch (v) {
2055
2085
  case 0:
2056
2086
  case 1:
2057
- encoding47.encode(state, m)
2087
+ encoding48.encode(state, m)
2058
2088
  break
2059
2089
  default:
2060
2090
  throw new Error('Unsupported version')
@@ -2065,7 +2095,7 @@ const encoding48 = {
2065
2095
  switch (v) {
2066
2096
  case 0:
2067
2097
  case 1: {
2068
- const decoded = encoding47.decode(state)
2098
+ const decoded = encoding48.decode(state)
2069
2099
  decoded.version = v
2070
2100
  return decoded
2071
2101
  }
@@ -2076,7 +2106,7 @@ const encoding48 = {
2076
2106
  }
2077
2107
 
2078
2108
  // @local/run-log-step-v1
2079
- const encoding49 = {
2109
+ const encoding50 = {
2080
2110
  preencode(state, m) {
2081
2111
  c.fixed32.preencode(state, m.meshKey)
2082
2112
  c.string.preencode(state, m.runId)
@@ -2106,14 +2136,14 @@ const encoding49 = {
2106
2136
  }
2107
2137
 
2108
2138
  // @local/run-log-step
2109
- const encoding50 = {
2139
+ const encoding51 = {
2110
2140
  preencode(state, m) {
2111
2141
  const v = m.version ?? 1
2112
2142
  c.uint.preencode(state, v)
2113
2143
  switch (v) {
2114
2144
  case 0:
2115
2145
  case 1:
2116
- encoding49.preencode(state, m)
2146
+ encoding50.preencode(state, m)
2117
2147
  break
2118
2148
  default:
2119
2149
  throw new Error('Unsupported version')
@@ -2125,7 +2155,7 @@ const encoding50 = {
2125
2155
  switch (v) {
2126
2156
  case 0:
2127
2157
  case 1:
2128
- encoding49.encode(state, m)
2158
+ encoding50.encode(state, m)
2129
2159
  break
2130
2160
  default:
2131
2161
  throw new Error('Unsupported version')
@@ -2136,7 +2166,7 @@ const encoding50 = {
2136
2166
  switch (v) {
2137
2167
  case 0:
2138
2168
  case 1: {
2139
- const decoded = encoding49.decode(state)
2169
+ const decoded = encoding50.decode(state)
2140
2170
  decoded.version = v
2141
2171
  return decoded
2142
2172
  }
@@ -2146,6 +2176,9 @@ const encoding50 = {
2146
2176
  }
2147
2177
  }
2148
2178
 
2179
+ // @local/mesh-membership-v1.joinHeads, deferred due to recusive use
2180
+ const encoding29_16 = c.array(c.frame(encoding43))
2181
+
2149
2182
  function setVersion(v) {
2150
2183
  version = v
2151
2184
  }
@@ -2261,22 +2294,24 @@ function getEncoding(name) {
2261
2294
  return encoding41
2262
2295
  case '@local/mesh-update':
2263
2296
  return encoding42
2264
- case '@local/mesh-purge-v1':
2297
+ case '@local/join-head':
2265
2298
  return encoding43
2266
- case '@local/mesh-purge':
2299
+ case '@local/mesh-purge-v1':
2267
2300
  return encoding44
2268
- case '@local/mesh-name-v1':
2301
+ case '@local/mesh-purge':
2269
2302
  return encoding45
2270
- case '@local/mesh-name':
2303
+ case '@local/mesh-name-v1':
2271
2304
  return encoding46
2272
- case '@local/run-log-v1':
2305
+ case '@local/mesh-name':
2273
2306
  return encoding47
2274
- case '@local/run-log':
2307
+ case '@local/run-log-v1':
2275
2308
  return encoding48
2276
- case '@local/run-log-step-v1':
2309
+ case '@local/run-log':
2277
2310
  return encoding49
2278
- case '@local/run-log-step':
2311
+ case '@local/run-log-step-v1':
2279
2312
  return encoding50
2313
+ case '@local/run-log-step':
2314
+ return encoding51
2280
2315
  default:
2281
2316
  throw new Error('Encoder not found ' + name)
2282
2317
  }
@@ -830,6 +830,12 @@
830
830
  "name": "initial",
831
831
  "type": "bool",
832
832
  "version": 13
833
+ },
834
+ {
835
+ "name": "joinHeads",
836
+ "array": true,
837
+ "type": "@local/join-head",
838
+ "version": 13
833
839
  }
834
840
  ]
835
841
  },
@@ -1166,6 +1172,11 @@
1166
1172
  "required": false,
1167
1173
  "type": "bool",
1168
1174
  "version": 11
1175
+ },
1176
+ {
1177
+ "name": "toLength",
1178
+ "type": "uint",
1179
+ "version": 13
1169
1180
  }
1170
1181
  ]
1171
1182
  },
@@ -1181,6 +1192,26 @@
1181
1192
  }
1182
1193
  ]
1183
1194
  },
1195
+ {
1196
+ "name": "join-head",
1197
+ "namespace": "local",
1198
+ "compact": false,
1199
+ "flagsPosition": -1,
1200
+ "fields": [
1201
+ {
1202
+ "name": "key",
1203
+ "required": true,
1204
+ "type": "fixed32",
1205
+ "version": 13
1206
+ },
1207
+ {
1208
+ "name": "length",
1209
+ "required": true,
1210
+ "type": "uint",
1211
+ "version": 13
1212
+ }
1213
+ ]
1214
+ },
1184
1215
  {
1185
1216
  "name": "mesh-purge-v1",
1186
1217
  "namespace": "local",
@@ -164,6 +164,7 @@ export interface LocalMeshMembershipV1 {
164
164
  kicked?: boolean
165
165
  retiredUnder?: Buffer | null
166
166
  initial?: boolean
167
+ joinHeads?: LocalJoinHead[] | null
167
168
  }
168
169
 
169
170
  export type LocalMeshMembership = (LocalMeshMembershipV1 & { version?: number })
@@ -232,10 +233,16 @@ export interface LocalMeshUpdateV1 {
232
233
  fromKey?: Buffer | null
233
234
  fromLength?: number
234
235
  incremental?: boolean
236
+ toLength?: number
235
237
  }
236
238
 
237
239
  export type LocalMeshUpdate = (LocalMeshUpdateV1 & { version?: number })
238
240
 
241
+ export interface LocalJoinHead {
242
+ key: Buffer
243
+ length: number
244
+ }
245
+
239
246
  export interface LocalMeshPurgeV1 {
240
247
  key: Buffer
241
248
  cores?: Buffer[] | null
@@ -316,6 +323,7 @@ export interface SchemaTypes {
316
323
  "@local/chat-move": LocalChatMove
317
324
  "@local/mesh-update-v1": LocalMeshUpdateV1
318
325
  "@local/mesh-update": LocalMeshUpdate
326
+ "@local/join-head": LocalJoinHead
319
327
  "@local/mesh-purge-v1": LocalMeshPurgeV1
320
328
  "@local/mesh-purge": LocalMeshPurge
321
329
  "@local/mesh-name-v1": LocalMeshNameV1
@@ -571,11 +571,12 @@
571
571
  "namespace": "qvac",
572
572
  "id": 29,
573
573
  "type": 1,
574
- "version": 4,
574
+ "version": 12,
575
575
  "versionField": null,
576
576
  "indexes": [
577
577
  "@qvac/writers-by-most-recent",
578
- "@qvac/live-writers-by-most-recent"
578
+ "@qvac/live-writers-by-most-recent",
579
+ "@qvac/linked-writers-by-most-recent"
579
580
  ],
580
581
  "schema": "@qvac/writer-activity",
581
582
  "derived": false,
@@ -1587,6 +1588,42 @@
1587
1588
  "key": [
1588
1589
  "memberId"
1589
1590
  ]
1591
+ },
1592
+ {
1593
+ "name": "linked-writers-by-most-recent",
1594
+ "namespace": "qvac",
1595
+ "id": 90,
1596
+ "type": 2,
1597
+ "version": 12,
1598
+ "collection": "@qvac/writer-activity",
1599
+ "unique": false,
1600
+ "deprecated": false,
1601
+ "key": {
1602
+ "type": {
1603
+ "fields": [
1604
+ {
1605
+ "name": "clock",
1606
+ "type": "uint"
1607
+ }
1608
+ ]
1609
+ },
1610
+ "map": "linkedWritersByMostRecentMap"
1611
+ }
1612
+ },
1613
+ {
1614
+ "name": "moved-out-chats",
1615
+ "namespace": "qvac",
1616
+ "id": 91,
1617
+ "type": 1,
1618
+ "version": 12,
1619
+ "versionField": null,
1620
+ "indexes": [],
1621
+ "schema": "@qvac/moved-out-chat",
1622
+ "derived": false,
1623
+ "key": [
1624
+ "chatId"
1625
+ ],
1626
+ "trigger": null
1590
1627
  }
1591
1628
  ]
1592
1629
  }
@@ -1750,7 +1750,7 @@ function collection29_reconstruct_key (keyBuf) {
1750
1750
  const collection29 = {
1751
1751
  name: '@qvac/writer-activity',
1752
1752
  id: 29,
1753
- version: 4,
1753
+ version: 12,
1754
1754
  encodeKey (record) {
1755
1755
  const key = [record.writerKey]
1756
1756
  return collection29_key.encode(key)
@@ -5570,6 +5570,119 @@ const index89 = {
5570
5570
  }
5571
5571
  collection87.indexes.push(index89)
5572
5572
 
5573
+ // '@qvac/linked-writers-by-most-recent' collection key
5574
+ const index90_key = new IndexEncoder([
5575
+ IndexEncoder.UINT,
5576
+ IndexEncoder.BUFFER
5577
+ ], { prefix: 90 })
5578
+
5579
+ // '@qvac/linked-writers-by-most-recent' has the following schema defined key map
5580
+ const index90_map = helpers0.linkedWritersByMostRecentMap
5581
+
5582
+ function index90_indexify (record) {
5583
+ const a = record.clock
5584
+ return a === undefined ? [] : [a]
5585
+ }
5586
+
5587
+ // '@qvac/linked-writers-by-most-recent'
5588
+ const index90 = {
5589
+ name: '@qvac/linked-writers-by-most-recent',
5590
+ version: 12,
5591
+ id: 90,
5592
+ encodeKey (record) {
5593
+ return index90_key.encode(index90_indexify(record))
5594
+ },
5595
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
5596
+ return index90_key.encodeRange({
5597
+ gt: gt ? index90_indexify(gt) : null,
5598
+ lt: lt ? index90_indexify(lt) : null,
5599
+ gte: gte ? index90_indexify(gte) : null,
5600
+ lte: lte ? index90_indexify(lte) : null
5601
+ })
5602
+ },
5603
+ encodeValue: (record) => index90.collection.encodeKey(record),
5604
+ encodeIndexKeys (record, context) {
5605
+ const mapped = index90_map(record, context)
5606
+ const keys = new Array(mapped.length)
5607
+ for (let i = 0; i < mapped.length; i++) {
5608
+ const mappedRecord = mapped[i]
5609
+ keys[i] = index90_key.encode([mappedRecord.clock, record.writerKey])
5610
+ }
5611
+ return keys
5612
+ },
5613
+ reconstruct: (keyBuf, valueBuf) => valueBuf,
5614
+ offset: collection29.indexes.length,
5615
+ collection: collection29
5616
+ }
5617
+ collection29.indexes.push(index90)
5618
+
5619
+ // '@qvac/moved-out-chats' collection key
5620
+ const collection91_key = new IndexEncoder([
5621
+ IndexEncoder.STRING
5622
+ ], { prefix: 91 })
5623
+
5624
+ function collection91_indexify (record) {
5625
+ const a = record.chatId
5626
+ return a === undefined ? [] : [a]
5627
+ }
5628
+
5629
+ // '@qvac/moved-out-chats' value encoding
5630
+ const collection91_enc = getEncoding('@qvac/moved-out-chat/hyperdb#91')
5631
+
5632
+ // '@qvac/moved-out-chats' reconstruction function
5633
+ function collection91_reconstruct (schemaVersion, keyBuf, valueBuf) {
5634
+ const key = collection91_key.decode(keyBuf)
5635
+ setVersion(schemaVersion)
5636
+ const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
5637
+ const type = c.uint.decode(state)
5638
+ if (type !== 0) throw new Error('Unknown collection type: ' + type)
5639
+ collection91.decodedVersion = c.uint.decode(state)
5640
+ const record = collection91_enc.decode(state)
5641
+ record.chatId = key[0]
5642
+ return record
5643
+ }
5644
+ // '@qvac/moved-out-chats' key reconstruction function
5645
+ function collection91_reconstruct_key (keyBuf) {
5646
+ const key = collection91_key.decode(keyBuf)
5647
+ return {
5648
+ chatId: key[0]
5649
+ }
5650
+ }
5651
+
5652
+ // '@qvac/moved-out-chats'
5653
+ const collection91 = {
5654
+ name: '@qvac/moved-out-chats',
5655
+ id: 91,
5656
+ version: 12,
5657
+ encodeKey (record) {
5658
+ const key = [record.chatId]
5659
+ return collection91_key.encode(key)
5660
+ },
5661
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
5662
+ return collection91_key.encodeRange({
5663
+ gt: gt ? collection91_indexify(gt) : null,
5664
+ lt: lt ? collection91_indexify(lt) : null,
5665
+ gte: gte ? collection91_indexify(gte) : null,
5666
+ lte: lte ? collection91_indexify(lte) : null
5667
+ })
5668
+ },
5669
+ encodeValue (schemaVersion, collectionVersion, record) {
5670
+ setVersion(schemaVersion)
5671
+ const state = { start: 0, end: 2, buffer: null }
5672
+ collection91_enc.preencode(state, record)
5673
+ state.buffer = b4a.allocUnsafe(state.end)
5674
+ state.buffer[state.start++] = 0
5675
+ state.buffer[state.start++] = collectionVersion
5676
+ collection91_enc.encode(state, record)
5677
+ return state.buffer
5678
+ },
5679
+ trigger: null,
5680
+ reconstruct: collection91_reconstruct,
5681
+ reconstructKey: collection91_reconstruct_key,
5682
+ indexes: [],
5683
+ decodedVersion: 0
5684
+ }
5685
+
5573
5686
  const collections = [
5574
5687
  collection0,
5575
5688
  collection1,
@@ -5619,7 +5732,8 @@ const collections = [
5619
5732
  collection71,
5620
5733
  collection83,
5621
5734
  collection85,
5622
- collection87
5735
+ collection87,
5736
+ collection91
5623
5737
  ]
5624
5738
 
5625
5739
  const indexes = [
@@ -5663,7 +5777,8 @@ const indexes = [
5663
5777
  index84,
5664
5778
  index86,
5665
5779
  index88,
5666
- index89
5780
+ index89,
5781
+ index90
5667
5782
  ]
5668
5783
 
5669
5784
  export default { versions, collections, indexes, resolveCollection, resolveIndex }
@@ -5719,6 +5834,7 @@ function resolveCollection (name) {
5719
5834
  case '@qvac/project-host-seals': return collection83
5720
5835
  case '@qvac/project-member-seals': return collection85
5721
5836
  case '@qvac/project-device-seals': return collection87
5837
+ case '@qvac/moved-out-chats': return collection91
5722
5838
  default: return null
5723
5839
  }
5724
5840
  }
@@ -5766,6 +5882,7 @@ function resolveIndex (name) {
5766
5882
  case '@qvac/project-member-seals-by-member': return index86
5767
5883
  case '@qvac/project-device-seals-by-device': return index88
5768
5884
  case '@qvac/project-device-seals-by-member': return index89
5885
+ case '@qvac/linked-writers-by-most-recent': return index90
5769
5886
  default: return null
5770
5887
  }
5771
5888
  }