@qvac/harness 0.1.0 → 0.1.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/dist/harness.bundle +8 -59
- package/dist/prebuilds-manifest.json +0 -8
- package/dist-lib/index.d.ts +240 -0
- package/dist-lib/index.js +1063 -0
- package/dist-lib/lib/audio-transcode-bare.d.ts +2 -0
- package/dist-lib/lib/audio-transcode-bare.js +145 -0
- package/dist-lib/lib/audio-transcode-node.d.ts +2 -0
- package/dist-lib/lib/audio-transcode-node.js +6 -0
- package/dist-lib/lib/capabilities/audio-resample.d.ts +14 -0
- package/dist-lib/lib/capabilities/audio-resample.js +72 -0
- package/dist-lib/lib/capabilities/completion.d.ts +288 -0
- package/dist-lib/lib/capabilities/completion.js +1077 -0
- package/dist-lib/lib/capabilities/download.d.ts +46 -0
- package/dist-lib/lib/capabilities/download.js +124 -0
- package/dist-lib/lib/capabilities/embed.d.ts +20 -0
- package/dist-lib/lib/capabilities/embed.js +13 -0
- package/dist-lib/lib/capabilities/kv-cache.d.ts +13 -0
- package/dist-lib/lib/capabilities/kv-cache.js +21 -0
- package/dist-lib/lib/capabilities/prompt-prefix.d.ts +6 -0
- package/dist-lib/lib/capabilities/prompt-prefix.js +10 -0
- package/dist-lib/lib/capabilities/speech-lexicon.d.ts +5 -0
- package/dist-lib/lib/capabilities/speech-lexicon.js +32 -0
- package/dist-lib/lib/capabilities/speech-text.d.ts +6 -0
- package/dist-lib/lib/capabilities/speech-text.js +79 -0
- package/dist-lib/lib/capabilities/tool-names.d.ts +3 -0
- package/dist-lib/lib/capabilities/tool-names.js +3 -0
- package/dist-lib/lib/capabilities/tool-selection.d.ts +43 -0
- package/dist-lib/lib/capabilities/tool-selection.js +60 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +9 -0
- package/dist-lib/lib/capabilities/tool-turns.js +101 -0
- package/dist-lib/lib/capabilities/usage-breakdown.d.ts +27 -0
- package/dist-lib/lib/capabilities/usage-breakdown.js +44 -0
- package/dist-lib/lib/capabilities/vision-history.d.ts +3 -0
- package/dist-lib/lib/capabilities/vision-history.js +21 -0
- package/dist-lib/lib/capabilities/voice.d.ts +78 -0
- package/dist-lib/lib/capabilities/voice.js +189 -0
- package/dist-lib/lib/connect.d.ts +76 -0
- package/dist-lib/lib/connect.js +789 -0
- package/dist-lib/lib/context-window.d.ts +7 -0
- package/dist-lib/lib/context-window.js +90 -0
- package/dist-lib/lib/contract-types.d.ts +210 -0
- package/dist-lib/lib/contract-types.js +1 -0
- package/dist-lib/lib/diagram-repair.d.ts +21 -0
- package/dist-lib/lib/diagram-repair.js +58 -0
- package/dist-lib/lib/dns-lookup.d.ts +1 -0
- package/dist-lib/lib/dns-lookup.js +13 -0
- package/dist-lib/lib/error-fields.d.ts +2 -0
- package/dist-lib/lib/error-fields.js +8 -0
- package/dist-lib/lib/fetch-node.d.ts +1 -0
- package/dist-lib/lib/fetch-node.js +1 -0
- package/dist-lib/lib/hardware/capability-probe.d.ts +9 -0
- package/dist-lib/lib/hardware/capability-probe.js +99 -0
- package/dist-lib/lib/hardware/gpu-classify.d.ts +2 -0
- package/dist-lib/lib/hardware/gpu-classify.js +32 -0
- package/dist-lib/lib/hardware/gpu-probe-addon.d.ts +2 -0
- package/dist-lib/lib/hardware/gpu-probe-addon.js +42 -0
- package/dist-lib/lib/hardware/gpu-stats.bare.d.ts +1 -0
- package/dist-lib/lib/hardware/gpu-stats.bare.js +24 -0
- package/dist-lib/lib/hardware/gpu-stats.stub.d.ts +1 -0
- package/dist-lib/lib/hardware/gpu-stats.stub.js +3 -0
- package/dist-lib/lib/hardware/memory-budget.d.ts +8 -0
- package/dist-lib/lib/hardware/memory-budget.js +1 -0
- package/dist-lib/lib/hardware/parsers.d.ts +7 -0
- package/dist-lib/lib/hardware/parsers.js +41 -0
- package/dist-lib/lib/headers-bare.d.ts +1 -0
- package/dist-lib/lib/headers-bare.js +1 -0
- package/dist-lib/lib/headers-node.d.ts +4 -0
- package/dist-lib/lib/headers-node.js +1 -0
- package/dist-lib/lib/helpers/buffer-burst.d.ts +1 -0
- package/dist-lib/lib/helpers/buffer-burst.js +20 -0
- package/dist-lib/lib/helpers/control-tokens.d.ts +7 -0
- package/dist-lib/lib/helpers/control-tokens.js +32 -0
- package/dist-lib/lib/helpers/join-guard.d.ts +6 -0
- package/dist-lib/lib/helpers/join-guard.js +46 -0
- package/dist-lib/lib/helpers/markup-stream-filter.d.ts +5 -0
- package/dist-lib/lib/helpers/markup-stream-filter.js +75 -0
- package/dist-lib/lib/helpers/race-abort.d.ts +5 -0
- package/dist-lib/lib/helpers/race-abort.js +18 -0
- package/dist-lib/lib/helpers/retry-memo.d.ts +5 -0
- package/dist-lib/lib/helpers/retry-memo.js +12 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +33 -0
- package/dist-lib/lib/helpers/run-outcome.js +204 -0
- package/dist-lib/lib/helpers/spawn-path.d.ts +5 -0
- package/dist-lib/lib/helpers/spawn-path.js +57 -0
- package/dist-lib/lib/helpers/text-coalescer.d.ts +15 -0
- package/dist-lib/lib/helpers/text-coalescer.js +34 -0
- package/dist-lib/lib/helpers/thinking.d.ts +8 -0
- package/dist-lib/lib/helpers/thinking.js +95 -0
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +20 -0
- package/dist-lib/lib/helpers/tool-call-markup.js +201 -0
- package/dist-lib/lib/helpers/tool-intent.d.ts +7 -0
- package/dist-lib/lib/helpers/tool-intent.js +21 -0
- package/dist-lib/lib/helpers/tool-label.d.ts +8 -0
- package/dist-lib/lib/helpers/tool-label.js +131 -0
- package/dist-lib/lib/hooks/built-in/arg-repair.d.ts +5 -0
- package/dist-lib/lib/hooks/built-in/arg-repair.js +88 -0
- package/dist-lib/lib/hooks/built-in/egress.d.ts +5 -0
- package/dist-lib/lib/hooks/built-in/egress.js +29 -0
- package/dist-lib/lib/hooks/built-in/index.d.ts +3 -0
- package/dist-lib/lib/hooks/built-in/index.js +3 -0
- package/dist-lib/lib/hooks/built-in/skill-catalog.d.ts +10 -0
- package/dist-lib/lib/hooks/built-in/skill-catalog.js +17 -0
- package/dist-lib/lib/hooks/pipeline.d.ts +20 -0
- package/dist-lib/lib/hooks/pipeline.js +49 -0
- package/dist-lib/lib/hooks/registry.d.ts +2 -0
- package/dist-lib/lib/hooks/registry.js +6 -0
- package/dist-lib/lib/hooks/run.d.ts +5 -0
- package/dist-lib/lib/hooks/run.js +83 -0
- package/dist-lib/lib/hooks/types.d.ts +57 -0
- package/dist-lib/lib/hooks/types.js +1 -0
- package/dist-lib/lib/log.d.ts +5 -0
- package/dist-lib/lib/log.js +37 -0
- package/dist-lib/lib/model-download-progress.d.ts +22 -0
- package/dist-lib/lib/model-download-progress.js +95 -0
- package/dist-lib/lib/models/context.d.ts +5 -0
- package/dist-lib/lib/models/context.js +12 -0
- package/dist-lib/lib/models/embed-config.d.ts +14 -0
- package/dist-lib/lib/models/embed-config.js +31 -0
- package/dist-lib/lib/models/gpu-selection.d.ts +3 -0
- package/dist-lib/lib/models/gpu-selection.js +26 -0
- package/dist-lib/lib/models/kv-cache.d.ts +4 -0
- package/dist-lib/lib/models/kv-cache.js +6 -0
- package/dist-lib/lib/models/llm-presets.d.ts +10 -0
- package/dist-lib/lib/models/llm-presets.js +58 -0
- package/dist-lib/lib/models/model-catalog-constants.d.ts +29 -0
- package/dist-lib/lib/models/model-catalog-constants.js +103 -0
- package/dist-lib/lib/models/model-catalog.d.ts +125 -0
- package/dist-lib/lib/models/model-catalog.js +371 -0
- package/dist-lib/lib/models/model-delete.d.ts +18 -0
- package/dist-lib/lib/models/model-delete.js +47 -0
- package/dist-lib/lib/models/model-handle.d.ts +18 -0
- package/dist-lib/lib/models/model-handle.js +33 -0
- package/dist-lib/lib/models/model-list.d.ts +42 -0
- package/dist-lib/lib/models/model-list.js +123 -0
- package/dist-lib/lib/models/model-pool.d.ts +116 -0
- package/dist-lib/lib/models/model-pool.js +356 -0
- package/dist-lib/lib/models/model-source.d.ts +6 -0
- package/dist-lib/lib/models/model-source.js +21 -0
- package/dist-lib/lib/models/music-catalog.d.ts +12 -0
- package/dist-lib/lib/models/music-catalog.js +26 -0
- package/dist-lib/lib/models/opencl-cache.d.ts +5 -0
- package/dist-lib/lib/models/opencl-cache.js +50 -0
- package/dist-lib/lib/models/sdk-faults.d.ts +21 -0
- package/dist-lib/lib/models/sdk-faults.js +66 -0
- package/dist-lib/lib/models/tool-dialect.d.ts +2 -0
- package/dist-lib/lib/models/tool-dialect.js +19 -0
- package/dist-lib/lib/models/tts-model-default.d.ts +3 -0
- package/dist-lib/lib/models/tts-model-default.js +13 -0
- package/dist-lib/lib/no-redirect-fetch-bare.d.ts +15 -0
- package/dist-lib/lib/no-redirect-fetch-bare.js +59 -0
- package/dist-lib/lib/no-redirect-fetch-impl.d.ts +39 -0
- package/dist-lib/lib/no-redirect-fetch-impl.js +80 -0
- package/dist-lib/lib/no-redirect-fetch-node.d.ts +4 -0
- package/dist-lib/lib/no-redirect-fetch-node.js +52 -0
- package/dist-lib/lib/prompt.d.ts +22 -0
- package/dist-lib/lib/prompt.js +77 -0
- package/dist-lib/lib/queue.d.ts +9 -0
- package/dist-lib/lib/queue.js +48 -0
- package/dist-lib/lib/resolution-detector.d.ts +5 -0
- package/dist-lib/lib/resolution-detector.js +100 -0
- package/dist-lib/lib/rpc-session.d.ts +8 -0
- package/dist-lib/lib/rpc-session.js +20 -0
- package/dist-lib/lib/sdk-config-loader.node.d.ts +1 -0
- package/dist-lib/lib/sdk-config-loader.node.js +1 -0
- package/dist-lib/lib/sdk-loader.d.ts +30 -0
- package/dist-lib/lib/sdk-loader.js +53 -0
- package/dist-lib/lib/sdk-storage.d.ts +8 -0
- package/dist-lib/lib/sdk-storage.js +24 -0
- package/dist-lib/lib/serve.d.ts +3 -0
- package/dist-lib/lib/serve.js +612 -0
- package/dist-lib/lib/spawn.d.ts +62 -0
- package/dist-lib/lib/spawn.js +71 -0
- package/dist-lib/lib/staging.d.ts +4 -0
- package/dist-lib/lib/staging.js +28 -0
- package/dist-lib/lib/storage.d.ts +18 -0
- package/dist-lib/lib/storage.js +26 -0
- package/dist-lib/lib/tmp-path.d.ts +7 -0
- package/dist-lib/lib/tmp-path.js +17 -0
- package/dist-lib/lib/tool-call-display.d.ts +21 -0
- package/dist-lib/lib/tool-call-display.js +1 -0
- package/dist-lib/lib/tools/catalog.d.ts +13 -0
- package/dist-lib/lib/tools/catalog.js +13 -0
- package/dist-lib/lib/tools/create-documents.d.ts +3 -0
- package/dist-lib/lib/tools/create-documents.js +87 -0
- package/dist-lib/lib/tools/edit-documents.d.ts +3 -0
- package/dist-lib/lib/tools/edit-documents.js +122 -0
- package/dist-lib/lib/tools/edit-image.d.ts +25 -0
- package/dist-lib/lib/tools/edit-image.js +271 -0
- package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +27 -0
- package/dist-lib/lib/tools/exec/adapters/adapter.js +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/attachments.d.ts +26 -0
- package/dist-lib/lib/tools/exec/adapters/python/attachments.js +160 -0
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.d.ts +7 -0
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +290 -0
- package/dist-lib/lib/tools/exec/adapters/python/loader.d.ts +11 -0
- package/dist-lib/lib/tools/exec/adapters/python/loader.js +94 -0
- package/dist-lib/lib/tools/exec/adapters/python/memfs.d.ts +47 -0
- package/dist-lib/lib/tools/exec/adapters/python/memfs.js +85 -0
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.d.ts +13 -0
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.js +129 -0
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.d.ts +19 -0
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.js +107 -0
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +75 -0
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +1094 -0
- package/dist-lib/lib/tools/exec/adapters/python/run-session.d.ts +75 -0
- package/dist-lib/lib/tools/exec/adapters/python/run-session.js +273 -0
- package/dist-lib/lib/tools/exec/adapters/python/wheels.d.ts +38 -0
- package/dist-lib/lib/tools/exec/adapters/python/wheels.js +102 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.d.ts +7 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.js +188 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.d.ts +1 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +105 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.d.ts +38 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.js +41 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-bare.d.ts +2 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-bare.js +30 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.d.ts +13 -0
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.js +45 -0
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.d.ts +12 -0
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +20 -0
- package/dist-lib/lib/tools/exec/obsidian/cli-process.d.ts +8 -0
- package/dist-lib/lib/tools/exec/obsidian/cli-process.js +74 -0
- package/dist-lib/lib/tools/exec/obsidian/cli.d.ts +18 -0
- package/dist-lib/lib/tools/exec/obsidian/cli.js +153 -0
- package/dist-lib/lib/tools/exec/obsidian/command.d.ts +5 -0
- package/dist-lib/lib/tools/exec/obsidian/command.js +18 -0
- package/dist-lib/lib/tools/exec/obsidian/guidance.d.ts +5 -0
- package/dist-lib/lib/tools/exec/obsidian/guidance.js +18 -0
- package/dist-lib/lib/tools/exec/obsidian/note-name.d.ts +1 -0
- package/dist-lib/lib/tools/exec/obsidian/note-name.js +6 -0
- package/dist-lib/lib/tools/exec/obsidian/output.d.ts +1 -0
- package/dist-lib/lib/tools/exec/obsidian/output.js +31 -0
- package/dist-lib/lib/tools/exec/obsidian/route.d.ts +19 -0
- package/dist-lib/lib/tools/exec/obsidian/route.js +85 -0
- package/dist-lib/lib/tools/exec/obsidian/safe-path.d.ts +3 -0
- package/dist-lib/lib/tools/exec/obsidian/safe-path.js +56 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-create.d.ts +1 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-create.js +40 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-fs.d.ts +3 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-fs.js +57 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.d.ts +20 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.js +171 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-read.d.ts +11 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-read.js +119 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-write.d.ts +7 -0
- package/dist-lib/lib/tools/exec/obsidian/vault-write.js +134 -0
- package/dist-lib/lib/tools/exec/runner.d.ts +62 -0
- package/dist-lib/lib/tools/exec/runner.js +87 -0
- package/dist-lib/lib/tools/exec/scope.d.ts +3 -0
- package/dist-lib/lib/tools/exec/scope.js +97 -0
- package/dist-lib/lib/tools/exec/shell-argv.d.ts +2 -0
- package/dist-lib/lib/tools/exec/shell-argv.js +48 -0
- package/dist-lib/lib/tools/exec.d.ts +29 -0
- package/dist-lib/lib/tools/exec.js +459 -0
- package/dist-lib/lib/tools/file-glob.d.ts +15 -0
- package/dist-lib/lib/tools/file-glob.js +112 -0
- package/dist-lib/lib/tools/fs/drive.d.ts +26 -0
- package/dist-lib/lib/tools/fs/drive.js +1 -0
- package/dist-lib/lib/tools/fs/glob.d.ts +1 -0
- package/dist-lib/lib/tools/fs/glob.js +34 -0
- package/dist-lib/lib/tools/fs/local.d.ts +2 -0
- package/dist-lib/lib/tools/fs/local.js +29 -0
- package/dist-lib/lib/tools/fs/read.d.ts +2 -0
- package/dist-lib/lib/tools/fs/read.js +17 -0
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +40 -0
- package/dist-lib/lib/tools/fs/remote-protocol.js +1 -0
- package/dist-lib/lib/tools/fs/remote.d.ts +17 -0
- package/dist-lib/lib/tools/fs/remote.js +131 -0
- package/dist-lib/lib/tools/fs/scope.d.ts +37 -0
- package/dist-lib/lib/tools/fs/scope.js +130 -0
- package/dist-lib/lib/tools/fs/walk.d.ts +15 -0
- package/dist-lib/lib/tools/fs/walk.js +38 -0
- package/dist-lib/lib/tools/fs/write.d.ts +4 -0
- package/dist-lib/lib/tools/fs/write.js +5 -0
- package/dist-lib/lib/tools/generate-image.d.ts +111 -0
- package/dist-lib/lib/tools/generate-image.js +369 -0
- package/dist-lib/lib/tools/generate-music.d.ts +124 -0
- package/dist-lib/lib/tools/generate-music.js +522 -0
- package/dist-lib/lib/tools/grep.d.ts +5 -0
- package/dist-lib/lib/tools/grep.js +158 -0
- package/dist-lib/lib/tools/http-methods.d.ts +1 -0
- package/dist-lib/lib/tools/http-methods.js +1 -0
- package/dist-lib/lib/tools/http-request/encode-fields.d.ts +2 -0
- package/dist-lib/lib/tools/http-request/encode-fields.js +69 -0
- package/dist-lib/lib/tools/http-request/truncate-response.d.ts +1 -0
- package/dist-lib/lib/tools/http-request/truncate-response.js +83 -0
- package/dist-lib/lib/tools/http-request/utils.d.ts +27 -0
- package/dist-lib/lib/tools/http-request/utils.js +84 -0
- package/dist-lib/lib/tools/http-request.d.ts +20 -0
- package/dist-lib/lib/tools/http-request.js +177 -0
- package/dist-lib/lib/tools/mcp/utils.d.ts +47 -0
- package/dist-lib/lib/tools/mcp/utils.js +172 -0
- package/dist-lib/lib/tools/mcp-call.d.ts +14 -0
- package/dist-lib/lib/tools/mcp-call.js +155 -0
- package/dist-lib/lib/tools/model-args.d.ts +1 -0
- package/dist-lib/lib/tools/model-args.js +4 -0
- package/dist-lib/lib/tools/operations/builders.d.ts +17 -0
- package/dist-lib/lib/tools/operations/builders.js +179 -0
- package/dist-lib/lib/tools/operations/compile.d.ts +7 -0
- package/dist-lib/lib/tools/operations/compile.js +92 -0
- package/dist-lib/lib/tools/operations/gmail-message.d.ts +15 -0
- package/dist-lib/lib/tools/operations/gmail-message.js +62 -0
- package/dist-lib/lib/tools/operations/manifest.d.ts +60 -0
- package/dist-lib/lib/tools/operations/manifest.js +50 -0
- package/dist-lib/lib/tools/outbound-guard.d.ts +10 -0
- package/dist-lib/lib/tools/outbound-guard.js +127 -0
- package/dist-lib/lib/tools/private-ip.d.ts +4 -0
- package/dist-lib/lib/tools/private-ip.js +126 -0
- package/dist-lib/lib/tools/rag-search.d.ts +2 -0
- package/dist-lib/lib/tools/rag-search.js +98 -0
- package/dist-lib/lib/tools/read-files.d.ts +5 -0
- package/dist-lib/lib/tools/read-files.js +153 -0
- package/dist-lib/lib/tools/skill.d.ts +10 -0
- package/dist-lib/lib/tools/skill.js +123 -0
- package/dist-lib/lib/tools/skills/auth-resolver.d.ts +43 -0
- package/dist-lib/lib/tools/skills/auth-resolver.js +121 -0
- package/dist-lib/lib/tools/skills/bin-check.d.ts +9 -0
- package/dist-lib/lib/tools/skills/bin-check.js +56 -0
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +2 -0
- package/dist-lib/lib/tools/skills/bundled-dir.js +117 -0
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +4 -0
- package/dist-lib/lib/tools/skills/bundled-hash.js +12 -0
- package/dist-lib/lib/tools/skills/catalog.d.ts +60 -0
- package/dist-lib/lib/tools/skills/catalog.js +203 -0
- package/dist-lib/lib/tools/skills/cli-argv.d.ts +9 -0
- package/dist-lib/lib/tools/skills/cli-argv.js +147 -0
- package/dist-lib/lib/tools/skills/cli-schema-check.d.ts +3 -0
- package/dist-lib/lib/tools/skills/cli-schema-check.js +62 -0
- package/dist-lib/lib/tools/skills/cli-schema-load.d.ts +4 -0
- package/dist-lib/lib/tools/skills/cli-schema-load.js +90 -0
- package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +30 -0
- package/dist-lib/lib/tools/skills/cli-schema-types.js +1 -0
- package/dist-lib/lib/tools/skills/cli-schema.d.ts +7 -0
- package/dist-lib/lib/tools/skills/cli-schema.js +35 -0
- package/dist-lib/lib/tools/skills/credential-check.d.ts +20 -0
- package/dist-lib/lib/tools/skills/credential-check.js +94 -0
- package/dist-lib/lib/tools/skills/credential-grants.d.ts +9 -0
- package/dist-lib/lib/tools/skills/credential-grants.js +25 -0
- package/dist-lib/lib/tools/skills/credential-health.d.ts +8 -0
- package/dist-lib/lib/tools/skills/credential-health.js +51 -0
- package/dist-lib/lib/tools/skills/credential-slots.d.ts +7 -0
- package/dist-lib/lib/tools/skills/credential-slots.js +8 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +23 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +68 -0
- package/dist-lib/lib/tools/skills/index.d.ts +5 -0
- package/dist-lib/lib/tools/skills/index.js +5 -0
- package/dist-lib/lib/tools/skills/manifest-parse.d.ts +12 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +199 -0
- package/dist-lib/lib/tools/skills/manifest.d.ts +47 -0
- package/dist-lib/lib/tools/skills/manifest.js +1 -0
- package/dist-lib/lib/tools/skills/mention-name.d.ts +1 -0
- package/dist-lib/lib/tools/skills/mention-name.js +4 -0
- package/dist-lib/lib/tools/skills/mention.d.ts +6 -0
- package/dist-lib/lib/tools/skills/mention.js +42 -0
- package/dist-lib/lib/tools/skills/obsidian-readiness.d.ts +16 -0
- package/dist-lib/lib/tools/skills/obsidian-readiness.js +95 -0
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +18 -0
- package/dist-lib/lib/tools/skills/overlay-crud.js +98 -0
- package/dist-lib/lib/tools/skills/overlay-dir.d.ts +2 -0
- package/dist-lib/lib/tools/skills/overlay-dir.js +22 -0
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +13 -0
- package/dist-lib/lib/tools/skills/overlay-watch.js +44 -0
- package/dist-lib/lib/tools/skills/scope-key.d.ts +7 -0
- package/dist-lib/lib/tools/skills/scope-key.js +7 -0
- package/dist-lib/lib/tools/skills/setup-routes.d.ts +4 -0
- package/dist-lib/lib/tools/skills/setup-routes.js +14 -0
- package/dist-lib/lib/tools/skills/skill-settings.d.ts +16 -0
- package/dist-lib/lib/tools/skills/skill-settings.js +33 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.d.ts +12 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.js +14 -0
- package/dist-lib/lib/tools/skills/skill-state.d.ts +40 -0
- package/dist-lib/lib/tools/skills/skill-state.js +117 -0
- package/dist-lib/lib/tools/skills/tool-grants.d.ts +5 -0
- package/dist-lib/lib/tools/skills/tool-grants.js +14 -0
- package/dist-lib/lib/tools/toolsets.d.ts +8 -0
- package/dist-lib/lib/tools/toolsets.js +20 -0
- package/dist-lib/lib/tools/url-guard.d.ts +8 -0
- package/dist-lib/lib/tools/url-guard.js +40 -0
- package/dist-lib/lib/tools/web-fetch.d.ts +8 -0
- package/dist-lib/lib/tools/web-fetch.js +302 -0
- package/dist-lib/lib/tools/web-search.d.ts +6 -0
- package/dist-lib/lib/tools/web-search.js +55 -0
- package/dist-lib/lib/transport.d.ts +12 -0
- package/dist-lib/lib/transport.js +59 -0
- package/dist-lib/lib/user-agent.d.ts +1 -0
- package/dist-lib/lib/user-agent.js +1 -0
- package/dist-lib/lib/validating-lookup.d.ts +17 -0
- package/dist-lib/lib/validating-lookup.js +25 -0
- package/dist-lib/lib/wav-encode.d.ts +5 -0
- package/dist-lib/lib/wav-encode.js +24 -0
- package/dist-lib/lib/web-fetch/embedded-state.d.ts +1 -0
- package/dist-lib/lib/web-fetch/embedded-state.js +131 -0
- package/dist-lib/lib/web-fetch/extract.d.ts +6 -0
- package/dist-lib/lib/web-fetch/extract.js +65 -0
- package/dist-lib/lib/web-fetch/images.d.ts +3 -0
- package/dist-lib/lib/web-fetch/images.js +43 -0
- package/dist-lib/lib/web-fetch/video.d.ts +5 -0
- package/dist-lib/lib/web-fetch/video.js +42 -0
- package/dist-lib/lib/web-search/engine-registry.d.ts +7 -0
- package/dist-lib/lib/web-search/engine-registry.js +17 -0
- package/dist-lib/lib/web-search/engines/aol.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/aol.js +81 -0
- package/dist-lib/lib/web-search/engines/bing.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/bing.js +111 -0
- package/dist-lib/lib/web-search/engines/brave.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/brave.js +59 -0
- package/dist-lib/lib/web-search/engines/duckduckgo.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/duckduckgo.js +112 -0
- package/dist-lib/lib/web-search/engines/google.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/google.js +92 -0
- package/dist-lib/lib/web-search/engines/wikipedia.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/wikipedia.js +37 -0
- package/dist-lib/lib/web-search/engines/yahoo.d.ts +3 -0
- package/dist-lib/lib/web-search/engines/yahoo.js +81 -0
- package/dist-lib/lib/web-search/fetch-html.d.ts +25 -0
- package/dist-lib/lib/web-search/fetch-html.js +97 -0
- package/dist-lib/lib/web-search/format-results.d.ts +3 -0
- package/dist-lib/lib/web-search/format-results.js +14 -0
- package/dist-lib/lib/web-search/html-helpers.d.ts +3 -0
- package/dist-lib/lib/web-search/html-helpers.js +24 -0
- package/dist-lib/lib/web-search/merge-results.d.ts +2 -0
- package/dist-lib/lib/web-search/merge-results.js +53 -0
- package/dist-lib/lib/web-search/orchestrator.d.ts +14 -0
- package/dist-lib/lib/web-search/orchestrator.js +50 -0
- package/dist-lib/lib/web-search/types.d.ts +34 -0
- package/dist-lib/lib/web-search/types.js +1 -0
- package/dist-lib/lib/web-search/url-helpers.d.ts +1 -0
- package/dist-lib/lib/web-search/url-helpers.js +11 -0
- package/dist-lib/lib/web-search/url-normalize.d.ts +1 -0
- package/dist-lib/lib/web-search/url-normalize.js +25 -0
- package/dist-lib/lib/web-search/user-agents.d.ts +3 -0
- package/dist-lib/lib/web-search/user-agents.js +3 -0
- package/dist-lib/lib/wire.d.ts +50 -0
- package/dist-lib/lib/wire.js +145 -0
- package/dist-lib/schema/baseline.d.ts +8 -0
- package/dist-lib/schema/baseline.js +35 -0
- package/dist-lib/schema/build.d.ts +1 -0
- package/dist-lib/schema/build.js +39 -0
- package/dist-lib/schema/generate.d.ts +20 -0
- package/dist-lib/schema/generate.js +149 -0
- package/dist-lib/schema/harness.d.ts +2 -0
- package/dist-lib/schema/harness.js +745 -0
- package/dist-lib/schema/release-tags.d.ts +5 -0
- package/dist-lib/schema/release-tags.js +58 -0
- package/dist-lib/spec/bind.d.ts +2 -0
- package/dist-lib/spec/bind.js +124 -0
- package/dist-lib/spec/calls.d.ts +3 -0
- package/dist-lib/spec/calls.js +41 -0
- package/dist-lib/spec/hrpc/hrpc.json +356 -0
- package/dist-lib/spec/hrpc/index.d.ts +3 -0
- package/dist-lib/spec/hrpc/index.js +463 -0
- package/dist-lib/spec/hrpc/messages.d.ts +4 -0
- package/dist-lib/spec/hrpc/messages.js +3102 -0
- package/dist-lib/spec/hyperschema/index.js +3102 -0
- package/dist-lib/spec/hyperschema/schema.json +2290 -0
- package/dist-lib/spec/hyperschema/types.d.ts +554 -0
- package/dist-lib/spec/index.d.ts +8 -0
- package/dist-lib/spec/index.js +1 -0
- package/package.json +239 -64
- package/.gitattributes +0 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Message } from './capabilities/completion.ts';
|
|
2
|
+
export declare const TOOL_RESULT_TRUNCATION_MARKER = "\n[tool result truncated for context]\n";
|
|
3
|
+
export interface ContextCandidate {
|
|
4
|
+
history: Message[];
|
|
5
|
+
droppedTurns: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function contextCandidates(history: Message[]): ContextCandidate[];
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { TOOL_CONTINUATION_NUDGE } from "./capabilities/tool-turns.js";
|
|
2
|
+
export const TOOL_RESULT_TRUNCATION_MARKER = '\n[tool result truncated for context]\n';
|
|
3
|
+
function isTurnBoundary(message) {
|
|
4
|
+
return message.role === 'user' && message.content !== TOOL_CONTINUATION_NUDGE;
|
|
5
|
+
}
|
|
6
|
+
export function contextCandidates(history) {
|
|
7
|
+
const { prefix, turns } = splitTurns(history);
|
|
8
|
+
if (!turns.length)
|
|
9
|
+
return [{ history, droppedTurns: 0 }];
|
|
10
|
+
const maxDropped = Math.max(0, turns.length - 1);
|
|
11
|
+
const candidates = dropCounts(maxDropped).map((droppedTurns) => ({
|
|
12
|
+
history: droppedTurns ? [...prefix, ...turns.slice(droppedTurns).flat()] : history,
|
|
13
|
+
droppedTurns
|
|
14
|
+
}));
|
|
15
|
+
appendToolCompactions(candidates);
|
|
16
|
+
return candidates;
|
|
17
|
+
}
|
|
18
|
+
function splitTurns(history) {
|
|
19
|
+
const firstUser = history.findIndex(isTurnBoundary);
|
|
20
|
+
if (firstUser === -1)
|
|
21
|
+
return { prefix: history, turns: [] };
|
|
22
|
+
const prefix = history.slice(0, firstUser);
|
|
23
|
+
const starts = [];
|
|
24
|
+
for (let i = firstUser; i < history.length; i++) {
|
|
25
|
+
if (isTurnBoundary(history[i]))
|
|
26
|
+
starts.push(i);
|
|
27
|
+
}
|
|
28
|
+
const turns = starts.map((start, index) => history.slice(start, starts[index + 1]));
|
|
29
|
+
return { prefix, turns };
|
|
30
|
+
}
|
|
31
|
+
function dropCounts(max) {
|
|
32
|
+
const counts = [0];
|
|
33
|
+
for (let step = 1; counts[counts.length - 1] < max; step *= 2) {
|
|
34
|
+
const next = Math.min(max, step);
|
|
35
|
+
if (next !== counts[counts.length - 1])
|
|
36
|
+
counts.push(next);
|
|
37
|
+
}
|
|
38
|
+
return counts;
|
|
39
|
+
}
|
|
40
|
+
function appendToolCompactions(candidates) {
|
|
41
|
+
const last = candidates[candidates.length - 1];
|
|
42
|
+
if (!last)
|
|
43
|
+
return;
|
|
44
|
+
const tools = compactableTools(last.history);
|
|
45
|
+
let history = last.history;
|
|
46
|
+
while (true) {
|
|
47
|
+
const selected = longestTool(tools);
|
|
48
|
+
if (!selected)
|
|
49
|
+
return;
|
|
50
|
+
selected.target = Math.max(TOOL_RESULT_TRUNCATION_MARKER.length, Math.floor(selected.target / 2));
|
|
51
|
+
history = history.map(compactTool.bind(null, selected));
|
|
52
|
+
candidates.push({ history, droppedTurns: last.droppedTurns });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function compactableTools(history) {
|
|
56
|
+
let newestUser = -1;
|
|
57
|
+
for (let index = history.length - 1; index >= 0; index--) {
|
|
58
|
+
if (!isTurnBoundary(history[index]))
|
|
59
|
+
continue;
|
|
60
|
+
newestUser = index;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
if (newestUser === -1)
|
|
64
|
+
return [];
|
|
65
|
+
const tools = [];
|
|
66
|
+
for (let index = newestUser + 1; index < history.length; index++) {
|
|
67
|
+
const message = history[index];
|
|
68
|
+
if (message.role !== 'tool' || message.content.length <= TOOL_RESULT_TRUNCATION_MARKER.length) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
tools.push({ index, original: message.content, target: message.content.length });
|
|
72
|
+
}
|
|
73
|
+
return tools;
|
|
74
|
+
}
|
|
75
|
+
function longestTool(tools) {
|
|
76
|
+
return tools
|
|
77
|
+
.filter((tool) => tool.target > TOOL_RESULT_TRUNCATION_MARKER.length)
|
|
78
|
+
.sort((a, b) => b.target - a.target)[0];
|
|
79
|
+
}
|
|
80
|
+
function compactContent(content, target) {
|
|
81
|
+
const retained = target - TOOL_RESULT_TRUNCATION_MARKER.length;
|
|
82
|
+
const head = Math.ceil(retained / 2);
|
|
83
|
+
const tail = Math.floor(retained / 2);
|
|
84
|
+
return `${content.slice(0, head)}${TOOL_RESULT_TRUNCATION_MARKER}${tail ? content.slice(-tail) : ''}`;
|
|
85
|
+
}
|
|
86
|
+
function compactTool(selected, message, index) {
|
|
87
|
+
if (index !== selected.index)
|
|
88
|
+
return message;
|
|
89
|
+
return { ...message, content: compactContent(selected.original, selected.target) };
|
|
90
|
+
}
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import type { HarnessCapabilityProfile } from '../spec/hyperschema/types.d.ts';
|
|
2
|
+
import type { ApproveFn, AskUserFn, AttachFn, FetchAttachmentFn, ProgressFn, RagSearchFn, ResourceDescriptor, ResponseFormat } from './capabilities/completion.ts';
|
|
3
|
+
import type { KvCacheDeletionResult } from './capabilities/kv-cache.ts';
|
|
4
|
+
import type { MemoryBudget } from './hardware/memory-budget.ts';
|
|
5
|
+
import type { EmbedDevice } from './models/embed-config.ts';
|
|
6
|
+
import type { LlmGenerationParams } from './models/llm-presets.ts';
|
|
7
|
+
import type { DeleteModelSummary } from './models/model-delete.ts';
|
|
8
|
+
import type { ListModelsOptions, ModelInfo } from './models/model-list.ts';
|
|
9
|
+
import type { ToolCatalogEntry } from './tools/catalog.ts';
|
|
10
|
+
import type { ManagedSkill, SkillFileContent } from './tools/skills/overlay-crud.ts';
|
|
11
|
+
import type { DriveOpFn, GrantedDrive } from './tools/fs/remote.ts';
|
|
12
|
+
import type { ResolvedSkillCatalogEntry } from './tools/skills/catalog.ts';
|
|
13
|
+
import type { InstallStep, SkillSetup } from './tools/skills/manifest.ts';
|
|
14
|
+
export type { InstallStep, ListModelsOptions, ModelInfo, ResolvedSkillCatalogEntry, ResourceDescriptor, SkillSetup, ToolCatalogEntry };
|
|
15
|
+
export type ApprovalCall = Parameters<ApproveFn>[0];
|
|
16
|
+
export interface ChatMessage {
|
|
17
|
+
role: 'system' | 'user' | 'assistant' | 'tool';
|
|
18
|
+
content: string;
|
|
19
|
+
attachments?: {
|
|
20
|
+
path: string;
|
|
21
|
+
}[] | null;
|
|
22
|
+
}
|
|
23
|
+
export interface AgentKnobs {
|
|
24
|
+
id?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
bio?: string;
|
|
27
|
+
reasoning?: 'inherit' | 'enabled' | 'disabled' | null;
|
|
28
|
+
enabledTools?: string[] | null;
|
|
29
|
+
enabledSkills?: string[] | null;
|
|
30
|
+
toolsScope?: 'all' | 'selected' | null;
|
|
31
|
+
skillsScope?: 'all' | 'selected' | null;
|
|
32
|
+
ctxSize?: number | null;
|
|
33
|
+
kvCacheK?: string | null;
|
|
34
|
+
kvCacheV?: string | null;
|
|
35
|
+
imageModelChoice?: string | null;
|
|
36
|
+
imageSteps?: number | null;
|
|
37
|
+
imageWidth?: number | null;
|
|
38
|
+
imageHeight?: number | null;
|
|
39
|
+
approvalMode?: 'ask' | 'skip-all' | null;
|
|
40
|
+
disabledToolsets?: string[] | null;
|
|
41
|
+
}
|
|
42
|
+
export interface CompletionContext {
|
|
43
|
+
model: string;
|
|
44
|
+
agent: AgentKnobs;
|
|
45
|
+
messages: ChatMessage[];
|
|
46
|
+
cacheKey?: string;
|
|
47
|
+
thinkingDefault?: string;
|
|
48
|
+
toolConfigs?: Record<string, Record<string, unknown>>;
|
|
49
|
+
generationParams?: LlmGenerationParams;
|
|
50
|
+
responseFormat?: ResponseFormat;
|
|
51
|
+
grantedDirs?: string[];
|
|
52
|
+
grantedDrives?: GrantedDrive[];
|
|
53
|
+
driveOp?: DriveOpFn;
|
|
54
|
+
grantedWriteDirs?: string[];
|
|
55
|
+
approve?: (call: ApprovalCall) => Promise<boolean>;
|
|
56
|
+
attach?: AttachFn;
|
|
57
|
+
fetchAttachment?: FetchAttachmentFn;
|
|
58
|
+
ragSearch?: RagSearchFn;
|
|
59
|
+
progress?: ProgressFn;
|
|
60
|
+
askUser?: AskUserFn;
|
|
61
|
+
signal?: {
|
|
62
|
+
aborted?: boolean;
|
|
63
|
+
addEventListener?: (type: 'abort', fn: () => void, opts?: {
|
|
64
|
+
once?: boolean;
|
|
65
|
+
}) => void;
|
|
66
|
+
removeEventListener?: (type: 'abort', fn: () => void) => void;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
export interface HarnessEvent {
|
|
70
|
+
type: string;
|
|
71
|
+
text?: string;
|
|
72
|
+
message?: string;
|
|
73
|
+
[key: string]: unknown;
|
|
74
|
+
}
|
|
75
|
+
export interface ModelState {
|
|
76
|
+
status: string;
|
|
77
|
+
model?: string;
|
|
78
|
+
percentage?: number;
|
|
79
|
+
downloaded?: number;
|
|
80
|
+
total?: number;
|
|
81
|
+
message?: string;
|
|
82
|
+
catalogChanged?: boolean;
|
|
83
|
+
loaded?: Array<{
|
|
84
|
+
model: string;
|
|
85
|
+
refs: number;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
export interface WarmModelContext {
|
|
89
|
+
model: string;
|
|
90
|
+
agent?: AgentKnobs;
|
|
91
|
+
signal?: CompletionContext['signal'];
|
|
92
|
+
}
|
|
93
|
+
export interface DownloadContext {
|
|
94
|
+
model: string;
|
|
95
|
+
addon?: string;
|
|
96
|
+
seed?: boolean;
|
|
97
|
+
signal?: CompletionContext['signal'];
|
|
98
|
+
}
|
|
99
|
+
export interface EmbedContext {
|
|
100
|
+
model: string;
|
|
101
|
+
texts: string[];
|
|
102
|
+
signal?: CompletionContext['signal'];
|
|
103
|
+
}
|
|
104
|
+
export interface TranscribeContext {
|
|
105
|
+
model: string;
|
|
106
|
+
audio: Buffer;
|
|
107
|
+
signal?: CompletionContext['signal'];
|
|
108
|
+
}
|
|
109
|
+
export interface SpeakContext {
|
|
110
|
+
model: string;
|
|
111
|
+
text: string;
|
|
112
|
+
signal?: CompletionContext['signal'];
|
|
113
|
+
}
|
|
114
|
+
export interface SpeakResult {
|
|
115
|
+
audio: Buffer;
|
|
116
|
+
sampleRate: number;
|
|
117
|
+
}
|
|
118
|
+
export interface SpeakStreamContext {
|
|
119
|
+
model: string;
|
|
120
|
+
text: AsyncIterable<string>;
|
|
121
|
+
signal?: CompletionContext['signal'];
|
|
122
|
+
}
|
|
123
|
+
export interface HarnessDiagnostics {
|
|
124
|
+
models: Array<{
|
|
125
|
+
model: string;
|
|
126
|
+
refs: number;
|
|
127
|
+
}>;
|
|
128
|
+
suspended: boolean;
|
|
129
|
+
sdkLoaded: boolean;
|
|
130
|
+
toolNames: string[];
|
|
131
|
+
skills: string[];
|
|
132
|
+
device?: 'cpu' | 'gpu';
|
|
133
|
+
}
|
|
134
|
+
export interface HarnessInfo {
|
|
135
|
+
toolNames: string[];
|
|
136
|
+
skills: string[];
|
|
137
|
+
supportsImages: boolean;
|
|
138
|
+
supportsKvCacheDeletion?: boolean;
|
|
139
|
+
}
|
|
140
|
+
export interface CapabilityInfo {
|
|
141
|
+
capabilityProfile: HarnessCapabilityProfile;
|
|
142
|
+
recommendedModelName: string;
|
|
143
|
+
memoryBudget?: MemoryBudget;
|
|
144
|
+
}
|
|
145
|
+
export interface HarnessContract {
|
|
146
|
+
completion(context: CompletionContext): AsyncIterable<HarnessEvent>;
|
|
147
|
+
download?(context: DownloadContext): AsyncIterable<HarnessEvent>;
|
|
148
|
+
describe?(): Promise<HarnessInfo | null> | HarnessInfo;
|
|
149
|
+
embed?(context: EmbedContext): Promise<number[][]>;
|
|
150
|
+
transcribe?(context: TranscribeContext): Promise<string>;
|
|
151
|
+
speak?(context: SpeakContext): Promise<SpeakResult>;
|
|
152
|
+
speakStream?(context: SpeakStreamContext): AsyncIterable<SpeakResult>;
|
|
153
|
+
getEmbeddingDevice?(): EmbedDevice | Promise<EmbedDevice>;
|
|
154
|
+
setEmbeddingDevice?(device: EmbedDevice): Promise<void> | void;
|
|
155
|
+
on?(event: 'model' | 'status', listener: (...args: never[]) => void): unknown;
|
|
156
|
+
off?(event: 'model' | 'status', listener: (...args: never[]) => void): unknown;
|
|
157
|
+
presuspend?(): Promise<void> | void;
|
|
158
|
+
suspend?(): Promise<void> | void;
|
|
159
|
+
wakeup?(): Promise<void> | void;
|
|
160
|
+
resume?(): Promise<void> | void;
|
|
161
|
+
skills?(agentId?: string | null, modelName?: string | null, options?: {
|
|
162
|
+
readonly refresh?: boolean;
|
|
163
|
+
readonly skipCredentialProbe?: boolean;
|
|
164
|
+
}): Promise<ResolvedSkillCatalogEntry[]>;
|
|
165
|
+
tools?(): Promise<ToolCatalogEntry[]>;
|
|
166
|
+
setCredentials?(entries: ReadonlyArray<{
|
|
167
|
+
key: string;
|
|
168
|
+
token?: string | null;
|
|
169
|
+
expiresAt?: number | null;
|
|
170
|
+
agentId?: string | null;
|
|
171
|
+
skill?: string | null;
|
|
172
|
+
}>): void | Promise<void>;
|
|
173
|
+
setSkillSettings?(entries: ReadonlyArray<{
|
|
174
|
+
skill: string;
|
|
175
|
+
key: string;
|
|
176
|
+
value: string;
|
|
177
|
+
agentId?: string | null;
|
|
178
|
+
}>): void | Promise<void>;
|
|
179
|
+
listManagedSkills?(): Promise<ManagedSkill[]>;
|
|
180
|
+
readSkillFile?(name: string): Promise<SkillFileContent | null>;
|
|
181
|
+
writeSkillFile?(name: string, content: string): Promise<{
|
|
182
|
+
readonly ok: boolean;
|
|
183
|
+
}>;
|
|
184
|
+
copyBaseForEdit?(name: string): Promise<{
|
|
185
|
+
readonly copied: boolean;
|
|
186
|
+
}>;
|
|
187
|
+
deleteOverlaySkill?(name: string): Promise<{
|
|
188
|
+
readonly removed: boolean;
|
|
189
|
+
}>;
|
|
190
|
+
list?(options?: ListModelsOptions): Promise<ModelInfo[]>;
|
|
191
|
+
warmModel?(context: WarmModelContext): Promise<void>;
|
|
192
|
+
deleteModel?(name: string): Promise<DeleteModelSummary>;
|
|
193
|
+
clearKvCache?(): Promise<KvCacheDeletionResult>;
|
|
194
|
+
infraModels?(profile: string): Promise<ReadonlyArray<{
|
|
195
|
+
name: string;
|
|
196
|
+
addon: string;
|
|
197
|
+
}>>;
|
|
198
|
+
setCustomModels?(entries: ReadonlyArray<{
|
|
199
|
+
name: string;
|
|
200
|
+
src: string;
|
|
201
|
+
projectionSrc?: string;
|
|
202
|
+
}>): void | Promise<void>;
|
|
203
|
+
capability?(): Promise<CapabilityInfo>;
|
|
204
|
+
diagnostics?(): HarnessDiagnostics;
|
|
205
|
+
}
|
|
206
|
+
export interface HarnessStatus {
|
|
207
|
+
state: 'running' | 'died';
|
|
208
|
+
error?: string;
|
|
209
|
+
code?: string;
|
|
210
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export declare const DIAGRAM_REPAIR_PROMPT_PREFIX = "<!-- qvac:diagram-repair:";
|
|
2
|
+
export declare const DIAGRAM_REPAIR_PROMPT_SUFFIX: string;
|
|
3
|
+
export declare function diagramRepairPromptCount(content: string, parentRunId?: string): number | null;
|
|
4
|
+
export declare function isDiagramRepairPrompt(content: string): boolean;
|
|
5
|
+
export declare function completeMermaidDiagramCount(content: string): number;
|
|
6
|
+
export declare function diagramRepairAccepted(text: string): boolean;
|
|
7
|
+
type DiagramRepairRecord = {
|
|
8
|
+
readonly id: string;
|
|
9
|
+
readonly seq: number;
|
|
10
|
+
readonly runId?: string | null;
|
|
11
|
+
readonly parentId?: string | null;
|
|
12
|
+
};
|
|
13
|
+
export type DiagramRepairLink = {
|
|
14
|
+
readonly expectedCount: number;
|
|
15
|
+
readonly parentId: string;
|
|
16
|
+
readonly promptId: string;
|
|
17
|
+
readonly promptText: string;
|
|
18
|
+
readonly runId: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function diagramRepairLinks<T extends DiagramRepairRecord>(records: ReadonlyArray<T>, textOf: (record: T) => string | null): ReadonlyArray<DiagramRepairLink>;
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
export const DIAGRAM_REPAIR_PROMPT_PREFIX = '<!-- qvac:diagram-repair:';
|
|
2
|
+
export const DIAGRAM_REPAIR_PROMPT_SUFFIX = 'Rewrite the complete previous answer with corrected Mermaid code blocks. Preserve all non-diagram content. Return only the corrected answer. Do not call tools.\n' +
|
|
3
|
+
'Common fixes: put every label with spaces or punctuation in double quotes like A["Send (HTTP)"]; never use lowercase end as a node label - write "End"; the first line inside the fence must be the diagram type; close the fence before any prose - never leave a sentence inside it; give every node a unique id.';
|
|
4
|
+
export function diagramRepairPromptCount(content, parentRunId) {
|
|
5
|
+
const match = /^<!-- qvac:diagram-repair:(\d+):([^\s>]+) -->\n(\d+) Mermaid diagram(?:s)? in your previous answer fail(?:s)? to render\.\n/.exec(content);
|
|
6
|
+
if (!match || !content.endsWith(`\n\n${DIAGRAM_REPAIR_PROMPT_SUFFIX}`))
|
|
7
|
+
return null;
|
|
8
|
+
const expected = Number(match[1]);
|
|
9
|
+
return Number.isSafeInteger(expected) &&
|
|
10
|
+
expected > 0 &&
|
|
11
|
+
Number(match[3]) > 0 &&
|
|
12
|
+
(!parentRunId || match[2] === parentRunId)
|
|
13
|
+
? expected
|
|
14
|
+
: null;
|
|
15
|
+
}
|
|
16
|
+
export function isDiagramRepairPrompt(content) {
|
|
17
|
+
return diagramRepairPromptCount(content) !== null;
|
|
18
|
+
}
|
|
19
|
+
export function completeMermaidDiagramCount(content) {
|
|
20
|
+
const fence = /^[ \t]{0,3}(`{3,}|~{3,})[ \t]*mermaid[ \t]*\r?\n([\s\S]*?)^[ \t]{0,3}\1[ \t]*$/gm;
|
|
21
|
+
return [...content.matchAll(fence)].filter((match) => match[2]?.trim()).length;
|
|
22
|
+
}
|
|
23
|
+
export function diagramRepairAccepted(text) {
|
|
24
|
+
return completeMermaidDiagramCount(text) > 0;
|
|
25
|
+
}
|
|
26
|
+
export function diagramRepairLinks(records, textOf) {
|
|
27
|
+
const ordered = [...records].sort((left, right) => left.seq - right.seq);
|
|
28
|
+
const byId = new Map(ordered.map((record) => [record.id, record]));
|
|
29
|
+
const used = new Set();
|
|
30
|
+
return ordered.flatMap((child) => {
|
|
31
|
+
if (!child.runId || !child.parentId)
|
|
32
|
+
return [];
|
|
33
|
+
const parent = byId.get(child.parentId);
|
|
34
|
+
if (!parent?.runId)
|
|
35
|
+
return [];
|
|
36
|
+
const prompt = [...ordered]
|
|
37
|
+
.reverse()
|
|
38
|
+
.find((candidate) => candidate.seq > parent.seq &&
|
|
39
|
+
candidate.seq < child.seq &&
|
|
40
|
+
!used.has(candidate.id) &&
|
|
41
|
+
diagramRepairPromptCount(textOf(candidate) ?? '', parent.runId ?? undefined) !== null);
|
|
42
|
+
const promptText = prompt ? textOf(prompt) : null;
|
|
43
|
+
const expectedCount = diagramRepairPromptCount(promptText ?? '', parent.runId);
|
|
44
|
+
if (prompt)
|
|
45
|
+
used.add(prompt.id);
|
|
46
|
+
return prompt && promptText && expectedCount
|
|
47
|
+
? [
|
|
48
|
+
{
|
|
49
|
+
expectedCount,
|
|
50
|
+
parentId: child.parentId,
|
|
51
|
+
promptId: prompt.id,
|
|
52
|
+
promptText,
|
|
53
|
+
runId: child.runId
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
|
+
: [];
|
|
57
|
+
});
|
|
58
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function lookupHost(hostname: string): Promise<string[]>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as dns from '#dns';
|
|
2
|
+
export function lookupHost(hostname) {
|
|
3
|
+
return new Promise((resolve, reject) => {
|
|
4
|
+
const callback = (err, addresses) => {
|
|
5
|
+
if (err) {
|
|
6
|
+
reject(err);
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
resolve((addresses ?? []).map((entry) => entry.address));
|
|
10
|
+
};
|
|
11
|
+
dns.lookup(hostname, { all: true }, callback);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export function errorMessage(err) {
|
|
2
|
+
return err instanceof Error ? err.message : String(err);
|
|
3
|
+
}
|
|
4
|
+
export function errorCode(err) {
|
|
5
|
+
if (!err || typeof err !== 'object' || !('code' in err))
|
|
6
|
+
return undefined;
|
|
7
|
+
return typeof err.code === 'string' ? err.code : undefined;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default fetch;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default fetch;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { CapabilityInfo } from '../contract-types.ts';
|
|
2
|
+
export interface PlatformReads {
|
|
3
|
+
totalmem(): number;
|
|
4
|
+
platform(): string;
|
|
5
|
+
readFile(path: string): Promise<string | null>;
|
|
6
|
+
run(command: string): Promise<string | null>;
|
|
7
|
+
readGpuStats(): unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare function probeCapabilityProfile(reads: PlatformReads): Promise<CapabilityInfo>;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import process from 'process';
|
|
2
|
+
import { capabilityProfileToModelName } from "../models/model-catalog.js";
|
|
3
|
+
import { probeWithAddon } from "./gpu-probe-addon.js";
|
|
4
|
+
import { mobileBudget, parseNvidiaSmiOutput, parseRocmSmiOutput, parseWindowsRegistryOutput, sharedRamBudget } from "./parsers.js";
|
|
5
|
+
const GIB = 1024 * 1024 * 1024;
|
|
6
|
+
const WINDOWS_REGISTRY_QUERY = "(Get-ItemProperty 'HKLM:\\SYSTEM\\ControlSet001\\Control\\Class\\{4d36e968-e325-11ce-bfc1-08002be10318}\\0*' -Name 'HardwareInformation.qwMemorySize' -ErrorAction SilentlyContinue).'HardwareInformation.qwMemorySize' | Sort-Object -Descending | Select-Object -First 1";
|
|
7
|
+
const SYSFS_VRAM_PATHS = [
|
|
8
|
+
'/sys/class/drm/card0/device/mem_info_vram_total',
|
|
9
|
+
'/sys/class/drm/card1/device/mem_info_vram_total'
|
|
10
|
+
];
|
|
11
|
+
function pickTier(availableBytes) {
|
|
12
|
+
if (availableBytes >= 48 * GIB)
|
|
13
|
+
return 'xhigh';
|
|
14
|
+
if (availableBytes >= 30 * GIB)
|
|
15
|
+
return 'high';
|
|
16
|
+
if (availableBytes >= 8 * GIB)
|
|
17
|
+
return 'mid';
|
|
18
|
+
return 'low';
|
|
19
|
+
}
|
|
20
|
+
function tierProfile(budget) {
|
|
21
|
+
if (budget.source === 'mobile' || budget.source === 'software' || budget.source === 'no-gpu') {
|
|
22
|
+
return 'low';
|
|
23
|
+
}
|
|
24
|
+
return pickTier(budget.availableBytes);
|
|
25
|
+
}
|
|
26
|
+
function recommend(budget) {
|
|
27
|
+
const profile = tierProfile(budget);
|
|
28
|
+
return {
|
|
29
|
+
capabilityProfile: profile,
|
|
30
|
+
recommendedModelName: capabilityProfileToModelName(profile),
|
|
31
|
+
memoryBudget: {
|
|
32
|
+
...budget,
|
|
33
|
+
totalBytes: Math.floor(budget.totalBytes),
|
|
34
|
+
availableBytes: Math.floor(budget.availableBytes)
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
async function probeSysfs(reads) {
|
|
39
|
+
for (const path of SYSFS_VRAM_PATHS) {
|
|
40
|
+
const raw = await reads.readFile(path);
|
|
41
|
+
if (!raw)
|
|
42
|
+
continue;
|
|
43
|
+
const bytes = Number.parseInt(raw.trim(), 10);
|
|
44
|
+
if (!Number.isNaN(bytes) && bytes > 0) {
|
|
45
|
+
return { totalBytes: bytes, availableBytes: bytes, source: 'vram' };
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
async function probeDesktop(reads) {
|
|
51
|
+
const ram = reads.totalmem();
|
|
52
|
+
const addon = probeWithAddon(reads.readGpuStats(), ram);
|
|
53
|
+
if (addon && addon.source === 'vram')
|
|
54
|
+
return addon;
|
|
55
|
+
const nvidia = await reads.run('nvidia-smi --query-gpu=memory.total --format=csv,noheader,nounits');
|
|
56
|
+
const nvidiaBudget = nvidia ? parseNvidiaSmiOutput(nvidia) : null;
|
|
57
|
+
if (nvidiaBudget)
|
|
58
|
+
return nvidiaBudget;
|
|
59
|
+
const rocm = await reads.run('rocm-smi --showmeminfo vram');
|
|
60
|
+
const rocmBudget = rocm ? parseRocmSmiOutput(rocm) : null;
|
|
61
|
+
if (rocmBudget)
|
|
62
|
+
return rocmBudget;
|
|
63
|
+
const sysfs = await probeSysfs(reads);
|
|
64
|
+
if (sysfs)
|
|
65
|
+
return sysfs;
|
|
66
|
+
const registry = await reads.run(`powershell -Command "${WINDOWS_REGISTRY_QUERY}"`);
|
|
67
|
+
const registryBudget = registry ? parseWindowsRegistryOutput(registry, ram) : null;
|
|
68
|
+
if (registryBudget)
|
|
69
|
+
return registryBudget;
|
|
70
|
+
if (addon)
|
|
71
|
+
return addon;
|
|
72
|
+
return { ...sharedRamBudget(ram), source: 'no-gpu' };
|
|
73
|
+
}
|
|
74
|
+
async function isPixel(reads) {
|
|
75
|
+
const out = await reads.run('getprop ro.product.brand');
|
|
76
|
+
return out?.trim().toLowerCase() === 'google';
|
|
77
|
+
}
|
|
78
|
+
async function probeMemoryBudget(reads) {
|
|
79
|
+
const os = reads.platform();
|
|
80
|
+
if (os === 'android' || os === 'ios')
|
|
81
|
+
return mobileBudget(reads.totalmem(), await isPixel(reads));
|
|
82
|
+
if (os === 'darwin')
|
|
83
|
+
return sharedRamBudget(reads.totalmem());
|
|
84
|
+
return probeDesktop(reads);
|
|
85
|
+
}
|
|
86
|
+
function forcedProfile() {
|
|
87
|
+
if (process.env['QVAC_WORKBENCH_E2E'] === '1')
|
|
88
|
+
return 'mid';
|
|
89
|
+
if (process.env['QVAC_WORKBENCH_FORCE_TINY_MODEL'] === '1')
|
|
90
|
+
return 'tiny';
|
|
91
|
+
return undefined;
|
|
92
|
+
}
|
|
93
|
+
export async function probeCapabilityProfile(reads) {
|
|
94
|
+
const forced = forcedProfile();
|
|
95
|
+
if (forced) {
|
|
96
|
+
return { capabilityProfile: forced, recommendedModelName: capabilityProfileToModelName(forced) };
|
|
97
|
+
}
|
|
98
|
+
return recommend(await probeMemoryBudget(reads));
|
|
99
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
const DISCRETE_GPU = [
|
|
2
|
+
/nvidia/i,
|
|
3
|
+
/geforce/i,
|
|
4
|
+
/quadro/i,
|
|
5
|
+
/tesla/i,
|
|
6
|
+
/amd radeon rx/i,
|
|
7
|
+
/radeon rx/i,
|
|
8
|
+
/radeon pro w/i,
|
|
9
|
+
/\barc\b.*\b[ab]\d{2,}/i,
|
|
10
|
+
/adreno/i,
|
|
11
|
+
/mali-g/i,
|
|
12
|
+
/apple m\d/i
|
|
13
|
+
];
|
|
14
|
+
const INTEGRATED_GPU = [
|
|
15
|
+
/intel.*(hd|uhd|iris)/i,
|
|
16
|
+
/amd radeon(?! rx| pro w)/i,
|
|
17
|
+
/radeon vega/i,
|
|
18
|
+
/microsoft basic render/i
|
|
19
|
+
];
|
|
20
|
+
const SOFTWARE_GPU = [/llvmpipe/i, /swrast/i, /mesa/i];
|
|
21
|
+
export function classifyGpu(name) {
|
|
22
|
+
for (const re of DISCRETE_GPU)
|
|
23
|
+
if (re.test(name))
|
|
24
|
+
return 'discrete';
|
|
25
|
+
for (const re of INTEGRATED_GPU)
|
|
26
|
+
if (re.test(name))
|
|
27
|
+
return 'integrated';
|
|
28
|
+
for (const re of SOFTWARE_GPU)
|
|
29
|
+
if (re.test(name))
|
|
30
|
+
return 'software';
|
|
31
|
+
return 'integrated';
|
|
32
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { classifyGpu } from "./gpu-classify.js";
|
|
3
|
+
import { IGPU_LIE_THRESHOLD, sharedRamBudget } from "./parsers.js";
|
|
4
|
+
const GpuDeviceSchema = z.object({
|
|
5
|
+
name: z.string(),
|
|
6
|
+
videoMemoryBytes: z.number()
|
|
7
|
+
});
|
|
8
|
+
const StatsSchema = z.object({
|
|
9
|
+
memory: z.object({ totalBytes: z.number() }).optional(),
|
|
10
|
+
gpu: z.object({ devices: z.array(GpuDeviceSchema) }).optional()
|
|
11
|
+
});
|
|
12
|
+
function classifyBestDevice(devices, systemRamBytes) {
|
|
13
|
+
for (const device of devices) {
|
|
14
|
+
const cls = classifyGpu(device.name);
|
|
15
|
+
if (cls === 'software')
|
|
16
|
+
continue;
|
|
17
|
+
if (cls === 'discrete') {
|
|
18
|
+
const vram = device.videoMemoryBytes;
|
|
19
|
+
if (vram > systemRamBytes * IGPU_LIE_THRESHOLD) {
|
|
20
|
+
return { ...sharedRamBudget(systemRamBytes), source: 'integrated', gpuClass: 'integrated' };
|
|
21
|
+
}
|
|
22
|
+
return { totalBytes: vram, availableBytes: vram, source: 'vram', gpuClass: 'discrete' };
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
export function probeWithAddon(rawStats, systemRamBytes) {
|
|
28
|
+
const parsed = StatsSchema.safeParse(rawStats);
|
|
29
|
+
if (!parsed.success)
|
|
30
|
+
return null;
|
|
31
|
+
const devices = parsed.data.gpu?.devices ?? [];
|
|
32
|
+
if (devices.length === 0)
|
|
33
|
+
return null;
|
|
34
|
+
const totalRamBytes = parsed.data.memory?.totalBytes ?? systemRamBytes;
|
|
35
|
+
const best = classifyBestDevice(devices, totalRamBytes);
|
|
36
|
+
if (best)
|
|
37
|
+
return best;
|
|
38
|
+
if (devices.every((device) => classifyGpu(device.name) === 'software')) {
|
|
39
|
+
return { ...sharedRamBudget(totalRamBytes), source: 'software' };
|
|
40
|
+
}
|
|
41
|
+
return { ...sharedRamBudget(totalRamBytes), source: 'integrated', gpuClass: 'integrated' };
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readSystemStats(): unknown;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import os from 'os';
|
|
2
|
+
import GPUInfo from 'bare-gpu-info';
|
|
3
|
+
export function readSystemStats() {
|
|
4
|
+
try {
|
|
5
|
+
const info = new GPUInfo();
|
|
6
|
+
try {
|
|
7
|
+
const devices = [];
|
|
8
|
+
for (const gpu of info) {
|
|
9
|
+
if (typeof gpu.memory !== 'number' || !gpu.name)
|
|
10
|
+
continue;
|
|
11
|
+
devices.push({ name: gpu.name, videoMemoryBytes: gpu.memory });
|
|
12
|
+
}
|
|
13
|
+
if (devices.length === 0)
|
|
14
|
+
return null;
|
|
15
|
+
return { memory: { totalBytes: os.totalmem() }, gpu: { devices } };
|
|
16
|
+
}
|
|
17
|
+
finally {
|
|
18
|
+
info.destroy();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function readSystemStats(): unknown;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type MemoryBudgetSource = 'vram' | 'shared' | 'mobile' | 'integrated' | 'no-gpu' | 'software';
|
|
2
|
+
export type GpuClass = 'discrete' | 'integrated';
|
|
3
|
+
export interface MemoryBudget {
|
|
4
|
+
readonly totalBytes: number;
|
|
5
|
+
readonly availableBytes: number;
|
|
6
|
+
readonly source: MemoryBudgetSource;
|
|
7
|
+
readonly gpuClass?: GpuClass;
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|