@mcowger/pi-plexus 1.2.5 → 1.2.6
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/README.md +3 -3
- package/dist/extension.js +5 -24
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ To force a model refresh:
|
|
|
105
105
|
/plexus refresh
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
Select a Plexus model explicitly for the current session. With no model ID, Pi opens a selector; you can also pass the exact Plexus model ID directly. This explicit choice is not applied automatically when starting a new session:
|
|
109
109
|
|
|
110
110
|
```
|
|
111
111
|
/plexus set-default-model
|
|
@@ -163,7 +163,7 @@ export PLEXUS_API_KEY=your-api-key
|
|
|
163
163
|
|
|
164
164
|
```
|
|
165
165
|
~/.pi/agent/extensions/plexus/
|
|
166
|
-
config.json # base URL and
|
|
166
|
+
config.json # base URL and model preference metadata
|
|
167
167
|
plexus-models-cache.json # last-fetched model list (startup cache)
|
|
168
168
|
plexus-models-response.json # raw API response (diagnostics)
|
|
169
169
|
plexus.log # extension activity log
|
|
@@ -237,7 +237,7 @@ Models with a falsy `id` are skipped. Missing metadata falls back to safe defaul
|
|
|
237
237
|
|
|
238
238
|
## Adapter behavior
|
|
239
239
|
|
|
240
|
-
- **pi** refreshes on session start and through `/plexus refresh
|
|
240
|
+
- **pi** refreshes on session start and through `/plexus refresh`, without changing the model selected for the session. It accepts either root URLs or URLs ending in `/v1` and normalizes them before calling Plexus.
|
|
241
241
|
- **OpenCode** seeds the provider from the on-disk cache (or a placeholder model) once, during config loading — OpenCode's `provider.models` hook never fires for custom providers, so there is no live discovery at startup. Run `/plexus-refresh` to force a live fetch and rewrite the cache; because OpenCode has no way to hot-reload a custom provider's model list mid-session, a restart is required afterward to see the refreshed models in the picker.
|
|
242
242
|
- OpenCode models retain their upstream model ID, SDK dialect, release date, and reasoning metadata so OpenCode can generate its native GPT, Claude, Gemini, and OpenAI-compatible variants and apply its current request transforms. DeepSeek models also preserve `reasoning_content` across tool-call turns.
|
|
243
243
|
- OpenCode uses a 250K-token context window when Plexus supplies no context metadata; its output fallback remains 20% of that window.
|
package/dist/extension.js
CHANGED
|
@@ -350,9 +350,6 @@ function getBaseUrl() {
|
|
|
350
350
|
const raw = getRawBaseUrl();
|
|
351
351
|
return raw ? normalizeApiBase(raw) : null;
|
|
352
352
|
}
|
|
353
|
-
function getDefaultModel() {
|
|
354
|
-
return getConfigSync().defaultModel ?? null;
|
|
355
|
-
}
|
|
356
353
|
|
|
357
354
|
// src/cache.ts
|
|
358
355
|
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
@@ -506,10 +503,9 @@ function plexusExtension(pi) {
|
|
|
506
503
|
log("session_start", { hasApiKey: !!apiKey, baseUrl });
|
|
507
504
|
if (!apiKey || !baseUrl) {
|
|
508
505
|
log("session_start: no auth configured, skipping refresh");
|
|
509
|
-
await trySetDefaultModel(pi, startupModels, ctx);
|
|
510
506
|
return;
|
|
511
507
|
}
|
|
512
|
-
await doRefresh(pi, apiKey, ctx
|
|
508
|
+
await doRefresh(pi, apiKey, ctx);
|
|
513
509
|
});
|
|
514
510
|
pi.registerCommand("plexus", {
|
|
515
511
|
description: "Plexus provider commands: refresh, set-default-model (setup: /login plexus)",
|
|
@@ -562,7 +558,7 @@ function createPlexusLoginProvider(pi) {
|
|
|
562
558
|
throw new Error("Plexus API key is required.");
|
|
563
559
|
await saveBaseUrl(baseUrl);
|
|
564
560
|
callbacks.onProgress?.("Refreshing Plexus models...");
|
|
565
|
-
await doRefresh(pi, apiKey, null
|
|
561
|
+
await doRefresh(pi, apiKey, null);
|
|
566
562
|
return {
|
|
567
563
|
access: apiKey,
|
|
568
564
|
refresh: apiKey,
|
|
@@ -592,7 +588,7 @@ async function handleRefresh(pi, ctx) {
|
|
|
592
588
|
return;
|
|
593
589
|
}
|
|
594
590
|
ctx.ui.notify("Refreshing Plexus models\u2026", "info");
|
|
595
|
-
await doRefresh(pi, apiKey, ctx
|
|
591
|
+
await doRefresh(pi, apiKey, ctx);
|
|
596
592
|
}
|
|
597
593
|
async function handleSetDefaultModel(pi, ctx, requestedModelId) {
|
|
598
594
|
let modelId = requestedModelId;
|
|
@@ -616,9 +612,9 @@ async function handleSetDefaultModel(pi, ctx, requestedModelId) {
|
|
|
616
612
|
await saveDefaultModel(model.id);
|
|
617
613
|
const registryModel = ctx.modelRegistry.find(PROVIDER_NAME, model.id) ?? model;
|
|
618
614
|
const active = await pi.setModel(registryModel);
|
|
619
|
-
ctx.ui.notify(active ? `
|
|
615
|
+
ctx.ui.notify(active ? `Plexus model selected: ${model.id}.` : `Plexus model ${model.id} was saved but could not be selected in this session.`, active ? "info" : "warning");
|
|
620
616
|
}
|
|
621
|
-
async function doRefresh(pi, apiKey, ctx
|
|
617
|
+
async function doRefresh(pi, apiKey, ctx) {
|
|
622
618
|
const modelsUrl = getModelsUrl();
|
|
623
619
|
const baseUrl = getBaseUrl();
|
|
624
620
|
if (!modelsUrl || !baseUrl) {
|
|
@@ -644,8 +640,6 @@ async function doRefresh(pi, apiKey, ctx, setDefault) {
|
|
|
644
640
|
log("doRefresh: registered", { count: piModels.length });
|
|
645
641
|
if (ctx)
|
|
646
642
|
ctx.ui.notify(`Refreshed ${piModels.length} Plexus models`, "info");
|
|
647
|
-
if (setDefault)
|
|
648
|
-
await trySetDefaultModel(pi, piModels, ctx);
|
|
649
643
|
} catch (error) {
|
|
650
644
|
log("doRefresh: failed", { error: String(error) });
|
|
651
645
|
if (ctx) {
|
|
@@ -653,19 +647,6 @@ async function doRefresh(pi, apiKey, ctx, setDefault) {
|
|
|
653
647
|
}
|
|
654
648
|
}
|
|
655
649
|
}
|
|
656
|
-
async function trySetDefaultModel(pi, models, ctx) {
|
|
657
|
-
const defaultModelId = getDefaultModel();
|
|
658
|
-
if (!defaultModelId)
|
|
659
|
-
return;
|
|
660
|
-
const model = models.find((m) => m.id === defaultModelId);
|
|
661
|
-
if (!model) {
|
|
662
|
-
log("trySetDefaultModel: model not found", { defaultModelId });
|
|
663
|
-
return;
|
|
664
|
-
}
|
|
665
|
-
const registryModel = ctx?.modelRegistry.find(PROVIDER_NAME, defaultModelId) ?? model;
|
|
666
|
-
const ok = await pi.setModel(registryModel);
|
|
667
|
-
log("trySetDefaultModel", { defaultModelId, ok });
|
|
668
|
-
}
|
|
669
650
|
export {
|
|
670
651
|
plexusExtension as default
|
|
671
652
|
};
|