maxpool 1.24.12 → 1.24.14
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/package.json +1 -1
- package/src/claude-reset-grants.js +14 -5
- package/src/server.js +6 -3
package/package.json
CHANGED
|
@@ -119,17 +119,26 @@ export async function listResetGrants(accessToken, { signal } = {}) {
|
|
|
119
119
|
* random per CALL (server treats already_used as success), so a caller retry is
|
|
120
120
|
* safe but the id is not reused across distinct decisions. Returns
|
|
121
121
|
* { ok:true } | { ok:false, error, code }. */
|
|
122
|
-
export async function claimResetGrant(accessToken, grantId, { signal, requestId } = {}) {
|
|
122
|
+
export async function claimResetGrant(accessToken, grantId, { signal, requestId, fetchImpl } = {}) {
|
|
123
123
|
if (!accessToken || !grantId) return { ok: false, error: 'missing args' };
|
|
124
|
+
const doFetch = fetchImpl || ((u, o) => fetch(u, o));
|
|
124
125
|
try {
|
|
125
|
-
const prof = await
|
|
126
|
+
const prof = await doFetch(PROFILE_URL, { headers: headers(accessToken), signal });
|
|
126
127
|
if (!prof.ok) return { ok: false, error: `profile HTTP ${prof.status}` };
|
|
127
|
-
const
|
|
128
|
-
|
|
128
|
+
const body = await prof.json();
|
|
129
|
+
// The profile returns `organization` (SINGULAR object) — measured live on
|
|
130
|
+
// maxim.krasnykh@gmail.com 2026-10-09: {account, organization, application}.
|
|
131
|
+
// v1.24.0-12 read only the plural `organizations` array (null for personal
|
|
132
|
+
// accounts), so EVERY cedar_ember claim on a personal account failed with
|
|
133
|
+
// 'no oauth organization' while the account sat exhausted with a usable reset
|
|
134
|
+
// (owner report: 'this account is exhausted but the reset is not being used').
|
|
135
|
+
// Accept both shapes; singular wins when present.
|
|
136
|
+
const org = body?.organization?.uuid
|
|
137
|
+
?? (Array.isArray(body?.organizations) && body.organizations.length ? body.organizations[0].uuid : null);
|
|
129
138
|
if (!org) return { ok: false, error: 'no oauth organization' };
|
|
130
139
|
|
|
131
140
|
const rid = requestId || randomUUID();
|
|
132
|
-
const res = await
|
|
141
|
+
const res = await doFetch(`https://api.anthropic.com${CLAIM_PATH}/${org}/reset_rate_limits`, {
|
|
133
142
|
method: 'POST',
|
|
134
143
|
headers: { ...headers(accessToken), 'Content-Type': 'application/json' },
|
|
135
144
|
body: JSON.stringify({ program: 'cedar_ember', grant_id: grantId, request_id: rid }),
|
package/src/server.js
CHANGED
|
@@ -1745,9 +1745,12 @@ function computeQueueWindowMs({
|
|
|
1745
1745
|
// (which survives outages natively) takes over after our fast error.
|
|
1746
1746
|
// streamClientToleranceMs may be 3h from x-maxpool-client-stream-idle-ms, so it
|
|
1747
1747
|
// cannot bound a NETWORK hold — only a capacity/quota hold with real content.
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1748
|
+
// EVERY streaming hold is bounded by the CLI's absolute 30-min stream ceiling —
|
|
1749
|
+
// measured again 2026-10-09: five CAPACITY-cause holds (network-storm cooldowns)
|
|
1750
|
+
// from the 05:30 network switch died client-side at 1820-1848s with only pings
|
|
1751
|
+
// sent; the network-cause cap alone (2026-10-07) left this class behind. No
|
|
1752
|
+
// client survives past the ceiling, so a longer hold is always an orphan.
|
|
1753
|
+
windowMs = Math.min(windowMs, CLI_STREAM_CEILING_MS);
|
|
1751
1754
|
return windowMs;
|
|
1752
1755
|
}
|
|
1753
1756
|
|