maxpool 1.0.2 → 1.0.3
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/server.js +12 -3
package/package.json
CHANGED
package/src/server.js
CHANGED
|
@@ -846,7 +846,7 @@ function unavailableMessage(accountManager, requestInfo = {}, retryAfter, willRe
|
|
|
846
846
|
return `All ${n} accounts exhausted. Retry in ${retryAfter}s.`;
|
|
847
847
|
}
|
|
848
848
|
|
|
849
|
-
export const __serverTest = { unavailableMessage, isRetriableUpstreamStatus };
|
|
849
|
+
export const __serverTest = { unavailableMessage, isRetriableUpstreamStatus, headerValue, getMaxpoolProfile };
|
|
850
850
|
|
|
851
851
|
async function readErrorBody(upstreamRes, limitBytes = 64 * 1024) {
|
|
852
852
|
if (!upstreamRes.body) return '';
|
|
@@ -1227,7 +1227,8 @@ function containsThinkingBlock(value) {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
|
|
1229
1229
|
function getMaxpoolProfile(headers) {
|
|
1230
|
-
|
|
1230
|
+
// headerValue() handles the x-teamclaude-* legacy fallback.
|
|
1231
|
+
const profile = String(headerValue(headers, 'x-maxpool-profile') || 'claude').trim().toLowerCase();
|
|
1231
1232
|
return profile || 'claude';
|
|
1232
1233
|
}
|
|
1233
1234
|
|
|
@@ -1272,7 +1273,15 @@ function prepareRuntimeProviders(accountManager, headers) {
|
|
|
1272
1273
|
}
|
|
1273
1274
|
|
|
1274
1275
|
function headerValue(headers, name) {
|
|
1275
|
-
const
|
|
1276
|
+
const lname = name.toLowerCase();
|
|
1277
|
+
let value = headers[lname];
|
|
1278
|
+
// Backward compatibility: sessions launched before the teamclaude→maxpool
|
|
1279
|
+
// rename send x-teamclaude-* headers (a process's ANTHROPIC_CUSTOM_HEADERS is
|
|
1280
|
+
// fixed at launch). Fall back to the legacy name so already-running sessions
|
|
1281
|
+
// keep full routing/fallback without needing a restart.
|
|
1282
|
+
if ((value == null || value === '') && lname.startsWith('x-maxpool-')) {
|
|
1283
|
+
value = headers['x-teamclaude-' + lname.slice('x-maxpool-'.length)];
|
|
1284
|
+
}
|
|
1276
1285
|
if (Array.isArray(value)) return value[0];
|
|
1277
1286
|
return value ? String(value).trim() : '';
|
|
1278
1287
|
}
|