blyuecode 0.1.5 → 0.1.7
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 +6 -1
- package/dist/ui/Banner.js +10 -11
- package/dist/ui/Chat.js +28 -20
- package/dist/ui/Spinner.js +2 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -17,4 +17,9 @@ const App = () => {
|
|
|
17
17
|
}, []);
|
|
18
18
|
return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Static, { items: ['banner'], children: () => _jsx(Banner, {}) }), ready ? _jsx(Chat, {}) : _jsx(Setup, { onDone: () => setReady(true) })] }));
|
|
19
19
|
};
|
|
20
|
-
render(_jsx(App, {})
|
|
20
|
+
render(_jsx(App, {}), {
|
|
21
|
+
// Prevent console.log interference from npm/openai warnings
|
|
22
|
+
patchConsole: false,
|
|
23
|
+
// Only redraw when Ink state actually changes
|
|
24
|
+
exitOnCtrlC: true,
|
|
25
|
+
});
|
package/dist/ui/Banner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect } from 'react';
|
|
3
3
|
import { Box, Text, useStdout } from 'ink';
|
|
4
4
|
import { readFileSync } from 'fs';
|
|
@@ -6,7 +6,6 @@ import { fileURLToPath } from 'url';
|
|
|
6
6
|
import { dirname, join } from 'path';
|
|
7
7
|
import os from 'os';
|
|
8
8
|
import { hueAt } from './animColor.js';
|
|
9
|
-
import { MakerMark } from './MakerMark.js';
|
|
10
9
|
function getVersion() {
|
|
11
10
|
try {
|
|
12
11
|
const here = dirname(fileURLToPath(import.meta.url));
|
|
@@ -17,7 +16,6 @@ function getVersion() {
|
|
|
17
16
|
return '0.0.0';
|
|
18
17
|
}
|
|
19
18
|
}
|
|
20
|
-
// Static mode = no animation. Animated mode = hue cycling.
|
|
21
19
|
function shouldAnimate() {
|
|
22
20
|
if (process.env.BLYUE_ANIMATE === '1')
|
|
23
21
|
return true;
|
|
@@ -27,7 +25,6 @@ function shouldAnimate() {
|
|
|
27
25
|
const gb = os.totalmem() / 1024 / 1024 / 1024;
|
|
28
26
|
const cores = os.cpus().length;
|
|
29
27
|
const mhz = os.cpus()[0]?.speed || 0;
|
|
30
|
-
// Atom = ~1.6 GHz, 4GB → static
|
|
31
28
|
if (gb < 8)
|
|
32
29
|
return false;
|
|
33
30
|
if (cores < 4)
|
|
@@ -38,9 +35,6 @@ function shouldAnimate() {
|
|
|
38
35
|
catch { }
|
|
39
36
|
return true;
|
|
40
37
|
}
|
|
41
|
-
// ─────────────────────────────────────────────
|
|
42
|
-
// BLYUE — 44 cols wide (all lines same length)
|
|
43
|
-
// ─────────────────────────────────────────────
|
|
44
38
|
const BLYUE_BIG = [
|
|
45
39
|
'██████╗ ██╗ ██╗ ██╗ ██╗ ██╗ ███████╗',
|
|
46
40
|
'██╔══██╗██║ ╚██╗ ██╔╝ ██║ ██║ ██╔════╝',
|
|
@@ -55,9 +49,6 @@ const BLYUE_SMALL = [
|
|
|
55
49
|
'| _ \\| |__| |_| | |_| | _| ',
|
|
56
50
|
'|___/|____|\\___/ \\___/|___|',
|
|
57
51
|
];
|
|
58
|
-
// ─────────────────────────────────────────────
|
|
59
|
-
// CODE — 33 cols wide, indented 6 spaces to center under 44-wide BLYUE
|
|
60
|
-
// ─────────────────────────────────────────────
|
|
61
52
|
const CODE_BIG = [
|
|
62
53
|
' ██████╗ ██████╗ ██████╗ ███████╗',
|
|
63
54
|
' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
|
|
@@ -70,12 +61,18 @@ const CODE_SMALL = [
|
|
|
70
61
|
' █▀▀ █▀█ █▀▄ █▀▀',
|
|
71
62
|
' █▄▄ █▄█ █▄▀ ██▄',
|
|
72
63
|
];
|
|
64
|
+
const BLYUE_WIDTH = 44;
|
|
65
|
+
const BLYUE_SMALL_WIDTH = 27;
|
|
73
66
|
export const Banner = () => {
|
|
74
67
|
const { stdout } = useStdout();
|
|
75
68
|
const width = stdout?.columns ?? 80;
|
|
76
69
|
const wide = width >= 60;
|
|
77
70
|
const blyue = wide ? BLYUE_BIG : BLYUE_SMALL;
|
|
78
71
|
const code = wide ? CODE_BIG : CODE_SMALL;
|
|
72
|
+
const blockWidth = wide ? BLYUE_WIDTH : BLYUE_SMALL_WIDTH;
|
|
73
|
+
// Left padding to center whole block in terminal
|
|
74
|
+
const leftPad = Math.max(0, Math.floor((width - blockWidth) / 2));
|
|
75
|
+
const pad = ' '.repeat(leftPad);
|
|
79
76
|
const [animate] = useState(() => shouldAnimate());
|
|
80
77
|
const [t, setT] = useState(0);
|
|
81
78
|
useEffect(() => {
|
|
@@ -87,5 +84,7 @@ export const Banner = () => {
|
|
|
87
84
|
const baseHue = animate ? t : 0.1;
|
|
88
85
|
const brand = hueAt(baseHue);
|
|
89
86
|
const version = getVersion();
|
|
90
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(
|
|
87
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { children: [pad, _jsx(MakerMarkInline, { color: brand })] }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06) % 1), bold: true, children: pad + line }, 'b' + i))), code.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06 + 0.35) % 1), bold: true, children: pad + line }, 'c' + i))), _jsx(Text, { children: " " }), _jsxs(Text, { children: [pad, _jsx(Text, { color: "gray", children: 'a coding agent · v' + version })] }), _jsx(Text, { children: " " })] }));
|
|
91
88
|
};
|
|
89
|
+
// Inline version of MakerMark so it aligns inside the padded Text
|
|
90
|
+
const MakerMarkInline = ({ color }) => (_jsxs(_Fragment, { children: [_jsx(Text, { color: color, bold: true, children: "\u25C6 " }), _jsx(Text, { color: color, bold: true, children: "L U M E N" })] }));
|
package/dist/ui/Chat.js
CHANGED
|
@@ -1,10 +1,31 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from 'react';
|
|
3
|
-
import { Box, Text, useInput, useStdout } from 'ink';
|
|
3
|
+
import { Box, Text, useInput, useStdout, Static } from 'ink';
|
|
4
4
|
import { Agent } from '../core/agent.js';
|
|
5
5
|
import { InputBar } from './InputBar.js';
|
|
6
6
|
import { ModelPicker } from './ModelPicker.js';
|
|
7
7
|
import { theme } from './theme.js';
|
|
8
|
+
let nextId = 0;
|
|
9
|
+
const mkItem = (kind, text) => ({
|
|
10
|
+
kind,
|
|
11
|
+
text,
|
|
12
|
+
id: nextId++,
|
|
13
|
+
});
|
|
14
|
+
// ─────────────────────────────────────────────
|
|
15
|
+
// One history line — rendered ONCE via <Static>
|
|
16
|
+
// ─────────────────────────────────────────────
|
|
17
|
+
const HistoryLine = ({ item }) => {
|
|
18
|
+
if (item.kind === 'user') {
|
|
19
|
+
return (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: theme.accent, bold: true, children: '❯ ' }), _jsx(Text, { color: theme.text, bold: true, children: item.text })] }));
|
|
20
|
+
}
|
|
21
|
+
if (item.kind === 'error') {
|
|
22
|
+
return (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: theme.error, children: '❯ ' }), _jsx(Text, { color: theme.error, children: item.text })] }));
|
|
23
|
+
}
|
|
24
|
+
if (item.kind === 'tool') {
|
|
25
|
+
return _jsx(Text, { color: theme.muted, children: item.text.trim() });
|
|
26
|
+
}
|
|
27
|
+
return (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.text, children: item.text }) }));
|
|
28
|
+
};
|
|
8
29
|
export const Chat = () => {
|
|
9
30
|
const { stdout } = useStdout();
|
|
10
31
|
const width = stdout?.columns ?? 80;
|
|
@@ -15,9 +36,8 @@ export const Chat = () => {
|
|
|
15
36
|
const [currentModel, setCurrentModel] = useState(process.env.MODEL || '');
|
|
16
37
|
const [agent, setAgent] = useState(() => new Agent());
|
|
17
38
|
useInput((inputChar, key) => {
|
|
18
|
-
if (key.ctrl && inputChar === 'p')
|
|
39
|
+
if (key.ctrl && inputChar === 'p')
|
|
19
40
|
setModelPickerOpen(true);
|
|
20
|
-
}
|
|
21
41
|
});
|
|
22
42
|
const handleSubmit = async (text) => {
|
|
23
43
|
if (!text.trim() || loading)
|
|
@@ -29,16 +49,16 @@ export const Chat = () => {
|
|
|
29
49
|
return;
|
|
30
50
|
}
|
|
31
51
|
setInput('');
|
|
32
|
-
setHistory((h) => [...h,
|
|
52
|
+
setHistory((h) => [...h, mkItem('user', trimmed)]);
|
|
33
53
|
setLoading(true);
|
|
34
54
|
try {
|
|
35
55
|
for await (const chunk of agent.run(trimmed)) {
|
|
36
56
|
const isTool = chunk.startsWith('\n[Calling') || chunk.startsWith('[Result]');
|
|
37
|
-
setHistory((h) => [...h,
|
|
57
|
+
setHistory((h) => [...h, mkItem(isTool ? 'tool' : 'ai', chunk)]);
|
|
38
58
|
}
|
|
39
59
|
}
|
|
40
60
|
catch (e) {
|
|
41
|
-
setHistory((h) => [...h,
|
|
61
|
+
setHistory((h) => [...h, mkItem('error', e?.message || String(e))]);
|
|
42
62
|
}
|
|
43
63
|
setLoading(false);
|
|
44
64
|
};
|
|
@@ -47,26 +67,14 @@ export const Chat = () => {
|
|
|
47
67
|
setCurrentModel(id);
|
|
48
68
|
setModelPickerOpen(false);
|
|
49
69
|
setAgent(new Agent());
|
|
50
|
-
setHistory((h) => [...h,
|
|
70
|
+
setHistory((h) => [...h, mkItem('tool', `model → ${id}`)]);
|
|
51
71
|
};
|
|
52
72
|
if (modelPickerOpen) {
|
|
53
73
|
return (_jsx(Box, { flexDirection: "column", children: _jsx(ModelPicker, { current: currentModel, onSelect: handleModelSelect, onCancel: () => setModelPickerOpen(false) }) }));
|
|
54
74
|
}
|
|
55
|
-
// Aggressive truncation so footer fits on one line
|
|
56
75
|
const maxModelLen = Math.max(10, width - 14);
|
|
57
76
|
const shortModel = currentModel.length > maxModelLen
|
|
58
77
|
? '…' + currentModel.slice(-(maxModelLen - 1))
|
|
59
78
|
: currentModel || 'unset';
|
|
60
|
-
return (_jsxs(Box, { flexDirection: "column", children: [history
|
|
61
|
-
if (item.kind === 'user') {
|
|
62
|
-
return (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: theme.accent, bold: true, children: '❯ ' }), _jsx(Text, { color: theme.text, bold: true, children: item.text })] }, i));
|
|
63
|
-
}
|
|
64
|
-
if (item.kind === 'error') {
|
|
65
|
-
return (_jsxs(Box, { marginTop: 1, children: [_jsx(Text, { color: theme.error, children: '❯ ' }), _jsx(Text, { color: theme.error, children: item.text })] }, i));
|
|
66
|
-
}
|
|
67
|
-
if (item.kind === 'tool') {
|
|
68
|
-
return _jsx(Text, { color: theme.muted, children: item.text.trim() }, i);
|
|
69
|
-
}
|
|
70
|
-
return (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: theme.text, children: item.text }) }, i));
|
|
71
|
-
}), _jsx(Box, { marginTop: 1, children: _jsx(InputBar, { value: input, onChange: setInput, onSubmit: handleSubmit, loading: loading }) }), _jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: " /model" }), _jsxs(Text, { color: theme.muted, children: [" ", shortModel] })] })] }));
|
|
79
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: history, children: (item) => _jsx(HistoryLine, { item: item }, item.id) }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(InputBar, { value: input, onChange: setInput, onSubmit: handleSubmit, loading: loading }), _jsxs(Text, { children: [_jsx(Text, { color: theme.accent, children: " /model" }), _jsxs(Text, { color: theme.muted, children: [" ", shortModel] })] })] })] }));
|
|
72
80
|
};
|
package/dist/ui/Spinner.js
CHANGED
|
@@ -6,7 +6,8 @@ const FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '
|
|
|
6
6
|
export const Spinner = ({ label = 'Thinking' }) => {
|
|
7
7
|
const [i, setI] = useState(0);
|
|
8
8
|
useEffect(() => {
|
|
9
|
-
|
|
9
|
+
// 200ms instead of 90ms → 5 fps not 11 fps
|
|
10
|
+
const t = setInterval(() => setI((v) => (v + 1) % FRAMES.length), 200);
|
|
10
11
|
return () => clearInterval(t);
|
|
11
12
|
}, []);
|
|
12
13
|
return (_jsxs(Text, { children: [_jsx(Text, { color: theme.accent, bold: true, children: '❯ ' }), _jsxs(Text, { color: theme.muted, children: [FRAMES[i], " ", label, "\u2026"] })] }));
|