@duckmind/dm-linux-x64 0.66.0 → 0.66.2
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/dm +2 -2
- package/extensions/.dm-extensions.json +12 -546
- package/extensions/dm-lens/clients/dispatch/runners/utils/runner-helpers.js +1 -1
- package/extensions/dm-mcp-adapter/mcp-keyring-helper.cjs +1 -1
- package/extensions/dm-ponytail/hooks/ponytail-activate.js +1 -1
- package/extensions/dm-ponytail/hooks/ponytail-instructions.js +1 -1
- package/extensions/dm-subagents/src/runs/background/runner-aliases.js +2 -2
- package/extensions/dm-subagents/src/runs/foreground/prompt-audit.js +4 -1
- package/extensions/dm-subagents/src/runs/shared/child-session.js +8 -6
- package/extensions/dm-subagents/src/watchdog/permission-arbiter.js +9 -1
- package/extensions/dm-subagents/src/watchdog/review.js +4 -1
- package/package.json +1 -1
- package/extensions/dm-lens/dist/clients/actionable-warnings-logger.js +0 -24
- package/extensions/dm-lens/dist/clients/actionable-warnings.js +0 -1014
- package/extensions/dm-lens/dist/clients/advisory-provenance.js +0 -385
- package/extensions/dm-lens/dist/clients/agent-behavior-client.js +0 -94
- package/extensions/dm-lens/dist/clients/agent-nudge.js +0 -151
- package/extensions/dm-lens/dist/clients/analysed-root.js +0 -1
- package/extensions/dm-lens/dist/clients/ast-grep-client.js +0 -576
- package/extensions/dm-lens/dist/clients/ast-grep-rule-manager.js +0 -114
- package/extensions/dm-lens/dist/clients/ast-grep-tool-logger.js +0 -85
- package/extensions/dm-lens/dist/clients/ast-grep-types.js +0 -1
- package/extensions/dm-lens/dist/clients/ast-grep-yaml-synth.js +0 -109
- package/extensions/dm-lens/dist/clients/atomic-write-staging.js +0 -66
- package/extensions/dm-lens/dist/clients/atomic-write.js +0 -37
- package/extensions/dm-lens/dist/clients/availability-probe-flight.js +0 -11
- package/extensions/dm-lens/dist/clients/bash-file-access.js +0 -830
- package/extensions/dm-lens/dist/clients/biome-client.js +0 -221
- package/extensions/dm-lens/dist/clients/blocker-freshness.js +0 -385
- package/extensions/dm-lens/dist/clients/blocker-past-eof.js +0 -49
- package/extensions/dm-lens/dist/clients/bootstrap.js +0 -246
- package/extensions/dm-lens/dist/clients/bounded-cache.js +0 -105
- package/extensions/dm-lens/dist/clients/bounded-pid-file-lock.js +0 -173
- package/extensions/dm-lens/dist/clients/bounded-telemetry.js +0 -104
- package/extensions/dm-lens/dist/clients/build-identity.js +0 -45
- package/extensions/dm-lens/dist/clients/bundled-resource-health.js +0 -41
- package/extensions/dm-lens/dist/clients/bus-events-logger.js +0 -48
- package/extensions/dm-lens/dist/clients/bus-publish.js +0 -117
- package/extensions/dm-lens/dist/clients/cache/rule-cache.js +0 -103
- package/extensions/dm-lens/dist/clients/cache-manager.js +0 -340
- package/extensions/dm-lens/dist/clients/cache-observability.js +0 -847
- package/extensions/dm-lens/dist/clients/call-graph.js +0 -628
- package/extensions/dm-lens/dist/clients/cargo-manifest.js +0 -151
- package/extensions/dm-lens/dist/clients/cascade-budget.js +0 -52
- package/extensions/dm-lens/dist/clients/cascade-format.js +0 -160
- package/extensions/dm-lens/dist/clients/cascade-logger.js +0 -22
- package/extensions/dm-lens/dist/clients/cascade-types.js +0 -1
- package/extensions/dm-lens/dist/clients/child-unref.js +0 -59
- package/extensions/dm-lens/dist/clients/code-quality-warnings.js +0 -192
- package/extensions/dm-lens/dist/clients/codebase-model.js +0 -110
- package/extensions/dm-lens/dist/clients/collateral-test-role.js +0 -8
- package/extensions/dm-lens/dist/clients/complexity-client.js +0 -398
- package/extensions/dm-lens/dist/clients/config-core/deny.js +0 -117
- package/extensions/dm-lens/dist/clients/config-core/index.js +0 -2
- package/extensions/dm-lens/dist/clients/config-core/merge.js +0 -228
- package/extensions/dm-lens/dist/clients/config-core/normalize.js +0 -217
- package/extensions/dm-lens/dist/clients/config-core/process-spec.js +0 -147
- package/extensions/dm-lens/dist/clients/config-core/provenance.js +0 -54
- package/extensions/dm-lens/dist/clients/config-core/records.js +0 -79
- package/extensions/dm-lens/dist/clients/config-core/resolve.js +0 -48
- package/extensions/dm-lens/dist/clients/config-core/safe-object.js +0 -22
- package/extensions/dm-lens/dist/clients/config-core/schema.js +0 -90
- package/extensions/dm-lens/dist/clients/config-diagnostic-codes.js +0 -90
- package/extensions/dm-lens/dist/clients/config-locations.js +0 -175
- package/extensions/dm-lens/dist/clients/config-resolve.js +0 -359
- package/extensions/dm-lens/dist/clients/config-schema.js +0 -128
- package/extensions/dm-lens/dist/clients/config-warn.js +0 -146
- package/extensions/dm-lens/dist/clients/console-guard-install.js +0 -4
- package/extensions/dm-lens/dist/clients/cooperative-budget.js +0 -36
- package/extensions/dm-lens/dist/clients/dead-code-client.js +0 -342
- package/extensions/dm-lens/dist/clients/dead-code-logger.js +0 -18
- package/extensions/dm-lens/dist/clients/deadline-utils.js +0 -117
- package/extensions/dm-lens/dist/clients/debug-handles.js +0 -121
- package/extensions/dm-lens/dist/clients/debug-heap.js +0 -80
- package/extensions/dm-lens/dist/clients/deferred-lsp-work.js +0 -33
- package/extensions/dm-lens/dist/clients/degradation-ledger.js +0 -272
- package/extensions/dm-lens/dist/clients/demoted-finding-render.js +0 -61
- package/extensions/dm-lens/dist/clients/dependency-checker.js +0 -525
- package/extensions/dm-lens/dist/clients/deps/ast-grep-napi.js +0 -17
- package/extensions/dm-lens/dist/clients/deps/dm-host-deps.js +0 -10
- package/extensions/dm-lens/dist/clients/deps/dm-tui-compat.js +0 -58
- package/extensions/dm-lens/dist/clients/deps/js-yaml.js +0 -7
- package/extensions/dm-lens/dist/clients/deps/minimatch.js +0 -6
- package/extensions/dm-lens/dist/clients/deps/pidusage.js +0 -5
- package/extensions/dm-lens/dist/clients/deps/typebox.js +0 -5
- package/extensions/dm-lens/dist/clients/deps/vscode-jsonrpc.js +0 -8
- package/extensions/dm-lens/dist/clients/deps/web-tree-sitter.js +0 -11
- package/extensions/dm-lens/dist/clients/diagnostic-dispositions.js +0 -318
- package/extensions/dm-lens/dist/clients/diagnostic-line-freshness.js +0 -144
- package/extensions/dm-lens/dist/clients/diagnostic-logger.js +0 -60
- package/extensions/dm-lens/dist/clients/diagnostic-tracker.js +0 -89
- package/extensions/dm-lens/dist/clients/diagnostics-publish.js +0 -134
- package/extensions/dm-lens/dist/clients/dispatch/ast-grep-catalog.js +0 -16
- package/extensions/dm-lens/dist/clients/dispatch/auxiliary-lsp.js +0 -158
- package/extensions/dm-lens/dist/clients/dispatch/collect-later-tier.js +0 -25
- package/extensions/dm-lens/dist/clients/dispatch/diagnostic-taxonomy.js +0 -58
- package/extensions/dm-lens/dist/clients/dispatch/dispatcher.js +0 -953
- package/extensions/dm-lens/dist/clients/dispatch/fact-provider-types.js +0 -1
- package/extensions/dm-lens/dist/clients/dispatch/fact-rule-runner.js +0 -17
- package/extensions/dm-lens/dist/clients/dispatch/fact-runner.js +0 -18
- package/extensions/dm-lens/dist/clients/dispatch/fact-scheduler.js +0 -52
- package/extensions/dm-lens/dist/clients/dispatch/fact-store.js +0 -199
- package/extensions/dm-lens/dist/clients/dispatch/facts/comment-facts.js +0 -20
- package/extensions/dm-lens/dist/clients/dispatch/facts/file-content.js +0 -18
- package/extensions/dm-lens/dist/clients/dispatch/facts/function-facts.js +0 -281
- package/extensions/dm-lens/dist/clients/dispatch/facts/import-facts.js +0 -169
- package/extensions/dm-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +0 -19
- package/extensions/dm-lens/dist/clients/dispatch/facts/try-catch-facts.js +0 -95
- package/extensions/dm-lens/dist/clients/dispatch/finding-policy.js +0 -159
- package/extensions/dm-lens/dist/clients/dispatch/indent-detect.js +0 -227
- package/extensions/dm-lens/dist/clients/dispatch/inline-suppressions.js +0 -52
- package/extensions/dm-lens/dist/clients/dispatch/integration.js +0 -1463
- package/extensions/dm-lens/dist/clients/dispatch/lazy.js +0 -8
- package/extensions/dm-lens/dist/clients/dispatch/pending-runner-findings.js +0 -75
- package/extensions/dm-lens/dist/clients/dispatch/plan.js +0 -278
- package/extensions/dm-lens/dist/clients/dispatch/priorities.js +0 -14
- package/extensions/dm-lens/dist/clients/dispatch/rule-id-normalize.js +0 -42
- package/extensions/dm-lens/dist/clients/dispatch/rule-ignores.js +0 -21
- package/extensions/dm-lens/dist/clients/dispatch/rule-policy.js +0 -73
- package/extensions/dm-lens/dist/clients/dispatch/rules/async-noise.js +0 -31
- package/extensions/dm-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +0 -27
- package/extensions/dm-lens/dist/clients/dispatch/rules/cors-wildcard.js +0 -35
- package/extensions/dm-lens/dist/clients/dispatch/rules/error-obscuring.js +0 -29
- package/extensions/dm-lens/dist/clients/dispatch/rules/error-swallowing.js +0 -29
- package/extensions/dm-lens/dist/clients/dispatch/rules/framework-call-noise.js +0 -31
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-complexity.js +0 -56
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-fan-out.js +0 -45
- package/extensions/dm-lens/dist/clients/dispatch/rules/high-import-coupling.js +0 -31
- package/extensions/dm-lens/dist/clients/dispatch/rules/missing-error-propagation.js +0 -45
- package/extensions/dm-lens/dist/clients/dispatch/rules/no-commented-credentials.js +0 -46
- package/extensions/dm-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +0 -38
- package/extensions/dm-lens/dist/clients/dispatch/rules/placeholder-comments.js +0 -40
- package/extensions/dm-lens/dist/clients/dispatch/rules/unsafe-boundary.js +0 -101
- package/extensions/dm-lens/dist/clients/dispatch/runner-context.js +0 -46
- package/extensions/dm-lens/dist/clients/dispatch/runners/actionlint.js +0 -98
- package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-napi.js +0 -690
- package/extensions/dm-lens/dist/clients/dispatch/runners/biome-check.js +0 -202
- package/extensions/dm-lens/dist/clients/dispatch/runners/cpp-check.js +0 -190
- package/extensions/dm-lens/dist/clients/dispatch/runners/credo.js +0 -66
- package/extensions/dm-lens/dist/clients/dispatch/runners/cue-vet.js +0 -167
- package/extensions/dm-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -151
- package/extensions/dm-lens/dist/clients/dispatch/runners/detekt.js +0 -157
- package/extensions/dm-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -157
- package/extensions/dm-lens/dist/clients/dispatch/runners/elixir-check.js +0 -153
- package/extensions/dm-lens/dist/clients/dispatch/runners/eslint.js +0 -99
- package/extensions/dm-lens/dist/clients/dispatch/runners/fact-rules.js +0 -20
- package/extensions/dm-lens/dist/clients/dispatch/runners/fish-indent.js +0 -65
- package/extensions/dm-lens/dist/clients/dispatch/runners/gleam-check.js +0 -107
- package/extensions/dm-lens/dist/clients/dispatch/runners/go-vet.js +0 -51
- package/extensions/dm-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -89
- package/extensions/dm-lens/dist/clients/dispatch/runners/hadolint.js +0 -83
- package/extensions/dm-lens/dist/clients/dispatch/runners/helm-lint.js +0 -144
- package/extensions/dm-lens/dist/clients/dispatch/runners/helm-render.js +0 -593
- package/extensions/dm-lens/dist/clients/dispatch/runners/htmlhint.js +0 -103
- package/extensions/dm-lens/dist/clients/dispatch/runners/index.js +0 -100
- package/extensions/dm-lens/dist/clients/dispatch/runners/javac.js +0 -82
- package/extensions/dm-lens/dist/clients/dispatch/runners/ktlint.js +0 -93
- package/extensions/dm-lens/dist/clients/dispatch/runners/lsp.js +0 -206
- package/extensions/dm-lens/dist/clients/dispatch/runners/markdownlint.js +0 -129
- package/extensions/dm-lens/dist/clients/dispatch/runners/mypy.js +0 -70
- package/extensions/dm-lens/dist/clients/dispatch/runners/oxlint.js +0 -305
- package/extensions/dm-lens/dist/clients/dispatch/runners/php-lint.js +0 -70
- package/extensions/dm-lens/dist/clients/dispatch/runners/phpstan.js +0 -90
- package/extensions/dm-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -56
- package/extensions/dm-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -307
- package/extensions/dm-lens/dist/clients/dispatch/runners/pyright.js +0 -118
- package/extensions/dm-lens/dist/clients/dispatch/runners/rubocop.js +0 -79
- package/extensions/dm-lens/dist/clients/dispatch/runners/ruff.js +0 -69
- package/extensions/dm-lens/dist/clients/dispatch/runners/rust-clippy.js +0 -147
- package/extensions/dm-lens/dist/clients/dispatch/runners/shellcheck.js +0 -111
- package/extensions/dm-lens/dist/clients/dispatch/runners/shfmt.js +0 -81
- package/extensions/dm-lens/dist/clients/dispatch/runners/spellcheck.js +0 -74
- package/extensions/dm-lens/dist/clients/dispatch/runners/spotbugs.js +0 -208
- package/extensions/dm-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -136
- package/extensions/dm-lens/dist/clients/dispatch/runners/stylelint.js +0 -118
- package/extensions/dm-lens/dist/clients/dispatch/runners/swiftlint.js +0 -143
- package/extensions/dm-lens/dist/clients/dispatch/runners/taplo.js +0 -97
- package/extensions/dm-lens/dist/clients/dispatch/runners/terragrunt.js +0 -110
- package/extensions/dm-lens/dist/clients/dispatch/runners/tflint.js +0 -104
- package/extensions/dm-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -516
- package/extensions/dm-lens/dist/clients/dispatch/runners/trivy-config.js +0 -155
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/availability-policy.js +0 -285
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +0 -61
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -61
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +0 -130
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +0 -1067
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +0 -40
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/tool-failure.js +0 -117
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +0 -88
- package/extensions/dm-lens/dist/clients/dispatch/runners/utils.js +0 -8
- package/extensions/dm-lens/dist/clients/dispatch/runners/vale.js +0 -106
- package/extensions/dm-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +0 -163
- package/extensions/dm-lens/dist/clients/dispatch/runners/yamllint.js +0 -83
- package/extensions/dm-lens/dist/clients/dispatch/runners/zig-check.js +0 -72
- package/extensions/dm-lens/dist/clients/dispatch/suppress-writer.js +0 -57
- package/extensions/dm-lens/dist/clients/dispatch/tool-profile.js +0 -30
- package/extensions/dm-lens/dist/clients/dispatch/types.js +0 -7
- package/extensions/dm-lens/dist/clients/dispatch/utils/format-utils.js +0 -45
- package/extensions/dm-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +0 -31
- package/extensions/dm-lens/dist/clients/disposition-logger.js +0 -19
- package/extensions/dm-lens/dist/clients/disposition-publish.js +0 -88
- package/extensions/dm-lens/dist/clients/durable-store.js +0 -77
- package/extensions/dm-lens/dist/clients/effective-config.js +0 -160
- package/extensions/dm-lens/dist/clients/env-utils.js +0 -26
- package/extensions/dm-lens/dist/clients/error-class.js +0 -3
- package/extensions/dm-lens/dist/clients/eval-timestamp.js +0 -2
- package/extensions/dm-lens/dist/clients/event-loop-hold.js +0 -119
- package/extensions/dm-lens/dist/clients/event-loop-monitor.js +0 -84
- package/extensions/dm-lens/dist/clients/extension-log.js +0 -230
- package/extensions/dm-lens/dist/clients/extension-mode.js +0 -20
- package/extensions/dm-lens/dist/clients/feature-hints.js +0 -88
- package/extensions/dm-lens/dist/clients/file-kinds.js +0 -304
- package/extensions/dm-lens/dist/clients/file-role.js +0 -50
- package/extensions/dm-lens/dist/clients/file-time.js +0 -112
- package/extensions/dm-lens/dist/clients/file-utils.js +0 -630
- package/extensions/dm-lens/dist/clients/finding-delivery-gate.js +0 -129
- package/extensions/dm-lens/dist/clients/finding-identity.js +0 -23
- package/extensions/dm-lens/dist/clients/fix-worklog.js +0 -75
- package/extensions/dm-lens/dist/clients/format-events-publish.js +0 -230
- package/extensions/dm-lens/dist/clients/format-service.js +0 -154
- package/extensions/dm-lens/dist/clients/formatters-lazy.js +0 -8
- package/extensions/dm-lens/dist/clients/formatters.js +0 -1351
- package/extensions/dm-lens/dist/clients/freshness-cadence.js +0 -1
- package/extensions/dm-lens/dist/clients/freshness.js +0 -8
- package/extensions/dm-lens/dist/clients/generated-artifacts.js +0 -209
- package/extensions/dm-lens/dist/clients/generation-guard.js +0 -105
- package/extensions/dm-lens/dist/clients/git-guard.js +0 -770
- package/extensions/dm-lens/dist/clients/git-tracked-ignore.js +0 -120
- package/extensions/dm-lens/dist/clients/gitleaks-client.js +0 -282
- package/extensions/dm-lens/dist/clients/go-client.js +0 -47
- package/extensions/dm-lens/dist/clients/govulncheck-client.js +0 -411
- package/extensions/dm-lens/dist/clients/gradle-ktfmt-style.js +0 -177
- package/extensions/dm-lens/dist/clients/grammar-source.js +0 -224
- package/extensions/dm-lens/dist/clients/gzip-stage-write.js +0 -85
- package/extensions/dm-lens/dist/clients/hashline-anchor.js +0 -222
- package/extensions/dm-lens/dist/clients/hook-budgets.js +0 -16
- package/extensions/dm-lens/dist/clients/host-edit-normalize.js +0 -87
- package/extensions/dm-lens/dist/clients/host-ports.js +0 -35
- package/extensions/dm-lens/dist/clients/indent-retarget.js +0 -102
- package/extensions/dm-lens/dist/clients/inline-blocker-dispositions.js +0 -103
- package/extensions/dm-lens/dist/clients/install-diagnostics.js +0 -123
- package/extensions/dm-lens/dist/clients/installer/index.js +0 -3770
- package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh-session.js +0 -17
- package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh.js +0 -522
- package/extensions/dm-lens/dist/clients/instance-reaper-state.js +0 -3
- package/extensions/dm-lens/dist/clients/instance-reaper.js +0 -577
- package/extensions/dm-lens/dist/clients/instance-registry-lock.js +0 -131
- package/extensions/dm-lens/dist/clients/instance-registry.js +0 -452
- package/extensions/dm-lens/dist/clients/jscpd-client.js +0 -252
- package/extensions/dm-lens/dist/clients/json-cache-read.js +0 -25
- package/extensions/dm-lens/dist/clients/knip-client.js +0 -472
- package/extensions/dm-lens/dist/clients/language-policy.js +0 -242
- package/extensions/dm-lens/dist/clients/language-profile.js +0 -261
- package/extensions/dm-lens/dist/clients/language-registry.js +0 -424
- package/extensions/dm-lens/dist/clients/latency-logger.js +0 -192
- package/extensions/dm-lens/dist/clients/lazy-import.js +0 -14
- package/extensions/dm-lens/dist/clients/ledger-bounds.js +0 -21
- package/extensions/dm-lens/dist/clients/lens-config.js +0 -237
- package/extensions/dm-lens/dist/clients/lens-engine.js +0 -181
- package/extensions/dm-lens/dist/clients/lens-events.js +0 -105
- package/extensions/dm-lens/dist/clients/lens-flag-registry.js +0 -302
- package/extensions/dm-lens/dist/clients/lens-map.js +0 -980
- package/extensions/dm-lens/dist/clients/live-bus-emitter.js +0 -53
- package/extensions/dm-lens/dist/clients/log-cleanup.js +0 -138
- package/extensions/dm-lens/dist/clients/lsp/aggregation.js +0 -88
- package/extensions/dm-lens/dist/clients/lsp/cascade-tier.js +0 -203
- package/extensions/dm-lens/dist/clients/lsp/client.js +0 -2709
- package/extensions/dm-lens/dist/clients/lsp/config.js +0 -252
- package/extensions/dm-lens/dist/clients/lsp/content-limits.js +0 -21
- package/extensions/dm-lens/dist/clients/lsp/diagnostic-binding.js +0 -79
- package/extensions/dm-lens/dist/clients/lsp/document-drift.js +0 -312
- package/extensions/dm-lens/dist/clients/lsp/edits.js +0 -930
- package/extensions/dm-lens/dist/clients/lsp/index.js +0 -4448
- package/extensions/dm-lens/dist/clients/lsp/inferred-project.js +0 -121
- package/extensions/dm-lens/dist/clients/lsp/jvm-runtime.js +0 -194
- package/extensions/dm-lens/dist/clients/lsp/language.js +0 -23
- package/extensions/dm-lens/dist/clients/lsp/launch.js +0 -468
- package/extensions/dm-lens/dist/clients/lsp/lombok.js +0 -146
- package/extensions/dm-lens/dist/clients/lsp/path-utils.js +0 -1
- package/extensions/dm-lens/dist/clients/lsp/pending-aux-coverage.js +0 -90
- package/extensions/dm-lens/dist/clients/lsp/position-encoding.js +0 -28
- package/extensions/dm-lens/dist/clients/lsp/ruby-drive-dirs.js +0 -42
- package/extensions/dm-lens/dist/clients/lsp/server.js +0 -2422
- package/extensions/dm-lens/dist/clients/lsp/session-roots.js +0 -52
- package/extensions/dm-lens/dist/clients/lsp/spawn-history.js +0 -15
- package/extensions/dm-lens/dist/clients/lsp/sync-kind.js +0 -30
- package/extensions/dm-lens/dist/clients/lsp/tsserver-sync.js +0 -156
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +0 -1
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/classification.js +0 -36
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/index.js +0 -3
- package/extensions/dm-lens/dist/clients/lsp/wait-policy/strategies.js +0 -175
- package/extensions/dm-lens/dist/clients/lsp/watch-queue.js +0 -40
- package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-cache.js +0 -267
- package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-session.js +0 -7
- package/extensions/dm-lens/dist/clients/lsp/workspace-sweep-hold.js +0 -93
- package/extensions/dm-lens/dist/clients/lsp-budget.js +0 -83
- package/extensions/dm-lens/dist/clients/lsp-document-symbols.js +0 -93
- package/extensions/dm-lens/dist/clients/lsp-lazy.js +0 -8
- package/extensions/dm-lens/dist/clients/lsp-mutation.js +0 -273
- package/extensions/dm-lens/dist/clients/lsp-status.js +0 -37
- package/extensions/dm-lens/dist/clients/map-with-concurrency.js +0 -20
- package/extensions/dm-lens/dist/clients/mcp/analyze.js +0 -251
- package/extensions/dm-lens/dist/clients/mcp/host-shim.js +0 -14
- package/extensions/dm-lens/dist/clients/mcp/ipc.js +0 -302
- package/extensions/dm-lens/dist/clients/mcp/review.js +0 -137
- package/extensions/dm-lens/dist/clients/mcp/session.js +0 -305
- package/extensions/dm-lens/dist/clients/memory-sampler.js +0 -107
- package/extensions/dm-lens/dist/clients/message-end-attribution.js +0 -18
- package/extensions/dm-lens/dist/clients/metrics-client.js +0 -80
- package/extensions/dm-lens/dist/clients/metrics-history.js +0 -255
- package/extensions/dm-lens/dist/clients/middle-man-analysis.js +0 -161
- package/extensions/dm-lens/dist/clients/model-provider.js +0 -31
- package/extensions/dm-lens/dist/clients/module-report-lsp.js +0 -140
- package/extensions/dm-lens/dist/clients/module-report.js +0 -1642
- package/extensions/dm-lens/dist/clients/mutating-tool.js +0 -377
- package/extensions/dm-lens/dist/clients/mutation-attribution.js +0 -168
- package/extensions/dm-lens/dist/clients/mutation-bridge.js +0 -102
- package/extensions/dm-lens/dist/clients/ndjson-logger.js +0 -471
- package/extensions/dm-lens/dist/clients/observed-mutation-sources.js +0 -43
- package/extensions/dm-lens/dist/clients/observed-mutation.js +0 -709
- package/extensions/dm-lens/dist/clients/oldtext-autopatch.js +0 -100
- package/extensions/dm-lens/dist/clients/opaque-mutation-scan.js +0 -313
- package/extensions/dm-lens/dist/clients/opengrep-client.js +0 -216
- package/extensions/dm-lens/dist/clients/opengrep-config.js +0 -52
- package/extensions/dm-lens/dist/clients/package-manager.js +0 -303
- package/extensions/dm-lens/dist/clients/package-root.js +0 -25
- package/extensions/dm-lens/dist/clients/partial-edit-apply.js +0 -337
- package/extensions/dm-lens/dist/clients/path-attribution-telemetry.js +0 -31
- package/extensions/dm-lens/dist/clients/path-keyed-map.js +0 -57
- package/extensions/dm-lens/dist/clients/path-utils.js +0 -476
- package/extensions/dm-lens/dist/clients/performance-report.js +0 -291
- package/extensions/dm-lens/dist/clients/persist-debounce.js +0 -37
- package/extensions/dm-lens/dist/clients/persistent-reverify.js +0 -165
- package/extensions/dm-lens/dist/clients/php-cs-fixer-config.js +0 -15
- package/extensions/dm-lens/dist/clients/pipeline.js +0 -1091
- package/extensions/dm-lens/dist/clients/post-autofix-notice.js +0 -19
- package/extensions/dm-lens/dist/clients/print-mode.js +0 -3
- package/extensions/dm-lens/dist/clients/probe-home-state.js +0 -62
- package/extensions/dm-lens/dist/clients/process-bridge.js +0 -20
- package/extensions/dm-lens/dist/clients/process-singletons.js +0 -69
- package/extensions/dm-lens/dist/clients/process-snapshot.js +0 -22
- package/extensions/dm-lens/dist/clients/project-changes.js +0 -112
- package/extensions/dm-lens/dist/clients/project-conventions.js +0 -152
- package/extensions/dm-lens/dist/clients/project-diagnostics/cache.js +0 -91
- package/extensions/dm-lens/dist/clients/project-diagnostics/extractors.js +0 -53
- package/extensions/dm-lens/dist/clients/project-diagnostics/fresh-fetch.js +0 -408
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +0 -64
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +0 -38
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +0 -21
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +0 -23
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +0 -28
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +0 -45
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +0 -34
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +0 -32
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +0 -79
- package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +0 -41
- package/extensions/dm-lens/dist/clients/project-diagnostics/scanner.js +0 -349
- package/extensions/dm-lens/dist/clients/project-diagnostics/types.js +0 -1
- package/extensions/dm-lens/dist/clients/project-lens-config.js +0 -437
- package/extensions/dm-lens/dist/clients/project-report.js +0 -527
- package/extensions/dm-lens/dist/clients/project-scale.js +0 -60
- package/extensions/dm-lens/dist/clients/project-scan-policy.js +0 -4
- package/extensions/dm-lens/dist/clients/project-snapshot-fingerprint.js +0 -39
- package/extensions/dm-lens/dist/clients/project-snapshot-persist-worker.js +0 -14
- package/extensions/dm-lens/dist/clients/project-snapshot.js +0 -1178
- package/extensions/dm-lens/dist/clients/project-trust.js +0 -104
- package/extensions/dm-lens/dist/clients/python-environment.js +0 -120
- package/extensions/dm-lens/dist/clients/python-provenance.js +0 -551
- package/extensions/dm-lens/dist/clients/quiet-window-config.js +0 -16
- package/extensions/dm-lens/dist/clients/quiet-window.js +0 -126
- package/extensions/dm-lens/dist/clients/read-bridge.js +0 -46
- package/extensions/dm-lens/dist/clients/read-expansion.js +0 -218
- package/extensions/dm-lens/dist/clients/read-guard-logger.js +0 -178
- package/extensions/dm-lens/dist/clients/read-guard-tool-lines.js +0 -1042
- package/extensions/dm-lens/dist/clients/read-guard.js +0 -1096
- package/extensions/dm-lens/dist/clients/recent-touches.js +0 -126
- package/extensions/dm-lens/dist/clients/redact/secrets.js +0 -386
- package/extensions/dm-lens/dist/clients/resource-sampler.js +0 -344
- package/extensions/dm-lens/dist/clients/reverse-deps.js +0 -227
- package/extensions/dm-lens/dist/clients/review-graph/builder.js +0 -3635
- package/extensions/dm-lens/dist/clients/review-graph/format.js +0 -30
- package/extensions/dm-lens/dist/clients/review-graph/git-identity.js +0 -115
- package/extensions/dm-lens/dist/clients/review-graph/import-resolvers.js +0 -325
- package/extensions/dm-lens/dist/clients/review-graph/persist-worker.js +0 -8
- package/extensions/dm-lens/dist/clients/review-graph/query.js +0 -195
- package/extensions/dm-lens/dist/clients/review-graph/revision-drift.js +0 -3
- package/extensions/dm-lens/dist/clients/review-graph/service.js +0 -60
- package/extensions/dm-lens/dist/clients/review-graph/shared-extraction-ir.js +0 -54
- package/extensions/dm-lens/dist/clients/review-graph/symbol-id.js +0 -29
- package/extensions/dm-lens/dist/clients/review-graph/tsconfig-paths.js +0 -253
- package/extensions/dm-lens/dist/clients/review-graph/types.js +0 -1
- package/extensions/dm-lens/dist/clients/review-graph/workspace-modules.js +0 -374
- package/extensions/dm-lens/dist/clients/review-graph-logger.js +0 -51
- package/extensions/dm-lens/dist/clients/ruff-client.js +0 -109
- package/extensions/dm-lens/dist/clients/rules-scanner.js +0 -113
- package/extensions/dm-lens/dist/clients/run-duration.js +0 -9
- package/extensions/dm-lens/dist/clients/runtime-agent-end.js +0 -608
- package/extensions/dm-lens/dist/clients/runtime-config.js +0 -39
- package/extensions/dm-lens/dist/clients/runtime-context.js +0 -155
- package/extensions/dm-lens/dist/clients/runtime-coordinator.js +0 -817
- package/extensions/dm-lens/dist/clients/runtime-session.js +0 -1625
- package/extensions/dm-lens/dist/clients/runtime-tool-call.js +0 -868
- package/extensions/dm-lens/dist/clients/runtime-tool-result.js +0 -1317
- package/extensions/dm-lens/dist/clients/runtime-turn.js +0 -2333
- package/extensions/dm-lens/dist/clients/rust-client.js +0 -48
- package/extensions/dm-lens/dist/clients/safe-spawn.js +0 -1267
- package/extensions/dm-lens/dist/clients/sanitize.js +0 -174
- package/extensions/dm-lens/dist/clients/scan-utils.js +0 -7
- package/extensions/dm-lens/dist/clients/scratch-tree-policy.js +0 -57
- package/extensions/dm-lens/dist/clients/search-read-registration.js +0 -59
- package/extensions/dm-lens/dist/clients/secret-findings.js +0 -69
- package/extensions/dm-lens/dist/clients/security-scan-client.js +0 -208
- package/extensions/dm-lens/dist/clients/session-event-guard.js +0 -111
- package/extensions/dm-lens/dist/clients/session-lifecycle.js +0 -173
- package/extensions/dm-lens/dist/clients/session-start-observability.js +0 -47
- package/extensions/dm-lens/dist/clients/session-state-store.js +0 -63
- package/extensions/dm-lens/dist/clients/session-summary.js +0 -8
- package/extensions/dm-lens/dist/clients/sessionstart-logger.js +0 -22
- package/extensions/dm-lens/dist/clients/sg-runner.js +0 -627
- package/extensions/dm-lens/dist/clients/sgconfig.js +0 -280
- package/extensions/dm-lens/dist/clients/shared-checkout-guard.js +0 -177
- package/extensions/dm-lens/dist/clients/single-flight.js +0 -52
- package/extensions/dm-lens/dist/clients/situational-tool-telemetry.js +0 -85
- package/extensions/dm-lens/dist/clients/skills-resolver.js +0 -38
- package/extensions/dm-lens/dist/clients/slow-fs.js +0 -77
- package/extensions/dm-lens/dist/clients/smells-rollup.js +0 -118
- package/extensions/dm-lens/dist/clients/source-filter.js +0 -320
- package/extensions/dm-lens/dist/clients/source-walker.js +0 -96
- package/extensions/dm-lens/dist/clients/spawn-output-cap.js +0 -35
- package/extensions/dm-lens/dist/clients/spawn-timeout-cooldown.js +0 -51
- package/extensions/dm-lens/dist/clients/stale-marker.js +0 -1
- package/extensions/dm-lens/dist/clients/startup-scan.js +0 -222
- package/extensions/dm-lens/dist/clients/startup-timing.js +0 -67
- package/extensions/dm-lens/dist/clients/string-utils.js +0 -6
- package/extensions/dm-lens/dist/clients/subagent-mode.js +0 -40
- package/extensions/dm-lens/dist/clients/symbol-containment.js +0 -16
- package/extensions/dm-lens/dist/clients/symbol-types.js +0 -1
- package/extensions/dm-lens/dist/clients/test-runner-client.js +0 -1504
- package/extensions/dm-lens/dist/clients/test-runner-delivery.js +0 -260
- package/extensions/dm-lens/dist/clients/todo-scanner.js +0 -164
- package/extensions/dm-lens/dist/clients/tool-agreement.js +0 -377
- package/extensions/dm-lens/dist/clients/tool-config.js +0 -218
- package/extensions/dm-lens/dist/clients/tool-cwd.js +0 -235
- package/extensions/dm-lens/dist/clients/tool-definition.js +0 -22
- package/extensions/dm-lens/dist/clients/tool-event.js +0 -18
- package/extensions/dm-lens/dist/clients/tool-policy.js +0 -2393
- package/extensions/dm-lens/dist/clients/tool-probe.js +0 -5
- package/extensions/dm-lens/dist/clients/tool-render.js +0 -79
- package/extensions/dm-lens/dist/clients/tool-set-policy.js +0 -70
- package/extensions/dm-lens/dist/clients/tree-sitter-cache.js +0 -206
- package/extensions/dm-lens/dist/clients/tree-sitter-client.js +0 -2787
- package/extensions/dm-lens/dist/clients/tree-sitter-logger.js +0 -77
- package/extensions/dm-lens/dist/clients/tree-sitter-navigator.js +0 -198
- package/extensions/dm-lens/dist/clients/tree-sitter-query-loader.js +0 -318
- package/extensions/dm-lens/dist/clients/tree-sitter-shared.js +0 -87
- package/extensions/dm-lens/dist/clients/tree-sitter-symbol-extractor.js +0 -957
- package/extensions/dm-lens/dist/clients/trivy-client.js +0 -305
- package/extensions/dm-lens/dist/clients/tui-fit.js +0 -26
- package/extensions/dm-lens/dist/clients/turn-context.js +0 -48
- package/extensions/dm-lens/dist/clients/turn-end/lane.js +0 -1
- package/extensions/dm-lens/dist/clients/turn-end/lanes/govulncheck.js +0 -54
- package/extensions/dm-lens/dist/clients/turn-end/lanes/secrets.js +0 -131
- package/extensions/dm-lens/dist/clients/turn-summary-render.js +0 -56
- package/extensions/dm-lens/dist/clients/turn-summary.js +0 -84
- package/extensions/dm-lens/dist/clients/typos-config.js +0 -9
- package/extensions/dm-lens/dist/clients/user-notify.js +0 -15
- package/extensions/dm-lens/dist/clients/vanished-instance-marker.js +0 -18
- package/extensions/dm-lens/dist/clients/warm-attach.js +0 -210
- package/extensions/dm-lens/dist/clients/widget-state.js +0 -963
- package/extensions/dm-lens/dist/clients/word-index-logger.js +0 -21
- package/extensions/dm-lens/dist/clients/word-index-store.js +0 -222
- package/extensions/dm-lens/dist/clients/word-index.js +0 -1426
- package/extensions/dm-lens/dist/clients/workspace-topology.js +0 -261
- package/extensions/dm-lens/dist/clients/write-ordering-guard.js +0 -24
- package/extensions/dm-lens/dist/clients/zizmor-config.js +0 -160
- package/extensions/dm-lens/dist/i18n.js +0 -67
- package/extensions/dm-lens/dist/index.js +0 -1782
- package/extensions/dm-lens/dist/mcp/analyze-cli.js +0 -178
- package/extensions/dm-lens/dist/mcp/build-staleness.js +0 -55
- package/extensions/dm-lens/dist/mcp/cli.js +0 -78
- package/extensions/dm-lens/dist/mcp/server.js +0 -1208
- package/extensions/dm-lens/dist/mcp/worker.js +0 -33
- package/extensions/dm-lens/dist/scripts/lib/process-scan.mjs +0 -256
- package/extensions/dm-lens/dist/scripts/lib/skills-predicate.mjs +0 -53
- package/extensions/dm-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +0 -45
- package/extensions/dm-lens/dist/tools/activate-tools.js +0 -61
- package/extensions/dm-lens/dist/tools/ast-grep-outline.js +0 -127
- package/extensions/dm-lens/dist/tools/ast-grep-replace.js +0 -226
- package/extensions/dm-lens/dist/tools/ast-grep-search.js +0 -687
- package/extensions/dm-lens/dist/tools/effective-config.js +0 -59
- package/extensions/dm-lens/dist/tools/lens-diagnostic-mark.js +0 -240
- package/extensions/dm-lens/dist/tools/lens-diagnostics.js +0 -1484
- package/extensions/dm-lens/dist/tools/lsp-diagnostics.js +0 -1088
- package/extensions/dm-lens/dist/tools/lsp-navigation.js +0 -1194
- package/extensions/dm-lens/dist/tools/lsp-structured-output.js +0 -277
- package/extensions/dm-lens/dist/tools/module-report.js +0 -332
- package/extensions/dm-lens/dist/tools/project-report.js +0 -72
- package/extensions/dm-lens/dist/tools/render-compact.js +0 -272
- package/extensions/dm-lens/dist/tools/scan-progress.js +0 -31
- package/extensions/dm-lens/dist/tools/shared.js +0 -26
- package/extensions/dm-lens/dist/tools/symbol-search.js +0 -133
- package/extensions/dm-mcp-adapter/dist/abort.js +0 -35
- package/extensions/dm-mcp-adapter/dist/agent-dir.js +0 -45
- package/extensions/dm-mcp-adapter/dist/agent-plugin-loader.js +0 -392
- package/extensions/dm-mcp-adapter/dist/agent-plugin-provenance.js +0 -26
- package/extensions/dm-mcp-adapter/dist/bearer-command-resolver.js +0 -182
- package/extensions/dm-mcp-adapter/dist/claude-plugin-loader.js +0 -350
- package/extensions/dm-mcp-adapter/dist/config.js +0 -1310
- package/extensions/dm-mcp-adapter/dist/consent-manager.js +0 -84
- package/extensions/dm-mcp-adapter/dist/elicitation-handler.js +0 -308
- package/extensions/dm-mcp-adapter/dist/errors.js +0 -225
- package/extensions/dm-mcp-adapter/dist/http-ca.js +0 -71
- package/extensions/dm-mcp-adapter/dist/jev-client.js +0 -359
- package/extensions/dm-mcp-adapter/dist/jev-contracts.js +0 -1
- package/extensions/dm-mcp-adapter/dist/jev-key-store.js +0 -176
- package/extensions/dm-mcp-adapter/dist/json-schema-validator.js +0 -70
- package/extensions/dm-mcp-adapter/dist/lifecycle.js +0 -387
- package/extensions/dm-mcp-adapter/dist/logger.js +0 -115
- package/extensions/dm-mcp-adapter/dist/mcp-auth-fetch.js +0 -86
- package/extensions/dm-mcp-adapter/dist/mcp-auth-flow.js +0 -949
- package/extensions/dm-mcp-adapter/dist/mcp-auth.js +0 -997
- package/extensions/dm-mcp-adapter/dist/mcp-bearer-store.js +0 -182
- package/extensions/dm-mcp-adapter/dist/mcp-callback-server.js +0 -381
- package/extensions/dm-mcp-adapter/dist/mcp-oauth-provider.js +0 -524
- package/extensions/dm-mcp-adapter/dist/mcp-probe.js +0 -151
- package/extensions/dm-mcp-adapter/dist/mcp-tasks.js +0 -300
- package/extensions/dm-mcp-adapter/dist/mcp-trace.js +0 -215
- package/extensions/dm-mcp-adapter/dist/metadata-cache.js +0 -267
- package/extensions/dm-mcp-adapter/dist/npx-resolver.js +0 -465
- package/extensions/dm-mcp-adapter/dist/package-mcp-loader.js +0 -135
- package/extensions/dm-mcp-adapter/dist/request-headers-command.js +0 -294
- package/extensions/dm-mcp-adapter/dist/resource-tools.js +0 -7
- package/extensions/dm-mcp-adapter/dist/runtime-owner.js +0 -94
- package/extensions/dm-mcp-adapter/dist/sampling-handler.js +0 -213
- package/extensions/dm-mcp-adapter/dist/secure-keyring.js +0 -191
- package/extensions/dm-mcp-adapter/dist/server-manager.js +0 -1514
- package/extensions/dm-mcp-adapter/dist/session-approvals.js +0 -127
- package/extensions/dm-mcp-adapter/dist/session-recovery.js +0 -82
- package/extensions/dm-mcp-adapter/dist/state.js +0 -1
- package/extensions/dm-mcp-adapter/dist/types.js +0 -286
- package/extensions/dm-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -36
- package/extensions/dm-mcp-adapter/dist/ui-resource-handler.js +0 -204
- package/extensions/dm-mcp-adapter/dist/ui-stream-types.js +0 -58
- package/extensions/dm-mcp-adapter/dist/ui-tool-visibility.js +0 -26
- package/extensions/dm-mcp-adapter/dist/unix-socket-transport.js +0 -83
- package/extensions/dm-mcp-adapter/dist/utils.js +0 -382
|
@@ -1,377 +0,0 @@
|
|
|
1
|
-
import { BoundedFifoMap } from "./bounded-cache.js";
|
|
2
|
-
import { resolveHashlineAnchor } from "./hashline-anchor.js";
|
|
3
|
-
import { lookupLearnedMutatingTool } from "./mutation-attribution.js";
|
|
4
|
-
import { boundedIndexesForCount, createReadGuardEditBatchSummary, logReadGuardEvent } from "./read-guard-logger.js";
|
|
5
|
-
const BUILTIN_MUTATING_TOOLS = new Map([
|
|
6
|
-
["write", "write"],
|
|
7
|
-
["edit", "edit"]
|
|
8
|
-
]);
|
|
9
|
-
const BLOCKED_MARKER = "\uD83D\uDD34 BLOCKED —";
|
|
10
|
-
export function isMutatingToolName(toolName) {
|
|
11
|
-
return BUILTIN_MUTATING_TOOLS.has(toolName);
|
|
12
|
-
}
|
|
13
|
-
export function getBuiltinMutatingToolNames() {
|
|
14
|
-
return [...BUILTIN_MUTATING_TOOLS.keys()];
|
|
15
|
-
}
|
|
16
|
-
function asRecord(value) {
|
|
17
|
-
return value !== null && typeof value === "object" ? value : {};
|
|
18
|
-
}
|
|
19
|
-
function resolveMutationPath(input) {
|
|
20
|
-
for (const key of ["path", "filePath", "file_path"]) {
|
|
21
|
-
const value = input[key];
|
|
22
|
-
if (typeof value === "string" && value.length > 0)
|
|
23
|
-
return value;
|
|
24
|
-
}
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
export function readMutationPathField(event) {
|
|
28
|
-
return resolveMutationPath(asRecord(event?.input));
|
|
29
|
-
}
|
|
30
|
-
function parseHashlineAnchor(anchor) {
|
|
31
|
-
if (typeof anchor !== "string")
|
|
32
|
-
return;
|
|
33
|
-
const trimmed = anchor.trim();
|
|
34
|
-
const separator = trimmed.indexOf(":");
|
|
35
|
-
const lineText = separator === -1 ? trimmed : trimmed.slice(0, separator);
|
|
36
|
-
if (!/^\d+$/.test(lineText))
|
|
37
|
-
return;
|
|
38
|
-
const line = Number(lineText);
|
|
39
|
-
return Number.isInteger(line) && line > 0 ? line : undefined;
|
|
40
|
-
}
|
|
41
|
-
function combineRanges(ranges) {
|
|
42
|
-
const starts = ranges.map(([start]) => start);
|
|
43
|
-
const ends = ranges.map(([, end]) => end);
|
|
44
|
-
return {
|
|
45
|
-
touchedLines: [Math.min(...starts), Math.max(...ends)],
|
|
46
|
-
editRanges: ranges.length > 1 ? ranges : undefined
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function blockedByAdapter(args) {
|
|
50
|
-
const indexes = boundedIndexesForCount(args.operationCount);
|
|
51
|
-
const editBatchSummary = createReadGuardEditBatchSummary({
|
|
52
|
-
requestedIndexes: indexes,
|
|
53
|
-
requestedTotal: args.operationCount,
|
|
54
|
-
rejectedReasons: indexes.map((index) => ({
|
|
55
|
-
index,
|
|
56
|
-
code: "preflight_blocked"
|
|
57
|
-
})),
|
|
58
|
-
rejectedTotal: args.operationCount,
|
|
59
|
-
durationMs: 0,
|
|
60
|
-
terminalStatus: "blocked"
|
|
61
|
-
});
|
|
62
|
-
if (args.ctx.filePath && !args.ctx.recognizeOnly) {
|
|
63
|
-
logReadGuardEvent({
|
|
64
|
-
event: "edit_preflight_blocked",
|
|
65
|
-
correlationId: args.ctx.correlationId,
|
|
66
|
-
sessionId: args.ctx.sessionId,
|
|
67
|
-
filePath: args.ctx.filePath,
|
|
68
|
-
metadata: {
|
|
69
|
-
tool: "edit",
|
|
70
|
-
source: args.adapterSource,
|
|
71
|
-
reasonKind: args.reasonKind,
|
|
72
|
-
operationCount: args.operationCount,
|
|
73
|
-
errorCount: args.errors.length,
|
|
74
|
-
errors: args.errors.slice(0, 10)
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
logReadGuardEvent({
|
|
78
|
-
event: "edit_batch_summary",
|
|
79
|
-
correlationId: args.ctx.correlationId,
|
|
80
|
-
filePath: args.ctx.filePath,
|
|
81
|
-
metadata: { tool: "edit", editBatchSummary }
|
|
82
|
-
});
|
|
83
|
-
}
|
|
84
|
-
return {
|
|
85
|
-
touchedLines: undefined,
|
|
86
|
-
preflightError: `${BLOCKED_MARKER} ${args.title}
|
|
87
|
-
|
|
88
|
-
${args.errors.join(`
|
|
89
|
-
`)}
|
|
90
|
-
|
|
91
|
-
${args.retryHint}`,
|
|
92
|
-
editBatchSummary
|
|
93
|
-
};
|
|
94
|
-
}
|
|
95
|
-
function logTouchedLines(args) {
|
|
96
|
-
if (!args.ctx.filePath || args.ctx.recognizeOnly)
|
|
97
|
-
return;
|
|
98
|
-
logReadGuardEvent({
|
|
99
|
-
event: "touched_lines_detected",
|
|
100
|
-
correlationId: args.ctx.correlationId,
|
|
101
|
-
sessionId: args.ctx.sessionId,
|
|
102
|
-
filePath: args.ctx.filePath,
|
|
103
|
-
metadata: {
|
|
104
|
-
tool: "edit",
|
|
105
|
-
source: args.adapterSource,
|
|
106
|
-
touchedLines: args.result.touchedLines,
|
|
107
|
-
editRanges: args.result.editRanges,
|
|
108
|
-
operationCount: args.operationCount,
|
|
109
|
-
...args.extra
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
function isHashlineOperation(value) {
|
|
114
|
-
const op = asRecord(value);
|
|
115
|
-
return op.set_line !== undefined || op.replace_lines !== undefined || op.replace_symbol !== undefined;
|
|
116
|
-
}
|
|
117
|
-
function getHashlineOperations(input) {
|
|
118
|
-
const operations = Array.isArray(input.operations) ? input.operations : Array.isArray(input.ops) ? input.ops : isHashlineOperation(input) ? [input] : undefined;
|
|
119
|
-
if (operations === undefined || operations.length === 0)
|
|
120
|
-
return;
|
|
121
|
-
return operations.some(isHashlineOperation) ? operations : undefined;
|
|
122
|
-
}
|
|
123
|
-
const hashlineReadmapAdapter = (input, ctx) => {
|
|
124
|
-
const operations = getHashlineOperations(input);
|
|
125
|
-
if (operations === undefined)
|
|
126
|
-
return;
|
|
127
|
-
const ranges = [];
|
|
128
|
-
const errors = [];
|
|
129
|
-
for (let index = 0;index < operations.length; index += 1) {
|
|
130
|
-
const op = asRecord(operations[index]);
|
|
131
|
-
if (op.set_line) {
|
|
132
|
-
const payload = asRecord(op.set_line);
|
|
133
|
-
const line = parseHashlineAnchor(payload.anchor);
|
|
134
|
-
if (!line) {
|
|
135
|
-
errors.push(`operation[${index}].set_line.anchor is malformed`);
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
138
|
-
ranges.push([line, line]);
|
|
139
|
-
continue;
|
|
140
|
-
}
|
|
141
|
-
if (op.replace_lines) {
|
|
142
|
-
const payload = asRecord(op.replace_lines);
|
|
143
|
-
const start = parseHashlineAnchor(payload.start_anchor);
|
|
144
|
-
const end = parseHashlineAnchor(payload.end_anchor);
|
|
145
|
-
if (!start || !end) {
|
|
146
|
-
errors.push(`operation[${index}].replace_lines anchors are malformed`);
|
|
147
|
-
continue;
|
|
148
|
-
}
|
|
149
|
-
if (start > end) {
|
|
150
|
-
errors.push(`operation[${index}].replace_lines range is inverted`);
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
ranges.push([start, end]);
|
|
154
|
-
continue;
|
|
155
|
-
}
|
|
156
|
-
if (op.replace_symbol) {
|
|
157
|
-
errors.push(`operation[${index}].replace_symbol cannot be resolved safely yet; use line anchors or a native ranged edit`);
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
errors.push(`operation[${index}] is not a recognized hashline edit`);
|
|
161
|
-
}
|
|
162
|
-
if (errors.length > 0) {
|
|
163
|
-
const target = ctx.filePath ? `\`${ctx.filePath}\`` : "the file";
|
|
164
|
-
return blockedByAdapter({
|
|
165
|
-
adapterSource: "hashline_edit",
|
|
166
|
-
reasonKind: "unsupported_hashline_edit_target",
|
|
167
|
-
title: "Unsupported hashline edit target",
|
|
168
|
-
errors,
|
|
169
|
-
operationCount: operations.length,
|
|
170
|
-
retryHint: `Re-read ${target} to get current #line anchors, then retry using set_line / replace_lines with those anchors — or use a native ranged edit.`,
|
|
171
|
-
ctx
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
if (ranges.length === 0)
|
|
175
|
-
return;
|
|
176
|
-
const result = combineRanges(ranges);
|
|
177
|
-
logTouchedLines({
|
|
178
|
-
adapterSource: ranges.length === 1 && ranges[0][0] === ranges[0][1] ? "hashline_set_line" : "hashline_replace_lines",
|
|
179
|
-
result,
|
|
180
|
-
operationCount: operations.length,
|
|
181
|
-
ctx
|
|
182
|
-
});
|
|
183
|
-
return result;
|
|
184
|
-
};
|
|
185
|
-
function isStringArray(value) {
|
|
186
|
-
return Array.isArray(value) && value.every((entry) => typeof entry === "string");
|
|
187
|
-
}
|
|
188
|
-
function readHashlineProReplace(input) {
|
|
189
|
-
if (typeof input.remove_from !== "string" || typeof input.remove_to !== "string" || !isStringArray(input.replacement_lines)) {
|
|
190
|
-
return;
|
|
191
|
-
}
|
|
192
|
-
return { removeFrom: input.remove_from, removeTo: input.remove_to };
|
|
193
|
-
}
|
|
194
|
-
function readHashlineProInsert(input) {
|
|
195
|
-
if (typeof input.anchor !== "string" || input.anchor.length === 0)
|
|
196
|
-
return;
|
|
197
|
-
if (input.direction !== "before" && input.direction !== "after")
|
|
198
|
-
return;
|
|
199
|
-
if (!isStringArray(input.lines))
|
|
200
|
-
return;
|
|
201
|
-
return { anchor: input.anchor, direction: input.direction };
|
|
202
|
-
}
|
|
203
|
-
function anchorUnresolved(field, failure) {
|
|
204
|
-
return `${field}:${failure}`;
|
|
205
|
-
}
|
|
206
|
-
const hashlineEditProAdapter = (input, ctx) => {
|
|
207
|
-
const replace = readHashlineProReplace(input);
|
|
208
|
-
if (replace) {
|
|
209
|
-
if (ctx.recognizeOnly || !ctx.filePath) {
|
|
210
|
-
return {
|
|
211
|
-
touchedLines: undefined,
|
|
212
|
-
unresolvedReason: ctx.recognizeOnly ? "replace:recognize_only" : "replace:no_file_path"
|
|
213
|
-
};
|
|
214
|
-
}
|
|
215
|
-
const from = resolveHashlineAnchor(ctx.filePath, replace.removeFrom);
|
|
216
|
-
const to = resolveHashlineAnchor(ctx.filePath, replace.removeTo);
|
|
217
|
-
if (from.line === undefined || to.line === undefined) {
|
|
218
|
-
return {
|
|
219
|
-
touchedLines: undefined,
|
|
220
|
-
unresolvedReason: from.line === undefined ? anchorUnresolved("remove_from", from.failure ?? "anchor_not_found") : anchorUnresolved("remove_to", to.failure ?? "anchor_not_found")
|
|
221
|
-
};
|
|
222
|
-
}
|
|
223
|
-
const result = combineRanges([
|
|
224
|
-
[Math.min(from.line, to.line), Math.max(from.line, to.line)]
|
|
225
|
-
]);
|
|
226
|
-
logTouchedLines({
|
|
227
|
-
adapterSource: "hashline_pro_replace",
|
|
228
|
-
result,
|
|
229
|
-
operationCount: 1,
|
|
230
|
-
ctx,
|
|
231
|
-
extra: {
|
|
232
|
-
anchors: [replace.removeFrom, replace.removeTo],
|
|
233
|
-
swapped: from.line > to.line
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
return result;
|
|
237
|
-
}
|
|
238
|
-
const insert = readHashlineProInsert(input);
|
|
239
|
-
if (insert) {
|
|
240
|
-
if (ctx.recognizeOnly || !ctx.filePath) {
|
|
241
|
-
return {
|
|
242
|
-
touchedLines: undefined,
|
|
243
|
-
unresolvedReason: ctx.recognizeOnly ? "insert:recognize_only" : "insert:no_file_path"
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
const anchor = resolveHashlineAnchor(ctx.filePath, insert.anchor);
|
|
247
|
-
if (anchor.line === undefined) {
|
|
248
|
-
return {
|
|
249
|
-
touchedLines: undefined,
|
|
250
|
-
unresolvedReason: anchorUnresolved("anchor", anchor.failure ?? "anchor_not_found")
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
const result = combineRanges([[anchor.line, anchor.line]]);
|
|
254
|
-
logTouchedLines({
|
|
255
|
-
adapterSource: "hashline_pro_insert",
|
|
256
|
-
result,
|
|
257
|
-
operationCount: 1,
|
|
258
|
-
ctx,
|
|
259
|
-
extra: { direction: insert.direction, anchors: [insert.anchor] }
|
|
260
|
-
});
|
|
261
|
-
return result;
|
|
262
|
-
}
|
|
263
|
-
return;
|
|
264
|
-
};
|
|
265
|
-
const RESOLVED_RANGE_CARRY_LIMIT = 64;
|
|
266
|
-
const RESOLVED_RANGE_CARRY = new BoundedFifoMap(RESOLVED_RANGE_CARRY_LIMIT);
|
|
267
|
-
function readToolCallId(event) {
|
|
268
|
-
const id = event?.toolCallId;
|
|
269
|
-
return typeof id === "string" && id.length > 0 ? id : undefined;
|
|
270
|
-
}
|
|
271
|
-
function carryResolvedRanges(event, result) {
|
|
272
|
-
const toolCallId = readToolCallId(event);
|
|
273
|
-
if (!toolCallId || result.touchedLines === undefined)
|
|
274
|
-
return;
|
|
275
|
-
RESOLVED_RANGE_CARRY.set(toolCallId, {
|
|
276
|
-
touchedLines: result.touchedLines,
|
|
277
|
-
editRanges: result.editRanges
|
|
278
|
-
});
|
|
279
|
-
}
|
|
280
|
-
function readCarriedRanges(event) {
|
|
281
|
-
const toolCallId = readToolCallId(event);
|
|
282
|
-
return toolCallId ? RESOLVED_RANGE_CARRY.get(toolCallId) : undefined;
|
|
283
|
-
}
|
|
284
|
-
export function _resetMutationRangeCarryForTests() {
|
|
285
|
-
RESOLVED_RANGE_CARRY.clear();
|
|
286
|
-
}
|
|
287
|
-
export function _carryResolvedRangesForTests(toolCallId, touchedLines) {
|
|
288
|
-
carryResolvedRanges({ toolCallId }, { touchedLines, editRanges: undefined });
|
|
289
|
-
}
|
|
290
|
-
export function _hasCarriedRangeForTests(toolCallId) {
|
|
291
|
-
return readCarriedRanges({ toolCallId }) !== undefined;
|
|
292
|
-
}
|
|
293
|
-
export const RESOLVED_RANGE_CARRY_LIMIT_FOR_TESTS = RESOLVED_RANGE_CARRY_LIMIT;
|
|
294
|
-
export const MUTATION_SHAPE_ADAPTERS = [
|
|
295
|
-
{ name: "hashline-readmap", kind: "edit", resolve: hashlineReadmapAdapter },
|
|
296
|
-
{ name: "hashline-edit-pro", kind: "edit", resolve: hashlineEditProAdapter }
|
|
297
|
-
];
|
|
298
|
-
function readToolName(event) {
|
|
299
|
-
const name = event?.toolName;
|
|
300
|
-
return typeof name === "string" && name.length > 0 ? name : undefined;
|
|
301
|
-
}
|
|
302
|
-
export const DM_LENS_SYNTHETIC_MUTATION_FIELD = "piLensSyntheticMutation";
|
|
303
|
-
export function classifyMutatingTool(event, ctx = {}) {
|
|
304
|
-
const toolName = readToolName(event);
|
|
305
|
-
if (toolName === undefined)
|
|
306
|
-
return;
|
|
307
|
-
const input = asRecord(event.input);
|
|
308
|
-
const builtinKind = BUILTIN_MUTATING_TOOLS.get(toolName);
|
|
309
|
-
const syntheticSource = event[DM_LENS_SYNTHETIC_MUTATION_FIELD];
|
|
310
|
-
const builtinProvenance = syntheticSource === "bash" ? "bash-derived" : "builtin";
|
|
311
|
-
if (builtinKind === "write") {
|
|
312
|
-
return {
|
|
313
|
-
toolName,
|
|
314
|
-
path: resolveMutationPath(input),
|
|
315
|
-
kind: "write",
|
|
316
|
-
provenance: builtinProvenance
|
|
317
|
-
};
|
|
318
|
-
}
|
|
319
|
-
for (const adapter of MUTATION_SHAPE_ADAPTERS) {
|
|
320
|
-
let resolved = adapter.resolve(input, ctx);
|
|
321
|
-
if (resolved === undefined)
|
|
322
|
-
continue;
|
|
323
|
-
if (resolved.touchedLines !== undefined) {
|
|
324
|
-
carryResolvedRanges(event, resolved);
|
|
325
|
-
} else if (!resolved.preflightError) {
|
|
326
|
-
const carried = readCarriedRanges(event);
|
|
327
|
-
if (carried)
|
|
328
|
-
resolved = { ...resolved, ...carried, unresolvedReason: undefined };
|
|
329
|
-
}
|
|
330
|
-
return {
|
|
331
|
-
toolName,
|
|
332
|
-
path: resolveMutationPath(input),
|
|
333
|
-
kind: adapter.kind,
|
|
334
|
-
touchedLines: resolved.touchedLines,
|
|
335
|
-
editRanges: resolved.editRanges,
|
|
336
|
-
preflightError: resolved.preflightError,
|
|
337
|
-
editBatchSummary: resolved.editBatchSummary,
|
|
338
|
-
unresolvedReason: resolved.unresolvedReason,
|
|
339
|
-
provenance: builtinKind !== undefined ? builtinProvenance : "declared",
|
|
340
|
-
source: adapter.name
|
|
341
|
-
};
|
|
342
|
-
}
|
|
343
|
-
if (builtinKind !== undefined) {
|
|
344
|
-
return {
|
|
345
|
-
toolName,
|
|
346
|
-
path: resolveMutationPath(input),
|
|
347
|
-
kind: builtinKind,
|
|
348
|
-
provenance: builtinProvenance
|
|
349
|
-
};
|
|
350
|
-
}
|
|
351
|
-
const learnedPath = resolveMutationPath(input);
|
|
352
|
-
if (learnedPath !== undefined) {
|
|
353
|
-
const learned = lookupLearnedMutatingTool(toolName);
|
|
354
|
-
if (learned !== undefined) {
|
|
355
|
-
return {
|
|
356
|
-
toolName,
|
|
357
|
-
path: learnedPath,
|
|
358
|
-
kind: "edit",
|
|
359
|
-
provenance: "learned",
|
|
360
|
-
source: `attribution:${learned}`
|
|
361
|
-
};
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
export function classifyBridgeMutation(entry) {
|
|
367
|
-
const provenance = entry.provenance === "observed" || entry.provenance === "settled-sweep" ? entry.provenance : "bridge";
|
|
368
|
-
return {
|
|
369
|
-
toolName: entry.consumer ?? "unknown",
|
|
370
|
-
path: entry.filePath,
|
|
371
|
-
kind: entry.kind,
|
|
372
|
-
touchedLines: entry.touchedLines,
|
|
373
|
-
editRanges: entry.editRanges,
|
|
374
|
-
provenance,
|
|
375
|
-
source: provenance === "bridge" ? "mutation-bridge" : "observed-mutation"
|
|
376
|
-
};
|
|
377
|
-
}
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import { writeFileAtomic } from "./atomic-write.js";
|
|
4
|
-
import { recordDegradationOnce } from "./degradation-ledger.js";
|
|
5
|
-
import { BoundedFifoMap } from "./bounded-cache.js";
|
|
6
|
-
import { getProjectDataDir } from "./file-utils.js";
|
|
7
|
-
import { getProcessSingleton } from "./process-singletons.js";
|
|
8
|
-
const MUTATION_ATTRIBUTION_FILE_VERSION = 1;
|
|
9
|
-
export const MUTATION_ATTRIBUTION_FILE = "observed-mutating-tools.json";
|
|
10
|
-
const PERSIST_AFTER_OBSERVATIONS = 2;
|
|
11
|
-
export const CLEAN_OBSERVATION_ARM_LIMIT = 2;
|
|
12
|
-
export const DEATTRIBUTE_AFTER_CLEAN_OBSERVATIONS = 3;
|
|
13
|
-
const MUTATION_ATTRIBUTION_MAX_TOOLS = 64;
|
|
14
|
-
const ATTRIBUTION_FAMILY = "mutation-attribution";
|
|
15
|
-
const ATTRIBUTION_VERSION = 2;
|
|
16
|
-
function state() {
|
|
17
|
-
return getProcessSingleton(ATTRIBUTION_FAMILY, ATTRIBUTION_VERSION, () => ({
|
|
18
|
-
session: new BoundedFifoMap(MUTATION_ATTRIBUTION_MAX_TOOLS),
|
|
19
|
-
fromDisk: undefined,
|
|
20
|
-
primedCwd: undefined
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
function observationFor(toolName) {
|
|
24
|
-
const current = state().session.get(toolName);
|
|
25
|
-
if (current)
|
|
26
|
-
return current;
|
|
27
|
-
const created = {
|
|
28
|
-
mutating: 0,
|
|
29
|
-
clean: 0,
|
|
30
|
-
cleanRun: 0,
|
|
31
|
-
unverifiable: 0,
|
|
32
|
-
persisted: false
|
|
33
|
-
};
|
|
34
|
-
state().session.set(toolName, created);
|
|
35
|
-
return created;
|
|
36
|
-
}
|
|
37
|
-
function attributionFilePath(cwd) {
|
|
38
|
-
return path.join(getProjectDataDir(cwd), MUTATION_ATTRIBUTION_FILE);
|
|
39
|
-
}
|
|
40
|
-
function isPersistedEntry(entry) {
|
|
41
|
-
const candidate = entry;
|
|
42
|
-
return typeof candidate?.name === "string" && candidate.name.length > 0 && typeof candidate.observations === "number";
|
|
43
|
-
}
|
|
44
|
-
function readPersisted(cwd) {
|
|
45
|
-
try {
|
|
46
|
-
const raw = fs.readFileSync(attributionFilePath(cwd), "utf-8");
|
|
47
|
-
const parsed = JSON.parse(raw);
|
|
48
|
-
if (parsed?.version !== MUTATION_ATTRIBUTION_FILE_VERSION)
|
|
49
|
-
return;
|
|
50
|
-
if (!Array.isArray(parsed.tools))
|
|
51
|
-
return;
|
|
52
|
-
return {
|
|
53
|
-
version: MUTATION_ATTRIBUTION_FILE_VERSION,
|
|
54
|
-
tools: parsed.tools.filter(isPersistedEntry).slice(0, MUTATION_ATTRIBUTION_MAX_TOOLS).map((entry) => ({
|
|
55
|
-
name: entry.name,
|
|
56
|
-
observations: entry.observations,
|
|
57
|
-
lastSeen: typeof entry.lastSeen === "number" ? entry.lastSeen : 0
|
|
58
|
-
}))
|
|
59
|
-
};
|
|
60
|
-
} catch {
|
|
61
|
-
return;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
export function primePersistedMutationAttribution(cwd) {
|
|
65
|
-
const current = state();
|
|
66
|
-
current.primedCwd = cwd;
|
|
67
|
-
current.fromDisk = new Set;
|
|
68
|
-
if (!cwd)
|
|
69
|
-
return;
|
|
70
|
-
const file = readPersisted(cwd);
|
|
71
|
-
if (!file)
|
|
72
|
-
return;
|
|
73
|
-
for (const entry of file.tools)
|
|
74
|
-
current.fromDisk.add(entry.name);
|
|
75
|
-
}
|
|
76
|
-
export function lookupLearnedMutatingTool(toolName) {
|
|
77
|
-
const current = state();
|
|
78
|
-
if ((current.session.get(toolName)?.mutating ?? 0) > 0)
|
|
79
|
-
return "session";
|
|
80
|
-
return current.fromDisk?.has(toolName) === true ? "persisted" : undefined;
|
|
81
|
-
}
|
|
82
|
-
export function isProvisionalLearnedAttribution(toolName) {
|
|
83
|
-
const current = state();
|
|
84
|
-
if (current.fromDisk?.has(toolName) === true)
|
|
85
|
-
return false;
|
|
86
|
-
const observation = current.session.get(toolName);
|
|
87
|
-
if (!observation || observation.persisted)
|
|
88
|
-
return false;
|
|
89
|
-
return observation.mutating > 0 && observation.mutating < PERSIST_AFTER_OBSERVATIONS;
|
|
90
|
-
}
|
|
91
|
-
export function shouldArmObservationForTool(toolName) {
|
|
92
|
-
const observation = state().session.get(toolName);
|
|
93
|
-
if ((observation?.mutating ?? 0) > 0)
|
|
94
|
-
return isProvisionalLearnedAttribution(toolName);
|
|
95
|
-
if (state().fromDisk?.has(toolName) === true)
|
|
96
|
-
return false;
|
|
97
|
-
return (observation?.clean ?? 0) < CLEAN_OBSERVATION_ARM_LIMIT;
|
|
98
|
-
}
|
|
99
|
-
export function noteObservedMutation(toolName, cwd) {
|
|
100
|
-
const observation = observationFor(toolName);
|
|
101
|
-
observation.mutating += 1;
|
|
102
|
-
observation.clean = 0;
|
|
103
|
-
observation.cleanRun = 0;
|
|
104
|
-
recordDegradationOnce({
|
|
105
|
-
kind: "unclassified-mutating-tool",
|
|
106
|
-
subject: toolName,
|
|
107
|
-
reason: "tool mutated a tracked file but matched no built-in name and no mutation shape adapter; classified by disk observation (#2430)"
|
|
108
|
-
});
|
|
109
|
-
let persisted = false;
|
|
110
|
-
if (observation.mutating >= PERSIST_AFTER_OBSERVATIONS && !observation.persisted) {
|
|
111
|
-
persisted = persistAttribution(toolName, cwd, observation.mutating);
|
|
112
|
-
observation.persisted = persisted;
|
|
113
|
-
}
|
|
114
|
-
return { observations: observation.mutating, persisted };
|
|
115
|
-
}
|
|
116
|
-
export function noteObservedClean(toolName) {
|
|
117
|
-
const observation = observationFor(toolName);
|
|
118
|
-
observation.clean += 1;
|
|
119
|
-
observation.cleanRun += 1;
|
|
120
|
-
if (observation.mutating > 0 && !observation.persisted && observation.cleanRun >= DEATTRIBUTE_AFTER_CLEAN_OBSERVATIONS) {
|
|
121
|
-
observation.mutating = 0;
|
|
122
|
-
observation.clean = 0;
|
|
123
|
-
observation.cleanRun = 0;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export function noteObservedUnverifiable(toolName) {
|
|
127
|
-
const observation = observationFor(toolName);
|
|
128
|
-
observation.unverifiable += 1;
|
|
129
|
-
observation.cleanRun = 0;
|
|
130
|
-
}
|
|
131
|
-
function persistAttribution(toolName, cwd, observations) {
|
|
132
|
-
const root = cwd ?? state().primedCwd;
|
|
133
|
-
if (!root)
|
|
134
|
-
return false;
|
|
135
|
-
try {
|
|
136
|
-
const existing = readPersisted(root) ?? {
|
|
137
|
-
version: MUTATION_ATTRIBUTION_FILE_VERSION,
|
|
138
|
-
tools: []
|
|
139
|
-
};
|
|
140
|
-
const tools = existing.tools.filter((entry) => entry.name !== toolName);
|
|
141
|
-
tools.push({ name: toolName, observations, lastSeen: Date.now() });
|
|
142
|
-
tools.sort((a, b) => a.lastSeen - b.lastSeen);
|
|
143
|
-
const bounded = tools.slice(-MUTATION_ATTRIBUTION_MAX_TOOLS);
|
|
144
|
-
const dir = getProjectDataDir(root);
|
|
145
|
-
fs.mkdirSync(dir, { recursive: true });
|
|
146
|
-
writeFileAtomic(path.join(dir, MUTATION_ATTRIBUTION_FILE), JSON.stringify({
|
|
147
|
-
version: MUTATION_ATTRIBUTION_FILE_VERSION,
|
|
148
|
-
tools: bounded
|
|
149
|
-
}));
|
|
150
|
-
state().fromDisk?.add(toolName);
|
|
151
|
-
return true;
|
|
152
|
-
} catch {
|
|
153
|
-
return false;
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
export function resetMutationAttribution() {
|
|
157
|
-
const current = state();
|
|
158
|
-
current.session.clear();
|
|
159
|
-
current.fromDisk = undefined;
|
|
160
|
-
current.primedCwd = undefined;
|
|
161
|
-
}
|
|
162
|
-
export function _mutationAttributionSnapshotForTests() {
|
|
163
|
-
const current = state();
|
|
164
|
-
return {
|
|
165
|
-
session: current.session.entriesArray().map(([name, obs]) => [name, { ...obs }]),
|
|
166
|
-
fromDisk: current.fromDisk ? [...current.fromDisk] : undefined
|
|
167
|
-
};
|
|
168
|
-
}
|
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { classifyBridgeMutation } from "./mutating-tool.js";
|
|
2
|
-
import { noteMutationHandled } from "./observed-mutation.js";
|
|
3
|
-
import { getProcessBridge, registerProcessBridge } from "./process-bridge.js";
|
|
4
|
-
export const MUTATION_BRIDGE_KEY = Symbol.for("dm-lens:mutation-bridge");
|
|
5
|
-
function isValidRange(value) {
|
|
6
|
-
if (!Array.isArray(value) || value.length !== 2)
|
|
7
|
-
return false;
|
|
8
|
-
const [start, end] = value;
|
|
9
|
-
return typeof start === "number" && typeof end === "number" && Number.isInteger(start) && Number.isInteger(end) && start >= 1 && end >= start;
|
|
10
|
-
}
|
|
11
|
-
export function isValidMutationEntry(entry) {
|
|
12
|
-
if (typeof entry !== "object" || entry === null)
|
|
13
|
-
return false;
|
|
14
|
-
const e = entry;
|
|
15
|
-
if (typeof e["filePath"] !== "string" || e["filePath"] === "")
|
|
16
|
-
return false;
|
|
17
|
-
const kind = e["kind"];
|
|
18
|
-
if (kind !== "write" && kind !== "edit")
|
|
19
|
-
return false;
|
|
20
|
-
if (e["touchedLines"] !== undefined && !isValidRange(e["touchedLines"]))
|
|
21
|
-
return false;
|
|
22
|
-
const editRanges = e["editRanges"];
|
|
23
|
-
if (editRanges !== undefined) {
|
|
24
|
-
if (!Array.isArray(editRanges) || editRanges.length === 0)
|
|
25
|
-
return false;
|
|
26
|
-
if (!editRanges.every(isValidRange))
|
|
27
|
-
return false;
|
|
28
|
-
}
|
|
29
|
-
if (e["consumer"] !== undefined && typeof e["consumer"] !== "string")
|
|
30
|
-
return false;
|
|
31
|
-
if (e["importsChanged"] !== undefined && typeof e["importsChanged"] !== "boolean")
|
|
32
|
-
return false;
|
|
33
|
-
if (e["deferAutofix"] !== undefined && typeof e["deferAutofix"] !== "boolean")
|
|
34
|
-
return false;
|
|
35
|
-
const provenance = e["provenance"];
|
|
36
|
-
if (provenance !== undefined && provenance !== "observed" && provenance !== "settled-sweep")
|
|
37
|
-
return false;
|
|
38
|
-
return true;
|
|
39
|
-
}
|
|
40
|
-
function resolveChangedRange(classification, deps, filePath) {
|
|
41
|
-
if (classification.touchedLines) {
|
|
42
|
-
const [start, end] = classification.touchedLines;
|
|
43
|
-
return { start, end };
|
|
44
|
-
}
|
|
45
|
-
if (classification.editRanges && classification.editRanges.length > 0) {
|
|
46
|
-
const starts = classification.editRanges.map(([start]) => start);
|
|
47
|
-
const ends = classification.editRanges.map(([, end]) => end);
|
|
48
|
-
return { start: Math.min(...starts), end: Math.max(...ends) };
|
|
49
|
-
}
|
|
50
|
-
return { start: 1, end: Math.max(1, deps.countFileLines(filePath)) };
|
|
51
|
-
}
|
|
52
|
-
export function recordMutationThroughSeam(entry, deps) {
|
|
53
|
-
if (!isValidMutationEntry(entry)) {
|
|
54
|
-
deps.dbg?.("mutation_bridge: dropped malformed entry");
|
|
55
|
-
return false;
|
|
56
|
-
}
|
|
57
|
-
if (!deps.isRecordable(entry.filePath)) {
|
|
58
|
-
deps.dbg?.(`mutation_bridge: out of scope ${entry.filePath}`);
|
|
59
|
-
return false;
|
|
60
|
-
}
|
|
61
|
-
const classification = classifyBridgeMutation(entry);
|
|
62
|
-
const filePath = entry.filePath;
|
|
63
|
-
const runtime = deps.getRuntime();
|
|
64
|
-
const projectRoot = deps.getProjectRoot();
|
|
65
|
-
const dispatchCwd = deps.getDispatchCwd(filePath);
|
|
66
|
-
try {
|
|
67
|
-
if (deps.shouldStampReadGuard?.() ?? true) {
|
|
68
|
-
runtime.readGuard?.recordWritten?.(filePath);
|
|
69
|
-
}
|
|
70
|
-
const changedRange = resolveChangedRange(classification, deps, filePath);
|
|
71
|
-
deps.getCacheManager().addModifiedRange?.(filePath, changedRange, entry.importsChanged ?? false, projectRoot, runtime.telemetrySessionId);
|
|
72
|
-
runtime.recordProjectMutation?.({
|
|
73
|
-
filePath,
|
|
74
|
-
source: `agent-tool:${classification.toolName}`,
|
|
75
|
-
cwd: projectRoot,
|
|
76
|
-
changedRange,
|
|
77
|
-
onAppendError: (err) => deps.dbg?.(`mutation_bridge: change log append failed: ${err}`)
|
|
78
|
-
});
|
|
79
|
-
noteMutationHandled(filePath);
|
|
80
|
-
if (entry.deferAutofix !== false) {
|
|
81
|
-
for (const kind of ["autofix", "format"]) {
|
|
82
|
-
runtime.deferMutation?.(filePath, dispatchCwd, classification.toolName, projectRoot, kind, runtime.telemetrySessionId, projectRoot);
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
} catch (err) {
|
|
86
|
-
deps.dbg?.(`mutation_bridge: recording failed for ${filePath}: ${err}`);
|
|
87
|
-
return false;
|
|
88
|
-
}
|
|
89
|
-
return true;
|
|
90
|
-
}
|
|
91
|
-
export function registerMutationBridge(deps) {
|
|
92
|
-
registerProcessBridge(MUTATION_BRIDGE_KEY, () => ({
|
|
93
|
-
version: 1,
|
|
94
|
-
recordMutation(entry) {
|
|
95
|
-
return recordMutationThroughSeam(entry, deps);
|
|
96
|
-
}
|
|
97
|
-
}));
|
|
98
|
-
}
|
|
99
|
-
export function getMutationBridge() {
|
|
100
|
-
const candidate = getProcessBridge(MUTATION_BRIDGE_KEY, 1);
|
|
101
|
-
return typeof candidate?.recordMutation === "function" ? candidate : undefined;
|
|
102
|
-
}
|