@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
|
@@ -1,424 +0,0 @@
|
|
|
1
|
-
import * as xml from '../xml.js';
|
|
2
|
-
import * as refs from './refs.js';
|
|
3
|
-
import * as formula from './formula.js';
|
|
4
|
-
const X = xml.ns.x;
|
|
5
|
-
const XDR = xml.ns.xdr;
|
|
6
|
-
const XM = 'http://schemas.microsoft.com/office/excel/2006/main';
|
|
7
|
-
const PIVOT_CACHE = 'application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml';
|
|
8
|
-
const COMMENTS_REL = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments';
|
|
9
|
-
const TABLE_REL = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/table';
|
|
10
|
-
const PIVOT_TABLE_REL = 'http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable';
|
|
11
|
-
export function formulaElements(doc) {
|
|
12
|
-
return [
|
|
13
|
-
...xml.descendants(doc, X, 'f'),
|
|
14
|
-
...xml.descendants(doc, X, 'formula'),
|
|
15
|
-
...xml.descendants(doc, X, 'formula1'),
|
|
16
|
-
...xml.descendants(doc, X, 'formula2'),
|
|
17
|
-
...xml.descendants(doc, XM, 'f')
|
|
18
|
-
];
|
|
19
|
-
}
|
|
20
|
-
export function tableNames(pkg, sheetPart) {
|
|
21
|
-
return pkg.related(sheetPart, TABLE_REL).map((part) => {
|
|
22
|
-
const root = pkg.root(part);
|
|
23
|
-
return root.getAttribute('displayName') || root.getAttribute('name') || part;
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
function tables(host, sheet) {
|
|
27
|
-
return host.package.related(sheet.part, TABLE_REL).map((part) => {
|
|
28
|
-
const root = host.package.root(part);
|
|
29
|
-
return {
|
|
30
|
-
part,
|
|
31
|
-
root,
|
|
32
|
-
area: refs.parseRange(root.getAttribute('ref') || 'A1'),
|
|
33
|
-
header: root.hasAttribute('headerRowCount') ? Number(root.getAttribute('headerRowCount')) : 1,
|
|
34
|
-
totals: root.hasAttribute('totalsRowCount') ? Number(root.getAttribute('totalsRowCount')) : 0,
|
|
35
|
-
name: root.getAttribute('displayName') || root.getAttribute('name') || part
|
|
36
|
-
};
|
|
37
|
-
});
|
|
38
|
-
}
|
|
39
|
-
function sqref(value, change) {
|
|
40
|
-
const parts = value
|
|
41
|
-
.trim()
|
|
42
|
-
.split(/\s+/)
|
|
43
|
-
.map((part) => formula.adjustRange(part, change))
|
|
44
|
-
.filter((part) => part !== null);
|
|
45
|
-
return parts.length ? parts.join(' ') : null;
|
|
46
|
-
}
|
|
47
|
-
function tableBlockers(host, sheet, change) {
|
|
48
|
-
const reasons = [];
|
|
49
|
-
const end = change.at + change.count - 1;
|
|
50
|
-
const hits = (lo, hi) => lo <= hi && change.at <= hi && end >= lo;
|
|
51
|
-
for (const table of tables(host, sheet)) {
|
|
52
|
-
const { top, bottom } = table.area;
|
|
53
|
-
const dataTop = top + table.header;
|
|
54
|
-
const dataBottom = bottom - table.totals;
|
|
55
|
-
if (hits(top, dataTop - 1) || hits(dataBottom + 1, bottom)) {
|
|
56
|
-
reasons.push(`the header or totals row of table ${table.name}`);
|
|
57
|
-
}
|
|
58
|
-
else if (change.at <= dataTop && end >= dataBottom && dataTop <= dataBottom) {
|
|
59
|
-
reasons.push(`every data row of table ${table.name}`);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return reasons;
|
|
63
|
-
}
|
|
64
|
-
export function renamePivotSources(pkg, from, to) {
|
|
65
|
-
const wanted = from.toLowerCase();
|
|
66
|
-
for (const name of pkg.names().filter((n) => pkg.contentType(n) === PIVOT_CACHE)) {
|
|
67
|
-
const sources = xml
|
|
68
|
-
.descendants(pkg.xml(name), X, 'worksheetSource')
|
|
69
|
-
.filter((src) => (src.getAttribute('sheet') || '').toLowerCase() === wanted);
|
|
70
|
-
for (const src of sources) {
|
|
71
|
-
src.setAttribute('sheet', to);
|
|
72
|
-
}
|
|
73
|
-
if (sources.length) {
|
|
74
|
-
pkg.touch(name);
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
function hasPivot(host, sheet) {
|
|
79
|
-
if (host.package.related(sheet.part, PIVOT_TABLE_REL).length) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
const target = sheet.name.toLowerCase();
|
|
83
|
-
return host.package.names().some((name) => {
|
|
84
|
-
if (host.package.contentType(name) !== PIVOT_CACHE)
|
|
85
|
-
return false;
|
|
86
|
-
return xml
|
|
87
|
-
.descendants(host.package.xml(name), X, 'worksheetSource')
|
|
88
|
-
.some((src) => (src.getAttribute('sheet') || '').toLowerCase() === target);
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
function straddles(area, change) {
|
|
92
|
-
const lo = change.axis === 'row' ? area.top : area.left;
|
|
93
|
-
const hi = change.axis === 'row' ? area.bottom : area.right;
|
|
94
|
-
if (change.kind === 'insert') {
|
|
95
|
-
return change.at > lo && change.at <= hi;
|
|
96
|
-
}
|
|
97
|
-
const past = change.at + change.count;
|
|
98
|
-
return change.at <= hi && past > lo && !(change.at <= lo && past > hi);
|
|
99
|
-
}
|
|
100
|
-
function formulaBlocker(sheet, change) {
|
|
101
|
-
for (const f of xml.descendants(sheet.doc, X, 'f')) {
|
|
102
|
-
const kind = f.getAttribute('t');
|
|
103
|
-
if (kind === 'dataTable') {
|
|
104
|
-
return 'data tables';
|
|
105
|
-
}
|
|
106
|
-
const ref = f.getAttribute('ref');
|
|
107
|
-
if (kind !== 'array' || !ref) {
|
|
108
|
-
continue;
|
|
109
|
-
}
|
|
110
|
-
if (straddles(refs.parseRange(ref), change)) {
|
|
111
|
-
return `an array formula over ${ref}`;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
116
|
-
export function blockers(host, sheet, change) {
|
|
117
|
-
const reasons = [];
|
|
118
|
-
const root = sheet.root;
|
|
119
|
-
if (change.axis === 'col' && xml.child(root, X, 'tableParts')) {
|
|
120
|
-
reasons.push('tables');
|
|
121
|
-
}
|
|
122
|
-
if (change.axis === 'row' && change.kind === 'delete') {
|
|
123
|
-
reasons.push(...tableBlockers(host, sheet, change));
|
|
124
|
-
}
|
|
125
|
-
if (xml.child(root, X, 'legacyDrawing') ||
|
|
126
|
-
host.package.related(sheet.part, COMMENTS_REL).length) {
|
|
127
|
-
reasons.push('comments');
|
|
128
|
-
}
|
|
129
|
-
if (hasPivot(host, sheet)) {
|
|
130
|
-
reasons.push('pivot tables');
|
|
131
|
-
}
|
|
132
|
-
const blocker = formulaBlocker(sheet, change);
|
|
133
|
-
if (blocker) {
|
|
134
|
-
reasons.push(blocker);
|
|
135
|
-
}
|
|
136
|
-
return reasons;
|
|
137
|
-
}
|
|
138
|
-
export function expandShared(sheet) {
|
|
139
|
-
const shared = xml.descendants(sheet.doc, X, 'f').filter((f) => f.getAttribute('t') === 'shared');
|
|
140
|
-
if (!shared.length) {
|
|
141
|
-
return false;
|
|
142
|
-
}
|
|
143
|
-
const texts = new Map();
|
|
144
|
-
for (const f of shared) {
|
|
145
|
-
const cell = f.parentNode;
|
|
146
|
-
texts.set(f, xml.isElement(cell) ? sheet.formula(cell) : null);
|
|
147
|
-
}
|
|
148
|
-
for (const f of shared) {
|
|
149
|
-
const text = texts.get(f);
|
|
150
|
-
for (const attr of ['t', 'ref', 'si']) {
|
|
151
|
-
f.removeAttribute(attr);
|
|
152
|
-
}
|
|
153
|
-
if (text) {
|
|
154
|
-
xml.setText(f, text.replace(/^=/, ''));
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
sheet.resetMasters();
|
|
158
|
-
sheet.touch();
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
function needsExpansion(sheet, target) {
|
|
162
|
-
return xml
|
|
163
|
-
.descendants(sheet.doc, X, 'f')
|
|
164
|
-
.some((f) => f.getAttribute('t') === 'shared' &&
|
|
165
|
-
!!xml.text(f) &&
|
|
166
|
-
formula.references(xml.text(f), sheet.name, target));
|
|
167
|
-
}
|
|
168
|
-
function adjustText(el, ownSheet, change) {
|
|
169
|
-
const text = xml.text(el);
|
|
170
|
-
if (!text) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
const next = formula.adjust(text, ownSheet, change);
|
|
174
|
-
if (next === text) {
|
|
175
|
-
return false;
|
|
176
|
-
}
|
|
177
|
-
xml.setText(el, next);
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
function adjustCellFormula(sheet, f, change) {
|
|
181
|
-
let touched = adjustText(f, sheet.name, change);
|
|
182
|
-
const ref = f.getAttribute('ref');
|
|
183
|
-
if (sheet.name === change.sheet && ref) {
|
|
184
|
-
const next = formula.adjustRange(ref, change);
|
|
185
|
-
if (next && next !== ref) {
|
|
186
|
-
f.setAttribute('ref', next);
|
|
187
|
-
touched = true;
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
const cell = f.parentNode;
|
|
191
|
-
if (xml.isElement(cell) && formula.references(xml.text(f), sheet.name, change.sheet)) {
|
|
192
|
-
for (const v of xml.children(cell, X, 'v')) {
|
|
193
|
-
xml.remove(v);
|
|
194
|
-
}
|
|
195
|
-
cell.removeAttribute('t');
|
|
196
|
-
touched = true;
|
|
197
|
-
}
|
|
198
|
-
return touched;
|
|
199
|
-
}
|
|
200
|
-
function adjustFormulas(sheet, change) {
|
|
201
|
-
let touched = false;
|
|
202
|
-
for (const f of xml.descendants(sheet.doc, X, 'f')) {
|
|
203
|
-
if (adjustCellFormula(sheet, f, change)) {
|
|
204
|
-
touched = true;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
const rules = formulaElements(sheet.doc).filter((el) => el.namespaceURI !== X || el.localName !== 'f');
|
|
208
|
-
for (const el of rules) {
|
|
209
|
-
if (adjustText(el, sheet.name, change)) {
|
|
210
|
-
touched = true;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
return touched;
|
|
214
|
-
}
|
|
215
|
-
function adjustList(list, entry, change) {
|
|
216
|
-
if (!list)
|
|
217
|
-
return;
|
|
218
|
-
for (const el of xml.children(list, X, entry)) {
|
|
219
|
-
const next = formula.adjustRange(xml.attr(el, 'ref'), change);
|
|
220
|
-
const keep = entry === 'mergeCell' ? !!next && next.includes(':') : next !== null;
|
|
221
|
-
if (!keep || next === null) {
|
|
222
|
-
xml.remove(el);
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
el.setAttribute('ref', next);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
const count = xml.children(list, X, entry).length;
|
|
229
|
-
if (!count) {
|
|
230
|
-
xml.remove(list);
|
|
231
|
-
}
|
|
232
|
-
else if (entry === 'mergeCell') {
|
|
233
|
-
list.setAttribute('count', String(count));
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
function adjustSqrefs(sheet, change) {
|
|
237
|
-
for (const local of ['conditionalFormatting', 'dataValidation']) {
|
|
238
|
-
for (const el of xml.descendants(sheet.doc, X, local)) {
|
|
239
|
-
const value = el.getAttribute('sqref');
|
|
240
|
-
if (value === null) {
|
|
241
|
-
continue;
|
|
242
|
-
}
|
|
243
|
-
const next = sqref(value, change);
|
|
244
|
-
if (next === null) {
|
|
245
|
-
xml.remove(el);
|
|
246
|
-
}
|
|
247
|
-
else {
|
|
248
|
-
el.setAttribute('sqref', next);
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
const validations = xml.child(sheet.root, X, 'dataValidations');
|
|
253
|
-
if (validations) {
|
|
254
|
-
const count = xml.children(validations, X, 'dataValidation').length;
|
|
255
|
-
if (count) {
|
|
256
|
-
validations.setAttribute('count', String(count));
|
|
257
|
-
}
|
|
258
|
-
else {
|
|
259
|
-
xml.remove(validations);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
for (const el of xml.descendants(sheet.doc, XM, 'sqref')) {
|
|
263
|
-
const next = sqref(xml.text(el), change);
|
|
264
|
-
if (next !== null) {
|
|
265
|
-
xml.setText(el, next);
|
|
266
|
-
}
|
|
267
|
-
else if (el.parentNode?.parentNode) {
|
|
268
|
-
xml.remove(el.parentNode);
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
function adjustFilterColumns(el, move) {
|
|
273
|
-
const { change } = move;
|
|
274
|
-
if (change.axis !== 'col') {
|
|
275
|
-
return;
|
|
276
|
-
}
|
|
277
|
-
const left = refs.parseRange(move.from).left;
|
|
278
|
-
const nextLeft = refs.parseRange(move.to).left;
|
|
279
|
-
for (const column of xml.children(el, X, 'filterColumn')) {
|
|
280
|
-
const moved = formula.moveIndex(left + Number(column.getAttribute('colId')), change);
|
|
281
|
-
if (moved === null) {
|
|
282
|
-
xml.remove(column);
|
|
283
|
-
}
|
|
284
|
-
else {
|
|
285
|
-
column.setAttribute('colId', String(moved - nextLeft));
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
}
|
|
289
|
-
function adjustFilters(sheet, change) {
|
|
290
|
-
for (const local of ['autoFilter', 'sortState', 'sortCondition']) {
|
|
291
|
-
for (const el of xml.descendants(sheet.doc, X, local)) {
|
|
292
|
-
const ref = el.getAttribute('ref');
|
|
293
|
-
if (ref === null) {
|
|
294
|
-
continue;
|
|
295
|
-
}
|
|
296
|
-
const next = formula.adjustRange(ref, change);
|
|
297
|
-
if (next === null) {
|
|
298
|
-
xml.remove(el);
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
adjustFilterColumns(el, { from: ref, to: next, change });
|
|
302
|
-
el.setAttribute('ref', next);
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
function adjustBreaks(sheet, change) {
|
|
308
|
-
const breaks = xml.child(sheet.root, X, change.axis === 'row' ? 'rowBreaks' : 'colBreaks');
|
|
309
|
-
if (!breaks) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
for (const brk of xml.children(breaks, X, 'brk')) {
|
|
313
|
-
const next = formula.moveIndex(Number(brk.getAttribute('id')), change);
|
|
314
|
-
if (next === null) {
|
|
315
|
-
xml.remove(brk);
|
|
316
|
-
}
|
|
317
|
-
else {
|
|
318
|
-
brk.setAttribute('id', String(next));
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
const count = xml.children(breaks, X, 'brk').length;
|
|
322
|
-
if (!count) {
|
|
323
|
-
xml.remove(breaks);
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
breaks.setAttribute('count', String(count));
|
|
327
|
-
if (breaks.hasAttribute('manualBreakCount')) {
|
|
328
|
-
breaks.setAttribute('manualBreakCount', String(count));
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
function adjustTables(host, sheet, change) {
|
|
332
|
-
if (change.axis !== 'row')
|
|
333
|
-
return;
|
|
334
|
-
for (const table of tables(host, sheet)) {
|
|
335
|
-
for (const el of [table.root, ...xml.children(table.root, X, 'autoFilter')]) {
|
|
336
|
-
const next = formula.adjustRange(xml.attr(el, 'ref'), change);
|
|
337
|
-
if (next) {
|
|
338
|
-
el.setAttribute('ref', next);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
host.package.touch(table.part);
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
function adjustAnchors(host, sheet, change) {
|
|
345
|
-
const drawing = host.drawingOf(sheet);
|
|
346
|
-
if (!drawing) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
const doc = host.package.xml(drawing);
|
|
350
|
-
const local = change.axis === 'row' ? 'row' : 'col';
|
|
351
|
-
let moved = false;
|
|
352
|
-
for (const marker of [...xml.descendants(doc, XDR, 'from'), ...xml.descendants(doc, XDR, 'to')]) {
|
|
353
|
-
const el = xml.child(marker, XDR, local);
|
|
354
|
-
if (!el) {
|
|
355
|
-
continue;
|
|
356
|
-
}
|
|
357
|
-
const index = Number(xml.text(el));
|
|
358
|
-
const edge = (change.axis === 'row' ? refs.MAX_ROWS : refs.MAX_COLUMNS) - 1;
|
|
359
|
-
const value = formula.moveIndex(index, change) ?? (change.kind === 'insert' ? edge : change.at);
|
|
360
|
-
if (value !== index) {
|
|
361
|
-
xml.setText(el, String(value));
|
|
362
|
-
moved = true;
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
if (moved) {
|
|
366
|
-
host.package.touch(drawing);
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
function adjustStructures(host, sheet, change) {
|
|
370
|
-
adjustList(xml.child(sheet.root, X, 'mergeCells'), 'mergeCell', change);
|
|
371
|
-
adjustList(xml.child(sheet.root, X, 'hyperlinks'), 'hyperlink', change);
|
|
372
|
-
adjustSqrefs(sheet, change);
|
|
373
|
-
adjustFilters(sheet, change);
|
|
374
|
-
adjustBreaks(sheet, change);
|
|
375
|
-
adjustTables(host, sheet, change);
|
|
376
|
-
adjustAnchors(host, sheet, change);
|
|
377
|
-
sheet.touch();
|
|
378
|
-
}
|
|
379
|
-
function adjustElsewhere(host, change) {
|
|
380
|
-
let names = false;
|
|
381
|
-
for (const dn of host.definedNames()) {
|
|
382
|
-
if (adjustText(dn, null, change)) {
|
|
383
|
-
names = true;
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
if (names) {
|
|
387
|
-
host.package.touch(host.main);
|
|
388
|
-
}
|
|
389
|
-
for (const part of host.chartParts()) {
|
|
390
|
-
let touched = false;
|
|
391
|
-
for (const f of xml.descendants(host.package.xml(part), xml.ns.c, 'f')) {
|
|
392
|
-
if (adjustText(f, null, change)) {
|
|
393
|
-
touched = true;
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
if (touched) {
|
|
397
|
-
host.package.touch(part);
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
function sheetsOf(host, target) {
|
|
402
|
-
return host
|
|
403
|
-
.entries()
|
|
404
|
-
.filter((entry) => entry.kind === 'worksheet')
|
|
405
|
-
.map((entry) => (entry.part === target.part ? target : host.sheetFor(entry)));
|
|
406
|
-
}
|
|
407
|
-
export function apply(host, target, change) {
|
|
408
|
-
for (const sheet of sheetsOf(host, target)) {
|
|
409
|
-
if (adjustFormulas(sheet, change)) {
|
|
410
|
-
sheet.touch();
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
adjustStructures(host, target, change);
|
|
414
|
-
adjustElsewhere(host, change);
|
|
415
|
-
host.state.formulas = true;
|
|
416
|
-
host.state.cellsChanged = true;
|
|
417
|
-
}
|
|
418
|
-
export function prepare(host, target) {
|
|
419
|
-
for (const sheet of sheetsOf(host, target)) {
|
|
420
|
-
if (sheet.part === target.part || needsExpansion(sheet, target.name)) {
|
|
421
|
-
expandShared(sheet);
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
}
|
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
import type { Document, Element } from '../xml.ts';
|
|
2
|
-
import type { Package } from '../opc/package.ts';
|
|
3
|
-
import { type SharedStrings } from './strings.ts';
|
|
4
|
-
import type { Styles } from './styles.ts';
|
|
5
|
-
import type { Area, Position } from './refs.ts';
|
|
6
|
-
export type CellValue = string | number | boolean | null;
|
|
7
|
-
export interface EditState {
|
|
8
|
-
touched: Set<Sheet>;
|
|
9
|
-
formulas: boolean;
|
|
10
|
-
cellsChanged: boolean;
|
|
11
|
-
}
|
|
12
|
-
export interface SheetHost {
|
|
13
|
-
package: Package;
|
|
14
|
-
strings: SharedStrings;
|
|
15
|
-
styles: Styles;
|
|
16
|
-
state: EditState;
|
|
17
|
-
readonly date1904: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface SheetEntry {
|
|
20
|
-
el: Element;
|
|
21
|
-
index: number;
|
|
22
|
-
rId: string;
|
|
23
|
-
name: string;
|
|
24
|
-
state: string;
|
|
25
|
-
part: string;
|
|
26
|
-
kind: string;
|
|
27
|
-
}
|
|
28
|
-
export interface CellEntry extends Position {
|
|
29
|
-
el: Element;
|
|
30
|
-
}
|
|
31
|
-
export interface RowEntry {
|
|
32
|
-
el: Element;
|
|
33
|
-
r: number;
|
|
34
|
-
}
|
|
35
|
-
export interface ReadOptions {
|
|
36
|
-
range?: string;
|
|
37
|
-
limit?: number;
|
|
38
|
-
}
|
|
39
|
-
export interface SheetRead {
|
|
40
|
-
name: string;
|
|
41
|
-
range: string | null;
|
|
42
|
-
rows: CellValue[][];
|
|
43
|
-
formulas: Record<string, string>;
|
|
44
|
-
merged: string[];
|
|
45
|
-
truncated?: boolean;
|
|
46
|
-
}
|
|
47
|
-
export interface CellRead {
|
|
48
|
-
value: CellValue;
|
|
49
|
-
formula: string | null;
|
|
50
|
-
format: string;
|
|
51
|
-
}
|
|
52
|
-
export interface SerialDate {
|
|
53
|
-
serial: number;
|
|
54
|
-
time: boolean;
|
|
55
|
-
}
|
|
56
|
-
export interface ColumnWidth {
|
|
57
|
-
col: number;
|
|
58
|
-
width: number;
|
|
59
|
-
}
|
|
60
|
-
export declare const SHEET_ORDER: string[];
|
|
61
|
-
export declare function serialToIso(serial: number, date1904: boolean): string | number;
|
|
62
|
-
export declare function isoToSerial(value: string, date1904: boolean): SerialDate;
|
|
63
|
-
export declare class Sheet {
|
|
64
|
-
host: SheetHost;
|
|
65
|
-
name: string;
|
|
66
|
-
part: string;
|
|
67
|
-
index: number;
|
|
68
|
-
private masters;
|
|
69
|
-
constructor(host: SheetHost, entry: SheetEntry);
|
|
70
|
-
get package(): Package;
|
|
71
|
-
get doc(): Document;
|
|
72
|
-
get root(): Element;
|
|
73
|
-
sheetData(): Element;
|
|
74
|
-
rows(): Element[];
|
|
75
|
-
touch(): void;
|
|
76
|
-
cells(): CellEntry[];
|
|
77
|
-
numberedRows(): RowEntry[];
|
|
78
|
-
numberedCells(row: Element, r: number): CellEntry[];
|
|
79
|
-
number(): void;
|
|
80
|
-
positionOf(c: Element): Position;
|
|
81
|
-
usedRange(): Area | null;
|
|
82
|
-
merged(): string[];
|
|
83
|
-
value(c: Element): CellValue;
|
|
84
|
-
formula(c: Element): string | null;
|
|
85
|
-
resetMasters(): void;
|
|
86
|
-
read(opts?: ReadOptions): SheetRead;
|
|
87
|
-
get(ref: unknown): CellRead;
|
|
88
|
-
findRow(r: number): Element | null;
|
|
89
|
-
ensureRow(r: number): Element;
|
|
90
|
-
findCell(pos: Position): Element | null;
|
|
91
|
-
ensureCell(pos: Position): Element;
|
|
92
|
-
write(ref: string, input: unknown): void;
|
|
93
|
-
lastRow(): number;
|
|
94
|
-
shiftRows(from: number, delta: number): void;
|
|
95
|
-
removeRows(from: number, count: number): void;
|
|
96
|
-
removeColumns(from: number, count: number): void;
|
|
97
|
-
setColumnWidth(spec: ColumnWidth): void;
|
|
98
|
-
updateDimension(): void;
|
|
99
|
-
private position;
|
|
100
|
-
private sharedMasters;
|
|
101
|
-
private fillRead;
|
|
102
|
-
private appendValue;
|
|
103
|
-
private writeContent;
|
|
104
|
-
private writeValue;
|
|
105
|
-
private shrinkColumns;
|
|
106
|
-
private guardMerged;
|
|
107
|
-
private guardWrite;
|
|
108
|
-
}
|