@victor-software-house/pi-openai-proxy 0.2.0 → 0.2.1

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.
Files changed (2) hide show
  1. package/extensions/proxy.ts +33 -28
  2. package/package.json +1 -1
@@ -483,42 +483,47 @@ export default function proxyExtension(pi: ExtensionAPI): void {
483
483
 
484
484
  await ctx.ui.custom<void>(
485
485
  (tui, theme, _kb, done) => {
486
- const container = new Container();
487
- container.addChild(new Text(theme.fg("accent", theme.bold("Proxy Settings")), 1, 0));
488
- container.addChild(new Text(theme.fg("dim", getConfigPath()), 1, 0));
489
-
490
- const settingsList = new SettingsList(
491
- buildSettingItems(),
492
- 10,
493
- getSettingsListTheme(),
494
- (id, newValue) => {
495
- applySetting(id, newValue);
496
- // Rebuild items to reflect normalized values
497
- settingsList.setItems(buildSettingItems());
498
- tui.requestRender();
499
- },
500
- () => done(undefined),
501
- { enableSearch: true },
502
- );
486
+ function build(): { container: Container; settingsList: SettingsList } {
487
+ const container = new Container();
488
+ container.addChild(new Text(theme.fg("accent", theme.bold("Proxy Settings")), 1, 0));
489
+ container.addChild(new Text(theme.fg("dim", getConfigPath()), 1, 0));
490
+
491
+ const settingsList = new SettingsList(
492
+ buildSettingItems(),
493
+ 10,
494
+ getSettingsListTheme(),
495
+ (id, newValue) => {
496
+ applySetting(id, newValue);
497
+ current = build();
498
+ tui.requestRender();
499
+ },
500
+ () => done(undefined),
501
+ { enableSearch: true },
502
+ );
503
+
504
+ container.addChild(settingsList);
505
+ container.addChild(
506
+ new Text(
507
+ theme.fg("dim", "Esc: close | Arrow keys: navigate | Space: toggle | Restart proxy to apply"),
508
+ 1,
509
+ 0,
510
+ ),
511
+ );
512
+
513
+ return { container, settingsList };
514
+ }
503
515
 
504
- container.addChild(settingsList);
505
- container.addChild(
506
- new Text(
507
- theme.fg("dim", "Esc: close | Arrow keys: navigate | Space: toggle | Restart proxy to apply"),
508
- 1,
509
- 0,
510
- ),
511
- );
516
+ let current = build();
512
517
 
513
518
  return {
514
519
  render(width: number): string[] {
515
- return container.render(width);
520
+ return current.container.render(width);
516
521
  },
517
522
  invalidate(): void {
518
- container.invalidate();
523
+ current.container.invalidate();
519
524
  },
520
525
  handleInput(data: string): void {
521
- settingsList.handleInput?.(data);
526
+ current.settingsList.handleInput?.(data);
522
527
  tui.requestRender();
523
528
  },
524
529
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@victor-software-house/pi-openai-proxy",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Local OpenAI-compatible HTTP proxy built on pi's SDK",
5
5
  "license": "MIT",
6
6
  "author": "Victor Software House",