@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
package/bench/bfcl/data.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import path from 'path'
|
|
3
|
-
import fetch from '#fetch'
|
|
4
|
-
import type { Message } from '../../lib/contract/index.ts'
|
|
5
|
-
import type { Answer, FunctionDoc } from './checker.ts'
|
|
6
|
-
|
|
7
|
-
// the gorilla commit the data and the checker port were read from
|
|
8
|
-
export const BFCL_COMMIT = '6ea57973c7a6097fd7c5915698c54c17c5b1b6c8'
|
|
9
|
-
const BFCL_DATA = `https://raw.githubusercontent.com/ShishirPatil/gorilla/${BFCL_COMMIT}/berkeley-function-call-leaderboard/bfcl_eval/data`
|
|
10
|
-
|
|
11
|
-
// the single-turn categories BFCL scores by AST; multi-turn, memory and web search need executors
|
|
12
|
-
export const CATEGORIES = [
|
|
13
|
-
'simple_python',
|
|
14
|
-
'multiple',
|
|
15
|
-
'parallel',
|
|
16
|
-
'parallel_multiple',
|
|
17
|
-
'irrelevance',
|
|
18
|
-
'live_simple',
|
|
19
|
-
'live_multiple',
|
|
20
|
-
'live_parallel',
|
|
21
|
-
'live_parallel_multiple',
|
|
22
|
-
'live_irrelevance',
|
|
23
|
-
'live_relevance'
|
|
24
|
-
]
|
|
25
|
-
|
|
26
|
-
// the params the #157 stopgap rewrites, keyed as sdkProperty keys them
|
|
27
|
-
export const SHAPES = ['nested', 'default-only', 'untouched'] as const
|
|
28
|
-
export type Shape = (typeof SHAPES)[number]
|
|
29
|
-
|
|
30
|
-
export function shapeOf(functions: readonly FunctionDoc[]): Shape {
|
|
31
|
-
const params = functions.flatMap((doc) => Object.values(doc.parameters.properties))
|
|
32
|
-
if (params.some((param) => param.properties || param.items)) {
|
|
33
|
-
return 'nested'
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return params.some((param) => param.default !== undefined) ? 'default-only' : 'untouched'
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface BfclCase {
|
|
40
|
-
readonly id: string
|
|
41
|
-
readonly category: string
|
|
42
|
-
readonly turns: Message[]
|
|
43
|
-
readonly functions: FunctionDoc[]
|
|
44
|
-
readonly answers: Answer[] | null
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export interface LoadOptions {
|
|
48
|
-
readonly dir: string
|
|
49
|
-
// cases per category, spread evenly across it
|
|
50
|
-
readonly limit: number
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export async function loadCategory(category: string, options: LoadOptions): Promise<BfclCase[]> {
|
|
54
|
-
const entries = await lines(`BFCL_v4_${category}.json`, options.dir)
|
|
55
|
-
// relevance and irrelevance are judged by whether a call was made, so they ship no answers
|
|
56
|
-
const answers = category.includes('relevance')
|
|
57
|
-
? new Map()
|
|
58
|
-
: new Map(
|
|
59
|
-
(await lines(`possible_answer/BFCL_v4_${category}.json`, options.dir)).map((entry) => [
|
|
60
|
-
entry.id,
|
|
61
|
-
entry.ground_truth
|
|
62
|
-
])
|
|
63
|
-
)
|
|
64
|
-
const all = entries.map((entry): BfclCase => ({
|
|
65
|
-
id: entry.id,
|
|
66
|
-
category,
|
|
67
|
-
turns: entry.question[0],
|
|
68
|
-
functions: entry.function,
|
|
69
|
-
answers: answers.get(entry.id) ?? null
|
|
70
|
-
}))
|
|
71
|
-
const step = Math.max(1, Math.floor(all.length / Math.min(options.limit, all.length)))
|
|
72
|
-
|
|
73
|
-
return all.filter((_, index) => index % step === 0).slice(0, options.limit)
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
async function lines(file: string, dir: string) {
|
|
77
|
-
const local = path.join(dir, file)
|
|
78
|
-
if (!fs.existsSync(local)) {
|
|
79
|
-
const response = await fetch(`${BFCL_DATA}/${file}`)
|
|
80
|
-
if (!response.ok) {
|
|
81
|
-
throw new Error(`BFCL ${file}: HTTP ${response.status}`)
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
fs.mkdirSync(path.dirname(local), { recursive: true })
|
|
85
|
-
fs.writeFileSync(local, await response.text())
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
return fs
|
|
89
|
-
.readFileSync(local, 'utf8')
|
|
90
|
-
.split('\n')
|
|
91
|
-
.filter(Boolean)
|
|
92
|
-
.map((line) => JSON.parse(line))
|
|
93
|
-
}
|
package/bench/bfcl/observe.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
CompletionEvent,
|
|
3
|
-
LlmGenerationParams,
|
|
4
|
-
MetricsEvent
|
|
5
|
-
} from '../../lib/contract/index.ts'
|
|
6
|
-
import { errorMessage } from '../../lib/guards.ts'
|
|
7
|
-
import type { Call } from './checker.ts'
|
|
8
|
-
|
|
9
|
-
export interface Made {
|
|
10
|
-
readonly first: Call[]
|
|
11
|
-
readonly all: Call[]
|
|
12
|
-
readonly reply: string
|
|
13
|
-
readonly error: string | null
|
|
14
|
-
readonly metrics: MetricsEvent | null
|
|
15
|
-
readonly firstCallRound: number | null
|
|
16
|
-
// what the second round was sent, where a re-ask is forced
|
|
17
|
-
readonly reaskParams: LlmGenerationParams | null
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface Observing {
|
|
21
|
-
readonly original: (name: string) => string
|
|
22
|
-
readonly stop: () => void
|
|
23
|
-
// distinct calls that end the run; null ends it with the first round instead
|
|
24
|
-
readonly enough: number | null
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export async function observe(
|
|
28
|
-
events: AsyncIterable<CompletionEvent>,
|
|
29
|
-
observing: Observing
|
|
30
|
-
): Promise<Made> {
|
|
31
|
-
const { original, stop, enough } = observing
|
|
32
|
-
const first: Call[] = []
|
|
33
|
-
const all: Call[] = []
|
|
34
|
-
let firstRound: number | undefined
|
|
35
|
-
let doneRound: number | undefined
|
|
36
|
-
let stopped = false
|
|
37
|
-
let reply = ''
|
|
38
|
-
let error: string | null = null
|
|
39
|
-
let metrics: MetricsEvent | null = null
|
|
40
|
-
let reaskParams: LlmGenerationParams | null = null
|
|
41
|
-
try {
|
|
42
|
-
for await (const event of events) {
|
|
43
|
-
if (event.type === 'metrics') {
|
|
44
|
-
metrics = event
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// a stopped run is drained, not left, so its speed still arrives; the rest is not scored
|
|
48
|
-
if (stopped) {
|
|
49
|
-
continue
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// stop only at a round boundary, so every call of the round that finished the work is seen
|
|
53
|
-
if (doneRound !== undefined && (event.round ?? doneRound) > doneRound) {
|
|
54
|
-
stopped = true
|
|
55
|
-
stop()
|
|
56
|
-
continue
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// a script's own calls arrive as tool calls of the same round, so they are the ones scored
|
|
60
|
-
if (event.type === 'tool-call' && event.name !== 'run_code') {
|
|
61
|
-
firstRound ??= event.round
|
|
62
|
-
record(
|
|
63
|
-
{ [original(event.name)]: event.args },
|
|
64
|
-
event.round === firstRound ? first : null,
|
|
65
|
-
all
|
|
66
|
-
)
|
|
67
|
-
doneRound ??= enough === null || all.length >= enough ? event.round : undefined
|
|
68
|
-
} else if (event.type === 'content' && firstRound === undefined) {
|
|
69
|
-
reply += event.text
|
|
70
|
-
} else if (event.type === 'error') {
|
|
71
|
-
error = event.message
|
|
72
|
-
} else if (event.type === 'aborted') {
|
|
73
|
-
error = 'aborted'
|
|
74
|
-
} else if (event.type === 'inference-call' && event.call.round === 1) {
|
|
75
|
-
reaskParams ??= event.call.generationParams ?? null
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
} catch (err) {
|
|
79
|
-
if (!stopped) {
|
|
80
|
-
error = errorMessage(err)
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
return { first, all, reply, error, metrics, firstCallRound: firstRound ?? null, reaskParams }
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// a repeat of the same call is one call to BFCL, not a second
|
|
88
|
-
function record(call: Call, first: Call[] | null, all: Call[]): void {
|
|
89
|
-
first?.push(call)
|
|
90
|
-
if (!all.some((seen) => JSON.stringify(seen) === JSON.stringify(call))) {
|
|
91
|
-
all.push(call)
|
|
92
|
-
}
|
|
93
|
-
}
|
package/bench/bfcl/run.ts
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
// BFCL v4 single-turn categories through Harness.completion, scored by the ported AST checker
|
|
2
|
-
import fs from 'fs'
|
|
3
|
-
import path from 'path'
|
|
4
|
-
import process from 'process'
|
|
5
|
-
import { fileURLToPath } from 'url'
|
|
6
|
-
import { AbortController } from 'bare-abort-controller'
|
|
7
|
-
import type { Harness } from '../../index.ts'
|
|
8
|
-
import type { AgentConfig, LlmGenerationParams } from '../../lib/contract/index.ts'
|
|
9
|
-
import { QWEN_35_4B } from '../../lib/models/model-catalog-constants.ts'
|
|
10
|
-
import { ensureBundledSkillsDir } from '../../lib/tools/skills/bundled-dir.ts'
|
|
11
|
-
import { openBenchHarness } from '../harness.ts'
|
|
12
|
-
import { speedOf, type Speed } from '../speed.ts'
|
|
13
|
-
import { check, type Call, type Verdict } from './checker.ts'
|
|
14
|
-
import {
|
|
15
|
-
BFCL_COMMIT,
|
|
16
|
-
CATEGORIES,
|
|
17
|
-
loadCategory,
|
|
18
|
-
shapeOf,
|
|
19
|
-
type BfclCase,
|
|
20
|
-
type Shape
|
|
21
|
-
} from './data.ts'
|
|
22
|
-
import { observe } from './observe.ts'
|
|
23
|
-
import { caseTools } from './tools.ts'
|
|
24
|
-
|
|
25
|
-
const REPO_ROOT = fileURLToPath(new URL('../..', import.meta.url))
|
|
26
|
-
const REASONING_MODES = ['disabled', 'enabled', 'inherit'] as const
|
|
27
|
-
|
|
28
|
-
const USAGE = `usage: bare bench/bfcl/run.ts [options]
|
|
29
|
-
--categories <a,b> default ${CATEGORIES.join(',')}
|
|
30
|
-
--models <a,b> default ${QWEN_35_4B}
|
|
31
|
-
--limit <n> cases per category, spread evenly across it; default all
|
|
32
|
-
--timeout <ms> per case, default 120000
|
|
33
|
-
--reasoning <mode> disabled|enabled|inherit, default inherit
|
|
34
|
-
--out <dir> default output/bfcl/<stamp>
|
|
35
|
-
`
|
|
36
|
-
|
|
37
|
-
interface CaseRow {
|
|
38
|
-
readonly model: string
|
|
39
|
-
readonly category: string
|
|
40
|
-
readonly id: string
|
|
41
|
-
readonly shape: Shape
|
|
42
|
-
// BFCL's rule: every call in the model's first response
|
|
43
|
-
readonly valid: boolean
|
|
44
|
-
readonly error: string | null
|
|
45
|
-
// the harness asks for one action at a time, so parallel calls are credited across the run's rounds
|
|
46
|
-
readonly wholeValid: boolean
|
|
47
|
-
readonly wholeError: string | null
|
|
48
|
-
readonly calls: Call[]
|
|
49
|
-
readonly firstCallRound: number | null
|
|
50
|
-
readonly reaskParams: LlmGenerationParams | null
|
|
51
|
-
readonly reply: string
|
|
52
|
-
readonly wallMs: number
|
|
53
|
-
readonly speed: Speed | null
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const argv = process.argv.slice(2)
|
|
57
|
-
if (argv.includes('--help')) {
|
|
58
|
-
console.log(USAGE)
|
|
59
|
-
process.exit(0)
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
const flag = (name: string): string | undefined => {
|
|
63
|
-
const index = argv.indexOf(`--${name}`)
|
|
64
|
-
return index >= 0 ? argv[index + 1] : undefined
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
const categories = flag('categories')?.split(',') ?? CATEGORIES
|
|
68
|
-
const models = flag('models')?.split(',') ?? [QWEN_35_4B]
|
|
69
|
-
const limit = flag('limit') === undefined ? Infinity : Number(flag('limit'))
|
|
70
|
-
const timeoutMs = Number(flag('timeout') ?? 120_000)
|
|
71
|
-
const reasoning = REASONING_MODES.find((mode) => mode === flag('reasoning')) ?? 'inherit'
|
|
72
|
-
const stamp = new Date().toISOString().replace(/[:.]/g, '-')
|
|
73
|
-
const outDir = flag('out') ?? path.join(REPO_ROOT, 'output', 'bfcl', stamp)
|
|
74
|
-
const dataDir = path.join(REPO_ROOT, 'output', 'bfcl-data', BFCL_COMMIT)
|
|
75
|
-
|
|
76
|
-
fs.mkdirSync(outDir, { recursive: true })
|
|
77
|
-
const say = (line: string) => process.stdout.write(`${line}\n`)
|
|
78
|
-
// the SDK and addons print whole prompts through console; keep them out of the progress lines
|
|
79
|
-
const log = fs.openSync(path.join(outDir, 'bench.log'), 'a')
|
|
80
|
-
console.log =
|
|
81
|
-
console.info =
|
|
82
|
-
console.debug =
|
|
83
|
-
console.warn =
|
|
84
|
-
console.error =
|
|
85
|
-
(...args: unknown[]) => fs.writeSync(log, `${args.map(String).join(' ')}\n`)
|
|
86
|
-
|
|
87
|
-
process.env.QVAC_NO_SKILL_BIN_PROBE = '1'
|
|
88
|
-
const loaded = await Promise.all(
|
|
89
|
-
categories.map((category) => loadCategory(category, { dir: dataDir, limit }))
|
|
90
|
-
)
|
|
91
|
-
const cases = loaded.flat()
|
|
92
|
-
const harness = await openBenchHarness({
|
|
93
|
-
root: path.join(REPO_ROOT, 'output', 'bench', 'sdk-root'),
|
|
94
|
-
skillsDir: await ensureBundledSkillsDir()
|
|
95
|
-
})
|
|
96
|
-
say(`${cases.length} BFCL cases × ${models.length} models → ${outDir}`)
|
|
97
|
-
|
|
98
|
-
const rows: CaseRow[] = []
|
|
99
|
-
for (const model of models) {
|
|
100
|
-
for (const bfclCase of cases) {
|
|
101
|
-
const row = await runCase(harness, bfclCase, model)
|
|
102
|
-
rows.push(row)
|
|
103
|
-
fs.appendFileSync(path.join(outDir, 'runs.jsonl'), `${JSON.stringify(row)}\n`)
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
const own = rows.filter((row) => row.model === model)
|
|
107
|
-
say(`${model}: strict ${rate(own, strictly)} · across rounds ${rate(own, wholly)}`)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
fs.writeFileSync(path.join(outDir, 'summary.md'), summary(rows))
|
|
111
|
-
say(`\n${summary(rows)}\nwritten to ${outDir}`)
|
|
112
|
-
await harness.close()
|
|
113
|
-
|
|
114
|
-
async function runCase(host: Harness, bfclCase: BfclCase, model: string): Promise<CaseRow> {
|
|
115
|
-
const { tools, original } = caseTools(bfclCase.functions)
|
|
116
|
-
const system = bfclCase.turns.filter((turn) => turn.role === 'system')
|
|
117
|
-
// only the case's functions: no product tool, no skill
|
|
118
|
-
const agent: AgentConfig = {
|
|
119
|
-
id: 'bfcl',
|
|
120
|
-
toolsScope: 'selected',
|
|
121
|
-
enabledTools: [
|
|
122
|
-
...tools.map((tool) => tool.name),
|
|
123
|
-
...(process.env.QVAC_BENCH_CODE_MODE === '1' ? ['run_code'] : [])
|
|
124
|
-
],
|
|
125
|
-
skillsScope: 'selected',
|
|
126
|
-
enabledSkills: [],
|
|
127
|
-
bio: system.length ? system.map((turn) => turn.content).join('\n\n') : undefined,
|
|
128
|
-
reasoning
|
|
129
|
-
}
|
|
130
|
-
const controller = new AbortController()
|
|
131
|
-
const deadline = setTimeout(() => controller.abort(new Error('deadline')), timeoutMs)
|
|
132
|
-
const started = Date.now()
|
|
133
|
-
// only parallel work is credited past the first round, so other runs stop when the second begins
|
|
134
|
-
const across = bfclCase.category.includes('parallel')
|
|
135
|
-
const made = await observe(
|
|
136
|
-
host.completion({
|
|
137
|
-
model,
|
|
138
|
-
agent,
|
|
139
|
-
messages: bfclCase.turns.filter((turn) => turn.role !== 'system'),
|
|
140
|
-
tools,
|
|
141
|
-
cacheKey: `bfcl-${stamp}-${model}-${bfclCase.id}`,
|
|
142
|
-
captureInferenceCalls: true,
|
|
143
|
-
signal: controller.signal
|
|
144
|
-
}),
|
|
145
|
-
{
|
|
146
|
-
original,
|
|
147
|
-
stop: () => controller.abort(new Error('scored')),
|
|
148
|
-
// a parallel run is done once it has made every call BFCL expects; the rest after one round
|
|
149
|
-
enough: across ? (bfclCase.answers?.length ?? 0) : null
|
|
150
|
-
}
|
|
151
|
-
)
|
|
152
|
-
clearTimeout(deadline)
|
|
153
|
-
|
|
154
|
-
const subject = {
|
|
155
|
-
category: bfclCase.category,
|
|
156
|
-
docs: bfclCase.functions,
|
|
157
|
-
answers: bfclCase.answers
|
|
158
|
-
}
|
|
159
|
-
const score = (calls: Call[]): Verdict =>
|
|
160
|
-
made.error && !calls.length ? { valid: false, error: made.error } : check(subject, calls)
|
|
161
|
-
const strict = score(made.first)
|
|
162
|
-
// only parallel work can span rounds; a later call elsewhere is the model reacting to a stub result
|
|
163
|
-
const whole = across ? score(made.all) : strict
|
|
164
|
-
|
|
165
|
-
return {
|
|
166
|
-
model,
|
|
167
|
-
category: bfclCase.category,
|
|
168
|
-
id: bfclCase.id,
|
|
169
|
-
shape: shapeOf(bfclCase.functions),
|
|
170
|
-
valid: strict.valid,
|
|
171
|
-
error: strict.error,
|
|
172
|
-
wholeValid: whole.valid,
|
|
173
|
-
wholeError: whole.error,
|
|
174
|
-
calls: made.all,
|
|
175
|
-
firstCallRound: made.firstCallRound,
|
|
176
|
-
reaskParams: made.reaskParams,
|
|
177
|
-
reply: made.reply.slice(0, 500),
|
|
178
|
-
wallMs: Date.now() - started,
|
|
179
|
-
speed: speedOf(made.metrics)
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
function strictly(row: CaseRow): boolean {
|
|
184
|
-
return row.valid
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function wholly(row: CaseRow): boolean {
|
|
188
|
-
return row.wholeValid
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function rate(rows: readonly CaseRow[], passed: (row: CaseRow) => boolean): string {
|
|
192
|
-
const count = rows.filter(passed).length
|
|
193
|
-
|
|
194
|
-
return `${count}/${rows.length} (${Math.round((count / Math.max(1, rows.length)) * 100)}%)`
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function summary(all: readonly CaseRow[]): string {
|
|
198
|
-
const names = [...new Set(all.map((row) => row.model))]
|
|
199
|
-
const header = names.map((model) => `${model} strict | ${model} across rounds`).join(' | ')
|
|
200
|
-
const lines = [
|
|
201
|
-
`| category | ${header} |`,
|
|
202
|
-
`| --- | ${names.map(() => '--- | ---').join(' | ')} |`
|
|
203
|
-
]
|
|
204
|
-
for (const category of categories) {
|
|
205
|
-
const cells = names.map((model) => {
|
|
206
|
-
const own = all.filter((row) => row.model === model && row.category === category)
|
|
207
|
-
return `${rate(own, strictly)} | ${rate(own, wholly)}`
|
|
208
|
-
})
|
|
209
|
-
lines.push(`| ${category} | ${cells.join(' | ')} |`)
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
return lines.join('\n') + '\n'
|
|
213
|
-
}
|
package/bench/bfcl/tools.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
ToolDefinition,
|
|
3
|
-
ToolParameterSchema,
|
|
4
|
-
ToolParameterType,
|
|
5
|
-
ToolParameters
|
|
6
|
-
} from '../../lib/contract/index.ts'
|
|
7
|
-
import type { FunctionDoc, ParamDoc } from './checker.ts'
|
|
8
|
-
|
|
9
|
-
const TYPES: Record<string, ToolParameterType> = {
|
|
10
|
-
dict: 'object',
|
|
11
|
-
float: 'number',
|
|
12
|
-
tuple: 'array',
|
|
13
|
-
any: 'string',
|
|
14
|
-
integer: 'integer',
|
|
15
|
-
string: 'string',
|
|
16
|
-
boolean: 'boolean',
|
|
17
|
-
array: 'array'
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export interface CaseTools {
|
|
21
|
-
readonly tools: ToolDefinition[]
|
|
22
|
-
// the name a model saw back to BFCL's, which may carry dots
|
|
23
|
-
original(name: string): string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
// dots become underscores as BFCL's own function-calling handlers rename them for providers
|
|
27
|
-
export function caseTools(docs: readonly FunctionDoc[]): CaseTools {
|
|
28
|
-
const names = new Map(docs.map((doc) => [toolName(doc.name), doc.name]))
|
|
29
|
-
return {
|
|
30
|
-
tools: docs.map((doc): ToolDefinition => ({
|
|
31
|
-
name: toolName(doc.name),
|
|
32
|
-
toolset: null,
|
|
33
|
-
description: doc.description,
|
|
34
|
-
parameters: parameters(doc.parameters),
|
|
35
|
-
// the answer is the call itself; an intent field would be a parameter BFCL never asked for
|
|
36
|
-
autoApprove: true,
|
|
37
|
-
effect: () => 'read',
|
|
38
|
-
execute: () => Promise.resolve({ ok: true })
|
|
39
|
-
})),
|
|
40
|
-
original: (name) => names.get(name) ?? name
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function toolName(name: string): string {
|
|
45
|
-
return name.replace(/[^\w-]/g, '_')
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function parameters(doc: FunctionDoc['parameters']): ToolParameters {
|
|
49
|
-
return {
|
|
50
|
-
type: 'object',
|
|
51
|
-
properties: Object.fromEntries(
|
|
52
|
-
Object.entries(doc.properties).map(([key, value]) => [key, schema(value)])
|
|
53
|
-
),
|
|
54
|
-
required: [...(doc.required ?? [])]
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function schema(doc: ParamDoc): ToolParameterSchema {
|
|
59
|
-
return {
|
|
60
|
-
type: TYPES[doc.type] ?? 'string',
|
|
61
|
-
description: doc.description,
|
|
62
|
-
enum: doc.enum?.map(String),
|
|
63
|
-
items: doc.items ? schema(doc.items) : undefined,
|
|
64
|
-
properties: doc.properties
|
|
65
|
-
? Object.fromEntries(
|
|
66
|
-
Object.entries(doc.properties).map(([key, value]) => [key, schema(value)])
|
|
67
|
-
)
|
|
68
|
-
: undefined,
|
|
69
|
-
required: doc.required ? [...doc.required] : undefined,
|
|
70
|
-
default: doc.default
|
|
71
|
-
}
|
|
72
|
-
}
|