@herbertgao/pi-extensions 2026.9.0 → 2026.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (360) hide show
  1. package/node_modules/@czottmann/pi-automode/CHANGELOG.md +13 -1
  2. package/node_modules/@czottmann/pi-automode/README.md +20 -0
  3. package/node_modules/@czottmann/pi-automode/docs/GLOSSARY.md +1 -1
  4. package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +2 -1
  5. package/node_modules/@czottmann/pi-automode/docs/defaults.md +3 -2
  6. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +38 -2
  7. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +5 -3
  8. package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +11 -3
  9. package/node_modules/@czottmann/pi-automode/package.json +1 -1
  10. package/node_modules/@narumitw/pi-btw/README.md +57 -141
  11. package/node_modules/@narumitw/pi-btw/dist/index.ts +466 -41
  12. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  13. package/node_modules/@narumitw/pi-btw/docs/workflows.md +74 -0
  14. package/node_modules/@narumitw/pi-btw/package.json +2 -1
  15. package/node_modules/@narumitw/pi-btw/src/btw.ts +15 -1
  16. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +32 -2
  17. package/node_modules/@narumitw/pi-btw/src/keybindings.ts +330 -0
  18. package/node_modules/@narumitw/pi-btw/src/menu.ts +136 -19
  19. package/node_modules/@narumitw/pi-btw/src/settings.ts +32 -0
  20. package/node_modules/@narumitw/pi-btw/src/side-thread.ts +57 -5
  21. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +52 -30
  22. package/node_modules/@pi-plugins/fast-mode/README.md +5 -3
  23. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
  24. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +20 -55
  25. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
  26. package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
  27. package/node_modules/pi-lens/CHANGELOG.md +1072 -0
  28. package/node_modules/pi-lens/README.md +3 -0
  29. package/node_modules/pi-lens/config/biome/core.jsonc +11 -2
  30. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +13 -1
  31. package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +2 -9
  32. package/node_modules/pi-lens/dist/clients/actionable-warnings.js +927 -80
  33. package/node_modules/pi-lens/dist/clients/advisory-provenance.js +1 -1
  34. package/node_modules/pi-lens/dist/clients/agent-behavior-client.js +13 -4
  35. package/node_modules/pi-lens/dist/clients/ast-grep-client.js +123 -3
  36. package/node_modules/pi-lens/dist/clients/ast-grep-rule-manager.js +60 -5
  37. package/node_modules/pi-lens/dist/clients/ast-grep-tool-logger.js +2 -9
  38. package/node_modules/pi-lens/dist/clients/ast-grep-types.js +2 -0
  39. package/node_modules/pi-lens/dist/clients/bash-file-access.js +133 -3
  40. package/node_modules/pi-lens/dist/clients/biome-client.js +9 -2
  41. package/node_modules/pi-lens/dist/clients/blocker-freshness.js +14 -6
  42. package/node_modules/pi-lens/dist/clients/bootstrap.js +509 -73
  43. package/node_modules/pi-lens/dist/clients/bounded-cache.js +152 -12
  44. package/node_modules/pi-lens/dist/clients/bounded-pid-file-lock.js +1 -1
  45. package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +59 -9
  46. package/node_modules/pi-lens/dist/clients/bundled-resource-health.js +113 -0
  47. package/node_modules/pi-lens/dist/clients/bus-events-logger.js +3 -11
  48. package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +31 -4
  49. package/node_modules/pi-lens/dist/clients/cache-manager.js +105 -6
  50. package/node_modules/pi-lens/dist/clients/cache-observability.js +40 -19
  51. package/node_modules/pi-lens/dist/clients/cargo-manifest.js +422 -0
  52. package/node_modules/pi-lens/dist/clients/cascade-logger.js +2 -9
  53. package/node_modules/pi-lens/dist/clients/child-unref.js +1 -19
  54. package/node_modules/pi-lens/dist/clients/code-quality-warnings.js +13 -3
  55. package/node_modules/pi-lens/dist/clients/complexity-client.js +16 -5
  56. package/node_modules/pi-lens/dist/clients/config-core/deny.js +221 -0
  57. package/node_modules/pi-lens/dist/clients/config-core/index.js +50 -0
  58. package/node_modules/pi-lens/dist/clients/config-core/merge.js +357 -0
  59. package/node_modules/pi-lens/dist/clients/config-core/normalize.js +340 -0
  60. package/node_modules/pi-lens/dist/clients/config-core/process-spec.js +248 -0
  61. package/node_modules/pi-lens/dist/clients/config-core/provenance.js +164 -0
  62. package/node_modules/pi-lens/dist/clients/config-core/records.js +218 -0
  63. package/node_modules/pi-lens/dist/clients/config-core/resolve.js +125 -0
  64. package/node_modules/pi-lens/dist/clients/config-core/safe-object.js +78 -0
  65. package/node_modules/pi-lens/dist/clients/config-core/schema.js +165 -0
  66. package/node_modules/pi-lens/dist/clients/config-diagnostic-codes.js +281 -0
  67. package/node_modules/pi-lens/dist/clients/config-locations.js +160 -0
  68. package/node_modules/pi-lens/dist/clients/config-resolve.js +789 -0
  69. package/node_modules/pi-lens/dist/clients/config-schema.js +234 -0
  70. package/node_modules/pi-lens/dist/clients/config-warn.js +407 -0
  71. package/node_modules/pi-lens/dist/clients/dead-code-client.js +19 -14
  72. package/node_modules/pi-lens/dist/clients/dead-code-logger.js +2 -6
  73. package/node_modules/pi-lens/dist/clients/deadline-utils.js +178 -0
  74. package/node_modules/pi-lens/dist/clients/debug-handles.js +2 -2
  75. package/node_modules/pi-lens/dist/clients/debug-heap.js +3 -3
  76. package/node_modules/pi-lens/dist/clients/deferred-lsp-work.js +106 -0
  77. package/node_modules/pi-lens/dist/clients/degradation-ledger.js +113 -7
  78. package/node_modules/pi-lens/dist/clients/dependency-checker.js +8 -19
  79. package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +1 -1
  80. package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +12 -9
  81. package/node_modules/pi-lens/dist/clients/diagnostic-logger.js +15 -5
  82. package/node_modules/pi-lens/dist/clients/dispatch/collect-later-tier.js +0 -4
  83. package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +162 -44
  84. package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +97 -0
  85. package/node_modules/pi-lens/dist/clients/dispatch/integration.js +27 -8
  86. package/node_modules/pi-lens/dist/clients/dispatch/lazy.js +0 -6
  87. package/node_modules/pi-lens/dist/clients/dispatch/pending-runner-findings.js +1 -1
  88. package/node_modules/pi-lens/dist/clients/dispatch/plan.js +0 -3
  89. package/node_modules/pi-lens/dist/clients/dispatch/rules/high-complexity.js +2 -2
  90. package/node_modules/pi-lens/dist/clients/dispatch/rules/high-fan-out.js +1 -1
  91. package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +0 -1
  92. package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +383 -27
  93. package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +0 -1
  94. package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +4 -1
  95. package/node_modules/pi-lens/dist/clients/dispatch/runners/credo.js +0 -1
  96. package/node_modules/pi-lens/dist/clients/dispatch/runners/cue-vet.js +0 -1
  97. package/node_modules/pi-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -1
  98. package/node_modules/pi-lens/dist/clients/dispatch/runners/detekt.js +0 -1
  99. package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -1
  100. package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +0 -1
  101. package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +0 -1
  102. package/node_modules/pi-lens/dist/clients/dispatch/runners/fact-rules.js +0 -1
  103. package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +0 -1
  104. package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +0 -1
  105. package/node_modules/pi-lens/dist/clients/dispatch/runners/go-vet.js +1 -3
  106. package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -1
  107. package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +0 -1
  108. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +0 -1
  109. package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +1 -2
  110. package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +0 -1
  111. package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +0 -1
  112. package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +0 -1
  113. package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +0 -1
  114. package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +0 -1
  115. package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +0 -1
  116. package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +14 -18
  117. package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +0 -1
  118. package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +0 -1
  119. package/node_modules/pi-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -1
  120. package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +6 -3
  121. package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +7 -4
  122. package/node_modules/pi-lens/dist/clients/dispatch/runners/rubocop.js +0 -1
  123. package/node_modules/pi-lens/dist/clients/dispatch/runners/ruff.js +1 -2
  124. package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +1 -3
  125. package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +1 -2
  126. package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +0 -1
  127. package/node_modules/pi-lens/dist/clients/dispatch/runners/spellcheck.js +4 -3
  128. package/node_modules/pi-lens/dist/clients/dispatch/runners/spotbugs.js +0 -1
  129. package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -1
  130. package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +0 -1
  131. package/node_modules/pi-lens/dist/clients/dispatch/runners/swiftlint.js +0 -1
  132. package/node_modules/pi-lens/dist/clients/dispatch/runners/taplo.js +0 -1
  133. package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +0 -1
  134. package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +0 -1
  135. package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -1
  136. package/node_modules/pi-lens/dist/clients/dispatch/runners/trivy-config.js +0 -1
  137. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/availability-policy.js +3 -0
  138. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +3 -67
  139. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +194 -80
  140. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +84 -15
  141. package/node_modules/pi-lens/dist/clients/dispatch/runners/utils.js +0 -21
  142. package/node_modules/pi-lens/dist/clients/dispatch/runners/vale.js +0 -1
  143. package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +2 -20
  144. package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +1 -1
  145. package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +0 -1
  146. package/node_modules/pi-lens/dist/clients/dispatch/utils/format-utils.js +2 -2
  147. package/node_modules/pi-lens/dist/clients/disposition-logger.js +3 -10
  148. package/node_modules/pi-lens/dist/clients/effective-config.js +403 -0
  149. package/node_modules/pi-lens/dist/clients/error-class.js +23 -0
  150. package/node_modules/pi-lens/dist/clients/event-loop-hold.js +274 -0
  151. package/node_modules/pi-lens/dist/clients/event-loop-monitor.js +2 -2
  152. package/node_modules/pi-lens/dist/clients/extension-log.js +2 -2
  153. package/node_modules/pi-lens/dist/clients/feature-hints.js +2 -1
  154. package/node_modules/pi-lens/dist/clients/file-kinds.js +1 -38
  155. package/node_modules/pi-lens/dist/clients/file-time.js +7 -2
  156. package/node_modules/pi-lens/dist/clients/file-utils.js +117 -10
  157. package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +50 -13
  158. package/node_modules/pi-lens/dist/clients/format-service.js +6 -2
  159. package/node_modules/pi-lens/dist/clients/formatters.js +385 -104
  160. package/node_modules/pi-lens/dist/clients/freshness-cadence.js +17 -0
  161. package/node_modules/pi-lens/dist/clients/generated-artifacts.js +116 -22
  162. package/node_modules/pi-lens/dist/clients/generation-guard.js +4 -9
  163. package/node_modules/pi-lens/dist/clients/git-guard.js +6 -1
  164. package/node_modules/pi-lens/dist/clients/go-client.js +39 -0
  165. package/node_modules/pi-lens/dist/clients/gradle-ktfmt-style.js +252 -0
  166. package/node_modules/pi-lens/dist/clients/grammar-source.js +3 -3
  167. package/node_modules/pi-lens/dist/clients/hashline-anchor.js +424 -0
  168. package/node_modules/pi-lens/dist/clients/hook-budgets.js +76 -0
  169. package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +5 -2
  170. package/node_modules/pi-lens/dist/clients/host-ports.js +1 -1
  171. package/node_modules/pi-lens/dist/clients/installer/index.js +289 -59
  172. package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh.js +84 -18
  173. package/node_modules/pi-lens/dist/clients/instance-reaper.js +110 -236
  174. package/node_modules/pi-lens/dist/clients/instance-registry.js +6 -3
  175. package/node_modules/pi-lens/dist/clients/language-profile.js +0 -9
  176. package/node_modules/pi-lens/dist/clients/language-registry.js +599 -0
  177. package/node_modules/pi-lens/dist/clients/latency-logger.js +165 -9
  178. package/node_modules/pi-lens/dist/clients/ledger-bounds.js +34 -1
  179. package/node_modules/pi-lens/dist/clients/lens-config.js +160 -30
  180. package/node_modules/pi-lens/dist/clients/lens-engine.js +33 -41
  181. package/node_modules/pi-lens/dist/clients/lens-events.js +1 -1
  182. package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +77 -6
  183. package/node_modules/pi-lens/dist/clients/lens-map.js +1 -1
  184. package/node_modules/pi-lens/dist/clients/log-cleanup.js +2 -38
  185. package/node_modules/pi-lens/dist/clients/lsp/aggregation.js +3 -1
  186. package/node_modules/pi-lens/dist/clients/lsp/client.js +172 -33
  187. package/node_modules/pi-lens/dist/clients/lsp/config.js +484 -158
  188. package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +1 -1
  189. package/node_modules/pi-lens/dist/clients/lsp/document-drift.js +1 -1
  190. package/node_modules/pi-lens/dist/clients/lsp/edits.js +18 -5
  191. package/node_modules/pi-lens/dist/clients/lsp/index.js +892 -96
  192. package/node_modules/pi-lens/dist/clients/lsp/inferred-project.js +1 -1
  193. package/node_modules/pi-lens/dist/clients/lsp/language.js +18 -177
  194. package/node_modules/pi-lens/dist/clients/lsp/launch.js +2 -1
  195. package/node_modules/pi-lens/dist/clients/lsp/path-utils.js +1 -1
  196. package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +5 -18
  197. package/node_modules/pi-lens/dist/clients/lsp/server.js +284 -147
  198. package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +116 -23
  199. package/node_modules/pi-lens/dist/clients/lsp/spawn-history.js +2 -7
  200. package/node_modules/pi-lens/dist/clients/lsp/sync-kind.js +0 -1
  201. package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +14 -7
  202. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/classification.js +6 -0
  203. package/node_modules/pi-lens/dist/clients/lsp/wait-policy/strategies.js +2 -1
  204. package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +1 -1
  205. package/node_modules/pi-lens/dist/clients/lsp-document-symbols.js +1 -1
  206. package/node_modules/pi-lens/dist/clients/lsp-mutation.js +163 -21
  207. package/node_modules/pi-lens/dist/clients/map-with-concurrency.js +36 -0
  208. package/node_modules/pi-lens/dist/clients/mcp/analyze.js +33 -4
  209. package/node_modules/pi-lens/dist/clients/mcp/session.js +5 -16
  210. package/node_modules/pi-lens/dist/clients/memory-sampler.js +8 -3
  211. package/node_modules/pi-lens/dist/clients/metrics-history.js +28 -107
  212. package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +3 -5
  213. package/node_modules/pi-lens/dist/clients/module-report.js +21 -46
  214. package/node_modules/pi-lens/dist/clients/mutating-tool.js +651 -0
  215. package/node_modules/pi-lens/dist/clients/mutation-attribution.js +368 -0
  216. package/node_modules/pi-lens/dist/clients/mutation-bridge.js +240 -0
  217. package/node_modules/pi-lens/dist/clients/ndjson-logger.js +247 -24
  218. package/node_modules/pi-lens/dist/clients/observed-mutation-sources.js +101 -0
  219. package/node_modules/pi-lens/dist/clients/observed-mutation.js +1215 -0
  220. package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +70 -28
  221. package/node_modules/pi-lens/dist/clients/opengrep-config.js +5 -1
  222. package/node_modules/pi-lens/dist/clients/package-manager.js +195 -26
  223. package/node_modules/pi-lens/dist/clients/partial-edit-apply.js +359 -80
  224. package/node_modules/pi-lens/dist/clients/path-attribution-telemetry.js +23 -7
  225. package/node_modules/pi-lens/dist/clients/path-keyed-map.js +21 -2
  226. package/node_modules/pi-lens/dist/clients/path-utils.js +451 -15
  227. package/node_modules/pi-lens/dist/clients/performance-report.js +2 -2
  228. package/node_modules/pi-lens/dist/clients/persist-debounce.js +8 -1
  229. package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +114 -0
  230. package/node_modules/pi-lens/dist/clients/pipeline.js +79 -18
  231. package/node_modules/pi-lens/dist/clients/probe-home-state.js +228 -0
  232. package/node_modules/pi-lens/dist/clients/process-bridge.js +66 -0
  233. package/node_modules/pi-lens/dist/clients/process-snapshot.js +68 -0
  234. package/node_modules/pi-lens/dist/clients/project-changes.js +1 -1
  235. package/node_modules/pi-lens/dist/clients/project-diagnostics/extractors.js +1 -1
  236. package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +4 -3
  237. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +1 -1
  238. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +1 -1
  239. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +1 -1
  240. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +1 -1
  241. package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +28 -4
  242. package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +51 -20
  243. package/node_modules/pi-lens/dist/clients/project-lens-config.js +438 -122
  244. package/node_modules/pi-lens/dist/clients/project-scan-policy.js +3 -51
  245. package/node_modules/pi-lens/dist/clients/project-snapshot.js +52 -24
  246. package/node_modules/pi-lens/dist/clients/python-environment.js +217 -0
  247. package/node_modules/pi-lens/dist/clients/python-provenance.js +639 -0
  248. package/node_modules/pi-lens/dist/clients/quiet-window.js +6 -1
  249. package/node_modules/pi-lens/dist/clients/read-bridge.js +13 -21
  250. package/node_modules/pi-lens/dist/clients/read-expansion.js +9 -46
  251. package/node_modules/pi-lens/dist/clients/read-guard-logger.js +16 -5
  252. package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +364 -212
  253. package/node_modules/pi-lens/dist/clients/read-guard.js +26 -2
  254. package/node_modules/pi-lens/dist/clients/recent-touches.js +2 -2
  255. package/node_modules/pi-lens/dist/clients/resource-sampler.js +195 -96
  256. package/node_modules/pi-lens/dist/clients/review-graph/builder.js +155 -114
  257. package/node_modules/pi-lens/dist/clients/review-graph/import-resolvers.js +1 -1
  258. package/node_modules/pi-lens/dist/clients/review-graph/service.js +55 -3
  259. package/node_modules/pi-lens/dist/clients/review-graph/shared-extraction-ir.js +7 -15
  260. package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +10 -74
  261. package/node_modules/pi-lens/dist/clients/review-graph-logger.js +9 -3
  262. package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +19 -3
  263. package/node_modules/pi-lens/dist/clients/runtime-context.js +49 -16
  264. package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +25 -6
  265. package/node_modules/pi-lens/dist/clients/runtime-session.js +184 -32
  266. package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +179 -36
  267. package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +797 -243
  268. package/node_modules/pi-lens/dist/clients/runtime-turn.js +1028 -53
  269. package/node_modules/pi-lens/dist/clients/rust-client.js +31 -0
  270. package/node_modules/pi-lens/dist/clients/safe-spawn.js +33 -10
  271. package/node_modules/pi-lens/dist/clients/sanitize.js +7 -12
  272. package/node_modules/pi-lens/dist/clients/scan-utils.js +1 -56
  273. package/node_modules/pi-lens/dist/clients/scratch-tree-policy.js +1 -3
  274. package/node_modules/pi-lens/dist/clients/security-scan-client.js +3 -0
  275. package/node_modules/pi-lens/dist/clients/session-lifecycle.js +1 -1
  276. package/node_modules/pi-lens/dist/clients/session-start-observability.js +79 -0
  277. package/node_modules/pi-lens/dist/clients/session-summary.js +0 -24
  278. package/node_modules/pi-lens/dist/clients/sessionstart-logger.js +12 -3
  279. package/node_modules/pi-lens/dist/clients/sgconfig.js +7 -6
  280. package/node_modules/pi-lens/dist/clients/shared-checkout-guard.js +1 -1
  281. package/node_modules/pi-lens/dist/clients/skills-resolver.js +105 -0
  282. package/node_modules/pi-lens/dist/clients/smells-rollup.js +4 -4
  283. package/node_modules/pi-lens/dist/clients/startup-scan.js +2 -10
  284. package/node_modules/pi-lens/dist/clients/string-utils.js +13 -0
  285. package/node_modules/pi-lens/dist/clients/subagent-mode.js +17 -4
  286. package/node_modules/pi-lens/dist/clients/test-runner-client.js +176 -39
  287. package/node_modules/pi-lens/dist/clients/test-runner-delivery.js +244 -0
  288. package/node_modules/pi-lens/dist/clients/tool-definition.js +41 -1
  289. package/node_modules/pi-lens/dist/clients/tool-policy.js +92 -22
  290. package/node_modules/pi-lens/dist/clients/tree-sitter-cache.js +40 -40
  291. package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +87 -100
  292. package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +2 -2
  293. package/node_modules/pi-lens/dist/clients/tree-sitter-query-loader.js +81 -1
  294. package/node_modules/pi-lens/dist/clients/tree-sitter-shared.js +51 -46
  295. package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +28 -0
  296. package/node_modules/pi-lens/dist/clients/tui-fit.js +0 -4
  297. package/node_modules/pi-lens/dist/clients/typos-config.js +5 -0
  298. package/node_modules/pi-lens/dist/clients/user-notify.js +6 -6
  299. package/node_modules/pi-lens/dist/clients/widget-state.js +191 -26
  300. package/node_modules/pi-lens/dist/clients/word-index-logger.js +2 -9
  301. package/node_modules/pi-lens/dist/clients/word-index-store.js +23 -12
  302. package/node_modules/pi-lens/dist/clients/word-index.js +252 -47
  303. package/node_modules/pi-lens/dist/clients/workspace-topology.js +8 -1
  304. package/node_modules/pi-lens/dist/clients/zizmor-config.js +4 -1
  305. package/node_modules/pi-lens/dist/index.js +65899 -55340
  306. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +3 -1
  307. package/node_modules/pi-lens/dist/mcp/build-staleness.js +1 -1
  308. package/node_modules/pi-lens/dist/mcp/server.js +127 -5
  309. package/node_modules/pi-lens/dist/scripts/lib/process-scan.mjs +583 -0
  310. package/node_modules/pi-lens/dist/scripts/lib/skills-predicate.mjs +129 -0
  311. package/node_modules/pi-lens/dist/tools/effective-config.js +89 -0
  312. package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +96 -25
  313. package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +104 -86
  314. package/node_modules/pi-lens/dist/tools/lsp-navigation.js +37 -16
  315. package/node_modules/pi-lens/dist/tools/lsp-structured-output.js +3 -3
  316. package/node_modules/pi-lens/dist/tools/render-compact.js +1 -1
  317. package/node_modules/pi-lens/dist/tools/shared.js +0 -1
  318. package/node_modules/pi-lens/dist/tools/symbol-search.js +1 -2
  319. package/node_modules/pi-lens/docs/agent-guide.md +64 -1
  320. package/node_modules/pi-lens/docs/configuration.md +222 -0
  321. package/node_modules/pi-lens/docs/dependencies.md +3 -3
  322. package/node_modules/pi-lens/docs/features.md +44 -5
  323. package/node_modules/pi-lens/docs/globalconfig.md +20 -0
  324. package/node_modules/pi-lens/docs/language-coverage.md +2 -2
  325. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +9 -1
  326. package/node_modules/pi-lens/docs/pi-lens-fixer.md +25 -0
  327. package/node_modules/pi-lens/docs/pi-lens-investigator.md +25 -0
  328. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +33 -0
  329. package/node_modules/pi-lens/docs/pi-lens-subagent.md +49 -0
  330. package/node_modules/pi-lens/docs/pi-lens-warden.md +55 -0
  331. package/node_modules/pi-lens/docs/public-api-stability.md +359 -0
  332. package/node_modules/pi-lens/docs/release-qa-baseline.md +190 -0
  333. package/node_modules/pi-lens/docs/servercapabilities.md +7 -3
  334. package/node_modules/pi-lens/docs/subagent-compat.md +110 -30
  335. package/node_modules/pi-lens/docs/tree-sitter_rules_catalog.md +2 -2
  336. package/node_modules/pi-lens/docs/word-index.md +1 -1
  337. package/node_modules/pi-lens/package.json +18 -35
  338. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-cross-language-method.yml +3 -3
  339. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-hallucinated-import.yml +2 -2
  340. package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-sql-injection.yml +12 -2
  341. package/node_modules/pi-lens/rules/typos/_typos.toml +4 -2
  342. package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +192 -1
  343. package/node_modules/pi-lens/scripts/install-selftest.mjs +58 -2
  344. package/node_modules/pi-lens/scripts/lib/skills-predicate.mjs +129 -0
  345. package/node_modules/pi-lens/scripts/lib/warm-loader-cache.mjs +1 -1
  346. package/node_modules/pi-lens/scripts/rpc-load-check.mjs +3 -1
  347. package/node_modules/pi-lens/scripts/warm-loader-cache.mjs +4 -2
  348. package/node_modules/pi-web-access/CHANGELOG.md +28 -0
  349. package/node_modules/pi-web-access/README.md +62 -15
  350. package/node_modules/pi-web-access/curator-page.ts +3 -1
  351. package/node_modules/pi-web-access/curator-server.ts +5 -1
  352. package/node_modules/pi-web-access/gemini-search.ts +8 -4
  353. package/node_modules/pi-web-access/github-extract.ts +242 -1
  354. package/node_modules/pi-web-access/index.ts +118 -64
  355. package/node_modules/pi-web-access/mistral-search.ts +281 -0
  356. package/node_modules/pi-web-access/package.json +2 -2
  357. package/node_modules/pi-web-access/perplexity.ts +14 -1
  358. package/node_modules/pi-web-access/utils.ts +23 -6
  359. package/node_modules/pi-web-access/xai-search.ts +96 -33
  360. package/package.json +6 -6
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Shared formatting utilities for the dispatch system.
3
3
  */
4
- export const EMOJI = {
4
+ const EMOJI = {
5
5
  blocking: "🔴",
6
6
  warning: "🟡",
7
7
  fixed: "✅",
@@ -12,7 +12,7 @@ export const EMOJI = {
12
12
  /**
13
13
  * Format a single diagnostic for display
14
14
  */
15
- export function formatDiagnostic(d) {
15
+ function formatDiagnostic(d) {
16
16
  const line = d.line ? `L${d.line}: ` : "";
17
17
  const indented = d.message.split("\n").join("\n ");
18
18
  const fix = d.fixSuggestion ? `\n 💡 Fix: ${d.fixSuggestion}` : "";
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * NDJSON telemetry log for diagnostic disposition marks (#690). Same shape as
3
- * clients/actionable-warnings-logger.ts: machine-global (getGlobalPiLensDir),
3
+ * clients/actionable-warnings-logger.ts: machine-global (getGlobalPiLensLogDir),
4
4
  * size-capped with a single `.log.1` backup, isTestMode no-op.
5
5
  *
6
6
  * Why a log at all: #181 identified false-positive marks flowing to telemetry
@@ -13,9 +13,9 @@
13
13
  */
14
14
  import * as path from "node:path";
15
15
  import { isTestMode } from "./env-utils.js";
16
- import { getGlobalPiLensDir } from "./file-utils.js";
16
+ import { getGlobalPiLensLogDir } from "./probe-home-state.js";
17
17
  import { createNdjsonLogger } from "./ndjson-logger.js";
18
- const DISPOSITION_LOG_DIR = getGlobalPiLensDir();
18
+ const DISPOSITION_LOG_DIR = getGlobalPiLensLogDir();
19
19
  const DISPOSITION_LOG_FILE = path.join(DISPOSITION_LOG_DIR, "dispositions.log");
20
20
  const DISPOSITION_LOG_BACKUP_FILE = path.join(DISPOSITION_LOG_DIR, "dispositions.log.1");
21
21
  const MAX_LOG_BYTES = Math.max(128 * 1024, Number.parseInt(process.env.PI_LENS_DISPOSITION_LOG_MAX_BYTES ?? "1048576", 10) || 1048576);
@@ -30,10 +30,3 @@ export function logDispositionEvent(entry) {
30
30
  }
31
31
  writer.log({ ts: new Date().toISOString(), ...entry });
32
32
  }
33
- export function getDispositionLogPath() {
34
- return DISPOSITION_LOG_FILE;
35
- }
36
- /** Resolve once all enqueued disposition writes are on disk. */
37
- export function flushDispositionLog() {
38
- return writer.flush();
39
- }
@@ -0,0 +1,403 @@
1
+ /**
2
+ * Effective-config introspection (#2427; the introspection addition to #2415).
3
+ *
4
+ * ONE query answers "why is X running / selected", which today costs log
5
+ * forensics across `lsp/config.ts`, `language-policy.ts` and the trust state.
6
+ * `LSPService.getCapabilitySnapshots` is the proven template: compute the
7
+ * answer once in the engine, project it through every adapter unchanged.
8
+ *
9
+ * Three rules this module is built on, and none of them is negotiable at a
10
+ * call site:
11
+ *
12
+ * 1. IT DECIDES NOTHING. Every answer is read back from the same production
13
+ * machinery the runtime uses — `resolvePiLensConfig` for the resolution,
14
+ * `explainServersForFile` for the LSP gates, `detectFileKind` +
15
+ * `getToolPlan` + `getAvailableRunners` for dispatch. A second evaluation
16
+ * that agreed with production today would disagree with it eventually, and
17
+ * an introspection surface that lies is worse than none.
18
+ * 2. IT REPORTS NOTHING. `resolveConfig` is pure and `reportPiLensConfigRecords`
19
+ * is a separate, explicit step (`config-core/index.ts`) precisely so a
20
+ * caller decides when a user gets warned. Asking "what is my config" must
21
+ * not emit a deprecation notice, and must not consume the warn-once latch
22
+ * that the loader needs — so this module carries record CODES and counts,
23
+ * and never calls the reporter.
24
+ * 3. THE REDACTED VIEW IS THE ONLY VIEW. There is no `redact: false`. Config
25
+ * file paths are rewritten home-relative, a custom server's argv is cut to
26
+ * `argv[0]`, and its environment is reduced to NAMES — the two places a
27
+ * secret actually lives (#2415 AC 4). The `redact` option exists only
28
+ * because the issue named it; it is `true` or absent, and both mean the
29
+ * same thing, so no future caller can spell an unredacted request.
30
+ */
31
+ import * as os from "node:os";
32
+ import * as path from "node:path";
33
+ import { compareKeys, provenanceFor, provenanceView, } from "./config-core/provenance.js";
34
+ import { LSP_NAMESPACE_KEY } from "./config-locations.js";
35
+ import { lspSectionOf, resolvePiLensConfig, summarizeConfigResolution, } from "./config-resolve.js";
36
+ import { getToolPlan } from "./dispatch/plan.js";
37
+ import { getAvailableRunners } from "./dispatch/integration.js";
38
+ import { detectFileKind } from "./file-kinds.js";
39
+ import { getGlobalPiLensDir } from "./file-utils.js";
40
+ import { resolveLanguage } from "./language-registry.js";
41
+ import { getPiLensGlobalConfigPath } from "./lens-config.js";
42
+ import { explainServersForFile, lspConfigOf, registerLSPConfig, } from "./lsp/config.js";
43
+ // The shared path-shape-aware containment comparator (#1150/#1152 defect
44
+ // shape) — the SAME one the session-root registry
45
+ // (`clients/lsp/session-roots.ts`) gates enrollment with. A second
46
+ // hand-rolled `path.relative`/prefix check here is how the two would drift
47
+ // apart on a Windows-shaped path (AGENTS.md defect shape 2).
48
+ import { isSameOrWithin } from "./lsp/server.js";
49
+ import { homeRelativePath } from "./path-utils.js";
50
+ import { compareOrdinal } from "./string-utils.js";
51
+ /** True when a `file` half is the rejection shape, not a resolved view. */
52
+ export function isEffectiveFileViewError(file) {
53
+ return "error" in file;
54
+ }
55
+ function countBy(items, key) {
56
+ const counts = {};
57
+ for (const item of items) {
58
+ const name = key(item);
59
+ counts[name] = (counts[name] ?? 0) + 1;
60
+ }
61
+ return counts;
62
+ }
63
+ /**
64
+ * Redact a `lsp.servers.<id>` entry.
65
+ *
66
+ * Deliberately NOT `redactProcessSpec`: that takes a built `ProcessSpec`, and
67
+ * a custom server is still the pre-#2416 bare `{ command, args, env }` shape.
68
+ * The INVARIANT is the same one and is spelled the same way — `argv[0]` and
69
+ * env NAMES survive, everything else does not — so when #2416 replaces the
70
+ * shape this projection is deleted rather than adapted.
71
+ */
72
+ function redactServerSpec(entry) {
73
+ if (typeof entry !== "object" || entry === null || Array.isArray(entry)) {
74
+ return undefined;
75
+ }
76
+ const record = entry;
77
+ const command = typeof record.command === "string" ? record.command : undefined;
78
+ const args = Array.isArray(record.args) ? record.args : [];
79
+ const env = typeof record.env === "object" && record.env !== null
80
+ ? Object.keys(record.env).sort(compareOrdinal)
81
+ : [];
82
+ return {
83
+ ...(command === undefined ? {} : { command }),
84
+ argvCount: (command === undefined ? 0 : 1) + args.length,
85
+ envNames: env,
86
+ };
87
+ }
88
+ /**
89
+ * The provenance of a SUBTREE — the entry at the pointer, else the nearest
90
+ * ancestor's, else the lowest-sorting leaf beneath it.
91
+ *
92
+ * `provenanceFor` walks UP only, and that is correct for its question: a leaf
93
+ * asks who decided it. An object node asks the opposite question. `merge()`
94
+ * records provenance at the leaves, so `lsp.servers.<id>` — an object — has no
95
+ * entry of its own and no ancestor with one either, and asking `provenanceFor`
96
+ * about it answers `undefined` for a section a file demonstrably contributed.
97
+ * Descending settles it: the entry sorts deterministically (`compareKeys`), so
98
+ * the same config produces the same attribution on every machine.
99
+ */
100
+ function provenanceOfSubtree(resolved, pointer) {
101
+ const own = provenanceFor(resolved, pointer);
102
+ if (own)
103
+ return own;
104
+ const prefix = `${pointer}/`;
105
+ let best;
106
+ for (const entry of resolved.provenance.values()) {
107
+ if (!entry.key.startsWith(prefix))
108
+ continue;
109
+ if (!best || compareKeys(entry.key, best.key) < 0)
110
+ best = entry;
111
+ }
112
+ return best;
113
+ }
114
+ /**
115
+ * The provenance entry governing a pointer, projected and home-relative.
116
+ *
117
+ * Goes through `provenanceFor`, which walks to the nearest ancestor — and for
118
+ * a deny union that ancestry now MATTERS (#2427 review round 2, F2).
119
+ * `merge()` records an entry at the array's own pointer AND one per surviving
120
+ * member, so `/lsp/disabledServers/0` and `/lsp/disabledServers`
121
+ * deliberately give DIFFERENT answers: the array names the tier that denied
122
+ * first, the member names the tier that contributed that member. Round 1 of
123
+ * this PR asserted they were the same, read the array entry for every server,
124
+ * and reported a project-tier denial as a global one. Asking about a member
125
+ * that has no entry of its own still falls back to the array, which is the
126
+ * walk doing its job rather than an accident.
127
+ */
128
+ function viewOf(entry, homeDir) {
129
+ if (!entry)
130
+ return undefined;
131
+ return {
132
+ key: entry.key,
133
+ tier: entry.tier,
134
+ ...(entry.file === undefined
135
+ ? {}
136
+ : { file: homeRelativePath(entry.file, homeDir) }),
137
+ ...(entry.trust === undefined ? {} : { trust: entry.trust }),
138
+ };
139
+ }
140
+ /**
141
+ * `{ decidedBy }`, or nothing when there is no provenance to report.
142
+ *
143
+ * A named helper because the alternative at the call site is a ternary inside a
144
+ * spread inside a ternary, which is the nesting SonarCloud flags and a reader
145
+ * has to unpick to learn one fact.
146
+ */
147
+ function decidedByOrNothing(entry) {
148
+ return entry === undefined ? {} : { decidedBy: entry };
149
+ }
150
+ /**
151
+ * The resolved model of pi-lens's configuration, with the provenance of every
152
+ * decision — and, for one file, which servers and tools that configuration
153
+ * selects or denies and why.
154
+ *
155
+ * ASKING CHANGES NOTHING (#2427 review round 3). The per-file half needs a
156
+ * workspace's registered LSP config — `getConfigForFile` answers EMPTY for a
157
+ * tree nothing initialized, which would report every server as selected — and
158
+ * round 2 got it by calling `initLSPConfig(cwd, { report: false })`. That
159
+ * inverted this surface's own guarantee: `initLSPConfig` is the session-root
160
+ * registry's single writer and the per-root config store's only producer, so
161
+ * a question about a foreign directory enrolled it as a served LSP root
162
+ * (widening the #2052 access gate) and, after ~40 such questions, evicted a
163
+ * live root's config from what was then a separate 32-entry LRU — silently
164
+ * lifting the operator's `disabledServers` denial, which is precisely what
165
+ * this surface promises cannot happen, and `shouldInitializeSessionRoot` never
166
+ * repaired it because the 128-entry registry still reported the root served.
167
+ * #2518 collapsed those two containers into one entry per root, so the second
168
+ * half of that failure is gone; the first half — a read-only query enrolling a
169
+ * foreign root at all — is still this surface's own to avoid
170
+ *
171
+ * So the query DERIVES the config instead: `lspConfigOf` (the projection
172
+ * `loadLSPConfig` returns, minus the notices — rule 2) through the same
173
+ * `registerLSPConfig` conversion, handed to `explainServersForFile` as an
174
+ * explicit argument. Same gate, same answer, no write.
175
+ *
176
+ * ONE RESOLUTION ANSWERS THE WHOLE QUERY (#2427 review round 5, F-R4-1), taken
177
+ * at the FILE's own directory whenever a file is asked about — matching what
178
+ * the runtime registers via `ensureLSPConfigInitialized(path.dirname(filePath))`,
179
+ * because a nested `repo/sub/.pi-lens.json` layer (config.ts header point 3)
180
+ * reaches the runtime's decision no other way (round 4, F1).
181
+ *
182
+ * Round 4 moved the GATES to that root and left the rest — the redacted spec,
183
+ * every `decidedBy`, the `documents` list — reading a SECOND resolution taken
184
+ * at the workspace root. Two roots, and they disagreed: the view named the
185
+ * root's definition of a server the runtime spawns from the nested one,
186
+ * attributed a nested denial to whichever tier denied first at the root, and
187
+ * omitted the nested document. Deriving both halves from a single resolution
188
+ * makes that class of disagreement unrepresentable rather than fixed.
189
+ *
190
+ * The file-directory root is a SUPERSET of the workspace's ONLY when `file`
191
+ * resolves inside `cwd` — the project walk runs upward and is
192
+ * ceiling-bounded, so a nested `file` naturally passes back through the
193
+ * workspace's own document on its way up. A `file` outside `cwd` has no such
194
+ * relationship: its own ancestry can omit the workspace's document entirely
195
+ * while `cwd` above still names the workspace, mislabelling a foreign tree's
196
+ * config as this workspace's own (#2520). So the containment is CONFINED, not
197
+ * assumed: a `file` that does not resolve inside `cwd` is rejected — with
198
+ * `file: { error }` naming the `cwd` it was measured against and the remedy
199
+ * (re-query with `cwd` set to the file's own workspace) — rather than
200
+ * answered from an unrelated root. This confinement is a trade the query
201
+ * makes deliberately, not a limitation to route around: it also rejects a
202
+ * SIBLING package in the SAME monorepo (`cwd` at `repo/packages/a`, `file`
203
+ * under `repo/packages/b`) even though both share a repo root, because the
204
+ * per-file half is only ever correct when it is a superset of the workspace
205
+ * half — a caller who wants package `b`'s answer queries with `cwd` set to
206
+ * `repo/packages/b`. When no `file` is asked about, or the confined one is
207
+ * used, the root IS (or nests under) the workspace `cwd`, and the fileless
208
+ * case is the view `pilens_health` takes on every call.
209
+ *
210
+ * The differentials are pinned in `tests/clients/effective-config.test.ts`.
211
+ */
212
+ export async function effectiveConfig(options = {}) {
213
+ const cwd = options.cwd ?? process.cwd();
214
+ const homeDir = options.homeDir ?? os.homedir();
215
+ // The resolution, at whichever directory this query is answered FROM.
216
+ //
217
+ // `homeDir` is threaded, unlike `initLSPConfig`'s hard-wired `os.homedir()`:
218
+ // this call answers for the workspace the CALLER named, so the project walk
219
+ // must stop at the `$HOME` the rest of the view is resolved against.
220
+ //
221
+ // No `onReadError`: rule 2. An unreadable file still shows up as a
222
+ // `PILENS_CFG_0001` record count below, so the answer is not silent — it
223
+ // just is not a second user-facing warning fired by a question. Nothing
224
+ // here reports at all, which is why the query no longer routes through
225
+ // `loadLSPConfig`: that loader's whole difference from this call is the
226
+ // notices, and the query wants the resolution, not the notices.
227
+ const resolveAt = (dir) => resolvePiLensConfig({
228
+ cwd: dir,
229
+ globalDir: getGlobalPiLensDir(),
230
+ globalConfigPath: getPiLensGlobalConfigPath(homeDir),
231
+ homeDir,
232
+ });
233
+ // The queried path resolves HERE, beside the resolution root it selects, so
234
+ // "is there a file half" is one condition rather than two a later edit could
235
+ // disagree on. It is relative to the WORKSPACE, not to `process.cwd()`: a
236
+ // caller that names a workspace and then a file inside it means that file,
237
+ // and a bare `path.resolve` would silently answer for a same-named path
238
+ // under the host process's own directory — a wrong answer wearing a
239
+ // confident shape.
240
+ const requestedFile = options.file === undefined ? undefined : path.resolve(cwd, options.file);
241
+ // CONFINED, not assumed (#2520). A `file` that resolves outside `cwd` has
242
+ // no containment relationship to the workspace this view is `cwd`-labelled
243
+ // as: its own ancestor walk can reach a `.pi-lens.json` the workspace never
244
+ // saw while omitting the workspace's own, and `resolveAt` below would
245
+ // silently answer for that unrelated tree. `isSameOrWithin` is the shared
246
+ // path-shape-aware comparator, not a hand-rolled prefix check, so a
247
+ // Windows-shaped `cwd`/`file` pair is judged the same way on every host OS.
248
+ const fileOutsideCwd = requestedFile !== undefined && !isSameOrWithin(cwd, requestedFile);
249
+ const absolute = fileOutsideCwd ? undefined : requestedFile;
250
+ // ONE RESOLUTION ANSWERS THE WHOLE QUERY (#2427 review round 5, F-R4-1),
251
+ // and its root is the FILE's own directory whenever a CONFINED file is
252
+ // asked about.
253
+ //
254
+ // The runtime registers LSP config at that directory —
255
+ // `ensureLSPConfigInitialized(path.dirname(filePath))` in
256
+ // `runtime-tool-call.ts` — and `getConfigForFile` answers with the deepest
257
+ // registered ancestor, so a nested `repo/sub/.pi-lens.json` (config.ts
258
+ // header point 3) only reaches the runtime's decision through the file's
259
+ // own directory. Round 4 fixed the GATES that way but left every other fact
260
+ // — the redacted spec, every `decidedBy`, the `documents` list — read off a
261
+ // second resolution taken at the workspace root, so the query had two
262
+ // resolution roots and they disagreed: it reported the root's definition of
263
+ // a server the runtime spawns from the nested one, attributed a nested deny
264
+ // to whichever tier denied FIRST at the root (the round-2 F2
265
+ // misattribution, reopened), and omitted the nested document entirely. One
266
+ // resolution makes the two halves unable to disagree by construction.
267
+ //
268
+ // A rejected (outside-`cwd`) file falls back to `cwd` itself here, same as
269
+ // no file at all — the walk never touches the foreign tree.
270
+ const resolution = resolveAt(absolute === undefined ? cwd : path.dirname(absolute));
271
+ const resolved = {
272
+ value: resolution.value,
273
+ provenance: resolution.provenance,
274
+ };
275
+ // The redacted document list and the per-tier counts come from the SHARED
276
+ // projection (#2526), not from a second copy of the mapping here: the
277
+ // `config_resolved` latency phase writes the same summary at session start,
278
+ // and a surface that answers "what is my config" must not be able to
279
+ // disagree with the record that says what was resolved.
280
+ const summary = summarizeConfigResolution(resolution, homeDir);
281
+ // Home-relative, like every path this module reports (rule 3) — including
282
+ // the one named back in the rejection message below, so an agent reading
283
+ // `file: { error }` sees the SAME `cwd` spelling the rest of the view
284
+ // uses, not a second, raw-path rendering of it.
285
+ const homeRelativeCwd = homeRelativePath(cwd, homeDir);
286
+ const view = {
287
+ cwd: homeRelativeCwd,
288
+ documents: summary.documents,
289
+ provenance: provenanceView(resolved, homeDir).entries,
290
+ provenanceCounts: summary.countsByTier,
291
+ recordCounts: countBy(resolution.records, (record) => record.code),
292
+ ...(fileOutsideCwd
293
+ ? {
294
+ file: {
295
+ error: `file is outside cwd (${homeRelativeCwd}); query with cwd set ` +
296
+ "to the file's own workspace instead",
297
+ },
298
+ }
299
+ : absolute === undefined
300
+ ? {}
301
+ : {
302
+ file: await fileView(absolute, resolved, homeDir,
303
+ // The gates read the LSP slice of that SAME resolution, through
304
+ // the same `registerLSPConfig` conversion `initLSPConfig` uses —
305
+ // no session-root registration, no per-root config-store write
306
+ // (P11/P12). Computed here rather than hoisted into a
307
+ // `{ absolute, lspConfig }` struct (#2520): `absolute` is already
308
+ // this branch's narrowed local, so the struct's own field was
309
+ // carrying the same fact twice.
310
+ registerLSPConfig(lspConfigOf(resolution.value))),
311
+ }),
312
+ };
313
+ return view;
314
+ }
315
+ /**
316
+ * Why a runner is or is not in the plan for a file.
317
+ *
318
+ * A named function rather than a nested ternary at the call site (#2427
319
+ * review round 2, F3): the two-level conditional was one of the nesting
320
+ * hits SonarCloud raises on this file, and the three answers read as a table
321
+ * here.
322
+ */
323
+ function toolReason(selected, kind) {
324
+ if (selected)
325
+ return "selected";
326
+ return kind === undefined ? "no-dispatch-plan" : "not-registered-for-kind";
327
+ }
328
+ async function fileView(absolute, resolved, homeDir, lspConfig) {
329
+ const language = resolveLanguage(absolute);
330
+ const kind = detectFileKind(absolute);
331
+ const section = lspSectionOf(resolved.value);
332
+ const customServers = typeof section.servers === "object" &&
333
+ section.servers !== null &&
334
+ !Array.isArray(section.servers)
335
+ ? section.servers
336
+ : {};
337
+ // The provenance that answers "why can I not turn THIS one back on".
338
+ //
339
+ // Per MEMBER, not per array (#2427 review round 2, F2). The union is
340
+ // assembled from several tiers, so the array's own entry names only the tier
341
+ // that denied FIRST; stamping it on every disabled server reported a
342
+ // project-tier denial as a global one. `merge()` records an entry at each
343
+ // member's pointer, so the answer is a lookup at the member's index in the
344
+ // resolved list.
345
+ //
346
+ // The legacy root spelling is no longer a fallback: `resolvePiLensConfig`
347
+ // normalizes it into the namespace at source injection, so `/disabledServers`
348
+ // is not a pointer any resolution produces any more (F1).
349
+ const denied = Array.isArray(section.disabledServers)
350
+ ? section.disabledServers
351
+ : [];
352
+ const denyPointer = `/${LSP_NAMESPACE_KEY}/disabledServers`;
353
+ const decidedByDeny = (id) => {
354
+ const index = denied.indexOf(id);
355
+ // `provenanceFor` walks UP, so a member with no entry of its own still
356
+ // answers with the array's — the right degradation, not a silent gap.
357
+ return viewOf(provenanceFor(resolved, index >= 0 ? `${denyPointer}/${index}` : denyPointer), homeDir);
358
+ };
359
+ const servers = explainServersForFile(absolute, lspConfig).map((entry) => {
360
+ const spec = redactServerSpec(customServers[entry.server.id]);
361
+ return {
362
+ id: entry.server.id,
363
+ selected: entry.selected,
364
+ reason: entry.reason,
365
+ ...(entry.server.role === undefined ? {} : { role: entry.server.role }),
366
+ ...(entry.reason === "disabled-by-config"
367
+ ? decidedByOrNothing(decidedByDeny(entry.server.id))
368
+ : {}),
369
+ ...(spec === undefined
370
+ ? {}
371
+ : {
372
+ spec,
373
+ ...(entry.reason === "disabled-by-config"
374
+ ? {}
375
+ : {
376
+ decidedBy: viewOf(provenanceOfSubtree(resolved, `/${LSP_NAMESPACE_KEY}/servers/${entry.server.id}`) ??
377
+ provenanceOfSubtree(resolved, `/servers/${entry.server.id}`), homeDir),
378
+ }),
379
+ }),
380
+ };
381
+ });
382
+ const available = new Set(await getAvailableRunners(absolute));
383
+ const planned = kind
384
+ ? (getToolPlan(kind)?.groups.flatMap((group) => group.runnerIds) ?? [])
385
+ : [];
386
+ // Ordinal, not the default locale sort: this list is the ORDER of a payload
387
+ // callers compare across machines, and a locale-sensitive comparator can
388
+ // order the same ids differently under a different ICU build (#2427 review
389
+ // round 2, F3; SonarCloud S2871).
390
+ const ids = [...new Set([...planned, ...available])].sort(compareOrdinal);
391
+ const tools = ids.map((id) => ({
392
+ id,
393
+ selected: available.has(id),
394
+ reason: toolReason(available.has(id), kind),
395
+ }));
396
+ return {
397
+ path: homeRelativePath(absolute, homeDir),
398
+ ...(language === undefined ? {} : { language: language.id }),
399
+ ...(kind === undefined ? {} : { kind }),
400
+ servers,
401
+ tools,
402
+ };
403
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * The class name of a caught error, and NOTHING else — never the message,
3
+ * which for some callers could quote content they do not want to risk
4
+ * surfacing (a config-core bug thrown while walking the raw, untrusted
5
+ * parsed document; a whole-resolution catch wrapping several stages at
6
+ * once). One leaf so that guarantee does not grow a third, fourth, and
7
+ * fifth hand-rolled `error instanceof Error ? error.name : "unknown error"`
8
+ * (#2451 — `clients/config-warn.ts`'s `normalizeParseErrorReason` (the
9
+ * `classOnly` option), `clients/config-core/normalize.ts`,
10
+ * `clients/config-core/resolve.ts`, and `clients/lens-config.ts` all call
11
+ * this instead of inlining their own copy).
12
+ *
13
+ * Zero imports of its own, deliberately: `config-core/` must never import a
14
+ * sink (`clients/config-warn.ts` -> the degradation ledger) — that exact
15
+ * import closed seven cycles when #2426 removed it, and importing
16
+ * `normalizeParseErrorReason` from inside `config-core/` to get this one
17
+ * value back would reopen them. This leaf is how `config-warn.ts` and
18
+ * `config-core/*.ts` share ONE implementation without either importing the
19
+ * other.
20
+ */
21
+ export function errorClassName(error) {
22
+ return error instanceof Error ? error.name : "unknown error";
23
+ }