@qvac/core 0.10.1 → 0.10.3

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 (40) hide show
  1. package/CHANGELOG.md +63 -1
  2. package/dist-lib/lib/api/agent-folders.d.ts +22 -0
  3. package/dist-lib/lib/api/agent-folders.js +115 -0
  4. package/dist-lib/lib/api/agents.d.ts +3 -1
  5. package/dist-lib/lib/api/agents.js +5 -3
  6. package/dist-lib/lib/api/execution.js +2 -0
  7. package/dist-lib/lib/api/index.d.ts +1 -0
  8. package/dist-lib/lib/api/index.js +4 -0
  9. package/dist-lib/lib/assistant-tree.js +2 -1
  10. package/dist-lib/lib/assistant.js +7 -4
  11. package/dist-lib/lib/core/agent.d.ts +5 -1
  12. package/dist-lib/lib/core/agent.js +8 -3
  13. package/dist-lib/lib/core/chat.d.ts +4 -1
  14. package/dist-lib/lib/core/chat.js +12 -4
  15. package/dist-lib/lib/core/local/index.d.ts +2 -1
  16. package/dist-lib/lib/core/local/index.js +9 -1
  17. package/dist-lib/lib/core/send.js +2 -0
  18. package/dist-lib/lib/core.d.ts +1 -0
  19. package/dist-lib/lib/core.js +41 -13
  20. package/dist-lib/lib/errors.d.ts +20 -0
  21. package/dist-lib/lib/errors.js +20 -0
  22. package/dist-lib/lib/lent-harness.d.ts +2 -0
  23. package/dist-lib/lib/lent-harness.js +51 -0
  24. package/dist-lib/lib/mesh-scoped-engine.js +3 -0
  25. package/dist-lib/schema/engine.js +58 -1
  26. package/dist-lib/spec/bind.js +9 -0
  27. package/dist-lib/spec/calls.js +3 -0
  28. package/dist-lib/spec/capabilities.d.ts +8 -2
  29. package/dist-lib/spec/hrpc/hrpc.json +40 -1
  30. package/dist-lib/spec/hrpc/index.js +40 -4
  31. package/dist-lib/spec/hrpc/messages.js +190 -0
  32. package/dist-lib/spec/hyperschema/index.js +190 -0
  33. package/dist-lib/spec/hyperschema/schema.json +141 -0
  34. package/dist-lib/spec/hyperschema/types.d.ts +40 -0
  35. package/package.json +2 -1
  36. package/tui/README.md +16 -0
  37. package/tui/app.mjs +80 -13
  38. package/tui/lib/folders-command.mjs +92 -0
  39. package/tui/lib/knowledge-import.mjs +3 -21
  40. package/tui/lib/local-path.mjs +21 -0
@@ -10492,6 +10492,180 @@ const encoding303 = {
10492
10492
  }
10493
10493
  }
10494
10494
 
10495
+ // @assistant/delete-agent-request
10496
+ const encoding304 = {
10497
+ preencode(state, m) {
10498
+ c.string.preencode(state, m.agentId)
10499
+ c.string.preencode(state, m.meshId)
10500
+ state.end++ // max flag is 1 so always one byte
10501
+ },
10502
+ encode(state, m) {
10503
+ const flags = m.keepChats ? 1 : 0
10504
+
10505
+ c.string.encode(state, m.agentId)
10506
+ c.string.encode(state, m.meshId)
10507
+ c.uint.encode(state, flags)
10508
+ },
10509
+ decode(state) {
10510
+ const r0 = c.string.decode(state)
10511
+ const r1 = c.string.decode(state)
10512
+ const flags = c.uint.decode(state)
10513
+
10514
+ return {
10515
+ agentId: r0,
10516
+ meshId: r1,
10517
+ keepChats: (flags & 1) !== 0
10518
+ }
10519
+ }
10520
+ }
10521
+
10522
+ const encoding305_enum = {
10523
+ read: 'read',
10524
+ write: 'write'
10525
+ }
10526
+
10527
+ // @assistant/agent-folder-access enum
10528
+ const encoding305 = {
10529
+ preencode (state, m) {
10530
+ state.end++ // max enum is 2 so always one byte
10531
+ },
10532
+ encode (state, m) {
10533
+ switch (m) {
10534
+ case 'read':
10535
+ c.uint.encode(state, 1)
10536
+ break
10537
+ case 'write':
10538
+ c.uint.encode(state, 2)
10539
+ break
10540
+ default:
10541
+ throw new Error('Unknown enum')
10542
+ }
10543
+ },
10544
+ decode (state) {
10545
+ switch (c.uint.decode(state)) {
10546
+ case 1:
10547
+ return 'read'
10548
+ case 2:
10549
+ return 'write'
10550
+ default: return null
10551
+ }
10552
+ }
10553
+ }
10554
+
10555
+ // @assistant/agent-folder
10556
+ const encoding306 = {
10557
+ preencode(state, m) {
10558
+ c.string.preencode(state, m.path)
10559
+ encoding305.preencode(state, m.access)
10560
+ },
10561
+ encode(state, m) {
10562
+ c.string.encode(state, m.path)
10563
+ encoding305.encode(state, m.access)
10564
+ },
10565
+ decode(state) {
10566
+ const r0 = c.string.decode(state)
10567
+ const r1 = encoding305.decode(state)
10568
+
10569
+ return {
10570
+ path: r0,
10571
+ access: r1
10572
+ }
10573
+ }
10574
+ }
10575
+
10576
+ // @assistant/agent-folders-request
10577
+ const encoding307 = {
10578
+ preencode(state, m) {
10579
+ c.string.preencode(state, m.agentId)
10580
+ },
10581
+ encode(state, m) {
10582
+ c.string.encode(state, m.agentId)
10583
+ },
10584
+ decode(state) {
10585
+ const r0 = c.string.decode(state)
10586
+
10587
+ return {
10588
+ agentId: r0
10589
+ }
10590
+ }
10591
+ }
10592
+
10593
+ // @assistant/agent-folders.folders
10594
+ const encoding308_1 = c.array(c.frame(encoding306))
10595
+
10596
+ // @assistant/agent-folders
10597
+ const encoding308 = {
10598
+ preencode(state, m) {
10599
+ c.string.preencode(state, m.agentId)
10600
+ state.end++ // max flag is 1 so always one byte
10601
+
10602
+ if (m.folders) encoding308_1.preencode(state, m.folders)
10603
+ },
10604
+ encode(state, m) {
10605
+ const flags = m.folders ? 1 : 0
10606
+
10607
+ c.string.encode(state, m.agentId)
10608
+ c.uint.encode(state, flags)
10609
+
10610
+ if (m.folders) encoding308_1.encode(state, m.folders)
10611
+ },
10612
+ decode(state) {
10613
+ const r0 = c.string.decode(state)
10614
+ const flags = c.uint.decode(state)
10615
+
10616
+ return {
10617
+ agentId: r0,
10618
+ folders: (flags & 1) !== 0 ? encoding308_1.decode(state) : null
10619
+ }
10620
+ }
10621
+ }
10622
+
10623
+ // @assistant/add-agent-folder-request
10624
+ const encoding309 = {
10625
+ preencode(state, m) {
10626
+ c.string.preencode(state, m.agentId)
10627
+ c.string.preencode(state, m.path)
10628
+ encoding305.preencode(state, m.access)
10629
+ },
10630
+ encode(state, m) {
10631
+ c.string.encode(state, m.agentId)
10632
+ c.string.encode(state, m.path)
10633
+ encoding305.encode(state, m.access)
10634
+ },
10635
+ decode(state) {
10636
+ const r0 = c.string.decode(state)
10637
+ const r1 = c.string.decode(state)
10638
+ const r2 = encoding305.decode(state)
10639
+
10640
+ return {
10641
+ agentId: r0,
10642
+ path: r1,
10643
+ access: r2
10644
+ }
10645
+ }
10646
+ }
10647
+
10648
+ // @assistant/remove-agent-folder-request
10649
+ const encoding310 = {
10650
+ preencode(state, m) {
10651
+ c.string.preencode(state, m.agentId)
10652
+ c.string.preencode(state, m.path)
10653
+ },
10654
+ encode(state, m) {
10655
+ c.string.encode(state, m.agentId)
10656
+ c.string.encode(state, m.path)
10657
+ },
10658
+ decode(state) {
10659
+ const r0 = c.string.decode(state)
10660
+ const r1 = c.string.decode(state)
10661
+
10662
+ return {
10663
+ agentId: r0,
10664
+ path: r1
10665
+ }
10666
+ }
10667
+ }
10668
+
10495
10669
  // @assistant/model-info-list.memory, deferred due to recusive use
10496
10670
  const encoding156_1 = c.frame(encoding302)
10497
10671
 
@@ -10585,6 +10759,8 @@ function getEnum(name) {
10585
10759
  return encoding245_enum
10586
10760
  case '@assistant/model-use':
10587
10761
  return encoding297_enum
10762
+ case '@assistant/agent-folder-access':
10763
+ return encoding305_enum
10588
10764
  default:
10589
10765
  throw new Error('Enum not found ' + name)
10590
10766
  }
@@ -11200,6 +11376,20 @@ function getEncoding(name) {
11200
11376
  return encoding302
11201
11377
  case '@assistant/device-scope':
11202
11378
  return encoding303
11379
+ case '@assistant/delete-agent-request':
11380
+ return encoding304
11381
+ case '@assistant/agent-folder-access':
11382
+ return encoding305
11383
+ case '@assistant/agent-folder':
11384
+ return encoding306
11385
+ case '@assistant/agent-folders-request':
11386
+ return encoding307
11387
+ case '@assistant/agent-folders':
11388
+ return encoding308
11389
+ case '@assistant/add-agent-folder-request':
11390
+ return encoding309
11391
+ case '@assistant/remove-agent-folder-request':
11392
+ return encoding310
11203
11393
  default:
11204
11394
  throw new Error('Encoder not found ' + name)
11205
11395
  }
@@ -8748,6 +8748,147 @@
8748
8748
  "version": 1
8749
8749
  }
8750
8750
  ]
8751
+ },
8752
+ {
8753
+ "name": "delete-agent-request",
8754
+ "namespace": "assistant",
8755
+ "compact": false,
8756
+ "flagsPosition": 2,
8757
+ "fields": [
8758
+ {
8759
+ "name": "agentId",
8760
+ "required": true,
8761
+ "type": "string",
8762
+ "version": 1
8763
+ },
8764
+ {
8765
+ "name": "meshId",
8766
+ "required": true,
8767
+ "type": "string",
8768
+ "version": 1
8769
+ },
8770
+ {
8771
+ "name": "keepChats",
8772
+ "type": "bool",
8773
+ "version": 1
8774
+ }
8775
+ ]
8776
+ },
8777
+ {
8778
+ "name": "agent-folder-access",
8779
+ "namespace": "assistant",
8780
+ "offset": 1,
8781
+ "enum": [
8782
+ {
8783
+ "key": "read",
8784
+ "version": 1
8785
+ },
8786
+ {
8787
+ "key": "write",
8788
+ "version": 1
8789
+ }
8790
+ ],
8791
+ "strings": true
8792
+ },
8793
+ {
8794
+ "name": "agent-folder",
8795
+ "namespace": "assistant",
8796
+ "compact": false,
8797
+ "flagsPosition": -1,
8798
+ "fields": [
8799
+ {
8800
+ "name": "path",
8801
+ "required": true,
8802
+ "type": "string",
8803
+ "version": 1
8804
+ },
8805
+ {
8806
+ "name": "access",
8807
+ "required": true,
8808
+ "type": "@assistant/agent-folder-access",
8809
+ "version": 1
8810
+ }
8811
+ ]
8812
+ },
8813
+ {
8814
+ "name": "agent-folders-request",
8815
+ "namespace": "assistant",
8816
+ "compact": false,
8817
+ "flagsPosition": -1,
8818
+ "fields": [
8819
+ {
8820
+ "name": "agentId",
8821
+ "required": true,
8822
+ "type": "string",
8823
+ "version": 1
8824
+ }
8825
+ ]
8826
+ },
8827
+ {
8828
+ "name": "agent-folders",
8829
+ "namespace": "assistant",
8830
+ "compact": false,
8831
+ "flagsPosition": 1,
8832
+ "fields": [
8833
+ {
8834
+ "name": "agentId",
8835
+ "required": true,
8836
+ "type": "string",
8837
+ "version": 1
8838
+ },
8839
+ {
8840
+ "name": "folders",
8841
+ "array": true,
8842
+ "type": "@assistant/agent-folder",
8843
+ "version": 1
8844
+ }
8845
+ ]
8846
+ },
8847
+ {
8848
+ "name": "add-agent-folder-request",
8849
+ "namespace": "assistant",
8850
+ "compact": false,
8851
+ "flagsPosition": -1,
8852
+ "fields": [
8853
+ {
8854
+ "name": "agentId",
8855
+ "required": true,
8856
+ "type": "string",
8857
+ "version": 1
8858
+ },
8859
+ {
8860
+ "name": "path",
8861
+ "required": true,
8862
+ "type": "string",
8863
+ "version": 1
8864
+ },
8865
+ {
8866
+ "name": "access",
8867
+ "required": true,
8868
+ "type": "@assistant/agent-folder-access",
8869
+ "version": 1
8870
+ }
8871
+ ]
8872
+ },
8873
+ {
8874
+ "name": "remove-agent-folder-request",
8875
+ "namespace": "assistant",
8876
+ "compact": false,
8877
+ "flagsPosition": -1,
8878
+ "fields": [
8879
+ {
8880
+ "name": "agentId",
8881
+ "required": true,
8882
+ "type": "string",
8883
+ "version": 1
8884
+ },
8885
+ {
8886
+ "name": "path",
8887
+ "required": true,
8888
+ "type": "string",
8889
+ "version": 1
8890
+ }
8891
+ ]
8751
8892
  }
8752
8893
  ]
8753
8894
  }
@@ -1885,6 +1885,39 @@ export interface AssistantDeviceScope {
1885
1885
  deviceId?: Buffer | null
1886
1886
  }
1887
1887
 
1888
+ export interface AssistantDeleteAgentRequest {
1889
+ agentId: string
1890
+ meshId: string
1891
+ keepChats?: boolean
1892
+ }
1893
+
1894
+ export type AssistantAgentFolderAccess = "read" | "write"
1895
+
1896
+ export interface AssistantAgentFolder {
1897
+ path: string
1898
+ access: AssistantAgentFolderAccess
1899
+ }
1900
+
1901
+ export interface AssistantAgentFoldersRequest {
1902
+ agentId: string
1903
+ }
1904
+
1905
+ export interface AssistantAgentFolders {
1906
+ agentId: string
1907
+ folders?: AssistantAgentFolder[] | null
1908
+ }
1909
+
1910
+ export interface AssistantAddAgentFolderRequest {
1911
+ agentId: string
1912
+ path: string
1913
+ access: AssistantAgentFolderAccess
1914
+ }
1915
+
1916
+ export interface AssistantRemoveAgentFolderRequest {
1917
+ agentId: string
1918
+ path: string
1919
+ }
1920
+
1888
1921
  export interface SchemaTypes {
1889
1922
  "@assistant/empty": AssistantEmpty
1890
1923
  "@assistant/ok-response": AssistantOkResponse
@@ -2190,4 +2223,11 @@ export interface SchemaTypes {
2190
2223
  "@assistant/chunk-delta": AssistantChunkDelta
2191
2224
  "@assistant/model-memory": AssistantModelMemory
2192
2225
  "@assistant/device-scope": AssistantDeviceScope
2226
+ "@assistant/delete-agent-request": AssistantDeleteAgentRequest
2227
+ "@assistant/agent-folder-access": AssistantAgentFolderAccess
2228
+ "@assistant/agent-folder": AssistantAgentFolder
2229
+ "@assistant/agent-folders-request": AssistantAgentFoldersRequest
2230
+ "@assistant/agent-folders": AssistantAgentFolders
2231
+ "@assistant/add-agent-folder-request": AssistantAddAgentFolderRequest
2232
+ "@assistant/remove-agent-folder-request": AssistantRemoveAgentFolderRequest
2193
2233
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/core",
3
- "version": "0.10.1",
3
+ "version": "0.10.3",
4
4
  "type": "module",
5
5
  "description": "Peer-to-peer AI across your devices",
6
6
  "engines": {
@@ -158,6 +158,7 @@
158
158
  "error-codes": "bare examples/error-codes.mjs",
159
159
  "model-downloads-held": "bare examples/model-downloads-held.mjs",
160
160
  "blind-peering": "bare examples/blind-peering.mjs",
161
+ "agent-folders": "bare examples/agent-folders.mjs",
161
162
  "chunks-delta-watch": "bare examples/chunks-delta-watch.mjs",
162
163
  "mesh-pair-and-migrate": "bare examples/mesh-pair-and-migrate.mjs",
163
164
  "mesh-scoped-catalog": "bare examples/mesh-scoped-catalog.mjs",
package/tui/README.md CHANGED
@@ -79,6 +79,16 @@ an explicit root — it puts the SDK home and its lock on a scratch
79
79
  `<dir>/sdk-home`. Models are still shared; `QVAC_MODEL_CACHE_PATH` isolates
80
80
  those too.
81
81
 
82
+ The file tools (reading, listing, searching and editing files) reach an agent
83
+ only with a shared folder. `/folders add <path> rw` shares one with the active
84
+ agent on this device, `/folders` lists them and `/folders remove <path>` stops
85
+ sharing one; `ro` in place of `rw` keeps it read-only. With `--storage` or
86
+ `--temp`, share a folder outside that root: Core refuses the app's own storage.
87
+
88
+ ```
89
+ /folders add ~/scratch/site rw
90
+ ```
91
+
82
92
  The TUI copies its mesh invite to the clipboard on ctrl+y. With no clipboard
83
93
  command (a container, ssh) it asks your terminal to set the clipboard with
84
94
  OSC 52, which the terminal has to allow. A running TUI moves
@@ -105,6 +115,12 @@ QVAC_MODEL=Qwen3.5-4B-Q4_K_M duck
105
115
  The bare `Qwen3.5-4B` is not a catalog name: it falls through to a registry
106
116
  search whose first match is that model's mmproj file, which fails to load.
107
117
 
118
+ A GGUF of your own runs vision once it is added with its projector:
119
+
120
+ ```text
121
+ /models add visionpsy https://host/visionpsy-nano-460m-q8_0.gguf https://host/mmproj-visionpsy-nano-460m-q8.gguf
122
+ ```
123
+
108
124
  Logs (Core's own lines, and the sidecar child's piped stdout/stderr — the
109
125
  llama.cpp and SDK output) go to `<storage.root>/assistant.log`, as they do on
110
126
  desktop. Nothing is printed: the TUI owns the tty.
package/tui/app.mjs CHANGED
@@ -41,6 +41,7 @@ import { exportMarkdown } from './lib/export.mjs'
41
41
  import { paintSelection, selectionText } from './lib/select.mjs'
42
42
  import { center, splash } from './lib/splash.mjs'
43
43
  import { wrapBlock, wrapLine } from './lib/wrap.mjs'
44
+ import { foldersCommand } from './lib/folders-command.mjs'
44
45
  import { knowledgeCommand } from './lib/knowledge-command.mjs'
45
46
  import { describeMove } from './lib/move-command.mjs'
46
47
  import { forkCut } from './lib/fork-command.mjs'
@@ -266,6 +267,15 @@ const COMMANDS = [
266
267
  },
267
268
  { name: 'meshes', desc: 'list the meshes this device belongs to', palette: true },
268
269
  { name: 'cred', desc: 'set a credential value for this agent' },
270
+ {
271
+ name: 'folders',
272
+ desc: 'the folders on this device the agent may read or edit with its file tools',
273
+ sub: [
274
+ { name: 'list', desc: 'the shared folders, each ro or rw' },
275
+ { name: 'add', desc: '<path> [ro|rw] — share a folder, read-only unless rw' },
276
+ { name: 'remove', desc: '<path> — stop sharing a folder' }
277
+ ]
278
+ },
269
279
  { name: 'connect', desc: 'OAuth-connect a skill for this agent', palette: true },
270
280
  {
271
281
  name: 'my-device',
@@ -288,7 +298,7 @@ const COMMANDS = [
288
298
  },
289
299
  {
290
300
  name: 'add',
291
- desc: '<label> <src|n> [tools|vision|thinking] — add a gguf url or path'
301
+ desc: '<label> <src|n> [mmproj] [tools|vision|thinking] — add a gguf url or path'
292
302
  },
293
303
  { name: 'use', desc: '<name|label> — make a model the agent’s model' },
294
304
  {
@@ -364,6 +374,7 @@ const MODEL_TYPES = new Set([
364
374
  'vad',
365
375
  'other'
366
376
  ])
377
+ const MODEL_ADD_FLAGS = new Set(['tools', 'vision', 'thinking'])
367
378
  const MODEL_VERBS = new Set([
368
379
  'custom',
369
380
  'preview',
@@ -602,6 +613,22 @@ async function catalogRow(engine, name) {
602
613
  return entry ? (catalog.find((m) => m.registryPath === entry.registryPath) ?? null) : null
603
614
  }
604
615
 
616
+ // the harness guesses at a bare name it cannot place, and can land on another file
617
+ async function isListedModel(engine, name) {
618
+ if (/^(\/|~|\.|file:|https?:|registry:|pear:|hyper:)/.test(name)) {
619
+ return true
620
+ }
621
+
622
+ const { models } = await engine.listModels({})
623
+ if ((models ?? []).some((m) => m.name === name)) {
624
+ return true
625
+ }
626
+
627
+ const { models: registry } = await engine.listModels({ fullRegistry: true })
628
+
629
+ return (registry ?? []).some((m) => m.name === name)
630
+ }
631
+
605
632
  const notOursToUse = (device) =>
606
633
  `/models use picks this agent's model, not ${device.name}'s — /device here first`
607
634
 
@@ -1171,7 +1198,7 @@ export function formatModelPreview(preview) {
1171
1198
 
1172
1199
  if (!preview.src && preview.files?.length) {
1173
1200
  return [
1174
- 'several models here — pick one by number: /models preview <n> · /models add <name> <n>',
1201
+ 'several models here — pick one by number: /models preview <n> [mmproj] · /models add <name> <n> [mmproj]',
1175
1202
  ...preview.files.map(
1176
1203
  (file, index) =>
1177
1204
  ` ${index + 1}. ${file.label} ${bytesToGb(file.sizeBytes) ?? 'size unknown'}\n ${file.src}`
@@ -1191,7 +1218,8 @@ export function formatModelPreview(preview) {
1191
1218
  ` context ${preview.contextLength ? formatTokenCount(preview.contextLength) : 'unknown'}`,
1192
1219
  ` ${[preview.taskType, preview.architecture].filter(Boolean).join(' · ') || 'task unknown'}`,
1193
1220
  ` license ${preview.license || 'unknown'}`,
1194
- ` fit ${fit}${reasons}`
1221
+ ` fit ${fit}${reasons}`,
1222
+ ...(preview.mmprojSrc ? [` projector ${preview.mmprojSrc}`] : [])
1195
1223
  ].join('\n')
1196
1224
  }
1197
1225
 
@@ -1662,7 +1690,8 @@ const AGENT_COMMANDS = new Set([
1662
1690
  'skill',
1663
1691
  'scope',
1664
1692
  'connect',
1665
- 'cred'
1693
+ 'cred',
1694
+ 'folders'
1666
1695
  ])
1667
1696
  const NO_AGENT = 'no agent in this mesh · /agent new <name> or /agent use <name|id>'
1668
1697
 
@@ -1864,6 +1893,7 @@ export class ChatApp {
1864
1893
  this._customModels = new Map()
1865
1894
  this._modelsDevice = null // set by /device: the account device the /models commands act on
1866
1895
  this._pickableFiles = []
1896
+ this._previewedProjections = new Map() // src → the projector its last preview checked, for /models add
1867
1897
  this._statusIterator = null
1868
1898
  this._downloadsIterator = null
1869
1899
  this.modelDownloads = new Map()
@@ -2452,7 +2482,7 @@ export class ChatApp {
2452
2482
  ' /models idle <never|minutes> · cap <percent> · settings — free loaded models after that long with no request, the share of memory they may fill, and both settings',
2453
2483
  ' /device [list] · /device use <n|name|id> · /device here — point /models at another device of this account, or back at this one',
2454
2484
  ' /models [type] — browse every model in the SDK registry; type is an SDK addon (llm, tts, whisper, embeddings, diffusion, …) or an alias (transcription, embedding, image); ↑/↓ move, space selects',
2455
- ' /models custom · preview <src|n> [mmproj] · add <label> <src|n> [tools|vision|thinking] · use <name|label> · remove <name|label> — check a GGUF by url or local path, add it, and pick it; its context window caps /ctx',
2485
+ ' /models custom · preview <src|n> [mmproj] · add <label> <src|n> [mmproj] [tools|vision|thinking] · use <name|label> · remove <name|label> — check a GGUF by url or local path, add it, and pick it; its context window caps /ctx',
2456
2486
  ' /image [model <choice> | steps <n> | size <WxH> | reset] — the agent’s image-generation defaults',
2457
2487
  '',
2458
2488
  'Connections — a skill that needs an account or a token (Menu ▸ Agent ▸ Connections lists them with their state)',
@@ -2468,6 +2498,7 @@ export class ChatApp {
2468
2498
  '',
2469
2499
  'Advanced',
2470
2500
  ' /cred <key> <value> — set a credential by hand for this agent (e.g. /cred github_access_token ghp_…); /skills, enter on the skill, fills this in for you',
2501
+ ' /folders — the folders on this device the agent may use with its file tools · /folders add <path> [ro|rw] — share one, read-only unless rw · /folders remove <path>',
2471
2502
  ' /scope skills all|selected — switch scope',
2472
2503
  ' /join <qvac://device/… or qvac://workspace/…> — preview who you would join as (ctrl+y copies this mesh’s invite) · /join yes — confirm it (a device invite retires this device’s mesh, a member invite adds one beside it) · /join cancel — abort a join in progress',
2473
2504
  ' /leave — leave the active mesh; the device lands on another mesh it can write to, or mints a fresh account',
@@ -2648,7 +2679,7 @@ export class ChatApp {
2648
2679
  if (cmd === 'models') {
2649
2680
  const raw = rest[0]?.toLowerCase()
2650
2681
  const USAGE =
2651
- 'usage: /models [type] · custom · preview <src|n> [mmproj] · add <label> <src|n> [tools] [vision] [thinking] · use <name|label> · remove <name|label> · load <model> · unload <model> · delete <name> · download <name> · pause <name> · resume <name> · idle <never|minutes> · cap <percent> · settings'
2682
+ 'usage: /models [type] · custom · preview <src|n> [mmproj] · add <label> <src|n> [mmproj] [tools] [vision] [thinking] · use <name|label> · remove <name|label> · load <model> · unload <model> · delete <name> · download <name> · pause <name> · resume <name> · idle <never|minutes> · cap <percent> · settings'
2652
2683
  const models = this._modelsEngine()
2653
2684
  const on = this._modelsDevice
2654
2685
  const where = (text) => (on ? `${on.name}: ${text}` : text)
@@ -2765,8 +2796,9 @@ export class ChatApp {
2765
2796
  const ctx =
2766
2797
  m.contextLength > 0 ? formatTokenCount(m.contextLength) : 'ctx window unknown'
2767
2798
  const about = [m.taskType, m.license].filter(Boolean).join(' · ')
2799
+ const projector = m.mmprojSrc ? `\n projector ${m.mmprojSrc}` : ''
2768
2800
 
2769
- return `${m.label || m.name} ${m.name}\n ${m.src}\n ${ctx}${about ? ` · ${about}` : ''}`
2801
+ return `${m.label || m.name} ${m.name}\n ${m.src}${projector}\n ${ctx}${about ? ` · ${about}` : ''}`
2770
2802
  })
2771
2803
  .join('\n')
2772
2804
  )
@@ -2779,12 +2811,16 @@ export class ChatApp {
2779
2811
  return notice(USAGE)
2780
2812
  }
2781
2813
 
2814
+ const mmprojSrc = rest[2]
2815
+
2782
2816
  return run(async () => {
2783
- const preview = await models.previewCustomModel({ src, mmprojSrc: rest[2] })
2817
+ const preview = await models.previewCustomModel({ src, mmprojSrc })
2784
2818
  if (!preview.src && preview.files?.length) {
2785
2819
  this._pickableFiles = preview.files
2786
2820
  }
2787
2821
 
2822
+ this._previewedProjections.set(src, preview.mmprojSrc)
2823
+
2788
2824
  return where(formatModelPreview(preview))
2789
2825
  })
2790
2826
  }
@@ -2792,18 +2828,20 @@ export class ChatApp {
2792
2828
  if (raw === 'add') {
2793
2829
  const label = rest[1]
2794
2830
  const src = this._pickedSource(rest[2])
2795
- if (!label || !src) {
2831
+ const flags = new Set(rest.slice(3).map((f) => f.toLowerCase()))
2832
+ const projections = rest.slice(3).filter((f) => !MODEL_ADD_FLAGS.has(f.toLowerCase()))
2833
+ if (!label || !src || projections.length > 1) {
2796
2834
  return notice(USAGE)
2797
2835
  }
2798
2836
 
2799
- const flags = new Set(rest.slice(3).map((f) => f.toLowerCase()))
2800
-
2801
2837
  return run(async () => {
2838
+ const mmprojSrc = projections[0] ?? (await this._pairedProjection(src))
2802
2839
  const { id } = await models.addCustomModel({
2803
2840
  label,
2804
2841
  src,
2842
+ mmprojSrc,
2805
2843
  supportsTools: flags.has('tools'),
2806
- supportsVision: flags.has('vision'),
2844
+ supportsVision: flags.has('vision') || Boolean(mmprojSrc),
2807
2845
  supportsThinking: flags.has('thinking')
2808
2846
  })
2809
2847
  const row = (await this._modelsLibrary()).get(id)
@@ -2812,7 +2850,9 @@ export class ChatApp {
2812
2850
  ? `context window ${formatTokenCount(row.contextLength)}`
2813
2851
  : 'context window unknown — the picker uses the default range'
2814
2852
 
2815
- return where(`added ${label} as ${id}\n ${row?.src ?? src}\n ${ctx}`)
2853
+ const projector = row?.mmprojSrc ? `\n projector ${row.mmprojSrc}` : ''
2854
+
2855
+ return where(`added ${label} as ${id}\n ${row?.src ?? src}${projector}\n ${ctx}`)
2816
2856
  })
2817
2857
  }
2818
2858
 
@@ -2834,6 +2874,10 @@ export class ChatApp {
2834
2874
  return `${asked} was not set \u2014 ${unrunnable.message}`
2835
2875
  }
2836
2876
 
2877
+ if (!custom && !(await isListedModel(engine, asked))) {
2878
+ return `${asked} was not set \u2014 no added model has that name, and it ${notInCatalog('this device')}`
2879
+ }
2880
+
2837
2881
  const name = custom?.name ?? asked
2838
2882
  this.agent = await engine.updateAgent({
2839
2883
  meshId: this.meshId,
@@ -3552,6 +3596,22 @@ export class ChatApp {
3552
3596
  })
3553
3597
  }
3554
3598
 
3599
+ if (cmd === 'folders') {
3600
+ return [
3601
+ this,
3602
+ async () => {
3603
+ const provider = agent.providerDeviceId
3604
+ const remote = provider && !(await this._hostedHere(provider))
3605
+ const host = remote ? this._deviceName(b4a.toHex(provider)) : null
3606
+ const lent = agent.lenderDeviceId
3607
+ const borrows = lent && !(await this._hostedHere(lent))
3608
+ const lender = borrows ? this._deviceName(b4a.toHex(lent)) : null
3609
+
3610
+ return foldersCommand(engine, { agent, host, lender }, rawArgs)
3611
+ }
3612
+ ]
3613
+ }
3614
+
3555
3615
  if (cmd === 'cred') {
3556
3616
  const [key, ...valueParts] = rest
3557
3617
  const value = valueParts.join(' ')
@@ -4898,6 +4958,13 @@ export class ChatApp {
4898
4958
  return (await this._customModelsOf(this._modelsEngine())) ?? new Map()
4899
4959
  }
4900
4960
 
4961
+ // Core takes a re-added row whole, so a rename that names no projector keeps the one it had
4962
+ async _pairedProjection(src) {
4963
+ const stored = [...(await this._modelsLibrary()).values()].find((m) => m.src === src)
4964
+
4965
+ return this._previewedProjections.get(src) ?? stored?.mmprojSrc
4966
+ }
4967
+
4901
4968
  async _customModelFor(nameOrLabel, customs = this._customModels, engine = this.engine) {
4902
4969
  const byId = customs.get(nameOrLabel)
4903
4970
  if (byId) {