@aliou/pi-dev-kit 0.6.3 → 0.6.5
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/package.json +11 -7
- package/src/skills/pi-extension/SKILL.md +18 -12
- package/src/skills/pi-extension/references/additional-apis.md +42 -3
- package/src/skills/pi-extension/references/hooks.md +4 -4
- package/src/skills/pi-extension/references/messages.md +27 -10
- package/src/skills/pi-extension/references/structure.md +92 -38
- package/src/skills/pi-extension/references/tools.md +46 -25
- package/src/tools/changelog-tool.ts +225 -230
- package/src/tools/docs-tool.ts +125 -128
- package/src/tools/package-manager-tool.ts +146 -145
- package/src/tools/version-tool.ts +45 -49
|
@@ -2,69 +2,65 @@ import { ToolCallHeader } from "@aliou/pi-utils-ui";
|
|
|
2
2
|
import type {
|
|
3
3
|
AgentToolResult,
|
|
4
4
|
ExtensionAPI,
|
|
5
|
-
ExtensionContext,
|
|
6
5
|
Theme,
|
|
7
|
-
ToolRenderResultOptions,
|
|
8
6
|
} from "@mariozechner/pi-coding-agent";
|
|
9
|
-
import { VERSION } from "@mariozechner/pi-coding-agent";
|
|
7
|
+
import { defineTool, VERSION } from "@mariozechner/pi-coding-agent";
|
|
10
8
|
import { Text } from "@mariozechner/pi-tui";
|
|
11
|
-
import { Type } from "
|
|
9
|
+
import { type Static, Type } from "typebox";
|
|
12
10
|
|
|
13
11
|
const VersionParams = Type.Object({});
|
|
14
|
-
type VersionParamsType =
|
|
12
|
+
type VersionParamsType = Static<typeof VersionParams>;
|
|
13
|
+
|
|
14
|
+
function renderVersionCall(_args: VersionParamsType, theme: Theme) {
|
|
15
|
+
return new ToolCallHeader({ toolName: "Pi Version" }, theme);
|
|
16
|
+
}
|
|
15
17
|
|
|
16
18
|
interface VersionDetails {
|
|
17
19
|
version?: string;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
],
|
|
22
|
+
const versionTool = defineTool({
|
|
23
|
+
name: "pi_version",
|
|
24
|
+
label: "Pi Version",
|
|
25
|
+
description: "Get the version of the currently running Pi instance",
|
|
26
|
+
promptSnippet: "Check the current Pi version.",
|
|
27
|
+
promptGuidelines: [
|
|
28
|
+
"Use pi_version when the user asks about the Pi version or when a task depends on knowing the installed version.",
|
|
29
|
+
],
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
parameters: VersionParams,
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
33
|
+
async execute(
|
|
34
|
+
_toolCallId,
|
|
35
|
+
_params,
|
|
36
|
+
_signal,
|
|
37
|
+
_onUpdate,
|
|
38
|
+
_ctx,
|
|
39
|
+
): Promise<AgentToolResult<VersionDetails>> {
|
|
40
|
+
return {
|
|
41
|
+
content: [{ type: "text", text: `Pi version ${VERSION}` }],
|
|
42
|
+
details: { version: VERSION },
|
|
43
|
+
};
|
|
44
|
+
},
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
renderCall(args, theme) {
|
|
47
|
+
return renderVersionCall(args, theme);
|
|
48
|
+
},
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_options: ToolRenderResultOptions,
|
|
52
|
-
theme: Theme,
|
|
53
|
-
): Text {
|
|
54
|
-
const { details } = result;
|
|
50
|
+
renderResult(result, _options, theme) {
|
|
51
|
+
const { details } = result;
|
|
55
52
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
if (!details?.version) {
|
|
54
|
+
const textBlock = result.content.find((c) => c.type === "text");
|
|
55
|
+
const msg =
|
|
56
|
+
(textBlock?.type === "text" && textBlock.text) || "Unknown version";
|
|
57
|
+
return new Text(theme.fg("error", msg), 0, 0);
|
|
58
|
+
}
|
|
62
59
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
});
|
|
60
|
+
return new Text(theme.fg("accent", `Pi version: ${details.version}`), 0, 0);
|
|
61
|
+
},
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
export function setupVersionTool(pi: ExtensionAPI) {
|
|
65
|
+
pi.registerTool(versionTool);
|
|
70
66
|
}
|