@narumitw/pi-subagents 0.17.2 → 0.18.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/package.json +1 -1
- package/src/config-ui.ts +27 -5
package/package.json
CHANGED
package/src/config-ui.ts
CHANGED
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
Container,
|
|
5
5
|
Key,
|
|
6
6
|
matchesKey,
|
|
7
|
-
SelectList,
|
|
8
7
|
type SelectItem,
|
|
8
|
+
SelectList,
|
|
9
9
|
Spacer,
|
|
10
10
|
Text,
|
|
11
11
|
truncateToWidth,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
uniqueToolNames,
|
|
21
21
|
} from "./settings.js";
|
|
22
22
|
|
|
23
|
-
class ToolToggleList {
|
|
23
|
+
export class ToolToggleList {
|
|
24
24
|
private items: { name: string; selected: boolean }[];
|
|
25
25
|
private cursor = 0;
|
|
26
26
|
private cachedWidth?: number;
|
|
@@ -98,6 +98,7 @@ export function registerSubagentConfigCommand(pi: ExtensionAPI) {
|
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
// Loop: agent selection → tool toggle (Esc in tools returns here)
|
|
101
|
+
let selectedAgentIndex = 0;
|
|
101
102
|
while (true) {
|
|
102
103
|
// Step 1: pick an agent to configure
|
|
103
104
|
const agentItems: SelectItem[] = agents.map((a) => {
|
|
@@ -133,7 +134,20 @@ export function registerSubagentConfigCommand(pi: ExtensionAPI) {
|
|
|
133
134
|
scrollInfo: (t: string) => theme.fg("dim", t),
|
|
134
135
|
noMatch: (t: string) => theme.fg("warning", t),
|
|
135
136
|
});
|
|
136
|
-
selectList.
|
|
137
|
+
selectList.setSelectedIndex(selectedAgentIndex);
|
|
138
|
+
selectList.onSelectionChange = (item) => {
|
|
139
|
+
selectedAgentIndex = Math.max(
|
|
140
|
+
0,
|
|
141
|
+
agentItems.findIndex((candidate) => candidate.value === item.value),
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
selectList.onSelect = (item) => {
|
|
145
|
+
selectedAgentIndex = Math.max(
|
|
146
|
+
0,
|
|
147
|
+
agentItems.findIndex((candidate) => candidate.value === item.value),
|
|
148
|
+
);
|
|
149
|
+
done(item.value);
|
|
150
|
+
};
|
|
137
151
|
selectList.onCancel = () => done(null);
|
|
138
152
|
container.addChild(selectList);
|
|
139
153
|
container.addChild(
|
|
@@ -193,7 +207,11 @@ export function registerSubagentConfigCommand(pi: ExtensionAPI) {
|
|
|
193
207
|
);
|
|
194
208
|
container.addChild(new Spacer(1));
|
|
195
209
|
container.addChild(
|
|
196
|
-
new Text(
|
|
210
|
+
new Text(
|
|
211
|
+
theme.fg("muted", "Toggle tools with Enter/Space. S to save, Esc to cancel."),
|
|
212
|
+
1,
|
|
213
|
+
0,
|
|
214
|
+
),
|
|
197
215
|
);
|
|
198
216
|
container.addChild(new Spacer(1));
|
|
199
217
|
|
|
@@ -206,7 +224,11 @@ export function registerSubagentConfigCommand(pi: ExtensionAPI) {
|
|
|
206
224
|
|
|
207
225
|
container.addChild(new Spacer(1));
|
|
208
226
|
container.addChild(
|
|
209
|
-
new Text(
|
|
227
|
+
new Text(
|
|
228
|
+
theme.fg("dim", "↑↓ navigate · enter/space toggle · S save · esc cancel"),
|
|
229
|
+
1,
|
|
230
|
+
0,
|
|
231
|
+
),
|
|
210
232
|
);
|
|
211
233
|
container.addChild(new DynamicBorder((s: string) => theme.fg("accent", s)));
|
|
212
234
|
|