@duckmind/dm-darwin-x64 0.67.2 → 0.67.3

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.
Files changed (605) hide show
  1. package/README.md +2 -2
  2. package/dm +1 -1
  3. package/extensions/.dm-extensions.json +611 -13
  4. package/extensions/dm-lens/clients/dispatch/runners/utils/runner-helpers.js +1 -1
  5. package/extensions/dm-lens/dist/clients/actionable-warnings-logger.js +24 -0
  6. package/extensions/dm-lens/dist/clients/actionable-warnings.js +1066 -0
  7. package/extensions/dm-lens/dist/clients/advisory-provenance.js +388 -0
  8. package/extensions/dm-lens/dist/clients/agent-behavior-client.js +94 -0
  9. package/extensions/dm-lens/dist/clients/agent-nudge.js +253 -0
  10. package/extensions/dm-lens/dist/clients/analysed-root.js +1 -0
  11. package/extensions/dm-lens/dist/clients/analysis-root.js +133 -0
  12. package/extensions/dm-lens/dist/clients/ast-grep-client.js +587 -0
  13. package/extensions/dm-lens/dist/clients/ast-grep-rule-manager.js +137 -0
  14. package/extensions/dm-lens/dist/clients/ast-grep-tool-logger.js +85 -0
  15. package/extensions/dm-lens/dist/clients/ast-grep-types.js +1 -0
  16. package/extensions/dm-lens/dist/clients/ast-grep-yaml-synth.js +109 -0
  17. package/extensions/dm-lens/dist/clients/atomic-write-staging.js +66 -0
  18. package/extensions/dm-lens/dist/clients/atomic-write.js +37 -0
  19. package/extensions/dm-lens/dist/clients/availability-probe-flight.js +11 -0
  20. package/extensions/dm-lens/dist/clients/bash-file-access.js +1257 -0
  21. package/extensions/dm-lens/dist/clients/biome-client.js +223 -0
  22. package/extensions/dm-lens/dist/clients/blocker-freshness.js +553 -0
  23. package/extensions/dm-lens/dist/clients/blocker-past-eof.js +51 -0
  24. package/extensions/dm-lens/dist/clients/bootstrap.js +246 -0
  25. package/extensions/dm-lens/dist/clients/bounded-cache.js +105 -0
  26. package/extensions/dm-lens/dist/clients/bounded-pid-file-lock.js +275 -0
  27. package/extensions/dm-lens/dist/clients/bounded-telemetry.js +110 -0
  28. package/extensions/dm-lens/dist/clients/build-identity.js +45 -0
  29. package/extensions/dm-lens/dist/clients/bundled-resource-health.js +41 -0
  30. package/extensions/dm-lens/dist/clients/bus-events-logger.js +48 -0
  31. package/extensions/dm-lens/dist/clients/bus-publish.js +117 -0
  32. package/extensions/dm-lens/dist/clients/cache/rule-cache.js +87 -0
  33. package/extensions/dm-lens/dist/clients/cache-manager.js +449 -0
  34. package/extensions/dm-lens/dist/clients/cache-observability.js +1105 -0
  35. package/extensions/dm-lens/dist/clients/call-graph.js +628 -0
  36. package/extensions/dm-lens/dist/clients/cargo-manifest.js +167 -0
  37. package/extensions/dm-lens/dist/clients/cascade-budget.js +52 -0
  38. package/extensions/dm-lens/dist/clients/cascade-format.js +301 -0
  39. package/extensions/dm-lens/dist/clients/cascade-logger.js +22 -0
  40. package/extensions/dm-lens/dist/clients/cascade-types.js +1 -0
  41. package/extensions/dm-lens/dist/clients/child-unref.js +59 -0
  42. package/extensions/dm-lens/dist/clients/code-quality-warnings.js +192 -0
  43. package/extensions/dm-lens/dist/clients/codebase-model.js +110 -0
  44. package/extensions/dm-lens/dist/clients/collateral-test-role.js +8 -0
  45. package/extensions/dm-lens/dist/clients/complexity-client.js +398 -0
  46. package/extensions/dm-lens/dist/clients/config-core/deny.js +117 -0
  47. package/extensions/dm-lens/dist/clients/config-core/index.js +2 -0
  48. package/extensions/dm-lens/dist/clients/config-core/merge.js +228 -0
  49. package/extensions/dm-lens/dist/clients/config-core/normalize.js +226 -0
  50. package/extensions/dm-lens/dist/clients/config-core/process-spec.js +147 -0
  51. package/extensions/dm-lens/dist/clients/config-core/provenance.js +54 -0
  52. package/extensions/dm-lens/dist/clients/config-core/records.js +79 -0
  53. package/extensions/dm-lens/dist/clients/config-core/resolve.js +48 -0
  54. package/extensions/dm-lens/dist/clients/config-core/safe-object.js +22 -0
  55. package/extensions/dm-lens/dist/clients/config-core/schema.js +93 -0
  56. package/extensions/dm-lens/dist/clients/config-diagnostic-codes.js +90 -0
  57. package/extensions/dm-lens/dist/clients/config-locations.js +169 -0
  58. package/extensions/dm-lens/dist/clients/config-resolve.js +359 -0
  59. package/extensions/dm-lens/dist/clients/config-schema.js +230 -0
  60. package/extensions/dm-lens/dist/clients/config-warn.js +146 -0
  61. package/extensions/dm-lens/dist/clients/confirmed-delete.js +11 -0
  62. package/extensions/dm-lens/dist/clients/console-guard-install.js +4 -0
  63. package/extensions/dm-lens/dist/clients/content-stamp.js +16 -0
  64. package/extensions/dm-lens/dist/clients/context-injection-ledger.js +157 -0
  65. package/extensions/dm-lens/dist/clients/cooperative-budget.js +36 -0
  66. package/extensions/dm-lens/dist/clients/custom-rule-locations.js +28 -0
  67. package/extensions/dm-lens/dist/clients/dead-code-client.js +408 -0
  68. package/extensions/dm-lens/dist/clients/dead-code-logger.js +18 -0
  69. package/extensions/dm-lens/dist/clients/deadline-utils.js +117 -0
  70. package/extensions/dm-lens/dist/clients/debug-handles.js +121 -0
  71. package/extensions/dm-lens/dist/clients/debug-heap.js +80 -0
  72. package/extensions/dm-lens/dist/clients/deferred-lsp-work.js +33 -0
  73. package/extensions/dm-lens/dist/clients/deferred-runner-blockers.js +146 -0
  74. package/extensions/dm-lens/dist/clients/deferred-test-targets.js +31 -0
  75. package/extensions/dm-lens/dist/clients/degradation-ledger.js +306 -0
  76. package/extensions/dm-lens/dist/clients/demoted-finding-render.js +64 -0
  77. package/extensions/dm-lens/dist/clients/dependency-checker.js +534 -0
  78. package/extensions/dm-lens/dist/clients/deps/ast-grep-napi.js +27 -0
  79. package/extensions/dm-lens/dist/clients/deps/dm-host-deps.js +10 -0
  80. package/extensions/dm-lens/dist/clients/deps/dm-tui-compat.js +58 -0
  81. package/extensions/dm-lens/dist/clients/deps/js-yaml.js +7 -0
  82. package/extensions/dm-lens/dist/clients/deps/minimatch.js +6 -0
  83. package/extensions/dm-lens/dist/clients/deps/pidusage.js +5 -0
  84. package/extensions/dm-lens/dist/clients/deps/typebox.js +5 -0
  85. package/extensions/dm-lens/dist/clients/deps/vscode-jsonrpc.js +8 -0
  86. package/extensions/dm-lens/dist/clients/deps/web-tree-sitter.js +11 -0
  87. package/extensions/dm-lens/dist/clients/diagnostic-dispositions.js +334 -0
  88. package/extensions/dm-lens/dist/clients/diagnostic-line-freshness.js +142 -0
  89. package/extensions/dm-lens/dist/clients/diagnostic-logger.js +60 -0
  90. package/extensions/dm-lens/dist/clients/diagnostic-tracker.js +89 -0
  91. package/extensions/dm-lens/dist/clients/diagnostics-publish.js +134 -0
  92. package/extensions/dm-lens/dist/clients/disk-change-consumers.js +312 -0
  93. package/extensions/dm-lens/dist/clients/disk-change-subscribers.js +191 -0
  94. package/extensions/dm-lens/dist/clients/disk-changes.js +165 -0
  95. package/extensions/dm-lens/dist/clients/dispatch/adopted-root-runners.js +22 -0
  96. package/extensions/dm-lens/dist/clients/dispatch/ast-grep-catalog.js +16 -0
  97. package/extensions/dm-lens/dist/clients/dispatch/auxiliary-lsp.js +162 -0
  98. package/extensions/dm-lens/dist/clients/dispatch/collect-later-tier.js +25 -0
  99. package/extensions/dm-lens/dist/clients/dispatch/diagnostic-taxonomy.js +58 -0
  100. package/extensions/dm-lens/dist/clients/dispatch/dispatcher.js +1240 -0
  101. package/extensions/dm-lens/dist/clients/dispatch/fact-provider-types.js +1 -0
  102. package/extensions/dm-lens/dist/clients/dispatch/fact-rule-runner.js +17 -0
  103. package/extensions/dm-lens/dist/clients/dispatch/fact-runner.js +18 -0
  104. package/extensions/dm-lens/dist/clients/dispatch/fact-scheduler.js +52 -0
  105. package/extensions/dm-lens/dist/clients/dispatch/fact-store.js +193 -0
  106. package/extensions/dm-lens/dist/clients/dispatch/facts/comment-facts.js +23 -0
  107. package/extensions/dm-lens/dist/clients/dispatch/facts/file-content.js +18 -0
  108. package/extensions/dm-lens/dist/clients/dispatch/facts/function-facts.js +274 -0
  109. package/extensions/dm-lens/dist/clients/dispatch/facts/import-facts.js +169 -0
  110. package/extensions/dm-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +19 -0
  111. package/extensions/dm-lens/dist/clients/dispatch/facts/try-catch-facts.js +95 -0
  112. package/extensions/dm-lens/dist/clients/dispatch/finding-policy.js +188 -0
  113. package/extensions/dm-lens/dist/clients/dispatch/indent-detect.js +227 -0
  114. package/extensions/dm-lens/dist/clients/dispatch/inline-suppressions.js +52 -0
  115. package/extensions/dm-lens/dist/clients/dispatch/integration.js +1698 -0
  116. package/extensions/dm-lens/dist/clients/dispatch/known-runner-ids.js +13 -0
  117. package/extensions/dm-lens/dist/clients/dispatch/lane-copies.js +23 -0
  118. package/extensions/dm-lens/dist/clients/dispatch/lazy.js +8 -0
  119. package/extensions/dm-lens/dist/clients/dispatch/pending-runner-findings.js +133 -0
  120. package/extensions/dm-lens/dist/clients/dispatch/plan.js +284 -0
  121. package/extensions/dm-lens/dist/clients/dispatch/pre-edit-seed.js +57 -0
  122. package/extensions/dm-lens/dist/clients/dispatch/priorities.js +14 -0
  123. package/extensions/dm-lens/dist/clients/dispatch/rule-id-normalize.js +54 -0
  124. package/extensions/dm-lens/dist/clients/dispatch/rule-ignores.js +21 -0
  125. package/extensions/dm-lens/dist/clients/dispatch/rule-policy.js +102 -0
  126. package/extensions/dm-lens/dist/clients/dispatch/rules/async-noise.js +31 -0
  127. package/extensions/dm-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +27 -0
  128. package/extensions/dm-lens/dist/clients/dispatch/rules/cors-wildcard.js +35 -0
  129. package/extensions/dm-lens/dist/clients/dispatch/rules/error-obscuring.js +29 -0
  130. package/extensions/dm-lens/dist/clients/dispatch/rules/error-swallowing.js +29 -0
  131. package/extensions/dm-lens/dist/clients/dispatch/rules/framework-call-noise.js +31 -0
  132. package/extensions/dm-lens/dist/clients/dispatch/rules/high-complexity.js +41 -0
  133. package/extensions/dm-lens/dist/clients/dispatch/rules/high-fan-out.js +37 -0
  134. package/extensions/dm-lens/dist/clients/dispatch/rules/high-import-coupling.js +31 -0
  135. package/extensions/dm-lens/dist/clients/dispatch/rules/missing-error-propagation.js +45 -0
  136. package/extensions/dm-lens/dist/clients/dispatch/rules/no-commented-credentials.js +46 -0
  137. package/extensions/dm-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +38 -0
  138. package/extensions/dm-lens/dist/clients/dispatch/rules/placeholder-comments.js +40 -0
  139. package/extensions/dm-lens/dist/clients/dispatch/rules/unsafe-boundary.js +101 -0
  140. package/extensions/dm-lens/dist/clients/dispatch/runner-context.js +41 -0
  141. package/extensions/dm-lens/dist/clients/dispatch/runners/actionlint.js +98 -0
  142. package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-literal-anchors.js +58 -0
  143. package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-napi.js +739 -0
  144. package/extensions/dm-lens/dist/clients/dispatch/runners/biome-check.js +196 -0
  145. package/extensions/dm-lens/dist/clients/dispatch/runners/cpp-check.js +190 -0
  146. package/extensions/dm-lens/dist/clients/dispatch/runners/credo.js +66 -0
  147. package/extensions/dm-lens/dist/clients/dispatch/runners/cue-vet.js +161 -0
  148. package/extensions/dm-lens/dist/clients/dispatch/runners/dart-analyze.js +151 -0
  149. package/extensions/dm-lens/dist/clients/dispatch/runners/detekt.js +158 -0
  150. package/extensions/dm-lens/dist/clients/dispatch/runners/dotnet-build.js +163 -0
  151. package/extensions/dm-lens/dist/clients/dispatch/runners/elixir-check.js +153 -0
  152. package/extensions/dm-lens/dist/clients/dispatch/runners/eslint.js +99 -0
  153. package/extensions/dm-lens/dist/clients/dispatch/runners/fact-rules.js +20 -0
  154. package/extensions/dm-lens/dist/clients/dispatch/runners/fish-indent.js +120 -0
  155. package/extensions/dm-lens/dist/clients/dispatch/runners/gleam-check.js +100 -0
  156. package/extensions/dm-lens/dist/clients/dispatch/runners/go-vet.js +52 -0
  157. package/extensions/dm-lens/dist/clients/dispatch/runners/golangci-lint.js +105 -0
  158. package/extensions/dm-lens/dist/clients/dispatch/runners/hadolint.js +83 -0
  159. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-lint.js +147 -0
  160. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-render.js +593 -0
  161. package/extensions/dm-lens/dist/clients/dispatch/runners/htmlhint.js +103 -0
  162. package/extensions/dm-lens/dist/clients/dispatch/runners/index.js +100 -0
  163. package/extensions/dm-lens/dist/clients/dispatch/runners/javac.js +82 -0
  164. package/extensions/dm-lens/dist/clients/dispatch/runners/ktlint.js +115 -0
  165. package/extensions/dm-lens/dist/clients/dispatch/runners/lsp.js +275 -0
  166. package/extensions/dm-lens/dist/clients/dispatch/runners/markdownlint.js +129 -0
  167. package/extensions/dm-lens/dist/clients/dispatch/runners/mypy.js +70 -0
  168. package/extensions/dm-lens/dist/clients/dispatch/runners/oxlint.js +296 -0
  169. package/extensions/dm-lens/dist/clients/dispatch/runners/php-lint.js +66 -0
  170. package/extensions/dm-lens/dist/clients/dispatch/runners/phpstan.js +90 -0
  171. package/extensions/dm-lens/dist/clients/dispatch/runners/prisma-validate.js +66 -0
  172. package/extensions/dm-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +307 -0
  173. package/extensions/dm-lens/dist/clients/dispatch/runners/pyright.js +118 -0
  174. package/extensions/dm-lens/dist/clients/dispatch/runners/rubocop.js +79 -0
  175. package/extensions/dm-lens/dist/clients/dispatch/runners/ruff.js +69 -0
  176. package/extensions/dm-lens/dist/clients/dispatch/runners/rust-clippy.js +166 -0
  177. package/extensions/dm-lens/dist/clients/dispatch/runners/shellcheck.js +168 -0
  178. package/extensions/dm-lens/dist/clients/dispatch/runners/shfmt.js +92 -0
  179. package/extensions/dm-lens/dist/clients/dispatch/runners/spellcheck.js +74 -0
  180. package/extensions/dm-lens/dist/clients/dispatch/runners/spotbugs.js +208 -0
  181. package/extensions/dm-lens/dist/clients/dispatch/runners/sqlfluff.js +136 -0
  182. package/extensions/dm-lens/dist/clients/dispatch/runners/stylelint.js +118 -0
  183. package/extensions/dm-lens/dist/clients/dispatch/runners/swiftlint.js +143 -0
  184. package/extensions/dm-lens/dist/clients/dispatch/runners/taplo.js +109 -0
  185. package/extensions/dm-lens/dist/clients/dispatch/runners/terragrunt.js +110 -0
  186. package/extensions/dm-lens/dist/clients/dispatch/runners/tflint.js +104 -0
  187. package/extensions/dm-lens/dist/clients/dispatch/runners/tree-sitter.js +534 -0
  188. package/extensions/dm-lens/dist/clients/dispatch/runners/trivy-config.js +155 -0
  189. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/availability-policy.js +313 -0
  190. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +66 -0
  191. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +62 -0
  192. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +130 -0
  193. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +1143 -0
  194. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +40 -0
  195. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/tool-failure.js +110 -0
  196. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +88 -0
  197. package/extensions/dm-lens/dist/clients/dispatch/runners/utils.js +8 -0
  198. package/extensions/dm-lens/dist/clients/dispatch/runners/vale.js +92 -0
  199. package/extensions/dm-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +170 -0
  200. package/extensions/dm-lens/dist/clients/dispatch/runners/yamllint.js +83 -0
  201. package/extensions/dm-lens/dist/clients/dispatch/runners/zig-check.js +72 -0
  202. package/extensions/dm-lens/dist/clients/dispatch/suppress-writer.js +57 -0
  203. package/extensions/dm-lens/dist/clients/dispatch/tool-profile.js +30 -0
  204. package/extensions/dm-lens/dist/clients/dispatch/types.js +72 -0
  205. package/extensions/dm-lens/dist/clients/dispatch/utils/format-utils.js +58 -0
  206. package/extensions/dm-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +32 -0
  207. package/extensions/dm-lens/dist/clients/disposition-logger.js +19 -0
  208. package/extensions/dm-lens/dist/clients/disposition-publish.js +88 -0
  209. package/extensions/dm-lens/dist/clients/durable-store.js +77 -0
  210. package/extensions/dm-lens/dist/clients/effective-config.js +170 -0
  211. package/extensions/dm-lens/dist/clients/env-utils.js +26 -0
  212. package/extensions/dm-lens/dist/clients/ephemeral-root.js +55 -0
  213. package/extensions/dm-lens/dist/clients/error-class.js +3 -0
  214. package/extensions/dm-lens/dist/clients/eval-timestamp.js +2 -0
  215. package/extensions/dm-lens/dist/clients/event-loop-hold.js +119 -0
  216. package/extensions/dm-lens/dist/clients/event-loop-monitor.js +84 -0
  217. package/extensions/dm-lens/dist/clients/extension-log.js +230 -0
  218. package/extensions/dm-lens/dist/clients/extension-mode.js +20 -0
  219. package/extensions/dm-lens/dist/clients/feature-hints.js +88 -0
  220. package/extensions/dm-lens/dist/clients/file-kinds.js +317 -0
  221. package/extensions/dm-lens/dist/clients/file-mutation-queue.js +91 -0
  222. package/extensions/dm-lens/dist/clients/file-role.js +50 -0
  223. package/extensions/dm-lens/dist/clients/file-time.js +112 -0
  224. package/extensions/dm-lens/dist/clients/file-utils.js +840 -0
  225. package/extensions/dm-lens/dist/clients/finding-delivery-gate.js +146 -0
  226. package/extensions/dm-lens/dist/clients/finding-identity.js +79 -0
  227. package/extensions/dm-lens/dist/clients/fix-run-restore.js +423 -0
  228. package/extensions/dm-lens/dist/clients/fix-worklog.js +75 -0
  229. package/extensions/dm-lens/dist/clients/format-events-publish.js +310 -0
  230. package/extensions/dm-lens/dist/clients/format-service.js +177 -0
  231. package/extensions/dm-lens/dist/clients/formatters-lazy.js +8 -0
  232. package/extensions/dm-lens/dist/clients/formatters.js +1367 -0
  233. package/extensions/dm-lens/dist/clients/freshness-cadence.js +1 -0
  234. package/extensions/dm-lens/dist/clients/freshness.js +8 -0
  235. package/extensions/dm-lens/dist/clients/generated-artifacts.js +209 -0
  236. package/extensions/dm-lens/dist/clients/generation-guard.js +147 -0
  237. package/extensions/dm-lens/dist/clients/generation-lock.js +181 -0
  238. package/extensions/dm-lens/dist/clients/git-guard.js +1208 -0
  239. package/extensions/dm-lens/dist/clients/git-tracked-ignore.js +120 -0
  240. package/extensions/dm-lens/dist/clients/gitleaks-client.js +290 -0
  241. package/extensions/dm-lens/dist/clients/go-client.js +47 -0
  242. package/extensions/dm-lens/dist/clients/govulncheck-client.js +416 -0
  243. package/extensions/dm-lens/dist/clients/gradle-ktfmt-style.js +177 -0
  244. package/extensions/dm-lens/dist/clients/grammar-source.js +263 -0
  245. package/extensions/dm-lens/dist/clients/grammar-wasm-imports.js +48 -0
  246. package/extensions/dm-lens/dist/clients/gzip-stage-write.js +174 -0
  247. package/extensions/dm-lens/dist/clients/hard-failure-summary.js +28 -0
  248. package/extensions/dm-lens/dist/clients/hashline-anchor.js +222 -0
  249. package/extensions/dm-lens/dist/clients/hook-budgets.js +17 -0
  250. package/extensions/dm-lens/dist/clients/host-edit-normalize.js +87 -0
  251. package/extensions/dm-lens/dist/clients/host-ports.js +35 -0
  252. package/extensions/dm-lens/dist/clients/indent-retarget.js +102 -0
  253. package/extensions/dm-lens/dist/clients/inline-blocker-dispositions.js +103 -0
  254. package/extensions/dm-lens/dist/clients/inline-blocker-fields.js +8 -0
  255. package/extensions/dm-lens/dist/clients/install-diagnostics.js +135 -0
  256. package/extensions/dm-lens/dist/clients/installer/index.js +3928 -0
  257. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh-session.js +17 -0
  258. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh.js +721 -0
  259. package/extensions/dm-lens/dist/clients/instance-reaper-state.js +3 -0
  260. package/extensions/dm-lens/dist/clients/instance-reaper.js +693 -0
  261. package/extensions/dm-lens/dist/clients/instance-registry-lock.js +166 -0
  262. package/extensions/dm-lens/dist/clients/instance-registry-tail.js +17 -0
  263. package/extensions/dm-lens/dist/clients/instance-registry.js +607 -0
  264. package/extensions/dm-lens/dist/clients/io-bridge-contract.js +7 -0
  265. package/extensions/dm-lens/dist/clients/io-bridge.js +357 -0
  266. package/extensions/dm-lens/dist/clients/jscpd-client.js +311 -0
  267. package/extensions/dm-lens/dist/clients/json-cache-read.js +25 -0
  268. package/extensions/dm-lens/dist/clients/knip-client.js +534 -0
  269. package/extensions/dm-lens/dist/clients/knip-scan-roots.js +26 -0
  270. package/extensions/dm-lens/dist/clients/language-policy.js +244 -0
  271. package/extensions/dm-lens/dist/clients/language-profile.js +259 -0
  272. package/extensions/dm-lens/dist/clients/language-registry.js +468 -0
  273. package/extensions/dm-lens/dist/clients/latency-logger.js +210 -0
  274. package/extensions/dm-lens/dist/clients/lazy-import.js +14 -0
  275. package/extensions/dm-lens/dist/clients/ledger-bounds.js +21 -0
  276. package/extensions/dm-lens/dist/clients/lens-config.js +254 -0
  277. package/extensions/dm-lens/dist/clients/lens-engine.js +188 -0
  278. package/extensions/dm-lens/dist/clients/lens-events.js +105 -0
  279. package/extensions/dm-lens/dist/clients/lens-flag-registry.js +308 -0
  280. package/extensions/dm-lens/dist/clients/lens-map.js +980 -0
  281. package/extensions/dm-lens/dist/clients/line-alignment.js +200 -0
  282. package/extensions/dm-lens/dist/clients/live-bus-emitter.js +53 -0
  283. package/extensions/dm-lens/dist/clients/log-cleanup.js +138 -0
  284. package/extensions/dm-lens/dist/clients/lsp/aggregation.js +89 -0
  285. package/extensions/dm-lens/dist/clients/lsp/auxiliary-lifecycle.js +23 -0
  286. package/extensions/dm-lens/dist/clients/lsp/capabilities.js +94 -0
  287. package/extensions/dm-lens/dist/clients/lsp/cascade-tier.js +318 -0
  288. package/extensions/dm-lens/dist/clients/lsp/client-registry.js +877 -0
  289. package/extensions/dm-lens/dist/clients/lsp/client.js +3232 -0
  290. package/extensions/dm-lens/dist/clients/lsp/config.js +571 -0
  291. package/extensions/dm-lens/dist/clients/lsp/content-limits.js +21 -0
  292. package/extensions/dm-lens/dist/clients/lsp/content-scan.js +69 -0
  293. package/extensions/dm-lens/dist/clients/lsp/created-import-targets.js +134 -0
  294. package/extensions/dm-lens/dist/clients/lsp/diagnostic-binding.js +113 -0
  295. package/extensions/dm-lens/dist/clients/lsp/document-drift.js +372 -0
  296. package/extensions/dm-lens/dist/clients/lsp/edits.js +1060 -0
  297. package/extensions/dm-lens/dist/clients/lsp/environment-gap.js +186 -0
  298. package/extensions/dm-lens/dist/clients/lsp/file-server-match.js +26 -0
  299. package/extensions/dm-lens/dist/clients/lsp/grouping.js +38 -0
  300. package/extensions/dm-lens/dist/clients/lsp/implicit-scope.js +205 -0
  301. package/extensions/dm-lens/dist/clients/lsp/index.js +4292 -0
  302. package/extensions/dm-lens/dist/clients/lsp/inferred-project.js +140 -0
  303. package/extensions/dm-lens/dist/clients/lsp/jvm-runtime.js +200 -0
  304. package/extensions/dm-lens/dist/clients/lsp/language.js +26 -0
  305. package/extensions/dm-lens/dist/clients/lsp/launch.js +606 -0
  306. package/extensions/dm-lens/dist/clients/lsp/lombok.js +133 -0
  307. package/extensions/dm-lens/dist/clients/lsp/path-utils.js +1 -0
  308. package/extensions/dm-lens/dist/clients/lsp/pending-aux-coverage.js +120 -0
  309. package/extensions/dm-lens/dist/clients/lsp/position-encoding.js +21 -0
  310. package/extensions/dm-lens/dist/clients/lsp/resolved-config.js +183 -0
  311. package/extensions/dm-lens/dist/clients/lsp/ruby-drive-dirs.js +42 -0
  312. package/extensions/dm-lens/dist/clients/lsp/server-config-files.js +11 -0
  313. package/extensions/dm-lens/dist/clients/lsp/server-covers.js +8 -0
  314. package/extensions/dm-lens/dist/clients/lsp/server-traits.js +45 -0
  315. package/extensions/dm-lens/dist/clients/lsp/server.js +2827 -0
  316. package/extensions/dm-lens/dist/clients/lsp/service-singleton.js +59 -0
  317. package/extensions/dm-lens/dist/clients/lsp/session-roots.js +83 -0
  318. package/extensions/dm-lens/dist/clients/lsp/spawn-history.js +15 -0
  319. package/extensions/dm-lens/dist/clients/lsp/sync-kind.js +30 -0
  320. package/extensions/dm-lens/dist/clients/lsp/tsserver-sync.js +156 -0
  321. package/extensions/dm-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +1 -0
  322. package/extensions/dm-lens/dist/clients/lsp/wait-policy/classification.js +37 -0
  323. package/extensions/dm-lens/dist/clients/lsp/wait-policy/index.js +3 -0
  324. package/extensions/dm-lens/dist/clients/lsp/wait-policy/strategies.js +276 -0
  325. package/extensions/dm-lens/dist/clients/lsp/watch-queue.js +61 -0
  326. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-cache.js +395 -0
  327. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-session.js +42 -0
  328. package/extensions/dm-lens/dist/clients/lsp/workspace-sweep-hold.js +93 -0
  329. package/extensions/dm-lens/dist/clients/lsp-budget.js +87 -0
  330. package/extensions/dm-lens/dist/clients/lsp-document-symbols.js +93 -0
  331. package/extensions/dm-lens/dist/clients/lsp-lazy.js +8 -0
  332. package/extensions/dm-lens/dist/clients/lsp-mutation.js +309 -0
  333. package/extensions/dm-lens/dist/clients/lsp-status.js +35 -0
  334. package/extensions/dm-lens/dist/clients/map-with-concurrency.js +20 -0
  335. package/extensions/dm-lens/dist/clients/mcp/analyze.js +302 -0
  336. package/extensions/dm-lens/dist/clients/mcp/host-shim.js +14 -0
  337. package/extensions/dm-lens/dist/clients/mcp/ipc.js +344 -0
  338. package/extensions/dm-lens/dist/clients/mcp/review.js +137 -0
  339. package/extensions/dm-lens/dist/clients/mcp/session.js +300 -0
  340. package/extensions/dm-lens/dist/clients/memory-sampler.js +163 -0
  341. package/extensions/dm-lens/dist/clients/message-end-attribution.js +18 -0
  342. package/extensions/dm-lens/dist/clients/metrics-client.js +80 -0
  343. package/extensions/dm-lens/dist/clients/metrics-history.js +242 -0
  344. package/extensions/dm-lens/dist/clients/middle-man-analysis.js +161 -0
  345. package/extensions/dm-lens/dist/clients/model-provider.js +31 -0
  346. package/extensions/dm-lens/dist/clients/module-report-lsp.js +140 -0
  347. package/extensions/dm-lens/dist/clients/module-report.js +1648 -0
  348. package/extensions/dm-lens/dist/clients/mutating-tool.js +388 -0
  349. package/extensions/dm-lens/dist/clients/mutation-attribution.js +173 -0
  350. package/extensions/dm-lens/dist/clients/mutation-bridge.js +231 -0
  351. package/extensions/dm-lens/dist/clients/ndjson-logger.js +504 -0
  352. package/extensions/dm-lens/dist/clients/observed-mutation-sources.js +43 -0
  353. package/extensions/dm-lens/dist/clients/observed-mutation.js +735 -0
  354. package/extensions/dm-lens/dist/clients/oldtext-autopatch.js +100 -0
  355. package/extensions/dm-lens/dist/clients/opaque-mutation-scan.js +541 -0
  356. package/extensions/dm-lens/dist/clients/opengrep-client.js +224 -0
  357. package/extensions/dm-lens/dist/clients/opengrep-config.js +57 -0
  358. package/extensions/dm-lens/dist/clients/opengrep-rule-pack.js +19 -0
  359. package/extensions/dm-lens/dist/clients/out-of-band-changes.js +329 -0
  360. package/extensions/dm-lens/dist/clients/package-manager.js +332 -0
  361. package/extensions/dm-lens/dist/clients/package-root.js +21 -0
  362. package/extensions/dm-lens/dist/clients/partial-edit-apply.js +341 -0
  363. package/extensions/dm-lens/dist/clients/path-attribution-telemetry.js +31 -0
  364. package/extensions/dm-lens/dist/clients/path-birth.js +58 -0
  365. package/extensions/dm-lens/dist/clients/path-keyed-map.js +57 -0
  366. package/extensions/dm-lens/dist/clients/path-utils.js +654 -0
  367. package/extensions/dm-lens/dist/clients/performance-report.js +291 -0
  368. package/extensions/dm-lens/dist/clients/persist-debounce.js +37 -0
  369. package/extensions/dm-lens/dist/clients/persist-worker-stats.js +16 -0
  370. package/extensions/dm-lens/dist/clients/persistent-reverify.js +167 -0
  371. package/extensions/dm-lens/dist/clients/php-cs-fixer-config.js +15 -0
  372. package/extensions/dm-lens/dist/clients/pipeline.js +1473 -0
  373. package/extensions/dm-lens/dist/clients/post-autofix-notice.js +19 -0
  374. package/extensions/dm-lens/dist/clients/print-mode.js +3 -0
  375. package/extensions/dm-lens/dist/clients/probe-home-state.js +73 -0
  376. package/extensions/dm-lens/dist/clients/process-bridge.js +48 -0
  377. package/extensions/dm-lens/dist/clients/process-singletons.js +69 -0
  378. package/extensions/dm-lens/dist/clients/process-snapshot.js +130 -0
  379. package/extensions/dm-lens/dist/clients/project-changes.js +180 -0
  380. package/extensions/dm-lens/dist/clients/project-conventions.js +152 -0
  381. package/extensions/dm-lens/dist/clients/project-diagnostics/cache.js +91 -0
  382. package/extensions/dm-lens/dist/clients/project-diagnostics/extractors.js +53 -0
  383. package/extensions/dm-lens/dist/clients/project-diagnostics/fresh-fetch.js +413 -0
  384. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +64 -0
  385. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +38 -0
  386. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +21 -0
  387. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +23 -0
  388. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +28 -0
  389. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +45 -0
  390. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +34 -0
  391. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +32 -0
  392. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +79 -0
  393. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +41 -0
  394. package/extensions/dm-lens/dist/clients/project-diagnostics/scanner.js +351 -0
  395. package/extensions/dm-lens/dist/clients/project-diagnostics/types.js +1 -0
  396. package/extensions/dm-lens/dist/clients/project-lens-config.js +462 -0
  397. package/extensions/dm-lens/dist/clients/project-report.js +527 -0
  398. package/extensions/dm-lens/dist/clients/project-root-markers.js +8 -0
  399. package/extensions/dm-lens/dist/clients/project-scale.js +60 -0
  400. package/extensions/dm-lens/dist/clients/project-scan-policy.js +4 -0
  401. package/extensions/dm-lens/dist/clients/project-snapshot-fingerprint.js +44 -0
  402. package/extensions/dm-lens/dist/clients/project-snapshot-persist-worker.js +31 -0
  403. package/extensions/dm-lens/dist/clients/project-snapshot.js +1355 -0
  404. package/extensions/dm-lens/dist/clients/project-trust.js +104 -0
  405. package/extensions/dm-lens/dist/clients/python-environment.js +388 -0
  406. package/extensions/dm-lens/dist/clients/python-provenance.js +551 -0
  407. package/extensions/dm-lens/dist/clients/quiet-window-config.js +16 -0
  408. package/extensions/dm-lens/dist/clients/quiet-window.js +129 -0
  409. package/extensions/dm-lens/dist/clients/read-bridge.js +53 -0
  410. package/extensions/dm-lens/dist/clients/read-expansion.js +218 -0
  411. package/extensions/dm-lens/dist/clients/read-guard-branch.js +126 -0
  412. package/extensions/dm-lens/dist/clients/read-guard-logger.js +186 -0
  413. package/extensions/dm-lens/dist/clients/read-guard-tool-lines.js +1044 -0
  414. package/extensions/dm-lens/dist/clients/read-guard.js +1517 -0
  415. package/extensions/dm-lens/dist/clients/recent-touches.js +126 -0
  416. package/extensions/dm-lens/dist/clients/redact/secrets.js +386 -0
  417. package/extensions/dm-lens/dist/clients/resource-sampler.js +344 -0
  418. package/extensions/dm-lens/dist/clients/reverse-deps.js +227 -0
  419. package/extensions/dm-lens/dist/clients/review-graph/builder.js +3780 -0
  420. package/extensions/dm-lens/dist/clients/review-graph/format.js +30 -0
  421. package/extensions/dm-lens/dist/clients/review-graph/git-identity.js +173 -0
  422. package/extensions/dm-lens/dist/clients/review-graph/import-resolvers.js +332 -0
  423. package/extensions/dm-lens/dist/clients/review-graph/persist-worker.js +8 -0
  424. package/extensions/dm-lens/dist/clients/review-graph/query.js +195 -0
  425. package/extensions/dm-lens/dist/clients/review-graph/revision-drift.js +3 -0
  426. package/extensions/dm-lens/dist/clients/review-graph/service.js +60 -0
  427. package/extensions/dm-lens/dist/clients/review-graph/shared-extraction-ir.js +54 -0
  428. package/extensions/dm-lens/dist/clients/review-graph/symbol-id.js +29 -0
  429. package/extensions/dm-lens/dist/clients/review-graph/tsconfig-paths.js +286 -0
  430. package/extensions/dm-lens/dist/clients/review-graph/types.js +1 -0
  431. package/extensions/dm-lens/dist/clients/review-graph/workspace-modules.js +374 -0
  432. package/extensions/dm-lens/dist/clients/review-graph-logger.js +51 -0
  433. package/extensions/dm-lens/dist/clients/ruff-client.js +107 -0
  434. package/extensions/dm-lens/dist/clients/rules-scanner.js +70 -0
  435. package/extensions/dm-lens/dist/clients/run-duration.js +9 -0
  436. package/extensions/dm-lens/dist/clients/runtime-agent-end.js +831 -0
  437. package/extensions/dm-lens/dist/clients/runtime-config.js +39 -0
  438. package/extensions/dm-lens/dist/clients/runtime-context.js +155 -0
  439. package/extensions/dm-lens/dist/clients/runtime-coordinator.js +1254 -0
  440. package/extensions/dm-lens/dist/clients/runtime-session.js +1806 -0
  441. package/extensions/dm-lens/dist/clients/runtime-tool-call.js +1026 -0
  442. package/extensions/dm-lens/dist/clients/runtime-tool-result.js +2068 -0
  443. package/extensions/dm-lens/dist/clients/runtime-turn.js +3198 -0
  444. package/extensions/dm-lens/dist/clients/rust-client.js +46 -0
  445. package/extensions/dm-lens/dist/clients/safe-spawn.js +1402 -0
  446. package/extensions/dm-lens/dist/clients/sanitize.js +5 -0
  447. package/extensions/dm-lens/dist/clients/scan-utils.js +7 -0
  448. package/extensions/dm-lens/dist/clients/scanner-temp-root.js +8 -0
  449. package/extensions/dm-lens/dist/clients/scratch-tree-policy.js +63 -0
  450. package/extensions/dm-lens/dist/clients/search-read-registration.js +76 -0
  451. package/extensions/dm-lens/dist/clients/secret-findings.js +69 -0
  452. package/extensions/dm-lens/dist/clients/security-scan-client.js +208 -0
  453. package/extensions/dm-lens/dist/clients/session-event-guard.js +111 -0
  454. package/extensions/dm-lens/dist/clients/session-lifecycle.js +309 -0
  455. package/extensions/dm-lens/dist/clients/session-repository.js +113 -0
  456. package/extensions/dm-lens/dist/clients/session-scope.js +451 -0
  457. package/extensions/dm-lens/dist/clients/session-start-observability.js +59 -0
  458. package/extensions/dm-lens/dist/clients/session-state-store.js +71 -0
  459. package/extensions/dm-lens/dist/clients/session-summary.js +8 -0
  460. package/extensions/dm-lens/dist/clients/sessionstart-logger.js +22 -0
  461. package/extensions/dm-lens/dist/clients/sg-runner.js +642 -0
  462. package/extensions/dm-lens/dist/clients/sgconfig.js +299 -0
  463. package/extensions/dm-lens/dist/clients/shared-checkout-guard.js +177 -0
  464. package/extensions/dm-lens/dist/clients/single-flight.js +53 -0
  465. package/extensions/dm-lens/dist/clients/situational-tool-telemetry.js +85 -0
  466. package/extensions/dm-lens/dist/clients/skills-resolver.js +38 -0
  467. package/extensions/dm-lens/dist/clients/slow-fs.js +77 -0
  468. package/extensions/dm-lens/dist/clients/smells-rollup.js +118 -0
  469. package/extensions/dm-lens/dist/clients/source-filter.js +323 -0
  470. package/extensions/dm-lens/dist/clients/source-walker.js +114 -0
  471. package/extensions/dm-lens/dist/clients/spawn-output-cap.js +35 -0
  472. package/extensions/dm-lens/dist/clients/spawn-timeout-cooldown.js +51 -0
  473. package/extensions/dm-lens/dist/clients/stale-marker.js +1 -0
  474. package/extensions/dm-lens/dist/clients/startup-scan.js +221 -0
  475. package/extensions/dm-lens/dist/clients/startup-timing.js +67 -0
  476. package/extensions/dm-lens/dist/clients/string-utils.js +6 -0
  477. package/extensions/dm-lens/dist/clients/subagent-mode.js +40 -0
  478. package/extensions/dm-lens/dist/clients/symbol-containment.js +16 -0
  479. package/extensions/dm-lens/dist/clients/symbol-types.js +1 -0
  480. package/extensions/dm-lens/dist/clients/test-runner-client.js +1686 -0
  481. package/extensions/dm-lens/dist/clients/test-runner-delivery.js +285 -0
  482. package/extensions/dm-lens/dist/clients/test-target-roots.js +17 -0
  483. package/extensions/dm-lens/dist/clients/todo-scanner.js +164 -0
  484. package/extensions/dm-lens/dist/clients/tool-agreement.js +640 -0
  485. package/extensions/dm-lens/dist/clients/tool-config.js +239 -0
  486. package/extensions/dm-lens/dist/clients/tool-cwd.js +236 -0
  487. package/extensions/dm-lens/dist/clients/tool-definition.js +22 -0
  488. package/extensions/dm-lens/dist/clients/tool-event.js +24 -0
  489. package/extensions/dm-lens/dist/clients/tool-policy.js +2386 -0
  490. package/extensions/dm-lens/dist/clients/tool-probe.js +13 -0
  491. package/extensions/dm-lens/dist/clients/tool-render.js +79 -0
  492. package/extensions/dm-lens/dist/clients/tool-set-policy.js +106 -0
  493. package/extensions/dm-lens/dist/clients/tree-sitter-cache.js +206 -0
  494. package/extensions/dm-lens/dist/clients/tree-sitter-client.js +3101 -0
  495. package/extensions/dm-lens/dist/clients/tree-sitter-logger.js +77 -0
  496. package/extensions/dm-lens/dist/clients/tree-sitter-navigator.js +198 -0
  497. package/extensions/dm-lens/dist/clients/tree-sitter-query-loader.js +401 -0
  498. package/extensions/dm-lens/dist/clients/tree-sitter-shared.js +87 -0
  499. package/extensions/dm-lens/dist/clients/tree-sitter-symbol-extractor.js +984 -0
  500. package/extensions/dm-lens/dist/clients/trivy-client.js +335 -0
  501. package/extensions/dm-lens/dist/clients/tui-fit.js +26 -0
  502. package/extensions/dm-lens/dist/clients/turn-context.js +48 -0
  503. package/extensions/dm-lens/dist/clients/turn-end/delivery-holds.js +59 -0
  504. package/extensions/dm-lens/dist/clients/turn-end/lane.js +1 -0
  505. package/extensions/dm-lens/dist/clients/turn-end/lanes/govulncheck.js +54 -0
  506. package/extensions/dm-lens/dist/clients/turn-end/lanes/secrets.js +131 -0
  507. package/extensions/dm-lens/dist/clients/turn-summary-render.js +56 -0
  508. package/extensions/dm-lens/dist/clients/turn-summary.js +84 -0
  509. package/extensions/dm-lens/dist/clients/typos-config.js +9 -0
  510. package/extensions/dm-lens/dist/clients/user-notify.js +15 -0
  511. package/extensions/dm-lens/dist/clients/vanished-instance-marker.js +18 -0
  512. package/extensions/dm-lens/dist/clients/warm-attach.js +232 -0
  513. package/extensions/dm-lens/dist/clients/widget-state.js +1014 -0
  514. package/extensions/dm-lens/dist/clients/word-index-logger.js +24 -0
  515. package/extensions/dm-lens/dist/clients/word-index-store.js +222 -0
  516. package/extensions/dm-lens/dist/clients/word-index.js +1503 -0
  517. package/extensions/dm-lens/dist/clients/workspace-topology.js +274 -0
  518. package/extensions/dm-lens/dist/clients/write-ordering-guard.js +28 -0
  519. package/extensions/dm-lens/dist/clients/zizmor-config.js +160 -0
  520. package/extensions/dm-lens/dist/i18n.js +67 -0
  521. package/extensions/dm-lens/dist/index.js +2144 -0
  522. package/extensions/dm-lens/dist/mcp/analyze-cli.js +205 -0
  523. package/extensions/dm-lens/dist/mcp/build-staleness.js +55 -0
  524. package/extensions/dm-lens/dist/mcp/cli.js +96 -0
  525. package/extensions/dm-lens/dist/mcp/server.js +1241 -0
  526. package/extensions/dm-lens/dist/mcp/tool-arguments.js +134 -0
  527. package/extensions/dm-lens/dist/mcp/worker.js +41 -0
  528. package/extensions/dm-lens/dist/scripts/lib/process-scan.mjs +375 -0
  529. package/extensions/dm-lens/dist/scripts/lib/skills-predicate.mjs +53 -0
  530. package/extensions/dm-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +51 -0
  531. package/extensions/dm-lens/dist/tools/activate-tools.js +63 -0
  532. package/extensions/dm-lens/dist/tools/ast-grep-outline.js +128 -0
  533. package/extensions/dm-lens/dist/tools/ast-grep-replace.js +234 -0
  534. package/extensions/dm-lens/dist/tools/ast-grep-search.js +690 -0
  535. package/extensions/dm-lens/dist/tools/effective-config.js +59 -0
  536. package/extensions/dm-lens/dist/tools/lens-diagnostic-mark.js +251 -0
  537. package/extensions/dm-lens/dist/tools/lens-diagnostics.js +1693 -0
  538. package/extensions/dm-lens/dist/tools/lsp-diagnostics.js +1397 -0
  539. package/extensions/dm-lens/dist/tools/lsp-navigation.js +1301 -0
  540. package/extensions/dm-lens/dist/tools/lsp-structured-output.js +277 -0
  541. package/extensions/dm-lens/dist/tools/module-report.js +333 -0
  542. package/extensions/dm-lens/dist/tools/project-report.js +72 -0
  543. package/extensions/dm-lens/dist/tools/render-compact.js +272 -0
  544. package/extensions/dm-lens/dist/tools/scan-progress.js +31 -0
  545. package/extensions/dm-lens/dist/tools/shared.js +46 -0
  546. package/extensions/dm-lens/dist/tools/symbol-search.js +133 -0
  547. package/extensions/dm-mcp-adapter/dist/abort.js +35 -0
  548. package/extensions/dm-mcp-adapter/dist/agent-dir.js +45 -0
  549. package/extensions/dm-mcp-adapter/dist/agent-plugin-loader.js +392 -0
  550. package/extensions/dm-mcp-adapter/dist/agent-plugin-provenance.js +26 -0
  551. package/extensions/dm-mcp-adapter/dist/bearer-command-resolver.js +184 -0
  552. package/extensions/dm-mcp-adapter/dist/claude-plugin-loader.js +350 -0
  553. package/extensions/dm-mcp-adapter/dist/config.js +1984 -0
  554. package/extensions/dm-mcp-adapter/dist/consent-manager.js +84 -0
  555. package/extensions/dm-mcp-adapter/dist/elicitation-handler.js +374 -0
  556. package/extensions/dm-mcp-adapter/dist/errors.js +225 -0
  557. package/extensions/dm-mcp-adapter/dist/extraction-settings.js +43 -0
  558. package/extensions/dm-mcp-adapter/dist/http-ca.js +75 -0
  559. package/extensions/dm-mcp-adapter/dist/jev-client.js +359 -0
  560. package/extensions/dm-mcp-adapter/dist/jev-contracts.js +1 -0
  561. package/extensions/dm-mcp-adapter/dist/jev-key-store.js +189 -0
  562. package/extensions/dm-mcp-adapter/dist/json-schema-validator.js +70 -0
  563. package/extensions/dm-mcp-adapter/dist/lifecycle.js +387 -0
  564. package/extensions/dm-mcp-adapter/dist/logger.js +115 -0
  565. package/extensions/dm-mcp-adapter/dist/mcp-auth-fetch.js +86 -0
  566. package/extensions/dm-mcp-adapter/dist/mcp-auth-flow.js +956 -0
  567. package/extensions/dm-mcp-adapter/dist/mcp-auth.js +998 -0
  568. package/extensions/dm-mcp-adapter/dist/mcp-bearer-store.js +182 -0
  569. package/extensions/dm-mcp-adapter/dist/mcp-callback-server.js +380 -0
  570. package/extensions/dm-mcp-adapter/dist/mcp-oauth-provider.js +525 -0
  571. package/extensions/dm-mcp-adapter/dist/mcp-probe.js +151 -0
  572. package/extensions/dm-mcp-adapter/dist/mcp-tasks.js +339 -0
  573. package/extensions/dm-mcp-adapter/dist/mcp-trace.js +220 -0
  574. package/extensions/dm-mcp-adapter/dist/metadata-cache.js +411 -0
  575. package/extensions/dm-mcp-adapter/dist/npx-resolver.js +465 -0
  576. package/extensions/dm-mcp-adapter/dist/output-shape.js +312 -0
  577. package/extensions/dm-mcp-adapter/dist/package-mcp-loader.js +144 -0
  578. package/extensions/dm-mcp-adapter/dist/project-server-trust.js +274 -0
  579. package/extensions/dm-mcp-adapter/dist/request-headers-command.js +310 -0
  580. package/extensions/dm-mcp-adapter/dist/resource-tools.js +7 -0
  581. package/extensions/dm-mcp-adapter/dist/runtime-owner.js +95 -0
  582. package/extensions/dm-mcp-adapter/dist/sampling-handler.js +219 -0
  583. package/extensions/dm-mcp-adapter/dist/script-tools.js +72 -0
  584. package/extensions/dm-mcp-adapter/dist/secure-keyring.js +191 -0
  585. package/extensions/dm-mcp-adapter/dist/semantic-settings.js +51 -0
  586. package/extensions/dm-mcp-adapter/dist/server-log.js +19 -0
  587. package/extensions/dm-mcp-adapter/dist/server-manager.js +1635 -0
  588. package/extensions/dm-mcp-adapter/dist/session-approvals.js +127 -0
  589. package/extensions/dm-mcp-adapter/dist/session-recovery.js +83 -0
  590. package/extensions/dm-mcp-adapter/dist/state.js +1 -0
  591. package/extensions/dm-mcp-adapter/dist/task-entries.js +60 -0
  592. package/extensions/dm-mcp-adapter/dist/task-jobs.js +259 -0
  593. package/extensions/dm-mcp-adapter/dist/ts-shape.js +157 -0
  594. package/extensions/dm-mcp-adapter/dist/types.js +293 -0
  595. package/extensions/dm-mcp-adapter/dist/ui-app-bridge-helpers.js +36 -0
  596. package/extensions/dm-mcp-adapter/dist/ui-resource-handler.js +204 -0
  597. package/extensions/dm-mcp-adapter/dist/ui-stream-types.js +58 -0
  598. package/extensions/dm-mcp-adapter/dist/ui-tool-visibility.js +26 -0
  599. package/extensions/dm-mcp-adapter/dist/unix-socket-transport.js +83 -0
  600. package/extensions/dm-mcp-adapter/dist/utils.js +444 -0
  601. package/extensions/dm-mcp-adapter/mcp-keyring-helper.cjs +1 -1
  602. package/extensions/dm-ponytail/hooks/ponytail-activate.js +1 -1
  603. package/extensions/dm-ponytail/hooks/ponytail-instructions.js +1 -1
  604. package/extensions/dm-ponytail/hooks/ponytail-mode-tracker.js +1 -1
  605. package/package.json +1 -1
@@ -0,0 +1,1473 @@
1
+ import * as nodeFs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { hashFileBytes, stampContentBytes } from "./content-stamp.js";
4
+ import { PathKeyedMap } from "./path-keyed-map.js";
5
+ import { findNearestContaining, normalizeEphemeralMapKey, normalizeMapKey, realpathOrResolve } from "./path-utils.js";
6
+ import { inlineBlockerLines, inlineBlockerSources } from "./inline-blocker-fields.js";
7
+ import { recordFromDispatchDiagnostic } from "./actionable-warnings.js";
8
+ import { recordFromCodeQualityDiagnostic } from "./code-quality-warnings.js";
9
+ import { admitWidgetDiagnosticsWrite, recordDiagnostics } from "./widget-state.js";
10
+ import { writeOrderToken } from "./write-ordering-guard.js";
11
+ import { getDiagnosticLogger } from "./diagnostic-logger.js";
12
+ import { getDiagnosticTracker } from "./diagnostic-tracker.js";
13
+ import { ANY_POSITION, retainRecordedFindings } from "./finding-identity.js";
14
+ import { alignLines, boundedAnchor, lineHashesOf, lineHashOf, linesOfRanges, linesOwedByContent, owedContentOf, owedRangesAfterDispatch, rangesOfLines, stampLineHashes } from "./line-alignment.js";
15
+ import { loadDispatchIntegration } from "./dispatch/lazy.js";
16
+ import { toRunnerDisplayPath } from "./dispatch/runner-context.js";
17
+ import { classifyProbeFailure, createAvailabilityChecker, createAvailabilityLatch, describeProbeEvidence, logAvailabilityDecision, startHostStallSampler, resolveAvailableOrInstall, resolveCommandArgsWithInstallFallback, resolveToolCommand, resolveToolCommandWithInstallFallback } from "./dispatch/runners/utils/runner-helpers.js";
18
+ import { findDetektConfig } from "./dispatch/runners/detekt.js";
19
+ import { checkedWholeFile, spanOverlapsModifiedRanges } from "./dispatch/types.js";
20
+ import { formatDiagnostics, formatPromotionNotes } from "./dispatch/utils/format-utils.js";
21
+ import { detectFileKind, getFileKindLabel } from "./file-kinds.js";
22
+ import { detectFileChangedAfterCommand, getProjectIgnoreMatcher, isExcludedDirName } from "./file-utils.js";
23
+ import { resolveAnalysisRoot } from "./analysis-root.js";
24
+ import { emitBounded } from "./bounded-telemetry.js";
25
+ import { logLatency } from "./latency-logger.js";
26
+ import { emitLensAnalysisComplete } from "./lens-events.js";
27
+ import { publishFilesTouched } from "./bus-publish.js";
28
+ import { publishDiagnostics, wasPreviouslyReportedDirty } from "./diagnostics-publish.js";
29
+ import { loadLspService } from "./lsp-lazy.js";
30
+ import { clearGraphCache } from "./review-graph/builder.js";
31
+ import { classifyTreeSitterWasmError } from "./tree-sitter-client.js";
32
+ import { BoundedLruCache } from "./bounded-cache.js";
33
+ import { RUNTIME_CONFIG } from "./runtime-config.js";
34
+ import { getAmbientAbortSignal, safeSpawnAsync } from "./safe-spawn.js";
35
+ import { probeToolAsync } from "./tool-probe.js";
36
+ import { renderFixRunLoss, runWithFixRestore } from "./fix-run-restore.js";
37
+ import { bounded } from "./deadline-utils.js";
38
+ import { HOOK_WALL_BUDGET_MS } from "./hook-budgets.js";
39
+ import { enabledAuxiliaryLspServerIds } from "./dispatch/auxiliary-lsp.js";
40
+ import { incrementDegradationCount, recordDegradationOnce } from "./degradation-ledger.js";
41
+ import { holdFileMutationQueue } from "./file-mutation-queue.js";
42
+ import { establishToolAgreement } from "./tool-agreement.js";
43
+ import { dropFindingsForMissingPaths } from "./advisory-provenance.js";
44
+ import { getAutofixPolicyForFile, getPreferredAutofixTools, getRubocopCommand, hasBiomeConfig, hasDetektConfig, hasEslintConfig, hasGolangciConfig, hasKtfmtConfig, hasKtlintConfig, hasOxlintConfig, hasRubocopConfig, hasSqlfluffConfig, hasStylelintConfig, markdownlintConfigArgs } from "./tool-policy.js";
45
+ import { exceedsLspSyncLimits } from "./lsp/content-limits.js";
46
+ import { surfaceHandlerCrash } from "./session-event-guard.js";
47
+ const LSP_SPAWN_BUDGET_MS = RUNTIME_CONFIG.pipeline.lspSpawnBudgetMs;
48
+ const AUTOFIX_CHANGED_FILE_SCAN_LIMIT = 5000;
49
+ function lspSyncBudgetMs() {
50
+ const raw = Number(process.env.DM_LENS_LSP_SYNC_BUDGET_MS);
51
+ return Number.isFinite(raw) && raw > 0 ? raw : 3000;
52
+ }
53
+ const SNAPSHOT_YIELD_EVERY = 500;
54
+ async function snapshotDirInto(dir, ignoreMatcher, stack, snapshot, counter) {
55
+ let entries;
56
+ try {
57
+ entries = await nodeFs.promises.readdir(dir, { withFileTypes: true });
58
+ } catch {
59
+ return;
60
+ }
61
+ for (const entry of entries) {
62
+ const fullPath = path.join(dir, entry.name);
63
+ if (entry.isDirectory()) {
64
+ if (!isExcludedDirName(entry.name) && !ignoreMatcher.isIgnored(fullPath, true)) {
65
+ stack.push(fullPath);
66
+ }
67
+ continue;
68
+ }
69
+ if (!entry.isFile())
70
+ continue;
71
+ if (ignoreMatcher.isIgnored(fullPath, false))
72
+ continue;
73
+ try {
74
+ const stat = await nodeFs.promises.stat(fullPath);
75
+ snapshot.set(path.resolve(fullPath), {
76
+ mtimeMs: stat.mtimeMs,
77
+ size: stat.size
78
+ });
79
+ } catch {}
80
+ if (++counter.n % SNAPSHOT_YIELD_EVERY === 0) {
81
+ await new Promise((resolve) => setImmediate(resolve));
82
+ }
83
+ }
84
+ }
85
+ export async function snapshotProjectFiles(root) {
86
+ const snapshot = new Map;
87
+ const projectRoot = path.resolve(root);
88
+ const ignoreMatcher = getProjectIgnoreMatcher(projectRoot);
89
+ await ignoreMatcher.ensureTrackedIndex();
90
+ const stack = [projectRoot];
91
+ const counter = { n: 0 };
92
+ while (stack.length > 0 && snapshot.size < AUTOFIX_CHANGED_FILE_SCAN_LIMIT) {
93
+ await snapshotDirInto(stack.pop(), ignoreMatcher, stack, snapshot, counter);
94
+ }
95
+ return snapshot;
96
+ }
97
+ async function diffProjectSnapshot(root, before) {
98
+ const after = await snapshotProjectFiles(root);
99
+ const changed = new Set;
100
+ for (const [filePath, next] of after) {
101
+ const prev = before.get(filePath);
102
+ if (prev?.mtimeMs !== next.mtimeMs || prev?.size !== next.size) {
103
+ changed.add(filePath);
104
+ }
105
+ }
106
+ for (const filePath of before.keys()) {
107
+ if (!after.has(filePath))
108
+ changed.add(filePath);
109
+ }
110
+ return [...changed].sort((a, b) => a.localeCompare(b));
111
+ }
112
+ function createPhaseTracker(toolName, filePath) {
113
+ const phases = [];
114
+ return {
115
+ start(name) {
116
+ phases.push({ name, startTime: Date.now(), ended: false });
117
+ },
118
+ end(name, metadata) {
119
+ const p = phases.find((x) => x.name === name && !x.ended);
120
+ if (p) {
121
+ p.ended = true;
122
+ logLatency({
123
+ type: "phase",
124
+ toolName,
125
+ filePath,
126
+ phase: name,
127
+ durationMs: Date.now() - p.startTime,
128
+ metadata
129
+ });
130
+ }
131
+ }
132
+ };
133
+ }
134
+
135
+ export { hasEslintConfig, hasSqlfluffConfig, hasStylelintConfig };
136
+ const ESLINT_FIX_PROBE_BUDGET_MS = 5000;
137
+ const _eslintCache = new BoundedLruCache(32);
138
+ async function tryEslintFix(filePath, cwd, writeHold) {
139
+ const userHasConfig = hasEslintConfig(cwd);
140
+ if (!userHasConfig)
141
+ return 0;
142
+ const cacheKey = `${path.resolve(cwd)}|${process.env.PATH ?? ""}`;
143
+ let cached = _eslintCache.get(cacheKey);
144
+ if (!cached) {
145
+ cached = { latch: createAvailabilityLatch(), bin: null };
146
+ _eslintCache.set(cacheKey, cached);
147
+ }
148
+ if (cached.latch.read() === null) {
149
+ const candidate = resolveToolCommand(cwd, "eslint") ?? "eslint";
150
+ const stallSampler = startHostStallSampler();
151
+ const startedAt = Date.now();
152
+ let check;
153
+ let hostStallMs;
154
+ try {
155
+ check = await safeSpawnAsync(candidate, ["--version"], {
156
+ timeout: ESLINT_FIX_PROBE_BUDGET_MS,
157
+ cwd
158
+ });
159
+ } finally {
160
+ hostStallMs = stallSampler.stop();
161
+ }
162
+ const elapsedMs = Date.now() - startedAt;
163
+ const decisionCwd = path.resolve(cwd);
164
+ if (!check.error && check.status === 0) {
165
+ cached.bin = candidate;
166
+ cached.latch.noteAvailable();
167
+ logAvailabilityDecision({
168
+ tool: "eslint",
169
+ verdict: "available",
170
+ outcome: "success",
171
+ cause: "ok",
172
+ elapsedMs,
173
+ latched: true,
174
+ hostStallMs,
175
+ budgetMs: ESLINT_FIX_PROBE_BUDGET_MS,
176
+ classifiedBy: "probe",
177
+ evidence: describeProbeEvidence(check, "eslint")
178
+ }, decisionCwd);
179
+ } else {
180
+ cached.bin = null;
181
+ const { outcome, cause, evidence } = classifyProbeFailure(check, {
182
+ hostStallMs,
183
+ command: "eslint"
184
+ });
185
+ const retryAfterMs = cached.latch.noteUnavailable(outcome, cause);
186
+ logAvailabilityDecision({
187
+ tool: "eslint",
188
+ verdict: "unavailable",
189
+ outcome,
190
+ cause,
191
+ elapsedMs,
192
+ latched: retryAfterMs === 0,
193
+ hostStallMs,
194
+ ...retryAfterMs > 0 && { retryAfterMs },
195
+ budgetMs: ESLINT_FIX_PROBE_BUDGET_MS,
196
+ classifiedBy: "probe",
197
+ evidence
198
+ }, decisionCwd);
199
+ }
200
+ }
201
+ if (cached.latch.read() !== true || !cached.bin)
202
+ return 0;
203
+ const cmd = cached.bin;
204
+ if (writeHold)
205
+ await writeHold.acquire();
206
+ return detectFileChangedAfterCommand(filePath, cmd, ["--fix", "--no-error-on-unmatched-pattern", filePath], cwd, [1]);
207
+ }
208
+ async function tryStylelintFix(filePath, cwd, writeHold) {
209
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "stylelint");
210
+ if (!cmd)
211
+ return 0;
212
+ if (writeHold)
213
+ await writeHold.acquire();
214
+ return detectFileChangedAfterCommand(filePath, cmd, ["--fix", "--allow-empty-input", filePath], cwd, [2]);
215
+ }
216
+ async function trySqlfluffFix(filePath, cwd, writeHold) {
217
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "sqlfluff");
218
+ if (!cmd)
219
+ return 0;
220
+ if (writeHold)
221
+ await writeHold.acquire();
222
+ const args = ["fix", "--force", filePath];
223
+ if (!hasSqlfluffConfig(cwd)) {
224
+ args.splice(2, 0, "--dialect", "ansi");
225
+ }
226
+ return detectFileChangedAfterCommand(filePath, cmd, args, cwd);
227
+ }
228
+ async function tryRubocopFix(filePath, cwd, writeHold) {
229
+ const resolved = await resolveCommandArgsWithInstallFallback(getRubocopCommand(cwd), "rubocop", cwd, ["--version"], 1e4);
230
+ if (!resolved)
231
+ return 0;
232
+ if (writeHold)
233
+ await writeHold.acquire();
234
+ return detectFileChangedAfterCommand(filePath, resolved.cmd, [...resolved.args, "-a", "--no-color", filePath], cwd, [1]);
235
+ }
236
+ async function tryKtlintFix(filePath, cwd, writeHold) {
237
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "ktlint");
238
+ if (!cmd)
239
+ return 0;
240
+ if (writeHold)
241
+ await writeHold.acquire();
242
+ return detectFileChangedAfterCommand(filePath, cmd, ["-F", filePath], cwd, [1]);
243
+ }
244
+ const golangciAutofixChecker = createAvailabilityChecker("golangci-lint", ".exe");
245
+ const detektAutofixChecker = createAvailabilityChecker("detekt", ".bat");
246
+ const ktfmtAutofixChecker = createAvailabilityChecker("ktfmt", ".bat");
247
+ async function tryKtfmtFix(filePath, cwd, writeHold) {
248
+ const cmd = await resolveAvailableOrInstall(ktfmtAutofixChecker, "ktfmt", cwd);
249
+ if (!cmd)
250
+ return 0;
251
+ if (writeHold)
252
+ await writeHold.acquire();
253
+ const absPath = path.resolve(cwd, filePath);
254
+ return detectFileChangedAfterCommand(filePath, cmd, [absPath], cwd, [0]);
255
+ }
256
+ async function tryGolangciLintFix(filePath, cwd, writeHold) {
257
+ const cmd = await resolveAvailableOrInstall(golangciAutofixChecker, "golangci-lint", cwd);
258
+ if (!cmd)
259
+ return 0;
260
+ if (writeHold)
261
+ await writeHold.acquire();
262
+ return detectFileChangedAfterCommand(filePath, cmd, ["run", "--fix", filePath], cwd, [1, 7]);
263
+ }
264
+ async function tryDetektFix(filePath, cwd, writeHold) {
265
+ const configPath = findDetektConfig(cwd);
266
+ if (!configPath)
267
+ return 0;
268
+ if (!await detektAutofixChecker.isAvailableAsync(cwd))
269
+ return 0;
270
+ const cmd = detektAutofixChecker.getCommand(cwd);
271
+ if (!cmd)
272
+ return 0;
273
+ if (writeHold)
274
+ await writeHold.acquire();
275
+ const absPath = path.resolve(cwd, filePath);
276
+ return detectFileChangedAfterCommand(filePath, cmd, ["--auto-correct", "--input", absPath, "--config", configPath], cwd, [1, 2]);
277
+ }
278
+ async function tryMarkdownlintFix(filePath, cwd, writeHold) {
279
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "markdownlint");
280
+ if (!cmd)
281
+ return 0;
282
+ if (writeHold)
283
+ await writeHold.acquire();
284
+ return detectFileChangedAfterCommand(filePath, cmd, [...markdownlintConfigArgs(cwd), "--fix", filePath], cwd, [1]);
285
+ }
286
+ async function tryOxlintFix(filePath, cwd, writeHold) {
287
+ const cmd = await resolveToolCommandWithInstallFallback(cwd, "oxlint");
288
+ if (!cmd)
289
+ return 0;
290
+ if (writeHold)
291
+ await writeHold.acquire();
292
+ return detectFileChangedAfterCommand(filePath, cmd, ["--fix", filePath], cwd, [1]);
293
+ }
294
+ function displayLoss(cwd, restoring) {
295
+ return restoring.then((report) => ({
296
+ lost: report.lost.map((f) => toRunnerDisplayPath(cwd, f)),
297
+ possiblyLost: report.possiblyLost.map((f) => toRunnerDisplayPath(cwd, f))
298
+ }));
299
+ }
300
+ function deliverFixRunLoss(restoring, ctx) {
301
+ restoring.then((loss) => {
302
+ if (loss.lost.length > 0 || loss.possiblyLost.length > 0)
303
+ ctx.onFixRunLoss?.(renderFixRunLoss(loss));
304
+ }).catch((failure) => ctx.dbg(`fix-run loss notice failed: ${failure instanceof Error ? failure.message : String(failure)}`));
305
+ }
306
+ async function wholePackageChangedFiles(root, before, result, agentEdited) {
307
+ if (result.error || result.status !== 0)
308
+ return [];
309
+ const edited = new Set(agentEdited);
310
+ const changed = await diffProjectSnapshot(root, before);
311
+ return changed.flatMap((file) => edited.has(file) ? [] : [file]);
312
+ }
313
+ async function tryRustClippyFix(filePath, writeHold) {
314
+ const none = { changedFiles: [] };
315
+ const check = await probeToolAsync("cargo", ["--version"], { timeout: 5000 });
316
+ if (check.error || check.status !== 0)
317
+ return none;
318
+ const cargoDir = findNearestContaining(path.dirname(realpathOrResolve(filePath)), ["Cargo.toml"]);
319
+ if (!cargoDir)
320
+ return none;
321
+ if (writeHold)
322
+ await writeHold.acquire();
323
+ const before = await snapshotProjectFiles(cargoDir);
324
+ const { result: changedFiles, restoring } = await runWithFixRestore({ tool: "rust-clippy", extension: ".rs", candidates: before.keys() }, () => safeSpawnAsync("cargo", ["clippy", "--fix", "--allow-dirty", "--allow-staged", "-q"], { timeout: 30000, cwd: cargoDir }), (result, agentEdited) => wholePackageChangedFiles(cargoDir, before, result, agentEdited));
325
+ return { changedFiles, restoring };
326
+ }
327
+ async function tryDartFix(filePath, writeHold) {
328
+ const none = { changedFiles: [] };
329
+ const check = await probeToolAsync("dart", ["--version"], { timeout: 5000 });
330
+ if (check.error || check.status !== 0)
331
+ return none;
332
+ const pubspecDir = findNearestContaining(path.dirname(realpathOrResolve(filePath)), ["pubspec.yaml"]);
333
+ if (!pubspecDir)
334
+ return none;
335
+ if (writeHold)
336
+ await writeHold.acquire();
337
+ const before = await snapshotProjectFiles(pubspecDir);
338
+ const { result: changedFiles, restoring } = await runWithFixRestore({ tool: "dart-analyze", extension: ".dart", candidates: before.keys() }, () => safeSpawnAsync("dart", ["fix", "--apply"], {
339
+ timeout: 30000,
340
+ cwd: pubspecDir
341
+ }), (result, agentEdited) => wholePackageChangedFiles(pubspecDir, before, result, agentEdited));
342
+ return { changedFiles, restoring };
343
+ }
344
+ export async function runAutofix(filePath, cwd, getFlag, dbg, deps, getFlagSource, writeHold, sessionRoot = cwd) {
345
+ if (resolveAnalysisRoot(filePath, sessionRoot) === "adopted") {
346
+ emitBounded("adopted_root_writer_skipped", `${filePath}:autofix`, {
347
+ filePath,
348
+ durationMs: 0,
349
+ metadata: { writer: "autofix" }
350
+ }, { ledgerKind: "adopted-root-writer-skipped", risingEdgePer: "identity" });
351
+ return {
352
+ fixedCount: 0,
353
+ autofixTools: [],
354
+ attemptedTools: [],
355
+ changedFiles: [],
356
+ needsContentRefresh: false,
357
+ skipReason: "adopted_root"
358
+ };
359
+ }
360
+ const { biomeClient, ruffClient, fixedThisTurn } = deps;
361
+ const noAutofix = getFlag("no-autofix", filePath);
362
+ let fixedCount = 0;
363
+ const autofixTools = [];
364
+ const attemptedTools = [];
365
+ const changedFiles = new Set;
366
+ const restorings = [];
367
+ const markTargetChanged = () => changedFiles.add(path.resolve(filePath));
368
+ let needsContentRefresh = false;
369
+ if (fixedThisTurn.has(filePath)) {
370
+ dbg(`autofix: skipped for ${filePath} (already fixed this turn)`);
371
+ return {
372
+ fixedCount,
373
+ autofixTools,
374
+ attemptedTools,
375
+ changedFiles: [],
376
+ needsContentRefresh,
377
+ skipReason: "already_fixed_this_turn"
378
+ };
379
+ }
380
+ if (noAutofix) {
381
+ const source = getFlagSource?.("no-autofix", filePath);
382
+ dbg(`autofix: skipped for ${filePath} (--no-autofix${source ? `, source=${source}` : ""})`);
383
+ return {
384
+ fixedCount,
385
+ autofixTools,
386
+ attemptedTools,
387
+ changedFiles: [],
388
+ needsContentRefresh,
389
+ skipReason: "disabled_by_flag"
390
+ };
391
+ }
392
+ const autofixContext = {
393
+ hasEslintConfig: hasEslintConfig(cwd),
394
+ hasStylelintConfig: hasStylelintConfig(cwd),
395
+ hasSqlfluffConfig: hasSqlfluffConfig(cwd),
396
+ hasRubocopConfig: hasRubocopConfig(cwd),
397
+ hasBiomeConfig: hasBiomeConfig(cwd),
398
+ hasGolangciConfig: hasGolangciConfig(cwd),
399
+ hasDetektConfig: hasDetektConfig(cwd),
400
+ hasKtfmtConfig: hasKtfmtConfig(cwd),
401
+ hasKtlintConfig: hasKtlintConfig(cwd),
402
+ hasOxlintConfig: hasOxlintConfig(cwd)
403
+ };
404
+ const autofixPolicy = getAutofixPolicyForFile(filePath, autofixContext);
405
+ const preferredAutofixTools = autofixPolicy?.safe ? getPreferredAutofixTools(filePath, autofixContext) : [];
406
+ dbg(`autofix: policy for ${filePath} -> ${autofixPolicy?.defaultTool ?? "none"} ` + `(preferred: ${preferredAutofixTools.join(",") || "none"}, gate: ${autofixPolicy?.gate ?? "none"}, safe: ${autofixPolicy?.safe ? "yes" : "no"})`);
407
+ if (!autofixPolicy) {
408
+ dbg(`autofix: no policy for ${filePath}`);
409
+ return {
410
+ fixedCount,
411
+ autofixTools,
412
+ attemptedTools,
413
+ changedFiles: [],
414
+ needsContentRefresh,
415
+ skipReason: "no_policy"
416
+ };
417
+ }
418
+ if (!autofixPolicy.safe || preferredAutofixTools.length === 0) {
419
+ dbg(`autofix: no safe preferred tools for ${filePath}`);
420
+ return {
421
+ fixedCount,
422
+ autofixTools,
423
+ attemptedTools,
424
+ changedFiles: [],
425
+ needsContentRefresh,
426
+ skipReason: "no_safe_tools"
427
+ };
428
+ }
429
+ for (const toolName of preferredAutofixTools) {
430
+ attemptedTools.push(toolName);
431
+ const agreement = establishToolAgreement(toolName, cwd);
432
+ if (agreement.decision === "decline") {
433
+ const reason = agreement.reason;
434
+ dbg(`autofix: ${toolName} declined (${reason})`);
435
+ recordDegradationOnce({
436
+ kind: "autofix-agreement-unavailable",
437
+ subject: agreement.subject,
438
+ reason
439
+ });
440
+ continue;
441
+ }
442
+ if (toolName === "ruff") {
443
+ const ruffReady = ruffClient.isPythonFile(filePath) ? await ruffClient.ensureAvailable() : false;
444
+ if (!ruffReady) {
445
+ dbg(`autofix: ruff unavailable for ${filePath}`);
446
+ continue;
447
+ }
448
+ if (writeHold)
449
+ await writeHold.acquire();
450
+ const result = await ruffClient.fixFileAsync(filePath, cwd);
451
+ if (result.success && result.fixed > 0) {
452
+ fixedCount += result.fixed;
453
+ autofixTools.push(`ruff:${result.fixed}`);
454
+ fixedThisTurn.add(filePath);
455
+ markTargetChanged();
456
+ dbg(`autofix: ruff fixed ${result.fixed} issue(s) in ${filePath}`);
457
+ needsContentRefresh = true;
458
+ }
459
+ continue;
460
+ }
461
+ if (toolName === "biome") {
462
+ const biomeReady = biomeClient.isSupportedFile(filePath) ? await biomeClient.ensureAvailable() : false;
463
+ if (!biomeReady) {
464
+ dbg(`autofix: biome unavailable or unsupported for ${filePath}`);
465
+ continue;
466
+ }
467
+ if (writeHold)
468
+ await writeHold.acquire();
469
+ const result = await biomeClient.fixFileAsync(filePath, cwd);
470
+ if (result.success && result.fixed > 0) {
471
+ fixedCount += result.fixed;
472
+ autofixTools.push(`biome:${result.fixed}`);
473
+ fixedThisTurn.add(filePath);
474
+ markTargetChanged();
475
+ dbg(`autofix: biome fixed ${result.fixed} issue(s) in ${filePath}`);
476
+ needsContentRefresh = true;
477
+ }
478
+ continue;
479
+ }
480
+ if (toolName === "eslint") {
481
+ const eslintFixed = await tryEslintFix(filePath, cwd, writeHold);
482
+ if (eslintFixed > 0) {
483
+ fixedCount += eslintFixed;
484
+ autofixTools.push(`eslint:${eslintFixed}`);
485
+ fixedThisTurn.add(filePath);
486
+ markTargetChanged();
487
+ dbg(`autofix: eslint fixed ${eslintFixed} issue(s) in ${filePath}`);
488
+ needsContentRefresh = true;
489
+ }
490
+ continue;
491
+ }
492
+ if (toolName === "stylelint") {
493
+ const stylelintFixed = await tryStylelintFix(filePath, cwd, writeHold);
494
+ if (stylelintFixed > 0) {
495
+ fixedCount += stylelintFixed;
496
+ autofixTools.push(`stylelint:${stylelintFixed}`);
497
+ fixedThisTurn.add(filePath);
498
+ markTargetChanged();
499
+ dbg(`autofix: stylelint fixed ${stylelintFixed} issue(s) in ${filePath}`);
500
+ needsContentRefresh = true;
501
+ }
502
+ continue;
503
+ }
504
+ if (toolName === "sqlfluff") {
505
+ const sqlfluffFixed = await trySqlfluffFix(filePath, cwd, writeHold);
506
+ if (sqlfluffFixed > 0) {
507
+ fixedCount += sqlfluffFixed;
508
+ autofixTools.push(`sqlfluff:${sqlfluffFixed}`);
509
+ fixedThisTurn.add(filePath);
510
+ markTargetChanged();
511
+ dbg(`autofix: sqlfluff fixed ${sqlfluffFixed} issue(s) in ${filePath}`);
512
+ needsContentRefresh = true;
513
+ }
514
+ continue;
515
+ }
516
+ if (toolName === "rubocop") {
517
+ const rubocopFixed = await tryRubocopFix(filePath, cwd, writeHold);
518
+ if (rubocopFixed > 0) {
519
+ fixedCount += rubocopFixed;
520
+ autofixTools.push(`rubocop:${rubocopFixed}`);
521
+ fixedThisTurn.add(filePath);
522
+ markTargetChanged();
523
+ dbg(`autofix: rubocop fixed ${rubocopFixed} issue(s) in ${filePath}`);
524
+ needsContentRefresh = true;
525
+ }
526
+ continue;
527
+ }
528
+ if (toolName === "ktlint") {
529
+ const ktlintFixed = await tryKtlintFix(filePath, cwd, writeHold);
530
+ if (ktlintFixed > 0) {
531
+ fixedCount += ktlintFixed;
532
+ autofixTools.push(`ktlint:${ktlintFixed}`);
533
+ fixedThisTurn.add(filePath);
534
+ markTargetChanged();
535
+ dbg(`autofix: ktlint fixed ${ktlintFixed} issue(s) in ${filePath}`);
536
+ needsContentRefresh = true;
537
+ }
538
+ continue;
539
+ }
540
+ if (toolName === "rust-clippy") {
541
+ const clippy = await tryRustClippyFix(filePath, writeHold);
542
+ const clippyChangedFiles = clippy.changedFiles;
543
+ if (clippy.restoring)
544
+ restorings.push(displayLoss(cwd, clippy.restoring));
545
+ if (clippyChangedFiles.length > 0) {
546
+ fixedCount += clippyChangedFiles.length;
547
+ autofixTools.push(`rust-clippy:${clippyChangedFiles.length}`);
548
+ fixedThisTurn.add(filePath);
549
+ for (const changedFile of clippyChangedFiles)
550
+ changedFiles.add(changedFile);
551
+ dbg(`autofix: rust-clippy changed ${clippyChangedFiles.length} file(s) from ${filePath}`);
552
+ needsContentRefresh = true;
553
+ }
554
+ continue;
555
+ }
556
+ if (toolName === "dart-analyze") {
557
+ const dart = await tryDartFix(filePath, writeHold);
558
+ const dartChangedFiles = dart.changedFiles;
559
+ if (dart.restoring)
560
+ restorings.push(displayLoss(cwd, dart.restoring));
561
+ if (dartChangedFiles.length > 0) {
562
+ fixedCount += dartChangedFiles.length;
563
+ autofixTools.push(`dart-analyze:${dartChangedFiles.length}`);
564
+ fixedThisTurn.add(filePath);
565
+ for (const changedFile of dartChangedFiles)
566
+ changedFiles.add(changedFile);
567
+ dbg(`autofix: dart fix changed ${dartChangedFiles.length} file(s) from ${filePath}`);
568
+ needsContentRefresh = true;
569
+ }
570
+ continue;
571
+ }
572
+ if (toolName === "golangci-lint") {
573
+ const fixed = await tryGolangciLintFix(filePath, cwd, writeHold);
574
+ if (fixed > 0) {
575
+ fixedCount += fixed;
576
+ autofixTools.push(`golangci-lint:${fixed}`);
577
+ fixedThisTurn.add(filePath);
578
+ markTargetChanged();
579
+ dbg(`autofix: golangci-lint fixed ${filePath}`);
580
+ needsContentRefresh = true;
581
+ }
582
+ continue;
583
+ }
584
+ if (toolName === "detekt") {
585
+ const fixed = await tryDetektFix(filePath, cwd, writeHold);
586
+ if (fixed > 0) {
587
+ fixedCount += fixed;
588
+ autofixTools.push(`detekt:${fixed}`);
589
+ fixedThisTurn.add(filePath);
590
+ markTargetChanged();
591
+ dbg(`autofix: detekt --auto-correct fixed ${filePath}`);
592
+ needsContentRefresh = true;
593
+ }
594
+ continue;
595
+ }
596
+ if (toolName === "ktfmt") {
597
+ const fixed = await tryKtfmtFix(filePath, cwd, writeHold);
598
+ if (fixed > 0) {
599
+ fixedCount += fixed;
600
+ autofixTools.push(`ktfmt:${fixed}`);
601
+ fixedThisTurn.add(filePath);
602
+ markTargetChanged();
603
+ dbg(`autofix: ktfmt formatted ${filePath}`);
604
+ needsContentRefresh = true;
605
+ }
606
+ continue;
607
+ }
608
+ if (toolName === "markdownlint") {
609
+ const fixed = await tryMarkdownlintFix(filePath, cwd, writeHold);
610
+ if (fixed > 0) {
611
+ fixedCount += fixed;
612
+ autofixTools.push(`markdownlint:${fixed}`);
613
+ fixedThisTurn.add(filePath);
614
+ markTargetChanged();
615
+ dbg(`autofix: markdownlint --fix fixed ${filePath}`);
616
+ needsContentRefresh = true;
617
+ }
618
+ continue;
619
+ }
620
+ if (toolName === "oxlint") {
621
+ const fixed = await tryOxlintFix(filePath, cwd, writeHold);
622
+ if (fixed > 0) {
623
+ fixedCount += fixed;
624
+ autofixTools.push(`oxlint:${fixed}`);
625
+ fixedThisTurn.add(filePath);
626
+ markTargetChanged();
627
+ dbg(`autofix: oxlint --fix fixed ${filePath}`);
628
+ needsContentRefresh = true;
629
+ }
630
+ }
631
+ }
632
+ if (attemptedTools.length > 0 && autofixTools.length === 0) {
633
+ dbg(`autofix: attempted ${attemptedTools.join(",")} for ${filePath}, but no fixes were applied`);
634
+ }
635
+ return {
636
+ fixedCount,
637
+ autofixTools,
638
+ attemptedTools,
639
+ changedFiles: [...changedFiles],
640
+ needsContentRefresh,
641
+ restoring: restorings.length > 0 ? Promise.all(restorings).then((losses) => ({
642
+ lost: losses.flatMap((loss) => loss.lost),
643
+ possiblyLost: losses.flatMap((loss) => loss.possiblyLost)
644
+ })) : undefined
645
+ };
646
+ }
647
+ export async function resyncHeldLspDocument(filePath) {
648
+ const service = (await loadLspService()).peekLSPService();
649
+ if (!service)
650
+ return "no-service";
651
+ const dispositions = await service.resyncGitChangedFiles([filePath], {
652
+ saved: true
653
+ });
654
+ return dispositions.get(filePath) ?? "no-service";
655
+ }
656
+ export function chainLateFormatResync(settled, which, row, dbg) {
657
+ const inband = which === "inband";
658
+ const logLate = (outcome) => {
659
+ const common = {
660
+ type: "phase",
661
+ toolName: row.toolName,
662
+ filePath: row.filePath,
663
+ durationMs: Date.now() - row.startedAt,
664
+ metadata: { outcome }
665
+ };
666
+ if (inband)
667
+ logLatency({ ...common, phase: "inband_format_late_resync" });
668
+ else
669
+ logLatency({ ...common, phase: "deferred_format_late_resync" });
670
+ };
671
+ logLatency({
672
+ type: "phase",
673
+ phase: "format_late_resync_chained",
674
+ toolName: row.toolName,
675
+ filePath: row.filePath,
676
+ durationMs: Date.now() - row.startedAt,
677
+ metadata: { which }
678
+ });
679
+ return settled.then(async () => {
680
+ logLate(await resyncHeldLspDocument(row.filePath));
681
+ }).catch((err) => {
682
+ surfaceHandlerCrash(inband ? "inband-format-late-resync" : "deferred-format-late-resync", err, { dbg, rethrow: false });
683
+ logLate("failed");
684
+ });
685
+ }
686
+ export async function resyncLspFile(filePath, fileContent, needsContentRefresh, lspSyncCompleted, getFlag, dbg, readStamp) {
687
+ if (getFlag("no-lsp"))
688
+ return "no-lsp";
689
+ if (!needsContentRefresh && lspSyncCompleted)
690
+ return "up-to-date";
691
+ const limitCheck = exceedsLspSyncLimits(fileContent);
692
+ if (limitCheck.tooLarge)
693
+ return "too-large";
694
+ try {
695
+ const lspService = (await loadLspService()).getLSPService();
696
+ if (lspService.supportsLSP(filePath)) {
697
+ const budgetMs = lspSyncBudgetMs();
698
+ const abort = getAmbientAbortSignal();
699
+ if (abort?.aborted)
700
+ return "aborted";
701
+ const startedAt = Date.now();
702
+ const touch = lspService.touchFile(filePath, fileContent, {
703
+ diagnostics: "none",
704
+ source: "lsp_sync",
705
+ clientScope: "primary",
706
+ maxClientWaitMs: LSP_SPAWN_BUDGET_MS,
707
+ saved: true,
708
+ readStamp
709
+ }).then((result) => {
710
+ if (result === undefined)
711
+ return "not-sent";
712
+ return result.supersededServerIds?.length ? "superseded" : "synced";
713
+ }).catch((err) => {
714
+ dbg(`LSP resync after autofix error: ${err}`);
715
+ return "failed";
716
+ });
717
+ const auxServerIds = enabledAuxiliaryLspServerIds(getFlag);
718
+ if (auxServerIds.length > 0) {
719
+ (async () => lspService.getAuxiliaryClientsForFile(filePath, new Set(auxServerIds), undefined, LSP_SPAWN_BUDGET_MS, abort, "tool_result_edit"))().catch(() => {});
720
+ }
721
+ const outcome = await bounded(touch, {
722
+ ms: budgetMs,
723
+ signal: abort,
724
+ hook: "tool_result_edit",
725
+ label: "resyncLspFile"
726
+ });
727
+ if (outcome === undefined) {
728
+ const spawnInFlight = !abort?.aborted && lspService.isSpawnInFlight(filePath);
729
+ const reason = abort?.aborted ? "aborted" : spawnInFlight ? "spawn-in-flight" : "timeout";
730
+ logLatency({
731
+ type: "phase",
732
+ phase: "lsp_sync_abandoned",
733
+ filePath,
734
+ durationMs: Date.now() - startedAt,
735
+ metadata: {
736
+ source: "lsp_sync",
737
+ reason,
738
+ budgetMs
739
+ }
740
+ });
741
+ const cause = abort?.aborted ? "aborted (Escape)" : spawnInFlight ? `timed out after ${budgetMs}ms; reason: spawn-in-flight (server still cold-spawning)` : `timed out after ${budgetMs}ms; server slow/wedged`;
742
+ dbg(`LSP resync ${cause} for ${filePath}`);
743
+ return "abandoned";
744
+ }
745
+ return outcome;
746
+ }
747
+ return "unsupported";
748
+ } catch (err) {
749
+ dbg(`LSP resync after autofix error: ${err}`);
750
+ return "failed";
751
+ }
752
+ }
753
+ function toPilensDiagnosticEntry(d) {
754
+ const entry = {
755
+ severity: d.severity,
756
+ message: d.message,
757
+ tool: d.tool
758
+ };
759
+ if (d.rule !== undefined)
760
+ entry.ruleId = d.rule;
761
+ if (d.line !== undefined)
762
+ entry.line = d.line;
763
+ if (d.column !== undefined)
764
+ entry.col = d.column;
765
+ if (d.fixable !== undefined)
766
+ entry.fixable = d.fixable;
767
+ return entry;
768
+ }
769
+ function buildAllClearOutput(dispatchResult, elapsed, filePath) {
770
+ const kind = detectFileKind(filePath);
771
+ const langLabel = kind ? getFileKindLabel(kind) : path.extname(filePath);
772
+ if (kind && dispatchResult.unconfirmedStatus !== undefined) {
773
+ return `⚠ ${langLabel} unconfirmed — ${dispatchResult.unconfirmedStatus} · ${elapsed}ms`;
774
+ }
775
+ const parts = [];
776
+ if (kind) {
777
+ parts.push(`${langLabel} clean`);
778
+ }
779
+ parts.push(`${elapsed}ms`);
780
+ return `checkmark ${parts.join(" · ")}`.replace("checkmark", "✓");
781
+ }
782
+ function formatStillUnfixedLine(blockers, filePath) {
783
+ const lines = [...new Set(inlineBlockerLines(blockers, filePath))];
784
+ const shown = lines.slice(0, 5).map((line) => `L${line}`);
785
+ if (lines.length > shown.length)
786
+ shown.push(`+${lines.length - shown.length} more`);
787
+ const where = shown.length > 0 ? ` (${shown.join(", ")})` : "";
788
+ const count = blockers.length;
789
+ return `\uD83D\uDD34 Still unfixed: ${count} blocker${count === 1 ? "" : "s"} reported earlier${where}.`;
790
+ }
791
+ function formatPreExistingLine(findings, filePath) {
792
+ const lines = [...new Set(inlineBlockerLines(findings, filePath))];
793
+ const shown = lines.slice(0, 5).map((line) => `L${line}`);
794
+ if (lines.length > shown.length)
795
+ shown.push(`+${lines.length - shown.length} more`);
796
+ const where = shown.length > 0 ? ` (${shown.join(", ")})` : "";
797
+ const count = findings.length;
798
+ return `ℹ Pre-existing: ${count} linter error${count === 1 ? "" : "s"} already in this file before its first edit this session${where}; not blocking.`;
799
+ }
800
+ export async function runFormatPhase(filePath, getFormatService, dbg, signal, budgetMs = HOOK_WALL_BUDGET_MS.tool_result_edit, hook = "tool_result_edit", writeHold, sessionRoot) {
801
+ let formatChanged = false;
802
+ let formattersUsed = [];
803
+ const formatFailures = [];
804
+ const formatUnavailable = [];
805
+ let fileContent;
806
+ let abandoned;
807
+ const adopted = resolveAnalysisRoot(filePath, sessionRoot) === "adopted";
808
+ if (adopted)
809
+ emitBounded("adopted_root_writer_skipped", `${filePath}:format`, {
810
+ filePath,
811
+ durationMs: 0,
812
+ metadata: { writer: "format" }
813
+ }, { ledgerKind: "adopted-root-writer-skipped", risingEdgePer: "identity" });
814
+ if (!adopted) {
815
+ const formatService = getFormatService();
816
+ try {
817
+ formatService.recordRead(filePath);
818
+ const result = await formatService.formatFile(filePath, {
819
+ signal,
820
+ budgetMs,
821
+ hook,
822
+ sessionRoot,
823
+ ...writeHold ? { writeHold } : {}
824
+ });
825
+ abandoned = result.abandoned;
826
+ for (const f of result.formatters) {
827
+ if (f.outcome !== "unavailable")
828
+ continue;
829
+ if (f.error?.includes("project tool agreement could not be established"))
830
+ continue;
831
+ const reason = f.error ?? "formatter executable not found";
832
+ formatUnavailable.push({ formatter: f.name, reason });
833
+ recordDegradationOnce({
834
+ kind: "formatter-unavailable",
835
+ subject: `${f.name}:${path.basename(filePath)}`,
836
+ reason
837
+ });
838
+ }
839
+ formattersUsed = result.formatters.filter((f) => f.outcome !== "unavailable").map((f) => f.name);
840
+ if (result.anyChanged) {
841
+ formatChanged = true;
842
+ dbg("autoformat: " + result.formatters.map((f) => f.name + "(" + (f.changed ? "changed" : "unchanged") + ")").join(", "));
843
+ }
844
+ if (!result.allSucceeded) {
845
+ const failures = result.formatters.filter((f) => !f.success);
846
+ for (const failure of failures) {
847
+ recordDegradationOnce({
848
+ kind: "formatter-failure",
849
+ subject: `${failure.name}:${path.basename(filePath)}`,
850
+ reason: failure.error ?? "unknown error"
851
+ });
852
+ }
853
+ formatFailures.push(...failures.map((f) => `${f.name}: ${f.error ?? "unknown error"}`));
854
+ dbg("autoformat: " + failures.map((f) => f.name + " failed: " + (f.error ?? "unknown error")).join("; "));
855
+ }
856
+ } catch (err) {
857
+ const message = err instanceof Error ? err.message : String(err);
858
+ recordDegradationOnce({
859
+ kind: "formatter-failure",
860
+ subject: `format-service:${path.basename(filePath)}`,
861
+ reason: message
862
+ });
863
+ formatFailures.push(message);
864
+ dbg(`autoformat error: ${err}`);
865
+ }
866
+ }
867
+ const fileReadStamp = performance.now();
868
+ const fileReadAtMs = Date.now();
869
+ let fileBytes;
870
+ try {
871
+ fileBytes = nodeFs.readFileSync(filePath);
872
+ fileContent = fileBytes.toString("utf-8");
873
+ } catch {
874
+ fileContent = undefined;
875
+ }
876
+ return {
877
+ formatChanged,
878
+ formattersUsed,
879
+ formatFailures,
880
+ formatUnavailable,
881
+ fileContent,
882
+ fileBytes,
883
+ fileReadStamp,
884
+ ...abandoned === undefined ? {} : { abandoned },
885
+ fileReadAtMs
886
+ };
887
+ }
888
+ function buildEnrichedBlockerOutput(blockers, fileContent = "") {
889
+ if (blockers.length === 0)
890
+ return "";
891
+ const fileLines = fileContent ? fileContent.split(`
892
+ `) : [];
893
+ const MAX_SNIPPET = 120;
894
+ let out = `
895
+
896
+ \uD83D\uDD34 STOP — ${blockers.length} issue(s) must be fixed:
897
+ `;
898
+ const shown = blockers.slice(0, 10);
899
+ for (const d of shown) {
900
+ const lineNo = d.line ?? 1;
901
+ const nodeCtx = d.astNodeType ? ` (${d.astNodeType})` : "";
902
+ out += ` L${lineNo}: ${d.message}${nodeCtx}
903
+ `;
904
+ const snippet = d.matchedText ? d.matchedText.trim().split(`
905
+ `)[0]?.slice(0, MAX_SNIPPET) : fileLines[lineNo - 1]?.trim().slice(0, MAX_SNIPPET);
906
+ if (snippet)
907
+ out += ` → ${snippet}
908
+ `;
909
+ if (d.fixSuggestion)
910
+ out += ` \uD83D\uDCA1 ${d.fixSuggestion}
911
+ `;
912
+ }
913
+ if (blockers.length > 10) {
914
+ out += ` ... and ${blockers.length - 10} more
915
+ `;
916
+ }
917
+ out += formatPromotionNotes(blockers);
918
+ return out;
919
+ }
920
+ function carryRecordedBlockers(prior, observed, dispatchResult, filePath, positionOf, matchesAnywhere, editRanges) {
921
+ if (prior.length === 0)
922
+ return { carried: [], matched: new Set };
923
+ const runnerIds = new Set(dispatchResult.inconclusiveSources?.runnerIds);
924
+ const serverIds = new Set(dispatchResult.inconclusiveSources?.serverIds);
925
+ const editScoped = new Set(dispatchResult.editScopedRunnerIds);
926
+ const insideEdit = (d) => {
927
+ const at = d.line === undefined ? ANY_POSITION : positionOf(d);
928
+ return at === undefined || typeof at === "number" && spanOverlapsModifiedRanges(at, at, editRanges);
929
+ };
930
+ const observedNow = new Set(observed);
931
+ const recorded = new Set(prior);
932
+ const { kept } = retainRecordedFindings(prior, [...observed, ...dispatchResult.stillObserved ?? []], {
933
+ positionOf,
934
+ matchesAnywhere,
935
+ keepUnobserved: (d) => d.runnerId !== undefined && runnerIds.has(d.runnerId) || d.serverId !== undefined && serverIds.has(d.serverId) || d.runnerId !== undefined && editScoped.has(d.runnerId) && !insideEdit(d)
936
+ });
937
+ const matched = new Set(kept.flatMap((d) => observedNow.has(d) ? [d] : []));
938
+ const carried = kept.flatMap((d) => {
939
+ if (observedNow.has(d))
940
+ return [];
941
+ if (!recorded.has(d))
942
+ return [d];
943
+ const at = positionOf(d);
944
+ if (typeof at !== "number")
945
+ return [d.positionStale ? d : { ...d, positionStale: true }];
946
+ return [at === d.line ? d : { ...d, line: at }];
947
+ });
948
+ if (carried.some((d) => !dispatchResult.stillObserved?.includes(d))) {
949
+ incrementDegradationCount({
950
+ kind: "blocker-carried-unobserved",
951
+ subject: normalizeMapKey(filePath),
952
+ reason: "a recorded blocker's source reached no verdict on this write, so the blocker stays pending (#4484)"
953
+ });
954
+ }
955
+ return { carried, matched };
956
+ }
957
+ function anchorToPriorAnalysis(prior, fileContent, fileBytes, filePath) {
958
+ let hashes = null;
959
+ const currentHashes = () => {
960
+ hashes ??= fileContent !== undefined && fileBytes !== undefined && fileBytes.byteLength <= 2 * 1024 * 1024 ? lineHashesOf(fileContent) : undefined;
961
+ return hashes ?? undefined;
962
+ };
963
+ let lines;
964
+ const lineCount = () => currentHashes()?.length ?? fileContent?.split(/\r?\n/).length ?? 0;
965
+ const textAt = (line) => {
966
+ if (fileContent === undefined)
967
+ return;
968
+ lines ??= fileContent.split(/\r?\n/);
969
+ return lines[line - 1];
970
+ };
971
+ const hashAt = (line) => {
972
+ const all = currentHashes();
973
+ if (all)
974
+ return all[line - 1];
975
+ const text = textAt(line);
976
+ return text === undefined ? undefined : lineHashOf(text);
977
+ };
978
+ let lineMap = null;
979
+ const alignment = () => {
980
+ if (lineMap === null) {
981
+ const now = currentHashes();
982
+ lineMap = prior?.lineHashes && now ? alignLines(prior.lineHashes, now) : undefined;
983
+ }
984
+ return lineMap;
985
+ };
986
+ const unplaced = () => recordDegradationOnce({
987
+ kind: "blocker-position-unaligned",
988
+ subject: normalizeMapKey(filePath),
989
+ reason: "a recorded blocker could not be placed in the write's bytes (no alignment, or its line no longer holds its text); it matches its identity only on a line with its own text, and owed lines are matched by content (#4484)"
990
+ });
991
+ const positionOf = (d) => {
992
+ const map = alignment();
993
+ const placed = d.positionStale !== true && (d.lineHash === undefined || prior?.lineHashes?.[d.line - 1] === d.lineHash);
994
+ if (map && placed)
995
+ return map(d.line);
996
+ unplaced();
997
+ return ANY_POSITION;
998
+ };
999
+ const matchesAnywhere = (prior, observed) => {
1000
+ if (prior.lineHash === undefined || observed.line === undefined)
1001
+ return true;
1002
+ const text = hashAt(observed.line);
1003
+ return text === undefined || text === prior.lineHash;
1004
+ };
1005
+ const owed = new Map;
1006
+ const owe = (runnerId, ranges) => {
1007
+ if (ranges.length > 0)
1008
+ owed.set(runnerId, ranges);
1009
+ };
1010
+ for (const [runnerId, ranges] of prior?.owedRanges ?? []) {
1011
+ const map = alignment();
1012
+ if (!map) {
1013
+ unplaced();
1014
+ owe(runnerId, linesOwedByContent(owedContentOf(ranges, prior?.lineHashes), currentHashes(), lineCount(), textAt));
1015
+ continue;
1016
+ }
1017
+ owe(runnerId, rangesOfLines(linesOfRanges(ranges).flatMap((line) => {
1018
+ const at = map(line);
1019
+ return at === undefined ? [] : [at];
1020
+ })));
1021
+ }
1022
+ for (const [runnerId, content] of prior?.owedContent ?? [])
1023
+ owe(runnerId, linesOwedByContent(content, currentHashes(), lineCount(), textAt));
1024
+ return {
1025
+ positionOf,
1026
+ matchesAnywhere,
1027
+ owed,
1028
+ next(sources, modifiedRanges, delivers, editScoped) {
1029
+ const lineHashes = currentHashes();
1030
+ const owedRanges = owedRangesAfterDispatch({
1031
+ delivers,
1032
+ noVerdict: sources?.runnerIds ?? [],
1033
+ editScoped,
1034
+ collectLater: sources?.collectLaterRunnerIds ?? [],
1035
+ modifiedRanges,
1036
+ owed,
1037
+ lineCount
1038
+ });
1039
+ if (lineHashes === undefined && owedRanges.size === 0)
1040
+ return;
1041
+ return boundedAnchor(lineHashes, owedRanges);
1042
+ }
1043
+ };
1044
+ }
1045
+ export async function runPipeline(ctx, deps) {
1046
+ const writeHold = holdFileMutationQueue(ctx.filePath);
1047
+ try {
1048
+ return await analysePipeline(ctx, deps, writeHold);
1049
+ } finally {
1050
+ writeHold?.release();
1051
+ }
1052
+ }
1053
+ async function analysePipeline(ctx, deps, writeHold) {
1054
+ const { filePath, cwd, toolName, getFlag, getFlagSource, dbg } = ctx;
1055
+ const { getFormatService } = deps;
1056
+ const allowAutonomousWriters = ctx.allowAutonomousWriters !== false;
1057
+ if (!allowAutonomousWriters) {
1058
+ incrementDegradationCount({
1059
+ kind: "opaque-mutation-ownership-boundary",
1060
+ subject: "pipeline",
1061
+ reason: `observed mutation is not evidence of agent authorship (${filePath})`
1062
+ });
1063
+ }
1064
+ const widgetOrder = () => writeOrderToken(ctx.telemetry?.orderTurn, ctx.telemetry?.writeIndex);
1065
+ const widgetKey = normalizeMapKey(filePath);
1066
+ admitWidgetDiagnosticsWrite(widgetKey, widgetOrder());
1067
+ const phase = createPhaseTracker(toolName, filePath);
1068
+ const pipelineStart = Date.now();
1069
+ clearGraphCache();
1070
+ phase.start("total");
1071
+ phase.start("read_file");
1072
+ let fileContent;
1073
+ let fileReadStamp = performance.now();
1074
+ let analysisReadAtMs = Date.now();
1075
+ let fileBytes;
1076
+ try {
1077
+ fileBytes = nodeFs.readFileSync(filePath);
1078
+ fileContent = fileBytes.toString("utf-8");
1079
+ } catch {}
1080
+ const readContent = fileContent;
1081
+ phase.end("read_file");
1082
+ phase.start("format");
1083
+ let formatChanged = false;
1084
+ let formattersUsed = [];
1085
+ let formatFailures = [];
1086
+ const piChangedFiles = new PathKeyedMap(normalizeMapKey);
1087
+ const autoformatDisabled = resolveAnalysisRoot(filePath, ctx.projectRoot ?? cwd) === "adopted" || !!getFlag("no-autoformat", filePath);
1088
+ const immediateFormat = !!getFlag("immediate-format");
1089
+ const formatDeferred = allowAutonomousWriters && !autoformatDisabled && !immediateFormat && !!fileContent;
1090
+ if (allowAutonomousWriters && !autoformatDisabled && immediateFormat && fileContent) {
1091
+ const formatResult = await runFormatPhase(filePath, getFormatService, dbg, ctx.signal, undefined, undefined, writeHold, ctx.projectRoot ?? cwd);
1092
+ if (formatResult.abandoned)
1093
+ chainLateFormatResync(formatResult.abandoned, "inband", { toolName, filePath, startedAt: pipelineStart }, dbg);
1094
+ formatChanged = formatResult.formatChanged;
1095
+ formattersUsed = formatResult.formattersUsed;
1096
+ formatFailures = formatResult.formatFailures;
1097
+ fileContent = formatResult.fileContent;
1098
+ fileBytes = formatResult.fileBytes;
1099
+ fileReadStamp = formatResult.fileReadStamp;
1100
+ analysisReadAtMs = formatResult.fileReadAtMs;
1101
+ if (formatChanged) {
1102
+ const absPath = path.resolve(filePath);
1103
+ piChangedFiles.set(filePath, true);
1104
+ publishFilesTouched({
1105
+ reason: "format",
1106
+ paths: [absPath],
1107
+ cwd,
1108
+ dbg,
1109
+ fixes: formattersUsed.map((tool) => ({
1110
+ path: absPath,
1111
+ tool,
1112
+ kind: "format"
1113
+ }))
1114
+ });
1115
+ }
1116
+ } else if (formatDeferred) {
1117
+ dbg(`autoformat: deferred until agent_end for ${filePath}`);
1118
+ } else if (!allowAutonomousWriters) {
1119
+ dbg(`autoformat: skipped for ${filePath} (mutation ownership is unproven)`);
1120
+ } else if (autoformatDisabled) {
1121
+ const source = getFlagSource?.("no-autoformat", filePath);
1122
+ dbg(`autoformat: skipped for ${filePath} (--no-autoformat${source ? `, source=${source}` : ""})`);
1123
+ }
1124
+ phase.end("format", {
1125
+ formattersUsed,
1126
+ formatChanged,
1127
+ deferred: formatDeferred
1128
+ });
1129
+ phase.start("autofix");
1130
+ let fixedCount = 0;
1131
+ let autofixTools = [];
1132
+ let attemptedTools = [];
1133
+ let autofixChangedFiles = [];
1134
+ let autofixRestoring;
1135
+ let fixRefresh = false;
1136
+ let autofixSkipReason;
1137
+ if (!allowAutonomousWriters) {
1138
+ autofixSkipReason = "mutation_ownership_unproven";
1139
+ dbg(`autofix: skipped for ${filePath} (mutation ownership is unproven)`);
1140
+ } else if (ctx.autofixMode === "deferred") {
1141
+ autofixSkipReason = "deferred_to_agent_end";
1142
+ dbg(`autofix: deferred until agent_end for ${filePath}`);
1143
+ } else
1144
+ ({
1145
+ fixedCount,
1146
+ autofixTools,
1147
+ attemptedTools,
1148
+ changedFiles: autofixChangedFiles,
1149
+ needsContentRefresh: fixRefresh,
1150
+ restoring: autofixRestoring,
1151
+ skipReason: autofixSkipReason
1152
+ } = await runAutofix(filePath, cwd, getFlag, dbg, deps, getFlagSource, writeHold, ctx.projectRoot ?? cwd));
1153
+ if (autofixRestoring)
1154
+ deliverFixRunLoss(autofixRestoring, ctx);
1155
+ for (const changedFile of autofixChangedFiles) {
1156
+ piChangedFiles.set(changedFile, true);
1157
+ }
1158
+ if (autofixChangedFiles.length > 0) {
1159
+ const absChangedFiles = autofixChangedFiles.map((f) => path.resolve(f));
1160
+ const toolNames = autofixTools.map((t) => t.split(":")[0]);
1161
+ publishFilesTouched({
1162
+ reason: "autofix",
1163
+ paths: absChangedFiles,
1164
+ cwd,
1165
+ dbg,
1166
+ fixes: absChangedFiles.flatMap((p) => toolNames.map((tool) => ({ path: p, tool, kind: "autofix" })))
1167
+ });
1168
+ }
1169
+ if (fixRefresh) {
1170
+ fileReadStamp = performance.now();
1171
+ analysisReadAtMs = Date.now();
1172
+ try {
1173
+ fileBytes = nodeFs.readFileSync(filePath);
1174
+ fileContent = fileBytes.toString("utf-8");
1175
+ } catch {
1176
+ fileBytes = undefined;
1177
+ fileContent = undefined;
1178
+ }
1179
+ }
1180
+ phase.end("autofix", {
1181
+ fixedCount,
1182
+ tools: autofixTools,
1183
+ attemptedTools,
1184
+ skipReason: autofixSkipReason
1185
+ });
1186
+ const fileModified = formatChanged || fixedCount > 0;
1187
+ const targetFileModified = piChangedFiles.has(filePath);
1188
+ const postWriteStateHash = fileModified && targetFileModified ? (() => {
1189
+ try {
1190
+ return hashFileBytes(filePath);
1191
+ } catch (error) {
1192
+ recordDegradationOnce({
1193
+ kind: "pipeline-post-write-hash-unavailable",
1194
+ subject: filePath,
1195
+ reason: error instanceof Error ? error.message : String(error)
1196
+ });
1197
+ return;
1198
+ }
1199
+ })() : undefined;
1200
+ if (fileContent !== readContent && ctx.telemetry && ctx.nextWriteIndex) {
1201
+ ctx.telemetry = { ...ctx.telemetry, ...ctx.nextWriteIndex() };
1202
+ }
1203
+ writeHold?.release();
1204
+ phase.start("lsp_sync");
1205
+ let lspSyncCompleted = false;
1206
+ if (fileContent) {
1207
+ await resyncLspFile(filePath, fileContent, true, false, getFlag, dbg, fileReadStamp);
1208
+ lspSyncCompleted = true;
1209
+ }
1210
+ phase.end("lsp_sync", { completed: lspSyncCompleted, finalContent: true });
1211
+ phase.start("dispatch_lint");
1212
+ dbg(`dispatch: running lint tools for ${filePath}`);
1213
+ const piApi = {
1214
+ getFlag
1215
+ };
1216
+ const { dispatchLintWithResult, computeCascadeForFile } = await loadDispatchIntegration();
1217
+ const inlineBlockerFileContent = fileBytes?.byteLength && fileBytes.byteLength <= 2 * 1024 * 1024 ? (() => {
1218
+ const content = fileBytes;
1219
+ const stamp = stampContentBytes(content, 0);
1220
+ return stamp.sha256 ? { size: stamp.size, sha256: stamp.sha256 } : undefined;
1221
+ })() : undefined;
1222
+ const anchoring = anchorToPriorAnalysis(ctx.priorAnalysisAnchor?.(), fileContent, fileBytes, filePath);
1223
+ const recordedRunnerIds = new Set((ctx.priorInlineBlockers?.() ?? []).flatMap((d) => d.runnerId === undefined ? [] : [d.runnerId]));
1224
+ const dispatchResult = await dispatchLintWithResult(filePath, cwd, piApi, ctx.modifiedRanges, {
1225
+ model: ctx.telemetry?.model ?? "unknown",
1226
+ sessionId: ctx.telemetry?.sessionId ?? "unknown",
1227
+ turnIndex: ctx.telemetry?.turnIndex ?? 0,
1228
+ writeIndex: ctx.telemetry?.writeIndex ?? 0
1229
+ }, {
1230
+ projectRoot: ctx.projectRoot,
1231
+ analysisRootMode: ctx.analysisRootMode,
1232
+ writeIndex: widgetOrder(),
1233
+ sessionGeneration: ctx.sessionGeneration,
1234
+ sessionId: ctx.telemetry?.sessionId,
1235
+ telemetryModel: ctx.telemetry?.modelId,
1236
+ telemetryProvider: ctx.telemetry?.provider,
1237
+ owedRanges: anchoring.owed.size > 0 ? anchoring.owed : undefined,
1238
+ recordedRunnerIds: recordedRunnerIds.size > 0 ? recordedRunnerIds : undefined
1239
+ });
1240
+ const heldBackBlockers = dispatchResult.heldBackBlockers ?? [];
1241
+ const seededFindings = dispatchResult.preExisting ?? [];
1242
+ const ownFile = normalizeEphemeralMapKey(filePath);
1243
+ const { carried: carriedBlockers, matched: matchedBlockers } = carryRecordedBlockers(ctx.priorInlineBlockers?.() ?? [], [...dispatchResult.blockers, ...heldBackBlockers, ...seededFindings], dispatchResult, filePath, (d) => d.line === undefined || d.filePath && normalizeEphemeralMapKey(d.filePath) !== ownFile ? d.line : anchoring.positionOf({
1244
+ line: d.line,
1245
+ lineHash: d.lineHash,
1246
+ positionStale: d.positionStale
1247
+ }), anchoring.matchesAnywhere, ctx.modifiedRanges);
1248
+ const promotedBlockers = heldBackBlockers.flatMap((d) => matchedBlockers.has(d) ? [] : [d]);
1249
+ const preExisting = seededFindings.filter((d) => !matchedBlockers.has(d));
1250
+ const recordedSeeded = seededFindings.filter((d) => matchedBlockers.has(d));
1251
+ const keptBlockers = carriedBlockers.length > 0 || recordedSeeded.length > 0 ? [...heldBackBlockers, ...recordedSeeded, ...carriedBlockers] : heldBackBlockers;
1252
+ const storedDiagnostics = keptBlockers.length > 0 ? [...dispatchResult.diagnostics, ...keptBlockers] : dispatchResult.diagnostics;
1253
+ recordDiagnostics(widgetKey, storedDiagnostics, widgetOrder(), analysisReadAtMs);
1254
+ {
1255
+ const absPath = path.resolve(filePath);
1256
+ const wasDirty = wasPreviouslyReportedDirty(absPath);
1257
+ if (storedDiagnostics.length > 0 || wasDirty) {
1258
+ publishDiagnostics({
1259
+ cwd,
1260
+ files: [
1261
+ {
1262
+ path: absPath,
1263
+ diagnostics: storedDiagnostics.map(toPilensDiagnosticEntry)
1264
+ }
1265
+ ],
1266
+ dbg
1267
+ });
1268
+ }
1269
+ }
1270
+ const hasBlockers = allowAutonomousWriters && dispatchResult.hasBlockers;
1271
+ const actionableWarnings = allowAutonomousWriters ? dispatchResult.warnings.map((diagnostic) => recordFromDispatchDiagnostic(diagnostic, cwd)).filter((warning) => Boolean(warning)) : [];
1272
+ const codeQualityWarnings = dispatchResult.warnings.map((diagnostic) => recordFromCodeQualityDiagnostic(diagnostic, cwd)).filter((warning) => Boolean(warning));
1273
+ if (dispatchResult.diagnostics.length > 0) {
1274
+ const tracker = getDiagnosticTracker();
1275
+ tracker.trackShown(dispatchResult.diagnostics);
1276
+ }
1277
+ if (fixedCount > 0)
1278
+ getDiagnosticTracker().trackAutoFixed(fixedCount);
1279
+ if (dispatchResult.resolvedCount > 0)
1280
+ getDiagnosticTracker().trackAgentFixed(dispatchResult.resolvedCount);
1281
+ let output = "";
1282
+ const currentBlockers = keptBlockers.length > 0 ? [...dispatchResult.blockers, ...keptBlockers] : dispatchResult.blockers;
1283
+ const liveBlockers = currentBlockers.length > 0 ? dropFindingsForMissingPaths({
1284
+ store: "stop-blocker",
1285
+ findings: currentBlockers,
1286
+ cwd,
1287
+ citedPath: (b) => b.filePath || undefined
1288
+ }) : [];
1289
+ const newBlockers = new Set([
1290
+ ...hasBlockers ? dispatchResult.blockers : [],
1291
+ ...allowAutonomousWriters ? promotedBlockers : []
1292
+ ]);
1293
+ const deliverableBlockers = newBlockers.size > 0 ? liveBlockers.filter((b) => newBlockers.has(b)) : [];
1294
+ const recordBlockers = allowAutonomousWriters ? liveBlockers : [];
1295
+ const stillUnfixed = recordBlockers.filter((b) => !newBlockers.has(b));
1296
+ const hasDeliverableBlockers = deliverableBlockers.length > 0;
1297
+ if (dispatchResult.diagnostics.length > 0) {
1298
+ const logger = getDiagnosticLogger();
1299
+ const toKey = (d) => [
1300
+ d.tool || "",
1301
+ d.id || "",
1302
+ d.rule || "",
1303
+ d.filePath || "",
1304
+ d.line || 0,
1305
+ d.column || 0
1306
+ ].join("|");
1307
+ const inlineKeys = new Set([...deliverableBlockers, ...dispatchResult.fixed].map(toKey));
1308
+ for (const d of dispatchResult.diagnostics) {
1309
+ logger.logCaught(d, {
1310
+ model: ctx.telemetry?.model ?? "unknown",
1311
+ sessionId: ctx.telemetry?.sessionId ?? "unknown",
1312
+ turnIndex: ctx.telemetry?.turnIndex ?? 0,
1313
+ writeIndex: ctx.telemetry?.writeIndex ?? 0
1314
+ }, inlineKeys.has(toKey(d)));
1315
+ }
1316
+ }
1317
+ const deliveredOutput = !allowAutonomousWriters && dispatchResult.hasBlockers ? dispatchResult.output.slice(dispatchResult.blockerOutput.length) : dispatchResult.output;
1318
+ const rendersStop = newBlockers.size > 0;
1319
+ if (rendersStop && fileContent) {
1320
+ if (deliverableBlockers.length > 0) {
1321
+ output += buildEnrichedBlockerOutput(deliverableBlockers, fileContent);
1322
+ }
1323
+ const rest = dispatchResult.output.slice(dispatchResult.blockerOutput.length);
1324
+ if (rest)
1325
+ output += rest;
1326
+ } else if (deliveredOutput) {
1327
+ if (rendersStop && deliverableBlockers.length !== dispatchResult.blockers.length) {
1328
+ let gatedOut = buildEnrichedBlockerOutput(deliverableBlockers);
1329
+ const rest = dispatchResult.output.slice(dispatchResult.blockerOutput.length);
1330
+ if (rest)
1331
+ gatedOut += rest;
1332
+ if (gatedOut)
1333
+ output += `
1334
+
1335
+ ${gatedOut}`;
1336
+ } else {
1337
+ output += `
1338
+
1339
+ ${deliveredOutput}`;
1340
+ }
1341
+ }
1342
+ if (stillUnfixed.length > 0) {
1343
+ output += `
1344
+
1345
+ ${formatStillUnfixedLine(stillUnfixed, filePath)}`;
1346
+ }
1347
+ if (preExisting.length > 0) {
1348
+ output += `
1349
+
1350
+ ${formatPreExistingLine(preExisting, filePath)}`;
1351
+ }
1352
+ if (fixedCount > 0) {
1353
+ const detail = autofixTools.length > 0 ? ` (${autofixTools.join(", ")})` : "";
1354
+ output += `
1355
+
1356
+ ✅ Auto-fixed ${fixedCount} issue(s)${detail}`;
1357
+ }
1358
+ if (formatFailures.length > 0) {
1359
+ const details = formatFailures.slice(0, 3).join("; ");
1360
+ const suffix = formatFailures.length > 3 ? `; ... and ${formatFailures.length - 3} more` : "";
1361
+ output += `
1362
+
1363
+ ⚠️ Auto-format failed: ${details}${suffix}`;
1364
+ }
1365
+ const postAutofixNotice = formatChanged || fixedCount > 0 ? {
1366
+ targetPath: toRunnerDisplayPath(cwd, filePath),
1367
+ changedFiles: [...piChangedFiles.keys()].map((changedFile) => toRunnerDisplayPath(cwd, changedFile))
1368
+ } : undefined;
1369
+ phase.end("dispatch_lint", {
1370
+ hasOutput: !!dispatchResult.output,
1371
+ diagnosticCount: dispatchResult.diagnostics.length
1372
+ });
1373
+ const cascadeOrigin = {
1374
+ turnSeq: ctx.telemetry?.turnIndex,
1375
+ writeSeq: ctx.telemetry?.writeIndex,
1376
+ projectSeq: ctx.seqState?.projectSeq()
1377
+ };
1378
+ const cascadePromise = getFlag("no-lsp") ? undefined : computeCascadeForFile(filePath, cwd, {
1379
+ hasBlockers,
1380
+ dbg,
1381
+ turnSeq: ctx.telemetry?.turnIndex,
1382
+ orderTurn: ctx.telemetry?.orderTurn,
1383
+ writeSeq: ctx.telemetry?.writeIndex,
1384
+ projectRoot: ctx.projectRoot,
1385
+ seqState: ctx.seqState,
1386
+ turnEndCascadeSettleStart: ctx.turnEndCascadeSettleStart,
1387
+ fileContent,
1388
+ wordIndex: ctx.wordIndex,
1389
+ onWordIndexUpdated: ctx.onWordIndexUpdated,
1390
+ sessionGeneration: ctx.sessionGeneration
1391
+ }).then((run) => ({ ...run, origin: cascadeOrigin })).catch((err) => {
1392
+ dbg(`cascade compute failed for ${filePath}: ${err}`);
1393
+ return {
1394
+ filePath,
1395
+ origin: cascadeOrigin,
1396
+ result: undefined,
1397
+ neighborCount: 0,
1398
+ diagnosticCount: 0,
1399
+ skipReason: "error",
1400
+ indeterminate: classifyTreeSitterWasmError(err) ? {
1401
+ reason: "graph_degraded",
1402
+ detail: "review graph degraded — tree-sitter wasm runtime failure"
1403
+ } : {
1404
+ reason: "error",
1405
+ detail: "cascade computation failed"
1406
+ }
1407
+ };
1408
+ });
1409
+ const elapsed = Date.now() - pipelineStart;
1410
+ let checkedClean = false;
1411
+ if (!output && !postAutofixNotice) {
1412
+ output = buildAllClearOutput(dispatchResult, elapsed, filePath);
1413
+ checkedClean = dispatchResult.primaryLspChecked === true && storedDiagnostics.length === 0;
1414
+ }
1415
+ phase.end("total", { hasOutput: !!output });
1416
+ const changedFiles = [...piChangedFiles.keys()];
1417
+ emitLensAnalysisComplete({
1418
+ cwd,
1419
+ filePath,
1420
+ toolName,
1421
+ model: ctx.telemetry?.model ?? "unknown",
1422
+ sessionId: ctx.telemetry?.sessionId ?? "unknown",
1423
+ turnIndex: ctx.telemetry?.turnIndex ?? 0,
1424
+ writeIndex: ctx.telemetry?.writeIndex ?? 0,
1425
+ diagnostics: dispatchResult.diagnostics,
1426
+ blockers: hasBlockers ? dispatchResult.blockers : [],
1427
+ warnings: dispatchResult.warnings,
1428
+ fixed: dispatchResult.fixed,
1429
+ resolvedCount: dispatchResult.resolvedCount,
1430
+ hasBlockers,
1431
+ fileModified,
1432
+ changedFiles,
1433
+ durationMs: elapsed
1434
+ });
1435
+ return {
1436
+ output,
1437
+ hasBlockers: hasDeliverableBlockers,
1438
+ cascadePromise,
1439
+ isError: false,
1440
+ fileModified,
1441
+ checkedClean,
1442
+ postWriteStateHash,
1443
+ writeIndex: ctx.telemetry?.writeIndex,
1444
+ orderTurn: ctx.telemetry?.orderTurn,
1445
+ analysisReadAtMs,
1446
+ changedFiles,
1447
+ inlineBlockerSummary: recordBlockers.length > 0 ? formatDiagnostics(recordBlockers, "blocking").trim() || undefined : undefined,
1448
+ inlineBlockerSources: recordBlockers.length > 0 ? inlineBlockerSources(recordBlockers) : undefined,
1449
+ inlineBlockerLines: recordBlockers.length > 0 ? inlineBlockerLines(recordBlockers, filePath) : undefined,
1450
+ actionableWarnings,
1451
+ codeQualityWarnings,
1452
+ diagnostics: dispatchResult.diagnostics,
1453
+ formattersUsed,
1454
+ fixedCount,
1455
+ autofixTools,
1456
+ postAutofixNotice,
1457
+ postMutation: ctx.autofixMode !== "deferred" && autofixChangedFiles.some((f) => normalizeMapKey(f) === normalizeMapKey(filePath)) && fileContent !== undefined ? {
1458
+ filePath: path.resolve(filePath),
1459
+ content: fileContent,
1460
+ source: "autofix"
1461
+ } : undefined,
1462
+ inlineBlockerFileContent,
1463
+ analysisAnchor: anchoring.next(dispatchResult.inconclusiveSources, ctx.modifiedRanges, allowAutonomousWriters, dispatchResult.editScopedRunnerIds),
1464
+ inlineBlockerDiagnostics: recordBlockers.length > 0 ? stampLineHashes(recordBlockers, fileContent, (d) => !d.filePath || normalizeEphemeralMapKey(d.filePath) === ownFile) : undefined,
1465
+ currentBlockerCount: liveBlockers.length,
1466
+ ...preExisting.length > 0 && {
1467
+ preExistingBlockerCount: preExisting.length
1468
+ },
1469
+ ...checkedWholeFile(dispatchResult) && {
1470
+ fileVerdictComplete: true
1471
+ }
1472
+ };
1473
+ }