@victor-software-house/pi-openai-proxy 4.2.2 → 4.2.4

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.
@@ -553,11 +553,18 @@ export default function proxyExtension(pi: ExtensionAPI): void {
553
553
  const models = getAvailableModels();
554
554
  const selected = new Set(config.customModels);
555
555
 
556
+ // Build provider order from sorted model list
557
+ const providerOrder: string[] = [];
558
+ for (const m of models) {
559
+ if (!providerOrder.includes(m.provider)) providerOrder.push(m.provider);
560
+ }
561
+
556
562
  const items: SettingItem[] = models.map((m) => {
557
563
  const canonical = `${m.provider}/${m.id}`;
558
564
  return {
559
565
  id: canonical,
560
566
  label: canonical,
567
+ description: `Provider: ${m.provider} | Left/Right: jump provider`,
561
568
  currentValue: selected.has(canonical) ? "[x]" : "[ ]",
562
569
  values: ["[x]", "[ ]"],
563
570
  };
@@ -581,6 +588,52 @@ export default function proxyExtension(pi: ExtensionAPI): void {
581
588
  { enableSearch: true },
582
589
  );
583
590
 
591
+ // SettingsList has no public selectedIndex setter.
592
+ // Access internals via bracket notation for provider jumping.
593
+ function jumpProvider(direction: "prev" | "next"): void {
594
+ const sl = list as unknown as Record<string, unknown>;
595
+ const idx = sl["selectedIndex"] as number;
596
+ const display = (
597
+ (sl["searchEnabled"] as boolean) ? sl["filteredItems"] : sl["items"]
598
+ ) as SettingItem[];
599
+ if (display.length === 0) return;
600
+
601
+ const current = display[idx];
602
+ if (current === undefined) return;
603
+ const currentProv = current.id.split("/")[0] ?? "";
604
+ const provIdx = providerOrder.indexOf(currentProv);
605
+
606
+ let target: number;
607
+ if (direction === "prev") {
608
+ if (provIdx <= 0) {
609
+ target = 0;
610
+ } else {
611
+ const prev = providerOrder[provIdx - 1] ?? "";
612
+ target = 0;
613
+ for (let i = display.length - 1; i >= 0; i--) {
614
+ if (display[i]?.id.startsWith(`${prev}/`) === true) {
615
+ target = i;
616
+ break;
617
+ }
618
+ }
619
+ }
620
+ } else {
621
+ if (provIdx >= providerOrder.length - 1) {
622
+ target = display.length - 1;
623
+ } else {
624
+ const next = providerOrder[provIdx + 1] ?? "";
625
+ target = display.length - 1;
626
+ for (let i = 0; i < display.length; i++) {
627
+ if (display[i]?.id.startsWith(`${next}/`) === true) {
628
+ target = i;
629
+ break;
630
+ }
631
+ }
632
+ }
633
+ }
634
+ sl["selectedIndex"] = target;
635
+ }
636
+
584
637
  return {
585
638
  render(width: number): string[] {
586
639
  return list.render(width);
@@ -589,7 +642,13 @@ export default function proxyExtension(pi: ExtensionAPI): void {
589
642
  list.invalidate();
590
643
  },
591
644
  handleInput(data: string): void {
592
- list.handleInput(data);
645
+ if (data === "\x1B[D") {
646
+ jumpProvider("prev");
647
+ } else if (data === "\x1B[C") {
648
+ jumpProvider("next");
649
+ } else {
650
+ list.handleInput(data);
651
+ }
593
652
  },
594
653
  };
595
654
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@victor-software-house/pi-openai-proxy",
3
- "version": "4.2.2",
3
+ "version": "4.2.4",
4
4
  "description": "OpenAI-compatible HTTP proxy for pi's multi-provider model registry",
5
5
  "license": "MIT",
6
6
  "author": "Victor Software House",