pi-bob 0.2.4 → 0.2.5

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/extensions/bob.ts CHANGED
@@ -164,8 +164,13 @@ function configuredApiKey(): { envName: "IBM_BOB_API_KEY" | "IBM_BOB_KEY"; value
164
164
  return alias ? { envName: "IBM_BOB_KEY", value: alias } : undefined;
165
165
  }
166
166
 
167
- function providerApiKeyReference(): string {
168
- return `$${configuredApiKey()?.envName ?? "IBM_BOB_API_KEY"}`;
167
+ function providerApiKeyReference(): string | undefined {
168
+ const apiKey = configuredApiKey();
169
+ // Only advertise when resolvable at launch: an unresolvable $VAR reference makes
170
+ // pi's /model catalog refresh throw for a logged-out provider ("Could not refresh
171
+ // ibm-bob; showing cached models"). Process env is fixed after launch, so this
172
+ // loses nothing.
173
+ return apiKey ? `$${apiKey.envName}` : undefined;
169
174
  }
170
175
 
171
176
  function apiKeyAuthScheme(): string {
@@ -921,6 +926,7 @@ export default async function (pi: ExtensionAPI) {
921
926
  const headers = buildHeaders(settings);
922
927
  let catalog: BobDiscoveredModel[] | undefined;
923
928
  const apiKey = configuredApiKey();
929
+ const apiKeyRef = providerApiKeyReference();
924
930
  if (apiKey && envBool("IBM_BOB_DISCOVER_MODELS", true)) {
925
931
  try {
926
932
  catalog = await fetchBobModelCatalog(apiKey.value, apiKeyAuthScheme(), settings);
@@ -934,7 +940,7 @@ export default async function (pi: ExtensionAPI) {
934
940
  pi.registerProvider(PROVIDER_ID, {
935
941
  name: "IBM Bob",
936
942
  baseUrl: providerRequestBaseUrl(api),
937
- apiKey: providerApiKeyReference(),
943
+ ...(apiKeyRef ? { apiKey: apiKeyRef } : {}),
938
944
  api: BOB_API,
939
945
  ...(headers ? { headers } : {}),
940
946
  models: buildModels(api, catalog),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-bob",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
4
4
  "type": "module",
5
5
  "description": "Pi provider extension for IBM Bob / IBM-approved compatible model endpoints.",
6
6
  "keywords": [