pi-lens 4.4.2 → 4.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/dist/{chunk-2ZGIZPDG.js → chunk-2VUQMUMT.js} +6 -6
  3. package/dist/{chunk-ARJ6PLFH.js → chunk-3W7IEVVL.js} +1 -1
  4. package/dist/{chunk-5JM2524W.js → chunk-3YN6V5TV.js} +16 -15
  5. package/dist/{chunk-CF24OIYI.js → chunk-5UCAH366.js} +1 -1
  6. package/dist/{chunk-NW7BOILN.js → chunk-6STA6Z7I.js} +2 -2
  7. package/dist/{chunk-66SXUJCA.js → chunk-77M37OKR.js} +5 -3
  8. package/dist/{chunk-EETY4LF7.js → chunk-AB3YYG6N.js} +1 -1
  9. package/dist/{chunk-66VMUL7Q.js → chunk-ACXEQZOU.js} +3 -3
  10. package/dist/{chunk-3UUPUE3O.js → chunk-CMMHNUZ2.js} +31 -29
  11. package/dist/chunk-CSHFH5IN.js +17 -0
  12. package/dist/{chunk-3WA4HP4I.js → chunk-EC47DWFA.js} +6 -5
  13. package/dist/{chunk-ESBQHFMJ.js → chunk-EU63SDCG.js} +187 -79
  14. package/dist/{chunk-34WSVGEM.js → chunk-FCSOVF55.js} +78 -0
  15. package/dist/{chunk-IBRALRBR.js → chunk-FMSO6RDZ.js} +3 -2
  16. package/dist/{chunk-ODBNXWT4.js → chunk-H6MF6EVN.js} +81 -42
  17. package/dist/{chunk-XPZPXCBV.js → chunk-KDERNTCQ.js} +2 -2
  18. package/dist/chunk-KSX3TXSZ.js +69 -0
  19. package/dist/{chunk-PV6LR5P5.js → chunk-M6HSLBWY.js} +198 -4362
  20. package/dist/{chunk-XKIZ2HNN.js → chunk-MXGY6KPT.js} +6 -4
  21. package/dist/{chunk-GHB6AYCP.js → chunk-RXCOMYPY.js} +2 -2
  22. package/dist/{chunk-GZYBXISR.js → chunk-SQ4TVJBR.js} +3 -3
  23. package/dist/{chunk-VITUCP5A.js → chunk-SS36ZX4J.js} +5 -3
  24. package/dist/{chunk-PFNSLWU5.js → chunk-T6CPIZNT.js} +5 -4
  25. package/dist/{chunk-JWA5I3SR.js → chunk-VCO24T4L.js} +3 -5
  26. package/dist/{chunk-Q6ZWTCLY.js → chunk-XAGLWMJ4.js} +2 -3
  27. package/dist/{chunk-WOKKRCJ5.js → chunk-XIJZVPD5.js} +3 -2
  28. package/dist/{chunk-7ULNCDCO.js → chunk-YIUAVF7E.js} +5 -5
  29. package/dist/{chunk-GOYRYZ2R.js → chunk-YSZNHOBY.js} +63 -11
  30. package/dist/chunk-YYOIQFRS.js +4139 -0
  31. package/dist/{chunk-QZVW3AAK.js → chunk-ZWFS3OEF.js} +5 -4
  32. package/dist/index.js +1628 -1482
  33. package/dist/mcp/analyze-cli.js +1 -1
  34. package/dist/mcp/cli.js +6 -6
  35. package/dist/mcp/server.js +62 -61
  36. package/dist/mcp/worker.js +16 -15
  37. package/dist/probes/installer.js +1 -1
  38. package/docs/pi-lens-merge-policy.md +12 -4
  39. package/docs/pi-lens-reviewer.md +3 -0
  40. package/docs/pi-lens-subagent.md +5 -0
  41. package/package.json +1 -1
  42. package/dist/chunk-CO2G5PHH.js +0 -84
  43. package/dist/{chunk-IXXDFY73.js → chunk-3EFKIGZN.js} +0 -0
  44. package/dist/{chunk-OG5UUPN7.js → chunk-OCAGUNBC.js} +3 -3
@@ -8,11 +8,15 @@ import {
8
8
  getProjectTrustState
9
9
  } from "./chunk-ZANLILYD.js";
10
10
  import {
11
+ incrementDegradationCount,
11
12
  recordDegradationOnce
12
13
  } from "./chunk-JAU72XNY.js";
13
14
  import {
14
15
  logExtension
15
16
  } from "./chunk-XTMJ7XDT.js";
17
+ import {
18
+ logLatency
19
+ } from "./chunk-QQNQ7SJW.js";
16
20
  import {
17
21
  UV_WORKSPACE_EXCLUDE_DIALECT,
18
22
  UV_WORKSPACE_MEMBERS_DIALECT,
@@ -22,6 +26,78 @@ import {
22
26
  walkUpDirs
23
27
  } from "./chunk-N2H3ZPZY.js";
24
28
 
29
+ // dist/clients/bounded-telemetry.js
30
+ var MAX_TRACKED_TURN_CAPS = 64;
31
+ var turnCounts = /* @__PURE__ */ new Map();
32
+ var latestCountedTurnIndex;
33
+ var retiredThroughTurnIndex = Number.NEGATIVE_INFINITY;
34
+ function admitBounded(phase, identity, options = {}) {
35
+ try {
36
+ let isRisingEdge = true;
37
+ if (options.ledgerKind !== void 0) {
38
+ isRisingEdge = incrementDegradationCount({
39
+ kind: options.ledgerKind,
40
+ subject: identity,
41
+ reason: options.reason ?? phase
42
+ });
43
+ }
44
+ if (options.risingEdgePer !== void 0 && !isRisingEdge)
45
+ return false;
46
+ return admitAgainstTurnCap(phase, options.capPerTurn);
47
+ } catch {
48
+ return true;
49
+ }
50
+ }
51
+ function emitBounded(phase, identity, payload, options = {}) {
52
+ try {
53
+ if (!admitBounded(phase, identity, options))
54
+ return false;
55
+ logLatency({
56
+ ...payload,
57
+ type: payload.type ?? "phase",
58
+ phase,
59
+ // `filePath` is what existing latency.log queries filter on, so a site
60
+ // may keep a coarser one; `metadata.identity` below always carries the
61
+ // full discriminating identity. Aggregation that loses WHICH subject
62
+ // is stuck is the failure AGENTS.md names.
63
+ filePath: payload.filePath ?? identity,
64
+ metadata: { ...payload.metadata, identity }
65
+ });
66
+ return true;
67
+ } catch {
68
+ return false;
69
+ }
70
+ }
71
+ function admitAgainstTurnCap(phase, cap) {
72
+ if (cap === void 0)
73
+ return true;
74
+ if (cap.turnIndex <= retiredThroughTurnIndex)
75
+ return false;
76
+ let counts = turnCounts.get(cap.turnIndex);
77
+ if (!counts) {
78
+ if (turnCounts.size >= MAX_TRACKED_TURN_CAPS) {
79
+ const oldestTrackedTurn = Math.min(...turnCounts.keys());
80
+ if (cap.turnIndex < oldestTrackedTurn)
81
+ return false;
82
+ turnCounts.delete(oldestTrackedTurn);
83
+ retiredThroughTurnIndex = Math.max(retiredThroughTurnIndex, oldestTrackedTurn);
84
+ }
85
+ counts = /* @__PURE__ */ new Map();
86
+ turnCounts.set(cap.turnIndex, counts);
87
+ }
88
+ latestCountedTurnIndex = Math.max(latestCountedTurnIndex ?? cap.turnIndex, cap.turnIndex);
89
+ const used = counts.get(phase) ?? 0;
90
+ if (used >= cap.limit)
91
+ return false;
92
+ counts.set(phase, used + 1);
93
+ return true;
94
+ }
95
+ function resetBoundedTelemetry() {
96
+ turnCounts = /* @__PURE__ */ new Map();
97
+ latestCountedTurnIndex = void 0;
98
+ retiredThroughTurnIndex = Number.NEGATIVE_INFINITY;
99
+ }
100
+
25
101
  // dist/clients/python-environment.js
26
102
  import { access, readFile } from "node:fs/promises";
27
103
  import os from "node:os";
@@ -187,6 +263,8 @@ function pythonEnvironmentToolCandidates(environment, command) {
187
263
  }
188
264
 
189
265
  export {
266
+ emitBounded,
267
+ resetBoundedTelemetry,
190
268
  hasAmbientPythonEnvironment,
191
269
  detectPythonEnvironment,
192
270
  detectPythonVenv,
@@ -9,9 +9,10 @@ import {
9
9
  resolveSeverityFloor,
10
10
  shouldScanTrivy,
11
11
  worktreeSkipDirs
12
- } from "./chunk-66SXUJCA.js";
12
+ } from "./chunk-77M37OKR.js";
13
+ import "./chunk-CSHFH5IN.js";
13
14
  import "./chunk-VCHXCQFG.js";
14
- import "./chunk-IXXDFY73.js";
15
+ import "./chunk-3EFKIGZN.js";
15
16
  import "./chunk-PNQDPDRC.js";
16
17
  import "./chunk-RWWYJ623.js";
17
18
  import "./chunk-VRZP76YM.js";
@@ -3,16 +3,6 @@ import {
3
3
  getLazyInstallAttempt,
4
4
  tryLazyInstall
5
5
  } from "./chunk-OXXKQCSV.js";
6
- import {
7
- stripAnsi
8
- } from "./chunk-FC4RP4I2.js";
9
- import {
10
- isTrivyEnabled,
11
- resolveSeverityFloor
12
- } from "./chunk-66SXUJCA.js";
13
- import {
14
- rustClient
15
- } from "./chunk-MRXKYPCS.js";
16
6
  import {
17
7
  findingsResult,
18
8
  finishParsedRun,
@@ -23,9 +13,22 @@ import {
23
13
  parseToolRun,
24
14
  skipUnlessToolRan
25
15
  } from "./chunk-2CD5RS6M.js";
16
+ import {
17
+ stripAnsi
18
+ } from "./chunk-FC4RP4I2.js";
26
19
  import {
27
20
  spawnFailedWithNoOutput
28
21
  } from "./chunk-UZ3TUTRV.js";
22
+ import {
23
+ goClient
24
+ } from "./chunk-XMSXXAHW.js";
25
+ import {
26
+ isTrivyEnabled,
27
+ resolveSeverityFloor
28
+ } from "./chunk-77M37OKR.js";
29
+ import {
30
+ rustClient
31
+ } from "./chunk-MRXKYPCS.js";
29
32
  import {
30
33
  coveringLaneAvailable,
31
34
  createAvailabilityChecker,
@@ -33,6 +36,7 @@ import {
33
36
  getDispatchAvailabilityGeneration,
34
37
  lspPrimaryCoversFile,
35
38
  recordAvailabilityProbeOverrun,
39
+ resolveAdoptedRootCommand,
36
40
  resolveAvailableOrInstall,
37
41
  resolveCommandArgsWithInstallFallback,
38
42
  resolveLocalFirstAsync,
@@ -40,7 +44,7 @@ import {
40
44
  resolveToolCommand,
41
45
  resolveToolCommandWithInstallFallback,
42
46
  resolveVendorToolCommand
43
- } from "./chunk-GOYRYZ2R.js";
47
+ } from "./chunk-YSZNHOBY.js";
44
48
  import {
45
49
  biomeConfigArgs,
46
50
  findCompiledClassesDir,
@@ -73,25 +77,24 @@ import {
73
77
  computeImpactCascade
74
78
  } from "./chunk-2B73ZPOK.js";
75
79
  import {
76
- goClient
77
- } from "./chunk-XMSXXAHW.js";
80
+ buildOrUpdateGraph,
81
+ clearReviewGraphWorkspaceCache,
82
+ fileContentProvider
83
+ } from "./chunk-YYOIQFRS.js";
78
84
  import {
79
85
  MAX_BLOCKING_RULE_COMPLEXITY,
80
86
  RUNTIME_CONFIG,
81
87
  applyDispositions,
82
88
  applyDispositionsMultiFile,
83
89
  buildEffectiveAstGrepCatalog,
84
- buildOrUpdateGraph,
85
90
  calculateRuleComplexity,
86
91
  classifyDefect,
87
92
  classifyDiagnostic,
88
93
  classifyDiagnosticTier,
89
94
  clearPendingAuxiliaryCoverage,
90
- clearReviewGraphWorkspaceCache,
91
95
  enabledAuxiliaryLspServerIds,
92
96
  exceedsLspSyncLimits,
93
97
  fetchTsserverProjectIdentity,
94
- fileContentProvider,
95
98
  getLSPService,
96
99
  getRunnerTimeoutFloorMs,
97
100
  hasAnyDispositionMarks,
@@ -107,19 +110,20 @@ import {
107
110
  touchCoverageGap,
108
111
  tryWarmAttachedCodeActions,
109
112
  tryWarmAttachedDiagnostics
110
- } from "./chunk-PV6LR5P5.js";
113
+ } from "./chunk-M6HSLBWY.js";
111
114
  import {
112
115
  mapWithConcurrency
113
116
  } from "./chunk-XIMYZ3JA.js";
114
117
  import {
115
118
  LSP_SERVERS,
116
119
  getAstGrepRuleSources,
117
- registerRunnerId
118
- } from "./chunk-ESBQHFMJ.js";
120
+ registerRunnerId,
121
+ resolveAnalysisRoot
122
+ } from "./chunk-EU63SDCG.js";
119
123
  import {
120
124
  augmentPythonEnvironment,
121
125
  detectPythonEnvironment
122
- } from "./chunk-34WSVGEM.js";
126
+ } from "./chunk-FCSOVF55.js";
123
127
  import {
124
128
  loadProjectSnapshot,
125
129
  readJsonCache,
@@ -167,7 +171,7 @@ import {
167
171
  } from "./chunk-L3BLXZG7.js";
168
172
  import {
169
173
  isSpawnableCommand
170
- } from "./chunk-66VMUL7Q.js";
174
+ } from "./chunk-ACXEQZOU.js";
171
175
  import {
172
176
  logRunnerAdvisoryOnce,
173
177
  resolveRunnerCwd,
@@ -1420,6 +1424,30 @@ function pendingRunnerFindingsSize() {
1420
1424
  return pending.length;
1421
1425
  }
1422
1426
 
1427
+ // dist/clients/dispatch/adopted-root-runners.js
1428
+ var ADOPTED_ROOT_RUNNER_ALLOWLIST = [
1429
+ "fish-indent",
1430
+ "php-lint"
1431
+ ];
1432
+ var ADMITTED = new Set(ADOPTED_ROOT_RUNNER_ALLOWLIST);
1433
+ function isAdoptedRootRunnerAdmitted(runnerId) {
1434
+ return ADMITTED.has(runnerId);
1435
+ }
1436
+ function filterGroupsForAdoptedRoot(groups) {
1437
+ const filtered = [];
1438
+ for (const group of groups) {
1439
+ const runnerIds = [];
1440
+ for (const runnerId of group.runnerIds) {
1441
+ if (isAdoptedRootRunnerAdmitted(runnerId))
1442
+ runnerIds.push(runnerId);
1443
+ }
1444
+ if (runnerIds.length === 0)
1445
+ continue;
1446
+ filtered.push(runnerIds.length === group.runnerIds.length ? group : { ...group, runnerIds });
1447
+ }
1448
+ return filtered;
1449
+ }
1450
+
1423
1451
  // dist/clients/dispatch/rule-policy.js
1424
1452
  function resolvedRulePolicyMap(root) {
1425
1453
  const resolved = resolvePiLensConfig({
@@ -2288,17 +2316,34 @@ async function runGroup(ctx, group, registry, onRunnerResult) {
2288
2316
  async function dispatchForFile(ctx, groups, registry, onRunnerResult, options) {
2289
2317
  const _overallStart = Date.now();
2290
2318
  if (ctx.analysisRootMode === "adopted") {
2291
- return {
2292
- diagnostics: [],
2293
- blockers: [],
2294
- warnings: [],
2295
- baselineWarningCount: 0,
2296
- fixed: [],
2297
- resolvedCount: 0,
2298
- output: "",
2299
- blockerOutput: "",
2300
- hasBlockers: false
2301
- };
2319
+ const planned = groups.flatMap((g) => g.runnerIds);
2320
+ groups = filterGroupsForAdoptedRoot(groups);
2321
+ const admitted = new Set(groups.flatMap((g) => g.runnerIds));
2322
+ logLatency({
2323
+ type: "phase",
2324
+ filePath: ctx.filePath,
2325
+ phase: "dispatch_adopted_root_allowlist",
2326
+ durationMs: 0,
2327
+ metadata: {
2328
+ admissionList: ADOPTED_ROOT_RUNNER_ALLOWLIST.join(","),
2329
+ admitted: groups.flatMap((g) => g.runnerIds).join(","),
2330
+ refused: planned.flatMap((id) => admitted.has(id) ? [] : [id]).join(","),
2331
+ noAdmittedRunner: groups.length === 0
2332
+ }
2333
+ });
2334
+ if (groups.length === 0) {
2335
+ return {
2336
+ diagnostics: [],
2337
+ blockers: [],
2338
+ warnings: [],
2339
+ baselineWarningCount: 0,
2340
+ fixed: [],
2341
+ resolvedCount: 0,
2342
+ output: "",
2343
+ blockerOutput: "",
2344
+ hasBlockers: false
2345
+ };
2346
+ }
2302
2347
  }
2303
2348
  if (ctx.fileRole === "generated") {
2304
2349
  const evidence = ctx.generatedEvidence;
@@ -7791,13 +7836,9 @@ var phpLintRunner = {
7791
7836
  skipTestFiles: false,
7792
7837
  async run(ctx) {
7793
7838
  const cwd = resolveRunnerCwd(ctx, "php-lint");
7794
- if (!await php.isAvailableAsync(cwd)) {
7795
- return { status: "skipped", diagnostics: [], semantic: "none" };
7796
- }
7797
- const cmd = php.getCommand(cwd);
7798
- if (!cmd) {
7839
+ const cmd = ctx.analysisRootMode === "adopted" ? resolveAdoptedRootCommand("php", ctx, cwd) : await php.isAvailableAsync(cwd) ? php.getCommand(cwd) : null;
7840
+ if (!cmd)
7799
7841
  return { status: "skipped", diagnostics: [], semantic: "none" };
7800
- }
7801
7842
  const absPath = path30.resolve(cwd, ctx.filePath);
7802
7843
  const result = await safeSpawnAsync(cmd, ["-l", absPath], {
7803
7844
  timeout: 15e3,
@@ -9083,10 +9124,7 @@ var fishIndentRunner = {
9083
9124
  skipTestFiles: false,
9084
9125
  async run(ctx) {
9085
9126
  const cwd = resolveRunnerCwd(ctx, "fish-indent");
9086
- const available = await fishIndent.isAvailableAsync(cwd);
9087
- if (!available)
9088
- return { status: "skipped", diagnostics: [], semantic: "none" };
9089
- const cmd = fishIndent.getCommand(cwd);
9127
+ const cmd = ctx.analysisRootMode === "adopted" ? resolveAdoptedRootCommand("fish_indent", ctx, cwd) : await fishIndent.isAvailableAsync(cwd) ? fishIndent.getCommand(cwd) : null;
9090
9128
  if (!cmd)
9091
9129
  return { status: "skipped", diagnostics: [], semantic: "none" };
9092
9130
  const result = await safeSpawnAsync(cmd, ["--check", ctx.filePath], {
@@ -12154,6 +12192,7 @@ async function analyzeFile(filePath, cwd, options = {}) {
12154
12192
  const start = Date.now();
12155
12193
  const result = await dispatchLintWithResult(absPath, cwd, host, void 0, void 0, {
12156
12194
  blockingOnly: options.blockingOnly ?? false,
12195
+ analysisRootMode: resolveAnalysisRoot(absPath, cwd),
12157
12196
  // #3791: this is a pull surface. Each call is an independent question,
12158
12197
  // so the synthetic coverage notice must come back on every call rather
12159
12198
  // than being latched once per session by the dispatcher — otherwise a
@@ -2,9 +2,9 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  GovulncheckClient,
4
4
  parseGovulncheckJson
5
- } from "./chunk-GZYBXISR.js";
6
- import "./chunk-IXXDFY73.js";
5
+ } from "./chunk-SQ4TVJBR.js";
7
6
  import "./chunk-UZ3TUTRV.js";
7
+ import "./chunk-3EFKIGZN.js";
8
8
  import "./chunk-RWWYJ623.js";
9
9
  import "./chunk-VRZP76YM.js";
10
10
  import "./chunk-C34ZXZ7O.js";
@@ -0,0 +1,69 @@
1
+ import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
+ import {
3
+ adaptLspService,
4
+ getLSPService,
5
+ groupFilesByPrimaryServer,
6
+ hasAuxiliaryLspPublishedForRoot,
7
+ notifyExternalFileChange,
8
+ peekLSPService,
9
+ resetLSPService,
10
+ resyncGitChangedFiles,
11
+ runPerServerGroups
12
+ } from "./chunk-M6HSLBWY.js";
13
+ import "./chunk-IBGIOBEE.js";
14
+ import "./chunk-XIMYZ3JA.js";
15
+ import "./chunk-EU63SDCG.js";
16
+ import "./chunk-VWCXW2E7.js";
17
+ import "./chunk-FCSOVF55.js";
18
+ import "./chunk-PNQDPDRC.js";
19
+ import "./chunk-ZXYDQ3TZ.js";
20
+ import "./chunk-QHJ6DQ2R.js";
21
+ import "./chunk-Z54ZSOBZ.js";
22
+ import "./chunk-724UL2TJ.js";
23
+ import "./chunk-QOZXJ4NA.js";
24
+ import "./chunk-GBPP5P7X.js";
25
+ import "./chunk-P7266HLM.js";
26
+ import "./chunk-MQLUAEOC.js";
27
+ import "./chunk-52FUZI6K.js";
28
+ import "./chunk-SAEFPSB6.js";
29
+ import "./chunk-GAEGEPOC.js";
30
+ import "./chunk-Z3CCVDUB.js";
31
+ import "./chunk-L3BLXZG7.js";
32
+ import "./chunk-2BEMIWEW.js";
33
+ import "./chunk-ACXEQZOU.js";
34
+ import "./chunk-Q7DUK4LX.js";
35
+ import "./chunk-AW7R2GWG.js";
36
+ import "./chunk-RWWYJ623.js";
37
+ import "./chunk-VRZP76YM.js";
38
+ import "./chunk-QOBUHWHX.js";
39
+ import "./chunk-QILIYSJF.js";
40
+ import "./chunk-6C7JWPCP.js";
41
+ import "./chunk-5NGR67U5.js";
42
+ import "./chunk-C34ZXZ7O.js";
43
+ import "./chunk-BW5KFIQC.js";
44
+ import "./chunk-QYF5S6P6.js";
45
+ import "./chunk-PHDMFAKM.js";
46
+ import "./chunk-2BBLFX75.js";
47
+ import "./chunk-XVF2VVXP.js";
48
+ import "./chunk-ZANLILYD.js";
49
+ import "./chunk-2EECBNC5.js";
50
+ import "./chunk-JAU72XNY.js";
51
+ import "./chunk-XTMJ7XDT.js";
52
+ import "./chunk-JMYYOTQG.js";
53
+ import "./chunk-QQNQ7SJW.js";
54
+ import "./chunk-AOHZU2BM.js";
55
+ import "./chunk-LJDODBBZ.js";
56
+ import "./chunk-ABBOA7UD.js";
57
+ import "./chunk-N2H3ZPZY.js";
58
+ import "./chunk-NXL4FFQQ.js";
59
+ export {
60
+ adaptLspService,
61
+ getLSPService,
62
+ groupFilesByPrimaryServer,
63
+ hasAuxiliaryLspPublishedForRoot,
64
+ notifyExternalFileChange,
65
+ peekLSPService,
66
+ resetLSPService,
67
+ resyncGitChangedFiles,
68
+ runPerServerGroups
69
+ };