wave-code 0.5.0 → 0.6.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.
Files changed (112) hide show
  1. package/dist/components/App.d.ts.map +1 -1
  2. package/dist/components/App.js +40 -2
  3. package/dist/components/BackgroundTaskManager.d.ts +6 -0
  4. package/dist/components/BackgroundTaskManager.d.ts.map +1 -0
  5. package/dist/components/{TaskManager.js → BackgroundTaskManager.js} +1 -1
  6. package/dist/components/ChatInterface.d.ts.map +1 -1
  7. package/dist/components/ChatInterface.js +40 -5
  8. package/dist/components/CommandOutputDisplay.d.ts.map +1 -1
  9. package/dist/components/CommandOutputDisplay.js +6 -17
  10. package/dist/components/CommandSelector.d.ts.map +1 -1
  11. package/dist/components/CommandSelector.js +16 -2
  12. package/dist/components/CompressDisplay.d.ts.map +1 -1
  13. package/dist/components/CompressDisplay.js +6 -10
  14. package/dist/components/ConfirmationDetails.d.ts +9 -0
  15. package/dist/components/ConfirmationDetails.d.ts.map +1 -0
  16. package/dist/components/ConfirmationDetails.js +53 -0
  17. package/dist/components/{Confirmation.d.ts → ConfirmationSelector.d.ts} +3 -3
  18. package/dist/components/ConfirmationSelector.d.ts.map +1 -0
  19. package/dist/components/{Confirmation.js → ConfirmationSelector.js} +34 -96
  20. package/dist/components/DiffDisplay.d.ts.map +1 -1
  21. package/dist/components/DiffDisplay.js +48 -1
  22. package/dist/components/FileSelector.d.ts.map +1 -1
  23. package/dist/components/FileSelector.js +2 -2
  24. package/dist/components/HelpView.d.ts +6 -0
  25. package/dist/components/HelpView.d.ts.map +1 -0
  26. package/dist/components/HelpView.js +24 -0
  27. package/dist/components/HistorySearch.d.ts.map +1 -1
  28. package/dist/components/HistorySearch.js +12 -4
  29. package/dist/components/InputBox.d.ts +1 -3
  30. package/dist/components/InputBox.d.ts.map +1 -1
  31. package/dist/components/InputBox.js +14 -17
  32. package/dist/components/LoadingIndicator.d.ts +11 -0
  33. package/dist/components/LoadingIndicator.d.ts.map +1 -0
  34. package/dist/components/LoadingIndicator.js +6 -0
  35. package/dist/components/Markdown.d.ts.map +1 -1
  36. package/dist/components/Markdown.js +114 -121
  37. package/dist/components/MessageItem.d.ts +1 -1
  38. package/dist/components/MessageItem.d.ts.map +1 -1
  39. package/dist/components/MessageItem.js +3 -5
  40. package/dist/components/MessageList.d.ts +2 -3
  41. package/dist/components/MessageList.d.ts.map +1 -1
  42. package/dist/components/MessageList.js +29 -12
  43. package/dist/components/PlanDisplay.d.ts.map +1 -1
  44. package/dist/components/PlanDisplay.js +4 -12
  45. package/dist/components/RewindCommand.d.ts +4 -0
  46. package/dist/components/RewindCommand.d.ts.map +1 -1
  47. package/dist/components/RewindCommand.js +20 -3
  48. package/dist/components/TaskList.d.ts +3 -0
  49. package/dist/components/TaskList.d.ts.map +1 -0
  50. package/dist/components/TaskList.js +40 -0
  51. package/dist/components/ToolDisplay.d.ts +9 -0
  52. package/dist/components/ToolDisplay.d.ts.map +1 -0
  53. package/dist/components/ToolDisplay.js +44 -0
  54. package/dist/contexts/useChat.d.ts +11 -3
  55. package/dist/contexts/useChat.d.ts.map +1 -1
  56. package/dist/contexts/useChat.js +51 -32
  57. package/dist/hooks/useInputManager.d.ts +4 -15
  58. package/dist/hooks/useInputManager.d.ts.map +1 -1
  59. package/dist/hooks/useInputManager.js +20 -65
  60. package/dist/hooks/useTasks.d.ts +2 -0
  61. package/dist/hooks/useTasks.d.ts.map +1 -0
  62. package/dist/hooks/useTasks.js +5 -0
  63. package/dist/managers/InputManager.d.ts +8 -30
  64. package/dist/managers/InputManager.d.ts.map +1 -1
  65. package/dist/managers/InputManager.js +38 -144
  66. package/dist/print-cli.d.ts.map +1 -1
  67. package/dist/print-cli.js +11 -30
  68. package/package.json +5 -6
  69. package/src/components/App.tsx +51 -3
  70. package/src/components/{TaskManager.tsx → BackgroundTaskManager.tsx} +4 -2
  71. package/src/components/ChatInterface.tsx +80 -23
  72. package/src/components/CommandOutputDisplay.tsx +16 -38
  73. package/src/components/CommandSelector.tsx +41 -17
  74. package/src/components/CompressDisplay.tsx +5 -22
  75. package/src/components/ConfirmationDetails.tsx +108 -0
  76. package/src/components/{Confirmation.tsx → ConfirmationSelector.tsx} +74 -193
  77. package/src/components/DiffDisplay.tsx +71 -1
  78. package/src/components/FileSelector.tsx +0 -2
  79. package/src/components/HelpView.tsx +59 -0
  80. package/src/components/HistorySearch.tsx +45 -21
  81. package/src/components/InputBox.tsx +51 -63
  82. package/src/components/LoadingIndicator.tsx +56 -0
  83. package/src/components/Markdown.tsx +126 -323
  84. package/src/components/MessageItem.tsx +13 -24
  85. package/src/components/MessageList.tsx +48 -82
  86. package/src/components/PlanDisplay.tsx +4 -27
  87. package/src/components/RewindCommand.tsx +39 -2
  88. package/src/components/TaskList.tsx +58 -0
  89. package/src/components/{ToolResultDisplay.tsx → ToolDisplay.tsx} +8 -18
  90. package/src/contexts/useChat.tsx +73 -41
  91. package/src/hooks/useInputManager.ts +21 -83
  92. package/src/hooks/useTasks.ts +6 -0
  93. package/src/managers/InputManager.ts +43 -179
  94. package/src/print-cli.ts +17 -35
  95. package/dist/components/Confirmation.d.ts.map +0 -1
  96. package/dist/components/MemoryDisplay.d.ts +0 -8
  97. package/dist/components/MemoryDisplay.d.ts.map +0 -1
  98. package/dist/components/MemoryDisplay.js +0 -25
  99. package/dist/components/MemoryTypeSelector.d.ts +0 -8
  100. package/dist/components/MemoryTypeSelector.d.ts.map +0 -1
  101. package/dist/components/MemoryTypeSelector.js +0 -38
  102. package/dist/components/SubagentBlock.d.ts +0 -8
  103. package/dist/components/SubagentBlock.d.ts.map +0 -1
  104. package/dist/components/SubagentBlock.js +0 -70
  105. package/dist/components/TaskManager.d.ts +0 -6
  106. package/dist/components/TaskManager.d.ts.map +0 -1
  107. package/dist/components/ToolResultDisplay.d.ts +0 -9
  108. package/dist/components/ToolResultDisplay.d.ts.map +0 -1
  109. package/dist/components/ToolResultDisplay.js +0 -54
  110. package/src/components/MemoryDisplay.tsx +0 -62
  111. package/src/components/MemoryTypeSelector.tsx +0 -98
  112. package/src/components/SubagentBlock.tsx +0 -143
@@ -1,54 +0,0 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { Box, Text } from "ink";
3
- import { DiffDisplay } from "./DiffDisplay.js";
4
- export const ToolResultDisplay = ({ block, isExpanded = false, }) => {
5
- const { parameters, result, compactParams, stage, success, error, name } = block;
6
- // Directly use compactParams
7
- // (no change needed as we destructured it above)
8
- const getStatusColor = () => {
9
- if (stage === "running")
10
- return "yellow";
11
- if (success)
12
- return "green";
13
- if (error || success === false)
14
- return "red";
15
- return "gray"; // Unknown state or no state information
16
- };
17
- const getStatusText = () => {
18
- if (stage === "running")
19
- return "🔄";
20
- if (success)
21
- return "";
22
- if (error || success === false)
23
- return "❌";
24
- return ""; // Don't display text for unknown state
25
- };
26
- const hasImages = () => {
27
- return block.images && block.images.length > 0;
28
- };
29
- const getImageIndicator = () => {
30
- if (!hasImages())
31
- return "";
32
- const imageCount = block.images.length;
33
- return imageCount === 1 ? "🖼️" : `🖼️×${imageCount}`;
34
- };
35
- const toolName = name ? String(name) : "Tool";
36
- const isBackgroundable = stage === "running" && (toolName === "Bash" || toolName === "Task");
37
- // Get shortResult, if not available show last 5 lines of result
38
- const getShortResult = () => {
39
- if (block.shortResult) {
40
- return block.shortResult;
41
- }
42
- // If no shortResult but has result, return last 5 lines
43
- if (block.result) {
44
- const lines = block.result.split("\n");
45
- if (lines.length > 5) {
46
- return lines.slice(-5).join("\n");
47
- }
48
- return block.result;
49
- }
50
- return null;
51
- };
52
- const shortResult = getShortResult();
53
- return (_jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsxs(Box, { children: [_jsx(Text, { color: "magenta", children: "\uD83D\uDD27 " }), _jsx(Text, { color: "white", children: toolName }), !isExpanded && compactParams && (_jsxs(Text, { color: "gray", children: [" ", compactParams] })), _jsxs(Text, { color: getStatusColor(), children: [" ", getStatusText()] }), hasImages() && _jsxs(Text, { color: "blue", children: [" ", getImageIndicator()] }), isBackgroundable && _jsx(Text, { color: "gray", children: " [Ctrl-B] Background" })] }), !isExpanded && shortResult && !error && (_jsx(Box, { paddingLeft: 2, borderLeft: true, borderColor: "gray", flexDirection: "column", children: shortResult.split("\n").map((line, index) => (_jsx(Text, { color: "white", children: line }, index))) })), isExpanded && parameters && (_jsxs(Box, { paddingLeft: 2, borderLeft: true, borderColor: "gray", flexDirection: "column", children: [_jsx(Text, { color: "cyan", bold: true, children: "Parameters:" }), _jsx(Text, { color: "gray", children: parameters })] })), isExpanded && result && (_jsx(Box, { flexDirection: "column", children: _jsxs(Box, { paddingLeft: 2, borderLeft: true, borderColor: "green", flexDirection: "column", children: [_jsx(Text, { color: "cyan", bold: true, children: "Result:" }), _jsx(Text, { color: "white", children: result })] }) })), error && (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", typeof error === "string" ? error : String(error)] }) })), stage === "end" && success && (_jsx(DiffDisplay, { toolName: name, parameters: parameters }))] }));
54
- };
@@ -1,62 +0,0 @@
1
- import React from "react";
2
- import { Box, Text } from "ink";
3
- import type { MemoryBlock } from "wave-agent-sdk";
4
-
5
- interface MemoryDisplayProps {
6
- block: MemoryBlock;
7
- }
8
-
9
- export const MemoryDisplay: React.FC<MemoryDisplayProps> = ({ block }) => {
10
- const { content, isSuccess, memoryType, storagePath } = block;
11
-
12
- const getStatusIcon = () => {
13
- return isSuccess ? "💾" : "⚠️";
14
- };
15
-
16
- const getStatusColor = () => {
17
- return isSuccess ? "green" : "red";
18
- };
19
-
20
- const getStatusText = () => {
21
- return isSuccess ? "Added to memory" : "Failed to add memory";
22
- };
23
-
24
- const getStorageText = () => {
25
- if (!isSuccess) return null;
26
-
27
- if (memoryType === "user") {
28
- return `Memory saved to ${storagePath || "AGENTS.md"}`;
29
- } else {
30
- return `Memory saved to ${storagePath || "AGENTS.md"}`;
31
- }
32
- };
33
-
34
- return (
35
- <Box flexDirection="column">
36
- <Box>
37
- <Text color={getStatusColor()}>{getStatusIcon()} </Text>
38
- <Text color={getStatusColor()}>{getStatusText()}</Text>
39
- </Box>
40
-
41
- {content && (
42
- <Box marginTop={1} paddingLeft={2}>
43
- <Box
44
- borderLeft
45
- borderColor={isSuccess ? "green" : "red"}
46
- paddingLeft={1}
47
- >
48
- <Text color="gray">{content}</Text>
49
- </Box>
50
- </Box>
51
- )}
52
-
53
- {isSuccess && (
54
- <Box paddingLeft={2} marginTop={1}>
55
- <Text color="yellow" dimColor>
56
- {getStorageText()}
57
- </Text>
58
- </Box>
59
- )}
60
- </Box>
61
- );
62
- };
@@ -1,98 +0,0 @@
1
- import React, { useState } from "react";
2
- import { Box, Text, useInput } from "ink";
3
-
4
- export interface MemoryTypeSelectorProps {
5
- message: string;
6
- onSelect: (type: "project" | "user") => void;
7
- onCancel: () => void;
8
- }
9
-
10
- export const MemoryTypeSelector: React.FC<MemoryTypeSelectorProps> = ({
11
- message,
12
- onSelect,
13
- onCancel,
14
- }) => {
15
- const [selectedIndex, setSelectedIndex] = useState(0);
16
-
17
- const options = [
18
- {
19
- type: "project" as const,
20
- label: "Project Memory",
21
- description: "Save to current project (AGENTS.md)",
22
- },
23
- {
24
- type: "user" as const,
25
- label: "User Memory",
26
- description: "Save to user global memory",
27
- },
28
- ];
29
-
30
- useInput((input, key) => {
31
- if (key.return) {
32
- const selectedOption = options[selectedIndex];
33
- onSelect(selectedOption.type);
34
- return;
35
- }
36
-
37
- if (key.escape) {
38
- onCancel();
39
- return;
40
- }
41
-
42
- if (key.upArrow) {
43
- setSelectedIndex(Math.max(0, selectedIndex - 1));
44
- return;
45
- }
46
-
47
- if (key.downArrow) {
48
- setSelectedIndex(Math.min(options.length - 1, selectedIndex + 1));
49
- return;
50
- }
51
- });
52
-
53
- return (
54
- <Box
55
- flexDirection="column"
56
- borderStyle="single"
57
- borderColor="green"
58
- borderBottom={false}
59
- borderLeft={false}
60
- borderRight={false}
61
- paddingTop={1}
62
- gap={1}
63
- >
64
- <Box>
65
- <Text color="green" bold>
66
- Save Memory: "{message.substring(1).trim()}"
67
- </Text>
68
- </Box>
69
-
70
- <Text color="gray">Choose where to save this memory:</Text>
71
-
72
- {options.map((option, index) => (
73
- <Box key={option.type} flexDirection="column">
74
- <Text
75
- color={index === selectedIndex ? "black" : "white"}
76
- backgroundColor={index === selectedIndex ? "green" : undefined}
77
- bold={index === selectedIndex}
78
- >
79
- {option.label}
80
- </Text>
81
- {index === selectedIndex && (
82
- <Box marginLeft={2}>
83
- <Text color="gray" dimColor>
84
- {option.description}
85
- </Text>
86
- </Box>
87
- )}
88
- </Box>
89
- ))}
90
-
91
- <Box>
92
- <Text dimColor>
93
- Use ↑↓ to navigate, Enter to select, Escape to cancel
94
- </Text>
95
- </Box>
96
- </Box>
97
- );
98
- };
@@ -1,143 +0,0 @@
1
- import React from "react";
2
- import { Box, Text } from "ink";
3
- import type { SubagentBlock as SubagentBlockType } from "wave-agent-sdk";
4
- import { useChat } from "../contexts/useChat.js";
5
- import { Markdown } from "./Markdown.js";
6
-
7
- interface SubagentBlockProps {
8
- block: SubagentBlockType;
9
- }
10
-
11
- export const SubagentBlock: React.FC<SubagentBlockProps> = ({ block }) => {
12
- const { subagentMessages } = useChat();
13
-
14
- // If the subagent is running in the background, don't show the block
15
- if (block.runInBackground) {
16
- return null;
17
- }
18
-
19
- // Get messages for this subagent from context
20
- const messages = subagentMessages[block.subagentId] || [];
21
-
22
- // Status indicator mapping
23
- const getStatusIndicator = (status: SubagentBlockType["status"]) => {
24
- switch (status) {
25
- case "active":
26
- return { icon: "🔄", color: "yellow" as const };
27
- case "completed":
28
- return { icon: "✅", color: "green" as const };
29
- case "error":
30
- return { icon: "❌", color: "red" as const };
31
- case "aborted":
32
- return { icon: "⏹️", color: "gray" as const };
33
- default:
34
- return { icon: "⏳", color: "gray" as const };
35
- }
36
- };
37
-
38
- const statusInfo = getStatusIndicator(block.status);
39
-
40
- // Find the last 2 tool names and their compact params, and count total tools
41
- const getLastTwoTools = (): {
42
- tools: Array<{ name: string; compactParams?: string }>;
43
- totalToolCount: number;
44
- } => {
45
- const tools: Array<{ name: string; compactParams?: string }> = [];
46
- let totalToolCount = 0;
47
-
48
- for (let i = messages.length - 1; i >= 0; i--) {
49
- const message = messages[i];
50
- for (let j = message.blocks.length - 1; j >= 0; j--) {
51
- const messageBlock = message.blocks[j];
52
- if (messageBlock.type === "tool" && messageBlock.name) {
53
- totalToolCount++;
54
- if (tools.length < 2) {
55
- tools.push({
56
- name: messageBlock.name,
57
- compactParams: messageBlock.compactParams,
58
- });
59
- }
60
- }
61
- }
62
- }
63
- return { tools: tools.reverse(), totalToolCount }; // Reverse to show oldest first, newest last
64
- };
65
-
66
- const { tools: lastTwoTools, totalToolCount } = getLastTwoTools();
67
-
68
- // Get the last text message content if completed
69
- const getLastTextMessage = () => {
70
- if (block.status !== "completed") return null;
71
-
72
- for (let i = messages.length - 1; i >= 0; i--) {
73
- const message = messages[i];
74
- if (message.role === "assistant") {
75
- for (let j = message.blocks.length - 1; j >= 0; j--) {
76
- const messageBlock = message.blocks[j];
77
- if (messageBlock.type === "text" && messageBlock.content) {
78
- return messageBlock.content;
79
- }
80
- }
81
- }
82
- }
83
- return null;
84
- };
85
-
86
- const lastTextMessage = getLastTextMessage();
87
-
88
- return (
89
- <Box
90
- borderRight={false}
91
- borderTop={false}
92
- borderBottom={false}
93
- borderStyle="classic"
94
- borderColor="magenta"
95
- paddingX={1}
96
- paddingY={0}
97
- flexDirection="column"
98
- marginBottom={1}
99
- >
100
- {/* Header Section */}
101
- <Box flexDirection="row" gap={1}>
102
- <Box flexDirection="row" alignItems="center">
103
- <Text color="cyan">🤖 {block.subagentName}</Text>
104
- <Text color={statusInfo.color} dimColor={false}>
105
- {" "}
106
- {statusInfo.icon}
107
- </Text>
108
- <Text color="gray" dimColor>
109
- {" "}
110
- ({messages.length} messages)
111
- </Text>
112
- </Box>
113
- </Box>
114
-
115
- {/* Last Text Message Section */}
116
- {lastTextMessage && (
117
- <Box marginTop={1}>
118
- <Markdown>{lastTextMessage}</Markdown>
119
- </Box>
120
- )}
121
-
122
- {/* Tool Names Section - Vertical List */}
123
- {block.status !== "completed" && lastTwoTools.length > 0 && (
124
- <Box flexDirection="column" marginTop={1} gap={1}>
125
- {totalToolCount > 2 && (
126
- <Text color="gray" dimColor>
127
- ...
128
- </Text>
129
- )}
130
- {lastTwoTools.map((tool, index) => (
131
- <Box key={index} flexDirection="row">
132
- <Text color="magenta">🔧 </Text>
133
- <Text color="white">{tool.name}</Text>
134
- {tool.compactParams && (
135
- <Text color="gray"> {tool.compactParams}</Text>
136
- )}
137
- </Box>
138
- ))}
139
- </Box>
140
- )}
141
- </Box>
142
- );
143
- };