wave-code 0.0.4 → 0.0.6
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/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +4 -24
- package/dist/components/CommandSelector.js +4 -4
- package/dist/components/DiffViewer.d.ts +1 -1
- package/dist/components/DiffViewer.d.ts.map +1 -1
- package/dist/components/DiffViewer.js +15 -15
- package/dist/components/FileSelector.js +2 -2
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +46 -101
- package/dist/components/Markdown.d.ts +6 -0
- package/dist/components/Markdown.d.ts.map +1 -0
- package/dist/components/Markdown.js +22 -0
- package/dist/components/MessageItem.d.ts +9 -0
- package/dist/components/MessageItem.d.ts.map +1 -0
- package/dist/components/MessageItem.js +15 -0
- package/dist/components/MessageList.d.ts +1 -1
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +33 -32
- package/dist/components/SubagentBlock.d.ts +1 -2
- package/dist/components/SubagentBlock.d.ts.map +1 -1
- package/dist/components/SubagentBlock.js +29 -20
- package/dist/components/ToolResultDisplay.js +5 -5
- package/dist/contexts/useChat.d.ts +1 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +29 -2
- package/dist/hooks/useInputManager.d.ts +93 -0
- package/dist/hooks/useInputManager.d.ts.map +1 -0
- package/dist/hooks/useInputManager.js +332 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -10
- package/dist/managers/InputManager.d.ts +171 -0
- package/dist/managers/InputManager.d.ts.map +1 -0
- package/dist/managers/InputManager.js +826 -0
- package/dist/print-cli.d.ts +8 -0
- package/dist/print-cli.d.ts.map +1 -0
- package/dist/print-cli.js +128 -0
- package/dist/utils/constants.d.ts +1 -1
- package/dist/utils/constants.js +1 -1
- package/dist/utils/fileSearch.d.ts +20 -0
- package/dist/utils/fileSearch.d.ts.map +1 -0
- package/dist/utils/fileSearch.js +102 -0
- package/dist/utils/logger.js +3 -3
- package/dist/utils/usageSummary.d.ts +33 -0
- package/dist/utils/usageSummary.d.ts.map +1 -0
- package/dist/utils/usageSummary.js +154 -0
- package/package.json +10 -6
- package/src/components/ChatInterface.tsx +13 -43
- package/src/components/CommandSelector.tsx +5 -5
- package/src/components/DiffViewer.tsx +18 -16
- package/src/components/FileSelector.tsx +2 -2
- package/src/components/InputBox.tsx +78 -169
- package/src/components/Markdown.tsx +29 -0
- package/src/components/MessageItem.tsx +104 -0
- package/src/components/MessageList.tsx +142 -198
- package/src/components/SubagentBlock.tsx +56 -73
- package/src/components/ToolResultDisplay.tsx +6 -6
- package/src/contexts/useChat.tsx +34 -2
- package/src/hooks/useInputManager.ts +461 -0
- package/src/index.ts +20 -10
- package/src/managers/InputManager.ts +1132 -0
- package/src/print-cli.ts +160 -0
- package/src/utils/constants.ts +1 -1
- package/src/utils/fileSearch.ts +133 -0
- package/src/utils/logger.ts +3 -3
- package/src/utils/usageSummary.ts +234 -0
- package/dist/hooks/useBashHistorySelector.d.ts +0 -15
- package/dist/hooks/useBashHistorySelector.d.ts.map +0 -1
- package/dist/hooks/useBashHistorySelector.js +0 -61
- package/dist/hooks/useCommandSelector.d.ts +0 -24
- package/dist/hooks/useCommandSelector.d.ts.map +0 -1
- package/dist/hooks/useCommandSelector.js +0 -98
- package/dist/hooks/useFileSelector.d.ts +0 -16
- package/dist/hooks/useFileSelector.d.ts.map +0 -1
- package/dist/hooks/useFileSelector.js +0 -174
- package/dist/hooks/useImageManager.d.ts +0 -13
- package/dist/hooks/useImageManager.d.ts.map +0 -1
- package/dist/hooks/useImageManager.js +0 -46
- package/dist/hooks/useInputHistory.d.ts +0 -11
- package/dist/hooks/useInputHistory.d.ts.map +0 -1
- package/dist/hooks/useInputHistory.js +0 -64
- package/dist/hooks/useInputKeyboardHandler.d.ts +0 -83
- package/dist/hooks/useInputKeyboardHandler.d.ts.map +0 -1
- package/dist/hooks/useInputKeyboardHandler.js +0 -507
- package/dist/hooks/useInputState.d.ts +0 -14
- package/dist/hooks/useInputState.d.ts.map +0 -1
- package/dist/hooks/useInputState.js +0 -57
- package/dist/hooks/useMemoryTypeSelector.d.ts +0 -9
- package/dist/hooks/useMemoryTypeSelector.d.ts.map +0 -1
- package/dist/hooks/useMemoryTypeSelector.js +0 -27
- package/dist/plain-cli.d.ts +0 -7
- package/dist/plain-cli.d.ts.map +0 -1
- package/dist/plain-cli.js +0 -44
- package/src/hooks/useBashHistorySelector.ts +0 -77
- package/src/hooks/useCommandSelector.ts +0 -131
- package/src/hooks/useFileSelector.ts +0 -227
- package/src/hooks/useImageManager.ts +0 -64
- package/src/hooks/useInputHistory.ts +0 -74
- package/src/hooks/useInputKeyboardHandler.ts +0 -778
- package/src/hooks/useInputState.ts +0 -66
- package/src/hooks/useMemoryTypeSelector.ts +0 -40
- package/src/plain-cli.ts +0 -60
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { useState, useCallback } from "react";
|
|
2
|
-
|
|
3
|
-
export const useInputState = () => {
|
|
4
|
-
const [inputText, setInputText] = useState("");
|
|
5
|
-
const [cursorPosition, setCursorPosition] = useState(0);
|
|
6
|
-
|
|
7
|
-
const insertTextAtCursor = useCallback((text: string) => {
|
|
8
|
-
setCursorPosition((currentCursor) => {
|
|
9
|
-
setInputText((currentText) => {
|
|
10
|
-
const beforeCursor = currentText.substring(0, currentCursor);
|
|
11
|
-
const afterCursor = currentText.substring(currentCursor);
|
|
12
|
-
return beforeCursor + text + afterCursor;
|
|
13
|
-
});
|
|
14
|
-
return currentCursor + text.length;
|
|
15
|
-
});
|
|
16
|
-
}, []);
|
|
17
|
-
|
|
18
|
-
const deleteCharAtCursor = useCallback(() => {
|
|
19
|
-
setCursorPosition((currentCursor) => {
|
|
20
|
-
if (currentCursor > 0) {
|
|
21
|
-
setInputText((currentText) => {
|
|
22
|
-
const beforeCursor = currentText.substring(0, currentCursor - 1);
|
|
23
|
-
const afterCursor = currentText.substring(currentCursor);
|
|
24
|
-
return beforeCursor + afterCursor;
|
|
25
|
-
});
|
|
26
|
-
return currentCursor - 1;
|
|
27
|
-
}
|
|
28
|
-
return currentCursor;
|
|
29
|
-
});
|
|
30
|
-
}, []);
|
|
31
|
-
|
|
32
|
-
const clearInput = useCallback(() => {
|
|
33
|
-
setInputText("");
|
|
34
|
-
setCursorPosition(0);
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
const moveCursorLeft = useCallback(() => {
|
|
38
|
-
setCursorPosition((current) => Math.max(0, current - 1));
|
|
39
|
-
}, []);
|
|
40
|
-
|
|
41
|
-
const moveCursorRight = useCallback(() => {
|
|
42
|
-
setCursorPosition((current) => Math.min(inputText.length, current + 1));
|
|
43
|
-
}, [inputText.length]);
|
|
44
|
-
|
|
45
|
-
const moveCursorToStart = useCallback(() => {
|
|
46
|
-
setCursorPosition(0);
|
|
47
|
-
}, []);
|
|
48
|
-
|
|
49
|
-
const moveCursorToEnd = useCallback(() => {
|
|
50
|
-
setCursorPosition(inputText.length);
|
|
51
|
-
}, [inputText.length]);
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
inputText,
|
|
55
|
-
setInputText,
|
|
56
|
-
cursorPosition,
|
|
57
|
-
setCursorPosition,
|
|
58
|
-
insertTextAtCursor,
|
|
59
|
-
deleteCharAtCursor,
|
|
60
|
-
clearInput,
|
|
61
|
-
moveCursorLeft,
|
|
62
|
-
moveCursorRight,
|
|
63
|
-
moveCursorToStart,
|
|
64
|
-
moveCursorToEnd,
|
|
65
|
-
};
|
|
66
|
-
};
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
2
|
-
|
|
3
|
-
export interface UseMemoryTypeSelectorReturn {
|
|
4
|
-
showMemoryTypeSelector: boolean;
|
|
5
|
-
memoryMessage: string;
|
|
6
|
-
activateMemoryTypeSelector: (message: string) => void;
|
|
7
|
-
handleMemoryTypeSelect: (type: "project" | "user") => void;
|
|
8
|
-
handleCancelMemoryTypeSelect: () => void;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export const useMemoryTypeSelector = (): UseMemoryTypeSelectorReturn => {
|
|
12
|
-
const [showMemoryTypeSelector, setShowMemoryTypeSelector] = useState(false);
|
|
13
|
-
const [memoryMessage, setMemoryMessage] = useState("");
|
|
14
|
-
|
|
15
|
-
const activateMemoryTypeSelector = (message: string) => {
|
|
16
|
-
setMemoryMessage(message);
|
|
17
|
-
setShowMemoryTypeSelector(true);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const handleMemoryTypeSelect = (type: "project" | "user"): void => {
|
|
21
|
-
setShowMemoryTypeSelector(false);
|
|
22
|
-
setMemoryMessage("");
|
|
23
|
-
// Type parameter is passed by external component, here only responsible for closing selector
|
|
24
|
-
// Actual type handling is completed in useInputKeyboardHandler
|
|
25
|
-
void type; // Explicitly mark parameter as known but unused
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const handleCancelMemoryTypeSelect = () => {
|
|
29
|
-
setShowMemoryTypeSelector(false);
|
|
30
|
-
setMemoryMessage("");
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
return {
|
|
34
|
-
showMemoryTypeSelector,
|
|
35
|
-
memoryMessage,
|
|
36
|
-
activateMemoryTypeSelector,
|
|
37
|
-
handleMemoryTypeSelect,
|
|
38
|
-
handleCancelMemoryTypeSelect,
|
|
39
|
-
};
|
|
40
|
-
};
|
package/src/plain-cli.ts
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Agent, AgentCallbacks } from "wave-agent-sdk";
|
|
2
|
-
import { logger } from "./utils/logger.js";
|
|
3
|
-
|
|
4
|
-
export interface PlainCliOptions {
|
|
5
|
-
restoreSessionId?: string;
|
|
6
|
-
continueLastSession?: boolean;
|
|
7
|
-
message?: string;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export async function startPlainCli(options: PlainCliOptions): Promise<void> {
|
|
11
|
-
const { restoreSessionId, continueLastSession, message } = options;
|
|
12
|
-
|
|
13
|
-
if (
|
|
14
|
-
(!message || message.trim() === "") &&
|
|
15
|
-
!continueLastSession &&
|
|
16
|
-
!restoreSessionId
|
|
17
|
-
) {
|
|
18
|
-
console.error(
|
|
19
|
-
"Plain mode requires a message: use --plain 'your message' or -p 'your message'",
|
|
20
|
-
);
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
let agent: Agent;
|
|
25
|
-
|
|
26
|
-
// Setup callbacks for agent
|
|
27
|
-
const callbacks: AgentCallbacks = {
|
|
28
|
-
onAssistantMessageAdded: (content?: string) => {
|
|
29
|
-
// Only output the content field, not tool calls
|
|
30
|
-
if (content) {
|
|
31
|
-
console.log(content);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
try {
|
|
37
|
-
// Initialize agent
|
|
38
|
-
agent = await Agent.create({
|
|
39
|
-
callbacks,
|
|
40
|
-
restoreSessionId,
|
|
41
|
-
continueLastSession,
|
|
42
|
-
logger,
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
// Send message if provided and not empty
|
|
46
|
-
if (message && message.trim() !== "") {
|
|
47
|
-
await agent.sendMessage(message);
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Destroy agent and exit after sendMessage completes
|
|
51
|
-
agent.destroy();
|
|
52
|
-
process.exit(0);
|
|
53
|
-
} catch (error) {
|
|
54
|
-
console.error("Failed to send message:", error);
|
|
55
|
-
if (agent!) {
|
|
56
|
-
agent.destroy();
|
|
57
|
-
}
|
|
58
|
-
process.exit(1);
|
|
59
|
-
}
|
|
60
|
-
}
|