@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
package/README.md CHANGED
@@ -21,10 +21,10 @@ When migrating from `pi-mcp-adapter`, remove any standalone adapter install as w
21
21
  The package bundles 5 active `@herbertgao/*` child packages—`pi-agency`, `pi-bark`, `pi-cc-extensions`, `pi-subagents`, and `sol-pi`—plus the following upstream packages under their original names:
22
22
 
23
23
  - `pi-antigravity@0.11.0`
24
- - `pi-provider-qoder@0.6.2`
24
+ - `pi-provider-qoder@0.6.5`
25
25
  - `@dietrichgebert/ponytail@5.3.2`
26
- - `@juicesharp/rpiv-ask-user-question@2.13.9`
27
- - `@narumitw/pi-btw@0.62.0`
26
+ - `@juicesharp/rpiv-ask-user-question@2.15.0`
27
+ - `@narumitw/pi-btw@0.63.0`
28
28
  - `@narumitw/pi-caffeinate@0.49.12`
29
29
  - `@pi-plugins/fast-mode@0.1.14`
30
30
  - `@tifan/pi-copy-response@0.2.7`
@@ -34,16 +34,16 @@ The package bundles 5 active `@herbertgao/*` child packages—`pi-agency`, `pi-b
34
34
  - `@tifan/pi-preferred-thinking@1.0.2`
35
35
  - `@tifan/pi-recap@0.4.8`
36
36
  - `@tifan/pi-rename@0.6.0`
37
- - `pi-typesafe@0.10.0`
38
- - `pi-next-cue@1.0.7`
39
- - `pi-lens@4.4.4`
37
+ - `pi-typesafe@0.13.0`
38
+ - `pi-next-cue@1.0.8`
39
+ - `pi-lens@4.4.5`
40
40
  - `pi-web-access@0.44.0`
41
41
 
42
42
  Pi loads their extensions and skills through `node_modules/` paths inside one package root. The upstream companions are pinned and bundled, not forked or renamed.
43
43
 
44
- The locally customized CC package follows upstream `pi-cc-extensions@1.0.8`; SoL-Pi follows its complete main baseline `e1a586af` with Pi 1.x/codemode compatibility updates through `21956803`. Local behavior not already covered upstream is retained. SoL-Pi's `update_plan` now follows upstream's model-only contract: invoke it directly, not inside codemode scripts. Action Fusion and ccstyle write rich diffs coexist without disabling either feature. All four SoL-Pi features remain opt-in; its new non-persistent-session evidence archives remain on disk for consumers and require host or caller cleanup.
44
+ The locally customized CC package follows upstream `pi-cc-extensions@1.0.11`; SoL-Pi follows its complete main baseline `e1a586af` with Pi 1.x/codemode compatibility updates through `21956803`. Local behavior not already covered upstream is retained. SoL-Pi's `update_plan` now follows upstream's model-only contract: invoke it directly, not inside codemode scripts. Action Fusion and ccstyle write rich diffs coexist without disabling either feature. All four SoL-Pi features remain opt-in; its new non-persistent-session evidence archives remain on disk for consumers and require host or caller cleanup.
45
45
 
46
- Antigravity `0.11.0` enriches search citations by visiting source sites by default (`ANTIGRAVITY_NO_SOURCE_ENRICH=1` disables enrichment). It refreshes a curated model catalog and upgrades the existing model cache; previously listed model IDs may disappear. Ask `2.13.9` lets other extensions in the same process answer or cancel TUI questionnaires through its event channel, without sender authentication. Web Access `0.44.0` keeps direct tool exposure and `toolActivation: auto` by default. Linkup, DeepSeek search and fetch, provider gateways, `toolActivation: "none"`, deferred exposure, and GCE ADC support require explicit configuration.
46
+ Antigravity `0.11.0` enriches search citations by visiting source sites by default (`ANTIGRAVITY_NO_SOURCE_ENRICH=1` disables enrichment). It refreshes a curated model catalog and upgrades the existing model cache; previously listed model IDs may disappear. Ask `2.15.0` lets other extensions in the same process answer or cancel TUI questionnaires through its event channel, without sender authentication. Its notes shortcut defaults to `n` and can be a single non-Latin character; reserved navigation keys stay on `n`. Web Access `0.44.0` keeps direct tool exposure and `toolActivation: auto` by default. Linkup, DeepSeek search and fetch, provider gateways, `toolActivation: "none"`, deferred exposure, and GCE ADC support require explicit configuration.
47
47
 
48
48
  Ponytail `5.3.2` updates the Pi skill guidance, including how to turn it off. Its Pi extension entry is unchanged; the new Claude Code band/board hooks are not registered by this aggregate.
49
49
 
@@ -57,15 +57,15 @@ Ponytail `5.3.2` updates the Pi skill guidance, including how to turn it off. It
57
57
 
58
58
  `@narumitw/pi-caffeinate@0.49.12` uses the host platform's sleep inhibitor during each Pi agent run. On macOS, `/caffeinate sleep` keeps the system awake while allowing the display to sleep; `/caffeinate display` also keeps the display awake. It releases the inhibitor when the run or session ends. Its D-Bus dependency remains on the normal socket transport under Node; Bun on Linux/macOS can use FFI and an in-process reader thread for Unix file-descriptor transport, falling back when unavailable. No daemon or build step is added.
59
59
 
60
- `clef` asks Cloudflare Clef-flash an on-demand yes/no, choice, or score and prints the questions and answers in the transcript, plus a one-line notice. It is not a permission gate. `pi-typesafe@0.9.1` provides `/typesafe` and `typesafe_evaluate` for explicit structured decisions; `/typesafe enable` or `PI_TYPESAFE_ENABLED=1` is still required for agent tool calls. The Pi extension continues to use the TypeSafe API, not Liquid. The package's programmatic client additionally supports Liquid with its own API key and free or paid models; existing usage accounting now merges writes under a short-lived file lock (up to 200ms synchronous wait under contention).
60
+ `clef` asks Cloudflare Clef-flash an on-demand yes/no, choice, or score and prints the questions and answers in the transcript, plus a one-line notice. It is not a permission gate. `pi-typesafe@0.13.0` provides `/typesafe` and `typesafe_evaluate` for explicit structured decisions; `/typesafe enable` or `PI_TYPESAFE_ENABLED=1` is still required for agent tool calls. The default backend remains `https://api.typesafe.ai`. `PI_TYPESAFE_BACKEND` and `PI_TYPESAFE_MODEL` select the session backend and model, and `/typesafe login` stores a key for the named backend. Daily request, token, and USD caps are opt-in. OpenRouter, Command Code, Liquid, SubQ, and a named endpoint stay explicit and use that backend's own key. The promoted SDK is `@typesafe-ai/sdk@0.7.0`.
61
61
 
62
- `@herbertgao/sol-pi` adds opt-in Action Fusion, ObservationPack, Evidence-Preserving Reducer, and Online Context Compact; see its [configuration guide](../sol-pi/docs/configuration.md). `pi-lens@4.4.4` publishes a public LSP config schema, reads user-level custom rule directories (project before user before built-in), normalizes argv-style server entries, downgrades `throw-new-error` to a warning, and counts Docker, JSON, and Jedi servers in idle eviction; language routing and the retained multi-root diagnostic facts are unchanged. It promotes `@ast-grep/cli` to `0.50.0`. `pi-web-access@0.44.0` provides configurable web search and fetch tools; its `toolActivation` defaults to `auto`, choosing eager or dynamic tool activation per model. `toolActivation: "none"` stays opt-in and still requires deferred exposure. It adds structured search/fetch data for codemode and an optional, manually started `pi-web-access-mcp` stdio CLI; installing the aggregate does not start that server. Degoog, Keenable, Ceramic, Linkup, and DeepSeek fetch are explicit-only, excluded from automatic and `all` selection. Provider gateway base URLs are opt-in and are not configured by the aggregate. OpenAI search now defaults to `gpt-6-luna`, results and clone cleanup are scoped per extension instance, and the promoted `@modelcontextprotocol/sdk@^1.32.1` moves the bundle off GHSA-6qxp-vccf-f47h. Perplexity search now uses the Search API's ranked pages and snippets rather than a Sonar-generated answer; requests requiring prose still use Sonar. `pi-antigravity@0.11.0` reads Pi 0.86+ transcript system messages, so Antigravity requests carry Pi's system prompt and tools; it also registers `google_search` and `generate_image` tools that use the signed-in Antigravity account. `pi-provider-qoder@0.6.2` registers the `qoder` and `qoder-cn` model providers. Sign in with `/login qoder` (browser or a personal access token from [qoder.com/account/integrations](https://qoder.com/account/integrations)) or `/login qoder-cn` (token from [qoder.com.cn/account/integrations](https://qoder.com.cn/account/integrations)). `QODER_PERSONAL_ACCESS_TOKEN` and `QODERCN_PERSONAL_ACCESS_TOKEN` log those providers in at startup. `/qoder-usage footer on` replaces the status-bar footer for that session, so leave it off while the pi-cc footer is in use. Preferred Thinking 1.0.2 preserves an explicit subagent `--thinking` choice. Deprecated `@tifan/pi-titlebar-spinner` is no longer bundled; Rename remains the single owner of Herdr tab naming.
62
+ `@herbertgao/sol-pi` adds opt-in Action Fusion, ObservationPack, Evidence-Preserving Reducer, and Online Context Compact; see its [configuration guide](../sol-pi/docs/configuration.md). `pi-lens@4.4.5` publishes a public LSP config schema, reads user-level custom rule directories (project before user before built-in), normalizes argv-style server entries, downgrades `throw-new-error` to a warning, and counts Docker, JSON, and Jedi servers in idle eviction; language routing and the retained multi-root diagnostic facts are unchanged. It promotes `@ast-grep/cli` to `0.51.0` and `@ast-grep/napi` to `^0.51.0`. Concatenated SQL passed to `.execute()` is an advisory full-analysis finding; a parameterized `execute(sql, values)` call stays quiet. Keeping injected findings in later requests is opt-in. `pi-web-access@0.44.0` provides configurable web search and fetch tools; its `toolActivation` defaults to `auto`, choosing eager or dynamic tool activation per model. `toolActivation: "none"` stays opt-in and still requires deferred exposure. It adds structured search/fetch data for codemode and an optional, manually started `pi-web-access-mcp` stdio CLI; installing the aggregate does not start that server. Degoog, Keenable, Ceramic, Linkup, and DeepSeek fetch are explicit-only, excluded from automatic and `all` selection. Provider gateway base URLs are opt-in and are not configured by the aggregate. OpenAI search now defaults to `gpt-6-luna`, results and clone cleanup are scoped per extension instance, and the promoted `@modelcontextprotocol/sdk@^1.32.1` moves the bundle off GHSA-6qxp-vccf-f47h. Perplexity search now uses the Search API's ranked pages and snippets rather than a Sonar-generated answer; requests requiring prose still use Sonar. `pi-antigravity@0.11.0` reads Pi 0.86+ transcript system messages, so Antigravity requests carry Pi's system prompt and tools; it also registers `google_search` and `generate_image` tools that use the signed-in Antigravity account. `pi-provider-qoder@0.6.5` registers the `qoder` and `qoder-cn` model providers. Sign in with `/login qoder` (browser or a personal access token from [qoder.com/account/integrations](https://qoder.com/account/integrations)) or `/login qoder-cn` (token from [qoder.com.cn/account/integrations](https://qoder.com.cn/account/integrations)). `QODER_PERSONAL_ACCESS_TOKEN` and `QODERCN_PERSONAL_ACCESS_TOKEN` log those providers in at startup. `/qoder-usage footer on` replaces the status-bar footer for that session, so leave it off while the pi-cc footer is in use. Preferred Thinking 1.0.2 preserves an explicit subagent `--thinking` choice. Deprecated `@tifan/pi-titlebar-spinner` is no longer bundled; Rename remains the single owner of Herdr tab naming.
63
63
 
64
64
  `pi-stash` is no longer bundled: `/btw` already preserves the main editor draft while handling side questions outside the main conversation. Prior `@herbertgao/pi-stash` releases remain available but are no longer maintained here.
65
65
 
66
66
  ### Next-cue suggestions
67
67
 
68
- `pi-next-cue@1.0.7` predicts a short next prompt after each completed agent turn. In the empty editor, `Tab` fills the suggestion and `Enter` sends it. Each settled turn can make one extra model request using recent conversation text, recent tool names/results, and the configured active or explicitly selected model. It is TUI-only and wraps the prompt editor, so do not enable another custom-editor extension that also owns the editor slot.
68
+ `pi-next-cue@1.0.8` predicts a short next prompt after each completed agent turn. Its peer dependency is Pi `>=1.2.0`. In the empty editor, `Tab` fills the suggestion and `Enter` sends it. Each settled turn can make one extra model request using recent conversation text, recent tool names/results, and the configured active or explicitly selected model. It is TUI-only and wraps the prompt editor, so do not enable another custom-editor extension that also owns the editor slot.
69
69
 
70
70
  ### Footer
71
71
 
@@ -111,7 +111,7 @@ THE SOFTWARE.
111
111
 
112
112
  ## `pi-typesafe`
113
113
 
114
- The aggregate bundles [`pi-typesafe`](https://github.com/DevMortimer/pi-typesafe) version 0.10.0 under its original MIT license:
114
+ The aggregate bundles [`pi-typesafe`](https://github.com/DevMortimer/pi-typesafe) version 0.13.0 under its original MIT license:
115
115
 
116
116
  MIT License
117
117
 
@@ -137,7 +137,7 @@ THE SOFTWARE.
137
137
 
138
138
  ## `pi-next-cue`
139
139
 
140
- The aggregate bundles [`pi-next-cue`](https://github.com/ouzhenkun/pi-next-cue) version 1.0.7 under its original MIT license. The imported npm package corresponds to upstream commit [`015a595c6751d50889b3a6937ba4816dfe92adc1`](https://github.com/ouzhenkun/pi-next-cue/commit/015a595c6751d50889b3a6937ba4816dfe92adc1).
140
+ The aggregate bundles [`pi-next-cue`](https://github.com/ouzhenkun/pi-next-cue) version 1.0.8 under its original MIT license. The imported npm package corresponds to upstream commit [`49c56b4ba659d20bbb36873a572094f55779e87b`](https://github.com/ouzhenkun/pi-next-cue/commit/49c56b4ba659d20bbb36873a572094f55779e87b).
141
141
 
142
142
  MIT License
143
143
 
@@ -163,4 +163,4 @@ THE SOFTWARE.
163
163
 
164
164
  ## `pi-provider-qoder`
165
165
 
166
- The aggregate bundles [`pi-provider-qoder`](https://github.com/simonsmh/pi-provider-qoder) version 0.6.2 under its original package name. npm metadata and the repository README declare the MIT license. The published tarball does not include a LICENSE file. The published package corresponds to git commit [`9764217c0c2c8db9f442b87e045153a11a6dfb1c`](https://github.com/simonsmh/pi-provider-qoder/commit/9764217c0c2c8db9f442b87e045153a11a6dfb1c).
166
+ The aggregate bundles [`pi-provider-qoder`](https://github.com/simonsmh/pi-provider-qoder) version 0.6.5 under its original package name. npm metadata and the repository README declare the MIT license. The published tarball does not include a LICENSE file. The published package corresponds to git commit [`fa5067d1bf0c4accc2fc88ad672e23390a2d6f16`](https://github.com/simonsmh/pi-provider-qoder/commit/fa5067d1bf0c4accc2fc88ad672e23390a2d6f16).
@@ -4,7 +4,7 @@
4
4
 
5
5
  # pi-cc-extensions
6
6
 
7
- > Claude Code-style TUI output with some personal touches and handy utilities.
7
+ > Claude Code-style TUI output with some personal touches and handy utilities (no extra built-in tools).
8
8
 
9
9
  ## Preview
10
10
 
@@ -34,7 +34,7 @@ Run `/reload` after installation.
34
34
  | Context inspection | Usage breakdown and previews for the system prompt, memory, skills, tools definition, and messages | `/context` |
35
35
  | Session/Subagent references | Search and inject effective context from previous Sessions or existing SubAgents | `@` |
36
36
  | Status bar | Shows model, context, cache, cost, and git; also works with `@narumitw/pi-usage` for live quota. Git/cache Nerd Font icons can be turned off | `/ccstyle` |
37
- | Theme | Bundled CC Dark and CC Light themes | `/theme` |
37
+ | Theme | Bundled CC Dark and CC Light themes | `/settings` → Theme |
38
38
 
39
39
  Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-examples-default.md) · [compact](./docs/tool-render-examples-compact.md)
40
40
 
@@ -55,7 +55,7 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
55
55
  "enableAgentSummary": true, // per-turn tool summary
56
56
  "enableWorkingMessage": true, // Working... bottom token/elapsed
57
57
  "enableAliases": true, // /clear, /exit aliases
58
- "enableMarkdownEnhance": true, // markdown pass: Mermaid dialects and circled-number conversion; false hands it to other extensions
58
+ "enableMarkdownEnhance": true, // markdown pass: Mermaid dialects and circled-number conversion; false hands it to other extensions
59
59
  "enableEditorPrefix": true, // editor ❯ prefix
60
60
 
61
61
  // ui
@@ -91,18 +91,16 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
91
91
  "footerGitStatsMode": "working", // working (default): uncommitted; branch: cumulative net changes
92
92
  "footerHiddenKeys": [], // hidden chip keys
93
93
  "footerLine1Keys": ["model", "context", "cache", "rate", "cost", "pi-usage"], // chip order per line; builtins and plugins share one layout
94
- "footerLine2Keys": ["cwd", "git"], // cwd: directory and session; git: branch and changes. Either can move to any line
94
+ "footerLine2Keys": ["cwd", "git"], // cwd: directory and session; git: branch and changes. Either can move to any line
95
95
  "footerLine3Keys": [], // painted only when a chip is visible
96
96
  }
97
97
  ```
98
98
 
99
99
  > [!TIP]
100
- > **Fullscreen**: click `click to show more` to expand tool cards, thinking, Skill, and compact summaries. An expanded diff always shows every line; when expanded Input/Output exceeds the line cap, the footer `… +N more lines · click to show more` opens a full preview. Click to collapse.
101
- >
102
- > Both `scrollButtonMode` values show the same `Back to bottom` / `N new message(s)` text: `dock` draws it in a dedicated row, `native` in Pi’s floating overlay.
100
+ > **Fullscreen**: expanded diffs always show every line. When expanded Input/Output exceeds the line cap, the footer shows `… +N more lines`; click for the full preview, click again to collapse.
103
101
 
104
102
  > [!NOTE]
105
- > **Mermaid rendering**: set `markdown.mermaid` to `final` via `~/.pi/agent/settings.json` or the Mermaid diagrams option in `/settings`. Default `streaming` redraws per frame; `final` renders once at completion.
103
+ > **Mermaid rendering**: set `markdown.mermaid` to `final` via `~/.pi/agent/settings.json` or `/settings`. Default `streaming` redraws every frame; `final` renders once.
106
104
 
107
105
  ## Local development
108
106
 
@@ -128,7 +126,7 @@ pi -e . # one run, does not edit settings.json
128
126
 
129
127
  ## Credits
130
128
 
131
- - Based on [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.8 (MIT), upstream baseline [`2cb2c1e`](https://github.com/minuque/pi-cc-extensions/commit/2cb2c1ec7240f183ff68cbab0ea6ae3239529f23), with this repository's configuration migration and compatibility patches retained.
129
+ - Based on [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.11 (MIT), upstream baseline [`4697b4a`](https://github.com/minuque/pi-cc-extensions/commit/4697b4ac2cc28ee89bb9c37f1021e91075bfd94c), with this repository's configuration migration and compatibility patches retained.
132
130
  - Rich diffs are adapted from [`MasuRii/pi-tool-display`](https://github.com/MasuRii/pi-tool-display) (MIT). See [`extensions/renderer/tool/diff/ATTRIBUTION.md`](./extensions/renderer/tool/diff/ATTRIBUTION.md).
133
131
 
134
132
  ## License
@@ -4,7 +4,7 @@
4
4
 
5
5
  # pi-cc-extensions
6
6
 
7
- > 类 Claude Code TUI 输出风格,并融入了一些个人喜好,和一些实用小功能。
7
+ > 类 Claude Code TUI 输出风格,并融入了一些个人喜好,和一些实用小功能(无额外内置工具)。
8
8
 
9
9
  ## 界面预览
10
10
 
@@ -34,7 +34,7 @@ pi install git:github.com/HerbertGao/pi-extensions
34
34
  | 上下文检查 | 查看上下文占用,并预览 System prompt、Memory、Skills、Tools definition 和消息内容 | `/context` |
35
35
  | Session/Subagent 引用 | 搜索并注入历史 Session 或现有 SubAgent 的有效上下文 | `@` |
36
36
  | 状态栏 | 显示:模型、上下文、缓存、费用、git并适配 @narumitw/pi-usage 实时显示额度;git/缓存图标可关 Nerd Font | `/ccstyle` |
37
- | 主题 | 随包提供内置 CC Dark、CC Light 主题 | `/theme` |
37
+ | 主题 | 随包提供内置 CC Dark、CC Light 主题 | `/settings` → Theme |
38
38
 
39
39
  `on` / `compact` 两种模式的渲染样例:[默认模式](./docs/tool-render-examples-default.md) · [紧凑模式](./docs/tool-render-examples-compact.md)
40
40
 
@@ -55,7 +55,7 @@ pi install git:github.com/HerbertGao/pi-extensions
55
55
  "enableAgentSummary": true, // 每回合工具摘要
56
56
  "enableWorkingMessage": true, // Working... 底部 token/耗时
57
57
  "enableAliases": true, // /clear、/exit 别名
58
- "enableMarkdownEnhance": true, // markdown 转换:Mermaid 方言渲染、圈数字转半角括号;false 让位给其他扩展
58
+ "enableMarkdownEnhance": true, // markdown 转换:Mermaid 方言渲染、圈数字转半角括号;false 让位给其他扩展
59
59
  "enableEditorPrefix": true, // 输入框 ❯ 前缀
60
60
 
61
61
  // ui
@@ -90,18 +90,16 @@ pi install git:github.com/HerbertGao/pi-extensions
90
90
  "footerGitStatsMode": "working", // working(默认):未提交改动;branch:分支累计净改动
91
91
  "footerHiddenKeys": [], // 隐藏的芯片 key
92
92
  "footerLine1Keys": ["model", "context", "cache", "rate", "cost", "pi-usage"], // 每行芯片顺序;内置项与插件同一套排布
93
- "footerLine2Keys": ["cwd", "git"], // cwd:目录和会话名;git:分支和改动。可换到任意行
93
+ "footerLine2Keys": ["cwd", "git"], // cwd:目录和会话名;git:分支和改动。可换到任意行
94
94
  "footerLine3Keys": [] // 有可见芯片才占行
95
95
  }
96
96
  ```
97
97
 
98
98
  > [!TIP]
99
- > **全屏模式**:单击 `click to show more` 展开工具卡、思考、Skill 和 compact 摘要;工具卡展开态 diff 全量显示,Input/Output 超行时末行 `… +N more lines · click to show more` 打开全量预览,单击收起。
100
- >
101
- > `scrollButtonMode` 两种模式文案相同(`Back to bottom` / `N new message(s)`):`dock` 画在独占行,`native` 画在 Pi 原生浮层。
99
+ > **全屏模式**:展开态 diff 全量显示。Input/Output 超行时末行给 `… +N more lines`,单击看全量,再击收起。
102
100
 
103
101
  > [!NOTE]
104
- > **Mermaid 渲染**:建议把 `markdown.mermaid` 设为 `final`(`~/.pi/agent/settings.json` 或 `/settings` 面板的 Mermaid diagrams 选项)。默认 `streaming` 逐帧重绘,`final` 渲染最终版更稳定。
102
+ > **Mermaid 渲染**:`markdown.mermaid` 建议设为 `final`(`~/.pi/agent/settings.json` 或 `/settings`)。默认 `streaming` 逐帧重绘,`final` 只渲染最终版。
105
103
 
106
104
  ## 本地开发
107
105
 
@@ -127,7 +125,7 @@ pi -e . # 只跑一次,不改 settings.json
127
125
 
128
126
  ## 致谢
129
127
 
130
- - 基于 [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.8(MIT),上游基线 [`2cb2c1e`](https://github.com/minuque/pi-cc-extensions/commit/2cb2c1ec7240f183ff68cbab0ea6ae3239529f23);保留本仓库的配置迁移与兼容性补丁。
128
+ - 基于 [`minuque/pi-cc-extensions`](https://github.com/minuque/pi-cc-extensions) 1.0.11(MIT),上游基线 [`4697b4a`](https://github.com/minuque/pi-cc-extensions/commit/4697b4ac2cc28ee89bb9c37f1021e91075bfd94c);保留本仓库的配置迁移与兼容性补丁。
131
129
  - Rich diff 改编自 [`MasuRii/pi-tool-display`](https://github.com/MasuRii/pi-tool-display)(MIT);详见 [`extensions/renderer/tool/diff/ATTRIBUTION.md`](./extensions/renderer/tool/diff/ATTRIBUTION.md)。
132
130
 
133
131
  ## 许可证
@@ -122,6 +122,7 @@ export const THINKING_PREVIEW_LINES_VALUES = ["0", "1", "3", "5", "10"];
122
122
  export const THINKING_ANIMATION_INTERVAL_VALUES = ["40", "60", "90", "120", "180"];
123
123
  /** Tools commonly toggled in excludeRenderers via the settings panel. */
124
124
  export const EXCLUDE_RENDERER_CANDIDATES = [
125
+ "Agent",
125
126
  "bash",
126
127
  "powershell",
127
128
  "read",
@@ -82,8 +82,8 @@ function modeSettingDescription(mode: CompactStyleMode): string {
82
82
 
83
83
  function excludeRenderersDescription(names: readonly string[]): string {
84
84
  return names.length === 0
85
- ? "No tools excluded. Agent always keeps its dedicated renderer. Enter to toggle common tools."
86
- : `Native renderer for: ${names.join(", ")}. Agent is always native. Enter to toggle.`;
85
+ ? "No tools excluded. Enter to toggle common tools."
86
+ : `Native renderer for: ${names.join(", ")}. Enter to toggle.`;
87
87
  }
88
88
 
89
89
  function customFooterDescription(enabled: boolean): string {
@@ -275,10 +275,7 @@ function buildExcludeRenderersSubmenu(
275
275
  const items = candidates.map((name) => ({
276
276
  id: name,
277
277
  label: name,
278
- description:
279
- name === "Agent"
280
- ? "Agent always uses its dedicated renderer and cannot be forced through ccstyle."
281
- : `Use Pi native renderer for ${name} instead of Claude Code styling.`,
278
+ description: `Use Pi native renderer for ${name} instead of Claude Code styling.`,
282
279
  currentValue: config.excludeRenderers.includes(name) ? "exclude" : "style",
283
280
  values: ["style", "exclude"],
284
281
  }));
@@ -432,6 +429,11 @@ export async function showCcstylePanel(
432
429
  return;
433
430
  }
434
431
 
432
+ // 编辑器插槽只能在面板关闭后替换:面板自己就挂在 editorContainer 上,面板开着时调
433
+ // setEditorComponent 会把面板踢出渲染树、done() 再也走不到,`ctx.ui.custom()` 永不落定,
434
+ // 整个输入管线随之卡死。
435
+ let editorPrefixChanged = false;
436
+
435
437
  await ctx.ui.custom((tui: any, theme: any, _keybindings: any, done: () => void) => {
436
438
  const modeSetting = {
437
439
  id: "mode",
@@ -881,8 +883,7 @@ export async function showCcstylePanel(
881
883
  editorPrefixSetting.description = enabled
882
884
  ? "Show ❯ before the input line; color follows thinking level / bash mode."
883
885
  : "Plain input line, no ❯ glyph.";
884
- if (enabled) applyPromptEditor(ctx);
885
- else clearPromptEditor(ctx);
886
+ editorPrefixChanged = true;
886
887
  ctx.ui.notify(`Updated ${id}: ${value}`, "info");
887
888
  return;
888
889
  }
@@ -1210,6 +1211,11 @@ export async function showCcstylePanel(
1210
1211
  },
1211
1212
  };
1212
1213
  });
1214
+ // 面板已经卸下,插槽此时替换才不会踢掉对话框。
1215
+ if (editorPrefixChanged) {
1216
+ if (config.enableEditorPrefix) applyPromptEditor(ctx);
1217
+ else clearPromptEditor(ctx);
1218
+ }
1213
1219
  // 面板卸下后主 transcript 重新挂载;再刷一次,吃掉打开期间扫树失败的切换。
1214
1220
  hooks.refreshCurrentTranscript(ctx, toolGrouping);
1215
1221
  }
@@ -820,27 +820,44 @@ export default function contextUsageExtension(pi: ExtensionAPI) {
820
820
  return theme.style("█".repeat(Math.max(0, cells)), { fg: part.color });
821
821
  })
822
822
  .join("");
823
+ const amountCells = allParts.map((part) => {
824
+ const pct = contextWindow > 0 ? (part.tokens / contextWindow) * 100 : 0;
825
+ const tokens = formatTokens(part.tokens).padStart(7);
826
+ const percent = `${pct.toFixed(1).padStart(5)}%`;
827
+ return { tokens, percent, plain: `${tokens} ${percent}` };
828
+ });
829
+ // 数字列整体贴右:label 最多占到「行宽 - 数字列宽 - 前缀 - 边距」为止。
830
+ const amountWidth = Math.max(
831
+ ...amountCells.map((cell) => visibleWidth(cell.plain)),
832
+ );
823
833
  const labelWidth = Math.min(
824
834
  24,
825
835
  Math.max(...allParts.map((part) => part.label.length)),
836
+ Math.max(1, inner - amountWidth - 5),
826
837
  );
827
838
  const selectedLabel = visiblePreviews[selectedPreviewIndex]?.label;
828
- const partRows = allParts.map((part) => {
829
- const pct = contextWindow > 0 ? (part.tokens / contextWindow) * 100 : 0;
839
+ const partRows = allParts.map((part, index) => {
830
840
  const swatch = theme.style("■", { fg: part.color });
831
841
  const label = part.label.padEnd(labelWidth);
832
- const amount = `${formatTokens(part.tokens).padStart(7)} ${pct.toFixed(1).padStart(5)}%`;
842
+ const amount = amountCells[index];
833
843
  const selected = part.label === selectedLabel;
834
844
  const hoverLabel = visiblePreviews.find((p) => p.key === hoveredKey)?.label;
835
845
  const prefix = selected ? "› " : " ";
836
- const row = padLine(`${prefix}${swatch} ${label} ${amount}`, inner);
846
+ const left = `${prefix}${swatch} ${label}`;
847
+ const gap = Math.max(
848
+ 1,
849
+ inner - 1 - visibleWidth(left) - visibleWidth(amount?.plain ?? ""),
850
+ );
851
+ // token 数字用次级色,百分比保持正文色以保留可读的主指标。
852
+ const right = `${theme.fg("dim", amount?.tokens ?? "")} ${amount?.percent ?? ""}`;
853
+ const row = padLine(`${left}${" ".repeat(gap)}${right}`, inner);
837
854
  if (selected) return theme.bg("selectedBg", row);
838
855
  return part.label === hoverLabel ? theme.bg("customMessageBg", row) : row;
839
856
  });
840
857
  const border = (text: string) => theme.fg("border", text);
841
858
  const lines = [
842
859
  border(`╭${"─".repeat(inner)}╮`),
843
- `${border("│")}${padLine(` ${title} ${theme.fg("muted", subtitle)}`, inner - escWidth)}${theme.fg(escHovered ? "text" : "muted", "[esc]")}${border("│")}`,
860
+ `${border("│")}${padLine(` ${title} ${theme.fg("dim", subtitle)}`, inner - escWidth)}${theme.fg(escHovered ? "text" : "muted", "[esc]")}${border("│")}`,
844
861
  `${border("├")}${border("─".repeat(inner))}${border("┤")}`,
845
862
  `${border("│")}${padLine(` ${segments}`, inner)}${border("│")}`,
846
863
  `${border("│")}${" ".repeat(inner)}${border("│")}`,
@@ -385,12 +385,24 @@ const createCustomFooterFactory =
385
385
  return 0;
386
386
  };
387
387
 
388
- const render = (width: number): string[] => {
388
+ // 三个会话统计每帧重算会全量遍历 session,长会话把 pi 钉在 100% CPU(issue #80)。
389
+ // leaf/model/thinking 任一变化立即重算;不变时 1s TTL,流式期间每秒刷新一次。
390
+ const SESSION_STATS_TTL_MS = 1_000;
391
+ let statsMemoKey = "";
392
+ let statsMemoAt = 0;
393
+ let statsMemo:
394
+ | { contextUsage: ReturnType<typeof ctx.getContextUsage>; cost: number; cachePct: number }
395
+ | undefined;
396
+ const sessionStats = () => {
389
397
  const model = ctx.model;
390
- const contextUsage = ctx.getContextUsage();
391
- const contextWindow = contextUsage?.contextWindow ?? model?.contextWindow ?? 0;
392
- const percent = contextUsage?.percent;
393
-
398
+ const key = `${ctx.sessionManager.getLeafId() ?? ""}|${model?.provider}/${model?.id}|${ctx.thinkingLevel ?? ""}`;
399
+ if (
400
+ statsMemo &&
401
+ key === statsMemoKey &&
402
+ performance.now() - statsMemoAt < SESSION_STATS_TTL_MS
403
+ ) {
404
+ return statsMemo;
405
+ }
394
406
  let cost = 0;
395
407
  for (const entry of ctx.sessionManager.getEntries()) {
396
408
  if (entry.type === "message") {
@@ -404,6 +416,17 @@ const createCustomFooterFactory =
404
416
  cost += entry.usage.cost?.total || 0;
405
417
  }
406
418
  }
419
+ statsMemo = { contextUsage: ctx.getContextUsage(), cost, cachePct: getCachePct() };
420
+ statsMemoKey = key;
421
+ statsMemoAt = performance.now();
422
+ return statsMemo;
423
+ };
424
+
425
+ const render = (width: number): string[] => {
426
+ const model = ctx.model;
427
+ const { contextUsage, cost, cachePct } = sessionStats();
428
+ const contextWindow = contextUsage?.contextWindow ?? model?.contextWindow ?? 0;
429
+ const percent = contextUsage?.percent;
407
430
 
408
431
  // cwd 默认只显示最底层路径(根目录时回退完整路径)
409
432
  const cwdLabel = ctx.cwd.split(/[\\/]/).filter(Boolean).pop() || ctx.cwd;
@@ -430,7 +453,6 @@ const createCustomFooterFactory =
430
453
  const dimPlugin = (text: string) => colorUsageChip(theme, text);
431
454
 
432
455
  const pctLabel = percent === null || percent === undefined ? "?" : `${Math.floor(percent)}%`;
433
- const cachePct = getCachePct();
434
456
  const glyphs = footerGlyphs(config.footerNerdIcons);
435
457
  const cacheLabel =
436
458
  cachePct > 0 ? `${glyphs.cache ? `${glyphs.cache} ` : ""}${Math.floor(cachePct)}%` : "";
@@ -59,27 +59,48 @@ const promptEditorFactory: EditorFactory = (tui, theme, keybindings) =>
59
59
  let active = false;
60
60
  let previousEditorFactory: EditorFactory | undefined;
61
61
 
62
- /** 撤销本扩展占据的插槽;从未占用就不碰插槽。 */
62
+ /**
63
+ * 撤销本扩展占据的插槽;从未占用就不碰插槽。
64
+ *
65
+ * 插槽可能已经被其他扩展包在外层(pi-inline-skills 会把当前工厂再包一层),
66
+ * 那种结构里无法只拆内层,直接还回占据前的工厂;外层扩展会在下次终端输入时
67
+ * 自己重新包装,前缀不会因此复活。
68
+ *
69
+ * 例外:插槽被 pi 重置回占据前的工厂时(/new、/reload 走 resetExtensionUI),
70
+ * 我们已经不在槽里,再写一次会把 pi 刚重置的结果又覆盖掉;此时只清状态。
71
+ */
63
72
  function releasePromptEditor(ctx: ExtensionContext): void {
64
73
  if (!active) return;
65
- ctx.ui.setEditorComponent(previousEditorFactory);
74
+ const previous = previousEditorFactory;
66
75
  active = false;
67
76
  previousEditorFactory = undefined;
77
+ if (ctx.ui.getEditorComponent?.() === previous) return;
78
+ ctx.ui.setEditorComponent(previous);
68
79
  }
69
80
 
70
- /** 应用输入框前缀;enableEditorPrefix=false 时只撤自己装的那层。 */
81
+ /**
82
+ * 应用输入框前缀;enableEditorPrefix=false 时只撤自己装的那层。
83
+ *
84
+ * 只在没有扩展对话框开着时调用:pi 的 setEditorComponent 会清空 editorContainer 并
85
+ * 抢走焦点,把正在设置面板里的对话框踢出渲染树,对话框的 done() 再也走不到,
86
+ * `ctx.ui.custom()` 的 Promise 永不落定,后续输入全部卡死。设置面板自己不做替换,
87
+ * 等 `ctx.ui.custom()` 返回后再调本函数。
88
+ *
89
+ * 插槽已经装着本扩展的编辑器时直接返回:重复安装只会重建实例,丢掉撤销栈、
90
+ * 历史等编辑器状态,还会打断其他扩展包在外层的编辑器。
91
+ */
71
92
  export function applyPromptEditor(ctx: ExtensionContext): void {
72
93
  if (!ctx?.hasUI || typeof ctx.ui?.setEditorComponent !== "function") return;
94
+ if (!config.enableEditorPrefix) {
95
+ releasePromptEditor(ctx);
96
+ return;
97
+ }
98
+ const current = ctx.ui.getEditorComponent?.();
99
+ if (current === promptEditorFactory) return;
73
100
  try {
74
- if (!config.enableEditorPrefix) {
75
- releasePromptEditor(ctx);
76
- return;
77
- }
78
- if (!active) {
79
- // pi 的插槽是硬替换、没有栈,先记住是谁占着,撤销时还回去。
80
- previousEditorFactory = ctx.ui.getEditorComponent?.();
81
- active = true;
82
- }
101
+ // pi 的插槽是硬替换、没有栈,先记住是谁占着,撤销时还回去。
102
+ previousEditorFactory = current;
103
+ active = true;
83
104
  ctx.ui.setEditorComponent(promptEditorFactory);
84
105
  } catch (err) {
85
106
  ctx.ui.notify(
@@ -64,6 +64,7 @@ import { paddedBackgroundRow } from "./tool/grouping.ts";
64
64
  import { styleChangeCounts } from "./tool/ccstyle-tool.ts";
65
65
  import { formatDisplayPath } from "./tool/names.ts";
66
66
  import {
67
+ contentRowRange,
67
68
  hasVisibleText,
68
69
  removeStyledRange,
69
70
  stripBackgroundAnsi,
@@ -372,7 +373,7 @@ function editWriteExpandedCard(theme: any, component: any): any {
372
373
  /** compact 展开面板:外卡片保持展开卡背景;展开的 thinking 另包一层更深的
373
374
  * 内卡(自身 Box 背景与外卡同色,不区分会糊在一起),工具卡直接铺在外卡背景上。
374
375
  * 每个子卡前面补 1 行分隔(上一条已经是空行时不再补),子卡自带的首尾空行会被裁掉,
375
- * 避免与外卡/内卡 padding 叠出双空行。
376
+ * 避免与外卡/内卡 padding 叠出双空行(内联图片的占位行不裁,见 contentRowRange)。
376
377
  * hits:子卡的行区间与命中目标(thinking 命中自身,工具命中 tool 组件),
377
378
  * 供展开后点击 hint。未开启 toolHits 时不映射工具,点击仍归外层面板。
378
379
  * live=true:live 槽位用,不铺底色也不留上下空行,首行紧跟 `↳`、其余行缩进对齐
@@ -434,14 +435,8 @@ function layoutExpandedToolCard(
434
435
  const painted = paints?.[childIndex];
435
436
  const childLines = Array.isArray(painted) ? painted : child.render(innerWidth);
436
437
  const innerCard = !live && isThinkingPreview(child) && child.expanded === true;
437
- let first = -1;
438
- let last = -1;
439
- for (let i = 0; i < childLines.length; i++) {
440
- if (hasVisibleText(childLines[i])) {
441
- if (first < 0) first = i;
442
- last = i;
443
- }
444
- }
438
+ // 内联图片按 placement 把范围撑开:锚点前后的空行是图片占的位置,不能当首尾空行裁。
439
+ const { first, last } = contentRowRange(childLines);
445
440
  if (first < 0) {
446
441
  if (live) continue;
447
442
  for (const line of childLines) {
@@ -603,16 +598,20 @@ export type CompactModeHooks = {
603
598
  /** 重新渲染包含指定 toolCallId 的 assistant 消息(思考收尾时刷新)。 */
604
599
  refreshToolCallMessage(toolCallId: string | undefined): void;
605
600
  /**
606
- * 收尾 resume 重放留下的活动回合。重放是同步的,回合之间靠下一条消息收口,
607
- * 只有最后一条没有后续消息,会停在 Running。
601
+ * 会话已空闲时收尾末尾回合。回放/切换样式/重载重建之后,末尾那条消息
602
+ * 后面没有消息来收口;活性只问会话,不从消息形状推断。
608
603
  */
609
- settleReplayedRound(): void;
604
+ settleIdleRound(): void;
605
+ /** agent 这轮跑完:收尾仍在 live 的末尾回合,别让它一直挂着 Running。 */
606
+ settleFinishedRound(): void;
610
607
  shutdown(): void;
611
608
  };
612
609
 
613
610
  type CompactModeInstallDeps = {
614
611
  query?: CompactThinkingQuery;
615
612
  writeMetadata: WriteExecutionMetadataStore;
613
+ /** 会话是否空闲;测试注入用,正式路径取 ctx.isIdle。 */
614
+ isIdle?: () => boolean;
616
615
  };
617
616
 
618
617
  type CompactModePatch = {
@@ -1057,6 +1056,14 @@ function compactStopStatusLine(status: string, pad = 0): any {
1057
1056
  /** 展开入口的动作词:我们的 `click to show more`、pi 的 `<key> to expand`(键名可能取不到)。 */
1058
1057
  const EXPAND_ACTION = String.raw`(?:click to show more|(?:[\w/+]+\s+)?to (?:show more|expand))`;
1059
1058
 
1059
+ /**
1060
+ * 展开入口只挂在行尾:正则只看行尾这一段,单行代价与行长无关。
1061
+ * 图片负载(kitty 图形数据的 Base64)一行可达数百 KB,整行过正则会拖住渲染帧。
1062
+ */
1063
+ const SLOT_HINT_WINDOW = 200;
1064
+ /** 窗口里出现这些词才可能有展开入口,其余行(负载、代码)直接放过正则。 */
1065
+ const SLOT_HINT_MARKERS = ["to expand", "to show more"];
1066
+
1060
1067
  const SLOT_HINT_PATTERNS: RegExp[] = [
1061
1068
  // 卡在括号里:`(9 more lines, click to show more)` / `(195 earlier lines, ctrl+o to expand)`,
1062
1069
  // 只去掉动作词,收尾括号与计数保留。
@@ -1066,13 +1073,18 @@ const SLOT_HINT_PATTERNS: RegExp[] = [
1066
1073
  new RegExp(String.raw`\s*(?:[•·]\s*)?${EXPAND_ACTION}\s*$`),
1067
1074
  ];
1068
1075
 
1069
- function stripSlotHint(line: string): string {
1070
- const plain = stripTerminalSequencesPreservingLayout(line);
1076
+ /** 导出供单测:窗口边界与键名长度是性能与裁剪行为的关键,需要逐条钉住。 */
1077
+ export function stripSlotHint(line: string): string {
1078
+ // 切点可能落在转义序列中间,残片只当作窗口头部文本;两个模式都锚在行尾,不受影响。
1079
+ const head = line.slice(0, Math.max(0, line.length - SLOT_HINT_WINDOW));
1080
+ const tail = line.slice(head.length);
1081
+ const plain = stripTerminalSequencesPreservingLayout(tail);
1082
+ if (!SLOT_HINT_MARKERS.some((marker) => plain.includes(marker))) return line;
1071
1083
  for (const re of SLOT_HINT_PATTERNS) {
1072
1084
  const match = re.exec(plain);
1073
1085
  if (!match) continue;
1074
1086
  // 删除区间而非截断后拼纯文本:收尾括号留在原样式里(dim),不会掉回默认前景色。
1075
- return removeStyledRange(line, match.index, match.index + match[0].length);
1087
+ return head + removeStyledRange(tail, match.index, match.index + match[0].length);
1076
1088
  }
1077
1089
  return line;
1078
1090
  }
@@ -1220,8 +1232,18 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
1220
1232
  const liveSlotToolIds = new Set<string>();
1221
1233
  const pendingFoldRounds = new Set<CompactRound>();
1222
1234
  let uiRef: { requestRender?: (force?: boolean) => void } | undefined;
1235
+ let idleRef: (() => boolean) | undefined = deps.isIdle;
1223
1236
  let roundTickTimer: ReturnType<typeof setInterval> | undefined;
1224
1237
 
1238
+ /** 会话是否空闲:回合活性的事实来源,取不到就当没空闲(宁可保留 Running)。 */
1239
+ const sessionIdle = (): boolean => {
1240
+ try {
1241
+ return idleRef?.() === true;
1242
+ } catch {
1243
+ return false;
1244
+ }
1245
+ };
1246
+
1225
1247
  const roundWallMs = (round: CompactRound): number => {
1226
1248
  const end = round.active ? Date.now() : (round.endedAt ?? Date.now());
1227
1249
  return Math.max(1, end - round.startedAt);
@@ -2159,6 +2181,19 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2159
2181
  }
2160
2182
  };
2161
2183
 
2184
+ /**
2185
+ * 会话已空闲时收尾末尾回合。重建 pass 内仍按顺序并回合(同一 turn 的多条
2186
+ * 消息要合成一条摘要),只在 pass 结束时对账:会话没在跑,末尾那条就不会
2187
+ * 再长出内容,停在 Running 是假的。
2188
+ */
2189
+ const settleTrailingRound = (): void => {
2190
+ if (!sessionIdle()) return;
2191
+ const round = activeRound;
2192
+ if (!round) return;
2193
+ finalizeRound(round);
2194
+ renderRound(round);
2195
+ };
2196
+
2162
2197
  patch.assistantInstalled = function (this: any, message: any, isStreaming?: boolean) {
2163
2198
  const self = this as any;
2164
2199
  // 同 compact-thinking:isStreaming 丢失 → mermaid 流式误渲染来回闪。
@@ -2410,6 +2445,7 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2410
2445
  sync(ctx: any) {
2411
2446
  if (!patch.active) return;
2412
2447
  uiRef = ctx?.ui;
2448
+ if (typeof ctx?.isIdle === "function") idleRef = () => ctx.isIdle() === true;
2413
2449
  resetRounds();
2414
2450
  // 始终保持补丁在链上:mode=on/off 走 passThrough,仍写入 lastMessage
2415
2451
  // 与 tracked 集合,这样 /ccstyle 切回 compact 时不必 /reload。
@@ -2418,6 +2454,7 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2418
2454
  else hoveredAssistantComponent = undefined;
2419
2455
  refreshTrackedComponents();
2420
2456
  sweepOrphanTails();
2457
+ settleTrailingRound();
2421
2458
  },
2422
2459
  refresh() {
2423
2460
  if (!patch.active) return;
@@ -2426,6 +2463,7 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2426
2463
  if (config.mode !== "compact") hoveredAssistantComponent = undefined;
2427
2464
  refreshTrackedComponents();
2428
2465
  sweepOrphanTails();
2466
+ settleTrailingRound();
2429
2467
  },
2430
2468
  assertOwnership() {
2431
2469
  if (!patch.active) return;
@@ -2446,11 +2484,16 @@ export function installCompactMode(deps: CompactModeInstallDeps): CompactModeHoo
2446
2484
  }
2447
2485
  }
2448
2486
  },
2449
- settleReplayedRound() {
2487
+ settleIdleRound() {
2488
+ if (!patch.active || config.mode !== "compact") return;
2489
+ settleTrailingRound();
2490
+ },
2491
+ settleFinishedRound() {
2450
2492
  if (!patch.active || config.mode !== "compact") return;
2451
2493
  const round = activeRound;
2452
2494
  if (!round) return;
2453
- finalizeRound(round); // clears activeRound — capture it first
2495
+ // 走静默期:摘要行当场翻成 Ran for,槽位卡多留一拍再收拢。
2496
+ endRound(round, true);
2454
2497
  renderRound(round);
2455
2498
  },
2456
2499
  shutdown() {