maxpool 1.5.65 → 1.5.67
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/account-manager.js +20 -2
- package/src/secret-resolver.js +1 -1
- package/src/tui.js +16 -1
package/package.json
CHANGED
package/src/account-manager.js
CHANGED
|
@@ -2965,8 +2965,26 @@ export class AccountManager {
|
|
|
2965
2965
|
if (idx >= 0 && this.accounts[idx].inFlight === 0) this.removeAccount(idx);
|
|
2966
2966
|
}
|
|
2967
2967
|
}
|
|
2968
|
+
// Remove state-restored (header-based) providers whose token is now served by a
|
|
2969
|
+
// config provider — otherwise the same key shows up twice (once as the old
|
|
2970
|
+
// "glm-fallback"/"kimi-fallback" from state.json, once as the config provider).
|
|
2971
|
+
const configTokens = new Set(
|
|
2972
|
+
entries.map(e => e.token).filter(Boolean),
|
|
2973
|
+
);
|
|
2974
|
+
for (const a of [...this.accounts]) {
|
|
2975
|
+
if (!a.configSourced && a.type === 'provider' && a.credential && configTokens.has(a.credential)) {
|
|
2976
|
+
const idx = this.accounts.indexOf(a);
|
|
2977
|
+
if (idx >= 0 && this.accounts[idx].inFlight === 0) this.removeAccount(idx);
|
|
2978
|
+
}
|
|
2979
|
+
}
|
|
2968
2980
|
for (const entry of entries) {
|
|
2969
2981
|
if (!entry || !entry.name || !entry.provider) continue;
|
|
2982
|
+
// Default model maps — match what `cc all` sends via headers. Users can override
|
|
2983
|
+
// per-provider in config. Without these z.ai returns [1210 Invalid API parameter].
|
|
2984
|
+
const defaultModelMap = entry.provider === 'zai'
|
|
2985
|
+
? { opus: 'glm-5.2', sonnet: 'glm-5.2', haiku: 'glm-5.1', default: 'glm-5.2' }
|
|
2986
|
+
: null;
|
|
2987
|
+
const defaultModel = entry.provider === 'kimi' ? 'kimi-k3' : null;
|
|
2970
2988
|
this.upsertRuntimeAccount({
|
|
2971
2989
|
name: entry.name,
|
|
2972
2990
|
type: 'provider',
|
|
@@ -2978,8 +2996,8 @@ export class AccountManager {
|
|
|
2978
2996
|
authHeader: 'authorization',
|
|
2979
2997
|
profiles: ['all'],
|
|
2980
2998
|
priority: Number.isFinite(entry.priority) ? entry.priority : 10,
|
|
2981
|
-
modelMap: entry.modelMap,
|
|
2982
|
-
model: entry.model,
|
|
2999
|
+
modelMap: entry.modelMap || defaultModelMap,
|
|
3000
|
+
model: entry.model || defaultModel,
|
|
2983
3001
|
stripBetaHeaders: true,
|
|
2984
3002
|
configSourced: true,
|
|
2985
3003
|
});
|
package/src/secret-resolver.js
CHANGED
|
@@ -15,7 +15,7 @@ const execFileAsync = promisify(execFile);
|
|
|
15
15
|
|
|
16
16
|
const DEFAULT_PROJECT = 'mokka-business-automations';
|
|
17
17
|
|
|
18
|
-
export async function resolveSecret(secretName, { project = DEFAULT_PROJECT, timeoutMs =
|
|
18
|
+
export async function resolveSecret(secretName, { project = DEFAULT_PROJECT, timeoutMs = 45_000 } = {}) {
|
|
19
19
|
if (!secretName || typeof secretName !== 'string') return null;
|
|
20
20
|
try {
|
|
21
21
|
const { stdout } = await execFileAsync(
|
package/src/tui.js
CHANGED
|
@@ -585,6 +585,18 @@ export class TUI {
|
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
587
|
|
|
588
|
+
// Derive a human-readable account name from a GCP secret name.
|
|
589
|
+
// RESTRICTED_AL_MAXPOOL_ZAI → glm al | ZAI_API_KEY → glm primary
|
|
590
|
+
// RESTRICTED_MAX_KIMI_API_KEY → kimi max | KIMI_API_KEY → kimi primary
|
|
591
|
+
static deriveProviderName(provider, secretName) {
|
|
592
|
+
const provLabel = provider === 'kimi' ? 'kimi' : 'glm';
|
|
593
|
+
const s = String(secretName || '').toUpperCase();
|
|
594
|
+
// Try to extract a user from RESTRICTED_<USER>_...
|
|
595
|
+
const m = /^RESTRICTED_([A-Z]+)_/.exec(s);
|
|
596
|
+
const user = m ? m[1].toLowerCase() : null;
|
|
597
|
+
return user ? `${provLabel} ${user}` : `${provLabel} primary`;
|
|
598
|
+
}
|
|
599
|
+
|
|
588
600
|
_keyProviders(k) {
|
|
589
601
|
if (k === 'a') {
|
|
590
602
|
this._providerAddStep('name');
|
|
@@ -620,9 +632,12 @@ export class TUI {
|
|
|
620
632
|
this.inputCb = value => {
|
|
621
633
|
const provider = String(value || '').trim().toLowerCase();
|
|
622
634
|
if (provider !== 'zai' && provider !== 'kimi') { this._addLog('Type must be zai or kimi'); this.mode = 'providers'; return; }
|
|
623
|
-
|
|
635
|
+
// Suggest a name derived from the provider type
|
|
636
|
+
const suggested = provider === 'kimi' ? 'kimi' : 'glm';
|
|
637
|
+
this._providerAddStep('secret', { ...prev, provider, suggestedName: suggested });
|
|
624
638
|
};
|
|
625
639
|
} else if (step === 'secret') {
|
|
640
|
+
const suggested = TUI.deriveProviderName(prev.provider, '');
|
|
626
641
|
this.mode = 'input';
|
|
627
642
|
this.inputPrompt = `${prev.name}: GCP secret name OR paste API key directly`;
|
|
628
643
|
this.inputBuf = '';
|