agent-dag 1.30.8 → 1.30.9

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.
@@ -5,7 +5,7 @@
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <title>agents-deck</title>
7
7
  <link rel="icon" href="data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Ctext y='84' font-size='84'%3E%E2%97%89%3C/text%3E%3C/svg%3E" />
8
- <script type="module" crossorigin src="/assets/index-1i-Vckvo.js"></script>
8
+ <script type="module" crossorigin src="/assets/index-bPVurIAI.js"></script>
9
9
  <link rel="stylesheet" crossorigin href="/assets/index-CEAcuttN.css">
10
10
  </head>
11
11
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-dag",
3
- "version": "1.30.8",
3
+ "version": "1.30.9",
4
4
  "description": "Live deck of Claude Code and Codex agents — watch parallel subagents fork, call tools, and return on one calm canvas. Also available as npx ccdeck and npx agent-dag.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -357,6 +357,20 @@ async function storeQuota() {
357
357
  const REREAD_TRIES = 3;
358
358
  const REREAD_GAP_MS = 800;
359
359
 
360
+ /**
361
+ * Whichever of two readings was collected later, regardless of source.
362
+ *
363
+ * Quota numbers only ever move forward in time, so "newer" is the only ranking
364
+ * that makes sense between a store row and something we fetched ourselves. A
365
+ * five-hour window can also reset between the two, which makes an older reading
366
+ * not merely stale but wrong — 23% from before the reset, 3% after it.
367
+ */
368
+ export function freshest(a, b) {
369
+ if (!a) return b ?? null;
370
+ if (!b) return a;
371
+ return (b.fetchedAt ?? 0) > (a.fetchedAt ?? 0) ? b : a;
372
+ }
373
+
360
374
  /** Ask for a collection, then watch the store for the result. */
361
375
  async function nudgeAndReread(previous) {
362
376
  let asked = false;
@@ -426,8 +440,13 @@ async function _doFetch(now, force = false) {
426
440
  // Nothing usable in the store. Everything below spends the user's budget, so
427
441
  // it happens on a floor, and not at all while a 429 cooldown is running.
428
442
  if (!maySelfPoll({ now, force, lastSelfPollAt: _lastSelfPollAt, rateLimitedUntil: _rateLimitedUntil })) {
429
- // A stale row still beats an empty panel, and says how stale it is.
430
- const held = store ?? _lastGood;
443
+ // A stale row still beats an empty panel, and says how stale it is — but
444
+ // it must be the freshest thing we hold, not just the store. Preferring
445
+ // the store here threw away readings we had already paid for: after a boot
446
+ // that fell through to the CLI, the panel showed 3% (fetched seconds ago)
447
+ // and then reverted to 23% (from a 48-minute-old store row) on the very
448
+ // next poll, because the store had not moved.
449
+ const held = freshest(store, _lastGood);
431
450
  if (held) {
432
451
  const result = { ...held, stale: true };
433
452
  _cache = result; _cacheAt = now;