@alexanderfortin/pi-loaded-tools 0.2.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/CHANGELOG.md +14 -0
- package/LICENSE +21 -0
- package/README.md +45 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/tools/api.d.ts +47 -0
- package/dist/tools/api.d.ts.map +1 -0
- package/dist/tools/api.js +142 -0
- package/dist/tools/api.js.map +1 -0
- package/dist/tools/display.d.ts +9 -0
- package/dist/tools/display.d.ts.map +1 -0
- package/dist/tools/display.js +27 -0
- package/dist/tools/display.js.map +1 -0
- package/dist/tools/index.d.ts +2 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +2 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/types.d.ts +69 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +5 -0
- package/dist/tools/types.js.map +1 -0
- package/package.json +85 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [0.1.0] - 2025-04-09
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
|
|
12
|
+
- Initial release of pi-loaded-tools
|
|
13
|
+
- `list-tools` command for displaying loaded tools with source provenance
|
|
14
|
+
- Tool diagnostics including active status and validation information
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
# pi-loaded-tools
|
|
2
|
+
|
|
3
|
+
[](https://codecov.io/gh/shaftoe/pi-loaded-tools)
|
|
4
|
+
|
|
5
|
+
[Pi coding agent](https://pi.dev) extension to list session's loaded tools.
|
|
6
|
+
|
|
7
|
+
Pi currently doesn't show this important information at startup nor elsewhere, installing this extension will show tools list at startup with active/inactive status and source labels, also prints the list on demand with `/tools` registered command.
|
|
8
|
+
|
|
9
|
+
## Example
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
### From npm
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
pi install npm:@alexanderfortin/pi-loaded-tools
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### From github
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pi install git:github.com/shaftoe/pi-loaded-tools
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
## Usage
|
|
28
|
+
|
|
29
|
+
Run `/tools` inside a pi session to see the list of loaded tools.
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
/tools # List all loaded tools with source provenance
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Releasing
|
|
36
|
+
|
|
37
|
+
This project uses automated publishing to NPM via GitHub Actions. The workflow will:
|
|
38
|
+
|
|
39
|
+
- Run all CI checks
|
|
40
|
+
- Build the package
|
|
41
|
+
- Publish to NPM with provenance (signed) via [trusted publishing](https://docs.npmjs.com/trusted-publishers)
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
See [LICENSE](./LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi List Tools Extension
|
|
3
|
+
*
|
|
4
|
+
* Registers a /tools command and automatically shows loaded tools at startup.
|
|
5
|
+
* Also exports a public API for querying loaded tools programmatically.
|
|
6
|
+
*/
|
|
7
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
8
|
+
export default function (pi: ExtensionAPI): void;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAGlE,MAAM,CAAC,OAAO,WAAW,EAAE,EAAE,YAAY,GAAG,IAAI,CAW/C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pi List Tools Extension
|
|
3
|
+
*
|
|
4
|
+
* Registers a /tools command and automatically shows loaded tools at startup.
|
|
5
|
+
* Also exports a public API for querying loaded tools programmatically.
|
|
6
|
+
*/
|
|
7
|
+
import { showTools } from "./tools";
|
|
8
|
+
export default function (pi) {
|
|
9
|
+
pi.registerCommand("tools", {
|
|
10
|
+
description: "List all loaded tools with source provenance and active status",
|
|
11
|
+
handler: async (_args, ctx) => {
|
|
12
|
+
await Promise.resolve().then(() => showTools(pi, ctx));
|
|
13
|
+
},
|
|
14
|
+
});
|
|
15
|
+
pi.on("session_start", (_event, ctx) => {
|
|
16
|
+
showTools(pi, ctx);
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEpC,MAAM,CAAC,OAAO,WAAW,EAAgB;IACvC,EAAE,CAAC,eAAe,CAAC,OAAO,EAAE;QAC1B,WAAW,EAAE,gEAAgE;QAC7E,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE;YAC5B,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC,CAAC;QACzD,CAAC;KACF,CAAC,CAAC;IAEH,EAAE,CAAC,EAAE,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACrC,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API for querying and organizing loaded tools.
|
|
3
|
+
*/
|
|
4
|
+
import type { ToolInfo } from "@mariozechner/pi-coding-agent";
|
|
5
|
+
import type { LoadedTool, ToolGroups, ToolSource, ToolStats } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* Get all loaded tools with full metadata.
|
|
8
|
+
*
|
|
9
|
+
* @param allTools - Result of pi.getAllTools()
|
|
10
|
+
* @param activeNames - Set of active tool names (pi.getActiveTools())
|
|
11
|
+
* @returns Array of loaded tools with metadata
|
|
12
|
+
*/
|
|
13
|
+
export declare function getAllLoadedTools(allTools: ToolInfo[], activeNames: Set<string>): LoadedTool[];
|
|
14
|
+
/**
|
|
15
|
+
* Get tools grouped by source and active status.
|
|
16
|
+
*
|
|
17
|
+
* @param tools - Pre-computed array from getAllLoadedTools()
|
|
18
|
+
* @returns Tools organized by source and active status
|
|
19
|
+
*/
|
|
20
|
+
export declare function getToolGroups(tools: LoadedTool[]): ToolGroups;
|
|
21
|
+
/**
|
|
22
|
+
* Get statistics about loaded tools.
|
|
23
|
+
*
|
|
24
|
+
* @param tools - Pre-computed array from getAllLoadedTools()
|
|
25
|
+
* @returns Tool statistics
|
|
26
|
+
*/
|
|
27
|
+
export declare function getToolStats(tools: LoadedTool[]): ToolStats;
|
|
28
|
+
/**
|
|
29
|
+
* Truncate a description string for display.
|
|
30
|
+
*/
|
|
31
|
+
export declare function truncateDescription(desc: string): string;
|
|
32
|
+
/**
|
|
33
|
+
* Format tool source for display.
|
|
34
|
+
*
|
|
35
|
+
* @param source - Tool source (already mapped from Pi's raw values)
|
|
36
|
+
* @param extensionPath - Extension identifier (package name or file path)
|
|
37
|
+
* @returns Formatted source string
|
|
38
|
+
*/
|
|
39
|
+
export declare function formatToolSource(source: ToolSource, extensionPath?: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Get a display label for a tool source.
|
|
42
|
+
*
|
|
43
|
+
* @param source - Tool source
|
|
44
|
+
* @returns Display label (e.g., "Built-in", "SDK", "Extensions")
|
|
45
|
+
*/
|
|
46
|
+
export declare function getSourceLabel(source: ToolSource): string;
|
|
47
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/tools/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAiBhF;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,QAAQ,EAAE,EAAE,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,GAAG,UAAU,EAAE,CAgC9F;AAMD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,UAAU,CAa7D;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,SAAS,CAsB3D;AAUD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGxD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAOnF;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CASzD"}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API for querying and organizing loaded tools.
|
|
3
|
+
*/
|
|
4
|
+
function toSourceGroup(source) {
|
|
5
|
+
return source === "extension" ? "extensions" : source;
|
|
6
|
+
}
|
|
7
|
+
// ---------------------------------------------------------------------------
|
|
8
|
+
// Core: getAllLoadedTools
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
/**
|
|
11
|
+
* Get all loaded tools with full metadata.
|
|
12
|
+
*
|
|
13
|
+
* @param allTools - Result of pi.getAllTools()
|
|
14
|
+
* @param activeNames - Set of active tool names (pi.getActiveTools())
|
|
15
|
+
* @returns Array of loaded tools with metadata
|
|
16
|
+
*/
|
|
17
|
+
export function getAllLoadedTools(allTools, activeNames) {
|
|
18
|
+
return allTools.map((tool) => {
|
|
19
|
+
const si = tool.sourceInfo;
|
|
20
|
+
const rawSource = si?.source ?? "";
|
|
21
|
+
const isBuiltin = (si?.path?.startsWith("<") ?? false) || rawSource === "builtin";
|
|
22
|
+
const source = isBuiltin ? "builtin" : rawSource === "sdk" ? "sdk" : "extension";
|
|
23
|
+
// Derive a human-readable extension name:
|
|
24
|
+
// - npm packages: sourceInfo.source is the package identifier (e.g. "npm:@foo/bar")
|
|
25
|
+
// - local extensions: sourceInfo.path is the file path
|
|
26
|
+
// - built-in/SDK: not needed
|
|
27
|
+
let extensionPath;
|
|
28
|
+
if (source === "extension") {
|
|
29
|
+
const origin = si?.origin ?? "top-level";
|
|
30
|
+
if (origin === "package" && rawSource && rawSource !== "local") {
|
|
31
|
+
extensionPath = rawSource;
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
extensionPath = si?.path || undefined;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// Take only first line of description, no truncation (that's a display concern)
|
|
38
|
+
const desc = (tool.description ?? "").split("\n")[0] ?? "";
|
|
39
|
+
return {
|
|
40
|
+
name: tool.name,
|
|
41
|
+
description: desc.trim(),
|
|
42
|
+
active: activeNames.has(tool.name),
|
|
43
|
+
source,
|
|
44
|
+
extensionPath,
|
|
45
|
+
};
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
// ---------------------------------------------------------------------------
|
|
49
|
+
// Derived queries (accept pre-computed LoadedTool[])
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
/**
|
|
52
|
+
* Get tools grouped by source and active status.
|
|
53
|
+
*
|
|
54
|
+
* @param tools - Pre-computed array from getAllLoadedTools()
|
|
55
|
+
* @returns Tools organized by source and active status
|
|
56
|
+
*/
|
|
57
|
+
export function getToolGroups(tools) {
|
|
58
|
+
const groups = {
|
|
59
|
+
builtin: { active: [], inactive: [] },
|
|
60
|
+
sdk: { active: [], inactive: [] },
|
|
61
|
+
extensions: { active: [], inactive: [] },
|
|
62
|
+
};
|
|
63
|
+
for (const tool of tools) {
|
|
64
|
+
const target = groups[toSourceGroup(tool.source)];
|
|
65
|
+
(tool.active ? target.active : target.inactive).push(tool);
|
|
66
|
+
}
|
|
67
|
+
return groups;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Get statistics about loaded tools.
|
|
71
|
+
*
|
|
72
|
+
* @param tools - Pre-computed array from getAllLoadedTools()
|
|
73
|
+
* @returns Tool statistics
|
|
74
|
+
*/
|
|
75
|
+
export function getToolStats(tools) {
|
|
76
|
+
const stats = {
|
|
77
|
+
total: tools.length,
|
|
78
|
+
active: 0,
|
|
79
|
+
inactive: 0,
|
|
80
|
+
builtin: { total: 0, active: 0 },
|
|
81
|
+
sdk: { total: 0, active: 0 },
|
|
82
|
+
extensions: { total: 0, active: 0 },
|
|
83
|
+
};
|
|
84
|
+
for (const tool of tools) {
|
|
85
|
+
stats.active += tool.active ? 1 : 0;
|
|
86
|
+
stats.inactive += tool.active ? 0 : 1;
|
|
87
|
+
const target = stats[toSourceGroup(tool.source)];
|
|
88
|
+
target.total++;
|
|
89
|
+
if (tool.active) {
|
|
90
|
+
target.active++;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return stats;
|
|
94
|
+
}
|
|
95
|
+
// ---------------------------------------------------------------------------
|
|
96
|
+
// Formatting helpers
|
|
97
|
+
// ---------------------------------------------------------------------------
|
|
98
|
+
/** Maximum description length for display. */
|
|
99
|
+
const MAX_DESC_LEN = 120;
|
|
100
|
+
const ELLIPSIS = "...";
|
|
101
|
+
/**
|
|
102
|
+
* Truncate a description string for display.
|
|
103
|
+
*/
|
|
104
|
+
export function truncateDescription(desc) {
|
|
105
|
+
if (desc.length <= MAX_DESC_LEN)
|
|
106
|
+
return desc;
|
|
107
|
+
return `${desc.slice(0, MAX_DESC_LEN - ELLIPSIS.length)}${ELLIPSIS}`;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Format tool source for display.
|
|
111
|
+
*
|
|
112
|
+
* @param source - Tool source (already mapped from Pi's raw values)
|
|
113
|
+
* @param extensionPath - Extension identifier (package name or file path)
|
|
114
|
+
* @returns Formatted source string
|
|
115
|
+
*/
|
|
116
|
+
export function formatToolSource(source, extensionPath) {
|
|
117
|
+
if (source === "builtin")
|
|
118
|
+
return "built-in";
|
|
119
|
+
if (source === "sdk")
|
|
120
|
+
return "SDK";
|
|
121
|
+
if (source === "extension" && extensionPath) {
|
|
122
|
+
return extensionPath.replace(/\/dist\/index\.js$/, "") || extensionPath;
|
|
123
|
+
}
|
|
124
|
+
return "extension";
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get a display label for a tool source.
|
|
128
|
+
*
|
|
129
|
+
* @param source - Tool source
|
|
130
|
+
* @returns Display label (e.g., "Built-in", "SDK", "Extensions")
|
|
131
|
+
*/
|
|
132
|
+
export function getSourceLabel(source) {
|
|
133
|
+
switch (source) {
|
|
134
|
+
case "builtin":
|
|
135
|
+
return "Built-in";
|
|
136
|
+
case "sdk":
|
|
137
|
+
return "SDK";
|
|
138
|
+
case "extension":
|
|
139
|
+
return "Extensions";
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/tools/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,SAAS,aAAa,CAAC,MAAkB;IACvC,OAAO,MAAM,KAAK,WAAW,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC;AACxD,CAAC;AAED,8EAA8E;AAC9E,0BAA0B;AAC1B,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,QAAoB,EAAE,WAAwB;IAC9E,OAAO,QAAQ,C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,WAAW;YACd,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools display logic (internal — not part of public API).
|
|
3
|
+
*/
|
|
4
|
+
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
5
|
+
/**
|
|
6
|
+
* Show loaded tools via notification.
|
|
7
|
+
*/
|
|
8
|
+
export declare function showTools(pi: ExtensionAPI, ctx: ExtensionContext): void;
|
|
9
|
+
//# sourceMappingURL=display.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.d.ts","sourceRoot":"","sources":["../../src/tools/display.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAGpF;;GAEG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,YAAY,EAAE,GAAG,EAAE,gBAAgB,GAAG,IAAI,CAsBvE"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tools display logic (internal — not part of public API).
|
|
3
|
+
*/
|
|
4
|
+
import { formatToolSource, getAllLoadedTools } from "./api.js";
|
|
5
|
+
/**
|
|
6
|
+
* Show loaded tools via notification.
|
|
7
|
+
*/
|
|
8
|
+
export function showTools(pi, ctx) {
|
|
9
|
+
const theme = ctx.ui.theme;
|
|
10
|
+
const tools = getAllLoadedTools(pi.getAllTools(), new Set(pi.getActiveTools()));
|
|
11
|
+
const lines = [];
|
|
12
|
+
lines.push(theme.fg("accent", "[Tools]"));
|
|
13
|
+
// Active tools
|
|
14
|
+
const active = tools.filter((t) => t.active);
|
|
15
|
+
for (const tool of active) {
|
|
16
|
+
const sourceDisplay = formatToolSource(tool.source, tool.extensionPath);
|
|
17
|
+
lines.push(` ● ${tool.name} [${sourceDisplay}]`);
|
|
18
|
+
}
|
|
19
|
+
// Inactive tools
|
|
20
|
+
const inactive = tools.filter((t) => !t.active);
|
|
21
|
+
for (const tool of inactive) {
|
|
22
|
+
const sourceDisplay = formatToolSource(tool.source, tool.extensionPath);
|
|
23
|
+
lines.push(` ${theme.fg("dim", `○ ${tool.name} [${sourceDisplay}]`)}`);
|
|
24
|
+
}
|
|
25
|
+
ctx.ui.notify(lines.join("\n"), "info");
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=display.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"display.js","sourceRoot":"","sources":["../../src/tools/display.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAE/D;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,EAAgB,EAAE,GAAqB;IAC/D,MAAM,KAAK,GAAG,GAAG,CAAC,EAAE,CAAC,KAAK,CAAC;IAC3B,MAAM,KAAK,GAAG,iBAAiB,CAAC,EAAE,CAAC,WAAW,EAAE,EAAE,IAAI,GAAG,CAAC,EAAE,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;IAEhF,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,CAAC;IAE1C,eAAe;IACf,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CAAC;QAC1B,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACxE,KAAK,CAAC,IAAI,CAAC,OAAO,IAAI,CAAC,IAAI,MAAM,aAAa,GAAG,CAAC,CAAC;IACrD,CAAC;IAED,iBAAiB;IACjB,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;IAChD,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,aAAa,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,CAAC;QACxE,KAAK,CAAC,IAAI,CAAC,KAAK,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,IAAI,CAAC,IAAI,MAAM,aAAa,GAAG,CAAC,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,GAAG,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types for the loaded tools extension.
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Where a tool comes from.
|
|
6
|
+
*/
|
|
7
|
+
export type ToolSource = "builtin" | "sdk" | "extension";
|
|
8
|
+
/**
|
|
9
|
+
* A loaded tool with all relevant metadata.
|
|
10
|
+
*/
|
|
11
|
+
export interface LoadedTool {
|
|
12
|
+
/** Tool name (as known to LLM) */
|
|
13
|
+
name: string;
|
|
14
|
+
/** One-line description (first line, raw) */
|
|
15
|
+
description: string;
|
|
16
|
+
/** Whether this tool is currently active */
|
|
17
|
+
active: boolean;
|
|
18
|
+
/** Where this tool comes from */
|
|
19
|
+
source: ToolSource;
|
|
20
|
+
/** Extension path (for extension tools only) */
|
|
21
|
+
extensionPath?: string;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Grouped tools for display purposes.
|
|
25
|
+
*/
|
|
26
|
+
export interface ToolGroups {
|
|
27
|
+
/** Built-in tools (Pi's core tools) */
|
|
28
|
+
builtin: {
|
|
29
|
+
active: LoadedTool[];
|
|
30
|
+
inactive: LoadedTool[];
|
|
31
|
+
};
|
|
32
|
+
/** SDK tools (passed via customTools) */
|
|
33
|
+
sdk: {
|
|
34
|
+
active: LoadedTool[];
|
|
35
|
+
inactive: LoadedTool[];
|
|
36
|
+
};
|
|
37
|
+
/** Extension tools (registered by extensions) */
|
|
38
|
+
extensions: {
|
|
39
|
+
active: LoadedTool[];
|
|
40
|
+
inactive: LoadedTool[];
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Summary stats for tools.
|
|
45
|
+
*/
|
|
46
|
+
export interface ToolStats {
|
|
47
|
+
/** Total number of tools */
|
|
48
|
+
total: number;
|
|
49
|
+
/** Number of active tools */
|
|
50
|
+
active: number;
|
|
51
|
+
/** Number of inactive tools */
|
|
52
|
+
inactive: number;
|
|
53
|
+
/** Built-in tools */
|
|
54
|
+
builtin: {
|
|
55
|
+
total: number;
|
|
56
|
+
active: number;
|
|
57
|
+
};
|
|
58
|
+
/** SDK tools */
|
|
59
|
+
sdk: {
|
|
60
|
+
total: number;
|
|
61
|
+
active: number;
|
|
62
|
+
};
|
|
63
|
+
/** Extension tools */
|
|
64
|
+
extensions: {
|
|
65
|
+
total: number;
|
|
66
|
+
active: number;
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAE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;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
package/package.json
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@alexanderfortin/pi-loaded-tools",
|
|
3
|
+
"author": "Alexander Fortin",
|
|
4
|
+
"version": "0.2.0",
|
|
5
|
+
"description": "Pi coding agent extension for listing loaded tools with source provenance",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package",
|
|
8
|
+
"tools",
|
|
9
|
+
"list-tools"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"exports": {
|
|
15
|
+
".": {
|
|
16
|
+
"types": "./dist/index.d.ts",
|
|
17
|
+
"import": "./dist/index.js"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"license": "MIT",
|
|
21
|
+
"pi": {
|
|
22
|
+
"extensions": [
|
|
23
|
+
"./dist/index.js"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"files": [
|
|
30
|
+
"dist",
|
|
31
|
+
"package.json",
|
|
32
|
+
"README.md",
|
|
33
|
+
"CHANGELOG.md",
|
|
34
|
+
"LICENSE"
|
|
35
|
+
],
|
|
36
|
+
"peerDependencies": {
|
|
37
|
+
"@mariozechner/pi-coding-agent": "*",
|
|
38
|
+
"@mariozechner/pi-ai": "*",
|
|
39
|
+
"@mariozechner/pi-tui": "*",
|
|
40
|
+
"@sinclair/typebox": "*"
|
|
41
|
+
},
|
|
42
|
+
"repository": {
|
|
43
|
+
"type": "git",
|
|
44
|
+
"url": "https://github.com/shaftoe/pi-loaded-tools"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "bun run check && rm -rf dist && tsc --project tsconfig.build.json",
|
|
48
|
+
"check": "tsc --noEmit",
|
|
49
|
+
"check:watch": "tsc --noEmit --watch",
|
|
50
|
+
"lint": "eslint . --ext .ts",
|
|
51
|
+
"lint:fix": "eslint . --ext .ts --fix",
|
|
52
|
+
"format": "prettier --check .",
|
|
53
|
+
"format:fix": "prettier --write .",
|
|
54
|
+
"test": "bun test",
|
|
55
|
+
"test:coverage": "bun test --coverage --coverage-reporter=lcov",
|
|
56
|
+
"test:watch": "bun test --watch",
|
|
57
|
+
"release": "semantic-release",
|
|
58
|
+
"release:dry-run": "semantic-release --dry-run",
|
|
59
|
+
"validate": "bun run lint && bun run format && bun run check"
|
|
60
|
+
},
|
|
61
|
+
"devDependencies": {
|
|
62
|
+
"@mariozechner/pi-ai": "0.66.1",
|
|
63
|
+
"@mariozechner/pi-coding-agent": "0.66.1",
|
|
64
|
+
"@mariozechner/pi-tui": "0.66.1",
|
|
65
|
+
"@semantic-release/changelog": "6.0.3",
|
|
66
|
+
"@semantic-release/commit-analyzer": "13.0.1",
|
|
67
|
+
"@semantic-release/exec": "7.1.0",
|
|
68
|
+
"@semantic-release/git": "10.0.1",
|
|
69
|
+
"@semantic-release/github": "12.0.6",
|
|
70
|
+
"@semantic-release/npm": "13.1.5",
|
|
71
|
+
"@semantic-release/release-notes-generator": "14.1.0",
|
|
72
|
+
"@sinclair/typebox": "0.34.49",
|
|
73
|
+
"@types/bun": "1.3.11",
|
|
74
|
+
"@types/node": "25.5.2",
|
|
75
|
+
"@typescript-eslint/eslint-plugin": "8.58.1",
|
|
76
|
+
"@typescript-eslint/parser": "8.58.1",
|
|
77
|
+
"eslint": "10.2.0",
|
|
78
|
+
"eslint-config-prettier": "10.1.8",
|
|
79
|
+
"prettier": "3.8.1",
|
|
80
|
+
"prettier-plugin-organize-imports": "4.3.0",
|
|
81
|
+
"semantic-release": "25.0.3",
|
|
82
|
+
"typescript": "6.0.2"
|
|
83
|
+
},
|
|
84
|
+
"dependencies": {}
|
|
85
|
+
}
|