@qvac/core 0.1.4 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/.claude/skills/asana/SKILL.md +86 -0
  2. package/.claude/skills/compaction/SKILL.md +127 -0
  3. package/.claude/skills/device-mesh-debug/SKILL.md +328 -0
  4. package/.claude/skills/gh-stack/SKILL.md +181 -0
  5. package/.claude/skills/gh-stack/references/commands.md +177 -0
  6. package/.claude/skills/gh-stack/references/stack-design.md +97 -0
  7. package/.claude/skills/gh-stack/references/troubleshooting.md +159 -0
  8. package/.claude/skills/js-house-style/SKILL.md +670 -0
  9. package/.claude/skills/pr-create/SKILL.md +180 -0
  10. package/.claude/skills/pr-review/SKILL.md +216 -0
  11. package/CLAUDE.md +45 -0
  12. package/README.md +10 -5
  13. package/dist-lib/lib/api/agents.js +3 -3
  14. package/dist-lib/lib/api/chat-groups.d.ts +1 -1
  15. package/dist-lib/lib/api/chat-groups.js +5 -3
  16. package/dist-lib/lib/api/chat.js +2 -2
  17. package/dist-lib/lib/api/current-mesh.d.ts +3 -2
  18. package/dist-lib/lib/api/current-mesh.js +4 -3
  19. package/dist-lib/lib/api/devices.js +1 -0
  20. package/dist-lib/lib/api/index.js +2 -0
  21. package/dist-lib/lib/api/members.d.ts +3 -0
  22. package/dist-lib/lib/api/members.js +23 -0
  23. package/dist-lib/lib/api/mesh.d.ts +14 -3
  24. package/dist-lib/lib/api/mesh.js +20 -3
  25. package/dist-lib/lib/api/watchable.d.ts +1 -1
  26. package/dist-lib/lib/api/watchable.js +1 -1
  27. package/dist-lib/lib/assistant.js +2 -1
  28. package/dist-lib/lib/core/agent.d.ts +1 -0
  29. package/dist-lib/lib/core/agent.js +29 -1
  30. package/dist-lib/lib/core/chat-group.d.ts +4 -0
  31. package/dist-lib/lib/core/chat-group.js +43 -1
  32. package/dist-lib/lib/core/chat.d.ts +10 -0
  33. package/dist-lib/lib/core/chat.js +75 -9
  34. package/dist-lib/lib/core/contract/index.js +2 -0
  35. package/dist-lib/lib/core/contract/joined-meshes.d.ts +2 -0
  36. package/dist-lib/lib/core/contract/joined-meshes.js +41 -0
  37. package/dist-lib/lib/core/contract/members.js +68 -2
  38. package/dist-lib/lib/core/contract/writers.js +19 -3
  39. package/dist-lib/lib/core/departures.d.ts +3 -1
  40. package/dist-lib/lib/core/departures.js +6 -4
  41. package/dist-lib/lib/core/device-attestation.d.ts +8 -0
  42. package/dist-lib/lib/core/device-attestation.js +25 -0
  43. package/dist-lib/lib/core/device-invites.d.ts +9 -0
  44. package/dist-lib/lib/core/device-invites.js +40 -0
  45. package/dist-lib/lib/core/files/index.d.ts +2 -1
  46. package/dist-lib/lib/core/files/index.js +1 -1
  47. package/dist-lib/lib/core/files/store/index.d.ts +1 -0
  48. package/dist-lib/lib/core/files/store/server.d.ts +5 -4
  49. package/dist-lib/lib/core/files/store/server.js +10 -6
  50. package/dist-lib/lib/core/helpers/index.d.ts +1 -1
  51. package/dist-lib/lib/core/hosted-agents.d.ts +3 -1
  52. package/dist-lib/lib/core/hosted-agents.js +9 -3
  53. package/dist-lib/lib/core/identity.d.ts +10 -0
  54. package/dist-lib/lib/core/identity.js +45 -0
  55. package/dist-lib/lib/core/invite.d.ts +3 -0
  56. package/dist-lib/lib/core/invite.js +8 -2
  57. package/dist-lib/lib/core/local/index.d.ts +22 -7
  58. package/dist-lib/lib/core/local/index.js +202 -66
  59. package/dist-lib/lib/core/membership.d.ts +8 -2
  60. package/dist-lib/lib/core/membership.js +33 -9
  61. package/dist-lib/lib/core/mesh-seed-handoff.d.ts +17 -0
  62. package/dist-lib/lib/core/mesh-seed-handoff.js +34 -0
  63. package/dist-lib/lib/core/mesh.d.ts +13 -1
  64. package/dist-lib/lib/core/mesh.js +61 -8
  65. package/dist-lib/lib/core/migrations/index.d.ts +3 -1
  66. package/dist-lib/lib/core/migrations/index.js +2 -2
  67. package/dist-lib/lib/core/migrations/membership.js +27 -15
  68. package/dist-lib/lib/core/rank.d.ts +14 -0
  69. package/dist-lib/lib/core/rank.js +23 -0
  70. package/dist-lib/lib/core/sync/index.js +6 -0
  71. package/dist-lib/lib/core.d.ts +91 -13
  72. package/dist-lib/lib/core.js +1051 -207
  73. package/dist-lib/schema/build.js +3 -2
  74. package/dist-lib/schema/engine.js +153 -9
  75. package/dist-lib/schema/field-order.js +4 -1
  76. package/dist-lib/schema/local.js +32 -0
  77. package/dist-lib/schema/qvac.js +45 -6
  78. package/dist-lib/spec/bind.js +35 -0
  79. package/dist-lib/spec/calls.js +37 -27
  80. package/dist-lib/spec/capabilities.d.ts +30 -10
  81. package/dist-lib/spec/hrpc/hrpc.json +135 -5
  82. package/dist-lib/spec/hrpc/index.js +130 -9
  83. package/dist-lib/spec/hrpc/messages.js +408 -14
  84. package/dist-lib/spec/hyperschema/index.js +408 -14
  85. package/dist-lib/spec/hyperschema/schema.json +309 -1
  86. package/dist-lib/spec/hyperschema/types.d.ts +90 -1
  87. package/dist-lib/spec/local/hyperdb/db.json +46 -1
  88. package/dist-lib/spec/local/hyperdb/index.js +209 -2
  89. package/dist-lib/spec/local/hyperdb/messages.js +557 -90
  90. package/dist-lib/spec/local/hyperschema/index.js +240 -2
  91. package/dist-lib/spec/local/hyperschema/schema.json +120 -1
  92. package/dist-lib/spec/local/hyperschema/types.d.ts +33 -1
  93. package/dist-lib/spec/mesh/hyperdb/db.json +16 -1
  94. package/dist-lib/spec/mesh/hyperdb/index.js +71 -2
  95. package/dist-lib/spec/mesh/hyperdb/messages.js +571 -192
  96. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +13 -1
  97. package/dist-lib/spec/mesh/hyperdispatch/index.js +35 -1
  98. package/dist-lib/spec/mesh/hyperdispatch/messages.js +283 -20
  99. package/dist-lib/spec/mesh/hyperschema/index.js +283 -20
  100. package/dist-lib/spec/mesh/hyperschema/schema.json +179 -1
  101. package/dist-lib/spec/mesh/hyperschema/types.d.ts +45 -1
  102. package/package.json +6 -6
  103. package/tui/app.mjs +416 -50
  104. package/tui/boot.mjs +1 -1
  105. package/tui/lib/sidebar.mjs +3 -2
@@ -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: 4 }
7
+ const versions = { schema: version, db: 5 }
8
8
 
9
9
  // '@local/config' collection key
10
10
  const collection0_key = new IndexEncoder([
@@ -810,6 +810,207 @@ const collection11 = {
810
810
  decodedVersion: 0
811
811
  }
812
812
 
813
+ // '@local/active-mesh' collection key
814
+ const collection12_key = new IndexEncoder([
815
+ IndexEncoder.BUFFER
816
+ ], { prefix: 12 })
817
+
818
+ function collection12_indexify (record) {
819
+ const a = record.deviceId
820
+ return a === undefined ? [] : [a]
821
+ }
822
+
823
+ // '@local/active-mesh' value encoding
824
+ const collection12_enc = getEncoding('@local/active-mesh/hyperdb#12')
825
+
826
+ // '@local/active-mesh' reconstruction function
827
+ function collection12_reconstruct (schemaVersion, keyBuf, valueBuf) {
828
+ const key = collection12_key.decode(keyBuf)
829
+ setVersion(schemaVersion)
830
+ const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
831
+ const type = c.uint.decode(state)
832
+ if (type !== 0) throw new Error('Unknown collection type: ' + type)
833
+ collection12.decodedVersion = c.uint.decode(state)
834
+ const record = collection12_enc.decode(state)
835
+ record.deviceId = key[0]
836
+ return record
837
+ }
838
+ // '@local/active-mesh' key reconstruction function
839
+ function collection12_reconstruct_key (keyBuf) {
840
+ const key = collection12_key.decode(keyBuf)
841
+ return {
842
+ deviceId: key[0]
843
+ }
844
+ }
845
+
846
+ // '@local/active-mesh'
847
+ const collection12 = {
848
+ name: '@local/active-mesh',
849
+ id: 12,
850
+ version: 5,
851
+ encodeKey (record) {
852
+ const key = [record.deviceId]
853
+ return collection12_key.encode(key)
854
+ },
855
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
856
+ return collection12_key.encodeRange({
857
+ gt: gt ? collection12_indexify(gt) : null,
858
+ lt: lt ? collection12_indexify(lt) : null,
859
+ gte: gte ? collection12_indexify(gte) : null,
860
+ lte: lte ? collection12_indexify(lte) : null
861
+ })
862
+ },
863
+ encodeValue (schemaVersion, collectionVersion, record) {
864
+ setVersion(schemaVersion)
865
+ const state = { start: 0, end: 2, buffer: null }
866
+ collection12_enc.preencode(state, record)
867
+ state.buffer = b4a.allocUnsafe(state.end)
868
+ state.buffer[state.start++] = 0
869
+ state.buffer[state.start++] = collectionVersion
870
+ collection12_enc.encode(state, record)
871
+ return state.buffer
872
+ },
873
+ trigger: null,
874
+ reconstruct: collection12_reconstruct,
875
+ reconstructKey: collection12_reconstruct_key,
876
+ indexes: [],
877
+ decodedVersion: 0
878
+ }
879
+
880
+ // '@local/mesh-membership' collection key
881
+ const collection13_key = new IndexEncoder([
882
+ IndexEncoder.BUFFER
883
+ ], { prefix: 13 })
884
+
885
+ function collection13_indexify (record) {
886
+ const a = record.key
887
+ return a === undefined ? [] : [a]
888
+ }
889
+
890
+ // '@local/mesh-membership' value encoding
891
+ const collection13_enc = getEncoding('@local/mesh-membership/hyperdb#13')
892
+
893
+ // '@local/mesh-membership' reconstruction function
894
+ function collection13_reconstruct (schemaVersion, keyBuf, valueBuf) {
895
+ const key = collection13_key.decode(keyBuf)
896
+ setVersion(schemaVersion)
897
+ const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
898
+ const type = c.uint.decode(state)
899
+ if (type !== 0) throw new Error('Unknown collection type: ' + type)
900
+ collection13.decodedVersion = c.uint.decode(state)
901
+ const record = collection13_enc.decode(state)
902
+ record.key = key[0]
903
+ return record
904
+ }
905
+ // '@local/mesh-membership' key reconstruction function
906
+ function collection13_reconstruct_key (keyBuf) {
907
+ const key = collection13_key.decode(keyBuf)
908
+ return {
909
+ key: key[0]
910
+ }
911
+ }
912
+
913
+ // '@local/mesh-membership'
914
+ const collection13 = {
915
+ name: '@local/mesh-membership',
916
+ id: 13,
917
+ version: 5,
918
+ encodeKey (record) {
919
+ const key = [record.key]
920
+ return collection13_key.encode(key)
921
+ },
922
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
923
+ return collection13_key.encodeRange({
924
+ gt: gt ? collection13_indexify(gt) : null,
925
+ lt: lt ? collection13_indexify(lt) : null,
926
+ gte: gte ? collection13_indexify(gte) : null,
927
+ lte: lte ? collection13_indexify(lte) : null
928
+ })
929
+ },
930
+ encodeValue (schemaVersion, collectionVersion, record) {
931
+ setVersion(schemaVersion)
932
+ const state = { start: 0, end: 2, buffer: null }
933
+ collection13_enc.preencode(state, record)
934
+ state.buffer = b4a.allocUnsafe(state.end)
935
+ state.buffer[state.start++] = 0
936
+ state.buffer[state.start++] = collectionVersion
937
+ collection13_enc.encode(state, record)
938
+ return state.buffer
939
+ },
940
+ trigger: null,
941
+ reconstruct: collection13_reconstruct,
942
+ reconstructKey: collection13_reconstruct_key,
943
+ indexes: [],
944
+ decodedVersion: 0
945
+ }
946
+
947
+ // '@local/member-proof' collection key
948
+ const collection14_key = new IndexEncoder([
949
+ IndexEncoder.BUFFER
950
+ ], { prefix: 14 })
951
+
952
+ function collection14_indexify (record) {
953
+ const a = record.meshKey
954
+ return a === undefined ? [] : [a]
955
+ }
956
+
957
+ // '@local/member-proof' value encoding
958
+ const collection14_enc = getEncoding('@local/member-proof/hyperdb#14')
959
+
960
+ // '@local/member-proof' reconstruction function
961
+ function collection14_reconstruct (schemaVersion, keyBuf, valueBuf) {
962
+ const key = collection14_key.decode(keyBuf)
963
+ setVersion(schemaVersion)
964
+ const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
965
+ const type = c.uint.decode(state)
966
+ if (type !== 0) throw new Error('Unknown collection type: ' + type)
967
+ collection14.decodedVersion = c.uint.decode(state)
968
+ const record = collection14_enc.decode(state)
969
+ record.meshKey = key[0]
970
+ return record
971
+ }
972
+ // '@local/member-proof' key reconstruction function
973
+ function collection14_reconstruct_key (keyBuf) {
974
+ const key = collection14_key.decode(keyBuf)
975
+ return {
976
+ meshKey: key[0]
977
+ }
978
+ }
979
+
980
+ // '@local/member-proof'
981
+ const collection14 = {
982
+ name: '@local/member-proof',
983
+ id: 14,
984
+ version: 5,
985
+ encodeKey (record) {
986
+ const key = [record.meshKey]
987
+ return collection14_key.encode(key)
988
+ },
989
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
990
+ return collection14_key.encodeRange({
991
+ gt: gt ? collection14_indexify(gt) : null,
992
+ lt: lt ? collection14_indexify(lt) : null,
993
+ gte: gte ? collection14_indexify(gte) : null,
994
+ lte: lte ? collection14_indexify(lte) : null
995
+ })
996
+ },
997
+ encodeValue (schemaVersion, collectionVersion, record) {
998
+ setVersion(schemaVersion)
999
+ const state = { start: 0, end: 2, buffer: null }
1000
+ collection14_enc.preencode(state, record)
1001
+ state.buffer = b4a.allocUnsafe(state.end)
1002
+ state.buffer[state.start++] = 0
1003
+ state.buffer[state.start++] = collectionVersion
1004
+ collection14_enc.encode(state, record)
1005
+ return state.buffer
1006
+ },
1007
+ trigger: null,
1008
+ reconstruct: collection14_reconstruct,
1009
+ reconstructKey: collection14_reconstruct_key,
1010
+ indexes: [],
1011
+ decodedVersion: 0
1012
+ }
1013
+
813
1014
  const collections = [
814
1015
  collection0,
815
1016
  collection1,
@@ -822,7 +1023,10 @@ const collections = [
822
1023
  collection8,
823
1024
  collection9,
824
1025
  collection10,
825
- collection11
1026
+ collection11,
1027
+ collection12,
1028
+ collection13,
1029
+ collection14
826
1030
  ]
827
1031
 
828
1032
  const indexes = [
@@ -844,6 +1048,9 @@ function resolveCollection (name) {
844
1048
  case '@local/chat-notify': return collection9
845
1049
  case '@local/model-notify': return collection10
846
1050
  case '@local/mesh-departure': return collection11
1051
+ case '@local/active-mesh': return collection12
1052
+ case '@local/mesh-membership': return collection13
1053
+ case '@local/member-proof': return collection14
847
1054
  default: return null
848
1055
  }
849
1056
  }