wave-code 0.7.2 → 0.8.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/cli.d.ts +2 -4
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +24 -52
- package/dist/components/App.d.ts +3 -4
- package/dist/components/App.d.ts.map +1 -1
- package/dist/components/App.js +49 -6
- package/dist/components/BangDisplay.d.ts +9 -0
- package/dist/components/BangDisplay.d.ts.map +1 -0
- package/dist/components/{CommandOutputDisplay.js → BangDisplay.js} +1 -1
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +3 -2
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +18 -2
- package/dist/components/ConfirmationSelector.d.ts.map +1 -1
- package/dist/components/ConfirmationSelector.js +105 -8
- package/dist/components/HelpView.d.ts.map +1 -1
- package/dist/components/HelpView.js +2 -0
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +9 -3
- package/dist/components/MarketplaceAddForm.d.ts.map +1 -1
- package/dist/components/MarketplaceAddForm.js +13 -6
- package/dist/components/MarketplaceDetail.d.ts.map +1 -1
- package/dist/components/MarketplaceDetail.js +8 -3
- package/dist/components/MessageBlockItem.js +2 -2
- package/dist/components/MessageList.d.ts +4 -1
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +15 -8
- package/dist/components/PluginDetail.d.ts.map +1 -1
- package/dist/components/PluginDetail.js +14 -3
- package/dist/components/PluginManagerShell.d.ts.map +1 -1
- package/dist/components/PluginManagerShell.js +3 -3
- package/dist/components/PluginManagerTypes.d.ts +2 -0
- package/dist/components/PluginManagerTypes.d.ts.map +1 -1
- package/dist/components/SessionSelector.d.ts.map +1 -1
- package/dist/components/SessionSelector.js +5 -5
- package/dist/components/StatusCommand.d.ts +6 -0
- package/dist/components/StatusCommand.d.ts.map +1 -0
- package/dist/components/StatusCommand.js +28 -0
- package/dist/components/WorktreeExitPrompt.d.ts +13 -0
- package/dist/components/WorktreeExitPrompt.d.ts.map +1 -0
- package/dist/components/WorktreeExitPrompt.js +26 -0
- package/dist/contexts/useChat.d.ts +9 -5
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +38 -8
- package/dist/contracts/status.d.ts +8 -0
- package/dist/contracts/status.d.ts.map +1 -0
- package/dist/contracts/status.js +1 -0
- package/dist/hooks/useInputManager.d.ts +2 -0
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +12 -0
- package/dist/hooks/usePluginManager.d.ts.map +1 -1
- package/dist/hooks/usePluginManager.js +41 -13
- package/dist/hooks/useTasks.js +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -4
- package/dist/managers/InputManager.d.ts +6 -0
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +32 -13
- package/dist/print-cli.d.ts +2 -4
- package/dist/print-cli.d.ts.map +1 -1
- package/dist/print-cli.js +31 -2
- package/dist/session-selector-cli.d.ts +3 -1
- package/dist/session-selector-cli.d.ts.map +1 -1
- package/dist/session-selector-cli.js +2 -2
- package/dist/types.d.ts +11 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/dist/utils/worktree.d.ts +23 -0
- package/dist/utils/worktree.d.ts.map +1 -0
- package/dist/utils/worktree.js +135 -0
- package/package.json +2 -2
- package/src/cli.tsx +36 -59
- package/src/components/App.tsx +99 -11
- package/src/components/{CommandOutputDisplay.tsx → BangDisplay.tsx} +4 -4
- package/src/components/ChatInterface.tsx +8 -0
- package/src/components/CommandSelector.tsx +18 -1
- package/src/components/ConfirmationSelector.tsx +118 -9
- package/src/components/HelpView.tsx +2 -0
- package/src/components/InputBox.tsx +11 -1
- package/src/components/MarketplaceAddForm.tsx +21 -8
- package/src/components/MarketplaceDetail.tsx +19 -4
- package/src/components/MessageBlockItem.tsx +3 -3
- package/src/components/MessageList.tsx +47 -23
- package/src/components/PluginDetail.tsx +30 -6
- package/src/components/PluginManagerShell.tsx +24 -6
- package/src/components/PluginManagerTypes.ts +2 -0
- package/src/components/SessionSelector.tsx +33 -16
- package/src/components/StatusCommand.tsx +94 -0
- package/src/components/WorktreeExitPrompt.tsx +86 -0
- package/src/contexts/useChat.tsx +57 -13
- package/src/contracts/status.ts +7 -0
- package/src/hooks/useInputManager.ts +12 -0
- package/src/hooks/usePluginManager.ts +47 -13
- package/src/hooks/useTasks.ts +2 -2
- package/src/index.ts +71 -12
- package/src/managers/InputManager.ts +37 -15
- package/src/print-cli.ts +48 -5
- package/src/session-selector-cli.tsx +6 -2
- package/src/types.ts +11 -0
- package/src/utils/worktree.ts +164 -0
- package/dist/components/CommandOutputDisplay.d.ts +0 -9
- package/dist/components/CommandOutputDisplay.d.ts.map +0 -1
|
@@ -20,7 +20,7 @@ export const MarketplaceDetail = () => {
|
|
|
20
20
|
else if (key.downArrow) {
|
|
21
21
|
setSelectedActionIndex((prev) => prev < ACTIONS.length - 1 ? prev + 1 : 0);
|
|
22
22
|
}
|
|
23
|
-
else if (key.return && marketplace) {
|
|
23
|
+
else if (key.return && marketplace && !state.isLoading) {
|
|
24
24
|
const action = ACTIONS[selectedActionIndex].id;
|
|
25
25
|
if (action === "update") {
|
|
26
26
|
actions.updateMarketplace(marketplace.name);
|
|
@@ -28,11 +28,16 @@ export const MarketplaceDetail = () => {
|
|
|
28
28
|
else {
|
|
29
29
|
actions.removeMarketplace(marketplace.name);
|
|
30
30
|
}
|
|
31
|
-
actions.setView("MARKETPLACES");
|
|
32
31
|
}
|
|
33
32
|
});
|
|
34
33
|
if (!marketplace) {
|
|
35
34
|
return (_jsx(Box, { children: _jsx(Text, { color: "red", children: "Marketplace not found." }) }));
|
|
36
35
|
}
|
|
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)] }) }),
|
|
36
|
+
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)] }) }), 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
|
|
37
|
+
? state.isLoading
|
|
38
|
+
? "gray"
|
|
39
|
+
: "yellow"
|
|
40
|
+
: undefined, children: [index === selectedActionIndex ? "> " : " ", action.label] }, action.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: state.isLoading
|
|
41
|
+
? "Please wait..."
|
|
42
|
+
: "Use ↑/↓ to select, Enter to confirm" }) }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Esc to go back" }) })] })] }));
|
|
38
43
|
};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Box, Text } from "ink";
|
|
3
3
|
import { MessageSource } from "wave-agent-sdk";
|
|
4
|
-
import {
|
|
4
|
+
import { BangDisplay } from "./BangDisplay.js";
|
|
5
5
|
import { ToolDisplay } from "./ToolDisplay.js";
|
|
6
6
|
import { CompressDisplay } from "./CompressDisplay.js";
|
|
7
7
|
import { ReasoningDisplay } from "./ReasoningDisplay.js";
|
|
8
8
|
import { Markdown } from "./Markdown.js";
|
|
9
9
|
export const MessageBlockItem = ({ block, message, isExpanded, paddingTop = 0, }) => {
|
|
10
|
-
return (_jsxs(Box, { flexDirection: "column", paddingTop: paddingTop, children: [block.type === "text" && block.content.trim() && (_jsxs(Box, { children: [block.customCommandContent && (_jsxs(Text, { color: "cyan", bold: true, children: ["$", " "] })), block.source === MessageSource.HOOK && (_jsxs(Text, { color: "magenta", bold: true, children: ["~", " "] })), message.role === "user" ? (_jsx(Text, { backgroundColor: "gray", color: "white", children: block.content })) : (_jsx(Markdown, { children: block.content }))] })), block.type === "error" && (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", block.content] }) })), block.type === "
|
|
10
|
+
return (_jsxs(Box, { flexDirection: "column", paddingTop: paddingTop, children: [block.type === "text" && block.content.trim() && (_jsxs(Box, { children: [block.customCommandContent && (_jsxs(Text, { color: "cyan", bold: true, children: ["$", " "] })), block.source === MessageSource.HOOK && (_jsxs(Text, { color: "magenta", bold: true, children: ["~", " "] })), message.role === "user" ? (_jsx(Text, { backgroundColor: "gray", color: "white", children: block.content })) : (_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 === "compress" && (_jsx(CompressDisplay, { block: block, isExpanded: isExpanded })), block.type === "reasoning" && _jsx(ReasoningDisplay, { block: block })] }));
|
|
11
11
|
};
|
|
@@ -4,6 +4,9 @@ export interface MessageListProps {
|
|
|
4
4
|
messages: Message[];
|
|
5
5
|
isExpanded?: boolean;
|
|
6
6
|
hideDynamicBlocks?: boolean;
|
|
7
|
+
version?: string;
|
|
8
|
+
workdir?: string;
|
|
9
|
+
model?: string;
|
|
7
10
|
}
|
|
8
|
-
export declare const MessageList: React.MemoExoticComponent<({ messages, isExpanded, hideDynamicBlocks, }: MessageListProps) => import("react/jsx-runtime").JSX.Element>;
|
|
11
|
+
export declare const MessageList: React.MemoExoticComponent<({ messages, isExpanded, hideDynamicBlocks, version, workdir, model, }: MessageListProps) => import("react/jsx-runtime").JSX.Element>;
|
|
9
12
|
//# sourceMappingURL=MessageList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../src/components/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"MessageList.d.ts","sourceRoot":"","sources":["../../src/components/MessageList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAG9C,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,WAAW,oGAQnB,gBAAgB,6CAoGpB,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from "react";
|
|
3
|
+
import os from "os";
|
|
3
4
|
import { Box, Text, Static } from "ink";
|
|
4
5
|
import { MessageBlockItem } from "./MessageBlockItem.js";
|
|
5
|
-
export const MessageList = React.memo(({ messages, isExpanded = false, hideDynamicBlocks = false, }) => {
|
|
6
|
-
|
|
7
|
-
if (messages.length === 0) {
|
|
8
|
-
return (_jsx(Box, { flexDirection: "column", gap: 1, children: _jsx(Box, { flexDirection: "column", paddingY: 1, children: _jsx(Text, { color: "gray", children: "Welcome to WAVE Code Assistant!" }) }) }));
|
|
9
|
-
}
|
|
6
|
+
export const MessageList = React.memo(({ messages, isExpanded = false, hideDynamicBlocks = false, version, workdir, model, }) => {
|
|
7
|
+
const welcomeMessage = (_jsxs(Box, { flexDirection: "column", paddingTop: 1, children: [_jsxs(Text, { color: "gray", children: ["WAVE", version ? ` v${version}` : "", model ? ` • ${model}` : ""] }), workdir && (_jsx(Text, { color: "gray", wrap: "truncate-middle", children: workdir.replace(os.homedir(), "~") }))] }));
|
|
10
8
|
// Limit messages when expanded to prevent long rendering times
|
|
11
9
|
const maxExpandedMessages = 20;
|
|
12
10
|
const shouldLimitMessages = isExpanded && messages.length > maxExpandedMessages;
|
|
@@ -31,14 +29,23 @@ export const MessageList = React.memo(({ messages, isExpanded = false, hideDynam
|
|
|
31
29
|
const { block, isLastMessage } = item;
|
|
32
30
|
const isDynamic = isLastMessage &&
|
|
33
31
|
((block.type === "tool" && block.stage !== "end") ||
|
|
34
|
-
(block.type === "
|
|
32
|
+
(block.type === "bang" && block.isRunning));
|
|
35
33
|
return { ...item, isDynamic };
|
|
36
34
|
});
|
|
37
35
|
const staticBlocks = blocksWithStatus.filter((b) => !b.isDynamic);
|
|
38
36
|
const dynamicBlocks = hideDynamicBlocks
|
|
39
37
|
? []
|
|
40
38
|
: blocksWithStatus.filter((b) => b.isDynamic);
|
|
41
|
-
|
|
39
|
+
const staticItems = [
|
|
40
|
+
{ isWelcome: true, key: "welcome", block: undefined, message: undefined },
|
|
41
|
+
...staticBlocks.map((b) => ({ ...b, isWelcome: false })),
|
|
42
|
+
];
|
|
43
|
+
return (_jsxs(Box, { flexDirection: "column", paddingBottom: 1, children: [staticItems.length > 0 && (_jsx(Static, { items: staticItems, children: (item) => {
|
|
44
|
+
if (item.isWelcome) {
|
|
45
|
+
return (_jsx(React.Fragment, { children: welcomeMessage }, item.key));
|
|
46
|
+
}
|
|
47
|
+
return (_jsx(MessageBlockItem, { block: item.block, message: item.message, isExpanded: isExpanded, paddingTop: 1 }, item.key));
|
|
48
|
+
} })), 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))) }))] }));
|
|
42
49
|
});
|
|
43
50
|
// Add display name for debugging
|
|
44
51
|
MessageList.displayName = "MessageList";
|
|
@@ -1 +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,
|
|
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,EA+JhC,CAAC"}
|
|
@@ -31,7 +31,7 @@ export const PluginDetail = () => {
|
|
|
31
31
|
setSelectedActionIndex((prev) => prev < INSTALLED_ACTIONS.length - 1 ? prev + 1 : 0);
|
|
32
32
|
setSelectedScopeIndex((prev) => prev < SCOPES.length - 1 ? prev + 1 : 0);
|
|
33
33
|
}
|
|
34
|
-
else if (key.return && plugin) {
|
|
34
|
+
else if (key.return && plugin && !state.isLoading) {
|
|
35
35
|
if (isInstalledAndEnabled) {
|
|
36
36
|
setSelectedActionIndex((prev) => {
|
|
37
37
|
const action = INSTALLED_ACTIONS[prev].id;
|
|
@@ -50,11 +50,22 @@ export const PluginDetail = () => {
|
|
|
50
50
|
return prev;
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
actions.setView("INSTALLED");
|
|
54
53
|
}
|
|
55
54
|
});
|
|
56
55
|
if (!plugin) {
|
|
57
56
|
return (_jsx(Box, { children: _jsx(Text, { color: "red", children: "Plugin not found." }) }));
|
|
58
57
|
}
|
|
59
|
-
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 })] }) })),
|
|
58
|
+
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 === selectedActionIndex
|
|
59
|
+
? state.isLoading
|
|
60
|
+
? "gray"
|
|
61
|
+
: "yellow"
|
|
62
|
+
: undefined, children: [index === selectedActionIndex ? "> " : " ", action.label] }, action.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: state.isLoading
|
|
63
|
+
? "Please wait..."
|
|
64
|
+
: "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 === selectedScopeIndex
|
|
65
|
+
? state.isLoading
|
|
66
|
+
? "gray"
|
|
67
|
+
: "green"
|
|
68
|
+
: undefined, children: [index === selectedScopeIndex ? "> " : " ", scope.label] }, scope.id))), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: state.isLoading
|
|
69
|
+
? "Please wait..."
|
|
70
|
+
: "Use ↑/↓ to select, Enter to install" }) })] })), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Press Esc to go back" }) })] })] }));
|
|
60
71
|
};
|
|
@@ -1 +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,
|
|
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,CAkMvE,CAAC"}
|
|
@@ -83,7 +83,7 @@ export const PluginManagerShell = ({ children, }) => {
|
|
|
83
83
|
state.currentView === "MARKETPLACE_DETAIL" ||
|
|
84
84
|
state.currentView === "ADD_MARKETPLACE"
|
|
85
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
|
-
|
|
88
|
-
|
|
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(Box, { flexGrow: 1, 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.isLoading && (_jsx(Box, { marginLeft: 2, children: _jsx(Text, { color: "yellow", bold: true, children: "\u231B Processing..." }) })), state.successMessage && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: "green", bold: true, children: ["\u2713 ", state.successMessage] }) })), state.error && (_jsx(Box, { marginLeft: 2, children: _jsxs(Text, { color: "red", bold: true, children: ["\u2717 Error: ", state.error] }) }))] })] }) }));
|
|
89
89
|
};
|
|
@@ -5,6 +5,7 @@ export interface PluginManagerState {
|
|
|
5
5
|
selectedId: string | null;
|
|
6
6
|
isLoading: boolean;
|
|
7
7
|
error: string | null;
|
|
8
|
+
successMessage: string | null;
|
|
8
9
|
searchQuery: string;
|
|
9
10
|
}
|
|
10
11
|
export interface PluginManagerContextType {
|
|
@@ -28,6 +29,7 @@ export interface PluginManagerContextType {
|
|
|
28
29
|
uninstallPlugin: (name: string, marketplace: string) => Promise<void>;
|
|
29
30
|
updatePlugin: (name: string, marketplace: string) => Promise<void>;
|
|
30
31
|
refresh: () => Promise<void>;
|
|
32
|
+
clearPluginFeedback: () => void;
|
|
31
33
|
};
|
|
32
34
|
}
|
|
33
35
|
//# sourceMappingURL=PluginManagerTypes.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PluginManagerTypes.d.ts","sourceRoot":"","sources":["../../src/components/PluginManagerTypes.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I,CAAC;IACtC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,
|
|
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,CAqI1D,CAAC"}
|
|
@@ -26,13 +26,13 @@ export const SessionSelector = ({ sessions, onSelect, onCancel, }) => {
|
|
|
26
26
|
if (sessions.length === 0) {
|
|
27
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
28
|
}
|
|
29
|
-
const
|
|
30
|
-
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(
|
|
31
|
-
const displaySessions = sessions.slice(startIndex, startIndex +
|
|
29
|
+
const MAX_VISIBLE_ITEMS = 3;
|
|
30
|
+
const startIndex = Math.max(0, Math.min(selectedIndex - Math.floor(MAX_VISIBLE_ITEMS / 2), Math.max(0, sessions.length - MAX_VISIBLE_ITEMS)));
|
|
31
|
+
const displaySessions = sessions.slice(startIndex, startIndex + MAX_VISIBLE_ITEMS);
|
|
32
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
33
|
const actualIndex = startIndex + index;
|
|
34
34
|
const isSelected = actualIndex === selectedIndex;
|
|
35
35
|
const lastActiveAt = new Date(session.lastActiveAt).toLocaleString();
|
|
36
|
-
return (_jsxs(Box, { flexDirection: "column", width: "100%", children: [
|
|
37
|
-
}) }), sessions.length >
|
|
36
|
+
return (_jsxs(Box, { flexDirection: "column", width: "100%", children: [_jsxs(Box, { width: "100%", children: [_jsx(Box, { backgroundColor: isSelected ? "cyan" : undefined, flexShrink: 0, children: _jsx(Text, { color: isSelected ? "black" : "white", children: isSelected ? "▶ " : " " }) }), _jsx(Box, { backgroundColor: isSelected ? "cyan" : undefined, flexGrow: 1, children: _jsxs(Text, { color: isSelected ? "black" : "white", wrap: "truncate-end", children: [session.id, " | ", lastActiveAt, " | ", session.latestTotalTokens, " ", "tokens"] }) })] }), isSelected && session.firstMessage && (_jsx(Box, { marginLeft: 2, width: "100%", children: _jsx(Text, { dimColor: true, italic: true, wrap: "truncate-end", children: session.firstMessage.replace(/\n/g, "\\n") }) }))] }, session.id));
|
|
37
|
+
}) }), sessions.length > MAX_VISIBLE_ITEMS && (_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
38
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StatusCommand.d.ts","sourceRoot":"","sources":["../../src/components/StatusCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,MAAM,WAAW,kBAAkB;IACjC,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,kBAAkB,CA+EtD,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Text, useInput } from "ink";
|
|
3
|
+
import { useChat } from "../contexts/useChat.js";
|
|
4
|
+
import fs from "fs";
|
|
5
|
+
import path from "path";
|
|
6
|
+
import { fileURLToPath } from "url";
|
|
7
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
8
|
+
const __dirname = path.dirname(__filename);
|
|
9
|
+
export const StatusCommand = ({ onCancel }) => {
|
|
10
|
+
const { sessionId, workingDirectory, getGatewayConfig, getModelConfig } = useChat();
|
|
11
|
+
useInput((_, key) => {
|
|
12
|
+
if (key.escape) {
|
|
13
|
+
onCancel();
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
const gatewayConfig = getGatewayConfig();
|
|
17
|
+
const modelConfig = getModelConfig();
|
|
18
|
+
let version = "unknown";
|
|
19
|
+
try {
|
|
20
|
+
const pkgPath = path.resolve(__dirname, "../../package.json");
|
|
21
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
22
|
+
version = pkg.version;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Fallback if package.json cannot be read
|
|
26
|
+
}
|
|
27
|
+
return (_jsxs(Box, { flexDirection: "column", borderStyle: "round", borderColor: "cyan", borderLeft: false, borderRight: false, paddingX: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { color: "cyan", bold: true, underline: true, children: "Agent Status" }) }), _jsxs(Box, { children: [_jsx(Box, { width: 20, children: _jsx(Text, { color: "yellow", children: "Version:" }) }), _jsx(Text, { color: "white", children: version })] }), _jsxs(Box, { children: [_jsx(Box, { width: 20, children: _jsx(Text, { color: "yellow", children: "Session ID:" }) }), _jsx(Text, { color: "white", children: sessionId })] }), _jsxs(Box, { children: [_jsx(Box, { width: 20, children: _jsx(Text, { color: "yellow", children: "cwd:" }) }), _jsx(Text, { color: "white", wrap: "wrap", children: workingDirectory })] }), _jsxs(Box, { children: [_jsx(Box, { width: 20, children: _jsx(Text, { color: "yellow", children: "Wave base URL:" }) }), _jsx(Text, { color: "white", children: gatewayConfig.baseURL })] }), _jsxs(Box, { children: [_jsx(Box, { width: 20, children: _jsx(Text, { color: "yellow", children: "Model:" }) }), _jsx(Text, { color: "white", children: modelConfig.model })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Esc to cancel" }) })] }));
|
|
28
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
interface WorktreeExitPromptProps {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
hasUncommittedChanges: boolean;
|
|
6
|
+
hasNewCommits: boolean;
|
|
7
|
+
onKeep: () => void;
|
|
8
|
+
onRemove: () => void;
|
|
9
|
+
onCancel: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const WorktreeExitPrompt: React.FC<WorktreeExitPromptProps>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=WorktreeExitPrompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"WorktreeExitPrompt.d.ts","sourceRoot":"","sources":["../../src/components/WorktreeExitPrompt.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,UAAU,uBAAuB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,qBAAqB,EAAE,OAAO,CAAC;IAC/B,aAAa,EAAE,OAAO,CAAC;IACvB,MAAM,EAAE,MAAM,IAAI,CAAC;IACnB,QAAQ,EAAE,MAAM,IAAI,CAAC;IACrB,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,eAAO,MAAM,kBAAkB,EAAE,KAAK,CAAC,EAAE,CAAC,uBAAuB,CAwEhE,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
|
+
export const WorktreeExitPrompt = ({ name, path: worktreePath, hasUncommittedChanges, hasNewCommits, onKeep, onRemove, onCancel, }) => {
|
|
5
|
+
const [selectedIndex, setSelectedIndex] = useState(0);
|
|
6
|
+
useInput((input, key) => {
|
|
7
|
+
if (key.upArrow) {
|
|
8
|
+
setSelectedIndex((prev) => (prev === 0 ? 1 : 0));
|
|
9
|
+
}
|
|
10
|
+
if (key.downArrow) {
|
|
11
|
+
setSelectedIndex((prev) => (prev === 1 ? 0 : 1));
|
|
12
|
+
}
|
|
13
|
+
if (key.return) {
|
|
14
|
+
if (selectedIndex === 0) {
|
|
15
|
+
onKeep();
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
onRemove();
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
if (key.escape) {
|
|
22
|
+
onCancel();
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return (_jsxs(Box, { flexDirection: "column", paddingX: 1, marginY: 1, children: [_jsx(Box, { marginBottom: 1, children: _jsx(Text, { bold: true, children: "Exiting worktree session" }) }), _jsx(Box, { marginBottom: 1, children: hasUncommittedChanges && hasNewCommits ? (_jsx(Text, { children: "You have uncommitted changes and new commits. These will be lost if you remove the worktree." })) : hasUncommittedChanges ? (_jsx(Text, { children: "You have uncommitted changes. These will be lost if you remove the worktree." })) : (_jsxs(Text, { children: ["You have new commits on worktree-", name, ". The branch will be deleted if you remove the worktree."] })) }), _jsxs(Box, { flexDirection: "column", children: [_jsx(Box, { children: _jsxs(Text, { color: selectedIndex === 0 ? "cyan" : undefined, children: [selectedIndex === 0 ? "❯ " : " ", "Keep worktree Stays at", " ", worktreePath] }) }), _jsx(Box, { children: _jsxs(Text, { color: selectedIndex === 1 ? "cyan" : undefined, children: [selectedIndex === 1 ? "❯ " : " ", "Remove worktree All changes and commits will be lost."] }) })] }), _jsx(Box, { marginTop: 1, children: _jsx(Text, { dimColor: true, children: "Enter to confirm \u00B7 Esc to cancel" }) })] }));
|
|
26
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { Message, McpServerStatus, BackgroundTask, Task, SlashCommand, PermissionDecision, PermissionMode } from "wave-agent-sdk";
|
|
3
|
+
import { BaseAppProps } from "../types.js";
|
|
3
4
|
export interface ChatContextType {
|
|
4
5
|
messages: Message[];
|
|
5
6
|
isLoading: boolean;
|
|
@@ -15,11 +16,12 @@ export interface ChatContextType {
|
|
|
15
16
|
}>) => Promise<void>;
|
|
16
17
|
abortMessage: () => void;
|
|
17
18
|
latestTotalTokens: number;
|
|
19
|
+
clearMessages: () => void;
|
|
18
20
|
mcpServers: McpServerStatus[];
|
|
19
21
|
connectMcpServer: (serverName: string) => Promise<boolean>;
|
|
20
22
|
disconnectMcpServer: (serverName: string) => Promise<boolean>;
|
|
21
23
|
backgroundTasks: BackgroundTask[];
|
|
22
|
-
|
|
24
|
+
tasks: Task[];
|
|
23
25
|
getBackgroundTaskOutput: (taskId: string) => {
|
|
24
26
|
stdout: string;
|
|
25
27
|
stderr: string;
|
|
@@ -52,13 +54,15 @@ export interface ChatContextType {
|
|
|
52
54
|
}>;
|
|
53
55
|
wasLastDetailsTooTall: number;
|
|
54
56
|
setWasLastDetailsTooTall: React.Dispatch<React.SetStateAction<number>>;
|
|
57
|
+
getGatewayConfig: () => import("wave-agent-sdk").GatewayConfig;
|
|
58
|
+
getModelConfig: () => import("wave-agent-sdk").ModelConfig;
|
|
59
|
+
workingDirectory: string;
|
|
60
|
+
version?: string;
|
|
61
|
+
workdir?: string;
|
|
55
62
|
}
|
|
56
63
|
export declare const useChat: () => ChatContextType;
|
|
57
|
-
export interface ChatProviderProps {
|
|
64
|
+
export interface ChatProviderProps extends BaseAppProps {
|
|
58
65
|
children: React.ReactNode;
|
|
59
|
-
bypassPermissions?: boolean;
|
|
60
|
-
pluginDirs?: string[];
|
|
61
|
-
tools?: string[];
|
|
62
66
|
}
|
|
63
67
|
export declare const ChatProvider: React.FC<ChatProviderProps>;
|
|
64
68
|
//# sourceMappingURL=useChat.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../src/contexts/useChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACf,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"useChat.d.ts","sourceRoot":"","sources":["../../src/contexts/useChat.tsx"],"names":[],"mappings":"AAAA,OAAO,KAON,MAAM,OAAO,CAAC;AAGf,OAAO,KAAK,EACV,OAAO,EACP,eAAe,EACf,cAAc,EACd,IAAI,EACJ,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACf,MAAM,gBAAgB,CAAC;AASxB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,MAAM,WAAW,eAAe;IAC9B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,SAAS,EAAE,OAAO,CAAC;IACnB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,aAAa,EAAE,OAAO,CAAC;IAEvB,UAAU,EAAE,OAAO,CAAC;IACpB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,oBAAoB,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,CAAC;IAEjD,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,CACX,OAAO,EAAE,MAAM,EACf,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,M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ist/contexts/useChat.js
CHANGED
|
@@ -13,7 +13,7 @@ export const useChat = () => {
|
|
|
13
13
|
}
|
|
14
14
|
return context;
|
|
15
15
|
};
|
|
16
|
-
export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }) => {
|
|
16
|
+
export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, workdir, worktreeSession, version, model, }) => {
|
|
17
17
|
const { restoreSessionId, continueLastSession } = useAppConfig();
|
|
18
18
|
// Message Display State
|
|
19
19
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
@@ -34,8 +34,8 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
34
34
|
const [mcpServers, setMcpServers] = useState([]);
|
|
35
35
|
// Background tasks state
|
|
36
36
|
const [backgroundTasks, setBackgroundTasks] = useState([]);
|
|
37
|
-
//
|
|
38
|
-
const [
|
|
37
|
+
// Tasks state
|
|
38
|
+
const [tasks, setTasks] = useState([]);
|
|
39
39
|
// Command state
|
|
40
40
|
const [slashCommands, setSlashCommands] = useState([]);
|
|
41
41
|
// Subagent messages state
|
|
@@ -50,6 +50,8 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
50
50
|
const [currentConfirmation, setCurrentConfirmation] = useState(null);
|
|
51
51
|
// Rewind state
|
|
52
52
|
const [rewindId, setRewindId] = useState(0);
|
|
53
|
+
// Status metadata state
|
|
54
|
+
const [workingDirectory, setWorkingDirectory] = useState("");
|
|
53
55
|
// Confirmation too tall state
|
|
54
56
|
const [wasLastDetailsTooTall, setWasLastDetailsTooTall] = useState(0);
|
|
55
57
|
const agentRef = useRef(null);
|
|
@@ -80,7 +82,7 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
80
82
|
setMessages([...agentRef.current.messages]);
|
|
81
83
|
}
|
|
82
84
|
messagesUpdateTimerRef.current = null;
|
|
83
|
-
},
|
|
85
|
+
}, 100);
|
|
84
86
|
}
|
|
85
87
|
}
|
|
86
88
|
},
|
|
@@ -96,11 +98,11 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
96
98
|
onCompressionStateChange: (isCompressingState) => {
|
|
97
99
|
setIsCompressing(isCompressingState);
|
|
98
100
|
},
|
|
99
|
-
|
|
101
|
+
onBackgroundTasksChange: (tasks) => {
|
|
100
102
|
setBackgroundTasks([...tasks]);
|
|
101
103
|
},
|
|
102
|
-
|
|
103
|
-
|
|
104
|
+
onTasksChange: (tasks) => {
|
|
105
|
+
setTasks([...tasks]);
|
|
104
106
|
},
|
|
105
107
|
onSubagentMessagesChange: (subagentId, messages) => {
|
|
106
108
|
logger.debug("onSubagentMessagesChange", subagentId, messages.length);
|
|
@@ -148,6 +150,10 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
148
150
|
stream: false, // 关闭流式模式
|
|
149
151
|
plugins: pluginDirs?.map((path) => ({ type: "local", path })),
|
|
150
152
|
tools,
|
|
153
|
+
workdir,
|
|
154
|
+
worktreeName: worktreeSession?.name,
|
|
155
|
+
isNewWorktree: worktreeSession?.isNew,
|
|
156
|
+
model,
|
|
151
157
|
});
|
|
152
158
|
agentRef.current = agent;
|
|
153
159
|
// Get initial state
|
|
@@ -158,6 +164,7 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
158
164
|
setIsCommandRunning(agent.isCommandRunning);
|
|
159
165
|
setIsCompressing(agent.isCompressing);
|
|
160
166
|
setPermissionModeState(agent.getPermissionMode());
|
|
167
|
+
setWorkingDirectory(agent.workingDirectory);
|
|
161
168
|
// Get initial MCP servers state
|
|
162
169
|
const mcpServers = agent.getMcpServers?.() || [];
|
|
163
170
|
setMcpServers(mcpServers);
|
|
@@ -177,6 +184,8 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
177
184
|
showConfirmation,
|
|
178
185
|
pluginDirs,
|
|
179
186
|
tools,
|
|
187
|
+
workdir,
|
|
188
|
+
worktreeSession,
|
|
180
189
|
]);
|
|
181
190
|
// Cleanup on unmount
|
|
182
191
|
useEffect(() => {
|
|
@@ -245,6 +254,9 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
245
254
|
const abortMessage = useCallback(() => {
|
|
246
255
|
agentRef.current?.abortMessage();
|
|
247
256
|
}, []);
|
|
257
|
+
const clearMessages = useCallback(() => {
|
|
258
|
+
agentRef.current?.clearMessages();
|
|
259
|
+
}, []);
|
|
248
260
|
// Permission management methods
|
|
249
261
|
const setPermissionMode = useCallback((mode) => {
|
|
250
262
|
setPermissionModeState((prev) => {
|
|
@@ -336,6 +348,18 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
336
348
|
}
|
|
337
349
|
return { messages: [], sessionIds: [] };
|
|
338
350
|
}, []);
|
|
351
|
+
const getGatewayConfig = useCallback(() => {
|
|
352
|
+
if (!agentRef.current) {
|
|
353
|
+
return { baseURL: "" };
|
|
354
|
+
}
|
|
355
|
+
return agentRef.current.getGatewayConfig();
|
|
356
|
+
}, []);
|
|
357
|
+
const getModelConfig = useCallback(() => {
|
|
358
|
+
if (!agentRef.current) {
|
|
359
|
+
return { model: "", fastModel: "" };
|
|
360
|
+
}
|
|
361
|
+
return agentRef.current.getModelConfig();
|
|
362
|
+
}, []);
|
|
339
363
|
// Listen for Ctrl+O hotkey to toggle collapse/expand state and ESC to cancel confirmation
|
|
340
364
|
useInput((input, key) => {
|
|
341
365
|
if (key.ctrl && input === "o") {
|
|
@@ -384,13 +408,14 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
384
408
|
sessionId,
|
|
385
409
|
sendMessage,
|
|
386
410
|
abortMessage,
|
|
411
|
+
clearMessages,
|
|
387
412
|
latestTotalTokens,
|
|
388
413
|
isCompressing,
|
|
389
414
|
mcpServers,
|
|
390
415
|
connectMcpServer,
|
|
391
416
|
disconnectMcpServer,
|
|
392
417
|
backgroundTasks,
|
|
393
|
-
|
|
418
|
+
tasks,
|
|
394
419
|
getBackgroundTaskOutput,
|
|
395
420
|
stopBackgroundTask,
|
|
396
421
|
slashCommands,
|
|
@@ -411,6 +436,11 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, tools, }
|
|
|
411
436
|
getFullMessageThread,
|
|
412
437
|
wasLastDetailsTooTall,
|
|
413
438
|
setWasLastDetailsTooTall,
|
|
439
|
+
getGatewayConfig,
|
|
440
|
+
getModelConfig,
|
|
441
|
+
workingDirectory,
|
|
442
|
+
version,
|
|
443
|
+
workdir,
|
|
414
444
|
};
|
|
415
445
|
return (_jsx(ChatContext.Provider, { value: contextValue, children: children }));
|
|
416
446
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/contracts/status.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -18,6 +18,7 @@ export declare const useInputManager: (callbacks?: Partial<InputManagerCallbacks
|
|
|
18
18
|
showMcpManager: boolean;
|
|
19
19
|
showRewindManager: boolean;
|
|
20
20
|
showHelp: boolean;
|
|
21
|
+
showStatusCommand: boolean;
|
|
21
22
|
permissionMode: PermissionMode;
|
|
22
23
|
attachedImages: AttachedImage[];
|
|
23
24
|
isManagerReady: boolean;
|
|
@@ -53,6 +54,7 @@ export declare const useInputManager: (callbacks?: Partial<InputManagerCallbacks
|
|
|
53
54
|
setShowMcpManager: (show: boolean) => void;
|
|
54
55
|
setShowRewindManager: (show: boolean) => void;
|
|
55
56
|
setShowHelp: (show: boolean) => void;
|
|
57
|
+
setShowStatusCommand: (show: boolean) => void;
|
|
56
58
|
setPermissionMode: (mode: PermissionMode) => void;
|
|
57
59
|
addImage: (imagePath: string, mimeType: string) => AttachedImage | undefined;
|
|
58
60
|
removeImage: (imageId: number) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useInputManager.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,eAAO,MAAM,eAAe,GAC1B,YAAW,OAAO,CAAC,qBAAqB,CAAM
|
|
1
|
+
{"version":3,"file":"useInputManager.d.ts","sourceRoot":"","sources":["../../src/hooks/useInputManager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,aAAa,EACd,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGhD,eAAO,MAAM,eAAe,GAC1B,YAAW,OAAO,CAAC,qBAAqB,CAAM;;;;;;;;;;;;;;;;;;;;+BA+HpC,MAAM,aACD,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,KAAK,IAAI;oCAQrD,CAAC,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,KAAK,IAAI;;;;qCAmBd,MAAM;iCAK7C,MAAM;;;;;mCAe+B,MAAM;oCAIL,MAAM;wCAKF,MAAM;mCAKjD,MAAM;;;;mCAYN,MAAM;;;;;sCAemC,MAAM;uCAIL,MAAM;wCAKL,MAAM;;mCASX,MAAM;yCAkEL,OAAO;8BAGlB,OAAO;iCAGJ,OAAO;wBAIhB,OAAO;iCAIE,OAAO;8BAIV,cAAc;0BAMlB,MAAM,YAAY,MAAM;2BAGvB,MAAM;;;8BAWH,MAAM;mCAKxB,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,cAC1D,OAAO,qBACA,OAAO;uCAUkB,MAAM;;yBAU1C,MAAM,OACR,GAAG,kBACQ,KAAK,CAAC;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,cAC1D,OAAO,qBACA,OAAO,gBACX,MAAM,IAAI;yBAnIgB,MAAM;kCAIG,MAAM;;CAsJ9D,CAAC"}
|
|
@@ -26,6 +26,7 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
26
26
|
const [showMcpManager, setShowMcpManager] = useState(false);
|
|
27
27
|
const [showRewindManager, setShowRewindManager] = useState(false);
|
|
28
28
|
const [showHelp, setShowHelp] = useState(false);
|
|
29
|
+
const [showStatusCommand, setShowStatusCommand] = useState(false);
|
|
29
30
|
const [permissionMode, setPermissionModeState] = useState("default");
|
|
30
31
|
const [attachedImages, setAttachedImages] = useState([]);
|
|
31
32
|
// Create InputManager on mount and update callbacks when they change
|
|
@@ -57,6 +58,9 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
57
58
|
onHelpStateChange: (show) => {
|
|
58
59
|
setShowHelp(show);
|
|
59
60
|
},
|
|
61
|
+
onStatusCommandStateChange: (show) => {
|
|
62
|
+
setShowStatusCommand(show);
|
|
63
|
+
},
|
|
60
64
|
onPermissionModeChange: (mode) => {
|
|
61
65
|
setPermissionModeState(mode);
|
|
62
66
|
callbacks.onPermissionModeChange?.(mode);
|
|
@@ -94,6 +98,9 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
94
98
|
onHelpStateChange: (show) => {
|
|
95
99
|
setShowHelp(show);
|
|
96
100
|
},
|
|
101
|
+
onStatusCommandStateChange: (show) => {
|
|
102
|
+
setShowStatusCommand(show);
|
|
103
|
+
},
|
|
97
104
|
onPermissionModeChange: (mode) => {
|
|
98
105
|
setPermissionModeState(mode);
|
|
99
106
|
callbacks.onPermissionModeChange?.(mode);
|
|
@@ -207,6 +214,7 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
207
214
|
showMcpManager,
|
|
208
215
|
showRewindManager,
|
|
209
216
|
showHelp,
|
|
217
|
+
showStatusCommand,
|
|
210
218
|
permissionMode,
|
|
211
219
|
attachedImages,
|
|
212
220
|
isManagerReady,
|
|
@@ -249,6 +257,10 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
249
257
|
managerRef.current?.setShowHelp(show);
|
|
250
258
|
setShowHelp(show);
|
|
251
259
|
}, []),
|
|
260
|
+
setShowStatusCommand: useCallback((show) => {
|
|
261
|
+
managerRef.current?.setShowStatusCommand(show);
|
|
262
|
+
setShowStatusCommand(show);
|
|
263
|
+
}, []),
|
|
252
264
|
setPermissionMode: useCallback((mode) => {
|
|
253
265
|
setPermissionModeState(mode);
|
|
254
266
|
managerRef.current?.setPermissionMode(mode);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePluginManager.d.ts","sourceRoot":"","sources":["../../src/hooks/usePluginManager.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,gBAAgB,IAAI,wBAAwB,
|
|
1
|
+
{"version":3,"file":"usePluginManager.d.ts","sourceRoot":"","sources":["../../src/hooks/usePluginManager.ts"],"names":[],"mappings":"AAOA,OAAO,EAGL,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,gBAAgB,IAAI,wBAAwB,CA8R3D"}
|