@qvac/harness 1.0.0-rc.3 → 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 +44 -31
- 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 +98 -26
- 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/bench/README.md +0 -94
- package/bench/bfcl/checker.ts +0 -313
- package/bench/bfcl/data.ts +0 -93
- package/bench/bfcl/observe.ts +0 -93
- package/bench/bfcl/run.ts +0 -213
- package/bench/bfcl/tools.ts +0 -72
- package/bench/bridge/bridge.ts +0 -392
- package/bench/bridge/openai.ts +0 -150
- package/bench/bridge/python/qvac_bench/__init__.py +0 -3
- package/bench/bridge/python/qvac_bench/airline.py +0 -42
- package/bench/bridge/python/qvac_bench/approval.py +0 -26
- package/bench/bridge/python/qvac_bench/bfcl_multi_turn.py +0 -152
- package/bench/bridge/python/qvac_bench/client.py +0 -88
- package/bench/bridge/python/qvac_bench/harbor_agent.py +0 -85
- package/bench/bridge/python/qvac_bench/session.py +0 -107
- package/bench/bridge/python/qvac_bench/speed.py +0 -30
- package/bench/bridge/python/qvac_bench/tau2_agent.py +0 -106
- package/bench/bridge/python/qvac_bench/tools.py +0 -11
- package/bench/bridge/python/run_bfcl_multi_turn.py +0 -95
- package/bench/bridge/python/run_tau2.py +0 -150
- package/bench/bridge/python/smoke.py +0 -47
- package/bench/bridge/python/test_airline.py +0 -28
- package/bench/bridge/python/test_approval.py +0 -57
- package/bench/bridge/python/test_bfcl_multi_turn.py +0 -185
- package/bench/bridge/python/test_harbor_agent.py +0 -107
- package/bench/bridge/serve.ts +0 -52
- package/bench/bridge/transcript.ts +0 -52
- package/bench/bun-tsconfig.json +0 -15
- package/bench/cpu-main.mjs +0 -216
- package/bench/cpu.ts +0 -457
- package/bench/evidence/2026-09-28-review15.md +0 -225
- package/bench/evidence/redact-bun1.3.14.json +0 -92
- package/bench/evidence/redact-node24.11.json +0 -92
- package/bench/graph-metrics.ts +0 -43
- package/bench/harness.ts +0 -73
- package/bench/issue129-matrix.mjs +0 -722
- package/bench/redact-adversarial.ts +0 -256
- package/bench/repeat-cpu.mjs +0 -281
- package/bench/report.ts +0 -1075
- package/bench/skill-eval/harness.ts +0 -30
- package/bench/skill-eval/laws.ts +0 -37
- package/bench/skill-eval/mermaid/client.ts +0 -132
- package/bench/skill-eval/mermaid/validate.mjs +0 -115
- package/bench/skill-eval/pack.ts +0 -61
- package/bench/skill-eval/packs/diagrams/cases.ts +0 -281
- package/bench/skill-eval/packs/diagrams/index.ts +0 -50
- package/bench/skill-eval/packs/diagrams/score.ts +0 -74
- package/bench/skill-eval/packs/index.ts +0 -5
- package/bench/skill-eval/packs/weather/cases.ts +0 -279
- package/bench/skill-eval/packs/weather/fixtures/wttr.json +0 -566
- package/bench/skill-eval/packs/weather/fixtures.ts +0 -84
- package/bench/skill-eval/packs/weather/index.ts +0 -55
- package/bench/skill-eval/packs/weather/score.ts +0 -92
- package/bench/skill-eval/report.ts +0 -194
- package/bench/skill-eval/run.ts +0 -316
- package/bench/speed.ts +0 -80
- 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,13 +1,19 @@
|
|
|
1
1
|
import type { CompletionHistoryEntry, HistorySplice, PlanStep, RoundSpeed, RunBackendUse, ToolSpeed } from '../../contract/run.ts';
|
|
2
2
|
import { type FailureResultValue } from '../../helpers/failure-result.ts';
|
|
3
|
-
import type { CompletionStats, SettledCall, CompletionContext, ResolvedCallSnapshot, ToolPreflightFacts } from './types.ts';
|
|
3
|
+
import type { CompletionStats, GoalCheck, RunPolicy, SettledCall, CompletionContext, ResolvedCallSnapshot, ToolPreflightFacts } from './types.ts';
|
|
4
4
|
export declare function runsUnasked(facts: Pick<ToolPreflightFacts, 'effect' | 'autoApprove' | 'skipApprovals' | 'permission'>): boolean;
|
|
5
5
|
export declare const MAX_MUTE_ROUNDS = 1;
|
|
6
|
+
export declare const MAX_CUT_ROUNDS = 2;
|
|
6
7
|
export declare const MAX_CAPPED_ROUNDS = 1;
|
|
7
8
|
export declare const MAX_BLOCKED_REPEATS = 3;
|
|
9
|
+
export declare const MAX_UNCHANGED_RESULTS = 3;
|
|
10
|
+
export declare const MAX_ROUND_REPEATS = 3;
|
|
11
|
+
export declare const MAX_ROUND_CALLS = 32;
|
|
8
12
|
export declare function nudgeWithPlan(nudge: string, plan: readonly PlanStep[]): string;
|
|
9
|
-
export declare function
|
|
13
|
+
export declare function goalMet({ plan, goal }: Readonly<CompletionContext>): boolean;
|
|
14
|
+
export declare function nudgeWithChecks(nudge: string, checks: readonly GoalCheck[], checkable?: boolean): string;
|
|
10
15
|
export declare function goalTokensLeft({ goal, metrics }: Readonly<CompletionContext>): boolean;
|
|
16
|
+
export declare function goalStalled({ outcome }: Readonly<CompletionContext>): boolean;
|
|
11
17
|
export declare function retainFailureResults(history: readonly CompletionHistoryEntry[], values: Readonly<Record<string, FailureResultValue>>, failedCalls: Readonly<Record<string, SettledCall>>): Record<string, FailureResultValue>;
|
|
12
18
|
export declare function activate(activated: string[], names: readonly string[]): string[];
|
|
13
19
|
export interface ApplyHistorySpliceOptions {
|
|
@@ -33,8 +39,17 @@ export interface FinishedRound {
|
|
|
33
39
|
stopReason?: string | undefined;
|
|
34
40
|
durationMs?: number | undefined;
|
|
35
41
|
ctxSize?: number | undefined;
|
|
42
|
+
overflows?: number | undefined;
|
|
43
|
+
reasoningDeltas?: number | undefined;
|
|
36
44
|
}
|
|
37
45
|
export declare function foldMetrics(state: MetricsState, round: number, finished: FinishedRound): void;
|
|
46
|
+
type StoppedRound = Pick<FinishedRound, 'stats' | 'stopReason'> & {
|
|
47
|
+
cut?: string | undefined;
|
|
48
|
+
};
|
|
49
|
+
export declare function atContextBoundary({ stats, stopReason }: StoppedRound): boolean;
|
|
50
|
+
export declare function cutShort(round: StoppedRound): boolean;
|
|
51
|
+
export declare function cutOffMessage(policy: RunPolicy, round: StoppedRound | null): string;
|
|
38
52
|
export declare function recordTool(context: Readonly<CompletionContext>, call: ResolvedCallSnapshot | null, durationMs: number | undefined): CompletionContext['metrics'];
|
|
39
53
|
export declare function leadingReads(context: Readonly<CompletionContext>): number;
|
|
40
54
|
export declare function applySplice(history: CompletionHistoryEntry[], splice?: HistorySplice): CompletionHistoryEntry[];
|
|
55
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { isFailureResultReference } from '../../helpers/failure-result.js';
|
|
2
|
+
import { GOAL_CHECKS_ASK } from '../../helpers/goal-check.js';
|
|
2
3
|
export function runsUnasked(facts) {
|
|
3
4
|
if (facts.permission === 'ask')
|
|
4
5
|
return false;
|
|
@@ -8,8 +9,12 @@ export function runsUnasked(facts) {
|
|
|
8
9
|
facts.skipApprovals);
|
|
9
10
|
}
|
|
10
11
|
export const MAX_MUTE_ROUNDS = 1;
|
|
12
|
+
export const MAX_CUT_ROUNDS = 2;
|
|
11
13
|
export const MAX_CAPPED_ROUNDS = 1;
|
|
12
14
|
export const MAX_BLOCKED_REPEATS = 3;
|
|
15
|
+
export const MAX_UNCHANGED_RESULTS = 3;
|
|
16
|
+
export const MAX_ROUND_REPEATS = 3;
|
|
17
|
+
export const MAX_ROUND_CALLS = 32;
|
|
13
18
|
const PLAN_MARKS = {
|
|
14
19
|
pending: '[ ]',
|
|
15
20
|
in_progress: '[>]',
|
|
@@ -25,12 +30,33 @@ export function nudgeWithPlan(nudge, plan) {
|
|
|
25
30
|
function isDone(step) {
|
|
26
31
|
return step.status === 'done';
|
|
27
32
|
}
|
|
28
|
-
|
|
33
|
+
function planDone(plan) {
|
|
29
34
|
return plan.length > 0 && plan.every(isDone);
|
|
30
35
|
}
|
|
36
|
+
export function goalMet({ plan, goal }) {
|
|
37
|
+
const checks = goal?.checks ?? [];
|
|
38
|
+
return (planDone(plan) &&
|
|
39
|
+
(checks.length > 0 || !goal?.checkable) &&
|
|
40
|
+
checks.every((check) => check.passed));
|
|
41
|
+
}
|
|
42
|
+
export function nudgeWithChecks(nudge, checks, checkable) {
|
|
43
|
+
if (!checks.length) {
|
|
44
|
+
return checkable ? `${nudge}\n${GOAL_CHECKS_ASK}` : nudge;
|
|
45
|
+
}
|
|
46
|
+
const open = checks.filter((check) => !check.passed);
|
|
47
|
+
if (!open.length) {
|
|
48
|
+
return nudge;
|
|
49
|
+
}
|
|
50
|
+
const lines = open.map(({ name, output }) => output === null ? `- ${name}: not run yet` : `- ${name}: failed. Its last output:\n${output}`);
|
|
51
|
+
return (`${nudge}\nChecks: the goal is met only once each of these runs as its own command and ` +
|
|
52
|
+
`exits 0, with no pipe or ; after it to hide its exit code.\n${lines.join('\n')}`);
|
|
53
|
+
}
|
|
31
54
|
export function goalTokensLeft({ goal, metrics }) {
|
|
32
55
|
return !goal || goal.tokens === null || metrics.tokens < goal.tokens;
|
|
33
56
|
}
|
|
57
|
+
export function goalStalled({ outcome }) {
|
|
58
|
+
return outcome === 'exhausted';
|
|
59
|
+
}
|
|
34
60
|
export function retainFailureResults(history, values, failedCalls) {
|
|
35
61
|
const retained = new Set();
|
|
36
62
|
for (const entry of history) {
|
|
@@ -95,7 +121,7 @@ const ROUND_STATS = [
|
|
|
95
121
|
'tokensPerSecond',
|
|
96
122
|
'timeToFirstToken'
|
|
97
123
|
];
|
|
98
|
-
function roundSpeed(round, { stats, stopReason, durationMs }) {
|
|
124
|
+
function roundSpeed(round, { stats, stopReason, durationMs, overflows, reasoningDeltas }) {
|
|
99
125
|
const speed = { round, durationMs: durationMs ?? 0 };
|
|
100
126
|
for (const key of ROUND_STATS) {
|
|
101
127
|
const value = stats?.[key];
|
|
@@ -106,8 +132,28 @@ function roundSpeed(round, { stats, stopReason, durationMs }) {
|
|
|
106
132
|
if (stopReason) {
|
|
107
133
|
speed.stopReason = stopReason;
|
|
108
134
|
}
|
|
135
|
+
if (overflows) {
|
|
136
|
+
speed.overflows = overflows;
|
|
137
|
+
}
|
|
138
|
+
if (atContextBoundary({ stats, stopReason })) {
|
|
139
|
+
speed.contextBoundary = true;
|
|
140
|
+
}
|
|
141
|
+
if (reasoningDeltas) {
|
|
142
|
+
speed.reasoningDeltas = reasoningDeltas;
|
|
143
|
+
}
|
|
109
144
|
return speed;
|
|
110
145
|
}
|
|
146
|
+
export function atContextBoundary({ stats, stopReason }) {
|
|
147
|
+
return stopReason === 'length' && stats?.contextBoundary !== false;
|
|
148
|
+
}
|
|
149
|
+
export function cutShort(round) {
|
|
150
|
+
return round.stopReason === 'length' || round.cut !== undefined;
|
|
151
|
+
}
|
|
152
|
+
export function cutOffMessage(policy, round) {
|
|
153
|
+
if (round?.cut !== undefined)
|
|
154
|
+
return policy.roundCutMessage;
|
|
155
|
+
return round && atContextBoundary(round) ? policy.contextBoundaryMessage : policy.cutOffMessage;
|
|
156
|
+
}
|
|
111
157
|
export function recordTool(context, call, durationMs) {
|
|
112
158
|
if (durationMs === undefined || !call) {
|
|
113
159
|
return context.metrics;
|
|
@@ -118,7 +164,7 @@ export function recordTool(context, call, durationMs) {
|
|
|
118
164
|
export function leadingReads(context) {
|
|
119
165
|
const keys = new Set();
|
|
120
166
|
for (const call of context.toolQueue) {
|
|
121
|
-
if (!call.concurrent || keys.has(call.key) || context.failedCalls[call.key]) {
|
|
167
|
+
if (!call.concurrent || call.cutOff || keys.has(call.key) || context.failedCalls[call.key]) {
|
|
122
168
|
break;
|
|
123
169
|
}
|
|
124
170
|
keys.add(call.key);
|
|
@@ -8,6 +8,7 @@ export interface CompletionStats {
|
|
|
8
8
|
tokensPerSecond?: number | undefined;
|
|
9
9
|
promptTokens?: number | undefined;
|
|
10
10
|
cacheTokens?: number | undefined;
|
|
11
|
+
contextBoundary?: boolean | undefined;
|
|
11
12
|
}
|
|
12
13
|
export interface EngineEvent {
|
|
13
14
|
type: string;
|
|
@@ -20,6 +21,7 @@ export interface EngineEvent {
|
|
|
20
21
|
replacedTypes?: ('content' | 'thinking')[];
|
|
21
22
|
status?: GoalStatus;
|
|
22
23
|
turn?: number;
|
|
24
|
+
checks?: string[];
|
|
23
25
|
}
|
|
24
26
|
export interface EngineFacts extends Record<string, unknown> {
|
|
25
27
|
runBudget: RunBudget;
|
|
@@ -72,11 +74,14 @@ export interface RoundDonePayload {
|
|
|
72
74
|
stopReason?: string;
|
|
73
75
|
durationMs: number;
|
|
74
76
|
ctxSize?: number | undefined;
|
|
77
|
+
overflows?: number | undefined;
|
|
78
|
+
reasoningDeltas?: number | undefined;
|
|
75
79
|
replay: string | null;
|
|
76
80
|
response?: string;
|
|
77
81
|
history?: HistorySplice;
|
|
78
82
|
cacheable?: boolean;
|
|
79
83
|
fallbackResponse?: string;
|
|
84
|
+
cut?: string;
|
|
80
85
|
}
|
|
81
86
|
export interface ResolvedCallSnapshot {
|
|
82
87
|
key: string;
|
|
@@ -89,6 +94,7 @@ export interface ResolvedCallSnapshot {
|
|
|
89
94
|
permission?: 'allow' | 'ask';
|
|
90
95
|
concurrent?: true;
|
|
91
96
|
leavesPlan?: true;
|
|
97
|
+
cutOff?: true;
|
|
92
98
|
}
|
|
93
99
|
export interface ToolExecutionSnapshot {
|
|
94
100
|
kind: 'direct' | 'tool';
|
|
@@ -134,6 +140,12 @@ export interface ToolDonePayload {
|
|
|
134
140
|
};
|
|
135
141
|
progressed?: boolean;
|
|
136
142
|
blockedRepeat?: boolean;
|
|
143
|
+
unchanged?: boolean;
|
|
144
|
+
settled?: {
|
|
145
|
+
key: string;
|
|
146
|
+
digest: string;
|
|
147
|
+
};
|
|
148
|
+
stableRead?: true;
|
|
137
149
|
endedRun?: boolean;
|
|
138
150
|
answer?: string;
|
|
139
151
|
delivered?: boolean;
|
|
@@ -141,6 +153,7 @@ export interface ToolDonePayload {
|
|
|
141
153
|
activate?: string;
|
|
142
154
|
plan?: PlanStep[];
|
|
143
155
|
leftPlanMode?: boolean;
|
|
156
|
+
checked?: GoalCheck[];
|
|
144
157
|
}
|
|
145
158
|
export interface BatchDonePayload {
|
|
146
159
|
history?: HistorySplice;
|
|
@@ -187,6 +200,7 @@ export interface PreparingPayload {
|
|
|
187
200
|
sources?: TrustedSourceFacts[];
|
|
188
201
|
availableTools?: string[];
|
|
189
202
|
promptPrefix?: string;
|
|
203
|
+
checkable?: boolean;
|
|
190
204
|
}
|
|
191
205
|
export interface PrepareStepProposal {
|
|
192
206
|
id: string;
|
|
@@ -223,6 +237,7 @@ export interface AnsweredPayload {
|
|
|
223
237
|
durationMs?: number;
|
|
224
238
|
narrated?: string;
|
|
225
239
|
malformed?: boolean;
|
|
240
|
+
cutOff?: true;
|
|
226
241
|
}
|
|
227
242
|
export interface ToolsResolvedPayload {
|
|
228
243
|
calls: ResolvedCallSnapshot[];
|
|
@@ -234,13 +249,30 @@ export interface RunPolicy {
|
|
|
234
249
|
deliveredNudge: string;
|
|
235
250
|
deniedMessage: string;
|
|
236
251
|
cutOffMessage: string;
|
|
252
|
+
contextBoundaryMessage: string;
|
|
253
|
+
roundCutMessage: string;
|
|
254
|
+
repeatedCallMessage: string;
|
|
255
|
+
unchangedMessage: string;
|
|
237
256
|
goalNudge: string;
|
|
238
257
|
}
|
|
258
|
+
export interface SettledResult {
|
|
259
|
+
digest: string;
|
|
260
|
+
repeats: number;
|
|
261
|
+
round: number;
|
|
262
|
+
folded?: true;
|
|
263
|
+
}
|
|
264
|
+
export interface GoalCheck {
|
|
265
|
+
name: string;
|
|
266
|
+
passed: boolean;
|
|
267
|
+
output: string | null;
|
|
268
|
+
}
|
|
239
269
|
export interface GoalState {
|
|
240
270
|
objective: string;
|
|
241
271
|
tokens: number | null;
|
|
242
272
|
turns: number;
|
|
243
273
|
status: GoalStatus;
|
|
274
|
+
checks: GoalCheck[];
|
|
275
|
+
checkable?: boolean;
|
|
244
276
|
}
|
|
245
277
|
export interface QueuedInput {
|
|
246
278
|
id?: string;
|
|
@@ -262,6 +294,7 @@ export interface CompletionContext {
|
|
|
262
294
|
round: number;
|
|
263
295
|
roundsSent: number;
|
|
264
296
|
mute: number;
|
|
297
|
+
cuts: number;
|
|
265
298
|
narrated: boolean;
|
|
266
299
|
malformed: boolean;
|
|
267
300
|
webSearches: number;
|
|
@@ -271,6 +304,8 @@ export interface CompletionContext {
|
|
|
271
304
|
deniedKeys: string[];
|
|
272
305
|
failedCalls: Record<string, SettledCall>;
|
|
273
306
|
blockedRepeats: number;
|
|
307
|
+
settledResults: Record<string, SettledResult>;
|
|
308
|
+
answeredReads?: string[];
|
|
274
309
|
roundProgressed: boolean;
|
|
275
310
|
answer: string | null;
|
|
276
311
|
delivered: boolean;
|
|
@@ -333,6 +368,7 @@ export interface ToolRejection {
|
|
|
333
368
|
emitCall?: boolean;
|
|
334
369
|
emitResult?: boolean;
|
|
335
370
|
capped?: boolean;
|
|
371
|
+
repeat?: ToolExecutionOutcome;
|
|
336
372
|
}
|
|
337
373
|
export interface SearchingOutput {
|
|
338
374
|
directTool: DirectToolOutput | null;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { emptyCompletionContext } from './completion/context.ts';
|
|
2
|
-
import { runsUnasked } from './completion/rules.ts';
|
|
2
|
+
import { atContextBoundary, cutOffMessage, cutShort, runsUnasked } from './completion/rules.ts';
|
|
3
3
|
import { completionMachineDefinition, transitionName } from './definition.ts';
|
|
4
4
|
export declare class CompletionMachine {
|
|
5
5
|
static VERSION: number;
|
|
@@ -210,6 +210,9 @@ export declare class CompletionMachine {
|
|
|
210
210
|
} | {
|
|
211
211
|
type: "requestPrepare";
|
|
212
212
|
params: import("./completion/actions/prepare.ts").RequestPrepareParams;
|
|
213
|
+
} | {
|
|
214
|
+
type: "resetCutRound";
|
|
215
|
+
params: import("./completion/types.ts").ToolsResolvedPayload & import("./completion/types.ts").AnsweredPayload;
|
|
213
216
|
} | {
|
|
214
217
|
type: "resolveTools";
|
|
215
218
|
params: import("./completion/types.ts").ToolsResolvedPayload;
|
|
@@ -219,12 +222,15 @@ export declare class CompletionMachine {
|
|
|
219
222
|
} | {
|
|
220
223
|
type: "retryCappedSearch";
|
|
221
224
|
params: undefined;
|
|
225
|
+
} | {
|
|
226
|
+
type: "retryCutRound";
|
|
227
|
+
params: undefined;
|
|
222
228
|
} | {
|
|
223
229
|
type: "retryMalformedRound";
|
|
224
230
|
params: import("./completion/types.ts").AnsweredPayload;
|
|
225
231
|
} | {
|
|
226
232
|
type: "retryMuteRound";
|
|
227
|
-
params:
|
|
233
|
+
params: import("./completion/types.ts").AnsweredPayload;
|
|
228
234
|
} | {
|
|
229
235
|
type: "retryNarratedRound";
|
|
230
236
|
params: import("./completion/types.ts").AnsweredPayload;
|
|
@@ -257,6 +263,9 @@ export declare class CompletionMachine {
|
|
|
257
263
|
} | {
|
|
258
264
|
type: "wrapCompletion";
|
|
259
265
|
params: import("../contract/run.ts").RunOutcome;
|
|
266
|
+
} | {
|
|
267
|
+
type: "wrapCutCompletion";
|
|
268
|
+
params: undefined;
|
|
260
269
|
} | {
|
|
261
270
|
type: "wrapDeliveredCompletion";
|
|
262
271
|
params: undefined;
|
|
@@ -265,7 +274,7 @@ export declare class CompletionMachine {
|
|
|
265
274
|
params: undefined;
|
|
266
275
|
} | {
|
|
267
276
|
type: "wrapMuteCompletion";
|
|
268
|
-
params:
|
|
277
|
+
params: import("./completion/types.ts").AnsweredPayload;
|
|
269
278
|
} | {
|
|
270
279
|
type: "wrapSearchCappedCompletion";
|
|
271
280
|
params: undefined;
|
|
@@ -281,6 +290,9 @@ export declare class CompletionMachine {
|
|
|
281
290
|
} | {
|
|
282
291
|
type: "canMuteRetry";
|
|
283
292
|
params: unknown;
|
|
293
|
+
} | {
|
|
294
|
+
type: "canRetryCut";
|
|
295
|
+
params: unknown;
|
|
284
296
|
} | {
|
|
285
297
|
type: "canRetrySearchCap";
|
|
286
298
|
params: unknown;
|
|
@@ -323,6 +335,9 @@ export declare class CompletionMachine {
|
|
|
323
335
|
} | {
|
|
324
336
|
type: "failedOutcome";
|
|
325
337
|
params: unknown;
|
|
338
|
+
} | {
|
|
339
|
+
type: "goalStalled";
|
|
340
|
+
params: unknown;
|
|
326
341
|
} | {
|
|
327
342
|
type: "goalTokensLeft";
|
|
328
343
|
params: unknown;
|
|
@@ -341,6 +356,9 @@ export declare class CompletionMachine {
|
|
|
341
356
|
} | {
|
|
342
357
|
type: "hasRoundsLeft";
|
|
343
358
|
params: unknown;
|
|
359
|
+
} | {
|
|
360
|
+
type: "headCutOff";
|
|
361
|
+
params: unknown;
|
|
344
362
|
} | {
|
|
345
363
|
type: "interrupted";
|
|
346
364
|
params: unknown;
|
|
@@ -378,7 +396,7 @@ export declare class CompletionMachine {
|
|
|
378
396
|
type: "repeatsBlocked";
|
|
379
397
|
params: unknown;
|
|
380
398
|
} | {
|
|
381
|
-
type: "
|
|
399
|
+
type: "roundCut";
|
|
382
400
|
params: unknown;
|
|
383
401
|
} | {
|
|
384
402
|
type: "roundHasToolCalls";
|
|
@@ -456,6 +474,11 @@ export declare class CompletionMachine {
|
|
|
456
474
|
static emptyContext: typeof emptyCompletionContext;
|
|
457
475
|
static transitionName: typeof transitionName;
|
|
458
476
|
static runsUnasked: typeof runsUnasked;
|
|
477
|
+
static cutOffMessage: typeof cutOffMessage;
|
|
478
|
+
static cutShort: typeof cutShort;
|
|
479
|
+
static atContextBoundary: typeof atContextBoundary;
|
|
480
|
+
static MAX_ROUND_CALLS: number;
|
|
481
|
+
static MAX_ROUND_REPEATS: number;
|
|
459
482
|
}
|
|
460
483
|
export type { MachineDefinitionNode } from './definition.ts';
|
|
461
484
|
export type { EmptyCompletionContextOptions } from './completion/context.ts';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PLAN_MODE_REFUSAL } from './completion/actions/tools.js';
|
|
2
2
|
import { emptyCompletionContext } from './completion/context.js';
|
|
3
3
|
import { createCompletionMachine } from './completion/machine.js';
|
|
4
|
-
import { runsUnasked } from './completion/rules.js';
|
|
4
|
+
import { atContextBoundary, cutOffMessage, cutShort, MAX_ROUND_CALLS, MAX_ROUND_REPEATS, runsUnasked } from './completion/rules.js';
|
|
5
5
|
import { MACHINE_VERSION } from './completion/version.js';
|
|
6
6
|
import { completionMachineDefinition, transitionName } from './definition.js';
|
|
7
7
|
export class CompletionMachine {
|
|
@@ -12,4 +12,9 @@ export class CompletionMachine {
|
|
|
12
12
|
static emptyContext = emptyCompletionContext;
|
|
13
13
|
static transitionName = transitionName;
|
|
14
14
|
static runsUnasked = runsUnasked;
|
|
15
|
+
static cutOffMessage = cutOffMessage;
|
|
16
|
+
static cutShort = cutShort;
|
|
17
|
+
static atContextBoundary = atContextBoundary;
|
|
18
|
+
static MAX_ROUND_CALLS = MAX_ROUND_CALLS;
|
|
19
|
+
static MAX_ROUND_REPEATS = MAX_ROUND_REPEATS;
|
|
15
20
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CapabilityProfile } from './model-catalog-constants.ts';
|
|
2
|
+
export interface ContextAsk {
|
|
3
|
+
trained(): Promise<number | undefined>;
|
|
4
|
+
fits(ctxSize: number): Promise<boolean>;
|
|
5
|
+
}
|
|
6
|
+
export declare class ContextChoice {
|
|
7
|
+
private readonly _profile;
|
|
8
|
+
private readonly _pending;
|
|
9
|
+
private readonly _chosen;
|
|
10
|
+
constructor(profile: () => Promise<CapabilityProfile | undefined>);
|
|
11
|
+
static ceiling(profile: CapabilityProfile | undefined): number | undefined;
|
|
12
|
+
chosen(key: string): number | undefined;
|
|
13
|
+
choose(key: string, tier: number, ask: ContextAsk): Promise<number>;
|
|
14
|
+
private _climb;
|
|
15
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const RUNGS = [262_144, 131_072, 65_536];
|
|
2
|
+
const CEILINGS = {
|
|
3
|
+
mid: 65_536,
|
|
4
|
+
high: 131_072,
|
|
5
|
+
xhigh: 262_144
|
|
6
|
+
};
|
|
7
|
+
export class ContextChoice {
|
|
8
|
+
_profile;
|
|
9
|
+
_pending = new Map();
|
|
10
|
+
_chosen = new Map();
|
|
11
|
+
constructor(profile) {
|
|
12
|
+
this._profile = profile;
|
|
13
|
+
}
|
|
14
|
+
static ceiling(profile) {
|
|
15
|
+
return profile && CEILINGS[profile];
|
|
16
|
+
}
|
|
17
|
+
chosen(key) {
|
|
18
|
+
return this._chosen.get(key);
|
|
19
|
+
}
|
|
20
|
+
choose(key, tier, ask) {
|
|
21
|
+
const pending = this._pending.get(key);
|
|
22
|
+
if (pending) {
|
|
23
|
+
return pending;
|
|
24
|
+
}
|
|
25
|
+
const choice = this._climb(tier, ask).then((ctxSize) => {
|
|
26
|
+
if (ctxSize === undefined) {
|
|
27
|
+
this._pending.delete(key);
|
|
28
|
+
return tier;
|
|
29
|
+
}
|
|
30
|
+
this._chosen.set(key, ctxSize);
|
|
31
|
+
return ctxSize;
|
|
32
|
+
});
|
|
33
|
+
this._pending.set(key, choice);
|
|
34
|
+
return choice;
|
|
35
|
+
}
|
|
36
|
+
async _climb(tier, ask) {
|
|
37
|
+
const ceiling = ContextChoice.ceiling(await this._profile());
|
|
38
|
+
if (!ceiling || ceiling <= tier) {
|
|
39
|
+
return tier;
|
|
40
|
+
}
|
|
41
|
+
const trained = await ask.trained();
|
|
42
|
+
if (!trained) {
|
|
43
|
+
return undefined;
|
|
44
|
+
}
|
|
45
|
+
for (const rung of RUNGS) {
|
|
46
|
+
if (rung > ceiling || rung > trained || rung <= tier) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
if (await ask.fits(rung)) {
|
|
50
|
+
return rung;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return tier;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import type { ModelAddon } from './model-source.ts';
|
|
3
|
+
export interface HeldModel {
|
|
4
|
+
readonly model: string;
|
|
5
|
+
readonly addon: ModelAddon;
|
|
6
|
+
}
|
|
7
|
+
export interface DownloadGateOptions {
|
|
8
|
+
isCached(model: string, addon: ModelAddon): Promise<boolean>;
|
|
9
|
+
onHeld(held: HeldModel): void;
|
|
10
|
+
onDropped(held: HeldModel): void;
|
|
11
|
+
}
|
|
12
|
+
export type HoldFn = (model: string, addon: ModelAddon, signal?: BareAbortSignal) => Promise<void>;
|
|
13
|
+
export interface DownloadGate {
|
|
14
|
+
readonly allowed: boolean;
|
|
15
|
+
setAllowed(allowed: boolean): void;
|
|
16
|
+
downloaded(): void;
|
|
17
|
+
hold: HoldFn;
|
|
18
|
+
abandon(): void;
|
|
19
|
+
}
|
|
20
|
+
export declare function createDownloadGate({ isCached, onHeld, onDropped }: DownloadGateOptions): DownloadGate;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { AbortedError, raceAbort } from '../helpers/race-abort.js';
|
|
2
|
+
function deferred() {
|
|
3
|
+
const next = Promise.withResolvers();
|
|
4
|
+
next.promise.catch(noop);
|
|
5
|
+
return next;
|
|
6
|
+
}
|
|
7
|
+
export function createDownloadGate({ isCached, onHeld, onDropped }) {
|
|
8
|
+
let allowed = true;
|
|
9
|
+
let woke = deferred();
|
|
10
|
+
let dropped = deferred();
|
|
11
|
+
const wake = () => {
|
|
12
|
+
const woken = woke;
|
|
13
|
+
woke = deferred();
|
|
14
|
+
woken.resolve();
|
|
15
|
+
};
|
|
16
|
+
const wait = async (held, signal, onWait) => {
|
|
17
|
+
const drop = dropped;
|
|
18
|
+
const cancelled = () => signal?.aborted === true || drop !== dropped;
|
|
19
|
+
for (;;) {
|
|
20
|
+
const change = Promise.race([raceAbort(woke.promise, signal), drop.promise]);
|
|
21
|
+
change.catch(noop);
|
|
22
|
+
const ready = allowed || (await isCached(held.model, held.addon).catch(() => false));
|
|
23
|
+
if (cancelled()) {
|
|
24
|
+
throw new AbortedError();
|
|
25
|
+
}
|
|
26
|
+
if (ready) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
onWait();
|
|
30
|
+
await change;
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
get allowed() {
|
|
35
|
+
return allowed;
|
|
36
|
+
},
|
|
37
|
+
setAllowed(next) {
|
|
38
|
+
allowed = next;
|
|
39
|
+
if (allowed) {
|
|
40
|
+
wake();
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
downloaded: wake,
|
|
44
|
+
async hold(model, addon, signal) {
|
|
45
|
+
if (allowed)
|
|
46
|
+
return;
|
|
47
|
+
if (signal?.aborted)
|
|
48
|
+
throw new AbortedError();
|
|
49
|
+
const held = { model, addon };
|
|
50
|
+
let shown = false;
|
|
51
|
+
try {
|
|
52
|
+
await wait(held, signal, () => {
|
|
53
|
+
if (!shown) {
|
|
54
|
+
shown = true;
|
|
55
|
+
onHeld(held);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
catch (err) {
|
|
60
|
+
if (shown) {
|
|
61
|
+
onDropped(held);
|
|
62
|
+
}
|
|
63
|
+
throw err;
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
abandon() {
|
|
67
|
+
const abandoned = dropped;
|
|
68
|
+
dropped = deferred();
|
|
69
|
+
abandoned.reject(new AbortedError());
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function noop() { }
|
|
@@ -21,6 +21,9 @@ export type GgufRangeFetch = (url: string, init: {
|
|
|
21
21
|
}>;
|
|
22
22
|
export declare const GGUF_HEADER_BYTES = 1048576;
|
|
23
23
|
export declare const GGUF_HEADER_TIMEOUT_MS = 30000;
|
|
24
|
+
export declare const GGUF_HEADER_ATTEMPTS = 3;
|
|
25
|
+
export declare const GGUF_STUB_MAX_BYTES = 33554432;
|
|
26
|
+
export declare const GGUF_STUB_TIMEOUT_MS = 60000;
|
|
24
27
|
export declare function isRemoteSource(src: string): boolean;
|
|
25
28
|
export declare function localSourcePath(src: string): string | null;
|
|
26
29
|
export interface ReadGgufHeaderOptions {
|
|
@@ -28,4 +31,6 @@ export interface ReadGgufHeaderOptions {
|
|
|
28
31
|
maxBytes?: number;
|
|
29
32
|
}
|
|
30
33
|
export declare function readGgufHeaderBytes(src: string, opts?: ReadGgufHeaderOptions): Promise<Uint8Array | null>;
|
|
34
|
+
export declare function fetchGgufStub(src: string, opts?: ReadGgufHeaderOptions): Promise<Uint8Array | null>;
|
|
35
|
+
export declare function ggufDataOffset(bytes: Uint8Array): number | null;
|
|
31
36
|
export declare function parseGgufHeader(bytes: Uint8Array): GgufHeader | null;
|