wave-code 0.8.0 → 0.8.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/components/ChatInterface.js +1 -1
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +1 -38
- package/dist/components/ConfirmationSelector.d.ts.map +1 -1
- package/dist/components/ConfirmationSelector.js +11 -3
- package/dist/components/HelpView.d.ts +2 -0
- package/dist/components/HelpView.d.ts.map +1 -1
- package/dist/components/HelpView.js +49 -5
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +1 -1
- package/dist/components/MessageList.d.ts +2 -2
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +5 -6
- package/dist/constants/commands.d.ts +3 -0
- package/dist/constants/commands.d.ts.map +1 -0
- package/dist/constants/commands.js +38 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +2 -17
- package/dist/hooks/useInputManager.d.ts +7 -8
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +224 -232
- package/dist/managers/inputHandlers.d.ts +28 -0
- package/dist/managers/inputHandlers.d.ts.map +1 -0
- package/dist/managers/inputHandlers.js +378 -0
- package/dist/managers/inputReducer.d.ts +157 -0
- package/dist/managers/inputReducer.d.ts.map +1 -0
- package/dist/managers/inputReducer.js +242 -0
- package/dist/utils/highlightUtils.d.ts.map +1 -1
- package/dist/utils/highlightUtils.js +66 -42
- package/package.json +2 -2
- package/src/components/ChatInterface.tsx +1 -1
- package/src/components/CommandSelector.tsx +1 -40
- package/src/components/ConfirmationSelector.tsx +13 -3
- package/src/components/HelpView.tsx +129 -16
- package/src/components/InputBox.tsx +3 -1
- package/src/components/MessageList.tsx +5 -6
- package/src/constants/commands.ts +41 -0
- package/src/contexts/useChat.tsx +2 -17
- package/src/hooks/useInputManager.ts +352 -299
- package/src/managers/inputHandlers.ts +560 -0
- package/src/managers/inputReducer.ts +367 -0
- package/src/utils/highlightUtils.ts +66 -42
- package/dist/managers/InputManager.d.ts +0 -156
- package/dist/managers/InputManager.d.ts.map +0 -1
- package/dist/managers/InputManager.js +0 -749
- package/src/managers/InputManager.ts +0 -1024
|
@@ -174,7 +174,9 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
174
174
|
}
|
|
175
175
|
|
|
176
176
|
if (showHelp) {
|
|
177
|
-
return
|
|
177
|
+
return (
|
|
178
|
+
<HelpView onCancel={() => setShowHelp(false)} commands={slashCommands} />
|
|
179
|
+
);
|
|
178
180
|
}
|
|
179
181
|
|
|
180
182
|
if (showStatusCommand) {
|
|
@@ -7,7 +7,7 @@ import { MessageBlockItem } from "./MessageBlockItem.js";
|
|
|
7
7
|
export interface MessageListProps {
|
|
8
8
|
messages: Message[];
|
|
9
9
|
isExpanded?: boolean;
|
|
10
|
-
|
|
10
|
+
forceStatic?: boolean;
|
|
11
11
|
version?: string;
|
|
12
12
|
workdir?: string;
|
|
13
13
|
model?: string;
|
|
@@ -17,7 +17,7 @@ export const MessageList = React.memo(
|
|
|
17
17
|
({
|
|
18
18
|
messages,
|
|
19
19
|
isExpanded = false,
|
|
20
|
-
|
|
20
|
+
forceStatic = false,
|
|
21
21
|
version,
|
|
22
22
|
workdir,
|
|
23
23
|
model,
|
|
@@ -54,7 +54,7 @@ export const MessageList = React.memo(
|
|
|
54
54
|
message,
|
|
55
55
|
isLastMessage: messageIndex === messages.length - 1,
|
|
56
56
|
// Unique key for each block to help Static component
|
|
57
|
-
key: `${message.id
|
|
57
|
+
key: `${message.id}-${blockIndex}`,
|
|
58
58
|
}));
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -62,6 +62,7 @@ export const MessageList = React.memo(
|
|
|
62
62
|
const blocksWithStatus = allBlocks.map((item) => {
|
|
63
63
|
const { block, isLastMessage } = item;
|
|
64
64
|
const isDynamic =
|
|
65
|
+
!forceStatic &&
|
|
65
66
|
isLastMessage &&
|
|
66
67
|
((block.type === "tool" && block.stage !== "end") ||
|
|
67
68
|
(block.type === "bang" && block.isRunning));
|
|
@@ -69,9 +70,7 @@ export const MessageList = React.memo(
|
|
|
69
70
|
});
|
|
70
71
|
|
|
71
72
|
const staticBlocks = blocksWithStatus.filter((b) => !b.isDynamic);
|
|
72
|
-
const dynamicBlocks =
|
|
73
|
-
? []
|
|
74
|
-
: blocksWithStatus.filter((b) => b.isDynamic);
|
|
73
|
+
const dynamicBlocks = blocksWithStatus.filter((b) => b.isDynamic);
|
|
75
74
|
|
|
76
75
|
const staticItems = [
|
|
77
76
|
{ isWelcome: true, key: "welcome", block: undefined, message: undefined },
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { SlashCommand } from "wave-agent-sdk";
|
|
2
|
+
|
|
3
|
+
export const AVAILABLE_COMMANDS: SlashCommand[] = [
|
|
4
|
+
{
|
|
5
|
+
id: "clear",
|
|
6
|
+
name: "clear",
|
|
7
|
+
description: "Clear the chat session and terminal",
|
|
8
|
+
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
id: "tasks",
|
|
12
|
+
name: "tasks",
|
|
13
|
+
description: "View and manage background tasks (shells and subagents)",
|
|
14
|
+
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "mcp",
|
|
18
|
+
name: "mcp",
|
|
19
|
+
description: "View and manage MCP servers",
|
|
20
|
+
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: "rewind",
|
|
24
|
+
name: "rewind",
|
|
25
|
+
description:
|
|
26
|
+
"Revert conversation and file changes to a previous checkpoint",
|
|
27
|
+
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
id: "help",
|
|
31
|
+
name: "help",
|
|
32
|
+
description: "Show help and key bindings",
|
|
33
|
+
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "status",
|
|
37
|
+
name: "status",
|
|
38
|
+
description: "Show agent status and configuration",
|
|
39
|
+
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
40
|
+
},
|
|
41
|
+
];
|
package/src/contexts/useChat.tsx
CHANGED
|
@@ -141,7 +141,6 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
141
141
|
|
|
142
142
|
// AI State
|
|
143
143
|
const [messages, setMessages] = useState<Message[]>([]);
|
|
144
|
-
const messagesUpdateTimerRef = useRef<NodeJS.Timeout | null>(null);
|
|
145
144
|
|
|
146
145
|
const [isLoading, setIsLoading] = useState(false);
|
|
147
146
|
const [latestTotalTokens, setlatestTotalTokens] = useState(0);
|
|
@@ -243,15 +242,8 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
243
242
|
const initializeAgent = async () => {
|
|
244
243
|
const callbacks: AgentCallbacks = {
|
|
245
244
|
onMessagesChange: () => {
|
|
246
|
-
if (!isExpandedRef.current) {
|
|
247
|
-
|
|
248
|
-
messagesUpdateTimerRef.current = setTimeout(() => {
|
|
249
|
-
if (agentRef.current) {
|
|
250
|
-
setMessages([...agentRef.current.messages]);
|
|
251
|
-
}
|
|
252
|
-
messagesUpdateTimerRef.current = null;
|
|
253
|
-
}, 100);
|
|
254
|
-
}
|
|
245
|
+
if (!isExpandedRef.current && agentRef.current) {
|
|
246
|
+
setMessages([...agentRef.current.messages]);
|
|
255
247
|
}
|
|
256
248
|
},
|
|
257
249
|
onServersChange: (servers) => {
|
|
@@ -374,9 +366,6 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
374
366
|
// Cleanup on unmount
|
|
375
367
|
useEffect(() => {
|
|
376
368
|
return () => {
|
|
377
|
-
if (messagesUpdateTimerRef.current) {
|
|
378
|
-
clearTimeout(messagesUpdateTimerRef.current);
|
|
379
|
-
}
|
|
380
369
|
if (agentRef.current) {
|
|
381
370
|
try {
|
|
382
371
|
// Display usage summary before cleanup
|
|
@@ -580,10 +569,6 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
580
569
|
setIsExpanded((prev) => {
|
|
581
570
|
const newExpanded = !prev;
|
|
582
571
|
if (newExpanded) {
|
|
583
|
-
if (messagesUpdateTimerRef.current) {
|
|
584
|
-
clearTimeout(messagesUpdateTimerRef.current);
|
|
585
|
-
messagesUpdateTimerRef.current = null;
|
|
586
|
-
}
|
|
587
572
|
// Transitioning to EXPANDED: Freeze the current view
|
|
588
573
|
// Deep copy the last message to ensure it doesn't update if the agent is still writing to it
|
|
589
574
|
setMessages((currentMessages) => {
|