@herbertgao/pi-extensions 2026.10.4 → 2026.10.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.
- package/README.md +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/README.en.md +13 -9
- package/node_modules/@herbertgao/pi-cc-extensions/README.md +13 -9
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/config.ts +72 -16
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/config/panel.ts +262 -48
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/agent-summary/core.ts +2 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/compact-thinking.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/context.ts +131 -28
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/index.ts +2 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/reference/subagent.ts +3 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer-currency.ts +29 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/footer.ts +96 -59
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/git-stats.ts +162 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/token-rate.ts +204 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/feature/shell/working-message.ts +51 -86
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/compact-mode.ts +212 -74
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/default-mode.ts +50 -362
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/index.ts +35 -3
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/markdown-enhance.ts +16 -83
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/hover.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/interaction.ts +28 -26
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/packets.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/mouse/sticky-prompt.ts +450 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ask-user-question.ts +173 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/ccstyle-tool.ts +467 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/codemode.ts +5 -9
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/ansi-utils.ts +1 -24
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-edit-render.ts +64 -11
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-limits.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-presentation.ts +41 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-renderer.ts +5 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-text.ts +2 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/diff-write-render.ts +36 -10
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/diff/line-width-safety.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/grouping.ts +140 -51
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/message-display.ts +1 -1
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/names.ts +44 -4
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/result.ts +34 -803
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-io.ts +735 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/tool-state.ts +138 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/format.ts +9 -0
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/utils/patch-keys.ts +5 -0
- package/node_modules/@herbertgao/pi-cc-extensions/package.json +5 -4
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-dark.json +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/themes/cc-light.json +3 -3
- package/node_modules/@herbertgao/pi-subagents/package.json +2 -1
- package/node_modules/@herbertgao/sol-pi/README.md +3 -3
- package/node_modules/@herbertgao/sol-pi/THIRD_PARTY_NOTICES.md +4 -4
- package/node_modules/@herbertgao/sol-pi/agents-install.md +3 -3
- package/node_modules/@herbertgao/sol-pi/docs/compatibility.md +1 -1
- package/package.json +2 -2
- package/node_modules/@herbertgao/pi-cc-extensions/extensions/renderer/tool/show-more-hint.ts +0 -48
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ Aggregate installer for HerbertGao-maintained Pi extensions and pinned upstream
|
|
|
8
8
|
pi install npm:@herbertgao/pi-extensions
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
-
Requires Node.js 24 or newer and Pi 1.0
|
|
11
|
+
Requires Node.js 24 or newer and Pi 1.2.0 or newer.
|
|
12
12
|
|
|
13
13
|
## Native MCP
|
|
14
14
|
|
|
@@ -46,7 +46,7 @@ Pi loads their extensions and skills through `node_modules/` paths inside one pa
|
|
|
46
46
|
|
|
47
47
|
The local `@herbertgao/resume-from` fork is retired. If it is installed separately, remove that package before upgrading the aggregate to avoid registering `/resume-from` twice. The aggregate now uses upstream `resume-from@0.4.1`; its v0.4.0 start-directory fix supersedes our local patch.
|
|
48
48
|
|
|
49
|
-
The locally customized CC and SoL-Pi packages now follow complete upstream baselines `pi-cc-extensions@0.
|
|
49
|
+
The locally customized CC and SoL-Pi packages now follow complete upstream baselines `pi-cc-extensions@1.0.3` and SoL-Pi main `e1a586af`, with local behavior replayed on top. Action Fusion and ccstyle write rich diffs coexist without disabling either feature. All four SoL-Pi features remain opt-in; its new non-persistent-session evidence archives remain on disk for consumers and require host or caller cleanup.
|
|
50
50
|
|
|
51
51
|
### Agency Agents
|
|
52
52
|
|
|
@@ -61,15 +61,15 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
|
|
|
61
61
|
"expandedOutputMaxLines": 10, // expanded tool Output lines; overflow shows a footer hint
|
|
62
62
|
"expandedPreviewMaxLines": 40, // max lines for expanded TaskList bodies (expanded diffs always show all)
|
|
63
63
|
"expandedCardBackground": "userMessageBg", // expanded card background slot: userMessageBg (same as user prompts) / toolPendingBg (neutral) etc.
|
|
64
|
-
"
|
|
64
|
+
"toolLabelClip": 0, // tool summary path/command clip length; 0 = fit width
|
|
65
65
|
"showStartupHeader": true, // startup header (logo + tips) toggle
|
|
66
|
-
"
|
|
66
|
+
"stickyUserMessage": true, // fullscreen: pin a user message's first line once it scrolls off the top edge, until the next one takes over
|
|
67
67
|
|
|
68
68
|
// diff
|
|
69
69
|
"diffViewMode": "auto", // layout: auto / split / unified
|
|
70
70
|
"diffIndicatorMode": "bars", // change indicators: bars / classic / none
|
|
71
71
|
"diffSplitMinWidth": 120, // min terminal width for side-by-side columns
|
|
72
|
-
"editDiffCollapsedLines": 24, //
|
|
72
|
+
"editDiffCollapsedLines": 24, // edit collapse lines; 0 = change-count summary only
|
|
73
73
|
"writeDiffCollapsedLines": 0, // write collapse lines; 0 = creation summary only
|
|
74
74
|
"diffWordWrap": true, // wrap long diff lines
|
|
75
75
|
|
|
@@ -81,7 +81,12 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
|
|
|
81
81
|
|
|
82
82
|
// footer
|
|
83
83
|
"enableCustomFooter": true, // custom status bar
|
|
84
|
+
"footerTokenRate": true, // output rate chip; false hides it
|
|
85
|
+
"footerTokenRateMode": "average", // average: whole-prompt avg; live: trailing 1s rate
|
|
86
|
+
"footerCurrency": "USD", // display currency for the footer cost
|
|
87
|
+
"footerCurrencyRate": null, // display units per 1 cost unit; null changes the symbol only
|
|
84
88
|
"footerNerdIcons": true, // Nerd Font glyphs for git/cache; false = plain text
|
|
89
|
+
"footerGitStatsMode": "working", // working (default): uncommitted; branch: cumulative net changes
|
|
85
90
|
"footerHiddenKeys": [], // hidden plugin chip keys
|
|
86
91
|
"footerLine1Keys": ["pi-usage"], // line1 plugin chip order; pi-usage is shown by default, data from @narumitw/pi-usage
|
|
87
92
|
"footerLine2Keys": [], // line2 plugin chip order (after cwd/git)
|
|
@@ -90,7 +95,7 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
|
|
|
90
95
|
```
|
|
91
96
|
|
|
92
97
|
> [!TIP]
|
|
93
|
-
> **Fullscreen**: click `click to show more` to expand tool cards, thinking, Skill, and compact summaries. An expanded diff always shows every line; when expanded Input/Output exceeds the line cap, the footer `… +N more lines · click to show more` opens a full preview. Click to collapse
|
|
98
|
+
> **Fullscreen**: click `click to show more` to expand tool cards, thinking, Skill, and compact summaries. An expanded diff always shows every line; when expanded Input/Output exceeds the line cap, the footer `… +N more lines · click to show more` opens a full preview. Click to collapse.
|
|
94
99
|
|
|
95
100
|
> [!NOTE]
|
|
96
101
|
> **Mermaid rendering**: set `markdown.mermaid` to `final` via `~/.pi/agent/settings.json` or the Mermaid diagrams option in `/settings`. Default `streaming` redraws per frame; `final` renders once at completion.
|
|
@@ -100,20 +105,19 @@ Renderer snapshots for `on` / `compact` modes: [default](./docs/tool-render-exam
|
|
|
100
105
|
```bash
|
|
101
106
|
npm test
|
|
102
107
|
npm run typecheck
|
|
103
|
-
./test.sh
|
|
104
|
-
test.bat
|
|
105
|
-
# one
|
|
108
|
+
./test.sh # macOS/Linux: load the local checkout for one run, then restore
|
|
109
|
+
./test.bat # Windows: runs test.sh through Git Bash
|
|
110
|
+
pi -e . # one run, does not edit settings.json
|
|
106
111
|
```
|
|
107
112
|
|
|
108
113
|
## Compatibility
|
|
109
114
|
|
|
110
|
-
- Node.js `>=24`; the monorepo uses Pi `1.0
|
|
115
|
+
- Node.js `>=24`; the monorepo uses Pi `1.2.0`, with published Pi peer versions kept at `*`.
|
|
111
116
|
|
|
112
117
|
## Recommended companions
|
|
113
118
|
|
|
114
119
|
| Extension | Purpose |
|
|
115
120
|
| ------------------------ | ----------------------------------------------------------- |
|
|
116
|
-
| `npm:@ff-labs/pi-fff` | FFF-powered fuzzy file and content search (fffind / ffgrep) |
|
|
117
121
|
| `npm:pi-web-access` | Web search, URL fetching, GitHub cloning, PDF/video parsing |
|
|
118
122
|
| `npm:@narumitw/pi-usage` | Current-account usage for Codex / Copilot / OpenRouter |
|
|
119
123
|
|
|
@@ -61,15 +61,15 @@ pi install git:github.com/HerbertGao/pi-extensions
|
|
|
61
61
|
"expandedOutputMaxLines": 10, // 展开工具卡 Output 可见行数,超出在末行显示展开提示
|
|
62
62
|
"expandedPreviewMaxLines": 40, // 展开 TaskList 正文最大行数(展开 diff 始终全量)
|
|
63
63
|
"expandedCardBackground": "userMessageBg", // 展开卡背景槽位;userMessageBg 与用户消息同色,toolPendingBg 为中性灰
|
|
64
|
-
"
|
|
64
|
+
"toolLabelClip": 0, // 工具摘要 path/command 折叠字符数;0 = 按可用宽度
|
|
65
65
|
"showStartupHeader": true, // 启动头(logo + tips)开关
|
|
66
|
-
"
|
|
66
|
+
"stickyUserMessage": true, // fullscreen:userMessage 正文首行滚出视口上沿后钉住,直到下一条指令接手
|
|
67
67
|
|
|
68
68
|
// diff
|
|
69
69
|
"diffViewMode": "auto", // 布局:auto / split / unified
|
|
70
70
|
"diffIndicatorMode": "bars", // 变更指示:bars / classic / none
|
|
71
71
|
"diffSplitMinWidth": 120, // 左右分栏的最小终端宽度
|
|
72
|
-
"editDiffCollapsedLines": 24, //
|
|
72
|
+
"editDiffCollapsedLines": 24, // edit 折叠行数;0 仅显示变更统计摘要
|
|
73
73
|
"writeDiffCollapsedLines": 0, // write 折叠行数,0 仅显示创建摘要
|
|
74
74
|
"diffWordWrap": true, // 长 diff 行换行
|
|
75
75
|
|
|
@@ -81,7 +81,12 @@ pi install git:github.com/HerbertGao/pi-extensions
|
|
|
81
81
|
|
|
82
82
|
// footer
|
|
83
83
|
"enableCustomFooter": true, // 自定义状态栏
|
|
84
|
+
"footerTokenRate": true, // 输出速率芯片;false 隐藏
|
|
85
|
+
"footerTokenRateMode": "average", // average:整段指令平均(avg);live:最近 1 秒瞬时(live)
|
|
86
|
+
"footerCurrency": "USD", // 底栏费用的显示币种
|
|
87
|
+
"footerCurrencyRate": null, // 1 单位费用换成多少显示币种;null 只换符号、不乘倍率
|
|
84
88
|
"footerNerdIcons": true, // git/缓存用 Nerd Font 图标;false 为纯文本
|
|
89
|
+
"footerGitStatsMode": "working", // working(默认):未提交改动;branch:分支累计净改动
|
|
85
90
|
"footerHiddenKeys": [], // 隐藏的插件芯片 key
|
|
86
91
|
"footerLine1Keys": ["pi-usage"], // line1 插件芯片顺序;pi-usage 默认显示,数据来自 @narumitw/pi-usage
|
|
87
92
|
"footerLine2Keys": [], // line2 插件芯片顺序(接在 cwd/git 后)
|
|
@@ -90,7 +95,7 @@ pi install git:github.com/HerbertGao/pi-extensions
|
|
|
90
95
|
```
|
|
91
96
|
|
|
92
97
|
> [!TIP]
|
|
93
|
-
> **全屏模式**:单击 `click to show more` 展开工具卡、思考、Skill 和 compact 摘要;工具卡展开态 diff 全量显示,Input/Output 超行时末行 `… +N more lines · click to show more`
|
|
98
|
+
> **全屏模式**:单击 `click to show more` 展开工具卡、思考、Skill 和 compact 摘要;工具卡展开态 diff 全量显示,Input/Output 超行时末行 `… +N more lines · click to show more` 打开全量预览,单击收起。
|
|
94
99
|
|
|
95
100
|
> [!NOTE]
|
|
96
101
|
> **Mermaid 渲染**:建议把 `markdown.mermaid` 设为 `final`(`~/.pi/agent/settings.json` 或 `/settings` 面板的 Mermaid diagrams 选项)。默认 `streaming` 逐帧重绘,`final` 渲染最终版更稳定。
|
|
@@ -100,20 +105,19 @@ pi install git:github.com/HerbertGao/pi-extensions
|
|
|
100
105
|
```bash
|
|
101
106
|
npm test
|
|
102
107
|
npm run typecheck
|
|
103
|
-
./test.sh
|
|
104
|
-
test.bat
|
|
105
|
-
|
|
108
|
+
./test.sh # macOS/Linux:临时加载本地检出,退出后还原
|
|
109
|
+
./test.bat # Windows:经 Git Bash 运行 test.sh
|
|
110
|
+
pi -e . # 只跑一次,不改 settings.json
|
|
106
111
|
```
|
|
107
112
|
|
|
108
113
|
## 兼容性
|
|
109
114
|
|
|
110
|
-
- Node.js `>=24`;monorepo 使用 Pi `1.0
|
|
115
|
+
- Node.js `>=24`;monorepo 使用 Pi `1.2.0`,发布包的 Pi peer 版本保持 `*`。
|
|
111
116
|
|
|
112
117
|
## 推荐搭配
|
|
113
118
|
|
|
114
119
|
| 扩展 | 用途 |
|
|
115
120
|
| ---------------------------------------- | ------------------------------------------------ |
|
|
116
|
-
| `npm:@ff-labs/pi-fff` | 模糊文件与内容检索(fffind / ffgrep) |
|
|
117
121
|
| `npm:pi-web-access` | 网页搜索、URL 抓取、GitHub 克隆、PDF/视频解析 |
|
|
118
122
|
| `npm:@narumitw/pi-usage` | 查看当前账号用量(Codex / Copilot / OpenRouter) |
|
|
119
123
|
|
|
@@ -13,11 +13,14 @@ export type CompactStyleMode = "on" | "compact" | "off";
|
|
|
13
13
|
|
|
14
14
|
export type DiffViewMode = "auto" | "split" | "unified";
|
|
15
15
|
export type DiffIndicatorMode = "bars" | "classic" | "none";
|
|
16
|
+
export type FooterGitStatsMode = "working" | "branch";
|
|
17
|
+
export type FooterTokenRateMode = "average" | "live";
|
|
16
18
|
|
|
17
19
|
export interface ToolDisplayConfig {
|
|
18
20
|
diffViewMode: DiffViewMode;
|
|
19
21
|
diffIndicatorMode: DiffIndicatorMode;
|
|
20
22
|
diffSplitMinWidth: number;
|
|
23
|
+
/** Edit-only collapsed body lines. 0 = change counts and an expand hint. */
|
|
21
24
|
editDiffCollapsedLines: number;
|
|
22
25
|
/** Write-only collapsed body lines. 0 = `↳ created · click to show more`. */
|
|
23
26
|
writeDiffCollapsedLines: number;
|
|
@@ -57,13 +60,14 @@ export type Config = {
|
|
|
57
60
|
expandedCardBackground: ThemeBg;
|
|
58
61
|
expandedInputMaxLines: number;
|
|
59
62
|
expandedOutputMaxLines: number;
|
|
60
|
-
|
|
63
|
+
toolLabelClip: number;
|
|
61
64
|
useSummaryTitlesAsThinkingTitle: boolean;
|
|
62
65
|
previewLines: number;
|
|
63
66
|
animationIntervalMs: number;
|
|
64
67
|
dimThinkingText: boolean;
|
|
65
68
|
showStartupHeader: boolean;
|
|
66
|
-
|
|
69
|
+
/** fullscreen:userMessage 正文首行滚出视口上沿后钉住,直到下一条指令接手。 */
|
|
70
|
+
stickyUserMessage: boolean;
|
|
67
71
|
enableSessionReference: boolean;
|
|
68
72
|
enableSubagentAutocomplete: boolean;
|
|
69
73
|
enableContextCommand: boolean;
|
|
@@ -71,7 +75,18 @@ export type Config = {
|
|
|
71
75
|
enableWorkingMessage: boolean;
|
|
72
76
|
enableAliases: boolean;
|
|
73
77
|
enableCustomFooter: boolean;
|
|
78
|
+
/** footer 输出速率芯片。关则不显示。 */
|
|
79
|
+
footerTokenRate: boolean;
|
|
80
|
+
/** average:整段指令墙钟平均;live:最近 1 秒瞬时速率,空档回退平均。 */
|
|
81
|
+
footerTokenRateMode: FooterTokenRateMode;
|
|
82
|
+
/** 速率芯片是否带 TTFT。关则只显示速率。 */
|
|
83
|
+
footerTokenRateTtft: boolean;
|
|
84
|
+
/** ISO 4217 显示币种。USD 时不换算。 */
|
|
85
|
+
footerCurrency: string;
|
|
86
|
+
/** 1 单位费用对应的显示币种数量。null 只换符号、不乘倍率。 */
|
|
87
|
+
footerCurrencyRate: number | null;
|
|
74
88
|
footerNerdIcons: boolean;
|
|
89
|
+
footerGitStatsMode: FooterGitStatsMode;
|
|
75
90
|
footerHiddenKeys: string[];
|
|
76
91
|
footerLine1Keys: string[];
|
|
77
92
|
footerLine2Keys: string[];
|
|
@@ -84,8 +99,10 @@ const LEGACY_CONFIG_PATH = join(AGENT_DIR, "claude-code-style.json");
|
|
|
84
99
|
|
|
85
100
|
export const DIFF_VIEW_MODES: DiffViewMode[] = ["auto", "split", "unified"];
|
|
86
101
|
export const DIFF_INDICATOR_MODES: DiffIndicatorMode[] = ["bars", "classic", "none"];
|
|
102
|
+
export const FOOTER_GIT_STATS_MODES: FooterGitStatsMode[] = ["working", "branch"];
|
|
103
|
+
export const FOOTER_TOKEN_RATE_MODES: FooterTokenRateMode[] = ["average", "live"];
|
|
87
104
|
export const DIFF_SPLIT_MIN_WIDTH_VALUES = ["80", "100", "120", "140", "160", "180"];
|
|
88
|
-
export const DIFF_COLLAPSED_LINES_VALUES = ["12", "24", "36", "48", "80", "120"];
|
|
105
|
+
export const DIFF_COLLAPSED_LINES_VALUES = ["0", "12", "24", "36", "48", "80", "120"];
|
|
89
106
|
/** Write collapsed presets. 0 = stats only (`+N -0` + expand hint). */
|
|
90
107
|
export const WRITE_DIFF_COLLAPSED_LINES_VALUES = ["0", "4", "8", "12", "24", "36"];
|
|
91
108
|
/** Presets for expanded body height — keep low options first so cycling stays TUI-friendly. */
|
|
@@ -109,11 +126,9 @@ export const EXPANDED_INPUT_MAX_LINES_VALUES = ["5", "10", "20", "40", "80"];
|
|
|
109
126
|
/** 展开工具卡 Output 可见行数预设。 */
|
|
110
127
|
export const EXPANDED_OUTPUT_MAX_LINES_VALUES = ["10", "20", "40", "80", "120"];
|
|
111
128
|
/** 工具摘要里 path/command 等输入的折叠字符数;0 = 只按可用宽度截断。 */
|
|
112
|
-
export const
|
|
129
|
+
export const TOOL_LABEL_CLIP_VALUES = ["0", "40", "60", "80", "100", "120", "160"];
|
|
113
130
|
export const THINKING_PREVIEW_LINES_VALUES = ["0", "1", "3", "5", "10"];
|
|
114
131
|
export const THINKING_ANIMATION_INTERVAL_VALUES = ["40", "60", "90", "120", "180"];
|
|
115
|
-
/** fullscreen 滚轮步进行数预设。 */
|
|
116
|
-
export const SCROLL_STEP_LINES_VALUES = ["1", "2", "3", "5", "10"];
|
|
117
132
|
/** Tools commonly toggled in excludeRenderers via the settings panel. */
|
|
118
133
|
export const EXCLUDE_RENDERER_CANDIDATES = [
|
|
119
134
|
"bash",
|
|
@@ -142,13 +157,13 @@ export const DEFAULT_CONFIG: Config = {
|
|
|
142
157
|
expandedCardBackground: "userMessageBg",
|
|
143
158
|
expandedInputMaxLines: 5,
|
|
144
159
|
expandedOutputMaxLines: 10,
|
|
145
|
-
|
|
160
|
+
toolLabelClip: 0,
|
|
146
161
|
useSummaryTitlesAsThinkingTitle: true,
|
|
147
162
|
previewLines: 3,
|
|
148
163
|
animationIntervalMs: 90,
|
|
149
164
|
dimThinkingText: false,
|
|
150
165
|
showStartupHeader: true,
|
|
151
|
-
|
|
166
|
+
stickyUserMessage: true,
|
|
152
167
|
enableSessionReference: true,
|
|
153
168
|
enableSubagentAutocomplete: true,
|
|
154
169
|
enableContextCommand: true,
|
|
@@ -156,7 +171,13 @@ export const DEFAULT_CONFIG: Config = {
|
|
|
156
171
|
enableWorkingMessage: true,
|
|
157
172
|
enableAliases: true,
|
|
158
173
|
enableCustomFooter: true,
|
|
174
|
+
footerTokenRate: true,
|
|
175
|
+
footerTokenRateMode: "average",
|
|
176
|
+
footerTokenRateTtft: true,
|
|
177
|
+
footerCurrency: "USD",
|
|
178
|
+
footerCurrencyRate: null,
|
|
159
179
|
footerNerdIcons: true,
|
|
180
|
+
footerGitStatsMode: "working",
|
|
160
181
|
...DEFAULT_FOOTER_CHIP_LAYOUT,
|
|
161
182
|
};
|
|
162
183
|
|
|
@@ -172,10 +193,10 @@ export function pickPositiveInt(value: unknown, fallback: number, min = 1, max =
|
|
|
172
193
|
return Math.min(max, Math.max(min, Math.floor(n)));
|
|
173
194
|
}
|
|
174
195
|
|
|
175
|
-
/**
|
|
176
|
-
export function
|
|
196
|
+
/** toolLabelClip:0 表示按宽度自适应,其余夹到 8..500。 */
|
|
197
|
+
export function pickToolLabelClip(value: unknown): number {
|
|
177
198
|
const n = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
178
|
-
return n === 0 ? 0 : pickPositiveInt(value, DEFAULT_CONFIG.
|
|
199
|
+
return n === 0 ? 0 : pickPositiveInt(value, DEFAULT_CONFIG.toolLabelClip, 8, 500);
|
|
179
200
|
}
|
|
180
201
|
|
|
181
202
|
export function pickPositiveNumber(value: unknown, fallback: number, min = 1): number {
|
|
@@ -183,6 +204,19 @@ export function pickPositiveNumber(value: unknown, fallback: number, min = 1): n
|
|
|
183
204
|
return Number.isFinite(n) ? Math.max(min, n) : fallback;
|
|
184
205
|
}
|
|
185
206
|
|
|
207
|
+
function normalizeCurrency(value: unknown): string {
|
|
208
|
+
return typeof value === "string" && /^[A-Za-z]{3}$/.test(value.trim())
|
|
209
|
+
? value.trim().toUpperCase()
|
|
210
|
+
: "USD";
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/** 缺失、空串、非正数都视为不换算。 */
|
|
214
|
+
function normalizeFooterCurrencyRate(value: unknown): number | null {
|
|
215
|
+
if (value === undefined || value === null || value === "") return null;
|
|
216
|
+
const n = typeof value === "number" ? value : typeof value === "string" ? Number(value) : NaN;
|
|
217
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
218
|
+
}
|
|
219
|
+
|
|
186
220
|
export function normalizeConfig(input: unknown): Config {
|
|
187
221
|
const source = (input && typeof input === "object" ? input : {}) as Record<string, unknown>;
|
|
188
222
|
const mode = pickEnum(source.mode, ["on", "compact", "off"], DEFAULT_CONFIG.mode);
|
|
@@ -213,7 +247,7 @@ export function normalizeConfig(input: unknown): Config {
|
|
|
213
247
|
editDiffCollapsedLines: pickPositiveInt(
|
|
214
248
|
source.editDiffCollapsedLines,
|
|
215
249
|
DEFAULT_CONFIG.editDiffCollapsedLines,
|
|
216
|
-
|
|
250
|
+
0,
|
|
217
251
|
500,
|
|
218
252
|
),
|
|
219
253
|
writeDiffCollapsedLines: pickPositiveInt(
|
|
@@ -246,7 +280,9 @@ export function normalizeConfig(input: unknown): Config {
|
|
|
246
280
|
1,
|
|
247
281
|
5_000,
|
|
248
282
|
),
|
|
249
|
-
|
|
283
|
+
toolLabelClip: pickToolLabelClip(
|
|
284
|
+
source.toolLabelClip ?? source.inputClip, // 兼容旧配置键
|
|
285
|
+
),
|
|
250
286
|
useSummaryTitlesAsThinkingTitle: source.useSummaryTitlesAsThinkingTitle !== false,
|
|
251
287
|
previewLines: pickPositiveInt(
|
|
252
288
|
source.previewLines,
|
|
@@ -260,7 +296,7 @@ export function normalizeConfig(input: unknown): Config {
|
|
|
260
296
|
),
|
|
261
297
|
dimThinkingText: source.dimThinkingText === true,
|
|
262
298
|
showStartupHeader: source.showStartupHeader !== false,
|
|
263
|
-
|
|
299
|
+
stickyUserMessage: source.stickyUserMessage !== false,
|
|
264
300
|
enableSessionReference: source.enableSessionReference !== false,
|
|
265
301
|
enableSubagentAutocomplete: source.enableSubagentAutocomplete !== false,
|
|
266
302
|
enableContextCommand: source.enableContextCommand !== false,
|
|
@@ -268,7 +304,21 @@ export function normalizeConfig(input: unknown): Config {
|
|
|
268
304
|
enableWorkingMessage: source.enableWorkingMessage !== false,
|
|
269
305
|
enableAliases: source.enableAliases !== false,
|
|
270
306
|
enableCustomFooter: source.enableCustomFooter !== false,
|
|
307
|
+
footerTokenRate: source.footerTokenRate !== false,
|
|
308
|
+
footerTokenRateMode: pickEnum(
|
|
309
|
+
source.footerTokenRateMode,
|
|
310
|
+
FOOTER_TOKEN_RATE_MODES,
|
|
311
|
+
DEFAULT_CONFIG.footerTokenRateMode,
|
|
312
|
+
),
|
|
313
|
+
footerTokenRateTtft: source.footerTokenRateTtft !== false,
|
|
314
|
+
footerCurrency: normalizeCurrency(source.footerCurrency),
|
|
315
|
+
footerCurrencyRate: normalizeFooterCurrencyRate(source.footerCurrencyRate),
|
|
271
316
|
footerNerdIcons: source.footerNerdIcons !== false,
|
|
317
|
+
footerGitStatsMode: pickEnum(
|
|
318
|
+
source.footerGitStatsMode,
|
|
319
|
+
FOOTER_GIT_STATS_MODES,
|
|
320
|
+
DEFAULT_CONFIG.footerGitStatsMode,
|
|
321
|
+
),
|
|
272
322
|
...normalizeFooterChipLayout(source),
|
|
273
323
|
};
|
|
274
324
|
}
|
|
@@ -310,13 +360,13 @@ export function formatConfigStatus(source: Config = config): string {
|
|
|
310
360
|
`expandedMax=${source.expandedPreviewMaxLines}`,
|
|
311
361
|
`expandedInput=${source.expandedInputMaxLines}`,
|
|
312
362
|
`expandedOutput=${source.expandedOutputMaxLines}`,
|
|
313
|
-
`
|
|
363
|
+
`toolLabelClip=${source.toolLabelClip}`,
|
|
314
364
|
`thinkingTitle=${source.useSummaryTitlesAsThinkingTitle ? "summary" : "default"}`,
|
|
315
365
|
`thinkingPreview=${source.previewLines}`,
|
|
316
366
|
`thinkingAnimation=${source.animationIntervalMs}ms`,
|
|
317
367
|
`thinkingDim=${source.dimThinkingText ? "on" : "off"}`,
|
|
318
368
|
`startupHeader=${source.showStartupHeader ? "on" : "off"}`,
|
|
319
|
-
`
|
|
369
|
+
`stickyUserMessage=${source.stickyUserMessage ? "on" : "off"}`,
|
|
320
370
|
`sessionRef=${source.enableSessionReference ? "on" : "off"}`,
|
|
321
371
|
`subagentAuto=${source.enableSubagentAutocomplete ? "on" : "off"}`,
|
|
322
372
|
`context=${source.enableContextCommand ? "on" : "off"}`,
|
|
@@ -324,7 +374,13 @@ export function formatConfigStatus(source: Config = config): string {
|
|
|
324
374
|
`workingMsg=${source.enableWorkingMessage ? "on" : "off"}`,
|
|
325
375
|
`aliases=${source.enableAliases ? "on" : "off"}`,
|
|
326
376
|
`footer=${source.enableCustomFooter ? "on" : "off"}`,
|
|
377
|
+
`footerTokenRate=${source.footerTokenRate ? "on" : "off"}`,
|
|
378
|
+
`footerTokenRateMode=${source.footerTokenRateMode}`,
|
|
379
|
+
`footerTokenRateTtft=${source.footerTokenRateTtft ? "on" : "off"}`,
|
|
380
|
+
`footerCurrency=${source.footerCurrency}`,
|
|
381
|
+
`footerRate=${source.footerCurrencyRate ?? "-"}`,
|
|
327
382
|
`footerIcons=${source.footerNerdIcons ? "nerd" : "plain"}`,
|
|
383
|
+
`footerGitStats=${source.footerGitStatsMode}`,
|
|
328
384
|
formatFooterChipSummary(source),
|
|
329
385
|
].join(" · ");
|
|
330
386
|
}
|