@qvac/core 0.10.0 → 0.10.1
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,23 @@ release.
|
|
|
13
13
|
|
|
14
14
|
## [Unreleased]
|
|
15
15
|
|
|
16
|
+
## [0.10.1] - 2026-10-19
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- `QvacAssistant` takes `runIdleTimeoutMs`, how long a run's harness may send
|
|
21
|
+
nothing before the run fails. It defaults to 15 minutes. (#468)
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- `@qvac/harness` is now `^0.8.11` and `@qvac/skills` `^0.1.16`. (#468)
|
|
26
|
+
|
|
27
|
+
### Fixed
|
|
28
|
+
|
|
29
|
+
- A run whose harness goes silent fails with "the agent stopped responding"
|
|
30
|
+
instead of showing busy forever. A run parked on an approval does not count
|
|
31
|
+
as silent. (#468)
|
|
32
|
+
|
|
16
33
|
## [0.10.0] - 2026-10-16
|
|
17
34
|
|
|
18
35
|
### Added
|
|
@@ -1780,7 +1797,8 @@ Published under the `release-0.1` dist-tag.
|
|
|
1780
1797
|
await assistant.ready()
|
|
1781
1798
|
```
|
|
1782
1799
|
|
|
1783
|
-
[Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.10.
|
|
1800
|
+
[Unreleased]: https://github.com/tetherto/qvac-core/compare/v0.10.1...HEAD
|
|
1801
|
+
[0.10.1]: https://github.com/tetherto/qvac-core/compare/v0.10.0...v0.10.1
|
|
1784
1802
|
[0.10.0]: https://github.com/tetherto/qvac-core/compare/v0.9.0...v0.10.0
|
|
1785
1803
|
[0.9.0]: https://github.com/tetherto/qvac-core/compare/v0.8.0...v0.9.0
|
|
1786
1804
|
[0.8.0]: https://github.com/tetherto/qvac-core/compare/v0.7.6...v0.8.0
|
|
@@ -31,6 +31,7 @@ export interface AssistantOptions {
|
|
|
31
31
|
drives?: DriveHost;
|
|
32
32
|
borrowHarness?: (deviceId: string) => Duplex;
|
|
33
33
|
blobReadTimeoutMs?: number;
|
|
34
|
+
runIdleTimeoutMs?: number;
|
|
34
35
|
pdfRasterizer?: PdfRasterizer;
|
|
35
36
|
}
|
|
36
37
|
export interface SkillListOptions extends SkillOptions {
|
|
@@ -51,6 +52,7 @@ export declare class QvacAssistant extends ReadyResource {
|
|
|
51
52
|
private readonly _preloadCurrentAgentModel;
|
|
52
53
|
private readonly _drives?;
|
|
53
54
|
private readonly _blobReadTimeoutMs;
|
|
55
|
+
private readonly _runIdleTimeoutMs;
|
|
54
56
|
private readonly _pdfRasterizer;
|
|
55
57
|
private readonly _warmAbort;
|
|
56
58
|
private readonly _unloading;
|
|
@@ -99,7 +101,7 @@ export declare class QvacAssistant extends ReadyResource {
|
|
|
99
101
|
private readonly _modelCatalog;
|
|
100
102
|
private readonly _onHarnessStatus;
|
|
101
103
|
private readonly _onModelCatalogEvent;
|
|
102
|
-
constructor(engine: Capabilities, harness: Harness, { logger, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, downloadRetryMs, platform, preloadCurrentAgentModel, drives, borrowHarness, blobReadTimeoutMs, pdfRasterizer: pdfRasterizerOption }?: AssistantOptions);
|
|
104
|
+
constructor(engine: Capabilities, harness: Harness, { logger, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, downloadRetryMs, platform, preloadCurrentAgentModel, drives, borrowHarness, blobReadTimeoutMs, runIdleTimeoutMs, pdfRasterizer: pdfRasterizerOption }?: AssistantOptions);
|
|
103
105
|
private _requireDeviceId;
|
|
104
106
|
_open(): Promise<void>;
|
|
105
107
|
private _triggerModelWarm;
|
|
@@ -41,6 +41,7 @@ import { AbortedError, raceAbort } from '@qvac/harness/race-abort';
|
|
|
41
41
|
import { RunTranscript } from './run-transcript.js';
|
|
42
42
|
import { searchKnowledge } from './knowledge-search.js';
|
|
43
43
|
import { isLifecycleTeardown, knownAbortOutcome, RUN_ABORT_REASONS, RUN_FAILURE_REASONS, runFailureNotice } from './run-notices.js';
|
|
44
|
+
import { unref } from './unref.js';
|
|
44
45
|
import { encodeAgentSkillReadiness } from './skill-readiness.js';
|
|
45
46
|
import { harnessClearKvCache, harnessDeathReason, harnessDeleteModel, harnessDied, harnessListModels, harnessPreviewModelSource, harnessSkillCatalog, harnessSkillManagement, harnessDetectLanguage, harnessSpeak, harnessSpeakStream, harnessTools, harnessTranscribe, heldLoadModel, droppedHeldLoadModel, imageDownloadProgress, isHarnessEvent, modelCatalogChanged, toolReportEntry } from './assistant/harness.js';
|
|
46
47
|
import { annotateUnreadableImages, audioTranscriptBlock, backfillDocumentOnlyTurn, backfillImageOnlyTurns, silentAudioNotice, unheardAudioNotice, nameSenders } from './assistant/message.js';
|
|
@@ -57,6 +58,33 @@ const DEFAULT_PROFILE = 'mid';
|
|
|
57
58
|
const QvacState = local.getEnum('@local/qvac-state');
|
|
58
59
|
const FINAL_FLUSH_MS = 10_000;
|
|
59
60
|
const UPLOAD_FRAME_BYTES = 64 * 1024;
|
|
61
|
+
const RUN_IDLE_TIMEOUT_MS = 15 * 60_000;
|
|
62
|
+
function idleWatch(controller, ms) {
|
|
63
|
+
let last = 0;
|
|
64
|
+
let parked = 0;
|
|
65
|
+
const timer = setInterval(() => {
|
|
66
|
+
if (last && !parked && Date.now() - last >= ms) {
|
|
67
|
+
controller.abort(RUN_ABORT_REASONS.stalled);
|
|
68
|
+
}
|
|
69
|
+
}, Math.min(ms, 30_000));
|
|
70
|
+
unref(timer);
|
|
71
|
+
return {
|
|
72
|
+
touch: () => {
|
|
73
|
+
last = Date.now();
|
|
74
|
+
},
|
|
75
|
+
parks: (fn) => async (...args) => {
|
|
76
|
+
parked++;
|
|
77
|
+
try {
|
|
78
|
+
return await fn(...args);
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
parked--;
|
|
82
|
+
last = Date.now();
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
stop: () => clearInterval(timer)
|
|
86
|
+
};
|
|
87
|
+
}
|
|
60
88
|
function settledWithin(write, ms) {
|
|
61
89
|
let timer;
|
|
62
90
|
const expired = new Promise((resolve) => {
|
|
@@ -148,6 +176,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
148
176
|
_preloadCurrentAgentModel;
|
|
149
177
|
_drives;
|
|
150
178
|
_blobReadTimeoutMs;
|
|
179
|
+
_runIdleTimeoutMs;
|
|
151
180
|
_pdfRasterizer;
|
|
152
181
|
_warmAbort = new AbortController();
|
|
153
182
|
_unloading = new Map();
|
|
@@ -196,7 +225,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
196
225
|
_modelCatalog = new ModelCatalogRevisionHub();
|
|
197
226
|
_onHarnessStatus;
|
|
198
227
|
_onModelCatalogEvent;
|
|
199
|
-
constructor(engine, harness, { logger = null, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, downloadRetryMs, platform = os.platform(), preloadCurrentAgentModel = true, drives, borrowHarness, blobReadTimeoutMs = BLOB_READ_TIMEOUT_MS, pdfRasterizer: pdfRasterizerOption } = {}) {
|
|
228
|
+
constructor(engine, harness, { logger = null, imageCacheDir, inferenceCallsDir, runReplayDir, imageCacheMaxBytes, imageCacheMaxAgeMs, downloadRetryMs, platform = os.platform(), preloadCurrentAgentModel = true, drives, borrowHarness, blobReadTimeoutMs = BLOB_READ_TIMEOUT_MS, runIdleTimeoutMs = RUN_IDLE_TIMEOUT_MS, pdfRasterizer: pdfRasterizerOption } = {}) {
|
|
200
229
|
super();
|
|
201
230
|
this._engine = engine;
|
|
202
231
|
this._harness = harness;
|
|
@@ -211,6 +240,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
211
240
|
this._mobileClass = isMobilePlatform(platform);
|
|
212
241
|
this._preloadCurrentAgentModel = preloadCurrentAgentModel;
|
|
213
242
|
this._blobReadTimeoutMs = blobReadTimeoutMs;
|
|
243
|
+
this._runIdleTimeoutMs = runIdleTimeoutMs;
|
|
214
244
|
this._pdfRasterizer = pdfRasterizerOption ?? createPdfRasterizer(logger);
|
|
215
245
|
this._deviceId = null;
|
|
216
246
|
this._info = { toolNames: [], skills: [], supportsImages: false };
|
|
@@ -1729,6 +1759,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
1729
1759
|
agentId: agent.id,
|
|
1730
1760
|
hasRun: () => ran
|
|
1731
1761
|
});
|
|
1762
|
+
const idle = idleWatch(controller, this._runIdleTimeoutMs);
|
|
1732
1763
|
const modelWatch = this._watchModelProgress((runStatus) => transcript.progress(runStatusId, runStatus), busyChatId !== null);
|
|
1733
1764
|
let metrics;
|
|
1734
1765
|
const sourceTagFilter = createRagSourceTagFilter();
|
|
@@ -1889,6 +1920,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
1889
1920
|
const input = nameSenders(messages);
|
|
1890
1921
|
inputLength = input.length;
|
|
1891
1922
|
const inspecting = await this._capturingInferenceCalls();
|
|
1923
|
+
idle.touch();
|
|
1892
1924
|
const events = this._harnessFor(runAgent).completion({
|
|
1893
1925
|
model,
|
|
1894
1926
|
agent: runAgent,
|
|
@@ -1902,7 +1934,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
1902
1934
|
grantedDrives,
|
|
1903
1935
|
driveOp,
|
|
1904
1936
|
grantedWriteDirs: write,
|
|
1905
|
-
approve: approvals.approve,
|
|
1937
|
+
approve: idle.parks(approvals.approve),
|
|
1906
1938
|
attach: (input) => this._uploadGenerated(input, { meshId, chatId, runId, deviceId }),
|
|
1907
1939
|
fetchAttachment: (query) => this._fetchAttachment(engine, chatId, query),
|
|
1908
1940
|
ragSearch: async (input) => {
|
|
@@ -1939,7 +1971,10 @@ export class QvacAssistant extends ReadyResource {
|
|
|
1939
1971
|
hits
|
|
1940
1972
|
};
|
|
1941
1973
|
},
|
|
1942
|
-
progress: (update) =>
|
|
1974
|
+
progress: (update) => {
|
|
1975
|
+
idle.touch();
|
|
1976
|
+
modelWatch.image(update);
|
|
1977
|
+
},
|
|
1943
1978
|
generationParams: diagramRepair ? { reasoning_budget: 0 } : undefined,
|
|
1944
1979
|
captureInferenceCalls: true,
|
|
1945
1980
|
signal: controller.signal
|
|
@@ -1947,6 +1982,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
1947
1982
|
let harnessEvents = 0;
|
|
1948
1983
|
for await (const event of events) {
|
|
1949
1984
|
harnessEvents++;
|
|
1985
|
+
idle.touch();
|
|
1950
1986
|
modelWatch.clear();
|
|
1951
1987
|
if (isHarnessEvent(event, 'content') || isHarnessEvent(event, 'thinking')) {
|
|
1952
1988
|
await writeText(event.type, event.text);
|
|
@@ -2076,6 +2112,7 @@ export class QvacAssistant extends ReadyResource {
|
|
|
2076
2112
|
})
|
|
2077
2113
|
.catch((err) => this._log?.warn('assistant', 'run outcome not recorded', { err }));
|
|
2078
2114
|
transcript.close();
|
|
2115
|
+
idle.stop();
|
|
2079
2116
|
modelWatch.stop();
|
|
2080
2117
|
ownershipWatch.stop();
|
|
2081
2118
|
await approvals.settle({ preservePending: isLifecycleTeardown(controller.signal.reason) });
|
|
@@ -5,12 +5,14 @@ export declare const RUN_ABORT_REASONS: {
|
|
|
5
5
|
readonly runnerDied: 'runner-died';
|
|
6
6
|
readonly runnerClosed: 'runner-closed';
|
|
7
7
|
readonly modelUnloaded: 'model-unloaded';
|
|
8
|
+
readonly stalled: 'stalled';
|
|
8
9
|
};
|
|
9
10
|
export type RunAbortReason = (typeof RUN_ABORT_REASONS)[keyof typeof RUN_ABORT_REASONS];
|
|
10
11
|
export declare const RUN_FAILURE_REASONS: {
|
|
11
12
|
readonly harnessDied: 'the model runtime died';
|
|
12
13
|
readonly runtimeEndedTurn: 'the model runtime ended this turn';
|
|
13
14
|
readonly capabilityUnavailable: 'this device cannot run a capability without a model';
|
|
15
|
+
readonly stalled: 'the agent stopped responding';
|
|
14
16
|
};
|
|
15
17
|
export type AbortOutcome = {
|
|
16
18
|
readonly kind: 'replay';
|
|
@@ -4,12 +4,14 @@ export const RUN_ABORT_REASONS = {
|
|
|
4
4
|
runSettled: 'run-settled',
|
|
5
5
|
runnerDied: 'runner-died',
|
|
6
6
|
runnerClosed: 'runner-closed',
|
|
7
|
-
modelUnloaded: 'model-unloaded'
|
|
7
|
+
modelUnloaded: 'model-unloaded',
|
|
8
|
+
stalled: 'stalled'
|
|
8
9
|
};
|
|
9
10
|
export const RUN_FAILURE_REASONS = {
|
|
10
11
|
harnessDied: 'the model runtime died',
|
|
11
12
|
runtimeEndedTurn: 'the model runtime ended this turn',
|
|
12
|
-
capabilityUnavailable: 'this device cannot run a capability without a model'
|
|
13
|
+
capabilityUnavailable: 'this device cannot run a capability without a model',
|
|
14
|
+
stalled: 'the agent stopped responding'
|
|
13
15
|
};
|
|
14
16
|
export function knownAbortOutcome(reason) {
|
|
15
17
|
if (reason === RUN_ABORT_REASONS.suspended ||
|
|
@@ -23,6 +25,9 @@ export function knownAbortOutcome(reason) {
|
|
|
23
25
|
if (reason === RUN_ABORT_REASONS.runnerDied) {
|
|
24
26
|
return { kind: 'failed', reason: RUN_FAILURE_REASONS.harnessDied };
|
|
25
27
|
}
|
|
28
|
+
if (reason === RUN_ABORT_REASONS.stalled) {
|
|
29
|
+
return { kind: 'failed', reason: RUN_FAILURE_REASONS.stalled };
|
|
30
|
+
}
|
|
26
31
|
return null;
|
|
27
32
|
}
|
|
28
33
|
export function isLifecycleTeardown(reason) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qvac/core",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Peer-to-peer AI across your devices",
|
|
6
6
|
"engines": {
|
|
@@ -240,9 +240,9 @@
|
|
|
240
240
|
},
|
|
241
241
|
"dependencies": {
|
|
242
242
|
"@qvac/error": "^0.2.0",
|
|
243
|
-
"@qvac/harness": "^0.8.
|
|
243
|
+
"@qvac/harness": "^0.8.11",
|
|
244
244
|
"@qvac/logging": "^0.2.0",
|
|
245
|
-
"@qvac/skills": "0.1.
|
|
245
|
+
"@qvac/skills": "^0.1.16",
|
|
246
246
|
"asenion": "^0.1.0",
|
|
247
247
|
"autobee": "^2.11.8",
|
|
248
248
|
"b4a": "^1.9.0",
|