@qvac/core 1.0.0-rc.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/CHANGELOG.md +241 -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/device-routes.d.ts +6 -1
  8. package/dist-lib/lib/api/device-routes.js +20 -1
  9. package/dist-lib/lib/api/devices.js +6 -18
  10. package/dist-lib/lib/api/execution.d.ts +6 -2
  11. package/dist-lib/lib/api/execution.js +29 -3
  12. package/dist-lib/lib/api/host-run-log.d.ts +7 -1
  13. package/dist-lib/lib/api/host-run-log.js +3 -1
  14. package/dist-lib/lib/api/index.d.ts +3 -1
  15. package/dist-lib/lib/api/index.js +17 -6
  16. package/dist-lib/lib/api/members.js +13 -29
  17. package/dist-lib/lib/api/mesh.d.ts +2 -1
  18. package/dist-lib/lib/api/projects.d.ts +1 -1
  19. package/dist-lib/lib/api/projects.js +9 -5
  20. package/dist-lib/lib/api/rag-label.d.ts +4 -0
  21. package/dist-lib/lib/api/rag-label.js +21 -0
  22. package/dist-lib/lib/api/rag-lexical.d.ts +22 -0
  23. package/dist-lib/lib/api/rag-lexical.js +1058 -0
  24. package/dist-lib/lib/api/rag-manifest.d.ts +13 -0
  25. package/dist-lib/lib/api/rag-manifest.js +46 -0
  26. package/dist-lib/lib/api/rag-outline.d.ts +36 -0
  27. package/dist-lib/lib/api/rag-outline.js +426 -0
  28. package/dist-lib/lib/api/rag-plugin.d.ts +20 -0
  29. package/dist-lib/lib/api/rag-plugin.js +70 -0
  30. package/dist-lib/lib/api/rag-synthesis.d.ts +7 -0
  31. package/dist-lib/lib/api/rag-synthesis.js +102 -0
  32. package/dist-lib/lib/api/rag-targets.d.ts +23 -0
  33. package/dist-lib/lib/api/rag-targets.js +215 -0
  34. package/dist-lib/lib/api/rag-window.d.ts +5 -0
  35. package/dist-lib/lib/api/rag-window.js +46 -0
  36. package/dist-lib/lib/api/rag.d.ts +3 -2
  37. package/dist-lib/lib/api/rag.js +421 -184
  38. package/dist-lib/lib/api/served.js +8 -14
  39. package/dist-lib/lib/api/workspace.d.ts +8 -1
  40. package/dist-lib/lib/api/workspace.js +27 -13
  41. package/dist-lib/lib/assistant/harness.d.ts +9 -1
  42. package/dist-lib/lib/assistant/history.d.ts +11 -2
  43. package/dist-lib/lib/assistant/history.js +74 -4
  44. package/dist-lib/lib/assistant/media-round.d.ts +61 -0
  45. package/dist-lib/lib/assistant/media-round.js +111 -0
  46. package/dist-lib/lib/assistant/message.d.ts +7 -0
  47. package/dist-lib/lib/assistant/model-round.d.ts +19 -1
  48. package/dist-lib/lib/assistant/model-round.js +163 -28
  49. package/dist-lib/lib/assistant/pdf-pages.d.ts +16 -1
  50. package/dist-lib/lib/assistant/pdf-pages.js +67 -3
  51. package/dist-lib/lib/assistant/round-host.d.ts +22 -0
  52. package/dist-lib/lib/assistant/round-host.js +142 -8
  53. package/dist-lib/lib/assistant/upload.d.ts +12 -0
  54. package/dist-lib/lib/assistant/upload.js +36 -0
  55. package/dist-lib/lib/assistant-client.d.ts +1 -0
  56. package/dist-lib/lib/assistant-client.js +40 -19
  57. package/dist-lib/lib/assistant-tree.d.ts +2 -0
  58. package/dist-lib/lib/assistant-tree.js +48 -1
  59. package/dist-lib/lib/assistant.d.ts +18 -1
  60. package/dist-lib/lib/assistant.js +484 -95
  61. package/dist-lib/lib/client.d.ts +1 -0
  62. package/dist-lib/lib/client.js +4 -1
  63. package/dist-lib/lib/compaction.js +2 -2
  64. package/dist-lib/lib/core/agent.js +12 -45
  65. package/dist-lib/lib/core/approval-rules.js +1 -8
  66. package/dist-lib/lib/core/archived-mesh.d.ts +2 -1
  67. package/dist-lib/lib/core/archived-mesh.js +12 -8
  68. package/dist-lib/lib/core/chat-copy.d.ts +18 -3
  69. package/dist-lib/lib/core/chat-copy.js +74 -25
  70. package/dist-lib/lib/core/chat-fork.js +15 -6
  71. package/dist-lib/lib/core/chat-group.js +16 -24
  72. package/dist-lib/lib/core/chat-move.d.ts +9 -0
  73. package/dist-lib/lib/core/chat-move.js +94 -3
  74. package/dist-lib/lib/core/chat-order.js +12 -18
  75. package/dist-lib/lib/core/chat.js +38 -31
  76. package/dist-lib/lib/core/chunk.d.ts +2 -2
  77. package/dist-lib/lib/core/chunk.js +18 -25
  78. package/dist-lib/lib/core/collections.d.ts +2 -0
  79. package/dist-lib/lib/core/collections.js +2 -0
  80. package/dist-lib/lib/core/contract/activity.d.ts +4 -0
  81. package/dist-lib/lib/core/contract/activity.js +34 -4
  82. package/dist-lib/lib/core/contract/chat-group.d.ts +1 -0
  83. package/dist-lib/lib/core/contract/chat-group.js +21 -1
  84. package/dist-lib/lib/core/contract/chat.d.ts +9 -0
  85. package/dist-lib/lib/core/contract/chat.js +127 -5
  86. package/dist-lib/lib/core/contract/chunks.d.ts +1 -0
  87. package/dist-lib/lib/core/contract/chunks.js +37 -6
  88. package/dist-lib/lib/core/contract/features.d.ts +21 -0
  89. package/dist-lib/lib/core/contract/features.js +22 -0
  90. package/dist-lib/lib/core/contract/index.js +2 -0
  91. package/dist-lib/lib/core/contract/indexing.js +4 -2
  92. package/dist-lib/lib/core/contract/knowledge.js +5 -4
  93. package/dist-lib/lib/core/contract/members.js +16 -10
  94. package/dist-lib/lib/core/contract/mesh-kind.d.ts +1 -0
  95. package/dist-lib/lib/core/contract/mesh-kind.js +3 -1
  96. package/dist-lib/lib/core/contract/projects.d.ts +5 -0
  97. package/dist-lib/lib/core/contract/projects.js +13 -5
  98. package/dist-lib/lib/core/contract/roles.js +32 -4
  99. package/dist-lib/lib/core/contract/run-requests.d.ts +1 -0
  100. package/dist-lib/lib/core/contract/run-requests.js +35 -2
  101. package/dist-lib/lib/core/contract/seed-defaults.js +2 -2
  102. package/dist-lib/lib/core/contract/tool-configs.js +3 -2
  103. package/dist-lib/lib/core/contract/workspace.d.ts +2 -0
  104. package/dist-lib/lib/core/contract/workspace.js +40 -7
  105. package/dist-lib/lib/core/contract/writers.js +2 -2
  106. package/dist-lib/lib/core/departures.d.ts +3 -1
  107. package/dist-lib/lib/core/departures.js +3 -0
  108. package/dist-lib/lib/core/devices.js +1 -8
  109. package/dist-lib/lib/core/files/attachments.d.ts +2 -0
  110. package/dist-lib/lib/core/files/attachments.js +19 -1
  111. package/dist-lib/lib/core/files/index.d.ts +20 -4
  112. package/dist-lib/lib/core/files/index.js +132 -21
  113. package/dist-lib/lib/core/files/processing/document.d.ts +4 -0
  114. package/dist-lib/lib/core/files/processing/document.js +7 -0
  115. package/dist-lib/lib/core/files/processing/index.d.ts +13 -0
  116. package/dist-lib/lib/core/files/processing/index.js +144 -12
  117. package/dist-lib/lib/core/files/processing/protocol.js +13 -34
  118. package/dist-lib/lib/core/files/processing/state.d.ts +2 -0
  119. package/dist-lib/lib/core/files/rag/build.d.ts +19 -2
  120. package/dist-lib/lib/core/files/rag/build.js +123 -19
  121. package/dist-lib/lib/core/files/rag/failure.js +2 -1
  122. package/dist-lib/lib/core/files/rag/index.d.ts +11 -3
  123. package/dist-lib/lib/core/files/rag/index.js +13 -1
  124. package/dist-lib/lib/core/files/rag/load.d.ts +6 -3
  125. package/dist-lib/lib/core/files/rag/load.js +27 -6
  126. package/dist-lib/lib/core/files/rag/plugin-index.d.ts +32 -0
  127. package/dist-lib/lib/core/files/rag/plugin-index.js +127 -0
  128. package/dist-lib/lib/core/files/rag/produce.d.ts +5 -3
  129. package/dist-lib/lib/core/files/rag/produce.js +104 -16
  130. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +3 -1
  131. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +62 -13
  132. package/dist-lib/lib/core/files/rag/text-cache.d.ts +28 -0
  133. package/dist-lib/lib/core/files/rag/text-cache.js +141 -0
  134. package/dist-lib/lib/core/files/records/knowledge.d.ts +1 -3
  135. package/dist-lib/lib/core/files/records/knowledge.js +7 -40
  136. package/dist-lib/lib/core/files/records/reclaim.js +5 -10
  137. package/dist-lib/lib/core/files/upload.js +68 -41
  138. package/dist-lib/lib/core/fs-drives.js +14 -26
  139. package/dist-lib/lib/core/invite.d.ts +1 -0
  140. package/dist-lib/lib/core/invite.js +4 -2
  141. package/dist-lib/lib/core/local/files.d.ts +1 -1
  142. package/dist-lib/lib/core/local/files.js +5 -5
  143. package/dist-lib/lib/core/local/index.d.ts +13 -6
  144. package/dist-lib/lib/core/local/index.js +103 -69
  145. package/dist-lib/lib/core/local/run-logs.d.ts +1 -1
  146. package/dist-lib/lib/core/local/run-logs.js +5 -5
  147. package/dist-lib/lib/core/mesh-processor.d.ts +19 -0
  148. package/dist-lib/lib/core/mesh-processor.js +87 -0
  149. package/dist-lib/lib/core/mesh.d.ts +48 -5
  150. package/dist-lib/lib/core/mesh.js +318 -129
  151. package/dist-lib/lib/core/migrations/agent-catalog.js +2 -8
  152. package/dist-lib/lib/core/migrations/agent-tools-scope.js +5 -11
  153. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.d.ts +88 -0
  154. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.js +731 -0
  155. package/dist-lib/lib/core/migrations/writer-links.d.ts +2 -0
  156. package/dist-lib/lib/core/migrations/writer-links.js +32 -0
  157. package/dist-lib/lib/core/project-keys.d.ts +6 -0
  158. package/dist-lib/lib/core/project-keys.js +11 -0
  159. package/dist-lib/lib/core/public-mesh.d.ts +3 -0
  160. package/dist-lib/lib/core/public-mesh.js +10 -8
  161. package/dist-lib/lib/core/run-requests.d.ts +3 -0
  162. package/dist-lib/lib/core/run-requests.js +21 -1
  163. package/dist-lib/lib/core/skill-availability.d.ts +33 -0
  164. package/dist-lib/lib/core/skill-availability.js +67 -0
  165. package/dist-lib/lib/core/sync/background.d.ts +0 -1
  166. package/dist-lib/lib/core/sync/background.js +2 -1
  167. package/dist-lib/lib/core/sync/changed.d.ts +4 -2
  168. package/dist-lib/lib/core/sync/changed.js +1 -1
  169. package/dist-lib/lib/core/sync/index.js +52 -10
  170. package/dist-lib/lib/core/sync/view-updates.d.ts +18 -12
  171. package/dist-lib/lib/core/sync/view-updates.js +82 -91
  172. package/dist-lib/lib/core/sync-status.js +97 -41
  173. package/dist-lib/lib/core/tool-activity.js +6 -12
  174. package/dist-lib/lib/core/tool-configs.js +17 -29
  175. package/dist-lib/lib/core/upgrade-summary.d.ts +19 -0
  176. package/dist-lib/lib/core/upgrade-summary.js +67 -0
  177. package/dist-lib/lib/core/view-read.d.ts +4 -0
  178. package/dist-lib/lib/core/view-read.js +23 -0
  179. package/dist-lib/lib/core/workspace-upgrade.d.ts +7 -0
  180. package/dist-lib/lib/core/workspace-upgrade.js +27 -16
  181. package/dist-lib/lib/core.d.ts +45 -42
  182. package/dist-lib/lib/core.js +675 -640
  183. package/dist-lib/lib/errors.d.ts +24 -0
  184. package/dist-lib/lib/errors.js +24 -0
  185. package/dist-lib/lib/llm-model-names.d.ts +1 -1
  186. package/dist-lib/lib/llm-model-names.js +1 -1
  187. package/dist-lib/lib/mesh-scoped-engine.js +4 -0
  188. package/dist-lib/lib/model-context.js +1 -2
  189. package/dist-lib/lib/model-download.d.ts +6 -1
  190. package/dist-lib/lib/model-download.js +16 -3
  191. package/dist-lib/lib/oauth/resolve.js +29 -8
  192. package/dist-lib/lib/oauth/token-exchange-core.js +11 -0
  193. package/dist-lib/lib/probe-rounds.d.ts +7 -2
  194. package/dist-lib/lib/probe-rounds.js +6 -1
  195. package/dist-lib/lib/run-transcript.d.ts +4 -1
  196. package/dist-lib/lib/run-transcript.js +15 -6
  197. package/dist-lib/schema/engine.js +83 -6
  198. package/dist-lib/schema/indexes.d.ts +3 -0
  199. package/dist-lib/schema/indexes.js +5 -0
  200. package/dist-lib/schema/local.js +11 -2
  201. package/dist-lib/schema/qvac.js +49 -5
  202. package/dist-lib/spec/bind.js +34 -0
  203. package/dist-lib/spec/calls.js +5 -0
  204. package/dist-lib/spec/capabilities.d.ts +17 -0
  205. package/dist-lib/spec/hrpc/hrpc.json +65 -0
  206. package/dist-lib/spec/hrpc/index.js +68 -5
  207. package/dist-lib/spec/hrpc/messages.js +260 -23
  208. package/dist-lib/spec/hyperschema/index.js +260 -23
  209. package/dist-lib/spec/hyperschema/schema.json +181 -0
  210. package/dist-lib/spec/hyperschema/types.d.ts +48 -0
  211. package/dist-lib/spec/local/hyperdb/messages.js +270 -224
  212. package/dist-lib/spec/local/hyperschema/index.js +73 -38
  213. package/dist-lib/spec/local/hyperschema/schema.json +31 -0
  214. package/dist-lib/spec/local/hyperschema/types.d.ts +8 -0
  215. package/dist-lib/spec/mesh/hyperdb/db.json +39 -2
  216. package/dist-lib/spec/mesh/hyperdb/index.js +120 -3
  217. package/dist-lib/spec/mesh/hyperdb/messages.js +1328 -838
  218. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +30 -0
  219. package/dist-lib/spec/mesh/hyperdispatch/index.js +86 -1
  220. package/dist-lib/spec/mesh/hyperdispatch/messages.js +682 -287
  221. package/dist-lib/spec/mesh/hyperschema/index.js +682 -287
  222. package/dist-lib/spec/mesh/hyperschema/schema.json +201 -0
  223. package/dist-lib/spec/mesh/hyperschema/types.d.ts +52 -0
  224. package/package.json +82 -71
  225. package/tui/README.md +52 -0
  226. package/tui/app.mjs +69 -12
  227. package/tui/boot.mjs +27 -6
  228. package/tui/cli.mjs +93 -0
  229. package/tui/index.mjs +2 -87
  230. package/tui/lib/attachment-files.mjs +82 -0
  231. package/tui/lib/reopen-meshes.mjs +15 -0
  232. package/tui/lib/updater.mjs +86 -0
  233. package/tui/main.mjs +29 -57
  234. package/worker/assistant-sidecar.mjs +10 -3
  235. package/worker/stow-entry.mjs +3 -52
  236. package/dist-lib/lib/core/chat-project.d.ts +0 -2
  237. package/dist-lib/lib/core/chat-project.js +0 -15
@@ -12,7 +12,7 @@ export class LocalRunLogs {
12
12
  this._locked = locked;
13
13
  }
14
14
  begin({ meshKey, runId }, now = Date.now()) {
15
- return this._locked(async () => {
15
+ return this._locked('begin', async () => {
16
16
  const cursor = await this._db.get(LOCAL_RUN_LOGS, { meshKey, runId });
17
17
  const generation = b4a.toHex(crypto.randomBytes(16));
18
18
  const row = cursor
@@ -34,7 +34,7 @@ export class LocalRunLogs {
34
34
  });
35
35
  }
36
36
  append({ meshKey, runId, generation, step }, now = Date.now()) {
37
- return this._locked(async () => {
37
+ return this._locked('append', async () => {
38
38
  const cursor = await this._live({ meshKey, runId, generation });
39
39
  if (step.seq !== cursor.nextSeq || step.expectedLength !== cursor.length) {
40
40
  throw new CoreError('RUN_LOG_STEP_OUT_OF_ORDER', [runId, cursor.nextSeq]);
@@ -56,7 +56,7 @@ export class LocalRunLogs {
56
56
  });
57
57
  }
58
58
  release({ meshKey, runId, generation }, now = Date.now()) {
59
- return this._locked(async () => {
59
+ return this._locked('release', async () => {
60
60
  const cursor = await this._db.get(LOCAL_RUN_LOGS, { meshKey, runId });
61
61
  if (!cursor?.generation) {
62
62
  return;
@@ -70,14 +70,14 @@ export class LocalRunLogs {
70
70
  });
71
71
  }
72
72
  drop(key) {
73
- return this._locked(async () => {
73
+ return this._locked('drop', async () => {
74
74
  const tx = this._db.transaction();
75
75
  await deleteLog(tx, key);
76
76
  await tx.flush();
77
77
  });
78
78
  }
79
79
  sweep(now = Date.now()) {
80
- return this._locked(async () => {
80
+ return this._locked('sweep', async () => {
81
81
  const cursors = await this._db.find(LOCAL_RUN_LOGS).toArray();
82
82
  const expired = cursors.filter((cursor) => now - cursor.updatedAt > RUN_LOG_RETENTION_MS);
83
83
  if (expired.length === 0) {
@@ -0,0 +1,19 @@
1
+ export interface Processed {
2
+ readonly closing: unknown;
3
+ }
4
+ export type MeshPass<M, W> = (mesh: M, due: ReadonlySet<W>) => Promise<void>;
5
+ export declare class MeshProcessor<M extends Processed, W> {
6
+ private readonly _pass;
7
+ private readonly _onError;
8
+ private readonly _queued;
9
+ private readonly _settling;
10
+ private readonly _draining;
11
+ private _closed;
12
+ constructor(pass: MeshPass<M, W>, onError: (err: unknown) => void);
13
+ enqueue(mesh: M, due: ReadonlyArray<W>): void;
14
+ settle(mesh: M, write: () => Promise<void>): void;
15
+ settled(): Promise<void>;
16
+ close(): void;
17
+ private _chain;
18
+ private _drain;
19
+ }
@@ -0,0 +1,87 @@
1
+ import ScopeLock from 'scope-lock';
2
+ export class MeshProcessor {
3
+ _pass;
4
+ _onError;
5
+ _queued = new Map();
6
+ _settling = new Map();
7
+ _draining = new Set();
8
+ _closed = false;
9
+ constructor(pass, onError) {
10
+ this._pass = pass;
11
+ this._onError = onError;
12
+ }
13
+ enqueue(mesh, due) {
14
+ if (this._closed || mesh.closing || due.length === 0) {
15
+ return;
16
+ }
17
+ const queued = this._queued.get(mesh) ?? {
18
+ lock: new ScopeLock({ debounce: true }),
19
+ due: new Set(),
20
+ held: null
21
+ };
22
+ for (const writer of due) {
23
+ queued.due.add(writer);
24
+ }
25
+ this._queued.set(mesh, queued);
26
+ const draining = this._drain(mesh, queued).catch(this._onError);
27
+ this._draining.add(draining);
28
+ void draining.then(() => this._draining.delete(draining));
29
+ }
30
+ settle(mesh, write) {
31
+ const held = this._queued.get(mesh)?.held;
32
+ if (held) {
33
+ held.push(write);
34
+ return;
35
+ }
36
+ this._chain(mesh, write);
37
+ }
38
+ async settled() {
39
+ while (this._draining.size > 0 || this._settling.size > 0) {
40
+ await Promise.allSettled([...this._draining, ...this._settling.values()]);
41
+ }
42
+ }
43
+ close() {
44
+ this._closed = true;
45
+ for (const { lock } of this._queued.values()) {
46
+ lock.destroy();
47
+ }
48
+ this._queued.clear();
49
+ }
50
+ _chain(mesh, write) {
51
+ if (this._closed || mesh.closing) {
52
+ return;
53
+ }
54
+ const settling = (this._settling.get(mesh) ?? Promise.resolve())
55
+ .then(write)
56
+ .catch(this._onError);
57
+ this._settling.set(mesh, settling);
58
+ void settling.then(() => {
59
+ if (this._settling.get(mesh) === settling) {
60
+ this._settling.delete(mesh);
61
+ }
62
+ });
63
+ }
64
+ async _drain(mesh, queued) {
65
+ if (!(await queued.lock.lock()))
66
+ return;
67
+ const due = queued.due;
68
+ queued.due = new Set();
69
+ const held = [];
70
+ queued.held = held;
71
+ try {
72
+ if (!this._closed && !mesh.closing && due.size > 0) {
73
+ await this._pass(mesh, due);
74
+ }
75
+ }
76
+ finally {
77
+ queued.held = null;
78
+ queued.lock.unlock();
79
+ if (!queued.lock.locked && queued.due.size === 0 && this._queued.get(mesh) === queued) {
80
+ this._queued.delete(mesh);
81
+ }
82
+ }
83
+ for (const write of held) {
84
+ this._chain(mesh, write);
85
+ }
86
+ }
87
+ }
@@ -42,20 +42,40 @@ export interface MeshOptions {
42
42
  logger?: LoggerInterface | null;
43
43
  blindPeerKeys?: ReadonlyArray<Buffer>;
44
44
  bootFrom?: AutobeeOplogRef | null;
45
- trustedDevice?: (deviceId: Buffer) => Promise<boolean>;
45
+ joinHeads?: ReadonlyArray<AutobeeOplogRef>;
46
46
  wakeup?: Wakeup;
47
47
  attachmentUrl?: AttachmentUrl | null;
48
48
  fileIndex?: MeshFileIndex | null;
49
+ history?: MeshHistory | null;
49
50
  pendingUpdates?: PendingUpdates | null;
51
+ sidebarChats?: SidebarChats | null;
52
+ onerror?: ErrorSink;
50
53
  slowWriteMs?: number;
51
54
  slowDrainMs?: number;
52
55
  }
56
+ export interface MeshHistory {
57
+ edited(chatIds: ReadonlySet<string> | null): Promise<void>;
58
+ }
59
+ export type SidebarChats = (limit: number) => Promise<ReadonlyArray<{
60
+ readonly chatId: string;
61
+ }>>;
62
+ export interface ErrorContext {
63
+ readonly meshId?: string;
64
+ }
65
+ export type ErrorSink = (err: Error, context: ErrorContext) => void;
66
+ export declare class AppliedOp {
67
+ readonly writer: string;
68
+ readonly length: number;
69
+ constructor(writer: string, length: number);
70
+ }
71
+ export declare function logErrors(log: LoggerInterface | null): ErrorSink;
53
72
  export declare const SCHEMA_VERSION: number;
54
73
  export declare function meshPublicKeyFromSeed(seed: Buffer): Buffer;
55
74
  export interface TrustScope {
56
75
  readonly ourMemberId: Buffer | null;
57
76
  }
58
- export declare function isTrustedWriter(snap: HyperDB, writerKey: Buffer, { ourMemberId }: TrustScope): Promise<boolean>;
77
+ export declare function trustsDevice(device: QvacDevice | null, { ourMemberId }: TrustScope): boolean;
78
+ export declare function isTrustedWriter(snap: HyperDB, writerKey: Buffer, scope: TrustScope): Promise<boolean>;
59
79
  export type BirthRow = {
60
80
  readonly id: Buffer;
61
81
  readonly joinedAt: number;
@@ -79,7 +99,6 @@ interface BirthOptions {
79
99
  }
80
100
  export interface ProjectIdentity {
81
101
  readonly name: string;
82
- readonly upgraded?: boolean;
83
102
  }
84
103
  export interface WorkspaceIdentity {
85
104
  readonly name: string;
@@ -115,11 +134,16 @@ export declare class Mesh extends ReadyResource {
115
134
  private readonly _key;
116
135
  private readonly _writerSeed;
117
136
  private readonly _log;
137
+ private readonly _applyLog;
138
+ private _applying;
139
+ private readonly _onerror;
118
140
  private readonly _blindPeerKeys;
119
141
  private readonly _bootFrom;
142
+ private _joinHeads;
120
143
  private readonly _wakeup;
121
144
  readonly attachmentUrl: AttachmentUrl | null;
122
145
  readonly fileIndex: MeshFileIndex | null;
146
+ readonly history: MeshHistory | null;
123
147
  private readonly _scope;
124
148
  readonly router: Router;
125
149
  private readonly _keyPair;
@@ -131,12 +155,13 @@ export declare class Mesh extends ReadyResource {
131
155
  workspaceKey: Buffer | null;
132
156
  private readonly _updates;
133
157
  private _openedAt;
134
- private readonly _trustedDevice;
158
+ private readonly _sidebarChats;
135
159
  private _joined;
136
160
  private _orphanedBlobSweepStatus;
137
161
  private _bootInterrupted;
138
162
  private _localWriterUploadedLength;
139
163
  private _ourMemberId;
164
+ private _ourMembership;
140
165
  private _name;
141
166
  private _membership;
142
167
  private readonly _deviceId;
@@ -145,8 +170,10 @@ export declare class Mesh extends ReadyResource {
145
170
  private _stallReported;
146
171
  private _admitted;
147
172
  private _refused;
173
+ private readonly _applied;
148
174
  private _kickSeen;
149
175
  private _birth;
176
+ private _ownWriterSession;
150
177
  private _rulesRaised;
151
178
  private _autobee;
152
179
  private _blobs;
@@ -158,6 +185,8 @@ export declare class Mesh extends ReadyResource {
158
185
  get syncActivity(): SyncActivity;
159
186
  get publicKey(): Buffer;
160
187
  get log(): LoggerInterface | null;
188
+ reportError(err: unknown): void;
189
+ private _report;
161
190
  get devicePublicKey(): Buffer;
162
191
  get key(): Buffer;
163
192
  get role(): MeshRole;
@@ -167,11 +196,13 @@ export declare class Mesh extends ReadyResource {
167
196
  get orphanedBlobSweepStatus(): OrphanedBlobSweepStatus;
168
197
  blindPeerStats(): Array<BlindPeerStats>;
169
198
  get ourMemberId(): Buffer | null;
199
+ get ourMembership(): OurMembership | null;
170
200
  get ourDeviceId(): Buffer | null;
171
201
  get membership(): MembershipStats;
172
202
  tallyMembership(): void;
173
203
  refreshMembership(): Promise<void>;
174
204
  refreshOurMember(): Promise<QvacDevice | null>;
205
+ recordOurMember(own: QvacDevice | null): QvacDevice | null;
175
206
  get name(): QvacMeshName | null;
176
207
  refreshName(): Promise<void>;
177
208
  setName(name: string): Promise<void>;
@@ -192,6 +223,7 @@ export declare class Mesh extends ReadyResource {
192
223
  ownCoreDiscoveryKeys(storage: CorestoreStorage): Promise<Buffer[]>;
193
224
  openBlobs(coreKey: Buffer): Promise<Hyperblobs>;
194
225
  interruptBoot(): void;
226
+ close(): Promise<void>;
195
227
  _close(): Promise<void>;
196
228
  private _sweepOrphanedBlobs;
197
229
  get view(): HyperDB;
@@ -216,12 +248,15 @@ export declare class Mesh extends ReadyResource {
216
248
  private _settleBirth;
217
249
  get joined(): boolean;
218
250
  private _appendBirthOp;
251
+ joinAfter(heads: ReadonlyArray<AutobeeOplogRef>): void;
252
+ private _announceOwnWriter;
219
253
  private _bornKind;
220
254
  private _seedDefaults;
221
255
  get interrupted(): unknown;
222
256
  throwIfInterrupted(): void;
223
257
  waitForWritable(timeout?: number): Promise<void>;
224
258
  pendingUploads(): number;
259
+ appliedLength(writerKey: Buffer): number | undefined;
225
260
  suspend(): Promise<void>;
226
261
  resume(): void;
227
262
  syncInBackground({ focus }?: SyncInBackgroundOptions): Promise<boolean>;
@@ -229,13 +264,21 @@ export declare class Mesh extends ReadyResource {
229
264
  pickedFrom: (() => Promise<Mesh | null>) | null;
230
265
  syncChatOrder: ((chatIds: Set<string>) => Promise<void>) | null;
231
266
  chatOrderBuilt: Promise<void>;
267
+ chatOrderStale: boolean;
268
+ read(): HyperDB;
269
+ private _heldOrServed;
232
270
  watch(listener: () => void): void;
233
271
  unwatch(listener: () => void): void;
234
272
  _autobeeIsTrusted(key: Buffer, reference: MeshView): Promise<boolean>;
235
273
  _autobeeMostRecentTrusted(target: MeshView, reference: MeshView | null): Promise<AutobeeOplogRef | null>;
236
- private _vouchedByItsRow;
274
+ private _newestLinked;
275
+ private _trustedIndex;
276
+ private _newestTrustedOf;
277
+ private _trusts;
237
278
  _autobeeOpen(bee: unknown): MeshView;
279
+ _autobeeClose(view: MeshView): Promise<void>;
238
280
  _autobeeWarmup(view: MeshView): Promise<void>;
281
+ private _sidebarTop;
239
282
  _autobeeApply(nodes: ReadonlyArray<AutobeeNode>, view: MeshView, host: AutobeeHost): Promise<void>;
240
283
  private _applyNode;
241
284
  private _halt;