@mrrlin-dev/external-agents 0.3.2 → 0.3.3

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/package.json +1 -1
  2. package/ui.js +27 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrrlin-dev/external-agents",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "description": "One MCP server for every LLM you talk to \u2014 direct-API dispatcher across Gemini, DeepSeek, Groq, OpenRouter, Cerebras, and more. Part of mrrlin.com.",
5
5
  "type": "module",
6
6
  "main": "server.js",
package/ui.js CHANGED
@@ -358,9 +358,14 @@ async function saveKey(envName) {
358
358
  });
359
359
  const j = await r.json();
360
360
  if (r.ok) {
361
- stat.textContent = "✓ persisted to " + j.persisted_to + ". Restart your MCP client to pick it up.";
361
+ const nProbed = (j.reprobed || []).length;
362
+ stat.textContent = "✓ persisted to keys.env" + (nProbed ? " · " + nProbed + " entries re-probed" : "");
362
363
  stat.className = "status";
363
364
  inp.value = "";
365
+ // Immediately refresh the table + banner so freshly-unlocked entries
366
+ // drop from the banner without a manual page reload. State has already
367
+ // been server-side re-probed by /api/set_credential.
368
+ await refresh();
364
369
  } else {
365
370
  stat.textContent = "error: " + (j.error || r.statusText);
366
371
  stat.className = "status err";
@@ -423,11 +428,31 @@ const server = http.createServer(async (req, res) => {
423
428
  // restart to see it. We tell them so in the response.
424
429
  process.env[env_name] = value;
425
430
  console.error(`external-agents ui: credential persisted for ${env_name} (${value.length} chars)`);
431
+ // Re-probe every registry entry that references this env var — either
432
+ // via its `auth: "env:XYZ"` field or its `transports.generate_new.env`.
433
+ // Without this, state.json keeps its stale `needs_auth` marker until
434
+ // the operator restarts the process, and the banner keeps counting
435
+ // just-unlocked entries as still-locked. State + banner reconcile now.
436
+ const affected = REGISTRY.agents.filter((a) => {
437
+ const authVar = typeof a.auth === "string" && a.auth.startsWith("env:")
438
+ ? a.auth.slice("env:".length).split(/\s+/)[0]
439
+ : null;
440
+ const genVar = a.transports?.generate_new?.env || null;
441
+ return authVar === env_name || genVar === env_name;
442
+ });
443
+ const patch = {};
444
+ for (const a of affected) {
445
+ const r = probeInstalled(a);
446
+ patch[a.id] = { ...r, checked: Math.floor(Date.now() / 1000) };
447
+ }
448
+ if (Object.keys(patch).length > 0) writeState(patch);
449
+ console.error(`external-agents ui: re-probed ${affected.length} entries after set_credential(${env_name}): ${affected.map((a) => a.id).join(", ")}`);
426
450
  return json(res, 200, {
427
451
  ok: true,
428
452
  env_name,
429
453
  persisted_to: KEYS_FILE,
430
- restart_required: "Restart your MCP client (Claude Code / Codex) to pick up the new key.",
454
+ reprobed: affected.map((a) => a.id),
455
+ restart_required: "Restart your MCP client (Claude Code / Codex) so IT reads keys.env too.",
431
456
  });
432
457
  } catch (e) {
433
458
  return json(res, 400, { error: "invalid json: " + e.message });