refactor(command): remove history command

This commit is contained in:
chengyongru authored and chengyongru committed 2026-11-14 23:02:26 +08:00
1 parent efec4a608d
commit c927808aff
30 files changed
+58 -278

No files matched your search

+6 -6
View File
@@ -1399,9 +1399,9 @@ describe("webui API helpers", () => {
accepts_args: false,
},
{
command: "/history",
title: "Show conversation history",
description: "Print the last N messages.",
command: "/inspect",
title: "Inspect session",
description: "Inspect a session.",
icon: "history",
arg_hint: "[n]",
lifecycle: "side_channel",
@@ -1437,9 +1437,9 @@ describe("webui API helpers", () => {
acceptsArgs: false,
},
{
command: "/history",
title: "Show conversation history",
description: "Print the last N messages.",
command: "/inspect",
title: "Inspect session",
description: "Inspect a session.",
icon: "history",
argHint: "[n]",
lifecycle: "side_channel",
-2
View File
@@ -28,7 +28,6 @@ const SLASH_COMMAND_KEYS = [
"restart",
"status",
"model",
"history",
"dream",
"dream_log",
"dream_restore",
@@ -629,7 +628,6 @@ describe("webui i18n", () => {
expect(slash.badges.recent).toBeTruthy();
expect(slash.details.goalActive).toBeTruthy();
expect(slash.details.goalReady).toBeTruthy();
expect(slash.details.history).toBeTruthy();
expect(slash.details.stopRunning).toBeTruthy();
for (const key of SLASH_COMMAND_KEYS) {
const command = slash.commands[key as keyof typeof slash.commands];
+23 -23
View File
@@ -50,9 +50,9 @@ const COMMANDS: SlashCommand[] = [
acceptsArgs: false,
},
{
command: "/history",
title: "Show conversation history",
description: "Print the last N persisted messages.",
command: "/inspect",
title: "Inspect session",
description: "Inspect a session.",
icon: "history",
argHint: "[n]",
lifecycle: "side_channel",
@@ -490,13 +490,13 @@ describe("ThreadComposer", () => {
const input = screen.getByLabelText("Message input");
fireEvent.change(input, { target: { value: "/" } });
expect(screen.getByRole("option", { name: /\/history/i })).toHaveAttribute(
expect(screen.getByRole("option", { name: /\/inspect/i })).toHaveAttribute(
"aria-selected",
"true",
);
fireEvent.keyDown(input, { key: "Enter" });
expect(input).toHaveValue("/history ");
expect(input).toHaveValue("/inspect ");
expect(onSend).not.toHaveBeenCalled();
});
@@ -1714,15 +1714,15 @@ describe("ThreadComposer", () => {
expect(palette).toBeInTheDocument();
expect(palette).toHaveStyle({ maxHeight: "288px" });
expect(screen.queryByRole("option", { name: /\/stop/i })).not.toBeInTheDocument();
expect(screen.getByRole("option", { name: /\/history/i })).toHaveAttribute(
expect(screen.getByRole("option", { name: /\/inspect/i })).toHaveAttribute(
"aria-selected",
"true",
);
fireEvent.keyDown(input, { key: "Enter" });
expect(input).toHaveValue("/history ");
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/history");
expect(input.previousElementSibling?.textContent).toBe("/history ");
expect(input).toHaveValue("/inspect ");
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/inspect");
expect(input.previousElementSibling?.textContent).toBe("/inspect ");
expect(onSend).not.toHaveBeenCalled();
expect(screen.queryByRole("listbox", { name: "Slash commands" })).not.toBeInTheDocument();
});
@@ -1807,7 +1807,7 @@ describe("ThreadComposer", () => {
});
it("orders recent slash commands first for the blank slash menu", () => {
window.localStorage.setItem("nanobot.webui.slashCommandRecents", JSON.stringify(["/history"]));
window.localStorage.setItem("nanobot.webui.slashCommandRecents", JSON.stringify(["/inspect"]));
render(
<ThreadComposer
onSend={vi.fn()}
@@ -1820,7 +1820,7 @@ describe("ThreadComposer", () => {
target: { value: "/" },
});
expect(screen.getByRole("option", { name: /\/history/i })).toHaveAttribute(
expect(screen.getByRole("option", { name: /\/inspect/i })).toHaveAttribute(
"aria-selected",
"true",
);
@@ -2419,12 +2419,12 @@ describe("ThreadComposer", () => {
const onSend = vi.fn();
render(<ThreadComposer onSend={onSend} slashCommands={COMMANDS} />);
const input = screen.getByLabelText("Message input") as HTMLTextAreaElement;
const text = "/history $workflow 中文 English";
const text = "/inspect $workflow 中文 English";
fireEvent.change(input, { target: { value: text, selectionStart: text.length } });
const command = screen.getByTestId("composer-slash-command");
const skill = screen.getByTestId("composer-skill-reference-workflow");
expect(command).toHaveTextContent("/history");
expect(command).toHaveTextContent("/inspect");
expect(command.className).toBe(skill.className);
expect(command.getAttribute("style")).toBe(skill.getAttribute("style"));
expect(input.previousElementSibling).toHaveAttribute("aria-hidden", "true");
@@ -2433,15 +2433,15 @@ describe("ThreadComposer", () => {
input.setSelectionRange(1, 4);
const setData = vi.fn();
fireEvent.copy(input, { clipboardData: { setData } });
expect(setData).toHaveBeenCalledWith("text/plain", "his");
expect(setData).toHaveBeenCalledWith("text/plain", "ins");
fireEvent.cut(input, { clipboardData: { setData } });
expect(input).toHaveValue("/tory $workflow 中文 English");
expect(input).toHaveValue("/pect $workflow 中文 English");
expect(screen.queryByTestId("composer-slash-command")).not.toBeInTheDocument();
fireEvent.keyDown(input, { key: "z", ctrlKey: true });
expect(input).toHaveValue(text);
expect(input.selectionStart).toBe(1);
expect(input.selectionEnd).toBe(4);
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/history");
expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/inspect");
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
expect(onSend).toHaveBeenCalledWith(text, undefined, { sideChannel: true });
@@ -2495,14 +2495,14 @@ describe("ThreadComposer", () => {
expect(onSend).toHaveBeenCalledWith(command.trim(), undefined, { sideChannel: true, userShell: true });
});
it.each(["", "/history "])("mirrors inline references during composition without submitting the IME confirmation: %s", (prefix) => {
it.each(["", "/inspect "])("mirrors inline references during composition without submitting the IME confirmation: %s", (prefix) => {
const onSend = vi.fn();
render(<ThreadComposer onSend={onSend} slashCommands={COMMANDS} />);
const input = screen.getByLabelText("Message input") as HTMLTextAreaElement;
fireEvent.change(input, { target: { value: `${prefix}$workflow ` } });
fireEvent.compositionStart(input);
fireEvent.change(input, { target: { value: `${prefix}$workflow zhong` } });
if (prefix) expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/history");
if (prefix) expect(screen.getByTestId("composer-slash-command")).toHaveTextContent("/inspect");
expect(screen.getByTestId("composer-skill-reference-workflow")).toHaveTextContent(/^\$workflow$/);
expect(input.previousElementSibling?.textContent).toBe(input.value);
expect(input.previousElementSibling).toHaveClass("z-20");
@@ -3237,10 +3237,10 @@ describe("ThreadComposer", () => {
);
const input = screen.getByLabelText("Message input");
fireEvent.change(input, { target: { value: "/history" } });
fireEvent.change(input, { target: { value: "/inspect" } });
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
expect(onSend).toHaveBeenCalledWith("/history", undefined, { sideChannel: true });
expect(onSend).toHaveBeenCalledWith("/inspect", undefined, { sideChannel: true });
});
it("does not infer side-channel behavior before command metadata loads", () => {
@@ -3497,10 +3497,10 @@ describe("ThreadComposer", () => {
it("does not mark side-channel commands as guidance during an active turn", () => {
const onSend = vi.fn();
render(<ThreadComposer onSend={onSend} onStop={vi.fn()} isStreaming slashCommands={COMMANDS} />);
fireEvent.change(screen.getByLabelText("Message input"), { target: { value: "/history 5" } });
fireEvent.change(screen.getByLabelText("Message input"), { target: { value: "/inspect 5" } });
fireEvent.click(screen.getByRole("button", { name: "Send message" }));
expect(onSend).toHaveBeenCalledWith("/history 5", undefined, { sideChannel: true });
expect(onSend).toHaveBeenCalledWith("/inspect 5", undefined, { sideChannel: true });
});
it("keeps Stop available while a draft attachment is encoding", () => {
@@ -3574,7 +3574,7 @@ describe("ThreadComposer", () => {
},
);
it.each(["/history 5", "/stop now", "/STOP@nanobot now"])(
it.each(["/inspect 5", "/stop now", "/STOP@nanobot now"])(
"sends registered command %s to the gateway without queuing it",
(content) => {
const onSend = vi.fn();
+4 -4
View File
@@ -5478,9 +5478,9 @@ describe("ThreadShell", () => {
return httpJson({
commands: [
{
command: "/history",
title: "Show conversation history",
description: "Print the last N persisted messages.",
command: "/inspect",
title: "Inspect session",
description: "Inspect a session.",
icon: "history",
arg_hint: "[n]",
lifecycle: "side_channel",
@@ -5520,7 +5520,7 @@ describe("ThreadShell", () => {
});
expect(screen.getByRole("listbox", { name: "Slash commands" })).toBeInTheDocument();
expect(screen.getByRole("option", { name: /\/history/i })).toBeInTheDocument();
expect(screen.getByRole("option", { name: /\/inspect/i })).toBeInTheDocument();
});
it("surfaces a dismissible banner for an uncorrelated message_too_big error", async () => {