@duckmind/dm-darwin-x64 0.67.2 → 0.67.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (605) hide show
  1. package/README.md +2 -2
  2. package/dm +1 -1
  3. package/extensions/.dm-extensions.json +611 -13
  4. package/extensions/dm-lens/clients/dispatch/runners/utils/runner-helpers.js +1 -1
  5. package/extensions/dm-lens/dist/clients/actionable-warnings-logger.js +24 -0
  6. package/extensions/dm-lens/dist/clients/actionable-warnings.js +1066 -0
  7. package/extensions/dm-lens/dist/clients/advisory-provenance.js +388 -0
  8. package/extensions/dm-lens/dist/clients/agent-behavior-client.js +94 -0
  9. package/extensions/dm-lens/dist/clients/agent-nudge.js +253 -0
  10. package/extensions/dm-lens/dist/clients/analysed-root.js +1 -0
  11. package/extensions/dm-lens/dist/clients/analysis-root.js +133 -0
  12. package/extensions/dm-lens/dist/clients/ast-grep-client.js +587 -0
  13. package/extensions/dm-lens/dist/clients/ast-grep-rule-manager.js +137 -0
  14. package/extensions/dm-lens/dist/clients/ast-grep-tool-logger.js +85 -0
  15. package/extensions/dm-lens/dist/clients/ast-grep-types.js +1 -0
  16. package/extensions/dm-lens/dist/clients/ast-grep-yaml-synth.js +109 -0
  17. package/extensions/dm-lens/dist/clients/atomic-write-staging.js +66 -0
  18. package/extensions/dm-lens/dist/clients/atomic-write.js +37 -0
  19. package/extensions/dm-lens/dist/clients/availability-probe-flight.js +11 -0
  20. package/extensions/dm-lens/dist/clients/bash-file-access.js +1257 -0
  21. package/extensions/dm-lens/dist/clients/biome-client.js +223 -0
  22. package/extensions/dm-lens/dist/clients/blocker-freshness.js +553 -0
  23. package/extensions/dm-lens/dist/clients/blocker-past-eof.js +51 -0
  24. package/extensions/dm-lens/dist/clients/bootstrap.js +246 -0
  25. package/extensions/dm-lens/dist/clients/bounded-cache.js +105 -0
  26. package/extensions/dm-lens/dist/clients/bounded-pid-file-lock.js +275 -0
  27. package/extensions/dm-lens/dist/clients/bounded-telemetry.js +110 -0
  28. package/extensions/dm-lens/dist/clients/build-identity.js +45 -0
  29. package/extensions/dm-lens/dist/clients/bundled-resource-health.js +41 -0
  30. package/extensions/dm-lens/dist/clients/bus-events-logger.js +48 -0
  31. package/extensions/dm-lens/dist/clients/bus-publish.js +117 -0
  32. package/extensions/dm-lens/dist/clients/cache/rule-cache.js +87 -0
  33. package/extensions/dm-lens/dist/clients/cache-manager.js +449 -0
  34. package/extensions/dm-lens/dist/clients/cache-observability.js +1105 -0
  35. package/extensions/dm-lens/dist/clients/call-graph.js +628 -0
  36. package/extensions/dm-lens/dist/clients/cargo-manifest.js +167 -0
  37. package/extensions/dm-lens/dist/clients/cascade-budget.js +52 -0
  38. package/extensions/dm-lens/dist/clients/cascade-format.js +301 -0
  39. package/extensions/dm-lens/dist/clients/cascade-logger.js +22 -0
  40. package/extensions/dm-lens/dist/clients/cascade-types.js +1 -0
  41. package/extensions/dm-lens/dist/clients/child-unref.js +59 -0
  42. package/extensions/dm-lens/dist/clients/code-quality-warnings.js +192 -0
  43. package/extensions/dm-lens/dist/clients/codebase-model.js +110 -0
  44. package/extensions/dm-lens/dist/clients/collateral-test-role.js +8 -0
  45. package/extensions/dm-lens/dist/clients/complexity-client.js +398 -0
  46. package/extensions/dm-lens/dist/clients/config-core/deny.js +117 -0
  47. package/extensions/dm-lens/dist/clients/config-core/index.js +2 -0
  48. package/extensions/dm-lens/dist/clients/config-core/merge.js +228 -0
  49. package/extensions/dm-lens/dist/clients/config-core/normalize.js +226 -0
  50. package/extensions/dm-lens/dist/clients/config-core/process-spec.js +147 -0
  51. package/extensions/dm-lens/dist/clients/config-core/provenance.js +54 -0
  52. package/extensions/dm-lens/dist/clients/config-core/records.js +79 -0
  53. package/extensions/dm-lens/dist/clients/config-core/resolve.js +48 -0
  54. package/extensions/dm-lens/dist/clients/config-core/safe-object.js +22 -0
  55. package/extensions/dm-lens/dist/clients/config-core/schema.js +93 -0
  56. package/extensions/dm-lens/dist/clients/config-diagnostic-codes.js +90 -0
  57. package/extensions/dm-lens/dist/clients/config-locations.js +169 -0
  58. package/extensions/dm-lens/dist/clients/config-resolve.js +359 -0
  59. package/extensions/dm-lens/dist/clients/config-schema.js +230 -0
  60. package/extensions/dm-lens/dist/clients/config-warn.js +146 -0
  61. package/extensions/dm-lens/dist/clients/confirmed-delete.js +11 -0
  62. package/extensions/dm-lens/dist/clients/console-guard-install.js +4 -0
  63. package/extensions/dm-lens/dist/clients/content-stamp.js +16 -0
  64. package/extensions/dm-lens/dist/clients/context-injection-ledger.js +157 -0
  65. package/extensions/dm-lens/dist/clients/cooperative-budget.js +36 -0
  66. package/extensions/dm-lens/dist/clients/custom-rule-locations.js +28 -0
  67. package/extensions/dm-lens/dist/clients/dead-code-client.js +408 -0
  68. package/extensions/dm-lens/dist/clients/dead-code-logger.js +18 -0
  69. package/extensions/dm-lens/dist/clients/deadline-utils.js +117 -0
  70. package/extensions/dm-lens/dist/clients/debug-handles.js +121 -0
  71. package/extensions/dm-lens/dist/clients/debug-heap.js +80 -0
  72. package/extensions/dm-lens/dist/clients/deferred-lsp-work.js +33 -0
  73. package/extensions/dm-lens/dist/clients/deferred-runner-blockers.js +146 -0
  74. package/extensions/dm-lens/dist/clients/deferred-test-targets.js +31 -0
  75. package/extensions/dm-lens/dist/clients/degradation-ledger.js +306 -0
  76. package/extensions/dm-lens/dist/clients/demoted-finding-render.js +64 -0
  77. package/extensions/dm-lens/dist/clients/dependency-checker.js +534 -0
  78. package/extensions/dm-lens/dist/clients/deps/ast-grep-napi.js +27 -0
  79. package/extensions/dm-lens/dist/clients/deps/dm-host-deps.js +10 -0
  80. package/extensions/dm-lens/dist/clients/deps/dm-tui-compat.js +58 -0
  81. package/extensions/dm-lens/dist/clients/deps/js-yaml.js +7 -0
  82. package/extensions/dm-lens/dist/clients/deps/minimatch.js +6 -0
  83. package/extensions/dm-lens/dist/clients/deps/pidusage.js +5 -0
  84. package/extensions/dm-lens/dist/clients/deps/typebox.js +5 -0
  85. package/extensions/dm-lens/dist/clients/deps/vscode-jsonrpc.js +8 -0
  86. package/extensions/dm-lens/dist/clients/deps/web-tree-sitter.js +11 -0
  87. package/extensions/dm-lens/dist/clients/diagnostic-dispositions.js +334 -0
  88. package/extensions/dm-lens/dist/clients/diagnostic-line-freshness.js +142 -0
  89. package/extensions/dm-lens/dist/clients/diagnostic-logger.js +60 -0
  90. package/extensions/dm-lens/dist/clients/diagnostic-tracker.js +89 -0
  91. package/extensions/dm-lens/dist/clients/diagnostics-publish.js +134 -0
  92. package/extensions/dm-lens/dist/clients/disk-change-consumers.js +312 -0
  93. package/extensions/dm-lens/dist/clients/disk-change-subscribers.js +191 -0
  94. package/extensions/dm-lens/dist/clients/disk-changes.js +165 -0
  95. package/extensions/dm-lens/dist/clients/dispatch/adopted-root-runners.js +22 -0
  96. package/extensions/dm-lens/dist/clients/dispatch/ast-grep-catalog.js +16 -0
  97. package/extensions/dm-lens/dist/clients/dispatch/auxiliary-lsp.js +162 -0
  98. package/extensions/dm-lens/dist/clients/dispatch/collect-later-tier.js +25 -0
  99. package/extensions/dm-lens/dist/clients/dispatch/diagnostic-taxonomy.js +58 -0
  100. package/extensions/dm-lens/dist/clients/dispatch/dispatcher.js +1240 -0
  101. package/extensions/dm-lens/dist/clients/dispatch/fact-provider-types.js +1 -0
  102. package/extensions/dm-lens/dist/clients/dispatch/fact-rule-runner.js +17 -0
  103. package/extensions/dm-lens/dist/clients/dispatch/fact-runner.js +18 -0
  104. package/extensions/dm-lens/dist/clients/dispatch/fact-scheduler.js +52 -0
  105. package/extensions/dm-lens/dist/clients/dispatch/fact-store.js +193 -0
  106. package/extensions/dm-lens/dist/clients/dispatch/facts/comment-facts.js +23 -0
  107. package/extensions/dm-lens/dist/clients/dispatch/facts/file-content.js +18 -0
  108. package/extensions/dm-lens/dist/clients/dispatch/facts/function-facts.js +274 -0
  109. package/extensions/dm-lens/dist/clients/dispatch/facts/import-facts.js +169 -0
  110. package/extensions/dm-lens/dist/clients/dispatch/facts/tree-sitter-facts.js +19 -0
  111. package/extensions/dm-lens/dist/clients/dispatch/facts/try-catch-facts.js +95 -0
  112. package/extensions/dm-lens/dist/clients/dispatch/finding-policy.js +188 -0
  113. package/extensions/dm-lens/dist/clients/dispatch/indent-detect.js +227 -0
  114. package/extensions/dm-lens/dist/clients/dispatch/inline-suppressions.js +52 -0
  115. package/extensions/dm-lens/dist/clients/dispatch/integration.js +1698 -0
  116. package/extensions/dm-lens/dist/clients/dispatch/known-runner-ids.js +13 -0
  117. package/extensions/dm-lens/dist/clients/dispatch/lane-copies.js +23 -0
  118. package/extensions/dm-lens/dist/clients/dispatch/lazy.js +8 -0
  119. package/extensions/dm-lens/dist/clients/dispatch/pending-runner-findings.js +133 -0
  120. package/extensions/dm-lens/dist/clients/dispatch/plan.js +284 -0
  121. package/extensions/dm-lens/dist/clients/dispatch/pre-edit-seed.js +57 -0
  122. package/extensions/dm-lens/dist/clients/dispatch/priorities.js +14 -0
  123. package/extensions/dm-lens/dist/clients/dispatch/rule-id-normalize.js +54 -0
  124. package/extensions/dm-lens/dist/clients/dispatch/rule-ignores.js +21 -0
  125. package/extensions/dm-lens/dist/clients/dispatch/rule-policy.js +102 -0
  126. package/extensions/dm-lens/dist/clients/dispatch/rules/async-noise.js +31 -0
  127. package/extensions/dm-lens/dist/clients/dispatch/rules/async-unnecessary-wrapper.js +27 -0
  128. package/extensions/dm-lens/dist/clients/dispatch/rules/cors-wildcard.js +35 -0
  129. package/extensions/dm-lens/dist/clients/dispatch/rules/error-obscuring.js +29 -0
  130. package/extensions/dm-lens/dist/clients/dispatch/rules/error-swallowing.js +29 -0
  131. package/extensions/dm-lens/dist/clients/dispatch/rules/framework-call-noise.js +31 -0
  132. package/extensions/dm-lens/dist/clients/dispatch/rules/high-complexity.js +41 -0
  133. package/extensions/dm-lens/dist/clients/dispatch/rules/high-fan-out.js +37 -0
  134. package/extensions/dm-lens/dist/clients/dispatch/rules/high-import-coupling.js +31 -0
  135. package/extensions/dm-lens/dist/clients/dispatch/rules/missing-error-propagation.js +45 -0
  136. package/extensions/dm-lens/dist/clients/dispatch/rules/no-commented-credentials.js +46 -0
  137. package/extensions/dm-lens/dist/clients/dispatch/rules/pass-through-wrappers.js +38 -0
  138. package/extensions/dm-lens/dist/clients/dispatch/rules/placeholder-comments.js +40 -0
  139. package/extensions/dm-lens/dist/clients/dispatch/rules/unsafe-boundary.js +101 -0
  140. package/extensions/dm-lens/dist/clients/dispatch/runner-context.js +41 -0
  141. package/extensions/dm-lens/dist/clients/dispatch/runners/actionlint.js +98 -0
  142. package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-literal-anchors.js +58 -0
  143. package/extensions/dm-lens/dist/clients/dispatch/runners/ast-grep-napi.js +739 -0
  144. package/extensions/dm-lens/dist/clients/dispatch/runners/biome-check.js +196 -0
  145. package/extensions/dm-lens/dist/clients/dispatch/runners/cpp-check.js +190 -0
  146. package/extensions/dm-lens/dist/clients/dispatch/runners/credo.js +66 -0
  147. package/extensions/dm-lens/dist/clients/dispatch/runners/cue-vet.js +161 -0
  148. package/extensions/dm-lens/dist/clients/dispatch/runners/dart-analyze.js +151 -0
  149. package/extensions/dm-lens/dist/clients/dispatch/runners/detekt.js +158 -0
  150. package/extensions/dm-lens/dist/clients/dispatch/runners/dotnet-build.js +163 -0
  151. package/extensions/dm-lens/dist/clients/dispatch/runners/elixir-check.js +153 -0
  152. package/extensions/dm-lens/dist/clients/dispatch/runners/eslint.js +99 -0
  153. package/extensions/dm-lens/dist/clients/dispatch/runners/fact-rules.js +20 -0
  154. package/extensions/dm-lens/dist/clients/dispatch/runners/fish-indent.js +120 -0
  155. package/extensions/dm-lens/dist/clients/dispatch/runners/gleam-check.js +100 -0
  156. package/extensions/dm-lens/dist/clients/dispatch/runners/go-vet.js +52 -0
  157. package/extensions/dm-lens/dist/clients/dispatch/runners/golangci-lint.js +105 -0
  158. package/extensions/dm-lens/dist/clients/dispatch/runners/hadolint.js +83 -0
  159. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-lint.js +147 -0
  160. package/extensions/dm-lens/dist/clients/dispatch/runners/helm-render.js +593 -0
  161. package/extensions/dm-lens/dist/clients/dispatch/runners/htmlhint.js +103 -0
  162. package/extensions/dm-lens/dist/clients/dispatch/runners/index.js +100 -0
  163. package/extensions/dm-lens/dist/clients/dispatch/runners/javac.js +82 -0
  164. package/extensions/dm-lens/dist/clients/dispatch/runners/ktlint.js +115 -0
  165. package/extensions/dm-lens/dist/clients/dispatch/runners/lsp.js +275 -0
  166. package/extensions/dm-lens/dist/clients/dispatch/runners/markdownlint.js +129 -0
  167. package/extensions/dm-lens/dist/clients/dispatch/runners/mypy.js +70 -0
  168. package/extensions/dm-lens/dist/clients/dispatch/runners/oxlint.js +296 -0
  169. package/extensions/dm-lens/dist/clients/dispatch/runners/php-lint.js +66 -0
  170. package/extensions/dm-lens/dist/clients/dispatch/runners/phpstan.js +90 -0
  171. package/extensions/dm-lens/dist/clients/dispatch/runners/prisma-validate.js +66 -0
  172. package/extensions/dm-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +307 -0
  173. package/extensions/dm-lens/dist/clients/dispatch/runners/pyright.js +118 -0
  174. package/extensions/dm-lens/dist/clients/dispatch/runners/rubocop.js +79 -0
  175. package/extensions/dm-lens/dist/clients/dispatch/runners/ruff.js +69 -0
  176. package/extensions/dm-lens/dist/clients/dispatch/runners/rust-clippy.js +166 -0
  177. package/extensions/dm-lens/dist/clients/dispatch/runners/shellcheck.js +168 -0
  178. package/extensions/dm-lens/dist/clients/dispatch/runners/shfmt.js +92 -0
  179. package/extensions/dm-lens/dist/clients/dispatch/runners/spellcheck.js +74 -0
  180. package/extensions/dm-lens/dist/clients/dispatch/runners/spotbugs.js +208 -0
  181. package/extensions/dm-lens/dist/clients/dispatch/runners/sqlfluff.js +136 -0
  182. package/extensions/dm-lens/dist/clients/dispatch/runners/stylelint.js +118 -0
  183. package/extensions/dm-lens/dist/clients/dispatch/runners/swiftlint.js +143 -0
  184. package/extensions/dm-lens/dist/clients/dispatch/runners/taplo.js +109 -0
  185. package/extensions/dm-lens/dist/clients/dispatch/runners/terragrunt.js +110 -0
  186. package/extensions/dm-lens/dist/clients/dispatch/runners/tflint.js +104 -0
  187. package/extensions/dm-lens/dist/clients/dispatch/runners/tree-sitter.js +534 -0
  188. package/extensions/dm-lens/dist/clients/dispatch/runners/trivy-config.js +155 -0
  189. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/availability-policy.js +313 -0
  190. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/candidate-probe.js +66 -0
  191. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +62 -0
  192. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/lazy-installer.js +130 -0
  193. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +1143 -0
  194. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/spawn-outcome.js +40 -0
  195. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/tool-failure.js +110 -0
  196. package/extensions/dm-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +88 -0
  197. package/extensions/dm-lens/dist/clients/dispatch/runners/utils.js +8 -0
  198. package/extensions/dm-lens/dist/clients/dispatch/runners/vale.js +92 -0
  199. package/extensions/dm-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +170 -0
  200. package/extensions/dm-lens/dist/clients/dispatch/runners/yamllint.js +83 -0
  201. package/extensions/dm-lens/dist/clients/dispatch/runners/zig-check.js +72 -0
  202. package/extensions/dm-lens/dist/clients/dispatch/suppress-writer.js +57 -0
  203. package/extensions/dm-lens/dist/clients/dispatch/tool-profile.js +30 -0
  204. package/extensions/dm-lens/dist/clients/dispatch/types.js +72 -0
  205. package/extensions/dm-lens/dist/clients/dispatch/utils/format-utils.js +58 -0
  206. package/extensions/dm-lens/dist/clients/dispatch/utils/lsp-diagnostics.js +32 -0
  207. package/extensions/dm-lens/dist/clients/disposition-logger.js +19 -0
  208. package/extensions/dm-lens/dist/clients/disposition-publish.js +88 -0
  209. package/extensions/dm-lens/dist/clients/durable-store.js +77 -0
  210. package/extensions/dm-lens/dist/clients/effective-config.js +170 -0
  211. package/extensions/dm-lens/dist/clients/env-utils.js +26 -0
  212. package/extensions/dm-lens/dist/clients/ephemeral-root.js +55 -0
  213. package/extensions/dm-lens/dist/clients/error-class.js +3 -0
  214. package/extensions/dm-lens/dist/clients/eval-timestamp.js +2 -0
  215. package/extensions/dm-lens/dist/clients/event-loop-hold.js +119 -0
  216. package/extensions/dm-lens/dist/clients/event-loop-monitor.js +84 -0
  217. package/extensions/dm-lens/dist/clients/extension-log.js +230 -0
  218. package/extensions/dm-lens/dist/clients/extension-mode.js +20 -0
  219. package/extensions/dm-lens/dist/clients/feature-hints.js +88 -0
  220. package/extensions/dm-lens/dist/clients/file-kinds.js +317 -0
  221. package/extensions/dm-lens/dist/clients/file-mutation-queue.js +91 -0
  222. package/extensions/dm-lens/dist/clients/file-role.js +50 -0
  223. package/extensions/dm-lens/dist/clients/file-time.js +112 -0
  224. package/extensions/dm-lens/dist/clients/file-utils.js +840 -0
  225. package/extensions/dm-lens/dist/clients/finding-delivery-gate.js +146 -0
  226. package/extensions/dm-lens/dist/clients/finding-identity.js +79 -0
  227. package/extensions/dm-lens/dist/clients/fix-run-restore.js +423 -0
  228. package/extensions/dm-lens/dist/clients/fix-worklog.js +75 -0
  229. package/extensions/dm-lens/dist/clients/format-events-publish.js +310 -0
  230. package/extensions/dm-lens/dist/clients/format-service.js +177 -0
  231. package/extensions/dm-lens/dist/clients/formatters-lazy.js +8 -0
  232. package/extensions/dm-lens/dist/clients/formatters.js +1367 -0
  233. package/extensions/dm-lens/dist/clients/freshness-cadence.js +1 -0
  234. package/extensions/dm-lens/dist/clients/freshness.js +8 -0
  235. package/extensions/dm-lens/dist/clients/generated-artifacts.js +209 -0
  236. package/extensions/dm-lens/dist/clients/generation-guard.js +147 -0
  237. package/extensions/dm-lens/dist/clients/generation-lock.js +181 -0
  238. package/extensions/dm-lens/dist/clients/git-guard.js +1208 -0
  239. package/extensions/dm-lens/dist/clients/git-tracked-ignore.js +120 -0
  240. package/extensions/dm-lens/dist/clients/gitleaks-client.js +290 -0
  241. package/extensions/dm-lens/dist/clients/go-client.js +47 -0
  242. package/extensions/dm-lens/dist/clients/govulncheck-client.js +416 -0
  243. package/extensions/dm-lens/dist/clients/gradle-ktfmt-style.js +177 -0
  244. package/extensions/dm-lens/dist/clients/grammar-source.js +263 -0
  245. package/extensions/dm-lens/dist/clients/grammar-wasm-imports.js +48 -0
  246. package/extensions/dm-lens/dist/clients/gzip-stage-write.js +174 -0
  247. package/extensions/dm-lens/dist/clients/hard-failure-summary.js +28 -0
  248. package/extensions/dm-lens/dist/clients/hashline-anchor.js +222 -0
  249. package/extensions/dm-lens/dist/clients/hook-budgets.js +17 -0
  250. package/extensions/dm-lens/dist/clients/host-edit-normalize.js +87 -0
  251. package/extensions/dm-lens/dist/clients/host-ports.js +35 -0
  252. package/extensions/dm-lens/dist/clients/indent-retarget.js +102 -0
  253. package/extensions/dm-lens/dist/clients/inline-blocker-dispositions.js +103 -0
  254. package/extensions/dm-lens/dist/clients/inline-blocker-fields.js +8 -0
  255. package/extensions/dm-lens/dist/clients/install-diagnostics.js +135 -0
  256. package/extensions/dm-lens/dist/clients/installer/index.js +3928 -0
  257. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh-session.js +17 -0
  258. package/extensions/dm-lens/dist/clients/installer/managed-tool-refresh.js +721 -0
  259. package/extensions/dm-lens/dist/clients/instance-reaper-state.js +3 -0
  260. package/extensions/dm-lens/dist/clients/instance-reaper.js +693 -0
  261. package/extensions/dm-lens/dist/clients/instance-registry-lock.js +166 -0
  262. package/extensions/dm-lens/dist/clients/instance-registry-tail.js +17 -0
  263. package/extensions/dm-lens/dist/clients/instance-registry.js +607 -0
  264. package/extensions/dm-lens/dist/clients/io-bridge-contract.js +7 -0
  265. package/extensions/dm-lens/dist/clients/io-bridge.js +357 -0
  266. package/extensions/dm-lens/dist/clients/jscpd-client.js +311 -0
  267. package/extensions/dm-lens/dist/clients/json-cache-read.js +25 -0
  268. package/extensions/dm-lens/dist/clients/knip-client.js +534 -0
  269. package/extensions/dm-lens/dist/clients/knip-scan-roots.js +26 -0
  270. package/extensions/dm-lens/dist/clients/language-policy.js +244 -0
  271. package/extensions/dm-lens/dist/clients/language-profile.js +259 -0
  272. package/extensions/dm-lens/dist/clients/language-registry.js +468 -0
  273. package/extensions/dm-lens/dist/clients/latency-logger.js +210 -0
  274. package/extensions/dm-lens/dist/clients/lazy-import.js +14 -0
  275. package/extensions/dm-lens/dist/clients/ledger-bounds.js +21 -0
  276. package/extensions/dm-lens/dist/clients/lens-config.js +254 -0
  277. package/extensions/dm-lens/dist/clients/lens-engine.js +188 -0
  278. package/extensions/dm-lens/dist/clients/lens-events.js +105 -0
  279. package/extensions/dm-lens/dist/clients/lens-flag-registry.js +308 -0
  280. package/extensions/dm-lens/dist/clients/lens-map.js +980 -0
  281. package/extensions/dm-lens/dist/clients/line-alignment.js +200 -0
  282. package/extensions/dm-lens/dist/clients/live-bus-emitter.js +53 -0
  283. package/extensions/dm-lens/dist/clients/log-cleanup.js +138 -0
  284. package/extensions/dm-lens/dist/clients/lsp/aggregation.js +89 -0
  285. package/extensions/dm-lens/dist/clients/lsp/auxiliary-lifecycle.js +23 -0
  286. package/extensions/dm-lens/dist/clients/lsp/capabilities.js +94 -0
  287. package/extensions/dm-lens/dist/clients/lsp/cascade-tier.js +318 -0
  288. package/extensions/dm-lens/dist/clients/lsp/client-registry.js +877 -0
  289. package/extensions/dm-lens/dist/clients/lsp/client.js +3232 -0
  290. package/extensions/dm-lens/dist/clients/lsp/config.js +571 -0
  291. package/extensions/dm-lens/dist/clients/lsp/content-limits.js +21 -0
  292. package/extensions/dm-lens/dist/clients/lsp/content-scan.js +69 -0
  293. package/extensions/dm-lens/dist/clients/lsp/created-import-targets.js +134 -0
  294. package/extensions/dm-lens/dist/clients/lsp/diagnostic-binding.js +113 -0
  295. package/extensions/dm-lens/dist/clients/lsp/document-drift.js +372 -0
  296. package/extensions/dm-lens/dist/clients/lsp/edits.js +1060 -0
  297. package/extensions/dm-lens/dist/clients/lsp/environment-gap.js +186 -0
  298. package/extensions/dm-lens/dist/clients/lsp/file-server-match.js +26 -0
  299. package/extensions/dm-lens/dist/clients/lsp/grouping.js +38 -0
  300. package/extensions/dm-lens/dist/clients/lsp/implicit-scope.js +205 -0
  301. package/extensions/dm-lens/dist/clients/lsp/index.js +4292 -0
  302. package/extensions/dm-lens/dist/clients/lsp/inferred-project.js +140 -0
  303. package/extensions/dm-lens/dist/clients/lsp/jvm-runtime.js +200 -0
  304. package/extensions/dm-lens/dist/clients/lsp/language.js +26 -0
  305. package/extensions/dm-lens/dist/clients/lsp/launch.js +606 -0
  306. package/extensions/dm-lens/dist/clients/lsp/lombok.js +133 -0
  307. package/extensions/dm-lens/dist/clients/lsp/path-utils.js +1 -0
  308. package/extensions/dm-lens/dist/clients/lsp/pending-aux-coverage.js +120 -0
  309. package/extensions/dm-lens/dist/clients/lsp/position-encoding.js +21 -0
  310. package/extensions/dm-lens/dist/clients/lsp/resolved-config.js +183 -0
  311. package/extensions/dm-lens/dist/clients/lsp/ruby-drive-dirs.js +42 -0
  312. package/extensions/dm-lens/dist/clients/lsp/server-config-files.js +11 -0
  313. package/extensions/dm-lens/dist/clients/lsp/server-covers.js +8 -0
  314. package/extensions/dm-lens/dist/clients/lsp/server-traits.js +45 -0
  315. package/extensions/dm-lens/dist/clients/lsp/server.js +2827 -0
  316. package/extensions/dm-lens/dist/clients/lsp/service-singleton.js +59 -0
  317. package/extensions/dm-lens/dist/clients/lsp/session-roots.js +83 -0
  318. package/extensions/dm-lens/dist/clients/lsp/spawn-history.js +15 -0
  319. package/extensions/dm-lens/dist/clients/lsp/sync-kind.js +30 -0
  320. package/extensions/dm-lens/dist/clients/lsp/tsserver-sync.js +156 -0
  321. package/extensions/dm-lens/dist/clients/lsp/wait-policy/capability-snapshot.js +1 -0
  322. package/extensions/dm-lens/dist/clients/lsp/wait-policy/classification.js +37 -0
  323. package/extensions/dm-lens/dist/clients/lsp/wait-policy/index.js +3 -0
  324. package/extensions/dm-lens/dist/clients/lsp/wait-policy/strategies.js +276 -0
  325. package/extensions/dm-lens/dist/clients/lsp/watch-queue.js +61 -0
  326. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-cache.js +395 -0
  327. package/extensions/dm-lens/dist/clients/lsp/workspace-diagnostics-session.js +42 -0
  328. package/extensions/dm-lens/dist/clients/lsp/workspace-sweep-hold.js +93 -0
  329. package/extensions/dm-lens/dist/clients/lsp-budget.js +87 -0
  330. package/extensions/dm-lens/dist/clients/lsp-document-symbols.js +93 -0
  331. package/extensions/dm-lens/dist/clients/lsp-lazy.js +8 -0
  332. package/extensions/dm-lens/dist/clients/lsp-mutation.js +309 -0
  333. package/extensions/dm-lens/dist/clients/lsp-status.js +35 -0
  334. package/extensions/dm-lens/dist/clients/map-with-concurrency.js +20 -0
  335. package/extensions/dm-lens/dist/clients/mcp/analyze.js +302 -0
  336. package/extensions/dm-lens/dist/clients/mcp/host-shim.js +14 -0
  337. package/extensions/dm-lens/dist/clients/mcp/ipc.js +344 -0
  338. package/extensions/dm-lens/dist/clients/mcp/review.js +137 -0
  339. package/extensions/dm-lens/dist/clients/mcp/session.js +300 -0
  340. package/extensions/dm-lens/dist/clients/memory-sampler.js +163 -0
  341. package/extensions/dm-lens/dist/clients/message-end-attribution.js +18 -0
  342. package/extensions/dm-lens/dist/clients/metrics-client.js +80 -0
  343. package/extensions/dm-lens/dist/clients/metrics-history.js +242 -0
  344. package/extensions/dm-lens/dist/clients/middle-man-analysis.js +161 -0
  345. package/extensions/dm-lens/dist/clients/model-provider.js +31 -0
  346. package/extensions/dm-lens/dist/clients/module-report-lsp.js +140 -0
  347. package/extensions/dm-lens/dist/clients/module-report.js +1648 -0
  348. package/extensions/dm-lens/dist/clients/mutating-tool.js +388 -0
  349. package/extensions/dm-lens/dist/clients/mutation-attribution.js +173 -0
  350. package/extensions/dm-lens/dist/clients/mutation-bridge.js +231 -0
  351. package/extensions/dm-lens/dist/clients/ndjson-logger.js +504 -0
  352. package/extensions/dm-lens/dist/clients/observed-mutation-sources.js +43 -0
  353. package/extensions/dm-lens/dist/clients/observed-mutation.js +735 -0
  354. package/extensions/dm-lens/dist/clients/oldtext-autopatch.js +100 -0
  355. package/extensions/dm-lens/dist/clients/opaque-mutation-scan.js +541 -0
  356. package/extensions/dm-lens/dist/clients/opengrep-client.js +224 -0
  357. package/extensions/dm-lens/dist/clients/opengrep-config.js +57 -0
  358. package/extensions/dm-lens/dist/clients/opengrep-rule-pack.js +19 -0
  359. package/extensions/dm-lens/dist/clients/out-of-band-changes.js +329 -0
  360. package/extensions/dm-lens/dist/clients/package-manager.js +332 -0
  361. package/extensions/dm-lens/dist/clients/package-root.js +21 -0
  362. package/extensions/dm-lens/dist/clients/partial-edit-apply.js +341 -0
  363. package/extensions/dm-lens/dist/clients/path-attribution-telemetry.js +31 -0
  364. package/extensions/dm-lens/dist/clients/path-birth.js +58 -0
  365. package/extensions/dm-lens/dist/clients/path-keyed-map.js +57 -0
  366. package/extensions/dm-lens/dist/clients/path-utils.js +654 -0
  367. package/extensions/dm-lens/dist/clients/performance-report.js +291 -0
  368. package/extensions/dm-lens/dist/clients/persist-debounce.js +37 -0
  369. package/extensions/dm-lens/dist/clients/persist-worker-stats.js +16 -0
  370. package/extensions/dm-lens/dist/clients/persistent-reverify.js +167 -0
  371. package/extensions/dm-lens/dist/clients/php-cs-fixer-config.js +15 -0
  372. package/extensions/dm-lens/dist/clients/pipeline.js +1473 -0
  373. package/extensions/dm-lens/dist/clients/post-autofix-notice.js +19 -0
  374. package/extensions/dm-lens/dist/clients/print-mode.js +3 -0
  375. package/extensions/dm-lens/dist/clients/probe-home-state.js +73 -0
  376. package/extensions/dm-lens/dist/clients/process-bridge.js +48 -0
  377. package/extensions/dm-lens/dist/clients/process-singletons.js +69 -0
  378. package/extensions/dm-lens/dist/clients/process-snapshot.js +130 -0
  379. package/extensions/dm-lens/dist/clients/project-changes.js +180 -0
  380. package/extensions/dm-lens/dist/clients/project-conventions.js +152 -0
  381. package/extensions/dm-lens/dist/clients/project-diagnostics/cache.js +91 -0
  382. package/extensions/dm-lens/dist/clients/project-diagnostics/extractors.js +53 -0
  383. package/extensions/dm-lens/dist/clients/project-diagnostics/fresh-fetch.js +413 -0
  384. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/call-graph-impact.js +64 -0
  385. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/dead-code.js +38 -0
  386. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/gitleaks.js +21 -0
  387. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/govulncheck.js +23 -0
  388. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +28 -0
  389. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +45 -0
  390. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +34 -0
  391. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +32 -0
  392. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +79 -0
  393. package/extensions/dm-lens/dist/clients/project-diagnostics/runner-adapters/trivy.js +41 -0
  394. package/extensions/dm-lens/dist/clients/project-diagnostics/scanner.js +351 -0
  395. package/extensions/dm-lens/dist/clients/project-diagnostics/types.js +1 -0
  396. package/extensions/dm-lens/dist/clients/project-lens-config.js +462 -0
  397. package/extensions/dm-lens/dist/clients/project-report.js +527 -0
  398. package/extensions/dm-lens/dist/clients/project-root-markers.js +8 -0
  399. package/extensions/dm-lens/dist/clients/project-scale.js +60 -0
  400. package/extensions/dm-lens/dist/clients/project-scan-policy.js +4 -0
  401. package/extensions/dm-lens/dist/clients/project-snapshot-fingerprint.js +44 -0
  402. package/extensions/dm-lens/dist/clients/project-snapshot-persist-worker.js +31 -0
  403. package/extensions/dm-lens/dist/clients/project-snapshot.js +1355 -0
  404. package/extensions/dm-lens/dist/clients/project-trust.js +104 -0
  405. package/extensions/dm-lens/dist/clients/python-environment.js +388 -0
  406. package/extensions/dm-lens/dist/clients/python-provenance.js +551 -0
  407. package/extensions/dm-lens/dist/clients/quiet-window-config.js +16 -0
  408. package/extensions/dm-lens/dist/clients/quiet-window.js +129 -0
  409. package/extensions/dm-lens/dist/clients/read-bridge.js +53 -0
  410. package/extensions/dm-lens/dist/clients/read-expansion.js +218 -0
  411. package/extensions/dm-lens/dist/clients/read-guard-branch.js +126 -0
  412. package/extensions/dm-lens/dist/clients/read-guard-logger.js +186 -0
  413. package/extensions/dm-lens/dist/clients/read-guard-tool-lines.js +1044 -0
  414. package/extensions/dm-lens/dist/clients/read-guard.js +1517 -0
  415. package/extensions/dm-lens/dist/clients/recent-touches.js +126 -0
  416. package/extensions/dm-lens/dist/clients/redact/secrets.js +386 -0
  417. package/extensions/dm-lens/dist/clients/resource-sampler.js +344 -0
  418. package/extensions/dm-lens/dist/clients/reverse-deps.js +227 -0
  419. package/extensions/dm-lens/dist/clients/review-graph/builder.js +3780 -0
  420. package/extensions/dm-lens/dist/clients/review-graph/format.js +30 -0
  421. package/extensions/dm-lens/dist/clients/review-graph/git-identity.js +173 -0
  422. package/extensions/dm-lens/dist/clients/review-graph/import-resolvers.js +332 -0
  423. package/extensions/dm-lens/dist/clients/review-graph/persist-worker.js +8 -0
  424. package/extensions/dm-lens/dist/clients/review-graph/query.js +195 -0
  425. package/extensions/dm-lens/dist/clients/review-graph/revision-drift.js +3 -0
  426. package/extensions/dm-lens/dist/clients/review-graph/service.js +60 -0
  427. package/extensions/dm-lens/dist/clients/review-graph/shared-extraction-ir.js +54 -0
  428. package/extensions/dm-lens/dist/clients/review-graph/symbol-id.js +29 -0
  429. package/extensions/dm-lens/dist/clients/review-graph/tsconfig-paths.js +286 -0
  430. package/extensions/dm-lens/dist/clients/review-graph/types.js +1 -0
  431. package/extensions/dm-lens/dist/clients/review-graph/workspace-modules.js +374 -0
  432. package/extensions/dm-lens/dist/clients/review-graph-logger.js +51 -0
  433. package/extensions/dm-lens/dist/clients/ruff-client.js +107 -0
  434. package/extensions/dm-lens/dist/clients/rules-scanner.js +70 -0
  435. package/extensions/dm-lens/dist/clients/run-duration.js +9 -0
  436. package/extensions/dm-lens/dist/clients/runtime-agent-end.js +831 -0
  437. package/extensions/dm-lens/dist/clients/runtime-config.js +39 -0
  438. package/extensions/dm-lens/dist/clients/runtime-context.js +155 -0
  439. package/extensions/dm-lens/dist/clients/runtime-coordinator.js +1254 -0
  440. package/extensions/dm-lens/dist/clients/runtime-session.js +1806 -0
  441. package/extensions/dm-lens/dist/clients/runtime-tool-call.js +1026 -0
  442. package/extensions/dm-lens/dist/clients/runtime-tool-result.js +2068 -0
  443. package/extensions/dm-lens/dist/clients/runtime-turn.js +3198 -0
  444. package/extensions/dm-lens/dist/clients/rust-client.js +46 -0
  445. package/extensions/dm-lens/dist/clients/safe-spawn.js +1402 -0
  446. package/extensions/dm-lens/dist/clients/sanitize.js +5 -0
  447. package/extensions/dm-lens/dist/clients/scan-utils.js +7 -0
  448. package/extensions/dm-lens/dist/clients/scanner-temp-root.js +8 -0
  449. package/extensions/dm-lens/dist/clients/scratch-tree-policy.js +63 -0
  450. package/extensions/dm-lens/dist/clients/search-read-registration.js +76 -0
  451. package/extensions/dm-lens/dist/clients/secret-findings.js +69 -0
  452. package/extensions/dm-lens/dist/clients/security-scan-client.js +208 -0
  453. package/extensions/dm-lens/dist/clients/session-event-guard.js +111 -0
  454. package/extensions/dm-lens/dist/clients/session-lifecycle.js +309 -0
  455. package/extensions/dm-lens/dist/clients/session-repository.js +113 -0
  456. package/extensions/dm-lens/dist/clients/session-scope.js +451 -0
  457. package/extensions/dm-lens/dist/clients/session-start-observability.js +59 -0
  458. package/extensions/dm-lens/dist/clients/session-state-store.js +71 -0
  459. package/extensions/dm-lens/dist/clients/session-summary.js +8 -0
  460. package/extensions/dm-lens/dist/clients/sessionstart-logger.js +22 -0
  461. package/extensions/dm-lens/dist/clients/sg-runner.js +642 -0
  462. package/extensions/dm-lens/dist/clients/sgconfig.js +299 -0
  463. package/extensions/dm-lens/dist/clients/shared-checkout-guard.js +177 -0
  464. package/extensions/dm-lens/dist/clients/single-flight.js +53 -0
  465. package/extensions/dm-lens/dist/clients/situational-tool-telemetry.js +85 -0
  466. package/extensions/dm-lens/dist/clients/skills-resolver.js +38 -0
  467. package/extensions/dm-lens/dist/clients/slow-fs.js +77 -0
  468. package/extensions/dm-lens/dist/clients/smells-rollup.js +118 -0
  469. package/extensions/dm-lens/dist/clients/source-filter.js +323 -0
  470. package/extensions/dm-lens/dist/clients/source-walker.js +114 -0
  471. package/extensions/dm-lens/dist/clients/spawn-output-cap.js +35 -0
  472. package/extensions/dm-lens/dist/clients/spawn-timeout-cooldown.js +51 -0
  473. package/extensions/dm-lens/dist/clients/stale-marker.js +1 -0
  474. package/extensions/dm-lens/dist/clients/startup-scan.js +221 -0
  475. package/extensions/dm-lens/dist/clients/startup-timing.js +67 -0
  476. package/extensions/dm-lens/dist/clients/string-utils.js +6 -0
  477. package/extensions/dm-lens/dist/clients/subagent-mode.js +40 -0
  478. package/extensions/dm-lens/dist/clients/symbol-containment.js +16 -0
  479. package/extensions/dm-lens/dist/clients/symbol-types.js +1 -0
  480. package/extensions/dm-lens/dist/clients/test-runner-client.js +1686 -0
  481. package/extensions/dm-lens/dist/clients/test-runner-delivery.js +285 -0
  482. package/extensions/dm-lens/dist/clients/test-target-roots.js +17 -0
  483. package/extensions/dm-lens/dist/clients/todo-scanner.js +164 -0
  484. package/extensions/dm-lens/dist/clients/tool-agreement.js +640 -0
  485. package/extensions/dm-lens/dist/clients/tool-config.js +239 -0
  486. package/extensions/dm-lens/dist/clients/tool-cwd.js +236 -0
  487. package/extensions/dm-lens/dist/clients/tool-definition.js +22 -0
  488. package/extensions/dm-lens/dist/clients/tool-event.js +24 -0
  489. package/extensions/dm-lens/dist/clients/tool-policy.js +2386 -0
  490. package/extensions/dm-lens/dist/clients/tool-probe.js +13 -0
  491. package/extensions/dm-lens/dist/clients/tool-render.js +79 -0
  492. package/extensions/dm-lens/dist/clients/tool-set-policy.js +106 -0
  493. package/extensions/dm-lens/dist/clients/tree-sitter-cache.js +206 -0
  494. package/extensions/dm-lens/dist/clients/tree-sitter-client.js +3101 -0
  495. package/extensions/dm-lens/dist/clients/tree-sitter-logger.js +77 -0
  496. package/extensions/dm-lens/dist/clients/tree-sitter-navigator.js +198 -0
  497. package/extensions/dm-lens/dist/clients/tree-sitter-query-loader.js +401 -0
  498. package/extensions/dm-lens/dist/clients/tree-sitter-shared.js +87 -0
  499. package/extensions/dm-lens/dist/clients/tree-sitter-symbol-extractor.js +984 -0
  500. package/extensions/dm-lens/dist/clients/trivy-client.js +335 -0
  501. package/extensions/dm-lens/dist/clients/tui-fit.js +26 -0
  502. package/extensions/dm-lens/dist/clients/turn-context.js +48 -0
  503. package/extensions/dm-lens/dist/clients/turn-end/delivery-holds.js +59 -0
  504. package/extensions/dm-lens/dist/clients/turn-end/lane.js +1 -0
  505. package/extensions/dm-lens/dist/clients/turn-end/lanes/govulncheck.js +54 -0
  506. package/extensions/dm-lens/dist/clients/turn-end/lanes/secrets.js +131 -0
  507. package/extensions/dm-lens/dist/clients/turn-summary-render.js +56 -0
  508. package/extensions/dm-lens/dist/clients/turn-summary.js +84 -0
  509. package/extensions/dm-lens/dist/clients/typos-config.js +9 -0
  510. package/extensions/dm-lens/dist/clients/user-notify.js +15 -0
  511. package/extensions/dm-lens/dist/clients/vanished-instance-marker.js +18 -0
  512. package/extensions/dm-lens/dist/clients/warm-attach.js +232 -0
  513. package/extensions/dm-lens/dist/clients/widget-state.js +1014 -0
  514. package/extensions/dm-lens/dist/clients/word-index-logger.js +24 -0
  515. package/extensions/dm-lens/dist/clients/word-index-store.js +222 -0
  516. package/extensions/dm-lens/dist/clients/word-index.js +1503 -0
  517. package/extensions/dm-lens/dist/clients/workspace-topology.js +274 -0
  518. package/extensions/dm-lens/dist/clients/write-ordering-guard.js +28 -0
  519. package/extensions/dm-lens/dist/clients/zizmor-config.js +160 -0
  520. package/extensions/dm-lens/dist/i18n.js +67 -0
  521. package/extensions/dm-lens/dist/index.js +2144 -0
  522. package/extensions/dm-lens/dist/mcp/analyze-cli.js +205 -0
  523. package/extensions/dm-lens/dist/mcp/build-staleness.js +55 -0
  524. package/extensions/dm-lens/dist/mcp/cli.js +96 -0
  525. package/extensions/dm-lens/dist/mcp/server.js +1241 -0
  526. package/extensions/dm-lens/dist/mcp/tool-arguments.js +134 -0
  527. package/extensions/dm-lens/dist/mcp/worker.js +41 -0
  528. package/extensions/dm-lens/dist/scripts/lib/process-scan.mjs +375 -0
  529. package/extensions/dm-lens/dist/scripts/lib/skills-predicate.mjs +53 -0
  530. package/extensions/dm-lens/dist/scripts/lib/web-tree-sitter-dir.mjs +51 -0
  531. package/extensions/dm-lens/dist/tools/activate-tools.js +63 -0
  532. package/extensions/dm-lens/dist/tools/ast-grep-outline.js +128 -0
  533. package/extensions/dm-lens/dist/tools/ast-grep-replace.js +234 -0
  534. package/extensions/dm-lens/dist/tools/ast-grep-search.js +690 -0
  535. package/extensions/dm-lens/dist/tools/effective-config.js +59 -0
  536. package/extensions/dm-lens/dist/tools/lens-diagnostic-mark.js +251 -0
  537. package/extensions/dm-lens/dist/tools/lens-diagnostics.js +1693 -0
  538. package/extensions/dm-lens/dist/tools/lsp-diagnostics.js +1397 -0
  539. package/extensions/dm-lens/dist/tools/lsp-navigation.js +1301 -0
  540. package/extensions/dm-lens/dist/tools/lsp-structured-output.js +277 -0
  541. package/extensions/dm-lens/dist/tools/module-report.js +333 -0
  542. package/extensions/dm-lens/dist/tools/project-report.js +72 -0
  543. package/extensions/dm-lens/dist/tools/render-compact.js +272 -0
  544. package/extensions/dm-lens/dist/tools/scan-progress.js +31 -0
  545. package/extensions/dm-lens/dist/tools/shared.js +46 -0
  546. package/extensions/dm-lens/dist/tools/symbol-search.js +133 -0
  547. package/extensions/dm-mcp-adapter/dist/abort.js +35 -0
  548. package/extensions/dm-mcp-adapter/dist/agent-dir.js +45 -0
  549. package/extensions/dm-mcp-adapter/dist/agent-plugin-loader.js +392 -0
  550. package/extensions/dm-mcp-adapter/dist/agent-plugin-provenance.js +26 -0
  551. package/extensions/dm-mcp-adapter/dist/bearer-command-resolver.js +184 -0
  552. package/extensions/dm-mcp-adapter/dist/claude-plugin-loader.js +350 -0
  553. package/extensions/dm-mcp-adapter/dist/config.js +1984 -0
  554. package/extensions/dm-mcp-adapter/dist/consent-manager.js +84 -0
  555. package/extensions/dm-mcp-adapter/dist/elicitation-handler.js +374 -0
  556. package/extensions/dm-mcp-adapter/dist/errors.js +225 -0
  557. package/extensions/dm-mcp-adapter/dist/extraction-settings.js +43 -0
  558. package/extensions/dm-mcp-adapter/dist/http-ca.js +75 -0
  559. package/extensions/dm-mcp-adapter/dist/jev-client.js +359 -0
  560. package/extensions/dm-mcp-adapter/dist/jev-contracts.js +1 -0
  561. package/extensions/dm-mcp-adapter/dist/jev-key-store.js +189 -0
  562. package/extensions/dm-mcp-adapter/dist/json-schema-validator.js +70 -0
  563. package/extensions/dm-mcp-adapter/dist/lifecycle.js +387 -0
  564. package/extensions/dm-mcp-adapter/dist/logger.js +115 -0
  565. package/extensions/dm-mcp-adapter/dist/mcp-auth-fetch.js +86 -0
  566. package/extensions/dm-mcp-adapter/dist/mcp-auth-flow.js +956 -0
  567. package/extensions/dm-mcp-adapter/dist/mcp-auth.js +998 -0
  568. package/extensions/dm-mcp-adapter/dist/mcp-bearer-store.js +182 -0
  569. package/extensions/dm-mcp-adapter/dist/mcp-callback-server.js +380 -0
  570. package/extensions/dm-mcp-adapter/dist/mcp-oauth-provider.js +525 -0
  571. package/extensions/dm-mcp-adapter/dist/mcp-probe.js +151 -0
  572. package/extensions/dm-mcp-adapter/dist/mcp-tasks.js +339 -0
  573. package/extensions/dm-mcp-adapter/dist/mcp-trace.js +220 -0
  574. package/extensions/dm-mcp-adapter/dist/metadata-cache.js +411 -0
  575. package/extensions/dm-mcp-adapter/dist/npx-resolver.js +465 -0
  576. package/extensions/dm-mcp-adapter/dist/output-shape.js +312 -0
  577. package/extensions/dm-mcp-adapter/dist/package-mcp-loader.js +144 -0
  578. package/extensions/dm-mcp-adapter/dist/project-server-trust.js +274 -0
  579. package/extensions/dm-mcp-adapter/dist/request-headers-command.js +310 -0
  580. package/extensions/dm-mcp-adapter/dist/resource-tools.js +7 -0
  581. package/extensions/dm-mcp-adapter/dist/runtime-owner.js +95 -0
  582. package/extensions/dm-mcp-adapter/dist/sampling-handler.js +219 -0
  583. package/extensions/dm-mcp-adapter/dist/script-tools.js +72 -0
  584. package/extensions/dm-mcp-adapter/dist/secure-keyring.js +191 -0
  585. package/extensions/dm-mcp-adapter/dist/semantic-settings.js +51 -0
  586. package/extensions/dm-mcp-adapter/dist/server-log.js +19 -0
  587. package/extensions/dm-mcp-adapter/dist/server-manager.js +1635 -0
  588. package/extensions/dm-mcp-adapter/dist/session-approvals.js +127 -0
  589. package/extensions/dm-mcp-adapter/dist/session-recovery.js +83 -0
  590. package/extensions/dm-mcp-adapter/dist/state.js +1 -0
  591. package/extensions/dm-mcp-adapter/dist/task-entries.js +60 -0
  592. package/extensions/dm-mcp-adapter/dist/task-jobs.js +259 -0
  593. package/extensions/dm-mcp-adapter/dist/ts-shape.js +157 -0
  594. package/extensions/dm-mcp-adapter/dist/types.js +293 -0
  595. package/extensions/dm-mcp-adapter/dist/ui-app-bridge-helpers.js +36 -0
  596. package/extensions/dm-mcp-adapter/dist/ui-resource-handler.js +204 -0
  597. package/extensions/dm-mcp-adapter/dist/ui-stream-types.js +58 -0
  598. package/extensions/dm-mcp-adapter/dist/ui-tool-visibility.js +26 -0
  599. package/extensions/dm-mcp-adapter/dist/unix-socket-transport.js +83 -0
  600. package/extensions/dm-mcp-adapter/dist/utils.js +444 -0
  601. package/extensions/dm-mcp-adapter/mcp-keyring-helper.cjs +1 -1
  602. package/extensions/dm-ponytail/hooks/ponytail-activate.js +1 -1
  603. package/extensions/dm-ponytail/hooks/ponytail-instructions.js +1 -1
  604. package/extensions/dm-ponytail/hooks/ponytail-mode-tracker.js +1 -1
  605. package/package.json +1 -1
@@ -0,0 +1,1301 @@
1
+ import * as nodeFs from "node:fs";
2
+ import * as path from "node:path";
3
+ import { fileURLToPath, pathToFileURL } from "node:url";
4
+ import { Type } from "../clients/deps/typebox.js";
5
+ import { logLatency } from "../clients/latency-logger.js";
6
+ import { newLspMutationCorrelationId, recordLspMutationOutcome } from "../clients/lsp-mutation.js";
7
+ import { resolveHostToolPath, uriToPath } from "../clients/path-utils.js";
8
+ import { escapeRegExp } from "../clients/string-utils.js";
9
+ import { isRecordableProjectPath } from "../clients/file-utils.js";
10
+ import { compactRenderResult } from "./render-compact.js";
11
+ import { applyWorkspaceEdit, captureRenameExpectedContent, summarizeWorkspaceEdit } from "../clients/lsp/edits.js";
12
+ import { configDisabledAuxiliaryLspServerIds } from "../clients/dispatch/auxiliary-lsp.js";
13
+ import { readFileContent } from "../clients/dispatch/runners/utils.js";
14
+ import { PRIMARY_UNAVAILABLE_CAUSE, primaryUnavailableCause } from "../clients/lsp/diagnostic-binding.js";
15
+ import { getLSPService } from "../clients/lsp/capabilities.js";
16
+ import { buildLspNavigationEnvelope } from "./lsp-structured-output.js";
17
+ import { applyProbeFindingPolicy, describePrimaryUnavailable, mergeWithheld, withheldCompileNote } from "./lsp-diagnostics.js";
18
+ import { dispositionSuppressedLine, formatCacheAgeLabel } from "../clients/finding-delivery-gate.js";
19
+ import { disabledPrimaries } from "../clients/lsp/session-roots.js";
20
+ import { SYMBOL_KIND_NAMES } from "../clients/lsp-document-symbols.js";
21
+ import { detectPythonTargetVersion, isJediCompileVerdict, PYTHON_DECLARATION_CONCURRENCY } from "../clients/python-environment.js";
22
+ import { mapWithConcurrency } from "../clients/map-with-concurrency.js";
23
+ const VALID_OPERATIONS = [
24
+ "definition",
25
+ "typeDefinition",
26
+ "declaration",
27
+ "references",
28
+ "hover",
29
+ "signatureHelp",
30
+ "documentSymbol",
31
+ "findSymbol",
32
+ "workspaceSymbol",
33
+ "codeAction",
34
+ "rename",
35
+ "rename_file",
36
+ "implementation",
37
+ "prepareCallHierarchy",
38
+ "incomingCalls",
39
+ "outgoingCalls",
40
+ "executeCommand",
41
+ "workspaceDiagnostics",
42
+ "capabilities"
43
+ ];
44
+ const NAVIGABLE_SYMBOL_KINDS = new Set([
45
+ 5,
46
+ 6,
47
+ 8,
48
+ 11,
49
+ 12,
50
+ 13,
51
+ 22,
52
+ 23
53
+ ]);
54
+ function normalizeOperation(value) {
55
+ if (typeof value !== "string")
56
+ return "";
57
+ return value.trim().replace(/^["']+|["']+$/g, "");
58
+ }
59
+ function isValidOperation(value) {
60
+ return VALID_OPERATIONS.includes(value);
61
+ }
62
+ function rangeProblem(value) {
63
+ if (!value || typeof value !== "object")
64
+ return " must be a range object";
65
+ for (const end of ["start", "end"]) {
66
+ const position = value[end];
67
+ if (!position || typeof position !== "object")
68
+ return `.${end} must be a position object`;
69
+ for (const axis of ["line", "character"]) {
70
+ if (typeof position[axis] !== "number")
71
+ return `.${end}.${axis} must be a number`;
72
+ }
73
+ }
74
+ return;
75
+ }
76
+ function checkCallHierarchyItem(value) {
77
+ if (value === undefined || value === null)
78
+ return { problem: "callHierarchyItem parameter required" };
79
+ if (typeof value !== "object" || Array.isArray(value))
80
+ return {
81
+ problem: "callHierarchyItem must be the object prepareCallHierarchy returned"
82
+ };
83
+ const item = value;
84
+ for (const [field, type] of [
85
+ ["name", "string"],
86
+ ["kind", "number"],
87
+ ["uri", "string"]
88
+ ]) {
89
+ if (typeof item[field] !== type)
90
+ return { problem: `callHierarchyItem.${field} must be a ${type}` };
91
+ }
92
+ for (const field of ["range", "selectionRange"]) {
93
+ const problem = rangeProblem(item[field]);
94
+ if (problem)
95
+ return { problem: `callHierarchyItem.${field}${problem}` };
96
+ }
97
+ return { item: value };
98
+ }
99
+ function operationSupportStatus(operation, support) {
100
+ if (!support)
101
+ return null;
102
+ if (operation === "definition")
103
+ return support.definition;
104
+ if (operation === "typeDefinition")
105
+ return support.typeDefinition;
106
+ if (operation === "declaration")
107
+ return support.declaration;
108
+ if (operation === "references")
109
+ return support.references;
110
+ if (operation === "hover")
111
+ return support.hover;
112
+ if (operation === "signatureHelp")
113
+ return support.signatureHelp;
114
+ if (operation === "documentSymbol" || operation === "findSymbol")
115
+ return support.documentSymbol;
116
+ if (operation === "workspaceSymbol")
117
+ return support.workspaceSymbol;
118
+ if (operation === "codeAction")
119
+ return support.codeAction;
120
+ if (operation === "rename")
121
+ return support.rename;
122
+ if (operation === "implementation")
123
+ return support.implementation;
124
+ if (operation === "prepareCallHierarchy" || operation === "incomingCalls" || operation === "outgoingCalls")
125
+ return support.callHierarchy;
126
+ return null;
127
+ }
128
+ function noServerAnsweredText(filePath) {
129
+ const { disabledServerIds, fallbackServerIds } = disabledPrimaries(filePath);
130
+ const cause = primaryUnavailableCause([...fallbackServerIds, ...disabledServerIds], disabledServerIds, fallbackServerIds);
131
+ const who = disabledServerIds.length > 0 ? `Primary LSP (${disabledServerIds.join(", ")}) did not answer` : "no language server answered";
132
+ return `No LSP server available for ${path.basename(filePath)}: ${who} (${PRIMARY_UNAVAILABLE_CAUSE[cause]}).`;
133
+ }
134
+ function emptyReasonForOperation(operation) {
135
+ if (operation === "signatureHelp")
136
+ return "position-sensitive-or-no-signature";
137
+ if (operation === "codeAction")
138
+ return "no-applicable-actions";
139
+ if (operation === "rename")
140
+ return "no-rename-edits-or-symbol-not-renamable";
141
+ if (operation === "rename_file")
142
+ return "no-file-rename-result";
143
+ if (operation === "findSymbol")
144
+ return "no-matching-symbols";
145
+ if (operation === "workspaceSymbol")
146
+ return "no-matching-symbols-or-server-index-unavailable";
147
+ if (operation === "capabilities")
148
+ return "no-active-lsp-servers";
149
+ if (operation === "executeCommand")
150
+ return "command-returned-no-result";
151
+ if (operation === "incomingCalls" || operation === "outgoingCalls")
152
+ return "no-call-hierarchy-results";
153
+ return "no-results";
154
+ }
155
+ function parseSymbolSelector(symbol) {
156
+ const trimmed = symbol.trim();
157
+ const match = /^([^#]*)(?:#(-?\d+))?$/.exec(trimmed);
158
+ const baseSymbol = (match?.[1] ?? trimmed).trim();
159
+ const rawOccurrence = match?.[2];
160
+ if (!rawOccurrence)
161
+ return { baseSymbol, occurrence: 1 };
162
+ const occurrence = Number.parseInt(rawOccurrence, 10);
163
+ if (!Number.isFinite(occurrence) || occurrence < 1) {
164
+ return {
165
+ baseSymbol,
166
+ occurrence: 1,
167
+ debug: `invalid occurrence selector #${rawOccurrence}; using #1`
168
+ };
169
+ }
170
+ return { baseSymbol, occurrence };
171
+ }
172
+ function findNthMatch(lineText, regex, occurrence) {
173
+ let seen = 0;
174
+ regex.lastIndex = 0;
175
+ let match;
176
+ while ((match = regex.exec(lineText)) !== null) {
177
+ seen += 1;
178
+ if (seen === occurrence)
179
+ return match;
180
+ if (match[0].length === 0)
181
+ regex.lastIndex += 1;
182
+ }
183
+ return null;
184
+ }
185
+ function firstNonWhitespaceCharacter(lineText) {
186
+ const match = /\S/.exec(lineText);
187
+ return (match?.index ?? 0) + 1;
188
+ }
189
+ function resolveSymbolColumn(content, line1, character, symbol) {
190
+ if (typeof character === "number" && character > 0) {
191
+ return { character, strategy: "explicit" };
192
+ }
193
+ const lineText = content.split(/\r?\n/)[line1 - 1] ?? "";
194
+ if (!symbol || symbol.trim().length === 0) {
195
+ return {
196
+ character: 1,
197
+ strategy: "fallback",
198
+ debug: "character omitted and no symbol supplied; using column 1"
199
+ };
200
+ }
201
+ const { baseSymbol, occurrence, debug } = parseSymbolSelector(symbol);
202
+ if (!baseSymbol) {
203
+ return {
204
+ character: firstNonWhitespaceCharacter(lineText),
205
+ requestedSymbol: symbol,
206
+ baseSymbol,
207
+ requestedOccurrence: occurrence,
208
+ usedOccurrence: 1,
209
+ strategy: "fallback",
210
+ debug: debug ?? "empty symbol selector; using first non-whitespace column"
211
+ };
212
+ }
213
+ const pattern = `\\b${escapeRegExp(baseSymbol)}\\b`;
214
+ const exactRegex = new RegExp(pattern, "g");
215
+ const exact = findNthMatch(lineText, exactRegex, occurrence);
216
+ if (exact) {
217
+ return {
218
+ character: exact.index + 1,
219
+ requestedSymbol: symbol,
220
+ baseSymbol,
221
+ requestedOccurrence: occurrence,
222
+ usedOccurrence: occurrence,
223
+ strategy: "word-boundary",
224
+ debug
225
+ };
226
+ }
227
+ const firstExact = findNthMatch(lineText, exactRegex, 1);
228
+ if (firstExact && occurrence !== 1) {
229
+ return {
230
+ character: firstExact.index + 1,
231
+ requestedSymbol: symbol,
232
+ baseSymbol,
233
+ requestedOccurrence: occurrence,
234
+ usedOccurrence: 1,
235
+ strategy: "word-boundary",
236
+ debug: `${debug ? `${debug}; ` : ""}occurrence #${occurrence} not found; using #1`
237
+ };
238
+ }
239
+ const insensitiveRegex = new RegExp(pattern, "gi");
240
+ const insensitive = findNthMatch(lineText, insensitiveRegex, occurrence);
241
+ if (insensitive) {
242
+ return {
243
+ character: insensitive.index + 1,
244
+ requestedSymbol: symbol,
245
+ baseSymbol,
246
+ requestedOccurrence: occurrence,
247
+ usedOccurrence: occurrence,
248
+ strategy: "case-insensitive",
249
+ debug: debug ?? "exact-case symbol not found; used case-insensitive match"
250
+ };
251
+ }
252
+ const firstInsensitive = findNthMatch(lineText, insensitiveRegex, 1);
253
+ if (firstInsensitive && occurrence !== 1) {
254
+ return {
255
+ character: firstInsensitive.index + 1,
256
+ requestedSymbol: symbol,
257
+ baseSymbol,
258
+ requestedOccurrence: occurrence,
259
+ usedOccurrence: 1,
260
+ strategy: "case-insensitive",
261
+ debug: `${debug ? `${debug}; ` : ""}occurrence #${occurrence} not found case-insensitively; using #1`
262
+ };
263
+ }
264
+ return {
265
+ character: firstNonWhitespaceCharacter(lineText),
266
+ requestedSymbol: symbol,
267
+ baseSymbol,
268
+ requestedOccurrence: occurrence,
269
+ usedOccurrence: 1,
270
+ strategy: "fallback",
271
+ debug: `${debug ? `${debug}; ` : ""}symbol not found on line; using first non-whitespace column`
272
+ };
273
+ }
274
+ function tokenAtPosition(content, line1, char1) {
275
+ const lines = content.split(/\r?\n/);
276
+ const line = lines[line1 - 1];
277
+ if (!line)
278
+ return;
279
+ const chars = [...line];
280
+ const idx = Math.max(0, Math.min(chars.length - 1, char1 - 1));
281
+ const isWord = (ch) => !!ch && /[A-Za-z0-9_?!]/.test(ch);
282
+ let left = idx;
283
+ let right = idx;
284
+ if (!isWord(chars[idx]) && isWord(chars[idx + 1])) {
285
+ left = idx + 1;
286
+ right = idx + 1;
287
+ }
288
+ while (left > 0 && isWord(chars[left - 1]))
289
+ left -= 1;
290
+ while (right < chars.length - 1 && isWord(chars[right + 1]))
291
+ right += 1;
292
+ const token = chars.slice(left, right + 1).join("").trim();
293
+ return token.length > 0 ? token : undefined;
294
+ }
295
+ function symbolKindLabel(kind) {
296
+ return kind == null ? "symbol" : SYMBOL_KIND_NAMES[kind] ?? "symbol";
297
+ }
298
+ function rangeStart(range) {
299
+ const start = range?.start;
300
+ return {
301
+ line: typeof start?.line === "number" ? start.line + 1 : undefined,
302
+ character: typeof start?.character === "number" ? start.character + 1 : undefined
303
+ };
304
+ }
305
+ function findSymbolMatches(symbols, query, options) {
306
+ const normalizedQuery = query.trim().toLowerCase();
307
+ if (!normalizedQuery)
308
+ return [];
309
+ const matches = [];
310
+ const matchesText = (symbol) => {
311
+ const values = [symbol.name, symbol.detail].filter((value) => Boolean(value)).map((value) => value.trim().toLowerCase());
312
+ return options.exactMatch ? values.some((value) => value === normalizedQuery) : values.some((value) => value.includes(normalizedQuery));
313
+ };
314
+ const matchesKind = (symbol) => {
315
+ if (options.kinds.size === 0)
316
+ return true;
317
+ return options.kinds.has(symbolKindLabel(symbol.kind).toLowerCase());
318
+ };
319
+ const visit = (entries, depth) => {
320
+ for (const symbol of entries) {
321
+ if (symbol.name && matchesText(symbol) && matchesKind(symbol)) {
322
+ const preferredRange = symbol.selectionRange ?? symbol.range;
323
+ const start = rangeStart(preferredRange);
324
+ matches.push({
325
+ name: symbol.name,
326
+ kind: symbolKindLabel(symbol.kind),
327
+ kindCode: symbol.kind,
328
+ detail: symbol.detail,
329
+ line: start.line,
330
+ character: start.character,
331
+ depth,
332
+ location: symbol.location,
333
+ range: preferredRange
334
+ });
335
+ if (matches.length >= options.maxResults)
336
+ return;
337
+ }
338
+ if (!options.topLevelOnly && symbol.children?.length) {
339
+ visit(symbol.children, depth + 1);
340
+ if (matches.length >= options.maxResults)
341
+ return;
342
+ }
343
+ }
344
+ };
345
+ visit(symbols, 1);
346
+ return matches;
347
+ }
348
+ function flattenSymbols(symbols) {
349
+ const all = [];
350
+ for (const symbol of symbols) {
351
+ all.push(symbol);
352
+ if (symbol.children && symbol.children.length > 0) {
353
+ all.push(...flattenSymbols(symbol.children));
354
+ }
355
+ }
356
+ return all;
357
+ }
358
+ function pickLocalSymbolLocation(symbols, token, filePath) {
359
+ const flat = flattenSymbols(symbols).filter((symbol) => symbol.name === token);
360
+ if (flat.length === 0)
361
+ return [];
362
+ const uri = pathToFileURL(filePath).href;
363
+ return flat.map((symbol) => {
364
+ if (symbol.location?.uri && symbol.location.range) {
365
+ return { uri: symbol.location.uri, range: symbol.location.range };
366
+ }
367
+ if (symbol.range) {
368
+ return { uri, range: symbol.range };
369
+ }
370
+ return;
371
+ }).filter((entry) => Boolean(entry));
372
+ }
373
+ function workspaceSymbolDedupeKey(symbol) {
374
+ const location = symbol.location;
375
+ const start = rangeStart(location?.range ?? symbol.range ?? symbol.selectionRange);
376
+ return [
377
+ symbol.name ?? "",
378
+ symbol.detail ?? "",
379
+ symbol.kind ?? "",
380
+ location?.uri ?? "",
381
+ start.line ?? "",
382
+ start.character ?? ""
383
+ ].join(":");
384
+ }
385
+ function dedupeWorkspaceSymbols(symbols) {
386
+ const out = [];
387
+ const seen = new Set;
388
+ for (const symbol of symbols) {
389
+ const key = workspaceSymbolDedupeKey(symbol);
390
+ if (seen.has(key))
391
+ continue;
392
+ seen.add(key);
393
+ out.push(symbol);
394
+ }
395
+ return out;
396
+ }
397
+ function asRecord(value) {
398
+ return typeof value === "object" && value !== null ? value : undefined;
399
+ }
400
+ function searchReadFromUriRange(uri, range) {
401
+ if (typeof uri !== "string" || !uri.startsWith("file:"))
402
+ return;
403
+ const rangeLike = asRecord(range);
404
+ const startLine = rangeLike?.start?.line;
405
+ if (typeof startLine !== "number" || !Number.isFinite(startLine)) {
406
+ return;
407
+ }
408
+ const endLine = rangeLike?.end?.line;
409
+ try {
410
+ return {
411
+ file: fileURLToPath(uri),
412
+ startLine: Math.max(1, Math.floor(startLine) + 1),
413
+ endLine: typeof endLine === "number" && Number.isFinite(endLine) ? Math.max(1, Math.floor(endLine) + 1) : undefined
414
+ };
415
+ } catch {
416
+ return;
417
+ }
418
+ }
419
+ function pushSearchRead(out, uri, range) {
420
+ const loc = searchReadFromUriRange(uri, range);
421
+ if (loc)
422
+ out.push(loc);
423
+ }
424
+ function collectLocationSearchReads(result) {
425
+ const out = [];
426
+ for (const entry of Array.isArray(result) ? result : [result]) {
427
+ const record = asRecord(entry);
428
+ if (!record)
429
+ continue;
430
+ pushSearchRead(out, record.uri, record.range);
431
+ pushSearchRead(out, record.targetUri, record.targetSelectionRange ?? record.targetRange);
432
+ }
433
+ return out;
434
+ }
435
+ function collectWorkspaceSymbolSearchReads(result) {
436
+ const out = [];
437
+ for (const entry of Array.isArray(result) ? result : [result]) {
438
+ const symbol = asRecord(entry);
439
+ const location = asRecord(symbol?.location);
440
+ if (!location)
441
+ continue;
442
+ pushSearchRead(out, location.uri, location.range);
443
+ pushSearchRead(out, location.targetUri, location.targetSelectionRange ?? location.targetRange);
444
+ }
445
+ return out;
446
+ }
447
+ function collectCallHierarchySearchReads(result, operation, callHierarchyItem) {
448
+ const out = [];
449
+ for (const entry of Array.isArray(result) ? result : [result]) {
450
+ const record = asRecord(entry);
451
+ if (!record)
452
+ continue;
453
+ const item = asRecord(operation === "incomingCalls" ? record.from : record.to);
454
+ pushSearchRead(out, item?.uri, item?.selectionRange ?? item?.range);
455
+ const rangeUri = operation === "incomingCalls" ? item?.uri : callHierarchyItem?.uri;
456
+ const fromRanges = record.fromRanges;
457
+ if (Array.isArray(fromRanges)) {
458
+ for (const range of fromRanges)
459
+ pushSearchRead(out, rangeUri, range);
460
+ }
461
+ }
462
+ return out;
463
+ }
464
+ function collectSearchReadsForOperation(operation, result, callHierarchyItem) {
465
+ if ([
466
+ "definition",
467
+ "typeDefinition",
468
+ "declaration",
469
+ "references",
470
+ "implementation"
471
+ ].includes(operation)) {
472
+ return collectLocationSearchReads(result);
473
+ }
474
+ if (operation === "workspaceSymbol") {
475
+ return collectWorkspaceSymbolSearchReads(result);
476
+ }
477
+ if (operation === "incomingCalls" || operation === "outgoingCalls") {
478
+ return collectCallHierarchySearchReads(result, operation, callHierarchyItem);
479
+ }
480
+ return [];
481
+ }
482
+ function formatCapabilities(snapshots, filePath) {
483
+ if (snapshots.length === 0) {
484
+ return filePath ? `No active LSP server for ${path.basename(filePath)}. Open/touch the file first or run another LSP operation to start the server.` : "No active LSP servers in this session.";
485
+ }
486
+ const rows = [
487
+ ["definition", (s) => !!s.operationSupport.definition],
488
+ ["typeDefinition", (s) => !!s.operationSupport.typeDefinition],
489
+ ["declaration", (s) => !!s.operationSupport.declaration],
490
+ ["references", (s) => !!s.operationSupport.references],
491
+ ["hover", (s) => !!s.operationSupport.hover],
492
+ ["rename", (s) => !!s.operationSupport.rename],
493
+ ["codeAction", (s) => !!s.operationSupport.codeAction],
494
+ ["codeAction/resolve", (s) => !!s.operationSupport.codeActionResolve],
495
+ ["workspace/willRenameFiles", (s) => !!s.operationSupport.willRenameFiles],
496
+ ["workspaceSymbol", (s) => !!s.operationSupport.workspaceSymbol],
497
+ ["implementation", (s) => !!s.operationSupport.implementation],
498
+ ["signatureHelp", (s) => !!s.operationSupport.signatureHelp],
499
+ ["incomingCalls", (s) => !!s.operationSupport.callHierarchy],
500
+ ["outgoingCalls", (s) => !!s.operationSupport.callHierarchy],
501
+ [
502
+ "workspaceDiagnostics",
503
+ (s) => s.workspaceDiagnosticsSupport.mode === "pull",
504
+ "pull diagnostics"
505
+ ],
506
+ [
507
+ "rename_file",
508
+ () => true,
509
+ "filesystem rename; preflight support shown above"
510
+ ]
511
+ ];
512
+ const lines = [];
513
+ for (const snapshot of snapshots) {
514
+ const label = filePath ? `${snapshot.serverId} (${path.basename(filePath)})` : `${snapshot.serverId} (${snapshot.root})`;
515
+ lines.push(label);
516
+ for (const [name, supported, note] of rows) {
517
+ const suffix = note ? ` (${note})` : "";
518
+ lines.push(` ${name} ${supported(snapshot) ? "✓" : "✗"}${suffix}`);
519
+ }
520
+ const commands = snapshot.advertisedCommands ?? [];
521
+ lines.push(` executeCommand ${commands.length > 0 ? "✓" : "✗"} (${commands.length} advertised command(s)` + (commands.length > 0 ? `: ${commands.slice(0, 20).join(", ")}` : "") + ")");
522
+ }
523
+ return lines.join(`
524
+ `);
525
+ }
526
+ function classifyCodeActions(actions) {
527
+ if (!actions || actions.length === 0)
528
+ return { quickfix: 0, refactor: 0, other: 0 };
529
+ let quickfix = 0;
530
+ let refactor = 0;
531
+ let other = 0;
532
+ for (const action of actions) {
533
+ const kind = action.kind ?? "";
534
+ if (kind.startsWith("quickfix"))
535
+ quickfix += 1;
536
+ else if (kind.startsWith("refactor"))
537
+ refactor += 1;
538
+ else
539
+ other += 1;
540
+ }
541
+ return { quickfix, refactor, other };
542
+ }
543
+ async function openFileBestEffort(lspService, filePath, waitForDiagnostics = false, excludeServerIds) {
544
+ let fileContent;
545
+ try {
546
+ fileContent = nodeFs.readFileSync(filePath, "utf-8");
547
+ } catch {
548
+ return;
549
+ }
550
+ if (fileContent === "")
551
+ return "";
552
+ try {
553
+ await lspService.touchFile(filePath, fileContent, {
554
+ diagnostics: waitForDiagnostics ? "document" : "none",
555
+ source: "lsp_navigation",
556
+ clientScope: waitForDiagnostics ? "all" : "primary",
557
+ ...excludeServerIds !== undefined && { excludeServerIds }
558
+ });
559
+ } catch {}
560
+ return fileContent;
561
+ }
562
+ export function createLspNavigationTool(getFlag, mutationDeps) {
563
+ return {
564
+ name: "lsp_navigation",
565
+ label: "LSP Navigate",
566
+ description: 'Navigate source with language-server operations such as definition, references, hover, and rename. Example: use `{operation: "references", path: "src/app.ts", line: 12}`.',
567
+ promptSnippet: "Navigate definitions and references with LSP",
568
+ renderResult: compactRenderResult(({ details, args, isError, text }) => {
569
+ const op = details?.operation ?? (typeof args.operation === "string" ? args.operation : "lsp");
570
+ if (isError || details?.supported === false) {
571
+ return `lsp_navigation ${op} — ${details?.emptyReason ?? text.split(`
572
+ `)[0] ?? "unavailable"}`;
573
+ }
574
+ const n = details?.resultCount ?? 0;
575
+ if (n === 0) {
576
+ return `lsp_navigation ${op} — ${details?.emptyReason ?? "no results"}`;
577
+ }
578
+ return `lsp_navigation ${op} — ${n} result${n === 1 ? "" : "s"}`;
579
+ }),
580
+ parameters: Type.Object({
581
+ operation: Type.String({
582
+ enum: [...VALID_OPERATIONS],
583
+ description: "LSP operation."
584
+ }),
585
+ path: Type.Optional(Type.String({
586
+ description: "Target file path."
587
+ })),
588
+ line: Type.Optional(Type.Number({
589
+ description: "1-based line number."
590
+ })),
591
+ character: Type.Optional(Type.Number({
592
+ description: "1-based character offset."
593
+ })),
594
+ symbol: Type.Optional(Type.String({
595
+ description: "Symbol for automatic character resolution."
596
+ })),
597
+ endLine: Type.Optional(Type.Number({
598
+ description: "1-based range end line."
599
+ })),
600
+ endCharacter: Type.Optional(Type.Number({
601
+ description: "1-based range end character."
602
+ })),
603
+ newName: Type.Optional(Type.String({
604
+ description: "New symbol name."
605
+ })),
606
+ newFilePath: Type.Optional(Type.String({
607
+ description: "New file path."
608
+ })),
609
+ apply: Type.Optional(Type.Boolean({
610
+ description: "Apply a mutation instead of previewing it."
611
+ })),
612
+ command: Type.Optional(Type.String({
613
+ description: "Server command identifier."
614
+ })),
615
+ commandArguments: Type.Optional(Type.Array(Type.Unknown(), {
616
+ description: "Arguments for the server command."
617
+ })),
618
+ query: Type.Optional(Type.String({
619
+ description: "Symbol search query."
620
+ })),
621
+ kinds: Type.Optional(Type.Array(Type.String(), {
622
+ description: "Symbol-kind filters."
623
+ })),
624
+ exactMatch: Type.Optional(Type.Boolean({
625
+ description: "Require an exact symbol match."
626
+ })),
627
+ topLevelOnly: Type.Optional(Type.Boolean({
628
+ description: "Exclude nested symbols."
629
+ })),
630
+ maxResults: Type.Optional(Type.Number({
631
+ description: "Maximum symbol matches."
632
+ })),
633
+ callHierarchyItem: Type.Optional(Type.Object({}, {
634
+ description: "An item prepareCallHierarchy returned, passed back unchanged."
635
+ }))
636
+ }),
637
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
638
+ const session = mutationDeps?.runtime?.captureSessionGeneration?.();
639
+ const startedAt = Date.now();
640
+ let supported = null;
641
+ let noFileClient = false;
642
+ let diagnosticsMode = "unknown";
643
+ let columnResolution;
644
+ let openedFileContent;
645
+ let renameRequestedAtMs = 0;
646
+ let mutationContext;
647
+ let requestedApply = false;
648
+ const workspaceScopeAttribution = {};
649
+ const finalize = (payload, meta) => {
650
+ if (payload.isError && requestedApply && mutationContext && ["rename", "rename_file", "executeCommand"].includes(meta.operation)) {
651
+ recordLspMutationOutcome(mutationContext, "failed");
652
+ }
653
+ const normalizedFilePath = meta.filePath.replace(/\\/g, "/");
654
+ logLatency({
655
+ type: "phase",
656
+ phase: "lsp_navigation_result",
657
+ filePath: normalizedFilePath,
658
+ durationMs: Date.now() - startedAt,
659
+ metadata: {
660
+ operation: meta.operation,
661
+ failureKind: meta.failureKind,
662
+ resultCount: meta.resultCount,
663
+ supported,
664
+ diagnosticsMode,
665
+ columnResolution,
666
+ ...Object.keys(workspaceScopeAttribution).length > 0 ? { workspaceScopeAttribution } : {}
667
+ }
668
+ });
669
+ const text = payload.content[0]?.text ?? "";
670
+ const envelope = buildLspNavigationEnvelope({
671
+ operation: meta.operation,
672
+ filePath: meta.filePath,
673
+ failureKind: meta.failureKind,
674
+ resultCount: meta.resultCount,
675
+ text,
676
+ isError: payload.isError,
677
+ details: payload.details
678
+ });
679
+ return {
680
+ ...payload,
681
+ content: [
682
+ {
683
+ type: "text",
684
+ text: JSON.stringify(envelope)
685
+ }
686
+ ],
687
+ details: {
688
+ ...payload.details,
689
+ failureKind: meta.failureKind
690
+ }
691
+ };
692
+ };
693
+ if (getFlag("no-lsp", ctx.cwd)) {
694
+ return finalize({
695
+ content: [
696
+ {
697
+ type: "text",
698
+ text: "lsp_navigation requires LSP to be enabled. Remove --no-lsp to use LSP navigation."
699
+ }
700
+ ],
701
+ isError: true
702
+ }, {
703
+ operation: "precheck",
704
+ filePath: "(workspace)",
705
+ failureKind: "lsp_disabled",
706
+ resultCount: 0
707
+ });
708
+ }
709
+ const { operation: rawOperation, path: rawPath, line, character, symbol, endLine, endCharacter, newName, newFilePath, apply, command, commandArguments, query, kinds, exactMatch, topLevelOnly, maxResults, callHierarchyItem } = params;
710
+ const normalizedOperation = normalizeOperation(rawOperation);
711
+ if (!isValidOperation(normalizedOperation)) {
712
+ return finalize({
713
+ content: [
714
+ {
715
+ type: "text",
716
+ text: `Unknown lsp_navigation operation "${normalizedOperation || String(rawOperation ?? "") || ""}". ` + `Valid operations: ${VALID_OPERATIONS.join(", ")}`
717
+ }
718
+ ],
719
+ isError: true,
720
+ details: {
721
+ rawOperation,
722
+ normalizedOperation,
723
+ validOperations: VALID_OPERATIONS
724
+ }
725
+ }, {
726
+ operation: normalizedOperation || "invalid",
727
+ filePath: "(workspace)",
728
+ failureKind: "invalid_operation",
729
+ resultCount: 0
730
+ });
731
+ }
732
+ const operation = normalizedOperation;
733
+ requestedApply = apply === true;
734
+ if (requestedApply && ["rename", "rename_file", "executeCommand"].includes(operation)) {
735
+ const cwd = ctx.cwd || ".";
736
+ const mutationSource = operation === "executeCommand" ? "lsp-execute-command" : "lsp-rename";
737
+ mutationContext = {
738
+ cwd,
739
+ sessionId: ctx.sessionManager?.getSessionId?.(),
740
+ correlationId: newLspMutationCorrelationId(_toolCallId),
741
+ toolCallId: _toolCallId,
742
+ tool: `lsp_navigation:${operation}`,
743
+ source: mutationSource,
744
+ ...mutationDeps,
745
+ session,
746
+ readGuard: getFlag("no-read-guard", cwd) ? undefined : mutationDeps?.readGuard,
747
+ isRecordable: (filePath) => {
748
+ return isRecordableProjectPath(filePath, mutationDeps?.runtime?.projectRoot ?? cwd);
749
+ }
750
+ };
751
+ }
752
+ const isCallHierarchyTraversal = operation === "incomingCalls" || operation === "outgoingCalls";
753
+ const needsFilePath = operation !== "workspaceDiagnostics" && operation !== "workspaceSymbol" && operation !== "executeCommand" && operation !== "capabilities" && !isCallHierarchyTraversal;
754
+ if (needsFilePath && (!rawPath || rawPath.trim().length === 0)) {
755
+ return finalize({
756
+ content: [
757
+ {
758
+ type: "text",
759
+ text: `path is required for ${operation}`
760
+ }
761
+ ],
762
+ isError: true
763
+ }, {
764
+ operation,
765
+ filePath: "(workspace)",
766
+ failureKind: "missing_file_path",
767
+ resultCount: 0
768
+ });
769
+ }
770
+ const filePath = rawPath ? resolveHostToolPath(rawPath, ctx.cwd || ".") : "";
771
+ let filePathIsDirectory = false;
772
+ if (filePath) {
773
+ try {
774
+ filePathIsDirectory = nodeFs.statSync(filePath).isDirectory();
775
+ } catch {}
776
+ }
777
+ const lspService = getLSPService();
778
+ if (operation === "capabilities") {
779
+ const snapshots = rawPath ? await lspService.getCapabilitySnapshots(filePath) : await lspService.getCapabilitySnapshots(undefined, workspaceScopeAttribution);
780
+ const output = formatCapabilities(snapshots, rawPath ? filePath : undefined);
781
+ return finalize({
782
+ content: [{ type: "text", text: output }],
783
+ details: {
784
+ operation,
785
+ resultCount: snapshots.length,
786
+ servers: snapshots.map((snapshot) => snapshot.serverId)
787
+ }
788
+ }, {
789
+ operation,
790
+ filePath: rawPath ? filePath : "(workspace)",
791
+ failureKind: snapshots.length === 0 ? "empty_result" : "success",
792
+ resultCount: snapshots.length
793
+ });
794
+ }
795
+ if (operation === "workspaceDiagnostics") {
796
+ const policyCwd = ctx.cwd || process.cwd();
797
+ const wsDiagSupport = rawPath ? await lspService.getWorkspaceDiagnosticsSupport(filePath) : await lspService.getWorkspaceDiagnosticsSupport(undefined, workspaceScopeAttribution);
798
+ diagnosticsMode = wsDiagSupport?.mode ?? "unknown";
799
+ if (rawPath && !filePathIsDirectory) {
800
+ const hasLSP = lspService.supportsLSP(filePath) || disabledPrimaries(filePath).disabledServerIds.length > 0;
801
+ if (!hasLSP) {
802
+ return finalize({
803
+ content: [
804
+ {
805
+ type: "text",
806
+ text: `No LSP server available for ${path.basename(filePath)}. Check that the language server is installed.`
807
+ }
808
+ ],
809
+ isError: true
810
+ }, {
811
+ operation,
812
+ filePath,
813
+ failureKind: "no_server",
814
+ resultCount: 0
815
+ });
816
+ }
817
+ const excludeServerIds = configDisabledAuxiliaryLspServerIds((name) => getFlag(name, ctx.cwd));
818
+ await lspService.sweepDocumentDrift({ force: true, full: true });
819
+ const openedContent = await openFileBestEffort(lspService, filePath, true, excludeServerIds);
820
+ const pythonCompileTarget = await detectPythonTargetVersion(filePath);
821
+ const policy = applyProbeFindingPolicy(filePath, await lspService.getDiagnostics(filePath, undefined, excludeServerIds), policyCwd, openedContent, "all", "lsp_navigation", pythonCompileTarget);
822
+ const diagnostics = policy.kept;
823
+ const suppressedLine = dispositionSuppressedLine(policy.suppressed);
824
+ const withheldLine = withheldCompileNote(policy.withheld);
825
+ const primaryUnavailable = describePrimaryUnavailable(undefined, lspService.getDiagnosticsHealth(filePath))?.text;
826
+ const result = [
827
+ {
828
+ filePath,
829
+ diagnostics,
830
+ count: diagnostics.length
831
+ }
832
+ ];
833
+ const noteMap = {
834
+ pull: "Note: path mode requests pull diagnostics for this file and returns the aggregated result",
835
+ "push-only": "Note: server is push-only; result depends on published diagnostics for this file"
836
+ };
837
+ const note = noteMap[diagnosticsMode] ?? "Note: workspace diagnostics mode unknown (no active capability snapshot)";
838
+ const resultCount = diagnostics.length;
839
+ return finalize({
840
+ content: [
841
+ {
842
+ type: "text",
843
+ text: `${note}
844
+ ${JSON.stringify(result)}${primaryUnavailable ? `
845
+ Note: ${primaryUnavailable}` : ""}${suppressedLine ? `
846
+ Note: ${suppressedLine}` : ""}${withheldLine ? `
847
+ Note: ${withheldLine}` : ""}`
848
+ }
849
+ ],
850
+ details: {
851
+ operation,
852
+ resultCount,
853
+ diagnosticsMode,
854
+ coverage: "requested-file",
855
+ ...policy.suppressed > 0 && {
856
+ dispositionSuppressed: policy.suppressed
857
+ },
858
+ ...policy.withheld && {
859
+ withheldCompile: policy.withheld
860
+ },
861
+ ...primaryUnavailable !== undefined && {
862
+ unconfirmed: true,
863
+ primaryUnavailable
864
+ }
865
+ }
866
+ }, {
867
+ operation,
868
+ filePath,
869
+ failureKind: resultCount === 0 ? "empty_result" : "success",
870
+ resultCount
871
+ });
872
+ }
873
+ const allDiagnostics = await lspService.getAllDiagnostics(configDisabledAuxiliaryLspServerIds((name) => getFlag(name, ctx.cwd)));
874
+ const compileVerdictFiles = [];
875
+ for (const [trackedFile, entry] of allDiagnostics) {
876
+ if (entry.diags.some(isJediCompileVerdict)) {
877
+ compileVerdictFiles.push(trackedFile);
878
+ }
879
+ }
880
+ const compileVerdictTargets = await mapWithConcurrency(compileVerdictFiles, PYTHON_DECLARATION_CONCURRENCY, async (trackedFile) => ({
881
+ trackedFile,
882
+ target: await detectPythonTargetVersion(trackedFile)
883
+ }));
884
+ const pythonCompileTargets = new Map(compileVerdictTargets.map((entry) => [entry.trackedFile, entry.target]));
885
+ let snapshotSuppressed = 0;
886
+ const snapshotWithheldEntries = [];
887
+ const result = Array.from(allDiagnostics.entries()).map(([trackedFile, { diags, ts }]) => {
888
+ let kept = diags;
889
+ if (diags.length > 0) {
890
+ const policy = applyProbeFindingPolicy(trackedFile, diags, policyCwd, readFileContent(trackedFile), "all", "lsp_navigation", pythonCompileTargets.get(trackedFile));
891
+ snapshotSuppressed += policy.suppressed;
892
+ snapshotWithheldEntries.push(policy.withheld);
893
+ kept = policy.kept;
894
+ }
895
+ return {
896
+ filePath: trackedFile,
897
+ diagnostics: kept,
898
+ count: kept.length,
899
+ lag: formatCacheAgeLabel(ts)
900
+ };
901
+ });
902
+ const snapshotSuppressedLine = dispositionSuppressedLine(snapshotSuppressed);
903
+ const snapshotWithheld = mergeWithheld(snapshotWithheldEntries);
904
+ const snapshotWithheldLine = withheldCompileNote(snapshotWithheld);
905
+ const noteMap2 = {
906
+ "push-only": "Note: push-only tracked diagnostics snapshot (not full workspace pull diagnostics).",
907
+ pull: "Note: tracked diagnostics snapshot from active clients. Provide path to force file-level diagnostics collection"
908
+ };
909
+ const note = noteMap2[diagnosticsMode] ?? "Note: workspace diagnostics mode unknown (no active capability snapshot)";
910
+ return finalize({
911
+ content: [
912
+ {
913
+ type: "text",
914
+ text: `${note}
915
+ ${JSON.stringify(result)}${snapshotSuppressedLine ? `
916
+ Note: ${snapshotSuppressedLine}` : ""}${snapshotWithheldLine ? `
917
+ Note: ${snapshotWithheldLine}` : ""}`
918
+ }
919
+ ],
920
+ details: {
921
+ operation,
922
+ resultCount: result.length,
923
+ diagnosticsMode,
924
+ coverage: "tracked-open-files",
925
+ ...snapshotSuppressed > 0 && {
926
+ dispositionSuppressed: snapshotSuppressed
927
+ },
928
+ ...snapshotWithheld && {
929
+ withheldCompile: snapshotWithheld
930
+ }
931
+ }
932
+ }, {
933
+ operation,
934
+ filePath: rawPath ? filePath : "(workspace)",
935
+ failureKind: diagnosticsMode === "push-only" ? "tracked_snapshot" : "success",
936
+ resultCount: result.length
937
+ });
938
+ }
939
+ if (needsFilePath && filePathIsDirectory) {
940
+ return finalize({
941
+ content: [
942
+ {
943
+ type: "text",
944
+ text: `path must be a source file, got directory: ${filePath}. Pass a source file path, or omit path for workspace-level operations.`
945
+ }
946
+ ],
947
+ isError: true
948
+ }, {
949
+ operation,
950
+ filePath,
951
+ failureKind: "filepath_is_directory",
952
+ resultCount: 0
953
+ });
954
+ }
955
+ const hasLSP = filePath ? lspService.supportsLSP(filePath) : false;
956
+ if (needsFilePath && !hasLSP) {
957
+ return finalize({
958
+ content: [
959
+ {
960
+ type: "text",
961
+ text: disabledPrimaries(filePath).disabledServerIds.length > 0 ? noServerAnsweredText(filePath) : `No LSP server available for ${path.basename(filePath)}. Check that the language server is installed.`
962
+ }
963
+ ],
964
+ isError: true
965
+ }, {
966
+ operation,
967
+ filePath,
968
+ failureKind: "no_server",
969
+ resultCount: 0
970
+ });
971
+ }
972
+ if (needsFilePath) {
973
+ const support = await lspService.getOperationSupport(filePath);
974
+ noFileClient = support === null;
975
+ supported = operationSupportStatus(operation, support);
976
+ if (supported === false) {
977
+ return finalize({
978
+ content: [
979
+ {
980
+ type: "text",
981
+ text: `LSP server for ${path.basename(filePath)} does not advertise support for ${operation}`
982
+ }
983
+ ],
984
+ isError: true,
985
+ details: {
986
+ operation,
987
+ supported: false,
988
+ emptyReason: "unsupported"
989
+ }
990
+ }, { operation, filePath, failureKind: "unsupported", resultCount: 0 });
991
+ }
992
+ openedFileContent = await openFileBestEffort(lspService, filePath);
993
+ }
994
+ const lspLine = (line ?? 1) - 1;
995
+ const needsPosition = [
996
+ "definition",
997
+ "typeDefinition",
998
+ "declaration",
999
+ "references",
1000
+ "hover",
1001
+ "signatureHelp",
1002
+ "codeAction",
1003
+ "rename",
1004
+ "implementation",
1005
+ "prepareCallHierarchy"
1006
+ ].includes(operation);
1007
+ const resolvedCharacter = needsPosition && filePath ? resolveSymbolColumn(nodeFs.existsSync(filePath) ? nodeFs.readFileSync(filePath, "utf-8") : "", line ?? 1, character, symbol) : {
1008
+ character: character ?? 1,
1009
+ strategy: "explicit"
1010
+ };
1011
+ columnResolution = resolvedCharacter;
1012
+ const lspChar = resolvedCharacter.character - 1;
1013
+ const lspEndLine = (endLine ?? line ?? 1) - 1;
1014
+ const lspEndChar = (endCharacter ?? resolvedCharacter.character) - 1;
1015
+ const runWorkspaceSymbolOperation = async () => {
1016
+ const support = rawPath ? await lspService.getOperationSupport(filePath) : await lspService.getOperationSupport(undefined, workspaceScopeAttribution);
1017
+ supported = operationSupportStatus(operation, support);
1018
+ if (supported === false) {
1019
+ throw new Error("__UNSUPPORTED__ Active LSP server does not advertise support for workspaceSymbol");
1020
+ }
1021
+ if (!query || query.trim().length === 0) {
1022
+ throw new Error("__BADINPUT__ query parameter required for workspaceSymbol");
1023
+ }
1024
+ if (rawPath) {
1025
+ await openFileBestEffort(lspService, filePath);
1026
+ }
1027
+ try {
1028
+ const raw = rawPath ? await lspService.workspaceSymbol(query ?? "", filePath) : await lspService.workspaceSymbol(query ?? "", undefined, workspaceScopeAttribution);
1029
+ const filtered = (Array.isArray(raw) ? raw : [raw]).filter((s) => typeof s === "object" && s !== null && (!s.kind || NAVIGABLE_SYMBOL_KINDS.has(s.kind)));
1030
+ return dedupeWorkspaceSymbols(filtered).slice(0, 15);
1031
+ } catch (err) {
1032
+ const msg = err instanceof Error ? err.message : String(err);
1033
+ if (rawPath && /No Project/i.test(msg)) {
1034
+ await openFileBestEffort(lspService, filePath);
1035
+ await new Promise((resolve) => setTimeout(resolve, 120));
1036
+ const retryRaw = await lspService.workspaceSymbol(query ?? "", filePath);
1037
+ const retrySymbols = (Array.isArray(retryRaw) ? retryRaw : [retryRaw]).filter((s) => typeof s === "object" && s !== null);
1038
+ return dedupeWorkspaceSymbols(retrySymbols);
1039
+ }
1040
+ throw err;
1041
+ }
1042
+ };
1043
+ const runOperation = async () => {
1044
+ switch (operation) {
1045
+ case "definition":
1046
+ return lspService.definition(filePath, lspLine, lspChar);
1047
+ case "typeDefinition":
1048
+ return lspService.typeDefinition(filePath, lspLine, lspChar);
1049
+ case "declaration":
1050
+ return lspService.declaration(filePath, lspLine, lspChar);
1051
+ case "references":
1052
+ return lspService.references(filePath, lspLine, lspChar);
1053
+ case "hover":
1054
+ return lspService.hover(filePath, lspLine, lspChar);
1055
+ case "signatureHelp":
1056
+ return lspService.signatureHelp(filePath, lspLine, lspChar);
1057
+ case "documentSymbol":
1058
+ return lspService.documentSymbol(filePath);
1059
+ case "findSymbol": {
1060
+ if (!query || query.trim().length === 0) {
1061
+ throw new Error("__BADINPUT__ query parameter required for findSymbol");
1062
+ }
1063
+ const symbols = await lspService.documentSymbol(filePath);
1064
+ return findSymbolMatches(symbols, query, {
1065
+ maxResults: Math.max(1, Math.min(100, maxResults ?? 20)),
1066
+ topLevelOnly: topLevelOnly ?? false,
1067
+ exactMatch: exactMatch ?? false,
1068
+ kinds: new Set((kinds ?? []).map((kind) => kind.trim().toLowerCase()).filter(Boolean))
1069
+ });
1070
+ }
1071
+ case "workspaceSymbol":
1072
+ return runWorkspaceSymbolOperation();
1073
+ case "codeAction":
1074
+ return lspService.codeAction(filePath, lspLine, lspChar, lspEndLine, lspEndChar);
1075
+ case "rename": {
1076
+ if (!newName || newName.trim().length === 0) {
1077
+ throw new Error("__BADINPUT__ newName parameter required for rename");
1078
+ }
1079
+ renameRequestedAtMs = Date.now();
1080
+ const edit = await lspService.rename(filePath, lspLine, lspChar, newName);
1081
+ if (!edit)
1082
+ return null;
1083
+ if (!apply) {
1084
+ return {
1085
+ applied: false,
1086
+ summary: summarizeWorkspaceEdit(edit, ctx.cwd || "."),
1087
+ edit
1088
+ };
1089
+ }
1090
+ const applied = await applyWorkspaceEdit(edit, ctx.cwd || ".", {
1091
+ mutationContext,
1092
+ expectedContent: captureRenameExpectedContent(edit, ctx.cwd || ".", renameRequestedAtMs, (filePath, atCwd) => lspService.getTrackedContent(filePath, atCwd), openedFileContent === undefined ? undefined : { filePath, content: openedFileContent })
1093
+ });
1094
+ for (const touchedFile of applied.files) {
1095
+ try {
1096
+ await openFileBestEffort(lspService, touchedFile, false);
1097
+ } catch {}
1098
+ }
1099
+ return { applied: true, ...applied };
1100
+ }
1101
+ case "rename_file": {
1102
+ if (!newFilePath || newFilePath.trim().length === 0) {
1103
+ throw new Error("__BADINPUT__ newFilePath parameter required for rename_file");
1104
+ }
1105
+ const resolvedNewFilePath = resolveHostToolPath(newFilePath, ctx.cwd || ".");
1106
+ const result = await lspService.renameFile(filePath, resolvedNewFilePath, {
1107
+ cwd: ctx.cwd || ".",
1108
+ apply: apply ?? false,
1109
+ ...mutationContext ? { mutationContext } : {}
1110
+ });
1111
+ if (result.applied) {
1112
+ for (const touchedFile of result.files ?? []) {
1113
+ try {
1114
+ await openFileBestEffort(lspService, touchedFile, false);
1115
+ } catch {}
1116
+ }
1117
+ }
1118
+ return result;
1119
+ }
1120
+ case "implementation":
1121
+ return lspService.implementation(filePath, lspLine, lspChar);
1122
+ case "prepareCallHierarchy":
1123
+ return lspService.prepareCallHierarchy(filePath, lspLine, lspChar);
1124
+ case "executeCommand": {
1125
+ if (!command || command.trim().length === 0) {
1126
+ throw new Error("__BADINPUT__ command parameter required for executeCommand");
1127
+ }
1128
+ const advertised = rawPath ? await lspService.getAdvertisedCommands(filePath) : await lspService.getAdvertisedCommands(undefined, workspaceScopeAttribution);
1129
+ const isAdvertised = advertised.includes(command);
1130
+ if (apply !== true) {
1131
+ return {
1132
+ executed: false,
1133
+ dryRun: true,
1134
+ command,
1135
+ advertised: isAdvertised,
1136
+ advertisedCommands: advertised,
1137
+ note: isAdvertised ? "Command is advertised. Re-run with apply:true to execute." : "Command is NOT advertised by the active server; execution would be refused."
1138
+ };
1139
+ }
1140
+ if (!isAdvertised) {
1141
+ throw new Error(`__UNSUPPORTED__ command "${command}" is not advertised by the active LSP server (advertised: ${advertised.join(", ") || "none"})`);
1142
+ }
1143
+ return rawPath ? lspService.executeCommand(filePath, command, commandArguments, mutationContext) : lspService.executeCommand(undefined, command, commandArguments, mutationContext, workspaceScopeAttribution);
1144
+ }
1145
+ case "incomingCalls": {
1146
+ const checked = checkCallHierarchyItem(callHierarchyItem);
1147
+ if ("problem" in checked) {
1148
+ throw new Error(`__BADINPUT__ ${checked.problem} for incomingCalls`);
1149
+ }
1150
+ supported = operationSupportStatus(operation, await lspService.getOperationSupport(uriToPath(checked.item.uri)));
1151
+ if (supported === false) {
1152
+ throw new Error("__UNSUPPORTED__ Active LSP server does not advertise support for incomingCalls");
1153
+ }
1154
+ return lspService.incomingCalls(checked.item);
1155
+ }
1156
+ case "outgoingCalls": {
1157
+ const checked = checkCallHierarchyItem(callHierarchyItem);
1158
+ if ("problem" in checked) {
1159
+ throw new Error(`__BADINPUT__ ${checked.problem} for outgoingCalls`);
1160
+ }
1161
+ supported = operationSupportStatus(operation, await lspService.getOperationSupport(uriToPath(checked.item.uri)));
1162
+ if (supported === false) {
1163
+ throw new Error("__UNSUPPORTED__ Active LSP server does not advertise support for outgoingCalls");
1164
+ }
1165
+ return lspService.outgoingCalls(checked.item);
1166
+ }
1167
+ default:
1168
+ return [];
1169
+ }
1170
+ };
1171
+ let result;
1172
+ let usedDocumentSymbolFallback = false;
1173
+ try {
1174
+ result = await runOperation();
1175
+ const isEmptyInitial = !result || Array.isArray(result) && result.length === 0;
1176
+ const shouldRetryOnEmpty = isEmptyInitial && needsFilePath && [
1177
+ "definition",
1178
+ "typeDefinition",
1179
+ "declaration",
1180
+ "references",
1181
+ "hover",
1182
+ "signatureHelp",
1183
+ "codeAction",
1184
+ "rename",
1185
+ "implementation"
1186
+ ].includes(operation);
1187
+ if (shouldRetryOnEmpty) {
1188
+ openedFileContent = await openFileBestEffort(lspService, filePath, true);
1189
+ result = await runOperation();
1190
+ }
1191
+ const stillEmpty = !result || Array.isArray(result) && result.length === 0;
1192
+ if (stillEmpty && needsFilePath && operation === "definition") {
1193
+ const content = nodeFs.readFileSync(filePath, "utf-8");
1194
+ const token = line && character ? tokenAtPosition(content, line, character) : undefined;
1195
+ if (token) {
1196
+ const docSymbols = await lspService.documentSymbol(filePath);
1197
+ const locations = pickLocalSymbolLocation(docSymbols, token, filePath);
1198
+ if (locations.length > 0) {
1199
+ result = locations;
1200
+ usedDocumentSymbolFallback = true;
1201
+ }
1202
+ }
1203
+ }
1204
+ if (mutationContext && requestedApply && !mutationContext.summaryEmitted) {
1205
+ const outcome = operation === "rename_file" && result && typeof result === "object" && "applied" in result && result.applied === false ? "failed" : operation === "executeCommand" && result && typeof result === "object" && ("executed" in result) && result.executed === false ? "failed" : "skipped";
1206
+ recordLspMutationOutcome(mutationContext, outcome);
1207
+ }
1208
+ } catch (err) {
1209
+ const msg = err instanceof Error ? err.message : String(err);
1210
+ if (msg.startsWith("__UNSUPPORTED__ ")) {
1211
+ return finalize({
1212
+ content: [
1213
+ {
1214
+ type: "text",
1215
+ text: msg.replace("__UNSUPPORTED__ ", "")
1216
+ }
1217
+ ],
1218
+ isError: true,
1219
+ details: {
1220
+ operation,
1221
+ supported: false,
1222
+ emptyReason: "unsupported"
1223
+ }
1224
+ }, { operation, filePath, failureKind: "unsupported", resultCount: 0 });
1225
+ }
1226
+ if (msg.startsWith("__BADINPUT__ ")) {
1227
+ return finalize({
1228
+ content: [
1229
+ {
1230
+ type: "text",
1231
+ text: msg.replace("__BADINPUT__ ", "")
1232
+ }
1233
+ ],
1234
+ isError: true,
1235
+ details: {}
1236
+ }, { operation, filePath, failureKind: "bad_input", resultCount: 0 });
1237
+ }
1238
+ return finalize({
1239
+ content: [
1240
+ {
1241
+ type: "text",
1242
+ text: `LSP error: ${err instanceof Error ? err.message : String(err)}`
1243
+ }
1244
+ ],
1245
+ isError: true,
1246
+ details: {}
1247
+ }, { operation, filePath, failureKind: "lsp_error", resultCount: 0 });
1248
+ }
1249
+ const isEmpty = !result || Array.isArray(result) && result.length === 0;
1250
+ if (isEmpty && noFileClient) {
1251
+ return finalize({
1252
+ content: [
1253
+ { type: "text", text: noServerAnsweredText(filePath) }
1254
+ ],
1255
+ isError: true
1256
+ }, { operation, filePath, failureKind: "no_server", resultCount: 0 });
1257
+ }
1258
+ const fileCtx = filePath ? " at " + path.basename(filePath) : "";
1259
+ const lineCtx = line ? ":" + line + ":" + character : "";
1260
+ let output = isEmpty ? "No results for " + operation + fileCtx + lineCtx : JSON.stringify(result);
1261
+ if (isEmpty && operation === "workspaceSymbol" && !rawPath) {
1262
+ output += `
1263
+ Hint: provide path to scope workspaceSymbol to the active language server/root.`;
1264
+ }
1265
+ if (usedDocumentSymbolFallback) {
1266
+ output += `
1267
+ Note: served from documentSymbol fallback due to empty primary result.`;
1268
+ }
1269
+ if (operation === "references" && Array.isArray(result) && result.length <= 2) {
1270
+ output += `
1271
+ Hint: references from usage sites can be partial; retry from the symbol definition for broader cross-file results.`;
1272
+ }
1273
+ const actionStats = operation === "codeAction" && Array.isArray(result) ? classifyCodeActions(result) : null;
1274
+ if (operation === "codeAction" && actionStats) {
1275
+ if (actionStats.quickfix === 0 && actionStats.refactor > 0) {
1276
+ output += `
1277
+ Note: no diagnostic quick fixes returned; refactor-only actions available.`;
1278
+ }
1279
+ }
1280
+ const resultCount = Array.isArray(result) ? result.length : result ? 1 : 0;
1281
+ const searchReads = collectSearchReadsForOperation(operation, result, callHierarchyItem);
1282
+ return finalize({
1283
+ content: [{ type: "text", text: output }],
1284
+ details: {
1285
+ operation,
1286
+ supported,
1287
+ searchReads: searchReads.length > 0 ? searchReads : undefined,
1288
+ emptyReason: isEmpty ? emptyReasonForOperation(operation) : undefined,
1289
+ codeActionKinds: actionStats ?? undefined,
1290
+ columnResolution: columnResolution?.strategy === "explicit" ? undefined : columnResolution,
1291
+ resultCount
1292
+ }
1293
+ }, {
1294
+ operation,
1295
+ filePath: rawPath ? filePath : "(workspace)",
1296
+ failureKind: isEmpty ? "empty_result" : usedDocumentSymbolFallback ? "fallback_success" : "success",
1297
+ resultCount
1298
+ });
1299
+ }
1300
+ };
1301
+ }