@bivy/bivy 0.10.1-staging.201 → 0.10.1-staging.202
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 +5 -0
- package/dist/server.js +25 -12
- package/package.json +1 -1
|
@@ -272,6 +272,11 @@ class PiSession {
|
|
|
272
272
|
await runtime.getAvailable();
|
|
273
273
|
return runtime.getModels().map((model) => toModelInfo(model, runtime.hasConfiguredAuth(model.provider)));
|
|
274
274
|
}
|
|
275
|
+
/** Reload the projected models.json in-place so a live session immediately
|
|
276
|
+
* sees custom endpoints added after that session was created. */
|
|
277
|
+
async refreshModels() {
|
|
278
|
+
await this.session.modelRuntime.refresh({ allowNetwork: true });
|
|
279
|
+
}
|
|
275
280
|
getCurrentModel() {
|
|
276
281
|
const model = this.session.model;
|
|
277
282
|
return model ? toModelInfo(model) : undefined;
|
package/dist/server.js
CHANGED
|
@@ -5054,20 +5054,33 @@ function nativeLoginCommand() {
|
|
|
5054
5054
|
return `cd ${shellQuote(repoRoot)} && BIVY_WORKSPACE=${shellQuote(active?.workspace ?? defaultWorkspace)} npm run bivy -- login`;
|
|
5055
5055
|
}
|
|
5056
5056
|
async function refreshSessionAfterAuth() {
|
|
5057
|
-
// Model runtimes load the projected models.json
|
|
5058
|
-
//
|
|
5059
|
-
//
|
|
5060
|
-
//
|
|
5061
|
-
|
|
5057
|
+
// Model runtimes load the projected models.json into memory. Scratch sessions
|
|
5058
|
+
// are disposable, so evict them and let the next picker read build a fresh
|
|
5059
|
+
// one. Live sessions are not disposable: replacing `active` with a brand-new
|
|
5060
|
+
// session left the client's original session (the one models.list names by
|
|
5061
|
+
// id) on its stale catalog, so custom providers never appeared there. Reload
|
|
5062
|
+
// capable runtimes in place instead.
|
|
5063
|
+
const scratchRecords = new Set(modelQueryScratch.values());
|
|
5064
|
+
for (const record of scratchRecords)
|
|
5062
5065
|
closeSessionRecord(record);
|
|
5063
|
-
}
|
|
5064
5066
|
modelQueryScratch.clear();
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
|
|
5067
|
+
const sessions = new Map();
|
|
5068
|
+
for (const record of openSessions.values())
|
|
5069
|
+
sessions.set(record.id, record);
|
|
5070
|
+
await Promise.all([...sessions.values()].map(async (record) => {
|
|
5071
|
+
if (typeof record.session.refreshModels !== "function")
|
|
5072
|
+
return;
|
|
5073
|
+
try {
|
|
5074
|
+
await record.session.refreshModels();
|
|
5075
|
+
}
|
|
5076
|
+
catch (error) {
|
|
5077
|
+
broadcast({
|
|
5078
|
+
type: "session.error",
|
|
5079
|
+
sessionId: record.id,
|
|
5080
|
+
error: `Could not refresh models: ${error instanceof Error ? error.message : String(error)}`,
|
|
5081
|
+
});
|
|
5082
|
+
}
|
|
5083
|
+
}));
|
|
5071
5084
|
}
|
|
5072
5085
|
/**
|
|
5073
5086
|
* The "Models & providers" list. `base` is the node's per-provider auth status
|
package/package.json
CHANGED