flowmind 1.1.0 → 1.2.2

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.
@@ -0,0 +1,49 @@
1
+ const React = require('react');
2
+ const { Box, Text } = require('ink');
3
+
4
+ const LEVEL_NAMES = ['Egg', 'Hatchling', 'Juvenile', 'Adult', 'Elder', 'Ascended'];
5
+
6
+ function StatusBar({ flowmind }) {
7
+ const [aiStatus, setAiStatus] = React.useState(null);
8
+ const [componentStatus, setComponentStatus] = React.useState(null);
9
+ const [honorData, setHonorData] = React.useState(null);
10
+
11
+ React.useEffect(() => {
12
+ if (flowmind) {
13
+ try {
14
+ setAiStatus(flowmind.getAIStatus());
15
+ setComponentStatus(flowmind.getComponentStatus());
16
+ setHonorData(flowmind.getHonorData());
17
+ } catch (e) { /* Non-blocking */ }
18
+ }
19
+ }, [flowmind]);
20
+
21
+ const aiName = aiStatus?.defaultProvider || 'none';
22
+ const aiOk = aiStatus?.initialized || false;
23
+ const componentCount = componentStatus ? Object.keys(componentStatus).length : 0;
24
+ const activeCount = componentStatus ? Object.values(componentStatus).filter(c => c.active).length : 0;
25
+ const level = honorData?.level || 0;
26
+ const points = honorData?.points || 0;
27
+
28
+ return (
29
+ React.createElement(Box, { borderStyle: 'single', borderColor: 'gray', paddingX: 1, justifyContent: 'space-between' },
30
+ React.createElement(Text, null,
31
+ React.createElement(Text, { color: 'gray' }, 'AI: '),
32
+ React.createElement(Text, { color: aiOk ? 'green' : 'red' }, aiName),
33
+ React.createElement(Text, { color: aiOk ? 'green' : 'red' }, aiOk ? ' \u25CF' : ' \u25CB')
34
+ ),
35
+ React.createElement(Text, null,
36
+ React.createElement(Text, { color: 'gray' }, 'Components: '),
37
+ React.createElement(Text, { color: 'white' }, activeCount + '/' + componentCount),
38
+ React.createElement(Text, { color: 'green' }, ' active')
39
+ ),
40
+ React.createElement(Text, null,
41
+ React.createElement(Text, { color: 'gray' }, 'Honor: '),
42
+ React.createElement(Text, { color: 'yellow' }, LEVEL_NAMES[level]),
43
+ React.createElement(Text, { color: 'gray' }, ' (' + points + ' pts)')
44
+ )
45
+ )
46
+ );
47
+ }
48
+
49
+ module.exports = StatusBar;