wave-code 1.0.9 → 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.
- package/bin/wave-code.js +8 -2
- package/dist/bundle/wave.mjs +3207 -0
- package/package.json +24 -25
- package/src/commands/update.ts +2 -7
- package/src/components/App.tsx +3 -7
- package/src/components/BtwDisplay.tsx +10 -1
- package/src/components/ChatInterface.tsx +21 -52
- package/src/components/ConfirmationDetails.tsx +144 -37
- package/src/components/DiffDisplay.tsx +335 -301
- package/src/components/InputBox.tsx +3 -1
- package/src/components/LoadingIndicator.tsx +16 -2
- package/src/components/MessageBlockItem.tsx +2 -4
- package/src/components/MessageList.tsx +75 -14
- package/src/components/ReasoningDisplay.tsx +2 -4
- package/src/components/SessionSelector.tsx +82 -11
- package/src/components/StatusCommand.tsx +2 -9
- package/src/components/ToolDisplay.tsx +2 -4
- package/src/contexts/useChat.tsx +172 -350
- package/src/daemon/commands.ts +57 -27
- package/src/daemon/jsonRpcClient.ts +1 -1
- package/src/daemon/socketClient.ts +2 -2
- package/src/hooks/useInputManager.ts +1 -1
- package/src/index.ts +57 -10
- package/src/managers/inputReducer.ts +186 -104
- package/src/print-cli.ts +21 -17
- package/src/reducers/selectorReducer.ts +10 -0
- package/src/session-selector-cli.tsx +269 -28
- package/src/stdio/agentBridge.ts +22 -21
- package/src/stdio/daemonServer.ts +3 -1
- package/src/stdio/jsonRpcConnection.ts +19 -1
- package/src/stdio/stdioServer.ts +17 -0
- package/src/utils/clipboard.ts +21 -0
- package/src/utils/highlightUtils.ts +46 -1
- package/src/utils/readPackageJson.ts +29 -0
- package/src/utils/streamingText.ts +11 -0
- package/src/utils/worktree.ts +191 -43
- package/dist/cli.d.ts +0 -6
- package/dist/cli.js +0 -53
- package/dist/commands/plugin/disable.d.ts +0 -5
- package/dist/commands/plugin/disable.js +0 -15
- package/dist/commands/plugin/enable.d.ts +0 -5
- package/dist/commands/plugin/enable.js +0 -15
- package/dist/commands/plugin/install.d.ts +0 -5
- package/dist/commands/plugin/install.js +0 -21
- package/dist/commands/plugin/list.d.ts +0 -1
- package/dist/commands/plugin/list.js +0 -31
- package/dist/commands/plugin/marketplace.d.ts +0 -10
- package/dist/commands/plugin/marketplace.js +0 -90
- package/dist/commands/plugin/uninstall.d.ts +0 -3
- package/dist/commands/plugin/uninstall.js +0 -16
- package/dist/commands/plugin/update.d.ts +0 -3
- package/dist/commands/plugin/update.js +0 -15
- package/dist/commands/update.d.ts +0 -1
- package/dist/commands/update.js +0 -97
- package/dist/components/AgentsManager.d.ts +0 -7
- package/dist/components/AgentsManager.js +0 -109
- package/dist/components/App.d.ts +0 -9
- package/dist/components/App.js +0 -76
- package/dist/components/BackgroundTaskManager.d.ts +0 -5
- package/dist/components/BackgroundTaskManager.js +0 -99
- package/dist/components/BangDisplay.d.ts +0 -8
- package/dist/components/BangDisplay.js +0 -17
- package/dist/components/BtwDisplay.d.ts +0 -7
- package/dist/components/BtwDisplay.js +0 -19
- package/dist/components/ChatInterface.d.ts +0 -2
- package/dist/components/ChatInterface.js +0 -61
- package/dist/components/CommandSelector.d.ts +0 -10
- package/dist/components/CommandSelector.js +0 -66
- package/dist/components/CompactDisplay.d.ts +0 -8
- package/dist/components/CompactDisplay.js +0 -13
- package/dist/components/ConfirmationDetails.d.ts +0 -9
- package/dist/components/ConfirmationDetails.js +0 -45
- package/dist/components/ConfirmationSelector.d.ts +0 -13
- package/dist/components/ConfirmationSelector.js +0 -127
- package/dist/components/DiffDisplay.d.ts +0 -8
- package/dist/components/DiffDisplay.js +0 -201
- package/dist/components/DiscoverView.d.ts +0 -2
- package/dist/components/DiscoverView.js +0 -37
- package/dist/components/FileSelector.d.ts +0 -11
- package/dist/components/FileSelector.js +0 -50
- package/dist/components/HelpView.d.ts +0 -7
- package/dist/components/HelpView.js +0 -74
- package/dist/components/HistorySearch.d.ts +0 -8
- package/dist/components/HistorySearch.js +0 -66
- package/dist/components/InputBox.d.ts +0 -24
- package/dist/components/InputBox.js +0 -149
- package/dist/components/InstalledView.d.ts +0 -2
- package/dist/components/InstalledView.js +0 -45
- package/dist/components/LoadingIndicator.d.ts +0 -10
- package/dist/components/LoadingIndicator.js +0 -6
- package/dist/components/LoginCommand.d.ts +0 -5
- package/dist/components/LoginCommand.js +0 -153
- package/dist/components/Markdown.d.ts +0 -5
- package/dist/components/Markdown.js +0 -127
- package/dist/components/MarketplaceAddForm.d.ts +0 -2
- package/dist/components/MarketplaceAddForm.js +0 -55
- package/dist/components/MarketplaceDetail.d.ts +0 -2
- package/dist/components/MarketplaceDetail.js +0 -74
- package/dist/components/MarketplaceList.d.ts +0 -8
- package/dist/components/MarketplaceList.js +0 -17
- package/dist/components/MarketplaceView.d.ts +0 -2
- package/dist/components/MarketplaceView.js +0 -41
- package/dist/components/McpManager.d.ts +0 -9
- package/dist/components/McpManager.js +0 -88
- package/dist/components/MessageBlockItem.d.ts +0 -8
- package/dist/components/MessageBlockItem.js +0 -15
- package/dist/components/MessageList.d.ts +0 -10
- package/dist/components/MessageList.js +0 -80
- package/dist/components/ModelSelector.d.ts +0 -8
- package/dist/components/ModelSelector.js +0 -45
- package/dist/components/Notifications.d.ts +0 -7
- package/dist/components/Notifications.js +0 -9
- package/dist/components/PlanDisplay.d.ts +0 -7
- package/dist/components/PlanDisplay.js +0 -6
- package/dist/components/PluginDetail.d.ts +0 -2
- package/dist/components/PluginDetail.js +0 -87
- package/dist/components/PluginList.d.ts +0 -13
- package/dist/components/PluginList.js +0 -15
- package/dist/components/PluginManagerShell.d.ts +0 -6
- package/dist/components/PluginManagerShell.js +0 -92
- package/dist/components/PluginManagerTypes.d.ts +0 -35
- package/dist/components/PluginManagerTypes.js +0 -1
- package/dist/components/QueuedMessageList.d.ts +0 -2
- package/dist/components/QueuedMessageList.js +0 -18
- package/dist/components/ReasoningDisplay.d.ts +0 -8
- package/dist/components/ReasoningDisplay.js +0 -13
- package/dist/components/RewindCommand.d.ts +0 -12
- package/dist/components/RewindCommand.js +0 -78
- package/dist/components/SessionSelector.d.ts +0 -12
- package/dist/components/SessionSelector.js +0 -47
- package/dist/components/StatusCommand.d.ts +0 -5
- package/dist/components/StatusCommand.js +0 -28
- package/dist/components/StatusLine.d.ts +0 -6
- package/dist/components/StatusLine.js +0 -9
- package/dist/components/TaskList.d.ts +0 -5
- package/dist/components/TaskList.js +0 -197
- package/dist/components/TaskNotificationMessage.d.ts +0 -5
- package/dist/components/TaskNotificationMessage.js +0 -12
- package/dist/components/ToolDisplay.d.ts +0 -9
- package/dist/components/ToolDisplay.js +0 -55
- package/dist/components/WorkflowManager.d.ts +0 -5
- package/dist/components/WorkflowManager.js +0 -102
- package/dist/components/WorktreeExitPrompt.d.ts +0 -12
- package/dist/components/WorktreeExitPrompt.js +0 -35
- package/dist/constants/commands.d.ts +0 -2
- package/dist/constants/commands.js +0 -92
- package/dist/contexts/PluginManagerContext.d.ts +0 -3
- package/dist/contexts/PluginManagerContext.js +0 -9
- package/dist/contexts/useAppConfig.d.ts +0 -10
- package/dist/contexts/useAppConfig.js +0 -13
- package/dist/contexts/useChat.d.ts +0 -101
- package/dist/contexts/useChat.js +0 -992
- package/dist/contracts/status.d.ts +0 -7
- package/dist/contracts/status.js +0 -1
- package/dist/daemon/commands.d.ts +0 -49
- package/dist/daemon/commands.js +0 -341
- package/dist/daemon/jsonRpcClient.d.ts +0 -38
- package/dist/daemon/jsonRpcClient.js +0 -129
- package/dist/daemon/socketClient.d.ts +0 -13
- package/dist/daemon/socketClient.js +0 -26
- package/dist/daemon-cli.d.ts +0 -10
- package/dist/daemon-cli.js +0 -15
- package/dist/hooks/useInputManager.d.ts +0 -75
- package/dist/hooks/useInputManager.js +0 -583
- package/dist/hooks/usePluginManager.d.ts +0 -4
- package/dist/hooks/usePluginManager.js +0 -265
- package/dist/hooks/useTasks.d.ts +0 -1
- package/dist/hooks/useTasks.js +0 -5
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -447
- package/dist/managers/inputHandlers.d.ts +0 -30
- package/dist/managers/inputHandlers.js +0 -625
- package/dist/managers/inputReducer.d.ts +0 -271
- package/dist/managers/inputReducer.js +0 -1121
- package/dist/plugin-manager-cli.d.ts +0 -5
- package/dist/plugin-manager-cli.js +0 -12
- package/dist/print-cli.d.ts +0 -10
- package/dist/print-cli.js +0 -209
- package/dist/reducers/agentsManagerReducer.d.ts +0 -26
- package/dist/reducers/agentsManagerReducer.js +0 -54
- package/dist/reducers/backgroundTaskManagerReducer.d.ts +0 -62
- package/dist/reducers/backgroundTaskManagerReducer.js +0 -106
- package/dist/reducers/confirmationReducer.d.ts +0 -37
- package/dist/reducers/confirmationReducer.js +0 -193
- package/dist/reducers/helpSelectorReducer.d.ts +0 -25
- package/dist/reducers/helpSelectorReducer.js +0 -52
- package/dist/reducers/marketplaceAddFormReducer.d.ts +0 -24
- package/dist/reducers/marketplaceAddFormReducer.js +0 -58
- package/dist/reducers/mcpManagerReducer.d.ts +0 -37
- package/dist/reducers/mcpManagerReducer.js +0 -74
- package/dist/reducers/pluginDetailReducer.d.ts +0 -32
- package/dist/reducers/pluginDetailReducer.js +0 -70
- package/dist/reducers/questionReducer.d.ts +0 -82
- package/dist/reducers/questionReducer.js +0 -375
- package/dist/reducers/rewindSelectorReducer.d.ts +0 -21
- package/dist/reducers/rewindSelectorReducer.js +0 -37
- package/dist/reducers/selectorReducer.d.ts +0 -23
- package/dist/reducers/selectorReducer.js +0 -42
- package/dist/reducers/workflowManagerReducer.d.ts +0 -40
- package/dist/reducers/workflowManagerReducer.js +0 -100
- package/dist/session-selector-cli.d.ts +0 -3
- package/dist/session-selector-cli.js +0 -25
- package/dist/stdio/agentBridge.d.ts +0 -139
- package/dist/stdio/agentBridge.js +0 -999
- package/dist/stdio/daemonServer.d.ts +0 -67
- package/dist/stdio/daemonServer.js +0 -191
- package/dist/stdio/index.d.ts +0 -5
- package/dist/stdio/index.js +0 -5
- package/dist/stdio/jsonRpcConnection.d.ts +0 -30
- package/dist/stdio/jsonRpcConnection.js +0 -127
- package/dist/stdio/protocol.d.ts +0 -41
- package/dist/stdio/protocol.js +0 -26
- package/dist/stdio/stdioServer.d.ts +0 -28
- package/dist/stdio/stdioServer.js +0 -36
- package/dist/stdio-cli.d.ts +0 -8
- package/dist/stdio-cli.js +0 -15
- package/dist/types.d.ts +0 -20
- package/dist/types.js +0 -1
- package/dist/utils/bracketedPaste.d.ts +0 -39
- package/dist/utils/bracketedPaste.js +0 -122
- package/dist/utils/clipboard.d.ts +0 -21
- package/dist/utils/clipboard.js +0 -347
- package/dist/utils/constants.d.ts +0 -16
- package/dist/utils/constants.js +0 -18
- package/dist/utils/highlightUtils.d.ts +0 -1
- package/dist/utils/highlightUtils.js +0 -93
- package/dist/utils/inputUtils.d.ts +0 -17
- package/dist/utils/inputUtils.js +0 -67
- package/dist/utils/logger.d.ts +0 -71
- package/dist/utils/logger.js +0 -259
- package/dist/utils/markdownTable.d.ts +0 -34
- package/dist/utils/markdownTable.js +0 -302
- package/dist/utils/rewindCheckpoints.d.ts +0 -8
- package/dist/utils/rewindCheckpoints.js +0 -17
- package/dist/utils/throttle.d.ts +0 -14
- package/dist/utils/throttle.js +0 -55
- package/dist/utils/toolParameterTransforms.d.ts +0 -18
- package/dist/utils/toolParameterTransforms.js +0 -73
- package/dist/utils/usageSummary.d.ts +0 -28
- package/dist/utils/usageSummary.js +0 -121
- package/dist/utils/version.d.ts +0 -1
- package/dist/utils/version.js +0 -4
- package/dist/utils/worktree.d.ts +0 -35
- 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;
|