@duckmind/dm-darwin-x64 0.67.1 → 0.67.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (1121) hide show
  1. package/README.md +2 -2
  2. package/dm +2 -2
  3. package/extensions/.dm-extensions.json +120 -603
  4. package/extensions/dm-lens/clients/actionable-warnings.js +12 -4
  5. package/extensions/dm-lens/clients/advisory-provenance.js +11 -10
  6. package/extensions/dm-lens/clients/agent-nudge.js +1 -1
  7. package/extensions/dm-lens/clients/analysis-root.js +75 -34
  8. package/extensions/dm-lens/clients/bash-file-access.js +550 -123
  9. package/extensions/dm-lens/clients/blocker-freshness.js +202 -19
  10. package/extensions/dm-lens/clients/blocker-past-eof.js +3 -1
  11. package/extensions/dm-lens/clients/bounded-telemetry.js +3 -0
  12. package/extensions/dm-lens/clients/cache-manager.js +22 -1
  13. package/extensions/dm-lens/clients/cache-observability.js +278 -17
  14. package/extensions/dm-lens/clients/cargo-manifest.js +8 -12
  15. package/extensions/dm-lens/clients/cascade-format.js +162 -19
  16. package/extensions/dm-lens/clients/codebase-model.js +2 -2
  17. package/extensions/dm-lens/clients/config-locations.js +1 -8
  18. package/extensions/dm-lens/clients/content-stamp.js +16 -0
  19. package/extensions/dm-lens/clients/context-injection-ledger.js +160 -0
  20. package/extensions/dm-lens/clients/deferred-runner-blockers.js +46 -6
  21. package/extensions/dm-lens/clients/degradation-ledger.js +21 -1
  22. package/extensions/dm-lens/clients/deps/ast-grep-napi.js +10 -0
  23. package/extensions/dm-lens/clients/diagnostic-dispositions.js +28 -12
  24. package/extensions/dm-lens/clients/disk-change-consumers.js +312 -0
  25. package/extensions/dm-lens/clients/disk-change-subscribers.js +197 -0
  26. package/extensions/dm-lens/clients/disk-changes.js +168 -0
  27. package/extensions/dm-lens/clients/dispatch/auxiliary-lsp.js +10 -6
  28. package/extensions/dm-lens/clients/dispatch/dispatcher.js +300 -61
  29. package/extensions/dm-lens/clients/dispatch/fact-store.js +2 -8
  30. package/extensions/dm-lens/clients/dispatch/facts/function-facts.js +87 -94
  31. package/extensions/dm-lens/clients/dispatch/finding-policy.js +25 -1
  32. package/extensions/dm-lens/clients/dispatch/indent-detect.js +1 -1
  33. package/extensions/dm-lens/clients/dispatch/integration.js +349 -135
  34. package/extensions/dm-lens/clients/dispatch/lane-copies.js +23 -0
  35. package/extensions/dm-lens/clients/dispatch/pending-runner-findings.js +3 -0
  36. package/extensions/dm-lens/clients/dispatch/pre-edit-seed.js +57 -0
  37. package/extensions/dm-lens/clients/dispatch/rule-id-normalize.js +6 -1
  38. package/extensions/dm-lens/clients/dispatch/rules/high-complexity.js +2 -17
  39. package/extensions/dm-lens/clients/dispatch/rules/high-fan-out.js +1 -9
  40. package/extensions/dm-lens/clients/dispatch/runner-context.js +9 -10
  41. package/extensions/dm-lens/clients/dispatch/runners/ast-grep-literal-anchors.js +58 -0
  42. package/extensions/dm-lens/clients/dispatch/runners/ast-grep-napi.js +59 -14
  43. package/extensions/dm-lens/clients/dispatch/runners/biome-check.js +9 -18
  44. package/extensions/dm-lens/clients/dispatch/runners/cue-vet.js +11 -21
  45. package/extensions/dm-lens/clients/dispatch/runners/dart-analyze.js +1 -1
  46. package/extensions/dm-lens/clients/dispatch/runners/detekt.js +4 -3
  47. package/extensions/dm-lens/clients/dispatch/runners/dotnet-build.js +15 -6
  48. package/extensions/dm-lens/clients/dispatch/runners/fish-indent.js +59 -5
  49. package/extensions/dm-lens/clients/dispatch/runners/gleam-check.js +9 -19
  50. package/extensions/dm-lens/clients/dispatch/runners/go-vet.js +2 -2
  51. package/extensions/dm-lens/clients/dispatch/runners/golangci-lint.js +17 -1
  52. package/extensions/dm-lens/clients/dispatch/runners/helm-lint.js +8 -5
  53. package/extensions/dm-lens/clients/dispatch/runners/helm-render.js +1 -1
  54. package/extensions/dm-lens/clients/dispatch/runners/ktlint.js +27 -5
  55. package/extensions/dm-lens/clients/dispatch/runners/lsp.js +91 -30
  56. package/extensions/dm-lens/clients/dispatch/runners/oxlint.js +9 -18
  57. package/extensions/dm-lens/clients/dispatch/runners/shellcheck.js +11 -20
  58. package/extensions/dm-lens/clients/dispatch/runners/shfmt.js +7 -0
  59. package/extensions/dm-lens/clients/dispatch/runners/taplo.js +2 -1
  60. package/extensions/dm-lens/clients/dispatch/runners/tree-sitter.js +29 -16
  61. package/extensions/dm-lens/clients/dispatch/runners/utils/availability-policy.js +32 -4
  62. package/extensions/dm-lens/clients/dispatch/runners/utils/candidate-probe.js +8 -0
  63. package/extensions/dm-lens/clients/dispatch/runners/utils/diagnostic-parsers.js +2 -1
  64. package/extensions/dm-lens/clients/dispatch/runners/utils/runner-helpers.js +1 -1
  65. package/extensions/dm-lens/clients/dispatch/runners/utils/tool-failure.js +9 -18
  66. package/extensions/dm-lens/clients/dispatch/runners/vale.js +2 -16
  67. package/extensions/dm-lens/clients/dispatch/types.js +45 -0
  68. package/extensions/dm-lens/clients/dispatch/utils/lsp-diagnostics.js +2 -1
  69. package/extensions/dm-lens/clients/ephemeral-root.js +10 -20
  70. package/extensions/dm-lens/clients/file-kinds.js +6 -2
  71. package/extensions/dm-lens/clients/file-mutation-queue.js +4 -8
  72. package/extensions/dm-lens/clients/file-utils.js +167 -28
  73. package/extensions/dm-lens/clients/finding-delivery-gate.js +15 -1
  74. package/extensions/dm-lens/clients/finding-identity.js +56 -0
  75. package/extensions/dm-lens/clients/fix-run-restore.js +10 -0
  76. package/extensions/dm-lens/clients/format-service.js +23 -5
  77. package/extensions/dm-lens/clients/formatters.js +33 -25
  78. package/extensions/dm-lens/clients/git-guard.js +516 -85
  79. package/extensions/dm-lens/clients/govulncheck-client.js +8 -0
  80. package/extensions/dm-lens/clients/grammar-source.js +39 -5
  81. package/extensions/dm-lens/clients/gzip-stage-write.js +99 -18
  82. package/extensions/dm-lens/clients/inline-blocker-fields.js +1 -1
  83. package/extensions/dm-lens/clients/installer/index.js +83 -85
  84. package/extensions/dm-lens/clients/installer/managed-tool-refresh.js +211 -8
  85. package/extensions/dm-lens/clients/instance-reaper.js +19 -8
  86. package/extensions/dm-lens/clients/instance-registry.js +12 -0
  87. package/extensions/dm-lens/clients/jscpd-client.js +20 -4
  88. package/extensions/dm-lens/clients/language-profile.js +8 -7
  89. package/extensions/dm-lens/clients/language-registry.js +45 -4
  90. package/extensions/dm-lens/clients/latency-logger.js +10 -2
  91. package/extensions/dm-lens/clients/lens-config.js +14 -4
  92. package/extensions/dm-lens/clients/lens-engine.js +10 -2
  93. package/extensions/dm-lens/clients/lens-flag-registry.js +19 -3
  94. package/extensions/dm-lens/clients/line-alignment.js +200 -0
  95. package/extensions/dm-lens/clients/lsp/capabilities.js +2 -2
  96. package/extensions/dm-lens/clients/lsp/cascade-tier.js +148 -38
  97. package/extensions/dm-lens/clients/lsp/client-registry.js +906 -0
  98. package/extensions/dm-lens/clients/lsp/client.js +413 -108
  99. package/extensions/dm-lens/clients/lsp/config.js +151 -47
  100. package/extensions/dm-lens/clients/lsp/content-limits.js +2 -2
  101. package/extensions/dm-lens/clients/lsp/content-scan.js +69 -0
  102. package/extensions/dm-lens/clients/lsp/created-import-targets.js +134 -0
  103. package/extensions/dm-lens/clients/lsp/diagnostic-binding.js +34 -0
  104. package/extensions/dm-lens/clients/lsp/document-drift.js +63 -15
  105. package/extensions/dm-lens/clients/lsp/edits.js +109 -26
  106. package/extensions/dm-lens/clients/lsp/environment-gap.js +186 -0
  107. package/extensions/dm-lens/clients/lsp/file-server-match.js +26 -0
  108. package/extensions/dm-lens/clients/lsp/implicit-scope.js +208 -0
  109. package/extensions/dm-lens/clients/lsp/index.js +574 -916
  110. package/extensions/dm-lens/clients/lsp/inferred-project.js +37 -15
  111. package/extensions/dm-lens/clients/lsp/jvm-runtime.js +15 -9
  112. package/extensions/dm-lens/clients/lsp/language.js +8 -1
  113. package/extensions/dm-lens/clients/lsp/launch.js +93 -43
  114. package/extensions/dm-lens/clients/lsp/lombok.js +0 -13
  115. package/extensions/dm-lens/clients/lsp/path-utils.js +2 -0
  116. package/extensions/dm-lens/clients/lsp/position-encoding.js +0 -7
  117. package/extensions/dm-lens/clients/lsp/server-config-files.js +11 -0
  118. package/extensions/dm-lens/clients/lsp/server-traits.js +8 -2
  119. package/extensions/dm-lens/clients/lsp/server.js +273 -76
  120. package/extensions/dm-lens/clients/lsp/session-roots.js +38 -3
  121. package/extensions/dm-lens/clients/lsp/wait-policy/strategies.js +87 -5
  122. package/extensions/dm-lens/clients/lsp/watch-queue.js +23 -2
  123. package/extensions/dm-lens/clients/lsp/workspace-diagnostics-cache.js +183 -47
  124. package/extensions/dm-lens/clients/lsp/workspace-diagnostics-session.js +35 -0
  125. package/extensions/dm-lens/clients/lsp-mutation.js +1 -1
  126. package/extensions/dm-lens/clients/mcp/analyze.js +51 -13
  127. package/extensions/dm-lens/clients/mcp/ipc.js +24 -1
  128. package/extensions/dm-lens/clients/mcp/session.js +2 -7
  129. package/extensions/dm-lens/clients/memory-sampler.js +19 -1
  130. package/extensions/dm-lens/clients/metrics-history.js +16 -29
  131. package/extensions/dm-lens/clients/mutating-tool.js +4 -2
  132. package/extensions/dm-lens/clients/mutation-attribution.js +1 -4
  133. package/extensions/dm-lens/clients/observed-mutation.js +7 -1
  134. package/extensions/dm-lens/clients/opaque-mutation-scan.js +273 -59
  135. package/extensions/dm-lens/clients/opengrep-client.js +6 -1
  136. package/extensions/dm-lens/clients/opengrep-config.js +10 -5
  137. package/extensions/dm-lens/clients/opengrep-rule-pack.js +19 -0
  138. package/extensions/dm-lens/clients/out-of-band-changes.js +342 -0
  139. package/extensions/dm-lens/clients/package-manager.js +51 -62
  140. package/extensions/dm-lens/clients/package-root.js +8 -12
  141. package/extensions/dm-lens/clients/partial-edit-apply.js +8 -4
  142. package/extensions/dm-lens/clients/path-birth.js +58 -0
  143. package/extensions/dm-lens/clients/path-utils.js +145 -23
  144. package/extensions/dm-lens/clients/persist-worker-stats.js +8 -0
  145. package/extensions/dm-lens/clients/persistent-reverify.js +2 -1
  146. package/extensions/dm-lens/clients/pipeline.js +248 -35
  147. package/extensions/dm-lens/clients/probe-home-state.js +6 -0
  148. package/extensions/dm-lens/clients/project-changes.js +9 -3
  149. package/extensions/dm-lens/clients/project-diagnostics/fresh-fetch.js +1 -1
  150. package/extensions/dm-lens/clients/project-diagnostics/scanner.js +4 -2
  151. package/extensions/dm-lens/clients/project-lens-config.js +4 -6
  152. package/extensions/dm-lens/clients/project-root-markers.js +8 -0
  153. package/extensions/dm-lens/clients/project-snapshot-persist-worker.js +26 -8
  154. package/extensions/dm-lens/clients/project-snapshot.js +36 -10
  155. package/extensions/dm-lens/clients/python-environment.js +239 -12
  156. package/extensions/dm-lens/clients/read-guard-tool-lines.js +2 -8
  157. package/extensions/dm-lens/clients/read-guard.js +130 -43
  158. package/extensions/dm-lens/clients/review-graph/builder.js +102 -19
  159. package/extensions/dm-lens/clients/review-graph/git-identity.js +7 -2
  160. package/extensions/dm-lens/clients/review-graph/import-resolvers.js +9 -0
  161. package/extensions/dm-lens/clients/review-graph/tsconfig-paths.js +35 -2
  162. package/extensions/dm-lens/clients/ruff-client.js +0 -2
  163. package/extensions/dm-lens/clients/rules-scanner.js +0 -43
  164. package/extensions/dm-lens/clients/runtime-agent-end.js +37 -6
  165. package/extensions/dm-lens/clients/runtime-coordinator.js +177 -31
  166. package/extensions/dm-lens/clients/runtime-session.js +106 -66
  167. package/extensions/dm-lens/clients/runtime-tool-call.js +162 -65
  168. package/extensions/dm-lens/clients/runtime-tool-result.js +634 -147
  169. package/extensions/dm-lens/clients/runtime-turn.js +472 -150
  170. package/extensions/dm-lens/clients/rust-client.js +11 -13
  171. package/extensions/dm-lens/clients/safe-spawn.js +149 -17
  172. package/extensions/dm-lens/clients/sanitize.js +0 -169
  173. package/extensions/dm-lens/clients/search-read-registration.js +22 -4
  174. package/extensions/dm-lens/clients/session-lifecycle.js +44 -1
  175. package/extensions/dm-lens/clients/session-repository.js +119 -0
  176. package/extensions/dm-lens/clients/session-scope.js +1 -1
  177. package/extensions/dm-lens/clients/session-start-observability.js +12 -0
  178. package/extensions/dm-lens/clients/session-state-store.js +6 -1
  179. package/extensions/dm-lens/clients/sg-runner.js +5 -8
  180. package/extensions/dm-lens/clients/sgconfig.js +7 -14
  181. package/extensions/dm-lens/clients/single-flight.js +1 -0
  182. package/extensions/dm-lens/clients/source-filter.js +19 -16
  183. package/extensions/dm-lens/clients/source-walker.js +21 -3
  184. package/extensions/dm-lens/clients/startup-scan.js +18 -23
  185. package/extensions/dm-lens/clients/test-runner-client.js +21 -27
  186. package/extensions/dm-lens/clients/test-runner-delivery.js +2 -10
  187. package/extensions/dm-lens/clients/tool-config.js +24 -4
  188. package/extensions/dm-lens/clients/tool-cwd.js +11 -9
  189. package/extensions/dm-lens/clients/tool-policy.js +1 -8
  190. package/extensions/dm-lens/clients/tool-set-policy.js +32 -3
  191. package/extensions/dm-lens/clients/tree-sitter-client.js +70 -24
  192. package/extensions/dm-lens/clients/tree-sitter-query-loader.js +13 -1
  193. package/extensions/dm-lens/clients/tree-sitter-symbol-extractor.js +81 -56
  194. package/extensions/dm-lens/clients/warm-attach.js +33 -8
  195. package/extensions/dm-lens/clients/widget-state.js +48 -31
  196. package/extensions/dm-lens/clients/word-index-logger.js +3 -0
  197. package/extensions/dm-lens/clients/word-index.js +15 -2
  198. package/extensions/dm-lens/clients/workspace-topology.js +10 -8
  199. package/extensions/dm-lens/config/biome/core.jsonc +3 -3
  200. package/extensions/dm-lens/config/dependency-cruiser-eager-allowlist.json +1 -0
  201. package/extensions/dm-lens/index.js +336 -141
  202. package/extensions/dm-lens/mcp/analyze-cli.js +1 -1
  203. package/extensions/dm-lens/mcp/cli.js +1 -1
  204. package/extensions/dm-lens/mcp/server.js +16 -13
  205. package/extensions/dm-lens/mcp/worker.js +1 -1
  206. package/extensions/dm-lens/package.json +1 -1
  207. package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  208. package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  209. package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  210. package/extensions/dm-lens/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  211. package/extensions/dm-lens/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  212. package/extensions/dm-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  213. package/extensions/dm-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  214. package/extensions/dm-lens/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  215. package/extensions/dm-lens/rules/rule-catalog.json +25 -1
  216. package/extensions/dm-lens/scripts/lib/process-scan.mjs +1 -1
  217. package/extensions/dm-lens/skills/{pi-lens-ast-grep → dm-lens-ast-grep}/SKILL.md +1 -1
  218. package/extensions/dm-lens/tools/activate-tools.js +3 -2
  219. package/extensions/dm-lens/tools/ast-grep-outline.js +6 -4
  220. package/extensions/dm-lens/tools/ast-grep-replace.js +17 -10
  221. package/extensions/dm-lens/tools/ast-grep-search.js +27 -19
  222. package/extensions/dm-lens/tools/lens-diagnostic-mark.js +3 -3
  223. package/extensions/dm-lens/tools/lens-diagnostics.js +260 -68
  224. package/extensions/dm-lens/tools/lsp-diagnostics.js +303 -76
  225. package/extensions/dm-lens/tools/lsp-navigation.js +168 -102
  226. package/extensions/dm-lens/tools/module-report.js +2 -1
  227. package/extensions/dm-lens/tools/shared.js +16 -2
  228. package/extensions/dm-mcp-adapter/.github/workflows/ci.yml +82 -0
  229. package/extensions/dm-mcp-adapter/THIRD_PARTY_NOTICES.md +1 -1
  230. package/extensions/dm-mcp-adapter/VISION.md +94 -0
  231. package/extensions/dm-mcp-adapter/agent-dir.js +2 -2
  232. package/extensions/dm-mcp-adapter/bearer-command-resolver.js +5 -3
  233. package/extensions/dm-mcp-adapter/bench/server-memory.mjs +432 -0
  234. package/extensions/dm-mcp-adapter/bench/session.js +105 -0
  235. package/extensions/dm-mcp-adapter/bench/token-cost/data.mjs +231 -0
  236. package/extensions/dm-mcp-adapter/bench/token-cost/run.mjs +190 -0
  237. package/extensions/dm-mcp-adapter/bench/token-cost/server.mjs +109 -0
  238. package/extensions/dm-mcp-adapter/cli.js +55 -100
  239. package/extensions/dm-mcp-adapter/codemode-bridge.js +92 -0
  240. package/extensions/dm-mcp-adapter/commands.js +143 -26
  241. package/extensions/dm-mcp-adapter/config.js +303 -78
  242. package/extensions/dm-mcp-adapter/conformance/baseline-client.yml +22 -0
  243. package/extensions/dm-mcp-adapter/conformance/driver.js +200 -0
  244. package/extensions/dm-mcp-adapter/conformance/driver.sh +24 -0
  245. package/extensions/dm-mcp-adapter/conformance/run.sh +130 -0
  246. package/extensions/dm-mcp-adapter/deferred-tool-surface.js +69 -0
  247. package/extensions/dm-mcp-adapter/direct-tool-surface.js +96 -72
  248. package/extensions/dm-mcp-adapter/direct-tools.js +76 -53
  249. package/extensions/dm-mcp-adapter/dm-host-tool-context.js +0 -0
  250. package/extensions/dm-mcp-adapter/elicitation-handler.js +4 -0
  251. package/extensions/dm-mcp-adapter/error-signal.js +12 -1
  252. package/extensions/dm-mcp-adapter/executor-accounts.js +192 -0
  253. package/extensions/dm-mcp-adapter/executor-app-tools.js +61 -0
  254. package/extensions/dm-mcp-adapter/executor-catalog.js +157 -0
  255. package/extensions/dm-mcp-adapter/executor-pauses.js +105 -0
  256. package/extensions/dm-mcp-adapter/extraction-settings.js +43 -0
  257. package/extensions/dm-mcp-adapter/extraction.js +396 -0
  258. package/extensions/dm-mcp-adapter/host-html-template.js +1 -1
  259. package/extensions/dm-mcp-adapter/host-managed.js +24 -5
  260. package/extensions/dm-mcp-adapter/index.js +761 -76
  261. package/extensions/dm-mcp-adapter/init.js +235 -11
  262. package/extensions/dm-mcp-adapter/jev-semantic-search.js +161 -0
  263. package/extensions/dm-mcp-adapter/mcp-code.js +12 -11
  264. package/extensions/dm-mcp-adapter/mcp-keyring-helper.cjs +1 -1
  265. package/extensions/dm-mcp-adapter/mcp-output-guard.js +7 -0
  266. package/extensions/dm-mcp-adapter/mcp-panel.js +23 -21
  267. package/extensions/dm-mcp-adapter/mcp-probe.js +1 -1
  268. package/extensions/dm-mcp-adapter/mcp-status.js +2 -1
  269. package/extensions/dm-mcp-adapter/mcp-tasks.js +46 -7
  270. package/extensions/dm-mcp-adapter/metadata-cache.js +93 -5
  271. package/extensions/dm-mcp-adapter/namespace-tools.js +12 -4
  272. package/extensions/dm-mcp-adapter/output-shape.js +1 -1
  273. package/extensions/dm-mcp-adapter/package.json +1 -1
  274. package/extensions/dm-mcp-adapter/pi-mcp.mp4 +0 -0
  275. package/extensions/dm-mcp-adapter/pi-signin-import.js +1 -1
  276. package/extensions/dm-mcp-adapter/project-server-trust.js +108 -20
  277. package/extensions/dm-mcp-adapter/proxy-modes.js +320 -110
  278. package/extensions/dm-mcp-adapter/request-headers-command.js +17 -1
  279. package/extensions/dm-mcp-adapter/runtime-owner.js +7 -6
  280. package/extensions/dm-mcp-adapter/sampling-handler.js +8 -2
  281. package/extensions/dm-mcp-adapter/script-tool-save.js +251 -0
  282. package/extensions/dm-mcp-adapter/script-tool-surface.js +100 -0
  283. package/extensions/dm-mcp-adapter/script-tools.js +72 -0
  284. package/extensions/dm-mcp-adapter/semantic-search.js +176 -50
  285. package/extensions/dm-mcp-adapter/semantic-settings.js +51 -0
  286. package/extensions/dm-mcp-adapter/server-log.js +19 -0
  287. package/extensions/dm-mcp-adapter/server-manager.js +64 -21
  288. package/extensions/dm-mcp-adapter/task-entries.js +60 -0
  289. package/extensions/dm-mcp-adapter/task-jobs.js +263 -0
  290. package/extensions/dm-mcp-adapter/tool-approval.js +49 -2
  291. package/extensions/dm-mcp-adapter/tool-metadata.js +70 -3
  292. package/extensions/dm-mcp-adapter/tool-registrar.js +8 -1
  293. package/extensions/dm-mcp-adapter/tool-result-renderer.js +10 -6
  294. package/extensions/dm-mcp-adapter/types.js +7 -0
  295. package/extensions/dm-mcp-adapter/ui-server.js +24 -18
  296. package/extensions/dm-mcp-adapter/ui-session.js +3 -3
  297. package/extensions/dm-mcp-adapter/upgrade-notice.js +42 -0
  298. package/extensions/dm-mcp-adapter/utils.js +33 -7
  299. package/extensions/dm-ponytail/extensions/ponytail.mjs +11 -3
  300. package/extensions/dm-ponytail/hooks/band/board.js +524 -0
  301. package/extensions/dm-ponytail/hooks/band/logo.js +2 -0
  302. package/extensions/dm-ponytail/hooks/band/metrics.js +238 -0
  303. package/extensions/dm-ponytail/hooks/band/register.js +532 -0
  304. package/extensions/dm-ponytail/hooks/claude-band.json +6 -0
  305. package/extensions/dm-ponytail/hooks/claude-codex-hooks.json +6 -6
  306. package/extensions/dm-ponytail/hooks/copilot-hooks.json +6 -6
  307. package/extensions/dm-ponytail/hooks/cursor-hooks.json +2 -2
  308. package/extensions/dm-ponytail/hooks/ponytail-activate.js +105 -70
  309. package/extensions/dm-ponytail/hooks/ponytail-band-import.js +308 -0
  310. package/extensions/dm-ponytail/hooks/ponytail-config.js +4 -0
  311. package/extensions/dm-ponytail/hooks/ponytail-instructions.js +1 -1
  312. package/extensions/dm-ponytail/hooks/ponytail-map.js +7 -3
  313. package/extensions/dm-ponytail/hooks/ponytail-mode-tracker.js +41 -4
  314. package/extensions/dm-ponytail/hooks/ponytail-runtime.js +11 -8
  315. package/extensions/dm-ponytail/pi-extension/index.js +11 -3
  316. package/extensions/dm-ponytail/skills/ponytail/SKILL.md +1 -1
  317. package/extensions/dm-ponytail/skills/ponytail-debt/SKILL.md +4 -5
  318. package/extensions/dm-ponytail/skills/ponytail-gain/SKILL.md +0 -1
  319. package/extensions/dm-ponytail/skills/ponytail-help/SKILL.md +6 -0
  320. package/extensions/dm-skills-manager/package.json +1 -1
  321. package/extensions/dm-subagents/VISION.md +98 -0
  322. package/extensions/dm-subagents/agents/evidence-auditor.md +1 -0
  323. package/extensions/dm-subagents/agents/oracle.md +1 -0
  324. package/extensions/dm-subagents/agents/reviewer.md +1 -0
  325. package/extensions/dm-subagents/package.json +2 -1
  326. package/extensions/dm-subagents/scripts/build-package.mjs +128 -0
  327. package/extensions/dm-subagents/skills/council-mode/SKILL.md +1 -4
  328. package/extensions/dm-subagents/skills/dm-subagents/SKILL.md +130 -106
  329. package/extensions/dm-subagents/skills/dm-subagents/references/execution-controls.md +4 -3
  330. package/extensions/dm-subagents/skills/dm-subagents/references/orchestration.md +124 -0
  331. package/extensions/dm-subagents/skills/dm-subagents/references/prompting-and-roles.md +96 -295
  332. package/extensions/dm-subagents/src/agents/agent-management.js +14 -19
  333. package/extensions/dm-subagents/src/agents/agent-memory.js +2 -1
  334. package/extensions/dm-subagents/src/agents/agent-serializer.js +1 -2
  335. package/extensions/dm-subagents/src/agents/agents.js +7 -8
  336. package/extensions/dm-subagents/src/agents/frontmatter.js +34 -16
  337. package/extensions/dm-subagents/src/agents/skills.js +1 -1
  338. package/extensions/dm-subagents/src/api/background-work.js +8 -5
  339. package/extensions/dm-subagents/src/api/external-runs.js +3 -4
  340. package/extensions/dm-subagents/src/extension/active-runs-prompt.js +20 -0
  341. package/extensions/dm-subagents/src/extension/config.js +12 -0
  342. package/extensions/dm-subagents/src/extension/declaration-pinning.js +20 -3
  343. package/extensions/dm-subagents/src/extension/herdr-dm-bridge.js +24 -12
  344. package/extensions/dm-subagents/src/extension/index.js +125 -20
  345. package/extensions/dm-subagents/src/extension/public-execution.js +3 -0
  346. package/extensions/dm-subagents/src/extension/reply-workflow-script.js +3 -2
  347. package/extensions/dm-subagents/src/extension/rpc.js +5 -3
  348. package/extensions/dm-subagents/src/extension/schemas.js +6 -5
  349. package/extensions/dm-subagents/src/extension/subagent-guide.js +1 -2
  350. package/extensions/dm-subagents/src/extension/tool-activation.js +60 -26
  351. package/extensions/dm-subagents/src/extension/tool-description.js +2 -2
  352. package/extensions/dm-subagents/src/extension/upgrade-notice.js +5 -1
  353. package/extensions/dm-subagents/src/intercom/native-supervisor-channel.js +143 -15
  354. package/extensions/dm-subagents/src/missions/actions.js +4 -1
  355. package/extensions/dm-subagents/src/missions/lifecycle.js +32 -8
  356. package/extensions/dm-subagents/src/missions/store.js +1 -0
  357. package/extensions/dm-subagents/src/runs/background/active-async-capacity.js +15 -9
  358. package/extensions/dm-subagents/src/runs/background/async-execution.js +30 -16
  359. package/extensions/dm-subagents/src/runs/background/async-job-tracker.js +12 -3
  360. package/extensions/dm-subagents/src/runs/background/async-resume.js +5 -3
  361. package/extensions/dm-subagents/src/runs/background/async-status-snapshot.js +4 -2
  362. package/extensions/dm-subagents/src/runs/background/async-status.js +32 -10
  363. package/extensions/dm-subagents/src/runs/background/auto-drain.js +2 -1
  364. package/extensions/dm-subagents/src/runs/background/await-async-run.js +2 -7
  365. package/extensions/dm-subagents/src/runs/background/boot-id.js +36 -0
  366. package/extensions/dm-subagents/src/runs/background/chain-root-attachment.js +4 -4
  367. package/extensions/dm-subagents/src/runs/background/index-segment.js +1 -1
  368. package/extensions/dm-subagents/src/runs/background/inspect-rpc.js +17 -3
  369. package/extensions/dm-subagents/src/runs/background/interrupted-elsewhere.js +55 -0
  370. package/extensions/dm-subagents/src/runs/background/notify.js +98 -10
  371. package/extensions/dm-subagents/src/runs/background/result-delivery-ownership.js +20 -22
  372. package/extensions/dm-subagents/src/runs/background/result-files.js +9 -6
  373. package/extensions/dm-subagents/src/runs/background/result-watcher.js +32 -17
  374. package/extensions/dm-subagents/src/runs/background/resume-guidance.js +2 -1
  375. package/extensions/dm-subagents/src/runs/background/retained-children.js +1 -1
  376. package/extensions/dm-subagents/src/runs/background/run-child-session.js +40 -21
  377. package/extensions/dm-subagents/src/runs/background/run-status.js +12 -5
  378. package/extensions/dm-subagents/src/runs/background/runner-aliases.js +7 -5
  379. package/extensions/dm-subagents/src/runs/background/runner-child-launch.js +1 -2
  380. package/extensions/dm-subagents/src/runs/background/stale-run-reconciler.js +89 -21
  381. package/extensions/dm-subagents/src/runs/background/subagent-runner-bootstrap.js +2 -0
  382. package/extensions/dm-subagents/src/runs/background/subagent-runner.js +190 -244
  383. package/extensions/dm-subagents/src/runs/background/subagent-wait.js +5 -2
  384. package/extensions/dm-subagents/src/runs/background/terminal-run-index.js +39 -4
  385. package/extensions/dm-subagents/src/runs/background/wait-subscriptions.js +5 -1
  386. package/extensions/dm-subagents/src/runs/background/workflow-terminal-proof.js +28 -2
  387. package/extensions/dm-subagents/src/runs/foreground/async-dismiss-action.js +2 -1
  388. package/extensions/dm-subagents/src/runs/foreground/async-steering-action.js +21 -7
  389. package/extensions/dm-subagents/src/runs/foreground/async-stop-action.js +10 -8
  390. package/extensions/dm-subagents/src/runs/foreground/command-action.js +2 -1
  391. package/extensions/dm-subagents/src/runs/foreground/execution.js +107 -66
  392. package/extensions/dm-subagents/src/runs/foreground/foreground-history.js +111 -32
  393. package/extensions/dm-subagents/src/runs/foreground/prompt-audit.js +2 -2
  394. package/extensions/dm-subagents/src/runs/foreground/subagent-executor.js +377 -126
  395. package/extensions/dm-subagents/src/runs/shared/async-status-projection.js +18 -1
  396. package/extensions/dm-subagents/src/runs/shared/child-commands.js +7 -1
  397. package/extensions/dm-subagents/src/runs/shared/child-runtime-config.js +1 -0
  398. package/extensions/dm-subagents/src/runs/shared/child-session.js +184 -65
  399. package/extensions/dm-subagents/src/runs/shared/child-tool-plan.js +14 -3
  400. package/extensions/dm-subagents/src/runs/shared/dm-spawn.js +71 -25
  401. package/extensions/dm-subagents/src/runs/shared/external-cli-runner.js +2 -1
  402. package/extensions/dm-subagents/src/runs/shared/herdr-connection.js +20 -10
  403. package/extensions/dm-subagents/src/runs/shared/herdr-external-adapters.js +1 -1
  404. package/extensions/dm-subagents/src/runs/shared/herdr-machine.js +50 -8
  405. package/extensions/dm-subagents/src/runs/shared/herdr-pane-host.js +212 -0
  406. package/extensions/dm-subagents/src/runs/shared/herdr-placed-run.js +47 -503
  407. package/extensions/dm-subagents/src/runs/shared/local-machine-access.js +29 -0
  408. package/extensions/dm-subagents/src/runs/shared/long-running-guard.js +70 -17
  409. package/extensions/dm-subagents/src/runs/shared/model-resolution.js +7 -1
  410. package/extensions/dm-subagents/src/runs/shared/nested-events.js +2 -0
  411. package/extensions/dm-subagents/src/runs/shared/orca-progress-tabs.js +2 -24
  412. package/extensions/dm-subagents/src/runs/shared/parallel-handoff.js +9 -6
  413. package/extensions/dm-subagents/src/runs/shared/partial-output.js +5 -0
  414. package/extensions/dm-subagents/src/runs/shared/placed-run-owner.js +157 -0
  415. package/extensions/dm-subagents/src/runs/shared/placement-host.js +166 -0
  416. package/extensions/dm-subagents/src/runs/shared/rex-machine.js +75 -0
  417. package/extensions/dm-subagents/src/runs/shared/rex-pane-host.js +306 -0
  418. package/extensions/dm-subagents/src/runs/shared/run-ownership.js +7 -0
  419. package/extensions/dm-subagents/src/runs/shared/single-output.js +29 -6
  420. package/extensions/dm-subagents/src/runs/shared/structured-output.js +1 -0
  421. package/extensions/dm-subagents/src/runs/shared/subagent-control.js +2 -1
  422. package/extensions/dm-subagents/src/runs/shared/subagent-prompt-runtime.js +177 -17
  423. package/extensions/dm-subagents/src/runs/shared/tool-budget.js +1 -1
  424. package/extensions/dm-subagents/src/shared/accessible-dir.js +1 -1
  425. package/extensions/dm-subagents/src/shared/child-transcript.js +1 -1
  426. package/extensions/dm-subagents/src/shared/completion-owner.js +1 -0
  427. package/extensions/dm-subagents/src/shared/dm-declarations.js +36 -1
  428. package/extensions/dm-subagents/src/shared/dm-safeguards.js +1 -1
  429. package/extensions/dm-subagents/src/shared/dm-settlement.js +2 -0
  430. package/extensions/dm-subagents/src/shared/extension-context.js +3 -0
  431. package/extensions/dm-subagents/src/shared/file-lease.js +4 -1
  432. package/extensions/dm-subagents/src/shared/fork-context.js +21 -8
  433. package/extensions/dm-subagents/src/shared/parent-wake.js +6 -11
  434. package/extensions/dm-subagents/src/shared/provider-diagnostics.js +59 -0
  435. package/extensions/dm-subagents/src/shared/session-identity.js +24 -0
  436. package/extensions/dm-subagents/src/shared/session-succession.js +18 -0
  437. package/extensions/dm-subagents/src/shared/types.js +5 -4
  438. package/extensions/dm-subagents/src/shared/utils.js +13 -0
  439. package/extensions/dm-subagents/src/slash/delegation-adapters.js +8 -1
  440. package/extensions/dm-subagents/src/slash/prompt-template-bridge.js +2 -1
  441. package/extensions/dm-subagents/src/slash/slash-commands.js +6 -4
  442. package/extensions/dm-subagents/src/slash/subagents-admin.js +3 -2
  443. package/extensions/dm-subagents/src/tui/dm-mouse-region.js +9 -1
  444. package/extensions/dm-subagents/src/tui/fleet-layout.js +19 -0
  445. package/extensions/dm-subagents/src/tui/fleet-status.js +20 -3
  446. package/extensions/dm-subagents/src/tui/fleet-viewport.js +59 -0
  447. package/extensions/dm-subagents/src/tui/fleet.js +92 -69
  448. package/extensions/dm-subagents/src/tui/render.js +45 -19
  449. package/extensions/dm-subagents/src/tui/subagent-messages.js +1 -0
  450. package/extensions/dm-subagents/src/watchdog/change-signature.js +1 -3
  451. package/extensions/dm-subagents/src/watchdog/diff-tool.js +7 -3
  452. package/extensions/dm-subagents/src/watchdog/permission-arbiter.js +15 -6
  453. package/extensions/dm-subagents/src/watchdog/register-main.js +10 -9
  454. package/extensions/dm-subagents/src/watchdog/review.js +9 -1
  455. package/extensions/dm-subagents/src/watchdog/runtime.js +3 -5
  456. package/extensions/dm-subagents/src/workflows/scripted-workflow.js +33 -6
  457. package/extensions/dm-subagents/src/workflows/structured-workflow-scripts.js +21 -8
  458. package/extensions/dm-subagents/src/workflows/workflow-auto-resume.js +81 -0
  459. package/extensions/dm-subagents/src/workflows/workflow-child-summary.js +18 -2
  460. package/extensions/dm-subagents/src/workflows/workflow-launch-record.js +45 -0
  461. package/extensions/dm-subagents/src/workflows/workflow-resources.js +2 -2
  462. package/extensions/dm-subagents/src/workflows/workflow-resume-claim.js +171 -0
  463. package/extensions/dm-subagents/src/workflows/workflow-resume.js +88 -0
  464. package/extensions/dm-subagents/src/workflows/workflow-reuse.js +72 -3
  465. package/extensions/dm-subagents/src/workflows/workflow-revival.js +1 -1
  466. package/extensions/dm-subagents/src/workflows/workflow-stop-cause.js +5 -0
  467. package/extensions/dm-web-access/.github/workflows/test.yml +28 -0
  468. package/extensions/dm-web-access/anysearch.js +3 -3
  469. package/extensions/dm-web-access/bocha.js +3 -3
  470. package/extensions/dm-web-access/brave-rate-limit.js +2 -2
  471. package/extensions/dm-web-access/brave.js +5 -10
  472. package/extensions/dm-web-access/brightdata-unlocker.js +2 -2
  473. package/extensions/dm-web-access/brightdata.js +3 -3
  474. package/extensions/dm-web-access/ceramic.js +2 -2
  475. package/extensions/dm-web-access/chrome-cookies.js +1 -1
  476. package/extensions/dm-web-access/claim-judge.js +147 -0
  477. package/extensions/dm-web-access/content-find.js +1 -1
  478. package/extensions/dm-web-access/credential-source.js +42 -5
  479. package/extensions/dm-web-access/curator-page.js +8 -2
  480. package/extensions/dm-web-access/curator-server.js +6 -0
  481. package/extensions/dm-web-access/deepseek.js +331 -0
  482. package/extensions/dm-web-access/duckduckgo-rate-limit.js +75 -0
  483. package/extensions/dm-web-access/duckduckgo.js +49 -43
  484. package/extensions/dm-web-access/endpoint-pdf-extract.js +30 -77
  485. package/extensions/dm-web-access/eval/claim-judge.mjs +96 -0
  486. package/extensions/dm-web-access/eval/field-extract.mjs +84 -0
  487. package/extensions/dm-web-access/eval/fixtures/claims-calibration.json +1026 -0
  488. package/extensions/dm-web-access/eval/fixtures/claims-holdout.json +896 -0
  489. package/extensions/dm-web-access/eval/fixtures/claims-sibling-holdout.json +226 -0
  490. package/extensions/dm-web-access/eval/fixtures/extract-calibration.json +12 -0
  491. package/extensions/dm-web-access/eval/fixtures/extract-holdout.json +172 -0
  492. package/extensions/dm-web-access/eval/fixtures/offtopic-calibration.json +103 -0
  493. package/extensions/dm-web-access/eval/fixtures/offtopic-holdout.json +307 -0
  494. package/extensions/dm-web-access/eval/offtopic-judge.mjs +66 -0
  495. package/extensions/dm-web-access/evidence/CONTRACT-EVIDENCE.md +496 -0
  496. package/extensions/dm-web-access/evidence/contract-probe.mjs +127 -0
  497. package/extensions/dm-web-access/exa.js +42 -4
  498. package/extensions/dm-web-access/extract.js +110 -19
  499. package/extensions/dm-web-access/fetch-params.js +12 -3
  500. package/extensions/dm-web-access/field-extract.js +324 -0
  501. package/extensions/dm-web-access/gemini-adc.js +47 -1
  502. package/extensions/dm-web-access/gemini-api.js +11 -0
  503. package/extensions/dm-web-access/gemini-search.js +204 -196
  504. package/extensions/dm-web-access/github-extract.js +1 -1
  505. package/extensions/dm-web-access/github-issue-pr.js +6 -6
  506. package/extensions/dm-web-access/index.js +159 -112
  507. package/extensions/dm-web-access/jina-search.js +6 -4
  508. package/extensions/dm-web-access/kagi.js +4 -4
  509. package/extensions/dm-web-access/keenable.js +2 -2
  510. package/extensions/dm-web-access/linkup.js +160 -0
  511. package/extensions/dm-web-access/mistral-search.js +4 -4
  512. package/extensions/dm-web-access/ninerouter.js +100 -0
  513. package/extensions/dm-web-access/offtopic-judge.js +56 -0
  514. package/extensions/dm-web-access/ollama.js +4 -4
  515. package/extensions/dm-web-access/openai-search.js +32 -12
  516. package/extensions/dm-web-access/package.json +1 -1
  517. package/extensions/dm-web-access/page-query.js +7 -4
  518. package/extensions/dm-web-access/parallel.js +6 -7
  519. package/extensions/dm-web-access/pdf-extract.js +1 -3
  520. package/extensions/dm-web-access/perplexity.js +6 -5
  521. package/extensions/dm-web-access/querit.js +3 -3
  522. package/extensions/dm-web-access/query-rewrite.js +32 -8
  523. package/extensions/dm-web-access/scripts/dm-extensions-dist.js +16 -0
  524. package/extensions/dm-web-access/scripts/publish.js +38 -0
  525. package/extensions/dm-web-access/search1api.js +3 -3
  526. package/extensions/dm-web-access/searchinfinity.js +3 -3
  527. package/extensions/dm-web-access/searxng.js +2 -1
  528. package/extensions/dm-web-access/serpapi.js +6 -5
  529. package/extensions/dm-web-access/serpbase.js +4 -4
  530. package/extensions/dm-web-access/serpdive.js +3 -3
  531. package/extensions/dm-web-access/serper.js +5 -4
  532. package/extensions/dm-web-access/serply.js +2 -2
  533. package/extensions/dm-web-access/source-check.js +22 -14
  534. package/extensions/dm-web-access/ssrf-protection.js +29 -4
  535. package/extensions/dm-web-access/summary-model-scope.js +11 -1
  536. package/extensions/dm-web-access/summary-review.js +36 -43
  537. package/extensions/dm-web-access/tool-activation.js +11 -2
  538. package/extensions/dm-web-access/upgrade-notice.js +41 -0
  539. package/extensions/dm-web-access/utils.js +51 -3
  540. package/extensions/dm-web-access/valyu.js +3 -3
  541. package/extensions/dm-web-access/video-extract.js +3 -2
  542. package/extensions/dm-web-access/web-tool-core.js +161 -51
  543. package/extensions/dm-web-access/xai-search.js +44 -9
  544. package/extensions/dm-web-access/xcrawl.js +3 -3
  545. package/extensions/dm-web-access/you.js +2 -2
  546. package/package.json +4 -4
  547. package/extensions/dm-lens/dist/clients/actionable-warnings-logger.js +0 -24
  548. package/extensions/dm-lens/dist/clients/actionable-warnings.js +0 -1062
  549. package/extensions/dm-lens/dist/clients/advisory-provenance.js +0 -387
  550. package/extensions/dm-lens/dist/clients/agent-behavior-client.js +0 -94
  551. package/extensions/dm-lens/dist/clients/agent-nudge.js +0 -253
  552. package/extensions/dm-lens/dist/clients/analysed-root.js +0 -1
  553. package/extensions/dm-lens/dist/clients/analysis-root.js +0 -100
  554. package/extensions/dm-lens/dist/clients/ast-grep-client.js +0 -587
  555. package/extensions/dm-lens/dist/clients/ast-grep-rule-manager.js +0 -137
  556. package/extensions/dm-lens/dist/clients/ast-grep-tool-logger.js +0 -85
  557. package/extensions/dm-lens/dist/clients/ast-grep-types.js +0 -1
  558. package/extensions/dm-lens/dist/clients/ast-grep-yaml-synth.js +0 -109
  559. package/extensions/dm-lens/dist/clients/atomic-write-staging.js +0 -66
  560. package/extensions/dm-lens/dist/clients/atomic-write.js +0 -37
  561. package/extensions/dm-lens/dist/clients/availability-probe-flight.js +0 -11
  562. package/extensions/dm-lens/dist/clients/bash-file-access.js +0 -830
  563. package/extensions/dm-lens/dist/clients/biome-client.js +0 -223
  564. package/extensions/dm-lens/dist/clients/blocker-freshness.js +0 -377
  565. package/extensions/dm-lens/dist/clients/blocker-past-eof.js +0 -49
  566. package/extensions/dm-lens/dist/clients/bootstrap.js +0 -246
  567. package/extensions/dm-lens/dist/clients/bounded-cache.js +0 -105
  568. package/extensions/dm-lens/dist/clients/bounded-pid-file-lock.js +0 -275
  569. package/extensions/dm-lens/dist/clients/bounded-telemetry.js +0 -107
  570. package/extensions/dm-lens/dist/clients/build-identity.js +0 -45
  571. package/extensions/dm-lens/dist/clients/bundled-resource-health.js +0 -41
  572. package/extensions/dm-lens/dist/clients/bus-events-logger.js +0 -48
  573. package/extensions/dm-lens/dist/clients/bus-publish.js +0 -117
  574. package/extensions/dm-lens/dist/clients/cache/rule-cache.js +0 -87
  575. package/extensions/dm-lens/dist/clients/cache-manager.js +0 -428
  576. package/extensions/dm-lens/dist/clients/cache-observability.js +0 -847
  577. package/extensions/dm-lens/dist/clients/call-graph.js +0 -628
  578. package/extensions/dm-lens/dist/clients/cargo-manifest.js +0 -171
  579. package/extensions/dm-lens/dist/clients/cascade-budget.js +0 -52
  580. package/extensions/dm-lens/dist/clients/cascade-format.js +0 -160
  581. package/extensions/dm-lens/dist/clients/cascade-logger.js +0 -22
  582. package/extensions/dm-lens/dist/clients/cascade-types.js +0 -1
  583. package/extensions/dm-lens/dist/clients/child-unref.js +0 -59
  584. package/extensions/dm-lens/dist/clients/code-quality-warnings.js +0 -192
  585. package/extensions/dm-lens/dist/clients/codebase-model.js +0 -110
  586. package/extensions/dm-lens/dist/clients/collateral-test-role.js +0 -8
  587. package/extensions/dm-lens/dist/clients/complexity-client.js +0 -398
  588. package/extensions/dm-lens/dist/clients/config-core/deny.js +0 -117
  589. package/extensions/dm-lens/dist/clients/config-core/index.js +0 -2
  590. package/extensions/dm-lens/dist/clients/config-core/merge.js +0 -228
  591. package/extensions/dm-lens/dist/clients/config-core/normalize.js +0 -226
  592. package/extensions/dm-lens/dist/clients/config-core/process-spec.js +0 -147
  593. package/extensions/dm-lens/dist/clients/config-core/provenance.js +0 -54
  594. package/extensions/dm-lens/dist/clients/config-core/records.js +0 -79
  595. package/extensions/dm-lens/dist/clients/config-core/resolve.js +0 -48
  596. package/extensions/dm-lens/dist/clients/config-core/safe-object.js +0 -22
  597. package/extensions/dm-lens/dist/clients/config-core/schema.js +0 -93
  598. package/extensions/dm-lens/dist/clients/config-diagnostic-codes.js +0 -90
  599. package/extensions/dm-lens/dist/clients/config-locations.js +0 -175
  600. package/extensions/dm-lens/dist/clients/config-resolve.js +0 -359
  601. package/extensions/dm-lens/dist/clients/config-schema.js +0 -230
  602. package/extensions/dm-lens/dist/clients/config-warn.js +0 -146
  603. package/extensions/dm-lens/dist/clients/confirmed-delete.js +0 -11
  604. package/extensions/dm-lens/dist/clients/console-guard-install.js +0 -4
  605. package/extensions/dm-lens/dist/clients/cooperative-budget.js +0 -36
  606. package/extensions/dm-lens/dist/clients/custom-rule-locations.js +0 -28
  607. package/extensions/dm-lens/dist/clients/dead-code-client.js +0 -408
  608. package/extensions/dm-lens/dist/clients/dead-code-logger.js +0 -18
  609. package/extensions/dm-lens/dist/clients/deadline-utils.js +0 -117
  610. package/extensions/dm-lens/dist/clients/debug-handles.js +0 -121
  611. package/extensions/dm-lens/dist/clients/debug-heap.js +0 -80
  612. package/extensions/dm-lens/dist/clients/deferred-lsp-work.js +0 -33
  613. package/extensions/dm-lens/dist/clients/deferred-runner-blockers.js +0 -106
  614. package/extensions/dm-lens/dist/clients/deferred-test-targets.js +0 -31
  615. package/extensions/dm-lens/dist/clients/degradation-ledger.js +0 -289
  616. package/extensions/dm-lens/dist/clients/demoted-finding-render.js +0 -64
  617. package/extensions/dm-lens/dist/clients/dependency-checker.js +0 -534
  618. package/extensions/dm-lens/dist/clients/deps/ast-grep-napi.js +0 -17
  619. package/extensions/dm-lens/dist/clients/deps/dm-host-deps.js +0 -10
  620. package/extensions/dm-lens/dist/clients/deps/dm-tui-compat.js +0 -58
  621. package/extensions/dm-lens/dist/clients/deps/js-yaml.js +0 -7
  622. package/extensions/dm-lens/dist/clients/deps/minimatch.js +0 -6
  623. package/extensions/dm-lens/dist/clients/deps/pidusage.js +0 -5
  624. package/extensions/dm-lens/dist/clients/deps/typebox.js +0 -5
  625. package/extensions/dm-lens/dist/clients/deps/vscode-jsonrpc.js +0 -8
  626. package/extensions/dm-lens/dist/clients/deps/web-tree-sitter.js +0 -11
  627. package/extensions/dm-lens/dist/clients/diagnostic-dispositions.js +0 -318
  628. package/extensions/dm-lens/dist/clients/diagnostic-line-freshness.js +0 -142
  629. package/extensions/dm-lens/dist/clients/diagnostic-logger.js +0 -60
  630. package/extensions/dm-lens/dist/clients/diagnostic-tracker.js +0 -89
  631. package/extensions/dm-lens/dist/clients/diagnostics-publish.js +0 -134
  632. package/extensions/dm-lens/dist/clients/dispatch/adopted-root-runners.js +0 -22
  633. package/extensions/dm-lens/dist/clients/dispatch/ast-grep-catalog.js +0 -16
  634. package/extensions/dm-lens/dist/clients/dispatch/auxiliary-lsp.js +0 -158
  635. package/extensions/dm-lens/dist/clients/dispatch/collect-later-tier.js +0 -25
  636. package/extensions/dm-lens/dist/clients/dispatch/diagnostic-taxonomy.js +0 -58
  637. package/extensions/dm-lens/dist/clients/dispatch/dispatcher.js +0 -1017
  638. package/extensions/dm-lens/dist/clients/dispatch/fact-provider-types.js +0 -1
  639. package/extensions/dm-lens/dist/clients/dispatch/fact-rule-runner.js +0 -17
  640. package/extensions/dm-lens/dist/clients/dispatch/fact-runner.js +0 -18
  641. package/extensions/dm-lens/dist/clients/dispatch/fact-scheduler.js +0 -52
  642. package/extensions/dm-lens/dist/clients/dispatch/fact-store.js +0 -199
  643. package/extensions/dm-lens/dist/clients/dispatch/facts/comment-facts.js +0 -23
  644. package/extensions/dm-lens/dist/clients/dispatch/facts/file-content.js +0 -18
  645. package/extensions/dm-lens/dist/clients/dispatch/facts/function-facts.js +0 -281
  646. package/extensions/dm-lens/dist/clients/dispatch/facts/import-facts.js +0 -169
  647. package/extensions/dm-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +0 -19
  648. package/extensions/dm-lens/dist/clients/dispatch/facts/try-catch-facts.js +0 -95
  649. package/extensions/dm-lens/dist/clients/dispatch/finding-policy.js +0 -164
  650. package/extensions/dm-lens/dist/clients/dispatch/indent-detect.js +0 -227
  651. package/extensions/dm-lens/dist/clients/dispatch/inline-suppressions.js +0 -52
  652. package/extensions/dm-lens/dist/clients/dispatch/integration.js +0 -1502
  653. package/extensions/dm-lens/dist/clients/dispatch/known-runner-ids.js +0 -13
  654. package/extensions/dm-lens/dist/clients/dispatch/lazy.js +0 -8
  655. package/extensions/dm-lens/dist/clients/dispatch/pending-runner-findings.js +0 -130
  656. package/extensions/dm-lens/dist/clients/dispatch/plan.js +0 -284
  657. package/extensions/dm-lens/dist/clients/dispatch/priorities.js +0 -14
  658. package/extensions/dm-lens/dist/clients/dispatch/rule-id-normalize.js +0 -49
  659. package/extensions/dm-lens/dist/clients/dispatch/rule-ignores.js +0 -21
  660. package/extensions/dm-lens/dist/clients/dispatch/rule-policy.js +0 -102
  661. package/extensions/dm-lens/dist/clients/dispatch/rules/async-noise.js +0 -31
  662. package/extensions/dm-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +0 -27
  663. package/extensions/dm-lens/dist/clients/dispatch/rules/cors-wildcard.js +0 -35
  664. package/extensions/dm-lens/dist/clients/dispatch/rules/error-obscuring.js +0 -29
  665. package/extensions/dm-lens/dist/clients/dispatch/rules/error-swallowing.js +0 -29
  666. package/extensions/dm-lens/dist/clients/dispatch/rules/framework-call-noise.js +0 -31
  667. package/extensions/dm-lens/dist/clients/dispatch/rules/high-complexity.js +0 -56
  668. package/extensions/dm-lens/dist/clients/dispatch/rules/high-fan-out.js +0 -45
  669. package/extensions/dm-lens/dist/clients/dispatch/rules/high-import-coupling.js +0 -31
  670. package/extensions/dm-lens/dist/clients/dispatch/rules/missing-error-propagation.js +0 -45
  671. package/extensions/dm-lens/dist/clients/dispatch/rules/no-commented-credentials.js +0 -46
  672. package/extensions/dm-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +0 -38
  673. package/extensions/dm-lens/dist/clients/dispatch/rules/placeholder-comments.js +0 -40
  674. package/extensions/dm-lens/dist/clients/dispatch/rules/unsafe-boundary.js +0 -101
  675. package/extensions/dm-lens/dist/clients/dispatch/runner-context.js +0 -46
  676. package/extensions/dm-lens/dist/clients/dispatch/runners/actionlint.js +0 -98
  677. package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-napi.js +0 -694
  678. package/extensions/dm-lens/dist/clients/dispatch/runners/biome-check.js +0 -205
  679. package/extensions/dm-lens/dist/clients/dispatch/runners/cpp-check.js +0 -190
  680. package/extensions/dm-lens/dist/clients/dispatch/runners/credo.js +0 -66
  681. package/extensions/dm-lens/dist/clients/dispatch/runners/cue-vet.js +0 -171
  682. package/extensions/dm-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -151
  683. package/extensions/dm-lens/dist/clients/dispatch/runners/detekt.js +0 -157
  684. package/extensions/dm-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -157
  685. package/extensions/dm-lens/dist/clients/dispatch/runners/elixir-check.js +0 -153
  686. package/extensions/dm-lens/dist/clients/dispatch/runners/eslint.js +0 -99
  687. package/extensions/dm-lens/dist/clients/dispatch/runners/fact-rules.js +0 -20
  688. package/extensions/dm-lens/dist/clients/dispatch/runners/fish-indent.js +0 -66
  689. package/extensions/dm-lens/dist/clients/dispatch/runners/gleam-check.js +0 -110
  690. package/extensions/dm-lens/dist/clients/dispatch/runners/go-vet.js +0 -52
  691. package/extensions/dm-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -89
  692. package/extensions/dm-lens/dist/clients/dispatch/runners/hadolint.js +0 -83
  693. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-lint.js +0 -144
  694. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-render.js +0 -593
  695. package/extensions/dm-lens/dist/clients/dispatch/runners/htmlhint.js +0 -103
  696. package/extensions/dm-lens/dist/clients/dispatch/runners/index.js +0 -100
  697. package/extensions/dm-lens/dist/clients/dispatch/runners/javac.js +0 -82
  698. package/extensions/dm-lens/dist/clients/dispatch/runners/ktlint.js +0 -93
  699. package/extensions/dm-lens/dist/clients/dispatch/runners/lsp.js +0 -226
  700. package/extensions/dm-lens/dist/clients/dispatch/runners/markdownlint.js +0 -129
  701. package/extensions/dm-lens/dist/clients/dispatch/runners/mypy.js +0 -70
  702. package/extensions/dm-lens/dist/clients/dispatch/runners/oxlint.js +0 -305
  703. package/extensions/dm-lens/dist/clients/dispatch/runners/php-lint.js +0 -66
  704. package/extensions/dm-lens/dist/clients/dispatch/runners/phpstan.js +0 -90
  705. package/extensions/dm-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -66
  706. package/extensions/dm-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +0 -307
  707. package/extensions/dm-lens/dist/clients/dispatch/runners/pyright.js +0 -118
  708. package/extensions/dm-lens/dist/clients/dispatch/runners/rubocop.js +0 -79
  709. package/extensions/dm-lens/dist/clients/dispatch/runners/ruff.js +0 -69
  710. package/extensions/dm-lens/dist/clients/dispatch/runners/rust-clippy.js +0 -166
  711. package/extensions/dm-lens/dist/clients/dispatch/runners/shellcheck.js +0 -177
  712. package/extensions/dm-lens/dist/clients/dispatch/runners/shfmt.js +0 -85
  713. package/extensions/dm-lens/dist/clients/dispatch/runners/spellcheck.js +0 -74
  714. package/extensions/dm-lens/dist/clients/dispatch/runners/spotbugs.js +0 -208
  715. package/extensions/dm-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -136
  716. package/extensions/dm-lens/dist/clients/dispatch/runners/stylelint.js +0 -118
  717. package/extensions/dm-lens/dist/clients/dispatch/runners/swiftlint.js +0 -143
  718. package/extensions/dm-lens/dist/clients/dispatch/runners/taplo.js +0 -108
  719. package/extensions/dm-lens/dist/clients/dispatch/runners/terragrunt.js +0 -110
  720. package/extensions/dm-lens/dist/clients/dispatch/runners/tflint.js +0 -104
  721. package/extensions/dm-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -521
  722. package/extensions/dm-lens/dist/clients/dispatch/runners/trivy-config.js +0 -155
  723. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/availability-policy.js +0 -285
  724. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +0 -61
  725. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +0 -61
  726. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +0 -130
  727. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +0 -1143
  728. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +0 -40
  729. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/tool-failure.js +0 -120
  730. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +0 -88
  731. package/extensions/dm-lens/dist/clients/dispatch/runners/utils.js +0 -8
  732. package/extensions/dm-lens/dist/clients/dispatch/runners/vale.js +0 -106
  733. package/extensions/dm-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +0 -170
  734. package/extensions/dm-lens/dist/clients/dispatch/runners/yamllint.js +0 -83
  735. package/extensions/dm-lens/dist/clients/dispatch/runners/zig-check.js +0 -72
  736. package/extensions/dm-lens/dist/clients/dispatch/suppress-writer.js +0 -57
  737. package/extensions/dm-lens/dist/clients/dispatch/tool-profile.js +0 -30
  738. package/extensions/dm-lens/dist/clients/dispatch/types.js +0 -27
  739. package/extensions/dm-lens/dist/clients/dispatch/utils/format-utils.js +0 -58
  740. package/extensions/dm-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +0 -31
  741. package/extensions/dm-lens/dist/clients/disposition-logger.js +0 -19
  742. package/extensions/dm-lens/dist/clients/disposition-publish.js +0 -88
  743. package/extensions/dm-lens/dist/clients/durable-store.js +0 -77
  744. package/extensions/dm-lens/dist/clients/effective-config.js +0 -170
  745. package/extensions/dm-lens/dist/clients/env-utils.js +0 -26
  746. package/extensions/dm-lens/dist/clients/ephemeral-root.js +0 -67
  747. package/extensions/dm-lens/dist/clients/error-class.js +0 -3
  748. package/extensions/dm-lens/dist/clients/eval-timestamp.js +0 -2
  749. package/extensions/dm-lens/dist/clients/event-loop-hold.js +0 -119
  750. package/extensions/dm-lens/dist/clients/event-loop-monitor.js +0 -84
  751. package/extensions/dm-lens/dist/clients/extension-log.js +0 -230
  752. package/extensions/dm-lens/dist/clients/extension-mode.js +0 -20
  753. package/extensions/dm-lens/dist/clients/feature-hints.js +0 -88
  754. package/extensions/dm-lens/dist/clients/file-kinds.js +0 -313
  755. package/extensions/dm-lens/dist/clients/file-mutation-queue.js +0 -95
  756. package/extensions/dm-lens/dist/clients/file-role.js +0 -50
  757. package/extensions/dm-lens/dist/clients/file-time.js +0 -112
  758. package/extensions/dm-lens/dist/clients/file-utils.js +0 -706
  759. package/extensions/dm-lens/dist/clients/finding-delivery-gate.js +0 -132
  760. package/extensions/dm-lens/dist/clients/finding-identity.js +0 -23
  761. package/extensions/dm-lens/dist/clients/fix-run-restore.js +0 -413
  762. package/extensions/dm-lens/dist/clients/fix-worklog.js +0 -75
  763. package/extensions/dm-lens/dist/clients/format-events-publish.js +0 -310
  764. package/extensions/dm-lens/dist/clients/format-service.js +0 -159
  765. package/extensions/dm-lens/dist/clients/formatters-lazy.js +0 -8
  766. package/extensions/dm-lens/dist/clients/formatters.js +0 -1367
  767. package/extensions/dm-lens/dist/clients/freshness-cadence.js +0 -1
  768. package/extensions/dm-lens/dist/clients/freshness.js +0 -8
  769. package/extensions/dm-lens/dist/clients/generated-artifacts.js +0 -209
  770. package/extensions/dm-lens/dist/clients/generation-guard.js +0 -147
  771. package/extensions/dm-lens/dist/clients/generation-lock.js +0 -181
  772. package/extensions/dm-lens/dist/clients/git-guard.js +0 -786
  773. package/extensions/dm-lens/dist/clients/git-tracked-ignore.js +0 -120
  774. package/extensions/dm-lens/dist/clients/gitleaks-client.js +0 -290
  775. package/extensions/dm-lens/dist/clients/go-client.js +0 -47
  776. package/extensions/dm-lens/dist/clients/govulncheck-client.js +0 -411
  777. package/extensions/dm-lens/dist/clients/gradle-ktfmt-style.js +0 -177
  778. package/extensions/dm-lens/dist/clients/grammar-source.js +0 -229
  779. package/extensions/dm-lens/dist/clients/grammar-wasm-imports.js +0 -48
  780. package/extensions/dm-lens/dist/clients/gzip-stage-write.js +0 -93
  781. package/extensions/dm-lens/dist/clients/hard-failure-summary.js +0 -28
  782. package/extensions/dm-lens/dist/clients/hashline-anchor.js +0 -222
  783. package/extensions/dm-lens/dist/clients/hook-budgets.js +0 -17
  784. package/extensions/dm-lens/dist/clients/host-edit-normalize.js +0 -87
  785. package/extensions/dm-lens/dist/clients/host-ports.js +0 -35
  786. package/extensions/dm-lens/dist/clients/indent-retarget.js +0 -102
  787. package/extensions/dm-lens/dist/clients/inline-blocker-dispositions.js +0 -103
  788. package/extensions/dm-lens/dist/clients/inline-blocker-fields.js +0 -8
  789. package/extensions/dm-lens/dist/clients/install-diagnostics.js +0 -135
  790. package/extensions/dm-lens/dist/clients/installer/index.js +0 -3935
  791. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh-session.js +0 -17
  792. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh.js +0 -522
  793. package/extensions/dm-lens/dist/clients/instance-reaper-state.js +0 -3
  794. package/extensions/dm-lens/dist/clients/instance-reaper.js +0 -682
  795. package/extensions/dm-lens/dist/clients/instance-registry-lock.js +0 -166
  796. package/extensions/dm-lens/dist/clients/instance-registry-tail.js +0 -17
  797. package/extensions/dm-lens/dist/clients/instance-registry.js +0 -595
  798. package/extensions/dm-lens/dist/clients/io-bridge-contract.js +0 -7
  799. package/extensions/dm-lens/dist/clients/io-bridge.js +0 -357
  800. package/extensions/dm-lens/dist/clients/jscpd-client.js +0 -300
  801. package/extensions/dm-lens/dist/clients/json-cache-read.js +0 -25
  802. package/extensions/dm-lens/dist/clients/knip-client.js +0 -534
  803. package/extensions/dm-lens/dist/clients/knip-scan-roots.js +0 -26
  804. package/extensions/dm-lens/dist/clients/language-policy.js +0 -244
  805. package/extensions/dm-lens/dist/clients/language-profile.js +0 -263
  806. package/extensions/dm-lens/dist/clients/language-registry.js +0 -427
  807. package/extensions/dm-lens/dist/clients/latency-logger.js +0 -202
  808. package/extensions/dm-lens/dist/clients/lazy-import.js +0 -14
  809. package/extensions/dm-lens/dist/clients/ledger-bounds.js +0 -21
  810. package/extensions/dm-lens/dist/clients/lens-config.js +0 -246
  811. package/extensions/dm-lens/dist/clients/lens-engine.js +0 -181
  812. package/extensions/dm-lens/dist/clients/lens-events.js +0 -105
  813. package/extensions/dm-lens/dist/clients/lens-flag-registry.js +0 -292
  814. package/extensions/dm-lens/dist/clients/lens-map.js +0 -980
  815. package/extensions/dm-lens/dist/clients/live-bus-emitter.js +0 -53
  816. package/extensions/dm-lens/dist/clients/log-cleanup.js +0 -138
  817. package/extensions/dm-lens/dist/clients/lsp/aggregation.js +0 -89
  818. package/extensions/dm-lens/dist/clients/lsp/auxiliary-lifecycle.js +0 -23
  819. package/extensions/dm-lens/dist/clients/lsp/capabilities.js +0 -94
  820. package/extensions/dm-lens/dist/clients/lsp/cascade-tier.js +0 -208
  821. package/extensions/dm-lens/dist/clients/lsp/client.js +0 -2943
  822. package/extensions/dm-lens/dist/clients/lsp/config.js +0 -471
  823. package/extensions/dm-lens/dist/clients/lsp/content-limits.js +0 -21
  824. package/extensions/dm-lens/dist/clients/lsp/diagnostic-binding.js +0 -79
  825. package/extensions/dm-lens/dist/clients/lsp/document-drift.js +0 -324
  826. package/extensions/dm-lens/dist/clients/lsp/edits.js +0 -982
  827. package/extensions/dm-lens/dist/clients/lsp/grouping.js +0 -38
  828. package/extensions/dm-lens/dist/clients/lsp/index.js +0 -4639
  829. package/extensions/dm-lens/dist/clients/lsp/inferred-project.js +0 -121
  830. package/extensions/dm-lens/dist/clients/lsp/jvm-runtime.js +0 -194
  831. package/extensions/dm-lens/dist/clients/lsp/language.js +0 -23
  832. package/extensions/dm-lens/dist/clients/lsp/launch.js +0 -564
  833. package/extensions/dm-lens/dist/clients/lsp/lombok.js +0 -146
  834. package/extensions/dm-lens/dist/clients/lsp/path-utils.js +0 -1
  835. package/extensions/dm-lens/dist/clients/lsp/pending-aux-coverage.js +0 -120
  836. package/extensions/dm-lens/dist/clients/lsp/position-encoding.js +0 -28
  837. package/extensions/dm-lens/dist/clients/lsp/resolved-config.js +0 -183
  838. package/extensions/dm-lens/dist/clients/lsp/ruby-drive-dirs.js +0 -42
  839. package/extensions/dm-lens/dist/clients/lsp/server-covers.js +0 -8
  840. package/extensions/dm-lens/dist/clients/lsp/server-traits.js +0 -39
  841. package/extensions/dm-lens/dist/clients/lsp/server.js +0 -2640
  842. package/extensions/dm-lens/dist/clients/lsp/service-singleton.js +0 -59
  843. package/extensions/dm-lens/dist/clients/lsp/session-roots.js +0 -52
  844. package/extensions/dm-lens/dist/clients/lsp/spawn-history.js +0 -15
  845. package/extensions/dm-lens/dist/clients/lsp/sync-kind.js +0 -30
  846. package/extensions/dm-lens/dist/clients/lsp/tsserver-sync.js +0 -156
  847. package/extensions/dm-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +0 -1
  848. package/extensions/dm-lens/dist/clients/lsp/wait-policy/classification.js +0 -37
  849. package/extensions/dm-lens/dist/clients/lsp/wait-policy/index.js +0 -3
  850. package/extensions/dm-lens/dist/clients/lsp/wait-policy/strategies.js +0 -196
  851. package/extensions/dm-lens/dist/clients/lsp/watch-queue.js +0 -40
  852. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-cache.js +0 -270
  853. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-session.js +0 -7
  854. package/extensions/dm-lens/dist/clients/lsp/workspace-sweep-hold.js +0 -93
  855. package/extensions/dm-lens/dist/clients/lsp-budget.js +0 -87
  856. package/extensions/dm-lens/dist/clients/lsp-document-symbols.js +0 -93
  857. package/extensions/dm-lens/dist/clients/lsp-lazy.js +0 -8
  858. package/extensions/dm-lens/dist/clients/lsp-mutation.js +0 -309
  859. package/extensions/dm-lens/dist/clients/lsp-status.js +0 -35
  860. package/extensions/dm-lens/dist/clients/map-with-concurrency.js +0 -20
  861. package/extensions/dm-lens/dist/clients/mcp/analyze.js +0 -265
  862. package/extensions/dm-lens/dist/clients/mcp/host-shim.js +0 -14
  863. package/extensions/dm-lens/dist/clients/mcp/ipc.js +0 -321
  864. package/extensions/dm-lens/dist/clients/mcp/review.js +0 -137
  865. package/extensions/dm-lens/dist/clients/mcp/session.js +0 -305
  866. package/extensions/dm-lens/dist/clients/memory-sampler.js +0 -145
  867. package/extensions/dm-lens/dist/clients/message-end-attribution.js +0 -18
  868. package/extensions/dm-lens/dist/clients/metrics-client.js +0 -80
  869. package/extensions/dm-lens/dist/clients/metrics-history.js +0 -255
  870. package/extensions/dm-lens/dist/clients/middle-man-analysis.js +0 -161
  871. package/extensions/dm-lens/dist/clients/model-provider.js +0 -31
  872. package/extensions/dm-lens/dist/clients/module-report-lsp.js +0 -140
  873. package/extensions/dm-lens/dist/clients/module-report.js +0 -1648
  874. package/extensions/dm-lens/dist/clients/mutating-tool.js +0 -386
  875. package/extensions/dm-lens/dist/clients/mutation-attribution.js +0 -176
  876. package/extensions/dm-lens/dist/clients/mutation-bridge.js +0 -231
  877. package/extensions/dm-lens/dist/clients/ndjson-logger.js +0 -504
  878. package/extensions/dm-lens/dist/clients/observed-mutation-sources.js +0 -43
  879. package/extensions/dm-lens/dist/clients/observed-mutation.js +0 -729
  880. package/extensions/dm-lens/dist/clients/oldtext-autopatch.js +0 -100
  881. package/extensions/dm-lens/dist/clients/opaque-mutation-scan.js +0 -340
  882. package/extensions/dm-lens/dist/clients/opengrep-client.js +0 -219
  883. package/extensions/dm-lens/dist/clients/opengrep-config.js +0 -52
  884. package/extensions/dm-lens/dist/clients/package-manager.js +0 -358
  885. package/extensions/dm-lens/dist/clients/package-root.js +0 -25
  886. package/extensions/dm-lens/dist/clients/partial-edit-apply.js +0 -337
  887. package/extensions/dm-lens/dist/clients/path-attribution-telemetry.js +0 -31
  888. package/extensions/dm-lens/dist/clients/path-keyed-map.js +0 -57
  889. package/extensions/dm-lens/dist/clients/path-utils.js +0 -535
  890. package/extensions/dm-lens/dist/clients/performance-report.js +0 -291
  891. package/extensions/dm-lens/dist/clients/persist-debounce.js +0 -37
  892. package/extensions/dm-lens/dist/clients/persist-worker-stats.js +0 -8
  893. package/extensions/dm-lens/dist/clients/persistent-reverify.js +0 -166
  894. package/extensions/dm-lens/dist/clients/php-cs-fixer-config.js +0 -15
  895. package/extensions/dm-lens/dist/clients/pipeline.js +0 -1279
  896. package/extensions/dm-lens/dist/clients/post-autofix-notice.js +0 -19
  897. package/extensions/dm-lens/dist/clients/print-mode.js +0 -3
  898. package/extensions/dm-lens/dist/clients/probe-home-state.js +0 -67
  899. package/extensions/dm-lens/dist/clients/process-bridge.js +0 -48
  900. package/extensions/dm-lens/dist/clients/process-singletons.js +0 -69
  901. package/extensions/dm-lens/dist/clients/process-snapshot.js +0 -130
  902. package/extensions/dm-lens/dist/clients/project-changes.js +0 -174
  903. package/extensions/dm-lens/dist/clients/project-conventions.js +0 -152
  904. package/extensions/dm-lens/dist/clients/project-diagnostics/cache.js +0 -91
  905. package/extensions/dm-lens/dist/clients/project-diagnostics/extractors.js +0 -53
  906. package/extensions/dm-lens/dist/clients/project-diagnostics/fresh-fetch.js +0 -413
  907. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +0 -64
  908. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +0 -38
  909. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +0 -21
  910. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +0 -23
  911. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +0 -28
  912. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +0 -45
  913. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +0 -34
  914. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +0 -32
  915. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +0 -79
  916. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +0 -41
  917. package/extensions/dm-lens/dist/clients/project-diagnostics/scanner.js +0 -349
  918. package/extensions/dm-lens/dist/clients/project-diagnostics/types.js +0 -1
  919. package/extensions/dm-lens/dist/clients/project-lens-config.js +0 -464
  920. package/extensions/dm-lens/dist/clients/project-report.js +0 -527
  921. package/extensions/dm-lens/dist/clients/project-scale.js +0 -60
  922. package/extensions/dm-lens/dist/clients/project-scan-policy.js +0 -4
  923. package/extensions/dm-lens/dist/clients/project-snapshot-fingerprint.js +0 -44
  924. package/extensions/dm-lens/dist/clients/project-snapshot-persist-worker.js +0 -13
  925. package/extensions/dm-lens/dist/clients/project-snapshot.js +0 -1333
  926. package/extensions/dm-lens/dist/clients/project-trust.js +0 -104
  927. package/extensions/dm-lens/dist/clients/python-environment.js +0 -162
  928. package/extensions/dm-lens/dist/clients/python-provenance.js +0 -551
  929. package/extensions/dm-lens/dist/clients/quiet-window-config.js +0 -16
  930. package/extensions/dm-lens/dist/clients/quiet-window.js +0 -129
  931. package/extensions/dm-lens/dist/clients/read-bridge.js +0 -53
  932. package/extensions/dm-lens/dist/clients/read-expansion.js +0 -218
  933. package/extensions/dm-lens/dist/clients/read-guard-branch.js +0 -126
  934. package/extensions/dm-lens/dist/clients/read-guard-logger.js +0 -186
  935. package/extensions/dm-lens/dist/clients/read-guard-tool-lines.js +0 -1050
  936. package/extensions/dm-lens/dist/clients/read-guard.js +0 -1429
  937. package/extensions/dm-lens/dist/clients/recent-touches.js +0 -126
  938. package/extensions/dm-lens/dist/clients/redact/secrets.js +0 -386
  939. package/extensions/dm-lens/dist/clients/resource-sampler.js +0 -344
  940. package/extensions/dm-lens/dist/clients/reverse-deps.js +0 -227
  941. package/extensions/dm-lens/dist/clients/review-graph/builder.js +0 -3708
  942. package/extensions/dm-lens/dist/clients/review-graph/format.js +0 -30
  943. package/extensions/dm-lens/dist/clients/review-graph/git-identity.js +0 -168
  944. package/extensions/dm-lens/dist/clients/review-graph/import-resolvers.js +0 -323
  945. package/extensions/dm-lens/dist/clients/review-graph/persist-worker.js +0 -8
  946. package/extensions/dm-lens/dist/clients/review-graph/query.js +0 -195
  947. package/extensions/dm-lens/dist/clients/review-graph/revision-drift.js +0 -3
  948. package/extensions/dm-lens/dist/clients/review-graph/service.js +0 -60
  949. package/extensions/dm-lens/dist/clients/review-graph/shared-extraction-ir.js +0 -54
  950. package/extensions/dm-lens/dist/clients/review-graph/symbol-id.js +0 -29
  951. package/extensions/dm-lens/dist/clients/review-graph/tsconfig-paths.js +0 -253
  952. package/extensions/dm-lens/dist/clients/review-graph/types.js +0 -1
  953. package/extensions/dm-lens/dist/clients/review-graph/workspace-modules.js +0 -374
  954. package/extensions/dm-lens/dist/clients/review-graph-logger.js +0 -51
  955. package/extensions/dm-lens/dist/clients/ruff-client.js +0 -109
  956. package/extensions/dm-lens/dist/clients/rules-scanner.js +0 -113
  957. package/extensions/dm-lens/dist/clients/run-duration.js +0 -9
  958. package/extensions/dm-lens/dist/clients/runtime-agent-end.js +0 -800
  959. package/extensions/dm-lens/dist/clients/runtime-config.js +0 -39
  960. package/extensions/dm-lens/dist/clients/runtime-context.js +0 -155
  961. package/extensions/dm-lens/dist/clients/runtime-coordinator.js +0 -1117
  962. package/extensions/dm-lens/dist/clients/runtime-session.js +0 -1768
  963. package/extensions/dm-lens/dist/clients/runtime-tool-call.js +0 -935
  964. package/extensions/dm-lens/dist/clients/runtime-tool-result.js +0 -1630
  965. package/extensions/dm-lens/dist/clients/runtime-turn.js +0 -2900
  966. package/extensions/dm-lens/dist/clients/rust-client.js +0 -48
  967. package/extensions/dm-lens/dist/clients/safe-spawn.js +0 -1275
  968. package/extensions/dm-lens/dist/clients/sanitize.js +0 -174
  969. package/extensions/dm-lens/dist/clients/scan-utils.js +0 -7
  970. package/extensions/dm-lens/dist/clients/scanner-temp-root.js +0 -8
  971. package/extensions/dm-lens/dist/clients/scratch-tree-policy.js +0 -63
  972. package/extensions/dm-lens/dist/clients/search-read-registration.js +0 -60
  973. package/extensions/dm-lens/dist/clients/secret-findings.js +0 -69
  974. package/extensions/dm-lens/dist/clients/security-scan-client.js +0 -208
  975. package/extensions/dm-lens/dist/clients/session-event-guard.js +0 -111
  976. package/extensions/dm-lens/dist/clients/session-lifecycle.js +0 -269
  977. package/extensions/dm-lens/dist/clients/session-scope.js +0 -451
  978. package/extensions/dm-lens/dist/clients/session-start-observability.js +0 -47
  979. package/extensions/dm-lens/dist/clients/session-state-store.js +0 -66
  980. package/extensions/dm-lens/dist/clients/session-summary.js +0 -8
  981. package/extensions/dm-lens/dist/clients/sessionstart-logger.js +0 -22
  982. package/extensions/dm-lens/dist/clients/sg-runner.js +0 -645
  983. package/extensions/dm-lens/dist/clients/sgconfig.js +0 -306
  984. package/extensions/dm-lens/dist/clients/shared-checkout-guard.js +0 -177
  985. package/extensions/dm-lens/dist/clients/single-flight.js +0 -52
  986. package/extensions/dm-lens/dist/clients/situational-tool-telemetry.js +0 -85
  987. package/extensions/dm-lens/dist/clients/skills-resolver.js +0 -38
  988. package/extensions/dm-lens/dist/clients/slow-fs.js +0 -77
  989. package/extensions/dm-lens/dist/clients/smells-rollup.js +0 -118
  990. package/extensions/dm-lens/dist/clients/source-filter.js +0 -320
  991. package/extensions/dm-lens/dist/clients/source-walker.js +0 -96
  992. package/extensions/dm-lens/dist/clients/spawn-output-cap.js +0 -35
  993. package/extensions/dm-lens/dist/clients/spawn-timeout-cooldown.js +0 -51
  994. package/extensions/dm-lens/dist/clients/stale-marker.js +0 -1
  995. package/extensions/dm-lens/dist/clients/startup-scan.js +0 -230
  996. package/extensions/dm-lens/dist/clients/startup-timing.js +0 -67
  997. package/extensions/dm-lens/dist/clients/string-utils.js +0 -6
  998. package/extensions/dm-lens/dist/clients/subagent-mode.js +0 -40
  999. package/extensions/dm-lens/dist/clients/symbol-containment.js +0 -16
  1000. package/extensions/dm-lens/dist/clients/symbol-types.js +0 -1
  1001. package/extensions/dm-lens/dist/clients/test-runner-client.js +0 -1697
  1002. package/extensions/dm-lens/dist/clients/test-runner-delivery.js +0 -293
  1003. package/extensions/dm-lens/dist/clients/test-target-roots.js +0 -17
  1004. package/extensions/dm-lens/dist/clients/todo-scanner.js +0 -164
  1005. package/extensions/dm-lens/dist/clients/tool-agreement.js +0 -640
  1006. package/extensions/dm-lens/dist/clients/tool-config.js +0 -219
  1007. package/extensions/dm-lens/dist/clients/tool-cwd.js +0 -235
  1008. package/extensions/dm-lens/dist/clients/tool-definition.js +0 -22
  1009. package/extensions/dm-lens/dist/clients/tool-event.js +0 -24
  1010. package/extensions/dm-lens/dist/clients/tool-policy.js +0 -2393
  1011. package/extensions/dm-lens/dist/clients/tool-probe.js +0 -13
  1012. package/extensions/dm-lens/dist/clients/tool-render.js +0 -79
  1013. package/extensions/dm-lens/dist/clients/tool-set-policy.js +0 -77
  1014. package/extensions/dm-lens/dist/clients/tree-sitter-cache.js +0 -206
  1015. package/extensions/dm-lens/dist/clients/tree-sitter-client.js +0 -3057
  1016. package/extensions/dm-lens/dist/clients/tree-sitter-logger.js +0 -77
  1017. package/extensions/dm-lens/dist/clients/tree-sitter-navigator.js +0 -198
  1018. package/extensions/dm-lens/dist/clients/tree-sitter-query-loader.js +0 -389
  1019. package/extensions/dm-lens/dist/clients/tree-sitter-shared.js +0 -87
  1020. package/extensions/dm-lens/dist/clients/tree-sitter-symbol-extractor.js +0 -959
  1021. package/extensions/dm-lens/dist/clients/trivy-client.js +0 -335
  1022. package/extensions/dm-lens/dist/clients/tui-fit.js +0 -26
  1023. package/extensions/dm-lens/dist/clients/turn-context.js +0 -48
  1024. package/extensions/dm-lens/dist/clients/turn-end/delivery-holds.js +0 -59
  1025. package/extensions/dm-lens/dist/clients/turn-end/lane.js +0 -1
  1026. package/extensions/dm-lens/dist/clients/turn-end/lanes/govulncheck.js +0 -54
  1027. package/extensions/dm-lens/dist/clients/turn-end/lanes/secrets.js +0 -131
  1028. package/extensions/dm-lens/dist/clients/turn-summary-render.js +0 -56
  1029. package/extensions/dm-lens/dist/clients/turn-summary.js +0 -84
  1030. package/extensions/dm-lens/dist/clients/typos-config.js +0 -9
  1031. package/extensions/dm-lens/dist/clients/user-notify.js +0 -15
  1032. package/extensions/dm-lens/dist/clients/vanished-instance-marker.js +0 -18
  1033. package/extensions/dm-lens/dist/clients/warm-attach.js +0 -210
  1034. package/extensions/dm-lens/dist/clients/widget-state.js +0 -997
  1035. package/extensions/dm-lens/dist/clients/word-index-logger.js +0 -21
  1036. package/extensions/dm-lens/dist/clients/word-index-store.js +0 -222
  1037. package/extensions/dm-lens/dist/clients/word-index.js +0 -1494
  1038. package/extensions/dm-lens/dist/clients/workspace-topology.js +0 -268
  1039. package/extensions/dm-lens/dist/clients/write-ordering-guard.js +0 -28
  1040. package/extensions/dm-lens/dist/clients/zizmor-config.js +0 -160
  1041. package/extensions/dm-lens/dist/i18n.js +0 -67
  1042. package/extensions/dm-lens/dist/index.js +0 -1973
  1043. package/extensions/dm-lens/dist/mcp/analyze-cli.js +0 -205
  1044. package/extensions/dm-lens/dist/mcp/build-staleness.js +0 -55
  1045. package/extensions/dm-lens/dist/mcp/cli.js +0 -96
  1046. package/extensions/dm-lens/dist/mcp/server.js +0 -1239
  1047. package/extensions/dm-lens/dist/mcp/tool-arguments.js +0 -134
  1048. package/extensions/dm-lens/dist/mcp/worker.js +0 -41
  1049. package/extensions/dm-lens/dist/scripts/lib/process-scan.mjs +0 -375
  1050. package/extensions/dm-lens/dist/scripts/lib/skills-predicate.mjs +0 -53
  1051. package/extensions/dm-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +0 -51
  1052. package/extensions/dm-lens/dist/tools/activate-tools.js +0 -62
  1053. package/extensions/dm-lens/dist/tools/ast-grep-outline.js +0 -126
  1054. package/extensions/dm-lens/dist/tools/ast-grep-replace.js +0 -227
  1055. package/extensions/dm-lens/dist/tools/ast-grep-search.js +0 -687
  1056. package/extensions/dm-lens/dist/tools/effective-config.js +0 -59
  1057. package/extensions/dm-lens/dist/tools/lens-diagnostic-mark.js +0 -251
  1058. package/extensions/dm-lens/dist/tools/lens-diagnostics.js +0 -1518
  1059. package/extensions/dm-lens/dist/tools/lsp-diagnostics.js +0 -1198
  1060. package/extensions/dm-lens/dist/tools/lsp-navigation.js +0 -1249
  1061. package/extensions/dm-lens/dist/tools/lsp-structured-output.js +0 -277
  1062. package/extensions/dm-lens/dist/tools/module-report.js +0 -332
  1063. package/extensions/dm-lens/dist/tools/project-report.js +0 -72
  1064. package/extensions/dm-lens/dist/tools/render-compact.js +0 -272
  1065. package/extensions/dm-lens/dist/tools/scan-progress.js +0 -31
  1066. package/extensions/dm-lens/dist/tools/shared.js +0 -32
  1067. package/extensions/dm-lens/dist/tools/symbol-search.js +0 -133
  1068. package/extensions/dm-mcp-adapter/dist/abort.js +0 -35
  1069. package/extensions/dm-mcp-adapter/dist/agent-dir.js +0 -45
  1070. package/extensions/dm-mcp-adapter/dist/agent-plugin-loader.js +0 -392
  1071. package/extensions/dm-mcp-adapter/dist/agent-plugin-provenance.js +0 -26
  1072. package/extensions/dm-mcp-adapter/dist/bearer-command-resolver.js +0 -182
  1073. package/extensions/dm-mcp-adapter/dist/claude-plugin-loader.js +0 -350
  1074. package/extensions/dm-mcp-adapter/dist/config.js +0 -1735
  1075. package/extensions/dm-mcp-adapter/dist/consent-manager.js +0 -84
  1076. package/extensions/dm-mcp-adapter/dist/elicitation-handler.js +0 -370
  1077. package/extensions/dm-mcp-adapter/dist/errors.js +0 -225
  1078. package/extensions/dm-mcp-adapter/dist/http-ca.js +0 -75
  1079. package/extensions/dm-mcp-adapter/dist/jev-client.js +0 -359
  1080. package/extensions/dm-mcp-adapter/dist/jev-contracts.js +0 -1
  1081. package/extensions/dm-mcp-adapter/dist/jev-key-store.js +0 -189
  1082. package/extensions/dm-mcp-adapter/dist/json-schema-validator.js +0 -70
  1083. package/extensions/dm-mcp-adapter/dist/lifecycle.js +0 -387
  1084. package/extensions/dm-mcp-adapter/dist/logger.js +0 -115
  1085. package/extensions/dm-mcp-adapter/dist/mcp-auth-fetch.js +0 -86
  1086. package/extensions/dm-mcp-adapter/dist/mcp-auth-flow.js +0 -956
  1087. package/extensions/dm-mcp-adapter/dist/mcp-auth.js +0 -998
  1088. package/extensions/dm-mcp-adapter/dist/mcp-bearer-store.js +0 -182
  1089. package/extensions/dm-mcp-adapter/dist/mcp-callback-server.js +0 -380
  1090. package/extensions/dm-mcp-adapter/dist/mcp-oauth-provider.js +0 -525
  1091. package/extensions/dm-mcp-adapter/dist/mcp-probe.js +0 -151
  1092. package/extensions/dm-mcp-adapter/dist/mcp-tasks.js +0 -300
  1093. package/extensions/dm-mcp-adapter/dist/mcp-trace.js +0 -220
  1094. package/extensions/dm-mcp-adapter/dist/metadata-cache.js +0 -323
  1095. package/extensions/dm-mcp-adapter/dist/npx-resolver.js +0 -465
  1096. package/extensions/dm-mcp-adapter/dist/output-shape.js +0 -312
  1097. package/extensions/dm-mcp-adapter/dist/package-mcp-loader.js +0 -144
  1098. package/extensions/dm-mcp-adapter/dist/project-server-trust.js +0 -186
  1099. package/extensions/dm-mcp-adapter/dist/request-headers-command.js +0 -294
  1100. package/extensions/dm-mcp-adapter/dist/resource-tools.js +0 -7
  1101. package/extensions/dm-mcp-adapter/dist/runtime-owner.js +0 -94
  1102. package/extensions/dm-mcp-adapter/dist/sampling-handler.js +0 -213
  1103. package/extensions/dm-mcp-adapter/dist/secure-keyring.js +0 -191
  1104. package/extensions/dm-mcp-adapter/dist/server-manager.js +0 -1594
  1105. package/extensions/dm-mcp-adapter/dist/session-approvals.js +0 -127
  1106. package/extensions/dm-mcp-adapter/dist/session-recovery.js +0 -83
  1107. package/extensions/dm-mcp-adapter/dist/state.js +0 -1
  1108. package/extensions/dm-mcp-adapter/dist/ts-shape.js +0 -157
  1109. package/extensions/dm-mcp-adapter/dist/types.js +0 -286
  1110. package/extensions/dm-mcp-adapter/dist/ui-app-bridge-helpers.js +0 -36
  1111. package/extensions/dm-mcp-adapter/dist/ui-resource-handler.js +0 -204
  1112. package/extensions/dm-mcp-adapter/dist/ui-stream-types.js +0 -58
  1113. package/extensions/dm-mcp-adapter/dist/ui-tool-visibility.js +0 -26
  1114. package/extensions/dm-mcp-adapter/dist/unix-socket-transport.js +0 -83
  1115. package/extensions/dm-mcp-adapter/dist/utils.js +0 -418
  1116. package/extensions/dm-web-access/dist/index.js +0 -28396
  1117. package/extensions/dm-web-access/dist/mcp-cli.js +0 -28185
  1118. /package/extensions/dm-lens/skills/{pi-lens-lsp-navigation → dm-lens-lsp-navigation}/SKILL.md +0 -0
  1119. /package/extensions/dm-lens/skills/{pi-lens-write-ast-grep-rule → dm-lens-write-ast-grep-rule}/SKILL.md +0 -0
  1120. /package/extensions/dm-lens/skills/{pi-lens-write-ast-grep-rule → dm-lens-write-ast-grep-rule}/reference.md +0 -0
  1121. /package/extensions/dm-lens/skills/{pi-lens-write-tree-sitter-rule → dm-lens-write-tree-sitter-rule}/SKILL.md +0 -0
@@ -1,26 +1,37 @@
1
1
  import { CASCADE_DIAGNOSTICS_TTL_MS } from "../cascade-types.js";
2
2
  import * as nodeFs from "node:fs";
3
3
  import fs from "node:fs/promises";
4
+ import os from "node:os";
4
5
  import path from "node:path";
5
6
  import { pathToFileURL, URL } from "node:url";
6
7
  import { BoundedFifoMap } from "../bounded-cache.js";
8
+ import {
9
+ CONTENT_HASH_MAX_BYTES,
10
+ stampContentBytes
11
+ } from "../content-stamp.js";
12
+ import {
13
+ FILE_CHANGED,
14
+ FILE_CREATED,
15
+ watchedTypeForOpen
16
+ } from "./watch-queue.js";
17
+ import {
18
+ noteWorkspaceFilesChangedOnDisk,
19
+ workspaceFileCreatedAtFor
20
+ } from "./workspace-diagnostics-session.js";
21
+ import {
22
+ emitCreatedImportScanRollupAtSessionEnd,
23
+ goPackageFilesToAnnounce,
24
+ importTargetsToAnnounce
25
+ } from "./created-import-targets.js";
7
26
  import { getProjectIgnoreMatcher, isExcludedDirName } from "../file-utils.js";
8
- import { recordLsp } from "../widget-state.js";
9
27
  import { applyAuxiliarySuppressions } from "../dispatch/auxiliary-lsp.js";
10
28
  import { detectFileRole } from "../file-role.js";
11
29
  import { emitBounded } from "../bounded-telemetry.js";
12
30
  import { logLatency, phaseFinished, phaseStarted } from "../latency-logger.js";
13
- import { logSessionStart } from "../sessionstart-logger.js";
14
31
  import {
15
32
  incrementDegradationCount,
16
- recordDegradation,
17
33
  recordDegradationOnce
18
34
  } from "../degradation-ledger.js";
19
- import { assertInstallAllowed } from "../project-trust.js";
20
- import {
21
- isLspSpawnAllowedByTrust,
22
- projectTrustDenialReason
23
- } from "../project-trust.js";
24
35
  import { shouldPreferPullOnlyDiagnostics } from "../lsp-budget.js";
25
36
  import { sampleProcessTreeCpuPercent } from "../resource-sampler.js";
26
37
  import { bounded, withDeadline, withTimeout } from "../deadline-utils.js";
@@ -35,6 +46,7 @@ import {
35
46
  DocumentDriftTracker,
36
47
  fingerprintDocumentContent
37
48
  } from "./document-drift.js";
49
+ import { exceedsLspSyncLimits } from "./content-limits.js";
38
50
  import {
39
51
  captureAuxPublicationBacklog,
40
52
  markPendingAuxiliaryCoverage,
@@ -42,12 +54,11 @@ import {
42
54
  } from "./pending-aux-coverage.js";
43
55
  import {
44
56
  isAtOrAboveHomeDir,
45
- isWindowsPath,
46
57
  normalizeMapKey,
58
+ realpathOrResolve,
47
59
  uriToPath
48
60
  } from "../path-utils.js";
49
61
  import { recordLspMutation } from "../lsp-mutation.js";
50
- import { createLSPClient } from "./client.js";
51
62
  import {
52
63
  auxiliaryCoverageGap,
53
64
  auxiliaryPublicationEvidence,
@@ -55,25 +66,16 @@ import {
55
66
  composeBoundToCurrentDisk,
56
67
  createDiskBindingCache,
57
68
  hashDiagnosticContent,
69
+ primaryUnavailableCause,
58
70
  resolveTouchVerdict,
59
71
  touchCoverageGap
60
72
  } from "./diagnostic-binding.js";
73
+ import { getServersForFileWithConfig } from "./config.js";
74
+ import { serverIdsForConfigFile } from "./server-config-files.js";
61
75
  import {
62
- getServersForFileWithConfig,
63
- getServerInitOverride
64
- } from "./config.js";
65
- import {
66
- getSessionRootsForTelemetry,
67
- isOutsideAllSessionRoots
76
+ disabledPrimaries,
77
+ getSessionRootsForTelemetry
68
78
  } from "./session-roots.js";
69
- import {
70
- findLocalBinUpwards,
71
- isProjectLocalBinPath
72
- } from "../package-manager.js";
73
- import {
74
- resolveAnalysisRoot,
75
- resolveAnalysisRootPath
76
- } from "../analysis-root.js";
77
79
  import {
78
80
  configureLspServiceLifecycle,
79
81
  getOwnedLspService,
@@ -82,27 +84,31 @@ import {
82
84
  } from "./service-singleton.js";
83
85
  import { groupFilesByPrimaryServer, runPerServerGroups } from "./grouping.js";
84
86
  export { groupFilesByPrimaryServer, runPerServerGroups } from "./grouping.js";
85
- import { isEphemeralCheckoutRoot } from "../ephemeral-root.js";
87
+ import {
88
+ BROKEN_BASE_COOLDOWN_MS,
89
+ ClientRegistry
90
+ } from "./client-registry.js";
91
+ export {
92
+ getLspClientCeiling,
93
+ getLspIdleEvictMs,
94
+ getLspIdleEvictMsForRoot,
95
+ mergeInitializationOptions
96
+ } from "./client-registry.js";
86
97
  import { getLanguageId } from "./language.js";
87
98
  import {
88
99
  getReverseDepsFromIndex,
89
100
  loadReverseDependencyIndexFromSnapshot
90
101
  } from "../reverse-deps.js";
91
- import { isSameOrWithin } from "./server.js";
92
- import {
93
- refuseUntrustedLspExecution,
94
- withLspProjectCodePermission
95
- } from "./launch.js";
96
102
  import {
97
- enforceLspRootCeiling,
103
+ declinesLooseFileRoot,
98
104
  getServerById,
99
- hasProjectBoundaryMarker,
100
- isDirectLspCommandTemporarilyUnavailable,
101
105
  resetClassicTsRepairGuard,
102
- resetLspLaunchAvailabilityGeneration,
103
- resolveLspServerCwd
106
+ resetLspLaunchAvailabilityGeneration
104
107
  } from "./server.js";
105
- import { isAuxiliary, serverTraits } from "./server-traits.js";
108
+ import {
109
+ isAuxiliary,
110
+ serverTraits
111
+ } from "./server-traits.js";
106
112
  import {
107
113
  auxWaitBudgetMs,
108
114
  readEnvAuxGraceMs,
@@ -126,11 +132,10 @@ const AUX_WAIT_DEMOTION_THRESHOLD = 5;
126
132
  const AUX_WAIT_DEMOTION_RATIO = 0.9;
127
133
  const AUX_WAIT_REPROMOTION_THRESHOLD = 5;
128
134
  const AUX_WAIT_REPROMOTION_RATIO = 0.5;
129
- const ADOPTED_ROOT_CAP = 2;
130
- const ADOPTED_ROOT_IDLE_EVICT_MS = 60000;
131
135
  import { raceToCompletion } from "./aggregation.js";
132
136
  import {
133
137
  applyWorkspaceEdit,
138
+ captureRenameExpectedContent,
134
139
  mergeWorkspaceTextEditsByPriority,
135
140
  summarizeWorkspaceEdit,
136
141
  validateWorkspaceEdit
@@ -139,12 +144,10 @@ import {
139
144
  buildScopeKey,
140
145
  createWorkspaceDiagnosticsCacheContext
141
146
  } from "./workspace-diagnostics-cache.js";
147
+ import { demoteInferredProjectDiagnostics } from "./inferred-project.js";
142
148
  import { attemptTsserverSyncDiagnostics } from "./tsserver-sync.js";
143
149
  import { isWarmAttached, tryWarmAttachedDiagnostics } from "../warm-attach.js";
144
- import {
145
- getSuccessfulLspSpawnDurationMs,
146
- recordSuccessfulLspSpawn
147
- } from "./spawn-history.js";
150
+ import { getSuccessfulLspSpawnDurationMs } from "./spawn-history.js";
148
151
  function destinationUriPreservingSpelling(oldUri, oldFilePath, newFilePath) {
149
152
  const canonical = pathToFileURL(newFilePath);
150
153
  try {
@@ -179,36 +182,10 @@ function destinationUriPreservingSpelling(oldUri, oldFilePath, newFilePath) {
179
182
  return canonical.href;
180
183
  }
181
184
  }
182
- function deepMergeObjects(base, override) {
183
- const result = { ...base };
184
- for (const [key, val] of Object.entries(override)) {
185
- if (val !== null && typeof val === "object" && !Array.isArray(val) && result[key] !== null && typeof result[key] === "object" && !Array.isArray(result[key])) {
186
- result[key] = deepMergeObjects(result[key], val);
187
- } else {
188
- result[key] = val;
189
- }
190
- }
191
- return result;
192
- }
193
- export function mergeInitializationOptions(base, override) {
194
- if (!override)
195
- return base;
196
- if (!base)
197
- return override;
198
- return deepMergeObjects(base, override);
199
- }
200
- const BROKEN_BASE_COOLDOWN_MS = 15000;
201
- const BROKEN_MAX_COOLDOWN_MS = 5 * 60000;
202
- const BROKEN_PERMANENT_AFTER = 5;
203
- const RUNTIME_EXIT_UPTIME_THRESHOLD_MS = 60000;
204
- const RUNTIME_EXIT_WINDOW_MS = 15 * 60000;
205
- const RUNTIME_EXIT_WINDOW_TRIP_COUNT = BROKEN_PERMANENT_AFTER;
206
- const RUNTIME_EXIT_WINDOW_UPTIME_CEILING_MS = 10 * 60000;
207
185
  const NOTIFY_BACKPRESSURE_BROKEN_AFTER = 3;
208
- const OPTIONAL_LSP_RETRY_COOLDOWN_MS = 5 * 60000;
209
- const OPTIONAL_LSP_SERVER_IDS = new Set;
210
186
  const NAV_CLIENT_WAIT_TIMEOUT_MS = Math.max(0, Number.parseInt(process.env.DM_LENS_LSP_NAV_CLIENT_WAIT_MS ?? "1500", 10) || 1500);
211
187
  const TOUCH_DEBOUNCE_MS = Math.max(0, Number.parseInt(process.env.DM_LENS_LSP_TOUCH_DEBOUNCE_MS ?? "1500", 10) || 1500);
188
+ const RECENT_TOUCH_CAP = 800;
212
189
  const SCOPED_DEPENDENCY_TOUCH_MAX = 32;
213
190
  const RENAME_NOTIFY_TIMEOUT_MS = Math.max(50, Number.parseInt(process.env.DM_LENS_LSP_RENAME_NOTIFY_TIMEOUT_MS ?? "1500", 10) || 1500);
214
191
  async function runRenameNotify(send, timeoutMs) {
@@ -224,31 +201,6 @@ async function runRenameNotify(send, timeoutMs) {
224
201
  };
225
202
  }
226
203
  }
227
- const DEFAULT_LSP_CLIENT_CEILING = 24;
228
- const DEFAULT_IDLE_EVICT_MS = 20 * 60000;
229
- const DEFAULT_EPHEMERAL_IDLE_EVICT_MS = 60000;
230
- export function getLspIdleEvictMs() {
231
- for (const name of [
232
- "DM_LENS_LSP_IDLE_EVICT_MS",
233
- "DM_LENS_TS_IDLE_EVICT_MS"
234
- ]) {
235
- const parsed = Number.parseInt(process.env[name] ?? "", 10);
236
- if (Number.isSafeInteger(parsed) && parsed > 0)
237
- return parsed;
238
- }
239
- return DEFAULT_IDLE_EVICT_MS;
240
- }
241
- function getEphemeralLspIdleEvictMs() {
242
- const parsed = Number.parseInt(process.env.DM_LENS_EPHEMERAL_LSP_IDLE_EVICT_MS ?? "", 10);
243
- return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : DEFAULT_EPHEMERAL_IDLE_EVICT_MS;
244
- }
245
- export function getLspIdleEvictMsForRoot(root) {
246
- return isEphemeralCheckoutRoot(root) ? getEphemeralLspIdleEvictMs() : getLspIdleEvictMs();
247
- }
248
- export function getLspClientCeiling() {
249
- const parsed = Number.parseInt(process.env.DM_LENS_LSP_CLIENT_CEILING ?? "", 10);
250
- return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : DEFAULT_LSP_CLIENT_CEILING;
251
- }
252
204
  function documentIsOpenOn(client, filePath) {
253
205
  const probe = client.isDocumentOpen;
254
206
  if (typeof probe !== "function")
@@ -295,6 +247,19 @@ const MAX_TOUCH_CANDIDATES = 8;
295
247
  const DIAGNOSTICS_SEMANTIC_SETTLE_THRESHOLD_MS = Math.max(0, Number.parseInt(process.env.DM_LENS_LSP_DIAGNOSTICS_SEMANTIC_THRESHOLD_MS ?? "250", 10) || 250);
296
248
  const DIAGNOSTICS_SEMANTIC_SETTLE_WAIT_MS = Math.max(0, Number.parseInt(process.env.DM_LENS_LSP_DIAGNOSTICS_SEMANTIC_SETTLE_MS ?? "400", 10) || 400);
297
249
  const EARLY_UNBLOCK_GRACE_MS = Math.max(0, Number.parseInt(process.env.DM_LENS_LSP_EARLY_UNBLOCK_GRACE_MS ?? "400", 10) || 400);
250
+ function unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath) {
251
+ if (spawned.some((entry) => !isAuxiliary(entry.info)))
252
+ return { serverIds: [], disabledServerIds: [], cause: "unstarted" };
253
+ const { disabledServerIds, fallbackServerIds } = disabledPrimaries(filePath);
254
+ const serverIds = [
255
+ ...new Set([...resolvedPrimaryRoots.keys(), ...disabledServerIds])
256
+ ];
257
+ return {
258
+ serverIds,
259
+ disabledServerIds,
260
+ cause: primaryUnavailableCause(serverIds, disabledServerIds, fallbackServerIds)
261
+ };
262
+ }
298
263
  function mergeLspDiagnostics(diagnostics) {
299
264
  const merged = [];
300
265
  const seen = new Set;
@@ -314,6 +279,12 @@ function mergeLspDiagnostics(diagnostics) {
314
279
  function attributeDiagnostics(serverId, diagnostics) {
315
280
  return diagnostics.map((diagnostic) => ({ ...diagnostic, serverId }));
316
281
  }
282
+ const SWEEP_REASON_FOR_CAUSE = {
283
+ unstarted: "primary_unavailable",
284
+ either: "primary_unavailable",
285
+ disabled: "primary_disabled",
286
+ disabledFallback: "primary_disabled_fallback"
287
+ };
317
288
  export function createSweepIndexGate() {
318
289
  const seen = new Set;
319
290
  return {
@@ -367,7 +338,7 @@ function getMaxWorkspaceDiagnosticFiles() {
367
338
  }
368
339
  async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceDiagnosticFiles(), signal, homeDir) {
369
340
  const files = [];
370
- if (isAtOrAboveHomeDir(root, homeDir))
341
+ if (isAtOrAboveHomeDir(realpathOrResolve(root), realpathOrResolve(homeDir ?? os.homedir())))
371
342
  return files;
372
343
  const ignoreMatcher = getProjectIgnoreMatcher(root);
373
344
  await ignoreMatcher.ensureTrackedIndex();
@@ -405,28 +376,29 @@ async function collectWorkspaceDiagnosticFiles(root, maxFiles = getMaxWorkspaceD
405
376
 
406
377
  export class LSPService {
407
378
  static MAX_SIBLING_ANNOUNCEMENTS = 1024;
408
- sessionCwd;
379
+ static MAX_UNHELD_STAMPS = 4096;
409
380
  state;
381
+ unheldStamps = new BoundedFifoMap(LSPService.MAX_UNHELD_STAMPS);
410
382
  siblingAnnouncementHashes = new BoundedFifoMap(LSPService.MAX_SIBLING_ANNOUNCEMENTS);
411
- workspaceProbeLogged = new Set;
412
- projectBoundaryCache = new Map;
413
- warmStartLogged = new Set;
414
- optionalFailureLogged = new Set;
415
- unavailableLogged = new Set;
416
- optionalDisabled = new Set;
417
383
  firstContactWaits = new Map;
418
384
  auxWaitPressureStreak = new Map;
419
385
  auxWaitFastAnswerStreak = new Map;
420
386
  demotedAuxiliaryServerIds = new Set;
421
387
  demotedAuxiliaryBudgets = new Map;
422
- lastSpawnVerdict = new Map;
423
- failureCounts = new Map;
424
- runtimeExitCounts = new Map;
425
- runtimeExitWindow = new Map;
426
- permanentlyBroken = new Set;
427
388
  lastKnownDiagnostics = new Map;
428
389
  lastKnownContentHash = new Map;
429
- documentDrift = new DocumentDriftTracker;
390
+ documentDrift = new DocumentDriftTracker({
391
+ holdsDocument: (filePath) => this.hasLiveClientHoldingDocument(filePath),
392
+ onCapOverflow: ({ tracked, cap }) => {
393
+ logLatency({
394
+ type: "phase",
395
+ phase: "lsp_document_drift_cap",
396
+ filePath: "",
397
+ durationMs: 0,
398
+ metadata: { tracked, cap }
399
+ });
400
+ }
401
+ });
430
402
  diskBindingCache = createDiskBindingCache();
431
403
  lastDiagnosticsHealth = new Map;
432
404
  recentTouches = new Map;
@@ -436,24 +408,34 @@ export class LSPService {
436
408
  outstandingAuxNotifyWrites = new Map;
437
409
  static MAX_NOTIFY_STALL_DEMOTIONS = 50;
438
410
  notifyStallDemotions = new BoundedFifoMap(LSPService.MAX_NOTIFY_STALL_DEMOTIONS);
439
- clientLastUsedAt = new Map;
440
- adoptedRootLastUsedAt = new Map;
441
- adoptedClientKeys = new Set;
442
- clientLeases = new Map;
443
- idleEvictionTimers = new Map;
444
- clientSpawnGate = Promise.resolve();
445
- isDestroyed = false;
446
411
  shutdownController = new AbortController;
447
- generationHandoff;
412
+ clientRegistry;
448
413
  constructor(generationHandoff, sessionCwd) {
449
- this.generationHandoff = generationHandoff;
450
- this.sessionCwd = sessionCwd;
414
+ this.clientRegistry = new ClientRegistry({
415
+ releaseNotifyWrite: (key) => this.releaseOutstandingAuxNotifyWrite(key),
416
+ forgetReadiness: (key) => this.forgetReadiness(key),
417
+ forgetNotifyBacklog: (key) => {
418
+ this.auxNotifyInflight.delete(key);
419
+ this.auxNotifyDrainLatencyEwma.delete(key);
420
+ },
421
+ clearStallDemotion: (key) => {
422
+ this.notifyStallDemotions.delete(key);
423
+ },
424
+ rearmFirstContact: (serverId) => {
425
+ this.state.diagnosticsPublished.delete(serverId);
426
+ this.state.diagnosticsUnsupported.delete(serverId);
427
+ this.firstContactWaits.delete(serverId);
428
+ },
429
+ noteDiagnosticsPublished: (serverId) => {
430
+ this.state.diagnosticsPublished.add(serverId);
431
+ }
432
+ }, generationHandoff, sessionCwd);
451
433
  this.state = {
452
- clients: new Map,
434
+ clients: this.clientRegistry.clients,
453
435
  servers: new Map,
454
- broken: new Map,
455
- inFlight: new Map,
456
- clientSpawnedAt: new Map,
436
+ broken: this.clientRegistry.broken,
437
+ inFlight: this.clientRegistry.inFlight,
438
+ clientSpawnedAt: this.clientRegistry.clientSpawnedAt,
457
439
  demonstratedReady: new Set,
458
440
  demonstratedCold: new Set,
459
441
  diagnosticsPublished: new Set,
@@ -507,120 +489,16 @@ export class LSPService {
507
489
  reason: "auxiliary produced five consecutive late answers below half its declared wait budget"
508
490
  });
509
491
  }
510
- analysisRootModeForFile(filePath) {
511
- const roots = getSessionRootsForTelemetry(128);
512
- if (this.sessionCwd)
513
- roots.push(this.sessionCwd);
514
- let adopted = false;
515
- for (const root of new Set(roots)) {
516
- const mode = resolveAnalysisRoot(filePath, root);
517
- if (mode === "session" || mode === "linked-worktree")
518
- return mode;
519
- adopted ||= mode === "adopted";
520
- }
521
- return adopted ? "adopted" : "none";
522
- }
523
- fileIsOutsideRegisteredRoots(filePath) {
524
- const roots = getSessionRootsForTelemetry(128);
525
- if (roots.length === 0)
526
- return isOutsideAllSessionRoots(filePath);
527
- return !roots.some((root) => isSameOrWithin(root, filePath));
528
- }
529
- admitAdoptedRoot(root, filePath) {
530
- if (this.analysisRootModeForFile(filePath) !== "adopted")
531
- return false;
532
- const normalized = normalizeMapKey(root);
533
- const liveRoots = new Set;
534
- for (const key of this.state.clients.keys()) {
535
- if (this.adoptedClientKeys.has(key))
536
- liveRoots.add(key.slice(key.indexOf(":") + 1));
537
- }
538
- for (const root of this.adoptedRootLastUsedAt.keys()) {
539
- if (!liveRoots.has(root))
540
- this.adoptedRootLastUsedAt.delete(root);
541
- }
542
- if (liveRoots.has(normalized)) {
543
- this.adoptedRootLastUsedAt.set(normalized, Date.now());
544
- return true;
545
- }
546
- if (this.adoptedRootLastUsedAt.size < ADOPTED_ROOT_CAP) {
547
- this.adoptedRootLastUsedAt.set(normalized, Date.now());
548
- return true;
549
- }
550
- this.adoptedRootLastUsedAt.set(normalized, Date.now());
551
- const victim = [...this.adoptedRootLastUsedAt.keys()].sort((a, b) => (this.adoptedRootLastUsedAt.get(a) ?? 0) - (this.adoptedRootLastUsedAt.get(b) ?? 0)).find((candidate) => candidate !== normalized);
552
- if (!victim)
553
- return true;
554
- this.adoptedRootLastUsedAt.delete(victim);
555
- for (const [key, client] of this.state.clients) {
556
- if (!this.adoptedClientKeys.has(key) || !key.endsWith(`:${victim}`))
557
- continue;
558
- if ((this.clientLeases.get(key) ?? 0) > 0)
559
- continue;
560
- this.retireClient(key);
561
- client.shutdown({ reason: "adopted-root-lru" }).catch(() => {});
562
- }
563
- incrementDegradationCount({
564
- kind: "lsp-adopted-root-evicted",
565
- subject: victim,
566
- reason: `adopted root cap ${ADOPTED_ROOT_CAP} evicted ${victim}`
567
- });
568
- return true;
569
- }
570
- async resolveServerRoot(server, filePath, onRootFailure) {
571
- const candidate = await resolveLspServerCwd(server, filePath, this.sessionCwd ?? process.cwd(), onRootFailure);
572
- if (!candidate)
573
- return;
574
- const mode = this.analysisRootModeForFile(filePath);
575
- if (mode === "adopted") {
576
- const classifierRoot = resolveAnalysisRootPath(filePath, this.sessionCwd ?? process.cwd());
577
- if (!classifierRoot || normalizeMapKey(classifierRoot) !== normalizeMapKey(candidate))
578
- return;
579
- }
580
- if (this.fileIsOutsideRegisteredRoots(filePath) && this.analysisRootModeForFile(filePath) !== "adopted")
581
- return;
582
- const root = enforceLspRootCeiling(candidate, process.cwd(), filePath);
583
- if (normalizeMapKey(root) === normalizeMapKey(process.cwd()))
584
- return root;
585
- const rootKey = normalizeMapKey(root);
586
- const prefix = `${server.id}:`;
587
- let nearestAncestor;
588
- for (const key of new Set([
589
- ...this.state.clients.keys(),
590
- ...this.state.inFlight.keys()
591
- ])) {
592
- if (!key.startsWith(prefix))
593
- continue;
594
- const ancestorKey = key.slice(prefix.length);
595
- const pathApi = isWindowsPath(ancestorKey) || isWindowsPath(rootKey) ? path.win32 : path;
596
- const relative = pathApi.relative(ancestorKey, rootKey);
597
- if (relative === "" || relative.startsWith("..") || pathApi.isAbsolute(relative)) {
598
- continue;
599
- }
600
- if (!nearestAncestor || ancestorKey.length > nearestAncestor.length) {
601
- nearestAncestor = ancestorKey;
602
- }
603
- }
604
- if (!nearestAncestor)
605
- return root;
606
- let boundary = this.projectBoundaryCache.get(rootKey);
607
- if (!boundary) {
608
- boundary = hasProjectBoundaryMarker(root);
609
- this.projectBoundaryCache.set(rootKey, boundary);
610
- }
611
- if (await boundary)
612
- return root;
613
- return this.state.clients.get(`${server.id}:${nearestAncestor}`)?.root ?? nearestAncestor;
614
- }
615
492
  checkDestroyed() {
616
- return this.isDestroyed;
493
+ return this.clientRegistry.checkDestroyed();
617
494
  }
618
495
  announceToSiblings(filePath, content, contentHash = this.hashContent(content)) {
619
496
  const normalizedPath = normalizeMapKey(filePath);
620
497
  if (this.siblingAnnouncementHashes.get(normalizedPath) === contentHash) {
621
498
  return Promise.resolve();
622
499
  }
623
- return Promise.all(getServersForFileWithConfig(filePath).map((server) => this.resolveServerRoot(server, filePath).then((root) => {
500
+ this.announceCreatedFiles([filePath]);
501
+ return Promise.all(getServersForFileWithConfig(filePath).map((server) => this.clientRegistry.resolveServerRoot(server, filePath).then((root) => {
624
502
  if (!root)
625
503
  return false;
626
504
  const ownKey = `${server.id}:${normalizeMapKey(root)}`;
@@ -641,121 +519,22 @@ export class LSPService {
641
519
  }
642
520
  return notified;
643
521
  }
644
- async withClientSpawnGate(operation) {
645
- const previous = this.clientSpawnGate;
646
- let release;
647
- this.clientSpawnGate = new Promise((resolve) => {
648
- release = resolve;
649
- });
650
- await previous;
651
- try {
652
- return await operation();
653
- } finally {
654
- release();
655
- }
656
- }
657
- async clientKeyFor(entry, filePath) {
658
- const root = await this.resolveServerRoot(entry.info, filePath);
659
- return root ? `${entry.info.id}:${normalizeMapKey(root)}` : undefined;
660
- }
661
- async acquireClientLease(entry, filePath) {
662
- const key = await this.clientKeyFor(entry, filePath);
663
- if (!key)
664
- return;
665
- return this.withClientSpawnGate(async () => {
666
- if (this.isDestroyed || this.state.clients.get(key) !== entry.client) {
667
- return;
668
- }
669
- this.clientLeases.set(key, (this.clientLeases.get(key) ?? 0) + 1);
670
- return key;
671
- });
672
- }
673
- async acquireClientLeases(entries, filePath) {
674
- const keys = await Promise.all(entries.map((entry) => this.clientKeyFor(entry, filePath)));
675
- if (keys.some((key) => key === undefined))
676
- return;
677
- const keyed = entries.map((entry, index) => [keys[index], entry]);
678
- return this.withClientSpawnGate(async () => {
679
- if (this.isDestroyed || keyed.some(([key, entry]) => this.state.clients.get(key) !== entry.client)) {
680
- return;
681
- }
682
- for (const [key] of keyed) {
683
- this.clientLeases.set(key, (this.clientLeases.get(key) ?? 0) + 1);
684
- }
685
- return keyed.map(([key, entry]) => ({ key, server: entry.info }));
686
- });
687
- }
688
- releaseClientLease(key, server) {
689
- const remaining = (this.clientLeases.get(key) ?? 1) - 1;
690
- if (remaining > 0) {
691
- this.clientLeases.set(key, remaining);
692
- return;
693
- }
694
- this.clientLeases.delete(key);
695
- if (this.state.clients.has(key)) {
696
- this.clientLastUsedAt.set(key, Date.now());
697
- this.scheduleIdleEviction(key, server);
698
- }
699
- }
700
522
  async withClientForFileUse(filePath, maxWaitMs, hardCapMs, use) {
701
- while (!this.isDestroyed) {
523
+ while (!this.checkDestroyed()) {
702
524
  const entry = await this.getClientForFile(filePath, maxWaitMs, hardCapMs);
703
525
  if (!entry)
704
526
  return;
705
- const leaseKey = await this.acquireClientLease(entry, filePath);
527
+ const leaseKey = await this.clientRegistry.acquireClientLease(entry, filePath);
706
528
  if (!leaseKey)
707
529
  continue;
708
530
  try {
709
531
  return await use(entry);
710
532
  } finally {
711
- this.releaseClientLease(leaseKey, entry.info);
533
+ this.clientRegistry.releaseClientLease(leaseKey, entry.info);
712
534
  }
713
535
  }
714
536
  return;
715
537
  }
716
- async makeCapacityForClient(key) {
717
- const occupiedKeys = new Set(this.state.inFlight.keys());
718
- for (const [clientKey, client] of this.state.clients) {
719
- if (client.isAlive())
720
- occupiedKeys.add(clientKey);
721
- }
722
- const occupied = occupiedKeys.size;
723
- if (occupied < getLspClientCeiling())
724
- return true;
725
- const idle = [...this.state.clients.entries()].filter(([candidateKey, client]) => candidateKey !== key && client.isAlive() && client.isBusy?.() !== true && (this.clientLeases.get(candidateKey) ?? 0) === 0).sort(([a], [b]) => (this.clientLastUsedAt.get(a) ?? this.state.clientSpawnedAt.get(a) ?? 0) - (this.clientLastUsedAt.get(b) ?? this.state.clientSpawnedAt.get(b) ?? 0));
726
- const victim = idle[0];
727
- if (!victim) {
728
- logSessionStart(`lsp client ceiling ${getLspClientCeiling()}: spawn declined; all clients are in use`);
729
- return false;
730
- }
731
- const [victimKey, victimClient] = victim;
732
- this.releaseOutstandingAuxNotifyWrite(victimKey);
733
- await victimClient.shutdown({ reason: "client_ceiling_lru" });
734
- this.retireClient(victimKey);
735
- logSessionStart(`lsp client ceiling ${getLspClientCeiling()}: evicted idle LRU ${victimKey}`);
736
- return true;
737
- }
738
- clearIdleEvictionTimer(key) {
739
- const timer = this.idleEvictionTimers.get(key);
740
- if (timer)
741
- clearTimeout(timer);
742
- this.idleEvictionTimers.delete(key);
743
- }
744
- retireClient(key) {
745
- this.releaseOutstandingAuxNotifyWrite(key);
746
- this.state.clients.delete(key);
747
- this.state.clientSpawnedAt.delete(key);
748
- this.forgetReadiness(key);
749
- this.clientLastUsedAt.delete(key);
750
- if (this.adoptedClientKeys.delete(key)) {
751
- const root = key.slice(key.indexOf(":") + 1);
752
- if (![...this.adoptedClientKeys].some((candidate) => candidate.endsWith(`:${root}`)))
753
- this.adoptedRootLastUsedAt.delete(root);
754
- }
755
- this.clearIdleEvictionTimer(key);
756
- this.auxNotifyInflight.delete(key);
757
- this.auxNotifyDrainLatencyEwma.delete(key);
758
- }
759
538
  releaseOutstandingAuxNotifyWrite(key, token) {
760
539
  const current = this.outstandingAuxNotifyWrites.get(key);
761
540
  if (!current || token !== undefined && current !== token)
@@ -764,82 +543,78 @@ export class LSPService {
764
543
  this.outstandingAuxNotifyWrites.delete(key);
765
544
  current.resolveSettled();
766
545
  }
767
- scheduleIdleEviction(key, server) {
768
- if (server.idleEviction !== "transparent" && !this.adoptedClientKeys.has(key))
769
- return;
770
- this.clearIdleEvictionTimer(key);
771
- const lastUsedAt = this.clientLastUsedAt.get(key) ?? Date.now();
772
- const root = key.slice(key.indexOf(":") + 1);
773
- const idleMs = this.adoptedClientKeys.has(key) ? ADOPTED_ROOT_IDLE_EVICT_MS : getLspIdleEvictMsForRoot(root);
774
- const timer = setTimeout(() => {
775
- this.idleEvictionTimers.delete(key);
776
- this.withClientSpawnGate(async () => {
777
- if (this.isDestroyed)
778
- return;
779
- const client = this.state.clients.get(key);
780
- if (!client?.isAlive())
781
- return;
782
- if (client.isBusy?.() === true || (this.clientLeases.get(key) ?? 0) > 0 || (this.clientLastUsedAt.get(key) ?? 0) !== lastUsedAt) {
783
- this.scheduleIdleEviction(key, server);
784
- return;
785
- }
786
- this.retireClient(key);
787
- try {
788
- await client.shutdown({ reason: "idle_eviction" });
789
- } catch {}
790
- logSessionStart(`lsp idle eviction: released ${key}`);
791
- recordDegradation({
792
- kind: "lsp-idle-eviction",
793
- subject: key,
794
- reason: "idle LSP client released to bound memory"
795
- });
796
- }).catch(() => {});
797
- }, idleMs);
798
- timer.unref?.();
799
- this.idleEvictionTimers.set(key, timer);
800
- }
801
- shouldSkipTouch(filePath, contentFingerprint, clientScope, waitForDiagnostics, spawned) {
546
+ shouldSkipTouch(filePath, sentContentHash, waitForDiagnostics, spawned) {
802
547
  if (waitForDiagnostics)
803
548
  return false;
804
549
  if (spawned.length === 0)
805
550
  return false;
806
- return spawned.every((entry) => this.shouldSkipNotify(filePath, contentFingerprint, clientScope, entry.info.id, entry.client));
551
+ return spawned.every((entry) => this.shouldSkipNotify(filePath, sentContentHash, entry.info.id, entry.client));
807
552
  }
808
- shouldSkipNotify(filePath, contentFingerprint, clientScope, serverId, client) {
553
+ shouldSkipNotify(filePath, sentContentHash, serverId, client) {
809
554
  if (TOUCH_DEBOUNCE_MS <= 0)
810
555
  return false;
811
- const previous = this.recentTouches.get(this.recentTouchKey(filePath, clientScope, serverId));
556
+ const previous = this.recentTouches.get(this.recentTouchKey(filePath, serverId));
812
557
  if (!previous)
813
558
  return false;
814
- const now = Date.now();
815
- if (now - previous.touchedAt > TOUCH_DEBOUNCE_MS)
816
- return false;
817
559
  if (previous.client.deref() !== client)
818
560
  return false;
819
- return previous.fingerprint === contentFingerprint();
561
+ if (workspaceFileCreatedAtFor((id) => id === client.serverId, (root) => root === client.root) >= previous.touchedAt) {
562
+ return false;
563
+ }
564
+ const sentContent = client.getSentContent?.(filePath);
565
+ if (sentContent === undefined || sentContent.hash !== sentContentHash) {
566
+ return false;
567
+ }
568
+ return client.hasNotifyInFlight?.(filePath) === false;
820
569
  }
821
- recentTouchKey(filePath, clientScope, serverId) {
822
- return `${normalizeMapKey(filePath)}:${clientScope}:${serverId}`;
570
+ saveDebouncedPush(filePath, entry, saved, sentContentHash, retryOnFailure = true) {
571
+ if (!saved)
572
+ return;
573
+ const previous = this.recentTouches.get(this.recentTouchKey(filePath, entry.info.id));
574
+ if (!previous || entry.client.getSentContent?.(filePath)?.savedHash === sentContentHash)
575
+ return;
576
+ if (entry.client.getSaveOptions?.() === undefined)
577
+ return;
578
+ const save = entry.client.notify.save;
579
+ if (!save)
580
+ return;
581
+ const recover = () => {
582
+ if (retryOnFailure) {
583
+ this.saveDebouncedPush(filePath, entry, true, sentContentHash, false);
584
+ return;
585
+ }
586
+ recordDegradationOnce({
587
+ kind: "lsp-did-save-recovery-exhausted",
588
+ subject: entry.info.id,
589
+ reason: "a standalone didSave and its one retry both sent nothing",
590
+ metadata: { filePath }
591
+ });
592
+ };
593
+ save.call(entry.client.notify, filePath, true).then((sent) => {
594
+ if (sent === false)
595
+ recover();
596
+ }, recover);
597
+ return entry.info.id;
823
598
  }
824
- markTouched(filePath, contentFingerprint, clientScope, serverId, client) {
825
- const key = this.recentTouchKey(filePath, clientScope, serverId);
826
- const now = Date.now();
599
+ recentTouchKey(filePath, serverId) {
600
+ return `${normalizeMapKey(filePath)}:${serverId}`;
601
+ }
602
+ markTouched(filePath, serverId, client) {
603
+ const key = this.recentTouchKey(filePath, serverId);
604
+ this.recentTouches.delete(key);
827
605
  this.recentTouches.set(key, {
828
- fingerprint: contentFingerprint,
829
- touchedAt: now,
830
- clientScope,
606
+ touchedAt: Date.now(),
831
607
  client: new WeakRef(client)
832
608
  });
833
- if (this.recentTouches.size > 800) {
834
- for (const [k, v] of this.recentTouches) {
835
- if (now - v.touchedAt > TOUCH_DEBOUNCE_MS) {
836
- this.recentTouches.delete(k);
837
- }
838
- }
609
+ while (this.recentTouches.size > RECENT_TOUCH_CAP) {
610
+ const oldest = this.recentTouches.keys().next();
611
+ if (oldest.done)
612
+ break;
613
+ this.recentTouches.delete(oldest.value);
839
614
  }
840
615
  }
841
616
  async demonstratedReadyKeyFor(server, filePath) {
842
- const root = await this.resolveServerRoot(server, filePath);
617
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
843
618
  if (!root)
844
619
  return;
845
620
  return `${server.id}:${normalizeMapKey(root)}`;
@@ -853,9 +628,6 @@ export class LSPService {
853
628
  this.state.demonstratedReady.add(key);
854
629
  this.state.demonstratedCold.delete(key);
855
630
  }
856
- recordBreaker(key, reason) {
857
- recordDegradationOnce({ kind: "lsp-breaker", subject: key, reason });
858
- }
859
631
  recordNotifyWriteBackpressure(key, entry, filePath) {
860
632
  if (!key)
861
633
  return;
@@ -874,11 +646,11 @@ export class LSPService {
874
646
  async demoteNotifyStallCpuGuarded(key, entry, filePath, reason) {
875
647
  if (this.state.clients.get(key) !== entry.client)
876
648
  return;
877
- this.clearIdleEvictionTimer(key);
649
+ this.clientRegistry.clearIdleEvictionTimer(key);
878
650
  const verdict = await this.notifyStallCpuVerdict(entry);
879
651
  if (verdict.cpuVerdict === "busy") {
880
652
  if (this.state.clients.get(key) === entry.client) {
881
- this.scheduleIdleEviction(key, entry.info);
653
+ this.clientRegistry.scheduleIdleEviction(key, entry.info);
882
654
  }
883
655
  this.logNotifyStallCpuBusy(key, entry, filePath, 0, verdict);
884
656
  return;
@@ -933,10 +705,10 @@ export class LSPService {
933
705
  demoteForNotifyStall(key, entry, filePath, reason) {
934
706
  if (this.state.clients.get(key) !== entry.client)
935
707
  return;
936
- this.state.broken.set(key, Date.now() + BROKEN_BASE_COOLDOWN_MS);
708
+ this.clientRegistry.coolDown(key, BROKEN_BASE_COOLDOWN_MS);
937
709
  this.notifyStallDemotions.set(key, Date.now());
938
710
  entry.client.shutdown().catch(() => {});
939
- this.retireClient(key);
711
+ this.clientRegistry.retireClient(key);
940
712
  logLatency({
941
713
  type: "phase",
942
714
  phase: "lsp_notify_backpressure_broken",
@@ -1224,12 +996,13 @@ export class LSPService {
1224
996
  };
1225
997
  }
1226
998
  }
1227
- async brokenSkippedAuxiliaryServerIds(filePath, clientScope, options, spawned) {
999
+ async skippedAuxiliaryServerIds(filePath, clientScope, options, spawned) {
1228
1000
  if (clientScope === "primary")
1229
- return [];
1001
+ return { brokenSkippedServerIds: [], policySkippedServerIds: [] };
1230
1002
  const enabledAuxiliaries = clientScope === "with-auxiliary" ? new Set(options.auxiliaryServerIds ?? []) : undefined;
1231
1003
  const attached = new Set(spawned.map((entry) => entry.info.id));
1232
- const skipped = [];
1004
+ const brokenSkippedServerIds = [];
1005
+ const policySkippedServerIds = [];
1233
1006
  for (const server of getServersForFileWithConfig(filePath)) {
1234
1007
  if (!isAuxiliary(server))
1235
1008
  continue;
@@ -1239,15 +1012,20 @@ export class LSPService {
1239
1012
  continue;
1240
1013
  if (enabledAuxiliaries && !enabledAuxiliaries.has(server.id))
1241
1014
  continue;
1242
- const key = await this.demonstratedReadyKeyFor(server, filePath);
1243
- if (!key)
1015
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1016
+ if (!root)
1244
1017
  continue;
1018
+ if (declinesLooseFileRoot(server, root)) {
1019
+ policySkippedServerIds.push(server.id);
1020
+ continue;
1021
+ }
1022
+ const key = `${server.id}:${normalizeMapKey(root)}`;
1245
1023
  const brokenUntil = this.state.broken.get(key);
1246
- if (this.permanentlyBroken.has(key) || typeof brokenUntil === "number" && brokenUntil > Date.now()) {
1247
- skipped.push(server.id);
1024
+ if (this.clientRegistry.permanentlyBroken.has(key) || typeof brokenUntil === "number" && brokenUntil > Date.now()) {
1025
+ brokenSkippedServerIds.push(server.id);
1248
1026
  }
1249
1027
  }
1250
- return skipped;
1028
+ return { brokenSkippedServerIds, policySkippedServerIds };
1251
1029
  }
1252
1030
  activeClientsForCwd(cwd, priorityServerIds = []) {
1253
1031
  const normalizedCwd = normalizeMapKey(cwd);
@@ -1262,7 +1040,7 @@ export class LSPService {
1262
1040
  const sameOrNested = root === normalizedCwd || root.startsWith(`${normalizedCwd}/`) || normalizedCwd.startsWith(`${root}/`);
1263
1041
  if (!sameOrNested)
1264
1042
  continue;
1265
- entries.push({ serverId, client });
1043
+ entries.push({ clientKey: key, serverId, client });
1266
1044
  }
1267
1045
  return entries.sort((a, b) => (priority.get(a.serverId) ?? Number.MAX_SAFE_INTEGER) - (priority.get(b.serverId) ?? Number.MAX_SAFE_INTEGER));
1268
1046
  }
@@ -1276,9 +1054,18 @@ export class LSPService {
1276
1054
  }
1277
1055
  return [...paths];
1278
1056
  }
1279
- getTrackedContent(filePath, cwd) {
1057
+ getTrackedContent(filePath, cwd, sourceClientKeys) {
1280
1058
  const priorityServerIds = getServersForFileWithConfig(filePath).map((server) => server.id);
1281
- for (const { client } of this.activeClientsForCwd(cwd, priorityServerIds)) {
1059
+ const clients = this.activeClientsForCwd(cwd, priorityServerIds);
1060
+ if (sourceClientKeys !== undefined) {
1061
+ const sourceSet = new Set(sourceClientKeys);
1062
+ const sends = clients.filter(({ clientKey }) => sourceSet.has(clientKey)).flatMap(({ clientKey, client }) => {
1063
+ const sent = client.getSentContent?.(filePath);
1064
+ return sent === undefined ? [] : [{ ...sent, clientKey }];
1065
+ });
1066
+ return sends;
1067
+ }
1068
+ for (const { client } of clients) {
1282
1069
  const sent = client.getSentContent?.(filePath);
1283
1070
  if (sent !== undefined)
1284
1071
  return sent;
@@ -1296,7 +1083,7 @@ export class LSPService {
1296
1083
  try {
1297
1084
  return {
1298
1085
  server,
1299
- root: await this.resolveServerRootOnce(server, filePath, rootMemo, (reason) => {
1086
+ root: await this.clientRegistry.resolveServerRootOnce(server, filePath, rootMemo, (reason) => {
1300
1087
  rootFailureReason = reason;
1301
1088
  }),
1302
1089
  reason: rootFailureReason
@@ -1343,7 +1130,7 @@ export class LSPService {
1343
1130
  const acquisition = {
1344
1131
  outcome: "declined"
1345
1132
  };
1346
- const spawned = await this.ensureClientForServer(filePath, server, resolvedRoots, noteSpawnInFlight, (reported) => {
1133
+ const spawned = await this.clientRegistry.ensureClientForServer(filePath, server, resolvedRoots, noteSpawnInFlight, (reported) => {
1347
1134
  acquisition.outcome = reported;
1348
1135
  }, rootMemo);
1349
1136
  if (spawned) {
@@ -1381,14 +1168,14 @@ export class LSPService {
1381
1168
  });
1382
1169
  }
1383
1170
  const unavailable = (await Promise.all(servers.map(async (server) => {
1384
- const root = await this.resolveServerRootOnce(server, filePath, rootMemo);
1171
+ const root = await this.clientRegistry.resolveServerRootOnce(server, filePath, rootMemo);
1385
1172
  return {
1386
1173
  server,
1387
1174
  key: `${server.id}:${root ? normalizeMapKey(root) : "<unresolved>"}`
1388
1175
  };
1389
- }))).filter(({ key }) => !this.unavailableLogged.has(key));
1176
+ }))).filter(({ key }) => !this.clientRegistry.unavailableLogged.has(key));
1390
1177
  for (const { key } of unavailable)
1391
- this.unavailableLogged.add(key);
1178
+ this.clientRegistry.unavailableLogged.add(key);
1392
1179
  if (unavailable.length === 0)
1393
1180
  return;
1394
1181
  logLatency({
@@ -1491,7 +1278,7 @@ export class LSPService {
1491
1278
  return { clients: [], serverCountAttempted: 0 };
1492
1279
  const rootedServers = (await Promise.all(servers.map(async (server) => ({
1493
1280
  server,
1494
- root: await this.resolveServerRoot(server, filePath)
1281
+ root: await this.clientRegistry.resolveServerRoot(server, filePath)
1495
1282
  })))).filter((entry) => entry.root !== undefined);
1496
1283
  for (const { server, root } of rootedServers)
1497
1284
  if (isAuxiliary(server))
@@ -1500,7 +1287,7 @@ export class LSPService {
1500
1287
  const acquisitions = new Map;
1501
1288
  const acquire = (server) => {
1502
1289
  serverCountAttempted += 1;
1503
- return this.ensureClientForServer(filePath, server, resolvedRoots);
1290
+ return this.clientRegistry.ensureClientForServer(filePath, server, resolvedRoots);
1504
1291
  };
1505
1292
  for (const { server } of rootedServers) {
1506
1293
  const preferred = server.fallbackFor ? acquisitions.get(server.fallbackFor) : undefined;
@@ -1521,7 +1308,7 @@ export class LSPService {
1521
1308
  const effectiveSignal = signal ?? getAmbientAbortSignal();
1522
1309
  const effectiveHook = hook ?? "tool_result_edit";
1523
1310
  const spawned = await Promise.all(servers.map(async (server) => {
1524
- const acquisition = this.ensureClientForServer(filePath, server, undefined, undefined, (reported) => onOutcome?.(server.id, reported), rootMemo);
1311
+ const acquisition = this.clientRegistry.ensureClientForServer(filePath, server, undefined, undefined, (reported) => onOutcome?.(server.id, reported), rootMemo);
1525
1312
  if (!maxWaitMs || maxWaitMs <= 0) {
1526
1313
  return acquisition;
1527
1314
  }
@@ -1540,7 +1327,7 @@ export class LSPService {
1540
1327
  const servers = getServersForFileWithConfig(filePath);
1541
1328
  const missed = [];
1542
1329
  for (const server of servers) {
1543
- const root = await this.resolveServerRoot(server, filePath);
1330
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1544
1331
  if (!root)
1545
1332
  continue;
1546
1333
  const key = `${server.id}:${normalizeMapKey(root)}`;
@@ -1572,7 +1359,7 @@ export class LSPService {
1572
1359
  for (const server of getServersForFileWithConfig(filePath)) {
1573
1360
  if (server.id !== serverId)
1574
1361
  continue;
1575
- const root = await this.resolveServerRoot(server, filePath);
1362
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1576
1363
  if (!root)
1577
1364
  continue;
1578
1365
  const key = `${server.id}:${normalizeMapKey(root)}`;
@@ -1590,7 +1377,7 @@ export class LSPService {
1590
1377
  for (const server of getServersForFileWithConfig(filePath)) {
1591
1378
  if (!serverIds.has(server.id) || out.has(server.id))
1592
1379
  continue;
1593
- const root = await this.resolveServerRoot(server, filePath);
1380
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1594
1381
  if (!root)
1595
1382
  continue;
1596
1383
  const key = `${server.id}:${normalizeMapKey(root)}`;
@@ -1619,7 +1406,7 @@ export class LSPService {
1619
1406
  for (const server of getServersForFileWithConfig(filePath)) {
1620
1407
  if (server.id !== serverId)
1621
1408
  continue;
1622
- const root = await this.resolveServerRoot(server, filePath);
1409
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1623
1410
  if (root === undefined)
1624
1411
  return;
1625
1412
  this.noteAuxiliaryLateAnswer(`${serverId}:${normalizeMapKey(root)}`, elapsedMs);
@@ -1630,12 +1417,213 @@ export class LSPService {
1630
1417
  if (this.checkDestroyed())
1631
1418
  return;
1632
1419
  for (const server of getServersForFileWithConfig(filePath)) {
1633
- const root = await this.resolveServerRoot(server, filePath);
1420
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1634
1421
  if (!root)
1635
1422
  continue;
1636
1423
  this.notifyLiveClientsForServer(server.id, filePath, type, `${server.id}:${normalizeMapKey(root)}`, true);
1637
1424
  }
1638
1425
  }
1426
+ notifyOutOfBandFileChanges(changes) {
1427
+ if (this.checkDestroyed() || changes.length === 0)
1428
+ return;
1429
+ for (const { filePath, type } of changes) {
1430
+ const serverIds = new Set([
1431
+ ...serverIdsForConfigFile(filePath) ?? [],
1432
+ ...getServersForFileWithConfig(filePath).map((server) => server.id)
1433
+ ]);
1434
+ for (const serverId of serverIds)
1435
+ this.notifyLiveClientsForServer(serverId, filePath, type, "", true);
1436
+ this.noteUnheldSent(filePath);
1437
+ }
1438
+ for (const client of this.state.clients.values())
1439
+ if (client.isAlive())
1440
+ client.notify.flushWatched?.();
1441
+ }
1442
+ noteUnheldSent(filePath) {
1443
+ const key = normalizeMapKey(filePath);
1444
+ let stat;
1445
+ try {
1446
+ stat = nodeFs.statSync(filePath, { throwIfNoEntry: false });
1447
+ } catch {
1448
+ stat = undefined;
1449
+ }
1450
+ if (stat === undefined) {
1451
+ this.unheldStamps.delete(key);
1452
+ return;
1453
+ }
1454
+ const seen = this.unheldStamps.get(key);
1455
+ if (seen?.size === stat.size && seen.mtimeMs === stat.mtimeMs)
1456
+ return;
1457
+ this.unheldStamps.set(key, { size: stat.size, mtimeMs: stat.mtimeMs });
1458
+ }
1459
+ async restartPrimaryClientsUnder(root) {
1460
+ if (this.checkDestroyed())
1461
+ return 0;
1462
+ return (await this.clientRegistry.restartPrimaryClientsUnder(root)).length;
1463
+ }
1464
+ livePrimaryClientRoots() {
1465
+ if (this.checkDestroyed())
1466
+ return [];
1467
+ return this.clientRegistry.livePrimaryClientRoots();
1468
+ }
1469
+ announceCreatedFiles(filePaths, importTargets = []) {
1470
+ if (this.checkDestroyed() || this.state.clients.size === 0)
1471
+ return;
1472
+ this.sendUnheldChanges(importTargets);
1473
+ const byServer = new Map;
1474
+ for (const filePath of [...filePaths, ...importTargets]) {
1475
+ let stat;
1476
+ try {
1477
+ stat = nodeFs.statSync(filePath);
1478
+ } catch {
1479
+ continue;
1480
+ }
1481
+ for (const server of getServersForFileWithConfig(filePath)) {
1482
+ const entries = byServer.get(server.id) ?? [];
1483
+ entries.push({ filePath, stat });
1484
+ byServer.set(server.id, entries);
1485
+ }
1486
+ }
1487
+ for (const [key, client] of this.state.clients) {
1488
+ if (!client.isAlive())
1489
+ continue;
1490
+ const entries = [...byServer].flatMap(([serverId, list]) => key.startsWith(`${serverId}:`) ? list : []);
1491
+ client.notify.announceCreated(entries);
1492
+ }
1493
+ }
1494
+ sendUnheldChanges(filePaths) {
1495
+ const changed = [];
1496
+ const at = Date.now();
1497
+ for (const filePath of filePaths) {
1498
+ let stat;
1499
+ try {
1500
+ stat = nodeFs.statSync(filePath);
1501
+ } catch {
1502
+ continue;
1503
+ }
1504
+ const servers = getServersForFileWithConfig(filePath);
1505
+ if (!this.unheldBytesMoved(filePath, stat, servers))
1506
+ continue;
1507
+ changed.push({ filePath, type: FILE_CHANGED });
1508
+ for (const client of this.liveClientsOf(servers, filePath))
1509
+ noteWorkspaceFilesChangedOnDisk(client.root, [normalizeMapKey(filePath)], at);
1510
+ }
1511
+ if (changed.length === 0)
1512
+ return;
1513
+ this.notifyOutOfBandFileChanges(changed);
1514
+ logLatency({
1515
+ type: "phase",
1516
+ phase: "lsp_unheld_dependency_changed",
1517
+ filePath: changed[0]?.filePath ?? "",
1518
+ durationMs: Date.now() - at,
1519
+ result: `changed:${changed.length}`,
1520
+ metadata: {
1521
+ changed: changed.length,
1522
+ paths: changed.slice(0, 5).map((change) => change.filePath)
1523
+ }
1524
+ });
1525
+ }
1526
+ unheldBytesMoved(filePath, stat, servers) {
1527
+ const live = this.liveClientsOf(servers, filePath);
1528
+ if (live.every((client) => client.holds))
1529
+ return false;
1530
+ const key = normalizeMapKey(filePath);
1531
+ const seen = this.unheldStamps.get(key);
1532
+ if (seen?.size === stat.size && seen.mtimeMs === stat.mtimeMs)
1533
+ return false;
1534
+ let stamp = { size: stat.size, mtimeMs: stat.mtimeMs };
1535
+ if (stat.size <= CONTENT_HASH_MAX_BYTES) {
1536
+ try {
1537
+ stamp = stampContentBytes(nodeFs.readFileSync(filePath), stat.mtimeMs);
1538
+ } catch (cause) {
1539
+ recordDegradationOnce({
1540
+ kind: "lsp-unheld-dependency-unreadable",
1541
+ subject: key,
1542
+ reason: `could not read a closed module to compare its bytes; a change of its stat is sent as a change: ${cause instanceof Error ? cause.message : String(cause)}`
1543
+ });
1544
+ }
1545
+ }
1546
+ this.unheldStamps.set(key, stamp);
1547
+ if (seen === undefined)
1548
+ return live.some((client) => watchedTypeForOpen(stat.mtimeMs, client.launchedAt) === FILE_CREATED);
1549
+ return seen.sha256 === undefined || seen.sha256 !== stamp.sha256;
1550
+ }
1551
+ liveClientsOf(servers, filePath) {
1552
+ const live = [];
1553
+ for (const [key, client] of this.state.clients) {
1554
+ if (!client.isAlive())
1555
+ continue;
1556
+ if (!servers.some((server) => key.startsWith(`${server.id}:`)))
1557
+ continue;
1558
+ live.push({
1559
+ root: client.root,
1560
+ launchedAt: this.clientRegistry.clientLaunchStartedAt.get(key) ?? 0,
1561
+ holds: documentIsOpenOn(client, filePath)
1562
+ });
1563
+ }
1564
+ return live;
1565
+ }
1566
+ async resyncHeldPrimaries(filePaths, drainMs) {
1567
+ let sent = 0;
1568
+ const sentTo = new Map;
1569
+ for (const filePath of filePaths) {
1570
+ if (this.checkDestroyed())
1571
+ break;
1572
+ const servers = getServersForFileWithConfig(filePath);
1573
+ const exclude = await this.serverIdsNotHoldingDocument(filePath);
1574
+ for (const server of servers)
1575
+ if (isAuxiliary(server))
1576
+ exclude.add(server.id);
1577
+ if (servers.every((server) => exclude.has(server.id)))
1578
+ continue;
1579
+ const readStamp = performance.now();
1580
+ let content;
1581
+ try {
1582
+ content = await fs.readFile(filePath, "utf8");
1583
+ } catch {
1584
+ continue;
1585
+ }
1586
+ await this.touchFile(filePath, content, {
1587
+ diagnostics: "none",
1588
+ source: "head_move_primary",
1589
+ clientScope: "all",
1590
+ excludeServerIds: exclude,
1591
+ readStamp
1592
+ });
1593
+ sent += 1;
1594
+ for (const server of servers) {
1595
+ if (exclude.has(server.id))
1596
+ continue;
1597
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1598
+ const key = root ? `${server.id}:${normalizeMapKey(root)}` : undefined;
1599
+ const client = key ? this.state.clients.get(key) : undefined;
1600
+ if (key && client) {
1601
+ const traits = serverTraits(server);
1602
+ const documents = sentTo.get(key)?.documents ?? [];
1603
+ documents.push({ filePath, content, readStamp });
1604
+ sentTo.set(key, {
1605
+ client,
1606
+ ordered: traits.replyOrdering === "single-task-ordered",
1607
+ rechecks: traits.resendRecheck === "rechecks",
1608
+ documents
1609
+ });
1610
+ }
1611
+ }
1612
+ }
1613
+ if (sentTo.size === 0)
1614
+ return { sent, drained: true };
1615
+ await Promise.all([...sentTo.values()].flatMap(({ client, rechecks, documents }) => (rechecks ? documents : []).slice(0, -1).map(({ filePath, content, readStamp }) => client.notify.open(filePath, content, getLanguageId(filePath) ?? "plaintext", undefined, undefined, undefined, readStamp))));
1616
+ const answers = await Promise.all([...sentTo.values()].map(async ({ client, ordered }) => {
1617
+ if (!ordered)
1618
+ return false;
1619
+ try {
1620
+ return await client.pingLiveness?.(drainMs) ?? true;
1621
+ } catch {
1622
+ return false;
1623
+ }
1624
+ }));
1625
+ return { sent, drained: answers.every(Boolean) };
1626
+ }
1639
1627
  async resyncGitChangedFiles(changedPaths, options = {}) {
1640
1628
  const dispositions = new Map;
1641
1629
  if (this.checkDestroyed() || changedPaths.length === 0) {
@@ -1646,7 +1634,7 @@ export class LSPService {
1646
1634
  for (const changedPath of changedPaths) {
1647
1635
  const resolved = path.resolve(changedPath);
1648
1636
  for (const server of getServersForFileWithConfig(resolved)) {
1649
- const root = await this.resolveServerRoot(server, resolved);
1637
+ const root = await this.clientRegistry.resolveServerRoot(server, resolved);
1650
1638
  if (!root)
1651
1639
  continue;
1652
1640
  const index = loadReverseDependencyIndexFromSnapshot({ cwd: root });
@@ -1661,7 +1649,21 @@ export class LSPService {
1661
1649
  const written = new Set(changed.values());
1662
1650
  this.documentDrift.enqueueResync(openTargets.filter((filePath) => !written.has(filePath)));
1663
1651
  this.documentDrift.enqueueResync(openTargets.filter((filePath) => written.has(filePath)), { saved: options.saved === true });
1664
- const pass = await this.sweepDocumentDrift({ force: true });
1652
+ let pass;
1653
+ let passes = 0;
1654
+ const reached = new Map;
1655
+ const waiting = (filePath) => {
1656
+ const disposition = reached.get(normalizeMapKey(filePath));
1657
+ return disposition === undefined || disposition === "deferred";
1658
+ };
1659
+ for (let n = 0;n < Math.max(1, options.maxPasses ?? 1); n++) {
1660
+ pass = await this.sweepDocumentDrift({ force: true });
1661
+ passes += 1;
1662
+ for (const [key, disposition] of pass?.queued ?? [])
1663
+ reached.set(key, disposition);
1664
+ if (!pass || !openTargets.some(waiting))
1665
+ break;
1666
+ }
1665
1667
  logLatency({
1666
1668
  type: "phase",
1667
1669
  phase: "lsp_external_change_resync",
@@ -1670,11 +1672,12 @@ export class LSPService {
1670
1672
  metadata: {
1671
1673
  changedCount: changedPaths.length,
1672
1674
  enqueued: openTargets.length,
1673
- deferred: pass?.deferred ?? this.documentDrift.pendingResyncCount
1675
+ deferred: pass?.deferred ?? this.documentDrift.pendingResyncCount,
1676
+ passes
1674
1677
  }
1675
1678
  });
1676
1679
  for (const [changedPath, resolved] of changed) {
1677
- dispositions.set(changedPath, openTargets.includes(resolved) ? pass?.queued.get(normalizeMapKey(resolved)) ?? "deferred" : "unheld");
1680
+ dispositions.set(changedPath, openTargets.includes(resolved) ? reached.get(normalizeMapKey(resolved)) ?? "deferred" : "unheld");
1678
1681
  }
1679
1682
  return dispositions;
1680
1683
  }
@@ -1683,6 +1686,8 @@ export class LSPService {
1683
1686
  return;
1684
1687
  return this.documentDrift.sweep({
1685
1688
  resync: async (filePath, content, _driftAgeMs, readStamp, saved) => {
1689
+ if (exceedsLspSyncLimits(content).tooLarge)
1690
+ return false;
1686
1691
  await this.touchFile(filePath, content, {
1687
1692
  diagnostics: "none",
1688
1693
  source: "drift_resync",
@@ -1693,7 +1698,6 @@ export class LSPService {
1693
1698
  });
1694
1699
  return this.documentDrift.peek(filePath)?.fingerprint === fingerprintDocumentContent(content);
1695
1700
  },
1696
- holdsDocument: (filePath) => this.hasLiveClientHoldingDocument(filePath),
1697
1701
  onDrift: (event) => {
1698
1702
  if (event.disposition === "unchanged" || event.disposition === "vanished" || event.disposition === "unheld") {
1699
1703
  return;
@@ -1733,7 +1737,7 @@ export class LSPService {
1733
1737
  async serverIdsNotHoldingDocument(filePath) {
1734
1738
  const exclude = new Set;
1735
1739
  for (const server of getServersForFileWithConfig(filePath)) {
1736
- const root = await this.resolveServerRoot(server, filePath);
1740
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
1737
1741
  const existing = root ? this.state.clients.get(`${server.id}:${normalizeMapKey(root)}`) : undefined;
1738
1742
  if (existing?.isAlive() && documentIsOpenOn(existing, filePath))
1739
1743
  continue;
@@ -1755,366 +1759,6 @@ export class LSPService {
1755
1759
  }
1756
1760
  this.documentDrift.recordSynced(filePath, content, at, contentFingerprint?.() ?? fingerprintDocumentContent(content));
1757
1761
  }
1758
- noteSpawnVerdict(key, verdict) {
1759
- this.lastSpawnVerdict.set(key, verdict);
1760
- }
1761
- resolveServerRootOnce(server, filePath, memo, onRootFailure) {
1762
- if (!memo)
1763
- return this.resolveServerRoot(server, filePath, onRootFailure);
1764
- const pending = memo.get(server.id);
1765
- if (pending !== undefined)
1766
- return pending;
1767
- const started = this.resolveServerRoot(server, filePath, onRootFailure);
1768
- memo.set(server.id, started);
1769
- return started;
1770
- }
1771
- async ensureClientForServer(filePath, server, resolvedRoots, onSpawnInFlight, onOutcome, rootMemo) {
1772
- const handoff = this.generationHandoff;
1773
- if (handoff) {
1774
- await handoff;
1775
- if (this.generationHandoff === handoff) {
1776
- this.generationHandoff = undefined;
1777
- }
1778
- if (this.checkDestroyed())
1779
- return;
1780
- }
1781
- const root = await this.resolveServerRootOnce(server, filePath, rootMemo);
1782
- if (!root || this.checkDestroyed())
1783
- return;
1784
- if (!isAuxiliary(server)) {
1785
- resolvedRoots?.set(server.id, normalizeMapKey(root));
1786
- }
1787
- const allowInstall = this.shouldAllowInstall(server.id);
1788
- const normalizedRoot = normalizeMapKey(root);
1789
- const key = `${server.id}:${normalizedRoot}`;
1790
- const adopted = this.analysisRootModeForFile(filePath) === "adopted";
1791
- if (adopted) {
1792
- const localCommand = server.command ?? server.projectLocalCommand ?? server.availabilityKey;
1793
- const localBinary = localCommand ? path.isAbsolute(localCommand) ? isProjectLocalBinPath(localCommand, root) ? localCommand : undefined : findLocalBinUpwards(localCommand, root) : undefined;
1794
- if (localBinary) {
1795
- recordDegradationOnce({
1796
- kind: "lsp-registry-decision",
1797
- subject: `${server.id}:${normalizeMapKey(root)}`,
1798
- reason: "project-local LSP binary refused for adopted root"
1799
- });
1800
- return;
1801
- }
1802
- this.adoptedClientKeys.add(key);
1803
- if (!this.admitAdoptedRoot(root, filePath))
1804
- return;
1805
- }
1806
- const isOptionalServer = OPTIONAL_LSP_SERVER_IDS.has(server.id);
1807
- if (server.availabilityKey && isDirectLspCommandTemporarilyUnavailable(server.availabilityKey)) {
1808
- emitBounded("lsp_client_skipped_unavailable_command", `${server.availabilityKey}:${normalizeMapKey(filePath)}`, {
1809
- filePath,
1810
- durationMs: 0,
1811
- metadata: {
1812
- serverId: server.id,
1813
- command: server.availabilityKey
1814
- }
1815
- }, {
1816
- ledgerKind: "lsp-client-skipped-unavailable-command",
1817
- risingEdgePer: "identity",
1818
- reason: `command ${server.availabilityKey} temporarily unavailable`
1819
- });
1820
- return;
1821
- }
1822
- if (isOptionalServer && this.optionalDisabled.has(key)) {
1823
- return;
1824
- }
1825
- if (this.permanentlyBroken.has(key)) {
1826
- emitBounded("lsp_client_skipped_broken", `${server.id}:${normalizeMapKey(filePath)}`, {
1827
- filePath,
1828
- durationMs: 0,
1829
- metadata: {
1830
- serverId: server.id,
1831
- permanent: true
1832
- }
1833
- }, {
1834
- ledgerKind: "lsp-client-skipped-broken",
1835
- risingEdgePer: "identity",
1836
- reason: `${server.id} latched permanently broken`
1837
- });
1838
- return;
1839
- }
1840
- const existing = this.state.clients.get(key);
1841
- if (existing) {
1842
- if (existing.isAlive()) {
1843
- this.unavailableLogged.delete(key);
1844
- this.clientLastUsedAt.set(key, Date.now());
1845
- this.scheduleIdleEviction(key, server);
1846
- if (!this.warmStartLogged.has(key)) {
1847
- logSessionStart(`lsp warm-start ${server.id}: reused root=${root} file=${filePath}`);
1848
- this.warmStartLogged.add(key);
1849
- }
1850
- onOutcome?.("warm-reuse");
1851
- return { client: existing, info: server };
1852
- }
1853
- const spawnedAt = this.state.clientSpawnedAt.get(key);
1854
- const wasIntentional = existing.wasShutdownIntentional();
1855
- const exitedAt = existing.getExitedAt();
1856
- const uptimeMs = exitedAt != null && spawnedAt != null ? exitedAt - spawnedAt : spawnedAt != null ? Date.now() - spawnedAt : null;
1857
- logLatency({
1858
- type: "phase",
1859
- phase: "lsp_server_respawn",
1860
- filePath,
1861
- durationMs: 0,
1862
- metadata: {
1863
- serverId: server.id,
1864
- root,
1865
- uptimeMs,
1866
- intentional: wasIntentional
1867
- }
1868
- });
1869
- this.releaseOutstandingAuxNotifyWrite(key);
1870
- try {
1871
- await existing.shutdown();
1872
- } catch {}
1873
- this.retireClient(key);
1874
- this.state.broken.delete(key);
1875
- if (wasIntentional) {} else {
1876
- if (this.recordRuntimeExitWindow(key, exitedAt, uptimeMs)) {
1877
- const rate = `${RUNTIME_EXIT_WINDOW_TRIP_COUNT} deaths within ${Math.round(RUNTIME_EXIT_WINDOW_MS / 60000)}m`;
1878
- this.state.broken.set(key, Math.max(this.state.broken.get(key) ?? 0, Date.now() + (isOptionalServer ? OPTIONAL_LSP_RETRY_COOLDOWN_MS : BROKEN_MAX_COOLDOWN_MS)));
1879
- if (isOptionalServer) {
1880
- this.optionalDisabled.add(key);
1881
- this.runtimeExitWindow.delete(key);
1882
- logSessionStart(`lsp respawn ${server.id}: optional server cooled down (windowed-rate trip: ${rate})`);
1883
- } else {
1884
- this.permanentlyBroken.add(key);
1885
- this.recordBreaker(key, `windowed runtime-exit trip: ${rate}`);
1886
- logSessionStart(`lsp respawn ${server.id}: permanently disabled (windowed-rate trip: ${rate}, uptimeMs=${uptimeMs})`);
1887
- }
1888
- }
1889
- if (uptimeMs != null && uptimeMs < RUNTIME_EXIT_UPTIME_THRESHOLD_MS) {
1890
- const rCount = (this.runtimeExitCounts.get(key) ?? 0) + 1;
1891
- this.runtimeExitCounts.set(key, rCount);
1892
- const rCooldown = Math.min(BROKEN_BASE_COOLDOWN_MS * 2 ** (rCount - 1), BROKEN_MAX_COOLDOWN_MS);
1893
- this.state.broken.set(key, Date.now() + rCooldown);
1894
- if (!isOptionalServer && rCount >= BROKEN_PERMANENT_AFTER) {
1895
- this.permanentlyBroken.add(key);
1896
- this.recordBreaker(key, `permanently disabled after ${rCount} early post-init exits`);
1897
- logSessionStart(`lsp respawn ${server.id}: permanently disabled after ${rCount} early post-init exits (uptimeMs=${uptimeMs})`);
1898
- } else {
1899
- logSessionStart(`lsp respawn ${server.id}: early post-init exit ${rCount}/${BROKEN_PERMANENT_AFTER} (uptimeMs=${uptimeMs}), cooldown=${rCooldown}ms`);
1900
- }
1901
- } else {
1902
- this.runtimeExitCounts.delete(key);
1903
- const windowDeaths = this.runtimeExitWindow.get(key);
1904
- if (windowDeaths) {
1905
- const windowNow = exitedAt ?? Date.now();
1906
- if (!windowDeaths.some((t) => t >= windowNow - RUNTIME_EXIT_WINDOW_MS)) {
1907
- this.runtimeExitWindow.delete(key);
1908
- }
1909
- }
1910
- }
1911
- }
1912
- }
1913
- const brokenUntil = this.state.broken.get(key);
1914
- if (typeof brokenUntil === "number" && brokenUntil > Date.now()) {
1915
- emitBounded("lsp_client_skipped_broken", `${server.id}:${normalizeMapKey(filePath)}`, {
1916
- filePath,
1917
- durationMs: 0,
1918
- metadata: {
1919
- serverId: server.id,
1920
- retryInMs: Math.max(0, brokenUntil - Date.now())
1921
- }
1922
- }, {
1923
- ledgerKind: "lsp-client-skipped-broken",
1924
- risingEdgePer: "identity",
1925
- reason: `${server.id} in breaker cooldown`
1926
- });
1927
- return;
1928
- }
1929
- if (typeof brokenUntil === "number" && brokenUntil <= Date.now()) {
1930
- this.state.broken.delete(key);
1931
- if (isOptionalServer)
1932
- this.optionalDisabled.delete(key);
1933
- }
1934
- let startedSpawn = false;
1935
- let spawnPromise = this.state.inFlight.get(key);
1936
- if (!spawnPromise) {
1937
- const started = await this.withClientSpawnGate(async () => {
1938
- const raced = this.state.inFlight.get(key);
1939
- if (raced)
1940
- return { promise: raced, startedSpawn: false };
1941
- if (this.checkDestroyed())
1942
- return;
1943
- if (!await this.makeCapacityForClient(key))
1944
- return;
1945
- const promise = this.spawnClient(server, root, key, filePath, allowInstall);
1946
- this.state.inFlight.set(key, promise);
1947
- return { promise, startedSpawn: true };
1948
- });
1949
- if (!started)
1950
- return;
1951
- spawnPromise = started.promise;
1952
- startedSpawn = started.startedSpawn;
1953
- }
1954
- onSpawnInFlight?.(server.id);
1955
- try {
1956
- const spawned = await spawnPromise;
1957
- onOutcome?.(spawned ? startedSpawn ? "cold-spawn" : "cold-spawn-joined" : this.lastSpawnVerdict.get(key) === "failed" ? startedSpawn ? "spawn-failure" : "spawn-failure-joined" : "declined");
1958
- return spawned;
1959
- } catch (err) {
1960
- onOutcome?.("spawn-failure");
1961
- throw err;
1962
- } finally {
1963
- if (this.state.inFlight.get(key) === spawnPromise) {
1964
- this.state.inFlight.delete(key);
1965
- }
1966
- }
1967
- }
1968
- shouldAllowInstall(serverId) {
1969
- if (!assertInstallAllowed(`lsp install: ${serverId}`))
1970
- return false;
1971
- return process.env.DM_LENS_DISABLE_LSP_INSTALL !== "1";
1972
- }
1973
- async spawnClient(server, root, key, filePath, allowInstall) {
1974
- try {
1975
- if (server.executesProjectCode === true) {
1976
- refuseUntrustedLspExecution({
1977
- kind: "project-code-server",
1978
- serverId: server.id,
1979
- root
1980
- });
1981
- }
1982
- } catch (error) {
1983
- logSessionStart(`lsp spawn ${server.id}: refused — ${error instanceof Error ? error.message : String(error)}`);
1984
- this.noteSpawnVerdict(key, "failed");
1985
- return;
1986
- }
1987
- if (server.trustAllowed !== true && !isLspSpawnAllowedByTrust()) {
1988
- logSessionStart(`lsp spawn ${server.id}: refused — ${projectTrustDenialReason()}`);
1989
- this.noteSpawnVerdict(key, "declined");
1990
- return;
1991
- }
1992
- const isOptionalServer = OPTIONAL_LSP_SERVER_IDS.has(server.id);
1993
- const startedAt = Date.now();
1994
- logSessionStart(`lsp spawn ${server.id}: start root=${root} install=${allowInstall ? "enabled" : "disabled"} file=${filePath}`);
1995
- recordLsp(server.id, root, "spawn_start");
1996
- try {
1997
- const projectCodeAllowed = this.analysisRootModeForFile(filePath) !== "adopted";
1998
- const spawned = await withLspProjectCodePermission(projectCodeAllowed, () => server.spawn(root, {
1999
- allowInstall,
2000
- projectCodeAllowed,
2001
- sessionRoot: this.sessionCwd ?? process.cwd()
2002
- }));
2003
- if (this.isDestroyed) {
2004
- try {
2005
- spawned?.process?.process?.kill();
2006
- } catch {}
2007
- logSessionStart(`lsp spawn ${server.id}: aborted (service shut down mid-spawn)`);
2008
- this.noteSpawnVerdict(key, "declined");
2009
- return;
2010
- }
2011
- if (!spawned) {
2012
- logSessionStart(`lsp spawn ${server.id}: unavailable (${Date.now() - startedAt}ms)`);
2013
- recordLsp(server.id, root, "spawn_failed", Date.now() - startedAt);
2014
- if (!allowInstall) {
2015
- logSessionStart(`lsp spawn ${server.id}: unavailable with install disabled; temporary cooldown only`);
2016
- this.state.broken.set(key, Date.now() + BROKEN_BASE_COOLDOWN_MS);
2017
- this.noteSpawnVerdict(key, "declined");
2018
- return;
2019
- }
2020
- const uCount = (this.failureCounts.get(key) ?? 0) + 1;
2021
- this.failureCounts.set(key, uCount);
2022
- const uCooldown = Math.min(BROKEN_BASE_COOLDOWN_MS * 2 ** (uCount - 1), BROKEN_MAX_COOLDOWN_MS);
2023
- this.state.broken.set(key, Date.now() + uCooldown);
2024
- if (uCount >= BROKEN_PERMANENT_AFTER) {
2025
- this.permanentlyBroken.add(key);
2026
- this.recordBreaker(key, `permanently disabled after ${uCount} unavailable spawns`);
2027
- logSessionStart(`lsp spawn ${server.id}: permanently disabled after ${uCount} failures`);
2028
- }
2029
- this.noteSpawnVerdict(key, "failed");
2030
- return;
2031
- }
2032
- const override = getServerInitOverride(server.id, filePath);
2033
- const mergedInit = spawned.launchVariant === "classic" ? mergeInitializationOptions(override?.initializationOptions, spawned.initialization) : mergeInitializationOptions(spawned.initialization, override?.initializationOptions);
2034
- this.state.diagnosticsPublished.delete(server.id);
2035
- this.state.diagnosticsUnsupported.delete(server.id);
2036
- this.firstContactWaits.delete(server.id);
2037
- const client = await createLSPClient({
2038
- serverId: server.id,
2039
- process: spawned.process,
2040
- root,
2041
- sessionCwd: this.sessionCwd,
2042
- initialization: mergedInit,
2043
- initializeTimeoutMs: server.initializeTimeoutMs,
2044
- launchVariant: spawned.launchVariant,
2045
- onDiagnosticsPublished: (serverId) => {
2046
- this.state.diagnosticsPublished.add(serverId);
2047
- }
2048
- });
2049
- if (this.isDestroyed) {
2050
- client.shutdown({ fast: true }).catch(() => {});
2051
- logSessionStart(`lsp spawn ${server.id}: aborted (service shut down mid-initialize)`);
2052
- this.noteSpawnVerdict(key, "declined");
2053
- return;
2054
- }
2055
- const wsDiag = typeof client.getWorkspaceDiagnosticsSupport === "function" ? client.getWorkspaceDiagnosticsSupport() : {
2056
- advertised: false,
2057
- mode: "push-only",
2058
- diagnosticProviderKind: "unavailable"
2059
- };
2060
- this.state.clients.set(key, client);
2061
- this.forgetReadiness(key);
2062
- this.notifyStallDemotions.delete(key);
2063
- this.unavailableLogged.delete(key);
2064
- this.lastSpawnVerdict.delete(key);
2065
- this.state.clientSpawnedAt.set(key, Date.now());
2066
- this.clientLastUsedAt.set(key, Date.now());
2067
- this.scheduleIdleEviction(key, server);
2068
- this.failureCounts.delete(key);
2069
- if (isOptionalServer) {
2070
- this.optionalDisabled.delete(key);
2071
- this.optionalFailureLogged.delete(key);
2072
- }
2073
- logSessionStart(`lsp spawn ${server.id}: success source=${spawned.source ?? "unknown"} (${Date.now() - startedAt}ms)`);
2074
- const spawnDurationMs = Date.now() - startedAt;
2075
- recordLsp(server.id, root, "spawn_success", spawnDurationMs);
2076
- recordSuccessfulLspSpawn(server.id, spawnDurationMs);
2077
- logLatency({
2078
- type: "phase",
2079
- phase: "lsp_server_spawned",
2080
- filePath: root,
2081
- durationMs: spawnDurationMs,
2082
- metadata: {
2083
- serverId: server.id,
2084
- source: spawned.source ?? "unknown",
2085
- launchVariant: spawned.launchVariant ?? "default",
2086
- triggerFilePath: filePath
2087
- }
2088
- });
2089
- if (!this.workspaceProbeLogged.has(key)) {
2090
- logSessionStart(`lsp workspace-diag probe ${server.id}: advertised=${wsDiag.advertised} mode=${wsDiag.mode} provider=${wsDiag.diagnosticProviderKind}`);
2091
- this.workspaceProbeLogged.add(key);
2092
- }
2093
- return { client, info: server };
2094
- } catch (err) {
2095
- recordLsp(server.id, root, "spawn_failed", Date.now() - startedAt);
2096
- if (!isOptionalServer || !this.optionalFailureLogged.has(key)) {
2097
- logSessionStart(`lsp spawn ${server.id}: failed (${Date.now() - startedAt}ms) error=${err instanceof Error ? err.message : String(err)}`);
2098
- if (isOptionalServer) {
2099
- this.optionalFailureLogged.add(key);
2100
- }
2101
- }
2102
- const eCount = (this.failureCounts.get(key) ?? 0) + 1;
2103
- this.failureCounts.set(key, eCount);
2104
- const eCooldown = isOptionalServer ? OPTIONAL_LSP_RETRY_COOLDOWN_MS : Math.min(BROKEN_BASE_COOLDOWN_MS * 2 ** (eCount - 1), BROKEN_MAX_COOLDOWN_MS);
2105
- this.state.broken.set(key, Date.now() + eCooldown);
2106
- if (!isOptionalServer && eCount >= BROKEN_PERMANENT_AFTER) {
2107
- this.permanentlyBroken.add(key);
2108
- this.recordBreaker(key, `permanently disabled after ${eCount} spawn/initialize failures`);
2109
- logSessionStart(`lsp spawn ${server.id}: permanently disabled after ${eCount} failures`);
2110
- }
2111
- if (isOptionalServer) {
2112
- this.optionalDisabled.add(key);
2113
- }
2114
- this.noteSpawnVerdict(key, "failed");
2115
- return;
2116
- }
2117
- }
2118
1762
  async openFile(filePath, content, options) {
2119
1763
  if (this.checkDestroyed())
2120
1764
  return;
@@ -2220,6 +1864,8 @@ export class LSPService {
2220
1864
  }
2221
1865
  if (spawned.length === 0) {
2222
1866
  const failureKind = this.isSpawnInFlight(filePath, resolvedPrimaryRoots) ? "spawn_in_flight_budget_elapsed" : "no_clients_none_spawning";
1867
+ const unanswered = diagnosticsMode === "none" ? undefined : unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
1868
+ const disabledPrimaryServerIds = unanswered?.disabledServerIds ?? [];
2223
1869
  logLatency({
2224
1870
  type: "phase",
2225
1871
  phase: "lsp_touch_file",
@@ -2234,12 +1880,30 @@ export class LSPService {
2234
1880
  maxClientWaitMs: options.maxClientWaitMs,
2235
1881
  failureKind,
2236
1882
  ...waitSkipReasons.size > 0 ? { reason: [...waitSkipReasons][0] } : {},
1883
+ ...disabledPrimaryServerIds.length > 0 && {
1884
+ disabledPrimaryServerIds
1885
+ },
2237
1886
  candidates: this.describeTouchCandidates(filePath, resolvedPrimaryRoots, attemptedAuxiliaryRoots)
2238
1887
  }
2239
1888
  });
1889
+ if (unanswered !== undefined && (disabledPrimaryServerIds.length > 0 || options.nameUnansweredPrimaries === true && unanswered.serverIds.length > 0)) {
1890
+ return {
1891
+ diags: [],
1892
+ ...resolveTouchVerdict({
1893
+ unavailablePrimaryServerIds: unanswered.serverIds,
1894
+ disabledPrimaryServerIds,
1895
+ primaryUnavailableCause: unanswered.cause,
1896
+ primaryNotifyWriteTimedOutServerIds: [],
1897
+ diagnosticsTimedOut: false,
1898
+ diagnosticsUnansweredServerIds: []
1899
+ })
1900
+ };
1901
+ }
2240
1902
  return;
2241
1903
  }
2242
- const leaseKeys = await this.acquireClientLeases(spawned, filePath);
1904
+ const unanswered = unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
1905
+ const unavailablePrimaryServerIds = unanswered.serverIds;
1906
+ const leaseKeys = await this.clientRegistry.acquireClientLeases(spawned, filePath);
2243
1907
  if (!leaseKeys) {
2244
1908
  if (this.checkDestroyed()) {
2245
1909
  const primaryServerIds = spawned.filter((entry) => !isAuxiliary(entry.info)).map((entry) => entry.info.id);
@@ -2255,7 +1919,8 @@ export class LSPService {
2255
1919
  return this.touchFile(filePath, content, options);
2256
1920
  }
2257
1921
  try {
2258
- if (this.shouldSkipTouch(filePath, contentFingerprint, clientScope, diagnosticsMode !== "none", spawned)) {
1922
+ if (this.shouldSkipTouch(filePath, contentHash, diagnosticsMode !== "none", spawned)) {
1923
+ const savedServerIds = spawned.flatMap((entry) => this.saveDebouncedPush(filePath, entry, options.saved === true, contentHash) ?? []);
2259
1924
  logLatency({
2260
1925
  type: "phase",
2261
1926
  phase: "lsp_touch_file",
@@ -2268,15 +1933,17 @@ export class LSPService {
2268
1933
  source,
2269
1934
  failureKind: "success",
2270
1935
  skipped: true,
2271
- reason: "debounced_unchanged_content"
1936
+ reason: "debounced_unchanged_content",
1937
+ ...savedServerIds.length > 0 && { savedServerIds }
2272
1938
  }
2273
1939
  });
2274
1940
  return { diags: [] };
2275
1941
  }
2276
1942
  const languageId = getLanguageId(filePath) ?? "plaintext";
2277
1943
  const silent = options.silent ?? false;
2278
- const notifySkippedServerIds = new Set(spawned.filter((entry) => this.shouldSkipNotify(filePath, contentFingerprint, clientScope, entry.info.id, entry.client)).map((entry) => entry.info.id));
1944
+ const notifySkippedServerIds = new Set(spawned.filter((entry) => this.shouldSkipNotify(filePath, contentHash, entry.info.id, entry.client)).map((entry) => entry.info.id));
2279
1945
  const notifySkipped = spawned.length > 0 && notifySkippedServerIds.size === spawned.length;
1946
+ const savedServerIds = spawned.flatMap((entry) => notifySkippedServerIds.has(entry.info.id) ? this.saveDebouncedPush(filePath, entry, options.saved === true, contentHash) ?? [] : []);
2280
1947
  const readPathVersion = (client) => client.getDiagnosticsVersionForPath?.(filePath);
2281
1948
  const diagnosticBaselines = new Map(spawned.map((entry) => [entry.client, readPathVersion(entry.client)]));
2282
1949
  const markedAtMs = Date.now();
@@ -2299,6 +1966,7 @@ export class LSPService {
2299
1966
  return false;
2300
1967
  return auxPublishedThisContent.has(serverId) || bindingMatchesTouchContent(entry.client.getDiagnosticBinding?.(filePath));
2301
1968
  };
1969
+ const auxPublishedCount = (client, published) => published ? client.getDiagnostics?.(filePath)?.length ?? 0 : 0;
2302
1970
  const notifyWriteTimedOutServerIds = [];
2303
1971
  const notifyDeferredServerIds = [];
2304
1972
  const supersededServerIds = [];
@@ -2343,7 +2011,7 @@ export class LSPService {
2343
2011
  let rejected = false;
2344
2012
  try {
2345
2013
  const writeStartedAt = Date.now();
2346
- const writePromise = entry.client.notify.open(filePath, content, languageId, undefined, silent, options.saved === true, options.readStamp).then((sent) => sent !== false);
2014
+ const writePromise = entry.client.notify.open(filePath, content, languageId, undefined, silent, options.saved === true, options.readStamp, contentHash).then((sent) => sent !== false);
2347
2015
  if (gated && clientKey) {
2348
2016
  this.noteAuxNotifyIssued(clientKey, entry.client);
2349
2017
  }
@@ -2370,7 +2038,7 @@ export class LSPService {
2370
2038
  if (wrote === true) {
2371
2039
  if (clientKey)
2372
2040
  this.notifyWriteBackpressureStreak.delete(clientKey);
2373
- this.markTouched(filePath, contentFingerprint(), clientScope, entry.info.id, entry.client);
2041
+ this.markTouched(filePath, entry.info.id, entry.client);
2374
2042
  } else if (wrote === false) {
2375
2043
  supersededServerIds.push(entry.info.id);
2376
2044
  } else {
@@ -2646,14 +2314,16 @@ export class LSPService {
2646
2314
  const outcomes = await Promise.all(auxWaits.map(async (aux) => {
2647
2315
  const { budgetMs } = aux;
2648
2316
  if (aux.demoted) {
2317
+ const demotedPublished = auxiliaryPublicationEvidence({
2318
+ bindingMatchesContent: auxCoversThisContent(aux.serverId),
2319
+ baseline: aux.baseline,
2320
+ currentPathVersion: readPathVersion(aux.client)
2321
+ });
2649
2322
  return {
2650
2323
  serverId: aux.serverId,
2651
2324
  outcome: deferredResyncServerIds.has(aux.serverId) ? "deferred" : "demoted",
2652
- publishedThisContent: auxiliaryPublicationEvidence({
2653
- bindingMatchesContent: auxCoversThisContent(aux.serverId),
2654
- baseline: aux.baseline,
2655
- currentPathVersion: readPathVersion(aux.client)
2656
- }),
2325
+ publishedThisContent: demotedPublished,
2326
+ publishedCount: auxPublishedCount(aux.client, demotedPublished),
2657
2327
  budgetMs,
2658
2328
  elapsedMs: 0,
2659
2329
  elapsedSinceNotifyMs: 0
@@ -2688,6 +2358,7 @@ export class LSPService {
2688
2358
  serverId: aux.serverId,
2689
2359
  outcome,
2690
2360
  publishedThisContent: auxCoversThisContent(aux.serverId),
2361
+ publishedCount: auxPublishedCount(aux.client, publishedEvidence || auxCoversThisContent(aux.serverId)),
2691
2362
  budgetMs,
2692
2363
  elapsedMs,
2693
2364
  elapsedSinceNotifyMs: Date.now() - waitStartedAt
@@ -2790,6 +2461,7 @@ export class LSPService {
2790
2461
  serverId: entry.info.id,
2791
2462
  outcome: deferredResyncServerIds.has(entry.info.id) ? "deferred" : publishedEvidence ? "answered" : "silent",
2792
2463
  publishedThisContent: auxCoversThisContent(entry.info.id),
2464
+ publishedCount: auxPublishedCount(entry.client, publishedEvidence || auxCoversThisContent(entry.info.id)),
2793
2465
  budgetMs: timeoutFor(entry.client.serverId),
2794
2466
  elapsedMs: waitedMs,
2795
2467
  elapsedSinceNotifyMs: waitedMs
@@ -2949,28 +2621,39 @@ export class LSPService {
2949
2621
  } catch {}
2950
2622
  }
2951
2623
  const verdict = resolveTouchVerdict({
2624
+ unavailablePrimaryServerIds,
2625
+ disabledPrimaryServerIds: unanswered.disabledServerIds,
2626
+ primaryUnavailableCause: unanswered.cause,
2952
2627
  primaryNotifyWriteTimedOutServerIds,
2953
2628
  diagnosticsTimedOut,
2954
2629
  diagnosticsUnansweredServerIds: diagnosticsUnansweredPrimaryServerIds
2955
2630
  });
2956
2631
  const inconclusive = verdict.inconclusive;
2957
- const brokenSkippedServerIds = collected !== undefined ? await this.brokenSkippedAuxiliaryServerIds(filePath, clientScope, options, spawned) : [];
2632
+ const skippedAuxiliaries = collected !== undefined ? await this.skippedAuxiliaryServerIds(filePath, clientScope, options, spawned) : { brokenSkippedServerIds: [], policySkippedServerIds: [] };
2633
+ const brokenSkippedServerIds = skippedAuxiliaries.brokenSkippedServerIds;
2634
+ const policySkippedServerIds = skippedAuxiliaries.policySkippedServerIds;
2958
2635
  const auxNoAnswerServerIds = spawned.filter((entry) => isAuxiliary(entry.info) && (diagnosticsUnansweredServerIds.includes(entry.info.id) || notifyWriteTimedOutServerIds.includes(entry.info.id)) && !auxCoveredAtMerge.has(entry.info.id)).map((entry) => entry.info.id);
2959
2636
  const unconfirmedServerIds = [
2960
2637
  ...new Set([
2961
2638
  ...auxUnconfirmedServerIds ?? [],
2962
2639
  ...auxNoAnswerServerIds,
2963
2640
  ...uncoveredDeferredServerIds,
2964
- ...brokenSkippedServerIds
2641
+ ...brokenSkippedServerIds,
2642
+ ...policySkippedServerIds
2965
2643
  ])
2966
2644
  ].filter((serverId) => !auxCoveredAtMerge.has(serverId));
2967
2645
  const coverageGap = unconfirmedServerIds.length > 0;
2968
- if (brokenSkippedServerIds.length > 0 || uncoveredDeferredServerIds.length > 0 || auxNoAnswerServerIds.length > 0) {
2646
+ if (brokenSkippedServerIds.length > 0 || policySkippedServerIds.length > 0 || uncoveredDeferredServerIds.length > 0 || auxNoAnswerServerIds.length > 0) {
2647
+ const configFailureSuffix = (serverId) => {
2648
+ const failure = spawned.find((entry) => entry.info.id === serverId)?.client.getConfigLoadFailure?.();
2649
+ return failure ? ` (server reported: ${failure})` : "";
2650
+ };
2969
2651
  for (const serverId of unconfirmedServerIds) {
2970
2652
  const reasons = [
2971
2653
  brokenSkippedServerIds.includes(serverId) && "breaker skip",
2654
+ policySkippedServerIds.includes(serverId) && "root policy skip",
2972
2655
  uncoveredDeferredServerIds.includes(serverId) && "deferred resync",
2973
- auxNoAnswerServerIds.includes(serverId) && "no diagnostics answer"
2656
+ auxNoAnswerServerIds.includes(serverId) && `no diagnostics answer${configFailureSuffix(serverId)}`
2974
2657
  ].filter(Boolean);
2975
2658
  incrementDegradationCount({
2976
2659
  kind: "lsp-scanner-coverage-gap",
@@ -2987,6 +2670,9 @@ export class LSPService {
2987
2670
  ...brokenSkippedServerIds.length > 0 && {
2988
2671
  brokenSkippedServerIds
2989
2672
  },
2673
+ ...policySkippedServerIds.length > 0 && {
2674
+ policySkippedServerIds
2675
+ },
2990
2676
  ...uncoveredDeferredServerIds.length > 0 && {
2991
2677
  deferredResyncServerIds: uncoveredDeferredServerIds
2992
2678
  },
@@ -3028,6 +2714,12 @@ export class LSPService {
3028
2714
  result.inconclusiveServerIds = verdict.inconclusiveServerIds;
3029
2715
  }
3030
2716
  result.inconclusiveReason = verdict.inconclusiveReason;
2717
+ if (verdict.disabledPrimaryServerIds) {
2718
+ result.disabledPrimaryServerIds = verdict.disabledPrimaryServerIds;
2719
+ }
2720
+ if (verdict.primaryUnavailableCause) {
2721
+ result.primaryUnavailableCause = verdict.primaryUnavailableCause;
2722
+ }
3031
2723
  } else if (collected !== undefined && primaryDiagnosticsUnsupported) {
3032
2724
  if (unconfirmedServerIds.length > 0) {
3033
2725
  result.unconfirmedServerIds = [...unconfirmedServerIds];
@@ -3074,6 +2766,7 @@ export class LSPService {
3074
2766
  notifyWriteTimedOutServerIds
3075
2767
  },
3076
2768
  ...supersededServerIds.length > 0 && { supersededServerIds },
2769
+ ...savedServerIds.length > 0 && { savedServerIds },
3077
2770
  diagnosticsTimedOut,
3078
2771
  inconclusive,
3079
2772
  ...verdict.inconclusiveServerIds && {
@@ -3090,6 +2783,7 @@ export class LSPService {
3090
2783
  auxUnconfirmedServerIds
3091
2784
  },
3092
2785
  ...brokenSkippedServerIds.length > 0 && { brokenSkippedServerIds },
2786
+ ...policySkippedServerIds.length > 0 && { policySkippedServerIds },
3093
2787
  ...uncoveredDeferredServerIds.length > 0 && {
3094
2788
  deferredResyncServerIds: uncoveredDeferredServerIds
3095
2789
  },
@@ -3102,13 +2796,13 @@ export class LSPService {
3102
2796
  return result;
3103
2797
  } finally {
3104
2798
  for (const lease of leaseKeys)
3105
- this.releaseClientLease(lease.key, lease.server);
2799
+ this.clientRegistry.releaseClientLease(lease.key, lease.server);
3106
2800
  }
3107
2801
  }
3108
2802
  async findOutsideProjectRoot(filePath) {
3109
- if (!this.fileIsOutsideRegisteredRoots(filePath))
2803
+ if (!this.clientRegistry.fileIsOutsideRegisteredRoots(filePath))
3110
2804
  return;
3111
- if (this.analysisRootModeForFile(filePath) === "adopted")
2805
+ if (this.clientRegistry.analysisRootModeForFile(filePath) === "adopted")
3112
2806
  return;
3113
2807
  const candidates = await Promise.all(getServersForFileWithConfig(filePath).map((server) => server.root(filePath)));
3114
2808
  return candidates.find((candidate) => Boolean(candidate));
@@ -3144,7 +2838,7 @@ export class LSPService {
3144
2838
  }
3145
2839
  return this.lastKnownDiagnostics.get(normalizedKey);
3146
2840
  }
3147
- async getDiagnostics(filePath, diagnosticsMode = "full") {
2841
+ async getDiagnostics(filePath, diagnosticsMode = "full", excludeServerIds) {
3148
2842
  const normalizedPath = normalizeMapKey(filePath);
3149
2843
  const outsideRoot = await this.findOutsideProjectRoot(filePath);
3150
2844
  if (outsideRoot) {
@@ -3165,11 +2859,15 @@ export class LSPService {
3165
2859
  return [];
3166
2860
  }
3167
2861
  const startedAt = Date.now();
3168
- const candidateServerIds = getServersForFileWithConfig(filePath).map((s) => s.id);
3169
- const { clients: spawned, serverCountAttempted } = await this.getClientsForFile(filePath);
2862
+ const candidateServerIds = getServersForFileWithConfig(filePath).flatMap((s) => excludeServerIds?.has(s.id) ? [] : [s.id]);
2863
+ const resolvedPrimaryRoots = new Map;
2864
+ const { clients: spawned, serverCountAttempted } = await this.getClientsForFile(filePath, excludeServerIds, resolvedPrimaryRoots);
3170
2865
  if (spawned.length === 0) {
3171
- const stale = this.lastKnownDiagnostics.get(normalizedPath);
2866
+ const stored = this.lastKnownDiagnostics.get(normalizedPath);
2867
+ const stale = excludeServerIds !== undefined && excludeServerIds.size > 0 ? stored?.filter((diagnostic) => !excludeServerIds.has(diagnostic.serverId ?? "")) : stored;
3172
2868
  const failureKind = stale?.length ? "no_clients_stale" : "no_clients";
2869
+ const unanswered = unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
2870
+ const unavailablePrimaryServerIds = unanswered.serverIds;
3173
2871
  this.lastDiagnosticsHealth.set(normalizedPath, {
3174
2872
  health: failureKind,
3175
2873
  failureKind,
@@ -3178,7 +2876,14 @@ export class LSPService {
3178
2876
  candidateServerIds,
3179
2877
  mergedCount: stale?.length ?? 0,
3180
2878
  dedupDroppedCount: 0,
3181
- checkedAt: new Date().toISOString()
2879
+ checkedAt: new Date().toISOString(),
2880
+ unavailablePrimaryServerIds,
2881
+ ...unanswered.disabledServerIds.length > 0 && {
2882
+ disabledPrimaryServerIds: unanswered.disabledServerIds
2883
+ },
2884
+ ...unavailablePrimaryServerIds.length > 0 && {
2885
+ primaryUnavailableCause: unanswered.cause
2886
+ }
3182
2887
  });
3183
2888
  logLatency({
3184
2889
  type: "phase",
@@ -3192,7 +2897,10 @@ export class LSPService {
3192
2897
  dedupDroppedCount: 0,
3193
2898
  failureKind,
3194
2899
  health: failureKind,
3195
- servers: []
2900
+ servers: [],
2901
+ ...unavailablePrimaryServerIds.length > 0 && {
2902
+ unavailablePrimaryServerIds
2903
+ }
3196
2904
  }
3197
2905
  });
3198
2906
  return stale ?? [];
@@ -3258,6 +2966,8 @@ export class LSPService {
3258
2966
  const rawCount = perServerFull.reduce((sum, entry) => sum + entry.diagnosticCount, 0);
3259
2967
  const serversWithDiagnostics = perServerFull.filter((entry) => entry.diagnosticCount > 0).length;
3260
2968
  const failureKind = merged.length === 0 ? "ok_empty" : "success";
2969
+ const unanswered = unansweredPrimaries(spawned, resolvedPrimaryRoots, filePath);
2970
+ const unavailablePrimaryServerIds = unanswered.serverIds;
3261
2971
  this.lastDiagnosticsHealth.set(normalizedPath, {
3262
2972
  health: failureKind === "success" ? "ok" : "ok_empty",
3263
2973
  failureKind,
@@ -3266,7 +2976,14 @@ export class LSPService {
3266
2976
  candidateServerIds,
3267
2977
  mergedCount: merged.length,
3268
2978
  dedupDroppedCount: rawCount - merged.length,
3269
- checkedAt: new Date().toISOString()
2979
+ checkedAt: new Date().toISOString(),
2980
+ unavailablePrimaryServerIds,
2981
+ ...unanswered.disabledServerIds.length > 0 && {
2982
+ disabledPrimaryServerIds: unanswered.disabledServerIds
2983
+ },
2984
+ ...unavailablePrimaryServerIds.length > 0 && {
2985
+ primaryUnavailableCause: unanswered.cause
2986
+ }
3270
2987
  });
3271
2988
  logLatency({
3272
2989
  type: "phase",
@@ -3287,7 +3004,10 @@ export class LSPService {
3287
3004
  id: entry.serverId,
3288
3005
  waitMs: entry.waitMs,
3289
3006
  diagnosticCount: entry.diagnosticCount
3290
- }))
3007
+ })),
3008
+ ...unavailablePrimaryServerIds.length > 0 && {
3009
+ unavailablePrimaryServerIds
3010
+ }
3291
3011
  }
3292
3012
  });
3293
3013
  if (merged.length > 0) {
@@ -3451,7 +3171,7 @@ export class LSPService {
3451
3171
  return { executed: false, reason: "lsp service destroyed" };
3452
3172
  }
3453
3173
  for (const server of getServersForFileWithConfig(filePath)) {
3454
- const root = await this.resolveServerRoot(server, filePath);
3174
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
3455
3175
  if (!root)
3456
3176
  continue;
3457
3177
  const entry = this.state.clients.get(`${server.id}:${normalizeMapKey(root)}`);
@@ -3506,7 +3226,7 @@ export class LSPService {
3506
3226
  if (filePath) {
3507
3227
  const servers = getServersForFileWithConfig(filePath);
3508
3228
  for (const server of servers) {
3509
- const root = await this.resolveServerRoot(server, filePath);
3229
+ const root = await this.clientRegistry.resolveServerRoot(server, filePath);
3510
3230
  if (!root)
3511
3231
  continue;
3512
3232
  const client = this.state.clients.get(`${server.id}:${normalizeMapKey(root)}`);
@@ -3619,21 +3339,24 @@ export class LSPService {
3619
3339
  });
3620
3340
  return false;
3621
3341
  });
3622
- const willResults = await Promise.all(willRenameClients.map(async ({ serverId, client }) => {
3342
+ const renameRequestedAtMs = Date.now();
3343
+ const willResults = await Promise.all(willRenameClients.map(async ({ clientKey, serverId, client }) => {
3623
3344
  try {
3624
3345
  return {
3346
+ clientKey,
3625
3347
  serverId,
3626
- edit: await client.willRenameFiles(oldFilePath, newFilePath)
3348
+ edit: await client.willRenameFiles(oldFilePath, newFilePath),
3349
+ failed: false
3627
3350
  };
3628
3351
  } catch (err) {
3629
3352
  willRenameFailures.push({
3630
3353
  serverId,
3631
3354
  error: err instanceof Error ? err.message : String(err)
3632
3355
  });
3633
- return { serverId, edit: null };
3356
+ return { clientKey, serverId, edit: null, failed: true };
3634
3357
  }
3635
3358
  }));
3636
- const successfulWillResults = willResults.filter((result) => !willRenameFailures.some((failure) => failure.serverId === result.serverId));
3359
+ const successfulWillResults = willResults.filter((result) => !result.failed);
3637
3360
  if (willRenameClients.length > 0 && successfulWillResults.length === 0) {
3638
3361
  throw new Error(`workspace/willRenameFiles failed for all active LSP servers: ${willRenameFailures.map((failure) => `${failure.serverId}: ${failure.error}`).join("; ")}`);
3639
3362
  }
@@ -3654,7 +3377,9 @@ export class LSPService {
3654
3377
  try {
3655
3378
  applied = await applyWorkspaceEdit(merged.edit, cwd, {
3656
3379
  mutationContext: options.mutationContext,
3657
- observe: false
3380
+ observe: false,
3381
+ watchedFileSink: this,
3382
+ expectedContent: captureRenameExpectedContent(merged.edit, cwd, renameRequestedAtMs, (filePath, atCwd, sourceClientKeys) => sourceClientKeys === undefined ? this.getTrackedContent(filePath, atCwd) : this.getTrackedContent(filePath, atCwd, sourceClientKeys), undefined, merged.sourceClientKeys)
3658
3383
  });
3659
3384
  } catch (err) {
3660
3385
  if (options.mutationContext) {
@@ -3668,7 +3393,8 @@ export class LSPService {
3668
3393
  }
3669
3394
  throw err;
3670
3395
  }
3671
- const openDocuments = activeClients.filter(({ client }) => client.isDocumentOpen(oldFilePath)).map(({ serverId, client }) => ({
3396
+ const openDocuments = activeClients.filter(({ client }) => client.isDocumentOpen(oldFilePath)).map(({ clientKey, serverId, client }) => ({
3397
+ clientKey,
3672
3398
  serverId,
3673
3399
  client,
3674
3400
  oldUri: client.getDocumentUri(oldFilePath)
@@ -3737,7 +3463,7 @@ export class LSPService {
3737
3463
  newUri: pathToFileURL(newFilePath).href
3738
3464
  }
3739
3465
  ]
3740
- }, cwd, { observe: false });
3466
+ }, cwd, { observe: false, watchedFileSink: this });
3741
3467
  } catch (err) {
3742
3468
  if (options.mutationContext) {
3743
3469
  recordLspMutation(options.mutationContext, {
@@ -3750,7 +3476,7 @@ export class LSPService {
3750
3476
  const relOld = path.relative(cwd, oldFilePath).replace(/\\/g, "/") || path.basename(oldFilePath);
3751
3477
  const relNew = path.relative(cwd, newFilePath).replace(/\\/g, "/") || path.basename(newFilePath);
3752
3478
  const renameDescription = `Renamed ${relOld} → ${relNew}`;
3753
- await Promise.all(activeClients.map(async ({ serverId, client }) => {
3479
+ await Promise.all(activeClients.map(async ({ clientKey, serverId, client }) => {
3754
3480
  if (client.getOperationSupport().didRenameFiles !== true) {
3755
3481
  recordDegradationOnce({
3756
3482
  kind: "lsp-capability-skip",
@@ -3759,7 +3485,7 @@ export class LSPService {
3759
3485
  });
3760
3486
  return;
3761
3487
  }
3762
- const opened = openDocuments.find((entry) => entry.serverId === serverId);
3488
+ const opened = openDocuments.find((entry) => entry.clientKey === clientKey);
3763
3489
  const result = await runRenameNotify(() => opened?.oldUri ? client.didRenameFiles(oldFilePath, newFilePath, opened.oldUri, destinationUriPreservingSpelling(opened.oldUri, oldFilePath, newFilePath)) : client.didRenameFiles(oldFilePath, newFilePath), RENAME_NOTIFY_TIMEOUT_MS);
3764
3490
  if (!result.ok) {
3765
3491
  didRenameFailures.push({
@@ -4071,6 +3797,7 @@ export class LSPService {
4071
3797
  }));
4072
3798
  return !capped;
4073
3799
  };
3800
+ this.announceCreatedFiles([...files, ...goPackageFilesToAnnounce(files)], await importTargetsToAnnounce(root, files.filter((filePath) => !workspaceDiagnosticsCacheCtx.servesClean(filePath, workspaceSweepScopeKey)), (filePath, scope) => workspaceDiagnosticsCacheCtx.noteImportScope(filePath, scope)));
4074
3801
  const cachedResults = [];
4075
3802
  const filesToTouch = [];
4076
3803
  const writeIndexByPath = new Map;
@@ -4205,7 +3932,13 @@ export class LSPService {
4205
3932
  await this.ensureWarmForSweep(filePath, { signal });
4206
3933
  }
4207
3934
  const touchResult = attached?.available ? {
4208
- diags: attached.response.diagnostics,
3935
+ diags: attached.response.projectIdentity === undefined ? attached.response.diagnostics : await demoteInferredProjectDiagnostics(attached.response.diagnostics, {
3936
+ filePath,
3937
+ cwd,
3938
+ identityCache: new Map([
3939
+ [filePath, attached.response.projectIdentity]
3940
+ ])
3941
+ }),
4209
3942
  ...attached.response.unconfirmedServerIds !== undefined && {
4210
3943
  unconfirmedServerIds: attached.response.unconfirmedServerIds
4211
3944
  }
@@ -4225,7 +3958,7 @@ export class LSPService {
4225
3958
  const timedOut = touchResult === undefined || inconclusive || declinedOutsideRoot;
4226
3959
  if (timedOut)
4227
3960
  timedOutFiles += 1;
4228
- const unconfirmedReason = touchResult === undefined ? "budget" : declinedOutsideRoot ? "outside_project_root" : inconclusive ? "inconclusive" : undefined;
3961
+ const unconfirmedReason = touchResult === undefined ? "budget" : declinedOutsideRoot ? "outside_project_root" : inconclusive ? touchResult?.inconclusiveReason === "primary-unavailable" ? SWEEP_REASON_FOR_CAUSE[touchResult.primaryUnavailableCause ?? "unstarted"] : "inconclusive" : undefined;
4229
3962
  const rawBinding = touchResult?.binding;
4230
3963
  const filteredDiagnostics = diagnostics ? applyAuxiliarySuppressions(diagnostics, content, {
4231
3964
  fileRole: detectFileRole(filePath, content),
@@ -4326,12 +4059,13 @@ export class LSPService {
4326
4059
  }
4327
4060
  });
4328
4061
  for (const filePath of group.files) {
4062
+ const { disabledServerIds, fallbackServerIds } = disabledPrimaries(filePath);
4329
4063
  results.push({
4330
4064
  filePath,
4331
4065
  diagnostics: [],
4332
4066
  count: 0,
4333
4067
  timedOut: true,
4334
- unconfirmedReason: "inconclusive",
4068
+ unconfirmedReason: SWEEP_REASON_FOR_CAUSE[primaryUnavailableCause([...warmup.failedServerIds, ...disabledServerIds], disabledServerIds, fallbackServerIds)],
4335
4069
  skippedWarmupFailure: true
4336
4070
  });
4337
4071
  timedOutFiles += 1;
@@ -4478,7 +4212,7 @@ export class LSPService {
4478
4212
  return;
4479
4213
  }
4480
4214
  }
4481
- async getAllDiagnostics() {
4215
+ async getAllDiagnostics(excludeServerIds) {
4482
4216
  const all = new Map;
4483
4217
  const bindingsByPath = new Map;
4484
4218
  const now = Date.now();
@@ -4493,6 +4227,8 @@ export class LSPService {
4493
4227
  return true;
4494
4228
  }));
4495
4229
  client.pruneDiagnostics((filePath, ts) => !existingPaths.has(filePath) || now - ts > CASCADE_DIAGNOSTICS_TTL_MS);
4230
+ if (excludeServerIds?.has(client.serverId))
4231
+ continue;
4496
4232
  const clientDiags = client.getAllDiagnostics();
4497
4233
  for (const [filePath, entry] of clientDiags) {
4498
4234
  const attributed = attributeDiagnostics(client.serverId, entry.diags);
@@ -4525,13 +4261,6 @@ export class LSPService {
4525
4261
  supportsLSP(filePath) {
4526
4262
  return getServersForFileWithConfig(filePath).length > 0;
4527
4263
  }
4528
- isSpawnInFlight(_filePath, resolvedRoots = new Map) {
4529
- for (const [serverId, root] of resolvedRoots) {
4530
- if (this.state.inFlight.has(`${serverId}:${root}`))
4531
- return true;
4532
- }
4533
- return false;
4534
- }
4535
4264
  describeTouchCandidates(filePath, resolvedRoots, auxiliaryRoots = new Map) {
4536
4265
  const candidates = [];
4537
4266
  for (const server of getServersForFileWithConfig(filePath)) {
@@ -4564,28 +4293,12 @@ export class LSPService {
4564
4293
  const resetStartedAt = Date.now();
4565
4294
  if (this.checkDestroyed())
4566
4295
  return;
4567
- this.isDestroyed = true;
4296
+ this.clientRegistry.markDestroyed();
4568
4297
  this.shutdownController.abort();
4569
4298
  for (const [key, token] of this.outstandingAuxNotifyWrites) {
4570
4299
  this.releaseOutstandingAuxNotifyWrite(key, token);
4571
4300
  }
4572
- for (const key of this.idleEvictionTimers.keys()) {
4573
- this.clearIdleEvictionTimer(key);
4574
- }
4575
- if (!options.processExiting && this.state.inFlight.size > 0) {
4576
- const pending = Array.from(this.state.inFlight.values());
4577
- this.state.inFlight.clear();
4578
- const settled = await Promise.allSettled(pending);
4579
- for (const result of settled) {
4580
- if (result.status === "fulfilled" && result.value?.client) {
4581
- result.value.client.shutdown({ fast: true }).catch(() => {});
4582
- }
4583
- }
4584
- } else {
4585
- this.state.inFlight.clear();
4586
- }
4587
- const aliveClients = this.getAliveClientCount();
4588
- await Promise.allSettled(Array.from(this.state.clients.values(), (client) => Promise.resolve().then(() => client.shutdown(options))));
4301
+ const aliveClients = await this.clientRegistry.shutdownClients(options);
4589
4302
  logLatency({
4590
4303
  type: "phase",
4591
4304
  phase: "lsp_service_reset",
@@ -4599,10 +4312,8 @@ export class LSPService {
4599
4312
  processExiting: !!options.processExiting
4600
4313
  }
4601
4314
  });
4602
- this.state.clients.clear();
4603
- this.state.broken.clear();
4315
+ this.clientRegistry.clearAfterShutdown();
4604
4316
  this.firstContactWaits.clear();
4605
- this.lastSpawnVerdict.clear();
4606
4317
  for (const [key, token] of this.outstandingAuxNotifyWrites) {
4607
4318
  this.releaseOutstandingAuxNotifyWrite(key, token);
4608
4319
  }
@@ -4610,76 +4321,21 @@ export class LSPService {
4610
4321
  this.auxNotifyDrainLatencyEwma.clear();
4611
4322
  this.auxNotifyInflight.clear();
4612
4323
  this.documentDrift.clear();
4613
- this.workspaceProbeLogged.clear();
4614
- this.warmStartLogged.clear();
4615
4324
  }
4616
- getStatus() {
4617
- return Array.from(this.state.clients.entries()).map(([key, client]) => {
4618
- const [serverId, root] = key.split(":");
4619
- return {
4620
- serverId,
4621
- root,
4622
- connected: client.isAlive(),
4623
- pullFailureHistory: (client.getPullFailureHistory?.() ?? []).map((entry) => ({
4624
- ...entry,
4625
- message: entry.message.slice(0, 200)
4626
- }))
4627
- };
4628
- });
4325
+ isSpawnInFlight(filePath, resolvedRoots) {
4326
+ return this.clientRegistry.isSpawnInFlight(filePath, resolvedRoots);
4629
4327
  }
4630
- recordRuntimeExitWindow(key, exitedAt, uptimeMs) {
4631
- if (exitedAt == null || uptimeMs == null || uptimeMs > RUNTIME_EXIT_WINDOW_UPTIME_CEILING_MS) {
4632
- return false;
4633
- }
4634
- const deaths = this.runtimeExitWindow.get(key) ?? [];
4635
- deaths.push(exitedAt);
4636
- const windowRef = Math.max(...deaths);
4637
- const windowStart = windowRef - RUNTIME_EXIT_WINDOW_MS;
4638
- let pruned = deaths.filter((t) => t >= windowStart);
4639
- if (pruned.length > RUNTIME_EXIT_WINDOW_TRIP_COUNT) {
4640
- pruned = pruned.slice(pruned.length - RUNTIME_EXIT_WINDOW_TRIP_COUNT);
4641
- }
4642
- this.runtimeExitWindow.set(key, pruned);
4643
- return pruned.length >= RUNTIME_EXIT_WINDOW_TRIP_COUNT;
4328
+ getStatus() {
4329
+ return this.clientRegistry.getStatus();
4644
4330
  }
4645
4331
  getBrokenStatus() {
4646
- const keys = new Set([
4647
- ...this.state.broken.keys(),
4648
- ...this.permanentlyBroken
4649
- ]);
4650
- return [...keys].map((key) => {
4651
- const separator = key.indexOf(":");
4652
- return {
4653
- serverId: separator >= 0 ? key.slice(0, separator) : key,
4654
- root: separator >= 0 ? key.slice(separator + 1) : "",
4655
- failures: (this.failureCounts.get(key) ?? 0) + Math.max(this.runtimeExitCounts.get(key) ?? 0, this.runtimeExitWindow.get(key)?.length ?? 0),
4656
- permanentlyBroken: this.permanentlyBroken.has(key),
4657
- cooldownUntil: this.state.broken.get(key) ?? 0
4658
- };
4659
- });
4332
+ return this.clientRegistry.getBrokenStatus();
4660
4333
  }
4661
4334
  getAliveClientCount() {
4662
- let count = 0;
4663
- for (const client of this.state.clients.values()) {
4664
- if (client.isAlive())
4665
- count++;
4666
- }
4667
- return count;
4335
+ return this.clientRegistry.getAliveClientCount();
4668
4336
  }
4669
4337
  getAliveServerIds() {
4670
- const primary = [];
4671
- const aux = [];
4672
- const seen = new Set;
4673
- for (const client of this.state.clients.values()) {
4674
- if (!client.isAlive())
4675
- continue;
4676
- const id = client.serverId;
4677
- if (seen.has(id))
4678
- continue;
4679
- seen.add(id);
4680
- (isAuxiliary(getServerById(id)) ? aux : primary).push(id);
4681
- }
4682
- return [...primary, ...aux];
4338
+ return this.clientRegistry.getAliveServerIds();
4683
4339
  }
4684
4340
  }
4685
4341
  configureLspServiceLifecycle({
@@ -4713,6 +4369,8 @@ export function resetLSPService(options = {}) {
4713
4369
  resetClassicTsRepairGuard();
4714
4370
  clearWorkspaceSweepHoldForSessionStart();
4715
4371
  }
4372
+ if (options.reason === "session_shutdown")
4373
+ emitCreatedImportScanRollupAtSessionEnd();
4716
4374
  resetOwnedLspService(options);
4717
4375
  }
4718
4376
  export function __collectWorkspaceDiagnosticFilesForTest(root, maxFiles, signal, homeDir) {