@qvac/harness 1.0.0-rc.9 → 1.0.1
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/CHANGELOG.md +701 -7
- package/NOTICE.md +0 -16
- package/README.md +46 -5
- package/dist-lib/index.d.ts +23 -16
- package/dist-lib/index.js +127 -23
- package/dist-lib/lib/agent/delegate.d.ts +1 -0
- package/dist-lib/lib/agent/delegate.js +10 -9
- package/dist-lib/lib/agent/follow.d.ts +1 -0
- package/dist-lib/lib/agent/follow.js +12 -2
- package/dist-lib/lib/agent/resolve.js +11 -3
- package/dist-lib/lib/agent/tools.d.ts +1 -0
- package/dist-lib/lib/agent/tools.js +1 -1
- package/dist-lib/lib/capabilities/agent-ports.d.ts +1 -1
- package/dist-lib/lib/capabilities/agent-ports.js +8 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +1 -1
- 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 +79 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +12 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +13 -8
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +47 -22
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +5 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +19 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +38 -23
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +31 -10
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +61 -7
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +41 -16
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +26 -10
- package/dist-lib/lib/capabilities/completion-engine/actors.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/actors.js +8 -8
- package/dist-lib/lib/capabilities/completion-engine/driver.d.ts +0 -1
- package/dist-lib/lib/capabilities/completion-engine/driver.js +30 -6
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/durable.js +7 -1
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/engine.js +35 -15
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +0 -1
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +13 -3
- package/dist-lib/lib/capabilities/completion-engine/loop.js +7 -2
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +2 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.js +29 -9
- package/dist-lib/lib/capabilities/completion-engine/ports.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/ports.js +6 -4
- package/dist-lib/lib/capabilities/completion-engine/prepare-step.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +14 -0
- package/dist-lib/lib/capabilities/completion-engine/round.js +102 -47
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/session.js +1 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +3 -1
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +5 -41
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +21 -135
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.js +40 -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/transition-log.d.ts +14 -0
- package/dist-lib/lib/capabilities/completion-engine/transition-log.js +44 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.js +36 -8
- package/dist-lib/lib/capabilities/enhance.js +3 -3
- package/dist-lib/lib/capabilities/kv-cache.js +11 -3
- package/dist-lib/lib/capabilities/prefix-template.d.ts +34 -0
- package/dist-lib/lib/capabilities/prefix-template.js +175 -0
- package/dist-lib/lib/capabilities/prompt-prefix.d.ts +2 -0
- package/dist-lib/lib/capabilities/prompt-prefix.js +8 -0
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +4 -4
- package/dist-lib/lib/capabilities/sdk-tool.js +22 -6
- 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-turns/answered.d.ts +15 -0
- package/dist-lib/lib/capabilities/tool-turns/answered.js +16 -0
- 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 +10 -43
- package/dist-lib/lib/capabilities/tool-turns.js +7 -262
- 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.js +6 -5
- 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 +20 -0
- package/dist-lib/lib/connect/host-run-log.js +89 -0
- package/dist-lib/lib/connect/round-log.d.ts +8 -0
- package/dist-lib/lib/connect/round-log.js +33 -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 +5 -1
- package/dist-lib/lib/connect.js +102 -444
- package/dist-lib/lib/context-window.d.ts +13 -6
- package/dist-lib/lib/context-window.js +18 -5
- package/dist-lib/lib/contract/agent.d.ts +18 -1
- package/dist-lib/lib/contract/completion.d.ts +35 -3
- package/dist-lib/lib/contract/drive.d.ts +154 -4
- package/dist-lib/lib/contract/exec.d.ts +1 -0
- package/dist-lib/lib/contract/index.d.ts +1 -0
- package/dist-lib/lib/contract/knowledge.d.ts +10 -0
- package/dist-lib/lib/contract/media.d.ts +58 -0
- package/dist-lib/lib/contract/models.d.ts +6 -2
- package/dist-lib/lib/contract/ocr.d.ts +17 -0
- package/dist-lib/lib/contract/ocr.js +1 -0
- package/dist-lib/lib/contract/root-search.d.ts +34 -0
- package/dist-lib/lib/contract/root-search.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +13 -0
- package/dist-lib/lib/contract-types.d.ts +10 -2
- package/dist-lib/lib/docx/index.js +1 -1
- package/dist-lib/lib/errors.d.ts +8 -4
- package/dist-lib/lib/errors.js +12 -8
- package/dist-lib/lib/fold/index.d.ts +4 -2
- package/dist-lib/lib/fold/index.js +15 -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/gpu-probe-addon.js +26 -11
- package/dist-lib/lib/hardware/gpu-stats.native.cjs +17 -1
- package/dist-lib/lib/helpers/completion-params.d.ts +2 -1
- package/dist-lib/lib/helpers/completion-params.js +18 -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/drain.d.ts +1 -1
- package/dist-lib/lib/helpers/drain.js +1 -1
- 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 -6
- package/dist-lib/lib/helpers/goal-check.js +34 -98
- package/dist-lib/lib/helpers/html-helpers.js +9 -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 +9 -2
- package/dist-lib/lib/helpers/root-search.d.ts +3 -0
- package/dist-lib/lib/helpers/root-search.js +74 -0
- package/dist-lib/lib/helpers/run-latency.d.ts +14 -0
- package/dist-lib/lib/helpers/run-latency.js +63 -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/stable-stringify.js +10 -2
- package/dist-lib/lib/helpers/text-coalescer.d.ts +6 -0
- package/dist-lib/lib/helpers/text-coalescer.js +44 -4
- 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 +157 -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/lifecycle/completion-run.js +2 -2
- package/dist-lib/lib/log.d.ts +3 -0
- package/dist-lib/lib/log.js +17 -1
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +13 -16
- package/dist-lib/lib/machine/completion/actions/completion.js +110 -138
- 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 +2 -1
- 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 +73 -151
- package/dist-lib/lib/machine/completion/context.js +6 -1
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +2 -1
- package/dist-lib/lib/machine/completion/guards/retry.js +4 -3
- package/dist-lib/lib/machine/completion/implementations.d.ts +8 -5
- package/dist-lib/lib/machine/completion/implementations.js +22 -7
- package/dist-lib/lib/machine/completion/machine.d.ts +15 -6
- package/dist-lib/lib/machine/completion/machine.js +25 -5
- package/dist-lib/lib/machine/completion/metrics.d.ts +25 -0
- package/dist-lib/lib/machine/completion/metrics.js +70 -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 +10 -33
- package/dist-lib/lib/machine/completion/rules.js +27 -103
- 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 +37 -13
- package/dist-lib/lib/machine/index.d.ts +21 -7
- package/dist-lib/lib/machine/index.js +7 -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.js +8 -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/gguf-header.d.ts +6 -0
- package/dist-lib/lib/models/gguf-header.js +38 -1
- 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.js +27 -1
- 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/model-catalog-constants.d.ts +3 -2
- package/dist-lib/lib/models/model-catalog-constants.js +8 -5
- package/dist-lib/lib/models/model-catalog.d.ts +12 -3
- package/dist-lib/lib/models/model-catalog.js +40 -16
- package/dist-lib/lib/models/model-delete.js +3 -0
- package/dist-lib/lib/models/model-handle.d.ts +1 -0
- package/dist-lib/lib/models/model-list.d.ts +2 -1
- package/dist-lib/lib/models/model-list.js +5 -1
- package/dist-lib/lib/models/model-pool.d.ts +7 -1
- package/dist-lib/lib/models/model-pool.js +34 -13
- 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-impl.d.ts +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +45 -8
- package/dist-lib/lib/office/index.js +1 -1
- package/dist-lib/lib/plugins/registry.d.ts +12 -0
- package/dist-lib/lib/plugins/registry.js +71 -15
- 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/prompt.d.ts +7 -4
- package/dist-lib/lib/prompt.js +81 -24
- package/dist-lib/lib/residency/completion-runtime.d.ts +8 -6
- package/dist-lib/lib/residency/completion-runtime.js +53 -9
- package/dist-lib/lib/residency/index.d.ts +12 -3
- package/dist-lib/lib/residency/index.js +52 -16
- package/dist-lib/lib/round-host.js +3 -3
- package/dist-lib/lib/round-port.js +3 -3
- package/dist-lib/lib/run-log/boundary.d.ts +1 -4
- package/dist-lib/lib/run-log/boundary.js +4 -21
- package/dist-lib/lib/run-log/history-codec.d.ts +1 -1
- package/dist-lib/lib/run-log/history-codec.js +3 -3
- package/dist-lib/lib/run-log/protocol.js +17 -16
- package/dist-lib/lib/run-log/redact.d.ts +10 -1
- package/dist-lib/lib/run-log/redact.js +99 -9
- package/dist-lib/lib/run-log/request-codec.d.ts +3 -0
- package/dist-lib/lib/run-log/request-codec.js +19 -4
- package/dist-lib/lib/run-log/run-journal.js +1 -1
- package/dist-lib/lib/sdk-loader.d.ts +1 -0
- package/dist-lib/lib/sdk-loader.js +14 -0
- package/dist-lib/lib/serve/completion.d.ts +7 -0
- package/dist-lib/lib/serve/completion.js +571 -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 +148 -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 +37 -0
- package/dist-lib/lib/serve/run-log-start.js +253 -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 +23 -995
- package/dist-lib/lib/sidecar/index.d.ts +1 -1
- package/dist-lib/lib/sidecar/index.js +11 -19
- package/dist-lib/lib/sidecar/user-plugins.js +6 -4
- package/dist-lib/lib/skills-host/index.d.ts +6 -3
- package/dist-lib/lib/skills-host/index.js +39 -18
- package/dist-lib/lib/spawn.d.ts +14 -0
- package/dist-lib/lib/spawn.js +9 -5
- 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 +18 -22
- package/dist-lib/lib/tools/exec/runner.d.ts +4 -0
- package/dist-lib/lib/tools/exec/runner.js +20 -3
- package/dist-lib/lib/tools/exec/shell-guidance.d.ts +2 -0
- package/dist-lib/lib/tools/exec/shell-guidance.js +29 -0
- package/dist-lib/lib/tools/exec.js +4 -2
- package/dist-lib/lib/tools/files/edit-file.d.ts +4 -1
- package/dist-lib/lib/tools/files/edit-file.js +220 -28
- package/dist-lib/lib/tools/files/glob.js +72 -11
- package/dist-lib/lib/tools/files/grep.js +65 -22
- package/dist-lib/lib/tools/files/index.js +3 -1
- package/dist-lib/lib/tools/files/read-file.js +199 -36
- package/dist-lib/lib/tools/fs/document-text.d.ts +7 -1
- package/dist-lib/lib/tools/fs/document-text.js +5 -21
- package/dist-lib/lib/tools/fs/drive.d.ts +1 -17
- package/dist-lib/lib/tools/fs/edit-match.d.ts +22 -0
- package/dist-lib/lib/tools/fs/edit-match.js +337 -45
- package/dist-lib/lib/tools/fs/engine.d.ts +9 -0
- package/dist-lib/lib/tools/fs/engine.js +28 -0
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +1 -81
- package/dist-lib/lib/tools/fs/scope.d.ts +2 -17
- package/dist-lib/lib/tools/fs/search.d.ts +2 -18
- package/dist-lib/lib/tools/fs/suggest.d.ts +8 -0
- package/dist-lib/lib/tools/fs/suggest.js +110 -0
- package/dist-lib/lib/tools/fs/tool-path.d.ts +3 -0
- package/dist-lib/lib/tools/fs/tool-path.js +13 -0
- package/dist-lib/lib/tools/fs/walk.d.ts +5 -5
- package/dist-lib/lib/tools/fs/walk.js +22 -21
- 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 +93 -14
- package/dist-lib/lib/tools/index.d.ts +3 -1
- package/dist-lib/lib/tools/index.js +6 -2
- 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 +3 -2
- package/dist-lib/lib/tools/office.js +200 -39
- 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 +13 -3
- package/dist-lib/lib/tools/pdf/build.js +52 -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 +42 -14
- package/dist-lib/lib/tools/skill.js +13 -4
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +8 -1
- package/dist-lib/lib/tools/skills/bundled-dir.js +38 -32
- 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 +5 -8
- package/dist-lib/lib/tools/skills/catalog.js +1 -162
- 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/index.d.ts +1 -0
- package/dist-lib/lib/tools/skills/index.js +1 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +27 -3
- package/dist-lib/lib/tools/skills/manifest.d.ts +1 -0
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +3 -3
- package/dist-lib/lib/tools/skills/overlay-crud.js +4 -4
- 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-tree.d.ts +5 -0
- package/dist-lib/lib/tools/skills/skill-tree.js +54 -0
- package/dist-lib/lib/tools/tls-failure.d.ts +1 -0
- package/dist-lib/lib/tools/tls-failure.js +8 -0
- package/dist-lib/lib/tools/toolsets.d.ts +1 -1
- package/dist-lib/lib/tools/toolsets.js +2 -0
- package/dist-lib/lib/tools/web-fetch.js +46 -130
- 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 -77
- package/dist-lib/lib/wire.js +24 -463
- package/dist-lib/plugins/charts/chart-tool.d.ts +8 -0
- package/dist-lib/plugins/charts/chart-tool.js +175 -0
- package/dist-lib/plugins/charts/index.d.ts +16 -0
- package/dist-lib/plugins/charts/index.js +21 -0
- 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/diagrams/draw.d.ts +10 -0
- package/dist-lib/plugins/diagrams/draw.js +90 -0
- package/dist-lib/plugins/diagrams/index.d.ts +13 -0
- package/dist-lib/plugins/diagrams/index.js +15 -0
- package/dist-lib/plugins/diagrams/render.d.ts +16 -0
- package/dist-lib/plugins/diagrams/render.js +285 -0
- package/dist-lib/plugins/image/edit-image.d.ts +3 -22
- package/dist-lib/plugins/image/edit-image.js +20 -44
- 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 +24 -4
- package/dist-lib/plugins/image/generate-image.js +198 -72
- package/dist-lib/plugins/image/index.d.ts +2 -1
- package/dist-lib/plugins/image/index.js +17 -8
- 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/mcp/call.js +15 -4
- package/dist-lib/plugins/mcp/protocol.d.ts +10 -2
- package/dist-lib/plugins/mcp/protocol.js +13 -12
- 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 +21 -4
- package/dist-lib/plugins/music/generate-music.js +168 -65
- package/dist-lib/plugins/music/index.d.ts +2 -1
- package/dist-lib/plugins/music/index.js +11 -6
- package/dist-lib/plugins/obsidian/index.js +14 -4
- 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/index.d.ts +4 -1
- package/dist-lib/plugins/python/index.js +5 -1
- package/dist-lib/plugins/python/language.js +11 -10
- package/dist-lib/plugins/python/python-adapter.d.ts +6 -1
- package/dist-lib/plugins/python/python-adapter.js +34 -1
- package/dist-lib/plugins/python/worker/client.js +1 -1
- 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/spawn.js +1 -1
- package/dist-lib/plugins/ripgrep/index.d.ts +15 -0
- package/dist-lib/plugins/ripgrep/index.js +28 -0
- package/dist-lib/plugins/run-report/story.js +4 -1
- package/dist-lib/plugins/sandbox-linux/index.js +2 -2
- package/dist-lib/plugins/sandbox-macos/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/index.d.ts +2 -1
- package/dist-lib/plugins/sandbox-vm/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +3 -1
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +45 -16
- package/dist-lib/plugins/sandbox-windows/index.js +2 -2
- 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/speech-engine.d.ts +1 -1
- package/dist-lib/plugins/speech/speech-engine.js +10 -5
- 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.js +7 -2
- package/dist-lib/plugins/walkie-talkie/index.d.ts +2 -0
- package/dist-lib/plugins/walkie-talkie/index.js +6 -1
- package/dist-lib/plugins/weather/lookup.js +1 -0
- package/dist-lib/schema/baseline.d.ts +2 -1
- package/dist-lib/schema/baseline.js +2 -2
- package/dist-lib/schema/generate.js +8 -1
- package/dist-lib/schema/harness.js +34 -5
- package/dist-lib/schema/release-tags.d.ts +2 -1
- package/dist-lib/schema/release-tags.js +9 -10
- package/dist-lib/spec/bind.js +3 -0
- package/dist-lib/spec/calls.js +1 -0
- package/dist-lib/spec/hrpc/hrpc.json +13 -0
- package/dist-lib/spec/hrpc/index.js +15 -3
- package/dist-lib/spec/hrpc/messages.js +126 -13
- package/dist-lib/spec/hyperschema/index.js +126 -13
- package/dist-lib/spec/hyperschema/schema.json +86 -2
- package/dist-lib/spec/hyperschema/types.d.ts +18 -3
- package/package.json +96 -36
- package/scripts/addon-externals.cjs +7 -1
- package/worker/harness-sidecar.mjs +10 -0
- package/dist-lib/lib/helpers/buffer-burst.d.ts +0 -1
- package/dist-lib/lib/helpers/buffer-burst.js +0 -22
- package/dist-lib/lib/office/engine/codes.d.ts +0 -62
- package/dist-lib/lib/office/engine/codes.js +0 -61
- package/dist-lib/lib/office/engine/docx/document.d.ts +0 -216
- package/dist-lib/lib/office/engine/docx/document.js +0 -1152
- package/dist-lib/lib/office/engine/docx/index.d.ts +0 -7
- package/dist-lib/lib/office/engine/docx/index.js +0 -8
- package/dist-lib/lib/office/engine/docx/styles.d.ts +0 -31
- package/dist-lib/lib/office/engine/docx/styles.js +0 -173
- package/dist-lib/lib/office/engine/docx/template.d.ts +0 -18
- package/dist-lib/lib/office/engine/docx/template.js +0 -133
- package/dist-lib/lib/office/engine/docx/text.d.ts +0 -55
- package/dist-lib/lib/office/engine/docx/text.js +0 -538
- package/dist-lib/lib/office/engine/drawingml/chart.d.ts +0 -63
- package/dist-lib/lib/office/engine/drawingml/chart.js +0 -539
- package/dist-lib/lib/office/engine/drawingml/text.d.ts +0 -35
- package/dist-lib/lib/office/engine/drawingml/text.js +0 -352
- package/dist-lib/lib/office/engine/errors.d.ts +0 -6
- package/dist-lib/lib/office/engine/errors.js +0 -12
- package/dist-lib/lib/office/engine/image.d.ts +0 -8
- package/dist-lib/lib/office/engine/image.js +0 -48
- package/dist-lib/lib/office/engine/index.d.ts +0 -12
- package/dist-lib/lib/office/engine/index.js +0 -7
- package/dist-lib/lib/office/engine/opc/content-types.d.ts +0 -17
- package/dist-lib/lib/office/engine/opc/content-types.js +0 -74
- package/dist-lib/lib/office/engine/opc/media.d.ts +0 -13
- package/dist-lib/lib/office/engine/opc/media.js +0 -11
- package/dist-lib/lib/office/engine/opc/package.d.ts +0 -51
- package/dist-lib/lib/office/engine/opc/package.js +0 -324
- package/dist-lib/lib/office/engine/opc/paths.d.ts +0 -7
- package/dist-lib/lib/office/engine/opc/paths.js +0 -46
- package/dist-lib/lib/office/engine/opc/properties.d.ts +0 -7
- package/dist-lib/lib/office/engine/opc/properties.js +0 -75
- package/dist-lib/lib/office/engine/opc/relationships.d.ts +0 -23
- package/dist-lib/lib/office/engine/opc/relationships.js +0 -65
- package/dist-lib/lib/office/engine/opc/zip.d.ts +0 -15
- package/dist-lib/lib/office/engine/opc/zip.js +0 -264
- package/dist-lib/lib/office/engine/pptx/fit.d.ts +0 -12
- package/dist-lib/lib/office/engine/pptx/fit.js +0 -37
- package/dist-lib/lib/office/engine/pptx/index.d.ts +0 -8
- package/dist-lib/lib/office/engine/pptx/index.js +0 -8
- package/dist-lib/lib/office/engine/pptx/inherit.d.ts +0 -29
- package/dist-lib/lib/office/engine/pptx/inherit.js +0 -155
- package/dist-lib/lib/office/engine/pptx/notes.d.ts +0 -5
- package/dist-lib/lib/office/engine/pptx/notes.js +0 -85
- package/dist-lib/lib/office/engine/pptx/picture-area.d.ts +0 -23
- package/dist-lib/lib/office/engine/pptx/picture-area.js +0 -84
- package/dist-lib/lib/office/engine/pptx/presentation.d.ts +0 -56
- package/dist-lib/lib/office/engine/pptx/presentation.js +0 -787
- package/dist-lib/lib/office/engine/pptx/read.d.ts +0 -9
- package/dist-lib/lib/office/engine/pptx/read.js +0 -66
- package/dist-lib/lib/office/engine/pptx/shapes.d.ts +0 -52
- package/dist-lib/lib/office/engine/pptx/shapes.js +0 -276
- package/dist-lib/lib/office/engine/pptx/slides.d.ts +0 -27
- package/dist-lib/lib/office/engine/pptx/slides.js +0 -123
- package/dist-lib/lib/office/engine/pptx/template.d.ts +0 -20
- package/dist-lib/lib/office/engine/pptx/template.js +0 -391
- package/dist-lib/lib/office/engine/pptx/types.d.ts +0 -121
- package/dist-lib/lib/office/engine/units.d.ts +0 -3
- package/dist-lib/lib/office/engine/units.js +0 -12
- package/dist-lib/lib/office/engine/utf8.d.ts +0 -2
- package/dist-lib/lib/office/engine/utf8.js +0 -103
- package/dist-lib/lib/office/engine/xlsx/formula.d.ts +0 -49
- package/dist-lib/lib/office/engine/xlsx/formula.js +0 -381
- package/dist-lib/lib/office/engine/xlsx/index.d.ts +0 -8
- package/dist-lib/lib/office/engine/xlsx/index.js +0 -8
- package/dist-lib/lib/office/engine/xlsx/refs.d.ts +0 -22
- package/dist-lib/lib/office/engine/xlsx/refs.js +0 -82
- package/dist-lib/lib/office/engine/xlsx/reshape.d.ts +0 -21
- package/dist-lib/lib/office/engine/xlsx/reshape.js +0 -424
- package/dist-lib/lib/office/engine/xlsx/sheet.d.ts +0 -108
- package/dist-lib/lib/office/engine/xlsx/sheet.js +0 -662
- package/dist-lib/lib/office/engine/xlsx/strings.d.ts +0 -15
- package/dist-lib/lib/office/engine/xlsx/strings.js +0 -93
- package/dist-lib/lib/office/engine/xlsx/styles.d.ts +0 -38
- package/dist-lib/lib/office/engine/xlsx/styles.js +0 -369
- package/dist-lib/lib/office/engine/xlsx/template.d.ts +0 -7
- package/dist-lib/lib/office/engine/xlsx/template.js +0 -54
- package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +0 -162
- package/dist-lib/lib/office/engine/xlsx/workbook.js +0 -881
- package/dist-lib/lib/office/engine/xlsx/write.d.ts +0 -2
- package/dist-lib/lib/office/engine/xlsx/write.js +0 -42
- package/dist-lib/lib/office/engine/xml.d.ts +0 -45
- package/dist-lib/lib/office/engine/xml.js +0 -258
- package/patches/localwatch@1.4.3.patch +0 -13
- /package/dist-lib/lib/{office/engine/pptx/types.js → contract/media.js} +0 -0
package/NOTICE.md
CHANGED
|
@@ -11,19 +11,3 @@ distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
11
11
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
See the License for the specific language governing permissions and
|
|
13
13
|
limitations under the License.
|
|
14
|
-
|
|
15
|
-
## Third-party components
|
|
16
|
-
|
|
17
|
-
### @xmldom/xmldom
|
|
18
|
-
|
|
19
|
-
XML parsing and serialization for the office engine. Copyright 2019 - present
|
|
20
|
-
Christopher J. Brody and other contributors; Copyright 2012 - 2017 @jindw and
|
|
21
|
-
other contributors. Licensed under the MIT License.
|
|
22
|
-
<https://github.com/xmldom/xmldom>
|
|
23
|
-
|
|
24
|
-
## Test data
|
|
25
|
-
|
|
26
|
-
The files under `test/fixtures/office-corpus` are taken from the Apache POI test
|
|
27
|
-
data. Copyright The Apache Software Foundation. Licensed under the Apache
|
|
28
|
-
License, Version 2.0. <https://github.com/apache/poi>. They are used by the test
|
|
29
|
-
suite only and are not part of the published package.
|
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
<a href="#plugins">Plugins</a> ·
|
|
23
23
|
<a href="#examples">Examples</a> ·
|
|
24
24
|
<a href="#host-it">Host it</a> ·
|
|
25
|
+
<a href="docs/runtime-support.md">Runtime support</a> ·
|
|
25
26
|
<a href="#development">Development</a>
|
|
26
27
|
</p>
|
|
27
28
|
|
|
@@ -99,6 +100,12 @@ Built-in tools read and edit files only inside folders you grant (`grantedDirs`,
|
|
|
99
100
|
`grantedWriteDirs`), and never inside the app's own storage. They also read, edit and create Word,
|
|
100
101
|
Excel, PowerPoint and PDF files on device, in TypeScript, with no Python and no cloud.
|
|
101
102
|
|
|
103
|
+
A writable folder also enables `insert_text` and `edit_many` by default. Use `insert_text` to add
|
|
104
|
+
lines after a checked line, or at the start or end; use `edit_many` for several replacements in
|
|
105
|
+
one file, matched against the original content and validated together before writing. Both ask
|
|
106
|
+
for approval. `edit_file` keeps its existing single-replacement interface. Disable the `files`
|
|
107
|
+
toolset to hide file tools, or pass `files: false` when composing `Tools.product`.
|
|
108
|
+
|
|
102
109
|
### Large tool sets, on demand
|
|
103
110
|
|
|
104
111
|
Mark a tool `defer: true` and the model sees only its name, grouped under `group`, until it calls
|
|
@@ -193,12 +200,43 @@ const delegate = Agent.delegateTool(harness, base, { targets })
|
|
|
193
200
|
`plan: true` gives an agent `update_plan`, a checklist it sees after every round. A `goal` keeps the
|
|
194
201
|
run going until every step is done or a budget runs out. A goal's `checks` are commands the result
|
|
195
202
|
is judged by, and until they pass each goal turn names the check and the output of its failed run.
|
|
196
|
-
On a run with a tool that takes a `command`, the model
|
|
203
|
+
On a run with a tool that takes a `command`, the model is also asked to name its own checks under a
|
|
197
204
|
`Checks:` line, and the goal is met only once every check, the host's and the model's, ran in a
|
|
198
|
-
call's `command` and exited 0
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
205
|
+
call's `command` and exited 0. With no tool that takes a `command` and no host checks, the goal ends
|
|
206
|
+
when the plan is done; host checks need a tool that takes a `command`, or the goal runs to its
|
|
207
|
+
budget.
|
|
208
|
+
|
|
209
|
+
The ask stops after two goal turns the model ignores. From then on the plan and any host checks,
|
|
210
|
+
such as `npm test`, meet the goal once the gates below hold. When every host check only tests that a
|
|
211
|
+
path exists (`test -s out.txt`, `[ -f out.txt ]`), a passing test runner, test script or assertion
|
|
212
|
+
also counts as a check the model named. Such a goal is met only once its checks pass and one of them
|
|
213
|
+
names a path the host checks test, runs a script the model wrote that names one, or runs a test
|
|
214
|
+
runner on no given script, such as `npm test` or `pytest`. `cat`, `ls` and other commands that only
|
|
215
|
+
show or move a file do not count, nor does a `test` with no comparison. While every check passes and
|
|
216
|
+
none does this, each goal turn asks for such a check, and until one does, the checks the model names
|
|
217
|
+
are added. A check wrapped in `timeout`, `env`, `nice` or `stdbuf` counts as the command it runs.
|
|
218
|
+
|
|
219
|
+
On a run with a tool that takes a `command`, three more gates hold on every goal. Once the model
|
|
220
|
+
writes a source file, known by its extension (`.py`, `.js`, `.ts`, `.sh`, `.go`, `.rs`, `.c`,
|
|
221
|
+
`.java` and the like, not `.txt`, `.json`, `.csv` or `.md`), the goal is met only after a later
|
|
222
|
+
command runs that code and exits 0; once the checks pass, each goal turn asks for that run. A run
|
|
223
|
+
counts when it runs the file as a program or through its interpreter, runs a test suite (`pytest`,
|
|
224
|
+
`npm test`, `cargo test`, `go test`) or a test script, builds and runs the project (`go run .`,
|
|
225
|
+
`cargo run`, or a build then a run in one command), or is a passing check that runs a script or a
|
|
226
|
+
test suite. `cat`, `grep`, `diff` and other commands that only read a file do not count, nor does a
|
|
227
|
+
compile, lint or syntax check, nor a run piped or followed by `|| true` or `;`. Another write to a
|
|
228
|
+
source file needs a new run. Once the checks pass and the code ran, one goal turn asks the model to
|
|
229
|
+
list each requirement of the task with the command that proves it and the output it gave, then,
|
|
230
|
+
under a `Checks:` line, a command for each requirement nothing proved. The reply answers it only
|
|
231
|
+
when a line above its `Checks:` names, in backticks, a passed check or the run that proved the code;
|
|
232
|
+
otherwise the turn is asked again, at most twice in all. The commands it names under `Checks:` are
|
|
233
|
+
added. A goal met with more than half of each budget left (time, rounds, and the goal's tokens when
|
|
234
|
+
it caps them) then takes one turn on the cases the task names. `checksProve: true` says the host
|
|
235
|
+
checks prove the task: the goal skips the ask and the gate on the paths, and still takes the run
|
|
236
|
+
gate, the review turn and the cases turn. It has no effect without checks. On every goal,
|
|
237
|
+
`checksProve` included, a write to a script resets the pass of each check that runs it, so the check
|
|
238
|
+
must pass again.
|
|
239
|
+
|
|
202
240
|
`planMode` refuses writes until the user approves the plan.
|
|
203
241
|
|
|
204
242
|
```ts
|
|
@@ -270,6 +308,7 @@ itself.
|
|
|
270
308
|
| [`WalkieTalkie`](plugins/walkie-talkie/README.md) | Two-way comms with agents and people on other machines, over Hyperswarm |
|
|
271
309
|
| [`RunReport`](plugins/run-report/README.md) | A run as a flowchart played back step by step, with why; records through `hopLog`, not `plugins` |
|
|
272
310
|
| [`CodingPlugin`](plugins/coding/README.md) | A shell that keeps its place, background jobs |
|
|
311
|
+
| [`CodingGuards`](plugins/coding-guards/README.md) | Stops a coding model rewriting files in a loop, and tells it when nothing here can run |
|
|
273
312
|
| [`LspPlugin`](plugins/lsp/README.md) | Definitions, references, symbols and diagnostics from language servers |
|
|
274
313
|
| [`McpPlugin`](plugins/mcp/README.md) | The tools of any HTTP MCP server |
|
|
275
314
|
| [`CodeMode`](plugins/code-mode/README.md) | `run_code`: a script that calls the other tools |
|
|
@@ -288,6 +327,8 @@ itself.
|
|
|
288
327
|
| [`TranslationPlugin`](plugins/translation/README.md) | Translation on device |
|
|
289
328
|
| [`LanguageHint`](plugins/language-hint/README.md) | A prompt in another language, in English too, for the model |
|
|
290
329
|
| [`Weather`](plugins/weather/README.md) | Weather lookup |
|
|
330
|
+
| [`Diagrams`](plugins/diagrams/README.md) | Diagrams drawn from a type and its links, as the Mermaid the app renders |
|
|
331
|
+
| [`Charts`](plugins/charts/README.md) | Charts drawn from numbers the model describes, as an SVG attachment |
|
|
291
332
|
| [`ObsidianRoute`](plugins/obsidian/README.md) | `obsidian …` commands against a vault |
|
|
292
333
|
|
|
293
334
|
Each plugin is imported from `@qvac/harness/plugins/<folder>`. Its own dependencies are optional
|
package/dist-lib/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
|
2
2
|
import ReadyResource from 'ready-resource';
|
|
3
3
|
import { Policy } from './lib/policy/index.ts';
|
|
4
4
|
import type { EngineBoot, EngineStep, RecoveryResolution } from './lib/run-log/index.ts';
|
|
5
|
-
import { type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult } from './lib/capabilities/completion-engine/index.ts';
|
|
6
|
-
import type { AccessPolicy, AgentConfig, ApproveFn, AskUserFn, AttachFn, CompletionEvent, FetchAttachmentFn, Message, ProgressFn, ResponseFormat, RunGoal, RunInput, ToolDefinition, ToolExecuteContext } from './lib/contract/index.ts';
|
|
5
|
+
import { type CompletionArgs, type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult } from './lib/capabilities/completion-engine/index.ts';
|
|
6
|
+
import type { AccessPolicy, AgentConfig, ApproveFn, AskUserFn, AttachFn, CompletionEvent, FetchAttachmentFn, MediaRoundIo, MediaRoundPort, MediaRoundRequest, MediaRoundResult, Message, ProgressFn, WorkspaceSkill, ResponseFormat, RunGoal, RunInput, ShowImageFn, ToolDefinition, ToolExecuteContext, ProjectSkill } from './lib/contract/index.ts';
|
|
7
7
|
import { type DetectLanguageContext, type DetectedLanguage } from './lib/capabilities/detect-language.ts';
|
|
8
8
|
import { type Capability } from './lib/capabilities/invoke.ts';
|
|
9
9
|
import { type ModelSourcePreview, type PreviewModelSourceContext } from './lib/capabilities/preview-model-source.ts';
|
|
@@ -12,8 +12,10 @@ import { type DownloadArgs, type DownloadEventStream } from './lib/capabilities/
|
|
|
12
12
|
import type { EmbedContext } from './lib/capabilities/embed.ts';
|
|
13
13
|
import { type KvCacheDeletionResult } from './lib/capabilities/kv-cache.ts';
|
|
14
14
|
import type { LlmGenerationParams } from './lib/models/llm-presets.ts';
|
|
15
|
+
import type { OcrPage, OcrReadContext } from './lib/contract/ocr.ts';
|
|
15
16
|
import type { SpeakContext, SpeakResult, SpeakStreamContext, TranscribeContext } from './lib/contract/speech.ts';
|
|
16
17
|
import type { CapabilityInfo, CredentialEntry, HarnessDiagnostics, InfraModel, LoadModelResult, MemoryUsage, SkillWriteResult, UnloadModelContext, UnloadModelResult } from './lib/contract-types.ts';
|
|
18
|
+
import { RunLatency } from './lib/helpers/run-latency.ts';
|
|
17
19
|
import { type CustomModelEntry } from './lib/models/model-catalog.ts';
|
|
18
20
|
import { type ListModelsOptions, type ModelInfo } from './lib/models/model-list.ts';
|
|
19
21
|
import { type DeleteModelSummary } from './lib/models/model-delete.ts';
|
|
@@ -31,6 +33,7 @@ import type { ResolvedSkillCatalogEntry } from './lib/tools/skills/catalog.ts';
|
|
|
31
33
|
import type { SkillSettingEntry } from './lib/tools/skills/skill-settings.ts';
|
|
32
34
|
export type * from './lib/contract/index.ts';
|
|
33
35
|
export { CompletionEngine, type CompletionArgs, type CompletionEngineOptions, type CompletionRun, type ModelRoundEvent, type ModelRoundIo, type ModelRoundPort, type ModelRoundRequest, type ModelRoundResult, ToolSets } from './lib/capabilities/completion-engine/index.ts';
|
|
36
|
+
export { renderedTools } from './lib/capabilities/sdk-tool.ts';
|
|
34
37
|
export declare const CONTEXT_OVERFLOW_MESSAGE: string;
|
|
35
38
|
export { imageSettingsFrom } from './lib/helpers/image-settings.ts';
|
|
36
39
|
export { skillInContext, unreadySkillState, type CompletionSkillEntry } from './lib/capabilities/skill-entry.ts';
|
|
@@ -43,6 +46,8 @@ export type { ModelSourceFile, ModelSourcePreview, ModelSourceRefusal, PreviewMo
|
|
|
43
46
|
export type { ModelFitBasis, ModelFitEvidence, ModelFitVerdict } from './lib/models/model-fit.ts';
|
|
44
47
|
export * from './lib/capabilities/download.ts';
|
|
45
48
|
export type { EmbedContext } from './lib/capabilities/embed.ts';
|
|
49
|
+
export type { OcrImage, OcrPage, OcrReadContext, OcrService } from './lib/contract/ocr.ts';
|
|
50
|
+
export type { RootSearch, RootSearchQuery, RootSearchResult, RootSearchScope, RootWalkResult } from './lib/contract/root-search.ts';
|
|
46
51
|
export type { SpeakContext, SpeakResult, SpeakStreamContext, SpeechService, TranscribeContext } from './lib/contract/speech.ts';
|
|
47
52
|
export type { EmbedDevice } from './lib/models/embed-config.ts';
|
|
48
53
|
export type { MemoryBudget } from './lib/hardware/memory-budget.ts';
|
|
@@ -51,7 +56,7 @@ export * from './lib/models/model-list.ts';
|
|
|
51
56
|
export type { ModelTaskType } from './lib/models/model-task.ts';
|
|
52
57
|
export type { DeleteModelResult, DeleteModelSummary } from './lib/models/model-delete.ts';
|
|
53
58
|
export type { RecoveryResolution } from './lib/run-log/index.ts';
|
|
54
|
-
export { harnessChild, spawnHarness, type HarnessChildOptions, type HarnessKnowledgeConfig, type HarnessMcpServer, type HarnessPluginOptions, type HarnessSpeechOptions, type SpawnHarnessOptions } from './lib/spawn.ts';
|
|
59
|
+
export { harnessChild, spawnHarness, type HarnessChartsOptions, type HarnessChildOptions, type HarnessKnowledgeConfig, type HarnessMcpServer, type HarnessPluginOptions, type HarnessSpeechOptions, type SpawnHarnessOptions } from './lib/spawn.ts';
|
|
55
60
|
export * from './lib/tools/skills/catalog.ts';
|
|
56
61
|
export { requiredSettings, settingEnvName, type SkillSettingEntry, type SkillSettingsFn } from './lib/tools/skills/skill-settings.ts';
|
|
57
62
|
export type { ToolCatalogEntry } from './lib/tools/catalog.ts';
|
|
@@ -66,7 +71,7 @@ export type { ConnectOptions, HostRunLog, HostRunLogLease } from './lib/connect.
|
|
|
66
71
|
export type { KvCacheDeletionResult } from './lib/capabilities/kv-cache.ts';
|
|
67
72
|
export type { AgentKnobs, ApprovalCall, ChatMessage, CredentialEntry, DownloadContext, HarnessContract, HarnessDiagnostics, HarnessEvent, HarnessInfo, HarnessStatus, InfraModel, LoadedModel, LoadFit, ModelState, SkillsOptions, SkillWriteResult } from './lib/contract-types.ts';
|
|
68
73
|
import type { DownloadsAllowedOptions, HarnessInfo } from './lib/contract-types.ts';
|
|
69
|
-
export
|
|
74
|
+
export declare const serveHarness: (stream: import("./lib/rpc-session.ts").Stream, harness: import("./index.ts").HarnessContract) => void;
|
|
70
75
|
export { HarnessLog };
|
|
71
76
|
export type { LogLevel } from './lib/log.ts';
|
|
72
77
|
export declare const harnessLog: typeof HarnessLog;
|
|
@@ -129,21 +134,13 @@ export interface CompletionContext {
|
|
|
129
134
|
planMode?: boolean;
|
|
130
135
|
deferTools?: boolean;
|
|
131
136
|
goal?: RunGoal;
|
|
132
|
-
wording?:
|
|
133
|
-
toolContinuation?: string;
|
|
134
|
-
fileDelivered?: string;
|
|
135
|
-
toolDenied?: string;
|
|
136
|
-
toolCutOff?: string;
|
|
137
|
-
toolRoundCut?: string;
|
|
138
|
-
toolContextBoundary?: string;
|
|
139
|
-
toolRepeated?: string;
|
|
140
|
-
toolUnchanged?: string;
|
|
141
|
-
goalContinuation?: string;
|
|
142
|
-
};
|
|
137
|
+
wording?: CompletionArgs['wording'];
|
|
143
138
|
resume?: boolean;
|
|
144
139
|
recovery?: RecoveryResolution[];
|
|
145
140
|
model: string;
|
|
146
141
|
agent?: AgentConfig;
|
|
142
|
+
projectSkills?: readonly ProjectSkill[];
|
|
143
|
+
workspaceSkills?: readonly WorkspaceSkill[];
|
|
147
144
|
agents?: Record<string, AgentConfig>;
|
|
148
145
|
messages: Message[];
|
|
149
146
|
typedText?: string;
|
|
@@ -162,16 +159,18 @@ export interface CompletionContext {
|
|
|
162
159
|
approve?: ApproveFn;
|
|
163
160
|
attach?: AttachFn;
|
|
164
161
|
fetchAttachment?: FetchAttachmentFn;
|
|
162
|
+
showImage?: ShowImageFn;
|
|
165
163
|
progress?: ProgressFn;
|
|
166
164
|
askUser?: AskUserFn;
|
|
167
165
|
boot?: EngineBoot;
|
|
168
166
|
onStep?: (step: EngineStep) => Promise<void>;
|
|
169
|
-
hostAppendTimeoutMs?: number;
|
|
170
167
|
requestDigestKey?: Uint8Array;
|
|
171
168
|
signal?: BareAbortSignal;
|
|
172
169
|
input?: AsyncIterable<RunInput>;
|
|
173
170
|
roundCut?: (cut: (note: string) => void) => void;
|
|
174
171
|
modelRound?: ModelRoundPort;
|
|
172
|
+
mediaRound?: MediaRoundPort;
|
|
173
|
+
latency?: RunLatency;
|
|
175
174
|
hopLog?: (hop: RunHop) => RunHopLog;
|
|
176
175
|
}
|
|
177
176
|
export interface RunHop {
|
|
@@ -221,6 +220,7 @@ export declare class Harness extends ReadyResource {
|
|
|
221
220
|
private _shell;
|
|
222
221
|
private _projectionModel;
|
|
223
222
|
private _customProjection;
|
|
223
|
+
private readonly _speculative;
|
|
224
224
|
private readonly _contextSize?;
|
|
225
225
|
private readonly _recentFits;
|
|
226
226
|
private readonly _gpuStats?;
|
|
@@ -229,6 +229,7 @@ export declare class Harness extends ReadyResource {
|
|
|
229
229
|
private readonly _hostHooks;
|
|
230
230
|
private _hooks;
|
|
231
231
|
private readonly _plugins;
|
|
232
|
+
private readonly _prefix;
|
|
232
233
|
private readonly _pluginMode;
|
|
233
234
|
private _pluginsStarted;
|
|
234
235
|
constructor({ tools, sdkLoader, skillsDir, modelsDir, sdkHome, exec, projectionModel, llmDevice, llmGpuLayers, contextSize, kvCacheK, kvCacheV, llmLoad, slots, embedDevice, embedGpuLayers, embedBatchSize, transcriptionDevice, completionModelCap, credentialStore, platform, gpuStats, hooks, plugins, pluginMode, policy }?: HarnessOptions);
|
|
@@ -263,6 +264,7 @@ export declare class Harness extends ReadyResource {
|
|
|
263
264
|
get toolNames(): string[];
|
|
264
265
|
get supportsImages(): boolean;
|
|
265
266
|
supportsImagesFor(model: string): boolean;
|
|
267
|
+
private _draftFor;
|
|
266
268
|
private _projectionFor;
|
|
267
269
|
setCustomModels(entries: ReadonlyArray<CustomModelEntry>): void;
|
|
268
270
|
setModelIdleTimeout(ms: number): void;
|
|
@@ -293,6 +295,8 @@ export declare class Harness extends ReadyResource {
|
|
|
293
295
|
knowledgeStatus(): Promise<KnowledgeStatus>;
|
|
294
296
|
transcribe(context: TranscribeContext): Promise<string>;
|
|
295
297
|
private _transcribe;
|
|
298
|
+
ocrRead({ image, signal }: OcrReadContext): Promise<OcrPage>;
|
|
299
|
+
private _ocrService;
|
|
296
300
|
detectLanguage(context: DetectLanguageContext): Promise<DetectedLanguage[]>;
|
|
297
301
|
speak(context: SpeakContext): Promise<SpeakResult>;
|
|
298
302
|
private _speak;
|
|
@@ -312,9 +316,12 @@ export declare class Harness extends ReadyResource {
|
|
|
312
316
|
private _invoke;
|
|
313
317
|
completion(context: CompletionContext | ResumeCompletionContext): AsyncGenerator<CompletionEvent>;
|
|
314
318
|
serveModelRound(request: ModelRoundRequest, io: ModelRoundIo): Promise<ModelRoundResult>;
|
|
319
|
+
serveMediaRound(request: MediaRoundRequest, io: MediaRoundIo): Promise<MediaRoundResult>;
|
|
315
320
|
private _servedRoundFailed;
|
|
316
321
|
private _completion;
|
|
317
322
|
private _runCompletion;
|
|
323
|
+
private _seeding;
|
|
324
|
+
private _residentLease;
|
|
318
325
|
private _access;
|
|
319
326
|
private _providers;
|
|
320
327
|
private _completionFailed;
|
package/dist-lib/index.js
CHANGED
|
@@ -3,12 +3,11 @@ import { platform, totalmem } from 'os';
|
|
|
3
3
|
import process from 'process';
|
|
4
4
|
import ReadyResource from 'ready-resource';
|
|
5
5
|
import { HarnessError } from './lib/errors.js';
|
|
6
|
-
import { androidCpuPlacement } from './lib/hardware/cpu-placement.js';
|
|
7
6
|
import { probeGpuStats } from './lib/hardware/gpu-probe.js';
|
|
8
7
|
import { probeCapabilityProfile } from './lib/hardware/capability-probe.js';
|
|
9
8
|
import { Lifecycle } from './lib/lifecycle/index.js';
|
|
10
9
|
import { Policy } from './lib/policy/index.js';
|
|
11
|
-
import { didDrainTimeOut, raceDrain } from './lib/helpers/drain.js';
|
|
10
|
+
import { EFFECT_DRAIN_TIMEOUT_MS, didDrainTimeOut, raceDrain } from './lib/helpers/drain.js';
|
|
12
11
|
import { CompletionEngine } from './lib/capabilities/completion-engine/index.js';
|
|
13
12
|
import { imageSettingsFrom } from './lib/helpers/image-settings.js';
|
|
14
13
|
import { detectLanguage } from './lib/capabilities/detect-language.js';
|
|
@@ -18,9 +17,11 @@ import { expandImagePrompt } from './lib/capabilities/enhance.js';
|
|
|
18
17
|
import { download } from './lib/capabilities/download.js';
|
|
19
18
|
import { Embeddings } from './lib/embeddings/index.js';
|
|
20
19
|
import { deleteAllKvCaches, deleteKvCacheKey } from './lib/capabilities/kv-cache.js';
|
|
20
|
+
import { kvCacheDir, PrefixTemplate } from './lib/capabilities/prefix-template.js';
|
|
21
21
|
import { pushQueue } from './lib/queue.js';
|
|
22
22
|
import { AbortedError } from './lib/helpers/race-abort.js';
|
|
23
|
-
import {
|
|
23
|
+
import { RunLatency } from './lib/helpers/run-latency.js';
|
|
24
|
+
import { audioGenDownloadMetadata, categoryDownloadMetadata, customProjectionMap, defaultProjectionMap, catalogModelName, defaultVoiceModel, diffusionDownloadMetadata, infraModelsFor, speculativeDraft, modelNameToCapabilityProfile, residentSrc, setCustomModels } from './lib/models/model-catalog.js';
|
|
24
25
|
import { customModelRows, isModelSourceCached, mergeCustomRows, listModels } from './lib/models/model-list.js';
|
|
25
26
|
import { createDownloadGate } from './lib/models/download-gate.js';
|
|
26
27
|
import { deleteModelFiles, summarizeDelete } from './lib/models/model-delete.js';
|
|
@@ -33,14 +34,16 @@ import { Residency } from './lib/residency/index.js';
|
|
|
33
34
|
import { toolCatalog } from './lib/tools/catalog.js';
|
|
34
35
|
import { SkillsHost } from './lib/skills-host/index.js';
|
|
35
36
|
import { errorMessage, isRecord } from './lib/guards.js';
|
|
36
|
-
import {
|
|
37
|
+
import { Wire } from './lib/wire.js';
|
|
37
38
|
import { HarnessLog } from './lib/log.js';
|
|
39
|
+
import { HarnessServer } from './lib/serve.js';
|
|
38
40
|
import { installResolutionDetector, resolutionDetail } from './lib/resolution-detector.js';
|
|
39
41
|
import { bareRuntime } from './lib/tools/exec/bare-runtime.js';
|
|
40
42
|
import { runCommand } from './lib/tools/exec/runner.js';
|
|
41
43
|
import { createLocalRoots } from './lib/tools/fs/local.js';
|
|
42
44
|
import { createRemoteRoots } from './lib/tools/fs/remote.js';
|
|
43
45
|
export { CompletionEngine, ToolSets } from './lib/capabilities/completion-engine/index.js';
|
|
46
|
+
export { renderedTools } from './lib/capabilities/sdk-tool.js';
|
|
44
47
|
export const CONTEXT_OVERFLOW_MESSAGE = HarnessError.CONTEXT_OVERFLOW_MESSAGE;
|
|
45
48
|
export { imageSettingsFrom } from './lib/helpers/image-settings.js';
|
|
46
49
|
export { skillInContext, unreadySkillState } from './lib/capabilities/skill-entry.js';
|
|
@@ -58,7 +61,7 @@ export { markCredentialRejected, markCredentialValid, recordCredentialHealth, re
|
|
|
58
61
|
export { readSetup as normalizeSkillSetup } from './lib/tools/skills/manifest-parse.js';
|
|
59
62
|
export { isAvailableState, SKILL_STATE } from './lib/tools/skills/skill-state.js';
|
|
60
63
|
export { connectHarness, HARNESS_DIED, RemoteHarness } from './lib/connect.js';
|
|
61
|
-
export
|
|
64
|
+
export const serveHarness = HarnessServer.serve;
|
|
62
65
|
export { HarnessLog };
|
|
63
66
|
export const harnessLog = HarnessLog;
|
|
64
67
|
export const hlog = HarnessLog.info;
|
|
@@ -77,6 +80,8 @@ export const PLUGIN_API_VERSION = PluginRegistry.API_VERSION;
|
|
|
77
80
|
const SUSPEND_SETTLE_MS = 500;
|
|
78
81
|
const SPEECH_PLUGIN_MISSING = 'speech needs the speech plugin';
|
|
79
82
|
const KNOWLEDGE_PLUGIN_MISSING = 'knowledge needs the knowledge plugin';
|
|
83
|
+
const OCR_PLUGIN_MISSING = 'ocr needs the ocr plugin';
|
|
84
|
+
const MEDIA_ROUND_SERVICES = { image: 'image-rounds', music: 'music-rounds' };
|
|
80
85
|
const UNLOAD_FAILED = 'Runtime unload failed; close the harness before loading models again';
|
|
81
86
|
const HOST_SHELL = { name: 'host' };
|
|
82
87
|
function execOptions(exec) {
|
|
@@ -106,6 +111,7 @@ export class Harness extends ReadyResource {
|
|
|
106
111
|
_shell;
|
|
107
112
|
_projectionModel;
|
|
108
113
|
_customProjection = {};
|
|
114
|
+
_speculative;
|
|
109
115
|
_contextSize;
|
|
110
116
|
_recentFits = new Map();
|
|
111
117
|
_gpuStats;
|
|
@@ -114,6 +120,7 @@ export class Harness extends ReadyResource {
|
|
|
114
120
|
_hostHooks;
|
|
115
121
|
_hooks;
|
|
116
122
|
_plugins;
|
|
123
|
+
_prefix;
|
|
117
124
|
_pluginMode;
|
|
118
125
|
_pluginsStarted = null;
|
|
119
126
|
constructor({ tools = [], sdkLoader, skillsDir, modelsDir, sdkHome, exec, projectionModel, llmDevice, llmGpuLayers, contextSize, kvCacheK, kvCacheV, llmLoad, slots, embedDevice, embedGpuLayers, embedBatchSize, transcriptionDevice, completionModelCap, credentialStore, platform, gpuStats, hooks, plugins = [], pluginMode = 'frozen', policy } = {}) {
|
|
@@ -134,6 +141,10 @@ export class Harness extends ReadyResource {
|
|
|
134
141
|
this._hostHooks = Object.freeze([...(hooks ?? HookPipeline.defaults())]);
|
|
135
142
|
this._hooks = this._hostHooks;
|
|
136
143
|
this._sdk = sdkLoader ?? createSdkLoader();
|
|
144
|
+
this._prefix =
|
|
145
|
+
sdkHome === undefined
|
|
146
|
+
? null
|
|
147
|
+
: new PrefixTemplate({ cacheDir: kvCacheDir(sdkHome), sdk: () => this._sdk.load() });
|
|
137
148
|
this._lifecycle = new Lifecycle({
|
|
138
149
|
resource: this,
|
|
139
150
|
sdk: { peek: () => this._sdk.peek() },
|
|
@@ -157,7 +168,8 @@ export class Harness extends ReadyResource {
|
|
|
157
168
|
},
|
|
158
169
|
statusChanged: () => this._residency.invalidateStatus(),
|
|
159
170
|
teardown: async () => {
|
|
160
|
-
this.
|
|
171
|
+
await this._prefix?.close();
|
|
172
|
+
await this._skills.close();
|
|
161
173
|
await this._teardownPlugins();
|
|
162
174
|
}
|
|
163
175
|
});
|
|
@@ -165,6 +177,7 @@ export class Harness extends ReadyResource {
|
|
|
165
177
|
this._hostTools = tools;
|
|
166
178
|
this._tools = tools;
|
|
167
179
|
this._projectionModel = projectionModel ?? defaultProjectionMap();
|
|
180
|
+
this._speculative = llmLoad?.speculative === true;
|
|
168
181
|
this._modelsDir = modelsDir;
|
|
169
182
|
this._skillsDir = skillsDir;
|
|
170
183
|
this._skills = new SkillsHost({
|
|
@@ -190,6 +203,7 @@ export class Harness extends ReadyResource {
|
|
|
190
203
|
llmLoad,
|
|
191
204
|
slots,
|
|
192
205
|
completionModelCap,
|
|
206
|
+
modelsDir: this._modelsDir,
|
|
193
207
|
sdk: { load: () => this._sdk.load() },
|
|
194
208
|
loads: this._loads,
|
|
195
209
|
gate: this._lifecycle,
|
|
@@ -225,7 +239,8 @@ export class Harness extends ReadyResource {
|
|
|
225
239
|
],
|
|
226
240
|
unloadIdlePlugins: () => this._plugins.unloadIdle(),
|
|
227
241
|
tools: () => this._tools,
|
|
228
|
-
skills: (agentId, model) => this._skills.completionSkills(agentId, model)
|
|
242
|
+
skills: (agentId, model, trees) => this._skills.completionSkills(agentId, model, trees),
|
|
243
|
+
platform: () => this._skills.platform
|
|
229
244
|
});
|
|
230
245
|
this._embeddings = new Embeddings({
|
|
231
246
|
device: embedDevice,
|
|
@@ -244,8 +259,10 @@ export class Harness extends ReadyResource {
|
|
|
244
259
|
async _open() {
|
|
245
260
|
try {
|
|
246
261
|
installResolutionDetector(import.meta);
|
|
262
|
+
const core = PluginRegistry.loadAddons('the harness', this._sdk.addons);
|
|
263
|
+
core.catch(noop);
|
|
247
264
|
await this._startPlugins();
|
|
248
|
-
await this._loadAddons();
|
|
265
|
+
await this._loadAddons(core);
|
|
249
266
|
await this._skills.open();
|
|
250
267
|
HarnessLog.info('open', { skills: this._skills.names.length, tools: this._tools.length });
|
|
251
268
|
}
|
|
@@ -314,12 +331,17 @@ export class Harness extends ReadyResource {
|
|
|
314
331
|
this._lifecycle.assertNotClosing();
|
|
315
332
|
}
|
|
316
333
|
_modelHost(transcriptionDevice) {
|
|
334
|
+
const residency = () => this._residency;
|
|
317
335
|
return {
|
|
318
336
|
transcriptionDevice,
|
|
319
337
|
sdk: () => this._sdk.load(),
|
|
320
338
|
track: (load, sdk) => this._loads.track(load, sdk),
|
|
321
339
|
makeRoom: (signal, busy, srcs) => this._residency.makeRoomForPlugin(signal, busy, srcs),
|
|
322
340
|
hold: this._hold,
|
|
341
|
+
isCached: (model, addon) => this._isModelCached(catalogModelName(model, addon), addon),
|
|
342
|
+
get requests() {
|
|
343
|
+
return residency().requests;
|
|
344
|
+
},
|
|
323
345
|
completionModel: (model, signal) => this._residency.borrow(model, signal),
|
|
324
346
|
emit: (state) => this.emit('model', state),
|
|
325
347
|
progressState,
|
|
@@ -370,9 +392,9 @@ export class Harness extends ReadyResource {
|
|
|
370
392
|
sdk: () => this._sdk.loadEmbed()
|
|
371
393
|
};
|
|
372
394
|
}
|
|
373
|
-
async _loadAddons() {
|
|
395
|
+
async _loadAddons(core) {
|
|
374
396
|
await Promise.all([
|
|
375
|
-
|
|
397
|
+
core,
|
|
376
398
|
...this._tools.map((tool) => PluginRegistry.loadAddons(`tool '${tool.name}'`, tool.addons))
|
|
377
399
|
]);
|
|
378
400
|
}
|
|
@@ -436,6 +458,9 @@ export class Harness extends ReadyResource {
|
|
|
436
458
|
supportsImagesFor(model) {
|
|
437
459
|
return Boolean(this._projectionFor(model));
|
|
438
460
|
}
|
|
461
|
+
_draftFor(model) {
|
|
462
|
+
return this._speculative ? speculativeDraft(model)?.model?.src : undefined;
|
|
463
|
+
}
|
|
439
464
|
_projectionFor(model) {
|
|
440
465
|
const custom = this._customProjection[model];
|
|
441
466
|
if (custom) {
|
|
@@ -511,7 +536,7 @@ export class Harness extends ReadyResource {
|
|
|
511
536
|
this._downloads.abandon();
|
|
512
537
|
const result = await raceDrain(this._lifecycle.send('SUSPEND'), SUSPEND_SETTLE_MS);
|
|
513
538
|
if (didDrainTimeOut(result)) {
|
|
514
|
-
|
|
539
|
+
HarnessLog.info('suspend still waiting for active work to settle');
|
|
515
540
|
}
|
|
516
541
|
}
|
|
517
542
|
async resume() {
|
|
@@ -544,7 +569,7 @@ export class Harness extends ReadyResource {
|
|
|
544
569
|
this._closeRetryNeeded = true;
|
|
545
570
|
}
|
|
546
571
|
});
|
|
547
|
-
const bounded = raceDrain(pending).then((result) => {
|
|
572
|
+
const bounded = raceDrain(pending, EFFECT_DRAIN_TIMEOUT_MS).then((result) => {
|
|
548
573
|
if (didDrainTimeOut(result)) {
|
|
549
574
|
throw new Error('Harness close is still waiting for active work to settle');
|
|
550
575
|
}
|
|
@@ -572,7 +597,9 @@ export class Harness extends ReadyResource {
|
|
|
572
597
|
download(args) {
|
|
573
598
|
this._lifecycle.assertNotClosing();
|
|
574
599
|
let releaseWork = null;
|
|
575
|
-
const
|
|
600
|
+
const llm = (args.addon ?? 'llm') === 'llm';
|
|
601
|
+
const projection = llm ? this._projectionFor(args.model) : undefined;
|
|
602
|
+
const draft = llm ? this._draftFor(args.model) : undefined;
|
|
576
603
|
const multiFile = diffusionDownloadMetadata(args.model, args.addon) ??
|
|
577
604
|
audioGenDownloadMetadata(args.model, args.addon) ??
|
|
578
605
|
categoryDownloadMetadata(args.model, args.addon);
|
|
@@ -583,7 +610,10 @@ export class Harness extends ReadyResource {
|
|
|
583
610
|
try {
|
|
584
611
|
const sdk = await this._sdk.load();
|
|
585
612
|
this._lifecycle.assertNotClosing();
|
|
586
|
-
return
|
|
613
|
+
return {
|
|
614
|
+
...sdk,
|
|
615
|
+
downloadAsset: (opts) => this._loads.track(sdk.downloadAsset(opts), sdk)
|
|
616
|
+
};
|
|
587
617
|
}
|
|
588
618
|
catch (error) {
|
|
589
619
|
releaseWork?.();
|
|
@@ -593,7 +623,7 @@ export class Harness extends ReadyResource {
|
|
|
593
623
|
}, {
|
|
594
624
|
...args,
|
|
595
625
|
projection,
|
|
596
|
-
companions: multiFile?.companions,
|
|
626
|
+
companions: draft ? [...(multiFile?.companions ?? []), draft] : multiFile?.companions,
|
|
597
627
|
assetSizes: multiFile?.assetSizes
|
|
598
628
|
}, (event) => {
|
|
599
629
|
this._residency.invalidateStatus();
|
|
@@ -647,6 +677,17 @@ export class Harness extends ReadyResource {
|
|
|
647
677
|
signal
|
|
648
678
|
});
|
|
649
679
|
}
|
|
680
|
+
ocrRead({ image, signal }) {
|
|
681
|
+
return this._residency.busy(async () => (await this._ocrService()).read(image, signal));
|
|
682
|
+
}
|
|
683
|
+
async _ocrService() {
|
|
684
|
+
if (!this.opened)
|
|
685
|
+
await this.ready();
|
|
686
|
+
if (!this._plugins.ctx.ocr) {
|
|
687
|
+
throw new Error(OCR_PLUGIN_MISSING);
|
|
688
|
+
}
|
|
689
|
+
return this._plugins.ctx.ocr;
|
|
690
|
+
}
|
|
650
691
|
detectLanguage(context) {
|
|
651
692
|
return detectLanguage(context);
|
|
652
693
|
}
|
|
@@ -677,7 +718,8 @@ export class Harness extends ReadyResource {
|
|
|
677
718
|
this._lifecycle.assertNotClosing();
|
|
678
719
|
const rows = await listModels(sdk, options, {
|
|
679
720
|
cache: this._residency.status,
|
|
680
|
-
projectionFor: (name) => this._projectionFor(name)
|
|
721
|
+
projectionFor: (name) => this._projectionFor(name),
|
|
722
|
+
draftFor: (name) => this._draftFor(name)
|
|
681
723
|
});
|
|
682
724
|
const loaded = this._residency.settled();
|
|
683
725
|
const loading = this._residency.loading();
|
|
@@ -854,23 +896,56 @@ export class Harness extends ReadyResource {
|
|
|
854
896
|
throw new Error(UNLOAD_FAILED);
|
|
855
897
|
}
|
|
856
898
|
const { modelId } = request;
|
|
857
|
-
const { key, acquireRound } = this._residency.servedRound(modelId);
|
|
899
|
+
const { key, acquireRound: acquire } = this._residency.servedRound(modelId, request.load);
|
|
900
|
+
const acquireRound = this._seeding(acquire, modelId);
|
|
858
901
|
let served;
|
|
859
902
|
const round = this._lifecycle.trackCompletion((signal) => this._residency.busyStream(async function* () {
|
|
860
903
|
served = await CompletionEngine.serveModelRound(request, { signal, emit: (event) => io.emit(event), retake: () => io.retake() }, { acquireRound });
|
|
861
904
|
}), io.signal);
|
|
905
|
+
const releasePrefix = this._prefix?.holdServed(request.runId);
|
|
862
906
|
try {
|
|
863
907
|
await round.next();
|
|
864
908
|
}
|
|
865
909
|
catch (err) {
|
|
866
910
|
throw await this._servedRoundFailed(err, modelId, key);
|
|
867
911
|
}
|
|
912
|
+
finally {
|
|
913
|
+
releasePrefix?.(Boolean(served?.final.toolCalls.length));
|
|
914
|
+
}
|
|
868
915
|
if (!served) {
|
|
869
916
|
throw new Error('A served round ended without its result');
|
|
870
917
|
}
|
|
871
918
|
this._residency.clearFaults(modelId);
|
|
872
919
|
return served;
|
|
873
920
|
}
|
|
921
|
+
async serveMediaRound(request, io) {
|
|
922
|
+
if (!this.opened)
|
|
923
|
+
await this.ready();
|
|
924
|
+
this._lifecycle.assertNotClosing();
|
|
925
|
+
if (this.suspended || this._lifecycle.draining) {
|
|
926
|
+
throw new HarnessError('HARNESS_SUSPENDED');
|
|
927
|
+
}
|
|
928
|
+
const releasePlugins = await this._plugins.hold();
|
|
929
|
+
try {
|
|
930
|
+
const server = this._plugins.ctx[MEDIA_ROUND_SERVICES[request.kind]];
|
|
931
|
+
if (!server) {
|
|
932
|
+
throw new HarnessError('MEDIA_MODEL_MISSING', [
|
|
933
|
+
request.kind,
|
|
934
|
+
request.modelChoice ?? 'default'
|
|
935
|
+
]);
|
|
936
|
+
}
|
|
937
|
+
const leave = this._lifecycle.enterWork();
|
|
938
|
+
try {
|
|
939
|
+
return await server.serve(request, io);
|
|
940
|
+
}
|
|
941
|
+
finally {
|
|
942
|
+
leave();
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
finally {
|
|
946
|
+
releasePlugins();
|
|
947
|
+
}
|
|
948
|
+
}
|
|
874
949
|
async _servedRoundFailed(err, model, key) {
|
|
875
950
|
const aborted = err instanceof AbortedError || this.suspended || this._lifecycle.draining;
|
|
876
951
|
if (aborted || !isSdkModelWedgedError(err)) {
|
|
@@ -890,7 +965,9 @@ export class Harness extends ReadyResource {
|
|
|
890
965
|
if (this._lifecycle.unloadFailed) {
|
|
891
966
|
throw new Error(UNLOAD_FAILED);
|
|
892
967
|
}
|
|
893
|
-
|
|
968
|
+
const own = context.latency ? undefined : RunLatency.start();
|
|
969
|
+
const run = this._lifecycle.trackCompletion((signal) => this._residency.busyStream(() => this._runCompletion({ ...context, signal, latency: context.latency ?? own })), context.signal);
|
|
970
|
+
return own ? own.logAfter(run) : run;
|
|
894
971
|
}
|
|
895
972
|
async *_runCompletion(request) {
|
|
896
973
|
if (!this.opened)
|
|
@@ -900,10 +977,12 @@ export class Harness extends ReadyResource {
|
|
|
900
977
|
yield { type: 'aborted' };
|
|
901
978
|
return;
|
|
902
979
|
}
|
|
903
|
-
const { boot, onStep,
|
|
980
|
+
const { boot, onStep, requestDigestKey, ...provided } = request;
|
|
904
981
|
let modelId = request.model ?? '';
|
|
905
982
|
let key = null;
|
|
906
983
|
const releasePlugins = await this._plugins.hold(request.parentRunId !== undefined);
|
|
984
|
+
const releasePrefix = this._prefix?.hold();
|
|
985
|
+
request.latency?.mark('admittedMs');
|
|
907
986
|
const detached = [];
|
|
908
987
|
try {
|
|
909
988
|
const runtime = async (run) => {
|
|
@@ -911,18 +990,24 @@ export class Harness extends ReadyResource {
|
|
|
911
990
|
const runContext = { ...run, model: run.model ?? run.modelId };
|
|
912
991
|
const lease = await this._residency.completionRuntime(runContext);
|
|
913
992
|
const access = await this._access(run, lease.args);
|
|
993
|
+
request.latency?.mark('preparedMs');
|
|
914
994
|
if (!key) {
|
|
915
995
|
this._residency.reply(lease.key);
|
|
916
996
|
}
|
|
917
997
|
key = lease.key;
|
|
918
|
-
|
|
998
|
+
const acquireRound = this._seeding(lease.args.acquireRound, modelId);
|
|
999
|
+
const args = { ...lease.args, access, acquireRound };
|
|
1000
|
+
return { ...lease, args, services: this._plugins.ctx };
|
|
1001
|
+
};
|
|
1002
|
+
const args = {
|
|
1003
|
+
...provided,
|
|
1004
|
+
latency: request.latency,
|
|
1005
|
+
lockOwner: this
|
|
919
1006
|
};
|
|
920
|
-
const args = { ...provided, lockOwner: this };
|
|
921
1007
|
for await (const event of CompletionEngine.run(runtime, args, {
|
|
922
1008
|
hooks: this._hooks,
|
|
923
1009
|
boot,
|
|
924
1010
|
onStep,
|
|
925
|
-
hostAppendTimeoutMs,
|
|
926
1011
|
requestDigestKey,
|
|
927
1012
|
resumeRequest: provided,
|
|
928
1013
|
onDetached: (pending, runId) => {
|
|
@@ -946,7 +1031,26 @@ export class Harness extends ReadyResource {
|
|
|
946
1031
|
void this._plugins.unloadIdle();
|
|
947
1032
|
}
|
|
948
1033
|
void Promise.allSettled(detached).then(releasePlugins);
|
|
1034
|
+
releasePrefix?.();
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
_seeding(acquire, model) {
|
|
1038
|
+
const prefix = this._prefix;
|
|
1039
|
+
if (!prefix) {
|
|
1040
|
+
return acquire;
|
|
949
1041
|
}
|
|
1042
|
+
return async (signal) => ({
|
|
1043
|
+
...(await acquire(signal)),
|
|
1044
|
+
seed: (cacheKey, prime) => prefix.seed(cacheKey, prime, () => this._residentLease(model, prime.modelId))
|
|
1045
|
+
});
|
|
1046
|
+
}
|
|
1047
|
+
async _residentLease(model, modelId) {
|
|
1048
|
+
const lease = await leaseResidentModel(this._residency.pool, (name) => name === model);
|
|
1049
|
+
if (lease?.modelId === modelId) {
|
|
1050
|
+
return lease;
|
|
1051
|
+
}
|
|
1052
|
+
lease?.release();
|
|
1053
|
+
return null;
|
|
950
1054
|
}
|
|
951
1055
|
async _access(run, roots) {
|
|
952
1056
|
const layers = [this._policy, run.agent?.policy, run.policy];
|
|
@@ -1021,7 +1125,7 @@ function completionErrorDetails(error) {
|
|
|
1021
1125
|
if (!isRecord(error))
|
|
1022
1126
|
return {};
|
|
1023
1127
|
if (error.code === 'PENDING_ARGS_REDACTED') {
|
|
1024
|
-
return { code: 'PENDING_ARGS_REDACTED', ...redactedRecoveryFields(error) };
|
|
1128
|
+
return { code: 'PENDING_ARGS_REDACTED', ...Wire.redactedRecoveryFields(error) };
|
|
1025
1129
|
}
|
|
1026
1130
|
if (error.name !== 'RunIncompatible') {
|
|
1027
1131
|
return {};
|