@bradygaster/squad-cli 0.8.5 → 0.8.17-preview
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/README.md +2 -2
- package/dist/cli/commands/copilot-bridge.d.ts +42 -0
- package/dist/cli/commands/copilot-bridge.d.ts.map +1 -0
- package/dist/cli/commands/copilot-bridge.js +191 -0
- package/dist/cli/commands/copilot-bridge.js.map +1 -0
- package/dist/cli/commands/import.js.map +1 -1
- package/dist/cli/commands/rc-tunnel.d.ts +30 -0
- package/dist/cli/commands/rc-tunnel.d.ts.map +1 -0
- package/dist/cli/commands/rc-tunnel.js +107 -0
- package/dist/cli/commands/rc-tunnel.js.map +1 -0
- package/dist/cli/commands/rc.d.ts +13 -0
- package/dist/cli/commands/rc.d.ts.map +1 -0
- package/dist/cli/commands/rc.js +270 -0
- package/dist/cli/commands/rc.js.map +1 -0
- package/dist/cli/commands/start.d.ts +18 -0
- package/dist/cli/commands/start.d.ts.map +1 -0
- package/dist/cli/commands/start.js +219 -0
- package/dist/cli/commands/start.js.map +1 -0
- package/dist/cli/commands/upstream.js.map +1 -1
- package/dist/cli/commands/watch.d.ts +10 -0
- package/dist/cli/commands/watch.d.ts.map +1 -1
- package/dist/cli/commands/watch.js +181 -65
- package/dist/cli/commands/watch.js.map +1 -1
- package/dist/cli/core/cast.d.ts +40 -0
- package/dist/cli/core/cast.d.ts.map +1 -0
- package/dist/cli/core/cast.js +442 -0
- package/dist/cli/core/cast.js.map +1 -0
- package/dist/cli/core/gh-cli.d.ts +25 -0
- package/dist/cli/core/gh-cli.d.ts.map +1 -1
- package/dist/cli/core/gh-cli.js +15 -1
- package/dist/cli/core/gh-cli.js.map +1 -1
- package/dist/cli/core/init.d.ts +9 -1
- package/dist/cli/core/init.d.ts.map +1 -1
- package/dist/cli/core/init.js +108 -13
- package/dist/cli/core/init.js.map +1 -1
- package/dist/cli/core/migrations.js.map +1 -1
- package/dist/cli/core/nap.d.ts +37 -0
- package/dist/cli/core/nap.d.ts.map +1 -0
- package/dist/cli/core/nap.js +528 -0
- package/dist/cli/core/nap.js.map +1 -0
- package/dist/cli/core/output.d.ts +5 -0
- package/dist/cli/core/output.d.ts.map +1 -1
- package/dist/cli/core/output.js +7 -0
- package/dist/cli/core/output.js.map +1 -1
- package/dist/cli/core/upgrade.d.ts +0 -1
- package/dist/cli/core/upgrade.d.ts.map +1 -1
- package/dist/cli/core/upgrade.js.map +1 -1
- package/dist/cli/core/version.js.map +1 -1
- package/dist/cli/shell/agent-status.d.ts +11 -0
- package/dist/cli/shell/agent-status.d.ts.map +1 -0
- package/dist/cli/shell/agent-status.js +26 -0
- package/dist/cli/shell/agent-status.js.map +1 -0
- package/dist/cli/shell/commands.d.ts +10 -0
- package/dist/cli/shell/commands.d.ts.map +1 -1
- package/dist/cli/shell/commands.js +143 -29
- package/dist/cli/shell/commands.js.map +1 -1
- package/dist/cli/shell/components/AgentPanel.d.ts +1 -4
- package/dist/cli/shell/components/AgentPanel.d.ts.map +1 -1
- package/dist/cli/shell/components/AgentPanel.js +88 -6
- package/dist/cli/shell/components/AgentPanel.js.map +1 -1
- package/dist/cli/shell/components/App.d.ts +11 -6
- package/dist/cli/shell/components/App.d.ts.map +1 -1
- package/dist/cli/shell/components/App.js +212 -35
- package/dist/cli/shell/components/App.js.map +1 -1
- package/dist/cli/shell/components/ErrorBoundary.d.ts +22 -0
- package/dist/cli/shell/components/ErrorBoundary.d.ts.map +1 -0
- package/dist/cli/shell/components/ErrorBoundary.js +31 -0
- package/dist/cli/shell/components/ErrorBoundary.js.map +1 -0
- package/dist/cli/shell/components/InputPrompt.d.ts +3 -0
- package/dist/cli/shell/components/InputPrompt.d.ts.map +1 -1
- package/dist/cli/shell/components/InputPrompt.js +155 -13
- package/dist/cli/shell/components/InputPrompt.js.map +1 -1
- package/dist/cli/shell/components/MessageStream.d.ts +17 -4
- package/dist/cli/shell/components/MessageStream.d.ts.map +1 -1
- package/dist/cli/shell/components/MessageStream.js +215 -23
- package/dist/cli/shell/components/MessageStream.js.map +1 -1
- package/dist/cli/shell/components/Separator.d.ts +17 -0
- package/dist/cli/shell/components/Separator.d.ts.map +1 -0
- package/dist/cli/shell/components/Separator.js +10 -0
- package/dist/cli/shell/components/Separator.js.map +1 -0
- package/dist/cli/shell/components/ThinkingIndicator.d.ts +21 -0
- package/dist/cli/shell/components/ThinkingIndicator.d.ts.map +1 -0
- package/dist/cli/shell/components/ThinkingIndicator.js +102 -0
- package/dist/cli/shell/components/ThinkingIndicator.js.map +1 -0
- package/dist/cli/shell/components/index.d.ts +3 -0
- package/dist/cli/shell/components/index.d.ts.map +1 -1
- package/dist/cli/shell/components/index.js +2 -0
- package/dist/cli/shell/components/index.js.map +1 -1
- package/dist/cli/shell/coordinator.d.ts +10 -0
- package/dist/cli/shell/coordinator.d.ts.map +1 -1
- package/dist/cli/shell/coordinator.js +99 -4
- package/dist/cli/shell/coordinator.js.map +1 -1
- package/dist/cli/shell/error-messages.d.ts +21 -0
- package/dist/cli/shell/error-messages.d.ts.map +1 -0
- package/dist/cli/shell/error-messages.js +61 -0
- package/dist/cli/shell/error-messages.js.map +1 -0
- package/dist/cli/shell/index.d.ts +24 -3
- package/dist/cli/shell/index.d.ts.map +1 -1
- package/dist/cli/shell/index.js +943 -34
- package/dist/cli/shell/index.js.map +1 -1
- package/dist/cli/shell/lifecycle.d.ts +2 -0
- package/dist/cli/shell/lifecycle.d.ts.map +1 -1
- package/dist/cli/shell/lifecycle.js +59 -6
- package/dist/cli/shell/lifecycle.js.map +1 -1
- package/dist/cli/shell/memory.d.ts +6 -1
- package/dist/cli/shell/memory.d.ts.map +1 -1
- package/dist/cli/shell/memory.js +12 -1
- package/dist/cli/shell/memory.js.map +1 -1
- package/dist/cli/shell/router.d.ts +16 -0
- package/dist/cli/shell/router.d.ts.map +1 -1
- package/dist/cli/shell/router.js +27 -0
- package/dist/cli/shell/router.js.map +1 -1
- package/dist/cli/shell/session-store.d.ts +47 -0
- package/dist/cli/shell/session-store.d.ts.map +1 -0
- package/dist/cli/shell/session-store.js +125 -0
- package/dist/cli/shell/session-store.js.map +1 -0
- package/dist/cli/shell/sessions.d.ts +2 -0
- package/dist/cli/shell/sessions.d.ts.map +1 -1
- package/dist/cli/shell/sessions.js +19 -5
- package/dist/cli/shell/sessions.js.map +1 -1
- package/dist/cli/shell/shell-metrics.d.ts +34 -0
- package/dist/cli/shell/shell-metrics.d.ts.map +1 -0
- package/dist/cli/shell/shell-metrics.js +98 -0
- package/dist/cli/shell/shell-metrics.js.map +1 -0
- package/dist/cli/shell/spawn.d.ts.map +1 -1
- package/dist/cli/shell/spawn.js +20 -6
- package/dist/cli/shell/spawn.js.map +1 -1
- package/dist/cli/shell/terminal.d.ts +26 -0
- package/dist/cli/shell/terminal.d.ts.map +1 -1
- package/dist/cli/shell/terminal.js +65 -2
- package/dist/cli/shell/terminal.js.map +1 -1
- package/dist/cli/shell/theme-colors.d.ts +39 -0
- package/dist/cli/shell/theme-colors.d.ts.map +1 -0
- package/dist/cli/shell/theme-colors.js +39 -0
- package/dist/cli/shell/theme-colors.js.map +1 -0
- package/dist/cli/shell/types.d.ts +2 -0
- package/dist/cli/shell/types.d.ts.map +1 -1
- package/dist/cli/shell/useAnimation.d.ts +42 -0
- package/dist/cli/shell/useAnimation.d.ts.map +1 -0
- package/dist/cli/shell/useAnimation.js +139 -0
- package/dist/cli/shell/useAnimation.js.map +1 -0
- package/dist/cli-entry.d.ts +0 -7
- package/dist/cli-entry.d.ts.map +1 -1
- package/dist/cli-entry.js +701 -96
- package/dist/cli-entry.js.map +1 -1
- package/package.json +18 -2
- package/templates/orchestration-log.md +1 -1
- package/templates/package.json +3 -0
- package/templates/ralph-triage.js +543 -0
- package/templates/scribe-charter.md +1 -1
- package/templates/squad.agent.md +10 -10
- package/templates/workflows/squad-heartbeat.yml +52 -196
- package/templates/workflows/squad-insider-release.yml +1 -1
|
@@ -1,52 +1,133 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*
|
|
5
|
-
* Exposes a ShellApi callback so the parent (runShell) can wire
|
|
6
|
-
* StreamBridge events into React state.
|
|
7
|
-
*/
|
|
8
|
-
import { useState, useCallback, useEffect, useRef } from 'react';
|
|
9
|
-
import { Box, Text, useApp, useInput } from 'ink';
|
|
2
|
+
import { useState, useCallback, useEffect, useRef, useMemo } from 'react';
|
|
3
|
+
import { Box, Text, Static, useApp, useInput } from 'ink';
|
|
10
4
|
import { AgentPanel } from './AgentPanel.js';
|
|
11
|
-
import { MessageStream } from './MessageStream.js';
|
|
5
|
+
import { MessageStream, renderMarkdownInline, formatDuration } from './MessageStream.js';
|
|
12
6
|
import { InputPrompt } from './InputPrompt.js';
|
|
13
7
|
import { parseInput } from '../router.js';
|
|
14
8
|
import { executeCommand } from '../commands.js';
|
|
15
|
-
import { loadWelcomeData } from '../lifecycle.js';
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
import { loadWelcomeData, getRoleEmoji } from '../lifecycle.js';
|
|
10
|
+
import { isNoColor, useTerminalWidth, useTerminalHeight, useLayoutTier } from '../terminal.js';
|
|
11
|
+
import { Separator } from './Separator.js';
|
|
12
|
+
import { MemoryManager } from '../memory.js';
|
|
13
|
+
const EXIT_WORDS = new Set(['exit', 'quit', 'q']);
|
|
14
|
+
export const App = ({ registry, renderer, teamRoot, version, maxMessages, onReady, onDispatch, onCancel, onRestoreSession }) => {
|
|
18
15
|
const { exit } = useApp();
|
|
16
|
+
// Session-scoped ID ensures Static keys are unique across session boundaries,
|
|
17
|
+
// preventing Ink from confusing items when sessions are restored.
|
|
18
|
+
const sessionId = useMemo(() => Date.now().toString(36), []);
|
|
19
|
+
const memoryManager = useMemo(() => new MemoryManager(maxMessages != null ? { maxMessages } : undefined), [maxMessages]);
|
|
19
20
|
const [messages, setMessages] = useState([]);
|
|
21
|
+
const [archivedMessages, setArchivedMessages] = useState([]);
|
|
20
22
|
const [agents, setAgents] = useState(registry.getAll());
|
|
21
|
-
const [streamingContent, setStreamingContent] = useState(
|
|
23
|
+
const [streamingContent, setStreamingContent] = useState(new Map());
|
|
22
24
|
const [processing, setProcessing] = useState(false);
|
|
23
|
-
const [
|
|
25
|
+
const [activityHint, setActivityHint] = useState(undefined);
|
|
26
|
+
const [agentActivities, setAgentActivities] = useState(new Map());
|
|
27
|
+
const [welcome, setWelcome] = useState(() => loadWelcomeData(teamRoot));
|
|
24
28
|
const messagesRef = useRef([]);
|
|
29
|
+
const ctrlCRef = useRef(0);
|
|
30
|
+
const ctrlCTimerRef = useRef(null);
|
|
31
|
+
// Append messages and enforce the history cap, archiving overflow
|
|
32
|
+
const appendMessages = useCallback((updater) => {
|
|
33
|
+
setMessages(prev => {
|
|
34
|
+
const next = updater(prev);
|
|
35
|
+
const { kept, archived } = memoryManager.trimWithArchival(next);
|
|
36
|
+
if (archived.length > 0) {
|
|
37
|
+
setArchivedMessages(old => [...old, ...archived]);
|
|
38
|
+
}
|
|
39
|
+
return kept;
|
|
40
|
+
});
|
|
41
|
+
}, [memoryManager]);
|
|
25
42
|
// Keep ref in sync so command handlers see latest history
|
|
26
43
|
useEffect(() => { messagesRef.current = messages; }, [messages]);
|
|
27
|
-
// Load welcome data from .squad/ directory on mount
|
|
28
|
-
useEffect(() => {
|
|
29
|
-
const data = loadWelcomeData(teamRoot);
|
|
30
|
-
if (data)
|
|
31
|
-
setWelcome(data);
|
|
32
|
-
}, [teamRoot]);
|
|
33
44
|
// Expose API for external callers (StreamBridge, coordinator)
|
|
34
45
|
useEffect(() => {
|
|
35
46
|
onReady?.({
|
|
36
47
|
addMessage: (msg) => {
|
|
37
|
-
|
|
38
|
-
|
|
48
|
+
appendMessages(prev => [...prev, msg]);
|
|
49
|
+
if (msg.agentName) {
|
|
50
|
+
setStreamingContent(prev => {
|
|
51
|
+
const next = new Map(prev);
|
|
52
|
+
next.delete(msg.agentName);
|
|
53
|
+
return next;
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
setActivityHint(undefined);
|
|
57
|
+
},
|
|
58
|
+
clearMessages: () => {
|
|
59
|
+
setMessages([]);
|
|
60
|
+
setArchivedMessages([]);
|
|
61
|
+
},
|
|
62
|
+
setStreamingContent: (content) => {
|
|
63
|
+
if (content === null) {
|
|
64
|
+
setStreamingContent(new Map());
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
setStreamingContent(prev => {
|
|
68
|
+
const next = new Map(prev);
|
|
69
|
+
next.set(content.agentName, content.content);
|
|
70
|
+
return next;
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
clearAgentStream: (agentName) => {
|
|
75
|
+
setStreamingContent(prev => {
|
|
76
|
+
const next = new Map(prev);
|
|
77
|
+
next.delete(agentName);
|
|
78
|
+
return next;
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
setActivityHint,
|
|
82
|
+
setAgentActivity: (agentName, activity) => {
|
|
83
|
+
setAgentActivities(prev => {
|
|
84
|
+
const next = new Map(prev);
|
|
85
|
+
if (activity) {
|
|
86
|
+
next.set(agentName, activity);
|
|
87
|
+
}
|
|
88
|
+
else {
|
|
89
|
+
next.delete(agentName);
|
|
90
|
+
}
|
|
91
|
+
return next;
|
|
92
|
+
});
|
|
39
93
|
},
|
|
40
|
-
|
|
94
|
+
setProcessing,
|
|
41
95
|
refreshAgents: () => {
|
|
42
96
|
setAgents([...registry.getAll()]);
|
|
43
97
|
},
|
|
98
|
+
refreshWelcome: () => {
|
|
99
|
+
const data = loadWelcomeData(teamRoot);
|
|
100
|
+
if (data)
|
|
101
|
+
setWelcome(data);
|
|
102
|
+
},
|
|
44
103
|
});
|
|
45
|
-
}, [onReady, registry]);
|
|
46
|
-
//
|
|
104
|
+
}, [onReady, registry, appendMessages]);
|
|
105
|
+
// Ctrl+C: cancel operation when processing, double-tap to exit when idle
|
|
47
106
|
useInput((_input, key) => {
|
|
48
107
|
if (key.ctrl && _input === 'c') {
|
|
49
|
-
|
|
108
|
+
if (processing && onCancel) {
|
|
109
|
+
// First Ctrl+C while processing → cancel operation and return to prompt
|
|
110
|
+
onCancel();
|
|
111
|
+
setProcessing(false);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
// Not processing, or no cancel handler → increment double-tap counter
|
|
115
|
+
ctrlCRef.current++;
|
|
116
|
+
if (ctrlCTimerRef.current)
|
|
117
|
+
clearTimeout(ctrlCTimerRef.current);
|
|
118
|
+
if (ctrlCRef.current >= 2) {
|
|
119
|
+
exit();
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
// Single Ctrl+C when idle — show hint, reset after 1s
|
|
123
|
+
ctrlCTimerRef.current = setTimeout(() => { ctrlCRef.current = 0; }, 1000);
|
|
124
|
+
if (!processing) {
|
|
125
|
+
appendMessages(prev => [...prev, {
|
|
126
|
+
role: 'system',
|
|
127
|
+
content: 'Press Ctrl+C again to exit.',
|
|
128
|
+
timestamp: new Date(),
|
|
129
|
+
}]);
|
|
130
|
+
}
|
|
50
131
|
}
|
|
51
132
|
});
|
|
52
133
|
const handleSubmit = useCallback((input) => {
|
|
@@ -56,7 +137,7 @@ export const App = ({ registry, renderer, teamRoot, version, onReady, onDispatch
|
|
|
56
137
|
return;
|
|
57
138
|
}
|
|
58
139
|
const userMsg = { role: 'user', content: input, timestamp: new Date() };
|
|
59
|
-
|
|
140
|
+
appendMessages(prev => [...prev, userMsg]);
|
|
60
141
|
const knownAgents = registry.getAll().map(a => a.name);
|
|
61
142
|
const parsed = parseInput(input, knownAgents);
|
|
62
143
|
if (parsed.type === 'slash_command') {
|
|
@@ -65,13 +146,35 @@ export const App = ({ registry, renderer, teamRoot, version, onReady, onDispatch
|
|
|
65
146
|
renderer,
|
|
66
147
|
messageHistory: [...messagesRef.current, userMsg],
|
|
67
148
|
teamRoot,
|
|
149
|
+
version,
|
|
150
|
+
onRestoreSession,
|
|
68
151
|
});
|
|
69
152
|
if (result.exit) {
|
|
70
153
|
exit();
|
|
71
154
|
return;
|
|
72
155
|
}
|
|
156
|
+
if (result.clear) {
|
|
157
|
+
setMessages([]);
|
|
158
|
+
setArchivedMessages([]);
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
if (result.triggerInitCast && onDispatch) {
|
|
162
|
+
// /init command returned a cast trigger — dispatch it as a coordinator message
|
|
163
|
+
const castParsed = {
|
|
164
|
+
type: 'coordinator',
|
|
165
|
+
raw: result.triggerInitCast.prompt,
|
|
166
|
+
content: result.triggerInitCast.prompt,
|
|
167
|
+
skipCastConfirmation: true,
|
|
168
|
+
};
|
|
169
|
+
setProcessing(true);
|
|
170
|
+
onDispatch(castParsed).finally(() => {
|
|
171
|
+
setProcessing(false);
|
|
172
|
+
setAgents([...registry.getAll()]);
|
|
173
|
+
});
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
73
176
|
if (result.output) {
|
|
74
|
-
|
|
177
|
+
appendMessages(prev => [...prev, {
|
|
75
178
|
role: 'system',
|
|
76
179
|
content: result.output,
|
|
77
180
|
timestamp: new Date(),
|
|
@@ -80,9 +183,9 @@ export const App = ({ registry, renderer, teamRoot, version, onReady, onDispatch
|
|
|
80
183
|
}
|
|
81
184
|
else if (parsed.type === 'direct_agent' || parsed.type === 'coordinator') {
|
|
82
185
|
if (!onDispatch) {
|
|
83
|
-
|
|
186
|
+
appendMessages(prev => [...prev, {
|
|
84
187
|
role: 'system',
|
|
85
|
-
content: '
|
|
188
|
+
content: 'SDK not connected. Try: (1) squad doctor to check setup, (2) check your internet connection, (3) restart the shell to reconnect.',
|
|
86
189
|
timestamp: new Date(),
|
|
87
190
|
}]);
|
|
88
191
|
return;
|
|
@@ -94,10 +197,84 @@ export const App = ({ registry, renderer, teamRoot, version, onReady, onDispatch
|
|
|
94
197
|
});
|
|
95
198
|
}
|
|
96
199
|
setAgents([...registry.getAll()]);
|
|
97
|
-
}, [registry, renderer, teamRoot, exit, onDispatch]);
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
200
|
+
}, [registry, renderer, teamRoot, exit, onDispatch, appendMessages]);
|
|
201
|
+
const rosterAgents = welcome?.agents ?? [];
|
|
202
|
+
const noColor = isNoColor();
|
|
203
|
+
const width = useTerminalWidth();
|
|
204
|
+
const tier = useLayoutTier();
|
|
205
|
+
const terminalHeight = useTerminalHeight();
|
|
206
|
+
const contentWidth = tier === 'wide' ? Math.min(width, 120) : tier === 'normal' ? Math.min(width, 80) : width;
|
|
207
|
+
// Budget live region height so InputPrompt is never pushed off-screen.
|
|
208
|
+
// Reserve 3 rows for InputPrompt (prompt line + hint + padding).
|
|
209
|
+
const INPUT_RESERVED_ROWS = 3;
|
|
210
|
+
const liveContentHeight = Math.max(terminalHeight - INPUT_RESERVED_ROWS, 4);
|
|
211
|
+
// Prefer lead/coordinator for first-run hint, fall back to first agent
|
|
212
|
+
const leadAgent = welcome?.agents.find(a => a.role?.toLowerCase().includes('lead') ||
|
|
213
|
+
a.role?.toLowerCase().includes('coordinator') ||
|
|
214
|
+
a.role?.toLowerCase().includes('architect'))?.name ?? welcome?.agents[0]?.name;
|
|
215
|
+
// Determine ThinkingIndicator phase based on SDK connection state
|
|
216
|
+
const thinkingPhase = !onDispatch ? 'connecting' : 'routing';
|
|
217
|
+
// Derive @mention hint from last user message (needed because MessageStream
|
|
218
|
+
// receives messages=[] after the Static scrollback refactor).
|
|
219
|
+
const mentionHint = useMemo(() => {
|
|
220
|
+
if (!processing)
|
|
221
|
+
return undefined;
|
|
222
|
+
const lastUser = [...messages].reverse().find(m => m.role === 'user');
|
|
223
|
+
if (lastUser) {
|
|
224
|
+
const atMatch = lastUser.content.match(/^@(\w+)/);
|
|
225
|
+
if (atMatch?.[1])
|
|
226
|
+
return `${atMatch[1]} is thinking...`;
|
|
227
|
+
}
|
|
228
|
+
return undefined;
|
|
229
|
+
}, [messages, processing]);
|
|
230
|
+
// Combine archived + current messages for Static rendering.
|
|
231
|
+
// This array only grows — archival moves items between the two source arrays
|
|
232
|
+
// but the combined list stays stable, which is required by Ink's Static tracking.
|
|
233
|
+
const staticMessages = useMemo(() => [...archivedMessages, ...messages], [archivedMessages, messages]);
|
|
234
|
+
const roleMap = useMemo(() => new Map((agents ?? []).map(a => [a.name, a.role])), [agents]);
|
|
235
|
+
// Memoize the header box — rendered once into Static scroll buffer at the top.
|
|
236
|
+
const headerElement = useMemo(() => {
|
|
237
|
+
// Narrow: minimal header, no border
|
|
238
|
+
if (tier === 'narrow') {
|
|
239
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, children: [_jsx(Text, { bold: true, color: noColor ? undefined : 'cyan', children: "SQUAD" }), _jsxs(Text, { dimColor: true, children: ["v", version] }), _jsx(Text, { color: noColor ? undefined : 'yellow', dimColor: true, children: "\u26A0\uFE0F Experimental" })] }));
|
|
240
|
+
}
|
|
241
|
+
// Normal: abbreviated header
|
|
242
|
+
if (tier === 'normal') {
|
|
243
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: noColor ? undefined : 'cyan', paddingX: 1, children: [_jsxs(Text, { bold: true, color: noColor ? undefined : 'cyan', children: ["SQUAD v", version] }), _jsxs(Text, { dimColor: true, children: ["Type naturally \u00B7 ", _jsx(Text, { bold: true, children: "@Agent" }), " \u00B7 ", _jsx(Text, { bold: true, children: "/help" })] }), _jsx(Text, { color: noColor ? undefined : 'yellow', dimColor: true, children: "\u26A0\uFE0F Experimental preview" })] }));
|
|
244
|
+
}
|
|
245
|
+
// Wide: full ASCII art header
|
|
246
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: noColor ? undefined : 'cyan', paddingX: 1, children: [_jsx(Text, { bold: true, color: noColor ? undefined : 'cyan', children: ' ___ ___ _ _ _ ___\n / __|/ _ \\| | | |/_\\ | \\\n \\__ \\ (_) | |_| / _ \\| |) |\n |___/\\__\\_\\\\___/_/ \\_\\___/' }), _jsx(Text, { children: ' ' }), _jsxs(Text, { dimColor: true, children: ["v", version, " \u00B7 Type naturally \u00B7 ", _jsx(Text, { bold: true, children: "@Agent" }), " to direct \u00B7 ", _jsx(Text, { bold: true, children: "/help" })] }), _jsx(Text, { color: noColor ? undefined : 'yellow', dimColor: true, children: "\u26A0\uFE0F Experimental preview \u2014 file issues at github.com/bradygaster/squad" })] }));
|
|
247
|
+
}, [noColor, version, tier]);
|
|
248
|
+
const firstRunElement = useMemo(() => {
|
|
249
|
+
if (!welcome?.isFirstRun)
|
|
250
|
+
return null;
|
|
251
|
+
return (_jsx(Box, { flexDirection: "column", paddingX: 1, paddingY: 1, children: rosterAgents.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Text, { color: noColor ? undefined : 'green', bold: true, children: "Your squad is assembled." }), _jsx(Text, { children: " " }), _jsxs(Text, { bold: true, children: ["Try: ", _jsx(Text, { bold: true, color: noColor ? undefined : 'cyan', children: "What should we build first?" })] }), _jsx(Text, { dimColor: true, children: "Squad automatically routes your message to the best agent." }), _jsxs(Text, { dimColor: true, children: ["Or use ", _jsxs(Text, { bold: true, children: ["@", leadAgent] }), " to message an agent directly."] })] })) : null }));
|
|
252
|
+
}, [welcome?.isFirstRun, rosterAgents, noColor, leadAgent]);
|
|
253
|
+
const allStaticItems = useMemo(() => {
|
|
254
|
+
const items = [{ kind: 'header', key: 'welcome-header' }];
|
|
255
|
+
for (let i = 0; i < staticMessages.length; i++) {
|
|
256
|
+
items.push({ kind: 'msg', key: `${sessionId}-${i}`, msg: staticMessages[i], idx: i });
|
|
257
|
+
}
|
|
258
|
+
return items;
|
|
259
|
+
}, [staticMessages, sessionId]);
|
|
260
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Static, { items: allStaticItems, children: (item) => {
|
|
261
|
+
if (item.kind === 'header') {
|
|
262
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [headerElement, firstRunElement] }, item.key));
|
|
263
|
+
}
|
|
264
|
+
const { msg, idx: i } = item;
|
|
265
|
+
const isNewTurn = msg.role === 'user' && i > 0;
|
|
266
|
+
const agentRole = msg.agentName ? roleMap.get(msg.agentName) : undefined;
|
|
267
|
+
const emoji = agentRole ? getRoleEmoji(agentRole) : '';
|
|
268
|
+
let duration = null;
|
|
269
|
+
if (msg.role === 'agent') {
|
|
270
|
+
for (let j = i - 1; j >= 0; j--) {
|
|
271
|
+
if (staticMessages[j]?.role === 'user') {
|
|
272
|
+
duration = formatDuration(staticMessages[j].timestamp, msg.timestamp);
|
|
273
|
+
break;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
return (_jsxs(Box, { flexDirection: "column", width: contentWidth, children: [isNewTurn && tier !== 'narrow' && _jsx(Separator, { marginTop: 1 }), _jsx(Box, { gap: 1, paddingLeft: msg.role === 'user' ? 0 : 2, children: msg.role === 'user' ? (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { gap: 1, children: [_jsx(Text, { color: noColor ? undefined : 'cyan', bold: true, children: "\u276F" }), _jsx(Text, { color: noColor ? undefined : 'cyan', wrap: "wrap", children: msg.content.split('\n')[0] ?? '' })] }), msg.content.split('\n').slice(1).map((line, li) => (_jsx(Box, { paddingLeft: 2, children: _jsx(Text, { color: noColor ? undefined : 'cyan', wrap: "wrap", children: line }) }, li)))] })) : msg.role === 'system' ? (_jsx(Text, { dimColor: true, wrap: "wrap", children: msg.content })) : (_jsxs(_Fragment, { children: [_jsxs(Text, { color: noColor ? undefined : 'green', bold: true, children: [emoji ? `${emoji} ` : '', (msg.agentName === 'coordinator' ? 'Squad' : msg.agentName) ?? 'agent', ":"] }), _jsx(Text, { wrap: "wrap", children: renderMarkdownInline(msg.content) }), duration && _jsxs(Text, { dimColor: true, children: ["(", duration, ")"] })] })) })] }, item.key));
|
|
278
|
+
} }), _jsxs(Box, { flexDirection: "column", height: liveContentHeight, overflow: "hidden", children: [_jsx(AgentPanel, { agents: agents, streamingContent: streamingContent }), _jsx(MessageStream, { messages: [], agents: agents, streamingContent: streamingContent, processing: processing, activityHint: activityHint || mentionHint, agentActivities: agentActivities, thinkingPhase: thinkingPhase })] }), _jsx(Box, { marginTop: 1, borderStyle: noColor ? undefined : 'round', borderColor: noColor ? undefined : 'cyan', paddingX: 1, children: _jsx(InputPrompt, { onSubmit: handleSubmit, disabled: processing, agentNames: agents.map(a => a.name), messageCount: messages.length }) })] }));
|
|
102
279
|
};
|
|
103
280
|
//# sourceMappingURL=App.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../../../../src/cli/shell/components/App.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAc,EAAE,QAAQ,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAoB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAsBlD,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAErC,MAAM,CAAC,MAAM,GAAG,GAAuB,CAAC,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE,EAAE;IACxG,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,EAAE,CAAC;IAC1B,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAiB,EAAE,CAAC,CAAC;IAC7D,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAA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AC,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAC,QAAQ,aACtE,KAAC,UAAU,IAAC,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,GAAI,EAClE,KAAC,aAAa,IAAC,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,YAAY,IAAI,WAAW,EAAE,eAAe,EAAE,eAAe,EAAE,aAAa,EAAE,aAAa,GAAI,IAClN,EAEN,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,QAAQ,EAAE,CAAC,YACnH,KAAC,WAAW,IAAC,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,YAAY,EAAE,QAAQ,CAAC,MAAM,GAAI,GAC7H,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* React ErrorBoundary for the Ink shell.
|
|
3
|
+
*
|
|
4
|
+
* Catches unhandled errors in the component tree and shows a friendly
|
|
5
|
+
* message instead of a raw stack trace. Logs the error to stderr for debugging.
|
|
6
|
+
*/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
interface ErrorBoundaryProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
interface ErrorBoundaryState {
|
|
12
|
+
hasError: boolean;
|
|
13
|
+
error: Error | null;
|
|
14
|
+
}
|
|
15
|
+
export declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
|
16
|
+
constructor(props: ErrorBoundaryProps);
|
|
17
|
+
static getDerivedStateFromError(error: Error): ErrorBoundaryState;
|
|
18
|
+
componentDidCatch(error: Error, info: React.ErrorInfo): void;
|
|
19
|
+
render(): React.ReactNode;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
22
|
+
//# sourceMappingURL=ErrorBoundary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.d.ts","sourceRoot":"","sources":["../../../../src/cli/shell/components/ErrorBoundary.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,UAAU,kBAAkB;IAC1B,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACrB;AAED,qBAAa,aAAc,SAAQ,KAAK,CAAC,SAAS,CAAC,kBAAkB,EAAE,kBAAkB,CAAC;gBAC5E,KAAK,EAAE,kBAAkB;IAKrC,MAAM,CAAC,wBAAwB,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB;IAIjE,iBAAiB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,CAAC,SAAS,GAAG,IAAI;IAO5D,MAAM,IAAI,KAAK,CAAC,SAAS;CAW1B"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* React ErrorBoundary for the Ink shell.
|
|
4
|
+
*
|
|
5
|
+
* Catches unhandled errors in the component tree and shows a friendly
|
|
6
|
+
* message instead of a raw stack trace. Logs the error to stderr for debugging.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { Box, Text } from 'ink';
|
|
10
|
+
export class ErrorBoundary extends React.Component {
|
|
11
|
+
constructor(props) {
|
|
12
|
+
super(props);
|
|
13
|
+
this.state = { hasError: false, error: null };
|
|
14
|
+
}
|
|
15
|
+
static getDerivedStateFromError(error) {
|
|
16
|
+
return { hasError: true, error };
|
|
17
|
+
}
|
|
18
|
+
componentDidCatch(error, info) {
|
|
19
|
+
console.error('[squad] Unhandled UI error:', error);
|
|
20
|
+
if (info.componentStack) {
|
|
21
|
+
console.error('[squad] Component stack:', info.componentStack);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
render() {
|
|
25
|
+
if (this.state.hasError) {
|
|
26
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { color: "red", bold: true, children: "Something went wrong. Press Ctrl+C to exit." }), _jsx(Text, { dimColor: true, children: "The error has been logged to stderr for debugging." })] }));
|
|
27
|
+
}
|
|
28
|
+
return this.props.children;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=ErrorBoundary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../../src/cli/shell/components/ErrorBoundary.tsx"],"names":[],"mappings":";AAAA;;;;;GAKG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAWhC,MAAM,OAAO,aAAc,SAAQ,KAAK,CAAC,SAAiD;IACxF,YAAY,KAAyB;QACnC,KAAK,CAAC,KAAK,CAAC,CAAC;QACb,IAAI,CAAC,KAAK,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC;IAChD,CAAC;IAED,MAAM,CAAC,wBAAwB,CAAC,KAAY;QAC1C,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAED,iBAAiB,CAAC,KAAY,EAAE,IAAqB;QACnD,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;QACpD,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;YACxB,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC;QACjE,CAAC;IACH,CAAC;IAED,MAAM;QACJ,IAAI,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,CAAC;YACxB,OAAO,CACL,MAAC,GAAG,IAAC,aAAa,EAAC,QAAQ,EAAC,OAAO,EAAE,CAAC,aACpC,KAAC,IAAI,IAAC,KAAK,EAAC,KAAK,EAAC,IAAI,kEAAmD,EACzE,KAAC,IAAI,IAAC,QAAQ,yEAA0D,IACpE,CACP,CAAC;QACJ,CAAC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CACF"}
|
|
@@ -3,6 +3,9 @@ interface InputPromptProps {
|
|
|
3
3
|
onSubmit: (value: string) => void;
|
|
4
4
|
prompt?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
agentNames?: string[];
|
|
7
|
+
/** Number of messages exchanged so far — drives progressive hint text. */
|
|
8
|
+
messageCount?: number;
|
|
6
9
|
}
|
|
7
10
|
export declare const InputPrompt: React.FC<InputPromptProps>;
|
|
8
11
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputPrompt.d.ts","sourceRoot":"","sources":["../../../../src/cli/shell/components/InputPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"InputPrompt.d.ts","sourceRoot":"","sources":["../../../../src/cli/shell/components/InputPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAKpE,UAAU,gBAAgB;IACxB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,0EAA0E;IAC1E,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAcD,eAAO,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA6NlD,CAAC"}
|
|
@@ -1,29 +1,142 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useState } from 'react';
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect, useRef, useMemo } from 'react';
|
|
3
3
|
import { Box, Text, useInput } from 'ink';
|
|
4
|
-
|
|
4
|
+
import { isNoColor, useTerminalWidth } from '../terminal.js';
|
|
5
|
+
import { createCompleter } from '../autocomplete.js';
|
|
6
|
+
/** Return context-appropriate placeholder hint based on session progress.
|
|
7
|
+
* The header banner already shows @agent / /help guidance, so the prompt
|
|
8
|
+
* placeholder provides complementary tips instead of duplicating it. */
|
|
9
|
+
function getHintText(messageCount, narrow) {
|
|
10
|
+
if (messageCount < 10) {
|
|
11
|
+
return narrow ? ' Tab · ↑↓ history' : ' Tab completes · ↑↓ history';
|
|
12
|
+
}
|
|
13
|
+
return narrow ? ' /status · /clear · /export' : ' /status · /clear · /export';
|
|
14
|
+
}
|
|
15
|
+
const SPINNER_FRAMES = ['⠋', '⠙', '⠹', '⠸', '⠼', '⠴', '⠦', '⠧', '⠇', '⠏'];
|
|
16
|
+
export const InputPrompt = ({ onSubmit, prompt = '> ', disabled = false, agentNames = [], messageCount = 0, }) => {
|
|
17
|
+
const noColor = isNoColor();
|
|
18
|
+
const width = useTerminalWidth();
|
|
19
|
+
const narrow = width < 60;
|
|
5
20
|
const [value, setValue] = useState('');
|
|
6
21
|
const [history, setHistory] = useState([]);
|
|
7
22
|
const [historyIndex, setHistoryIndex] = useState(-1);
|
|
23
|
+
const [spinFrame, setSpinFrame] = useState(0);
|
|
24
|
+
const [bufferDisplay, setBufferDisplay] = useState('');
|
|
25
|
+
const bufferRef = useRef('');
|
|
26
|
+
const wasDisabledRef = useRef(disabled);
|
|
27
|
+
const pendingInputRef = useRef([]);
|
|
28
|
+
const pasteTimerRef = useRef(null);
|
|
29
|
+
const valueRef = useRef('');
|
|
30
|
+
// When transitioning from disabled → enabled, restore buffered input
|
|
31
|
+
useEffect(() => {
|
|
32
|
+
if (wasDisabledRef.current && !disabled) {
|
|
33
|
+
// Clear any pending paste timer from before disable
|
|
34
|
+
if (pasteTimerRef.current) {
|
|
35
|
+
clearTimeout(pasteTimerRef.current);
|
|
36
|
+
pasteTimerRef.current = null;
|
|
37
|
+
}
|
|
38
|
+
// Drain pending input queue first (fast typing during transition)
|
|
39
|
+
const pending = pendingInputRef.current.join('');
|
|
40
|
+
pendingInputRef.current = [];
|
|
41
|
+
const combined = bufferRef.current + pending;
|
|
42
|
+
if (combined) {
|
|
43
|
+
valueRef.current = combined;
|
|
44
|
+
setValue(combined);
|
|
45
|
+
bufferRef.current = '';
|
|
46
|
+
setBufferDisplay('');
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
valueRef.current = '';
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
wasDisabledRef.current = disabled;
|
|
53
|
+
}, [disabled]);
|
|
54
|
+
const completer = useMemo(() => createCompleter(agentNames), [agentNames]);
|
|
55
|
+
// Tab-cycling state
|
|
56
|
+
const tabMatchesRef = useRef([]);
|
|
57
|
+
const tabIndexRef = useRef(0);
|
|
58
|
+
const tabPrefixRef = useRef('');
|
|
59
|
+
// Animate spinner when disabled (processing) — static in NO_COLOR mode
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (!disabled || noColor)
|
|
62
|
+
return;
|
|
63
|
+
const timer = setInterval(() => {
|
|
64
|
+
setSpinFrame(f => (f + 1) % SPINNER_FRAMES.length);
|
|
65
|
+
}, 80);
|
|
66
|
+
return () => clearInterval(timer);
|
|
67
|
+
}, [disabled, noColor]);
|
|
68
|
+
// Clean up paste detection timer on unmount
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
return () => {
|
|
71
|
+
if (pasteTimerRef.current)
|
|
72
|
+
clearTimeout(pasteTimerRef.current);
|
|
73
|
+
};
|
|
74
|
+
}, []);
|
|
8
75
|
useInput((input, key) => {
|
|
9
|
-
if (disabled)
|
|
76
|
+
if (disabled) {
|
|
77
|
+
// Allow slash commands through while processing (read-only, no dispatch)
|
|
78
|
+
if (key.return && bufferRef.current.trimStart().startsWith('/')) {
|
|
79
|
+
const cmd = bufferRef.current.trim();
|
|
80
|
+
bufferRef.current = '';
|
|
81
|
+
setBufferDisplay('');
|
|
82
|
+
pendingInputRef.current = [];
|
|
83
|
+
onSubmit(cmd);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
// Preserve newlines from pasted text in disabled buffer
|
|
87
|
+
if (key.return) {
|
|
88
|
+
bufferRef.current += '\n';
|
|
89
|
+
setBufferDisplay(bufferRef.current);
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
if (key.upArrow || key.downArrow || key.ctrl || key.meta)
|
|
93
|
+
return;
|
|
94
|
+
if (key.backspace || key.delete) {
|
|
95
|
+
bufferRef.current = bufferRef.current.slice(0, -1);
|
|
96
|
+
setBufferDisplay(bufferRef.current);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (input) {
|
|
100
|
+
// Queue input to catch race during disabled→enabled transition
|
|
101
|
+
pendingInputRef.current.push(input);
|
|
102
|
+
bufferRef.current += input;
|
|
103
|
+
setBufferDisplay(bufferRef.current);
|
|
104
|
+
}
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
// Race guard: if we just re-enabled but haven't drained queue yet, queue this too
|
|
108
|
+
if (wasDisabledRef.current && pendingInputRef.current.length > 0) {
|
|
109
|
+
pendingInputRef.current.push(input || '');
|
|
10
110
|
return;
|
|
111
|
+
}
|
|
11
112
|
if (key.return) {
|
|
12
|
-
if
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
113
|
+
// Debounce to detect multi-line paste: if more input arrives
|
|
114
|
+
// within 10ms this is a paste and the newline should be preserved.
|
|
115
|
+
if (pasteTimerRef.current)
|
|
116
|
+
clearTimeout(pasteTimerRef.current);
|
|
117
|
+
valueRef.current += '\n';
|
|
118
|
+
pasteTimerRef.current = setTimeout(() => {
|
|
119
|
+
pasteTimerRef.current = null;
|
|
120
|
+
const submitVal = valueRef.current.trim();
|
|
121
|
+
if (submitVal) {
|
|
122
|
+
onSubmit(submitVal);
|
|
123
|
+
setHistory(prev => [...prev, submitVal]);
|
|
124
|
+
setHistoryIndex(-1);
|
|
125
|
+
}
|
|
126
|
+
valueRef.current = '';
|
|
127
|
+
setValue('');
|
|
128
|
+
}, 10);
|
|
18
129
|
return;
|
|
19
130
|
}
|
|
20
131
|
if (key.backspace || key.delete) {
|
|
21
|
-
|
|
132
|
+
valueRef.current = valueRef.current.slice(0, -1);
|
|
133
|
+
setValue(valueRef.current);
|
|
22
134
|
return;
|
|
23
135
|
}
|
|
24
136
|
if (key.upArrow && history.length > 0) {
|
|
25
137
|
const newIndex = historyIndex === -1 ? history.length - 1 : Math.max(0, historyIndex - 1);
|
|
26
138
|
setHistoryIndex(newIndex);
|
|
139
|
+
valueRef.current = history[newIndex];
|
|
27
140
|
setValue(history[newIndex]);
|
|
28
141
|
return;
|
|
29
142
|
}
|
|
@@ -32,19 +145,48 @@ export const InputPrompt = ({ onSubmit, prompt = '> ', disabled = false }) => {
|
|
|
32
145
|
const newIndex = historyIndex + 1;
|
|
33
146
|
if (newIndex >= history.length) {
|
|
34
147
|
setHistoryIndex(-1);
|
|
148
|
+
valueRef.current = '';
|
|
35
149
|
setValue('');
|
|
36
150
|
}
|
|
37
151
|
else {
|
|
38
152
|
setHistoryIndex(newIndex);
|
|
153
|
+
valueRef.current = history[newIndex];
|
|
39
154
|
setValue(history[newIndex]);
|
|
40
155
|
}
|
|
41
156
|
}
|
|
42
157
|
return;
|
|
43
158
|
}
|
|
159
|
+
if (key.tab) {
|
|
160
|
+
if (tabPrefixRef.current !== value) {
|
|
161
|
+
// New prefix — compute matches
|
|
162
|
+
tabPrefixRef.current = value;
|
|
163
|
+
tabIndexRef.current = 0;
|
|
164
|
+
const [matches] = completer(value);
|
|
165
|
+
tabMatchesRef.current = matches;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
// Same prefix — cycle to next match
|
|
169
|
+
if (tabMatchesRef.current.length > 0) {
|
|
170
|
+
tabIndexRef.current = (tabIndexRef.current + 1) % tabMatchesRef.current.length;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
if (tabMatchesRef.current.length > 0) {
|
|
174
|
+
valueRef.current = tabMatchesRef.current[tabIndexRef.current];
|
|
175
|
+
setValue(tabMatchesRef.current[tabIndexRef.current]);
|
|
176
|
+
}
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
// Reset tab state on any other key
|
|
180
|
+
tabMatchesRef.current = [];
|
|
181
|
+
tabPrefixRef.current = '';
|
|
44
182
|
if (input && !key.ctrl && !key.meta) {
|
|
45
|
-
|
|
183
|
+
valueRef.current += input;
|
|
184
|
+
setValue(valueRef.current);
|
|
46
185
|
}
|
|
47
186
|
});
|
|
48
|
-
|
|
187
|
+
if (disabled) {
|
|
188
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { children: noColor ? (_jsxs(_Fragment, { children: [_jsx(Text, { bold: true, children: narrow ? 'sq ' : '◆ squad ' }), _jsx(Text, { children: "[working...]" }), bufferDisplay ? _jsxs(Text, { children: [" ", bufferDisplay] }) : null] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { color: "cyan", bold: true, children: narrow ? 'sq ' : '◆ squad ' }), _jsx(Text, { color: "cyan", children: SPINNER_FRAMES[spinFrame] }), _jsx(Text, { color: "cyan", bold: true, children: '> ' }), bufferDisplay ? _jsx(Text, { dimColor: true, children: bufferDisplay }) : null] })) }), !bufferDisplay && _jsx(Text, { dimColor: true, children: "[working...]" })] }));
|
|
189
|
+
}
|
|
190
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: noColor ? undefined : 'cyan', bold: true, children: narrow ? 'sq> ' : '◆ squad> ' }), _jsx(Text, { children: value }), _jsx(Text, { color: noColor ? undefined : 'cyan', bold: true, children: "\u258C" })] }), !value && (_jsx(Text, { dimColor: true, children: getHintText(messageCount, narrow) }))] }));
|
|
49
191
|
};
|
|
50
192
|
//# sourceMappingURL=InputPrompt.js.map
|