@adhdev/daemon-standalone 1.0.56-rc.18 → 1.0.56-rc.19
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/index.js +229 -17
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/vendor/mcp-server/index.js.map +1 -1
package/dist/index.js
CHANGED
|
@@ -36053,7 +36053,9 @@ var require_dist3 = __commonJS({
|
|
|
36053
36053
|
onDependencyFailure: "block"
|
|
36054
36054
|
};
|
|
36055
36055
|
DEFAULT_QUOTA_ROUTING_POLICY = {
|
|
36056
|
-
|
|
36056
|
+
// ★Must stay equal to quota/refresh.ts QUOTA_ROUTABLE_MAX_AGE_MS —
|
|
36057
|
+
// quota-routing-staleness-agreement.test.ts fails on drift.
|
|
36058
|
+
staleAfterMs: 60 * 60 * 1e3,
|
|
36057
36059
|
sessionMinRemainingPercent: 10,
|
|
36058
36060
|
sessionResetImminentMs: 5 * 60 * 1e3,
|
|
36059
36061
|
weeklyMinRemainingPercent: 15,
|
|
@@ -36620,10 +36622,10 @@ var require_dist3 = __commonJS({
|
|
|
36620
36622
|
}
|
|
36621
36623
|
function getDaemonBuildInfo() {
|
|
36622
36624
|
if (cached2) return cached2;
|
|
36623
|
-
const commit = readInjected(true ? "
|
|
36624
|
-
const commitShort = readInjected(true ? "
|
|
36625
|
-
const version2 = readInjected(true ? "1.0.56-rc.
|
|
36626
|
-
const builtAt = readInjected(true ? "2026-08-
|
|
36625
|
+
const commit = readInjected(true ? "6d9cfa28a604d36d2b29cf1cdd21499c13171ab4" : void 0) ?? "unknown";
|
|
36626
|
+
const commitShort = readInjected(true ? "6d9cfa28" : void 0) ?? (commit !== "unknown" ? commit.slice(0, 7) : "unknown");
|
|
36627
|
+
const version2 = readInjected(true ? "1.0.56-rc.19" : void 0) ?? readInjected(typeof process !== "undefined" ? process.env?.ADHDEV_PKG_VERSION : void 0) ?? "unknown";
|
|
36628
|
+
const builtAt = readInjected(true ? "2026-08-20T17:59:03.306Z" : void 0);
|
|
36627
36629
|
cached2 = builtAt ? { commit, commitShort, version: version2, builtAt } : { commit, commitShort, version: version2 };
|
|
36628
36630
|
return cached2;
|
|
36629
36631
|
}
|
|
@@ -41126,6 +41128,26 @@ child.on('exit', () => process.exit(0));
|
|
|
41126
41128
|
}
|
|
41127
41129
|
};
|
|
41128
41130
|
}
|
|
41131
|
+
function stampFetchedAt(quota, now) {
|
|
41132
|
+
return { ...quota, metadata: { ...quota.metadata, fetchedAt: now } };
|
|
41133
|
+
}
|
|
41134
|
+
function lastAttemptAt(entry) {
|
|
41135
|
+
if (!entry) return void 0;
|
|
41136
|
+
const fetchedAt = Number(entry.metadata?.fetchedAt);
|
|
41137
|
+
if (Number.isFinite(fetchedAt) && fetchedAt > 0) return fetchedAt;
|
|
41138
|
+
const updatedAt = Number(entry.updatedAt);
|
|
41139
|
+
return Number.isFinite(updatedAt) && updatedAt > 0 ? updatedAt : void 0;
|
|
41140
|
+
}
|
|
41141
|
+
function isDueByAxisTtl(provider, now = Date.now(), ttlTable = QUOTA_AXIS_TTL_MS) {
|
|
41142
|
+
const ttl = ttlTable[provider];
|
|
41143
|
+
if (!Number.isFinite(ttl)) return false;
|
|
41144
|
+
const attemptedAt = lastAttemptAt(cache.get(provider));
|
|
41145
|
+
if (attemptedAt === void 0) return true;
|
|
41146
|
+
return now - attemptedAt >= ttl;
|
|
41147
|
+
}
|
|
41148
|
+
function isDueBySwrTtl(provider, now = Date.now()) {
|
|
41149
|
+
return isDueByAxisTtl(provider, now, QUOTA_SWR_TTL_MS);
|
|
41150
|
+
}
|
|
41129
41151
|
function readQuotaCache() {
|
|
41130
41152
|
if (cache.size === 0) return void 0;
|
|
41131
41153
|
return Object.fromEntries(cache);
|
|
@@ -41166,8 +41188,9 @@ child.on('exit', () => process.exit(0));
|
|
|
41166
41188
|
const retryAtMs = entry.metadata?.retryAtMs;
|
|
41167
41189
|
return typeof retryAtMs === "number" && retryAtMs > now;
|
|
41168
41190
|
}
|
|
41169
|
-
async function refreshQuotaCacheOnce(fetchers = REFRESHERS, isEnabled) {
|
|
41170
|
-
const
|
|
41191
|
+
async function refreshQuotaCacheOnce(fetchers = REFRESHERS, isEnabled, options = {}) {
|
|
41192
|
+
const selected = options.probeOnly ? fetchers.filter(({ provider }) => options.probeOnly.has(provider)) : fetchers;
|
|
41193
|
+
const enabled = isEnabled ? selected.filter(({ provider }) => isEnabled(provider)) : selected;
|
|
41171
41194
|
if (isEnabled) {
|
|
41172
41195
|
for (const { provider } of fetchers) {
|
|
41173
41196
|
if (!isEnabled(provider)) {
|
|
@@ -41182,17 +41205,21 @@ child.on('exit', () => process.exit(0));
|
|
|
41182
41205
|
active.map(async ({ provider, fetch: fetch2 }) => {
|
|
41183
41206
|
try {
|
|
41184
41207
|
const fresh = toWireQuota(await fetch2());
|
|
41185
|
-
cache.set(
|
|
41208
|
+
cache.set(
|
|
41209
|
+
provider,
|
|
41210
|
+
stampFetchedAt(carryForwardLastGoodWindows(cache.get(provider), fresh), Date.now())
|
|
41211
|
+
);
|
|
41186
41212
|
hydratedOnly.delete(provider);
|
|
41187
41213
|
} catch (e) {
|
|
41214
|
+
const now = Date.now();
|
|
41188
41215
|
cache.set(provider, {
|
|
41189
41216
|
provider,
|
|
41190
41217
|
status: "error",
|
|
41191
41218
|
session: null,
|
|
41192
41219
|
weekly: null,
|
|
41193
|
-
updatedAt:
|
|
41220
|
+
updatedAt: now,
|
|
41194
41221
|
error: `Quota fetch threw: ${e?.message || e}`,
|
|
41195
|
-
metadata: { failureKind: "unknown" }
|
|
41222
|
+
metadata: { failureKind: "unknown", fetchedAt: now }
|
|
41196
41223
|
});
|
|
41197
41224
|
hydratedOnly.delete(provider);
|
|
41198
41225
|
}
|
|
@@ -41264,6 +41291,7 @@ child.on('exit', () => process.exit(0));
|
|
|
41264
41291
|
function startQuotaRefreshLoop(options) {
|
|
41265
41292
|
const intervalMs = options.intervalMs ?? QUOTA_REFRESH_INTERVAL_MS;
|
|
41266
41293
|
const fetchers = options.fetchers ?? REFRESHERS;
|
|
41294
|
+
if (options.isEnabled) ambientIsEnabled = options.isEnabled;
|
|
41267
41295
|
let running = false;
|
|
41268
41296
|
const timer = setInterval(() => {
|
|
41269
41297
|
if (running) return;
|
|
@@ -41273,15 +41301,22 @@ child.on('exit', () => process.exit(0));
|
|
|
41273
41301
|
} catch {
|
|
41274
41302
|
active = false;
|
|
41275
41303
|
}
|
|
41276
|
-
const
|
|
41277
|
-
|
|
41304
|
+
const backfillDue = (provider) => !!options.isEnabled && (!cache.has(provider) || isFailureRetryDue(provider) || isSnapshotStaleForRouting(provider));
|
|
41305
|
+
const due = fetchers.filter(({ provider }) => {
|
|
41306
|
+
if (options.isEnabled && !options.isEnabled(provider)) return false;
|
|
41307
|
+
if (backfillDue(provider)) return true;
|
|
41308
|
+
return active && isDueByAxisTtl(provider);
|
|
41309
|
+
});
|
|
41310
|
+
const needsPrune = !!options.isEnabled && fetchers.some(({ provider }) => !options.isEnabled(provider) && cache.has(provider));
|
|
41311
|
+
if (due.length === 0 && !needsPrune) return;
|
|
41278
41312
|
running = true;
|
|
41279
|
-
|
|
41313
|
+
const probeOnly = new Set(due.map(({ provider }) => provider));
|
|
41314
|
+
void refreshQuotaCacheOnce(fetchers, options.isEnabled, { probeOnly }).catch((e) => LOG2.warn("Quota", `Quota refresh tick error: ${e?.message || e}`)).finally(() => {
|
|
41280
41315
|
running = false;
|
|
41281
41316
|
});
|
|
41282
41317
|
}, intervalMs);
|
|
41283
41318
|
if (typeof timer.unref === "function") timer.unref();
|
|
41284
|
-
LOG2.info("Quota", `Quota refresh loop started (interval ${intervalMs}ms, idle machines skipped)`);
|
|
41319
|
+
LOG2.info("Quota", `Quota refresh loop started (interval ${intervalMs}ms, per-axis TTL, idle machines skipped)`);
|
|
41285
41320
|
return {
|
|
41286
41321
|
stop() {
|
|
41287
41322
|
clearInterval(timer);
|
|
@@ -41329,10 +41364,87 @@ child.on('exit', () => process.exit(0));
|
|
|
41329
41364
|
}
|
|
41330
41365
|
};
|
|
41331
41366
|
}
|
|
41367
|
+
function readQuotaCacheWithRevalidate(now = Date.now()) {
|
|
41368
|
+
const snapshot = readQuotaCache();
|
|
41369
|
+
try {
|
|
41370
|
+
scheduleStaleRevalidate(now);
|
|
41371
|
+
} catch (e) {
|
|
41372
|
+
LOG2.warn("Quota", `Quota revalidate scheduling failed: ${e?.message || e}`);
|
|
41373
|
+
}
|
|
41374
|
+
return snapshot;
|
|
41375
|
+
}
|
|
41376
|
+
function scheduleStaleRevalidate(now) {
|
|
41377
|
+
const due = REFRESHERS.filter(({ provider }) => {
|
|
41378
|
+
if (ambientIsEnabled && !ambientIsEnabled(provider)) return false;
|
|
41379
|
+
if (revalidateInFlight.has(provider)) return false;
|
|
41380
|
+
if (isRateLimitedCooldownActive(cache.get(provider), now)) return false;
|
|
41381
|
+
return isDueBySwrTtl(provider, now);
|
|
41382
|
+
});
|
|
41383
|
+
if (due.length === 0) return;
|
|
41384
|
+
for (const { provider } of due) revalidateInFlight.add(provider);
|
|
41385
|
+
const probeOnly = new Set(due.map(({ provider }) => provider));
|
|
41386
|
+
void refreshQuotaCacheOnce(REFRESHERS, ambientIsEnabled, { probeOnly }).catch((e) => LOG2.warn("Quota", `Quota revalidate failed: ${e?.message || e}`)).finally(() => {
|
|
41387
|
+
for (const { provider } of due) revalidateInFlight.delete(provider);
|
|
41388
|
+
});
|
|
41389
|
+
}
|
|
41390
|
+
async function forceRefreshQuota2(providers, now = Date.now()) {
|
|
41391
|
+
const requested = providers && providers.length > 0 ? providers.map((p) => String(p).trim()).filter(Boolean) : REFRESHERS.map(({ provider }) => provider);
|
|
41392
|
+
const entries = [];
|
|
41393
|
+
const probe = [];
|
|
41394
|
+
for (const name of requested) {
|
|
41395
|
+
const refresher = REFRESHERS.find(({ provider: provider2 }) => provider2 === name);
|
|
41396
|
+
if (!refresher) {
|
|
41397
|
+
entries.push({
|
|
41398
|
+
provider: name,
|
|
41399
|
+
outcome: "unsupported",
|
|
41400
|
+
reason: `'${name}' does not report quota on this machine`
|
|
41401
|
+
});
|
|
41402
|
+
continue;
|
|
41403
|
+
}
|
|
41404
|
+
const provider = refresher.provider;
|
|
41405
|
+
if (ambientIsEnabled && !ambientIsEnabled(provider)) {
|
|
41406
|
+
entries.push({
|
|
41407
|
+
provider,
|
|
41408
|
+
outcome: "disabled",
|
|
41409
|
+
reason: `${provider} is disabled on this machine (or its quota probe is turned off)`
|
|
41410
|
+
});
|
|
41411
|
+
continue;
|
|
41412
|
+
}
|
|
41413
|
+
const entry = cache.get(provider);
|
|
41414
|
+
if (isRateLimitedCooldownActive(entry, now)) {
|
|
41415
|
+
const retryAtMs = Number(entry?.metadata?.retryAtMs);
|
|
41416
|
+
const seconds = Math.max(0, Math.ceil((retryAtMs - now) / 1e3));
|
|
41417
|
+
entries.push({
|
|
41418
|
+
provider,
|
|
41419
|
+
outcome: "cooldown",
|
|
41420
|
+
retryAtMs,
|
|
41421
|
+
reason: `${provider} hit its provider's rate limit \u2014 not re-probed for another ${formatDuration(seconds)}. The numbers shown are the last good reading.`
|
|
41422
|
+
});
|
|
41423
|
+
continue;
|
|
41424
|
+
}
|
|
41425
|
+
probe.push(provider);
|
|
41426
|
+
}
|
|
41427
|
+
if (probe.length > 0) {
|
|
41428
|
+
await refreshQuotaCacheOnce(REFRESHERS, ambientIsEnabled, { probeOnly: new Set(probe) }).catch((e) => LOG2.warn("Quota", `Force quota refresh failed: ${e?.message || e}`));
|
|
41429
|
+
for (const provider of probe) entries.push({ provider, outcome: "refreshed" });
|
|
41430
|
+
}
|
|
41431
|
+
entries.sort((a, b) => a.provider.localeCompare(b.provider));
|
|
41432
|
+
return { entries, quota: readQuotaCache() };
|
|
41433
|
+
}
|
|
41434
|
+
function formatDuration(seconds) {
|
|
41435
|
+
if (seconds < 60) return `${seconds}s`;
|
|
41436
|
+
const minutes = Math.floor(seconds / 60);
|
|
41437
|
+
const rest = seconds % 60;
|
|
41438
|
+
return rest === 0 ? `${minutes}m` : `${minutes}m ${rest}s`;
|
|
41439
|
+
}
|
|
41332
41440
|
var QUOTA_REFRESH_INTERVAL_MS;
|
|
41333
41441
|
var QUOTA_ACTIVITY_WINDOW_MS;
|
|
41442
|
+
var QUOTA_AXIS;
|
|
41443
|
+
var QUOTA_AXIS_TTL_MS;
|
|
41444
|
+
var QUOTA_SWR_TTL_MS;
|
|
41334
41445
|
var REFRESHERS;
|
|
41335
41446
|
var cache;
|
|
41447
|
+
var ambientIsEnabled;
|
|
41336
41448
|
var hydratedOnly;
|
|
41337
41449
|
var hydrated;
|
|
41338
41450
|
var QUOTA_FAILURE_MAX_RETRIES;
|
|
@@ -41342,6 +41454,7 @@ child.on('exit', () => process.exit(0));
|
|
|
41342
41454
|
var bootRefreshInFlight;
|
|
41343
41455
|
var QUOTA_EVENT_REFRESH_DEBOUNCE_MS;
|
|
41344
41456
|
var QUOTA_REFRESH_EVENTS;
|
|
41457
|
+
var revalidateInFlight;
|
|
41345
41458
|
var init_refresh = __esm2({
|
|
41346
41459
|
"src/quota/refresh.ts"() {
|
|
41347
41460
|
"use strict";
|
|
@@ -41356,6 +41469,30 @@ child.on('exit', () => process.exit(0));
|
|
|
41356
41469
|
init_persist();
|
|
41357
41470
|
QUOTA_REFRESH_INTERVAL_MS = 15 * 60 * 1e3;
|
|
41358
41471
|
QUOTA_ACTIVITY_WINDOW_MS = 20 * 60 * 1e3;
|
|
41472
|
+
QUOTA_AXIS = {
|
|
41473
|
+
"antigravity-cli": "network",
|
|
41474
|
+
"claude-cli": "file",
|
|
41475
|
+
"codex-cli": "file",
|
|
41476
|
+
"grok-cli": "network",
|
|
41477
|
+
"kimi": "network",
|
|
41478
|
+
"opencode": "file"
|
|
41479
|
+
};
|
|
41480
|
+
QUOTA_AXIS_TTL_MS = {
|
|
41481
|
+
"antigravity-cli": Number.POSITIVE_INFINITY,
|
|
41482
|
+
"claude-cli": 6e4,
|
|
41483
|
+
"codex-cli": 6e4,
|
|
41484
|
+
"grok-cli": Number.POSITIVE_INFINITY,
|
|
41485
|
+
"kimi": Number.POSITIVE_INFINITY,
|
|
41486
|
+
"opencode": 5 * 60 * 1e3
|
|
41487
|
+
};
|
|
41488
|
+
QUOTA_SWR_TTL_MS = {
|
|
41489
|
+
"antigravity-cli": 10 * 60 * 1e3,
|
|
41490
|
+
"claude-cli": QUOTA_AXIS_TTL_MS["claude-cli"],
|
|
41491
|
+
"codex-cli": QUOTA_AXIS_TTL_MS["codex-cli"],
|
|
41492
|
+
"grok-cli": 10 * 60 * 1e3,
|
|
41493
|
+
"kimi": 10 * 60 * 1e3,
|
|
41494
|
+
"opencode": QUOTA_AXIS_TTL_MS["opencode"]
|
|
41495
|
+
};
|
|
41359
41496
|
REFRESHERS = [
|
|
41360
41497
|
{ provider: "antigravity-cli", fetch: () => fetchAntigravityQuota2() },
|
|
41361
41498
|
{ provider: "claude-cli", fetch: () => fetchClaudeQuota2() },
|
|
@@ -41369,7 +41506,7 @@ child.on('exit', () => process.exit(0));
|
|
|
41369
41506
|
hydrated = false;
|
|
41370
41507
|
QUOTA_FAILURE_MAX_RETRIES = 4;
|
|
41371
41508
|
failureRetries = /* @__PURE__ */ new Map();
|
|
41372
|
-
QUOTA_ROUTABLE_MAX_AGE_MS =
|
|
41509
|
+
QUOTA_ROUTABLE_MAX_AGE_MS = 60 * 60 * 1e3;
|
|
41373
41510
|
WORKING_STATUSES = /* @__PURE__ */ new Set([
|
|
41374
41511
|
"generating",
|
|
41375
41512
|
"waiting_approval",
|
|
@@ -41383,6 +41520,7 @@ child.on('exit', () => process.exit(0));
|
|
|
41383
41520
|
bootRefreshInFlight = false;
|
|
41384
41521
|
QUOTA_EVENT_REFRESH_DEBOUNCE_MS = 6e4;
|
|
41385
41522
|
QUOTA_REFRESH_EVENTS = /* @__PURE__ */ new Set(["agent:generating_completed", "agent:stopped"]);
|
|
41523
|
+
revalidateInFlight = /* @__PURE__ */ new Set();
|
|
41386
41524
|
}
|
|
41387
41525
|
});
|
|
41388
41526
|
var import_session_host_core3;
|
|
@@ -84699,6 +84837,8 @@ ${e?.stderr || ""}`;
|
|
|
84699
84837
|
ProviderChannelStore: () => ProviderChannelStore,
|
|
84700
84838
|
ProviderInstanceManager: () => ProviderInstanceManager,
|
|
84701
84839
|
ProviderLoader: () => ProviderLoader,
|
|
84840
|
+
QUOTA_AXIS: () => QUOTA_AXIS,
|
|
84841
|
+
QUOTA_AXIS_TTL_MS: () => QUOTA_AXIS_TTL_MS,
|
|
84702
84842
|
RECENT_MAGI_CAP: () => RECENT_MAGI_CAP,
|
|
84703
84843
|
RECENT_TERMINAL_REFINE_CAP: () => RECENT_TERMINAL_REFINE_CAP,
|
|
84704
84844
|
RawTerminalAttachment: () => RawTerminalAttachment,
|
|
@@ -84858,6 +84998,7 @@ ${e?.stderr || ""}`;
|
|
|
84858
84998
|
findTasksOrphanedBySessionStop: () => findTasksOrphanedBySessionStop,
|
|
84859
84999
|
flattenMessageParts: () => flattenMessageParts,
|
|
84860
85000
|
foldUsageRecords: () => foldUsageRecords,
|
|
85001
|
+
forceRefreshQuota: () => forceRefreshQuota2,
|
|
84861
85002
|
formatManifestValidationIssues: () => formatManifestValidationIssues,
|
|
84862
85003
|
formatMeshTaskModeViolations: () => formatMeshTaskModeViolations,
|
|
84863
85004
|
forwardAgentStreamsToIdeInstance: () => forwardAgentStreamsToIdeInstance2,
|
|
@@ -85039,6 +85180,7 @@ ${e?.stderr || ""}`;
|
|
|
85039
85180
|
printClaudeUninstallResult: () => printClaudeUninstallResult2,
|
|
85040
85181
|
printQuota: () => printQuota2,
|
|
85041
85182
|
printQuotaInstallError: () => printQuotaInstallError2,
|
|
85183
|
+
printQuotaRefreshOutcome: () => printQuotaRefreshOutcome2,
|
|
85042
85184
|
probeCdpPort: () => probeCdpPort,
|
|
85043
85185
|
projectGraphPublicPolicy: () => projectGraphPublicPolicy,
|
|
85044
85186
|
pruneOperatingNotes: () => pruneOperatingNotes,
|
|
@@ -99464,8 +99606,40 @@ ${marker}`,
|
|
|
99464
99606
|
providerChannelStaleness: ctx.deps.providerLoader?.getChannelStalenessSnapshot?.() ?? null
|
|
99465
99607
|
};
|
|
99466
99608
|
},
|
|
99609
|
+
/**
|
|
99610
|
+
* ★FORCE REFRESH — the single entry point for "read my quota again, now".
|
|
99611
|
+
*
|
|
99612
|
+
* Every surface funnels here: `adhdev quota --refresh` (over local IPC), a
|
|
99613
|
+
* dashboard refresh button, an MCP caller. One entry point rather than
|
|
99614
|
+
* several is what keeps the 429 cooldown, the enable gate and the
|
|
99615
|
+
* carry-forward from being re-implemented (and quietly weakened) per
|
|
99616
|
+
* surface.
|
|
99617
|
+
*
|
|
99618
|
+
* ★It runs INSIDE the daemon, so it warms the cache that routing and every
|
|
99619
|
+
* dashboard read consume. This is the difference from `adhdev quota codex`,
|
|
99620
|
+
* which calls a fetcher in a separate CLI process: that prints a number and
|
|
99621
|
+
* leaves the daemon exactly as stale as it was.
|
|
99622
|
+
*
|
|
99623
|
+
* ★It does not bypass the 429 cooldown. A cooling-down provider comes back
|
|
99624
|
+
* with outcome 'cooldown' + retryAtMs, and the caller is expected to SAY so
|
|
99625
|
+
* — see forceRefreshQuota for why overriding on user request is the wrong
|
|
99626
|
+
* behaviour here.
|
|
99627
|
+
*/
|
|
99628
|
+
refresh_provider_quota: async (_ctx, args) => {
|
|
99629
|
+
const raw = args?.providers ?? args?.provider;
|
|
99630
|
+
const providers = Array.isArray(raw) ? raw.filter((p) => typeof p === "string") : typeof raw === "string" && raw.trim() ? [raw.trim()] : void 0;
|
|
99631
|
+
const { entries, quota } = await forceRefreshQuota2(providers);
|
|
99632
|
+
return {
|
|
99633
|
+
success: true,
|
|
99634
|
+
refreshed: entries,
|
|
99635
|
+
// Same "omit rather than send undefined" contract as the reads above.
|
|
99636
|
+
...quota ? { quota } : {},
|
|
99637
|
+
machineNickname: loadConfig2().machineNickname,
|
|
99638
|
+
timestamp: Date.now()
|
|
99639
|
+
};
|
|
99640
|
+
},
|
|
99467
99641
|
get_machine_runtime_stats: async (_ctx, _args) => {
|
|
99468
|
-
const quota =
|
|
99642
|
+
const quota = readQuotaCacheWithRevalidate();
|
|
99469
99643
|
return {
|
|
99470
99644
|
success: true,
|
|
99471
99645
|
machine: {
|
|
@@ -99498,7 +99672,7 @@ ${marker}`,
|
|
|
99498
99672
|
const launchInfo = adapter && typeof adapter.getLaunchInfo === "function" ? adapter.getLaunchInfo() : void 0;
|
|
99499
99673
|
const providerType = target?.providerType || coord?.cliType || "";
|
|
99500
99674
|
const providerMetaForSession = providerType ? ctx.deps.providerLoader.resolve?.(providerType) || ctx.deps.providerLoader.getMeta(providerType) : void 0;
|
|
99501
|
-
const quota =
|
|
99675
|
+
const quota = readQuotaCacheWithRevalidate();
|
|
99502
99676
|
return {
|
|
99503
99677
|
success: true,
|
|
99504
99678
|
session: {
|
|
@@ -133753,6 +133927,32 @@ ${upgradeFailureNotice.notice}${supersededHint}`);
|
|
|
133753
133927
|
}
|
|
133754
133928
|
console.log();
|
|
133755
133929
|
}
|
|
133930
|
+
function printQuotaRefreshOutcome2(entries) {
|
|
133931
|
+
console.log();
|
|
133932
|
+
if (entries.length === 0) {
|
|
133933
|
+
console.log(import_chalk2.default.gray(" Nothing to refresh."));
|
|
133934
|
+
console.log();
|
|
133935
|
+
return;
|
|
133936
|
+
}
|
|
133937
|
+
const refreshed = entries.filter((e) => e.outcome === "refreshed");
|
|
133938
|
+
if (refreshed.length > 0) {
|
|
133939
|
+
console.log(import_chalk2.default.green(`\u2713 Refreshed ${refreshed.map((e) => e.provider).join(", ")}`));
|
|
133940
|
+
}
|
|
133941
|
+
for (const entry of entries) {
|
|
133942
|
+
if (entry.outcome === "refreshed") continue;
|
|
133943
|
+
if (entry.outcome === "cooldown") {
|
|
133944
|
+
console.log(import_chalk2.default.yellow(`\u2022 ${entry.provider}: rate-limited \u2014 not re-probed`));
|
|
133945
|
+
if (typeof entry.retryAtMs === "number" && Number.isFinite(entry.retryAtMs)) {
|
|
133946
|
+
console.log(import_chalk2.default.gray(` Retrying no earlier than ${formatRelative(entry.retryAtMs)}.`));
|
|
133947
|
+
}
|
|
133948
|
+
console.log(import_chalk2.default.gray(" The numbers shown are the last good reading."));
|
|
133949
|
+
console.log(import_chalk2.default.gray(" Re-probing now would extend the provider's own throttle."));
|
|
133950
|
+
continue;
|
|
133951
|
+
}
|
|
133952
|
+
console.log(import_chalk2.default.gray(`\u2022 ${entry.provider}: ${entry.reason || entry.outcome}`));
|
|
133953
|
+
}
|
|
133954
|
+
console.log();
|
|
133955
|
+
}
|
|
133756
133956
|
function printClaudeInstallResult2(result) {
|
|
133757
133957
|
console.log();
|
|
133758
133958
|
console.log(
|
|
@@ -134175,6 +134375,7 @@ async function proxySessionHostAttach(target, options = {}) {
|
|
|
134175
134375
|
var import_daemon_core2 = __toESM(require_dist3());
|
|
134176
134376
|
var QUOTA_HELP_TEXT = `
|
|
134177
134377
|
Usage: adhdev quota <provider>
|
|
134378
|
+
adhdev quota refresh [providers...]
|
|
134178
134379
|
adhdev quota claude:install | claude:uninstall | claude:status
|
|
134179
134380
|
|
|
134180
134381
|
Providers:
|
|
@@ -134184,6 +134385,12 @@ Providers:
|
|
|
134184
134385
|
grok Show Grok CLI plan usage (queries the xAI billing API live)
|
|
134185
134386
|
kimi Show Kimi Code plan usage (queries the Kimi API live)
|
|
134186
134387
|
|
|
134388
|
+
Refresh:
|
|
134389
|
+
refresh Re-read quota now. Providers that recently returned HTTP 429 are
|
|
134390
|
+
NOT re-probed \u2014 the cooldown is reported with the time it lifts,
|
|
134391
|
+
because re-hitting the endpoint extends the provider's own throttle.
|
|
134392
|
+
Local-file providers (claude, codex) have no cooldown.
|
|
134393
|
+
|
|
134187
134394
|
Claude Code setup (antigravity/codex/grok/kimi need no setup \u2014 they query live):
|
|
134188
134395
|
claude:install Set up Claude Code quota reporting by wrapping your statusline
|
|
134189
134396
|
claude:uninstall Remove Claude Code quota reporting and restore your original statusline
|
|
@@ -134208,6 +134415,11 @@ async function runQuotaCommand(args) {
|
|
|
134208
134415
|
case "kimi":
|
|
134209
134416
|
(0, import_daemon_core2.printQuota)("Kimi Code", await (0, import_daemon_core2.fetchKimiQuota)());
|
|
134210
134417
|
return 0;
|
|
134418
|
+
case "refresh": {
|
|
134419
|
+
const { entries } = await (0, import_daemon_core2.forceRefreshQuota)(args.slice(1));
|
|
134420
|
+
(0, import_daemon_core2.printQuotaRefreshOutcome)(entries);
|
|
134421
|
+
return entries.some((e) => e.outcome === "unsupported") ? 1 : 0;
|
|
134422
|
+
}
|
|
134211
134423
|
case "claude:install":
|
|
134212
134424
|
case "claude-install": {
|
|
134213
134425
|
try {
|