@bivy/bivy 0.16.25-staging.14 → 0.16.25-staging.16
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/dist/agents/pi/runtime.js +27 -3
- package/dist/server.js +13 -1
- package/package.json +1 -1
|
@@ -268,8 +268,29 @@ class PiSession {
|
|
|
268
268
|
* reload. Async because that resolution reads the store.
|
|
269
269
|
*/
|
|
270
270
|
async getModels() {
|
|
271
|
-
const
|
|
272
|
-
|
|
271
|
+
const runtime = this.session.modelRuntime;
|
|
272
|
+
try {
|
|
273
|
+
const models = await runtime.getAvailable();
|
|
274
|
+
return models.map((model) => toModelInfo(model, true));
|
|
275
|
+
}
|
|
276
|
+
catch (error) {
|
|
277
|
+
// The runtime's availability refresh is a Promise.all across every
|
|
278
|
+
// provider's auth check, so one broken provider (an unreachable custom
|
|
279
|
+
// endpoint, a single failing credential read) rejects the whole catalog
|
|
280
|
+
// and the picker shows nothing. Degrade to per-provider listing and
|
|
281
|
+
// skip only the broken ones; rethrow only when truly nothing survives.
|
|
282
|
+
const models = [];
|
|
283
|
+
for (const provider of runtime.getProviders()) {
|
|
284
|
+
try {
|
|
285
|
+
for (const model of await runtime.getAvailable(provider.id))
|
|
286
|
+
models.push(toModelInfo(model, true));
|
|
287
|
+
}
|
|
288
|
+
catch { /* this provider is broken — the rest still list */ }
|
|
289
|
+
}
|
|
290
|
+
if (models.length)
|
|
291
|
+
return models;
|
|
292
|
+
throw error instanceof Error ? error : new Error(String(error));
|
|
293
|
+
}
|
|
273
294
|
}
|
|
274
295
|
/**
|
|
275
296
|
* Every model Pi knows about — built-in and custom, regardless of whether
|
|
@@ -281,7 +302,10 @@ class PiSession {
|
|
|
281
302
|
async getAllModels() {
|
|
282
303
|
const runtime = this.session.modelRuntime;
|
|
283
304
|
// Refresh availability first so `hasConfiguredAuth` reflects current creds.
|
|
284
|
-
|
|
305
|
+
// Best-effort: a failed refresh (one broken provider rejects the shared
|
|
306
|
+
// Promise.all) must not blank the full catalog — the flags then reflect
|
|
307
|
+
// the last successful refresh, which the picker can still act on.
|
|
308
|
+
await runtime.getAvailable().catch(() => { });
|
|
285
309
|
return runtime.getModels().map((model) => toModelInfo(model, runtime.hasConfiguredAuth(model.provider)));
|
|
286
310
|
}
|
|
287
311
|
/** Reload the projected models.json in-place so a live session immediately
|
package/dist/server.js
CHANGED
|
@@ -2407,7 +2407,19 @@ const RELAY_COMMANDS = {
|
|
|
2407
2407
|
// this a models.list answered for one agent (e.g. Codex's models) could
|
|
2408
2408
|
// linger on the composer/picker after the user switched to another agent
|
|
2409
2409
|
// (e.g. Claude) — the "Claude shows Codex models" bug.
|
|
2410
|
-
|
|
2410
|
+
let event;
|
|
2411
|
+
try {
|
|
2412
|
+
event = await modelsListEventFor(record);
|
|
2413
|
+
}
|
|
2414
|
+
catch (error) {
|
|
2415
|
+
// A catalog read failure must never answer with silence: the generic
|
|
2416
|
+
// relay catch would swallow the rejection and the client (notably a
|
|
2417
|
+
// Cloud launch waiting to validate its saved model) could only guess
|
|
2418
|
+
// via timeout. Name the real reason on the session instead.
|
|
2419
|
+
relay?.sendEvent({ type: "session.error", sessionId: requestedSessionId ?? record.id, error: `Couldn't read this machine's model catalog: ${error instanceof Error ? error.message : String(error)}` });
|
|
2420
|
+
return;
|
|
2421
|
+
}
|
|
2422
|
+
relay?.sendEvent(event);
|
|
2411
2423
|
},
|
|
2412
2424
|
"models.prefetch"(msg) {
|
|
2413
2425
|
// The composer's agent picker opened: warm the scratch session for each
|
package/package.json
CHANGED