@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,150 +0,0 @@
|
|
|
1
|
-
"""tau2-bench with the harness as the agent and a local model as the simulated user.
|
|
2
|
-
|
|
3
|
-
output/venvs/tau2/bin/python bench/bridge/python/run_tau2.py --domain airline --tasks 10
|
|
4
|
-
|
|
5
|
-
Scores are tau2's own rewards, but not comparable to its leaderboard, whose user is GPT-4.1.
|
|
6
|
-
"""
|
|
7
|
-
|
|
8
|
-
import argparse
|
|
9
|
-
import datetime
|
|
10
|
-
import json
|
|
11
|
-
import os
|
|
12
|
-
import re
|
|
13
|
-
import signal
|
|
14
|
-
import subprocess
|
|
15
|
-
import sys
|
|
16
|
-
import time
|
|
17
|
-
|
|
18
|
-
sys.path.insert(0, os.path.dirname(__file__))
|
|
19
|
-
from qvac_bench.session import QvacSession # noqa: E402
|
|
20
|
-
from qvac_bench.tau2_agent import QvacTau2Agent # noqa: E402
|
|
21
|
-
from tau2.evaluator.evaluator import EvaluationType # noqa: E402
|
|
22
|
-
from tau2.orchestrator.orchestrator import Orchestrator # noqa: E402
|
|
23
|
-
from tau2.runner import build_environment, build_user, get_tasks, run_simulation # noqa: E402
|
|
24
|
-
|
|
25
|
-
REPO = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
|
|
26
|
-
PORT = 8765
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def start_user_endpoint() -> subprocess.Popen:
|
|
30
|
-
endpoint = subprocess.Popen(
|
|
31
|
-
[os.path.join(REPO, "node_modules", ".bin", "bare"), "bench/bridge/openai.ts"],
|
|
32
|
-
cwd=REPO,
|
|
33
|
-
env={**os.environ, "QVAC_OPENAI_PORT": str(PORT), "QVAC_OPENAI_END_TOKENS": "1"},
|
|
34
|
-
stdout=subprocess.PIPE,
|
|
35
|
-
stderr=subprocess.DEVNULL,
|
|
36
|
-
text=True,
|
|
37
|
-
# the bin shim spawns the runtime, so only a process group takes both down
|
|
38
|
-
start_new_session=True,
|
|
39
|
-
)
|
|
40
|
-
for line in endpoint.stdout:
|
|
41
|
-
if "endpoint on" in line:
|
|
42
|
-
return endpoint
|
|
43
|
-
raise RuntimeError("the user endpoint exited before listening; is port %d taken?" % PORT)
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
def stop(process: subprocess.Popen) -> None:
|
|
47
|
-
os.killpg(process.pid, signal.SIGTERM)
|
|
48
|
-
process.wait()
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
# the task files run roughly from refusals to multi-step changes, so the first N are not a sample
|
|
52
|
-
def sample(tasks: list, count: int | None) -> list:
|
|
53
|
-
if not count or count >= len(tasks):
|
|
54
|
-
return tasks
|
|
55
|
-
step = len(tasks) / count
|
|
56
|
-
return [tasks[int(index * step)] for index in range(count)]
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
# the policy's own hand-off line; τ²'s customer should answer it with ###TRANSFER###, which ends the task
|
|
60
|
-
TRANSFER_MESSAGE = "YOU ARE BEING TRANSFERRED TO A HUMAN AGENT"
|
|
61
|
-
# τ²'s end tokens are ###STOP### and the like; a customer that drops the hashes never ends the task
|
|
62
|
-
END_WORDS = {"STOP", "TRANSFER", "OUT-OF-SCOPE"}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
def customer_never_ended(result) -> bool:
|
|
66
|
-
if not str(result.termination_reason).endswith("MAX_STEPS"):
|
|
67
|
-
return False
|
|
68
|
-
handed_off = any(m.role == "assistant" and TRANSFER_MESSAGE in (m.content or "") for m in result.messages)
|
|
69
|
-
bare_end = any(m.role == "user" and (m.content or "").strip(" #.").upper() in END_WORDS for m in result.messages)
|
|
70
|
-
return handed_off or bare_end
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
# a task whose expected actions change the database, as opposed to one the policy says to refuse
|
|
74
|
-
def needs_write(task) -> bool:
|
|
75
|
-
actions = (task.evaluation_criteria.actions or []) if task.evaluation_criteria else []
|
|
76
|
-
return any(not action.name.startswith(("get_", "search_", "list_", "calculate", "think", "transfer")) for action in actions)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# tau2 policies state their own present ("The current time is 2024-05-15 15:00:00 EST.")
|
|
80
|
-
def policy_now(policy: str) -> int | None:
|
|
81
|
-
match = re.search(r"current time is (\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) EST", policy)
|
|
82
|
-
if not match:
|
|
83
|
-
return None
|
|
84
|
-
est = datetime.timezone(datetime.timedelta(hours=-5))
|
|
85
|
-
return int(datetime.datetime.strptime(match.group(1), "%Y-%m-%d %H:%M:%S").replace(tzinfo=est).timestamp() * 1000)
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
def main() -> None:
|
|
89
|
-
parser = argparse.ArgumentParser()
|
|
90
|
-
parser.add_argument("--domain", default="airline")
|
|
91
|
-
parser.add_argument("--model", default="Qwen3.5-9B-Q4_K_M")
|
|
92
|
-
parser.add_argument("--user-model", default="Qwen3.5-9B-Q4_K_M")
|
|
93
|
-
parser.add_argument("--tasks", type=int, default=None)
|
|
94
|
-
parser.add_argument("--task-ids", default=None, help="comma-separated ids, instead of a sample")
|
|
95
|
-
parser.add_argument("--max-steps", type=int, default=100)
|
|
96
|
-
parser.add_argument("--out", default=os.path.join(REPO, "output", "tau2"))
|
|
97
|
-
args = parser.parse_args()
|
|
98
|
-
|
|
99
|
-
os.makedirs(args.out, exist_ok=True)
|
|
100
|
-
out_file = os.path.join(args.out, f"{args.domain}-{args.model}-{int(time.time())}.jsonl")
|
|
101
|
-
endpoint = start_user_endpoint()
|
|
102
|
-
commit = subprocess.run(["git", "rev-parse", "--short", "HEAD"], cwd=REPO, capture_output=True, text=True).stdout.strip()
|
|
103
|
-
session = QvacSession(REPO, args.model, trace=out_file.replace(".jsonl", ".trace"))
|
|
104
|
-
user_llm_args = {"api_base": f"http://127.0.0.1:{PORT}/v1", "api_key": "local", "temperature": 0.0}
|
|
105
|
-
rewards = []
|
|
106
|
-
try:
|
|
107
|
-
chosen = args.task_ids.split(",") if args.task_ids else None
|
|
108
|
-
tasks = get_tasks(args.domain, task_ids=chosen) if chosen else sample(get_tasks(args.domain), args.tasks)
|
|
109
|
-
for task in tasks:
|
|
110
|
-
env = build_environment(args.domain)
|
|
111
|
-
agent = QvacTau2Agent(env.get_tools(), env.get_policy(), session, policy_now(env.get_policy()))
|
|
112
|
-
user = build_user("user_simulator", env, task, llm=f"openai/{args.user_model}", llm_args=user_llm_args)
|
|
113
|
-
orchestrator = Orchestrator(
|
|
114
|
-
domain=args.domain, agent=agent, user=user, environment=env, task=task,
|
|
115
|
-
max_steps=args.max_steps, max_errors=10, seed=42,
|
|
116
|
-
)
|
|
117
|
-
started = time.time()
|
|
118
|
-
try:
|
|
119
|
-
result = run_simulation(orchestrator, evaluation_type=EvaluationType.ALL)
|
|
120
|
-
finally:
|
|
121
|
-
session.finish()
|
|
122
|
-
reward = result.reward_info.reward if result.reward_info else 0.0
|
|
123
|
-
rewards.append(reward)
|
|
124
|
-
row = {
|
|
125
|
-
"task": task.id,
|
|
126
|
-
"commit": commit,
|
|
127
|
-
"writes": needs_write(task),
|
|
128
|
-
"reward": reward,
|
|
129
|
-
"termination": str(getattr(result, "termination_reason", "")),
|
|
130
|
-
"breakdown": {str(k): v for k, v in (result.reward_info.reward_breakdown or {}).items()} if result.reward_info else {},
|
|
131
|
-
"messages": len(result.messages),
|
|
132
|
-
"customer_never_ended": customer_never_ended(result),
|
|
133
|
-
"replies": agent.replies,
|
|
134
|
-
"failed_turns": agent.failed_turns,
|
|
135
|
-
"errors": agent.errors,
|
|
136
|
-
"speed": agent.speed,
|
|
137
|
-
"seconds": round(time.time() - started, 1),
|
|
138
|
-
}
|
|
139
|
-
with open(out_file, "a") as f:
|
|
140
|
-
f.write(json.dumps(row) + "\n")
|
|
141
|
-
print(f"{task.id}: reward {reward} in {row['seconds']}s ({row['messages']} messages)", flush=True)
|
|
142
|
-
finally:
|
|
143
|
-
session.close()
|
|
144
|
-
stop(endpoint)
|
|
145
|
-
|
|
146
|
-
print(f"{args.domain} {args.model}: pass^1 {sum(rewards) / max(1, len(rewards)):.3f} over {len(rewards)} tasks -> {out_file}")
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
if __name__ == "__main__":
|
|
150
|
-
main()
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
"""Smoke the bridge without a benchmark: a real model, one bash tool, a throwaway local folder."""
|
|
2
|
-
|
|
3
|
-
import asyncio
|
|
4
|
-
import os
|
|
5
|
-
import subprocess
|
|
6
|
-
import sys
|
|
7
|
-
import tempfile
|
|
8
|
-
|
|
9
|
-
sys.path.insert(0, os.path.dirname(__file__))
|
|
10
|
-
from qvac_bench import QvacBridge # noqa: E402
|
|
11
|
-
from qvac_bench.tools import BASH # noqa: E402
|
|
12
|
-
|
|
13
|
-
REPO = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", ".."))
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
async def main(model: str) -> None:
|
|
17
|
-
workdir = os.path.realpath(tempfile.mkdtemp(prefix="qvac-bridge-"))
|
|
18
|
-
with open(os.path.join(workdir, "notes.txt"), "w") as f:
|
|
19
|
-
f.write("launch: 14 March\n")
|
|
20
|
-
|
|
21
|
-
async def execute(name: str, args: dict) -> dict:
|
|
22
|
-
# the model's commands run on this machine, so confine them: no network, writes only in workdir
|
|
23
|
-
profile = f'(version 1)(allow default)(deny network*)(deny file-write*)(allow file-write* (subpath "{workdir}") (literal "/dev/null"))'
|
|
24
|
-
done = subprocess.run(
|
|
25
|
-
["sandbox-exec", "-p", profile, "/bin/sh", "-c", args["command"]],
|
|
26
|
-
cwd=workdir, capture_output=True, text=True, timeout=30,
|
|
27
|
-
)
|
|
28
|
-
return {"stdout": done.stdout, "stderr": done.stderr, "return_code": done.returncode}
|
|
29
|
-
|
|
30
|
-
bridge = QvacBridge(REPO, model)
|
|
31
|
-
await bridge.start()
|
|
32
|
-
try:
|
|
33
|
-
done = await bridge.run(
|
|
34
|
-
[{"role": "user", "content": "Create a file called answer.txt containing the launch date from notes.txt."}],
|
|
35
|
-
[BASH],
|
|
36
|
-
execute,
|
|
37
|
-
system="You work in a terminal. Use the bash tool.",
|
|
38
|
-
)
|
|
39
|
-
finally:
|
|
40
|
-
await bridge.close()
|
|
41
|
-
|
|
42
|
-
answer = os.path.join(workdir, "answer.txt")
|
|
43
|
-
print({"reply": done["reply"][:200], "calls": done["calls"], "error": done["error"]})
|
|
44
|
-
print("answer.txt:", open(answer).read().strip() if os.path.exists(answer) else None)
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
asyncio.run(main(sys.argv[1] if len(sys.argv) > 1 else "Qwen3.5-4B-Q4_K_M"))
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"""python3 -m unittest test_airline, from this folder: tau2 is not needed."""
|
|
2
|
-
|
|
3
|
-
import unittest
|
|
4
|
-
|
|
5
|
-
from qvac_bench.airline import quote
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
class Quote(unittest.TestCase):
|
|
9
|
-
def test_flights_that_are_not_objects_fall_back(self):
|
|
10
|
-
self.assertTrue(quote("book_reservation", {"flights": ["HAT1"]}).startswith("Call book_reservation with "))
|
|
11
|
-
|
|
12
|
-
def test_a_passenger_count_falls_back(self):
|
|
13
|
-
self.assertTrue(quote("book_reservation", {"passengers": 5}).startswith("Call book_reservation with "))
|
|
14
|
-
|
|
15
|
-
def test_a_string_amount_is_priced(self):
|
|
16
|
-
self.assertIn("total of $100.", quote("book_reservation", {"payment_methods": [{"amount": "100"}]}))
|
|
17
|
-
self.assertTrue(quote("book_reservation", {"payment_methods": [{"amount": "lots"}]}).startswith("Call "))
|
|
18
|
-
|
|
19
|
-
def test_a_string_bag_count_is_priced(self):
|
|
20
|
-
self.assertIn("2 paid at $50 each ($100)", quote("update_reservation_baggages", {"nonfree_baggages": "2"}))
|
|
21
|
-
self.assertIn("(2 paid)", quote("book_reservation", {"nonfree_baggages": "2"}))
|
|
22
|
-
|
|
23
|
-
def test_an_unknown_tool_is_summarised(self):
|
|
24
|
-
self.assertEqual(quote("get_user_details", {"user_id": "u1"}), 'Call get_user_details with {"user_id": "u1"}.')
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
if __name__ == "__main__":
|
|
28
|
-
unittest.main()
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"""python3 -m unittest test_approval, from this folder: tau2 is not needed."""
|
|
2
|
-
|
|
3
|
-
import unittest
|
|
4
|
-
|
|
5
|
-
from qvac_bench.approval import confirms
|
|
6
|
-
|
|
7
|
-
# replies a Qwen3.5 simulated user gave to a quoted tau2 write
|
|
8
|
-
APPROVALS = [
|
|
9
|
-
"yes",
|
|
10
|
-
"Yes.",
|
|
11
|
-
"Yes, please proceed with the cabin upgrade.",
|
|
12
|
-
"Okay, I confirm the upgrade to business class for XEHM4B using the card ending in 2135.",
|
|
13
|
-
"I confirm.",
|
|
14
|
-
"I confirm the cabin upgrade to business class for both passengers on flights HAT235 and HAT298.",
|
|
15
|
-
"I already confirmed the name change from Mei Lee to Mei Garcia. Please proceed with updating it.",
|
|
16
|
-
"I’ve already confirmed that FDZ0T5 should be cancelled. Please go ahead and cancel it now.",
|
|
17
|
-
"I understand you're asking for confirmation. I already gave my verbal confirmation earlier.",
|
|
18
|
-
"Upgrade confirmed. Now cancel both reservations: XEHM4B and 59XX6W.",
|
|
19
|
-
"I understand. Please proceed with the upgrade and cancellation for XEHM4B. Could you please handle this?",
|
|
20
|
-
"I already confirmed the cancellation of FDZ0T5 earlier. Should I proceed with PUNERT as well?",
|
|
21
|
-
]
|
|
22
|
-
|
|
23
|
-
HOLDS = [
|
|
24
|
-
"",
|
|
25
|
-
"I",
|
|
26
|
-
"###STOP###",
|
|
27
|
-
"make it two bags",
|
|
28
|
-
"The total cost is $255, which doesn't match the flight price of $103 plus free baggage.",
|
|
29
|
-
"I see the confirmation request. However, there's a discrepancy in the date.",
|
|
30
|
-
"I need to clarify something before confirming. The payment method I prefer is a gift card.",
|
|
31
|
-
"Wait, before I confirm anything, let me clarify: you're asking to cancel all flights?",
|
|
32
|
-
"I'm sorry, but I cannot proceed with the cabin upgrade at this time.",
|
|
33
|
-
"I see the booking is confirmed with a total of $400.",
|
|
34
|
-
"I have successfully booked your flight!",
|
|
35
|
-
"Yes. But make it two bags.",
|
|
36
|
-
"Since I already confirmed yes verbally, could you please proceed with updating my reservation?",
|
|
37
|
-
"I don't have my date of birth in my user profile. Can you please proceed without it?",
|
|
38
|
-
]
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
class Confirms(unittest.TestCase):
|
|
42
|
-
def test_a_confirmation_approves(self):
|
|
43
|
-
for reply in APPROVALS:
|
|
44
|
-
with self.subTest(reply=reply):
|
|
45
|
-
self.assertTrue(confirms(reply))
|
|
46
|
-
|
|
47
|
-
def test_a_change_question_or_dispute_goes_back_to_the_model(self):
|
|
48
|
-
for reply in HOLDS:
|
|
49
|
-
with self.subTest(reply=reply):
|
|
50
|
-
self.assertFalse(confirms(reply))
|
|
51
|
-
|
|
52
|
-
def test_no_reply_holds(self):
|
|
53
|
-
self.assertFalse(confirms(None))
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
if __name__ == "__main__":
|
|
57
|
-
unittest.main()
|
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"""output/venvs/bfcl/bin/python -m unittest test_bfcl_multi_turn, from this folder: no model is loaded.
|
|
2
|
-
|
|
3
|
-
A scripted model plays BFCL's own ground truth through the adapter, so BFCL's checker must pass it;
|
|
4
|
-
the same script with a turn dropped or an argument changed must fail as BFCL fails it.
|
|
5
|
-
"""
|
|
6
|
-
|
|
7
|
-
import ast
|
|
8
|
-
import asyncio
|
|
9
|
-
import itertools
|
|
10
|
-
import unittest
|
|
11
|
-
|
|
12
|
-
import json
|
|
13
|
-
|
|
14
|
-
from bfcl_eval.constants.default_prompts import DEFAULT_USER_PROMPT_FOR_ADDITIONAL_FUNCTION_FC, MAXIMUM_STEP_LIMIT
|
|
15
|
-
from bfcl_eval.eval_checker.multi_turn_eval.multi_turn_utils import execute_multi_turn_func_call
|
|
16
|
-
|
|
17
|
-
from qvac_bench.bfcl_multi_turn import CATEGORIES, Episode, executed, load
|
|
18
|
-
|
|
19
|
-
names = (f"test_{index}" for index in itertools.count())
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def parse(source: str, tools: list[dict]) -> tuple[str, dict]:
|
|
23
|
-
call = ast.parse(source, mode="eval").body
|
|
24
|
-
name = call.func.id
|
|
25
|
-
params = next(tool for tool in tools if tool["name"] == name)["parameters"]["properties"]
|
|
26
|
-
args = dict(zip(params, (ast.literal_eval(arg) for arg in call.args)))
|
|
27
|
-
args.update({keyword.arg: ast.literal_eval(keyword.value) for keyword in call.keywords})
|
|
28
|
-
return name, args
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def scripted(answer: list[list[str]], change=lambda turn, name, args: args, seen=None, refused=None):
|
|
32
|
-
"""A run that makes one turn's ground-truth calls, one round each, and returns the bridge's done frame."""
|
|
33
|
-
turns = iter(answer)
|
|
34
|
-
|
|
35
|
-
async def run(messages, tools, execute):
|
|
36
|
-
if seen is not None:
|
|
37
|
-
seen.append((list(messages), [tool["name"] for tool in tools]))
|
|
38
|
-
turn = next(turns)
|
|
39
|
-
history = []
|
|
40
|
-
if refused:
|
|
41
|
-
history.append({"role": "assistant", "content": "", "toolCalls": [refused]})
|
|
42
|
-
for index, source in enumerate(turn):
|
|
43
|
-
name, args = parse(source, tools)
|
|
44
|
-
args = change(turn, name, args)
|
|
45
|
-
call_id = f"c{index}"
|
|
46
|
-
result = await execute(name, args)
|
|
47
|
-
history.append({"role": "assistant", "content": "", "toolCalls": [{"id": call_id, "name": name, "arguments": args}]})
|
|
48
|
-
history.append({"role": "tool", "toolCallId": call_id, "name": name, "content": result})
|
|
49
|
-
history.append({"role": "assistant", "content": "Done."})
|
|
50
|
-
return {"type": "done", "reply": "Done.", "calls": len(turn), "error": None, "metrics": None, "history": history}
|
|
51
|
-
|
|
52
|
-
return run
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
def play(entry, answer, run):
|
|
56
|
-
return asyncio.run(Episode(entry, answer, next(names)).play(run))
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
def stepping(steps: int):
|
|
60
|
-
"""A run that makes the same call for `steps` rounds every turn."""
|
|
61
|
-
|
|
62
|
-
async def run(messages, tools, execute):
|
|
63
|
-
history = []
|
|
64
|
-
for _ in range(steps):
|
|
65
|
-
await execute("pwd", {})
|
|
66
|
-
history.append({"role": "assistant", "content": "", "toolCalls": [{"id": "c", "name": "pwd", "arguments": {}}]})
|
|
67
|
-
return {"reply": "", "error": None, "metrics": None, "history": history}
|
|
68
|
-
|
|
69
|
-
return run
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
class GroundTruth(unittest.TestCase):
|
|
73
|
-
def test_bfcl_passes_its_own_answers_in_every_category(self):
|
|
74
|
-
for category in CATEGORIES:
|
|
75
|
-
for entry, answer in load(category, 3):
|
|
76
|
-
with self.subTest(entry=entry["id"]):
|
|
77
|
-
self.assertEqual(play(entry, answer, scripted(answer))["valid"], True)
|
|
78
|
-
|
|
79
|
-
def test_a_missed_function_is_offered_only_from_its_turn(self):
|
|
80
|
-
entry, answer = load("multi_turn_miss_func", 1)[0]
|
|
81
|
-
[(turn, [missed])] = entry["missed_function"].items()
|
|
82
|
-
seen = []
|
|
83
|
-
play(entry, answer, scripted(answer, seen=seen))
|
|
84
|
-
|
|
85
|
-
self.assertNotIn(missed["name"], seen[int(turn) - 1][1])
|
|
86
|
-
self.assertIn(missed["name"], seen[int(turn)][1])
|
|
87
|
-
self.assertEqual(seen[int(turn)][0][-1], {"role": "user", "content": DEFAULT_USER_PROMPT_FOR_ADDITIONAL_FUNCTION_FC})
|
|
88
|
-
|
|
89
|
-
def test_each_turn_sees_the_conversation_so_far(self):
|
|
90
|
-
entry, answer = load("multi_turn_base", 1)[0]
|
|
91
|
-
seen = []
|
|
92
|
-
play(entry, answer, scripted(answer, seen=seen))
|
|
93
|
-
|
|
94
|
-
second = seen[1][0]
|
|
95
|
-
self.assertEqual(second[0], entry["question"][0][0])
|
|
96
|
-
self.assertEqual(second[-1], entry["question"][1][0])
|
|
97
|
-
self.assertTrue(any(message.get("toolCalls") for message in second))
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
class Failures(unittest.TestCase):
|
|
101
|
-
def setUp(self):
|
|
102
|
-
self.entry, self.answer = load("multi_turn_base", 1)[0]
|
|
103
|
-
|
|
104
|
-
def test_a_turn_without_its_calls_fails_as_an_empty_turn(self):
|
|
105
|
-
dropped = [self.answer[0], []] + self.answer[2:]
|
|
106
|
-
verdict = play(self.entry, self.answer, scripted(dropped))
|
|
107
|
-
|
|
108
|
-
self.assertEqual(verdict["error_type"], "multi_turn:empty_turn_model_response")
|
|
109
|
-
|
|
110
|
-
def test_a_wrong_argument_fails_on_the_backend_state(self):
|
|
111
|
-
def rename(turn, name, args):
|
|
112
|
-
return {**args, "dir_name": "elsewhere"} if name == "mkdir" else args
|
|
113
|
-
|
|
114
|
-
verdict = play(self.entry, self.answer, scripted(self.answer, rename))
|
|
115
|
-
|
|
116
|
-
self.assertEqual(verdict["error_type"], "multi_turn:instance_state_mismatch")
|
|
117
|
-
|
|
118
|
-
def test_a_harness_error_fails_the_entry_as_bfcl_fails_a_raised_inference(self):
|
|
119
|
-
async def broken(messages, tools, execute):
|
|
120
|
-
return {"reply": "", "error": "context overflow", "metrics": None, "history": []}
|
|
121
|
-
|
|
122
|
-
verdict = play(self.entry, self.answer, broken)
|
|
123
|
-
|
|
124
|
-
self.assertEqual((verdict["error_type"], verdict["error"]), ("multi_turn:inference_error", "context overflow"))
|
|
125
|
-
|
|
126
|
-
def test_a_turn_past_the_step_limit_is_force_terminated(self):
|
|
127
|
-
verdict = play(self.entry, self.answer, stepping(MAXIMUM_STEP_LIMIT + 1))
|
|
128
|
-
|
|
129
|
-
self.assertEqual(verdict["error_type"], "multi_turn:force_terminated")
|
|
130
|
-
|
|
131
|
-
def test_a_turn_at_the_step_limit_is_scored(self):
|
|
132
|
-
verdict = play(self.entry, self.answer, stepping(MAXIMUM_STEP_LIMIT))
|
|
133
|
-
|
|
134
|
-
self.assertNotEqual(verdict["error_type"], "multi_turn:force_terminated")
|
|
135
|
-
|
|
136
|
-
def test_a_call_the_harness_refused_is_not_scored(self):
|
|
137
|
-
cut_off = {"id": "x", "name": "mkdir", "arguments": {"dir_name": "te"}}
|
|
138
|
-
|
|
139
|
-
self.assertTrue(play(self.entry, self.answer, scripted(self.answer, refused=cut_off))["valid"])
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
def test_refused_calls_leave_the_rounds_that_ran_as_steps(self):
|
|
143
|
-
def turn(*calls):
|
|
144
|
-
return {"role": "assistant", "content": "", "toolCalls": [{"id": "x", "name": name, "arguments": args} for name, args in calls]}
|
|
145
|
-
|
|
146
|
-
history = [
|
|
147
|
-
turn(("cd", {"folder": "do"}), ("ls", {"a": "tr"})),
|
|
148
|
-
turn(("cd", {"folder": "document"})),
|
|
149
|
-
turn(("ls", {"a": True})),
|
|
150
|
-
]
|
|
151
|
-
ran = [{"cd": {"folder": "document"}}, {"ls": {"a": True}}]
|
|
152
|
-
|
|
153
|
-
self.assertEqual(executed(history, ran), [[ran[0]], [ran[1]]])
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
class Execution(unittest.TestCase):
|
|
157
|
-
def test_a_call_returns_what_bfcl_sends_the_model(self):
|
|
158
|
-
entry, answer = load("multi_turn_base", 1)[0]
|
|
159
|
-
own, _ = execute_multi_turn_func_call(
|
|
160
|
-
["cd(folder='document')"], entry["initial_config"], entry["involved_classes"], next(names), entry["id"]
|
|
161
|
-
)
|
|
162
|
-
result = asyncio.run(Episode(entry, answer, next(names)).execute("cd", {"folder": "document"}))
|
|
163
|
-
|
|
164
|
-
self.assertEqual(result, json.loads(own[0]), "a JSON result goes out as the object, so it is encoded once")
|
|
165
|
-
|
|
166
|
-
def test_a_text_result_stays_text(self):
|
|
167
|
-
entry, answer = load("multi_turn_base", 1)[0]
|
|
168
|
-
result = asyncio.run(Episode(entry, answer, next(names)).execute("cd", {"path": "document"}))
|
|
169
|
-
|
|
170
|
-
self.assertTrue(result.startswith("Error during execution: "), result)
|
|
171
|
-
|
|
172
|
-
def test_a_long_context_entry_runs_the_long_backend(self):
|
|
173
|
-
def listing(category):
|
|
174
|
-
entry, answer = load(category, 1)[0]
|
|
175
|
-
episode = Episode(entry, answer, next(names))
|
|
176
|
-
asyncio.run(episode.execute("cd", {"folder": "document"}))
|
|
177
|
-
return asyncio.run(episode.execute("ls", {}))
|
|
178
|
-
|
|
179
|
-
base, long = listing("multi_turn_base"), listing("multi_turn_long_context")
|
|
180
|
-
|
|
181
|
-
self.assertGreater(len(long["current_directory_content"]), len(base["current_directory_content"]))
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
if __name__ == "__main__":
|
|
185
|
-
unittest.main()
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
"""python3 -m unittest test_harbor_agent, from this folder: harbor is not needed."""
|
|
2
|
-
|
|
3
|
-
import asyncio
|
|
4
|
-
import json
|
|
5
|
-
import os
|
|
6
|
-
import sys
|
|
7
|
-
import tempfile
|
|
8
|
-
import types
|
|
9
|
-
import unittest
|
|
10
|
-
from unittest import mock
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class BaseAgent:
|
|
14
|
-
def __init__(self, logs_dir, model_name=None, **kwargs):
|
|
15
|
-
self.logs_dir = logs_dir
|
|
16
|
-
self.model_name = model_name
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
for name, attrs in {
|
|
20
|
-
"harbor": {},
|
|
21
|
-
"harbor.agents": {},
|
|
22
|
-
"harbor.agents.base": {"BaseAgent": BaseAgent},
|
|
23
|
-
"harbor.environments": {},
|
|
24
|
-
"harbor.environments.base": {"BaseEnvironment": object},
|
|
25
|
-
"harbor.models": {},
|
|
26
|
-
"harbor.models.agent": {},
|
|
27
|
-
"harbor.models.agent.context": {"AgentContext": object},
|
|
28
|
-
}.items():
|
|
29
|
-
sys.modules.setdefault(name, types.ModuleType(name)).__dict__.update(attrs)
|
|
30
|
-
|
|
31
|
-
from qvac_bench import harbor_agent # noqa: E402
|
|
32
|
-
|
|
33
|
-
DONE = {
|
|
34
|
-
"type": "done",
|
|
35
|
-
"id": "run-0",
|
|
36
|
-
"reply": "Done.",
|
|
37
|
-
"calls": 1,
|
|
38
|
-
"error": None,
|
|
39
|
-
"metrics": {"rounds": [{"promptTokens": 300, "generatedTokens": 20}, {"promptTokens": 50, "generatedTokens": 5}]},
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class FakeBridge:
|
|
44
|
-
runs = []
|
|
45
|
-
results = []
|
|
46
|
-
|
|
47
|
-
def __init__(self, repo, model):
|
|
48
|
-
pass
|
|
49
|
-
|
|
50
|
-
async def start(self):
|
|
51
|
-
pass
|
|
52
|
-
|
|
53
|
-
async def run(self, messages, tools, execute, system=None, max_tool_rounds=None):
|
|
54
|
-
FakeBridge.runs.append(max_tool_rounds)
|
|
55
|
-
FakeBridge.results.append(await execute("bash", {"command": "ls"}))
|
|
56
|
-
return DONE
|
|
57
|
-
|
|
58
|
-
async def close(self):
|
|
59
|
-
pass
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
class Environment:
|
|
63
|
-
async def exec(self, command, timeout_sec=None):
|
|
64
|
-
return types.SimpleNamespace(stdout="a b", stderr="", return_code=0)
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class TimeoutEnvironment:
|
|
68
|
-
async def exec(self, command, timeout_sec=None):
|
|
69
|
-
raise RuntimeError(f"Command timed out after {timeout_sec} seconds")
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def run_agent(environment, max_tool_rounds="40"):
|
|
73
|
-
with tempfile.TemporaryDirectory() as logs, mock.patch.object(harbor_agent, "QvacBridge", FakeBridge), \
|
|
74
|
-
mock.patch.dict(os.environ, {"QVAC_HARNESS_REPO": "/repo"}):
|
|
75
|
-
agent = harbor_agent.QvacHarnessAgent(logs_dir=logs, model_name="m", max_tool_rounds=max_tool_rounds)
|
|
76
|
-
context = types.SimpleNamespace()
|
|
77
|
-
asyncio.run(agent.run("list the files", environment, context))
|
|
78
|
-
with open(os.path.join(logs, "qvac.jsonl")) as log:
|
|
79
|
-
return [json.loads(line) for line in log], context
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
class Agent(unittest.TestCase):
|
|
83
|
-
def setUp(self):
|
|
84
|
-
FakeBridge.runs = []
|
|
85
|
-
FakeBridge.results = []
|
|
86
|
-
|
|
87
|
-
def test_the_round_limit_reaches_the_run_and_the_log_records_it(self):
|
|
88
|
-
rows, context = run_agent(Environment())
|
|
89
|
-
|
|
90
|
-
self.assertEqual(FakeBridge.runs, [40])
|
|
91
|
-
self.assertEqual([row["type"] for row in rows], ["start", "call", "done", "end"])
|
|
92
|
-
self.assertEqual(rows[0]["max_tool_rounds"], 40)
|
|
93
|
-
self.assertEqual(len(rows[0]["load"]), 3)
|
|
94
|
-
self.assertEqual((rows[1]["command"], rows[1]["return_code"]), ("ls", 0))
|
|
95
|
-
self.assertEqual(rows[2], DONE)
|
|
96
|
-
self.assertEqual((context.n_input_tokens, context.n_output_tokens), (350, 25))
|
|
97
|
-
|
|
98
|
-
def test_a_command_timeout_returns_a_failed_result_and_the_trial_goes_on(self):
|
|
99
|
-
rows, _ = run_agent(TimeoutEnvironment())
|
|
100
|
-
|
|
101
|
-
self.assertEqual(FakeBridge.results, [{"stdout": "", "stderr": "Command timed out after 180 seconds", "return_code": 124}])
|
|
102
|
-
self.assertEqual([row["type"] for row in rows], ["start", "call", "done", "end"])
|
|
103
|
-
self.assertEqual((rows[1]["command"], rows[1]["return_code"]), ("ls", 124))
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
if __name__ == "__main__":
|
|
107
|
-
unittest.main()
|
package/bench/bridge/serve.ts
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
// a benchmark in another process drives the harness over stdio: bare bench/bridge/serve.ts
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import process from 'process'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
|
-
import { ensureBundledSkillsDir } from '../../lib/tools/skills/bundled-dir.ts'
|
|
7
|
-
import { openBenchHarness } from '../harness.ts'
|
|
8
|
-
import { Bridge, FRAME, type Inbound, type Outbound } from './bridge.ts'
|
|
9
|
-
|
|
10
|
-
const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
11
|
-
const logFile = process.env.QVAC_BRIDGE_LOG ?? path.join(REPO_ROOT, 'output', 'bridge.log')
|
|
12
|
-
|
|
13
|
-
fs.mkdirSync(path.dirname(logFile), { recursive: true })
|
|
14
|
-
const log = fs.openSync(logFile, 'a')
|
|
15
|
-
// stdout carries the frames; everything the SDK says goes to the log
|
|
16
|
-
console.log =
|
|
17
|
-
console.info =
|
|
18
|
-
console.debug =
|
|
19
|
-
console.warn =
|
|
20
|
-
console.error =
|
|
21
|
-
(...args: unknown[]) => fs.writeSync(log, `${args.map(String).join(' ')}\n`)
|
|
22
|
-
|
|
23
|
-
process.env.QVAC_NO_SKILL_BIN_PROBE = '1'
|
|
24
|
-
const harness = await openBenchHarness({
|
|
25
|
-
root: path.join(REPO_ROOT, 'output', 'bench', 'sdk-root'),
|
|
26
|
-
skillsDir: await ensureBundledSkillsDir()
|
|
27
|
-
})
|
|
28
|
-
const send = (frame: Outbound) => process.stdout.write(`${FRAME}${JSON.stringify(frame)}\n`)
|
|
29
|
-
const bridge = new Bridge((context) => harness.completion(context), send, {
|
|
30
|
-
plan: process.env.QVAC_BRIDGE_PLAN === '1',
|
|
31
|
-
forget: (cacheKey) => harness.deleteKvCache(cacheKey)
|
|
32
|
-
})
|
|
33
|
-
|
|
34
|
-
let buffered = ''
|
|
35
|
-
process.stdin.on('data', (chunk: Uint8Array) => {
|
|
36
|
-
buffered += chunk.toString()
|
|
37
|
-
for (let newline = buffered.indexOf('\n'); newline >= 0; newline = buffered.indexOf('\n')) {
|
|
38
|
-
const line = buffered.slice(0, newline).trim()
|
|
39
|
-
buffered = buffered.slice(newline + 1)
|
|
40
|
-
if (line) {
|
|
41
|
-
receive(JSON.parse(line))
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
process.stdin.on('end', () => {
|
|
46
|
-
harness.close().then(() => process.exit(0))
|
|
47
|
-
})
|
|
48
|
-
send({ type: 'ready' })
|
|
49
|
-
|
|
50
|
-
function receive(frame: Inbound): void {
|
|
51
|
-
bridge.receive(frame).catch((err: unknown) => console.error('[bridge]', err))
|
|
52
|
-
}
|