@herbertgao/pi-extensions 2026.9.19 → 2026.9.20
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.
- package/README.md +1 -8
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +76 -59
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +76 -59
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/preview.webp +0 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +93 -34
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +346 -117
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +6 -36
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/index.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +24 -29
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +330 -360
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/index.ts +56 -108
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/session.ts +97 -15
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/subagent.ts +80 -45
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/flush-docked-bash.ts +36 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer-layout.ts +229 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +479 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/startup-header.ts +92 -61
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +58 -38
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/index.ts +19 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +1080 -229
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +232 -259
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +38 -48
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +8 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +2 -7
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +277 -113
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/layout.ts +15 -6
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +18 -72
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/scroll.ts +61 -26
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/ansi-utils.ts +25 -57
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-component.ts +125 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-edit-render.ts +227 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-header.ts +136 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-highlight.ts +115 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-inline.ts +324 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-layout.ts +762 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-limits.ts +152 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-palette.ts +410 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-parse.ts +535 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-renderer.ts +21 -3219
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-text.ts +44 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +568 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/index.ts +19 -18
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-execution.ts +1 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +142 -192
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/mcp-title.ts +39 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{message-display.ts → tool/message-display.ts} +24 -90
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +426 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +90 -132
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/{show-more-hint.ts → tool/show-more-hint.ts} +10 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/transcript-refresh.ts +8 -26
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-color.ts +44 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/ansi-text.ts +76 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/component-tree.ts +34 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +28 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/fullscreen-detect.ts +51 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/patch-keys.ts +124 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/sgr-mouse.ts +70 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +7 -7
- package/package.json +3 -7
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.en.svg +0 -101
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/hero.svg +0 -101
- package/node_modules/@herbertgao/pi-cc-extensions/assets/readme/welcome.webp +0 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/render-utils.ts +0 -5
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/types.ts +0 -30
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/write-display-utils.ts +0 -12
- package/node_modules/pi-footer/CHANGELOG.md +0 -145
- package/node_modules/pi-footer/LICENSE +0 -21
- package/node_modules/pi-footer/README.md +0 -354
- package/node_modules/pi-footer/package.json +0 -68
- package/node_modules/pi-footer/src/cache.ts +0 -106
- package/node_modules/pi-footer/src/colors.ts +0 -237
- package/node_modules/pi-footer/src/config.ts +0 -202
- package/node_modules/pi-footer/src/event-widgets.ts +0 -41
- package/node_modules/pi-footer/src/extension-statuses.ts +0 -102
- package/node_modules/pi-footer/src/git.ts +0 -135
- package/node_modules/pi-footer/src/index.ts +0 -268
- package/node_modules/pi-footer/src/metrics.ts +0 -141
- package/node_modules/pi-footer/src/presets.ts +0 -383
- package/node_modules/pi-footer/src/render.ts +0 -114
- package/node_modules/pi-footer/src/separators.ts +0 -52
- package/node_modules/pi-footer/src/types.ts +0 -122
- package/node_modules/pi-footer/src/ui/color-level-confirm.ts +0 -22
- package/node_modules/pi-footer/src/ui/color-options.ts +0 -195
- package/node_modules/pi-footer/src/ui/config-lifecycle.ts +0 -61
- package/node_modules/pi-footer/src/ui/edit-colors.ts +0 -13
- package/node_modules/pi-footer/src/ui/events.ts +0 -35
- package/node_modules/pi-footer/src/ui/extension-status-picker.ts +0 -60
- package/node_modules/pi-footer/src/ui/extension-statuses.ts +0 -73
- package/node_modules/pi-footer/src/ui/fields.ts +0 -252
- package/node_modules/pi-footer/src/ui/global-menu.ts +0 -126
- package/node_modules/pi-footer/src/ui/helpers.ts +0 -44
- package/node_modules/pi-footer/src/ui/layout.ts +0 -17
- package/node_modules/pi-footer/src/ui/line-list.ts +0 -19
- package/node_modules/pi-footer/src/ui/model.ts +0 -64
- package/node_modules/pi-footer/src/ui/navigation.ts +0 -29
- package/node_modules/pi-footer/src/ui/option-edit.ts +0 -93
- package/node_modules/pi-footer/src/ui/overlay-render.ts +0 -103
- package/node_modules/pi-footer/src/ui/screen-context.ts +0 -18
- package/node_modules/pi-footer/src/ui/screen-controller.ts +0 -27
- package/node_modules/pi-footer/src/ui/screen-render.ts +0 -32
- package/node_modules/pi-footer/src/ui/screen-state.ts +0 -20
- package/node_modules/pi-footer/src/ui/screen.ts +0 -243
- package/node_modules/pi-footer/src/ui/screens/add-widget.ts +0 -92
- package/node_modules/pi-footer/src/ui/screens/confirm-exit.ts +0 -52
- package/node_modules/pi-footer/src/ui/screens/controller.ts +0 -12
- package/node_modules/pi-footer/src/ui/screens/edit-colors.ts +0 -68
- package/node_modules/pi-footer/src/ui/screens/edit-widget.ts +0 -115
- package/node_modules/pi-footer/src/ui/screens/extension-status-row.ts +0 -61
- package/node_modules/pi-footer/src/ui/screens/global.ts +0 -75
- package/node_modules/pi-footer/src/ui/screens/line-list.ts +0 -108
- package/node_modules/pi-footer/src/ui/screens/main.ts +0 -99
- package/node_modules/pi-footer/src/ui/screens/terminal.ts +0 -121
- package/node_modules/pi-footer/src/ui/screens/widget-list.ts +0 -154
- package/node_modules/pi-footer/src/ui/terminal-menu.ts +0 -32
- package/node_modules/pi-footer/src/ui/theme.ts +0 -48
- package/node_modules/pi-footer/src/ui/title-bar.ts +0 -100
- package/node_modules/pi-footer/src/ui/widget-actions.ts +0 -76
- package/node_modules/pi-footer/src/ui.ts +0 -66
- package/node_modules/pi-footer/src/widgets/context.ts +0 -28
- package/node_modules/pi-footer/src/widgets/core/active-tools.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/context-window.ts +0 -24
- package/node_modules/pi-footer/src/widgets/core/cwd-basename.ts +0 -19
- package/node_modules/pi-footer/src/widgets/core/cwd.ts +0 -108
- package/node_modules/pi-footer/src/widgets/core/event.ts +0 -34
- package/node_modules/pi-footer/src/widgets/core/external-status.ts +0 -102
- package/node_modules/pi-footer/src/widgets/core/model-provider.ts +0 -20
- package/node_modules/pi-footer/src/widgets/core/model.ts +0 -35
- package/node_modules/pi-footer/src/widgets/core/provider.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/session-name.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/text-verbosity.ts +0 -17
- package/node_modules/pi-footer/src/widgets/core/thinking-level.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/ahead-behind.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/branch.ts +0 -81
- package/node_modules/pi-footer/src/widgets/git/clean.ts +0 -19
- package/node_modules/pi-footer/src/widgets/git/deletions.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/diff.ts +0 -38
- package/node_modules/pi-footer/src/widgets/git/insertions.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/remote.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/root.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/sha.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/staged.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/status.ts +0 -19
- package/node_modules/pi-footer/src/widgets/git/unstaged.ts +0 -17
- package/node_modules/pi-footer/src/widgets/git/untracked.ts +0 -17
- package/node_modules/pi-footer/src/widgets/instance.ts +0 -118
- package/node_modules/pi-footer/src/widgets/layout/custom-text.ts +0 -18
- package/node_modules/pi-footer/src/widgets/layout/flex-separator.ts +0 -32
- package/node_modules/pi-footer/src/widgets/layout/separator.ts +0 -57
- package/node_modules/pi-footer/src/widgets/layout/spacer.ts +0 -31
- package/node_modules/pi-footer/src/widgets/options.ts +0 -122
- package/node_modules/pi-footer/src/widgets/project/runtime.ts +0 -361
- package/node_modules/pi-footer/src/widgets/registry.ts +0 -223
- package/node_modules/pi-footer/src/widgets/session/assistant-messages.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/compactions.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/elapsed.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/last-activity.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/messages.ts +0 -19
- package/node_modules/pi-footer/src/widgets/session/session-id.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/session-start.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/tool-results.ts +0 -17
- package/node_modules/pi-footer/src/widgets/session/total-messages.ts +0 -19
- package/node_modules/pi-footer/src/widgets/session/total-time.ts +0 -18
- package/node_modules/pi-footer/src/widgets/session/user-messages.ts +0 -17
- package/node_modules/pi-footer/src/widgets/store.ts +0 -26
- package/node_modules/pi-footer/src/widgets/tokens/cache-hit-rate.ts +0 -55
- package/node_modules/pi-footer/src/widgets/tokens/cache-read.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/cache-write.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/context-bar.ts +0 -108
- package/node_modules/pi-footer/src/widgets/tokens/context-length.ts +0 -26
- package/node_modules/pi-footer/src/widgets/tokens/context-remaining.ts +0 -29
- package/node_modules/pi-footer/src/widgets/tokens/context.ts +0 -29
- package/node_modules/pi-footer/src/widgets/tokens/cost.ts +0 -51
- package/node_modules/pi-footer/src/widgets/tokens/input-speed.ts +0 -25
- package/node_modules/pi-footer/src/widgets/tokens/input-tokens.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/output-speed.ts +0 -25
- package/node_modules/pi-footer/src/widgets/tokens/output-tokens.ts +0 -18
- package/node_modules/pi-footer/src/widgets/tokens/tokens.ts +0 -20
- package/node_modules/pi-footer/src/widgets/tokens/total-speed.ts +0 -25
- package/node_modules/pi-footer/src/widgets/tokens/total-tokens.ts +0 -18
- package/node_modules/pi-footer/src/widgets/types.ts +0 -181
- package/node_modules/pi-footer/src/widgets/utils/colors.ts +0 -11
- package/node_modules/pi-footer/src/widgets/utils/context.ts +0 -112
- package/node_modules/pi-footer/src/widgets/utils/session.ts +0 -19
- package/node_modules/pi-footer/src/widgets/utils/token-format.ts +0 -78
|
@@ -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.
|
|
3
|
+
"version": "0.10.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,12 @@
|
|
|
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/
|
|
40
|
-
"video": "https://github.com/
|
|
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
|
|
44
|
-
"typecheck": "
|
|
43
|
+
"test": "node scripts/test.mjs",
|
|
44
|
+
"typecheck": "tsc --noEmit",
|
|
45
45
|
"format": "biome format --write .",
|
|
46
46
|
"format:check": "biome format ."
|
|
47
47
|
},
|
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
},
|
|
70
70
|
"x-upstream": {
|
|
71
71
|
"package": "pi-cc-extensions",
|
|
72
|
-
"version": "0.
|
|
72
|
+
"version": "0.9.9",
|
|
73
73
|
"reviewedVersion": "0.9.9",
|
|
74
74
|
"repository": "https://github.com/minuque/pi-cc-extensions",
|
|
75
|
-
"commit": "
|
|
75
|
+
"commit": "17d294bcdc5e9a7e68771f0c550440ed22738457"
|
|
76
76
|
}
|
|
77
77
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@herbertgao/pi-extensions",
|
|
3
|
-
"version": "2026.9.
|
|
3
|
+
"version": "2026.9.20",
|
|
4
4
|
"description": "Aggregate installer for HerbertGao-maintained Pi extensions.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"extensions",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@bufbuild/protobuf": "^2.14.0",
|
|
40
40
|
"@dietrichgebert/ponytail": "4.10.0",
|
|
41
41
|
"@herbertgao/pi-bark": "0.1.4",
|
|
42
|
-
"@herbertgao/pi-cc-extensions": "0.
|
|
42
|
+
"@herbertgao/pi-cc-extensions": "0.10.0",
|
|
43
43
|
"@herbertgao/pi-subagents": "0.18.4",
|
|
44
44
|
"@herbertgao/resume-from": "0.2.4",
|
|
45
45
|
"@herbertgao/sol-pi": "0.3.4",
|
|
@@ -62,7 +62,6 @@
|
|
|
62
62
|
"@tifan/pi-recap": "0.4.7",
|
|
63
63
|
"@tifan/pi-rename": "0.6.0",
|
|
64
64
|
"@typesafe-ai/sdk": "0.6.0",
|
|
65
|
-
"chalk": "^6.0.0",
|
|
66
65
|
"croner": "^10.0.1",
|
|
67
66
|
"dbus-native": "^0.15.2",
|
|
68
67
|
"defuddle": "0.19.3",
|
|
@@ -75,7 +74,6 @@
|
|
|
75
74
|
"nanoid": "^5.0.0",
|
|
76
75
|
"p-limit": "^6.1.0",
|
|
77
76
|
"pi-antigravity": "0.8.1",
|
|
78
|
-
"pi-footer": "0.5.1",
|
|
79
77
|
"pi-jev-auto-mode": "0.5.0",
|
|
80
78
|
"pi-lens": "4.3.0",
|
|
81
79
|
"pi-multi-account": "1.23.2",
|
|
@@ -126,7 +124,6 @@
|
|
|
126
124
|
"@tifan/pi-rename",
|
|
127
125
|
"grok-mermaid",
|
|
128
126
|
"pi-antigravity",
|
|
129
|
-
"pi-footer",
|
|
130
127
|
"pi-jev-auto-mode",
|
|
131
128
|
"pi-lens",
|
|
132
129
|
"pi-multi-account",
|
|
@@ -165,8 +162,7 @@
|
|
|
165
162
|
"./node_modules/pi-web-access/dist",
|
|
166
163
|
"./node_modules/pi-antigravity/src/index.ts",
|
|
167
164
|
"./node_modules/pi-typesafe/extensions/index.js",
|
|
168
|
-
"./node_modules/remote-pi/dist/index.js"
|
|
169
|
-
"./node_modules/pi-footer/src/index.ts"
|
|
165
|
+
"./node_modules/remote-pi/dist/index.js"
|
|
170
166
|
],
|
|
171
167
|
"themes": [
|
|
172
168
|
"./node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json",
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="400" viewBox="0 0 1200 400" role="img" aria-labelledby="title desc">
|
|
2
|
-
<title id="title">pi-cc-extensions
|
|
3
|
-
</title>
|
|
4
|
-
<desc id="desc">The Claude and Pi brand marks together connect three extension capabilities: Claude Code-style output, context inspection, and historical Session references.
|
|
5
|
-
</desc>
|
|
6
|
-
<defs>
|
|
7
|
-
<linearGradient id="panel" x1="0" y1="0" x2="1" y2="1">
|
|
8
|
-
<stop offset="0" stop-color="#0D131B"/>
|
|
9
|
-
<stop offset="1" stop-color="#090D12"/>
|
|
10
|
-
</linearGradient>
|
|
11
|
-
</defs>
|
|
12
|
-
<rect width="1200" height="400" rx="28" fill="url(#panel)"/>
|
|
13
|
-
<rect x="1" y="1" width="1198" height="398" rx="27" fill="none" stroke="#263241" stroke-width="2"/>
|
|
14
|
-
<g id="title-block" transform="translate(64 58)" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif">
|
|
15
|
-
<g font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="16" font-weight="600" letter-spacing="1.4">
|
|
16
|
-
<text x="0" y="0" fill="#66E3C4">PI EXTENSION
|
|
17
|
-
</text>
|
|
18
|
-
</g>
|
|
19
|
-
<text x="0" y="82" fill="#F4F7FA" font-size="54" font-weight="750" letter-spacing="-1.5">pi-cc-extensions
|
|
20
|
-
</text>
|
|
21
|
-
<text x="0" y="130" fill="#B8C3CF" font-size="23">Make Pi work like Claude Code 🙃
|
|
22
|
-
</text>
|
|
23
|
-
<g transform="translate(0 180)" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17">
|
|
24
|
-
<rect width="488" height="58" rx="12" fill="#111923" stroke="#2B3948"/>
|
|
25
|
-
<text x="20" y="36" fill="#66E3C4">›
|
|
26
|
-
</text>
|
|
27
|
-
<text x="44" y="36" fill="#F4F7FA">/ccstyle
|
|
28
|
-
</text>
|
|
29
|
-
<text x="155" y="36" fill="#536172">·
|
|
30
|
-
</text>
|
|
31
|
-
<text x="178" y="36" fill="#7CC7FF">/context
|
|
32
|
-
</text>
|
|
33
|
-
<text x="292" y="36" fill="#536172">·
|
|
34
|
-
</text>
|
|
35
|
-
<text x="315" y="36" fill="#F2C879">@session:
|
|
36
|
-
</text>
|
|
37
|
-
<rect x="411" y="22" width="9" height="20" rx="2" fill="#66E3C4"/>
|
|
38
|
-
</g>
|
|
39
|
-
<g transform="translate(0 282)" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="15">
|
|
40
|
-
<circle cx="6" cy="-5" r="6" fill="#66E3C4"/>
|
|
41
|
-
<text x="22" y="0" fill="#8B9AAD">3 EXTENSIONS
|
|
42
|
-
</text>
|
|
43
|
-
<text x="160" y="0" fill="#3B4857">•
|
|
44
|
-
</text>
|
|
45
|
-
<text x="183" y="0" fill="#8B9AAD">TYPESCRIPT
|
|
46
|
-
</text>
|
|
47
|
-
<text x="303" y="0" fill="#3B4857">•
|
|
48
|
-
</text>
|
|
49
|
-
<text x="326" y="0" fill="#8B9AAD">NODE ≥ 22.19
|
|
50
|
-
</text>
|
|
51
|
-
</g>
|
|
52
|
-
</g>
|
|
53
|
-
<g id="extension-map" transform="translate(662 48)" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif">
|
|
54
|
-
<g id="claude-pi-mark" transform="translate(0 0)">
|
|
55
|
-
<!-- Official Claude starburst vector; source: Anthropic Claude brand mark. -->
|
|
56
|
-
<path transform="translate(2 2) scale(.34)" fill="#D97757" d="m19.6 66.5 19.7-11 .3-1-.3-.5h-1l-3.3-.2-11.2-.3L14 53l-9.5-.5-2.4-.5L0 49l.2-1.5 2-1.3 2.9.2 6.3.5 9.5.6 6.9.4L38 49.1h1.6l.2-.7-.5-.4-.4-.4L29 41l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2 2.7-3 3.7.3.9.2 3.7 2.9 8 6.1L37 36l1.5 1.2.6-.4.1-.3-.7-1.1L33 25l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28 0l4.2.6L33.8 2l2.6 6 4.1 9.3L47 29.9l2 3.8 1 3.4.3 1h.7v-.5l.5-7.2 1-8.7 1-11.2.3-3.2 1.6-3.8 3-2L61 2.6l2 2.9-.3 1.8-1.1 7.7L59 27.1l-1.5 8.2h.9l1-1.1 4.1-5.4 6.9-8.6 3-3.5L77 13l2.3-1.8h4.3l3.1 4.7-1.4 4.9-4.4 5.6-3.7 4.7-5.3 7.1-3.2 5.7.3.4h.7l12-2.6 6.4-1.1 7.6-1.3 3.5 1.6.4 1.6-1.4 3.4-8.2 2-9.6 2-14.3 3.3-.2.1.2.3 6.4.6 2.8.2h6.8l12.6 1 3.3 2 1.9 2.7-.3 2-5.1 2.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6 4.5 8.3 7.5L89 80.1l.5 2.4-1.3 2-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8 2.7 9.8 14.7.5 4.5-.7 1.4-2.6 1-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9 30.2-1.3 1.5-3 1.2-2.5-2-1.4-3 1.4-6.2 1.6-8 1.3-6.4 1.2-7.9.7-2.6v-.2H49L43 72l-9 12.3-7.2 7.6-1.7.7-3-1.5.3-2.8L24 86l10-12.8 6-7.9 4-4.6-.1-.5h-.3L17.2 77.4l-4.7.6-2-2 .2-3 1-1 8-5.5Z"/>
|
|
57
|
-
<path d="M50 3V35" stroke="#3A4857" stroke-width="2"/>
|
|
58
|
-
<!-- Official Pi logo vectors; source: https://pi.dev/logo-auto.svg -->
|
|
59
|
-
<g transform="translate(52 -5) scale(.06)" fill="#F4F7FA">
|
|
60
|
-
<path fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/>
|
|
61
|
-
<path d="M517.36 400H634.72V634.72H517.36Z"/>
|
|
62
|
-
</g>
|
|
63
|
-
<text x="104" y="15" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="15" font-weight="700" letter-spacing=".8">CLAUDE CODE UX
|
|
64
|
-
</text>
|
|
65
|
-
<text x="104" y="34" fill="#7F8D9C" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="13" letter-spacing="1.2">FOR PI
|
|
66
|
-
</text>
|
|
67
|
-
</g>
|
|
68
|
-
<g transform="translate(0 52)">
|
|
69
|
-
<rect width="474" height="82" rx="14" fill="#101821" stroke="#2C3A48"/>
|
|
70
|
-
<rect width="5" height="82" rx="2.5" fill="#66E3C4"/>
|
|
71
|
-
<text x="26" y="32" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">/ccstyle
|
|
72
|
-
</text>
|
|
73
|
-
<text x="26" y="59" fill="#8B9AAD" font-size="16">Tool summaries · Diffs · Status bar
|
|
74
|
-
</text>
|
|
75
|
-
<circle cx="438" cy="29" r="9" fill="#66E3C4" opacity=".18"/>
|
|
76
|
-
<path d="M434 29l3 3 6-7" fill="none" stroke="#66E3C4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
77
|
-
</g>
|
|
78
|
-
<g transform="translate(0 144)">
|
|
79
|
-
<rect width="474" height="82" rx="14" fill="#101821" stroke="#2C3A48"/>
|
|
80
|
-
<rect width="5" height="82" rx="2.5" fill="#7CC7FF"/>
|
|
81
|
-
<text x="26" y="32" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">/context
|
|
82
|
-
</text>
|
|
83
|
-
<text x="26" y="59" fill="#8B9AAD" font-size="16">Usage breakdown · Injected content preview
|
|
84
|
-
</text>
|
|
85
|
-
<g transform="translate(416 23)">
|
|
86
|
-
<rect width="42" height="14" rx="7" fill="#1C2B38"/>
|
|
87
|
-
<rect width="27" height="14" rx="7" fill="#7CC7FF"/>
|
|
88
|
-
</g>
|
|
89
|
-
</g>
|
|
90
|
-
<g transform="translate(0 236)">
|
|
91
|
-
<rect width="474" height="82" rx="14" fill="#101821" stroke="#2C3A48"/>
|
|
92
|
-
<rect width="5" height="82" rx="2.5" fill="#F2C879"/>
|
|
93
|
-
<text x="26" y="32" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">@session:
|
|
94
|
-
</text>
|
|
95
|
-
<text x="26" y="59" fill="#8B9AAD" font-size="16">History completion · Cross-session references
|
|
96
|
-
</text>
|
|
97
|
-
<text x="431" y="40" fill="#F2C879" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="26">@
|
|
98
|
-
</text>
|
|
99
|
-
</g>
|
|
100
|
-
</g>
|
|
101
|
-
</svg>
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="1200" height="400" viewBox="0 0 1200 400" role="img" aria-labelledby="title desc">
|
|
2
|
-
<title id="title">pi-cc-extensions
|
|
3
|
-
</title>
|
|
4
|
-
<desc id="desc">Claude 与 Pi 品牌图标组合连接三项扩展能力:Claude Code 风格界面、上下文洞察和历史 Session 引用。
|
|
5
|
-
</desc>
|
|
6
|
-
<defs>
|
|
7
|
-
<linearGradient id="panel" x1="0" y1="0" x2="1" y2="1">
|
|
8
|
-
<stop offset="0" stop-color="#0D131B"/>
|
|
9
|
-
<stop offset="1" stop-color="#090D12"/>
|
|
10
|
-
</linearGradient>
|
|
11
|
-
</defs>
|
|
12
|
-
<rect width="1200" height="400" rx="28" fill="url(#panel)"/>
|
|
13
|
-
<rect x="1" y="1" width="1198" height="398" rx="27" fill="none" stroke="#263241" stroke-width="2"/>
|
|
14
|
-
<g id="title-block" transform="translate(64 58)" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif">
|
|
15
|
-
<g font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="16" font-weight="600" letter-spacing="1.4">
|
|
16
|
-
<text x="0" y="0" fill="#66E3C4">PI EXTENSION
|
|
17
|
-
</text>
|
|
18
|
-
</g>
|
|
19
|
-
<text x="0" y="82" fill="#F4F7FA" font-size="54" font-weight="750" letter-spacing="-1.5">pi-cc-extensions
|
|
20
|
-
</text>
|
|
21
|
-
<text x="0" y="130" fill="#B8C3CF" font-size="23">让 Pi 工作时表现像 Claude code 🙃
|
|
22
|
-
</text>
|
|
23
|
-
<g transform="translate(0 180)" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="17">
|
|
24
|
-
<rect width="488" height="58" rx="12" fill="#111923" stroke="#2B3948"/>
|
|
25
|
-
<text x="20" y="36" fill="#66E3C4">›
|
|
26
|
-
</text>
|
|
27
|
-
<text x="44" y="36" fill="#F4F7FA">/ccstyle
|
|
28
|
-
</text>
|
|
29
|
-
<text x="155" y="36" fill="#536172">·
|
|
30
|
-
</text>
|
|
31
|
-
<text x="178" y="36" fill="#7CC7FF">/context
|
|
32
|
-
</text>
|
|
33
|
-
<text x="292" y="36" fill="#536172">·
|
|
34
|
-
</text>
|
|
35
|
-
<text x="315" y="36" fill="#F2C879">@session:
|
|
36
|
-
</text>
|
|
37
|
-
<rect x="411" y="22" width="9" height="20" rx="2" fill="#66E3C4"/>
|
|
38
|
-
</g>
|
|
39
|
-
<g transform="translate(0 282)" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="15">
|
|
40
|
-
<circle cx="6" cy="-5" r="6" fill="#66E3C4"/>
|
|
41
|
-
<text x="22" y="0" fill="#8B9AAD">3 EXTENSIONS
|
|
42
|
-
</text>
|
|
43
|
-
<text x="160" y="0" fill="#3B4857">•
|
|
44
|
-
</text>
|
|
45
|
-
<text x="183" y="0" fill="#8B9AAD">TYPESCRIPT
|
|
46
|
-
</text>
|
|
47
|
-
<text x="303" y="0" fill="#3B4857">•
|
|
48
|
-
</text>
|
|
49
|
-
<text x="326" y="0" fill="#8B9AAD">NODE ≥ 22.19
|
|
50
|
-
</text>
|
|
51
|
-
</g>
|
|
52
|
-
</g>
|
|
53
|
-
<g id="extension-map" transform="translate(662 48)" font-family="-apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif">
|
|
54
|
-
<g id="claude-pi-mark" transform="translate(0 0)">
|
|
55
|
-
<!-- Official Claude starburst vector; source: Anthropic Claude brand mark. -->
|
|
56
|
-
<path transform="translate(2 2) scale(.34)" fill="#D97757" d="m19.6 66.5 19.7-11 .3-1-.3-.5h-1l-3.3-.2-11.2-.3L14 53l-9.5-.5-2.4-.5L0 49l.2-1.5 2-1.3 2.9.2 6.3.5 9.5.6 6.9.4L38 49.1h1.6l.2-.7-.5-.4-.4-.4L29 41l-10.6-7-5.6-4.1-3-2-1.5-2-.6-4.2 2.7-3 3.7.3.9.2 3.7 2.9 8 6.1L37 36l1.5 1.2.6-.4.1-.3-.7-1.1L33 25l-6-10.4-2.7-4.3-.7-2.6c-.3-1-.4-2-.4-3l3-4.2L28 0l4.2.6L33.8 2l2.6 6 4.1 9.3L47 29.9l2 3.8 1 3.4.3 1h.7v-.5l.5-7.2 1-8.7 1-11.2.3-3.2 1.6-3.8 3-2L61 2.6l2 2.9-.3 1.8-1.1 7.7L59 27.1l-1.5 8.2h.9l1-1.1 4.1-5.4 6.9-8.6 3-3.5L77 13l2.3-1.8h4.3l3.1 4.7-1.4 4.9-4.4 5.6-3.7 4.7-5.3 7.1-3.2 5.7.3.4h.7l12-2.6 6.4-1.1 7.6-1.3 3.5 1.6.4 1.6-1.4 3.4-8.2 2-9.6 2-14.3 3.3-.2.1.2.3 6.4.6 2.8.2h6.8l12.6 1 3.3 2 1.9 2.7-.3 2-5.1 2.6-6.8-1.6-16-3.8-5.4-1.3h-.8v.4l4.6 4.5 8.3 7.5L89 80.1l.5 2.4-1.3 2-1.4-.2-9.2-7-3.6-3-8-6.8h-.5v.7l1.8 2.7 9.8 14.7.5 4.5-.7 1.4-2.6 1-2.7-.6-5.8-8-6-9-4.7-8.2-.5.4-2.9 30.2-1.3 1.5-3 1.2-2.5-2-1.4-3 1.4-6.2 1.6-8 1.3-6.4 1.2-7.9.7-2.6v-.2H49L43 72l-9 12.3-7.2 7.6-1.7.7-3-1.5.3-2.8L24 86l10-12.8 6-7.9 4-4.6-.1-.5h-.3L17.2 77.4l-4.7.6-2-2 .2-3 1-1 8-5.5Z"/>
|
|
57
|
-
<path d="M50 3V35" stroke="#3A4857" stroke-width="2"/>
|
|
58
|
-
<!-- Official Pi logo vectors; source: https://pi.dev/logo-auto.svg -->
|
|
59
|
-
<g transform="translate(52 -5) scale(.06)" fill="#F4F7FA">
|
|
60
|
-
<path fill-rule="evenodd" d="M165.29 165.29H517.36V400H400V517.36H282.65V634.72H165.29ZM282.65 282.65V400H400V282.65Z"/>
|
|
61
|
-
<path d="M517.36 400H634.72V634.72H517.36Z"/>
|
|
62
|
-
</g>
|
|
63
|
-
<text x="104" y="15" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="15" font-weight="700" letter-spacing=".8">CLAUDE CODE UX
|
|
64
|
-
</text>
|
|
65
|
-
<text x="104" y="34" fill="#7F8D9C" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="13" letter-spacing="1.2">FOR PI
|
|
66
|
-
</text>
|
|
67
|
-
</g>
|
|
68
|
-
<g transform="translate(0 52)">
|
|
69
|
-
<rect width="474" height="82" rx="14" fill="#101821" stroke="#2C3A48"/>
|
|
70
|
-
<rect width="5" height="82" rx="2.5" fill="#66E3C4"/>
|
|
71
|
-
<text x="26" y="32" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">/ccstyle
|
|
72
|
-
</text>
|
|
73
|
-
<text x="26" y="59" fill="#8B9AAD" font-size="16">工具摘要 · Diff · 状态栏
|
|
74
|
-
</text>
|
|
75
|
-
<circle cx="438" cy="29" r="9" fill="#66E3C4" opacity=".18"/>
|
|
76
|
-
<path d="M434 29l3 3 6-7" fill="none" stroke="#66E3C4" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
77
|
-
</g>
|
|
78
|
-
<g transform="translate(0 144)">
|
|
79
|
-
<rect width="474" height="82" rx="14" fill="#101821" stroke="#2C3A48"/>
|
|
80
|
-
<rect width="5" height="82" rx="2.5" fill="#7CC7FF"/>
|
|
81
|
-
<text x="26" y="32" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">/context
|
|
82
|
-
</text>
|
|
83
|
-
<text x="26" y="59" fill="#8B9AAD" font-size="16">用量分布 · 注入内容预览
|
|
84
|
-
</text>
|
|
85
|
-
<g transform="translate(416 23)">
|
|
86
|
-
<rect width="42" height="14" rx="7" fill="#1C2B38"/>
|
|
87
|
-
<rect width="27" height="14" rx="7" fill="#7CC7FF"/>
|
|
88
|
-
</g>
|
|
89
|
-
</g>
|
|
90
|
-
<g transform="translate(0 236)">
|
|
91
|
-
<rect width="474" height="82" rx="14" fill="#101821" stroke="#2C3A48"/>
|
|
92
|
-
<rect width="5" height="82" rx="2.5" fill="#F2C879"/>
|
|
93
|
-
<text x="26" y="32" fill="#F4F7FA" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="18" font-weight="700">@session:
|
|
94
|
-
</text>
|
|
95
|
-
<text x="26" y="59" fill="#8B9AAD" font-size="16">历史补全 · 跨会话引用
|
|
96
|
-
</text>
|
|
97
|
-
<text x="431" y="40" fill="#F2C879" font-family="ui-monospace, SFMono-Regular, Menlo, Consolas, monospace" font-size="26">@
|
|
98
|
-
</text>
|
|
99
|
-
</g>
|
|
100
|
-
</g>
|
|
101
|
-
</svg>
|
|
Binary file
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
export type DiffViewMode = "auto" | "split" | "unified";
|
|
2
|
-
export type DiffIndicatorMode = "bars" | "classic" | "none";
|
|
3
|
-
|
|
4
|
-
export interface ToolDisplayConfig {
|
|
5
|
-
diffViewMode: DiffViewMode;
|
|
6
|
-
diffIndicatorMode: DiffIndicatorMode;
|
|
7
|
-
diffSplitMinWidth: number;
|
|
8
|
-
editDiffCollapsedLines: number;
|
|
9
|
-
/** Write-only collapsed body lines. 0 = `↳ created • click to show more`. */
|
|
10
|
-
writeDiffCollapsedLines: number;
|
|
11
|
-
diffWordWrap: boolean;
|
|
12
|
-
expandedPreviewMaxLines: number;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const DEFAULT_TOOL_DISPLAY_CONFIG: ToolDisplayConfig = {
|
|
16
|
-
diffViewMode: "auto",
|
|
17
|
-
diffIndicatorMode: "bars",
|
|
18
|
-
diffSplitMinWidth: 120,
|
|
19
|
-
/** Collapsed edit/diff body: ~half a typical terminal after chrome. */
|
|
20
|
-
editDiffCollapsedLines: 24,
|
|
21
|
-
/** Write create/overwrite collapsed body; 0 shows only the expand hint. */
|
|
22
|
-
writeDiffCollapsedLines: 0,
|
|
23
|
-
diffWordWrap: true,
|
|
24
|
-
/**
|
|
25
|
-
* Expanded tool/diff body cap. 40 ≈ one screen of content after title,
|
|
26
|
-
* Input section, editor, and status — keeps the TUI compact.
|
|
27
|
-
* Raise via /ccstyle → Diff → Expanded max lines when reviewing large dumps.
|
|
28
|
-
*/
|
|
29
|
-
expandedPreviewMaxLines: 40,
|
|
30
|
-
};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export function splitWriteContentLines(content: string): string[] {
|
|
2
|
-
if (!content) {
|
|
3
|
-
return [];
|
|
4
|
-
}
|
|
5
|
-
|
|
6
|
-
const normalized = content.replace(/\r\n?/g, "\n");
|
|
7
|
-
const lines = normalized.split("\n");
|
|
8
|
-
if (lines.length > 0 && lines[lines.length - 1] === "") {
|
|
9
|
-
lines.pop();
|
|
10
|
-
}
|
|
11
|
-
return lines;
|
|
12
|
-
}
|