@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,5 +1,6 @@
|
|
|
1
1
|
import { hasRoundsLeft } from '../guards/retry.js';
|
|
2
|
-
import {
|
|
2
|
+
import { namedChecks } from '../../../helpers/goal-check.js';
|
|
3
|
+
import { activate, applyHistorySplice, applySplice, foldMetrics, goalMet, goalStalled, goalTokensLeft, nudgeWithChecks, nudgeWithPlan, retainFailureResults } from '../rules.js';
|
|
3
4
|
export function startInitialRound({ context, params }) {
|
|
4
5
|
return applyPreparation(context, params);
|
|
5
6
|
}
|
|
@@ -10,13 +11,28 @@ export function startNextRound({ context }) {
|
|
|
10
11
|
...endToolRound(context),
|
|
11
12
|
round: context.round + 1,
|
|
12
13
|
mute: 0,
|
|
14
|
+
cuts: 0,
|
|
13
15
|
narrated: false,
|
|
14
16
|
malformed: false,
|
|
15
17
|
cappedRounds: 0
|
|
16
18
|
};
|
|
17
19
|
}
|
|
18
|
-
export function retryMuteRound(
|
|
19
|
-
|
|
20
|
+
export function retryMuteRound(args) {
|
|
21
|
+
const { context } = args;
|
|
22
|
+
return { ...silentTurn(args), mute: context.mute + 1, round: context.round + 1 };
|
|
23
|
+
}
|
|
24
|
+
function silentTurn({ context, params }) {
|
|
25
|
+
if (params.cutOff) {
|
|
26
|
+
return {};
|
|
27
|
+
}
|
|
28
|
+
return {
|
|
29
|
+
history: [
|
|
30
|
+
...context.history,
|
|
31
|
+
{ role: 'assistant', content: params.response?.trim() ?? '' },
|
|
32
|
+
...continuation(context)
|
|
33
|
+
],
|
|
34
|
+
steering: []
|
|
35
|
+
};
|
|
20
36
|
}
|
|
21
37
|
export function retryNarratedRound({ context, params }) {
|
|
22
38
|
return {
|
|
@@ -44,11 +60,29 @@ export function retryCappedSearch({ context }) {
|
|
|
44
60
|
...endToolRound(context),
|
|
45
61
|
round: context.round + 1,
|
|
46
62
|
mute: 0,
|
|
63
|
+
cuts: 0,
|
|
47
64
|
narrated: false,
|
|
48
65
|
malformed: false,
|
|
49
66
|
cappedRounds: context.cappedRounds + 1
|
|
50
67
|
};
|
|
51
68
|
}
|
|
69
|
+
export function retryCutRound({ context }) {
|
|
70
|
+
return { ...cutTurns(context), cuts: context.cuts + 1, round: context.round + 1 };
|
|
71
|
+
}
|
|
72
|
+
export function wrapCutCompletion({ context }) {
|
|
73
|
+
return { ...cutTurns(context), outcome: 'mute' };
|
|
74
|
+
}
|
|
75
|
+
function cutTurns(context) {
|
|
76
|
+
const said = context.lastRound?.contentText.trim();
|
|
77
|
+
return {
|
|
78
|
+
history: [
|
|
79
|
+
...context.history,
|
|
80
|
+
...(said ? [{ role: 'assistant', content: said }] : []),
|
|
81
|
+
...userTurns(context.steering)
|
|
82
|
+
],
|
|
83
|
+
steering: []
|
|
84
|
+
};
|
|
85
|
+
}
|
|
52
86
|
function closeFailureMemo(context) {
|
|
53
87
|
if (!context.roundProgressed)
|
|
54
88
|
return {};
|
|
@@ -84,6 +118,7 @@ function continueAfterAnswer(context, turns) {
|
|
|
84
118
|
answer: null,
|
|
85
119
|
round: context.round + 1,
|
|
86
120
|
mute: 0,
|
|
121
|
+
cuts: 0,
|
|
87
122
|
narrated: false,
|
|
88
123
|
malformed: false,
|
|
89
124
|
cappedRounds: 0
|
|
@@ -106,7 +141,7 @@ export function addKnowledge({ context, params }) {
|
|
|
106
141
|
};
|
|
107
142
|
}
|
|
108
143
|
export function goalTurn({ policy, goal, plan }) {
|
|
109
|
-
return nudgeWithPlan(`${policy.goalNudge}\nGoal: ${goal?.objective ?? ''}`, plan);
|
|
144
|
+
return nudgeWithChecks(nudgeWithPlan(`${policy.goalNudge}\nGoal: ${goal?.objective ?? ''}`, plan), goal?.checks ?? [], goal?.checkable);
|
|
110
145
|
}
|
|
111
146
|
export function continueGoal({ context }) {
|
|
112
147
|
const { goal } = context;
|
|
@@ -123,7 +158,7 @@ export function settleGoal({ context }) {
|
|
|
123
158
|
return goal ? { goal: { ...goal, status: goalStatus(context) } } : {};
|
|
124
159
|
}
|
|
125
160
|
function goalStatus(context) {
|
|
126
|
-
if (
|
|
161
|
+
if (goalMet(context)) {
|
|
127
162
|
return 'met';
|
|
128
163
|
}
|
|
129
164
|
if (!hasRoundsLeft(context)) {
|
|
@@ -132,7 +167,10 @@ function goalStatus(context) {
|
|
|
132
167
|
if (context.timeUp) {
|
|
133
168
|
return 'time';
|
|
134
169
|
}
|
|
135
|
-
|
|
170
|
+
if (!goalTokensLeft(context)) {
|
|
171
|
+
return 'tokens';
|
|
172
|
+
}
|
|
173
|
+
return goalStalled(context) ? 'stalled' : 'open';
|
|
136
174
|
}
|
|
137
175
|
export function finishRound({ context, params }) {
|
|
138
176
|
const metrics = { ...context.metrics };
|
|
@@ -140,11 +178,14 @@ export function finishRound({ context, params }) {
|
|
|
140
178
|
const historyState = applyHistorySplice(context, params.history);
|
|
141
179
|
return {
|
|
142
180
|
lastRound: { ...params, history: undefined },
|
|
181
|
+
goal: adoptChecks(context.goal, params.contentText),
|
|
143
182
|
roundsSent: context.round + 1,
|
|
144
183
|
cacheKey: params.cacheable === false ? null : context.cacheKey,
|
|
145
184
|
...historyState,
|
|
185
|
+
...settledAfterSend(context, params),
|
|
146
186
|
promptPrefix: params.promptPrefix ?? context.promptPrefix,
|
|
147
|
-
metrics
|
|
187
|
+
metrics,
|
|
188
|
+
steering: params.cut === undefined ? context.steering : [...context.steering, { text: params.cut }]
|
|
148
189
|
};
|
|
149
190
|
}
|
|
150
191
|
export function finishWrapRound({ context, params }) {
|
|
@@ -153,15 +194,36 @@ export function finishWrapRound({ context, params }) {
|
|
|
153
194
|
const historyState = applyHistorySplice(context, params.history);
|
|
154
195
|
return {
|
|
155
196
|
...historyState,
|
|
197
|
+
...settledAfterSend(context, params),
|
|
156
198
|
lastRound: { ...params, history: undefined },
|
|
157
199
|
metrics
|
|
158
200
|
};
|
|
159
201
|
}
|
|
202
|
+
function adoptChecks(goal, text) {
|
|
203
|
+
if (!goal?.checkable || goal.checks.length) {
|
|
204
|
+
return goal;
|
|
205
|
+
}
|
|
206
|
+
const named = namedChecks(text);
|
|
207
|
+
return named.length
|
|
208
|
+
? { ...goal, checks: named.map((name) => ({ name, passed: false, output: null })) }
|
|
209
|
+
: goal;
|
|
210
|
+
}
|
|
211
|
+
function settledAfterSend(context, params) {
|
|
212
|
+
return params.history && params.history.at < context.history.length
|
|
213
|
+
? {
|
|
214
|
+
settledResults: Object.fromEntries(Object.entries(context.settledResults).map(([key, result]) => [
|
|
215
|
+
key,
|
|
216
|
+
{ ...result, folded: true }
|
|
217
|
+
])),
|
|
218
|
+
answeredReads: context.answeredReads?.length ? [] : undefined
|
|
219
|
+
}
|
|
220
|
+
: {};
|
|
221
|
+
}
|
|
160
222
|
export function wrapCompletion({ params }) {
|
|
161
223
|
return { outcome: params };
|
|
162
224
|
}
|
|
163
|
-
export function wrapMuteCompletion(
|
|
164
|
-
return { outcome: 'mute' };
|
|
225
|
+
export function wrapMuteCompletion(args) {
|
|
226
|
+
return { ...silentTurn(args), outcome: 'mute' };
|
|
165
227
|
}
|
|
166
228
|
export function wrapSearchCappedCompletion({ context }) {
|
|
167
229
|
return { ...endToolRound(context), outcome: 'search-capped' };
|
|
@@ -186,7 +248,7 @@ export function answerCompletion({ context, params }) {
|
|
|
186
248
|
: history,
|
|
187
249
|
response: params.response || context.response,
|
|
188
250
|
metrics,
|
|
189
|
-
outcome: 'answered'
|
|
251
|
+
outcome: context.outcome ?? 'answered'
|
|
190
252
|
};
|
|
191
253
|
}
|
|
192
254
|
export function failCompletion({ params }) {
|
|
@@ -213,6 +275,9 @@ export function applyPreparation(context, payload) {
|
|
|
213
275
|
sources: payload?.sources ? [...payload.sources] : context.sources,
|
|
214
276
|
availableTools: payload?.availableTools ? [...payload.availableTools] : context.availableTools,
|
|
215
277
|
promptPrefix: payload?.promptPrefix ?? context.promptPrefix,
|
|
278
|
+
goal: context.goal && payload?.checkable !== undefined
|
|
279
|
+
? { ...context.goal, checkable: payload.checkable }
|
|
280
|
+
: context.goal,
|
|
216
281
|
currentCall: null,
|
|
217
282
|
execution: null,
|
|
218
283
|
rejectedCall: null,
|
|
@@ -17,7 +17,7 @@ export function settlePrepareFailure({ context, params }) {
|
|
|
17
17
|
if (!failure) {
|
|
18
18
|
return {};
|
|
19
19
|
}
|
|
20
|
-
return { ...applyHistorySplice(context, failure.history), prepareStep: null };
|
|
20
|
+
return { ...applyHistorySplice(context, failure.history), cacheKey: null, prepareStep: null };
|
|
21
21
|
}
|
|
22
22
|
export function settlePrepare({ context, params }) {
|
|
23
23
|
return {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { activate, applyHistorySplice, applySplice, recordTool, retainFailureResults } from '../rules.js';
|
|
1
|
+
import { activate, applyHistorySplice, applySplice, cutOffMessage, recordTool, retainFailureResults } from '../rules.js';
|
|
2
2
|
import { failureResultRef, storeFailureResult, toolDeniedResult } from '../../../helpers/failure-result.js';
|
|
3
3
|
import { applyPreparation } from './completion.js';
|
|
4
4
|
export function resolveTools({ context, params }) {
|
|
@@ -34,7 +34,8 @@ export function rejectTool({ context, params }) {
|
|
|
34
34
|
emitCall: rejection.emitCall ?? true,
|
|
35
35
|
emitResult: rejection.emitResult ?? true,
|
|
36
36
|
capped: rejection.capped ?? false,
|
|
37
|
-
source: rejection.source
|
|
37
|
+
source: rejection.source,
|
|
38
|
+
repeat: rejection.repeat
|
|
38
39
|
})
|
|
39
40
|
};
|
|
40
41
|
}
|
|
@@ -96,7 +97,8 @@ function rejectionPayload(payload) {
|
|
|
96
97
|
emitCall: payload.emitCall,
|
|
97
98
|
emitResult: payload.emitResult,
|
|
98
99
|
capped: payload.capped,
|
|
99
|
-
source: payload.source
|
|
100
|
+
source: payload.source,
|
|
101
|
+
repeat: payload.repeat
|
|
100
102
|
};
|
|
101
103
|
}
|
|
102
104
|
export function queueDirectSearch({ context, params }) {
|
|
@@ -147,6 +149,15 @@ function roundResult(context, payload) {
|
|
|
147
149
|
deliveredThisRound: context.deliveredThisRound || payload.delivered === true
|
|
148
150
|
};
|
|
149
151
|
}
|
|
152
|
+
function unchangedRound(context, payload) {
|
|
153
|
+
const folded = payload.settled ? context.settledResults[payload.settled.key]?.folded : undefined;
|
|
154
|
+
return (payload.unchanged === true &&
|
|
155
|
+
!folded &&
|
|
156
|
+
!Object.entries(context.settledResults).some(([key, { repeats, round }]) => key !== payload.settled?.key && round === context.round && repeats > 0));
|
|
157
|
+
}
|
|
158
|
+
function settledSince(settled) {
|
|
159
|
+
return Object.fromEntries(Object.entries(settled).map(([key, result]) => [key, { ...result, repeats: 0 }]));
|
|
160
|
+
}
|
|
150
161
|
function applyToolResult(context, payload, call) {
|
|
151
162
|
const failedCalls = payload.failed
|
|
152
163
|
? {
|
|
@@ -172,13 +183,27 @@ function applyToolResult(context, payload, call) {
|
|
|
172
183
|
? [...context.deniedKeys, payload.deniedKey]
|
|
173
184
|
: context.deniedKeys,
|
|
174
185
|
failedCalls,
|
|
175
|
-
blockedRepeats: context.blockedRepeats + (payload.blockedRepeat ? 1 : 0),
|
|
186
|
+
blockedRepeats: context.blockedRepeats + (payload.blockedRepeat || unchangedRound(context, payload) ? 1 : 0),
|
|
187
|
+
settledResults: payload.settled
|
|
188
|
+
? {
|
|
189
|
+
...(payload.progressed ? settledSince(context.settledResults) : context.settledResults),
|
|
190
|
+
[payload.settled.key]: {
|
|
191
|
+
digest: payload.settled.digest,
|
|
192
|
+
repeats: payload.unchanged
|
|
193
|
+
? (context.settledResults[payload.settled.key]?.repeats ?? 0) + 1
|
|
194
|
+
: 0,
|
|
195
|
+
round: context.round
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
: context.settledResults,
|
|
199
|
+
answeredReads: answeredReads(context, payload),
|
|
176
200
|
roundProgressed: context.roundProgressed || payload.progressed === true,
|
|
177
201
|
webSearches: context.webSearches + (payload.webSearch ? 1 : 0),
|
|
178
202
|
cappedCalls: context.cappedCalls + (payload.searchCapped ? 1 : 0),
|
|
179
203
|
metrics: recordTool(context, call, payload.durationMs),
|
|
180
204
|
activated: activate(context.activated, payload.activate ? [payload.activate] : []),
|
|
181
205
|
plan: payload.plan ?? context.plan,
|
|
206
|
+
goal: applyChecks(context.goal, payload.checked),
|
|
182
207
|
planMode: context.planMode && payload.leftPlanMode !== true,
|
|
183
208
|
pendingCall: null,
|
|
184
209
|
approval: { status: 'idle', key: null },
|
|
@@ -187,6 +212,15 @@ function applyToolResult(context, payload, call) {
|
|
|
187
212
|
rejectedCall: null
|
|
188
213
|
};
|
|
189
214
|
}
|
|
215
|
+
function answeredReads(context, payload) {
|
|
216
|
+
const memo = context.answeredReads ?? [];
|
|
217
|
+
if (payload.stableRead) {
|
|
218
|
+
return payload.settled && !memo.includes(payload.settled.key)
|
|
219
|
+
? [...memo, payload.settled.key]
|
|
220
|
+
: context.answeredReads;
|
|
221
|
+
}
|
|
222
|
+
return payload.durationMs === undefined || !memo.length ? context.answeredReads : [];
|
|
223
|
+
}
|
|
190
224
|
export function rejectRepeatedTool({ params }) {
|
|
191
225
|
const { call, prior } = params;
|
|
192
226
|
return {
|
|
@@ -208,7 +242,7 @@ export function rejectCutOffTool({ context, params }) {
|
|
|
208
242
|
currentCall: params,
|
|
209
243
|
rejectedCall: {
|
|
210
244
|
call: params,
|
|
211
|
-
result: { error: context.policy.
|
|
245
|
+
result: { error: cutOffMessage(context.policy, context.lastRound), guidance: true },
|
|
212
246
|
activity: null,
|
|
213
247
|
emitCall: true,
|
|
214
248
|
emitResult: true,
|
|
@@ -243,3 +277,12 @@ export function rejectPlanModeWrite({ params }) {
|
|
|
243
277
|
}
|
|
244
278
|
};
|
|
245
279
|
}
|
|
280
|
+
function applyChecks(goal, checked) {
|
|
281
|
+
if (!goal || !checked) {
|
|
282
|
+
return goal;
|
|
283
|
+
}
|
|
284
|
+
return {
|
|
285
|
+
...goal,
|
|
286
|
+
checks: goal.checks.map((check) => checked.find(({ name }) => name === check.name) ?? check)
|
|
287
|
+
};
|
|
288
|
+
}
|
|
@@ -15,6 +15,7 @@ export function emptyCompletionContext(opts) {
|
|
|
15
15
|
round: 0,
|
|
16
16
|
roundsSent: 0,
|
|
17
17
|
mute: 0,
|
|
18
|
+
cuts: 0,
|
|
18
19
|
narrated: false,
|
|
19
20
|
malformed: false,
|
|
20
21
|
webSearches: 0,
|
|
@@ -24,6 +25,7 @@ export function emptyCompletionContext(opts) {
|
|
|
24
25
|
deniedKeys: [],
|
|
25
26
|
failedCalls: {},
|
|
26
27
|
blockedRepeats: 0,
|
|
28
|
+
settledResults: {},
|
|
27
29
|
roundProgressed: false,
|
|
28
30
|
answer: null,
|
|
29
31
|
delivered: false,
|
|
@@ -61,7 +63,8 @@ export function emptyCompletionContext(opts) {
|
|
|
61
63
|
objective: opts.goal.objective,
|
|
62
64
|
tokens: opts.goal.tokens ?? null,
|
|
63
65
|
turns: 0,
|
|
64
|
-
status: 'open'
|
|
66
|
+
status: 'open',
|
|
67
|
+
checks: (opts.goal.checks ?? []).map((name) => ({ name, passed: false, output: null }))
|
|
65
68
|
}
|
|
66
69
|
: null
|
|
67
70
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { CompletionContext } from '../types.ts';
|
|
2
2
|
export declare function canMuteRetry(ctx: CompletionContext): boolean;
|
|
3
|
+
export declare function canRetryCut(ctx: CompletionContext): boolean;
|
|
3
4
|
export declare function canRetrySearchCap(ctx: CompletionContext): boolean;
|
|
4
5
|
export declare function repeatsBlocked(ctx: CompletionContext): boolean;
|
|
5
6
|
export declare function hasRoundsLeft(ctx: CompletionContext): boolean;
|
|
@@ -1,12 +1,18 @@
|
|
|
1
|
-
import { MAX_BLOCKED_REPEATS, MAX_CAPPED_ROUNDS, MAX_MUTE_ROUNDS } from '../rules.js';
|
|
1
|
+
import { MAX_BLOCKED_REPEATS, MAX_CAPPED_ROUNDS, MAX_CUT_ROUNDS, MAX_MUTE_ROUNDS, MAX_UNCHANGED_RESULTS } from '../rules.js';
|
|
2
2
|
export function canMuteRetry(ctx) {
|
|
3
3
|
return ctx.mute < MAX_MUTE_ROUNDS && hasRoundsLeft(ctx);
|
|
4
4
|
}
|
|
5
|
+
export function canRetryCut(ctx) {
|
|
6
|
+
return ctx.cuts + 1 < MAX_CUT_ROUNDS && hasRoundsLeft(ctx);
|
|
7
|
+
}
|
|
5
8
|
export function canRetrySearchCap(ctx) {
|
|
6
9
|
return ctx.cappedRounds < MAX_CAPPED_ROUNDS;
|
|
7
10
|
}
|
|
8
11
|
export function repeatsBlocked(ctx) {
|
|
9
|
-
return !ctx.roundProgressed && ctx.blockedRepeats >= MAX_BLOCKED_REPEATS;
|
|
12
|
+
return (!ctx.roundProgressed && ctx.blockedRepeats >= MAX_BLOCKED_REPEATS) || resultStuck(ctx);
|
|
13
|
+
}
|
|
14
|
+
function resultStuck(ctx) {
|
|
15
|
+
return Object.values(ctx.settledResults).some(({ repeats, round }) => round === ctx.round && repeats >= MAX_UNCHANGED_RESULTS);
|
|
10
16
|
}
|
|
11
17
|
export function hasRoundsLeft(ctx) {
|
|
12
18
|
return ctx.round + 1 < ctx.policy.maxToolRounds;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CompletionContext, CompletionMachineEvent, EngineEvent, ToolExecutionSnapshot } from './types.ts';
|
|
1
|
+
import type { CompletionContext, CompletionMachineEvent, EngineEvent, ResolvingOutput, ToolExecutionSnapshot } from './types.ts';
|
|
2
2
|
interface Args {
|
|
3
3
|
context: CompletionContext;
|
|
4
4
|
event: CompletionMachineEvent;
|
|
@@ -13,6 +13,8 @@ export declare const completionGuards: {
|
|
|
13
13
|
noDirectTool: ({ event }: Args) => boolean;
|
|
14
14
|
searchPending: ({ context }: Args) => boolean;
|
|
15
15
|
roundHasToolCalls: ({ event }: Args) => boolean;
|
|
16
|
+
roundCut: ({ context }: Args) => boolean;
|
|
17
|
+
canRetryCut: ({ context }: Args) => boolean;
|
|
16
18
|
malformedToolCall: ({ context, event }: Args) => boolean;
|
|
17
19
|
narratedIntent: ({ context, event }: Args) => boolean;
|
|
18
20
|
hasAnswer: ({ event }: Args) => boolean;
|
|
@@ -20,7 +22,7 @@ export declare const completionGuards: {
|
|
|
20
22
|
hasRoundsLeft: ({ context }: Args) => boolean;
|
|
21
23
|
hasQueuedTool: ({ context }: Args) => boolean;
|
|
22
24
|
repeatOfFailed: ({ context }: Args) => boolean;
|
|
23
|
-
|
|
25
|
+
headCutOff: ({ context }: Args) => boolean;
|
|
24
26
|
readBatchQueued: ({ context }: Args) => boolean;
|
|
25
27
|
batchRan: ({ event }: Args) => boolean;
|
|
26
28
|
toolAnswered: ({ context }: Args) => boolean;
|
|
@@ -41,6 +43,7 @@ export declare const completionGuards: {
|
|
|
41
43
|
stopContinues: ({ event }: Args) => boolean;
|
|
42
44
|
goalUnmet: ({ context }: Args) => boolean;
|
|
43
45
|
goalTokensLeft: ({ context }: Args) => boolean;
|
|
46
|
+
goalStalled: ({ context }: Args) => boolean;
|
|
44
47
|
needsRecovery: ({ event }: Args) => boolean;
|
|
45
48
|
interrupted: ({ event }: Args) => boolean;
|
|
46
49
|
};
|
|
@@ -64,9 +67,11 @@ export declare const completionActions: {
|
|
|
64
67
|
continueGoal: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, EngineEvent>;
|
|
65
68
|
settleGoal: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, EngineEvent>;
|
|
66
69
|
retryMalformedRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").AnsweredPayload, never, never, never, never, never>;
|
|
67
|
-
retryMuteRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent,
|
|
70
|
+
retryMuteRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").AnsweredPayload, never, never, never, never, never>;
|
|
71
|
+
retryCutRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
72
|
+
wrapCutCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
68
73
|
retryNarratedRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").AnsweredPayload, never, never, never, never, never>;
|
|
69
|
-
wrapMuteCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent,
|
|
74
|
+
wrapMuteCompletion: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").AnsweredPayload, never, never, never, never, never>;
|
|
70
75
|
selectNextTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").ResolvedCallSnapshot, never, never, never, never, never>;
|
|
71
76
|
rejectRepeatedTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").RepeatOfFailedCallParams, never, never, never, never, never>;
|
|
72
77
|
rejectCutOffTool: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, import("./types.ts").ResolvedCallSnapshot, never, never, never, never, never>;
|
|
@@ -97,6 +102,7 @@ export declare const completionActions: {
|
|
|
97
102
|
recordRecovery: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
98
103
|
resumeRun: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
99
104
|
ackSteering: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, RoundParams, never, never, never, never, EngineEvent>;
|
|
105
|
+
resetCutRound: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, ResolvingOutput, never, never, never, never, EngineEvent>;
|
|
100
106
|
ackInput: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, EngineEvent>;
|
|
101
107
|
queueInput: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
102
108
|
recordFacts: import("xstate").ActionFunction<CompletionContext, CompletionMachineEvent, CompletionMachineEvent, undefined, never, never, never, never, never>;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { assign, enqueueActions } from 'xstate';
|
|
2
2
|
import { approveCompletion, requestApproval } from './actions/approval.js';
|
|
3
|
-
import { addKnowledge, answerCompletion, continueGoal, continueStop, continueWithInput, failCompletion, finishWrapRound, finishRound, goalTurn, retryCappedSearch, retryMalformedRound, retryMuteRound, retryNarratedRound, settleGoal, startInitialRound, startNextRound, wrapCompletion, wrapDeliveredCompletion, wrapExhaustedCompletion, wrapMuteCompletion, wrapSearchCappedCompletion } from './actions/completion.js';
|
|
3
|
+
import { addKnowledge, answerCompletion, continueGoal, continueStop, continueWithInput, failCompletion, finishWrapRound, finishRound, goalTurn, retryCappedSearch, retryCutRound, retryMalformedRound, retryMuteRound, retryNarratedRound, settleGoal, startInitialRound, startNextRound, wrapCompletion, wrapCutCompletion, wrapDeliveredCompletion, wrapExhaustedCompletion, wrapMuteCompletion, wrapSearchCappedCompletion } from './actions/completion.js';
|
|
4
4
|
import { authorizePrepare, requestPrepare, settlePrepare, settlePrepareFailure } from './actions/prepare.js';
|
|
5
5
|
import { finishBatch, finishDirectTool, finishTool, endRunOnTool, queueDirectSearch, rejectCutOffTool, rejectDeniedApproval, rejectPlanModeWrite, rejectRepeatedTool, rejectTool, resolveTools, selectNextTool, startDirectTool, startTool } from './actions/tools.js';
|
|
6
|
-
import { allResolvedToolsCapped, canMuteRetry, canRetryMalformed, canRetryNarrated, canRetrySearchCap, hasQueuedTool, hasRoundsLeft, repeatsBlocked, searchPending } from './guards/retry.js';
|
|
7
|
-
import { goalTokensLeft, leadingReads,
|
|
6
|
+
import { allResolvedToolsCapped, canMuteRetry, canRetryCut, canRetryMalformed, canRetryNarrated, canRetrySearchCap, hasQueuedTool, hasRoundsLeft, repeatsBlocked, searchPending } from './guards/retry.js';
|
|
7
|
+
import { goalMet, goalStalled, goalTokensLeft, leadingReads, runsUnasked } from './rules.js';
|
|
8
8
|
function output(event) {
|
|
9
9
|
return ('output' in event ? event.output : {});
|
|
10
10
|
}
|
|
@@ -42,9 +42,14 @@ export const completionGuards = {
|
|
|
42
42
|
noDirectTool: ({ event }) => !output(event).directTool,
|
|
43
43
|
searchPending: ({ context }) => searchPending(context),
|
|
44
44
|
roundHasToolCalls: ({ event }) => (output(event).calls?.length ?? 0) > 0,
|
|
45
|
+
roundCut: ({ context }) => context.lastRound?.cut !== undefined,
|
|
46
|
+
canRetryCut: ({ context }) => canRetryCut(context),
|
|
45
47
|
malformedToolCall: ({ context, event }) => canRetryMalformed(context) && Boolean(output(event).malformed),
|
|
46
48
|
narratedIntent: ({ context, event }) => canRetryNarrated(context) && Boolean(output(event).narrated),
|
|
47
|
-
hasAnswer: ({ event }) =>
|
|
49
|
+
hasAnswer: ({ event }) => {
|
|
50
|
+
const { response, cutOff } = output(event);
|
|
51
|
+
return !!response?.trim() && !cutOff;
|
|
52
|
+
},
|
|
48
53
|
canMuteRetry: ({ context }) => canMuteRetry(context),
|
|
49
54
|
hasRoundsLeft: ({ context }) => hasRoundsLeft(context),
|
|
50
55
|
hasQueuedTool: ({ context }) => hasQueuedTool(context),
|
|
@@ -52,7 +57,7 @@ export const completionGuards = {
|
|
|
52
57
|
const next = context.toolQueue[0];
|
|
53
58
|
return Boolean(next && context.failedCalls[next.key]);
|
|
54
59
|
},
|
|
55
|
-
|
|
60
|
+
headCutOff: ({ context }) => Boolean(context.toolQueue[0]?.cutOff),
|
|
56
61
|
readBatchQueued: ({ context }) => leadingReads(context) >= 2,
|
|
57
62
|
batchRan: ({ event }) => (output(event).results?.length ?? 0) > 0,
|
|
58
63
|
toolAnswered: ({ context }) => context.answer !== null,
|
|
@@ -75,8 +80,9 @@ export const completionGuards = {
|
|
|
75
80
|
failedOutcome: ({ context }) => context.outcome === 'failed',
|
|
76
81
|
hasInput: ({ context }) => context.steering.length + context.followUps.length > 0,
|
|
77
82
|
stopContinues: ({ event }) => Boolean(output(event).continue),
|
|
78
|
-
goalUnmet: ({ context }) => context.goal !== null && !
|
|
83
|
+
goalUnmet: ({ context }) => context.goal !== null && !goalMet(context),
|
|
79
84
|
goalTokensLeft: ({ context }) => goalTokensLeft(context),
|
|
85
|
+
goalStalled: ({ context }) => goalStalled(context),
|
|
80
86
|
needsRecovery: ({ event }) => errorOf(event)?.tag === 'recovery',
|
|
81
87
|
interrupted: ({ event }) => errorOf(event)?.tag === 'aborted'
|
|
82
88
|
};
|
|
@@ -101,6 +107,8 @@ export const completionActions = {
|
|
|
101
107
|
settleGoal: goalAction(settleGoal),
|
|
102
108
|
retryMalformedRound: assignAction(retryMalformedRound),
|
|
103
109
|
retryMuteRound: assignAction(retryMuteRound),
|
|
110
|
+
retryCutRound: assignAction(retryCutRound),
|
|
111
|
+
wrapCutCompletion: assignAction(wrapCutCompletion),
|
|
104
112
|
retryNarratedRound: assignAction(retryNarratedRound),
|
|
105
113
|
wrapMuteCompletion: assignAction(wrapMuteCompletion),
|
|
106
114
|
selectNextTool: assignAction(selectNextTool),
|
|
@@ -155,6 +163,16 @@ export const completionActions = {
|
|
|
155
163
|
};
|
|
156
164
|
}),
|
|
157
165
|
ackSteering: ackAction(({ context }, params) => context.steering.map((queued) => inputEvent(context.runId, queued, params.round))),
|
|
166
|
+
resetCutRound: ackAction(({ context }, params) => params.cutOff
|
|
167
|
+
? [
|
|
168
|
+
{
|
|
169
|
+
type: 'round-reset',
|
|
170
|
+
runId: context.runId,
|
|
171
|
+
round: context.round,
|
|
172
|
+
replacedTypes: ['content', 'thinking']
|
|
173
|
+
}
|
|
174
|
+
]
|
|
175
|
+
: []),
|
|
158
176
|
ackInput: ackAction(({ context }) => [...context.steering, ...context.followUps].map((queued) => inputEvent(context.runId, queued, context.round + 1))),
|
|
159
177
|
queueInput: assign(({ context, event }) => {
|
|
160
178
|
if (event.type !== 'INPUT')
|
|
@@ -194,6 +212,9 @@ function goalAction(action) {
|
|
|
194
212
|
if (goal.status === 'open') {
|
|
195
213
|
event.text = goalTurn(context);
|
|
196
214
|
}
|
|
215
|
+
if (goal.checks.length) {
|
|
216
|
+
event.checks = goal.checks.map(({ name }) => name);
|
|
217
|
+
}
|
|
197
218
|
enqueue.emit(event);
|
|
198
219
|
});
|
|
199
220
|
}
|
|
@@ -206,6 +206,9 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
206
206
|
} | {
|
|
207
207
|
type: "requestPrepare";
|
|
208
208
|
params: import("./actions/prepare.ts").RequestPrepareParams;
|
|
209
|
+
} | {
|
|
210
|
+
type: "resetCutRound";
|
|
211
|
+
params: import("./types.ts").ToolsResolvedPayload & import("./types.ts").AnsweredPayload;
|
|
209
212
|
} | {
|
|
210
213
|
type: "resolveTools";
|
|
211
214
|
params: import("./types.ts").ToolsResolvedPayload;
|
|
@@ -215,12 +218,15 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
215
218
|
} | {
|
|
216
219
|
type: "retryCappedSearch";
|
|
217
220
|
params: undefined;
|
|
221
|
+
} | {
|
|
222
|
+
type: "retryCutRound";
|
|
223
|
+
params: undefined;
|
|
218
224
|
} | {
|
|
219
225
|
type: "retryMalformedRound";
|
|
220
226
|
params: import("./types.ts").AnsweredPayload;
|
|
221
227
|
} | {
|
|
222
228
|
type: "retryMuteRound";
|
|
223
|
-
params:
|
|
229
|
+
params: import("./types.ts").AnsweredPayload;
|
|
224
230
|
} | {
|
|
225
231
|
type: "retryNarratedRound";
|
|
226
232
|
params: import("./types.ts").AnsweredPayload;
|
|
@@ -253,6 +259,9 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
253
259
|
} | {
|
|
254
260
|
type: "wrapCompletion";
|
|
255
261
|
params: import("../../contract/run.ts").RunOutcome;
|
|
262
|
+
} | {
|
|
263
|
+
type: "wrapCutCompletion";
|
|
264
|
+
params: undefined;
|
|
256
265
|
} | {
|
|
257
266
|
type: "wrapDeliveredCompletion";
|
|
258
267
|
params: undefined;
|
|
@@ -261,7 +270,7 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
261
270
|
params: undefined;
|
|
262
271
|
} | {
|
|
263
272
|
type: "wrapMuteCompletion";
|
|
264
|
-
params:
|
|
273
|
+
params: import("./types.ts").AnsweredPayload;
|
|
265
274
|
} | {
|
|
266
275
|
type: "wrapSearchCappedCompletion";
|
|
267
276
|
params: undefined;
|
|
@@ -277,6 +286,9 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
277
286
|
} | {
|
|
278
287
|
type: "canMuteRetry";
|
|
279
288
|
params: unknown;
|
|
289
|
+
} | {
|
|
290
|
+
type: "canRetryCut";
|
|
291
|
+
params: unknown;
|
|
280
292
|
} | {
|
|
281
293
|
type: "canRetrySearchCap";
|
|
282
294
|
params: unknown;
|
|
@@ -319,6 +331,9 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
319
331
|
} | {
|
|
320
332
|
type: "failedOutcome";
|
|
321
333
|
params: unknown;
|
|
334
|
+
} | {
|
|
335
|
+
type: "goalStalled";
|
|
336
|
+
params: unknown;
|
|
322
337
|
} | {
|
|
323
338
|
type: "goalTokensLeft";
|
|
324
339
|
params: unknown;
|
|
@@ -337,6 +352,9 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
337
352
|
} | {
|
|
338
353
|
type: "hasRoundsLeft";
|
|
339
354
|
params: unknown;
|
|
355
|
+
} | {
|
|
356
|
+
type: "headCutOff";
|
|
357
|
+
params: unknown;
|
|
340
358
|
} | {
|
|
341
359
|
type: "interrupted";
|
|
342
360
|
params: unknown;
|
|
@@ -374,7 +392,7 @@ declare const createCompletionMachineImplementation: (context?: CompletionContex
|
|
|
374
392
|
type: "repeatsBlocked";
|
|
375
393
|
params: unknown;
|
|
376
394
|
} | {
|
|
377
|
-
type: "
|
|
395
|
+
type: "roundCut";
|
|
378
396
|
params: unknown;
|
|
379
397
|
} | {
|
|
380
398
|
type: "roundHasToolCalls";
|
|
@@ -292,6 +292,16 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
292
292
|
target: 'tools',
|
|
293
293
|
actions: { type: 'resolveTools', params: ({ event }) => event.output }
|
|
294
294
|
},
|
|
295
|
+
{
|
|
296
|
+
guard: and(['roundCut', or(['canRetryCut', 'timeUp'])]),
|
|
297
|
+
target: 'round',
|
|
298
|
+
actions: [nextRoundAck, 'retryCutRound']
|
|
299
|
+
},
|
|
300
|
+
{
|
|
301
|
+
guard: 'roundCut',
|
|
302
|
+
target: 'wrapping',
|
|
303
|
+
actions: [sameRoundAck, 'wrapCutCompletion']
|
|
304
|
+
},
|
|
295
305
|
{
|
|
296
306
|
guard: 'malformedToolCall',
|
|
297
307
|
target: 'round',
|
|
@@ -309,8 +319,21 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
309
319
|
guard: 'hasAnswer',
|
|
310
320
|
target: 'answering'
|
|
311
321
|
},
|
|
312
|
-
{
|
|
313
|
-
|
|
322
|
+
{
|
|
323
|
+
guard: 'canMuteRetry',
|
|
324
|
+
target: 'round',
|
|
325
|
+
actions: [
|
|
326
|
+
{ type: 'resetCutRound', params: ({ event }) => event.output },
|
|
327
|
+
{ type: 'retryMuteRound', params: ({ event }) => event.output }
|
|
328
|
+
]
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
target: 'wrapping',
|
|
332
|
+
actions: [
|
|
333
|
+
{ type: 'resetCutRound', params: ({ event }) => event.output },
|
|
334
|
+
{ type: 'wrapMuteCompletion', params: ({ event }) => event.output }
|
|
335
|
+
]
|
|
336
|
+
}
|
|
314
337
|
]
|
|
315
338
|
}
|
|
316
339
|
},
|
|
@@ -338,7 +361,13 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
338
361
|
]
|
|
339
362
|
},
|
|
340
363
|
{
|
|
341
|
-
guard: and([
|
|
364
|
+
guard: and([
|
|
365
|
+
'goalUnmet',
|
|
366
|
+
'hasRoundsLeft',
|
|
367
|
+
not('timeUp'),
|
|
368
|
+
'goalTokensLeft',
|
|
369
|
+
not('goalStalled')
|
|
370
|
+
]),
|
|
342
371
|
target: 'round',
|
|
343
372
|
actions: [
|
|
344
373
|
{ type: 'answerCompletion', params: ({ event }) => event.output },
|
|
@@ -372,7 +401,7 @@ const createCompletionMachineImplementation = (context, now = noClock) => setup(
|
|
|
372
401
|
selecting: {
|
|
373
402
|
always: [
|
|
374
403
|
{
|
|
375
|
-
guard: and(['hasQueuedTool', '
|
|
404
|
+
guard: and(['hasQueuedTool', 'headCutOff']),
|
|
376
405
|
target: 'rejecting',
|
|
377
406
|
actions: {
|
|
378
407
|
type: 'rejectCutOffTool',
|