agentk8 2.2.3 → 2.2.5
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
CHANGED
package/dist/components/App.js
CHANGED
|
@@ -20,6 +20,7 @@ export const App = ({ mode, version }) => {
|
|
|
20
20
|
const [completedAgents, setCompletedAgents] = useState([]);
|
|
21
21
|
const [pendingPlan, setPendingPlan] = useState(null);
|
|
22
22
|
const [awaitingApproval, setAwaitingApproval] = useState(false);
|
|
23
|
+
const [autoAccept, setAutoAccept] = useState(false);
|
|
23
24
|
// Detect agents mentioned in response
|
|
24
25
|
const detectMentionedAgents = (content) => {
|
|
25
26
|
const agents = [];
|
|
@@ -42,7 +43,8 @@ export const App = ({ mode, version }) => {
|
|
|
42
43
|
}
|
|
43
44
|
// Handle approval response
|
|
44
45
|
if (awaitingApproval) {
|
|
45
|
-
|
|
46
|
+
// Enter (empty input) = approve
|
|
47
|
+
if (input.trim() === '') {
|
|
46
48
|
setAwaitingApproval(false);
|
|
47
49
|
if (pendingPlan) {
|
|
48
50
|
await executeTask(pendingPlan);
|
|
@@ -56,6 +58,9 @@ export const App = ({ mode, version }) => {
|
|
|
56
58
|
addSystemMessage('Plan cancelled. What would you like to do instead?');
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
61
|
+
// Any other input cancels and starts new request
|
|
62
|
+
setAwaitingApproval(false);
|
|
63
|
+
setPendingPlan(null);
|
|
59
64
|
}
|
|
60
65
|
// Add user message
|
|
61
66
|
const userMessage = {
|
|
@@ -90,7 +95,7 @@ Respond with:
|
|
|
90
95
|
4. Questions (if any clarification needed)
|
|
91
96
|
|
|
92
97
|
Format your response clearly with headers.`;
|
|
93
|
-
const result = await runClaude(planPrompt, mode);
|
|
98
|
+
const result = await runClaude(planPrompt, mode, autoAccept);
|
|
94
99
|
const mentioned = detectMentionedAgents(result.response);
|
|
95
100
|
setCompletedAgents(['Orchestrator', ...mentioned]);
|
|
96
101
|
setActiveAgent(undefined);
|
|
@@ -108,7 +113,7 @@ Format your response clearly with headers.`;
|
|
|
108
113
|
}
|
|
109
114
|
setPendingPlan(input);
|
|
110
115
|
setAwaitingApproval(true);
|
|
111
|
-
addSystemMessage('
|
|
116
|
+
addSystemMessage('Press Enter to execute, or type "n" to cancel');
|
|
112
117
|
}
|
|
113
118
|
catch (err) {
|
|
114
119
|
setError(err instanceof Error ? err.message : 'Unknown error');
|
|
@@ -126,7 +131,7 @@ Format your response clearly with headers.`;
|
|
|
126
131
|
setCompletedAgents([]);
|
|
127
132
|
setError(null);
|
|
128
133
|
try {
|
|
129
|
-
const result = await runClaude(input, mode);
|
|
134
|
+
const result = await runClaude(input, mode, autoAccept);
|
|
130
135
|
const mentioned = detectMentionedAgents(result.response);
|
|
131
136
|
setCompletedAgents(['Orchestrator', ...mentioned]);
|
|
132
137
|
setActiveAgent(undefined);
|
|
@@ -240,11 +245,19 @@ Ctrl+U - Clear input line`,
|
|
|
240
245
|
setError(`Unknown command: /${command}`);
|
|
241
246
|
}
|
|
242
247
|
};
|
|
243
|
-
// Handle
|
|
248
|
+
// Handle keyboard shortcuts
|
|
244
249
|
useInput((input, key) => {
|
|
245
250
|
if (key.ctrl && input === 'c') {
|
|
246
251
|
exit();
|
|
247
252
|
}
|
|
253
|
+
// Shift+Tab to toggle auto-accept
|
|
254
|
+
if (key.shift && key.tab) {
|
|
255
|
+
setAutoAccept(prev => {
|
|
256
|
+
const newValue = !prev;
|
|
257
|
+
addSystemMessage(newValue ? 'Auto-accept enabled (edits will be applied automatically)' : 'Auto-accept disabled');
|
|
258
|
+
return newValue;
|
|
259
|
+
});
|
|
260
|
+
}
|
|
248
261
|
});
|
|
249
262
|
// Prepare items for Static (include welcome box as first item)
|
|
250
263
|
const staticItems = messages.length === 0
|
|
@@ -255,7 +268,7 @@ Ctrl+U - Clear input line`,
|
|
|
255
268
|
return _jsx(WelcomeBox, { version: version, mode: mode }, "welcome");
|
|
256
269
|
}
|
|
257
270
|
return (_jsx(ChatMessage, { role: item.role, agentName: item.agentName, content: item.content, tokens: item.tokens }, item.id));
|
|
258
|
-
} }), isProcessing && processingStartTime && (_jsx(ThinkingIndicator, { startTime: processingStartTime })), error && (_jsx(Box, { marginY: 1, marginLeft: 1, children: _jsxs(Text, { color: "#e53e3e", children: ["\u2717 Error: ", error] }) })), _jsx(Input, { onSubmit: handleSubmit, disabled: isProcessing, placeholder: awaitingApproval ? "
|
|
271
|
+
} }), isProcessing && processingStartTime && (_jsx(ThinkingIndicator, { startTime: processingStartTime })), error && (_jsx(Box, { marginY: 1, marginLeft: 1, children: _jsxs(Text, { color: "#e53e3e", children: ["\u2717 Error: ", error] }) })), _jsx(Input, { onSubmit: handleSubmit, disabled: isProcessing, placeholder: awaitingApproval ? "Press Enter to execute, n to cancel" : 'Try "build a password validator"' }), _jsx(StatusBar, { mode: mode, tokens: totalTokens, startTime: startTime, isProcessing: isProcessing, activeAgent: activeAgent, completedAgents: completedAgents, autoAccept: autoAccept })] }));
|
|
259
272
|
};
|
|
260
273
|
function formatElapsed(start) {
|
|
261
274
|
const secs = Math.floor((Date.now() - start.getTime()) / 1000);
|
|
@@ -23,7 +23,7 @@ const agentIcons = {
|
|
|
23
23
|
'Data Engineer': '&',
|
|
24
24
|
Evaluator: '^',
|
|
25
25
|
};
|
|
26
|
-
export const StatusBar = ({ mode, tokens, startTime, isProcessing = false, activeAgent, completedAgents = [], }) => {
|
|
26
|
+
export const StatusBar = ({ mode, tokens, startTime, isProcessing = false, activeAgent, completedAgents = [], autoAccept = false, }) => {
|
|
27
27
|
const [elapsed, setElapsed] = useState('');
|
|
28
28
|
const [spinnerFrame, setSpinnerFrame] = useState(0);
|
|
29
29
|
const [pulseFrame, setPulseFrame] = useState(0);
|
|
@@ -82,6 +82,6 @@ export const StatusBar = ({ mode, tokens, startTime, isProcessing = false, activ
|
|
|
82
82
|
const leftBracket = isActive ? pulseBrackets[pulseFrame] : '[';
|
|
83
83
|
const rightBracket = isActive ? pulseBrackets[(pulseFrame + 3) % pulseBrackets.length] === '<' ? '>' : pulseBrackets[(pulseFrame + 3) % pulseBrackets.length] === '{' ? '}' : pulseBrackets[(pulseFrame + 3) % pulseBrackets.length] === '(' ? ')' : ']' : ']';
|
|
84
84
|
return (_jsxs(React.Fragment, { children: [_jsx(Text, { color: getAgentColor(agent), children: leftBracket }), _jsx(Text, { color: getAgentColor(agent), children: agentIcons[agent] }), _jsx(Text, { color: getAgentColor(agent), children: rightBracket }), i < modeAgents.length - 1 && _jsx(Text, { color: theme.dim, children: " " })] }, agent));
|
|
85
|
-
}), _jsx(Text, { color: theme.border, children: " \u2502 " }), _jsx(Text, { color: theme.dim, children: "? help" }), isProcessing && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.border, children: " \u2502 " }), _jsx(Text, { color: theme.highlight, children: icons.spinner[spinnerFrame] })] })), elapsed && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.border, children: " \u2502 " }), _jsx(Text, { color: theme.dim, children: elapsed })] })), _jsx(Text, { color: theme.dim, children: ' '.repeat(3) }), _jsxs(Text, { color: theme.accent, children: ["\u2191 ", formatTokens(tokens)] }), _jsx(Text, { color: theme.dim, children: " tokens" })] }));
|
|
85
|
+
}), _jsx(Text, { color: theme.border, children: " \u2502 " }), _jsx(Text, { color: theme.dim, children: "? help" }), autoAccept && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.border, children: " \u2502 " }), _jsx(Text, { color: theme.active, children: "AUTO" })] })), isProcessing && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.border, children: " \u2502 " }), _jsx(Text, { color: theme.highlight, children: icons.spinner[spinnerFrame] })] })), elapsed && (_jsxs(_Fragment, { children: [_jsx(Text, { color: theme.border, children: " \u2502 " }), _jsx(Text, { color: theme.dim, children: elapsed })] })), _jsx(Text, { color: theme.dim, children: ' '.repeat(3) }), _jsxs(Text, { color: theme.accent, children: ["\u2191 ", formatTokens(tokens)] }), _jsx(Text, { color: theme.dim, children: " tokens" })] }));
|
|
86
86
|
};
|
|
87
87
|
export default StatusBar;
|
package/dist/lib/claude.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ interface ClaudeResult {
|
|
|
5
5
|
output: number;
|
|
6
6
|
};
|
|
7
7
|
}
|
|
8
|
-
export declare function runClaude(prompt: string, mode: 'dev' | 'ml'): Promise<ClaudeResult>;
|
|
8
|
+
export declare function runClaude(prompt: string, mode: 'dev' | 'ml', autoAccept?: boolean): Promise<ClaudeResult>;
|
|
9
9
|
export declare function checkClaudeInstalled(): Promise<boolean>;
|
|
10
10
|
export {};
|
package/dist/lib/claude.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { spawn } from 'child_process';
|
|
2
|
-
export async function runClaude(prompt, mode) {
|
|
2
|
+
export async function runClaude(prompt, mode, autoAccept = false) {
|
|
3
3
|
const systemPrompt = getSystemPrompt(mode);
|
|
4
4
|
return new Promise((resolve, reject) => {
|
|
5
5
|
const args = [
|
|
6
6
|
'--print',
|
|
7
7
|
'--output-format', 'json',
|
|
8
|
+
...(autoAccept ? ['--dangerously-skip-permissions'] : []),
|
|
8
9
|
'--system-prompt', systemPrompt,
|
|
9
10
|
prompt,
|
|
10
11
|
];
|