@mcowger/pi-plexus 1.2.4 → 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 CHANGED
@@ -105,7 +105,7 @@ To force a model refresh:
105
105
  /plexus refresh
106
106
  ```
107
107
 
108
- Set the model Pi should use by default. With no model ID, Pi opens a selector; you can also pass the exact Plexus model ID directly:
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 optional default model (set via /plexus set-default-model)
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`. It accepts either root URLs or URLs ending in `/v1` and normalizes them before calling Plexus.
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";
@@ -465,6 +462,7 @@ function descriptorToPiModel(descriptor) {
465
462
  id: descriptor.id,
466
463
  name: descriptor.name,
467
464
  api: descriptor.preferredApi,
465
+ provider: descriptor.provider,
468
466
  baseUrl: descriptor.baseUrl,
469
467
  reasoning: descriptor.reasoning,
470
468
  input: descriptor.input,
@@ -505,10 +503,9 @@ function plexusExtension(pi) {
505
503
  log("session_start", { hasApiKey: !!apiKey, baseUrl });
506
504
  if (!apiKey || !baseUrl) {
507
505
  log("session_start: no auth configured, skipping refresh");
508
- await trySetDefaultModel(pi, startupModels);
509
506
  return;
510
507
  }
511
- await doRefresh(pi, apiKey, ctx, true);
508
+ await doRefresh(pi, apiKey, ctx);
512
509
  });
513
510
  pi.registerCommand("plexus", {
514
511
  description: "Plexus provider commands: refresh, set-default-model (setup: /login plexus)",
@@ -561,7 +558,7 @@ function createPlexusLoginProvider(pi) {
561
558
  throw new Error("Plexus API key is required.");
562
559
  await saveBaseUrl(baseUrl);
563
560
  callbacks.onProgress?.("Refreshing Plexus models...");
564
- await doRefresh(pi, apiKey, null, false);
561
+ await doRefresh(pi, apiKey, null);
565
562
  return {
566
563
  access: apiKey,
567
564
  refresh: apiKey,
@@ -591,7 +588,7 @@ async function handleRefresh(pi, ctx) {
591
588
  return;
592
589
  }
593
590
  ctx.ui.notify("Refreshing Plexus models\u2026", "info");
594
- await doRefresh(pi, apiKey, ctx, true);
591
+ await doRefresh(pi, apiKey, ctx);
595
592
  }
596
593
  async function handleSetDefaultModel(pi, ctx, requestedModelId) {
597
594
  let modelId = requestedModelId;
@@ -613,10 +610,11 @@ async function handleSetDefaultModel(pi, ctx, requestedModelId) {
613
610
  return;
614
611
  }
615
612
  await saveDefaultModel(model.id);
616
- const active = await pi.setModel(model);
617
- ctx.ui.notify(active ? `Default Plexus model set to ${model.id}.` : `Default Plexus model set to ${model.id}; it will be selected when Plexus authentication is available.`, active ? "info" : "warning");
613
+ const registryModel = ctx.modelRegistry.find(PROVIDER_NAME, model.id) ?? model;
614
+ const active = await pi.setModel(registryModel);
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");
618
616
  }
619
- async function doRefresh(pi, apiKey, ctx, setDefault) {
617
+ async function doRefresh(pi, apiKey, ctx) {
620
618
  const modelsUrl = getModelsUrl();
621
619
  const baseUrl = getBaseUrl();
622
620
  if (!modelsUrl || !baseUrl) {
@@ -642,8 +640,6 @@ async function doRefresh(pi, apiKey, ctx, setDefault) {
642
640
  log("doRefresh: registered", { count: piModels.length });
643
641
  if (ctx)
644
642
  ctx.ui.notify(`Refreshed ${piModels.length} Plexus models`, "info");
645
- if (setDefault)
646
- await trySetDefaultModel(pi, piModels);
647
643
  } catch (error) {
648
644
  log("doRefresh: failed", { error: String(error) });
649
645
  if (ctx) {
@@ -651,18 +647,6 @@ async function doRefresh(pi, apiKey, ctx, setDefault) {
651
647
  }
652
648
  }
653
649
  }
654
- async function trySetDefaultModel(pi, models) {
655
- const defaultModelId = getDefaultModel();
656
- if (!defaultModelId)
657
- return;
658
- const model = models.find((m) => m.id === defaultModelId);
659
- if (!model) {
660
- log("trySetDefaultModel: model not found", { defaultModelId });
661
- return;
662
- }
663
- const ok = await pi.setModel(model);
664
- log("trySetDefaultModel", { defaultModelId, ok });
665
- }
666
650
  export {
667
651
  plexusExtension as default
668
652
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcowger/pi-plexus",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "description": "Plexus AI proxy plugin for the pi coding agent",
5
5
  "type": "module",
6
6
  "files": [