@qvac/core 1.0.0-rc.7 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (237) hide show
  1. package/CHANGELOG.md +241 -3
  2. package/README.md +1 -0
  3. package/dist-lib/lib/api/attachments.d.ts +1 -1
  4. package/dist-lib/lib/api/attachments.js +11 -0
  5. package/dist-lib/lib/api/chunks.d.ts +4 -2
  6. package/dist-lib/lib/api/chunks.js +6 -3
  7. package/dist-lib/lib/api/device-routes.d.ts +6 -1
  8. package/dist-lib/lib/api/device-routes.js +20 -1
  9. package/dist-lib/lib/api/devices.js +6 -18
  10. package/dist-lib/lib/api/execution.d.ts +6 -2
  11. package/dist-lib/lib/api/execution.js +29 -3
  12. package/dist-lib/lib/api/host-run-log.d.ts +7 -1
  13. package/dist-lib/lib/api/host-run-log.js +3 -1
  14. package/dist-lib/lib/api/index.d.ts +3 -1
  15. package/dist-lib/lib/api/index.js +17 -6
  16. package/dist-lib/lib/api/members.js +13 -29
  17. package/dist-lib/lib/api/mesh.d.ts +2 -1
  18. package/dist-lib/lib/api/projects.d.ts +1 -1
  19. package/dist-lib/lib/api/projects.js +9 -5
  20. package/dist-lib/lib/api/rag-label.d.ts +4 -0
  21. package/dist-lib/lib/api/rag-label.js +21 -0
  22. package/dist-lib/lib/api/rag-lexical.d.ts +22 -0
  23. package/dist-lib/lib/api/rag-lexical.js +1058 -0
  24. package/dist-lib/lib/api/rag-manifest.d.ts +13 -0
  25. package/dist-lib/lib/api/rag-manifest.js +46 -0
  26. package/dist-lib/lib/api/rag-outline.d.ts +36 -0
  27. package/dist-lib/lib/api/rag-outline.js +426 -0
  28. package/dist-lib/lib/api/rag-plugin.d.ts +20 -0
  29. package/dist-lib/lib/api/rag-plugin.js +70 -0
  30. package/dist-lib/lib/api/rag-synthesis.d.ts +7 -0
  31. package/dist-lib/lib/api/rag-synthesis.js +102 -0
  32. package/dist-lib/lib/api/rag-targets.d.ts +23 -0
  33. package/dist-lib/lib/api/rag-targets.js +215 -0
  34. package/dist-lib/lib/api/rag-window.d.ts +5 -0
  35. package/dist-lib/lib/api/rag-window.js +46 -0
  36. package/dist-lib/lib/api/rag.d.ts +3 -2
  37. package/dist-lib/lib/api/rag.js +421 -184
  38. package/dist-lib/lib/api/served.js +8 -14
  39. package/dist-lib/lib/api/workspace.d.ts +8 -1
  40. package/dist-lib/lib/api/workspace.js +27 -13
  41. package/dist-lib/lib/assistant/harness.d.ts +9 -1
  42. package/dist-lib/lib/assistant/history.d.ts +11 -2
  43. package/dist-lib/lib/assistant/history.js +74 -4
  44. package/dist-lib/lib/assistant/media-round.d.ts +61 -0
  45. package/dist-lib/lib/assistant/media-round.js +111 -0
  46. package/dist-lib/lib/assistant/message.d.ts +7 -0
  47. package/dist-lib/lib/assistant/model-round.d.ts +19 -1
  48. package/dist-lib/lib/assistant/model-round.js +163 -28
  49. package/dist-lib/lib/assistant/pdf-pages.d.ts +16 -1
  50. package/dist-lib/lib/assistant/pdf-pages.js +67 -3
  51. package/dist-lib/lib/assistant/round-host.d.ts +22 -0
  52. package/dist-lib/lib/assistant/round-host.js +142 -8
  53. package/dist-lib/lib/assistant/upload.d.ts +12 -0
  54. package/dist-lib/lib/assistant/upload.js +36 -0
  55. package/dist-lib/lib/assistant-client.d.ts +1 -0
  56. package/dist-lib/lib/assistant-client.js +40 -19
  57. package/dist-lib/lib/assistant-tree.d.ts +2 -0
  58. package/dist-lib/lib/assistant-tree.js +48 -1
  59. package/dist-lib/lib/assistant.d.ts +18 -1
  60. package/dist-lib/lib/assistant.js +484 -95
  61. package/dist-lib/lib/client.d.ts +1 -0
  62. package/dist-lib/lib/client.js +4 -1
  63. package/dist-lib/lib/compaction.js +2 -2
  64. package/dist-lib/lib/core/agent.js +12 -45
  65. package/dist-lib/lib/core/approval-rules.js +1 -8
  66. package/dist-lib/lib/core/archived-mesh.d.ts +2 -1
  67. package/dist-lib/lib/core/archived-mesh.js +12 -8
  68. package/dist-lib/lib/core/chat-copy.d.ts +18 -3
  69. package/dist-lib/lib/core/chat-copy.js +74 -25
  70. package/dist-lib/lib/core/chat-fork.js +15 -6
  71. package/dist-lib/lib/core/chat-group.js +16 -24
  72. package/dist-lib/lib/core/chat-move.d.ts +9 -0
  73. package/dist-lib/lib/core/chat-move.js +94 -3
  74. package/dist-lib/lib/core/chat-order.js +12 -18
  75. package/dist-lib/lib/core/chat.js +38 -31
  76. package/dist-lib/lib/core/chunk.d.ts +2 -2
  77. package/dist-lib/lib/core/chunk.js +18 -25
  78. package/dist-lib/lib/core/collections.d.ts +2 -0
  79. package/dist-lib/lib/core/collections.js +2 -0
  80. package/dist-lib/lib/core/contract/activity.d.ts +4 -0
  81. package/dist-lib/lib/core/contract/activity.js +34 -4
  82. package/dist-lib/lib/core/contract/chat-group.d.ts +1 -0
  83. package/dist-lib/lib/core/contract/chat-group.js +21 -1
  84. package/dist-lib/lib/core/contract/chat.d.ts +9 -0
  85. package/dist-lib/lib/core/contract/chat.js +127 -5
  86. package/dist-lib/lib/core/contract/chunks.d.ts +1 -0
  87. package/dist-lib/lib/core/contract/chunks.js +37 -6
  88. package/dist-lib/lib/core/contract/features.d.ts +21 -0
  89. package/dist-lib/lib/core/contract/features.js +22 -0
  90. package/dist-lib/lib/core/contract/index.js +2 -0
  91. package/dist-lib/lib/core/contract/indexing.js +4 -2
  92. package/dist-lib/lib/core/contract/knowledge.js +5 -4
  93. package/dist-lib/lib/core/contract/members.js +16 -10
  94. package/dist-lib/lib/core/contract/mesh-kind.d.ts +1 -0
  95. package/dist-lib/lib/core/contract/mesh-kind.js +3 -1
  96. package/dist-lib/lib/core/contract/projects.d.ts +5 -0
  97. package/dist-lib/lib/core/contract/projects.js +13 -5
  98. package/dist-lib/lib/core/contract/roles.js +32 -4
  99. package/dist-lib/lib/core/contract/run-requests.d.ts +1 -0
  100. package/dist-lib/lib/core/contract/run-requests.js +35 -2
  101. package/dist-lib/lib/core/contract/seed-defaults.js +2 -2
  102. package/dist-lib/lib/core/contract/tool-configs.js +3 -2
  103. package/dist-lib/lib/core/contract/workspace.d.ts +2 -0
  104. package/dist-lib/lib/core/contract/workspace.js +40 -7
  105. package/dist-lib/lib/core/contract/writers.js +2 -2
  106. package/dist-lib/lib/core/departures.d.ts +3 -1
  107. package/dist-lib/lib/core/departures.js +3 -0
  108. package/dist-lib/lib/core/devices.js +1 -8
  109. package/dist-lib/lib/core/files/attachments.d.ts +2 -0
  110. package/dist-lib/lib/core/files/attachments.js +19 -1
  111. package/dist-lib/lib/core/files/index.d.ts +20 -4
  112. package/dist-lib/lib/core/files/index.js +132 -21
  113. package/dist-lib/lib/core/files/processing/document.d.ts +4 -0
  114. package/dist-lib/lib/core/files/processing/document.js +7 -0
  115. package/dist-lib/lib/core/files/processing/index.d.ts +13 -0
  116. package/dist-lib/lib/core/files/processing/index.js +144 -12
  117. package/dist-lib/lib/core/files/processing/protocol.js +13 -34
  118. package/dist-lib/lib/core/files/processing/state.d.ts +2 -0
  119. package/dist-lib/lib/core/files/rag/build.d.ts +19 -2
  120. package/dist-lib/lib/core/files/rag/build.js +123 -19
  121. package/dist-lib/lib/core/files/rag/failure.js +2 -1
  122. package/dist-lib/lib/core/files/rag/index.d.ts +11 -3
  123. package/dist-lib/lib/core/files/rag/index.js +13 -1
  124. package/dist-lib/lib/core/files/rag/load.d.ts +6 -3
  125. package/dist-lib/lib/core/files/rag/load.js +27 -6
  126. package/dist-lib/lib/core/files/rag/plugin-index.d.ts +32 -0
  127. package/dist-lib/lib/core/files/rag/plugin-index.js +127 -0
  128. package/dist-lib/lib/core/files/rag/produce.d.ts +5 -3
  129. package/dist-lib/lib/core/files/rag/produce.js +104 -16
  130. package/dist-lib/lib/core/files/rag/retrieval/full-text.d.ts +3 -1
  131. package/dist-lib/lib/core/files/rag/retrieval/full-text.js +62 -13
  132. package/dist-lib/lib/core/files/rag/text-cache.d.ts +28 -0
  133. package/dist-lib/lib/core/files/rag/text-cache.js +141 -0
  134. package/dist-lib/lib/core/files/records/knowledge.d.ts +1 -3
  135. package/dist-lib/lib/core/files/records/knowledge.js +7 -40
  136. package/dist-lib/lib/core/files/records/reclaim.js +5 -10
  137. package/dist-lib/lib/core/files/upload.js +68 -41
  138. package/dist-lib/lib/core/fs-drives.js +14 -26
  139. package/dist-lib/lib/core/invite.d.ts +1 -0
  140. package/dist-lib/lib/core/invite.js +4 -2
  141. package/dist-lib/lib/core/local/files.d.ts +1 -1
  142. package/dist-lib/lib/core/local/files.js +5 -5
  143. package/dist-lib/lib/core/local/index.d.ts +13 -6
  144. package/dist-lib/lib/core/local/index.js +103 -69
  145. package/dist-lib/lib/core/local/run-logs.d.ts +1 -1
  146. package/dist-lib/lib/core/local/run-logs.js +5 -5
  147. package/dist-lib/lib/core/mesh-processor.d.ts +19 -0
  148. package/dist-lib/lib/core/mesh-processor.js +87 -0
  149. package/dist-lib/lib/core/mesh.d.ts +48 -5
  150. package/dist-lib/lib/core/mesh.js +318 -129
  151. package/dist-lib/lib/core/migrations/agent-catalog.js +2 -8
  152. package/dist-lib/lib/core/migrations/agent-tools-scope.js +5 -11
  153. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.d.ts +88 -0
  154. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.js +731 -0
  155. package/dist-lib/lib/core/migrations/writer-links.d.ts +2 -0
  156. package/dist-lib/lib/core/migrations/writer-links.js +32 -0
  157. package/dist-lib/lib/core/project-keys.d.ts +6 -0
  158. package/dist-lib/lib/core/project-keys.js +11 -0
  159. package/dist-lib/lib/core/public-mesh.d.ts +3 -0
  160. package/dist-lib/lib/core/public-mesh.js +10 -8
  161. package/dist-lib/lib/core/run-requests.d.ts +3 -0
  162. package/dist-lib/lib/core/run-requests.js +21 -1
  163. package/dist-lib/lib/core/skill-availability.d.ts +33 -0
  164. package/dist-lib/lib/core/skill-availability.js +67 -0
  165. package/dist-lib/lib/core/sync/background.d.ts +0 -1
  166. package/dist-lib/lib/core/sync/background.js +2 -1
  167. package/dist-lib/lib/core/sync/changed.d.ts +4 -2
  168. package/dist-lib/lib/core/sync/changed.js +1 -1
  169. package/dist-lib/lib/core/sync/index.js +52 -10
  170. package/dist-lib/lib/core/sync/view-updates.d.ts +18 -12
  171. package/dist-lib/lib/core/sync/view-updates.js +82 -91
  172. package/dist-lib/lib/core/sync-status.js +97 -41
  173. package/dist-lib/lib/core/tool-activity.js +6 -12
  174. package/dist-lib/lib/core/tool-configs.js +17 -29
  175. package/dist-lib/lib/core/upgrade-summary.d.ts +19 -0
  176. package/dist-lib/lib/core/upgrade-summary.js +67 -0
  177. package/dist-lib/lib/core/view-read.d.ts +4 -0
  178. package/dist-lib/lib/core/view-read.js +23 -0
  179. package/dist-lib/lib/core/workspace-upgrade.d.ts +7 -0
  180. package/dist-lib/lib/core/workspace-upgrade.js +27 -16
  181. package/dist-lib/lib/core.d.ts +45 -42
  182. package/dist-lib/lib/core.js +675 -640
  183. package/dist-lib/lib/errors.d.ts +24 -0
  184. package/dist-lib/lib/errors.js +24 -0
  185. package/dist-lib/lib/llm-model-names.d.ts +1 -1
  186. package/dist-lib/lib/llm-model-names.js +1 -1
  187. package/dist-lib/lib/mesh-scoped-engine.js +4 -0
  188. package/dist-lib/lib/model-context.js +1 -2
  189. package/dist-lib/lib/model-download.d.ts +6 -1
  190. package/dist-lib/lib/model-download.js +16 -3
  191. package/dist-lib/lib/oauth/resolve.js +29 -8
  192. package/dist-lib/lib/oauth/token-exchange-core.js +11 -0
  193. package/dist-lib/lib/probe-rounds.d.ts +7 -2
  194. package/dist-lib/lib/probe-rounds.js +6 -1
  195. package/dist-lib/lib/run-transcript.d.ts +4 -1
  196. package/dist-lib/lib/run-transcript.js +15 -6
  197. package/dist-lib/schema/engine.js +83 -6
  198. package/dist-lib/schema/indexes.d.ts +3 -0
  199. package/dist-lib/schema/indexes.js +5 -0
  200. package/dist-lib/schema/local.js +11 -2
  201. package/dist-lib/schema/qvac.js +49 -5
  202. package/dist-lib/spec/bind.js +34 -0
  203. package/dist-lib/spec/calls.js +5 -0
  204. package/dist-lib/spec/capabilities.d.ts +17 -0
  205. package/dist-lib/spec/hrpc/hrpc.json +65 -0
  206. package/dist-lib/spec/hrpc/index.js +68 -5
  207. package/dist-lib/spec/hrpc/messages.js +260 -23
  208. package/dist-lib/spec/hyperschema/index.js +260 -23
  209. package/dist-lib/spec/hyperschema/schema.json +181 -0
  210. package/dist-lib/spec/hyperschema/types.d.ts +48 -0
  211. package/dist-lib/spec/local/hyperdb/messages.js +270 -224
  212. package/dist-lib/spec/local/hyperschema/index.js +73 -38
  213. package/dist-lib/spec/local/hyperschema/schema.json +31 -0
  214. package/dist-lib/spec/local/hyperschema/types.d.ts +8 -0
  215. package/dist-lib/spec/mesh/hyperdb/db.json +39 -2
  216. package/dist-lib/spec/mesh/hyperdb/index.js +120 -3
  217. package/dist-lib/spec/mesh/hyperdb/messages.js +1328 -838
  218. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +30 -0
  219. package/dist-lib/spec/mesh/hyperdispatch/index.js +86 -1
  220. package/dist-lib/spec/mesh/hyperdispatch/messages.js +682 -287
  221. package/dist-lib/spec/mesh/hyperschema/index.js +682 -287
  222. package/dist-lib/spec/mesh/hyperschema/schema.json +201 -0
  223. package/dist-lib/spec/mesh/hyperschema/types.d.ts +52 -0
  224. package/package.json +82 -71
  225. package/tui/README.md +52 -0
  226. package/tui/app.mjs +69 -12
  227. package/tui/boot.mjs +27 -6
  228. package/tui/cli.mjs +93 -0
  229. package/tui/index.mjs +2 -87
  230. package/tui/lib/attachment-files.mjs +82 -0
  231. package/tui/lib/reopen-meshes.mjs +15 -0
  232. package/tui/lib/updater.mjs +86 -0
  233. package/tui/main.mjs +29 -57
  234. package/worker/assistant-sidecar.mjs +10 -3
  235. package/worker/stow-entry.mjs +3 -52
  236. package/dist-lib/lib/core/chat-project.d.ts +0 -2
  237. package/dist-lib/lib/core/chat-project.js +0 -15
@@ -139,6 +139,14 @@ declare const DEFINITIONS: {
139
139
  readonly code: 100131;
140
140
  readonly message: (route: string) => string;
141
141
  };
142
+ readonly MESH_VIEW_UNAVAILABLE: {
143
+ readonly code: 100132;
144
+ readonly message: () => string;
145
+ };
146
+ readonly MESH_CLOSED_BEFORE_WRITE: {
147
+ readonly code: 100133;
148
+ readonly message: () => string;
149
+ };
142
150
  readonly INVITE_INVALID: {
143
151
  readonly code: 100201;
144
152
  readonly message: () => string;
@@ -495,6 +503,14 @@ declare const DEFINITIONS: {
495
503
  readonly code: 100730;
496
504
  readonly message: (chunkId: string) => string;
497
505
  };
506
+ readonly RUN_REQUEST_NOT_MOVABLE: {
507
+ readonly code: 100732;
508
+ readonly message: (chunkId: string) => string;
509
+ };
510
+ readonly RUN_REQUEST_OFFLINE: {
511
+ readonly code: 100733;
512
+ readonly message: (chunkId: string) => string;
513
+ };
498
514
  readonly APPROVAL_RULE_NOT_FOUND: {
499
515
  readonly code: 100731;
500
516
  readonly message: (ruleId: string) => string;
@@ -595,6 +611,10 @@ declare const DEFINITIONS: {
595
611
  readonly code: 100918;
596
612
  readonly message: () => string;
597
613
  };
614
+ readonly UPLOAD_BLOB_INCOMPLETE: {
615
+ readonly code: 100919;
616
+ readonly message: () => string;
617
+ };
598
618
  readonly TOOL_CONFIGS_INVALID: {
599
619
  readonly code: 101001;
600
620
  readonly message: () => string;
@@ -735,6 +755,10 @@ declare const DEFINITIONS: {
735
755
  readonly code: 101220;
736
756
  readonly message: () => string;
737
757
  };
758
+ readonly OAUTH_GRANT_REVOKED: {
759
+ readonly code: 101221;
760
+ readonly message: () => string;
761
+ };
738
762
  readonly SIDECAR_ENTRY_MISSING: {
739
763
  readonly code: 101301;
740
764
  readonly message: () => string;
@@ -113,6 +113,14 @@ const DEFINITIONS = {
113
113
  code: 100131,
114
114
  message: (route) => `${route} reads and writes a workspace: name a workspace's meshId, not the account's`
115
115
  },
116
+ MESH_VIEW_UNAVAILABLE: {
117
+ code: 100132,
118
+ message: () => 'This mesh is still syncing: the rows this read needs have not reached this device'
119
+ },
120
+ MESH_CLOSED_BEFORE_WRITE: {
121
+ code: 100133,
122
+ message: () => 'The mesh closed before this write reached its log; nothing was written'
123
+ },
116
124
  INVITE_INVALID: { code: 100201, message: () => 'Invalid mesh invite' },
117
125
  MESH_JOIN_CANCELED: { code: 100202, message: () => 'Mesh join canceled' },
118
126
  JOIN_NOT_PERMITTED: {
@@ -409,6 +417,14 @@ const DEFINITIONS = {
409
417
  code: 100730,
410
418
  message: (chunkId) => `run-request ${chunkId} is not open to take`
411
419
  },
420
+ RUN_REQUEST_NOT_MOVABLE: {
421
+ code: 100732,
422
+ message: (chunkId) => `run-request ${chunkId} is not held by another of your devices, or its run has ended`
423
+ },
424
+ RUN_REQUEST_OFFLINE: {
425
+ code: 100733,
426
+ message: (chunkId) => `this device is offline, so it cannot take run-request ${chunkId} from the device that holds it`
427
+ },
412
428
  APPROVAL_RULE_NOT_FOUND: {
413
429
  code: 100731,
414
430
  message: (ruleId) => `no approval rule of yours: ${ruleId}`
@@ -509,6 +525,10 @@ const DEFINITIONS = {
509
525
  code: 100918,
510
526
  message: () => 'a knowledge cap must be at least 1 byte'
511
527
  },
528
+ UPLOAD_BLOB_INCOMPLETE: {
529
+ code: 100919,
530
+ message: () => 'uploadAttachment: a blobId comes with raw and totalBytes, and no data'
531
+ },
512
532
  TOOL_CONFIGS_INVALID: {
513
533
  code: 101001,
514
534
  message: () => 'tool configs must be a plain object'
@@ -650,6 +670,10 @@ const DEFINITIONS = {
650
670
  code: 101220,
651
671
  message: () => 'OAuth client registration timed out'
652
672
  },
673
+ OAUTH_GRANT_REVOKED: {
674
+ code: 101221,
675
+ message: () => 'OAuth grant was revoked or expired (invalid_grant); sign in again'
676
+ },
653
677
  SIDECAR_ENTRY_MISSING: {
654
678
  code: 101301,
655
679
  message: () => 'sidecar mode needs a stowed bundle entry'
@@ -1 +1 @@
1
- export { QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_27B, QWEN_36_35B_A3B, QWEN_38_27B, MEDPSY_1_7B, MEDPSY_4B } from '@qvac/harness/model-catalog';
1
+ export { QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_35B_A3B, QWEN_38_27B, MEDPSY_1_7B, MEDPSY_4B } from '@qvac/harness/model-catalog';
@@ -1 +1 @@
1
- export { QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_27B, QWEN_36_35B_A3B, QWEN_38_27B, MEDPSY_1_7B, MEDPSY_4B } from '@qvac/harness/model-catalog';
1
+ export { QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_35B_A3B, QWEN_38_27B, MEDPSY_1_7B, MEDPSY_4B } from '@qvac/harness/model-catalog';
@@ -28,6 +28,8 @@ export const MESH_SCOPED = new Set([
28
28
  'setMeshName',
29
29
  'listChatActivity',
30
30
  'chatActivityWatch',
31
+ 'chatSkillAvailability',
32
+ 'chatSkillAvailabilityWatch',
31
33
  'searchChats',
32
34
  'createChatGroup',
33
35
  'listChatGroups',
@@ -51,9 +53,11 @@ export const MESH_SCOPED = new Set([
51
53
  'reopenModelRequest',
52
54
  'modelRequestsWatch',
53
55
  'takeRunRequest',
56
+ 'continueRunHere',
54
57
  'uploadAttachment',
55
58
  'downloadAttachment',
56
59
  'deleteAttachment',
60
+ 'putBlob',
57
61
  'uploadKnowledge',
58
62
  'downloadKnowledge',
59
63
  'removeKnowledge',
@@ -1,4 +1,4 @@
1
- import { QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_27B, QWEN_36_35B_A3B, QWEN_38_27B, MEDPSY_1_7B, MEDPSY_4B } from './llm-model-names.js';
1
+ import { QWEN_35_2B, QWEN_35_4B, QWEN_35_9B, QWEN_36_35B_A3B, QWEN_38_27B, MEDPSY_1_7B, MEDPSY_4B } from './llm-model-names.js';
2
2
  const QWEN_35_MAX_CONTEXT = 262_144;
3
3
  const QWEN_36_MAX_CONTEXT = 262_144;
4
4
  const QWEN_38_MAX_CONTEXT = 262_144;
@@ -25,7 +25,6 @@ const MODEL_CONTEXT_SPECS = [
25
25
  { name: QWEN_35_2B, maxContextTokens: QWEN_35_MAX_CONTEXT, parameterBillions: 2 },
26
26
  { name: QWEN_35_4B, maxContextTokens: QWEN_35_MAX_CONTEXT, parameterBillions: 4 },
27
27
  { name: QWEN_35_9B, maxContextTokens: QWEN_35_MAX_CONTEXT, parameterBillions: 9 },
28
- { name: QWEN_36_27B, maxContextTokens: QWEN_36_MAX_CONTEXT, parameterBillions: 27 },
29
28
  { name: QWEN_36_35B_A3B, maxContextTokens: QWEN_36_MAX_CONTEXT, parameterBillions: 35 },
30
29
  { name: QWEN_38_27B, maxContextTokens: QWEN_38_MAX_CONTEXT, parameterBillions: 27 },
31
30
  { name: MEDPSY_1_7B, maxContextTokens: MEDPSY_1_7B_MAX_CONTEXT, parameterBillions: 1.7 },
@@ -25,6 +25,9 @@ export interface CacheWaitOptions {
25
25
  readonly onProgress?: (percentage: number) => void;
26
26
  readonly onStall?: () => void;
27
27
  }
28
+ export interface RetryOptions {
29
+ readonly sibling?: boolean;
30
+ }
28
31
  interface DownloadHarness {
29
32
  list?(options?: {
30
33
  cachedOnly?: boolean;
@@ -138,6 +141,7 @@ export declare class ModelDownloadReconciler {
138
141
  private readonly _observedProgress;
139
142
  private readonly _observedSpeed;
140
143
  private readonly _requestedModels;
144
+ private readonly _siblingRequests;
141
145
  private readonly _heldLoads;
142
146
  private readonly _releasing;
143
147
  private readonly _targetTotals;
@@ -174,7 +178,8 @@ export declare class ModelDownloadReconciler {
174
178
  private _transfer;
175
179
  private _completeTransfer;
176
180
  waitUntilCached(model: string, signal: AbortSignal, { onHold, onProgress, onStall }?: CacheWaitOptions): Promise<void>;
177
- retry(name: string): Promise<void>;
181
+ retry(name: string, { sibling }?: RetryOptions): Promise<void>;
182
+ siblingResumed(name: string): void;
178
183
  release<T>(name: string, removeFiles: () => Promise<T>): Promise<T>;
179
184
  close(): Promise<void>;
180
185
  private _watchConfig;
@@ -34,6 +34,7 @@ export class ModelDownloadReconciler {
34
34
  _observedProgress = new Map();
35
35
  _observedSpeed = new Map();
36
36
  _requestedModels = new Set();
37
+ _siblingRequests = new Set();
37
38
  _heldLoads = new Set();
38
39
  _releasing = new Set();
39
40
  _targetTotals = new Map();
@@ -227,10 +228,15 @@ export class ModelDownloadReconciler {
227
228
  this._kick();
228
229
  });
229
230
  }
230
- async retry(name) {
231
+ async retry(name, { sibling = false } = {}) {
231
232
  if (this._closed)
232
233
  throw new CoreError('MODEL_DOWNLOAD_CLOSED');
233
- this._requestedModels.add(name);
234
+ if (!sibling) {
235
+ this._requestedModels.add(name);
236
+ }
237
+ else if (!this._requestedModels.has(name)) {
238
+ this._siblingRequests.add(name);
239
+ }
234
240
  this._attemptGenerations.set(name, this._attemptGeneration(name) + 1);
235
241
  const demand = this._demands.get(name);
236
242
  if (demand) {
@@ -243,11 +249,17 @@ export class ModelDownloadReconciler {
243
249
  }
244
250
  this._kick();
245
251
  }
252
+ siblingResumed(name) {
253
+ if (this._config?.pausedModels?.includes(name) && this._requestedModels.delete(name)) {
254
+ this._siblingRequests.add(name);
255
+ }
256
+ }
246
257
  async release(name, removeFiles) {
247
258
  if (this._closed)
248
259
  throw new CoreError('MODEL_DOWNLOAD_CLOSED');
249
260
  this._releasing.add(name);
250
261
  this._requestedModels.delete(name);
262
+ this._siblingRequests.delete(name);
251
263
  this._handled.delete(name);
252
264
  try {
253
265
  if (this._active?.model === name) {
@@ -616,7 +628,7 @@ export class ModelDownloadReconciler {
616
628
  }
617
629
  }
618
630
  }
619
- for (const name of this._requestedModels) {
631
+ for (const name of [...this._requestedModels, ...this._siblingRequests]) {
620
632
  if (wanted.has(name))
621
633
  continue;
622
634
  const addon = availability.addons.get(name);
@@ -647,6 +659,7 @@ export class ModelDownloadReconciler {
647
659
  for (const model of wanted.values()) {
648
660
  if (availability.cached.has(model.name)) {
649
661
  this._requestedModels.delete(model.name);
662
+ this._siblingRequests.delete(model.name);
650
663
  this._resolveDemand(model.name);
651
664
  await this._status.clear(model.name);
652
665
  continue;
@@ -1,4 +1,5 @@
1
1
  import { scopedKey } from './keys.js';
2
+ import { isCoreError } from '../errors.js';
2
3
  export const REFRESH_SKEW_MS = 60_000;
3
4
  const inFlightRefresh = new WeakMap();
4
5
  export async function resolveOAuthCredential(opts) {
@@ -41,12 +42,16 @@ export async function resolveOAuthCredential(opts) {
41
42
  let pending = engineRefreshes.get(refreshKey);
42
43
  if (!pending) {
43
44
  pending = (async () => {
44
- const refreshed = await refresh({
45
- clientId,
46
- clientSecret,
47
- refreshToken,
48
- fetch: opts.fetch
49
- });
45
+ let refreshed;
46
+ try {
47
+ refreshed = await refresh({ clientId, clientSecret, refreshToken, fetch: opts.fetch });
48
+ }
49
+ catch (err) {
50
+ if (isCoreError(err, 'OAUTH_GRANT_REVOKED')) {
51
+ await forgetGrant(opts, refreshToken);
52
+ }
53
+ throw err;
54
+ }
50
55
  await engine.configSet({
51
56
  key: scopedKey(agentId, credentialKey),
52
57
  value: refreshed.accessToken
@@ -65,7 +70,23 @@ export async function resolveOAuthCredential(opts) {
65
70
  }
66
71
  return await pending;
67
72
  }
68
- catch {
69
- return token;
73
+ catch (err) {
74
+ return isCoreError(err, 'OAUTH_GRANT_REVOKED') ? null : token;
75
+ }
76
+ }
77
+ async function forgetGrant({ engine, agentId, credentialKey, stateKey }, deadRefreshToken) {
78
+ const { value: raw } = await engine.configGet({ key: scopedKey(agentId, stateKey) });
79
+ let current = {};
80
+ try {
81
+ current = (typeof raw === 'string' && JSON.parse(raw)) || {};
82
+ }
83
+ catch { }
84
+ if (current.refreshToken !== deadRefreshToken) {
85
+ return;
70
86
  }
87
+ await engine.configSet({ key: scopedKey(agentId, credentialKey), value: '' });
88
+ await engine.configSet({
89
+ key: scopedKey(agentId, stateKey),
90
+ value: JSON.stringify({ ...current, refreshToken: undefined, expiresAt: undefined })
91
+ });
71
92
  }
@@ -86,12 +86,23 @@ export async function refreshOAuthTokensWithFetch(config, refreshToken, fetchImp
86
86
  read: async (response) => {
87
87
  if (!response.ok) {
88
88
  const text = await response.text().catch(() => '');
89
+ if (isInvalidGrant(text)) {
90
+ throw new CoreError('OAUTH_GRANT_REVOKED');
91
+ }
89
92
  throw new CoreError('OAUTH_TOKEN_REFRESH_FAILED', [response.status, text]);
90
93
  }
91
94
  return toTokens(parseTokenResponse(await response.json()), refreshToken);
92
95
  }
93
96
  });
94
97
  }
98
+ function isInvalidGrant(text) {
99
+ try {
100
+ return TokenErrorSchema.safeParse(JSON.parse(text)).data?.error === 'invalid_grant';
101
+ }
102
+ catch {
103
+ return false;
104
+ }
105
+ }
95
106
  export function isTokenExpired(record, bufferMs = 60_000) {
96
107
  return typeof record.expiresAt === 'number' && Date.now() + bufferMs >= record.expiresAt;
97
108
  }
@@ -1,3 +1,8 @@
1
- export declare const PROBE_KINDS: readonly ['fold', 'title', 'suggestion'];
2
- export type ProbeKind = (typeof PROBE_KINDS)[number];
1
+ export declare const MEDIA_KINDS: readonly ['image', 'music'];
2
+ declare const TEXT_KINDS: readonly ['fold', 'title', 'suggestion'];
3
+ export declare const PROBE_KINDS: readonly ["fold", "title", "suggestion", "image", "music"];
4
+ export type ProbeKind = (typeof TEXT_KINDS)[number];
5
+ export type MediaKind = (typeof MEDIA_KINDS)[number];
3
6
  export declare function isProbeRound(options: unknown): boolean;
7
+ export declare function isMediaRound(options: unknown): boolean;
8
+ export {};
@@ -1,5 +1,10 @@
1
1
  import { isRecord } from './guards.js';
2
- export const PROBE_KINDS = ['fold', 'title', 'suggestion'];
2
+ export const MEDIA_KINDS = ['image', 'music'];
3
+ const TEXT_KINDS = ['fold', 'title', 'suggestion'];
4
+ export const PROBE_KINDS = [...TEXT_KINDS, ...MEDIA_KINDS];
3
5
  export function isProbeRound(options) {
4
6
  return isRecord(options) && PROBE_KINDS.some((kind) => kind === options.kind);
5
7
  }
8
+ export function isMediaRound(options) {
9
+ return isRecord(options) && MEDIA_KINDS.some((kind) => kind === options.kind);
10
+ }
@@ -9,6 +9,7 @@ export interface RunTranscriptOptions {
9
9
  runId: string;
10
10
  deviceId: Buffer;
11
11
  model: string;
12
+ unavailableSkills?: ReadonlyArray<string>;
12
13
  parentId?: string;
13
14
  log?: LoggerInterface | null;
14
15
  }
@@ -18,10 +19,12 @@ export declare class RunTranscript {
18
19
  private readonly _runId;
19
20
  private readonly _deviceId;
20
21
  private readonly _model;
22
+ private readonly _unavailableSkills;
21
23
  private readonly _parentId;
22
24
  private readonly _log;
23
25
  private readonly _writes;
24
- private readonly _ticker;
26
+ private _ticker;
27
+ private _closed;
25
28
  private readonly _announced;
26
29
  private _buffered;
27
30
  constructor(engine: ScopedCapabilities, opts: RunTranscriptOptions);
@@ -10,28 +10,28 @@ export class RunTranscript {
10
10
  _runId;
11
11
  _deviceId;
12
12
  _model;
13
+ _unavailableSkills;
13
14
  _parentId;
14
15
  _log;
15
16
  _writes;
16
- _ticker;
17
+ _ticker = null;
18
+ _closed = false;
17
19
  _announced = new Set();
18
20
  _buffered = null;
19
21
  constructor(engine, opts) {
20
- const { chatId, runId, deviceId, model, parentId, log } = opts;
22
+ const { chatId, runId, deviceId, model, unavailableSkills, parentId, log } = opts;
21
23
  this._engine = engine;
22
24
  this._chatId = chatId;
23
25
  this._runId = runId;
24
26
  this._deviceId = deviceId;
25
27
  this._model = model;
28
+ this._unavailableSkills = unavailableSkills?.length ? [...unavailableSkills] : undefined;
26
29
  this._parentId = parentId;
27
30
  this._log = log ?? null;
28
31
  this._writes = new WriteQueue({
29
32
  slowMs: SLOW_WRITE_MS,
30
33
  onSlow: (info) => this._log?.warn('runs', 'write still pending', { runId, ...info })
31
34
  });
32
- this._ticker = setInterval(() => {
33
- this.flush().catch((err) => this._log?.error('assistant', 'content flush failed', err));
34
- }, FLUSH_INTERVAL_MS);
35
35
  }
36
36
  async text(type, text, round) {
37
37
  if (this._buffered && (this._buffered.type !== type || this._buffered.round !== round)) {
@@ -41,6 +41,11 @@ export class RunTranscript {
41
41
  this._buffered = { type, text: '', round };
42
42
  this._announce(type);
43
43
  }
44
+ if (!this._ticker && !this._closed) {
45
+ this._ticker = setInterval(() => {
46
+ this.flush().catch((err) => this._log?.error('assistant', 'content flush failed', err));
47
+ }, FLUSH_INTERVAL_MS);
48
+ }
44
49
  this._buffered.text += text;
45
50
  if (this._buffered.text.length >= COALESCE_CAP) {
46
51
  await this.flush();
@@ -77,6 +82,7 @@ export class RunTranscript {
77
82
  type: 'run-status',
78
83
  runStatus: { ...runStatus, model: this._model },
79
84
  resumed: resumed || undefined,
85
+ unavailableSkills: this._unavailableSkills,
80
86
  originDeviceId: this._deviceId
81
87
  }));
82
88
  }
@@ -114,7 +120,10 @@ export class RunTranscript {
114
120
  return this._writes.pending();
115
121
  }
116
122
  close() {
117
- clearInterval(this._ticker);
123
+ this._closed = true;
124
+ if (this._ticker) {
125
+ clearInterval(this._ticker);
126
+ }
118
127
  }
119
128
  _announce(type) {
120
129
  if (this._announced.has(type))
@@ -648,7 +648,9 @@ export function registerEngineTypes(ns) {
648
648
  { name: 'agentSwitch', type: '@assistant/chunk-content-agent-switch' },
649
649
  { name: 'runnerDeviceId', type: 'fixed32' },
650
650
  { name: 'runTakenBy', type: 'fixed32' },
651
- { name: 'runTakenAt', type: 'uint' }
651
+ { name: 'runTakenAt', type: 'uint' },
652
+ { name: 'runMovedFrom', type: 'fixed32' },
653
+ { name: 'unavailableSkills', type: 'string', array: true }
652
654
  ]);
653
655
  ns.register({
654
656
  name: 'chunk-list',
@@ -687,7 +689,8 @@ export function registerEngineTypes(ns) {
687
689
  { name: 'callId', type: 'string' },
688
690
  { name: 'resumed', type: 'bool' },
689
691
  { name: 'roundReset', type: '@assistant/chunk-content-round-reset' },
690
- { name: 'agentSwitch', type: '@assistant/chunk-content-agent-switch' }
692
+ { name: 'agentSwitch', type: '@assistant/chunk-content-agent-switch' },
693
+ { name: 'unavailableSkills', type: 'string', array: true }
691
694
  ]
692
695
  });
693
696
  ns.register({
@@ -780,7 +783,8 @@ export function registerEngineTypes(ns) {
780
783
  { name: 'fileId', type: 'string' },
781
784
  { name: 'totalBytes', type: 'uint' },
782
785
  { name: 'meshId', type: 'string' },
783
- { name: 'sourceId', type: 'string' }
786
+ { name: 'sourceId', type: 'string' },
787
+ { name: 'blobId', type: 'string' }
784
788
  ]
785
789
  });
786
790
  ns.register({
@@ -865,7 +869,9 @@ export function registerEngineTypes(ns) {
865
869
  { name: 'mode', type: '@assistant/rag-search-mode' },
866
870
  { name: 'attachmentIds', type: 'string', array: true },
867
871
  { name: 'meshId', type: 'string', required: true },
868
- { name: 'immediate', type: 'bool' }
872
+ { name: 'immediate', type: 'bool' },
873
+ { name: 'previousQuery', type: 'string' },
874
+ { name: 'excerptsOnly', type: 'bool' }
869
875
  ]
870
876
  });
871
877
  ns.register({
@@ -893,7 +899,9 @@ export function registerEngineTypes(ns) {
893
899
  { name: 'pendingFiles', type: 'string', array: true },
894
900
  { name: 'chatFilesNotReady', type: 'uint' },
895
901
  { name: 'projectFilesNotReady', type: 'uint' },
896
- { name: 'chatFilesIndexingHere', type: 'uint' }
902
+ { name: 'chatFilesIndexingHere', type: 'uint' },
903
+ { name: 'uncoveredItems', type: 'string', array: true },
904
+ { name: 'outline', type: 'string', array: true }
897
905
  ]
898
906
  });
899
907
  ns.register({
@@ -959,7 +967,8 @@ export function registerEngineTypes(ns) {
959
967
  { name: 'error', type: 'string' },
960
968
  { name: 'loaded', type: 'bool', required: true },
961
969
  { name: 'reason', type: '@assistant/indexing-failure' },
962
- { name: 'failedOn', type: 'string' }
970
+ { name: 'failedOn', type: 'string' },
971
+ { name: 'progress', type: '@assistant/file-progress' }
963
972
  ]
964
973
  });
965
974
  ns.register({
@@ -2569,6 +2578,49 @@ export function registerEngineTypes(ns) {
2569
2578
  { name: 'error', type: 'string' }
2570
2579
  ]
2571
2580
  });
2581
+ ns.register({
2582
+ name: 'skill-availability',
2583
+ fields: [
2584
+ { name: 'name', type: 'string', required: true },
2585
+ { name: 'available', type: 'bool', required: true },
2586
+ { name: 'reason', type: 'string' }
2587
+ ]
2588
+ });
2589
+ ns.register({
2590
+ name: 'chat-skill-availability',
2591
+ fields: [{ name: 'skills', type: '@assistant/skill-availability', array: true }]
2592
+ });
2593
+ ns.register({
2594
+ name: 'upgraded-workspace',
2595
+ fields: [
2596
+ { name: 'meshId', type: 'string', required: true },
2597
+ { name: 'pending', type: 'bool', required: true },
2598
+ { name: 'hasGroups', type: 'bool', required: true },
2599
+ { name: 'ungroupedProjectId', type: 'string' }
2600
+ ]
2601
+ });
2602
+ ns.register({
2603
+ name: 'workspace-upgrade-summary',
2604
+ fields: [
2605
+ { name: 'workspaces', type: '@assistant/upgraded-workspace', array: true },
2606
+ { name: 'privateChatsWorkspaceId', type: 'string' },
2607
+ { name: 'privateChatsPending', type: 'bool', required: true }
2608
+ ]
2609
+ });
2610
+ ns.register({
2611
+ name: 'put-blob-request',
2612
+ fields: [
2613
+ { name: 'meshId', type: 'string' },
2614
+ { name: 'data', type: 'buffer' }
2615
+ ]
2616
+ });
2617
+ ns.register({
2618
+ name: 'put-blob-response',
2619
+ fields: [
2620
+ { name: 'bytesWritten', type: 'uint', required: true },
2621
+ { name: 'blobId', type: 'string' }
2622
+ ]
2623
+ });
2572
2624
  }
2573
2625
  export function registerEngineApi(api) {
2574
2626
  api.register({
@@ -3586,4 +3638,29 @@ export function registerEngineApi(api) {
3586
3638
  request: { name: '@assistant/skill-oauth-request', stream: false },
3587
3639
  response: { name: '@assistant/skill-oauth-response', stream: false }
3588
3640
  });
3641
+ api.register({
3642
+ name: 'continue-run-here',
3643
+ request: { name: '@assistant/run-request-request', stream: false },
3644
+ response: { name: '@assistant/chunk', stream: false }
3645
+ });
3646
+ api.register({
3647
+ name: 'chat-skill-availability',
3648
+ request: { name: '@assistant/chat-id', stream: false },
3649
+ response: { name: '@assistant/chat-skill-availability', stream: false }
3650
+ });
3651
+ api.register({
3652
+ name: 'chat-skill-availability-watch',
3653
+ request: { name: '@assistant/chat-id', stream: false },
3654
+ response: { name: '@assistant/chat-skill-availability', stream: true }
3655
+ });
3656
+ api.register({
3657
+ name: 'workspace-upgrade-summary',
3658
+ request: { name: '@assistant/empty', stream: false },
3659
+ response: { name: '@assistant/workspace-upgrade-summary', stream: false }
3660
+ });
3661
+ api.register({
3662
+ name: 'put-blob',
3663
+ request: { name: '@assistant/put-blob-request', stream: true },
3664
+ response: { name: '@assistant/put-blob-response', stream: true }
3665
+ });
3589
3666
  }
@@ -27,3 +27,6 @@ export function devicesByMemberMap(record: unknown): ReadonlyArray<Record<string
27
27
  export const terminalRunStates: ReadonlyArray<string>
28
28
  export function terminalRunStatusesMap(record: unknown): ReadonlyArray<Record<string, unknown>>
29
29
  export function liveWritersByMostRecentMap(record: unknown): ReadonlyArray<Record<string, unknown>>
30
+ export function linkedWritersByMostRecentMap(
31
+ record: unknown
32
+ ): ReadonlyArray<Record<string, unknown>>
@@ -201,6 +201,11 @@ export function liveWritersByMostRecentMap(record) {
201
201
  return [{ clock: record.clock }]
202
202
  }
203
203
 
204
+ export function linkedWritersByMostRecentMap(record) {
205
+ if (record.revoked || !record.linked) return []
206
+ return [{ clock: record.clock }]
207
+ }
208
+
204
209
  export function liveFilesMap(record) {
205
210
  if (record.deletedAt) return []
206
211
  return [{ meshKey: record.meshKey, coreKey: record.coreKey, blockOffset: record.blockOffset }]
@@ -111,6 +111,13 @@ export function registerLocalTypes(ns) {
111
111
  { name: 'activeMeshKey', type: 'fixed32' },
112
112
  { name: 'homeMeshKey', type: 'fixed32' }
113
113
  ]);
114
+ ns.register({
115
+ name: 'join-head',
116
+ fields: [
117
+ { name: 'key', type: 'fixed32', required: true },
118
+ { name: 'length', type: 'uint', required: true }
119
+ ]
120
+ });
114
121
  versioned('mesh-membership', [
115
122
  { name: 'key', type: 'fixed32', required: true },
116
123
  { name: 'seed', type: 'fixed32', required: true },
@@ -127,7 +134,8 @@ export function registerLocalTypes(ns) {
127
134
  { name: 'joinedAt', type: 'uint' },
128
135
  { name: 'kicked', type: 'bool' },
129
136
  { name: 'retiredUnder', type: 'fixed32' },
130
- { name: 'initial', type: 'bool' }
137
+ { name: 'initial', type: 'bool' },
138
+ { name: 'joinHeads', type: '@local/join-head', array: true }
131
139
  ]);
132
140
  versioned('member-proof', [
133
141
  { name: 'meshKey', type: 'fixed32', required: true },
@@ -178,7 +186,8 @@ export function registerLocalTypes(ns) {
178
186
  { name: 'meshKey', type: 'fixed32', required: true },
179
187
  { name: 'fromKey', type: 'fixed32' },
180
188
  { name: 'fromLength', type: 'uint' },
181
- { name: 'incremental', type: 'bool', required: true }
189
+ { name: 'incremental', type: 'bool', required: true },
190
+ { name: 'toLength', type: 'uint' }
182
191
  ]);
183
192
  versioned('mesh-purge', [
184
193
  { name: 'key', type: 'fixed32', required: true },