@victor-software-house/pi-openai-proxy 3.0.0 → 4.0.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 +11 -15
  2. package/package.json +6 -5
@@ -83,6 +83,12 @@ export default function proxyExtension(pi: ExtensionAPI): void {
83
83
  return registry.getAvailable();
84
84
  }
85
85
 
86
+ function getAllRegisteredModels(): Model<Api>[] {
87
+ const auth = AuthStorage.create();
88
+ const registry = new ModelRegistry(auth);
89
+ return registry.getAll();
90
+ }
91
+
86
92
  function getUniqueProviders(models: readonly Model<Api>[]): string[] {
87
93
  const seen = new Set<string>();
88
94
  for (const m of models) {
@@ -453,7 +459,8 @@ export default function proxyExtension(pi: ExtensionAPI): void {
453
459
 
454
460
  // Public ID preview (first 5 exposed models)
455
461
  const models = getAvailableModels();
456
- const outcome = computeModelExposure(models, buildExposureConfig());
462
+ const allModels = getAllRegisteredModels();
463
+ const outcome = computeModelExposure(models, allModels, buildExposureConfig());
457
464
  if (outcome.ok && outcome.models.length > 0) {
458
465
  const preview = outcome.models.slice(0, 5).map((m) => m.publicId);
459
466
  const suffix =
@@ -475,24 +482,13 @@ export default function proxyExtension(pi: ExtensionAPI): void {
475
482
  const models = getAvailableModels();
476
483
  const issues: string[] = [];
477
484
 
485
+ const allModels = getAllRegisteredModels();
486
+
478
487
  // Check available models
479
488
  if (models.length === 0) {
480
489
  issues.push("No models have auth configured. The proxy will expose 0 models.");
481
490
  }
482
491
 
483
- // Check scoped providers reference valid providers
484
- if (config.modelExposureMode === "scoped") {
485
- const availableProviders = new Set(getUniqueProviders(models));
486
- for (const p of config.scopedProviders) {
487
- if (!availableProviders.has(p)) {
488
- issues.push(`Scoped provider '${p}' has no available models (no auth or unknown).`);
489
- }
490
- }
491
- if (config.scopedProviders.length === 0) {
492
- issues.push("Scoped mode with empty provider list will expose 0 models.");
493
- }
494
- }
495
-
496
492
  // Check custom models reference valid canonical IDs
497
493
  if (config.modelExposureMode === "custom") {
498
494
  const canonicalSet = new Set(models.map((m) => `${m.provider}/${m.id}`));
@@ -507,7 +503,7 @@ export default function proxyExtension(pi: ExtensionAPI): void {
507
503
  }
508
504
 
509
505
  // Run the full exposure computation to catch ID/prefix errors
510
- const outcome = computeModelExposure(models, buildExposureConfig());
506
+ const outcome = computeModelExposure(models, allModels, buildExposureConfig());
511
507
  if (!outcome.ok) {
512
508
  issues.push(outcome.message);
513
509
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@victor-software-house/pi-openai-proxy",
3
- "version": "3.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "OpenAI-compatible HTTP proxy for pi's multi-provider model registry",
5
5
  "license": "MIT",
6
6
  "author": "Victor Software House",
@@ -78,17 +78,18 @@
78
78
  "@commitlint/cli": "^20.5.0",
79
79
  "@commitlint/config-conventional": "^20.5.0",
80
80
  "@limegrass/eslint-plugin-import-alias": "^1.6.1",
81
+ "@semantic-release/changelog": "^6.0.3",
82
+ "@semantic-release/git": "^10.0.1",
83
+ "@semantic-release/github": "^12.0.6",
84
+ "@semantic-release/npm": "^13.1.5",
81
85
  "@types/bun": "^1.3.11",
82
86
  "@types/node": "^25.5.0",
83
87
  "eslint-plugin-zod": "^3.5.0",
84
88
  "lefthook": "^2.1.4",
89
+ "openai": "^6.26.0",
85
90
  "oxlint": "^1.56.0",
86
91
  "oxlint-tsgolint": "^0.17.1",
87
92
  "semantic-release": "^25.0.3",
88
- "@semantic-release/changelog": "^6.0.3",
89
- "@semantic-release/git": "^10.0.1",
90
- "@semantic-release/github": "^12.0.6",
91
- "@semantic-release/npm": "^13.1.5",
92
93
  "tsdown": "^0.21.4",
93
94
  "typescript": "^5.9.3"
94
95
  }