@herbertgao/pi-extensions 2026.8.15 → 2026.9.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 (59) hide show
  1. package/README.md +4 -1
  2. package/THIRD_PARTY_NOTICES.md +26 -0
  3. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +20 -0
  4. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +46 -3
  5. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +55 -17
  6. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +6 -0
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +5 -0
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +34 -30
  9. package/node_modules/@herbertgao/pi-cc-extensions/package.json +3 -3
  10. package/node_modules/@juicesharp/rpiv-ask-user-question/package.json +2 -2
  11. package/node_modules/@narumitw/pi-btw/README.md +5 -1
  12. package/node_modules/@narumitw/pi-btw/dist/index.ts +143 -14
  13. package/node_modules/@narumitw/pi-btw/dist/index.ts.map +3 -3
  14. package/node_modules/@narumitw/pi-btw/package.json +4 -4
  15. package/node_modules/@narumitw/pi-btw/src/fullscreen-ui.ts +158 -7
  16. package/node_modules/@narumitw/pi-btw/src/text.ts +18 -0
  17. package/node_modules/@narumitw/pi-btw/src/transcript-pager.ts +5 -16
  18. package/node_modules/@narumitw/pi-caffeinate/LICENSE +21 -0
  19. package/node_modules/@narumitw/pi-caffeinate/README.md +224 -0
  20. package/node_modules/@narumitw/pi-caffeinate/dist/index.ts +1112 -0
  21. package/node_modules/@narumitw/pi-caffeinate/dist/index.ts.map +7 -0
  22. package/node_modules/@narumitw/pi-caffeinate/package.json +53 -0
  23. package/node_modules/@narumitw/pi-caffeinate/src/caffeinate.ts +811 -0
  24. package/node_modules/@narumitw/pi-caffeinate/src/dbus-inhibit.ts +153 -0
  25. package/node_modules/@narumitw/pi-caffeinate/src/index.ts +1 -0
  26. package/node_modules/@narumitw/pi-caffeinate/src/inhibitor-process.ts +43 -0
  27. package/node_modules/@narumitw/pi-caffeinate/src/inhibitors.ts +167 -0
  28. package/node_modules/@narumitw/pi-caffeinate/src/settings.ts +202 -0
  29. package/node_modules/@tifan/pi-handoff/README.md +6 -3
  30. package/node_modules/@tifan/pi-handoff/package.json +1 -1
  31. package/node_modules/@tifan/pi-handoff/src/index.ts +8 -3
  32. package/node_modules/pi-mcp-adapter/CHANGELOG.md +27 -0
  33. package/node_modules/pi-mcp-adapter/README.md +13 -13
  34. package/node_modules/pi-mcp-adapter/commands.ts +58 -21
  35. package/node_modules/pi-mcp-adapter/config.ts +18 -4
  36. package/node_modules/pi-mcp-adapter/direct-tools.ts +26 -6
  37. package/node_modules/pi-mcp-adapter/dist/config.d.ts +4 -0
  38. package/node_modules/pi-mcp-adapter/dist/config.js +13 -4
  39. package/node_modules/pi-mcp-adapter/dist/config.js.map +1 -1
  40. package/node_modules/pi-mcp-adapter/dist/types.d.ts +11 -3
  41. package/node_modules/pi-mcp-adapter/dist/types.js.map +1 -1
  42. package/node_modules/pi-mcp-adapter/error-signal.ts +15 -4
  43. package/node_modules/pi-mcp-adapter/errors.ts +141 -0
  44. package/node_modules/pi-mcp-adapter/host-html-template.ts +58 -5
  45. package/node_modules/pi-mcp-adapter/index.ts +2 -3
  46. package/node_modules/pi-mcp-adapter/init.ts +5 -0
  47. package/node_modules/pi-mcp-adapter/mcp-panel.ts +30 -9
  48. package/node_modules/pi-mcp-adapter/mcp-setup-panel.ts +66 -28
  49. package/node_modules/pi-mcp-adapter/mcp-status.ts +2 -0
  50. package/node_modules/pi-mcp-adapter/package.json +2 -1
  51. package/node_modules/pi-mcp-adapter/proxy-modes.ts +66 -13
  52. package/node_modules/pi-mcp-adapter/sandbox-proxy-template.ts +217 -0
  53. package/node_modules/pi-mcp-adapter/server-manager.ts +337 -6
  54. package/node_modules/pi-mcp-adapter/skills/mcp-scripting/SKILL.md +1 -0
  55. package/node_modules/pi-mcp-adapter/types.ts +18 -3
  56. package/node_modules/pi-mcp-adapter/ui-resource-handler.ts +18 -2
  57. package/node_modules/pi-mcp-adapter/ui-server.ts +179 -54
  58. package/node_modules/pi-mcp-adapter/ui-session.ts +28 -8
  59. package/package.json +11 -7
package/README.md CHANGED
@@ -15,7 +15,8 @@ The package bundles 4 active `@herbertgao/*` child packages—`pi-bark`, `pi-cc-
15
15
  - `@dietrichgebert/ponytail@4.9.0`
16
16
  - `@juicesharp/rpiv-ask-user-question@2.8.0`
17
17
  - `@luxusai/pi-hindsight@0.12.0`
18
- - `@narumitw/pi-btw@0.56.0`
18
+ - `@narumitw/pi-btw@0.57.0`
19
+ - `@narumitw/pi-caffeinate@0.49.7`
19
20
  - `@pi-plugins/fast-mode@0.1.10`
20
21
  - `@tifan/pi-copy-response@0.2.6`
21
22
  - `@tifan/pi-handoff@2.2.0`
@@ -37,6 +38,8 @@ Pi loads their extensions and skills through `node_modules/` paths inside one pa
37
38
 
38
39
  `@herbertgao/pi-bark` sends localized Bark pushes when a user-facing Pi run fully settles or `@juicesharp/rpiv-ask-user-question` needs an answer. Notifications include emoji-labeled machine/path metadata and support the bundled official Pi badge through Bark's `icon` parameter. Configure it in `$PI_CODING_AGENT_DIR/bark.json` (normally `~/.pi/agent/bark.json`); see the [package README](../pi-bark/README.md). Without a valid endpoint it stays inactive.
39
40
 
41
+ `@narumitw/pi-caffeinate@0.49.7` 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.
42
+
40
43
  `@herbertgao/resume-from@0.2.0` keeps Claude Code sessions associated with their original repository when the active transcript later moves into a nested cwd. `pi-lens@4.1.3` expands language routing and bounds retained diagnostic facts across multi-root sessions. `pi-automode@1.15.0` preserves dynamic providers on legacy registries. `pi-web-access@0.27.0` adds configurable fetch deadlines and answer models plus isolated GitHub clone runtimes. Preferred Thinking 1.0.1 preserves an explicit subagent `--thinking` choice. Deprecated `@tifan/pi-titlebar-spinner` is no longer bundled; Rename remains the single owner of Herdr tab naming.
41
44
 
42
45
  `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.
@@ -37,3 +37,29 @@ THE SOFTWARE.
37
37
  ## `@luxusai/pi-hindsight`
38
38
 
39
39
  The aggregate also bundles [`@luxusai/pi-hindsight`](https://github.com/luxus/pi-hindsight) version 0.12.0. Its published `package.json` declares the SPDX license identifier `MIT`. The reviewed upstream repository and npm tarball do not currently include a standalone license or copyright notice, so this aggregate does not invent one; it preserves the published package metadata and upstream attribution verbatim.
40
+
41
+ ## `@narumitw/pi-caffeinate`
42
+
43
+ The aggregate bundles [`@narumitw/pi-caffeinate`](https://github.com/narumiruna/pi-extensions/tree/main/packages/pi-caffeinate) version 0.49.7 under its original MIT license:
44
+
45
+ MIT License
46
+
47
+ Copyright (c) 2026 narumiruna
48
+
49
+ Permission is hereby granted, free of charge, to any person obtaining a copy
50
+ of this software and associated documentation files (the "Software"), to deal
51
+ in the Software without restriction, including without limitation the rights
52
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
53
+ copies of the Software, and to permit persons to whom the Software is
54
+ furnished to do so, subject to the following conditions:
55
+
56
+ The above copyright notice and this permission notice shall be included in all
57
+ copies or substantial portions of the Software.
58
+
59
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
60
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
61
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
62
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
63
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
64
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
65
+ SOFTWARE.
@@ -21,6 +21,8 @@ export type Config = {
21
21
  writeDiffCollapsedLines: number;
22
22
  diffWordWrap: boolean;
23
23
  expandedPreviewMaxLines: number;
24
+ expandedInputMaxLines: number;
25
+ expandedOutputMaxLines: number;
24
26
  useSummaryTitlesAsThinkingTitle: boolean;
25
27
  previewLines: number;
26
28
  animationIntervalMs: number;
@@ -46,6 +48,8 @@ export const DIFF_COLLAPSED_LINES_VALUES = ["12", "24", "36", "48", "80", "120"]
46
48
  export const WRITE_DIFF_COLLAPSED_LINES_VALUES = ["0", "4", "8", "12", "24", "36"];
47
49
  /** Presets for expanded body height — keep low options first so cycling stays TUI-friendly. */
48
50
  export const EXPANDED_PREVIEW_MAX_LINES_VALUES = ["40", "60", "80", "120", "200", "500", "2000"];
51
+ export const EXPANDED_INPUT_MAX_LINES_VALUES = ["5", "10", "20", "40", "80"];
52
+ export const EXPANDED_OUTPUT_MAX_LINES_VALUES = ["10", "20", "40", "80", "120"];
49
53
  export const THINKING_PREVIEW_LINES_VALUES = ["0", "1", "3", "5", "10"];
50
54
  export const THINKING_ANIMATION_INTERVAL_VALUES = ["40", "60", "90", "120", "180"];
51
55
  /** fullscreen 滚轮步进行数预设。 */
@@ -73,6 +77,8 @@ export const DEFAULT_CONFIG: Config = {
73
77
  writeDiffCollapsedLines: DEFAULT_TOOL_DISPLAY_CONFIG.writeDiffCollapsedLines,
74
78
  diffWordWrap: DEFAULT_TOOL_DISPLAY_CONFIG.diffWordWrap,
75
79
  expandedPreviewMaxLines: DEFAULT_TOOL_DISPLAY_CONFIG.expandedPreviewMaxLines,
80
+ expandedInputMaxLines: 5,
81
+ expandedOutputMaxLines: 10,
76
82
  useSummaryTitlesAsThinkingTitle: true,
77
83
  previewLines: 3,
78
84
  animationIntervalMs: 90,
@@ -159,6 +165,18 @@ export function normalizeConfig(input: unknown): Config {
159
165
  10,
160
166
  50_000,
161
167
  ),
168
+ expandedInputMaxLines: pickPositiveInt(
169
+ source.expandedInputMaxLines,
170
+ DEFAULT_CONFIG.expandedInputMaxLines,
171
+ 1,
172
+ 5_000,
173
+ ),
174
+ expandedOutputMaxLines: pickPositiveInt(
175
+ source.expandedOutputMaxLines,
176
+ DEFAULT_CONFIG.expandedOutputMaxLines,
177
+ 1,
178
+ 5_000,
179
+ ),
162
180
  useSummaryTitlesAsThinkingTitle: source.useSummaryTitlesAsThinkingTitle !== false,
163
181
  previewLines: pickPositiveInt(
164
182
  source.previewLines,
@@ -217,6 +235,8 @@ export function formatConfigStatus(source: Config = config): string {
217
235
  `writeCollapsed=${source.writeDiffCollapsedLines}`,
218
236
  `diffWordWrap=${source.diffWordWrap ? "on" : "off"}`,
219
237
  `expandedMax=${source.expandedPreviewMaxLines}`,
238
+ `expandedInput=${source.expandedInputMaxLines}`,
239
+ `expandedOutput=${source.expandedOutputMaxLines}`,
220
240
  `thinkingTitle=${source.useSummaryTitlesAsThinkingTitle ? "summary" : "default"}`,
221
241
  `thinkingPreview=${source.previewLines}`,
222
242
  `thinkingAnimation=${source.animationIntervalMs}ms`,
@@ -18,6 +18,8 @@ import {
18
18
  DIFF_SPLIT_MIN_WIDTH_VALUES,
19
19
  DIFF_VIEW_MODES,
20
20
  EXCLUDE_RENDERER_CANDIDATES,
21
+ EXPANDED_INPUT_MAX_LINES_VALUES,
22
+ EXPANDED_OUTPUT_MAX_LINES_VALUES,
21
23
  EXPANDED_PREVIEW_MAX_LINES_VALUES,
22
24
  formatExcludeRenderers,
23
25
  getCompactThinkingConfig,
@@ -324,6 +326,24 @@ export async function showCcstylePanel(
324
326
  submenu: (_current: string, closeSubmenu: (selected?: string) => void) =>
325
327
  buildNumberInputSubmenu(theme, expandedMaxSetting, closeSubmenu),
326
328
  };
329
+ const expandedInputSetting = {
330
+ id: "expandedInputMaxLines",
331
+ label: "Expanded Input max lines",
332
+ description: "Max Input body lines before the show-more footer appears.",
333
+ currentValue: String(config.expandedInputMaxLines),
334
+ values: [...EXPANDED_INPUT_MAX_LINES_VALUES],
335
+ submenu: (_current: string, closeSubmenu: (selected?: string) => void) =>
336
+ buildNumberInputSubmenu(theme, expandedInputSetting, closeSubmenu),
337
+ };
338
+ const expandedOutputSetting = {
339
+ id: "expandedOutputMaxLines",
340
+ label: "Expanded Output max lines",
341
+ description: "Max Output body lines before the show-more footer appears.",
342
+ currentValue: String(config.expandedOutputMaxLines),
343
+ values: [...EXPANDED_OUTPUT_MAX_LINES_VALUES],
344
+ submenu: (_current: string, closeSubmenu: (selected?: string) => void) =>
345
+ buildNumberInputSubmenu(theme, expandedOutputSetting, closeSubmenu),
346
+ };
327
347
  const thinkingTitleSetting = {
328
348
  id: "useSummaryTitlesAsThinkingTitle",
329
349
  label: "Summary title",
@@ -500,6 +520,24 @@ export async function showCcstylePanel(
500
520
  );
501
521
  expandedMaxSetting.currentValue = String(config.expandedPreviewMaxLines);
502
522
  break;
523
+ case "expandedInputMaxLines":
524
+ config.expandedInputMaxLines = pickPositiveInt(
525
+ value,
526
+ DEFAULT_CONFIG.expandedInputMaxLines,
527
+ 1,
528
+ 5_000,
529
+ );
530
+ expandedInputSetting.currentValue = String(config.expandedInputMaxLines);
531
+ break;
532
+ case "expandedOutputMaxLines":
533
+ config.expandedOutputMaxLines = pickPositiveInt(
534
+ value,
535
+ DEFAULT_CONFIG.expandedOutputMaxLines,
536
+ 1,
537
+ 5_000,
538
+ );
539
+ expandedOutputSetting.currentValue = String(config.expandedOutputMaxLines);
540
+ break;
503
541
  case "useSummaryTitlesAsThinkingTitle":
504
542
  config.useSummaryTitlesAsThinkingTitle = value === "on";
505
543
  break;
@@ -554,10 +592,8 @@ export async function showCcstylePanel(
554
592
  diffViewSetting,
555
593
  diffIndicatorSetting,
556
594
  diffSplitSetting,
557
- diffCollapsedSetting,
558
595
  writeDiffCollapsedSetting,
559
596
  diffWordWrapSetting,
560
- expandedMaxSetting,
561
597
  ],
562
598
  },
563
599
  {
@@ -573,7 +609,14 @@ export async function showCcstylePanel(
573
609
  {
574
610
  id: "ui",
575
611
  label: "UI",
576
- items: [startupHeaderSetting, scrollStepSetting],
612
+ items: [
613
+ expandedMaxSetting,
614
+ expandedInputSetting,
615
+ expandedOutputSetting,
616
+ diffCollapsedSetting,
617
+ startupHeaderSetting,
618
+ scrollStepSetting,
619
+ ],
577
620
  },
578
621
  {
579
622
  id: "feature",
@@ -18,6 +18,7 @@ import {
18
18
  collectToolComponents,
19
19
  extractToolFramePlacements,
20
20
  isSgrLeftPress,
21
+ isSgrLeftRelease,
21
22
  isToolExecutionComponent,
22
23
  parseSgrMousePackets,
23
24
  stripTerminalSequences,
@@ -35,6 +36,7 @@ import {
35
36
  isScrollbarColumnAt,
36
37
  } from "./layout.ts";
37
38
  import {
39
+ disableOfficialScrollToEnd,
38
40
  fullscreenLazyTui,
39
41
  hideScrollButton,
40
42
  isScrollBottomInput,
@@ -157,8 +159,11 @@ function updateToolSummaryHover(tui: any, packet: SgrMousePacket): void {
157
159
  }
158
160
 
159
161
  const EXPAND_PANEL_DOUBLE_CLICK_MS = 400;
162
+ const EXPAND_PANEL_CLICK_ARM_MS = 50;
160
163
  type ExpandPanelIdentity = string | object;
161
- let lastExpandPanelClick: { id: ExpandPanelIdentity; at: number } | null = null;
164
+ let pendingExpandPress: { id: ExpandPanelIdentity } | null = null;
165
+ let lastExpandClick: { id: ExpandPanelIdentity; at: number } | null = null;
166
+ let armExpandClickTimer: ReturnType<typeof setTimeout> | null = null;
162
167
 
163
168
  function expandPanelIdentity(card: any): ExpandPanelIdentity {
164
169
  return card instanceof ThinkingPreviewBlock
@@ -169,17 +174,47 @@ function expandPanelIdentity(card: any): ExpandPanelIdentity {
169
174
  function isExpandPanelDoubleClick(card: any): boolean {
170
175
  const now = Date.now();
171
176
  const id = expandPanelIdentity(card);
172
- const prev = lastExpandPanelClick;
173
- lastExpandPanelClick = { id, at: now };
174
- return Boolean(prev && prev.id === id && now - prev.at <= EXPAND_PANEL_DOUBLE_CLICK_MS);
177
+ const prev = lastExpandClick;
178
+ pendingExpandPress = { id };
179
+ if (prev && prev.id === id && now - prev.at <= EXPAND_PANEL_DOUBLE_CLICK_MS) {
180
+ pendingExpandPress = null;
181
+ lastExpandClick = null;
182
+ return true;
183
+ }
184
+ return false;
185
+ }
186
+
187
+ function completeExpandPanelClick(): void {
188
+ if (!pendingExpandPress) return;
189
+ const click = { id: pendingExpandPress.id, at: Date.now() };
190
+ pendingExpandPress = null;
191
+ if (armExpandClickTimer) clearTimeout(armExpandClickTimer);
192
+ armExpandClickTimer = setTimeout(() => {
193
+ armExpandClickTimer = null;
194
+ if (pendingExpandPress) return;
195
+ lastExpandClick = click;
196
+ }, EXPAND_PANEL_CLICK_ARM_MS);
197
+ if (
198
+ typeof armExpandClickTimer === "object" &&
199
+ armExpandClickTimer &&
200
+ "unref" in armExpandClickTimer
201
+ ) {
202
+ armExpandClickTimer.unref();
203
+ }
175
204
  }
176
205
 
177
206
  function clearExpandPanelDoubleClick(): void {
178
- lastExpandPanelClick = null;
207
+ pendingExpandPress = null;
208
+ lastExpandClick = null;
209
+ if (armExpandClickTimer) {
210
+ clearTimeout(armExpandClickTimer);
211
+ armExpandClickTimer = null;
212
+ }
179
213
  }
180
214
 
181
215
  function collapseExpandedCard(tui: any, card: any): boolean {
182
- if (!isExpandPanelDoubleClick(card)) return false;
216
+ // 单击也 consume,避免官方链再合成一次 press 把单击当成双击。
217
+ if (!isExpandPanelDoubleClick(card)) return true;
183
218
  card.setExpanded(false);
184
219
  setHoveredToolCallId(null);
185
220
  setHoveredToolGroup(null);
@@ -336,18 +371,17 @@ function handleFullscreenToolClick(tui: any, packet: SgrMousePacket): boolean {
336
371
  const plain = stripTerminalSequencesPreservingLayout(line);
337
372
  const section = view.matchShowMoreLine(plain);
338
373
  if (section) {
374
+ clearExpandPanelDoubleClick();
339
375
  const box = view.showMoreHitbox(plain);
340
- if (box && x + 1 >= box.startCol && x + 1 <= box.endCol) {
341
- return tryOpenToolIoShowMore({
342
- kind: "show-more",
343
- row: 0,
344
- startCol: box.startCol,
345
- endCol: box.endCol,
346
- component,
347
- view,
348
- section,
349
- });
350
- }
376
+ return tryOpenToolIoShowMore({
377
+ kind: "show-more",
378
+ row: 0,
379
+ startCol: box?.startCol ?? 1,
380
+ endCol: box?.endCol ?? 1,
381
+ component,
382
+ view,
383
+ section,
384
+ });
351
385
  }
352
386
  }
353
387
  // 双击收起:内部工具仍归所属 group。单击放行官方(选择/链接)。
@@ -464,6 +498,7 @@ function patchFullscreenViewportInput(tui: any): void {
464
498
  if (packets && tui.hasOverlay?.() && hasActiveTextPreview()) return undefined;
465
499
  if (packets && !tui.hasOverlay?.()) {
466
500
  for (const packet of packets) {
501
+ if (isSgrLeftRelease(packet)) completeExpandPanelClick();
467
502
  if (isSgrLeftPress(packet) && handleFullscreenToolClick(tui, packet)) {
468
503
  return { consume: true };
469
504
  }
@@ -800,6 +835,7 @@ function handleToolMouseInput(data: string): { consume: true } | undefined {
800
835
  let consumed = false;
801
836
  for (const packet of packets) {
802
837
  updateToolSummaryHover(getToolMouseTui(), packet);
838
+ if (isSgrLeftRelease(packet)) completeExpandPanelClick();
803
839
  if (!isSgrLeftPress(packet)) continue;
804
840
  if (toggleToolAtMouseClick(getToolMouseTui(), packet)) {
805
841
  consumed = true;
@@ -880,10 +916,12 @@ export function installToolMouseInteraction(
880
916
  setToolMouseTui(tui);
881
917
  setToolTuiFullscreen(fullscreenLazyTui(tui));
882
918
  if (isLazyProxyTui(tui)) {
919
+ disableOfficialScrollToEnd(tui);
883
920
  patchFullscreenViewportInput(tui);
884
921
  ensureFullscreenToolMouseMotion(tui);
885
922
  setScrollButtonWidget({
886
923
  render: (width: number) => {
924
+ disableOfficialScrollToEnd(tui);
887
925
  patchFullscreenViewportInput(tui);
888
926
  ensureFullscreenToolMouseMotion(tui);
889
927
  return renderScrollButton(width, theme);
@@ -53,6 +53,12 @@ export function isSgrLeftPress(packet: SgrMousePacket): boolean {
53
53
  return packet.final === "M" && baseButton === 0 && (packet.code & 32) === 0;
54
54
  }
55
55
 
56
+ /** 是否为左键松开。 */
57
+ export function isSgrLeftRelease(packet: SgrMousePacket): boolean {
58
+ const baseButton = packet.code & ~(4 | 8 | 16 | 32);
59
+ return packet.final === "m" && baseButton === 0 && (packet.code & 32) === 0;
60
+ }
61
+
56
62
  /** 仅剥离终端序列、保留原布局(换行/空白不动),用于命中区间计算。 */
57
63
  export function stripTerminalSequencesPreservingLayout(value: string): string {
58
64
  return value
@@ -83,6 +83,11 @@ export function fullscreenLazyTui(tui: any): boolean {
83
83
  return isLazyProxyTui(tui) && tui.mode === "fullscreen";
84
84
  }
85
85
 
86
+ /** 关掉 pi 0.85 Jump to latest overlay,避免和本仓库 dock 按钮叠两层。 */
87
+ export function disableOfficialScrollToEnd(tui: any): void {
88
+ if (typeof tui?.scrollToEndIndicator === "function") tui.scrollToEndIndicator = undefined;
89
+ }
90
+
86
91
  /** 官方 fullscreen:是否已跟随 transcript 底部(按钮隐藏条件)。 */
87
92
  export function isFullscreenAtBottom(tui: any): boolean {
88
93
  const following = tui.isFollowingOutput ?? tui.getPrimaryScrollView?.()?.isFollowingEnd ?? true;
@@ -246,7 +246,7 @@ export class ExpandedToolIoView {
246
246
  private hoveredSection: ToolIoSection | null = null;
247
247
  /** Which sections currently show the show-more affordance (after last render). */
248
248
  private truncated: { input: boolean; output: boolean } = { input: false, output: false };
249
- /** 0-based header line indexes that carry show-more after last render. */
249
+ /** 0-based body/footer line indexes that carry show-more after last render. */
250
250
  private showMoreHeaderRows: { input?: number; output?: number } = {};
251
251
 
252
252
  constructor(
@@ -306,12 +306,12 @@ export class ExpandedToolIoView {
306
306
  this.invalidate();
307
307
  }
308
308
 
309
- /** True when the plain header line is a truncated section with show-more. */
309
+ /** True when the plain footer line is a truncated section with show-more. */
310
310
  matchShowMoreLine(plainLine: string): ToolIoSection | null {
311
311
  const line = plainLine.replace(/\x1b\[[0-9;]*m/g, "");
312
- if (!line.includes(` • ${showMoreHintText()}`)) return null;
313
- if (/\bInput\b/.test(line) && this.truncated.input) return "input";
314
- if (/\bOutput\b/.test(line) && this.truncated.output) return "output";
312
+ if (!line.includes(` • ${showMoreHintText()}`) || !/\+\d+ more lines/.test(line)) return null;
313
+ if (this.truncated.input && line.includes("│")) return "input";
314
+ if (this.truncated.output) return "output";
315
315
  return null;
316
316
  }
317
317
 
@@ -355,24 +355,13 @@ export class ExpandedToolIoView {
355
355
  this.truncated = { input: false, output: false };
356
356
  this.showMoreHeaderRows = {};
357
357
 
358
- const pushHeader = (
359
- corner: "├" | "└",
360
- label: string,
361
- section: ToolIoSection,
362
- showMore: boolean,
363
- ) => {
358
+ const pushHeader = (corner: "├" | "└", label: string) => {
364
359
  const mark = theme.fg("dim", ` ${corner} `);
365
360
  const title = theme.fg(
366
361
  "accent",
367
362
  typeof theme.bold === "function" ? theme.bold(label) : label,
368
363
  );
369
- // hover 只高亮文字,圆点保持 dim(与 group hint 一致)。
370
- const more = showMore
371
- ? theme.fg("dim", " •") +
372
- theme.fg(this.hoveredSection === section ? "text" : "dim", ` ${showMoreHintText()}`)
373
- : "";
374
- if (showMore) this.showMoreHeaderRows[section] = lines.length;
375
- lines.push(truncateToWidth(mark + title + more, safeWidth, ""));
364
+ lines.push(truncateToWidth(mark + title, safeWidth, ""));
376
365
  };
377
366
 
378
367
  const pushRailLine = (styledContent: string, continued = true) => {
@@ -394,7 +383,7 @@ export class ExpandedToolIoView {
394
383
 
395
384
  const pushBody = (
396
385
  body: string,
397
- opts: { input?: boolean; limit: number; continued?: boolean },
386
+ opts: { input?: boolean; limit: number; continued?: boolean; section: ToolIoSection },
398
387
  ): boolean /* truncated */ => {
399
388
  const raw = body.replace(/\t/g, " ").replace(/\n+$/, "");
400
389
  if (!raw.trim()) {
@@ -417,7 +406,14 @@ export class ExpandedToolIoView {
417
406
  if (truncated) {
418
407
  const hidden = Math.max(0, wrapped.length - visible.length);
419
408
  if (hidden > 0) {
420
- pushRailLine(theme.fg("dim", `… +${hidden} more lines`), opts.continued);
409
+ const more =
410
+ theme.fg("dim", " •") +
411
+ theme.fg(
412
+ this.hoveredSection === opts.section ? "text" : "dim",
413
+ ` ${showMoreHintText()}`,
414
+ );
415
+ pushRailLine(theme.fg("dim", `… +${hidden} more lines`) + more, opts.continued);
416
+ this.showMoreHeaderRows[opts.section] = lines.length - 1;
421
417
  }
422
418
  }
423
419
  return truncated;
@@ -426,7 +422,6 @@ export class ExpandedToolIoView {
426
422
  const hasInput = this.inputBody.trim().length > 0;
427
423
  const outputText = this.getOutputBody();
428
424
 
429
- // Decide show-more from the same truncation rules as pushBody.
430
425
  const inputWouldTruncate =
431
426
  hasInput &&
432
427
  bodyExceedsLineLimit(this.inputBody, this.maxInputLines, contentWidth, true, theme);
@@ -441,20 +436,21 @@ export class ExpandedToolIoView {
441
436
 
442
437
  if (hasInput) {
443
438
  this.truncated.input = inputWouldTruncate;
444
- pushHeader("├", "Input", "input", inputWouldTruncate);
439
+ pushHeader("├", "Input");
445
440
  pushBody(this.inputBody, {
446
441
  input: true,
447
442
  limit: this.maxInputLines,
448
443
  continued: true,
444
+ section: "input",
449
445
  });
450
446
  pushBlankRail();
451
447
  this.truncated.output = outputWouldTruncate;
452
- pushHeader("└", "Output", "output", outputWouldTruncate);
453
- pushBody(outputText, { limit: this.maxOutputLines, continued: false });
448
+ pushHeader("└", "Output");
449
+ pushBody(outputText, { limit: this.maxOutputLines, continued: false, section: "output" });
454
450
  } else {
455
451
  this.truncated.output = outputWouldTruncate;
456
- pushHeader("└", "Output", "output", outputWouldTruncate);
457
- pushBody(outputText, { limit: this.maxOutputLines, continued: false });
452
+ pushHeader("└", "Output");
453
+ pushBody(outputText, { limit: this.maxOutputLines, continued: false, section: "output" });
458
454
  }
459
455
 
460
456
  this.cachedWidth = width;
@@ -655,16 +651,24 @@ export function renderExpandedToolResult(
655
651
  ): ExpandedToolIoView | ExpandedToolResultText | Text {
656
652
  const inputBody = formatToolInputArgs(args);
657
653
  const outputBody = body;
658
- const maxLines = config.expandedPreviewMaxLines;
654
+ const maxOutputLines = config.expandedOutputMaxLines;
655
+ const maxInputLines = config.expandedInputMaxLines;
659
656
 
660
657
  // Prefer structured Input/Output when we have args or non-empty output.
661
658
  if (inputBody.trim() || outputBody.trim()) {
662
659
  let view: ExpandedToolIoView;
663
660
  if (isExpandedToolIoView(lastComponent)) {
664
- lastComponent.setContent(inputBody, outputBody, isError, maxLines, maxLines);
661
+ lastComponent.setContent(inputBody, outputBody, isError, maxOutputLines, maxInputLines);
665
662
  view = lastComponent;
666
663
  } else {
667
- view = new ExpandedToolIoView(theme, inputBody, outputBody, isError, maxLines, maxLines);
664
+ view = new ExpandedToolIoView(
665
+ theme,
666
+ inputBody,
667
+ outputBody,
668
+ isError,
669
+ maxOutputLines,
670
+ maxInputLines,
671
+ );
668
672
  }
669
673
  if (context) rememberIoView(context, view);
670
674
  return view;
@@ -701,7 +705,7 @@ function frameViewId(view: ExpandedToolIoView): number | null {
701
705
  function withIoViewMarkers(view: ExpandedToolIoView, lines: string[]): string[] {
702
706
  const id = frameViewId(view);
703
707
  if (id === null) return lines;
704
- // Mark by exact header row from render — never scan body text for Input/Output labels.
708
+ // Mark by exact recorded show-more row from render — never scan body text heuristically.
705
709
  const marked = lines.slice();
706
710
  for (const { section, line } of view.showMoreHeaderLineIndexes()) {
707
711
  if (line < 0 || line >= marked.length) continue;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-cc-extensions",
3
- "version": "0.8.60",
3
+ "version": "0.9.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",
@@ -69,8 +69,8 @@
69
69
  },
70
70
  "x-upstream": {
71
71
  "package": "pi-cc-extensions",
72
- "version": "0.8.68",
72
+ "version": "0.8.69",
73
73
  "repository": "https://github.com/minuque/pi-cc-extensions",
74
- "commit": "1ca144c8fa3f2b391fd76d008f0148e04bad14be"
74
+ "commit": "5d7a2666f51da9f450bd019af10200c88cc1df98"
75
75
  }
76
76
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juicesharp/rpiv-ask-user-question",
3
- "version": "2.8.0",
3
+ "version": "2.9.0",
4
4
  "description": "Pi extension. A structured questionnaire the model can put to you when it would otherwise guess, with typed options instead of free-form replies.",
5
5
  "keywords": [
6
6
  "pi-package",
@@ -94,7 +94,7 @@
94
94
  }
95
95
  },
96
96
  "dependencies": {
97
- "@juicesharp/rpiv-config": "^2.8.0",
97
+ "@juicesharp/rpiv-config": "^2.9.0",
98
98
  "typebox": "^1.1.24"
99
99
  }
100
100
  }
@@ -9,7 +9,7 @@ Only context you explicitly bring back is loaded into the main editor.
9
9
 
10
10
  - Starts a side thread immediately with `/btw <question>` or opens the manager with `/btw`.
11
11
  - Uses any persisted main-session branch as context without switching branches.
12
- - Supports scrollable answers, transcript search, follow-up questions, queued steering, and in-memory resume.
12
+ - Supports scrollable answers, transcript search, a clickable jump-to-latest control, follow-up questions, queued steering, and in-memory resume.
13
13
  - Keeps side questions and answers out of the main conversation by default.
14
14
  - Brings back the latest answer, a question suffix, an exact range, or the complete thread only when requested.
15
15
  - Uses Pi's current model and thinking level or saved pi-btw choices.
@@ -120,6 +120,9 @@ A failed response remains visible and does not discard later queued questions.
120
120
  Steering never appends to the main conversation or editor.
121
121
 
122
122
  Use the mouse wheel, trackpad, or `PgUp`/`PgDn` to scroll transcript history.
123
+ On Pi 0.85 or newer, scrolling away from a following transcript shows **Jump to latest message** over its final visible row.
124
+ Click the control or use Pi's effective `tui.altScreen.bottom` binding (`End` by default) to resume at the latest content.
125
+ The control disappears after the transcript returns to follow-end mode.
123
126
  The footer shows history keys only when scrolling is available.
124
127
  Ctrl+C cancels the active response and discards the current draft and steering queue.
125
128
  Completed questions, answers, and visible errors remain available through Resume until the extension instance ends.
@@ -216,6 +219,7 @@ The file is read for every `/btw` invocation, so edits apply without `/reload`.
216
219
  - Resume state is memory-only and lasts only for the current extension instance.
217
220
  - A side thread retains the latest 40,000 characters of main-conversation context and adds a truncation notice when earlier content is omitted.
218
221
  - Clipboard access depends on Pi's host helper, the operating system, and the terminal.
222
+ - Pi versions before 0.85 omit the clickable jump-to-latest control.
219
223
 
220
224
  ## 🗂️ Package layout
221
225