scalemax 0.1.35 → 0.1.36

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.
@@ -16,6 +16,23 @@ const preferredOpenAi = [
16
16
  'gpt-5.4-mini',
17
17
  'gpt-5.3-codex',
18
18
  'codex-auto-review',
19
+ // Gemini / Grok / Qwen ride the same OpenAI-compatible route, so they are
20
+ // ranked in the same list. Ordering across families is harmless: a key is
21
+ // scoped to ONE family, so filterModelsForScope has already reduced the
22
+ // candidates to that family before this runs. Listing them means each family
23
+ // picks its own flagship rather than whatever the catalog happened to return
24
+ // first — preferredFrom's fallback made it work, but arbitrarily.
25
+ 'gemini-3-pro-preview',
26
+ 'gemini-3.1-pro-preview',
27
+ 'gemini-3.6-flash',
28
+ 'gemini-3.5-flash',
29
+ 'gemini-3-flash-preview',
30
+ 'gemini-3.1-flash-lite-preview',
31
+ 'gemini-2.5-flash',
32
+ 'gemini-2.5-flash-lite',
33
+ 'grok-4.5',
34
+ 'qwen3.7-plus',
35
+ 'qwen3.6-plus',
19
36
  'glm-5.2',
20
37
  'deepseek-v4-flash'
21
38
  ];
@@ -1,5 +1,5 @@
1
1
  export type ClientId = 'codex' | 'cursor' | 'roo-code' | 'cline' | 'continue' | 'trae-solo' | 'claude' | 'opencode' | 'openclaw' | 'hermes' | 'cherry-studio' | 'api-code';
2
- export type ProviderScope = 'openai' | 'anthropic' | 'both' | 'deepseek-v4-flash' | 'glm-5.2';
2
+ export type ProviderScope = 'openai' | 'anthropic' | 'both' | 'gemini' | 'grok' | 'qwen' | 'deepseek-v4-flash' | 'glm-5.2';
3
3
  export interface ClientDefinition {
4
4
  id: ClientId;
5
5
  name: string;
@@ -1,6 +1,6 @@
1
1
  export declare const DEEPSEEK_V4_FLASH_SCOPE: "deepseek-v4-flash";
2
2
  export declare const GLM_5_2_SCOPE: "glm-5.2";
3
- export type ProviderScope = 'openai' | 'anthropic' | 'both' | typeof DEEPSEEK_V4_FLASH_SCOPE | typeof GLM_5_2_SCOPE;
3
+ export type ProviderScope = 'openai' | 'anthropic' | 'both' | 'gemini' | 'grok' | 'qwen' | typeof DEEPSEEK_V4_FLASH_SCOPE | typeof GLM_5_2_SCOPE;
4
4
  export interface ModelInfo {
5
5
  id: string;
6
6
  object?: string;
package/dist/utils/api.js CHANGED
@@ -3,6 +3,18 @@ import { redactApiKey, sanitizeApiKey } from './apiKey.js';
3
3
  import { scaleMaxFetch } from './network.js';
4
4
  export const DEEPSEEK_V4_FLASH_SCOPE = 'deepseek-v4-flash';
5
5
  export const GLM_5_2_SCOPE = 'glm-5.2';
6
+ /**
7
+ * Provider FAMILIES sold as their own scope. Each reaches only its own models;
8
+ * `both` deliberately does not inherit them, matching the gateway.
9
+ */
10
+ const FAMILY_SCOPES = ['gemini', 'grok', 'qwen'];
11
+ function isFamilyScope(scope) {
12
+ return FAMILY_SCOPES.includes(scope);
13
+ }
14
+ /** The family a model belongs to, from the catalog's own owned_by/provider. */
15
+ function modelFamily(model) {
16
+ return String(model.provider || model.owned_by || '').trim().toLowerCase();
17
+ }
6
18
  // Keep only aliases that are no longer offered. Direct GPT-5.6 Sol is an
7
19
  // active Codex model and must remain available to all generated clients.
8
20
  export const RETIRED_MODEL_IDS = new Set(['fable-5-ultra']);
@@ -41,6 +53,18 @@ export function filterModelsForScope(models, scope) {
41
53
  return scope === exactScope;
42
54
  if (scope === DEEPSEEK_V4_FLASH_SCOPE || scope === GLM_5_2_SCOPE)
43
55
  return false;
56
+ // A family scope reaches ONLY its own family. This must be an allowlist:
57
+ // the old final line fell through to `!isAnthropicModel(model)` for any
58
+ // unrecognised scope, so a gemini key was offered every non-Anthropic model
59
+ // — GPT, Codex, Grok, Qwen — and `scalemax setup` wrote a client profile
60
+ // whose every model 403s at the gateway.
61
+ if (isFamilyScope(scope))
62
+ return modelFamily(model) === scope;
63
+ // Conversely, a family model must not leak into the broad scopes: an
64
+ // openai/both key cannot call them (the gateway prices those families
65
+ // separately), so offering them here would be the same lie in reverse.
66
+ if (FAMILY_SCOPES.includes(modelFamily(model)))
67
+ return false;
44
68
  return scope === 'both' || (scope === 'anthropic' ? isAnthropicModel(model) : !isAnthropicModel(model));
45
69
  });
46
70
  }
package/dist/utils/fs.js CHANGED
@@ -7,7 +7,15 @@ export async function exists(p) { return fs.pathExists(p); }
7
7
  export async function syncParentDirectory(directory, platform = process.platform) {
8
8
  // Windows does not support fsync on directory handles and commonly returns EPERM.
9
9
  // The file itself is still fsynced before the atomic rename on every platform.
10
- if (platform === 'win32')
10
+ //
11
+ // BOTH the injected platform and the REAL host are checked. The parameter
12
+ // exists so a test can simulate another OS's config layout, but fsync on a
13
+ // directory handle is a property of the machine actually running, not of the
14
+ // OS being simulated — so simulating linux on a Windows host made 49 tests
15
+ // fail with EPERM on a syscall that host can never support. Guarding on the
16
+ // host too costs Linux nothing: there process.platform is not 'win32', so the
17
+ // durability fsync still runs exactly as before.
18
+ if (platform === 'win32' || process.platform === 'win32')
11
19
  return;
12
20
  const dir = await fsp.open(directory, 'r');
13
21
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scalemax",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
4
4
  "description": "Universal ScaleMax installer for AI coding clients",
5
5
  "type": "module",
6
6
  "bin": {