@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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { HarnessError } from '../errors.js';
|
|
1
2
|
import { createEmbedLane } from '../capabilities/embed.js';
|
|
2
3
|
import { AbortedError, raceAbort } from '../helpers/race-abort.js';
|
|
3
4
|
import { assertEmbedDevice, createEmbedConfig } from '../models/embed-config.js';
|
|
@@ -14,6 +15,8 @@ export class Embeddings {
|
|
|
14
15
|
_notify;
|
|
15
16
|
_settleFit;
|
|
16
17
|
_evictIdleChat;
|
|
18
|
+
_beforeLoad;
|
|
19
|
+
_hold;
|
|
17
20
|
_embedModels;
|
|
18
21
|
_retiredEmbedModels = new Set();
|
|
19
22
|
_faultedEmbedKeys = new WeakMap();
|
|
@@ -29,6 +32,8 @@ export class Embeddings {
|
|
|
29
32
|
this._notify = opts.notify;
|
|
30
33
|
this._settleFit = opts.settleFit;
|
|
31
34
|
this._evictIdleChat = opts.evictIdleChat;
|
|
35
|
+
this._beforeLoad = opts.beforeLoad;
|
|
36
|
+
this._hold = opts.hold;
|
|
32
37
|
const embedConfig = createEmbedConfig({
|
|
33
38
|
device: opts.device,
|
|
34
39
|
gpuLayers: opts.gpuLayers,
|
|
@@ -53,7 +58,12 @@ export class Embeddings {
|
|
|
53
58
|
}
|
|
54
59
|
target(model) {
|
|
55
60
|
const key = this._embedFaults.key(residentSrc(model, 'embeddings'));
|
|
56
|
-
return {
|
|
61
|
+
return {
|
|
62
|
+
pool: this._embedModels,
|
|
63
|
+
key,
|
|
64
|
+
modelType: 'llamacpp-embedding',
|
|
65
|
+
open: () => this._embedModels.open(key, model)
|
|
66
|
+
};
|
|
57
67
|
}
|
|
58
68
|
recreate() {
|
|
59
69
|
this._embedModels = this._createEmbedPool();
|
|
@@ -100,7 +110,7 @@ export class Embeddings {
|
|
|
100
110
|
}
|
|
101
111
|
this._gate.assertNotClosing();
|
|
102
112
|
if (this._gate.suspended) {
|
|
103
|
-
throw new
|
|
113
|
+
throw new HarnessError('HARNESS_SUSPENDED');
|
|
104
114
|
}
|
|
105
115
|
if (texts.length === 0) {
|
|
106
116
|
return [];
|
|
@@ -122,6 +132,7 @@ export class Embeddings {
|
|
|
122
132
|
let loaded = null;
|
|
123
133
|
let job = null;
|
|
124
134
|
let releaseAfter = null;
|
|
135
|
+
let collectAfter = null;
|
|
125
136
|
let drainWorkAfter = null;
|
|
126
137
|
try {
|
|
127
138
|
loaded = await raceAbort(handle.load(), signal);
|
|
@@ -134,8 +145,11 @@ export class Embeddings {
|
|
|
134
145
|
}
|
|
135
146
|
catch (err) {
|
|
136
147
|
if (err instanceof AbortedError) {
|
|
137
|
-
if (job
|
|
138
|
-
releaseAfter = job
|
|
148
|
+
if (job) {
|
|
149
|
+
releaseAfter = job;
|
|
150
|
+
}
|
|
151
|
+
else if (this._retiredEmbedModels.has(pool)) {
|
|
152
|
+
collectAfter = handle.peek();
|
|
139
153
|
}
|
|
140
154
|
else {
|
|
141
155
|
drainWorkAfter = handle.peek();
|
|
@@ -155,6 +169,11 @@ export class Embeddings {
|
|
|
155
169
|
generation
|
|
156
170
|
}).finally(releaseWork);
|
|
157
171
|
}
|
|
172
|
+
else if (collectAfter) {
|
|
173
|
+
releaseModel(pool, key);
|
|
174
|
+
const collect = () => this._collectRetiredEmbedPool(pool);
|
|
175
|
+
void collectAfter.then(collect, collect).catch(noop).finally(releaseWork);
|
|
176
|
+
}
|
|
158
177
|
else {
|
|
159
178
|
const releasing = this._releaseEmbedResource(pool, key);
|
|
160
179
|
if (drainWorkAfter) {
|
|
@@ -173,7 +192,9 @@ export class Embeddings {
|
|
|
173
192
|
batchSize: this._embedBatchSize,
|
|
174
193
|
openclCacheDir,
|
|
175
194
|
loads: this._loads,
|
|
176
|
-
onUnloadFailure: (modelId, error) => this._gate.recordModelUnloadFailure(modelId, error)
|
|
195
|
+
onUnloadFailure: (modelId, error) => this._gate.recordModelUnloadFailure(modelId, error),
|
|
196
|
+
beforeLoad: this._beforeLoad,
|
|
197
|
+
hold: this._hold
|
|
177
198
|
});
|
|
178
199
|
}
|
|
179
200
|
async _collectRetiredEmbedPool(pool) {
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { QvacErrorBase } from '@qvac/error';
|
|
2
|
+
declare const HARNESS_ERRORS: {
|
|
3
|
+
readonly ABORTED: {
|
|
4
|
+
readonly code: 102001;
|
|
5
|
+
readonly message: () => string;
|
|
6
|
+
};
|
|
7
|
+
readonly HARNESS_CLOSING: {
|
|
8
|
+
readonly code: 102002;
|
|
9
|
+
readonly message: () => string;
|
|
10
|
+
};
|
|
11
|
+
readonly HARNESS_SUSPENDED: {
|
|
12
|
+
readonly code: 102003;
|
|
13
|
+
readonly message: () => string;
|
|
14
|
+
};
|
|
15
|
+
readonly HARNESS_EXITED_BEFORE_READY: {
|
|
16
|
+
readonly code: 102004;
|
|
17
|
+
readonly message: (exitCode: number | null) => string;
|
|
18
|
+
};
|
|
19
|
+
readonly CAPABILITY_UNSUPPORTED: {
|
|
20
|
+
readonly code: 102005;
|
|
21
|
+
readonly message: (what: string) => string;
|
|
22
|
+
};
|
|
23
|
+
readonly UNKNOWN_CAPABILITY: {
|
|
24
|
+
readonly code: 102006;
|
|
25
|
+
readonly message: (capability: string) => string;
|
|
26
|
+
};
|
|
27
|
+
readonly CLIENT_GONE: {
|
|
28
|
+
readonly code: 102007;
|
|
29
|
+
readonly message: () => string;
|
|
30
|
+
};
|
|
31
|
+
readonly RPC_STREAM_DESTROYED: {
|
|
32
|
+
readonly code: 102008;
|
|
33
|
+
readonly message: () => string;
|
|
34
|
+
};
|
|
35
|
+
readonly EMBED_ABORTED: {
|
|
36
|
+
readonly code: 102009;
|
|
37
|
+
readonly message: () => string;
|
|
38
|
+
};
|
|
39
|
+
readonly NO_SKILLS_OVERLAY: {
|
|
40
|
+
readonly code: 102010;
|
|
41
|
+
readonly message: () => string;
|
|
42
|
+
};
|
|
43
|
+
readonly CHAT_MODEL_BUSY: {
|
|
44
|
+
readonly code: 102101;
|
|
45
|
+
readonly message: (output: string) => string;
|
|
46
|
+
};
|
|
47
|
+
readonly MODEL_NOT_RESIDENT: {
|
|
48
|
+
readonly code: 102102;
|
|
49
|
+
readonly message: (model: string) => string;
|
|
50
|
+
};
|
|
51
|
+
readonly AUDIOGEN_MODEL_NOT_FOUND: {
|
|
52
|
+
readonly code: 102103;
|
|
53
|
+
readonly message: (model: string) => string;
|
|
54
|
+
};
|
|
55
|
+
readonly MODEL_NOT_IN_REGISTRY: {
|
|
56
|
+
readonly code: 102104;
|
|
57
|
+
readonly message: (model: string, addon: string) => string;
|
|
58
|
+
};
|
|
59
|
+
readonly MODEL_LOAD_CLOCK_SKEW: {
|
|
60
|
+
readonly code: 102105;
|
|
61
|
+
readonly message: (model: string) => string;
|
|
62
|
+
};
|
|
63
|
+
readonly IMAGE_LOAD_STALLED: {
|
|
64
|
+
readonly code: 102106;
|
|
65
|
+
readonly message: () => string;
|
|
66
|
+
};
|
|
67
|
+
readonly TRANSLATION_LOAD_STALLED: {
|
|
68
|
+
readonly code: 102107;
|
|
69
|
+
readonly message: () => string;
|
|
70
|
+
};
|
|
71
|
+
readonly CONTEXT_WINDOW_EXCEEDED: {
|
|
72
|
+
readonly code: 102201;
|
|
73
|
+
readonly message: () => string;
|
|
74
|
+
};
|
|
75
|
+
readonly TTS_NO_AUDIO: {
|
|
76
|
+
readonly code: 102202;
|
|
77
|
+
readonly message: () => string;
|
|
78
|
+
};
|
|
79
|
+
readonly TTS_INCOMPLETE: {
|
|
80
|
+
readonly code: 102203;
|
|
81
|
+
readonly message: () => string;
|
|
82
|
+
};
|
|
83
|
+
readonly FETCH_TIMED_OUT: {
|
|
84
|
+
readonly code: 102301;
|
|
85
|
+
readonly message: (ms: number) => string;
|
|
86
|
+
};
|
|
87
|
+
readonly FETCH_CANCELLED: {
|
|
88
|
+
readonly code: 102302;
|
|
89
|
+
readonly message: () => string;
|
|
90
|
+
};
|
|
91
|
+
readonly RESPONSE_NOT_JSON: {
|
|
92
|
+
readonly code: 102303;
|
|
93
|
+
readonly message: (chars: number, detail: string) => string;
|
|
94
|
+
};
|
|
95
|
+
readonly HTTP_STATUS: {
|
|
96
|
+
readonly code: 102304;
|
|
97
|
+
readonly message: (status: number) => string;
|
|
98
|
+
};
|
|
99
|
+
readonly SEARCH_CAPTCHA: {
|
|
100
|
+
readonly code: 102305;
|
|
101
|
+
readonly message: (engine: string) => string;
|
|
102
|
+
};
|
|
103
|
+
readonly RESPONSE_TOO_LARGE: {
|
|
104
|
+
readonly code: 102306;
|
|
105
|
+
readonly message: (maxBytes: number) => string;
|
|
106
|
+
};
|
|
107
|
+
readonly UNSUPPORTED_HTTP_METHOD: {
|
|
108
|
+
readonly code: 102307;
|
|
109
|
+
readonly message: (method: string) => string;
|
|
110
|
+
};
|
|
111
|
+
readonly GEOCODER_HTTP_STATUS: {
|
|
112
|
+
readonly code: 102308;
|
|
113
|
+
readonly message: (status: number) => string;
|
|
114
|
+
};
|
|
115
|
+
readonly EGRESS_BLOCKED: {
|
|
116
|
+
readonly code: 102309;
|
|
117
|
+
readonly message: (reason: string) => string;
|
|
118
|
+
};
|
|
119
|
+
readonly OFFICE_UNSUPPORTED_DOCUMENT: {
|
|
120
|
+
readonly code: 102401;
|
|
121
|
+
readonly message: (fileName: string) => string;
|
|
122
|
+
};
|
|
123
|
+
readonly OFFICE_TOO_LARGE: {
|
|
124
|
+
readonly code: 102402;
|
|
125
|
+
readonly message: (bytes: number, limit: number) => string;
|
|
126
|
+
};
|
|
127
|
+
readonly OFFICE_EXTRACTION_ABORTED: {
|
|
128
|
+
readonly code: 102403;
|
|
129
|
+
readonly message: (fileName: string) => string;
|
|
130
|
+
};
|
|
131
|
+
readonly OFFICE_EXTRACTION_FAILED: {
|
|
132
|
+
readonly code: 102404;
|
|
133
|
+
readonly message: (fileName: string, detail: string) => string;
|
|
134
|
+
};
|
|
135
|
+
readonly OFFICE_OP_UNAVAILABLE: {
|
|
136
|
+
readonly code: 102405;
|
|
137
|
+
readonly message: (op: string) => string;
|
|
138
|
+
};
|
|
139
|
+
readonly COMMAND_TIMED_OUT: {
|
|
140
|
+
readonly code: 102501;
|
|
141
|
+
readonly message: (ms: number) => string;
|
|
142
|
+
};
|
|
143
|
+
readonly PACKAGE_INSTALL_TIMED_OUT: {
|
|
144
|
+
readonly code: 102502;
|
|
145
|
+
readonly message: (ms: number) => string;
|
|
146
|
+
};
|
|
147
|
+
readonly PYTHON_WORKER_FAILED: {
|
|
148
|
+
readonly code: 102503;
|
|
149
|
+
readonly message: (detail: string) => string;
|
|
150
|
+
};
|
|
151
|
+
readonly PYTHON_WORKER_EXITED: {
|
|
152
|
+
readonly code: 102504;
|
|
153
|
+
readonly message: (exitCode: number) => string;
|
|
154
|
+
};
|
|
155
|
+
readonly ATTACHMENT_STAGING_TIMED_OUT: {
|
|
156
|
+
readonly code: 102505;
|
|
157
|
+
readonly message: (ms: number) => string;
|
|
158
|
+
};
|
|
159
|
+
readonly FETCH_REFUSED: {
|
|
160
|
+
readonly code: 102506;
|
|
161
|
+
readonly message: (reason: string) => string;
|
|
162
|
+
};
|
|
163
|
+
readonly OBSIDIAN_NOTE_NAME_IS_PATH: {
|
|
164
|
+
readonly code: 102601;
|
|
165
|
+
readonly message: () => string;
|
|
166
|
+
};
|
|
167
|
+
readonly OBSIDIAN_NOTE_NOT_FOUND: {
|
|
168
|
+
readonly code: 102602;
|
|
169
|
+
readonly message: (args: readonly string[]) => string;
|
|
170
|
+
};
|
|
171
|
+
readonly OBSIDIAN_MISSING_ARGUMENT: {
|
|
172
|
+
readonly code: 102603;
|
|
173
|
+
readonly message: (names: string) => string;
|
|
174
|
+
};
|
|
175
|
+
readonly OBSIDIAN_NO_PROPERTIES: {
|
|
176
|
+
readonly code: 102604;
|
|
177
|
+
readonly message: () => string;
|
|
178
|
+
};
|
|
179
|
+
readonly OBSIDIAN_NOTE_EXISTS: {
|
|
180
|
+
readonly code: 102605;
|
|
181
|
+
readonly message: (name: string, folder: string) => string;
|
|
182
|
+
};
|
|
183
|
+
readonly OBSIDIAN_ACTION_UNSUPPORTED: {
|
|
184
|
+
readonly code: 102606;
|
|
185
|
+
readonly message: (action: string) => string;
|
|
186
|
+
};
|
|
187
|
+
readonly OBSIDIAN_NOTE_CHANGED: {
|
|
188
|
+
readonly code: 102607;
|
|
189
|
+
readonly message: (why: string, file: string) => string;
|
|
190
|
+
};
|
|
191
|
+
readonly OBSIDIAN_PATH_CROSSES_SYMLINK: {
|
|
192
|
+
readonly code: 102608;
|
|
193
|
+
readonly message: (target: string) => string;
|
|
194
|
+
};
|
|
195
|
+
readonly OBSIDIAN_PATH_ESCAPES_VAULT: {
|
|
196
|
+
readonly code: 102609;
|
|
197
|
+
readonly message: (rel: string) => string;
|
|
198
|
+
};
|
|
199
|
+
readonly OBSIDIAN_DESTINATION_EXISTS: {
|
|
200
|
+
readonly code: 102610;
|
|
201
|
+
readonly message: (filePath: string) => string;
|
|
202
|
+
};
|
|
203
|
+
readonly SKILL_FILE_NOT_FOUND: {
|
|
204
|
+
readonly code: 102701;
|
|
205
|
+
readonly message: (name: string, file: string) => string;
|
|
206
|
+
};
|
|
207
|
+
readonly INVALID_SKILL_NAME: {
|
|
208
|
+
readonly code: 102702;
|
|
209
|
+
readonly message: (name: string) => string;
|
|
210
|
+
};
|
|
211
|
+
readonly SKILL_NOT_FOUND: {
|
|
212
|
+
readonly code: 102703;
|
|
213
|
+
readonly message: (name: string) => string;
|
|
214
|
+
};
|
|
215
|
+
readonly BUNDLED_SKILLS_INVALID: {
|
|
216
|
+
readonly code: 102704;
|
|
217
|
+
readonly message: (staging: string) => string;
|
|
218
|
+
};
|
|
219
|
+
readonly BUNDLED_SKILLS_TAMPERED: {
|
|
220
|
+
readonly code: 102705;
|
|
221
|
+
readonly message: (dir: string) => string;
|
|
222
|
+
};
|
|
223
|
+
readonly BUNDLED_SKILLS_OCCUPIED: {
|
|
224
|
+
readonly code: 102706;
|
|
225
|
+
readonly message: (dir: string, why: string) => string;
|
|
226
|
+
};
|
|
227
|
+
readonly DRIVE_TIMED_OUT: {
|
|
228
|
+
readonly code: 102707;
|
|
229
|
+
readonly message: (op: string) => string;
|
|
230
|
+
};
|
|
231
|
+
readonly DRIVE_READ_TRUNCATED: {
|
|
232
|
+
readonly code: 102708;
|
|
233
|
+
readonly message: (maxBytes: number, key: string) => string;
|
|
234
|
+
};
|
|
235
|
+
readonly NO_STORAGE_ROOT: {
|
|
236
|
+
readonly code: 102709;
|
|
237
|
+
readonly message: () => string;
|
|
238
|
+
};
|
|
239
|
+
readonly SLM_TRANSLATION_UNAVAILABLE: {
|
|
240
|
+
readonly code: 102710;
|
|
241
|
+
readonly message: () => string;
|
|
242
|
+
};
|
|
243
|
+
readonly PDF_TEXT_UNAVAILABLE: {
|
|
244
|
+
readonly code: 102711;
|
|
245
|
+
readonly message: () => string;
|
|
246
|
+
};
|
|
247
|
+
};
|
|
248
|
+
type Errors = typeof HARNESS_ERRORS;
|
|
249
|
+
export type HarnessErrorName = keyof Errors;
|
|
250
|
+
type Adds<K extends HarnessErrorName> = Parameters<Errors[K]['message']>;
|
|
251
|
+
interface HarnessErrorOptions {
|
|
252
|
+
readonly cause?: unknown;
|
|
253
|
+
}
|
|
254
|
+
type HarnessErrorArgs<K extends HarnessErrorName> = [
|
|
255
|
+
] extends Adds<K> ? [adds?: Adds<K>, opts?: HarnessErrorOptions] : [adds: Adds<K>, opts?: HarnessErrorOptions];
|
|
256
|
+
export declare class HarnessError<K extends HarnessErrorName = HarnessErrorName> extends QvacErrorBase {
|
|
257
|
+
static readonly CONTEXT_OVERFLOW_MESSAGE: string;
|
|
258
|
+
static readonly IMAGE_LOAD_STALL_ERROR: string;
|
|
259
|
+
static readonly TRANSLATION_LOAD_STALL_ERROR: string;
|
|
260
|
+
static readonly NO_STORAGE_ROOT: string;
|
|
261
|
+
constructor(name: K, ...[adds, opts]: HarnessErrorArgs<K>);
|
|
262
|
+
static code(name: HarnessErrorName): number;
|
|
263
|
+
static codes(): ReadonlyArray<number>;
|
|
264
|
+
static is(err: unknown, name: HarnessErrorName): boolean;
|
|
265
|
+
}
|
|
266
|
+
export {};
|
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { QvacErrorBase, addCodes } from '@qvac/error';
|
|
2
|
+
import { isRecord } from './guards.js';
|
|
3
|
+
const HARNESS_ERRORS = {
|
|
4
|
+
ABORTED: { code: 102001, message: () => 'aborted' },
|
|
5
|
+
HARNESS_CLOSING: { code: 102002, message: () => 'harness is closing' },
|
|
6
|
+
HARNESS_SUSPENDED: { code: 102003, message: () => 'harness is suspended' },
|
|
7
|
+
HARNESS_EXITED_BEFORE_READY: {
|
|
8
|
+
code: 102004,
|
|
9
|
+
message: (exitCode) => `harness exited (${exitCode}) before ready`
|
|
10
|
+
},
|
|
11
|
+
CAPABILITY_UNSUPPORTED: {
|
|
12
|
+
code: 102005,
|
|
13
|
+
message: (what) => `harness does not support ${what}`
|
|
14
|
+
},
|
|
15
|
+
UNKNOWN_CAPABILITY: {
|
|
16
|
+
code: 102006,
|
|
17
|
+
message: (capability) => `unknown capability: ${capability}`
|
|
18
|
+
},
|
|
19
|
+
CLIENT_GONE: { code: 102007, message: () => 'client gone' },
|
|
20
|
+
RPC_STREAM_DESTROYED: { code: 102008, message: () => 'rpc stream destroyed' },
|
|
21
|
+
EMBED_ABORTED: { code: 102009, message: () => 'embed aborted' },
|
|
22
|
+
NO_SKILLS_OVERLAY: { code: 102010, message: () => 'no writable skills overlay is configured' },
|
|
23
|
+
CHAT_MODEL_BUSY: {
|
|
24
|
+
code: 102101,
|
|
25
|
+
message: (output) => `the chat model is busy; try the ${output} again once the current reply finishes`
|
|
26
|
+
},
|
|
27
|
+
MODEL_NOT_RESIDENT: {
|
|
28
|
+
code: 102102,
|
|
29
|
+
message: (model) => `${model} loads for each generation and is not kept in memory`
|
|
30
|
+
},
|
|
31
|
+
AUDIOGEN_MODEL_NOT_FOUND: {
|
|
32
|
+
code: 102103,
|
|
33
|
+
message: (model) => `audiogen model not found: ${model}`
|
|
34
|
+
},
|
|
35
|
+
MODEL_NOT_IN_REGISTRY: {
|
|
36
|
+
code: 102104,
|
|
37
|
+
message: (model, addon) => `model not found in registry: ${model} (addon=${addon})`
|
|
38
|
+
},
|
|
39
|
+
MODEL_LOAD_CLOCK_SKEW: {
|
|
40
|
+
code: 102105,
|
|
41
|
+
message: (model) => `model load abandoned: system clock moved backward mid-load: ${model}`
|
|
42
|
+
},
|
|
43
|
+
IMAGE_LOAD_STALLED: { code: 102106, message: () => 'image model download stalled' },
|
|
44
|
+
TRANSLATION_LOAD_STALLED: {
|
|
45
|
+
code: 102107,
|
|
46
|
+
message: () => 'translation model download stalled'
|
|
47
|
+
},
|
|
48
|
+
CONTEXT_WINDOW_EXCEEDED: {
|
|
49
|
+
code: 102201,
|
|
50
|
+
message: () => 'This message is too large for the model context window.'
|
|
51
|
+
},
|
|
52
|
+
TTS_NO_AUDIO: { code: 102202, message: () => 'Text-to-speech returned no audio.' },
|
|
53
|
+
TTS_INCOMPLETE: { code: 102203, message: () => 'tts synthesis did not complete' },
|
|
54
|
+
FETCH_TIMED_OUT: { code: 102301, message: (ms) => `Request timed out after ${ms}ms` },
|
|
55
|
+
FETCH_CANCELLED: { code: 102302, message: () => 'Request cancelled' },
|
|
56
|
+
RESPONSE_NOT_JSON: {
|
|
57
|
+
code: 102303,
|
|
58
|
+
message: (chars, detail) => `Response was not valid JSON (${chars} chars): ${detail}`
|
|
59
|
+
},
|
|
60
|
+
HTTP_STATUS: { code: 102304, message: (status) => `HTTP ${status}` },
|
|
61
|
+
SEARCH_CAPTCHA: { code: 102305, message: (engine) => `${engine} CAPTCHA detected` },
|
|
62
|
+
RESPONSE_TOO_LARGE: {
|
|
63
|
+
code: 102306,
|
|
64
|
+
message: (maxBytes) => `response exceeded ${maxBytes} bytes`
|
|
65
|
+
},
|
|
66
|
+
UNSUPPORTED_HTTP_METHOD: {
|
|
67
|
+
code: 102307,
|
|
68
|
+
message: (method) => `unsupported HTTP method: ${method}`
|
|
69
|
+
},
|
|
70
|
+
GEOCODER_HTTP_STATUS: {
|
|
71
|
+
code: 102308,
|
|
72
|
+
message: (status) => `geocoder answered HTTP ${status}`
|
|
73
|
+
},
|
|
74
|
+
EGRESS_BLOCKED: { code: 102309, message: (reason) => reason },
|
|
75
|
+
OFFICE_UNSUPPORTED_DOCUMENT: {
|
|
76
|
+
code: 102401,
|
|
77
|
+
message: (fileName) => `Unsupported Office document: ${fileName}`
|
|
78
|
+
},
|
|
79
|
+
OFFICE_TOO_LARGE: {
|
|
80
|
+
code: 102402,
|
|
81
|
+
message: (bytes, limit) => `document is too large to extract: ${bytes} bytes, limit ${limit}`
|
|
82
|
+
},
|
|
83
|
+
OFFICE_EXTRACTION_ABORTED: {
|
|
84
|
+
code: 102403,
|
|
85
|
+
message: (fileName) => `${fileName}: extraction aborted`
|
|
86
|
+
},
|
|
87
|
+
OFFICE_EXTRACTION_FAILED: {
|
|
88
|
+
code: 102404,
|
|
89
|
+
message: (fileName, detail) => `${fileName}: ${detail}`
|
|
90
|
+
},
|
|
91
|
+
OFFICE_OP_UNAVAILABLE: {
|
|
92
|
+
code: 102405,
|
|
93
|
+
message: (op) => `${op} is not available on this file`
|
|
94
|
+
},
|
|
95
|
+
COMMAND_TIMED_OUT: { code: 102501, message: (ms) => `Command timed out after ${ms}ms` },
|
|
96
|
+
PACKAGE_INSTALL_TIMED_OUT: {
|
|
97
|
+
code: 102502,
|
|
98
|
+
message: (ms) => `package install timed out after ${ms}ms`
|
|
99
|
+
},
|
|
100
|
+
PYTHON_WORKER_FAILED: { code: 102503, message: (detail) => `python worker: ${detail}` },
|
|
101
|
+
PYTHON_WORKER_EXITED: {
|
|
102
|
+
code: 102504,
|
|
103
|
+
message: (exitCode) => `python worker exited with code ${exitCode}`
|
|
104
|
+
},
|
|
105
|
+
ATTACHMENT_STAGING_TIMED_OUT: {
|
|
106
|
+
code: 102505,
|
|
107
|
+
message: (ms) => `staging attachments timed out after ${ms}ms`
|
|
108
|
+
},
|
|
109
|
+
FETCH_REFUSED: { code: 102506, message: (reason) => `fetch refused: ${reason}` },
|
|
110
|
+
OBSIDIAN_NOTE_NAME_IS_PATH: {
|
|
111
|
+
code: 102601,
|
|
112
|
+
message: () => 'name= must be a note name, not a path.'
|
|
113
|
+
},
|
|
114
|
+
OBSIDIAN_NOTE_NOT_FOUND: {
|
|
115
|
+
code: 102602,
|
|
116
|
+
message: (args) => `Note not found. Args: ${args.join(', ')}`
|
|
117
|
+
},
|
|
118
|
+
OBSIDIAN_MISSING_ARGUMENT: {
|
|
119
|
+
code: 102603,
|
|
120
|
+
message: (names) => `Missing required argument: ${names}`
|
|
121
|
+
},
|
|
122
|
+
OBSIDIAN_NO_PROPERTIES: { code: 102604, message: () => 'No property key=value pairs provided.' },
|
|
123
|
+
OBSIDIAN_NOTE_EXISTS: {
|
|
124
|
+
code: 102605,
|
|
125
|
+
message: (name, folder) => `Note "${name}" already exists at ${folder}`
|
|
126
|
+
},
|
|
127
|
+
OBSIDIAN_ACTION_UNSUPPORTED: {
|
|
128
|
+
code: 102606,
|
|
129
|
+
message: (action) => `Action "${action}" is not supported in vault file mode. ` +
|
|
130
|
+
`This action requires the Obsidian CLI connected to the running app.`
|
|
131
|
+
},
|
|
132
|
+
OBSIDIAN_NOTE_CHANGED: {
|
|
133
|
+
code: 102607,
|
|
134
|
+
message: (why, file) => `Note changed on disk during update (${why}): ${file}`
|
|
135
|
+
},
|
|
136
|
+
OBSIDIAN_PATH_CROSSES_SYMLINK: {
|
|
137
|
+
code: 102608,
|
|
138
|
+
message: (target) => `Path "${target}" crosses a symlink inside the vault.`
|
|
139
|
+
},
|
|
140
|
+
OBSIDIAN_PATH_ESCAPES_VAULT: {
|
|
141
|
+
code: 102609,
|
|
142
|
+
message: (rel) => `Path "${rel}" escapes the vault root.`
|
|
143
|
+
},
|
|
144
|
+
OBSIDIAN_DESTINATION_EXISTS: {
|
|
145
|
+
code: 102610,
|
|
146
|
+
message: (filePath) => `Destination already exists: ${filePath}`
|
|
147
|
+
},
|
|
148
|
+
SKILL_FILE_NOT_FOUND: {
|
|
149
|
+
code: 102701,
|
|
150
|
+
message: (name, file) => `ENOENT: ${name}/${file}`
|
|
151
|
+
},
|
|
152
|
+
INVALID_SKILL_NAME: { code: 102702, message: (name) => `invalid skill name: ${name}` },
|
|
153
|
+
SKILL_NOT_FOUND: { code: 102703, message: (name) => `skill not found: ${name}` },
|
|
154
|
+
BUNDLED_SKILLS_INVALID: {
|
|
155
|
+
code: 102704,
|
|
156
|
+
message: (staging) => `bundled skills staging dir ${staging} failed validation`
|
|
157
|
+
},
|
|
158
|
+
BUNDLED_SKILLS_TAMPERED: {
|
|
159
|
+
code: 102705,
|
|
160
|
+
message: (dir) => `bundled skills dir ${dir} failed validation after a rewrite — ` +
|
|
161
|
+
'another process is tampering with it; remove it and restart'
|
|
162
|
+
},
|
|
163
|
+
BUNDLED_SKILLS_OCCUPIED: {
|
|
164
|
+
code: 102706,
|
|
165
|
+
message: (dir, why) => `bundled skills dir ${dir} could not be read or replaced${why} — remove it and restart`
|
|
166
|
+
},
|
|
167
|
+
DRIVE_TIMED_OUT: { code: 102707, message: (op) => `drive ${op} timed out` },
|
|
168
|
+
DRIVE_READ_TRUNCATED: {
|
|
169
|
+
code: 102708,
|
|
170
|
+
message: (maxBytes, key) => `read stopped at ${maxBytes} bytes: ${key}`
|
|
171
|
+
},
|
|
172
|
+
NO_STORAGE_ROOT: {
|
|
173
|
+
code: 102709,
|
|
174
|
+
message: () => 'cannot fence the app storage root: the SDK home is unknown'
|
|
175
|
+
},
|
|
176
|
+
SLM_TRANSLATION_UNAVAILABLE: { code: 102710, message: () => 'slm translation is unavailable' },
|
|
177
|
+
PDF_TEXT_UNAVAILABLE: { code: 102711, message: () => 'PDF text is not available on this device' }
|
|
178
|
+
};
|
|
179
|
+
addCodes(Object.fromEntries(Object.entries(HARNESS_ERRORS).map(([name, { code, message }]) => [code, { name, message }])), { name: '@qvac/harness', version: `${Object.keys(HARNESS_ERRORS).length}.0.0` });
|
|
180
|
+
export class HarnessError extends QvacErrorBase {
|
|
181
|
+
static CONTEXT_OVERFLOW_MESSAGE = HARNESS_ERRORS.CONTEXT_WINDOW_EXCEEDED.message();
|
|
182
|
+
static IMAGE_LOAD_STALL_ERROR = HARNESS_ERRORS.IMAGE_LOAD_STALLED.message();
|
|
183
|
+
static TRANSLATION_LOAD_STALL_ERROR = HARNESS_ERRORS.TRANSLATION_LOAD_STALLED.message();
|
|
184
|
+
static NO_STORAGE_ROOT = HARNESS_ERRORS.NO_STORAGE_ROOT.message();
|
|
185
|
+
constructor(name, ...[adds, opts]) {
|
|
186
|
+
const cause = opts?.cause instanceof Error ? opts.cause : undefined;
|
|
187
|
+
super({ code: HARNESS_ERRORS[name].code, adds: adds ?? [], cause });
|
|
188
|
+
}
|
|
189
|
+
static code(name) {
|
|
190
|
+
return HARNESS_ERRORS[name].code;
|
|
191
|
+
}
|
|
192
|
+
static codes() {
|
|
193
|
+
return Object.values(HARNESS_ERRORS).map(({ code }) => code);
|
|
194
|
+
}
|
|
195
|
+
static is(err, name) {
|
|
196
|
+
return isRecord(err) && String(err.code) === String(HARNESS_ERRORS[name].code);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
@@ -2,6 +2,7 @@ import type { FoldEvent, Message } from '../contract/index.ts';
|
|
|
2
2
|
export interface FoldReading {
|
|
3
3
|
cacheTokens: number | undefined;
|
|
4
4
|
ctxSize: number | undefined;
|
|
5
|
+
cutOff?: boolean | undefined;
|
|
5
6
|
}
|
|
6
7
|
export interface FoldSummary {
|
|
7
8
|
text: string | null;
|
|
@@ -27,24 +28,47 @@ export interface FoldOptions {
|
|
|
27
28
|
ctxSize?: number | undefined;
|
|
28
29
|
instructions?: string | undefined;
|
|
29
30
|
}
|
|
31
|
+
export interface RoundsBoundary {
|
|
32
|
+
task: number;
|
|
33
|
+
folded: number[];
|
|
34
|
+
foldedRounds: number;
|
|
35
|
+
}
|
|
36
|
+
export interface RoundsOptions extends FoldOptions {
|
|
37
|
+
nudges: readonly string[];
|
|
38
|
+
keeps: (message: Message) => boolean;
|
|
39
|
+
}
|
|
40
|
+
export type RoundsResult = {
|
|
41
|
+
folded: true;
|
|
42
|
+
history: Message[];
|
|
43
|
+
summary: string;
|
|
44
|
+
foldedRounds: number;
|
|
45
|
+
} | {
|
|
46
|
+
folded: false;
|
|
47
|
+
reason: FoldRefusal;
|
|
48
|
+
};
|
|
30
49
|
export declare class Fold {
|
|
31
50
|
static FLOOR: number;
|
|
32
51
|
static TIERS: readonly (readonly [below: number, ratio: number])[];
|
|
33
52
|
static RATIO: number;
|
|
34
53
|
static KEEP_TURNS: number;
|
|
54
|
+
static KEEP_ROUNDS: number;
|
|
35
55
|
static PREFIX: string;
|
|
36
56
|
summarize: Summarize;
|
|
37
57
|
constructor(summarize: Summarize);
|
|
38
58
|
static turn(summary: string): string;
|
|
39
59
|
static isSummary(message: Pick<Message, 'role' | 'content'>): boolean;
|
|
60
|
+
static isTurn(message: Pick<Message, 'role' | 'content'>, nudges: readonly string[]): boolean;
|
|
61
|
+
static carriesPlan(message: Pick<Message, 'role' | 'content'>, nudges: readonly string[]): boolean;
|
|
40
62
|
static ratio(ctxSize: number): number;
|
|
41
63
|
static fits(ctxSize: number | undefined): boolean;
|
|
42
|
-
static due({ cacheTokens, ctxSize }: FoldReading): boolean;
|
|
64
|
+
static due({ cacheTokens, ctxSize, cutOff }: FoldReading): boolean;
|
|
43
65
|
static observe(cacheKey: string, reading: FoldReading): void;
|
|
44
66
|
static reading(cacheKey: string): FoldReading | undefined;
|
|
45
67
|
static forget(cacheKey: string): void;
|
|
46
68
|
static boundary(messages: readonly Message[], keepTurns?: number): FoldBoundary | null;
|
|
69
|
+
static roundBoundary(messages: readonly Message[], { nudges, keeps }: Pick<RoundsOptions, 'nudges' | 'keeps'>, most?: number): RoundsBoundary | null;
|
|
47
70
|
static prompt(messages: readonly Message[], instructions?: string): string;
|
|
48
71
|
static shrinks(folded: readonly Message[], summary: string): boolean;
|
|
49
72
|
run(messages: readonly Message[], options?: FoldOptions): AsyncGenerator<FoldEvent, FoldResult>;
|
|
73
|
+
rounds(messages: readonly Message[], options: RoundsOptions): Promise<RoundsResult>;
|
|
50
74
|
}
|