wave-code 0.2.0 → 0.4.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/dist/commands/plugin/disable.d.ts +2 -1
- package/dist/commands/plugin/disable.d.ts.map +1 -1
- package/dist/commands/plugin/disable.js +3 -2
- package/dist/commands/plugin/enable.d.ts +2 -1
- package/dist/commands/plugin/enable.d.ts.map +1 -1
- package/dist/commands/plugin/enable.js +3 -2
- package/dist/commands/plugin/install.d.ts +2 -1
- package/dist/commands/plugin/install.d.ts.map +1 -1
- package/dist/commands/plugin/list.d.ts.map +1 -1
- package/dist/commands/plugin/list.js +15 -3
- package/dist/commands/plugin/marketplace.d.ts +3 -0
- package/dist/commands/plugin/marketplace.d.ts.map +1 -1
- package/dist/commands/plugin/marketplace.js +15 -1
- package/dist/commands/plugin/uninstall.d.ts +4 -0
- package/dist/commands/plugin/uninstall.d.ts.map +1 -0
- package/dist/commands/plugin/uninstall.js +29 -0
- package/dist/commands/plugin/update.d.ts +4 -0
- package/dist/commands/plugin/update.d.ts.map +1 -0
- package/dist/commands/plugin/update.js +15 -0
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +2 -2
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +6 -0
- package/dist/components/Confirmation.js +1 -1
- package/dist/components/DiscoverView.d.ts +3 -0
- package/dist/components/DiscoverView.d.ts.map +1 -0
- package/dist/components/DiscoverView.js +25 -0
- package/dist/components/FileSelector.js +1 -1
- package/dist/components/HistorySearch.d.ts +8 -0
- package/dist/components/HistorySearch.d.ts.map +1 -0
- package/dist/components/HistorySearch.js +67 -0
- package/dist/components/InputBox.d.ts +1 -1
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +26 -17
- package/dist/components/InstalledView.d.ts +3 -0
- package/dist/components/InstalledView.d.ts.map +1 -0
- package/dist/components/InstalledView.js +30 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +22 -9
- package/dist/components/MarketplaceAddForm.d.ts +3 -0
- package/dist/components/MarketplaceAddForm.d.ts.map +1 -0
- package/dist/components/MarketplaceAddForm.js +26 -0
- package/dist/components/MarketplaceDetail.d.ts +3 -0
- package/dist/components/MarketplaceDetail.d.ts.map +1 -0
- package/dist/components/MarketplaceDetail.js +38 -0
- package/dist/components/MarketplaceList.d.ts +9 -0
- package/dist/components/MarketplaceList.d.ts.map +1 -0
- package/dist/components/MarketplaceList.js +16 -0
- package/dist/components/MarketplaceView.d.ts +3 -0
- package/dist/components/MarketplaceView.d.ts.map +1 -0
- package/dist/components/MarketplaceView.js +28 -0
- package/dist/components/PluginDetail.d.ts +3 -0
- package/dist/components/PluginDetail.d.ts.map +1 -0
- package/dist/components/PluginDetail.js +63 -0
- package/dist/components/PluginList.d.ts +14 -0
- package/dist/components/PluginList.d.ts.map +1 -0
- package/dist/components/PluginList.js +12 -0
- package/dist/components/PluginManagerShell.d.ts +5 -0
- package/dist/components/PluginManagerShell.d.ts.map +1 -0
- package/dist/components/PluginManagerShell.js +89 -0
- package/dist/components/PluginManagerTypes.d.ts +33 -0
- package/dist/components/PluginManagerTypes.d.ts.map +1 -0
- package/dist/components/PluginManagerTypes.js +1 -0
- package/dist/components/RewindCommand.d.ts +9 -0
- package/dist/components/RewindCommand.d.ts.map +1 -0
- package/dist/components/RewindCommand.js +42 -0
- package/dist/components/SessionSelector.d.ts +11 -0
- package/dist/components/SessionSelector.d.ts.map +1 -0
- package/dist/components/SessionSelector.js +38 -0
- package/dist/components/SubagentBlock.d.ts.map +1 -1
- package/dist/components/SubagentBlock.js +20 -1
- package/dist/components/ToolResultDisplay.js +1 -1
- package/dist/contexts/PluginManagerContext.d.ts +4 -0
- package/dist/contexts/PluginManagerContext.d.ts.map +1 -0
- package/dist/contexts/PluginManagerContext.js +9 -0
- package/dist/contexts/useChat.d.ts +2 -0
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +21 -0
- package/dist/hooks/useInputManager.d.ts +6 -14
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +29 -45
- package/dist/hooks/usePluginManager.d.ts +3 -0
- package/dist/hooks/usePluginManager.d.ts.map +1 -0
- package/dist/hooks/usePluginManager.js +223 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +150 -177
- package/dist/managers/InputManager.d.ts +12 -21
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +77 -108
- package/dist/plugin-manager-cli.d.ts +6 -0
- package/dist/plugin-manager-cli.d.ts.map +1 -0
- package/dist/plugin-manager-cli.js +12 -0
- package/dist/session-selector-cli.d.ts +2 -0
- package/dist/session-selector-cli.d.ts.map +1 -0
- package/dist/session-selector-cli.js +25 -0
- package/package.json +7 -3
- package/src/commands/plugin/disable.ts +7 -3
- package/src/commands/plugin/enable.ts +7 -3
- package/src/commands/plugin/install.ts +2 -1
- package/src/commands/plugin/list.ts +21 -3
- package/src/commands/plugin/marketplace.ts +17 -1
- package/src/commands/plugin/uninstall.ts +39 -0
- package/src/commands/plugin/update.ts +19 -0
- package/src/components/ChatInterface.tsx +2 -1
- package/src/components/CommandSelector.tsx +7 -0
- package/src/components/Confirmation.tsx +1 -1
- package/src/components/DiscoverView.tsx +31 -0
- package/src/components/FileSelector.tsx +1 -1
- package/src/components/HistorySearch.tsx +148 -0
- package/src/components/InputBox.tsx +43 -28
- package/src/components/InstalledView.tsx +61 -0
- package/src/components/Markdown.tsx +37 -26
- package/src/components/MarketplaceAddForm.tsx +39 -0
- package/src/components/MarketplaceDetail.tsx +79 -0
- package/src/components/MarketplaceList.tsx +52 -0
- package/src/components/MarketplaceView.tsx +43 -0
- package/src/components/PluginDetail.tsx +147 -0
- package/src/components/PluginList.tsx +51 -0
- package/src/components/PluginManagerShell.tsx +189 -0
- package/src/components/PluginManagerTypes.ts +47 -0
- package/src/components/RewindCommand.tsx +114 -0
- package/src/components/SessionSelector.tsx +127 -0
- package/src/components/SubagentBlock.tsx +29 -1
- package/src/components/ToolResultDisplay.tsx +2 -2
- package/src/contexts/PluginManagerContext.ts +15 -0
- package/src/contexts/useChat.tsx +26 -0
- package/src/hooks/useInputManager.ts +29 -61
- package/src/hooks/usePluginManager.ts +296 -0
- package/src/index.ts +241 -280
- package/src/managers/InputManager.ts +93 -149
- package/src/plugin-manager-cli.tsx +13 -0
- package/src/session-selector-cli.tsx +37 -0
- package/dist/components/BashHistorySelector.d.ts +0 -11
- package/dist/components/BashHistorySelector.d.ts.map +0 -1
- package/dist/components/BashHistorySelector.js +0 -93
- package/dist/hooks/usePagination.d.ts +0 -20
- package/dist/hooks/usePagination.d.ts.map +0 -1
- package/dist/hooks/usePagination.js +0 -168
- package/src/components/BashHistorySelector.tsx +0 -181
- package/src/hooks/usePagination.ts +0 -203
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import React, { useMemo } from "react";
|
|
3
3
|
import { Box, Text, useStdout } from "ink";
|
|
4
4
|
import { marked } from "marked";
|
|
5
|
+
import { highlight } from "cli-highlight";
|
|
5
6
|
const unescapeHtml = (html) => {
|
|
6
7
|
return html
|
|
7
8
|
.replace(/&/g, "&")
|
|
8
9
|
.replace(/</g, "<")
|
|
9
10
|
.replace(/>/g, ">")
|
|
10
11
|
.replace(/"/g, '"')
|
|
11
|
-
.replace(/'/g, "'")
|
|
12
|
+
.replace(/'/g, "'")
|
|
13
|
+
.replace(/'/g, "'");
|
|
12
14
|
};
|
|
13
15
|
const InlineRenderer = ({ tokens }) => {
|
|
14
16
|
return (_jsx(_Fragment, { children: tokens.map((token, index) => {
|
|
@@ -26,8 +28,10 @@ const InlineRenderer = ({ tokens }) => {
|
|
|
26
28
|
return (_jsx(Text, { italic: true, children: token.tokens ? (_jsx(InlineRenderer, { tokens: token.tokens })) : (unescapeHtml(token.text)) }, index));
|
|
27
29
|
case "codespan":
|
|
28
30
|
return (_jsx(Text, { color: "yellow", children: unescapeHtml(token.text) }, index));
|
|
29
|
-
case "link":
|
|
30
|
-
|
|
31
|
+
case "link": {
|
|
32
|
+
const t = token;
|
|
33
|
+
return (_jsxs(Text, { children: [_jsx(Text, { color: "blue", underline: true, children: t.tokens ? (_jsx(InlineRenderer, { tokens: t.tokens })) : (unescapeHtml(t.text)) }), _jsxs(Text, { color: "gray", children: [" (", t.href, ")"] })] }, index));
|
|
34
|
+
}
|
|
31
35
|
case "br":
|
|
32
36
|
return _jsx(Text, { children: "\n" }, index);
|
|
33
37
|
case "del":
|
|
@@ -71,18 +75,27 @@ const BlockRenderer = ({ tokens }) => {
|
|
|
71
75
|
}
|
|
72
76
|
case "paragraph": {
|
|
73
77
|
const t = token;
|
|
74
|
-
return (_jsx(Box, { marginBottom: 1, flexDirection: "row",
|
|
78
|
+
return (_jsx(Box, { marginBottom: 1, flexDirection: "row", children: _jsx(Text, { children: _jsx(InlineRenderer, { tokens: t.tokens }) }) }, index));
|
|
75
79
|
}
|
|
76
80
|
case "code": {
|
|
77
81
|
const t = token;
|
|
78
82
|
if (t.lang !== undefined) {
|
|
79
|
-
const
|
|
83
|
+
const raw = token.raw.endsWith("\n")
|
|
84
|
+
? token.raw.slice(0, -1)
|
|
85
|
+
: token.raw;
|
|
86
|
+
const lines = raw.split("\n");
|
|
80
87
|
const opening = lines[0];
|
|
81
88
|
const closing = lines[lines.length - 1];
|
|
82
89
|
const content = lines.slice(1, -1).join("\n");
|
|
83
|
-
|
|
90
|
+
const highlighted = content
|
|
91
|
+
? highlight(unescapeHtml(content), {
|
|
92
|
+
language: t.lang,
|
|
93
|
+
ignoreIllegals: true,
|
|
94
|
+
})
|
|
95
|
+
: "";
|
|
96
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: [_jsx(Text, { color: "gray", children: opening }), highlighted && _jsx(Text, { children: highlighted }), _jsx(Text, { color: "gray", children: closing })] }, index));
|
|
84
97
|
}
|
|
85
|
-
return (_jsx(Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: _jsx(Text, { children: t.text }) }, index));
|
|
98
|
+
return (_jsx(Box, { flexDirection: "column", paddingX: 1, marginBottom: 1, children: _jsx(Text, { children: unescapeHtml(t.text) }) }, index));
|
|
86
99
|
}
|
|
87
100
|
case "list": {
|
|
88
101
|
const t = token;
|
|
@@ -91,7 +104,7 @@ const BlockRenderer = ({ tokens }) => {
|
|
|
91
104
|
return (_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: "gray", children: t.ordered ? `${start + i}. ` : "• " }), _jsx(Box, { flexDirection: "column", flexGrow: 1, children: item.tokens.map((itemToken, itemIndex) => {
|
|
92
105
|
if (itemToken.type === "text") {
|
|
93
106
|
const it = itemToken;
|
|
94
|
-
return (_jsx(Box, { flexDirection: "row",
|
|
107
|
+
return (_jsx(Box, { flexDirection: "row", children: _jsx(Text, { children: _jsx(InlineRenderer, { tokens: it.tokens || [itemToken] }) }) }, itemIndex));
|
|
95
108
|
}
|
|
96
109
|
return (_jsx(BlockRenderer, { tokens: [itemToken] }, itemIndex));
|
|
97
110
|
}) })] }, i));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketplaceAddForm.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceAddForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAkCtC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
+
export const MarketplaceAddForm = () => {
|
|
6
|
+
const { actions } = usePluginManagerContext();
|
|
7
|
+
const [source, setSource] = useState("");
|
|
8
|
+
useInput((input, key) => {
|
|
9
|
+
if (key.escape) {
|
|
10
|
+
actions.setView("MARKETPLACES");
|
|
11
|
+
}
|
|
12
|
+
else if (key.return) {
|
|
13
|
+
if (source.trim()) {
|
|
14
|
+
actions.addMarketplace(source.trim());
|
|
15
|
+
actions.setView("MARKETPLACES");
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
else if (key.backspace || key.delete) {
|
|
19
|
+
setSource((prev) => prev.slice(0, -1));
|
|
20
|
+
}
|
|
21
|
+
else if (input.length === 1) {
|
|
22
|
+
setSource((prev) => prev + input);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return (_jsxs(Box, { flexDirection: "column", padding: 1, children: [_jsx(Text, { bold: true, color: "cyan", children: "Add Marketplace" }), _jsxs(Box, { marginTop: 1, children: [_jsx(Text, { children: "Source (URL or Path): " }), _jsx(Text, { color: "yellow", children: source }), _jsx(Text, { color: "yellow", children: "_" })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Enter to add, Esc to cancel" }) })] }));
|
|
26
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketplaceDetail.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAIxC,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EA0ErC,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
+
export const MarketplaceDetail = () => {
|
|
6
|
+
const { state, marketplaces, actions } = usePluginManagerContext();
|
|
7
|
+
const [selectedActionIndex, setSelectedActionIndex] = useState(0);
|
|
8
|
+
const marketplace = marketplaces.find((m) => m.name === state.selectedId);
|
|
9
|
+
const ACTIONS = [
|
|
10
|
+
{ id: "update", label: "Update marketplace" },
|
|
11
|
+
{ id: "remove", label: "Remove marketplace" },
|
|
12
|
+
];
|
|
13
|
+
useInput((input, key) => {
|
|
14
|
+
if (key.escape) {
|
|
15
|
+
actions.setView("MARKETPLACES");
|
|
16
|
+
}
|
|
17
|
+
else if (key.upArrow) {
|
|
18
|
+
setSelectedActionIndex((prev) => prev > 0 ? prev - 1 : ACTIONS.length - 1);
|
|
19
|
+
}
|
|
20
|
+
else if (key.downArrow) {
|
|
21
|
+
setSelectedActionIndex((prev) => prev < ACTIONS.length - 1 ? prev + 1 : 0);
|
|
22
|
+
}
|
|
23
|
+
else if (key.return && marketplace) {
|
|
24
|
+
const action = ACTIONS[selectedActionIndex].id;
|
|
25
|
+
if (action === "update") {
|
|
26
|
+
actions.updateMarketplace(marketplace.name);
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
actions.removeMarketplace(marketplace.name);
|
|
30
|
+
}
|
|
31
|
+
actions.setView("MARKETPLACES");
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
if (!marketplace) {
|
|
35
|
+
return (_jsx(Box, { children: _jsx(Text, { color: "red", children: "Marketplace not found." }) }));
|
|
36
|
+
}
|
|
37
|
+
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)" })] }), _jsx(Box, { marginBottom: 1, children: _jsxs(Text, { children: ["Source: ", JSON.stringify(marketplace.source)] }) }), _jsxs(Box, { marginTop: 1, flexDirection: "column", children: [_jsx(Text, { bold: true, children: "Marketplace Actions:" }), ACTIONS.map((action, index) => (_jsxs(Text, { color: index === selectedActionIndex ? "yellow" : undefined, children: [index === selectedActionIndex ? "> " : " ", action.label] }, action.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Use \u2191/\u2193 to select, Enter to confirm" }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Esc to go back" }) })] })] }));
|
|
38
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { KnownMarketplace } from "wave-agent-sdk";
|
|
3
|
+
interface MarketplaceListProps {
|
|
4
|
+
marketplaces: KnownMarketplace[];
|
|
5
|
+
selectedIndex: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const MarketplaceList: React.FC<MarketplaceListProps>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=MarketplaceList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketplaceList.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,UAAU,oBAAoB;IAC5B,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA0C1D,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
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]" }))] }) }), _jsx(Box, { marginLeft: 4, children: _jsxs(Text, { dimColor: true, children: ["Source: ", sourceStr] }) })] }, marketplace.name));
|
|
15
|
+
}) }));
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MarketplaceView.d.ts","sourceRoot":"","sources":["../../src/components/MarketplaceView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAMxC,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAoCnC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
+
import { MarketplaceList } from "./MarketplaceList.js";
|
|
6
|
+
export const MarketplaceView = () => {
|
|
7
|
+
const { marketplaces, actions } = usePluginManagerContext();
|
|
8
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
9
|
+
useInput((input, key) => {
|
|
10
|
+
if (key.upArrow) {
|
|
11
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
12
|
+
}
|
|
13
|
+
else if (key.downArrow) {
|
|
14
|
+
setSelectedIndex(Math.min(marketplaces.length - 1, selectedIndex + 1));
|
|
15
|
+
}
|
|
16
|
+
else if (key.return) {
|
|
17
|
+
const mk = marketplaces[selectedIndex];
|
|
18
|
+
if (mk) {
|
|
19
|
+
actions.setSelectedId(mk.name);
|
|
20
|
+
actions.setView("MARKETPLACE_DETAIL");
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
else if (input === "a") {
|
|
24
|
+
actions.setView("ADD_MARKETPLACE");
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
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" }) }))] }));
|
|
28
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginDetail.d.ts","sourceRoot":"","sources":["../../src/components/PluginDetail.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAUxC,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAwIhC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
import { usePluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
5
|
+
const SCOPES = [
|
|
6
|
+
{ id: "project", label: "Install for all collaborators (project scope)" },
|
|
7
|
+
{ id: "user", label: "Install for you (user scope)" },
|
|
8
|
+
{ id: "local", label: "Install for you, in this repo only (local scope)" },
|
|
9
|
+
];
|
|
10
|
+
export const PluginDetail = () => {
|
|
11
|
+
const { state, discoverablePlugins, installedPlugins, actions } = usePluginManagerContext();
|
|
12
|
+
const [selectedScopeIndex, setSelectedScopeIndex] = useState(0);
|
|
13
|
+
const [selectedActionIndex, setSelectedActionIndex] = useState(0);
|
|
14
|
+
const plugin = discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId) ||
|
|
15
|
+
installedPlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId);
|
|
16
|
+
const INSTALLED_ACTIONS = [
|
|
17
|
+
{ id: "uninstall", label: "Uninstall plugin" },
|
|
18
|
+
{ id: "update", label: "Update plugin (reinstall)" },
|
|
19
|
+
];
|
|
20
|
+
const isInstalledAndEnabled = plugin && "enabled" in plugin && plugin.enabled;
|
|
21
|
+
useInput((input, key) => {
|
|
22
|
+
if (key.escape) {
|
|
23
|
+
const isFromDiscover = discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId);
|
|
24
|
+
actions.setView(isFromDiscover ? "DISCOVER" : "INSTALLED");
|
|
25
|
+
}
|
|
26
|
+
else if (key.upArrow) {
|
|
27
|
+
if (isInstalledAndEnabled) {
|
|
28
|
+
setSelectedActionIndex((prev) => prev > 0 ? prev - 1 : INSTALLED_ACTIONS.length - 1);
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
setSelectedScopeIndex((prev) => prev > 0 ? prev - 1 : SCOPES.length - 1);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
else if (key.downArrow) {
|
|
35
|
+
if (isInstalledAndEnabled) {
|
|
36
|
+
setSelectedActionIndex((prev) => prev < INSTALLED_ACTIONS.length - 1 ? prev + 1 : 0);
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
setSelectedScopeIndex((prev) => prev < SCOPES.length - 1 ? prev + 1 : 0);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
else if (key.return && plugin) {
|
|
43
|
+
if (isInstalledAndEnabled) {
|
|
44
|
+
const action = INSTALLED_ACTIONS[selectedActionIndex].id;
|
|
45
|
+
if (action === "uninstall") {
|
|
46
|
+
actions.uninstallPlugin(plugin.name, plugin.marketplace);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
actions.updatePlugin(plugin.name, plugin.marketplace);
|
|
50
|
+
}
|
|
51
|
+
actions.setView("INSTALLED");
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
actions.installPlugin(plugin.name, plugin.marketplace, SCOPES[selectedScopeIndex].id);
|
|
55
|
+
actions.setView("INSTALLED");
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
if (!plugin) {
|
|
60
|
+
return (_jsx(Box, { children: _jsx(Text, { color: "red", children: "Plugin not found." }) }));
|
|
61
|
+
}
|
|
62
|
+
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 })] }) })), _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 === selectedActionIndex ? "yellow" : undefined, children: [index === selectedActionIndex ? "> " : " ", action.label] }, action.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Use \u2191/\u2193 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 === selectedScopeIndex ? "green" : undefined, children: [index === selectedScopeIndex ? "> " : " ", scope.label] }, scope.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Use \u2191/\u2193 to select, Enter to install" }) })] })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Esc to go back" }) })] })] }));
|
|
63
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
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 {};
|
|
14
|
+
//# sourceMappingURL=PluginList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginList.d.ts","sourceRoot":"","sources":["../../src/components/PluginList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AAExD,UAAU,eAAe;IACvB,OAAO,EAAE,CAAC,sBAAsB,GAAG;QACjC,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,EAAE,CAAC;IACL,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CAoChD,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text } from "ink";
|
|
3
|
+
export const PluginList = ({ plugins, selectedIndex, }) => {
|
|
4
|
+
if (plugins.length === 0) {
|
|
5
|
+
return (_jsx(Box, { padding: 1, children: _jsx(Text, { dimColor: true, children: "No plugins found." }) }));
|
|
6
|
+
}
|
|
7
|
+
return (_jsx(Box, { flexDirection: "column", children: plugins.map((plugin, index) => {
|
|
8
|
+
const isSelected = index === selectedIndex;
|
|
9
|
+
const pluginId = `${plugin.name}@${plugin.marketplace}`;
|
|
10
|
+
return (_jsxs(Box, { flexDirection: "column", marginBottom: 1, children: [_jsx(Box, { children: _jsxs(Text, { color: isSelected ? "cyan" : undefined, children: [isSelected ? "> " : " ", _jsx(Text, { bold: true, children: plugin.name }), _jsxs(Text, { dimColor: true, children: [" @", plugin.marketplace] }), plugin.version && _jsxs(Text, { color: "blue", children: [" v", plugin.version] })] }) }), _jsx(Box, { marginLeft: 4, children: _jsx(Text, { dimColor: true, children: plugin.description }) })] }, pluginId));
|
|
11
|
+
}) }));
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginManagerShell.d.ts","sourceRoot":"","sources":["../../src/components/PluginManagerShell.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAY1B,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAgLvE,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { usePluginManager } from "../hooks/usePluginManager.js";
|
|
4
|
+
import { DiscoverView } from "./DiscoverView.js";
|
|
5
|
+
import { InstalledView } from "./InstalledView.js";
|
|
6
|
+
import { MarketplaceView } from "./MarketplaceView.js";
|
|
7
|
+
import { MarketplaceDetail } from "./MarketplaceDetail.js";
|
|
8
|
+
import { PluginDetail } from "./PluginDetail.js";
|
|
9
|
+
import { MarketplaceAddForm } from "./MarketplaceAddForm.js";
|
|
10
|
+
import { PluginManagerContext } from "../contexts/PluginManagerContext.js";
|
|
11
|
+
export const PluginManagerShell = ({ children, }) => {
|
|
12
|
+
const pluginManager = usePluginManager();
|
|
13
|
+
const { state, actions, discoverablePlugins } = pluginManager;
|
|
14
|
+
const setView = (view) => {
|
|
15
|
+
if (view !== "PLUGIN_DETAIL" &&
|
|
16
|
+
view !== "MARKETPLACE_DETAIL" &&
|
|
17
|
+
view !== "ADD_MARKETPLACE") {
|
|
18
|
+
actions.setSelectedId(null);
|
|
19
|
+
}
|
|
20
|
+
actions.setView(view);
|
|
21
|
+
};
|
|
22
|
+
useInput((input, key) => {
|
|
23
|
+
if (key.tab) {
|
|
24
|
+
const views = ["DISCOVER", "INSTALLED", "MARKETPLACES"];
|
|
25
|
+
const currentIndex = views.indexOf(state.currentView === "PLUGIN_DETAIL"
|
|
26
|
+
? discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId)
|
|
27
|
+
? "DISCOVER"
|
|
28
|
+
: "INSTALLED"
|
|
29
|
+
: state.currentView === "MARKETPLACE_DETAIL" ||
|
|
30
|
+
state.currentView === "ADD_MARKETPLACE"
|
|
31
|
+
? "MARKETPLACES"
|
|
32
|
+
: state.currentView);
|
|
33
|
+
let nextIndex;
|
|
34
|
+
if (key.shift) {
|
|
35
|
+
nextIndex = (currentIndex - 1 + views.length) % views.length;
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
nextIndex = (currentIndex + 1) % views.length;
|
|
39
|
+
}
|
|
40
|
+
setView(views[nextIndex]);
|
|
41
|
+
}
|
|
42
|
+
if (key.escape) {
|
|
43
|
+
if (state.currentView === "PLUGIN_DETAIL") {
|
|
44
|
+
const isFromDiscover = discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId);
|
|
45
|
+
setView(isFromDiscover ? "DISCOVER" : "INSTALLED");
|
|
46
|
+
}
|
|
47
|
+
else if (state.currentView === "MARKETPLACE_DETAIL" ||
|
|
48
|
+
state.currentView === "ADD_MARKETPLACE") {
|
|
49
|
+
setView("MARKETPLACES");
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
const renderView = () => {
|
|
54
|
+
if (state.isLoading && !state.selectedId) {
|
|
55
|
+
return (_jsx(Box, { padding: 1, children: _jsx(Text, { color: "yellow", children: "Loading..." }) }));
|
|
56
|
+
}
|
|
57
|
+
switch (state.currentView) {
|
|
58
|
+
case "DISCOVER":
|
|
59
|
+
return _jsx(DiscoverView, {});
|
|
60
|
+
case "INSTALLED":
|
|
61
|
+
return _jsx(InstalledView, {});
|
|
62
|
+
case "MARKETPLACES":
|
|
63
|
+
return _jsx(MarketplaceView, {});
|
|
64
|
+
case "MARKETPLACE_DETAIL":
|
|
65
|
+
return _jsx(MarketplaceDetail, {});
|
|
66
|
+
case "PLUGIN_DETAIL":
|
|
67
|
+
return _jsx(PluginDetail, {});
|
|
68
|
+
case "ADD_MARKETPLACE":
|
|
69
|
+
return _jsx(MarketplaceAddForm, {});
|
|
70
|
+
default:
|
|
71
|
+
return _jsx(DiscoverView, {});
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return (_jsx(PluginManagerContext.Provider, { value: pluginManager, children: _jsxs(Box, { flexDirection: "column", width: "100%", height: "100%", borderStyle: "round", borderColor: "cyan", children: [_jsxs(Box, { paddingX: 1, borderStyle: "single", borderBottom: true, borderTop: false, borderLeft: false, borderRight: false, children: [_jsx(Box, { marginRight: 2, children: _jsx(Text, { bold: true, color: "cyan", children: "Plugin Manager" }) }), _jsxs(Box, { children: [_jsxs(Text, { color: state.currentView === "DISCOVER" ||
|
|
75
|
+
(state.currentView === "PLUGIN_DETAIL" &&
|
|
76
|
+
!!discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId))
|
|
77
|
+
? "yellow"
|
|
78
|
+
: undefined, children: [" ", "Discover", " "] }), _jsxs(Text, { color: state.currentView === "INSTALLED" ||
|
|
79
|
+
(state.currentView === "PLUGIN_DETAIL" &&
|
|
80
|
+
!discoverablePlugins.find((p) => `${p.name}@${p.marketplace}` === state.selectedId))
|
|
81
|
+
? "yellow"
|
|
82
|
+
: undefined, children: [" ", "Installed", " "] }), _jsxs(Text, { color: state.currentView === "MARKETPLACES" ||
|
|
83
|
+
state.currentView === "MARKETPLACE_DETAIL" ||
|
|
84
|
+
state.currentView === "ADD_MARKETPLACE"
|
|
85
|
+
? "yellow"
|
|
86
|
+
: undefined, children: [" ", "Marketplaces", " "] })] })] }), _jsxs(Box, { flexGrow: 1, flexDirection: "column", padding: 1, children: [renderView(), children] }), _jsxs(Box, { paddingX: 1, borderStyle: "single", borderTop: true, borderBottom: false, borderLeft: false, borderRight: false, children: [_jsx(Text, { dimColor: true, children: state.isLoading
|
|
87
|
+
? "Loading..."
|
|
88
|
+
: "Use Tab to switch views, arrows to navigate, Enter to select, Esc to go back" }), state.error && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: "red", children: ["Error: ", state.error] }) }))] })] }) }));
|
|
89
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { KnownMarketplace, InstalledPlugin, MarketplacePluginEntry } from "wave-agent-sdk";
|
|
2
|
+
export type ViewType = "DISCOVER" | "INSTALLED" | "MARKETPLACES" | "PLUGIN_DETAIL" | "MARKETPLACE_DETAIL" | "ADD_MARKETPLACE";
|
|
3
|
+
export interface PluginManagerState {
|
|
4
|
+
currentView: ViewType;
|
|
5
|
+
selectedId: string | null;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
error: string | null;
|
|
8
|
+
searchQuery: string;
|
|
9
|
+
}
|
|
10
|
+
export interface PluginManagerContextType {
|
|
11
|
+
state: PluginManagerState;
|
|
12
|
+
marketplaces: KnownMarketplace[];
|
|
13
|
+
installedPlugins: (InstalledPlugin & {
|
|
14
|
+
enabled: boolean;
|
|
15
|
+
})[];
|
|
16
|
+
discoverablePlugins: (MarketplacePluginEntry & {
|
|
17
|
+
marketplace: string;
|
|
18
|
+
installed: boolean;
|
|
19
|
+
version?: string;
|
|
20
|
+
})[];
|
|
21
|
+
actions: {
|
|
22
|
+
setView: (view: ViewType) => void;
|
|
23
|
+
setSelectedId: (id: string | null) => void;
|
|
24
|
+
addMarketplace: (source: string) => Promise<void>;
|
|
25
|
+
removeMarketplace: (name: string) => Promise<void>;
|
|
26
|
+
updateMarketplace: (name: string) => Promise<void>;
|
|
27
|
+
installPlugin: (name: string, marketplace: string, scope?: "user" | "project" | "local") => Promise<void>;
|
|
28
|
+
uninstallPlugin: (name: string, marketplace: string) => Promise<void>;
|
|
29
|
+
updatePlugin: (name: string, marketplace: string) => Promise<void>;
|
|
30
|
+
refresh: () => Promise<void>;
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=PluginManagerTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PluginManagerTypes.d.ts","sourceRoot":"","sources":["../../src/components/PluginManagerTypes.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,sBAAsB,EACvB,MAAM,gBAAgB,CAAC;AAExB,MAAM,MAAM,QAAQ,GAChB,UAAU,GACV,WAAW,GACX,cAAc,GACd,eAAe,GACf,oBAAoB,GACpB,iBAAiB,CAAC;AAEtB,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,QAAQ,CAAC;IACtB,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,KAAK,EAAE,kBAAkB,CAAC;IAC1B,YAAY,EAAE,gBAAgB,EAAE,CAAC;IACjC,gBAAgB,EAAE,CAAC,eAAe,GAAG;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC,EAAE,CAAC;IAC7D,mBAAmB,EAAE,CAAC,sBAAsB,GAAG;QAC7C,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,OAAO,CAAC;QACnB,OAAO,CAAC,EAAE,MAAM,CAAC;KAClB,CAAC,EAAE,CAAC;IACL,OAAO,EAAE;QACP,OAAO,EAAE,CAAC,IAAI,EAAE,QAAQ,KAAK,IAAI,CAAC;QAClC,aAAa,EAAE,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;QAC3C,cAAc,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAClD,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACnD,iBAAiB,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACnD,aAAa,EAAE,CACb,IAAI,EAAE,MAAM,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,KACjC,OAAO,CAAC,IAAI,CAAC,CAAC;QACnB,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACtE,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QACnE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;KAC9B,CAAC;CACH"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { Message } from "wave-agent-sdk";
|
|
3
|
+
export interface RewindCommandProps {
|
|
4
|
+
messages: Message[];
|
|
5
|
+
onSelect: (index: number) => void;
|
|
6
|
+
onCancel: () => void;
|
|
7
|
+
}
|
|
8
|
+
export declare const RewindCommand: React.FC<RewindCommandProps>;
|
|
9
|
+
//# sourceMappingURL=RewindCommand.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RewindCommand.d.ts","sourceRoot":"","sources":["../../src/components/RewindCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,OAAO,EAAa,MAAM,gBAAgB,CAAC;AAEzD,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CAuGtD,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
export const RewindCommand = ({ messages, onSelect, onCancel, }) => {
|
|
5
|
+
// Filter user messages as checkpoints
|
|
6
|
+
const checkpoints = messages
|
|
7
|
+
.map((msg, index) => ({ msg, index }))
|
|
8
|
+
.filter(({ msg }) => msg.role === "user");
|
|
9
|
+
const [selectedIndex, setSelectedIndex] = useState(checkpoints.length - 1);
|
|
10
|
+
useInput((input, key) => {
|
|
11
|
+
if (key.return) {
|
|
12
|
+
if (checkpoints.length > 0 && selectedIndex >= 0) {
|
|
13
|
+
onSelect(checkpoints[selectedIndex].index);
|
|
14
|
+
}
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (key.escape) {
|
|
18
|
+
onCancel();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (key.upArrow) {
|
|
22
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (key.downArrow) {
|
|
26
|
+
setSelectedIndex(Math.min(checkpoints.length - 1, selectedIndex + 1));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
if (checkpoints.length === 0) {
|
|
31
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, borderStyle: "single", borderColor: "yellow", borderLeft: false, borderRight: false, children: [_jsx(Text, { color: "yellow", children: "No user messages found to rewind to." }), _jsx(Text, { dimColor: true, children: "Press Escape to cancel" })] }));
|
|
32
|
+
}
|
|
33
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, gap: 1, borderStyle: "single", borderColor: "cyan", borderLeft: false, borderRight: false, children: [_jsx(Box, { children: _jsx(Text, { color: "cyan", bold: true, children: "Rewind: Select a message to revert to" }) }), _jsx(Box, { flexDirection: "column", children: checkpoints.map((checkpoint, index) => {
|
|
34
|
+
const isSelected = index === selectedIndex;
|
|
35
|
+
const content = checkpoint.msg.blocks
|
|
36
|
+
.filter((b) => b.type === "text")
|
|
37
|
+
.map((b) => b.content)
|
|
38
|
+
.join(" ")
|
|
39
|
+
.substring(0, 60);
|
|
40
|
+
return (_jsx(Box, { children: _jsxs(Text, { color: isSelected ? "black" : "white", backgroundColor: isSelected ? "cyan" : undefined, children: [isSelected ? "▶ " : " ", "[", checkpoint.index, "]", " ", content || "(No text content)", index === checkpoints.length - 1 ? " (Latest)" : ""] }) }, checkpoint.index));
|
|
41
|
+
}) }), _jsx(Box, { children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter to rewind \u2022 Esc to cancel" }) }), _jsx(Box, { children: _jsx(Text, { color: "red", dimColor: true, children: "\u26A0\uFE0F Warning: This will delete all subsequent messages and revert file changes." }) })] }));
|
|
42
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { SessionMetadata } from "wave-agent-sdk";
|
|
3
|
+
export interface SessionSelectorProps {
|
|
4
|
+
sessions: (SessionMetadata & {
|
|
5
|
+
firstMessage?: string;
|
|
6
|
+
})[];
|
|
7
|
+
onSelect: (sessionId: string) => void;
|
|
8
|
+
onCancel: () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare const SessionSelector: React.FC<SessionSelectorProps>;
|
|
11
|
+
//# sourceMappingURL=SessionSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SessionSelector.d.ts","sourceRoot":"","sources":["../../src/components/SessionSelector.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,CAAC,eAAe,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC,EAAE,CAAC;IAC1D,QAAQ,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAoH1D,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { Box, Text, useInput } from "ink";
|
|
4
|
+
export const SessionSelector = ({ sessions, onSelect, onCancel, }) => {
|
|
5
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
6
|
+
useInput((input, key) => {
|
|
7
|
+
if (key.return) {
|
|
8
|
+
if (sessions.length > 0 && selectedIndex < sessions.length) {
|
|
9
|
+
onSelect(sessions[selectedIndex].id);
|
|
10
|
+
}
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
if (key.escape) {
|
|
14
|
+
onCancel();
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
if (key.upArrow) {
|
|
18
|
+
setSelectedIndex(Math.max(0, selectedIndex - 1));
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
if (key.downArrow) {
|
|
22
|
+
setSelectedIndex(Math.min(sessions.length - 1, selectedIndex + 1));
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
});
|
|
26
|
+
if (sessions.length === 0) {
|
|
27
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "single", borderColor: "yellow", borderLeft: false, borderRight: false, paddingX: 1, width: "100%", children: [_jsx(Text, { color: "yellow", children: "No sessions found." }), _jsx(Text, { dimColor: true, children: "Press Escape to cancel" })] }));
|
|
28
|
+
}
|
|
29
|
+
const maxDisplay = 10;
|
|
30
|
+
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(maxDisplay / 2), sessions.length - maxDisplay));
|
|
31
|
+
const displaySessions = sessions.slice(startIndex, startIndex + maxDisplay);
|
|
32
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, gap: 1, borderStyle: "single", borderColor: "cyan", borderLeft: false, borderRight: false, width: "100%", children: [_jsx(Box, { children: _jsx(Text, { color: "cyan", bold: true, children: "Select a session to resume" }) }), _jsx(Box, { flexDirection: "column", children: displaySessions.map((session, index) => {
|
|
33
|
+
const actualIndex = startIndex + index;
|
|
34
|
+
const isSelected = actualIndex === selectedIndex;
|
|
35
|
+
const lastActiveAt = new Date(session.lastActiveAt).toLocaleString();
|
|
36
|
+
return (_jsxs(Box, { flexDirection: "column", width: "100%", children: [_jsx(Box, { width: "100%", children: _jsxs(Text, { color: isSelected ? "black" : "white", backgroundColor: isSelected ? "cyan" : undefined, children: [isSelected ? "▶ " : " ", session.id, " | ", lastActiveAt, " | ", session.latestTotalTokens, " ", "tokens"] }) }), _jsx(Box, { marginLeft: 4, width: "100%", children: _jsx(Text, { dimColor: true, italic: true, children: session.firstMessage }) })] }, session.id));
|
|
37
|
+
}) }), sessions.length > maxDisplay && (_jsx(Box, { children: _jsxs(Text, { dimColor: true, children: ["... showing ", displaySessions.length, " of ", sessions.length, " sessions"] }) })), _jsx(Box, { children: _jsx(Text, { dimColor: true, children: "\u2191\u2193 navigate \u2022 Enter to select \u2022 Esc to cancel" }) })] }));
|
|
38
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubagentBlock.d.ts","sourceRoot":"","sources":["../../src/components/SubagentBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"SubagentBlock.d.ts","sourceRoot":"","sources":["../../src/components/SubagentBlock.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,aAAa,IAAI,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AAIzE,UAAU,kBAAkB;IAC1B,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+HtD,CAAC"}
|