blyuecode 0.1.6 → 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 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/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, { kind: 'user', text: trimmed }]);
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, { kind: isTool ? 'tool' : 'ai', text: chunk }]);
57
+ setHistory((h) => [...h, mkItem(isTool ? 'tool' : 'ai', chunk)]);
38
58
  }
39
59
  }
40
60
  catch (e) {
41
- setHistory((h) => [...h, { kind: 'error', text: e?.message || String(e) }]);
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, { kind: 'tool', text: `model → ${id}` }]);
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.map((item, i) => {
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
  };
@@ -6,7 +6,8 @@ const FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '
6
6
  export const Spinner = ({ label = 'Thinking' }) => {
7
7
  const [i, setI] = useState(0);
8
8
  useEffect(() => {
9
- const t = setInterval(() => setI((v) => (v + 1) % FRAMES.length), 90);
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"] })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blyuecode",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "BLYUE Code — a coding agent by Lumen",
5
5
  "type": "module",
6
6
  "license": "MIT",