@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,84 +0,0 @@
|
|
|
1
|
-
import type { FetchFn } from '../../../../lib/tools/http-request.ts'
|
|
2
|
-
|
|
3
|
-
export const SUFFIXES = ['format=3', '1T', '2T', 'T', 'bare', 'other'] as const
|
|
4
|
-
|
|
5
|
-
export type Suffix = (typeof SUFFIXES)[number]
|
|
6
|
-
|
|
7
|
-
export interface WttrRequest {
|
|
8
|
-
readonly url: string
|
|
9
|
-
readonly host: string
|
|
10
|
-
readonly location: string
|
|
11
|
-
readonly suffix: Suffix
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export interface Fixture {
|
|
15
|
-
readonly status: number
|
|
16
|
-
readonly body: string
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export type Fixtures = Record<string, Fixture>
|
|
20
|
-
|
|
21
|
-
export const FIXTURE_MISS: Fixture = { status: 599, body: 'eval fixture miss' }
|
|
22
|
-
|
|
23
|
-
// one key for fixtures and judging; wttr.in treats `Paris,+Texas`, `Paris+Texas` and `Zürich` alike
|
|
24
|
-
export function wttrRequest(url: URL): WttrRequest {
|
|
25
|
-
const location = decodeURIComponent(url.pathname.slice(1))
|
|
26
|
-
.normalize('NFD')
|
|
27
|
-
.replace(/[\u0300-\u036f]/g, '')
|
|
28
|
-
.replace(/[+,]/g, ' ')
|
|
29
|
-
.replace(/\s+/g, ' ')
|
|
30
|
-
.trim()
|
|
31
|
-
.toLowerCase()
|
|
32
|
-
return { url: url.href, host: url.hostname, location, suffix: suffixOf(url.search.slice(1)) }
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export function wttrKey(request: WttrRequest): string {
|
|
36
|
-
return `${request.location}|${request.suffix}`
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function suffixOf(query: string): Suffix {
|
|
40
|
-
if (query === '') return 'bare'
|
|
41
|
-
return SUFFIXES.find((suffix) => suffix === query) ?? 'other'
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface FakeFetchOptions {
|
|
45
|
-
readonly onServe: (key: string, fixture: Fixture) => void
|
|
46
|
-
readonly onMiss: (key: string) => void
|
|
47
|
-
// present only under --record: a miss is fetched live and kept
|
|
48
|
-
readonly live?: FetchFn | undefined
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// offline, an off-list suffix gets the one-liner: the scorer fails the suffix, the model sees weather
|
|
52
|
-
export function fakeFetch(fixtures: Fixtures, options: FakeFetchOptions): FetchFn {
|
|
53
|
-
return async (url, init) => {
|
|
54
|
-
const request = wttrRequest(url)
|
|
55
|
-
const key = wttrKey(request)
|
|
56
|
-
const offList = request.suffix === 'other' && !options.live
|
|
57
|
-
const known = fixtures[key] ?? (offList ? fixtures[`${request.location}|format=3`] : undefined)
|
|
58
|
-
if (known) {
|
|
59
|
-
options.onServe(key, known)
|
|
60
|
-
return response(known)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (!options.live) {
|
|
64
|
-
options.onMiss(key)
|
|
65
|
-
return response(FIXTURE_MISS)
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
const recorded = await record(options.live, url, init)
|
|
69
|
-
fixtures[key] = recorded
|
|
70
|
-
options.onServe(key, recorded)
|
|
71
|
-
|
|
72
|
-
return response(recorded)
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// wttr.in serves HTML to a browser agent; the product sends an empty one, so recording does too
|
|
77
|
-
async function record(live: FetchFn, url: URL, init: Parameters<FetchFn>[1]): Promise<Fixture> {
|
|
78
|
-
const res = await live(url, { ...init, headers: { ...init.headers, 'user-agent': '' } })
|
|
79
|
-
return { status: res.status, body: await res.text() }
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function response(fixture: Fixture): Awaited<ReturnType<FetchFn>> {
|
|
83
|
-
return { status: fixture.status, headers: { get: () => null }, text: () => fixture.body }
|
|
84
|
-
}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import fs from 'fs'
|
|
2
|
-
import { fileURLToPath } from 'url'
|
|
3
|
-
import { createHttpRequestTool } from '../../../../lib/tools/http-request.ts'
|
|
4
|
-
import type { PackWorld, SkillPack, WorldOptions } from '../../pack.ts'
|
|
5
|
-
import { CASES, SKILL, TICKET_CASE, type Expect } from './cases.ts'
|
|
6
|
-
import { fakeFetch, type Fixture, type Fixtures } from './fixtures.ts'
|
|
7
|
-
import { requested, score } from './score.ts'
|
|
8
|
-
|
|
9
|
-
// any public address: the url guard resolves the host on every call, and the eval is offline
|
|
10
|
-
const WTTR_ADDRESSES = ['5.9.243.187']
|
|
11
|
-
const FIXTURES_PATH = fileURLToPath(new URL('./fixtures/wttr.json', import.meta.url))
|
|
12
|
-
|
|
13
|
-
function world(options: WorldOptions): PackWorld<Expect> {
|
|
14
|
-
const fixtures: Fixtures = JSON.parse(fs.readFileSync(FIXTURES_PATH, 'utf8'))
|
|
15
|
-
const served: Fixture[] = []
|
|
16
|
-
const misses: string[] = []
|
|
17
|
-
const fetch = fakeFetch(fixtures, {
|
|
18
|
-
onServe: (_key, fixture) => served.push(fixture),
|
|
19
|
-
onMiss: (key) => misses.push(key),
|
|
20
|
-
live: options.live
|
|
21
|
-
})
|
|
22
|
-
const http = createHttpRequestTool({
|
|
23
|
-
fetch,
|
|
24
|
-
resolveHost: () => Promise.resolve(WTTR_ADDRESSES)
|
|
25
|
-
})
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
tools: [http],
|
|
29
|
-
reset() {
|
|
30
|
-
served.length = 0
|
|
31
|
-
misses.length = 0
|
|
32
|
-
},
|
|
33
|
-
judge(evalCase, observed) {
|
|
34
|
-
const calls = observed.calls
|
|
35
|
-
.filter((call) => call.name === http.name)
|
|
36
|
-
.map((call) => requested(call.args))
|
|
37
|
-
const verdict = score(evalCase, { calls, served, reply: observed.reply })
|
|
38
|
-
// a wrong call is judged on its own; only a right call the fixtures could not answer is a gap
|
|
39
|
-
const callWrong = verdict.some((failure) => /^(?:calls|host|location|suffix):/.test(failure))
|
|
40
|
-
|
|
41
|
-
return {
|
|
42
|
-
failures: [...misses.map((key) => `fixture miss: ${key}`), ...verdict],
|
|
43
|
-
gap: misses.length > 0 && !callWrong
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
save() {
|
|
47
|
-
const sorted = Object.fromEntries(
|
|
48
|
-
Object.entries(fixtures).sort(([a], [b]) => a.localeCompare(b))
|
|
49
|
-
)
|
|
50
|
-
fs.writeFileSync(FIXTURES_PATH, `${JSON.stringify(sorted, null, 2)}\n`)
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
export const weather: SkillPack<Expect> = { skill: SKILL, focus: TICKET_CASE, cases: CASES, world }
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
import { applyQuery, parseObjectArg } from '../../../../lib/tools/http-request/request.ts'
|
|
2
|
-
import { replyFailures } from '../../laws.ts'
|
|
3
|
-
import { TEMPERATURE, type EvalCase, type Expect } from './cases.ts'
|
|
4
|
-
import { wttrRequest, type Fixture, type WttrRequest } from './fixtures.ts'
|
|
5
|
-
|
|
6
|
-
export interface Observed {
|
|
7
|
-
readonly calls: ReadonlyArray<WttrRequest>
|
|
8
|
-
readonly served: ReadonlyArray<Fixture>
|
|
9
|
-
readonly reply: string
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const WTTR_HOST = 'wttr.in'
|
|
13
|
-
|
|
14
|
-
export function score(evalCase: EvalCase, observed: Observed): string[] {
|
|
15
|
-
return [
|
|
16
|
-
...callFailures(evalCase.expect, observed.calls),
|
|
17
|
-
...replyChecks(evalCase.expect, observed)
|
|
18
|
-
]
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
function callFailures(expect: Expect, calls: ReadonlyArray<WttrRequest>): string[] {
|
|
22
|
-
const failures: string[] = []
|
|
23
|
-
const [min, max] = typeof expect.calls === 'number' ? [expect.calls, expect.calls] : expect.calls
|
|
24
|
-
if (calls.length < min || calls.length > max) {
|
|
25
|
-
failures.push(`calls: ${calls.length}, expected ${min === max ? min : `${min}-${max}`}`)
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
for (const call of calls) {
|
|
29
|
-
if (call.host !== WTTR_HOST) {
|
|
30
|
-
failures.push(`host: ${call.host}`)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (expect.location && !expect.location.includes(call.location)) {
|
|
34
|
-
failures.push(`location: ${call.location}`)
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (expect.suffix && !expect.suffix.includes(call.suffix)) {
|
|
38
|
-
failures.push(`suffix: ${call.suffix}`)
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return failures
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function replyChecks(expect: Expect, observed: Observed): string[] {
|
|
46
|
-
const failures = replyFailures(observed.reply, expect.reply)
|
|
47
|
-
if (failures.length === 1 && failures[0] === 'reply: empty') {
|
|
48
|
-
return failures
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
return expect.echoes ? [...echoFailures(observed), ...failures] : failures
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
// judged as the tool sends it: `query` merged into the url, an unparseable url failing on the host
|
|
55
|
-
export function requested(args: Record<string, unknown>): WttrRequest {
|
|
56
|
-
try {
|
|
57
|
-
const url = new URL(String(args.url))
|
|
58
|
-
const query = parseObjectArg(args.query, 'query')
|
|
59
|
-
if (query.ok && query.value) {
|
|
60
|
-
applyQuery(url, query.value)
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
return wttrRequest(url)
|
|
64
|
-
} catch {
|
|
65
|
-
return { url: String(args.url), host: 'invalid', location: '', suffix: 'other' }
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
// the fixture is the truth, so re-recording on another day never breaks a case
|
|
70
|
-
function echoFailures(observed: Observed): string[] {
|
|
71
|
-
const celsius = observed.served.flatMap((fixture) => temperatures(fixture.body))
|
|
72
|
-
if (celsius.length === 0) {
|
|
73
|
-
return ['echo: no temperature was served']
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
const accepted = [...celsius, ...celsius.map(fahrenheit)]
|
|
77
|
-
const stated = temperatures(observed.reply)
|
|
78
|
-
|
|
79
|
-
return stated.some((value) => accepted.some((known) => Math.abs(known - value) <= 1))
|
|
80
|
-
? []
|
|
81
|
-
: [`echo: reply says ${stated.join(', ') || 'nothing'}, served ${celsius.join(', ')}°C`]
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
function fahrenheit(celsius: number): number {
|
|
85
|
-
return Math.round((celsius * 9) / 5 + 32)
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
function temperatures(text: string): number[] {
|
|
89
|
-
return Array.from(text.matchAll(new RegExp(TEMPERATURE.source, 'gi')), (match) =>
|
|
90
|
-
Number.parseFloat(match[0])
|
|
91
|
-
)
|
|
92
|
-
}
|
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
// prose is a turn the harness preloads the skill into; self-load makes the model fetch it first
|
|
2
|
-
export const ROUTES = ['mention', 'prose', 'self-load'] as const
|
|
3
|
-
|
|
4
|
-
export type Route = (typeof ROUTES)[number]
|
|
5
|
-
|
|
6
|
-
export interface RunRow {
|
|
7
|
-
readonly variant: string
|
|
8
|
-
readonly route: Route
|
|
9
|
-
readonly caseId: string
|
|
10
|
-
readonly category: string
|
|
11
|
-
readonly repeat: number
|
|
12
|
-
readonly passed: boolean
|
|
13
|
-
readonly gap: boolean
|
|
14
|
-
// null when the reply carried no diagram to parse, so it leaves the renders column
|
|
15
|
-
readonly renders: boolean | null
|
|
16
|
-
// the pack's user-facing verdict; null for a pack that has only its laws
|
|
17
|
-
readonly outcome: boolean | null
|
|
18
|
-
readonly failures: ReadonlyArray<string>
|
|
19
|
-
readonly reply: string
|
|
20
|
-
readonly calls: ReadonlyArray<string>
|
|
21
|
-
readonly skillLoaded: boolean
|
|
22
|
-
readonly thinkingChars: number
|
|
23
|
-
// the whole prompt the last round sent, and the share of it the skills index took
|
|
24
|
-
readonly contextTokens: number | null
|
|
25
|
-
readonly skillTokens: number | null
|
|
26
|
-
readonly ttftMs: number | null
|
|
27
|
-
readonly generatedTokens: number | null
|
|
28
|
-
readonly wallMs: number
|
|
29
|
-
readonly error: string | null
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface SummaryOptions {
|
|
33
|
-
readonly focus: string
|
|
34
|
-
readonly categories: ReadonlyArray<string>
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
const CSV_COLUMNS = [
|
|
38
|
-
'variant',
|
|
39
|
-
'route',
|
|
40
|
-
'caseId',
|
|
41
|
-
'category',
|
|
42
|
-
'repeat',
|
|
43
|
-
'passed',
|
|
44
|
-
'gap',
|
|
45
|
-
'renders',
|
|
46
|
-
'outcome',
|
|
47
|
-
'failures',
|
|
48
|
-
'calls',
|
|
49
|
-
'skillLoaded',
|
|
50
|
-
'thinkingChars',
|
|
51
|
-
'contextTokens',
|
|
52
|
-
'skillTokens',
|
|
53
|
-
'ttftMs',
|
|
54
|
-
'generatedTokens',
|
|
55
|
-
'wallMs',
|
|
56
|
-
'error'
|
|
57
|
-
] as const
|
|
58
|
-
|
|
59
|
-
export function toJsonl(rows: ReadonlyArray<RunRow>): string {
|
|
60
|
-
return rows.map((row) => JSON.stringify(row)).join('\n') + '\n'
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function toCsv(rows: ReadonlyArray<RunRow>): string {
|
|
64
|
-
const lines = rows.map((row) => CSV_COLUMNS.map((column) => csvCell(row[column])).join(','))
|
|
65
|
-
return [CSV_COLUMNS.join(','), ...lines].join('\n') + '\n'
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function csvCell(value: unknown): string {
|
|
69
|
-
const text = Array.isArray(value) ? value.join('; ') : String(value ?? '')
|
|
70
|
-
return /[",\n]/.test(text) ? `"${text.replace(/"/g, '""')}"` : text
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
export function summaryMarkdown(rows: ReadonlyArray<RunRow>, options: SummaryOptions): string {
|
|
74
|
-
const variants = unique(rows.map((row) => row.variant))
|
|
75
|
-
const routes = ROUTES.filter((route) => rows.some((row) => row.route === route))
|
|
76
|
-
const cases = unique(rows.map((row) => row.caseId))
|
|
77
|
-
const used = options.categories.filter((category) =>
|
|
78
|
-
rows.some((row) => row.category === category)
|
|
79
|
-
)
|
|
80
|
-
|
|
81
|
-
const header = [
|
|
82
|
-
'variant',
|
|
83
|
-
'route',
|
|
84
|
-
'overall',
|
|
85
|
-
'outcome',
|
|
86
|
-
'renders',
|
|
87
|
-
...used,
|
|
88
|
-
options.focus,
|
|
89
|
-
'ctx tok',
|
|
90
|
-
'skills idx tok',
|
|
91
|
-
'ttft ms',
|
|
92
|
-
'wall ms',
|
|
93
|
-
'gaps',
|
|
94
|
-
'think',
|
|
95
|
-
'errors'
|
|
96
|
-
]
|
|
97
|
-
const summary = variants.flatMap((variant) =>
|
|
98
|
-
routes.map((route) => {
|
|
99
|
-
const mine = rows.filter((row) => row.variant === variant && row.route === route)
|
|
100
|
-
return [
|
|
101
|
-
variant,
|
|
102
|
-
route,
|
|
103
|
-
rate(mine),
|
|
104
|
-
outcomeRate(mine),
|
|
105
|
-
renderRate(mine),
|
|
106
|
-
...used.map((category) => rate(mine.filter((row) => row.category === category))),
|
|
107
|
-
rate(mine.filter((row) => row.caseId === options.focus)),
|
|
108
|
-
mean(mine.map((row) => row.contextTokens)),
|
|
109
|
-
mean(mine.map((row) => row.skillTokens)),
|
|
110
|
-
mean(mine.map((row) => row.ttftMs)),
|
|
111
|
-
mean(mine.map((row) => row.wallMs)),
|
|
112
|
-
String(mine.filter((row) => row.gap).length),
|
|
113
|
-
String(mine.filter((row) => row.thinkingChars > 0).length),
|
|
114
|
-
String(mine.filter((row) => row.error !== null).length)
|
|
115
|
-
]
|
|
116
|
-
})
|
|
117
|
-
)
|
|
118
|
-
|
|
119
|
-
const columns = variants.flatMap((variant) => routes.map((route) => ({ variant, route })))
|
|
120
|
-
const matrixHeader = [
|
|
121
|
-
'case',
|
|
122
|
-
'category',
|
|
123
|
-
...columns.map((column) => `${column.variant}/${column.route}`)
|
|
124
|
-
]
|
|
125
|
-
const matrix = cases.map((caseId) => {
|
|
126
|
-
const mine = rows.filter((row) => row.caseId === caseId)
|
|
127
|
-
return [
|
|
128
|
-
caseId,
|
|
129
|
-
mine[0]?.category ?? '',
|
|
130
|
-
...columns.map((column) =>
|
|
131
|
-
count(mine.filter((row) => row.variant === column.variant && row.route === column.route))
|
|
132
|
-
)
|
|
133
|
-
]
|
|
134
|
-
})
|
|
135
|
-
|
|
136
|
-
return `## Variants\n\n${table(header, summary)}\n\n## Cases\n\n${table(matrixHeader, matrix)}\n`
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// a gap row is an eval defect, not a model result, so it leaves the denominator
|
|
140
|
-
export function rate(rows: ReadonlyArray<RunRow>): string {
|
|
141
|
-
const judged = rows.filter((row) => !row.gap)
|
|
142
|
-
if (judged.length === 0) {
|
|
143
|
-
return '-'
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const passed = judged.filter((row) => row.passed).length
|
|
147
|
-
|
|
148
|
-
return `${Math.round((passed / judged.length) * 100)}% (${passed}/${judged.length})`
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// what the user got, by the pack's own definition; '-' for a pack that defines none
|
|
152
|
-
export function outcomeRate(rows: ReadonlyArray<RunRow>): string {
|
|
153
|
-
const judged = rows.filter((row) => !row.gap && row.outcome !== null)
|
|
154
|
-
if (judged.length === 0) {
|
|
155
|
-
return '-'
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
const good = judged.filter((row) => row.outcome).length
|
|
159
|
-
|
|
160
|
-
return `${Math.round((good / judged.length) * 100)}% (${good}/${judged.length})`
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// a diagram that does not parse shows as unavailable; a reply with no diagram leaves the denominator
|
|
164
|
-
export function renderRate(rows: ReadonlyArray<RunRow>): string {
|
|
165
|
-
const drawn = rows.filter((row) => !row.gap && row.renders !== null)
|
|
166
|
-
if (drawn.length === 0) {
|
|
167
|
-
return '-'
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
const parsed = drawn.filter((row) => row.renders).length
|
|
171
|
-
|
|
172
|
-
return `${Math.round((parsed / drawn.length) * 100)}% (${parsed}/${drawn.length})`
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
function count(rows: ReadonlyArray<RunRow>): string {
|
|
176
|
-
const judged = rows.filter((row) => !row.gap)
|
|
177
|
-
return judged.length === 0 ? '-' : `${judged.filter((row) => row.passed).length}/${judged.length}`
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function mean(values: ReadonlyArray<number | null>): string {
|
|
181
|
-
const known = values.filter((value): value is number => value !== null)
|
|
182
|
-
return known.length === 0
|
|
183
|
-
? '-'
|
|
184
|
-
: String(Math.round(known.reduce((a, b) => a + b, 0) / known.length))
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
function unique<T>(values: ReadonlyArray<T>): T[] {
|
|
188
|
-
return [...new Set(values)]
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
function table(header: ReadonlyArray<string>, body: ReadonlyArray<ReadonlyArray<string>>): string {
|
|
192
|
-
const line = (cells: ReadonlyArray<string>) => `| ${cells.join(' | ')} |`
|
|
193
|
-
return [line(header), line(header.map(() => '---')), ...body.map(line)].join('\n')
|
|
194
|
-
}
|