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,5 +0,0 @@
|
||||
import type { Agent } from "@/stores/session-store";
|
||||
|
||||
export function shouldAutoOpenAgentTab(agent: Pick<Agent, "parentAgentId">): boolean {
|
||||
return !agent.parentAgentId;
|
||||
}
|
||||
@@ -3,4 +3,4 @@ export { selectSubagentsForParent, useSubagentsForParent } from "./select";
|
||||
export { useArchiveSubagent, type UseArchiveSubagentInput } from "./use-archive-subagent";
|
||||
export { useDetachSubagent, type UseDetachSubagentInput } from "./use-detach-subagent";
|
||||
export { resolveCloseAgentTabPolicy, type CloseAgentTabPolicy } from "./close-tab-policy";
|
||||
export { shouldAutoOpenAgentTab } from "./auto-open-tab-policy";
|
||||
export { isWorkspaceRootAgent } from "./workspace-root-policy";
|
||||
|
||||
@@ -6,4 +6,4 @@
|
||||
// UI surface. Use `@/subagents/policies` only when the caller is
|
||||
// non-RN infrastructure code; otherwise prefer `@/subagents`.
|
||||
export { resolveCloseAgentTabPolicy, type CloseAgentTabPolicy } from "./close-tab-policy";
|
||||
export { shouldAutoOpenAgentTab } from "./auto-open-tab-policy";
|
||||
export { isWorkspaceRootAgent } from "./workspace-root-policy";
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
import type { Agent } from "@/stores/session-store";
|
||||
import { normalizeWorkspaceOpaqueId } from "@/utils/workspace-identity";
|
||||
|
||||
type WorkspaceAgent = Pick<Agent, "parentAgentId" | "workspaceId">;
|
||||
|
||||
export function isWorkspaceRootAgent(
|
||||
agent: WorkspaceAgent,
|
||||
parentAgent: Pick<Agent, "workspaceId"> | undefined,
|
||||
): boolean {
|
||||
if (!agent.parentAgentId) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const workspaceId = normalizeWorkspaceOpaqueId(agent.workspaceId);
|
||||
const parentWorkspaceId = normalizeWorkspaceOpaqueId(parentAgent?.workspaceId);
|
||||
return Boolean(workspaceId && parentWorkspaceId && workspaceId !== parentWorkspaceId);
|
||||
}
|
||||
Reference in New Issue
Block a user