@qvac/core 0.10.2 → 0.10.4

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 (69) hide show
  1. package/CHANGELOG.md +66 -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 +4 -2
  6. package/dist-lib/lib/api/index.d.ts +1 -0
  7. package/dist-lib/lib/api/index.js +4 -0
  8. package/dist-lib/lib/assistant/history.js +18 -2
  9. package/dist-lib/lib/assistant/message.d.ts +17 -0
  10. package/dist-lib/lib/assistant/message.js +28 -0
  11. package/dist-lib/lib/assistant/video-budget.d.ts +13 -0
  12. package/dist-lib/lib/assistant/video-budget.js +29 -0
  13. package/dist-lib/lib/assistant-tree.js +2 -1
  14. package/dist-lib/lib/assistant.d.ts +22 -2
  15. package/dist-lib/lib/assistant.js +377 -15
  16. package/dist-lib/lib/core/chat-fork.js +1 -0
  17. package/dist-lib/lib/core/chat-search.js +1 -1
  18. package/dist-lib/lib/core/chat.d.ts +1 -0
  19. package/dist-lib/lib/core/chat.js +2 -1
  20. package/dist-lib/lib/core/chunk.d.ts +2 -2
  21. package/dist-lib/lib/core/chunk.js +5 -1
  22. package/dist-lib/lib/core/document-attachment.js +3 -0
  23. package/dist-lib/lib/core/files/index.js +4 -4
  24. package/dist-lib/lib/core/files/records/chunks.js +21 -0
  25. package/dist-lib/lib/core/files/records/purge.js +4 -3
  26. package/dist-lib/lib/core/files/records/source.js +3 -5
  27. package/dist-lib/lib/core/files/upload.js +3 -2
  28. package/dist-lib/lib/core/video/attachment.d.ts +1 -0
  29. package/dist-lib/lib/core/video/attachment.js +7 -0
  30. package/dist-lib/lib/core/video/digest.d.ts +16 -0
  31. package/dist-lib/lib/core/video/digest.js +57 -0
  32. package/dist-lib/lib/core/video/frames.d.ts +32 -0
  33. package/dist-lib/lib/core/video/frames.js +224 -0
  34. package/dist-lib/lib/core.js +25 -5
  35. package/dist-lib/lib/credential-pusher.d.ts +5 -0
  36. package/dist-lib/lib/credential-pusher.js +42 -11
  37. package/dist-lib/lib/errors.d.ts +20 -0
  38. package/dist-lib/lib/errors.js +20 -0
  39. package/dist-lib/lib/lent-harness.d.ts +2 -0
  40. package/dist-lib/lib/lent-harness.js +51 -0
  41. package/dist-lib/lib/mesh-scoped-engine.js +3 -0
  42. package/dist-lib/lib/run-notices.d.ts +1 -0
  43. package/dist-lib/lib/run-notices.js +2 -1
  44. package/dist-lib/lib/task.js +1 -1
  45. package/dist-lib/schema/engine.js +53 -2
  46. package/dist-lib/schema/indexes.js +2 -2
  47. package/dist-lib/schema/qvac.js +4 -2
  48. package/dist-lib/spec/bind.js +9 -0
  49. package/dist-lib/spec/calls.js +3 -0
  50. package/dist-lib/spec/capabilities.d.ts +6 -0
  51. package/dist-lib/spec/hrpc/hrpc.json +39 -0
  52. package/dist-lib/spec/hrpc/index.js +39 -3
  53. package/dist-lib/spec/hrpc/messages.js +177 -6
  54. package/dist-lib/spec/hyperschema/index.js +177 -6
  55. package/dist-lib/spec/hyperschema/schema.json +126 -0
  56. package/dist-lib/spec/hyperschema/types.d.ts +35 -0
  57. package/dist-lib/spec/mesh/hyperdb/messages.js +26 -11
  58. package/dist-lib/spec/mesh/hyperdispatch/messages.js +18 -8
  59. package/dist-lib/spec/mesh/hyperschema/index.js +18 -8
  60. package/dist-lib/spec/mesh/hyperschema/schema.json +11 -1
  61. package/dist-lib/spec/mesh/hyperschema/types.d.ts +3 -1
  62. package/package.json +4 -1
  63. package/tui/README.md +10 -0
  64. package/tui/app.mjs +63 -2
  65. package/tui/lib/folders-command.mjs +92 -0
  66. package/tui/lib/knowledge-import.mjs +3 -21
  67. package/tui/lib/local-path.mjs +21 -0
  68. package/tui/lib/render.mjs +5 -0
  69. package/tui/main.mjs +8 -0
@@ -588,6 +588,7 @@ export interface AssistantChunkV1 {
588
588
  capability?: string | null
589
589
  capabilityArgs?: unknown | null
590
590
  enhance?: AssistantEnhanceMode | null
591
+ sourceId?: string | null
591
592
  }
592
593
 
593
594
  export type AssistantChunk = (AssistantChunkV1 & { version?: number })
@@ -701,6 +702,7 @@ export interface AssistantUploadAttachmentRequest {
701
702
  fileId?: string | null
702
703
  totalBytes?: number
703
704
  meshId?: string | null
705
+ sourceId?: string | null
704
706
  }
705
707
 
706
708
  export interface AssistantUploadAttachmentResponse {
@@ -1891,6 +1893,33 @@ export interface AssistantDeleteAgentRequest {
1891
1893
  keepChats?: boolean
1892
1894
  }
1893
1895
 
1896
+ export type AssistantAgentFolderAccess = "read" | "write"
1897
+
1898
+ export interface AssistantAgentFolder {
1899
+ path: string
1900
+ access: AssistantAgentFolderAccess
1901
+ }
1902
+
1903
+ export interface AssistantAgentFoldersRequest {
1904
+ agentId: string
1905
+ }
1906
+
1907
+ export interface AssistantAgentFolders {
1908
+ agentId: string
1909
+ folders?: AssistantAgentFolder[] | null
1910
+ }
1911
+
1912
+ export interface AssistantAddAgentFolderRequest {
1913
+ agentId: string
1914
+ path: string
1915
+ access: AssistantAgentFolderAccess
1916
+ }
1917
+
1918
+ export interface AssistantRemoveAgentFolderRequest {
1919
+ agentId: string
1920
+ path: string
1921
+ }
1922
+
1894
1923
  export interface SchemaTypes {
1895
1924
  "@assistant/empty": AssistantEmpty
1896
1925
  "@assistant/ok-response": AssistantOkResponse
@@ -2197,4 +2226,10 @@ export interface SchemaTypes {
2197
2226
  "@assistant/model-memory": AssistantModelMemory
2198
2227
  "@assistant/device-scope": AssistantDeviceScope
2199
2228
  "@assistant/delete-agent-request": AssistantDeleteAgentRequest
2229
+ "@assistant/agent-folder-access": AssistantAgentFolderAccess
2230
+ "@assistant/agent-folder": AssistantAgentFolder
2231
+ "@assistant/agent-folders-request": AssistantAgentFoldersRequest
2232
+ "@assistant/agent-folders": AssistantAgentFolders
2233
+ "@assistant/add-agent-folder-request": AssistantAddAgentFolderRequest
2234
+ "@assistant/remove-agent-folder-request": AssistantRemoveAgentFolderRequest
2200
2235
  }
@@ -1,12 +1,12 @@
1
1
  // This file is autogenerated by the hyperschema compiler
2
- // Schema Version: 15
2
+ // Schema Version: 16
3
3
  /* eslint-disable camelcase */
4
4
  /* eslint-disable quotes */
5
5
  /* eslint-disable space-before-function-paren */
6
6
 
7
7
  import { c } from 'hyperschema/runtime'
8
8
 
9
- const VERSION = 15
9
+ const VERSION = 16
10
10
 
11
11
  // eslint-disable-next-line no-unused-vars
12
12
  let version = VERSION
@@ -1046,7 +1046,8 @@ const encoding27 = {
1046
1046
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
1047
1047
  ((version >= 10 && m.capability) ? 524288 : 0) |
1048
1048
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
1049
- ((version >= 10 && m.enhance) ? 2097152 : 0)
1049
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
1050
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
1050
1051
 
1051
1052
  c.string.preencode(state, m.id)
1052
1053
  c.string.preencode(state, m.chatId)
@@ -1078,6 +1079,7 @@ const encoding27 = {
1078
1079
  if (version >= 10 && m.capability) c.string.preencode(state, m.capability)
1079
1080
  if (version >= 10 && m.capabilityArgs) c.json.preencode(state, m.capabilityArgs)
1080
1081
  if (version >= 10 && m.enhance) encoding141.preencode(state, m.enhance)
1082
+ if (version >= 16 && m.sourceId) c.string.preencode(state, m.sourceId)
1081
1083
  },
1082
1084
  encode(state, m) {
1083
1085
  const flags =
@@ -1102,7 +1104,8 @@ const encoding27 = {
1102
1104
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
1103
1105
  ((version >= 10 && m.capability) ? 524288 : 0) |
1104
1106
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
1105
- ((version >= 10 && m.enhance) ? 2097152 : 0)
1107
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
1108
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
1106
1109
 
1107
1110
  c.string.encode(state, m.id)
1108
1111
  c.string.encode(state, m.chatId)
@@ -1134,6 +1137,7 @@ const encoding27 = {
1134
1137
  if (version >= 10 && m.capability) c.string.encode(state, m.capability)
1135
1138
  if (version >= 10 && m.capabilityArgs) c.json.encode(state, m.capabilityArgs)
1136
1139
  if (version >= 10 && m.enhance) encoding141.encode(state, m.enhance)
1140
+ if (version >= 16 && m.sourceId) c.string.encode(state, m.sourceId)
1137
1141
  },
1138
1142
  decode(state) {
1139
1143
  const r0 = c.string.decode(state)
@@ -1169,7 +1173,8 @@ const encoding27 = {
1169
1173
  senderMemberId: (version >= 8 && (flags & 262144) !== 0) ? c.fixed32.decode(state) : null,
1170
1174
  capability: (version >= 10 && (flags & 524288) !== 0) ? c.string.decode(state) : null,
1171
1175
  capabilityArgs: (version >= 10 && (flags & 1048576) !== 0) ? c.json.decode(state) : null,
1172
- enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null
1176
+ enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null,
1177
+ sourceId: (version >= 16 && (flags & 4194304) !== 0) ? c.string.decode(state) : null
1173
1178
  }
1174
1179
  }
1175
1180
  }
@@ -1312,7 +1317,8 @@ const encoding31 = {
1312
1317
  ((version >= 8 && m.senderMemberId) ? 131072 : 0) |
1313
1318
  ((version >= 10 && m.capability) ? 262144 : 0) |
1314
1319
  ((version >= 10 && m.capabilityArgs) ? 524288 : 0) |
1315
- ((version >= 10 && m.enhance) ? 1048576 : 0)
1320
+ ((version >= 10 && m.enhance) ? 1048576 : 0) |
1321
+ ((version >= 16 && m.sourceId) ? 2097152 : 0)
1316
1322
 
1317
1323
  c.string.preencode(state, m.id)
1318
1324
  c.string.preencode(state, m.chatId)
@@ -1342,6 +1348,7 @@ const encoding31 = {
1342
1348
  if (version >= 10 && m.capability) c.string.preencode(state, m.capability)
1343
1349
  if (version >= 10 && m.capabilityArgs) c.json.preencode(state, m.capabilityArgs)
1344
1350
  if (version >= 10 && m.enhance) encoding141.preencode(state, m.enhance)
1351
+ if (version >= 16 && m.sourceId) c.string.preencode(state, m.sourceId)
1345
1352
  },
1346
1353
  encode(state, m) {
1347
1354
  const flags =
@@ -1365,7 +1372,8 @@ const encoding31 = {
1365
1372
  ((version >= 8 && m.senderMemberId) ? 131072 : 0) |
1366
1373
  ((version >= 10 && m.capability) ? 262144 : 0) |
1367
1374
  ((version >= 10 && m.capabilityArgs) ? 524288 : 0) |
1368
- ((version >= 10 && m.enhance) ? 1048576 : 0)
1375
+ ((version >= 10 && m.enhance) ? 1048576 : 0) |
1376
+ ((version >= 16 && m.sourceId) ? 2097152 : 0)
1369
1377
 
1370
1378
  c.string.encode(state, m.id)
1371
1379
  c.string.encode(state, m.chatId)
@@ -1395,6 +1403,7 @@ const encoding31 = {
1395
1403
  if (version >= 10 && m.capability) c.string.encode(state, m.capability)
1396
1404
  if (version >= 10 && m.capabilityArgs) c.json.encode(state, m.capabilityArgs)
1397
1405
  if (version >= 10 && m.enhance) encoding141.encode(state, m.enhance)
1406
+ if (version >= 16 && m.sourceId) c.string.encode(state, m.sourceId)
1398
1407
  },
1399
1408
  decode(state) {
1400
1409
  const r0 = c.string.decode(state)
@@ -1428,7 +1437,8 @@ const encoding31 = {
1428
1437
  senderMemberId: (version >= 8 && (flags & 131072) !== 0) ? c.fixed32.decode(state) : null,
1429
1438
  capability: (version >= 10 && (flags & 262144) !== 0) ? c.string.decode(state) : null,
1430
1439
  capabilityArgs: (version >= 10 && (flags & 524288) !== 0) ? c.json.decode(state) : null,
1431
- enhance: (version >= 10 && (flags & 1048576) !== 0) ? encoding141.decode(state) : null
1440
+ enhance: (version >= 10 && (flags & 1048576) !== 0) ? encoding141.decode(state) : null,
1441
+ sourceId: (version >= 16 && (flags & 2097152) !== 0) ? c.string.decode(state) : null
1432
1442
  }
1433
1443
  }
1434
1444
  }
@@ -7124,7 +7134,8 @@ const encoding179 = {
7124
7134
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
7125
7135
  ((version >= 10 && m.capability) ? 524288 : 0) |
7126
7136
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
7127
- ((version >= 10 && m.enhance) ? 2097152 : 0)
7137
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
7138
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
7128
7139
 
7129
7140
  c.string.preencode(state, m.chatId)
7130
7141
  c.uint.preencode(state, flags)
@@ -7155,6 +7166,7 @@ const encoding179 = {
7155
7166
  if (version >= 10 && m.capability) c.string.preencode(state, m.capability)
7156
7167
  if (version >= 10 && m.capabilityArgs) c.json.preencode(state, m.capabilityArgs)
7157
7168
  if (version >= 10 && m.enhance) encoding141.preencode(state, m.enhance)
7169
+ if (version >= 16 && m.sourceId) c.string.preencode(state, m.sourceId)
7158
7170
  },
7159
7171
  encode(state, m) {
7160
7172
  const flags =
@@ -7179,7 +7191,8 @@ const encoding179 = {
7179
7191
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
7180
7192
  ((version >= 10 && m.capability) ? 524288 : 0) |
7181
7193
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
7182
- ((version >= 10 && m.enhance) ? 2097152 : 0)
7194
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
7195
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
7183
7196
 
7184
7197
  c.string.encode(state, m.chatId)
7185
7198
  c.uint.encode(state, flags)
@@ -7210,6 +7223,7 @@ const encoding179 = {
7210
7223
  if (version >= 10 && m.capability) c.string.encode(state, m.capability)
7211
7224
  if (version >= 10 && m.capabilityArgs) c.json.encode(state, m.capabilityArgs)
7212
7225
  if (version >= 10 && m.enhance) encoding141.encode(state, m.enhance)
7226
+ if (version >= 16 && m.sourceId) c.string.encode(state, m.sourceId)
7213
7227
  },
7214
7228
  decode(state) {
7215
7229
  const r1 = c.string.decode(state)
@@ -7244,7 +7258,8 @@ const encoding179 = {
7244
7258
  senderMemberId: (version >= 8 && (flags & 262144) !== 0) ? c.fixed32.decode(state) : null,
7245
7259
  capability: (version >= 10 && (flags & 524288) !== 0) ? c.string.decode(state) : null,
7246
7260
  capabilityArgs: (version >= 10 && (flags & 1048576) !== 0) ? c.json.decode(state) : null,
7247
- enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null
7261
+ enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null,
7262
+ sourceId: (version >= 16 && (flags & 4194304) !== 0) ? c.string.decode(state) : null
7248
7263
  }
7249
7264
  }
7250
7265
  }
@@ -1,12 +1,12 @@
1
1
  // This file is autogenerated by the hyperschema compiler
2
- // Schema Version: 15
2
+ // Schema Version: 16
3
3
  /* eslint-disable camelcase */
4
4
  /* eslint-disable quotes */
5
5
  /* eslint-disable space-before-function-paren */
6
6
 
7
7
  import { c } from 'hyperschema/runtime'
8
8
 
9
- const VERSION = 15
9
+ const VERSION = 16
10
10
 
11
11
  // eslint-disable-next-line no-unused-vars
12
12
  let version = VERSION
@@ -1046,7 +1046,8 @@ const encoding27 = {
1046
1046
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
1047
1047
  ((version >= 10 && m.capability) ? 524288 : 0) |
1048
1048
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
1049
- ((version >= 10 && m.enhance) ? 2097152 : 0)
1049
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
1050
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
1050
1051
 
1051
1052
  c.string.preencode(state, m.id)
1052
1053
  c.string.preencode(state, m.chatId)
@@ -1078,6 +1079,7 @@ const encoding27 = {
1078
1079
  if (version >= 10 && m.capability) c.string.preencode(state, m.capability)
1079
1080
  if (version >= 10 && m.capabilityArgs) c.json.preencode(state, m.capabilityArgs)
1080
1081
  if (version >= 10 && m.enhance) encoding141.preencode(state, m.enhance)
1082
+ if (version >= 16 && m.sourceId) c.string.preencode(state, m.sourceId)
1081
1083
  },
1082
1084
  encode(state, m) {
1083
1085
  const flags =
@@ -1102,7 +1104,8 @@ const encoding27 = {
1102
1104
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
1103
1105
  ((version >= 10 && m.capability) ? 524288 : 0) |
1104
1106
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
1105
- ((version >= 10 && m.enhance) ? 2097152 : 0)
1107
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
1108
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
1106
1109
 
1107
1110
  c.string.encode(state, m.id)
1108
1111
  c.string.encode(state, m.chatId)
@@ -1134,6 +1137,7 @@ const encoding27 = {
1134
1137
  if (version >= 10 && m.capability) c.string.encode(state, m.capability)
1135
1138
  if (version >= 10 && m.capabilityArgs) c.json.encode(state, m.capabilityArgs)
1136
1139
  if (version >= 10 && m.enhance) encoding141.encode(state, m.enhance)
1140
+ if (version >= 16 && m.sourceId) c.string.encode(state, m.sourceId)
1137
1141
  },
1138
1142
  decode(state) {
1139
1143
  const r0 = c.string.decode(state)
@@ -1169,7 +1173,8 @@ const encoding27 = {
1169
1173
  senderMemberId: (version >= 8 && (flags & 262144) !== 0) ? c.fixed32.decode(state) : null,
1170
1174
  capability: (version >= 10 && (flags & 524288) !== 0) ? c.string.decode(state) : null,
1171
1175
  capabilityArgs: (version >= 10 && (flags & 1048576) !== 0) ? c.json.decode(state) : null,
1172
- enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null
1176
+ enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null,
1177
+ sourceId: (version >= 16 && (flags & 4194304) !== 0) ? c.string.decode(state) : null
1173
1178
  }
1174
1179
  }
1175
1180
  }
@@ -1312,7 +1317,8 @@ const encoding31 = {
1312
1317
  ((version >= 8 && m.senderMemberId) ? 131072 : 0) |
1313
1318
  ((version >= 10 && m.capability) ? 262144 : 0) |
1314
1319
  ((version >= 10 && m.capabilityArgs) ? 524288 : 0) |
1315
- ((version >= 10 && m.enhance) ? 1048576 : 0)
1320
+ ((version >= 10 && m.enhance) ? 1048576 : 0) |
1321
+ ((version >= 16 && m.sourceId) ? 2097152 : 0)
1316
1322
 
1317
1323
  c.string.preencode(state, m.id)
1318
1324
  c.string.preencode(state, m.chatId)
@@ -1342,6 +1348,7 @@ const encoding31 = {
1342
1348
  if (version >= 10 && m.capability) c.string.preencode(state, m.capability)
1343
1349
  if (version >= 10 && m.capabilityArgs) c.json.preencode(state, m.capabilityArgs)
1344
1350
  if (version >= 10 && m.enhance) encoding141.preencode(state, m.enhance)
1351
+ if (version >= 16 && m.sourceId) c.string.preencode(state, m.sourceId)
1345
1352
  },
1346
1353
  encode(state, m) {
1347
1354
  const flags =
@@ -1365,7 +1372,8 @@ const encoding31 = {
1365
1372
  ((version >= 8 && m.senderMemberId) ? 131072 : 0) |
1366
1373
  ((version >= 10 && m.capability) ? 262144 : 0) |
1367
1374
  ((version >= 10 && m.capabilityArgs) ? 524288 : 0) |
1368
- ((version >= 10 && m.enhance) ? 1048576 : 0)
1375
+ ((version >= 10 && m.enhance) ? 1048576 : 0) |
1376
+ ((version >= 16 && m.sourceId) ? 2097152 : 0)
1369
1377
 
1370
1378
  c.string.encode(state, m.id)
1371
1379
  c.string.encode(state, m.chatId)
@@ -1395,6 +1403,7 @@ const encoding31 = {
1395
1403
  if (version >= 10 && m.capability) c.string.encode(state, m.capability)
1396
1404
  if (version >= 10 && m.capabilityArgs) c.json.encode(state, m.capabilityArgs)
1397
1405
  if (version >= 10 && m.enhance) encoding141.encode(state, m.enhance)
1406
+ if (version >= 16 && m.sourceId) c.string.encode(state, m.sourceId)
1398
1407
  },
1399
1408
  decode(state) {
1400
1409
  const r0 = c.string.decode(state)
@@ -1428,7 +1437,8 @@ const encoding31 = {
1428
1437
  senderMemberId: (version >= 8 && (flags & 131072) !== 0) ? c.fixed32.decode(state) : null,
1429
1438
  capability: (version >= 10 && (flags & 262144) !== 0) ? c.string.decode(state) : null,
1430
1439
  capabilityArgs: (version >= 10 && (flags & 524288) !== 0) ? c.json.decode(state) : null,
1431
- enhance: (version >= 10 && (flags & 1048576) !== 0) ? encoding141.decode(state) : null
1440
+ enhance: (version >= 10 && (flags & 1048576) !== 0) ? encoding141.decode(state) : null,
1441
+ sourceId: (version >= 16 && (flags & 2097152) !== 0) ? c.string.decode(state) : null
1432
1442
  }
1433
1443
  }
1434
1444
  }
@@ -1,12 +1,12 @@
1
1
  // This file is autogenerated by the hyperschema compiler
2
- // Schema Version: 15
2
+ // Schema Version: 16
3
3
  /* eslint-disable camelcase */
4
4
  /* eslint-disable quotes */
5
5
  /* eslint-disable space-before-function-paren */
6
6
 
7
7
  import { c } from 'hyperschema/runtime'
8
8
 
9
- const VERSION = 15
9
+ const VERSION = 16
10
10
 
11
11
  // eslint-disable-next-line no-unused-vars
12
12
  let version = VERSION
@@ -1046,7 +1046,8 @@ const encoding27 = {
1046
1046
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
1047
1047
  ((version >= 10 && m.capability) ? 524288 : 0) |
1048
1048
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
1049
- ((version >= 10 && m.enhance) ? 2097152 : 0)
1049
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
1050
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
1050
1051
 
1051
1052
  c.string.preencode(state, m.id)
1052
1053
  c.string.preencode(state, m.chatId)
@@ -1078,6 +1079,7 @@ const encoding27 = {
1078
1079
  if (version >= 10 && m.capability) c.string.preencode(state, m.capability)
1079
1080
  if (version >= 10 && m.capabilityArgs) c.json.preencode(state, m.capabilityArgs)
1080
1081
  if (version >= 10 && m.enhance) encoding141.preencode(state, m.enhance)
1082
+ if (version >= 16 && m.sourceId) c.string.preencode(state, m.sourceId)
1081
1083
  },
1082
1084
  encode(state, m) {
1083
1085
  const flags =
@@ -1102,7 +1104,8 @@ const encoding27 = {
1102
1104
  ((version >= 8 && m.senderMemberId) ? 262144 : 0) |
1103
1105
  ((version >= 10 && m.capability) ? 524288 : 0) |
1104
1106
  ((version >= 10 && m.capabilityArgs) ? 1048576 : 0) |
1105
- ((version >= 10 && m.enhance) ? 2097152 : 0)
1107
+ ((version >= 10 && m.enhance) ? 2097152 : 0) |
1108
+ ((version >= 16 && m.sourceId) ? 4194304 : 0)
1106
1109
 
1107
1110
  c.string.encode(state, m.id)
1108
1111
  c.string.encode(state, m.chatId)
@@ -1134,6 +1137,7 @@ const encoding27 = {
1134
1137
  if (version >= 10 && m.capability) c.string.encode(state, m.capability)
1135
1138
  if (version >= 10 && m.capabilityArgs) c.json.encode(state, m.capabilityArgs)
1136
1139
  if (version >= 10 && m.enhance) encoding141.encode(state, m.enhance)
1140
+ if (version >= 16 && m.sourceId) c.string.encode(state, m.sourceId)
1137
1141
  },
1138
1142
  decode(state) {
1139
1143
  const r0 = c.string.decode(state)
@@ -1169,7 +1173,8 @@ const encoding27 = {
1169
1173
  senderMemberId: (version >= 8 && (flags & 262144) !== 0) ? c.fixed32.decode(state) : null,
1170
1174
  capability: (version >= 10 && (flags & 524288) !== 0) ? c.string.decode(state) : null,
1171
1175
  capabilityArgs: (version >= 10 && (flags & 1048576) !== 0) ? c.json.decode(state) : null,
1172
- enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null
1176
+ enhance: (version >= 10 && (flags & 2097152) !== 0) ? encoding141.decode(state) : null,
1177
+ sourceId: (version >= 16 && (flags & 4194304) !== 0) ? c.string.decode(state) : null
1173
1178
  }
1174
1179
  }
1175
1180
  }
@@ -1312,7 +1317,8 @@ const encoding31 = {
1312
1317
  ((version >= 8 && m.senderMemberId) ? 131072 : 0) |
1313
1318
  ((version >= 10 && m.capability) ? 262144 : 0) |
1314
1319
  ((version >= 10 && m.capabilityArgs) ? 524288 : 0) |
1315
- ((version >= 10 && m.enhance) ? 1048576 : 0)
1320
+ ((version >= 10 && m.enhance) ? 1048576 : 0) |
1321
+ ((version >= 16 && m.sourceId) ? 2097152 : 0)
1316
1322
 
1317
1323
  c.string.preencode(state, m.id)
1318
1324
  c.string.preencode(state, m.chatId)
@@ -1342,6 +1348,7 @@ const encoding31 = {
1342
1348
  if (version >= 10 && m.capability) c.string.preencode(state, m.capability)
1343
1349
  if (version >= 10 && m.capabilityArgs) c.json.preencode(state, m.capabilityArgs)
1344
1350
  if (version >= 10 && m.enhance) encoding141.preencode(state, m.enhance)
1351
+ if (version >= 16 && m.sourceId) c.string.preencode(state, m.sourceId)
1345
1352
  },
1346
1353
  encode(state, m) {
1347
1354
  const flags =
@@ -1365,7 +1372,8 @@ const encoding31 = {
1365
1372
  ((version >= 8 && m.senderMemberId) ? 131072 : 0) |
1366
1373
  ((version >= 10 && m.capability) ? 262144 : 0) |
1367
1374
  ((version >= 10 && m.capabilityArgs) ? 524288 : 0) |
1368
- ((version >= 10 && m.enhance) ? 1048576 : 0)
1375
+ ((version >= 10 && m.enhance) ? 1048576 : 0) |
1376
+ ((version >= 16 && m.sourceId) ? 2097152 : 0)
1369
1377
 
1370
1378
  c.string.encode(state, m.id)
1371
1379
  c.string.encode(state, m.chatId)
@@ -1395,6 +1403,7 @@ const encoding31 = {
1395
1403
  if (version >= 10 && m.capability) c.string.encode(state, m.capability)
1396
1404
  if (version >= 10 && m.capabilityArgs) c.json.encode(state, m.capabilityArgs)
1397
1405
  if (version >= 10 && m.enhance) encoding141.encode(state, m.enhance)
1406
+ if (version >= 16 && m.sourceId) c.string.encode(state, m.sourceId)
1398
1407
  },
1399
1408
  decode(state) {
1400
1409
  const r0 = c.string.decode(state)
@@ -1428,7 +1437,8 @@ const encoding31 = {
1428
1437
  senderMemberId: (version >= 8 && (flags & 131072) !== 0) ? c.fixed32.decode(state) : null,
1429
1438
  capability: (version >= 10 && (flags & 262144) !== 0) ? c.string.decode(state) : null,
1430
1439
  capabilityArgs: (version >= 10 && (flags & 524288) !== 0) ? c.json.decode(state) : null,
1431
- enhance: (version >= 10 && (flags & 1048576) !== 0) ? encoding141.decode(state) : null
1440
+ enhance: (version >= 10 && (flags & 1048576) !== 0) ? encoding141.decode(state) : null,
1441
+ sourceId: (version >= 16 && (flags & 2097152) !== 0) ? c.string.decode(state) : null
1432
1442
  }
1433
1443
  }
1434
1444
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": 15,
2
+ "version": 16,
3
3
  "schema": [
4
4
  {
5
5
  "name": "chunk-type",
@@ -743,6 +743,11 @@
743
743
  "name": "enhance",
744
744
  "type": "@qvac/enhance-mode",
745
745
  "version": 10
746
+ },
747
+ {
748
+ "name": "sourceId",
749
+ "type": "string",
750
+ "version": 16
746
751
  }
747
752
  ]
748
753
  },
@@ -935,6 +940,11 @@
935
940
  "name": "enhance",
936
941
  "type": "@qvac/enhance-mode",
937
942
  "version": 10
943
+ },
944
+ {
945
+ "name": "sourceId",
946
+ "type": "string",
947
+ "version": 16
938
948
  }
939
949
  ]
940
950
  },
@@ -1,5 +1,5 @@
1
1
  // This file is autogenerated by hyperschema-ts
2
- // Schema version: 15
2
+ // Schema version: 16
3
3
  // Do not edit manually.
4
4
 
5
5
  export type QvacChunkType = "user-message" | "content" | "thinking" | "tool-call" | "tool-result" | "attachment" | "approval-request" | "run-status" | "run-request" | "sources" | "compaction"
@@ -140,6 +140,7 @@ export interface QvacChunkV1 {
140
140
  capability?: string | null
141
141
  capabilityArgs?: unknown | null
142
142
  enhance?: QvacEnhanceMode | null
143
+ sourceId?: string | null
143
144
  }
144
145
 
145
146
  export type QvacChunk = (QvacChunkV1 & { version?: number })
@@ -179,6 +180,7 @@ export interface QvacAppendChunkOperationV1 {
179
180
  capability?: string | null
180
181
  capabilityArgs?: unknown | null
181
182
  enhance?: QvacEnhanceMode | null
183
+ sourceId?: string | null
182
184
  }
183
185
 
184
186
  export type QvacAppendChunkOperation = (QvacAppendChunkOperationV1 & { version?: number })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/core",
3
- "version": "0.10.2",
3
+ "version": "0.10.4",
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",
@@ -252,11 +253,13 @@
252
253
  "bare-crypto": "^1.15.3",
253
254
  "bare-events": "^2.9.1",
254
255
  "bare-fetch": "^3.0.1",
256
+ "bare-ffmpeg": "^1.5.0",
255
257
  "bare-file-logger": "^1.2.1",
256
258
  "bare-fs": "^4.7.2",
257
259
  "bare-gpu-info": "^0.1.0",
258
260
  "bare-http1": "4.6.1",
259
261
  "bare-media": "^2.10.0",
262
+ "bare-module": "~7.4.0",
260
263
  "bare-os": "^3.9.1",
261
264
  "bare-path": "^3.0.1",
262
265
  "bare-pdfium": "^1.5.5",
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
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',
@@ -1680,7 +1690,8 @@ const AGENT_COMMANDS = new Set([
1680
1690
  'skill',
1681
1691
  'scope',
1682
1692
  'connect',
1683
- 'cred'
1693
+ 'cred',
1694
+ 'folders'
1684
1695
  ])
1685
1696
  const NO_AGENT = 'no agent in this mesh · /agent new <name> or /agent use <name|id>'
1686
1697
 
@@ -2195,6 +2206,21 @@ export class ChatApp {
2195
2206
  }
2196
2207
  }
2197
2208
 
2209
+ _reopenMeshes(meshes) {
2210
+ if (!this.engine.openMesh) return null
2211
+
2212
+ return meshes
2213
+ .filter((mesh) => !mesh.open)
2214
+ .map((mesh) => async () => {
2215
+ try {
2216
+ await this.engine.openMesh({ meshId: mesh.meshId })
2217
+ return null
2218
+ } catch (error) {
2219
+ return { type: 'mesh.reopen-failed', meshId: mesh.meshId, error }
2220
+ }
2221
+ })
2222
+ }
2223
+
2198
2224
  // the window's mesh can go without the window doing anything: a kick retires the account
2199
2225
  _watchNextMeshes() {
2200
2226
  if (!this.engine.meshesWatch) return null
@@ -2487,6 +2513,7 @@ export class ChatApp {
2487
2513
  '',
2488
2514
  'Advanced',
2489
2515
  ' /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',
2516
+ ' /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>',
2490
2517
  ' /scope skills all|selected — switch scope',
2491
2518
  ' /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',
2492
2519
  ' /leave — leave the active mesh; the device lands on another mesh it can write to, or mints a fresh account',
@@ -3584,6 +3611,22 @@ export class ChatApp {
3584
3611
  })
3585
3612
  }
3586
3613
 
3614
+ if (cmd === 'folders') {
3615
+ return [
3616
+ this,
3617
+ async () => {
3618
+ const provider = agent.providerDeviceId
3619
+ const remote = provider && !(await this._hostedHere(provider))
3620
+ const host = remote ? this._deviceName(b4a.toHex(provider)) : null
3621
+ const lent = agent.lenderDeviceId
3622
+ const borrows = lent && !(await this._hostedHere(lent))
3623
+ const lender = borrows ? this._deviceName(b4a.toHex(lent)) : null
3624
+
3625
+ return foldersCommand(engine, { agent, host, lender }, rawArgs)
3626
+ }
3627
+ ]
3628
+ }
3629
+
3587
3630
  if (cmd === 'cred') {
3588
3631
  const [key, ...valueParts] = rest
3589
3632
  const value = valueParts.join(' ')
@@ -6453,9 +6496,27 @@ export class ChatApp {
6453
6496
  const ids = new Set(msg.meshes.map((mesh) => mesh.meshId))
6454
6497
  // a mesh transition in flight moves the window itself
6455
6498
  const lost = !this._booting && this._meshIds?.has(this.meshId) && !ids.has(this.meshId)
6499
+ // only the startup frame: a later closed mesh was closed on purpose
6500
+ const first = this._meshIds === null
6456
6501
  this._meshIds = ids
6457
6502
 
6458
- return [this, batch(this._watchNextMeshes(), lost ? this._lostMesh(this.meshId) : null)]
6503
+ return [
6504
+ this,
6505
+ batch(
6506
+ this._watchNextMeshes(),
6507
+ lost ? this._lostMesh(this.meshId) : null,
6508
+ first ? this._reopenMeshes(msg.meshes) : null
6509
+ )
6510
+ ]
6511
+ }
6512
+
6513
+ if (msg.type === 'mesh.reopen-failed') {
6514
+ this.status = fg.err.render(
6515
+ `could not reopen mesh ${msg.meshId.slice(0, 8)}: ${msg.error.message}`
6516
+ )
6517
+ this._render()
6518
+
6519
+ return [this, null]
6459
6520
  }
6460
6521
 
6461
6522
  if (msg.type === 'meshes.done') {