@herbertgao/pi-extensions 2026.10.12 → 2026.10.14

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 (269) hide show
  1. package/README.md +11 -11
  2. package/THIRD_PARTY_NOTICES.md +3 -3
  3. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +7 -9
  4. package/node_modules/@herbertgao/pi-cc-extensions/README.md +7 -9
  5. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +1 -0
  6. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +14 -8
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +22 -5
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +28 -6
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/prompt-editor.ts +33 -12
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +60 -17
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +1 -5
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +20 -5
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +4 -1
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +42 -18
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +12 -3
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +131 -0
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +217 -113
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +12 -5
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/subagent-notification.ts +556 -0
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +50 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +11 -0
  22. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/patch-keys.ts +4 -0
  23. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  24. package/node_modules/@juicesharp/rpiv-ask-user-question/README.md +1 -0
  25. package/node_modules/@juicesharp/rpiv-ask-user-question/ask-user-question.ts +27 -3
  26. package/node_modules/@juicesharp/rpiv-ask-user-question/config.ts +23 -0
  27. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/configuration.md +15 -0
  28. package/node_modules/@juicesharp/rpiv-ask-user-question/docs/keyboard.md +9 -2
  29. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/de.json +7 -4
  30. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/en.json +8 -5
  31. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/es.json +7 -4
  32. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/fr.json +7 -4
  33. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt-BR.json +7 -4
  34. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/pt.json +7 -4
  35. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/ru.json +7 -4
  36. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/uk.json +7 -4
  37. package/node_modules/@juicesharp/rpiv-ask-user-question/locales/zh.json +7 -4
  38. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +4 -3
  39. package/node_modules/@juicesharp/rpiv-ask-user-question/presentation.ts +11 -1
  40. package/node_modules/@juicesharp/rpiv-ask-user-question/state/build-questionnaire.ts +6 -0
  41. package/node_modules/@juicesharp/rpiv-ask-user-question/state/key-router.ts +49 -8
  42. package/node_modules/@juicesharp/rpiv-ask-user-question/state/questionnaire-session.ts +6 -0
  43. package/node_modules/@juicesharp/rpiv-ask-user-question/state/state-reducer.ts +13 -1
  44. package/node_modules/@juicesharp/rpiv-ask-user-question/state/state.ts +2 -0
  45. package/node_modules/@juicesharp/rpiv-ask-user-question/view/components/preview/preview-block-renderer.ts +19 -7
  46. package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-builder.ts +36 -7
  47. package/node_modules/@juicesharp/rpiv-ask-user-question/view/dialog-copy.ts +13 -2
  48. package/node_modules/@juicesharp/rpiv-ask-user-question/view/tab-content-strategy.ts +24 -8
  49. package/node_modules/@juicesharp/rpiv-ask-user-question/view/transcript.ts +144 -0
  50. package/node_modules/@narumitw/pi-btw/README.md +7 -2
  51. package/node_modules/@narumitw/pi-btw/dist/index.ts +371 -118
  52. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +4 -4
  53. package/node_modules/@narumitw/pi-btw/docs/main-context-runtime.md +45 -0
  54. package/node_modules/@narumitw/pi-btw/docs/workflows.md +48 -5
  55. package/node_modules/@narumitw/pi-btw/package.json +1 -1
  56. package/node_modules/@narumitw/pi-btw/src/btw.ts +39 -14
  57. package/node_modules/@narumitw/pi-btw/src/import-main-updates.ts +84 -0
  58. package/node_modules/@narumitw/pi-btw/src/keybindings.ts +29 -4
  59. package/node_modules/@narumitw/pi-btw/src/main-context-snapshot.ts +125 -0
  60. package/node_modules/@narumitw/pi-btw/src/menu.ts +1 -0
  61. package/node_modules/@narumitw/pi-btw/src/side-thread.ts +66 -17
  62. package/node_modules/@narumitw/pi-btw/src/transcript-markdown.ts +5 -5
  63. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +47 -6
  64. package/node_modules/pi-lens/CHANGELOG.md +440 -0
  65. package/node_modules/pi-lens/README.md +13 -3
  66. package/node_modules/pi-lens/config/dependency-cruiser-eager-allowlist.json +1 -0
  67. package/node_modules/pi-lens/dist/chunk-22Y2BM7H.js +23 -0
  68. package/node_modules/pi-lens/dist/{chunk-ATKJFDQN.js → chunk-27VWVB23.js} +12 -14
  69. package/node_modules/pi-lens/dist/{chunk-S2HEXIWI.js → chunk-2FYKETQJ.js} +10 -6
  70. package/node_modules/pi-lens/dist/{chunk-SRYEJNES.js → chunk-2LDMXL2M.js} +2 -2
  71. package/node_modules/pi-lens/dist/{chunk-ZHH37KZL.js → chunk-2SDHYHHO.js} +17 -17
  72. package/node_modules/pi-lens/dist/chunk-2Y6OJRSI.js +38 -0
  73. package/node_modules/pi-lens/dist/chunk-3SNDVPOR.js +507 -0
  74. package/node_modules/pi-lens/dist/{chunk-5OFV52AM.js → chunk-3WCEHYOI.js} +1 -1
  75. package/node_modules/pi-lens/dist/chunk-44X7VIKR.js +73 -0
  76. package/node_modules/pi-lens/dist/{chunk-DEL2U6CM.js → chunk-4FHUGDKU.js} +16 -14
  77. package/node_modules/pi-lens/dist/{chunk-CT4MN5IU.js → chunk-4ODSZ35Z.js} +353 -359
  78. package/node_modules/pi-lens/dist/{chunk-ZIVJBOO3.js → chunk-4U7GDSZQ.js} +2 -2
  79. package/node_modules/pi-lens/dist/chunk-54NIOJJZ.js +25 -0
  80. package/node_modules/pi-lens/dist/{chunk-N5FLEO7W.js → chunk-5DKE4HGX.js} +37 -37
  81. package/node_modules/pi-lens/dist/{chunk-P63GXC37.js → chunk-5LRUKYFA.js} +31 -4
  82. package/node_modules/pi-lens/dist/{chunk-HRNHZA3N.js → chunk-63NMUNYP.js} +12 -16
  83. package/node_modules/pi-lens/dist/{chunk-HWCCCQNX.js → chunk-6XSESGWD.js} +13 -6
  84. package/node_modules/pi-lens/dist/{chunk-UMS2MFPZ.js → chunk-72J27ICO.js} +2 -3
  85. package/node_modules/pi-lens/dist/{chunk-ED36RF6Y.js → chunk-7FLRUH6B.js} +1 -1
  86. package/node_modules/pi-lens/dist/chunk-7IYC4ENJ.js +297 -0
  87. package/node_modules/pi-lens/dist/chunk-7WWQAW5P.js +30 -0
  88. package/node_modules/pi-lens/dist/{chunk-3DA2JDOL.js → chunk-7ZS7MC24.js} +551 -203
  89. package/node_modules/pi-lens/dist/{chunk-WMYE35PX.js → chunk-AHWA4AKM.js} +7 -5
  90. package/node_modules/pi-lens/dist/{chunk-JW3YWBVB.js → chunk-AI3GP74G.js} +17 -19
  91. package/node_modules/pi-lens/dist/{chunk-AGSS7277.js → chunk-APFJKOP6.js} +6 -23
  92. package/node_modules/pi-lens/dist/{chunk-ZVUL7QYY.js → chunk-ASRAO7KG.js} +29 -32
  93. package/node_modules/pi-lens/dist/{chunk-BW5KFIQC.js → chunk-AWQWXSW4.js} +1 -0
  94. package/node_modules/pi-lens/dist/{chunk-TLX72JTG.js → chunk-CG5V25HX.js} +1 -1
  95. package/node_modules/pi-lens/dist/chunk-CKEQFGLT.js +32 -0
  96. package/node_modules/pi-lens/dist/{chunk-Y6GZHWSJ.js → chunk-COOUUC5W.js} +6 -6
  97. package/node_modules/pi-lens/dist/{chunk-XTBDCR27.js → chunk-CPZ5JJW6.js} +4 -4
  98. package/node_modules/pi-lens/dist/{chunk-RKKOYPRA.js → chunk-DS2USX5G.js} +13 -15
  99. package/node_modules/pi-lens/dist/chunk-EA2ZRG44.js +27 -0
  100. package/node_modules/pi-lens/dist/{chunk-GSLNCYGG.js → chunk-EDMLIW6W.js} +13 -14
  101. package/node_modules/pi-lens/dist/{chunk-2EECBNC5.js → chunk-EIKRZ32J.js} +75 -0
  102. package/node_modules/pi-lens/dist/chunk-EKNWOL2I.js +27 -0
  103. package/node_modules/pi-lens/dist/{chunk-R3T7CLQ2.js → chunk-ELZRSR5N.js} +41 -41
  104. package/node_modules/pi-lens/dist/{chunk-GMX5OS7B.js → chunk-EN5AM7PX.js} +11 -12
  105. package/node_modules/pi-lens/dist/{chunk-3RKP3FMS.js → chunk-EWXXLS26.js} +226 -24
  106. package/node_modules/pi-lens/dist/chunk-EX4EXBW7.js +37 -0
  107. package/node_modules/pi-lens/dist/{chunk-XHJBS436.js → chunk-EXVXBSGN.js} +25 -25
  108. package/node_modules/pi-lens/dist/{chunk-MZGQNL3Y.js → chunk-F7BO6FWH.js} +12 -13
  109. package/node_modules/pi-lens/dist/{chunk-V35JG4JB.js → chunk-FEDWAYDS.js} +152 -334
  110. package/node_modules/pi-lens/dist/{chunk-J64T55EI.js → chunk-FWZRGGGY.js} +73 -9
  111. package/node_modules/pi-lens/dist/{chunk-T57LYLZT.js → chunk-G224FADB.js} +1 -1
  112. package/node_modules/pi-lens/dist/chunk-G5UCJFT7.js +26 -0
  113. package/node_modules/pi-lens/dist/{chunk-LLJNQKQW.js → chunk-GLW3YDZZ.js} +20 -13
  114. package/node_modules/pi-lens/dist/{chunk-GXFV6MYU.js → chunk-GTDSYEA2.js} +72 -39
  115. package/node_modules/pi-lens/dist/{chunk-DUO2TU77.js → chunk-GYRZ72R4.js} +10 -4
  116. package/node_modules/pi-lens/dist/chunk-HYVXA3BB.js +49 -0
  117. package/node_modules/pi-lens/dist/{chunk-W66O5E25.js → chunk-IEBJF3PN.js} +13 -15
  118. package/node_modules/pi-lens/dist/{chunk-GAQ7OQG6.js → chunk-IL7K66ZQ.js} +83 -94
  119. package/node_modules/pi-lens/dist/{chunk-T7FEBKXN.js → chunk-JWOVP5BL.js} +7 -9
  120. package/node_modules/pi-lens/dist/{chunk-UBOQLVT2.js → chunk-K2GUZ4DN.js} +4 -4
  121. package/node_modules/pi-lens/dist/{chunk-5VSF4UUQ.js → chunk-K4SZB56V.js} +34 -39
  122. package/node_modules/pi-lens/dist/{chunk-7D6L4MTX.js → chunk-KCBRHV5E.js} +3 -3
  123. package/node_modules/pi-lens/dist/{chunk-GSM5UU7A.js → chunk-KFXCL4OV.js} +38 -28
  124. package/node_modules/pi-lens/dist/{chunk-J6MPGQTS.js → chunk-KJJAVH3X.js} +81 -15
  125. package/node_modules/pi-lens/dist/{chunk-BWD5EPKO.js → chunk-KPVLQHCZ.js} +4 -6
  126. package/node_modules/pi-lens/dist/{chunk-MPNJLASA.js → chunk-KX56K73G.js} +10 -13
  127. package/node_modules/pi-lens/dist/{chunk-AWSCPCN2.js → chunk-LMCTHJ2H.js} +19 -19
  128. package/node_modules/pi-lens/dist/{chunk-IWDLU6K3.js → chunk-MEFLGBCS.js} +4 -6
  129. package/node_modules/pi-lens/dist/{chunk-TOY6QKOH.js → chunk-MKPCELNI.js} +17 -17
  130. package/node_modules/pi-lens/dist/{chunk-POMLXPMY.js → chunk-N3PLNNCW.js} +1 -1
  131. package/node_modules/pi-lens/dist/chunk-N5FBM25N.js +22 -0
  132. package/node_modules/pi-lens/dist/{chunk-CYRKQRPM.js → chunk-NFNVDDGB.js} +2 -4
  133. package/node_modules/pi-lens/dist/{chunk-RMLC67LF.js → chunk-NLIVE7L6.js} +2 -30
  134. package/node_modules/pi-lens/dist/{chunk-24AKHFGP.js → chunk-OMJ3OFBJ.js} +6 -6
  135. package/node_modules/pi-lens/dist/{chunk-IQWN5JCP.js → chunk-OZNCKLOX.js} +13 -14
  136. package/node_modules/pi-lens/dist/chunk-P5XUGPIX.js +31 -0
  137. package/node_modules/pi-lens/dist/{chunk-2KXTHF3M.js → chunk-PJXNTPB2.js} +253 -33
  138. package/node_modules/pi-lens/dist/chunk-PKOXJIVT.js +88 -0
  139. package/node_modules/pi-lens/dist/{chunk-DGUKIYSI.js → chunk-PP2A5V2T.js} +8 -10
  140. package/node_modules/pi-lens/dist/{chunk-KAPJINKN.js → chunk-Q42LJANT.js} +2 -2
  141. package/node_modules/pi-lens/dist/{chunk-UZ2XCLYS.js → chunk-Q4BKKOVC.js} +8 -8
  142. package/node_modules/pi-lens/dist/{chunk-TIQ2PKDW.js → chunk-QT66NEYN.js} +4 -4
  143. package/node_modules/pi-lens/dist/{chunk-U44DJXQP.js → chunk-RCHO5W7M.js} +15 -18
  144. package/node_modules/pi-lens/dist/{chunk-YH5MVY2U.js → chunk-RG3MXTRI.js} +7 -7
  145. package/node_modules/pi-lens/dist/chunk-RG7OODGM.js +57 -0
  146. package/node_modules/pi-lens/dist/{chunk-OHKJ7PQF.js → chunk-RU34BA4D.js} +43 -39
  147. package/node_modules/pi-lens/dist/{chunk-JMYYOTQG.js → chunk-S26LC76R.js} +13 -1
  148. package/node_modules/pi-lens/dist/{chunk-XBJVAEEO.js → chunk-S55TEC7I.js} +3 -2
  149. package/node_modules/pi-lens/dist/{chunk-RVK72CZX.js → chunk-SJHC3BCZ.js} +1397 -481
  150. package/node_modules/pi-lens/dist/{chunk-IYNJ6YPZ.js → chunk-SNEUMLM7.js} +4 -4
  151. package/node_modules/pi-lens/dist/{chunk-S67KYG37.js → chunk-T4NGVFYI.js} +2 -2
  152. package/node_modules/pi-lens/dist/{chunk-YCWYO6TQ.js → chunk-THEXI2QO.js} +48 -45
  153. package/node_modules/pi-lens/dist/{chunk-AMERCH6V.js → chunk-TL2TCJYL.js} +15 -16
  154. package/node_modules/pi-lens/dist/{chunk-KUA4OJ5Y.js → chunk-TPYYEDP5.js} +823 -350
  155. package/node_modules/pi-lens/dist/{chunk-YNE3RP52.js → chunk-TVZRLTG6.js} +8 -1
  156. package/node_modules/pi-lens/dist/{chunk-ROYSX2S5.js → chunk-UCVMSOXF.js} +2 -2
  157. package/node_modules/pi-lens/dist/chunk-UL5SXQVX.js +32 -0
  158. package/node_modules/pi-lens/dist/{chunk-7HXE67BN.js → chunk-UO66IMVP.js} +2 -2
  159. package/node_modules/pi-lens/dist/{chunk-VOOAPROD.js → chunk-UVY4TOJH.js} +3 -3
  160. package/node_modules/pi-lens/dist/{chunk-RKBXZN3A.js → chunk-VIDEKABZ.js} +2 -2
  161. package/node_modules/pi-lens/dist/{chunk-2FN63LPV.js → chunk-VITFDI3O.js} +13 -14
  162. package/node_modules/pi-lens/dist/{chunk-6DLWKFEX.js → chunk-VUAVE3QC.js} +41 -42
  163. package/node_modules/pi-lens/dist/{chunk-FM4RDMKT.js → chunk-WUY4BZEP.js} +10 -12
  164. package/node_modules/pi-lens/dist/{chunk-SD4I7ZO4.js → chunk-X3UTCXAA.js} +43 -53
  165. package/node_modules/pi-lens/dist/chunk-XHDBJODR.js +45 -0
  166. package/node_modules/pi-lens/dist/{chunk-5IUSNGOC.js → chunk-XHLK33VM.js} +28 -21
  167. package/node_modules/pi-lens/dist/{chunk-3KAZU3VR.js → chunk-XI34NWDI.js} +2 -2
  168. package/node_modules/pi-lens/dist/{chunk-QBFBRV2B.js → chunk-XWFIHYCH.js} +4 -2
  169. package/node_modules/pi-lens/dist/{chunk-JUKMK5Y4.js → chunk-Y2TPADJR.js} +10 -11
  170. package/node_modules/pi-lens/dist/{chunk-EBC36LNN.js → chunk-Y5KTA2OB.js} +17 -17
  171. package/node_modules/pi-lens/dist/{chunk-HYGZEMX6.js → chunk-YKVDBNPO.js} +11 -5
  172. package/node_modules/pi-lens/dist/{chunk-KN35K52N.js → chunk-YSDPVDFC.js} +3 -3
  173. package/node_modules/pi-lens/dist/chunk-YWNO5Q4R.js +44 -0
  174. package/node_modules/pi-lens/dist/{chunk-US7ECLD7.js → chunk-YWWG4AQA.js} +119 -28
  175. package/node_modules/pi-lens/dist/{chunk-O4NWQT6I.js → chunk-YXDCRUKQ.js} +4 -4
  176. package/node_modules/pi-lens/dist/{chunk-XYURS6EN.js → chunk-YXGRRORB.js} +15 -17
  177. package/node_modules/pi-lens/dist/{chunk-IUE7SSKV.js → chunk-ZAPSUBLU.js} +13 -7
  178. package/node_modules/pi-lens/dist/{chunk-EUXZEFTV.js → chunk-ZPJM7DID.js} +3 -3
  179. package/node_modules/pi-lens/dist/{chunk-5HSRT26B.js → chunk-ZSUX7KEM.js} +16 -15
  180. package/node_modules/pi-lens/dist/index.js +37155 -32210
  181. package/node_modules/pi-lens/dist/mcp/analyze-cli.js +11 -12
  182. package/node_modules/pi-lens/dist/mcp/cli.js +46 -45
  183. package/node_modules/pi-lens/dist/mcp/server.js +1210 -574
  184. package/node_modules/pi-lens/dist/mcp/worker.js +65 -65
  185. package/node_modules/pi-lens/dist/probes/installer.js +21 -23
  186. package/node_modules/pi-lens/docs/adr/0010-trace-validation-session-lifecycle.md +390 -0
  187. package/node_modules/pi-lens/docs/adr/README.md +1 -0
  188. package/node_modules/pi-lens/docs/ast-grep_rules_catalog.md +5 -3
  189. package/node_modules/pi-lens/docs/configuration.md +9 -0
  190. package/node_modules/pi-lens/docs/engineering-principles.md +12 -0
  191. package/node_modules/pi-lens/docs/environment-variables.md +20 -0
  192. package/node_modules/pi-lens/docs/features.md +16 -1
  193. package/node_modules/pi-lens/docs/globalconfig.md +37 -8
  194. package/node_modules/pi-lens/docs/lsp-capability-matrix.md +105 -12
  195. package/node_modules/pi-lens/docs/lsp-idle-eviction.md +37 -18
  196. package/node_modules/pi-lens/docs/pi-lens-fixer.md +22 -1
  197. package/node_modules/pi-lens/docs/pi-lens-investigator.md +14 -0
  198. package/node_modules/pi-lens/docs/pi-lens-merge-policy.md +23 -10
  199. package/node_modules/pi-lens/docs/pi-lens-monitor.md +64 -8
  200. package/node_modules/pi-lens/docs/pi-lens-retro.md +2 -2
  201. package/node_modules/pi-lens/docs/pi-lens-reviewer.md +48 -1
  202. package/node_modules/pi-lens/docs/pi-lens-subagent.md +8 -1
  203. package/node_modules/pi-lens/docs/release-qa-baseline.md +19 -7
  204. package/node_modules/pi-lens/docs/servercapabilities.md +47 -47
  205. package/node_modules/pi-lens/docs/settings.md +9 -5
  206. package/node_modules/pi-lens/docs/subagent-compat.md +1 -1
  207. package/node_modules/pi-lens/docs/usage.md +1 -0
  208. package/node_modules/pi-lens/package.json +6 -4
  209. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-return-value-in-generator-test.yml +17 -0
  210. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-js-test.yml +86 -0
  211. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/no-sql-in-code-execute-test.yml +86 -0
  212. package/node_modules/pi-lens/rules/ast-grep-rules/rule-tests/unchecked-numeric-parse-python-test.yml +15 -0
  213. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-return-value-in-generator.yml +9 -4
  214. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute-js.yml +119 -0
  215. package/node_modules/pi-lens/rules/ast-grep-rules/rules/no-sql-in-code-execute.yml +119 -0
  216. package/node_modules/pi-lens/rules/ast-grep-rules/rules/unchecked-numeric-parse-python.yml +13 -2
  217. package/node_modules/pi-lens/rules/rule-catalog.json +25 -1
  218. package/node_modules/pi-lens/scripts/analyze-pi-lens-logs.mjs +15 -5
  219. package/node_modules/pi-lens/scripts/lib/is-main-module.mjs +27 -0
  220. package/node_modules/pi-lens/scripts/lib/scratch-home-env.mjs +21 -0
  221. package/node_modules/pi-lens/scripts/rpc-load-check.mjs +4 -6
  222. package/node_modules/pi-lens/scripts/warm-loader-cache.mjs +2 -5
  223. package/node_modules/pi-next-cue/package.json +4 -1
  224. package/node_modules/pi-provider-qoder/dist/index.js +438 -283
  225. package/node_modules/pi-provider-qoder/package.json +1 -1
  226. package/node_modules/pi-typesafe/README.md +6 -6
  227. package/node_modules/pi-typesafe/dist/ask.js +9 -2
  228. package/node_modules/pi-typesafe/dist/auth.d.ts +3 -2
  229. package/node_modules/pi-typesafe/dist/auth.js +2 -2
  230. package/node_modules/pi-typesafe/dist/backends.d.ts +20 -5
  231. package/node_modules/pi-typesafe/dist/backends.js +32 -8
  232. package/node_modules/pi-typesafe/dist/batch.d.ts +1 -1
  233. package/node_modules/pi-typesafe/dist/batch.js +2 -2
  234. package/node_modules/pi-typesafe/dist/client.d.ts +1 -1
  235. package/node_modules/pi-typesafe/dist/client.js +24 -12
  236. package/node_modules/pi-typesafe/dist/credentials.d.ts +8 -6
  237. package/node_modules/pi-typesafe/dist/credentials.js +70 -16
  238. package/node_modules/pi-typesafe/dist/extension.js +118 -26
  239. package/node_modules/pi-typesafe/dist/index.d.ts +1 -1
  240. package/node_modules/pi-typesafe/dist/index.js +1 -1
  241. package/node_modules/pi-typesafe/dist/key-prompt.d.ts +1 -1
  242. package/node_modules/pi-typesafe/dist/key-prompt.js +6 -6
  243. package/node_modules/pi-typesafe/dist/login.d.ts +11 -10
  244. package/node_modules/pi-typesafe/dist/login.js +24 -21
  245. package/node_modules/pi-typesafe/dist/schema.d.ts +8 -8
  246. package/node_modules/pi-typesafe/dist/schema.js +29 -7
  247. package/node_modules/pi-typesafe/package.json +2 -2
  248. package/package.json +12 -12
  249. package/node_modules/pi-lens/dist/chunk-3PTHXJXR.js +0 -28
  250. package/node_modules/pi-lens/dist/chunk-3QED2P4V.js +0 -31
  251. package/node_modules/pi-lens/dist/chunk-5WRPDP2A.js +0 -47
  252. package/node_modules/pi-lens/dist/chunk-ABBOA7UD.js +0 -157
  253. package/node_modules/pi-lens/dist/chunk-CUHSHSB6.js +0 -273
  254. package/node_modules/pi-lens/dist/chunk-GL5LUMZE.js +0 -51
  255. package/node_modules/pi-lens/dist/chunk-HAD7QRQI.js +0 -30
  256. package/node_modules/pi-lens/dist/chunk-JORED7EX.js +0 -44
  257. package/node_modules/pi-lens/dist/chunk-KYUB6QDC.js +0 -72
  258. package/node_modules/pi-lens/dist/chunk-LZSEQW6A.js +0 -57
  259. package/node_modules/pi-lens/dist/chunk-M2IFVFWU.js +0 -79
  260. package/node_modules/pi-lens/dist/chunk-M2UD3LPU.js +0 -88
  261. package/node_modules/pi-lens/dist/chunk-MBKQHGA7.js +0 -39
  262. package/node_modules/pi-lens/dist/chunk-R7YOCSNV.js +0 -23
  263. package/node_modules/pi-lens/dist/chunk-SKAMFC7A.js +0 -28
  264. package/node_modules/pi-lens/dist/chunk-SYE6T2EB.js +0 -28
  265. package/node_modules/pi-lens/dist/chunk-TRETHTQO.js +0 -26
  266. package/node_modules/pi-lens/dist/chunk-UA7ZXYDR.js +0 -184
  267. package/node_modules/pi-lens/dist/chunk-XTFDJI3T.js +0 -24
  268. package/node_modules/pi-lens/dist/chunk-Z3CCVDUB.js +0 -76
  269. package/node_modules/pi-next-cue/.github/workflows/publish.yml +0 -20
@@ -1,23 +1,23 @@
1
1
  import { createRequire as __pilensCreateRequire } from "node:module"; const require = __pilensCreateRequire(import.meta.url);
2
2
  import {
3
3
  resolveToolCwd
4
- } from "./chunk-DEL2U6CM.js";
4
+ } from "./chunk-4FHUGDKU.js";
5
5
  import {
6
6
  allAvailableGlobalBinDirs,
7
7
  installArgs,
8
8
  pmBinary,
9
9
  resolveNodePackageManager
10
- } from "./chunk-5VSF4UUQ.js";
10
+ } from "./chunk-K4SZB56V.js";
11
11
  import {
12
12
  probeToolAsync
13
- } from "./chunk-3KAZU3VR.js";
13
+ } from "./chunk-XI34NWDI.js";
14
14
  import {
15
15
  TRANSIENT_MAX_COOLDOWN_MS,
16
16
  classifyProbeFailure,
17
17
  createAvailabilityLatch,
18
18
  logAvailabilityDecision,
19
19
  startHostStallSampler
20
- } from "./chunk-P63GXC37.js";
20
+ } from "./chunk-5LRUKYFA.js";
21
21
  import {
22
22
  acquireBoundedPidFileLock,
23
23
  acquireQuarantinePidFileLock,
@@ -25,52 +25,50 @@ import {
25
25
  getGlobalPiLensDir,
26
26
  heartbeatIntervalMs,
27
27
  isLockContention,
28
+ isUntrustedProjectPath,
28
29
  ownsTopGeneration,
29
30
  recordGenerationTakeover,
30
31
  recordLegacyLockHeld,
32
+ recordProjectCommandRefusal,
31
33
  releaseGeneration,
32
34
  resetSafeSpawnWindowsCommandCache,
33
35
  safeSpawnAsync,
34
36
  startGenerationHeartbeat,
35
37
  tryAcquireGeneration
36
- } from "./chunk-KUA4OJ5Y.js";
38
+ } from "./chunk-TPYYEDP5.js";
37
39
  import {
38
40
  assertInstallAllowed,
39
- projectTrustDenialReason
40
- } from "./chunk-M2IFVFWU.js";
41
- import {
42
- DEFAULT_MAX_OUTPUT_BYTES,
43
- createBoundedOutputSink,
41
+ getProjectTrustGeneration,
42
+ projectTrustDenialReason,
44
43
  writeFileAtomic,
45
44
  writeFileAtomicAsync
46
- } from "./chunk-2EECBNC5.js";
45
+ } from "./chunk-EIKRZ32J.js";
47
46
  import {
48
47
  getDegradationLedgerGeneration,
49
48
  incrementDegradationCount,
50
49
  recordDegradationOnce
51
- } from "./chunk-J64T55EI.js";
50
+ } from "./chunk-FWZRGGGY.js";
52
51
  import {
53
52
  logExtension
54
- } from "./chunk-POMLXPMY.js";
53
+ } from "./chunk-N3PLNNCW.js";
55
54
  import {
56
55
  createNdjsonLogger,
57
56
  getGlobalPiLensLogDir,
58
57
  getMaxLogSizeMB,
59
58
  isTestMode
60
- } from "./chunk-YNE3RP52.js";
61
- import {
62
- BoundedLruCache
63
- } from "./chunk-ABBOA7UD.js";
59
+ } from "./chunk-TVZRLTG6.js";
64
60
  import {
61
+ BoundedLruCache,
65
62
  findLocalToolConfig,
66
- isFullyQualified
67
- } from "./chunk-3RKP3FMS.js";
63
+ isFullyQualified,
64
+ isUnderDir,
65
+ realpathOrResolve
66
+ } from "./chunk-EWXXLS26.js";
68
67
  import {
69
68
  __require
70
69
  } from "./chunk-NXL4FFQQ.js";
71
70
 
72
71
  // dist/clients/installer/index.js
73
- import { spawn } from "node:child_process";
74
72
  import { existsSync, readFileSync as readFileSync2, statSync, unlinkSync, writeFileSync } from "node:fs";
75
73
  import fs2 from "node:fs/promises";
76
74
  import { createHash, randomUUID } from "node:crypto";
@@ -331,6 +329,8 @@ async function resolveGitHubToken(envKeys = ["GITHUB_TOKEN", "GH_TOKEN"], option
331
329
  // dist/clients/installer/index.js
332
330
  var _installerRequire = createRequire(import.meta.url);
333
331
  var TOOLS_DIR = path3.join(getGlobalPiLensDir(), "tools");
332
+ var USER_BASE_PROBE_TIMEOUT_MS = 5e3;
333
+ var ARCHIVE_COMMAND_TIMEOUT_MS = 12e4;
334
334
  var INSTALL_LOCK_PATH = path3.join(TOOLS_DIR, ".install.lock");
335
335
  var INSTALL_LOCK_GENERATIONS = `${INSTALL_LOCK_PATH}s`;
336
336
  var activeInstallLocks = /* @__PURE__ */ new Set();
@@ -465,7 +465,24 @@ async function acquireInstallLock() {
465
465
  reason: `timed out after ${timeoutMs}ms waiting for shared tools install lock (${installLockOwner()})`
466
466
  };
467
467
  }
468
- var GITHUB_BIN_DIR = path3.join(getGlobalPiLensDir(), "bin");
468
+ var GLOBAL_HOME_DIR = getGlobalPiLensDir();
469
+ var GITHUB_BIN_DIR = path3.join(GLOBAL_HOME_DIR, "bin");
470
+ var GITHUB_BIN_DIR_PINNED = Boolean(process.env.PI_LENS_HOME?.trim());
471
+ function assertManagedBinDirInsidePinnedHome(toolId) {
472
+ if (!GITHUB_BIN_DIR_PINNED)
473
+ return;
474
+ const home = realpathOrResolve(GLOBAL_HOME_DIR);
475
+ const bin = realpathOrResolve(GITHUB_BIN_DIR);
476
+ if (isUnderDir(bin, home))
477
+ return;
478
+ const reason = `bin directory escapes the pinned PI_LENS_HOME: ${GITHUB_BIN_DIR} resolves to ${bin}, outside ${home}; refusing to write through the link`;
479
+ recordDegradationOnce({
480
+ kind: "managed-tool-install",
481
+ subject: `${toolId}:bin-dir-escape`,
482
+ reason
483
+ });
484
+ throw new Error(reason);
485
+ }
469
486
  var DEBUG = process.env.PI_LENS_DEBUG === "1" || process.argv.includes("--debug");
470
487
  function installerPlatform() {
471
488
  const override = process.env.PI_LENS_TEST_PLATFORM;
@@ -2091,12 +2108,16 @@ async function isCommandAvailable(command, _args) {
2091
2108
  if (!dir)
2092
2109
  continue;
2093
2110
  for (const name of names) {
2094
- const candidate = path3.join(dir, name);
2111
+ const candidate = isWindows ? path3.join(dir, name) : `${dir}${path3.sep}${name}`;
2095
2112
  try {
2096
2113
  const stat = statSync(candidate);
2097
- if (stat.isFile() && stat.size > 0) {
2098
- return true;
2114
+ if (!stat.isFile() || stat.size === 0)
2115
+ continue;
2116
+ if (isUntrustedProjectPath(candidate)) {
2117
+ recordProjectCommandRefusal(candidate);
2118
+ continue;
2099
2119
  }
2120
+ return true;
2100
2121
  } catch {
2101
2122
  }
2102
2123
  }
@@ -2104,7 +2125,8 @@ async function isCommandAvailable(command, _args) {
2104
2125
  return false;
2105
2126
  }
2106
2127
  async function isSpawnableCommand(command) {
2107
- if (/[\\/]/.test(command)) {
2128
+ const namesPath = installerPlatform() === "win32" ? /[\\/]/.test(command) : command.includes("/");
2129
+ if (namesPath) {
2108
2130
  try {
2109
2131
  const stat = statSync(command);
2110
2132
  return stat.isFile() && stat.size > 0;
@@ -2112,7 +2134,7 @@ async function isSpawnableCommand(command) {
2112
2134
  return false;
2113
2135
  }
2114
2136
  }
2115
- const memoKey = `${command}:${hashSync(process.env.PATH || "")}`;
2137
+ const memoKey = `${getProjectTrustGeneration()}:${command}:${hashSync(process.env.PATH || "")}`;
2116
2138
  if (pathWalkMemo.has(memoKey))
2117
2139
  return pathWalkMemo.get(memoKey) ?? false;
2118
2140
  const isSpawnable = await isCommandAvailable(command);
@@ -2557,6 +2579,10 @@ async function findNpmGlobalToolPath(binaryName, onTransient, verificationArgs =
2557
2579
  for (const candidate of candidates) {
2558
2580
  try {
2559
2581
  await fs2.access(candidate);
2582
+ if (isUntrustedProjectPath(candidate)) {
2583
+ recordProjectCommandRefusal(candidate);
2584
+ continue;
2585
+ }
2560
2586
  if (await verifyToolBinary(candidate, void 0, onTransient, verificationTimeoutMs, verificationArgs)) {
2561
2587
  return candidate;
2562
2588
  }
@@ -2621,6 +2647,10 @@ async function findPipUserToolPath(binaryName, onTransient, verificationArgs = [
2621
2647
  for (const candidate of candidates) {
2622
2648
  try {
2623
2649
  await fs2.access(candidate);
2650
+ if (isUntrustedProjectPath(candidate)) {
2651
+ recordProjectCommandRefusal(candidate);
2652
+ continue;
2653
+ }
2624
2654
  if (await verifyToolBinary(candidate, void 0, onTransient, verificationTimeoutMs, verificationArgs)) {
2625
2655
  return candidate;
2626
2656
  }
@@ -2631,22 +2661,18 @@ async function findPipUserToolPath(binaryName, onTransient, verificationArgs = [
2631
2661
  }
2632
2662
  return void 0;
2633
2663
  }
2634
- function userBaseProbeResult(command, code, stdout) {
2635
- if (stdout.truncated) {
2636
- recordDegradationOnce({
2637
- kind: "spawn-output-cap-truncated",
2638
- subject: `user-base-probe:${command}`,
2639
- reason: `\`${command} -m site --user-base\` reached the ${DEFAULT_MAX_OUTPUT_BYTES}-byte default cap after ${stdout.observedBytes} bytes; the probed user base is unusable`,
2640
- metadata: {
2641
- capBytes: DEFAULT_MAX_OUTPUT_BYTES,
2642
- capSource: "default",
2643
- observedBytes: stdout.observedBytes,
2644
- killed: false
2645
- }
2646
- });
2664
+ function userBaseProbeResult(result) {
2665
+ if (result.outputTruncated || result.error || result.status !== 0)
2647
2666
  return "";
2648
- }
2649
- return code === 0 ? stdout.text.trim() : "";
2667
+ return result.stdout.trim();
2668
+ }
2669
+ async function probeUserBase(command) {
2670
+ return userBaseProbeResult(await safeSpawnAsync(command, ["-m", "site", "--user-base"], {
2671
+ timeout: USER_BASE_PROBE_TIMEOUT_MS,
2672
+ cwd: os.homedir(),
2673
+ ignoreAmbientSignal: true,
2674
+ lifetimeCoupled: true
2675
+ }));
2650
2676
  }
2651
2677
  async function getPythonUserBaseCandidates() {
2652
2678
  const candidates = [];
@@ -2673,24 +2699,7 @@ async function getPythonUserBaseCandidates() {
2673
2699
  { command: "python", args: ["-m", "site", "--user-base"] }
2674
2700
  ];
2675
2701
  for (const probe of probes) {
2676
- const userBase = await new Promise((resolve) => {
2677
- const isWin = process.platform === "win32";
2678
- const spawnCmd = isWin ? [probe.command, ...probe.args].join(" ") : probe.command;
2679
- let proc;
2680
- try {
2681
- proc = spawn(spawnCmd, isWin ? [] : probe.args, {
2682
- stdio: ["ignore", "pipe", "pipe"],
2683
- shell: isWin
2684
- });
2685
- } catch {
2686
- resolve("");
2687
- return;
2688
- }
2689
- const stdout = createBoundedOutputSink();
2690
- proc.stdout?.on("data", (data) => stdout.append(data));
2691
- proc.on("exit", (code) => resolve(userBaseProbeResult(probe.command, code, stdout)));
2692
- proc.on("error", () => resolve(""));
2693
- });
2702
+ const userBase = await probeUserBase(probe.command);
2694
2703
  add(userBase);
2695
2704
  }
2696
2705
  return candidates;
@@ -2770,22 +2779,14 @@ async function httpsGet(url, maxRedirects = 5, headers = {}) {
2770
2779
  }
2771
2780
  return response.body;
2772
2781
  }
2773
- function runCommand(command, args, cwd) {
2774
- return new Promise((resolve) => {
2775
- let proc;
2776
- try {
2777
- proc = spawn(command, args, {
2778
- cwd,
2779
- stdio: "ignore",
2780
- shell: process.platform === "win32"
2781
- });
2782
- } catch {
2783
- resolve(false);
2784
- return;
2785
- }
2786
- proc.on("exit", (code) => resolve(code === 0));
2787
- proc.on("error", () => resolve(false));
2782
+ async function runCommand(command, args, cwd) {
2783
+ const result = await safeSpawnAsync(command, args, {
2784
+ cwd,
2785
+ timeout: ARCHIVE_COMMAND_TIMEOUT_MS,
2786
+ ignoreAmbientSignal: true,
2787
+ lifetimeCoupled: true
2788
2788
  });
2789
+ return !result.error && result.status === 0;
2789
2790
  }
2790
2791
  async function installGitHubTool(tool, prefetchedRelease) {
2791
2792
  const spec = tool.github;
@@ -2855,6 +2856,7 @@ async function installGitHubTool(tool, prefetchedRelease) {
2855
2856
  return void 0;
2856
2857
  }
2857
2858
  try {
2859
+ assertManagedBinDirInsidePinnedHome(tool.id);
2858
2860
  if (launcherRuntime) {
2859
2861
  const assetPath = path3.join(GITHUB_BIN_DIR, `${tool.id}${assetName.endsWith(".phar") ? ".phar" : ".jar"}`);
2860
2862
  await writeFileAtomicAsync(assetPath, assetBuffer, {
@@ -3422,6 +3424,7 @@ async function installMavenTool(tool) {
3422
3424
  }
3423
3425
  try {
3424
3426
  await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3427
+ assertManagedBinDirInsidePinnedHome(tool.id);
3425
3428
  const jarPath = path3.join(GITHUB_BIN_DIR, `${tool.id}.jar`);
3426
3429
  await writeFileAtomicAsync(jarPath, jarBuffer, { bestEffort: false });
3427
3430
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
@@ -3645,10 +3648,11 @@ async function installArchiveTool(tool) {
3645
3648
  });
3646
3649
  return void 0;
3647
3650
  }
3651
+ await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3652
+ assertManagedBinDirInsidePinnedHome(tool.id);
3648
3653
  await swapExtractedDir(tool.id, tmpExtractDir, extractDir);
3649
3654
  const innerLauncher = path3.join(extractDir, ...launcherParts);
3650
3655
  const resolvedInner = isWindows ? `${innerLauncher}.bat` : innerLauncher;
3651
- await fs2.mkdir(GITHUB_BIN_DIR, { recursive: true });
3652
3656
  const launcherName = isWindows ? `${binaryName}.bat` : binaryName;
3653
3657
  const shimPath = path3.join(GITHUB_BIN_DIR, launcherName);
3654
3658
  if (isWindows) {
@@ -3979,22 +3983,7 @@ async function installPipTool(toolId, packageName, binaryName, options = {}) {
3979
3983
  const result = await run(candidate.command, args);
3980
3984
  const error = (result.error?.message ?? result.stderr).trim();
3981
3985
  if (result.status === 0) {
3982
- const base = await new Promise((resolve) => {
3983
- let probe;
3984
- try {
3985
- probe = spawn(candidate.command, ["-m", "site", "--user-base"], {
3986
- stdio: ["ignore", "pipe", "pipe"],
3987
- shell: isWindows
3988
- });
3989
- } catch {
3990
- resolve("");
3991
- return;
3992
- }
3993
- const stdout = createBoundedOutputSink();
3994
- probe.stdout?.on("data", (data) => stdout.append(data));
3995
- probe.on("exit", (code) => resolve(userBaseProbeResult(candidate.command, code, stdout)));
3996
- probe.on("error", () => resolve(""));
3997
- });
3986
+ const base = await probeUserBase(candidate.command);
3998
3987
  const binaryPath = base ? await addBinToPath(pipScriptsDir(base, installerPlatform())) : void 0;
3999
3988
  return succeeded("user", binaryPath ?? packageName);
4000
3989
  }
@@ -4060,7 +4049,7 @@ async function stampInstallResolution(toolId) {
4060
4049
  return;
4061
4050
  try {
4062
4051
  const resolutionId = lastInstallResolutionId.get(toolId);
4063
- const refresh = await import("./chunk-2KXTHF3M.js");
4052
+ const refresh = await import("./chunk-PJXNTPB2.js");
4064
4053
  await refresh.stampManagedToolInstall(toolId, resolutionId);
4065
4054
  } catch {
4066
4055
  }
@@ -4073,7 +4062,7 @@ async function finishInstallAttempt(toolId, ok, startedAt) {
4073
4062
  if (ok) {
4074
4063
  resetSafeSpawnWindowsCommandCache();
4075
4064
  try {
4076
- const { resetMadgeManagedPathMemo } = await import("./chunk-LZSEQW6A.js");
4065
+ const { resetMadgeManagedPathMemo } = await import("./chunk-RG7OODGM.js");
4077
4066
  resetMadgeManagedPathMemo();
4078
4067
  } catch (err) {
4079
4068
  logSessionStart(`auto-install ${toolId}: madge memo reset failed: ${err.message}`);
@@ -4103,7 +4092,7 @@ async function installTool(toolId, ownsLock) {
4103
4092
  return false;
4104
4093
  const npmPath = await installNpmTool(tool.id, tool.packageName, tool.binaryName, tool.checkArgs, getToolVerificationTimeout(tool), packageEntryVerification(tool), ownsLock);
4105
4094
  if (npmPath !== void 0) {
4106
- await import("./chunk-2KXTHF3M.js").then((m) => m.stampManagedToolInstalled(tool.id, tool.packageName)).catch(() => {
4095
+ await import("./chunk-PJXNTPB2.js").then((m) => m.stampManagedToolInstalled(tool.id, tool.packageName)).catch(() => {
4107
4096
  });
4108
4097
  }
4109
4098
  return finishInstallAttempt(tool.id, npmPath !== void 0, startedAt);
@@ -3,7 +3,7 @@ import {
3
3
  deserializeWordIndex,
4
4
  recordPersistedWordIndexWireBytes,
5
5
  serializeWordIndex
6
- } from "./chunk-W66O5E25.js";
6
+ } from "./chunk-IEBJF3PN.js";
7
7
  import {
8
8
  fingerprintProjectSnapshotJson
9
9
  } from "./chunk-2BEMIWEW.js";
@@ -15,22 +15,20 @@ import {
15
15
  getProjectDataDir,
16
16
  isStaleStageFile,
17
17
  withGenerationLockSync
18
- } from "./chunk-KUA4OJ5Y.js";
18
+ } from "./chunk-TPYYEDP5.js";
19
19
  import {
20
20
  writeFileAtomic
21
- } from "./chunk-2EECBNC5.js";
21
+ } from "./chunk-EIKRZ32J.js";
22
22
  import {
23
23
  incrementDegradationCount
24
- } from "./chunk-J64T55EI.js";
24
+ } from "./chunk-FWZRGGGY.js";
25
25
  import {
26
26
  logLatency
27
- } from "./chunk-QBFBRV2B.js";
28
- import {
29
- BoundedFifoMap
30
- } from "./chunk-ABBOA7UD.js";
27
+ } from "./chunk-XWFIHYCH.js";
31
28
  import {
29
+ BoundedFifoMap,
32
30
  normalizeMapKey
33
- } from "./chunk-3RKP3FMS.js";
31
+ } from "./chunk-EWXXLS26.js";
34
32
 
35
33
  // dist/clients/project-snapshot.js
36
34
  import * as fs3 from "node:fs";
@@ -2,16 +2,16 @@ import { createRequire as __pilensCreateRequire } from "node:module"; const requ
2
2
  import {
3
3
  classifyProbeFailure,
4
4
  installRetryDelayMs
5
- } from "./chunk-P63GXC37.js";
5
+ } from "./chunk-5LRUKYFA.js";
6
6
  import {
7
7
  safeSpawnAsync
8
- } from "./chunk-KUA4OJ5Y.js";
8
+ } from "./chunk-TPYYEDP5.js";
9
9
  import {
10
10
  assertInstallAllowed
11
- } from "./chunk-M2IFVFWU.js";
11
+ } from "./chunk-EIKRZ32J.js";
12
12
  import {
13
13
  logExtension
14
- } from "./chunk-POMLXPMY.js";
14
+ } from "./chunk-N3PLNNCW.js";
15
15
 
16
16
  // dist/clients/dispatch/runners/utils/lazy-installer.js
17
17
  var LAZY_INSTALL_SPECS = {
@@ -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-3KAZU3VR.js";
5
+ } from "./chunk-XI34NWDI.js";
6
6
  import {
7
7
  classifyProbeFailure,
8
8
  createAvailabilityLatch,
9
9
  isTransientDecision,
10
10
  logAvailabilityDecision,
11
11
  startHostStallSampler
12
- } from "./chunk-P63GXC37.js";
12
+ } from "./chunk-5LRUKYFA.js";
13
13
  import {
14
+ NODE_MODULES_BIN_DIRS,
14
15
  createGenerationSource,
16
+ isUntrustedProjectPath,
17
+ projectLocalBinDirs,
18
+ recordProjectCommandRefusal,
15
19
  safeSpawnAsync
16
- } from "./chunk-KUA4OJ5Y.js";
20
+ } from "./chunk-TPYYEDP5.js";
17
21
  import {
18
22
  getProjectTrustState
19
- } from "./chunk-M2IFVFWU.js";
23
+ } from "./chunk-EIKRZ32J.js";
20
24
  import {
21
25
  recordDegradationOnce
22
- } from "./chunk-J64T55EI.js";
26
+ } from "./chunk-FWZRGGGY.js";
23
27
  import {
24
28
  logExtension
25
- } from "./chunk-POMLXPMY.js";
29
+ } from "./chunk-N3PLNNCW.js";
26
30
  import {
27
31
  isAtOrAboveHomeDir,
28
32
  isUnderDir,
29
33
  walkUpDirs
30
- } from "./chunk-3RKP3FMS.js";
34
+ } from "./chunk-EWXXLS26.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 cached = globalBinDirCache.get(pm);
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(pm, () => probeGlobalBinDirs(pm, generation));
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(pm, () => {
211
- globalBinDirCache.set(pm, dirs2);
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, { timeout: 5e3 });
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(pm, () => {
224
- globalBinDirCache.set(pm, dirs);
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
- return full;
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 ancestor of walkUpDirs(cwd)) {
296
- if (isAtOrAboveHomeDir(ancestor, os.homedir()))
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,
@@ -4,14 +4,14 @@ import {
4
4
  } from "./chunk-3MED75HT.js";
5
5
  import {
6
6
  getProjectDataDir
7
- } from "./chunk-KUA4OJ5Y.js";
7
+ } from "./chunk-TPYYEDP5.js";
8
8
  import {
9
9
  writeFileAtomic
10
- } from "./chunk-2EECBNC5.js";
10
+ } from "./chunk-EIKRZ32J.js";
11
11
  import {
12
12
  normalizeMapKey,
13
13
  toProjectRelativePath
14
- } from "./chunk-3RKP3FMS.js";
14
+ } from "./chunk-EWXXLS26.js";
15
15
 
16
16
  // dist/clients/call-graph.js
17
17
  import * as fs from "node:fs";