Skip to content

Commit ff7454b

Browse files
committed
Add /gpt-5-agent to mention '@gpt-5-agent'
1 parent e4343ff commit ff7454b

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

cli/src/chat.tsx

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -675,6 +675,21 @@ export const Chat = ({
675675
const selected = slashMatches[index]
676676
if (!selected) return
677677

678+
// If the command has insertText, insert it instead of executing
679+
if (selected.insertText && slashContext.startIndex >= 0) {
680+
const before = inputValue.slice(0, slashContext.startIndex)
681+
const after = inputValue.slice(
682+
slashContext.startIndex + 1 + slashContext.query.length,
683+
)
684+
setInputValue({
685+
text: before + selected.insertText + after,
686+
cursorPosition: before.length + selected.insertText.length,
687+
lastEditDueToNav: false,
688+
})
689+
setSlashSelectedIndex(0)
690+
return
691+
}
692+
678693
// Execute the selected slash command immediately
679694
const commandString = `/${selected.id}`
680695
setSlashSelectedIndex(0)
@@ -684,6 +699,9 @@ export const Chat = ({
684699
},
685700
[
686701
slashMatches,
702+
slashContext,
703+
inputValue,
704+
setInputValue,
687705
setSlashSelectedIndex,
688706
onSubmitPrompt,
689707
agentMode,
@@ -884,6 +902,21 @@ export const Chat = ({
884902
const selected = slashMatches[slashSelectedIndex] || slashMatches[0]
885903
if (!selected) return
886904

905+
// If the command has insertText, insert it instead of executing
906+
if (selected.insertText && slashContext.startIndex >= 0) {
907+
const before = inputValue.slice(0, slashContext.startIndex)
908+
const after = inputValue.slice(
909+
slashContext.startIndex + 1 + slashContext.query.length,
910+
)
911+
setInputValue({
912+
text: before + selected.insertText + after,
913+
cursorPosition: before.length + selected.insertText.length,
914+
lastEditDueToNav: false,
915+
})
916+
setSlashSelectedIndex(0)
917+
return
918+
}
919+
887920
// Execute the selected slash command immediately
888921
const commandString = `/${selected.id}`
889922
setSlashSelectedIndex(0)

cli/src/data/slash-commands.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ export interface SlashCommand {
1010
* input matches the command id exactly (no arguments).
1111
*/
1212
implicitCommand?: boolean
13+
/**
14+
* If set, selecting this command inserts this text into the input field
15+
* instead of executing a command. Useful for agent shortcuts.
16+
*/
17+
insertText?: string
1318
}
1419

1520
// Generate mode commands from the AGENT_MODES constant
@@ -112,6 +117,12 @@ export const SLASH_COMMANDS: SlashCommand[] = [
112117
label: 'publish',
113118
description: 'Publish agents to the agent store',
114119
},
120+
{
121+
id: 'gpt-5-agent',
122+
label: 'gpt-5-agent',
123+
description: 'Mention the GPT-5 agent to help solve complex problems',
124+
insertText: '@gpt-5-agent ',
125+
},
115126
{
116127
id: 'logout',
117128
label: 'logout',

0 commit comments

Comments
 (0)