@@ -60,6 +60,10 @@ import {
6060 stripFilePartsForStorage ,
6161} from "@/lib/ai/message-attachments" ;
6262import { ImageAttachmentGrid } from "@/components/ui/image-attachment-grid" ;
63+ import {
64+ getMatchingSkillsForSlashQuery ,
65+ shouldAutocompleteCaptureEnter ,
66+ } from "./slash-command" ;
6367
6468type AgentMode = "long-agent" | "agent" | "plan" | "ask" ;
6569type ModelSelection = { provider : string ; model : string } ;
@@ -1263,6 +1267,14 @@ export function AgentPanel({
12631267 } ;
12641268
12651269 const slashQuery = input . startsWith ( "/" ) ? input . slice ( 1 ) : "" ;
1270+ const matchingSlashSkills = useMemo (
1271+ ( ) => getMatchingSkillsForSlashQuery ( availableSkills , slashQuery ) ,
1272+ [ availableSkills , slashQuery ]
1273+ ) ;
1274+ const autocompleteCapturesEnter = shouldAutocompleteCaptureEnter (
1275+ showAutocomplete ,
1276+ matchingSlashSkills
1277+ ) ;
12661278
12671279 return (
12681280 < div ref = { containerRef } className = "relative flex h-full min-w-0 flex-col bg-agent-bg text-agent-foreground font-mono text-sm overflow-hidden" >
@@ -1373,7 +1385,7 @@ export function AgentPanel({
13731385 { /* Input area with autocomplete */ }
13741386 < div className = "relative z-10 flex shrink-0 flex-col overflow-hidden bg-agent-bg/80 backdrop-blur-sm" style = { { height : inputHeight } } >
13751387 { /* Slash command autocomplete */ }
1376- { showAutocomplete && availableSkills . length > 0 && (
1388+ { autocompleteCapturesEnter && (
13771389 < SkillAutocomplete
13781390 query = { slashQuery }
13791391 skills = { availableSkills }
@@ -1513,7 +1525,7 @@ export function AgentPanel({
15131525 onPaste = { handleInputPaste }
15141526 onKeyDown = { ( e ) => {
15151527 // Enter without Shift sends message, Shift+Enter creates new line
1516- if ( e . key === "Enter" && ! e . shiftKey && ! e . nativeEvent . isComposing && ! showAutocomplete ) {
1528+ if ( e . key === "Enter" && ! e . shiftKey && ! e . nativeEvent . isComposing && ! autocompleteCapturesEnter ) {
15171529 e . preventDefault ( ) ;
15181530 handleSend ( ) ;
15191531 }
0 commit comments