switchroom 0.14.0 → 0.14.2
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/auth-broker/index.js +16 -1
- package/dist/cli/switchroom.js +1082 -873
- package/dist/host-control/main.js +1 -1
- package/package.json +1 -1
- package/profiles/_shared/telegram-style.md.hbs +1 -1
- package/telegram-plugin/auth-snapshot-format.ts +47 -1
- package/telegram-plugin/dist/gateway/gateway.js +983 -537
- package/telegram-plugin/gateway/boot-card.ts +100 -0
- package/telegram-plugin/gateway/config-snapshot.ts +274 -0
- package/telegram-plugin/gateway/gateway.ts +235 -20
- package/telegram-plugin/operator-events.ts +2 -10
- package/telegram-plugin/quota-watch.ts +276 -0
- package/telegram-plugin/tests/auth-snapshot-format.test.ts +133 -1
- package/telegram-plugin/tests/boot-card-render.test.ts +93 -0
- package/telegram-plugin/tests/config-snapshot.test.ts +409 -0
- package/telegram-plugin/tests/operator-events.test.ts +12 -6
- package/telegram-plugin/tests/quota-watch.test.ts +366 -0
- package/telegram-plugin/tests/tool-activity-summary.test.ts +45 -0
- package/telegram-plugin/tests/turn-flush-safety.test.ts +48 -0
- package/telegram-plugin/tool-activity-summary.ts +47 -0
- package/telegram-plugin/turn-flush-safety.ts +47 -0
- package/telegram-plugin/uat/assertions.ts +4 -4
|
@@ -13356,6 +13356,7 @@ class AuthBroker {
|
|
|
13356
13356
|
fetcher;
|
|
13357
13357
|
providers;
|
|
13358
13358
|
quota = {};
|
|
13359
|
+
lastQuotaCache = {};
|
|
13359
13360
|
shaIndex = {};
|
|
13360
13361
|
thresholdViolations = {};
|
|
13361
13362
|
lastWrittenExpiresAt = new Map;
|
|
@@ -13768,13 +13769,15 @@ class AuthBroker {
|
|
|
13768
13769
|
const meta = readAccountMeta(label, this.home);
|
|
13769
13770
|
const q = this.quota[label];
|
|
13770
13771
|
const exhausted = q !== undefined && q.exhausted_until > this.now();
|
|
13772
|
+
const lq = this.lastQuotaCache[label];
|
|
13771
13773
|
return {
|
|
13772
13774
|
label,
|
|
13773
13775
|
expiresAt: creds?.claudeAiOauth?.expiresAt,
|
|
13774
13776
|
exhausted,
|
|
13775
13777
|
exhausted_until: q?.exhausted_until,
|
|
13776
13778
|
threshold_violations: this.thresholdViolations[label] ?? 0,
|
|
13777
|
-
last_refreshed_at: meta?.lastRefreshedAt
|
|
13779
|
+
last_refreshed_at: meta?.lastRefreshedAt,
|
|
13780
|
+
last_quota: lq ?? null
|
|
13778
13781
|
};
|
|
13779
13782
|
});
|
|
13780
13783
|
const agents = Object.entries(this.config.agents ?? {}).map(([name, agent]) => {
|
|
@@ -13831,6 +13834,18 @@ class AuthBroker {
|
|
|
13831
13834
|
ok: result.ok,
|
|
13832
13835
|
error: result.ok ? undefined : result.reason
|
|
13833
13836
|
});
|
|
13837
|
+
if (result.ok) {
|
|
13838
|
+
this.lastQuotaCache[label] = {
|
|
13839
|
+
fiveHourUtilizationPct: result.data.fiveHourUtilizationPct,
|
|
13840
|
+
sevenDayUtilizationPct: result.data.sevenDayUtilizationPct,
|
|
13841
|
+
fiveHourResetAt: result.data.fiveHourResetAt?.toISOString() ?? null,
|
|
13842
|
+
sevenDayResetAt: result.data.sevenDayResetAt?.toISOString() ?? null,
|
|
13843
|
+
representativeClaim: result.data.representativeClaim,
|
|
13844
|
+
overageStatus: result.data.overageStatus,
|
|
13845
|
+
overageDisabledReason: result.data.overageDisabledReason,
|
|
13846
|
+
capturedAt: this.now()
|
|
13847
|
+
};
|
|
13848
|
+
}
|
|
13834
13849
|
return { label, result };
|
|
13835
13850
|
}));
|
|
13836
13851
|
socket.write(encodeSuccess(id, { results }));
|