@qvac/harness 1.0.0-rc.2 → 1.0.0-rc.21
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 +3073 -1485
- package/README.md +110 -46
- package/dist-lib/index.d.ts +63 -16
- package/dist-lib/index.js +232 -38
- 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 +11 -2
- package/dist-lib/lib/agent/resolve.js +30 -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 +2 -0
- package/dist-lib/lib/agent/tools.js +2 -1
- package/dist-lib/lib/capabilities/agent-ports.d.ts +1 -1
- package/dist-lib/lib/capabilities/agent-ports.js +11 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +2 -2
- 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/execute.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +132 -13
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +11 -5
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +54 -10
- 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 +12 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +142 -50
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +78 -20
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +33 -16
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +38 -23
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +50 -12
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +80 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.d.ts +5 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +101 -41
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +56 -17
- package/dist-lib/lib/capabilities/completion-engine/driver.js +58 -15
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +3 -1
- package/dist-lib/lib/capabilities/completion-engine/durable.js +12 -2
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/engine.js +14 -1
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +5 -1
- package/dist-lib/lib/capabilities/completion-engine/index.js +5 -2
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +26 -3
- package/dist-lib/lib/capabilities/completion-engine/loop.js +14 -2
- 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 +63 -0
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +99 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.js +30 -10
- package/dist-lib/lib/capabilities/completion-engine/ports.js +6 -9
- package/dist-lib/lib/capabilities/completion-engine/prepare-step.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +38 -6
- package/dist-lib/lib/capabilities/completion-engine/round.js +395 -118
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +12 -4
- package/dist-lib/lib/capabilities/completion-engine/session.js +31 -2
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +5 -2
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +8 -43
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +32 -141
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.js +42 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.d.ts +43 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.js +91 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-sets.d.ts +24 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-sets.js +15 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +17 -9
- package/dist-lib/lib/capabilities/completion-engine/turns.js +98 -86
- package/dist-lib/lib/capabilities/detect-language.d.ts +2 -1
- package/dist-lib/lib/capabilities/detect-language.js +14 -2
- package/dist-lib/lib/capabilities/download.d.ts +10 -8
- 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 +23 -11
- package/dist-lib/lib/capabilities/kv-cache.d.ts +1 -1
- 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/prompt-prefix.d.ts +3 -1
- package/dist-lib/lib/capabilities/prompt-prefix.js +8 -0
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +13 -4
- package/dist-lib/lib/capabilities/sdk-tool.js +59 -7
- package/dist-lib/lib/capabilities/skill-entry.d.ts +13 -1
- package/dist-lib/lib/capabilities/skill-entry.js +33 -2
- package/dist-lib/lib/capabilities/tool-failed-note.d.ts +1 -0
- package/dist-lib/lib/capabilities/tool-failed-note.js +1 -0
- package/dist-lib/lib/capabilities/tool-plan.d.ts +5 -1
- package/dist-lib/lib/capabilities/tool-plan.js +20 -5
- package/dist-lib/lib/capabilities/tool-prompt-log.d.ts +1 -1
- package/dist-lib/lib/capabilities/tool-prompt-log.js +3 -3
- package/dist-lib/lib/capabilities/tool-turns/attachments.d.ts +7 -0
- package/dist-lib/lib/capabilities/tool-turns/attachments.js +39 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.d.ts +13 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.js +29 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.d.ts +22 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.js +120 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.d.ts +6 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.js +32 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.d.ts +9 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.js +71 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +8 -43
- package/dist-lib/lib/capabilities/tool-turns.js +6 -253
- package/dist-lib/lib/capabilities/usage-breakdown.d.ts +1 -0
- package/dist-lib/lib/capabilities/usage-breakdown.js +4 -1
- package/dist-lib/lib/client/index.d.ts +19 -0
- package/dist-lib/lib/client/index.js +263 -0
- package/dist-lib/lib/connect/abort.d.ts +6 -0
- package/dist-lib/lib/connect/abort.js +52 -0
- package/dist-lib/lib/connect/bridges.d.ts +21 -0
- package/dist-lib/lib/connect/bridges.js +185 -0
- package/dist-lib/lib/connect/decode.d.ts +31 -0
- package/dist-lib/lib/connect/decode.js +114 -0
- package/dist-lib/lib/connect/host-run-log.d.ts +16 -0
- package/dist-lib/lib/connect/host-run-log.js +74 -0
- package/dist-lib/lib/connect/served.d.ts +7 -0
- package/dist-lib/lib/connect/served.js +45 -0
- package/dist-lib/lib/connect.d.ts +20 -11
- package/dist-lib/lib/connect.js +178 -415
- package/dist-lib/lib/context-window.d.ts +13 -5
- package/dist-lib/lib/context-window.js +19 -6
- package/dist-lib/lib/contract/agent.d.ts +25 -4
- package/dist-lib/lib/contract/completion.d.ts +82 -32
- package/dist-lib/lib/contract/drive.d.ts +130 -0
- package/dist-lib/lib/contract/drive.js +1 -0
- package/dist-lib/lib/contract/egress-proxy.d.ts +13 -0
- package/dist-lib/lib/contract/egress-proxy.js +1 -0
- package/dist-lib/lib/contract/exec.d.ts +4 -3
- package/dist-lib/lib/contract/hooks.d.ts +4 -1
- package/dist-lib/lib/contract/index.d.ts +4 -0
- package/dist-lib/lib/contract/knowledge.d.ts +10 -0
- package/dist-lib/lib/contract/managed-skills.d.ts +1 -0
- package/dist-lib/lib/contract/managed-skills.js +1 -0
- package/dist-lib/lib/contract/media.d.ts +58 -0
- package/dist-lib/lib/contract/media.js +1 -0
- package/dist-lib/lib/contract/models.d.ts +12 -6
- package/dist-lib/lib/contract/ocr.d.ts +17 -0
- package/dist-lib/lib/contract/ocr.js +1 -0
- 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 +28 -3
- package/dist-lib/lib/contract/sandbox.d.ts +3 -1
- package/dist-lib/lib/contract/speech.d.ts +1 -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 +48 -16
- 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 +278 -0
- package/dist-lib/lib/errors.js +212 -0
- package/dist-lib/lib/fold/index.d.ts +26 -1
- package/dist-lib/lib/fold/index.js +76 -9
- package/dist-lib/lib/guarded-fetch.js +11 -7
- package/dist-lib/lib/guards.d.ts +2 -0
- package/dist-lib/lib/guards.js +7 -0
- package/dist-lib/lib/hardware/capability-probe.js +10 -7
- package/dist-lib/lib/hardware/cpu-placement.d.ts +8 -0
- package/dist-lib/lib/hardware/cpu-placement.js +48 -0
- package/dist-lib/lib/hardware/gpu-probe-addon.js +26 -11
- package/dist-lib/lib/hardware/gpu-probe.js +10 -1
- package/dist-lib/lib/hardware/gpu-stats.native.cjs +17 -1
- package/dist-lib/lib/helpers/completion-params.d.ts +7 -2
- package/dist-lib/lib/helpers/completion-params.js +26 -2
- package/dist-lib/lib/helpers/control-tokens.d.ts +3 -0
- package/dist-lib/lib/helpers/control-tokens.js +25 -0
- 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/asks.d.ts +25 -0
- package/dist-lib/lib/helpers/goal-check/asks.js +52 -0
- package/dist-lib/lib/helpers/goal-check/checks.d.ts +8 -0
- package/dist-lib/lib/helpers/goal-check/checks.js +92 -0
- package/dist-lib/lib/helpers/goal-check/commands.d.ts +7 -0
- package/dist-lib/lib/helpers/goal-check/commands.js +130 -0
- package/dist-lib/lib/helpers/goal-check/paths.d.ts +5 -0
- package/dist-lib/lib/helpers/goal-check/paths.js +44 -0
- package/dist-lib/lib/helpers/goal-check/shell.d.ts +9 -0
- package/dist-lib/lib/helpers/goal-check/shell.js +96 -0
- package/dist-lib/lib/helpers/goal-check.d.ts +36 -0
- package/dist-lib/lib/helpers/goal-check.js +35 -0
- package/dist-lib/lib/helpers/head-tail.js +1 -1
- package/dist-lib/lib/helpers/html-helpers.js +9 -6
- 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/recent-map.d.ts +7 -0
- package/dist-lib/lib/helpers/recent-map.js +23 -0
- package/dist-lib/lib/helpers/repeated-reply.js +24 -16
- package/dist-lib/lib/helpers/require-peers.d.ts +3 -0
- package/dist-lib/lib/helpers/require-peers.js +23 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +2 -0
- package/dist-lib/lib/helpers/run-outcome.js +6 -2
- package/dist-lib/lib/helpers/spawn-path.d.ts +1 -0
- package/dist-lib/lib/helpers/spawn-path.js +2 -1
- package/dist-lib/lib/helpers/thinking.d.ts +3 -2
- package/dist-lib/lib/helpers/thinking.js +19 -0
- package/dist-lib/lib/helpers/tool-call-markup/emit.d.ts +6 -0
- package/dist-lib/lib/helpers/tool-call-markup/emit.js +15 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.d.ts +22 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.js +130 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.d.ts +3 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.js +56 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.d.ts +4 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.js +149 -0
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +19 -24
- package/dist-lib/lib/helpers/tool-call-markup.js +17 -343
- 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 +15 -16
- package/dist-lib/lib/machine/completion/actions/completion.js +164 -107
- package/dist-lib/lib/machine/completion/actions/goal.d.ts +10 -0
- package/dist-lib/lib/machine/completion/actions/goal.js +93 -0
- package/dist-lib/lib/machine/completion/actions/prepare.js +3 -2
- package/dist-lib/lib/machine/completion/actions/reject-tool.d.ts +16 -0
- package/dist-lib/lib/machine/completion/actions/reject-tool.js +147 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.d.ts +6 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.js +50 -0
- package/dist-lib/lib/machine/completion/actions/rounds.d.ts +5 -0
- package/dist-lib/lib/machine/completion/actions/rounds.js +31 -0
- package/dist-lib/lib/machine/completion/actions/tools.d.ts +1 -16
- package/dist-lib/lib/machine/completion/actions/tools.js +111 -140
- package/dist-lib/lib/machine/completion/context.js +11 -1
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +3 -1
- package/dist-lib/lib/machine/completion/guards/retry.js +9 -2
- package/dist-lib/lib/machine/completion/implementations.d.ts +18 -9
- package/dist-lib/lib/machine/completion/implementations.js +64 -16
- package/dist-lib/lib/machine/completion/machine.d.ts +38 -9
- package/dist-lib/lib/machine/completion/machine.js +58 -9
- package/dist-lib/lib/machine/completion/metrics.d.ts +25 -0
- package/dist-lib/lib/machine/completion/metrics.js +68 -0
- package/dist-lib/lib/machine/completion/nudges.d.ts +5 -0
- package/dist-lib/lib/machine/completion/nudges.js +33 -0
- package/dist-lib/lib/machine/completion/rules.d.ts +19 -27
- package/dist-lib/lib/machine/completion/rules.js +48 -79
- package/dist-lib/lib/machine/completion/splice.d.ts +9 -0
- package/dist-lib/lib/machine/completion/splice.js +19 -0
- package/dist-lib/lib/machine/completion/types.d.ts +81 -14
- package/dist-lib/lib/machine/index.d.ts +50 -11
- package/dist-lib/lib/machine/index.js +12 -2
- package/dist-lib/lib/media-host.d.ts +12 -0
- package/dist-lib/lib/media-host.js +52 -0
- package/dist-lib/lib/media-port.d.ts +20 -0
- package/dist-lib/lib/media-port.js +77 -0
- package/dist-lib/lib/media-wire.d.ts +8 -0
- package/dist-lib/lib/media-wire.js +111 -0
- package/dist-lib/lib/models/context-choice.d.ts +15 -0
- package/dist-lib/lib/models/context-choice.js +62 -0
- package/dist-lib/lib/models/context.d.ts +1 -1
- package/dist-lib/lib/models/custom-model-cache.d.ts +1 -0
- package/dist-lib/lib/models/custom-model-cache.js +3 -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 +11 -0
- package/dist-lib/lib/models/gguf-header.js +203 -15
- package/dist-lib/lib/models/gpu-selection.d.ts +6 -1
- package/dist-lib/lib/models/gpu-selection.js +29 -5
- package/dist-lib/lib/models/kv-cache.d.ts +2 -0
- package/dist-lib/lib/models/kv-cache.js +8 -0
- package/dist-lib/lib/models/llm-presets.d.ts +6 -1
- package/dist-lib/lib/models/llm-presets.js +33 -6
- package/dist-lib/lib/models/load-requests.d.ts +9 -0
- package/dist-lib/lib/models/load-requests.js +42 -0
- 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-constants.d.ts +2 -2
- package/dist-lib/lib/models/model-catalog-constants.js +3 -4
- package/dist-lib/lib/models/model-catalog.d.ts +7 -3
- package/dist-lib/lib/models/model-catalog.js +44 -11
- package/dist-lib/lib/models/model-delete.d.ts +1 -1
- package/dist-lib/lib/models/model-fit.d.ts +2 -2
- package/dist-lib/lib/models/model-fit.js +5 -6
- package/dist-lib/lib/models/model-handle.d.ts +9 -2
- package/dist-lib/lib/models/model-handle.js +14 -3
- package/dist-lib/lib/models/model-list.d.ts +9 -2
- package/dist-lib/lib/models/model-list.js +23 -0
- package/dist-lib/lib/models/model-pool.d.ts +42 -7
- package/dist-lib/lib/models/model-pool.js +139 -49
- package/dist-lib/lib/models/model-source.d.ts +3 -2
- package/dist-lib/lib/models/model-source.js +23 -5
- package/dist-lib/lib/models/opencl-cache.js +2 -2
- 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/models/tool-dialect.d.ts +1 -1
- package/dist-lib/lib/models/tts-model-default.d.ts +2 -1
- package/dist-lib/lib/models/tts-model-default.js +8 -6
- package/dist-lib/lib/no-redirect-fetch-bare.js +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.d.ts +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +46 -8
- 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 +64 -21
- package/dist-lib/lib/office/engine/pptx/types.d.ts +1 -0
- package/dist-lib/lib/office/engine/xlsx/sheet.js +10 -4
- 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 +15 -0
- package/dist-lib/lib/plugins/registry.js +91 -22
- package/dist-lib/lib/plugins/require-bare.d.ts +1 -0
- package/dist-lib/lib/plugins/require-bare.js +13 -0
- package/dist-lib/lib/policy/index.d.ts +11 -0
- package/dist-lib/lib/policy/index.js +235 -0
- package/dist-lib/lib/prompt.d.ts +9 -4
- package/dist-lib/lib/prompt.js +95 -32
- package/dist-lib/lib/residency/completion-runtime.d.ts +17 -6
- package/dist-lib/lib/residency/completion-runtime.js +91 -37
- package/dist-lib/lib/residency/index.d.ts +59 -6
- package/dist-lib/lib/residency/index.js +444 -42
- package/dist-lib/lib/resolution-detector.js +3 -3
- package/dist-lib/lib/round-host.d.ts +12 -0
- package/dist-lib/lib/round-host.js +57 -0
- package/dist-lib/lib/round-port.d.ts +24 -0
- package/dist-lib/lib/round-port.js +81 -0
- package/dist-lib/lib/rpc-session.js +2 -1
- package/dist-lib/lib/run-log/redact.js +7 -7
- package/dist-lib/lib/run-log/request-codec.js +2 -2
- package/dist-lib/lib/sdk-loader.d.ts +1 -1
- package/dist-lib/lib/sdk-loader.js +47 -17
- package/dist-lib/lib/sdk-storage.d.ts +1 -0
- package/dist-lib/lib/sdk-storage.js +18 -2
- package/dist-lib/lib/serve/completion.d.ts +7 -0
- package/dist-lib/lib/serve/completion.js +553 -0
- package/dist-lib/lib/serve/downloads.d.ts +4 -0
- package/dist-lib/lib/serve/downloads.js +79 -0
- package/dist-lib/lib/serve/models.d.ts +5 -0
- package/dist-lib/lib/serve/models.js +120 -0
- package/dist-lib/lib/serve/noop.d.ts +1 -0
- package/dist-lib/lib/serve/noop.js +1 -0
- package/dist-lib/lib/serve/requests.d.ts +147 -0
- package/dist-lib/lib/serve/requests.js +1 -0
- package/dist-lib/lib/serve/rounds.d.ts +11 -0
- package/dist-lib/lib/serve/rounds.js +67 -0
- package/dist-lib/lib/serve/run-log-start.d.ts +38 -0
- package/dist-lib/lib/serve/run-log-start.js +254 -0
- package/dist-lib/lib/serve/skills.d.ts +32 -0
- package/dist-lib/lib/serve/skills.js +46 -0
- package/dist-lib/lib/serve.d.ts +5 -1
- package/dist-lib/lib/serve.js +51 -916
- package/dist-lib/lib/sidecar/index.d.ts +39 -0
- package/dist-lib/lib/sidecar/index.js +205 -0
- package/dist-lib/lib/sidecar/user-plugins.d.ts +9 -0
- package/dist-lib/lib/sidecar/user-plugins.js +119 -0
- package/dist-lib/lib/skills-host/index.d.ts +7 -3
- package/dist-lib/lib/skills-host/index.js +47 -22
- package/dist-lib/lib/spawn.d.ts +6 -4
- package/dist-lib/lib/spawn.js +22 -20
- package/dist-lib/lib/spill.d.ts +1 -0
- package/dist-lib/lib/spill.js +12 -8
- package/dist-lib/lib/tools/ask-user.d.ts +2 -0
- package/dist-lib/lib/tools/ask-user.js +137 -0
- package/dist-lib/lib/tools/attachments/delivered.d.ts +5 -0
- package/dist-lib/lib/tools/attachments/delivered.js +16 -0
- package/dist-lib/lib/tools/attachments/fetched-file.d.ts +32 -0
- package/dist-lib/lib/tools/attachments/fetched-file.js +134 -0
- package/dist-lib/lib/tools/attachments/staging.d.ts +1 -0
- package/dist-lib/lib/tools/attachments/staging.js +19 -8
- package/dist-lib/lib/tools/exec/runner.d.ts +4 -0
- package/dist-lib/lib/tools/exec/runner.js +20 -2
- 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 +89 -27
- package/dist-lib/lib/tools/files/edit-file.d.ts +6 -0
- package/dist-lib/lib/tools/files/edit-file.js +266 -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 +212 -0
- package/dist-lib/lib/tools/files/index.d.ts +3 -0
- package/dist-lib/lib/tools/files/index.js +25 -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 +224 -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 +8 -0
- package/dist-lib/lib/tools/fs/document-text.js +22 -0
- package/dist-lib/lib/tools/fs/drive.d.ts +5 -25
- package/dist-lib/lib/tools/fs/drive.js +9 -1
- package/dist-lib/lib/tools/fs/edit-match.d.ts +33 -0
- package/dist-lib/lib/tools/fs/edit-match.js +445 -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 +2 -40
- package/dist-lib/lib/tools/fs/remote-protocol.js +1 -1
- package/dist-lib/lib/tools/fs/remote.d.ts +3 -11
- package/dist-lib/lib/tools/fs/remote.js +24 -14
- package/dist-lib/lib/tools/fs/scope.d.ts +4 -15
- package/dist-lib/lib/tools/fs/scope.js +5 -2
- package/dist-lib/lib/tools/fs/search.d.ts +25 -0
- package/dist-lib/lib/tools/fs/search.js +383 -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 +14 -5
- package/dist-lib/lib/tools/fs/walk.js +119 -24
- package/dist-lib/lib/tools/http-request/request.d.ts +4 -2
- package/dist-lib/lib/tools/http-request/request.js +2 -1
- package/dist-lib/lib/tools/http-request/truncate-response.d.ts +16 -1
- package/dist-lib/lib/tools/http-request/truncate-response.js +56 -11
- package/dist-lib/lib/tools/http-request.d.ts +1 -0
- package/dist-lib/lib/tools/http-request.js +101 -16
- package/dist-lib/lib/tools/index.d.ts +4 -1
- package/dist-lib/lib/tools/index.js +8 -12
- package/dist-lib/lib/tools/office/ops.d.ts +1 -0
- package/dist-lib/lib/tools/office/ops.js +5 -1
- package/dist-lib/lib/tools/office.d.ts +2 -1
- package/dist-lib/lib/tools/office.js +273 -56
- package/dist-lib/lib/tools/operations/builders.d.ts +4 -3
- package/dist-lib/lib/tools/operations/builders.js +41 -3
- package/dist-lib/lib/tools/operations/calendar-range.d.ts +16 -0
- package/dist-lib/lib/tools/operations/calendar-range.js +40 -0
- package/dist-lib/lib/tools/operations/compile.js +8 -6
- package/dist-lib/lib/tools/operations/manifest.d.ts +4 -0
- package/dist-lib/lib/tools/pdf/build.d.ts +17 -3
- package/dist-lib/lib/tools/pdf/build.js +77 -16
- package/dist-lib/lib/tools/pdf/pages.d.ts +12 -0
- package/dist-lib/lib/tools/pdf/pages.js +31 -0
- package/dist-lib/lib/tools/pdf/recognize.d.ts +13 -0
- package/dist-lib/lib/tools/pdf/recognize.js +55 -0
- package/dist-lib/lib/tools/pdf/request.d.ts +3 -8
- package/dist-lib/lib/tools/pdf/request.js +4 -4
- package/dist-lib/lib/tools/pdf.d.ts +0 -1
- package/dist-lib/lib/tools/pdf.js +56 -13
- package/dist-lib/lib/tools/skill.js +23 -11
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +8 -1
- package/dist-lib/lib/tools/skills/bundled-dir.js +42 -36
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +1 -0
- package/dist-lib/lib/tools/skills/bundled-hash.js +4 -1
- package/dist-lib/lib/tools/skills/catalog-loader.d.ts +12 -0
- package/dist-lib/lib/tools/skills/catalog-loader.js +173 -0
- package/dist-lib/lib/tools/skills/catalog.d.ts +7 -8
- package/dist-lib/lib/tools/skills/catalog.js +1 -158
- 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-check.d.ts +1 -0
- package/dist-lib/lib/tools/skills/credential-check.js +3 -0
- package/dist-lib/lib/tools/skills/credential-health.js +3 -3
- package/dist-lib/lib/tools/skills/frontmatter-parser.d.ts +3 -0
- package/dist-lib/lib/tools/skills/frontmatter-parser.js +5 -0
- package/dist-lib/lib/tools/skills/index.d.ts +1 -0
- package/dist-lib/lib/tools/skills/index.js +1 -0
- package/dist-lib/lib/tools/skills/manifest-parse.d.ts +1 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +39 -3
- package/dist-lib/lib/tools/skills/manifest.d.ts +1 -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.d.ts +3 -3
- package/dist-lib/lib/tools/skills/overlay-crud.js +7 -6
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +2 -2
- package/dist-lib/lib/tools/skills/overlay-watch.js +4 -3
- package/dist-lib/lib/tools/skills/scope-key.d.ts +1 -0
- package/dist-lib/lib/tools/skills/scope-key.js +4 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.d.ts +1 -0
- package/dist-lib/lib/tools/skills/skill-state-constants.js +4 -0
- package/dist-lib/lib/tools/skills/skill-tree.d.ts +5 -0
- package/dist-lib/lib/tools/skills/skill-tree.js +54 -0
- 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 +50 -133
- package/dist-lib/lib/wire/download.d.ts +10 -0
- package/dist-lib/lib/wire/download.js +35 -0
- package/dist-lib/lib/wire/event.d.ts +41 -0
- package/dist-lib/lib/wire/event.js +306 -0
- package/dist-lib/lib/wire/fields.d.ts +3 -0
- package/dist-lib/lib/wire/fields.js +12 -0
- package/dist-lib/lib/wire/knowledge.d.ts +9 -0
- package/dist-lib/lib/wire/knowledge.js +68 -0
- package/dist-lib/lib/wire/round.d.ts +14 -0
- package/dist-lib/lib/wire/round.js +45 -0
- package/dist-lib/lib/wire/vectors.d.ts +6 -0
- package/dist-lib/lib/wire/vectors.js +33 -0
- package/dist-lib/lib/wire.d.ts +28 -64
- package/dist-lib/lib/wire.js +24 -417
- package/dist-lib/plugins/coding/index.d.ts +1 -1
- package/dist-lib/plugins/coding/index.js +2 -4
- package/dist-lib/plugins/coding/read-only.d.ts +1 -0
- package/dist-lib/plugins/coding/read-only.js +264 -0
- package/dist-lib/plugins/coding/session.d.ts +6 -4
- package/dist-lib/plugins/coding/session.js +45 -16
- package/dist-lib/plugins/coding-guards/index.d.ts +25 -0
- package/dist-lib/plugins/coding-guards/index.js +126 -0
- 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 +184 -0
- package/dist-lib/plugins/image/edit-image.d.ts +3 -22
- package/dist-lib/plugins/image/edit-image.js +23 -46
- package/dist-lib/plugins/image/fit.d.ts +31 -0
- package/dist-lib/plugins/image/fit.js +28 -0
- package/dist-lib/plugins/image/generate-image.d.ts +27 -6
- package/dist-lib/plugins/image/generate-image.js +201 -74
- package/dist-lib/plugins/image/index.d.ts +2 -1
- package/dist-lib/plugins/image/index.js +29 -12
- package/dist-lib/plugins/knowledge/index.d.ts +3 -0
- package/dist-lib/plugins/knowledge/index.js +5 -0
- package/dist-lib/plugins/knowledge/manifest.d.ts +53 -0
- package/dist-lib/plugins/knowledge/manifest.js +86 -0
- package/dist-lib/plugins/knowledge/search-tool.js +8 -8
- package/dist-lib/plugins/knowledge/store.d.ts +45 -8
- package/dist-lib/plugins/knowledge/store.js +428 -166
- package/dist-lib/plugins/language-hint/index.d.ts +15 -0
- package/dist-lib/plugins/language-hint/index.js +54 -0
- package/dist-lib/plugins/lsp/tool.js +2 -2
- package/dist-lib/plugins/mcp/call.js +15 -4
- package/dist-lib/plugins/mcp/index.js +6 -3
- package/dist-lib/plugins/mcp/protocol.d.ts +10 -2
- package/dist-lib/plugins/mcp/protocol.js +13 -12
- package/dist-lib/plugins/mcp/server.js +1 -1
- package/dist-lib/plugins/mcp/tool-listing.d.ts +6 -0
- package/dist-lib/plugins/mcp/tool-listing.js +97 -0
- package/dist-lib/plugins/music/generate-music.d.ts +24 -5
- package/dist-lib/plugins/music/generate-music.js +170 -64
- package/dist-lib/plugins/music/index.d.ts +2 -1
- package/dist-lib/plugins/music/index.js +23 -11
- package/dist-lib/plugins/obsidian/command.js +2 -2
- package/dist-lib/plugins/obsidian/index.js +14 -4
- package/dist-lib/plugins/obsidian/note-name.js +2 -1
- package/dist-lib/plugins/obsidian/readiness.js +2 -2
- 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 +20 -18
- package/dist-lib/plugins/obsidian/vault-write.js +13 -12
- package/dist-lib/plugins/ocr/bmp.d.ts +2 -0
- package/dist-lib/plugins/ocr/bmp.js +27 -0
- package/dist-lib/plugins/ocr/coverage.d.ts +3 -0
- package/dist-lib/plugins/ocr/coverage.js +67 -0
- package/dist-lib/plugins/ocr/index.d.ts +12 -0
- package/dist-lib/plugins/ocr/index.js +20 -0
- package/dist-lib/plugins/ocr/ocr-runtime.d.ts +25 -0
- package/dist-lib/plugins/ocr/ocr-runtime.js +103 -0
- package/dist-lib/plugins/ocr/reading-order.d.ts +5 -0
- package/dist-lib/plugins/ocr/reading-order.js +218 -0
- package/dist-lib/plugins/python/bare-floor.d.ts +1 -0
- package/dist-lib/plugins/python/bare-floor.js +2 -0
- 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/index.d.ts +4 -1
- package/dist-lib/plugins/python/index.js +6 -1
- package/dist-lib/plugins/python/interrupt-timer.js +2 -2
- package/dist-lib/plugins/python/language.js +11 -10
- package/dist-lib/plugins/python/loader.d.ts +1 -0
- package/dist-lib/plugins/python/loader.js +76 -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.d.ts +6 -1
- package/dist-lib/plugins/python/python-adapter.js +37 -2
- 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 +10 -9
- package/dist-lib/plugins/python/worker/entry.js +2 -8
- package/dist-lib/plugins/python/worker/preload.d.ts +1 -0
- package/dist-lib/plugins/python/worker/preload.js +2 -0
- 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 +3 -2
- package/dist-lib/plugins/quickjs/index.js +4 -0
- package/dist-lib/plugins/quickjs/runtime.js +8 -3
- 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 +32 -13
- package/dist-lib/plugins/run-report/layout.js +1 -1
- 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 +7 -4
- 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 +62 -0
- package/dist-lib/plugins/sandbox-linux/index.js +354 -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 +25 -11
- package/dist-lib/plugins/sandbox-macos/index.js +244 -49
- package/dist-lib/plugins/sandbox-vm/index.d.ts +2 -1
- package/dist-lib/plugins/sandbox-vm/index.js +5 -2
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +7 -3
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +54 -20
- 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 +8 -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/index.d.ts +1 -0
- package/dist-lib/plugins/speech/index.js +8 -1
- package/dist-lib/plugins/speech/speech-engine.d.ts +1 -1
- package/dist-lib/plugins/speech/speech-engine.js +10 -5
- package/dist-lib/plugins/speech/speech-runtime.js +37 -37
- package/dist-lib/plugins/speech/speech-text.d.ts +1 -0
- package/dist-lib/plugins/speech/speech-text.js +9 -4
- package/dist-lib/plugins/speech/voice.d.ts +5 -1
- package/dist-lib/plugins/speech/voice.js +107 -33
- package/dist-lib/plugins/translation/index.d.ts +2 -1
- package/dist-lib/plugins/translation/index.js +21 -10
- package/dist-lib/plugins/translation/translate.d.ts +9 -5
- package/dist-lib/plugins/translation/translate.js +69 -64
- package/dist-lib/plugins/walkie-talkie/index.d.ts +4 -2
- package/dist-lib/plugins/walkie-talkie/index.js +19 -6
- package/dist-lib/plugins/walkie-talkie/wire.d.ts +5 -0
- package/dist-lib/plugins/walkie-talkie/wire.js +6 -5
- package/dist-lib/plugins/weather/geocode.js +2 -1
- package/dist-lib/plugins/weather/lookup.js +6 -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/generate.js +8 -1
- package/dist-lib/schema/harness.js +94 -12
- package/dist-lib/spec/bind.js +12 -0
- package/dist-lib/spec/calls.js +4 -0
- package/dist-lib/spec/hrpc/hrpc.json +55 -3
- package/dist-lib/spec/hrpc/index.js +58 -10
- package/dist-lib/spec/hrpc/messages.js +485 -209
- package/dist-lib/spec/hyperschema/index.js +485 -209
- package/dist-lib/spec/hyperschema/schema.json +290 -85
- package/dist-lib/spec/hyperschema/types.d.ts +42 -5
- package/package.json +265 -65
- package/patches/pyodide@314.0.2.patch +37 -8
- package/scripts/addon-externals.cjs +16 -5
- package/worker/harness-sidecar.mjs +23 -154
- package/dist-lib/lib/tools/create-documents.d.ts +0 -3
- package/dist-lib/lib/tools/create-documents.js +0 -95
- package/dist-lib/lib/tools/edit-documents.d.ts +0 -3
- package/dist-lib/lib/tools/edit-documents.js +0 -132
- package/dist-lib/lib/tools/exec/shell-argv.d.ts +0 -2
- package/dist-lib/lib/tools/exec/shell-argv.js +0 -61
- package/dist-lib/lib/tools/file-glob.js +0 -118
- package/dist-lib/lib/tools/grep.d.ts +0 -5
- package/dist-lib/lib/tools/grep.js +0 -184
- package/dist-lib/lib/tools/read-files.d.ts +0 -5
- package/dist-lib/lib/tools/read-files.js +0 -160
- package/dist-lib/plugins/coding/write-file.d.ts +0 -3
- package/dist-lib/plugins/coding/write-file.js +0 -52
- package/patches/@qvac%2Finference@0.21.0.patch +0 -67
- package/patches/bare-stow@0.1.5.patch +0 -68
- package/patches/hypercore-blob-server@1.15.0.patch +0 -15
- package/patches/localwatch@1.4.3.patch +0 -13
|
@@ -3,6 +3,7 @@ import { type EngineBoot, type EngineStep } from '../../run-log/index.ts';
|
|
|
3
3
|
import type { CompletionSkillEntry } from '../skill-entry.ts';
|
|
4
4
|
import { type CompletionRun, type CompletionRuntime } from './driver.ts';
|
|
5
5
|
import type { CompletionArgs } from './loop.ts';
|
|
6
|
+
import { ModelRound } from './model-round.ts';
|
|
6
7
|
export interface CompletionEngineOptions {
|
|
7
8
|
hooks?: readonly HarnessHook[];
|
|
8
9
|
outbound?: OutboundGuard;
|
|
@@ -16,7 +17,8 @@ export interface CompletionEngineOptions {
|
|
|
16
17
|
bootRequest?: unknown;
|
|
17
18
|
}
|
|
18
19
|
export declare class CompletionEngine {
|
|
19
|
-
static
|
|
20
|
+
static WRAP_UP_PREDICT: number;
|
|
21
|
+
static serveModelRound: typeof ModelRound.serve;
|
|
20
22
|
runtime: CompletionRuntime;
|
|
21
23
|
hooks: readonly HarnessHook[];
|
|
22
24
|
outbound: OutboundGuard;
|
|
@@ -28,3 +30,5 @@ export declare class CompletionEngine {
|
|
|
28
30
|
}
|
|
29
31
|
export type { CompletionArgs } from './loop.ts';
|
|
30
32
|
export type { CompletionRun, CompletionRuntime } from './driver.ts';
|
|
33
|
+
export type { ModelRoundEvent, ModelRoundIo, ModelRoundPort, ModelRoundRequest, ModelRoundResult, ModelRoundServeOptions } from './model-round.ts';
|
|
34
|
+
export { ToolSets } from './tool-sets.ts';
|
|
@@ -4,9 +4,11 @@ import { RunLog } from '../../run-log/index.js';
|
|
|
4
4
|
import { outboundGuard } from '../../tools/outbound-guard.js';
|
|
5
5
|
import { defaultAgentPorts } from '../agent-ports.js';
|
|
6
6
|
import { driveCompletion } from './driver.js';
|
|
7
|
-
import {
|
|
7
|
+
import { WRAP_UP_PREDICT } from './actors/wrap-up.js';
|
|
8
|
+
import { ModelRound } from './model-round.js';
|
|
8
9
|
export class CompletionEngine {
|
|
9
|
-
static
|
|
10
|
+
static WRAP_UP_PREDICT = WRAP_UP_PREDICT;
|
|
11
|
+
static serveModelRound = ModelRound.serve;
|
|
10
12
|
runtime;
|
|
11
13
|
hooks;
|
|
12
14
|
outbound;
|
|
@@ -42,3 +44,4 @@ export class CompletionEngine {
|
|
|
42
44
|
return new CompletionEngine(sdk, opts).run(args);
|
|
43
45
|
}
|
|
44
46
|
}
|
|
47
|
+
export { ToolSets } from './tool-sets.js';
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
2
|
import type { RecoveryResolution } from '../../run-log/index.ts';
|
|
3
3
|
import type { KnowledgeGrant } from '../../contract/knowledge.ts';
|
|
4
|
-
import type { ToolCallDisplay } from '../../contract/index.ts';
|
|
5
|
-
import type { AgentConfig, CompletionEvent, ApproveFn, AskUserFn, AttachFn, DriveRoot, FetchAttachmentFn, LlmGenerationParams, Message, ProgressFn, ResponseFormat, RunBudget, RunGoal, RunInput, RoundModelLease, ToolDefinition, ToolExecuteContext } from '../../contract/index.ts';
|
|
4
|
+
import type { GuidelineWording, MediaRoundPort, ToolCallDisplay } from '../../contract/index.ts';
|
|
5
|
+
import type { AgentConfig, AccessPolicy, CompiledPolicy, CompletionEvent, ApproveFn, AskUserFn, AttachFn, DriveRoot, FetchAttachmentFn, LlmGenerationParams, Message, ProgressFn, ResponseFormat, RunBudget, RunGoal, RunInput, RoundModelLease, ShowImageFn, ToolDefinition, SkillTree, ToolExecuteContext } from '../../contract/index.ts';
|
|
6
6
|
import type { CompletionSkillEntry } from '../skill-entry.ts';
|
|
7
|
+
import type { ModelRoundPort } from './model-round.ts';
|
|
7
8
|
export interface CompletionArgs {
|
|
8
9
|
runId?: string;
|
|
9
10
|
parentRunId?: string;
|
|
@@ -12,39 +13,61 @@ export interface CompletionArgs {
|
|
|
12
13
|
lockOwner?: object;
|
|
13
14
|
modelId: string;
|
|
14
15
|
acquireRound?: (signal?: BareAbortSignal) => Promise<RoundModelLease>;
|
|
16
|
+
modelRound?: ModelRoundPort;
|
|
17
|
+
mediaRound?: MediaRoundPort;
|
|
15
18
|
model?: string;
|
|
16
19
|
agent?: AgentConfig;
|
|
17
20
|
ctxSize?: number;
|
|
18
21
|
cacheKey?: string;
|
|
22
|
+
replaysContext?: boolean;
|
|
23
|
+
session?: string;
|
|
19
24
|
thinkingDefault?: string;
|
|
20
25
|
generationParams?: LlmGenerationParams;
|
|
21
26
|
responseFormat?: ResponseFormat;
|
|
22
27
|
messages: Message[];
|
|
28
|
+
typedText?: string;
|
|
23
29
|
requestMessages?: Message[];
|
|
24
30
|
tools?: ToolDefinition[];
|
|
25
31
|
skillCatalog?: readonly CompletionSkillEntry[];
|
|
32
|
+
platform?: string | undefined;
|
|
33
|
+
skillTrees?: ReadonlyMap<string, SkillTree>;
|
|
26
34
|
approve?: ApproveFn;
|
|
27
35
|
attach?: AttachFn;
|
|
28
36
|
fetchAttachment?: FetchAttachmentFn;
|
|
37
|
+
showImage?: ShowImageFn;
|
|
29
38
|
progress?: ProgressFn;
|
|
30
39
|
askUser?: AskUserFn;
|
|
31
40
|
signal?: BareAbortSignal;
|
|
32
41
|
input?: AsyncIterable<RunInput>;
|
|
42
|
+
roundCut?: (cut: (note: string) => void) => void;
|
|
33
43
|
toolConfigs?: Record<string, Record<string, unknown>>;
|
|
34
44
|
fsRoots?: readonly DriveRoot[];
|
|
35
45
|
fsWriteRoots?: readonly DriveRoot[];
|
|
46
|
+
policy?: AccessPolicy;
|
|
47
|
+
access?: CompiledPolicy;
|
|
36
48
|
captureInferenceCalls?: boolean;
|
|
37
49
|
now?: () => number;
|
|
38
50
|
maxToolRounds?: number;
|
|
51
|
+
budgetMs?: number;
|
|
39
52
|
knowledge?: KnowledgeGrant;
|
|
40
53
|
planMode?: boolean;
|
|
54
|
+
deferTools?: boolean;
|
|
41
55
|
goal?: RunGoal;
|
|
42
56
|
wording?: {
|
|
43
57
|
toolContinuation?: string;
|
|
44
58
|
fileDelivered?: string;
|
|
59
|
+
wrapUp?: string;
|
|
45
60
|
toolDenied?: string;
|
|
46
61
|
toolCutOff?: string;
|
|
62
|
+
toolRoundCut?: string;
|
|
63
|
+
toolContextBoundary?: string;
|
|
64
|
+
toolRepeated?: string;
|
|
65
|
+
toolRepeatedFailure?: string;
|
|
66
|
+
toolUnchanged?: string;
|
|
67
|
+
toolFailing?: string;
|
|
47
68
|
goalContinuation?: string;
|
|
69
|
+
goalStalled?: string;
|
|
70
|
+
guidelines?: GuidelineWording;
|
|
48
71
|
};
|
|
49
72
|
}
|
|
50
73
|
export declare function labelOf(name: string, args: Record<string, unknown>, emoji: string | null): ToolCallDisplay;
|
|
@@ -55,4 +78,4 @@ export declare function createRunBudget(startedAt: number, ms?: number): RunBudg
|
|
|
55
78
|
export type ToolContextFactory = (turnImages?: {
|
|
56
79
|
path: string;
|
|
57
80
|
}[], ctxSize?: number, signal?: BareAbortSignal) => ToolExecuteContext;
|
|
58
|
-
export declare function runToolContext(args: Pick<CompletionArgs, 'agent' | 'attach' | 'fetchAttachment' | 'progress' | 'askUser' | 'signal' | 'fsRoots' | 'fsWriteRoots'>, runBudget: RunBudget): ToolContextFactory;
|
|
81
|
+
export declare function runToolContext(args: Pick<CompletionArgs, 'agent' | 'attach' | 'fetchAttachment' | 'progress' | 'askUser' | 'mediaRound' | 'signal' | 'fsRoots' | 'fsWriteRoots' | 'session' | 'cacheKey' | 'skillTrees'>, runBudget: RunBudget): ToolContextFactory;
|
|
@@ -25,20 +25,26 @@ const RUN_WALL_CLOCK_BUDGET_MS = 30 * 60_000;
|
|
|
25
25
|
export function createRunBudget(startedAt, ms) {
|
|
26
26
|
const override = Number(process.env.QVAC_RUN_BUDGET_MS);
|
|
27
27
|
const fallback = Number.isFinite(override) && override > 0 ? override : RUN_WALL_CLOCK_BUDGET_MS;
|
|
28
|
-
|
|
28
|
+
const totalMs = ms ?? fallback;
|
|
29
|
+
return { deadlineMs: startedAt + totalMs, totalMs, outputBytesUsed: 0 };
|
|
29
30
|
}
|
|
30
31
|
export function runToolContext(args, runBudget) {
|
|
31
|
-
const { agent, attach, fetchAttachment, progress, askUser, signal } = args;
|
|
32
|
+
const { agent, attach, fetchAttachment, progress, askUser, mediaRound, signal } = args;
|
|
32
33
|
const image = imageSettingsFrom(agent);
|
|
34
|
+
const session = args.session ?? sessionOf(args.cacheKey);
|
|
33
35
|
return (turnImages = [], ctxSize, invocationSignal) => {
|
|
34
36
|
const context = {
|
|
35
37
|
agentId: agent?.id ?? null,
|
|
38
|
+
skillTrees: args.skillTrees,
|
|
36
39
|
ctxSize,
|
|
37
40
|
fsRoots: args.fsRoots ?? [],
|
|
38
41
|
fsWriteRoots: args.fsWriteRoots ?? [],
|
|
39
42
|
runBudget,
|
|
40
43
|
signal: invocationSignal ?? signal
|
|
41
44
|
};
|
|
45
|
+
if (session) {
|
|
46
|
+
context.session = session;
|
|
47
|
+
}
|
|
42
48
|
if (image) {
|
|
43
49
|
context.image = image;
|
|
44
50
|
}
|
|
@@ -57,6 +63,12 @@ export function runToolContext(args, runBudget) {
|
|
|
57
63
|
if (askUser) {
|
|
58
64
|
context.askUser = askUser;
|
|
59
65
|
}
|
|
66
|
+
if (mediaRound) {
|
|
67
|
+
context.mediaRound = mediaRound;
|
|
68
|
+
}
|
|
60
69
|
return context;
|
|
61
70
|
};
|
|
62
71
|
}
|
|
72
|
+
function sessionOf(cacheKey) {
|
|
73
|
+
return cacheKey?.split('/')[0] || undefined;
|
|
74
|
+
}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { CompletionContext } from '../../machine/index.ts';
|
|
2
|
-
import type { MetricsEvent } from '../../contract/index.ts';
|
|
2
|
+
import type { MetricsEvent, RoundSpeed, RunOutcome } from '../../contract/index.ts';
|
|
3
3
|
import type { UsageBreakdown } from '../usage-breakdown.ts';
|
|
4
|
-
|
|
4
|
+
import type { LiveRound } from './round.ts';
|
|
5
|
+
export interface RunEnd {
|
|
6
|
+
usage?: UsageBreakdown | null;
|
|
7
|
+
outcome?: RunOutcome | null;
|
|
8
|
+
cancelled?: RoundSpeed | null;
|
|
9
|
+
}
|
|
10
|
+
export declare function metricsEvent(state: CompletionContext['metrics'], wallMs: number, { usage, outcome, cancelled }?: RunEnd): MetricsEvent | null;
|
|
11
|
+
export declare function cancelledRound(live: LiveRound | null | undefined): RoundSpeed | null;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
export function metricsEvent(state, wallMs, usage) {
|
|
2
|
-
if (!state.tokens) {
|
|
1
|
+
export function metricsEvent(state, wallMs, { usage, outcome, cancelled } = {}) {
|
|
2
|
+
if (!state.tokens && !cancelled) {
|
|
3
3
|
return null;
|
|
4
4
|
}
|
|
5
|
+
const rounds = cancelled ? [...state.rounds, cancelled] : state.rounds;
|
|
5
6
|
const event = {
|
|
6
7
|
type: 'metrics',
|
|
7
8
|
totalTokens: state.tokens,
|
|
8
9
|
durationMs: wallMs,
|
|
9
|
-
modelMs: sum(
|
|
10
|
+
modelMs: sum(rounds),
|
|
10
11
|
toolMs: sum(state.tools),
|
|
11
12
|
timeToFirstToken: state.ttft,
|
|
12
|
-
promptTokensPerSecond: prefillRate(
|
|
13
|
+
promptTokensPerSecond: prefillRate(rounds),
|
|
13
14
|
tokensPerSecond: state.decodeMs > 0 ? (state.timedTokens / state.decodeMs) * 1000 : undefined,
|
|
14
15
|
promptTokens: state.promptTokens,
|
|
15
16
|
cacheTokens: state.cacheTokens,
|
|
16
|
-
rounds
|
|
17
|
+
rounds,
|
|
17
18
|
tools: state.tools
|
|
18
19
|
};
|
|
19
20
|
if (state.ctxSize) {
|
|
@@ -25,11 +26,31 @@ export function metricsEvent(state, wallMs, usage) {
|
|
|
25
26
|
if (usage) {
|
|
26
27
|
event.usage = usage;
|
|
27
28
|
}
|
|
28
|
-
|
|
29
|
-
|
|
29
|
+
const stopReason = cancelled ? cancelled.stopReason : state.stopReason;
|
|
30
|
+
if (stopReason) {
|
|
31
|
+
event.stopReason = stopReason;
|
|
32
|
+
}
|
|
33
|
+
if (outcome) {
|
|
34
|
+
event.outcome = outcome;
|
|
30
35
|
}
|
|
31
36
|
return event;
|
|
32
37
|
}
|
|
38
|
+
export function cancelledRound(live) {
|
|
39
|
+
if (!live) {
|
|
40
|
+
return null;
|
|
41
|
+
}
|
|
42
|
+
const record = {
|
|
43
|
+
round: live.round,
|
|
44
|
+
durationMs: Date.now() - live.startedAt,
|
|
45
|
+
stopReason: 'cancelled',
|
|
46
|
+
rawContentChars: live.rawChars,
|
|
47
|
+
kind: live.kind
|
|
48
|
+
};
|
|
49
|
+
if (live.reasoningDeltas > 0) {
|
|
50
|
+
record.reasoningDeltas = live.reasoningDeltas;
|
|
51
|
+
}
|
|
52
|
+
return record;
|
|
53
|
+
}
|
|
33
54
|
function sum(records) {
|
|
34
55
|
return records.reduce((total, record) => total + record.durationMs, 0);
|
|
35
56
|
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { CompletionFinal, Tool as SdkTool, ToolDialect } from '@qvac/inference';
|
|
2
|
+
import { type AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
3
|
+
import type { TextEvent } from '../../helpers/thinking.ts';
|
|
4
|
+
import type { AgentConfig, CompletionSdk, LlmGenerationParams, Message, ResponseFormat, RoundModelLease, RunLifecycleEvent } from '../../contract/index.ts';
|
|
5
|
+
export interface ModelRoundRequest {
|
|
6
|
+
runId: string;
|
|
7
|
+
round: number;
|
|
8
|
+
kind: 'streaming' | 'wrap-up';
|
|
9
|
+
attempt: number;
|
|
10
|
+
modelId: string;
|
|
11
|
+
load?: Pick<AgentConfig, 'ctxSize' | 'kvCacheK' | 'kvCacheV'> | undefined;
|
|
12
|
+
history: Message[];
|
|
13
|
+
tools?: SdkTool[] | undefined;
|
|
14
|
+
toolSet?: string | undefined;
|
|
15
|
+
generationParams?: Partial<LlmGenerationParams> | undefined;
|
|
16
|
+
responseFormat?: ResponseFormat | undefined;
|
|
17
|
+
toolDialect?: ToolDialect | undefined;
|
|
18
|
+
cacheKey?: string | undefined;
|
|
19
|
+
promptPrefix: string;
|
|
20
|
+
continuationNudge: string;
|
|
21
|
+
deliveredNudge: string;
|
|
22
|
+
goalNudge?: string | undefined;
|
|
23
|
+
wrapUpNudge?: string | undefined;
|
|
24
|
+
unforced?: {
|
|
25
|
+
generationParams?: Partial<LlmGenerationParams> | undefined;
|
|
26
|
+
} | undefined;
|
|
27
|
+
}
|
|
28
|
+
export interface ModelRoundResult {
|
|
29
|
+
contentText: string;
|
|
30
|
+
final: CompletionFinal;
|
|
31
|
+
cut?: string | undefined;
|
|
32
|
+
unproven?: string | null | undefined;
|
|
33
|
+
replay?: string | null | undefined;
|
|
34
|
+
reasoningDeltas?: number | undefined;
|
|
35
|
+
ctxSize?: number | undefined;
|
|
36
|
+
overflows?: number | undefined;
|
|
37
|
+
}
|
|
38
|
+
export type ModelRoundEvent = TextEvent;
|
|
39
|
+
type RoundReset = Extract<RunLifecycleEvent, {
|
|
40
|
+
type: 'round-reset';
|
|
41
|
+
}>;
|
|
42
|
+
export interface ModelRoundIo {
|
|
43
|
+
signal: BareAbortSignal;
|
|
44
|
+
emit(event: ModelRoundEvent): void;
|
|
45
|
+
retake(): (event: ModelRoundEvent) => void;
|
|
46
|
+
}
|
|
47
|
+
export type ModelRoundPort = (request: ModelRoundRequest, io: ModelRoundIo) => Promise<ModelRoundResult>;
|
|
48
|
+
interface RunOptions {
|
|
49
|
+
signal?: BareAbortSignal | undefined;
|
|
50
|
+
emit(event: ModelRoundEvent | RoundReset): void;
|
|
51
|
+
}
|
|
52
|
+
export interface ModelRoundServeOptions {
|
|
53
|
+
sdk?: CompletionSdk | undefined;
|
|
54
|
+
acquireRound?: ((signal?: BareAbortSignal) => Promise<RoundModelLease>) | undefined;
|
|
55
|
+
}
|
|
56
|
+
export declare class ModelRound {
|
|
57
|
+
port: ModelRoundPort;
|
|
58
|
+
constructor(port: ModelRoundPort);
|
|
59
|
+
run(request: ModelRoundRequest, options: RunOptions): Promise<ModelRoundResult>;
|
|
60
|
+
static run(port: ModelRoundPort, request: ModelRoundRequest, { signal, emit }: RunOptions): Promise<ModelRoundResult>;
|
|
61
|
+
static serve(request: ModelRoundRequest, io: ModelRoundIo, { sdk, acquireRound }: ModelRoundServeOptions): Promise<ModelRoundResult>;
|
|
62
|
+
}
|
|
63
|
+
export {};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { AbortController } from 'bare-abort-controller';
|
|
2
|
+
import { raceAbort } from '../../helpers/race-abort.js';
|
|
3
|
+
import { runRecoveredRound } from './round.js';
|
|
4
|
+
export class ModelRound {
|
|
5
|
+
port;
|
|
6
|
+
constructor(port) {
|
|
7
|
+
this.port = port;
|
|
8
|
+
}
|
|
9
|
+
run(request, options) {
|
|
10
|
+
return ModelRound.run(this.port, request, options);
|
|
11
|
+
}
|
|
12
|
+
static async run(port, request, { signal = new AbortController().signal, emit }) {
|
|
13
|
+
let taker = 0;
|
|
14
|
+
let open = true;
|
|
15
|
+
const live = () => open && !signal.aborted;
|
|
16
|
+
const emitter = (generation) => (event) => {
|
|
17
|
+
if (generation === taker && live()) {
|
|
18
|
+
emit(event);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
const sent = port(request, {
|
|
22
|
+
signal,
|
|
23
|
+
emit: emitter(0),
|
|
24
|
+
retake: () => {
|
|
25
|
+
if (!live())
|
|
26
|
+
return noop;
|
|
27
|
+
taker++;
|
|
28
|
+
emit({
|
|
29
|
+
type: 'round-reset',
|
|
30
|
+
runId: request.runId,
|
|
31
|
+
round: request.round,
|
|
32
|
+
replacedTypes: ['content', 'thinking']
|
|
33
|
+
});
|
|
34
|
+
return emitter(taker);
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
sent.catch(noop);
|
|
38
|
+
try {
|
|
39
|
+
return await raceAbort(sent, signal);
|
|
40
|
+
}
|
|
41
|
+
finally {
|
|
42
|
+
open = false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
static async serve(request, io, { sdk, acquireRound }) {
|
|
46
|
+
const rounds = runRecoveredRound(sdk, servedArgs(request, io.signal, acquireRound));
|
|
47
|
+
let emit = io.emit;
|
|
48
|
+
for await (const event of served(rounds)) {
|
|
49
|
+
if (event.type === 'served') {
|
|
50
|
+
return result(event.round);
|
|
51
|
+
}
|
|
52
|
+
if (event.type === 'content' || event.type === 'thinking') {
|
|
53
|
+
emit(event);
|
|
54
|
+
}
|
|
55
|
+
else if (event.type === 'round-reset') {
|
|
56
|
+
emit = io.retake();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
throw new Error('A served round ended without its result');
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function servedArgs(request, signal, acquireRound) {
|
|
63
|
+
return {
|
|
64
|
+
modelId: request.modelId,
|
|
65
|
+
acquireRound,
|
|
66
|
+
history: request.history,
|
|
67
|
+
failureResults: {},
|
|
68
|
+
continuationNudge: request.continuationNudge,
|
|
69
|
+
deliveredNudge: request.deliveredNudge,
|
|
70
|
+
goalNudge: request.goalNudge,
|
|
71
|
+
wrapUpNudge: request.wrapUpNudge,
|
|
72
|
+
tools: request.tools,
|
|
73
|
+
generationParams: request.generationParams,
|
|
74
|
+
responseFormat: request.responseFormat,
|
|
75
|
+
toolDialect: request.toolDialect,
|
|
76
|
+
cacheKey: request.cacheKey,
|
|
77
|
+
signal,
|
|
78
|
+
round: request.round,
|
|
79
|
+
runId: request.runId,
|
|
80
|
+
promptPrefix: request.promptPrefix,
|
|
81
|
+
capture: false,
|
|
82
|
+
knownTools: request.tools,
|
|
83
|
+
unforced: request.unforced,
|
|
84
|
+
live: {
|
|
85
|
+
round: request.round,
|
|
86
|
+
kind: request.kind,
|
|
87
|
+
startedAt: Date.now(),
|
|
88
|
+
rawChars: 0,
|
|
89
|
+
reasoningDeltas: 0
|
|
90
|
+
}
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
async function* served(rounds) {
|
|
94
|
+
yield { type: 'served', round: yield* rounds };
|
|
95
|
+
}
|
|
96
|
+
function result({ contentText, final, cut, unproven, replay, reasoningDeltas, ctxSize, overflows }) {
|
|
97
|
+
return { contentText, final, cut, unproven, replay, reasoningDeltas, ctxSize, overflows };
|
|
98
|
+
}
|
|
99
|
+
const noop = () => { };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash } from 'crypto';
|
|
2
2
|
import { normalizeToolExecutionOutcome, writeResult } from '../../helpers/run-outcome.js';
|
|
3
3
|
import { isMetadataMethod } from '../../helpers/mcp-methods.js';
|
|
4
|
-
import { captureFacts, captureToolOperationFacts, restoreFacts } from './durable.js';
|
|
4
|
+
import { captureFacts, captureToolOperationFacts, laterDelivered, restoreFacts } from './durable.js';
|
|
5
5
|
import { AbortedError } from '../../helpers/race-abort.js';
|
|
6
6
|
import { isRecord } from '../../guards.js';
|
|
7
7
|
import { detachJson } from '../../helpers/detach-json.js';
|
|
@@ -43,11 +43,13 @@ export function toolOperationFacts(value) {
|
|
|
43
43
|
}
|
|
44
44
|
const backends = value.backends.filter(isBackendUse);
|
|
45
45
|
const runBudget = value.runBudget.outputBytesUsed;
|
|
46
|
+
const delivered = value.runBudget.delivered;
|
|
46
47
|
const outcome = value.outcome;
|
|
47
48
|
if (backends.length !== value.backends.length ||
|
|
48
49
|
typeof runBudget !== 'number' ||
|
|
49
50
|
!Number.isSafeInteger(runBudget) ||
|
|
50
51
|
runBudget < 0 ||
|
|
52
|
+
(delivered !== undefined && !(Array.isArray(delivered) && delivered.every(isDeliveredFile))) ||
|
|
51
53
|
!isRecord(outcome) ||
|
|
52
54
|
!Array.isArray(outcome.confirmedWrites)) {
|
|
53
55
|
throw new TypeError('Malformed tool operation facts');
|
|
@@ -56,7 +58,19 @@ export function toolOperationFacts(value) {
|
|
|
56
58
|
if (confirmedWrites.length !== outcome.confirmedWrites.length) {
|
|
57
59
|
throw new TypeError('Malformed tool operation facts');
|
|
58
60
|
}
|
|
59
|
-
return {
|
|
61
|
+
return {
|
|
62
|
+
backends,
|
|
63
|
+
runBudget: { outputBytesUsed: runBudget, delivered },
|
|
64
|
+
outcome: { confirmedWrites }
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function isDeliveredFile(value) {
|
|
68
|
+
return (isRecord(value) &&
|
|
69
|
+
typeof value.name === 'string' &&
|
|
70
|
+
typeof value.sha256 === 'string' &&
|
|
71
|
+
typeof value.attachmentId === 'string' &&
|
|
72
|
+
typeof value.fileName === 'string' &&
|
|
73
|
+
typeof value.byteLength === 'number');
|
|
60
74
|
}
|
|
61
75
|
function runHookOperation({ deps, base, phase, id, name, payload, check, run }) {
|
|
62
76
|
check();
|
|
@@ -71,8 +85,8 @@ function wrapHostCallback({ deps, check, prefix, stage, callId, name, effect, ca
|
|
|
71
85
|
const release = deps.session.trackInvoke();
|
|
72
86
|
try {
|
|
73
87
|
check();
|
|
74
|
-
const journalInput = detachHostCallbackInput(input);
|
|
75
|
-
const callbackInput = detachHostCallbackInput(
|
|
88
|
+
const journalInput = detachHostCallbackInput(input, digestBytes);
|
|
89
|
+
const callbackInput = detachHostCallbackInput(input, (bytes) => Uint8Array.from(bytes));
|
|
76
90
|
return await deps.operations.operation({
|
|
77
91
|
id: `${prefix}:${stage}:${callId}:host-${name}-${count++}`,
|
|
78
92
|
name: `host:${name}`,
|
|
@@ -85,13 +99,17 @@ function wrapHostCallback({ deps, check, prefix, stage, callId, name, effect, ca
|
|
|
85
99
|
}
|
|
86
100
|
};
|
|
87
101
|
}
|
|
88
|
-
function detachHostCallbackInput(input) {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
Reflect.set(detached, 'bytes', Uint8Array.from(input.bytes));
|
|
102
|
+
function detachHostCallbackInput(input, bytesAs) {
|
|
103
|
+
if (!isRecord(input) || !(input.bytes instanceof Uint8Array)) {
|
|
104
|
+
return detachJson(input);
|
|
92
105
|
}
|
|
106
|
+
const detached = detachJson({ ...input, bytes: null });
|
|
107
|
+
Reflect.set(detached, 'bytes', bytesAs(input.bytes));
|
|
93
108
|
return detached;
|
|
94
109
|
}
|
|
110
|
+
function digestBytes(bytes) {
|
|
111
|
+
return { byteLength: bytes.byteLength, sha256: createHash('sha256').update(bytes).digest('hex') };
|
|
112
|
+
}
|
|
95
113
|
function plannedEffect(context, { stage, callId, name }) {
|
|
96
114
|
if (context.execution && context.currentCall?.name === name) {
|
|
97
115
|
return context.execution.effect;
|
|
@@ -145,7 +163,9 @@ export function bindOperations(deps, context, stage) {
|
|
|
145
163
|
: current.backends,
|
|
146
164
|
runBudget: {
|
|
147
165
|
deadlineMs: current.runBudget.deadlineMs,
|
|
148
|
-
|
|
166
|
+
totalMs: current.runBudget.totalMs,
|
|
167
|
+
outputBytesUsed: Math.max(current.runBudget.outputBytesUsed, recorded.runBudget.outputBytesUsed),
|
|
168
|
+
delivered: laterDelivered(current.runBudget.delivered, recorded.runBudget.delivered)
|
|
149
169
|
},
|
|
150
170
|
outcome: {
|
|
151
171
|
...current.outcome,
|
|
@@ -223,7 +243,7 @@ export function bindOperations(deps, context, stage) {
|
|
|
223
243
|
};
|
|
224
244
|
let preToolCount = 0;
|
|
225
245
|
pipeline.runPreToolFold = async (payload) => {
|
|
226
|
-
const { signal: _signal, egress: _egress, ...durable } = payload;
|
|
246
|
+
const { signal: _signal, egress: _egress, command: _command, paths: _paths, ...durable } = payload;
|
|
227
247
|
return runHookOperation({
|
|
228
248
|
deps,
|
|
229
249
|
base,
|
|
@@ -19,9 +19,9 @@ import { skillStep } from './actors/skill-step.js';
|
|
|
19
19
|
import { streaming } from './actors/streaming.js';
|
|
20
20
|
import { wrapUp } from './actors/wrap-up.js';
|
|
21
21
|
import { toolContext } from './actors/execution-plan.js';
|
|
22
|
-
import { capabilityPolicy, captureFacts, restoreFacts, schemaDigest } from './durable.js';
|
|
22
|
+
import { capabilityPolicy, captureFacts, laterDelivered, restoreFacts, schemaDigest } from './durable.js';
|
|
23
23
|
import { bindOperations, toolOperationFacts } from './operations.js';
|
|
24
|
-
import {} from './session.js';
|
|
24
|
+
import { loadedSkills } from './session.js';
|
|
25
25
|
import { errorMessage, isRecord } from '../../guards.js';
|
|
26
26
|
import { detachJson } from '../../helpers/detach-json.js';
|
|
27
27
|
const prepareSource = skillStep;
|
|
@@ -79,7 +79,8 @@ export function completionPorts(deps) {
|
|
|
79
79
|
backends: recorded.backends.length > currentBackends.length ? recorded.backends : currentBackends,
|
|
80
80
|
runBudget: {
|
|
81
81
|
...currentBudget,
|
|
82
|
-
outputBytesUsed: Math.max(typeof currentBudget.outputBytesUsed === 'number' ? currentBudget.outputBytesUsed : 0, recorded.runBudget.outputBytesUsed)
|
|
82
|
+
outputBytesUsed: Math.max(typeof currentBudget.outputBytesUsed === 'number' ? currentBudget.outputBytesUsed : 0, recorded.runBudget.outputBytesUsed),
|
|
83
|
+
delivered: laterDelivered(Array.isArray(currentBudget.delivered) ? currentBudget.delivered : undefined, recorded.runBudget.delivered)
|
|
83
84
|
},
|
|
84
85
|
outcome: {
|
|
85
86
|
...currentOutcome,
|
|
@@ -168,11 +169,7 @@ function detachEventPayload(event) {
|
|
|
168
169
|
case 'inference-call':
|
|
169
170
|
return { ...event, call: detachJson(event.call) };
|
|
170
171
|
case 'inference-sent':
|
|
171
|
-
return {
|
|
172
|
-
...event,
|
|
173
|
-
messages: detachJson(event.messages),
|
|
174
|
-
tokens: detachJson(event.tokens)
|
|
175
|
-
};
|
|
172
|
+
return { ...event, tokens: detachJson(event.tokens) };
|
|
176
173
|
case 'metrics':
|
|
177
174
|
return {
|
|
178
175
|
...event,
|
|
@@ -230,7 +227,7 @@ async function rebuildSession(deps, cx) {
|
|
|
230
227
|
restoreFacts(invocation.input, durable);
|
|
231
228
|
}
|
|
232
229
|
const session = deps.session;
|
|
233
|
-
session.reselectTools?.(
|
|
230
|
+
session.reselectTools?.(loadedSkills(context, session), context.history);
|
|
234
231
|
const missing = context.availableTools.filter((name) => !session.enabled.some((tool) => tool.name === name));
|
|
235
232
|
const changed = durable?.tools
|
|
236
233
|
.filter((saved) => {
|
|
@@ -9,7 +9,7 @@ export interface PrepareSettleInput {
|
|
|
9
9
|
context: CompletionContext;
|
|
10
10
|
step: PrepareStep;
|
|
11
11
|
result: unknown;
|
|
12
|
-
announce(): void;
|
|
12
|
+
announce(result: unknown): void;
|
|
13
13
|
}
|
|
14
14
|
export interface PrepareFailInput {
|
|
15
15
|
deps: CompletionDeps;
|
|
@@ -21,6 +21,9 @@ export interface PrepareStepSource {
|
|
|
21
21
|
readonly label: string;
|
|
22
22
|
propose(deps: CompletionDeps, agent: ResolvedAgent<CompletionSkillEntry>): PrepareCall | null;
|
|
23
23
|
display(deps: CompletionDeps, step: PrepareStep): ToolCallDisplay;
|
|
24
|
+
refusal?(deps: CompletionDeps, step: PrepareStep): {
|
|
25
|
+
readonly error: string;
|
|
26
|
+
} | null;
|
|
24
27
|
settle(input: PrepareSettleInput): PrepareRunOutput;
|
|
25
28
|
fail(input: PrepareFailInput): PrepareFailure;
|
|
26
29
|
}
|
|
@@ -1,30 +1,40 @@
|
|
|
1
|
-
import type { CompletionFinal, Tool as SdkTool, ToolDialect } from '@qvac/
|
|
1
|
+
import type { CompletionFinal, CompletionStats, Tool as SdkTool, ToolDialect } from '@qvac/inference';
|
|
2
2
|
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
3
|
+
import { type KnownTool } from '../../helpers/tool-call-markup.ts';
|
|
3
4
|
import { type TextEvent } from '../../helpers/thinking.ts';
|
|
4
5
|
import type { CompletionHistoryEntry, LlmGenerationParams } from '../../contract/index.ts';
|
|
5
|
-
import type { CompletionSdk, InferenceCallEvent, InferenceSentEvent, FoldEvent, Message, ResponseFormat, RoundModelLease, RunLifecycleEvent } from '../../contract/index.ts';
|
|
6
|
+
import type { CompletionSdk, InferenceCallEvent, InferenceSentEvent, FoldEvent, Message, ResponseFormat, RoundModelLease, RoundSpeed, RunLifecycleEvent } from '../../contract/index.ts';
|
|
6
7
|
import { type FailureTurn } from '../tool-turns.ts';
|
|
8
|
+
import { type CompletionParams } from '../../helpers/completion-params.ts';
|
|
7
9
|
import type { ModelRequest } from '../../run-log/index.ts';
|
|
8
10
|
import { type FailureResultValue } from '../../helpers/failure-result.ts';
|
|
9
|
-
|
|
11
|
+
import { type FoldReading } from '../../fold/index.ts';
|
|
12
|
+
export declare function foldTokens(stats: CompletionStats | undefined, cacheable: boolean | undefined): number | undefined;
|
|
10
13
|
export interface RecoveredRound {
|
|
11
14
|
contentText: string;
|
|
12
15
|
final: CompletionFinal;
|
|
13
16
|
history: CompletionHistoryEntry[];
|
|
14
17
|
cacheable: boolean;
|
|
18
|
+
keyed: boolean;
|
|
15
19
|
unproven: string | null;
|
|
16
20
|
replay: string | null;
|
|
21
|
+
reasoningDeltas?: number | undefined;
|
|
17
22
|
ctxSize?: number | undefined;
|
|
23
|
+
overflows?: number | undefined;
|
|
24
|
+
cut?: string | undefined;
|
|
18
25
|
}
|
|
19
26
|
export interface RoundArgs {
|
|
20
27
|
modelId: string;
|
|
28
|
+
canThink?: boolean | undefined;
|
|
21
29
|
acquireRound?: ((signal?: BareAbortSignal) => Promise<RoundModelLease>) | undefined;
|
|
22
30
|
history: CompletionHistoryEntry[];
|
|
23
31
|
failureResults: Readonly<Record<string, FailureResultValue>>;
|
|
24
32
|
continuationNudge: string;
|
|
25
33
|
deliveredNudge: string;
|
|
34
|
+
goalNudge?: string | undefined;
|
|
35
|
+
wrapUpNudge?: string | undefined;
|
|
26
36
|
tools?: SdkTool[] | undefined;
|
|
27
|
-
generationParams?: LlmGenerationParams | undefined;
|
|
37
|
+
generationParams?: Partial<LlmGenerationParams> | undefined;
|
|
28
38
|
responseFormat?: ResponseFormat | undefined;
|
|
29
39
|
toolDialect?: ToolDialect | undefined;
|
|
30
40
|
cacheKey?: string | undefined;
|
|
@@ -33,21 +43,43 @@ export interface RoundArgs {
|
|
|
33
43
|
runId?: string | undefined;
|
|
34
44
|
promptPrefix: string;
|
|
35
45
|
capture: boolean;
|
|
46
|
+
knownTools?: ReadonlyArray<KnownTool> | undefined;
|
|
36
47
|
unforced?: {
|
|
37
|
-
generationParams
|
|
48
|
+
generationParams?: Partial<LlmGenerationParams> | undefined;
|
|
38
49
|
} | undefined;
|
|
39
50
|
recordRequest?: ((request: ModelRequest, failures: readonly FailureTurn[]) => Promise<void>) | undefined;
|
|
40
51
|
fold?: RoundFold | undefined;
|
|
52
|
+
live: LiveRound;
|
|
41
53
|
}
|
|
54
|
+
export interface LiveRound {
|
|
55
|
+
readonly round: number;
|
|
56
|
+
readonly kind: RoundKind;
|
|
57
|
+
readonly startedAt: number;
|
|
58
|
+
rawChars: number;
|
|
59
|
+
reasoningDeltas: number;
|
|
60
|
+
cut?: ((note: string) => void) | undefined;
|
|
61
|
+
}
|
|
62
|
+
export type RoundKind = NonNullable<RoundSpeed['kind']>;
|
|
42
63
|
export interface RoundFold {
|
|
43
64
|
messages: readonly Message[];
|
|
44
65
|
nudge: string;
|
|
45
66
|
ctxSize?: number | undefined;
|
|
67
|
+
cacheKey?: string | undefined;
|
|
46
68
|
instructions?: ((messages: readonly Message[]) => Promise<string | undefined>) | undefined;
|
|
69
|
+
reading?: FoldReading | undefined;
|
|
47
70
|
}
|
|
48
71
|
type RoundReset = Extract<RunLifecycleEvent, {
|
|
49
72
|
type: 'round-reset';
|
|
50
73
|
}>;
|
|
51
|
-
type RoundEvent = TextEvent | InferenceCallEvent | InferenceSentEvent | RoundReset | FoldEvent;
|
|
74
|
+
export type RoundEvent = TextEvent | InferenceCallEvent | InferenceSentEvent | RoundReset | FoldEvent;
|
|
75
|
+
interface CallCapture {
|
|
76
|
+
args: RoundArgs;
|
|
77
|
+
droppedTurns: number;
|
|
78
|
+
modelId: string;
|
|
79
|
+
params: CompletionParams;
|
|
80
|
+
cacheKey: string | undefined;
|
|
81
|
+
}
|
|
52
82
|
export declare function runRecoveredRound(sdk: CompletionSdk | undefined, args: RoundArgs): AsyncGenerator<RoundEvent, RecoveredRound>;
|
|
83
|
+
export declare function recordWholeRound(args: RoundArgs): Promise<CompletionParams>;
|
|
84
|
+
export declare function inferenceCall({ args, droppedTurns, modelId, params, cacheKey }: CallCapture): InferenceCallEvent;
|
|
53
85
|
export {};
|