@xynogen/pix-toolbox 0.1.13 → 0.1.15
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/README.md +8 -1
- package/package.json +1 -1
- package/src/toolbox.ts +8 -6
package/README.md
CHANGED
|
@@ -4,7 +4,12 @@ Pi tool — gated tool toggle UI (`/toolbox`).
|
|
|
4
4
|
|
|
5
5
|
## What it does
|
|
6
6
|
|
|
7
|
-
Registers a `/toolbox` slash command
|
|
7
|
+
Registers a `/toolbox` slash command — a TUI fuzzy-search picker listing every registered tool (built-in, extension, MCP). Toggle tools on/off to control which are described in the system prompt via `pi.setActiveTools()`.
|
|
8
|
+
|
|
9
|
+
- Toggling only affects **prompt visibility** — all tools stay callable via their function definitions.
|
|
10
|
+
- Four tools (`bash`, `edit`, `read`, `write`) are protected and can't be disabled.
|
|
11
|
+
- Gate state persists to `~/.pi/agent/toolbox.json`.
|
|
12
|
+
- Headless subcommands: `/toolbox enable <names>`, `/toolbox disable <names>`, `/toolbox list [query]`.
|
|
8
13
|
|
|
9
14
|
## Install
|
|
10
15
|
|
|
@@ -12,6 +17,8 @@ Registers a `/toolbox` slash command that opens a TUI fuzzy-search picker listin
|
|
|
12
17
|
pi install npm:@xynogen/pix-toolbox
|
|
13
18
|
```
|
|
14
19
|
|
|
20
|
+
> Standalone/opt-in — **not** bundled by [`@xynogen/pix-core`](https://www.npmjs.com/package/@xynogen/pix-core). A power-user tool-toggle UI, installed only if you want it.
|
|
21
|
+
|
|
15
22
|
## Full distro
|
|
16
23
|
|
|
17
24
|
Source: [github.com/xynogen/pix-mono](https://github.com/xynogen/pix-mono)
|
package/package.json
CHANGED
package/src/toolbox.ts
CHANGED
|
@@ -345,8 +345,8 @@ export default function registerToolbox(pi: ExtensionAPI): void {
|
|
|
345
345
|
const accent = "accent";
|
|
346
346
|
const mute = (s: string) => theme.fg("muted", s);
|
|
347
347
|
const guide = (key: string, action: string) =>
|
|
348
|
-
theme.fg("text", key) + theme.fg("
|
|
349
|
-
const guideSep = theme.fg("
|
|
348
|
+
theme.fg("text", key) + theme.fg("muted", ` ${action}`);
|
|
349
|
+
const guideSep = theme.fg("muted", " · ");
|
|
350
350
|
|
|
351
351
|
type RowState = "active" | "gated";
|
|
352
352
|
const stateOf = (name: string): RowState => (ops.isActive(name) ? "active" : "gated");
|
|
@@ -354,7 +354,7 @@ export default function registerToolbox(pi: ExtensionAPI): void {
|
|
|
354
354
|
const labelFor = (r: ToolRow): string => {
|
|
355
355
|
const active = stateOf(r.name) === "active";
|
|
356
356
|
const marker = active ? " " : theme.fg("warning", "#");
|
|
357
|
-
const name = active ? theme.fg("success", r.name) : theme.fg("
|
|
357
|
+
const name = active ? theme.fg("success", r.name) : theme.fg("muted", r.name);
|
|
358
358
|
const kind = mute(`[${r.mcp ? "MCP" : "tool"}]`);
|
|
359
359
|
return `${marker} ${name} ${kind}`;
|
|
360
360
|
};
|
|
@@ -386,7 +386,7 @@ export default function registerToolbox(pi: ExtensionAPI): void {
|
|
|
386
386
|
selectedPrefix: (t: string) => theme.fg(accent, t),
|
|
387
387
|
selectedText: (t: string) => theme.fg(accent, t),
|
|
388
388
|
description: (t: string) => t,
|
|
389
|
-
scrollInfo: (t: string) => theme.fg("
|
|
389
|
+
scrollInfo: (t: string) => theme.fg("muted", t),
|
|
390
390
|
noMatch: (t: string) => theme.fg("warning", t),
|
|
391
391
|
},
|
|
392
392
|
{
|
|
@@ -395,6 +395,7 @@ export default function registerToolbox(pi: ExtensionAPI): void {
|
|
|
395
395
|
},
|
|
396
396
|
);
|
|
397
397
|
|
|
398
|
+
// SAFETY: SelectList exposes these stable fields internally for label refreshes.
|
|
398
399
|
const internal = list as unknown as {
|
|
399
400
|
items: SelectItem[];
|
|
400
401
|
filteredItems: SelectItem[];
|
|
@@ -420,7 +421,7 @@ export default function registerToolbox(pi: ExtensionAPI): void {
|
|
|
420
421
|
const sel = list.getSelectedItem();
|
|
421
422
|
if (!sel) return;
|
|
422
423
|
const msg = toggleTool(action, sel.value, rows, ops);
|
|
423
|
-
statusText = theme.fg("
|
|
424
|
+
statusText = theme.fg("dim", msg);
|
|
424
425
|
refreshLabels();
|
|
425
426
|
};
|
|
426
427
|
|
|
@@ -473,7 +474,7 @@ export default function registerToolbox(pi: ExtensionAPI): void {
|
|
|
473
474
|
minHeight: MIN_MODAL_HEIGHT,
|
|
474
475
|
header: [
|
|
475
476
|
theme.fg(accent, theme.bold("🧰 Toolbox")),
|
|
476
|
-
theme.fg("
|
|
477
|
+
theme.fg("dim", "Search:"),
|
|
477
478
|
...search.render(inner),
|
|
478
479
|
"",
|
|
479
480
|
],
|
|
@@ -565,6 +566,7 @@ export default function registerToolbox(pi: ExtensionAPI): void {
|
|
|
565
566
|
}
|
|
566
567
|
|
|
567
568
|
if (typeof ctx.ui.custom === "function") {
|
|
569
|
+
// SAFETY: The runtime command context satisfies showPicker's narrowed UI contract.
|
|
568
570
|
await showPicker(ctx as unknown as Parameters<typeof showPicker>[0]);
|
|
569
571
|
} else {
|
|
570
572
|
ctx.ui.notify(renderList(getRows(), ops.isActive), "info");
|