@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.
Files changed (146) hide show
  1. package/CHANGELOG.md +211 -1
  2. package/README.md +2 -0
  3. package/dist-lib/lib/api/app-config.d.ts +3 -1
  4. package/dist-lib/lib/api/app-config.js +15 -4
  5. package/dist-lib/lib/api/chat.d.ts +1 -1
  6. package/dist-lib/lib/api/chat.js +9 -0
  7. package/dist-lib/lib/api/index.d.ts +2 -1
  8. package/dist-lib/lib/api/index.js +2 -1
  9. package/dist-lib/lib/api/network.d.ts +8 -1
  10. package/dist-lib/lib/api/network.js +6 -0
  11. package/dist-lib/lib/assistant/fake-models.d.ts +22 -0
  12. package/dist-lib/lib/assistant/fake-models.js +112 -0
  13. package/dist-lib/lib/assistant/harness.d.ts +12 -0
  14. package/dist-lib/lib/assistant/harness.js +26 -0
  15. package/dist-lib/lib/assistant/history.d.ts +5 -1
  16. package/dist-lib/lib/assistant/history.js +14 -2
  17. package/dist-lib/lib/assistant-tree.d.ts +4 -0
  18. package/dist-lib/lib/assistant-tree.js +45 -7
  19. package/dist-lib/lib/assistant.d.ts +15 -2
  20. package/dist-lib/lib/assistant.js +181 -42
  21. package/dist-lib/lib/constants.d.ts +6 -0
  22. package/dist-lib/lib/constants.js +6 -0
  23. package/dist-lib/lib/core/agent.d.ts +2 -0
  24. package/dist-lib/lib/core/agent.js +16 -5
  25. package/dist-lib/lib/core/blind-peers.d.ts +4 -0
  26. package/dist-lib/lib/core/blind-peers.js +1 -0
  27. package/dist-lib/lib/core/chat-activity.d.ts +1 -1
  28. package/dist-lib/lib/core/chat-activity.js +3 -0
  29. package/dist-lib/lib/core/chat-copy.d.ts +4 -0
  30. package/dist-lib/lib/core/chat-copy.js +1 -1
  31. package/dist-lib/lib/core/chat-fork.d.ts +21 -0
  32. package/dist-lib/lib/core/chat-fork.js +245 -0
  33. package/dist-lib/lib/core/chat-move.js +1 -4
  34. package/dist-lib/lib/core/chat.d.ts +1 -0
  35. package/dist-lib/lib/core/chat.js +1 -1
  36. package/dist-lib/lib/core/collections.d.ts +1 -0
  37. package/dist-lib/lib/core/collections.js +1 -0
  38. package/dist-lib/lib/core/contract/compute.d.ts +1 -1
  39. package/dist-lib/lib/core/contract/compute.js +2 -1
  40. package/dist-lib/lib/core/contract/index.js +6 -1
  41. package/dist-lib/lib/core/contract/invites.d.ts +1 -11
  42. package/dist-lib/lib/core/contract/invites.js +3 -3
  43. package/dist-lib/lib/core/contract/mesh-seeds.d.ts +2 -0
  44. package/dist-lib/lib/core/contract/mesh-seeds.js +26 -0
  45. package/dist-lib/lib/core/contract/open-join.d.ts +2 -0
  46. package/dist-lib/lib/core/contract/open-join.js +57 -0
  47. package/dist-lib/lib/core/departures.d.ts +8 -1
  48. package/dist-lib/lib/core/departures.js +59 -2
  49. package/dist-lib/lib/core/fs-drives.d.ts +8 -1
  50. package/dist-lib/lib/core/fs-drives.js +47 -15
  51. package/dist-lib/lib/core/harness-loan.d.ts +4 -20
  52. package/dist-lib/lib/core/harness-loan.js +7 -184
  53. package/dist-lib/lib/core/id.d.ts +1 -0
  54. package/dist-lib/lib/core/id.js +3 -0
  55. package/dist-lib/lib/core/identity.d.ts +1 -1
  56. package/dist-lib/lib/core/identity.js +6 -4
  57. package/dist-lib/lib/core/invite.d.ts +2 -0
  58. package/dist-lib/lib/core/invite.js +6 -2
  59. package/dist-lib/lib/core/membership.d.ts +1 -12
  60. package/dist-lib/lib/core/membership.js +1 -94
  61. package/dist-lib/lib/core/mesh.d.ts +11 -15
  62. package/dist-lib/lib/core/mesh.js +52 -88
  63. package/dist-lib/lib/core/migrations/agent-tools-scope.d.ts +2 -0
  64. package/dist-lib/lib/core/migrations/agent-tools-scope.js +24 -0
  65. package/dist-lib/lib/core/migrations/index.js +3 -1
  66. package/dist-lib/lib/core/peer-duplex.d.ts +32 -0
  67. package/dist-lib/lib/core/peer-duplex.js +207 -0
  68. package/dist-lib/lib/core/sync/index.js +2 -16
  69. package/dist-lib/lib/core.d.ts +47 -50
  70. package/dist-lib/lib/core.js +524 -878
  71. package/dist-lib/lib/diagnostics.d.ts +7 -0
  72. package/dist-lib/lib/diagnostics.js +22 -0
  73. package/dist-lib/lib/doctor/checks.d.ts +15 -0
  74. package/dist-lib/lib/doctor/checks.js +272 -0
  75. package/dist-lib/lib/doctor/redact.d.ts +4 -0
  76. package/dist-lib/lib/doctor/redact.js +31 -0
  77. package/dist-lib/lib/doctor/render.d.ts +8 -0
  78. package/dist-lib/lib/doctor/render.js +83 -0
  79. package/dist-lib/lib/doctor/tree.d.ts +5 -0
  80. package/dist-lib/lib/doctor/tree.js +167 -0
  81. package/dist-lib/lib/downloads-allowed-pusher.d.ts +10 -0
  82. package/dist-lib/lib/downloads-allowed-pusher.js +37 -0
  83. package/dist-lib/lib/guards.d.ts +1 -0
  84. package/dist-lib/lib/guards.js +4 -0
  85. package/dist-lib/lib/inference-calls.js +1 -5
  86. package/dist-lib/lib/kv-cache-reclaim.d.ts +2 -1
  87. package/dist-lib/lib/kv-cache-reclaim.js +24 -0
  88. package/dist-lib/lib/mesh-scoped-engine.js +4 -0
  89. package/dist-lib/lib/model-download-status.d.ts +1 -1
  90. package/dist-lib/lib/model-download.d.ts +9 -10
  91. package/dist-lib/lib/model-download.js +49 -16
  92. package/dist-lib/lib/model-memory-cap.d.ts +29 -0
  93. package/dist-lib/lib/model-memory-cap.js +69 -0
  94. package/dist-lib/lib/models-watch.d.ts +1 -1
  95. package/dist-lib/lib/models-watch.js +4 -4
  96. package/dist-lib/lib/oauth/flow.js +1 -1
  97. package/dist-lib/lib/oauth/loopback.js +16 -2
  98. package/dist-lib/lib/oauth/redirect-types.d.ts +1 -0
  99. package/dist-lib/lib/run-replay.d.ts +26 -0
  100. package/dist-lib/lib/run-replay.js +107 -0
  101. package/dist-lib/schema/config.d.ts +1 -1
  102. package/dist-lib/schema/config.js +1 -1
  103. package/dist-lib/schema/content.js +9 -1
  104. package/dist-lib/schema/engine.js +75 -6
  105. package/dist-lib/schema/field-order.js +1 -1
  106. package/dist-lib/schema/local.js +3 -2
  107. package/dist-lib/schema/qvac.js +28 -2
  108. package/dist-lib/spec/bind.js +17 -0
  109. package/dist-lib/spec/calls.js +4 -0
  110. package/dist-lib/spec/capabilities.d.ts +8 -0
  111. package/dist-lib/spec/config/hyperconf/index.js +1 -1
  112. package/dist-lib/spec/hrpc/hrpc.json +52 -0
  113. package/dist-lib/spec/hrpc/index.js +53 -4
  114. package/dist-lib/spec/hrpc/messages.js +1498 -1278
  115. package/dist-lib/spec/hyperschema/index.js +1498 -1278
  116. package/dist-lib/spec/hyperschema/schema.json +182 -0
  117. package/dist-lib/spec/hyperschema/types.d.ts +49 -3
  118. package/dist-lib/spec/local/hyperdb/messages.js +22 -10
  119. package/dist-lib/spec/local/hyperschema/index.js +16 -7
  120. package/dist-lib/spec/local/hyperschema/schema.json +10 -1
  121. package/dist-lib/spec/local/hyperschema/types.d.ts +3 -2
  122. package/dist-lib/spec/mesh/hyperdb/db.json +16 -1
  123. package/dist-lib/spec/mesh/hyperdb/index.js +71 -2
  124. package/dist-lib/spec/mesh/hyperdb/messages.js +530 -246
  125. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +13 -1
  126. package/dist-lib/spec/mesh/hyperdispatch/index.js +35 -1
  127. package/dist-lib/spec/mesh/hyperdispatch/messages.js +223 -10
  128. package/dist-lib/spec/mesh/hyperschema/index.js +223 -10
  129. package/dist-lib/spec/mesh/hyperschema/schema.json +128 -1
  130. package/dist-lib/spec/mesh/hyperschema/types.d.ts +34 -2
  131. package/package.json +14 -19
  132. package/tui/README.md +7 -1
  133. package/tui/app.mjs +366 -78
  134. package/tui/boot.mjs +1 -0
  135. package/tui/index.mjs +1 -0
  136. package/tui/lib/fork-command.mjs +43 -0
  137. package/tui/lib/render.mjs +25 -1
  138. package/worker/assistant-sidecar.mjs +5 -2
  139. package/dist-lib/lib/core/device-invites.d.ts +0 -11
  140. package/dist-lib/lib/core/device-invites.js +0 -63
  141. package/dist-lib/lib/core/grant-expiry.d.ts +0 -11
  142. package/dist-lib/lib/core/grant-expiry.js +0 -66
  143. package/dist-lib/lib/core/mesh-seed-handoff.d.ts +0 -27
  144. package/dist-lib/lib/core/mesh-seed-handoff.js +0 -53
  145. package/dist-lib/lib/oauth/loopback.stub.d.ts +0 -3
  146. package/dist-lib/lib/oauth/loopback.stub.js +0 -6
@@ -0,0 +1,107 @@
1
+ import fs from 'fs';
2
+ import { join } from 'path';
3
+ import { persistent } from 'bare-storage';
4
+ import { isRecord, safeName } from './guards.js';
5
+ export const LOCAL_HOLDER = 'local';
6
+ export class RunReplayStore {
7
+ _dir;
8
+ constructor(dir = defaultRunReplayDir()) {
9
+ this._dir = dir;
10
+ }
11
+ async started() {
12
+ try {
13
+ await fs.promises.stat(this._dir);
14
+ return true;
15
+ }
16
+ catch {
17
+ return false;
18
+ }
19
+ }
20
+ async start() {
21
+ await fs.promises.mkdir(this._dir, { recursive: true });
22
+ }
23
+ async load({ holder, chatId }) {
24
+ const chatDir = this._chatDir(holder, chatId);
25
+ const runs = new Map();
26
+ let names;
27
+ try {
28
+ names = await fs.promises.readdir(chatDir);
29
+ }
30
+ catch {
31
+ return runs;
32
+ }
33
+ for (const name of names) {
34
+ if (!name.endsWith('.json'))
35
+ continue;
36
+ const parsed = JSON.parse(await fs.promises.readFile(join(chatDir, name), 'utf8'));
37
+ if (isRecord(parsed) && typeof parsed.runId === 'string' && Array.isArray(parsed.messages)) {
38
+ runs.set(parsed.runId, parsed.messages.filter(isChatMessage));
39
+ }
40
+ }
41
+ return runs;
42
+ }
43
+ async save({ holder, chatId }, runId, messages) {
44
+ const chatDir = this._chatDir(holder, chatId);
45
+ await fs.promises.mkdir(chatDir, { recursive: true });
46
+ await fs.promises.writeFile(join(chatDir, `${safeName(runId)}.json`), JSON.stringify({ runId, messages }));
47
+ }
48
+ async forget(chatId, holder) {
49
+ const holders = holder === undefined ? await this._holders() : [holder];
50
+ for (const each of holders) {
51
+ await fs.promises.rm(this._chatDir(each, chatId), { recursive: true, force: true });
52
+ }
53
+ }
54
+ async clear(holder) {
55
+ await fs.promises.rm(join(this._dir, safeName(holder)), { recursive: true, force: true });
56
+ }
57
+ _chatDir(holder, chatId) {
58
+ return join(this._dir, safeName(holder), safeName(chatId));
59
+ }
60
+ async _holders() {
61
+ try {
62
+ return await fs.promises.readdir(this._dir);
63
+ }
64
+ catch {
65
+ return [];
66
+ }
67
+ }
68
+ }
69
+ export function trackSentRun(cacheKey) {
70
+ let used = false;
71
+ let last = null;
72
+ return {
73
+ get used() {
74
+ return used;
75
+ },
76
+ observe(call) {
77
+ if (cacheKey && call.cacheKey === cacheKey) {
78
+ used = true;
79
+ last = call.droppedTurns ? null : call.messages;
80
+ }
81
+ else if (used) {
82
+ last = null;
83
+ }
84
+ },
85
+ turns: (inputLength) => appendedTurns(last, inputLength)
86
+ };
87
+ }
88
+ export function appendedTurns(sent, inputLength) {
89
+ if (!Array.isArray(sent))
90
+ return null;
91
+ const offset = (isRecord(sent[0]) && sent[0].role === 'system' ? 1 : 0) + inputLength;
92
+ if (sent.length < offset) {
93
+ return null;
94
+ }
95
+ const turns = sent
96
+ .slice(offset)
97
+ .map((turn) => (isRecord(turn) ? { role: turn.role, content: turn.content } : null));
98
+ return turns.every(isChatMessage) ? turns : null;
99
+ }
100
+ export function defaultRunReplayDir() {
101
+ return join(persistent(), 'qvac', 'run-replay');
102
+ }
103
+ function isChatMessage(value) {
104
+ return (isRecord(value) &&
105
+ (value.role === 'user' || value.role === 'assistant' || value.role === 'tool') &&
106
+ typeof value.content === 'string');
107
+ }
@@ -1,3 +1,3 @@
1
1
  import type { Registry } from './content.ts';
2
2
  export declare function registerConfigTypes(ns: Registry): void;
3
- export declare const VENDORED_MIN_SUPPORTED_VERSION = ">=0.19.0";
3
+ export declare const VENDORED_MIN_SUPPORTED_VERSION = ">=0.19.1";
@@ -4,4 +4,4 @@ export function registerConfigTypes(ns) {
4
4
  fields: [{ name: 'minSupportedVersion', type: 'string', required: true }]
5
5
  });
6
6
  }
7
- export const VENDORED_MIN_SUPPORTED_VERSION = '>=0.19.0';
7
+ export const VENDORED_MIN_SUPPORTED_VERSION = '>=0.19.1';
@@ -53,7 +53,15 @@ export function registerContentTypes(ns, namespace) {
53
53
  });
54
54
  ns.register({
55
55
  name: 'progress-phase',
56
- enum: ['loading', 'downloading', 'queued', 'generating', 'transcribing', 'compacting'],
56
+ enum: [
57
+ 'loading',
58
+ 'downloading',
59
+ 'queued',
60
+ 'generating',
61
+ 'transcribing',
62
+ 'compacting',
63
+ 'awaiting-download'
64
+ ],
57
65
  strings: true
58
66
  });
59
67
  ns.register({
@@ -193,6 +193,14 @@ export function registerEngineTypes(ns) {
193
193
  { name: 'config', type: '@assistant/agent-update-config', required: true }
194
194
  ]
195
195
  });
196
+ ns.register({
197
+ name: 'chat-fork-source',
198
+ fields: [
199
+ { name: 'meshId', type: 'string', required: true },
200
+ { name: 'chatId', type: 'string', required: true },
201
+ { name: 'runId', type: 'string' }
202
+ ]
203
+ });
196
204
  ns.register({
197
205
  name: 'chat',
198
206
  fields: [
@@ -206,7 +214,8 @@ export function registerEngineTypes(ns) {
206
214
  { name: 'updatedAt', type: 'uint' },
207
215
  { name: 'lastActivityAt', type: 'uint' },
208
216
  { name: 'groupId', type: 'string' },
209
- { name: 'readThrough', type: 'uint' }
217
+ { name: 'readThrough', type: 'uint' },
218
+ { name: 'forkedFrom', type: '@assistant/chat-fork-source' }
210
219
  ]
211
220
  });
212
221
  ns.register({
@@ -247,7 +256,8 @@ export function registerEngineTypes(ns) {
247
256
  'generating-image',
248
257
  'generating-audio',
249
258
  'transcribing-audio',
250
- 'awaiting-approval'
259
+ 'awaiting-approval',
260
+ 'awaiting-download'
251
261
  ],
252
262
  strings: true
253
263
  });
@@ -352,6 +362,22 @@ export function registerEngineTypes(ns) {
352
362
  { name: 'failure', type: 'string' }
353
363
  ]
354
364
  });
365
+ ns.register({
366
+ name: 'fork-chat-config',
367
+ fields: [{ name: 'title', type: 'string' }]
368
+ });
369
+ ns.register({
370
+ name: 'fork-chat-request',
371
+ fields: [
372
+ { name: 'chatId', type: 'string', required: true },
373
+ { name: 'meshId', type: 'string', required: true },
374
+ { name: 'runId', type: 'string' },
375
+ { name: 'exclusive', type: 'bool' },
376
+ { name: 'targetMeshId', type: 'string' },
377
+ { name: 'agentId', type: 'string' },
378
+ { name: 'config', type: '@assistant/fork-chat-config' }
379
+ ]
380
+ });
355
381
  ns.register({
356
382
  name: 'set-chat-agent-request',
357
383
  fields: [
@@ -921,6 +947,10 @@ export function registerEngineTypes(ns) {
921
947
  { name: 'peerCount', type: 'uint', required: true }
922
948
  ]
923
949
  });
950
+ ns.register({
951
+ name: 'blind-peering',
952
+ fields: [{ name: 'enabled', type: 'bool', required: true }]
953
+ });
924
954
  ns.register({
925
955
  name: 'sync-status-state',
926
956
  enum: ['idle', 'syncing', 'synced'],
@@ -980,12 +1010,16 @@ export function registerEngineTypes(ns) {
980
1010
  { name: 'actualSize', type: 'uint' },
981
1011
  { name: 'supportsImages', type: 'bool' },
982
1012
  { name: 'taskType', type: '@assistant/model-task-type' },
983
- { name: 'isLoading', type: 'bool' }
1013
+ { name: 'isLoading', type: 'bool' },
1014
+ { name: 'memoryBytes', type: 'uint' }
984
1015
  ]
985
1016
  });
986
1017
  ns.register({
987
1018
  name: 'model-info-list',
988
- fields: [{ name: 'models', type: '@assistant/model-info', array: true }]
1019
+ fields: [
1020
+ { name: 'models', type: '@assistant/model-info', array: true },
1021
+ { name: 'memory', type: '@assistant/model-memory' }
1022
+ ]
989
1023
  });
990
1024
  ns.register({
991
1025
  name: 'delete-model-request',
@@ -1073,7 +1107,8 @@ export function registerEngineTypes(ns) {
1073
1107
  { name: 'onboardingCompleted', type: 'bool', required: true },
1074
1108
  { name: 'delegation', type: '@assistant/delegation', required: true },
1075
1109
  { name: 'pausedModels', type: 'string', array: true },
1076
- { name: 'releasedModels', type: 'string', array: true }
1110
+ { name: 'releasedModels', type: 'string', array: true },
1111
+ { name: 'autoDownloadModels', type: 'bool', required: true }
1077
1112
  ]
1078
1113
  });
1079
1114
  ns.register({
@@ -1101,9 +1136,13 @@ export function registerEngineTypes(ns) {
1101
1136
  { name: 'released', type: 'bool', required: true }
1102
1137
  ]
1103
1138
  });
1139
+ ns.register({
1140
+ name: 'set-auto-download-models-request',
1141
+ fields: [{ name: 'enabled', type: 'bool', required: true }]
1142
+ });
1104
1143
  ns.register({
1105
1144
  name: 'model-download-phase',
1106
- enum: ['queued', 'downloading', 'paused', 'error'],
1145
+ enum: ['queued', 'downloading', 'paused', 'error', 'held'],
1107
1146
  strings: true
1108
1147
  });
1109
1148
  ns.register({
@@ -2074,6 +2113,16 @@ export function registerEngineTypes(ns) {
2074
2113
  { name: 'count', type: 'uint', required: true }
2075
2114
  ]
2076
2115
  });
2116
+ ns.register({
2117
+ name: 'model-memory',
2118
+ fields: [
2119
+ { name: 'usableBytes', type: 'uint', required: true },
2120
+ { name: 'capPercent', type: 'uint', required: true },
2121
+ { name: 'capBytes', type: 'uint', required: true },
2122
+ { name: 'usedBytes', type: 'uint', required: true },
2123
+ { name: 'overCap', type: 'bool', required: true }
2124
+ ]
2125
+ });
2077
2126
  }
2078
2127
  export function registerEngineApi(api) {
2079
2128
  api.register({
@@ -2861,4 +2910,24 @@ export function registerEngineApi(api) {
2861
2910
  request: { name: '@assistant/chunks-by-chat-request', stream: false },
2862
2911
  response: { name: '@assistant/chunk-delta', stream: true }
2863
2912
  });
2913
+ api.register({
2914
+ name: 'set-auto-download-models',
2915
+ request: { name: '@assistant/set-auto-download-models-request', stream: false },
2916
+ response: { name: '@assistant/app-config', stream: false }
2917
+ });
2918
+ api.register({
2919
+ name: 'fork-chat',
2920
+ request: { name: '@assistant/fork-chat-request', stream: false },
2921
+ response: { name: '@assistant/chat', stream: false }
2922
+ });
2923
+ api.register({
2924
+ name: 'set-blind-peering',
2925
+ request: { name: '@assistant/blind-peering', stream: false },
2926
+ response: { name: '@assistant/blind-peering', stream: false }
2927
+ });
2928
+ api.register({
2929
+ name: 'blind-peering-watch',
2930
+ request: { name: '@assistant/empty', stream: false },
2931
+ response: { name: '@assistant/blind-peering', stream: true }
2932
+ });
2864
2933
  }
@@ -1,7 +1,7 @@
1
1
  import fs from 'bare-fs';
2
2
  import { spawnSync } from 'bare-subprocess';
3
3
  const EXEMPT = {
4
- '@qvac/seed-defaults-operation-v1.chat': 'seedableChat (lib/core/helpers/index.ts) allowlists the seed chat and leaves readThrough off it'
4
+ '@qvac/seed-defaults-operation-v1.chat': 'seedableChat (lib/core/helpers/index.ts) allowlists the seed chat and leaves readThrough and forkedFrom off it'
5
5
  };
6
6
  export function assertFieldOrder(root, schemaFile, tags) {
7
7
  const current = index(JSON.parse(fs.readFileSync(schemaFile, 'utf8')).schema);
@@ -39,11 +39,12 @@ export function registerLocalTypes(ns) {
39
39
  { name: 'onboardingCompleted', type: 'bool' },
40
40
  { name: 'delegation', type: 'json' },
41
41
  { name: 'pausedModels', type: 'string', array: true },
42
- { name: 'releasedModels', type: 'string', array: true }
42
+ { name: 'releasedModels', type: 'string', array: true },
43
+ { name: 'manualModelDownloads', type: 'bool' }
43
44
  ]);
44
45
  ns.register({
45
46
  name: 'model-download-phase',
46
- enum: ['queued', 'downloading', 'paused', 'error'],
47
+ enum: ['queued', 'downloading', 'paused', 'error', 'held'],
47
48
  strings: true
48
49
  });
49
50
  versioned('model-download', [
@@ -184,6 +184,14 @@ export function registerQvacTypes(ns) {
184
184
  { name: 'disabledToolsets', type: 'string', array: true },
185
185
  { name: 'lenderDeviceId', type: 'fixed32' }
186
186
  ]);
187
+ ns.register({
188
+ name: 'chat-fork-source',
189
+ fields: [
190
+ { name: 'meshId', type: 'string', required: true },
191
+ { name: 'chatId', type: 'string', required: true },
192
+ { name: 'runId', type: 'string' }
193
+ ]
194
+ });
187
195
  versioned('chat', [
188
196
  { name: 'id', type: 'string', required: true },
189
197
  { name: 'agentId', type: 'string', required: true },
@@ -196,7 +204,8 @@ export function registerQvacTypes(ns) {
196
204
  { name: 'groupId', type: 'string' },
197
205
  { name: 'rank', type: 'float64' },
198
206
  { name: 'rankedAt', type: 'uint' },
199
- { name: 'readThrough', type: 'uint' }
207
+ { name: 'readThrough', type: 'uint' },
208
+ { name: 'forkedFrom', type: '@qvac/chat-fork-source' }
200
209
  ]);
201
210
  ns.register({
202
211
  name: 'tool-report-entry',
@@ -316,7 +325,9 @@ export function registerQvacTypes(ns) {
316
325
  { name: 'memberId', type: 'fixed32' },
317
326
  { name: 'inviteNonce', type: 'fixed32' },
318
327
  { name: 'compute', type: 'bool' },
319
- { name: 'inviterName', type: 'string' }
328
+ { name: 'inviterName', type: 'string' },
329
+ { name: 'deviceSeed', type: 'fixed32' },
330
+ { name: 'deviceProof', type: 'buffer' }
320
331
  ]);
321
332
  versioned('seed-defaults-operation', [
322
333
  { name: 'agent', type: '@qvac/agent', required: true },
@@ -562,6 +573,18 @@ export function registerQvacTypes(ns) {
562
573
  { name: 'name', type: 'string', required: true },
563
574
  { name: 'namedAt', type: 'uint', required: true }
564
575
  ]);
576
+ versioned('open-join', [
577
+ { name: 'signature', type: 'buffer', required: true },
578
+ { name: 'device', type: '@qvac/device' },
579
+ { name: 'deviceId', type: 'fixed32' },
580
+ { name: 'deviceSignature', type: 'buffer' },
581
+ { name: 'member', type: '@qvac/member' },
582
+ { name: 'memberClaim', type: 'buffer' }
583
+ ]);
584
+ versioned('mesh-seed', [
585
+ { name: 'meshKey', type: 'fixed32', required: true },
586
+ { name: 'seed', type: 'fixed32', required: true }
587
+ ]);
565
588
  }
566
589
  export function registerQvacCollections(dbns, helpersPath) {
567
590
  dbns.require(helpersPath);
@@ -892,6 +915,7 @@ export function registerQvacCollections(dbns, helpersPath) {
892
915
  dbns.collections.register({ name: 'mesh-founders', schema: '@qvac/mesh-founder', key: ['id'] });
893
916
  dbns.collections.register({ name: 'purged-chats', schema: '@qvac/purged-chat', key: ['chatId'] });
894
917
  dbns.collections.register({ name: 'mesh-names', schema: '@qvac/mesh-name', key: ['id'] });
918
+ dbns.collections.register({ name: 'mesh-seeds', schema: '@qvac/mesh-seed', key: ['meshKey'] });
895
919
  }
896
920
  export function registerQvacDispatch(ds) {
897
921
  ds.register({ name: 'append-chunk', requestType: '@qvac/append-chunk-operation' });
@@ -958,4 +982,6 @@ export function registerQvacDispatch(ds) {
958
982
  ds.register({ name: 'recover-device', requestType: '@qvac/recovery-claim' });
959
983
  ds.register({ name: 'purge-chat', requestType: '@qvac/purge-chat-operation' });
960
984
  ds.register({ name: 'name-mesh', requestType: '@qvac/name-mesh-operation' });
985
+ ds.register({ name: 'open-join', requestType: '@qvac/open-join' });
986
+ ds.register({ name: 'put-mesh-seed', requestType: '@qvac/mesh-seed' });
961
987
  }
@@ -673,4 +673,21 @@ export function bindApi(rpc, api) {
673
673
  out.writeStream?.on("close", () => src.destroy());
674
674
  });
675
675
  }
676
+ if (api.setAutoDownloadModels) {
677
+ rpc.onSetAutoDownloadModels((req) => api.setAutoDownloadModels(req));
678
+ }
679
+ if (api.forkChat) {
680
+ rpc.onForkChat((req) => api.forkChat(req));
681
+ }
682
+ if (api.setBlindPeering) {
683
+ rpc.onSetBlindPeering((req) => api.setBlindPeering(req));
684
+ }
685
+ if (api.blindPeeringWatch) {
686
+ rpc.onBlindPeeringWatch((out) => {
687
+ const src = Readable.from(api.blindPeeringWatch(out.data));
688
+ src.on("error", (err) => out.writeStream?.destroy(err));
689
+ pipeline(src, out, noop);
690
+ out.writeStream?.on("close", () => src.destroy());
691
+ });
692
+ }
676
693
  }
@@ -167,5 +167,9 @@ export function engineClient(rpc) {
167
167
  moveChatToMesh: (input) => rpc.moveChatToMesh(input),
168
168
  chatMoveWatch: (input) => armed(rpc.chatMoveWatch(input)),
169
169
  chunksDeltaWatch: (input) => armed(rpc.chunksDeltaWatch(input)),
170
+ setAutoDownloadModels: (input) => rpc.setAutoDownloadModels(input),
171
+ forkChat: (input) => rpc.forkChat(input),
172
+ setBlindPeering: (input) => rpc.setBlindPeering(input),
173
+ blindPeeringWatch: (input) => armed(rpc.blindPeeringWatch(input ?? {})),
170
174
  };
171
175
  }
@@ -185,6 +185,10 @@ export interface Capabilities {
185
185
  moveChatToMesh(input: T.AssistantMoveChatToMeshRequest): Promise<T.AssistantChatMove>
186
186
  chatMoveWatch(input: T.AssistantChatId): WatchStream<T.AssistantChatMove>
187
187
  chunksDeltaWatch(input: T.AssistantChunksByChatRequest): WatchStream<T.AssistantChunkDelta>
188
+ setAutoDownloadModels(input: T.AssistantSetAutoDownloadModelsRequest): Promise<T.AssistantAppConfig>
189
+ forkChat(input: T.AssistantForkChatRequest): Promise<T.AssistantChat>
190
+ setBlindPeering(input: T.AssistantBlindPeering): Promise<T.AssistantBlindPeering>
191
+ blindPeeringWatch(input?: T.AssistantEmpty): WatchStream<T.AssistantBlindPeering>
188
192
  }
189
193
 
190
194
  export interface CapabilityHandlers {
@@ -345,4 +349,8 @@ export interface CapabilityHandlers {
345
349
  moveChatToMesh(input: T.AssistantMoveChatToMeshRequest): T.AssistantChatMove | Promise<T.AssistantChatMove>
346
350
  chatMoveWatch(input: T.AssistantChatId): AsyncIterable<T.AssistantChatMove>
347
351
  chunksDeltaWatch(input: T.AssistantChunksByChatRequest): AsyncIterable<T.AssistantChunkDelta>
352
+ setAutoDownloadModels(input: T.AssistantSetAutoDownloadModelsRequest): T.AssistantAppConfig | Promise<T.AssistantAppConfig>
353
+ forkChat(input: T.AssistantForkChatRequest): T.AssistantChat | Promise<T.AssistantChat>
354
+ setBlindPeering(input: T.AssistantBlindPeering): T.AssistantBlindPeering | Promise<T.AssistantBlindPeering>
355
+ blindPeeringWatch(input?: T.AssistantEmpty): AsyncIterable<T.AssistantBlindPeering>
348
356
  }
@@ -6,7 +6,7 @@ const runtime = require('hyperconf/runtime')
6
6
  const productionEncoding = schema.getEncoding('@conf/config')
7
7
  const production = decode(
8
8
  productionEncoding,
9
- runtime.b4a.from('CD49MC4xOS4w', 'base64')
9
+ runtime.b4a.from('CD49MC4xOS4x', 'base64')
10
10
  )
11
11
 
12
12
  const developmentEncoding = null
@@ -2041,6 +2041,58 @@
2041
2041
  "stream": true
2042
2042
  },
2043
2043
  "version": 1
2044
+ },
2045
+ {
2046
+ "id": 157,
2047
+ "name": "@assistant/set-auto-download-models",
2048
+ "request": {
2049
+ "name": "@assistant/set-auto-download-models-request",
2050
+ "stream": false
2051
+ },
2052
+ "response": {
2053
+ "name": "@assistant/app-config",
2054
+ "stream": false
2055
+ },
2056
+ "version": 1
2057
+ },
2058
+ {
2059
+ "id": 158,
2060
+ "name": "@assistant/fork-chat",
2061
+ "request": {
2062
+ "name": "@assistant/fork-chat-request",
2063
+ "stream": false
2064
+ },
2065
+ "response": {
2066
+ "name": "@assistant/chat",
2067
+ "stream": false
2068
+ },
2069
+ "version": 1
2070
+ },
2071
+ {
2072
+ "id": 159,
2073
+ "name": "@assistant/set-blind-peering",
2074
+ "request": {
2075
+ "name": "@assistant/blind-peering",
2076
+ "stream": false
2077
+ },
2078
+ "response": {
2079
+ "name": "@assistant/blind-peering",
2080
+ "stream": false
2081
+ },
2082
+ "version": 1
2083
+ },
2084
+ {
2085
+ "id": 160,
2086
+ "name": "@assistant/blind-peering-watch",
2087
+ "request": {
2088
+ "name": "@assistant/empty",
2089
+ "stream": false
2090
+ },
2091
+ "response": {
2092
+ "name": "@assistant/blind-peering",
2093
+ "stream": true
2094
+ },
2095
+ "version": 1
2044
2096
  }
2045
2097
  ]
2046
2098
  }
@@ -319,7 +319,15 @@ const methods = new Map([
319
319
  ['@assistant/chat-move-watch', 155],
320
320
  [155, '@assistant/chat-move-watch'],
321
321
  ['@assistant/chunks-delta-watch', 156],
322
- [156, '@assistant/chunks-delta-watch']
322
+ [156, '@assistant/chunks-delta-watch'],
323
+ ['@assistant/set-auto-download-models', 157],
324
+ [157, '@assistant/set-auto-download-models'],
325
+ ['@assistant/fork-chat', 158],
326
+ [158, '@assistant/fork-chat'],
327
+ ['@assistant/set-blind-peering', 159],
328
+ [159, '@assistant/set-blind-peering'],
329
+ ['@assistant/blind-peering-watch', 160],
330
+ [160, '@assistant/blind-peering-watch']
323
331
  ])
324
332
 
325
333
  class HRPC {
@@ -483,7 +491,11 @@ class HRPC {
483
491
  ['@assistant/set-chat-agent', getEncoding('@assistant/set-chat-agent-request')],
484
492
  ['@assistant/move-chat-to-mesh', getEncoding('@assistant/move-chat-to-mesh-request')],
485
493
  ['@assistant/chat-move-watch', getEncoding('@assistant/chat-id')],
486
- ['@assistant/chunks-delta-watch', getEncoding('@assistant/chunks-by-chat-request')]
494
+ ['@assistant/chunks-delta-watch', getEncoding('@assistant/chunks-by-chat-request')],
495
+ ['@assistant/set-auto-download-models', getEncoding('@assistant/set-auto-download-models-request')],
496
+ ['@assistant/fork-chat', getEncoding('@assistant/fork-chat-request')],
497
+ ['@assistant/set-blind-peering', getEncoding('@assistant/blind-peering')],
498
+ ['@assistant/blind-peering-watch', getEncoding('@assistant/empty')]
487
499
  ])
488
500
  this._responseEncodings = new Map([
489
501
  ['@assistant/config-get', getEncoding('@assistant/config-value')],
@@ -642,7 +654,11 @@ class HRPC {
642
654
  ['@assistant/set-chat-agent', getEncoding('@assistant/chat')],
643
655
  ['@assistant/move-chat-to-mesh', getEncoding('@assistant/chat-move')],
644
656
  ['@assistant/chat-move-watch', getEncoding('@assistant/chat-move')],
645
- ['@assistant/chunks-delta-watch', getEncoding('@assistant/chunk-delta')]
657
+ ['@assistant/chunks-delta-watch', getEncoding('@assistant/chunk-delta')],
658
+ ['@assistant/set-auto-download-models', getEncoding('@assistant/app-config')],
659
+ ['@assistant/fork-chat', getEncoding('@assistant/chat')],
660
+ ['@assistant/set-blind-peering', getEncoding('@assistant/blind-peering')],
661
+ ['@assistant/blind-peering-watch', getEncoding('@assistant/blind-peering')]
646
662
  ])
647
663
  this._rpc = new RPC(stream, async (req) => {
648
664
  const command = methods.get(req.command)
@@ -1368,6 +1384,22 @@ class HRPC {
1368
1384
  return this._callSync('@assistant/chunks-delta-watch', args)
1369
1385
  }
1370
1386
 
1387
+ async setAutoDownloadModels(args) {
1388
+ return this._call('@assistant/set-auto-download-models', args)
1389
+ }
1390
+
1391
+ async forkChat(args) {
1392
+ return this._call('@assistant/fork-chat', args)
1393
+ }
1394
+
1395
+ async setBlindPeering(args) {
1396
+ return this._call('@assistant/set-blind-peering', args)
1397
+ }
1398
+
1399
+ blindPeeringWatch(args) {
1400
+ return this._callSync('@assistant/blind-peering-watch', args)
1401
+ }
1402
+
1371
1403
  onConfigGet(responseFn) {
1372
1404
  this._handlers['@assistant/config-get'] = responseFn
1373
1405
  }
@@ -1996,6 +2028,22 @@ class HRPC {
1996
2028
  this._handlers['@assistant/chunks-delta-watch'] = responseFn
1997
2029
  }
1998
2030
 
2031
+ onSetAutoDownloadModels(responseFn) {
2032
+ this._handlers['@assistant/set-auto-download-models'] = responseFn
2033
+ }
2034
+
2035
+ onForkChat(responseFn) {
2036
+ this._handlers['@assistant/fork-chat'] = responseFn
2037
+ }
2038
+
2039
+ onSetBlindPeering(responseFn) {
2040
+ this._handlers['@assistant/set-blind-peering'] = responseFn
2041
+ }
2042
+
2043
+ onBlindPeeringWatch(responseFn) {
2044
+ this._handlers['@assistant/blind-peering-watch'] = responseFn
2045
+ }
2046
+
1999
2047
  _requestIsStream(command) {
2000
2048
  return [
2001
2049
  '@assistant/upload-attachment',
@@ -2040,7 +2088,8 @@ class HRPC {
2040
2088
  '@assistant/members-watch',
2041
2089
  '@assistant/models-watch',
2042
2090
  '@assistant/chat-move-watch',
2043
- '@assistant/chunks-delta-watch'
2091
+ '@assistant/chunks-delta-watch',
2092
+ '@assistant/blind-peering-watch'
2044
2093
  ].includes(command)
2045
2094
  }
2046
2095