diff --git a/apps/web/src/bench/members-tab.tsx b/apps/web/src/bench/members-tab.tsx
index 7349a9160..fffec23ee 100644
--- a/apps/web/src/bench/members-tab.tsx
+++ b/apps/web/src/bench/members-tab.tsx
@@ -5,6 +5,7 @@ import { IdentityAvatar, WorkbenchAvatar } from "@/chat/avatar";
import type { WorkbenchParticipant } from "@/chat/threads-api";
import { Link } from "../navigation";
import { tenantKeys } from "../query-client";
+import { useWorkerBenches } from "../worker-benches";
import { principalLabel } from "../settings/identity";
import { listPrincipals } from "../settings/tenancy-api";
@@ -26,6 +27,7 @@ export function MembersTab({
queryKey: [...tenantKeys.principals(workbenchTenantId), "members"],
queryFn: async () => (await listPrincipals(workbenchTenantId)).filter((p) => p.kind === "user"),
});
+ const { workerIdForAsset } = useWorkerBenches();
const agents = participants.filter((p) => p.kind === "agent");
return (
@@ -72,17 +74,33 @@ export function MembersTab({
No agents yet.
) : null}
- {agents.map((agent) => (
- -
-
+ {agents.map((agent) => {
+ const workerId =
+ agent.assetName === undefined ? undefined : workerIdForAsset(agent.assetName);
+ const body = (
+ <>
{agent.name}
{agent.address === "" ? "Starting" : "Running"}
-
-
- ))}
+ >
+ );
+ return (
+ -
+ {workerId === undefined ? (
+ body
+ ) : (
+
+ {body}
+
+ )}
+
+ );
+ })}
diff --git a/apps/web/src/pages/worker-page.tsx b/apps/web/src/pages/worker-page.tsx
index 2bec71a42..100def6db 100644
--- a/apps/web/src/pages/worker-page.tsx
+++ b/apps/web/src/pages/worker-page.tsx
@@ -28,7 +28,8 @@ import { useTenantQuery } from "../routines-api";
import { StageTopBar } from "../shell/stage-top-bar";
import { WORKERS_PATH_PREFIX } from "../path-ids";
import { workbenchPath } from "../workbench-path";
-import { StatusPill, useWorkbenchList, workerStatus } from "./workers-page";
+import { useWorkerBenches } from "../worker-benches";
+import { StatusPill, workerStatus } from "./workers-page";
function sourceKey(tenantId: string, agentId: string) {
return [...tenantKeys.agents(tenantId), "source", agentId] as const;
@@ -307,8 +308,7 @@ export function WorkerRoute({ agentId }: { readonly agentId: string }) {
selectedTenantId !== null,
() => listChatAgents(selectedTenantId as string),
);
- const benches = useWorkbenchList(selectedTenantId);
- const bench = benches.data?.[0];
+ const { byWorker } = useWorkerBenches();
return (
@@ -328,6 +328,8 @@ export function WorkerRoute({ agentId }: { readonly agentId: string }) {
);
}
const status = workerStatus(agent);
+ const agentBenches = byWorker.get(agent.id) ?? [];
+ const bench = agentBenches[0];
return (
<>
- Open {bench.title}
+ Open {bench.name}
)}
@@ -372,16 +374,18 @@ export function WorkerRoute({ agentId }: { readonly agentId: string }) {
Workbench
- {benches.data === undefined || benches.data.length === 0 ? (
- No workbenches yet.
+ {agentBenches.length === 0 ? (
+
+ Not in a workbench yet.
+
) : (
- benches.data.map((item) => (
+ agentBenches.map((item) => (
- {item.title}
+ {item.name}
))
)}
diff --git a/apps/web/src/pages/workers-page.tsx b/apps/web/src/pages/workers-page.tsx
index 9487c296f..d517ee99b 100644
--- a/apps/web/src/pages/workers-page.tsx
+++ b/apps/web/src/pages/workers-page.tsx
@@ -4,16 +4,16 @@
import { useState } from "react";
import { Button, RichEmptyState, toast } from "@corbits/react-ui";
import { Plus, Robot } from "@/lib/icons";
-import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
+import { useMutation, useQueryClient } from "@tanstack/react-query";
import { reportError } from "@corbits/error-sink";
import { QueryView } from "@/lib/api-query";
import { tenantKeys } from "../query-client";
import { isAgentNotRunning, listChatAgents, type ChatAgent } from "@/chat/threads-api";
import { WorkbenchAvatar } from "@/chat/avatar";
-import { listWorkbenches } from "@/chat/workbench-tenants";
import { describeRestartFailure, redeployWorkbenchAgent } from "../workbench-create";
import { useBench } from "../bench-context";
+import { useWorkerBenches } from "../worker-benches";
import { Link } from "../navigation";
import { useTenantQuery } from "../routines-api";
import { PageLayout } from "../shell/page-layout";
@@ -36,16 +36,6 @@ export function workerStatus(agent: Pick listWorkbenches(tenantId as string),
- });
-}
-
export function workerPath(agentId: string): string {
return `${WORKERS_PATH_PREFIX}/${encodeURIComponent(agentId)}`;
}
@@ -85,7 +75,7 @@ export function WorkersRosterList({
readonly tenantId: string;
readonly agents: readonly ChatAgent[];
}) {
- const benchName = useWorkbenchList(tenantId).data?.[0]?.title ?? "";
+ const { byWorker } = useWorkerBenches();
const [filter, setFilter] = useState("all");
const [query, setQuery] = useState("");
const queryClient = useQueryClient();
@@ -187,7 +177,7 @@ export function WorkersRosterList({
) : null}
- {benchName}
+ {(byWorker.get(agent.id) ?? []).map((bench) => bench.name).join(", ")}
{agent.liveAddress === null ? "" : "Now"}
diff --git a/apps/web/src/shell/workbench-list.tsx b/apps/web/src/shell/workbench-list.tsx
index f2082caec..d2b686331 100644
--- a/apps/web/src/shell/workbench-list.tsx
+++ b/apps/web/src/shell/workbench-list.tsx
@@ -9,6 +9,7 @@ import { Hash } from "@/lib/icons";
import { useBench } from "../bench-context";
import { useBenchWorkerStatus } from "../worker-status";
+import { useWorkerBenches } from "../worker-benches";
import { tenantKeys } from "../query-client";
import { workbenchIdFromPath, workbenchPath } from "../workbench-path";
import type { HubTenant } from "../needs-converge";
@@ -99,7 +100,7 @@ export function WorkbenchList({
/>
))}
-
+
);
}
@@ -110,13 +111,13 @@ function WorkerRow({
active,
onSelect,
}: {
- readonly agent: { readonly name: string };
+ readonly agent: { readonly name: string; readonly assetName: string };
readonly benches: readonly HubTenant[];
readonly active: boolean;
readonly onSelect: () => void;
}) {
- // Sidebar workers are the workspace's agents; a bench's copy shares the name.
- const status = useBenchWorkerStatus(benches, (p) => p.name === agent.name);
+ // The bench's copy of a workspace worker shares its deploy asset name.
+ const status = useBenchWorkerStatus(benches, (p) => p.assetName === agent.assetName);
return (