@qvac/core 0.7.6 → 0.8.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.
package/CHANGELOG.md CHANGED
@@ -13,6 +13,67 @@ release.
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.8.0] - 2026-10-15
17
+
18
+ ### Added
19
+
20
+ - `skillCatalog` entries carry `displayName`, the user-facing name and `@`
21
+ handle a skill's manifest declares, so an app can show Documents and
22
+ Spreadsheets for the `word` and `excel` skills without renaming them. (#392)
23
+
24
+ ```js
25
+ const { skills } = await engine.skillCatalog({ agentId: agent.id })
26
+ const handle = skills.map((skill) => skill.displayName ?? skill.name)
27
+ ```
28
+
29
+ - `meshStatusWatch` frames carry `blindPeersConnected` and `blindPeersTotal`,
30
+ the device's blind peers holding a connection of those it dials; a blind
31
+ peer connecting or dropping makes a frame. (#403)
32
+ - Every mesh lifecycle line carries where the mesh stood: `opening` names the
33
+ head it boots from (`null` is a replay from genesis), `autobee opened`,
34
+ `landed on the view`, `joined` and `closing` carry the local, system and
35
+ view lengths, the flushes, autobee's counters and the time since the open;
36
+ Core logs `mesh opened` with why (`route`, `follow`, `readmit`) and how long,
37
+ `followed the joined meshes` with its tally, and names the mesh it announces.
38
+ `diagnostics` returns the same counters under `stats.mesh.stats`. The two
39
+ seed lines (`seeded default agent`, `seeded first chat`) are debug: a rebuilt
40
+ view re-applies the genesis seed, and they read as a second seeding. (#403)
41
+
42
+ ### Changed
43
+
44
+ - Joining a mesh reports joined as soon as the fast-forward lands, instead of
45
+ after a read of the whole view over the network. On a mesh with a long
46
+ history that read took tens of seconds, whatever the invite's head. The
47
+ member tally, mesh name, chat order and file index fill in moments after the
48
+ landing; a chat list in that window waits for the rebuild. (#400)
49
+ - The mesh logs `landed on the view` and `joined` with their timings, applies
50
+ and undos, and `device admitted` is a debug line: a catch-up re-applies every
51
+ claim on each re-linearisation. (#400)
52
+ - The meshes an account names open once the account's own join has settled,
53
+ instead of the moment the account lands, so they no longer compete with the
54
+ account's catch-up for the same peers. (#407)
55
+
56
+ ### Fixed
57
+
58
+ - A mesh the account names on a sibling's behalf, opened with no head of its
59
+ own, fast-forwards onto the first head a sibling device offers, instead of
60
+ replaying from genesis until that device's row happened to land. The head's
61
+ own view carries the device's signed claim to the writer, and the account
62
+ says whose device that is. (#408)
63
+ - One blind-peering client per device, shared by every mesh and core. Each mesh
64
+ (and the config, recovery, departure and drive cores) built its own client,
65
+ all dialling under the device's one key, and a blind peer keeps one connection
66
+ per key: every connect by one mesh dropped another's, endlessly. A mesh's
67
+ invite still names the blind peers it is mirrored on; what is shared is the
68
+ connection to each. (#405)
69
+ - A device no longer dials every device in its account mesh directly on each
70
+ membership change; peers are found on the mesh topic. (#405)
71
+ - A device coming back after a long absence fast-forwards onto the new head
72
+ without diffing the whole view across cores: it reads the landed snapshot,
73
+ and the attachments deleted while it was away refresh on the sweep. On a mesh
74
+ with ~20k rows that jump took 110–150 s; it now takes a few seconds. (#399,
75
+ #402)
76
+
16
77
  ## [0.7.6] - 2026-10-14
17
78
 
18
79
  ### Added
@@ -1608,7 +1669,8 @@ Published under the `release-0.1` dist-tag.
1608
1669
  await assistant.ready()
1609
1670
  ```
1610
1671
 
1611
- [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.7.6...HEAD
1672
+ [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.8.0...HEAD
1673
+ [0.8.0]: https://github.com/tetherto/qvac-core/compare/v0.7.6...v0.8.0
1612
1674
  [0.7.6]: https://github.com/tetherto/qvac-core/compare/v0.7.5...v0.7.6
1613
1675
  [0.7.5]: https://github.com/tetherto/qvac-core/compare/v0.7.4...v0.7.5
1614
1676
  [0.7.4]: https://github.com/tetherto/qvac-core/compare/v0.7.3...v0.7.4
@@ -2,6 +2,7 @@ import type { InstallStep, SkillRequires, SkillSetup } from '@qvac/harness';
2
2
  import type { AssistantSkill } from '../../spec/hyperschema/types.d.ts';
3
3
  export interface Skill {
4
4
  name: string;
5
+ displayName?: string;
5
6
  description: string;
6
7
  status: string;
7
8
  tools: string[];
@@ -4,6 +4,7 @@ export function toEngineSkill(skill) {
4
4
  const setup = normalizeSkillSetup(skill.setup);
5
5
  return {
6
6
  name: skill.name,
7
+ displayName: skill.displayName,
7
8
  description: skill.description,
8
9
  tools: [...skill.tools],
9
10
  credentials: [...skill.credentials],
@@ -1,7 +1,4 @@
1
1
  export declare const BLIND_PEERING_OFF_KEY = "debug.blindPeeringOff";
2
- export interface StartBlindPeeringOpts {
3
- readonly suspended?: boolean;
4
- }
5
2
  export interface BlindPeeringOpts {
6
3
  readonly batchIdleWait?: number;
7
4
  readonly batchMaxWait?: number;
@@ -7,6 +7,10 @@ type AppendChunkInput = Pick<QvacChunk, 'chatId' | 'runId' | 'type' | 'originDev
7
7
  id?: string;
8
8
  };
9
9
  type UpdateChunkInput = Pick<QvacChunk, 'id' | 'runStatus' | 'attachment'>;
10
+ export interface ChunkByChatKey {
11
+ chatId: string;
12
+ seq: number;
13
+ }
10
14
  export declare const HISTORY_CHUNK_TYPES: QvacChunk['type'][];
11
15
  type MediaKind = 'audio' | 'image' | 'video' | 'other';
12
16
  type AttachmentOrigin = 'uploaded' | 'generated';
@@ -5,7 +5,7 @@ export function registerSeedDefaultsRoutes(router) {
5
5
  let seeded = false;
6
6
  if (!(await tx.get(AGENTS, { id: op.agent.id }))) {
7
7
  await tx.insert(AGENTS, op.agent);
8
- log?.info('contract', 'seeded default agent', {
8
+ log?.debug('contract', 'seeded default agent', {
9
9
  id: op.agent.id,
10
10
  model: op.agent.modelName
11
11
  });
@@ -13,7 +13,7 @@ export function registerSeedDefaultsRoutes(router) {
13
13
  }
14
14
  if (!(await tx.get(CHATS, { id: op.chat.id }))) {
15
15
  await tx.insert(CHATS, op.chat);
16
- log?.info('contract', 'seeded first chat', { id: op.chat.id });
16
+ log?.debug('contract', 'seeded first chat', { id: op.chat.id });
17
17
  seeded = true;
18
18
  }
19
19
  for (const peer of op.blindPeers ?? []) {
@@ -88,7 +88,7 @@ export async function admitDevice({ tx, node, host, meshPublicKey, log }, device
88
88
  }
89
89
  await markWriterRevoked(tx, writerKey, { revoked: false });
90
90
  if (!alreadyAdmitted) {
91
- log?.info('contract', 'device admitted', { id: b4a.toHex(id).slice(0, 16) });
91
+ log?.debug('contract', 'device admitted', { id: b4a.toHex(id).slice(0, 16) });
92
92
  }
93
93
  return 'admitted';
94
94
  }
@@ -3,7 +3,7 @@ import type Hyperswarm from 'hyperswarm';
3
3
  import type Wakeup from 'protomux-wakeup';
4
4
  import type { Logger } from '../../index.ts';
5
5
  import type { LocalMeshDeparture } from '../../spec/local/hyperschema/types.d.ts';
6
- import type { BlindPeeringOpts, StartBlindPeeringOpts } from './blind-peers.ts';
6
+ import type BlindPeering from 'blind-peering';
7
7
  interface DepartureRows {
8
8
  departures(): Promise<LocalMeshDeparture[]>;
9
9
  deleteDeparture(key: Buffer): Promise<void>;
@@ -14,8 +14,7 @@ export interface PendingDeparturesOptions {
14
14
  deviceId: () => Buffer | null;
15
15
  logger?: Logger | null;
16
16
  blindPeerKeys?: ReadonlyArray<Buffer>;
17
- blindPeeringOpts?: BlindPeeringOpts;
18
- blindPeering?: boolean;
17
+ blindPeering: () => BlindPeering | null;
19
18
  wakeup?: Wakeup;
20
19
  }
21
20
  export declare class PendingDepartures {
@@ -24,7 +23,6 @@ export declare class PendingDepartures {
24
23
  private readonly _swarm;
25
24
  private readonly _log;
26
25
  private readonly _blindPeerKeys;
27
- private readonly _blindPeeringOpts;
28
26
  private readonly _wakeup;
29
27
  private readonly _isPooled;
30
28
  private readonly _deviceId;
@@ -32,7 +30,7 @@ export declare class PendingDepartures {
32
30
  private readonly _parked;
33
31
  private readonly _lock;
34
32
  private _closing;
35
- private _blindPeering;
33
+ private readonly _blindPeering;
36
34
  constructor(store: Corestore, local: DepartureRows, opts: PendingDeparturesOptions);
37
35
  flush(): void;
38
36
  private _flush;
@@ -41,8 +39,8 @@ export declare class PendingDepartures {
41
39
  park(key: Buffer): Promise<void>;
42
40
  unpark(key: Buffer): void;
43
41
  drop(key: Buffer): Promise<void>;
44
- startBlindPeering(opts?: StartBlindPeeringOpts): void;
45
- stopBlindPeering(): Promise<void>;
42
+ startBlindPeering(): void;
43
+ stopBlindPeering(): void;
46
44
  suspend(): Promise<void>;
47
45
  resume(): Promise<void>;
48
46
  close(): Promise<void>;
@@ -8,7 +8,6 @@ export class PendingDepartures {
8
8
  _swarm;
9
9
  _log;
10
10
  _blindPeerKeys;
11
- _blindPeeringOpts;
12
11
  _wakeup;
13
12
  _isPooled;
14
13
  _deviceId;
@@ -25,9 +24,8 @@ export class PendingDepartures {
25
24
  this._deviceId = opts.deviceId;
26
25
  this._log = opts.logger ?? null;
27
26
  this._blindPeerKeys = opts.blindPeerKeys ?? [];
28
- this._blindPeeringOpts = opts.blindPeeringOpts;
29
27
  this._wakeup = opts.wakeup;
30
- this._blindPeering = opts.blindPeering ?? true;
28
+ this._blindPeering = opts.blindPeering;
31
29
  }
32
30
  flush() {
33
31
  void this._flush().catch((err) => this._log?.warn(SCOPE, 'departure flush failed', err));
@@ -52,7 +50,6 @@ export class PendingDepartures {
52
50
  deviceId: this._deviceId() ?? undefined,
53
51
  logger: this._log,
54
52
  blindPeerKeys: this._blindPeerKeys,
55
- blindPeeringOpts: this._blindPeeringOpts,
56
53
  wakeup: this._wakeup
57
54
  });
58
55
  const done = this._deliver(row, mesh)
@@ -73,8 +70,9 @@ export class PendingDepartures {
73
70
  return;
74
71
  }
75
72
  this._swarm.join(mesh.discoveryKey, { server: true, client: true });
76
- if (this._blindPeering) {
77
- mesh.startBlindPeering(this._swarm.dht);
73
+ const peering = this._blindPeering();
74
+ if (peering) {
75
+ mesh.startBlindPeering(peering);
78
76
  }
79
77
  this._log?.info(scope, 'reopened a departed mesh to deliver its removal');
80
78
  const announced = await this._announce(mesh);
@@ -128,15 +126,19 @@ export class PendingDepartures {
128
126
  drop(key) {
129
127
  return this._local.deleteDeparture(key);
130
128
  }
131
- startBlindPeering(opts = {}) {
132
- this._blindPeering = true;
129
+ startBlindPeering() {
130
+ const peering = this._blindPeering();
131
+ if (!peering) {
132
+ return;
133
+ }
133
134
  for (const { mesh } of this._active.values()) {
134
- mesh.startBlindPeering(this._swarm.dht, opts);
135
+ mesh.startBlindPeering(peering);
135
136
  }
136
137
  }
137
- async stopBlindPeering() {
138
- this._blindPeering = false;
139
- await Promise.all([...this._active.values()].map(({ mesh }) => mesh.stopBlindPeering()));
138
+ stopBlindPeering() {
139
+ for (const { mesh } of this._active.values()) {
140
+ mesh.stopBlindPeering();
141
+ }
140
142
  }
141
143
  async suspend() {
142
144
  for (const { mesh } of this._active.values()) {
@@ -86,7 +86,7 @@ async function syncChatAttachmentChunks(mesh, chatId) {
86
86
  for (const chunk of await listChunks(mesh, { chatId, type: 'attachment' })) {
87
87
  if (mesh.closing)
88
88
  return false;
89
- await syncAttachmentChunk(mesh, chunk);
89
+ await mesh.files.syncAttachment(chunk);
90
90
  }
91
91
  return true;
92
92
  }
@@ -1,7 +1,7 @@
1
+ import BlindPeering from 'blind-peering';
1
2
  import Hyperdrive from 'hyperdrive';
2
3
  import type Corestore from 'corestore';
3
4
  import type Hyperswarm from 'hyperswarm';
4
- import type { BlindPeeringOpts } from './blind-peers.ts';
5
5
  export interface AcquiredDrive {
6
6
  readonly drive: Hyperdrive;
7
7
  readonly writable: boolean;
@@ -12,14 +12,10 @@ export interface DriveHost {
12
12
  }
13
13
  export interface PeeredDriveHost extends DriveHost {
14
14
  startBlindPeering(): Promise<void>;
15
- stopBlindPeering(): Promise<void>;
16
- suspend(): Promise<void>;
17
- resume(): Promise<void>;
18
15
  }
19
16
  export interface DriveHostOptions {
20
17
  readonly swarm: Hyperswarm;
21
18
  readonly blindPeerKeys: ReadonlyArray<Buffer>;
22
- readonly blindPeeringOpts?: BlindPeeringOpts;
23
- readonly blindPeering?: boolean;
19
+ readonly blindPeering: () => BlindPeering | null;
24
20
  }
25
21
  export declare function createFsDriveHost(store: Corestore, opts: DriveHostOptions): PeeredDriveHost;
@@ -26,20 +26,15 @@ async function openDrive(store, swarm, key) {
26
26
  export function createFsDriveHost(store, opts) {
27
27
  const namespaced = store.namespace(NAMESPACE);
28
28
  const drives = new Map();
29
- let suspended = false;
30
- let peering = opts.blindPeering === false ? null : startPeering();
31
- function startPeering() {
32
- return new BlindPeering(opts.swarm.dht, namespaced, {
33
- pick: 2,
34
- suspended,
35
- ...opts.blindPeeringOpts
36
- });
37
- }
38
29
  async function peer(held) {
30
+ const peering = opts.blindPeering();
31
+ if (!peering) {
32
+ return;
33
+ }
39
34
  const blobs = await held.drive.getBlobs();
40
- peering?.addCoreBackground(held.drive.core, { keys: opts.blindPeerKeys });
35
+ peering.addCoreBackground(held.drive.core, { keys: opts.blindPeerKeys, pick: 2 });
41
36
  if (blobs) {
42
- peering?.addCoreBackground(blobs.core, { keys: opts.blindPeerKeys });
37
+ peering.addCoreBackground(blobs.core, { keys: opts.blindPeerKeys, pick: 2 });
43
38
  }
44
39
  }
45
40
  async function acquire(key) {
@@ -63,25 +58,8 @@ export function createFsDriveHost(store, opts) {
63
58
  .map(({ value }) => value);
64
59
  }
65
60
  async function startBlindPeering() {
66
- if (peering) {
67
- return;
68
- }
69
- peering = startPeering();
70
61
  await Promise.all((await opened()).map(peer));
71
62
  }
72
- async function stopBlindPeering() {
73
- const closing = peering;
74
- peering = null;
75
- await closing?.close();
76
- }
77
- async function suspend() {
78
- suspended = true;
79
- await peering?.suspend();
80
- }
81
- async function resume() {
82
- suspended = false;
83
- await peering?.resume();
84
- }
85
63
  async function close() {
86
64
  const held = await opened();
87
65
  drives.clear();
@@ -89,7 +67,6 @@ export function createFsDriveHost(store, opts) {
89
67
  await topic.destroy();
90
68
  await drive.close();
91
69
  }));
92
- await peering?.close();
93
70
  }
94
- return { acquire, startBlindPeering, stopBlindPeering, suspend, resume, close };
71
+ return { acquire, startBlindPeering, close };
95
72
  }
@@ -1,4 +1,5 @@
1
1
  import Autobee, { type AutobeeChanges, type AutobeeHost, type AutobeeNode, type AutobeeOplogRef } from 'autobee';
2
+ import BlindPeering from 'blind-peering';
2
3
  import Corestore from 'corestore';
3
4
  import HyperDB from 'hyperdb';
4
5
  import Hyperblobs from 'hyperblobs';
@@ -9,7 +10,6 @@ import { Files } from './files/index.ts';
9
10
  import type { Logger } from '../../index.ts';
10
11
  import { Router } from '../../spec/mesh/hyperdispatch/index.js';
11
12
  import type { QvacCapabilityProfile, QvacDevice, QvacMember, QvacMeshName } from '../../spec/mesh/hyperschema/types.d.ts';
12
- import type { BlindPeeringOpts, StartBlindPeeringOpts } from './blind-peers.ts';
13
13
  import type { AttachmentUrl } from './attachment-link.ts';
14
14
  import type { MeshFileIndex } from './files/local-index.ts';
15
15
  import { type DeviceAttestation } from './device-attestation.ts';
@@ -35,8 +35,8 @@ export interface MeshOptions {
35
35
  deviceId?: Buffer;
36
36
  logger?: Logger | null;
37
37
  blindPeerKeys?: ReadonlyArray<Buffer>;
38
- blindPeeringOpts?: BlindPeeringOpts;
39
38
  bootFrom?: AutobeeOplogRef | null;
39
+ trustedDevice?: (deviceId: Buffer) => Promise<boolean>;
40
40
  wakeup?: Wakeup;
41
41
  attachmentUrl?: AttachmentUrl | null;
42
42
  fileIndex?: MeshFileIndex | null;
@@ -93,7 +93,6 @@ export declare class Mesh extends ReadyResource {
93
93
  private readonly _writerSeed;
94
94
  private readonly _log;
95
95
  private readonly _blindPeerKeys;
96
- private readonly _blindPeeringOpts;
97
96
  private readonly _bootFrom;
98
97
  private readonly _wakeup;
99
98
  readonly attachmentUrl: AttachmentUrl | null;
@@ -104,6 +103,9 @@ export declare class Mesh extends ReadyResource {
104
103
  private readonly _deviceKeyPair;
105
104
  private readonly _encryptionKey;
106
105
  private _blindPeering;
106
+ private _openedAt;
107
+ private readonly _trustedDevice;
108
+ private _joined;
107
109
  private _orphanedBlobSweepStatus;
108
110
  private _bootInterrupted;
109
111
  private _localWriterUploadedLength;
@@ -144,8 +146,14 @@ export declare class Mesh extends ReadyResource {
144
146
  attestDevice(deviceId: Buffer): DeviceAttestation;
145
147
  constructor(store: Corestore, opts?: MeshOptions);
146
148
  _open(): Promise<void>;
147
- startBlindPeering(dht: unknown, { suspended }?: StartBlindPeeringOpts): void;
148
- stopBlindPeering(): Promise<void>;
149
+ startBlindPeering(peering: BlindPeering): void;
150
+ stopBlindPeering(): void;
151
+ get bootFrom(): number | null;
152
+ get writerCount(): number;
153
+ get uptimeMs(): number;
154
+ blindPeersConnected(): number;
155
+ private _sinceOpen;
156
+ private _lengths;
149
157
  openBlobs(coreKey: Buffer): Promise<Hyperblobs>;
150
158
  interruptBoot(): void;
151
159
  _close(): Promise<void>;
@@ -166,25 +174,30 @@ export declare class Mesh extends ReadyResource {
166
174
  batch(): MeshBatch;
167
175
  appendBirthOp(identity: Buffer | KeyPair, device?: DeviceMetadata, opts?: BirthOptions | (() => Promise<BirthOptions>)): Promise<void>;
168
176
  private _settleBirth;
177
+ get joined(): boolean;
169
178
  private _appendBirthOp;
170
179
  get interrupted(): unknown;
171
180
  throwIfInterrupted(): void;
172
181
  waitForWritable(timeout?: number): Promise<void>;
173
182
  pendingUploads(): number;
174
183
  suspend(): Promise<void>;
175
- resume(): Promise<void>;
176
- syncChatOrder: ((chatIds: Set<string>) => Promise<void>) | null;
184
+ resume(): void;
185
+ syncChatOrder: ((chatIds: Set<string> | null) => Promise<void>) | null;
177
186
  chatOrderBuilt: Promise<void>;
178
187
  watch(listener: () => void): void;
179
188
  unwatch(listener: () => void): void;
180
189
  _autobeeIsTrusted(key: Buffer, reference: MeshView): Promise<boolean>;
181
190
  _autobeeMostRecentTrusted(target: MeshView, reference: MeshView | null): Promise<AutobeeOplogRef | null>;
191
+ private _vouchedByItsRow;
182
192
  _autobeeOpen(bee: unknown): MeshView;
183
193
  _autobeeWarmup(view: MeshView): Promise<void>;
184
194
  _autobeeApply(nodes: ReadonlyArray<AutobeeNode>, view: MeshView, host: AutobeeHost): Promise<void>;
185
195
  private _applyNode;
186
196
  private _halt;
187
197
  _autobeeUpdate(view: MeshView, changes: AutobeeChanges): Promise<void>;
198
+ private _arrive;
199
+ private _readLanding;
200
+ private _prefetchView;
188
201
  checkOwnAdmission(): Promise<void>;
189
202
  checkResumedRevocation(): Promise<'kicked' | 'left' | null>;
190
203
  ownWriterRefused(): Promise<boolean>;