@qvac/harness 1.0.0-rc.2 → 1.0.0-rc.4
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/.nvmrc +1 -0
- package/CHANGELOG.md +2280 -1485
- package/README.md +56 -43
- package/dist-lib/index.d.ts +50 -6
- package/dist-lib/index.js +130 -28
- package/dist-lib/lib/agent/delegate.d.ts +3 -2
- package/dist-lib/lib/agent/delegate.js +6 -4
- package/dist-lib/lib/agent/follow.d.ts +5 -0
- package/dist-lib/lib/agent/follow.js +2 -0
- package/dist-lib/lib/agent/resolve.js +22 -17
- package/dist-lib/lib/agent/tool-selection.d.ts +4 -2
- package/dist-lib/lib/agent/tool-selection.js +5 -6
- package/dist-lib/lib/agent/tools.d.ts +1 -0
- package/dist-lib/lib/agent/tools.js +2 -1
- package/dist-lib/lib/capabilities/agent-ports.js +3 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/batching.js +1 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +2 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +60 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +4 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +35 -6
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +2 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +67 -27
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +6 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +61 -16
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +23 -13
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +8 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +61 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.d.ts +5 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +47 -21
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +30 -5
- package/dist-lib/lib/capabilities/completion-engine/driver.js +27 -11
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/durable.js +5 -1
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/index.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +15 -2
- package/dist-lib/lib/capabilities/completion-engine/loop.js +7 -0
- package/dist-lib/lib/capabilities/completion-engine/metrics.d.ts +9 -2
- package/dist-lib/lib/capabilities/completion-engine/metrics.js +28 -7
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +46 -0
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +45 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/ports.js +3 -7
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +23 -3
- package/dist-lib/lib/capabilities/completion-engine/round.js +323 -97
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +10 -3
- package/dist-lib/lib/capabilities/completion-engine/session.js +30 -2
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +3 -2
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +4 -3
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +15 -10
- package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +11 -4
- package/dist-lib/lib/capabilities/completion-engine/turns.js +48 -65
- package/dist-lib/lib/capabilities/download.d.ts +9 -7
- package/dist-lib/lib/capabilities/download.js +1 -1
- package/dist-lib/lib/capabilities/enhance.d.ts +1 -1
- package/dist-lib/lib/capabilities/enhance.js +20 -8
- package/dist-lib/lib/capabilities/preview-model-source.d.ts +7 -0
- package/dist-lib/lib/capabilities/preview-model-source.js +83 -23
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +1 -0
- package/dist-lib/lib/capabilities/sdk-tool.js +18 -1
- package/dist-lib/lib/capabilities/tool-plan.d.ts +1 -1
- package/dist-lib/lib/capabilities/tool-plan.js +5 -5
- package/dist-lib/lib/capabilities/tool-prompt-log.js +3 -3
- package/dist-lib/lib/capabilities/tool-turns.d.ts +7 -9
- package/dist-lib/lib/capabilities/tool-turns.js +25 -20
- package/dist-lib/lib/client/index.d.ts +19 -0
- package/dist-lib/lib/client/index.js +262 -0
- package/dist-lib/lib/connect.d.ts +13 -10
- package/dist-lib/lib/connect.js +62 -24
- package/dist-lib/lib/context-window.d.ts +1 -0
- package/dist-lib/lib/context-window.js +3 -3
- package/dist-lib/lib/contract/agent.d.ts +7 -3
- package/dist-lib/lib/contract/completion.d.ts +44 -29
- package/dist-lib/lib/contract/egress-proxy.d.ts +13 -0
- package/dist-lib/lib/contract/egress-proxy.js +1 -0
- package/dist-lib/lib/contract/exec.d.ts +3 -3
- package/dist-lib/lib/contract/hooks.d.ts +4 -1
- package/dist-lib/lib/contract/index.d.ts +1 -0
- package/dist-lib/lib/contract/models.d.ts +6 -4
- package/dist-lib/lib/contract/policy.d.ts +75 -0
- package/dist-lib/lib/contract/policy.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +9 -3
- package/dist-lib/lib/contract/sandbox.d.ts +3 -1
- package/dist-lib/lib/contract/translation.d.ts +20 -0
- package/dist-lib/lib/contract/translation.js +1 -0
- package/dist-lib/lib/contract-types.d.ts +32 -14
- package/dist-lib/lib/embeddings/index.d.ts +7 -1
- package/dist-lib/lib/embeddings/index.js +26 -5
- package/dist-lib/lib/errors.d.ts +266 -0
- package/dist-lib/lib/errors.js +198 -0
- package/dist-lib/lib/fold/index.d.ts +25 -1
- package/dist-lib/lib/fold/index.js +75 -9
- package/dist-lib/lib/guarded-fetch.js +11 -7
- package/dist-lib/lib/hardware/gpu-probe.js +10 -1
- package/dist-lib/lib/helpers/completion-params.d.ts +6 -2
- package/dist-lib/lib/helpers/completion-params.js +10 -1
- package/dist-lib/lib/helpers/engine-error.d.ts +2 -1
- package/dist-lib/lib/helpers/engine-error.js +12 -12
- package/dist-lib/lib/helpers/goal-check.d.ts +4 -0
- package/dist-lib/lib/helpers/goal-check.js +81 -0
- package/dist-lib/lib/helpers/head-tail.js +1 -1
- package/dist-lib/lib/helpers/load-stall.d.ts +1 -1
- package/dist-lib/lib/helpers/load-stall.js +2 -2
- package/dist-lib/lib/helpers/markup-stream-filter.d.ts +4 -1
- package/dist-lib/lib/helpers/markup-stream-filter.js +20 -6
- package/dist-lib/lib/helpers/repeated-reply.js +24 -16
- package/dist-lib/lib/helpers/thinking.d.ts +3 -2
- package/dist-lib/lib/helpers/thinking.js +19 -0
- package/dist-lib/lib/hooks/built-in/arg-repair.js +6 -2
- package/dist-lib/lib/hooks/built-in/policy-rules.d.ts +8 -0
- package/dist-lib/lib/hooks/built-in/policy-rules.js +192 -0
- package/dist-lib/lib/hooks/built-in/sandbox.js +23 -5
- package/dist-lib/lib/hooks/index.d.ts +4 -1
- package/dist-lib/lib/hooks/index.js +9 -4
- package/dist-lib/lib/hooks/run.js +3 -3
- package/dist-lib/lib/lifecycle/index.js +15 -14
- package/dist-lib/lib/lifecycle/machine.js +2 -2
- package/dist-lib/lib/log.d.ts +26 -5
- package/dist-lib/lib/log.js +86 -23
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +4 -2
- package/dist-lib/lib/machine/completion/actions/completion.js +75 -10
- package/dist-lib/lib/machine/completion/actions/prepare.js +1 -1
- package/dist-lib/lib/machine/completion/actions/tools.js +48 -5
- package/dist-lib/lib/machine/completion/context.js +4 -1
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +1 -0
- package/dist-lib/lib/machine/completion/guards/retry.js +8 -2
- package/dist-lib/lib/machine/completion/implementations.d.ts +10 -4
- package/dist-lib/lib/machine/completion/implementations.js +27 -6
- package/dist-lib/lib/machine/completion/machine.d.ts +21 -3
- package/dist-lib/lib/machine/completion/machine.js +33 -4
- package/dist-lib/lib/machine/completion/rules.d.ts +17 -2
- package/dist-lib/lib/machine/completion/rules.js +49 -3
- package/dist-lib/lib/machine/completion/types.d.ts +36 -0
- package/dist-lib/lib/machine/index.d.ts +27 -4
- package/dist-lib/lib/machine/index.js +6 -1
- package/dist-lib/lib/models/context-choice.d.ts +15 -0
- package/dist-lib/lib/models/context-choice.js +55 -0
- package/dist-lib/lib/models/download-gate.d.ts +20 -0
- package/dist-lib/lib/models/download-gate.js +73 -0
- package/dist-lib/lib/models/gguf-header.d.ts +5 -0
- package/dist-lib/lib/models/gguf-header.js +165 -14
- package/dist-lib/lib/models/llm-presets.d.ts +5 -1
- package/dist-lib/lib/models/llm-presets.js +6 -5
- package/dist-lib/lib/models/memory-cap.d.ts +13 -0
- package/dist-lib/lib/models/memory-cap.js +21 -0
- package/dist-lib/lib/models/model-catalog.d.ts +2 -0
- package/dist-lib/lib/models/model-catalog.js +15 -0
- package/dist-lib/lib/models/model-fit.d.ts +1 -1
- package/dist-lib/lib/models/model-fit.js +5 -6
- package/dist-lib/lib/models/model-handle.d.ts +8 -2
- package/dist-lib/lib/models/model-handle.js +14 -3
- package/dist-lib/lib/models/model-list.d.ts +8 -1
- package/dist-lib/lib/models/model-list.js +23 -0
- package/dist-lib/lib/models/model-pool.d.ts +35 -5
- package/dist-lib/lib/models/model-pool.js +121 -43
- package/dist-lib/lib/models/model-source.d.ts +1 -0
- package/dist-lib/lib/models/model-source.js +23 -5
- package/dist-lib/lib/models/sdk-faults.d.ts +1 -0
- package/dist-lib/lib/models/sdk-faults.js +9 -0
- package/dist-lib/lib/no-redirect-fetch-bare.js +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +2 -1
- package/dist-lib/lib/office/engine/pptx/picture-area.d.ts +23 -0
- package/dist-lib/lib/office/engine/pptx/picture-area.js +84 -0
- package/dist-lib/lib/office/engine/pptx/presentation.d.ts +2 -0
- package/dist-lib/lib/office/engine/pptx/presentation.js +55 -17
- package/dist-lib/lib/office/engine/pptx/types.d.ts +1 -0
- package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +1 -0
- package/dist-lib/lib/office/engine/xlsx/workbook.js +34 -3
- package/dist-lib/lib/office/extract.js +4 -3
- package/dist-lib/lib/office/index.js +2 -1
- package/dist-lib/lib/plugins/registry.d.ts +3 -0
- package/dist-lib/lib/plugins/registry.js +16 -7
- package/dist-lib/lib/policy/index.d.ts +10 -0
- package/dist-lib/lib/policy/index.js +229 -0
- package/dist-lib/lib/prompt.d.ts +1 -0
- package/dist-lib/lib/prompt.js +7 -1
- package/dist-lib/lib/residency/completion-runtime.d.ts +1 -0
- package/dist-lib/lib/residency/completion-runtime.js +11 -4
- package/dist-lib/lib/residency/index.d.ts +44 -4
- package/dist-lib/lib/residency/index.js +399 -35
- package/dist-lib/lib/resolution-detector.js +3 -3
- package/dist-lib/lib/rpc-session.js +2 -1
- package/dist-lib/lib/sdk-loader.js +17 -11
- package/dist-lib/lib/serve.js +76 -36
- package/dist-lib/lib/sidecar/index.d.ts +29 -0
- package/dist-lib/lib/sidecar/index.js +174 -0
- package/dist-lib/lib/sidecar/user-plugins.d.ts +8 -0
- package/dist-lib/lib/sidecar/user-plugins.js +117 -0
- package/dist-lib/lib/skills-host/index.d.ts +1 -0
- package/dist-lib/lib/skills-host/index.js +8 -4
- package/dist-lib/lib/spawn.d.ts +3 -4
- package/dist-lib/lib/spawn.js +17 -17
- package/dist-lib/lib/spill.d.ts +1 -0
- package/dist-lib/lib/spill.js +12 -8
- package/dist-lib/lib/tools/attachments/staging.js +8 -8
- package/dist-lib/lib/tools/exec/runner.js +2 -1
- package/dist-lib/lib/tools/exec/scope.d.ts +0 -1
- package/dist-lib/lib/tools/exec/scope.js +23 -114
- package/dist-lib/lib/tools/exec/shell-guidance.js +4 -4
- package/dist-lib/lib/tools/exec/shell-line.d.ts +26 -0
- package/dist-lib/lib/tools/exec/shell-line.js +334 -0
- package/dist-lib/lib/tools/exec.d.ts +4 -1
- package/dist-lib/lib/tools/exec.js +87 -26
- package/dist-lib/lib/tools/files/edit-file.d.ts +3 -0
- package/dist-lib/lib/tools/files/edit-file.js +74 -0
- package/dist-lib/lib/tools/files/glob.d.ts +3 -0
- package/dist-lib/lib/tools/files/glob.js +65 -0
- package/dist-lib/lib/tools/files/grep.d.ts +6 -0
- package/dist-lib/lib/tools/files/grep.js +114 -0
- package/dist-lib/lib/tools/files/index.d.ts +3 -0
- package/dist-lib/lib/tools/files/index.js +23 -0
- package/dist-lib/lib/tools/files/list-dir.d.ts +6 -0
- package/dist-lib/lib/tools/files/list-dir.js +136 -0
- package/dist-lib/lib/tools/files/make-dir.d.ts +3 -0
- package/dist-lib/lib/tools/files/make-dir.js +48 -0
- package/dist-lib/lib/tools/files/read-file.d.ts +3 -0
- package/dist-lib/lib/tools/files/read-file.js +105 -0
- package/dist-lib/lib/tools/files/transfer.d.ts +4 -0
- package/dist-lib/lib/tools/files/transfer.js +83 -0
- package/dist-lib/lib/tools/files/trash-file.d.ts +4 -0
- package/dist-lib/lib/tools/files/trash-file.js +62 -0
- package/dist-lib/lib/tools/files/write-file.d.ts +3 -0
- package/dist-lib/lib/tools/files/write-file.js +56 -0
- package/dist-lib/lib/tools/fs/document-text.d.ts +2 -0
- package/dist-lib/lib/tools/fs/document-text.js +38 -0
- package/dist-lib/lib/tools/fs/drive.d.ts +14 -3
- package/dist-lib/lib/tools/fs/drive.js +9 -1
- package/dist-lib/lib/tools/fs/edit-match.d.ts +11 -0
- package/dist-lib/lib/tools/fs/edit-match.js +85 -0
- package/dist-lib/lib/tools/fs/ignore.d.ts +13 -0
- package/dist-lib/lib/tools/fs/ignore.js +104 -0
- package/dist-lib/lib/tools/fs/local.js +28 -5
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +23 -3
- package/dist-lib/lib/tools/fs/remote.d.ts +3 -4
- package/dist-lib/lib/tools/fs/remote.js +23 -13
- package/dist-lib/lib/tools/fs/scope.d.ts +5 -1
- package/dist-lib/lib/tools/fs/scope.js +5 -2
- package/dist-lib/lib/tools/fs/search.d.ts +41 -0
- package/dist-lib/lib/tools/fs/search.js +382 -0
- package/dist-lib/lib/tools/{file-glob.d.ts → fs/targets.d.ts} +1 -5
- package/dist-lib/lib/tools/fs/targets.js +32 -0
- package/dist-lib/lib/tools/fs/tool-path.d.ts +27 -0
- package/dist-lib/lib/tools/fs/tool-path.js +70 -0
- package/dist-lib/lib/tools/fs/walk.d.ts +15 -3
- package/dist-lib/lib/tools/fs/walk.js +118 -24
- package/dist-lib/lib/tools/http-request.js +12 -2
- package/dist-lib/lib/tools/index.js +2 -10
- package/dist-lib/lib/tools/office/ops.js +1 -1
- package/dist-lib/lib/tools/office.js +77 -21
- package/dist-lib/lib/tools/pdf/build.d.ts +5 -1
- package/dist-lib/lib/tools/pdf/build.js +31 -6
- package/dist-lib/lib/tools/pdf.js +17 -2
- package/dist-lib/lib/tools/skill.js +10 -7
- package/dist-lib/lib/tools/skills/bundled-dir.js +4 -4
- package/dist-lib/lib/tools/skills/catalog.d.ts +2 -0
- package/dist-lib/lib/tools/skills/catalog.js +6 -2
- package/dist-lib/lib/tools/skills/cli-argv.js +25 -5
- package/dist-lib/lib/tools/skills/cli-schema-check.d.ts +1 -0
- package/dist-lib/lib/tools/skills/cli-schema-check.js +3 -0
- package/dist-lib/lib/tools/skills/cli-schema-load.js +10 -0
- package/dist-lib/lib/tools/skills/cli-schema-types.d.ts +2 -0
- package/dist-lib/lib/tools/skills/cli-schema.js +6 -3
- package/dist-lib/lib/tools/skills/credential-health.js +3 -3
- package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +2 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +4 -0
- package/dist-lib/lib/tools/skills/manifest-parse.d.ts +1 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +12 -0
- package/dist-lib/lib/tools/skills/mention-name.d.ts +6 -0
- package/dist-lib/lib/tools/skills/mention-name.js +6 -0
- package/dist-lib/lib/tools/skills/mention.d.ts +2 -2
- package/dist-lib/lib/tools/skills/mention.js +11 -4
- package/dist-lib/lib/tools/skills/overlay-crud.js +3 -2
- package/dist-lib/lib/tools/url-guard.d.ts +6 -1
- package/dist-lib/lib/tools/url-guard.js +8 -2
- package/dist-lib/lib/tools/web-fetch.js +10 -4
- package/dist-lib/lib/wire.js +3 -5
- package/dist-lib/plugins/coding/index.d.ts +1 -1
- package/dist-lib/plugins/coding/index.js +2 -4
- package/dist-lib/plugins/coding/session.d.ts +3 -3
- package/dist-lib/plugins/coding/session.js +26 -14
- package/dist-lib/plugins/command-hooks/index.js +5 -3
- package/dist-lib/plugins/egress-proxy/index.d.ts +53 -0
- package/dist-lib/plugins/egress-proxy/index.js +182 -0
- package/dist-lib/plugins/image/edit-image.js +4 -3
- package/dist-lib/plugins/image/generate-image.d.ts +4 -3
- package/dist-lib/plugins/image/generate-image.js +10 -9
- package/dist-lib/plugins/image/index.d.ts +1 -1
- package/dist-lib/plugins/image/index.js +13 -10
- package/dist-lib/plugins/language-hint/index.d.ts +15 -0
- package/dist-lib/plugins/language-hint/index.js +51 -0
- package/dist-lib/plugins/lsp/tool.js +2 -2
- package/dist-lib/plugins/mcp/index.js +6 -3
- package/dist-lib/plugins/music/generate-music.d.ts +4 -2
- package/dist-lib/plugins/music/generate-music.js +7 -4
- package/dist-lib/plugins/music/index.js +12 -9
- package/dist-lib/plugins/obsidian/command.js +2 -2
- package/dist-lib/plugins/obsidian/note-name.js +2 -1
- package/dist-lib/plugins/obsidian/safe-path.js +5 -4
- package/dist-lib/plugins/obsidian/vault-create.js +3 -2
- package/dist-lib/plugins/obsidian/vault-fs.js +2 -2
- package/dist-lib/plugins/obsidian/vault-paths.js +3 -2
- package/dist-lib/plugins/obsidian/vault-read.js +6 -5
- package/dist-lib/plugins/obsidian/vault-write.js +13 -12
- package/dist-lib/plugins/python/guarded-fetch.d.ts +2 -1
- package/dist-lib/plugins/python/guarded-fetch.js +5 -1
- package/dist-lib/plugins/python/interrupt-timer.js +2 -2
- package/dist-lib/plugins/python/loader.js +68 -3
- package/dist-lib/plugins/python/memfs.js +2 -2
- package/dist-lib/plugins/python/pyodide.d.ts +1 -0
- package/dist-lib/plugins/python/pyodide.js +9 -8
- package/dist-lib/plugins/python/python-adapter.js +3 -1
- package/dist-lib/plugins/python/run-session.d.ts +1 -0
- package/dist-lib/plugins/python/run-session.js +19 -8
- package/dist-lib/plugins/python/wheels.js +8 -6
- package/dist-lib/plugins/python/worker/active.js +2 -2
- package/dist-lib/plugins/python/worker/client.js +9 -8
- package/dist-lib/plugins/python/worker/protocol.d.ts +2 -0
- package/dist-lib/plugins/python/worker/serve.js +23 -4
- package/dist-lib/plugins/python/worker/spawn.d.ts +2 -1
- package/dist-lib/plugins/python/worker/spawn.js +2 -1
- package/dist-lib/plugins/run-report/chain.d.ts +2 -0
- package/dist-lib/plugins/run-report/chain.js +73 -0
- package/dist-lib/plugins/run-report/flow-view.js +2 -1
- package/dist-lib/plugins/run-report/flow.d.ts +1 -1
- package/dist-lib/plugins/run-report/flow.js +66 -14
- package/dist-lib/plugins/run-report/index.d.ts +23 -2
- package/dist-lib/plugins/run-report/index.js +27 -12
- package/dist-lib/plugins/run-report/model.d.ts +10 -1
- package/dist-lib/plugins/run-report/model.js +12 -6
- package/dist-lib/plugins/run-report/page.d.ts +9 -0
- package/dist-lib/plugins/run-report/page.js +55 -15
- package/dist-lib/plugins/run-report/script.js +317 -43
- package/dist-lib/plugins/run-report/story.d.ts +2 -1
- package/dist-lib/plugins/run-report/story.js +3 -3
- package/dist-lib/plugins/run-report/style.d.ts +1 -1
- package/dist-lib/plugins/run-report/style.js +126 -0
- package/dist-lib/plugins/run-report/why.js +1 -1
- package/dist-lib/plugins/sandbox-linux/index.d.ts +60 -0
- package/dist-lib/plugins/sandbox-linux/index.js +347 -0
- package/dist-lib/plugins/sandbox-linux/seccomp.d.ts +2 -0
- package/dist-lib/plugins/sandbox-linux/seccomp.js +74 -0
- package/dist-lib/plugins/sandbox-macos/index.d.ts +23 -11
- package/dist-lib/plugins/sandbox-macos/index.js +239 -49
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +4 -2
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +9 -4
- package/dist-lib/plugins/sandbox-windows/helper/qvac-sandbox.c +554 -0
- package/dist-lib/plugins/sandbox-windows/index.d.ts +53 -0
- package/dist-lib/plugins/sandbox-windows/index.js +205 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/speech/audio-resample.d.ts +1 -1
- package/dist-lib/plugins/speech/audio-resample.js +7 -8
- package/dist-lib/plugins/speech/audio-transcode-bare.d.ts +1 -1
- package/dist-lib/plugins/speech/audio-transcode-bare.js +23 -26
- package/dist-lib/plugins/speech/audio-transcode-node.d.ts +1 -1
- package/dist-lib/plugins/speech/audio-transcode-node.js +1 -3
- package/dist-lib/plugins/speech/speech-runtime.js +37 -37
- package/dist-lib/plugins/speech/voice.d.ts +5 -1
- package/dist-lib/plugins/speech/voice.js +100 -31
- package/dist-lib/plugins/translation/index.d.ts +1 -0
- package/dist-lib/plugins/translation/index.js +16 -9
- package/dist-lib/plugins/translation/translate.d.ts +7 -3
- package/dist-lib/plugins/translation/translate.js +64 -58
- package/dist-lib/plugins/weather/geocode.js +2 -1
- package/dist-lib/plugins/weather/lookup.js +5 -4
- package/dist-lib/plugins/web-search/engines/bing.js +2 -1
- package/dist-lib/plugins/web-search/engines/google.js +2 -1
- package/dist-lib/plugins/web-search/fetch-html.d.ts +5 -5
- package/dist-lib/plugins/web-search/fetch-html.js +12 -15
- package/dist-lib/plugins/web-search/tool.js +1 -0
- package/dist-lib/schema/harness.js +48 -7
- package/dist-lib/spec/bind.js +9 -0
- package/dist-lib/spec/calls.js +3 -0
- package/dist-lib/spec/hrpc/hrpc.json +42 -3
- package/dist-lib/spec/hrpc/index.js +44 -8
- package/dist-lib/spec/hrpc/messages.js +297 -202
- package/dist-lib/spec/hyperschema/index.js +297 -202
- package/dist-lib/spec/hyperschema/schema.json +155 -84
- package/dist-lib/spec/hyperschema/types.d.ts +23 -3
- package/package.json +101 -38
- package/patches/@qvac%2Finference@0.22.0.patch +59 -0
- package/patches/pyodide@314.0.2.patch +37 -8
- package/scripts/addon-externals.cjs +10 -5
- package/worker/harness-sidecar.mjs +18 -154
- package/dist-lib/lib/tools/create-documents.d.ts +0 -3
- package/dist-lib/lib/tools/create-documents.js +0 -95
- package/dist-lib/lib/tools/edit-documents.d.ts +0 -3
- package/dist-lib/lib/tools/edit-documents.js +0 -132
- package/dist-lib/lib/tools/exec/shell-argv.d.ts +0 -2
- package/dist-lib/lib/tools/exec/shell-argv.js +0 -61
- package/dist-lib/lib/tools/file-glob.js +0 -118
- package/dist-lib/lib/tools/grep.d.ts +0 -5
- package/dist-lib/lib/tools/grep.js +0 -184
- package/dist-lib/lib/tools/read-files.d.ts +0 -5
- package/dist-lib/lib/tools/read-files.js +0 -160
- package/dist-lib/plugins/coding/write-file.d.ts +0 -3
- package/dist-lib/plugins/coding/write-file.js +0 -52
- package/patches/@qvac%2Finference@0.21.0.patch +0 -67
- package/patches/bare-stow@0.1.5.patch +0 -68
- package/patches/hypercore-blob-server@1.15.0.patch +0 -15
|
@@ -2,6 +2,7 @@ import fs from 'fs';
|
|
|
2
2
|
import os from 'os';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import process from 'process';
|
|
5
|
+
import { HarnessError } from '../../errors.js';
|
|
5
6
|
import { userTmpPath } from '../../tmp-path.js';
|
|
6
7
|
import { hashBundledSkills } from './bundled-hash.js';
|
|
7
8
|
import { SKILLS as BUNDLED_SKILLS } from '@qvac/skills/bundled';
|
|
@@ -26,7 +27,7 @@ async function materialize() {
|
|
|
26
27
|
try {
|
|
27
28
|
await writeTree(staging);
|
|
28
29
|
if (!(await validTree(staging))) {
|
|
29
|
-
throw new
|
|
30
|
+
throw new HarnessError('BUNDLED_SKILLS_INVALID', [staging]);
|
|
30
31
|
}
|
|
31
32
|
if (await tryRename(staging, dir)) {
|
|
32
33
|
return dir;
|
|
@@ -58,12 +59,11 @@ async function materialize() {
|
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
function tamperError(dir) {
|
|
61
|
-
return new
|
|
62
|
-
'another process is tampering with it; remove it and restart');
|
|
62
|
+
return new HarnessError('BUNDLED_SKILLS_TAMPERED', [dir]);
|
|
63
63
|
}
|
|
64
64
|
function occupiedError(dir, cause) {
|
|
65
65
|
const why = cause instanceof Error ? ` (${cause.message})` : '';
|
|
66
|
-
return new
|
|
66
|
+
return new HarnessError('BUNDLED_SKILLS_OCCUPIED', [dir, why]);
|
|
67
67
|
}
|
|
68
68
|
export function randomSuffix() {
|
|
69
69
|
return Math.random().toString(36).slice(2, 10);
|
|
@@ -10,6 +10,7 @@ import { type OperationSpec } from '../operations/manifest.ts';
|
|
|
10
10
|
import type { CapabilityProfile } from '../../models/model-catalog.ts';
|
|
11
11
|
export interface SkillCatalogEntry {
|
|
12
12
|
name: string;
|
|
13
|
+
displayName?: string;
|
|
13
14
|
description: string;
|
|
14
15
|
contentDigest?: string;
|
|
15
16
|
aliases?: string[];
|
|
@@ -22,6 +23,7 @@ export interface SkillCatalogEntry {
|
|
|
22
23
|
requires?: SkillRequires;
|
|
23
24
|
install?: InstallStep[];
|
|
24
25
|
setup?: SkillSetup;
|
|
26
|
+
env?: Readonly<Record<string, string>>;
|
|
25
27
|
cliValidator?: CliValidator;
|
|
26
28
|
stub?: boolean;
|
|
27
29
|
minCapabilityProfile?: string;
|
|
@@ -11,7 +11,7 @@ import { Agent } from '../../agent/index.js';
|
|
|
11
11
|
import { deriveSetup } from './setup-routes.js';
|
|
12
12
|
import { resolveSkillsOverlayDir } from './overlay-dir.js';
|
|
13
13
|
import { parseOperationsManifest } from '../operations/manifest.js';
|
|
14
|
-
import {
|
|
14
|
+
import { HarnessLog } from '../../log.js';
|
|
15
15
|
export function skillSupportsPlatform(entry, platform) {
|
|
16
16
|
return supportsPlatform(entry, platform);
|
|
17
17
|
}
|
|
@@ -84,9 +84,11 @@ function mergeOverlay(base, overlay) {
|
|
|
84
84
|
contentDigest: createHash('sha256')
|
|
85
85
|
.update(`${base.contentDigest ?? ''}:${overlay.contentDigest ?? ''}`)
|
|
86
86
|
.digest('hex'),
|
|
87
|
+
displayName: base.displayName,
|
|
87
88
|
credentials: base.credentials,
|
|
88
89
|
allowList: base.allowList,
|
|
89
90
|
platform: base.platform,
|
|
91
|
+
env: base.env,
|
|
90
92
|
operations: base.operations,
|
|
91
93
|
mcpReads: base.mcpReads
|
|
92
94
|
};
|
|
@@ -166,6 +168,7 @@ async function loadEntry(skillsDir, dir, origin) {
|
|
|
166
168
|
const platform = platformsOf(meta.platform, origin);
|
|
167
169
|
return {
|
|
168
170
|
name: dir,
|
|
171
|
+
displayName: origin === 'overlay' ? undefined : meta.displayName || undefined,
|
|
169
172
|
description: meta.description ?? '',
|
|
170
173
|
contentDigest: contentHash.digest('hex'),
|
|
171
174
|
aliases: meta.aliases,
|
|
@@ -178,6 +181,7 @@ async function loadEntry(skillsDir, dir, origin) {
|
|
|
178
181
|
requires: meta.requires,
|
|
179
182
|
install: meta.install,
|
|
180
183
|
setup: meta.setup,
|
|
184
|
+
env: origin === 'overlay' ? undefined : meta.env,
|
|
181
185
|
cliValidator: cli ? buildCliValidator(cli) : undefined,
|
|
182
186
|
stub: meta.stub,
|
|
183
187
|
minCapabilityProfile: meta.minCapabilityProfile || undefined,
|
|
@@ -201,7 +205,7 @@ async function loadOperations(skillDir, name) {
|
|
|
201
205
|
}
|
|
202
206
|
const operations = parseOperationsManifest(raw);
|
|
203
207
|
if (!operations) {
|
|
204
|
-
|
|
208
|
+
HarnessLog.warn('skill operations manifest rejected', { skill: name });
|
|
205
209
|
return [];
|
|
206
210
|
}
|
|
207
211
|
return operations;
|
|
@@ -19,7 +19,7 @@ export function walkCommands(argv, schema) {
|
|
|
19
19
|
}
|
|
20
20
|
export function argvToObject(argv, schema) {
|
|
21
21
|
const { node, pathSegs, index } = walkCommands(argv, schema);
|
|
22
|
-
const leaf = parseParams(argv.slice(index), node);
|
|
22
|
+
const leaf = parseParams(argv.slice(index), node, pathSegs.join(' '));
|
|
23
23
|
if (typeof leaf === 'string') {
|
|
24
24
|
return leaf;
|
|
25
25
|
}
|
|
@@ -52,7 +52,27 @@ function flagParts(tok) {
|
|
|
52
52
|
}
|
|
53
53
|
return { key: body.slice(0, ieq), inline: body.slice(ieq + 1) };
|
|
54
54
|
}
|
|
55
|
-
function
|
|
55
|
+
function accepted(schema, command) {
|
|
56
|
+
const commands = [];
|
|
57
|
+
const params = [];
|
|
58
|
+
for (const [key, prop] of Object.entries(objectProps(schema))) {
|
|
59
|
+
if (isObjectSchema(prop)) {
|
|
60
|
+
commands.push(key);
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
params.push(key);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const parts = [];
|
|
67
|
+
if (commands.length) {
|
|
68
|
+
parts.push(`commands: ${commands.join(', ')}`);
|
|
69
|
+
}
|
|
70
|
+
if (params.length) {
|
|
71
|
+
parts.push(`${command || 'it'} takes: ${params.join(', ')}`);
|
|
72
|
+
}
|
|
73
|
+
return parts.length ? `; ${parts.join('; ')}` : '';
|
|
74
|
+
}
|
|
75
|
+
function parseParams(tokens, schema, command) {
|
|
56
76
|
const props = objectProps(schema);
|
|
57
77
|
const propSchemas = new Map(Object.entries(props));
|
|
58
78
|
const boolKeys = new Set(Object.entries(props)
|
|
@@ -77,7 +97,7 @@ function parseParams(tokens, schema) {
|
|
|
77
97
|
continue;
|
|
78
98
|
}
|
|
79
99
|
if (!canAbsorb) {
|
|
80
|
-
return `unknown parameter "${key}"`;
|
|
100
|
+
return `unknown parameter "${key}"${accepted(schema, command)}`;
|
|
81
101
|
}
|
|
82
102
|
}
|
|
83
103
|
const flag = tok.startsWith('-') ? flagParts(tok) : null;
|
|
@@ -103,7 +123,7 @@ function parseParams(tokens, schema) {
|
|
|
103
123
|
continue;
|
|
104
124
|
}
|
|
105
125
|
if (flag && !canAbsorb) {
|
|
106
|
-
return `unknown flag "--${flag.key}"`;
|
|
126
|
+
return `unknown flag "--${flag.key}"${accepted(schema, command)}`;
|
|
107
127
|
}
|
|
108
128
|
if (boolKeys.has(tok)) {
|
|
109
129
|
out[tok] = true;
|
|
@@ -131,7 +151,7 @@ function parseParams(tokens, schema) {
|
|
|
131
151
|
i++;
|
|
132
152
|
continue;
|
|
133
153
|
}
|
|
134
|
-
return `unexpected argument "${tok}"`;
|
|
154
|
+
return `unexpected argument "${tok}"${accepted(schema, command)}`;
|
|
135
155
|
}
|
|
136
156
|
if (restName && restVals.length > 0) {
|
|
137
157
|
out[restName] = restVals;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import type { JsonSchema } from './cli-schema-types.ts';
|
|
2
2
|
export declare function buildSchemaAnnotation(schema: JsonSchema): (argv: readonly string[]) => 'read' | 'write';
|
|
3
|
+
export declare function buildSchemaOutputCap(schema: JsonSchema): (argv: readonly string[]) => number | undefined;
|
|
3
4
|
export declare function buildSchemaCheck(schema: JsonSchema, resourcePaths: readonly string[] | undefined): (argv: readonly string[]) => string | null;
|
|
@@ -13,6 +13,9 @@ export function buildSchemaAnnotation(schema) {
|
|
|
13
13
|
return walkCommands(argv, schema).node['x-effect'] === 'read' ? 'read' : 'write';
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
|
+
export function buildSchemaOutputCap(schema) {
|
|
17
|
+
return (argv) => walkCommands(argv, schema).node['x-max-output-chars'];
|
|
18
|
+
}
|
|
16
19
|
function basename(p) {
|
|
17
20
|
return p.slice(Math.max(p.lastIndexOf('/'), p.lastIndexOf('\\')) + 1);
|
|
18
21
|
}
|
|
@@ -28,6 +28,9 @@ export async function resolveCliSchema(skillDir, bin, readFile = (p) => fs.promi
|
|
|
28
28
|
if (!resourceEffectsValid(schema)) {
|
|
29
29
|
return { bin, schemaFile: CLI_SCHEMA_FILENAME };
|
|
30
30
|
}
|
|
31
|
+
if (!outputCapsValid(schema)) {
|
|
32
|
+
return { bin, schemaFile: CLI_SCHEMA_FILENAME };
|
|
33
|
+
}
|
|
31
34
|
const resourcePaths = resolveResourcePaths(skillDir, schema);
|
|
32
35
|
return {
|
|
33
36
|
bin,
|
|
@@ -63,6 +66,13 @@ function resourceEffectsValid(schema) {
|
|
|
63
66
|
const files = new Set(schema['x-resource-files'] ?? []);
|
|
64
67
|
return Object.entries(effects).every(([file, effect]) => effect === 'read' && files.has(file));
|
|
65
68
|
}
|
|
69
|
+
function outputCapsValid(schema) {
|
|
70
|
+
const cap = schema['x-max-output-chars'];
|
|
71
|
+
if (cap !== undefined && !(Number.isInteger(cap) && cap > 0)) {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
return Object.values(schema.properties ?? {}).every(outputCapsValid);
|
|
75
|
+
}
|
|
66
76
|
function resolveResourcePaths(skillDir, schema) {
|
|
67
77
|
const resources = schema['x-resource-files'] ?? [];
|
|
68
78
|
return resources
|
|
@@ -13,6 +13,7 @@ export interface JsonSchema {
|
|
|
13
13
|
readonly 'x-resource-files'?: readonly string[];
|
|
14
14
|
readonly 'x-resource-effects'?: Readonly<Record<string, string>>;
|
|
15
15
|
readonly 'x-effect'?: string;
|
|
16
|
+
readonly 'x-max-output-chars'?: number;
|
|
16
17
|
readonly [key: string]: unknown;
|
|
17
18
|
}
|
|
18
19
|
export interface SkillCli {
|
|
@@ -28,4 +29,5 @@ export interface CliValidator {
|
|
|
28
29
|
readonly check: (argv: readonly string[]) => string | null;
|
|
29
30
|
readonly annotation: (argv: readonly string[]) => 'read' | 'write';
|
|
30
31
|
readonly effect: (argv: readonly string[]) => 'read' | 'write';
|
|
32
|
+
readonly outputCap: (argv: readonly string[]) => number | undefined;
|
|
31
33
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { CLI_SCHEMA_FILENAME } from './cli-schema-types.js';
|
|
2
2
|
export { argvToObject } from './cli-argv.js';
|
|
3
3
|
export { loadSkillCli, resolveCliSchema, execBinFromTools } from './cli-schema-load.js';
|
|
4
|
-
import { buildSchemaAnnotation, buildSchemaCheck } from './cli-schema-check.js';
|
|
4
|
+
import { buildSchemaAnnotation, buildSchemaCheck, buildSchemaOutputCap } from './cli-schema-check.js';
|
|
5
5
|
import { createHash } from 'crypto';
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import { errorCode } from '../../guards.js';
|
|
@@ -33,17 +33,20 @@ export function buildCliValidator(def) {
|
|
|
33
33
|
fingerprint,
|
|
34
34
|
check: () => 'skill cli schema is missing',
|
|
35
35
|
annotation: () => 'write',
|
|
36
|
-
effect: () => 'write'
|
|
36
|
+
effect: () => 'write',
|
|
37
|
+
outputCap: () => undefined
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
40
|
const check = buildSchemaCheck(def.schema, def.resourcePaths);
|
|
40
41
|
const annotation = buildSchemaAnnotation(def.schema);
|
|
42
|
+
const outputCap = buildSchemaOutputCap(def.schema);
|
|
41
43
|
return {
|
|
42
44
|
bin,
|
|
43
45
|
fingerprint,
|
|
44
46
|
check,
|
|
45
47
|
annotation,
|
|
46
|
-
effect: (argv) => (check(argv) === null ? annotation(argv) : 'write')
|
|
48
|
+
effect: (argv) => (check(argv) === null ? annotation(argv) : 'write'),
|
|
49
|
+
outputCap: (argv) => (check(argv) === null ? outputCap(argv) : undefined)
|
|
47
50
|
};
|
|
48
51
|
}
|
|
49
52
|
export function checkCliOps(argv, compiled) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HarnessLog } from '../../log.js';
|
|
2
2
|
import { scopeKey } from './scope-key.js';
|
|
3
3
|
const rejected = new Set();
|
|
4
4
|
const lastProbedAt = new Map();
|
|
@@ -16,12 +16,12 @@ export function markCredentialValid(key, agentId, skill) {
|
|
|
16
16
|
}
|
|
17
17
|
export function recordCredentialHealth(key, status, agentId) {
|
|
18
18
|
if (status === 401 || status === 403) {
|
|
19
|
-
|
|
19
|
+
HarnessLog.warn('credential rejected by provider', { key, status });
|
|
20
20
|
markCredentialRejected(key, agentId);
|
|
21
21
|
}
|
|
22
22
|
else if (status < 400) {
|
|
23
23
|
if (isCredentialRejected(key, agentId)) {
|
|
24
|
-
|
|
24
|
+
HarnessLog.info('credential recovered', { key });
|
|
25
25
|
}
|
|
26
26
|
markCredentialValid(key, agentId);
|
|
27
27
|
}
|
|
@@ -2,6 +2,7 @@ import type { InstallStep, SkillRequires, SkillSetup } from './manifest.ts';
|
|
|
2
2
|
export { credentialSlots, type CredentialSlotSource } from './credential-slots.ts';
|
|
3
3
|
export interface SkillFrontMatter {
|
|
4
4
|
name?: string;
|
|
5
|
+
displayName?: string;
|
|
5
6
|
description?: string;
|
|
6
7
|
aliases?: string[];
|
|
7
8
|
preloadOnName?: boolean;
|
|
@@ -13,6 +14,7 @@ export interface SkillFrontMatter {
|
|
|
13
14
|
requires?: SkillRequires;
|
|
14
15
|
install?: InstallStep[];
|
|
15
16
|
setup?: SkillSetup;
|
|
17
|
+
env?: Readonly<Record<string, string>>;
|
|
16
18
|
stub?: boolean;
|
|
17
19
|
minCapabilityProfile?: string;
|
|
18
20
|
emoji?: string;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { parseManifestBlock } from './manifest-parse.js';
|
|
2
|
+
import { isMentionHandle } from './mention-name.js';
|
|
2
3
|
export { credentialSlots } from './credential-slots.js';
|
|
3
4
|
const FRONT_MATTER_RE = /^---\r?\n([\s\S]*?)\r?\n---\r?\n?([\s\S]*)$/;
|
|
4
5
|
const FIELD_RE = /^([A-Za-z_][\w-]*):(.*)$/;
|
|
@@ -55,6 +56,9 @@ function parseFields(block) {
|
|
|
55
56
|
else if (key === 'name' || key === 'description') {
|
|
56
57
|
meta[key] = stripQuotes(value);
|
|
57
58
|
}
|
|
59
|
+
else if (key === 'display_name' && isMentionHandle(stripQuotes(value))) {
|
|
60
|
+
meta.displayName = stripQuotes(value);
|
|
61
|
+
}
|
|
58
62
|
else if (key === 'preload_on_name') {
|
|
59
63
|
meta.preloadOnName = stripQuotes(value).toLowerCase() !== 'false';
|
|
60
64
|
}
|
|
@@ -12,11 +12,23 @@ export function parseManifestBlock(block, key = 'metadata') {
|
|
|
12
12
|
requires,
|
|
13
13
|
install,
|
|
14
14
|
setup,
|
|
15
|
+
env: readEnv(oc.env),
|
|
15
16
|
stub: typeof oc.stub === 'boolean' ? oc.stub : undefined,
|
|
16
17
|
minCapabilityProfile: typeof oc.minCapabilityProfile === 'string' ? oc.minCapabilityProfile : undefined,
|
|
17
18
|
emoji: typeof oc.emoji === 'string' ? oc.emoji : undefined
|
|
18
19
|
};
|
|
19
20
|
}
|
|
21
|
+
function readEnv(v) {
|
|
22
|
+
if (!isObj(v))
|
|
23
|
+
return undefined;
|
|
24
|
+
const env = {};
|
|
25
|
+
for (const [name, value] of Object.entries(v)) {
|
|
26
|
+
if (typeof value === 'string' && /^[A-Z_][A-Z0-9_]*$/.test(name)) {
|
|
27
|
+
env[name] = value;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return Object.keys(env).length > 0 ? env : undefined;
|
|
31
|
+
}
|
|
20
32
|
function extractJsonBlock(block, key) {
|
|
21
33
|
const at = block.indexOf(`${key}:`);
|
|
22
34
|
if (at === -1) {
|
|
@@ -1 +1,7 @@
|
|
|
1
1
|
export declare function skillMentionName(text: string): string | null;
|
|
2
|
+
export declare function isMentionHandle(value: string): boolean;
|
|
3
|
+
export interface MentionableSkill {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly displayName?: string | undefined;
|
|
6
|
+
}
|
|
7
|
+
export declare function skillMentionHandle(skill: MentionableSkill): string;
|
|
@@ -2,3 +2,9 @@ const MENTION_PATTERN = /^@([a-z0-9][a-z0-9_-]*)(?=\s|$)/;
|
|
|
2
2
|
export function skillMentionName(text) {
|
|
3
3
|
return MENTION_PATTERN.exec(text.trimStart().toLowerCase())?.[1] ?? null;
|
|
4
4
|
}
|
|
5
|
+
export function isMentionHandle(value) {
|
|
6
|
+
return skillMentionName(`@${value}`) === value.toLowerCase();
|
|
7
|
+
}
|
|
8
|
+
export function skillMentionHandle(skill) {
|
|
9
|
+
return (skill.displayName ?? skill.name).toLowerCase();
|
|
10
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { SkillCatalogEntry } from './catalog.ts';
|
|
2
|
-
import { skillMentionName } from './mention-name.ts';
|
|
3
|
-
export { skillMentionName };
|
|
2
|
+
import { skillMentionHandle, skillMentionName } from './mention-name.ts';
|
|
3
|
+
export { skillMentionHandle, skillMentionName };
|
|
4
4
|
export declare function resolveSkillMention<Skill extends SkillCatalogEntry>(text: string, catalog: readonly Skill[]): Skill | null;
|
|
5
5
|
export declare function resolveImplicitSkill(text: string, activeSkills: readonly SkillCatalogEntry[]): SkillCatalogEntry | null;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { has } from 'asenion';
|
|
2
|
-
import { skillMentionName } from './mention-name.js';
|
|
3
|
-
export { skillMentionName };
|
|
2
|
+
import { skillMentionHandle, skillMentionName } from './mention-name.js';
|
|
3
|
+
export { skillMentionHandle, skillMentionName };
|
|
4
4
|
export function resolveSkillMention(text, catalog) {
|
|
5
5
|
const name = skillMentionName(text);
|
|
6
6
|
if (!name) {
|
|
7
7
|
return null;
|
|
8
8
|
}
|
|
9
|
-
return catalog.find((skill) => skill.
|
|
9
|
+
return (catalog.find((skill) => skill.displayName?.toLowerCase() === name) ??
|
|
10
|
+
catalog.find((skill) => !skill.displayName && skill.name.toLowerCase() === name) ??
|
|
11
|
+
null);
|
|
10
12
|
}
|
|
11
13
|
const MIN_IMPLICIT_NAME_LENGTH = 4;
|
|
12
14
|
function matchesName(text, candidate) {
|
|
@@ -16,7 +18,12 @@ function matchesName(text, candidate) {
|
|
|
16
18
|
}
|
|
17
19
|
return true;
|
|
18
20
|
}
|
|
21
|
+
function withoutMention(text) {
|
|
22
|
+
const name = skillMentionName(text);
|
|
23
|
+
return name ? text.trimStart().slice(name.length + 1) : text;
|
|
24
|
+
}
|
|
19
25
|
export function resolveImplicitSkill(text, activeSkills) {
|
|
26
|
+
const prose = withoutMention(text);
|
|
20
27
|
let best = null;
|
|
21
28
|
let bestLength = 0;
|
|
22
29
|
for (const skill of activeSkills) {
|
|
@@ -26,7 +33,7 @@ export function resolveImplicitSkill(text, activeSkills) {
|
|
|
26
33
|
if (candidate.length < MIN_IMPLICIT_NAME_LENGTH) {
|
|
27
34
|
continue;
|
|
28
35
|
}
|
|
29
|
-
if (!matchesName(
|
|
36
|
+
if (!matchesName(prose, candidate)) {
|
|
30
37
|
continue;
|
|
31
38
|
}
|
|
32
39
|
const weight = candidate.replace(/\+/g, '').length;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import fs from 'fs';
|
|
2
2
|
import path from 'path';
|
|
3
|
+
import { HarnessError } from '../../errors.js';
|
|
3
4
|
import { randomSuffix } from './bundled-dir.js';
|
|
4
5
|
const SAFE_NAME = /^[A-Za-z0-9][A-Za-z0-9._-]*$/;
|
|
5
6
|
function assertSafeName(name) {
|
|
6
7
|
if (!SAFE_NAME.test(name)) {
|
|
7
|
-
throw new
|
|
8
|
+
throw new HarnessError('INVALID_SKILL_NAME', [name]);
|
|
8
9
|
}
|
|
9
10
|
}
|
|
10
11
|
async function dirNames(root) {
|
|
@@ -66,7 +67,7 @@ export async function copyBaseForEdit(baseDir, overlayDir, name) {
|
|
|
66
67
|
}
|
|
67
68
|
const src = path.join(baseDir, name);
|
|
68
69
|
if (!(await exists(src))) {
|
|
69
|
-
throw new
|
|
70
|
+
throw new HarnessError('SKILL_NOT_FOUND', [name]);
|
|
70
71
|
}
|
|
71
72
|
await copyDir(src, dest);
|
|
72
73
|
return { copied: true };
|
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
2
|
export type HostResolver = (hostname: string) => Promise<readonly string[]>;
|
|
3
|
+
export interface OutboundUrlOptions {
|
|
4
|
+
readonly resolveHost?: HostResolver | undefined;
|
|
5
|
+
readonly signal?: BareAbortSignal | undefined;
|
|
6
|
+
readonly hosts?: readonly string[] | undefined;
|
|
7
|
+
}
|
|
3
8
|
export interface OutboundUrlCheck {
|
|
4
9
|
readonly blocked: string | null;
|
|
5
10
|
readonly addresses?: readonly string[];
|
|
6
11
|
}
|
|
7
12
|
export declare function checkOutboundHost(url: URL): string | null;
|
|
8
|
-
export declare function resolveOutboundUrl(url: URL, resolveHost
|
|
13
|
+
export declare function resolveOutboundUrl(url: URL, { resolveHost, signal, hosts }?: OutboundUrlOptions): Promise<OutboundUrlCheck>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { AbortedError, raceAbort } from '../helpers/race-abort.js';
|
|
2
|
+
import { Policy } from '../policy/index.js';
|
|
2
3
|
import { isPrivateOrBlocked, stripIPv6Brackets } from './private-ip.js';
|
|
3
4
|
const LITERAL_IPV4 = /^\d{1,3}(\.\d{1,3}){3}$/;
|
|
4
5
|
export function checkOutboundHost(url) {
|
|
@@ -7,8 +8,13 @@ export function checkOutboundHost(url) {
|
|
|
7
8
|
? `blocked host: ${host} (private, loopback, link-local or metadata address)`
|
|
8
9
|
: null;
|
|
9
10
|
}
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
function unlisted(url, hosts) {
|
|
12
|
+
return hosts && !Policy.allowsHost(hosts, url.hostname)
|
|
13
|
+
? `host ${url.hostname} is not in the policy's network.hosts`
|
|
14
|
+
: null;
|
|
15
|
+
}
|
|
16
|
+
export async function resolveOutboundUrl(url, { resolveHost, signal, hosts } = {}) {
|
|
17
|
+
const blocked = unlisted(url, hosts) ?? checkOutboundHost(url);
|
|
12
18
|
if (blocked) {
|
|
13
19
|
return { blocked };
|
|
14
20
|
}
|
|
@@ -9,6 +9,7 @@ import { extractPageText, looksLikeHtml } from '../web-fetch/extract.js';
|
|
|
9
9
|
import { imageFileName, pageImageUrls } from '../web-fetch/images.js';
|
|
10
10
|
import { pageVideoRef } from '../web-fetch/video.js';
|
|
11
11
|
import { isRedirectStatus } from './http-request/request.js';
|
|
12
|
+
import { Policy } from '../policy/index.js';
|
|
12
13
|
import { resolveOutboundUrl } from './url-guard.js';
|
|
13
14
|
const SMALL_CONTEXT_TOKENS = 12_288;
|
|
14
15
|
const SMALL_CONTEXT_CHARS = 6_000;
|
|
@@ -44,6 +45,7 @@ export function createWebFetchTool({ fetch: fetchImpl, resolveHost = lookupHost
|
|
|
44
45
|
},
|
|
45
46
|
effect: () => 'read',
|
|
46
47
|
egress: (args) => (typeof args.url === 'string' ? args.url : null),
|
|
48
|
+
stableRead: true,
|
|
47
49
|
resource: (args) => {
|
|
48
50
|
try {
|
|
49
51
|
return { kind: 'host', label: new URL(String(args.url)).hostname };
|
|
@@ -75,9 +77,11 @@ export function createWebFetchTool({ fetch: fetchImpl, resolveHost = lookupHost
|
|
|
75
77
|
const timeout = setTimeout(() => controller.abort(undefined), PAGE_TIMEOUT_MS);
|
|
76
78
|
const onCallerAbort = () => controller.abort(undefined);
|
|
77
79
|
ctx?.signal?.addEventListener('abort', onCallerAbort);
|
|
80
|
+
const hosts = Policy.hostsOf(ctx?.policy);
|
|
78
81
|
try {
|
|
79
82
|
const got = await guardedGet(fetch, url, {
|
|
80
83
|
resolveHost,
|
|
84
|
+
hosts,
|
|
81
85
|
signal: controller.signal,
|
|
82
86
|
accept: 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
|
|
83
87
|
maxBytes: MAX_PAGE_BYTES,
|
|
@@ -128,6 +132,7 @@ export function createWebFetchTool({ fetch: fetchImpl, resolveHost = lookupHost
|
|
|
128
132
|
? await attachPageImages(body, currentUrl, {
|
|
129
133
|
fetch,
|
|
130
134
|
resolveHost,
|
|
135
|
+
hosts,
|
|
131
136
|
attach: ctx?.attach,
|
|
132
137
|
signal: controller.signal
|
|
133
138
|
})
|
|
@@ -291,8 +296,8 @@ function extensionFor(mimeType) {
|
|
|
291
296
|
const subtype = mimeType.split('/')[1] ?? '';
|
|
292
297
|
return /^[a-z0-9]{1,5}$/.test(subtype) ? subtype : 'bin';
|
|
293
298
|
}
|
|
294
|
-
async function guardedGet(fetch, url, { resolveHost, signal, accept, maxBytes, truncate }) {
|
|
295
|
-
const initialCheck = await resolveOutboundUrl(url, resolveHost, signal);
|
|
299
|
+
async function guardedGet(fetch, url, { resolveHost, hosts, signal, accept, maxBytes, truncate }) {
|
|
300
|
+
const initialCheck = await resolveOutboundUrl(url, { resolveHost, signal, hosts });
|
|
296
301
|
if (initialCheck.blocked) {
|
|
297
302
|
return { ok: false, error: initialCheck.blocked };
|
|
298
303
|
}
|
|
@@ -328,7 +333,7 @@ async function guardedGet(fetch, url, { resolveHost, signal, accept, maxBytes, t
|
|
|
328
333
|
if (redirects >= MAX_REDIRECTS) {
|
|
329
334
|
return { ok: false, error: 'too many redirects' };
|
|
330
335
|
}
|
|
331
|
-
const hopCheck = await resolveOutboundUrl(nextUrl, resolveHost, signal);
|
|
336
|
+
const hopCheck = await resolveOutboundUrl(nextUrl, { resolveHost, signal, hosts });
|
|
332
337
|
if (hopCheck.blocked) {
|
|
333
338
|
return { ok: false, error: hopCheck.blocked };
|
|
334
339
|
}
|
|
@@ -336,7 +341,7 @@ async function guardedGet(fetch, url, { resolveHost, signal, accept, maxBytes, t
|
|
|
336
341
|
validatedAddresses = hopCheck.addresses;
|
|
337
342
|
}
|
|
338
343
|
}
|
|
339
|
-
async function attachPageImages(html, pageUrl, { fetch, resolveHost, attach, signal }) {
|
|
344
|
+
async function attachPageImages(html, pageUrl, { fetch, resolveHost, hosts, attach, signal }) {
|
|
340
345
|
if (!attach)
|
|
341
346
|
return [];
|
|
342
347
|
const attached = [];
|
|
@@ -344,6 +349,7 @@ async function attachPageImages(html, pageUrl, { fetch, resolveHost, attach, sig
|
|
|
344
349
|
try {
|
|
345
350
|
const got = await guardedGet(fetch, new URL(href), {
|
|
346
351
|
resolveHost,
|
|
352
|
+
hosts,
|
|
347
353
|
signal,
|
|
348
354
|
accept: 'image/*',
|
|
349
355
|
maxBytes: MAX_IMAGE_BYTES
|
package/dist-lib/lib/wire.js
CHANGED
|
@@ -105,7 +105,6 @@ function toWirePayload(event) {
|
|
|
105
105
|
payload: {
|
|
106
106
|
round: event.round,
|
|
107
107
|
droppedTurns: event.droppedTurns,
|
|
108
|
-
messages: event.messages,
|
|
109
108
|
tokens: event.tokens,
|
|
110
109
|
outcome: event.outcome,
|
|
111
110
|
reason: event.reason
|
|
@@ -144,7 +143,7 @@ function toWirePayload(event) {
|
|
|
144
143
|
return {
|
|
145
144
|
type: 'goal',
|
|
146
145
|
text: stringField(event.text),
|
|
147
|
-
payload: { status: event.status, turn: event.turn }
|
|
146
|
+
payload: { status: event.status, turn: event.turn, checks: event.checks }
|
|
148
147
|
};
|
|
149
148
|
case 'fold':
|
|
150
149
|
return event.phase === 'done'
|
|
@@ -240,7 +239,6 @@ function fromWirePayload(event) {
|
|
|
240
239
|
const sent = objectField(event.payload);
|
|
241
240
|
return {
|
|
242
241
|
type: 'inference-sent',
|
|
243
|
-
messages: sent.messages,
|
|
244
242
|
round: Number(sent.round ?? 0),
|
|
245
243
|
droppedTurns: Number(sent.droppedTurns ?? 0),
|
|
246
244
|
tokens: sent.tokens,
|
|
@@ -280,8 +278,8 @@ function fromWirePayload(event) {
|
|
|
280
278
|
case 'input-rejected':
|
|
281
279
|
return { type: 'input-rejected', reason: event.text ?? '' };
|
|
282
280
|
case 'goal': {
|
|
283
|
-
const { status, turn } = objectField(event.payload);
|
|
284
|
-
return { type: 'goal', status, turn, text: event.text || undefined };
|
|
281
|
+
const { status, turn, checks } = objectField(event.payload);
|
|
282
|
+
return { type: 'goal', status, turn, text: event.text || undefined, checks };
|
|
285
283
|
}
|
|
286
284
|
case 'fold': {
|
|
287
285
|
const { phase, summary, throughId, foldedTurns } = objectField(event.payload);
|
|
@@ -4,7 +4,7 @@ export interface CodingOptions {
|
|
|
4
4
|
readonly deniedRoots?: readonly string[];
|
|
5
5
|
}
|
|
6
6
|
export declare class CodingPlugin implements HarnessPlugin {
|
|
7
|
-
static readonly TOOLS: readonly ['shell', 'shell_jobs'
|
|
7
|
+
static readonly TOOLS: readonly ['shell', 'shell_jobs'];
|
|
8
8
|
readonly name = "coding";
|
|
9
9
|
readonly api = 1;
|
|
10
10
|
readonly needs: string[];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { PluginRegistry } from '../../lib/plugins/index.js';
|
|
2
2
|
import { Jobs, shellJobsTool } from './jobs.js';
|
|
3
3
|
import { CodingSession, shellTool } from './session.js';
|
|
4
|
-
import { writeFileTool } from './write-file.js';
|
|
5
4
|
export class CodingPlugin {
|
|
6
|
-
static TOOLS = ['shell', 'shell_jobs'
|
|
5
|
+
static TOOLS = ['shell', 'shell_jobs'];
|
|
7
6
|
name = 'coding';
|
|
8
7
|
api = PluginRegistry.API_VERSION;
|
|
9
8
|
needs = ['sandbox'];
|
|
@@ -20,8 +19,7 @@ export class CodingPlugin {
|
|
|
20
19
|
return {
|
|
21
20
|
tools: [
|
|
22
21
|
shellTool({ session, start: (call) => jobs.start(call) }),
|
|
23
|
-
shellJobsTool(session, jobs)
|
|
24
|
-
writeFileTool(session)
|
|
22
|
+
shellJobsTool(session, jobs)
|
|
25
23
|
],
|
|
26
24
|
hooks: [
|
|
27
25
|
{
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
|
-
import type { ToolDefinition, ToolExecuteContext } from '../../lib/contract/index.ts';
|
|
2
|
+
import type { CompiledPolicy, ToolDefinition, ToolExecuteContext } from '../../lib/contract/index.ts';
|
|
3
3
|
import type { SandboxExecResult, SandboxJob, SandboxService, SandboxWorkspace } from '../../lib/contract/sandbox.ts';
|
|
4
4
|
import { type LocalRoot } from '../../lib/tools/fs/scope.ts';
|
|
5
5
|
export interface ToolError {
|
|
@@ -10,7 +10,6 @@ export declare function guidance(error: string): ToolError;
|
|
|
10
10
|
export declare function isError(value: unknown): value is ToolError;
|
|
11
11
|
export declare function shellQuote(text: string): string;
|
|
12
12
|
export declare function errorText(error: unknown): string;
|
|
13
|
-
export declare function workspaceKey(root: LocalRoot, input: string): Promise<string | ToolError>;
|
|
14
13
|
export declare function capped(text: string, stream: 'stdout' | 'stderr', ctx: ToolExecuteContext | undefined): Promise<string>;
|
|
15
14
|
interface ExecCall {
|
|
16
15
|
timeoutMs?: number;
|
|
@@ -27,13 +26,14 @@ export declare class CodingSession {
|
|
|
27
26
|
private readonly _bind;
|
|
28
27
|
private readonly _workspaces;
|
|
29
28
|
private readonly _runs;
|
|
29
|
+
private readonly _keys;
|
|
30
30
|
constructor(sandbox: SandboxService, deniedRoots?: readonly string[]);
|
|
31
31
|
effect(ctx: ToolExecuteContext | undefined): 'read' | 'write';
|
|
32
32
|
refusal(ctx: ToolExecuteContext | undefined): ToolError | null;
|
|
33
33
|
workspace(ctx: ToolExecuteContext | undefined): Promise<LocalRoot | ToolError>;
|
|
34
34
|
policyVersion(): string;
|
|
35
35
|
statePath(runId: string): string;
|
|
36
|
-
open(root: LocalRoot, runId: string): Promise<SandboxWorkspace>;
|
|
36
|
+
open(root: LocalRoot, runId: string, policy: CompiledPolicy): Promise<SandboxWorkspace>;
|
|
37
37
|
workspaceOf(runId: string): Promise<SandboxWorkspace> | null;
|
|
38
38
|
private _prelude;
|
|
39
39
|
exec({ workspace, runId, line }: SessionLine, { timeoutMs, signal }?: ExecCall): Promise<SandboxExecResult>;
|