@qvac/core 0.2.0 → 0.2.2

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 (265) hide show
  1. package/.claude/skills/compaction/SKILL.md +9 -4
  2. package/.claude/skills/pr-create/SKILL.md +24 -3
  3. package/.claude/skills/pr-review/SKILL.md +248 -40
  4. package/CLAUDE.md +1 -3
  5. package/README.md +3 -1
  6. package/dist-lib/client.js +1 -1
  7. package/dist-lib/index.js +8 -8
  8. package/dist-lib/lib/api/agents.d.ts +1 -1
  9. package/dist-lib/lib/api/agents.js +10 -9
  10. package/dist-lib/lib/api/app-config.js +1 -1
  11. package/dist-lib/lib/api/approval-rules.js +9 -5
  12. package/dist-lib/lib/api/attachments.js +25 -3
  13. package/dist-lib/lib/api/chat-groups.d.ts +1 -1
  14. package/dist-lib/lib/api/chat-groups.js +5 -4
  15. package/dist-lib/lib/api/chat.js +8 -8
  16. package/dist-lib/lib/api/chunks.js +11 -11
  17. package/dist-lib/lib/api/config.js +1 -1
  18. package/dist-lib/lib/api/custom-models.js +2 -2
  19. package/dist-lib/lib/api/devices.d.ts +1 -1
  20. package/dist-lib/lib/api/devices.js +9 -9
  21. package/dist-lib/lib/api/diagnostics.js +1 -1
  22. package/dist-lib/lib/api/effective-ctx-size.js +1 -1
  23. package/dist-lib/lib/api/execution.js +4 -4
  24. package/dist-lib/lib/api/files.js +2 -2
  25. package/dist-lib/lib/api/index.d.ts +1 -0
  26. package/dist-lib/lib/api/index.js +33 -33
  27. package/dist-lib/lib/api/instrument.js +1 -1
  28. package/dist-lib/lib/api/knowledge.js +4 -4
  29. package/dist-lib/lib/api/logs.js +1 -1
  30. package/dist-lib/lib/api/members.d.ts +4 -1
  31. package/dist-lib/lib/api/members.js +88 -18
  32. package/dist-lib/lib/api/mesh.d.ts +13 -3
  33. package/dist-lib/lib/api/mesh.js +25 -2
  34. package/dist-lib/lib/api/model-download.js +1 -1
  35. package/dist-lib/lib/api/network.js +1 -1
  36. package/dist-lib/lib/api/notifications.js +3 -3
  37. package/dist-lib/lib/api/rag.js +7 -7
  38. package/dist-lib/lib/api/sync.js +1 -1
  39. package/dist-lib/lib/api/tool-activity.js +4 -4
  40. package/dist-lib/lib/api/tool-configs.js +5 -5
  41. package/dist-lib/lib/api/watchable.js +1 -1
  42. package/dist-lib/lib/assistant/fetch-body.d.ts +5 -0
  43. package/dist-lib/lib/assistant/fetch-body.js +36 -0
  44. package/dist-lib/lib/assistant/harness.d.ts +225 -0
  45. package/dist-lib/lib/assistant/harness.js +154 -0
  46. package/dist-lib/lib/assistant/history.d.ts +32 -0
  47. package/dist-lib/lib/assistant/history.js +232 -0
  48. package/dist-lib/lib/assistant/message.d.ts +45 -0
  49. package/dist-lib/lib/assistant/message.js +47 -0
  50. package/dist-lib/lib/assistant/skill-encode.d.ts +21 -0
  51. package/dist-lib/lib/assistant/skill-encode.js +71 -0
  52. package/dist-lib/lib/assistant-client.js +2 -2
  53. package/dist-lib/lib/assistant-tree.js +10 -4
  54. package/dist-lib/lib/assistant.d.ts +25 -285
  55. package/dist-lib/lib/assistant.js +250 -637
  56. package/dist-lib/lib/audio-format.js +2 -2
  57. package/dist-lib/lib/client.js +2 -2
  58. package/dist-lib/lib/collabora/convert.js +1 -1
  59. package/dist-lib/lib/collabora/entry.js +1 -1
  60. package/dist-lib/lib/collabora/worker.js +1 -1
  61. package/dist-lib/lib/compaction.d.ts +1 -2
  62. package/dist-lib/lib/compaction.js +8 -6
  63. package/dist-lib/lib/constants.js +1 -1
  64. package/dist-lib/lib/core/account-recovery.d.ts +19 -0
  65. package/dist-lib/lib/core/account-recovery.js +50 -0
  66. package/dist-lib/lib/core/agent.js +8 -4
  67. package/dist-lib/lib/core/app-build.d.ts +1 -1
  68. package/dist-lib/lib/core/approval-rules.d.ts +1 -0
  69. package/dist-lib/lib/core/approval-rules.js +3 -1
  70. package/dist-lib/lib/core/archived-mesh.d.ts +25 -0
  71. package/dist-lib/lib/core/archived-mesh.js +162 -0
  72. package/dist-lib/lib/core/chat-activity.js +1 -1
  73. package/dist-lib/lib/core/chat-group.d.ts +1 -0
  74. package/dist-lib/lib/core/chat-group.js +24 -4
  75. package/dist-lib/lib/core/chat-search.js +2 -2
  76. package/dist-lib/lib/core/chat.js +5 -5
  77. package/dist-lib/lib/core/chunk.d.ts +1 -1
  78. package/dist-lib/lib/core/chunk.js +4 -4
  79. package/dist-lib/lib/core/contract/agents.js +1 -1
  80. package/dist-lib/lib/core/contract/approval-rules.js +6 -4
  81. package/dist-lib/lib/core/contract/attestations.js +1 -1
  82. package/dist-lib/lib/core/contract/chat-group.js +1 -1
  83. package/dist-lib/lib/core/contract/chat.js +1 -1
  84. package/dist-lib/lib/core/contract/chunks.js +2 -2
  85. package/dist-lib/lib/core/contract/compute.d.ts +11 -0
  86. package/dist-lib/lib/core/contract/compute.js +45 -0
  87. package/dist-lib/lib/core/contract/devices.js +16 -3
  88. package/dist-lib/lib/core/contract/index.d.ts +3 -1
  89. package/dist-lib/lib/core/contract/index.js +19 -16
  90. package/dist-lib/lib/core/contract/indexing.js +2 -2
  91. package/dist-lib/lib/core/contract/joined-meshes.js +1 -1
  92. package/dist-lib/lib/core/contract/knowledge.js +2 -2
  93. package/dist-lib/lib/core/contract/members.js +2 -2
  94. package/dist-lib/lib/core/contract/seal.d.ts +2 -0
  95. package/dist-lib/lib/core/contract/seal.js +8 -0
  96. package/dist-lib/lib/core/contract/seed-defaults.js +1 -1
  97. package/dist-lib/lib/core/contract/tool-activity.js +1 -1
  98. package/dist-lib/lib/core/contract/tool-configs.js +3 -3
  99. package/dist-lib/lib/core/contract/writers.js +66 -42
  100. package/dist-lib/lib/core/departures.js +1 -1
  101. package/dist-lib/lib/core/device-invites.js +1 -1
  102. package/dist-lib/lib/core/document-attachment.js +2 -2
  103. package/dist-lib/lib/core/files/attachments.js +3 -3
  104. package/dist-lib/lib/core/files/index.d.ts +2 -2
  105. package/dist-lib/lib/core/files/index.js +19 -19
  106. package/dist-lib/lib/core/files/knowledge.js +3 -3
  107. package/dist-lib/lib/core/files/preview/image.js +1 -1
  108. package/dist-lib/lib/core/files/preview/index.js +6 -6
  109. package/dist-lib/lib/core/files/processing/claims.js +1 -1
  110. package/dist-lib/lib/core/files/processing/document.js +5 -5
  111. package/dist-lib/lib/core/files/processing/index.js +8 -8
  112. package/dist-lib/lib/core/files/processing/ownership.js +1 -1
  113. package/dist-lib/lib/core/files/processing/protocol.js +3 -3
  114. package/dist-lib/lib/core/files/processing/source.js +1 -1
  115. package/dist-lib/lib/core/files/rag/artifact/codec.js +1 -1
  116. package/dist-lib/lib/core/files/rag/artifact/id.js +1 -1
  117. package/dist-lib/lib/core/files/rag/artifact/types.d.ts +4 -4
  118. package/dist-lib/lib/core/files/rag/build.js +2 -2
  119. package/dist-lib/lib/core/files/rag/chunk/chunking.js +2 -2
  120. package/dist-lib/lib/core/files/rag/document-types.d.ts +3 -3
  121. package/dist-lib/lib/core/files/rag/extract/document-types.d.ts +9 -9
  122. package/dist-lib/lib/core/files/rag/extract/extract.js +7 -7
  123. package/dist-lib/lib/core/files/rag/extract/html-text.js +1 -1
  124. package/dist-lib/lib/core/files/rag/extract/office-collabora.js +2 -2
  125. package/dist-lib/lib/core/files/rag/extract/pdf-platform.js +1 -1
  126. package/dist-lib/lib/core/files/rag/extract/pdf-text.js +1 -1
  127. package/dist-lib/lib/core/files/rag/extract/text-decoding.js +1 -1
  128. package/dist-lib/lib/core/files/rag/extract/types.d.ts +2 -2
  129. package/dist-lib/lib/core/files/rag/index.js +22 -22
  130. package/dist-lib/lib/core/files/rag/load.js +5 -5
  131. package/dist-lib/lib/core/files/rag/policy.js +2 -2
  132. package/dist-lib/lib/core/files/rag/produce.js +5 -5
  133. package/dist-lib/lib/core/files/rag/retrieval/coverage.js +2 -2
  134. package/dist-lib/lib/core/files/rag/retrieval/diversity.js +1 -1
  135. package/dist-lib/lib/core/files/rag/retrieval/floor.js +2 -2
  136. package/dist-lib/lib/core/files/rag/retrieval/format.js +1 -1
  137. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +18 -11
  138. package/dist-lib/lib/core/files/rag/retrieval/knowledge.js +6 -5
  139. package/dist-lib/lib/core/files/rag/retrieval/scoring.js +2 -2
  140. package/dist-lib/lib/core/files/rag/retrieval/search.js +7 -4
  141. package/dist-lib/lib/core/files/rag/retrieval/selection.d.ts +1 -0
  142. package/dist-lib/lib/core/files/rag/retrieval/selection.js +32 -2
  143. package/dist-lib/lib/core/files/rag/retrieval/sources.js +2 -2
  144. package/dist-lib/lib/core/files/rag/retrieval/terms.js +1 -1
  145. package/dist-lib/lib/core/files/rag/retrieval/types.d.ts +1 -0
  146. package/dist-lib/lib/core/files/rag/retrieval/web-sources.js +1 -1
  147. package/dist-lib/lib/core/files/records/chunks.js +1 -1
  148. package/dist-lib/lib/core/files/records/index.js +8 -8
  149. package/dist-lib/lib/core/files/records/knowledge.js +2 -2
  150. package/dist-lib/lib/core/files/records/output.js +1 -1
  151. package/dist-lib/lib/core/files/records/reclaim.js +5 -5
  152. package/dist-lib/lib/core/files/records/routing.js +7 -7
  153. package/dist-lib/lib/core/files/store/blob.js +2 -2
  154. package/dist-lib/lib/core/files/store/index.js +7 -7
  155. package/dist-lib/lib/core/files/store/reference.js +2 -2
  156. package/dist-lib/lib/core/files/store/server.js +1 -1
  157. package/dist-lib/lib/core/files/store/sweep.js +1 -1
  158. package/dist-lib/lib/core/files/upload-input.js +2 -2
  159. package/dist-lib/lib/core/files/upload.d.ts +1 -1
  160. package/dist-lib/lib/core/files/upload.js +6 -6
  161. package/dist-lib/lib/core/harness-loan.d.ts +29 -0
  162. package/dist-lib/lib/core/harness-loan.js +187 -0
  163. package/dist-lib/lib/core/helpers/index.d.ts +2 -1
  164. package/dist-lib/lib/core/helpers/index.js +4 -4
  165. package/dist-lib/lib/core/hosted-agents.js +2 -2
  166. package/dist-lib/lib/core/identity.d.ts +2 -0
  167. package/dist-lib/lib/core/identity.js +4 -2
  168. package/dist-lib/lib/core/invite.d.ts +1 -0
  169. package/dist-lib/lib/core/invite.js +4 -2
  170. package/dist-lib/lib/core/local/index.d.ts +12 -3
  171. package/dist-lib/lib/core/local/index.js +75 -16
  172. package/dist-lib/lib/core/membership.d.ts +3 -0
  173. package/dist-lib/lib/core/membership.js +15 -1
  174. package/dist-lib/lib/core/mesh-seed-handoff.js +1 -1
  175. package/dist-lib/lib/core/mesh.d.ts +9 -3
  176. package/dist-lib/lib/core/mesh.js +41 -26
  177. package/dist-lib/lib/core/migrations/agent-catalog.js +1 -1
  178. package/dist-lib/lib/core/migrations/index.js +5 -3
  179. package/dist-lib/lib/core/migrations/membership.js +2 -2
  180. package/dist-lib/lib/core/migrations/seal.d.ts +3 -0
  181. package/dist-lib/lib/core/migrations/seal.js +30 -0
  182. package/dist-lib/lib/core/next-frame.js +1 -1
  183. package/dist-lib/lib/core/notification.js +1 -1
  184. package/dist-lib/lib/core/ota-config.js +1 -1
  185. package/dist-lib/lib/core/secret-handoff.js +1 -1
  186. package/dist-lib/lib/core/send.js +3 -3
  187. package/dist-lib/lib/core/skill-overlay-handoff.js +1 -1
  188. package/dist-lib/lib/core/skill-overlay-receiver.js +2 -2
  189. package/dist-lib/lib/core/skill-secrets.js +3 -3
  190. package/dist-lib/lib/core/sync/devices.js +1 -1
  191. package/dist-lib/lib/core/sync/index.js +8 -5
  192. package/dist-lib/lib/core/sync-status.js +1 -1
  193. package/dist-lib/lib/core/system-info.js +1 -1
  194. package/dist-lib/lib/core/tool-activity.js +2 -2
  195. package/dist-lib/lib/core/tool-configs.js +2 -2
  196. package/dist-lib/lib/core.d.ts +41 -3
  197. package/dist-lib/lib/core.js +525 -90
  198. package/dist-lib/lib/credential-pusher.js +4 -4
  199. package/dist-lib/lib/deadline.js +1 -1
  200. package/dist-lib/lib/fs-drive-bridge.js +4 -2
  201. package/dist-lib/lib/integrations/index.js +3 -3
  202. package/dist-lib/lib/integrations/oauth-providers.js +1 -1
  203. package/dist-lib/lib/integrations/setup-routes.d.ts +5 -5
  204. package/dist-lib/lib/integrations/setup-routes.js +3 -3
  205. package/dist-lib/lib/knowledge-search.js +1 -1
  206. package/dist-lib/lib/log.js +3 -3
  207. package/dist-lib/lib/mesh-scoped-engine.d.ts +3 -0
  208. package/dist-lib/lib/mesh-scoped-engine.js +96 -0
  209. package/dist-lib/lib/model-context.d.ts +2 -2
  210. package/dist-lib/lib/model-context.js +1 -1
  211. package/dist-lib/lib/model-download.js +6 -6
  212. package/dist-lib/lib/oauth/asana.js +3 -3
  213. package/dist-lib/lib/oauth/browser-connect.js +1 -1
  214. package/dist-lib/lib/oauth/client.js +2 -2
  215. package/dist-lib/lib/oauth/common.d.ts +1 -1
  216. package/dist-lib/lib/oauth/common.js +1 -1
  217. package/dist-lib/lib/oauth/flow-core.js +3 -3
  218. package/dist-lib/lib/oauth/flow.js +2 -2
  219. package/dist-lib/lib/oauth/google.js +4 -4
  220. package/dist-lib/lib/oauth/host.js +3 -3
  221. package/dist-lib/lib/oauth/loopback.js +1 -1
  222. package/dist-lib/lib/oauth/notion.js +3 -3
  223. package/dist-lib/lib/oauth/providers.js +1 -1
  224. package/dist-lib/lib/oauth/resolve.js +1 -1
  225. package/dist-lib/lib/oauth/spotify.js +3 -3
  226. package/dist-lib/lib/oauth/token-exchange.js +1 -1
  227. package/dist-lib/lib/oauth.client.js +2 -2
  228. package/dist-lib/lib/oauth.js +12 -12
  229. package/dist-lib/lib/run-notices.d.ts +7 -7
  230. package/dist-lib/lib/run-transcript.js +1 -1
  231. package/dist-lib/schema/build.js +12 -6
  232. package/dist-lib/schema/content.d.ts +11 -11
  233. package/dist-lib/schema/engine.js +193 -30
  234. package/dist-lib/schema/field-order.js +2 -2
  235. package/dist-lib/schema/local.js +18 -4
  236. package/dist-lib/schema/qvac.js +15 -6
  237. package/dist-lib/spec/bind.js +41 -0
  238. package/dist-lib/spec/calls.js +12 -0
  239. package/dist-lib/spec/capabilities.d.ts +36 -12
  240. package/dist-lib/spec/hrpc/hrpc.json +161 -5
  241. package/dist-lib/spec/hrpc/index.js +154 -9
  242. package/dist-lib/spec/hrpc/messages.js +549 -129
  243. package/dist-lib/spec/hyperschema/index.js +549 -129
  244. package/dist-lib/spec/hyperschema/schema.json +370 -40
  245. package/dist-lib/spec/hyperschema/types.d.ts +85 -1
  246. package/dist-lib/spec/local/hyperdb/db.json +15 -0
  247. package/dist-lib/spec/local/hyperdb/index.js +70 -1
  248. package/dist-lib/spec/local/hyperdb/messages.js +300 -117
  249. package/dist-lib/spec/local/hyperschema/index.js +97 -4
  250. package/dist-lib/spec/local/hyperschema/schema.json +58 -1
  251. package/dist-lib/spec/local/hyperschema/types.d.ts +14 -0
  252. package/dist-lib/spec/mesh/hyperdb/messages.js +393 -288
  253. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +6 -0
  254. package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
  255. package/dist-lib/spec/mesh/hyperdispatch/messages.js +176 -85
  256. package/dist-lib/spec/mesh/hyperschema/index.js +176 -85
  257. package/dist-lib/spec/mesh/hyperschema/schema.json +71 -21
  258. package/dist-lib/spec/mesh/hyperschema/types.d.ts +14 -1
  259. package/package.json +16 -10
  260. package/tui/README.md +7 -0
  261. package/tui/app.mjs +311 -14
  262. package/tui/lib/busy-words.mjs +57 -5
  263. package/tui/lib/export.mjs +1 -0
  264. package/tui/lib/render.mjs +9 -2
  265. package/tui/main.mjs +5 -2
@@ -1,4 +1,4 @@
1
- export { isAudioAttachment as isAudioFile } from "./core/audio-attachment.js";
1
+ export { isAudioAttachment as isAudioFile } from './core/audio-attachment.js';
2
2
  export { AUDIO_EXTENSIONS } from '../schema/helpers.js';
3
- export { wavDurationSeconds } from "./wav-duration.js";
3
+ export { wavDurationSeconds } from './wav-duration.js';
4
4
  export const MAX_AUDIO_ATTACHMENT_BYTES = 25 * 1024 * 1024;
@@ -1,6 +1,6 @@
1
1
  import ReadyResource from 'ready-resource';
2
- import reconnectingWatch from "./reconnecting-watch.js";
3
- import { openLocalEngineSpec } from "./spec-loader.js";
2
+ import reconnectingWatch from './reconnecting-watch.js';
3
+ import { openLocalEngineSpec } from './spec-loader.js';
4
4
  import { settleOnClose } from '@qvac/harness/rpc';
5
5
  export class Client extends ReadyResource {
6
6
  _transport;
@@ -3,7 +3,7 @@ import { randomBytes } from 'crypto';
3
3
  import fs from 'fs';
4
4
  import os from 'os';
5
5
  import path from 'path';
6
- import { convertInWorker } from "./worker.js";
6
+ import { convertInWorker } from './worker.js';
7
7
  const ZIP_SIGNATURE = 0x04034b50;
8
8
  const EOCD_SIGNATURE = 0x06054b50;
9
9
  const EOCD_SIZE = 22;
@@ -1,4 +1,4 @@
1
- import { asHostJob } from "./protocol.js";
1
+ import { asHostJob } from './protocol.js';
2
2
  async function main() {
3
3
  const self = Bare.Thread.self;
4
4
  if (!self)
@@ -2,7 +2,7 @@ import process from 'process';
2
2
  import ScopeLock from 'scope-lock';
3
3
  import safetyCatch from 'safety-catch';
4
4
  import { fileURLToPath } from 'url';
5
- import { asWorkerReply } from "./protocol.js";
5
+ import { asWorkerReply } from './protocol.js';
6
6
  const DEADLINE_MS = 60_000;
7
7
  const lock = new ScopeLock();
8
8
  let active = null;
@@ -22,9 +22,8 @@ export interface FoldedChunks {
22
22
  summary: string | null;
23
23
  }
24
24
  export declare function foldCompactedChunks(chunks: ReadonlyArray<AssistantChunk>): FoldedChunks;
25
+ export declare const COMPACTION_TRIGGER_TIERS: ReadonlyArray<readonly [below: number, ratio: number]>;
25
26
  export declare const COMPACTION_TRIGGER_RATIO = 0.95;
26
- export declare const COMPACTION_TRIGGER_RATIO_SMALL = 0.9;
27
- export declare const COMPACTION_SMALL_CTX_SIZE = 4096;
28
27
  export declare function compactionTriggerRatio(ctxSize: number): number;
29
28
  export declare function nearContextLimit(cacheTokens: number | undefined, ctxSize: number | undefined): boolean;
30
29
  export declare function isContextOverflowFailure(message: string | undefined): boolean;
@@ -1,5 +1,5 @@
1
1
  import { CONTEXT_OVERFLOW_MESSAGE } from '@qvac/harness';
2
- import { COMPACTION_MIN_CTX_SIZE } from "./model-context.js";
2
+ import { COMPACTION_MIN_CTX_SIZE } from './model-context.js';
3
3
  export const COMPACTION_KEEP_TURNS = 1;
4
4
  export const COMPACTION_TURN_PREFIX = '[Summary of the earlier conversation in this chat, written by another model. Treat it as established context, not as a new request.]';
5
5
  export function compactionTurn(summary) {
@@ -77,13 +77,15 @@ export function foldCompactedChunks(chunks) {
77
77
  summary: compaction.summary
78
78
  };
79
79
  }
80
+ export const COMPACTION_TRIGGER_TIERS = [
81
+ [12_288, 0.75],
82
+ [16_384, 0.82],
83
+ [32_768, 0.85],
84
+ [65_536, 0.9]
85
+ ];
80
86
  export const COMPACTION_TRIGGER_RATIO = 0.95;
81
- export const COMPACTION_TRIGGER_RATIO_SMALL = 0.9;
82
- export const COMPACTION_SMALL_CTX_SIZE = 4_096;
83
87
  export function compactionTriggerRatio(ctxSize) {
84
- return ctxSize <= COMPACTION_SMALL_CTX_SIZE
85
- ? COMPACTION_TRIGGER_RATIO_SMALL
86
- : COMPACTION_TRIGGER_RATIO;
88
+ return (COMPACTION_TRIGGER_TIERS.find(([below]) => ctxSize < below)?.[1] ?? COMPACTION_TRIGGER_RATIO);
87
89
  }
88
90
  export function nearContextLimit(cacheTokens, ctxSize) {
89
91
  if (!cacheTokens || !ctxSize)
@@ -1,4 +1,4 @@
1
- export { COMPACTION_MIN_CTX_SIZE, contextOptionsForModel, DEFAULT_CONTEXT_SIZE, defaultContextForModel, formatTokenCount, MODEL_CONTEXT_TARGET, maxContextForModel, modelContextTargetForPlatform } from "./model-context.js";
1
+ export { COMPACTION_MIN_CTX_SIZE, contextOptionsForModel, DEFAULT_CONTEXT_SIZE, defaultContextForModel, formatTokenCount, MODEL_CONTEXT_TARGET, maxContextForModel, modelContextTargetForPlatform } from './model-context.js';
2
2
  export const CANCELED_CHAT_MESSAGE = 'Stopped the current run. Send a follow-up to steer the next step.';
3
3
  export const HOMEBREW_BIN_DIRS = ['/opt/homebrew/bin', '/usr/local/bin'];
4
4
  export const SAFE_BIN_NAME = /^[A-Za-z0-9._-]+$/;
@@ -0,0 +1,19 @@
1
+ import type Corestore from 'corestore';
2
+ import type { Hypercore } from 'corestore';
3
+ import type { KeyPair } from 'hypercore-crypto';
4
+ import type IdentityKey from 'keet-identity-key';
5
+ export interface RecoveryKeys {
6
+ readonly coreKeyPair: KeyPair;
7
+ readonly encryptionKey: Buffer;
8
+ }
9
+ export interface RecoveryRecord {
10
+ readonly meshKey: Buffer;
11
+ readonly seed: Buffer;
12
+ readonly createdAt: number;
13
+ }
14
+ export declare function recoveryKeys(identity: IdentityKey): RecoveryKeys;
15
+ export declare function openRecoveryCore(store: Corestore, keys: RecoveryKeys): Hypercore;
16
+ export declare function publishRecovery(core: Hypercore, next: RecoveryRecord): Promise<boolean>;
17
+ export declare function readRecovery(core: Hypercore, { timeout }?: {
18
+ timeout?: number;
19
+ }): Promise<RecoveryRecord | null>;
@@ -0,0 +1,50 @@
1
+ import c from 'compact-encoding';
2
+ const CORE_PATH = [48, 7822, 0, 0, 0];
3
+ const ENCRYPTION_PATH = ['qvac', 'account-recovery', 'seal'];
4
+ const record = {
5
+ preencode(state, r) {
6
+ c.fixed32.preencode(state, r.meshKey);
7
+ c.fixed32.preencode(state, r.seed);
8
+ c.uint.preencode(state, r.createdAt);
9
+ },
10
+ encode(state, r) {
11
+ c.fixed32.encode(state, r.meshKey);
12
+ c.fixed32.encode(state, r.seed);
13
+ c.uint.encode(state, r.createdAt);
14
+ },
15
+ decode(state) {
16
+ return {
17
+ meshKey: Buffer.from(c.fixed32.decode(state)),
18
+ seed: Buffer.from(c.fixed32.decode(state)),
19
+ createdAt: c.uint.decode(state)
20
+ };
21
+ }
22
+ };
23
+ export function recoveryKeys(identity) {
24
+ const { keyChain } = identity;
25
+ return {
26
+ coreKeyPair: keyChain.get(CORE_PATH),
27
+ encryptionKey: keyChain.getSymmetricKey(ENCRYPTION_PATH)
28
+ };
29
+ }
30
+ export function openRecoveryCore(store, keys) {
31
+ return store.get({ keyPair: keys.coreKeyPair, encryptionKey: keys.encryptionKey });
32
+ }
33
+ export async function publishRecovery(core, next) {
34
+ const current = await readRecovery(core);
35
+ if (current?.meshKey.equals(next.meshKey))
36
+ return false;
37
+ await core.append(c.encode(record, next));
38
+ return true;
39
+ }
40
+ export async function readRecovery(core, { timeout } = {}) {
41
+ await core.ready();
42
+ if (core.length === 0) {
43
+ if (timeout === undefined)
44
+ return null;
45
+ await core.get(0, { timeout });
46
+ await core.update({ wait: true });
47
+ }
48
+ const block = await core.get(core.length - 1);
49
+ return block ? c.decode(record, block) : null;
50
+ }
@@ -1,6 +1,6 @@
1
- import { softDeleteChatsForAgent } from "./chat.js";
2
- import { randomId } from "./id.js";
3
- import { softDeleteToolConfigsForAgent } from "./tool-configs.js";
1
+ import { softDeleteChatsForAgent } from './chat.js';
2
+ import { randomId } from './id.js';
3
+ import { softDeleteToolConfigsForAgent } from './tool-configs.js';
4
4
  const AGENTS = '@qvac/agents';
5
5
  const ACTIVE_AGENTS = '@qvac/active-agents';
6
6
  const DEVICES = '@qvac/devices';
@@ -97,7 +97,8 @@ export async function createAgent(store, input) {
97
97
  imageWidth: input.imageWidth || undefined,
98
98
  imageHeight: input.imageHeight || undefined,
99
99
  approvalMode: input.approvalMode === 'skip-all' ? 'skip-all' : 'ask',
100
- disabledToolsets: input.disabledToolsets ?? []
100
+ disabledToolsets: input.disabledToolsets ?? [],
101
+ lenderDeviceId: input.lenderDeviceId ?? undefined
101
102
  };
102
103
  await store.dispatch('put-agent', { agent });
103
104
  return agent;
@@ -159,6 +160,9 @@ export async function updateAgent(store, input) {
159
160
  imageHeight: input.imageHeight || imageBase.imageHeight || undefined,
160
161
  approvalMode: patch(input.approvalMode, current.approvalMode),
161
162
  disabledToolsets: patch(input.disabledToolsets, current.disabledToolsets),
163
+ lenderDeviceId: input.clearLenderDeviceId
164
+ ? undefined
165
+ : patch(input.lenderDeviceId, current.lenderDeviceId),
162
166
  updatedAt: Date.now()
163
167
  };
164
168
  await store.dispatch('put-agent', { agent: updated });
@@ -1,4 +1,4 @@
1
- export declare const RELEASE_LANES: readonly ["dev", "staging", "prod"];
1
+ export declare const RELEASE_LANES: readonly ['dev', 'staging', 'prod'];
2
2
  export type ReleaseLane = (typeof RELEASE_LANES)[number];
3
3
  export interface AppBuildMetadata {
4
4
  readonly version: string;
@@ -11,5 +11,6 @@ export declare function matchApprovalRule(rules: ReadonlyArray<QvacApprovalRule>
11
11
  toolName: string;
12
12
  resource?: ResourceDescriptor | null;
13
13
  agentId?: string;
14
+ memberId?: Buffer | null;
14
15
  }, now?: number): QvacApprovalRule | null;
15
16
  export {};
@@ -1,4 +1,4 @@
1
- import { randomId } from "./id.js";
1
+ import { randomId } from './id.js';
2
2
  const APPROVAL_RULES = '@qvac/approval-rules';
3
3
  export async function listApprovalRules(store) {
4
4
  const snap = store.view.snapshot();
@@ -18,6 +18,8 @@ export async function putApprovalRule(store, input) {
18
18
  }
19
19
  export function matchApprovalRule(rules, input, now = Date.now()) {
20
20
  for (const rule of rules) {
21
+ if (!input.memberId || !rule.memberId?.equals(input.memberId))
22
+ continue;
21
23
  if (rule.expiresAt && rule.expiresAt <= now)
22
24
  continue;
23
25
  if (rule.toolName && rule.toolName !== input.toolName)
@@ -0,0 +1,25 @@
1
+ import type Corestore from 'corestore';
2
+ import type CorestoreStorage from 'hypercore-storage';
3
+ import type { Logger } from '../../index.ts';
4
+ import type { LocalMeshMembership } from '../../spec/local/hyperschema/types.d.ts';
5
+ import { Mesh } from './mesh.ts';
6
+ export declare const NO_ARCHIVE_HELD = "No archive is held for this mesh";
7
+ export interface ArchivedMeshCounts {
8
+ readonly chats: number;
9
+ readonly agents: number;
10
+ readonly knowledge: number;
11
+ }
12
+ export interface ArchivedMeshContents extends ArchivedMeshCounts {
13
+ readonly meshId: string;
14
+ }
15
+ export interface ArchivedMeshMigration extends ArchivedMeshContents {
16
+ readonly migrated: boolean;
17
+ readonly migratedAt: number;
18
+ }
19
+ export declare function withArchivedMesh<T>(store: Corestore, row: LocalMeshMembership, opts: {
20
+ storage: CorestoreStorage;
21
+ deviceId: Buffer;
22
+ logger: Logger | null;
23
+ }, fn: (mesh: Mesh) => Promise<T>): Promise<T>;
24
+ export declare function countContents(mesh: Mesh, into?: Mesh | null): Promise<ArchivedMeshCounts>;
25
+ export declare function migrateContents(from: Mesh, into: Mesh): Promise<ArchivedMeshCounts>;
@@ -0,0 +1,162 @@
1
+ import crypto from 'hypercore-crypto';
2
+ import { parseBlobReferenceCoreKey } from './files/index.js';
3
+ import { Mesh } from './mesh.js';
4
+ const AGENTS = '@qvac/agents';
5
+ const ACTIVE_AGENTS = '@qvac/active-agents';
6
+ const ACTIVE_CHATS = '@qvac/active-chats';
7
+ const ACTIVE_CHAT_GROUPS = '@qvac/active-chat-groups';
8
+ const ACTIVE_TOOL_CONFIGS_BY_AGENT = '@qvac/active-tool-configs-by-agent';
9
+ const CHUNKS = '@qvac/chunks';
10
+ const CHUNKS_BY_CHAT = '@qvac/chunks-by-chat';
11
+ const KNOWLEDGE = '@qvac/knowledge';
12
+ const MIGRATED_SUFFIX = ' (migrated)';
13
+ export const NO_ARCHIVE_HELD = 'No archive is held for this mesh';
14
+ export async function withArchivedMesh(store, row, opts, fn) {
15
+ if (!(await opts.storage.hasCore(crypto.discoveryKey(row.key))))
16
+ throw new Error(NO_ARCHIVE_HELD);
17
+ const mesh = new Mesh(store, {
18
+ seed: row.seed,
19
+ key: row.key,
20
+ deviceId: opts.deviceId,
21
+ writerSeed: row.writerSeed ?? undefined,
22
+ logger: opts.logger
23
+ });
24
+ await mesh.ready();
25
+ try {
26
+ if (mesh.localLength === 0)
27
+ throw new Error(NO_ARCHIVE_HELD);
28
+ await mesh.autobee.update();
29
+ return await fn(mesh);
30
+ }
31
+ finally {
32
+ await mesh.close();
33
+ }
34
+ }
35
+ export async function countContents(mesh, into) {
36
+ const snap = mesh.view.snapshot();
37
+ try {
38
+ return {
39
+ chats: await count(snap.find(ACTIVE_CHATS)),
40
+ agents: await countAgents(snap, into),
41
+ knowledge: (await liveKnowledge(snap)).length
42
+ };
43
+ }
44
+ finally {
45
+ await snap.close();
46
+ }
47
+ }
48
+ async function countAgents(snap, into) {
49
+ if (!into)
50
+ return count(snap.find(ACTIVE_AGENTS));
51
+ let appendable = 0;
52
+ for (const row of await snap.find(ACTIVE_AGENTS).toArray()) {
53
+ if (!(await alreadyHeld(into, row)))
54
+ appendable++;
55
+ }
56
+ return appendable;
57
+ }
58
+ export async function migrateContents(from, into) {
59
+ const snap = from.view.snapshot();
60
+ try {
61
+ const chats = await snap.find(ACTIVE_CHATS).toArray();
62
+ const groups = await snap.find(ACTIVE_CHAT_GROUPS).toArray();
63
+ const knowledge = await liveKnowledge(snap);
64
+ const batch = into.batch();
65
+ const agents = await migrateAgents(snap, into, batch);
66
+ for (const group of groups)
67
+ batch.dispatch('put-chat-group', { group: stripped(group) });
68
+ for (const chat of chats)
69
+ batch.dispatch('put-chat', { chat: stripped(chat) });
70
+ await batch.flush();
71
+ for (const chat of chats)
72
+ await migrateChunks(snap, from, into, chat.id);
73
+ let carried = 0;
74
+ for (const row of knowledge) {
75
+ if (await into.view.get(KNOWLEDGE, { id: row.id })) {
76
+ carried++;
77
+ continue;
78
+ }
79
+ const blobId = await copyBlob(from, into, row.blobId);
80
+ if (!blobId)
81
+ continue;
82
+ batch.dispatch('add-knowledge', { knowledge: { ...stripped(row), blobId } });
83
+ await batch.flush();
84
+ carried++;
85
+ }
86
+ return { chats: chats.length, agents, knowledge: carried };
87
+ }
88
+ finally {
89
+ await snap.close();
90
+ }
91
+ }
92
+ async function migrateAgents(snap, into, batch) {
93
+ const agents = await snap.find(ACTIVE_AGENTS).toArray();
94
+ const names = new Set((await into.view.find(ACTIVE_AGENTS).toArray()).map((a) => a.name));
95
+ let appended = 0;
96
+ for (const row of agents) {
97
+ if (await alreadyHeld(into, row))
98
+ continue;
99
+ const { isDefault, ...agent } = stripped(row);
100
+ const name = isDefault && names.has(agent.name) ? agent.name + MIGRATED_SUFFIX : agent.name;
101
+ batch.dispatch('put-agent', { agent: { ...agent, name } });
102
+ const configs = snap.find(ACTIVE_TOOL_CONFIGS_BY_AGENT, {
103
+ gte: { agentId: row.id },
104
+ lte: { agentId: row.id }
105
+ });
106
+ for await (const settings of configs) {
107
+ batch.dispatch('put-tool-configs', { settings: stripped(settings) });
108
+ }
109
+ appended++;
110
+ }
111
+ return appended;
112
+ }
113
+ async function alreadyHeld(into, row) {
114
+ return !!(await into.view.get(AGENTS, { id: row.id }));
115
+ }
116
+ async function migrateChunks(snap, from, into, chatId) {
117
+ const chunks = await snap
118
+ .find(CHUNKS_BY_CHAT, { gte: { chatId }, lte: { chatId } })
119
+ .toArray();
120
+ const batch = into.batch();
121
+ for (const chunk of chunks) {
122
+ if (await into.view.get(CHUNKS, { id: chunk.id }))
123
+ continue;
124
+ const { seq, updatedAt, attachment, ...op } = stripped(chunk);
125
+ if (!attachment) {
126
+ batch.dispatch('append-chunk', op);
127
+ continue;
128
+ }
129
+ const blobId = await copyBlob(from, into, attachment.blobId);
130
+ if (!blobId)
131
+ continue;
132
+ batch.dispatch('append-chunk', { ...op, attachment: { ...attachment, blobId } });
133
+ await batch.flush();
134
+ }
135
+ await batch.flush();
136
+ }
137
+ async function copyBlob(from, into, reference) {
138
+ if (parseBlobReferenceCoreKey(reference) === undefined)
139
+ return reference;
140
+ let bytes;
141
+ try {
142
+ bytes = await from.files.readBytes(reference, { wait: false });
143
+ }
144
+ catch {
145
+ return null;
146
+ }
147
+ return (await into.files.put(bytes)).reference;
148
+ }
149
+ function stripped(row) {
150
+ const { version: _version, ...rest } = row;
151
+ return rest;
152
+ }
153
+ async function liveKnowledge(snap) {
154
+ const rows = await snap.find(KNOWLEDGE).toArray();
155
+ return rows.filter((row) => !row.deletedAt);
156
+ }
157
+ async function count(stream) {
158
+ let total = 0;
159
+ for await (const _row of stream)
160
+ total++;
161
+ return total;
162
+ }
@@ -1,5 +1,5 @@
1
1
  import ScopeLock from 'scope-lock';
2
- import { findChunksOfType } from "./chunk.js";
2
+ import { findChunksOfType } from './chunk.js';
3
3
  const ACTIVE_CHATS = '@qvac/active-chats';
4
4
  const CHUNKS = '@qvac/chunks';
5
5
  const TERMINAL_RUN_STATES = new Set(['completed', 'failed', 'canceled']);
@@ -15,4 +15,5 @@ export declare function renameChatGroup(store: Mesh, id: string, name: string):
15
15
  export declare function moveChatGroup(store: Mesh, id: string, { afterId }: {
16
16
  afterId?: string | null;
17
17
  }): Promise<QvacChatGroup>;
18
+ export declare function sortChatGroupsByName(store: Mesh): Promise<QvacChatGroup[]>;
18
19
  export declare function deleteChatGroup(store: Mesh, id: string): Promise<QvacChatGroup>;
@@ -1,13 +1,20 @@
1
- import { randomId } from "./id.js";
2
- import { place } from "./rank.js";
1
+ import { randomId } from './id.js';
2
+ import { place } from './rank.js';
3
3
  const CHAT_GROUPS = '@qvac/chat-groups';
4
4
  const ACTIVE_CHAT_GROUPS = '@qvac/active-chat-groups';
5
5
  const NAME_MAX_LENGTH = 100;
6
6
  export function groupSortKey(group) {
7
- return group.rank || group.createdAt;
7
+ return group.rank || 0;
8
8
  }
9
9
  export function byGroupOrder(a, b) {
10
- return groupSortKey(b) - groupSortKey(a) || (a.id < b.id ? -1 : 1);
10
+ const ranked = groupSortKey(b) - groupSortKey(a);
11
+ if (ranked)
12
+ return ranked;
13
+ const an = a.name.toLowerCase();
14
+ const bn = b.name.toLowerCase();
15
+ if (an !== bn)
16
+ return an < bn ? -1 : 1;
17
+ return a.id < b.id ? -1 : 1;
11
18
  }
12
19
  export async function listChatGroupsIn(snap) {
13
20
  const groups = await snap.find(ACTIVE_CHAT_GROUPS).toArray();
@@ -112,6 +119,19 @@ export async function moveChatGroup(store, id, { afterId }) {
112
119
  await batch.flush();
113
120
  return mustGetActiveChatGroup(store, id);
114
121
  }
122
+ export async function sortChatGroupsByName(store) {
123
+ const now = Date.now();
124
+ const batch = store.batch();
125
+ for (const group of await listChatGroups(store)) {
126
+ if (!group.rank)
127
+ continue;
128
+ batch.dispatch('put-chat-group', {
129
+ group: { ...group, rank: 0, updatedAt: Math.max(now, group.updatedAt) }
130
+ });
131
+ }
132
+ await batch.flush();
133
+ return listChatGroups(store);
134
+ }
115
135
  export async function deleteChatGroup(store, id) {
116
136
  const current = await mustGetChatGroup(store, id);
117
137
  const now = Date.now();
@@ -1,7 +1,7 @@
1
1
  import { diagramRepairAccepted, diagramRepairLinks, isDiagramRepairPrompt } from '@qvac/harness/lib/diagram-repair.ts';
2
2
  import { chunkTypeOrdinal } from '../../schema/helpers.js';
3
- import { enrichAll, lastActivity, liveGroupIds } from "./chat.js";
4
- import { foldSearchText } from "./search-fold.js";
3
+ import { enrichAll, lastActivity, liveGroupIds } from './chat.js';
4
+ import { foldSearchText } from './search-fold.js';
5
5
  const ACTIVE_CHATS = '@qvac/active-chats';
6
6
  const CHUNKS_BY_TYPE = '@qvac/chunks-by-type';
7
7
  const DEFAULT_LIMIT = 100;
@@ -1,8 +1,8 @@
1
- import { listChatGroupsIn, mustGetActiveChatGroup } from "./chat-group.js";
2
- import { appendChunk, listChunks, updateOp } from "./chunk.js";
3
- import { randomId } from "./id.js";
4
- import { assertRemovableAt } from "./files/index.js";
5
- import { place } from "./rank.js";
1
+ import { listChatGroupsIn, mustGetActiveChatGroup } from './chat-group.js';
2
+ import { appendChunk, listChunks, updateOp } from './chunk.js';
3
+ import { randomId } from './id.js';
4
+ import { assertRemovableAt } from './files/index.js';
5
+ import { place } from './rank.js';
6
6
  const CHATS = '@qvac/chats';
7
7
  const CHAT_GROUPS = '@qvac/chat-groups';
8
8
  const ACTIVE_CHATS = '@qvac/active-chats';
@@ -46,10 +46,10 @@ export declare function updateOp(chunk: QvacChunk, { id, runStatus, attachment }
46
46
  updatedAt: number;
47
47
  attachment?: undefined;
48
48
  } | {
49
+ runStatus?: undefined;
49
50
  id: string;
50
51
  attachment: import("../../spec/index").QvacChunkContentAttachment;
51
52
  updatedAt: number;
52
- runStatus?: undefined;
53
53
  };
54
54
  export declare function resolveApproval(store: Mesh, { id, approved, scope, expiresAt, agentId }: {
55
55
  id: string;
@@ -1,8 +1,8 @@
1
- import { CHUNK_PAYLOAD_FIELDS, ragSourcesWithinBounds } from "../../schema/qvac.js";
1
+ import { CHUNK_PAYLOAD_FIELDS, ragSourcesWithinBounds } from '../../schema/qvac.js';
2
2
  import { chunkTypeOrdinal, mediaKindOrdinal } from '../../schema/helpers.js';
3
- import { putApprovalRule } from "./approval-rules.js";
4
- import { linkAttachment } from "./attachment-link.js";
5
- import { randomId } from "./id.js";
3
+ import { putApprovalRule } from './approval-rules.js';
4
+ import { linkAttachment } from './attachment-link.js';
5
+ import { randomId } from './id.js';
6
6
  const CHUNKS = '@qvac/chunks';
7
7
  const CHUNKS_BY_CHAT = '@qvac/chunks-by-chat';
8
8
  const CHUNKS_BY_TYPE = '@qvac/chunks-by-type';
@@ -1,4 +1,4 @@
1
- import { trackActivity } from "./activity.js";
1
+ import { trackActivity } from './activity.js';
2
2
  const AGENTS = '@qvac/agents';
3
3
  export function registerAgentRoutes(router) {
4
4
  router.add('@qvac/put-agent', trackActivity(async ({ agent }, { tx, log }) => {
@@ -1,14 +1,16 @@
1
- import { trackActivity } from "./activity.js";
1
+ import { liveDeviceForWriter, trackActivity } from './activity.js';
2
2
  const APPROVAL_RULES = '@qvac/approval-rules';
3
3
  export function registerApprovalRuleRoutes(router) {
4
- router.add('@qvac/put-approval-rule', trackActivity(async ({ rule }, { tx, log }) => {
4
+ router.add('@qvac/put-approval-rule', trackActivity(async ({ rule }, { tx, node, log }) => {
5
5
  const existing = await tx.get(APPROVAL_RULES, { id: rule.id });
6
6
  if (existing && existing.updatedAt > rule.updatedAt) {
7
7
  log?.debug('contract', 'put-approval-rule dropped: stale updatedAt', { id: rule.id });
8
8
  return;
9
9
  }
10
- await tx.insert(APPROVAL_RULES, rule);
10
+ const author = await liveDeviceForWriter(tx, node.key);
11
+ const stored = { ...rule, memberId: author?.memberId };
12
+ await tx.insert(APPROVAL_RULES, stored);
11
13
  log?.info('contract', 'approval rule set', { id: rule.id });
12
- return rule;
14
+ return stored;
13
15
  }));
14
16
  }
@@ -1,4 +1,4 @@
1
- import { verifyDeviceAttestation } from "../device-attestation.js";
1
+ import { verifyDeviceAttestation } from '../device-attestation.js';
2
2
  const DEVICE_ATTESTATIONS = '@qvac/device-attestations';
3
3
  export function registerAttestationRoutes(router) {
4
4
  router.add('@qvac/attest-device', async (payload, { tx, meshDevicePublicKey, log }) => {
@@ -1,4 +1,4 @@
1
- import { trackActivity } from "./activity.js";
1
+ import { trackActivity } from './activity.js';
2
2
  const CHAT_GROUPS = '@qvac/chat-groups';
3
3
  export function registerChatGroupRoutes(router) {
4
4
  router.add('@qvac/put-chat-group', trackActivity(async ({ group }, { tx, log }) => {
@@ -1,4 +1,4 @@
1
- import { trackActivity } from "./activity.js";
1
+ import { trackActivity } from './activity.js';
2
2
  const CHATS = '@qvac/chats';
3
3
  export function registerChatRoutes(router) {
4
4
  router.add('@qvac/put-chat', trackActivity(async ({ chat }, { tx, log }) => {
@@ -1,5 +1,5 @@
1
- import { devicesByWriterKey, trackActivity } from "./activity.js";
2
- import { CHUNK_PAYLOAD_FIELDS, ragSourcesWithinBounds } from "../../../schema/qvac.js";
1
+ import { devicesByWriterKey, trackActivity } from './activity.js';
2
+ import { CHUNK_PAYLOAD_FIELDS, ragSourcesWithinBounds } from '../../../schema/qvac.js';
3
3
  import { chunkTypeOrdinal } from '../../../schema/helpers.js';
4
4
  const CHUNKS = '@qvac/chunks';
5
5
  const CHUNKS_BY_TYPE = '@qvac/chunks-by-type';
@@ -0,0 +1,11 @@
1
+ import type { Router } from '../../../spec/mesh/hyperdispatch/index.js';
2
+ declare const DROPPED: readonly ['@qvac/append-chunk', '@qvac/update-chunk', '@qvac/resolve-approval', '@qvac/put-agent', '@qvac/put-approval-rule', '@qvac/seed-defaults', '@qvac/add-knowledge', '@qvac/remove-knowledge', '@qvac/add-knowledge-artifact', '@qvac/claim-indexing', '@qvac/resolve-indexing', '@qvac/put-chat', '@qvac/put-tool-configs', '@qvac/append-tool-activity', '@qvac/migrate-agent-catalog', '@qvac/put-chat-group', '@qvac/put-joined-mesh'];
3
+ export type DroppedComputeRoute = (typeof DROPPED)[number];
4
+ export declare function droppedComputeRoutes(): ReadonlyArray<DroppedComputeRoute>;
5
+ export declare class ComputeRouteDropped extends Error {
6
+ readonly route: string;
7
+ constructor(route: string);
8
+ }
9
+ export declare function assertComputeRoute(compute: boolean, name: string): void;
10
+ export declare function registerComputeDrops(router: Router): void;
11
+ export {};
@@ -0,0 +1,45 @@
1
+ const DROPPED = [
2
+ '@qvac/append-chunk',
3
+ '@qvac/update-chunk',
4
+ '@qvac/resolve-approval',
5
+ '@qvac/put-agent',
6
+ '@qvac/put-approval-rule',
7
+ '@qvac/seed-defaults',
8
+ '@qvac/add-knowledge',
9
+ '@qvac/remove-knowledge',
10
+ '@qvac/add-knowledge-artifact',
11
+ '@qvac/claim-indexing',
12
+ '@qvac/resolve-indexing',
13
+ '@qvac/put-chat',
14
+ '@qvac/put-tool-configs',
15
+ '@qvac/append-tool-activity',
16
+ '@qvac/migrate-agent-catalog',
17
+ '@qvac/put-chat-group',
18
+ '@qvac/put-joined-mesh'
19
+ ];
20
+ const DROPPED_ROUTES = new Set(DROPPED);
21
+ export function droppedComputeRoutes() {
22
+ return DROPPED;
23
+ }
24
+ export class ComputeRouteDropped extends Error {
25
+ route;
26
+ constructor(route) {
27
+ super(`${route} is dropped on a compute mesh: it carries only delegated work`);
28
+ this.name = 'ComputeRouteDropped';
29
+ this.route = route;
30
+ }
31
+ }
32
+ export function assertComputeRoute(compute, name) {
33
+ if (!compute)
34
+ return;
35
+ const route = `@qvac/${name}`;
36
+ if (DROPPED_ROUTES.has(route))
37
+ throw new ComputeRouteDropped(route);
38
+ }
39
+ export function registerComputeDrops(router) {
40
+ for (const name of DROPPED) {
41
+ router.add(name, async (_op, { log }) => {
42
+ log?.debug('contract', `${name} dropped: this mesh carries only delegated work`);
43
+ });
44
+ }
45
+ }