@qvac/harness 0.1.0 → 0.1.2
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 +13 -64
- 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.bare.d.ts +1 -0
- package/dist-lib/lib/sdk-config-loader.bare.js +9 -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,16 @@
|
|
|
1
|
+
export declare const OBSIDIAN_SKILL_NAME = "obsidian";
|
|
2
|
+
export declare const OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY = "obsidian_vault_path";
|
|
3
|
+
export declare const OBSIDIAN_BIN_CANDIDATES: Readonly<Record<string, readonly string[]>>;
|
|
4
|
+
export declare const OBSIDIAN_CONFIG_CANDIDATES: Readonly<Record<string, readonly string[]>>;
|
|
5
|
+
export declare function expandObsidianPath(candidate: string, env?: Record<string, string | undefined>, home?: string): string;
|
|
6
|
+
export declare function firstExistingPath(candidates: readonly string[], expand: (candidate: string) => string, exists: (candidate: string) => boolean): string | null;
|
|
7
|
+
export type ObsidianPathProbe = {
|
|
8
|
+
expand?: (candidate: string) => string;
|
|
9
|
+
exists?: (candidate: string) => boolean;
|
|
10
|
+
readText?: (candidate: string) => string;
|
|
11
|
+
};
|
|
12
|
+
export declare function obsidianInstallState(platform: string | undefined, probe?: ObsidianPathProbe): 'installed' | 'missing';
|
|
13
|
+
export declare function parseObsidianCliEnabled(text: string): boolean | null;
|
|
14
|
+
export declare function obsidianCliState(platform: string | undefined, probe?: ObsidianPathProbe): 'enabled' | 'disabled' | 'unknown';
|
|
15
|
+
export declare function isSandboxedWorkbenchInstall(env?: Record<string, string | undefined>): boolean;
|
|
16
|
+
export declare function isObsidianVaultPath(value: string | null, existsDir?: (candidate: string) => boolean): boolean;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import { homedir } from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import process from 'process';
|
|
5
|
+
export const OBSIDIAN_SKILL_NAME = 'obsidian';
|
|
6
|
+
export const OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY = 'obsidian_vault_path';
|
|
7
|
+
export const OBSIDIAN_BIN_CANDIDATES = {
|
|
8
|
+
darwin: [
|
|
9
|
+
'/Applications/Obsidian.app/Contents/MacOS/obsidian',
|
|
10
|
+
'~/Applications/Obsidian.app/Contents/MacOS/obsidian',
|
|
11
|
+
'/usr/local/bin/obsidian'
|
|
12
|
+
],
|
|
13
|
+
linux: [
|
|
14
|
+
'/usr/bin/obsidian',
|
|
15
|
+
'/usr/local/bin/obsidian',
|
|
16
|
+
'~/.local/bin/obsidian',
|
|
17
|
+
'/opt/Obsidian/obsidian',
|
|
18
|
+
'/snap/bin/obsidian'
|
|
19
|
+
],
|
|
20
|
+
win32: [
|
|
21
|
+
'%LOCALAPPDATA%\\Programs\\Obsidian\\Obsidian.exe',
|
|
22
|
+
'%LOCALAPPDATA%\\Obsidian\\Obsidian.exe',
|
|
23
|
+
'%ProgramFiles%\\Obsidian\\Obsidian.exe',
|
|
24
|
+
'%ProgramFiles(x86)%\\Obsidian\\Obsidian.exe'
|
|
25
|
+
]
|
|
26
|
+
};
|
|
27
|
+
export const OBSIDIAN_CONFIG_CANDIDATES = {
|
|
28
|
+
darwin: ['~/Library/Application Support/obsidian/obsidian.json'],
|
|
29
|
+
linux: [
|
|
30
|
+
'~/.config/obsidian/obsidian.json',
|
|
31
|
+
'~/snap/obsidian/current/.config/obsidian/obsidian.json',
|
|
32
|
+
'~/.var/app/md.obsidian.Obsidian/config/obsidian/obsidian.json'
|
|
33
|
+
],
|
|
34
|
+
win32: ['%APPDATA%\\obsidian\\obsidian.json']
|
|
35
|
+
};
|
|
36
|
+
function environment() {
|
|
37
|
+
return process.env;
|
|
38
|
+
}
|
|
39
|
+
export function expandObsidianPath(candidate, env = environment(), home = homedir()) {
|
|
40
|
+
const withHome = candidate.startsWith('~/') ? path.join(home, candidate.slice(2)) : candidate;
|
|
41
|
+
return withHome.replace(/\$([A-Za-z_][A-Za-z0-9_]*)|%([^%]+)%/g, (_match, unix, windows) => env[unix ?? windows ?? ''] ?? '');
|
|
42
|
+
}
|
|
43
|
+
export function firstExistingPath(candidates, expand, exists) {
|
|
44
|
+
for (const candidate of candidates) {
|
|
45
|
+
const expanded = expand(candidate);
|
|
46
|
+
if (expanded && exists(expanded))
|
|
47
|
+
return expanded;
|
|
48
|
+
}
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
export function obsidianInstallState(platform, probe = {}) {
|
|
52
|
+
const expand = probe.expand ?? ((candidate) => expandObsidianPath(candidate));
|
|
53
|
+
const exists = probe.exists ?? ((candidate) => fs.existsSync(candidate));
|
|
54
|
+
const installed = firstExistingPath(OBSIDIAN_BIN_CANDIDATES[platform ?? ''] ?? [], expand, exists);
|
|
55
|
+
return installed ? 'installed' : 'missing';
|
|
56
|
+
}
|
|
57
|
+
export function parseObsidianCliEnabled(text) {
|
|
58
|
+
try {
|
|
59
|
+
const value = JSON.parse(text);
|
|
60
|
+
return typeof value.cli === 'boolean' ? value.cli : null;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export function obsidianCliState(platform, probe = {}) {
|
|
67
|
+
const expand = probe.expand ?? ((candidate) => expandObsidianPath(candidate));
|
|
68
|
+
const exists = probe.exists ?? ((candidate) => fs.existsSync(candidate));
|
|
69
|
+
const readText = probe.readText ?? ((candidate) => fs.readFileSync(candidate, 'utf8'));
|
|
70
|
+
const config = firstExistingPath(OBSIDIAN_CONFIG_CANDIDATES[platform ?? ''] ?? [], expand, exists);
|
|
71
|
+
if (!config)
|
|
72
|
+
return 'unknown';
|
|
73
|
+
try {
|
|
74
|
+
const enabled = parseObsidianCliEnabled(readText(config));
|
|
75
|
+
return enabled === null ? 'unknown' : enabled ? 'enabled' : 'disabled';
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
return 'unknown';
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export function isSandboxedWorkbenchInstall(env = environment()) {
|
|
82
|
+
return Boolean(env.SNAP || env.FLATPAK_ID);
|
|
83
|
+
}
|
|
84
|
+
export function isObsidianVaultPath(value, existsDir = (candidate) => {
|
|
85
|
+
try {
|
|
86
|
+
return fs.statSync(candidate).isDirectory();
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}) {
|
|
92
|
+
if (!value)
|
|
93
|
+
return false;
|
|
94
|
+
return existsDir(path.join(value, '.obsidian'));
|
|
95
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface ManagedSkill {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly origin: 'base' | 'overlay';
|
|
4
|
+
readonly overridesBase: boolean;
|
|
5
|
+
}
|
|
6
|
+
export interface SkillFileContent {
|
|
7
|
+
readonly content: string;
|
|
8
|
+
readonly origin: 'base' | 'overlay';
|
|
9
|
+
}
|
|
10
|
+
export declare function listManagedSkills(baseDir: string, overlayDir: string | null): Promise<ManagedSkill[]>;
|
|
11
|
+
export declare function readSkillFile(baseDir: string, overlayDir: string | null, name: string): Promise<SkillFileContent | null>;
|
|
12
|
+
export declare function writeSkillFile(overlayDir: string, name: string, content: string): Promise<string>;
|
|
13
|
+
export declare function copyBaseForEdit(baseDir: string, overlayDir: string, name: string): Promise<{
|
|
14
|
+
copied: boolean;
|
|
15
|
+
}>;
|
|
16
|
+
export declare function deleteOverlaySkill(overlayDir: string, name: string): Promise<{
|
|
17
|
+
removed: boolean;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { randomSuffix } from "./bundled-dir.js";
|
|
4
|
+
const SAFE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
5
|
+
function assertSafeName(name) {
|
|
6
|
+
if (!SAFE_NAME.test(name)) {
|
|
7
|
+
throw new Error(`invalid skill name: ${name}`);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
async function dirNames(root) {
|
|
11
|
+
try {
|
|
12
|
+
const entries = await fs.promises.readdir(root, { withFileTypes: true });
|
|
13
|
+
return new Set(entries.filter((entry) => entry.isDirectory()).map((entry) => entry.name));
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return new Set();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async function readIfPresent(file) {
|
|
20
|
+
try {
|
|
21
|
+
return await fs.promises.readFile(file, 'utf8');
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
export async function listManagedSkills(baseDir, overlayDir) {
|
|
28
|
+
const base = await dirNames(baseDir);
|
|
29
|
+
const overlay = overlayDir ? await dirNames(overlayDir) : new Set();
|
|
30
|
+
const names = [...new Set([...base, ...overlay])].sort((a, b) => a.localeCompare(b));
|
|
31
|
+
return names.map((name) => {
|
|
32
|
+
const inOverlay = overlay.has(name);
|
|
33
|
+
return {
|
|
34
|
+
name,
|
|
35
|
+
origin: inOverlay ? 'overlay' : 'base',
|
|
36
|
+
overridesBase: inOverlay && base.has(name)
|
|
37
|
+
};
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
export async function readSkillFile(baseDir, overlayDir, name) {
|
|
41
|
+
assertSafeName(name);
|
|
42
|
+
if (overlayDir) {
|
|
43
|
+
const over = await readIfPresent(path.join(overlayDir, name, 'SKILL.md'));
|
|
44
|
+
if (over !== null)
|
|
45
|
+
return { content: over, origin: 'overlay' };
|
|
46
|
+
}
|
|
47
|
+
const base = await readIfPresent(path.join(baseDir, name, 'SKILL.md'));
|
|
48
|
+
return base !== null ? { content: base, origin: 'base' } : null;
|
|
49
|
+
}
|
|
50
|
+
export async function writeSkillFile(overlayDir, name, content) {
|
|
51
|
+
assertSafeName(name);
|
|
52
|
+
const skillDir = path.join(overlayDir, name);
|
|
53
|
+
await fs.promises.mkdir(skillDir, { recursive: true });
|
|
54
|
+
const target = path.join(skillDir, 'SKILL.md');
|
|
55
|
+
const tmp = `${target}.tmp-${randomSuffix()}`;
|
|
56
|
+
await fs.promises.writeFile(tmp, content);
|
|
57
|
+
await fs.promises.rename(tmp, target);
|
|
58
|
+
return skillDir;
|
|
59
|
+
}
|
|
60
|
+
export async function copyBaseForEdit(baseDir, overlayDir, name) {
|
|
61
|
+
assertSafeName(name);
|
|
62
|
+
const dest = path.join(overlayDir, name);
|
|
63
|
+
if (await exists(dest))
|
|
64
|
+
return { copied: false };
|
|
65
|
+
const src = path.join(baseDir, name);
|
|
66
|
+
if (!(await exists(src)))
|
|
67
|
+
throw new Error(`skill not found: ${name}`);
|
|
68
|
+
await copyDir(src, dest);
|
|
69
|
+
return { copied: true };
|
|
70
|
+
}
|
|
71
|
+
export async function deleteOverlaySkill(overlayDir, name) {
|
|
72
|
+
assertSafeName(name);
|
|
73
|
+
const dir = path.join(overlayDir, name);
|
|
74
|
+
if (!(await exists(dir)))
|
|
75
|
+
return { removed: false };
|
|
76
|
+
await fs.promises.rm(dir, { recursive: true, force: true });
|
|
77
|
+
return { removed: true };
|
|
78
|
+
}
|
|
79
|
+
async function exists(target) {
|
|
80
|
+
try {
|
|
81
|
+
await fs.promises.lstat(target);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
catch {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async function copyDir(src, dest) {
|
|
89
|
+
await fs.promises.mkdir(dest, { recursive: true });
|
|
90
|
+
for (const entry of await fs.promises.readdir(src, { withFileTypes: true })) {
|
|
91
|
+
const from = path.join(src, entry.name);
|
|
92
|
+
const to = path.join(dest, entry.name);
|
|
93
|
+
if (entry.isDirectory())
|
|
94
|
+
await copyDir(from, to);
|
|
95
|
+
else if (entry.isFile())
|
|
96
|
+
await fs.promises.writeFile(to, await fs.promises.readFile(from));
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import fs from 'fs';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import process from 'process';
|
|
5
|
+
const SDK_CONFIG_PATH_ENV = 'QVAC_CONFIG_PATH';
|
|
6
|
+
const OVERLAY_DIR_NAME = 'skills';
|
|
7
|
+
export function resolveSkillsOverlayDir(env = process.env) {
|
|
8
|
+
const configPath = env[SDK_CONFIG_PATH_ENV];
|
|
9
|
+
if (!configPath)
|
|
10
|
+
return null;
|
|
11
|
+
return path.join(path.dirname(configPath), OVERLAY_DIR_NAME);
|
|
12
|
+
}
|
|
13
|
+
export function ensureSkillsOverlayDir(env = process.env) {
|
|
14
|
+
const dir = resolveSkillsOverlayDir(env);
|
|
15
|
+
return dir ? materialize(dir) : Promise.resolve(null);
|
|
16
|
+
}
|
|
17
|
+
async function materialize(dir) {
|
|
18
|
+
await fs.promises.mkdir(dir, { recursive: true });
|
|
19
|
+
if (os.platform() !== 'win32')
|
|
20
|
+
await fs.promises.chmod(dir, 0o700);
|
|
21
|
+
return dir;
|
|
22
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface OverlayWatcher {
|
|
2
|
+
stop(): void;
|
|
3
|
+
}
|
|
4
|
+
export type OverlayChangeStream = AsyncIterable<{
|
|
5
|
+
diff?: readonly unknown[];
|
|
6
|
+
}> & {
|
|
7
|
+
destroy?: () => void;
|
|
8
|
+
};
|
|
9
|
+
export type WatchStreamFactory = (overlayDir: string) => OverlayChangeStream;
|
|
10
|
+
export declare function watchSkillsOverlay(overlayDir: string, onChange: () => void, opts?: {
|
|
11
|
+
debounceMs?: number;
|
|
12
|
+
createStream?: WatchStreamFactory;
|
|
13
|
+
}): OverlayWatcher;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import Localdrive from 'localdrive';
|
|
2
|
+
import watch from 'watch-drive';
|
|
3
|
+
export function watchSkillsOverlay(overlayDir, onChange, opts = {}) {
|
|
4
|
+
const debounceMs = opts.debounceMs ?? 200;
|
|
5
|
+
const createStream = opts.createStream ?? defaultStream;
|
|
6
|
+
const stream = createStream(overlayDir);
|
|
7
|
+
let stopped = false;
|
|
8
|
+
let timer = null;
|
|
9
|
+
const schedule = () => {
|
|
10
|
+
if (stopped)
|
|
11
|
+
return;
|
|
12
|
+
if (timer)
|
|
13
|
+
clearTimeout(timer);
|
|
14
|
+
timer = setTimeout(() => {
|
|
15
|
+
timer = null;
|
|
16
|
+
if (!stopped)
|
|
17
|
+
onChange();
|
|
18
|
+
}, debounceMs);
|
|
19
|
+
};
|
|
20
|
+
void (async () => {
|
|
21
|
+
try {
|
|
22
|
+
for await (const batch of stream) {
|
|
23
|
+
if (batch?.diff && batch.diff.length > 0)
|
|
24
|
+
schedule();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
}
|
|
29
|
+
})();
|
|
30
|
+
return {
|
|
31
|
+
stop() {
|
|
32
|
+
if (stopped)
|
|
33
|
+
return;
|
|
34
|
+
stopped = true;
|
|
35
|
+
if (timer)
|
|
36
|
+
clearTimeout(timer);
|
|
37
|
+
timer = null;
|
|
38
|
+
stream.destroy?.();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function defaultStream(overlayDir) {
|
|
43
|
+
return watch(new Localdrive(overlayDir), '/');
|
|
44
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface CredentialScope {
|
|
2
|
+
readonly agentId?: string | null | undefined;
|
|
3
|
+
readonly skill?: string | null | undefined;
|
|
4
|
+
readonly key: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function scopeKey({ agentId, skill, key }: CredentialScope): string;
|
|
7
|
+
export declare function isDeviceSharedCredentialKey(key: string): boolean;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export function scopeKey({ agentId, skill, key }) {
|
|
2
|
+
return `${agentId ?? ''}\0${skill ?? ''}\0${key}`;
|
|
3
|
+
}
|
|
4
|
+
const DEVICE_SHARED_CREDENTIAL_KEYS = new Set(['obsidian_vault_path']);
|
|
5
|
+
export function isDeviceSharedCredentialKey(key) {
|
|
6
|
+
return DEVICE_SHARED_CREDENTIAL_KEYS.has(key);
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { SKILL_STATE } from "./skill-state.js";
|
|
2
|
+
export function deriveSetup(entry, state) {
|
|
3
|
+
if (!entry.setup)
|
|
4
|
+
return undefined;
|
|
5
|
+
return {
|
|
6
|
+
...entry.setup,
|
|
7
|
+
...(entry.setup.routes
|
|
8
|
+
? { routes: entry.setup.routes.map((route) => withSatisfied(route, state)) }
|
|
9
|
+
: {})
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function withSatisfied(route, state) {
|
|
13
|
+
return route.kind === 'install' ? { ...route, satisfied: state === SKILL_STATE.ready } : route;
|
|
14
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SkillSetup, SkillSetupField } from './manifest.ts';
|
|
2
|
+
export interface SkillSettingEntry {
|
|
3
|
+
readonly skill: string;
|
|
4
|
+
readonly key: string;
|
|
5
|
+
readonly value: string;
|
|
6
|
+
readonly agentId?: string | null;
|
|
7
|
+
}
|
|
8
|
+
export type SkillSettingsFn = (skill: string, agentId?: string | null) => Promise<Readonly<Record<string, string>>> | Readonly<Record<string, string>>;
|
|
9
|
+
export interface SkillSettingsEntry {
|
|
10
|
+
readonly setup?: SkillSetup | undefined;
|
|
11
|
+
}
|
|
12
|
+
export declare function requiredSettings(entry: SkillSettingsEntry): readonly string[];
|
|
13
|
+
export declare function isSettingField(field: SkillSetupField): boolean;
|
|
14
|
+
export declare function settingEnvName(skill: string, key: string): string;
|
|
15
|
+
export declare function settingsEnv(skill: string, settings: Readonly<Record<string, string>>): Record<string, string>;
|
|
16
|
+
export declare function settingsScopeKey(skill: string, agentId?: string | null): string;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { scopeKey } from "./scope-key.js";
|
|
2
|
+
function setupFields(entry) {
|
|
3
|
+
return (entry.setup?.routes ?? []).flatMap((route) => route.fields ?? []);
|
|
4
|
+
}
|
|
5
|
+
export function requiredSettings(entry) {
|
|
6
|
+
return [
|
|
7
|
+
...new Set(setupFields(entry)
|
|
8
|
+
.filter((field) => field.required === true && field.secret !== true)
|
|
9
|
+
.map((field) => field.key))
|
|
10
|
+
];
|
|
11
|
+
}
|
|
12
|
+
export function isSettingField(field) {
|
|
13
|
+
return field.secret !== true;
|
|
14
|
+
}
|
|
15
|
+
export function settingEnvName(skill, key) {
|
|
16
|
+
return `QVAC_SKILL_${envToken(skill)}_${settingKeyToken(key)}`;
|
|
17
|
+
}
|
|
18
|
+
function envToken(value) {
|
|
19
|
+
return value.toUpperCase().replace(/[^A-Z0-9]/g, '_');
|
|
20
|
+
}
|
|
21
|
+
function settingKeyToken(value) {
|
|
22
|
+
return value.toUpperCase().replace(/-/g, '_H_').replace(/[^A-Z0-9_]/g, '_');
|
|
23
|
+
}
|
|
24
|
+
export function settingsEnv(skill, settings) {
|
|
25
|
+
const env = {};
|
|
26
|
+
for (const [key, value] of Object.entries(settings)) {
|
|
27
|
+
env[settingEnvName(skill, key)] = value;
|
|
28
|
+
}
|
|
29
|
+
return env;
|
|
30
|
+
}
|
|
31
|
+
export function settingsScopeKey(skill, agentId) {
|
|
32
|
+
return scopeKey({ agentId, skill, key: '' });
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const SKILL_STATE: {
|
|
2
|
+
readonly ready: "ready";
|
|
3
|
+
readonly needsSetup: "needs-setup";
|
|
4
|
+
readonly disconnected: "disconnected";
|
|
5
|
+
readonly unsupported: "unsupported";
|
|
6
|
+
readonly disabled: "disabled";
|
|
7
|
+
readonly outdated: "outdated";
|
|
8
|
+
readonly incompatibleModel: "incompatible-model";
|
|
9
|
+
readonly failed: "failed";
|
|
10
|
+
};
|
|
11
|
+
export type SkillState = (typeof SKILL_STATE)[keyof typeof SKILL_STATE];
|
|
12
|
+
export declare function isAvailableState(state: SkillState): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const SKILL_STATE = {
|
|
2
|
+
ready: 'ready',
|
|
3
|
+
needsSetup: 'needs-setup',
|
|
4
|
+
disconnected: 'disconnected',
|
|
5
|
+
unsupported: 'unsupported',
|
|
6
|
+
disabled: 'disabled',
|
|
7
|
+
outdated: 'outdated',
|
|
8
|
+
incompatibleModel: 'incompatible-model',
|
|
9
|
+
failed: 'failed'
|
|
10
|
+
};
|
|
11
|
+
const AVAILABLE_STATES = new Set([SKILL_STATE.ready]);
|
|
12
|
+
export function isAvailableState(state) {
|
|
13
|
+
return AVAILABLE_STATES.has(state);
|
|
14
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { type CredentialStoreFn } from './auth-resolver.ts';
|
|
2
|
+
import type { SkillRequires, SkillSetup } from './manifest.ts';
|
|
3
|
+
import { type SkillSettingsFn } from './skill-settings.ts';
|
|
4
|
+
import { type ObsidianPathProbe } from './obsidian-readiness.ts';
|
|
5
|
+
import { type CapabilityProfile } from '../../models/model-catalog.ts';
|
|
6
|
+
import { SKILL_STATE, isAvailableState, type SkillState } from './skill-state-constants.ts';
|
|
7
|
+
export { SKILL_STATE, isAvailableState, type SkillState };
|
|
8
|
+
export interface SkillStateEntry {
|
|
9
|
+
readonly name: string;
|
|
10
|
+
readonly credentials: readonly string[];
|
|
11
|
+
readonly platform: readonly string[];
|
|
12
|
+
readonly requires?: SkillRequires;
|
|
13
|
+
readonly stub?: boolean;
|
|
14
|
+
readonly minCapabilityProfile?: string;
|
|
15
|
+
readonly setup?: SkillSetup;
|
|
16
|
+
}
|
|
17
|
+
export interface SkillStateInputs {
|
|
18
|
+
readonly credentialStore?: CredentialStoreFn | undefined;
|
|
19
|
+
readonly settingsStore?: SkillSettingsFn | undefined;
|
|
20
|
+
readonly platform?: string | undefined;
|
|
21
|
+
readonly rejected?: ReadonlySet<string>;
|
|
22
|
+
readonly agentId?: string | null | undefined;
|
|
23
|
+
readonly binVersions?: ReadonlyMap<string, 'ok' | 'too-old' | 'unknown'> | undefined;
|
|
24
|
+
readonly activeProfile?: CapabilityProfile | undefined;
|
|
25
|
+
readonly obsidianProbe?: ObsidianPathProbe;
|
|
26
|
+
readonly binOnPath?: (bin: string, platform?: string) => boolean;
|
|
27
|
+
}
|
|
28
|
+
export declare function isStub(entry: {
|
|
29
|
+
readonly stub?: boolean;
|
|
30
|
+
}): boolean;
|
|
31
|
+
export declare function isToolSupported(entry: {
|
|
32
|
+
readonly tools: readonly string[];
|
|
33
|
+
}, installedTools: ReadonlySet<string>): boolean;
|
|
34
|
+
export declare function supportsPlatform(entry: {
|
|
35
|
+
readonly platform: readonly string[];
|
|
36
|
+
}, platform: string | undefined): boolean;
|
|
37
|
+
export declare function isModelCompatible(entry: {
|
|
38
|
+
readonly minCapabilityProfile?: string;
|
|
39
|
+
}, activeProfile: CapabilityProfile | undefined): boolean;
|
|
40
|
+
export declare function resolveSkillState(entry: SkillStateEntry, inputs?: SkillStateInputs): Promise<SkillState>;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { credentialRecord, isCredentialExpired } from "./auth-resolver.js";
|
|
2
|
+
import { parseToolGrant } from "./tool-grants.js";
|
|
3
|
+
import { missingBins } from "./bin-check.js";
|
|
4
|
+
import { credentialSlots } from "./credential-slots.js";
|
|
5
|
+
import { requiredSettings } from "./skill-settings.js";
|
|
6
|
+
import { isCredentialRejected } from "./credential-health.js";
|
|
7
|
+
import { isObsidianVaultPath, isSandboxedWorkbenchInstall, OBSIDIAN_SKILL_NAME, OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY, obsidianCliState, obsidianInstallState } from "./obsidian-readiness.js";
|
|
8
|
+
import { isCapabilityProfile, meetsMinCapabilityProfile } from "../../models/model-catalog.js";
|
|
9
|
+
import { SKILL_STATE, isAvailableState } from "./skill-state-constants.js";
|
|
10
|
+
export { SKILL_STATE, isAvailableState };
|
|
11
|
+
export function isStub(entry) {
|
|
12
|
+
return entry.stub === true;
|
|
13
|
+
}
|
|
14
|
+
export function isToolSupported(entry, installedTools) {
|
|
15
|
+
return entry.tools.every((name) => installedTools.has(parseToolGrant(name).name));
|
|
16
|
+
}
|
|
17
|
+
export function supportsPlatform(entry, platform) {
|
|
18
|
+
return !platform || entry.platform.includes(platform);
|
|
19
|
+
}
|
|
20
|
+
export function isModelCompatible(entry, activeProfile) {
|
|
21
|
+
const required = entry.minCapabilityProfile;
|
|
22
|
+
if (!required || activeProfile === undefined || !isCapabilityProfile(required))
|
|
23
|
+
return true;
|
|
24
|
+
return meetsMinCapabilityProfile(activeProfile, required);
|
|
25
|
+
}
|
|
26
|
+
export async function resolveSkillState(entry, inputs = {}) {
|
|
27
|
+
try {
|
|
28
|
+
if (!supportsPlatform(entry, inputs.platform))
|
|
29
|
+
return SKILL_STATE.unsupported;
|
|
30
|
+
if (isStub(entry))
|
|
31
|
+
return SKILL_STATE.disabled;
|
|
32
|
+
if (!isModelCompatible(entry, inputs.activeProfile))
|
|
33
|
+
return SKILL_STATE.incompatibleModel;
|
|
34
|
+
const bins = entry.requires?.bins ?? [];
|
|
35
|
+
if (entry.name === OBSIDIAN_SKILL_NAME) {
|
|
36
|
+
const vault = inputs.credentialStore
|
|
37
|
+
? credentialRecord(await inputs.credentialStore(OBSIDIAN_VAULT_PATH_CREDENTIAL_KEY, {
|
|
38
|
+
agentId: inputs.agentId,
|
|
39
|
+
skills: [entry.name]
|
|
40
|
+
}))
|
|
41
|
+
: null;
|
|
42
|
+
if (vault && isObsidianVaultPath(vault.token))
|
|
43
|
+
return SKILL_STATE.ready;
|
|
44
|
+
if (isSandboxedWorkbenchInstall())
|
|
45
|
+
return SKILL_STATE.needsSetup;
|
|
46
|
+
}
|
|
47
|
+
let missing = bins.length > 0 ? missingBins(bins, inputs.platform, inputs.binOnPath) : [];
|
|
48
|
+
if (entry.name === OBSIDIAN_SKILL_NAME) {
|
|
49
|
+
const cli = obsidianCliState(inputs.platform, inputs.obsidianProbe);
|
|
50
|
+
if (cli === 'enabled' &&
|
|
51
|
+
missing.includes('obsidian') &&
|
|
52
|
+
obsidianInstallState(inputs.platform, inputs.obsidianProbe) === 'installed') {
|
|
53
|
+
missing = missing.filter((bin) => bin !== 'obsidian');
|
|
54
|
+
}
|
|
55
|
+
if (missing.length === 0 && cli === 'disabled')
|
|
56
|
+
return SKILL_STATE.needsSetup;
|
|
57
|
+
}
|
|
58
|
+
if (missing.length > 0) {
|
|
59
|
+
return SKILL_STATE.needsSetup;
|
|
60
|
+
}
|
|
61
|
+
if (inputs.binVersions &&
|
|
62
|
+
Object.keys(entry.requires?.binMinVersions ?? {}).some((bin) => inputs.binVersions?.get(bin) === 'too-old')) {
|
|
63
|
+
return SKILL_STATE.outdated;
|
|
64
|
+
}
|
|
65
|
+
const required = requiredSettings(entry);
|
|
66
|
+
if (required.length > 0) {
|
|
67
|
+
const settings = inputs.settingsStore
|
|
68
|
+
? await inputs.settingsStore(entry.name, inputs.agentId)
|
|
69
|
+
: {};
|
|
70
|
+
if (required.some((key) => !settings[key]))
|
|
71
|
+
return SKILL_STATE.needsSetup;
|
|
72
|
+
}
|
|
73
|
+
const slots = credentialSlots(entry);
|
|
74
|
+
if (slots.length === 0)
|
|
75
|
+
return SKILL_STATE.ready;
|
|
76
|
+
const isRejected = inputs.rejected
|
|
77
|
+
? (key) => inputs.rejected.has(key)
|
|
78
|
+
: (key) => isCredentialRejected(key, inputs.agentId, entry.name);
|
|
79
|
+
const store = inputs.credentialStore;
|
|
80
|
+
if (!store)
|
|
81
|
+
return SKILL_STATE.needsSetup;
|
|
82
|
+
const records = new Map(await Promise.all([...new Set(slots.flat())].map(async (key) => [
|
|
83
|
+
key,
|
|
84
|
+
credentialRecord(await store(key, { agentId: inputs.agentId, skills: [entry.name] }))
|
|
85
|
+
])));
|
|
86
|
+
let disconnected = false;
|
|
87
|
+
let needsSetup = false;
|
|
88
|
+
for (const slot of slots) {
|
|
89
|
+
let healthy = false;
|
|
90
|
+
let bad = false;
|
|
91
|
+
for (const key of slot) {
|
|
92
|
+
const record = records.get(key);
|
|
93
|
+
const expired = !!record && isCredentialExpired(record);
|
|
94
|
+
if (record && !isRejected(key) && !expired) {
|
|
95
|
+
healthy = true;
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
if (isRejected(key) || expired)
|
|
99
|
+
bad = true;
|
|
100
|
+
}
|
|
101
|
+
if (healthy)
|
|
102
|
+
continue;
|
|
103
|
+
if (bad)
|
|
104
|
+
disconnected = true;
|
|
105
|
+
else
|
|
106
|
+
needsSetup = true;
|
|
107
|
+
}
|
|
108
|
+
if (disconnected)
|
|
109
|
+
return SKILL_STATE.disconnected;
|
|
110
|
+
if (needsSetup)
|
|
111
|
+
return SKILL_STATE.needsSetup;
|
|
112
|
+
return SKILL_STATE.ready;
|
|
113
|
+
}
|
|
114
|
+
catch {
|
|
115
|
+
return SKILL_STATE.failed;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const GRANT_RE = /^([\w-]+)\((.*)\)$/;
|
|
2
|
+
export function parseToolGrant(entry) {
|
|
3
|
+
const trimmed = entry.trim();
|
|
4
|
+
const match = GRANT_RE.exec(trimmed);
|
|
5
|
+
if (!match)
|
|
6
|
+
return { name: trimmed, scope: null };
|
|
7
|
+
const name = match[1] ?? '';
|
|
8
|
+
const scope = (match[2] ?? '').trim();
|
|
9
|
+
if (!name)
|
|
10
|
+
return { name: trimmed, scope: null };
|
|
11
|
+
if (!scope)
|
|
12
|
+
return { name, scope: null };
|
|
13
|
+
return { name, scope };
|
|
14
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const TOOLSETS: readonly ["web-search", "knowledge", "files", "exec", "http-request", "mcp-call"];
|
|
2
|
+
export type Toolset = (typeof TOOLSETS)[number];
|
|
3
|
+
export declare function asToolset(value?: string | null): Toolset | null;
|
|
4
|
+
export interface ToolsetScoped {
|
|
5
|
+
toolset?: string | null;
|
|
6
|
+
}
|
|
7
|
+
export declare function permittedTools<T extends ToolsetScoped>(tools: ReadonlyArray<T>, disabled?: ReadonlyArray<string> | null): T[];
|
|
8
|
+
export declare function toolsetEnabled(toolset: Toolset, disabled?: ReadonlyArray<string> | null): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const TOOLSETS = [
|
|
2
|
+
'web-search',
|
|
3
|
+
'knowledge',
|
|
4
|
+
'files',
|
|
5
|
+
'exec',
|
|
6
|
+
'http-request',
|
|
7
|
+
'mcp-call'
|
|
8
|
+
];
|
|
9
|
+
export function asToolset(value) {
|
|
10
|
+
return TOOLSETS.find((toolset) => toolset === value) ?? null;
|
|
11
|
+
}
|
|
12
|
+
export function permittedTools(tools, disabled) {
|
|
13
|
+
if (!disabled?.length)
|
|
14
|
+
return [...tools];
|
|
15
|
+
const off = new Set(disabled);
|
|
16
|
+
return tools.filter((tool) => !tool.toolset || !off.has(tool.toolset));
|
|
17
|
+
}
|
|
18
|
+
export function toolsetEnabled(toolset, disabled) {
|
|
19
|
+
return !disabled?.includes(toolset);
|
|
20
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
|
+
export type HostResolver = (hostname: string) => Promise<readonly string[]>;
|
|
3
|
+
export interface OutboundUrlCheck {
|
|
4
|
+
readonly blocked: string | null;
|
|
5
|
+
readonly addresses?: readonly string[];
|
|
6
|
+
}
|
|
7
|
+
export declare function checkOutboundHost(url: URL): string | null;
|
|
8
|
+
export declare function resolveOutboundUrl(url: URL, resolveHost?: HostResolver, signal?: BareAbortSignal): Promise<OutboundUrlCheck>;
|