@qvac/core 0.10.4 → 0.11.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 (104) hide show
  1. package/CHANGELOG.md +114 -1
  2. package/dist-lib/index.d.ts +1 -0
  3. package/dist-lib/index.js +1 -0
  4. package/dist-lib/lib/api/chunk-delta.d.ts +6 -2
  5. package/dist-lib/lib/api/chunk-delta.js +69 -7
  6. package/dist-lib/lib/api/chunks.js +6 -2
  7. package/dist-lib/lib/api/config.d.ts +4 -1
  8. package/dist-lib/lib/api/config.js +23 -4
  9. package/dist-lib/lib/api/devices.js +3 -1
  10. package/dist-lib/lib/api/rag.js +4 -2
  11. package/dist-lib/lib/assistant/harness.d.ts +3 -1
  12. package/dist-lib/lib/assistant/harness.js +10 -0
  13. package/dist-lib/lib/assistant/history.d.ts +2 -1
  14. package/dist-lib/lib/assistant/history.js +39 -6
  15. package/dist-lib/lib/assistant/message.d.ts +3 -0
  16. package/dist-lib/lib/assistant/message.js +10 -2
  17. package/dist-lib/lib/assistant/pdf-budget.d.ts +3 -0
  18. package/dist-lib/lib/assistant/pdf-budget.js +13 -0
  19. package/dist-lib/lib/assistant-tree.d.ts +1 -0
  20. package/dist-lib/lib/assistant-tree.js +10 -3
  21. package/dist-lib/lib/assistant.d.ts +5 -1
  22. package/dist-lib/lib/assistant.js +112 -37
  23. package/dist-lib/lib/client.js +10 -1
  24. package/dist-lib/lib/core/archived-mesh.js +1 -0
  25. package/dist-lib/lib/core/chunk.d.ts +5 -2
  26. package/dist-lib/lib/core/chunk.js +74 -18
  27. package/dist-lib/lib/core/collections.d.ts +1 -0
  28. package/dist-lib/lib/core/collections.js +1 -0
  29. package/dist-lib/lib/core/config-value.d.ts +6 -0
  30. package/dist-lib/lib/core/config-value.js +14 -0
  31. package/dist-lib/lib/core/contract/chat.d.ts +1 -0
  32. package/dist-lib/lib/core/contract/chat.js +8 -1
  33. package/dist-lib/lib/core/contract/chunks.js +20 -6
  34. package/dist-lib/lib/core/contract/compute.d.ts +1 -1
  35. package/dist-lib/lib/core/contract/compute.js +2 -1
  36. package/dist-lib/lib/core/contract/devices.js +3 -2
  37. package/dist-lib/lib/core/departures.js +7 -0
  38. package/dist-lib/lib/core/devices.d.ts +2 -1
  39. package/dist-lib/lib/core/devices.js +4 -2
  40. package/dist-lib/lib/core/document-attachment.d.ts +7 -0
  41. package/dist-lib/lib/core/document-attachment.js +6 -0
  42. package/dist-lib/lib/core/files/index.d.ts +1 -1
  43. package/dist-lib/lib/core/files/index.js +1 -1
  44. package/dist-lib/lib/core/files/rag/index.d.ts +1 -1
  45. package/dist-lib/lib/core/files/rag/index.js +1 -1
  46. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +1 -0
  47. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +4 -1
  48. package/dist-lib/lib/core/identity.d.ts +2 -0
  49. package/dist-lib/lib/core/identity.js +19 -0
  50. package/dist-lib/lib/core/inference-calls-receiver.js +2 -2
  51. package/dist-lib/lib/core/known-sender.d.ts +3 -0
  52. package/dist-lib/lib/core/known-sender.js +26 -0
  53. package/dist-lib/lib/core/local/index.d.ts +2 -0
  54. package/dist-lib/lib/core/local/index.js +17 -10
  55. package/dist-lib/lib/core/mesh.d.ts +5 -1
  56. package/dist-lib/lib/core/mesh.js +6 -6
  57. package/dist-lib/lib/core/migrations/chat-chunks.d.ts +4 -0
  58. package/dist-lib/lib/core/migrations/chat-chunks.js +43 -0
  59. package/dist-lib/lib/core/pdf/rasterize.d.ts +0 -1
  60. package/dist-lib/lib/core/pdf/rasterize.js +0 -1
  61. package/dist-lib/lib/core/skill-overlay-receiver.js +2 -2
  62. package/dist-lib/lib/core/skill-secrets.js +2 -2
  63. package/dist-lib/lib/core.d.ts +12 -1
  64. package/dist-lib/lib/core.js +75 -11
  65. package/dist-lib/lib/credential-pusher.d.ts +1 -0
  66. package/dist-lib/lib/credential-pusher.js +34 -48
  67. package/dist-lib/lib/device-tree.d.ts +18 -0
  68. package/dist-lib/lib/device-tree.js +32 -0
  69. package/dist-lib/lib/errors.d.ts +8 -0
  70. package/dist-lib/lib/errors.js +8 -0
  71. package/dist-lib/lib/oauth/flow-core.js +2 -0
  72. package/dist-lib/lib/oauth/loopback.d.ts +1 -0
  73. package/dist-lib/lib/oauth/loopback.js +31 -1
  74. package/dist-lib/lib/oauth/register.js +33 -18
  75. package/dist-lib/lib/oauth/request.d.ts +10 -0
  76. package/dist-lib/lib/oauth/request.js +22 -0
  77. package/dist-lib/lib/oauth/token-exchange-core.js +29 -32
  78. package/dist-lib/lib/oauth/types.d.ts +3 -0
  79. package/dist-lib/lib/oauth.d.ts +2 -1
  80. package/dist-lib/lib/oauth.js +1 -0
  81. package/dist-lib/lib/run-replay.d.ts +8 -2
  82. package/dist-lib/lib/run-replay.js +29 -11
  83. package/dist-lib/schema/engine.js +20 -3
  84. package/dist-lib/schema/field-order.js +8 -1
  85. package/dist-lib/schema/local.js +7 -3
  86. package/dist-lib/schema/qvac.js +19 -2
  87. package/dist-lib/spec/hrpc/messages.js +1236 -1184
  88. package/dist-lib/spec/hyperschema/index.js +1236 -1184
  89. package/dist-lib/spec/hyperschema/schema.json +47 -0
  90. package/dist-lib/spec/hyperschema/types.d.ts +11 -0
  91. package/dist-lib/spec/local/hyperdb/messages.js +70 -20
  92. package/dist-lib/spec/local/hyperschema/index.js +36 -11
  93. package/dist-lib/spec/local/hyperschema/schema.json +21 -1
  94. package/dist-lib/spec/local/hyperschema/types.d.ts +5 -1
  95. package/dist-lib/spec/mesh/hyperdb/db.json +17 -1
  96. package/dist-lib/spec/mesh/hyperdb/index.js +83 -2
  97. package/dist-lib/spec/mesh/hyperdb/messages.js +573 -255
  98. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +7 -1
  99. package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
  100. package/dist-lib/spec/mesh/hyperdispatch/messages.js +121 -8
  101. package/dist-lib/spec/mesh/hyperschema/index.js +121 -8
  102. package/dist-lib/spec/mesh/hyperschema/schema.json +69 -1
  103. package/dist-lib/spec/mesh/hyperschema/types.d.ts +19 -1
  104. package/package.json +12 -10
@@ -1,8 +1,6 @@
1
- import { AbortController as BareAbortController } from 'bare-abort-controller';
2
1
  import * as z from 'zod';
2
+ import { providerRequest } from './request.js';
3
3
  import { CoreError } from '../errors.js';
4
- const TOKEN_REQUEST_TIMEOUT_MS = 30_000;
5
- const AbortController = globalThis.AbortController ?? BareAbortController;
6
4
  const TokenResponseSchema = z.object({
7
5
  access_token: z.string(),
8
6
  token_type: z.string(),
@@ -51,19 +49,23 @@ export async function exchangeCodeWithFetch(config, { clientId, redirectUri, cod
51
49
  Accept: 'application/json'
52
50
  };
53
51
  applyClientSecret(config, body, headers);
54
- const response = await fetchImpl(config.tokenUrl, {
55
- method: 'POST',
56
- headers,
57
- body: body.toString()
58
- });
59
- if (!response.ok) {
60
- const text = await response.text().catch(() => '');
61
- if (config.dynamicRegistration && /invalid_client/i.test(text)) {
62
- await deps.clearClientId?.();
52
+ return await providerRequest({
53
+ fetchImpl,
54
+ url: config.tokenUrl,
55
+ init: { method: 'POST', headers, body: body.toString() },
56
+ timeoutMs: deps.requestTimeoutMs,
57
+ timeout: () => new CoreError('OAUTH_TOKEN_EXCHANGE_TIMEOUT'),
58
+ read: async (response) => {
59
+ if (!response.ok) {
60
+ const text = await response.text().catch(() => '');
61
+ if (config.dynamicRegistration && /invalid_client/i.test(text)) {
62
+ await deps.clearClientId?.();
63
+ }
64
+ throw new CoreError('OAUTH_TOKEN_EXCHANGE_FAILED', [response.status, text]);
65
+ }
66
+ return toTokens(parseTokenResponse(await response.json()));
63
67
  }
64
- throw new CoreError('OAUTH_TOKEN_EXCHANGE_FAILED', [response.status, text]);
65
- }
66
- return toTokens(parseTokenResponse(await response.json()));
68
+ });
67
69
  }
68
70
  export async function refreshOAuthTokensWithFetch(config, refreshToken, fetchImpl) {
69
71
  const body = new URLSearchParams({
@@ -76,24 +78,19 @@ export async function refreshOAuthTokensWithFetch(config, refreshToken, fetchImp
76
78
  Accept: 'application/json'
77
79
  };
78
80
  applyClientSecret(config, body, headers);
79
- const controller = new AbortController();
80
- const timeout = globalThis.setTimeout(() => controller.abort(new CoreError('OAUTH_TOKEN_REFRESH_TIMEOUT')), TOKEN_REQUEST_TIMEOUT_MS);
81
- try {
82
- const response = await fetchImpl(config.tokenUrl, {
83
- method: 'POST',
84
- headers,
85
- body: body.toString(),
86
- signal: controller.signal
87
- });
88
- if (!response.ok) {
89
- const text = await response.text().catch(() => '');
90
- throw new CoreError('OAUTH_TOKEN_REFRESH_FAILED', [response.status, text]);
81
+ return await providerRequest({
82
+ fetchImpl,
83
+ url: config.tokenUrl,
84
+ init: { method: 'POST', headers, body: body.toString() },
85
+ timeout: () => new CoreError('OAUTH_TOKEN_REFRESH_TIMEOUT'),
86
+ read: async (response) => {
87
+ if (!response.ok) {
88
+ const text = await response.text().catch(() => '');
89
+ throw new CoreError('OAUTH_TOKEN_REFRESH_FAILED', [response.status, text]);
90
+ }
91
+ return toTokens(parseTokenResponse(await response.json()), refreshToken);
91
92
  }
92
- return toTokens(parseTokenResponse(await response.json()), refreshToken);
93
- }
94
- finally {
95
- globalThis.clearTimeout(timeout);
96
- }
93
+ });
97
94
  }
98
95
  export function isTokenExpired(record, bufferMs = 60_000) {
99
96
  return typeof record.expiresAt === 'number' && Date.now() + bufferMs >= record.expiresAt;
@@ -27,13 +27,16 @@ interface OAuthProviderConfigBase {
27
27
  readonly dynamicRegistration?: boolean;
28
28
  readonly registrationEndpoint?: string;
29
29
  }
30
+ export type OAuthFlowStage = 'awaiting-callback' | 'exchanging-code';
30
31
  export interface OAuthFlowDeps {
31
32
  readonly openUrl?: (url: string) => Promise<void>;
32
33
  readonly timeoutMs?: number;
34
+ readonly requestTimeoutMs?: number;
33
35
  readonly getClientId?: () => Promise<string | undefined>;
34
36
  readonly saveClientId?: (clientId: string) => Promise<void>;
35
37
  readonly clearClientId?: () => Promise<void>;
36
38
  readonly createRedirect?: OAuthRedirectFactory;
39
+ readonly onStage?: (stage: OAuthFlowStage) => void;
37
40
  }
38
41
  export type PkceOnlyProviderConfig = OAuthProviderConfigBase & {
39
42
  readonly tokenAuth: 'pkce-only';
@@ -1,5 +1,6 @@
1
1
  export { waitForOAuthCallback } from './oauth/browser-connect.ts';
2
2
  export { cancelOAuthFlow, runOAuthFlow } from './oauth/flow.ts';
3
+ export { deliverOAuthCallback } from './oauth/loopback.ts';
3
4
  export { OAUTH_CALLBACK_PATH, OAUTH_WAIT_FOR_CODE_TIMEOUT_MS, oauthRedirectUri, scopedKey, specFromRoute, type OAuthKeySpec, type OAuthRouteLike } from './oauth/keys.ts';
4
5
  export { oauthSpecFor, oauthSpecs } from './oauth/registry.ts';
5
6
  export { createPkce, generatePkceChallenge, type PkceChallenge } from './oauth/pkce.ts';
@@ -8,4 +9,4 @@ export type { OAuthCallbackResult, OAuthRedirect, OAuthRedirectFactory } from '.
8
9
  export { registerOAuthClient, resolveDynamicClientId } from './oauth/register.ts';
9
10
  export { resolveOAuthCredential, type ConfigEngine, type Fetch, type FetchResponse } from './oauth/resolve.ts';
10
11
  export { isTokenExpired, refreshOAuthTokens } from './oauth/token-exchange.ts';
11
- export type { OAuthCredentials, OAuthFlowDeps, OAuthFlowResult, OAuthProvider, OAuthProviderConfig, OAuthTokens } from './oauth/types.ts';
12
+ export type { OAuthCredentials, OAuthFlowDeps, OAuthFlowResult, OAuthFlowStage, OAuthProvider, OAuthProviderConfig, OAuthTokens } from './oauth/types.ts';
@@ -1,5 +1,6 @@
1
1
  export { waitForOAuthCallback } from './oauth/browser-connect.js';
2
2
  export { cancelOAuthFlow, runOAuthFlow } from './oauth/flow.js';
3
+ export { deliverOAuthCallback } from './oauth/loopback.js';
3
4
  export { OAUTH_CALLBACK_PATH, OAUTH_WAIT_FOR_CODE_TIMEOUT_MS, oauthRedirectUri, scopedKey, specFromRoute } from './oauth/keys.js';
4
5
  export { oauthSpecFor, oauthSpecs } from './oauth/registry.js';
5
6
  export { createPkce, generatePkceChallenge } from './oauth/pkce.js';
@@ -4,13 +4,19 @@ export interface ReplayChat {
4
4
  readonly holder: string;
5
5
  readonly chatId: string;
6
6
  }
7
+ export interface SentRun {
8
+ readonly messages: ChatMessage[];
9
+ readonly asked?: string | undefined;
10
+ }
7
11
  export declare class RunReplayStore {
8
12
  private readonly _dir;
9
13
  constructor(dir: string);
10
14
  started(): Promise<boolean>;
11
15
  start(): Promise<void>;
12
- load({ holder, chatId }: ReplayChat): Promise<Map<string, ChatMessage[]>>;
13
- save({ holder, chatId }: ReplayChat, runId: string, messages: ChatMessage[]): Promise<void>;
16
+ load(chat: ReplayChat): Promise<Map<string, ChatMessage[]>>;
17
+ loadAsked(chat: ReplayChat): Promise<Map<string, string>>;
18
+ save({ holder, chatId }: ReplayChat, runId: string, { messages, asked }: SentRun): Promise<void>;
19
+ private _records;
14
20
  forget(chatId: string, holder?: string): Promise<void>;
15
21
  clear(holder: string): Promise<void>;
16
22
  private _chatDir;
@@ -19,30 +19,48 @@ export class RunReplayStore {
19
19
  async start() {
20
20
  await fs.promises.mkdir(this._dir, { recursive: true });
21
21
  }
22
- async load({ holder, chatId }) {
23
- const chatDir = this._chatDir(holder, chatId);
22
+ async load(chat) {
24
23
  const runs = new Map();
24
+ for (const record of await this._records(chat)) {
25
+ if (Array.isArray(record.messages)) {
26
+ runs.set(record.runId, record.messages.filter(isChatMessage));
27
+ }
28
+ }
29
+ return runs;
30
+ }
31
+ async loadAsked(chat) {
32
+ const asked = new Map();
33
+ for (const record of await this._records(chat)) {
34
+ if (typeof record.asked === 'string') {
35
+ asked.set(record.runId, record.asked);
36
+ }
37
+ }
38
+ return asked;
39
+ }
40
+ async save({ holder, chatId }, runId, { messages, asked }) {
41
+ const chatDir = this._chatDir(holder, chatId);
42
+ await fs.promises.mkdir(chatDir, { recursive: true });
43
+ await fs.promises.writeFile(join(chatDir, `${safeName(runId)}.json`), JSON.stringify({ runId, messages, asked }));
44
+ }
45
+ async _records({ holder, chatId }) {
46
+ const chatDir = this._chatDir(holder, chatId);
25
47
  let names;
26
48
  try {
27
49
  names = await fs.promises.readdir(chatDir);
28
50
  }
29
51
  catch {
30
- return runs;
52
+ return [];
31
53
  }
54
+ const records = [];
32
55
  for (const name of names) {
33
56
  if (!name.endsWith('.json'))
34
57
  continue;
35
58
  const parsed = JSON.parse(await fs.promises.readFile(join(chatDir, name), 'utf8'));
36
- if (isRecord(parsed) && typeof parsed.runId === 'string' && Array.isArray(parsed.messages)) {
37
- runs.set(parsed.runId, parsed.messages.filter(isChatMessage));
59
+ if (isRecord(parsed) && typeof parsed.runId === 'string') {
60
+ records.push({ runId: parsed.runId, messages: parsed.messages, asked: parsed.asked });
38
61
  }
39
62
  }
40
- return runs;
41
- }
42
- async save({ holder, chatId }, runId, messages) {
43
- const chatDir = this._chatDir(holder, chatId);
44
- await fs.promises.mkdir(chatDir, { recursive: true });
45
- await fs.promises.writeFile(join(chatDir, `${safeName(runId)}.json`), JSON.stringify({ runId, messages }));
63
+ return records;
46
64
  }
47
65
  async forget(chatId, holder) {
48
66
  const holders = holder === undefined ? await this._holders() : [holder];
@@ -29,7 +29,13 @@ export function registerEngineTypes(ns) {
29
29
  { name: 'deviceId', type: 'fixed32' }
30
30
  ]
31
31
  });
32
- ns.register({ name: 'config-value', fields: [{ name: 'value', type: 'json' }] });
32
+ ns.register({
33
+ name: 'config-value',
34
+ fields: [
35
+ { name: 'value', type: 'json' },
36
+ { name: 'falsyValue', type: 'string' }
37
+ ]
38
+ });
33
39
  ns.register({
34
40
  name: 'config-set-request',
35
41
  fields: [
@@ -464,6 +470,15 @@ export function registerEngineTypes(ns) {
464
470
  { name: 'writeRootsRequired', type: 'bool' }
465
471
  ]
466
472
  });
473
+ ns.register({
474
+ name: 'custom-model-report-entry',
475
+ fields: [
476
+ { name: 'name', type: 'string', required: true },
477
+ { name: 'label', type: 'string', required: true },
478
+ { name: 'taskType', type: 'string' },
479
+ { name: 'expectedSize', type: 'uint' }
480
+ ]
481
+ });
467
482
  ns.register({
468
483
  name: 'device',
469
484
  fields: [
@@ -483,7 +498,8 @@ export function registerEngineTypes(ns) {
483
498
  { name: 'platform', type: 'string' },
484
499
  { name: 'readySkillNames', type: 'string', array: true },
485
500
  { name: 'toolCatalog', type: '@assistant/tool-report-entry', array: true },
486
- { name: 'memberId', type: 'fixed32' }
501
+ { name: 'memberId', type: 'fixed32' },
502
+ { name: 'customModels', type: '@assistant/custom-model-report-entry', array: true }
487
503
  ]
488
504
  });
489
505
  ns.register({
@@ -519,7 +535,8 @@ export function registerEngineTypes(ns) {
519
535
  { name: 'cachedModelNames', type: 'string', array: true },
520
536
  { name: 'readySkillNames', type: 'string', array: true },
521
537
  { name: 'toolCatalog', type: '@assistant/tool-report-entry', array: true },
522
- { name: 'meshId', type: 'string', required: true }
538
+ { name: 'meshId', type: 'string', required: true },
539
+ { name: 'customModels', type: '@assistant/custom-model-report-entry', array: true }
523
540
  ]
524
541
  });
525
542
  ns.register({
@@ -1,6 +1,13 @@
1
1
  import fs from 'bare-fs';
2
2
  import { spawnSync } from 'bare-subprocess';
3
- const EXEMPT = {};
3
+ const EXEMPT = {
4
+ '@qvac/writer-v1.device': 'add-writer carries a BirthRow or claimableDevice() from lib/core/mesh.ts, never customModels',
5
+ '@qvac/writer-claim-v1.device': 'claimableDevice() in lib/core/mesh.ts sends only the fields the released build decodes',
6
+ '@qvac/open-join-v1.device': 'claimableDevice() in lib/core/mesh.ts, as for the writer claim',
7
+ '@qvac/vouched-join-v1.device': 'deprecated: no build dispatches it, it is only replayed',
8
+ '@qvac/invite-claim-v1.device': 'deprecated: no build dispatches it, it is only replayed',
9
+ '@qvac/recovery-claim-v1.device': 'deprecated: no build dispatches it, it is only replayed'
10
+ };
4
11
  export function assertFieldOrder(root, schemaFile, tags) {
5
12
  const current = index(JSON.parse(fs.readFileSync(schemaFile, 'utf8')).schema);
6
13
  const seen = new Set();
@@ -8,7 +8,8 @@ export function registerLocalTypes(ns) {
8
8
  });
9
9
  versioned('config', [
10
10
  { name: 'key', type: 'string', required: true },
11
- { name: 'value', type: 'json' }
11
+ { name: 'value', type: 'json' },
12
+ { name: 'falsyValue', type: 'string' }
12
13
  ]);
13
14
  versioned('mesh-session', [
14
15
  { name: 'deviceId', type: 'buffer', required: true },
@@ -101,7 +102,8 @@ export function registerLocalTypes(ns) {
101
102
  { name: 'key', type: 'buffer', required: true },
102
103
  { name: 'seed', type: 'buffer', required: true },
103
104
  { name: 'creator', type: 'bool' },
104
- { name: 'writerSeed', type: 'string' }
105
+ { name: 'writerSeed', type: 'string' },
106
+ { name: 'compute', type: 'bool' }
105
107
  ]);
106
108
  versioned('active-mesh', [
107
109
  { name: 'deviceId', type: 'fixed32', required: true },
@@ -116,7 +118,9 @@ export function registerLocalTypes(ns) {
116
118
  { name: 'wasHome', type: 'bool' },
117
119
  { name: 'migratedAt', type: 'uint' },
118
120
  { name: 'compute', type: 'bool' },
119
- { name: 'awaitingAdmission', type: 'bool' }
121
+ { name: 'awaitingAdmission', type: 'bool' },
122
+ { name: 'bootKey', type: 'fixed32' },
123
+ { name: 'bootLength', type: 'uint' }
120
124
  ]);
121
125
  versioned('member-proof', [
122
126
  { name: 'meshKey', type: 'fixed32', required: true },
@@ -221,6 +221,15 @@ export function registerQvacTypes(ns) {
221
221
  { name: 'writeRootsRequired', type: 'bool' }
222
222
  ]
223
223
  });
224
+ ns.register({
225
+ name: 'custom-model-report-entry',
226
+ fields: [
227
+ { name: 'name', type: 'string', required: true },
228
+ { name: 'label', type: 'string', required: true },
229
+ { name: 'taskType', type: 'string' },
230
+ { name: 'expectedSize', type: 'uint' }
231
+ ]
232
+ });
224
233
  versioned('device', [
225
234
  { name: 'id', type: 'fixed32', required: true },
226
235
  { name: 'name', type: 'string', required: true },
@@ -246,7 +255,8 @@ export function registerQvacTypes(ns) {
246
255
  { name: 'attestedAt', type: 'uint' },
247
256
  { name: 'claimedMemberId', type: 'fixed32' },
248
257
  { name: 'inviteToken', type: 'fixed32' },
249
- { name: 'deviceSignature', type: 'buffer' }
258
+ { name: 'deviceSignature', type: 'buffer' },
259
+ { name: 'customModels', type: '@qvac/custom-model-report-entry', array: true }
250
260
  ]);
251
261
  versioned('writer', [
252
262
  { name: 'writerKey', type: 'buffer', required: true },
@@ -288,7 +298,8 @@ export function registerQvacTypes(ns) {
288
298
  { name: 'installedModelNames', type: 'string', array: true },
289
299
  { name: 'cachedModelNames', type: 'string', array: true },
290
300
  { name: 'readySkillNames', type: 'string', array: true },
291
- { name: 'toolCatalog', type: '@qvac/tool-report-entry', array: true }
301
+ { name: 'toolCatalog', type: '@qvac/tool-report-entry', array: true },
302
+ { name: 'customModels', type: '@qvac/custom-model-report-entry', array: true }
292
303
  ]);
293
304
  versioned('put-agent-operation', [{ name: 'agent', type: '@qvac/agent', required: true }]);
294
305
  versioned('put-chat-operation', [{ name: 'chat', type: '@qvac/chat', required: true }]);
@@ -587,6 +598,7 @@ export function registerQvacTypes(ns) {
587
598
  { name: 'meshKey', type: 'fixed32', required: true },
588
599
  { name: 'seed', type: 'fixed32', required: true }
589
600
  ]);
601
+ versioned('reindex-chat-chunks-operation', [{ name: 'chatId', type: 'string', required: true }]);
590
602
  }
591
603
  export function registerQvacCollections(dbns, helpersPath) {
592
604
  dbns.require(helpersPath);
@@ -918,6 +930,7 @@ export function registerQvacCollections(dbns, helpersPath) {
918
930
  dbns.collections.register({ name: 'purged-chats', schema: '@qvac/purged-chat', key: ['chatId'] });
919
931
  dbns.collections.register({ name: 'mesh-names', schema: '@qvac/mesh-name', key: ['id'] });
920
932
  dbns.collections.register({ name: 'mesh-seeds', schema: '@qvac/mesh-seed', key: ['meshKey'] });
933
+ dbns.collections.register({ name: 'chat-chunks', schema: '@qvac/chunk', key: ['chatId', 'seq'] });
921
934
  }
922
935
  export function registerQvacDispatch(ds) {
923
936
  ds.register({ name: 'append-chunk', requestType: '@qvac/append-chunk-operation' });
@@ -986,4 +999,8 @@ export function registerQvacDispatch(ds) {
986
999
  ds.register({ name: 'name-mesh', requestType: '@qvac/name-mesh-operation' });
987
1000
  ds.register({ name: 'open-join', requestType: '@qvac/open-join' });
988
1001
  ds.register({ name: 'put-mesh-seed', requestType: '@qvac/mesh-seed' });
1002
+ ds.register({
1003
+ name: 'reindex-chat-chunks',
1004
+ requestType: '@qvac/reindex-chat-chunks-operation'
1005
+ });
989
1006
  }