pi-advisor-flow 0.3.0 → 0.3.3
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 +21 -0
- package/README.md +21 -5
- package/extensions/index.ts +4 -2
- package/package.json +7 -7
- package/src/commands.ts +74 -22
- package/src/config.ts +11 -0
- package/src/conversation.ts +1 -1
- package/src/model-stream.ts +106 -0
- package/src/scout-context.ts +526 -0
- package/src/scout.ts +360 -0
- package/src/tools.ts +431 -73
- package/src/ui.ts +23 -3
package/src/ui.ts
CHANGED
|
@@ -17,6 +17,7 @@ interface RenderRequester {
|
|
|
17
17
|
}
|
|
18
18
|
interface SearchableModelSelectorOptions {
|
|
19
19
|
allOptions: string[];
|
|
20
|
+
currentOption?: string;
|
|
20
21
|
keybindings: KeybindingsManager;
|
|
21
22
|
onCancel: () => void;
|
|
22
23
|
onSelect: (value: string) => void;
|
|
@@ -50,6 +51,7 @@ export class SearchableModelSelector implements Component, Focusable {
|
|
|
50
51
|
private readonly tui: RenderRequester;
|
|
51
52
|
private readonly searchInput: Input;
|
|
52
53
|
private readonly allOptions: string[];
|
|
54
|
+
private readonly currentOption: string | undefined;
|
|
53
55
|
private filteredOptions: string[];
|
|
54
56
|
private selectedIndex = 0;
|
|
55
57
|
private readonly title: string;
|
|
@@ -70,7 +72,13 @@ export class SearchableModelSelector implements Component, Focusable {
|
|
|
70
72
|
constructor(options: SearchableModelSelectorOptions) {
|
|
71
73
|
this.tui = options.tui;
|
|
72
74
|
this.title = options.title;
|
|
73
|
-
this.
|
|
75
|
+
this.currentOption = options.currentOption || undefined;
|
|
76
|
+
this.allOptions = this.currentOption
|
|
77
|
+
? [
|
|
78
|
+
this.currentOption,
|
|
79
|
+
...options.allOptions.filter((item) => item !== this.currentOption),
|
|
80
|
+
]
|
|
81
|
+
: options.allOptions;
|
|
74
82
|
this.theme = options.theme;
|
|
75
83
|
this.keybindings = options.keybindings;
|
|
76
84
|
this.onSelect = options.onSelect;
|
|
@@ -116,12 +124,13 @@ export class SearchableModelSelector implements Component, Focusable {
|
|
|
116
124
|
const endIndex = Math.min(startIndex + maxVisible, total);
|
|
117
125
|
for (let i = startIndex; i < endIndex; i += 1) {
|
|
118
126
|
const item = this.filteredOptions[i];
|
|
127
|
+
const tick = item === this.currentOption ? "✓ " : " ";
|
|
119
128
|
if (i === this.selectedIndex) {
|
|
120
129
|
lines.push(
|
|
121
|
-
` ${this.theme.fg("accent", "→ ")}${this.theme.fg("accent", item)}`
|
|
130
|
+
` ${this.theme.fg("accent", "→ ")}${this.theme.fg("accent", `${tick}${item}`)}`
|
|
122
131
|
);
|
|
123
132
|
} else {
|
|
124
|
-
lines.push(` ${this.theme.fg("text", item)}`);
|
|
133
|
+
lines.push(` ${this.theme.fg("text", `${tick}${item}`)}`);
|
|
125
134
|
}
|
|
126
135
|
}
|
|
127
136
|
if (total > maxVisible) {
|
|
@@ -215,6 +224,7 @@ export interface AdvisorSettings {
|
|
|
215
224
|
outcomeLogging?: boolean;
|
|
216
225
|
planGate: boolean;
|
|
217
226
|
redactSecrets?: boolean;
|
|
227
|
+
scoutEnabled?: boolean;
|
|
218
228
|
sessionSummary?: boolean;
|
|
219
229
|
simpleMode?: boolean;
|
|
220
230
|
toolPolicies?: Record<string, "full" | "summary" | "exclude">;
|
|
@@ -229,6 +239,7 @@ type AdvisorSettingsRow =
|
|
|
229
239
|
| "alwaysOn"
|
|
230
240
|
| "context"
|
|
231
241
|
| "effort"
|
|
242
|
+
| "scoutEnabled"
|
|
232
243
|
| "planGate"
|
|
233
244
|
| "failureGate"
|
|
234
245
|
| "completionGate"
|
|
@@ -255,6 +266,7 @@ type AdvisorSettingsRow =
|
|
|
255
266
|
const ADVANCED_ROWS: AdvisorSettingsRow[] = [
|
|
256
267
|
"context",
|
|
257
268
|
"effort",
|
|
269
|
+
"scoutEnabled",
|
|
258
270
|
"planGate",
|
|
259
271
|
"failureGate",
|
|
260
272
|
"completionGate",
|
|
@@ -566,6 +578,11 @@ export class AdvisorSettingsSelector implements Component, Focusable {
|
|
|
566
578
|
const onOff = (value: boolean) => (value ? "On" : "Off");
|
|
567
579
|
const rows = [
|
|
568
580
|
this.row("Advisor reasoning", this.currentEffort(), "effort"),
|
|
581
|
+
this.row(
|
|
582
|
+
"Experimental Advisor Scout",
|
|
583
|
+
onOff(this.settings.scoutEnabled ?? false),
|
|
584
|
+
"scoutEnabled"
|
|
585
|
+
),
|
|
569
586
|
this.row("Plan gate", onOff(this.settings.planGate), "planGate"),
|
|
570
587
|
this.row("Failure gate", onOff(this.settings.failureGate), "failureGate"),
|
|
571
588
|
this.row(
|
|
@@ -814,6 +831,9 @@ export class AdvisorSettingsSelector implements Component, Focusable {
|
|
|
814
831
|
);
|
|
815
832
|
this.settings.effort = this.options.effortLevels[this.effortIndex];
|
|
816
833
|
break;
|
|
834
|
+
case "scoutEnabled":
|
|
835
|
+
this.settings.scoutEnabled = !(this.settings.scoutEnabled ?? false);
|
|
836
|
+
break;
|
|
817
837
|
case "planGate":
|
|
818
838
|
this.settings.planGate = !this.settings.planGate;
|
|
819
839
|
break;
|