blyuecode 0.1.3 → 0.1.4

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
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { useState, useEffect } from 'react';
4
- import { render, Box } from 'ink';
4
+ import { render, Box, Static } from 'ink';
5
5
  import { Setup } from './ui/Setup.js';
6
6
  import { Chat } from './ui/Chat.js';
7
7
  import { Banner } from './ui/Banner.js';
@@ -15,6 +15,6 @@ const App = () => {
15
15
  setReady(true);
16
16
  }
17
17
  }, []);
18
- return (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Banner, {}), ready ? _jsx(Chat, {}) : _jsx(Setup, { onDone: () => setReady(true) })] }));
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
20
  render(_jsx(App, {}));
package/dist/ui/Banner.js CHANGED
@@ -4,6 +4,7 @@ import { Box, Text, useStdout } from 'ink';
4
4
  import { readFileSync } from 'fs';
5
5
  import { fileURLToPath } from 'url';
6
6
  import { dirname, join } from 'path';
7
+ import os from 'os';
7
8
  import { hueAt } from './animColor.js';
8
9
  import { MakerMark } from './MakerMark.js';
9
10
  function getVersion() {
@@ -16,9 +17,25 @@ function getVersion() {
16
17
  return '0.0.0';
17
18
  }
18
19
  }
19
- // ─────────────────────────────────────────────
20
- // BLYUE — 44 cols wide
21
- // ─────────────────────────────────────────────
20
+ // Detect low-spec hardware — disable animation entirely
21
+ function isLowSpec() {
22
+ if (process.env.BLYUE_STATIC === '1')
23
+ return true;
24
+ if (process.env.BLYUE_SLOW === '1')
25
+ return true;
26
+ try {
27
+ // total RAM in GB
28
+ const gb = os.totalmem() / 1024 / 1024 / 1024;
29
+ if (gb < 6)
30
+ return true;
31
+ // CPU cores — Atom usually has 2-4
32
+ const cores = os.cpus().length;
33
+ if (cores <= 4 && gb < 8)
34
+ return true;
35
+ }
36
+ catch { }
37
+ return false;
38
+ }
22
39
  const BLYUE_BIG = [
23
40
  '██████╗ ██╗ ██╗ ██╗ ██╗ ██╗ ███████╗',
24
41
  '██╔══██╗██║ ╚██╗ ██╔╝ ██║ ██║ ██╔════╝',
@@ -33,9 +50,6 @@ const BLYUE_SMALL = [
33
50
  '| _ \\| |__| |_| | |_| | _| ',
34
51
  '|___/|____|\\___/ \\___/|___|',
35
52
  ];
36
- // ─────────────────────────────────────────────
37
- // CODE — 33 cols wide, centered with 5-space lead
38
- // ─────────────────────────────────────────────
39
53
  const CODE_BIG = [
40
54
  ' ██████╗ ██████╗ ██████╗ ███████╗',
41
55
  ' ██╔════╝██╔═══██╗██╔══██╗██╔════╝',
@@ -48,31 +62,25 @@ const CODE_SMALL = [
48
62
  ' █▀▀ █▀█ █▀▄ █▀▀',
49
63
  ' █▄▄ █▄█ █▄▀ ██▄',
50
64
  ];
51
- export const Banner = ({ freezeAfter = 3000 }) => {
65
+ export const Banner = () => {
52
66
  const { stdout } = useStdout();
53
67
  const width = stdout?.columns ?? 80;
54
68
  const wide = width >= 60;
55
69
  const blyue = wide ? BLYUE_BIG : BLYUE_SMALL;
56
70
  const code = wide ? CODE_BIG : CODE_SMALL;
71
+ const [staticMode] = useState(() => isLowSpec());
57
72
  const [t, setT] = useState(0);
58
- const [frozen, setFrozen] = useState(freezeAfter <= 0);
59
- // Animation tick — 100ms = 10fps, no flicker
60
73
  useEffect(() => {
61
- if (frozen)
62
- return;
74
+ if (staticMode)
75
+ return; // no animation on low-spec
63
76
  const interval = setInterval(() => {
64
- setT((v) => (v + 1 / 320) % 1); // half-speed gradient
77
+ setT((v) => (v + 1 / 320) % 1);
65
78
  }, 100);
66
79
  return () => clearInterval(interval);
67
- }, [frozen]);
68
- // Freeze after N ms so it never redraws during typing
69
- useEffect(() => {
70
- if (freezeAfter <= 0)
71
- return;
72
- const timer = setTimeout(() => setFrozen(true), freezeAfter);
73
- return () => clearTimeout(timer);
74
- }, [freezeAfter]);
75
- const brand = hueAt(t);
80
+ }, [staticMode]);
81
+ // In static mode, use a fixed pleasant hue
82
+ const baseHue = staticMode ? 0.15 : t;
83
+ const brand = hueAt(baseHue);
76
84
  const version = getVersion();
77
- return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MakerMark, { color: brand }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((t + i * 0.06) % 1), bold: true, children: line }, 'b' + i))), code.map((line, i) => (_jsx(Text, { color: hueAt((t + i * 0.06 + 0.35) % 1), bold: true, children: line }, 'c' + i))), _jsx(Text, { children: " " }), _jsx(Text, { color: "gray", children: 'a coding agent · v' + version }), _jsx(Text, { children: " " })] }));
85
+ return (_jsxs(Box, { flexDirection: "column", children: [_jsx(MakerMark, { color: brand }), _jsx(Text, { children: " " }), blyue.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06) % 1), bold: true, children: line }, 'b' + i))), code.map((line, i) => (_jsx(Text, { color: hueAt((baseHue + i * 0.06 + 0.35) % 1), bold: true, children: line }, 'c' + i))), _jsx(Text, { children: " " }), _jsx(Text, { color: "gray", children: 'a coding agent · v' + version }), _jsx(Text, { children: " " })] }));
78
86
  };
@@ -3,24 +3,38 @@ import { useState, useEffect } from 'react';
3
3
  import { Text } from 'ink';
4
4
  import { theme } from './theme.js';
5
5
  import { hueAt } from './animColor.js';
6
+ import os from 'os';
7
+ function isSlow() {
8
+ if (process.env.BLYUE_STATIC === '1')
9
+ return true;
10
+ try {
11
+ return os.totalmem() / 1024 / 1024 / 1024 < 6;
12
+ }
13
+ catch { }
14
+ return false;
15
+ }
6
16
  export const RocketBar = ({ label, loading, width }) => {
17
+ const [slow] = useState(() => isSlow());
7
18
  const [t, setT] = useState(0);
8
19
  const [pos, setPos] = useState(0);
9
- // Animated hue (matches banner)
20
+ // Slower tick on low-spec machines
21
+ const tickMs = slow ? 200 : 50;
22
+ const rocketMs = slow ? 200 : 65;
10
23
  useEffect(() => {
11
- const int = setInterval(() => setT((v) => (v + 0.00625) % 1), 50);
24
+ if (slow)
25
+ return; // no hue cycling on slow hardware
26
+ const int = setInterval(() => setT((v) => (v + 0.00625) % 1), tickMs);
12
27
  return () => clearInterval(int);
13
- }, []);
14
- const fixed = 5 + label.length; // '╭─ ' + label + ' ' + '╮'
28
+ }, [slow, tickMs]);
29
+ const fixed = 5 + label.length;
15
30
  const midLen = Math.max(0, width - fixed);
16
- // Rocket position animation
17
31
  useEffect(() => {
18
32
  if (!loading || midLen < 6)
19
33
  return;
20
34
  const track = midLen - 2;
21
- const int = setInterval(() => setPos((p) => (p + 1) % track), 65);
35
+ const int = setInterval(() => setPos((p) => (p + 1) % track), rocketMs);
22
36
  return () => clearInterval(int);
23
- }, [loading, midLen]);
37
+ }, [loading, midLen, rocketMs]);
24
38
  const hue = hueAt(t);
25
39
  if (!loading || midLen < 6) {
26
40
  return (_jsxs(Text, { children: [_jsx(Text, { color: theme.muted, children: '╭─ ' }), _jsx(Text, { color: loading ? hue : theme.accent, bold: true, children: label }), _jsx(Text, { color: theme.muted, children: ' ' + '─'.repeat(midLen) + '╮' })] }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blyuecode",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "BLYUE Code — a coding agent by Lumen",
5
5
  "type": "module",
6
6
  "license": "MIT",