lumina-code-agent 1.4.0 → 1.5.0
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/index.js +24 -29
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @ts-nocheck
|
|
3
|
+
// Check if we have a proper TTY for the TUI
|
|
4
|
+
const hasTTY = process.stdin.isTTY && process.stdout.isTTY;
|
|
5
|
+
if (!hasTTY) {
|
|
6
|
+
// Non-TUI mode: just show help
|
|
7
|
+
console.log('');
|
|
8
|
+
console.log(' ⚡ LUMINA CODE — AI Coding Agent');
|
|
9
|
+
console.log('');
|
|
10
|
+
console.log(' Lumina Code requires a proper terminal (TTY) to run.');
|
|
11
|
+
console.log(' Please open one of these and type: lumina');
|
|
12
|
+
console.log('');
|
|
13
|
+
console.log(' • Windows Terminal (recommended)');
|
|
14
|
+
console.log(' • PowerShell');
|
|
15
|
+
console.log(' • Command Prompt (cmd.exe)');
|
|
16
|
+
console.log(' • iTerm2 / Terminal.app (macOS)');
|
|
17
|
+
console.log(' • Any Linux terminal');
|
|
18
|
+
console.log('');
|
|
19
|
+
console.log(' If you\'re in Git Bash, try running from Windows Terminal instead.');
|
|
20
|
+
console.log('');
|
|
21
|
+
process.exit(0);
|
|
22
|
+
}
|
|
3
23
|
import React, { useState, useCallback, useRef } from 'react';
|
|
4
24
|
import { Box, Text, useInput, useApp, Spacer } from 'ink';
|
|
5
25
|
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync } from 'fs';
|
|
@@ -22,27 +42,12 @@ function saveConfig(config) {
|
|
|
22
42
|
mkdirSync(CONFIG_DIR, { recursive: true });
|
|
23
43
|
writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
24
44
|
}
|
|
25
|
-
// ── Simple Text Input Component ─────────────────────────────────────
|
|
26
|
-
function PromptInput({ value, onChange, onSubmit, placeholder }) {
|
|
27
|
-
useInput((input, key) => {
|
|
28
|
-
if (key.return && onSubmit) {
|
|
29
|
-
onSubmit(value);
|
|
30
|
-
}
|
|
31
|
-
else if (key.backspace || key.delete) {
|
|
32
|
-
onChange(value.slice(0, -1));
|
|
33
|
-
}
|
|
34
|
-
else if (!key.ctrl && !key.meta && input) {
|
|
35
|
-
onChange(value + input);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return React.createElement(Box, null, React.createElement(Text, { color: '#7C5CFC' }, ' > '), React.createElement(Text, { color: '#FAFAFA' }, value || placeholder || 'Type something...'), React.createElement(Text, { color: '#52525B' }, '▌'));
|
|
39
|
-
}
|
|
40
45
|
// ── Onboarding Screen ───────────────────────────────────────────────
|
|
41
46
|
function Onboarding({ onComplete }) {
|
|
42
47
|
const [step, setStep] = useState(0);
|
|
43
48
|
const [apiKey, setApiKey] = useState('');
|
|
44
49
|
const [name, setName] = useState('');
|
|
45
|
-
|
|
50
|
+
useInput((input, key) => {
|
|
46
51
|
if (key.return) {
|
|
47
52
|
if (step === 0) {
|
|
48
53
|
setStep(1);
|
|
@@ -67,8 +72,7 @@ function Onboarding({ onComplete }) {
|
|
|
67
72
|
if (step === 2)
|
|
68
73
|
setName(v => v + input);
|
|
69
74
|
}
|
|
70
|
-
}
|
|
71
|
-
useInput(handleKey);
|
|
75
|
+
});
|
|
72
76
|
return React.createElement(Box, { flexDirection: 'column', padding: 2 }, React.createElement(Box, { flexDirection: 'column', marginBottom: 2 }, React.createElement(Text, { bold: true, color: '#7C5CFC' }, ' ⚡ LUMINA CODE'), React.createElement(Text, { color: '#52525B' }, ' AI Coding Agent')), step === 0 && React.createElement(Box, { flexDirection: 'column' }, React.createElement(Text, { color: '#A1A1AA' }, ' Welcome! Let\'s get you set up.'), React.createElement(Text, { color: '#52525B' }, ' Press Enter to continue...')), step === 1 && React.createElement(Box, { flexDirection: 'column' }, React.createElement(Text, { color: '#A1A1AA' }, ' Enter your OpenRouter API key:'), React.createElement(Text, { color: '#52525B' }, ' (Get one at https://openrouter.ai/keys)'), React.createElement(Box, { marginTop: 1 }, React.createElement(Text, { color: '#7C5CFC' }, ' > '), React.createElement(Text, { color: '#FAFAFA' }, apiKey || 'sk-or-...'), React.createElement(Text, { color: '#52525B' }, '▌')), React.createElement(Text, { color: '#3F3F46', marginTop: 1 }, ' Press Enter to continue')), step === 2 && React.createElement(Box, { flexDirection: 'column' }, React.createElement(Text, { color: '#A1A1AA' }, ' What should I call you? (optional)'), React.createElement(Box, { marginTop: 1 }, React.createElement(Text, { color: '#7C5CFC' }, ' > '), React.createElement(Text, { color: '#FAFAFA' }, name || 'Your name'), React.createElement(Text, { color: '#52525B' }, '▌')), React.createElement(Text, { color: '#3F3F46', marginTop: 1 }, ' Press Enter to start coding!')));
|
|
73
77
|
}
|
|
74
78
|
// ── Chat Screen ─────────────────────────────────────────────────────
|
|
@@ -173,7 +177,6 @@ Working directory: ${process.cwd()}` }, ...currentMessages],
|
|
|
173
177
|
setStatus('Done');
|
|
174
178
|
break;
|
|
175
179
|
}
|
|
176
|
-
// Execute tools
|
|
177
180
|
for (const tc of toolCalls) {
|
|
178
181
|
const args = JSON.parse(tc.function.arguments || '{}');
|
|
179
182
|
const toolName = tc.function.name;
|
|
@@ -292,11 +295,7 @@ Working directory: ${process.cwd()}` }, ...currentMessages],
|
|
|
292
295
|
setInput(v => v + input);
|
|
293
296
|
}
|
|
294
297
|
});
|
|
295
|
-
return React.createElement(Box, { flexDirection: 'column', height: '100%' },
|
|
296
|
-
// Header
|
|
297
|
-
React.createElement(Box, { borderStyle: 'round', borderColor: '#7C5CFC', paddingX: 2, paddingY: 1 }, React.createElement(Text, { bold: true, color: '#7C5CFC' }, ' ⚡ LUMINA CODE'), React.createElement(Spacer, null), React.createElement(Text, { color: '#52525B' }, thinking ? ' ⏳ ' + status : ' ● ' + status)),
|
|
298
|
-
// Messages
|
|
299
|
-
React.createElement(Box, { flexDirection: 'column', flexGrow: 1, paddingX: 2, paddingY: 1, overflowY: 'hidden' }, visibleMessages.map((m, i) => {
|
|
298
|
+
return React.createElement(Box, { flexDirection: 'column', height: '100%' }, React.createElement(Box, { borderStyle: 'round', borderColor: '#7C5CFC', paddingX: 2, paddingY: 1 }, React.createElement(Text, { bold: true, color: '#7C5CFC' }, ' ⚡ LUMINA CODE'), React.createElement(Spacer, null), React.createElement(Text, { color: '#52525B' }, thinking ? ' ⏳ ' + status : ' ● ' + status)), React.createElement(Box, { flexDirection: 'column', flexGrow: 1, paddingX: 2, paddingY: 1, overflowY: 'hidden' }, visibleMessages.map((m, i) => {
|
|
300
299
|
if (m.role === 'user') {
|
|
301
300
|
return React.createElement(Box, { key: i, marginTop: 1 }, React.createElement(Text, { color: '#7C5CFC', bold: true }, '> '), React.createElement(Text, { color: '#FAFAFA' }, m.content));
|
|
302
301
|
}
|
|
@@ -304,11 +303,7 @@ Working directory: ${process.cwd()}` }, ...currentMessages],
|
|
|
304
303
|
return React.createElement(Box, { key: i, marginTop: 0, paddingLeft: 2 }, React.createElement(Text, { color: '#52525B' }, ' ' + m.content.slice(0, 200)));
|
|
305
304
|
}
|
|
306
305
|
return React.createElement(Box, { key: i, marginTop: 1, paddingLeft: 2 }, React.createElement(Text, { color: '#A1A1AA' }, m.content.slice(0, 500)));
|
|
307
|
-
}), thinking && React.createElement(Text, { color: '#F59E0B' }, ' ⏳ thinking...')),
|
|
308
|
-
// Input
|
|
309
|
-
React.createElement(Box, { borderStyle: 'single', borderColor: '#3F3F46', paddingX: 1 }, React.createElement(Text, { color: '#7C5CFC' }, ' > '), React.createElement(Text, { color: '#FAFAFA' }, input || 'What do you want to build?'), React.createElement(Text, { color: '#52525B' }, '▌')),
|
|
310
|
-
// Footer
|
|
311
|
-
React.createElement(Box, { paddingX: 2 }, React.createElement(Text, { color: '#3F3F46' }, ' Ctrl+C to exit | OWL-Alpha ')));
|
|
306
|
+
}), thinking && React.createElement(Text, { color: '#F59E0B' }, ' ⏳ thinking...')), React.createElement(Box, { borderStyle: 'single', borderColor: '#3F3F46', paddingX: 1 }, React.createElement(Text, { color: '#7C5CFC' }, ' > '), React.createElement(Text, { color: '#FAFAFA' }, input || 'What do you want to build?'), React.createElement(Text, { color: '#52525B' }, '▌')), React.createElement(Box, { paddingX: 2 }, React.createElement(Text, { color: '#3F3F46' }, ' Ctrl+C to exit | OWL-Alpha ')));
|
|
312
307
|
}
|
|
313
308
|
// ── Main App ────────────────────────────────────────────────────────
|
|
314
309
|
export default function App() {
|