@herbertgao/pi-extensions 2026.11.7 → 2026.11.8
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 +11 -0
- package/README.md +5 -5
- package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
- package/node_modules/@herbertgao/pi-subagents/README.md +2 -2
- package/node_modules/@herbertgao/pi-subagents/package.json +4 -4
- package/node_modules/@herbertgao/pi-subagents/src/ui/conversation-viewer.ts +10 -6
- package/node_modules/@herbertgao/pi-subagents/src/ui/viewer-keys.ts +47 -4
- package/node_modules/@narumitw/pi-btw/CHANGELOG.md +12 -0
- package/node_modules/@narumitw/pi-btw/dist/chunks/{main-tree-picker-WHRN26NJ.ts → main-tree-picker-3PXJARQW.ts} +59 -53
- package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-3PXJARQW.ts.map +7 -0
- package/node_modules/@narumitw/pi-btw/dist/index.ts +1 -1
- package/node_modules/@narumitw/pi-btw/docs/main-tree-snapshots.md +39 -0
- package/node_modules/@narumitw/pi-btw/docs/workflows.md +1 -0
- package/node_modules/@narumitw/pi-btw/package.json +1 -1
- package/node_modules/@narumitw/pi-btw/src/main-tree-picker.ts +73 -63
- package/node_modules/pi-lens/CHANGELOG-USER.md +6 -6
- package/node_modules/pi-lens/CHANGELOG.md +30 -0
- package/node_modules/pi-lens/README.md +1 -0
- package/node_modules/pi-lens/dist/{chunk-KDGKKK7A.js → chunk-2HWVG3IM.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-3QCI3V6C.js → chunk-3EIZMRXI.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-NWK7KKNO.js → chunk-3MHY4BQY.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-3NVGBFJS.js → chunk-3PMLYGJN.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-OP5BMZKK.js → chunk-3QMLB4TI.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-V7IPIAE5.js → chunk-3VWEZ6H2.js} +24 -26
- package/node_modules/pi-lens/dist/{chunk-NLRKB32C.js → chunk-5EEWCJG7.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VDMF7Q2P.js → chunk-5FDUKJZO.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-KBSC5Z3G.js → chunk-5KLRCUDT.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-GL6J5R34.js → chunk-6EXGCXM5.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-OC4ZGVMH.js → chunk-6GWCYEP7.js} +5 -7
- package/node_modules/pi-lens/dist/{chunk-LXE7JAMV.js → chunk-6JLNZ6DP.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-TTGDTNSN.js → chunk-75TVYCQW.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-QAM2Q3VO.js → chunk-7BEADGAZ.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-R5BNSOIV.js → chunk-7KWI5UHL.js} +7 -8
- package/node_modules/pi-lens/dist/{chunk-5YTDZ5WP.js → chunk-7M64NTAK.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-B4K6OSLL.js → chunk-7T64QA5D.js} +25 -27
- package/node_modules/pi-lens/dist/{chunk-KDMJ2DJD.js → chunk-7ZVEFWOE.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-D5L7Q57Z.js → chunk-AAIVSSUU.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-LIDFFCZZ.js → chunk-AD7JDEI6.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-WBXCIRVI.js → chunk-AVBEPUCD.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-VTXJAO5R.js → chunk-AZXTLZHE.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-UELHWF5I.js → chunk-BEIPWPVR.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-SQBDX6IO.js → chunk-C6V2DSZZ.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-ZD4KVFXI.js → chunk-D2ZYRI7M.js} +172 -3
- package/node_modules/pi-lens/dist/{chunk-HIUVHRLM.js → chunk-D6ANA6YU.js} +20 -22
- package/node_modules/pi-lens/dist/{chunk-YUF4DRYB.js → chunk-D7OEGXDX.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-AOQKQWZU.js → chunk-DFAY7JUN.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-QUZYRDT6.js → chunk-DIIDMDZU.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-QBUSONNE.js → chunk-DZSQXG66.js} +45 -27
- package/node_modules/pi-lens/dist/{chunk-UY3WWW5R.js → chunk-E5SSUV2A.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-DNB4ZQGN.js → chunk-ET3DSSFZ.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-4WWPDMRA.js → chunk-F7AMFFVK.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-LHCDWFDB.js → chunk-FDLGJFAE.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-C4ICGFEO.js → chunk-FVQKX5KI.js} +12 -12
- package/node_modules/pi-lens/dist/{chunk-TRYOYWWU.js → chunk-G3LR6V6N.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-AVOUHMCS.js → chunk-GHATCG2A.js} +10 -10
- package/node_modules/pi-lens/dist/{chunk-R2UF54ON.js → chunk-HJWF7CGW.js} +9 -9
- package/node_modules/pi-lens/dist/chunk-HRQTYU2T.js +355 -0
- package/node_modules/pi-lens/dist/{chunk-NR4KQOXZ.js → chunk-HSTN27NR.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-YVPB5YGO.js → chunk-HWMNTQBJ.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-6XNVY3FW.js → chunk-HYDJUVOE.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-WXMUGUZV.js → chunk-HYR25MV3.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-AJ62EQIQ.js → chunk-IC4L65U7.js} +12 -9
- package/node_modules/pi-lens/dist/{chunk-R2VUZZPJ.js → chunk-ILC2B7IJ.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-E6Z3CJT2.js → chunk-IZ36G463.js} +5 -5
- package/node_modules/pi-lens/dist/{chunk-IBEYUBCM.js → chunk-JKAVKTMY.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-LHU6NG5Z.js → chunk-JLMS7EMD.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-6RXMQYNU.js → chunk-JRSS6KM4.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-HASJPQBC.js → chunk-K2LD6YNH.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-UQ6OZYTO.js → chunk-KUDUKKQE.js} +43 -45
- package/node_modules/pi-lens/dist/{chunk-34RXPR7M.js → chunk-KXDQD34C.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-QDZ3ZZMY.js → chunk-LD7SXICE.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-NQFXN5U7.js → chunk-MOEWCPMC.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-IJ55MYO6.js → chunk-MV6ST2KT.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-532X3OCZ.js → chunk-NCDH2JB7.js} +7 -9
- package/node_modules/pi-lens/dist/{chunk-ITAPXBIB.js → chunk-NRVWLTOY.js} +9 -9
- package/node_modules/pi-lens/dist/{chunk-DPDA3ILA.js → chunk-NZINZCHB.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-A4HKPAEN.js → chunk-OEPWTSUG.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-TBE4OLPA.js → chunk-OF2YGDUE.js} +21 -23
- package/node_modules/pi-lens/dist/{chunk-BLL4VYGZ.js → chunk-OHEUOWYT.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-PSUXESQ5.js → chunk-ORYQGVC3.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-FVEEEEIM.js → chunk-OVPR3GQ6.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-BN36MQW5.js → chunk-PCREZ4HJ.js} +20 -22
- package/node_modules/pi-lens/dist/{chunk-KNP4ENFT.js → chunk-PK3GDU4M.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-2SD2CGVH.js → chunk-PPYUBO6Y.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-4HNBY7S7.js → chunk-PTJXMYRY.js} +7 -9
- package/node_modules/pi-lens/dist/{chunk-VI3BJMZO.js → chunk-PXGVB2CY.js} +14 -18
- package/node_modules/pi-lens/dist/{chunk-3C6ZZAB2.js → chunk-QY6J2FTK.js} +10 -12
- package/node_modules/pi-lens/dist/{chunk-5RLEDUUE.js → chunk-R67WQ5RY.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-WMCAEP2K.js → chunk-S6ZQFPOX.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-LPM6NKVI.js → chunk-SF7KSXB5.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-ECYUBKYX.js → chunk-T6PPK3T6.js} +40 -37
- package/node_modules/pi-lens/dist/{chunk-RV5VX2XW.js → chunk-TM3A3K7T.js} +8 -9
- package/node_modules/pi-lens/dist/{chunk-AFNPNHJV.js → chunk-TOOXNL6M.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-BJDB7PXU.js → chunk-TS5EIWEF.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-UG4YLCJ5.js → chunk-VD7MQFEV.js} +21 -23
- package/node_modules/pi-lens/dist/{chunk-BBJXIZ3X.js → chunk-VU2PRGRI.js} +5 -34
- package/node_modules/pi-lens/dist/{chunk-GTNO6F6K.js → chunk-WTSQKJAR.js} +4 -4
- package/node_modules/pi-lens/dist/{chunk-TPMBNWHO.js → chunk-Y7XMKBFP.js} +16 -16
- package/node_modules/pi-lens/dist/{chunk-JSQK5DH3.js → chunk-YLHJWAQS.js} +2 -2
- package/node_modules/pi-lens/dist/{chunk-HTUG7ZFK.js → chunk-YLW26OHX.js} +3 -3
- package/node_modules/pi-lens/dist/{chunk-C2REOMPO.js → chunk-YTXFNCVN.js} +1 -1
- package/node_modules/pi-lens/dist/{chunk-F37CCZUA.js → chunk-YULIERZW.js} +8 -8
- package/node_modules/pi-lens/dist/{chunk-KX4DF6XX.js → chunk-Z2W5YJBW.js} +6 -6
- package/node_modules/pi-lens/dist/{chunk-DBAHJFBU.js → chunk-Z6WTLVUL.js} +13 -18
- package/node_modules/pi-lens/dist/{chunk-6K4X7IIF.js → chunk-ZWZD4TJ5.js} +23 -25
- package/node_modules/pi-lens/dist/index.js +1134 -618
- package/node_modules/pi-lens/dist/mcp/analyze-cli.js +5 -7
- package/node_modules/pi-lens/dist/mcp/cli.js +25 -27
- package/node_modules/pi-lens/dist/mcp/server.js +101 -100
- package/node_modules/pi-lens/dist/mcp/worker.js +43 -45
- package/node_modules/pi-lens/dist/probes/installer.js +11 -11
- package/node_modules/pi-lens/docs/agent-tools.md +54 -12
- package/node_modules/pi-lens/docs/configuration.md +3 -3
- package/node_modules/pi-lens/docs/globalconfig.md +8 -1
- package/node_modules/pi-lens/docs/invariants/lsp-trust-exec.md +7 -0
- package/node_modules/pi-lens/docs/mcp.md +2 -1
- package/node_modules/pi-lens/docs/usage.md +1 -1
- package/node_modules/pi-lens/package.json +1 -1
- package/package.json +4 -4
- package/node_modules/@narumitw/pi-btw/dist/chunks/main-tree-picker-WHRN26NJ.ts.map +0 -7
- package/node_modules/pi-lens/dist/chunk-3HZ6MNB2.js +0 -140
- package/node_modules/pi-lens/dist/chunk-43KD3PPM.js +0 -162
- package/node_modules/pi-lens/dist/chunk-CKEQFGLT.js +0 -32
|
@@ -2,69 +2,67 @@
|
|
|
2
2
|
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
3
3
|
import {
|
|
4
4
|
analyzeFile
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-T6PPK3T6.js";
|
|
6
|
+
import "../chunk-6EXGCXM5.js";
|
|
7
7
|
import "../chunk-ME6MF2N2.js";
|
|
8
|
-
import "../chunk-
|
|
9
|
-
import "../chunk-
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-
|
|
12
|
-
import "../chunk-
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
17
|
-
import "../chunk-
|
|
18
|
-
import "../chunk-
|
|
19
|
-
import "../chunk-
|
|
20
|
-
import "../chunk-
|
|
21
|
-
import "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
24
|
-
import "../chunk-
|
|
8
|
+
import "../chunk-JRSS6KM4.js";
|
|
9
|
+
import "../chunk-MOEWCPMC.js";
|
|
10
|
+
import "../chunk-HYR25MV3.js";
|
|
11
|
+
import "../chunk-AAIVSSUU.js";
|
|
12
|
+
import "../chunk-LD7SXICE.js";
|
|
13
|
+
import "../chunk-NZINZCHB.js";
|
|
14
|
+
import "../chunk-FDLGJFAE.js";
|
|
15
|
+
import "../chunk-2HWVG3IM.js";
|
|
16
|
+
import "../chunk-E5SSUV2A.js";
|
|
17
|
+
import "../chunk-IZ36G463.js";
|
|
18
|
+
import "../chunk-BEIPWPVR.js";
|
|
19
|
+
import "../chunk-D7OEGXDX.js";
|
|
20
|
+
import "../chunk-3MHY4BQY.js";
|
|
21
|
+
import "../chunk-VU2PRGRI.js";
|
|
22
|
+
import "../chunk-D2ZYRI7M.js";
|
|
23
|
+
import "../chunk-OHEUOWYT.js";
|
|
24
|
+
import "../chunk-QY6J2FTK.js";
|
|
25
25
|
import "../chunk-3MED75HT.js";
|
|
26
26
|
import "../chunk-PKLB2XJL.js";
|
|
27
|
-
import "../chunk-
|
|
28
|
-
import "../chunk-
|
|
27
|
+
import "../chunk-DZSQXG66.js";
|
|
28
|
+
import "../chunk-DFAY7JUN.js";
|
|
29
29
|
import "../chunk-XIMYZ3JA.js";
|
|
30
|
-
import "../chunk-
|
|
31
|
-
import "../chunk-
|
|
32
|
-
import "../chunk-
|
|
30
|
+
import "../chunk-Z6WTLVUL.js";
|
|
31
|
+
import "../chunk-PPYUBO6Y.js";
|
|
32
|
+
import "../chunk-5EEWCJG7.js";
|
|
33
33
|
import "../chunk-QJ4T73J5.js";
|
|
34
|
-
import "../chunk-
|
|
34
|
+
import "../chunk-YLW26OHX.js";
|
|
35
35
|
import "../chunk-HGEE5LDW.js";
|
|
36
36
|
import "../chunk-5W3R6LFT.js";
|
|
37
|
-
import "../chunk-
|
|
38
|
-
import "../chunk-
|
|
37
|
+
import "../chunk-NCDH2JB7.js";
|
|
38
|
+
import "../chunk-HYDJUVOE.js";
|
|
39
39
|
import "../chunk-7424ANRU.js";
|
|
40
40
|
import "../chunk-SUIZOCSY.js";
|
|
41
|
-
import "../chunk-
|
|
41
|
+
import "../chunk-6GWCYEP7.js";
|
|
42
42
|
import "../chunk-Z54ZSOBZ.js";
|
|
43
|
-
import "../chunk-
|
|
43
|
+
import "../chunk-7M64NTAK.js";
|
|
44
44
|
import "../chunk-E3PNZDPH.js";
|
|
45
45
|
import "../chunk-6HWVI6MI.js";
|
|
46
|
-
import "../chunk-
|
|
47
|
-
import "../chunk-
|
|
48
|
-
import "../chunk-LXE7JAMV.js";
|
|
46
|
+
import "../chunk-PK3GDU4M.js";
|
|
47
|
+
import "../chunk-6JLNZ6DP.js";
|
|
49
48
|
import "../chunk-IT7MFVGP.js";
|
|
50
49
|
import "../chunk-AYDE7RFV.js";
|
|
51
50
|
import "../chunk-W6VLB6LL.js";
|
|
52
|
-
import "../chunk-
|
|
51
|
+
import "../chunk-HWMNTQBJ.js";
|
|
53
52
|
import "../chunk-ZRQMENT4.js";
|
|
54
|
-
import "../chunk-3HZ6MNB2.js";
|
|
55
53
|
import "../chunk-2BEMIWEW.js";
|
|
56
54
|
import "../chunk-IJYGIDF4.js";
|
|
57
|
-
import "../chunk-
|
|
58
|
-
import "../chunk-
|
|
59
|
-
import "../chunk-
|
|
60
|
-
import "../chunk-
|
|
55
|
+
import "../chunk-NRVWLTOY.js";
|
|
56
|
+
import "../chunk-YLHJWAQS.js";
|
|
57
|
+
import "../chunk-OVPR3GQ6.js";
|
|
58
|
+
import "../chunk-3QMLB4TI.js";
|
|
61
59
|
import "../chunk-UYXV5NIS.js";
|
|
62
|
-
import "../chunk-
|
|
63
|
-
import "../chunk-
|
|
64
|
-
import "../chunk-
|
|
65
|
-
import "../chunk-
|
|
66
|
-
import "../chunk-
|
|
67
|
-
import "../chunk-
|
|
60
|
+
import "../chunk-AVBEPUCD.js";
|
|
61
|
+
import "../chunk-75TVYCQW.js";
|
|
62
|
+
import "../chunk-KXDQD34C.js";
|
|
63
|
+
import "../chunk-3PMLYGJN.js";
|
|
64
|
+
import "../chunk-YTXFNCVN.js";
|
|
65
|
+
import "../chunk-ET3DSSFZ.js";
|
|
68
66
|
import "../chunk-B4FAFEBP.js";
|
|
69
67
|
import "../chunk-QYF5S6P6.js";
|
|
70
68
|
import "../chunk-SRXYSLMW.js";
|
|
@@ -73,7 +71,7 @@ import "../chunk-3R3Z54J7.js";
|
|
|
73
71
|
import "../chunk-CIA7X2PZ.js";
|
|
74
72
|
import {
|
|
75
73
|
setProjectTrustState
|
|
76
|
-
} from "../chunk-
|
|
74
|
+
} from "../chunk-HRQTYU2T.js";
|
|
77
75
|
import {
|
|
78
76
|
logExtension
|
|
79
77
|
} from "../chunk-AGEQRJ5A.js";
|
|
@@ -53,24 +53,24 @@ import {
|
|
|
53
53
|
verifyNpmPackageEntry,
|
|
54
54
|
verifyToolBinary,
|
|
55
55
|
wasLastResolveTransient
|
|
56
|
-
} from "../chunk-
|
|
57
|
-
import "../chunk-
|
|
58
|
-
import "../chunk-
|
|
59
|
-
import "../chunk-
|
|
56
|
+
} from "../chunk-NRVWLTOY.js";
|
|
57
|
+
import "../chunk-YLHJWAQS.js";
|
|
58
|
+
import "../chunk-OVPR3GQ6.js";
|
|
59
|
+
import "../chunk-3QMLB4TI.js";
|
|
60
60
|
import "../chunk-UYXV5NIS.js";
|
|
61
|
-
import "../chunk-
|
|
62
|
-
import "../chunk-
|
|
63
|
-
import "../chunk-
|
|
64
|
-
import "../chunk-
|
|
65
|
-
import "../chunk-
|
|
66
|
-
import "../chunk-
|
|
61
|
+
import "../chunk-AVBEPUCD.js";
|
|
62
|
+
import "../chunk-75TVYCQW.js";
|
|
63
|
+
import "../chunk-KXDQD34C.js";
|
|
64
|
+
import "../chunk-3PMLYGJN.js";
|
|
65
|
+
import "../chunk-YTXFNCVN.js";
|
|
66
|
+
import "../chunk-ET3DSSFZ.js";
|
|
67
67
|
import "../chunk-B4FAFEBP.js";
|
|
68
68
|
import "../chunk-QYF5S6P6.js";
|
|
69
69
|
import "../chunk-SRXYSLMW.js";
|
|
70
70
|
import "../chunk-6EIV3H7O.js";
|
|
71
71
|
import "../chunk-3R3Z54J7.js";
|
|
72
72
|
import "../chunk-CIA7X2PZ.js";
|
|
73
|
-
import "../chunk-
|
|
73
|
+
import "../chunk-HRQTYU2T.js";
|
|
74
74
|
import "../chunk-AGEQRJ5A.js";
|
|
75
75
|
import "../chunk-S26LC76R.js";
|
|
76
76
|
import "../chunk-K2GV34T2.js";
|
|
@@ -61,10 +61,20 @@ object argument such as `callHierarchyItem`, `rule` or `flags` are not checked):
|
|
|
61
61
|
send, written another way: a case or punctuation variant (`Path` for `path`),
|
|
62
62
|
a plural (`paths` for `path`), or a key whose last word is a declared
|
|
63
63
|
parameter (`file_path` for the declared `filePath`). The single-file
|
|
64
|
-
parameter is `path
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
parameter is `path`. Three MCP tools (`pilens_analyze`, `pilens_diagnostics`
|
|
65
|
+
and `pilens_lsp_navigation`) also declare `file` and `filePath` beside it as
|
|
66
|
+
accepted aliases (#5041), so those spellings run on them. The four tools whose
|
|
67
|
+
schema comes from the pi tool definition (`pilens_module_report`,
|
|
68
|
+
`pilens_read_symbol`, `pilens_read_enclosing` and `pilens_effective_config`)
|
|
69
|
+
declare `path` alone (#5138). Without `path`, a `file`, `filePath` or
|
|
70
|
+
`file_path` send to the first three is refused for missing required arguments
|
|
71
|
+
(``Not run: required argument(s) `path` missing.`` for `pilens_module_report`;
|
|
72
|
+
`read_symbol` also requires `symbol`, and `read_enclosing` requires `line`).
|
|
73
|
+
For `pilens_effective_config`, a `filePath` or `file_path` send without `path`
|
|
74
|
+
is reported as a mistyped `path`, naming the sent key (``Not run: `filePath`
|
|
75
|
+
looks like a mistyped `path`, which was not sent.``). Sending `path` avoids
|
|
76
|
+
that refusal, but conflicting `filePath` values still refuse with
|
|
77
|
+
`name different files — send one spelling`. The exact predicate is named in
|
|
68
78
|
[public-api-stability.md](public-api-stability.md). Anything looser (a typo,
|
|
69
79
|
an abbreviation, `files` for `maxLspFiles`, or a count, flag or output key
|
|
70
80
|
such as `maxFiles`, `includeFiles`, `outFile` or `cwdPath` where `cwd` is
|
|
@@ -86,6 +96,25 @@ schema; the retired `pilens_ast_grep_dump` name has no schema and is not
|
|
|
86
96
|
checked. A non-object `arguments` is a JSON-RPC `-32602` error; absent, `null`
|
|
87
97
|
and `[]` mean no arguments.
|
|
88
98
|
|
|
99
|
+
**The `paths` argument.** `ast_grep_search`, `ast_grep_replace`,
|
|
100
|
+
`ast_grep_outline`, `lens_diagnostics` and `symbol_search` read `paths` through
|
|
101
|
+
one reader (`readPathsArgument`, `tools/shared.ts`), so an entry means the same
|
|
102
|
+
in each. An entry that exists on disk is always a literal, so
|
|
103
|
+
`app/[id]/page.tsx` works as written. Any other entry with a glob character
|
|
104
|
+
(`src/**/*.ts`) expands once, against the call's own root, into the files and
|
|
105
|
+
directories it matches. A matched directory scopes its whole subtree: `src/*` can include
|
|
106
|
+
`src/pkg/nested.ts` through `src/pkg`, even though the file itself does not
|
|
107
|
+
match the glob. A glob that matches nothing answers `no file matches`, and a
|
|
108
|
+
glob that reaches outside the workspace is refused, as is an entry that starts with `!`
|
|
109
|
+
(`paths` names what to include; leave files out through the project ignore
|
|
110
|
+
config). The argument holds at most 100 entries, and the list a tool
|
|
111
|
+
receives after expansion is capped at the same 100 (`MAX_PATHS_ENTRIES`), counting
|
|
112
|
+
a matched directory once rather than counting its descendants; a
|
|
113
|
+
tool that is handed a list and not a filter refuses a larger scope rather than
|
|
114
|
+
narrowing it. `symbol_search` filters an index, so the file cap is lifted for
|
|
115
|
+
it and only the walk bound applies. A literal outside the workspace is left
|
|
116
|
+
alone.
|
|
117
|
+
|
|
89
118
|
## Per-edit
|
|
90
119
|
|
|
91
120
|
- **`lens_diagnostics`** — Session-cache or LSP-probe diagnostic state, selected
|
|
@@ -122,7 +151,10 @@ and `[]` mean no arguments.
|
|
|
122
151
|
(never dropped outright); this is what makes save-triggered servers like
|
|
123
152
|
Expert (Elixir) re-diagnose an edit made through pi-lens (refs #3405,
|
|
124
153
|
#3408). Legacy `mode`: `delta` (current turn), `all` (resurfaces stale
|
|
125
|
-
blockers dropped from turn context), `full` (project-wide scan).
|
|
154
|
+
blockers dropped from turn context), `full` (project-wide scan). When the delta
|
|
155
|
+
has no findings, files no check completed on are reported as not checked (`⚠ N files not checked, so no
|
|
156
|
+
findings is not a clean result`), naming at most five files and counting
|
|
157
|
+
the rest (`+2 more`, for example). A delta with findings omits this line.
|
|
126
158
|
- **`lens_diagnostic_mark`** — Triage a diagnostic: `false-positive` /
|
|
127
159
|
`suppress` (writes an inline `pi-lens-ignore` comment) / `defer`
|
|
128
160
|
(session-only) / `flagged` (persists, rendered `📌 flagged-to-fix`).
|
|
@@ -172,7 +204,11 @@ and `[]` mean no arguments.
|
|
|
172
204
|
results include a `suggestedDump` hint pointing at `ast_grep_search` with `dump=true`.
|
|
173
205
|
- **`ast_grep_replace`** — AST-aware structural replace. Re-validates the pattern
|
|
174
206
|
against the current file before writing and reports a clear error if the
|
|
175
|
-
file changed since the preview.
|
|
207
|
+
file changed since the preview. Under `--no-autofix` (`autofix.enabled:
|
|
208
|
+
false`) a preview with `apply: false` still runs and `apply: true` is
|
|
209
|
+
refused before any scan (`tools/ast-grep-replace.ts`). An apply also refuses
|
|
210
|
+
a file outside the session's writable roots, as `lens_diagnostic_mark` and a
|
|
211
|
+
language-server workspace edit do (#5417).
|
|
176
212
|
- **`ast_grep_search` with `dump=true`** — Dumps the raw tree-sitter AST for a source snippet. Use
|
|
177
213
|
this when an `ast_grep_search` or `ast_grep_replace` pattern returns zero
|
|
178
214
|
matches and the correct node kind or field name is unknown. `includeAnonymous`
|
|
@@ -199,7 +235,10 @@ and `[]` mean no arguments.
|
|
|
199
235
|
self-builds in the background and never blocks the call. The answer is one
|
|
200
236
|
ranked table: a `symbol` row per file with its path, best-matching line,
|
|
201
237
|
score, hit count and any graph annotations, or a `file` listing row with just
|
|
202
|
-
its path when the query carries a scope
|
|
238
|
+
its path when the query carries a scope (`paths`, `lang`, or an inline
|
|
239
|
+
`lang:`, `file:` or `ext:` filter) but no terms. A call with neither terms nor
|
|
240
|
+
scope is an error on the pi tool and over MCP alike, and an unknown `lang`
|
|
241
|
+
value is refused with the accepted file kinds and language ids. Then a footer with
|
|
203
242
|
index coverage and a
|
|
204
243
|
next-step line naming the top-ranked hit (`module_report <path>`) — read that
|
|
205
244
|
line with `offset=<line>, limit=1`. Both surfaces render it through
|
|
@@ -219,11 +258,14 @@ and `[]` mean no arguments.
|
|
|
219
258
|
size-skip verdict; later calls name the cap and start no build, so raise it
|
|
220
259
|
in `.pi-lens.json` instead of retrying.
|
|
221
260
|
- **`effective_config`** — Explains the resolved configuration and its
|
|
222
|
-
provenance. Pass `
|
|
223
|
-
per-runner selection decisions.
|
|
224
|
-
no
|
|
225
|
-
|
|
226
|
-
|
|
261
|
+
provenance. Pass `path` to add that file's language and the per-server and
|
|
262
|
+
per-runner selection decisions. A runner's decision is `selected`,
|
|
263
|
+
`disabled-by-config`, `no-project-config` (a runner that declares it needs
|
|
264
|
+
project config and would skip without it), `not-registered-for-kind` or
|
|
265
|
+
`no-dispatch-plan`. The result holds no
|
|
266
|
+
environment values and no command arguments beyond the binary, and it shows
|
|
267
|
+
paths under the home folder home-relative (a path outside it stays absolute).
|
|
268
|
+
`path` must resolve inside `cwd`. See
|
|
227
269
|
[configuration.md](configuration.md#asking-what-is-actually-in-effect).
|
|
228
270
|
- **`module_report`** — Navigable outline of a file: every symbol's name/kind/
|
|
229
271
|
startLine/endLine/signature, exported vs internal split, class/interface
|
|
@@ -492,16 +492,16 @@ server with the reason it was selected or denied, and the runners that would
|
|
|
492
492
|
dispatch. That is the answer to "why is this running" and to "why is this *not*
|
|
493
493
|
running", without reading a log.
|
|
494
494
|
|
|
495
|
-
Naming a
|
|
495
|
+
Naming a file (the `path` argument) resolves the configuration **at that file's own directory**,
|
|
496
496
|
which is where the runtime decides from — so a nested `repo/sub/.pi-lens.json`
|
|
497
497
|
layer contributes to the answer, appears in the reported document list, and is
|
|
498
498
|
named as the file behind any decision it made. The walk runs upward and is
|
|
499
|
-
**confined to `cwd`**: a `
|
|
499
|
+
**confined to `cwd`**: a `path` that resolves outside `cwd` — including a
|
|
500
500
|
sibling package in the same monorepo — is rejected rather than answered from
|
|
501
501
|
its own unrelated tree, because the per-file answer is only ever correct when
|
|
502
502
|
it is a superset of the workspace's own; the rejection names the `cwd` it was
|
|
503
503
|
measured against and the remedy is to re-query with `cwd` set to that file's
|
|
504
|
-
own workspace. A confined `
|
|
504
|
+
own workspace. A confined `path` always passes back through the workspace's
|
|
505
505
|
own documents on its way up, so they are always included too.
|
|
506
506
|
|
|
507
507
|
It reports **sources, never values**. Environment values never appear, a custom
|
|
@@ -273,7 +273,14 @@ Note: `maxProjectFiles` (below) is discovered differently — via an upward walk
|
|
|
273
273
|
|
|
274
274
|
Per-rule threshold overrides and policy filters. Currently honored:
|
|
275
275
|
|
|
276
|
-
- `high-complexity.threshold` — cyclomatic complexity (default `15`)
|
|
276
|
+
- `high-complexity.threshold` — cyclomatic complexity (default `15`). The
|
|
277
|
+
same number judges the per-edit complexity line (`⚠ complexity vs main: …`),
|
|
278
|
+
which names a function an edit made worse than the default branch has it,
|
|
279
|
+
and `disable`/`select`/`ignorePaths` of `high-complexity` switch the line off
|
|
280
|
+
too. The line uses the JS/TS thresholds (cyclomatic `15`, nesting `6`) for
|
|
281
|
+
every language it covers (Python, Go and Rust included) until #5089 sets
|
|
282
|
+
per-language ones. It never names an anonymous function, and a file over
|
|
283
|
+
256 KiB is not judged.
|
|
277
284
|
- `high-fan-out.threshold` — distinct function calls (default `20`)
|
|
278
285
|
- `<id>.disable` — disable diagnostics for the listed rule ids (output-only
|
|
279
286
|
filter). Same rule-id normalization as `pi-lens-ignore`: a user lists
|
|
@@ -44,6 +44,13 @@
|
|
|
44
44
|
fail-closed for those project fields with one bounded notice; installs keep
|
|
45
45
|
their existing compatibility policy. `tests/clients/lsp/lsp-registry-trust.test.ts`
|
|
46
46
|
and the LSP config/service suites pin the boundary.
|
|
47
|
+
Adopted roots resolve their own pi decision through the host's exported
|
|
48
|
+
`ProjectTrustStore.get`, resource classifier and global `defaultProjectTrust`;
|
|
49
|
+
missing exports refuse project-code servers. The registry reads each root once
|
|
50
|
+
per owning turn; detached acquisitions reread. SDK loading is deadline-bound
|
|
51
|
+
and abandoned on registry retirement. It never answers or writes pi trust. Inert servers keep their
|
|
52
|
+
existing adopted-root admission. `tests/clients/lsp/adopted-root-trust-5469.test.ts`
|
|
53
|
+
pins the host/session/root matrix.
|
|
47
54
|
Non-pi process entry points (`mcp/server.ts`, `mcp/worker.ts`,
|
|
48
55
|
`mcp/analyze-cli.ts`, and `mcp/cli.ts`) declare trusted execution once at
|
|
49
56
|
startup through `setProjectTrustState`: workspace trust belongs to their
|
|
@@ -136,7 +136,8 @@ the dispatcher accepts without comment: an undeclared key is reported in the
|
|
|
136
136
|
result (a leading `Ignored unknown argument(s) ...` line, plus
|
|
137
137
|
`structuredContent.ignoredArguments`). An ignored key that leaves a required
|
|
138
138
|
input missing, or that is a declared parameter the call did not send written
|
|
139
|
-
another way (`
|
|
139
|
+
another way (`pilens_module_report {"filePath": ...}` for `path`; the three tools
|
|
140
|
+
that declare `filePath` as an alias run it instead; predicate in
|
|
140
141
|
[public-api-stability.md](public-api-stability.md)), turns the call into an error
|
|
141
142
|
instead of a run on defaults; a looser "did you mean" stays a warning (#3749;
|
|
142
143
|
details in [agent-tools.md](agent-tools.md)). The check is the one seam in
|
|
@@ -130,7 +130,7 @@ pi --no-madge # Disable the madge session-start analyzer
|
|
|
130
130
|
pi --no-gitleaks # Disable the gitleaks session-start analyzer
|
|
131
131
|
pi --no-govulncheck # Disable the govulncheck session-start analyzer
|
|
132
132
|
pi --no-dead-code # Disable the dead-code session-start analyzer
|
|
133
|
-
pi --no-complexity # Disable the complexity
|
|
133
|
+
pi --no-complexity # Disable the complexity analyzer and the per-edit complexity line
|
|
134
134
|
|
|
135
135
|
# Actionable warnings (all default off)
|
|
136
136
|
pi --lens-actionable-warnings # Report fixable warnings at turn end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-extensions",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.8",
|
|
4
4
|
"description": "Aggregate installer for HerbertGao-maintained Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extensions",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"@herbertgao/pi-bark": "0.2.2",
|
|
44
44
|
"@herbertgao/pi-cc-extensions": "1.0.16-local.1",
|
|
45
45
|
"@herbertgao/pi-impeccable": "0.3.0",
|
|
46
|
-
"@herbertgao/pi-subagents": "0.23.
|
|
46
|
+
"@herbertgao/pi-subagents": "0.23.2-local.1",
|
|
47
47
|
"@herbertgao/sol-pi": "0.4.3",
|
|
48
48
|
"@juicesharp/rpiv-ask-user-question": "2.15.0",
|
|
49
49
|
"@juicesharp/rpiv-config": "^2.15.0",
|
|
50
50
|
"@modelcontextprotocol/sdk": "^1.32.1",
|
|
51
51
|
"@mozilla/readability": "^0.6.0",
|
|
52
52
|
"@napi-rs/keyring": "^2.1.0",
|
|
53
|
-
"@narumitw/pi-btw": "0.63.
|
|
53
|
+
"@narumitw/pi-btw": "0.63.7",
|
|
54
54
|
"@narumitw/pi-caffeinate": "0.49.14",
|
|
55
55
|
"@narumitw/pi-tui-kit": "^0.69.1",
|
|
56
56
|
"@pi-plugins/fast-mode": "0.1.15",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"p-limit": "^6.1.0",
|
|
75
75
|
"pi-antigravity": "0.12.0",
|
|
76
76
|
"pi-commandcode-provider": "0.8.1",
|
|
77
|
-
"pi-lens": "4.4.
|
|
77
|
+
"pi-lens": "4.4.12",
|
|
78
78
|
"pi-next-cue": "1.0.8",
|
|
79
79
|
"pi-provider-qoder": "0.6.12",
|
|
80
80
|
"pi-typesafe": "0.14.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": 3,
|
|
3
|
-
"sources": ["../../src/main-tree-picker.ts"],
|
|
4
|
-
"sourcesContent": ["import {\n copyToClipboard,\n type ExtensionAPI,\n type ExtensionCommandContext,\n type SessionEntry,\n type SessionTreeNode,\n TreeSelectorComponent,\n} from \"@earendil-works/pi-coding-agent\";\nimport { type Component, type Focusable, Key, matchesKey } from \"@earendil-works/pi-tui\";\nimport { showBtwCustomPreservingEditor } from \"./menu.js\";\nimport { sanitizeSingleLine } from \"./text.js\";\n\nexport type MainEntryPickResult = { kind: \"selected\"; entryId: string } | { kind: \"back\" } | { kind: \"closed\" };\n\nexport interface MainThreadTreeSelector extends Component, Focusable {\n onCopy?: (text: string | undefined) => void;\n setViewLabel?(entryId: string, label: string | undefined, labelTimestamp?: string): void;\n dispose?(): void;\n}\n\nexport interface MainThreadTreeSelectorOptions {\n tree: SessionTreeNode[];\n currentLeafId: string | null;\n terminalRows: number;\n onSelect: (entryId: string) => void;\n onCancel: () => void;\n onCopy: (entryId: string | undefined, displayText: string | undefined) => void;\n onLabelChange: (entryId: string, label: string | undefined) => void;\n}\n\nexport interface MainThreadTreePickerDependencies {\n createSelector?: (options: MainThreadTreeSelectorOptions) => MainThreadTreeSelector;\n copyToClipboard?: (text: string, signal: AbortSignal) => Promise<void>;\n}\n\nclass MainThreadTreePickerComponent implements Component, Focusable {\n constructor(\n private readonly selector: MainThreadTreeSelector,\n private readonly onClose: () => void,\n ) {}\n\n get focused(): boolean {\n return this.selector.focused;\n }\n\n set focused(value: boolean) {\n this.selector.focused = value;\n }\n\n get wantsKeyRelease(): boolean | undefined {\n return this.selector.wantsKeyRelease;\n }\n\n render(width: number): string[] {\n return this.selector.render(width);\n }\n\n handleInput(data: string): void {\n if (matchesKey(data, Key.ctrl(\"c\"))) {\n this.onClose();\n return;\n }\n this.selector.handleInput?.(data);\n }\n\n invalidate(): void {\n this.selector.invalidate();\n }\n\n dispose(): void {\n this.selector.dispose?.();\n this.onClose();\n }\n}\n\nexport async function pickMainEntry(\n pi: ExtensionAPI,\n ctx: ExtensionCommandContext,\n dependencies: MainThreadTreePickerDependencies = {},\n): Promise<MainEntryPickResult> {\n let rawTree: SessionTreeNode[];\n let currentLeafId: string | null;\n try {\n rawTree = ctx.sessionManager.getTree();\n currentLeafId = ctx.sessionManager.getLeafId();\n } catch {\n return { kind: \"closed\" };\n }\n\n if (rawTree.length === 0) {\n notifySafely(ctx, \"No main-thread entries are available\", \"warning\");\n return { kind: \"back\" };\n }\n\n const tree = sanitizeTreeForDisplay(rawTree);\n const rawCopyText = collectRawCopyText(rawTree);\n const savedLabels = collectSavedLabels(rawTree);\n const createSelector = dependencies.createSelector ?? createNativeTreeSelector;\n const copy = dependencies.copyToClipboard ?? copyText;\n const copyControllers = new Set<AbortController>();\n const copyTasks = new Set<Promise<void>>();\n const abortCopies = () => {\n for (const controller of copyControllers) {\n controller.abort(new Error(\"The main-thread tree picker closed\"));\n }\n };\n const result = await showBtwCustomPreservingEditor<MainEntryPickResult>(ctx, (tui, _theme, _keybindings, done) => {\n let settled = false;\n let selector: MainThreadTreeSelector | undefined;\n const finish = (value: MainEntryPickResult) => {\n if (settled) return;\n settled = true;\n abortCopies();\n done(value);\n };\n const onCopy = (entryId: string | undefined, displayText: string | undefined) => {\n if (settled) return;\n const text = entryId ? rawCopyText.get(entryId) : displayText;\n if (!text) {\n notifySafely(ctx, \"Selected entry has no text to copy\", \"warning\");\n return;\n }\n const controller = new AbortController();\n copyControllers.add(controller);\n let operation: Promise<void>;\n try {\n operation = copy(text, controller.signal);\n } catch (error: unknown) {\n operation = Promise.reject(error);\n }\n let task!: Promise<void>;\n task = operation\n .then(() => {\n if (!settled) notifySafely(ctx, \"Copied selected message\", \"info\");\n })\n .catch((error: unknown) => {\n if (!settled && !controller.signal.aborted) {\n notifySafely(ctx, `Could not copy selected message: ${formatError(error)}`, \"error\");\n }\n })\n .finally(() => {\n copyControllers.delete(controller);\n copyTasks.delete(task);\n });\n copyTasks.add(task);\n };\n const restoreLabel = (entryId: string) => {\n const previous = savedLabels.get(entryId);\n selector?.setViewLabel?.(entryId, previous?.label, previous?.labelTimestamp);\n tui.requestRender();\n };\n const onLabelChange = (entryId: string, label: string | undefined) => {\n if (settled) return;\n try {\n if (!ctx.sessionManager.getEntry(entryId)) {\n restoreLabel(entryId);\n notifySafely(ctx, \"The selected main-thread entry is no longer available\", \"warning\");\n return;\n }\n const persistedLabel = label === undefined ? undefined : sanitizeSingleLine(label);\n pi.setLabel(entryId, persistedLabel);\n savedLabels.set(entryId, { label: persistedLabel });\n selector?.setViewLabel?.(entryId, persistedLabel);\n tui.requestRender();\n } catch (error: unknown) {\n restoreLabel(entryId);\n notifySafely(ctx, `Could not update tree label: ${formatError(error)}`, \"error\");\n }\n };\n selector = createSelector({\n tree,\n currentLeafId,\n terminalRows: tui.terminal.rows,\n onSelect: (entryId) => finish({ kind: \"selected\", entryId }),\n onCancel: () => finish({ kind: \"back\" }),\n onCopy,\n onLabelChange,\n });\n return new MainThreadTreePickerComponent(selector, () => finish({ kind: \"closed\" }));\n });\n abortCopies();\n await Promise.allSettled([...copyTasks]);\n\n return result ?? { kind: \"closed\" };\n}\n\nfunction createNativeTreeSelector(options: MainThreadTreeSelectorOptions): MainThreadTreeSelector {\n const selector = new TreeSelectorComponent(\n options.tree,\n options.currentLeafId,\n options.terminalRows,\n options.onSelect,\n options.onCancel,\n options.onLabelChange,\n );\n selector.onCopy = (displayText) => options.onCopy(selector.getTreeList().getSelectedNode()?.entry.id, displayText);\n const result = selector as MainThreadTreeSelector;\n result.setViewLabel = (entryId, label, labelTimestamp) =>\n selector.getTreeList().updateNodeLabel(entryId, label, labelTimestamp);\n return result;\n}\n\nfunction sanitizeTreeForDisplay(tree: readonly SessionTreeNode[]): SessionTreeNode[] {\n return tree.map((node) => {\n const result: SessionTreeNode = {\n entry: sanitizeEntryForDisplay(node.entry),\n children: sanitizeTreeForDisplay(node.children),\n };\n if (node.label !== undefined) result.label = sanitizeSingleLine(node.label);\n if (node.labelTimestamp !== undefined) {\n result.labelTimestamp = sanitizeSingleLine(node.labelTimestamp);\n }\n return result;\n });\n}\n\nfunction sanitizeEntryForDisplay(entry: SessionEntry): SessionEntry {\n switch (entry.type) {\n case \"message\": {\n const message = { ...entry.message } as Record<string, unknown>;\n if (\"content\" in entry.message) message.content = sanitizeDisplayContent(entry.message.content);\n for (const key of [\"role\", \"errorMessage\", \"command\", \"toolName\"] as const) {\n const value = message[key];\n if (typeof value === \"string\") message[key] = sanitizeSingleLine(value);\n }\n return { ...entry, message } as unknown as SessionEntry;\n }\n case \"custom_message\":\n return {\n ...entry,\n customType: sanitizeSingleLine(entry.customType),\n content: sanitizeDisplayContent(entry.content) as typeof entry.content,\n };\n case \"compaction\":\n return { ...entry, summary: sanitizeSingleLine(entry.summary) };\n case \"branch_summary\":\n return { ...entry, summary: sanitizeSingleLine(entry.summary) };\n case \"model_change\":\n return {\n ...entry,\n provider: sanitizeSingleLine(entry.provider),\n modelId: sanitizeSingleLine(entry.modelId),\n };\n case \"thinking_level_change\":\n return { ...entry, thinkingLevel: sanitizeSingleLine(entry.thinkingLevel) };\n case \"custom\":\n return { ...entry, customType: sanitizeSingleLine(entry.customType) };\n case \"context_edit\":\n return { ...entry, targetId: sanitizeSingleLine(entry.targetId) };\n case \"label\":\n return {\n ...entry,\n label: entry.label === undefined ? undefined : sanitizeSingleLine(entry.label),\n };\n case \"session_info\":\n return {\n ...entry,\n name: entry.name === undefined ? undefined : sanitizeSingleLine(entry.name),\n };\n case \"usage\":\n return {\n ...entry,\n kind: sanitizeSingleLine(entry.kind),\n provider: sanitizeSingleLine(entry.provider),\n model: sanitizeSingleLine(entry.model),\n note: entry.note === undefined ? undefined : sanitizeSingleLine(entry.note),\n };\n }\n}\n\nfunction sanitizeDisplayContent(content: unknown): unknown {\n if (typeof content === \"string\") return sanitizeSingleLine(content);\n if (!Array.isArray(content)) return content;\n return content.map((block) => {\n if (block === null || typeof block !== \"object\" || !(\"type\" in block)) return block;\n if (block.type === \"text\" && \"text\" in block && typeof block.text === \"string\") {\n return { ...block, text: sanitizeSingleLine(block.text) };\n }\n if (block.type === \"toolCall\") {\n const copy = { ...block } as Record<string, unknown>;\n if (typeof copy.name === \"string\") copy.name = sanitizeSingleLine(copy.name);\n copy.arguments = sanitizeToolArguments(copy.arguments, new WeakMap());\n return copy;\n }\n return block;\n });\n}\n\nfunction sanitizeToolArguments(value: unknown, seen: WeakMap<object, unknown>): unknown {\n if (typeof value === \"string\") return sanitizeSingleLine(value);\n if (value === null || typeof value !== \"object\") return value;\n const existing = seen.get(value);\n if (existing !== undefined) return existing;\n if (Array.isArray(value)) {\n const result: unknown[] = [];\n seen.set(value, result);\n for (const item of value) result.push(sanitizeToolArguments(item, seen));\n return result;\n }\n const result: Record<string, unknown> = {};\n seen.set(value, result);\n for (const [key, item] of Object.entries(value)) {\n result[key] = sanitizeToolArguments(item, seen);\n }\n return result;\n}\n\nfunction collectRawCopyText(tree: readonly SessionTreeNode[]): Map<string, string> {\n const result = new Map<string, string>();\n const visit = (nodes: readonly SessionTreeNode[]) => {\n for (const node of nodes) {\n const text = getRawCopyText(node.entry);\n if (text !== undefined) result.set(node.entry.id, text);\n visit(node.children);\n }\n };\n visit(tree);\n return result;\n}\n\nfunction getRawCopyText(entry: SessionEntry): string | undefined {\n let text: string | undefined;\n if (entry.type === \"message\") {\n if (entry.message.role === \"bashExecution\") text = entry.message.command;\n else if (\"content\" in entry.message) {\n text = extractRawText(entry.message.content);\n if (!text && entry.message.role === \"assistant\") text = entry.message.errorMessage;\n }\n } else if (entry.type === \"custom_message\") text = extractRawText(entry.content);\n else if (entry.type === \"compaction\" || entry.type === \"branch_summary\") text = entry.summary;\n return text?.trim() ? text : undefined;\n}\n\nfunction extractRawText(content: unknown): string {\n if (typeof content === \"string\") return content;\n if (!Array.isArray(content)) return \"\";\n return content\n .filter(\n (block): block is { type: \"text\"; text: string } =>\n block !== null &&\n typeof block === \"object\" &&\n \"type\" in block &&\n block.type === \"text\" &&\n \"text\" in block &&\n typeof block.text === \"string\",\n )\n .map((block) => block.text)\n .join(\"\");\n}\n\ninterface SavedLabel {\n label: string | undefined;\n labelTimestamp?: string;\n}\n\nfunction collectSavedLabels(tree: readonly SessionTreeNode[]): Map<string, SavedLabel> {\n const result = new Map<string, SavedLabel>();\n const visit = (nodes: readonly SessionTreeNode[]) => {\n for (const node of nodes) {\n result.set(node.entry.id, {\n label: node.label === undefined ? undefined : sanitizeSingleLine(node.label),\n labelTimestamp: node.labelTimestamp === undefined ? undefined : sanitizeSingleLine(node.labelTimestamp),\n });\n visit(node.children);\n }\n };\n visit(tree);\n return result;\n}\n\nasync function copyText(text: string, signal: AbortSignal): Promise<void> {\n signal.throwIfAborted();\n await copyToClipboard(text);\n signal.throwIfAborted();\n}\n\nfunction notifySafely(\n ctx: ExtensionCommandContext,\n message: string,\n level: Parameters<ExtensionCommandContext[\"ui\"][\"notify\"]>[1],\n): void {\n try {\n ctx.ui.notify(sanitizeSingleLine(message), level);\n } catch {\n // The command context may have been replaced while the selector was open.\n }\n}\n\nfunction formatError(error: unknown): string {\n return error instanceof Error ? error.message : String(error);\n}\n"],
|
|
5
|
-
"mappings": ";;;;;;;;;;;AAAA;AAAA,EACE;AAAA,EAKA;AAAA,OACK;AACP,SAAyC,KAAK,kBAAkB;AA2BhE,IAAM,gCAAN,MAAoE;AAAA,EAClE,YACmB,UACA,SACjB;AAFiB;AACA;AAAA,EAChB;AAAA,EAFgB;AAAA,EACA;AAAA,EAGnB,IAAI,UAAmB;AACrB,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,IAAI,QAAQ,OAAgB;AAC1B,SAAK,SAAS,UAAU;AAAA,EAC1B;AAAA,EAEA,IAAI,kBAAuC;AACzC,WAAO,KAAK,SAAS;AAAA,EACvB;AAAA,EAEA,OAAO,OAAyB;AAC9B,WAAO,KAAK,SAAS,OAAO,KAAK;AAAA,EACnC;AAAA,EAEA,YAAY,MAAoB;AAC9B,QAAI,WAAW,MAAM,IAAI,KAAK,GAAG,CAAC,GAAG;AACnC,WAAK,QAAQ;AACb;AAAA,IACF;AACA,SAAK,SAAS,cAAc,IAAI;AAAA,EAClC;AAAA,EAEA,aAAmB;AACjB,SAAK,SAAS,WAAW;AAAA,EAC3B;AAAA,EAEA,UAAgB;AACd,SAAK,SAAS,UAAU;AACxB,SAAK,QAAQ;AAAA,EACf;AACF;AAEA,eAAsB,cACpB,IACA,KACA,eAAiD,CAAC,GACpB;AAC9B,MAAI;AACJ,MAAI;AACJ,MAAI;AACF,cAAU,IAAI,eAAe,QAAQ;AACrC,oBAAgB,IAAI,eAAe,UAAU;AAAA,EAC/C,QAAQ;AACN,WAAO,EAAE,MAAM,SAAS;AAAA,EAC1B;AAEA,MAAI,QAAQ,WAAW,GAAG;AACxB,iBAAa,KAAK,wCAAwC,SAAS;AACnE,WAAO,EAAE,MAAM,OAAO;AAAA,EACxB;AAEA,QAAM,OAAO,uBAAuB,OAAO;AAC3C,QAAM,cAAc,mBAAmB,OAAO;AAC9C,QAAM,cAAc,mBAAm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MAAI;AACF,QAAI,GAAG,OAAO,mBAAmB,OAAO,GAAG,KAAK;AAAA,EAClD,QAAQ;AAAA,EAER;AACF;AAEA,SAAS,YAAY,OAAwB;AAC3C,SAAO,iBAAiB,QAAQ,MAAM,UAAU,OAAO,KAAK;AAC9D;",
|
|
6
|
-
"names": ["result"]
|
|
7
|
-
}
|
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
|
|
2
|
-
import {
|
|
3
|
-
recordDegradationOnce
|
|
4
|
-
} from "./chunk-AGEQRJ5A.js";
|
|
5
|
-
|
|
6
|
-
// dist/clients/deadline-utils.js
|
|
7
|
-
function combineAbortSignals(...signals) {
|
|
8
|
-
const live = signals.filter((s) => s !== void 0);
|
|
9
|
-
if (live.length <= 1)
|
|
10
|
-
return live[0];
|
|
11
|
-
if (typeof AbortSignal.any === "function")
|
|
12
|
-
return AbortSignal.any(live);
|
|
13
|
-
const controller = new AbortController();
|
|
14
|
-
for (const s of live) {
|
|
15
|
-
if (s.aborted) {
|
|
16
|
-
controller.abort(s.reason);
|
|
17
|
-
break;
|
|
18
|
-
}
|
|
19
|
-
s.addEventListener("abort", () => controller.abort(s.reason), {
|
|
20
|
-
once: true
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
return controller.signal;
|
|
24
|
-
}
|
|
25
|
-
function untilAborted(work, signal, aborted) {
|
|
26
|
-
if (!signal)
|
|
27
|
-
return work;
|
|
28
|
-
if (signal.aborted)
|
|
29
|
-
return Promise.race([work, Promise.resolve(aborted)]);
|
|
30
|
-
let onAbort;
|
|
31
|
-
const abortedPromise = new Promise((resolve) => {
|
|
32
|
-
onAbort = () => resolve(aborted);
|
|
33
|
-
signal.addEventListener("abort", onAbort, { once: true });
|
|
34
|
-
});
|
|
35
|
-
return Promise.race([work, abortedPromise]).finally(() => {
|
|
36
|
-
if (onAbort)
|
|
37
|
-
signal.removeEventListener("abort", onAbort);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function withDeadline(promise, options) {
|
|
41
|
-
const onTimeout = options.onTimeout ?? "reject";
|
|
42
|
-
const onReject = options.onReject ?? "propagate";
|
|
43
|
-
const ms = options.ms ?? (options.deadlineAt !== void 0 ? options.deadlineAt - Date.now() : 0);
|
|
44
|
-
if (ms <= 0) {
|
|
45
|
-
promise.catch(() => {
|
|
46
|
-
});
|
|
47
|
-
return onTimeout === "undefined" ? Promise.resolve(void 0) : Promise.reject(new Error(`Timeout after ${Math.max(0, ms)}ms`));
|
|
48
|
-
}
|
|
49
|
-
const base = onReject === "undefined" ? promise.catch(() => void 0) : promise;
|
|
50
|
-
if (onReject === "propagate")
|
|
51
|
-
promise.catch(() => {
|
|
52
|
-
});
|
|
53
|
-
let timer;
|
|
54
|
-
const timeoutPromise = new Promise((resolve, reject) => {
|
|
55
|
-
timer = setTimeout(() => {
|
|
56
|
-
if (onTimeout === "undefined")
|
|
57
|
-
resolve(void 0);
|
|
58
|
-
else
|
|
59
|
-
reject(new Error(`Timeout after ${ms}ms`));
|
|
60
|
-
}, ms);
|
|
61
|
-
});
|
|
62
|
-
return Promise.race([base, timeoutPromise]).finally(() => {
|
|
63
|
-
if (timer)
|
|
64
|
-
clearTimeout(timer);
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
function withTimeout(promise, timeoutMs) {
|
|
68
|
-
return withDeadline(promise, { ms: timeoutMs });
|
|
69
|
-
}
|
|
70
|
-
function withBudget(promise, budgetMs) {
|
|
71
|
-
return withDeadline(promise, { ms: budgetMs, onTimeout: "undefined" });
|
|
72
|
-
}
|
|
73
|
-
var BOUND_ABORTED = /* @__PURE__ */ Symbol("pi-lens/bounded/aborted");
|
|
74
|
-
async function bounded(promise, options) {
|
|
75
|
-
const { signal, shutdownSignal, hook, label } = options;
|
|
76
|
-
const ms = Number.isFinite(options.ms) ? Math.max(0, options.ms) : 0;
|
|
77
|
-
const startedAt = Date.now();
|
|
78
|
-
const boxed = promise.then((value) => ({ value }));
|
|
79
|
-
void boxed.catch(() => {
|
|
80
|
-
});
|
|
81
|
-
let cause;
|
|
82
|
-
let timer;
|
|
83
|
-
let onCallerAbort;
|
|
84
|
-
let onShutdownAbort;
|
|
85
|
-
const abandoned = new Promise((resolve) => {
|
|
86
|
-
const fire = (reason) => {
|
|
87
|
-
cause ??= reason;
|
|
88
|
-
resolve(BOUND_ABORTED);
|
|
89
|
-
};
|
|
90
|
-
if (signal?.aborted)
|
|
91
|
-
return fire("caller-abort");
|
|
92
|
-
if (shutdownSignal?.aborted)
|
|
93
|
-
return fire("shutdown");
|
|
94
|
-
if (ms <= 0)
|
|
95
|
-
return fire("deadline");
|
|
96
|
-
timer = setTimeout(() => fire("deadline"), ms);
|
|
97
|
-
timer.unref?.();
|
|
98
|
-
onCallerAbort = () => fire("caller-abort");
|
|
99
|
-
signal?.addEventListener("abort", onCallerAbort, { once: true });
|
|
100
|
-
if (shutdownSignal) {
|
|
101
|
-
onShutdownAbort = () => fire("shutdown");
|
|
102
|
-
shutdownSignal.addEventListener("abort", onShutdownAbort, {
|
|
103
|
-
once: true
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
try {
|
|
108
|
-
const settled = await Promise.race([boxed, abandoned]);
|
|
109
|
-
if (settled !== BOUND_ABORTED)
|
|
110
|
-
return settled.value;
|
|
111
|
-
const elapsedMs = Date.now() - startedAt;
|
|
112
|
-
const fired = cause ?? "deadline";
|
|
113
|
-
if (fired === "deadline" || fired === "shutdown") {
|
|
114
|
-
recordDegradationOnce({
|
|
115
|
-
kind: fired === "deadline" ? "hook-await-exceeded" : "hook-await-abandoned",
|
|
116
|
-
subject: `${hook}:${label}`,
|
|
117
|
-
reason: fired === "deadline" ? `exceeded ${ms}ms budget after ${elapsedMs}ms` : `abandoned after ${elapsedMs}ms: session is shutting down (budget ${ms}ms)`,
|
|
118
|
-
metadata: { hook, label, budgetMs: ms, elapsedMs, cause: fired }
|
|
119
|
-
});
|
|
120
|
-
}
|
|
121
|
-
return void 0;
|
|
122
|
-
} finally {
|
|
123
|
-
if (timer !== void 0)
|
|
124
|
-
clearTimeout(timer);
|
|
125
|
-
if (onCallerAbort)
|
|
126
|
-
signal?.removeEventListener("abort", onCallerAbort);
|
|
127
|
-
if (onShutdownAbort) {
|
|
128
|
-
shutdownSignal?.removeEventListener("abort", onShutdownAbort);
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
export {
|
|
134
|
-
combineAbortSignals,
|
|
135
|
-
untilAborted,
|
|
136
|
-
withDeadline,
|
|
137
|
-
withTimeout,
|
|
138
|
-
withBudget,
|
|
139
|
-
bounded
|
|
140
|
-
};
|