@qvac/core 1.0.0-rc.12 → 1.0.0-rc.13

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 (63) hide show
  1. package/CHANGELOG.md +19 -1
  2. package/dist-lib/lib/assistant.js +2 -1
  3. package/dist-lib/lib/core/archived-mesh.js +7 -3
  4. package/dist-lib/lib/core/chat-copy.d.ts +18 -3
  5. package/dist-lib/lib/core/chat-copy.js +73 -23
  6. package/dist-lib/lib/core/chat-group.js +14 -9
  7. package/dist-lib/lib/core/chat-move.d.ts +9 -0
  8. package/dist-lib/lib/core/chat-move.js +94 -3
  9. package/dist-lib/lib/core/chat.js +21 -8
  10. package/dist-lib/lib/core/collections.d.ts +1 -0
  11. package/dist-lib/lib/core/collections.js +1 -0
  12. package/dist-lib/lib/core/contract/activity.js +2 -2
  13. package/dist-lib/lib/core/contract/chat-group.d.ts +1 -0
  14. package/dist-lib/lib/core/contract/chat-group.js +21 -1
  15. package/dist-lib/lib/core/contract/chat.d.ts +9 -0
  16. package/dist-lib/lib/core/contract/chat.js +127 -5
  17. package/dist-lib/lib/core/contract/chunks.d.ts +1 -0
  18. package/dist-lib/lib/core/contract/chunks.js +37 -6
  19. package/dist-lib/lib/core/contract/features.d.ts +21 -0
  20. package/dist-lib/lib/core/contract/features.js +22 -0
  21. package/dist-lib/lib/core/contract/indexing.js +4 -2
  22. package/dist-lib/lib/core/contract/knowledge.js +5 -4
  23. package/dist-lib/lib/core/contract/members.js +2 -2
  24. package/dist-lib/lib/core/contract/projects.d.ts +5 -0
  25. package/dist-lib/lib/core/contract/projects.js +12 -4
  26. package/dist-lib/lib/core/contract/roles.js +30 -4
  27. package/dist-lib/lib/core/contract/run-requests.js +2 -2
  28. package/dist-lib/lib/core/contract/seed-defaults.js +2 -2
  29. package/dist-lib/lib/core/contract/tool-configs.js +3 -2
  30. package/dist-lib/lib/core/contract/workspace.d.ts +2 -0
  31. package/dist-lib/lib/core/contract/workspace.js +40 -7
  32. package/dist-lib/lib/core/contract/writers.js +2 -2
  33. package/dist-lib/lib/core/files/attachments.js +4 -1
  34. package/dist-lib/lib/core/local/index.d.ts +6 -2
  35. package/dist-lib/lib/core/local/index.js +12 -3
  36. package/dist-lib/lib/core/mesh.d.ts +5 -0
  37. package/dist-lib/lib/core/mesh.js +3 -0
  38. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.d.ts +85 -0
  39. package/dist-lib/lib/core/migrations/workspace-from-0-21/index.js +690 -0
  40. package/dist-lib/lib/core/project-keys.d.ts +6 -0
  41. package/dist-lib/lib/core/project-keys.js +11 -0
  42. package/dist-lib/lib/core/public-mesh.d.ts +2 -0
  43. package/dist-lib/lib/core/public-mesh.js +5 -0
  44. package/dist-lib/lib/core/sync/changed.d.ts +4 -2
  45. package/dist-lib/lib/core/sync/changed.js +1 -1
  46. package/dist-lib/lib/core/sync/index.js +27 -2
  47. package/dist-lib/lib/core/workspace-upgrade.d.ts +6 -0
  48. package/dist-lib/lib/core/workspace-upgrade.js +26 -16
  49. package/dist-lib/lib/core.d.ts +4 -32
  50. package/dist-lib/lib/core.js +117 -469
  51. package/dist-lib/lib/run-transcript.d.ts +2 -1
  52. package/dist-lib/lib/run-transcript.js +11 -5
  53. package/dist-lib/schema/qvac.js +26 -1
  54. package/dist-lib/spec/mesh/hyperdb/db.json +15 -0
  55. package/dist-lib/spec/mesh/hyperdb/index.js +70 -1
  56. package/dist-lib/spec/mesh/hyperdb/messages.js +806 -438
  57. package/dist-lib/spec/mesh/hyperdispatch/dispatch.json +18 -0
  58. package/dist-lib/spec/mesh/hyperdispatch/index.js +52 -1
  59. package/dist-lib/spec/mesh/hyperdispatch/messages.js +303 -3
  60. package/dist-lib/spec/mesh/hyperschema/index.js +303 -3
  61. package/dist-lib/spec/mesh/hyperschema/schema.json +146 -0
  62. package/dist-lib/spec/mesh/hyperschema/types.d.ts +39 -0
  63. package/package.json +6 -4
@@ -23,7 +23,8 @@ export declare class RunTranscript {
23
23
  private readonly _parentId;
24
24
  private readonly _log;
25
25
  private readonly _writes;
26
- private readonly _ticker;
26
+ private _ticker;
27
+ private _closed;
27
28
  private readonly _announced;
28
29
  private _buffered;
29
30
  constructor(engine: ScopedCapabilities, opts: RunTranscriptOptions);
@@ -14,7 +14,8 @@ export class RunTranscript {
14
14
  _parentId;
15
15
  _log;
16
16
  _writes;
17
- _ticker;
17
+ _ticker = null;
18
+ _closed = false;
18
19
  _announced = new Set();
19
20
  _buffered = null;
20
21
  constructor(engine, opts) {
@@ -31,9 +32,6 @@ export class RunTranscript {
31
32
  slowMs: SLOW_WRITE_MS,
32
33
  onSlow: (info) => this._log?.warn('runs', 'write still pending', { runId, ...info })
33
34
  });
34
- this._ticker = setInterval(() => {
35
- this.flush().catch((err) => this._log?.error('assistant', 'content flush failed', err));
36
- }, FLUSH_INTERVAL_MS);
37
35
  }
38
36
  async text(type, text, round) {
39
37
  if (this._buffered && (this._buffered.type !== type || this._buffered.round !== round)) {
@@ -43,6 +41,11 @@ export class RunTranscript {
43
41
  this._buffered = { type, text: '', round };
44
42
  this._announce(type);
45
43
  }
44
+ if (!this._ticker && !this._closed) {
45
+ this._ticker = setInterval(() => {
46
+ this.flush().catch((err) => this._log?.error('assistant', 'content flush failed', err));
47
+ }, FLUSH_INTERVAL_MS);
48
+ }
46
49
  this._buffered.text += text;
47
50
  if (this._buffered.text.length >= COALESCE_CAP) {
48
51
  await this.flush();
@@ -117,7 +120,10 @@ export class RunTranscript {
117
120
  return this._writes.pending();
118
121
  }
119
122
  close() {
120
- clearInterval(this._ticker);
123
+ this._closed = true;
124
+ if (this._ticker) {
125
+ clearInterval(this._ticker);
126
+ }
121
127
  }
122
128
  _announce(type) {
123
129
  if (this._announced.has(type))
@@ -675,7 +675,8 @@ export function registerQvacTypes(ns) {
675
675
  { name: 'id', type: 'string', required: true },
676
676
  { name: 'icon', type: 'string' },
677
677
  { name: 'updatedAt', type: 'uint', required: true },
678
- { name: 'upgradeMemberIds', type: 'fixed32', array: true }
678
+ { name: 'upgradeMemberIds', type: 'fixed32', array: true },
679
+ { name: 'upgradeWriterKeys', type: 'fixed32', array: true }
679
680
  ]);
680
681
  versioned('put-workspace-operation', [
681
682
  { name: 'workspace', type: '@qvac/workspace', required: true }
@@ -830,6 +831,22 @@ export function registerQvacTypes(ns) {
830
831
  { name: 'memberId', type: 'fixed32', required: true },
831
832
  { name: 'sealedSeed', type: 'buffer', required: true }
832
833
  ]);
834
+ versioned('patch-chat-operation', [
835
+ { name: 'chat', type: '@qvac/chat', required: true },
836
+ { name: 'fields', type: 'string', array: true }
837
+ ]);
838
+ versioned('patch-chat-group-operation', [
839
+ { name: 'group', type: '@qvac/chat-group', required: true },
840
+ { name: 'fields', type: 'string', array: true }
841
+ ]);
842
+ versioned('moved-out-chat', [{ name: 'chatId', type: 'string', required: true }]);
843
+ versioned('remove-chat-copy-operation', [
844
+ { name: 'chatId', type: 'string', required: true },
845
+ { name: 'updatedAt', type: 'uint', required: true },
846
+ { name: 'chunkIds', type: 'string', array: true },
847
+ { name: 'knowledgeIds', type: 'string', array: true },
848
+ { name: 'toolActivityIds', type: 'string', array: true }
849
+ ]);
833
850
  }
834
851
  export function registerQvacCollections(dbns, helpersPath) {
835
852
  dbns.require(helpersPath);
@@ -1384,6 +1401,11 @@ export function registerQvacCollections(dbns, helpersPath) {
1384
1401
  map: 'linkedWritersByMostRecentMap'
1385
1402
  }
1386
1403
  });
1404
+ dbns.collections.register({
1405
+ name: 'moved-out-chats',
1406
+ schema: '@qvac/moved-out-chat',
1407
+ key: ['chatId']
1408
+ });
1387
1409
  }
1388
1410
  export function registerQvacDispatch(ds) {
1389
1411
  ds.register({ name: 'append-chunk', requestType: '@qvac/append-chunk-operation' });
@@ -1492,4 +1514,7 @@ export function registerQvacDispatch(ds) {
1492
1514
  ds.register({ name: 'put-skill-secret', requestType: '@qvac/skill-secret' });
1493
1515
  ds.register({ name: 'continue-run-here', requestType: '@qvac/take-run-request-operation' });
1494
1516
  ds.register({ name: 'reindex-writers', requestType: '@qvac/reindex-writers-operation' });
1517
+ ds.register({ name: 'patch-chat', requestType: '@qvac/patch-chat-operation' });
1518
+ ds.register({ name: 'patch-chat-group', requestType: '@qvac/patch-chat-group-operation' });
1519
+ ds.register({ name: 'remove-chat-copy', requestType: '@qvac/remove-chat-copy-operation' });
1495
1520
  }
@@ -1609,6 +1609,21 @@
1609
1609
  },
1610
1610
  "map": "linkedWritersByMostRecentMap"
1611
1611
  }
1612
+ },
1613
+ {
1614
+ "name": "moved-out-chats",
1615
+ "namespace": "qvac",
1616
+ "id": 91,
1617
+ "type": 1,
1618
+ "version": 12,
1619
+ "versionField": null,
1620
+ "indexes": [],
1621
+ "schema": "@qvac/moved-out-chat",
1622
+ "derived": false,
1623
+ "key": [
1624
+ "chatId"
1625
+ ],
1626
+ "trigger": null
1612
1627
  }
1613
1628
  ]
1614
1629
  }
@@ -5616,6 +5616,73 @@ const index90 = {
5616
5616
  }
5617
5617
  collection29.indexes.push(index90)
5618
5618
 
5619
+ // '@qvac/moved-out-chats' collection key
5620
+ const collection91_key = new IndexEncoder([
5621
+ IndexEncoder.STRING
5622
+ ], { prefix: 91 })
5623
+
5624
+ function collection91_indexify (record) {
5625
+ const a = record.chatId
5626
+ return a === undefined ? [] : [a]
5627
+ }
5628
+
5629
+ // '@qvac/moved-out-chats' value encoding
5630
+ const collection91_enc = getEncoding('@qvac/moved-out-chat/hyperdb#91')
5631
+
5632
+ // '@qvac/moved-out-chats' reconstruction function
5633
+ function collection91_reconstruct (schemaVersion, keyBuf, valueBuf) {
5634
+ const key = collection91_key.decode(keyBuf)
5635
+ setVersion(schemaVersion)
5636
+ const state = { start: 0, end: valueBuf.byteLength, buffer: valueBuf }
5637
+ const type = c.uint.decode(state)
5638
+ if (type !== 0) throw new Error('Unknown collection type: ' + type)
5639
+ collection91.decodedVersion = c.uint.decode(state)
5640
+ const record = collection91_enc.decode(state)
5641
+ record.chatId = key[0]
5642
+ return record
5643
+ }
5644
+ // '@qvac/moved-out-chats' key reconstruction function
5645
+ function collection91_reconstruct_key (keyBuf) {
5646
+ const key = collection91_key.decode(keyBuf)
5647
+ return {
5648
+ chatId: key[0]
5649
+ }
5650
+ }
5651
+
5652
+ // '@qvac/moved-out-chats'
5653
+ const collection91 = {
5654
+ name: '@qvac/moved-out-chats',
5655
+ id: 91,
5656
+ version: 12,
5657
+ encodeKey (record) {
5658
+ const key = [record.chatId]
5659
+ return collection91_key.encode(key)
5660
+ },
5661
+ encodeKeyRange ({ gt, lt, gte, lte } = {}) {
5662
+ return collection91_key.encodeRange({
5663
+ gt: gt ? collection91_indexify(gt) : null,
5664
+ lt: lt ? collection91_indexify(lt) : null,
5665
+ gte: gte ? collection91_indexify(gte) : null,
5666
+ lte: lte ? collection91_indexify(lte) : null
5667
+ })
5668
+ },
5669
+ encodeValue (schemaVersion, collectionVersion, record) {
5670
+ setVersion(schemaVersion)
5671
+ const state = { start: 0, end: 2, buffer: null }
5672
+ collection91_enc.preencode(state, record)
5673
+ state.buffer = b4a.allocUnsafe(state.end)
5674
+ state.buffer[state.start++] = 0
5675
+ state.buffer[state.start++] = collectionVersion
5676
+ collection91_enc.encode(state, record)
5677
+ return state.buffer
5678
+ },
5679
+ trigger: null,
5680
+ reconstruct: collection91_reconstruct,
5681
+ reconstructKey: collection91_reconstruct_key,
5682
+ indexes: [],
5683
+ decodedVersion: 0
5684
+ }
5685
+
5619
5686
  const collections = [
5620
5687
  collection0,
5621
5688
  collection1,
@@ -5665,7 +5732,8 @@ const collections = [
5665
5732
  collection71,
5666
5733
  collection83,
5667
5734
  collection85,
5668
- collection87
5735
+ collection87,
5736
+ collection91
5669
5737
  ]
5670
5738
 
5671
5739
  const indexes = [
@@ -5766,6 +5834,7 @@ function resolveCollection (name) {
5766
5834
  case '@qvac/project-host-seals': return collection83
5767
5835
  case '@qvac/project-member-seals': return collection85
5768
5836
  case '@qvac/project-device-seals': return collection87
5837
+ case '@qvac/moved-out-chats': return collection91
5769
5838
  default: return null
5770
5839
  }
5771
5840
  }