wave-code 0.6.1 → 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 (66) hide show
  1. package/dist/components/App.d.ts.map +1 -1
  2. package/dist/components/App.js +14 -12
  3. package/dist/components/ChatInterface.d.ts.map +1 -1
  4. package/dist/components/ChatInterface.js +2 -1
  5. package/dist/components/CommandOutputDisplay.d.ts.map +1 -1
  6. package/dist/components/CommandOutputDisplay.js +6 -17
  7. package/dist/components/CommandSelector.d.ts.map +1 -1
  8. package/dist/components/CommandSelector.js +6 -0
  9. package/dist/components/ConfirmationSelector.d.ts.map +1 -1
  10. package/dist/components/ConfirmationSelector.js +1 -1
  11. package/dist/components/DiffDisplay.d.ts.map +1 -1
  12. package/dist/components/DiffDisplay.js +4 -0
  13. package/dist/components/HelpView.d.ts +6 -0
  14. package/dist/components/HelpView.d.ts.map +1 -0
  15. package/dist/components/HelpView.js +24 -0
  16. package/dist/components/InputBox.d.ts +1 -1
  17. package/dist/components/InputBox.d.ts.map +1 -1
  18. package/dist/components/InputBox.js +10 -3
  19. package/dist/components/LoadingIndicator.js +1 -1
  20. package/dist/components/MessageItem.d.ts +1 -1
  21. package/dist/components/MessageItem.d.ts.map +1 -1
  22. package/dist/components/MessageItem.js +3 -4
  23. package/dist/components/MessageList.d.ts.map +1 -1
  24. package/dist/components/MessageList.js +24 -7
  25. package/dist/components/RewindCommand.js +1 -1
  26. package/dist/components/TaskList.d.ts.map +1 -1
  27. package/dist/components/TaskList.js +4 -13
  28. package/dist/components/ToolDisplay.d.ts +9 -0
  29. package/dist/components/ToolDisplay.d.ts.map +1 -0
  30. package/dist/components/ToolDisplay.js +44 -0
  31. package/dist/contexts/useChat.d.ts.map +1 -1
  32. package/dist/contexts/useChat.js +15 -1
  33. package/dist/hooks/useInputManager.d.ts +2 -2
  34. package/dist/hooks/useInputManager.d.ts.map +1 -1
  35. package/dist/hooks/useInputManager.js +12 -8
  36. package/dist/managers/InputManager.d.ts +4 -2
  37. package/dist/managers/InputManager.d.ts.map +1 -1
  38. package/dist/managers/InputManager.js +17 -17
  39. package/dist/print-cli.d.ts.map +1 -1
  40. package/dist/print-cli.js +11 -30
  41. package/package.json +2 -2
  42. package/src/components/App.tsx +16 -15
  43. package/src/components/ChatInterface.tsx +3 -2
  44. package/src/components/CommandOutputDisplay.tsx +16 -38
  45. package/src/components/CommandSelector.tsx +6 -0
  46. package/src/components/ConfirmationSelector.tsx +5 -9
  47. package/src/components/DiffDisplay.tsx +9 -0
  48. package/src/components/HelpView.tsx +59 -0
  49. package/src/components/InputBox.tsx +43 -33
  50. package/src/components/LoadingIndicator.tsx +1 -1
  51. package/src/components/MessageItem.tsx +12 -21
  52. package/src/components/MessageList.tsx +40 -17
  53. package/src/components/RewindCommand.tsx +1 -1
  54. package/src/components/TaskList.tsx +4 -16
  55. package/src/components/{ToolResultDisplay.tsx → ToolDisplay.tsx} +6 -16
  56. package/src/contexts/useChat.tsx +16 -1
  57. package/src/hooks/useInputManager.ts +12 -10
  58. package/src/managers/InputManager.ts +19 -21
  59. package/src/print-cli.ts +17 -35
  60. package/dist/components/SubagentBlock.d.ts +0 -8
  61. package/dist/components/SubagentBlock.d.ts.map +0 -1
  62. package/dist/components/SubagentBlock.js +0 -73
  63. package/dist/components/ToolResultDisplay.d.ts +0 -9
  64. package/dist/components/ToolResultDisplay.d.ts.map +0 -1
  65. package/dist/components/ToolResultDisplay.js +0 -54
  66. package/src/components/SubagentBlock.tsx +0 -152
@@ -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", 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: "gray", 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,152 +0,0 @@
1
- import React, { useMemo } 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, subagentLatestTokens } = useChat();
13
-
14
- // Get messages for this subagent from context
15
- const messages = useMemo(
16
- () => subagentMessages[block.subagentId] || [],
17
- [subagentMessages, block.subagentId],
18
- );
19
-
20
- // Get latest turn tokens for this subagent
21
- const latestTurnTokens = subagentLatestTokens[block.subagentId] || 0;
22
-
23
- // If the subagent is running in the background, don't show the block
24
- if (block.runInBackground) {
25
- return null;
26
- }
27
-
28
- // Status indicator mapping
29
- const getStatusIndicator = (status: SubagentBlockType["status"]) => {
30
- switch (status) {
31
- case "active":
32
- return { icon: "🔄", color: "yellow" as const };
33
- case "completed":
34
- return { icon: "✅", color: "green" as const };
35
- case "error":
36
- return { icon: "❌", color: "red" as const };
37
- case "aborted":
38
- return { icon: "âšī¸", color: "gray" as const };
39
- default:
40
- return { icon: "âŗ", color: "gray" as const };
41
- }
42
- };
43
-
44
- const statusInfo = getStatusIndicator(block.status);
45
-
46
- // Find the last 2 tool names and their compact params, and count total tools
47
- const getLastTwoTools = (): {
48
- tools: Array<{ name: string; compactParams?: string }>;
49
- totalToolCount: number;
50
- } => {
51
- const tools: Array<{ name: string; compactParams?: string }> = [];
52
- let totalToolCount = 0;
53
-
54
- for (let i = messages.length - 1; i >= 0; i--) {
55
- const message = messages[i];
56
- for (let j = message.blocks.length - 1; j >= 0; j--) {
57
- const messageBlock = message.blocks[j];
58
- if (messageBlock.type === "tool" && messageBlock.name) {
59
- totalToolCount++;
60
- if (tools.length < 2) {
61
- tools.push({
62
- name: messageBlock.name,
63
- compactParams: messageBlock.compactParams,
64
- });
65
- }
66
- }
67
- }
68
- }
69
- return { tools: tools.reverse(), totalToolCount }; // Reverse to show oldest first, newest last
70
- };
71
-
72
- const { tools: lastTwoTools } = getLastTwoTools();
73
-
74
- // Get the last text message content if completed
75
- const getLastTextMessage = () => {
76
- if (block.status !== "completed") return null;
77
-
78
- for (let i = messages.length - 1; i >= 0; i--) {
79
- const message = messages[i];
80
- if (message.role === "assistant") {
81
- for (let j = message.blocks.length - 1; j >= 0; j--) {
82
- const messageBlock = message.blocks[j];
83
- if (messageBlock.type === "text" && messageBlock.content) {
84
- return messageBlock.content;
85
- }
86
- }
87
- }
88
- }
89
- return null;
90
- };
91
-
92
- const lastTextMessage = getLastTextMessage();
93
-
94
- return (
95
- <Box
96
- borderRight={false}
97
- borderTop={false}
98
- borderBottom={false}
99
- borderStyle="classic"
100
- borderColor="magenta"
101
- paddingX={1}
102
- flexDirection="column"
103
- >
104
- {/* Header Section */}
105
- <Box flexDirection="row" gap={1}>
106
- <Box flexDirection="row" alignItems="center">
107
- <Text color="cyan">🤖 {block.subagentName}</Text>
108
- <Text color={statusInfo.color} dimColor={false}>
109
- {" "}
110
- {statusInfo.icon}
111
- </Text>
112
- <Text color="gray" dimColor>
113
- {" "}
114
- ({messages.length} messages
115
- {latestTurnTokens > 0 && (
116
- <>
117
- {" | "}
118
- <Text color="blue" bold>
119
- {latestTurnTokens.toLocaleString()}
120
- </Text>
121
- {" tokens"}
122
- </>
123
- )}
124
- )
125
- </Text>
126
- </Box>
127
- </Box>
128
-
129
- {/* Last Text Message Section */}
130
- {lastTextMessage && (
131
- <Box>
132
- <Markdown>{lastTextMessage}</Markdown>
133
- </Box>
134
- )}
135
-
136
- {/* Tool Names Section - Vertical List */}
137
- {block.status !== "completed" && lastTwoTools.length > 0 && (
138
- <Box flexDirection="column">
139
- {lastTwoTools.map((tool, index) => (
140
- <Box key={index} flexDirection="row">
141
- <Text color="magenta">🔧 </Text>
142
- <Text color="white">{tool.name}</Text>
143
- {tool.compactParams && (
144
- <Text color="gray"> {tool.compactParams}</Text>
145
- )}
146
- </Box>
147
- ))}
148
- </Box>
149
- )}
150
- </Box>
151
- );
152
- };