@herbertgao/pi-extensions 2026.9.19 → 2026.10.0

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 (444) hide show
  1. package/README.md +14 -16
  2. package/THIRD_PARTY_NOTICES.md +29 -3
  3. package/node_modules/@herbertgao/pi-bark/README.md +39 -3
  4. package/node_modules/@herbertgao/pi-bark/package.json +1 -1
  5. package/node_modules/@herbertgao/pi-bark/src/index.ts +275 -15
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +85 -68
  7. package/node_modules/@herbertgao/pi-cc-extensions/README.md +79 -62
  8. package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/preview.webp +0 -0
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +116 -34
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +370 -118
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +6 -36
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +2 -2
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +31 -33
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +330 -360
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/index.ts +56 -108
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/session.ts +97 -15
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/subagent.ts +80 -45
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/flush-docked-bash.ts +36 -0
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer-layout.ts +229 -0
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +521 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/mcp-chip.ts +136 -0
  22. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/startup-header.ts +92 -61
  23. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +58 -38
  24. package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +19 -3
  25. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +1127 -231
  26. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +267 -262
  27. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +38 -48
  28. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +8 -2
  29. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +2 -7
  30. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +287 -114
  31. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +15 -6
  32. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +18 -72
  33. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +61 -26
  34. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +303 -0
  35. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/ansi-utils.ts +25 -57
  36. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-component.ts +125 -0
  37. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-edit-render.ts +227 -0
  38. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +136 -0
  39. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-highlight.ts +151 -0
  40. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-inline.ts +324 -0
  41. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-layout.ts +762 -0
  42. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-limits.ts +152 -0
  43. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +410 -0
  44. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +535 -0
  45. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +4 -4
  46. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-renderer.ts +21 -3219
  47. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-text.ts +44 -0
  48. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +568 -0
  49. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/index.ts +103 -48
  50. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +8 -7
  51. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +2 -1
  52. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +171 -196
  53. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/mcp-title.ts +39 -0
  54. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{message-display.ts → tool/message-display.ts} +27 -93
  55. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +429 -0
  56. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +259 -164
  57. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{show-more-hint.ts → tool/show-more-hint.ts} +10 -0
  58. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-refresh.ts +8 -26
  59. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-color.ts +44 -0
  60. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +77 -0
  61. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/component-tree.ts +34 -0
  62. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +28 -0
  63. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +51 -0
  64. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/patch-keys.ts +124 -0
  65. package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/sgr-mouse.ts +70 -0
  66. package/node_modules/@herbertgao/pi-cc-extensions/package.json +10 -8
  67. package/node_modules/@herbertgao/pi-subagents/CHANGELOG.md +6 -0
  68. package/node_modules/@herbertgao/pi-subagents/package.json +1 -1
  69. package/node_modules/@herbertgao/pi-subagents/src/mention-clone.ts +3 -2
  70. package/node_modules/@herbertgao/sol-pi/CONTRIBUTING.md +22 -0
  71. package/node_modules/@herbertgao/sol-pi/README.md +36 -17
  72. package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +10 -6
  73. package/node_modules/@herbertgao/sol-pi/agents-install.md +15 -12
  74. package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +24 -8
  75. package/node_modules/@herbertgao/sol-pi/docs/configuration.md +2 -2
  76. package/node_modules/@herbertgao/sol-pi/docs/star-history.md +18 -0
  77. package/node_modules/@herbertgao/sol-pi/package.json +4 -2
  78. package/node_modules/@herbertgao/sol-pi/scripts/check-sol-pi-config.mjs +1 -1
  79. package/node_modules/@herbertgao/sol-pi/src/sol-pi/config.ts +1 -1
  80. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/file-queue.ts +23 -4
  81. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/index.ts +32 -1
  82. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/action-fusion/then-run.ts +3 -2
  83. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/observation-pack/observation.ts +1 -1
  84. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/economics.ts +27 -7
  85. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/extension.ts +137 -41
  86. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/index.ts +1 -0
  87. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/plan.ts +2 -1
  88. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/projection.ts +58 -0
  89. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/state.ts +28 -6
  90. package/node_modules/@herbertgao/sol-pi/src/sol-pi/extensions/online-context-compact/tools.ts +2 -1
  91. package/node_modules/@herbertgao/sol-pi/src/sol-pi/runtime-paths.ts +15 -2
  92. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
  93. package/node_modules/@pi-plugins/fast-mode/README.md +7 -1
  94. package/node_modules/@pi-plugins/fast-mode/dist/index.d.mts.map +1 -1
  95. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs +7 -1
  96. package/node_modules/@pi-plugins/fast-mode/dist/index.mjs.map +1 -1
  97. package/node_modules/@pi-plugins/fast-mode/package.json +5 -5
  98. package/node_modules/pi-antigravity/README.md +3 -0
  99. package/node_modules/pi-antigravity/package.json +8 -8
  100. package/node_modules/pi-antigravity/src/auth/oauth.ts +6 -3
  101. package/node_modules/pi-antigravity/src/index.ts +114 -110
  102. package/node_modules/pi-antigravity/src/stream/stream.ts +1 -1
  103. package/node_modules/pi-antigravity/src/utils/util.ts +18 -1
  104. package/node_modules/pi-multi-account/CHANGELOG.md +20 -0
  105. package/node_modules/pi-multi-account/README.md +46 -8
  106. package/node_modules/pi-multi-account/config-file-transaction.ts +42 -0
  107. package/node_modules/pi-multi-account/index.ts +255 -269
  108. package/node_modules/pi-multi-account/model-pins.ts +36 -0
  109. package/node_modules/pi-multi-account/package.json +9 -7
  110. package/node_modules/pi-multi-account/slot-proxy-auth.ts +12 -2
  111. package/node_modules/pi-multi-account/slot-proxy.ts +27 -5
  112. package/node_modules/pi-web-access/CHANGELOG.md +17 -0
  113. package/node_modules/pi-web-access/README.md +6 -3
  114. package/node_modules/pi-web-access/brave-rate-limit.ts +170 -0
  115. package/node_modules/pi-web-access/brave.ts +28 -11
  116. package/node_modules/pi-web-access/dist/index.js +202 -33
  117. package/node_modules/pi-web-access/gemini-search.ts +2 -5
  118. package/node_modules/pi-web-access/index.ts +13 -7
  119. package/node_modules/pi-web-access/openai-search.ts +24 -10
  120. package/node_modules/pi-web-access/package.json +1 -1
  121. package/node_modules/pi-web-access/summary-review.ts +8 -2
  122. package/node_modules/{@herbertgao/resume-from → resume-from}/README.md +16 -12
  123. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/adapter.d.ts +0 -5
  124. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/adapter.js +2 -3
  125. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/contract.d.ts +2 -2
  126. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/reader.d.ts +3 -0
  127. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/reader.js +27 -15
  128. package/node_modules/{@herbertgao/resume-from/dist/adapters/codex → resume-from/dist/adapters/claude-code}/redaction.js +16 -3
  129. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/writer.d.ts +2 -4
  130. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/writer.js +1 -1
  131. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/contract.d.ts +2 -4
  132. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/index.js +1 -2
  133. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/read.d.ts +16 -0
  134. package/node_modules/resume-from/dist/adapters/codex/read.js +723 -0
  135. package/node_modules/{@herbertgao/resume-from/dist/adapters/pi → resume-from/dist/adapters/codex}/redaction.js +16 -3
  136. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/rollout.d.ts +44 -4
  137. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/rollout.js +88 -4
  138. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/write.d.ts +2 -2
  139. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/write.js +2 -2
  140. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/contract.d.ts +5 -1
  141. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/adapter.js +10 -6
  142. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/contract.d.ts +2 -2
  143. package/node_modules/{@herbertgao/resume-from/dist/adapters/claude-code → resume-from/dist/adapters/pi}/redaction.js +16 -3
  144. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/serialize.d.ts +2 -4
  145. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/serialize.js +2 -2
  146. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/render.d.ts +1 -1
  147. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/render.js +4 -4
  148. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/runner.js +2 -2
  149. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/contract.d.ts +2 -2
  150. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/command.js +31 -8
  151. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/wiring.d.ts +1 -1
  152. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/wiring.js +1 -2
  153. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/confirmation.d.ts +4 -1
  154. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/confirmation.js +2 -2
  155. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/contract.d.ts +8 -6
  156. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/contract.d.ts +10 -5
  157. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/finder.d.ts +2 -1
  158. package/node_modules/resume-from/dist/import/discovery/finder.js +269 -0
  159. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/contract.d.ts +3 -3
  160. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/lander.js +3 -3
  161. package/node_modules/resume-from/dist/import/pipeline.d.ts +28 -0
  162. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/pipeline.js +31 -11
  163. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/builder.d.ts +2 -2
  164. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/builder.js +9 -5
  165. package/node_modules/resume-from/dist/import/preview/warnings.d.ts +14 -0
  166. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/warnings.js +26 -20
  167. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/wiring.js +12 -2
  168. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/contract.d.ts +9 -3
  169. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/git.d.ts +4 -4
  170. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/git.js +7 -4
  171. package/node_modules/resume-from/dist/platform/repo/reader.d.ts +3 -0
  172. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/reader.js +60 -20
  173. package/node_modules/{@herbertgao/resume-from → resume-from}/dist/session/contract.d.ts +8 -1
  174. package/node_modules/{@herbertgao/resume-from → resume-from}/package.json +19 -32
  175. package/node_modules/{@herbertgao/resume-from → resume-from}/shims/pi/extensions/resume-from.js +2 -2
  176. package/package.json +18 -22
  177. package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +0 -101
  178. package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.svg +0 -101
  179. package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/welcome.webp +0 -0
  180. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/render-utils.ts +0 -5
  181. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/types.ts +0 -30
  182. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +0 -12
  183. package/node_modules/@herbertgao/resume-from/dist/adapters/codex/read.js +0 -270
  184. package/node_modules/@herbertgao/resume-from/dist/import/discovery/finder.js +0 -129
  185. package/node_modules/@herbertgao/resume-from/dist/import/pipeline.d.ts +0 -17
  186. package/node_modules/@herbertgao/resume-from/dist/import/preview/warnings.d.ts +0 -11
  187. package/node_modules/@herbertgao/resume-from/dist/platform/repo/reader.d.ts +0 -8
  188. package/node_modules/pi-footer/CHANGELOG.md +0 -145
  189. package/node_modules/pi-footer/LICENSE +0 -21
  190. package/node_modules/pi-footer/README.md +0 -354
  191. package/node_modules/pi-footer/package.json +0 -68
  192. package/node_modules/pi-footer/src/cache.ts +0 -106
  193. package/node_modules/pi-footer/src/colors.ts +0 -237
  194. package/node_modules/pi-footer/src/config.ts +0 -202
  195. package/node_modules/pi-footer/src/event-widgets.ts +0 -41
  196. package/node_modules/pi-footer/src/extension-statuses.ts +0 -102
  197. package/node_modules/pi-footer/src/git.ts +0 -135
  198. package/node_modules/pi-footer/src/index.ts +0 -268
  199. package/node_modules/pi-footer/src/metrics.ts +0 -141
  200. package/node_modules/pi-footer/src/presets.ts +0 -383
  201. package/node_modules/pi-footer/src/render.ts +0 -114
  202. package/node_modules/pi-footer/src/separators.ts +0 -52
  203. package/node_modules/pi-footer/src/types.ts +0 -122
  204. package/node_modules/pi-footer/src/ui/color-level-confirm.ts +0 -22
  205. package/node_modules/pi-footer/src/ui/color-options.ts +0 -195
  206. package/node_modules/pi-footer/src/ui/config-lifecycle.ts +0 -61
  207. package/node_modules/pi-footer/src/ui/edit-colors.ts +0 -13
  208. package/node_modules/pi-footer/src/ui/events.ts +0 -35
  209. package/node_modules/pi-footer/src/ui/extension-status-picker.ts +0 -60
  210. package/node_modules/pi-footer/src/ui/extension-statuses.ts +0 -73
  211. package/node_modules/pi-footer/src/ui/fields.ts +0 -252
  212. package/node_modules/pi-footer/src/ui/global-menu.ts +0 -126
  213. package/node_modules/pi-footer/src/ui/helpers.ts +0 -44
  214. package/node_modules/pi-footer/src/ui/layout.ts +0 -17
  215. package/node_modules/pi-footer/src/ui/line-list.ts +0 -19
  216. package/node_modules/pi-footer/src/ui/model.ts +0 -64
  217. package/node_modules/pi-footer/src/ui/navigation.ts +0 -29
  218. package/node_modules/pi-footer/src/ui/option-edit.ts +0 -93
  219. package/node_modules/pi-footer/src/ui/overlay-render.ts +0 -103
  220. package/node_modules/pi-footer/src/ui/screen-context.ts +0 -18
  221. package/node_modules/pi-footer/src/ui/screen-controller.ts +0 -27
  222. package/node_modules/pi-footer/src/ui/screen-render.ts +0 -32
  223. package/node_modules/pi-footer/src/ui/screen-state.ts +0 -20
  224. package/node_modules/pi-footer/src/ui/screen.ts +0 -243
  225. package/node_modules/pi-footer/src/ui/screens/add-widget.ts +0 -92
  226. package/node_modules/pi-footer/src/ui/screens/confirm-exit.ts +0 -52
  227. package/node_modules/pi-footer/src/ui/screens/controller.ts +0 -12
  228. package/node_modules/pi-footer/src/ui/screens/edit-colors.ts +0 -68
  229. package/node_modules/pi-footer/src/ui/screens/edit-widget.ts +0 -115
  230. package/node_modules/pi-footer/src/ui/screens/extension-status-row.ts +0 -61
  231. package/node_modules/pi-footer/src/ui/screens/global.ts +0 -75
  232. package/node_modules/pi-footer/src/ui/screens/line-list.ts +0 -108
  233. package/node_modules/pi-footer/src/ui/screens/main.ts +0 -99
  234. package/node_modules/pi-footer/src/ui/screens/terminal.ts +0 -121
  235. package/node_modules/pi-footer/src/ui/screens/widget-list.ts +0 -154
  236. package/node_modules/pi-footer/src/ui/terminal-menu.ts +0 -32
  237. package/node_modules/pi-footer/src/ui/theme.ts +0 -48
  238. package/node_modules/pi-footer/src/ui/title-bar.ts +0 -100
  239. package/node_modules/pi-footer/src/ui/widget-actions.ts +0 -76
  240. package/node_modules/pi-footer/src/ui.ts +0 -66
  241. package/node_modules/pi-footer/src/widgets/context.ts +0 -28
  242. package/node_modules/pi-footer/src/widgets/core/active-tools.ts +0 -17
  243. package/node_modules/pi-footer/src/widgets/core/context-window.ts +0 -24
  244. package/node_modules/pi-footer/src/widgets/core/cwd-basename.ts +0 -19
  245. package/node_modules/pi-footer/src/widgets/core/cwd.ts +0 -108
  246. package/node_modules/pi-footer/src/widgets/core/event.ts +0 -34
  247. package/node_modules/pi-footer/src/widgets/core/external-status.ts +0 -102
  248. package/node_modules/pi-footer/src/widgets/core/model-provider.ts +0 -20
  249. package/node_modules/pi-footer/src/widgets/core/model.ts +0 -35
  250. package/node_modules/pi-footer/src/widgets/core/provider.ts +0 -17
  251. package/node_modules/pi-footer/src/widgets/core/session-name.ts +0 -17
  252. package/node_modules/pi-footer/src/widgets/core/text-verbosity.ts +0 -17
  253. package/node_modules/pi-footer/src/widgets/core/thinking-level.ts +0 -17
  254. package/node_modules/pi-footer/src/widgets/git/ahead-behind.ts +0 -17
  255. package/node_modules/pi-footer/src/widgets/git/branch.ts +0 -81
  256. package/node_modules/pi-footer/src/widgets/git/clean.ts +0 -19
  257. package/node_modules/pi-footer/src/widgets/git/deletions.ts +0 -17
  258. package/node_modules/pi-footer/src/widgets/git/diff.ts +0 -38
  259. package/node_modules/pi-footer/src/widgets/git/insertions.ts +0 -17
  260. package/node_modules/pi-footer/src/widgets/git/remote.ts +0 -17
  261. package/node_modules/pi-footer/src/widgets/git/root.ts +0 -17
  262. package/node_modules/pi-footer/src/widgets/git/sha.ts +0 -17
  263. package/node_modules/pi-footer/src/widgets/git/staged.ts +0 -17
  264. package/node_modules/pi-footer/src/widgets/git/status.ts +0 -19
  265. package/node_modules/pi-footer/src/widgets/git/unstaged.ts +0 -17
  266. package/node_modules/pi-footer/src/widgets/git/untracked.ts +0 -17
  267. package/node_modules/pi-footer/src/widgets/instance.ts +0 -118
  268. package/node_modules/pi-footer/src/widgets/layout/custom-text.ts +0 -18
  269. package/node_modules/pi-footer/src/widgets/layout/flex-separator.ts +0 -32
  270. package/node_modules/pi-footer/src/widgets/layout/separator.ts +0 -57
  271. package/node_modules/pi-footer/src/widgets/layout/spacer.ts +0 -31
  272. package/node_modules/pi-footer/src/widgets/options.ts +0 -122
  273. package/node_modules/pi-footer/src/widgets/project/runtime.ts +0 -361
  274. package/node_modules/pi-footer/src/widgets/registry.ts +0 -223
  275. package/node_modules/pi-footer/src/widgets/session/assistant-messages.ts +0 -17
  276. package/node_modules/pi-footer/src/widgets/session/compactions.ts +0 -17
  277. package/node_modules/pi-footer/src/widgets/session/elapsed.ts +0 -18
  278. package/node_modules/pi-footer/src/widgets/session/last-activity.ts +0 -18
  279. package/node_modules/pi-footer/src/widgets/session/messages.ts +0 -19
  280. package/node_modules/pi-footer/src/widgets/session/session-id.ts +0 -17
  281. package/node_modules/pi-footer/src/widgets/session/session-start.ts +0 -18
  282. package/node_modules/pi-footer/src/widgets/session/tool-results.ts +0 -17
  283. package/node_modules/pi-footer/src/widgets/session/total-messages.ts +0 -19
  284. package/node_modules/pi-footer/src/widgets/session/total-time.ts +0 -18
  285. package/node_modules/pi-footer/src/widgets/session/user-messages.ts +0 -17
  286. package/node_modules/pi-footer/src/widgets/store.ts +0 -26
  287. package/node_modules/pi-footer/src/widgets/tokens/cache-hit-rate.ts +0 -55
  288. package/node_modules/pi-footer/src/widgets/tokens/cache-read.ts +0 -18
  289. package/node_modules/pi-footer/src/widgets/tokens/cache-write.ts +0 -18
  290. package/node_modules/pi-footer/src/widgets/tokens/context-bar.ts +0 -108
  291. package/node_modules/pi-footer/src/widgets/tokens/context-length.ts +0 -26
  292. package/node_modules/pi-footer/src/widgets/tokens/context-remaining.ts +0 -29
  293. package/node_modules/pi-footer/src/widgets/tokens/context.ts +0 -29
  294. package/node_modules/pi-footer/src/widgets/tokens/cost.ts +0 -51
  295. package/node_modules/pi-footer/src/widgets/tokens/input-speed.ts +0 -25
  296. package/node_modules/pi-footer/src/widgets/tokens/input-tokens.ts +0 -18
  297. package/node_modules/pi-footer/src/widgets/tokens/output-speed.ts +0 -25
  298. package/node_modules/pi-footer/src/widgets/tokens/output-tokens.ts +0 -18
  299. package/node_modules/pi-footer/src/widgets/tokens/tokens.ts +0 -20
  300. package/node_modules/pi-footer/src/widgets/tokens/total-speed.ts +0 -25
  301. package/node_modules/pi-footer/src/widgets/tokens/total-tokens.ts +0 -18
  302. package/node_modules/pi-footer/src/widgets/types.ts +0 -181
  303. package/node_modules/pi-footer/src/widgets/utils/colors.ts +0 -11
  304. package/node_modules/pi-footer/src/widgets/utils/context.ts +0 -112
  305. package/node_modules/pi-footer/src/widgets/utils/session.ts +0 -19
  306. package/node_modules/pi-footer/src/widgets/utils/token-format.ts +0 -78
  307. /package/node_modules/{@herbertgao/resume-from → resume-from}/LICENSE +0 -0
  308. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/contract.js +0 -0
  309. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/entries.d.ts +0 -0
  310. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/entries.js +0 -0
  311. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/index.d.ts +0 -0
  312. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/index.js +0 -0
  313. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/layout.d.ts +0 -0
  314. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/layout.js +0 -0
  315. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/readback.d.ts +0 -0
  316. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/readback.js +0 -0
  317. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/redaction.d.ts +0 -0
  318. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/validation.d.ts +0 -0
  319. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/claude-code/validation.js +0 -0
  320. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/contract.js +0 -0
  321. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/index.d.ts +0 -0
  322. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/readback.d.ts +0 -0
  323. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/readback.js +0 -0
  324. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/redaction.d.ts +0 -0
  325. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/validation.d.ts +0 -0
  326. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/codex/validation.js +0 -0
  327. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/contract.js +0 -0
  328. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/adapter.d.ts +0 -0
  329. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/contract.js +0 -0
  330. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/format.d.ts +0 -0
  331. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/format.js +0 -0
  332. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/index.d.ts +0 -0
  333. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/index.js +0 -0
  334. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/parse.d.ts +0 -0
  335. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/parse.js +0 -0
  336. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/redaction.d.ts +0 -0
  337. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/validate.d.ts +0 -0
  338. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/adapters/pi/validate.js +0 -0
  339. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/bin.d.ts +0 -0
  340. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/bin.js +0 -0
  341. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/contract.d.ts +0 -0
  342. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/contract.js +0 -0
  343. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/agents.d.ts +0 -0
  344. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/agents.js +0 -0
  345. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/args.d.ts +0 -0
  346. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/args.js +0 -0
  347. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/contract.d.ts +0 -0
  348. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/contract.js +0 -0
  349. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/index.d.ts +0 -0
  350. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/index.js +0 -0
  351. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/presentation.d.ts +0 -0
  352. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/presentation.js +0 -0
  353. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/cli/runner.d.ts +0 -0
  354. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/contract.js +0 -0
  355. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/entry.d.ts +0 -0
  356. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/entry.js +0 -0
  357. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/index.d.ts +0 -0
  358. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/index.js +0 -0
  359. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/command.d.ts +0 -0
  360. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/contract.d.ts +0 -0
  361. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/contract.js +0 -0
  362. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/index.d.ts +0 -0
  363. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/index.js +0 -0
  364. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/picker.d.ts +0 -0
  365. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/picker.js +0 -0
  366. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/presentation.d.ts +0 -0
  367. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/presentation.js +0 -0
  368. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/register.d.ts +0 -0
  369. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/register.js +0 -0
  370. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/ui.d.ts +0 -0
  371. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/pi-extension/ui.js +0 -0
  372. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/profile.d.ts +0 -0
  373. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/profile.js +0 -0
  374. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/registry.d.ts +0 -0
  375. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/host/registry.js +0 -0
  376. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/contract.js +0 -0
  377. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/contract.js +0 -0
  378. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/errors.d.ts +0 -0
  379. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/errors.js +0 -0
  380. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/homes.d.ts +0 -0
  381. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/homes.js +0 -0
  382. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/index.d.ts +0 -0
  383. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/index.js +0 -0
  384. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/ordering.d.ts +0 -0
  385. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/discovery/ordering.js +0 -0
  386. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/errors.d.ts +0 -0
  387. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/errors.js +0 -0
  388. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/index.d.ts +0 -0
  389. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/index.js +0 -0
  390. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/contract.js +0 -0
  391. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/errors.d.ts +0 -0
  392. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/errors.js +0 -0
  393. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/handover.d.ts +0 -0
  394. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/handover.js +0 -0
  395. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/index.d.ts +0 -0
  396. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/index.js +0 -0
  397. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/lander.d.ts +0 -0
  398. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/marker.d.ts +0 -0
  399. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/landing/marker.js +0 -0
  400. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/contract.d.ts +0 -0
  401. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/contract.js +0 -0
  402. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/format.d.ts +0 -0
  403. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/format.js +0 -0
  404. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/index.d.ts +0 -0
  405. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/preview/index.js +0 -0
  406. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/contract.d.ts +0 -0
  407. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/contract.js +0 -0
  408. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/index.d.ts +0 -0
  409. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/index.js +0 -0
  410. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/rules.d.ts +0 -0
  411. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/transfer/rules.js +0 -0
  412. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/import/wiring.d.ts +0 -0
  413. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/index.d.ts +0 -0
  414. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/index.js +0 -0
  415. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/contract.d.ts +0 -0
  416. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/contract.js +0 -0
  417. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/defaults.d.ts +0 -0
  418. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/defaults.js +0 -0
  419. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/errors.d.ts +0 -0
  420. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/errors.js +0 -0
  421. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/index.d.ts +0 -0
  422. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/index.js +0 -0
  423. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/loader.d.ts +0 -0
  424. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/loader.js +0 -0
  425. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/paths.d.ts +0 -0
  426. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/paths.js +0 -0
  427. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/validate.d.ts +0 -0
  428. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/config/validate.js +0 -0
  429. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/contract.js +0 -0
  430. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/index.d.ts +0 -0
  431. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/repo/index.js +0 -0
  432. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/contract.d.ts +0 -0
  433. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/contract.js +0 -0
  434. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/file-committer.d.ts +0 -0
  435. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/file-committer.js +0 -0
  436. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/index.d.ts +0 -0
  437. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/store/index.js +0 -0
  438. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/contract.d.ts +0 -0
  439. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/contract.js +0 -0
  440. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/estimator.d.ts +0 -0
  441. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/estimator.js +0 -0
  442. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/index.d.ts +0 -0
  443. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/platform/tokens/index.js +0 -0
  444. /package/node_modules/{@herbertgao/resume-from → resume-from}/dist/session/contract.js +0 -0
@@ -36,3 +36,13 @@ export function expandShortcutText(): string {
36
36
  export function showMoreHintText(): string {
37
37
  return isToolTuiFullscreen() ? "click to show more" : `${expandShortcutText()} to show more`;
38
38
  }
39
+
40
+ /** 展开卡的收起提示,与折叠态 showMoreHintText 同一位置对称。 */
41
+ export function collapseHintText(): string {
42
+ return isToolTuiFullscreen() ? "↑ Collapse" : `${expandShortcutText()} to collapse`;
43
+ }
44
+
45
+ /** 该行是否带展开态收起提示(用于展开卡的 hint hover 命中)。 */
46
+ export function isCollapseHintLine(plainLine: string): boolean {
47
+ return plainLine.includes(collapseHintText());
48
+ }
@@ -1,5 +1,7 @@
1
1
  import type { AssistantMessage } from "@earendil-works/pi-ai";
2
2
  import { AssistantMessageComponent, ToolExecutionComponent } from "@earendil-works/pi-coding-agent";
3
+ import { walkComponentTree } from "../utils/component-tree.ts";
4
+ import { COMPACT_MODE_PATCH_KEY, patchRegistry } from "../utils/patch-keys.ts";
3
5
 
4
6
  // pi-coding-agent 类型声明中 AssistantMessageComponent 仅能以 value 形式使用,
5
7
  // updateContent/lastMessage 用结构化类型访问。
@@ -37,8 +39,6 @@ export function refreshTranscriptComponent(value: unknown): boolean {
37
39
  * 遍历 value.children 与 value.getMountedRoots?.()(seen 集合防环),
38
40
  * 单个组件失败用 try/catch 隔离,不影响其余组件。
39
41
  */
40
- // compact-mode 把补丁暴露在此 Symbol 上(见 compact-mode.ts),避免循环依赖。
41
- const COMPACT_MODE_PATCH_KEY = Symbol.for("pi.ccstyle.compact-mode-patch");
42
42
 
43
43
  /**
44
44
  * 补丁链序不变量:compact 模式下 compact-mode 必须位于 compact-thinking
@@ -48,8 +48,10 @@ const COMPACT_MODE_PATCH_KEY = Symbol.for("pi.ccstyle.compact-mode-patch");
48
48
  */
49
49
  function assertCompactModeOutermost(): void {
50
50
  try {
51
- const patch = (globalThis as any)[COMPACT_MODE_PATCH_KEY];
52
- if (typeof patch?.assertAssistantOwnership === "function") {
51
+ const patch = patchRegistry.get<{ assertAssistantOwnership?: () => void }>(
52
+ COMPACT_MODE_PATCH_KEY,
53
+ );
54
+ if (patch && typeof patch.assertAssistantOwnership === "function") {
53
55
  patch.assertAssistantOwnership();
54
56
  }
55
57
  } catch {
@@ -61,31 +63,11 @@ export function refreshMountedTranscript(tui?: unknown): void {
61
63
  if (!tui || typeof (tui as any).getMountedRoots !== "function") return;
62
64
  // 先修正链序再重绘:扫描触发 updateContent 时 compact-mode 已在外层。
63
65
  assertCompactModeOutermost();
64
- const seen = new Set<object>();
65
- const visit = (value: any): void => {
66
- if (!value || typeof value !== "object" || seen.has(value)) return;
67
- seen.add(value);
68
- if (Array.isArray(value)) {
69
- for (const child of value) visit(child);
70
- return;
71
- }
66
+ walkComponentTree(tui, (value: any) => {
72
67
  try {
73
68
  refreshTranscriptComponent(value);
74
69
  } catch {
75
70
  // 单个组件失败不阻断其余组件;后续 session_tree/重绘再试。
76
71
  }
77
- const children = value.children;
78
- if (Array.isArray(children)) {
79
- for (const child of children) visit(child);
80
- }
81
- try {
82
- const mounted = value.getMountedRoots?.();
83
- if (Array.isArray(mounted)) {
84
- for (const root of mounted) visit(root);
85
- }
86
- } catch {
87
- // 惰性 Proxy / 未挂载容器没有 mounted roots。
88
- }
89
- };
90
- visit(tui);
72
+ });
91
73
  }
@@ -0,0 +1,44 @@
1
+ /** ANSI 16 色 → RGB(标准 xterm 色序)。 */
2
+ const ANSI_16_RGB: readonly [number, number, number][] = [
3
+ [0, 0, 0],
4
+ [128, 0, 0],
5
+ [0, 128, 0],
6
+ [128, 128, 0],
7
+ [0, 0, 128],
8
+ [128, 0, 128],
9
+ [0, 128, 128],
10
+ [192, 192, 192],
11
+ [128, 128, 128],
12
+ [255, 0, 0],
13
+ [0, 255, 0],
14
+ [255, 255, 0],
15
+ [0, 0, 255],
16
+ [255, 0, 255],
17
+ [0, 255, 255],
18
+ [255, 255, 255],
19
+ ];
20
+
21
+ /** ANSI 16 色码(0-15)→ RGB;越界回退白。 */
22
+ export function ansi16ToRgb(index: number): [number, number, number] {
23
+ return ANSI_16_RGB[index] ?? [255, 255, 255];
24
+ }
25
+
26
+ /** ANSI 256 色码 → RGB(0-15 标准色 + 232-255 灰阶 + 16-231 六阶立方体)。 */
27
+ export function ansi256ToRgb(code: number): [number, number, number] {
28
+ // SGR 正则可解析任意位数字,入口先规范:取整并钳制到合法区间,
29
+ // 否则灰阶分支对 code > 255 会算出超出 0-255 的非法 RGB。
30
+ if (!Number.isFinite(code)) return [0, 0, 0];
31
+ code = Math.min(255, Math.max(0, Math.trunc(code)));
32
+ if (code < 16) return ansi16ToRgb(code);
33
+ if (code >= 232) {
34
+ const gray = 8 + (code - 232) * 10;
35
+ return [gray, gray, gray];
36
+ }
37
+ const cubeIndex = code - 16;
38
+ const levels = [0, 95, 135, 175, 215, 255];
39
+ return [
40
+ levels[Math.floor(cubeIndex / 36)]!,
41
+ levels[Math.floor((cubeIndex % 36) / 6)]!,
42
+ levels[cubeIndex % 6]!,
43
+ ];
44
+ }
@@ -0,0 +1,77 @@
1
+ /**
2
+ * 顶层共享的 ANSI/终端控制序列处理。
3
+ *
4
+ * 收敛原先散落在 renderer/grouping.ts / renderer/mouse/packets.ts /
5
+ * renderer/compact-mode.ts 的重复剥离逻辑,供 renderer 与 feature 共用。
6
+ */
7
+
8
+ /** 单个 CSI 序列(颜色、光标等 SGR/CUP/ED 等)。 */
9
+ const CSI_SEQUENCE_RE = /\x1b\[[0-?]*[ -/]*[@-~]/g;
10
+ /** OSC 序列(如 \x1b]8;;url\x07 或 ST 结尾)。 */
11
+ const OSC_SEQUENCE_RE = /\x1b\][^\x07]*(?:\x07|\x1b\\)/g;
12
+ /** compact-mode 原有 hasVisibleText 用的更严格 OSC(内容不允许内嵌 ESC)。 */
13
+ const OSC_SEQUENCE_STRICT_RE = /\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)/g;
14
+
15
+ /** 剥离一行内所有 CSI 序列。 */
16
+ export function stripAnsi(line: string): string {
17
+ return line.replace(CSI_SEQUENCE_RE, "");
18
+ }
19
+
20
+ /** 仅剥离终端序列、保留原布局(换行/空白不动),用于命中区间计算。 */
21
+ export function stripTerminalSequencesPreservingLayout(value: string): string {
22
+ return value.replace(OSC_SEQUENCE_RE, "").replace(CSI_SEQUENCE_RE, "");
23
+ }
24
+
25
+ /** 剥离终端序列并折叠空白(用于纯文本比较)。 */
26
+ export function stripTerminalSequences(value: string): string {
27
+ return stripTerminalSequencesPreservingLayout(value).replace(/\s+/g, " ").trim();
28
+ }
29
+
30
+ /** 去掉行内所有 CSI/OSC 序列后是否仍有可见文本(判断工具卡首尾内容行)。 */
31
+ export function hasVisibleText(line: string): boolean {
32
+ // OSC 用更严格的变体:内容内嵌 ESC 时不吞并后续文本,保持 compact-mode 原有语义。
33
+ return line.replace(CSI_SEQUENCE_RE, "").replace(OSC_SEQUENCE_STRICT_RE, "").trim().length > 0;
34
+ }
35
+
36
+ /** 剥离背景色 ANSI(用于重新铺背景行)。 */
37
+ export function stripBackgroundAnsi(line: string): string {
38
+ return line.replace(/\x1b\[(?:4[0-9]|10[0-7]|48(?:(?:;|:)[0-9]+)+|49)m/g, "");
39
+ }
40
+
41
+ /** 剥离行首状态图标(展开组内工具首行复用)。 */
42
+ export function stripLeadingStatusIcon(line: string): string {
43
+ return line.replace(
44
+ // 行首图标:ccstyle 用 `·`,pi 原生输出里还有 `•`,两种都要剥
45
+ /^((?:\x1b\[[0-9;]*m|[ \t]|[├└│─])*)(?:\x1b\[[0-9;]*m)*(?:[✓✗●○■⬤•·])(?:\x1b\[[0-9;]*m)*\s+/,
46
+ "$1",
47
+ );
48
+ }
49
+
50
+ /** 终端序列零宽(不计入 plain 下标),与 stripAnsi/stripTerminalSequencesPreservingLayout 一致。 */
51
+ const ANY_SEQUENCE_RE = new RegExp(`${CSI_SEQUENCE_RE.source}|${OSC_SEQUENCE_RE.source}`, "g");
52
+
53
+ /** 只保留 [start, end) 之外的字符(base 为 text 首字符在 plain 串中的下标)。 */
54
+ function keepOutsideRange(text: string, base: number, start: number, end: number): string {
55
+ if (base + text.length <= start || base >= end) return text;
56
+ return text.slice(0, Math.max(0, start - base)) + text.slice(Math.max(0, end - base));
57
+ }
58
+
59
+ /**
60
+ * 删除 plain 区间 [start, end) 的字符,保留其余字符的 ANSI 样式。
61
+ * 区间内的终端序列原样保留,因此区间后的字符(如收尾括号)沿用前文颜色,
62
+ * 不会像截断后拼纯文本那样掉回终端默认前景色。
63
+ */
64
+ export function removeStyledRange(styled: string, start: number, end: number): string {
65
+ if (end <= start) return styled;
66
+ let plain = 0;
67
+ let cursor = 0;
68
+ let out = "";
69
+ for (const match of styled.matchAll(ANY_SEQUENCE_RE)) {
70
+ const text = styled.slice(cursor, match.index);
71
+ out += keepOutsideRange(text, plain, start, end);
72
+ plain += text.length;
73
+ out += match[0];
74
+ cursor = match.index + match[0].length;
75
+ }
76
+ return out + keepOutsideRange(styled.slice(cursor), plain, start, end);
77
+ }
@@ -0,0 +1,34 @@
1
+ /**
2
+ * 组件树递归遍历共享实现。
3
+ *
4
+ * 收敛原先散落在 renderer 的 compact-mode / message-display / transcript-refresh /
5
+ * grouping / mouse/packets 的「children + getMountedRoots + seen 防环」同款遍历。
6
+ *
7
+ * visitor 在每个非数组对象节点上调用一次;返回 `false` 表示不再下钻该节点的
8
+ * children 与 mounted roots(对应各处原有的提前 return 语义)。
9
+ */
10
+ export function walkComponentTree(root: any, visitor: (value: any) => boolean | void): void {
11
+ const seen = new Set<any>();
12
+ const visit = (value: any): void => {
13
+ if (!value || typeof value !== "object" || seen.has(value)) return;
14
+ seen.add(value);
15
+ if (Array.isArray(value)) {
16
+ for (const child of value) visit(child);
17
+ return;
18
+ }
19
+ if (visitor(value) === false) return;
20
+ const children = value.children;
21
+ if (Array.isArray(children)) {
22
+ for (const child of children) visit(child);
23
+ }
24
+ try {
25
+ const mounted = value.getMountedRoots?.();
26
+ if (Array.isArray(mounted)) {
27
+ for (const root of mounted) visit(root);
28
+ }
29
+ } catch {
30
+ // renderer 切换中的惰性 Proxy 可能暂时没有 mounted roots。
31
+ }
32
+ };
33
+ visit(root);
34
+ }
@@ -0,0 +1,28 @@
1
+ import { truncateToWidth, visibleWidth } from "@earendil-works/pi-tui";
2
+ import { sanitizeToolResultText } from "./tool-result-sanitize.ts";
3
+
4
+ /** 毫秒 → "1h 2m 3s"/"2m 3s"/"3s";低于 1 秒返回 ""(省略)。 */
5
+ export function formatDuration(ms: number): string {
6
+ const totalSec = Math.floor(ms / 1000);
7
+ if (totalSec < 1) return "";
8
+ const hours = Math.floor(totalSec / 3600);
9
+ const minutes = Math.floor((totalSec % 3600) / 60);
10
+ const seconds = totalSec % 60;
11
+ if (hours > 0) return `${hours}h ${minutes}m ${seconds}s`;
12
+ if (minutes > 0) return `${minutes}m ${seconds}s`;
13
+ return `${seconds}s`;
14
+ }
15
+
16
+ /** 文本单行化:去换行空白,超宽截断加省略号。 */
17
+ export function oneLine(value: unknown, max = 96): string {
18
+ const text = sanitizeToolResultText(String(value ?? ""), 4096)
19
+ .replace(/\s+/g, " ")
20
+ .trim();
21
+ return text.length > max ? `${text.slice(0, max - 1)}…` : text;
22
+ }
23
+
24
+ /** 把一行文本补齐到固定可见宽度,超宽时截断并追加省略号。 */
25
+ export function padLine(text: string, width: number): string {
26
+ const truncated = truncateToWidth(text, width, "…");
27
+ return truncated + " ".repeat(Math.max(0, width - visibleWidth(truncated)));
28
+ }
@@ -1,3 +1,6 @@
1
+ import { TuiMainScreen } from "@earendil-works/pi-tui";
2
+ import { MAIN_SCREEN_DO_RENDER_PATCH, patchRegistry } from "./patch-keys.ts";
3
+
1
4
  /**
2
5
  * 官方 0.84+ 的 tui 引用是惰性 Proxy(createInteractiveTuiReference):
3
6
  * 函数属性每次 get 都返回新包装,执行时才解析到当前实现。
@@ -9,3 +12,51 @@ export function isLazyProxyTui(tui: any): boolean {
9
12
  const probe = tui.requestRender;
10
13
  return typeof probe === "function" && probe !== tui.requestRender;
11
14
  }
15
+
16
+ type MainScreenDoRenderPatch = {
17
+ active: boolean;
18
+ original: (lines: string[]) => string[];
19
+ installed: (lines: string[]) => string[];
20
+ };
21
+
22
+ /**
23
+ * regular(TuiMainScreen)模式的 doRender 走差分绘制:一旦第一个变化行落在
24
+ * previousViewportTop 之上(终端写不进 scrollback 的区域),只能
25
+ * fullRender(true)——\x1b[2J\x1b[H\x1b[3J 清屏并清掉整段 scrollback。
26
+ * compact 直播式回合的摘要行动画与流式正文渲染在回合工具卡/diff 面板上方;
27
+ * diff 面板一落地把下方内容撑过屏高,之后每帧重绘都命中该分支:scrollback
28
+ * 被反复清空,滚动条回弹、视口钉住,直到输出结束才恢复。
29
+ *
30
+ * 视口上方的行本就无法重写,只剩「清回滚重打」与「scrollback 保留旧文本」
31
+ * 两条路。这里选后者:applyLineResets 是差分比较前最后一个拿到整帧的环节,
32
+ * 把 previousLines 的视口上方前缀直接对齐新帧,差分只看到可写区域,照常增量
33
+ * 绘制。代价仅是 scrollback 里那几行停留在最后一次实际写入的内容。
34
+ */
35
+ export function installMainScreenDoRenderPatch(): void {
36
+ const prototype = TuiMainScreen.prototype as any;
37
+ if (typeof prototype?.applyLineResets !== "function") return;
38
+ const previous = patchRegistry.get<MainScreenDoRenderPatch>(MAIN_SCREEN_DO_RENDER_PATCH);
39
+ if (previous) previous.active = false;
40
+ const original =
41
+ previous && prototype.applyLineResets === previous.installed
42
+ ? previous.original
43
+ : prototype.applyLineResets;
44
+ const patch: MainScreenDoRenderPatch = {
45
+ active: true,
46
+ original,
47
+ installed(this: any, lines: string[]) {
48
+ const result = original.call(this, lines);
49
+ if (!patch.active) return result;
50
+ const prev = this.previousLines;
51
+ if (!Array.isArray(prev)) return result;
52
+ const top = Math.min(
53
+ Math.max(0, Math.floor(Number(this.previousViewportTop) || 0)),
54
+ result.length,
55
+ );
56
+ for (let i = 0; i < top; i++) prev[i] = result[i];
57
+ return result;
58
+ },
59
+ };
60
+ prototype.applyLineResets = patch.installed;
61
+ patchRegistry.install(MAIN_SCREEN_DO_RENDER_PATCH, patch);
62
+ }
@@ -0,0 +1,124 @@
1
+ /**
2
+ * ccstyle 补丁所有权与跨模块协调键的单一来源(single source of truth)。
3
+ *
4
+ * 全部使用 Symbol.for(全局注册表):/reload 后新模块实例拿到的是同一个 symbol,
5
+ * 这是跨 reload 识别/让渡补丁所有权的关键。切勿把这些 Symbol.for 改成模块局部 Symbol。
6
+ *
7
+ * 两类用途:
8
+ * 1. globalThis 槽位:安装补丁时写 host[KEY] = patch,dispose 时按所有权判断还原。
9
+ * 2. 实例/函数标记:把补丁包装器或组件实例标记在某个 symbol 属性上,供跨模块识别。
10
+ *
11
+ * PatchRegistry 把第 1 类的读写收口为带所有权语义的 install/dispose 生命周期;
12
+ * 底层仍是 globalThis[symbol],因此外部(含测试)直接读 globalThis 槽不受影响。
13
+ */
14
+
15
+ // ── compact / compact-thinking 协调 ──
16
+ export const COMPACT_MODE_PATCH_KEY = Symbol.for("pi.ccstyle.compact-mode-patch");
17
+ export const COMPACT_THINKING_PATCH_KEY = Symbol.for("pi.ccstyle.compact-thinking-update");
18
+ export const PROTOTYPE_ORIGINAL_KEY = Symbol.for("pi.ccstyle.prototype-original");
19
+ export const COMPACT_THINKING_OWNER = Symbol.for("pi.ccstyle.compact-thinking-owner");
20
+
21
+ // ── assistant 展开状态(实例标记) ──
22
+ export const ASSISTANT_SET_EXPANDED_KEY = Symbol.for("pi.ccstyle.compact-assistant-set-expanded");
23
+ export const ASSISTANT_TOGGLE_ROUND_KEY = Symbol.for("pi.ccstyle.compact-assistant-toggle-round");
24
+ export const ASSISTANT_REENTRY_KEY = Symbol.for("pi.ccstyle.compact-assistant-reentry");
25
+
26
+ // ── 工具渲染补丁 ──
27
+ export const GLOBAL_TOOL_RENDER_PATCH = Symbol.for("pi.ccstyle.global-tool-render-patch");
28
+ export const COMPONENT_TOOL_RENDER_MODE = Symbol.for("pi.ccstyle.component-tool-render-mode");
29
+ export const TOOL_EXPANDED_BACKGROUND_PATCH = Symbol.for(
30
+ "pi.ccstyle.tool-expanded-background-patch",
31
+ );
32
+ // write 归属:注册期确认一次,渲染期据此决定是否提供 rich diff。
33
+ export const WRITE_OWNERSHIP_SLOT = Symbol.for("pi.ccstyle.write-ownership");
34
+
35
+ // ── 消息组件补丁 ──
36
+ export const MESSAGE_DISPLAY_PATCH = Symbol.for("pi.ccstyle.message-display-patch");
37
+
38
+ // ── 工具分组 ──
39
+ export const TOOL_GROUPING_PATCH_KEY = Symbol.for("pi.ccstyle.tool-grouping-patch");
40
+ export const TOOL_GROUPING_PARENT_KEY = Symbol.for("pi.ccstyle.tool-grouping-parent");
41
+ export const TOOL_GROUPING_GENERATION_KEY = Symbol.for("pi.ccstyle.tool-grouping-generation");
42
+
43
+ // ── regular 主屏渲染补丁 ──
44
+ export const MAIN_SCREEN_DO_RENDER_PATCH = Symbol.for("pi.ccstyle.main-screen-do-render-patch");
45
+
46
+ // ── 鼠标交互 ──
47
+ export const TOOL_MOUSE_OWNER_KEY = Symbol.for("pi.ccstyle.tool-mouse-owner");
48
+ export const TOOL_MOUSE_TUI_SLOT = Symbol.for("pi.ccstyle.tool-mouse-tui");
49
+ export const SCROLL_BUTTON_STATE_SLOT = Symbol.for("pi.ccstyle.scroll-button-state");
50
+ export const OFFICIAL_SCROLL_TO_END_KEY = Symbol.for("pi.ccstyle.official-scroll-to-end");
51
+ export const FLUSH_DOCKED_BASH_PATCH = Symbol.for("pi.ccstyle.flush-docked-bash-patch");
52
+ export const EARLY_STARTUP_HEADER_PATCH = Symbol.for("pi.ccstyle.early-startup-header-patch");
53
+ export const EARLY_STARTUP_HEADER_SWAP_KEY = Symbol.for("pi.ccstyle.early-startup-header-swap");
54
+ export const TOOL_HOVER_STATE_KEY = Symbol.for("pi.ccstyle.tool-hover-state");
55
+
56
+ // ── rich diff 组件标记 ──
57
+ export const RICH_DIFF_COMPONENT = Symbol.for("pi.ccstyle.rich-diff-component");
58
+
59
+ // ── PatchRegistry:所有权生命周期统一收口 ──
60
+
61
+ /**
62
+ * host 上的补丁槽位读写器。把散落各处的
63
+ * `host[KEY] = patch` / `if (host[KEY] === patch) delete host[KEY]` 收口为
64
+ * 带所有权语义的 install/dispose 生命周期:
65
+ *
66
+ * - install:覆盖写入并返回被替换的旧值(不自动让旧值失效——部分安装器
67
+ * 需要先读旧补丁以链接下游方法,由调用方决定如何 inactivate)。
68
+ * - dispose:所有权守卫删除——仅当槽位仍 === 该值才删除,防止 /reload 后
69
+ * 旧模块误删新模块的补丁。
70
+ * - owns:判断槽位是否仍由某值持有(恒等比较)。
71
+ * - ensure:惰性状态槽(??= 语义),用于无所有权的跨模块共享状态。
72
+ */
73
+ export class PatchRegistry {
74
+ readonly host: Record<PropertyKey, unknown>;
75
+
76
+ constructor(
77
+ host: Record<PropertyKey, unknown> = globalThis as unknown as Record<PropertyKey, unknown>,
78
+ ) {
79
+ this.host = host;
80
+ }
81
+
82
+ /** 读取槽位当前值。 */
83
+ get<T = unknown>(key: symbol): T | undefined {
84
+ return this.host[key] as T | undefined;
85
+ }
86
+
87
+ /** 是否仍由 value 持有(恒等比较)。 */
88
+ owns(key: symbol, value: unknown): boolean {
89
+ return this.host[key] === value;
90
+ }
91
+
92
+ /** 覆盖写入并返回被替换的旧值;不自动让旧值失效。 */
93
+ install<T = unknown>(key: symbol, value: T): T | undefined {
94
+ const previous = this.host[key] as T | undefined;
95
+ this.host[key] = value;
96
+ return previous;
97
+ }
98
+
99
+ /** 所有权守卫删除:仅当槽位仍 === value 时删除。返回是否删除。 */
100
+ dispose(key: symbol, value: unknown): boolean {
101
+ if (!this.owns(key, value)) return false;
102
+ delete this.host[key];
103
+ return true;
104
+ }
105
+
106
+ /** 惰性槽位:无值(null/undefined)时用 init() 初始化并缓存。 */
107
+ ensure<T>(key: symbol, init: () => T): T {
108
+ const current = this.host[key];
109
+ if (current !== null && current !== undefined) return current as T;
110
+ const value = init();
111
+ this.host[key] = value;
112
+ return value;
113
+ }
114
+
115
+ /** 无条件删除槽位(不判断所有权)。返回是否实际删除了键。 */
116
+ delete(key: symbol): boolean {
117
+ if (!(key in this.host)) return false;
118
+ delete this.host[key];
119
+ return true;
120
+ }
121
+ }
122
+
123
+ /** 全局单例:host 固定为 globalThis,跨 /reload 与 jiti 重载稳定。 */
124
+ export const patchRegistry = new PatchRegistry();
@@ -0,0 +1,70 @@
1
+ /**
2
+ * SGR 鼠标协议解析(共享)。
3
+ *
4
+ * 收敛 feature/_util.ts 的单包解析与 renderer/mouse/packets.ts 的批量解析。
5
+ */
6
+
7
+ /** SGR 鼠标协议包(code;col;row + M/m 终结符)。 */
8
+ export type SgrMousePacket = {
9
+ code: number;
10
+ col: number;
11
+ row: number;
12
+ final: "M" | "m";
13
+ };
14
+
15
+ /** 解析单个完整 SGR 鼠标包(整段数据必须恰好是一个包)。 */
16
+ export function parseSgrMousePacket(data: string): SgrMousePacket | null {
17
+ const match = data.match(/^\x1b\[<(\d+);(\d+);(\d+)([Mm])$/);
18
+ if (!match) return null;
19
+ return {
20
+ code: Number(match[1]),
21
+ col: Number(match[2]),
22
+ row: Number(match[3]),
23
+ final: match[4] as "M" | "m",
24
+ };
25
+ }
26
+
27
+ /**
28
+ * 解析整段终端输入为 SGR 鼠标包序列;数据必须完全由连续 SGR 包组成
29
+ * (夹杂其他字节返回 null,交由常规输入链处理)。
30
+ */
31
+ export function parseSgrMousePackets(data: string): SgrMousePacket[] | null {
32
+ const pattern = /\x1b\[<(\d+);(\d+);(\d+)([Mm])/g;
33
+ const packets: SgrMousePacket[] = [];
34
+ let offset = 0;
35
+
36
+ for (const match of data.matchAll(pattern)) {
37
+ if (match.index !== offset) return null;
38
+ offset = match.index + match[0].length;
39
+ packets.push({
40
+ code: Number(match[1]),
41
+ col: Number(match[2]),
42
+ row: Number(match[3]),
43
+ final: match[4] as "M" | "m",
44
+ });
45
+ }
46
+
47
+ return packets.length > 0 && offset === data.length ? packets : null;
48
+ }
49
+
50
+ /** 是否为左键按下(排除修饰键、32 表示 motion 事件)。 */
51
+ export function isSgrLeftPress(packet: SgrMousePacket): boolean {
52
+ const baseButton = mouseBaseButton(packet.code);
53
+ return packet.final === "M" && baseButton === 0 && (packet.code & 32) === 0;
54
+ }
55
+
56
+ /** 是否为左键松开。 */
57
+ export function isSgrLeftRelease(packet: SgrMousePacket): boolean {
58
+ const baseButton = mouseBaseButton(packet.code);
59
+ return packet.final === "m" && baseButton === 0 && (packet.code & 32) === 0;
60
+ }
61
+
62
+ /** 无按键按住的指针移动(DECSET 1003 的 35)。左键拖动(32,文本选区)不是 hover。 */
63
+ export function isSgrIdleMotion(packet: SgrMousePacket): boolean {
64
+ return packet.final === "M" && (packet.code & 32) !== 0 && mouseBaseButton(packet.code) === 3;
65
+ }
66
+
67
+ /** 剥离修饰键位(4/8/16/32:shift/meta/ctrl/motion),得到基础按键码。 */
68
+ export function mouseBaseButton(code: number): number {
69
+ return code & ~(4 | 8 | 16 | 32);
70
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-cc-extensions",
3
- "version": "0.9.7",
3
+ "version": "0.11.0",
4
4
  "license": "MIT",
5
5
  "description": "A Pi productivity suite with Claude Code-style UI, context inspection, and agent/session references",
6
6
  "type": "module",
@@ -36,12 +36,14 @@
36
36
  "./themes/cc-dark.json",
37
37
  "./themes/cc-light.json"
38
38
  ],
39
- "image": "https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-cc-extensions/assets/readme/welcome.webp",
40
- "video": "https://github.com/user-attachments/assets/debf76ea-a9dc-4f34-977f-aae344a9a7f8"
39
+ "image": "https://raw.githubusercontent.com/HerbertGao/pi-extensions/master/packages/pi-cc-extensions/assets/readme/preview.webp",
40
+ "video": "https://github.com/minuque/pi-cc-extensions/releases/download/v0.9.4/demo.mp4"
41
41
  },
42
42
  "scripts": {
43
- "test": "node --test tests/**/*.test.ts",
44
- "typecheck": "node scripts/typecheck.mjs",
43
+ "test": "node scripts/test.mjs",
44
+ "coverage": "node scripts/test.mjs --experimental-test-coverage --test-coverage-include=extensions/**/*.ts",
45
+ "docs:tool-render": "node --experimental-strip-types scripts/generate-tool-render-examples.ts",
46
+ "typecheck": "tsc --noEmit",
45
47
  "format": "biome format --write .",
46
48
  "format:check": "biome format ."
47
49
  },
@@ -69,9 +71,9 @@
69
71
  },
70
72
  "x-upstream": {
71
73
  "package": "pi-cc-extensions",
72
- "version": "0.8.71",
73
- "reviewedVersion": "0.9.9",
74
+ "version": "0.9.10",
75
+ "reviewedVersion": "0.9.10",
74
76
  "repository": "https://github.com/minuque/pi-cc-extensions",
75
- "commit": "e43e0041b59f5d7f03be9b9d103a5f9e954e4c11"
77
+ "commit": "2b72669cafefe0771b2e3e63b0db5c478314d2d4"
76
78
  }
77
79
  }
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.18.5
4
+
5
+ ### Patch Changes
6
+
7
+ - [#258](https://github.com/HerbertGao/pi-extensions/pull/258) [`4f505b1`](https://github.com/HerbertGao/pi-extensions/commit/4f505b1456c5ea766121ee915f14ad29e48973e7) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Keep Pi 1.x tool-call capabilities when starting a mentioned agent through a conversation clone, while preserving attribution to the main session.
8
+
3
9
  ## 0.18.4
4
10
 
5
11
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-subagents",
3
- "version": "0.18.4",
3
+ "version": "0.18.5",
4
4
  "description": "Claude Code-style autonomous subagents and workflow orchestration for Pi, with HerbertGao-maintained UI extensions.",
5
5
  "keywords": [
6
6
  "agent",
@@ -108,7 +108,7 @@ export async function runMentionClone(
108
108
  let spawned = false
109
109
  const cloneAgentTool: ToolDefinition = {
110
110
  ...agentTool,
111
- execute: (_cloneToolCallId, params, signal, onUpdate, _cloneCtx) => {
111
+ execute: (_cloneToolCallId, params, signal, onUpdate, cloneCtx) => {
112
112
  // One spawn per mention. The clone has a single tool and every reason to
113
113
  // stop after using it, but a model that decides to "also" launch a second
114
114
  // agent would do it where nobody can see and nobody asked.
@@ -138,7 +138,8 @@ export async function runMentionClone(
138
138
  } as typeof params,
139
139
  signal,
140
140
  onUpdate,
141
- ctx,
141
+ // Keep Pi's tool-call capabilities, but attribute the spawn to the main session.
142
+ { ...ctx, tools: cloneCtx.tools, executeTool: cloneCtx.executeTool },
142
143
  )
143
144
  },
144
145
  }
@@ -0,0 +1,22 @@
1
+ # Contributing
2
+
3
+ We welcome external pull requests that improve token efficiency and reduce token cost through Pi-compatible extensions.
4
+
5
+ ## Pull Request Requirements
6
+
7
+ Your PR should:
8
+
9
+ - Implement a Pi-compatible extension using Pi's public extension APIs, without modifying Pi's core.
10
+ - Be tested before submission, with relevant automated tests and reproducible validation steps.
11
+ - Clearly explain how the extension reduces token cost or improves token efficiency, including local measurements where available.
12
+ - Document its configuration, expected behavior, and any trade-offs. Efficiency improvements will be evaluated alongside correctness and task performance.
13
+
14
+ ## Benchmarking and Reports
15
+
16
+ Our team will help benchmark submitted extensions to evaluate token usage, model cost, and task performance.
17
+
18
+ We will publish updated benchmark reports on a regular reporting cycle, sharing evaluated changes, results, and any observed trade-offs.
19
+
20
+ ## Contributor Recognition
21
+
22
+ Authors of accepted PRs will be credited as Contributors in the project documentation and the relevant benchmark reports.