Skip to content

Open-source AI coworkers that each get a computer of their own: a browser, files and tools, with every action decided before it happens and recorded after. Bring any AG-UI agent.

Let a hidden coworker be found again on the Agents screen (#647)

Asem ahmedca8d51c3bf99
diff --git a/CHANGELOG.md b/CHANGELOG.md
index a8aa3da8..af2dece1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -8,6 +8,15 @@ Newest first. `Unreleased` is what is on `main` and not yet tagged.
## Unreleased
+### A hidden coworker can be found again on the Agents screen
+
+Hiding a coworker took it off both lists on `/agents`, and Unhide is only in the coworker's dialog,
+which only its card opens, so a hidden coworker had no way back short of typing its id into the
+address bar. The screen now ends with a collapsed **Hidden** section listing them, each card opening
+the dialog as before. It appears only when something is hidden. Hiding still changes nothing for
+anyone else, and nothing on the server changed: the screen reads the `GET /api/agents?hidden=true`
+list the server already served.
+
### Browser controls are visible in chat and the Computer sidebar
Channel chats and standalone Bot chats now have a labeled Computer button and always-visible
diff --git a/app/src/routes/_authed/_app/agents/index.tsx b/app/src/routes/_authed/_app/agents/index.tsx
index 11d4ac85..fee6b3c8 100644
--- a/app/src/routes/_authed/_app/agents/index.tsx
+++ b/app/src/routes/_authed/_app/agents/index.tsx
@@ -1,4 +1,4 @@
-import { IconPlus } from "@tabler/icons-react";
+import { IconChevronDown, IconPlus } from "@tabler/icons-react";
import { useQuery } from "@tanstack/react-query";
import { createFileRoute, Link } from "@tanstack/react-router";
import { z } from "zod";
@@ -48,6 +48,13 @@ function AgentsScreen() {
} = useQuery(agentListQueryOptions());
const mine = agents?.filter((a) => a.mine);
const explore = agents?.filter(isSharedWithYou);
+ /*
+ * Hiding takes a coworker off both lists above, and Unhide lives in its dialog, which only a card
+ * opens. Without this section a hidden coworker had no way back onto the screen short of typing
+ * its id into the address bar. Nothing while loading, failed or empty: it is a way back for
+ * somebody who hid something, not a third roster everybody has to read past.
+ */
+ const { data: hiddenAgents } = useQuery(agentListQueryOptions(true));
// Creating wins if both are somehow set: it is the more recent intent.
const showCreate = isCreating === true;
@@ -167,6 +174,27 @@ function AgentsScreen() {
</Empty>
)}
</div>
+ {hiddenAgents?.length ? (
+ <details className="group mt-8 mb-12 w-full max-w-2xl">
+ <summary className="flex cursor-pointer list-none items-center gap-2 [&::-webkit-details-marker]:hidden">
+ <h2 className="font-bold text-lg">Hidden</h2>
+ <span className="text-sm text-muted-foreground">
+ {hiddenAgents.length}
+ </span>
+ <IconChevronDown
+ aria-hidden="true"
+ className="size-4 text-muted-foreground transition-transform group-open:rotate-180 motion-reduce:transition-none"
+ />
+ </summary>
+ <div className="mt-4 grid grid-cols-2 gap-4">
+ {hiddenAgents.map((agent) => (
+ <div className="min-w-0" key={agent.id}>
+ <AgentCard agent={agent} />
+ </div>
+ ))}
+ </div>
+ </details>
+ ) : null}
</div>
<CreateAgentDialog
onClose={close}
diff --git a/app/tests/agent-roster-error.test.tsx b/app/tests/agent-roster-error.test.tsx
index 6ce94cda..12731ea2 100644
--- a/app/tests/agent-roster-error.test.tsx
+++ b/app/tests/agent-roster-error.test.tsx
@@ -446,6 +446,56 @@ test("a failed REFETCH on /agents with the other slice empty also shows it as em
expect(view.queryByText("Your agents couldn't be loaded.")).toBeNull();
});
+/*
+ * Hiding a coworker takes it off both rosters, and Unhide is only in its dialog, which only a card
+ * opens. These serve the two list requests from their real URLs so the hidden roster arrives the
+ * way the server sends it: `GET /api/agents?hidden=true`.
+ */
+function servingRosters(visible: AgentProfile[], hidden: AgentProfile[]) {
+ global.fetch = (async (input: RequestInfo | URL) => {
+ const url = String(input);
+ const agents = url.includes("hidden=true") ? hidden : visible;
+ return Response.json({ agents });
+ }) as unknown as typeof fetch;
+}
+
+test("a hidden coworker is on /agents under Hidden, collapsed, with a card that opens it", async () => {
+ const mine = agent({ id: "mine-1", name: "Mine Agent" });
+ const tucked = agent({ id: "hidden-1", name: "Tucked Agent", hidden: true });
+ servingRosters([mine], [tucked]);
+
+ const view = renderAgents(failingQueryClient());
+
+ expect(await view.findByText("Hidden")).toBeTruthy();
+ const section = view.container.querySelector("details");
+ expect(section).not.toBeNull();
+ // Collapsed until asked for, so it does not push the two rosters apart.
+ expect(section?.open).toBe(false);
+ // Inside the section rather than in either roster above it.
+ expect(section?.textContent).toContain("Tucked Agent");
+ expect(section?.textContent).not.toContain("Mine Agent");
+ // The card's own Details link is the way to the dialog that holds Unhide.
+ const link = view.getByLabelText("View details for Tucked Agent");
+ expect(link.getAttribute("href")).toBe("/agents?agent=hidden-1");
+});
+
+test("with nothing hidden, /agents has no Hidden section at all", async () => {
+ servingRosters([agent({ id: "mine-1", name: "Mine Agent" })], []);
+ const queryClient = failingQueryClient();
+
+ const view = renderAgents(queryClient);
+
+ expect(await view.findByText("Mine Agent")).toBeTruthy();
+ // Absent because the hidden roster came back empty, not because it has not come back yet.
+ await waitFor(() => {
+ expect(queryClient.getQueryState(agentKeys.list(true))?.status).toBe(
+ "success",
+ );
+ });
+ expect(view.queryByText("Hidden")).toBeNull();
+ expect(view.container.querySelector("details")).toBeNull();
+});
+
test("a failed REFETCH on / with explore empty shows it as empty, not broken", async () => {
const mine = agent({ id: "mine-1", name: "Mine Agent", mine: true });
const queryClient = staleQueryClient([mine]);