@gokulvenkatareddy/cortex 0.1.11 → 0.1.12
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/bin/cortex +51 -9
- package/dist/cli.mjs +11 -19
- package/package.json +1 -1
package/bin/cortex
CHANGED
|
@@ -11,22 +11,22 @@ import os from 'os';
|
|
|
11
11
|
import path from 'path';
|
|
12
12
|
import { fileURLToPath } from 'url';
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
var __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
15
|
+
var ROOT = path.resolve(__dirname, '..');
|
|
16
|
+
var CLI_PATH = path.join(ROOT, 'dist', 'cli.mjs');
|
|
17
|
+
var WIZARD = path.join(ROOT, 'scripts', 'setup-wizard.ts');
|
|
18
18
|
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
var CONFIG_DIR = path.join(os.homedir(), '.cortex');
|
|
20
|
+
var CONFIG_ENV = path.join(CONFIG_DIR, '.env');
|
|
21
21
|
|
|
22
|
-
|
|
22
|
+
var args = process.argv.slice(2);
|
|
23
23
|
|
|
24
24
|
function loadUserConfig() {
|
|
25
25
|
if (!fs.existsSync(CONFIG_ENV)) return {};
|
|
26
26
|
var lines = fs.readFileSync(CONFIG_ENV, 'utf8').split('\n');
|
|
27
27
|
var env = {};
|
|
28
28
|
for (var i = 0; i < lines.length; i++) {
|
|
29
|
-
var m = lines[i].match(/^([A-
|
|
29
|
+
var m = lines[i].match(/^([A-Za-z_][A-Za-z0-9_]*)=(.+)$/);
|
|
30
30
|
if (m) env[m[1]] = m[2].trim();
|
|
31
31
|
}
|
|
32
32
|
return env;
|
|
@@ -68,8 +68,50 @@ function launchCortex(extraEnv) {
|
|
|
68
68
|
console.error('\n❌ dist/cli.mjs not found.\n');
|
|
69
69
|
process.exit(1);
|
|
70
70
|
}
|
|
71
|
+
|
|
71
72
|
var userConfig = loadUserConfig();
|
|
72
|
-
|
|
73
|
+
|
|
74
|
+
// ─── Auto-detect provider and set the correct CORTEX_USE_* flag ──────────
|
|
75
|
+
// Without these flags, the CLI defaults to 'firstParty' (Anthropic login screen).
|
|
76
|
+
var provider = userConfig['CORTEX_PROVIDER'] || '';
|
|
77
|
+
|
|
78
|
+
if (!process.env.CORTEX_USE_OPENAI && !process.env.CORTEX_USE_GEMINI && !process.env.CORTEX_USE_GITHUB) {
|
|
79
|
+
if (provider === 'nvidia' || userConfig['NVIDIA_API_KEY']) {
|
|
80
|
+
userConfig['CORTEX_USE_OPENAI'] = '1';
|
|
81
|
+
userConfig['CORTEX_NVIDIA_ONLY'] = '1';
|
|
82
|
+
if (userConfig['NVIDIA_API_KEY'] && !userConfig['OPENAI_API_KEY']) {
|
|
83
|
+
userConfig['OPENAI_API_KEY'] = userConfig['NVIDIA_API_KEY'];
|
|
84
|
+
}
|
|
85
|
+
if (userConfig['NVIDIA_BASE_URL'] && !userConfig['OPENAI_BASE_URL']) {
|
|
86
|
+
userConfig['OPENAI_BASE_URL'] = userConfig['NVIDIA_BASE_URL'];
|
|
87
|
+
} else if (!userConfig['OPENAI_BASE_URL']) {
|
|
88
|
+
userConfig['OPENAI_BASE_URL'] = 'https://integrate.api.nvidia.com/v1';
|
|
89
|
+
}
|
|
90
|
+
} else if (provider === 'openai' || userConfig['OPENAI_API_KEY']) {
|
|
91
|
+
userConfig['CORTEX_USE_OPENAI'] = '1';
|
|
92
|
+
} else if (provider === 'gemini' || userConfig['GEMINI_API_KEY']) {
|
|
93
|
+
userConfig['CORTEX_USE_GEMINI'] = '1';
|
|
94
|
+
} else if (provider === 'groq' || userConfig['GROQ_API_KEY']) {
|
|
95
|
+
userConfig['CORTEX_USE_OPENAI'] = '1';
|
|
96
|
+
if (userConfig['GROQ_API_KEY'] && !userConfig['OPENAI_API_KEY']) {
|
|
97
|
+
userConfig['OPENAI_API_KEY'] = userConfig['GROQ_API_KEY'];
|
|
98
|
+
}
|
|
99
|
+
if (!userConfig['OPENAI_BASE_URL']) {
|
|
100
|
+
userConfig['OPENAI_BASE_URL'] = 'https://api.groq.com/openai/v1';
|
|
101
|
+
}
|
|
102
|
+
} else if (provider === 'openrouter') {
|
|
103
|
+
userConfig['CORTEX_USE_OPENAI'] = '1';
|
|
104
|
+
} else if (provider === 'ollama') {
|
|
105
|
+
userConfig['CORTEX_USE_OPENAI'] = '1';
|
|
106
|
+
if (!userConfig['OPENAI_API_KEY']) userConfig['OPENAI_API_KEY'] = 'ollama';
|
|
107
|
+
if (!userConfig['OPENAI_BASE_URL']) userConfig['OPENAI_BASE_URL'] = 'http://localhost:11434/v1';
|
|
108
|
+
} else if (userConfig['HF_TOKEN']) {
|
|
109
|
+
// HuggingFace is auto-detected by providers.ts via HF_TOKEN
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
var mergedEnv = Object.assign({}, process.env, userConfig, extraEnv || {});
|
|
114
|
+
|
|
73
115
|
var proc = spawn('node', [CLI_PATH].concat(args), {
|
|
74
116
|
stdio: 'inherit',
|
|
75
117
|
cwd: ROOT,
|
package/dist/cli.mjs
CHANGED
|
@@ -103698,7 +103698,7 @@ function getAPIProvider() {
|
|
|
103698
103698
|
return isEnvTruthy(process.env.CORTEX_USE_GEMINI) ? "gemini" : isEnvTruthy(process.env.CORTEX_USE_GITHUB) ? "github" : isEnvTruthy(process.env.CORTEX_USE_OPENAI) ? isCodexModel() ? "codex" : "openai" : isEnvTruthy(process.env.CORTEX_USE_BEDROCK) ? "bedrock" : isEnvTruthy(process.env.CORTEX_USE_VERTEX) ? "vertex" : isEnvTruthy(process.env.CORTEX_USE_FOUNDRY) ? "foundry" : process.env.HF_TOKEN ? "huggingface" : "firstParty";
|
|
103699
103699
|
}
|
|
103700
103700
|
function usesCORTEXAccountFlow() {
|
|
103701
|
-
return
|
|
103701
|
+
return false;
|
|
103702
103702
|
}
|
|
103703
103703
|
function isCodexModel() {
|
|
103704
103704
|
const model = (process.env.OPENAI_MODEL || "").trim();
|
|
@@ -367814,7 +367814,7 @@ function getCORTEXEnvMetadata() {
|
|
|
367814
367814
|
function getBuildAgeMinutes() {
|
|
367815
367815
|
if (false)
|
|
367816
367816
|
;
|
|
367817
|
-
const buildTime = new Date("2026-05-07T10:
|
|
367817
|
+
const buildTime = new Date("2026-05-07T10:53:02.411Z").getTime();
|
|
367818
367818
|
if (isNaN(buildTime))
|
|
367819
367819
|
return;
|
|
367820
367820
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -394605,7 +394605,7 @@ function buildPrimarySection() {
|
|
|
394605
394605
|
}, undefined, false, undefined, this);
|
|
394606
394606
|
return [{
|
|
394607
394607
|
label: "Version",
|
|
394608
|
-
value: "0.1.
|
|
394608
|
+
value: "0.1.12"
|
|
394609
394609
|
}, {
|
|
394610
394610
|
label: "Session name",
|
|
394611
394611
|
value: nameValue
|
|
@@ -460184,7 +460184,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
460184
460184
|
var call60 = async () => {
|
|
460185
460185
|
return {
|
|
460186
460186
|
type: "text",
|
|
460187
|
-
value: `${"99.0.0"} (built ${"2026-05-07T10:
|
|
460187
|
+
value: `${"99.0.0"} (built ${"2026-05-07T10:53:02.411Z"})`
|
|
460188
460188
|
};
|
|
460189
460189
|
}, version2, version_default;
|
|
460190
460190
|
var init_version = __esm(() => {
|
|
@@ -534314,7 +534314,7 @@ function WelcomeV2() {
|
|
|
534314
534314
|
dimColor: true,
|
|
534315
534315
|
children: [
|
|
534316
534316
|
"v",
|
|
534317
|
-
"0.1.
|
|
534317
|
+
"0.1.12",
|
|
534318
534318
|
" "
|
|
534319
534319
|
]
|
|
534320
534320
|
}, undefined, true, undefined, this)
|
|
@@ -534514,7 +534514,7 @@ function WelcomeV2() {
|
|
|
534514
534514
|
dimColor: true,
|
|
534515
534515
|
children: [
|
|
534516
534516
|
"v",
|
|
534517
|
-
"0.1.
|
|
534517
|
+
"0.1.12",
|
|
534518
534518
|
" "
|
|
534519
534519
|
]
|
|
534520
534520
|
}, undefined, true, undefined, this)
|
|
@@ -534740,7 +534740,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
534740
534740
|
dimColor: true,
|
|
534741
534741
|
children: [
|
|
534742
534742
|
"v",
|
|
534743
|
-
"0.1.
|
|
534743
|
+
"0.1.12",
|
|
534744
534744
|
" "
|
|
534745
534745
|
]
|
|
534746
534746
|
}, undefined, true, undefined, this);
|
|
@@ -534994,7 +534994,7 @@ function AppleTerminalWelcomeV2(t0) {
|
|
|
534994
534994
|
dimColor: true,
|
|
534995
534995
|
children: [
|
|
534996
534996
|
"v",
|
|
534997
|
-
"0.1.
|
|
534997
|
+
"0.1.12",
|
|
534998
534998
|
" "
|
|
534999
534999
|
]
|
|
535000
535000
|
}, undefined, true, undefined, this);
|
|
@@ -554875,7 +554875,7 @@ Usage: cortex --remote "your task description"`, () => gracefulShutdown(1));
|
|
|
554875
554875
|
pendingHookMessages
|
|
554876
554876
|
}, renderAndRun);
|
|
554877
554877
|
}
|
|
554878
|
-
}).version("0.1.
|
|
554878
|
+
}).version("0.1.12 (CORTEX)", "-v, --version", "Output the version number");
|
|
554879
554879
|
program2.option("-w, --worktree [name]", "Create a new git worktree for this session (optionally specify a name)");
|
|
554880
554880
|
program2.option("--tmux", "Create a tmux session for the worktree (requires --worktree). Uses iTerm2 native panes when available; use --tmux=classic for traditional tmux.");
|
|
554881
554881
|
if (canUserConfigureAdvisor()) {
|
|
@@ -555433,13 +555433,6 @@ async function getProviderValidationError(env2 = process.env, options) {
|
|
|
555433
555433
|
}
|
|
555434
555434
|
return null;
|
|
555435
555435
|
}
|
|
555436
|
-
async function validateProviderEnvOrExit(env2 = process.env) {
|
|
555437
|
-
const error = await getProviderValidationError(env2);
|
|
555438
|
-
if (error) {
|
|
555439
|
-
console.error(error);
|
|
555440
|
-
process.exit(1);
|
|
555441
|
-
}
|
|
555442
|
-
}
|
|
555443
555436
|
|
|
555444
555437
|
// src/entrypoints/cli.tsx
|
|
555445
555438
|
try {
|
|
@@ -555470,7 +555463,7 @@ if (false) {}
|
|
|
555470
555463
|
async function main2() {
|
|
555471
555464
|
const args = process.argv.slice(2);
|
|
555472
555465
|
if (args.length === 1 && (args[0] === "--version" || args[0] === "-v" || args[0] === "-V")) {
|
|
555473
|
-
const v = typeof MACRO !== "undefined" ? "0.1.
|
|
555466
|
+
const v = typeof MACRO !== "undefined" ? "0.1.12" : "99.0.0-dev";
|
|
555474
555467
|
console.log(`${v} (CORTEX)`);
|
|
555475
555468
|
return;
|
|
555476
555469
|
}
|
|
@@ -555503,7 +555496,6 @@ async function main2() {
|
|
|
555503
555496
|
applyProfileEnvToProcessEnv(process.env, startupEnv);
|
|
555504
555497
|
}
|
|
555505
555498
|
}
|
|
555506
|
-
await validateProviderEnvOrExit();
|
|
555507
555499
|
const { printStartupScreen: printStartupScreen2 } = await Promise.resolve().then(() => (init_StartupScreen(), exports_StartupScreen));
|
|
555508
555500
|
await printStartupScreen2();
|
|
555509
555501
|
if (process.env.CORTEX_NO_SHARE !== "1") {
|
|
@@ -555655,4 +555647,4 @@ ${DIM4} session id:${RESET4} ${BOLD2}${handle.sessionId}${RESET4} ${DIM4}(rotat
|
|
|
555655
555647
|
}
|
|
555656
555648
|
main2();
|
|
555657
555649
|
|
|
555658
|
-
//# debugId=
|
|
555650
|
+
//# debugId=B294DE5C79990FEB64756E2164756E21
|
package/package.json
CHANGED