@qvac/core 0.6.4 → 0.6.6

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 (87) hide show
  1. package/CHANGELOG.md +78 -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/engine.js +80 -1
  58. package/dist-lib/schema/local.js +17 -0
  59. package/dist-lib/schema/qvac.d.ts +2 -0
  60. package/dist-lib/schema/qvac.js +16 -0
  61. package/dist-lib/spec/bind.js +25 -0
  62. package/dist-lib/spec/calls.js +5 -0
  63. package/dist-lib/spec/capabilities.d.ts +10 -0
  64. package/dist-lib/spec/hrpc/hrpc.json +65 -0
  65. package/dist-lib/spec/hrpc/index.js +66 -4
  66. package/dist-lib/spec/hrpc/messages.js +1398 -1154
  67. package/dist-lib/spec/hyperschema/index.js +1398 -1154
  68. package/dist-lib/spec/hyperschema/schema.json +204 -0
  69. package/dist-lib/spec/hyperschema/types.d.ts +47 -0
  70. package/dist-lib/spec/local/hyperdb/db.json +17 -1
  71. package/dist-lib/spec/local/hyperdb/index.js +83 -2
  72. package/dist-lib/spec/local/hyperdb/messages.js +340 -136
  73. package/dist-lib/spec/local/hyperschema/index.js +107 -2
  74. package/dist-lib/spec/local/hyperschema/schema.json +78 -1
  75. package/dist-lib/spec/local/hyperschema/types.d.ts +18 -1
  76. package/dist-lib/spec/mesh/hyperdb/db.json +16 -1
  77. package/dist-lib/spec/mesh/hyperdb/index.js +71 -2
  78. package/dist-lib/spec/mesh/hyperdb/messages.js +454 -228
  79. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +7 -1
  80. package/dist-lib/spec/mesh/hyperdispatch/index.js +18 -1
  81. package/dist-lib/spec/mesh/hyperdispatch/messages.js +150 -2
  82. package/dist-lib/spec/mesh/hyperschema/index.js +150 -2
  83. package/dist-lib/spec/mesh/hyperschema/schema.json +76 -1
  84. package/dist-lib/spec/mesh/hyperschema/types.d.ts +21 -1
  85. package/package.json +5 -3
  86. package/tui/app.mjs +89 -3
  87. package/tui/lib/move-command.mjs +17 -0
@@ -1,12 +1,12 @@
1
1
  // This file is autogenerated by the hyperschema compiler
2
- // Schema Version: 8
2
+ // Schema Version: 9
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 = 8
9
+ const VERSION = 9
10
10
 
11
11
  // eslint-disable-next-line no-unused-vars
12
12
  let version = VERSION
@@ -1606,6 +1606,107 @@ const encoding38 = {
1606
1606
  }
1607
1607
  }
1608
1608
 
1609
+ // @local/chat-move-v1
1610
+ const encoding39 = {
1611
+ preencode(state, m) {
1612
+ c.fixed32.preencode(state, m.meshKey)
1613
+ c.string.preencode(state, m.chatId)
1614
+ c.fixed32.preencode(state, m.targetMeshKey)
1615
+ c.string.preencode(state, m.targetChatId)
1616
+ c.string.preencode(state, m.agentId)
1617
+ c.uint.preencode(state, m.carried)
1618
+ state.end++ // max flag is 4 so always one byte
1619
+
1620
+ if (version >= 9 && m.restartRunId) c.string.preencode(state, m.restartRunId)
1621
+ c.uint.preencode(state, m.startedAt)
1622
+ if (version >= 9 && m.completedAt) c.uint.preencode(state, m.completedAt)
1623
+ if (version >= 9 && m.failure) c.string.preencode(state, m.failure)
1624
+ },
1625
+ encode(state, m) {
1626
+ const flags =
1627
+ ((version >= 9 && m.restartRunId) ? 1 : 0) |
1628
+ ((version >= 9 && m.completedAt) ? 2 : 0) |
1629
+ ((version >= 9 && m.failure) ? 4 : 0)
1630
+
1631
+ c.fixed32.encode(state, m.meshKey)
1632
+ c.string.encode(state, m.chatId)
1633
+ c.fixed32.encode(state, m.targetMeshKey)
1634
+ c.string.encode(state, m.targetChatId)
1635
+ c.string.encode(state, m.agentId)
1636
+ c.uint.encode(state, m.carried)
1637
+ c.uint.encode(state, flags)
1638
+
1639
+ if (version >= 9 && m.restartRunId) c.string.encode(state, m.restartRunId)
1640
+ c.uint.encode(state, m.startedAt)
1641
+ if (version >= 9 && m.completedAt) c.uint.encode(state, m.completedAt)
1642
+ if (version >= 9 && m.failure) c.string.encode(state, m.failure)
1643
+ },
1644
+ decode(state) {
1645
+ const r0 = c.fixed32.decode(state)
1646
+ const r1 = c.string.decode(state)
1647
+ const r2 = c.fixed32.decode(state)
1648
+ const r3 = c.string.decode(state)
1649
+ const r4 = c.string.decode(state)
1650
+ const r5 = c.uint.decode(state)
1651
+ const flags = c.uint.decode(state)
1652
+
1653
+ return {
1654
+ version: 0,
1655
+ meshKey: r0,
1656
+ chatId: r1,
1657
+ targetMeshKey: r2,
1658
+ targetChatId: r3,
1659
+ agentId: r4,
1660
+ carried: r5,
1661
+ restartRunId: (version >= 9 && (flags & 1) !== 0) ? c.string.decode(state) : null,
1662
+ startedAt: c.uint.decode(state),
1663
+ completedAt: (version >= 9 && (flags & 2) !== 0) ? c.uint.decode(state) : 0,
1664
+ failure: (version >= 9 && (flags & 4) !== 0) ? c.string.decode(state) : null
1665
+ }
1666
+ }
1667
+ }
1668
+
1669
+ // @local/chat-move
1670
+ const encoding40 = {
1671
+ preencode(state, m) {
1672
+ const v = m.version ?? 1
1673
+ c.uint.preencode(state, v)
1674
+ switch (v) {
1675
+ case 0:
1676
+ case 1:
1677
+ encoding39.preencode(state, m)
1678
+ break
1679
+ default:
1680
+ throw new Error('Unsupported version')
1681
+ }
1682
+ },
1683
+ encode(state, m) {
1684
+ const v = m.version ?? 1
1685
+ c.uint.encode(state, v)
1686
+ switch (v) {
1687
+ case 0:
1688
+ case 1:
1689
+ encoding39.encode(state, m)
1690
+ break
1691
+ default:
1692
+ throw new Error('Unsupported version')
1693
+ }
1694
+ },
1695
+ decode(state) {
1696
+ const v = c.uint.decode(state)
1697
+ switch (v) {
1698
+ case 0:
1699
+ case 1: {
1700
+ const decoded = encoding39.decode(state)
1701
+ decoded.version = v
1702
+ return decoded
1703
+ }
1704
+ default:
1705
+ throw new Error('Unsupported version')
1706
+ }
1707
+ }
1708
+ }
1709
+
1609
1710
  function setVersion(v) {
1610
1711
  version = v
1611
1712
  }
@@ -1713,6 +1814,10 @@ function getEncoding(name) {
1713
1814
  return encoding37
1714
1815
  case '@local/file':
1715
1816
  return encoding38
1817
+ case '@local/chat-move-v1':
1818
+ return encoding39
1819
+ case '@local/chat-move':
1820
+ return encoding40
1716
1821
  default:
1717
1822
  throw new Error('Encoder not found ' + name)
1718
1823
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": 8,
2
+ "version": 9,
3
3
  "schema": [
4
4
  {
5
5
  "name": "qvac-state",
@@ -992,6 +992,83 @@
992
992
  "version": 1
993
993
  }
994
994
  ]
995
+ },
996
+ {
997
+ "name": "chat-move-v1",
998
+ "namespace": "local",
999
+ "compact": false,
1000
+ "flagsPosition": 6,
1001
+ "fields": [
1002
+ {
1003
+ "name": "meshKey",
1004
+ "required": true,
1005
+ "type": "fixed32",
1006
+ "version": 9
1007
+ },
1008
+ {
1009
+ "name": "chatId",
1010
+ "required": true,
1011
+ "type": "string",
1012
+ "version": 9
1013
+ },
1014
+ {
1015
+ "name": "targetMeshKey",
1016
+ "required": true,
1017
+ "type": "fixed32",
1018
+ "version": 9
1019
+ },
1020
+ {
1021
+ "name": "targetChatId",
1022
+ "required": true,
1023
+ "type": "string",
1024
+ "version": 9
1025
+ },
1026
+ {
1027
+ "name": "agentId",
1028
+ "required": true,
1029
+ "type": "string",
1030
+ "version": 9
1031
+ },
1032
+ {
1033
+ "name": "carried",
1034
+ "required": true,
1035
+ "type": "uint",
1036
+ "version": 9
1037
+ },
1038
+ {
1039
+ "name": "restartRunId",
1040
+ "type": "string",
1041
+ "version": 9
1042
+ },
1043
+ {
1044
+ "name": "startedAt",
1045
+ "required": true,
1046
+ "type": "uint",
1047
+ "version": 9
1048
+ },
1049
+ {
1050
+ "name": "completedAt",
1051
+ "type": "uint",
1052
+ "version": 9
1053
+ },
1054
+ {
1055
+ "name": "failure",
1056
+ "type": "string",
1057
+ "version": 9
1058
+ }
1059
+ ]
1060
+ },
1061
+ {
1062
+ "name": "chat-move",
1063
+ "namespace": "local",
1064
+ "framed": false,
1065
+ "versions": [
1066
+ {
1067
+ "type": "@local/chat-move-v1",
1068
+ "map": null,
1069
+ "version": 1
1070
+ }
1071
+ ]
995
1072
  }
996
1073
  ]
997
1074
  }
@@ -1,5 +1,5 @@
1
1
  // This file is autogenerated by hyperschema-ts
2
- // Schema version: 8
2
+ // Schema version: 9
3
3
  // Do not edit manually.
4
4
 
5
5
  export type LocalQvacState = 1 | 2 | 3 | 4
@@ -199,6 +199,21 @@ export interface LocalFileV1 {
199
199
 
200
200
  export type LocalFile = (LocalFileV1 & { version?: number })
201
201
 
202
+ export interface LocalChatMoveV1 {
203
+ meshKey: Buffer
204
+ chatId: string
205
+ targetMeshKey: Buffer
206
+ targetChatId: string
207
+ agentId: string
208
+ carried: number
209
+ restartRunId?: string | null
210
+ startedAt: number
211
+ completedAt?: number
212
+ failure?: string | null
213
+ }
214
+
215
+ export type LocalChatMove = (LocalChatMoveV1 & { version?: number })
216
+
202
217
  export interface SchemaTypes {
203
218
  "@local/qvac-state": LocalQvacState
204
219
  "@local/config-v1": LocalConfigV1
@@ -239,4 +254,6 @@ export interface SchemaTypes {
239
254
  "@local/chat-order": LocalChatOrder
240
255
  "@local/file-v1": LocalFileV1
241
256
  "@local/file": LocalFile
257
+ "@local/chat-move-v1": LocalChatMoveV1
258
+ "@local/chat-move": LocalChatMove
242
259
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": 8,
2
+ "version": 9,
3
3
  "offset": 0,
4
4
  "schema": [
5
5
  {
@@ -907,6 +907,21 @@
907
907
  "chatId"
908
908
  ],
909
909
  "trigger": null
910
+ },
911
+ {
912
+ "name": "mesh-names",
913
+ "namespace": "qvac",
914
+ "id": 49,
915
+ "type": 1,
916
+ "version": 9,
917
+ "versionField": null,
918
+ "indexes": [],
919
+ "schema": "@qvac/mesh-name",
920
+ "derived": false,
921
+ "key": [
922
+ "id"
923
+ ],
924
+ "trigger": null
910
925
  }
911
926
  ]
912
927
  }
@@ -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: 8 }
7
+ const versions = { schema: version, db: 9 }
8
8
 
9
9
  import * as helpers0 from '../../../schema/indexes.js'
10
10
 
@@ -2938,6 +2938,73 @@ const collection48 = {
2938
2938
  decodedVersion: 0
2939
2939
  }
2940
2940
 
2941
+ // '@qvac/mesh-names' collection key
2942
+ const collection49_key = new IndexEncoder([
2943
+ IndexEncoder.STRING
2944
+ ], { prefix: 49 })
2945
+
2946
+ function collection49_indexify (record) {
2947
+ const a = record.id
2948
+ return a === undefined ? [] : [a]
2949
+ }
2950
+
2951
+ // '@qvac/mesh-names' value encoding
2952
+ const collection49_enc = getEncoding('@qvac/mesh-name/hyperdb#49')
2953
+
2954
+ // '@qvac/mesh-names' reconstruction function
2955
+ function collection49_reconstruct (schemaVersion, keyBuf, valueBuf) {
2956
+ const key = collection49_key.decode(keyBuf)
2957
+ setVersion(schemaVersion)
2958
+ const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
2959
+ const type = c.uint.decode(state)
2960
+ if (type !== 0) throw new Error('Unknown collection type: ' + type)
2961
+ collection49.decodedVersion = c.uint.decode(state)
2962
+ const record = collection49_enc.decode(state)
2963
+ record.id = key[0]
2964
+ return record
2965
+ }
2966
+ // '@qvac/mesh-names' key reconstruction function
2967
+ function collection49_reconstruct_key (keyBuf) {
2968
+ const key = collection49_key.decode(keyBuf)
2969
+ return {
2970
+ id: key[0]
2971
+ }
2972
+ }
2973
+
2974
+ // '@qvac/mesh-names'
2975
+ const collection49 = {
2976
+ name: '@qvac/mesh-names',
2977
+ id: 49,
2978
+ version: 9,
2979
+ encodeKey (record) {
2980
+ const key = [record.id]
2981
+ return collection49_key.encode(key)
2982
+ },
2983
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
2984
+ return collection49_key.encodeRange({
2985
+ gt: gt ? collection49_indexify(gt) : null,
2986
+ lt: lt ? collection49_indexify(lt) : null,
2987
+ gte: gte ? collection49_indexify(gte) : null,
2988
+ lte: lte ? collection49_indexify(lte) : null
2989
+ })
2990
+ },
2991
+ encodeValue (schemaVersion, collectionVersion, record) {
2992
+ setVersion(schemaVersion)
2993
+ const state = { start: 0, end: 2, buffer: null }
2994
+ collection49_enc.preencode(state, record)
2995
+ state.buffer = b4a.allocUnsafe(state.end)
2996
+ state.buffer[state.start++] = 0
2997
+ state.buffer[state.start++] = collectionVersion
2998
+ collection49_enc.encode(state, record)
2999
+ return state.buffer
3000
+ },
3001
+ trigger: null,
3002
+ reconstruct: collection49_reconstruct,
3003
+ reconstructKey: collection49_reconstruct_key,
3004
+ indexes: [],
3005
+ decodedVersion: 0
3006
+ }
3007
+
2941
3008
  const collections = [
2942
3009
  collection0,
2943
3010
  collection1,
@@ -2964,7 +3031,8 @@ const collections = [
2964
3031
  collection45,
2965
3032
  collection46,
2966
3033
  collection47,
2967
- collection48
3034
+ collection48,
3035
+ collection49
2968
3036
  ]
2969
3037
 
2970
3038
  const indexes = [
@@ -3023,6 +3091,7 @@ function resolveCollection (name) {
3023
3091
  case '@qvac/member-removals': return collection46
3024
3092
  case '@qvac/mesh-founders': return collection47
3025
3093
  case '@qvac/purged-chats': return collection48
3094
+ case '@qvac/mesh-names': return collection49
3026
3095
  default: return null
3027
3096
  }
3028
3097
  }