Surface cross-workspace subagents in their workspaces (#2061)
* fix(workspaces): show provider subagent activity Provider subagent lifecycle lives outside managed agent snapshots, so workspace aggregation dropped it after the parent turn finished. Count running provider subagents against the delegation root and emit workspace updates when their status changes. * fix(workspaces): surface cross-workspace subagents
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { Agent } from "@/stores/session-store";
|
||||
import type { WorkspaceTabSnapshot } from "@/stores/workspace-layout-actions";
|
||||
import { shouldAutoOpenAgentTab } from "@/subagents/policies";
|
||||
import { isWorkspaceRootAgent } from "@/subagents/policies";
|
||||
import { normalizeWorkspaceOpaqueId } from "@/utils/workspace-identity";
|
||||
|
||||
export interface WorkspaceAgentVisibility {
|
||||
@@ -31,6 +31,10 @@ export function deriveWorkspaceAgentVisibility(input: {
|
||||
const activeAgentIds = new Set<string>();
|
||||
const autoOpenAgentIds = new Set<string>();
|
||||
const knownAgentIds = new Set<string>();
|
||||
const agentsById = new Map<string, Agent>([
|
||||
...(agentDetails?.entries() ?? []),
|
||||
...(sessionAgents?.entries() ?? []),
|
||||
]);
|
||||
for (const agent of sessionAgents?.values() ?? []) {
|
||||
if (!agentBelongsToWorkspace(agent, workspaceId)) {
|
||||
continue;
|
||||
@@ -38,7 +42,8 @@ export function deriveWorkspaceAgentVisibility(input: {
|
||||
knownAgentIds.add(agent.id);
|
||||
if (!agent.archivedAt) {
|
||||
activeAgentIds.add(agent.id);
|
||||
if (shouldAutoOpenAgentTab(agent)) {
|
||||
const parentAgent = agent.parentAgentId ? agentsById.get(agent.parentAgentId) : undefined;
|
||||
if (isWorkspaceRootAgent(agent, parentAgent)) {
|
||||
autoOpenAgentIds.add(agent.id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user