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/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.allOptions = options.allOptions;
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;