@qvac/harness 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +740 -141
- package/README.md +75 -7
- package/dist/harness.bundle +72 -50
- package/dist-lib/index.d.ts +49 -39
- package/dist-lib/index.js +448 -161
- package/dist-lib/lib/audio-transcode-bare.d.ts +2 -2
- package/dist-lib/lib/audio-transcode-bare.js +28 -18
- package/dist-lib/lib/audio-transcode-node.d.ts +2 -2
- package/dist-lib/lib/capabilities/audio-resample.d.ts +7 -6
- package/dist-lib/lib/capabilities/audio-resample.js +30 -18
- package/dist-lib/lib/capabilities/completion.d.ts +20 -19
- package/dist-lib/lib/capabilities/completion.js +193 -132
- package/dist-lib/lib/capabilities/download.d.ts +6 -6
- package/dist-lib/lib/capabilities/download.js +15 -8
- package/dist-lib/lib/capabilities/embed.js +2 -1
- package/dist-lib/lib/capabilities/enhance.d.ts +6 -1
- package/dist-lib/lib/capabilities/enhance.js +7 -4
- package/dist-lib/lib/capabilities/invoke.js +7 -4
- package/dist-lib/lib/capabilities/kv-cache.js +2 -1
- package/dist-lib/lib/capabilities/preview-model-source.d.ts +9 -7
- package/dist-lib/lib/capabilities/preview-model-source.js +80 -28
- package/dist-lib/lib/capabilities/speech-text.js +5 -4
- package/dist-lib/lib/capabilities/tool-selection.js +10 -9
- package/dist-lib/lib/capabilities/tool-turns.js +30 -16
- package/dist-lib/lib/capabilities/usage-breakdown.js +2 -1
- package/dist-lib/lib/capabilities/voice.d.ts +5 -1
- package/dist-lib/lib/capabilities/voice.js +22 -12
- package/dist-lib/lib/connect.d.ts +13 -32
- package/dist-lib/lib/connect.js +170 -112
- package/dist-lib/lib/context-window.js +25 -21
- package/dist-lib/lib/contract-types.d.ts +35 -15
- package/dist-lib/lib/diagram-repair.d.ts +4 -4
- package/dist-lib/lib/diagram-repair.js +6 -3
- package/dist-lib/lib/docx/index.d.ts +3 -2
- package/dist-lib/lib/{error-fields.d.ts → guards.d.ts} +1 -0
- package/dist-lib/lib/{error-fields.js → guards.js} +3 -0
- package/dist-lib/lib/hardware/capability-probe.js +20 -10
- package/dist-lib/lib/hardware/gpu-classify.js +6 -3
- package/dist-lib/lib/hardware/gpu-probe-addon.js +8 -4
- package/dist-lib/lib/hardware/gpu-probe.js +4 -2
- package/dist-lib/lib/hardware/gpu-stats.native.cjs +8 -9
- package/dist-lib/lib/hardware/parsers.js +8 -4
- package/dist-lib/lib/helpers/buffer-burst.js +4 -2
- package/dist-lib/lib/helpers/control-tokens.js +4 -2
- package/dist-lib/lib/helpers/join-guard.d.ts +2 -2
- package/dist-lib/lib/helpers/join-guard.js +4 -2
- package/dist-lib/lib/helpers/load-stall.js +4 -2
- package/dist-lib/lib/helpers/markup-stream-filter.d.ts +2 -2
- package/dist-lib/lib/helpers/markup-stream-filter.js +6 -3
- package/dist-lib/lib/helpers/race-abort.js +2 -1
- package/dist-lib/lib/helpers/race-timeout.d.ts +5 -0
- package/dist-lib/lib/helpers/race-timeout.js +14 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +6 -8
- package/dist-lib/lib/helpers/run-outcome.js +36 -20
- package/dist-lib/lib/helpers/spawn-path.js +6 -3
- package/dist-lib/lib/helpers/text-coalescer.js +6 -3
- package/dist-lib/lib/helpers/thinking.js +38 -45
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +9 -7
- package/dist-lib/lib/helpers/tool-call-markup.js +36 -20
- package/dist-lib/lib/helpers/tool-intent.d.ts +3 -2
- package/dist-lib/lib/helpers/tool-intent.js +4 -2
- package/dist-lib/lib/helpers/tool-label.js +18 -9
- package/dist-lib/lib/hooks/built-in/arg-repair.js +23 -13
- package/dist-lib/lib/hooks/built-in/egress.js +2 -1
- package/dist-lib/lib/hooks/built-in/skill-catalog.js +2 -1
- package/dist-lib/lib/hooks/pipeline.d.ts +5 -4
- package/dist-lib/lib/hooks/pipeline.js +6 -3
- package/dist-lib/lib/hooks/run.js +12 -8
- package/dist-lib/lib/model-download-progress.js +10 -8
- package/dist-lib/lib/models/context.d.ts +1 -1
- package/dist-lib/lib/models/context.js +5 -1
- package/dist-lib/lib/models/custom-model-cache.d.ts +10 -1
- package/dist-lib/lib/models/custom-model-cache.js +43 -15
- package/dist-lib/lib/models/gguf-header.d.ts +3 -2
- package/dist-lib/lib/models/gguf-header.js +44 -22
- package/dist-lib/lib/models/idle-unload.d.ts +14 -0
- package/dist-lib/lib/models/idle-unload.js +51 -0
- package/dist-lib/lib/models/kv-cache.d.ts +3 -2
- package/dist-lib/lib/models/kv-cache.js +4 -3
- package/dist-lib/lib/models/llm-presets.d.ts +2 -2
- package/dist-lib/lib/models/llm-presets.js +4 -2
- package/dist-lib/lib/models/model-catalog-constants.js +3 -2
- package/dist-lib/lib/models/model-catalog.d.ts +15 -20
- package/dist-lib/lib/models/model-catalog.js +66 -31
- package/dist-lib/lib/models/model-delete.js +18 -8
- package/dist-lib/lib/models/model-handle.js +2 -1
- package/dist-lib/lib/models/model-list.d.ts +8 -3
- package/dist-lib/lib/models/model-list.js +11 -6
- package/dist-lib/lib/models/model-pool.d.ts +48 -10
- package/dist-lib/lib/models/model-pool.js +106 -45
- package/dist-lib/lib/models/model-source.js +10 -5
- package/dist-lib/lib/models/music-catalog.d.ts +2 -2
- package/dist-lib/lib/models/nmt-catalog.d.ts +4 -3
- package/dist-lib/lib/models/nmt-catalog.js +10 -5
- package/dist-lib/lib/models/opencl-cache.d.ts +6 -1
- package/dist-lib/lib/models/opencl-cache.js +5 -3
- package/dist-lib/lib/models/sdk-faults.d.ts +11 -8
- package/dist-lib/lib/models/sdk-faults.js +9 -6
- package/dist-lib/lib/models/shards.d.ts +11 -0
- package/dist-lib/lib/models/shards.js +15 -0
- package/dist-lib/lib/models/tool-dialect.js +10 -5
- package/dist-lib/lib/no-redirect-fetch-bare.d.ts +3 -3
- package/dist-lib/lib/no-redirect-fetch-bare.js +1 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +6 -3
- package/dist-lib/lib/no-redirect-fetch-node.d.ts +1 -1
- package/dist-lib/lib/no-redirect-fetch-node.js +9 -9
- package/dist-lib/lib/office/index.d.ts +3 -2
- package/dist-lib/lib/office/python.d.ts +3 -2
- package/dist-lib/lib/office/python.js +2 -1
- package/dist-lib/lib/prompt.d.ts +5 -4
- package/dist-lib/lib/prompt.js +8 -4
- package/dist-lib/lib/queue.js +10 -5
- package/dist-lib/lib/resolution-detector.js +21 -11
- package/dist-lib/lib/rpc-session.js +2 -1
- package/dist-lib/lib/sdk-loader.js +2 -1
- package/dist-lib/lib/sdk-storage.js +4 -2
- package/dist-lib/lib/serve.js +122 -66
- package/dist-lib/lib/spawn.js +7 -4
- package/dist-lib/lib/tmp-path.d.ts +7 -6
- package/dist-lib/lib/tool-call-display.d.ts +2 -2
- package/dist-lib/lib/tools/create-documents.js +18 -10
- package/dist-lib/lib/tools/edit-documents.js +23 -13
- package/dist-lib/lib/tools/edit-image.d.ts +2 -2
- package/dist-lib/lib/tools/edit-image.js +60 -36
- package/dist-lib/lib/tools/exec/adapters/adapter.d.ts +10 -10
- package/dist-lib/lib/tools/exec/adapters/python/attachments.d.ts +17 -11
- package/dist-lib/lib/tools/exec/adapters/python/attachments.js +53 -40
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/create-effect.js +60 -32
- package/dist-lib/lib/tools/exec/adapters/python/guarded-fetch.d.ts +33 -22
- package/dist-lib/lib/tools/exec/adapters/python/guarded-fetch.js +58 -29
- package/dist-lib/lib/tools/exec/adapters/python/interrupt-timer.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/loader.js +23 -12
- package/dist-lib/lib/tools/exec/adapters/python/memfs.d.ts +13 -11
- package/dist-lib/lib/tools/exec/adapters/python/memfs.js +10 -5
- package/dist-lib/lib/tools/exec/adapters/python/net-shim.js +3 -1
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.d.ts +6 -4
- package/dist-lib/lib/tools/exec/adapters/python/output-policy.js +20 -10
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/pyodide.js +14 -7
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.d.ts +41 -34
- package/dist-lib/lib/tools/exec/adapters/python/python-adapter.js +316 -166
- package/dist-lib/lib/tools/exec/adapters/python/run-session.d.ts +9 -8
- package/dist-lib/lib/tools/exec/adapters/python/run-session.js +56 -28
- package/dist-lib/lib/tools/exec/adapters/python/wheels.d.ts +8 -10
- package/dist-lib/lib/tools/exec/adapters/python/wheels.js +22 -11
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.d.ts +3 -2
- package/dist-lib/lib/tools/exec/adapters/python/worker/client.js +41 -26
- package/dist-lib/lib/tools/exec/adapters/python/worker/entry.js +27 -18
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.d.ts +2 -2
- package/dist-lib/lib/tools/exec/adapters/python/worker/protocol.js +14 -13
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.d.ts +4 -4
- package/dist-lib/lib/tools/exec/adapters/python/worker/spawn-node.js +10 -5
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.d.ts +4 -4
- package/dist-lib/lib/tools/exec/adapters/shell/shell-adapter.js +2 -1
- package/dist-lib/lib/tools/exec/obsidian/cli-process.d.ts +6 -1
- package/dist-lib/lib/tools/exec/obsidian/cli-process.js +8 -5
- package/dist-lib/lib/tools/exec/obsidian/cli.d.ts +6 -6
- package/dist-lib/lib/tools/exec/obsidian/cli.js +4 -4
- package/dist-lib/lib/tools/exec/obsidian/command.d.ts +3 -2
- package/dist-lib/lib/tools/exec/obsidian/command.js +6 -3
- package/dist-lib/lib/tools/exec/obsidian/output.js +2 -1
- package/dist-lib/lib/tools/exec/obsidian/route.d.ts +4 -6
- package/dist-lib/lib/tools/exec/obsidian/route.js +17 -11
- package/dist-lib/lib/tools/exec/obsidian/safe-path.js +2 -1
- package/dist-lib/lib/tools/exec/obsidian/vault-create.js +15 -7
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.d.ts +2 -2
- package/dist-lib/lib/tools/exec/obsidian/vault-paths.js +20 -10
- package/dist-lib/lib/tools/exec/obsidian/vault-read.js +20 -13
- package/dist-lib/lib/tools/exec/obsidian/vault-write.js +24 -12
- package/dist-lib/lib/tools/exec/runner.d.ts +14 -14
- package/dist-lib/lib/tools/exec/runner.js +5 -3
- package/dist-lib/lib/tools/exec/scope.js +52 -28
- package/dist-lib/lib/tools/exec/shell-argv.js +31 -18
- package/dist-lib/lib/tools/exec/shell-guidance.d.ts +6 -1
- package/dist-lib/lib/tools/exec/shell-guidance.js +35 -20
- package/dist-lib/lib/tools/exec/video-tools.js +2 -2
- package/dist-lib/lib/tools/exec.d.ts +6 -8
- package/dist-lib/lib/tools/exec.js +113 -54
- package/dist-lib/lib/tools/file-glob.d.ts +4 -5
- package/dist-lib/lib/tools/file-glob.js +16 -11
- package/dist-lib/lib/tools/fs/glob.js +13 -18
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +10 -10
- package/dist-lib/lib/tools/fs/remote.d.ts +3 -2
- package/dist-lib/lib/tools/fs/remote.js +13 -7
- package/dist-lib/lib/tools/fs/scope.d.ts +8 -3
- package/dist-lib/lib/tools/fs/scope.js +20 -12
- package/dist-lib/lib/tools/fs/walk.js +6 -3
- package/dist-lib/lib/tools/fs/write.d.ts +3 -2
- package/dist-lib/lib/tools/generate-image.d.ts +11 -9
- package/dist-lib/lib/tools/generate-image.js +73 -37
- package/dist-lib/lib/tools/generate-music.d.ts +22 -11
- package/dist-lib/lib/tools/generate-music.js +79 -48
- package/dist-lib/lib/tools/grep.js +66 -41
- package/dist-lib/lib/tools/http-request/encode-fields.js +18 -9
- package/dist-lib/lib/tools/http-request/{utils.js → request.js} +20 -11
- package/dist-lib/lib/tools/http-request/truncate-response.js +57 -46
- package/dist-lib/lib/tools/http-request.d.ts +1 -1
- package/dist-lib/lib/tools/http-request.js +33 -18
- package/dist-lib/lib/tools/mcp/protocol.d.ts +53 -0
- package/dist-lib/lib/tools/mcp/{utils.js → protocol.js} +45 -23
- package/dist-lib/lib/tools/mcp-call.d.ts +1 -1
- package/dist-lib/lib/tools/mcp-call.js +37 -16
- package/dist-lib/lib/tools/operations/builders.js +10 -6
- package/dist-lib/lib/tools/operations/compile.js +20 -10
- package/dist-lib/lib/tools/operations/decoders.js +12 -6
- package/dist-lib/lib/tools/operations/gmail-message.js +3 -2
- package/dist-lib/lib/tools/outbound-guard.d.ts +4 -3
- package/dist-lib/lib/tools/outbound-guard.js +14 -8
- package/dist-lib/lib/tools/private-ip.js +8 -7
- package/dist-lib/lib/tools/rag-search.js +14 -7
- package/dist-lib/lib/tools/read-files.js +23 -20
- package/dist-lib/lib/tools/skill.js +19 -10
- package/dist-lib/lib/tools/skills/auth-resolver.d.ts +11 -18
- package/dist-lib/lib/tools/skills/auth-resolver.js +30 -18
- package/dist-lib/lib/tools/skills/bin-check.d.ts +3 -2
- package/dist-lib/lib/tools/skills/bin-check.js +10 -3
- package/dist-lib/lib/tools/skills/bundled-dir.js +20 -10
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +3 -2
- package/dist-lib/lib/tools/skills/bundled-hash.js +6 -1
- package/dist-lib/lib/tools/skills/catalog.d.ts +3 -2
- package/dist-lib/lib/tools/skills/catalog.js +33 -28
- package/dist-lib/lib/tools/skills/cli-argv.d.ts +3 -2
- package/dist-lib/lib/tools/skills/cli-argv.js +55 -52
- package/dist-lib/lib/tools/skills/cli-schema-check.js +21 -10
- package/dist-lib/lib/tools/skills/cli-schema-load.js +28 -20
- package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +6 -6
- package/dist-lib/lib/tools/skills/cli-schema.js +2 -1
- package/dist-lib/lib/tools/skills/credential-check.d.ts +6 -3
- package/dist-lib/lib/tools/skills/credential-check.js +24 -12
- package/dist-lib/lib/tools/skills/credential-grants.js +1 -6
- package/dist-lib/lib/tools/skills/credential-health.d.ts +5 -1
- package/dist-lib/lib/tools/skills/credential-health.js +5 -3
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +10 -5
- package/dist-lib/lib/tools/skills/manifest-parse.js +84 -64
- package/dist-lib/lib/tools/skills/mention.js +7 -6
- package/dist-lib/lib/tools/skills/obsidian-readiness.d.ts +2 -2
- package/dist-lib/lib/tools/skills/obsidian-readiness.js +11 -3
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +6 -4
- package/dist-lib/lib/tools/skills/overlay-crud.js +12 -6
- package/dist-lib/lib/tools/skills/overlay-dir.js +4 -2
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +3 -2
- package/dist-lib/lib/tools/skills/overlay-watch.js +8 -4
- package/dist-lib/lib/tools/skills/setup-routes.js +1 -3
- package/dist-lib/lib/tools/skills/skill-settings.js +4 -1
- package/dist-lib/lib/tools/skills/skill-state.d.ts +6 -11
- package/dist-lib/lib/tools/skills/skill-state.js +48 -29
- package/dist-lib/lib/tools/skills/tool-grants.js +6 -3
- package/dist-lib/lib/tools/toolsets.js +2 -1
- package/dist-lib/lib/tools/translate.d.ts +4 -5
- package/dist-lib/lib/tools/translate.js +31 -14
- package/dist-lib/lib/tools/url-guard.js +2 -1
- package/dist-lib/lib/tools/weather-lookup/place.js +8 -4
- package/dist-lib/lib/tools/weather-lookup/report.d.ts +7 -1
- package/dist-lib/lib/tools/weather-lookup/report.js +46 -9
- package/dist-lib/lib/tools/weather-lookup.js +18 -12
- package/dist-lib/lib/tools/web-fetch.js +47 -24
- package/dist-lib/lib/tools/web-search.js +8 -3
- package/dist-lib/lib/validating-lookup.d.ts +4 -4
- package/dist-lib/lib/wav-encode.d.ts +1 -1
- package/dist-lib/lib/wav-encode.js +11 -10
- package/dist-lib/lib/web-fetch/embedded-state.js +24 -12
- package/dist-lib/lib/web-fetch/extract.js +4 -2
- package/dist-lib/lib/web-fetch/images.js +8 -4
- package/dist-lib/lib/web-fetch/video.d.ts +2 -2
- package/dist-lib/lib/web-fetch/video.js +8 -4
- package/dist-lib/lib/web-search/engine-registry.d.ts +2 -2
- package/dist-lib/lib/web-search/engines/aol.js +1 -1
- package/dist-lib/lib/web-search/engines/bing.js +1 -1
- package/dist-lib/lib/web-search/engines/brave.js +4 -1
- package/dist-lib/lib/web-search/engines/duckduckgo.js +3 -2
- package/dist-lib/lib/web-search/engines/google.js +7 -3
- package/dist-lib/lib/web-search/engines/wikipedia.js +5 -4
- package/dist-lib/lib/web-search/engines/yahoo.js +1 -1
- package/dist-lib/lib/web-search/fetch-html.d.ts +5 -4
- package/dist-lib/lib/web-search/fetch-html.js +13 -7
- package/dist-lib/lib/web-search/orchestrator.d.ts +9 -5
- package/dist-lib/lib/web-search/orchestrator.js +3 -3
- package/dist-lib/lib/wire.d.ts +3 -2
- package/dist-lib/lib/wire.js +23 -15
- package/dist-lib/schema/baseline.js +10 -5
- package/dist-lib/schema/build.js +2 -1
- package/dist-lib/schema/harness.d.ts +15 -2
- package/dist-lib/schema/harness.js +39 -2
- package/dist-lib/schema/release-tags.d.ts +3 -2
- package/dist-lib/schema/release-tags.js +6 -3
- package/dist-lib/spec/bind.js +9 -0
- package/dist-lib/spec/calls.js +3 -0
- package/dist-lib/spec/hrpc/hrpc.json +39 -0
- package/dist-lib/spec/hrpc/index.js +39 -3
- package/dist-lib/spec/hrpc/messages.js +105 -8
- package/dist-lib/spec/hyperschema/index.js +105 -8
- package/dist-lib/spec/hyperschema/schema.json +77 -1
- package/dist-lib/spec/hyperschema/types.d.ts +25 -1
- package/package.json +14 -14
- package/worker/harness-sidecar.mjs +15 -22
- package/worker/stow-entry.mjs +7 -4
- package/dist-lib/lib/tools/mcp/utils.d.ts +0 -47
- /package/dist-lib/lib/tools/http-request/{utils.d.ts → request.d.ts} +0 -0
|
@@ -1,48 +1,55 @@
|
|
|
1
|
+
import { isRecord } from '../../guards.js';
|
|
1
2
|
export function parseManifestBlock(block, key = 'metadata') {
|
|
2
3
|
const json = extractJsonBlock(block, key);
|
|
3
|
-
if (!isObj(json) || !isObj(json.openclaw))
|
|
4
|
+
if (!isObj(json) || !isObj(json.openclaw)) {
|
|
4
5
|
return {};
|
|
6
|
+
}
|
|
5
7
|
const oc = json.openclaw;
|
|
6
8
|
const requires = readRequires(oc.requires);
|
|
7
9
|
const install = readInstall(oc.install);
|
|
8
10
|
const setup = readSetup(oc.setup);
|
|
9
11
|
return {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
: {}),
|
|
17
|
-
...(typeof oc.emoji === 'string' ? { emoji: oc.emoji } : {})
|
|
12
|
+
requires,
|
|
13
|
+
install,
|
|
14
|
+
setup,
|
|
15
|
+
stub: typeof oc.stub === 'boolean' ? oc.stub : undefined,
|
|
16
|
+
minCapabilityProfile: typeof oc.minCapabilityProfile === 'string' ? oc.minCapabilityProfile : undefined,
|
|
17
|
+
emoji: typeof oc.emoji === 'string' ? oc.emoji : undefined
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
function extractJsonBlock(block, key) {
|
|
21
21
|
const at = block.indexOf(`${key}:`);
|
|
22
|
-
if (at === -1)
|
|
22
|
+
if (at === -1) {
|
|
23
23
|
return null;
|
|
24
|
+
}
|
|
24
25
|
const rest = block.slice(at + key.length + 1);
|
|
25
26
|
const start = rest.indexOf('{');
|
|
26
|
-
if (start === -1)
|
|
27
|
+
if (start === -1) {
|
|
27
28
|
return null;
|
|
29
|
+
}
|
|
28
30
|
let depth = 0;
|
|
29
31
|
let inString = false;
|
|
30
32
|
let escaped = false;
|
|
31
33
|
for (let i = start; i < rest.length; i++) {
|
|
32
34
|
const ch = rest[i];
|
|
33
35
|
if (inString) {
|
|
34
|
-
if (escaped)
|
|
36
|
+
if (escaped) {
|
|
35
37
|
escaped = false;
|
|
36
|
-
|
|
38
|
+
}
|
|
39
|
+
else if (ch === '\\') {
|
|
37
40
|
escaped = true;
|
|
38
|
-
|
|
41
|
+
}
|
|
42
|
+
else if (ch === '"') {
|
|
39
43
|
inString = false;
|
|
44
|
+
}
|
|
40
45
|
continue;
|
|
41
46
|
}
|
|
42
|
-
if (ch === '"')
|
|
47
|
+
if (ch === '"') {
|
|
43
48
|
inString = true;
|
|
44
|
-
|
|
49
|
+
}
|
|
50
|
+
else if (ch === '{') {
|
|
45
51
|
depth++;
|
|
52
|
+
}
|
|
46
53
|
else if (ch === '}' && --depth === 0) {
|
|
47
54
|
try {
|
|
48
55
|
return JSON.parse(rest.slice(start, i + 1));
|
|
@@ -54,8 +61,13 @@ function extractJsonBlock(block, key) {
|
|
|
54
61
|
}
|
|
55
62
|
return null;
|
|
56
63
|
}
|
|
64
|
+
function verifyBody(body) {
|
|
65
|
+
if (typeof body === 'string')
|
|
66
|
+
return body;
|
|
67
|
+
return isObj(body) ? JSON.stringify(body) : undefined;
|
|
68
|
+
}
|
|
57
69
|
function isObj(v) {
|
|
58
|
-
return
|
|
70
|
+
return isRecord(v) && !Array.isArray(v);
|
|
59
71
|
}
|
|
60
72
|
function strArr(v) {
|
|
61
73
|
if (!Array.isArray(v))
|
|
@@ -71,10 +83,10 @@ function readRequires(v) {
|
|
|
71
83
|
const credentialChecks = readCredentialChecks(v.credentialChecks);
|
|
72
84
|
return bins || mins || credentials || credentialChecks
|
|
73
85
|
? {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
86
|
+
bins,
|
|
87
|
+
binMinVersions: mins,
|
|
88
|
+
credentials,
|
|
89
|
+
credentialChecks
|
|
78
90
|
}
|
|
79
91
|
: undefined;
|
|
80
92
|
}
|
|
@@ -87,7 +99,7 @@ function readBinMinVersions(v) {
|
|
|
87
99
|
continue;
|
|
88
100
|
out[bin] = {
|
|
89
101
|
min: spec.min,
|
|
90
|
-
|
|
102
|
+
command: typeof spec.command === 'string' ? spec.command : undefined
|
|
91
103
|
};
|
|
92
104
|
}
|
|
93
105
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
@@ -102,8 +114,8 @@ function readCredentialChecks(v) {
|
|
|
102
114
|
const headers = readStringRecord(check.headers);
|
|
103
115
|
out[key] = {
|
|
104
116
|
url: check.url,
|
|
105
|
-
|
|
106
|
-
|
|
117
|
+
method: typeof check.method === 'string' ? check.method : undefined,
|
|
118
|
+
headers
|
|
107
119
|
};
|
|
108
120
|
}
|
|
109
121
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
@@ -113,8 +125,9 @@ function readStringRecord(v) {
|
|
|
113
125
|
return undefined;
|
|
114
126
|
const out = {};
|
|
115
127
|
for (const [key, value] of Object.entries(v)) {
|
|
116
|
-
if (typeof value === 'string')
|
|
128
|
+
if (typeof value === 'string') {
|
|
117
129
|
out[key] = value;
|
|
130
|
+
}
|
|
118
131
|
}
|
|
119
132
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
120
133
|
}
|
|
@@ -134,10 +147,10 @@ export function readInstall(v) {
|
|
|
134
147
|
id: raw.id,
|
|
135
148
|
kind: raw.kind,
|
|
136
149
|
label: raw.label,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
150
|
+
formula: typeof raw.formula === 'string' ? raw.formula : undefined,
|
|
151
|
+
bins,
|
|
152
|
+
command: typeof raw.command === 'string' ? raw.command : undefined,
|
|
153
|
+
manual: typeof raw.manual === 'boolean' ? raw.manual : undefined
|
|
141
154
|
});
|
|
142
155
|
}
|
|
143
156
|
return steps.length > 0 ? steps : undefined;
|
|
@@ -151,35 +164,35 @@ export function readSetup(v) {
|
|
|
151
164
|
return undefined;
|
|
152
165
|
const summary = typeof v.summary === 'string' ? v.summary : undefined;
|
|
153
166
|
const routes = readRoutes(v.routes);
|
|
154
|
-
return summary || routes
|
|
155
|
-
? { ...(summary ? { summary } : {}), ...(routes ? { routes } : {}) }
|
|
156
|
-
: undefined;
|
|
167
|
+
return summary || routes ? { summary: summary || undefined, routes } : undefined;
|
|
157
168
|
}
|
|
158
169
|
function readRoutes(v) {
|
|
159
170
|
if (!Array.isArray(v))
|
|
160
171
|
return undefined;
|
|
161
172
|
const routes = [];
|
|
162
173
|
for (const raw of v) {
|
|
163
|
-
if (!isObj(raw) || !isRouteKind(raw.kind) || typeof raw.label !== 'string')
|
|
174
|
+
if (!isObj(raw) || !isRouteKind(raw.kind) || typeof raw.label !== 'string') {
|
|
164
175
|
continue;
|
|
176
|
+
}
|
|
165
177
|
const steps = strArr(raw.steps);
|
|
166
178
|
const configSteps = strArr(raw.configSteps);
|
|
167
179
|
const fields = readFields(raw.fields);
|
|
168
180
|
const oauth = readOAuth(raw.oauth);
|
|
169
|
-
if (raw.kind === 'oauth' && !oauth)
|
|
181
|
+
if (raw.kind === 'oauth' && !oauth) {
|
|
170
182
|
continue;
|
|
183
|
+
}
|
|
171
184
|
routes.push({
|
|
172
185
|
kind: raw.kind,
|
|
173
186
|
label: raw.label,
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
187
|
+
provider: typeof raw.provider === 'string' ? raw.provider : undefined,
|
|
188
|
+
credentialKey: typeof raw.credentialKey === 'string' ? raw.credentialKey : undefined,
|
|
189
|
+
description: typeof raw.description === 'string' ? raw.description : undefined,
|
|
190
|
+
helpUrl: typeof raw.helpUrl === 'string' ? raw.helpUrl : undefined,
|
|
191
|
+
steps,
|
|
192
|
+
configSteps,
|
|
193
|
+
fields,
|
|
194
|
+
satisfied: typeof raw.satisfied === 'boolean' ? raw.satisfied : undefined,
|
|
195
|
+
oauth
|
|
183
196
|
});
|
|
184
197
|
}
|
|
185
198
|
return routes.length > 0 ? routes : undefined;
|
|
@@ -218,8 +231,9 @@ function readAuthParams(v) {
|
|
|
218
231
|
: []))
|
|
219
232
|
: v;
|
|
220
233
|
const record = readStringRecord(raw);
|
|
221
|
-
if (!record)
|
|
234
|
+
if (!record) {
|
|
222
235
|
return undefined;
|
|
236
|
+
}
|
|
223
237
|
const out = Object.fromEntries(Object.entries(record).filter(([key]) => !OAUTH_RESERVED_PARAMS.has(key)));
|
|
224
238
|
return Object.keys(out).length > 0 ? out : undefined;
|
|
225
239
|
}
|
|
@@ -228,38 +242,42 @@ function siteOf(url) {
|
|
|
228
242
|
return new URL(url).hostname.split('.').slice(-2).join('.');
|
|
229
243
|
}
|
|
230
244
|
function readVerifyRule(v) {
|
|
231
|
-
if (!isObj(v) || typeof v.error !== 'string' || !OAUTH_ERROR_CODE.test(v.error))
|
|
245
|
+
if (!isObj(v) || typeof v.error !== 'string' || !OAUTH_ERROR_CODE.test(v.error)) {
|
|
232
246
|
return undefined;
|
|
247
|
+
}
|
|
233
248
|
const status = Array.isArray(v.status)
|
|
234
249
|
? v.status.filter((s) => Number.isInteger(s) && s >= 100 && s < 600)
|
|
235
250
|
: [];
|
|
236
251
|
const field = typeof v.field === 'string' && v.field.length > 0 ? v.field : undefined;
|
|
237
|
-
if (status.length === 0 && !field)
|
|
252
|
+
if (status.length === 0 && !field) {
|
|
238
253
|
return undefined;
|
|
254
|
+
}
|
|
239
255
|
return {
|
|
240
256
|
error: v.error,
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
257
|
+
status: status.length > 0 ? status : undefined,
|
|
258
|
+
field,
|
|
259
|
+
notEqual: field && typeof v.notEqual === 'string' ? v.notEqual : undefined
|
|
244
260
|
};
|
|
245
261
|
}
|
|
246
262
|
function readVerify(v, tokenUrl) {
|
|
247
263
|
if (!isObj(v))
|
|
248
264
|
return undefined;
|
|
249
265
|
const url = httpsUrl(v.url);
|
|
250
|
-
if (!url || siteOf(url) !== siteOf(tokenUrl))
|
|
266
|
+
if (!url || siteOf(url) !== siteOf(tokenUrl)) {
|
|
251
267
|
return undefined;
|
|
268
|
+
}
|
|
252
269
|
if (v.method !== undefined && v.method !== null && v.method !== 'GET' && v.method !== 'POST') {
|
|
253
270
|
return undefined;
|
|
254
271
|
}
|
|
255
272
|
const reject = Array.isArray(v.reject) ? v.reject.flatMap((r) => readVerifyRule(r) ?? []) : [];
|
|
256
|
-
if (reject.length === 0)
|
|
273
|
+
if (reject.length === 0) {
|
|
257
274
|
return undefined;
|
|
258
|
-
|
|
275
|
+
}
|
|
276
|
+
const body = verifyBody(v.body);
|
|
259
277
|
return {
|
|
260
278
|
url,
|
|
261
|
-
|
|
262
|
-
|
|
279
|
+
method: v.method === 'GET' || v.method === 'POST' ? v.method : undefined,
|
|
280
|
+
body,
|
|
263
281
|
reject
|
|
264
282
|
};
|
|
265
283
|
}
|
|
@@ -276,8 +294,9 @@ function readOAuth(v) {
|
|
|
276
294
|
return undefined;
|
|
277
295
|
}
|
|
278
296
|
const scopes = v.scopes === undefined || v.scopes === null ? [] : strArr(v.scopes);
|
|
279
|
-
if (!scopes)
|
|
297
|
+
if (!scopes) {
|
|
280
298
|
return undefined;
|
|
299
|
+
}
|
|
281
300
|
const extraAuthParams = readAuthParams(v.extraAuthParams);
|
|
282
301
|
const registrationEndpoint = httpsUrl(v.registrationEndpoint);
|
|
283
302
|
const verify = readVerify(v.verify, tokenUrl);
|
|
@@ -287,11 +306,11 @@ function readOAuth(v) {
|
|
|
287
306
|
tokenUrl,
|
|
288
307
|
scopes,
|
|
289
308
|
tokenAuth: v.tokenAuth,
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
309
|
+
extraAuthParams,
|
|
310
|
+
registrationEndpoint,
|
|
311
|
+
port: isPort(v.port) ? v.port : undefined,
|
|
312
|
+
sharedIosSession: typeof v.sharedIosSession === 'boolean' ? v.sharedIosSession : undefined,
|
|
313
|
+
verify
|
|
295
314
|
};
|
|
296
315
|
}
|
|
297
316
|
export function toWireSetup(setup) {
|
|
@@ -318,14 +337,15 @@ function readFields(v) {
|
|
|
318
337
|
return undefined;
|
|
319
338
|
const fields = [];
|
|
320
339
|
for (const raw of v) {
|
|
321
|
-
if (!isObj(raw) || typeof raw.key !== 'string' || typeof raw.label !== 'string')
|
|
340
|
+
if (!isObj(raw) || typeof raw.key !== 'string' || typeof raw.label !== 'string') {
|
|
322
341
|
continue;
|
|
342
|
+
}
|
|
323
343
|
fields.push({
|
|
324
344
|
key: raw.key,
|
|
325
345
|
label: raw.label,
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
346
|
+
placeholder: typeof raw.placeholder === 'string' ? raw.placeholder : undefined,
|
|
347
|
+
secret: typeof raw.secret === 'boolean' ? raw.secret : undefined,
|
|
348
|
+
required: typeof raw.required === 'boolean' ? raw.required : undefined
|
|
329
349
|
});
|
|
330
350
|
}
|
|
331
351
|
return fields.length > 0 ? fields : undefined;
|
|
@@ -3,8 +3,9 @@ import { skillMentionName } from './mention-name.js';
|
|
|
3
3
|
export { skillMentionName };
|
|
4
4
|
export function resolveSkillMention(text, catalog) {
|
|
5
5
|
const name = skillMentionName(text);
|
|
6
|
-
if (!name)
|
|
6
|
+
if (!name) {
|
|
7
7
|
return null;
|
|
8
|
+
}
|
|
8
9
|
return catalog.find((skill) => skill.name.toLowerCase() === name) ?? null;
|
|
9
10
|
}
|
|
10
11
|
const MIN_IMPLICIT_NAME_LENGTH = 4;
|
|
@@ -19,15 +20,15 @@ export function resolveImplicitSkill(text, activeSkills) {
|
|
|
19
20
|
let best = null;
|
|
20
21
|
let bestLength = 0;
|
|
21
22
|
for (const skill of activeSkills) {
|
|
22
|
-
const names = skill.preloadOnName === false
|
|
23
|
-
? (skill.aliases ?? [])
|
|
24
|
-
: [skill.name, ...(skill.aliases ?? [])];
|
|
23
|
+
const names = skill.preloadOnName === false ? (skill.aliases ?? []) : [skill.name, ...(skill.aliases ?? [])];
|
|
25
24
|
for (const word of names) {
|
|
26
25
|
const candidate = word.toLowerCase();
|
|
27
|
-
if (candidate.length < MIN_IMPLICIT_NAME_LENGTH)
|
|
26
|
+
if (candidate.length < MIN_IMPLICIT_NAME_LENGTH) {
|
|
28
27
|
continue;
|
|
29
|
-
|
|
28
|
+
}
|
|
29
|
+
if (!matchesName(text, candidate)) {
|
|
30
30
|
continue;
|
|
31
|
+
}
|
|
31
32
|
const weight = candidate.replace(/\+/g, '').length;
|
|
32
33
|
if (weight > bestLength) {
|
|
33
34
|
best = skill;
|
|
@@ -4,11 +4,11 @@ export declare const OBSIDIAN_BIN_CANDIDATES: Readonly<Record<string, readonly s
|
|
|
4
4
|
export declare const OBSIDIAN_CONFIG_CANDIDATES: Readonly<Record<string, readonly string[]>>;
|
|
5
5
|
export declare function expandObsidianPath(candidate: string, env?: Record<string, string | undefined>, home?: string): string;
|
|
6
6
|
export declare function firstExistingPath(candidates: readonly string[], expand: (candidate: string) => string, exists: (candidate: string) => boolean): string | null;
|
|
7
|
-
export
|
|
7
|
+
export interface ObsidianPathProbe {
|
|
8
8
|
expand?: (candidate: string) => string;
|
|
9
9
|
exists?: (candidate: string) => boolean;
|
|
10
10
|
readText?: (candidate: string) => string;
|
|
11
|
-
}
|
|
11
|
+
}
|
|
12
12
|
export declare function obsidianInstallState(platform: string | undefined, probe?: ObsidianPathProbe): 'installed' | 'missing';
|
|
13
13
|
export declare function parseObsidianCliEnabled(text: string): boolean | null;
|
|
14
14
|
export declare function obsidianCliState(platform: string | undefined, probe?: ObsidianPathProbe): 'enabled' | 'disabled' | 'unknown';
|
|
@@ -43,8 +43,9 @@ export function expandObsidianPath(candidate, env = environment(), home = homedi
|
|
|
43
43
|
export function firstExistingPath(candidates, expand, exists) {
|
|
44
44
|
for (const candidate of candidates) {
|
|
45
45
|
const expanded = expand(candidate);
|
|
46
|
-
if (expanded && exists(expanded))
|
|
46
|
+
if (expanded && exists(expanded)) {
|
|
47
47
|
return expanded;
|
|
48
|
+
}
|
|
48
49
|
}
|
|
49
50
|
return null;
|
|
50
51
|
}
|
|
@@ -57,6 +58,9 @@ export function obsidianInstallState(platform, probe = {}) {
|
|
|
57
58
|
export function parseObsidianCliEnabled(text) {
|
|
58
59
|
try {
|
|
59
60
|
const value = JSON.parse(text);
|
|
61
|
+
if (typeof value !== 'object' || value === null || !('cli' in value)) {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
60
64
|
return typeof value.cli === 'boolean' ? value.cli : null;
|
|
61
65
|
}
|
|
62
66
|
catch {
|
|
@@ -68,11 +72,15 @@ export function obsidianCliState(platform, probe = {}) {
|
|
|
68
72
|
const exists = probe.exists ?? ((candidate) => fs.existsSync(candidate));
|
|
69
73
|
const readText = probe.readText ?? ((candidate) => fs.readFileSync(candidate, 'utf8'));
|
|
70
74
|
const config = firstExistingPath(OBSIDIAN_CONFIG_CANDIDATES[platform ?? ''] ?? [], expand, exists);
|
|
71
|
-
if (!config)
|
|
75
|
+
if (!config) {
|
|
72
76
|
return 'unknown';
|
|
77
|
+
}
|
|
73
78
|
try {
|
|
74
79
|
const enabled = parseObsidianCliEnabled(readText(config));
|
|
75
|
-
|
|
80
|
+
if (enabled === null) {
|
|
81
|
+
return 'unknown';
|
|
82
|
+
}
|
|
83
|
+
return enabled ? 'enabled' : 'disabled';
|
|
76
84
|
}
|
|
77
85
|
catch {
|
|
78
86
|
return 'unknown';
|
|
@@ -10,9 +10,11 @@ export interface SkillFileContent {
|
|
|
10
10
|
export declare function listManagedSkills(baseDir: string, overlayDir: string | null): Promise<ManagedSkill[]>;
|
|
11
11
|
export declare function readSkillFile(baseDir: string, overlayDir: string | null, name: string): Promise<SkillFileContent | null>;
|
|
12
12
|
export declare function writeSkillFile(overlayDir: string, name: string, content: string): Promise<string>;
|
|
13
|
-
export
|
|
13
|
+
export interface CopyBaseResult {
|
|
14
14
|
copied: boolean;
|
|
15
|
-
}
|
|
16
|
-
export declare function
|
|
15
|
+
}
|
|
16
|
+
export declare function copyBaseForEdit(baseDir: string, overlayDir: string, name: string): Promise<CopyBaseResult>;
|
|
17
|
+
export interface DeleteOverlayResult {
|
|
17
18
|
removed: boolean;
|
|
18
|
-
}
|
|
19
|
+
}
|
|
20
|
+
export declare function deleteOverlaySkill(overlayDir: string, name: string): Promise<DeleteOverlayResult>;
|
|
@@ -41,8 +41,9 @@ export async function readSkillFile(baseDir, overlayDir, name) {
|
|
|
41
41
|
assertSafeName(name);
|
|
42
42
|
if (overlayDir) {
|
|
43
43
|
const over = await readIfPresent(path.join(overlayDir, name, 'SKILL.md'));
|
|
44
|
-
if (over !== null)
|
|
44
|
+
if (over !== null) {
|
|
45
45
|
return { content: over, origin: 'overlay' };
|
|
46
|
+
}
|
|
46
47
|
}
|
|
47
48
|
const base = await readIfPresent(path.join(baseDir, name, 'SKILL.md'));
|
|
48
49
|
return base !== null ? { content: base, origin: 'base' } : null;
|
|
@@ -60,19 +61,22 @@ export async function writeSkillFile(overlayDir, name, content) {
|
|
|
60
61
|
export async function copyBaseForEdit(baseDir, overlayDir, name) {
|
|
61
62
|
assertSafeName(name);
|
|
62
63
|
const dest = path.join(overlayDir, name);
|
|
63
|
-
if (await exists(dest))
|
|
64
|
+
if (await exists(dest)) {
|
|
64
65
|
return { copied: false };
|
|
66
|
+
}
|
|
65
67
|
const src = path.join(baseDir, name);
|
|
66
|
-
if (!(await exists(src)))
|
|
68
|
+
if (!(await exists(src))) {
|
|
67
69
|
throw new Error(`skill not found: ${name}`);
|
|
70
|
+
}
|
|
68
71
|
await copyDir(src, dest);
|
|
69
72
|
return { copied: true };
|
|
70
73
|
}
|
|
71
74
|
export async function deleteOverlaySkill(overlayDir, name) {
|
|
72
75
|
assertSafeName(name);
|
|
73
76
|
const dir = path.join(overlayDir, name);
|
|
74
|
-
if (!(await exists(dir)))
|
|
77
|
+
if (!(await exists(dir))) {
|
|
75
78
|
return { removed: false };
|
|
79
|
+
}
|
|
76
80
|
await fs.promises.rm(dir, { recursive: true, force: true });
|
|
77
81
|
return { removed: true };
|
|
78
82
|
}
|
|
@@ -90,9 +94,11 @@ async function copyDir(src, dest) {
|
|
|
90
94
|
for (const entry of await fs.promises.readdir(src, { withFileTypes: true })) {
|
|
91
95
|
const from = path.join(src, entry.name);
|
|
92
96
|
const to = path.join(dest, entry.name);
|
|
93
|
-
if (entry.isDirectory())
|
|
97
|
+
if (entry.isDirectory()) {
|
|
94
98
|
await copyDir(from, to);
|
|
95
|
-
|
|
99
|
+
}
|
|
100
|
+
else if (entry.isFile()) {
|
|
96
101
|
await fs.promises.writeFile(to, await fs.promises.readFile(from));
|
|
102
|
+
}
|
|
97
103
|
}
|
|
98
104
|
}
|
|
@@ -6,8 +6,9 @@ const SDK_CONFIG_PATH_ENV = 'QVAC_CONFIG_PATH';
|
|
|
6
6
|
const OVERLAY_DIR_NAME = 'skills';
|
|
7
7
|
export function resolveSkillsOverlayDir(env = process.env) {
|
|
8
8
|
const configPath = env[SDK_CONFIG_PATH_ENV];
|
|
9
|
-
if (!configPath)
|
|
9
|
+
if (!configPath) {
|
|
10
10
|
return null;
|
|
11
|
+
}
|
|
11
12
|
return path.join(path.dirname(configPath), OVERLAY_DIR_NAME);
|
|
12
13
|
}
|
|
13
14
|
export function ensureSkillsOverlayDir(env = process.env) {
|
|
@@ -16,7 +17,8 @@ export function ensureSkillsOverlayDir(env = process.env) {
|
|
|
16
17
|
}
|
|
17
18
|
async function materialize(dir) {
|
|
18
19
|
await fs.promises.mkdir(dir, { recursive: true });
|
|
19
|
-
if (os.platform() !== 'win32')
|
|
20
|
+
if (os.platform() !== 'win32') {
|
|
20
21
|
await fs.promises.chmod(dir, 0o700);
|
|
22
|
+
}
|
|
21
23
|
return dir;
|
|
22
24
|
}
|
|
@@ -7,7 +7,8 @@ export type OverlayChangeStream = AsyncIterable<{
|
|
|
7
7
|
destroy?: () => void;
|
|
8
8
|
};
|
|
9
9
|
export type WatchStreamFactory = (overlayDir: string) => OverlayChangeStream;
|
|
10
|
-
export
|
|
10
|
+
export interface WatchSkillsOverlayOptions {
|
|
11
11
|
debounceMs?: number;
|
|
12
12
|
createStream?: WatchStreamFactory;
|
|
13
|
-
}
|
|
13
|
+
}
|
|
14
|
+
export declare function watchSkillsOverlay(overlayDir: string, onChange: () => void, opts?: WatchSkillsOverlayOptions): OverlayWatcher;
|
|
@@ -9,19 +9,22 @@ export function watchSkillsOverlay(overlayDir, onChange, opts = {}) {
|
|
|
9
9
|
const schedule = () => {
|
|
10
10
|
if (stopped)
|
|
11
11
|
return;
|
|
12
|
-
if (timer)
|
|
12
|
+
if (timer) {
|
|
13
13
|
clearTimeout(timer);
|
|
14
|
+
}
|
|
14
15
|
timer = setTimeout(() => {
|
|
15
16
|
timer = null;
|
|
16
|
-
if (!stopped)
|
|
17
|
+
if (!stopped) {
|
|
17
18
|
onChange();
|
|
19
|
+
}
|
|
18
20
|
}, debounceMs);
|
|
19
21
|
};
|
|
20
22
|
void (async () => {
|
|
21
23
|
try {
|
|
22
24
|
for await (const batch of stream) {
|
|
23
|
-
if (batch?.diff && batch.diff.length > 0)
|
|
25
|
+
if (batch?.diff && batch.diff.length > 0) {
|
|
24
26
|
schedule();
|
|
27
|
+
}
|
|
25
28
|
}
|
|
26
29
|
}
|
|
27
30
|
catch {
|
|
@@ -32,8 +35,9 @@ export function watchSkillsOverlay(overlayDir, onChange, opts = {}) {
|
|
|
32
35
|
if (stopped)
|
|
33
36
|
return;
|
|
34
37
|
stopped = true;
|
|
35
|
-
if (timer)
|
|
38
|
+
if (timer) {
|
|
36
39
|
clearTimeout(timer);
|
|
40
|
+
}
|
|
37
41
|
timer = null;
|
|
38
42
|
stream.destroy?.();
|
|
39
43
|
}
|
|
@@ -4,9 +4,7 @@ export function deriveSetup(entry, state) {
|
|
|
4
4
|
return undefined;
|
|
5
5
|
return {
|
|
6
6
|
...entry.setup,
|
|
7
|
-
|
|
8
|
-
? { routes: entry.setup.routes.map((route) => withSatisfied(route, state)) }
|
|
9
|
-
: {})
|
|
7
|
+
routes: entry.setup.routes?.map((route) => withSatisfied(route, state))
|
|
10
8
|
};
|
|
11
9
|
}
|
|
12
10
|
function withSatisfied(route, state) {
|
|
@@ -19,7 +19,10 @@ function envToken(value) {
|
|
|
19
19
|
return value.toUpperCase().replace(/[^A-Z0-9]/g, '_');
|
|
20
20
|
}
|
|
21
21
|
function settingKeyToken(value) {
|
|
22
|
-
return value
|
|
22
|
+
return value
|
|
23
|
+
.toUpperCase()
|
|
24
|
+
.replace(/-/g, '_H_')
|
|
25
|
+
.replace(/[^A-Z0-9_]/g, '_');
|
|
23
26
|
}
|
|
24
27
|
export function settingsEnv(skill, settings) {
|
|
25
28
|
const env = {};
|
|
@@ -25,16 +25,11 @@ export interface SkillStateInputs {
|
|
|
25
25
|
readonly obsidianProbe?: ObsidianPathProbe;
|
|
26
26
|
readonly binOnPath?: (bin: string, platform?: string) => boolean;
|
|
27
27
|
}
|
|
28
|
-
export declare function isStub(entry:
|
|
29
|
-
|
|
30
|
-
}): boolean;
|
|
31
|
-
export declare function isToolSupported(entry: {
|
|
28
|
+
export declare function isStub(entry: Pick<SkillStateEntry, 'stub'>): boolean;
|
|
29
|
+
export interface SkillToolsEntry {
|
|
32
30
|
readonly tools: readonly string[];
|
|
33
|
-
}
|
|
34
|
-
export declare function
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export declare function isModelCompatible(entry: {
|
|
38
|
-
readonly minCapabilityProfile?: string;
|
|
39
|
-
}, activeProfile: CapabilityProfile | undefined): boolean;
|
|
31
|
+
}
|
|
32
|
+
export declare function isToolSupported(entry: SkillToolsEntry, installedTools: ReadonlySet<string>): boolean;
|
|
33
|
+
export declare function supportsPlatform(entry: Pick<SkillStateEntry, 'platform'>, platform: string | undefined): boolean;
|
|
34
|
+
export declare function isModelCompatible(entry: Pick<SkillStateEntry, 'minCapabilityProfile'>, activeProfile: CapabilityProfile | undefined): boolean;
|
|
40
35
|
export declare function resolveSkillState(entry: SkillStateEntry, inputs?: SkillStateInputs): Promise<SkillState>;
|