@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,963 +0,0 @@
|
|
|
1
|
-
import { readFileSync } from "node:fs";
|
|
2
|
-
import { stat } from "node:fs/promises";
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import { pathToFileURL } from "node:url";
|
|
5
|
-
import { BoundedFifoMap } from "./bounded-cache.js";
|
|
6
|
-
import { demotePastEofDiagnostics } from "./diagnostic-line-freshness.js";
|
|
7
|
-
import { visibleWidth } from "./deps/dm-tui-compat.js";
|
|
8
|
-
import { normalizeEphemeralMapKey, normalizeMapKey } from "./path-utils.js";
|
|
9
|
-
import { fitLine } from "./tui-fit.js";
|
|
10
|
-
import { WriteOrderingGuard } from "./write-ordering-guard.js";
|
|
11
|
-
import { collectForwardImportMtimes } from "./blocker-freshness.js";
|
|
12
|
-
import { normalizeMessage } from "./finding-identity.js";
|
|
13
|
-
import { freshnessFromMtime } from "./freshness.js";
|
|
14
|
-
import { PAST_EOF_STALE_MARKER } from "./diagnostic-line-freshness.js";
|
|
15
|
-
import { STALE_LINE_MARKER } from "./stale-marker.js";
|
|
16
|
-
import { anchorsForDiagnostic, applyDispositions, getDisposition, registerWidgetDispositionReconciler, strictAnchorSpan, strictAnchorSpansIn } from "./diagnostic-dispositions.js";
|
|
17
|
-
import { recordDegradationOnce } from "./degradation-ledger.js";
|
|
18
|
-
function fileMapKey(filePath) {
|
|
19
|
-
return normalizeEphemeralMapKey(filePath);
|
|
20
|
-
}
|
|
21
|
-
export function isBlocking(d) {
|
|
22
|
-
if (d.disposition)
|
|
23
|
-
return false;
|
|
24
|
-
if (d.stale)
|
|
25
|
-
return false;
|
|
26
|
-
if (d.semantic === "blocking")
|
|
27
|
-
return true;
|
|
28
|
-
if (d.semantic == null && d.severity === "error")
|
|
29
|
-
return true;
|
|
30
|
-
return false;
|
|
31
|
-
}
|
|
32
|
-
const files = new Map;
|
|
33
|
-
let sessionLanguages = [];
|
|
34
|
-
let requestRenderFn = null;
|
|
35
|
-
const diagnosticsWriteGuard = new WriteOrderingGuard;
|
|
36
|
-
const runnerWriteGuard = new WriteOrderingGuard;
|
|
37
|
-
const MAX_STORED_DIAGNOSTICS_PER_FILE = 12;
|
|
38
|
-
const MAX_RETAINED_SUPPRESSED_PER_FILE = 12;
|
|
39
|
-
const MAX_INACTIVE_FILE_RECORDS = 1024;
|
|
40
|
-
const ACTIVE_FILE_IDLE_MS = 30 * 60000;
|
|
41
|
-
export const MAX_LSP_SERVER_RECORDS = 128;
|
|
42
|
-
const lspServers = new BoundedFifoMap(MAX_LSP_SERVER_RECORDS);
|
|
43
|
-
let nextInactivePruneSize = MAX_INACTIVE_FILE_RECORDS + 1;
|
|
44
|
-
function pruneInactiveFileRecords(now = Date.now()) {
|
|
45
|
-
if (files.size <= MAX_INACTIVE_FILE_RECORDS)
|
|
46
|
-
return;
|
|
47
|
-
const victims = [...files.entries()].filter(([, rec]) => now - rec.touchedAt > ACTIVE_FILE_IDLE_MS && !hasLiveDiagnostic(rec)).sort(([, a], [, b]) => a.touchedAt - b.touchedAt);
|
|
48
|
-
for (const [key] of victims) {
|
|
49
|
-
if (files.size <= MAX_INACTIVE_FILE_RECORDS)
|
|
50
|
-
break;
|
|
51
|
-
files.delete(key);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
function maybePruneInactiveFileRecords() {
|
|
55
|
-
if (files.size < nextInactivePruneSize)
|
|
56
|
-
return;
|
|
57
|
-
pruneInactiveFileRecords();
|
|
58
|
-
nextInactivePruneSize = Number.POSITIVE_INFINITY;
|
|
59
|
-
}
|
|
60
|
-
export function setRenderCallback(fn) {
|
|
61
|
-
requestRenderFn = fn;
|
|
62
|
-
}
|
|
63
|
-
export function reconcileWidgetDisposition(cwd, target, _disposition, content) {
|
|
64
|
-
const current = getFileDiagnostics(target.filePath);
|
|
65
|
-
if (!current) {
|
|
66
|
-
recordDegradationOnce({
|
|
67
|
-
kind: "widget-disposition-reconcile-fallback",
|
|
68
|
-
subject: target.filePath,
|
|
69
|
-
reason: "the marked finding's widget record is absent"
|
|
70
|
-
});
|
|
71
|
-
return;
|
|
72
|
-
}
|
|
73
|
-
let source = content ?? target.content;
|
|
74
|
-
if (source === undefined) {
|
|
75
|
-
try {
|
|
76
|
-
source = readFileSync(target.filePath, "utf8");
|
|
77
|
-
} catch {
|
|
78
|
-
recordDegradationOnce({
|
|
79
|
-
kind: "widget-disposition-reconcile-fallback",
|
|
80
|
-
subject: target.filePath,
|
|
81
|
-
reason: "the disposition anchor content could not be read"
|
|
82
|
-
});
|
|
83
|
-
source = "";
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
const active = new Set(applyDispositions(current, cwd, target.filePath, source));
|
|
87
|
-
const normalized = current.flatMap((diagnostic) => {
|
|
88
|
-
const { strict, weak } = anchorsForDiagnostic(cwd, target.filePath, diagnostic, source);
|
|
89
|
-
const entry = getDisposition(cwd, strict) ?? getDisposition(cwd, weak);
|
|
90
|
-
if (!active.has(diagnostic) && (entry?.disposition === "false-positive" || entry?.disposition === "suppress")) {
|
|
91
|
-
const { anchorSpan: _previousSpan, ...base } = diagnostic;
|
|
92
|
-
const span = entry.disposition === "false-positive" ? strictAnchorSpan(source, diagnostic.line) : undefined;
|
|
93
|
-
return [
|
|
94
|
-
{
|
|
95
|
-
...base,
|
|
96
|
-
disposition: entry.disposition,
|
|
97
|
-
flagged: false,
|
|
98
|
-
...span === undefined ? {} : { anchorSpan: span }
|
|
99
|
-
}
|
|
100
|
-
];
|
|
101
|
-
}
|
|
102
|
-
if (diagnostic.suppressedRetained)
|
|
103
|
-
return [];
|
|
104
|
-
const {
|
|
105
|
-
disposition: _disposition,
|
|
106
|
-
flagged: _flagged,
|
|
107
|
-
anchorSpan: _anchorSpan,
|
|
108
|
-
...baseDiagnostic
|
|
109
|
-
} = diagnostic;
|
|
110
|
-
return entry?.disposition === "flagged" ? [{ ...baseDiagnostic, flagged: true }] : [baseDiagnostic];
|
|
111
|
-
});
|
|
112
|
-
const rec = getOrCreate(target.filePath);
|
|
113
|
-
const writeIndex = admitWidgetDiagnosticsWrite(target.filePath);
|
|
114
|
-
if (!diagnosticsWriteGuard.shouldWrite(fileMapKey(target.filePath), writeIndex))
|
|
115
|
-
return;
|
|
116
|
-
commitDiagnostics(rec, target.filePath, normalized, Date.now(), fileMapKey(target.filePath), false);
|
|
117
|
-
}
|
|
118
|
-
export function admitWidgetDiagnosticsWrite(filePath, writeIndex) {
|
|
119
|
-
const key = fileMapKey(filePath);
|
|
120
|
-
const token = writeIndex ?? diagnosticsWriteGuard.nextToken(key);
|
|
121
|
-
diagnosticsWriteGuard.shouldWrite(key, token);
|
|
122
|
-
runnerWriteGuard.shouldWrite(key, token);
|
|
123
|
-
return token;
|
|
124
|
-
}
|
|
125
|
-
registerWidgetDispositionReconciler((cwd, target, disposition) => reconcileWidgetDisposition(cwd, target, disposition, target.content));
|
|
126
|
-
export function wireWidgetDispositionSubscriber(args) {
|
|
127
|
-
args.events?.on?.("dmlens:diagnostic:disposition", (data) => {
|
|
128
|
-
if (!data || typeof data !== "object")
|
|
129
|
-
return;
|
|
130
|
-
const payload = data;
|
|
131
|
-
if (payload.source !== "dm-lens" || typeof payload.cwd !== "string")
|
|
132
|
-
return;
|
|
133
|
-
if (typeof payload.filePath !== "string" || typeof payload.disposition !== "string")
|
|
134
|
-
return;
|
|
135
|
-
if (typeof payload.message !== "string")
|
|
136
|
-
return;
|
|
137
|
-
if (!["false-positive", "suppress", "defer", "flagged"].includes(payload.disposition))
|
|
138
|
-
return;
|
|
139
|
-
reconcileWidgetDisposition(payload.cwd, {
|
|
140
|
-
cwd: payload.cwd,
|
|
141
|
-
filePath: payload.filePath,
|
|
142
|
-
message: typeof payload.message === "string" ? payload.message : "",
|
|
143
|
-
...typeof payload.tool === "string" ? { tool: payload.tool } : {},
|
|
144
|
-
...typeof payload.rule === "string" ? { rule: payload.rule } : {},
|
|
145
|
-
...typeof payload.line === "number" ? { line: payload.line } : {}
|
|
146
|
-
}, payload.disposition);
|
|
147
|
-
});
|
|
148
|
-
}
|
|
149
|
-
const renderedDependencyDriftFiles = new Set;
|
|
150
|
-
export function clearWidgetState() {
|
|
151
|
-
files.clear();
|
|
152
|
-
renderedDependencyDriftFiles.clear();
|
|
153
|
-
lspServers.clear();
|
|
154
|
-
sessionLanguages = [];
|
|
155
|
-
requestRenderFn = null;
|
|
156
|
-
diagnosticsWriteGuard.clear();
|
|
157
|
-
runnerWriteGuard.clear();
|
|
158
|
-
nextInactivePruneSize = MAX_INACTIVE_FILE_RECORDS + 1;
|
|
159
|
-
}
|
|
160
|
-
export const WIDGET_STATE_VERSION = 3;
|
|
161
|
-
export function exportWidgetState() {
|
|
162
|
-
return {
|
|
163
|
-
version: WIDGET_STATE_VERSION,
|
|
164
|
-
sessionLanguages: [...sessionLanguages],
|
|
165
|
-
files: [...files.values()].map((rec) => ({
|
|
166
|
-
filePath: rec.filePath,
|
|
167
|
-
runners: [...rec.runners.entries()],
|
|
168
|
-
formatters: [...rec.formatters.entries()],
|
|
169
|
-
diagnostics: rec.diagnostics,
|
|
170
|
-
allDiagnostics: rec.allDiagnostics,
|
|
171
|
-
diagnosticCounts: rec.diagnosticCounts,
|
|
172
|
-
hasFinalDiagnosticsSnapshot: rec.hasFinalDiagnosticsSnapshot,
|
|
173
|
-
touchedAt: rec.touchedAt
|
|
174
|
-
}))
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
function migrateEntryStamps(entries, recordTouchedAt) {
|
|
178
|
-
return (entries ?? []).map((d) => {
|
|
179
|
-
const { stale: _stale, staleDeliveryCount: _staleDeliveryCount, footerRetired: _footerRetired, staleReason: _staleReason, ...rest } = d;
|
|
180
|
-
return rest.observedAt == null ? { ...rest, observedAt: recordTouchedAt } : rest;
|
|
181
|
-
});
|
|
182
|
-
}
|
|
183
|
-
export function importWidgetState(state) {
|
|
184
|
-
if (!state || typeof state.version !== "number" || state.version < 1 || state.version > WIDGET_STATE_VERSION) {
|
|
185
|
-
return false;
|
|
186
|
-
}
|
|
187
|
-
files.clear();
|
|
188
|
-
diagnosticsWriteGuard.clear();
|
|
189
|
-
runnerWriteGuard.clear();
|
|
190
|
-
for (const f of state.files ?? []) {
|
|
191
|
-
const recordTouchedAt = f.touchedAt ?? Date.now();
|
|
192
|
-
const migratedAllDiagnostics = migrateEntryStamps(f.allDiagnostics, recordTouchedAt);
|
|
193
|
-
files.set(fileMapKey(f.filePath), {
|
|
194
|
-
filePath: f.filePath,
|
|
195
|
-
runners: new Map(f.runners ?? []),
|
|
196
|
-
formatters: new Map((f.formatters ?? []).filter(([, outcome]) => outcome?.success !== false)),
|
|
197
|
-
diagnostics: migrateEntryStamps(f.diagnostics, recordTouchedAt),
|
|
198
|
-
allDiagnostics: migratedAllDiagnostics,
|
|
199
|
-
diagnosticCounts: countDiagnostics(migratedAllDiagnostics),
|
|
200
|
-
hasFinalDiagnosticsSnapshot: f.hasFinalDiagnosticsSnapshot ?? false,
|
|
201
|
-
touchedAt: recordTouchedAt
|
|
202
|
-
});
|
|
203
|
-
}
|
|
204
|
-
pruneInactiveFileRecords();
|
|
205
|
-
sessionLanguages = state.sessionLanguages ?? [];
|
|
206
|
-
requestRenderFn?.();
|
|
207
|
-
return true;
|
|
208
|
-
}
|
|
209
|
-
export function setSessionLanguages(langs) {
|
|
210
|
-
sessionLanguages = langs;
|
|
211
|
-
requestRender();
|
|
212
|
-
}
|
|
213
|
-
export function getSessionLanguages() {
|
|
214
|
-
return [...sessionLanguages];
|
|
215
|
-
}
|
|
216
|
-
export function getFailedLspServerIds() {
|
|
217
|
-
const ids = [];
|
|
218
|
-
const seen = new Set;
|
|
219
|
-
for (const rec of lspServers.values()) {
|
|
220
|
-
if (rec.status !== "failed" || seen.has(rec.serverId))
|
|
221
|
-
continue;
|
|
222
|
-
seen.add(rec.serverId);
|
|
223
|
-
ids.push(rec.serverId);
|
|
224
|
-
}
|
|
225
|
-
return ids;
|
|
226
|
-
}
|
|
227
|
-
export function recordFormatter(filePath, formatter, changed, success, outcome) {
|
|
228
|
-
const rec = getOrCreate(filePath);
|
|
229
|
-
rec.formatters.set(formatter, { changed, success, outcome });
|
|
230
|
-
rec.touchedAt = Date.now();
|
|
231
|
-
files.set(fileMapKey(filePath), rec);
|
|
232
|
-
requestRender();
|
|
233
|
-
}
|
|
234
|
-
export function recordRunner(filePath, runnerId, status, diagnosticCount, durationMs, writeIndex) {
|
|
235
|
-
const key = fileMapKey(filePath);
|
|
236
|
-
if (!runnerWriteGuard.shouldWrite(key, writeIndex))
|
|
237
|
-
return;
|
|
238
|
-
diagnosticsWriteGuard.shouldWrite(key, writeIndex);
|
|
239
|
-
const rec = getOrCreate(filePath);
|
|
240
|
-
rec.runners.set(runnerId, { status, count: diagnosticCount, durationMs });
|
|
241
|
-
rec.hasFinalDiagnosticsSnapshot = false;
|
|
242
|
-
rec.touchedAt = Date.now();
|
|
243
|
-
files.set(fileMapKey(filePath), rec);
|
|
244
|
-
requestRender();
|
|
245
|
-
}
|
|
246
|
-
function toSingleLineMessage(message) {
|
|
247
|
-
return (message ?? "").replace(/\s+/g, " ").trim();
|
|
248
|
-
}
|
|
249
|
-
export function widgetDiagnosticUri(filePath, line, column) {
|
|
250
|
-
const base = pathToFileURL(filePath).href;
|
|
251
|
-
return line != null ? `${base}#L${line}${column != null ? `:${column}` : ""}` : base;
|
|
252
|
-
}
|
|
253
|
-
export function recordDiagnostics(filePath, diagnostics, writeIndex, observedAt) {
|
|
254
|
-
const key = fileMapKey(filePath);
|
|
255
|
-
if (!diagnosticsWriteGuard.shouldWrite(key, writeIndex))
|
|
256
|
-
return false;
|
|
257
|
-
runnerWriteGuard.shouldWrite(key, writeIndex);
|
|
258
|
-
const observedTs = observedAt ?? Date.now();
|
|
259
|
-
const rec = getOrCreate(filePath, key);
|
|
260
|
-
commitDiagnostics(rec, filePath, normalizeDiagnostics(filePath, diagnostics, observedTs), observedTs, key);
|
|
261
|
-
return true;
|
|
262
|
-
}
|
|
263
|
-
function normalizeDiagnostics(filePath, diagnostics, observedTs) {
|
|
264
|
-
return diagnostics.map((d) => {
|
|
265
|
-
const rule = d.rule ?? d.id;
|
|
266
|
-
return {
|
|
267
|
-
severity: d.severity ?? "info",
|
|
268
|
-
semantic: d.semantic,
|
|
269
|
-
message: toSingleLineMessage(d.message),
|
|
270
|
-
line: d.line,
|
|
271
|
-
col: d.column,
|
|
272
|
-
rule,
|
|
273
|
-
tool: d.tool,
|
|
274
|
-
uri: widgetDiagnosticUri(filePath, d.line, d.column),
|
|
275
|
-
observedAt: observedTs
|
|
276
|
-
};
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
function retentionIdentity(d) {
|
|
280
|
-
return JSON.stringify([
|
|
281
|
-
d.tool ?? "",
|
|
282
|
-
d.rule ?? "",
|
|
283
|
-
normalizeMessage(d.message)
|
|
284
|
-
]);
|
|
285
|
-
}
|
|
286
|
-
function readContentOrUndefined(filePath) {
|
|
287
|
-
try {
|
|
288
|
-
return readFileSync(filePath, "utf8");
|
|
289
|
-
} catch {
|
|
290
|
-
recordDegradationOnce({
|
|
291
|
-
kind: "widget-mark-anchor-unreadable",
|
|
292
|
-
subject: filePath,
|
|
293
|
-
reason: "the marked file could not be read, so its suppressed rows fall back to the file-mtime retirement gate and the footer chip may under-count it"
|
|
294
|
-
});
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
function readAnchorSpans(filePath) {
|
|
299
|
-
const content = readContentOrUndefined(filePath);
|
|
300
|
-
return content === undefined ? undefined : strictAnchorSpansIn(content);
|
|
301
|
-
}
|
|
302
|
-
function retainSuppressedRows(previous, incoming, filePath) {
|
|
303
|
-
const tagged = previous.filter((d) => d.disposition !== undefined);
|
|
304
|
-
if (tagged.length === 0)
|
|
305
|
-
return incoming;
|
|
306
|
-
const reported = new Map;
|
|
307
|
-
for (const d of incoming) {
|
|
308
|
-
const id = retentionIdentity(d);
|
|
309
|
-
const bucket = reported.get(id);
|
|
310
|
-
if (bucket)
|
|
311
|
-
bucket.push(d);
|
|
312
|
-
else
|
|
313
|
-
reported.set(id, [d]);
|
|
314
|
-
}
|
|
315
|
-
const content = tagged.some((d) => d.anchorSpan !== undefined && reported.has(retentionIdentity(d))) ? readContentOrUndefined(filePath) : undefined;
|
|
316
|
-
const spans = content === undefined ? undefined : strictAnchorSpansIn(content);
|
|
317
|
-
const retained = tagged.filter((d) => {
|
|
318
|
-
const collisions = reported.get(retentionIdentity(d));
|
|
319
|
-
if (collisions === undefined)
|
|
320
|
-
return true;
|
|
321
|
-
if (d.anchorSpan === undefined || spans === undefined)
|
|
322
|
-
return false;
|
|
323
|
-
if (!spans.has(d.anchorSpan))
|
|
324
|
-
return false;
|
|
325
|
-
return !collisions.some((i) => strictAnchorSpan(content, i.line) === d.anchorSpan);
|
|
326
|
-
});
|
|
327
|
-
if (retained.length > MAX_RETAINED_SUPPRESSED_PER_FILE) {
|
|
328
|
-
retained.sort((a, b) => (b.observedAt ?? 0) - (a.observedAt ?? 0));
|
|
329
|
-
recordDegradationOnce({
|
|
330
|
-
kind: "widget-suppressed-retention-capped",
|
|
331
|
-
subject: filePath,
|
|
332
|
-
reason: `${retained.length - MAX_RETAINED_SUPPRESSED_PER_FILE} suppressed row(s) beyond the ${MAX_RETAINED_SUPPRESSED_PER_FILE}-row per-file retention cap are no longer counted by the footer chip`
|
|
333
|
-
});
|
|
334
|
-
retained.length = MAX_RETAINED_SUPPRESSED_PER_FILE;
|
|
335
|
-
}
|
|
336
|
-
return [
|
|
337
|
-
...incoming,
|
|
338
|
-
...retained.map((d) => d.suppressedRetained ? d : { ...d, suppressedRetained: true })
|
|
339
|
-
];
|
|
340
|
-
}
|
|
341
|
-
function commitDiagnostics(rec, filePath, incoming, observedAt, key = fileMapKey(filePath), retainSuppressed = true) {
|
|
342
|
-
const normalized = retainSuppressed ? retainSuppressedRows(rec.allDiagnostics, incoming, filePath) : incoming;
|
|
343
|
-
rec.diagnosticCounts = countDiagnostics(normalized);
|
|
344
|
-
rec.diagnostics = capStoredDiagnostics(normalized);
|
|
345
|
-
rec.allDiagnostics = normalized;
|
|
346
|
-
rec.hasFinalDiagnosticsSnapshot = true;
|
|
347
|
-
rec.touchedAt = freshestObservation(normalized, observedAt ?? Date.now());
|
|
348
|
-
files.set(key, rec);
|
|
349
|
-
requestRender();
|
|
350
|
-
}
|
|
351
|
-
export function classifyDiagnosticTier(d) {
|
|
352
|
-
if (d.severity === "error")
|
|
353
|
-
return "error";
|
|
354
|
-
if (d.severity === "warning")
|
|
355
|
-
return "warning";
|
|
356
|
-
if (d.severity === "hint" || d.severity === "info")
|
|
357
|
-
return "advisory";
|
|
358
|
-
return;
|
|
359
|
-
}
|
|
360
|
-
function countDiagnostics(diags) {
|
|
361
|
-
let blocking = 0;
|
|
362
|
-
let errors = 0;
|
|
363
|
-
let warnings = 0;
|
|
364
|
-
for (const diagnostic of diags) {
|
|
365
|
-
if (diagnostic.disposition)
|
|
366
|
-
continue;
|
|
367
|
-
if (isBlocking(diagnostic))
|
|
368
|
-
blocking++;
|
|
369
|
-
if (diagnostic.stale && (diagnostic.staleReason ?? "past-eof") === "past-eof")
|
|
370
|
-
continue;
|
|
371
|
-
const tier = classifyDiagnosticTier(diagnostic);
|
|
372
|
-
if (tier === "error")
|
|
373
|
-
errors++;
|
|
374
|
-
else if (tier === "warning")
|
|
375
|
-
warnings++;
|
|
376
|
-
}
|
|
377
|
-
return { blocking, errors, warnings };
|
|
378
|
-
}
|
|
379
|
-
function countAdvisories(diags) {
|
|
380
|
-
let advisories = 0;
|
|
381
|
-
for (const diagnostic of diags) {
|
|
382
|
-
if (diagnostic.stale && (diagnostic.staleReason ?? "past-eof") === "past-eof")
|
|
383
|
-
continue;
|
|
384
|
-
if (classifyDiagnosticTier(diagnostic) === "advisory")
|
|
385
|
-
advisories++;
|
|
386
|
-
}
|
|
387
|
-
return advisories;
|
|
388
|
-
}
|
|
389
|
-
function applyPastEofGate(rec, lineCountCache) {
|
|
390
|
-
if (rec.allDiagnostics.length === 0)
|
|
391
|
-
return;
|
|
392
|
-
const { diagnostics } = demotePastEofDiagnostics({
|
|
393
|
-
store: "widget-state",
|
|
394
|
-
cwd: process.cwd(),
|
|
395
|
-
filePath: rec.filePath,
|
|
396
|
-
diagnostics: rec.allDiagnostics,
|
|
397
|
-
lineCountCache
|
|
398
|
-
});
|
|
399
|
-
rec.allDiagnostics = diagnostics;
|
|
400
|
-
rec.diagnostics = capStoredDiagnostics(diagnostics);
|
|
401
|
-
rec.diagnosticCounts = countDiagnostics(diagnostics);
|
|
402
|
-
}
|
|
403
|
-
function freshestObservation(diags, fallback) {
|
|
404
|
-
let newest;
|
|
405
|
-
for (const d of diags) {
|
|
406
|
-
if (d.observedAt != null && (newest === undefined || d.observedAt > newest)) {
|
|
407
|
-
newest = d.observedAt;
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
return newest ?? fallback;
|
|
411
|
-
}
|
|
412
|
-
function isLspErrorEntry(d) {
|
|
413
|
-
return d.tool === "lsp" && (d.semantic === "blocking" || d.severity === "error");
|
|
414
|
-
}
|
|
415
|
-
export function reconcileCascadeNeighborLspErrors(filePath, lspErrorDiagnostics, writeIndex, observedAt) {
|
|
416
|
-
const key = fileMapKey(filePath);
|
|
417
|
-
if (!diagnosticsWriteGuard.shouldWrite(key, writeIndex))
|
|
418
|
-
return;
|
|
419
|
-
runnerWriteGuard.shouldWrite(key, writeIndex);
|
|
420
|
-
const observedTs = observedAt ?? Date.now();
|
|
421
|
-
const rec = getOrCreate(filePath);
|
|
422
|
-
const incoming = normalizeDiagnostics(filePath, lspErrorDiagnostics, observedTs);
|
|
423
|
-
const preserved = rec.allDiagnostics.filter((d) => !isLspErrorEntry(d));
|
|
424
|
-
commitDiagnostics(rec, filePath, [...incoming, ...preserved], observedTs);
|
|
425
|
-
}
|
|
426
|
-
export function reconcileScanDiagnostics(filePath, diagnostics, confirmed, writeIndex, observedAt) {
|
|
427
|
-
if (!confirmed)
|
|
428
|
-
return false;
|
|
429
|
-
return recordDiagnostics(filePath, diagnostics, writeIndex, observedAt);
|
|
430
|
-
}
|
|
431
|
-
export function reconcileCorrelatedScanDiagnostics(filePath, diagnostics, writeIndex, observedAt) {
|
|
432
|
-
const key = fileMapKey(filePath);
|
|
433
|
-
if (!diagnosticsWriteGuard.shouldWrite(key, writeIndex))
|
|
434
|
-
return;
|
|
435
|
-
runnerWriteGuard.shouldWrite(key, writeIndex);
|
|
436
|
-
const observedTs = observedAt ?? Date.now();
|
|
437
|
-
const correlated = diagnostics.map((diagnostic) => ({
|
|
438
|
-
...diagnostic,
|
|
439
|
-
observedAt: diagnostic.observedAt ?? observedTs
|
|
440
|
-
}));
|
|
441
|
-
commitDiagnostics(getOrCreate(filePath, key), filePath, correlated, observedTs, key);
|
|
442
|
-
}
|
|
443
|
-
export async function reconcileStaleWidgetFiles() {
|
|
444
|
-
const entries = [...files.entries()];
|
|
445
|
-
const verdicts = await Promise.all(entries.map(async ([mapKey, rec]) => {
|
|
446
|
-
let mtimeMs;
|
|
447
|
-
try {
|
|
448
|
-
mtimeMs = (await stat(rec.filePath)).mtimeMs;
|
|
449
|
-
} catch {
|
|
450
|
-
return { mapKey, action: "drop" };
|
|
451
|
-
}
|
|
452
|
-
if (rec.allDiagnostics.length === 0) {
|
|
453
|
-
return freshnessFromMtime({ mtimeMs, referenceMs: rec.touchedAt }).verdict === "stale" ? { mapKey, action: "drop" } : { mapKey, action: "keep" };
|
|
454
|
-
}
|
|
455
|
-
const mtimeStale = (d) => freshnessFromMtime({
|
|
456
|
-
mtimeMs,
|
|
457
|
-
referenceMs: d.observedAt ?? rec.touchedAt
|
|
458
|
-
}).verdict === "stale";
|
|
459
|
-
const spans = rec.allDiagnostics.some((d) => d.anchorSpan !== undefined && mtimeStale(d)) ? readAnchorSpans(rec.filePath) : undefined;
|
|
460
|
-
const survivors = rec.allDiagnostics.filter((d) => d.anchorSpan !== undefined && spans !== undefined ? spans.has(d.anchorSpan) : !mtimeStale(d));
|
|
461
|
-
if (survivors.length === rec.allDiagnostics.length) {
|
|
462
|
-
return { mapKey, action: "keep" };
|
|
463
|
-
}
|
|
464
|
-
if (survivors.length === 0) {
|
|
465
|
-
return { mapKey, action: "drop" };
|
|
466
|
-
}
|
|
467
|
-
return { mapKey, action: "prune", survivors };
|
|
468
|
-
}));
|
|
469
|
-
let dropped = 0;
|
|
470
|
-
for (const v of verdicts) {
|
|
471
|
-
if (v.action === "keep")
|
|
472
|
-
continue;
|
|
473
|
-
if (v.action === "drop") {
|
|
474
|
-
files.delete(v.mapKey);
|
|
475
|
-
dropped += 1;
|
|
476
|
-
continue;
|
|
477
|
-
}
|
|
478
|
-
const rec = files.get(v.mapKey);
|
|
479
|
-
if (rec) {
|
|
480
|
-
rec.allDiagnostics = v.survivors;
|
|
481
|
-
rec.diagnostics = capStoredDiagnostics(v.survivors);
|
|
482
|
-
rec.diagnosticCounts = countDiagnostics(v.survivors);
|
|
483
|
-
}
|
|
484
|
-
dropped += 1;
|
|
485
|
-
}
|
|
486
|
-
if (dropped > 0)
|
|
487
|
-
requestRenderFn?.();
|
|
488
|
-
return dropped;
|
|
489
|
-
}
|
|
490
|
-
export async function reconcileStaleWidgetDependencyBlockers(cwd, turnIndex) {
|
|
491
|
-
let demoted = 0;
|
|
492
|
-
let truncatedImports = 0;
|
|
493
|
-
for (const [, rec] of files.entries()) {
|
|
494
|
-
if (!rec.allDiagnostics.some((d) => isBlocking(d) && d.tool === "lsp"))
|
|
495
|
-
continue;
|
|
496
|
-
let importMtimes = [];
|
|
497
|
-
try {
|
|
498
|
-
const result = await collectForwardImportMtimes(cwd, rec.filePath, undefined, turnIndex);
|
|
499
|
-
importMtimes = result.mtimes;
|
|
500
|
-
if (result.truncated)
|
|
501
|
-
truncatedImports += 1;
|
|
502
|
-
} catch {
|
|
503
|
-
importMtimes = [];
|
|
504
|
-
}
|
|
505
|
-
if (importMtimes.length === 0)
|
|
506
|
-
continue;
|
|
507
|
-
let changed = false;
|
|
508
|
-
for (const d of rec.allDiagnostics) {
|
|
509
|
-
if (!isBlocking(d) || d.tool !== "lsp")
|
|
510
|
-
continue;
|
|
511
|
-
const baseline = d.observedAt ?? rec.touchedAt;
|
|
512
|
-
if (importMtimes.some((im) => freshnessFromMtime({
|
|
513
|
-
mtimeMs: im.mtimeMs,
|
|
514
|
-
referenceMs: baseline
|
|
515
|
-
}).verdict === "stale")) {
|
|
516
|
-
d.stale = true;
|
|
517
|
-
d.staleReason = "dependency-drift";
|
|
518
|
-
changed = true;
|
|
519
|
-
demoted += 1;
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
if (changed) {
|
|
523
|
-
rec.diagnosticCounts = countDiagnostics(rec.allDiagnostics);
|
|
524
|
-
rec.diagnostics = capStoredDiagnostics(rec.allDiagnostics);
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
if (demoted > 0)
|
|
528
|
-
requestRenderFn?.();
|
|
529
|
-
return { demoted, truncatedImports };
|
|
530
|
-
}
|
|
531
|
-
export function getWidgetBlockingFilesForSweep() {
|
|
532
|
-
const out = [];
|
|
533
|
-
for (const rec of files.values()) {
|
|
534
|
-
let earliest;
|
|
535
|
-
for (const d of rec.allDiagnostics) {
|
|
536
|
-
if (!isBlocking(d) || d.tool !== "lsp")
|
|
537
|
-
continue;
|
|
538
|
-
const observedAt = d.observedAt ?? rec.touchedAt;
|
|
539
|
-
if (earliest === undefined || observedAt < earliest)
|
|
540
|
-
earliest = observedAt;
|
|
541
|
-
}
|
|
542
|
-
if (earliest !== undefined)
|
|
543
|
-
out.push({ filePath: rec.filePath, recordedAtMs: earliest });
|
|
544
|
-
}
|
|
545
|
-
return out;
|
|
546
|
-
}
|
|
547
|
-
export function markWidgetFileBlockersStale(filePath, reason) {
|
|
548
|
-
const rec = files.get(fileMapKey(filePath));
|
|
549
|
-
if (!rec)
|
|
550
|
-
return false;
|
|
551
|
-
let changed = false;
|
|
552
|
-
for (const d of rec.allDiagnostics) {
|
|
553
|
-
if (!isBlocking(d) || d.tool !== "lsp")
|
|
554
|
-
continue;
|
|
555
|
-
d.stale = true;
|
|
556
|
-
d.staleReason = reason;
|
|
557
|
-
changed = true;
|
|
558
|
-
}
|
|
559
|
-
if (changed) {
|
|
560
|
-
rec.diagnosticCounts = countDiagnostics(rec.allDiagnostics);
|
|
561
|
-
rec.diagnostics = capStoredDiagnostics(rec.allDiagnostics);
|
|
562
|
-
requestRenderFn?.();
|
|
563
|
-
}
|
|
564
|
-
return changed;
|
|
565
|
-
}
|
|
566
|
-
function isDependencyDriftDemoted(d) {
|
|
567
|
-
return d.stale === true && d.staleReason === "dependency-drift" && d.footerRetired !== true;
|
|
568
|
-
}
|
|
569
|
-
export function drainRenderedDependencyDriftFilePaths() {
|
|
570
|
-
const out = [...renderedDependencyDriftFiles];
|
|
571
|
-
renderedDependencyDriftFiles.clear();
|
|
572
|
-
return out;
|
|
573
|
-
}
|
|
574
|
-
export function incrementWidgetDependencyDriftDelivery(filePath) {
|
|
575
|
-
const rec = files.get(fileMapKey(filePath));
|
|
576
|
-
if (!rec)
|
|
577
|
-
return 0;
|
|
578
|
-
let next = 0;
|
|
579
|
-
for (const d of rec.allDiagnostics) {
|
|
580
|
-
if (isDependencyDriftDemoted(d)) {
|
|
581
|
-
next = (d.staleDeliveryCount ?? 0) + 1;
|
|
582
|
-
d.staleDeliveryCount = next;
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
return next;
|
|
586
|
-
}
|
|
587
|
-
export function retireWidgetDependencyDriftBlockers(filePath) {
|
|
588
|
-
const rec = files.get(fileMapKey(filePath));
|
|
589
|
-
if (!rec)
|
|
590
|
-
return false;
|
|
591
|
-
let changed = false;
|
|
592
|
-
for (const d of rec.allDiagnostics) {
|
|
593
|
-
if (isDependencyDriftDemoted(d)) {
|
|
594
|
-
d.footerRetired = true;
|
|
595
|
-
changed = true;
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
if (!changed)
|
|
599
|
-
return false;
|
|
600
|
-
renderedDependencyDriftFiles.delete(rec.filePath);
|
|
601
|
-
requestRenderFn?.();
|
|
602
|
-
return true;
|
|
603
|
-
}
|
|
604
|
-
let staleReconcileTimer = null;
|
|
605
|
-
export const STALE_RECONCILE_DEBOUNCE_MS = 1500;
|
|
606
|
-
export function scheduleStaleReconcile() {
|
|
607
|
-
if (staleReconcileTimer !== null)
|
|
608
|
-
return;
|
|
609
|
-
staleReconcileTimer = setTimeout(() => {
|
|
610
|
-
staleReconcileTimer = null;
|
|
611
|
-
reconcileStaleWidgetFiles().catch(() => {});
|
|
612
|
-
}, STALE_RECONCILE_DEBOUNCE_MS);
|
|
613
|
-
staleReconcileTimer?.unref?.();
|
|
614
|
-
}
|
|
615
|
-
export function getFileDiagnosticSummaries() {
|
|
616
|
-
return [...files.values()].map((rec) => {
|
|
617
|
-
applyPastEofGate(rec);
|
|
618
|
-
const live = rec.allDiagnostics.filter((d) => d.disposition === undefined);
|
|
619
|
-
return {
|
|
620
|
-
filePath: rec.filePath,
|
|
621
|
-
blocking: rec.diagnosticCounts.blocking,
|
|
622
|
-
errors: rec.diagnosticCounts.errors,
|
|
623
|
-
warnings: rec.diagnosticCounts.warnings,
|
|
624
|
-
advisories: countAdvisories(live),
|
|
625
|
-
hasFinalSnapshot: rec.hasFinalDiagnosticsSnapshot,
|
|
626
|
-
diagnostics: live.map((d) => ({ ...d }))
|
|
627
|
-
};
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
export function countRetainedSuppressedRows(filePath) {
|
|
631
|
-
const rec = files.get(fileMapKey(filePath));
|
|
632
|
-
if (!rec)
|
|
633
|
-
return 0;
|
|
634
|
-
let n = 0;
|
|
635
|
-
for (const d of rec.allDiagnostics)
|
|
636
|
-
if (d.suppressedRetained)
|
|
637
|
-
n += 1;
|
|
638
|
-
return n;
|
|
639
|
-
}
|
|
640
|
-
export function getFileDiagnostics(filePath) {
|
|
641
|
-
const rec = files.get(fileMapKey(filePath));
|
|
642
|
-
if (!rec)
|
|
643
|
-
return;
|
|
644
|
-
applyPastEofGate(rec);
|
|
645
|
-
return rec.allDiagnostics.map((d) => ({ ...d }));
|
|
646
|
-
}
|
|
647
|
-
export const __testing = {
|
|
648
|
-
getWidgetStateSnapshot() {
|
|
649
|
-
return {
|
|
650
|
-
files: [...files.values()].map((rec) => ({
|
|
651
|
-
filePath: rec.filePath,
|
|
652
|
-
storedDiagnostics: rec.diagnostics.length,
|
|
653
|
-
blocking: rec.diagnosticCounts.blocking,
|
|
654
|
-
errors: rec.diagnosticCounts.errors,
|
|
655
|
-
warnings: rec.diagnosticCounts.warnings
|
|
656
|
-
}))
|
|
657
|
-
};
|
|
658
|
-
}
|
|
659
|
-
};
|
|
660
|
-
export function recordLsp(serverId, root, status, durationMs) {
|
|
661
|
-
const normalizedRoot = normalizeMapKey(root);
|
|
662
|
-
const key = `${serverId}@${normalizedRoot}`;
|
|
663
|
-
const mapped = status === "spawn_start" ? "spawning" : status === "spawn_success" ? "ready" : "failed";
|
|
664
|
-
lspServers.set(key, { serverId, root, status: mapped, durationMs });
|
|
665
|
-
requestRender();
|
|
666
|
-
}
|
|
667
|
-
const HORIZONTAL_MIN_WIDTH = 70;
|
|
668
|
-
export function renderWidget(width, theme) {
|
|
669
|
-
const dim = (s) => theme.fg("dim", s);
|
|
670
|
-
const red = (s) => theme.fg("error", s);
|
|
671
|
-
const yellow = (s) => theme.fg("warning", s);
|
|
672
|
-
const green = (s) => theme.fg("success", s);
|
|
673
|
-
const cyan = (s) => theme.fg("accent", s);
|
|
674
|
-
const w = Math.max(1, width || 80);
|
|
675
|
-
const useHorizontal = w >= HORIZONTAL_MIN_WIDTH;
|
|
676
|
-
if (files.size === 0 && lspServers.size === 0)
|
|
677
|
-
return [];
|
|
678
|
-
const lines = [];
|
|
679
|
-
const deduped = dedupeByBasename([...files.values()]);
|
|
680
|
-
const recencySorted = deduped.filter(shouldRenderFile).slice(0, 5);
|
|
681
|
-
const langStr = sessionLanguages.slice(0, 6).join(" ");
|
|
682
|
-
const totalBlocking = countBlockingIn(deduped);
|
|
683
|
-
const totalErrors = countTotalIn("error", deduped);
|
|
684
|
-
const totalWarnings = countTotalIn("warning", deduped);
|
|
685
|
-
const totalSuppressed = countSuppressedIn(deduped);
|
|
686
|
-
const hasPendingAnalysis = deduped.some(isPendingAnalysis);
|
|
687
|
-
const errorChunk = totalErrors > 0 ? (totalBlocking > 0 ? red : yellow)(`●${totalErrors}E`) : "";
|
|
688
|
-
const warningChunk = totalWarnings > 0 ? yellow(`!${totalWarnings}W`) : "";
|
|
689
|
-
const summary = errorChunk ? errorChunk + (warningChunk ? " " + warningChunk : "") : warningChunk ? warningChunk : files.size > 0 && !hasPendingAnalysis ? green("✓ clean") : "";
|
|
690
|
-
const spawning = [...lspServers.values()].filter((s) => s.status === "spawning");
|
|
691
|
-
const lspChip = useHorizontal && spawning.length > 0 ? " " + dim("LSP↑") : "";
|
|
692
|
-
const header = ` ${cyan("dm-lens")}${langStr ? " " + dim(langStr) : ""}${lspChip}${summary ? " " + summary : ""}`;
|
|
693
|
-
lines.push(fitLine(header, w));
|
|
694
|
-
if (totalSuppressed > 0) {
|
|
695
|
-
lines.push(fitLine(` ${dim(`suppressed: ${totalSuppressed}`)}`, w));
|
|
696
|
-
}
|
|
697
|
-
if (useHorizontal) {
|
|
698
|
-
const displayOrder = sortByTierThenRecency(recencySorted);
|
|
699
|
-
const rowLine = packHorizontalRow(displayOrder, w, theme);
|
|
700
|
-
if (rowLine.length > 0)
|
|
701
|
-
lines.push(rowLine);
|
|
702
|
-
} else {
|
|
703
|
-
for (const rec of recencySorted) {
|
|
704
|
-
lines.push(fitLine(formatFileRowVertical(rec, theme), w));
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
const isBlockingOrDemoted = (d) => (isBlocking(d) || d.stale === true) && d.footerRetired !== true;
|
|
708
|
-
const withBlocking = recencySorted.filter((r) => r.diagnostics.some(isBlockingOrDemoted));
|
|
709
|
-
if (withBlocking.length > 0) {
|
|
710
|
-
const rec = withBlocking[0];
|
|
711
|
-
applyPastEofGate(rec);
|
|
712
|
-
if (!useHorizontal) {
|
|
713
|
-
lines.push(fitLine(dim("─".repeat(Math.min(w, 60))), w));
|
|
714
|
-
lines.push(fitLine(` ${dim(path.basename(rec.filePath))}`, w));
|
|
715
|
-
}
|
|
716
|
-
const blockers = rec.diagnostics.filter(isBlockingOrDemoted).slice(0, 5);
|
|
717
|
-
if (blockers.some(isDependencyDriftDemoted)) {
|
|
718
|
-
renderedDependencyDriftFiles.add(rec.filePath);
|
|
719
|
-
}
|
|
720
|
-
for (const d of blockers) {
|
|
721
|
-
const pastEof = d.stale && (d.staleReason ?? "past-eof") === "past-eof";
|
|
722
|
-
const loc = pastEof ? PAST_EOF_STALE_MARKER : d.line != null ? osc8(d.uri ?? "", `L${d.line}`) : "";
|
|
723
|
-
const rule = d.rule ? dim(` ${d.rule}`) : "";
|
|
724
|
-
const staleTag = d.stale ? dim(` ${STALE_LINE_MARKER}`) : "";
|
|
725
|
-
const prefix = ` ${d.stale ? dim("○") : red("●")} ${loc}${rule} `;
|
|
726
|
-
const msgWidth = Math.max(1, w - visibleWidth(prefix) - visibleWidth(staleTag));
|
|
727
|
-
const msg = fitLine(d.message, msgWidth, "…");
|
|
728
|
-
lines.push(fitLine(`${prefix}${msg}${staleTag}`, w));
|
|
729
|
-
}
|
|
730
|
-
}
|
|
731
|
-
if (!useHorizontal && spawning.length > 0) {
|
|
732
|
-
const ids = spawning.map((s) => s.serverId).join(" ");
|
|
733
|
-
lines.push(fitLine(` ${dim(`LSP spawning: ${ids}`)}`, w));
|
|
734
|
-
}
|
|
735
|
-
return lines;
|
|
736
|
-
}
|
|
737
|
-
function classifyFileTier(rec) {
|
|
738
|
-
if (rec.diagnosticCounts.blocking > 0)
|
|
739
|
-
return "blocking";
|
|
740
|
-
if (rec.diagnosticCounts.errors > 0 || rec.diagnosticCounts.warnings > 0) {
|
|
741
|
-
return "warning";
|
|
742
|
-
}
|
|
743
|
-
return "clean";
|
|
744
|
-
}
|
|
745
|
-
function sortByTierThenRecency(recs) {
|
|
746
|
-
const order = {
|
|
747
|
-
blocking: 0,
|
|
748
|
-
warning: 1,
|
|
749
|
-
clean: 2
|
|
750
|
-
};
|
|
751
|
-
return [...recs].sort((a, b) => {
|
|
752
|
-
const ta = order[classifyFileTier(a)];
|
|
753
|
-
const tb = order[classifyFileTier(b)];
|
|
754
|
-
if (ta !== tb)
|
|
755
|
-
return ta - tb;
|
|
756
|
-
return b.touchedAt - a.touchedAt;
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
function formatFileRowVertical(rec, theme) {
|
|
760
|
-
const dim = (s) => theme.fg("dim", s);
|
|
761
|
-
const red = (s) => theme.fg("error", s);
|
|
762
|
-
const yellow = (s) => theme.fg("warning", s);
|
|
763
|
-
const green = (s) => theme.fg("success", s);
|
|
764
|
-
const base = path.basename(rec.filePath);
|
|
765
|
-
const blocking = rec.diagnosticCounts.blocking;
|
|
766
|
-
const errors = rec.diagnosticCounts.errors;
|
|
767
|
-
const warnings = rec.diagnosticCounts.warnings;
|
|
768
|
-
const formatterFailed = hasFailedFormatter(rec);
|
|
769
|
-
const dot = blocking > 0 ? red("●") : formatterFailed ? red("x") : warnings > 0 || errors > 0 ? yellow("!") : green("✓");
|
|
770
|
-
const runnerNames = [...rec.runners.entries()].filter(([, r]) => r.status !== "skipped").map(([id]) => id).join(" ");
|
|
771
|
-
const counts = errors > 0 ? " " + (blocking > 0 ? red : yellow)(`${errors}E`) + (warnings > 0 ? " " + yellow(`${warnings}W`) : "") : warnings > 0 ? " " + yellow(`${warnings}W`) : " " + dim("clean");
|
|
772
|
-
const changedFormatters = [...rec.formatters.entries()].filter(([, f]) => f.changed && f.success).map(([name]) => name);
|
|
773
|
-
const failedFormatters = [...rec.formatters.entries()].filter(([, f]) => !f.success && f.outcome !== "unavailable").map(([name]) => name);
|
|
774
|
-
const formatMark = (failedFormatters.length > 0 ? red(` fmt-failed:${failedFormatters.join(",")}`) : "") + (changedFormatters.length > 0 ? dim(` fmt:${changedFormatters.join(",")}`) : "");
|
|
775
|
-
return ` ${dot} ${base} ${dim(runnerNames)}${formatMark}${counts}`;
|
|
776
|
-
}
|
|
777
|
-
function packHorizontalRow(recs, totalWidth, theme) {
|
|
778
|
-
if (recs.length === 0)
|
|
779
|
-
return "";
|
|
780
|
-
const dim = (s) => theme.fg("dim", s);
|
|
781
|
-
const indent = " ";
|
|
782
|
-
const sep = " ";
|
|
783
|
-
const overflowReserve = 4;
|
|
784
|
-
let used = visibleWidth(indent);
|
|
785
|
-
const parts = [indent];
|
|
786
|
-
const addedTokenWidths = [];
|
|
787
|
-
let droppedAt = -1;
|
|
788
|
-
for (let i = 0;i < recs.length; i++) {
|
|
789
|
-
const sepWidth = parts.length > 1 ? visibleWidth(sep) : 0;
|
|
790
|
-
const willOverflow = i < recs.length - 1;
|
|
791
|
-
const reserve = willOverflow ? overflowReserve : 0;
|
|
792
|
-
const remaining = totalWidth - used - sepWidth - reserve;
|
|
793
|
-
if (remaining < 4) {
|
|
794
|
-
droppedAt = i;
|
|
795
|
-
break;
|
|
796
|
-
}
|
|
797
|
-
const token = formatFileTokenHorizontal(recs[i], remaining, theme);
|
|
798
|
-
const tokenWidth = visibleWidth(token);
|
|
799
|
-
if (token.length === 0 || used + sepWidth + tokenWidth > totalWidth) {
|
|
800
|
-
droppedAt = i;
|
|
801
|
-
break;
|
|
802
|
-
}
|
|
803
|
-
if (sepWidth > 0) {
|
|
804
|
-
parts.push(sep);
|
|
805
|
-
used += sepWidth;
|
|
806
|
-
}
|
|
807
|
-
parts.push(token);
|
|
808
|
-
used += tokenWidth;
|
|
809
|
-
addedTokenWidths.push(tokenWidth + sepWidth);
|
|
810
|
-
}
|
|
811
|
-
if (droppedAt >= 0) {
|
|
812
|
-
let dropped = recs.length - droppedAt;
|
|
813
|
-
let overflow = " " + dim(`+${dropped}`);
|
|
814
|
-
while (used + visibleWidth(overflow) > totalWidth && addedTokenWidths.length > 0) {
|
|
815
|
-
const lastWidth = addedTokenWidths.pop();
|
|
816
|
-
used -= lastWidth;
|
|
817
|
-
parts.pop();
|
|
818
|
-
if (parts.length > 1)
|
|
819
|
-
parts.pop();
|
|
820
|
-
dropped++;
|
|
821
|
-
overflow = " " + dim(`+${dropped}`);
|
|
822
|
-
}
|
|
823
|
-
if (used + visibleWidth(overflow) <= totalWidth) {
|
|
824
|
-
parts.push(overflow);
|
|
825
|
-
}
|
|
826
|
-
}
|
|
827
|
-
return fitLine(parts.join(""), totalWidth);
|
|
828
|
-
}
|
|
829
|
-
function formatFileTokenHorizontal(rec, remainingWidth, theme) {
|
|
830
|
-
const dim = (s) => theme.fg("dim", s);
|
|
831
|
-
const red = (s) => theme.fg("error", s);
|
|
832
|
-
const yellow = (s) => theme.fg("warning", s);
|
|
833
|
-
const blocking = rec.diagnosticCounts.blocking;
|
|
834
|
-
const errors = rec.diagnosticCounts.errors;
|
|
835
|
-
const warnings = rec.diagnosticCounts.warnings;
|
|
836
|
-
const formatterChanged = hasChangedFormatter(rec);
|
|
837
|
-
const formatterFailed = hasFailedFormatter(rec);
|
|
838
|
-
let dotChar;
|
|
839
|
-
if (blocking > 0)
|
|
840
|
-
dotChar = red("●");
|
|
841
|
-
else if (errors > 0 || warnings > 0)
|
|
842
|
-
dotChar = yellow("!");
|
|
843
|
-
else if (formatterChanged)
|
|
844
|
-
dotChar = dim("✎");
|
|
845
|
-
else
|
|
846
|
-
dotChar = dim("·");
|
|
847
|
-
if (formatterFailed && blocking === 0 && errors === 0 && warnings === 0) {
|
|
848
|
-
dotChar = red("x");
|
|
849
|
-
}
|
|
850
|
-
let countsStyled = "";
|
|
851
|
-
if (errors > 0 && warnings > 0) {
|
|
852
|
-
const eColor = blocking > 0 ? red : yellow;
|
|
853
|
-
countsStyled = " " + eColor(`${errors}E`) + yellow(`${warnings}W`);
|
|
854
|
-
} else if (errors > 0) {
|
|
855
|
-
const eColor = blocking > 0 ? red : yellow;
|
|
856
|
-
countsStyled = " " + eColor(`${errors}E`);
|
|
857
|
-
} else if (warnings > 0) {
|
|
858
|
-
countsStyled = " " + yellow(`${warnings}W`);
|
|
859
|
-
}
|
|
860
|
-
const fullBasename = path.basename(rec.filePath);
|
|
861
|
-
const fixedWidth = visibleWidth(dotChar) + 1 + visibleWidth(countsStyled);
|
|
862
|
-
const basenameBudget = remainingWidth - fixedWidth;
|
|
863
|
-
if (basenameBudget < 3)
|
|
864
|
-
return "";
|
|
865
|
-
const truncated = truncateBasename(fullBasename, basenameBudget);
|
|
866
|
-
const linked = osc8(pathToFileURL(rec.filePath).href, truncated);
|
|
867
|
-
return `${dotChar} ${linked}${countsStyled}`;
|
|
868
|
-
}
|
|
869
|
-
function truncateBasename(name, maxWidth) {
|
|
870
|
-
if (visibleWidth(name) <= maxWidth)
|
|
871
|
-
return name;
|
|
872
|
-
if (maxWidth < 2)
|
|
873
|
-
return "…";
|
|
874
|
-
const ext = path.extname(name);
|
|
875
|
-
const stem = name.slice(0, name.length - ext.length);
|
|
876
|
-
const keep = maxWidth - ext.length - 1;
|
|
877
|
-
if (keep < 1) {
|
|
878
|
-
return name.slice(0, maxWidth - 1) + "…";
|
|
879
|
-
}
|
|
880
|
-
return stem.slice(0, keep) + "…" + ext;
|
|
881
|
-
}
|
|
882
|
-
function getOrCreate(filePath, key = fileMapKey(filePath)) {
|
|
883
|
-
maybePruneInactiveFileRecords();
|
|
884
|
-
return files.get(key) ?? {
|
|
885
|
-
filePath,
|
|
886
|
-
runners: new Map,
|
|
887
|
-
formatters: new Map,
|
|
888
|
-
diagnostics: [],
|
|
889
|
-
allDiagnostics: [],
|
|
890
|
-
diagnosticCounts: { blocking: 0, errors: 0, warnings: 0 },
|
|
891
|
-
hasFinalDiagnosticsSnapshot: false,
|
|
892
|
-
touchedAt: Date.now()
|
|
893
|
-
};
|
|
894
|
-
}
|
|
895
|
-
function hasChangedFormatter(rec) {
|
|
896
|
-
return [...rec.formatters.values()].some((f) => f.changed && f.success);
|
|
897
|
-
}
|
|
898
|
-
function hasFailedFormatter(rec) {
|
|
899
|
-
return [...rec.formatters.values()].some((f) => !f.success && f.outcome !== "unavailable");
|
|
900
|
-
}
|
|
901
|
-
function shouldRenderFile(rec) {
|
|
902
|
-
return rec.hasFinalDiagnosticsSnapshot || hasChangedFormatter(rec) || hasFailedFormatter(rec);
|
|
903
|
-
}
|
|
904
|
-
function hasLiveDiagnostic(rec) {
|
|
905
|
-
return rec.hasFinalDiagnosticsSnapshot && rec.diagnostics.length > 0;
|
|
906
|
-
}
|
|
907
|
-
function isPendingAnalysis(rec) {
|
|
908
|
-
return rec.runners.size > 0 && !rec.hasFinalDiagnosticsSnapshot;
|
|
909
|
-
}
|
|
910
|
-
function capStoredDiagnostics(diagnostics) {
|
|
911
|
-
if (diagnostics.length <= MAX_STORED_DIAGNOSTICS_PER_FILE)
|
|
912
|
-
return diagnostics;
|
|
913
|
-
const blockers = diagnostics.filter(isBlocking);
|
|
914
|
-
if (blockers.length >= MAX_STORED_DIAGNOSTICS_PER_FILE) {
|
|
915
|
-
return blockers.slice(0, MAX_STORED_DIAGNOSTICS_PER_FILE);
|
|
916
|
-
}
|
|
917
|
-
const rest = diagnostics.filter((d) => !isBlocking(d));
|
|
918
|
-
return [
|
|
919
|
-
...blockers,
|
|
920
|
-
...rest.slice(0, MAX_STORED_DIAGNOSTICS_PER_FILE - blockers.length)
|
|
921
|
-
];
|
|
922
|
-
}
|
|
923
|
-
function countTotalIn(severity, recs) {
|
|
924
|
-
let n = 0;
|
|
925
|
-
for (const rec of recs) {
|
|
926
|
-
if (severity === "error")
|
|
927
|
-
n += rec.diagnosticCounts.errors;
|
|
928
|
-
else
|
|
929
|
-
n += rec.diagnosticCounts.warnings;
|
|
930
|
-
}
|
|
931
|
-
return n;
|
|
932
|
-
}
|
|
933
|
-
function countSuppressedIn(recs) {
|
|
934
|
-
let n = 0;
|
|
935
|
-
for (const rec of recs) {
|
|
936
|
-
for (const diagnostic of rec.allDiagnostics) {
|
|
937
|
-
if (diagnostic.disposition)
|
|
938
|
-
n++;
|
|
939
|
-
}
|
|
940
|
-
}
|
|
941
|
-
return n;
|
|
942
|
-
}
|
|
943
|
-
function countBlockingIn(recs) {
|
|
944
|
-
let n = 0;
|
|
945
|
-
for (const rec of recs)
|
|
946
|
-
n += rec.diagnosticCounts.blocking;
|
|
947
|
-
return n;
|
|
948
|
-
}
|
|
949
|
-
function requestRender() {
|
|
950
|
-
requestRenderFn?.();
|
|
951
|
-
}
|
|
952
|
-
function osc8(uri, label) {
|
|
953
|
-
if (!uri)
|
|
954
|
-
return label;
|
|
955
|
-
return `\x1B]8;;${uri}\x1B\\${label}\x1B]8;;\x1B\\`;
|
|
956
|
-
}
|
|
957
|
-
function dedupeByBasename(recs) {
|
|
958
|
-
const seen = new Map;
|
|
959
|
-
for (const r of [...recs].sort((a, b) => a.touchedAt - b.touchedAt)) {
|
|
960
|
-
seen.set(path.basename(r.filePath), r);
|
|
961
|
-
}
|
|
962
|
-
return [...seen.values()].sort((a, b) => b.touchedAt - a.touchedAt);
|
|
963
|
-
}
|