agentk8 2.1.0 → 2.1.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.
- package/dist/cli.js +1 -1
- package/dist/components/Banner.js +8 -1
- package/dist/components/Input.js +34 -1
- package/dist/components/StatusBar.js +6 -2
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -12,6 +12,13 @@ const theme = {
|
|
|
12
12
|
export const Banner = ({ version }) => {
|
|
13
13
|
const termWidth = process.stdout.columns || 80;
|
|
14
14
|
const w = termWidth;
|
|
15
|
-
|
|
15
|
+
// Calculate widths properly
|
|
16
|
+
const tagline = 'Multi-Agent System';
|
|
17
|
+
const versionStr = ` v${version}`;
|
|
18
|
+
const prefixLen = 25;
|
|
19
|
+
const usedWidth = prefixLen + tagline.length + versionStr.length;
|
|
20
|
+
const remainingSpace = Math.max(0, w - usedWidth - 2);
|
|
21
|
+
const dashes = remainingSpace > 0 ? ' ' + '─'.repeat(remainingSpace) + ' ' : ' ';
|
|
22
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { children: _jsx(Text, { color: theme.glow, children: '▁'.repeat(w) }) }), _jsxs(Box, { children: [_jsx(Text, { color: theme.border, children: ' ' }), _jsx(Text, { color: theme.dim, children: '◇' }), _jsx(Text, { color: theme.border, children: ' ─── ' }), _jsx(Text, { color: theme.highlight, bold: true, children: "AGENT" }), _jsx(Text, { color: theme.accent, bold: true, children: "-" }), _jsx(Text, { color: theme.highlight, bold: true, children: "K" }), _jsx(Text, { color: theme.border, children: ' ─── ' }), _jsx(Text, { color: theme.dim, children: '◇' }), _jsx(Text, { color: theme.border, children: ' ─ ' }), _jsx(Text, { color: theme.dim, italic: true, children: tagline }), _jsx(Text, { color: theme.border, children: dashes }), _jsx(Text, { color: theme.dim, children: versionStr })] }), _jsx(Box, { children: _jsx(Text, { color: theme.border, children: '─'.repeat(w) }) })] }));
|
|
16
23
|
};
|
|
17
24
|
export default Banner;
|
package/dist/components/Input.js
CHANGED
|
@@ -5,7 +5,10 @@ import { Box, Text, useInput } from 'ink';
|
|
|
5
5
|
const theme = {
|
|
6
6
|
accent: '#4fd1c5',
|
|
7
7
|
dim: '#4a5568',
|
|
8
|
+
suggestion: '#718096',
|
|
8
9
|
};
|
|
10
|
+
// Available commands for autocomplete
|
|
11
|
+
const COMMANDS = ['/help', '/status', '/clear', '/exit', '/mode'];
|
|
9
12
|
// Store history globally so it persists across re-renders
|
|
10
13
|
const commandHistory = [];
|
|
11
14
|
const MAX_HISTORY = 100;
|
|
@@ -14,6 +17,17 @@ export const Input = ({ onSubmit, placeholder = 'Type a message...', prefix = '>
|
|
|
14
17
|
const [cursorPosition, setCursorPosition] = useState(0);
|
|
15
18
|
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
16
19
|
const [tempValue, setTempValue] = useState(''); // Store current input when browsing history
|
|
20
|
+
const [tabIndex, setTabIndex] = useState(0); // For cycling through completions
|
|
21
|
+
// Get autocomplete suggestion
|
|
22
|
+
const getSuggestion = () => {
|
|
23
|
+
if (!value.startsWith('/') || value.length < 1)
|
|
24
|
+
return '';
|
|
25
|
+
const matches = COMMANDS.filter(cmd => cmd.startsWith(value.toLowerCase()));
|
|
26
|
+
if (matches.length === 0)
|
|
27
|
+
return '';
|
|
28
|
+
return matches[0].slice(value.length);
|
|
29
|
+
};
|
|
30
|
+
const suggestion = getSuggestion();
|
|
17
31
|
useInput((input, key) => {
|
|
18
32
|
if (disabled)
|
|
19
33
|
return;
|
|
@@ -99,16 +113,35 @@ export const Input = ({ onSubmit, placeholder = 'Type a message...', prefix = '>
|
|
|
99
113
|
// Go to end
|
|
100
114
|
setCursorPosition(value.length);
|
|
101
115
|
}
|
|
116
|
+
else if (key.tab) {
|
|
117
|
+
// Tab completion
|
|
118
|
+
if (suggestion) {
|
|
119
|
+
const completed = value + suggestion;
|
|
120
|
+
setValue(completed);
|
|
121
|
+
setCursorPosition(completed.length);
|
|
122
|
+
}
|
|
123
|
+
else if (value.startsWith('/')) {
|
|
124
|
+
// Cycle through matching commands
|
|
125
|
+
const matches = COMMANDS.filter(cmd => cmd.startsWith(value.toLowerCase()));
|
|
126
|
+
if (matches.length > 0) {
|
|
127
|
+
const nextIndex = (tabIndex + 1) % matches.length;
|
|
128
|
+
setTabIndex(nextIndex);
|
|
129
|
+
setValue(matches[nextIndex]);
|
|
130
|
+
setCursorPosition(matches[nextIndex].length);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
102
134
|
else if (!key.ctrl && !key.meta && input) {
|
|
103
135
|
setValue(prev => prev.slice(0, cursorPosition) + input + prev.slice(cursorPosition));
|
|
104
136
|
setCursorPosition(pos => pos + input.length);
|
|
105
137
|
setHistoryIndex(-1); // Reset history navigation on edit
|
|
138
|
+
setTabIndex(0); // Reset tab completion cycle
|
|
106
139
|
}
|
|
107
140
|
});
|
|
108
141
|
// Render input with cursor
|
|
109
142
|
const beforeCursor = value.slice(0, cursorPosition);
|
|
110
143
|
const atCursor = value[cursorPosition] || ' ';
|
|
111
144
|
const afterCursor = value.slice(cursorPosition + 1);
|
|
112
|
-
return (_jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: theme.accent, bold: true, children: [prefix, " "] }), value.length === 0 && !disabled ? (_jsx(Text, { color: theme.dim, children: placeholder })) : (_jsxs(_Fragment, { children: [_jsx(Text, { children: beforeCursor }), _jsx(Text, { inverse: true, children: atCursor }), _jsx(Text, { children: afterCursor })] })), disabled && _jsx(Text, { color: theme.dim, children: " processing..." })] }));
|
|
145
|
+
return (_jsxs(Box, { marginTop: 1, children: [_jsxs(Text, { color: theme.accent, bold: true, children: [prefix, " "] }), value.length === 0 && !disabled ? (_jsx(Text, { color: theme.dim, children: placeholder })) : (_jsxs(_Fragment, { children: [_jsx(Text, { children: beforeCursor }), _jsx(Text, { inverse: true, children: atCursor }), _jsx(Text, { children: afterCursor }), suggestion && cursorPosition === value.length && (_jsx(Text, { color: theme.suggestion, children: suggestion }))] })), disabled && _jsx(Text, { color: theme.dim, children: " processing..." })] }));
|
|
113
146
|
};
|
|
114
147
|
export default Input;
|
|
@@ -14,6 +14,10 @@ export const StatusBar = ({ mode, tokens, startTime, isProcessing = false, }) =>
|
|
|
14
14
|
const [elapsed, setElapsed] = useState('0s');
|
|
15
15
|
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
|
16
16
|
useEffect(() => {
|
|
17
|
+
if (!isProcessing) {
|
|
18
|
+
setElapsed('');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
17
21
|
const interval = setInterval(() => {
|
|
18
22
|
const secs = Math.floor((Date.now() - startTime.getTime()) / 1000);
|
|
19
23
|
const mins = Math.floor(secs / 60);
|
|
@@ -21,7 +25,7 @@ export const StatusBar = ({ mode, tokens, startTime, isProcessing = false, }) =>
|
|
|
21
25
|
setElapsed(mins > 0 ? `${mins}m ${remainingSecs}s` : `${secs}s`);
|
|
22
26
|
}, 1000);
|
|
23
27
|
return () => clearInterval(interval);
|
|
24
|
-
}, [startTime]);
|
|
28
|
+
}, [startTime, isProcessing]);
|
|
25
29
|
useEffect(() => {
|
|
26
30
|
if (!isProcessing)
|
|
27
31
|
return;
|
|
@@ -39,6 +43,6 @@ export const StatusBar = ({ mode, tokens, startTime, isProcessing = false, }) =>
|
|
|
39
43
|
};
|
|
40
44
|
const modeLabel = mode === 'dev' ? 'DEV' : 'ML';
|
|
41
45
|
const termWidth = process.stdout.columns || 80;
|
|
42
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.border, children: '─'.repeat(termWidth) }), _jsxs(Box, { justifyContent: "space-between", width: termWidth, children: [_jsxs(Box, { children: [_jsx(Text, { color: theme.dim, children: ' ◇ ' }), _jsx(Text, { color: theme.accent, children: modeLabel }), _jsx(Text, { color: theme.border, children: ' │ ' }), _jsx(Text, { color: theme.dim, children: "/help" }), isProcessing && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.border, children: ' │ ' }), _jsx(Text, { color: theme.highlight, children: icons.spinner[spinnerFrame] })] }))] }), _jsxs(Box, { children: [_jsx(Text, { color: theme.dim, children: elapsed }), _jsx(Text, { color: theme.border, children: ' │ ' }), _jsxs(Text, { color: theme.accent, children: ["\u2191 ", formatTokens(tokens)] }), _jsx(Text, { color: theme.dim, children: ' tokens ' })] })] })] }));
|
|
46
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { color: theme.border, children: '─'.repeat(termWidth) }), _jsxs(Box, { justifyContent: "space-between", width: termWidth, children: [_jsxs(Box, { children: [_jsx(Text, { color: theme.dim, children: ' ◇ ' }), _jsx(Text, { color: theme.accent, children: modeLabel }), _jsx(Text, { color: theme.border, children: ' │ ' }), _jsx(Text, { color: theme.dim, children: "/help" }), isProcessing && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.border, children: ' │ ' }), _jsx(Text, { color: theme.highlight, children: icons.spinner[spinnerFrame] })] }))] }), _jsxs(Box, { children: [elapsed && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.dim, children: elapsed }), _jsx(Text, { color: theme.border, children: ' │ ' })] })), _jsxs(Text, { color: theme.accent, children: ["\u2191 ", formatTokens(tokens)] }), _jsx(Text, { color: theme.dim, children: ' tokens ' })] })] })] }));
|
|
43
47
|
};
|
|
44
48
|
export default StatusBar;
|