@qvac/harness 0.4.0 → 0.5.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 +689 -141
- package/README.md +29 -7
- package/dist/harness.bundle +71 -50
- package/dist-lib/index.d.ts +36 -39
- package/dist-lib/index.js +279 -114
- package/dist-lib/lib/audio-transcode-bare.d.ts +2 -2
- package/dist-lib/lib/audio-transcode-bare.js +28 -18
- package/dist-lib/lib/audio-transcode-node.d.ts +2 -2
- package/dist-lib/lib/capabilities/audio-resample.d.ts +7 -6
- package/dist-lib/lib/capabilities/audio-resample.js +30 -18
- package/dist-lib/lib/capabilities/completion.d.ts +20 -19
- package/dist-lib/lib/capabilities/completion.js +193 -132
- package/dist-lib/lib/capabilities/download.d.ts +6 -6
- package/dist-lib/lib/capabilities/download.js +15 -8
- package/dist-lib/lib/capabilities/embed.js +2 -1
- package/dist-lib/lib/capabilities/enhance.d.ts +6 -1
- package/dist-lib/lib/capabilities/enhance.js +7 -4
- package/dist-lib/lib/capabilities/invoke.js +7 -4
- package/dist-lib/lib/capabilities/kv-cache.js +2 -1
- package/dist-lib/lib/capabilities/preview-model-source.d.ts +9 -7
- package/dist-lib/lib/capabilities/preview-model-source.js +80 -28
- package/dist-lib/lib/capabilities/speech-text.js +5 -4
- package/dist-lib/lib/capabilities/tool-selection.js +10 -9
- package/dist-lib/lib/capabilities/tool-turns.js +30 -16
- package/dist-lib/lib/capabilities/usage-breakdown.js +2 -1
- package/dist-lib/lib/capabilities/voice.d.ts +5 -1
- package/dist-lib/lib/capabilities/voice.js +22 -12
- package/dist-lib/lib/connect.d.ts +11 -32
- package/dist-lib/lib/connect.js +152 -112
- package/dist-lib/lib/context-window.js +25 -21
- package/dist-lib/lib/contract-types.d.ts +22 -15
- package/dist-lib/lib/diagram-repair.d.ts +4 -4
- package/dist-lib/lib/diagram-repair.js +6 -3
- package/dist-lib/lib/docx/index.d.ts +3 -2
- package/dist-lib/lib/{error-fields.d.ts → guards.d.ts} +1 -0
- package/dist-lib/lib/{error-fields.js → guards.js} +3 -0
- package/dist-lib/lib/hardware/capability-probe.js +20 -10
- package/dist-lib/lib/hardware/gpu-classify.js +6 -3
- package/dist-lib/lib/hardware/gpu-probe-addon.js +8 -4
- package/dist-lib/lib/hardware/gpu-probe.js +4 -2
- package/dist-lib/lib/hardware/gpu-stats.native.cjs +8 -9
- package/dist-lib/lib/hardware/parsers.js +8 -4
- package/dist-lib/lib/helpers/buffer-burst.js +4 -2
- package/dist-lib/lib/helpers/control-tokens.js +4 -2
- package/dist-lib/lib/helpers/join-guard.d.ts +2 -2
- package/dist-lib/lib/helpers/join-guard.js +4 -2
- package/dist-lib/lib/helpers/load-stall.js +4 -2
- package/dist-lib/lib/helpers/markup-stream-filter.d.ts +2 -2
- package/dist-lib/lib/helpers/markup-stream-filter.js +6 -3
- package/dist-lib/lib/helpers/race-abort.js +2 -1
- package/dist-lib/lib/helpers/race-timeout.d.ts +5 -0
- package/dist-lib/lib/helpers/race-timeout.js +14 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +6 -8
- package/dist-lib/lib/helpers/run-outcome.js +36 -20
- package/dist-lib/lib/helpers/spawn-path.js +6 -3
- package/dist-lib/lib/helpers/text-coalescer.js +6 -3
- package/dist-lib/lib/helpers/thinking.js +38 -45
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +9 -7
- package/dist-lib/lib/helpers/tool-call-markup.js +36 -20
- package/dist-lib/lib/helpers/tool-intent.d.ts +3 -2
- package/dist-lib/lib/helpers/tool-intent.js +4 -2
- package/dist-lib/lib/helpers/tool-label.js +18 -9
- package/dist-lib/lib/hooks/built-in/arg-repair.js +23 -13
- package/dist-lib/lib/hooks/built-in/egress.js +2 -1
- package/dist-lib/lib/hooks/built-in/skill-catalog.js +2 -1
- package/dist-lib/lib/hooks/pipeline.d.ts +5 -4
- package/dist-lib/lib/hooks/pipeline.js +6 -3
- package/dist-lib/lib/hooks/run.js +12 -8
- package/dist-lib/lib/model-download-progress.js +10 -8
- package/dist-lib/lib/models/context.d.ts +1 -1
- package/dist-lib/lib/models/context.js +5 -1
- package/dist-lib/lib/models/custom-model-cache.d.ts +10 -1
- package/dist-lib/lib/models/custom-model-cache.js +43 -15
- package/dist-lib/lib/models/gguf-header.d.ts +3 -2
- package/dist-lib/lib/models/gguf-header.js +44 -22
- package/dist-lib/lib/models/idle-unload.d.ts +14 -0
- package/dist-lib/lib/models/idle-unload.js +51 -0
- package/dist-lib/lib/models/kv-cache.d.ts +3 -2
- package/dist-lib/lib/models/kv-cache.js +4 -3
- package/dist-lib/lib/models/llm-presets.d.ts +2 -2
- package/dist-lib/lib/models/llm-presets.js +4 -2
- package/dist-lib/lib/models/model-catalog-constants.js +3 -2
- package/dist-lib/lib/models/model-catalog.d.ts +13 -20
- package/dist-lib/lib/models/model-catalog.js +59 -31
- package/dist-lib/lib/models/model-delete.js +18 -8
- package/dist-lib/lib/models/model-handle.js +2 -1
- package/dist-lib/lib/models/model-list.d.ts +8 -3
- package/dist-lib/lib/models/model-list.js +11 -6
- package/dist-lib/lib/models/model-pool.d.ts +44 -10
- package/dist-lib/lib/models/model-pool.js +47 -42
- package/dist-lib/lib/models/model-source.js +10 -5
- package/dist-lib/lib/models/music-catalog.d.ts +2 -2
- package/dist-lib/lib/models/nmt-catalog.d.ts +4 -3
- package/dist-lib/lib/models/nmt-catalog.js +10 -5
- package/dist-lib/lib/models/opencl-cache.d.ts +6 -1
- package/dist-lib/lib/models/opencl-cache.js +5 -3
- package/dist-lib/lib/models/sdk-faults.d.ts +11 -8
- package/dist-lib/lib/models/sdk-faults.js +9 -6
- package/dist-lib/lib/models/shards.d.ts +11 -0
- package/dist-lib/lib/models/shards.js +15 -0
- package/dist-lib/lib/models/tool-dialect.js +10 -5
- package/dist-lib/lib/no-redirect-fetch-bare.d.ts +3 -3
- package/dist-lib/lib/no-redirect-fetch-bare.js +1 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +6 -3
- package/dist-lib/lib/no-redirect-fetch-node.d.ts +1 -1
- package/dist-lib/lib/no-redirect-fetch-node.js +9 -9
- package/dist-lib/lib/office/index.d.ts +3 -2
- package/dist-lib/lib/office/python.d.ts +3 -2
- package/dist-lib/lib/office/python.js +2 -1
- package/dist-lib/lib/prompt.d.ts +5 -4
- package/dist-lib/lib/prompt.js +8 -4
- package/dist-lib/lib/queue.js +10 -5
- package/dist-lib/lib/resolution-detector.js +21 -11
- package/dist-lib/lib/rpc-session.js +2 -1
- package/dist-lib/lib/sdk-loader.js +2 -1
- package/dist-lib/lib/sdk-storage.js +4 -2
- package/dist-lib/lib/serve.js +110 -66
- package/dist-lib/lib/spawn.js +7 -4
- package/dist-lib/lib/tmp-path.d.ts +7 -6
- package/dist-lib/lib/tool-call-display.d.ts +2 -2
- package/dist-lib/lib/tools/create-documents.js +18 -10
- package/dist-lib/lib/tools/edit-documents.js +23 -13
- package/dist-lib/lib/tools/edit-image.d.ts +2 -2
- package/dist-lib/lib/tools/edit-image.js +60 -36
- package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +10 -10
- package/dist-lib/lib/tools/exec/adapters/python/attachments.d.ts +17 -11
- package/dist-lib/lib/tools/exec/adapters/python/attachments.js +53 -40
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +60 -32
- package/dist-lib/lib/tools/exec/adapters/python/guarded-fetch.d.ts +33 -22
- package/dist-lib/lib/tools/exec/adapters/python/guarded-fetch.js +58 -29
- package/dist-lib/lib/tools/exec/adapters/python/interrupt-timer.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/loader.js +23 -12
- package/dist-lib/lib/tools/exec/adapters/python/memfs.d.ts +13 -11
- package/dist-lib/lib/tools/exec/adapters/python/memfs.js +10 -5
- package/dist-lib/lib/tools/exec/adapters/python/net-shim.js +3 -1
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.d.ts +6 -4
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.js +20 -10
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.js +14 -7
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +41 -34
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +316 -166
- package/dist-lib/lib/tools/exec/adapters/python/run-session.d.ts +9 -8
- package/dist-lib/lib/tools/exec/adapters/python/run-session.js +56 -28
- package/dist-lib/lib/tools/exec/adapters/python/wheels.d.ts +8 -10
- package/dist-lib/lib/tools/exec/adapters/python/wheels.js +22 -11
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.d.ts +3 -2
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.js +41 -26
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +27 -18
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.js +14 -13
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.d.ts +4 -4
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.js +10 -5
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.d.ts +4 -4
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +2 -1
- package/dist-lib/lib/tools/exec/obsidian/cli-process.d.ts +6 -1
- package/dist-lib/lib/tools/exec/obsidian/cli-process.js +8 -5
- package/dist-lib/lib/tools/exec/obsidian/cli.d.ts +6 -6
- package/dist-lib/lib/tools/exec/obsidian/cli.js +4 -4
- package/dist-lib/lib/tools/exec/obsidian/command.d.ts +3 -2
- package/dist-lib/lib/tools/exec/obsidian/command.js +6 -3
- package/dist-lib/lib/tools/exec/obsidian/output.js +2 -1
- package/dist-lib/lib/tools/exec/obsidian/route.d.ts +4 -6
- package/dist-lib/lib/tools/exec/obsidian/route.js +17 -11
- package/dist-lib/lib/tools/exec/obsidian/safe-path.js +2 -1
- package/dist-lib/lib/tools/exec/obsidian/vault-create.js +15 -7
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.d.ts +2 -2
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.js +20 -10
- package/dist-lib/lib/tools/exec/obsidian/vault-read.js +20 -13
- package/dist-lib/lib/tools/exec/obsidian/vault-write.js +24 -12
- package/dist-lib/lib/tools/exec/runner.d.ts +14 -14
- package/dist-lib/lib/tools/exec/runner.js +5 -3
- package/dist-lib/lib/tools/exec/scope.js +52 -28
- package/dist-lib/lib/tools/exec/shell-argv.js +31 -18
- package/dist-lib/lib/tools/exec/shell-guidance.d.ts +6 -1
- package/dist-lib/lib/tools/exec/shell-guidance.js +35 -20
- package/dist-lib/lib/tools/exec/video-tools.js +2 -2
- package/dist-lib/lib/tools/exec.d.ts +6 -8
- package/dist-lib/lib/tools/exec.js +113 -54
- package/dist-lib/lib/tools/file-glob.d.ts +4 -5
- package/dist-lib/lib/tools/file-glob.js +16 -11
- package/dist-lib/lib/tools/fs/glob.js +13 -18
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +10 -10
- package/dist-lib/lib/tools/fs/remote.d.ts +3 -2
- package/dist-lib/lib/tools/fs/remote.js +13 -7
- package/dist-lib/lib/tools/fs/scope.d.ts +8 -3
- package/dist-lib/lib/tools/fs/scope.js +20 -12
- package/dist-lib/lib/tools/fs/walk.js +6 -3
- package/dist-lib/lib/tools/fs/write.d.ts +3 -2
- package/dist-lib/lib/tools/generate-image.d.ts +11 -9
- package/dist-lib/lib/tools/generate-image.js +73 -37
- package/dist-lib/lib/tools/generate-music.d.ts +22 -11
- package/dist-lib/lib/tools/generate-music.js +79 -48
- package/dist-lib/lib/tools/grep.js +66 -41
- package/dist-lib/lib/tools/http-request/encode-fields.js +18 -9
- package/dist-lib/lib/tools/http-request/{utils.js → request.js} +20 -11
- package/dist-lib/lib/tools/http-request/truncate-response.js +57 -46
- package/dist-lib/lib/tools/http-request.d.ts +1 -1
- package/dist-lib/lib/tools/http-request.js +33 -18
- package/dist-lib/lib/tools/mcp/protocol.d.ts +53 -0
- package/dist-lib/lib/tools/mcp/{utils.js → protocol.js} +45 -23
- package/dist-lib/lib/tools/mcp-call.d.ts +1 -1
- package/dist-lib/lib/tools/mcp-call.js +37 -16
- package/dist-lib/lib/tools/operations/builders.js +10 -6
- package/dist-lib/lib/tools/operations/compile.js +20 -10
- package/dist-lib/lib/tools/operations/decoders.js +12 -6
- package/dist-lib/lib/tools/operations/gmail-message.js +3 -2
- package/dist-lib/lib/tools/outbound-guard.d.ts +4 -3
- package/dist-lib/lib/tools/outbound-guard.js +14 -8
- package/dist-lib/lib/tools/private-ip.js +8 -7
- package/dist-lib/lib/tools/rag-search.js +14 -7
- package/dist-lib/lib/tools/read-files.js +23 -20
- package/dist-lib/lib/tools/skill.js +19 -10
- package/dist-lib/lib/tools/skills/auth-resolver.d.ts +11 -18
- package/dist-lib/lib/tools/skills/auth-resolver.js +30 -18
- package/dist-lib/lib/tools/skills/bin-check.d.ts +3 -2
- package/dist-lib/lib/tools/skills/bin-check.js +10 -3
- package/dist-lib/lib/tools/skills/bundled-dir.js +20 -10
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +3 -2
- package/dist-lib/lib/tools/skills/bundled-hash.js +6 -1
- package/dist-lib/lib/tools/skills/catalog.d.ts +3 -2
- package/dist-lib/lib/tools/skills/catalog.js +33 -28
- package/dist-lib/lib/tools/skills/cli-argv.d.ts +3 -2
- package/dist-lib/lib/tools/skills/cli-argv.js +55 -52
- package/dist-lib/lib/tools/skills/cli-schema-check.js +21 -10
- package/dist-lib/lib/tools/skills/cli-schema-load.js +28 -20
- package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +6 -6
- package/dist-lib/lib/tools/skills/cli-schema.js +2 -1
- package/dist-lib/lib/tools/skills/credential-check.d.ts +6 -3
- package/dist-lib/lib/tools/skills/credential-check.js +24 -12
- package/dist-lib/lib/tools/skills/credential-grants.js +1 -6
- package/dist-lib/lib/tools/skills/credential-health.d.ts +5 -1
- package/dist-lib/lib/tools/skills/credential-health.js +5 -3
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +10 -5
- package/dist-lib/lib/tools/skills/manifest-parse.js +84 -64
- package/dist-lib/lib/tools/skills/mention.js +7 -6
- package/dist-lib/lib/tools/skills/obsidian-readiness.d.ts +2 -2
- package/dist-lib/lib/tools/skills/obsidian-readiness.js +11 -3
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +6 -4
- package/dist-lib/lib/tools/skills/overlay-crud.js +12 -6
- package/dist-lib/lib/tools/skills/overlay-dir.js +4 -2
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +3 -2
- package/dist-lib/lib/tools/skills/overlay-watch.js +8 -4
- package/dist-lib/lib/tools/skills/setup-routes.js +1 -3
- package/dist-lib/lib/tools/skills/skill-settings.js +4 -1
- package/dist-lib/lib/tools/skills/skill-state.d.ts +6 -11
- package/dist-lib/lib/tools/skills/skill-state.js +48 -29
- package/dist-lib/lib/tools/skills/tool-grants.js +6 -3
- package/dist-lib/lib/tools/toolsets.js +2 -1
- package/dist-lib/lib/tools/translate.d.ts +4 -5
- package/dist-lib/lib/tools/translate.js +31 -14
- package/dist-lib/lib/tools/url-guard.js +2 -1
- package/dist-lib/lib/tools/weather-lookup/place.js +8 -4
- package/dist-lib/lib/tools/weather-lookup/report.d.ts +7 -1
- package/dist-lib/lib/tools/weather-lookup/report.js +46 -9
- package/dist-lib/lib/tools/weather-lookup.js +18 -12
- package/dist-lib/lib/tools/web-fetch.js +47 -24
- package/dist-lib/lib/tools/web-search.js +8 -3
- package/dist-lib/lib/validating-lookup.d.ts +4 -4
- package/dist-lib/lib/wav-encode.d.ts +1 -1
- package/dist-lib/lib/wav-encode.js +11 -10
- package/dist-lib/lib/web-fetch/embedded-state.js +24 -12
- package/dist-lib/lib/web-fetch/extract.js +4 -2
- package/dist-lib/lib/web-fetch/images.js +8 -4
- package/dist-lib/lib/web-fetch/video.d.ts +2 -2
- package/dist-lib/lib/web-fetch/video.js +8 -4
- package/dist-lib/lib/web-search/engine-registry.d.ts +2 -2
- package/dist-lib/lib/web-search/engines/aol.js +1 -1
- package/dist-lib/lib/web-search/engines/bing.js +1 -1
- package/dist-lib/lib/web-search/engines/brave.js +4 -1
- package/dist-lib/lib/web-search/engines/duckduckgo.js +3 -2
- package/dist-lib/lib/web-search/engines/google.js +7 -3
- package/dist-lib/lib/web-search/engines/wikipedia.js +5 -4
- package/dist-lib/lib/web-search/engines/yahoo.js +1 -1
- package/dist-lib/lib/web-search/fetch-html.d.ts +5 -4
- package/dist-lib/lib/web-search/fetch-html.js +13 -7
- package/dist-lib/lib/web-search/orchestrator.d.ts +9 -5
- package/dist-lib/lib/web-search/orchestrator.js +3 -3
- package/dist-lib/lib/wire.d.ts +3 -2
- package/dist-lib/lib/wire.js +23 -15
- package/dist-lib/schema/baseline.js +10 -5
- package/dist-lib/schema/build.js +2 -1
- package/dist-lib/schema/harness.d.ts +15 -2
- package/dist-lib/schema/harness.js +14 -2
- package/dist-lib/schema/release-tags.d.ts +3 -2
- package/dist-lib/schema/release-tags.js +6 -3
- 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 +39 -8
- package/dist-lib/spec/hyperschema/index.js +39 -8
- package/dist-lib/spec/hyperschema/schema.json +30 -1
- package/dist-lib/spec/hyperschema/types.d.ts +9 -1
- package/package.json +13 -14
- package/worker/harness-sidecar.mjs +15 -22
- package/worker/stow-entry.mjs +7 -4
- package/dist-lib/lib/tools/mcp/utils.d.ts +0 -47
- /package/dist-lib/lib/tools/http-request/{utils.d.ts → request.d.ts} +0 -0
|
@@ -37,7 +37,8 @@ function buildInit(options, signal) {
|
|
|
37
37
|
}
|
|
38
38
|
return init;
|
|
39
39
|
}
|
|
40
|
-
async function fetchWithTimeout(fetcher, url, options
|
|
40
|
+
async function fetchWithTimeout(fetcher, url, options) {
|
|
41
|
+
const callerSignal = options?.signal;
|
|
41
42
|
if (callerSignal?.aborted) {
|
|
42
43
|
throw new AbortError();
|
|
43
44
|
}
|
|
@@ -57,10 +58,12 @@ async function fetchWithTimeout(fetcher, url, options, callerSignal) {
|
|
|
57
58
|
return { ok: resp.ok, status: resp.status, text };
|
|
58
59
|
}
|
|
59
60
|
catch (err) {
|
|
60
|
-
if (timedOut)
|
|
61
|
+
if (timedOut) {
|
|
61
62
|
throw new TimeoutError(timeoutMs);
|
|
62
|
-
|
|
63
|
+
}
|
|
64
|
+
if (callerSignal?.aborted) {
|
|
63
65
|
throw new AbortError();
|
|
66
|
+
}
|
|
64
67
|
throw err;
|
|
65
68
|
}
|
|
66
69
|
finally {
|
|
@@ -68,8 +71,8 @@ async function fetchWithTimeout(fetcher, url, options, callerSignal) {
|
|
|
68
71
|
callerSignal?.removeEventListener('abort', onCallerAbort);
|
|
69
72
|
}
|
|
70
73
|
}
|
|
71
|
-
export async function fetchHtml(fetcher, url, options
|
|
72
|
-
const { ok, status, text } = await fetchWithTimeout(fetcher, url, options
|
|
74
|
+
export async function fetchHtml(fetcher, url, options) {
|
|
75
|
+
const { ok, status, text } = await fetchWithTimeout(fetcher, url, options);
|
|
73
76
|
if (!ok) {
|
|
74
77
|
throw new Error(`HTTP ${status}`);
|
|
75
78
|
}
|
|
@@ -83,8 +86,11 @@ export class JsonParseError extends Error {
|
|
|
83
86
|
this.name = 'JsonParseError';
|
|
84
87
|
}
|
|
85
88
|
}
|
|
86
|
-
export async function fetchJson(fetcher, url, options
|
|
87
|
-
const { ok, status, text } = await fetchWithTimeout(fetcher, url, {
|
|
89
|
+
export async function fetchJson(fetcher, url, options) {
|
|
90
|
+
const { ok, status, text } = await fetchWithTimeout(fetcher, url, {
|
|
91
|
+
...options,
|
|
92
|
+
accept: options?.accept ?? 'application/json'
|
|
93
|
+
});
|
|
88
94
|
if (!ok) {
|
|
89
95
|
throw new Error(`HTTP ${status}`);
|
|
90
96
|
}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
2
|
import type { Fetcher, WebSearchResult } from './types.ts';
|
|
3
|
-
export
|
|
3
|
+
export interface EngineSummaryEntry {
|
|
4
4
|
readonly engine: string;
|
|
5
5
|
readonly status: 'ok' | 'timeout' | 'error';
|
|
6
6
|
readonly resultCount: number;
|
|
7
7
|
readonly durationMs: number;
|
|
8
|
-
}
|
|
9
|
-
export
|
|
8
|
+
}
|
|
9
|
+
export interface SearchWebResult {
|
|
10
10
|
readonly results: ReadonlyArray<WebSearchResult>;
|
|
11
11
|
readonly engineSummary: ReadonlyArray<EngineSummaryEntry>;
|
|
12
|
-
}
|
|
12
|
+
}
|
|
13
13
|
export declare function classifyEngineError(reason: unknown): 'timeout' | 'error';
|
|
14
|
-
export
|
|
14
|
+
export interface SearchWebOptions {
|
|
15
|
+
readonly maxResults?: number;
|
|
16
|
+
readonly signal?: BareAbortSignal;
|
|
17
|
+
}
|
|
18
|
+
export declare function searchWeb(fetcher: Fetcher, query: string, { maxResults, signal }?: SearchWebOptions): Promise<SearchWebResult>;
|
|
@@ -4,7 +4,7 @@ import { mergeResults } from './merge-results.js';
|
|
|
4
4
|
export function classifyEngineError(reason) {
|
|
5
5
|
return reason instanceof TimeoutError ? 'timeout' : 'error';
|
|
6
6
|
}
|
|
7
|
-
function processSettledResult(engineName, result, outcomes, engineSummary) {
|
|
7
|
+
function processSettledResult(engineName, result, { outcomes, engineSummary }) {
|
|
8
8
|
if (result.status === 'fulfilled') {
|
|
9
9
|
outcomes.push(result.value);
|
|
10
10
|
engineSummary.push({
|
|
@@ -23,7 +23,7 @@ function processSettledResult(engineName, result, outcomes, engineSummary) {
|
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
-
export async function searchWeb(fetcher, query, maxResults = DEFAULT_MAX_RESULTS, signal) {
|
|
26
|
+
export async function searchWeb(fetcher, query, { maxResults = DEFAULT_MAX_RESULTS, signal } = {}) {
|
|
27
27
|
const settled = await Promise.allSettled(ENGINES.map(async ({ name, fn }) => {
|
|
28
28
|
const start = Date.now();
|
|
29
29
|
const results = await fn(query, fetcher, signal);
|
|
@@ -41,7 +41,7 @@ export async function searchWeb(fetcher, query, maxResults = DEFAULT_MAX_RESULTS
|
|
|
41
41
|
if (!engine || !settledResult) {
|
|
42
42
|
continue;
|
|
43
43
|
}
|
|
44
|
-
processSettledResult(engine.name, settledResult, outcomes, engineSummary);
|
|
44
|
+
processSettledResult(engine.name, settledResult, { outcomes, engineSummary });
|
|
45
45
|
}
|
|
46
46
|
if (outcomes.length === 0) {
|
|
47
47
|
return { results: [], engineSummary };
|
package/dist-lib/lib/wire.d.ts
CHANGED
|
@@ -44,8 +44,9 @@ export declare function toWire(event: HarnessEvent): WireEvent;
|
|
|
44
44
|
export declare function fromWire(event: WireEvent): HarnessEvent;
|
|
45
45
|
export declare function toDownloadWire(event: HarnessEvent): WireDownloadEvent;
|
|
46
46
|
export declare function fromDownloadWire(event: WireDownloadEvent): HarnessEvent;
|
|
47
|
-
export
|
|
47
|
+
export interface PackedVectors {
|
|
48
48
|
dimensions: number;
|
|
49
49
|
vectors: Buffer;
|
|
50
|
-
}
|
|
50
|
+
}
|
|
51
|
+
export declare function packVectors(vectors: number[][]): PackedVectors;
|
|
51
52
|
export declare function unpackVectors(dimensions: number, bytes: Buffer): number[][];
|
package/dist-lib/lib/wire.js
CHANGED
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
import b4a from 'b4a';
|
|
2
|
+
import { isRecord } from './guards.js';
|
|
3
|
+
function stringField(value) {
|
|
4
|
+
return typeof value === 'string' ? value : undefined;
|
|
5
|
+
}
|
|
6
|
+
function objectField(value) {
|
|
7
|
+
return isRecord(value) ? value : {};
|
|
8
|
+
}
|
|
9
|
+
function isResource(value) {
|
|
10
|
+
return isRecord(value) && typeof value.kind === 'string' && typeof value.label === 'string';
|
|
11
|
+
}
|
|
2
12
|
export function toWire(event) {
|
|
3
13
|
switch (event.type) {
|
|
4
14
|
case 'content':
|
|
@@ -7,26 +17,26 @@ export function toWire(event) {
|
|
|
7
17
|
case 'tool-call':
|
|
8
18
|
return {
|
|
9
19
|
type: 'tool-call',
|
|
10
|
-
name: event.name,
|
|
20
|
+
name: stringField(event.name),
|
|
11
21
|
arguments: event.args,
|
|
12
|
-
rawCall: event.rawCall ?? null,
|
|
13
|
-
effect: event.effect ?? null,
|
|
22
|
+
rawCall: stringField(event.rawCall) ?? null,
|
|
23
|
+
effect: stringField(event.effect) ?? null,
|
|
14
24
|
display: event.display
|
|
15
25
|
};
|
|
16
26
|
case 'tool-result':
|
|
17
27
|
return {
|
|
18
28
|
type: 'tool-result',
|
|
19
|
-
name: event.name,
|
|
29
|
+
name: stringField(event.name),
|
|
20
30
|
result: event.result
|
|
21
31
|
};
|
|
22
32
|
case 'tool-activity':
|
|
23
33
|
return {
|
|
24
34
|
type: 'tool-activity',
|
|
25
|
-
name: event.name,
|
|
35
|
+
name: stringField(event.name),
|
|
26
36
|
arguments: event.args,
|
|
27
|
-
resource: event.resource
|
|
28
|
-
effect: event.effect,
|
|
29
|
-
decision: event.decision
|
|
37
|
+
resource: isResource(event.resource) ? event.resource : null,
|
|
38
|
+
effect: stringField(event.effect),
|
|
39
|
+
decision: stringField(event.decision)
|
|
30
40
|
};
|
|
31
41
|
case 'metrics': {
|
|
32
42
|
const { type, ...metrics } = event;
|
|
@@ -64,9 +74,7 @@ export function fromWire(event) {
|
|
|
64
74
|
type: 'tool-call',
|
|
65
75
|
name: event.name ?? '',
|
|
66
76
|
args: event.arguments ?? {},
|
|
67
|
-
|
|
68
|
-
? {}
|
|
69
|
-
: { rawCall: event.rawCall }),
|
|
77
|
+
rawCall: event.rawCall ?? undefined,
|
|
70
78
|
effect: event.effect === 'read' ? 'read' : 'write',
|
|
71
79
|
display: event.display ?? undefined
|
|
72
80
|
};
|
|
@@ -86,11 +94,11 @@ export function fromWire(event) {
|
|
|
86
94
|
decision: event.decision || 'blocked'
|
|
87
95
|
};
|
|
88
96
|
case 'metrics':
|
|
89
|
-
return { type: 'metrics', ...event.metrics };
|
|
97
|
+
return { type: 'metrics', ...objectField(event.metrics) };
|
|
90
98
|
case 'inference-call':
|
|
91
99
|
return { type: 'inference-call', call: event.payload };
|
|
92
100
|
case 'inference-sent': {
|
|
93
|
-
const sent = (event.payload
|
|
101
|
+
const sent = objectField(event.payload);
|
|
94
102
|
return {
|
|
95
103
|
type: 'inference-sent',
|
|
96
104
|
messages: sent.messages,
|
|
@@ -118,7 +126,7 @@ export function toDownloadWire(event) {
|
|
|
118
126
|
case 'complete':
|
|
119
127
|
return {
|
|
120
128
|
type: 'complete',
|
|
121
|
-
assetId: event.assetId,
|
|
129
|
+
assetId: stringField(event.assetId),
|
|
122
130
|
downloaded: typeof event.downloaded === 'boolean' ? event.downloaded : undefined
|
|
123
131
|
};
|
|
124
132
|
case 'error':
|
|
@@ -132,7 +140,7 @@ export function toDownloadWire(event) {
|
|
|
132
140
|
export function fromDownloadWire(event) {
|
|
133
141
|
switch (event.type) {
|
|
134
142
|
case 'progress':
|
|
135
|
-
return { type: 'progress', ...(event.progress
|
|
143
|
+
return { type: 'progress', ...objectField(event.progress) };
|
|
136
144
|
case 'complete':
|
|
137
145
|
return { type: 'complete', assetId: event.assetId ?? '', downloaded: event.downloaded };
|
|
138
146
|
case 'error':
|
|
@@ -7,28 +7,33 @@ export function rewindSpec(root, dirs, { carries, keep }) {
|
|
|
7
7
|
if (process.env.SCHEMA_NO_BASELINE)
|
|
8
8
|
return [];
|
|
9
9
|
const baselines = previousReleaseTags(root, { carries });
|
|
10
|
-
if (baselines.length === 0)
|
|
10
|
+
if (baselines.length === 0) {
|
|
11
11
|
return [];
|
|
12
|
+
}
|
|
12
13
|
const held = keep.map((file) => {
|
|
13
14
|
const target = path.join(root, file);
|
|
14
15
|
return { target, contents: fs.readFileSync(target) };
|
|
15
16
|
});
|
|
16
|
-
for (const dir of dirs)
|
|
17
|
+
for (const dir of dirs) {
|
|
17
18
|
checkoutSpec(root, dir, baselines[0]);
|
|
18
|
-
|
|
19
|
+
}
|
|
20
|
+
for (const { target, contents } of held) {
|
|
19
21
|
fs.writeFileSync(target, contents);
|
|
22
|
+
}
|
|
20
23
|
return baselines;
|
|
21
24
|
}
|
|
22
25
|
function checkoutSpec(root, dir, tag) {
|
|
23
26
|
console.log(`rewinding ${path.relative(root, dir)} to ${tag}`);
|
|
24
27
|
const done = spawnSync('git', ['checkout', tag, '--', dir], { cwd: root });
|
|
25
|
-
if (done.status !== 0)
|
|
28
|
+
if (done.status !== 0) {
|
|
26
29
|
throw new Error(`checkout ${tag} failed: ${done.stderr ?? ''}`);
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
export function unstageSpec(root, dirs) {
|
|
29
33
|
const done = spawnSync('git', ['reset', '--quiet', 'HEAD', '--', ...dirs], { cwd: root });
|
|
30
|
-
if (done.status !== 0)
|
|
34
|
+
if (done.status !== 0) {
|
|
31
35
|
throw new Error(`git reset -- spec failed: ${done.stderr ?? ''}`);
|
|
36
|
+
}
|
|
32
37
|
}
|
|
33
38
|
export function resetHrpcIds(hrpcDir) {
|
|
34
39
|
fs.rmSync(path.join(hrpcDir, 'hrpc.json'), { force: true });
|
package/dist-lib/schema/build.js
CHANGED
|
@@ -34,6 +34,7 @@ registerHarnessApi(builder.namespace('harness'));
|
|
|
34
34
|
HRPCBuilder.toDisk(builder);
|
|
35
35
|
writeBind(builder, path.join(SPEC_DIR, 'bind.js'));
|
|
36
36
|
writeClient(builder, path.join(SPEC_DIR, 'calls.js'), 'harnessClient');
|
|
37
|
-
if (baselines.length > 0)
|
|
37
|
+
if (baselines.length > 0) {
|
|
38
38
|
unstageSpec(ROOT, BASELINE_DIRS);
|
|
39
|
+
}
|
|
39
40
|
console.log('harness contract spec generated under spec/');
|
|
@@ -1,2 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import type Hyperschema from 'hyperschema';
|
|
2
|
+
interface HrpcRoute {
|
|
3
|
+
name: string;
|
|
4
|
+
stream: boolean;
|
|
5
|
+
}
|
|
6
|
+
interface HrpcNamespace {
|
|
7
|
+
register(description: {
|
|
8
|
+
name: string;
|
|
9
|
+
request: HrpcRoute;
|
|
10
|
+
response: HrpcRoute;
|
|
11
|
+
}): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function registerHarnessTypes(ns: Hyperschema.Namespace): void;
|
|
14
|
+
export declare function registerHarnessApi(api: HrpcNamespace): void;
|
|
15
|
+
export {};
|
|
@@ -338,7 +338,8 @@ export function registerHarnessTypes(ns) {
|
|
|
338
338
|
{ name: 'isLoaded', type: 'bool', required: true },
|
|
339
339
|
{ name: 'supportsImages', type: 'bool', required: true },
|
|
340
340
|
{ name: 'expectedSize', type: 'uint', required: true },
|
|
341
|
-
{ name: 'actualSize', type: 'uint' }
|
|
341
|
+
{ name: 'actualSize', type: 'uint' },
|
|
342
|
+
{ name: 'label', type: 'string' }
|
|
342
343
|
]
|
|
343
344
|
});
|
|
344
345
|
ns.register({
|
|
@@ -566,7 +567,9 @@ export function registerHarnessTypes(ns) {
|
|
|
566
567
|
{ name: 'src', type: 'string', required: true },
|
|
567
568
|
{ name: 'projectionSrc', type: 'string' },
|
|
568
569
|
{ name: 'taskType', type: 'string' },
|
|
569
|
-
{ name: 'expectedSize', type: 'uint' }
|
|
570
|
+
{ name: 'expectedSize', type: 'uint' },
|
|
571
|
+
{ name: 'label', type: 'string' },
|
|
572
|
+
{ name: 'contextLength', type: 'uint' }
|
|
570
573
|
]
|
|
571
574
|
});
|
|
572
575
|
ns.register({
|
|
@@ -714,6 +717,10 @@ export function registerHarnessTypes(ns) {
|
|
|
714
717
|
{ name: 'mmprojSrc', type: 'string' }
|
|
715
718
|
]
|
|
716
719
|
});
|
|
720
|
+
ns.register({
|
|
721
|
+
name: 'set-model-idle-timeout-request',
|
|
722
|
+
fields: [{ name: 'ms', type: 'uint', required: true }]
|
|
723
|
+
});
|
|
717
724
|
}
|
|
718
725
|
export function registerHarnessApi(api) {
|
|
719
726
|
api.register({
|
|
@@ -866,4 +873,9 @@ export function registerHarnessApi(api) {
|
|
|
866
873
|
request: { name: '@harness/preview-model-source-request', stream: false },
|
|
867
874
|
response: { name: '@harness/preview-model-source-response', stream: false }
|
|
868
875
|
});
|
|
876
|
+
api.register({
|
|
877
|
+
name: 'set-model-idle-timeout',
|
|
878
|
+
request: { name: '@harness/set-model-idle-timeout-request', stream: false },
|
|
879
|
+
response: { name: '@harness/ok-response', stream: false }
|
|
880
|
+
});
|
|
869
881
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Version } from 'bare-semver';
|
|
2
2
|
export declare function currentReleaseVersion(root: string): Version;
|
|
3
|
-
export
|
|
3
|
+
export interface PreviousReleaseTagsOptions {
|
|
4
4
|
count?: number;
|
|
5
5
|
carries: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export declare function previousReleaseTags(root: string, { count, carries }: PreviousReleaseTagsOptions): string[];
|
|
@@ -16,13 +16,15 @@ const TAG_PREFIX = 'v';
|
|
|
16
16
|
export function previousReleaseTags(root, { count = 3, carries }) {
|
|
17
17
|
const current = currentReleaseVersion(root);
|
|
18
18
|
const listed = spawnSync('git', ['tag', '-l', `${TAG_PREFIX}*`], { cwd: root });
|
|
19
|
-
if (listed.status !== 0)
|
|
19
|
+
if (listed.status !== 0) {
|
|
20
20
|
throw new Error(`git tag -l failed: ${listed.stderr ?? ''}`);
|
|
21
|
+
}
|
|
21
22
|
const newestPerLine = new Map();
|
|
22
23
|
for (const line of (listed.stdout?.toString() ?? '').split('\n')) {
|
|
23
24
|
const parsed = parseTag(line.trim());
|
|
24
|
-
if (!parsed || Version.compare(parsed.version, current) > 0)
|
|
25
|
+
if (!parsed || Version.compare(parsed.version, current) > 0) {
|
|
25
26
|
continue;
|
|
27
|
+
}
|
|
26
28
|
const winner = newestPerLine.get(parsed.line);
|
|
27
29
|
if (!winner || Version.compare(parsed.version, winner.version) > 0) {
|
|
28
30
|
newestPerLine.set(parsed.line, parsed);
|
|
@@ -46,8 +48,9 @@ function parseTag(name) {
|
|
|
46
48
|
return null;
|
|
47
49
|
try {
|
|
48
50
|
const version = Version.parse(name.slice(TAG_PREFIX.length));
|
|
49
|
-
if (version.prerelease.length > 0)
|
|
51
|
+
if (version.prerelease.length > 0) {
|
|
50
52
|
return null;
|
|
53
|
+
}
|
|
51
54
|
return { tag: name, version, line: `${version.major}.${version.minor}` };
|
|
52
55
|
}
|
|
53
56
|
catch {
|
package/dist-lib/spec/bind.js
CHANGED
|
@@ -130,4 +130,7 @@ export function bindApi(rpc, api) {
|
|
|
130
130
|
if (api.previewModelSource) {
|
|
131
131
|
rpc.onPreviewModelSource((req) => api.previewModelSource(req));
|
|
132
132
|
}
|
|
133
|
+
if (api.setModelIdleTimeout) {
|
|
134
|
+
rpc.onSetModelIdleTimeout((req) => api.setModelIdleTimeout(req));
|
|
135
|
+
}
|
|
133
136
|
}
|
package/dist-lib/spec/calls.js
CHANGED
|
@@ -40,5 +40,6 @@ export function harnessClient(rpc) {
|
|
|
40
40
|
deleteKvCache: (input) => rpc.deleteKvCache(input),
|
|
41
41
|
detectLanguage: (input) => rpc.detectLanguage(input),
|
|
42
42
|
previewModelSource: (input) => rpc.previewModelSource(input),
|
|
43
|
+
setModelIdleTimeout: (input) => rpc.setModelIdleTimeout(input),
|
|
43
44
|
};
|
|
44
45
|
}
|
|
@@ -390,6 +390,19 @@
|
|
|
390
390
|
"stream": false
|
|
391
391
|
},
|
|
392
392
|
"version": 1
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"id": 30,
|
|
396
|
+
"name": "@harness/set-model-idle-timeout",
|
|
397
|
+
"request": {
|
|
398
|
+
"name": "@harness/set-model-idle-timeout-request",
|
|
399
|
+
"stream": false
|
|
400
|
+
},
|
|
401
|
+
"response": {
|
|
402
|
+
"name": "@harness/ok-response",
|
|
403
|
+
"stream": false
|
|
404
|
+
},
|
|
405
|
+
"version": 1
|
|
393
406
|
}
|
|
394
407
|
]
|
|
395
408
|
}
|
|
@@ -65,7 +65,9 @@ const methods = new Map([
|
|
|
65
65
|
['@harness/detect-language', 28],
|
|
66
66
|
[28, '@harness/detect-language'],
|
|
67
67
|
['@harness/preview-model-source', 29],
|
|
68
|
-
[29, '@harness/preview-model-source']
|
|
68
|
+
[29, '@harness/preview-model-source'],
|
|
69
|
+
['@harness/set-model-idle-timeout', 30],
|
|
70
|
+
[30, '@harness/set-model-idle-timeout']
|
|
69
71
|
])
|
|
70
72
|
|
|
71
73
|
class HRPC {
|
|
@@ -102,7 +104,8 @@ class HRPC {
|
|
|
102
104
|
['@harness/delete-overlay-skill', getEncoding('@harness/skill-name-request')],
|
|
103
105
|
['@harness/delete-kv-cache', getEncoding('@harness/kv-cache-delete-request')],
|
|
104
106
|
['@harness/detect-language', getEncoding('@harness/detect-language-request')],
|
|
105
|
-
['@harness/preview-model-source', getEncoding('@harness/preview-model-source-request')]
|
|
107
|
+
['@harness/preview-model-source', getEncoding('@harness/preview-model-source-request')],
|
|
108
|
+
['@harness/set-model-idle-timeout', getEncoding('@harness/set-model-idle-timeout-request')]
|
|
106
109
|
])
|
|
107
110
|
this._responseEncodings = new Map([
|
|
108
111
|
['@harness/completion', getEncoding('@harness/completion-event')],
|
|
@@ -134,7 +137,8 @@ class HRPC {
|
|
|
134
137
|
['@harness/delete-overlay-skill', getEncoding('@harness/delete-skill-response')],
|
|
135
138
|
['@harness/delete-kv-cache', getEncoding('@harness/kv-cache-deletion-response')],
|
|
136
139
|
['@harness/detect-language', getEncoding('@harness/detect-language-response')],
|
|
137
|
-
['@harness/preview-model-source', getEncoding('@harness/preview-model-source-response')]
|
|
140
|
+
['@harness/preview-model-source', getEncoding('@harness/preview-model-source-response')],
|
|
141
|
+
['@harness/set-model-idle-timeout', getEncoding('@harness/ok-response')]
|
|
138
142
|
])
|
|
139
143
|
this._rpc = new RPC(stream, async (req) => {
|
|
140
144
|
const command = methods.get(req.command)
|
|
@@ -352,6 +356,10 @@ class HRPC {
|
|
|
352
356
|
return this._call('@harness/preview-model-source', args)
|
|
353
357
|
}
|
|
354
358
|
|
|
359
|
+
async setModelIdleTimeout(args) {
|
|
360
|
+
return this._call('@harness/set-model-idle-timeout', args)
|
|
361
|
+
}
|
|
362
|
+
|
|
355
363
|
onCompletion(responseFn) {
|
|
356
364
|
this._handlers['@harness/completion'] = responseFn
|
|
357
365
|
}
|
|
@@ -472,6 +480,10 @@ class HRPC {
|
|
|
472
480
|
this._handlers['@harness/preview-model-source'] = responseFn
|
|
473
481
|
}
|
|
474
482
|
|
|
483
|
+
onSetModelIdleTimeout(responseFn) {
|
|
484
|
+
this._handlers['@harness/set-model-idle-timeout'] = responseFn
|
|
485
|
+
}
|
|
486
|
+
|
|
475
487
|
_requestIsStream(command) {
|
|
476
488
|
return [
|
|
477
489
|
'@harness/completion',
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// This file is autogenerated by the hyperschema compiler
|
|
2
|
-
// Schema Version:
|
|
2
|
+
// Schema Version: 15
|
|
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 = 15
|
|
10
10
|
|
|
11
11
|
// eslint-disable-next-line no-unused-vars
|
|
12
12
|
let version = VERSION
|
|
@@ -1610,17 +1610,19 @@ const encoding31 = {
|
|
|
1610
1610
|
c.string.preencode(state, m.type)
|
|
1611
1611
|
c.string.preencode(state, m.registryPath)
|
|
1612
1612
|
c.string.preencode(state, m.registrySource)
|
|
1613
|
-
state.end++ // max flag is
|
|
1613
|
+
state.end++ // max flag is 16 so always one byte
|
|
1614
1614
|
c.uint.preencode(state, m.expectedSize)
|
|
1615
1615
|
|
|
1616
1616
|
if (m.actualSize) c.uint.preencode(state, m.actualSize)
|
|
1617
|
+
if (version >= 15 && m.label) c.string.preencode(state, m.label)
|
|
1617
1618
|
},
|
|
1618
1619
|
encode(state, m) {
|
|
1619
1620
|
const flags =
|
|
1620
1621
|
(m.isCached ? 1 : 0) |
|
|
1621
1622
|
(m.isLoaded ? 2 : 0) |
|
|
1622
1623
|
(m.supportsImages ? 4 : 0) |
|
|
1623
|
-
(m.actualSize ? 8 : 0)
|
|
1624
|
+
(m.actualSize ? 8 : 0) |
|
|
1625
|
+
((version >= 15 && m.label) ? 16 : 0)
|
|
1624
1626
|
|
|
1625
1627
|
c.string.encode(state, m.name)
|
|
1626
1628
|
c.string.encode(state, m.type)
|
|
@@ -1630,6 +1632,7 @@ const encoding31 = {
|
|
|
1630
1632
|
c.uint.encode(state, m.expectedSize)
|
|
1631
1633
|
|
|
1632
1634
|
if (m.actualSize) c.uint.encode(state, m.actualSize)
|
|
1635
|
+
if (version >= 15 && m.label) c.string.encode(state, m.label)
|
|
1633
1636
|
},
|
|
1634
1637
|
decode(state) {
|
|
1635
1638
|
const r0 = c.string.decode(state)
|
|
@@ -1647,7 +1650,8 @@ const encoding31 = {
|
|
|
1647
1650
|
isLoaded: (flags & 2) !== 0,
|
|
1648
1651
|
supportsImages: (flags & 4) !== 0,
|
|
1649
1652
|
expectedSize: c.uint.decode(state),
|
|
1650
|
-
actualSize: (flags & 8) !== 0 ? c.uint.decode(state) : 0
|
|
1653
|
+
actualSize: (flags & 8) !== 0 ? c.uint.decode(state) : 0,
|
|
1654
|
+
label: (version >= 15 && (flags & 16) !== 0) ? c.string.decode(state) : null
|
|
1651
1655
|
}
|
|
1652
1656
|
}
|
|
1653
1657
|
}
|
|
@@ -2635,17 +2639,21 @@ const encoding65 = {
|
|
|
2635
2639
|
preencode(state, m) {
|
|
2636
2640
|
c.string.preencode(state, m.name)
|
|
2637
2641
|
c.string.preencode(state, m.src)
|
|
2638
|
-
state.end++ // max flag is
|
|
2642
|
+
state.end++ // max flag is 16 so always one byte
|
|
2639
2643
|
|
|
2640
2644
|
if (version >= 5 && m.projectionSrc) c.string.preencode(state, m.projectionSrc)
|
|
2641
2645
|
if (version >= 14 && m.taskType) c.string.preencode(state, m.taskType)
|
|
2642
2646
|
if (version >= 14 && m.expectedSize) c.uint.preencode(state, m.expectedSize)
|
|
2647
|
+
if (version >= 15 && m.label) c.string.preencode(state, m.label)
|
|
2648
|
+
if (version >= 15 && m.contextLength) c.uint.preencode(state, m.contextLength)
|
|
2643
2649
|
},
|
|
2644
2650
|
encode(state, m) {
|
|
2645
2651
|
const flags =
|
|
2646
2652
|
((version >= 5 && m.projectionSrc) ? 1 : 0) |
|
|
2647
2653
|
((version >= 14 && m.taskType) ? 2 : 0) |
|
|
2648
|
-
((version >= 14 && m.expectedSize) ? 4 : 0)
|
|
2654
|
+
((version >= 14 && m.expectedSize) ? 4 : 0) |
|
|
2655
|
+
((version >= 15 && m.label) ? 8 : 0) |
|
|
2656
|
+
((version >= 15 && m.contextLength) ? 16 : 0)
|
|
2649
2657
|
|
|
2650
2658
|
c.string.encode(state, m.name)
|
|
2651
2659
|
c.string.encode(state, m.src)
|
|
@@ -2654,6 +2662,8 @@ const encoding65 = {
|
|
|
2654
2662
|
if (version >= 5 && m.projectionSrc) c.string.encode(state, m.projectionSrc)
|
|
2655
2663
|
if (version >= 14 && m.taskType) c.string.encode(state, m.taskType)
|
|
2656
2664
|
if (version >= 14 && m.expectedSize) c.uint.encode(state, m.expectedSize)
|
|
2665
|
+
if (version >= 15 && m.label) c.string.encode(state, m.label)
|
|
2666
|
+
if (version >= 15 && m.contextLength) c.uint.encode(state, m.contextLength)
|
|
2657
2667
|
},
|
|
2658
2668
|
decode(state) {
|
|
2659
2669
|
const r0 = c.string.decode(state)
|
|
@@ -2665,7 +2675,9 @@ const encoding65 = {
|
|
|
2665
2675
|
src: r1,
|
|
2666
2676
|
projectionSrc: (version >= 5 && (flags & 1) !== 0) ? c.string.decode(state) : null,
|
|
2667
2677
|
taskType: (version >= 14 && (flags & 2) !== 0) ? c.string.decode(state) : null,
|
|
2668
|
-
expectedSize: (version >= 14 && (flags & 4) !== 0) ? c.uint.decode(state) : 0
|
|
2678
|
+
expectedSize: (version >= 14 && (flags & 4) !== 0) ? c.uint.decode(state) : 0,
|
|
2679
|
+
label: (version >= 15 && (flags & 8) !== 0) ? c.string.decode(state) : null,
|
|
2680
|
+
contextLength: (version >= 15 && (flags & 16) !== 0) ? c.uint.decode(state) : 0
|
|
2669
2681
|
}
|
|
2670
2682
|
}
|
|
2671
2683
|
}
|
|
@@ -3336,6 +3348,23 @@ const encoding87 = {
|
|
|
3336
3348
|
}
|
|
3337
3349
|
}
|
|
3338
3350
|
|
|
3351
|
+
// @harness/set-model-idle-timeout-request
|
|
3352
|
+
const encoding88 = {
|
|
3353
|
+
preencode(state, m) {
|
|
3354
|
+
c.uint.preencode(state, m.ms)
|
|
3355
|
+
},
|
|
3356
|
+
encode(state, m) {
|
|
3357
|
+
c.uint.encode(state, m.ms)
|
|
3358
|
+
},
|
|
3359
|
+
decode(state) {
|
|
3360
|
+
const r0 = c.uint.decode(state)
|
|
3361
|
+
|
|
3362
|
+
return {
|
|
3363
|
+
ms: r0
|
|
3364
|
+
}
|
|
3365
|
+
}
|
|
3366
|
+
}
|
|
3367
|
+
|
|
3339
3368
|
// @harness/completion-frame.grantedDrives, deferred due to recusive use
|
|
3340
3369
|
const encoding11_23 = c.array(c.frame(encoding60))
|
|
3341
3370
|
// @harness/skill.setupV2, deferred due to recusive use
|
|
@@ -3574,6 +3603,8 @@ function getEncoding(name) {
|
|
|
3574
3603
|
return encoding86
|
|
3575
3604
|
case '@harness/preview-model-source-response':
|
|
3576
3605
|
return encoding87
|
|
3606
|
+
case '@harness/set-model-idle-timeout-request':
|
|
3607
|
+
return encoding88
|
|
3577
3608
|
default:
|
|
3578
3609
|
throw new Error('Encoder not found ' + name)
|
|
3579
3610
|
}
|