feat(ui): finish the workspace-sessions plan — tool filter, session search, explicit Resume

- Sidebar: a tool filter (shown once workspaces of two tools exist, kept in
  agenthub.sidebar.projects → tool; reordering under it keeps the hidden
  workspaces' places), and search that also finds a workspace by one of its
  session names, showing only the matching sessions.
- Workspace home: the repository it belongs to (root, main branch, worktree
  count) under the title, and each recent's cost.
- Transcript page: an explicit Resume for a Claude session started in a
  workspace's own folder (SessionResumeButton). It warns that a resume re-reads
  the whole transcript, re-reads the live panes, then starts in the first free
  pane and opens it; a live session offers Open pane instead.
This commit is contained in:
2026-10-02 01:35:34 +07:00
parent d0535af626
commit 5b269698f6
15 changed files with 597 additions and 36 deletions
@@ -36,7 +36,7 @@ vi.mock("../../run/RunSetup", () => ({
let view: LaneSourcesView;
let runs: RunHandle[];
const sessions = [
{ id: "s-live", name: "Live one", started_at: "2026-09-30T10:00:00Z" },
{ id: "s-live", name: "Live one", started_at: "2026-09-30T10:00:00Z", cost: 1.234 },
{ id: "s-old", name: "Old one", started_at: "2026-09-29T10:00:00Z" },
] as Session[];
@@ -208,6 +208,36 @@ describe("WorkspaceHome", () => {
expect(api.lanes.action).not.toHaveBeenCalled();
});
it("names the repository it belongs to: root, main branch, worktree count", async () => {
renderHome();
const facts = await screen.findByTestId("workspace-home-facts");
expect(facts).toHaveTextContent("/r");
expect(facts).toHaveTextContent("main");
expect(facts).toHaveTextContent("3 worktrees");
});
it("shows no repository line for a workspace outside any repository", async () => {
vi.mocked(api.projects.list).mockResolvedValueOnce({
projects: [{ root: null, name: "plain", workspaces: [1], worktrees: [] }],
} as never);
renderHome();
await waitFor(() => expect(api.projects.list).toHaveBeenCalled());
expect(screen.queryByTestId("workspace-home-facts")).toBeNull();
});
it("shows no repository line for a folder in no git project", async () => {
renderHome(lane({ id: 9, cwd: "/plain" }));
await waitFor(() => expect(api.projects.list).toHaveBeenCalled());
expect(screen.queryByTestId("workspace-home-facts")).toBeNull();
});
it("shows a recent's cost when it has one", async () => {
renderHome();
const live = await screen.findByTestId("workspace-recent-s-live");
expect(live).toHaveTextContent("$1.23");
expect(screen.getByTestId("workspace-recent-s-old")).not.toHaveTextContent("$");
});
it("saves instructions", async () => {
const user = userEvent.setup();
renderHome();