@qvac/core 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +69 -1
  2. package/README.md +20 -4
  3. package/dist-lib/lib/api/chat-move.d.ts +3 -0
  4. package/dist-lib/lib/api/chat-move.js +7 -0
  5. package/dist-lib/lib/api/chat.d.ts +1 -1
  6. package/dist-lib/lib/api/chat.js +2 -1
  7. package/dist-lib/lib/api/chunk-delta.d.ts +7 -0
  8. package/dist-lib/lib/api/chunk-delta.js +33 -0
  9. package/dist-lib/lib/api/chunks.d.ts +1 -1
  10. package/dist-lib/lib/api/chunks.js +6 -3
  11. package/dist-lib/lib/api/index.d.ts +2 -0
  12. package/dist-lib/lib/api/index.js +2 -0
  13. package/dist-lib/lib/api/mesh.d.ts +2 -1
  14. package/dist-lib/lib/api/mesh.js +4 -0
  15. package/dist-lib/lib/assistant/harness.d.ts +8 -10
  16. package/dist-lib/lib/assistant.js +1 -1
  17. package/dist-lib/lib/constants.d.ts +1 -0
  18. package/dist-lib/lib/constants.js +1 -0
  19. package/dist-lib/lib/core/archived-mesh.js +3 -42
  20. package/dist-lib/lib/core/chat-activity.js +23 -10
  21. package/dist-lib/lib/core/chat-copy.d.ts +24 -0
  22. package/dist-lib/lib/core/chat-copy.js +115 -0
  23. package/dist-lib/lib/core/chat-move.d.ts +65 -0
  24. package/dist-lib/lib/core/chat-move.js +525 -0
  25. package/dist-lib/lib/core/chat.d.ts +6 -0
  26. package/dist-lib/lib/core/chat.js +11 -3
  27. package/dist-lib/lib/core/collections.d.ts +2 -0
  28. package/dist-lib/lib/core/collections.js +2 -0
  29. package/dist-lib/lib/core/contract/compute.d.ts +1 -1
  30. package/dist-lib/lib/core/contract/compute.js +2 -1
  31. package/dist-lib/lib/core/contract/index.js +2 -0
  32. package/dist-lib/lib/core/contract/invites.d.ts +1 -0
  33. package/dist-lib/lib/core/contract/invites.js +1 -1
  34. package/dist-lib/lib/core/contract/mesh-name.d.ts +3 -0
  35. package/dist-lib/lib/core/contract/mesh-name.js +26 -0
  36. package/dist-lib/lib/core/contract/writers.js +10 -3
  37. package/dist-lib/lib/core/files/index.d.ts +1 -1
  38. package/dist-lib/lib/core/files/index.js +1 -1
  39. package/dist-lib/lib/core/files/preview/index.js +4 -1
  40. package/dist-lib/lib/core/files/processing/source.js +4 -1
  41. package/dist-lib/lib/core/files/store/index.d.ts +2 -1
  42. package/dist-lib/lib/core/files/store/index.js +2 -1
  43. package/dist-lib/lib/core/files/store/reference.d.ts +3 -0
  44. package/dist-lib/lib/core/files/store/reference.js +8 -0
  45. package/dist-lib/lib/core/files/store/sweep.js +3 -1
  46. package/dist-lib/lib/core/local/index.d.ts +4 -1
  47. package/dist-lib/lib/core/local/index.js +14 -1
  48. package/dist-lib/lib/core/mesh-seed-handoff.d.ts +3 -1
  49. package/dist-lib/lib/core/mesh-seed-handoff.js +1 -0
  50. package/dist-lib/lib/core/mesh.d.ts +5 -1
  51. package/dist-lib/lib/core/mesh.js +16 -1
  52. package/dist-lib/lib/core/sync/index.js +9 -1
  53. package/dist-lib/lib/core.d.ts +9 -0
  54. package/dist-lib/lib/core.js +156 -30
  55. package/dist-lib/lib/custom-model-pusher.js +9 -5
  56. package/dist-lib/lib/mesh-scoped-engine.js +5 -0
  57. package/dist-lib/schema/config.d.ts +1 -1
  58. package/dist-lib/schema/config.js +1 -1
  59. package/dist-lib/schema/engine.js +80 -1
  60. package/dist-lib/schema/local.js +17 -0
  61. package/dist-lib/schema/qvac.d.ts +2 -0
  62. package/dist-lib/schema/qvac.js +16 -0
  63. package/dist-lib/spec/bind.js +25 -0
  64. package/dist-lib/spec/calls.js +5 -0
  65. package/dist-lib/spec/capabilities.d.ts +10 -0
  66. package/dist-lib/spec/config/hyperconf/index.js +1 -1
  67. package/dist-lib/spec/hrpc/hrpc.json +65 -0
  68. package/dist-lib/spec/hrpc/index.js +66 -4
  69. package/dist-lib/spec/hrpc/messages.js +1398 -1154
  70. package/dist-lib/spec/hyperschema/index.js +1398 -1154
  71. package/dist-lib/spec/hyperschema/schema.json +204 -0
  72. package/dist-lib/spec/hyperschema/types.d.ts +47 -0
  73. package/dist-lib/spec/local/hyperdb/db.json +17 -1
  74. package/dist-lib/spec/local/hyperdb/index.js +83 -2
  75. package/dist-lib/spec/local/hyperdb/messages.js +340 -136
  76. package/dist-lib/spec/local/hyperschema/index.js +107 -2
  77. package/dist-lib/spec/local/hyperschema/schema.json +78 -1
  78. package/dist-lib/spec/local/hyperschema/types.d.ts +18 -1
  79. package/dist-lib/spec/mesh/hyperdb/db.json +16 -1
  80. package/dist-lib/spec/mesh/hyperdb/index.js +71 -2
  81. package/dist-lib/spec/mesh/hyperdb/messages.js +454 -228
  82. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +7 -1
  83. package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
  84. package/dist-lib/spec/mesh/hyperdispatch/messages.js +150 -2
  85. package/dist-lib/spec/mesh/hyperschema/index.js +150 -2
  86. package/dist-lib/spec/mesh/hyperschema/schema.json +76 -1
  87. package/dist-lib/spec/mesh/hyperschema/types.d.ts +21 -1
  88. package/package.json +5 -3
  89. package/tui/app.mjs +89 -3
  90. package/tui/lib/move-command.mjs +17 -0
@@ -1271,6 +1271,154 @@
1271
1271
  }
1272
1272
  ]
1273
1273
  },
1274
+ {
1275
+ "name": "chat-move-state",
1276
+ "namespace": "assistant",
1277
+ "offset": 1,
1278
+ "enum": [
1279
+ {
1280
+ "key": "carrying",
1281
+ "version": 1
1282
+ },
1283
+ {
1284
+ "key": "leaving",
1285
+ "version": 1
1286
+ },
1287
+ {
1288
+ "key": "complete",
1289
+ "version": 1
1290
+ },
1291
+ {
1292
+ "key": "failed",
1293
+ "version": 1
1294
+ }
1295
+ ],
1296
+ "strings": true
1297
+ },
1298
+ {
1299
+ "name": "move-chat-to-mesh-request",
1300
+ "namespace": "assistant",
1301
+ "compact": false,
1302
+ "flagsPosition": 3,
1303
+ "fields": [
1304
+ {
1305
+ "name": "chatId",
1306
+ "required": true,
1307
+ "type": "string",
1308
+ "version": 1
1309
+ },
1310
+ {
1311
+ "name": "meshId",
1312
+ "required": true,
1313
+ "type": "string",
1314
+ "version": 1
1315
+ },
1316
+ {
1317
+ "name": "targetMeshId",
1318
+ "required": true,
1319
+ "type": "string",
1320
+ "version": 1
1321
+ },
1322
+ {
1323
+ "name": "agentId",
1324
+ "type": "string",
1325
+ "version": 1
1326
+ }
1327
+ ]
1328
+ },
1329
+ {
1330
+ "name": "chat-move",
1331
+ "namespace": "assistant",
1332
+ "compact": false,
1333
+ "flagsPosition": 7,
1334
+ "fields": [
1335
+ {
1336
+ "name": "meshId",
1337
+ "required": true,
1338
+ "type": "string",
1339
+ "version": 1
1340
+ },
1341
+ {
1342
+ "name": "chatId",
1343
+ "required": true,
1344
+ "type": "string",
1345
+ "version": 1
1346
+ },
1347
+ {
1348
+ "name": "targetMeshId",
1349
+ "required": true,
1350
+ "type": "string",
1351
+ "version": 1
1352
+ },
1353
+ {
1354
+ "name": "targetChatId",
1355
+ "required": true,
1356
+ "type": "string",
1357
+ "version": 1
1358
+ },
1359
+ {
1360
+ "name": "state",
1361
+ "required": true,
1362
+ "type": "@assistant/chat-move-state",
1363
+ "version": 1
1364
+ },
1365
+ {
1366
+ "name": "files",
1367
+ "required": true,
1368
+ "type": "uint",
1369
+ "version": 1
1370
+ },
1371
+ {
1372
+ "name": "carried",
1373
+ "required": true,
1374
+ "type": "uint",
1375
+ "version": 1
1376
+ },
1377
+ {
1378
+ "name": "waiting",
1379
+ "array": true,
1380
+ "type": "string",
1381
+ "version": 1
1382
+ },
1383
+ {
1384
+ "name": "restarted",
1385
+ "required": false,
1386
+ "type": "bool",
1387
+ "version": 1
1388
+ },
1389
+ {
1390
+ "name": "failure",
1391
+ "type": "string",
1392
+ "version": 1
1393
+ }
1394
+ ]
1395
+ },
1396
+ {
1397
+ "name": "set-chat-agent-request",
1398
+ "namespace": "assistant",
1399
+ "compact": false,
1400
+ "flagsPosition": -1,
1401
+ "fields": [
1402
+ {
1403
+ "name": "chatId",
1404
+ "required": true,
1405
+ "type": "string",
1406
+ "version": 1
1407
+ },
1408
+ {
1409
+ "name": "agentId",
1410
+ "required": true,
1411
+ "type": "string",
1412
+ "version": 1
1413
+ },
1414
+ {
1415
+ "name": "meshId",
1416
+ "required": true,
1417
+ "type": "string",
1418
+ "version": 1
1419
+ }
1420
+ ]
1421
+ },
1274
1422
  {
1275
1423
  "name": "set-chat-flag-request",
1276
1424
  "namespace": "assistant",
@@ -7393,6 +7541,11 @@
7393
7541
  "name": "awaitingFrom",
7394
7542
  "type": "string",
7395
7543
  "version": 1
7544
+ },
7545
+ {
7546
+ "name": "name",
7547
+ "type": "string",
7548
+ "version": 1
7396
7549
  }
7397
7550
  ]
7398
7551
  },
@@ -7415,6 +7568,25 @@
7415
7568
  }
7416
7569
  ]
7417
7570
  },
7571
+ {
7572
+ "name": "mesh-name-request",
7573
+ "namespace": "assistant",
7574
+ "compact": false,
7575
+ "flagsPosition": 1,
7576
+ "fields": [
7577
+ {
7578
+ "name": "meshId",
7579
+ "required": true,
7580
+ "type": "string",
7581
+ "version": 1
7582
+ },
7583
+ {
7584
+ "name": "name",
7585
+ "type": "string",
7586
+ "version": 1
7587
+ }
7588
+ ]
7589
+ },
7418
7590
  {
7419
7591
  "name": "mesh-list",
7420
7592
  "namespace": "assistant",
@@ -8259,6 +8431,38 @@
8259
8431
  "version": 1
8260
8432
  }
8261
8433
  ]
8434
+ },
8435
+ {
8436
+ "name": "chunk-delta",
8437
+ "namespace": "assistant",
8438
+ "compact": false,
8439
+ "flagsPosition": 0,
8440
+ "fields": [
8441
+ {
8442
+ "name": "reset",
8443
+ "required": false,
8444
+ "type": "bool",
8445
+ "version": 1
8446
+ },
8447
+ {
8448
+ "name": "chunks",
8449
+ "array": true,
8450
+ "type": "@assistant/chunk",
8451
+ "version": 1
8452
+ },
8453
+ {
8454
+ "name": "removed",
8455
+ "array": true,
8456
+ "type": "string",
8457
+ "version": 1
8458
+ },
8459
+ {
8460
+ "name": "count",
8461
+ "required": true,
8462
+ "type": "uint",
8463
+ "version": 1
8464
+ }
8465
+ ]
8262
8466
  }
8263
8467
  ]
8264
8468
  }
@@ -259,6 +259,34 @@ export interface AssistantRenameChatRequest {
259
259
  config: AssistantChatConfig
260
260
  }
261
261
 
262
+ export type AssistantChatMoveState = "carrying" | "leaving" | "complete" | "failed"
263
+
264
+ export interface AssistantMoveChatToMeshRequest {
265
+ chatId: string
266
+ meshId: string
267
+ targetMeshId: string
268
+ agentId?: string | null
269
+ }
270
+
271
+ export interface AssistantChatMove {
272
+ meshId: string
273
+ chatId: string
274
+ targetMeshId: string
275
+ targetChatId: string
276
+ state: AssistantChatMoveState
277
+ files: number
278
+ carried: number
279
+ waiting?: string[] | null
280
+ restarted?: boolean
281
+ failure?: string | null
282
+ }
283
+
284
+ export interface AssistantSetChatAgentRequest {
285
+ chatId: string
286
+ agentId: string
287
+ meshId: string
288
+ }
289
+
262
290
  export interface AssistantSetChatFlagRequest {
263
291
  chatId: string
264
292
  enabled?: boolean
@@ -1564,6 +1592,7 @@ export interface AssistantMeshEntry {
1564
1592
  compute?: boolean
1565
1593
  reason?: string | null
1566
1594
  awaitingFrom?: string | null
1595
+ name?: string | null
1567
1596
  }
1568
1597
 
1569
1598
  export interface AssistantMeshLabelRequest {
@@ -1571,6 +1600,11 @@ export interface AssistantMeshLabelRequest {
1571
1600
  label?: string | null
1572
1601
  }
1573
1602
 
1603
+ export interface AssistantMeshNameRequest {
1604
+ meshId: string
1605
+ name?: string | null
1606
+ }
1607
+
1574
1608
  export interface AssistantMeshList {
1575
1609
  meshes?: AssistantMeshEntry[] | null
1576
1610
  }
@@ -1782,6 +1816,13 @@ export interface AssistantModelUsers {
1782
1816
  agents?: AssistantModelUser[] | null
1783
1817
  }
1784
1818
 
1819
+ export interface AssistantChunkDelta {
1820
+ reset?: boolean
1821
+ chunks?: AssistantChunk[] | null
1822
+ removed?: string[] | null
1823
+ count: number
1824
+ }
1825
+
1785
1826
  export interface SchemaTypes {
1786
1827
  "@assistant/empty": AssistantEmpty
1787
1828
  "@assistant/ok-response": AssistantOkResponse
@@ -1825,6 +1866,10 @@ export interface SchemaTypes {
1825
1866
  "@assistant/chat-config": AssistantChatConfig
1826
1867
  "@assistant/create-chat-request": AssistantCreateChatRequest
1827
1868
  "@assistant/rename-chat-request": AssistantRenameChatRequest
1869
+ "@assistant/chat-move-state": AssistantChatMoveState
1870
+ "@assistant/move-chat-to-mesh-request": AssistantMoveChatToMeshRequest
1871
+ "@assistant/chat-move": AssistantChatMove
1872
+ "@assistant/set-chat-agent-request": AssistantSetChatAgentRequest
1828
1873
  "@assistant/set-chat-flag-request": AssistantSetChatFlagRequest
1829
1874
  "@assistant/chat-group-id": AssistantChatGroupId
1830
1875
  "@assistant/chat-group-config": AssistantChatGroupConfig
@@ -2033,6 +2078,7 @@ export interface SchemaTypes {
2033
2078
  "@assistant/file-retry-request": AssistantFileRetryRequest
2034
2079
  "@assistant/mesh-entry": AssistantMeshEntry
2035
2080
  "@assistant/mesh-label-request": AssistantMeshLabelRequest
2081
+ "@assistant/mesh-name-request": AssistantMeshNameRequest
2036
2082
  "@assistant/mesh-list": AssistantMeshList
2037
2083
  "@assistant/account": AssistantAccount
2038
2084
  "@assistant/mesh-target": AssistantMeshTarget
@@ -2074,4 +2120,5 @@ export interface SchemaTypes {
2074
2120
  "@assistant/model-users-request": AssistantModelUsersRequest
2075
2121
  "@assistant/model-user": AssistantModelUser
2076
2122
  "@assistant/model-users": AssistantModelUsers
2123
+ "@assistant/chunk-delta": AssistantChunkDelta
2077
2124
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": 6,
2
+ "version": 7,
3
3
  "offset": 0,
4
4
  "schema": [
5
5
  {
@@ -359,6 +359,22 @@
359
359
  },
360
360
  "map": "liveFilesMap"
361
361
  }
362
+ },
363
+ {
364
+ "name": "chat-moves",
365
+ "namespace": "local",
366
+ "id": 22,
367
+ "type": 1,
368
+ "version": 7,
369
+ "versionField": null,
370
+ "indexes": [],
371
+ "schema": "@local/chat-move",
372
+ "derived": false,
373
+ "key": [
374
+ "meshKey",
375
+ "chatId"
376
+ ],
377
+ "trigger": null
362
378
  }
363
379
  ]
364
380
  }
@@ -4,7 +4,7 @@
4
4
  import { IndexEncoder, c, b4a } from 'hyperdb/runtime'
5
5
  import { version, getEncoding, setVersion } from './messages.js'
6
6
 
7
- const versions = { schema: version, db: 6 }
7
+ const versions = { schema: version, db: 7 }
8
8
 
9
9
  import * as helpers0 from '../../../schema/indexes.js'
10
10
 
@@ -1478,6 +1478,85 @@ const index21 = {
1478
1478
  }
1479
1479
  collection18.indexes.push(index21)
1480
1480
 
1481
+ // '@local/chat-moves' collection key
1482
+ const collection22_key = new IndexEncoder([
1483
+ IndexEncoder.BUFFER,
1484
+ IndexEncoder.STRING
1485
+ ], { prefix: 22 })
1486
+
1487
+ function collection22_indexify (record) {
1488
+ const arr = []
1489
+
1490
+ const a0 = record.meshKey
1491
+ if (a0 === undefined) return arr
1492
+ arr.push(a0)
1493
+
1494
+ const a1 = record.chatId
1495
+ if (a1 === undefined) return arr
1496
+ arr.push(a1)
1497
+
1498
+ return arr
1499
+ }
1500
+
1501
+ // '@local/chat-moves' value encoding
1502
+ const collection22_enc = getEncoding('@local/chat-move/hyperdb#22')
1503
+
1504
+ // '@local/chat-moves' reconstruction function
1505
+ function collection22_reconstruct (schemaVersion, keyBuf, valueBuf) {
1506
+ const key = collection22_key.decode(keyBuf)
1507
+ setVersion(schemaVersion)
1508
+ const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
1509
+ const type = c.uint.decode(state)
1510
+ if (type !== 0) throw new Error('Unknown collection type: ' + type)
1511
+ collection22.decodedVersion = c.uint.decode(state)
1512
+ const record = collection22_enc.decode(state)
1513
+ record.meshKey = key[0]
1514
+ record.chatId = key[1]
1515
+ return record
1516
+ }
1517
+ // '@local/chat-moves' key reconstruction function
1518
+ function collection22_reconstruct_key (keyBuf) {
1519
+ const key = collection22_key.decode(keyBuf)
1520
+ return {
1521
+ meshKey: key[0],
1522
+ chatId: key[1]
1523
+ }
1524
+ }
1525
+
1526
+ // '@local/chat-moves'
1527
+ const collection22 = {
1528
+ name: '@local/chat-moves',
1529
+ id: 22,
1530
+ version: 7,
1531
+ encodeKey (record) {
1532
+ const key = [record.meshKey, record.chatId]
1533
+ return collection22_key.encode(key)
1534
+ },
1535
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
1536
+ return collection22_key.encodeRange({
1537
+ gt: gt ? collection22_indexify(gt) : null,
1538
+ lt: lt ? collection22_indexify(lt) : null,
1539
+ gte: gte ? collection22_indexify(gte) : null,
1540
+ lte: lte ? collection22_indexify(lte) : null
1541
+ })
1542
+ },
1543
+ encodeValue (schemaVersion, collectionVersion, record) {
1544
+ setVersion(schemaVersion)
1545
+ const state = { start: 0, end: 2, buffer: null }
1546
+ collection22_enc.preencode(state, record)
1547
+ state.buffer = b4a.allocUnsafe(state.end)
1548
+ state.buffer[state.start++] = 0
1549
+ state.buffer[state.start++] = collectionVersion
1550
+ collection22_enc.encode(state, record)
1551
+ return state.buffer
1552
+ },
1553
+ trigger: null,
1554
+ reconstruct: collection22_reconstruct,
1555
+ reconstructKey: collection22_reconstruct_key,
1556
+ indexes: [],
1557
+ decodedVersion: 0
1558
+ }
1559
+
1481
1560
  const collections = [
1482
1561
  collection0,
1483
1562
  collection1,
@@ -1496,7 +1575,8 @@ const collections = [
1496
1575
  collection14,
1497
1576
  collection15,
1498
1577
  collection16,
1499
- collection18
1578
+ collection18,
1579
+ collection22
1500
1580
  ]
1501
1581
 
1502
1582
  const indexes = [
@@ -1528,6 +1608,7 @@ function resolveCollection (name) {
1528
1608
  case '@local/account-recovery': return collection15
1529
1609
  case '@local/chat-order': return collection16
1530
1610
  case '@local/files': return collection18
1611
+ case '@local/chat-moves': return collection22
1531
1612
  default: return null
1532
1613
  }
1533
1614
  }