@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
- Fixed extensions documentation to clarify that `pi.getActiveTools()` returns active tool names while `pi.getAllTools()` returns tool metadata ([#5729](https://github.com/earendil-works/pi/issues/5729)).
|
||||||
- Fixed package commands such as `pi list`, `pi install`, and `pi update` to terminate after completing even if an extension leaves background handles open ([#5687](https://github.com/earendil-works/pi/issues/5687)).
|
- Fixed package commands such as `pi list`, `pi install`, and `pi update` to terminate after completing even if an extension leaves background handles open ([#5687](https://github.com/earendil-works/pi/issues/5687)).
|
||||||
- Fixed `pi update` for pnpm global installs whose configured `global-bin-dir` no longer matches the active pnpm home ([#5689](https://github.com/earendil-works/pi/issues/5689)).
|
- Fixed `pi update` for pnpm global installs whose configured `global-bin-dir` no longer matches the active pnpm home ([#5689](https://github.com/earendil-works/pi/issues/5689)).
|
||||||
- Fixed npm package specs that use ranges or tags (for example `@^1.2.7`) so installed package resources still load instead of being treated as mismatched exact pins ([#5695](https://github.com/earendil-works/pi/issues/5695)).
|
- Fixed npm package specs that use ranges or tags (for example `@^1.2.7`) so installed package resources still load instead of being treated as mismatched exact pins ([#5695](https://github.com/earendil-works/pi/issues/5695)).
|
||||||
|
|||||||
@@ -1534,21 +1534,21 @@ const result = await pi.exec("git", ["status"], { signal, timeout: 5000 });
|
|||||||
|
|
||||||
### pi.getActiveTools() / pi.getAllTools() / pi.setActiveTools(names)
|
### pi.getActiveTools() / pi.getAllTools() / pi.setActiveTools(names)
|
||||||
|
|
||||||
Manage active tools. This works for both built-in tools and dynamically registered tools.
|
Manage active tools. This works for both built-in tools and dynamically registered tools. `pi.getActiveTools()` returns the active tool names as `string[]`; `pi.getAllTools()` returns metadata for all configured tools.
|
||||||
|
|
||||||
```typescript
|
```typescript
|
||||||
const active = pi.getActiveTools();
|
const active = pi.getActiveTools(); // ["read", "bash", ...]
|
||||||
const all = pi.getAllTools();
|
const all = pi.getAllTools();
|
||||||
// [{
|
// all = [{
|
||||||
// name: "read",
|
// name: "read",
|
||||||
// description: "Read file contents...",
|
// description: "Read file contents...",
|
||||||
// parameters: ...,
|
// parameters: ...,
|
||||||
// promptGuidelines: ["Use read to examine files instead of cat or sed."],
|
// promptGuidelines: ["Use read to examine files instead of cat or sed."],
|
||||||
// sourceInfo: { path: "<builtin:read>", source: "builtin", scope: "temporary", origin: "top-level" }
|
// sourceInfo: { path: "<builtin:read>", source: "builtin", scope: "temporary", origin: "top-level" }
|
||||||
// }, ...]
|
// }, ...]
|
||||||
const names = all.map(t => t.name);
|
|
||||||
const builtinTools = all.filter((t) => t.sourceInfo.source === "builtin");
|
const builtinTools = all.filter((t) => t.sourceInfo.source === "builtin");
|
||||||
const extensionTools = all.filter((t) => t.sourceInfo.source !== "builtin" && t.sourceInfo.source !== "sdk");
|
const extensionTools = all.filter((t) => t.sourceInfo.source !== "builtin" && t.sourceInfo.source !== "sdk");
|
||||||
|
pi.setActiveTools([...new Set([...active, "my_custom_tool"])]); // Keep current tools and enable my_custom_tool
|
||||||
pi.setActiveTools(["read", "bash"]); // Switch to read-only
|
pi.setActiveTools(["read", "bash"]); // Switch to read-only
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user