wave-code 0.17.6 → 0.17.7
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/acp/agent.d.ts.map +1 -1
- package/dist/acp/agent.js +217 -176
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +4 -1
- package/dist/constants/commands.d.ts.map +1 -1
- package/dist/constants/commands.js +18 -0
- package/dist/contexts/useChat.d.ts +3 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +21 -0
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +13 -1
- package/dist/managers/inputHandlers.d.ts.map +1 -1
- package/dist/managers/inputHandlers.js +9 -0
- package/dist/managers/inputReducer.d.ts +4 -0
- package/dist/managers/inputReducer.d.ts.map +1 -1
- package/dist/managers/inputReducer.js +5 -0
- package/package.json +2 -2
- package/src/acp/agent.ts +258 -205
- package/src/components/InputBox.tsx +6 -0
- package/src/constants/commands.ts +18 -0
- package/src/contexts/useChat.tsx +27 -0
- package/src/hooks/useInputManager.ts +12 -0
- package/src/managers/inputHandlers.ts +6 -0
- package/src/managers/inputReducer.ts +10 -1
|
@@ -76,6 +76,9 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
76
76
|
sessionId,
|
|
77
77
|
workingDirectory,
|
|
78
78
|
askBtw,
|
|
79
|
+
clearMessages,
|
|
80
|
+
compact,
|
|
81
|
+
goalCommand,
|
|
79
82
|
currentModel,
|
|
80
83
|
configuredModels,
|
|
81
84
|
setModel,
|
|
@@ -155,6 +158,9 @@ export const InputBox: React.FC<InputBoxProps> = ({
|
|
|
155
158
|
} = useInputManager({
|
|
156
159
|
onSendMessage: sendMessage,
|
|
157
160
|
onAskBtw: askBtw,
|
|
161
|
+
onClearMessages: clearMessages,
|
|
162
|
+
onCompact: compact,
|
|
163
|
+
onGoalCommand: goalCommand,
|
|
158
164
|
onHasSlashCommand: hasSlashCommand,
|
|
159
165
|
onAbortMessage: abortMessage,
|
|
160
166
|
onBackgroundCurrentTask: backgroundCurrentTask,
|
|
@@ -68,4 +68,22 @@ export const AVAILABLE_COMMANDS: SlashCommand[] = [
|
|
|
68
68
|
description: "View and manage workflow runs",
|
|
69
69
|
handler: () => {}, // Handler here won't be used, actual processing is in the hook
|
|
70
70
|
},
|
|
71
|
+
{
|
|
72
|
+
id: "clear",
|
|
73
|
+
name: "clear",
|
|
74
|
+
description: "Clear conversation history and reset session",
|
|
75
|
+
handler: () => {},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: "compact",
|
|
79
|
+
name: "compact",
|
|
80
|
+
description: "Compact conversation history to reduce context usage",
|
|
81
|
+
handler: () => {},
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "goal",
|
|
85
|
+
name: "goal",
|
|
86
|
+
description: "Set, check, or clear an autonomous goal for the session",
|
|
87
|
+
handler: () => {},
|
|
88
|
+
},
|
|
71
89
|
];
|
package/src/contexts/useChat.tsx
CHANGED
|
@@ -53,6 +53,9 @@ export interface ChatContextType {
|
|
|
53
53
|
longTextMap?: Record<string, string>,
|
|
54
54
|
) => Promise<void>;
|
|
55
55
|
askBtw: (question: string) => Promise<string>;
|
|
56
|
+
clearMessages: () => Promise<void>;
|
|
57
|
+
compact: (instructions?: string) => Promise<void>;
|
|
58
|
+
goalCommand: (args?: string) => Promise<void>;
|
|
56
59
|
abortMessage: () => void;
|
|
57
60
|
recallQueuedMessage: () => QueuedMessage | null;
|
|
58
61
|
removeQueuedMessageById: (id: string) => boolean;
|
|
@@ -623,6 +626,27 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
623
626
|
return await agentRef.current.askBtw(question);
|
|
624
627
|
}, []);
|
|
625
628
|
|
|
629
|
+
const clearMessages = useCallback(async () => {
|
|
630
|
+
await agentRef.current?.clearMessages();
|
|
631
|
+
}, []);
|
|
632
|
+
|
|
633
|
+
const compact = useCallback(async (instructions?: string) => {
|
|
634
|
+
await agentRef.current?.compact(instructions);
|
|
635
|
+
}, []);
|
|
636
|
+
|
|
637
|
+
const goalCommand = useCallback(async (args?: string) => {
|
|
638
|
+
const trimmed = args?.trim() ?? "";
|
|
639
|
+
if (!trimmed) {
|
|
640
|
+
await agentRef.current?.showGoalStatus();
|
|
641
|
+
} else if (
|
|
642
|
+
["clear", "stop", "off", "reset", "none", "cancel"].includes(trimmed)
|
|
643
|
+
) {
|
|
644
|
+
await agentRef.current?.clearGoal();
|
|
645
|
+
} else {
|
|
646
|
+
await agentRef.current?.setGoal(trimmed);
|
|
647
|
+
}
|
|
648
|
+
}, []);
|
|
649
|
+
|
|
626
650
|
// Unified interrupt method, interrupt both AI messages and command execution
|
|
627
651
|
const abortMessage = useCallback(() => {
|
|
628
652
|
agentRef.current?.abortMessage();
|
|
@@ -824,6 +848,9 @@ export const ChatProvider: React.FC<ChatProviderProps> = ({
|
|
|
824
848
|
sessionId,
|
|
825
849
|
sendMessage,
|
|
826
850
|
askBtw,
|
|
851
|
+
clearMessages,
|
|
852
|
+
compact,
|
|
853
|
+
goalCommand,
|
|
827
854
|
abortMessage,
|
|
828
855
|
recallQueuedMessage,
|
|
829
856
|
removeQueuedMessageById,
|
|
@@ -45,6 +45,9 @@ export const useInputManager = (
|
|
|
45
45
|
logger,
|
|
46
46
|
hasQueuedMessages: hasQueuedMessagesProp,
|
|
47
47
|
onRecallQueuedMessage,
|
|
48
|
+
onClearMessages,
|
|
49
|
+
onCompact,
|
|
50
|
+
onGoalCommand,
|
|
48
51
|
} = callbacks;
|
|
49
52
|
|
|
50
53
|
// Handle debounced file search
|
|
@@ -212,6 +215,12 @@ export const useInputManager = (
|
|
|
212
215
|
dispatch({ type: "SET_SHOW_MODEL_SELECTOR", payload: true });
|
|
213
216
|
} else if (command === "workflows") {
|
|
214
217
|
dispatch({ type: "SET_SHOW_WORKFLOW_MANAGER", payload: true });
|
|
218
|
+
} else if (command === "clear") {
|
|
219
|
+
await onClearMessages?.();
|
|
220
|
+
} else if (command === "compact") {
|
|
221
|
+
await onCompact?.(effect.args);
|
|
222
|
+
} else if (command === "goal") {
|
|
223
|
+
await onGoalCommand?.(effect.args);
|
|
215
224
|
}
|
|
216
225
|
}
|
|
217
226
|
break;
|
|
@@ -238,6 +247,9 @@ export const useInputManager = (
|
|
|
238
247
|
logger,
|
|
239
248
|
onHasSlashCommand,
|
|
240
249
|
onRecallQueuedMessage,
|
|
250
|
+
onClearMessages,
|
|
251
|
+
onCompact,
|
|
252
|
+
onGoalCommand,
|
|
241
253
|
]);
|
|
242
254
|
|
|
243
255
|
useEffect(() => {
|
|
@@ -373,6 +373,12 @@ export const handleCommandSelect = (
|
|
|
373
373
|
dispatch({ type: "SET_SHOW_MODEL_SELECTOR", payload: true });
|
|
374
374
|
} else if (command === "workflows") {
|
|
375
375
|
dispatch({ type: "SET_SHOW_WORKFLOW_MANAGER", payload: true });
|
|
376
|
+
} else if (command === "clear") {
|
|
377
|
+
await callbacks.onClearMessages?.();
|
|
378
|
+
} else if (command === "compact") {
|
|
379
|
+
await callbacks.onCompact?.();
|
|
380
|
+
} else if (command === "goal") {
|
|
381
|
+
await callbacks.onGoalCommand?.();
|
|
376
382
|
}
|
|
377
383
|
}
|
|
378
384
|
})();
|
|
@@ -40,7 +40,7 @@ export type PendingEffect =
|
|
|
40
40
|
| { type: "PERMISSION_MODE_CHANGE"; mode: PermissionMode }
|
|
41
41
|
| { type: "FETCH_HISTORY" }
|
|
42
42
|
| { type: "PASTE_IMAGE" }
|
|
43
|
-
| { type: "EXECUTE_COMMAND"; command: string }
|
|
43
|
+
| { type: "EXECUTE_COMMAND"; command: string; args?: string }
|
|
44
44
|
| { type: "RECALL_QUEUED_MESSAGE" };
|
|
45
45
|
|
|
46
46
|
export interface InputManagerCallbacks {
|
|
@@ -77,6 +77,9 @@ export interface InputManagerCallbacks {
|
|
|
77
77
|
onBackgroundCurrentTask?: () => void;
|
|
78
78
|
onPermissionModeChange?: (mode: PermissionMode) => void;
|
|
79
79
|
onAskBtw?: (question: string) => Promise<string>;
|
|
80
|
+
onClearMessages?: () => Promise<void>;
|
|
81
|
+
onCompact?: (instructions?: string) => Promise<void>;
|
|
82
|
+
onGoalCommand?: (args?: string) => Promise<void>;
|
|
80
83
|
sessionId?: string;
|
|
81
84
|
workdir?: string;
|
|
82
85
|
getFullMessageThread?: () => Promise<{
|
|
@@ -1033,6 +1036,11 @@ export function inputReducer(
|
|
|
1033
1036
|
(cmd) => cmd.id === commandName,
|
|
1034
1037
|
);
|
|
1035
1038
|
if (isInternalCommand) {
|
|
1039
|
+
const argsText =
|
|
1040
|
+
spaceIndex === -1
|
|
1041
|
+
? undefined
|
|
1042
|
+
: contentWithPlaceholders.substring(spaceIndex + 1).trim() ||
|
|
1043
|
+
undefined;
|
|
1036
1044
|
return {
|
|
1037
1045
|
...state,
|
|
1038
1046
|
inputText: "",
|
|
@@ -1042,6 +1050,7 @@ export function inputReducer(
|
|
|
1042
1050
|
pendingEffect: {
|
|
1043
1051
|
type: "EXECUTE_COMMAND",
|
|
1044
1052
|
command: commandName,
|
|
1053
|
+
args: argsText,
|
|
1045
1054
|
},
|
|
1046
1055
|
};
|
|
1047
1056
|
}
|