@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
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { compileGlob } from './fs/glob.js';
|
|
2
|
-
import { NO_DIRS_GRANTED, canonicalDenyRoots, defaultRealpath, isDeniedPath, resolveKey } from './fs/scope.js';
|
|
3
|
-
import { walkFiles } from './fs/walk.js';
|
|
4
|
-
export const DEFAULT_GLOB_MATCHES = 100;
|
|
5
|
-
export const MAX_GLOB_MATCHES = 1000;
|
|
6
|
-
export async function searchTargets(dir, roots, { realpath, deny }) {
|
|
7
|
-
if (typeof dir === 'string' && dir.trim()) {
|
|
8
|
-
const resolved = await resolveKey(dir, roots, { realpath, deny });
|
|
9
|
-
if ('error' in resolved) {
|
|
10
|
-
return resolved;
|
|
11
|
-
}
|
|
12
|
-
if (resolved.root.kind === 'local') {
|
|
13
|
-
if (!resolved.exists) {
|
|
14
|
-
return { error: `no such file: ${dir}` };
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
else {
|
|
18
|
-
let hasEntry = false;
|
|
19
|
-
for await (const _entry of resolved.root.drive.list(resolved.key)) {
|
|
20
|
-
hasEntry = true;
|
|
21
|
-
break;
|
|
22
|
-
}
|
|
23
|
-
if (!hasEntry && (await resolved.root.drive.entry(resolved.key)) === null) {
|
|
24
|
-
return { error: `no such file: ${dir}` };
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return { targets: [{ root: resolved.root, folder: resolved.key }] };
|
|
28
|
-
}
|
|
29
|
-
if (roots.length === 0) {
|
|
30
|
-
return { error: NO_DIRS_GRANTED };
|
|
31
|
-
}
|
|
32
|
-
return { targets: roots.map((root) => ({ root, folder: '/' })) };
|
|
33
|
-
}
|
|
34
|
-
export function relativeKey(key, folder) {
|
|
35
|
-
return folder === '/' ? key.slice(1) : key.slice(folder.length + 1);
|
|
36
|
-
}
|
|
37
|
-
export function createFileGlobTool({ realpath = defaultRealpath, deniedRoots } = {}) {
|
|
38
|
-
return {
|
|
39
|
-
name: 'file_glob',
|
|
40
|
-
toolset: 'files',
|
|
41
|
-
description: 'List files matching a glob pattern inside the granted directories. ' +
|
|
42
|
-
'Use ** to cross directories (e.g. "**/*.ts"). Returns absolute paths. ' +
|
|
43
|
-
'Symlinks are never followed; skippedLinks counts the ones left out.',
|
|
44
|
-
parameters: {
|
|
45
|
-
type: 'object',
|
|
46
|
-
properties: {
|
|
47
|
-
pattern: { type: 'string', description: 'Glob pattern relative to the searched directory' },
|
|
48
|
-
dir: {
|
|
49
|
-
type: 'string',
|
|
50
|
-
description: 'Optional directory to search (default: every granted directory)'
|
|
51
|
-
},
|
|
52
|
-
limit: {
|
|
53
|
-
type: 'number',
|
|
54
|
-
description: `Optional match cap (default ${DEFAULT_GLOB_MATCHES}, max ${MAX_GLOB_MATCHES})`
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
required: ['pattern']
|
|
58
|
-
},
|
|
59
|
-
effect: () => 'read',
|
|
60
|
-
concurrent: true,
|
|
61
|
-
autoApprove: true,
|
|
62
|
-
rootsRequired: true,
|
|
63
|
-
validate(rawArgs) {
|
|
64
|
-
if (typeof rawArgs.pattern !== 'string' || !rawArgs.pattern.trim()) {
|
|
65
|
-
return 'pattern is required';
|
|
66
|
-
}
|
|
67
|
-
const limit = rawArgs.limit;
|
|
68
|
-
if (limit !== undefined && limit !== null) {
|
|
69
|
-
const n = Number(limit);
|
|
70
|
-
if (!Number.isInteger(n) || n <= 0 || n > MAX_GLOB_MATCHES) {
|
|
71
|
-
return `limit must be a positive integer ≤ ${MAX_GLOB_MATCHES}`;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
},
|
|
76
|
-
resource(args) {
|
|
77
|
-
const pattern = String(args.pattern ?? '').trim();
|
|
78
|
-
return pattern ? { kind: 'file', label: `glob ${pattern}` } : null;
|
|
79
|
-
},
|
|
80
|
-
async execute(rawArgs, ctx) {
|
|
81
|
-
const roots = ctx?.fsRoots ?? [];
|
|
82
|
-
const pattern = String(rawArgs.pattern ?? '').trim();
|
|
83
|
-
if (!pattern) {
|
|
84
|
-
return { error: 'pattern is required' };
|
|
85
|
-
}
|
|
86
|
-
const limit = rawArgs.limit ? Number(rawArgs.limit) : DEFAULT_GLOB_MATCHES;
|
|
87
|
-
const deny = await canonicalDenyRoots(deniedRoots, realpath);
|
|
88
|
-
const scoped = await searchTargets(rawArgs.dir, roots, { realpath, deny });
|
|
89
|
-
if ('error' in scoped) {
|
|
90
|
-
return scoped;
|
|
91
|
-
}
|
|
92
|
-
const match = compileGlob(pattern);
|
|
93
|
-
const matches = [];
|
|
94
|
-
let truncated = false;
|
|
95
|
-
let skippedLinks = 0;
|
|
96
|
-
for (const target of scoped.targets) {
|
|
97
|
-
const walk = await walkFiles(target.root, target.folder);
|
|
98
|
-
truncated ||= walk.truncated;
|
|
99
|
-
skippedLinks += walk.skippedLinks;
|
|
100
|
-
for (const file of walk.files) {
|
|
101
|
-
if (isDeniedPath(file.path, deny))
|
|
102
|
-
continue;
|
|
103
|
-
if (!match(relativeKey(file.key, target.folder)))
|
|
104
|
-
continue;
|
|
105
|
-
matches.push(file.path);
|
|
106
|
-
if (matches.length >= limit) {
|
|
107
|
-
return { matches, truncated: true, skippedLinks: skippedLinks || undefined };
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
matches,
|
|
113
|
-
truncated: truncated || undefined,
|
|
114
|
-
skippedLinks: skippedLinks || undefined
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
};
|
|
118
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../contract/index.ts';
|
|
2
|
-
import { type FsToolOptions } from './fs/scope.ts';
|
|
3
|
-
export declare const DEFAULT_GREP_MATCHES = 200;
|
|
4
|
-
export declare const MAX_GREP_MATCHES = 1000;
|
|
5
|
-
export declare function createGrepTool({ realpath, deniedRoots }?: FsToolOptions): ToolDefinition;
|
|
@@ -1,184 +0,0 @@
|
|
|
1
|
-
import { errorMessage } from '../guards.js';
|
|
2
|
-
import { hlog } from '../log.js';
|
|
3
|
-
import { searchTargets } from './file-glob.js';
|
|
4
|
-
import { readLines } from './fs/read.js';
|
|
5
|
-
import { isDriveReadTruncated } from './fs/remote.js';
|
|
6
|
-
import { canonicalDenyRoots, defaultRealpath, isDeniedPath } from './fs/scope.js';
|
|
7
|
-
import { walkFiles } from './fs/walk.js';
|
|
8
|
-
export const DEFAULT_GREP_MATCHES = 200;
|
|
9
|
-
export const MAX_GREP_MATCHES = 1000;
|
|
10
|
-
const MAX_LINE_CHARS = 500;
|
|
11
|
-
const BINARY_PROBE_CHARS = 1024;
|
|
12
|
-
async function scanFile(drive, key, { path, tests, room }) {
|
|
13
|
-
const hits = [];
|
|
14
|
-
let probed = 0;
|
|
15
|
-
let binary = false;
|
|
16
|
-
let index = 0;
|
|
17
|
-
try {
|
|
18
|
-
for await (const line of readLines(drive, key)) {
|
|
19
|
-
index++;
|
|
20
|
-
if (probed < BINARY_PROBE_CHARS && line.includes('\0')) {
|
|
21
|
-
binary = true;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
if (probed < BINARY_PROBE_CHARS) {
|
|
25
|
-
probed += line.length + 1;
|
|
26
|
-
}
|
|
27
|
-
if (!tests.some((test) => test(line))) {
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
hits.push({ file: path, line: index, text: line.slice(0, MAX_LINE_CHARS) });
|
|
31
|
-
if (hits.length >= room) {
|
|
32
|
-
return { hits, binary, end: 'capped' };
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
catch (error) {
|
|
37
|
-
if (isDriveReadTruncated(error)) {
|
|
38
|
-
return { hits, binary, end: 'cut' };
|
|
39
|
-
}
|
|
40
|
-
return { hits, binary, end: 'unreadable', error };
|
|
41
|
-
}
|
|
42
|
-
return { hits, binary, end: 'complete' };
|
|
43
|
-
}
|
|
44
|
-
function stringArray(raw) {
|
|
45
|
-
if (!Array.isArray(raw) || raw.length === 0)
|
|
46
|
-
return null;
|
|
47
|
-
const values = raw.filter((entry) => typeof entry === 'string' && entry.length > 0);
|
|
48
|
-
return values.length === raw.length ? values : null;
|
|
49
|
-
}
|
|
50
|
-
function compileQueries(queries, regex, caseSensitive) {
|
|
51
|
-
if (regex) {
|
|
52
|
-
try {
|
|
53
|
-
return queries.map((q) => {
|
|
54
|
-
const rx = new RegExp(q, caseSensitive ? '' : 'i');
|
|
55
|
-
return (line) => rx.test(line);
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
catch (err) {
|
|
59
|
-
return { error: `invalid regex: ${errorMessage(err)}` };
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return queries.map((q) => {
|
|
63
|
-
const needle = caseSensitive ? q : q.toLowerCase();
|
|
64
|
-
return caseSensitive
|
|
65
|
-
? (line) => line.includes(needle)
|
|
66
|
-
: (line) => line.toLowerCase().includes(needle);
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
export function createGrepTool({ realpath = defaultRealpath, deniedRoots } = {}) {
|
|
70
|
-
return {
|
|
71
|
-
name: 'grep',
|
|
72
|
-
toolset: 'files',
|
|
73
|
-
description: 'Search file contents inside the granted directories. Queries are literal ' +
|
|
74
|
-
'substrings by default (case-insensitive); set regex=true for patterns. ' +
|
|
75
|
-
'Returns matching lines with file and line number. Symlinks are never ' +
|
|
76
|
-
'followed; skippedLinks counts the ones left out.',
|
|
77
|
-
parameters: {
|
|
78
|
-
type: 'object',
|
|
79
|
-
properties: {
|
|
80
|
-
queries: {
|
|
81
|
-
type: 'array',
|
|
82
|
-
description: 'Text or patterns to search for',
|
|
83
|
-
items: { type: 'string' }
|
|
84
|
-
},
|
|
85
|
-
dir: {
|
|
86
|
-
type: 'string',
|
|
87
|
-
description: 'Optional directory to search (default: every granted directory)'
|
|
88
|
-
},
|
|
89
|
-
regex: {
|
|
90
|
-
type: 'boolean',
|
|
91
|
-
description: 'Treat queries as regular expressions (default false)'
|
|
92
|
-
},
|
|
93
|
-
caseSensitive: { type: 'boolean', description: 'Match case exactly (default false)' },
|
|
94
|
-
maxMatches: {
|
|
95
|
-
type: 'number',
|
|
96
|
-
description: `Optional match cap (default ${DEFAULT_GREP_MATCHES}, max ${MAX_GREP_MATCHES})`
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
required: ['queries']
|
|
100
|
-
},
|
|
101
|
-
effect: () => 'read',
|
|
102
|
-
concurrent: true,
|
|
103
|
-
autoApprove: true,
|
|
104
|
-
rootsRequired: true,
|
|
105
|
-
validate(rawArgs) {
|
|
106
|
-
const queries = stringArray(rawArgs.queries);
|
|
107
|
-
if (!queries) {
|
|
108
|
-
return 'queries must be a non-empty array of strings';
|
|
109
|
-
}
|
|
110
|
-
const compiled = compileQueries(queries, rawArgs.regex === true, rawArgs.caseSensitive === true);
|
|
111
|
-
if ('error' in compiled) {
|
|
112
|
-
return compiled.error;
|
|
113
|
-
}
|
|
114
|
-
const maxMatches = rawArgs.maxMatches;
|
|
115
|
-
if (maxMatches !== undefined && maxMatches !== null) {
|
|
116
|
-
const n = Number(maxMatches);
|
|
117
|
-
if (!Number.isInteger(n) || n <= 0 || n > MAX_GREP_MATCHES) {
|
|
118
|
-
return `maxMatches must be a positive integer ≤ ${MAX_GREP_MATCHES}`;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
return null;
|
|
122
|
-
},
|
|
123
|
-
resource(args) {
|
|
124
|
-
const queries = stringArray(args.queries);
|
|
125
|
-
return queries ? { kind: 'file', label: `grep ${queries.join(', ')}` } : null;
|
|
126
|
-
},
|
|
127
|
-
async execute(rawArgs, ctx) {
|
|
128
|
-
const roots = ctx?.fsRoots ?? [];
|
|
129
|
-
const queries = stringArray(rawArgs.queries);
|
|
130
|
-
if (!queries) {
|
|
131
|
-
return { error: 'queries must be a non-empty array of strings' };
|
|
132
|
-
}
|
|
133
|
-
const compiled = compileQueries(queries, rawArgs.regex === true, rawArgs.caseSensitive === true);
|
|
134
|
-
if ('error' in compiled) {
|
|
135
|
-
return compiled;
|
|
136
|
-
}
|
|
137
|
-
const maxMatches = rawArgs.maxMatches ? Number(rawArgs.maxMatches) : DEFAULT_GREP_MATCHES;
|
|
138
|
-
const deny = await canonicalDenyRoots(deniedRoots, realpath);
|
|
139
|
-
const scoped = await searchTargets(rawArgs.dir, roots, { realpath, deny });
|
|
140
|
-
if ('error' in scoped) {
|
|
141
|
-
return scoped;
|
|
142
|
-
}
|
|
143
|
-
const matches = [];
|
|
144
|
-
let truncated = false;
|
|
145
|
-
let skippedLinks = 0;
|
|
146
|
-
for (const target of scoped.targets) {
|
|
147
|
-
const walk = await walkFiles(target.root, target.folder);
|
|
148
|
-
truncated ||= walk.truncated;
|
|
149
|
-
skippedLinks += walk.skippedLinks;
|
|
150
|
-
for (const file of walk.files) {
|
|
151
|
-
if (isDeniedPath(file.path, deny))
|
|
152
|
-
continue;
|
|
153
|
-
const scan = await scanFile(target.root.drive, file.key, {
|
|
154
|
-
path: file.path,
|
|
155
|
-
tests: compiled,
|
|
156
|
-
room: maxMatches - matches.length
|
|
157
|
-
});
|
|
158
|
-
if (scan.end === 'capped') {
|
|
159
|
-
matches.push(...scan.hits);
|
|
160
|
-
return { matches, truncated: true, skippedLinks: skippedLinks || undefined };
|
|
161
|
-
}
|
|
162
|
-
if (scan.end === 'unreadable') {
|
|
163
|
-
hlog('warn: grep skipped a file', {
|
|
164
|
-
file: file.path,
|
|
165
|
-
err: errorMessage(scan.error)
|
|
166
|
-
});
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
if (scan.end === 'cut') {
|
|
170
|
-
truncated = true;
|
|
171
|
-
}
|
|
172
|
-
if (!scan.binary) {
|
|
173
|
-
matches.push(...scan.hits);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
|
-
return {
|
|
178
|
-
matches,
|
|
179
|
-
truncated: truncated || undefined,
|
|
180
|
-
skippedLinks: skippedLinks || undefined
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { ToolDefinition } from '../contract/index.ts';
|
|
2
|
-
import { type FsToolOptions } from './fs/scope.ts';
|
|
3
|
-
export declare const DEFAULT_READ_CHARS = 8192;
|
|
4
|
-
export declare const MAX_READ_CHARS = 65536;
|
|
5
|
-
export declare function createReadFilesTool({ realpath, deniedRoots }?: FsToolOptions): ToolDefinition;
|
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
import { errorMessage, isRecord } from '../guards.js';
|
|
2
|
-
import { createLocalRoots } from './fs/local.js';
|
|
3
|
-
import { readLines } from './fs/read.js';
|
|
4
|
-
import { isDriveReadTruncated } from './fs/remote.js';
|
|
5
|
-
import { canonicalDenyRoots, defaultRealpath, resolveKey } from './fs/scope.js';
|
|
6
|
-
export const DEFAULT_READ_CHARS = 8192;
|
|
7
|
-
export const MAX_READ_CHARS = 65_536;
|
|
8
|
-
function lineIndex(value) {
|
|
9
|
-
if (value === undefined || value === null)
|
|
10
|
-
return undefined;
|
|
11
|
-
const n = Number(value);
|
|
12
|
-
if (!Number.isInteger(n) || n < 1) {
|
|
13
|
-
return null;
|
|
14
|
-
}
|
|
15
|
-
return n;
|
|
16
|
-
}
|
|
17
|
-
function fileRequests(raw) {
|
|
18
|
-
if (!Array.isArray(raw) || raw.length === 0)
|
|
19
|
-
return null;
|
|
20
|
-
const files = [];
|
|
21
|
-
for (const entry of raw) {
|
|
22
|
-
if (!isRecord(entry) || typeof entry.path !== 'string' || !entry.path.trim()) {
|
|
23
|
-
return null;
|
|
24
|
-
}
|
|
25
|
-
const startLine = lineIndex(entry.startLine);
|
|
26
|
-
const endLine = lineIndex(entry.endLine);
|
|
27
|
-
if (startLine === null || endLine === null) {
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
files.push({ path: entry.path, startLine, endLine });
|
|
31
|
-
}
|
|
32
|
-
return files;
|
|
33
|
-
}
|
|
34
|
-
async function slice(drive, key, { request, maxChars }) {
|
|
35
|
-
const first = request.startLine ?? 1;
|
|
36
|
-
const last = request.endLine ?? Infinity;
|
|
37
|
-
const kept = [];
|
|
38
|
-
let length = 0;
|
|
39
|
-
let index = 0;
|
|
40
|
-
let capped = false;
|
|
41
|
-
try {
|
|
42
|
-
for await (const line of readLines(drive, key)) {
|
|
43
|
-
if (++index < first)
|
|
44
|
-
continue;
|
|
45
|
-
if (index > last)
|
|
46
|
-
break;
|
|
47
|
-
kept.push(line);
|
|
48
|
-
length += line.length + (kept.length > 1 ? 1 : 0);
|
|
49
|
-
if (length > maxChars) {
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
catch (err) {
|
|
55
|
-
if (!isDriveReadTruncated(err)) {
|
|
56
|
-
throw err;
|
|
57
|
-
}
|
|
58
|
-
capped = true;
|
|
59
|
-
}
|
|
60
|
-
const text = kept.join('\n');
|
|
61
|
-
return text.length > maxChars || capped
|
|
62
|
-
? { content: text.slice(0, maxChars), truncated: true }
|
|
63
|
-
: { content: text };
|
|
64
|
-
}
|
|
65
|
-
export function createReadFilesTool({ realpath = defaultRealpath, deniedRoots } = {}) {
|
|
66
|
-
return {
|
|
67
|
-
name: 'read_files',
|
|
68
|
-
toolset: 'files',
|
|
69
|
-
description: 'Read the contents of one or more files inside the granted directories. ' +
|
|
70
|
-
'Optionally slice by 1-indexed line range. Failures are reported per file.',
|
|
71
|
-
parameters: {
|
|
72
|
-
type: 'object',
|
|
73
|
-
properties: {
|
|
74
|
-
files: {
|
|
75
|
-
type: 'array',
|
|
76
|
-
description: 'Files to read',
|
|
77
|
-
items: {
|
|
78
|
-
type: 'object',
|
|
79
|
-
properties: {
|
|
80
|
-
path: { type: 'string', description: 'File path' },
|
|
81
|
-
startLine: { type: 'number', description: 'Optional 1-indexed first line' },
|
|
82
|
-
endLine: { type: 'number', description: 'Optional 1-indexed last line (inclusive)' }
|
|
83
|
-
},
|
|
84
|
-
required: ['path']
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
maxChars: {
|
|
88
|
-
type: 'number',
|
|
89
|
-
description: `Optional per-file cap in characters (default ${DEFAULT_READ_CHARS}, max ${MAX_READ_CHARS})`
|
|
90
|
-
}
|
|
91
|
-
},
|
|
92
|
-
required: ['files']
|
|
93
|
-
},
|
|
94
|
-
effect: () => 'read',
|
|
95
|
-
concurrent: true,
|
|
96
|
-
autoApprove: true,
|
|
97
|
-
rootsRequired: true,
|
|
98
|
-
validate(rawArgs) {
|
|
99
|
-
if (!fileRequests(rawArgs.files)) {
|
|
100
|
-
return 'files must be a non-empty array of { path } with optional positive integer startLine/endLine';
|
|
101
|
-
}
|
|
102
|
-
const maxChars = rawArgs.maxChars;
|
|
103
|
-
if (maxChars !== undefined && maxChars !== null) {
|
|
104
|
-
const n = Number(maxChars);
|
|
105
|
-
if (!Number.isInteger(n) || n <= 0 || n > MAX_READ_CHARS) {
|
|
106
|
-
return `maxChars must be a positive integer ≤ ${MAX_READ_CHARS}`;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
return null;
|
|
110
|
-
},
|
|
111
|
-
resource(args) {
|
|
112
|
-
const files = fileRequests(args.files);
|
|
113
|
-
if (!files) {
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
const label = files
|
|
117
|
-
.map((f) => f.path)
|
|
118
|
-
.slice(0, 3)
|
|
119
|
-
.join(', ');
|
|
120
|
-
return {
|
|
121
|
-
kind: 'file',
|
|
122
|
-
label: files.length > 3 ? `${label} (+${files.length - 3} more)` : label
|
|
123
|
-
};
|
|
124
|
-
},
|
|
125
|
-
async execute(rawArgs, ctx) {
|
|
126
|
-
const roots = ctx?.fsRoots ?? [];
|
|
127
|
-
const requests = fileRequests(rawArgs.files);
|
|
128
|
-
if (!requests) {
|
|
129
|
-
return { error: 'files must be a non-empty array of { path }' };
|
|
130
|
-
}
|
|
131
|
-
const maxChars = rawArgs.maxChars ? Number(rawArgs.maxChars) : DEFAULT_READ_CHARS;
|
|
132
|
-
const files = [];
|
|
133
|
-
const failed = [];
|
|
134
|
-
const deny = await canonicalDenyRoots(deniedRoots, realpath);
|
|
135
|
-
const spill = ctx?.spill ? await createLocalRoots([ctx.spill.dir], realpath) : [];
|
|
136
|
-
for (const request of requests) {
|
|
137
|
-
const own = spill.length ? await resolveKey(request.path, spill, { realpath }) : null;
|
|
138
|
-
const resolved = own && !('error' in own) ? own : await resolveKey(request.path, roots, { realpath, deny });
|
|
139
|
-
if ('error' in resolved) {
|
|
140
|
-
failed.push({ path: request.path, error: resolved.error });
|
|
141
|
-
continue;
|
|
142
|
-
}
|
|
143
|
-
try {
|
|
144
|
-
if ((await resolved.root.drive.entry(resolved.key)) === null) {
|
|
145
|
-
failed.push({ path: request.path, error: `no such file: ${request.path}` });
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
files.push({
|
|
149
|
-
path: request.path,
|
|
150
|
-
...(await slice(resolved.root.drive, resolved.key, { request, maxChars }))
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
catch (err) {
|
|
154
|
-
failed.push({ path: request.path, error: errorMessage(err) });
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return { files, failed: failed.length ? failed : undefined };
|
|
158
|
-
}
|
|
159
|
-
};
|
|
160
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { writeText } from '../../lib/tools/fs/write.js';
|
|
2
|
-
import { errorText, isError, workspaceKey } from './session.js';
|
|
3
|
-
async function fileKey(root, file) {
|
|
4
|
-
const key = await workspaceKey(root, file);
|
|
5
|
-
return key === '/' ? { error: 'path names the project folder, not a file' } : key;
|
|
6
|
-
}
|
|
7
|
-
async function writeFile(session, args, ctx) {
|
|
8
|
-
const root = await session.workspace(ctx);
|
|
9
|
-
if (isError(root)) {
|
|
10
|
-
return root;
|
|
11
|
-
}
|
|
12
|
-
const file = String(args.path);
|
|
13
|
-
const key = await fileKey(root, file);
|
|
14
|
-
if (isError(key)) {
|
|
15
|
-
return key;
|
|
16
|
-
}
|
|
17
|
-
try {
|
|
18
|
-
const existed = (await root.drive.entry(key)) !== null;
|
|
19
|
-
await writeText(root.drive, key, String(args.content));
|
|
20
|
-
return { path: file, written: existed ? 'overwritten' : 'created' };
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
return { error: errorText(error) };
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
export function writeFileTool(session) {
|
|
27
|
-
return {
|
|
28
|
-
name: 'write_file',
|
|
29
|
-
toolset: 'coding',
|
|
30
|
-
policyVersion: session.policyVersion(),
|
|
31
|
-
description: 'Create a file or overwrite it with the full content, inside the project. Parent ' +
|
|
32
|
-
'directories are created as needed. A relative path starts at the project folder.',
|
|
33
|
-
parameters: {
|
|
34
|
-
type: 'object',
|
|
35
|
-
properties: {
|
|
36
|
-
path: { type: 'string', description: 'File path' },
|
|
37
|
-
content: { type: 'string', description: 'Full file content' }
|
|
38
|
-
},
|
|
39
|
-
required: ['path', 'content']
|
|
40
|
-
},
|
|
41
|
-
effect: (_args, ctx) => session.effect(ctx),
|
|
42
|
-
quote: (args) => typeof args.path === 'string' && typeof args.content === 'string'
|
|
43
|
-
? `write ${args.path}, ${args.content.length} chars`
|
|
44
|
-
: null,
|
|
45
|
-
validate(args) {
|
|
46
|
-
return typeof args.path === 'string' && args.path.trim() && typeof args.content === 'string'
|
|
47
|
-
? null
|
|
48
|
-
: 'path must be a non-empty string and content a string';
|
|
49
|
-
},
|
|
50
|
-
execute: (args, ctx) => writeFile(session, args, ctx)
|
|
51
|
-
};
|
|
52
|
-
}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
diff --git a/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js b/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js
|
|
2
|
-
index 0040b6b39705a97e772a7c6e0d2b6d6fa679a18d..234802b06343bcb628609fca9378d15e7a38d15e 100644
|
|
3
|
-
--- a/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js
|
|
4
|
-
+++ b/dist/plugins/builtin/llamacpp-completion/ops/completion-stream.js
|
|
5
|
-
@@ -276,7 +276,10 @@ export async function* completion(params, opts) {
|
|
6
|
-
const transformedHistory = transformMessages(historyWithTools);
|
|
7
|
-
logCacheDisabled();
|
|
8
|
-
logMessagesToAddon(transformedHistory, 'NO_CACHE');
|
|
9
|
-
- return yield* processModelResponse(model, transformedHistory, callableTools, mergedGenerationParams, undefined, dialect, setActiveResponse);
|
|
10
|
-
+ // qvac-app patch: see the PROMPT_SEND path below
|
|
11
|
-
+ const uncached = yield* processModelResponse(model, transformedHistory, callableTools, mergedGenerationParams, undefined, dialect, setActiveResponse);
|
|
12
|
-
+ if (uncached?.stats) uncached.stats.sentMessages = transformedHistory;
|
|
13
|
-
+ return uncached;
|
|
14
|
-
}
|
|
15
|
-
// ---- KV-cache path. The session owns every bookkeeping layer; the handler
|
|
16
|
-
// registers one deferred unwind that `commitTurn` short-circuits on the happy
|
|
17
|
-
@@ -349,6 +352,9 @@ export async function* completion(params, opts) {
|
|
18
|
-
preserveCacheOnUnwind = !addonRunSettled;
|
|
19
|
-
throw error;
|
|
20
|
-
}
|
|
21
|
-
+ // qvac-app patch: the messages the cache slice actually pushed, for the prompt inspector.
|
|
22
|
-
+ // Rides the call's own result, so it needs no correlation back to the request.
|
|
23
|
-
+ if (result?.stats) result.stats.sentMessages = messagesToSend;
|
|
24
|
-
const shouldCommitTurn = shouldCommitCachedTurn({
|
|
25
|
-
aborted: signal.aborted,
|
|
26
|
-
producedTokens: result.producedTokens,
|
|
27
|
-
diff --git a/dist/schemas/completion-event.d.ts b/dist/schemas/completion-event.d.ts
|
|
28
|
-
index 7c126fa0750ddc75c5da0a2d54e9468e429a64d8..44be4282cce1c156e3548ffb7a376a203d8b3b6b 100644
|
|
29
|
-
--- a/dist/schemas/completion-event.d.ts
|
|
30
|
-
+++ b/dist/schemas/completion-event.d.ts
|
|
31
|
-
@@ -5,6 +5,7 @@ export declare const completionStatsSchema: z.ZodObject<{
|
|
32
|
-
timeToFirstToken: z.ZodOptional<z.ZodNumber>;
|
|
33
|
-
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
34
|
-
promptTokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
35
|
-
+ sentMessages: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
36
|
-
cacheTokens: z.ZodOptional<z.ZodNumber>;
|
|
37
|
-
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
38
|
-
generatedTokens: z.ZodOptional<z.ZodNumber>;
|
|
39
|
-
@@ -63,6 +64,7 @@ export declare const statsEventSchema: z.ZodObject<{
|
|
40
|
-
timeToFirstToken: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
42
|
-
promptTokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
43
|
-
+ sentMessages: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
44
|
-
cacheTokens: z.ZodOptional<z.ZodNumber>;
|
|
45
|
-
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
46
|
-
generatedTokens: z.ZodOptional<z.ZodNumber>;
|
|
47
|
-
@@ -147,6 +149,7 @@ export declare const completionEventSchema: z.ZodUnion<readonly [z.ZodObject<{
|
|
48
|
-
timeToFirstToken: z.ZodOptional<z.ZodNumber>;
|
|
49
|
-
tokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
50
|
-
promptTokensPerSecond: z.ZodOptional<z.ZodNumber>;
|
|
51
|
-
+ sentMessages: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
|
|
52
|
-
cacheTokens: z.ZodOptional<z.ZodNumber>;
|
|
53
|
-
promptTokens: z.ZodOptional<z.ZodNumber>;
|
|
54
|
-
generatedTokens: z.ZodOptional<z.ZodNumber>;
|
|
55
|
-
diff --git a/dist/schemas/completion-event.js b/dist/schemas/completion-event.js
|
|
56
|
-
index 1ef0d68a9a8cf6f590988272e114ac54ea093614..1d110710d476eed33ed5118f6f32f605f8ea5be8 100644
|
|
57
|
-
--- a/dist/schemas/completion-event.js
|
|
58
|
-
+++ b/dist/schemas/completion-event.js
|
|
59
|
-
@@ -4,6 +4,8 @@ export const completionStatsSchema = z.object({
|
|
60
|
-
timeToFirstToken: z.number().optional(),
|
|
61
|
-
tokensPerSecond: z.number().optional(),
|
|
62
|
-
promptTokensPerSecond: z.number().optional(),
|
|
63
|
-
+ // qvac-harness patch: the post-cache messages the SDK pushed to the addon
|
|
64
|
-
+ sentMessages: z.array(z.unknown()).optional(),
|
|
65
|
-
cacheTokens: z.number().optional(),
|
|
66
|
-
promptTokens: z.number().optional(),
|
|
67
|
-
// Decode count (`llama_perf` `n_eval`) — length / KV-cache budget decisions.
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
diff --git a/lib/host.d.ts b/lib/host.d.ts
|
|
2
|
-
index dacda847a9efbeab6991bbd7adf3ee644aad1523..82d3a1e11cef3c449ec00e2dc11908ed081f0aed 100644
|
|
3
|
-
--- a/lib/host.d.ts
|
|
4
|
-
+++ b/lib/host.d.ts
|
|
5
|
-
@@ -12,8 +12,4 @@ declare class IPC {
|
|
6
|
-
|
|
7
|
-
declare function wrap(stream: Duplex): IPC
|
|
8
|
-
|
|
9
|
-
-declare namespace wrap {
|
|
10
|
-
- export { IPC }
|
|
11
|
-
-}
|
|
12
|
-
-
|
|
13
|
-
-export = wrap
|
|
14
|
-
+export { type IPC, wrap }
|
|
15
|
-
diff --git a/lib/host.js b/lib/host.js
|
|
16
|
-
index 7e62e044374ffa5db7dd3f8bd231e8cd0b973d70..1233405a9e437c6ff1b28a7db968b65dc8f6cd58 100644
|
|
17
|
-
--- a/lib/host.js
|
|
18
|
-
+++ b/lib/host.js
|
|
19
|
-
@@ -5,17 +5,27 @@ class IPC extends Protocol {
|
|
20
|
-
super(stream)
|
|
21
|
-
|
|
22
|
-
this._ready = new Promise((resolve, reject) => {
|
|
23
|
-
+ const cleanup = () => {
|
|
24
|
-
+ this.off('ready', onready)
|
|
25
|
-
+ .off('error', onerror)
|
|
26
|
-
+ .off('close', onclose)
|
|
27
|
-
+ .off('exit', onexit)
|
|
28
|
-
+ }
|
|
29
|
-
+
|
|
30
|
-
const onready = () => {
|
|
31
|
-
- this.off('ready', onready).off('error', onerror)
|
|
32
|
-
+ cleanup()
|
|
33
|
-
resolve()
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
const onerror = (err) => {
|
|
37
|
-
- this.off('ready', onready).off('error', onerror)
|
|
38
|
-
+ cleanup()
|
|
39
|
-
reject(err)
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
- this.on('ready', onready).on('error', onerror)
|
|
43
|
-
+ const onclose = () => onerror(new Error('Worker IPC closed before ready'))
|
|
44
|
-
+ const onexit = (code) => onerror(new Error(`Worker exited (${code}) before ready`))
|
|
45
|
-
+
|
|
46
|
-
+ this.on('ready', onready).on('error', onerror).on('close', onclose).on('exit', onexit)
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
this._ready.catch(() => {})
|
|
50
|
-
@@ -50,8 +60,16 @@ class IPC extends Protocol {
|
|
51
|
-
_destroy(err, cb) {
|
|
52
|
-
if (this._stream.destroyed) return cb(null)
|
|
53
|
-
|
|
54
|
-
- this.send('terminate')
|
|
55
|
-
- this._stream.once('close', () => cb(null))
|
|
56
|
-
+ let finished = false
|
|
57
|
-
+ const finish = () => {
|
|
58
|
-
+ if (finished) return
|
|
59
|
-
+ finished = true
|
|
60
|
-
+ if (!this._stream.destroyed) this._stream.destroy()
|
|
61
|
-
+ cb(null)
|
|
62
|
-
+ }
|
|
63
|
-
+
|
|
64
|
-
+ this.send('terminate').then(finish, finish)
|
|
65
|
-
+ this._stream.once('close', finish)
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
|