@mcowger/pi-plexus 1.0.3 → 1.0.4

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
@@ -227,7 +227,7 @@ Models with a falsy `id` are skipped. Missing metadata falls back to safe defaul
227
227
 
228
228
  ## Adapter behavior
229
229
 
230
- - **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.
230
+ - **pi** refreshes on startup, extension reload, and through `/plexus refresh`. It accepts either root URLs or URLs ending in `/v1` and normalizes them before calling Plexus.
231
231
  - **OpenCode** seeds the provider from cache or a placeholder model during config loading, then performs live discovery through the `provider.models` hook. If Plexus is slow or unavailable, OpenCode uses the cache and lets the refresh continue in the background.
232
232
  - Both adapters convert Plexus's per-token base and tier rates to the per-million-token units expected by their host.
233
233
 
package/dist/extension.js CHANGED
@@ -470,6 +470,9 @@ function getPlexusModelBaseUrl(baseUrl, api) {
470
470
  const apiBase = normalized.endsWith("/v1") ? normalized : `${normalized}/v1`;
471
471
  return adjustBaseUrl(apiBase, api);
472
472
  }
473
+ function shouldRefreshModels(reason) {
474
+ return reason === "startup" || reason === "reload";
475
+ }
473
476
  var currentModels = [];
474
477
  function plexusExtension(pi) {
475
478
  const cached = readCachedModelsSync();
@@ -488,7 +491,11 @@ function plexusExtension(pi) {
488
491
  oauth: createPlexusLoginProvider(pi)
489
492
  });
490
493
  currentModels = startupModels;
491
- pi.on("session_start", async (_event, ctx) => {
494
+ pi.on("session_start", async (event, ctx) => {
495
+ if (!shouldRefreshModels(event.reason)) {
496
+ log("session_start: skipping refresh", { reason: event.reason });
497
+ return;
498
+ }
492
499
  const apiKey = await ctx.modelRegistry.authStorage.getApiKey(PROVIDER_NAME) ?? getEnvApiKey();
493
500
  const baseUrl = getBaseUrl();
494
501
  log("session_start", { hasApiKey: !!apiKey, baseUrl });
@@ -608,6 +615,7 @@ async function trySetDefaultModel(pi, models) {
608
615
  log("trySetDefaultModel", { defaultModelId, ok });
609
616
  }
610
617
  export {
618
+ shouldRefreshModels,
611
619
  getPlexusModelBaseUrl,
612
620
  plexusExtension as default
613
621
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcowger/pi-plexus",
3
- "version": "1.0.3",
3
+ "version": "1.0.4",
4
4
  "description": "Plexus AI proxy plugin for the pi coding agent",
5
5
  "type": "module",
6
6
  "files": [