@ekkos/cli 1.0.32 → 1.0.33
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/dist/commands/run.js +30 -5
- package/package.json +1 -1
package/dist/commands/run.js
CHANGED
|
@@ -311,6 +311,7 @@ const isWindows = os.platform() === 'win32';
|
|
|
311
311
|
// Core ekkOS patches (eviction, context management) work with all recent versions
|
|
312
312
|
// Cosmetic patches may fail on newer versions but don't affect functionality
|
|
313
313
|
const PINNED_CLAUDE_VERSION = 'latest';
|
|
314
|
+
const MIN_CLAUDE_VERSION_FOR_LATEST = process.env.EKKOS_MIN_CLAUDE_VERSION || '2.1.49';
|
|
314
315
|
// Max output tokens for Claude responses
|
|
315
316
|
// Default: 16384 (safe for Sonnet 4.5)
|
|
316
317
|
// Opus 4.5 supports up to 64k - set EKKOS_MAX_OUTPUT_TOKENS=32768 or =65536 to use higher limits
|
|
@@ -388,8 +389,8 @@ function getEkkosEnv() {
|
|
|
388
389
|
// Format: https://mcp.ekkos.dev/proxy/{userId}/{sessionName}?project={base64(cwd)}
|
|
389
390
|
// Gateway extracts from URL: /proxy/{userId}/{sessionName}/v1/messages
|
|
390
391
|
// Project path is base64-encoded to handle special chars safely
|
|
391
|
-
const projectPath = process.cwd();
|
|
392
|
-
const projectPathEncoded = Buffer.from(projectPath).toString('
|
|
392
|
+
const projectPath = process.cwd().replace(/\\/g, '/');
|
|
393
|
+
const projectPathEncoded = encodeURIComponent(Buffer.from(projectPath, 'utf-8').toString('base64'));
|
|
393
394
|
const proxyUrl = `${EKKOS_PROXY_URL}/proxy/${encodeURIComponent(userId)}/${encodeURIComponent(cliSessionName)}?project=${projectPathEncoded}`;
|
|
394
395
|
env.ANTHROPIC_BASE_URL = proxyUrl;
|
|
395
396
|
// Proxy URL contains userId + project path — don't leak to terminal
|
|
@@ -465,6 +466,24 @@ function getClaudeVersion(claudePath) {
|
|
|
465
466
|
return null;
|
|
466
467
|
}
|
|
467
468
|
}
|
|
469
|
+
function compareSemver(a, b) {
|
|
470
|
+
const parse = (v) => {
|
|
471
|
+
const m = v.match(/(\d+)\.(\d+)\.(\d+)/);
|
|
472
|
+
if (!m)
|
|
473
|
+
return [0, 0, 0];
|
|
474
|
+
return [Number(m[1]), Number(m[2]), Number(m[3])];
|
|
475
|
+
};
|
|
476
|
+
const pa = parse(a);
|
|
477
|
+
const pb = parse(b);
|
|
478
|
+
for (let i = 0; i < 3; i++) {
|
|
479
|
+
if (pa[i] !== pb[i])
|
|
480
|
+
return pa[i] - pb[i];
|
|
481
|
+
}
|
|
482
|
+
return 0;
|
|
483
|
+
}
|
|
484
|
+
function isVersionAtLeast(version, minVersion) {
|
|
485
|
+
return compareSemver(version, minVersion) >= 0;
|
|
486
|
+
}
|
|
468
487
|
/**
|
|
469
488
|
* Check if a Claude installation matches our required version
|
|
470
489
|
* When PINNED_CLAUDE_VERSION is 'latest', any version is acceptable
|
|
@@ -474,8 +493,9 @@ function checkClaudeVersion(claudePath) {
|
|
|
474
493
|
if (!version)
|
|
475
494
|
return false;
|
|
476
495
|
// 'latest' means any version is acceptable
|
|
477
|
-
if (PINNED_CLAUDE_VERSION === 'latest')
|
|
478
|
-
return
|
|
496
|
+
if (PINNED_CLAUDE_VERSION === 'latest') {
|
|
497
|
+
return isVersionAtLeast(version, MIN_CLAUDE_VERSION_FOR_LATEST);
|
|
498
|
+
}
|
|
479
499
|
return version === PINNED_CLAUDE_VERSION;
|
|
480
500
|
}
|
|
481
501
|
/**
|
|
@@ -559,7 +579,12 @@ function resolveClaudePath() {
|
|
|
559
579
|
// These binaries do not print the npm-to-native migration warning.
|
|
560
580
|
const nativeBin = resolveNativeClaudeBin();
|
|
561
581
|
if (nativeBin) {
|
|
562
|
-
|
|
582
|
+
const nativeVersion = getClaudeVersion(nativeBin);
|
|
583
|
+
if (PINNED_CLAUDE_VERSION !== 'latest' ||
|
|
584
|
+
(nativeVersion && isVersionAtLeast(nativeVersion, MIN_CLAUDE_VERSION_FOR_LATEST))) {
|
|
585
|
+
return nativeBin;
|
|
586
|
+
}
|
|
587
|
+
console.log(chalk_1.default.yellow(` Native Claude ${nativeVersion || 'unknown'} is below minimum ${MIN_CLAUDE_VERSION_FOR_LATEST}; using managed latest.`));
|
|
563
588
|
}
|
|
564
589
|
// PRIORITY 2: ekkOS-managed npm installation (existing users before native installer)
|
|
565
590
|
if (fs.existsSync(EKKOS_CLAUDE_BIN) && checkClaudeVersion(EKKOS_CLAUDE_BIN)) {
|