@qvac/core 0.7.1 → 0.7.2

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,18 @@ release.
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.7.2] - 2026-10-13
17
+
18
+ ### Added
19
+
20
+ - `duck --join <invite>` (`-j`) joins a mesh invite at boot, so a `--headless` peer, which has no prompt to `/join` from, can get onto an existing mesh. A device invite pairs it into your account; a member invite adds a shared mesh to its own. (#371)
21
+
22
+ ```sh
23
+ duck --headless --storage ~/duck-data --join qvac://mesh/…
24
+ ```
25
+
26
+ - `/rename device <name>` names this device and `/rename member <name>` names you in every mesh at once, so a roster of `duck-<pid>` devices can be told apart. (#372)
27
+
16
28
  ## [0.7.1] - 2026-10-12
17
29
 
18
30
  ### Added
@@ -1481,7 +1493,8 @@ Published under the `release-0.1` dist-tag.
1481
1493
  await assistant.ready()
1482
1494
  ```
1483
1495
 
1484
- [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.7.1...HEAD
1496
+ [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.7.2...HEAD
1497
+ [0.7.2]: https://github.com/tetherto/qvac-core/compare/v0.7.1...v0.7.2
1485
1498
  [0.7.1]: https://github.com/tetherto/qvac-core/compare/v0.7.0...v0.7.1
1486
1499
  [0.7.0]: https://github.com/tetherto/qvac-core/compare/v0.6.7...v0.7.0
1487
1500
  [0.6.7]: https://github.com/tetherto/qvac-core/compare/v0.6.6...v0.6.7
@@ -33,7 +33,7 @@ import { InferenceCallStore } from './inference-calls.js';
33
33
  import { LOCAL_HOLDER, RunReplayStore, trackSentRun } from './run-replay.js';
34
34
  import { fsGrantKey, fsWriteGrantKey } from './fs-grant-keys.js';
35
35
  import { fsGrantsFrom, grantedDirsFrom } from './fs-grants.js';
36
- import { defaultImageCacheDir } from './image-cache-dir.js';
36
+ import { persistentDir } from './persistent-dir.js';
37
37
  import { ModelCatalogRevisionHub } from './model-catalog-revision.js';
38
38
  import { agentRekeyFingerprint, agentSwitched, chatKvCacheKey, chatRepairKvCacheKey, disappearedChatIds } from './kv-cache-reclaim.js';
39
39
  import { buildCompactionPrompt, canCompact, foldReducesPrompt, COMPACTION_KEEP_TURNS, COMPACTION_TURN_PREFIX, isContextOverflowFailure, nearContextLimit, compactionBoundary, lastCompactedThroughId, parseCompactionSummary } from './compaction.js';
@@ -201,7 +201,7 @@ export class QvacAssistant extends ReadyResource {
201
201
  this._borrowHarness = borrowHarness ?? null;
202
202
  this._drives = drives;
203
203
  this._log = logger;
204
- this._imageCacheDir = imageCacheDir ?? defaultImageCacheDir();
204
+ this._imageCacheDir = imageCacheDir ?? persistentDir('image-cache');
205
205
  this._imageCacheMaxBytes = imageCacheMaxBytes;
206
206
  this._imageCacheMaxAgeMs = imageCacheMaxAgeMs;
207
207
  this._downloadRetryMs = downloadRetryMs;
@@ -229,8 +229,8 @@ export class QvacAssistant extends ReadyResource {
229
229
  this._meshConsumers = new Map();
230
230
  this._runs = new Map();
231
231
  this._seen = new Map();
232
- this._inferenceCalls = new InferenceCallStore(inferenceCallsDir);
233
- this._runReplay = new RunReplayStore(runReplayDir);
232
+ this._inferenceCalls = new InferenceCallStore(inferenceCallsDir ?? persistentDir('inspector'));
233
+ this._runReplay = new RunReplayStore(runReplayDir ?? persistentDir('run-replay'));
234
234
  this._lifecycle = new AbortController();
235
235
  this._audioTranscripts = new Map();
236
236
  this._pdfPages = new Map();
@@ -27,13 +27,12 @@ export interface SweepLimits {
27
27
  export interface SweepResult {
28
28
  readonly removed: number;
29
29
  }
30
- export declare function defaultInferenceCallsDir(): string;
31
30
  export declare const MAX_TOTAL_BYTES: number;
32
31
  export declare const MAX_AGE_MS: number;
33
32
  export declare class InferenceCallStore {
34
33
  private readonly _dir;
35
34
  private readonly _writes;
36
- constructor(dir?: string);
35
+ constructor(dir: string);
37
36
  record(chatId: string, entry: InferenceCallEntry): Promise<void>;
38
37
  recordSent(chatId: string, sent: InferenceCallSent): Promise<void>;
39
38
  recordOutcome(chatId: string, verdict: InferenceCallOutcome): Promise<void>;
@@ -1,11 +1,7 @@
1
1
  import fs from 'fs';
2
2
  import { join } from 'path';
3
- import { persistent } from 'bare-storage';
4
3
  import { WriteQueue } from './write-queue.js';
5
4
  import { isRecord, safeName } from './guards.js';
6
- export function defaultInferenceCallsDir() {
7
- return join(persistent(), 'qvac', 'inspector');
8
- }
9
5
  const CALLS_FILE = 'calls.jsonl';
10
6
  const BLOCKS_DIR = 'blocks';
11
7
  const MAX_CALLS_BYTES = 8 * 1024 * 1024;
@@ -15,7 +11,7 @@ const MAX_LINES_READ = 600;
15
11
  export class InferenceCallStore {
16
12
  _dir;
17
13
  _writes;
18
- constructor(dir = defaultInferenceCallsDir()) {
14
+ constructor(dir) {
19
15
  this._dir = dir;
20
16
  this._writes = new WriteQueue();
21
17
  }
@@ -0,0 +1 @@
1
+ export declare function persistentDir(name: string): string;
@@ -0,0 +1,9 @@
1
+ import { persistent } from 'bare-storage';
2
+ import { join } from 'path';
3
+ import { underTest } from './test-env.js';
4
+ export function persistentDir(name) {
5
+ if (underTest()) {
6
+ throw new Error(`${name} would land in the device's persistent dir; pass its dir option`);
7
+ }
8
+ return join(persistent(), 'qvac', name);
9
+ }
@@ -6,7 +6,7 @@ export interface ReplayChat {
6
6
  }
7
7
  export declare class RunReplayStore {
8
8
  private readonly _dir;
9
- constructor(dir?: string);
9
+ constructor(dir: string);
10
10
  started(): Promise<boolean>;
11
11
  start(): Promise<void>;
12
12
  load({ holder, chatId }: ReplayChat): Promise<Map<string, ChatMessage[]>>;
@@ -23,4 +23,3 @@ export interface SentRunTracker {
23
23
  }
24
24
  export declare function trackSentRun(cacheKey: string | undefined): SentRunTracker;
25
25
  export declare function appendedTurns(sent: unknown, inputLength: number): ChatMessage[] | null;
26
- export declare function defaultRunReplayDir(): string;
@@ -1,11 +1,10 @@
1
1
  import fs from 'fs';
2
2
  import { join } from 'path';
3
- import { persistent } from 'bare-storage';
4
3
  import { isRecord, safeName } from './guards.js';
5
4
  export const LOCAL_HOLDER = 'local';
6
5
  export class RunReplayStore {
7
6
  _dir;
8
- constructor(dir = defaultRunReplayDir()) {
7
+ constructor(dir) {
9
8
  this._dir = dir;
10
9
  }
11
10
  async started() {
@@ -97,9 +96,6 @@ export function appendedTurns(sent, inputLength) {
97
96
  .map((turn) => (isRecord(turn) ? { role: turn.role, content: turn.content } : null));
98
97
  return turns.every(isChatMessage) ? turns : null;
99
98
  }
100
- export function defaultRunReplayDir() {
101
- return join(persistent(), 'qvac', 'run-replay');
102
- }
103
99
  function isChatMessage(value) {
104
100
  return (isRecord(value) &&
105
101
  (value.role === 'user' || value.role === 'assistant' || value.role === 'tool') &&
@@ -0,0 +1 @@
1
+ export declare function underTest(): boolean;
@@ -0,0 +1,4 @@
1
+ import process from 'process';
2
+ export function underTest() {
3
+ return Boolean(process.env.QVAC_TEST);
4
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/core",
3
- "version": "0.7.1",
3
+ "version": "0.7.2",
4
4
  "type": "module",
5
5
  "description": "Peer-to-peer AI across your devices",
6
6
  "engines": {
@@ -165,7 +165,7 @@
165
165
  "mesh-recover-account": "bare examples/mesh-recover-account.mjs",
166
166
  "mesh-user-names": "bare examples/mesh-user-names.mjs",
167
167
  "test": "npm run test:bare && npm run bench:rag:test",
168
- "test:bare": "QVAC_NO_SKILL_BIN_PROBE=1 brittle-jobs -j 2 --retries 1 --timeout 600000 'test/*.ts' 'test/{api,basic,host,rag}/**/*.ts' 'test/tui/**/!(helpers).ts'",
168
+ "test:bare": "QVAC_NO_SKILL_BIN_PROBE=1 QVAC_TEST=1 brittle-jobs -j 2 --retries 1 --timeout 600000 'test/*.ts' 'test/{api,basic,host,rag}/**/*.ts' 'test/tui/**/!(helpers).ts'",
169
169
  "test:model": "QVAC_TEST_MODELS=1 npm run test:bare",
170
170
  "format": "prettier . --write",
171
171
  "lint": "prettier . --check && lunte && tsc --noEmit",
package/tui/README.md CHANGED
@@ -42,19 +42,22 @@ Bare's native TTY; the TUI will not run under node.
42
42
  ## Usage
43
43
 
44
44
  ```
45
- duck [--storage <dir>] [--temp] [--headless] [--fake-models]
45
+ duck [--storage <dir>] [--temp] [--headless] [--join <invite>] [--fake-models]
46
46
  ```
47
47
 
48
- Flags may appear in any order. Joining a mesh is `/join qvac://mesh/…` inside
49
- the app, not a boot argument.
48
+ Flags may appear in any order. Inside the app, `/join qvac://mesh/…` moves a
49
+ running instance to another mesh.
50
50
 
51
51
  - `--storage <dir>` — a self-contained root (its own corestore and SDK home
52
52
  under `<dir>`). `QVAC_STORAGE` is the env fallback.
53
53
  - `--temp` — the same, in a throwaway dir. `QVAC_TEMP=1` is the env fallback.
54
- - `--headless` — brings the same stack up with no TUI: prints the mesh invite,
55
- then streams logs (including the sidecar child's own output) to stdout until
54
+ - `--headless` — brings the same stack up with no TUI: prints this device's invite
55
+ (it adds one of your own devices), then streams logs (including the sidecar child's own output) to stdout until
56
56
  ctrl+C. A mesh peer to point other instances at, and the only live view of
57
57
  the boot the TUI hides.
58
+ - `--join <invite>` (`-j`) — joins that mesh invite at boot, with no preview
59
+ step, then prints this device's invite, as without the flag. For a headless peer that has no
60
+ prompt to `/join` from.
58
61
  - `--fake-models` — adds the `quack` model, a fake LLM that runs no inference:
59
62
  it replies with `quack` repeated a number of times taken from a hash of the
60
63
  prompt, so the same prompt always gets the same reply. Pick it with
package/tui/app.mjs CHANGED
@@ -231,6 +231,15 @@ const COMMANDS = [
231
231
  ]
232
232
  },
233
233
  { name: 'members', desc: 'list mesh members with their devices grouped', palette: true },
234
+ {
235
+ name: 'rename',
236
+ desc: 'name this device, or yourself across every mesh',
237
+ palette: true,
238
+ sub: [
239
+ { name: 'device', desc: '<name> — name this device; every mesh it is in shows it' },
240
+ { name: 'member', desc: '<name> — name yourself, in every mesh at once' }
241
+ ]
242
+ },
234
243
  // before `meshes`, so a bare /mesh offers the verb first and the list second
235
244
  {
236
245
  name: 'mesh',
@@ -2314,6 +2323,7 @@ export class ChatApp {
2314
2323
  ' /invite - show this mesh device invite · /invite member - open your shared mesh and invite someone into it (your account is never shared)',
2315
2324
  ' /mesh new - open another shared mesh · /mesh new compute - lend this device · /mesh label <n|id> <name> - name a mesh, privately to you',
2316
2325
  ' /members — list mesh members with their devices grouped',
2326
+ ' /rename device <name> — name this device · /rename member <name> — name yourself, across every mesh',
2317
2327
  ' /meshes - list the meshes this device belongs to, numbered, marking account / shared / active / open / writable',
2318
2328
  ' /mesh use <n|id> - make one of them active; its agent, chat and roster replace the ones on screen',
2319
2329
  ' /mesh move <n|id> [chat] - move this chat (or the named one) into another mesh, its files and running turn with it · /mesh moved [chat] - how that move is going',
@@ -3447,6 +3457,26 @@ export class ChatApp {
3447
3457
  })
3448
3458
  }
3449
3459
 
3460
+ if (cmd === 'rename') {
3461
+ const [action, ...nameParts] = rest
3462
+ const name = nameParts.join(' ')
3463
+ if (!name || (action !== 'device' && action !== 'member')) {
3464
+ return notice('usage: /rename device <name> · /rename member <name>')
3465
+ }
3466
+
3467
+ return run(async () => {
3468
+ if (action === 'device') {
3469
+ await engine.renameDevice({ meshId: this.meshId, config: { name } })
3470
+
3471
+ return `this device is now "${name}"`
3472
+ }
3473
+
3474
+ await engine.updateMember({ config: { name } })
3475
+
3476
+ return `you are now "${name}" in every mesh`
3477
+ })
3478
+ }
3479
+
3450
3480
  if (cmd === 'meshes') {
3451
3481
  return run(async () => {
3452
3482
  const { meshes } = await engine.listMeshes({})
package/tui/boot.mjs CHANGED
@@ -40,7 +40,7 @@ async function startSidecar({ entry, config, logger }) {
40
40
  }
41
41
  }
42
42
 
43
- // joining a mesh is /join inside the app: the engine takes an invite live, so it is never a flag
43
+ // --join is the headless way in, /join the interactive one; both hand the engine the invite live
44
44
  export async function boot(args) {
45
45
  const connectStart = Date.now()
46
46
  // only an explicit QVAC_MODEL overrides, or resuming a shared mesh rewrites the desktop's agent
@@ -95,6 +95,10 @@ export async function boot(args) {
95
95
  })
96
96
  // the device id is its public key: the raw 32-byte buffer end to end, never a hex string
97
97
  const deviceId = (await engine.deviceInfo({})).id
98
+ if (args.join) {
99
+ await engine.joinMesh({ invite: args.join })
100
+ }
101
+
98
102
  const meshInvite = (await engine.meshInvite({})).invite ?? null
99
103
 
100
104
  return {
package/tui/index.mjs CHANGED
@@ -12,7 +12,8 @@ const cmd = command(
12
12
  ),
13
13
  flag('--storage|-s [dir]', 'a self-contained root, its own corestore and SDK home'),
14
14
  flag('--temp', 'the same, in a throwaway dir'),
15
- flag('--headless', 'no TUI: print the mesh invite and stream logs until ctrl+C'),
15
+ flag('--headless', 'no TUI: print the device invite and stream logs until ctrl+C'),
16
+ flag('--join|-j <invite>', 'join this invite at boot'),
16
17
  flag('--fake-models', 'adds the quack model: a deterministic fake LLM for testing without AI'),
17
18
  flag('--version|-v', 'versions of core, harness and the SDK')
18
19
  )
@@ -1 +0,0 @@
1
- export declare function defaultImageCacheDir(): string;
@@ -1,5 +0,0 @@
1
- import { persistent } from 'bare-storage';
2
- import { join } from 'path';
3
- export function defaultImageCacheDir() {
4
- return join(persistent(), 'qvac', 'image-cache');
5
- }