@kingingwang/pi-windows-arm64 0.99.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/CHANGELOG.md +86 -0
- package/bin/docs/cli.md +8 -18
- package/bin/docs/codemode.md +207 -0
- package/bin/docs/docs.json +5 -1
- package/bin/docs/environment-variables.md +2 -2
- package/bin/docs/extensions.md +3 -3
- package/bin/docs/index.md +1 -1
- package/bin/docs/mcp.md +142 -82
- package/bin/docs/models.md +22 -1
- package/bin/docs/providers.md +18 -6
- package/bin/docs/sdk.md +2 -2
- package/bin/docs/settings.md +5 -3
- package/bin/docs/usage.md +1 -1
- package/bin/examples/extensions/built-in-tool-renderer.ts +16 -40
- package/bin/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/bin/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/bin/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/bin/examples/extensions/gondolin/package-lock.json +2 -2
- package/bin/examples/extensions/gondolin/package.json +1 -1
- package/bin/examples/extensions/minimal-mode.ts +24 -96
- package/bin/examples/extensions/sandbox/package-lock.json +2 -2
- package/bin/examples/extensions/sandbox/package.json +1 -1
- package/bin/examples/extensions/with-deps/package-lock.json +2 -2
- package/bin/examples/extensions/with-deps/package.json +1 -1
- package/bin/examples/sdk/14-codemode-mcp.ts +2 -2
- package/bin/package.json +10 -10
- package/bin/pi.exe +2 -2
- package/package.json +1 -1
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
*
|
|
13
13
|
* How it works:
|
|
14
14
|
* - registerTool() with the same name as a built-in replaces it entirely
|
|
15
|
-
* - We create
|
|
16
|
-
* and
|
|
15
|
+
* - We create the original definitions via createReadToolDefinition(), etc.
|
|
16
|
+
* and override only their renderers
|
|
17
17
|
* - renderCall() controls what's shown when the tool is invoked
|
|
18
18
|
* - renderResult() controls what's shown after execution completes
|
|
19
19
|
* - renderShell: "self" lets a tool render its own outer shell instead of
|
|
@@ -26,23 +26,21 @@
|
|
|
26
26
|
*/
|
|
27
27
|
|
|
28
28
|
import type { BashToolDetails, EditToolDetails, ExtensionAPI, ReadToolDetails } from "@earendil-works/pi-coding-agent";
|
|
29
|
-
import {
|
|
29
|
+
import {
|
|
30
|
+
createBashToolDefinition,
|
|
31
|
+
createEditToolDefinition,
|
|
32
|
+
createReadToolDefinition,
|
|
33
|
+
createWriteToolDefinition,
|
|
34
|
+
} from "@earendil-works/pi-coding-agent";
|
|
30
35
|
import { Text } from "@earendil-works/pi-tui";
|
|
31
36
|
|
|
32
37
|
export default function (pi: ExtensionAPI) {
|
|
33
38
|
const cwd = process.cwd();
|
|
34
39
|
|
|
35
40
|
// --- Read tool: show path and line count ---
|
|
36
|
-
const originalRead =
|
|
41
|
+
const originalRead = createReadToolDefinition(cwd);
|
|
37
42
|
pi.registerTool({
|
|
38
|
-
|
|
39
|
-
label: "read",
|
|
40
|
-
description: originalRead.description,
|
|
41
|
-
parameters: originalRead.parameters,
|
|
42
|
-
|
|
43
|
-
async execute(toolCallId, params, signal, onUpdate) {
|
|
44
|
-
return originalRead.execute(toolCallId, params, signal, onUpdate);
|
|
45
|
-
},
|
|
43
|
+
...originalRead,
|
|
46
44
|
|
|
47
45
|
renderCall(args, theme, _context) {
|
|
48
46
|
let text = theme.fg("toolTitle", theme.bold("read "));
|
|
@@ -92,16 +90,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
92
90
|
});
|
|
93
91
|
|
|
94
92
|
// --- Bash tool: show command and exit code ---
|
|
95
|
-
const originalBash =
|
|
93
|
+
const originalBash = createBashToolDefinition(cwd);
|
|
96
94
|
pi.registerTool({
|
|
97
|
-
|
|
98
|
-
label: "bash",
|
|
99
|
-
description: originalBash.description,
|
|
100
|
-
parameters: originalBash.parameters,
|
|
101
|
-
|
|
102
|
-
async execute(toolCallId, params, signal, onUpdate) {
|
|
103
|
-
return originalBash.execute(toolCallId, params, signal, onUpdate);
|
|
104
|
-
},
|
|
95
|
+
...originalBash,
|
|
105
96
|
|
|
106
97
|
renderCall(args, theme, _context) {
|
|
107
98
|
let text = theme.fg("toolTitle", theme.bold("$ "));
|
|
@@ -151,17 +142,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
151
142
|
});
|
|
152
143
|
|
|
153
144
|
// --- Edit tool: show path and diff stats ---
|
|
154
|
-
const originalEdit =
|
|
145
|
+
const originalEdit = createEditToolDefinition(cwd);
|
|
155
146
|
pi.registerTool({
|
|
156
|
-
|
|
157
|
-
label: "edit",
|
|
158
|
-
description: originalEdit.description,
|
|
159
|
-
parameters: originalEdit.parameters,
|
|
160
|
-
renderShell: "self",
|
|
161
|
-
|
|
162
|
-
async execute(toolCallId, params, signal, onUpdate) {
|
|
163
|
-
return originalEdit.execute(toolCallId, params, signal, onUpdate);
|
|
164
|
-
},
|
|
147
|
+
...originalEdit,
|
|
165
148
|
|
|
166
149
|
renderCall(args, theme, _context) {
|
|
167
150
|
let text = theme.fg("toolTitle", theme.bold("edit "));
|
|
@@ -216,16 +199,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
216
199
|
});
|
|
217
200
|
|
|
218
201
|
// --- Write tool: show path and size ---
|
|
219
|
-
const originalWrite =
|
|
202
|
+
const originalWrite = createWriteToolDefinition(cwd);
|
|
220
203
|
pi.registerTool({
|
|
221
|
-
|
|
222
|
-
label: "write",
|
|
223
|
-
description: originalWrite.description,
|
|
224
|
-
parameters: originalWrite.parameters,
|
|
225
|
-
|
|
226
|
-
async execute(toolCallId, params, signal, onUpdate) {
|
|
227
|
-
return originalWrite.execute(toolCallId, params, signal, onUpdate);
|
|
228
|
-
},
|
|
204
|
+
...originalWrite,
|
|
229
205
|
|
|
230
206
|
renderCall(args, theme, _context) {
|
|
231
207
|
let text = theme.fg("toolTitle", theme.bold("write "));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "1.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-gondolin",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-gondolin",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "1.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@earendil-works/gondolin": "0.12.0"
|
|
12
12
|
}
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
|
|
19
19
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
20
20
|
import {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
createBashToolDefinition,
|
|
22
|
+
createEditToolDefinition,
|
|
23
|
+
createFindToolDefinition,
|
|
24
|
+
createGrepToolDefinition,
|
|
25
|
+
createLsToolDefinition,
|
|
26
|
+
createReadToolDefinition,
|
|
27
|
+
createWriteToolDefinition,
|
|
28
28
|
} from "@earendil-works/pi-coding-agent";
|
|
29
29
|
import { Text } from "@earendil-works/pi-tui";
|
|
30
30
|
import { homedir } from "os";
|
|
@@ -40,45 +40,26 @@ function shortenPath(path: string): string {
|
|
|
40
40
|
return path;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
// Cache for built-in tools by cwd
|
|
44
|
-
const toolCache = new Map<string, ReturnType<typeof createBuiltInTools>>();
|
|
45
|
-
|
|
46
43
|
function createBuiltInTools(cwd: string) {
|
|
47
44
|
return {
|
|
48
|
-
read:
|
|
49
|
-
bash:
|
|
50
|
-
edit:
|
|
51
|
-
write:
|
|
52
|
-
find:
|
|
53
|
-
grep:
|
|
54
|
-
ls:
|
|
45
|
+
read: createReadToolDefinition(cwd),
|
|
46
|
+
bash: createBashToolDefinition(cwd),
|
|
47
|
+
edit: createEditToolDefinition(cwd),
|
|
48
|
+
write: createWriteToolDefinition(cwd),
|
|
49
|
+
find: createFindToolDefinition(cwd),
|
|
50
|
+
grep: createGrepToolDefinition(cwd),
|
|
51
|
+
ls: createLsToolDefinition(cwd),
|
|
55
52
|
};
|
|
56
53
|
}
|
|
57
54
|
|
|
58
|
-
function getBuiltInTools(cwd: string) {
|
|
59
|
-
let tools = toolCache.get(cwd);
|
|
60
|
-
if (!tools) {
|
|
61
|
-
tools = createBuiltInTools(cwd);
|
|
62
|
-
toolCache.set(cwd, tools);
|
|
63
|
-
}
|
|
64
|
-
return tools;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
55
|
export default function (pi: ExtensionAPI) {
|
|
56
|
+
const tools = createBuiltInTools(process.cwd());
|
|
57
|
+
|
|
68
58
|
// =========================================================================
|
|
69
59
|
// Read Tool
|
|
70
60
|
// =========================================================================
|
|
71
61
|
pi.registerTool({
|
|
72
|
-
|
|
73
|
-
label: "read",
|
|
74
|
-
description:
|
|
75
|
-
"Read the contents of a file. Supports text files and images (jpg, png, gif, webp). Images are sent as attachments. For text files, output is truncated to 2000 lines or 50KB (whichever is hit first). Use offset/limit for large files.",
|
|
76
|
-
parameters: getBuiltInTools(process.cwd()).read.parameters,
|
|
77
|
-
|
|
78
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
79
|
-
const tools = getBuiltInTools(ctx.cwd);
|
|
80
|
-
return tools.read.execute(toolCallId, params, signal, onUpdate);
|
|
81
|
-
},
|
|
62
|
+
...tools.read,
|
|
82
63
|
|
|
83
64
|
renderCall(args, theme, _context) {
|
|
84
65
|
const path = shortenPath(args.path || "");
|
|
@@ -116,16 +97,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
116
97
|
// Bash Tool
|
|
117
98
|
// =========================================================================
|
|
118
99
|
pi.registerTool({
|
|
119
|
-
|
|
120
|
-
label: "bash",
|
|
121
|
-
description:
|
|
122
|
-
"Execute a bash command in the current working directory. Returns stdout and stderr. Output is truncated to last 2000 lines or 50KB (whichever is hit first).",
|
|
123
|
-
parameters: getBuiltInTools(process.cwd()).bash.parameters,
|
|
124
|
-
|
|
125
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
126
|
-
const tools = getBuiltInTools(ctx.cwd);
|
|
127
|
-
return tools.bash.execute(toolCallId, params, signal, onUpdate);
|
|
128
|
-
},
|
|
100
|
+
...tools.bash,
|
|
129
101
|
|
|
130
102
|
renderCall(args, theme, _context) {
|
|
131
103
|
const command = args.command || "...";
|
|
@@ -165,16 +137,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
165
137
|
// Write Tool
|
|
166
138
|
// =========================================================================
|
|
167
139
|
pi.registerTool({
|
|
168
|
-
|
|
169
|
-
label: "write",
|
|
170
|
-
description:
|
|
171
|
-
"Write content to a file. Creates the file if it doesn't exist, overwrites if it does. Automatically creates parent directories.",
|
|
172
|
-
parameters: getBuiltInTools(process.cwd()).write.parameters,
|
|
173
|
-
|
|
174
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
175
|
-
const tools = getBuiltInTools(ctx.cwd);
|
|
176
|
-
return tools.write.execute(toolCallId, params, signal, onUpdate);
|
|
177
|
-
},
|
|
140
|
+
...tools.write,
|
|
178
141
|
|
|
179
142
|
renderCall(args, theme, _context) {
|
|
180
143
|
const path = shortenPath(args.path || "");
|
|
@@ -207,16 +170,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
207
170
|
// Edit Tool
|
|
208
171
|
// =========================================================================
|
|
209
172
|
pi.registerTool({
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
description:
|
|
213
|
-
"Edit a file by replacing exact text. The oldText must match exactly (including whitespace). Use this for precise, surgical edits.",
|
|
214
|
-
parameters: getBuiltInTools(process.cwd()).edit.parameters,
|
|
215
|
-
|
|
216
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
217
|
-
const tools = getBuiltInTools(ctx.cwd);
|
|
218
|
-
return tools.edit.execute(toolCallId, params, signal, onUpdate);
|
|
219
|
-
},
|
|
173
|
+
...tools.edit,
|
|
174
|
+
renderShell: "default",
|
|
220
175
|
|
|
221
176
|
renderCall(args, theme, _context) {
|
|
222
177
|
const path = shortenPath(args.path || "");
|
|
@@ -252,16 +207,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
252
207
|
// Find Tool
|
|
253
208
|
// =========================================================================
|
|
254
209
|
pi.registerTool({
|
|
255
|
-
|
|
256
|
-
label: "find",
|
|
257
|
-
description:
|
|
258
|
-
"Find files by name pattern (glob). Searches recursively from the specified path. Output limited to 200 results.",
|
|
259
|
-
parameters: getBuiltInTools(process.cwd()).find.parameters,
|
|
260
|
-
|
|
261
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
262
|
-
const tools = getBuiltInTools(ctx.cwd);
|
|
263
|
-
return tools.find.execute(toolCallId, params, signal, onUpdate);
|
|
264
|
-
},
|
|
210
|
+
...tools.find,
|
|
265
211
|
|
|
266
212
|
renderCall(args, theme, _context) {
|
|
267
213
|
const pattern = args.pattern || "";
|
|
@@ -310,16 +256,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
310
256
|
// Grep Tool
|
|
311
257
|
// =========================================================================
|
|
312
258
|
pi.registerTool({
|
|
313
|
-
|
|
314
|
-
label: "grep",
|
|
315
|
-
description:
|
|
316
|
-
"Search file contents by regex pattern. Uses ripgrep for fast searching. Output limited to 200 matches.",
|
|
317
|
-
parameters: getBuiltInTools(process.cwd()).grep.parameters,
|
|
318
|
-
|
|
319
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
320
|
-
const tools = getBuiltInTools(ctx.cwd);
|
|
321
|
-
return tools.grep.execute(toolCallId, params, signal, onUpdate);
|
|
322
|
-
},
|
|
259
|
+
...tools.grep,
|
|
323
260
|
|
|
324
261
|
renderCall(args, theme, _context) {
|
|
325
262
|
const pattern = args.pattern || "";
|
|
@@ -372,16 +309,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
372
309
|
// Ls Tool
|
|
373
310
|
// =========================================================================
|
|
374
311
|
pi.registerTool({
|
|
375
|
-
|
|
376
|
-
label: "ls",
|
|
377
|
-
description:
|
|
378
|
-
"List directory contents with file sizes. Shows files and directories with their sizes. Output limited to 500 entries.",
|
|
379
|
-
parameters: getBuiltInTools(process.cwd()).ls.parameters,
|
|
380
|
-
|
|
381
|
-
async execute(toolCallId, params, signal, onUpdate, ctx) {
|
|
382
|
-
const tools = getBuiltInTools(ctx.cwd);
|
|
383
|
-
return tools.ls.execute(toolCallId, params, signal, onUpdate);
|
|
384
|
-
},
|
|
312
|
+
...tools.ls,
|
|
385
313
|
|
|
386
314
|
renderCall(args, theme, _context) {
|
|
387
315
|
const path = shortenPath(args.path || ".");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-sandbox",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-sandbox",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "1.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sandbox-runtime": "^0.0.26"
|
|
12
12
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "0.
|
|
9
|
+
"version": "1.0.0",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
*
|
|
7
7
|
* `codemode` and `tool_search` are registered inactive. Enable them through the `defaultTools` setting
|
|
8
8
|
* (`tools` would also restrict the session to the named tools, which hides MCP tools), or let the
|
|
9
|
-
* MCP extension activate them: `codemode` for servers with `codemode`
|
|
10
|
-
*
|
|
9
|
+
* MCP extension activate them: `codemode` for servers with `codemode` exposure, `tool_search` for
|
|
10
|
+
* servers with `deferred` exposure.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import {
|
package/bin/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@earendil-works/pi-coding-agent",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"prepublishOnly": "npm run clean && npm run build && npm run shrinkwrap"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@earendil-works/chord": "^0.
|
|
53
|
-
"@earendil-works/pi-agent-core": "^0.
|
|
54
|
-
"@earendil-works/pi-ai": "^0.
|
|
55
|
-
"@earendil-works/pi-codemode": "^0.
|
|
56
|
-
"@earendil-works/pi-mcp": "^0.
|
|
57
|
-
"@earendil-works/pi-tui": "^0.
|
|
52
|
+
"@earendil-works/chord": "^1.0.0",
|
|
53
|
+
"@earendil-works/pi-agent-core": "^1.0.0",
|
|
54
|
+
"@earendil-works/pi-ai": "^1.0.0",
|
|
55
|
+
"@earendil-works/pi-codemode": "^1.0.0",
|
|
56
|
+
"@earendil-works/pi-mcp": "^1.0.0",
|
|
57
|
+
"@earendil-works/pi-tui": "^1.0.0",
|
|
58
58
|
"@silvia-odwyer/photon-node": "0.3.4",
|
|
59
59
|
"chalk": "6.0.0",
|
|
60
60
|
"cross-spawn": "7.0.6",
|
|
@@ -76,9 +76,9 @@
|
|
|
76
76
|
"protobufjs": "7.6.6"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
|
-
"@earendil-works/pi-client": "^0.
|
|
80
|
-
"@earendil-works/pi-protocol": "^0.
|
|
81
|
-
"@earendil-works/pi-server": "^0.
|
|
79
|
+
"@earendil-works/pi-client": "^1.0.0",
|
|
80
|
+
"@earendil-works/pi-protocol": "^1.0.0",
|
|
81
|
+
"@earendil-works/pi-server": "^1.0.0",
|
|
82
82
|
"@types/cross-spawn": "6.0.6",
|
|
83
83
|
"@types/hosted-git-info": "3.0.5",
|
|
84
84
|
"@types/node": "22.19.19",
|
package/bin/pi.exe
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
[diffend] Oversized file quarantined before diffing.
|
|
2
2
|
name: package/bin/pi.exe
|
|
3
|
-
size:
|
|
4
|
-
sha256:
|
|
3
|
+
size: 107836928 bytes
|
|
4
|
+
sha256: 72db5e41e8debef3dbc1e7df2ad86bd9929696a11d99a42dec917716eafb0526
|