@mariozechner/pi-coding-agent 0.51.2 → 0.51.4
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/CHANGELOG.md +37 -0
- package/README.md +5 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +1 -1
- package/dist/cli/args.js.map +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +49 -2
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +2 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +4 -0
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +1 -0
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -0
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/package-manager.d.ts +2 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +43 -11
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/sdk.d.ts +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +7 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/slash-commands.d.ts +15 -0
- package/dist/core/slash-commands.d.ts.map +1 -0
- package/dist/core/slash-commands.js +21 -0
- package/dist/core/slash-commands.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +60 -12
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +31 -46
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +1 -1
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +1 -1
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/extensions.md +25 -0
- package/docs/images/exy.png +0 -0
- package/docs/packages.md +3 -1
- package/docs/rpc.md +2 -2
- package/examples/extensions/commands.ts +72 -0
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/notify.ts +41 -11
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Commands Extension
|
|
3
|
+
*
|
|
4
|
+
* Demonstrates the pi.getCommands() API by providing a /commands command
|
|
5
|
+
* that lists all available slash commands in the current session.
|
|
6
|
+
*
|
|
7
|
+
* Usage:
|
|
8
|
+
* 1. Copy this file to ~/.pi/agent/extensions/ or your project's .pi/extensions/
|
|
9
|
+
* 2. Use /commands to see available commands
|
|
10
|
+
* 3. Use /commands extensions to filter by source
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import type { ExtensionAPI, SlashCommandInfo } from "@mariozechner/pi-coding-agent";
|
|
14
|
+
|
|
15
|
+
export default function commandsExtension(pi: ExtensionAPI) {
|
|
16
|
+
pi.registerCommand("commands", {
|
|
17
|
+
description: "List available slash commands",
|
|
18
|
+
getArgumentCompletions: (prefix) => {
|
|
19
|
+
const sources = ["extension", "prompt", "skill"];
|
|
20
|
+
const filtered = sources.filter((s) => s.startsWith(prefix));
|
|
21
|
+
return filtered.length > 0 ? filtered.map((s) => ({ value: s, label: s })) : null;
|
|
22
|
+
},
|
|
23
|
+
handler: async (args, ctx) => {
|
|
24
|
+
const commands = pi.getCommands();
|
|
25
|
+
const sourceFilter = args.trim() as "extension" | "prompt" | "skill" | "";
|
|
26
|
+
|
|
27
|
+
// Filter by source if specified
|
|
28
|
+
const filtered = sourceFilter ? commands.filter((c) => c.source === sourceFilter) : commands;
|
|
29
|
+
|
|
30
|
+
if (filtered.length === 0) {
|
|
31
|
+
ctx.ui.notify(sourceFilter ? `No ${sourceFilter} commands found` : "No commands found", "info");
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Build selection items grouped by source
|
|
36
|
+
const formatCommand = (cmd: SlashCommandInfo): string => {
|
|
37
|
+
const desc = cmd.description ? ` - ${cmd.description}` : "";
|
|
38
|
+
return `/${cmd.name}${desc}`;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const items: string[] = [];
|
|
42
|
+
const sources: Array<{ key: "extension" | "prompt" | "skill"; label: string }> = [
|
|
43
|
+
{ key: "extension", label: "Extensions" },
|
|
44
|
+
{ key: "prompt", label: "Prompts" },
|
|
45
|
+
{ key: "skill", label: "Skills" },
|
|
46
|
+
];
|
|
47
|
+
|
|
48
|
+
for (const { key, label } of sources) {
|
|
49
|
+
const cmds = filtered.filter((c) => c.source === key);
|
|
50
|
+
if (cmds.length > 0) {
|
|
51
|
+
items.push(`--- ${label} ---`);
|
|
52
|
+
items.push(...cmds.map(formatCommand));
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Show in a selector (user can scroll and see all commands)
|
|
57
|
+
const selected = await ctx.ui.select("Available Commands", items);
|
|
58
|
+
|
|
59
|
+
// If user selected a command (not a header), offer to show its path
|
|
60
|
+
if (selected && !selected.startsWith("---")) {
|
|
61
|
+
const cmdName = selected.split(" - ")[0].slice(1); // Remove leading /
|
|
62
|
+
const cmd = commands.find((c) => c.name === cmdName);
|
|
63
|
+
if (cmd?.path) {
|
|
64
|
+
const showPath = await ctx.ui.confirm(cmd.name, `View source path?\n${cmd.path}`);
|
|
65
|
+
if (showPath) {
|
|
66
|
+
ctx.ui.notify(cmd.path, "info");
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-custom-provider",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-custom-provider",
|
|
9
|
-
"version": "1.2.
|
|
9
|
+
"version": "1.2.4",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"@anthropic-ai/sdk": "^0.52.0"
|
|
12
12
|
}
|
|
@@ -1,23 +1,53 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Pi Notify Extension
|
|
3
3
|
*
|
|
4
|
-
* Sends a native
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* Sends a native terminal notification when Pi agent is done and waiting for input.
|
|
5
|
+
* Supports multiple terminal protocols:
|
|
6
|
+
* - OSC 777: Ghostty, iTerm2, WezTerm, rxvt-unicode
|
|
7
|
+
* - OSC 99: Kitty
|
|
8
|
+
* - Windows toast: Windows Terminal (WSL)
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
11
|
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
function windowsToastScript(title: string, body: string): string {
|
|
14
|
+
const type = "Windows.UI.Notifications";
|
|
15
|
+
const mgr = `[${type}.ToastNotificationManager, ${type}, ContentType = WindowsRuntime]`;
|
|
16
|
+
const template = `[${type}.ToastTemplateType]::ToastText01`;
|
|
17
|
+
const toast = `[${type}.ToastNotification]::new($xml)`;
|
|
18
|
+
return [
|
|
19
|
+
`${mgr} > $null`,
|
|
20
|
+
`$xml = [${type}.ToastNotificationManager]::GetTemplateContent(${template})`,
|
|
21
|
+
`$xml.GetElementsByTagName('text')[0].AppendChild($xml.CreateTextNode('${body}')) > $null`,
|
|
22
|
+
`[${type}.ToastNotificationManager]::CreateToastNotifier('${title}').Show(${toast})`,
|
|
23
|
+
].join("; ");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
function notifyOSC777(title: string, body: string): void {
|
|
18
27
|
process.stdout.write(`\x1b]777;notify;${title};${body}\x07`);
|
|
19
28
|
}
|
|
20
29
|
|
|
30
|
+
function notifyOSC99(title: string, body: string): void {
|
|
31
|
+
// Kitty OSC 99: i=notification id, d=0 means not done yet, p=body for second part
|
|
32
|
+
process.stdout.write(`\x1b]99;i=1:d=0;${title}\x1b\\`);
|
|
33
|
+
process.stdout.write(`\x1b]99;i=1:p=body;${body}\x1b\\`);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function notifyWindows(title: string, body: string): void {
|
|
37
|
+
const { execFile } = require("child_process");
|
|
38
|
+
execFile("powershell.exe", ["-NoProfile", "-Command", windowsToastScript(title, body)]);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function notify(title: string, body: string): void {
|
|
42
|
+
if (process.env.WT_SESSION) {
|
|
43
|
+
notifyWindows(title, body);
|
|
44
|
+
} else if (process.env.KITTY_WINDOW_ID) {
|
|
45
|
+
notifyOSC99(title, body);
|
|
46
|
+
} else {
|
|
47
|
+
notifyOSC777(title, body);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
21
51
|
export default function (pi: ExtensionAPI) {
|
|
22
52
|
pi.on("agent_end", async () => {
|
|
23
53
|
notify("Pi", "Ready for input");
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-extension-with-deps",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pi-extension-with-deps",
|
|
9
|
-
"version": "1.15.
|
|
9
|
+
"version": "1.15.4",
|
|
10
10
|
"dependencies": {
|
|
11
11
|
"ms": "^2.1.3"
|
|
12
12
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mariozechner/pi-coding-agent",
|
|
3
|
-
"version": "0.51.
|
|
3
|
+
"version": "0.51.4",
|
|
4
4
|
"description": "Coding agent CLI with read, bash, edit, write tools and session management",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"piConfig": {
|
|
@@ -40,9 +40,9 @@
|
|
|
40
40
|
},
|
|
41
41
|
"dependencies": {
|
|
42
42
|
"@mariozechner/jiti": "^2.6.2",
|
|
43
|
-
"@mariozechner/pi-agent-core": "^0.51.
|
|
44
|
-
"@mariozechner/pi-ai": "^0.51.
|
|
45
|
-
"@mariozechner/pi-tui": "^0.51.
|
|
43
|
+
"@mariozechner/pi-agent-core": "^0.51.4",
|
|
44
|
+
"@mariozechner/pi-ai": "^0.51.4",
|
|
45
|
+
"@mariozechner/pi-tui": "^0.51.4",
|
|
46
46
|
"@silvia-odwyer/photon-node": "^0.3.4",
|
|
47
47
|
"chalk": "^5.5.0",
|
|
48
48
|
"cli-highlight": "^2.1.11",
|