scalemax 0.1.16 → 0.1.17
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/README.md +1 -1
- package/dist/bootstrap.cjs +1 -1
- package/dist/configure/claude.js +8 -3
- package/dist/index.js +2 -2
- package/dist/utils/runtime.d.ts +1 -1
- package/dist/utils/runtime.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -114,7 +114,7 @@ For clients without a stable official config file, the installer writes a ScaleM
|
|
|
114
114
|
|
|
115
115
|
### Claude Code
|
|
116
116
|
|
|
117
|
-
ScaleMax updates `~/.claude/settings.json` with `ANTHROPIC_BASE_URL=https://api.scalemax.pro`, gateway model discovery, and a cached `apiKeyHelper` that reads a private `~/.claude/scalemax.key` file. The raw key is not stored in the settings JSON. The Anthropic base URL intentionally has no `/v1` suffix because Claude Code adds `/v1/messages` itself. The CLI preserves unrelated settings, selects a live main model from the authenticated catalog (preferring `claude-opus-4-8`), pins authenticated Haiku for lightweight background work when available, and verifies a one-token Messages request
|
|
117
|
+
ScaleMax updates `~/.claude/settings.json` with `ANTHROPIC_BASE_URL=https://api.scalemax.pro`, gateway model discovery, and a cached `apiKeyHelper` that reads a private `~/.claude/scalemax.key` file. The raw key is not stored in the settings JSON. The Anthropic base URL intentionally has no `/v1` suffix because Claude Code adds `/v1/messages` itself. The CLI preserves unrelated settings, selects a live main model from the authenticated catalog (preferring `claude-opus-4-8`), pins authenticated Haiku for lightweight background work when available, and sets `CLAUDE_CODE_DISABLE_THINKING=1` because third-party Anthropic-compatible providers do not support Claude Code's proprietary extended-thinking control envelope. It verifies a one-token Messages request and, if verification fails, removes only the ScaleMax-managed changes. Claude Code picker aliases such as `claude-opus-4-8[1m]` are normalized by the gateway.
|
|
118
118
|
|
|
119
119
|
### OpenCode
|
|
120
120
|
|
package/dist/bootstrap.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
function cmp(a,b){a=String(a).replace(/^v/,'').split('.').map(Number);b=String(b).split('.').map(Number);for(var i=0;i<3;i++){var d=(a[i]||0)-(b[i]||0);if(d)return d;}return 0;}
|
|
4
|
-
var min=
|
|
4
|
+
var min="18.19.0";
|
|
5
5
|
if (cmp(process.versions.node,min)<0) {
|
|
6
6
|
console.error('ScaleMax requires Node.js >= '+min+'. Current: '+process.versions.node);
|
|
7
7
|
console.error('Install Node.js LTS, then rerun: npx scalemax@latest');
|
package/dist/configure/claude.js
CHANGED
|
@@ -13,7 +13,8 @@ const name = 'Claude Code';
|
|
|
13
13
|
const discoveryKey = 'CLAUDE_CODE_ENABLE_GATEWAY_MODEL_DISCOVERY';
|
|
14
14
|
const fastModelKey = 'ANTHROPIC_DEFAULT_HAIKU_MODEL';
|
|
15
15
|
const helperTtlKey = 'CLAUDE_CODE_API_KEY_HELPER_TTL_MS';
|
|
16
|
-
const
|
|
16
|
+
const disableThinkingKey = 'CLAUDE_CODE_DISABLE_THINKING';
|
|
17
|
+
const managedEnvKeys = ['ANTHROPIC_AUTH_TOKEN', 'ANTHROPIC_API_KEY', 'ANTHROPIC_BASE_URL', 'ANTHROPIC_MODEL', discoveryKey, fastModelKey, helperTtlKey, disableThinkingKey];
|
|
17
18
|
function secretPath(home) { return path.join(home, '.claude', 'scalemax.key'); }
|
|
18
19
|
function helperCommand(home, platform) {
|
|
19
20
|
const file = secretPath(home);
|
|
@@ -47,7 +48,8 @@ export async function configure(ctx) {
|
|
|
47
48
|
ANTHROPIC_BASE_URL: baseUrl,
|
|
48
49
|
ANTHROPIC_MODEL: model,
|
|
49
50
|
[discoveryKey]: '1',
|
|
50
|
-
[helperTtlKey]: '900000'
|
|
51
|
+
[helperTtlKey]: '900000',
|
|
52
|
+
[disableThinkingKey]: '1'
|
|
51
53
|
};
|
|
52
54
|
delete nextEnv.ANTHROPIC_AUTH_TOKEN;
|
|
53
55
|
delete nextEnv.ANTHROPIC_API_KEY;
|
|
@@ -67,6 +69,7 @@ export async function configure(ctx) {
|
|
|
67
69
|
gatewayDiscovery: '1',
|
|
68
70
|
fastModel: quick || null,
|
|
69
71
|
helperTtl: '900000',
|
|
72
|
+
disableThinking: '1',
|
|
70
73
|
apiKeyHelper,
|
|
71
74
|
authTokenSha256: crypto.createHash('sha256').update(ctx.apiKey).digest('hex'),
|
|
72
75
|
previousEnv,
|
|
@@ -86,7 +89,7 @@ export async function verify(ctx) {
|
|
|
86
89
|
const settings = await fs.readJson(file);
|
|
87
90
|
const env = asRecord(settings?.env);
|
|
88
91
|
const model = String(env.ANTHROPIC_MODEL || '');
|
|
89
|
-
if (!modelIds(ctx).includes(model) || env.ANTHROPIC_BASE_URL !== anthropicOrigin(ctx.baseUrl) || settings.apiKeyHelper !== helperCommand(ctx.home, ctx.platform) || env.ANTHROPIC_AUTH_TOKEN || env.ANTHROPIC_API_KEY || env[discoveryKey] !== '1') {
|
|
92
|
+
if (!modelIds(ctx).includes(model) || env.ANTHROPIC_BASE_URL !== anthropicOrigin(ctx.baseUrl) || settings.apiKeyHelper !== helperCommand(ctx.home, ctx.platform) || env.ANTHROPIC_AUTH_TOKEN || env.ANTHROPIC_API_KEY || env[discoveryKey] !== '1' || env[disableThinkingKey] !== '1') {
|
|
90
93
|
throw new Error('Claude Code settings do not match the authenticated ScaleMax model catalog.');
|
|
91
94
|
}
|
|
92
95
|
await verifyClientSecret(secretPath(ctx.home), ctx);
|
|
@@ -138,6 +141,8 @@ export async function remove(ctx) {
|
|
|
138
141
|
restore(fastModelKey);
|
|
139
142
|
if (env[helperTtlKey] === managed.helperTtl)
|
|
140
143
|
restore(helperTtlKey);
|
|
144
|
+
if (env[disableThinkingKey] === managed.disableThinking)
|
|
145
|
+
restore(disableThinkingKey);
|
|
141
146
|
if (!Object.prototype.hasOwnProperty.call(env, 'ANTHROPIC_AUTH_TOKEN'))
|
|
142
147
|
restore('ANTHROPIC_AUTH_TOKEN');
|
|
143
148
|
if (!Object.prototype.hasOwnProperty.call(env, 'ANTHROPIC_API_KEY'))
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { modelsCommand } from './commands/models.js';
|
|
|
12
12
|
import { updateCommand } from './commands/update.js';
|
|
13
13
|
import { removeCommand } from './commands/remove.js';
|
|
14
14
|
import { ensureInstallerApiKey } from './utils/installerConfig.js';
|
|
15
|
-
import { isNodeSupported, nodeUpgradeHint } from './utils/runtime.js';
|
|
15
|
+
import { MIN_NODE, isNodeSupported, nodeUpgradeHint } from './utils/runtime.js';
|
|
16
16
|
import { runSystemAudit } from './utils/systemAudit.js';
|
|
17
17
|
function packageVersion() {
|
|
18
18
|
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -63,7 +63,7 @@ async function runInteractiveInstaller() {
|
|
|
63
63
|
}
|
|
64
64
|
async function main() {
|
|
65
65
|
if (!isNodeSupported()) {
|
|
66
|
-
console.error(chalk.red(`ScaleMax requires Node.js
|
|
66
|
+
console.error(chalk.red(`ScaleMax requires Node.js >=${MIN_NODE}. Current: ${process.versions.node}`));
|
|
67
67
|
console.error(nodeUpgradeHint());
|
|
68
68
|
process.exitCode = 1;
|
|
69
69
|
return;
|
package/dist/utils/runtime.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const MIN_NODE = "18.
|
|
1
|
+
export declare const MIN_NODE = "18.19.0";
|
|
2
2
|
export declare const RECOMMENDED_NODE = "22";
|
|
3
3
|
export type OsFamily = 'macos' | 'ubuntu' | 'debian' | 'fedora' | 'arch' | 'windows' | 'wsl' | 'linux' | 'unknown';
|
|
4
4
|
export type RuntimeAudit = {
|
package/dist/utils/runtime.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import os from 'node:os';
|
|
2
2
|
import { execa } from 'execa';
|
|
3
3
|
import { commandExists } from './exec.js';
|
|
4
|
-
export const MIN_NODE = '18.
|
|
4
|
+
export const MIN_NODE = '18.19.0';
|
|
5
5
|
export const RECOMMENDED_NODE = '22';
|
|
6
6
|
export function compareSemver(a, b) { const pa = a.replace(/^v/, '').split('.').map(Number), pb = b.replace(/^v/, '').split('.').map(Number); for (let i = 0; i < 3; i++) {
|
|
7
7
|
const d = (pa[i] || 0) - (pb[i] || 0);
|