@qvac/core 1.0.0-rc.8 → 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.
- package/CHANGELOG.md +234 -3
- package/README.md +1 -0
- package/dist-lib/lib/api/attachments.d.ts +1 -1
- package/dist-lib/lib/api/attachments.js +11 -0
- package/dist-lib/lib/api/chunks.d.ts +4 -2
- package/dist-lib/lib/api/chunks.js +6 -3
- package/dist-lib/lib/api/devices.js +6 -18
- package/dist-lib/lib/api/execution.d.ts +6 -2
- package/dist-lib/lib/api/execution.js +29 -3
- package/dist-lib/lib/api/host-run-log.d.ts +7 -1
- package/dist-lib/lib/api/host-run-log.js +3 -1
- package/dist-lib/lib/api/index.d.ts +3 -1
- package/dist-lib/lib/api/index.js +17 -6
- package/dist-lib/lib/api/members.js +13 -29
- package/dist-lib/lib/api/mesh.d.ts +2 -1
- package/dist-lib/lib/api/projects.d.ts +1 -1
- package/dist-lib/lib/api/projects.js +9 -5
- package/dist-lib/lib/api/rag-label.d.ts +4 -0
- package/dist-lib/lib/api/rag-label.js +21 -0
- package/dist-lib/lib/api/rag-lexical.d.ts +22 -0
- package/dist-lib/lib/api/rag-lexical.js +1058 -0
- package/dist-lib/lib/api/rag-manifest.d.ts +13 -0
- package/dist-lib/lib/api/rag-manifest.js +46 -0
- package/dist-lib/lib/api/rag-outline.d.ts +36 -0
- package/dist-lib/lib/api/rag-outline.js +426 -0
- package/dist-lib/lib/api/rag-plugin.d.ts +20 -0
- package/dist-lib/lib/api/rag-plugin.js +70 -0
- package/dist-lib/lib/api/rag-synthesis.d.ts +7 -0
- package/dist-lib/lib/api/rag-synthesis.js +102 -0
- package/dist-lib/lib/api/rag-targets.d.ts +23 -0
- package/dist-lib/lib/api/rag-targets.js +215 -0
- package/dist-lib/lib/api/rag-window.d.ts +5 -0
- package/dist-lib/lib/api/rag-window.js +46 -0
- package/dist-lib/lib/api/rag.d.ts +3 -2
- package/dist-lib/lib/api/rag.js +421 -181
- package/dist-lib/lib/api/served.js +8 -14
- package/dist-lib/lib/api/workspace.d.ts +8 -1
- package/dist-lib/lib/api/workspace.js +27 -13
- package/dist-lib/lib/assistant/harness.d.ts +9 -1
- package/dist-lib/lib/assistant/history.d.ts +11 -2
- package/dist-lib/lib/assistant/history.js +74 -4
- package/dist-lib/lib/assistant/media-round.d.ts +61 -0
- package/dist-lib/lib/assistant/media-round.js +111 -0
- package/dist-lib/lib/assistant/message.d.ts +7 -0
- package/dist-lib/lib/assistant/model-round.d.ts +12 -0
- package/dist-lib/lib/assistant/model-round.js +130 -17
- package/dist-lib/lib/assistant/pdf-pages.d.ts +16 -1
- package/dist-lib/lib/assistant/pdf-pages.js +67 -3
- package/dist-lib/lib/assistant/round-host.d.ts +22 -0
- package/dist-lib/lib/assistant/round-host.js +142 -8
- package/dist-lib/lib/assistant/upload.d.ts +12 -0
- package/dist-lib/lib/assistant/upload.js +36 -0
- package/dist-lib/lib/assistant-client.d.ts +1 -0
- package/dist-lib/lib/assistant-client.js +40 -19
- package/dist-lib/lib/assistant-tree.d.ts +2 -0
- package/dist-lib/lib/assistant-tree.js +41 -1
- package/dist-lib/lib/assistant.d.ts +15 -0
- package/dist-lib/lib/assistant.js +474 -89
- package/dist-lib/lib/client.d.ts +1 -0
- package/dist-lib/lib/client.js +4 -1
- package/dist-lib/lib/compaction.js +2 -2
- package/dist-lib/lib/core/agent.js +12 -45
- package/dist-lib/lib/core/approval-rules.js +1 -8
- package/dist-lib/lib/core/archived-mesh.d.ts +2 -1
- package/dist-lib/lib/core/archived-mesh.js +12 -8
- package/dist-lib/lib/core/chat-copy.d.ts +18 -3
- package/dist-lib/lib/core/chat-copy.js +74 -25
- package/dist-lib/lib/core/chat-fork.js +15 -6
- package/dist-lib/lib/core/chat-group.js +16 -24
- package/dist-lib/lib/core/chat-move.d.ts +9 -0
- package/dist-lib/lib/core/chat-move.js +94 -3
- package/dist-lib/lib/core/chat-order.js +12 -18
- package/dist-lib/lib/core/chat.js +38 -31
- package/dist-lib/lib/core/chunk.d.ts +2 -2
- package/dist-lib/lib/core/chunk.js +18 -25
- package/dist-lib/lib/core/collections.d.ts +2 -0
- package/dist-lib/lib/core/collections.js +2 -0
- package/dist-lib/lib/core/contract/activity.d.ts +4 -0
- package/dist-lib/lib/core/contract/activity.js +34 -4
- package/dist-lib/lib/core/contract/chat-group.d.ts +1 -0
- package/dist-lib/lib/core/contract/chat-group.js +21 -1
- package/dist-lib/lib/core/contract/chat.d.ts +9 -0
- package/dist-lib/lib/core/contract/chat.js +127 -5
- package/dist-lib/lib/core/contract/chunks.d.ts +1 -0
- package/dist-lib/lib/core/contract/chunks.js +37 -6
- package/dist-lib/lib/core/contract/features.d.ts +21 -0
- package/dist-lib/lib/core/contract/features.js +22 -0
- package/dist-lib/lib/core/contract/index.js +2 -0
- package/dist-lib/lib/core/contract/indexing.js +4 -2
- package/dist-lib/lib/core/contract/knowledge.js +5 -4
- package/dist-lib/lib/core/contract/members.js +16 -10
- package/dist-lib/lib/core/contract/mesh-kind.d.ts +1 -0
- package/dist-lib/lib/core/contract/mesh-kind.js +3 -1
- package/dist-lib/lib/core/contract/projects.d.ts +5 -0
- package/dist-lib/lib/core/contract/projects.js +13 -5
- package/dist-lib/lib/core/contract/roles.js +32 -4
- package/dist-lib/lib/core/contract/run-requests.d.ts +1 -0
- package/dist-lib/lib/core/contract/run-requests.js +35 -2
- package/dist-lib/lib/core/contract/seed-defaults.js +2 -2
- package/dist-lib/lib/core/contract/tool-configs.js +3 -2
- package/dist-lib/lib/core/contract/workspace.d.ts +2 -0
- package/dist-lib/lib/core/contract/workspace.js +40 -7
- package/dist-lib/lib/core/contract/writers.js +2 -2
- package/dist-lib/lib/core/departures.d.ts +3 -1
- package/dist-lib/lib/core/departures.js +3 -0
- package/dist-lib/lib/core/devices.js +1 -8
- package/dist-lib/lib/core/files/attachments.d.ts +2 -0
- package/dist-lib/lib/core/files/attachments.js +19 -1
- package/dist-lib/lib/core/files/index.d.ts +20 -4
- package/dist-lib/lib/core/files/index.js +132 -21
- package/dist-lib/lib/core/files/processing/document.d.ts +4 -0
- package/dist-lib/lib/core/files/processing/document.js +7 -0
- package/dist-lib/lib/core/files/processing/index.d.ts +13 -0
- package/dist-lib/lib/core/files/processing/index.js +144 -12
- package/dist-lib/lib/core/files/processing/protocol.js +13 -34
- package/dist-lib/lib/core/files/processing/state.d.ts +2 -0
- package/dist-lib/lib/core/files/rag/build.d.ts +19 -2
- package/dist-lib/lib/core/files/rag/build.js +123 -19
- package/dist-lib/lib/core/files/rag/failure.js +2 -1
- package/dist-lib/lib/core/files/rag/index.d.ts +11 -3
- package/dist-lib/lib/core/files/rag/index.js +13 -1
- package/dist-lib/lib/core/files/rag/load.d.ts +6 -3
- package/dist-lib/lib/core/files/rag/load.js +27 -6
- package/dist-lib/lib/core/files/rag/plugin-index.d.ts +32 -0
- package/dist-lib/lib/core/files/rag/plugin-index.js +127 -0
- package/dist-lib/lib/core/files/rag/produce.d.ts +5 -3
- package/dist-lib/lib/core/files/rag/produce.js +104 -16
- package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +3 -1
- package/dist-lib/lib/core/files/rag/retrieval/full-text.js +62 -13
- package/dist-lib/lib/core/files/rag/text-cache.d.ts +28 -0
- package/dist-lib/lib/core/files/rag/text-cache.js +141 -0
- package/dist-lib/lib/core/files/records/knowledge.d.ts +1 -3
- package/dist-lib/lib/core/files/records/knowledge.js +7 -40
- package/dist-lib/lib/core/files/records/reclaim.js +5 -10
- package/dist-lib/lib/core/files/upload.js +68 -41
- package/dist-lib/lib/core/fs-drives.js +14 -26
- package/dist-lib/lib/core/invite.d.ts +1 -0
- package/dist-lib/lib/core/invite.js +4 -2
- package/dist-lib/lib/core/local/files.d.ts +1 -1
- package/dist-lib/lib/core/local/files.js +5 -5
- package/dist-lib/lib/core/local/index.d.ts +13 -6
- package/dist-lib/lib/core/local/index.js +103 -69
- package/dist-lib/lib/core/local/run-logs.d.ts +1 -1
- package/dist-lib/lib/core/local/run-logs.js +5 -5
- package/dist-lib/lib/core/mesh-processor.d.ts +19 -0
- package/dist-lib/lib/core/mesh-processor.js +87 -0
- package/dist-lib/lib/core/mesh.d.ts +48 -5
- package/dist-lib/lib/core/mesh.js +318 -129
- package/dist-lib/lib/core/migrations/agent-catalog.js +2 -8
- package/dist-lib/lib/core/migrations/agent-tools-scope.js +5 -11
- package/dist-lib/lib/core/migrations/workspace-from-0-21/index.d.ts +88 -0
- package/dist-lib/lib/core/migrations/workspace-from-0-21/index.js +731 -0
- package/dist-lib/lib/core/migrations/writer-links.d.ts +2 -0
- package/dist-lib/lib/core/migrations/writer-links.js +32 -0
- package/dist-lib/lib/core/project-keys.d.ts +6 -0
- package/dist-lib/lib/core/project-keys.js +11 -0
- package/dist-lib/lib/core/public-mesh.d.ts +3 -0
- package/dist-lib/lib/core/public-mesh.js +10 -8
- package/dist-lib/lib/core/run-requests.d.ts +3 -0
- package/dist-lib/lib/core/run-requests.js +21 -1
- package/dist-lib/lib/core/skill-availability.d.ts +33 -0
- package/dist-lib/lib/core/skill-availability.js +67 -0
- package/dist-lib/lib/core/sync/background.d.ts +0 -1
- package/dist-lib/lib/core/sync/background.js +2 -1
- package/dist-lib/lib/core/sync/changed.d.ts +4 -2
- package/dist-lib/lib/core/sync/changed.js +1 -1
- package/dist-lib/lib/core/sync/index.js +52 -10
- package/dist-lib/lib/core/sync/view-updates.d.ts +18 -12
- package/dist-lib/lib/core/sync/view-updates.js +82 -91
- package/dist-lib/lib/core/sync-status.js +97 -41
- package/dist-lib/lib/core/tool-activity.js +6 -12
- package/dist-lib/lib/core/tool-configs.js +17 -29
- package/dist-lib/lib/core/upgrade-summary.d.ts +19 -0
- package/dist-lib/lib/core/upgrade-summary.js +67 -0
- package/dist-lib/lib/core/view-read.d.ts +4 -0
- package/dist-lib/lib/core/view-read.js +23 -0
- package/dist-lib/lib/core/workspace-upgrade.d.ts +7 -0
- package/dist-lib/lib/core/workspace-upgrade.js +27 -16
- package/dist-lib/lib/core.d.ts +39 -42
- package/dist-lib/lib/core.js +661 -639
- package/dist-lib/lib/errors.d.ts +20 -0
- package/dist-lib/lib/errors.js +20 -0
- package/dist-lib/lib/llm-model-names.d.ts +1 -1
- package/dist-lib/lib/llm-model-names.js +1 -1
- package/dist-lib/lib/mesh-scoped-engine.js +4 -0
- package/dist-lib/lib/model-context.js +1 -2
- package/dist-lib/lib/probe-rounds.d.ts +7 -2
- package/dist-lib/lib/probe-rounds.js +6 -1
- package/dist-lib/lib/run-transcript.d.ts +4 -1
- package/dist-lib/lib/run-transcript.js +15 -6
- package/dist-lib/schema/engine.js +83 -6
- package/dist-lib/schema/indexes.d.ts +3 -0
- package/dist-lib/schema/indexes.js +5 -0
- package/dist-lib/schema/local.js +11 -2
- package/dist-lib/schema/qvac.js +49 -5
- package/dist-lib/spec/bind.js +34 -0
- package/dist-lib/spec/calls.js +5 -0
- package/dist-lib/spec/capabilities.d.ts +17 -0
- package/dist-lib/spec/hrpc/hrpc.json +65 -0
- package/dist-lib/spec/hrpc/index.js +68 -5
- package/dist-lib/spec/hrpc/messages.js +260 -23
- package/dist-lib/spec/hyperschema/index.js +260 -23
- package/dist-lib/spec/hyperschema/schema.json +181 -0
- package/dist-lib/spec/hyperschema/types.d.ts +48 -0
- package/dist-lib/spec/local/hyperdb/messages.js +270 -224
- package/dist-lib/spec/local/hyperschema/index.js +73 -38
- package/dist-lib/spec/local/hyperschema/schema.json +31 -0
- package/dist-lib/spec/local/hyperschema/types.d.ts +8 -0
- package/dist-lib/spec/mesh/hyperdb/db.json +39 -2
- package/dist-lib/spec/mesh/hyperdb/index.js +120 -3
- package/dist-lib/spec/mesh/hyperdb/messages.js +1328 -838
- package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +30 -0
- package/dist-lib/spec/mesh/hyperdispatch/index.js +86 -1
- package/dist-lib/spec/mesh/hyperdispatch/messages.js +682 -287
- package/dist-lib/spec/mesh/hyperschema/index.js +682 -287
- package/dist-lib/spec/mesh/hyperschema/schema.json +201 -0
- package/dist-lib/spec/mesh/hyperschema/types.d.ts +52 -0
- package/package.json +75 -70
- package/tui/README.md +2 -1
- package/tui/app.mjs +28 -7
- package/tui/boot.mjs +5 -1
- package/tui/lib/attachment-files.mjs +82 -0
- package/tui/lib/reopen-meshes.mjs +15 -0
- package/tui/main.mjs +4 -43
- package/worker/assistant-sidecar.mjs +10 -3
- package/worker/stow-entry.mjs +3 -52
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
|
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;
|