@melaya/runner 1.1.70 → 1.1.71

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/detect.js +13 -1
  2. package/package.json +1 -1
package/dist/detect.js CHANGED
@@ -111,6 +111,16 @@ async function detectClaudeCode(force = false) {
111
111
  const names = await fetchClaudeFamilies(oauth.accessToken, force);
112
112
  return names.map((name) => ({ provider: "claude_code", name }));
113
113
  }
114
+ // The short-lived access token expired but the sign-in is still valid: the
115
+ // CLI only renews it when `claude` runs, and the runtime renews it through
116
+ // the CLI on first use (model.py _refresh_claude_oauth_via_cli). Report the
117
+ // user as signed in (known aliases; no API call with an expired token)
118
+ // instead of "not signed in". Never consume the refresh token here.
119
+ const refreshExpiresAt = Number(oauth.refreshTokenExpiresAt ?? 0);
120
+ if (oauth.accessToken && oauth.refreshToken && (!refreshExpiresAt || Date.now() < refreshExpiresAt)) {
121
+ const cached = networkCacheGet(`claude:${tokenKey(oauth.accessToken)}`, false);
122
+ return (cached ?? CLAUDE_ALIASES_FALLBACK).map((name) => ({ provider: "claude_code", name }));
123
+ }
114
124
  }
115
125
  catch { /* malformed creds → treat as logged out */ }
116
126
  return []; // not logged in / expired → don't advertise models
@@ -209,8 +219,10 @@ async function detectGithubCopilotWith(gh) {
209
219
  },
210
220
  signal: AbortSignal.timeout(6000),
211
221
  });
222
+ // No Copilot seat / revoked token → don't advertise (cached). Anything else
223
+ // (429, 5xx) is transient: null so it is not cached as "not signed in".
212
224
  if (!ex.ok)
213
- return []; // no Copilot seat / revoked → don't advertise
225
+ return ex.status === 401 || ex.status === 403 || ex.status === 404 ? [] : null;
214
226
  const exd = (await ex.json());
215
227
  if (!exd.token)
216
228
  return [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@melaya/runner",
3
- "version": "1.1.70",
3
+ "version": "1.1.71",
4
4
  "description": "Run Melaya AI pipelines locally with your own LM Studio or Ollama models",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Melaya Labs LLC",