@qvac/core 1.0.0-rc.2 → 1.0.0-rc.5

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 (213) hide show
  1. package/CHANGELOG.md +238 -12
  2. package/dist-lib/index.d.ts +3 -1
  3. package/dist-lib/index.js +1 -0
  4. package/dist-lib/lib/api/approval-rules.d.ts +1 -1
  5. package/dist-lib/lib/api/approval-rules.js +5 -1
  6. package/dist-lib/lib/api/chunk-delta.d.ts +7 -2
  7. package/dist-lib/lib/api/chunk-delta.js +89 -7
  8. package/dist-lib/lib/api/chunks.js +14 -8
  9. package/dist-lib/lib/api/config.d.ts +10 -3
  10. package/dist-lib/lib/api/config.js +51 -6
  11. package/dist-lib/lib/api/custom-models.js +3 -5
  12. package/dist-lib/lib/api/devices.js +3 -1
  13. package/dist-lib/lib/api/files.d.ts +1 -1
  14. package/dist-lib/lib/api/files.js +65 -8
  15. package/dist-lib/lib/api/index.d.ts +12 -2
  16. package/dist-lib/lib/api/index.js +6 -1
  17. package/dist-lib/lib/api/instrument.js +12 -4
  18. package/dist-lib/lib/api/members.js +7 -13
  19. package/dist-lib/lib/api/mesh.d.ts +1 -3
  20. package/dist-lib/lib/api/mesh.js +2 -2
  21. package/dist-lib/lib/api/notifications.js +8 -4
  22. package/dist-lib/lib/api/projects.js +5 -1
  23. package/dist-lib/lib/api/rag.js +32 -19
  24. package/dist-lib/lib/api/served.js +2 -1
  25. package/dist-lib/lib/api/workspace.js +0 -1
  26. package/dist-lib/lib/assistant/harness.d.ts +8 -2
  27. package/dist-lib/lib/assistant/harness.js +17 -4
  28. package/dist-lib/lib/assistant/history.d.ts +1 -1
  29. package/dist-lib/lib/assistant/history.js +19 -13
  30. package/dist-lib/lib/assistant/message.d.ts +6 -1
  31. package/dist-lib/lib/assistant/message.js +22 -2
  32. package/dist-lib/lib/assistant/model-round.d.ts +5 -0
  33. package/dist-lib/lib/assistant/model-round.js +47 -19
  34. package/dist-lib/lib/assistant/pdf-budget.d.ts +10 -2
  35. package/dist-lib/lib/assistant/pdf-budget.js +10 -11
  36. package/dist-lib/lib/assistant/pdf-pages.d.ts +25 -0
  37. package/dist-lib/lib/assistant/pdf-pages.js +75 -0
  38. package/dist-lib/lib/assistant/round-host.js +5 -3
  39. package/dist-lib/lib/assistant-client.d.ts +2 -1
  40. package/dist-lib/lib/assistant-client.js +24 -6
  41. package/dist-lib/lib/assistant-tree.d.ts +2 -0
  42. package/dist-lib/lib/assistant-tree.js +8 -5
  43. package/dist-lib/lib/assistant.d.ts +21 -7
  44. package/dist-lib/lib/assistant.js +481 -244
  45. package/dist-lib/lib/client.js +10 -1
  46. package/dist-lib/lib/compaction.d.ts +3 -1
  47. package/dist-lib/lib/compaction.js +18 -4
  48. package/dist-lib/lib/constants.d.ts +3 -0
  49. package/dist-lib/lib/constants.js +3 -0
  50. package/dist-lib/lib/core/agent-copies.js +7 -1
  51. package/dist-lib/lib/core/agent.js +1 -0
  52. package/dist-lib/lib/core/approval-rules.d.ts +5 -1
  53. package/dist-lib/lib/core/approval-rules.js +16 -1
  54. package/dist-lib/lib/core/chat-activity.js +13 -16
  55. package/dist-lib/lib/core/chat-copy.js +1 -1
  56. package/dist-lib/lib/core/chat-fork.js +2 -1
  57. package/dist-lib/lib/core/chat-move.d.ts +4 -0
  58. package/dist-lib/lib/core/chat-move.js +42 -11
  59. package/dist-lib/lib/core/chat.d.ts +0 -1
  60. package/dist-lib/lib/core/chat.js +1 -1
  61. package/dist-lib/lib/core/chunk.d.ts +14 -3
  62. package/dist-lib/lib/core/chunk.js +116 -25
  63. package/dist-lib/lib/core/collections.d.ts +12 -1
  64. package/dist-lib/lib/core/collections.js +12 -1
  65. package/dist-lib/lib/core/config-value.d.ts +7 -0
  66. package/dist-lib/lib/core/config-value.js +15 -0
  67. package/dist-lib/lib/core/contract/activity.d.ts +3 -2
  68. package/dist-lib/lib/core/contract/activity.js +39 -21
  69. package/dist-lib/lib/core/contract/agent-join.js +15 -19
  70. package/dist-lib/lib/core/contract/agents.js +8 -7
  71. package/dist-lib/lib/core/contract/chat.d.ts +3 -0
  72. package/dist-lib/lib/core/contract/chat.js +12 -1
  73. package/dist-lib/lib/core/contract/chunks.js +16 -6
  74. package/dist-lib/lib/core/contract/devices.js +6 -4
  75. package/dist-lib/lib/core/contract/index.js +2 -1
  76. package/dist-lib/lib/core/contract/invites.js +12 -31
  77. package/dist-lib/lib/core/contract/joined-meshes.js +2 -1
  78. package/dist-lib/lib/core/contract/mesh-rules.js +4 -0
  79. package/dist-lib/lib/core/contract/model-requests.js +7 -6
  80. package/dist-lib/lib/core/contract/project-device-keys.js +15 -6
  81. package/dist-lib/lib/core/contract/project-host-keys.js +5 -4
  82. package/dist-lib/lib/core/contract/projects.js +12 -13
  83. package/dist-lib/lib/core/contract/public-seeds.js +5 -5
  84. package/dist-lib/lib/core/contract/roles.js +2 -1
  85. package/dist-lib/lib/core/contract/run-requests.d.ts +1 -1
  86. package/dist-lib/lib/core/contract/run-requests.js +19 -13
  87. package/dist-lib/lib/core/contract/shipped-rows.d.ts +2 -0
  88. package/dist-lib/lib/core/contract/shipped-rows.js +22 -0
  89. package/dist-lib/lib/core/contract/workspace.js +6 -12
  90. package/dist-lib/lib/core/contract/writers.js +20 -6
  91. package/dist-lib/lib/core/deleted-agent-runs.d.ts +7 -0
  92. package/dist-lib/lib/core/deleted-agent-runs.js +46 -0
  93. package/dist-lib/lib/core/devices.d.ts +2 -1
  94. package/dist-lib/lib/core/devices.js +4 -2
  95. package/dist-lib/lib/core/document-attachment.d.ts +6 -3
  96. package/dist-lib/lib/core/document-attachment.js +10 -5
  97. package/dist-lib/lib/core/files/attachments.js +3 -3
  98. package/dist-lib/lib/core/files/index.d.ts +8 -5
  99. package/dist-lib/lib/core/files/index.js +111 -18
  100. package/dist-lib/lib/core/files/processing/index.d.ts +1 -1
  101. package/dist-lib/lib/core/files/processing/index.js +8 -2
  102. package/dist-lib/lib/core/files/processing/source.d.ts +1 -0
  103. package/dist-lib/lib/core/files/processing/source.js +3 -0
  104. package/dist-lib/lib/core/files/processing/state.d.ts +1 -0
  105. package/dist-lib/lib/core/files/processing/state.js +7 -0
  106. package/dist-lib/lib/core/files/rag/build.d.ts +1 -0
  107. package/dist-lib/lib/core/files/rag/build.js +14 -1
  108. package/dist-lib/lib/core/files/rag/index.d.ts +1 -1
  109. package/dist-lib/lib/core/files/rag/index.js +1 -1
  110. package/dist-lib/lib/core/files/rag/produce.js +1 -0
  111. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +2 -0
  112. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +7 -1
  113. package/dist-lib/lib/core/first-event.d.ts +6 -0
  114. package/dist-lib/lib/core/first-event.js +13 -0
  115. package/dist-lib/lib/core/invite.d.ts +2 -2
  116. package/dist-lib/lib/core/invite.js +5 -4
  117. package/dist-lib/lib/core/local/index.d.ts +16 -1
  118. package/dist-lib/lib/core/local/index.js +119 -10
  119. package/dist-lib/lib/core/mesh.d.ts +14 -3
  120. package/dist-lib/lib/core/mesh.js +127 -54
  121. package/dist-lib/lib/core/migrations/chat-chunks.d.ts +4 -0
  122. package/dist-lib/lib/core/migrations/chat-chunks.js +47 -0
  123. package/dist-lib/lib/core/migrations/file-index.d.ts +1 -1
  124. package/dist-lib/lib/core/migrations/file-index.js +6 -2
  125. package/dist-lib/lib/core/migrations/index.d.ts +2 -1
  126. package/dist-lib/lib/core/migrations/index.js +66 -9
  127. package/dist-lib/lib/core/notification.js +96 -23
  128. package/dist-lib/lib/core/pdf/figure.d.ts +22 -0
  129. package/dist-lib/lib/core/pdf/figure.js +64 -0
  130. package/dist-lib/lib/core/pdf/rasterize.d.ts +10 -1
  131. package/dist-lib/lib/core/pdf/rasterize.js +72 -22
  132. package/dist-lib/lib/core/peer-duplex.js +57 -5
  133. package/dist-lib/lib/core/public-mesh.js +8 -2
  134. package/dist-lib/lib/core/run-requests.js +2 -3
  135. package/dist-lib/lib/core/senders.d.ts +7 -6
  136. package/dist-lib/lib/core/senders.js +23 -30
  137. package/dist-lib/lib/core/shared-agents.d.ts +1 -0
  138. package/dist-lib/lib/core/shared-agents.js +47 -19
  139. package/dist-lib/lib/core/skill-secrets.d.ts +3 -2
  140. package/dist-lib/lib/core/skill-secrets.js +4 -1
  141. package/dist-lib/lib/core/sync/background.d.ts +3 -15
  142. package/dist-lib/lib/core/sync/background.js +25 -102
  143. package/dist-lib/lib/core/sync/devices.js +6 -3
  144. package/dist-lib/lib/core/sync/index.js +25 -3
  145. package/dist-lib/lib/core/sync-status.js +3 -3
  146. package/dist-lib/lib/core/vault-managed-skills.d.ts +18 -0
  147. package/dist-lib/lib/core/vault-managed-skills.js +105 -0
  148. package/dist-lib/lib/core.d.ts +66 -10
  149. package/dist-lib/lib/core.js +768 -179
  150. package/dist-lib/lib/credential-pusher.d.ts +11 -7
  151. package/dist-lib/lib/credential-pusher.js +40 -8
  152. package/dist-lib/lib/device-tree.d.ts +18 -0
  153. package/dist-lib/lib/device-tree.js +32 -0
  154. package/dist-lib/lib/doctor/redact.js +1 -1
  155. package/dist-lib/lib/errors.d.ts +12 -0
  156. package/dist-lib/lib/errors.js +12 -0
  157. package/dist-lib/lib/fs-drive-bridge.d.ts +7 -0
  158. package/dist-lib/lib/fs-drive-bridge.js +308 -30
  159. package/dist-lib/lib/integrations/setup-routes.js +7 -5
  160. package/dist-lib/lib/knowledge-search.d.ts +1 -1
  161. package/dist-lib/lib/knowledge-search.js +5 -46
  162. package/dist-lib/lib/kv-cache-retention.d.ts +35 -0
  163. package/dist-lib/lib/kv-cache-retention.js +98 -0
  164. package/dist-lib/lib/latest-frame.d.ts +10 -0
  165. package/dist-lib/lib/latest-frame.js +48 -0
  166. package/dist-lib/lib/mesh-scoped-engine.js +1 -0
  167. package/dist-lib/lib/model-download.d.ts +6 -1
  168. package/dist-lib/lib/model-download.js +32 -17
  169. package/dist-lib/lib/oauth/resolve.js +13 -5
  170. package/dist-lib/lib/reconnecting-watch.js +19 -11
  171. package/dist-lib/lib/run-notices.d.ts +2 -0
  172. package/dist-lib/lib/run-notices.js +5 -0
  173. package/dist-lib/lib/run-replay.d.ts +13 -1
  174. package/dist-lib/lib/run-replay.js +58 -21
  175. package/dist-lib/schema/build.js +66 -57
  176. package/dist-lib/schema/config.d.ts +1 -1
  177. package/dist-lib/schema/config.js +1 -1
  178. package/dist-lib/schema/content.js +2 -1
  179. package/dist-lib/schema/engine.js +70 -6
  180. package/dist-lib/schema/field-order.js +7 -1
  181. package/dist-lib/schema/indexes.d.ts +4 -0
  182. package/dist-lib/schema/indexes.js +18 -0
  183. package/dist-lib/schema/local.js +9 -2
  184. package/dist-lib/schema/qvac.js +116 -6
  185. package/dist-lib/spec/bind.js +15 -0
  186. package/dist-lib/spec/calls.js +5 -0
  187. package/dist-lib/spec/capabilities.d.ts +10 -0
  188. package/dist-lib/spec/config/hyperconf/index.js +1 -1
  189. package/dist-lib/spec/hrpc/hrpc.json +65 -0
  190. package/dist-lib/spec/hrpc/index.js +63 -3
  191. package/dist-lib/spec/hrpc/messages.js +1537 -1395
  192. package/dist-lib/spec/hyperschema/index.js +1537 -1395
  193. package/dist-lib/spec/hyperschema/schema.json +126 -1
  194. package/dist-lib/spec/hyperschema/types.d.ts +33 -1
  195. package/dist-lib/spec/local/hyperdb/messages.js +110 -54
  196. package/dist-lib/spec/local/hyperschema/index.js +56 -28
  197. package/dist-lib/spec/local/hyperschema/schema.json +55 -20
  198. package/dist-lib/spec/local/hyperschema/types.d.ts +8 -1
  199. package/dist-lib/spec/mesh/hyperdb/db.json +255 -51
  200. package/dist-lib/spec/mesh/hyperdb/index.js +1063 -404
  201. package/dist-lib/spec/mesh/hyperdb/messages.js +1673 -1202
  202. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +62 -56
  203. package/dist-lib/spec/mesh/hyperdispatch/index.js +156 -139
  204. package/dist-lib/spec/mesh/hyperdispatch/messages.js +809 -632
  205. package/dist-lib/spec/mesh/hyperschema/index.js +809 -632
  206. package/dist-lib/spec/mesh/hyperschema/schema.json +293 -174
  207. package/dist-lib/spec/mesh/hyperschema/types.d.ts +31 -1
  208. package/package.json +32 -26
  209. package/worker/assistant-sidecar.mjs +3 -0
  210. package/dist-lib/lib/core/files/processing/settle.d.ts +0 -13
  211. package/dist-lib/lib/core/files/processing/settle.js +0 -86
  212. package/dist-lib/lib/core/migrations/device-indexes.d.ts +0 -2
  213. package/dist-lib/lib/core/migrations/device-indexes.js +0 -7
@@ -13,8 +13,10 @@ export interface ChatMessage {
13
13
  audioAttachments?: AttachmentRef[];
14
14
  videos?: VideoRef[];
15
15
  documents?: DocumentAttachment[];
16
- pdfs?: AttachmentRef[];
16
+ pdfs?: PdfRef[];
17
17
  }
18
+ export declare function earlierImages(messages: ReadonlyArray<ChatMessage>): Set<string>;
19
+ export declare function claimNewImages(messages: unknown, sent: Set<string>): boolean;
18
20
  export declare const IMAGE_ONLY_USER_PROMPT = "The user sent one or more images without any accompanying text. Describe what the images show and respond to anything notable in them.";
19
21
  export declare const DOCUMENT_ONLY_USER_PROMPT = "The user sent one or more documents without any accompanying text. Summarize the attached documents.";
20
22
  export declare const IMAGE_AND_DOCUMENT_USER_PROMPT = "The user sent one or more images together with one or more documents, and no accompanying text. Describe what the images show and summarize the attached documents.";
@@ -50,6 +52,9 @@ export interface AttachmentRef {
50
52
  export interface VideoRef extends AttachmentRef {
51
53
  digest?: AttachmentRef;
52
54
  }
55
+ export interface PdfRef extends AttachmentRef {
56
+ pages?: AttachmentRef;
57
+ }
53
58
  export interface AttachInput {
54
59
  fileName: string;
55
60
  mimeType: string;
@@ -1,3 +1,23 @@
1
+ import { isRecord } from '../guards.js';
2
+ export function earlierImages(messages) {
3
+ const question = messages.findLastIndex((turn) => turn.role === 'user');
4
+ return new Set(messages.slice(0, Math.max(question, 0)).flatMap((turn) => imagePaths([turn])));
5
+ }
6
+ export function claimNewImages(messages, sent) {
7
+ let fresh = false;
8
+ for (const path of imagePaths(messages)) {
9
+ fresh ||= !sent.has(path);
10
+ sent.add(path);
11
+ }
12
+ return fresh;
13
+ }
14
+ function imagePaths(messages) {
15
+ if (!Array.isArray(messages))
16
+ return [];
17
+ return messages.flatMap((turn) => isRecord(turn) && Array.isArray(turn.attachments)
18
+ ? turn.attachments.flatMap((file) => isRecord(file) && typeof file.path === 'string' ? [file.path] : [])
19
+ : []);
20
+ }
1
21
  export const IMAGE_ONLY_USER_PROMPT = 'The user sent one or more images without any accompanying text. Describe what the images show and respond to anything notable in them.';
2
22
  export const DOCUMENT_ONLY_USER_PROMPT = 'The user sent one or more documents without any accompanying text. Summarize the attached documents.';
3
23
  export const IMAGE_AND_DOCUMENT_USER_PROMPT = 'The user sent one or more images together with one or more documents, and no accompanying text. Describe what the images show and summarize the attached documents.';
@@ -42,8 +62,8 @@ export function silentAudioNotice(fileName) {
42
62
  }
43
63
  export function audioTranscriptBlock(fileName, transcript) {
44
64
  return [
45
- `The audio file "${fileName}" has already been transcribed on-device. You cannot open the file itself — use the transcript below as its full content and answer from it.`,
46
- 'Transcript:',
65
+ `The audio file "${fileName}" has already been transcribed on-device for its speech. You cannot open the file itself, but a tool that takes an audio attachment still reads the audio.`,
66
+ 'Transcript of the speech in it, which is its words and not any music:',
47
67
  transcript
48
68
  ].join('\n');
49
69
  }
@@ -3,10 +3,12 @@ import type { AbortSignal } from 'bare-abort-controller';
3
3
  import type { AssistantChunk, AssistantChunkContentModelRequest, AssistantChunkDelta } from '../../spec/hyperschema/types.d.ts';
4
4
  import type { ScopedCapabilities } from '../mesh-scoped-engine.ts';
5
5
  import { type AttachmentRef } from './message.ts';
6
+ import type { PdfBounds } from '../core/pdf/figure.ts';
6
7
  import { type ProbeKind } from '../probe-rounds.ts';
7
8
  export interface MediaRef {
8
9
  readonly id: string;
9
10
  readonly page?: number | undefined;
11
+ readonly clip?: PdfBounds | undefined;
10
12
  readonly frame?: number | undefined;
11
13
  readonly frames?: number | undefined;
12
14
  }
@@ -24,6 +26,7 @@ export interface OwnerRoundsOptions {
24
26
  readonly deviceId: Buffer;
25
27
  readonly from: number;
26
28
  readonly media?: ((file: string) => MediaRef | undefined) | undefined;
29
+ readonly inspect?: ((call: Record<string, unknown>) => void) | undefined;
27
30
  }
28
31
  interface Echo {
29
32
  readonly type: 'content' | 'thinking';
@@ -50,8 +53,10 @@ export declare class OwnerRounds {
50
53
  private _contextSent;
51
54
  private _rounds;
52
55
  private _retakes;
56
+ private readonly _takers;
53
57
  constructor(opts: OwnerRoundsOptions);
54
58
  get rounds(): number;
59
+ ranHere(round: number | undefined): boolean;
55
60
  retook(): boolean;
56
61
  echoed(type: string, text: string): boolean;
57
62
  private _round;
@@ -1,16 +1,18 @@
1
1
  import b4a from 'b4a';
2
- import { ToolSets } from '@qvac/harness';
2
+ import { renderedTools, ToolSets } from '@qvac/harness';
3
3
  import { AbortedError } from '@qvac/harness/race-abort';
4
4
  import * as z from 'zod';
5
- import { isRecord } from '../guards.js';
5
+ import { errorMessage, isRecord } from '../guards.js';
6
6
  import { historyFromChunks, listHistoryChunks, replayFromChunks, runPromptView, sentTurn } from './history.js';
7
7
  import { nameSenders, restoreSentContent } from './message.js';
8
+ import { PdfBoundsSchema } from './pdf-pages.js';
8
9
  import { isProbeRound, PROBE_KINDS } from '../probe-rounds.js';
9
10
  const message = z.custom((value) => isRecord(value) && typeof value.role === 'string' && typeof value.content === 'string');
10
11
  const record = () => z.custom((value) => isRecord(value));
11
12
  const mediaRef = z.object({
12
13
  id: z.string(),
13
14
  page: z.number().optional(),
15
+ clip: PdfBoundsSchema.optional(),
14
16
  frame: z.number().optional(),
15
17
  frames: z.number().optional()
16
18
  });
@@ -40,6 +42,7 @@ export class OwnerRounds {
40
42
  _contextSent = false;
41
43
  _rounds = 0;
42
44
  _retakes = 0;
45
+ _takers = new Map();
43
46
  constructor(opts) {
44
47
  this._opts = opts;
45
48
  this.port = (request, io) => this._round(request, io);
@@ -47,6 +50,12 @@ export class OwnerRounds {
47
50
  get rounds() {
48
51
  return this._rounds;
49
52
  }
53
+ ranHere(round) {
54
+ if (!this._rounds)
55
+ return true;
56
+ const taker = round === undefined ? undefined : this._takers.get(round);
57
+ return !!taker && b4a.equals(taker, this._opts.deviceId);
58
+ }
50
59
  retook() {
51
60
  if (!this._retakes)
52
61
  return false;
@@ -80,6 +89,18 @@ export class OwnerRounds {
80
89
  const agentId = (await this._switchedTo()) ?? this._opts.agentId;
81
90
  const id = await this._ask(sent, agentId);
82
91
  this._rounds++;
92
+ const { round, modelId, history, tools, generationParams, responseFormat, toolDialect } = request;
93
+ this._opts.inspect?.({
94
+ round,
95
+ modelId,
96
+ messages: history,
97
+ tools: renderedTools(tools, history),
98
+ generationParams,
99
+ responseFormat,
100
+ toolDialect,
101
+ cacheKey: request.cacheKey,
102
+ promptPrefix: request.promptPrefix
103
+ });
83
104
  return this._follow(sent, { id, agentId }, io);
84
105
  }
85
106
  async probe({ kind, prompt, modelId, responseFormat, signal }) {
@@ -87,28 +108,34 @@ export class OwnerRounds {
87
108
  throw new AbortedError();
88
109
  const { engine, chatId, runId, deviceId } = this._opts;
89
110
  const agentId = (await this._switchedTo()) ?? this._opts.agentId;
111
+ const messages = [{ role: 'user', content: prompt }];
112
+ const options = {
113
+ kind,
114
+ attempt: 0,
115
+ modelId: await this._modelOf(agentId, modelId),
116
+ continuationNudge: '',
117
+ deliveredNudge: '',
118
+ generationParams: { reasoning_budget: 0 },
119
+ responseFormat
120
+ };
90
121
  const { id } = await engine.appendChunk({
91
122
  chatId,
92
123
  runId,
93
124
  type: 'model-request',
94
125
  originDeviceId: deviceId,
95
- modelRequest: {
96
- round: 0,
97
- agents: [agentId],
98
- toolTurns: [{ role: 'user', content: prompt }],
99
- options: {
100
- kind,
101
- attempt: 0,
102
- modelId: await this._modelOf(agentId, modelId),
103
- continuationNudge: '',
104
- deliveredNudge: '',
105
- generationParams: { reasoning_budget: 0 },
106
- responseFormat
107
- },
108
- state: 'open'
109
- }
126
+ modelRequest: { round: 0, agents: [agentId], toolTurns: messages, options, state: 'open' }
110
127
  });
111
- return (await this._probed({ id, agentId }, signal)).contentText;
128
+ const { modelId: asked, generationParams } = options;
129
+ const call = { kind, modelId: asked, messages, generationParams, responseFormat };
130
+ try {
131
+ const { contentText } = await this._probed({ id, agentId }, signal);
132
+ this._opts.inspect?.({ ...call, outcome: 'completed', result: contentText });
133
+ return contentText;
134
+ }
135
+ catch (err) {
136
+ this._opts.inspect?.({ ...call, outcome: 'failed', reason: errorMessage(err) });
137
+ throw err;
138
+ }
112
139
  }
113
140
  async _probed(asked, signal) {
114
141
  const { engine, chatId, from } = this._opts;
@@ -150,7 +177,7 @@ export class OwnerRounds {
150
177
  reachable = !!agent.hostReachable;
151
178
  const host = round()?.hostDeviceId;
152
179
  const moved = !!host && !b4a.equals(agent.providerDeviceId, host);
153
- if (moved || (was && !reachable && round()?.state === 'taken')) {
180
+ if (moved || (was && !reachable)) {
154
181
  await this._opts.engine.cancelModelRequest({ chunkId: asked.id }).catch(noop);
155
182
  return;
156
183
  }
@@ -277,6 +304,7 @@ export class OwnerRounds {
277
304
  const round = output.apply(frame);
278
305
  const result = at.moving ? undefined : roundEnd(round);
279
306
  if (result) {
307
+ this._takers.set(sent.round, round?.takenBy ?? null);
280
308
  return result;
281
309
  }
282
310
  const switched = output.switchedTo(from);
@@ -1,3 +1,11 @@
1
- export declare const MIN_PDF_PAGE_IMAGES = 2;
2
1
  export declare const MAX_PDF_PAGE_IMAGES = 32;
3
- export declare function pdfPageBudget(ctxSize: number): number;
2
+ export declare const CHARS_PER_TOKEN = 4;
3
+ export interface PdfReading {
4
+ readonly ctxSize: number;
5
+ readonly cacheTokens?: number;
6
+ }
7
+ export interface PdfRoom {
8
+ tokens: number;
9
+ images: number;
10
+ }
11
+ export declare function pdfImageRoom({ ctxSize, cacheTokens }: PdfReading, textChars: number): PdfRoom;
@@ -1,13 +1,12 @@
1
- import { MAX_IMAGE_WIDTH } from '../core/image/normalize.js';
2
- import { frameTokens } from './video-budget.js';
3
- const PAGE_TOKENS = frameTokens({
4
- width: MAX_IMAGE_WIDTH,
5
- height: Math.ceil(MAX_IMAGE_WIDTH * Math.SQRT2)
6
- });
7
- const PDF_SHARE = 0.5;
8
- export const MIN_PDF_PAGE_IMAGES = 2;
1
+ const DOCUMENT_SHARE = 0.5;
2
+ const ANSWER_SHARE = 0.25;
9
3
  export const MAX_PDF_PAGE_IMAGES = 32;
10
- export function pdfPageBudget(ctxSize) {
11
- const fits = Math.floor((ctxSize * PDF_SHARE) / PAGE_TOKENS);
12
- return Math.min(MAX_PDF_PAGE_IMAGES, Math.max(MIN_PDF_PAGE_IMAGES, fits));
4
+ export const CHARS_PER_TOKEN = 4;
5
+ export function pdfImageRoom({ ctxSize, cacheTokens }, textChars) {
6
+ const share = ctxSize * DOCUMENT_SHARE;
7
+ const free = cacheTokens === undefined ? share : Math.min(share, ctxSize * (1 - ANSWER_SHARE) - cacheTokens);
8
+ return {
9
+ tokens: Math.max(0, Math.floor(free - textChars / CHARS_PER_TOKEN)),
10
+ images: MAX_PDF_PAGE_IMAGES
11
+ };
13
12
  }
@@ -0,0 +1,25 @@
1
+ import * as z from 'zod';
2
+ import type { PdfBounds } from '../core/pdf/figure.ts';
3
+ import type { PdfDoc } from '../core/pdf/rasterize.ts';
4
+ import type { PdfRoom } from './pdf-budget.ts';
5
+ export declare const PDF_PAGES_MIME = "application/vnd.qvac.pdf-pages";
6
+ export interface PdfShot {
7
+ readonly page: number;
8
+ readonly clip?: PdfBounds;
9
+ readonly label: string;
10
+ }
11
+ export interface PdfSelection {
12
+ readonly pageCount: number;
13
+ readonly shots: ReadonlyArray<PdfShot>;
14
+ readonly cutAt?: number;
15
+ }
16
+ export declare const PdfBoundsSchema: z.ZodObject<{
17
+ x: z.ZodNumber;
18
+ y: z.ZodNumber;
19
+ width: z.ZodNumber;
20
+ height: z.ZodNumber;
21
+ }, z.core.$strip>;
22
+ export declare function pdfSelectionFileName(pdfFileName: string): string;
23
+ export declare function packPdfSelection(selection: PdfSelection): Uint8Array;
24
+ export declare function parsePdfSelection(bytes: Uint8Array): PdfSelection;
25
+ export declare function selectPdfPages(doc: PdfDoc, room: PdfRoom): Promise<PdfSelection>;
@@ -0,0 +1,75 @@
1
+ import b4a from 'b4a';
2
+ import * as z from 'zod';
3
+ import { frameTokens } from './video-budget.js';
4
+ export const PDF_PAGES_MIME = 'application/vnd.qvac.pdf-pages';
5
+ export const PdfBoundsSchema = z.object({
6
+ x: z.number(),
7
+ y: z.number(),
8
+ width: z.number().positive(),
9
+ height: z.number().positive()
10
+ });
11
+ const SelectionSchema = z.object({
12
+ version: z.literal(1),
13
+ pageCount: z.number().int().nonnegative(),
14
+ shots: z.array(z.object({
15
+ page: z.number().int().nonnegative(),
16
+ clip: PdfBoundsSchema.optional(),
17
+ label: z.string()
18
+ })),
19
+ cutAt: z.number().int().nonnegative().optional()
20
+ });
21
+ export function pdfSelectionFileName(pdfFileName) {
22
+ return `${pdfFileName}.pages`;
23
+ }
24
+ export function packPdfSelection(selection) {
25
+ return b4a.from(JSON.stringify({ version: 1, ...selection }));
26
+ }
27
+ export function parsePdfSelection(bytes) {
28
+ const { version: _, ...selection } = SelectionSchema.parse(JSON.parse(b4a.toString(bytes)));
29
+ return selection;
30
+ }
31
+ function shotLabel(page, names = []) {
32
+ return names.length ? `page ${page + 1} (${names.join(', ')})` : `page ${page + 1}`;
33
+ }
34
+ export async function selectPdfPages(doc, room) {
35
+ const pageCount = doc.pageCount();
36
+ const shots = [];
37
+ let cutAt;
38
+ for (let page = 0; page < pageCount; page++) {
39
+ let shot;
40
+ try {
41
+ shot = await pictured(doc, page);
42
+ }
43
+ catch {
44
+ continue;
45
+ }
46
+ if (!shot) {
47
+ continue;
48
+ }
49
+ if (room.images <= 0) {
50
+ return { pageCount, shots, cutAt: cutAt ?? page };
51
+ }
52
+ const cost = frameTokens(doc.renderSize(page, shot.clip));
53
+ if (cost > room.tokens) {
54
+ cutAt ??= page;
55
+ continue;
56
+ }
57
+ room.tokens -= cost;
58
+ room.images--;
59
+ shots.push(shot);
60
+ }
61
+ return cutAt === undefined ? { pageCount, shots } : { pageCount, shots, cutAt };
62
+ }
63
+ async function pictured(doc, page) {
64
+ const flags = doc.pageFlags(page);
65
+ if (flags.hasText && !flags.hasImage) {
66
+ return null;
67
+ }
68
+ if (!flags.hasText && !flags.hasImage && (await doc.blank(page))) {
69
+ return null;
70
+ }
71
+ const figure = flags.hasText ? doc.figure(page) : null;
72
+ return figure
73
+ ? { page, clip: figure.clip, label: shotLabel(page, figure.names) }
74
+ : { page, label: shotLabel(page) };
75
+ }
@@ -52,8 +52,10 @@ export class RoundHost {
52
52
  const round = rounds.find((chunk) => chunk.id === id);
53
53
  const takenBy = round?.modelRequest?.takenBy;
54
54
  const stale = (round?.updatedAt ?? 0) < serving.takenAt;
55
- const open = round?.modelRequest?.state === 'open';
56
- const ours = takenBy ? b4a.equals(takenBy, me) : open && stale;
55
+ const state = round?.modelRequest?.state;
56
+ const ours = takenBy
57
+ ? state === 'taken' && b4a.equals(takenBy, me)
58
+ : state === 'open' && stale;
57
59
  if (serving.taken && !ours) {
58
60
  serving.controller.abort(LEFT);
59
61
  this._serving.delete(id);
@@ -164,10 +166,10 @@ export class RoundHost {
164
166
  await engine.settleModelRequest({ chunkId: round.id, state: 'done', result });
165
167
  }
166
168
  catch (err) {
169
+ await writing.catch(noop);
167
170
  if (signal.aborted) {
168
171
  return;
169
172
  }
170
- await writing.catch(noop);
171
173
  await transcript.flush().catch(noop);
172
174
  await engine.settleModelRequest({
173
175
  chunkId: round.id,
@@ -9,6 +9,7 @@ export interface AssistantClientOptions extends ClientOptions {
9
9
  device?: DeviceMetadata;
10
10
  meshSeed?: Buffer;
11
11
  meshKey?: Buffer;
12
+ blindPeerKeys?: ReadonlyArray<Buffer>;
12
13
  bootstrapNodes?: ReadonlyArray<{
13
14
  host: string;
14
15
  port: number;
@@ -17,7 +18,7 @@ export interface AssistantClientOptions extends ClientOptions {
17
18
  }
18
19
  export declare class AssistantClient extends Client {
19
20
  private readonly _inline;
20
- constructor({ sidecar: spawnSidecar, storagePath, device, meshSeed, meshKey, bootstrapNodes, entry, ...engineOptions }: AssistantClientOptions);
21
+ constructor({ sidecar: spawnSidecar, storagePath, device, meshSeed, meshKey, bootstrapNodes, blindPeerKeys, entry, ...engineOptions }: AssistantClientOptions);
21
22
  get core(): Core | null;
22
23
  _close(): Promise<void>;
23
24
  }
@@ -4,7 +4,7 @@ import b4a from 'b4a';
4
4
  import { CoreError } from './errors.js';
5
5
  export class AssistantClient extends Client {
6
6
  _inline;
7
- constructor({ sidecar: spawnSidecar = true, storagePath, device, meshSeed, meshKey, bootstrapNodes, entry, ...engineOptions }) {
7
+ constructor({ sidecar: spawnSidecar = true, storagePath, device, meshSeed, meshKey, bootstrapNodes, blindPeerKeys, entry, ...engineOptions }) {
8
8
  const inline = { core: null };
9
9
  if (spawnSidecar && !entry) {
10
10
  throw new CoreError('SIDECAR_ENTRY_MISSING');
@@ -17,14 +17,24 @@ export class AssistantClient extends Client {
17
17
  device?.recommendedModelName ?? '',
18
18
  meshSeed ? b4a.toHex(meshSeed) : '',
19
19
  meshKey ? b4a.toHex(meshKey) : '',
20
- (bootstrapNodes ?? []).map((node) => `${node.host}:${node.port}`).join(',')
20
+ (bootstrapNodes ?? []).map((node) => `${node.host}:${node.port}`).join(','),
21
+ (blindPeerKeys ?? []).map((key) => b4a.toHex(key)).join(',')
21
22
  ];
22
23
  const transport = sidecarEntry
23
24
  ? async () => {
24
25
  const { default: sidecarRunner } = await import('bare-supervisor/runner/sidecar');
25
- const { ipc, exit } = sidecarRunner(sidecarEntry, args, engineOptions.logger ?? null);
26
- const died = exit.then((code) => new CoreError('SIDECAR_EXITED', [code]));
27
- const failure = await Promise.race([ipc.ready.then(() => null), died]);
26
+ const logger = engineOptions.logger ?? null;
27
+ const { ipc, exit } = sidecarRunner(sidecarEntry, args, logger);
28
+ let firstError = null;
29
+ ipc.on('error', (err) => {
30
+ firstError ??= err;
31
+ logger?.warn('assistant', 'the sidecar wire failed', err);
32
+ });
33
+ const died = exit.then((code) => sidecarDeath(code, firstError));
34
+ const failure = await Promise.race([
35
+ ipc.ready.then(() => null, () => died),
36
+ died
37
+ ]);
28
38
  if (failure) {
29
39
  throw failure;
30
40
  }
@@ -39,7 +49,8 @@ export class AssistantClient extends Client {
39
49
  device,
40
50
  meshSeed,
41
51
  meshKey,
42
- bootstrapNodes
52
+ bootstrapNodes,
53
+ blindPeerKeys
43
54
  });
44
55
  await inline.core.ready();
45
56
  return clientStream;
@@ -55,3 +66,10 @@ export class AssistantClient extends Client {
55
66
  await this._inline.core?.close();
56
67
  }
57
68
  }
69
+ function sidecarDeath(code, err) {
70
+ if (!err) {
71
+ return new CoreError('SIDECAR_EXITED', [code]);
72
+ }
73
+ const reason = err instanceof Error ? err : new Error(String(err));
74
+ return new CoreError('SIDECAR_BOOT_FAILED', [reason.message], { cause: reason });
75
+ }
@@ -26,6 +26,7 @@ export interface AssistantTreeOptions {
26
26
  runReplayDir?: string;
27
27
  imageCacheMaxBytes?: number;
28
28
  imageCacheMaxAgeMs?: number;
29
+ kvCacheRetentionMs?: number;
29
30
  embedder?: EmbedderFactory;
30
31
  extractors?: RagExtractors;
31
32
  onHarness?: OnHarness;
@@ -43,6 +44,7 @@ export interface AssistantChildOptions {
43
44
  runReplayDir?: string;
44
45
  imageCacheMaxBytes?: number;
45
46
  imageCacheMaxAgeMs?: number;
47
+ kvCacheRetentionMs?: number;
46
48
  embedder?: EmbedderFactory;
47
49
  extractors?: RagExtractors;
48
50
  onHarness?: OnHarness;
@@ -1,5 +1,5 @@
1
1
  import Supervisor, {} from 'bare-supervisor';
2
- import { harnessClearKvCache, harnessListModels, harnessPreviewModelSource, harnessSkillCatalog, harnessSkillManagement, harnessDetectLanguage, harnessSpeak, harnessSpeakStream, harnessTools, harnessTranscribe, QvacAssistant } from './assistant.js';
2
+ import { harnessClearKvCache, harnessListModels, harnessPreviewModelSource, harnessSkillCatalog, harnessSkillManagement, harnessDetectLanguage, harnessSpeak, harnessSpeakStream, harnessTools, harnessTranscribe, QvacAssistant, syncedSkills } from './assistant.js';
3
3
  import { Client } from './client.js';
4
4
  import { readFakeModels, watchFakeModels, withFakeModels } from './assistant/fake-models.js';
5
5
  import { startCustomModelPusher } from './custom-model-pusher.js';
@@ -8,7 +8,7 @@ import { startModelMemoryCap } from './model-memory-cap.js';
8
8
  import { startDownloadsAllowedPusher } from './downloads-allowed-pusher.js';
9
9
  import { duplexPair } from '@qvac/harness/transport';
10
10
  export function assistantTree(opts) {
11
- const { core, harness, logger = null, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, embedder, extractors, onHarness, platform, preloadCurrentAgentModel, fakeModels = false } = opts;
11
+ const { core, harness, logger = null, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, kvCacheRetentionMs, embedder, extractors, onHarness, platform, preloadCurrentAgentModel, fakeModels = false } = opts;
12
12
  const sup = new Supervisor();
13
13
  const logged = ['child-died', 'child-restarting', 'child-ready', 'gave-up', 'stall'];
14
14
  for (const event of logged) {
@@ -77,6 +77,7 @@ export function assistantTree(opts) {
77
77
  runReplayDir,
78
78
  imageCacheMaxBytes,
79
79
  imageCacheMaxAgeMs,
80
+ kvCacheRetentionMs,
80
81
  platform,
81
82
  preloadCurrentAgentModel,
82
83
  drives: core.fsDrives ?? undefined
@@ -94,7 +95,7 @@ export function assistantTree(opts) {
94
95
  offModelCatalogWatch = core.registerModelCatalogWatch(() => assistant.modelCatalogWatch());
95
96
  offCustomModels = startCustomModelPusher(harness, core.local, {
96
97
  logger,
97
- onPushed: () => assistant.notifyModelCatalog()
98
+ onPushed: () => assistant.cachedModelsChanged()
98
99
  });
99
100
  offModelIdle = startModelIdlePusher(harness, core.local, logger);
100
101
  modelMemoryCap = assistant.mobileClass
@@ -121,9 +122,10 @@ export function assistantTree(opts) {
121
122
  unload: (name) => assistant.unloadModel(name)
122
123
  });
123
124
  offModelUsers = core.registerModelUsers((name) => assistant.modelUsers(name));
125
+ const skills = syncedSkills((agentId, modelName, options) => assistant.skills(agentId, modelName, options), () => offHarness?.sync?.());
124
126
  offSkills = core.registerSkills(async (agentId, modelName, options) => {
125
127
  await offHarness?.ready?.();
126
- return assistant.skills(agentId, modelName, options);
128
+ return skills(agentId, modelName, options);
127
129
  });
128
130
  const transcribe = harnessTranscribe(harness);
129
131
  offTranscribe = core.registerTranscribe(async (request) => {
@@ -237,7 +239,7 @@ export function assistantTree(opts) {
237
239
  return sup;
238
240
  }
239
241
  export function assistantChild(opts) {
240
- const { harness, core = 'core', logger = null, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, embedder, extractors, onHarness, preloadCurrentAgentModel, fakeModels, ...spec } = opts;
242
+ const { harness, core = 'core', logger = null, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, kvCacheRetentionMs, embedder, extractors, onHarness, preloadCurrentAgentModel, fakeModels, ...spec } = opts;
241
243
  return {
242
244
  ...spec,
243
245
  deps: [core],
@@ -251,6 +253,7 @@ export function assistantChild(opts) {
251
253
  runReplayDir,
252
254
  imageCacheMaxBytes,
253
255
  imageCacheMaxAgeMs,
256
+ kvCacheRetentionMs,
254
257
  embedder,
255
258
  extractors,
256
259
  onHarness,
@@ -11,7 +11,7 @@ import type { LoggerInterface } from '@qvac/logging';
11
11
  import { type DeleteModelSummary, type Harness, type ListModelsOptions, type ModelInfo, type ToolCatalogEntry } from './assistant/harness.ts';
12
12
  import type { Skill } from './assistant/skill-encode.ts';
13
13
  import { type CompactOptions, type CompactResult } from './assistant/history.ts';
14
- export { harnessClearKvCache, harnessDeleteModel, harnessListModels, harnessPreviewModelSource, harnessSkillCatalog, harnessSkillManagement, harnessDetectLanguage, harnessSpeak, harnessSpeakStream, harnessTools, harnessTranscribe, type DeleteModelSummary, type Harness, type HarnessInfo, type ListModelsOptions, type ModelInfo, type ModelType, type ToolCatalogEntry } from './assistant/harness.ts';
14
+ export { harnessClearKvCache, harnessDeleteModel, harnessListModels, harnessPreviewModelSource, harnessSkillCatalog, harnessSkillManagement, syncedSkills, harnessDetectLanguage, harnessSpeak, harnessSpeakStream, harnessTools, harnessTranscribe, type DeleteModelSummary, type Harness, type HarnessInfo, type ListModelsOptions, type ModelInfo, type ModelType, type ToolCatalogEntry } from './assistant/harness.ts';
15
15
  export { type Skill } from './assistant/skill-encode.ts';
16
16
  export { annotateUnreadableImages, unheardAudioNotice, unreadableImagesNotice, DOCUMENT_ONLY_USER_PROMPT, IMAGE_AND_DOCUMENT_USER_PROMPT, IMAGE_ONLY_USER_PROMPT, nameSenders, restoreSentContent } from './assistant/message.ts';
17
17
  export { historyFromChunks, listHistoryChunks, staleToolRunIds, type CompactOptions, type CompactResult, type CompactionTrigger, type RunAt, type StaleToolRuns } from './assistant/history.ts';
@@ -27,6 +27,7 @@ export interface AssistantOptions {
27
27
  runReplayDir?: string;
28
28
  imageCacheMaxBytes?: number;
29
29
  imageCacheMaxAgeMs?: number;
30
+ kvCacheRetentionMs?: number;
30
31
  downloadRetryMs?: number;
31
32
  platform?: string;
32
33
  preloadCurrentAgentModel?: boolean;
@@ -55,6 +56,7 @@ export declare class QvacAssistant extends ReadyResource {
55
56
  private readonly _runIdleTimeoutMs;
56
57
  private readonly _modelReloadDelayMs;
57
58
  private readonly _reloads;
59
+ private readonly _releases;
58
60
  private readonly _pdfRasterizer;
59
61
  private readonly _warmAbort;
60
62
  private readonly _unloading;
@@ -98,19 +100,22 @@ export declare class QvacAssistant extends ReadyResource {
98
100
  private readonly _inferenceCalls;
99
101
  private readonly _runReplay;
100
102
  private readonly _roundHost;
103
+ private readonly _kvRetention;
101
104
  private readonly _lifecycle;
102
105
  private readonly _suggesting;
103
106
  private readonly _audioTranscripts;
104
107
  private readonly _videoProbes;
105
- private readonly _pdfPages;
108
+ private readonly _pdfSelections;
106
109
  private readonly _mediaRefs;
107
110
  private readonly _chats;
111
+ private readonly _intake;
108
112
  private readonly _runImageCacheNames;
109
113
  private readonly _reconciledCompactions;
114
+ private readonly _knowledgeCaps;
110
115
  private readonly _modelCatalog;
111
116
  private readonly _onHarnessStatus;
112
117
  private readonly _onModelCatalogEvent;
113
- constructor(engine: Capabilities, harness: Harness, { logger, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, downloadRetryMs, platform, preloadCurrentAgentModel, drives, blobReadTimeoutMs, runIdleTimeoutMs, modelReloadDelayMs, pdfRasterizer: pdfRasterizerOption }?: AssistantOptions);
118
+ constructor(engine: Capabilities, harness: Harness, { logger, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, kvCacheRetentionMs, downloadRetryMs, platform, preloadCurrentAgentModel, drives, blobReadTimeoutMs, runIdleTimeoutMs, modelReloadDelayMs, pdfRasterizer: pdfRasterizerOption }?: AssistantOptions);
114
119
  private _requireDeviceId;
115
120
  _open(): Promise<void>;
116
121
  private _triggerModelWarm;
@@ -152,12 +157,15 @@ export declare class QvacAssistant extends ReadyResource {
152
157
  private _isCached;
153
158
  private _scheduleModelReload;
154
159
  private _reloadLoadedModel;
160
+ private _scheduleModelRelease;
161
+ private _releaseUnusedModel;
155
162
  private _cancelModelReloads;
156
163
  private _agentRunning;
157
164
  unloadModel(name: string): Promise<AssistantUnloadModelResponse>;
158
165
  private _unloadModel;
159
166
  modelUsers(name: string): Promise<AssistantModelUsers>;
160
167
  private _meshModelUsers;
168
+ private _runModel;
161
169
  private _runnableHost;
162
170
  notifyModelCatalog(): void;
163
171
  cachedModelsChanged(): void;
@@ -169,14 +177,17 @@ export declare class QvacAssistant extends ReadyResource {
169
177
  private _supervisedWatch;
170
178
  private _reclaimDeletedChats;
171
179
  private _dropServedKvCache;
180
+ private _sweepIdleChatCaches;
172
181
  private _dropDeletedChat;
173
182
  private _followAgentEdits;
174
183
  private _reclaimAgentChatCaches;
175
184
  private _reconcileCompaction;
176
185
  deleteChatKvCache(chatId: string): Promise<AssistantKvCacheDeletionResponse>;
186
+ private _reclaimChatKvCache;
177
187
  clearKvCache(): Promise<AssistantKvCacheDeletionResponse>;
178
188
  private _clearPreReplayCaches;
179
189
  private _inspectCall;
190
+ private _inspectRound;
180
191
  private _inspectSent;
181
192
  private _sentRuns;
182
193
  private _recordSentRun;
@@ -192,6 +203,8 @@ export declare class QvacAssistant extends ReadyResource {
192
203
  private _stopMeshIntake;
193
204
  private _pruneSeen;
194
205
  private _dispatch;
206
+ private _schedule;
207
+ private _claim;
195
208
  private _offerSteer;
196
209
  private _requeue;
197
210
  private _citeWebSources;
@@ -231,13 +244,13 @@ export declare class QvacAssistant extends ReadyResource {
231
244
  private _servedPage;
232
245
  private _hydrateImage;
233
246
  private _hydratePdfPages;
234
- private _pdfPageBudget;
247
+ private _pdfReading;
235
248
  private _customModel;
236
- private _hydrateTurnPdfs;
237
249
  private _tryHydratePdf;
238
250
  private _hydratePdf;
239
- private _renderPdf;
240
- private _renderPdfPage;
251
+ private _storedPdfSelection;
252
+ private _renderPdfShots;
253
+ private _storePdfSelections;
241
254
  private _compactIfNearFull;
242
255
  private _runCompaction;
243
256
  private _contextReading;
@@ -259,6 +272,7 @@ export declare class QvacAssistant extends ReadyResource {
259
272
  private _abortOnLoss;
260
273
  private _runsChanged;
261
274
  private _generating;
275
+ private _markPreparing;
262
276
  idle(signal: AbortSignal): Promise<void>;
263
277
  private _logModelStatus;
264
278
  private _modelHolder;