refactor(web): remove the dead right-panel and subagent-preview code
v0.1.1 replaced both surfaces: the session tray took the right panel's todo/tasks, and the in-place `?sub=` child view took the subagent preview. - delete `features/chat/side-panel.tsx` (nothing imported it since the tray landed) - delete `SubagentModal` and its private helpers (`SUB_BADGE`, `SUB_DOT`, `SubagentEntry`, `parseSubagentLines`, `SUB_ROLES`); the child view builds its timeline from the parent's entries instead of `subagent.read` - drop `chatCommands.readSubagent` (its only caller is gone) - drop the deprecated store slice `PreviewTarget` / `preview` / `setPreview`, including the session-migration re-key and the `PanelTab` alias - drop their exclusive CSS (`.sub-item*`, `.sub-preview*`, `.sub-steer`) and the 6 orphan catalog keys (chat.subagentTitle, chat.preview, chat.previewNote, chat.task, chat.currentSubagents, chat.steerRequired) - tests: remove the two SubagentModal cases and the preview/readSubagent expectations (295 tests, down from 297 — exactly the deleted cases) Verification: typecheck clean, vitest 295/295, vite build green, visual matrix 24/24 clean.
This commit is contained in:
1 parent
bcf50b516f
commit
3789394c85
12 files changed
+12
-653
No files matched your search
@@ -121,11 +121,7 @@ describe("chat command payloads", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("reads sub-sessions and task output by id", () => {
|
||||
expect(chatCommands.readSubagent("s1", "researcher")).toMatchObject({
|
||||
method: "subagent.read",
|
||||
params: { target: "researcher" },
|
||||
});
|
||||
it("reads task output by id", () => {
|
||||
expect(chatCommands.stopTask("s1", "t1")).toMatchObject({
|
||||
method: "task.stop",
|
||||
params: { taskId: "t1" },
|
||||
|
||||
@@ -9,7 +9,7 @@ import { entryFixture, sessionFixture } from "./chat-fixtures";
|
||||
|
||||
beforeEach(() => {
|
||||
useSessionsStore.getState().reset();
|
||||
useChatStore.setState({ history: {}, sending: null, preview: null });
|
||||
useChatStore.setState({ history: {}, sending: null });
|
||||
window.history.replaceState(null, "", "/chat");
|
||||
});
|
||||
|
||||
@@ -21,7 +21,6 @@ describe("session id migration (`tmp-N` → real id)", () => {
|
||||
hasMore: true,
|
||||
});
|
||||
useChatStore.getState().setSending({ sessionId: "tmp-1", text: "hello" });
|
||||
useChatStore.getState().setPreview({ sessionId: "tmp-1", subagentId: "sa1" });
|
||||
window.history.replaceState(null, "", "/chat/tmp-1?workspace=w1");
|
||||
|
||||
const seen: string[] = [];
|
||||
@@ -41,7 +40,6 @@ describe("session id migration (`tmp-N` → real id)", () => {
|
||||
expect(useChatStore.getState().history["01a1-real"]?.entries).toHaveLength(1);
|
||||
expect(useChatStore.getState().history["01a1-real"]?.cursor).toEqual({ before: "u1", hasMore: true });
|
||||
expect(useChatStore.getState().sending).toEqual({ sessionId: "01a1-real", text: "hello" });
|
||||
expect(useChatStore.getState().preview).toEqual({ sessionId: "01a1-real", subagentId: "sa1" });
|
||||
|
||||
expect(replaceChatUrl("tmp-1", "01a1-real", "w1")).toBe(true);
|
||||
expect(window.location.pathname + window.location.search).toBe("/chat/01a1-real?workspace=w1");
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { afterEach, beforeAll, describe, expect, it, vi } from "vitest";
|
||||
|
||||
import { SubagentModal, TaskOutputModal } from "@/features/chat/modals";
|
||||
import { TaskOutputModal } from "@/features/chat/modals";
|
||||
import { setLanguage } from "@/lib/i18n";
|
||||
|
||||
import { sessionFixture, subagentFixture, taskFixture, taskOutputFixture } from "./chat-fixtures";
|
||||
import { sessionFixture, taskFixture, taskOutputFixture } from "./chat-fixtures";
|
||||
import { mockApi } from "./helpers/api-mock";
|
||||
|
||||
beforeAll(async () => {
|
||||
@@ -78,57 +78,3 @@ describe("task output modal", () => {
|
||||
expect(screen.queryByText("(no output)")).not.toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
describe("subagent preview modal", () => {
|
||||
it("renders the raw pi entries from subagent.read (sessionFile + lines)", async () => {
|
||||
mockCommands({
|
||||
"subagent.read": {
|
||||
status: 202,
|
||||
body: {
|
||||
sessionFile: "/tmp/pi2-subsessions/researcher.jsonl",
|
||||
lines: ["[1] user: fix the auth flow", "[2] assistant: looking at it now", "[3] tool result: ok"],
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
render(
|
||||
<SubagentModal
|
||||
open
|
||||
session={sessionFixture()}
|
||||
subagent={subagentFixture()}
|
||||
onClose={vi.fn()}
|
||||
onBack={vi.fn()}
|
||||
onSteer={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(await screen.findByText("fix the auth flow")).toBeInTheDocument();
|
||||
expect(screen.getByText("looking at it now")).toBeInTheDocument();
|
||||
expect(screen.getByText("/tmp/pi2-subsessions/researcher.jsonl")).toBeInTheDocument();
|
||||
expect(screen.getByText("fix the auth flow").closest("article")).toHaveAttribute("data-role", "user");
|
||||
expect(screen.getByText("looking at it now").closest("article")).toHaveAttribute("data-role", "assistant");
|
||||
// No synthetic "preview" copy.
|
||||
expect(screen.queryByText(/Got it\. I'll run with/)).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows an error state when the sub-session cannot be read", async () => {
|
||||
mockCommands({
|
||||
"subagent.read": {
|
||||
status: 404,
|
||||
body: { error: { code: "E_NOT_FOUND", message: "unknown sub-agent session file", retryable: false } },
|
||||
},
|
||||
});
|
||||
render(
|
||||
<SubagentModal
|
||||
open
|
||||
session={sessionFixture()}
|
||||
subagent={subagentFixture()}
|
||||
onClose={vi.fn()}
|
||||
onBack={vi.fn()}
|
||||
onSteer={vi.fn()}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(await screen.findByRole("alert")).toHaveTextContent("Not found");
|
||||
});
|
||||
});
|
||||
@@ -571,7 +571,7 @@ function requestedUrls(fetchMock: ReturnType<typeof mockApi>): string[] {
|
||||
describe("chat session deep link", () => {
|
||||
beforeEach(() => {
|
||||
useSessionsStore.getState().reset();
|
||||
useChatStore.setState({ history: {}, sending: null, preview: null });
|
||||
useChatStore.setState({ history: {}, sending: null });
|
||||
silentSocket();
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user