pi-lens 4.4.4 → 4.4.6
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/CHANGELOG.md +477 -0
- package/README.md +45 -3
- package/config/biome/core.jsonc +3 -3
- package/config/dependency-cruiser-eager-allowlist.json +1 -0
- package/dist/{chunk-UBOQLVT2.js → chunk-2DDDCJDL.js} +4 -4
- package/dist/{chunk-RKKOYPRA.js → chunk-2DMLM3ZO.js} +13 -15
- package/dist/chunk-2F47TQOA.js +73 -0
- package/dist/{chunk-O4NWQT6I.js → chunk-2PHMIAKO.js} +4 -4
- package/dist/{chunk-DGUKIYSI.js → chunk-2RLWJO5K.js} +8 -10
- package/dist/{chunk-S67KYG37.js → chunk-2X4VLOCC.js} +2 -2
- package/dist/{chunk-TIQ2PKDW.js → chunk-3MYEA7QD.js} +4 -4
- package/dist/{chunk-3DA2JDOL.js → chunk-3WEPUD2V.js} +551 -203
- package/dist/{chunk-AMERCH6V.js → chunk-4AVZ3TG7.js} +15 -16
- package/dist/{chunk-IYNJ6YPZ.js → chunk-4PCQCU47.js} +4 -4
- package/dist/chunk-4WX4CTUE.js +57 -0
- package/dist/{chunk-P63GXC37.js → chunk-5APMQ2IJ.js} +31 -4
- package/dist/{chunk-ZIVJBOO3.js → chunk-5CV5ITZF.js} +2 -2
- package/dist/{chunk-6DLWKFEX.js → chunk-5ZR3APIM.js} +41 -42
- package/dist/{chunk-XTBDCR27.js → chunk-63RIVFQI.js} +4 -4
- package/dist/{chunk-GSLNCYGG.js → chunk-75SY4F24.js} +13 -14
- package/dist/{chunk-U44DJXQP.js → chunk-7RQXA5GG.js} +15 -18
- package/dist/chunk-A3YNG5KP.js +45 -0
- package/dist/{chunk-5OFV52AM.js → chunk-AE37FEGH.js} +1 -1
- package/dist/{chunk-BWD5EPKO.js → chunk-AMXIUN2R.js} +4 -6
- package/dist/{chunk-3KAZU3VR.js → chunk-ARD426WI.js} +2 -2
- package/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
- package/dist/{chunk-YH5MVY2U.js → chunk-BHUWL2Y3.js} +7 -7
- package/dist/{chunk-CT4MN5IU.js → chunk-BI5LAQ3Y.js} +353 -359
- package/dist/{chunk-KAPJINKN.js → chunk-BM5GS6ZH.js} +2 -2
- package/dist/{chunk-TLX72JTG.js → chunk-BWYQUPOS.js} +1 -1
- package/dist/chunk-CFRQMBGP.js +49 -0
- package/dist/{chunk-RMLC67LF.js → chunk-CJYKEW2L.js} +2 -30
- package/dist/chunk-CKEQFGLT.js +32 -0
- package/dist/{chunk-IWDLU6K3.js → chunk-DC4CFXM5.js} +4 -6
- package/dist/{chunk-ZVUL7QYY.js → chunk-DMSLNKF7.js} +29 -32
- package/dist/{chunk-KN35K52N.js → chunk-DQXSPYRI.js} +3 -3
- package/dist/{chunk-HYGZEMX6.js → chunk-EVDGNG4F.js} +11 -5
- package/dist/{chunk-SRYEJNES.js → chunk-F5Z6URKM.js} +2 -2
- package/dist/{chunk-UMS2MFPZ.js → chunk-F6X3YJWD.js} +2 -3
- package/dist/{chunk-XYURS6EN.js → chunk-FA5LDARD.js} +15 -17
- package/dist/{chunk-24AKHFGP.js → chunk-FFL3A2VP.js} +6 -6
- package/dist/chunk-FJIVKLPH.js +31 -0
- package/dist/chunk-G2B7F6ZU.js +88 -0
- package/dist/{chunk-US7ECLD7.js → chunk-GAACZY6R.js} +131 -41
- package/dist/{chunk-MZGQNL3Y.js → chunk-GMTFDAOK.js} +12 -13
- package/dist/{chunk-VOOAPROD.js → chunk-GNSIWBAT.js} +3 -3
- package/dist/chunk-GTAI2J6U.js +27 -0
- package/dist/{chunk-RVK72CZX.js → chunk-GZE7WOI4.js} +1362 -459
- package/dist/{chunk-IUE7SSKV.js → chunk-H7HTEQUZ.js} +13 -7
- package/dist/{chunk-EUXZEFTV.js → chunk-HK6JVFZC.js} +3 -3
- package/dist/chunk-IPDG45G5.js +26 -0
- package/dist/{chunk-5HSRT26B.js → chunk-J6JP25XU.js} +16 -15
- package/dist/{chunk-HWCCCQNX.js → chunk-JL6CXUMW.js} +13 -6
- package/dist/{chunk-EBC36LNN.js → chunk-K2YGBXOA.js} +17 -17
- package/dist/{chunk-WMYE35PX.js → chunk-KLQVC3XC.js} +7 -5
- package/dist/{chunk-ATKJFDQN.js → chunk-KSR7RGQY.js} +12 -14
- package/dist/{chunk-POMLXPMY.js → chunk-KXF5R4UN.js} +1 -1
- package/dist/{chunk-LLJNQKQW.js → chunk-LEJOJDXL.js} +20 -13
- package/dist/{chunk-JUKMK5Y4.js → chunk-MA77RSFN.js} +10 -11
- package/dist/{chunk-GAQ7OQG6.js → chunk-MKVZQUEG.js} +85 -96
- package/dist/{chunk-2EECBNC5.js → chunk-MN7MHUXQ.js} +75 -0
- package/dist/{chunk-DEL2U6CM.js → chunk-MT6BVNFW.js} +16 -14
- package/dist/chunk-NDMCVUYK.js +507 -0
- package/dist/{chunk-HRNHZA3N.js → chunk-NIU2IPC5.js} +12 -16
- package/dist/{chunk-AGSS7277.js → chunk-NNKXDXXS.js} +7 -24
- package/dist/{chunk-V35JG4JB.js → chunk-OJLTLYHB.js} +152 -334
- package/dist/{chunk-J6MPGQTS.js → chunk-OLAWH5UQ.js} +81 -15
- package/dist/{chunk-T57LYLZT.js → chunk-OOU2WZZE.js} +1 -1
- package/dist/{chunk-CYRKQRPM.js → chunk-OSTKYB55.js} +2 -4
- package/dist/chunk-P4QNXS6I.js +27 -0
- package/dist/chunk-PKES3ISE.js +297 -0
- package/dist/{chunk-ROYSX2S5.js → chunk-PO45POGF.js} +2 -2
- package/dist/{chunk-T7FEBKXN.js → chunk-PPIBVH4R.js} +7 -9
- package/dist/{chunk-3RKP3FMS.js → chunk-PQJFG24Z.js} +295 -23
- package/dist/{chunk-KUA4OJ5Y.js → chunk-Q3UZHW6N.js} +846 -350
- package/dist/{chunk-N5FLEO7W.js → chunk-Q4EMRFNA.js} +37 -37
- package/dist/{chunk-5IUSNGOC.js → chunk-Q4FCYCRE.js} +28 -21
- package/dist/chunk-Q6D6VMI4.js +22 -0
- package/dist/{chunk-UZ2XCLYS.js → chunk-QGSTQH4D.js} +8 -8
- package/dist/{chunk-DUO2TU77.js → chunk-RZOXUSPC.js} +10 -4
- package/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
- package/dist/{chunk-GMX5OS7B.js → chunk-S67UJDGQ.js} +11 -12
- package/dist/chunk-SCIUNBPF.js +44 -0
- package/dist/{chunk-RKBXZN3A.js → chunk-SJJYRZB4.js} +2 -2
- package/dist/chunk-SXGD4ANG.js +25 -0
- package/dist/{chunk-YCWYO6TQ.js → chunk-T7FTXGS3.js} +48 -45
- package/dist/{chunk-FM4RDMKT.js → chunk-TIQJPRDD.js} +115 -61
- package/dist/{chunk-XHJBS436.js → chunk-TIYGSODX.js} +25 -25
- package/dist/{chunk-S2HEXIWI.js → chunk-U2SDMG7C.js} +10 -6
- package/dist/{chunk-2KXTHF3M.js → chunk-U6OC3QEM.js} +253 -33
- package/dist/{chunk-AWSCPCN2.js → chunk-UCGQT677.js} +19 -19
- package/dist/chunk-UHGF5UT5.js +32 -0
- package/dist/{chunk-JW3YWBVB.js → chunk-UN4TEBWN.js} +17 -19
- package/dist/{chunk-ZHH37KZL.js → chunk-V3APN3DY.js} +17 -17
- package/dist/{chunk-ED36RF6Y.js → chunk-V63BC55Q.js} +1 -1
- package/dist/{chunk-XBJVAEEO.js → chunk-VG5JS5SW.js} +3 -2
- package/dist/{chunk-W66O5E25.js → chunk-VPBIMOAQ.js} +13 -15
- package/dist/chunk-VQH24FIP.js +37 -0
- package/dist/{chunk-YNE3RP52.js → chunk-VSFLRN5Y.js} +8 -1
- package/dist/{chunk-7D6L4MTX.js → chunk-W2V54OCL.js} +3 -3
- package/dist/{chunk-2FN63LPV.js → chunk-W5LGKNET.js} +13 -14
- package/dist/{chunk-IQWN5JCP.js → chunk-W5R5SABV.js} +13 -14
- package/dist/{chunk-R3T7CLQ2.js → chunk-WIZWZR4C.js} +41 -41
- package/dist/{chunk-TOY6QKOH.js → chunk-WQOIR3QY.js} +17 -17
- package/dist/{chunk-Y6GZHWSJ.js → chunk-XAIT2YGS.js} +6 -6
- package/dist/chunk-XCUHKYCQ.js +23 -0
- package/dist/{chunk-GSM5UU7A.js → chunk-XQCSWV2G.js} +44 -35
- package/dist/{chunk-OHKJ7PQF.js → chunk-YBSONGSZ.js} +43 -39
- package/dist/{chunk-GXFV6MYU.js → chunk-YISME6ON.js} +72 -39
- package/dist/chunk-YRD4ISED.js +30 -0
- package/dist/{chunk-SD4I7ZO4.js → chunk-YSBHPOY6.js} +43 -53
- package/dist/{chunk-QBFBRV2B.js → chunk-Z2XAOKHK.js} +4 -2
- package/dist/{chunk-5VSF4UUQ.js → chunk-Z7IGUAXL.js} +34 -39
- package/dist/{chunk-MPNJLASA.js → chunk-ZKXQKGWZ.js} +10 -13
- package/dist/{chunk-J64T55EI.js → chunk-ZQ6NZZTB.js} +75 -9
- package/dist/chunk-ZUUI3ZSA.js +38 -0
- package/dist/{chunk-7HXE67BN.js → chunk-ZYNI26MI.js} +2 -2
- package/dist/index.js +32674 -27567
- package/dist/mcp/analyze-cli.js +11 -12
- package/dist/mcp/cli.js +46 -45
- package/dist/mcp/server.js +1210 -574
- package/dist/mcp/worker.js +65 -65
- package/dist/probes/installer.js +21 -23
- package/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
- package/docs/adr/README.md +1 -0
- package/docs/agent-tools.md +28 -7
- package/docs/ast-grep_rules_catalog.md +5 -3
- package/docs/configuration.md +12 -1
- package/docs/defect-shapes.md +738 -0
- package/docs/engineering-principles.md +12 -0
- package/docs/environment-variables.md +20 -0
- package/docs/features.md +16 -1
- package/docs/globalconfig.md +37 -8
- package/docs/invariants/caches-stores.md +30 -0
- package/docs/invariants/dispatch-runners.md +164 -0
- package/docs/invariants/git-guard-host.md +53 -0
- package/docs/invariants/language-config.md +31 -0
- package/docs/invariants/lsp-trust-exec.md +286 -0
- package/docs/invariants/paths-os.md +59 -0
- package/docs/invariants/session-telemetry.md +74 -0
- package/docs/lsp-capability-matrix.md +105 -12
- package/docs/lsp-idle-eviction.md +37 -18
- package/docs/pi-lens-fixer.md +24 -2
- package/docs/pi-lens-investigator.md +14 -0
- package/docs/pi-lens-merge-policy.md +32 -17
- package/docs/pi-lens-monitor.md +66 -10
- package/docs/pi-lens-orchestration.md +41 -0
- package/docs/pi-lens-release.md +20 -0
- package/docs/pi-lens-retro.md +5 -4
- package/docs/pi-lens-reviewer.md +54 -7
- package/docs/pi-lens-subagent.md +10 -3
- package/docs/release-qa-baseline.md +19 -7
- package/docs/servercapabilities.md +47 -47
- package/docs/settings.md +9 -5
- package/docs/subagent-compat.md +1 -1
- package/docs/usage.md +1 -0
- package/package.json +8 -5
- package/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
- package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
- package/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
- package/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
- package/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
- package/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
- package/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
- package/rules/rule-catalog.json +25 -1
- package/scripts/analyze-pi-lens-logs.mjs +15 -5
- package/scripts/lib/is-main-module.mjs +27 -0
- package/scripts/lib/scratch-home-env.mjs +21 -0
- package/scripts/rpc-load-check.mjs +4 -6
- package/scripts/warm-loader-cache.mjs +2 -5
- package/dist/chunk-3PTHXJXR.js +0 -28
- package/dist/chunk-3QED2P4V.js +0 -31
- package/dist/chunk-5WRPDP2A.js +0 -47
- package/dist/chunk-ABBOA7UD.js +0 -157
- package/dist/chunk-CUHSHSB6.js +0 -273
- package/dist/chunk-GL5LUMZE.js +0 -51
- package/dist/chunk-HAD7QRQI.js +0 -30
- package/dist/chunk-JORED7EX.js +0 -44
- package/dist/chunk-KYUB6QDC.js +0 -72
- package/dist/chunk-LZSEQW6A.js +0 -57
- package/dist/chunk-M2IFVFWU.js +0 -79
- package/dist/chunk-M2UD3LPU.js +0 -88
- package/dist/chunk-MBKQHGA7.js +0 -39
- package/dist/chunk-R7YOCSNV.js +0 -23
- package/dist/chunk-SKAMFC7A.js +0 -28
- package/dist/chunk-SYE6T2EB.js +0 -28
- package/dist/chunk-TRETHTQO.js +0 -26
- package/dist/chunk-UA7ZXYDR.js +0 -184
- package/dist/chunk-XTFDJI3T.js +0 -24
- package/dist/chunk-Z3CCVDUB.js +0 -76
|
@@ -2,32 +2,36 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
|
|
|
2
2
|
import {
|
|
3
3
|
createAvailabilityProbeFlight,
|
|
4
4
|
probeToolAsync
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ARD426WI.js";
|
|
6
6
|
import {
|
|
7
7
|
classifyProbeFailure,
|
|
8
8
|
createAvailabilityLatch,
|
|
9
9
|
isTransientDecision,
|
|
10
10
|
logAvailabilityDecision,
|
|
11
11
|
startHostStallSampler
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-5APMQ2IJ.js";
|
|
13
13
|
import {
|
|
14
|
+
NODE_MODULES_BIN_DIRS,
|
|
14
15
|
createGenerationSource,
|
|
16
|
+
isUntrustedProjectPath,
|
|
17
|
+
projectLocalBinDirs,
|
|
18
|
+
recordProjectCommandRefusal,
|
|
15
19
|
safeSpawnAsync
|
|
16
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-Q3UZHW6N.js";
|
|
17
21
|
import {
|
|
18
22
|
getProjectTrustState
|
|
19
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-MN7MHUXQ.js";
|
|
20
24
|
import {
|
|
21
25
|
recordDegradationOnce
|
|
22
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-ZQ6NZZTB.js";
|
|
23
27
|
import {
|
|
24
28
|
logExtension
|
|
25
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-KXF5R4UN.js";
|
|
26
30
|
import {
|
|
27
31
|
isAtOrAboveHomeDir,
|
|
28
32
|
isUnderDir,
|
|
29
33
|
walkUpDirs
|
|
30
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-PQJFG24Z.js";
|
|
31
35
|
|
|
32
36
|
// dist/clients/package-manager.js
|
|
33
37
|
import * as fs from "node:fs";
|
|
@@ -196,32 +200,37 @@ var globalBinDirCache = /* @__PURE__ */ new Map();
|
|
|
196
200
|
var packageManagerCacheGeneration = createGenerationSource("package-manager-global-bin");
|
|
197
201
|
var globalBinDirProbeFlights = createAvailabilityProbeFlight();
|
|
198
202
|
async function globalBinDirsFor(pm) {
|
|
199
|
-
const
|
|
203
|
+
const scoped = getProjectTrustState() !== "trusted";
|
|
204
|
+
const key = `${scoped ? "scoped" : "trusted"}:${pm}`;
|
|
205
|
+
const cached = globalBinDirCache.get(key);
|
|
200
206
|
if (cached)
|
|
201
207
|
return cached;
|
|
202
208
|
const generation = packageManagerCacheGeneration.capture();
|
|
203
|
-
const shared = globalBinDirProbeFlights.run(
|
|
209
|
+
const shared = globalBinDirProbeFlights.run(key, () => probeGlobalBinDirs(pm, key, scoped, generation));
|
|
204
210
|
return shared.promise;
|
|
205
211
|
}
|
|
206
|
-
async function probeGlobalBinDirs(pm, generation) {
|
|
212
|
+
async function probeGlobalBinDirs(pm, key, scoped, generation) {
|
|
207
213
|
if (pm === "bun") {
|
|
208
214
|
const base = process.env.BUN_INSTALL || path.join(os.homedir(), ".bun");
|
|
209
215
|
const dirs2 = [path.join(base, "bin")];
|
|
210
|
-
generation.guardedWrite(
|
|
211
|
-
globalBinDirCache.set(
|
|
216
|
+
generation.guardedWrite(key, () => {
|
|
217
|
+
globalBinDirCache.set(key, dirs2);
|
|
212
218
|
});
|
|
213
219
|
return dirs2;
|
|
214
220
|
}
|
|
215
221
|
const query = pm === "npm" ? ["config", "get", "prefix"] : pm === "pnpm" ? ["bin", "-g"] : ["global", "bin"];
|
|
216
|
-
const res = await safeSpawnAsync(pmBinary(pm), query, {
|
|
222
|
+
const res = await safeSpawnAsync(pmBinary(pm), query, {
|
|
223
|
+
timeout: 5e3,
|
|
224
|
+
...scoped && { cwd: os.homedir() }
|
|
225
|
+
});
|
|
217
226
|
if (res.status !== 0 || res.error)
|
|
218
227
|
return [];
|
|
219
228
|
const out = res.stdout.trim();
|
|
220
229
|
if (!out)
|
|
221
230
|
return [];
|
|
222
231
|
const dirs = pm === "npm" ? [onWindows() ? out : path.join(out, "bin")] : [out];
|
|
223
|
-
generation.guardedWrite(
|
|
224
|
-
globalBinDirCache.set(
|
|
232
|
+
generation.guardedWrite(key, () => {
|
|
233
|
+
globalBinDirCache.set(key, dirs);
|
|
225
234
|
});
|
|
226
235
|
return dirs;
|
|
227
236
|
}
|
|
@@ -247,29 +256,19 @@ async function findGlobalBinary(command, windowsExt = ".cmd") {
|
|
|
247
256
|
for (const binDir of await allAvailableGlobalBinDirs()) {
|
|
248
257
|
for (const name of candidates) {
|
|
249
258
|
const full = path.join(binDir, name);
|
|
250
|
-
if (fs.existsSync(full))
|
|
251
|
-
|
|
259
|
+
if (!fs.existsSync(full))
|
|
260
|
+
continue;
|
|
261
|
+
if (isUntrustedProjectPath(full)) {
|
|
262
|
+
recordProjectCommandRefusal(full);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
return full;
|
|
252
266
|
}
|
|
253
267
|
}
|
|
254
268
|
} catch {
|
|
255
269
|
}
|
|
256
270
|
return void 0;
|
|
257
271
|
}
|
|
258
|
-
var NODE_MODULES_BIN_DIRS = [
|
|
259
|
-
path.join("node_modules", ".bin")
|
|
260
|
-
];
|
|
261
|
-
var VENDOR_BIN_DIRS = [path.join("vendor", "bin")];
|
|
262
|
-
var VENV_BIN_DIRS = [
|
|
263
|
-
path.join(".venv", "bin"),
|
|
264
|
-
path.join("venv", "bin"),
|
|
265
|
-
path.join(".venv", "Scripts"),
|
|
266
|
-
path.join("venv", "Scripts")
|
|
267
|
-
];
|
|
268
|
-
var PROJECT_LOCAL_BIN_DIRS = [
|
|
269
|
-
...NODE_MODULES_BIN_DIRS,
|
|
270
|
-
...VENDOR_BIN_DIRS,
|
|
271
|
-
...VENV_BIN_DIRS
|
|
272
|
-
];
|
|
273
272
|
function localBinPath(value) {
|
|
274
273
|
return typeof value === "string" ? value : void 0;
|
|
275
274
|
}
|
|
@@ -292,10 +291,8 @@ function refuseLocalBin(tool, root) {
|
|
|
292
291
|
return { kind: "refused-by-trust", tool, root: resolvedRoot, trust };
|
|
293
292
|
}
|
|
294
293
|
function isProjectLocalBinPath(resolvedCommand, cwd) {
|
|
295
|
-
for (const
|
|
296
|
-
if (
|
|
297
|
-
break;
|
|
298
|
-
if (PROJECT_LOCAL_BIN_DIRS.some((binDir) => isUnderDir(resolvedCommand, path.join(ancestor, binDir))))
|
|
294
|
+
for (const binDir of projectLocalBinDirs(cwd)) {
|
|
295
|
+
if (isUnderDir(resolvedCommand, binDir))
|
|
299
296
|
return true;
|
|
300
297
|
}
|
|
301
298
|
return false;
|
|
@@ -319,7 +316,7 @@ function* matchesInDir(dir, names, binDirs) {
|
|
|
319
316
|
function* localBinMatches(tools, startDir, options) {
|
|
320
317
|
const { windowsExt = ".cmd", homeDir = os.homedir(), binDirs = NODE_MODULES_BIN_DIRS, isWindows = onWindows(), ceiling = true } = options;
|
|
321
318
|
const names = expandCandidateNames(tools, windowsExt, isWindows);
|
|
322
|
-
for (const dir of walkUpDirs(startDir)) {
|
|
319
|
+
for (const dir of walkUpDirs(startDir, { spelling: true })) {
|
|
323
320
|
if (ceiling && isAtOrAboveHomeDir(dir, homeDir))
|
|
324
321
|
return;
|
|
325
322
|
yield* matchesInDir(dir, names, binDirs);
|
|
@@ -358,8 +355,6 @@ export {
|
|
|
358
355
|
updateArgs,
|
|
359
356
|
allAvailableGlobalBinDirs,
|
|
360
357
|
findGlobalBinary,
|
|
361
|
-
VENDOR_BIN_DIRS,
|
|
362
|
-
VENV_BIN_DIRS,
|
|
363
358
|
localBinPath,
|
|
364
359
|
isProjectLocalBinPath,
|
|
365
360
|
commandSearchReachesProject,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
logExtension
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KXF5R4UN.js";
|
|
5
5
|
import {
|
|
6
6
|
findNearestMarkerRoot,
|
|
7
|
-
|
|
8
|
-
} from "./chunk-
|
|
7
|
+
walkUpDirs
|
|
8
|
+
} from "./chunk-PQJFG24Z.js";
|
|
9
9
|
|
|
10
10
|
// dist/clients/cargo-manifest.js
|
|
11
11
|
import { readFile } from "node:fs/promises";
|
|
@@ -81,10 +81,10 @@ function indexOfArrayEnd(text, from) {
|
|
|
81
81
|
function parseTomlScalarString(content, key) {
|
|
82
82
|
if (content === void 0)
|
|
83
83
|
return void 0;
|
|
84
|
-
const match = content.match(new RegExp(`^[ \\t]*${key}[ \\t]*=[ \\t]*(?:"([^"]*)"|'([^']*)')`, "m"));
|
|
84
|
+
const match = content.match(new RegExp(`^[ \\t]*${key}[ \\t]*=[ \\t]*(?:"""(?:\\r?\\n)?([\\s\\S]*?)"""|'''(?:\\r?\\n)?([\\s\\S]*?)'''|"([^"]*)"|'([^']*)')`, "m"));
|
|
85
85
|
if (!match)
|
|
86
86
|
return void 0;
|
|
87
|
-
return match[1] ?? match[2];
|
|
87
|
+
return match[1] ?? match[2] ?? match[3] ?? match[4];
|
|
88
88
|
}
|
|
89
89
|
function hasCargoWorkspaceTable(content) {
|
|
90
90
|
return hasTomlTable(content, "workspace");
|
|
@@ -159,18 +159,14 @@ async function resolveCargoPackageEdition(filePath, homeDir = os.homedir()) {
|
|
|
159
159
|
if (hasCargoWorkspaceTable(packageContent)) {
|
|
160
160
|
return validatedEdition(readWorkspacePackageEdition(packageContent), filePath);
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
162
|
+
for (const current of walkUpDirs(path.dirname(packageDir), {
|
|
163
|
+
homeDir,
|
|
164
|
+
maxDepth: 64
|
|
165
|
+
})) {
|
|
166
166
|
const ancestorContent = await readTextFileOrUndefined(path.join(current, "Cargo.toml"));
|
|
167
167
|
if (ancestorContent !== void 0 && hasCargoWorkspaceTable(ancestorContent)) {
|
|
168
168
|
return validatedEdition(readWorkspacePackageEdition(ancestorContent), filePath);
|
|
169
169
|
}
|
|
170
|
-
const parent = path.dirname(current);
|
|
171
|
-
if (parent === current)
|
|
172
|
-
return void 0;
|
|
173
|
-
current = parent;
|
|
174
170
|
}
|
|
175
171
|
return void 0;
|
|
176
172
|
}
|
|
@@ -179,6 +175,7 @@ export {
|
|
|
179
175
|
readTextFileOrUndefined,
|
|
180
176
|
extractTomlTableSection,
|
|
181
177
|
parseTomlStringArray,
|
|
178
|
+
parseTomlScalarString,
|
|
182
179
|
hasCargoWorkspaceTable,
|
|
183
180
|
hasTomlTable,
|
|
184
181
|
readCargoPackageName,
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
logExtension
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-KXF5R4UN.js";
|
|
5
5
|
import {
|
|
6
6
|
DEPRECATED_CONFIG_SURFACES
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-S26LC76R.js";
|
|
8
8
|
import {
|
|
9
9
|
logLatency
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-Z2XAOKHK.js";
|
|
11
11
|
import {
|
|
12
12
|
PROCESS_SINGLETON_RESET_KIND,
|
|
13
13
|
getProbeHomeRedirectEvent,
|
|
@@ -18,7 +18,11 @@ import {
|
|
|
18
18
|
getSinkWriteFailures,
|
|
19
19
|
resetSinkRotations,
|
|
20
20
|
resetSinkWriteFailures
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-VSFLRN5Y.js";
|
|
22
|
+
import {
|
|
23
|
+
getPathIdentityFallbacks,
|
|
24
|
+
resetPathIdentityFallbacks
|
|
25
|
+
} from "./chunk-PQJFG24Z.js";
|
|
22
26
|
|
|
23
27
|
// dist/clients/ledger-bounds.js
|
|
24
28
|
var LEDGER_FIELD_MAX = 200;
|
|
@@ -174,6 +178,18 @@ function getDegradationSummary() {
|
|
|
174
178
|
droppedCount: group.count - group.entries.length,
|
|
175
179
|
latestReasons: group.entries.map((entry) => ({ ...entry }))
|
|
176
180
|
}));
|
|
181
|
+
const identityFallbacks = getPathIdentityFallbacks();
|
|
182
|
+
if (identityFallbacks.length > 0) {
|
|
183
|
+
summary.push({
|
|
184
|
+
kind: "path-identity-fallback",
|
|
185
|
+
count: identityFallbacks.reduce((total, row) => total + row.count, 0),
|
|
186
|
+
droppedCount: 0,
|
|
187
|
+
latestReasons: identityFallbacks.map((row) => ({
|
|
188
|
+
subject: truncateForLedger(row.code),
|
|
189
|
+
reason: truncateForLedger(`${row.count} fallback(s) to an ancestor identity; first: ${row.firstPath}`)
|
|
190
|
+
}))
|
|
191
|
+
});
|
|
192
|
+
}
|
|
177
193
|
const sinkFailures = getSinkWriteFailures();
|
|
178
194
|
if (sinkFailures.length > 0) {
|
|
179
195
|
summary.push({
|
|
@@ -275,6 +291,8 @@ function isRenderableSummary(value) {
|
|
|
275
291
|
}
|
|
276
292
|
var INFORMATIONAL_DEGRADATION_KINDS = /* @__PURE__ */ new Set([
|
|
277
293
|
"log-sink-rotated",
|
|
294
|
+
// Project-scoped autofix dedupe is intentional, not a failed fixer (#4862).
|
|
295
|
+
"deferred-autofix-duplicate-scope",
|
|
278
296
|
// #2504 review round 8 (S1): both fire on the ordinary re-edit cadence
|
|
279
297
|
// (a carry-forward window closing, or a session boundary) and are
|
|
280
298
|
// self-healing -- the next turn's analysis or deferral re-observes the
|
|
@@ -302,7 +320,18 @@ var INFORMATIONAL_DEGRADATION_KINDS = /* @__PURE__ */ new Set([
|
|
|
302
320
|
// #3813: a part the cap cut was kept pending for the next turn, which is
|
|
303
321
|
// the cap and its re-offer working together; the agent's message carries
|
|
304
322
|
// the "N held" note, and the ledger needs only the tally.
|
|
305
|
-
"turn-end-sections-held"
|
|
323
|
+
"turn-end-sections-held",
|
|
324
|
+
// #3952: both are the idle-eviction POLICY answering, not a timer that
|
|
325
|
+
// failed. `lsp-idle-eviction` is the memory bound releasing a client that
|
|
326
|
+
// respawns on the next request; `lsp-idle-eviction-declined` is the
|
|
327
|
+
// declaration `unmeasured`/`resident` doing its job, once per server, so a
|
|
328
|
+
// nominal session writes up to one row per non-`transparent` server (32 of
|
|
329
|
+
// the 49 built-ins today). A `⚠` per server on every healthy session is
|
|
330
|
+
// the cry-wolf shape #2505 rejected; the sibling that DOES stand out is a
|
|
331
|
+
// measurement whose arm never reached the policy, and that one reads as a
|
|
332
|
+
// missing row, not as a warning here.
|
|
333
|
+
"lsp-idle-eviction",
|
|
334
|
+
"lsp-idle-eviction-declined"
|
|
306
335
|
]);
|
|
307
336
|
function renderDegradationLines(summary = getDegradationSummary()) {
|
|
308
337
|
if (!isRenderableSummary(summary))
|
|
@@ -337,6 +366,7 @@ function resetDegradationLedger() {
|
|
|
337
366
|
ledgerGeneration++;
|
|
338
367
|
resetSinkWriteFailures();
|
|
339
368
|
resetSinkRotations();
|
|
369
|
+
resetPathIdentityFallbacks();
|
|
340
370
|
}
|
|
341
371
|
|
|
342
372
|
// dist/clients/string-utils.js
|
|
@@ -442,7 +472,7 @@ var LENS_FLAGS = [
|
|
|
442
472
|
},
|
|
443
473
|
{
|
|
444
474
|
name: "no-opengrep",
|
|
445
|
-
description: "Disable the Opengrep security scanner (a default-on auxiliary LSP; auto-installs, uses repo rules if present else the login-free 'auto' ruleset). Also via opengrep.enabled=false in ~/.pi-lens/config.json.",
|
|
475
|
+
description: "Disable the Opengrep security scanner (a default-on auxiliary LSP; auto-installs, uses repo rules if present, else the registry pack pi-lens refreshes into its cache, else the login-free 'auto' ruleset). Also via opengrep.enabled=false in ~/.pi-lens/config.json.",
|
|
446
476
|
configKey: "opengrep.enabled",
|
|
447
477
|
negated: true,
|
|
448
478
|
default: false,
|
|
@@ -465,6 +495,14 @@ var LENS_FLAGS = [
|
|
|
465
495
|
scope: "global",
|
|
466
496
|
env: "PI_LENS_NO_CONTEXT_INJECTION"
|
|
467
497
|
},
|
|
498
|
+
{
|
|
499
|
+
name: "lens-retain-injections",
|
|
500
|
+
description: "Opt-in (#4743): re-send each request's injected findings unchanged, at the same place, in every later request of the session, so an exact-prefix prompt cache (a local llama.cpp or Qwen server) keeps the whole conversation. Each retained block is labelled a snapshot; findings are still delivered once. Default off. Also via contextInjection.retain=true in ~/.pi-lens/config.json.",
|
|
501
|
+
configKey: "contextInjection.retain",
|
|
502
|
+
negated: false,
|
|
503
|
+
default: false,
|
|
504
|
+
scope: "global"
|
|
505
|
+
},
|
|
468
506
|
{
|
|
469
507
|
name: "lens-turn-summary",
|
|
470
508
|
description: "Opt-in: persist a per-turn transcript entry summarizing diagnostics found, autofixes applied, and autoformats applied this turn (#484). Collapsed one-line, expandable in place. Default off. Also via turnSummary.enabled=true in ~/.pi-lens/config.json.",
|
|
@@ -511,11 +549,17 @@ var LENS_FLAGS = [
|
|
|
511
549
|
globalOptInFlag("lens-compact-widget", "Opt-in (#3959): render the pi-lens widget as ONE summary line (languages + error/warning totals) instead of also stacking file rows, the suppressed count and blocker details below it. Default off. Also via ui.compactWidget=true in ~/.pi-lens/config.json.", "ui.compactWidget"),
|
|
512
550
|
{
|
|
513
551
|
name: "no-lazy-tools",
|
|
514
|
-
description:
|
|
552
|
+
description: 'Keep every pi-lens tool active for the whole session. Same as tools.lazy=false in ~/.pi-lens/config.json; the default tools.lazy=true starts the situational tools inactive on every model, and tools.lazy="auto" only on models that support mid-conversation system messages.',
|
|
515
553
|
configKey: "tools.lazy",
|
|
516
554
|
negated: true,
|
|
517
555
|
default: false,
|
|
518
|
-
scope: "global"
|
|
556
|
+
scope: "global",
|
|
557
|
+
// #4687: `tools.lazy` takes a third value, "auto", which leaves this flag
|
|
558
|
+
// at its default (off); only the two booleans decide it.
|
|
559
|
+
readGlobal: (config) => {
|
|
560
|
+
const setting = readLazyToolsSetting(config);
|
|
561
|
+
return typeof setting === "boolean" ? setting : void 0;
|
|
562
|
+
}
|
|
519
563
|
},
|
|
520
564
|
{
|
|
521
565
|
name: "lens-turn-end-madge",
|
|
@@ -597,6 +641,10 @@ function flagConfigSectionKeys(flags) {
|
|
|
597
641
|
function asConfigObject(value) {
|
|
598
642
|
return value && typeof value === "object" && !Array.isArray(value) ? value : void 0;
|
|
599
643
|
}
|
|
644
|
+
function readLazyToolsSetting(config) {
|
|
645
|
+
const lazy = asConfigObject(asConfigObject(config)?.tools)?.lazy;
|
|
646
|
+
return lazy === true || lazy === false || lazy === "auto" ? lazy : void 0;
|
|
647
|
+
}
|
|
600
648
|
function resolveFlagConfigPath(raw, configKey, warnInvalid) {
|
|
601
649
|
const segments = configKey.split(".");
|
|
602
650
|
let source = raw;
|
|
@@ -810,6 +858,23 @@ function translateGuidanceToolNames(content, host) {
|
|
|
810
858
|
if (host === "pi")
|
|
811
859
|
return content;
|
|
812
860
|
let text = content;
|
|
861
|
+
const piOnly = [];
|
|
862
|
+
for (const entry of TOOL_REGISTRY) {
|
|
863
|
+
if (typeof entry.piName === "string" && typeof entry.mcpName !== "string") {
|
|
864
|
+
piOnly.push(entry.piName);
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
text = text.replace(/\n?• Situational \(([^)]*)\): ([^.]*)\.( Use [^\n]*)?/, (_match, clause, list, hint) => {
|
|
868
|
+
const kept = [];
|
|
869
|
+
for (const name of list.split(", ")) {
|
|
870
|
+
if (!piOnly.includes(name))
|
|
871
|
+
kept.push(name);
|
|
872
|
+
}
|
|
873
|
+
if (kept.length === 0)
|
|
874
|
+
return "";
|
|
875
|
+
return `
|
|
876
|
+
\u2022 Situational (${clause}): ${kept.join(", ")}.${hint ?? ""}`;
|
|
877
|
+
});
|
|
813
878
|
const byLength = [...TOOL_REGISTRY].sort((a, b) => (b.piName?.length ?? 0) - (a.piName?.length ?? 0));
|
|
814
879
|
for (const entry of byLength) {
|
|
815
880
|
if (typeof entry.piName !== "string" || typeof entry.mcpName !== "string") {
|
|
@@ -817,7 +882,7 @@ function translateGuidanceToolNames(content, host) {
|
|
|
817
882
|
}
|
|
818
883
|
text = text.replace(new RegExp(`\\b${escapeRegExp(entry.piName)}\\b`, "g"), entry.mcpName);
|
|
819
884
|
}
|
|
820
|
-
return text.replace("activate via pi_lens_activate_tools", "call directly");
|
|
885
|
+
return text.replace("activate via pi_lens_activate_tools if unlisted", "call directly").replace("activate via pi_lens_activate_tools", "call directly");
|
|
821
886
|
}
|
|
822
887
|
function toolRegistryEntryForMcp(name) {
|
|
823
888
|
return TOOL_REGISTRY.find((tool) => tool.mcpName === name);
|
|
@@ -890,6 +955,7 @@ export {
|
|
|
890
955
|
PROJECT_FOREIGN_CONFIG_NAMESPACES,
|
|
891
956
|
PROJECT_FOREIGN_NAMESPACE_HONORED_KEYS,
|
|
892
957
|
flagConfigSectionKeys,
|
|
958
|
+
readLazyToolsSetting,
|
|
893
959
|
hasFlagConfigPath,
|
|
894
960
|
readFlagConfigValue,
|
|
895
961
|
flagValueFromConfig,
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getGlobalPiLensDir
|
|
4
|
+
} from "./chunk-Q3UZHW6N.js";
|
|
5
|
+
import {
|
|
6
|
+
getTurnId
|
|
7
|
+
} from "./chunk-VSFLRN5Y.js";
|
|
8
|
+
import {
|
|
9
|
+
BoundedFifoMap
|
|
10
|
+
} from "./chunk-PQJFG24Z.js";
|
|
11
|
+
|
|
12
|
+
// dist/clients/custom-rule-locations.js
|
|
13
|
+
import * as path from "node:path";
|
|
14
|
+
function getUserRuleRoot() {
|
|
15
|
+
return path.join(getGlobalPiLensDir(), "rules");
|
|
16
|
+
}
|
|
17
|
+
var RULE_CORPUS_CYCLE_ENTRIES = 16;
|
|
18
|
+
var ruleCorpusCycleFingerprints = new BoundedFifoMap(RULE_CORPUS_CYCLE_ENTRIES);
|
|
19
|
+
var cycleSlot;
|
|
20
|
+
function ruleCorpusFingerprintForCycle(family, root, compute, force = false) {
|
|
21
|
+
const cycle = getTurnId();
|
|
22
|
+
if (!force && cycleSlot !== void 0 && cycleSlot.cycle === cycle && cycleSlot.family === family && cycleSlot.root === root) {
|
|
23
|
+
return cycleSlot.fingerprint;
|
|
24
|
+
}
|
|
25
|
+
const key = `${cycle}\0${family}\0${root}`;
|
|
26
|
+
let fingerprint = force ? void 0 : ruleCorpusCycleFingerprints.get(key);
|
|
27
|
+
if (fingerprint === void 0) {
|
|
28
|
+
fingerprint = compute(root);
|
|
29
|
+
ruleCorpusCycleFingerprints.set(key, fingerprint);
|
|
30
|
+
}
|
|
31
|
+
cycleSlot = { cycle, family, root, fingerprint };
|
|
32
|
+
return fingerprint;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {
|
|
36
|
+
getUserRuleRoot,
|
|
37
|
+
ruleCorpusFingerprintForCycle
|
|
38
|
+
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
loadPiLensProjectConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OLAWH5UQ.js";
|
|
5
5
|
import {
|
|
6
6
|
lazyEnvNumber,
|
|
7
7
|
toPositiveFinite
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VSFLRN5Y.js";
|
|
9
9
|
|
|
10
10
|
// dist/clients/project-scale.js
|
|
11
11
|
var DEFAULT_PROJECT_SCALE_BASE = 2e3;
|