@herbertgao/pi-extensions 2026.11.5 → 2026.11.6

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 (44) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/README.md +2 -2
  3. package/THIRD_PARTY_NOTICES.md +1 -1
  4. package/node_modules/@herbertgao/pi-cc-extensions/CHANGELOG.md +10 -0
  5. package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +5 -4
  6. package/node_modules/@herbertgao/pi-cc-extensions/README.md +5 -4
  7. package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +4 -4
  8. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +6 -0
  9. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +22 -4
  10. package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/session-tokens.ts +3 -3
  11. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +22 -2
  12. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +5 -0
  13. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +38 -6
  14. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +2 -1
  15. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +4 -4
  16. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-layout.ts +6 -6
  17. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +4 -4
  18. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
  19. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +3 -2
  20. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-mode.ts +465 -0
  21. package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-scope.ts +44 -0
  22. package/node_modules/@herbertgao/pi-cc-extensions/package.json +4 -4
  23. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark-hc.json +2 -4
  24. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +3 -5
  25. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light-hc.json +2 -4
  26. package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +3 -5
  27. package/node_modules/@herbertgao/pi-impeccable/CHANGELOG.md +10 -0
  28. package/node_modules/@herbertgao/pi-impeccable/README.md +2 -2
  29. package/node_modules/@herbertgao/pi-impeccable/package.json +4 -4
  30. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/SKILL.md +1 -1
  31. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/asset-producer.md +1 -1
  32. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/documenter.md +4 -4
  33. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/finish-reviewer.md +2 -2
  34. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/degraded/manual-edit-applier.md +3 -2
  35. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/hooks.md +13 -7
  36. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/init.md +2 -0
  37. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/live.md +5 -3
  38. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/reference/new-work.md +2 -2
  39. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/VERSION +1 -1
  40. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/engine-checksums.txt +5 -5
  41. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable +39 -22
  42. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/impeccable.cmd +43 -15
  43. package/node_modules/@herbertgao/pi-impeccable/skills/impeccable/scripts/live-browser.js +357 -139
  44. package/package.json +3 -3
@@ -0,0 +1,465 @@
1
+ /**
2
+ * 会话记录浏览层:对齐 Claude Code 的 transcript 视图。
3
+ *
4
+ * on / compact 模式、全屏、输入框有焦点时按「展开工具输出」键(默认 ctrl+o),
5
+ * 打开一个铺满屏幕的弹层,盖住对话区、输入框和底栏。弹层持有焦点,按键只用来翻阅。
6
+ *
7
+ * 弹层不走对话区的渲染流程:照着对话区现有组件新建一份副本来画。
8
+ * - 工具卡:按原参数与结果新建 ToolExecutionComponent,全部展开;
9
+ * shell 的开始/结束时钟一并抄过来,耗时不从副本首次绘制重新计;
10
+ * - 模型回复:按原消息新建 AssistantMessageComponent,思考块完整显示;
11
+ * - 其余(用户消息、提示、摘要):不受展开影响,直接画原组件;
12
+ * - compact 挂进对话区的回合尾行:跳过。
13
+ * 副本带浏览标记(见 transcript-scope),compact 折叠、分组、互斥收起与行数上限都不作用于它们。
14
+ * 对话区本身一个状态都不改,关掉弹层即恢复原样。
15
+ *
16
+ * Pi 把 app.tools.expand 列为保留键,registerShortcut 注册不上;这里在原始输入到达
17
+ * 输入框之前拦截。只认 Pi 自己会响应该键的组件(带 actionHandlers 的编辑器)。
18
+ */
19
+
20
+ import {
21
+ AssistantMessageComponent,
22
+ ToolExecutionComponent,
23
+ UserMessageComponent,
24
+ } from "@earendil-works/pi-coding-agent";
25
+ import { getKeybindings, isKeyRelease, matchesKey, truncateToWidth } from "@earendil-works/pi-tui";
26
+ import { config } from "../config/config.ts";
27
+ import { walkComponentTree } from "../utils/component-tree.ts";
28
+ import { isCompactRoundTail } from "./compact-mode.ts";
29
+ import { stripToolFrameMarkers } from "./mouse/packets.ts";
30
+ import { fullscreenLazyTui, getToolMouseTui } from "./mouse/scroll.ts";
31
+ import { copyShellTimingState } from "./tool/ccstyle-tool.ts";
32
+ import { ToolGroupComponent } from "./tool/grouping.ts";
33
+ import { expandShortcutText } from "./tool/names.ts";
34
+ import { markTranscriptComponent, withTranscriptScope } from "./transcript-scope.ts";
35
+
36
+ const EXPAND_ACTION = "app.tools.expand";
37
+ // 与 Pi 的 tui.altScreen.pageUp/pageDown 同一重叠行数,翻页后保留上下文。
38
+ const PAGE_SCROLL_OVERLAP = 4;
39
+ const WHEEL_LINES = 3;
40
+
41
+ type TranscriptUi = {
42
+ onTerminalInput(handler: (data: string) => { consume?: boolean } | undefined): () => void;
43
+ custom<T>(factory: (...args: any[]) => any, options?: any): Promise<T>;
44
+ };
45
+
46
+ type ScrollAction =
47
+ | { kind: "lines"; lines: number }
48
+ | { kind: "half"; direction: 1 | -1 }
49
+ | { kind: "page"; direction: 1 | -1 }
50
+ | { kind: "top" }
51
+ | { kind: "bottom" }
52
+ | { kind: "prompt"; direction: 1 | -1 };
53
+
54
+ const SCROLL_KEYS: Array<[string[], ScrollAction]> = [
55
+ [["j", "down", "ctrl+n"], { kind: "lines", lines: 1 }],
56
+ [["k", "up", "ctrl+p"], { kind: "lines", lines: -1 }],
57
+ [["ctrl+d"], { kind: "half", direction: 1 }],
58
+ [["ctrl+u"], { kind: "half", direction: -1 }],
59
+ [["space", "ctrl+f", "pageDown"], { kind: "page", direction: 1 }],
60
+ [["b", "ctrl+b", "shift+space", "pageUp"], { kind: "page", direction: -1 }],
61
+ [["g", "home"], { kind: "top" }],
62
+ [["shift+g", "end"], { kind: "bottom" }],
63
+ [["}"], { kind: "prompt", direction: 1 }],
64
+ [["{"], { kind: "prompt", direction: -1 }],
65
+ ];
66
+
67
+ const EXIT_KEYS = ["escape", "q", "ctrl+c"];
68
+
69
+ function matchesAny(data: string, keys: string[]): boolean {
70
+ return keys.some((key) => matchesKey(data, key as any));
71
+ }
72
+
73
+ export function transcriptScrollAction(data: string): ScrollAction | undefined {
74
+ for (const [keys, action] of SCROLL_KEYS) {
75
+ if (matchesAny(data, keys)) return action;
76
+ }
77
+ return undefined;
78
+ }
79
+
80
+ export function isTranscriptExitKey(data: string): boolean {
81
+ return matchesAny(data, EXIT_KEYS) || getKeybindings().matches(data, EXPAND_ACTION as any);
82
+ }
83
+
84
+ // ---------------------------------------------------------------------------
85
+ // 副本
86
+ // ---------------------------------------------------------------------------
87
+
88
+ type TranscriptItem = { view: any; prompt: boolean };
89
+ type CloneEntry = { view: any; signature: unknown[] };
90
+
91
+ const clones = new WeakMap<object, CloneEntry>();
92
+
93
+ function sameSignature(left: unknown[], right: unknown[]): boolean {
94
+ return left.length === right.length && left.every((value, index) => value === right[index]);
95
+ }
96
+
97
+ function reuseOrClone(live: any, signature: unknown[], build: () => any): any {
98
+ const cached = clones.get(live);
99
+ if (cached && sameSignature(cached.signature, signature)) return cached.view;
100
+ const view = withTranscriptScope(build);
101
+ markTranscriptComponent(view);
102
+ clones.set(live, { view, signature });
103
+ return view;
104
+ }
105
+
106
+ function cloneTool(live: any): any {
107
+ const timing = live?.rendererState;
108
+ const signature = [
109
+ live.args,
110
+ live.result,
111
+ live.isPartial,
112
+ live.executionStarted,
113
+ live.argsComplete,
114
+ timing?.ccstyleShellStartedAt,
115
+ timing?.ccstyleShellEndedAt,
116
+ ];
117
+ return reuseOrClone(live, signature, () => {
118
+ const view: any = new ToolExecutionComponent(
119
+ live.toolName,
120
+ live.toolCallId,
121
+ live.args,
122
+ {
123
+ showImages: live.showImages,
124
+ imageWidthCells: live.imageWidthCells,
125
+ outputPad: live.outputPad,
126
+ },
127
+ live.toolDefinition,
128
+ live.ui,
129
+ live.cwd,
130
+ );
131
+ // 构造时 executionStarted 还是 false,不会先把开始时间写成现在。
132
+ // 抄完再打执行标记和结果,完成态的耗时行才会用原卡的时钟。
133
+ copyShellTimingState(live, view);
134
+ if (live.argsComplete) view.setArgsComplete();
135
+ if (live.executionStarted) view.markExecutionStarted();
136
+ if (live.result) view.updateResult(live.result, live.isPartial === true);
137
+ view.setExpanded(true);
138
+ return view;
139
+ });
140
+ }
141
+
142
+ function cloneAssistant(live: any): any {
143
+ const message = live.lastMessage;
144
+ if (!message) return undefined;
145
+ return reuseOrClone(live, [message, live.isStreaming], () => {
146
+ const view: any = new AssistantMessageComponent(
147
+ undefined,
148
+ false,
149
+ live.markdownTheme,
150
+ live.hiddenThinkingLabel,
151
+ live.outputPad,
152
+ live.markdownTransformers,
153
+ );
154
+ view.updateContent(message, live.isStreaming === true);
155
+ return view;
156
+ });
157
+ }
158
+
159
+ /** 对话区(Pi 的 chatContainer):直接装着回复或用户消息的那个容器。 */
160
+ export function findChatContainer(root: any): any {
161
+ let found: any;
162
+ walkComponentTree(root, (value: any) => {
163
+ if (found) return false;
164
+ const children = value?.children;
165
+ if (
166
+ Array.isArray(children) &&
167
+ children.some(
168
+ (child: any) =>
169
+ child instanceof AssistantMessageComponent || child instanceof UserMessageComponent,
170
+ )
171
+ ) {
172
+ found = value;
173
+ return false;
174
+ }
175
+ return undefined;
176
+ });
177
+ return found;
178
+ }
179
+
180
+ /** 按对话区现有内容生成浏览项:工具与回复用副本,其余直接用原组件。 */
181
+ export function collectTranscriptItems(container: any): TranscriptItem[] {
182
+ const items: TranscriptItem[] = [];
183
+ const pushTool = (tool: any) => {
184
+ if (tool instanceof ToolExecutionComponent)
185
+ items.push({ view: cloneTool(tool), prompt: false });
186
+ };
187
+ for (const child of Array.isArray(container?.children) ? container.children : []) {
188
+ if (isCompactRoundTail(child)) continue;
189
+ if (child instanceof ToolGroupComponent) {
190
+ for (const tool of child.children) pushTool(tool);
191
+ } else if (child instanceof ToolExecutionComponent) {
192
+ pushTool(child);
193
+ } else if (child instanceof AssistantMessageComponent) {
194
+ const view = cloneAssistant(child);
195
+ if (view) items.push({ view, prompt: false });
196
+ } else if (child && typeof child.render === "function") {
197
+ items.push({ view: child, prompt: child instanceof UserMessageComponent });
198
+ }
199
+ }
200
+ return items;
201
+ }
202
+
203
+ // ---------------------------------------------------------------------------
204
+ // 弹层
205
+ // ---------------------------------------------------------------------------
206
+
207
+ export type TranscriptViewOptions = {
208
+ rows: () => number;
209
+ items: () => TranscriptItem[];
210
+ theme: any;
211
+ close: () => void;
212
+ focused: (view: object) => boolean;
213
+ /** 正文滚动了 delta 行(正数为向下翻),bodyHeight 为正文可见行数。 */
214
+ scrolled?: (delta: number, bodyHeight: number) => void;
215
+ };
216
+
217
+ type ScreenPoint = { row: number; col: number; scrollView?: unknown };
218
+
219
+ /**
220
+ * 让 Pi 的屏幕选区跟着浏览层的正文走。
221
+ *
222
+ * 有弹层时 Pi 的选区记的是屏幕行号(不挂 scrollView),复制也只从屏幕文字里取。
223
+ * 正文滚动 delta 行后把选区上移 delta 行,高亮与复制都跟着原来的文字。
224
+ * 选区有一端滚出正文区:屏幕上已没有那段文字,清掉选区,免得复制到别的内容。
225
+ */
226
+ export function followScreenSelection(tui: any, delta: number, bodyHeight: number): void {
227
+ if (!tui || delta === 0) return;
228
+ const anchor: ScreenPoint | undefined = tui.selectionAnchor;
229
+ const focus: ScreenPoint | undefined = tui.selectionFocus;
230
+ if (!anchor || !focus || anchor.scrollView || focus.scrollView) return;
231
+ const move = (point: ScreenPoint): ScreenPoint => ({ ...point, row: point.row - delta });
232
+ const nextAnchor = move(anchor);
233
+ const nextFocus = move(focus);
234
+ const inside = (point: ScreenPoint) => point.row >= 0 && point.row < bodyHeight;
235
+ if (!inside(nextAnchor) || !inside(nextFocus)) {
236
+ tui.resetTextSelection?.();
237
+ return;
238
+ }
239
+ tui.selectionAnchor = nextAnchor;
240
+ tui.selectionFocus = nextFocus;
241
+ const range = tui.selectionInitialRange;
242
+ if (range?.start && range?.end) {
243
+ tui.selectionInitialRange = { start: move(range.start), end: move(range.end) };
244
+ }
245
+ // 双击/三击按坐标累计:位置已变,不再和上一次点击连成多击。
246
+ tui.lastClick = undefined;
247
+ }
248
+
249
+ export class TranscriptView {
250
+ private scrollTop = 0;
251
+ private followEnd = true;
252
+ private bodyHeight = 1;
253
+ private totalLines = 0;
254
+ private promptRows: number[] = [];
255
+ private hadFocus = false;
256
+ private closed = false;
257
+ /** 上一帧画出的滚动位置:与本帧不同就通知选区跟随。 */
258
+ private renderedScrollTop: number | undefined;
259
+
260
+ private readonly options: TranscriptViewOptions;
261
+
262
+ constructor(options: TranscriptViewOptions) {
263
+ this.options = options;
264
+ }
265
+
266
+ private maxScroll(): number {
267
+ return Math.max(0, this.totalLines - this.bodyHeight);
268
+ }
269
+
270
+ private scrollTo(row: number): void {
271
+ this.scrollTop = Math.max(0, Math.min(this.maxScroll(), row));
272
+ this.followEnd = this.scrollTop >= this.maxScroll();
273
+ }
274
+
275
+ private scrollBy(lines: number): void {
276
+ this.scrollTo(this.scrollTop + lines);
277
+ }
278
+
279
+ private apply(action: ScrollAction): void {
280
+ switch (action.kind) {
281
+ case "lines":
282
+ this.scrollBy(action.lines);
283
+ break;
284
+ case "half":
285
+ this.scrollBy(action.direction * Math.max(1, Math.floor(this.bodyHeight / 2)));
286
+ break;
287
+ case "page":
288
+ this.scrollBy(action.direction * Math.max(1, this.bodyHeight - PAGE_SCROLL_OVERLAP));
289
+ break;
290
+ case "top":
291
+ this.scrollTo(0);
292
+ break;
293
+ case "bottom":
294
+ this.scrollTo(this.maxScroll());
295
+ break;
296
+ case "prompt": {
297
+ const target =
298
+ action.direction > 0
299
+ ? this.promptRows.find((row) => row > this.scrollTop)
300
+ : this.promptRows.findLast((row) => row < this.scrollTop);
301
+ if (target !== undefined) this.scrollTo(target);
302
+ break;
303
+ }
304
+ }
305
+ }
306
+
307
+ private close(): void {
308
+ if (this.closed) return;
309
+ this.closed = true;
310
+ this.options.close();
311
+ }
312
+
313
+ handleInput(data: string): void {
314
+ if (isKeyRelease(data)) return;
315
+ if (isTranscriptExitKey(data)) {
316
+ this.close();
317
+ return;
318
+ }
319
+ const action = transcriptScrollAction(data);
320
+ if (action) this.apply(action);
321
+ // 其余按键不做任何事:浏览层不编辑输入框。
322
+ }
323
+
324
+ /**
325
+ * 只接管滚轮。按下、拖动、松开不处理:Pi 有弹层时按屏幕文字做选中复制,
326
+ * 放行后浏览层里的文字照常能拖选、双击选词、复制。
327
+ */
328
+ handleMouse(event: any): { handled: boolean } | undefined {
329
+ if (event?.type !== "wheel") return undefined;
330
+ const delta = Number(event.wheelDelta) || 0;
331
+ if (delta !== 0) this.scrollBy(Math.sign(delta) * WHEEL_LINES);
332
+ return { handled: true };
333
+ }
334
+
335
+ render(width: number): string[] {
336
+ // 其他界面抢走焦点(提问、权限确认等对话框):让位给它。
337
+ if (this.options.focused(this)) this.hadFocus = true;
338
+ else if (this.hadFocus) queueMicrotask(() => this.close());
339
+
340
+ // 底部两行:空一行隔开正文,下面是提示。
341
+ const rows = Math.max(3, this.options.rows());
342
+ this.bodyHeight = rows - 2;
343
+ const lines: string[] = [];
344
+ const promptRows: number[] = [];
345
+ withTranscriptScope(() => {
346
+ for (const item of this.options.items()) {
347
+ if (item.prompt) promptRows.push(lines.length);
348
+ for (const line of item.view.render(width)) lines.push(stripToolFrameMarkers(line));
349
+ }
350
+ });
351
+ this.totalLines = lines.length;
352
+ this.promptRows = promptRows;
353
+ if (this.followEnd) this.scrollTop = this.maxScroll();
354
+ else this.scrollTop = Math.min(this.scrollTop, this.maxScroll());
355
+ // 按键、滚轮、跟随新内容都会改滚动位置,统一在画出时结算一次。
356
+ if (this.renderedScrollTop !== undefined && this.renderedScrollTop !== this.scrollTop) {
357
+ this.options.scrolled?.(this.scrollTop - this.renderedScrollTop, this.bodyHeight);
358
+ }
359
+ this.renderedScrollTop = this.scrollTop;
360
+
361
+ const body = lines.slice(this.scrollTop, this.scrollTop + this.bodyHeight);
362
+ while (body.length < this.bodyHeight) body.push("");
363
+ return [...body, "", this.hintLine(width)];
364
+ }
365
+
366
+ private hintLine(width: number): string {
367
+ const theme = this.options.theme;
368
+ const dim = (text: string) => (typeof theme?.fg === "function" ? theme.fg("dim", text) : text);
369
+ const position =
370
+ this.totalLines > this.bodyHeight
371
+ ? ` (${Math.min(100, Math.round(((this.scrollTop + this.bodyHeight) / this.totalLines) * 100))}%)`
372
+ : "";
373
+ // 窄屏从右侧截断:位置与退出方式放在最前。
374
+ return truncateToWidth(
375
+ dim(
376
+ ` Showing detailed transcript${position} · esc/q to exit · ${expandShortcutText()} to toggle · j/k scroll`,
377
+ ),
378
+ width,
379
+ );
380
+ }
381
+
382
+ invalidate(): void {}
383
+ }
384
+
385
+ // ---------------------------------------------------------------------------
386
+ // 入口
387
+ // ---------------------------------------------------------------------------
388
+
389
+ let ui: TranscriptUi | undefined;
390
+ let unsubscribe: (() => void) | undefined;
391
+ let open = false;
392
+ let closeOpen: (() => void) | undefined;
393
+
394
+ /** 浏览层是否打开。 */
395
+ export function isTranscriptModeActive(): boolean {
396
+ return open;
397
+ }
398
+
399
+ /** Pi 会把展开键交给它处理的组件:默认编辑器与继承 CustomEditor 的编辑器。 */
400
+ function editorFocused(tui: any): boolean {
401
+ const handlers = tui?.focusedComponent?.actionHandlers;
402
+ return handlers instanceof Map && handlers.has(EXPAND_ACTION);
403
+ }
404
+
405
+ function canOpen(tui: any): boolean {
406
+ return (
407
+ config.mode !== "off" &&
408
+ fullscreenLazyTui(tui) &&
409
+ tui.hasOverlay?.() !== true &&
410
+ editorFocused(tui)
411
+ );
412
+ }
413
+
414
+ function openTranscript(): void {
415
+ if (!ui || open) return;
416
+ open = true;
417
+ void ui
418
+ .custom<void>(
419
+ (tui: any, theme: any, _keybindings: unknown, done: () => void) => {
420
+ closeOpen = done;
421
+ return new TranscriptView({
422
+ rows: () => Number(tui?.terminal?.rows) || 24,
423
+ items: () => collectTranscriptItems(findChatContainer(getToolMouseTui() ?? tui)),
424
+ theme,
425
+ close: done,
426
+ focused: (view) => tui?.focusedComponent === view,
427
+ scrolled: (delta, bodyHeight) => followScreenSelection(tui, delta, bodyHeight),
428
+ });
429
+ },
430
+ {
431
+ overlay: true,
432
+ overlayOptions: { anchor: "top-left", width: "100%", maxHeight: "100%", margin: 0 },
433
+ },
434
+ )
435
+ .finally(() => {
436
+ open = false;
437
+ closeOpen = undefined;
438
+ });
439
+ }
440
+
441
+ function handleInput(data: string): { consume?: boolean } | undefined {
442
+ if (open) return undefined;
443
+ if (!getKeybindings().matches(data, EXPAND_ACTION as any)) return undefined;
444
+ if (!canOpen(getToolMouseTui())) return undefined;
445
+ if (!isKeyRelease(data)) openTranscript();
446
+ return { consume: true };
447
+ }
448
+
449
+ /** 装上展开键拦截;重复安装先拆旧的。 */
450
+ export function installTranscriptMode(ctx: any): void {
451
+ teardownTranscriptMode();
452
+ if (ctx?.mode !== "tui" || !ctx?.hasUI) return;
453
+ const candidate = ctx.ui as TranscriptUi | undefined;
454
+ if (typeof candidate?.onTerminalInput !== "function" || typeof candidate.custom !== "function")
455
+ return;
456
+ ui = candidate;
457
+ unsubscribe = candidate.onTerminalInput(handleInput);
458
+ }
459
+
460
+ export function teardownTranscriptMode(): void {
461
+ closeOpen?.();
462
+ unsubscribe?.();
463
+ unsubscribe = undefined;
464
+ ui = undefined;
465
+ }
@@ -0,0 +1,44 @@
1
+ /**
2
+ * 会话记录浏览层的组件标记。
3
+ *
4
+ * 浏览层照着对话区现有组件新建一份来画。这些副本要绕开对话区的渲染规则:
5
+ * compact 的整轮折叠与组件跟踪、compact-thinking 的思考跟踪、展开后的行数上限。
6
+ *
7
+ * 副本的构造与渲染都包在 withTranscriptScope 里;构造完成后再用
8
+ * markTranscriptComponent 打上实例标记,覆盖动画定时器等在作用域外触发的重绘。
9
+ */
10
+
11
+ const TRANSCRIPT_STATE_KEY = "ccstyleTranscript";
12
+ const marked = new WeakSet<object>();
13
+ let depth = 0;
14
+
15
+ /** 在浏览层作用域里执行:期间构造或渲染的组件都按浏览副本处理。 */
16
+ export function withTranscriptScope<T>(run: () => T): T {
17
+ depth++;
18
+ try {
19
+ return run();
20
+ } finally {
21
+ depth--;
22
+ }
23
+ }
24
+
25
+ /** 给浏览副本打实例标记;渲染状态里也记一份,供只拿得到 context 的渲染器判断。 */
26
+ export function markTranscriptComponent(component: any): void {
27
+ if (!component || typeof component !== "object") return;
28
+ marked.add(component);
29
+ const state = component.rendererState;
30
+ if (state && typeof state === "object") state[TRANSCRIPT_STATE_KEY] = true;
31
+ }
32
+
33
+ /** 组件是否为浏览副本(或正处于浏览层作用域)。 */
34
+ export function isTranscriptComponent(component: unknown): boolean {
35
+ return (
36
+ depth > 0 || (typeof component === "object" && component !== null && marked.has(component))
37
+ );
38
+ }
39
+
40
+ /** 展开内容的行数上限:浏览副本不限行数,其余沿用配置。 */
41
+ export function expandedLineLimit(limit: number, context?: any): number {
42
+ if (depth > 0 || context?.state?.[TRANSCRIPT_STATE_KEY] === true) return Number.MAX_SAFE_INTEGER;
43
+ return limit;
44
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-cc-extensions",
3
- "version": "1.0.15-local.1",
3
+ "version": "1.0.16-local.1",
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",
@@ -74,10 +74,10 @@
74
74
  },
75
75
  "x-upstream": {
76
76
  "package": "pi-cc-extensions",
77
- "version": "1.0.15",
78
- "reviewedVersion": "1.0.15",
77
+ "version": "1.0.16",
78
+ "reviewedVersion": "1.0.16",
79
79
  "repository": "https://github.com/minuque/pi-cc-extensions",
80
- "commit": "b996151bb63028c270340bde3e9526a62c634d2f",
80
+ "commit": "5e3ef6b9f96d198f93ec242eac81ff21bebdb4e1",
81
81
  "trackVersion": true
82
82
  }
83
83
  }
@@ -22,9 +22,7 @@
22
22
  "purple": "#be8fff",
23
23
  "pink": "#f778ba",
24
24
  "cyan": "#39c5cf",
25
- "selection": "#1a4480",
26
- "diffAddBg": "#0f2a24",
27
- "diffDelBg": "#261418"
25
+ "selection": "#1a4480"
28
26
  },
29
27
  "colors": {
30
28
  "accent": "blue",
@@ -32,7 +30,7 @@
32
30
  "borderAccent": "blue",
33
31
  "borderMuted": "borderMuted",
34
32
  "success": "green",
35
- "error": "#ffc4bd",
33
+ "error": "red",
36
34
  "warning": "yellow",
37
35
  "muted": "fgMuted",
38
36
  "dim": "#71717a",
@@ -22,9 +22,7 @@
22
22
  "purple": "#be8fff",
23
23
  "pink": "#f778ba",
24
24
  "cyan": "#39c5cf",
25
- "selection": "#1a4480",
26
- "diffAddBg": "#0f2a24",
27
- "diffDelBg": "#261418"
25
+ "selection": "#1a4480"
28
26
  },
29
27
  "colors": {
30
28
  "accent": "blue",
@@ -49,8 +47,8 @@
49
47
  "customMessageText": "fgMuted",
50
48
  "customMessageLabel": "blue",
51
49
  "toolPendingBg": "canvasSubtle",
52
- "toolSuccessBg": "diffAddBg",
53
- "toolErrorBg": "diffDelBg",
50
+ "toolSuccessBg": "#0f2a24",
51
+ "toolErrorBg": "#261418",
54
52
  "toolTitle": "fg",
55
53
  "toolOutput": "fgMuted",
56
54
  "mdHeading": "blueBright",
@@ -22,9 +22,7 @@
22
22
  "purple": "#65339c",
23
23
  "pink": "#931662",
24
24
  "cyan": "#005359",
25
- "selection": "#c5d6ee",
26
- "diffAddBg": "#c3dcd0",
27
- "diffDelBg": "#f0d5d8"
25
+ "selection": "#c5d6ee"
28
26
  },
29
27
  "colors": {
30
28
  "accent": "blue",
@@ -32,7 +30,7 @@
32
30
  "borderAccent": "blue",
33
31
  "borderMuted": "borderMuted",
34
32
  "success": "green",
35
- "error": "#6f0307",
33
+ "error": "red",
36
34
  "warning": "yellow",
37
35
  "muted": "fgMuted",
38
36
  "dim": "#4e5966",
@@ -22,9 +22,7 @@
22
22
  "purple": "#65339c",
23
23
  "pink": "#931662",
24
24
  "cyan": "#005359",
25
- "selection": "#c5d6ee",
26
- "diffAddBg": "#c3dcd0",
27
- "diffDelBg": "#f0d5d8"
25
+ "selection": "#c5d6ee"
28
26
  },
29
27
  "colors": {
30
28
  "accent": "blue",
@@ -49,8 +47,8 @@
49
47
  "customMessageText": "fgMuted",
50
48
  "customMessageLabel": "blue",
51
49
  "toolPendingBg": "canvasSubtle",
52
- "toolSuccessBg": "diffAddBg",
53
- "toolErrorBg": "diffDelBg",
50
+ "toolSuccessBg": "#c3dcd0",
51
+ "toolErrorBg": "#f0d5d8",
54
52
  "toolTitle": "fg",
55
53
  "toolOutput": "fgMuted",
56
54
  "mdHeading": "blueBright",
@@ -1,5 +1,15 @@
1
1
  # @herbertgao/pi-impeccable
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#362](https://github.com/HerbertGao/pi-extensions/pull/362) [`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Vendor the official Impeccable 4.8.1 Pi skill. The launcher pins engine 0.1.19 and skips a sibling binary from another engine version. Live mode can stage removal of a picked element.
8
+
9
+ ### Patch Changes
10
+
11
+ - [#362](https://github.com/HerbertGao/pi-extensions/pull/362) [`47bf3d5`](https://github.com/HerbertGao/pi-extensions/commit/47bf3d5c5d482a4fcb1e60a994455a4fc6bbe5e4) Thanks [@HerbertGao](https://github.com/HerbertGao)! - Keep a staged Live removal in the page when Go cleans the selected element, so Undo and Discard can restore it.
12
+
3
13
  ## 0.1.1
4
14
 
5
15
  ### Patch Changes
@@ -1,6 +1,6 @@
1
1
  # @herbertgao/pi-impeccable
2
2
 
3
- The [Impeccable](https://github.com/pbakaus/impeccable) design skill for [Pi](https://pi.dev/), vendored from the official `skill-v4.8.0` release. It provides design steering, critique, audit, and deterministic anti-pattern detection without an installer, background service, or global skill directory.
3
+ The [Impeccable](https://github.com/pbakaus/impeccable) design skill for [Pi](https://pi.dev/), vendored from the official `skill-v4.8.1` release. It provides design steering, critique, audit, and deterministic anti-pattern detection without an installer, background service, or global skill directory.
4
4
 
5
5
  ## Install
6
6
 
@@ -27,7 +27,7 @@ Upstream `pin` and `unpin` only discover skill installations in project harness
27
27
 
28
28
  ## Updates and provenance
29
29
 
30
- This package vendors the complete official Pi payload: 58 files from commit [`414603bf14c7a344edb466bb1f85690c77ce8b7d`](https://github.com/pbakaus/impeccable/commit/414603bf14c7a344edb466bb1f85690c77ce8b7d). Updates are reviewed and released through this repository rather than the upstream auto-updater.
30
+ This package vendors the official Pi payload: 58 files from commit [`924bbd194d02e5e15a227e75b5901fb0d7a4ecad`](https://github.com/pbakaus/impeccable/commit/924bbd194d02e5e15a227e75b5901fb0d7a4ecad). `scripts/live-browser.js` has one local fix on top of that commit: Go still cleans edit markers on the live selection, but it no longer detaches a staged removal, so Undo and Discard can restore the hidden node. The review cursor stays at that commit. Updates are reviewed and released through this repository rather than the upstream auto-updater.
31
31
 
32
32
  ## License
33
33
 
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@herbertgao/pi-impeccable",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "The Impeccable design skill for Pi, vendored from the official release.",
5
5
  "keywords": [
6
6
  "design",
@@ -46,9 +46,9 @@
46
46
  },
47
47
  "x-upstream": {
48
48
  "package": "impeccable",
49
- "version": "4.8.0",
50
- "reviewedVersion": "4.8.0",
49
+ "version": "4.8.1",
50
+ "reviewedVersion": "4.8.1",
51
51
  "repository": "https://github.com/pbakaus/impeccable",
52
- "commit": "414603bf14c7a344edb466bb1f85690c77ce8b7d"
52
+ "commit": "924bbd194d02e5e15a227e75b5901fb0d7a4ecad"
53
53
  }
54
54
  }
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: impeccable
3
3
  description: "Use when the user wants to design, redesign, shape, critique, audit, polish, simplify, harden, animate, or otherwise improve a frontend interface: websites, landing pages, dashboards, product UI, components, forms, settings, onboarding, empty states, and native iOS or Android screens. Handles UX review, hierarchy, layout, typography, color, motion, UX copy, accessibility, responsive behavior, edge cases, and capturing or documenting design systems (DESIGN.md, tokens). Also for making bland UI bolder, loud UI quieter, or ambitious visual effects. Not for backend-only or non-UI tasks."
4
- version: 4.8.0
4
+ version: 4.8.1
5
5
  license: Apache 2.0
6
6
  allowed-tools:
7
7
  - Bash(npx impeccable *)