wave-code 1.0.10 → 1.1.0

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 (242) hide show
  1. package/bin/wave-code.js +8 -2
  2. package/dist/bundle/wave.mjs +3207 -0
  3. package/package.json +24 -25
  4. package/src/commands/update.ts +2 -7
  5. package/src/components/App.tsx +3 -7
  6. package/src/components/BtwDisplay.tsx +10 -1
  7. package/src/components/ChatInterface.tsx +21 -52
  8. package/src/components/ConfirmationDetails.tsx +144 -37
  9. package/src/components/DiffDisplay.tsx +335 -301
  10. package/src/components/InputBox.tsx +3 -1
  11. package/src/components/LoadingIndicator.tsx +16 -2
  12. package/src/components/MessageBlockItem.tsx +2 -4
  13. package/src/components/MessageList.tsx +75 -14
  14. package/src/components/ReasoningDisplay.tsx +2 -4
  15. package/src/components/SessionSelector.tsx +82 -11
  16. package/src/components/StatusCommand.tsx +2 -9
  17. package/src/components/ToolDisplay.tsx +2 -4
  18. package/src/contexts/useChat.tsx +156 -335
  19. package/src/daemon/commands.ts +57 -27
  20. package/src/daemon/jsonRpcClient.ts +1 -1
  21. package/src/daemon/socketClient.ts +2 -2
  22. package/src/hooks/useInputManager.ts +1 -1
  23. package/src/index.ts +57 -10
  24. package/src/managers/inputReducer.ts +186 -104
  25. package/src/print-cli.ts +21 -17
  26. package/src/reducers/selectorReducer.ts +10 -0
  27. package/src/session-selector-cli.tsx +269 -28
  28. package/src/stdio/agentBridge.ts +22 -21
  29. package/src/stdio/daemonServer.ts +3 -1
  30. package/src/utils/clipboard.ts +21 -0
  31. package/src/utils/highlightUtils.ts +46 -1
  32. package/src/utils/readPackageJson.ts +29 -0
  33. package/src/utils/streamingText.ts +11 -0
  34. package/src/utils/worktree.ts +191 -43
  35. package/dist/cli.d.ts +0 -6
  36. package/dist/cli.js +0 -53
  37. package/dist/commands/plugin/disable.d.ts +0 -5
  38. package/dist/commands/plugin/disable.js +0 -15
  39. package/dist/commands/plugin/enable.d.ts +0 -5
  40. package/dist/commands/plugin/enable.js +0 -15
  41. package/dist/commands/plugin/install.d.ts +0 -5
  42. package/dist/commands/plugin/install.js +0 -21
  43. package/dist/commands/plugin/list.d.ts +0 -1
  44. package/dist/commands/plugin/list.js +0 -31
  45. package/dist/commands/plugin/marketplace.d.ts +0 -10
  46. package/dist/commands/plugin/marketplace.js +0 -90
  47. package/dist/commands/plugin/uninstall.d.ts +0 -3
  48. package/dist/commands/plugin/uninstall.js +0 -16
  49. package/dist/commands/plugin/update.d.ts +0 -3
  50. package/dist/commands/plugin/update.js +0 -15
  51. package/dist/commands/update.d.ts +0 -1
  52. package/dist/commands/update.js +0 -97
  53. package/dist/components/AgentsManager.d.ts +0 -7
  54. package/dist/components/AgentsManager.js +0 -109
  55. package/dist/components/App.d.ts +0 -9
  56. package/dist/components/App.js +0 -76
  57. package/dist/components/BackgroundTaskManager.d.ts +0 -5
  58. package/dist/components/BackgroundTaskManager.js +0 -99
  59. package/dist/components/BangDisplay.d.ts +0 -8
  60. package/dist/components/BangDisplay.js +0 -17
  61. package/dist/components/BtwDisplay.d.ts +0 -7
  62. package/dist/components/BtwDisplay.js +0 -19
  63. package/dist/components/ChatInterface.d.ts +0 -2
  64. package/dist/components/ChatInterface.js +0 -61
  65. package/dist/components/CommandSelector.d.ts +0 -10
  66. package/dist/components/CommandSelector.js +0 -66
  67. package/dist/components/CompactDisplay.d.ts +0 -8
  68. package/dist/components/CompactDisplay.js +0 -13
  69. package/dist/components/ConfirmationDetails.d.ts +0 -9
  70. package/dist/components/ConfirmationDetails.js +0 -45
  71. package/dist/components/ConfirmationSelector.d.ts +0 -13
  72. package/dist/components/ConfirmationSelector.js +0 -127
  73. package/dist/components/DiffDisplay.d.ts +0 -8
  74. package/dist/components/DiffDisplay.js +0 -201
  75. package/dist/components/DiscoverView.d.ts +0 -2
  76. package/dist/components/DiscoverView.js +0 -37
  77. package/dist/components/FileSelector.d.ts +0 -11
  78. package/dist/components/FileSelector.js +0 -50
  79. package/dist/components/HelpView.d.ts +0 -7
  80. package/dist/components/HelpView.js +0 -74
  81. package/dist/components/HistorySearch.d.ts +0 -8
  82. package/dist/components/HistorySearch.js +0 -66
  83. package/dist/components/InputBox.d.ts +0 -24
  84. package/dist/components/InputBox.js +0 -149
  85. package/dist/components/InstalledView.d.ts +0 -2
  86. package/dist/components/InstalledView.js +0 -45
  87. package/dist/components/LoadingIndicator.d.ts +0 -10
  88. package/dist/components/LoadingIndicator.js +0 -6
  89. package/dist/components/LoginCommand.d.ts +0 -5
  90. package/dist/components/LoginCommand.js +0 -153
  91. package/dist/components/Markdown.d.ts +0 -5
  92. package/dist/components/Markdown.js +0 -127
  93. package/dist/components/MarketplaceAddForm.d.ts +0 -2
  94. package/dist/components/MarketplaceAddForm.js +0 -55
  95. package/dist/components/MarketplaceDetail.d.ts +0 -2
  96. package/dist/components/MarketplaceDetail.js +0 -74
  97. package/dist/components/MarketplaceList.d.ts +0 -8
  98. package/dist/components/MarketplaceList.js +0 -17
  99. package/dist/components/MarketplaceView.d.ts +0 -2
  100. package/dist/components/MarketplaceView.js +0 -41
  101. package/dist/components/McpManager.d.ts +0 -9
  102. package/dist/components/McpManager.js +0 -88
  103. package/dist/components/MessageBlockItem.d.ts +0 -8
  104. package/dist/components/MessageBlockItem.js +0 -15
  105. package/dist/components/MessageList.d.ts +0 -10
  106. package/dist/components/MessageList.js +0 -80
  107. package/dist/components/ModelSelector.d.ts +0 -8
  108. package/dist/components/ModelSelector.js +0 -45
  109. package/dist/components/Notifications.d.ts +0 -7
  110. package/dist/components/Notifications.js +0 -9
  111. package/dist/components/PlanDisplay.d.ts +0 -7
  112. package/dist/components/PlanDisplay.js +0 -6
  113. package/dist/components/PluginDetail.d.ts +0 -2
  114. package/dist/components/PluginDetail.js +0 -87
  115. package/dist/components/PluginList.d.ts +0 -13
  116. package/dist/components/PluginList.js +0 -15
  117. package/dist/components/PluginManagerShell.d.ts +0 -6
  118. package/dist/components/PluginManagerShell.js +0 -92
  119. package/dist/components/PluginManagerTypes.d.ts +0 -35
  120. package/dist/components/PluginManagerTypes.js +0 -1
  121. package/dist/components/QueuedMessageList.d.ts +0 -2
  122. package/dist/components/QueuedMessageList.js +0 -18
  123. package/dist/components/ReasoningDisplay.d.ts +0 -8
  124. package/dist/components/ReasoningDisplay.js +0 -13
  125. package/dist/components/RewindCommand.d.ts +0 -12
  126. package/dist/components/RewindCommand.js +0 -78
  127. package/dist/components/SessionSelector.d.ts +0 -12
  128. package/dist/components/SessionSelector.js +0 -47
  129. package/dist/components/StatusCommand.d.ts +0 -5
  130. package/dist/components/StatusCommand.js +0 -28
  131. package/dist/components/StatusLine.d.ts +0 -6
  132. package/dist/components/StatusLine.js +0 -9
  133. package/dist/components/TaskList.d.ts +0 -5
  134. package/dist/components/TaskList.js +0 -197
  135. package/dist/components/TaskNotificationMessage.d.ts +0 -5
  136. package/dist/components/TaskNotificationMessage.js +0 -12
  137. package/dist/components/ToolDisplay.d.ts +0 -9
  138. package/dist/components/ToolDisplay.js +0 -55
  139. package/dist/components/WorkflowManager.d.ts +0 -5
  140. package/dist/components/WorkflowManager.js +0 -102
  141. package/dist/components/WorktreeExitPrompt.d.ts +0 -12
  142. package/dist/components/WorktreeExitPrompt.js +0 -35
  143. package/dist/constants/commands.d.ts +0 -2
  144. package/dist/constants/commands.js +0 -92
  145. package/dist/contexts/PluginManagerContext.d.ts +0 -3
  146. package/dist/contexts/PluginManagerContext.js +0 -9
  147. package/dist/contexts/useAppConfig.d.ts +0 -10
  148. package/dist/contexts/useAppConfig.js +0 -13
  149. package/dist/contexts/useChat.d.ts +0 -101
  150. package/dist/contexts/useChat.js +0 -993
  151. package/dist/contracts/status.d.ts +0 -7
  152. package/dist/contracts/status.js +0 -1
  153. package/dist/daemon/commands.d.ts +0 -49
  154. package/dist/daemon/commands.js +0 -341
  155. package/dist/daemon/jsonRpcClient.d.ts +0 -38
  156. package/dist/daemon/jsonRpcClient.js +0 -129
  157. package/dist/daemon/socketClient.d.ts +0 -13
  158. package/dist/daemon/socketClient.js +0 -26
  159. package/dist/daemon-cli.d.ts +0 -10
  160. package/dist/daemon-cli.js +0 -15
  161. package/dist/hooks/useInputManager.d.ts +0 -75
  162. package/dist/hooks/useInputManager.js +0 -583
  163. package/dist/hooks/usePluginManager.d.ts +0 -4
  164. package/dist/hooks/usePluginManager.js +0 -265
  165. package/dist/hooks/useTasks.d.ts +0 -1
  166. package/dist/hooks/useTasks.js +0 -5
  167. package/dist/index.d.ts +0 -4
  168. package/dist/index.js +0 -447
  169. package/dist/managers/inputHandlers.d.ts +0 -30
  170. package/dist/managers/inputHandlers.js +0 -625
  171. package/dist/managers/inputReducer.d.ts +0 -271
  172. package/dist/managers/inputReducer.js +0 -1121
  173. package/dist/plugin-manager-cli.d.ts +0 -5
  174. package/dist/plugin-manager-cli.js +0 -12
  175. package/dist/print-cli.d.ts +0 -10
  176. package/dist/print-cli.js +0 -209
  177. package/dist/reducers/agentsManagerReducer.d.ts +0 -26
  178. package/dist/reducers/agentsManagerReducer.js +0 -54
  179. package/dist/reducers/backgroundTaskManagerReducer.d.ts +0 -62
  180. package/dist/reducers/backgroundTaskManagerReducer.js +0 -106
  181. package/dist/reducers/confirmationReducer.d.ts +0 -37
  182. package/dist/reducers/confirmationReducer.js +0 -193
  183. package/dist/reducers/helpSelectorReducer.d.ts +0 -25
  184. package/dist/reducers/helpSelectorReducer.js +0 -52
  185. package/dist/reducers/marketplaceAddFormReducer.d.ts +0 -24
  186. package/dist/reducers/marketplaceAddFormReducer.js +0 -58
  187. package/dist/reducers/mcpManagerReducer.d.ts +0 -37
  188. package/dist/reducers/mcpManagerReducer.js +0 -74
  189. package/dist/reducers/pluginDetailReducer.d.ts +0 -32
  190. package/dist/reducers/pluginDetailReducer.js +0 -70
  191. package/dist/reducers/questionReducer.d.ts +0 -82
  192. package/dist/reducers/questionReducer.js +0 -375
  193. package/dist/reducers/rewindSelectorReducer.d.ts +0 -21
  194. package/dist/reducers/rewindSelectorReducer.js +0 -37
  195. package/dist/reducers/selectorReducer.d.ts +0 -23
  196. package/dist/reducers/selectorReducer.js +0 -42
  197. package/dist/reducers/workflowManagerReducer.d.ts +0 -40
  198. package/dist/reducers/workflowManagerReducer.js +0 -100
  199. package/dist/session-selector-cli.d.ts +0 -3
  200. package/dist/session-selector-cli.js +0 -25
  201. package/dist/stdio/agentBridge.d.ts +0 -139
  202. package/dist/stdio/agentBridge.js +0 -999
  203. package/dist/stdio/daemonServer.d.ts +0 -67
  204. package/dist/stdio/daemonServer.js +0 -191
  205. package/dist/stdio/index.d.ts +0 -5
  206. package/dist/stdio/index.js +0 -5
  207. package/dist/stdio/jsonRpcConnection.d.ts +0 -39
  208. package/dist/stdio/jsonRpcConnection.js +0 -135
  209. package/dist/stdio/protocol.d.ts +0 -41
  210. package/dist/stdio/protocol.js +0 -26
  211. package/dist/stdio/stdioServer.d.ts +0 -36
  212. package/dist/stdio/stdioServer.js +0 -51
  213. package/dist/stdio-cli.d.ts +0 -8
  214. package/dist/stdio-cli.js +0 -15
  215. package/dist/types.d.ts +0 -20
  216. package/dist/types.js +0 -1
  217. package/dist/utils/bracketedPaste.d.ts +0 -39
  218. package/dist/utils/bracketedPaste.js +0 -122
  219. package/dist/utils/clipboard.d.ts +0 -21
  220. package/dist/utils/clipboard.js +0 -347
  221. package/dist/utils/constants.d.ts +0 -16
  222. package/dist/utils/constants.js +0 -18
  223. package/dist/utils/highlightUtils.d.ts +0 -1
  224. package/dist/utils/highlightUtils.js +0 -93
  225. package/dist/utils/inputUtils.d.ts +0 -17
  226. package/dist/utils/inputUtils.js +0 -67
  227. package/dist/utils/logger.d.ts +0 -71
  228. package/dist/utils/logger.js +0 -259
  229. package/dist/utils/markdownTable.d.ts +0 -34
  230. package/dist/utils/markdownTable.js +0 -302
  231. package/dist/utils/rewindCheckpoints.d.ts +0 -8
  232. package/dist/utils/rewindCheckpoints.js +0 -17
  233. package/dist/utils/throttle.d.ts +0 -14
  234. package/dist/utils/throttle.js +0 -55
  235. package/dist/utils/toolParameterTransforms.d.ts +0 -18
  236. package/dist/utils/toolParameterTransforms.js +0 -73
  237. package/dist/utils/usageSummary.d.ts +0 -28
  238. package/dist/utils/usageSummary.js +0 -121
  239. package/dist/utils/version.d.ts +0 -1
  240. package/dist/utils/version.js +0 -4
  241. package/dist/utils/worktree.d.ts +0 -35
  242. package/dist/utils/worktree.js +0 -219
@@ -1,193 +0,0 @@
1
- import { BASH_TOOL_NAME, EXIT_PLAN_MODE_TOOL_NAME, ENTER_PLAN_MODE_TOOL_NAME, } from "wave-agent-sdk";
2
- export function confirmationReducer(state, action) {
3
- switch (action.type) {
4
- case "SELECT_OPTION":
5
- return { ...state, selectedOption: action.option };
6
- case "INSERT_TEXT": {
7
- const sanitized = action.text.replace(/\r\n?|\n/g, " ");
8
- const nextText = state.alternativeText.slice(0, state.alternativeCursorPosition) +
9
- sanitized +
10
- state.alternativeText.slice(state.alternativeCursorPosition);
11
- return {
12
- ...state,
13
- selectedOption: "alternative",
14
- alternativeText: nextText,
15
- alternativeCursorPosition: state.alternativeCursorPosition + sanitized.length,
16
- hasUserInput: true,
17
- };
18
- }
19
- case "BACKSPACE": {
20
- if (state.alternativeCursorPosition <= 0)
21
- return state;
22
- const nextText = state.alternativeText.slice(0, state.alternativeCursorPosition - 1) +
23
- state.alternativeText.slice(state.alternativeCursorPosition);
24
- return {
25
- ...state,
26
- selectedOption: "alternative",
27
- alternativeText: nextText,
28
- alternativeCursorPosition: state.alternativeCursorPosition - 1,
29
- hasUserInput: nextText.length > 0,
30
- };
31
- }
32
- case "MOVE_CURSOR_LEFT":
33
- return {
34
- ...state,
35
- alternativeCursorPosition: Math.max(0, state.alternativeCursorPosition - 1),
36
- };
37
- case "MOVE_CURSOR_RIGHT":
38
- return {
39
- ...state,
40
- alternativeCursorPosition: Math.min(state.alternativeText.length, state.alternativeCursorPosition + 1),
41
- };
42
- case "CONFIRM":
43
- return { ...state, decision: action.decision };
44
- case "CLEAR_DECISION":
45
- return { ...state, decision: null };
46
- case "HANDLE_KEY": {
47
- const { input, key, toolName, toolInput, suggestedPrefix, hidePersistentOption, permissionMode, } = action;
48
- if (key.return) {
49
- let decision = null;
50
- if (state.selectedOption === "allow") {
51
- if (toolName === EXIT_PLAN_MODE_TOOL_NAME) {
52
- decision = { behavior: "allow", newPermissionMode: "default" };
53
- }
54
- else if (toolName === ENTER_PLAN_MODE_TOOL_NAME) {
55
- decision = { behavior: "allow", newPermissionMode: "plan" };
56
- }
57
- else {
58
- decision = { behavior: "allow" };
59
- }
60
- }
61
- else if (state.selectedOption === "auto") {
62
- if (toolName === BASH_TOOL_NAME) {
63
- const command = toolInput?.command || "";
64
- if (command.trim().startsWith("mkdir")) {
65
- decision = {
66
- behavior: "allow",
67
- newPermissionMode: "acceptEdits",
68
- };
69
- }
70
- else {
71
- const rule = suggestedPrefix
72
- ? `Bash(${suggestedPrefix})`
73
- : `Bash(${toolInput?.command})`;
74
- decision = { behavior: "allow", newPermissionRule: rule };
75
- }
76
- }
77
- else if (toolName === ENTER_PLAN_MODE_TOOL_NAME) {
78
- decision = { behavior: "allow", newPermissionMode: "plan" };
79
- }
80
- else if (toolName.startsWith("mcp__")) {
81
- decision = { behavior: "allow", newPermissionRule: toolName };
82
- }
83
- else {
84
- decision = { behavior: "allow", newPermissionMode: "acceptEdits" };
85
- }
86
- }
87
- else if (state.selectedOption === "bypass") {
88
- decision = {
89
- behavior: "allow",
90
- newPermissionMode: "bypassPermissions",
91
- };
92
- }
93
- else if (state.alternativeText.trim()) {
94
- decision = {
95
- behavior: "deny",
96
- message: state.alternativeText.trim(),
97
- };
98
- }
99
- else if (toolName === ENTER_PLAN_MODE_TOOL_NAME) {
100
- decision = {
101
- behavior: "deny",
102
- message: "User chose not to enter plan mode",
103
- };
104
- }
105
- if (decision) {
106
- return { ...state, decision };
107
- }
108
- return state;
109
- }
110
- if (state.selectedOption === "alternative") {
111
- if (key.leftArrow) {
112
- return {
113
- ...state,
114
- alternativeCursorPosition: Math.max(0, state.alternativeCursorPosition - 1),
115
- };
116
- }
117
- if (key.rightArrow) {
118
- return {
119
- ...state,
120
- alternativeCursorPosition: Math.min(state.alternativeText.length, state.alternativeCursorPosition + 1),
121
- };
122
- }
123
- }
124
- const availableOptions = [];
125
- availableOptions.push("allow");
126
- if (!hidePersistentOption)
127
- availableOptions.push("auto");
128
- if (toolName === EXIT_PLAN_MODE_TOOL_NAME ||
129
- (toolName === BASH_TOOL_NAME && permissionMode !== "plan"))
130
- availableOptions.push("bypass");
131
- availableOptions.push("alternative");
132
- if (key.upArrow) {
133
- const currentIndex = availableOptions.indexOf(state.selectedOption);
134
- if (currentIndex > 0) {
135
- return {
136
- ...state,
137
- selectedOption: availableOptions[currentIndex - 1],
138
- };
139
- }
140
- return state;
141
- }
142
- if (key.downArrow) {
143
- const currentIndex = availableOptions.indexOf(state.selectedOption);
144
- if (currentIndex < availableOptions.length - 1) {
145
- return {
146
- ...state,
147
- selectedOption: availableOptions[currentIndex + 1],
148
- };
149
- }
150
- return state;
151
- }
152
- if (key.tab) {
153
- const currentIndex = availableOptions.indexOf(state.selectedOption);
154
- const direction = key.shift ? -1 : 1;
155
- let nextIndex = currentIndex + direction;
156
- if (nextIndex < 0)
157
- nextIndex = availableOptions.length - 1;
158
- if (nextIndex >= availableOptions.length)
159
- nextIndex = 0;
160
- return { ...state, selectedOption: availableOptions[nextIndex] };
161
- }
162
- if (input && !key.ctrl && !key.meta && !("alt" in key && key.alt)) {
163
- const sanitized = input.replace(/\r\n?|\n/g, " ");
164
- const nextText = state.alternativeText.slice(0, state.alternativeCursorPosition) +
165
- sanitized +
166
- state.alternativeText.slice(state.alternativeCursorPosition);
167
- return {
168
- ...state,
169
- selectedOption: "alternative",
170
- alternativeText: nextText,
171
- alternativeCursorPosition: state.alternativeCursorPosition + sanitized.length,
172
- hasUserInput: true,
173
- };
174
- }
175
- if (key.backspace || key.delete) {
176
- if (state.alternativeCursorPosition <= 0)
177
- return state;
178
- const nextText = state.alternativeText.slice(0, state.alternativeCursorPosition - 1) +
179
- state.alternativeText.slice(state.alternativeCursorPosition);
180
- return {
181
- ...state,
182
- selectedOption: "alternative",
183
- alternativeText: nextText,
184
- alternativeCursorPosition: state.alternativeCursorPosition - 1,
185
- hasUserInput: nextText.length > 0,
186
- };
187
- }
188
- return state;
189
- }
190
- default:
191
- return state;
192
- }
193
- }
@@ -1,25 +0,0 @@
1
- import { Key } from "ink";
2
- export interface SelectorState {
3
- selectedIndex: number;
4
- activeTab: "general" | "commands" | "custom-commands";
5
- pendingDecision: "select" | "insert" | "cancel" | "tab-switch" | null;
6
- }
7
- export type SelectorAction = {
8
- type: "MOVE_UP";
9
- } | {
10
- type: "MOVE_DOWN";
11
- maxIndex: number;
12
- } | {
13
- type: "RESET_INDEX";
14
- } | {
15
- type: "SWITCH_TAB";
16
- tabs: string[];
17
- } | {
18
- type: "HANDLE_KEY";
19
- key: Key;
20
- maxIndex: number;
21
- tabs: string[];
22
- } | {
23
- type: "CLEAR_DECISION";
24
- };
25
- export declare function helpSelectorReducer(state: SelectorState, action: SelectorAction): SelectorState;
@@ -1,52 +0,0 @@
1
- export function helpSelectorReducer(state, action) {
2
- switch (action.type) {
3
- case "MOVE_UP":
4
- return { ...state, selectedIndex: Math.max(0, state.selectedIndex - 1) };
5
- case "MOVE_DOWN":
6
- return {
7
- ...state,
8
- selectedIndex: Math.min(action.maxIndex, state.selectedIndex + 1),
9
- };
10
- case "RESET_INDEX":
11
- return { ...state, selectedIndex: 0 };
12
- case "SWITCH_TAB": {
13
- const currentIndex = action.tabs.indexOf(state.activeTab);
14
- const nextIndex = (currentIndex + 1) % action.tabs.length;
15
- return {
16
- ...state,
17
- activeTab: action.tabs[nextIndex],
18
- selectedIndex: 0,
19
- };
20
- }
21
- case "HANDLE_KEY":
22
- if (action.key.upArrow) {
23
- return {
24
- ...state,
25
- selectedIndex: Math.max(0, state.selectedIndex - 1),
26
- };
27
- }
28
- if (action.key.downArrow) {
29
- return {
30
- ...state,
31
- selectedIndex: Math.min(action.maxIndex, state.selectedIndex + 1),
32
- };
33
- }
34
- if (action.key.tab) {
35
- const currentIndex = action.tabs.indexOf(state.activeTab);
36
- const nextIndex = (currentIndex + 1) % action.tabs.length;
37
- return {
38
- ...state,
39
- activeTab: action.tabs[nextIndex],
40
- selectedIndex: 0,
41
- };
42
- }
43
- if (action.key.escape) {
44
- return { ...state, pendingDecision: "cancel" };
45
- }
46
- return state;
47
- case "CLEAR_DECISION":
48
- return { ...state, pendingDecision: null };
49
- default:
50
- return state;
51
- }
52
- }
@@ -1,24 +0,0 @@
1
- import { Key } from "ink";
2
- export declare const SCOPES: readonly ["user", "project", "local"];
3
- export type Scope = (typeof SCOPES)[number];
4
- export interface MarketplaceAddFormState {
5
- source: string;
6
- scopeIndex: number;
7
- step: "source" | "scope";
8
- pendingAction: {
9
- type: "submit";
10
- source: string;
11
- scope: Scope;
12
- } | {
13
- type: "cancel";
14
- } | null;
15
- }
16
- export type MarketplaceAddFormAction = {
17
- type: "HANDLE_KEY";
18
- key: Key;
19
- input: string;
20
- isLoading: boolean;
21
- } | {
22
- type: "CLEAR_PENDING_ACTION";
23
- };
24
- export declare function marketplaceAddFormReducer(state: MarketplaceAddFormState, action: MarketplaceAddFormAction): MarketplaceAddFormState;
@@ -1,58 +0,0 @@
1
- export const SCOPES = ["user", "project", "local"];
2
- export function marketplaceAddFormReducer(state, action) {
3
- switch (action.type) {
4
- case "HANDLE_KEY": {
5
- const { key, input, isLoading } = action;
6
- // Escape always works, even during loading
7
- if (key.escape) {
8
- if (state.step === "scope") {
9
- return { ...state, step: "source" };
10
- }
11
- return { ...state, pendingAction: { type: "cancel" } };
12
- }
13
- // Ignore all other input during loading
14
- if (isLoading)
15
- return state;
16
- if (state.step === "source") {
17
- if (key.return) {
18
- if (state.source.trim()) {
19
- return { ...state, step: "scope" };
20
- }
21
- return state;
22
- }
23
- if (key.backspace || key.delete) {
24
- return { ...state, source: state.source.slice(0, -1) };
25
- }
26
- if (input && !key.ctrl && !key.meta && !("alt" in key && key.alt)) {
27
- return { ...state, source: state.source + input };
28
- }
29
- return state;
30
- }
31
- // step === "scope"
32
- if (key.upArrow) {
33
- return { ...state, scopeIndex: Math.max(0, state.scopeIndex - 1) };
34
- }
35
- if (key.downArrow) {
36
- return {
37
- ...state,
38
- scopeIndex: Math.min(SCOPES.length - 1, state.scopeIndex + 1),
39
- };
40
- }
41
- if (key.return) {
42
- return {
43
- ...state,
44
- pendingAction: {
45
- type: "submit",
46
- source: state.source.trim(),
47
- scope: SCOPES[state.scopeIndex],
48
- },
49
- };
50
- }
51
- return state;
52
- }
53
- case "CLEAR_PENDING_ACTION":
54
- return { ...state, pendingAction: null };
55
- default:
56
- return state;
57
- }
58
- }
@@ -1,37 +0,0 @@
1
- import { Key } from "ink";
2
- export type PendingEffect = {
3
- type: "CANCEL";
4
- } | {
5
- type: "CONNECT_SERVER";
6
- serverName: string;
7
- } | {
8
- type: "DISCONNECT_SERVER";
9
- serverName: string;
10
- };
11
- export interface McpManagerState {
12
- selectedIndex: number;
13
- viewMode: "list" | "detail";
14
- pendingEffect: PendingEffect | null;
15
- }
16
- export type McpManagerAction = {
17
- type: "MOVE_UP";
18
- serverCount: number;
19
- } | {
20
- type: "MOVE_DOWN";
21
- serverCount: number;
22
- } | {
23
- type: "SET_VIEW_MODE";
24
- viewMode: "list" | "detail";
25
- } | {
26
- type: "HANDLE_KEY";
27
- input: string;
28
- key: Key;
29
- serverCount: number;
30
- servers: Array<{
31
- name: string;
32
- status: string;
33
- }>;
34
- } | {
35
- type: "CLEAR_PENDING_EFFECT";
36
- };
37
- export declare function mcpManagerReducer(state: McpManagerState, action: McpManagerAction): McpManagerState;
@@ -1,74 +0,0 @@
1
- export function mcpManagerReducer(state, action) {
2
- switch (action.type) {
3
- case "MOVE_UP":
4
- return { ...state, selectedIndex: Math.max(0, state.selectedIndex - 1) };
5
- case "MOVE_DOWN":
6
- return {
7
- ...state,
8
- selectedIndex: Math.min(action.serverCount - 1, state.selectedIndex + 1),
9
- };
10
- case "SET_VIEW_MODE":
11
- return { ...state, viewMode: action.viewMode };
12
- case "HANDLE_KEY": {
13
- const { input, key, serverCount, servers } = action;
14
- if (key.return) {
15
- if (state.viewMode === "list") {
16
- return { ...state, viewMode: "detail" };
17
- }
18
- return state;
19
- }
20
- if (key.escape) {
21
- if (state.viewMode === "detail") {
22
- return { ...state, viewMode: "list" };
23
- }
24
- else {
25
- return { ...state, pendingEffect: { type: "CANCEL" } };
26
- }
27
- }
28
- if (key.upArrow) {
29
- return {
30
- ...state,
31
- selectedIndex: Math.max(0, state.selectedIndex - 1),
32
- };
33
- }
34
- if (key.downArrow) {
35
- return {
36
- ...state,
37
- selectedIndex: Math.min(serverCount - 1, state.selectedIndex + 1),
38
- };
39
- }
40
- // Hotkeys for server actions
41
- if (input === "c") {
42
- const server = servers[state.selectedIndex];
43
- if (server &&
44
- (server.status === "disconnected" ||
45
- server.status === "error" ||
46
- server.status === "reconnecting")) {
47
- return {
48
- ...state,
49
- pendingEffect: { type: "CONNECT_SERVER", serverName: server.name },
50
- };
51
- }
52
- return state;
53
- }
54
- if (input === "d") {
55
- const server = servers[state.selectedIndex];
56
- if (server && server.status === "connected") {
57
- return {
58
- ...state,
59
- pendingEffect: {
60
- type: "DISCONNECT_SERVER",
61
- serverName: server.name,
62
- },
63
- };
64
- }
65
- return state;
66
- }
67
- return state;
68
- }
69
- case "CLEAR_PENDING_EFFECT":
70
- return { ...state, pendingEffect: null };
71
- default:
72
- return state;
73
- }
74
- }
@@ -1,32 +0,0 @@
1
- import { Key } from "ink";
2
- export interface PluginDetailState {
3
- selectedScopeIndex: number;
4
- selectedActionIndex: number;
5
- pendingDecision: "select" | "cancel" | null;
6
- }
7
- export type PluginDetailAction = {
8
- type: "SELECT_SCOPE_INDEX";
9
- index: number;
10
- } | {
11
- type: "SELECT_ACTION_INDEX";
12
- index: number;
13
- } | {
14
- type: "MOVE_SCOPE_UP";
15
- maxIndex: number;
16
- } | {
17
- type: "MOVE_SCOPE_DOWN";
18
- maxIndex: number;
19
- } | {
20
- type: "MOVE_ACTION_UP";
21
- maxIndex: number;
22
- } | {
23
- type: "MOVE_ACTION_DOWN";
24
- maxIndex: number;
25
- } | {
26
- type: "HANDLE_KEY";
27
- key: Key;
28
- maxIndex: number;
29
- } | {
30
- type: "CLEAR_DECISION";
31
- };
32
- export declare function pluginDetailReducer(state: PluginDetailState, action: PluginDetailAction): PluginDetailState;
@@ -1,70 +0,0 @@
1
- export function pluginDetailReducer(state, action) {
2
- switch (action.type) {
3
- case "SELECT_SCOPE_INDEX":
4
- return { ...state, selectedScopeIndex: action.index };
5
- case "SELECT_ACTION_INDEX":
6
- return { ...state, selectedActionIndex: action.index };
7
- case "MOVE_SCOPE_UP":
8
- return {
9
- ...state,
10
- selectedScopeIndex: state.selectedScopeIndex > 0
11
- ? state.selectedScopeIndex - 1
12
- : action.maxIndex,
13
- };
14
- case "MOVE_SCOPE_DOWN":
15
- return {
16
- ...state,
17
- selectedScopeIndex: state.selectedScopeIndex < action.maxIndex
18
- ? state.selectedScopeIndex + 1
19
- : 0,
20
- };
21
- case "MOVE_ACTION_UP":
22
- return {
23
- ...state,
24
- selectedActionIndex: state.selectedActionIndex > 0
25
- ? state.selectedActionIndex - 1
26
- : action.maxIndex,
27
- };
28
- case "MOVE_ACTION_DOWN":
29
- return {
30
- ...state,
31
- selectedActionIndex: state.selectedActionIndex < action.maxIndex
32
- ? state.selectedActionIndex + 1
33
- : 0,
34
- };
35
- case "HANDLE_KEY":
36
- if (action.key.upArrow) {
37
- return {
38
- ...state,
39
- selectedScopeIndex: state.selectedScopeIndex > 0
40
- ? state.selectedScopeIndex - 1
41
- : action.maxIndex,
42
- selectedActionIndex: state.selectedActionIndex > 0
43
- ? state.selectedActionIndex - 1
44
- : action.maxIndex,
45
- };
46
- }
47
- if (action.key.downArrow) {
48
- return {
49
- ...state,
50
- selectedScopeIndex: state.selectedScopeIndex < action.maxIndex
51
- ? state.selectedScopeIndex + 1
52
- : 0,
53
- selectedActionIndex: state.selectedActionIndex < action.maxIndex
54
- ? state.selectedActionIndex + 1
55
- : 0,
56
- };
57
- }
58
- if (action.key.return) {
59
- return { ...state, pendingDecision: "select" };
60
- }
61
- if (action.key.escape) {
62
- return { ...state, pendingDecision: "cancel" };
63
- }
64
- return state;
65
- case "CLEAR_DECISION":
66
- return { ...state, pendingDecision: null };
67
- default:
68
- return state;
69
- }
70
- }
@@ -1,82 +0,0 @@
1
- import { Key } from "ink";
2
- import type { PermissionDecision } from "wave-agent-sdk";
3
- export interface QuestionSavedState {
4
- selectedOptionIndex: number;
5
- selectedOptionIndices: Set<number>;
6
- otherText: string;
7
- otherCursorPosition: number;
8
- }
9
- export interface QuestionState {
10
- currentQuestionIndex: number;
11
- selectedOptionIndex: number;
12
- selectedOptionIndices: Set<number>;
13
- userAnswers: Record<string, string>;
14
- otherText: string;
15
- otherCursorPosition: number;
16
- savedStates: Record<number, QuestionSavedState>;
17
- decision: PermissionDecision | null;
18
- }
19
- export type QuestionAction = {
20
- type: "SELECT_OPTION";
21
- index: number;
22
- } | {
23
- type: "MOVE_OPTION_UP";
24
- maxIndex: number;
25
- } | {
26
- type: "MOVE_OPTION_DOWN";
27
- maxIndex: number;
28
- } | {
29
- type: "TOGGLE_MULTI_SELECT";
30
- optionsLength: number;
31
- } | {
32
- type: "CYCLE_QUESTION";
33
- shift: boolean;
34
- questionCount: number;
35
- } | {
36
- type: "INSERT_OTHER";
37
- text: string;
38
- optionsLength: number;
39
- } | {
40
- type: "DELETE_OTHER";
41
- optionsLength: number;
42
- } | {
43
- type: "MOVE_OTHER_LEFT";
44
- optionsLength: number;
45
- } | {
46
- type: "MOVE_OTHER_RIGHT";
47
- optionsLength: number;
48
- } | {
49
- type: "CONFIRM_ANSWER";
50
- currentQuestion: {
51
- question: string;
52
- options: Array<{
53
- label: string;
54
- }>;
55
- multiSelect?: boolean;
56
- };
57
- options: Array<{
58
- label: string;
59
- }>;
60
- isMultiSelect: boolean;
61
- questions: Array<{
62
- question: string;
63
- options: Array<{
64
- label: string;
65
- }>;
66
- multiSelect?: boolean;
67
- }>;
68
- } | {
69
- type: "CLEAR_DECISION";
70
- } | {
71
- type: "HANDLE_KEY";
72
- input: string;
73
- key: Key;
74
- questions: Array<{
75
- question: string;
76
- options: Array<{
77
- label: string;
78
- }>;
79
- multiSelect?: boolean;
80
- }>;
81
- };
82
- export declare function questionReducer(state: QuestionState, action: QuestionAction): QuestionState;