@qvac/harness 1.0.0-rc.3 → 1.0.0-rc.5
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 +2302 -1485
- package/README.md +44 -31
- package/dist-lib/index.d.ts +51 -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 +104 -40
- 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 +22 -13
- 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 +50 -22
- 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 +33 -6
- package/dist-lib/lib/capabilities/completion-engine/driver.js +28 -13
- 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/engine.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/engine.js +14 -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 +16 -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 +14 -9
- package/dist-lib/lib/capabilities/completion-engine/turns.js +63 -86
- 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 +68 -26
- 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 +51 -30
- package/dist-lib/lib/contract/drive.d.ts +4 -0
- package/dist-lib/lib/contract/drive.js +1 -0
- 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 +3 -0
- package/dist-lib/lib/contract/managed-skills.d.ts +1 -0
- package/dist-lib/lib/contract/managed-skills.js +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 +15 -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 +35 -15
- 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 +78 -12
- 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 +5 -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 +43 -10
- package/dist-lib/lib/machine/completion/machine.d.ts +23 -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 +43 -1
- package/dist-lib/lib/machine/index.d.ts +29 -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 +83 -38
- 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 +8 -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 +52 -9
- 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 +310 -205
- package/dist-lib/spec/hyperschema/index.js +310 -205
- package/dist-lib/spec/hyperschema/schema.json +164 -84
- package/dist-lib/spec/hyperschema/types.d.ts +25 -4
- 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
|
@@ -292,6 +292,16 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
292
292
|
target: 'tools',
|
|
293
293
|
actions: { type: 'resolveTools', params: ({ event }) => event.output }
|
|
294
294
|
},
|
|
295
|
+
{
|
|
296
|
+
guard: and(['roundCut', or(['canRetryCut', 'timeUp'])]),
|
|
297
|
+
target: 'round',
|
|
298
|
+
actions: [nextRoundAck, 'retryCutRound']
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
guard: 'roundCut',
|
|
302
|
+
target: 'wrapping',
|
|
303
|
+
actions: [sameRoundAck, 'wrapCutCompletion']
|
|
304
|
+
},
|
|
295
305
|
{
|
|
296
306
|
guard: 'malformedToolCall',
|
|
297
307
|
target: 'round',
|
|
@@ -309,8 +319,21 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
309
319
|
guard: 'hasAnswer',
|
|
310
320
|
target: 'answering'
|
|
311
321
|
},
|
|
312
|
-
{
|
|
313
|
-
|
|
322
|
+
{
|
|
323
|
+
guard: 'canMuteRetry',
|
|
324
|
+
target: 'round',
|
|
325
|
+
actions: [
|
|
326
|
+
{ type: 'resetCutRound', params: ({ event }) => event.output },
|
|
327
|
+
{ type: 'retryMuteRound', params: ({ event }) => event.output }
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
target: 'wrapping',
|
|
332
|
+
actions: [
|
|
333
|
+
{ type: 'resetCutRound', params: ({ event }) => event.output },
|
|
334
|
+
{ type: 'wrapMuteCompletion', params: ({ event }) => event.output }
|
|
335
|
+
]
|
|
336
|
+
}
|
|
314
337
|
]
|
|
315
338
|
}
|
|
316
339
|
},
|
|
@@ -338,7 +361,13 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
338
361
|
]
|
|
339
362
|
},
|
|
340
363
|
{
|
|
341
|
-
guard: and([
|
|
364
|
+
guard: and([
|
|
365
|
+
'goalUnmet',
|
|
366
|
+
'hasRoundsLeft',
|
|
367
|
+
not('timeUp'),
|
|
368
|
+
'goalTokensLeft',
|
|
369
|
+
not('goalStalled')
|
|
370
|
+
]),
|
|
342
371
|
target: 'round',
|
|
343
372
|
actions: [
|
|
344
373
|
{ type: 'answerCompletion', params: ({ event }) => event.output },
|
|
@@ -372,7 +401,7 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
372
401
|
selecting: {
|
|
373
402
|
always: [
|
|
374
403
|
{
|
|
375
|
-
guard: and(['hasQueuedTool', '
|
|
404
|
+
guard: and(['hasQueuedTool', 'headCutOff']),
|
|
376
405
|
target: 'rejecting',
|
|
377
406
|
actions: {
|
|
378
407
|
type: 'rejectCutOffTool',
|
|
@@ -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);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompletionHistoryEntry, GoalStatus, HistorySplice, HookRejection, Operation, PlanStep, ResourceDescriptor, RoundSpeed, RunBackendUse, RunBudget, RunOutcome, ToolActivityEvent, ToolCallDisplay, ToolEffect, ToolExecutionOutcome, ToolSpeed, TrustedSourceFacts } from '../../contract/run.ts';
|
|
1
|
+
import type { CompletionHistoryEntry, GoalStatus, HistorySplice, HookRejection, Operation, PlanStep, ResourceDescriptor, RoundSpeed, RunBackendUse, RunBudget, RunOutcome, ToolActivityEvent, ToolCallDisplay, ToolEffect, ToolExecutionOutcome, ToolSpeed, TrustedSourceFacts, TurnContext } from '../../contract/run.ts';
|
|
2
2
|
import type { EngineError } from '../../helpers/engine-error.ts';
|
|
3
3
|
import type { FailureResultValue } from '../../helpers/failure-result.ts';
|
|
4
4
|
export interface CompletionStats {
|
|
@@ -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,8 @@ export interface EngineEvent {
|
|
|
20
21
|
replacedTypes?: ('content' | 'thinking')[];
|
|
21
22
|
status?: GoalStatus;
|
|
22
23
|
turn?: number;
|
|
24
|
+
checks?: string[];
|
|
25
|
+
context?: TurnContext;
|
|
23
26
|
}
|
|
24
27
|
export interface EngineFacts extends Record<string, unknown> {
|
|
25
28
|
runBudget: RunBudget;
|
|
@@ -72,11 +75,14 @@ export interface RoundDonePayload {
|
|
|
72
75
|
stopReason?: string;
|
|
73
76
|
durationMs: number;
|
|
74
77
|
ctxSize?: number | undefined;
|
|
78
|
+
overflows?: number | undefined;
|
|
79
|
+
reasoningDeltas?: number | undefined;
|
|
75
80
|
replay: string | null;
|
|
76
81
|
response?: string;
|
|
77
82
|
history?: HistorySplice;
|
|
78
83
|
cacheable?: boolean;
|
|
79
84
|
fallbackResponse?: string;
|
|
85
|
+
cut?: string;
|
|
80
86
|
}
|
|
81
87
|
export interface ResolvedCallSnapshot {
|
|
82
88
|
key: string;
|
|
@@ -89,6 +95,7 @@ export interface ResolvedCallSnapshot {
|
|
|
89
95
|
permission?: 'allow' | 'ask';
|
|
90
96
|
concurrent?: true;
|
|
91
97
|
leavesPlan?: true;
|
|
98
|
+
cutOff?: true;
|
|
92
99
|
}
|
|
93
100
|
export interface ToolExecutionSnapshot {
|
|
94
101
|
kind: 'direct' | 'tool';
|
|
@@ -134,6 +141,12 @@ export interface ToolDonePayload {
|
|
|
134
141
|
};
|
|
135
142
|
progressed?: boolean;
|
|
136
143
|
blockedRepeat?: boolean;
|
|
144
|
+
unchanged?: boolean;
|
|
145
|
+
settled?: {
|
|
146
|
+
key: string;
|
|
147
|
+
digest: string;
|
|
148
|
+
};
|
|
149
|
+
stableRead?: true;
|
|
137
150
|
endedRun?: boolean;
|
|
138
151
|
answer?: string;
|
|
139
152
|
delivered?: boolean;
|
|
@@ -141,6 +154,7 @@ export interface ToolDonePayload {
|
|
|
141
154
|
activate?: string;
|
|
142
155
|
plan?: PlanStep[];
|
|
143
156
|
leftPlanMode?: boolean;
|
|
157
|
+
checked?: GoalCheck[];
|
|
144
158
|
}
|
|
145
159
|
export interface BatchDonePayload {
|
|
146
160
|
history?: HistorySplice;
|
|
@@ -187,6 +201,7 @@ export interface PreparingPayload {
|
|
|
187
201
|
sources?: TrustedSourceFacts[];
|
|
188
202
|
availableTools?: string[];
|
|
189
203
|
promptPrefix?: string;
|
|
204
|
+
checkable?: boolean;
|
|
190
205
|
}
|
|
191
206
|
export interface PrepareStepProposal {
|
|
192
207
|
id: string;
|
|
@@ -223,6 +238,7 @@ export interface AnsweredPayload {
|
|
|
223
238
|
durationMs?: number;
|
|
224
239
|
narrated?: string;
|
|
225
240
|
malformed?: boolean;
|
|
241
|
+
cutOff?: true;
|
|
226
242
|
}
|
|
227
243
|
export interface ToolsResolvedPayload {
|
|
228
244
|
calls: ResolvedCallSnapshot[];
|
|
@@ -234,17 +250,36 @@ export interface RunPolicy {
|
|
|
234
250
|
deliveredNudge: string;
|
|
235
251
|
deniedMessage: string;
|
|
236
252
|
cutOffMessage: string;
|
|
253
|
+
contextBoundaryMessage: string;
|
|
254
|
+
roundCutMessage: string;
|
|
255
|
+
repeatedCallMessage: string;
|
|
256
|
+
unchangedMessage: string;
|
|
237
257
|
goalNudge: string;
|
|
238
258
|
}
|
|
259
|
+
export interface SettledResult {
|
|
260
|
+
digest: string;
|
|
261
|
+
repeats: number;
|
|
262
|
+
round: number;
|
|
263
|
+
folded?: true;
|
|
264
|
+
}
|
|
265
|
+
export interface GoalCheck {
|
|
266
|
+
name: string;
|
|
267
|
+
passed: boolean;
|
|
268
|
+
output: string | null;
|
|
269
|
+
}
|
|
239
270
|
export interface GoalState {
|
|
240
271
|
objective: string;
|
|
241
272
|
tokens: number | null;
|
|
242
273
|
turns: number;
|
|
243
274
|
status: GoalStatus;
|
|
275
|
+
checks: GoalCheck[];
|
|
276
|
+
checkable?: boolean;
|
|
244
277
|
}
|
|
245
278
|
export interface QueuedInput {
|
|
246
279
|
id?: string;
|
|
247
280
|
text: string;
|
|
281
|
+
context?: TurnContext;
|
|
282
|
+
content?: string;
|
|
248
283
|
}
|
|
249
284
|
export interface CompletionContext {
|
|
250
285
|
runId: string;
|
|
@@ -262,6 +297,7 @@ export interface CompletionContext {
|
|
|
262
297
|
round: number;
|
|
263
298
|
roundsSent: number;
|
|
264
299
|
mute: number;
|
|
300
|
+
cuts: number;
|
|
265
301
|
narrated: boolean;
|
|
266
302
|
malformed: boolean;
|
|
267
303
|
webSearches: number;
|
|
@@ -271,6 +307,8 @@ export interface CompletionContext {
|
|
|
271
307
|
deniedKeys: string[];
|
|
272
308
|
failedCalls: Record<string, SettledCall>;
|
|
273
309
|
blockedRepeats: number;
|
|
310
|
+
settledResults: Record<string, SettledResult>;
|
|
311
|
+
answeredReads?: string[];
|
|
274
312
|
roundProgressed: boolean;
|
|
275
313
|
answer: string | null;
|
|
276
314
|
delivered: boolean;
|
|
@@ -299,6 +337,7 @@ export interface CompletionContext {
|
|
|
299
337
|
failMessage: string | null;
|
|
300
338
|
steering: QueuedInput[];
|
|
301
339
|
followUps: QueuedInput[];
|
|
340
|
+
edgeInputs: QueuedInput[];
|
|
302
341
|
plan: PlanStep[];
|
|
303
342
|
planMode: boolean;
|
|
304
343
|
goal: GoalState | null;
|
|
@@ -333,6 +372,7 @@ export interface ToolRejection {
|
|
|
333
372
|
emitCall?: boolean;
|
|
334
373
|
emitResult?: boolean;
|
|
335
374
|
capped?: boolean;
|
|
375
|
+
repeat?: ToolExecutionOutcome;
|
|
336
376
|
}
|
|
337
377
|
export interface SearchingOutput {
|
|
338
378
|
directTool: DirectToolOutput | null;
|
|
@@ -413,4 +453,6 @@ export type CompletionMachineEvent = {
|
|
|
413
453
|
mode: 'steer' | 'follow-up';
|
|
414
454
|
id?: string;
|
|
415
455
|
text: string;
|
|
456
|
+
context?: TurnContext;
|
|
457
|
+
content?: string;
|
|
416
458
|
};
|
|
@@ -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;
|
|
@@ -38,6 +38,8 @@ export declare class CompletionMachine {
|
|
|
38
38
|
mode: 'steer' | 'follow-up';
|
|
39
39
|
id?: string;
|
|
40
40
|
text: string;
|
|
41
|
+
context?: import("../contract/run.ts").TurnContext;
|
|
42
|
+
content?: string;
|
|
41
43
|
}, {
|
|
42
44
|
[x: string]: import("xstate").ActorRefFromLogic<import("xstate").PromiseActorLogic<void, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").AnsweredPayload, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").BatchDonePayload, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").InspectingOutput, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").PrepareInspectionOutput, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").PreparingOutput, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").RetrievingOutput, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").RoundDonePayload, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").SearchingOutput, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<import("./completion/types.ts").ToolDonePayload, import("./index.ts").InvocationInput> | import("xstate").PromiseActorLogic<{
|
|
43
45
|
approved: boolean;
|
|
@@ -210,6 +212,9 @@ export declare class CompletionMachine {
|
|
|
210
212
|
} | {
|
|
211
213
|
type: "requestPrepare";
|
|
212
214
|
params: import("./completion/actions/prepare.ts").RequestPrepareParams;
|
|
215
|
+
} | {
|
|
216
|
+
type: "resetCutRound";
|
|
217
|
+
params: import("./completion/types.ts").ToolsResolvedPayload & import("./completion/types.ts").AnsweredPayload;
|
|
213
218
|
} | {
|
|
214
219
|
type: "resolveTools";
|
|
215
220
|
params: import("./completion/types.ts").ToolsResolvedPayload;
|
|
@@ -219,12 +224,15 @@ export declare class CompletionMachine {
|
|
|
219
224
|
} | {
|
|
220
225
|
type: "retryCappedSearch";
|
|
221
226
|
params: undefined;
|
|
227
|
+
} | {
|
|
228
|
+
type: "retryCutRound";
|
|
229
|
+
params: undefined;
|
|
222
230
|
} | {
|
|
223
231
|
type: "retryMalformedRound";
|
|
224
232
|
params: import("./completion/types.ts").AnsweredPayload;
|
|
225
233
|
} | {
|
|
226
234
|
type: "retryMuteRound";
|
|
227
|
-
params:
|
|
235
|
+
params: import("./completion/types.ts").AnsweredPayload;
|
|
228
236
|
} | {
|
|
229
237
|
type: "retryNarratedRound";
|
|
230
238
|
params: import("./completion/types.ts").AnsweredPayload;
|
|
@@ -257,6 +265,9 @@ export declare class CompletionMachine {
|
|
|
257
265
|
} | {
|
|
258
266
|
type: "wrapCompletion";
|
|
259
267
|
params: import("../contract/run.ts").RunOutcome;
|
|
268
|
+
} | {
|
|
269
|
+
type: "wrapCutCompletion";
|
|
270
|
+
params: undefined;
|
|
260
271
|
} | {
|
|
261
272
|
type: "wrapDeliveredCompletion";
|
|
262
273
|
params: undefined;
|
|
@@ -265,7 +276,7 @@ export declare class CompletionMachine {
|
|
|
265
276
|
params: undefined;
|
|
266
277
|
} | {
|
|
267
278
|
type: "wrapMuteCompletion";
|
|
268
|
-
params:
|
|
279
|
+
params: import("./completion/types.ts").AnsweredPayload;
|
|
269
280
|
} | {
|
|
270
281
|
type: "wrapSearchCappedCompletion";
|
|
271
282
|
params: undefined;
|
|
@@ -281,6 +292,9 @@ export declare class CompletionMachine {
|
|
|
281
292
|
} | {
|
|
282
293
|
type: "canMuteRetry";
|
|
283
294
|
params: unknown;
|
|
295
|
+
} | {
|
|
296
|
+
type: "canRetryCut";
|
|
297
|
+
params: unknown;
|
|
284
298
|
} | {
|
|
285
299
|
type: "canRetrySearchCap";
|
|
286
300
|
params: unknown;
|
|
@@ -323,6 +337,9 @@ export declare class CompletionMachine {
|
|
|
323
337
|
} | {
|
|
324
338
|
type: "failedOutcome";
|
|
325
339
|
params: unknown;
|
|
340
|
+
} | {
|
|
341
|
+
type: "goalStalled";
|
|
342
|
+
params: unknown;
|
|
326
343
|
} | {
|
|
327
344
|
type: "goalTokensLeft";
|
|
328
345
|
params: unknown;
|
|
@@ -341,6 +358,9 @@ export declare class CompletionMachine {
|
|
|
341
358
|
} | {
|
|
342
359
|
type: "hasRoundsLeft";
|
|
343
360
|
params: unknown;
|
|
361
|
+
} | {
|
|
362
|
+
type: "headCutOff";
|
|
363
|
+
params: unknown;
|
|
344
364
|
} | {
|
|
345
365
|
type: "interrupted";
|
|
346
366
|
params: unknown;
|
|
@@ -378,7 +398,7 @@ export declare class CompletionMachine {
|
|
|
378
398
|
type: "repeatsBlocked";
|
|
379
399
|
params: unknown;
|
|
380
400
|
} | {
|
|
381
|
-
type: "
|
|
401
|
+
type: "roundCut";
|
|
382
402
|
params: unknown;
|
|
383
403
|
} | {
|
|
384
404
|
type: "roundHasToolCalls";
|
|
@@ -456,6 +476,11 @@ export declare class CompletionMachine {
|
|
|
456
476
|
static emptyContext: typeof emptyCompletionContext;
|
|
457
477
|
static transitionName: typeof transitionName;
|
|
458
478
|
static runsUnasked: typeof runsUnasked;
|
|
479
|
+
static cutOffMessage: typeof cutOffMessage;
|
|
480
|
+
static cutShort: typeof cutShort;
|
|
481
|
+
static atContextBoundary: typeof atContextBoundary;
|
|
482
|
+
static MAX_ROUND_CALLS: number;
|
|
483
|
+
static MAX_ROUND_REPEATS: number;
|
|
459
484
|
}
|
|
460
485
|
export type { MachineDefinitionNode } from './definition.ts';
|
|
461
486
|
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;
|