scalemax 0.1.53 → 0.1.55

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.
@@ -97,6 +97,19 @@ function isScaleMaxManagedGateway(value) {
97
97
  return false;
98
98
  }
99
99
  }
100
+ /**
101
+ * Settings a ScaleMax-gateway Claude Desktop (3P) profile needs for Cowork's
102
+ * tools to work. Without `coworkEgressAllowedHosts` Cowork and Chat refuse
103
+ * EVERY Web Fetch (and the sandbox shell reaches no host); tool search keeps
104
+ * many connectors from filling the context. An allowlist the user already set
105
+ * is left alone.
106
+ */
107
+ export function scaleMaxManagedConfigPatch(current) {
108
+ const next = { ...current, isLocalDevMcpEnabled: true, toolSearchEnabled: true };
109
+ if (current.coworkEgressAllowedHosts === undefined)
110
+ next.coworkEgressAllowedHosts = ['*'];
111
+ return next;
112
+ }
100
113
  async function managedThirdPartyConfigs(roots) {
101
114
  const files = [];
102
115
  for (const root of roots) {
@@ -164,7 +177,7 @@ export async function installClaudeDesktopGithubTools(home, platform = process.p
164
177
  const current = await parseJsonObject(file);
165
178
  if (!isScaleMaxManagedGateway(current))
166
179
  continue;
167
- managedConfigs.push({ file, current, next: { ...current, isLocalDevMcpEnabled: true, toolSearchEnabled: true } });
180
+ managedConfigs.push({ file, current, next: scaleMaxManagedConfigPatch(current) });
168
181
  }
169
182
  const oldScript = await fs.readFile(scriptPath, 'utf8').catch(() => undefined);
170
183
  const written = [];
@@ -6,9 +6,10 @@ import { clientConfigPath } from './paths.js';
6
6
  import { writeMergedJsonConfig } from './common.js';
7
7
  import { GENERATED_HEADER } from '../constants.js';
8
8
  import { redactApiKey } from '../utils/apiKey.js';
9
- import { anthropicOrigin, claudeCodeBackgroundModel, claudeCodeCustomModelId, claudeCodeMainModel, claudeCodeModelIds, modelAcceptsImages, modelIdKey, AUTO_MODEL_ID, canonicalModelId, sameModelId } from './models.js';
9
+ import { anthropicOrigin, claudeCodeBackgroundModel, claudeCodeCustomModelId, claudeCodeMainModel, claudeCodeModelIds, modelAcceptsImages, modelIdKey, canonicalModelId, sameModelId } from './models.js';
10
10
  import { contextSuffix } from '../utils/modelId.js';
11
11
  import { removeClientSecret, verifyClientSecret, writeClientSecret } from './client-secret.js';
12
+ import { FOREIGN_STATUSLINE_TIP, installStatusLineScript, planStatusLine, statusLineScriptPath, stripScaleMaxStatusLine } from './statusline.js';
12
13
  const id = 'claude';
13
14
  const name = 'Claude Code';
14
15
  const discoveryKey = 'CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY';
@@ -21,8 +22,8 @@ const helperTtlKey = 'CLAUDE_CODE_API_KEY_HELPER_TTL_MS';
21
22
  // Reconfiguring removes the value earlier versions wrote.
22
23
  const legacyDisableThinkingKey = 'CLAUDE_CODE_DISABLE_THINKING';
23
24
  // Claude Code's gateway discovery intentionally ignores model IDs that do not
24
- // start with `claude` or `anthropic`. Fable and Auto both need managed custom
25
- // picker entries so their public ScaleMax IDs remain selectable.
25
+ // start with `claude` or `anthropic`. Fable needs a managed custom picker
26
+ // entry so its public ScaleMax ID remains selectable.
26
27
  const customModelOptionKey = 'ANTHROPIC_CUSTOM_MODEL_OPTION';
27
28
  const customModelOptionNameKey = 'ANTHROPIC_CUSTOM_MODEL_OPTION_NAME';
28
29
  const customModelOptionDescriptionKey = 'ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTION';
@@ -33,7 +34,7 @@ const customModelOptionDescriptionKey = 'ANTHROPIC_CUSTOM_MODEL_OPTION_DESCRIPTI
33
34
  const fableModelId = 'fable-5';
34
35
  const fableModelName = 'Fable 5';
35
36
  const fableModelDescription = 'Fable 5 via ScaleMax';
36
- // Claude's picker exposes ONE custom model slot (shared with Auto). fable-5 keeps
37
+ // Claude's picker exposes ONE custom model slot. fable-5 keeps
37
38
  // it whenever the key has fable-5, so re-running `update` never silently moves an
38
39
  // existing user onto a different model and price; fable-5.1 takes the slot only
39
40
  // when it is the Fable model this key can reach. Either id stays callable
@@ -43,8 +44,11 @@ const fable51ModelName = 'Fable 5.1';
43
44
  const fable51ModelDescription = 'Fable 5.1 via ScaleMax';
44
45
  // Fable 5.1 cannot read images; say so when it is the picker option.
45
46
  const fable51TextOnlyDescription = 'Fable 5.1 via ScaleMax (text only, no images)';
46
- const autoModelName = 'Auto';
47
- const autoModelDescription = 'Auto via ScaleMax';
47
+ // Written by CLI versions that still configured the retired Auto API. Kept in
48
+ // the managed set only so `update` / `remove` clean them out of old configs.
49
+ const legacyAutoModelId = 'auto';
50
+ const legacyAutoModelName = 'Auto';
51
+ const legacyAutoModelDescription = 'Auto via ScaleMax';
48
52
  const verificationTimeoutMs = 60_000;
49
53
  const managedEnvKeys = [
50
54
  'ANTHROPIC_AUTH_TOKEN',
@@ -66,9 +70,9 @@ const managedCustomModelValues = new Set([
66
70
  fable51ModelName,
67
71
  fable51ModelDescription,
68
72
  fable51TextOnlyDescription,
69
- AUTO_MODEL_ID,
70
- autoModelName,
71
- autoModelDescription
73
+ legacyAutoModelId,
74
+ legacyAutoModelName,
75
+ legacyAutoModelDescription
72
76
  ]);
73
77
  function secretPath(home) { return path.join(home, '.claude', 'scalemax.key'); }
74
78
  function helperCommand(home, platform) {
@@ -83,7 +87,7 @@ function asRecord(value) {
83
87
  /**
84
88
  * The one custom picker entry (see claudeCodeCustomModelId): Fable 5 when the
85
89
  * key has it, otherwise an image-capable hidden model, otherwise Fable 5.1
86
- * (labelled text only) or Auto. Written in the catalog's spelling, so
90
+ * (labelled text only). Written in the catalog's spelling, so
87
91
  * `fable-5[1m]` keeps Claude Code's 1M window.
88
92
  */
89
93
  function managedCustomModel(ctx) {
@@ -101,8 +105,6 @@ function managedCustomModel(ctx) {
101
105
  description: modelAcceptsImages(ctx, pick) ? fable51ModelDescription : fable51TextOnlyDescription,
102
106
  };
103
107
  }
104
- if (key === AUTO_MODEL_ID)
105
- return { option: AUTO_MODEL_ID, name: autoModelName, description: autoModelDescription };
106
108
  const label = ctx.models?.find(model => model.id.trim() === pick)?.display_name || canonicalModelId(pick);
107
109
  return { option: pick, name: label, description: `${label} via ScaleMax` };
108
110
  }
@@ -123,11 +125,21 @@ export async function configure(ctx) {
123
125
  const baseUrl = anthropicOrigin(ctx.baseUrl);
124
126
  const apiKeyHelper = helperCommand(ctx.home, ctx.platform);
125
127
  const credentialFile = secretPath(ctx.home);
126
- const snapshots = await captureFileSnapshots([file, credentialFile]);
128
+ const statusLineScript = statusLineScriptPath(ctx.home);
129
+ // The status-line script is part of this attempt: a verification failure
130
+ // rolls it back with settings.json and the credential.
131
+ const snapshots = await captureFileSnapshots([file, credentialFile, statusLineScript]);
127
132
  const secret = await writeClientSecret(credentialFile, ctx);
128
133
  let result;
134
+ // Asserted, not annotated: TS would otherwise keep the initial narrowing past
135
+ // the callback that reassigns it.
136
+ let statusLine = { action: 'keep-foreign' };
137
+ let scriptChanged = false;
129
138
  try {
130
139
  result = await writeMergedJsonConfig(ctx, id, name, file, existing => {
140
+ // Add (or refresh) the ScaleMax balance status line only when there is
141
+ // none or it is already ours; a user's own statusLine is never replaced.
142
+ statusLine = planStatusLine(existing.statusLine, ctx.home, ctx.platform);
131
143
  const env = asRecord(existing.env);
132
144
  const oldMetadata = asRecord(existing.scalemax);
133
145
  const previousEnv = oldMetadata.managedBy === 'ScaleMax CLI'
@@ -158,8 +170,8 @@ export async function configure(ctx) {
158
170
  nextEnv[customModelOptionDescriptionKey] = customModel.description;
159
171
  }
160
172
  else if (oldMetadata.managedBy === 'ScaleMax CLI') {
161
- // A key can be reconfigured from a Fable/Auto catalog to one that does
162
- // not include either model. Remove only the values this CLI previously
173
+ // A key can be reconfigured from a Fable catalog (or a legacy Auto one)
174
+ // to one that does not include it. Remove only the values this CLI previously
163
175
  // managed, restoring any user values captured on the first configure.
164
176
  const written = {
165
177
  [customModelOptionKey]: oldMetadata.customModelOption,
@@ -182,6 +194,7 @@ export async function configure(ctx) {
182
194
  return JSON.stringify({
183
195
  ...existing,
184
196
  apiKeyHelper,
197
+ ...(statusLine.action === 'set' ? { statusLine: statusLine.statusLine } : {}),
185
198
  env: nextEnv,
186
199
  'scalemax.managedBy': GENERATED_HEADER,
187
200
  scalemax: {
@@ -201,6 +214,8 @@ export async function configure(ctx) {
201
214
  }
202
215
  }, null, 2) + '\n';
203
216
  });
217
+ if (statusLine.action === 'set')
218
+ scriptChanged = await installStatusLineScript(ctx.home, ctx.platform);
204
219
  }
205
220
  catch (error) {
206
221
  try {
@@ -211,11 +226,12 @@ export async function configure(ctx) {
211
226
  }
212
227
  throw error;
213
228
  }
214
- const changed = result.changed || secret.changed;
229
+ const changed = result.changed || secret.changed || scriptChanged;
215
230
  return {
216
231
  ...result,
217
232
  changed,
218
- message: `configured Anthropic Messages routing with ${model}, file-backed authentication, and gateway discovery${quick ? `; ${quick} handles background work` : ''}`,
233
+ message: `configured Anthropic Messages routing with ${model}, file-backed authentication, and gateway discovery${quick ? `; ${quick} handles background work` : ''}${statusLine.action === 'set' ? '; the status line shows your ScaleMax balance' : ''}`,
234
+ ...(statusLine.action === 'keep-foreign' ? { tip: FOREIGN_STATUSLINE_TIP } : {}),
219
235
  ...(changed ? { rollback: snapshotRollback(snapshots, ctx.platform) } : {}),
220
236
  };
221
237
  }
@@ -339,6 +355,9 @@ export async function remove(ctx) {
339
355
  settings.env = env;
340
356
  else
341
357
  delete settings.env;
358
+ // Only our statusLine (command runs .scalemax/statusline.mjs); a saved
359
+ // user statusLine replaced by `statusline --install` is put back.
360
+ await stripScaleMaxStatusLine(settings, ctx.home);
342
361
  delete settings['scalemax.managedBy'];
343
362
  delete settings.scalemax;
344
363
  await backupFile(file, ctx.home);
@@ -6,7 +6,7 @@ import { codexAuthPath, codexConfigPath } from './paths.js';
6
6
  import { atomicWrite, backupFile, captureFileSnapshots, listBackups, restoreFileSnapshots, snapshotRollback } from '../utils/fs.js';
7
7
  import { GENERATED_HEADER } from '../constants.js';
8
8
  import { commandExists } from '../utils/exec.js';
9
- import { AUTO_MODEL_ID, codexModel, codexModelIds, sameModelId } from './models.js';
9
+ import { codexModel, codexModelIds, sameModelId } from './models.js';
10
10
  const id = 'codex';
11
11
  const name = 'Codex';
12
12
  const provider = 'scalemax';
@@ -34,23 +34,18 @@ function managedAuthHash(config) {
34
34
  return markerHash(config, managedAuthHashPrefix);
35
35
  }
36
36
  function selectedModel(ctx) {
37
- if (!ctx.models) {
38
- // An auto-api key's ONLY model is `auto`; gpt-5.5 (the generic fallback
39
- // used when no authenticated catalog is available at all) is a model an
40
- // Auto key cannot call and would 403 every request.
41
- return ctx.providerScope === 'auto-api' ? AUTO_MODEL_ID : fallbackModel;
42
- }
43
- // GPT only (or Auto on an Auto key); throws a plain explanation otherwise.
37
+ if (!ctx.models)
38
+ return fallbackModel;
39
+ // GPT only; throws a plain explanation otherwise.
44
40
  return codexModel(ctx);
45
41
  }
46
- /** A model Codex can run on with this key: any of its GPT models, or Auto. */
42
+ /** A model Codex can run on with this key: any of its GPT models. */
47
43
  function codexCanUse(ctx, configured) {
48
44
  if (typeof configured !== 'string' || !configured.trim())
49
45
  return false;
50
46
  if (!ctx.models)
51
47
  return configured === selectedModel(ctx);
52
- return codexModelIds(ctx).some(id => sameModelId(id, configured))
53
- || (sameModelId(configured, AUTO_MODEL_ID) && sameModelId(selectedModel(ctx), AUTO_MODEL_ID));
48
+ return codexModelIds(ctx).some(id => sameModelId(id, configured));
54
49
  }
55
50
  function scalemaxCodexBlock(baseUrl, model = fallbackModel, authHash, keyHash) {
56
51
  const authMarker = authHash ? `${managedAuthHashPrefix}${authHash}\n` : '';
@@ -1,19 +1,10 @@
1
1
  import { ConfigureContext, ConfigureResult, InstallContext, RemoveContext } from '../types/client.js';
2
2
  /**
3
- * Which single-model keys Continue's automatic setup can configure.
4
- *
5
- * DELIBERATELY NOT `isExactChatCompletionsModelId` itself, even though the
6
- * shape of the question is identical: that function is shared with codex's
7
- * eligibility check (`!isAnthropicModel && !isExactChatCompletionsModelId`)
8
- * and hermes's, so adding `auto` to it would silently make Codex INELIGIBLE
9
- * for Auto keys -- the opposite of the fix this session already shipped and
10
- * verified live. This is a Continue-owned predicate instead.
11
- *
12
- * The real invariant Continue's automatic setup depends on is "this key can
13
- * call exactly one named model, over Chat Completions" -- true of DeepSeek and
14
- * GLM admin-issued keys, and equally true of an auto-api key (its catalog is
15
- * always exactly one model, `auto`, and it speaks Chat Completions with tools
16
- * -- live-verified, 2026-08-08).
3
+ * Which single-model keys Continue's automatic setup can configure: "this key
4
+ * can call exactly one named model, over Chat Completions" -- the DeepSeek and
5
+ * GLM admin-issued keys. Kept as a Continue-owned predicate so Continue's rule
6
+ * can change without touching codex's and hermes's use of
7
+ * `isExactChatCompletionsModelId`.
17
8
  */
18
9
  export declare function isContinueEligibleModelId(id: string): boolean;
19
10
  export declare function isManagedContinueModel(model: any): boolean;
@@ -6,25 +6,16 @@ import { atomicWrite, backupFile, captureFileSnapshots, restoreFileSnapshots, sn
6
6
  import { commandExists } from '../utils/exec.js';
7
7
  import { clientConfigPath } from './paths.js';
8
8
  import { isScaleMaxApiUrl } from './common.js';
9
- import { isExactChatCompletionsModelId, modelIdKey, modelName as displayModelName, AUTO_MODEL_ID } from './models.js';
9
+ import { isExactChatCompletionsModelId, modelIdKey, modelName as displayModelName } from './models.js';
10
10
  /**
11
- * Which single-model keys Continue's automatic setup can configure.
12
- *
13
- * DELIBERATELY NOT `isExactChatCompletionsModelId` itself, even though the
14
- * shape of the question is identical: that function is shared with codex's
15
- * eligibility check (`!isAnthropicModel && !isExactChatCompletionsModelId`)
16
- * and hermes's, so adding `auto` to it would silently make Codex INELIGIBLE
17
- * for Auto keys -- the opposite of the fix this session already shipped and
18
- * verified live. This is a Continue-owned predicate instead.
19
- *
20
- * The real invariant Continue's automatic setup depends on is "this key can
21
- * call exactly one named model, over Chat Completions" -- true of DeepSeek and
22
- * GLM admin-issued keys, and equally true of an auto-api key (its catalog is
23
- * always exactly one model, `auto`, and it speaks Chat Completions with tools
24
- * -- live-verified, 2026-08-08).
11
+ * Which single-model keys Continue's automatic setup can configure: "this key
12
+ * can call exactly one named model, over Chat Completions" -- the DeepSeek and
13
+ * GLM admin-issued keys. Kept as a Continue-owned predicate so Continue's rule
14
+ * can change without touching codex's and hermes's use of
15
+ * `isExactChatCompletionsModelId`.
25
16
  */
26
17
  export function isContinueEligibleModelId(id) {
27
- return isExactChatCompletionsModelId(id) || modelIdKey(id) === AUTO_MODEL_ID;
18
+ return isExactChatCompletionsModelId(id);
28
19
  }
29
20
  const id = 'continue';
30
21
  const name = 'Continue (VS Code)';
@@ -46,11 +37,15 @@ function parseYaml(text) {
46
37
  throw new Error('Continue config.yaml must contain a YAML object.');
47
38
  return doc;
48
39
  }
40
+ /** Written by CLI versions that still configured the retired Auto API; still
41
+ * recognised so `update` / `remove` can clean old profiles out. */
42
+ const LEGACY_MANAGED_MODEL_IDS = new Set(['auto']);
49
43
  export function isManagedContinueModel(model) {
44
+ const id = String(model?.model || '');
50
45
  return typeof model?.name === 'string'
51
46
  && model.name.startsWith('ScaleMax ')
52
47
  && ['azure', 'openai'].includes(model?.provider)
53
- && isContinueEligibleModelId(String(model?.model || ''))
48
+ && (isContinueEligibleModelId(id) || LEGACY_MANAGED_MODEL_IDS.has(modelIdKey(id)))
54
49
  && typeof model?.apiBase === 'string'
55
50
  && isScaleMaxApiUrl(model.apiBase)
56
51
  && model.apiKey === `\${{ secrets.${envKey} }}`
@@ -9,8 +9,6 @@ type CatalogContext = Pick<ConfigureContext, 'models' | 'avoidModelIds'>;
9
9
  export declare const DEEPSEEK_V4_FLASH_MODEL_ID = "deepseek-v4-flash";
10
10
  export declare const GLM_5_2_MODEL_ID = "glm-5.2";
11
11
  export declare const DEEPSEEK_V4_PRO_MODEL_ID = "deepseek-v4-pro";
12
- /** The single model behind an auto-api scoped key. */
13
- export declare const AUTO_MODEL_ID = "auto";
14
12
  /**
15
13
  * OpenClaw has distinct compatibility switches for each part of an
16
14
  * OpenAI-compatible tool loop. Do not infer one from another: a route can
@@ -58,7 +56,7 @@ export declare function modelAcceptsImages(ctx: CatalogContext, id: string): boo
58
56
  * before a text-only one. Never a model from another provider.
59
57
  */
60
58
  export declare function preferredAnthropicModel(ctx: CatalogContext): string;
61
- /** Every catalog id Claude Code can be pointed at: Claude rows, or Auto. */
59
+ /** Every catalog id Claude Code can be pointed at: the Claude rows. */
62
60
  export declare function claudeCodeModelIds(ctx: CatalogContext): string[];
63
61
  export declare const CLAUDE_CODE_NEEDS_CLAUDE_MESSAGE = "This API key has no Claude model, so Claude Code was not set up. Claude Code needs a key on the Claude or OpenAI + Claude plan: https://scalemax.pro/pricing";
64
62
  /** Claude Code's ANTHROPIC_MODEL. */
@@ -72,7 +70,7 @@ export declare function claudeCodeMainModel(ctx: CatalogContext): string;
72
70
  export declare function claudeCodeBackgroundModel(ctx: CatalogContext): string | undefined;
73
71
  /**
74
72
  * Claude Code's picker hides gateway ids that do not start with `claude` or
75
- * `anthropic`, so ONE custom option exposes Fable or Auto. Fable 5 keeps the
73
+ * `anthropic`, so ONE custom option exposes Fable. Fable 5 keeps the
76
74
  * slot whenever the key has it (re-running setup never moves a user onto a
77
75
  * different model and price); among the rest an image-capable model wins, so
78
76
  * a pasted screenshot does not fail on a text-only default.
@@ -82,8 +80,8 @@ export declare function claudeCodeCustomModelId(ctx: CatalogContext): string | u
82
80
  export declare function codexModelIds(ctx: CatalogContext): string[];
83
81
  export declare const CODEX_NEEDS_GPT_MESSAGE = "This API key has no GPT model, so Codex was not set up. Codex runs on GPT models only: use a key on the OpenAI or OpenAI + Claude plan: https://scalemax.pro/pricing";
84
82
  /**
85
- * Codex's model: a GPT model the key has (gpt-5.6-terra first), or `auto` on
86
- * an Auto key. Never a Claude id, the `claude-sonnet-4-6` alias, DeepSeek or
83
+ * Codex's model: a GPT model the key has (gpt-5.6-terra first). Never a
84
+ * Claude id, the `claude-sonnet-4-6` alias, DeepSeek or
87
85
  * another family's model: Codex's Responses requests fail on those.
88
86
  */
89
87
  export declare function codexModel(ctx: CatalogContext): string;
@@ -17,7 +17,7 @@ const preferredClaude = [
17
17
  'claude-haiku-5-5',
18
18
  'claude-haiku-4-5-20251001'
19
19
  ];
20
- /** Codex runs only on these (plus Auto on an Auto key). */
20
+ /** Codex runs only on these. */
21
21
  const preferredGpt = [
22
22
  'gpt-5.6-terra',
23
23
  'gpt-5.6-sol',
@@ -53,12 +53,8 @@ const preferredLocal = [
53
53
  * one or several families are present.
54
54
  */
55
55
  const preferredOtherFamilies = [
56
- 'gemini-3-pro-preview',
57
- 'gemini-3.1-pro-preview',
56
+ // Gemini Pro, 3.7/3.6/3.5 Flash retired (2026-10-12/15); 3.8 Flash leads.
58
57
  'gemini-3.8-flash',
59
- 'gemini-3.7-flash',
60
- 'gemini-3.6-flash',
61
- 'gemini-3.5-flash',
62
58
  'gemini-3-flash-preview',
63
59
  'gemini-3.1-flash-lite-preview',
64
60
  'grok-4.6',
@@ -72,8 +68,6 @@ const preferredOpenAi = [...preferredGpt, ...preferredLocal, ...preferredOtherFa
72
68
  export const DEEPSEEK_V4_FLASH_MODEL_ID = 'deepseek-v4-flash';
73
69
  export const GLM_5_2_MODEL_ID = 'glm-5.2';
74
70
  export const DEEPSEEK_V4_PRO_MODEL_ID = 'deepseek-v4-pro';
75
- /** The single model behind an auto-api scoped key. */
76
- export const AUTO_MODEL_ID = 'auto';
77
71
  /**
78
72
  * The catalog row for `id`: the exact spelling first, then the same model
79
73
  * under another context suffix (`claude-opus-5` finds `claude-opus-5[1m]`).
@@ -212,20 +206,15 @@ export function preferredAnthropicModel(ctx) {
212
206
  return preferred;
213
207
  throw new Error('No compatible Claude models are available for this API key; the client was not changed.');
214
208
  }
215
- /** Every catalog id Claude Code can be pointed at: Claude rows, or Auto. */
209
+ /** Every catalog id Claude Code can be pointed at: the Claude rows. */
216
210
  export function claudeCodeModelIds(ctx) {
217
- const claude = claudeDefaultIds(ctx);
218
- const auto = modelIds(ctx).filter(id => modelIdKey(id) === AUTO_MODEL_ID);
219
- return [...claude, ...auto];
211
+ return claudeDefaultIds(ctx);
220
212
  }
221
213
  export const CLAUDE_CODE_NEEDS_CLAUDE_MESSAGE = 'This API key has no Claude model, so Claude Code was not set up. Claude Code needs a key on the Claude or OpenAI + Claude plan: https://scalemax.pro/pricing';
222
214
  /** Claude Code's ANTHROPIC_MODEL. */
223
215
  export function claudeCodeMainModel(ctx) {
224
216
  if (claudeDefaultIds(ctx).length)
225
217
  return preferredAnthropicModel(ctx);
226
- const auto = claudeCodeModelIds(ctx)[0];
227
- if (auto)
228
- return auto;
229
218
  throw new Error(CLAUDE_CODE_NEEDS_CLAUDE_MESSAGE);
230
219
  }
231
220
  /** Lower is cheaper: list price when the catalog has it, else the model tier. */
@@ -262,7 +251,7 @@ export function claudeCodeBackgroundModel(ctx) {
262
251
  }
263
252
  /**
264
253
  * Claude Code's picker hides gateway ids that do not start with `claude` or
265
- * `anthropic`, so ONE custom option exposes Fable or Auto. Fable 5 keeps the
254
+ * `anthropic`, so ONE custom option exposes Fable. Fable 5 keeps the
266
255
  * slot whenever the key has it (re-running setup never moves a user onto a
267
256
  * different model and price); among the rest an image-capable model wins, so
268
257
  * a pasted screenshot does not fail on a text-only default.
@@ -274,7 +263,6 @@ export function claudeCodeCustomModelId(ctx) {
274
263
  return fable5;
275
264
  const ranked = (ids) => firstPreferred(ids, ['fable-5.1'])
276
265
  || ids.find(id => modelIdKey(id).startsWith('fable-'))
277
- || ids.find(id => modelIdKey(id) !== AUTO_MODEL_ID)
278
266
  || ids[0];
279
267
  return ranked(hidden.filter(id => modelAcceptsImages(ctx, id))) || ranked(hidden);
280
268
  }
@@ -284,17 +272,14 @@ export function codexModelIds(ctx) {
284
272
  }
285
273
  export const CODEX_NEEDS_GPT_MESSAGE = 'This API key has no GPT model, so Codex was not set up. Codex runs on GPT models only: use a key on the OpenAI or OpenAI + Claude plan: https://scalemax.pro/pricing';
286
274
  /**
287
- * Codex's model: a GPT model the key has (gpt-5.6-terra first), or `auto` on
288
- * an Auto key. Never a Claude id, the `claude-sonnet-4-6` alias, DeepSeek or
275
+ * Codex's model: a GPT model the key has (gpt-5.6-terra first). Never a
276
+ * Claude id, the `claude-sonnet-4-6` alias, DeepSeek or
289
277
  * another family's model: Codex's Responses requests fail on those.
290
278
  */
291
279
  export function codexModel(ctx) {
292
280
  const gpt = codexModelIds(ctx);
293
281
  if (gpt.length)
294
282
  return preferredFrom(ctx, gpt, preferredGpt, 'Codex');
295
- const auto = modelIds(ctx).find(id => modelIdKey(id) === AUTO_MODEL_ID);
296
- if (auto)
297
- return auto;
298
283
  throw new Error(CODEX_NEEDS_GPT_MESSAGE);
299
284
  }
300
285
  /** Non-Claude default for OpenAI-compatible clients: GPT, then Local, then other families. */
@@ -0,0 +1,52 @@
1
+ export declare const STATUSLINE_ASSET: string;
2
+ export declare function statusLineScriptPath(home: string): string;
3
+ /** Where a user's own statusLine waits while `statusline --install` has replaced it. */
4
+ export declare function previousStatusLinePath(home: string): string;
5
+ export declare function claudeSettingsPath(home: string, platform: NodeJS.Platform): string;
6
+ /**
7
+ * `node '<home>/.scalemax/statusline.mjs'`, quoted for the shell Claude Code
8
+ * uses. POSIX: single quotes (no `$`/backtick expansion in a home path).
9
+ * Windows: double quotes and forward slashes, which cmd, PowerShell and Git
10
+ * Bash all accept (Windows paths cannot contain `"`).
11
+ */
12
+ export declare function statusLineCommand(home: string, platform: NodeJS.Platform): string;
13
+ export declare function statusLineSetting(home: string, platform: NodeJS.Platform): {
14
+ type: 'command';
15
+ command: string;
16
+ };
17
+ export declare function isScaleMaxStatusLine(value: unknown): boolean;
18
+ export type StatusLinePlan = {
19
+ action: 'set';
20
+ statusLine: {
21
+ type: 'command';
22
+ command: string;
23
+ };
24
+ } | {
25
+ action: 'keep-foreign';
26
+ };
27
+ /** What `configure` does with an existing statusLine: add or refresh ours, never replace someone else's. */
28
+ export declare function planStatusLine(existing: unknown, home: string, platform: NodeJS.Platform): StatusLinePlan;
29
+ export declare const FOREIGN_STATUSLINE_TIP = "Add your ScaleMax balance to the Claude Code status line: npx scalemax@latest statusline --install (your current status line is saved and restored by --remove).";
30
+ /** Copy the script to ~/.scalemax/statusline.mjs when it differs. Returns whether it was written. */
31
+ export declare function installStatusLineScript(home: string, platform: NodeJS.Platform, assetPath?: string): Promise<boolean>;
32
+ /**
33
+ * Take our statusLine out of a parsed settings object, putting back the one
34
+ * `statusline --install` replaced when there is one. Leaves a foreign
35
+ * statusLine alone. Returns whether `settings` changed.
36
+ */
37
+ export declare function stripScaleMaxStatusLine(settings: Record<string, unknown>, home: string): Promise<boolean>;
38
+ export interface StatusLineChange {
39
+ changed: boolean;
40
+ message: string;
41
+ settingsPath: string;
42
+ }
43
+ /**
44
+ * `scalemax statusline --install`: an explicit request, so a foreign
45
+ * statusLine is replaced, but saved first so it can be restored.
46
+ */
47
+ export declare function installStatusLine(home: string, platform?: NodeJS.Platform, assetPath?: string): Promise<StatusLineChange>;
48
+ /**
49
+ * `scalemax statusline --remove` and `scalemax remove`: take out our
50
+ * statusLine only (restoring a saved one), then the script and its cache.
51
+ */
52
+ export declare function removeStatusLine(home: string, platform?: NodeJS.Platform): Promise<StatusLineChange>;