Skip to content

Commit e97c599

Browse files
authored
fix: Restore skill suggestions in new task view (#1463)
## Problem Removing the preview session in #1438 broke slash command suggestions in the new task view -- only the 3 built-in feedback commands appear when typing /. ## Changes 1. Fetch skills from skills.list on TaskInputEditor mount and store in draftStore.commands 2. Fall back to draftStore.commands in getCommandSuggestions when no active session exists 3. Clean up stored commands on unmount ## How did you test this? Manually
1 parent c0b2dde commit e97c599

2 files changed

Lines changed: 24 additions & 3 deletions

File tree

apps/code/src/renderer/features/message-editor/suggestions/getSuggestions.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,12 @@ export function getCommandSuggestions(
6565
sessionId: string,
6666
query: string,
6767
): CommandSuggestionItem[] {
68-
const taskId = useDraftStore.getState().contexts[sessionId]?.taskId;
69-
const merged = [...CODE_COMMANDS, ...getAvailableCommandsForTask(taskId)];
68+
const store = useDraftStore.getState();
69+
const taskId = store.contexts[sessionId]?.taskId;
70+
const agentCommands = taskId
71+
? getAvailableCommandsForTask(taskId)
72+
: (store.commands[sessionId] ?? []);
73+
const merged = [...CODE_COMMANDS, ...agentCommands];
7074
const commands = [...new Map(merged.map((cmd) => [cmd.name, cmd])).values()];
7175
const filtered = searchCommands(commands, query);
7276

apps/code/src/renderer/features/task-detail/components/TaskInputEditor.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { TourHighlight } from "@components/TourHighlight";
44
import { AttachmentsBar } from "@features/message-editor/components/AttachmentsBar";
55
import { EditorToolbar } from "@features/message-editor/components/EditorToolbar";
66
import type { MessageEditorHandle } from "@features/message-editor/components/MessageEditor";
7+
import { useDraftStore } from "@features/message-editor/stores/draftStore";
78
import { useTaskInputHistoryStore } from "@features/message-editor/stores/taskInputHistoryStore";
89
import { useTiptapEditor } from "@features/message-editor/tiptap/useTiptapEditor";
910
import { ReasoningLevelSelector } from "@features/sessions/components/ReasoningLevelSelector";
@@ -12,8 +13,9 @@ import type { AgentAdapter } from "@features/settings/stores/settingsStore";
1213
import { useConnectivity } from "@hooks/useConnectivity";
1314
import { ArrowUp } from "@phosphor-icons/react";
1415
import { Box, Flex, IconButton, Text, Tooltip } from "@radix-ui/themes";
16+
import { trpcClient } from "@renderer/trpc/client";
1517
import { EditorContent } from "@tiptap/react";
16-
import { forwardRef, useCallback, useImperativeHandle } from "react";
18+
import { forwardRef, useCallback, useEffect, useImperativeHandle } from "react";
1719
import "./TaskInput.css";
1820

1921
interface TaskInputEditorProps {
@@ -101,6 +103,21 @@ export const TaskInputEditor = forwardRef<
101103
onEmptyChange,
102104
});
103105

106+
useEffect(() => {
107+
let cancelled = false;
108+
trpcClient.skills.list.query().then((skills) => {
109+
if (cancelled) return;
110+
useDraftStore.getState().actions.setCommands(
111+
sessionId,
112+
skills.map((s) => ({ name: s.name, description: s.description })),
113+
);
114+
});
115+
return () => {
116+
cancelled = true;
117+
useDraftStore.getState().actions.clearCommands(sessionId);
118+
};
119+
}, [sessionId]);
120+
104121
useImperativeHandle(
105122
ref,
106123
() => ({

0 commit comments

Comments
 (0)