@qvac/harness 1.0.0 → 1.1.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 +137 -1
- package/README.md +28 -0
- package/dist-lib/index.d.ts +32 -304
- package/dist-lib/index.js +16 -1147
- package/dist-lib/lib/agent/child-run.d.ts +29 -0
- package/dist-lib/lib/agent/child-run.js +32 -0
- package/dist-lib/lib/agent/delegate.d.ts +3 -19
- package/dist-lib/lib/agent/delegate.js +8 -31
- package/dist-lib/lib/agent/index.d.ts +4 -0
- package/dist-lib/lib/agent/index.js +3 -0
- package/dist-lib/lib/agent/read-parts.d.ts +45 -0
- package/dist-lib/lib/agent/read-parts.js +60 -0
- package/dist-lib/lib/capabilities/completion-engine/driver.js +6 -2
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/engine.js +27 -18
- package/dist-lib/lib/capabilities/completion-engine/round.js +5 -4
- package/dist-lib/lib/client/index.js +1 -3
- package/dist-lib/lib/connect/decode.d.ts +3 -2
- package/dist-lib/lib/connect/decode.js +14 -0
- package/dist-lib/lib/connect.d.ts +1 -0
- package/dist-lib/lib/connect.js +11 -5
- package/dist-lib/lib/context-window.d.ts +2 -0
- package/dist-lib/lib/context-window.js +17 -14
- package/dist-lib/lib/contract/models.d.ts +8 -1
- package/dist-lib/lib/contract-types.d.ts +9 -0
- package/dist-lib/lib/harness.d.ts +267 -0
- package/dist-lib/lib/harness.js +1154 -0
- package/dist-lib/lib/models/custom-model-cache.d.ts +2 -0
- package/dist-lib/lib/models/custom-model-cache.js +21 -0
- package/dist-lib/lib/models/memory-cap.d.ts +6 -0
- package/dist-lib/lib/models/memory-cap.js +20 -0
- package/dist-lib/lib/models/model-catalog.d.ts +2 -0
- package/dist-lib/lib/models/model-catalog.js +8 -2
- package/dist-lib/lib/models/model-fit.d.ts +39 -7
- package/dist-lib/lib/models/model-fit.js +133 -18
- package/dist-lib/lib/models/model-handle.d.ts +2 -1
- package/dist-lib/lib/models/model-pool.d.ts +3 -2
- package/dist-lib/lib/models/model-pool.js +30 -13
- package/dist-lib/lib/models/tts-model-default.d.ts +1 -1
- package/dist-lib/lib/models/tts-model-default.js +7 -6
- package/dist-lib/lib/residency/index.d.ts +21 -7
- package/dist-lib/lib/residency/index.js +187 -80
- package/dist-lib/lib/run-log/boundary.d.ts +4 -1
- package/dist-lib/lib/run-log/boundary.js +2 -1
- package/dist-lib/lib/run-log/index.d.ts +2 -1
- package/dist-lib/lib/run-log/index.js +2 -1
- package/dist-lib/lib/run-log/persisted-actor.d.ts +10 -0
- package/dist-lib/lib/run-log/persisted-actor.js +15 -0
- package/dist-lib/lib/run-log/run-journal.d.ts +3 -0
- package/dist-lib/lib/run-log/run-journal.js +19 -8
- package/dist-lib/lib/serve/requests.d.ts +3 -0
- package/dist-lib/lib/serve.js +3 -0
- package/dist-lib/lib/spawn.d.ts +4 -1
- package/dist-lib/lib/tools/exec/shell-guidance.d.ts +2 -0
- package/dist-lib/lib/tools/exec/shell-guidance.js +29 -0
- package/dist-lib/lib/tools/exec.js +2 -1
- package/dist-lib/lib/tools/files/list-dir.js +79 -32
- package/dist-lib/lib/tools/fs/walk.d.ts +11 -1
- package/dist-lib/lib/tools/fs/walk.js +64 -30
- package/dist-lib/lib/tools/http-request.js +5 -0
- package/dist-lib/lib/tools/office.js +8 -5
- package/dist-lib/lib/tools/pdf/pages.d.ts +1 -1
- package/dist-lib/lib/tools/pdf/pages.js +3 -14
- package/dist-lib/lib/tools/pdf/recognize.d.ts +3 -0
- package/dist-lib/lib/tools/pdf/recognize.js +45 -7
- package/dist-lib/lib/tools/tls-failure.d.ts +1 -0
- package/dist-lib/lib/tools/tls-failure.js +8 -0
- package/dist-lib/lib/tools/web-fetch.js +5 -0
- package/dist-lib/plugins/image/generate-image.d.ts +2 -2
- package/dist-lib/plugins/image/generate-image.js +9 -1
- package/dist-lib/plugins/image/index.js +6 -2
- package/dist-lib/plugins/knowledge/chunk-index.d.ts +4 -0
- package/dist-lib/plugins/knowledge/chunk-index.js +191 -0
- package/dist-lib/plugins/knowledge/index.d.ts +1 -0
- package/dist-lib/plugins/knowledge/index.js +1 -0
- package/dist-lib/plugins/knowledge/manifest.d.ts +2 -1
- package/dist-lib/plugins/knowledge/manifest.js +2 -9
- package/dist-lib/plugins/knowledge/store.d.ts +5 -1
- package/dist-lib/plugins/knowledge/store.js +44 -16
- package/dist-lib/plugins/lsp/rpc.d.ts +9 -1
- package/dist-lib/plugins/lsp/rpc.js +81 -17
- package/dist-lib/plugins/music/generate-music.d.ts +2 -2
- package/dist-lib/plugins/music/generate-music.js +14 -1
- package/dist-lib/plugins/music/index.js +4 -1
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/speech/speech-engine.d.ts +5 -2
- package/dist-lib/plugins/speech/speech-engine.js +28 -7
- package/dist-lib/schema/harness.js +28 -2
- package/dist-lib/spec/bind.js +3 -0
- package/dist-lib/spec/calls.js +1 -0
- package/dist-lib/spec/hrpc/hrpc.json +13 -0
- package/dist-lib/spec/hrpc/index.js +15 -3
- package/dist-lib/spec/hrpc/messages.js +87 -6
- package/dist-lib/spec/hyperschema/index.js +87 -6
- package/dist-lib/spec/hyperschema/schema.json +70 -2
- package/dist-lib/spec/hyperschema/types.d.ts +21 -1
- package/package.json +29 -28
- package/scripts/addon-externals.cjs +1 -0
- package/worker/harness-sidecar.mjs +12 -1
|
@@ -1,38 +1,102 @@
|
|
|
1
1
|
import b4a from 'b4a';
|
|
2
2
|
import { isRecord } from '../../lib/guards.js';
|
|
3
3
|
const HEADER_END = b4a.from('\r\n\r\n');
|
|
4
|
+
const HEADER_END_BYTES = [13, 10, 13, 10];
|
|
4
5
|
const CONTENT_LENGTH = /^content-length:\s*(\d+)\s*$/im;
|
|
5
6
|
export function encodeMessage(message) {
|
|
6
7
|
const body = JSON.stringify({ jsonrpc: '2.0', ...message });
|
|
7
8
|
return b4a.from(`Content-Length: ${b4a.byteLength(body)}\r\n\r\n${body}`);
|
|
8
9
|
}
|
|
9
10
|
export class FrameDecoder {
|
|
10
|
-
|
|
11
|
+
_header = [];
|
|
12
|
+
_headerBytes = 0;
|
|
13
|
+
_headerEnd = 0;
|
|
14
|
+
_bodyLength = null;
|
|
15
|
+
_body = [];
|
|
16
|
+
_bodyBytes = 0;
|
|
11
17
|
push(chunk) {
|
|
12
|
-
this._buffer = this._buffer.byteLength ? b4a.concat([this._buffer, chunk]) : chunk;
|
|
13
18
|
const messages = [];
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (
|
|
17
|
-
|
|
19
|
+
let at = 0;
|
|
20
|
+
while (at < chunk.byteLength || this._bodyLength === 0) {
|
|
21
|
+
if (this._bodyLength === null) {
|
|
22
|
+
const next = this._readHeader(chunk, at);
|
|
23
|
+
if (next === null) {
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
at = next;
|
|
27
|
+
continue;
|
|
18
28
|
}
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
29
|
+
const frame = this._readBody(chunk, at);
|
|
30
|
+
at = frame.at;
|
|
31
|
+
if (frame.message) {
|
|
32
|
+
messages.push(frame.message);
|
|
22
33
|
}
|
|
23
|
-
|
|
24
|
-
const stop = start + Number(length[1]);
|
|
25
|
-
if (this._buffer.byteLength < stop) {
|
|
34
|
+
if (!frame.complete) {
|
|
26
35
|
break;
|
|
27
36
|
}
|
|
28
|
-
const message = JSON.parse(b4a.toString(this._buffer, 'utf8', start, stop));
|
|
29
|
-
if (isRecord(message)) {
|
|
30
|
-
messages.push(toMessage(message));
|
|
31
|
-
}
|
|
32
|
-
this._buffer = this._buffer.subarray(stop);
|
|
33
37
|
}
|
|
34
38
|
return messages;
|
|
35
39
|
}
|
|
40
|
+
_readHeader(chunk, from) {
|
|
41
|
+
let at = from;
|
|
42
|
+
let ended = false;
|
|
43
|
+
while (at < chunk.byteLength) {
|
|
44
|
+
const byte = chunk[at++];
|
|
45
|
+
if (byte === HEADER_END_BYTES[this._headerEnd]) {
|
|
46
|
+
this._headerEnd++;
|
|
47
|
+
if (this._headerEnd === HEADER_END_BYTES.length) {
|
|
48
|
+
ended = true;
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
this._headerEnd = byte === HEADER_END_BYTES[0] ? 1 : 0;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
const part = chunk.subarray(from, at);
|
|
57
|
+
if (part.byteLength > 0) {
|
|
58
|
+
this._header.push(part);
|
|
59
|
+
this._headerBytes += part.byteLength;
|
|
60
|
+
}
|
|
61
|
+
if (!ended) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
this._startBody();
|
|
65
|
+
return at;
|
|
66
|
+
}
|
|
67
|
+
_startBody() {
|
|
68
|
+
const header = this._header.length > 1 ? b4a.concat(this._header) : this._header[0];
|
|
69
|
+
const length = CONTENT_LENGTH.exec(b4a.toString(header, 'ascii', 0, this._headerBytes - HEADER_END.byteLength));
|
|
70
|
+
if (!length) {
|
|
71
|
+
throw new Error('language server sent a frame with no Content-Length');
|
|
72
|
+
}
|
|
73
|
+
this._bodyLength = Number(length[1]);
|
|
74
|
+
this._header = [];
|
|
75
|
+
this._headerBytes = 0;
|
|
76
|
+
this._headerEnd = 0;
|
|
77
|
+
}
|
|
78
|
+
_readBody(chunk, from) {
|
|
79
|
+
const expected = this._bodyLength;
|
|
80
|
+
if (expected === null) {
|
|
81
|
+
return { at: from, complete: false };
|
|
82
|
+
}
|
|
83
|
+
const length = Math.min(expected - this._bodyBytes, chunk.byteLength - from);
|
|
84
|
+
const part = chunk.subarray(from, from + length);
|
|
85
|
+
if (part.byteLength > 0) {
|
|
86
|
+
this._body.push(part);
|
|
87
|
+
this._bodyBytes += part.byteLength;
|
|
88
|
+
}
|
|
89
|
+
if (this._bodyBytes < expected) {
|
|
90
|
+
return { at: from + part.byteLength, complete: false };
|
|
91
|
+
}
|
|
92
|
+
const bytes = this._body.length > 1 ? b4a.concat(this._body) : (this._body[0] ?? b4a.alloc(0));
|
|
93
|
+
const value = JSON.parse(b4a.toString(bytes, 'utf8'));
|
|
94
|
+
const message = isRecord(value) ? toMessage(value) : undefined;
|
|
95
|
+
this._bodyLength = null;
|
|
96
|
+
this._body = [];
|
|
97
|
+
this._bodyBytes = 0;
|
|
98
|
+
return { at: from + part.byteLength, complete: true, message };
|
|
99
|
+
}
|
|
36
100
|
}
|
|
37
101
|
function toMessage(value) {
|
|
38
102
|
const { id, method, params, result, error } = value;
|
|
@@ -2,7 +2,7 @@ import { type AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
|
2
2
|
import type { MediaRoundServer, MusicSettings, ToolDefinition, ToolExecuteContext } from '../../lib/contract/index.ts';
|
|
3
3
|
import type { ModelSrc } from '../../lib/models/context.ts';
|
|
4
4
|
import { type MusicClamps, type MusicModelStages } from '../../lib/models/model-catalog.ts';
|
|
5
|
-
import type { LoadRequests, ModelHost, TrackedLoad } from '../../lib/contract/models.ts';
|
|
5
|
+
import type { LoadRequests, ModelHost, ReleaseRoom, TrackedLoad } from '../../lib/contract/models.ts';
|
|
6
6
|
import type { HoldFn } from '../../lib/contract/models.ts';
|
|
7
7
|
import { type ModelRegistrySdk } from '../../lib/models/model-source.ts';
|
|
8
8
|
export declare const MAX_DURATION_SECONDS = 300;
|
|
@@ -71,7 +71,7 @@ export interface MusicRuntimeOptions extends MusicModelStages {
|
|
|
71
71
|
inferenceSteps?: number;
|
|
72
72
|
useGpu?: boolean;
|
|
73
73
|
onProgress?: (model: string, progress: Record<string, unknown>) => void;
|
|
74
|
-
onBeforeLoad?: (signal: BareAbortSignal | undefined, srcs: ReadonlyArray<string>) => Promise<
|
|
74
|
+
onBeforeLoad?: (signal: BareAbortSignal | undefined, srcs: ReadonlyArray<string>) => Promise<ReleaseRoom>;
|
|
75
75
|
hold?: HoldFn;
|
|
76
76
|
requests?: LoadRequests;
|
|
77
77
|
loads?: Pick<ModelHost, 'track'>;
|
|
@@ -61,6 +61,11 @@ export function createMusicRuntime({ loadSdk, onProgress, onBeforeLoad, hold, re
|
|
|
61
61
|
let loading = null;
|
|
62
62
|
let residentFingerprint = null;
|
|
63
63
|
let busy = false;
|
|
64
|
+
let releaseRoom = noop;
|
|
65
|
+
const freeRoom = () => {
|
|
66
|
+
releaseRoom();
|
|
67
|
+
releaseRoom = noop;
|
|
68
|
+
};
|
|
64
69
|
const lock = new ScopeLock();
|
|
65
70
|
const defaultSteps = baseSteps ?? musicDefaultSteps(musicChoiceForDit(base.dit));
|
|
66
71
|
const doUnload = async () => {
|
|
@@ -73,12 +78,14 @@ export function createMusicRuntime({ loadSdk, onProgress, onBeforeLoad, hold, re
|
|
|
73
78
|
if (!loaded) {
|
|
74
79
|
loading = null;
|
|
75
80
|
residentFingerprint = null;
|
|
81
|
+
freeRoom();
|
|
76
82
|
return;
|
|
77
83
|
}
|
|
78
84
|
const sdk = await loadSdk();
|
|
79
85
|
await sdk.unloadModel({ modelId: loaded.modelId });
|
|
80
86
|
loading = null;
|
|
81
87
|
residentFingerprint = null;
|
|
88
|
+
freeRoom();
|
|
82
89
|
};
|
|
83
90
|
const unload = async () => {
|
|
84
91
|
await lock.lock();
|
|
@@ -118,6 +125,7 @@ export function createMusicRuntime({ loadSdk, onProgress, onBeforeLoad, hold, re
|
|
|
118
125
|
})().catch((err) => {
|
|
119
126
|
loading = null;
|
|
120
127
|
residentFingerprint = null;
|
|
128
|
+
freeRoom();
|
|
121
129
|
requests.failed(name, err);
|
|
122
130
|
throw err;
|
|
123
131
|
});
|
|
@@ -130,7 +138,12 @@ export function createMusicRuntime({ loadSdk, onProgress, onBeforeLoad, hold, re
|
|
|
130
138
|
await doUnload();
|
|
131
139
|
}
|
|
132
140
|
if (!loading && onBeforeLoad) {
|
|
133
|
-
await onBeforeLoad(signal, [
|
|
141
|
+
releaseRoom = await onBeforeLoad(signal, [
|
|
142
|
+
stages.dit,
|
|
143
|
+
stages.textEnc,
|
|
144
|
+
stages.lm,
|
|
145
|
+
stages.vae
|
|
146
|
+
]);
|
|
134
147
|
}
|
|
135
148
|
residentFingerprint = fingerprint;
|
|
136
149
|
loading ??= loadStages(sdk, stages, steps);
|
|
@@ -46,7 +46,10 @@ export class Music {
|
|
|
46
46
|
hold: models.hold,
|
|
47
47
|
requests: models.requests,
|
|
48
48
|
onProgress: (name, progress) => models.emit(models.progressState(name, progress)),
|
|
49
|
-
onBeforeLoad: (signal, srcs) => models.makeRoom(signal, new HarnessError('CHAT_MODEL_BUSY', ['music']),
|
|
49
|
+
onBeforeLoad: (signal, srcs) => models.makeRoom(signal, new HarnessError('CHAT_MODEL_BUSY', ['music']), {
|
|
50
|
+
srcs,
|
|
51
|
+
unloadIdle: () => runtime.unloadIdle()
|
|
52
|
+
})
|
|
50
53
|
});
|
|
51
54
|
return {
|
|
52
55
|
tools: [createGenerateMusicTool(runtime, clamps)],
|
|
Binary file
|
|
Binary file
|
|
@@ -11,13 +11,16 @@ export interface SpeechDialogue {
|
|
|
11
11
|
export interface SpeechOptions {
|
|
12
12
|
tts?: TtsEngine;
|
|
13
13
|
voice?: string;
|
|
14
|
+
voiceTranscript?: string;
|
|
14
15
|
dialogue?: SpeechDialogue;
|
|
15
16
|
}
|
|
16
17
|
type ModelSrc = Parameters<typeof categoryModelConfig>[0];
|
|
17
|
-
export declare
|
|
18
|
+
export declare const AUDIO8_NEEDS_VOICE = "Audio8 has no voice of its own: tts: 'audio8' needs voice, a recording to clone, and voiceTranscript, what it says word for word";
|
|
19
|
+
export declare function invalidOptions({ tts, voice, voiceTranscript, dialogue }: SpeechOptions): string | null;
|
|
18
20
|
export declare function defaultTts({ tts, dialogue }: SpeechOptions, profile: CapabilityProfile | null): string;
|
|
21
|
+
export declare function hasAudio8Voice({ voice, voiceTranscript }: SpeechOptions): boolean;
|
|
19
22
|
export declare function isDialogue({ dialogue }: SpeechOptions, src: string): boolean;
|
|
20
23
|
export declare function engineOf(options: SpeechOptions, src: string): TtsEngine;
|
|
21
24
|
export declare function dialogueScript({ dialogue }: SpeechOptions, text: string): string;
|
|
22
|
-
export declare function loadConfig({ voice, dialogue }: SpeechOptions, modelSrc: ModelSrc): Readonly<Record<string, unknown>>;
|
|
25
|
+
export declare function loadConfig({ voice, voiceTranscript, dialogue }: SpeechOptions, modelSrc: ModelSrc): Readonly<Record<string, unknown>>;
|
|
23
26
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AUDIO8_TTS, categoryModelConfig, MOSS_CODEC_ENCODER_SRC, MOSS_TTS, supertonicFor } from '../../lib/models/model-catalog.js';
|
|
1
|
+
import { AUDIO8_CODEC_ENCODER_SRC, AUDIO8_TTS, categoryModelConfig, MOSS_CODEC_ENCODER_SRC, MOSS_TTS, supertonicFor } from '../../lib/models/model-catalog.js';
|
|
2
2
|
const SUPERTONIC_CONFIG = {
|
|
3
3
|
ttsEngine: 'supertonic',
|
|
4
4
|
language: 'en',
|
|
@@ -6,12 +6,22 @@ const SUPERTONIC_CONFIG = {
|
|
|
6
6
|
ttsNumInferenceSteps: 5
|
|
7
7
|
};
|
|
8
8
|
const MAX_SPEAKERS = 5;
|
|
9
|
-
export
|
|
9
|
+
export const AUDIO8_NEEDS_VOICE = "Audio8 has no voice of its own: tts: 'audio8' needs voice, a recording to clone, and voiceTranscript, what it says word for word";
|
|
10
|
+
export function invalidOptions({ tts, voice, voiceTranscript, dialogue }) {
|
|
10
11
|
if (voice && dialogue) {
|
|
11
12
|
return 'a cloned voice and a dialogue are exclusive: give each speaker a recording instead';
|
|
12
13
|
}
|
|
13
|
-
if (
|
|
14
|
-
return
|
|
14
|
+
if (tts === 'audio8' && !hasAudio8Voice({ voice, voiceTranscript })) {
|
|
15
|
+
return AUDIO8_NEEDS_VOICE;
|
|
16
|
+
}
|
|
17
|
+
if (voice && tts !== 'moss' && tts !== 'audio8') {
|
|
18
|
+
return "a cloned voice needs tts: 'moss' or 'audio8'";
|
|
19
|
+
}
|
|
20
|
+
if (voiceTranscript && tts !== 'audio8') {
|
|
21
|
+
return "voiceTranscript is for tts: 'audio8': MOSS clones from the recording alone";
|
|
22
|
+
}
|
|
23
|
+
if (dialogue && tts !== 'moss') {
|
|
24
|
+
return "a dialogue needs tts: 'moss'";
|
|
15
25
|
}
|
|
16
26
|
if (dialogue && (dialogue.speakers.length < 1 || dialogue.speakers.length > MAX_SPEAKERS)) {
|
|
17
27
|
return `a dialogue takes 1 to ${MAX_SPEAKERS} speakers`;
|
|
@@ -22,7 +32,10 @@ export function defaultTts({ tts, dialogue }, profile) {
|
|
|
22
32
|
if (tts === 'moss') {
|
|
23
33
|
return dialogue ? dialogue.backbone : MOSS_TTS.asset.src;
|
|
24
34
|
}
|
|
25
|
-
return tts === '
|
|
35
|
+
return tts === 'audio8' ? AUDIO8_TTS.asset.src : supertonicFor(profile).asset.src;
|
|
36
|
+
}
|
|
37
|
+
export function hasAudio8Voice({ voice, voiceTranscript }) {
|
|
38
|
+
return Boolean(voice && voiceTranscript?.trim());
|
|
26
39
|
}
|
|
27
40
|
export function isDialogue({ dialogue }, src) {
|
|
28
41
|
return dialogue !== undefined && src === dialogue.backbone;
|
|
@@ -38,7 +51,7 @@ export function dialogueScript({ dialogue }, text) {
|
|
|
38
51
|
const references = (dialogue?.speakers ?? []).map((speaker, index) => `[S${index + 1}] ${speaker.transcript}`);
|
|
39
52
|
return [...references, text].join(' ');
|
|
40
53
|
}
|
|
41
|
-
export function loadConfig({ voice, dialogue }, modelSrc) {
|
|
54
|
+
export function loadConfig({ voice, voiceTranscript, dialogue }, modelSrc) {
|
|
42
55
|
const src = typeof modelSrc === 'string' ? modelSrc : modelSrc.src;
|
|
43
56
|
if (dialogue && src === dialogue.backbone) {
|
|
44
57
|
return {
|
|
@@ -49,7 +62,15 @@ export function loadConfig({ voice, dialogue }, modelSrc) {
|
|
|
49
62
|
}
|
|
50
63
|
const tuned = categoryModelConfig(modelSrc);
|
|
51
64
|
if (tuned?.['ttsEngine'] === 'audio8') {
|
|
52
|
-
|
|
65
|
+
if (!hasAudio8Voice({ voice, voiceTranscript })) {
|
|
66
|
+
throw new Error(AUDIO8_NEEDS_VOICE);
|
|
67
|
+
}
|
|
68
|
+
return {
|
|
69
|
+
...tuned,
|
|
70
|
+
audio8CodecEncoderModelSrc: AUDIO8_CODEC_ENCODER_SRC,
|
|
71
|
+
referenceAudioSrc: voice,
|
|
72
|
+
referenceText: voiceTranscript?.trim()
|
|
73
|
+
};
|
|
53
74
|
}
|
|
54
75
|
if (tuned?.['ttsEngine'] !== 'moss') {
|
|
55
76
|
return { ...SUPERTONIC_CONFIG, ...tuned };
|
|
@@ -548,7 +548,8 @@ export function registerHarnessTypes(ns) {
|
|
|
548
548
|
{ name: 'mobile', type: 'bool' },
|
|
549
549
|
{ name: 'completionRecovery', type: 'bool' },
|
|
550
550
|
{ name: 'hostRunLog', type: 'bool' },
|
|
551
|
-
{ name: 'hostRunLogVersion', type: 'uint' }
|
|
551
|
+
{ name: 'hostRunLogVersion', type: 'uint' },
|
|
552
|
+
{ name: 'mobileMemoryCap', type: 'bool' }
|
|
552
553
|
]
|
|
553
554
|
});
|
|
554
555
|
ns.register({
|
|
@@ -838,9 +839,21 @@ export function registerHarnessTypes(ns) {
|
|
|
838
839
|
name: 'set-model-memory-cap-request',
|
|
839
840
|
fields: [{ name: 'percent', type: 'uint', required: true }]
|
|
840
841
|
});
|
|
842
|
+
ns.register({
|
|
843
|
+
name: 'memory-pool-usage',
|
|
844
|
+
fields: [
|
|
845
|
+
{ name: 'id', type: 'string', required: true },
|
|
846
|
+
{ name: 'usedBytes', type: 'uint', required: true },
|
|
847
|
+
{ name: 'capBytes', type: 'uint' },
|
|
848
|
+
{ name: 'totalBytes', type: 'uint' }
|
|
849
|
+
]
|
|
850
|
+
});
|
|
841
851
|
ns.register({
|
|
842
852
|
name: 'memory-usage',
|
|
843
|
-
fields: [
|
|
853
|
+
fields: [
|
|
854
|
+
{ name: 'usedBytes', type: 'uint', required: true },
|
|
855
|
+
{ name: 'pools', type: '@harness/memory-pool-usage', array: true }
|
|
856
|
+
]
|
|
844
857
|
});
|
|
845
858
|
ns.register({
|
|
846
859
|
name: 'set-downloads-allowed-request',
|
|
@@ -946,6 +959,14 @@ export function registerHarnessTypes(ns) {
|
|
|
946
959
|
{ name: 'coverage', type: 'float64' }
|
|
947
960
|
]
|
|
948
961
|
});
|
|
962
|
+
ns.register({
|
|
963
|
+
name: 'embedding-weights-request',
|
|
964
|
+
fields: [{ name: 'model', type: 'string', required: true }]
|
|
965
|
+
});
|
|
966
|
+
ns.register({
|
|
967
|
+
name: 'embedding-weights-response',
|
|
968
|
+
fields: [{ name: 'weights', type: 'string' }]
|
|
969
|
+
});
|
|
949
970
|
}
|
|
950
971
|
export function registerHarnessApi(api) {
|
|
951
972
|
api.register({
|
|
@@ -1153,4 +1174,9 @@ export function registerHarnessApi(api) {
|
|
|
1153
1174
|
request: { name: '@harness/ocr-read-request', stream: false },
|
|
1154
1175
|
response: { name: '@harness/ocr-read-response', stream: false }
|
|
1155
1176
|
});
|
|
1177
|
+
api.register({
|
|
1178
|
+
name: 'embedding-weights',
|
|
1179
|
+
request: { name: '@harness/embedding-weights-request', stream: false },
|
|
1180
|
+
response: { name: '@harness/embedding-weights-response', stream: false }
|
|
1181
|
+
});
|
|
1156
1182
|
}
|
package/dist-lib/spec/bind.js
CHANGED
package/dist-lib/spec/calls.js
CHANGED
|
@@ -51,5 +51,6 @@ export function harnessClient(rpc) {
|
|
|
51
51
|
knowledgeSearch: (input) => rpc.knowledgeSearch(input),
|
|
52
52
|
knowledgeStatus: (input) => rpc.knowledgeStatus(input),
|
|
53
53
|
ocrRead: (input) => rpc.ocrRead(input),
|
|
54
|
+
embeddingWeights: (input) => rpc.embeddingWeights(input),
|
|
54
55
|
};
|
|
55
56
|
}
|
|
@@ -533,6 +533,19 @@
|
|
|
533
533
|
"stream": false
|
|
534
534
|
},
|
|
535
535
|
"version": 1
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
"id": 41,
|
|
539
|
+
"name": "@harness/embedding-weights",
|
|
540
|
+
"request": {
|
|
541
|
+
"name": "@harness/embedding-weights-request",
|
|
542
|
+
"stream": false
|
|
543
|
+
},
|
|
544
|
+
"response": {
|
|
545
|
+
"name": "@harness/embedding-weights-response",
|
|
546
|
+
"stream": false
|
|
547
|
+
},
|
|
548
|
+
"version": 1
|
|
536
549
|
}
|
|
537
550
|
]
|
|
538
551
|
}
|
|
@@ -87,7 +87,9 @@ const methods = new Map([
|
|
|
87
87
|
['@harness/knowledge-status', 39],
|
|
88
88
|
[39, '@harness/knowledge-status'],
|
|
89
89
|
['@harness/ocr-read', 40],
|
|
90
|
-
[40, '@harness/ocr-read']
|
|
90
|
+
[40, '@harness/ocr-read'],
|
|
91
|
+
['@harness/embedding-weights', 41],
|
|
92
|
+
[41, '@harness/embedding-weights']
|
|
91
93
|
])
|
|
92
94
|
|
|
93
95
|
class HRPC {
|
|
@@ -135,7 +137,8 @@ class HRPC {
|
|
|
135
137
|
['@harness/knowledge-remove', getEncoding('@harness/knowledge-remove-request')],
|
|
136
138
|
['@harness/knowledge-search', getEncoding('@harness/knowledge-search-request')],
|
|
137
139
|
['@harness/knowledge-status', getEncoding('@harness/empty')],
|
|
138
|
-
['@harness/ocr-read', getEncoding('@harness/ocr-read-request')]
|
|
140
|
+
['@harness/ocr-read', getEncoding('@harness/ocr-read-request')],
|
|
141
|
+
['@harness/embedding-weights', getEncoding('@harness/embedding-weights-request')]
|
|
139
142
|
])
|
|
140
143
|
this._responseEncodings = new Map([
|
|
141
144
|
['@harness/completion', getEncoding('@harness/completion-event')],
|
|
@@ -178,7 +181,8 @@ class HRPC {
|
|
|
178
181
|
['@harness/knowledge-remove', getEncoding('@harness/knowledge-remove-response')],
|
|
179
182
|
['@harness/knowledge-search', getEncoding('@harness/knowledge-search-response')],
|
|
180
183
|
['@harness/knowledge-status', getEncoding('@harness/knowledge-status-response')],
|
|
181
|
-
['@harness/ocr-read', getEncoding('@harness/ocr-read-response')]
|
|
184
|
+
['@harness/ocr-read', getEncoding('@harness/ocr-read-response')],
|
|
185
|
+
['@harness/embedding-weights', getEncoding('@harness/embedding-weights-response')]
|
|
182
186
|
])
|
|
183
187
|
this._rpc = new RPC(stream, async (req) => {
|
|
184
188
|
const command = methods.get(req.command)
|
|
@@ -440,6 +444,10 @@ class HRPC {
|
|
|
440
444
|
return this._call('@harness/ocr-read', args)
|
|
441
445
|
}
|
|
442
446
|
|
|
447
|
+
async embeddingWeights(args) {
|
|
448
|
+
return this._call('@harness/embedding-weights', args)
|
|
449
|
+
}
|
|
450
|
+
|
|
443
451
|
onCompletion(responseFn) {
|
|
444
452
|
this._handlers['@harness/completion'] = responseFn
|
|
445
453
|
}
|
|
@@ -604,6 +612,10 @@ class HRPC {
|
|
|
604
612
|
this._handlers['@harness/ocr-read'] = responseFn
|
|
605
613
|
}
|
|
606
614
|
|
|
615
|
+
onEmbeddingWeights(responseFn) {
|
|
616
|
+
this._handlers['@harness/embedding-weights'] = responseFn
|
|
617
|
+
}
|
|
618
|
+
|
|
607
619
|
_requestIsStream(command) {
|
|
608
620
|
return [
|
|
609
621
|
'@harness/completion',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 24
|
|
3
3
|
/* eslint-disable camelcase */
|
|
4
4
|
/* eslint-disable quotes */
|
|
5
5
|
/* eslint-disable space-before-function-paren */
|
|
6
6
|
|
|
7
7
|
import { c } from 'hyperschema/runtime'
|
|
8
8
|
|
|
9
|
-
const VERSION =
|
|
9
|
+
const VERSION = 24
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line no-unused-vars
|
|
12
12
|
let version = VERSION
|
|
@@ -2240,7 +2240,7 @@ const encoding42 = {
|
|
|
2240
2240
|
preencode(state, m) {
|
|
2241
2241
|
encoding38.preencode(state, m.capabilityProfile)
|
|
2242
2242
|
c.string.preencode(state, m.recommendedModelName)
|
|
2243
|
-
state.end++ // max flag is
|
|
2243
|
+
state.end++ // max flag is 32 so always one byte
|
|
2244
2244
|
|
|
2245
2245
|
if (version >= 2 && m.memoryBudget) encoding42_2.preencode(state, m.memoryBudget)
|
|
2246
2246
|
if (version >= 23 && m.hostRunLogVersion) c.uint.preencode(state, m.hostRunLogVersion)
|
|
@@ -2251,7 +2251,8 @@ const encoding42 = {
|
|
|
2251
2251
|
((version >= 17 && m.mobile) ? 2 : 0) |
|
|
2252
2252
|
((version >= 23 && m.completionRecovery) ? 4 : 0) |
|
|
2253
2253
|
((version >= 23 && m.hostRunLog) ? 8 : 0) |
|
|
2254
|
-
((version >= 23 && m.hostRunLogVersion) ? 16 : 0)
|
|
2254
|
+
((version >= 23 && m.hostRunLogVersion) ? 16 : 0) |
|
|
2255
|
+
((version >= 24 && m.mobileMemoryCap) ? 32 : 0)
|
|
2255
2256
|
|
|
2256
2257
|
encoding38.encode(state, m.capabilityProfile)
|
|
2257
2258
|
c.string.encode(state, m.recommendedModelName)
|
|
@@ -2272,7 +2273,8 @@ const encoding42 = {
|
|
|
2272
2273
|
mobile: (version >= 17 && (flags & 2) !== 0),
|
|
2273
2274
|
completionRecovery: (version >= 23 && (flags & 4) !== 0),
|
|
2274
2275
|
hostRunLog: (version >= 23 && (flags & 8) !== 0),
|
|
2275
|
-
hostRunLogVersion: (version >= 23 && (flags & 16) !== 0) ? c.uint.decode(state) : 0
|
|
2276
|
+
hostRunLogVersion: (version >= 23 && (flags & 16) !== 0) ? c.uint.decode(state) : 0,
|
|
2277
|
+
mobileMemoryCap: (version >= 24 && (flags & 32) !== 0)
|
|
2276
2278
|
}
|
|
2277
2279
|
}
|
|
2278
2280
|
}
|
|
@@ -3779,15 +3781,25 @@ const encoding92 = {
|
|
|
3779
3781
|
const encoding93 = {
|
|
3780
3782
|
preencode(state, m) {
|
|
3781
3783
|
c.uint.preencode(state, m.usedBytes)
|
|
3784
|
+
state.end++ // max flag is 1 so always one byte
|
|
3785
|
+
|
|
3786
|
+
if (version >= 24 && m.pools) encoding93_1.preencode(state, m.pools)
|
|
3782
3787
|
},
|
|
3783
3788
|
encode(state, m) {
|
|
3789
|
+
const flags = (version >= 24 && m.pools) ? 1 : 0
|
|
3790
|
+
|
|
3784
3791
|
c.uint.encode(state, m.usedBytes)
|
|
3792
|
+
c.uint.encode(state, flags)
|
|
3793
|
+
|
|
3794
|
+
if (version >= 24 && m.pools) encoding93_1.encode(state, m.pools)
|
|
3785
3795
|
},
|
|
3786
3796
|
decode(state) {
|
|
3787
3797
|
const r0 = c.uint.decode(state)
|
|
3798
|
+
const flags = state.start < state.end ? c.uint.decode(state) : 0
|
|
3788
3799
|
|
|
3789
3800
|
return {
|
|
3790
|
-
usedBytes: r0
|
|
3801
|
+
usedBytes: r0,
|
|
3802
|
+
pools: (version >= 24 && (flags & 1) !== 0) ? encoding93_1.decode(state) : null
|
|
3791
3803
|
}
|
|
3792
3804
|
}
|
|
3793
3805
|
}
|
|
@@ -4318,6 +4330,67 @@ const encoding110 = {
|
|
|
4318
4330
|
}
|
|
4319
4331
|
}
|
|
4320
4332
|
|
|
4333
|
+
// @harness/memory-pool-usage
|
|
4334
|
+
const encoding111 = {
|
|
4335
|
+
preencode(state, m) {
|
|
4336
|
+
c.string.preencode(state, m.id)
|
|
4337
|
+
c.uint.preencode(state, m.usedBytes)
|
|
4338
|
+
state.end++ // max flag is 2 so always one byte
|
|
4339
|
+
|
|
4340
|
+
if (version >= 24 && m.capBytes) c.uint.preencode(state, m.capBytes)
|
|
4341
|
+
if (version >= 24 && m.totalBytes) c.uint.preencode(state, m.totalBytes)
|
|
4342
|
+
},
|
|
4343
|
+
encode(state, m) {
|
|
4344
|
+
const flags =
|
|
4345
|
+
((version >= 24 && m.capBytes) ? 1 : 0) | ((version >= 24 && m.totalBytes) ? 2 : 0)
|
|
4346
|
+
|
|
4347
|
+
c.string.encode(state, m.id)
|
|
4348
|
+
c.uint.encode(state, m.usedBytes)
|
|
4349
|
+
c.uint.encode(state, flags)
|
|
4350
|
+
|
|
4351
|
+
if (version >= 24 && m.capBytes) c.uint.encode(state, m.capBytes)
|
|
4352
|
+
if (version >= 24 && m.totalBytes) c.uint.encode(state, m.totalBytes)
|
|
4353
|
+
},
|
|
4354
|
+
decode(state) {
|
|
4355
|
+
const r0 = c.string.decode(state)
|
|
4356
|
+
const r1 = c.uint.decode(state)
|
|
4357
|
+
const flags = c.uint.decode(state)
|
|
4358
|
+
|
|
4359
|
+
return {
|
|
4360
|
+
id: r0,
|
|
4361
|
+
usedBytes: r1,
|
|
4362
|
+
capBytes: (version >= 24 && (flags & 1) !== 0) ? c.uint.decode(state) : 0,
|
|
4363
|
+
totalBytes: (version >= 24 && (flags & 2) !== 0) ? c.uint.decode(state) : 0
|
|
4364
|
+
}
|
|
4365
|
+
}
|
|
4366
|
+
}
|
|
4367
|
+
|
|
4368
|
+
// @harness/embedding-weights-request
|
|
4369
|
+
const encoding112 = encoding90
|
|
4370
|
+
|
|
4371
|
+
// @harness/embedding-weights-response
|
|
4372
|
+
const encoding113 = {
|
|
4373
|
+
preencode(state, m) {
|
|
4374
|
+
state.end++ // max flag is 1 so always one byte
|
|
4375
|
+
|
|
4376
|
+
if (version >= 24 && m.weights) c.string.preencode(state, m.weights)
|
|
4377
|
+
},
|
|
4378
|
+
encode(state, m) {
|
|
4379
|
+
const flags = (version >= 24 && m.weights) ? 1 : 0
|
|
4380
|
+
|
|
4381
|
+
c.uint.encode(state, flags)
|
|
4382
|
+
|
|
4383
|
+
if (version >= 24 && m.weights) c.string.encode(state, m.weights)
|
|
4384
|
+
},
|
|
4385
|
+
decode(state) {
|
|
4386
|
+
const flags = c.uint.decode(state)
|
|
4387
|
+
|
|
4388
|
+
return {
|
|
4389
|
+
weights: (version >= 24 && (flags & 1) !== 0) ? c.string.decode(state) : null
|
|
4390
|
+
}
|
|
4391
|
+
}
|
|
4392
|
+
}
|
|
4393
|
+
|
|
4321
4394
|
// @harness/agent-knobs.handoffs, deferred due to recusive use
|
|
4322
4395
|
const encoding4_18 = c.array(c.frame(encoding95))
|
|
4323
4396
|
// @harness/completion-frame.grantedDrives, deferred due to recusive use
|
|
@@ -4332,6 +4405,8 @@ const encoding42_2 = c.frame(encoding57)
|
|
|
4332
4405
|
const encoding50_10 = c.frame(encoding82)
|
|
4333
4406
|
// @harness/skill-oauth-config.verify, deferred due to recusive use
|
|
4334
4407
|
const encoding82_9 = c.frame(encoding84)
|
|
4408
|
+
// @harness/memory-usage.pools, deferred due to recusive use
|
|
4409
|
+
const encoding93_1 = c.array(c.frame(encoding111))
|
|
4335
4410
|
|
|
4336
4411
|
function setVersion(v) {
|
|
4337
4412
|
version = v
|
|
@@ -4608,6 +4683,12 @@ function getEncoding(name) {
|
|
|
4608
4683
|
return encoding109
|
|
4609
4684
|
case '@harness/ocr-read-response':
|
|
4610
4685
|
return encoding110
|
|
4686
|
+
case '@harness/memory-pool-usage':
|
|
4687
|
+
return encoding111
|
|
4688
|
+
case '@harness/embedding-weights-request':
|
|
4689
|
+
return encoding112
|
|
4690
|
+
case '@harness/embedding-weights-response':
|
|
4691
|
+
return encoding113
|
|
4611
4692
|
default:
|
|
4612
4693
|
throw new Error('Encoder not found ' + name)
|
|
4613
4694
|
}
|