@qvac/core 0.6.2 → 0.6.4

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,21 @@ release.
13
13
 
14
14
  ## [Unreleased]
15
15
 
16
+ ## [0.6.4] - 2026-09-30
17
+
18
+ ### Removed
19
+
20
+ - The collabora office adapter and its `@qvac/core/rag/extract/office` export.
21
+ Office extraction is `extractOfficeText` from `@qvac/harness/office`, passed
22
+ through the `extractors.office` option. (#285)
23
+
24
+ ## [0.6.3] - 2026-09-30
25
+
26
+ ### Changed
27
+
28
+ - `@qvac/harness` is `^0.7.1`, the first harness that names `isLoading` on
29
+ `listModels` rows. Before it every row read `false`. (#288)
30
+
16
31
  ## [0.6.2] - 2026-09-30
17
32
 
18
33
  ### Added
@@ -56,7 +71,7 @@ release.
56
71
  into memory for the boot warm, `loadModel` or a run this device serves, with a
57
72
  `modelCatalogWatch` bump when it turns on and again when it turns off. A
58
73
  Models screen or host bar can say a model is loading at boot, before any
59
- message is sent. The harness names it, from `@qvac/harness` 0.8.0; an older
74
+ message is sent. The harness names it, from `@qvac/harness` 0.7.1; an older
60
75
  harness lists every row as `false`, and other rows read `false` for now.
61
76
 
62
77
  ```js
@@ -1144,7 +1159,9 @@ Published under the `release-0.1` dist-tag.
1144
1159
  await assistant.ready()
1145
1160
  ```
1146
1161
 
1147
- [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.6.2...HEAD
1162
+ [Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.6.4...HEAD
1163
+ [0.6.4]: https://github.com/tetherto/qvac-core/compare/v0.6.3...v0.6.4
1164
+ [0.6.3]: https://github.com/tetherto/qvac-core/compare/v0.6.2...v0.6.3
1148
1165
  [0.6.2]: https://github.com/tetherto/qvac-core/compare/v0.6.1...v0.6.2
1149
1166
  [0.6.1]: https://github.com/tetherto/qvac-core/compare/v0.6.0...v0.6.1
1150
1167
  [0.6.0]: https://github.com/tetherto/qvac-core/compare/v0.5.0...v0.6.0
package/README.md CHANGED
@@ -687,18 +687,10 @@ feature checklist vs core v1.
687
687
 
688
688
  ### Office documents
689
689
 
690
- Word-processor documents (`.docx`, `.doc`, `.docm`, `.dot`, `.dotx`, `.odt`,
691
- `.fodt`, `.ott`) decode through an engine the host supplies rather than a
692
- declared dependency: the package pulls all thirteen platform prebuilds at
693
- ~350MB each, so declaring it would cost every install 4.3GB. In this repo,
694
- fetch the one for this machine before exercising `/knowledge add report.docx`:
695
-
696
- ```sh
697
- bun run engine:collabora
698
- ```
699
-
700
- **There is no equivalent for an installed `duck`.** Nothing fetches the engine
701
- for you, so those formats fail to index outside this repo, even though
690
+ Core ships no office decoder. Word-processor documents (`.docx`, `.doc`,
691
+ `.odt`, …) index only when the host passes one through the `extractors.office`
692
+ option — the app injects `extractOfficeText` from `@qvac/harness/office`.
693
+ `duck` injects none, so those formats fail to index there even though
702
694
  `/knowledge add` accepts them. Everything else it accepts — `.pdf`, `.txt`,
703
695
  `.md`, `.rtf`, `.html`, `.csv`, `.json` and the rest — works from any install.
704
696
 
@@ -1,2 +1 @@
1
1
  export declare const MAX_KNOWLEDGE_BYTES: number;
2
- export declare const MAX_OFFICE_BYTES: number;
@@ -1,2 +1 @@
1
1
  export const MAX_KNOWLEDGE_BYTES = 100 * 1024 * 1024;
2
- export const MAX_OFFICE_BYTES = 20 * 1024 * 1024;
@@ -20,7 +20,6 @@ import { getChat, removeChatAttachments, removeChatKnowledge } from './core/chat
20
20
  import { rebuildChatOrder, refreshChatOrder } from './core/chat-order.js';
21
21
  import { createFsDriveHost } from './core/fs-drives.js';
22
22
  import { sweepDriveStaging } from './fs-drive-bridge.js';
23
- import { closeCollaboraWorker } from './collabora/worker.js';
24
23
  import { decodeMeshInvite, encodeMeshInvite } from './core/invite.js';
25
24
  import { fileKeyOf, knownFile, referencedFile } from './core/files/local-index.js';
26
25
  import { grantKeyPair, inviteGrantTermsRefusal } from './core/invite-grants.js';
@@ -918,7 +917,6 @@ export class Core extends ReadyResource {
918
917
  await this._stopHostedAgents(entry);
919
918
  }
920
919
  await this._stopIndexing();
921
- closeCollaboraWorker();
922
920
  await this._blobServer?.close();
923
921
  this._blobServer = null;
924
922
  for (const entry of this._meshes.values()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qvac/core",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "type": "module",
5
5
  "description": "Peer-to-peer AI across your devices",
6
6
  "engines": {
@@ -51,10 +51,6 @@
51
51
  "types": "./dist-lib/lib/core/files/rag/models.d.ts",
52
52
  "default": "./dist-lib/lib/core/files/rag/models.js"
53
53
  },
54
- "./rag/extract/office": {
55
- "types": "./dist-lib/lib/core/files/rag/extract/office-collabora.d.ts",
56
- "default": "./dist-lib/lib/core/files/rag/extract/office-collabora.js"
57
- },
58
54
  "./rag/limits": {
59
55
  "types": "./dist-lib/lib/core/files/rag/limits.d.ts",
60
56
  "default": "./dist-lib/lib/core/files/rag/limits.js"
@@ -223,7 +219,6 @@
223
219
  "bare": "bare-fetch",
224
220
  "default": "./dist-lib/lib/fetch-node.js"
225
221
  },
226
- "#collabora-worker-entry": "./dist-lib/lib/collabora/entry.js",
227
222
  "worker_threads": {
228
223
  "bare": "bare-worker",
229
224
  "default": "worker_threads"
@@ -242,7 +237,7 @@
242
237
  }
243
238
  },
244
239
  "dependencies": {
245
- "@qvac/harness": "^0.7.0",
240
+ "@qvac/harness": "^0.7.1",
246
241
  "@qvac/skills": "^0.1.11",
247
242
  "asenion": "^0.1.0",
248
243
  "autobee": "^2.11.8",
@@ -1,9 +0,0 @@
1
- import type { AbortSignal } from 'bare-abort-controller';
2
- export interface ConvertInput {
3
- readonly bytes: Uint8Array;
4
- readonly fileName: string;
5
- readonly to: string;
6
- readonly signal?: AbortSignal;
7
- }
8
- export declare function convert(input: ConvertInput): Promise<Uint8Array>;
9
- export declare function convertToText(input: ConvertInput): Promise<string>;
@@ -1,65 +0,0 @@
1
- import b4a from 'b4a';
2
- import { randomBytes } from 'crypto';
3
- import fs from 'fs';
4
- import os from 'os';
5
- import path from 'path';
6
- import { convertInWorker } from './worker.js';
7
- const ZIP_SIGNATURE = 0x04034b50;
8
- const EOCD_SIGNATURE = 0x06054b50;
9
- const EOCD_SIZE = 22;
10
- const EOCD_SCAN = 65_535 + EOCD_SIZE;
11
- export async function convert(input) {
12
- assertIntactZip(input.bytes);
13
- const base = path.join(os.tmpdir(), `qvac-collabora-${b4a.toHex(randomBytes(8))}`);
14
- const src = `${base}${sourceExtension(input.fileName)}`;
15
- const out = `${base}.${input.to}`;
16
- try {
17
- await fs.promises.writeFile(src, input.bytes);
18
- await convertInWorker({ src, out, format: input.to }, input.signal);
19
- return await fs.promises.readFile(out);
20
- }
21
- finally {
22
- await unlinkQuiet(src);
23
- await unlinkQuiet(out);
24
- }
25
- }
26
- export async function convertToText(input) {
27
- const bytes = await convert(input);
28
- return stripBom(b4a.toString(bytes, 'utf8'));
29
- }
30
- function assertIntactZip(bytes) {
31
- const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
32
- if (bytes.byteLength < EOCD_SIZE || view.getUint32(0, true) !== ZIP_SIGNATURE) {
33
- return;
34
- }
35
- const eocd = findEocd(view);
36
- if (eocd === -1) {
37
- throw new Error('truncated document: the zip central directory is missing');
38
- }
39
- const directoryEnd = view.getUint32(eocd + 16, true) + view.getUint32(eocd + 12, true);
40
- if (directoryEnd > eocd) {
41
- throw new Error('truncated document: zip central directory is cut off');
42
- }
43
- }
44
- function findEocd(view) {
45
- const from = Math.max(0, view.byteLength - EOCD_SCAN);
46
- for (let at = view.byteLength - EOCD_SIZE; at >= from; at--) {
47
- if (view.getUint32(at, true) === EOCD_SIGNATURE)
48
- return at;
49
- }
50
- return -1;
51
- }
52
- function sourceExtension(fileName) {
53
- const ext = path.extname(fileName).toLowerCase();
54
- return ext || '.doc';
55
- }
56
- function stripBom(text) {
57
- return text.charCodeAt(0) === 0xfeff ? text.slice(1) : text;
58
- }
59
- async function unlinkQuiet(file) {
60
- try {
61
- await fs.promises.unlink(file);
62
- }
63
- catch {
64
- }
65
- }
@@ -1 +0,0 @@
1
- export {};
@@ -1,42 +0,0 @@
1
- import { parentPort } from 'worker_threads';
2
- import { asHostJob } from './protocol.js';
3
- import { errorMessage } from '../guards.js';
4
- async function main() {
5
- if (!parentPort) {
6
- throw new Error('collabora entry loaded on the main thread');
7
- }
8
- const port = parentPort;
9
- const convert = await load();
10
- port.on('message', (message) => {
11
- const job = asHostJob(message);
12
- if (!job) {
13
- port.close();
14
- return;
15
- }
16
- if (typeof convert === 'string') {
17
- port.postMessage({ id: job.id, error: convert });
18
- port.close();
19
- return;
20
- }
21
- port.postMessage(run(convert, job));
22
- });
23
- }
24
- async function load() {
25
- try {
26
- const { Document } = await import('bare-collabora');
27
- return (job) => void new Document(job.src).saveAs(job.out, job.format);
28
- }
29
- catch (error) {
30
- return `the document engine failed to load: ${errorMessage(error)}`;
31
- }
32
- }
33
- function run(convert, job) {
34
- try {
35
- convert(job);
36
- return { id: job.id, ok: true };
37
- }
38
- catch (error) {
39
- return { id: job.id, error: errorMessage(error) };
40
- }
41
- }
42
- await main();
@@ -1,15 +0,0 @@
1
- export interface HostJob {
2
- readonly id: number;
3
- readonly src: string;
4
- readonly out: string;
5
- readonly format: string;
6
- }
7
- export type WorkerReply = {
8
- readonly id: number;
9
- readonly ok: true;
10
- } | {
11
- readonly id: number;
12
- readonly error: string;
13
- };
14
- export declare function asWorkerReply(value: unknown): WorkerReply | null;
15
- export declare function asHostJob(value: unknown): HostJob | null;
@@ -1,31 +0,0 @@
1
- export function asWorkerReply(value) {
2
- if (typeof value !== 'object' || value === null || !('id' in value)) {
3
- return null;
4
- }
5
- const id = value.id;
6
- if (typeof id !== 'number') {
7
- return null;
8
- }
9
- if ('ok' in value && value.ok === true) {
10
- return { id, ok: true };
11
- }
12
- if ('error' in value && typeof value.error === 'string') {
13
- return { id, error: value.error };
14
- }
15
- return null;
16
- }
17
- export function asHostJob(value) {
18
- if (typeof value !== 'object' || value === null)
19
- return null;
20
- if (!('id' in value && 'src' in value && 'out' in value && 'format' in value)) {
21
- return null;
22
- }
23
- const { id, src, out, format } = value;
24
- if (typeof id !== 'number') {
25
- return null;
26
- }
27
- if (typeof src !== 'string' || typeof out !== 'string' || typeof format !== 'string') {
28
- return null;
29
- }
30
- return { id, src, out, format };
31
- }
@@ -1,5 +0,0 @@
1
- import type { AbortSignal } from 'bare-abort-controller';
2
- import { type HostJob } from './protocol.ts';
3
- export type ConvertJob = Omit<HostJob, 'id'>;
4
- export declare function convertInWorker(job: ConvertJob, signal?: AbortSignal): Promise<void>;
5
- export declare function closeCollaboraWorker(): void;
@@ -1,177 +0,0 @@
1
- import process from 'process';
2
- import ScopeLock from 'scope-lock';
3
- import safetyCatch from 'safety-catch';
4
- import { fileURLToPath } from 'url';
5
- import { Worker as Thread } from 'worker_threads';
6
- import { asWorkerReply } from './protocol.js';
7
- import { errorMessage } from '../guards.js';
8
- const DEADLINE_MS = 60_000;
9
- const lock = new ScopeLock();
10
- let active = null;
11
- export async function convertInWorker(job, signal) {
12
- await lock.lock();
13
- try {
14
- const worker = active ?? (active = spawn());
15
- const id = worker.nextId++;
16
- worker.link.ref();
17
- try {
18
- worker.link.write({ id, ...job });
19
- await settle(worker, id, signal);
20
- }
21
- finally {
22
- worker.link.unref();
23
- }
24
- }
25
- finally {
26
- lock.unlock();
27
- }
28
- }
29
- export function closeCollaboraWorker() {
30
- if (!active)
31
- return;
32
- active.link.kill();
33
- active = null;
34
- }
35
- async function settle(worker, id, signal) {
36
- const deadline = timeout(deadlineMs());
37
- const cancel = cancellation(signal);
38
- try {
39
- const landed = reply(worker, id).catch((error) => {
40
- abandon(worker);
41
- throw error;
42
- });
43
- const outcome = await Promise.race([landed, deadline.expired, cancel.cancelled]);
44
- if (typeof outcome === 'string') {
45
- abandon(worker);
46
- throw new Error(outcome === 'deadline' ? 'the document engine stopped responding' : 'conversion cancelled');
47
- }
48
- if (outcome.error) {
49
- throw new Error(outcome.error);
50
- }
51
- }
52
- finally {
53
- deadline.clear();
54
- cancel.clear();
55
- }
56
- }
57
- async function reply(worker, id) {
58
- const message = asWorkerReply(await worker.link.read());
59
- if (!message) {
60
- throw new Error('the document engine closed unexpectedly');
61
- }
62
- if (message.id !== id) {
63
- throw new Error('the document engine answered a different conversion');
64
- }
65
- return 'error' in message ? { error: message.error } : {};
66
- }
67
- function abandon(worker) {
68
- if (active === worker) {
69
- active = null;
70
- }
71
- worker.link.kill();
72
- }
73
- function spawn() {
74
- if (typeof Bare === 'undefined') {
75
- throw new Error('the document engine needs the Bare runtime');
76
- }
77
- let thread;
78
- try {
79
- thread = new Thread(entry());
80
- }
81
- catch (error) {
82
- throw new Error(`the document engine failed to load: ${errorMessage(error)}`);
83
- }
84
- const inbox = new Inbox(thread);
85
- thread.unref();
86
- return {
87
- nextId: 1,
88
- link: {
89
- read: () => inbox.read(),
90
- write: (job) => thread.postMessage(job),
91
- ref: () => thread.ref(),
92
- unref: () => thread.unref(),
93
- kill() {
94
- thread.unref();
95
- thread.terminate().catch(safetyCatch);
96
- }
97
- }
98
- };
99
- }
100
- class Inbox {
101
- replies = [];
102
- waiting = [];
103
- ended = false;
104
- failure = null;
105
- constructor(thread) {
106
- thread.on('message', (reply) => this.push(reply));
107
- thread.on('error', (error) => this.end(error));
108
- thread.on('exit', () => this.end());
109
- }
110
- read() {
111
- if (this.replies.length > 0) {
112
- return Promise.resolve(this.replies.shift());
113
- }
114
- if (this.failure) {
115
- return Promise.reject(this.failure);
116
- }
117
- if (this.ended) {
118
- return Promise.resolve(null);
119
- }
120
- return new Promise((resolve, reject) => this.waiting.push({ resolve, reject }));
121
- }
122
- push(reply) {
123
- const next = this.waiting.shift();
124
- if (next) {
125
- next.resolve(reply);
126
- }
127
- else {
128
- this.replies.push(reply);
129
- }
130
- }
131
- end(error) {
132
- if (this.ended) {
133
- return;
134
- }
135
- this.ended = true;
136
- if (error !== undefined) {
137
- this.failure = new Error(`the document engine closed unexpectedly: ${errorMessage(error)}`);
138
- }
139
- for (const next of this.waiting.splice(0)) {
140
- if (this.failure) {
141
- next.reject(this.failure);
142
- }
143
- else {
144
- next.resolve(null);
145
- }
146
- }
147
- }
148
- }
149
- function entry() {
150
- return (process.env.QVAC_COLLABORA_WORKER_ENTRY ||
151
- fileURLToPath(import.meta.resolve('#collabora-worker-entry')));
152
- }
153
- function deadlineMs() {
154
- const ms = Number(process.env.QVAC_COLLABORA_TIMEOUT_MS);
155
- return ms > 0 ? ms : DEADLINE_MS;
156
- }
157
- function timeout(ms) {
158
- let timer;
159
- const expired = new Promise((resolve) => {
160
- timer = setTimeout(() => resolve('deadline'), ms);
161
- });
162
- return { expired, clear: () => clearTimeout(timer) };
163
- }
164
- function cancellation(signal) {
165
- if (!signal) {
166
- return { cancelled: new Promise(() => { }), clear: () => { } };
167
- }
168
- if (signal.aborted) {
169
- return { cancelled: Promise.resolve('aborted'), clear: () => { } };
170
- }
171
- let onAbort = () => { };
172
- const cancelled = new Promise((resolve) => {
173
- onAbort = () => resolve('aborted');
174
- signal.addEventListener('abort', onAbort);
175
- });
176
- return { cancelled, clear: () => signal.removeEventListener('abort', onAbort) };
177
- }
@@ -1,2 +0,0 @@
1
- import type { RagFileExtractor } from 'rag-extract';
2
- export declare const extractOfficeText: RagFileExtractor;
@@ -1,8 +0,0 @@
1
- import { convertToText } from '../../../../collabora/convert.js';
2
- import { MAX_OFFICE_BYTES } from '../limits.js';
3
- export const extractOfficeText = (bytes, fileName, opts) => {
4
- if (bytes.byteLength > MAX_OFFICE_BYTES) {
5
- throw new Error(`document is too large to convert: ${bytes.byteLength} bytes, limit ${MAX_OFFICE_BYTES}`);
6
- }
7
- return convertToText({ bytes, fileName, to: 'md', signal: opts?.signal });
8
- };