@goodandready/dsh-key-rotation 0.7.18 → 0.7.20

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 (3) hide show
  1. package/lib/client.js +850 -763
  2. package/lib/index.js +2 -38
  3. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -256,44 +256,8 @@ export function apply(ctx, config = {}) {
256
256
  let getConfig = () => config;
257
257
  registerConfigBridge(ctx, () => buildRuntime().cloneIds);
258
258
 
259
- // Dashboard widget (#117): fixed bottom-right panel that polls /health.
260
- const DASH_HTML = '<div id="krot-dash" style="position:fixed;top:16px;right:16px;z-index:9999;font:12px/1.4 system-ui;background:var(--dsw-alias-bg-layer-3,#1c1c1e);color:var(--dsw-alias-label-primary,#eee);border:1px solid var(--dsw-alias-border-l2,#333);border-radius:10px;padding:8px 12px;box-shadow:0 2px 8px rgba(0,0,0,.3);max-width:280px;display:block;cursor:grab;user-select:none;touch-action:none"></div>' +
261
- '<script>' +
262
- '(function(){' +
263
- 'console.log("[krot-dash] init");' +
264
- 'var el=document.getElementById("krot-dash");if(!el){console.log("[krot-dash] no element");return;}console.log("[krot-dash] el found, parent=",el.parentNode?el.parentNode.tagName:"none");' +
265
- 'if(document.body&&el.parentNode!==document.body){document.body.appendChild(el);}' +
266
- 'var shown=false;' +
267
- 'var saved=null;try{saved=JSON.parse(localStorage.getItem("krot-dash-pos")||"null");}catch(e){}' +
268
- 'if(saved){el.style.left=saved.left+"px";el.style.top=saved.top+"px";el.style.right="auto";}' +
269
- 'function poll(){console.log("[krot-dash] poll");' +
270
- 'fetch("/dsh-key-rotation/health",{headers:{accept:"application/json"}})' +
271
- '.then(function(r){return r.ok?r.json():null;})' +
272
- '.then(function(d){if(!d)return;' +
273
- 'if(!shown){el.style.display="block";shown=true;}' +
274
- 'var lines=[];' +
275
- 'for(var name in d.pools){var p=d.pools[name];' +
276
- 'var color=p.exhausted?"#e5484d":(p.healthy<p.total?"#f5a623":"#30a46c");' +
277
- 'lines.push(\'<div style="display:flex;align-items:center;gap:6px;margin:2px 0"><span style="width:8px;height:8px;border-radius:50%;background:\'+color+\';flex:none"></span><span style="flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap">\'+name+\'</span><span style="opacity:.6">\'+p.healthy+\'/\'+p.total+\'</span></div>\');' +
278
- '}' +
279
- 'el.innerHTML=lines.join("")||\'<div style="opacity:.6">no pools</div>\';' +
280
- '})' +
281
- '.catch(function(){});' +
282
- '}' +
283
- 'poll();' +
284
- 'setInterval(poll,4000);' +
285
- '// drag to move' +
286
- 'var dragging=false,ox=0,oy=0;' +
287
- 'el.addEventListener("mousedown",function(e){dragging=true;ox=e.clientX-el.offsetLeft;oy=e.clientY-el.offsetTop;el.style.cursor="grabbing";e.preventDefault();});' +
288
- 'document.addEventListener("mousemove",function(e){if(!dragging)return;var x=e.clientX-ox,y=e.clientY-oy;x=Math.max(0,Math.min(x,window.innerWidth-el.offsetWidth));y=Math.max(0,Math.min(y,window.innerHeight-el.offsetHeight));el.style.left=x+"px";el.style.top=y+"px";el.style.right="auto";});' +
289
- 'document.addEventListener("mouseup",function(){if(!dragging)return;dragging=false;el.style.cursor="grab";try{localStorage.setItem("krot-dash-pos",JSON.stringify({left:el.offsetLeft,top:el.offsetTop}));}catch(e){}});' +
290
- '})();' +
291
- '</script>';
292
- ctx.effect(() => ctx.webServer.tapIndex((html) => {
293
- const at = html.indexOf('</body>');
294
- if (at === -1) return html + DASH_HTML;
295
- return html.slice(0, at) + DASH_HTML + html.slice(at);
296
- }), 'dsh-key-rotation: dashboard');
259
+ // Dashboard widget now lives in client.js (mountDashboard, see issue #152).
260
+ const DASH_HTML = '';
297
261
  // ── key-pool state, persisted across config reloads ──
298
262
  // base provider -> { failedUntil: Map<ref, epochMs>, pointer: number, lastUsed: ref }
299
263
  const poolState = new Map();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-key-rotation",
3
- "version": "0.7.18",
3
+ "version": "0.7.20",
4
4
  "description": "Per-provider API key rotation for DeepSeek Harness: a key pool per provider, auto-created clone routes, and switching to the next key on quota/rate-limit errors. Includes a Settings section (Key Rotation) to edit the key pools, cooldown and switch codes.",
5
5
  "keywords": [
6
6
  "deepseek-harness",