agent-dag 1.30.0 → 1.30.1
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.
package/dist/web/index.html
CHANGED
|
@@ -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-
|
|
8
|
+
<script type="module" crossorigin src="/assets/index-DJb8KUBm.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="/assets/index-BLOOP_Fy.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.
|
|
3
|
+
"version": "1.30.1",
|
|
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": {
|
|
@@ -62,12 +62,28 @@ let _lastNudge = 0;
|
|
|
62
62
|
* Fire-and-forget. The result lands in the store for the next poll to pick up;
|
|
63
63
|
* making the caller wait would just delay the numbers it already has.
|
|
64
64
|
*/
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
/**
|
|
66
|
+
* Whether anything is waiting to be collected.
|
|
67
|
+
*
|
|
68
|
+
* An account with a row is due when its own schedule says so. An account with
|
|
69
|
+
* NO row has never been fetched at all, which is due by definition — and that
|
|
70
|
+
* was the gap: a freshly added account has no usage.json entry, so nothing was
|
|
71
|
+
* ever "due", so the collector was never asked, so the row never appeared. The
|
|
72
|
+
* panel sat on "never fetched" indefinitely unless the user happened to run
|
|
73
|
+
* cswap themselves.
|
|
74
|
+
*/
|
|
75
|
+
export function collectionDue(rows, slots, now) {
|
|
76
|
+
for (const slot of slots) {
|
|
77
|
+
if (!rows[slot]) return true; // never fetched
|
|
78
|
+
}
|
|
79
|
+
return Object.values(rows).some(r =>
|
|
68
80
|
typeof r?.nextPollAt === "number" && r.nextPollAt * 1000 <= now
|
|
69
81
|
);
|
|
70
|
-
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function nudgeCollector(rows, slots, now) {
|
|
85
|
+
if (now - _lastNudge < NUDGE_EVERY_MS) return;
|
|
86
|
+
if (!collectionDue(rows, slots, now)) return;
|
|
71
87
|
|
|
72
88
|
_lastNudge = now;
|
|
73
89
|
// Fire-and-forget: this function is deliberately synchronous so callers never
|
|
@@ -132,8 +148,10 @@ export async function fetchClaudeAccounts({ force = false } = {}) {
|
|
|
132
148
|
// A schema bump means the rows may not mean what this code thinks they do.
|
|
133
149
|
const rows = usage?.schemaVersion === 2 ? (usage.accounts ?? {}) : {};
|
|
134
150
|
|
|
135
|
-
// Kick a collection for the NEXT poll if
|
|
136
|
-
|
|
151
|
+
// Kick a collection for the NEXT poll if anything is due — either because
|
|
152
|
+
// claude-swap's schedule says so, or because an account has never been
|
|
153
|
+
// fetched at all.
|
|
154
|
+
nudgeCollector(rows, Object.keys(seq.accounts), now);
|
|
137
155
|
|
|
138
156
|
const order = Array.isArray(seq.sequence) && seq.sequence.length
|
|
139
157
|
? seq.sequence.map(String)
|
|
@@ -295,5 +313,11 @@ export async function seedFirstAccount() {
|
|
|
295
313
|
|
|
296
314
|
invalidateClaudeAccountsCache();
|
|
297
315
|
const count = existsSync(seqPath) ? accountCount(await readJson(seqPath)) : 0;
|
|
316
|
+
if (count > 0) {
|
|
317
|
+
// Collect straight away. Otherwise the first thing the user sees is their
|
|
318
|
+
// account listed with "never fetched" beside it, waiting on a poll cycle
|
|
319
|
+
// for numbers that are the reason the panel exists.
|
|
320
|
+
runDetached(await cswapBin(), ["list"]);
|
|
321
|
+
}
|
|
298
322
|
return count > 0 ? { state: "added", count } : { state: "nothing-to-add" };
|
|
299
323
|
}
|