@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.
- package/node_modules/@czottmann/pi-automode/CHANGELOG.md +13 -1
- package/node_modules/@czottmann/pi-automode/README.md +20 -0
- package/node_modules/@czottmann/pi-automode/docs/GLOSSARY.md +1 -1
- package/node_modules/@czottmann/pi-automode/docs/automode-classifier-flow.md +2 -1
- package/node_modules/@czottmann/pi-automode/docs/defaults.md +3 -2
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/classifier.ts +38 -2
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/constants.ts +5 -3
- package/node_modules/@czottmann/pi-automode/extensions/auto-mode/extension.ts +11 -3
- package/node_modules/@czottmann/pi-automode/package.json +1 -1
- package/node_modules/@narumitw/pi-btw/README.md +57 -141
- package/node_modules/@narumitw/pi-btw/dist/index.ts +466 -41
- package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
- package/node_modules/@narumitw/pi-btw/docs/workflows.md +74 -0
- package/node_modules/@narumitw/pi-btw/package.json +2 -1
- package/node_modules/@narumitw/pi-btw/src/btw.ts +15 -1
- package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +32 -2
- package/node_modules/@narumitw/pi-btw/src/keybindings.ts +330 -0
- package/node_modules/@narumitw/pi-btw/src/menu.ts +136 -19
- package/node_modules/@narumitw/pi-btw/src/settings.ts +32 -0
- package/node_modules/@narumitw/pi-btw/src/side-thread.ts +57 -5
- package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +52 -30
- package/node_modules/@pi-plugins/fast-mode/README.md +5 -3
- package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +20 -55
- package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
- package/node_modules/@pi-plugins/fast-mode/package.json +1 -1
- package/node_modules/pi-lens/CHANGELOG.md +1072 -0
- package/node_modules/pi-lens/README.md +3 -0
- package/node_modules/pi-lens/config/biome/core.jsonc +11 -2
- package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +13 -1
- package/node_modules/pi-lens/dist/clients/actionable-warnings-logger.js +2 -9
- package/node_modules/pi-lens/dist/clients/actionable-warnings.js +927 -80
- package/node_modules/pi-lens/dist/clients/advisory-provenance.js +1 -1
- package/node_modules/pi-lens/dist/clients/agent-behavior-client.js +13 -4
- package/node_modules/pi-lens/dist/clients/ast-grep-client.js +123 -3
- package/node_modules/pi-lens/dist/clients/ast-grep-rule-manager.js +60 -5
- package/node_modules/pi-lens/dist/clients/ast-grep-tool-logger.js +2 -9
- package/node_modules/pi-lens/dist/clients/ast-grep-types.js +2 -0
- package/node_modules/pi-lens/dist/clients/bash-file-access.js +133 -3
- package/node_modules/pi-lens/dist/clients/biome-client.js +9 -2
- package/node_modules/pi-lens/dist/clients/blocker-freshness.js +14 -6
- package/node_modules/pi-lens/dist/clients/bootstrap.js +509 -73
- package/node_modules/pi-lens/dist/clients/bounded-cache.js +152 -12
- package/node_modules/pi-lens/dist/clients/bounded-pid-file-lock.js +1 -1
- package/node_modules/pi-lens/dist/clients/bounded-telemetry.js +59 -9
- package/node_modules/pi-lens/dist/clients/bundled-resource-health.js +113 -0
- package/node_modules/pi-lens/dist/clients/bus-events-logger.js +3 -11
- package/node_modules/pi-lens/dist/clients/cache/rule-cache.js +31 -4
- package/node_modules/pi-lens/dist/clients/cache-manager.js +105 -6
- package/node_modules/pi-lens/dist/clients/cache-observability.js +40 -19
- package/node_modules/pi-lens/dist/clients/cargo-manifest.js +422 -0
- package/node_modules/pi-lens/dist/clients/cascade-logger.js +2 -9
- package/node_modules/pi-lens/dist/clients/child-unref.js +1 -19
- package/node_modules/pi-lens/dist/clients/code-quality-warnings.js +13 -3
- package/node_modules/pi-lens/dist/clients/complexity-client.js +16 -5
- package/node_modules/pi-lens/dist/clients/config-core/deny.js +221 -0
- package/node_modules/pi-lens/dist/clients/config-core/index.js +50 -0
- package/node_modules/pi-lens/dist/clients/config-core/merge.js +357 -0
- package/node_modules/pi-lens/dist/clients/config-core/normalize.js +340 -0
- package/node_modules/pi-lens/dist/clients/config-core/process-spec.js +248 -0
- package/node_modules/pi-lens/dist/clients/config-core/provenance.js +164 -0
- package/node_modules/pi-lens/dist/clients/config-core/records.js +218 -0
- package/node_modules/pi-lens/dist/clients/config-core/resolve.js +125 -0
- package/node_modules/pi-lens/dist/clients/config-core/safe-object.js +78 -0
- package/node_modules/pi-lens/dist/clients/config-core/schema.js +165 -0
- package/node_modules/pi-lens/dist/clients/config-diagnostic-codes.js +281 -0
- package/node_modules/pi-lens/dist/clients/config-locations.js +160 -0
- package/node_modules/pi-lens/dist/clients/config-resolve.js +789 -0
- package/node_modules/pi-lens/dist/clients/config-schema.js +234 -0
- package/node_modules/pi-lens/dist/clients/config-warn.js +407 -0
- package/node_modules/pi-lens/dist/clients/dead-code-client.js +19 -14
- package/node_modules/pi-lens/dist/clients/dead-code-logger.js +2 -6
- package/node_modules/pi-lens/dist/clients/deadline-utils.js +178 -0
- package/node_modules/pi-lens/dist/clients/debug-handles.js +2 -2
- package/node_modules/pi-lens/dist/clients/debug-heap.js +3 -3
- package/node_modules/pi-lens/dist/clients/deferred-lsp-work.js +106 -0
- package/node_modules/pi-lens/dist/clients/degradation-ledger.js +113 -7
- package/node_modules/pi-lens/dist/clients/dependency-checker.js +8 -19
- package/node_modules/pi-lens/dist/clients/diagnostic-dispositions.js +1 -1
- package/node_modules/pi-lens/dist/clients/diagnostic-line-freshness.js +12 -9
- package/node_modules/pi-lens/dist/clients/diagnostic-logger.js +15 -5
- package/node_modules/pi-lens/dist/clients/dispatch/collect-later-tier.js +0 -4
- package/node_modules/pi-lens/dist/clients/dispatch/dispatcher.js +162 -44
- package/node_modules/pi-lens/dist/clients/dispatch/fact-store.js +97 -0
- package/node_modules/pi-lens/dist/clients/dispatch/integration.js +27 -8
- package/node_modules/pi-lens/dist/clients/dispatch/lazy.js +0 -6
- package/node_modules/pi-lens/dist/clients/dispatch/pending-runner-findings.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/plan.js +0 -3
- package/node_modules/pi-lens/dist/clients/dispatch/rules/high-complexity.js +2 -2
- package/node_modules/pi-lens/dist/clients/dispatch/rules/high-fan-out.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/actionlint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ast-grep-napi.js +383 -27
- package/node_modules/pi-lens/dist/clients/dispatch/runners/biome-check.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cpp-check.js +4 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/credo.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/cue-vet.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dart-analyze.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/detekt.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/dotnet-build.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/elixir-check.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/eslint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/fact-rules.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/fish-indent.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/gleam-check.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/go-vet.js +1 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/golangci-lint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/hadolint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-lint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/helm-render.js +1 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/htmlhint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/javac.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ktlint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/lsp.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/markdownlint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/mypy.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/oxlint.js +14 -18
- package/node_modules/pi-lens/dist/clients/dispatch/runners/php-lint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/phpstan.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/prisma-validate.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/psscriptanalyzer.js +6 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/pyright.js +7 -4
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rubocop.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/ruff.js +1 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/rust-clippy.js +1 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shellcheck.js +1 -2
- package/node_modules/pi-lens/dist/clients/dispatch/runners/shfmt.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/spellcheck.js +4 -3
- package/node_modules/pi-lens/dist/clients/dispatch/runners/spotbugs.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/sqlfluff.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/stylelint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/swiftlint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/taplo.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/terragrunt.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tflint.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/tree-sitter.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/trivy-config.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/availability-policy.js +3 -0
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/diagnostic-parsers.js +3 -67
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/runner-helpers.js +194 -80
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils/toolchain-availability.js +84 -15
- package/node_modules/pi-lens/dist/clients/dispatch/runners/utils.js +0 -21
- package/node_modules/pi-lens/dist/clients/dispatch/runners/vale.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yaml-rule-parser.js +2 -20
- package/node_modules/pi-lens/dist/clients/dispatch/runners/yamllint.js +1 -1
- package/node_modules/pi-lens/dist/clients/dispatch/runners/zig-check.js +0 -1
- package/node_modules/pi-lens/dist/clients/dispatch/utils/format-utils.js +2 -2
- package/node_modules/pi-lens/dist/clients/disposition-logger.js +3 -10
- package/node_modules/pi-lens/dist/clients/effective-config.js +403 -0
- package/node_modules/pi-lens/dist/clients/error-class.js +23 -0
- package/node_modules/pi-lens/dist/clients/event-loop-hold.js +274 -0
- package/node_modules/pi-lens/dist/clients/event-loop-monitor.js +2 -2
- package/node_modules/pi-lens/dist/clients/extension-log.js +2 -2
- package/node_modules/pi-lens/dist/clients/feature-hints.js +2 -1
- package/node_modules/pi-lens/dist/clients/file-kinds.js +1 -38
- package/node_modules/pi-lens/dist/clients/file-time.js +7 -2
- package/node_modules/pi-lens/dist/clients/file-utils.js +117 -10
- package/node_modules/pi-lens/dist/clients/finding-delivery-gate.js +50 -13
- package/node_modules/pi-lens/dist/clients/format-service.js +6 -2
- package/node_modules/pi-lens/dist/clients/formatters.js +385 -104
- package/node_modules/pi-lens/dist/clients/freshness-cadence.js +17 -0
- package/node_modules/pi-lens/dist/clients/generated-artifacts.js +116 -22
- package/node_modules/pi-lens/dist/clients/generation-guard.js +4 -9
- package/node_modules/pi-lens/dist/clients/git-guard.js +6 -1
- package/node_modules/pi-lens/dist/clients/go-client.js +39 -0
- package/node_modules/pi-lens/dist/clients/gradle-ktfmt-style.js +252 -0
- package/node_modules/pi-lens/dist/clients/grammar-source.js +3 -3
- package/node_modules/pi-lens/dist/clients/hashline-anchor.js +424 -0
- package/node_modules/pi-lens/dist/clients/hook-budgets.js +76 -0
- package/node_modules/pi-lens/dist/clients/host-edit-normalize.js +5 -2
- package/node_modules/pi-lens/dist/clients/host-ports.js +1 -1
- package/node_modules/pi-lens/dist/clients/installer/index.js +289 -59
- package/node_modules/pi-lens/dist/clients/installer/managed-tool-refresh.js +84 -18
- package/node_modules/pi-lens/dist/clients/instance-reaper.js +110 -236
- package/node_modules/pi-lens/dist/clients/instance-registry.js +6 -3
- package/node_modules/pi-lens/dist/clients/language-profile.js +0 -9
- package/node_modules/pi-lens/dist/clients/language-registry.js +599 -0
- package/node_modules/pi-lens/dist/clients/latency-logger.js +165 -9
- package/node_modules/pi-lens/dist/clients/ledger-bounds.js +34 -1
- package/node_modules/pi-lens/dist/clients/lens-config.js +160 -30
- package/node_modules/pi-lens/dist/clients/lens-engine.js +33 -41
- package/node_modules/pi-lens/dist/clients/lens-events.js +1 -1
- package/node_modules/pi-lens/dist/clients/lens-flag-registry.js +77 -6
- package/node_modules/pi-lens/dist/clients/lens-map.js +1 -1
- package/node_modules/pi-lens/dist/clients/log-cleanup.js +2 -38
- package/node_modules/pi-lens/dist/clients/lsp/aggregation.js +3 -1
- package/node_modules/pi-lens/dist/clients/lsp/client.js +172 -33
- package/node_modules/pi-lens/dist/clients/lsp/config.js +484 -158
- package/node_modules/pi-lens/dist/clients/lsp/diagnostic-binding.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp/document-drift.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp/edits.js +18 -5
- package/node_modules/pi-lens/dist/clients/lsp/index.js +892 -96
- package/node_modules/pi-lens/dist/clients/lsp/inferred-project.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp/language.js +18 -177
- package/node_modules/pi-lens/dist/clients/lsp/launch.js +2 -1
- package/node_modules/pi-lens/dist/clients/lsp/path-utils.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp/pending-aux-coverage.js +5 -18
- package/node_modules/pi-lens/dist/clients/lsp/server.js +284 -147
- package/node_modules/pi-lens/dist/clients/lsp/session-roots.js +116 -23
- package/node_modules/pi-lens/dist/clients/lsp/spawn-history.js +2 -7
- package/node_modules/pi-lens/dist/clients/lsp/sync-kind.js +0 -1
- package/node_modules/pi-lens/dist/clients/lsp/tsserver-sync.js +14 -7
- package/node_modules/pi-lens/dist/clients/lsp/wait-policy/classification.js +6 -0
- package/node_modules/pi-lens/dist/clients/lsp/wait-policy/strategies.js +2 -1
- package/node_modules/pi-lens/dist/clients/lsp/workspace-diagnostics-cache.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp-document-symbols.js +1 -1
- package/node_modules/pi-lens/dist/clients/lsp-mutation.js +163 -21
- package/node_modules/pi-lens/dist/clients/map-with-concurrency.js +36 -0
- package/node_modules/pi-lens/dist/clients/mcp/analyze.js +33 -4
- package/node_modules/pi-lens/dist/clients/mcp/session.js +5 -16
- package/node_modules/pi-lens/dist/clients/memory-sampler.js +8 -3
- package/node_modules/pi-lens/dist/clients/metrics-history.js +28 -107
- package/node_modules/pi-lens/dist/clients/middle-man-analysis.js +3 -5
- package/node_modules/pi-lens/dist/clients/module-report.js +21 -46
- package/node_modules/pi-lens/dist/clients/mutating-tool.js +651 -0
- package/node_modules/pi-lens/dist/clients/mutation-attribution.js +368 -0
- package/node_modules/pi-lens/dist/clients/mutation-bridge.js +240 -0
- package/node_modules/pi-lens/dist/clients/ndjson-logger.js +247 -24
- package/node_modules/pi-lens/dist/clients/observed-mutation-sources.js +101 -0
- package/node_modules/pi-lens/dist/clients/observed-mutation.js +1215 -0
- package/node_modules/pi-lens/dist/clients/opaque-mutation-scan.js +70 -28
- package/node_modules/pi-lens/dist/clients/opengrep-config.js +5 -1
- package/node_modules/pi-lens/dist/clients/package-manager.js +195 -26
- package/node_modules/pi-lens/dist/clients/partial-edit-apply.js +359 -80
- package/node_modules/pi-lens/dist/clients/path-attribution-telemetry.js +23 -7
- package/node_modules/pi-lens/dist/clients/path-keyed-map.js +21 -2
- package/node_modules/pi-lens/dist/clients/path-utils.js +451 -15
- package/node_modules/pi-lens/dist/clients/performance-report.js +2 -2
- package/node_modules/pi-lens/dist/clients/persist-debounce.js +8 -1
- package/node_modules/pi-lens/dist/clients/php-cs-fixer-config.js +114 -0
- package/node_modules/pi-lens/dist/clients/pipeline.js +79 -18
- package/node_modules/pi-lens/dist/clients/probe-home-state.js +228 -0
- package/node_modules/pi-lens/dist/clients/process-bridge.js +66 -0
- package/node_modules/pi-lens/dist/clients/process-snapshot.js +68 -0
- package/node_modules/pi-lens/dist/clients/project-changes.js +1 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/extractors.js +1 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/fresh-fetch.js +4 -3
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/jscpd.js +1 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/knip.js +1 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/madge.js +1 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/opengrep.js +1 -1
- package/node_modules/pi-lens/dist/clients/project-diagnostics/runner-adapters/runner-findings.js +28 -4
- package/node_modules/pi-lens/dist/clients/project-diagnostics/scanner.js +51 -20
- package/node_modules/pi-lens/dist/clients/project-lens-config.js +438 -122
- package/node_modules/pi-lens/dist/clients/project-scan-policy.js +3 -51
- package/node_modules/pi-lens/dist/clients/project-snapshot.js +52 -24
- package/node_modules/pi-lens/dist/clients/python-environment.js +217 -0
- package/node_modules/pi-lens/dist/clients/python-provenance.js +639 -0
- package/node_modules/pi-lens/dist/clients/quiet-window.js +6 -1
- package/node_modules/pi-lens/dist/clients/read-bridge.js +13 -21
- package/node_modules/pi-lens/dist/clients/read-expansion.js +9 -46
- package/node_modules/pi-lens/dist/clients/read-guard-logger.js +16 -5
- package/node_modules/pi-lens/dist/clients/read-guard-tool-lines.js +364 -212
- package/node_modules/pi-lens/dist/clients/read-guard.js +26 -2
- package/node_modules/pi-lens/dist/clients/recent-touches.js +2 -2
- package/node_modules/pi-lens/dist/clients/resource-sampler.js +195 -96
- package/node_modules/pi-lens/dist/clients/review-graph/builder.js +155 -114
- package/node_modules/pi-lens/dist/clients/review-graph/import-resolvers.js +1 -1
- package/node_modules/pi-lens/dist/clients/review-graph/service.js +55 -3
- package/node_modules/pi-lens/dist/clients/review-graph/shared-extraction-ir.js +7 -15
- package/node_modules/pi-lens/dist/clients/review-graph/workspace-modules.js +10 -74
- package/node_modules/pi-lens/dist/clients/review-graph-logger.js +9 -3
- package/node_modules/pi-lens/dist/clients/runtime-agent-end.js +19 -3
- package/node_modules/pi-lens/dist/clients/runtime-context.js +49 -16
- package/node_modules/pi-lens/dist/clients/runtime-coordinator.js +25 -6
- package/node_modules/pi-lens/dist/clients/runtime-session.js +184 -32
- package/node_modules/pi-lens/dist/clients/runtime-tool-call.js +179 -36
- package/node_modules/pi-lens/dist/clients/runtime-tool-result.js +797 -243
- package/node_modules/pi-lens/dist/clients/runtime-turn.js +1028 -53
- package/node_modules/pi-lens/dist/clients/rust-client.js +31 -0
- package/node_modules/pi-lens/dist/clients/safe-spawn.js +33 -10
- package/node_modules/pi-lens/dist/clients/sanitize.js +7 -12
- package/node_modules/pi-lens/dist/clients/scan-utils.js +1 -56
- package/node_modules/pi-lens/dist/clients/scratch-tree-policy.js +1 -3
- package/node_modules/pi-lens/dist/clients/security-scan-client.js +3 -0
- package/node_modules/pi-lens/dist/clients/session-lifecycle.js +1 -1
- package/node_modules/pi-lens/dist/clients/session-start-observability.js +79 -0
- package/node_modules/pi-lens/dist/clients/session-summary.js +0 -24
- package/node_modules/pi-lens/dist/clients/sessionstart-logger.js +12 -3
- package/node_modules/pi-lens/dist/clients/sgconfig.js +7 -6
- package/node_modules/pi-lens/dist/clients/shared-checkout-guard.js +1 -1
- package/node_modules/pi-lens/dist/clients/skills-resolver.js +105 -0
- package/node_modules/pi-lens/dist/clients/smells-rollup.js +4 -4
- package/node_modules/pi-lens/dist/clients/startup-scan.js +2 -10
- package/node_modules/pi-lens/dist/clients/string-utils.js +13 -0
- package/node_modules/pi-lens/dist/clients/subagent-mode.js +17 -4
- package/node_modules/pi-lens/dist/clients/test-runner-client.js +176 -39
- package/node_modules/pi-lens/dist/clients/test-runner-delivery.js +244 -0
- package/node_modules/pi-lens/dist/clients/tool-definition.js +41 -1
- package/node_modules/pi-lens/dist/clients/tool-policy.js +92 -22
- package/node_modules/pi-lens/dist/clients/tree-sitter-cache.js +40 -40
- package/node_modules/pi-lens/dist/clients/tree-sitter-client.js +87 -100
- package/node_modules/pi-lens/dist/clients/tree-sitter-logger.js +2 -2
- package/node_modules/pi-lens/dist/clients/tree-sitter-query-loader.js +81 -1
- package/node_modules/pi-lens/dist/clients/tree-sitter-shared.js +51 -46
- package/node_modules/pi-lens/dist/clients/tree-sitter-symbol-extractor.js +28 -0
- package/node_modules/pi-lens/dist/clients/tui-fit.js +0 -4
- package/node_modules/pi-lens/dist/clients/typos-config.js +5 -0
- package/node_modules/pi-lens/dist/clients/user-notify.js +6 -6
- package/node_modules/pi-lens/dist/clients/widget-state.js +191 -26
- package/node_modules/pi-lens/dist/clients/word-index-logger.js +2 -9
- package/node_modules/pi-lens/dist/clients/word-index-store.js +23 -12
- package/node_modules/pi-lens/dist/clients/word-index.js +252 -47
- package/node_modules/pi-lens/dist/clients/workspace-topology.js +8 -1
- package/node_modules/pi-lens/dist/clients/zizmor-config.js +4 -1
- package/node_modules/pi-lens/dist/index.js +65899 -55340
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +3 -1
- package/node_modules/pi-lens/dist/mcp/build-staleness.js +1 -1
- package/node_modules/pi-lens/dist/mcp/server.js +127 -5
- package/node_modules/pi-lens/dist/scripts/lib/process-scan.mjs +583 -0
- package/node_modules/pi-lens/dist/scripts/lib/skills-predicate.mjs +129 -0
- package/node_modules/pi-lens/dist/tools/effective-config.js +89 -0
- package/node_modules/pi-lens/dist/tools/lens-diagnostics.js +96 -25
- package/node_modules/pi-lens/dist/tools/lsp-diagnostics.js +104 -86
- package/node_modules/pi-lens/dist/tools/lsp-navigation.js +37 -16
- package/node_modules/pi-lens/dist/tools/lsp-structured-output.js +3 -3
- package/node_modules/pi-lens/dist/tools/render-compact.js +1 -1
- package/node_modules/pi-lens/dist/tools/shared.js +0 -1
- package/node_modules/pi-lens/dist/tools/symbol-search.js +1 -2
- package/node_modules/pi-lens/docs/agent-guide.md +64 -1
- package/node_modules/pi-lens/docs/configuration.md +222 -0
- package/node_modules/pi-lens/docs/dependencies.md +3 -3
- package/node_modules/pi-lens/docs/features.md +44 -5
- package/node_modules/pi-lens/docs/globalconfig.md +20 -0
- package/node_modules/pi-lens/docs/language-coverage.md +2 -2
- package/node_modules/pi-lens/docs/lsp-capability-matrix.md +9 -1
- package/node_modules/pi-lens/docs/pi-lens-fixer.md +25 -0
- package/node_modules/pi-lens/docs/pi-lens-investigator.md +25 -0
- package/node_modules/pi-lens/docs/pi-lens-reviewer.md +33 -0
- package/node_modules/pi-lens/docs/pi-lens-subagent.md +49 -0
- package/node_modules/pi-lens/docs/pi-lens-warden.md +55 -0
- package/node_modules/pi-lens/docs/public-api-stability.md +359 -0
- package/node_modules/pi-lens/docs/release-qa-baseline.md +190 -0
- package/node_modules/pi-lens/docs/servercapabilities.md +7 -3
- package/node_modules/pi-lens/docs/subagent-compat.md +110 -30
- package/node_modules/pi-lens/docs/tree-sitter_rules_catalog.md +2 -2
- package/node_modules/pi-lens/docs/word-index.md +1 -1
- package/node_modules/pi-lens/package.json +18 -35
- package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-cross-language-method.yml +3 -3
- package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-hallucinated-import.yml +2 -2
- package/node_modules/pi-lens/rules/tree-sitter-queries/python/python-sql-injection.yml +12 -2
- package/node_modules/pi-lens/rules/typos/_typos.toml +4 -2
- package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +192 -1
- package/node_modules/pi-lens/scripts/install-selftest.mjs +58 -2
- package/node_modules/pi-lens/scripts/lib/skills-predicate.mjs +129 -0
- package/node_modules/pi-lens/scripts/lib/warm-loader-cache.mjs +1 -1
- package/node_modules/pi-lens/scripts/rpc-load-check.mjs +3 -1
- package/node_modules/pi-lens/scripts/warm-loader-cache.mjs +4 -2
- package/node_modules/pi-web-access/CHANGELOG.md +28 -0
- package/node_modules/pi-web-access/README.md +62 -15
- package/node_modules/pi-web-access/curator-page.ts +3 -1
- package/node_modules/pi-web-access/curator-server.ts +5 -1
- package/node_modules/pi-web-access/gemini-search.ts +8 -4
- package/node_modules/pi-web-access/github-extract.ts +242 -1
- package/node_modules/pi-web-access/index.ts +118 -64
- package/node_modules/pi-web-access/mistral-search.ts +281 -0
- package/node_modules/pi-web-access/package.json +2 -2
- package/node_modules/pi-web-access/perplexity.ts +14 -1
- package/node_modules/pi-web-access/utils.ts +23 -6
- package/node_modules/pi-web-access/xai-search.ts +96 -33
- package/package.json +6 -6
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Source tiers, per-leaf provenance, and the redacted provenance projection
|
|
3
|
+
* (#2425; scope items 2 and 3 of #2415).
|
|
4
|
+
*
|
|
5
|
+
* Three config loaders answer "which file won" three different ways today, and
|
|
6
|
+
* none of them can answer "why". This module fixes the vocabulary once: a
|
|
7
|
+
* resolved config carries, for every leaf, the tier that produced it, the file
|
|
8
|
+
* it came from, and the trust decision that applied to that file. #2427's
|
|
9
|
+
* introspection surface reads exactly this, so "why is server X running" stops
|
|
10
|
+
* being a log-forensics question.
|
|
11
|
+
*
|
|
12
|
+
* Two orderings live here, and they are NOT the same ordering:
|
|
13
|
+
*
|
|
14
|
+
* - `SOURCE_TIERS` decides who wins a plain value. Later beats earlier, so a
|
|
15
|
+
* CLI flag beats a project file beats a global file beats a built-in default.
|
|
16
|
+
* - `TIER_CLASS` decides who may LIFT a deny. `deny.ts` builds monotonic deny
|
|
17
|
+
* precedence on this split, and nothing else re-derives it.
|
|
18
|
+
*
|
|
19
|
+
* Deliberately free of module state: every export is a pure function over its
|
|
20
|
+
* arguments, so there is no latch here to re-arm at `session_start`.
|
|
21
|
+
*/
|
|
22
|
+
import { homeRelativePath } from "../path-utils.js";
|
|
23
|
+
/**
|
|
24
|
+
* Where a configuration value came from. A closed union: a tier becomes public
|
|
25
|
+
* API the moment it appears in a provenance projection, so new members arrive
|
|
26
|
+
* through the stability policy in `docs/public-api-stability.md`.
|
|
27
|
+
*/
|
|
28
|
+
export const SOURCE_TIERS = [
|
|
29
|
+
"builtin",
|
|
30
|
+
"global",
|
|
31
|
+
"project",
|
|
32
|
+
"nested-project",
|
|
33
|
+
"env",
|
|
34
|
+
"cli",
|
|
35
|
+
"host",
|
|
36
|
+
];
|
|
37
|
+
/**
|
|
38
|
+
* Who each tier speaks for. THREE classes, not two (#2440 review finding F3).
|
|
39
|
+
*
|
|
40
|
+
* - `repo` — content that arrives with a checkout, which is exactly the content
|
|
41
|
+
* a user may never have read. `project` and `nested-project`, for the same
|
|
42
|
+
* reason: both are files inside the checkout.
|
|
43
|
+
* - `operator` — a deliberate act by the person running pi-lens: their global
|
|
44
|
+
* config, the environment, the command line, the host application. (`host` is
|
|
45
|
+
* operator content because the host is the thing that decided the project's
|
|
46
|
+
* trust in the first place.)
|
|
47
|
+
* - `default` — pi-lens's OWN shipped defaults. Nobody chose them.
|
|
48
|
+
*
|
|
49
|
+
* `builtin` was `operator` until this review round, and that conflation had a
|
|
50
|
+
* consequence nobody would have chosen deliberately: because `deny.ts` never
|
|
51
|
+
* lifts an operator denial, a built-in `enabled: false` — or any member pi-lens
|
|
52
|
+
* ships in a built-in deny list — became permanently unliftable BY ANYONE. Not
|
|
53
|
+
* by a project file, which is correct, but also not by the user's own global
|
|
54
|
+
* config, their environment, or an explicit command-line flag. A default the
|
|
55
|
+
* operator cannot override is not a default; it is a hard-coded decision
|
|
56
|
+
* wearing a config field's clothes, and the only escape would have been editing
|
|
57
|
+
* pi-lens's source.
|
|
58
|
+
*
|
|
59
|
+
* Splitting the class fixes it without weakening anything: a `default` denial
|
|
60
|
+
* is liftable by an OPERATOR tier and still unliftable by a `repo` tier, so
|
|
61
|
+
* shipping a conservative default stays safe against repository content while
|
|
62
|
+
* remaining a default to the person who installed the thing.
|
|
63
|
+
*/
|
|
64
|
+
export const TIER_CLASS = {
|
|
65
|
+
builtin: "default",
|
|
66
|
+
global: "operator",
|
|
67
|
+
project: "repo",
|
|
68
|
+
"nested-project": "repo",
|
|
69
|
+
env: "operator",
|
|
70
|
+
cli: "operator",
|
|
71
|
+
host: "operator",
|
|
72
|
+
};
|
|
73
|
+
/** Numeric precedence of a tier. Higher wins. */
|
|
74
|
+
export function tierPrecedence(tier) {
|
|
75
|
+
return SOURCE_TIERS.indexOf(tier);
|
|
76
|
+
}
|
|
77
|
+
/** True for tiers whose content arrives with the checkout. */
|
|
78
|
+
export function isRepoTier(tier) {
|
|
79
|
+
return TIER_CLASS[tier] === "repo";
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* True for tiers the person running pi-lens set deliberately.
|
|
83
|
+
*
|
|
84
|
+
* NOT the complement of `isRepoTier`: `builtin` is neither. Asking this question
|
|
85
|
+
* with `!isRepoTier(tier)` is the exact bug F3 reported, so the affirmative
|
|
86
|
+
* predicate exists to make the third class impossible to overlook at a call
|
|
87
|
+
* site.
|
|
88
|
+
*/
|
|
89
|
+
export function isOperatorTier(tier) {
|
|
90
|
+
return TIER_CLASS[tier] === "operator";
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Project a resolution to its provenance, sorted by key.
|
|
94
|
+
*
|
|
95
|
+
* Redacted BY CONSTRUCTION, and that is the whole design: the projection is
|
|
96
|
+
* built from the provenance map alone and never reads `resolved.value`, so
|
|
97
|
+
* there is no value here for a later edit to include by accident. An
|
|
98
|
+
* un-redacted view does not exist, because the un-redacted data is the resolved
|
|
99
|
+
* config the caller already holds. #2415 AC 4 asks that the DIAGNOSTIC surface
|
|
100
|
+
* leak nothing, and the way to guarantee that is to make the diagnostic surface
|
|
101
|
+
* structurally incapable of carrying a value.
|
|
102
|
+
*
|
|
103
|
+
* `file` is rewritten home-relative (#2440 review finding F5). A global config
|
|
104
|
+
* path is `$HOME`-anchored by construction, so the un-rewritten projection put
|
|
105
|
+
* the operator's account name into every diagnostic that named it — a value the
|
|
106
|
+
* projection was never asked to carry and the one piece of environment a shared
|
|
107
|
+
* log reliably leaks.
|
|
108
|
+
*
|
|
109
|
+
* `homeDir` is a test seam only, matching `loadLSPConfig`'s: production passes
|
|
110
|
+
* nothing and gets `os.homedir()`. Without it a redaction test can only prove
|
|
111
|
+
* the rewrite against the machine's REAL home, which means either writing
|
|
112
|
+
* fixtures into the operator's home directory or asserting nothing at all
|
|
113
|
+
* (#2427).
|
|
114
|
+
*/
|
|
115
|
+
export function provenanceView(resolved, homeDir) {
|
|
116
|
+
const entries = [...resolved.provenance.values()]
|
|
117
|
+
.map((entry) => ({
|
|
118
|
+
key: entry.key,
|
|
119
|
+
tier: entry.tier,
|
|
120
|
+
...(entry.file === undefined
|
|
121
|
+
? {}
|
|
122
|
+
: { file: homeRelativePath(entry.file, homeDir) }),
|
|
123
|
+
...(entry.trust === undefined ? {} : { trust: entry.trust }),
|
|
124
|
+
}))
|
|
125
|
+
.sort((left, right) => compareKeys(left.key, right.key));
|
|
126
|
+
return { entries };
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The provenance governing a pointer: its own entry, else the nearest ancestor's.
|
|
130
|
+
*
|
|
131
|
+
* Not every leaf carries its own entry. An array merged with the `replace`
|
|
132
|
+
* strategy comes from ONE source, so one entry at the array's own pointer
|
|
133
|
+
* answers for every element inside it, and per-element copies would be noise
|
|
134
|
+
* that all say the same thing. Consumers ask this function rather than reading
|
|
135
|
+
* the map directly, so "which tier decided this" has one answer at every depth.
|
|
136
|
+
*/
|
|
137
|
+
export function provenanceFor(resolved, pointer) {
|
|
138
|
+
let candidate = pointer;
|
|
139
|
+
for (;;) {
|
|
140
|
+
const entry = resolved.provenance.get(candidate);
|
|
141
|
+
if (entry)
|
|
142
|
+
return entry;
|
|
143
|
+
if (candidate === "")
|
|
144
|
+
return undefined;
|
|
145
|
+
const cut = candidate.lastIndexOf("/");
|
|
146
|
+
candidate = cut <= 0 ? "" : candidate.slice(0, cut);
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Code-unit ordering for any key a diagnostic or telemetry surface sorts.
|
|
151
|
+
*
|
|
152
|
+
* Exported so `process-spec.ts` sorts env names with it rather than with a bare
|
|
153
|
+
* `.sort()` (Sonar S2871) or with `localeCompare`. `localeCompare` would be the
|
|
154
|
+
* obvious substitute and the wrong one: its answer depends on the machine's
|
|
155
|
+
* locale and ICU build, so two runs of the same resolution could order the same
|
|
156
|
+
* env names differently and a telemetry diff would show a change that is not
|
|
157
|
+
* one. A projection meant to be compared across machines must be
|
|
158
|
+
* locale-independent.
|
|
159
|
+
*/
|
|
160
|
+
export function compareKeys(left, right) {
|
|
161
|
+
if (left < right)
|
|
162
|
+
return -1;
|
|
163
|
+
return left > right ? 1 : 0;
|
|
164
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Bounded, redacted validation/migration records (#2425, scope item 6).
|
|
3
|
+
*
|
|
4
|
+
* A malformed config produces one record per rejected key, and a config file
|
|
5
|
+
* can hold arbitrarily many keys, so the collection is bounded at the source
|
|
6
|
+
* rather than at the sink. The bound reuses the degradation ledger's own
|
|
7
|
+
* `ENTRIES_PER_KIND` discipline — the same number, imported rather than
|
|
8
|
+
* re-typed, because a record that survives collection only to be dropped by the
|
|
9
|
+
* ledger is memory spent for nothing.
|
|
10
|
+
*
|
|
11
|
+
* REASONS NEVER EMBED FILE CONTENT. Every reason on this surface is assembled
|
|
12
|
+
* from a fixed template plus structural facts: a key name, a type name, a
|
|
13
|
+
* count. No value, no snippet, no parser echo. #2431 is the sibling defect on
|
|
14
|
+
* the existing loaders (a parse error carrying a source snippet); this module
|
|
15
|
+
* does not fix it, and it does not repeat it. Key names are user text, so they
|
|
16
|
+
* are stripped of control characters, length-bounded, and run through the
|
|
17
|
+
* repo's existing `redactSecrets` before they reach a record.
|
|
18
|
+
*
|
|
19
|
+
* No module state: the collector is an instance a caller owns for the length of
|
|
20
|
+
* one resolution, so there is no latch here to re-arm at `session_start`.
|
|
21
|
+
*/
|
|
22
|
+
import { DEGRADATION_ENTRIES_PER_KIND } from "../ledger-bounds.js";
|
|
23
|
+
import { redactSecrets } from "../redact/secrets.js";
|
|
24
|
+
/**
|
|
25
|
+
* Records retained per resolution. The same value and the same reasoning as the
|
|
26
|
+
* ledger's per-kind bound: everything past it is counted, not kept.
|
|
27
|
+
*/
|
|
28
|
+
export const MAX_MIGRATION_RECORDS = DEGRADATION_ENTRIES_PER_KIND;
|
|
29
|
+
/** Longest key label a record carries. A key is a name, not a document. */
|
|
30
|
+
export const MAX_RECORD_KEY_LENGTH = 120;
|
|
31
|
+
/**
|
|
32
|
+
* Codes whose record is a VERDICT ON THE WHOLE CONFIGURATION rather than one
|
|
33
|
+
* more notice about one key. They are kept however full the collector is, and
|
|
34
|
+
* are never counted as suppressed (#2426 review round 7, F1).
|
|
35
|
+
*
|
|
36
|
+
* The bound exists so that a file with 500 bad keys cannot put 500 notices on
|
|
37
|
+
* screen: past 20, the rest are worth a count. That reasoning holds for every
|
|
38
|
+
* PER-KEY record and inverts for this one. "Nothing in this file is in effect"
|
|
39
|
+
* is not more of the same information — it is the statement that the notices
|
|
40
|
+
* above it are no longer the whole story, and dropping it leaves the user
|
|
41
|
+
* reading "19 keys rejected, N more suppressed" about a configuration that
|
|
42
|
+
* applied nothing at all.
|
|
43
|
+
*
|
|
44
|
+
* Enforced in `add`, which is the single choke point BOTH bounds go through:
|
|
45
|
+
* `resolveConfig`'s own collector and the second `finalizeRecords` pass that
|
|
46
|
+
* `config-resolve.ts` runs over what the first one returned. A call site that
|
|
47
|
+
* appended the record itself would be re-bounded by the second pass.
|
|
48
|
+
*
|
|
49
|
+
* `PILENS_CFG_0007` is deliberately NOT here: it is produced by `finalize`
|
|
50
|
+
* after the bound has already been applied, so it can never meet it.
|
|
51
|
+
*/
|
|
52
|
+
const UNBOUNDED_RECORD_CODES = new Set(["PILENS_CFG_0008"]);
|
|
53
|
+
/**
|
|
54
|
+
* The NUL separator `warnIgnoredConfigOnce` puts between file and key. Built
|
|
55
|
+
* from its code point rather than written literally, so a literal NUL never
|
|
56
|
+
* enters this source file.
|
|
57
|
+
*/
|
|
58
|
+
const SUBJECT_SEPARATOR = String.fromCharCode(0);
|
|
59
|
+
/** The ledger subject for a (file, key) pair; a bare file when there is no key. */
|
|
60
|
+
export function migrationSubject(file, key) {
|
|
61
|
+
return key.length > 0 ? `${file}${SUBJECT_SEPARATOR}${key}` : file;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Replace every control character with a space.
|
|
65
|
+
*
|
|
66
|
+
* Written as a code-point scan rather than a character-class regex so this
|
|
67
|
+
* source file contains no literal control byte of its own.
|
|
68
|
+
*/
|
|
69
|
+
function stripControlCharacters(text) {
|
|
70
|
+
let out = "";
|
|
71
|
+
for (const character of text) {
|
|
72
|
+
const code = character.codePointAt(0) ?? 0;
|
|
73
|
+
out += code < 0x20 || code === 0x7f ? " " : character;
|
|
74
|
+
}
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Make a user-supplied key safe to quote in a diagnostic: strip control
|
|
79
|
+
* characters (a config key can hold a newline, which would split one warning
|
|
80
|
+
* across two log lines), bound the length, and run the result through the
|
|
81
|
+
* repo's secret redactor in case the key itself spells one.
|
|
82
|
+
*/
|
|
83
|
+
export function boundedKeyLabel(key) {
|
|
84
|
+
const printable = stripControlCharacters(key).trim();
|
|
85
|
+
const bounded = printable.length > MAX_RECORD_KEY_LENGTH
|
|
86
|
+
? `${printable.slice(0, MAX_RECORD_KEY_LENGTH)}...`
|
|
87
|
+
: printable;
|
|
88
|
+
return redactSecrets(bounded);
|
|
89
|
+
}
|
|
90
|
+
/** A JSON type name for a value. Structural only: never the value itself. */
|
|
91
|
+
export function jsonTypeName(value) {
|
|
92
|
+
if (value === null)
|
|
93
|
+
return "null";
|
|
94
|
+
if (Array.isArray(value))
|
|
95
|
+
return "array";
|
|
96
|
+
return typeof value;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* The file a finalized list names when its producer can anchor it to none.
|
|
100
|
+
*
|
|
101
|
+
* A list with no records cannot overflow, so this is the floor under an
|
|
102
|
+
* anchorless producer rather than a case production reaches.
|
|
103
|
+
*/
|
|
104
|
+
const UNANCHORED_RECORD_LABEL = "(config resolution)";
|
|
105
|
+
/**
|
|
106
|
+
* A bounded collector for one resolution.
|
|
107
|
+
*
|
|
108
|
+
* Deliberately an instance rather than a module singleton: a resolution is a
|
|
109
|
+
* call, not a session, so the collector's lifetime is the call's lifetime and
|
|
110
|
+
* nothing has to reset it on a session boundary (defect shape 17).
|
|
111
|
+
*/
|
|
112
|
+
export class MigrationRecordCollector {
|
|
113
|
+
kept = [];
|
|
114
|
+
dropped;
|
|
115
|
+
limit;
|
|
116
|
+
/**
|
|
117
|
+
* `priorDropped` SEEDS the drop count with records an EARLIER bound already
|
|
118
|
+
* discarded before this collector saw the list (#2426 review round 6, F1).
|
|
119
|
+
*
|
|
120
|
+
* The shared resolution is bounded twice by construction: `resolveConfig`
|
|
121
|
+
* runs its own collector across every source, and the loader then finalizes
|
|
122
|
+
* what survived plus the deprecation records it composes itself. Only the
|
|
123
|
+
* second bound used to be counted, so a `.pi-lens.json` whose 40 refused
|
|
124
|
+
* keys were truncated to 19 told the user ONE notice had been suppressed
|
|
125
|
+
* when 21 had. A suppression count that undercounts is worse than no count:
|
|
126
|
+
* it tells the user the list they were shown is almost complete.
|
|
127
|
+
*/
|
|
128
|
+
constructor(limit = MAX_MIGRATION_RECORDS, priorDropped = 0) {
|
|
129
|
+
this.limit = Math.max(0, Math.trunc(limit));
|
|
130
|
+
this.dropped = Math.max(0, Math.trunc(priorDropped));
|
|
131
|
+
}
|
|
132
|
+
add(record) {
|
|
133
|
+
if (this.kept.length >= this.limit) {
|
|
134
|
+
// A whole-config verdict outranks the bound — see
|
|
135
|
+
// `UNBOUNDED_RECORD_CODES`. It is kept AND not counted as suppressed,
|
|
136
|
+
// so `droppedCount` stays the number of per-key notices the user is
|
|
137
|
+
// not seeing.
|
|
138
|
+
if (UNBOUNDED_RECORD_CODES.has(record.code)) {
|
|
139
|
+
this.kept.push(record);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
this.dropped += 1;
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
this.kept.push(record);
|
|
146
|
+
}
|
|
147
|
+
/** The retained records, oldest first. */
|
|
148
|
+
get records() {
|
|
149
|
+
return this.kept;
|
|
150
|
+
}
|
|
151
|
+
/** How many records the bound discarded. Counted, never silently zero. */
|
|
152
|
+
get droppedCount() {
|
|
153
|
+
return this.dropped;
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The retained records plus, when the bound discarded any, ONE record
|
|
157
|
+
* counting them.
|
|
158
|
+
*
|
|
159
|
+
* The whole of "bound a record list and say so when it truncates" lives
|
|
160
|
+
* here, and nowhere else (#2426 review round 5, F-A/F-B/S-A). Three
|
|
161
|
+
* producers had grown their own copy of it — the shared resolution, the
|
|
162
|
+
* project loader's unknown-key scan, and (by omission, which is how the
|
|
163
|
+
* defect showed) the project loader's legacy-document enumeration, which
|
|
164
|
+
* shipped its records raw and let one file's key count set the
|
|
165
|
+
* notification count. A fourth producer must not have to remember any of
|
|
166
|
+
* this: it calls `finalizeRecords` and is bounded.
|
|
167
|
+
*
|
|
168
|
+
* Two finalized lists that anchor to the SAME file and suppress the SAME
|
|
169
|
+
* number of records render one notice, not two. That is the warn-once
|
|
170
|
+
* latch doing its documented job: both records state the identical fact
|
|
171
|
+
* about the identical file, and the user has one thing to do about it.
|
|
172
|
+
*/
|
|
173
|
+
finalize(anchor) {
|
|
174
|
+
if (this.dropped === 0)
|
|
175
|
+
return this.kept;
|
|
176
|
+
const file = anchor?.file ?? UNANCHORED_RECORD_LABEL;
|
|
177
|
+
return [
|
|
178
|
+
...this.kept,
|
|
179
|
+
{
|
|
180
|
+
code: "PILENS_CFG_0007",
|
|
181
|
+
file,
|
|
182
|
+
key: "",
|
|
183
|
+
subject: migrationSubject(file, ""),
|
|
184
|
+
reason: `${this.dropped} further config notices were suppressed by the bound of ${MAX_MIGRATION_RECORDS}`,
|
|
185
|
+
...(anchor?.tier === undefined ? {} : { tier: anchor.tier }),
|
|
186
|
+
},
|
|
187
|
+
];
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Bound a record list and append the suppression count when it truncates.
|
|
192
|
+
*
|
|
193
|
+
* The ONE exported shape every producer uses (#2426 review round 6, S2). It
|
|
194
|
+
* used to have a twin — `finalizableCollector()`, a pre-subtracted collector a
|
|
195
|
+
* streaming producer filled key by key — and two shapes for one policy is the
|
|
196
|
+
* thing round 5 collapsed three copies of this bound to avoid. A push-based
|
|
197
|
+
* producer buffers into an array and calls this; the array it builds is bounded
|
|
198
|
+
* by the parsed document already in memory, which is a smaller cost than a
|
|
199
|
+
* second public entry point onto the same arithmetic.
|
|
200
|
+
*
|
|
201
|
+
* One slot of the bound is held back for the overflow record, so a finalized
|
|
202
|
+
* list is never LONGER than `MAX_MIGRATION_RECORDS` however many records went
|
|
203
|
+
* in. That subtraction is written here and at no call site. The one exception
|
|
204
|
+
* is a whole-config verdict (`UNBOUNDED_RECORD_CODES`), which is kept past the
|
|
205
|
+
* limit by `add` and can therefore make a finalized list one entry longer —
|
|
206
|
+
* deliberately, because that entry is what makes the other entries readable.
|
|
207
|
+
*
|
|
208
|
+
* `priorDropped` is what an earlier bound already discarded — see the
|
|
209
|
+
* collector's constructor. A caller that finalizes a list some other bound has
|
|
210
|
+
* already truncated MUST pass it, or the count it publishes is the tail of the
|
|
211
|
+
* truncation rather than the whole of it.
|
|
212
|
+
*/
|
|
213
|
+
export function finalizeRecords(records, anchor, priorDropped = 0) {
|
|
214
|
+
const collector = new MigrationRecordCollector(MAX_MIGRATION_RECORDS - 1, priorDropped);
|
|
215
|
+
for (const record of records)
|
|
216
|
+
collector.add(record);
|
|
217
|
+
return collector.finalize(anchor);
|
|
218
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The front door of the config pipeline: validate every source, then merge.
|
|
3
|
+
*
|
|
4
|
+
* It lives in its OWN module rather than in `index.ts` (#2426). `index.ts` is
|
|
5
|
+
* the barrel, so anything importing it also pulls `process-spec.js` and, with
|
|
6
|
+
* it, `project-trust.js` and the degradation ledger. That was harmless while
|
|
7
|
+
* nothing downstream of `file-utils.ts` imported the core — and #2426 wires
|
|
8
|
+
* three loaders that all sit downstream of it, which turned the barrel's width
|
|
9
|
+
* into three extra import cycles that had nothing to do with what the loaders
|
|
10
|
+
* actually use. A caller that only needs to resolve a config now imports only
|
|
11
|
+
* the halves that resolve one.
|
|
12
|
+
*
|
|
13
|
+
* `index.ts` re-exports everything here, so the PUBLIC surface is unchanged and
|
|
14
|
+
* `resolveConfig` is still the one supported way in.
|
|
15
|
+
*/
|
|
16
|
+
import { errorClassName } from "../error-class.js";
|
|
17
|
+
import { merge } from "./merge.js";
|
|
18
|
+
import { validate } from "./normalize.js";
|
|
19
|
+
import { MigrationRecordCollector, migrationSubject, } from "./records.js";
|
|
20
|
+
/**
|
|
21
|
+
* Validate every source, then merge them.
|
|
22
|
+
*
|
|
23
|
+
* One collector spans the whole resolution, so the record bound is per
|
|
24
|
+
* resolution rather than per file. Sources are handed to `merge` in the order
|
|
25
|
+
* given; `merge` sorts them by tier precedence itself.
|
|
26
|
+
*
|
|
27
|
+
* NEVER THROWS, and that is a contract rather than an observation (#2440
|
|
28
|
+
* review). `validate` already promised it and enforced it with its own guard,
|
|
29
|
+
* but the front door called `merge` outside any guard, so a value that reached
|
|
30
|
+
* the merger in a shape it could not survive — the review's probe was a
|
|
31
|
+
* 4000-deep blob under an opaque schema node — turned a config load into a
|
|
32
|
+
* `RangeError` that took the session with it. The bounds inside both halves are
|
|
33
|
+
* the real fix; this guard is the floor under them, so a future bug in either
|
|
34
|
+
* half degrades a config to absent instead of failing a session.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* The highest-precedence source's file and tier — the one whose values would
|
|
38
|
+
* have won, and so the file a user looking at a failed resolution should open.
|
|
39
|
+
*
|
|
40
|
+
* Read DEFENSIVELY because its only caller is a catch block: whatever made the
|
|
41
|
+
* resolution throw may equally make reading a source's own fields throw, and a
|
|
42
|
+
* guard that throws while explaining a throw is no guard at all.
|
|
43
|
+
*/
|
|
44
|
+
function anchorSource(sources) {
|
|
45
|
+
try {
|
|
46
|
+
const last = sources?.[sources.length - 1];
|
|
47
|
+
return last === undefined || typeof last.file !== "string"
|
|
48
|
+
? undefined
|
|
49
|
+
: { file: last.file, tier: last.tier };
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// pi-lens-ignore: missing-error-propagation — the anchor is best-effort
|
|
53
|
+
return undefined;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function resolveConfig(options) {
|
|
57
|
+
const collector = new MigrationRecordCollector(options.maxRecords);
|
|
58
|
+
try {
|
|
59
|
+
const normalized = options.sources.map((source) => ({
|
|
60
|
+
tier: source.tier,
|
|
61
|
+
...(source.file === undefined ? {} : { file: source.file }),
|
|
62
|
+
...(source.trust === undefined ? {} : { trust: source.trust }),
|
|
63
|
+
value: validate(source.value, options.schema, {
|
|
64
|
+
file: source.file ?? "",
|
|
65
|
+
tier: source.tier,
|
|
66
|
+
collector,
|
|
67
|
+
}).value,
|
|
68
|
+
}));
|
|
69
|
+
return {
|
|
70
|
+
resolved: merge(normalized, options.schema, { collector }),
|
|
71
|
+
records: collector.records,
|
|
72
|
+
droppedRecordCount: collector.droppedCount,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
// The error CLASS only, never its message, which could quote the file.
|
|
77
|
+
// `errorClassName` (#2451) — never `config-warn.ts`'s own
|
|
78
|
+
// `normalizeParseErrorReason`, which this module must not import: that
|
|
79
|
+
// would reopen the sink-import cycle #2426 removed from `config-core/`.
|
|
80
|
+
//
|
|
81
|
+
// ANCHORED to the resolution's highest-precedence source (#2426 review
|
|
82
|
+
// round 4, S1). This record used to carry `file: ""` and no tier, which
|
|
83
|
+
// rendered as `ignoring invalid LSP config : …` — no path for the user to
|
|
84
|
+
// open — and, naming neither a key nor a tier, was reported by every
|
|
85
|
+
// config subsystem at once, so one internal failure became three notices.
|
|
86
|
+
// The sources are right here; nothing downstream can recover them.
|
|
87
|
+
//
|
|
88
|
+
// `PILENS_CFG_0008`, not `0005` (#2426 review round 6, S1): 0005 is
|
|
89
|
+
// registered and documented as a per-FIELD rejection, so a user matching
|
|
90
|
+
// on it expects to have lost one setting. This record means the WHOLE
|
|
91
|
+
// configuration was dropped, which is a different thing to do about it.
|
|
92
|
+
//
|
|
93
|
+
// SURVIVES THE BOUND (#2426 review round 7, F1). The per-field records
|
|
94
|
+
// fill this same bounded collector, so a resolution that had already
|
|
95
|
+
// produced `MAX_MIGRATION_RECORDS` of them used to swallow this record
|
|
96
|
+
// into the anonymous suppression count — and the user then read "19 keys
|
|
97
|
+
// rejected, 11 further notices suppressed" about a resolution that
|
|
98
|
+
// applied NOTHING. That is the round-6 inversion arriving through the
|
|
99
|
+
// bound rather than through the prose round 6 fixed.
|
|
100
|
+
//
|
|
101
|
+
// The rule that keeps it lives in `MigrationRecordCollector.add`
|
|
102
|
+
// (`UNBOUNDED_RECORD_CODES`), not here, because appending it at THIS call
|
|
103
|
+
// site fixes only this call site: `config-resolve.ts` re-bounds the very
|
|
104
|
+
// list this function returns through `finalizeRecords`, whose collector
|
|
105
|
+
// would drop it a second time. One rule at the one choke point covers
|
|
106
|
+
// both bounds.
|
|
107
|
+
const anchor = anchorSource(options.sources);
|
|
108
|
+
const file = anchor?.file ?? "";
|
|
109
|
+
collector.add({
|
|
110
|
+
code: "PILENS_CFG_0008",
|
|
111
|
+
file,
|
|
112
|
+
key: "",
|
|
113
|
+
subject: migrationSubject(file, ""),
|
|
114
|
+
reason: `config resolution failed internally (${errorClassName(error)}); configuration ignored`,
|
|
115
|
+
...(anchor ? { tier: anchor.tier } : {}),
|
|
116
|
+
});
|
|
117
|
+
return {
|
|
118
|
+
// The empty resolution, built by the merger from no sources rather than
|
|
119
|
+
// asserted into existence: `merge([])` is already "nothing resolved".
|
|
120
|
+
resolved: merge([], options.schema),
|
|
121
|
+
records: collector.records,
|
|
122
|
+
droppedRecordCount: collector.droppedCount,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two structural bounds every walk in the config core obeys (#2425).
|
|
3
|
+
*
|
|
4
|
+
* `normalize.ts` and `merge.ts` both build objects out of KEYS THE USER CHOSE.
|
|
5
|
+
* That makes plain assignment (`out[name] = value`) unsafe in a way that is
|
|
6
|
+
* invisible at the call site: `out["__proto__"] = x` does not create a property,
|
|
7
|
+
* it invokes the inherited `__proto__` SETTER and re-parents `out`. The result
|
|
8
|
+
* serializes as `{}` while `out.injected` answers with the attacker's value, so
|
|
9
|
+
* every downstream check that reads a field rather than enumerating one is
|
|
10
|
+
* answered by the hijacked prototype. `constructor` and `prototype` are the same
|
|
11
|
+
* family: an own property that shadows a name the rest of the runtime reads.
|
|
12
|
+
*
|
|
13
|
+
* The rule is REJECT, not sanitize-and-keep. A config file that spells
|
|
14
|
+
* `__proto__` is never expressing a setting pi-lens has, so there is nothing to
|
|
15
|
+
* preserve; a record naming the key is the whole of the useful outcome. Both
|
|
16
|
+
* builders route every key through `safeAssign`, and the assignment itself uses
|
|
17
|
+
* `Object.defineProperty`, so even a key that somehow reached it could only ever
|
|
18
|
+
* become an own data property.
|
|
19
|
+
*
|
|
20
|
+
* `MAX_CONFIG_DEPTH` lives here rather than in `normalize.ts` because BOTH
|
|
21
|
+
* halves of the pipeline need it. The validator bounds the walk it performs;
|
|
22
|
+
* the merger bounds the walk it performs over already-validated values, because
|
|
23
|
+
* `merge()` is exported and a caller can hand it a value `validate()` never saw.
|
|
24
|
+
* One constant, two enforcement points, no second number to drift.
|
|
25
|
+
*
|
|
26
|
+
* Pure and dependency-free apart from the domain types. No state, no I/O.
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Deepest nesting either half of the pipeline walks. A config is a settings
|
|
30
|
+
* document, not a tree; 32 levels is far past anything a human writes and far
|
|
31
|
+
* short of a stack overflow. Deeper nodes are dropped with a record rather than
|
|
32
|
+
* truncated silently.
|
|
33
|
+
*/
|
|
34
|
+
export const MAX_CONFIG_DEPTH = 32;
|
|
35
|
+
/**
|
|
36
|
+
* Keys that change an object's BEHAVIOR rather than its contents when assigned.
|
|
37
|
+
*
|
|
38
|
+
* A closed list rather than a heuristic (`/^__/`, "anything with `proto` in
|
|
39
|
+
* it"): a heuristic silently claims keys a user legitimately meant and silently
|
|
40
|
+
* misses the next name the runtime gives meaning to. These three are the names
|
|
41
|
+
* `Object.prototype` actually defines a setter or a read for.
|
|
42
|
+
*/
|
|
43
|
+
export const UNSAFE_CONFIG_KEYS = [
|
|
44
|
+
"__proto__",
|
|
45
|
+
"constructor",
|
|
46
|
+
"prototype",
|
|
47
|
+
];
|
|
48
|
+
const UNSAFE_KEY_SET = new Set(UNSAFE_CONFIG_KEYS);
|
|
49
|
+
/** True for a key no config object may carry. */
|
|
50
|
+
export function isUnsafeConfigKey(name) {
|
|
51
|
+
return UNSAFE_KEY_SET.has(name);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* The reason text a rejected key produces. One template, shared by both
|
|
55
|
+
* builders, so the two halves of the pipeline cannot describe the same defect
|
|
56
|
+
* two ways. The KEY is supplied by the caller's own bounded/redacted label; this
|
|
57
|
+
* function never sees a value.
|
|
58
|
+
*/
|
|
59
|
+
export const UNSAFE_KEY_REASON = "config key would modify the object prototype; ignored";
|
|
60
|
+
/**
|
|
61
|
+
* Assign one validated value under one user-chosen key, or refuse.
|
|
62
|
+
*
|
|
63
|
+
* Returns `false` when the key was refused, so the caller can record it. The
|
|
64
|
+
* write is a `defineProperty` rather than a `=` so no inherited setter can run,
|
|
65
|
+
* which makes the refusal the policy and the mechanism the backstop rather than
|
|
66
|
+
* the other way round.
|
|
67
|
+
*/
|
|
68
|
+
export function safeAssign(target, name, value) {
|
|
69
|
+
if (isUnsafeConfigKey(name))
|
|
70
|
+
return false;
|
|
71
|
+
Object.defineProperty(target, name, {
|
|
72
|
+
value,
|
|
73
|
+
writable: true,
|
|
74
|
+
enumerable: true,
|
|
75
|
+
configurable: true,
|
|
76
|
+
});
|
|
77
|
+
return true;
|
|
78
|
+
}
|