@mcowger/opencode-plexus 1.2.0 → 1.2.2
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/index.js +6 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -610,7 +610,7 @@ var PlexusProviderPlugin = async (ctx) => {
|
|
|
610
610
|
return cached ? toRuntimeModels(cached, provider) : {};
|
|
611
611
|
}
|
|
612
612
|
},
|
|
613
|
-
"command.execute.before": async (input
|
|
613
|
+
"command.execute.before": async (input) => {
|
|
614
614
|
if (input.command !== PLEXUS_REFRESH_COMMAND)
|
|
615
615
|
return;
|
|
616
616
|
const configResponse = await client.config.get();
|
|
@@ -618,19 +618,16 @@ var PlexusProviderPlugin = async (ctx) => {
|
|
|
618
618
|
const storedAuth = await readStoredAuth();
|
|
619
619
|
const { baseURL, apiKey } = resolveConfig(provider, storedAuth?.metadata);
|
|
620
620
|
const key = storedAuth?.key ?? apiKey;
|
|
621
|
-
const textPart = (text) => ({ type: "text", text, synthetic: true });
|
|
622
621
|
if (!baseURL) {
|
|
623
|
-
|
|
624
|
-
return;
|
|
622
|
+
throw new Error("Plexus refresh failed: no baseURL configured. Run /connect first.");
|
|
625
623
|
}
|
|
624
|
+
let models;
|
|
626
625
|
try {
|
|
627
|
-
|
|
628
|
-
output.parts = [
|
|
629
|
-
textPart(`Plexus models refreshed: ${Object.keys(models).length} models fetched from ${baseURL} and cached. Restart OpenCode to pick up the new model list.`)
|
|
630
|
-
];
|
|
626
|
+
models = await refreshModels(client, baseURL, log, key, true);
|
|
631
627
|
} catch (e) {
|
|
632
|
-
|
|
628
|
+
throw new Error(`Plexus refresh failed: ${String(e)}. Existing cache left untouched.`);
|
|
633
629
|
}
|
|
630
|
+
throw new Error(`Plexus models refreshed: ${Object.keys(models).length} models fetched from ${baseURL} and cached. Restart OpenCode to pick up the new model list.`);
|
|
634
631
|
},
|
|
635
632
|
auth: {
|
|
636
633
|
provider: PLEXUS_PROVIDER_ID,
|