@mcowger/opencode-plexus 1.3.10 → 1.4.0

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.
Files changed (2) hide show
  1. package/dist/index.js +5 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -120,9 +120,10 @@ function isChatModel(model) {
120
120
  return !NON_CHAT_PATTERN.test(`${model.id} ${model.name ?? ""} ${apiHints}`);
121
121
  }
122
122
  var DEFAULT_MODELS_FETCH_TIMEOUT_MS = 1e4;
123
- async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_FETCH_TIMEOUT_MS, etag) {
123
+ async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_FETCH_TIMEOUT_MS, etag, signal) {
124
124
  const controller = new AbortController;
125
125
  const timer = setTimeout(() => controller.abort(), timeoutMs);
126
+ const requestSignal = signal ? AbortSignal.any([signal, controller.signal]) : controller.signal;
126
127
  try {
127
128
  const headers = { Accept: "application/json" };
128
129
  if (apiKey)
@@ -131,7 +132,7 @@ async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_F
131
132
  headers["If-None-Match"] = etag;
132
133
  const res = await fetch(modelsUrl, {
133
134
  headers,
134
- signal: controller.signal
135
+ signal: requestSignal
135
136
  });
136
137
  if (res.status === 304) {
137
138
  return { models: [], notModified: true };
@@ -143,6 +144,8 @@ async function fetchPlexusModels(apiKey, modelsUrl, timeoutMs = DEFAULT_MODELS_F
143
144
  const responseEtag = res.headers.get("etag") ?? undefined;
144
145
  return { models: raw.data ?? [], raw, etag: responseEtag };
145
146
  } catch (err) {
147
+ if (signal?.aborted)
148
+ throw err;
146
149
  if (err instanceof Error && err.name === "AbortError") {
147
150
  throw new Error(`Plexus models fetch timed out after ${timeoutMs}ms`);
148
151
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcowger/opencode-plexus",
3
- "version": "1.3.10",
3
+ "version": "1.4.0",
4
4
  "description": "OpenCode plugin: Plexus provider with dynamic model discovery",
5
5
  "type": "module",
6
6
  "module": "./dist/index.js",