





















@@ -25,6 +25,7 @@ const BROWSER_SAFE_THINKING_LEVELS: ThinkLevel[] = [
2525type DefineChatCommandInput = {
2626key: string;
2727nativeName?: string;
28+nativeAliases?: string[];
2829description: string;
2930args?: ChatCommandDefinition["args"];
3031argsParsing?: ChatCommandDefinition["argsParsing"];
@@ -50,6 +51,7 @@ export function defineChatCommand(command: DefineChatCommandInput): ChatCommandD
5051return {
5152key: command.key,
5253nativeName: command.nativeName,
54+nativeAliases: command.nativeAliases?.map((alias) => alias.trim()).filter(Boolean),
5355description: command.description,
5456 acceptsArgs,
5557args: command.args,
@@ -105,17 +107,22 @@ export function assertCommandRegistry(commands: ChatCommandDefinition[]): void {
105107if (nativeName) {
106108throw new Error(`Text-only command has native name: ${command.key}`);
107109}
110+if (command.nativeAliases?.length) {
111+throw new Error(`Text-only command has native aliases: ${command.key}`);
112+}
108113if (command.textAliases.length === 0) {
109114throw new Error(`Text-only command missing text alias: ${command.key}`);
110115}
111116} else if (!nativeName) {
112117throw new Error(`Native command missing native name: ${command.key}`);
113118} else {
114-const nativeKey = normalizeOptionalLowercaseString(nativeName) ?? "";
115-if (nativeNames.has(nativeKey)) {
116-throw new Error(`Duplicate native command: ${nativeName}`);
119+for (const alias of [nativeName, ...(command.nativeAliases ?? [])]) {
120+const nativeKey = normalizeOptionalLowercaseString(alias) ?? "";
121+if (nativeNames.has(nativeKey)) {
122+throw new Error(`Duplicate native command: ${alias}`);
123+}
124+nativeNames.add(nativeKey);
117125}
118-nativeNames.add(nativeKey);
119126}
120127121128if (command.scope === "native" && command.textAliases.length > 0) {
@@ -268,8 +275,9 @@ export function buildBuiltinChatCommands(
268275defineChatCommand({
269276key: "btw",
270277nativeName: "btw",
278+nativeAliases: ["side"],
271279description: "Ask a side question without changing future session context.",
272-textAlias: "/btw",
280+textAliases: ["/btw", "/side"],
273281acceptsArgs: true,
274282category: "tools",
275283tier: "standard",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。