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,55 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect, useRef } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
-
import { marketplaceAddFormReducer, SCOPES, } from "../reducers/marketplaceAddFormReducer.js";
|
|
6
|
-
import { createBracketedPasteDetector } from "../utils/bracketedPaste.js";
|
|
7
|
-
export const MarketplaceAddForm = () => {
|
|
8
|
-
const { state: ctxState, actions } = usePluginManagerContext();
|
|
9
|
-
const [state, dispatch] = useReducer(marketplaceAddFormReducer, {
|
|
10
|
-
source: "",
|
|
11
|
-
scopeIndex: 0,
|
|
12
|
-
step: "source",
|
|
13
|
-
pendingAction: null,
|
|
14
|
-
});
|
|
15
|
-
// Handle side effects from reducer decisions
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
if (!state.pendingAction)
|
|
18
|
-
return;
|
|
19
|
-
if (state.pendingAction.type === "submit") {
|
|
20
|
-
actions.addMarketplace(state.pendingAction.source, state.pendingAction.scope);
|
|
21
|
-
}
|
|
22
|
-
else if (state.pendingAction.type === "cancel") {
|
|
23
|
-
actions.setView("MARKETPLACES");
|
|
24
|
-
}
|
|
25
|
-
dispatch({ type: "CLEAR_PENDING_ACTION" });
|
|
26
|
-
}, [state.pendingAction, actions]);
|
|
27
|
-
const pasteDetectorRef = useRef(createBracketedPasteDetector());
|
|
28
|
-
useInput((input, key) => {
|
|
29
|
-
const result = pasteDetectorRef.current.process(input);
|
|
30
|
-
if (result.kind === "consume") {
|
|
31
|
-
// Content of an in-flight bracketed paste: hold it, never submit.
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
let cleanInput;
|
|
35
|
-
if (result.kind === "paste") {
|
|
36
|
-
cleanInput = (result.leadingInput ?? "") + result.text;
|
|
37
|
-
}
|
|
38
|
-
else {
|
|
39
|
-
cleanInput = result.input;
|
|
40
|
-
}
|
|
41
|
-
dispatch({
|
|
42
|
-
type: "HANDLE_KEY",
|
|
43
|
-
key,
|
|
44
|
-
input: cleanInput,
|
|
45
|
-
isLoading: ctxState.isLoading,
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
const { source, scopeIndex, step } = state;
|
|
49
|
-
if (step === "source") {
|
|
50
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Step 1/2: Enter marketplace source" }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { children: "Source: " }), _jsx(Text, { color: "yellow", children: source }), !ctxState.isLoading && _jsx(Text, { color: "yellow", children: "_" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter to continue, Esc to cancel" }) })] }));
|
|
51
|
-
}
|
|
52
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Step 2/2: Select scope" }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { dimColor: true, children: "Source: " }), _jsx(Text, { dimColor: true, children: source })] }), _jsx(Box, { marginTop: 1, flexDirection: "column", children: SCOPES.map((s, i) => (_jsxs(Text, { color: i === scopeIndex ? "yellow" : "dim", children: [i === scopeIndex ? "> " : " ", s] }, s))) }), ctxState.isLoading && (_jsx(Box, { marginTop: 1, children: _jsx(Text, { color: "yellow", children: "Adding marketplace..." }) })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: ctxState.isLoading
|
|
53
|
-
? "Please wait..."
|
|
54
|
-
: "Enter to confirm, \u2191/\u2193 to navigate, Esc to go back" }) })] }));
|
|
55
|
-
};
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect, useMemo } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
-
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
6
|
-
export const MarketplaceDetail = () => {
|
|
7
|
-
const { state, marketplaces, actions } = usePluginManagerContext();
|
|
8
|
-
const [selectorState, dispatch] = useReducer((selectorReducer), {
|
|
9
|
-
selectedIndex: 0,
|
|
10
|
-
pendingDecision: null,
|
|
11
|
-
items: [],
|
|
12
|
-
});
|
|
13
|
-
const { selectedIndex: selectedActionIndex, pendingDecision, items: actionsList, } = selectorState;
|
|
14
|
-
const marketplace = marketplaces.find((m) => m.name === state.selectedId);
|
|
15
|
-
const ACTIONS = useMemo(() => [
|
|
16
|
-
{
|
|
17
|
-
id: "toggle-auto-update",
|
|
18
|
-
label: `${marketplace?.autoUpdate ? "Disable" : "Enable"} auto-update`,
|
|
19
|
-
},
|
|
20
|
-
{ id: "update", label: "Update marketplace" },
|
|
21
|
-
{ id: "remove", label: "Remove marketplace" },
|
|
22
|
-
], [marketplace?.autoUpdate]);
|
|
23
|
-
// Sync ACTIONS into reducer state
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
dispatch({ type: "SET_ITEMS", items: [...ACTIONS] });
|
|
26
|
-
}, [ACTIONS]);
|
|
27
|
-
useInput((_input, key) => {
|
|
28
|
-
if (state.isLoading && !key.escape)
|
|
29
|
-
return;
|
|
30
|
-
dispatch({
|
|
31
|
-
type: "HANDLE_KEY",
|
|
32
|
-
key,
|
|
33
|
-
hasInsert: false,
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (!pendingDecision)
|
|
38
|
-
return;
|
|
39
|
-
if (pendingDecision === "select" && marketplace && !state.isLoading) {
|
|
40
|
-
const action = actionsList[selectedActionIndex]?.id;
|
|
41
|
-
if (action === "toggle-auto-update") {
|
|
42
|
-
actions.toggleAutoUpdate(marketplace.name, !marketplace.autoUpdate);
|
|
43
|
-
}
|
|
44
|
-
else if (action === "update") {
|
|
45
|
-
actions.updateMarketplace(marketplace.name);
|
|
46
|
-
}
|
|
47
|
-
else if (action === "remove") {
|
|
48
|
-
actions.removeMarketplace(marketplace.name);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
else if (pendingDecision === "cancel") {
|
|
52
|
-
actions.setView("MARKETPLACES");
|
|
53
|
-
}
|
|
54
|
-
dispatch({ type: "CLEAR_DECISION" });
|
|
55
|
-
}, [
|
|
56
|
-
pendingDecision,
|
|
57
|
-
selectedActionIndex,
|
|
58
|
-
actionsList,
|
|
59
|
-
marketplace,
|
|
60
|
-
state.isLoading,
|
|
61
|
-
actions,
|
|
62
|
-
]);
|
|
63
|
-
if (!marketplace) {
|
|
64
|
-
return (_jsx(Box, { children: _jsx(Text, { color: "red", children: "Marketplace not found." }) }));
|
|
65
|
-
}
|
|
66
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: marketplace.name }), marketplace.isBuiltin && _jsx(Text, { dimColor: true, children: " (Built-in)" }), marketplace.declaredScope &&
|
|
67
|
-
marketplace.declaredScope !== "builtin" && (_jsxs(Text, { dimColor: true, children: [" (", marketplace.declaredScope, " scope)"] }))] }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: ["Source: ", JSON.stringify(marketplace.source)] }) }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: ["Auto-update:", " ", _jsx(Text, { color: marketplace.autoUpdate ? "green" : "red", children: marketplace.autoUpdate ? "Enabled" : "Disabled" })] }) }), marketplace.lastUpdated && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: ["Last updated:", " ", _jsx(Text, { color: "cyan", children: new Date(marketplace.lastUpdated).toLocaleString() })] }) })), state.isLoading && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "yellow", children: "\u231B Processing operation..." }) })), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Marketplace Actions:" }), ACTIONS.map((action, index) => (_jsxs(Text, { color: index === selectedActionIndex
|
|
68
|
-
? state.isLoading
|
|
69
|
-
? "gray"
|
|
70
|
-
: "yellow"
|
|
71
|
-
: undefined, children: [index === selectedActionIndex ? "> " : " ", action.label] }, action.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: state.isLoading
|
|
72
|
-
? "Please wait..."
|
|
73
|
-
: "Use ↑/↓ to select, Enter to confirm" }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Esc to go back" }) })] })] }));
|
|
74
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from "ink";
|
|
3
|
-
export const MarketplaceList = ({ marketplaces, selectedIndex, }) => {
|
|
4
|
-
if (marketplaces.length === 0) {
|
|
5
|
-
return (_jsx(Box, { padding: 1, children: _jsx(Text, { dimColor: true, children: "No marketplaces registered." }) }));
|
|
6
|
-
}
|
|
7
|
-
return (_jsx(Box, { flexDirection: "column", children: marketplaces.map((marketplace, index) => {
|
|
8
|
-
const isSelected = index === selectedIndex;
|
|
9
|
-
const sourceStr = marketplace.source.source === "directory"
|
|
10
|
-
? marketplace.source.path
|
|
11
|
-
: marketplace.source.source === "github"
|
|
12
|
-
? marketplace.source.repo
|
|
13
|
-
: marketplace.source.url;
|
|
14
|
-
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { children: _jsxs(Text, { color: isSelected ? "cyan" : undefined, children: [isSelected ? "> " : " ", _jsx(Text, { bold: true, children: marketplace.name }), marketplace.isBuiltin && (_jsx(Text, { color: "yellow", children: " [Built-in]" })), marketplace.declaredScope &&
|
|
15
|
-
marketplace.declaredScope !== "builtin" && (_jsxs(Text, { color: "magenta", children: [" [", marketplace.declaredScope, "]"] }))] }) }), _jsxs(Box, { marginLeft: 4, flexDirection: "column", children: [_jsxs(Text, { dimColor: true, children: ["Source: ", sourceStr] }), marketplace.lastUpdated && (_jsxs(Text, { dimColor: true, children: ["Last updated:", " ", new Date(marketplace.lastUpdated).toLocaleString()] }))] })] }, marketplace.name));
|
|
16
|
-
}) }));
|
|
17
|
-
};
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
-
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
6
|
-
import { MarketplaceList } from "./MarketplaceList.js";
|
|
7
|
-
export const MarketplaceView = () => {
|
|
8
|
-
const { marketplaces, actions } = usePluginManagerContext();
|
|
9
|
-
const [state, dispatch] = useReducer((selectorReducer), {
|
|
10
|
-
selectedIndex: 0,
|
|
11
|
-
pendingDecision: null,
|
|
12
|
-
items: [],
|
|
13
|
-
});
|
|
14
|
-
const { selectedIndex, pendingDecision, items } = state;
|
|
15
|
-
// Sync marketplaces into reducer state
|
|
16
|
-
useEffect(() => {
|
|
17
|
-
dispatch({ type: "SET_ITEMS", items: marketplaces });
|
|
18
|
-
}, [marketplaces]);
|
|
19
|
-
useInput((input, key) => {
|
|
20
|
-
if (input === "a") {
|
|
21
|
-
actions.setView("ADD_MARKETPLACE");
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
dispatch({
|
|
25
|
-
type: "HANDLE_KEY",
|
|
26
|
-
key,
|
|
27
|
-
hasInsert: false,
|
|
28
|
-
});
|
|
29
|
-
});
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (pendingDecision === "select") {
|
|
32
|
-
const mk = items[selectedIndex];
|
|
33
|
-
if (mk) {
|
|
34
|
-
actions.setSelectedId(mk.name);
|
|
35
|
-
actions.setView("MARKETPLACE_DETAIL");
|
|
36
|
-
}
|
|
37
|
-
dispatch({ type: "CLEAR_DECISION" });
|
|
38
|
-
}
|
|
39
|
-
}, [pendingDecision, selectedIndex, items, actions]);
|
|
40
|
-
return (_jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "green", children: "Press 'a' to add a new marketplace" }) }), _jsx(MarketplaceList, { marketplaces: marketplaces, selectedIndex: selectedIndex }), marketplaces.length > 0 && (_jsx(Box, { marginLeft: 4, marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Enter for actions" }) }))] }));
|
|
41
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { McpServerStatus } from "wave-agent-sdk";
|
|
3
|
-
export interface McpManagerProps {
|
|
4
|
-
onCancel: () => void;
|
|
5
|
-
servers: McpServerStatus[];
|
|
6
|
-
onConnectServer: (serverName: string) => Promise<boolean>;
|
|
7
|
-
onDisconnectServer: (serverName: string) => Promise<boolean>;
|
|
8
|
-
}
|
|
9
|
-
export declare const McpManager: React.FC<McpManagerProps>;
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { mcpManagerReducer, } from "../reducers/mcpManagerReducer.js";
|
|
5
|
-
const initialState = {
|
|
6
|
-
selectedIndex: 0,
|
|
7
|
-
viewMode: "list",
|
|
8
|
-
pendingEffect: null,
|
|
9
|
-
};
|
|
10
|
-
export const McpManager = ({ onCancel, servers, onConnectServer, onDisconnectServer, }) => {
|
|
11
|
-
const [state, dispatch] = useReducer(mcpManagerReducer, initialState);
|
|
12
|
-
// Handle pending effects
|
|
13
|
-
useEffect(() => {
|
|
14
|
-
if (!state.pendingEffect)
|
|
15
|
-
return;
|
|
16
|
-
const effect = state.pendingEffect;
|
|
17
|
-
dispatch({ type: "CLEAR_PENDING_EFFECT" });
|
|
18
|
-
switch (effect.type) {
|
|
19
|
-
case "CANCEL":
|
|
20
|
-
onCancel();
|
|
21
|
-
break;
|
|
22
|
-
case "CONNECT_SERVER":
|
|
23
|
-
onConnectServer(effect.serverName);
|
|
24
|
-
break;
|
|
25
|
-
case "DISCONNECT_SERVER":
|
|
26
|
-
onDisconnectServer(effect.serverName);
|
|
27
|
-
break;
|
|
28
|
-
}
|
|
29
|
-
}, [state.pendingEffect, onCancel, onConnectServer, onDisconnectServer]);
|
|
30
|
-
// Dynamically calculate selectedServer based on selectedIndex and servers
|
|
31
|
-
const selectedServer = state.viewMode === "detail" &&
|
|
32
|
-
servers.length > 0 &&
|
|
33
|
-
state.selectedIndex < servers.length
|
|
34
|
-
? servers[state.selectedIndex]
|
|
35
|
-
: null;
|
|
36
|
-
const formatTime = (timestamp) => {
|
|
37
|
-
return new Date(timestamp).toLocaleTimeString();
|
|
38
|
-
};
|
|
39
|
-
const getStatusColor = (status) => {
|
|
40
|
-
switch (status) {
|
|
41
|
-
case "connected":
|
|
42
|
-
return "green";
|
|
43
|
-
case "connecting":
|
|
44
|
-
return "yellow";
|
|
45
|
-
case "error":
|
|
46
|
-
return "red";
|
|
47
|
-
default:
|
|
48
|
-
return "gray";
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
const getStatusIcon = (status) => {
|
|
52
|
-
switch (status) {
|
|
53
|
-
case "connected":
|
|
54
|
-
return "✓";
|
|
55
|
-
case "connecting":
|
|
56
|
-
return "⟳";
|
|
57
|
-
case "error":
|
|
58
|
-
return "✗";
|
|
59
|
-
default:
|
|
60
|
-
return "○";
|
|
61
|
-
}
|
|
62
|
-
};
|
|
63
|
-
useInput((input, key) => {
|
|
64
|
-
dispatch({
|
|
65
|
-
type: "HANDLE_KEY",
|
|
66
|
-
input,
|
|
67
|
-
key,
|
|
68
|
-
serverCount: servers.length,
|
|
69
|
-
servers: servers.map((s) => ({ name: s.name, status: s.status })),
|
|
70
|
-
});
|
|
71
|
-
});
|
|
72
|
-
if (state.viewMode === "detail" && selectedServer) {
|
|
73
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, gap: 1, children: [_jsx(Box, { children: _jsxs(Text, { color: "cyan", bold: true, children: ["MCP Server Details: ", selectedServer.name] }) }), _jsxs(Box, { flexDirection: "column", gap: 1, children: [_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Status:" }), " ", _jsxs(Text, { color: getStatusColor(selectedServer.status), children: [getStatusIcon(selectedServer.status), " ", selectedServer.status] })] }) }), selectedServer.config.type && (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Type:" }), " ", selectedServer.config.type] }) })), _jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Command:" }), " ", selectedServer.config.command] }) }), selectedServer.originalUrl && (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "URL:" }), " ", selectedServer.originalUrl] }) })), selectedServer.config.args && (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Args:" }), " ", selectedServer.config.args.join(" ")] }) })), selectedServer.toolCount !== undefined && (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Tools:" }), " ", selectedServer.toolCount, " ", "tools"] }) })), selectedServer.capabilities && (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Capabilities:" }), " ", selectedServer.capabilities.join(", ")] }) })), selectedServer.lastConnected && (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "blue", children: "Last Connected:" }), " ", formatTime(selectedServer.lastConnected)] }) })), selectedServer.error && (_jsx(Box, { children: _jsxs(Text, { children: [_jsx(Text, { color: "red", children: "Error:" }), " ", selectedServer.error] }) }))] }), selectedServer.config.env &&
|
|
74
|
-
Object.keys(selectedServer.config.env).length > 0 && (_jsxs(Box, { flexDirection: "column", marginTop: 1, children: [_jsx(Text, { color: "blue", bold: true, children: "Environment Variables:" }), _jsx(Box, { borderStyle: "single", borderColor: "blue", padding: 1, children: Object.entries(selectedServer.config.env).map(([key, value]) => (_jsxs(Text, { children: [key, "=", value] }, key))) })] })), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: [selectedServer.status === "disconnected" ||
|
|
75
|
-
selectedServer.status === "error"
|
|
76
|
-
? "c to connect · "
|
|
77
|
-
: "", selectedServer.status === "connected" ? "d to disconnect · " : "", "Esc to go back"] }) })] }));
|
|
78
|
-
}
|
|
79
|
-
if (servers.length === 0) {
|
|
80
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: "Manage MCP servers" }), _jsx(Text, { children: "No MCP servers configured" }), _jsx(Text, { dimColor: true, children: "Create a .mcp.json file in your project root to add servers" }), _jsx(Text, { dimColor: true, children: "Press Escape to close" })] }));
|
|
81
|
-
}
|
|
82
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, gap: 1, children: [_jsx(Box, { children: _jsx(Text, { color: "cyan", bold: true, children: "Manage MCP servers" }) }), _jsx(Text, { dimColor: true, children: "Select a server to view details" }), servers.map((server, index) => (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Text, { color: index === state.selectedIndex ? "black" : "white", backgroundColor: index === state.selectedIndex ? "cyan" : undefined, children: [index === state.selectedIndex ? "▶ " : " ", index + 1, ".", " ", _jsx(Text, { color: getStatusColor(server.status), children: getStatusIcon(server.status) }), " ", server.name, server.status === "connected" && server.toolCount && (_jsxs(Text, { color: "green", children: [" \u00B7 ", server.toolCount, " tools"] }))] }), index === state.selectedIndex && (_jsxs(Box, { marginLeft: 4, flexDirection: "column", children: [server.config.command ? (_jsxs(Text, { color: "gray", dimColor: true, children: [server.config.command, server.config.args ? ` ${server.config.args.join(" ")}` : ""] })) : server.originalUrl ? (_jsx(Text, { color: "gray", dimColor: true, children: server.originalUrl })) : null, server.lastConnected && (_jsxs(Text, { color: "gray", dimColor: true, children: ["Last connected: ", formatTime(server.lastConnected)] }))] }))] }, server.name))), _jsx(Box, { marginTop: 1, children: _jsxs(Text, { dimColor: true, children: ["\u2191/\u2193 to select \u00B7 Enter to view \u00B7", " ", servers[state.selectedIndex]?.status === "disconnected" ||
|
|
83
|
-
servers[state.selectedIndex]?.status === "error"
|
|
84
|
-
? "c to connect · "
|
|
85
|
-
: "", servers[state.selectedIndex]?.status === "connected"
|
|
86
|
-
? "d to disconnect · "
|
|
87
|
-
: "", "Esc to close"] }) })] }));
|
|
88
|
-
};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Message, MessageBlock } from "wave-agent-sdk";
|
|
2
|
-
export interface MessageBlockItemProps {
|
|
3
|
-
block: MessageBlock;
|
|
4
|
-
message: Message;
|
|
5
|
-
isExpanded: boolean;
|
|
6
|
-
paddingTop?: number;
|
|
7
|
-
}
|
|
8
|
-
export declare const MessageBlockItem: ({ block, message, isExpanded, paddingTop, }: MessageBlockItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from "ink";
|
|
3
|
-
import { MessageSource } from "wave-agent-sdk";
|
|
4
|
-
import { BangDisplay } from "./BangDisplay.js";
|
|
5
|
-
import { ToolDisplay } from "./ToolDisplay.js";
|
|
6
|
-
import { CompactDisplay } from "./CompactDisplay.js";
|
|
7
|
-
import { ReasoningDisplay } from "./ReasoningDisplay.js";
|
|
8
|
-
import { Markdown } from "./Markdown.js";
|
|
9
|
-
import { TaskNotificationMessage } from "./TaskNotificationMessage.js";
|
|
10
|
-
export const MessageBlockItem = ({ block, message, isExpanded, paddingTop = 0, }) => {
|
|
11
|
-
return (_jsxs(Box, { flexDirection: "column", paddingTop: paddingTop, children: [block.type === "text" && block.content.trim() && (_jsxs(Box, { children: [block.source === MessageSource.HOOK && (_jsxs(Text, { color: "magenta", bold: true, children: ["~", " "] })), message.role === "user" || isExpanded ? (_jsx(Text, { backgroundColor: message.role === "user" ? "gray" : undefined, color: "white", children: block.content })) : block.stage === "streaming" ? (_jsx(Text, { color: "gray", wrap: "truncate-end", children: (() => {
|
|
12
|
-
const flat = block.content.replace(/\n/g, "\\n");
|
|
13
|
-
return flat.length > 30 ? `…${flat.slice(-30)}` : flat;
|
|
14
|
-
})() })) : (_jsx(Markdown, { children: block.content }))] })), block.type === "error" && (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", block.content] }) })), block.type === "bang" && (_jsx(BangDisplay, { block: block, isExpanded: isExpanded })), block.type === "tool" && (_jsx(ToolDisplay, { block: block, isExpanded: isExpanded })), block.type === "image" && (_jsxs(Box, { children: [_jsx(Text, { color: "magenta", bold: true, children: "# Image" }), block.imageUrls && block.imageUrls.length > 0 && (_jsxs(Text, { color: "gray", dimColor: true, children: [" ", "(", block.imageUrls.length, ")"] }))] })), block.type === "compact" && (_jsx(CompactDisplay, { block: block, isExpanded: isExpanded })), block.type === "reasoning" && (_jsx(ReasoningDisplay, { block: block, isExpanded: isExpanded })), block.type === "task_notification" && (_jsx(TaskNotificationMessage, { block: block }))] }));
|
|
15
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { Message } from "wave-agent-sdk";
|
|
3
|
-
export interface MessageListProps {
|
|
4
|
-
messages: Message[];
|
|
5
|
-
isExpanded?: boolean;
|
|
6
|
-
forceStatic?: boolean;
|
|
7
|
-
version?: string;
|
|
8
|
-
workdir?: string;
|
|
9
|
-
}
|
|
10
|
-
export declare const MessageList: React.MemoExoticComponent<({ messages, isExpanded, forceStatic, version, workdir, }: MessageListProps) => import("react/jsx-runtime").JSX.Element>;
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import React from "react";
|
|
3
|
-
import os from "os";
|
|
4
|
-
import { Box, Text, Static } from "ink";
|
|
5
|
-
import { MessageBlockItem } from "./MessageBlockItem.js";
|
|
6
|
-
const MAX_MESSAGES_COLLAPSED = 30;
|
|
7
|
-
const MAX_MESSAGES_EXPANDED = 10;
|
|
8
|
-
export const MessageList = React.memo(({ messages, isExpanded = false, forceStatic = false, version, workdir, }) => {
|
|
9
|
-
const maxMessages = isExpanded
|
|
10
|
-
? MAX_MESSAGES_EXPANDED
|
|
11
|
-
: MAX_MESSAGES_COLLAPSED;
|
|
12
|
-
const welcomeMessage = (_jsxs(Box, { flexDirection: "column", paddingTop: 1, children: [_jsxs(Text, { color: "gray", children: ["WAVE", version ? ` v${version}` : ""] }), workdir && (_jsx(Text, { color: "gray", wrap: "truncate-middle", children: workdir.replace(os.homedir(), "~") }))] }));
|
|
13
|
-
// Filter out meta messages
|
|
14
|
-
const visibleMessages = messages.filter((m) => !m.isMeta);
|
|
15
|
-
const isRunning = (b) => (b.type === "tool" &&
|
|
16
|
-
(b.stage === "running" ||
|
|
17
|
-
b.stage === "streaming" ||
|
|
18
|
-
b.stage === "start")) ||
|
|
19
|
-
(b.type === "bang" && b.stage === "running") ||
|
|
20
|
-
(b.type === "reasoning" && b.stage === "streaming") ||
|
|
21
|
-
(b.type === "text" && b.stage === "streaming");
|
|
22
|
-
// Flatten messages into blocks with metadata
|
|
23
|
-
// Include streaming text blocks (rendered as truncated gray text)
|
|
24
|
-
const allBlocks = visibleMessages.flatMap((message, messageIndex) => {
|
|
25
|
-
return message.blocks.map((block, blockIndex) => ({
|
|
26
|
-
block,
|
|
27
|
-
message,
|
|
28
|
-
messageIndex,
|
|
29
|
-
// Unique key for each block to help Static component
|
|
30
|
-
key: `${message.id}-${blockIndex}`,
|
|
31
|
-
}));
|
|
32
|
-
});
|
|
33
|
-
// Find message indices that have any running/streaming block
|
|
34
|
-
const runningMessageIndices = new Set();
|
|
35
|
-
for (const item of allBlocks) {
|
|
36
|
-
if (isRunning(item.block)) {
|
|
37
|
-
runningMessageIndices.add(item.messageIndex);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
// Determine which blocks are static vs dynamic
|
|
41
|
-
// Blocks not in the last message are always static.
|
|
42
|
-
// For the last message: if any block is running/streaming, blocks in that message are dynamic,
|
|
43
|
-
// except text/reasoning blocks that have already completed (stage === "end")
|
|
44
|
-
const lastMessageIndex = visibleMessages.length - 1;
|
|
45
|
-
const blocksWithStatus = allBlocks.map((item) => {
|
|
46
|
-
const isInLastMessage = item.messageIndex === lastMessageIndex;
|
|
47
|
-
const isBlockCompleted = (item.block.type === "text" || item.block.type === "reasoning") &&
|
|
48
|
-
item.block.stage === "end";
|
|
49
|
-
const isDynamic = !forceStatic &&
|
|
50
|
-
!isExpanded &&
|
|
51
|
-
isInLastMessage &&
|
|
52
|
-
!isBlockCompleted &&
|
|
53
|
-
runningMessageIndices.has(item.messageIndex);
|
|
54
|
-
return { ...item, isDynamic };
|
|
55
|
-
});
|
|
56
|
-
const staticBlocks = blocksWithStatus.filter((b) => !b.isDynamic);
|
|
57
|
-
const dynamicBlocks = blocksWithStatus.filter((b) => b.isDynamic);
|
|
58
|
-
const staticItems = [
|
|
59
|
-
{
|
|
60
|
-
isWelcome: true,
|
|
61
|
-
key: "welcome",
|
|
62
|
-
block: undefined,
|
|
63
|
-
message: undefined,
|
|
64
|
-
messageIndex: -1,
|
|
65
|
-
},
|
|
66
|
-
...staticBlocks.map((b) => ({ ...b, isWelcome: false })),
|
|
67
|
-
];
|
|
68
|
-
return (_jsxs(Box, { flexDirection: "column", paddingBottom: 1, children: [staticItems.length > 0 && (_jsx(Static, { items: staticItems, children: (item) => {
|
|
69
|
-
if (item.isWelcome) {
|
|
70
|
-
return (_jsx(React.Fragment, { children: welcomeMessage }, item.key));
|
|
71
|
-
}
|
|
72
|
-
if (visibleMessages.length > maxMessages &&
|
|
73
|
-
item.messageIndex < visibleMessages.length - maxMessages) {
|
|
74
|
-
return null;
|
|
75
|
-
}
|
|
76
|
-
return (_jsx(MessageBlockItem, { block: item.block, message: item.message, isExpanded: isExpanded, paddingTop: 1 }, item.key));
|
|
77
|
-
} })), dynamicBlocks.length > 0 && (_jsx(Box, { flexDirection: "column", children: dynamicBlocks.map((item) => (_jsx(MessageBlockItem, { block: item.block, message: item.message, isExpanded: isExpanded, paddingTop: 1 }, item.key))) }))] }));
|
|
78
|
-
});
|
|
79
|
-
// Add display name for debugging
|
|
80
|
-
MessageList.displayName = "MessageList";
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { selectorReducer, } from "../reducers/selectorReducer.js";
|
|
5
|
-
const MAX_VISIBLE_ITEMS = 5;
|
|
6
|
-
export const ModelSelector = ({ onCancel, currentModel, configuredModels, onSelectModel, }) => {
|
|
7
|
-
const [state, dispatch] = useReducer((selectorReducer), {
|
|
8
|
-
selectedIndex: configuredModels.indexOf(currentModel) !== -1
|
|
9
|
-
? configuredModels.indexOf(currentModel)
|
|
10
|
-
: 0,
|
|
11
|
-
pendingDecision: null,
|
|
12
|
-
items: configuredModels,
|
|
13
|
-
});
|
|
14
|
-
const { selectedIndex, pendingDecision, items: models } = state;
|
|
15
|
-
useInput((_input, key) => {
|
|
16
|
-
dispatch({
|
|
17
|
-
type: "HANDLE_KEY",
|
|
18
|
-
key,
|
|
19
|
-
hasInsert: false,
|
|
20
|
-
});
|
|
21
|
-
});
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (pendingDecision === "select") {
|
|
24
|
-
if (models.length > 0) {
|
|
25
|
-
onSelectModel(models[selectedIndex]);
|
|
26
|
-
}
|
|
27
|
-
onCancel();
|
|
28
|
-
dispatch({ type: "CLEAR_DECISION" });
|
|
29
|
-
}
|
|
30
|
-
else if (pendingDecision === "cancel") {
|
|
31
|
-
onCancel();
|
|
32
|
-
dispatch({ type: "CLEAR_DECISION" });
|
|
33
|
-
}
|
|
34
|
-
}, [pendingDecision, selectedIndex, models, onSelectModel, onCancel]);
|
|
35
|
-
// Calculate visible window
|
|
36
|
-
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2), Math.max(0, models.length - MAX_VISIBLE_ITEMS)));
|
|
37
|
-
const visibleModels = models.slice(startIndex, startIndex + MAX_VISIBLE_ITEMS);
|
|
38
|
-
if (configuredModels.length === 0) {
|
|
39
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, children: [_jsx(Text, { color: "cyan", bold: true, children: "Select AI Model" }), _jsx(Text, { children: "No models configured" }), _jsx(Text, { dimColor: true, children: "Press Escape to close" })] }));
|
|
40
|
-
}
|
|
41
|
-
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "cyan", borderBottom: false, borderLeft: false, borderRight: false, paddingTop: 1, gap: 1, children: [_jsx(Box, { children: _jsx(Text, { color: "cyan", bold: true, children: "Select AI Model" }) }), _jsx(Text, { dimColor: true, children: "Select a model to use for the current session" }), visibleModels.map((model, index) => {
|
|
42
|
-
const actualIndex = startIndex + index;
|
|
43
|
-
return (_jsx(Box, { children: _jsxs(Text, { color: actualIndex === selectedIndex ? "black" : "white", backgroundColor: actualIndex === selectedIndex ? "cyan" : undefined, children: [actualIndex === selectedIndex ? "▶ " : " ", model, model === currentModel ? (_jsx(Text, { color: "green", children: " (current)" })) : ("")] }) }, model));
|
|
44
|
-
}), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "\u2191/\u2193 to select \u00B7 Enter to confirm \u00B7 Esc to cancel" }) })] }));
|
|
45
|
-
};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Box, Text } from "ink";
|
|
3
|
-
export const Notifications = ({ latestTotalTokens = 0, maxInputTokens = 200000, showLoginHint = false, }) => {
|
|
4
|
-
const percentage = latestTotalTokens > 0
|
|
5
|
-
? Math.min(Math.round((latestTotalTokens / maxInputTokens) * 100), 100)
|
|
6
|
-
: 0;
|
|
7
|
-
const contextColor = percentage > 95 ? "red" : percentage > 80 ? "yellow" : "gray";
|
|
8
|
-
return (_jsxs(Box, { gap: 1, children: [showLoginHint && _jsx(Text, { color: "gray", children: "Type /login to authenticate" }), percentage > 0 && (_jsxs(Text, { color: contextColor, children: [percentage, "% context"] }))] }));
|
|
9
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Box } from "ink";
|
|
3
|
-
import { Markdown } from "./Markdown.js";
|
|
4
|
-
export const PlanDisplay = ({ plan }) => {
|
|
5
|
-
return (_jsx(Box, { flexDirection: "column", marginTop: 1, children: _jsx(Box, { flexDirection: "column", children: _jsx(Markdown, { children: plan }) }) }));
|
|
6
|
-
};
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useReducer, useEffect, useMemo } from "react";
|
|
3
|
-
import { Box, Text, useInput } from "ink";
|
|
4
|
-
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
-
import { pluginDetailReducer, } from "../reducers/pluginDetailReducer.js";
|
|
6
|
-
const SCOPES = [
|
|
7
|
-
{ id: "project", label: "Install for all collaborators (project scope)" },
|
|
8
|
-
{ id: "user", label: "Install for you (user scope)" },
|
|
9
|
-
{ id: "local", label: "Install for you, in this repo only (local scope)" },
|
|
10
|
-
];
|
|
11
|
-
export const PluginDetail = () => {
|
|
12
|
-
const { state, discoverablePlugins, installedPlugins, actions } = usePluginManagerContext();
|
|
13
|
-
const [detailState, dispatch] = useReducer(pluginDetailReducer, {
|
|
14
|
-
selectedScopeIndex: 0,
|
|
15
|
-
selectedActionIndex: 0,
|
|
16
|
-
pendingDecision: null,
|
|
17
|
-
});
|
|
18
|
-
const { selectedScopeIndex, selectedActionIndex, pendingDecision } = detailState;
|
|
19
|
-
const plugin = discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId) ||
|
|
20
|
-
installedPlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId);
|
|
21
|
-
const INSTALLED_ACTIONS = useMemo(() => [
|
|
22
|
-
{ id: "update", label: "Update plugin (reinstall)" },
|
|
23
|
-
{ id: "uninstall", label: "Uninstall plugin" },
|
|
24
|
-
], []);
|
|
25
|
-
const isInstalledAndEnabled = plugin && "enabled" in plugin && plugin.enabled;
|
|
26
|
-
useInput((_input, key) => {
|
|
27
|
-
if (state.isLoading && !key.escape)
|
|
28
|
-
return;
|
|
29
|
-
dispatch({
|
|
30
|
-
type: "HANDLE_KEY",
|
|
31
|
-
key,
|
|
32
|
-
maxIndex: isInstalledAndEnabled
|
|
33
|
-
? INSTALLED_ACTIONS.length - 1
|
|
34
|
-
: SCOPES.length - 1,
|
|
35
|
-
});
|
|
36
|
-
});
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (!pendingDecision)
|
|
39
|
-
return;
|
|
40
|
-
if (pendingDecision === "select" && plugin && !state.isLoading) {
|
|
41
|
-
if (isInstalledAndEnabled) {
|
|
42
|
-
const action = INSTALLED_ACTIONS[selectedActionIndex].id;
|
|
43
|
-
if (action === "uninstall") {
|
|
44
|
-
actions.uninstallPlugin(plugin.name, plugin.marketplace);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
actions.updatePlugin(plugin.name, plugin.marketplace);
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else {
|
|
51
|
-
actions.installPlugin(plugin.name, plugin.marketplace, SCOPES[selectedScopeIndex].id);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
else if (pendingDecision === "cancel") {
|
|
55
|
-
const isFromDiscover = discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId);
|
|
56
|
-
actions.setView(isFromDiscover ? "DISCOVER" : "INSTALLED");
|
|
57
|
-
}
|
|
58
|
-
dispatch({ type: "CLEAR_DECISION" });
|
|
59
|
-
}, [
|
|
60
|
-
pendingDecision,
|
|
61
|
-
selectedActionIndex,
|
|
62
|
-
selectedScopeIndex,
|
|
63
|
-
plugin,
|
|
64
|
-
isInstalledAndEnabled,
|
|
65
|
-
state.isLoading,
|
|
66
|
-
discoverablePlugins,
|
|
67
|
-
state.selectedId,
|
|
68
|
-
actions,
|
|
69
|
-
INSTALLED_ACTIONS,
|
|
70
|
-
]);
|
|
71
|
-
if (!plugin) {
|
|
72
|
-
return (_jsx(Box, { children: _jsx(Text, { color: "red", children: "Plugin not found." }) }));
|
|
73
|
-
}
|
|
74
|
-
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsxs(Box, { marginBottom: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: plugin.name }), _jsxs(Text, { dimColor: true, children: [" @", plugin.marketplace] })] }), _jsx(Box, { marginBottom: 1, children: _jsx(Text, { children: "description" in plugin ? plugin.description : "" }) }), plugin.version && (_jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: ["Version: ", _jsx(Text, { color: "blue", children: plugin.version })] }) })), state.isLoading && (_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "yellow", children: "\u231B Processing operation..." }) })), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [isInstalledAndEnabled ? (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Plugin Actions:" }), INSTALLED_ACTIONS.map((action, index) => (_jsxs(Text, { color: index === detailState.selectedActionIndex
|
|
75
|
-
? state.isLoading
|
|
76
|
-
? "gray"
|
|
77
|
-
: "yellow"
|
|
78
|
-
: undefined, children: [index === detailState.selectedActionIndex ? "> " : " ", action.label] }, action.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: state.isLoading
|
|
79
|
-
? "Please wait..."
|
|
80
|
-
: "Use ↑/↓ to select, Enter to confirm" }) })] })) : (_jsxs(Box, { flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Select Installation Scope:" }), SCOPES.map((scope, index) => (_jsxs(Text, { color: index === detailState.selectedScopeIndex
|
|
81
|
-
? state.isLoading
|
|
82
|
-
? "gray"
|
|
83
|
-
: "green"
|
|
84
|
-
: undefined, children: [index === detailState.selectedScopeIndex ? "> " : " ", scope.label] }, scope.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: state.isLoading
|
|
85
|
-
? "Please wait..."
|
|
86
|
-
: "Use ↑/↓ to select, Enter to install" }) })] })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Esc to go back" }) })] })] }));
|
|
87
|
-
};
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { MarketplacePluginEntry } from "wave-agent-sdk";
|
|
3
|
-
interface PluginListProps {
|
|
4
|
-
plugins: (MarketplacePluginEntry & {
|
|
5
|
-
marketplace: string;
|
|
6
|
-
installed: boolean;
|
|
7
|
-
version?: string;
|
|
8
|
-
})[];
|
|
9
|
-
selectedIndex: number;
|
|
10
|
-
onSelect?: (index: number) => void;
|
|
11
|
-
}
|
|
12
|
-
export declare const PluginList: React.FC<PluginListProps>;
|
|
13
|
-
export {};
|