wave-code 0.4.0 → 0.6.1
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/uninstall.js +1 -1
- package/dist/components/App.d.ts.map +1 -1
- package/dist/components/App.js +38 -2
- package/dist/components/BackgroundTaskManager.d.ts +6 -0
- package/dist/components/BackgroundTaskManager.d.ts.map +1 -0
- package/dist/components/BackgroundTaskManager.js +114 -0
- package/dist/components/ChatInterface.d.ts.map +1 -1
- package/dist/components/ChatInterface.js +39 -5
- package/dist/components/CommandSelector.d.ts.map +1 -1
- package/dist/components/CommandSelector.js +13 -5
- package/dist/components/CompressDisplay.d.ts.map +1 -1
- package/dist/components/CompressDisplay.js +6 -10
- package/dist/components/ConfirmationDetails.d.ts +9 -0
- package/dist/components/ConfirmationDetails.d.ts.map +1 -0
- package/dist/components/ConfirmationDetails.js +53 -0
- package/dist/components/{Confirmation.d.ts → ConfirmationSelector.d.ts} +3 -3
- package/dist/components/ConfirmationSelector.d.ts.map +1 -0
- package/dist/components/{Confirmation.js → ConfirmationSelector.js} +92 -101
- package/dist/components/DiffDisplay.d.ts +0 -1
- package/dist/components/DiffDisplay.d.ts.map +1 -1
- package/dist/components/DiffDisplay.js +82 -60
- package/dist/components/FileSelector.d.ts.map +1 -1
- package/dist/components/FileSelector.js +2 -2
- package/dist/components/HistorySearch.d.ts.map +1 -1
- package/dist/components/HistorySearch.js +12 -4
- package/dist/components/InputBox.d.ts +1 -3
- package/dist/components/InputBox.d.ts.map +1 -1
- package/dist/components/InputBox.js +9 -18
- package/dist/components/LoadingIndicator.d.ts +11 -0
- package/dist/components/LoadingIndicator.d.ts.map +1 -0
- package/dist/components/LoadingIndicator.js +6 -0
- package/dist/components/Markdown.d.ts.map +1 -1
- package/dist/components/Markdown.js +114 -120
- package/dist/components/MessageItem.d.ts.map +1 -1
- package/dist/components/MessageItem.js +1 -2
- package/dist/components/MessageList.d.ts +2 -3
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/MessageList.js +7 -7
- package/dist/components/PlanDisplay.d.ts.map +1 -1
- package/dist/components/PlanDisplay.js +4 -12
- package/dist/components/PluginDetail.js +1 -1
- package/dist/components/RewindCommand.d.ts +4 -0
- package/dist/components/RewindCommand.d.ts.map +1 -1
- package/dist/components/RewindCommand.js +19 -2
- package/dist/components/SubagentBlock.d.ts.map +1 -1
- package/dist/components/SubagentBlock.js +12 -5
- package/dist/components/TaskList.d.ts +3 -0
- package/dist/components/TaskList.d.ts.map +1 -0
- package/dist/components/TaskList.js +49 -0
- package/dist/components/ToolResultDisplay.d.ts.map +1 -1
- package/dist/components/ToolResultDisplay.js +2 -1
- package/dist/contexts/useChat.d.ts +15 -6
- package/dist/contexts/useChat.d.ts.map +1 -1
- package/dist/contexts/useChat.js +52 -43
- package/dist/hooks/useInputManager.d.ts +2 -13
- package/dist/hooks/useInputManager.d.ts.map +1 -1
- package/dist/hooks/useInputManager.js +8 -57
- package/dist/hooks/usePluginManager.d.ts.map +1 -1
- package/dist/hooks/usePluginManager.js +8 -4
- package/dist/hooks/useTasks.d.ts +2 -0
- package/dist/hooks/useTasks.d.ts.map +1 -0
- package/dist/hooks/useTasks.js +5 -0
- package/dist/managers/InputManager.d.ts +5 -28
- package/dist/managers/InputManager.d.ts.map +1 -1
- package/dist/managers/InputManager.js +26 -127
- package/package.json +9 -10
- package/src/commands/plugin/uninstall.ts +1 -1
- package/src/components/App.tsx +50 -3
- package/src/components/{BashShellManager.tsx → BackgroundTaskManager.tsx} +79 -73
- package/src/components/ChatInterface.tsx +79 -23
- package/src/components/CommandSelector.tsx +38 -20
- package/src/components/CompressDisplay.tsx +5 -22
- package/src/components/ConfirmationDetails.tsx +108 -0
- package/src/components/{Confirmation.tsx → ConfirmationSelector.tsx} +162 -187
- package/src/components/DiffDisplay.tsx +122 -107
- package/src/components/FileSelector.tsx +0 -2
- package/src/components/HistorySearch.tsx +45 -21
- package/src/components/InputBox.tsx +14 -34
- package/src/components/LoadingIndicator.tsx +56 -0
- package/src/components/Markdown.tsx +126 -318
- package/src/components/MessageItem.tsx +1 -3
- package/src/components/MessageList.tsx +10 -67
- package/src/components/PlanDisplay.tsx +5 -33
- package/src/components/PluginDetail.tsx +1 -1
- package/src/components/RewindCommand.tsx +38 -1
- package/src/components/SubagentBlock.tsx +28 -14
- package/src/components/TaskList.tsx +70 -0
- package/src/components/ToolResultDisplay.tsx +6 -2
- package/src/contexts/useChat.tsx +82 -60
- package/src/hooks/useInputManager.ts +9 -73
- package/src/hooks/usePluginManager.ts +10 -4
- package/src/hooks/useTasks.ts +6 -0
- package/src/managers/InputManager.ts +30 -157
- package/dist/components/BashShellManager.d.ts +0 -6
- package/dist/components/BashShellManager.d.ts.map +0 -1
- package/dist/components/BashShellManager.js +0 -116
- package/dist/components/Confirmation.d.ts.map +0 -1
- package/dist/components/MemoryDisplay.d.ts +0 -8
- package/dist/components/MemoryDisplay.d.ts.map +0 -1
- package/dist/components/MemoryDisplay.js +0 -25
- package/dist/components/MemoryTypeSelector.d.ts +0 -8
- package/dist/components/MemoryTypeSelector.d.ts.map +0 -1
- package/dist/components/MemoryTypeSelector.js +0 -38
- package/src/components/MemoryDisplay.tsx +0 -62
- package/src/components/MemoryTypeSelector.tsx +0 -98
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
import { jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from "react";
|
|
2
3
|
import { Box, Text } from "ink";
|
|
3
4
|
import { useChat } from "../contexts/useChat.js";
|
|
4
5
|
import { Markdown } from "./Markdown.js";
|
|
5
6
|
export const SubagentBlock = ({ block }) => {
|
|
6
|
-
const { subagentMessages } = useChat();
|
|
7
|
+
const { subagentMessages, subagentLatestTokens } = useChat();
|
|
7
8
|
// Get messages for this subagent from context
|
|
8
|
-
const messages = subagentMessages[block.subagentId] || [];
|
|
9
|
+
const messages = useMemo(() => subagentMessages[block.subagentId] || [], [subagentMessages, block.subagentId]);
|
|
10
|
+
// Get latest turn tokens for this subagent
|
|
11
|
+
const latestTurnTokens = subagentLatestTokens[block.subagentId] || 0;
|
|
12
|
+
// If the subagent is running in the background, don't show the block
|
|
13
|
+
if (block.runInBackground) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
9
16
|
// Status indicator mapping
|
|
10
17
|
const getStatusIndicator = (status) => {
|
|
11
18
|
switch (status) {
|
|
@@ -43,7 +50,7 @@ export const SubagentBlock = ({ block }) => {
|
|
|
43
50
|
}
|
|
44
51
|
return { tools: tools.reverse(), totalToolCount }; // Reverse to show oldest first, newest last
|
|
45
52
|
};
|
|
46
|
-
const { tools: lastTwoTools
|
|
53
|
+
const { tools: lastTwoTools } = getLastTwoTools();
|
|
47
54
|
// Get the last text message content if completed
|
|
48
55
|
const getLastTextMessage = () => {
|
|
49
56
|
if (block.status !== "completed")
|
|
@@ -62,5 +69,5 @@ export const SubagentBlock = ({ block }) => {
|
|
|
62
69
|
return null;
|
|
63
70
|
};
|
|
64
71
|
const lastTextMessage = getLastTextMessage();
|
|
65
|
-
return (_jsxs(Box, { borderRight: false, borderTop: false, borderBottom: false, borderStyle: "classic", borderColor: "magenta", paddingX: 1,
|
|
72
|
+
return (_jsxs(Box, { borderRight: false, borderTop: false, borderBottom: false, borderStyle: "classic", borderColor: "magenta", paddingX: 1, flexDirection: "column", children: [_jsx(Box, { flexDirection: "row", gap: 1, children: _jsxs(Box, { flexDirection: "row", alignItems: "center", children: [_jsxs(Text, { color: "cyan", children: ["\uD83E\uDD16 ", block.subagentName] }), _jsxs(Text, { color: statusInfo.color, dimColor: false, children: [" ", statusInfo.icon] }), _jsxs(Text, { color: "gray", dimColor: true, children: [" ", "(", messages.length, " messages", latestTurnTokens > 0 && (_jsxs(_Fragment, { children: [" | ", _jsx(Text, { color: "blue", bold: true, children: latestTurnTokens.toLocaleString() }), " tokens"] })), ")"] })] }) }), lastTextMessage && (_jsx(Box, { children: _jsx(Markdown, { children: lastTextMessage }) })), block.status !== "completed" && lastTwoTools.length > 0 && (_jsx(Box, { flexDirection: "column", children: lastTwoTools.map((tool, index) => (_jsxs(Box, { flexDirection: "row", children: [_jsx(Text, { color: "magenta", children: "\uD83D\uDD27 " }), _jsx(Text, { color: "white", children: tool.name }), tool.compactParams && (_jsxs(Text, { color: "gray", children: [" ", tool.compactParams] }))] }, index))) }))] }));
|
|
66
73
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TaskList.d.ts","sourceRoot":"","sources":["../../src/components/TaskList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAgE5B,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useChat } from "../contexts/useChat.js";
|
|
3
|
+
import { Box, Text, useStdout } from "ink";
|
|
4
|
+
import { useTasks } from "../hooks/useTasks.js";
|
|
5
|
+
export const TaskList = () => {
|
|
6
|
+
const tasks = useTasks();
|
|
7
|
+
const { isTaskListVisible } = useChat();
|
|
8
|
+
const { stdout } = useStdout();
|
|
9
|
+
const terminalWidth = stdout?.columns ?? 80;
|
|
10
|
+
const maxSubjectWidth = Math.max(20, terminalWidth - 10);
|
|
11
|
+
if (tasks.length === 0 || !isTaskListVisible) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
const getStatusIcon = (status, isBlocked) => {
|
|
15
|
+
if (isBlocked) {
|
|
16
|
+
return _jsx(Text, { color: "red", children: "\uD83D\uDD12" });
|
|
17
|
+
}
|
|
18
|
+
switch (status) {
|
|
19
|
+
case "pending":
|
|
20
|
+
return _jsx(Text, { color: "gray", children: "\u25CB" });
|
|
21
|
+
case "in_progress":
|
|
22
|
+
return _jsx(Text, { color: "yellow", children: "\u25CF" });
|
|
23
|
+
case "completed":
|
|
24
|
+
return _jsx(Text, { color: "green", children: "\u2713" });
|
|
25
|
+
case "deleted":
|
|
26
|
+
return _jsx(Text, { color: "red", children: "\u2715" });
|
|
27
|
+
default:
|
|
28
|
+
return _jsx(Text, { color: "gray", children: "?" });
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
const truncate = (text, maxWidth) => {
|
|
32
|
+
if (text.length <= maxWidth) {
|
|
33
|
+
return text;
|
|
34
|
+
}
|
|
35
|
+
return text.slice(0, maxWidth - 3) + "...";
|
|
36
|
+
};
|
|
37
|
+
return (_jsx(Box, { flexDirection: "column", children: tasks.map((task) => {
|
|
38
|
+
const isDimmed = task.status === "completed" || task.status === "deleted";
|
|
39
|
+
const isBlocked = task.blockedBy && task.blockedBy.length > 0;
|
|
40
|
+
const blockingTaskIds = isBlocked
|
|
41
|
+
? task.blockedBy.map((id) => `#${id}`)
|
|
42
|
+
: [];
|
|
43
|
+
const blockedByText = isBlocked && blockingTaskIds.length > 0
|
|
44
|
+
? ` (Blocked by: ${blockingTaskIds.join(", ")})`
|
|
45
|
+
: "";
|
|
46
|
+
const fullText = `${task.subject}${blockedByText}`;
|
|
47
|
+
return (_jsxs(Box, { gap: 1, children: [getStatusIcon(task.status, isBlocked), _jsx(Text, { dimColor: isDimmed, children: truncate(fullText, maxSubjectWidth) })] }, task.id));
|
|
48
|
+
}) }));
|
|
49
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolResultDisplay.d.ts","sourceRoot":"","sources":["../../src/components/ToolResultDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,
|
|
1
|
+
{"version":3,"file":"ToolResultDisplay.d.ts","sourceRoot":"","sources":["../../src/components/ToolResultDisplay.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGhD,UAAU,sBAAsB;IAC9B,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,eAAO,MAAM,iBAAiB,EAAE,KAAK,CAAC,EAAE,CAAC,sBAAsB,CAyI9D,CAAC"}
|
|
@@ -33,6 +33,7 @@ export const ToolResultDisplay = ({ block, isExpanded = false, }) => {
|
|
|
33
33
|
return imageCount === 1 ? "🖼️" : `🖼️×${imageCount}`;
|
|
34
34
|
};
|
|
35
35
|
const toolName = name ? String(name) : "Tool";
|
|
36
|
+
const isBackgroundable = stage === "running" && (toolName === "Bash" || toolName === "Task");
|
|
36
37
|
// Get shortResult, if not available show last 5 lines of result
|
|
37
38
|
const getShortResult = () => {
|
|
38
39
|
if (block.shortResult) {
|
|
@@ -49,5 +50,5 @@ export const ToolResultDisplay = ({ block, isExpanded = false, }) => {
|
|
|
49
50
|
return null;
|
|
50
51
|
};
|
|
51
52
|
const shortResult = getShortResult();
|
|
52
|
-
return (_jsxs(Box, { flexDirection: "column",
|
|
53
|
+
return (_jsxs(Box, { flexDirection: "column", children: [_jsxs(Box, { children: [_jsx(Text, { color: "magenta", children: "\uD83D\uDD27 " }), _jsx(Text, { color: "white", children: toolName }), !isExpanded && compactParams && (_jsxs(Text, { color: "gray", children: [" ", compactParams] })), _jsxs(Text, { color: getStatusColor(), children: [" ", getStatusText()] }), hasImages() && _jsxs(Text, { color: "blue", children: [" ", getImageIndicator()] }), isBackgroundable && _jsx(Text, { color: "gray", children: " [Ctrl-B] Background" })] }), !isExpanded && shortResult && !error && (_jsx(Box, { paddingLeft: 2, borderLeft: true, borderColor: "gray", flexDirection: "column", children: shortResult.split("\n").map((line, index) => (_jsx(Text, { color: "gray", children: line }, index))) })), isExpanded && parameters && (_jsxs(Box, { paddingLeft: 2, borderLeft: true, borderColor: "gray", flexDirection: "column", children: [_jsx(Text, { color: "cyan", bold: true, children: "Parameters:" }), _jsx(Text, { color: "gray", children: parameters })] })), isExpanded && result && (_jsx(Box, { flexDirection: "column", children: _jsxs(Box, { paddingLeft: 2, borderLeft: true, borderColor: "green", flexDirection: "column", children: [_jsx(Text, { color: "cyan", bold: true, children: "Result:" }), _jsx(Text, { color: "white", children: result })] }) })), error && (_jsx(Box, { children: _jsxs(Text, { color: "red", children: ["Error: ", typeof error === "string" ? error : String(error)] }) })), stage === "end" && success && (_jsx(DiffDisplay, { toolName: name, parameters: parameters }))] }));
|
|
53
54
|
};
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import type { Message, McpServerStatus,
|
|
2
|
+
import type { Message, McpServerStatus, BackgroundTask, Task, SlashCommand, PermissionDecision, PermissionMode } from "wave-agent-sdk";
|
|
3
3
|
export interface ChatContextType {
|
|
4
4
|
messages: Message[];
|
|
5
5
|
isLoading: boolean;
|
|
6
6
|
isCommandRunning: boolean;
|
|
7
7
|
isCompressing: boolean;
|
|
8
|
-
userInputHistory: string[];
|
|
9
8
|
isExpanded: boolean;
|
|
9
|
+
isTaskListVisible: boolean;
|
|
10
|
+
setIsTaskListVisible: (visible: boolean) => void;
|
|
10
11
|
sessionId: string;
|
|
11
12
|
sendMessage: (content: string, images?: Array<{
|
|
12
13
|
path: string;
|
|
@@ -14,20 +15,21 @@ export interface ChatContextType {
|
|
|
14
15
|
}>) => Promise<void>;
|
|
15
16
|
abortMessage: () => void;
|
|
16
17
|
latestTotalTokens: number;
|
|
17
|
-
saveMemory: (message: string, type: "project" | "user") => Promise<void>;
|
|
18
18
|
mcpServers: McpServerStatus[];
|
|
19
19
|
connectMcpServer: (serverName: string) => Promise<boolean>;
|
|
20
20
|
disconnectMcpServer: (serverName: string) => Promise<boolean>;
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
backgroundTasks: BackgroundTask[];
|
|
22
|
+
sessionTasks: Task[];
|
|
23
|
+
getBackgroundTaskOutput: (taskId: string) => {
|
|
23
24
|
stdout: string;
|
|
24
25
|
stderr: string;
|
|
25
26
|
status: string;
|
|
26
27
|
} | null;
|
|
27
|
-
|
|
28
|
+
stopBackgroundTask: (taskId: string) => boolean;
|
|
28
29
|
slashCommands: SlashCommand[];
|
|
29
30
|
hasSlashCommand: (commandId: string) => boolean;
|
|
30
31
|
subagentMessages: Record<string, Message[]>;
|
|
32
|
+
subagentLatestTokens: Record<string, number>;
|
|
31
33
|
permissionMode: PermissionMode;
|
|
32
34
|
setPermissionMode: (mode: PermissionMode) => void;
|
|
33
35
|
isConfirmationVisible: boolean;
|
|
@@ -41,8 +43,15 @@ export interface ChatContextType {
|
|
|
41
43
|
hideConfirmation: () => void;
|
|
42
44
|
handleConfirmationDecision: (decision: PermissionDecision) => void;
|
|
43
45
|
handleConfirmationCancel: () => void;
|
|
46
|
+
backgroundCurrentTask: () => void;
|
|
44
47
|
rewindId: number;
|
|
45
48
|
handleRewindSelect: (index: number) => Promise<void>;
|
|
49
|
+
getFullMessageThread: () => Promise<{
|
|
50
|
+
messages: Message[];
|
|
51
|
+
sessionIds: string[];
|
|
52
|
+
}>;
|
|
53
|
+
wasLastDetailsTooTall: number;
|
|
54
|
+
setWasLastDetailsTooTall: React.Dispatch<React.SetStateAction<number>>;
|
|
46
55
|
}
|
|
47
56
|
export declare const useChat: () => ChatContextType;
|
|
48
57
|
export interface ChatProviderProps {
|
|
@@ -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,
|
|
1
|
+
{"version":3,"file":"use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,CAAC;KACtB,CAAC,CAAC;IACH,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wBAAwB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;CACxE;AAID,eAAO,MAAM,OAAO,uBAMnB,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CA+cpD,CAAC"}
|
package/dist/contexts/useChat.js
CHANGED
|
@@ -17,6 +17,7 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
17
17
|
const { restoreSessionId, continueLastSession } = useAppConfig();
|
|
18
18
|
// Message Display State
|
|
19
19
|
const [isExpanded, setIsExpanded] = useState(false);
|
|
20
|
+
const [isTaskListVisible, setIsTaskListVisible] = useState(true);
|
|
20
21
|
// AI State
|
|
21
22
|
const [messages, setMessages] = useState([]);
|
|
22
23
|
const [isLoading, setIsLoading] = useState(false);
|
|
@@ -24,15 +25,17 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
24
25
|
const [sessionId, setSessionId] = useState("");
|
|
25
26
|
const [isCommandRunning, setIsCommandRunning] = useState(false);
|
|
26
27
|
const [isCompressing, setIsCompressing] = useState(false);
|
|
27
|
-
const [userInputHistory, setUserInputHistory] = useState([]);
|
|
28
28
|
// MCP State
|
|
29
29
|
const [mcpServers, setMcpServers] = useState([]);
|
|
30
|
-
// Background
|
|
31
|
-
const [
|
|
30
|
+
// Background tasks state
|
|
31
|
+
const [backgroundTasks, setBackgroundTasks] = useState([]);
|
|
32
|
+
// Session tasks state
|
|
33
|
+
const [sessionTasks, setSessionTasks] = useState([]);
|
|
32
34
|
// Command state
|
|
33
35
|
const [slashCommands, setSlashCommands] = useState([]);
|
|
34
36
|
// Subagent messages state
|
|
35
37
|
const [subagentMessages, setSubagentMessages] = useState({});
|
|
38
|
+
const [subagentLatestTokens, setSubagentLatestTokens] = useState({});
|
|
36
39
|
// Permission state
|
|
37
40
|
const [permissionMode, setPermissionModeState] = useState("default");
|
|
38
41
|
// Confirmation state with queue-based architecture
|
|
@@ -42,6 +45,8 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
42
45
|
const [currentConfirmation, setCurrentConfirmation] = useState(null);
|
|
43
46
|
// Rewind state
|
|
44
47
|
const [rewindId, setRewindId] = useState(0);
|
|
48
|
+
// Confirmation too tall state
|
|
49
|
+
const [wasLastDetailsTooTall, setWasLastDetailsTooTall] = useState(0);
|
|
45
50
|
const agentRef = useRef(null);
|
|
46
51
|
// Permission confirmation methods with queue support
|
|
47
52
|
const showConfirmation = useCallback(async (toolName, toolInput, suggestedPrefix, hidePersistentOption) => {
|
|
@@ -69,21 +74,19 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
69
74
|
setMcpServers([...servers]);
|
|
70
75
|
},
|
|
71
76
|
onSessionIdChange: (sessionId) => {
|
|
72
|
-
|
|
73
|
-
setSessionId(sessionId);
|
|
74
|
-
});
|
|
77
|
+
setSessionId(sessionId);
|
|
75
78
|
},
|
|
76
79
|
onLatestTotalTokensChange: (tokens) => {
|
|
77
80
|
setlatestTotalTokens(tokens);
|
|
78
81
|
},
|
|
79
|
-
onUserInputHistoryChange: (history) => {
|
|
80
|
-
setUserInputHistory([...history]);
|
|
81
|
-
},
|
|
82
82
|
onCompressionStateChange: (isCompressingState) => {
|
|
83
83
|
setIsCompressing(isCompressingState);
|
|
84
84
|
},
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
onTasksChange: (tasks) => {
|
|
86
|
+
setBackgroundTasks([...tasks]);
|
|
87
|
+
},
|
|
88
|
+
onSessionTasksChange: (tasks) => {
|
|
89
|
+
setSessionTasks([...tasks]);
|
|
87
90
|
},
|
|
88
91
|
onSubagentMessagesChange: (subagentId, messages) => {
|
|
89
92
|
logger.debug("onSubagentMessagesChange", subagentId, messages.length);
|
|
@@ -92,6 +95,12 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
92
95
|
[subagentId]: [...messages],
|
|
93
96
|
}));
|
|
94
97
|
},
|
|
98
|
+
onSubagentLatestTotalTokensChange: (subagentId, tokens) => {
|
|
99
|
+
setSubagentLatestTokens((prev) => ({
|
|
100
|
+
...prev,
|
|
101
|
+
[subagentId]: tokens,
|
|
102
|
+
}));
|
|
103
|
+
},
|
|
95
104
|
onPermissionModeChange: (mode) => {
|
|
96
105
|
setPermissionModeState(mode);
|
|
97
106
|
},
|
|
@@ -133,7 +142,6 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
133
142
|
setlatestTotalTokens(agent.latestTotalTokens);
|
|
134
143
|
setIsCommandRunning(agent.isCommandRunning);
|
|
135
144
|
setIsCompressing(agent.isCompressing);
|
|
136
|
-
setUserInputHistory(agent.userInputHistory);
|
|
137
145
|
setPermissionModeState(agent.getPermissionMode());
|
|
138
146
|
// Get initial MCP servers state
|
|
139
147
|
const mcpServers = agent.getMcpServers?.() || [];
|
|
@@ -179,15 +187,6 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
179
187
|
if (!hasTextContent && !hasImageAttachments)
|
|
180
188
|
return;
|
|
181
189
|
try {
|
|
182
|
-
// Handle memory mode - check if it's a memory message (starts with # and only one line)
|
|
183
|
-
if (content.startsWith("#") && !content.includes("\n")) {
|
|
184
|
-
const memoryText = content.substring(1).trim();
|
|
185
|
-
if (!memoryText)
|
|
186
|
-
return;
|
|
187
|
-
// In memory mode, don't add user message, only wait for user to choose memory type then add assistant message
|
|
188
|
-
// Don't auto-save, wait for user to choose memory type
|
|
189
|
-
return;
|
|
190
|
-
}
|
|
191
190
|
// Handle bash mode - check if it's a bash command (starts with ! and only one line)
|
|
192
191
|
if (content.startsWith("!") && !content.includes("\n")) {
|
|
193
192
|
const command = content.substring(1).trim();
|
|
@@ -227,10 +226,6 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
227
226
|
const abortMessage = useCallback(() => {
|
|
228
227
|
agentRef.current?.abortMessage();
|
|
229
228
|
}, []);
|
|
230
|
-
// Memory save function - delegate to Agent
|
|
231
|
-
const saveMemory = useCallback(async (message, type) => {
|
|
232
|
-
await agentRef.current?.saveMemory(message, type);
|
|
233
|
-
}, []);
|
|
234
229
|
// Permission management methods
|
|
235
230
|
const setPermissionMode = useCallback((mode) => {
|
|
236
231
|
setPermissionModeState((prev) => {
|
|
@@ -249,16 +244,16 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
249
244
|
const disconnectMcpServer = useCallback(async (serverName) => {
|
|
250
245
|
return (await agentRef.current?.disconnectMcpServer(serverName)) ?? false;
|
|
251
246
|
}, []);
|
|
252
|
-
// Background
|
|
253
|
-
const
|
|
247
|
+
// Background task management methods - delegate to Agent
|
|
248
|
+
const getBackgroundTaskOutput = useCallback((taskId) => {
|
|
254
249
|
if (!agentRef.current)
|
|
255
250
|
return null;
|
|
256
|
-
return agentRef.current.
|
|
251
|
+
return agentRef.current.getBackgroundTaskOutput(taskId);
|
|
257
252
|
}, []);
|
|
258
|
-
const
|
|
253
|
+
const stopBackgroundTask = useCallback((taskId) => {
|
|
259
254
|
if (!agentRef.current)
|
|
260
255
|
return false;
|
|
261
|
-
return agentRef.current.
|
|
256
|
+
return agentRef.current.stopBackgroundTask(taskId);
|
|
262
257
|
}, []);
|
|
263
258
|
const hasSlashCommand = useCallback((commandId) => {
|
|
264
259
|
if (!agentRef.current)
|
|
@@ -301,31 +296,39 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
301
296
|
}
|
|
302
297
|
hideConfirmation();
|
|
303
298
|
}, [currentConfirmation, hideConfirmation]);
|
|
299
|
+
const backgroundCurrentTask = useCallback(() => {
|
|
300
|
+
agentRef.current?.backgroundCurrentTask();
|
|
301
|
+
}, []);
|
|
304
302
|
const handleRewindSelect = useCallback(async (index) => {
|
|
305
303
|
if (agentRef.current) {
|
|
306
304
|
try {
|
|
307
305
|
await agentRef.current.truncateHistory(index);
|
|
308
306
|
// Clear terminal screen after rewind
|
|
309
|
-
|
|
310
|
-
setRewindId((prev) => prev + 1);
|
|
311
|
-
});
|
|
307
|
+
setRewindId((prev) => prev + 1);
|
|
312
308
|
}
|
|
313
309
|
catch (error) {
|
|
314
310
|
logger.error("Failed to rewind:", error);
|
|
315
311
|
}
|
|
316
312
|
}
|
|
317
313
|
}, []);
|
|
314
|
+
const getFullMessageThread = useCallback(async () => {
|
|
315
|
+
if (agentRef.current) {
|
|
316
|
+
return await agentRef.current.getFullMessageThread();
|
|
317
|
+
}
|
|
318
|
+
return { messages: [], sessionIds: [] };
|
|
319
|
+
}, []);
|
|
318
320
|
// Listen for Ctrl+O hotkey to toggle collapse/expand state and ESC to cancel confirmation
|
|
319
321
|
useInput((input, key) => {
|
|
320
322
|
if (key.ctrl && input === "o") {
|
|
321
323
|
// Clear terminal screen when expanded state changes
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
return newExpanded;
|
|
326
|
-
});
|
|
324
|
+
setIsExpanded((prev) => {
|
|
325
|
+
const newExpanded = !prev;
|
|
326
|
+
return newExpanded;
|
|
327
327
|
});
|
|
328
328
|
}
|
|
329
|
+
if (key.ctrl && input === "t") {
|
|
330
|
+
setIsTaskListVisible((prev) => !prev);
|
|
331
|
+
}
|
|
329
332
|
// Handle ESC key to cancel confirmation
|
|
330
333
|
if (key.escape && isConfirmationVisible) {
|
|
331
334
|
handleConfirmationCancel();
|
|
@@ -335,23 +338,25 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
335
338
|
messages,
|
|
336
339
|
isLoading,
|
|
337
340
|
isCommandRunning,
|
|
338
|
-
userInputHistory,
|
|
339
341
|
isExpanded,
|
|
342
|
+
isTaskListVisible,
|
|
343
|
+
setIsTaskListVisible,
|
|
340
344
|
sessionId,
|
|
341
345
|
sendMessage,
|
|
342
346
|
abortMessage,
|
|
343
347
|
latestTotalTokens,
|
|
344
348
|
isCompressing,
|
|
345
|
-
saveMemory,
|
|
346
349
|
mcpServers,
|
|
347
350
|
connectMcpServer,
|
|
348
351
|
disconnectMcpServer,
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
+
backgroundTasks,
|
|
353
|
+
sessionTasks,
|
|
354
|
+
getBackgroundTaskOutput,
|
|
355
|
+
stopBackgroundTask,
|
|
352
356
|
slashCommands,
|
|
353
357
|
hasSlashCommand,
|
|
354
358
|
subagentMessages,
|
|
359
|
+
subagentLatestTokens,
|
|
355
360
|
permissionMode,
|
|
356
361
|
setPermissionMode,
|
|
357
362
|
isConfirmationVisible,
|
|
@@ -360,8 +365,12 @@ export const ChatProvider = ({ children, bypassPermissions, pluginDirs, }) => {
|
|
|
360
365
|
hideConfirmation,
|
|
361
366
|
handleConfirmationDecision,
|
|
362
367
|
handleConfirmationCancel,
|
|
368
|
+
backgroundCurrentTask,
|
|
363
369
|
rewindId,
|
|
364
370
|
handleRewindSelect,
|
|
371
|
+
getFullMessageThread,
|
|
372
|
+
wasLastDetailsTooTall,
|
|
373
|
+
setWasLastDetailsTooTall,
|
|
365
374
|
};
|
|
366
375
|
return (_jsx(ChatContext.Provider, { value: contextValue, children: children }));
|
|
367
376
|
};
|
|
@@ -14,9 +14,7 @@ export declare const useInputManager: (callbacks?: Partial<InputManagerCallbacks
|
|
|
14
14
|
slashPosition: number;
|
|
15
15
|
showHistorySearch: boolean;
|
|
16
16
|
historySearchQuery: string;
|
|
17
|
-
|
|
18
|
-
memoryMessage: string;
|
|
19
|
-
showBashManager: boolean;
|
|
17
|
+
showBackgroundTaskManager: boolean;
|
|
20
18
|
showMcpManager: boolean;
|
|
21
19
|
showRewindManager: boolean;
|
|
22
20
|
permissionMode: PermissionMode;
|
|
@@ -51,17 +49,8 @@ export declare const useInputManager: (callbacks?: Partial<InputManagerCallbacks
|
|
|
51
49
|
checkForSlashDeletion: (cursorPos: number) => boolean;
|
|
52
50
|
handleHistorySearchSelect: (prompt: string) => void;
|
|
53
51
|
handleCancelHistorySearch: () => void;
|
|
54
|
-
activateMemoryTypeSelector: (message: string) => void;
|
|
55
|
-
handleMemoryTypeSelect: (type: "project" | "user") => Promise<void>;
|
|
56
|
-
handleCancelMemoryTypeSelect: () => void;
|
|
57
|
-
setUserInputHistory: (history: string[]) => void;
|
|
58
|
-
navigateHistory: (direction: "up" | "down", currentInput: string) => {
|
|
59
|
-
newInput: string;
|
|
60
|
-
newCursorPosition: number;
|
|
61
|
-
};
|
|
62
|
-
resetHistoryNavigation: () => void;
|
|
63
52
|
handleSpecialCharInput: (char: string) => void;
|
|
64
|
-
|
|
53
|
+
setShowBackgroundTaskManager: (show: boolean) => void;
|
|
65
54
|
setShowMcpManager: (show: boolean) => void;
|
|
66
55
|
setShowRewindManager: (show: boolean) => void;
|
|
67
56
|
setPermissionMode: (mode: PermissionMode) => 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,OAA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|
24
24
|
});
|
|
25
|
-
const [
|
|
26
|
-
show: false,
|
|
27
|
-
message: "",
|
|
28
|
-
});
|
|
29
|
-
const [showBashManager, setShowBashManager] = useState(false);
|
|
25
|
+
const [showBackgroundTaskManager, setShowBackgroundTaskManager] = useState(false);
|
|
30
26
|
const [showMcpManager, setShowMcpManager] = useState(false);
|
|
31
27
|
const [showRewindManager, setShowRewindManager] = useState(false);
|
|
32
28
|
const [permissionMode, setPermissionModeState] = useState("default");
|
|
@@ -48,11 +44,8 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
48
44
|
onHistorySearchStateChange: (show, query) => {
|
|
49
45
|
setHistorySearchState({ show, query });
|
|
50
46
|
},
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
54
|
-
onBashManagerStateChange: (show) => {
|
|
55
|
-
setShowBashManager(show);
|
|
47
|
+
onBackgroundTaskManagerStateChange: (show) => {
|
|
48
|
+
setShowBackgroundTaskManager(show);
|
|
56
49
|
},
|
|
57
50
|
onMcpManagerStateChange: (show) => {
|
|
58
51
|
setShowMcpManager(show);
|
|
@@ -65,9 +58,6 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
65
58
|
callbacks.onPermissionModeChange?.(mode);
|
|
66
59
|
},
|
|
67
60
|
onImagesStateChange: setAttachedImages,
|
|
68
|
-
onShowBashManager: () => setShowBashManager(true),
|
|
69
|
-
onShowMcpManager: () => setShowMcpManager(true),
|
|
70
|
-
onShowRewindManager: () => setShowRewindManager(true),
|
|
71
61
|
...callbacks,
|
|
72
62
|
});
|
|
73
63
|
managerRef.current = manager;
|
|
@@ -88,11 +78,8 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
88
78
|
onHistorySearchStateChange: (show, query) => {
|
|
89
79
|
setHistorySearchState({ show, query });
|
|
90
80
|
},
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
onBashManagerStateChange: (show) => {
|
|
95
|
-
setShowBashManager(show);
|
|
81
|
+
onBackgroundTaskManagerStateChange: (show) => {
|
|
82
|
+
setShowBackgroundTaskManager(show);
|
|
96
83
|
},
|
|
97
84
|
onMcpManagerStateChange: (show) => {
|
|
98
85
|
setShowMcpManager(show);
|
|
@@ -105,9 +92,6 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
105
92
|
callbacks.onPermissionModeChange?.(mode);
|
|
106
93
|
},
|
|
107
94
|
onImagesStateChange: setAttachedImages,
|
|
108
|
-
onShowBashManager: () => setShowBashManager(true),
|
|
109
|
-
onShowMcpManager: () => setShowMcpManager(true),
|
|
110
|
-
onShowRewindManager: () => setShowRewindManager(true),
|
|
111
95
|
...callbacks,
|
|
112
96
|
});
|
|
113
97
|
}
|
|
@@ -193,29 +177,6 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
193
177
|
const handleCancelHistorySearch = useCallback(() => {
|
|
194
178
|
managerRef.current?.handleCancelHistorySearch();
|
|
195
179
|
}, []);
|
|
196
|
-
// Memory type selector methods
|
|
197
|
-
const activateMemoryTypeSelector = useCallback((message) => {
|
|
198
|
-
managerRef.current?.activateMemoryTypeSelector(message);
|
|
199
|
-
}, []);
|
|
200
|
-
const handleMemoryTypeSelect = useCallback(async (type) => {
|
|
201
|
-
await managerRef.current?.handleMemoryTypeSelect(type);
|
|
202
|
-
}, []);
|
|
203
|
-
const handleCancelMemoryTypeSelect = useCallback(() => {
|
|
204
|
-
managerRef.current?.handleCancelMemoryTypeSelect();
|
|
205
|
-
}, []);
|
|
206
|
-
// Input history methods
|
|
207
|
-
const setUserInputHistory = useCallback((history) => {
|
|
208
|
-
managerRef.current?.setUserInputHistory(history);
|
|
209
|
-
}, []);
|
|
210
|
-
const navigateHistory = useCallback((direction, currentInput) => {
|
|
211
|
-
return (managerRef.current?.navigateHistory(direction, currentInput) || {
|
|
212
|
-
newInput: currentInput,
|
|
213
|
-
newCursorPosition: currentInput.length,
|
|
214
|
-
});
|
|
215
|
-
}, []);
|
|
216
|
-
const resetHistoryNavigation = useCallback(() => {
|
|
217
|
-
managerRef.current?.resetHistoryNavigation();
|
|
218
|
-
}, []);
|
|
219
180
|
// Special character handling
|
|
220
181
|
const handleSpecialCharInput = useCallback((char) => {
|
|
221
182
|
managerRef.current?.handleSpecialCharInput(char);
|
|
@@ -241,9 +202,7 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
241
202
|
slashPosition: commandSelectorState.position,
|
|
242
203
|
showHistorySearch: historySearchState.show,
|
|
243
204
|
historySearchQuery: historySearchState.query,
|
|
244
|
-
|
|
245
|
-
memoryMessage: memoryTypeSelectorState.message,
|
|
246
|
-
showBashManager,
|
|
205
|
+
showBackgroundTaskManager,
|
|
247
206
|
showMcpManager,
|
|
248
207
|
showRewindManager,
|
|
249
208
|
permissionMode,
|
|
@@ -273,19 +232,11 @@ export const useInputManager = (callbacks = {}) => {
|
|
|
273
232
|
// History search
|
|
274
233
|
handleHistorySearchSelect,
|
|
275
234
|
handleCancelHistorySearch,
|
|
276
|
-
// Memory type selector
|
|
277
|
-
activateMemoryTypeSelector,
|
|
278
|
-
handleMemoryTypeSelect,
|
|
279
|
-
handleCancelMemoryTypeSelect,
|
|
280
|
-
// Input history
|
|
281
|
-
setUserInputHistory,
|
|
282
|
-
navigateHistory,
|
|
283
|
-
resetHistoryNavigation,
|
|
284
235
|
// Special handling
|
|
285
236
|
handleSpecialCharInput,
|
|
286
237
|
// Bash/MCP Manager
|
|
287
|
-
|
|
288
|
-
managerRef.current?.
|
|
238
|
+
setShowBackgroundTaskManager: useCallback((show) => {
|
|
239
|
+
managerRef.current?.setShowBackgroundTaskManager(show);
|
|
289
240
|
}, []),
|
|
290
241
|
setShowMcpManager: useCallback((show) => {
|
|
291
242
|
managerRef.current?.setShowMcpManager(show);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"usePluginManager.d.ts","sourceRoot":"","sources":["../../src/hooks/usePluginManager.ts"],"names":[],"mappings":"AAUA,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":"AAUA,OAAO,EAGL,wBAAwB,EACzB,MAAM,qCAAqC,CAAC;AAE7C,wBAAgB,gBAAgB,IAAI,wBAAwB,CA6R3D"}
|
|
@@ -149,7 +149,8 @@ export function usePluginManager() {
|
|
|
149
149
|
}));
|
|
150
150
|
try {
|
|
151
151
|
const pluginId = `${name}@${marketplace}`;
|
|
152
|
-
|
|
152
|
+
const workdir = process.cwd();
|
|
153
|
+
await marketplaceService.installPlugin(pluginId, workdir);
|
|
153
154
|
await pluginScopeManager.enablePlugin(scope, pluginId);
|
|
154
155
|
await refresh();
|
|
155
156
|
}
|
|
@@ -169,10 +170,13 @@ export function usePluginManager() {
|
|
|
169
170
|
}));
|
|
170
171
|
try {
|
|
171
172
|
const pluginId = `${name}@${marketplace}`;
|
|
172
|
-
|
|
173
|
+
const workdir = process.cwd();
|
|
174
|
+
// 1. Remove from global registry and potentially clean up cache
|
|
175
|
+
await marketplaceService.uninstallPlugin(pluginId, workdir);
|
|
176
|
+
// 2. Find the scope where it's currently enabled and remove it from there
|
|
173
177
|
const scope = pluginScopeManager.findPluginScope(pluginId);
|
|
174
178
|
if (scope) {
|
|
175
|
-
await configurationService.removeEnabledPlugin(
|
|
179
|
+
await configurationService.removeEnabledPlugin(workdir, scope, pluginId);
|
|
176
180
|
}
|
|
177
181
|
await refresh();
|
|
178
182
|
}
|
|
@@ -183,7 +187,7 @@ export function usePluginManager() {
|
|
|
183
187
|
error: error instanceof Error ? error.message : String(error),
|
|
184
188
|
}));
|
|
185
189
|
}
|
|
186
|
-
}, [configurationService, pluginScopeManager, refresh]);
|
|
190
|
+
}, [configurationService, marketplaceService, pluginScopeManager, refresh]);
|
|
187
191
|
const updatePlugin = useCallback(async (name, marketplace) => {
|
|
188
192
|
setState((prev) => ({
|
|
189
193
|
...prev,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTasks.d.ts","sourceRoot":"","sources":["../../src/hooks/useTasks.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ,uCAGpB,CAAC"}
|