@qvac/harness 1.0.0-rc.9 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +696 -7
- package/NOTICE.md +0 -16
- package/README.md +46 -5
- package/dist-lib/index.d.ts +23 -16
- package/dist-lib/index.js +127 -23
- package/dist-lib/lib/agent/delegate.d.ts +1 -0
- package/dist-lib/lib/agent/delegate.js +10 -9
- package/dist-lib/lib/agent/follow.d.ts +1 -0
- package/dist-lib/lib/agent/follow.js +12 -2
- package/dist-lib/lib/agent/resolve.js +11 -3
- package/dist-lib/lib/agent/tools.d.ts +1 -0
- package/dist-lib/lib/agent/tools.js +1 -1
- package/dist-lib/lib/capabilities/agent-ports.d.ts +1 -1
- package/dist-lib/lib/capabilities/agent-ports.js +8 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/answering.js +2 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/direct-search.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/execute.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/executing.js +79 -9
- package/dist-lib/lib/capabilities/completion-engine/actors/execution-plan.js +12 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/inspect-prepare.js +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.d.ts +1 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/inspecting.js +13 -8
- package/dist-lib/lib/capabilities/completion-engine/actors/loading-skill.js +3 -2
- package/dist-lib/lib/capabilities/completion-engine/actors/preparing.js +47 -22
- package/dist-lib/lib/capabilities/completion-engine/actors/rejecting.js +5 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/resolving.js +10 -4
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/actors/retrieving.js +19 -11
- package/dist-lib/lib/capabilities/completion-engine/actors/run-prepare.js +38 -23
- package/dist-lib/lib/capabilities/completion-engine/actors/skill-step.js +31 -10
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/actors/stream.js +61 -7
- package/dist-lib/lib/capabilities/completion-engine/actors/streaming.js +41 -16
- package/dist-lib/lib/capabilities/completion-engine/actors/wrap-up.js +26 -10
- package/dist-lib/lib/capabilities/completion-engine/actors.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/actors.js +8 -8
- package/dist-lib/lib/capabilities/completion-engine/driver.d.ts +0 -1
- package/dist-lib/lib/capabilities/completion-engine/driver.js +30 -6
- package/dist-lib/lib/capabilities/completion-engine/durable.d.ts +2 -1
- package/dist-lib/lib/capabilities/completion-engine/durable.js +7 -1
- package/dist-lib/lib/capabilities/completion-engine/engine.d.ts +2 -0
- package/dist-lib/lib/capabilities/completion-engine/engine.js +35 -15
- package/dist-lib/lib/capabilities/completion-engine/index.d.ts +0 -1
- package/dist-lib/lib/capabilities/completion-engine/loop.d.ts +13 -3
- package/dist-lib/lib/capabilities/completion-engine/loop.js +7 -2
- package/dist-lib/lib/capabilities/completion-engine/model-round.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/model-round.js +2 -0
- package/dist-lib/lib/capabilities/completion-engine/operations.js +29 -9
- package/dist-lib/lib/capabilities/completion-engine/ports.d.ts +1 -0
- package/dist-lib/lib/capabilities/completion-engine/ports.js +6 -4
- package/dist-lib/lib/capabilities/completion-engine/prepare-step.d.ts +4 -1
- package/dist-lib/lib/capabilities/completion-engine/round.d.ts +14 -0
- package/dist-lib/lib/capabilities/completion-engine/round.js +102 -47
- package/dist-lib/lib/capabilities/completion-engine/session.d.ts +5 -3
- package/dist-lib/lib/capabilities/completion-engine/session.js +1 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-caller.js +3 -1
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.d.ts +5 -41
- package/dist-lib/lib/capabilities/completion-engine/tool-execution.js +21 -135
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-outcome.js +40 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.d.ts +43 -0
- package/dist-lib/lib/capabilities/completion-engine/tool-preflight.js +91 -0
- package/dist-lib/lib/capabilities/completion-engine/transition-log.d.ts +14 -0
- package/dist-lib/lib/capabilities/completion-engine/transition-log.js +44 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.d.ts +4 -0
- package/dist-lib/lib/capabilities/completion-engine/turns.js +36 -8
- package/dist-lib/lib/capabilities/enhance.js +3 -3
- package/dist-lib/lib/capabilities/kv-cache.js +11 -3
- package/dist-lib/lib/capabilities/prefix-template.d.ts +34 -0
- package/dist-lib/lib/capabilities/prefix-template.js +175 -0
- package/dist-lib/lib/capabilities/prompt-prefix.d.ts +2 -0
- package/dist-lib/lib/capabilities/prompt-prefix.js +8 -0
- package/dist-lib/lib/capabilities/sdk-tool.d.ts +4 -4
- package/dist-lib/lib/capabilities/sdk-tool.js +22 -6
- package/dist-lib/lib/capabilities/skill-entry.d.ts +13 -1
- package/dist-lib/lib/capabilities/skill-entry.js +33 -2
- package/dist-lib/lib/capabilities/tool-failed-note.d.ts +1 -0
- package/dist-lib/lib/capabilities/tool-failed-note.js +1 -0
- package/dist-lib/lib/capabilities/tool-turns/answered.d.ts +15 -0
- package/dist-lib/lib/capabilities/tool-turns/answered.js +16 -0
- package/dist-lib/lib/capabilities/tool-turns/attachments.d.ts +7 -0
- package/dist-lib/lib/capabilities/tool-turns/attachments.js +39 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.d.ts +13 -0
- package/dist-lib/lib/capabilities/tool-turns/copy.js +29 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.d.ts +22 -0
- package/dist-lib/lib/capabilities/tool-turns/result-turn.js +120 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.d.ts +6 -0
- package/dist-lib/lib/capabilities/tool-turns/run-limits.js +32 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.d.ts +9 -0
- package/dist-lib/lib/capabilities/tool-turns/skill-loads.js +71 -0
- package/dist-lib/lib/capabilities/tool-turns.d.ts +10 -43
- package/dist-lib/lib/capabilities/tool-turns.js +7 -262
- package/dist-lib/lib/capabilities/usage-breakdown.d.ts +1 -0
- package/dist-lib/lib/capabilities/usage-breakdown.js +4 -1
- package/dist-lib/lib/client/index.js +6 -5
- package/dist-lib/lib/connect/abort.d.ts +6 -0
- package/dist-lib/lib/connect/abort.js +52 -0
- package/dist-lib/lib/connect/bridges.d.ts +21 -0
- package/dist-lib/lib/connect/bridges.js +185 -0
- package/dist-lib/lib/connect/decode.d.ts +31 -0
- package/dist-lib/lib/connect/decode.js +114 -0
- package/dist-lib/lib/connect/host-run-log.d.ts +20 -0
- package/dist-lib/lib/connect/host-run-log.js +89 -0
- package/dist-lib/lib/connect/round-log.d.ts +8 -0
- package/dist-lib/lib/connect/round-log.js +33 -0
- package/dist-lib/lib/connect/served.d.ts +7 -0
- package/dist-lib/lib/connect/served.js +45 -0
- package/dist-lib/lib/connect.d.ts +5 -1
- package/dist-lib/lib/connect.js +102 -444
- package/dist-lib/lib/context-window.d.ts +13 -6
- package/dist-lib/lib/context-window.js +18 -5
- package/dist-lib/lib/contract/agent.d.ts +18 -1
- package/dist-lib/lib/contract/completion.d.ts +35 -3
- package/dist-lib/lib/contract/drive.d.ts +154 -4
- package/dist-lib/lib/contract/exec.d.ts +1 -0
- package/dist-lib/lib/contract/index.d.ts +1 -0
- package/dist-lib/lib/contract/knowledge.d.ts +10 -0
- package/dist-lib/lib/contract/media.d.ts +58 -0
- package/dist-lib/lib/contract/models.d.ts +6 -2
- package/dist-lib/lib/contract/ocr.d.ts +17 -0
- package/dist-lib/lib/contract/ocr.js +1 -0
- package/dist-lib/lib/contract/root-search.d.ts +34 -0
- package/dist-lib/lib/contract/root-search.js +1 -0
- package/dist-lib/lib/contract/run.d.ts +13 -0
- package/dist-lib/lib/contract-types.d.ts +10 -2
- package/dist-lib/lib/docx/index.js +1 -1
- package/dist-lib/lib/errors.d.ts +8 -4
- package/dist-lib/lib/errors.js +12 -8
- package/dist-lib/lib/fold/index.d.ts +4 -2
- package/dist-lib/lib/fold/index.js +15 -7
- package/dist-lib/lib/guards.d.ts +2 -0
- package/dist-lib/lib/guards.js +7 -0
- package/dist-lib/lib/hardware/capability-probe.js +10 -7
- package/dist-lib/lib/hardware/gpu-probe-addon.js +26 -11
- package/dist-lib/lib/hardware/gpu-stats.native.cjs +17 -1
- package/dist-lib/lib/helpers/completion-params.d.ts +2 -1
- package/dist-lib/lib/helpers/completion-params.js +18 -2
- package/dist-lib/lib/helpers/control-tokens.d.ts +3 -0
- package/dist-lib/lib/helpers/control-tokens.js +25 -0
- package/dist-lib/lib/helpers/drain.d.ts +1 -1
- package/dist-lib/lib/helpers/drain.js +1 -1
- package/dist-lib/lib/helpers/goal-check/asks.d.ts +25 -0
- package/dist-lib/lib/helpers/goal-check/asks.js +52 -0
- package/dist-lib/lib/helpers/goal-check/checks.d.ts +8 -0
- package/dist-lib/lib/helpers/goal-check/checks.js +92 -0
- package/dist-lib/lib/helpers/goal-check/commands.d.ts +7 -0
- package/dist-lib/lib/helpers/goal-check/commands.js +130 -0
- package/dist-lib/lib/helpers/goal-check/paths.d.ts +5 -0
- package/dist-lib/lib/helpers/goal-check/paths.js +44 -0
- package/dist-lib/lib/helpers/goal-check/shell.d.ts +9 -0
- package/dist-lib/lib/helpers/goal-check/shell.js +96 -0
- package/dist-lib/lib/helpers/goal-check.d.ts +36 -6
- package/dist-lib/lib/helpers/goal-check.js +34 -98
- package/dist-lib/lib/helpers/html-helpers.js +9 -6
- package/dist-lib/lib/helpers/recent-map.d.ts +7 -0
- package/dist-lib/lib/helpers/recent-map.js +23 -0
- package/dist-lib/lib/helpers/repeated-reply.js +9 -2
- package/dist-lib/lib/helpers/root-search.d.ts +3 -0
- package/dist-lib/lib/helpers/root-search.js +74 -0
- package/dist-lib/lib/helpers/run-latency.d.ts +14 -0
- package/dist-lib/lib/helpers/run-latency.js +63 -0
- package/dist-lib/lib/helpers/run-outcome.d.ts +2 -0
- package/dist-lib/lib/helpers/run-outcome.js +6 -2
- package/dist-lib/lib/helpers/spawn-path.d.ts +1 -0
- package/dist-lib/lib/helpers/spawn-path.js +2 -1
- package/dist-lib/lib/helpers/stable-stringify.js +10 -2
- package/dist-lib/lib/helpers/text-coalescer.d.ts +6 -0
- package/dist-lib/lib/helpers/text-coalescer.js +44 -4
- package/dist-lib/lib/helpers/tool-call-markup/emit.d.ts +6 -0
- package/dist-lib/lib/helpers/tool-call-markup/emit.js +15 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.d.ts +22 -0
- package/dist-lib/lib/helpers/tool-call-markup/recover.js +130 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.d.ts +3 -0
- package/dist-lib/lib/helpers/tool-call-markup/skill-recovery.js +56 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.d.ts +4 -0
- package/dist-lib/lib/helpers/tool-call-markup/strip.js +157 -0
- package/dist-lib/lib/helpers/tool-call-markup.d.ts +19 -24
- package/dist-lib/lib/helpers/tool-call-markup.js +17 -343
- package/dist-lib/lib/lifecycle/completion-run.js +2 -2
- package/dist-lib/lib/log.d.ts +3 -0
- package/dist-lib/lib/log.js +17 -1
- package/dist-lib/lib/machine/completion/actions/completion.d.ts +13 -16
- package/dist-lib/lib/machine/completion/actions/completion.js +110 -138
- package/dist-lib/lib/machine/completion/actions/goal.d.ts +10 -0
- package/dist-lib/lib/machine/completion/actions/goal.js +93 -0
- package/dist-lib/lib/machine/completion/actions/prepare.js +2 -1
- package/dist-lib/lib/machine/completion/actions/reject-tool.d.ts +16 -0
- package/dist-lib/lib/machine/completion/actions/reject-tool.js +147 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.d.ts +6 -0
- package/dist-lib/lib/machine/completion/actions/retry-round.js +50 -0
- package/dist-lib/lib/machine/completion/actions/rounds.d.ts +5 -0
- package/dist-lib/lib/machine/completion/actions/rounds.js +31 -0
- package/dist-lib/lib/machine/completion/actions/tools.d.ts +1 -16
- package/dist-lib/lib/machine/completion/actions/tools.js +73 -151
- package/dist-lib/lib/machine/completion/context.js +6 -1
- package/dist-lib/lib/machine/completion/guards/retry.d.ts +2 -1
- package/dist-lib/lib/machine/completion/guards/retry.js +4 -3
- package/dist-lib/lib/machine/completion/implementations.d.ts +8 -5
- package/dist-lib/lib/machine/completion/implementations.js +22 -7
- package/dist-lib/lib/machine/completion/machine.d.ts +15 -6
- package/dist-lib/lib/machine/completion/machine.js +25 -5
- package/dist-lib/lib/machine/completion/metrics.d.ts +25 -0
- package/dist-lib/lib/machine/completion/metrics.js +70 -0
- package/dist-lib/lib/machine/completion/nudges.d.ts +5 -0
- package/dist-lib/lib/machine/completion/nudges.js +33 -0
- package/dist-lib/lib/machine/completion/rules.d.ts +10 -33
- package/dist-lib/lib/machine/completion/rules.js +27 -103
- package/dist-lib/lib/machine/completion/splice.d.ts +9 -0
- package/dist-lib/lib/machine/completion/splice.js +19 -0
- package/dist-lib/lib/machine/completion/types.d.ts +37 -13
- package/dist-lib/lib/machine/index.d.ts +21 -7
- package/dist-lib/lib/machine/index.js +7 -2
- package/dist-lib/lib/media-host.d.ts +12 -0
- package/dist-lib/lib/media-host.js +52 -0
- package/dist-lib/lib/media-port.d.ts +20 -0
- package/dist-lib/lib/media-port.js +77 -0
- package/dist-lib/lib/media-wire.d.ts +8 -0
- package/dist-lib/lib/media-wire.js +111 -0
- package/dist-lib/lib/models/context-choice.js +8 -1
- package/dist-lib/lib/models/custom-model-cache.d.ts +1 -0
- package/dist-lib/lib/models/custom-model-cache.js +3 -0
- package/dist-lib/lib/models/gguf-header.d.ts +6 -0
- package/dist-lib/lib/models/gguf-header.js +38 -1
- package/dist-lib/lib/models/gpu-selection.d.ts +6 -1
- package/dist-lib/lib/models/gpu-selection.js +29 -5
- package/dist-lib/lib/models/kv-cache.d.ts +2 -0
- package/dist-lib/lib/models/kv-cache.js +8 -0
- package/dist-lib/lib/models/llm-presets.js +27 -1
- package/dist-lib/lib/models/load-requests.d.ts +9 -0
- package/dist-lib/lib/models/load-requests.js +42 -0
- package/dist-lib/lib/models/model-catalog-constants.d.ts +3 -2
- package/dist-lib/lib/models/model-catalog-constants.js +8 -5
- package/dist-lib/lib/models/model-catalog.d.ts +12 -3
- package/dist-lib/lib/models/model-catalog.js +40 -16
- package/dist-lib/lib/models/model-delete.js +3 -0
- package/dist-lib/lib/models/model-handle.d.ts +1 -0
- package/dist-lib/lib/models/model-list.d.ts +2 -1
- package/dist-lib/lib/models/model-list.js +5 -1
- package/dist-lib/lib/models/model-pool.d.ts +7 -1
- package/dist-lib/lib/models/model-pool.js +34 -13
- package/dist-lib/lib/models/tts-model-default.d.ts +2 -1
- package/dist-lib/lib/models/tts-model-default.js +8 -6
- package/dist-lib/lib/no-redirect-fetch-impl.d.ts +2 -1
- package/dist-lib/lib/no-redirect-fetch-impl.js +45 -8
- package/dist-lib/lib/office/index.js +1 -1
- package/dist-lib/lib/plugins/registry.d.ts +12 -0
- package/dist-lib/lib/plugins/registry.js +71 -15
- package/dist-lib/lib/plugins/require-bare.d.ts +1 -0
- package/dist-lib/lib/plugins/require-bare.js +13 -0
- package/dist-lib/lib/prompt.d.ts +7 -4
- package/dist-lib/lib/prompt.js +81 -24
- package/dist-lib/lib/residency/completion-runtime.d.ts +8 -6
- package/dist-lib/lib/residency/completion-runtime.js +53 -9
- package/dist-lib/lib/residency/index.d.ts +12 -3
- package/dist-lib/lib/residency/index.js +52 -16
- package/dist-lib/lib/round-host.js +3 -3
- package/dist-lib/lib/round-port.js +3 -3
- package/dist-lib/lib/run-log/boundary.d.ts +1 -4
- package/dist-lib/lib/run-log/boundary.js +4 -21
- package/dist-lib/lib/run-log/history-codec.d.ts +1 -1
- package/dist-lib/lib/run-log/history-codec.js +3 -3
- package/dist-lib/lib/run-log/protocol.js +17 -16
- package/dist-lib/lib/run-log/redact.d.ts +10 -1
- package/dist-lib/lib/run-log/redact.js +99 -9
- package/dist-lib/lib/run-log/request-codec.d.ts +3 -0
- package/dist-lib/lib/run-log/request-codec.js +19 -4
- package/dist-lib/lib/run-log/run-journal.js +1 -1
- package/dist-lib/lib/sdk-loader.d.ts +1 -0
- package/dist-lib/lib/sdk-loader.js +14 -0
- package/dist-lib/lib/serve/completion.d.ts +7 -0
- package/dist-lib/lib/serve/completion.js +571 -0
- package/dist-lib/lib/serve/downloads.d.ts +4 -0
- package/dist-lib/lib/serve/downloads.js +79 -0
- package/dist-lib/lib/serve/models.d.ts +5 -0
- package/dist-lib/lib/serve/models.js +120 -0
- package/dist-lib/lib/serve/noop.d.ts +1 -0
- package/dist-lib/lib/serve/noop.js +1 -0
- package/dist-lib/lib/serve/requests.d.ts +148 -0
- package/dist-lib/lib/serve/requests.js +1 -0
- package/dist-lib/lib/serve/rounds.d.ts +11 -0
- package/dist-lib/lib/serve/rounds.js +67 -0
- package/dist-lib/lib/serve/run-log-start.d.ts +37 -0
- package/dist-lib/lib/serve/run-log-start.js +253 -0
- package/dist-lib/lib/serve/skills.d.ts +32 -0
- package/dist-lib/lib/serve/skills.js +46 -0
- package/dist-lib/lib/serve.d.ts +5 -1
- package/dist-lib/lib/serve.js +23 -995
- package/dist-lib/lib/sidecar/index.d.ts +1 -1
- package/dist-lib/lib/sidecar/index.js +11 -19
- package/dist-lib/lib/sidecar/user-plugins.js +6 -4
- package/dist-lib/lib/skills-host/index.d.ts +6 -3
- package/dist-lib/lib/skills-host/index.js +39 -18
- package/dist-lib/lib/spawn.d.ts +14 -0
- package/dist-lib/lib/spawn.js +9 -5
- package/dist-lib/lib/tools/ask-user.d.ts +2 -0
- package/dist-lib/lib/tools/ask-user.js +137 -0
- package/dist-lib/lib/tools/attachments/delivered.d.ts +5 -0
- package/dist-lib/lib/tools/attachments/delivered.js +16 -0
- package/dist-lib/lib/tools/attachments/fetched-file.d.ts +32 -0
- package/dist-lib/lib/tools/attachments/fetched-file.js +134 -0
- package/dist-lib/lib/tools/attachments/staging.d.ts +1 -0
- package/dist-lib/lib/tools/attachments/staging.js +18 -22
- package/dist-lib/lib/tools/exec/runner.d.ts +4 -0
- package/dist-lib/lib/tools/exec/runner.js +20 -3
- package/dist-lib/lib/tools/exec.js +2 -1
- package/dist-lib/lib/tools/files/edit-file.d.ts +4 -1
- package/dist-lib/lib/tools/files/edit-file.js +220 -28
- package/dist-lib/lib/tools/files/glob.js +72 -11
- package/dist-lib/lib/tools/files/grep.js +65 -22
- package/dist-lib/lib/tools/files/index.js +3 -1
- package/dist-lib/lib/tools/files/read-file.js +199 -36
- package/dist-lib/lib/tools/fs/document-text.d.ts +7 -1
- package/dist-lib/lib/tools/fs/document-text.js +5 -21
- package/dist-lib/lib/tools/fs/drive.d.ts +1 -17
- package/dist-lib/lib/tools/fs/edit-match.d.ts +22 -0
- package/dist-lib/lib/tools/fs/edit-match.js +337 -45
- package/dist-lib/lib/tools/fs/engine.d.ts +9 -0
- package/dist-lib/lib/tools/fs/engine.js +28 -0
- package/dist-lib/lib/tools/fs/remote-protocol.d.ts +1 -81
- package/dist-lib/lib/tools/fs/scope.d.ts +2 -17
- package/dist-lib/lib/tools/fs/search.d.ts +2 -18
- package/dist-lib/lib/tools/fs/suggest.d.ts +8 -0
- package/dist-lib/lib/tools/fs/suggest.js +110 -0
- package/dist-lib/lib/tools/fs/tool-path.d.ts +3 -0
- package/dist-lib/lib/tools/fs/tool-path.js +13 -0
- package/dist-lib/lib/tools/fs/walk.d.ts +5 -5
- package/dist-lib/lib/tools/fs/walk.js +22 -21
- package/dist-lib/lib/tools/http-request/request.d.ts +4 -2
- package/dist-lib/lib/tools/http-request/request.js +2 -1
- package/dist-lib/lib/tools/http-request/truncate-response.d.ts +16 -1
- package/dist-lib/lib/tools/http-request/truncate-response.js +56 -11
- package/dist-lib/lib/tools/http-request.d.ts +1 -0
- package/dist-lib/lib/tools/http-request.js +88 -14
- package/dist-lib/lib/tools/index.d.ts +3 -1
- package/dist-lib/lib/tools/index.js +6 -2
- package/dist-lib/lib/tools/office/ops.d.ts +1 -0
- package/dist-lib/lib/tools/office/ops.js +5 -1
- package/dist-lib/lib/tools/office.d.ts +3 -2
- package/dist-lib/lib/tools/office.js +200 -39
- package/dist-lib/lib/tools/operations/builders.d.ts +4 -3
- package/dist-lib/lib/tools/operations/builders.js +41 -3
- package/dist-lib/lib/tools/operations/calendar-range.d.ts +16 -0
- package/dist-lib/lib/tools/operations/calendar-range.js +40 -0
- package/dist-lib/lib/tools/operations/compile.js +8 -6
- package/dist-lib/lib/tools/operations/manifest.d.ts +4 -0
- package/dist-lib/lib/tools/pdf/build.d.ts +13 -3
- package/dist-lib/lib/tools/pdf/build.js +52 -16
- package/dist-lib/lib/tools/pdf/pages.d.ts +12 -0
- package/dist-lib/lib/tools/pdf/pages.js +31 -0
- package/dist-lib/lib/tools/pdf/recognize.d.ts +13 -0
- package/dist-lib/lib/tools/pdf/recognize.js +55 -0
- package/dist-lib/lib/tools/pdf/request.d.ts +3 -8
- package/dist-lib/lib/tools/pdf/request.js +4 -4
- package/dist-lib/lib/tools/pdf.d.ts +0 -1
- package/dist-lib/lib/tools/pdf.js +42 -14
- package/dist-lib/lib/tools/skill.js +13 -4
- package/dist-lib/lib/tools/skills/bundled-dir.d.ts +8 -1
- package/dist-lib/lib/tools/skills/bundled-dir.js +38 -32
- package/dist-lib/lib/tools/skills/bundled-hash.d.ts +1 -0
- package/dist-lib/lib/tools/skills/bundled-hash.js +4 -1
- package/dist-lib/lib/tools/skills/catalog-loader.d.ts +12 -0
- package/dist-lib/lib/tools/skills/catalog-loader.js +173 -0
- package/dist-lib/lib/tools/skills/catalog.d.ts +5 -8
- package/dist-lib/lib/tools/skills/catalog.js +1 -162
- package/dist-lib/lib/tools/skills/credential-check.d.ts +1 -0
- package/dist-lib/lib/tools/skills/credential-check.js +3 -0
- package/dist-lib/lib/tools/skills/index.d.ts +1 -0
- package/dist-lib/lib/tools/skills/index.js +1 -0
- package/dist-lib/lib/tools/skills/manifest-parse.js +27 -3
- package/dist-lib/lib/tools/skills/manifest.d.ts +1 -0
- package/dist-lib/lib/tools/skills/overlay-crud.d.ts +3 -3
- package/dist-lib/lib/tools/skills/overlay-crud.js +4 -4
- package/dist-lib/lib/tools/skills/overlay-watch.d.ts +2 -2
- package/dist-lib/lib/tools/skills/overlay-watch.js +4 -3
- package/dist-lib/lib/tools/skills/scope-key.d.ts +1 -0
- package/dist-lib/lib/tools/skills/scope-key.js +4 -0
- package/dist-lib/lib/tools/skills/skill-tree.d.ts +5 -0
- package/dist-lib/lib/tools/skills/skill-tree.js +54 -0
- package/dist-lib/lib/tools/toolsets.d.ts +1 -1
- package/dist-lib/lib/tools/toolsets.js +2 -0
- package/dist-lib/lib/tools/web-fetch.js +41 -130
- package/dist-lib/lib/wire/download.d.ts +10 -0
- package/dist-lib/lib/wire/download.js +35 -0
- package/dist-lib/lib/wire/event.d.ts +41 -0
- package/dist-lib/lib/wire/event.js +306 -0
- package/dist-lib/lib/wire/fields.d.ts +3 -0
- package/dist-lib/lib/wire/fields.js +12 -0
- package/dist-lib/lib/wire/knowledge.d.ts +9 -0
- package/dist-lib/lib/wire/knowledge.js +68 -0
- package/dist-lib/lib/wire/round.d.ts +14 -0
- package/dist-lib/lib/wire/round.js +45 -0
- package/dist-lib/lib/wire/vectors.d.ts +6 -0
- package/dist-lib/lib/wire/vectors.js +33 -0
- package/dist-lib/lib/wire.d.ts +28 -77
- package/dist-lib/lib/wire.js +24 -463
- package/dist-lib/plugins/charts/chart-tool.d.ts +8 -0
- package/dist-lib/plugins/charts/chart-tool.js +175 -0
- package/dist-lib/plugins/charts/index.d.ts +16 -0
- package/dist-lib/plugins/charts/index.js +21 -0
- package/dist-lib/plugins/coding-guards/index.d.ts +25 -0
- package/dist-lib/plugins/coding-guards/index.js +126 -0
- package/dist-lib/plugins/diagrams/draw.d.ts +10 -0
- package/dist-lib/plugins/diagrams/draw.js +90 -0
- package/dist-lib/plugins/diagrams/index.d.ts +13 -0
- package/dist-lib/plugins/diagrams/index.js +15 -0
- package/dist-lib/plugins/diagrams/render.d.ts +16 -0
- package/dist-lib/plugins/diagrams/render.js +285 -0
- package/dist-lib/plugins/image/edit-image.d.ts +3 -22
- package/dist-lib/plugins/image/edit-image.js +20 -44
- package/dist-lib/plugins/image/fit.d.ts +31 -0
- package/dist-lib/plugins/image/fit.js +28 -0
- package/dist-lib/plugins/image/generate-image.d.ts +24 -4
- package/dist-lib/plugins/image/generate-image.js +198 -72
- package/dist-lib/plugins/image/index.d.ts +2 -1
- package/dist-lib/plugins/image/index.js +17 -8
- package/dist-lib/plugins/knowledge/index.d.ts +3 -0
- package/dist-lib/plugins/knowledge/index.js +5 -0
- package/dist-lib/plugins/knowledge/manifest.d.ts +53 -0
- package/dist-lib/plugins/knowledge/manifest.js +86 -0
- package/dist-lib/plugins/knowledge/search-tool.js +8 -8
- package/dist-lib/plugins/knowledge/store.d.ts +45 -8
- package/dist-lib/plugins/knowledge/store.js +428 -166
- package/dist-lib/plugins/mcp/call.js +15 -4
- package/dist-lib/plugins/mcp/protocol.d.ts +10 -2
- package/dist-lib/plugins/mcp/protocol.js +13 -12
- package/dist-lib/plugins/mcp/tool-listing.d.ts +6 -0
- package/dist-lib/plugins/mcp/tool-listing.js +97 -0
- package/dist-lib/plugins/music/generate-music.d.ts +21 -4
- package/dist-lib/plugins/music/generate-music.js +168 -65
- package/dist-lib/plugins/music/index.d.ts +2 -1
- package/dist-lib/plugins/music/index.js +11 -6
- package/dist-lib/plugins/obsidian/index.js +14 -4
- package/dist-lib/plugins/ocr/bmp.d.ts +2 -0
- package/dist-lib/plugins/ocr/bmp.js +27 -0
- package/dist-lib/plugins/ocr/coverage.d.ts +3 -0
- package/dist-lib/plugins/ocr/coverage.js +67 -0
- package/dist-lib/plugins/ocr/index.d.ts +12 -0
- package/dist-lib/plugins/ocr/index.js +20 -0
- package/dist-lib/plugins/ocr/ocr-runtime.d.ts +25 -0
- package/dist-lib/plugins/ocr/ocr-runtime.js +103 -0
- package/dist-lib/plugins/ocr/reading-order.d.ts +5 -0
- package/dist-lib/plugins/ocr/reading-order.js +218 -0
- package/dist-lib/plugins/python/bare-floor.d.ts +1 -0
- package/dist-lib/plugins/python/bare-floor.js +2 -0
- package/dist-lib/plugins/python/index.d.ts +4 -1
- package/dist-lib/plugins/python/index.js +5 -1
- package/dist-lib/plugins/python/language.js +11 -10
- package/dist-lib/plugins/python/python-adapter.d.ts +6 -1
- package/dist-lib/plugins/python/python-adapter.js +34 -1
- package/dist-lib/plugins/python/worker/client.js +1 -1
- package/dist-lib/plugins/python/worker/entry.js +2 -8
- package/dist-lib/plugins/python/worker/preload.d.ts +1 -0
- package/dist-lib/plugins/python/worker/preload.js +2 -0
- package/dist-lib/plugins/python/worker/spawn.js +1 -1
- package/dist-lib/plugins/ripgrep/index.d.ts +15 -0
- package/dist-lib/plugins/ripgrep/index.js +28 -0
- package/dist-lib/plugins/run-report/story.js +4 -1
- package/dist-lib/plugins/sandbox-linux/index.js +2 -2
- package/dist-lib/plugins/sandbox-macos/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/index.d.ts +2 -1
- package/dist-lib/plugins/sandbox-vm/index.js +2 -2
- package/dist-lib/plugins/sandbox-vm/vm-shell.d.ts +3 -1
- package/dist-lib/plugins/sandbox-vm/vm-shell.js +45 -16
- package/dist-lib/plugins/sandbox-windows/index.js +2 -2
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-arm64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/sandbox-windows/prebuilds/win32-x64/qvac-sandbox.exe +0 -0
- package/dist-lib/plugins/speech/speech-engine.d.ts +1 -1
- package/dist-lib/plugins/speech/speech-engine.js +10 -5
- package/dist-lib/plugins/speech/speech-text.d.ts +1 -0
- package/dist-lib/plugins/speech/speech-text.js +9 -4
- package/dist-lib/plugins/speech/voice.js +7 -2
- package/dist-lib/plugins/walkie-talkie/index.d.ts +2 -0
- package/dist-lib/plugins/walkie-talkie/index.js +6 -1
- package/dist-lib/plugins/weather/lookup.js +1 -0
- package/dist-lib/schema/baseline.d.ts +2 -1
- package/dist-lib/schema/baseline.js +2 -2
- package/dist-lib/schema/generate.js +8 -1
- package/dist-lib/schema/harness.js +34 -5
- package/dist-lib/schema/release-tags.d.ts +2 -1
- package/dist-lib/schema/release-tags.js +9 -10
- package/dist-lib/spec/bind.js +3 -0
- package/dist-lib/spec/calls.js +1 -0
- package/dist-lib/spec/hrpc/hrpc.json +13 -0
- package/dist-lib/spec/hrpc/index.js +15 -3
- package/dist-lib/spec/hrpc/messages.js +126 -13
- package/dist-lib/spec/hyperschema/index.js +126 -13
- package/dist-lib/spec/hyperschema/schema.json +86 -2
- package/dist-lib/spec/hyperschema/types.d.ts +18 -3
- package/package.json +96 -36
- package/scripts/addon-externals.cjs +7 -1
- package/worker/harness-sidecar.mjs +10 -0
- package/dist-lib/lib/helpers/buffer-burst.d.ts +0 -1
- package/dist-lib/lib/helpers/buffer-burst.js +0 -22
- package/dist-lib/lib/office/engine/codes.d.ts +0 -62
- package/dist-lib/lib/office/engine/codes.js +0 -61
- package/dist-lib/lib/office/engine/docx/document.d.ts +0 -216
- package/dist-lib/lib/office/engine/docx/document.js +0 -1152
- package/dist-lib/lib/office/engine/docx/index.d.ts +0 -7
- package/dist-lib/lib/office/engine/docx/index.js +0 -8
- package/dist-lib/lib/office/engine/docx/styles.d.ts +0 -31
- package/dist-lib/lib/office/engine/docx/styles.js +0 -173
- package/dist-lib/lib/office/engine/docx/template.d.ts +0 -18
- package/dist-lib/lib/office/engine/docx/template.js +0 -133
- package/dist-lib/lib/office/engine/docx/text.d.ts +0 -55
- package/dist-lib/lib/office/engine/docx/text.js +0 -538
- package/dist-lib/lib/office/engine/drawingml/chart.d.ts +0 -63
- package/dist-lib/lib/office/engine/drawingml/chart.js +0 -539
- package/dist-lib/lib/office/engine/drawingml/text.d.ts +0 -35
- package/dist-lib/lib/office/engine/drawingml/text.js +0 -352
- package/dist-lib/lib/office/engine/errors.d.ts +0 -6
- package/dist-lib/lib/office/engine/errors.js +0 -12
- package/dist-lib/lib/office/engine/image.d.ts +0 -8
- package/dist-lib/lib/office/engine/image.js +0 -48
- package/dist-lib/lib/office/engine/index.d.ts +0 -12
- package/dist-lib/lib/office/engine/index.js +0 -7
- package/dist-lib/lib/office/engine/opc/content-types.d.ts +0 -17
- package/dist-lib/lib/office/engine/opc/content-types.js +0 -74
- package/dist-lib/lib/office/engine/opc/media.d.ts +0 -13
- package/dist-lib/lib/office/engine/opc/media.js +0 -11
- package/dist-lib/lib/office/engine/opc/package.d.ts +0 -51
- package/dist-lib/lib/office/engine/opc/package.js +0 -324
- package/dist-lib/lib/office/engine/opc/paths.d.ts +0 -7
- package/dist-lib/lib/office/engine/opc/paths.js +0 -46
- package/dist-lib/lib/office/engine/opc/properties.d.ts +0 -7
- package/dist-lib/lib/office/engine/opc/properties.js +0 -75
- package/dist-lib/lib/office/engine/opc/relationships.d.ts +0 -23
- package/dist-lib/lib/office/engine/opc/relationships.js +0 -65
- package/dist-lib/lib/office/engine/opc/zip.d.ts +0 -15
- package/dist-lib/lib/office/engine/opc/zip.js +0 -264
- package/dist-lib/lib/office/engine/pptx/fit.d.ts +0 -12
- package/dist-lib/lib/office/engine/pptx/fit.js +0 -37
- package/dist-lib/lib/office/engine/pptx/index.d.ts +0 -8
- package/dist-lib/lib/office/engine/pptx/index.js +0 -8
- package/dist-lib/lib/office/engine/pptx/inherit.d.ts +0 -29
- package/dist-lib/lib/office/engine/pptx/inherit.js +0 -155
- package/dist-lib/lib/office/engine/pptx/notes.d.ts +0 -5
- package/dist-lib/lib/office/engine/pptx/notes.js +0 -85
- package/dist-lib/lib/office/engine/pptx/picture-area.d.ts +0 -23
- package/dist-lib/lib/office/engine/pptx/picture-area.js +0 -84
- package/dist-lib/lib/office/engine/pptx/presentation.d.ts +0 -56
- package/dist-lib/lib/office/engine/pptx/presentation.js +0 -787
- package/dist-lib/lib/office/engine/pptx/read.d.ts +0 -9
- package/dist-lib/lib/office/engine/pptx/read.js +0 -66
- package/dist-lib/lib/office/engine/pptx/shapes.d.ts +0 -52
- package/dist-lib/lib/office/engine/pptx/shapes.js +0 -276
- package/dist-lib/lib/office/engine/pptx/slides.d.ts +0 -27
- package/dist-lib/lib/office/engine/pptx/slides.js +0 -123
- package/dist-lib/lib/office/engine/pptx/template.d.ts +0 -20
- package/dist-lib/lib/office/engine/pptx/template.js +0 -391
- package/dist-lib/lib/office/engine/pptx/types.d.ts +0 -121
- package/dist-lib/lib/office/engine/units.d.ts +0 -3
- package/dist-lib/lib/office/engine/units.js +0 -12
- package/dist-lib/lib/office/engine/utf8.d.ts +0 -2
- package/dist-lib/lib/office/engine/utf8.js +0 -103
- package/dist-lib/lib/office/engine/xlsx/formula.d.ts +0 -49
- package/dist-lib/lib/office/engine/xlsx/formula.js +0 -381
- package/dist-lib/lib/office/engine/xlsx/index.d.ts +0 -8
- package/dist-lib/lib/office/engine/xlsx/index.js +0 -8
- package/dist-lib/lib/office/engine/xlsx/refs.d.ts +0 -22
- package/dist-lib/lib/office/engine/xlsx/refs.js +0 -82
- package/dist-lib/lib/office/engine/xlsx/reshape.d.ts +0 -21
- package/dist-lib/lib/office/engine/xlsx/reshape.js +0 -424
- package/dist-lib/lib/office/engine/xlsx/sheet.d.ts +0 -108
- package/dist-lib/lib/office/engine/xlsx/sheet.js +0 -662
- package/dist-lib/lib/office/engine/xlsx/strings.d.ts +0 -15
- package/dist-lib/lib/office/engine/xlsx/strings.js +0 -93
- package/dist-lib/lib/office/engine/xlsx/styles.d.ts +0 -38
- package/dist-lib/lib/office/engine/xlsx/styles.js +0 -369
- package/dist-lib/lib/office/engine/xlsx/template.d.ts +0 -7
- package/dist-lib/lib/office/engine/xlsx/template.js +0 -54
- package/dist-lib/lib/office/engine/xlsx/workbook.d.ts +0 -162
- package/dist-lib/lib/office/engine/xlsx/workbook.js +0 -881
- package/dist-lib/lib/office/engine/xlsx/write.d.ts +0 -2
- package/dist-lib/lib/office/engine/xlsx/write.js +0 -42
- package/dist-lib/lib/office/engine/xml.d.ts +0 -45
- package/dist-lib/lib/office/engine/xml.js +0 -258
- package/patches/localwatch@1.4.3.patch +0 -13
- /package/dist-lib/lib/{office/engine/pptx/types.js → contract/media.js} +0 -0
|
@@ -9,3 +9,25 @@ export interface EditMatch {
|
|
|
9
9
|
error: string | null;
|
|
10
10
|
}
|
|
11
11
|
export declare function editMatch(content: string, request: EditRequest): EditMatch;
|
|
12
|
+
export interface ReplaceEdit extends EditRequest {
|
|
13
|
+
readonly kind: 'replace';
|
|
14
|
+
}
|
|
15
|
+
export interface EdgeInsert {
|
|
16
|
+
readonly kind: 'edge';
|
|
17
|
+
readonly text: string;
|
|
18
|
+
readonly at: 'start' | 'end';
|
|
19
|
+
}
|
|
20
|
+
export interface LineInsert {
|
|
21
|
+
readonly kind: 'line';
|
|
22
|
+
readonly text: string;
|
|
23
|
+
readonly line: number;
|
|
24
|
+
readonly expect: string;
|
|
25
|
+
}
|
|
26
|
+
export type TextEdit = ReplaceEdit | EdgeInsert | LineInsert;
|
|
27
|
+
export interface EditsApplied {
|
|
28
|
+
content: string;
|
|
29
|
+
changes: number;
|
|
30
|
+
diff: string;
|
|
31
|
+
error: string | null;
|
|
32
|
+
}
|
|
33
|
+
export declare function applyEdits(content: string, edits: readonly TextEdit[]): EditsApplied;
|
|
@@ -28,41 +28,74 @@ function lineStarts(lines) {
|
|
|
28
28
|
}
|
|
29
29
|
return starts;
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
if (
|
|
43
|
-
const
|
|
44
|
-
|
|
45
|
-
spans.push({ from: starts[i], to: ownsNewline && last < lines.length - 1 ? end + 1 : end });
|
|
31
|
+
class MatchView {
|
|
32
|
+
text;
|
|
33
|
+
#plain;
|
|
34
|
+
#lines;
|
|
35
|
+
#trimmed;
|
|
36
|
+
#starts;
|
|
37
|
+
#rows;
|
|
38
|
+
constructor(text) {
|
|
39
|
+
this.text = text;
|
|
40
|
+
}
|
|
41
|
+
rows() {
|
|
42
|
+
if (!this.#rows) {
|
|
43
|
+
const lines = fileLines(this.text);
|
|
44
|
+
this.#rows = { lines, starts: lineStarts(lines) };
|
|
46
45
|
}
|
|
46
|
+
return this.#rows;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
spans(old) {
|
|
49
|
+
if (!old) {
|
|
50
|
+
return [];
|
|
51
|
+
}
|
|
52
|
+
const exact = occurrences(this.text, old);
|
|
53
|
+
if (exact.length) {
|
|
54
|
+
return exact;
|
|
55
|
+
}
|
|
56
|
+
const wanted = plain(old);
|
|
57
|
+
const typographic = occurrences(this.#normalized(), wanted);
|
|
58
|
+
if (typographic.length) {
|
|
59
|
+
return typographic;
|
|
60
|
+
}
|
|
61
|
+
return this.#lineSpans(wanted);
|
|
62
|
+
}
|
|
63
|
+
#normalized() {
|
|
64
|
+
return (this.#plain ??= plain(this.text));
|
|
54
65
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
66
|
+
#lineSpans(old) {
|
|
67
|
+
const lines = (this.#lines ??= this.#normalized().split('\n'));
|
|
68
|
+
const trimmed = (this.#trimmed ??= lines.map((line) => line.trimEnd()));
|
|
69
|
+
const starts = (this.#starts ??= lineStarts(lines));
|
|
70
|
+
const wanted = old.split('\n').map((line) => line.trimEnd());
|
|
71
|
+
const ownsNewline = wanted.length > 1 && wanted[wanted.length - 1] === '';
|
|
72
|
+
if (ownsNewline) {
|
|
73
|
+
wanted.pop();
|
|
74
|
+
}
|
|
75
|
+
const spans = [];
|
|
76
|
+
for (let i = 0; i + wanted.length <= lines.length; i++) {
|
|
77
|
+
let matched = true;
|
|
78
|
+
for (let k = 0; k < wanted.length; k++) {
|
|
79
|
+
if (trimmed[i + k] !== wanted[k]) {
|
|
80
|
+
matched = false;
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
if (matched) {
|
|
85
|
+
const last = i + wanted.length - 1;
|
|
86
|
+
const end = starts[last] + lines[last].length;
|
|
87
|
+
spans.push({ from: starts[i], to: ownsNewline && last < lines.length - 1 ? end + 1 : end });
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return spans;
|
|
58
91
|
}
|
|
59
|
-
return trimmedLineSpans(plain(content), plain(old));
|
|
60
92
|
}
|
|
61
93
|
function ambiguity(text, spans) {
|
|
62
|
-
const
|
|
94
|
+
const lineAt = lineCounter(text);
|
|
95
|
+
const lines = spans.map((span) => lineAt(span.from)).join(', ');
|
|
63
96
|
return `old text matches ${spans.length} places (lines ${lines}). Include a neighbouring line so it matches once, or set replaceAll to change every one.`;
|
|
64
97
|
}
|
|
65
|
-
const NUMBERED = /^\s
|
|
98
|
+
const NUMBERED = /^\s*(\d+)\| ?/;
|
|
66
99
|
function unnumbered(text) {
|
|
67
100
|
const lines = text.split('\n');
|
|
68
101
|
const filled = lines.filter((line) => line.trim());
|
|
@@ -70,6 +103,67 @@ function unnumbered(text) {
|
|
|
70
103
|
? lines.map((line) => line.replace(NUMBERED, '')).join('\n')
|
|
71
104
|
: text;
|
|
72
105
|
}
|
|
106
|
+
function rows(text) {
|
|
107
|
+
return text
|
|
108
|
+
.split('\n')
|
|
109
|
+
.filter((line) => line.trim())
|
|
110
|
+
.map((line) => Number(line.match(NUMBERED)?.[1]));
|
|
111
|
+
}
|
|
112
|
+
function matched(view, request) {
|
|
113
|
+
const asked = request.old.replace(/\r\n/g, '\n');
|
|
114
|
+
const replacement = request.replacement.replace(/\r\n/g, '\n');
|
|
115
|
+
const spans = view.spans(asked);
|
|
116
|
+
if (spans.length) {
|
|
117
|
+
return { old: asked, replacement, spans };
|
|
118
|
+
}
|
|
119
|
+
const old = unnumbered(asked);
|
|
120
|
+
if (old === asked) {
|
|
121
|
+
return { old: asked, replacement, spans };
|
|
122
|
+
}
|
|
123
|
+
const from = rows(asked);
|
|
124
|
+
const copied = rows(replacement).every((row) => row >= from[0] && row <= from[from.length - 1]);
|
|
125
|
+
return {
|
|
126
|
+
old,
|
|
127
|
+
replacement: copied ? unnumbered(replacement) : replacement,
|
|
128
|
+
spans: view.spans(old)
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
function viewOf(content) {
|
|
132
|
+
const bom = content.startsWith('\uFEFF') ? 1 : 0;
|
|
133
|
+
const parts = content.slice(bom).split('\r\n');
|
|
134
|
+
const breaks = [];
|
|
135
|
+
let offset = 0;
|
|
136
|
+
for (const part of parts.slice(0, -1)) {
|
|
137
|
+
offset += part.length;
|
|
138
|
+
breaks.push(offset);
|
|
139
|
+
offset++;
|
|
140
|
+
}
|
|
141
|
+
return { text: parts.join('\n'), bom, crlf: breaks.length > 0, breaks };
|
|
142
|
+
}
|
|
143
|
+
function original(view, offset) {
|
|
144
|
+
let lo = 0;
|
|
145
|
+
let hi = view.breaks.length;
|
|
146
|
+
while (lo < hi) {
|
|
147
|
+
const mid = (lo + hi) >> 1;
|
|
148
|
+
if (view.breaks[mid] < offset) {
|
|
149
|
+
lo = mid + 1;
|
|
150
|
+
}
|
|
151
|
+
else {
|
|
152
|
+
hi = mid;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return view.bom + offset + lo;
|
|
156
|
+
}
|
|
157
|
+
function written(content, view, changes) {
|
|
158
|
+
let out = '';
|
|
159
|
+
let cursor = 0;
|
|
160
|
+
for (const change of changes) {
|
|
161
|
+
const text = view.crlf ? change.text.replace(/\n/g, '\r\n') : change.text;
|
|
162
|
+
out += content.slice(cursor, original(view, change.from)) + text;
|
|
163
|
+
cursor = original(view, change.to);
|
|
164
|
+
}
|
|
165
|
+
return out + content.slice(cursor);
|
|
166
|
+
}
|
|
73
167
|
function closest(text, old) {
|
|
74
168
|
const lines = text.split('\n');
|
|
75
169
|
const file = lines.map((line) => pairsOf(line.trim()));
|
|
@@ -118,8 +212,9 @@ const CLOSE_ENOUGH = 0.6;
|
|
|
118
212
|
const CONTEXT_LINES = 2;
|
|
119
213
|
const PROBE_LINES = 8;
|
|
120
214
|
const DISTINCT_CHARS = 24;
|
|
121
|
-
function notFound(
|
|
122
|
-
|
|
215
|
+
function notFound(matcher, old, replacement) {
|
|
216
|
+
const { text } = matcher;
|
|
217
|
+
if (replacement.trim().length >= DISTINCT_CHARS && matcher.spans(replacement).length) {
|
|
123
218
|
return 'old text not found, and the new text is already in the file: this edit looks done. Read the file to check before changing it again.';
|
|
124
219
|
}
|
|
125
220
|
const near = closest(text, old);
|
|
@@ -128,26 +223,223 @@ function notFound(text, old, replacement) {
|
|
|
128
223
|
: 'old text not found. Read the file with read_file and copy the exact lines you want to change, including their indentation.';
|
|
129
224
|
}
|
|
130
225
|
export function editMatch(content, request) {
|
|
131
|
-
const
|
|
132
|
-
const text =
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
let replacement = request.replacement.replace(/\r\n/g, '\n');
|
|
136
|
-
let spans = spansFor(text, old);
|
|
137
|
-
if (!spans.length && unnumbered(asked) !== asked) {
|
|
138
|
-
old = unnumbered(asked);
|
|
139
|
-
replacement = unnumbered(replacement);
|
|
140
|
-
spans = spansFor(text, old);
|
|
141
|
-
}
|
|
226
|
+
const view = viewOf(content);
|
|
227
|
+
const { text } = view;
|
|
228
|
+
const matcher = new MatchView(text);
|
|
229
|
+
const { old, replacement, spans } = matched(matcher, request);
|
|
142
230
|
if (!spans.length) {
|
|
143
|
-
return { content, count: 0, error: notFound(
|
|
231
|
+
return { content, count: 0, error: notFound(matcher, old, replacement) };
|
|
144
232
|
}
|
|
145
233
|
if (spans.length > 1 && !request.replaceAll) {
|
|
146
234
|
return { content, count: 0, error: ambiguity(text, spans) };
|
|
147
235
|
}
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
236
|
+
const changes = spans.map((span) => ({ ...span, text: replacement }));
|
|
237
|
+
return { content: written(content, view, changes), count: spans.length, error: null };
|
|
238
|
+
}
|
|
239
|
+
const AROUND_LINES = 3;
|
|
240
|
+
function fileLines(text) {
|
|
241
|
+
const lines = text.split('\n');
|
|
242
|
+
if (lines[lines.length - 1] === '') {
|
|
243
|
+
lines.pop();
|
|
244
|
+
}
|
|
245
|
+
return lines;
|
|
246
|
+
}
|
|
247
|
+
function block(text) {
|
|
248
|
+
const lf = text.replace(/\r\n/g, '\n');
|
|
249
|
+
return lf.endsWith('\n') ? lf : `${lf}\n`;
|
|
250
|
+
}
|
|
251
|
+
function appended(text, insert) {
|
|
252
|
+
return text === '' || text.endsWith('\n') ? block(insert) : `\n${block(insert).slice(0, -1)}`;
|
|
253
|
+
}
|
|
254
|
+
function edgeSplice(text, edit) {
|
|
255
|
+
if (edit.at === 'start') {
|
|
256
|
+
return { from: 0, to: 0, text: block(edit.text) };
|
|
257
|
+
}
|
|
258
|
+
return { from: text.length, to: text.length, text: appended(text, edit.text) };
|
|
259
|
+
}
|
|
260
|
+
function sameLine(actual, expect, line) {
|
|
261
|
+
const wanted = expect.replace(/\r\n/g, '\n');
|
|
262
|
+
const prefix = new RegExp(`^${line}\\| ?`);
|
|
263
|
+
const candidates = prefix.test(wanted) ? [wanted, wanted.replace(prefix, '')] : [wanted];
|
|
264
|
+
return candidates.some((each) => plain(each).trimEnd() === plain(actual).trimEnd());
|
|
265
|
+
}
|
|
266
|
+
function around(lines, line) {
|
|
267
|
+
if (!lines.length) {
|
|
268
|
+
return '(the file is empty)';
|
|
269
|
+
}
|
|
270
|
+
const first = Math.max(1, line - AROUND_LINES);
|
|
271
|
+
const last = Math.min(lines.length, line + AROUND_LINES);
|
|
272
|
+
const rows = [];
|
|
273
|
+
for (let n = first; n <= last; n++) {
|
|
274
|
+
rows.push(`${n}| ${lines[n - 1]}`);
|
|
275
|
+
}
|
|
276
|
+
return rows.join('\n');
|
|
277
|
+
}
|
|
278
|
+
function lineSplice(matcher, edit) {
|
|
279
|
+
const { text } = matcher;
|
|
280
|
+
const { lines, starts } = matcher.rows();
|
|
281
|
+
const { line } = edit;
|
|
282
|
+
if (text === '' && line === 1 && sameLine('', edit.expect, 1)) {
|
|
283
|
+
return { from: 0, to: 0, text: block(edit.text) };
|
|
284
|
+
}
|
|
285
|
+
if (line < 1 || line > lines.length) {
|
|
286
|
+
return (`there is no line ${line}: the file has ${lines.length} lines. ` +
|
|
287
|
+
`Use after "end" to add to the end, or read the file with read_file for its line numbers.`);
|
|
288
|
+
}
|
|
289
|
+
if (!sameLine(lines[line - 1], edit.expect, line)) {
|
|
290
|
+
return (`line ${line} is not ${JSON.stringify(edit.expect)}. The file reads:\n${around(lines, line)}\n` +
|
|
291
|
+
`Use the line number and the exact text of the line you mean, or read the file again with read_file.`);
|
|
292
|
+
}
|
|
293
|
+
if (line < lines.length) {
|
|
294
|
+
return { from: starts[line], to: starts[line], text: block(edit.text) };
|
|
295
|
+
}
|
|
296
|
+
return { from: text.length, to: text.length, text: appended(text, edit.text) };
|
|
297
|
+
}
|
|
298
|
+
function replaceSplices(matcher, edit) {
|
|
299
|
+
const { text } = matcher;
|
|
300
|
+
const { old, replacement, spans } = matched(matcher, edit);
|
|
301
|
+
if (!spans.length) {
|
|
302
|
+
return notFound(matcher, old, replacement);
|
|
303
|
+
}
|
|
304
|
+
if (spans.length > 1 && !edit.replaceAll) {
|
|
305
|
+
return ambiguity(text, spans);
|
|
306
|
+
}
|
|
307
|
+
return spans.map((span) => ({ ...span, text: replacement }));
|
|
308
|
+
}
|
|
309
|
+
function splicesOf(matcher, edit) {
|
|
310
|
+
const { text } = matcher;
|
|
311
|
+
if (edit.kind === 'replace') {
|
|
312
|
+
return replaceSplices(matcher, edit);
|
|
313
|
+
}
|
|
314
|
+
const splice = edit.kind === 'edge' ? edgeSplice(text, edit) : lineSplice(matcher, edit);
|
|
315
|
+
return typeof splice === 'string' ? splice : [splice];
|
|
316
|
+
}
|
|
317
|
+
function lineCounter(text) {
|
|
318
|
+
let line = 1;
|
|
319
|
+
let next = text.indexOf('\n');
|
|
320
|
+
let last = 0;
|
|
321
|
+
return (offset) => {
|
|
322
|
+
if (offset < last) {
|
|
323
|
+
line = 1;
|
|
324
|
+
next = text.indexOf('\n');
|
|
325
|
+
}
|
|
326
|
+
last = offset;
|
|
327
|
+
while (next !== -1 && next < offset) {
|
|
328
|
+
line++;
|
|
329
|
+
next = text.indexOf('\n', next + 1);
|
|
330
|
+
}
|
|
331
|
+
return line;
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
function lineOf(text, offset) {
|
|
335
|
+
return lineCounter(text)(offset);
|
|
336
|
+
}
|
|
337
|
+
function overlap(text, splices) {
|
|
338
|
+
let reach = null;
|
|
339
|
+
for (const splice of splices) {
|
|
340
|
+
if (reach && reach.to > splice.from) {
|
|
341
|
+
return (`edits ${reach.edit + 1} and ${splice.edit + 1} change the same text ` +
|
|
342
|
+
`(line ${lineOf(text, splice.from)}). Merge them into one edit.`);
|
|
343
|
+
}
|
|
344
|
+
if (!reach || splice.to > reach.to) {
|
|
345
|
+
reach = splice;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
function spliced(text, splices) {
|
|
351
|
+
let out = '';
|
|
352
|
+
let cursor = 0;
|
|
353
|
+
for (const splice of splices) {
|
|
354
|
+
out += text.slice(cursor, splice.from) + splice.text;
|
|
355
|
+
cursor = splice.to;
|
|
356
|
+
}
|
|
357
|
+
return out + text.slice(cursor);
|
|
358
|
+
}
|
|
359
|
+
export function applyEdits(content, edits) {
|
|
360
|
+
const view = viewOf(content);
|
|
361
|
+
const { text } = view;
|
|
362
|
+
const matcher = new MatchView(text);
|
|
363
|
+
const splices = [];
|
|
364
|
+
for (const [index, edit] of edits.entries()) {
|
|
365
|
+
const found = splicesOf(matcher, edit);
|
|
366
|
+
if (typeof found === 'string') {
|
|
367
|
+
const error = edits.length > 1 ? `edit ${index + 1}: ${found}` : found;
|
|
368
|
+
return { content, changes: 0, diff: '', error };
|
|
369
|
+
}
|
|
370
|
+
splices.push(...found.map((splice) => ({ ...splice, edit: index })));
|
|
371
|
+
}
|
|
372
|
+
splices.sort((a, b) => a.from - b.from || a.to - b.to || a.edit - b.edit);
|
|
373
|
+
const crossed = overlap(text, splices);
|
|
374
|
+
if (crossed) {
|
|
375
|
+
return { content, changes: 0, diff: '', error: crossed };
|
|
376
|
+
}
|
|
377
|
+
return {
|
|
378
|
+
content: written(content, view, splices),
|
|
379
|
+
changes: splices.length,
|
|
380
|
+
diff: unifiedHunks(text, splices),
|
|
381
|
+
error: null
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
const NO_NEWLINE = '\n\';
|
|
385
|
+
function diffLines(text) {
|
|
386
|
+
const lines = fileLines(text);
|
|
387
|
+
if (text && !text.endsWith('\n')) {
|
|
388
|
+
lines[lines.length - 1] += NO_NEWLINE;
|
|
389
|
+
}
|
|
390
|
+
return lines;
|
|
391
|
+
}
|
|
392
|
+
function hunksOf(text, splices) {
|
|
393
|
+
const hunks = [];
|
|
394
|
+
for (const splice of splices) {
|
|
395
|
+
const from = splice.from && text.lastIndexOf('\n', splice.from - 1) + 1;
|
|
396
|
+
const end = text.indexOf('\n', Math.max(splice.to, from));
|
|
397
|
+
const to = end === -1 ? text.length : end + 1;
|
|
398
|
+
const last = hunks[hunks.length - 1];
|
|
399
|
+
if (last && from < last.to) {
|
|
400
|
+
last.to = Math.max(last.to, to);
|
|
401
|
+
last.splices.push(splice);
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
hunks.push({ from, to, splices: [splice] });
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
return hunks;
|
|
408
|
+
}
|
|
409
|
+
function sharedEdges(before, after) {
|
|
410
|
+
let head = 0;
|
|
411
|
+
while (head < before.length && head < after.length && before[head] === after[head]) {
|
|
412
|
+
head++;
|
|
413
|
+
}
|
|
414
|
+
let tail = 0;
|
|
415
|
+
while (tail < before.length - head &&
|
|
416
|
+
tail < after.length - head &&
|
|
417
|
+
before[before.length - 1 - tail] === after[after.length - 1 - tail]) {
|
|
418
|
+
tail++;
|
|
419
|
+
}
|
|
420
|
+
return [head, tail];
|
|
421
|
+
}
|
|
422
|
+
function range(start, count) {
|
|
423
|
+
return `${count ? start : start - 1},${count}`;
|
|
424
|
+
}
|
|
425
|
+
function unifiedHunks(text, splices) {
|
|
426
|
+
const out = [];
|
|
427
|
+
let shift = 0;
|
|
428
|
+
const lineAt = lineCounter(text);
|
|
429
|
+
for (const hunk of hunksOf(text, splices)) {
|
|
430
|
+
const shifted = hunk.splices.map((splice) => ({
|
|
431
|
+
...splice,
|
|
432
|
+
from: splice.from - hunk.from,
|
|
433
|
+
to: splice.to - hunk.from
|
|
434
|
+
}));
|
|
435
|
+
const before = diffLines(text.slice(hunk.from, hunk.to));
|
|
436
|
+
const after = diffLines(spliced(text.slice(hunk.from, hunk.to), shifted));
|
|
437
|
+
const [head, tail] = sharedEdges(before, after);
|
|
438
|
+
const removed = before.slice(head, before.length - tail);
|
|
439
|
+
const added = after.slice(head, after.length - tail);
|
|
440
|
+
const start = lineAt(hunk.from) + head;
|
|
441
|
+
out.push(`@@ -${range(start, removed.length)} +${range(start + shift, added.length)} @@`, ...removed.map((line) => `-${line}`), ...added.map((line) => `+${line}`));
|
|
442
|
+
shift += added.length - removed.length;
|
|
151
443
|
}
|
|
152
|
-
return
|
|
444
|
+
return out.join('\n');
|
|
153
445
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { AbortSignal as BareAbortSignal } from 'bare-abort-controller';
|
|
2
|
+
import type { DriveRoot } from '../../contract/drive.ts';
|
|
3
|
+
export interface EngineCall<T> {
|
|
4
|
+
run: () => Promise<T>;
|
|
5
|
+
found: (answer: T) => boolean;
|
|
6
|
+
includeIgnored: boolean;
|
|
7
|
+
signal: BareAbortSignal | undefined;
|
|
8
|
+
}
|
|
9
|
+
export declare function engineAnswer<T>(root: DriveRoot, folder: string, { run, found, includeIgnored, signal }: EngineCall<T>): Promise<T | null>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HIDDEN_DIRS, rootRules, WALK_SKIP_DIRS } from './walk.js';
|
|
2
|
+
async function ignoredFolder(root, folder, { includeIgnored }) {
|
|
3
|
+
const parts = folder.split('/').filter(Boolean);
|
|
4
|
+
if (parts.some((name) => WALK_SKIP_DIRS.has(name))) {
|
|
5
|
+
return true;
|
|
6
|
+
}
|
|
7
|
+
if (includeIgnored) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
const rules = await rootRules(root, folder);
|
|
11
|
+
const isDir = true;
|
|
12
|
+
return parts.some((name, i) => HIDDEN_DIRS.has(name) || rules.ignored(parts.slice(0, i + 1).join('/'), isDir));
|
|
13
|
+
}
|
|
14
|
+
export async function engineAnswer(root, folder, { run, found, includeIgnored, signal }) {
|
|
15
|
+
try {
|
|
16
|
+
const answer = await run();
|
|
17
|
+
if (found(answer)) {
|
|
18
|
+
return answer;
|
|
19
|
+
}
|
|
20
|
+
return (await ignoredFolder(root, folder, { includeIgnored })) ? null : answer;
|
|
21
|
+
}
|
|
22
|
+
catch (err) {
|
|
23
|
+
if (signal?.aborted) {
|
|
24
|
+
throw err;
|
|
25
|
+
}
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,82 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export interface DriveEntry {
|
|
3
|
-
key: string;
|
|
4
|
-
value: {
|
|
5
|
-
executable: boolean;
|
|
6
|
-
linkname: string | null;
|
|
7
|
-
blob: {
|
|
8
|
-
byteLength: number;
|
|
9
|
-
} | null;
|
|
10
|
-
metadata: unknown;
|
|
11
|
-
};
|
|
12
|
-
mtime?: number;
|
|
13
|
-
}
|
|
14
|
-
export interface DriveDir {
|
|
15
|
-
key: string;
|
|
16
|
-
dir: true;
|
|
17
|
-
}
|
|
18
|
-
export interface GrantedDrive {
|
|
19
|
-
readonly key: string;
|
|
20
|
-
readonly writable: boolean;
|
|
21
|
-
readonly search?: boolean;
|
|
22
|
-
}
|
|
1
|
+
export type { DriveDir, DriveEntry, DriveEntryRequest, DriveGetRequest, DriveListRequest, DriveOpFn, DriveReadRequest, DriveRequest, DriveResponse, DriveSearchQuery, DriveSearchRequest, DriveWriteRequest, GrantedDrive } from '../../contract/drive.ts';
|
|
23
2
|
export declare const MAX_DRIVE_BYTES: number;
|
|
24
|
-
export interface DriveEntryRequest {
|
|
25
|
-
op: 'entry';
|
|
26
|
-
driveKey: string;
|
|
27
|
-
key: string;
|
|
28
|
-
}
|
|
29
|
-
export interface DriveGetRequest {
|
|
30
|
-
op: 'get';
|
|
31
|
-
driveKey: string;
|
|
32
|
-
key: string;
|
|
33
|
-
}
|
|
34
|
-
export interface DriveReadRequest {
|
|
35
|
-
op: 'read';
|
|
36
|
-
driveKey: string;
|
|
37
|
-
key: string;
|
|
38
|
-
}
|
|
39
|
-
export interface DriveListRequest {
|
|
40
|
-
op: 'list';
|
|
41
|
-
driveKey: string;
|
|
42
|
-
folder: string;
|
|
43
|
-
skip: string[];
|
|
44
|
-
recursive: boolean;
|
|
45
|
-
limit: number;
|
|
46
|
-
cursor: string | null;
|
|
47
|
-
}
|
|
48
|
-
export interface DriveWriteRequest {
|
|
49
|
-
op: 'write';
|
|
50
|
-
driveKey: string;
|
|
51
|
-
key: string;
|
|
52
|
-
path: string;
|
|
53
|
-
executable?: boolean;
|
|
54
|
-
}
|
|
55
|
-
export interface DriveSearchQuery {
|
|
56
|
-
folder: string;
|
|
57
|
-
queries: string[];
|
|
58
|
-
regex: boolean;
|
|
59
|
-
caseSensitive: boolean;
|
|
60
|
-
includeIgnored: boolean;
|
|
61
|
-
maxMatches: number;
|
|
62
|
-
maxEntries: number;
|
|
63
|
-
maxMs: number;
|
|
64
|
-
}
|
|
65
|
-
export interface DriveSearchRequest extends DriveSearchQuery {
|
|
66
|
-
op: 'search';
|
|
67
|
-
driveKey: string;
|
|
68
|
-
}
|
|
69
|
-
export type DriveRequest = DriveEntryRequest | DriveGetRequest | DriveReadRequest | DriveListRequest | DriveWriteRequest | DriveSearchRequest;
|
|
70
|
-
export interface DriveResponse {
|
|
71
|
-
error?: string;
|
|
72
|
-
entry?: DriveEntry | null;
|
|
73
|
-
path?: string | null;
|
|
74
|
-
truncated?: boolean;
|
|
75
|
-
entries?: Array<DriveEntry | DriveDir>;
|
|
76
|
-
cursor?: string | null;
|
|
77
|
-
hits?: SearchHit[];
|
|
78
|
-
capped?: boolean;
|
|
79
|
-
cut?: boolean;
|
|
80
|
-
skippedLinks?: number;
|
|
81
|
-
}
|
|
82
|
-
export type DriveOpFn = (request: DriveRequest) => Promise<DriveResponse>;
|
|
@@ -1,23 +1,8 @@
|
|
|
1
1
|
import type { CompiledPolicy } from '../../contract/policy.ts';
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
import type { FolderSearchResult } from './search.ts';
|
|
2
|
+
import type { DriveRoot, LocalRoot } from '../../contract/drive.ts';
|
|
3
|
+
export type { DriveRoot, HyperRoot, LocalRoot } from '../../contract/drive.ts';
|
|
5
4
|
export type Realpath = (p: string) => Promise<string>;
|
|
6
5
|
export declare const defaultRealpath: Realpath;
|
|
7
|
-
export interface LocalRoot {
|
|
8
|
-
readonly kind: 'local';
|
|
9
|
-
readonly root: string;
|
|
10
|
-
readonly drive: Drive;
|
|
11
|
-
}
|
|
12
|
-
export interface HyperRoot {
|
|
13
|
-
readonly kind: 'hyper';
|
|
14
|
-
readonly key: string;
|
|
15
|
-
readonly writable: boolean;
|
|
16
|
-
readonly prefix: string;
|
|
17
|
-
readonly drive: Drive;
|
|
18
|
-
readonly search?: (query: DriveSearchQuery) => Promise<FolderSearchResult>;
|
|
19
|
-
}
|
|
20
|
-
export type DriveRoot = LocalRoot | HyperRoot;
|
|
21
6
|
export interface FsToolOptions {
|
|
22
7
|
readonly realpath?: Realpath;
|
|
23
8
|
readonly deniedRoots?: readonly string[];
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Drive, FolderSearchResult, SearchFile, SearchResult } from '../../contract/drive.ts';
|
|
2
2
|
import type { DriveResponse, DriveSearchRequest } from './remote-protocol.ts';
|
|
3
3
|
import { type DriveRoot } from './scope.ts';
|
|
4
|
-
|
|
4
|
+
export type { FolderSearchResult, SearchFile, SearchHit, SearchResult } from '../../contract/drive.ts';
|
|
5
5
|
export declare const MAX_GREP_MATCHES = 1000;
|
|
6
|
-
export interface SearchHit {
|
|
7
|
-
file: string;
|
|
8
|
-
line: number;
|
|
9
|
-
text: string;
|
|
10
|
-
}
|
|
11
|
-
export interface SearchFile {
|
|
12
|
-
path: string;
|
|
13
|
-
key: string;
|
|
14
|
-
}
|
|
15
6
|
export interface SearchOptions {
|
|
16
7
|
regex?: boolean;
|
|
17
8
|
caseSensitive?: boolean;
|
|
18
9
|
concurrency?: number;
|
|
19
10
|
}
|
|
20
|
-
export interface SearchResult {
|
|
21
|
-
hits: SearchHit[];
|
|
22
|
-
capped: boolean;
|
|
23
|
-
cut: boolean;
|
|
24
|
-
}
|
|
25
11
|
export interface FolderSearchOptions {
|
|
26
12
|
maxMatches: number;
|
|
27
13
|
includeIgnored?: boolean;
|
|
@@ -30,8 +16,6 @@ export interface FolderSearchOptions {
|
|
|
30
16
|
deny?: readonly string[];
|
|
31
17
|
include?: ((name: string, path: string) => boolean) | null;
|
|
32
18
|
}
|
|
33
|
-
export interface FolderSearchResult extends SearchResult, WalkSummary {
|
|
34
|
-
}
|
|
35
19
|
export declare class DriveSearch {
|
|
36
20
|
#private;
|
|
37
21
|
constructor(queries: readonly string[], { regex, caseSensitive, concurrency }?: SearchOptions);
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type DriveRoot, type FsToolError, type ResolvedKey } from './scope.ts';
|
|
2
|
+
export interface MissingPath {
|
|
3
|
+
readonly requested: string;
|
|
4
|
+
readonly resolved: ResolvedKey;
|
|
5
|
+
readonly anchor: DriveRoot | undefined;
|
|
6
|
+
readonly deny: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
export declare function missingFile({ requested, resolved: { root, key }, anchor, deny }: MissingPath): Promise<FsToolError>;
|