diff --git a/src/auto-reply/reply/get-reply-inline-actions.ts b/src/auto-reply/reply/get-reply-inline-actions.ts index e133585411a..c312e1144e4 100644 --- a/src/auto-reply/reply/get-reply-inline-actions.ts +++ b/src/auto-reply/reply/get-reply-inline-actions.ts @@ -30,8 +30,13 @@ import type { createModelSelectionState } from "./model-selection.js"; import { extractInlineSimpleCommand } from "./reply-inline.js"; import type { TypingController } from "./typing.js"; -const builtinSlashCommands = (() => { - return listReservedChatSlashCommandNames([ +let builtinSlashCommands: Set | null = null; + +function getBuiltinSlashCommands(): Set { + if (builtinSlashCommands) { + return builtinSlashCommands; + } + builtinSlashCommands = listReservedChatSlashCommandNames([ "think", "verbose", "reasoning", @@ -41,7 +46,8 @@ const builtinSlashCommands = (() => { "status", "queue", ]); -})(); + return builtinSlashCommands; +} function resolveSlashCommandName(commandBodyNormalized: string): string | null { const trimmed = commandBodyNormalized.trim(); @@ -163,7 +169,7 @@ export async function handleInlineActions(params: { allowTextCommands && slashCommandName !== null && // `/skill …` needs the full skill command list. - (slashCommandName === "skill" || !builtinSlashCommands.has(slashCommandName)); + (slashCommandName === "skill" || !getBuiltinSlashCommands().has(slashCommandName)); const skillCommands = shouldLoadSkillCommands && params.skillCommands ? params.skillCommands