pi-cc-extensions 0.7.9 → 0.7.11
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 +33 -2
- package/extensions/claude-code-style.ts +19 -16
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,9 +50,9 @@
|
|
|
50
50
|
|
|
51
51
|
`extensions/claude-code-style.ts` 提供:
|
|
52
52
|
|
|
53
|
-
- Claude Code
|
|
53
|
+
- Claude Code 风格的工具调用行与结果摘要(默认覆盖普通工具 renderer)
|
|
54
54
|
- Pi 默认输入栏
|
|
55
|
-
-
|
|
55
|
+
- 通过 `excludeRenderers` 保留指定工具的原生或扩展 renderer
|
|
56
56
|
- 工具结果的折叠与展开
|
|
57
57
|
- 类 claude code 滚动到底部 button
|
|
58
58
|
|
|
@@ -65,6 +65,17 @@
|
|
|
65
65
|
/ccstyle status # 查看状态
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
需要保留指定工具的原生或扩展 renderer 时,编辑 `~/.pi/agent/claude-code-style.json`:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{
|
|
72
|
+
"enabled": true,
|
|
73
|
+
"excludeRenderers": ["edit", "write"]
|
|
74
|
+
}
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
名单使用精确工具名;修改后执行 `/reload`。`Agent` 的专用 renderer 始终保留。
|
|
78
|
+
|
|
68
79
|
### 上下文窗口查看
|
|
69
80
|
|
|
70
81
|
`extensions/context.ts` 注册 `/context`,展示当前上下文窗口的使用分布,并可进一步预览:
|
|
@@ -141,3 +152,23 @@ pi install /absolute/path/to/pi-cc-extensions
|
|
|
141
152
|
|
|
142
153
|
- Node.js `>=22.19.0`
|
|
143
154
|
- 作为 Pi package 加载,入口由根目录 `package.json` 的 `pi.extensions` 显式声明
|
|
155
|
+
|
|
156
|
+
## 扩展推荐
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
| 扩展 | 作用 |
|
|
160
|
+
| ------------------------------------------ | ------------------------------------------------------------------------------- |
|
|
161
|
+
| `npm:pi-theme-picker` | 通过`/theme` 交互式切换 Pi 主题,支持模糊搜索和实时预览 |
|
|
162
|
+
| `npm:@juicesharp/rpiv-ask-user-question` | 提供`ask_user_question` 结构化问卷工具,支持单选、多选、预览和备注 |
|
|
163
|
+
| `npm:pi-mcp-adapter` | 将 MCP 服务接入 Pi,并通过代理工具按需发现,减少上下文占用 |
|
|
164
|
+
| `npm:@tintinweb/pi-subagents` | Claude Code 风格的并行 SubAgent、后台任务、任务编排、工作树隔离和自定义 Agent |
|
|
165
|
+
| `npm:@ayulab/pi-rewind` | 基于 checkpoint 的`/rewind` 回退,支持分别恢复代码、对话或两者 |
|
|
166
|
+
| `npm:pi-compact-thinking` | 将隐藏的思考块渲染为紧凑、带动画的推理预览 |
|
|
167
|
+
| `npm:pi-startup-header` | 用跟随当前主题配色的渐变 ASCII 标题替换默认启动头 |
|
|
168
|
+
| `npm:pi-zentui` | Starship 风格状态栏与 Opencode 风格编辑器,支持固定编辑器和 Git 状态 |
|
|
169
|
+
|
|
170
|
+
### 使用注意
|
|
171
|
+
|
|
172
|
+
- `pi-cc-extensions` 与 `pi-zentui` 都会修改 Pi 的 TUI / renderer。若出现布局或渲染冲突,建议先确定一个作为主要界面扩展,另一个按需停用。
|
|
173
|
+
- `pi-mcp-adapter` 默认延迟连接 MCP 服务,有助于节省上下文;包含凭据的 MCP 配置不要提交到仓库。
|
|
174
|
+
- `pi-compact-thinking` 和 `pi-zentui` 都涉及 Pi 内部 UI 行为,升级 Pi 后若出现异常,优先执行 `/reload` 或暂时停用对应扩展。
|
|
@@ -12,8 +12,8 @@ import { join } from "node:path";
|
|
|
12
12
|
/**
|
|
13
13
|
* Claude Code Style for pi
|
|
14
14
|
*
|
|
15
|
-
* Tool calls and results use a compact fallback renderer.
|
|
16
|
-
*
|
|
15
|
+
* Tool calls and results use a compact fallback renderer by default. Renderers
|
|
16
|
+
* listed in excludeRenderers remain untouched. A collapsed tool result can be
|
|
17
17
|
* clicked on its Ctrl+O hint to expand only that tool.
|
|
18
18
|
*
|
|
19
19
|
* Dynamic commands:
|
|
@@ -28,6 +28,7 @@ import { join } from "node:path";
|
|
|
28
28
|
|
|
29
29
|
type Config = {
|
|
30
30
|
enabled: boolean;
|
|
31
|
+
excludeRenderers: string[];
|
|
31
32
|
};
|
|
32
33
|
|
|
33
34
|
const CONFIG_PATH = join(homedir(), ".pi", "agent", "claude-code-style.json");
|
|
@@ -38,14 +39,18 @@ function loadConfig(): Config {
|
|
|
38
39
|
try {
|
|
39
40
|
if (existsSync(CONFIG_PATH)) {
|
|
40
41
|
const parsed = JSON.parse(readFileSync(CONFIG_PATH, "utf8")) as Partial<Config>;
|
|
42
|
+
const excludeRenderers = Array.isArray(parsed.excludeRenderers)
|
|
43
|
+
? [...new Set(parsed.excludeRenderers.filter((name): name is string => typeof name === "string" && name.length > 0))]
|
|
44
|
+
: [];
|
|
41
45
|
return {
|
|
42
46
|
enabled: parsed.enabled ?? true,
|
|
47
|
+
excludeRenderers,
|
|
43
48
|
};
|
|
44
49
|
}
|
|
45
50
|
} catch {
|
|
46
51
|
// Ignore bad config and fall back to defaults.
|
|
47
52
|
}
|
|
48
|
-
return { enabled: true };
|
|
53
|
+
return { enabled: true, excludeRenderers: [] };
|
|
49
54
|
}
|
|
50
55
|
|
|
51
56
|
function saveConfig() {
|
|
@@ -1069,10 +1074,9 @@ function createCcstyleTool(originalTool: any): any {
|
|
|
1069
1074
|
|
|
1070
1075
|
/**
|
|
1071
1076
|
* This extension does not register tools. ToolExecutionComponent is shared by
|
|
1072
|
-
* the TUI and exported by pi; patch its renderer lookup once so
|
|
1073
|
-
*
|
|
1074
|
-
*
|
|
1075
|
-
* fallback; subagents and extension-owned renderers keep their own output.
|
|
1077
|
+
* the TUI and exported by pi; patch its renderer lookup once so tools use the
|
|
1078
|
+
* same compact fallback shell by default. Tools named in excludeRenderers keep
|
|
1079
|
+
* their original renderer; subagent rendering remains protected.
|
|
1076
1080
|
*/
|
|
1077
1081
|
const GLOBAL_TOOL_RENDER_PATCH = Symbol.for("pi.ccstyle.global-tool-render-patch");
|
|
1078
1082
|
const COMPONENT_TOOL_RENDER_MODE = Symbol.for("pi.ccstyle.component-tool-render-mode");
|
|
@@ -1098,21 +1102,20 @@ function isMcpToolDefinition(definition: any, toolName: string): boolean {
|
|
|
1098
1102
|
return toolName === "mcp" || label === "MCP" || label.startsWith("MCP: ");
|
|
1099
1103
|
}
|
|
1100
1104
|
|
|
1101
|
-
/**
|
|
1102
|
-
* ToolExecutionComponent keeps extension-supplied and native definitions in
|
|
1103
|
-
* separate fields. Native renderers are eligible for ccstyle's fallback, while
|
|
1104
|
-
* an extension-owned dedicated renderer must remain untouched.
|
|
1105
|
-
*/
|
|
1105
|
+
/** Return true when this tool must keep its original renderer. */
|
|
1106
1106
|
export function preservesOriginalRenderer(
|
|
1107
1107
|
extensionDefinition: any,
|
|
1108
1108
|
toolName: string,
|
|
1109
1109
|
builtInToolDefinition?: any,
|
|
1110
|
+
excludeRenderers: readonly string[] = config.excludeRenderers,
|
|
1110
1111
|
): boolean {
|
|
1111
1112
|
if (SUBAGENT_TOOL_NAMES.has(toolName)) return true;
|
|
1112
|
-
if (!
|
|
1113
|
-
return extensionDefinition.
|
|
1114
|
-
|
|
1115
|
-
|| typeof
|
|
1113
|
+
if (!excludeRenderers.includes(toolName)) return false;
|
|
1114
|
+
return [extensionDefinition, builtInToolDefinition].some((definition) =>
|
|
1115
|
+
definition?.renderShell === "self"
|
|
1116
|
+
|| typeof definition?.renderCall === "function"
|
|
1117
|
+
|| typeof definition?.renderResult === "function",
|
|
1118
|
+
);
|
|
1116
1119
|
}
|
|
1117
1120
|
|
|
1118
1121
|
function shouldGloballyStyleTool(component: any, patch: GlobalToolRenderPatch): boolean {
|