@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
package/dist-lib/lib/connect.js
CHANGED
|
@@ -2,7 +2,6 @@ import b4a from 'b4a';
|
|
|
2
2
|
import { randomBytes } from 'crypto';
|
|
3
3
|
import EventEmitter from 'events';
|
|
4
4
|
import fs from 'fs';
|
|
5
|
-
import { z } from 'zod';
|
|
6
5
|
import { settleOnClose } from './rpc-session.js';
|
|
7
6
|
import { harnessClient } from '../spec/calls.js';
|
|
8
7
|
import HRPC from '../spec/hrpc/index.js';
|
|
@@ -11,19 +10,24 @@ import { unsupportedKvCacheDeletion } from './capabilities/kv-cache.js';
|
|
|
11
10
|
import { checkGoal, checkMaxToolRounds } from './capabilities/tool-turns.js';
|
|
12
11
|
import { Agent } from './agent/index.js';
|
|
13
12
|
import { readModelSourcePreview } from './capabilities/preview-model-source.js';
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
13
|
+
import { MediaHost } from './media-host.js';
|
|
14
|
+
import { discardRequestWire, mediaRequestWire } from './media-wire.js';
|
|
15
|
+
import { RoundHost } from './round-host.js';
|
|
16
|
+
import { HarnessLog } from './log.js';
|
|
16
17
|
import { assertEmbedDevice } from './models/embed-config.js';
|
|
17
18
|
import { addonTaskType } from './models/model-task.js';
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import { stageFile, sweepStaging } from './staging.js';
|
|
19
|
+
import { errorMessage, isRecord } from './guards.js';
|
|
20
|
+
import { sweepStaging } from './staging.js';
|
|
21
21
|
import { sweepSpill } from './spill.js';
|
|
22
22
|
import { readInstall, readSetup } from './tools/skills/manifest-parse.js';
|
|
23
|
-
import { SKILL_STATE } from './tools/skills/skill-state.js';
|
|
24
23
|
import { asToolset } from './tools/toolsets.js';
|
|
25
|
-
import {
|
|
26
|
-
|
|
24
|
+
import { Wire } from './wire.js';
|
|
25
|
+
import { loadedModel, parseSkillState, errorDetails, knobs, explicitEmptyIdentityFields, frames, downloadFrames } from './connect/decode.js';
|
|
26
|
+
import { died, noop, abortable, awaitWithAbort } from './connect/abort.js';
|
|
27
|
+
import { abortedRound, servedRound, servedMedia } from './connect/served.js';
|
|
28
|
+
import { bridgeAttach, bridgeShow, bridgeFetch, bridgeDrive, sendInput, answerQuestion, approvalCall } from './connect/bridges.js';
|
|
29
|
+
import { bridgeRunLog, validateHostRunLogLease, acquireHostRunLogLease } from './connect/host-run-log.js';
|
|
30
|
+
export { HARNESS_DIED } from './connect/abort.js';
|
|
27
31
|
const PAUSE_GRACE_MS = 10_000;
|
|
28
32
|
export function connectHarness(transport, options = {}) {
|
|
29
33
|
return new RemoteHarness(transport, options);
|
|
@@ -104,7 +108,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
104
108
|
await session.client.setCustomModels({ models: this._customModels });
|
|
105
109
|
}
|
|
106
110
|
catch (err) {
|
|
107
|
-
|
|
111
|
+
HarnessLog.warn('custom model restore failed', { message: errorMessage(err) });
|
|
108
112
|
}
|
|
109
113
|
}
|
|
110
114
|
return session;
|
|
@@ -130,17 +134,48 @@ export class RemoteHarness extends EventEmitter {
|
|
|
130
134
|
payload.explicitEmptyIdentity = explicitEmptyIdentity;
|
|
131
135
|
}
|
|
132
136
|
if (context.knowledge) {
|
|
133
|
-
|
|
137
|
+
const { scopes, focus, k } = context.knowledge;
|
|
138
|
+
payload.knowledge = { scopes: [...scopes], focus: focus && [...focus], k };
|
|
134
139
|
}
|
|
135
140
|
if (context.planMode) {
|
|
136
141
|
payload.planMode = true;
|
|
137
142
|
}
|
|
143
|
+
if (context.deferTools) {
|
|
144
|
+
payload.deferTools = true;
|
|
145
|
+
}
|
|
138
146
|
if (context.parentRunId) {
|
|
139
147
|
payload.parentRunId = context.parentRunId;
|
|
140
148
|
}
|
|
141
149
|
if (context.goal) {
|
|
142
150
|
payload.goal = checkGoal({ ...context.goal }, context.responseFormat);
|
|
143
151
|
}
|
|
152
|
+
if (context.typedText !== undefined) {
|
|
153
|
+
payload.typedText = context.typedText;
|
|
154
|
+
}
|
|
155
|
+
if (context.replaysContext) {
|
|
156
|
+
payload.replaysContext = true;
|
|
157
|
+
}
|
|
158
|
+
if (context.modelRound) {
|
|
159
|
+
payload.modelRound = true;
|
|
160
|
+
}
|
|
161
|
+
if (context.mediaRound) {
|
|
162
|
+
payload.mediaRound = true;
|
|
163
|
+
}
|
|
164
|
+
if (context.roundCut) {
|
|
165
|
+
payload.roundCut = true;
|
|
166
|
+
}
|
|
167
|
+
if (context.showImage) {
|
|
168
|
+
payload.showImage = true;
|
|
169
|
+
}
|
|
170
|
+
if (context.projectSkills?.length) {
|
|
171
|
+
payload.projectSkills = context.projectSkills;
|
|
172
|
+
}
|
|
173
|
+
if (context.workspaceSkills?.length) {
|
|
174
|
+
payload.workspaceSkills = context.workspaceSkills;
|
|
175
|
+
}
|
|
176
|
+
if (context.maxToolRounds !== undefined && context.maxToolRounds !== 0) {
|
|
177
|
+
payload.maxToolRounds = checkMaxToolRounds(context.maxToolRounds);
|
|
178
|
+
}
|
|
144
179
|
yield* this._run({
|
|
145
180
|
type: 'start',
|
|
146
181
|
runId,
|
|
@@ -148,21 +183,21 @@ export class RemoteHarness extends EventEmitter {
|
|
|
148
183
|
model: context.model,
|
|
149
184
|
agent: context.agent ? knobs(context.agent) : undefined,
|
|
150
185
|
cacheKey: context.cacheKey,
|
|
186
|
+
session: context.session,
|
|
151
187
|
thinkingDefault: context.thinkingDefault,
|
|
152
188
|
generationParams: context.generationParams,
|
|
153
189
|
responseFormat: context.responseFormat,
|
|
154
190
|
captureInferenceCalls: context.captureInferenceCalls,
|
|
155
|
-
|
|
156
|
-
? undefined
|
|
157
|
-
: checkMaxToolRounds(context.maxToolRounds),
|
|
158
|
-
messages: context.messages?.map(({ role, content, attachments, toolCalls, toolCallId, name, id }) => ({
|
|
191
|
+
messages: context.messages?.map(({ role, content, attachments, toolCalls, toolCallId, name, id, context: added, sentAt }) => ({
|
|
159
192
|
role,
|
|
160
193
|
content,
|
|
161
194
|
attachments: attachments?.map(({ path: file }) => ({ path: file })),
|
|
162
195
|
toolCalls,
|
|
163
196
|
toolCallId,
|
|
164
197
|
name,
|
|
165
|
-
id
|
|
198
|
+
id,
|
|
199
|
+
context: added,
|
|
200
|
+
sentAt
|
|
166
201
|
})),
|
|
167
202
|
toolConfigs: context.toolConfigs,
|
|
168
203
|
grantedDirs: context.grantedDirs,
|
|
@@ -170,6 +205,49 @@ export class RemoteHarness extends EventEmitter {
|
|
|
170
205
|
grantedWriteDirs: context.grantedWriteDirs
|
|
171
206
|
}, { ...context, runId });
|
|
172
207
|
}
|
|
208
|
+
async serveModelRound(request, io) {
|
|
209
|
+
const aborted = abortedRound(io.signal);
|
|
210
|
+
const { client } = await Promise.race([this._ensure(), aborted]);
|
|
211
|
+
const duplex = client.completion();
|
|
212
|
+
const stop = () => duplex.destroy();
|
|
213
|
+
io.signal?.addEventListener?.('abort', stop, { once: true });
|
|
214
|
+
try {
|
|
215
|
+
const frame = { type: 'model-round-ask', payload: request };
|
|
216
|
+
encode('@harness/completion-frame', frame);
|
|
217
|
+
duplex.write(frame);
|
|
218
|
+
const served = servedRound(frames(duplex), io);
|
|
219
|
+
served.catch(noop);
|
|
220
|
+
return await Promise.race([served, aborted]);
|
|
221
|
+
}
|
|
222
|
+
finally {
|
|
223
|
+
io.signal?.removeEventListener?.('abort', stop);
|
|
224
|
+
duplex.destroy();
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
async serveMediaRound(request, io) {
|
|
228
|
+
const aborted = abortedRound(io.signal);
|
|
229
|
+
const { client } = await Promise.race([this._ensure(), aborted]);
|
|
230
|
+
const payload = await mediaRequestWire(request);
|
|
231
|
+
const duplex = client.completion();
|
|
232
|
+
const stop = () => duplex.destroy();
|
|
233
|
+
io.signal?.addEventListener?.('abort', stop, { once: true });
|
|
234
|
+
try {
|
|
235
|
+
const frame = { type: 'media-round-ask', payload };
|
|
236
|
+
encode('@harness/completion-frame', frame);
|
|
237
|
+
duplex.write(frame);
|
|
238
|
+
const served = servedMedia(frames(duplex), io);
|
|
239
|
+
served.catch(noop);
|
|
240
|
+
return await Promise.race([served, aborted]);
|
|
241
|
+
}
|
|
242
|
+
catch (err) {
|
|
243
|
+
await discardRequestWire(payload);
|
|
244
|
+
throw err;
|
|
245
|
+
}
|
|
246
|
+
finally {
|
|
247
|
+
io.signal?.removeEventListener?.('abort', stop);
|
|
248
|
+
duplex.destroy();
|
|
249
|
+
}
|
|
250
|
+
}
|
|
173
251
|
async *invoke(context) {
|
|
174
252
|
const agent = context.agent ?? {};
|
|
175
253
|
yield* this._run({
|
|
@@ -256,6 +334,18 @@ export class RemoteHarness extends EventEmitter {
|
|
|
256
334
|
};
|
|
257
335
|
let pauseTimer;
|
|
258
336
|
let started = false;
|
|
337
|
+
const rounds = context.modelRound &&
|
|
338
|
+
new RoundHost(context.modelRound, (frame) => {
|
|
339
|
+
if (!closed) {
|
|
340
|
+
send({ ...frame });
|
|
341
|
+
}
|
|
342
|
+
});
|
|
343
|
+
const media = context.mediaRound &&
|
|
344
|
+
new MediaHost(context.mediaRound, (frame) => {
|
|
345
|
+
if (!closed) {
|
|
346
|
+
send({ ...frame });
|
|
347
|
+
}
|
|
348
|
+
});
|
|
259
349
|
let failure = null;
|
|
260
350
|
const send = (frame) => {
|
|
261
351
|
if (!duplex)
|
|
@@ -315,6 +405,11 @@ export class RemoteHarness extends EventEmitter {
|
|
|
315
405
|
throw failure;
|
|
316
406
|
}
|
|
317
407
|
started = true;
|
|
408
|
+
context.roundCut?.((note) => {
|
|
409
|
+
if (!closed) {
|
|
410
|
+
send({ type: 'round-cut', message: note });
|
|
411
|
+
}
|
|
412
|
+
});
|
|
318
413
|
if (context.input) {
|
|
319
414
|
void sendInput(context.input, (item) => {
|
|
320
415
|
if (closed)
|
|
@@ -326,11 +421,11 @@ export class RemoteHarness extends EventEmitter {
|
|
|
326
421
|
});
|
|
327
422
|
}).catch(noop);
|
|
328
423
|
}
|
|
329
|
-
|
|
424
|
+
HarnessLog.debug('client wire open', { model: context.model, capability: open.capability });
|
|
330
425
|
for await (const event of frames(duplex)) {
|
|
331
426
|
received++;
|
|
332
427
|
if (event.type !== 'content' && event.type !== 'thinking') {
|
|
333
|
-
|
|
428
|
+
HarnessLog.debug('client frame', { type: event.type, n: received });
|
|
334
429
|
}
|
|
335
430
|
if (event.type === 'run-started' || event.type === 'run-resumed') {
|
|
336
431
|
activeRunId = event.runId ?? activeRunId;
|
|
@@ -352,7 +447,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
352
447
|
send({ type: 'decision', callId, approved: false });
|
|
353
448
|
}
|
|
354
449
|
})
|
|
355
|
-
.catch((err) =>
|
|
450
|
+
.catch((err) => HarnessLog.warn('approval reply failed', { callId, message: errorMessage(err) }));
|
|
356
451
|
continue;
|
|
357
452
|
}
|
|
358
453
|
if (event.type === 'attach-ask') {
|
|
@@ -371,12 +466,13 @@ export class RemoteHarness extends EventEmitter {
|
|
|
371
466
|
});
|
|
372
467
|
}
|
|
373
468
|
})
|
|
374
|
-
.catch((err) =>
|
|
469
|
+
.catch((err) => HarnessLog.warn('attach reply failed', { callId, message: errorMessage(err) }));
|
|
375
470
|
continue;
|
|
376
471
|
}
|
|
377
472
|
if (event.type === 'fetch-ask') {
|
|
378
473
|
const callId = event.callId;
|
|
379
|
-
|
|
474
|
+
const show = isRecord(event.payload) && event.payload.show === true;
|
|
475
|
+
void (show ? bridgeShow(event, context) : bridgeFetch(event, context, staged))
|
|
380
476
|
.then((frame) => {
|
|
381
477
|
if (closed) {
|
|
382
478
|
return reclaim();
|
|
@@ -388,7 +484,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
388
484
|
}
|
|
389
485
|
send({ type: 'fetch-result', callId, message: errorMessage(err) });
|
|
390
486
|
})
|
|
391
|
-
.catch((err) =>
|
|
487
|
+
.catch((err) => HarnessLog.warn('fetch reply failed', { callId, message: errorMessage(err) }));
|
|
392
488
|
continue;
|
|
393
489
|
}
|
|
394
490
|
if (event.type === 'drive-ask') {
|
|
@@ -411,7 +507,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
411
507
|
});
|
|
412
508
|
}
|
|
413
509
|
})
|
|
414
|
-
.catch((err) =>
|
|
510
|
+
.catch((err) => HarnessLog.warn('drive reply failed', { callId, message: errorMessage(err) }));
|
|
415
511
|
continue;
|
|
416
512
|
}
|
|
417
513
|
if (event.type === 'run-log-append') {
|
|
@@ -435,7 +531,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
435
531
|
});
|
|
436
532
|
}
|
|
437
533
|
})
|
|
438
|
-
.catch((err) =>
|
|
534
|
+
.catch((err) => HarnessLog.warn('run-log reply failed', { callId, message: errorMessage(err) }));
|
|
439
535
|
continue;
|
|
440
536
|
}
|
|
441
537
|
if (event.type === 'question-ask') {
|
|
@@ -453,13 +549,29 @@ export class RemoteHarness extends EventEmitter {
|
|
|
453
549
|
context.progress?.(event.cleared ? null : { percentage: event.percentage ?? 0 });
|
|
454
550
|
continue;
|
|
455
551
|
}
|
|
456
|
-
|
|
552
|
+
if (event.type === 'model-round-ask') {
|
|
553
|
+
rounds?.ask(event.callId ?? '', event.payload);
|
|
554
|
+
continue;
|
|
555
|
+
}
|
|
556
|
+
if (event.type === 'model-round-cancel') {
|
|
557
|
+
rounds?.cancel(event.callId ?? '');
|
|
558
|
+
continue;
|
|
559
|
+
}
|
|
560
|
+
if (event.type === 'media-round-ask') {
|
|
561
|
+
media?.ask(event.callId ?? '', event.payload);
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
if (event.type === 'media-round-cancel') {
|
|
565
|
+
media?.cancel(event.callId ?? '');
|
|
566
|
+
continue;
|
|
567
|
+
}
|
|
568
|
+
const wire = Wire.fromWire(event);
|
|
457
569
|
if (wire.type === 'aborted' || wire.type === 'paused') {
|
|
458
570
|
emittedAborted = true;
|
|
459
571
|
}
|
|
460
572
|
yield wire;
|
|
461
573
|
}
|
|
462
|
-
|
|
574
|
+
HarnessLog.info('client wire ended', { received });
|
|
463
575
|
}
|
|
464
576
|
catch (err) {
|
|
465
577
|
if (failure) {
|
|
@@ -477,11 +589,13 @@ export class RemoteHarness extends EventEmitter {
|
|
|
477
589
|
throw died(`harness died mid-run: ${errorMessage(err)}`);
|
|
478
590
|
}
|
|
479
591
|
finally {
|
|
480
|
-
|
|
592
|
+
HarnessLog.debug('client run end', { received, aborted: Boolean(context.signal?.aborted) });
|
|
481
593
|
context.signal?.removeEventListener?.('abort', onAbort);
|
|
482
594
|
clearTimeout(pauseTimer);
|
|
483
595
|
duplex?.destroy();
|
|
484
596
|
closed = true;
|
|
597
|
+
rounds?.close();
|
|
598
|
+
media?.close();
|
|
485
599
|
reclaim();
|
|
486
600
|
if (hostLease && leasedRunId && context.runLog) {
|
|
487
601
|
let timer;
|
|
@@ -494,7 +608,10 @@ export class RemoteHarness extends EventEmitter {
|
|
|
494
608
|
]);
|
|
495
609
|
}
|
|
496
610
|
catch (err) {
|
|
497
|
-
|
|
611
|
+
HarnessLog.info('host run-log release failed', {
|
|
612
|
+
runId: leasedRunId,
|
|
613
|
+
message: errorMessage(err)
|
|
614
|
+
});
|
|
498
615
|
}
|
|
499
616
|
finally {
|
|
500
617
|
clearTimeout(timer);
|
|
@@ -523,7 +640,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
523
640
|
}
|
|
524
641
|
context.signal?.addEventListener?.('abort', onAbort, { once: true });
|
|
525
642
|
for await (const event of downloadFrames(stream)) {
|
|
526
|
-
const wire = fromDownloadWire(event);
|
|
643
|
+
const wire = Wire.fromDownloadWire(event);
|
|
527
644
|
if (wire.type === 'aborted') {
|
|
528
645
|
emittedAborted = true;
|
|
529
646
|
}
|
|
@@ -550,7 +667,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
550
667
|
async embed(context) {
|
|
551
668
|
const { client } = await this._ensure();
|
|
552
669
|
const response = await abortable(client.embed({ model: context.model, texts: context.texts }), context.signal);
|
|
553
|
-
const rows = unpackVectors(response.dimensions, response.vectors);
|
|
670
|
+
const rows = Wire.unpackVectors(response.dimensions, response.vectors);
|
|
554
671
|
if (rows.length !== context.texts.length) {
|
|
555
672
|
throw new Error(`embed returned ${rows.length} vectors for ${context.texts.length} texts`);
|
|
556
673
|
}
|
|
@@ -561,6 +678,16 @@ export class RemoteHarness extends EventEmitter {
|
|
|
561
678
|
const response = await abortable(client.transcribe({ model: context.model, audio: context.audio }), context.signal);
|
|
562
679
|
return response.text;
|
|
563
680
|
}
|
|
681
|
+
async ocrRead(context) {
|
|
682
|
+
const { client } = await this._ensure();
|
|
683
|
+
const { width, height, data } = context.image;
|
|
684
|
+
const response = await abortable(client.ocrRead({
|
|
685
|
+
width,
|
|
686
|
+
height,
|
|
687
|
+
data: b4a.from(data.buffer, data.byteOffset, data.byteLength)
|
|
688
|
+
}), context.signal);
|
|
689
|
+
return { text: response.text, coverage: response.coverage ?? 0 };
|
|
690
|
+
}
|
|
564
691
|
async detectLanguage(context) {
|
|
565
692
|
const { client } = await this._ensure();
|
|
566
693
|
const response = await client.detectLanguage({
|
|
@@ -624,6 +751,18 @@ export class RemoteHarness extends EventEmitter {
|
|
|
624
751
|
const { client } = await this._ensure();
|
|
625
752
|
await client.setModelIdleTimeout({ ms });
|
|
626
753
|
}
|
|
754
|
+
async setModelMemoryCap(percent) {
|
|
755
|
+
const { client } = await this._ensure();
|
|
756
|
+
await client.setModelMemoryCap({ percent });
|
|
757
|
+
}
|
|
758
|
+
async memoryUsage() {
|
|
759
|
+
const { client } = await this._ensure();
|
|
760
|
+
return await client.memoryUsage({});
|
|
761
|
+
}
|
|
762
|
+
async setDownloadsAllowed({ allowed }) {
|
|
763
|
+
const { client } = await this._ensure();
|
|
764
|
+
await client.setDownloadsAllowed({ allowed });
|
|
765
|
+
}
|
|
627
766
|
async listManagedSkills() {
|
|
628
767
|
const { client } = await this._ensure();
|
|
629
768
|
const response = await client.listManagedSkills({});
|
|
@@ -699,6 +838,7 @@ export class RemoteHarness extends EventEmitter {
|
|
|
699
838
|
}));
|
|
700
839
|
return {
|
|
701
840
|
name: skill.name,
|
|
841
|
+
displayName: skill.displayName || undefined,
|
|
702
842
|
description: skill.description,
|
|
703
843
|
tools: skill.tools ?? [],
|
|
704
844
|
credentials: skill.credentials ?? [],
|
|
@@ -763,8 +903,8 @@ export class RemoteHarness extends EventEmitter {
|
|
|
763
903
|
}
|
|
764
904
|
async knowledgeUpsert(artifact) {
|
|
765
905
|
const { client } = await this._ensure();
|
|
766
|
-
const response = await client.knowledgeUpsert(toKnowledgeUpsertWire(artifact));
|
|
767
|
-
return fromKnowledgeUpsertResultWire(response, artifact.chunks.length);
|
|
906
|
+
const response = await client.knowledgeUpsert(Wire.toKnowledgeUpsertWire(artifact));
|
|
907
|
+
return Wire.fromKnowledgeUpsertResultWire(response, artifact.chunks.length);
|
|
768
908
|
}
|
|
769
909
|
async knowledgeRemove(artifactId) {
|
|
770
910
|
const { client } = await this._ensure();
|
|
@@ -776,14 +916,15 @@ export class RemoteHarness extends EventEmitter {
|
|
|
776
916
|
const response = await client.knowledgeSearch({
|
|
777
917
|
text: query.text,
|
|
778
918
|
scopes: [...query.scopes],
|
|
779
|
-
k: query.k
|
|
919
|
+
k: query.k,
|
|
920
|
+
focus: query.focus && [...query.focus]
|
|
780
921
|
});
|
|
781
|
-
return response.hits.map(fromKnowledgeHitWire);
|
|
922
|
+
return response.hits.map(Wire.fromKnowledgeHitWire);
|
|
782
923
|
}
|
|
783
924
|
async knowledgeStatus() {
|
|
784
925
|
const { client } = await this._ensure();
|
|
785
926
|
const response = await client.knowledgeStatus({});
|
|
786
|
-
return fromKnowledgeStatusWire(response);
|
|
927
|
+
return Wire.fromKnowledgeStatusWire(response);
|
|
787
928
|
}
|
|
788
929
|
async list(options = {}) {
|
|
789
930
|
const { client } = await this._ensure();
|
|
@@ -792,9 +933,10 @@ export class RemoteHarness extends EventEmitter {
|
|
|
792
933
|
cachedOnly: options.cachedOnly,
|
|
793
934
|
fullRegistry: options.fullRegistry
|
|
794
935
|
});
|
|
795
|
-
return (response.models ?? []).map(({ actualSize, label, fit, fitBasis, fitEvidence, ...row }) => ({
|
|
936
|
+
return (response.models ?? []).map(({ actualSize, memoryBytes, label, fit, fitBasis, fitEvidence, ...row }) => ({
|
|
796
937
|
...row,
|
|
797
938
|
actualSize: actualSize || undefined,
|
|
939
|
+
memoryBytes: memoryBytes || undefined,
|
|
798
940
|
label: label || undefined,
|
|
799
941
|
taskType: addonTaskType(row.type),
|
|
800
942
|
fit: (fit || undefined),
|
|
@@ -909,382 +1051,3 @@ export class RemoteHarness extends EventEmitter {
|
|
|
909
1051
|
};
|
|
910
1052
|
}
|
|
911
1053
|
}
|
|
912
|
-
function loadedModel({ model, refs, fit }) {
|
|
913
|
-
if (!fit) {
|
|
914
|
-
return { model, refs };
|
|
915
|
-
}
|
|
916
|
-
const { verdict, reason, plan, deviceBytes, hostBytes } = fit;
|
|
917
|
-
return {
|
|
918
|
-
model,
|
|
919
|
-
refs,
|
|
920
|
-
fit: {
|
|
921
|
-
verdict,
|
|
922
|
-
reason,
|
|
923
|
-
plan: plan ?? undefined,
|
|
924
|
-
deviceBytes: deviceBytes || undefined,
|
|
925
|
-
hostBytes: hostBytes || undefined
|
|
926
|
-
}
|
|
927
|
-
};
|
|
928
|
-
}
|
|
929
|
-
function parseSkillState(value) {
|
|
930
|
-
return value ? value : SKILL_STATE.failed;
|
|
931
|
-
}
|
|
932
|
-
function errorDetails(err) {
|
|
933
|
-
return { error: errorMessage(err), code: errorCode(err) };
|
|
934
|
-
}
|
|
935
|
-
function isToolCallDisplay(value) {
|
|
936
|
-
return isRecord(value) && typeof value.label === 'string';
|
|
937
|
-
}
|
|
938
|
-
function died(message) {
|
|
939
|
-
return Object.assign(new Error(message), { code: HARNESS_DIED });
|
|
940
|
-
}
|
|
941
|
-
const noop = () => { };
|
|
942
|
-
function abortable(promise, signal) {
|
|
943
|
-
if (!signal)
|
|
944
|
-
return promise;
|
|
945
|
-
return new Promise((resolve, reject) => {
|
|
946
|
-
if (signal.aborted) {
|
|
947
|
-
promise.then(noop, noop);
|
|
948
|
-
reject(new Error('embed aborted'));
|
|
949
|
-
return;
|
|
950
|
-
}
|
|
951
|
-
const onAbort = () => reject(new Error('embed aborted'));
|
|
952
|
-
signal.addEventListener?.('abort', onAbort, { once: true });
|
|
953
|
-
promise.then(resolve, reject).finally(() => signal.removeEventListener?.('abort', onAbort));
|
|
954
|
-
});
|
|
955
|
-
}
|
|
956
|
-
function knobs(agent) {
|
|
957
|
-
return {
|
|
958
|
-
id: agent.id,
|
|
959
|
-
name: agent.name,
|
|
960
|
-
bio: agent.bio,
|
|
961
|
-
reasoning: agent.reasoning ?? undefined,
|
|
962
|
-
enabledTools: agent.enabledTools ?? undefined,
|
|
963
|
-
enabledSkills: agent.enabledSkills ?? undefined,
|
|
964
|
-
toolsScope: agent.toolsScope ?? undefined,
|
|
965
|
-
skillsScope: agent.skillsScope ?? undefined,
|
|
966
|
-
ctxSize: agent.ctxSize ?? undefined,
|
|
967
|
-
kvCacheK: agent.kvCacheK ?? undefined,
|
|
968
|
-
kvCacheV: agent.kvCacheV ?? undefined,
|
|
969
|
-
imageModelChoice: agent.imageModelChoice ?? undefined,
|
|
970
|
-
imageSteps: agent.imageSteps ?? undefined,
|
|
971
|
-
imageWidth: agent.imageWidth ?? undefined,
|
|
972
|
-
imageHeight: agent.imageHeight ?? undefined,
|
|
973
|
-
approvalMode: agent.approvalMode ?? undefined,
|
|
974
|
-
disabledToolsets: agent.disabledToolsets ?? undefined,
|
|
975
|
-
sandboxMode: agent.sandboxMode ?? undefined,
|
|
976
|
-
handoffs: agent.handoffs?.map(({ id, description }) => ({ id, description })),
|
|
977
|
-
plan: agent.plan ?? undefined,
|
|
978
|
-
model: agent.model ?? undefined
|
|
979
|
-
};
|
|
980
|
-
}
|
|
981
|
-
function explicitEmptyIdentityFields(context) {
|
|
982
|
-
const fields = [];
|
|
983
|
-
if (context.model === '') {
|
|
984
|
-
fields.push('model');
|
|
985
|
-
}
|
|
986
|
-
if (context.cacheKey === '') {
|
|
987
|
-
fields.push('cacheKey');
|
|
988
|
-
}
|
|
989
|
-
if (context.thinkingDefault === '') {
|
|
990
|
-
fields.push('thinkingDefault');
|
|
991
|
-
}
|
|
992
|
-
if (context.agent?.id === '') {
|
|
993
|
-
fields.push('agent.id');
|
|
994
|
-
}
|
|
995
|
-
if (context.agent?.name === '') {
|
|
996
|
-
fields.push('agent.name');
|
|
997
|
-
}
|
|
998
|
-
if (context.agent?.bio === '') {
|
|
999
|
-
fields.push('agent.bio');
|
|
1000
|
-
}
|
|
1001
|
-
return fields;
|
|
1002
|
-
}
|
|
1003
|
-
async function bridgeAttach(event, attach) {
|
|
1004
|
-
try {
|
|
1005
|
-
if (!attach) {
|
|
1006
|
-
return { type: 'attach-result', message: 'the host cannot persist attachments' };
|
|
1007
|
-
}
|
|
1008
|
-
const bytes = await fs.promises.readFile(event.path ?? '');
|
|
1009
|
-
const record = await attach({
|
|
1010
|
-
fileName: event.fileName ?? '',
|
|
1011
|
-
mimeType: event.mimeType ?? '',
|
|
1012
|
-
bytes,
|
|
1013
|
-
raw: event.raw === true
|
|
1014
|
-
});
|
|
1015
|
-
return {
|
|
1016
|
-
type: 'attach-result',
|
|
1017
|
-
attachment: {
|
|
1018
|
-
id: record.id,
|
|
1019
|
-
fileName: record.fileName,
|
|
1020
|
-
mimeType: record.mimeType,
|
|
1021
|
-
byteLength: record.byteLength
|
|
1022
|
-
}
|
|
1023
|
-
};
|
|
1024
|
-
}
|
|
1025
|
-
catch (err) {
|
|
1026
|
-
return { type: 'attach-result', message: errorMessage(err) };
|
|
1027
|
-
}
|
|
1028
|
-
finally {
|
|
1029
|
-
if (event.path) {
|
|
1030
|
-
void fs.promises.unlink(event.path).catch(noop);
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
}
|
|
1034
|
-
async function bridgeFetch(event, context, staged) {
|
|
1035
|
-
if (!context.fetchAttachment) {
|
|
1036
|
-
return { type: 'fetch-result', message: 'the host cannot read attachments' };
|
|
1037
|
-
}
|
|
1038
|
-
try {
|
|
1039
|
-
const metaOnly = event.meta === true;
|
|
1040
|
-
const found = await context.fetchAttachment({
|
|
1041
|
-
attachmentId: event.attachmentId ?? undefined,
|
|
1042
|
-
meta: metaOnly ? true : undefined,
|
|
1043
|
-
signal: context.signal
|
|
1044
|
-
});
|
|
1045
|
-
if (!found) {
|
|
1046
|
-
return { type: 'fetch-result' };
|
|
1047
|
-
}
|
|
1048
|
-
const size = 'bytes' in found && found.bytes !== null ? found.bytes.byteLength : found.byteLength;
|
|
1049
|
-
if (metaOnly) {
|
|
1050
|
-
return {
|
|
1051
|
-
type: 'fetch-result',
|
|
1052
|
-
meta: true,
|
|
1053
|
-
fileName: found.fileName,
|
|
1054
|
-
mimeType: found.mimeType,
|
|
1055
|
-
attachmentId: found.id,
|
|
1056
|
-
size
|
|
1057
|
-
};
|
|
1058
|
-
}
|
|
1059
|
-
if (!('bytes' in found) || found.bytes === null) {
|
|
1060
|
-
return { type: 'fetch-result', message: 'attachment has no bytes' };
|
|
1061
|
-
}
|
|
1062
|
-
const file = await stageFile('fetch', found.bytes);
|
|
1063
|
-
staged.push(file);
|
|
1064
|
-
return {
|
|
1065
|
-
type: 'fetch-result',
|
|
1066
|
-
path: file,
|
|
1067
|
-
fileName: found.fileName,
|
|
1068
|
-
mimeType: found.mimeType,
|
|
1069
|
-
attachmentId: found.id,
|
|
1070
|
-
size
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
catch (err) {
|
|
1074
|
-
return { type: 'fetch-result', message: errorMessage(err) };
|
|
1075
|
-
}
|
|
1076
|
-
}
|
|
1077
|
-
const DriveRequestSchema = z.discriminatedUnion('op', [
|
|
1078
|
-
z.looseObject({ op: z.literal('entry'), driveKey: z.string(), key: z.string() }),
|
|
1079
|
-
z.looseObject({ op: z.literal('get'), driveKey: z.string(), key: z.string() }),
|
|
1080
|
-
z.looseObject({ op: z.literal('read'), driveKey: z.string(), key: z.string() }),
|
|
1081
|
-
z.looseObject({
|
|
1082
|
-
op: z.literal('list'),
|
|
1083
|
-
driveKey: z.string(),
|
|
1084
|
-
folder: z.string(),
|
|
1085
|
-
skip: z.array(z.string()),
|
|
1086
|
-
limit: z.number(),
|
|
1087
|
-
cursor: z.string().nullable()
|
|
1088
|
-
}),
|
|
1089
|
-
z.looseObject({
|
|
1090
|
-
op: z.literal('write'),
|
|
1091
|
-
driveKey: z.string(),
|
|
1092
|
-
key: z.string(),
|
|
1093
|
-
path: z.string(),
|
|
1094
|
-
executable: z.boolean().optional()
|
|
1095
|
-
})
|
|
1096
|
-
]);
|
|
1097
|
-
async function bridgeDrive(event, context) {
|
|
1098
|
-
if (!context.driveOp) {
|
|
1099
|
-
return { type: 'drive-result', message: 'the host cannot proxy drives' };
|
|
1100
|
-
}
|
|
1101
|
-
try {
|
|
1102
|
-
const payload = await context.driveOp(DriveRequestSchema.parse(event.payload));
|
|
1103
|
-
return { type: 'drive-result', payload };
|
|
1104
|
-
}
|
|
1105
|
-
catch (err) {
|
|
1106
|
-
return { type: 'drive-result', message: errorMessage(err) };
|
|
1107
|
-
}
|
|
1108
|
-
}
|
|
1109
|
-
async function sendInput(input, send) {
|
|
1110
|
-
const iterator = input[Symbol.asyncIterator]();
|
|
1111
|
-
for (;;) {
|
|
1112
|
-
const next = await iterator.next();
|
|
1113
|
-
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1114
|
-
if (next.done || !send(next.value)) {
|
|
1115
|
-
return;
|
|
1116
|
-
}
|
|
1117
|
-
}
|
|
1118
|
-
}
|
|
1119
|
-
function answerQuestion(event, { askUser, reply }) {
|
|
1120
|
-
const callId = event.callId;
|
|
1121
|
-
if (!askUser) {
|
|
1122
|
-
reply({ type: 'question-result', callId, message: 'the host cannot ask questions' });
|
|
1123
|
-
return;
|
|
1124
|
-
}
|
|
1125
|
-
void Promise.resolve()
|
|
1126
|
-
.then(() => askUser({
|
|
1127
|
-
question: event.question ?? '',
|
|
1128
|
-
options: Array.isArray(event.options) ? event.options.map(String) : undefined
|
|
1129
|
-
}))
|
|
1130
|
-
.then((answer) => reply({ type: 'question-result', callId, answer: answer ?? '' }), (err) => reply({ type: 'question-result', callId, message: errorMessage(err) }))
|
|
1131
|
-
.catch((err) => hlog('question reply failed', { callId, message: errorMessage(err) }));
|
|
1132
|
-
}
|
|
1133
|
-
async function bridgeRunLog({ event, context, runId, generation }) {
|
|
1134
|
-
if (!context.runLog || !generation) {
|
|
1135
|
-
return { type: 'run-log-result', message: 'the host does not own this run log' };
|
|
1136
|
-
}
|
|
1137
|
-
const step = event.payload;
|
|
1138
|
-
if (!isEngineStep(step)) {
|
|
1139
|
-
return { type: 'run-log-result', message: 'the worker sent an invalid run-log step' };
|
|
1140
|
-
}
|
|
1141
|
-
try {
|
|
1142
|
-
await context.runLog.append(runId ?? '', generation, step);
|
|
1143
|
-
return { type: 'run-log-result' };
|
|
1144
|
-
}
|
|
1145
|
-
catch (err) {
|
|
1146
|
-
return { type: 'run-log-result', message: errorMessage(err) };
|
|
1147
|
-
}
|
|
1148
|
-
}
|
|
1149
|
-
function isEngineStep(value) {
|
|
1150
|
-
return (isRecord(value) &&
|
|
1151
|
-
typeof value.seq === 'number' &&
|
|
1152
|
-
Number.isSafeInteger(value.seq) &&
|
|
1153
|
-
value.seq >= 0 &&
|
|
1154
|
-
typeof value.expectedLength === 'number' &&
|
|
1155
|
-
Number.isSafeInteger(value.expectedLength) &&
|
|
1156
|
-
value.expectedLength >= 0 &&
|
|
1157
|
-
Array.isArray(value.records));
|
|
1158
|
-
}
|
|
1159
|
-
function isDigestKey(value) {
|
|
1160
|
-
return value instanceof Uint8Array && value.byteLength === 32;
|
|
1161
|
-
}
|
|
1162
|
-
function releaseLateHostLease(pending, runLog, runId) {
|
|
1163
|
-
void pending
|
|
1164
|
-
.then(async (lease) => {
|
|
1165
|
-
if (!lease || typeof lease.generation !== 'string' || !lease.generation) {
|
|
1166
|
-
throw new Error('host returned an invalid generation for an aborted run-log begin');
|
|
1167
|
-
}
|
|
1168
|
-
await runLog.release(runId, lease.generation);
|
|
1169
|
-
})
|
|
1170
|
-
.catch((err) => hlog('aborted run-log begin cleanup failed', {
|
|
1171
|
-
runId,
|
|
1172
|
-
message: errorMessage(err)
|
|
1173
|
-
}));
|
|
1174
|
-
}
|
|
1175
|
-
function validateHostRunLogLease(lease, runId) {
|
|
1176
|
-
if (typeof lease.generation !== 'string' || !lease.generation || !isDigestKey(lease.digestKey)) {
|
|
1177
|
-
throw new Error('host returned an invalid run-log lease');
|
|
1178
|
-
}
|
|
1179
|
-
if (lease.boot) {
|
|
1180
|
-
RunLog.validateEngineBoot(lease.boot);
|
|
1181
|
-
}
|
|
1182
|
-
const metadata = lease.boot?.metadata;
|
|
1183
|
-
if (metadata && metadata.runId !== runId) {
|
|
1184
|
-
throw new Error('host returned a run-log boot for a different run');
|
|
1185
|
-
}
|
|
1186
|
-
}
|
|
1187
|
-
function approvalCall(event) {
|
|
1188
|
-
const identity = isRecord(event.payload) ? event.payload : {};
|
|
1189
|
-
const approval = {
|
|
1190
|
-
name: event.name ?? '',
|
|
1191
|
-
arguments: isRecord(event.arguments) ? event.arguments : {},
|
|
1192
|
-
resource: event.resource ?? null,
|
|
1193
|
-
effect: event.effect === 'read' ? 'read' : 'write',
|
|
1194
|
-
intent: event.intent || null,
|
|
1195
|
-
display: isToolCallDisplay(event.display) ? event.display : null,
|
|
1196
|
-
quote: event.question || null
|
|
1197
|
-
};
|
|
1198
|
-
if (typeof identity.callId === 'string') {
|
|
1199
|
-
approval.callId = identity.callId;
|
|
1200
|
-
}
|
|
1201
|
-
if (typeof identity.round === 'number') {
|
|
1202
|
-
approval.round = identity.round;
|
|
1203
|
-
}
|
|
1204
|
-
return approval;
|
|
1205
|
-
}
|
|
1206
|
-
async function acquireHostRunLogLease(runLog, runId, signal) {
|
|
1207
|
-
if (!runId) {
|
|
1208
|
-
throw new Error('host-owned run log requires a run id');
|
|
1209
|
-
}
|
|
1210
|
-
const pending = runLog.begin(runId);
|
|
1211
|
-
try {
|
|
1212
|
-
return await awaitWithAbort(pending, signal);
|
|
1213
|
-
}
|
|
1214
|
-
catch (err) {
|
|
1215
|
-
if (!signal?.aborted) {
|
|
1216
|
-
throw err;
|
|
1217
|
-
}
|
|
1218
|
-
releaseLateHostLease(pending, runLog, runId);
|
|
1219
|
-
return null;
|
|
1220
|
-
}
|
|
1221
|
-
}
|
|
1222
|
-
function awaitWithAbort(promise, signal) {
|
|
1223
|
-
if (!signal)
|
|
1224
|
-
return promise;
|
|
1225
|
-
if (signal.aborted) {
|
|
1226
|
-
return Promise.reject(new Error('operation aborted'));
|
|
1227
|
-
}
|
|
1228
|
-
return new Promise((resolve, reject) => {
|
|
1229
|
-
let settled = false;
|
|
1230
|
-
const cleanup = () => signal.removeEventListener?.('abort', onAbort);
|
|
1231
|
-
const onAbort = () => {
|
|
1232
|
-
if (settled)
|
|
1233
|
-
return;
|
|
1234
|
-
settled = true;
|
|
1235
|
-
cleanup();
|
|
1236
|
-
reject(new Error('operation aborted'));
|
|
1237
|
-
};
|
|
1238
|
-
signal.addEventListener?.('abort', onAbort, { once: true });
|
|
1239
|
-
promise.then((value) => {
|
|
1240
|
-
if (settled)
|
|
1241
|
-
return;
|
|
1242
|
-
settled = true;
|
|
1243
|
-
cleanup();
|
|
1244
|
-
resolve(value);
|
|
1245
|
-
}, (error) => {
|
|
1246
|
-
if (settled)
|
|
1247
|
-
return;
|
|
1248
|
-
settled = true;
|
|
1249
|
-
cleanup();
|
|
1250
|
-
reject(error);
|
|
1251
|
-
});
|
|
1252
|
-
});
|
|
1253
|
-
}
|
|
1254
|
-
async function* frames(stream) {
|
|
1255
|
-
const queue = pushQueue();
|
|
1256
|
-
let error = null;
|
|
1257
|
-
stream.on('data', (frame) => queue.push(frame));
|
|
1258
|
-
stream.on('end', () => {
|
|
1259
|
-
hlog('client stream event', { event: 'end' });
|
|
1260
|
-
queue.end();
|
|
1261
|
-
});
|
|
1262
|
-
stream.on('close', () => {
|
|
1263
|
-
hlog('client stream event', { event: 'close' });
|
|
1264
|
-
queue.end();
|
|
1265
|
-
});
|
|
1266
|
-
stream.on('error', (err) => {
|
|
1267
|
-
hlog('client stream event', { event: 'error', err: err.message });
|
|
1268
|
-
error = err;
|
|
1269
|
-
queue.end();
|
|
1270
|
-
});
|
|
1271
|
-
yield* queue;
|
|
1272
|
-
if (error) {
|
|
1273
|
-
throw error;
|
|
1274
|
-
}
|
|
1275
|
-
}
|
|
1276
|
-
async function* downloadFrames(stream) {
|
|
1277
|
-
const queue = pushQueue();
|
|
1278
|
-
let error = null;
|
|
1279
|
-
stream.on('data', (frame) => queue.push(frame));
|
|
1280
|
-
stream.on('end', () => queue.end());
|
|
1281
|
-
stream.on('close', () => queue.end());
|
|
1282
|
-
stream.on('error', (err) => {
|
|
1283
|
-
error = err;
|
|
1284
|
-
queue.end();
|
|
1285
|
-
});
|
|
1286
|
-
yield* queue;
|
|
1287
|
-
if (error) {
|
|
1288
|
-
throw error;
|
|
1289
|
-
}
|
|
1290
|
-
}
|