Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

feat(control-ui): agent-centric access tabs with connectors column (D8)

Miguelon Peluchon80e3ad0edb76
diff --git a/control-ui/app/constants/createFlowLoading.ts b/control-ui/app/constants/createFlowLoading.ts
index a80fee81f..8016971e5 100644
--- a/control-ui/app/constants/createFlowLoading.ts
+++ b/control-ui/app/constants/createFlowLoading.ts
@@ -62,8 +62,8 @@ export const CREATE_FLOW_LOADING = {
title: 'Create team',
subtitle: 'Create a team now. You can assign a leader later.',
backLabel: 'Back to teams',
- steps: ['Team', 'Members', 'Access', 'Agents'],
- stepFlowClassName: 'cu-create-step-flow--4 cu-team-create-panel',
+ steps: ['Team', 'Members', 'Access'],
+ stepFlowClassName: 'cu-create-step-flow--3 cu-team-create-panel',
},
installRegistryEntry: {
iconKey: 'store',
diff --git a/control-ui/app/profile-admin/teams/[teamId]/[tab]/page.tsx b/control-ui/app/profile-admin/teams/[teamId]/[tab]/page.tsx
index cb4b8e95a..ac04ce05d 100644
--- a/control-ui/app/profile-admin/teams/[teamId]/[tab]/page.tsx
+++ b/control-ui/app/profile-admin/teams/[teamId]/[tab]/page.tsx
@@ -5,7 +5,7 @@ interface TeamTabPageProps {
params: Promise<{ tab: string }>
}
-const TEAM_DETAIL_TABS = ['members', 'access', 'agents']
+const TEAM_DETAIL_TABS = ['members', 'access']
export default async function TeamTabPage({ params }: TeamTabPageProps) {
const { tab } = await params
diff --git a/control-ui/app/profile-admin/teams/[teamId]/page.tsx b/control-ui/app/profile-admin/teams/[teamId]/page.tsx
index bc4ad045f..3150b27d2 100644
--- a/control-ui/app/profile-admin/teams/[teamId]/page.tsx
+++ b/control-ui/app/profile-admin/teams/[teamId]/page.tsx
@@ -11,6 +11,7 @@ import { useToast } from '@components/Toast'
import { CONTROL_ROUTES } from '@constants/routes'
import { partitionVisibleAccess } from '@lib/accessVisibility'
import { getAgentDisplayName } from '@lib/agentName'
+import { ConnectorCountCell } from '../../../../components/ConnectorCountCell'
import { InviteMemberDialog } from '../../../../components/InviteMemberDialog'
import { IconUsers } from '../../../../components/Sidebar/icons'
import { IconCheck, IconMoreHorizontal, IconPencil, IconX } from '../../../../components/icons'
@@ -44,13 +45,12 @@ import { formatTeamRole, permissionsForTeamRole } from '../../../../lib/teamRole
type Role = 'admin' | 'inviter' | 'member'
-type TeamTab = 'members' | 'access' | 'agents'
-const TEAM_TABS: TeamTab[] = ['members', 'access', 'agents']
+type TeamTab = 'members' | 'access'
+const TEAM_TABS: TeamTab[] = ['members', 'access']
const TEAM_TAB_LABELS: Record<TeamTab, string> = {
members: 'Members',
access: 'Access',
- agents: 'Agents',
}
function parseTeamTab(value: string | undefined): TeamTab {
@@ -176,7 +176,6 @@ export default function TeamDetailsPage() {
const [addMemberError, setAddMemberError] = useState('')
const [showAddContext, setShowAddContext] = useState(false)
- const [showAddAgent, setShowAddAgent] = useState(false)
const [availableContextIds, setAvailableContextIds] = useState<string[]>([])
const [assignedContextIds, setAssignedContextIds] = useState<string[]>([])
@@ -185,6 +184,7 @@ export default function TeamDetailsPage() {
const [hosts, setHosts] = useState<HostResource[]>([])
const [contextResources, setContextResources] = useState<ContextResource[]>([])
const [assignedAgentNames, setAssignedAgentNames] = useState<string[]>([])
+ const [deletedAgentNames, setDeletedAgentNames] = useState<string[]>([])
const [observedAgentNames, setObservedAgentNames] = useState<string[]>([])
const [selectedAgentNamesToAdd, setSelectedAgentNamesToAdd] = useState<string[]>([])
@@ -207,6 +207,53 @@ export default function TeamDetailsPage() {
// Rows are context IDs on the wire, but the user sees what that access
// means: the owning agent(s) for private scopes, the stored display name
// for anything else, and the raw id as a last-resort muted fallback.
+ // contextRef → attached connector names (per-agent Connectors column).
+ const contextsByRef = useMemo(() => {
+ const map: Record<string, string[]> = {}
+ for (const context of contextResources) {
+ const ref = String(context.spec?.contextId || context.metadata?.name || '').trim()
+ if (!ref) continue
+ map[ref] = Array.isArray(context.spec?.mcpServers) ? context.spec.mcpServers.map(String) : []
+ }
+ return map
+ }, [contextResources])
+
+ const hostsByName = useMemo(() => {
+ const map = new Map<string, HostResource>()
+ for (const host of hosts || []) {
+ const name = String(host.metadata?.name || '').trim()
+ if (name) map.set(name, host)
+ }
+ return map
+ }, [hosts])
+
+ // D8: granted set is agent-centric — direct team↔agent mapping unioned with
+ // agents resolved from legacy scope-only mappings.
+ const grantedAgentNames = useMemo(() => {
+ const granted = new Set(assignedAgentNames)
+ for (const contextId of assignedContextIds) {
+ for (const [name, host] of hostsByName) {
+ if (
+ String((host.spec as { contextRef?: string } | undefined)?.contextRef || '').trim() ===
+ contextId
+ ) {
+ granted.add(name)
+ }
+ }
+ }
+ return [...granted].sort((a, b) => a.localeCompare(b))
+ }, [assignedAgentNames, assignedContextIds, hostsByName])
+
+ const agentDisplay = (agentName: string): string => {
+ const host = hostsByName.get(agentName)
+ return String((host?.spec as { host?: string } | undefined)?.host || '').trim() || agentName
+ }
+
+ const agentContextRef = (agentName: string): string => {
+ const host = hostsByName.get(agentName)
+ return String((host?.spec as { contextRef?: string } | undefined)?.contextRef || '').trim()
+ }
+
const accessLabeler = useMemo(
() => accessScopeLabeler(contextResources, hosts || []),
[contextResources, hosts]
@@ -477,20 +524,58 @@ export default function TeamDetailsPage() {
}
}
- async function saveContexts(next: string[], message: string) {
+ // D8 composite write: the tab manages AGENTS; both legacy mappings stay in
+ // sync so whichever table the runtime enforces, the grant works.
+ async function saveAccess(nextGrantedAgents: string[], message: string) {
if (isNew) return
setBusy(true)
setError('')
try {
- const normalized = Array.from(new Set(next.map(v => v.trim()).filter(Boolean)))
- const updated = await updateAdminTeamContexts(teamId, normalized)
- const partition = partitionVisibleAccess(
- updated.contextIds || [],
+ const normalizedAgents = Array.from(
+ new Set(nextGrantedAgents.map(v => v.trim()).filter(Boolean))
+ ).sort((a, b) => a.localeCompare(b))
+
+ const nextRefs = new Set<string>()
+ for (const agentName of normalizedAgents) {
+ const ref = agentContextRef(agentName)
+ if (ref) nextRefs.add(ref)
+ }
+ const nextContextIds = availableContextIds.filter(contextId => {
+ const owned = [...hostsByName.values()].some(
+ host =>
+ String((host.spec as { contextRef?: string } | undefined)?.contextRef || '').trim() ===
+ contextId
+ )
+ return owned ? nextRefs.has(contextId) : true
+ })
+ for (const ref of nextRefs) {
+ if (!nextContextIds.includes(ref)) nextContextIds.push(ref)
+ }
+
+ const [updatedAgents, updatedContexts] = await Promise.all([
+ updateAdminTeamAgents(teamId, normalizedAgents, observedAgentNames),
+ updateAdminTeamContexts(
+ teamId,
+ nextContextIds.sort((a, b) => a.localeCompare(b))
+ ),
+ ])
+
+ const hostNames = [...hostsByName.keys()]
+ const agentPartition = partitionVisibleAccess(
+ updatedAgents.agentNames || [],
+ hostNames,
+ updatedAgents.deletedAgentNames || []
+ )
+ const contextPartition = partitionVisibleAccess(
+ updatedContexts.contextIds || [],
availableContextIds,
- updated.deletedContextIds || []
+ updatedContexts.deletedContextIds || []
)
- setAssignedContextIds(partition.active)
- setDeletedContextIds(partition.deleted)
+ setAssignedAgentNames(agentPartition.active)
+ setDeletedAgentNames(agentPartition.deleted)
+ setAssignedContextIds(contextPartition.active)
+ setDeletedContextIds(contextPartition.deleted)
+ setSelectedAgentNamesToAdd([])
setSelectedContextIdsToAdd([])
showToast(message, { tone: 'success' })
} catch (e) {
@@ -500,60 +585,22 @@ export default function TeamDetailsPage() {
}
}
- async function removeAccess(contextId: string) {
- const target = accessLabelFor(contextId).label
+ async function removeAccess(agentName: string) {
+ const target = agentDisplay(agentName)
const shouldRemove = await confirm({
title: 'Remove Access',
- message: `Remove ${teamName || 'this team'}'s access to ${target}?`,
+ message: `Remove ${teamName || 'this team'}'s access to ${target}? This revokes the agent and every connector it carries.`,
confirmLabel: 'Remove access',
tone: 'danger',
})
if (!shouldRemove) return
- await saveContexts(
- assignedContextIds.filter(id => id !== contextId),
+ await saveAccess(
+ grantedAgentNames.filter(name => name !== agentName),
'Team access updated.'
)
}
- async function saveAgents(next: string[], message: string) {
- if (isNew) return
- setBusy(true)
- setError('')
- try {
- const normalized = Array.from(new Set(next.map(v => v.trim()).filter(Boolean)))
- const updated = await updateAdminTeamAgents(teamId, normalized, observedAgentNames)
- const partition = partitionVisibleAccess(
- updated.agentNames || [],
- hostNameOptions,
- updated.deletedAgentNames || []
- )
- setAssignedAgentNames(partition.active)
- setObservedAgentNames([...(updated.agentNames || []), ...(updated.deletedAgentNames || [])])
- setSelectedAgentNamesToAdd([])
- showToast(message, { tone: 'success' })
- } catch (e) {
- setError(e instanceof Error ? e.message : 'Failed to update team agents')
- } finally {
- setBusy(false)
- }
- }
-
- async function revokeAgentAccess(agentName: string) {
- const shouldRevoke = await confirm({
- title: 'Revoke Agent Access',
- message: `Revoke ${teamName || 'this team'}'s access to ${agentName}?`,
- confirmLabel: 'Revoke',
- tone: 'danger',
- })
- if (!shouldRevoke) return
-
- await saveAgents(
- assignedAgentNames.filter(name => name !== agentName),
- 'Team agent access updated.'
- )
- }
-
async function deleteTeamPermanently() {
if (isNew) return
setDeletingTeam(true)
@@ -583,14 +630,6 @@ export default function TeamDetailsPage() {
})),
[existingMemberIds, users]
)
- const availableContextOptions = useMemo(
- () =>
- availableContextIds
- .filter(contextId => !assignedContextIds.includes(contextId))
- .map(contextId => ({ value: contextId, label: accessLabelFor(contextId).label })),
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [assignedContextIds, availableContextIds, contextResources, hosts]
- )
const availableAgentOptions = useMemo(
() =>
hostNameOptions
@@ -1000,7 +1039,7 @@ export default function TeamDetailsPage() {
}}
>
<p className="cu-muted" style={{ fontSize: '0.875rem', margin: 0 }}>
- Agents and connector scopes this team may access.
+ Agents this team may use — and the connectors each one carries.
</p>
<button
type="button"
@@ -1012,132 +1051,131 @@ export default function TeamDetailsPage() {
</button>
</div>
{initialLoading ? (
- <div role="list">
- {[1, 2, 3].map(i => (
- <div key={i} className="cu-skeleton--row">
- <div
- className="cu-skeleton cu-skeleton--cell"
- style={{ width: '12rem' }}
- ></div>
- <div
- className="cu-skeleton cu-skeleton--cell"
- style={{ width: '4rem' }}
- ></div>
- </div>
- ))}
+ <div className="cu-table-wrap">
+ <table className="cu-table">
+ <thead>
+ <tr>
+ <th>Access</th>
+ <th>Connectors</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {[1, 2, 3].map(i => (
+ <tr key={i}>
+ <td>
+ <div
+ className="cu-skeleton cu-skeleton--cell"
+ style={{ width: '12rem' }}
+ ></div>
+ </td>
+ <td></td>
+ <td></td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
</div>
- ) : assignedContextIds.length === 0 ? (
+ ) : grantedAgentNames.length === 0 ? (
<div className="cu-empty" style={{ padding: '0.5rem 0' }}>
No access assigned yet.
</div>
) : (
- <div role="list">
- {assignedContextIds.map(contextId => {
- const target = accessLabelFor(contextId)
- return (
- <div key={contextId} className="cu-access-row" role="listitem">
- <span className={target.resolved ? undefined : 'cu-muted'}>
- {target.label}
- </span>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--danger-icon"
- onClick={() => void removeAccess(contextId)}
- disabled={busy}
- title="Remove"
- aria-label="Remove access"
- >
- <IconX width={16} height={16} />
- </button>
- </div>
- )
- })}
+ <div className="cu-table-wrap">
+ <table className="cu-table">
+ <thead>
+ <tr>
+ <th>Access</th>
+ <th>Connectors</th>
+ <th></th>
+ </tr>
+ </thead>
+ <tbody>
+ {grantedAgentNames.map(agentName => (
+ <tr key={agentName}>
+ <td>
+ <button
+ type="button"
+ className="cu-link"
+ onClick={() =>
+ router.push(CONTROL_ROUTES.agents.detail(agentName))
+ }
+ >
+ {agentDisplay(agentName)}
+ </button>
+ </td>
+ <td>
+ <ConnectorCountCell
+ agentKey={`team-access-${agentName}`}
+ contextRef={agentContextRef(agentName)}
+ contextsByRef={contextsByRef}
+ onOpenConnectors={() =>
+ router.push(CONTROL_ROUTES.agents.tab(agentName, 'connectors'))
+ }
+ />
+ </td>
+ <td>
+ <div
+ style={{
+ display: 'flex',
+ gap: '0.35rem',
+ justifyContent: 'flex-end',
+ }}
+ >
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--danger-icon"
+ onClick={() => void removeAccess(agentName)}
+ disabled={busy}
+ title="Remove"
+ aria-label="Remove access"
+ >
+ <IconX width={16} height={16} />
+ </button>
+ </div>
+ </td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
</div>
)}
- {!initialLoading && deletedContextIds.length > 0 && (
+ {!initialLoading &&
+ (deletedAgentNames.length > 0 || deletedContextIds.length > 0) ? (
<>
<p className="cu-muted cu-deleted-access-heading">Removed access</p>
- <div role="list">
- {deletedContextIds.map(contextId => (
- <div key={contextId} className="cu-access-row" role="listitem">
- <span>{accessLabelFor(contextId).label}</span>
- <span className="cu-muted">Deleted</span>
- </div>
- ))}
+ <div className="cu-table-wrap">
+ <table className="cu-table">
+ <tbody>
+ {deletedAgentNames.map(agentName => (
+ <tr key={agentName}>
+ <td>{agentDisplay(agentName)}</td>
+ <td className="cu-muted">Deleted</td>
+ </tr>
+ ))}
+ {deletedContextIds
+ .filter(contextId => {
+ const owned = [...hostsByName.values()].some(
+ host =>
+ String(
+ (host.spec as { contextRef?: string } | undefined)
+ ?.contextRef || ''
+ ).trim() === contextId &&
+ grantedAgentNames.includes(String(host.metadata?.name ?? ''))
+ )
+ return !owned
+ })
+ .map(contextId => (
+ <tr key={contextId}>
+ <td className="cu-muted">{accessLabelFor(contextId).label}</td>
+ <td className="cu-muted">Deleted</td>
+ </tr>
+ ))}
+ </tbody>
+ </table>
</div>
</>
- )}
- </>
- )}
-
- {activeTab === 'agents' && (
- <>
- <div
- style={{
- display: 'flex',
- flexWrap: 'wrap',
- justifyContent: 'space-between',
- alignItems: 'center',
- gap: '0.5rem',
- marginBottom: '1rem',
- }}
- >
- <p className="cu-muted" style={{ fontSize: '0.875rem', margin: 0 }}>
- Agents this team may use.
- </p>
- <button
- type="button"
- className="cu-btn cu-btn--primary cu-btn--sm"
- onClick={() => setShowAddAgent(true)}
- disabled={busy}
- >
- Add agent
- </button>
- </div>
- {initialLoading ? (
- <div role="list">
- {[1, 2, 3].map(i => (
- <div key={i} className="cu-skeleton--row">
- <div
- className="cu-skeleton cu-skeleton--cell"
- style={{ width: '10rem' }}
- ></div>
- <div
- className="cu-skeleton cu-skeleton--cell"
- style={{ width: '4rem' }}
- ></div>
- </div>
- ))}
- </div>
- ) : assignedAgentNames.length === 0 ? (
- <div className="cu-empty" style={{ padding: '0.5rem 0' }}>
- No agent access yet.
- </div>
- ) : (
- <div role="list">
- {assignedAgentNames.map(agentName => (
- <div key={agentName} className="cu-access-row" role="listitem">
- <button
- type="button"
- className="cu-link"
- onClick={() => router.push(CONTROL_ROUTES.agents.detail(agentName))}
- >
- {agentName}
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--danger-icon"
- onClick={() => void revokeAgentAccess(agentName)}
- disabled={busy}
- title="Revoke"
- aria-label="Revoke agent"
- >
- <IconX width={16} height={16} />
- </button>
- </div>
- ))}
- </div>
- )}
+ ) : null}
</>
)}
</div>
@@ -1406,9 +1444,12 @@ export default function TeamDetailsPage() {
<SelectionDropdown
id="team-access-picker"
inline
- value={selectedContextIdsToAdd}
- onChange={setSelectedContextIdsToAdd}
- options={availableContextOptions}
+ value={selectedAgentNamesToAdd}
+ onChange={setSelectedAgentNamesToAdd}
+ options={[...hostsByName.keys()]
+ .filter(agentName => !grantedAgentNames.includes(agentName))
+ .sort((a, b) => agentDisplay(a).localeCompare(agentDisplay(b)))
+ .map(agentName => ({ value: agentName, label: agentDisplay(agentName) }))}
placeholder="Select access"
searchPlaceholder="Search access..."
selectionLabel="Selected access"
@@ -1430,168 +1471,15 @@ export default function TeamDetailsPage() {
type="button"
className="cu-btn cu-btn--primary"
onClick={() => {
- void saveContexts(
- [...assignedContextIds, ...selectedContextIdsToAdd],
+ void saveAccess(
+ [...grantedAgentNames, ...selectedAgentNamesToAdd],
'Team access updated.'
)
setShowAddContext(false)
}}
- disabled={busy || selectedContextIdsToAdd.length === 0}
- >
- Add access
- </button>
- </div>
- </div>
- </div>
- )}
-
- {showAddAgent && (
- <div
- style={{
- position: 'fixed',
- inset: 0,
- background: 'rgba(0, 0, 0, 0.6)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 1000,
- padding: '1rem',
- }}
- role="presentation"
- onClick={e => {
- if (e.target === e.currentTarget && !busy) setShowAddAgent(false)
- }}
- >
- <div
- className="cu-modal-panel cu-modal-panel--selection"
- role="dialog"
- aria-labelledby="add-agent-title"
- onClick={e => e.stopPropagation()}
- >
- <div className="cu-modal-panel__head">
- <strong id="add-agent-title" style={{ fontSize: '1rem', lineHeight: 1.35 }}>
- Add agent
- </strong>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--ghost"
- onClick={() => setShowAddAgent(false)}
- disabled={busy}
- aria-label="Close"
- >
- <IconX width={18} height={18} />
- </button>
- </div>
-
- <div className="cu-field">
- <label htmlFor="team-agent-picker">Agents</label>
- <SelectionDropdown
- id="team-agent-picker"
- inline
- value={selectedAgentNamesToAdd}
- onChange={setSelectedAgentNamesToAdd}
- options={availableAgentOptions}
- placeholder="Select agents"
- searchPlaceholder="Search agents..."
- selectionLabel="Selected agents"
- emptyLabel="No available agents."
- disabled={busy}
- />
- </div>
-
- <div className="cu-modal-panel__foot">
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => setShowAddAgent(false)}
- disabled={busy}
- >
- Cancel
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--primary"
- onClick={() => {
- void saveAgents(
- [...assignedAgentNames, ...selectedAgentNamesToAdd],
- selectedAgentNamesToAdd.length === 1
- ? 'Team agent access updated.'
- : 'Team agents access updated.'
- )
- setShowAddAgent(false)
- }}
disabled={busy || selectedAgentNamesToAdd.length === 0}
>
- {selectedAgentNamesToAdd.length > 1 ? 'Add agents' : 'Add agent'}
- </button>
- </div>
- </div>
- </div>
- )}
-
- {showDeleteTeamConfirm && (
- <div
- style={{
- position: 'fixed',
- inset: 0,
- background: 'rgba(0, 0, 0, 0.6)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 1000,
- padding: '1rem',
- }}
- role="presentation"
- onClick={e => {
- if (e.target === e.currentTarget && !deletingTeam) setShowDeleteTeamConfirm(false)
- }}
- >
- <div
- className="cu-modal-panel"
- style={{ width: 'min(28rem, 96vw)' }}
- role="alertdialog"
- aria-labelledby="confirm-delete-team"
- onClick={e => e.stopPropagation()}
- >
- <div className="cu-modal-panel__head">
- <strong id="confirm-delete-team" style={{ fontSize: '1rem', lineHeight: 1.35 }}>
- Delete team permanently?
- </strong>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--ghost"
- onClick={() => setShowDeleteTeamConfirm(false)}
- disabled={deletingTeam}
- aria-label="Close"
- >
- <IconX width={18} height={18} />
- </button>
- </div>
- <p className="cu-muted" style={{ fontSize: '0.875rem', margin: '0 0 1rem' }}>
- This removes <strong>{teamName || teamId}</strong> and cannot be undone.
- </p>
- {deleteTeamDialogError ? (
- <div className="cu-banner cu-banner--error" style={{ marginBottom: '0.75rem' }}>
- {deleteTeamDialogError}
- </div>
- ) : null}
- <div className="cu-modal-panel__foot">
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => setShowDeleteTeamConfirm(false)}
- disabled={deletingTeam}
- >
- Cancel
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--primary"
- style={{ background: 'var(--cu-danger)', borderColor: 'var(--cu-danger)' }}
- onClick={() => void deleteTeamPermanently()}
- disabled={deletingTeam}
- >
- {deletingTeam ? 'Deleting…' : 'Delete team'}
+ Add access
</button>
</div>
</div>
diff --git a/control-ui/app/profile-admin/teams/new/page.tsx b/control-ui/app/profile-admin/teams/new/page.tsx
index 9ff3acfb9..e4bd0a47e 100644
--- a/control-ui/app/profile-admin/teams/new/page.tsx
+++ b/control-ui/app/profile-admin/teams/new/page.tsx
@@ -28,9 +28,9 @@ import { permissionsForTeamRole, setDeletePermission, setInvitePermission } from
type Role = 'admin' | 'inviter' | 'member'
-type TeamCreateStep = 0 | 1 | 2 | 3
+type TeamCreateStep = 0 | 1 | 2
-const STEPS = ['Team', 'Members', 'Access', 'Agents'] as const
+const STEPS = ['Team', 'Members', 'Access'] as const
const STEP_DETAILS = [
{
@@ -46,12 +46,7 @@ const STEP_DETAILS = [
{
description: 'Map access',
title: 'Access',
- subtitle: 'Choose the agents and connector scopes this team can use.',
- },
- {
- description: 'Map agent access',
- title: 'Agents',
- subtitle: 'Select the agents this team can use.',
+ subtitle: 'Choose the agents this team can use — their connectors come along.',
},
] as const
@@ -231,12 +226,7 @@ export default function CreateTeamPage() {
return
}
if (step === 2) {
- setSelectedContextIds([])
- goNext()
- return
- }
- if (step === 3) {
- void handleCreateTeam({ agentNames: [] })
+ void handleCreateTeam({ agentNames: [], contextIds: [] })
}
}
@@ -258,8 +248,17 @@ export default function CreateTeamPage() {
createdTeamId = createdTeam.id
const teamId = createdTeamId
const selectedMemberRoles = overrides?.memberRoles ?? memberRoleDrafts
- const selectedContextValues = overrides?.contextIds ?? selectedContextIds
const selectedAgentValues = overrides?.agentNames ?? selectedAgentNames
+ // D8 composite: the wizard's Access step picks AGENTS; both mappings are
+ // written so scope-based and agent-based enforcement agree.
+ const agentRefs = selectedAgentValues
+ .map(agentName => hosts.find(host => host.metadata?.name === agentName))
+ .map(host =>
+ String((host?.spec as { contextRef?: string } | undefined)?.contextRef || '').trim()
+ )
+ .filter(Boolean)
+ const selectedContextValues = Array.from(new Set([...agentRefs]))
+ void selectedContextIds
await Promise.all(
Object.entries(selectedMemberRoles).map(([userId, role]) =>
@@ -438,18 +437,18 @@ export default function CreateTeamPage() {
{step === 2 ? (
<div className="cu-form-stack cu-agent-form-stack--wide">
{loadingReferenceData ? (
- <div className="cu-muted cu-muted-note--compact">Loading access...</div>
- ) : contextOptions.length > 0 ? (
+ <div className="cu-muted cu-muted-note--compact">Loading agents...</div>
+ ) : agentOptions.length > 0 ? (
<Field htmlFor="new-team-access-picker" label="Access">
<SelectionDropdown
id="new-team-access-picker"
- options={contextOptions}
- value={selectedContextIds}
- onChange={setSelectedContextIds}
+ options={agentOptions}
+ value={selectedAgentNames}
+ onChange={setSelectedAgentNames}
placeholder="Select access"
searchPlaceholder="Search access..."
selectionLabel="Selected access"
- emptyLabel="Nothing matches your search."
+ emptyLabel="No agents match your search."
disabled={saving}
showSelectedChips={false}
/>
@@ -462,31 +461,6 @@ export default function CreateTeamPage() {
</div>
) : null}
- {step === 3 ? (
- <div className="cu-form-stack cu-agent-form-stack--wide">
- {loadingReferenceData ? (
- <div className="cu-muted cu-muted-note--compact">Loading agents...</div>
- ) : agentOptions.length > 0 ? (
- <Field htmlFor="new-team-agent-picker" label="Agents">
- <SelectionDropdown
- id="new-team-agent-picker"
- options={agentOptions}
- value={selectedAgentNames}
- onChange={setSelectedAgentNames}
- placeholder="Select agents"
- searchPlaceholder="Search agents..."
- selectionLabel="Selected agents"
- emptyLabel="No agents match your search."
- disabled={saving}
- showSelectedChips={false}
- />
- </Field>
- ) : (
- <div className="cu-muted cu-muted-note--compact">No agents available.</div>
- )}
- </div>
- ) : null}
-
{error ? (
<div className="cu-banner cu-banner--error">
<span>{error}</span>
diff --git a/control-ui/app/profile-admin/users/[userId]/[tab]/page.tsx b/control-ui/app/profile-admin/users/[userId]/[tab]/page.tsx
index f51e7bf3f..c266dafe2 100644
--- a/control-ui/app/profile-admin/users/[userId]/[tab]/page.tsx
+++ b/control-ui/app/profile-admin/users/[userId]/[tab]/page.tsx
@@ -5,14 +5,7 @@ interface UserTabPageProps {
params: Promise<{ tab: string }>
}
-const USER_DETAIL_TABS = [
- 'contact',
- 'approval-dms',
- 'communication-channels',
- 'access',
- 'teams',
- 'agents',
-]
+const USER_DETAIL_TABS = ['contact', 'approval-dms', 'communication-channels', 'access', 'teams']
export default async function UserTabPage({ params }: UserTabPageProps) {
const { tab } = await params
diff --git a/control-ui/app/profile-admin/users/[userId]/page.tsx b/control-ui/app/profile-admin/users/[userId]/page.tsx
index 8b1fdab5d..2c374f9b8 100644
--- a/control-ui/app/profile-admin/users/[userId]/page.tsx
+++ b/control-ui/app/profile-admin/users/[userId]/page.tsx
@@ -15,6 +15,7 @@ import { partitionVisibleAccess } from '@lib/accessVisibility'
import { getAgentDisplayName } from '@lib/agentName'
import type { DeleteCandidateTeam } from '@lib/profileAdminDelete'
import { formatTeamNames, getSoloMemberTeamsForUser } from '@lib/profileAdminDelete'
+import { ConnectorCountCell } from '../../../../components/ConnectorCountCell'
import { IconUsers } from '../../../../components/Sidebar/icons'
import { UserApprovalMediumsPanel } from '../../../../components/UserApprovalMediumsPanel'
import { IconPencil, IconX } from '../../../../components/icons'
@@ -88,7 +89,6 @@ export default function UserDetailsPage() {
const [initialLoading, setInitialLoading] = useState(true)
const [editingContact, setEditingContact] = useState(false)
const [showAddContext, setShowAddContext] = useState(false)
- const [showAddAgent, setShowAddAgent] = useState(false)
const [showAddTeam, setShowAddTeam] = useState(false)
const [showDeleteUserConfirm, setShowDeleteUserConfirm] = useState(false)
@@ -115,6 +115,7 @@ export default function UserDetailsPage() {
const [selectedContextIdsToAdd, setSelectedContextIdsToAdd] = useState<string[]>([])
const [hosts, setHosts] = useState<HostResource[]>([])
const [assignedAgentNames, setAssignedAgentNames] = useState<string[]>([])
+ const [deletedAgentNames, setDeletedAgentNames] = useState<string[]>([])
const [observedAgentNames, setObservedAgentNames] = useState<string[]>([])
const [selectedAgentNamesToAdd, setSelectedAgentNamesToAdd] = useState<string[]>([])
const [communicationChannels, setCommunicationChannels] = useState<CommunicationChannelItem[]>([])
@@ -138,6 +139,55 @@ export default function UserDetailsPage() {
// Label resolution must be declared before its first consumer
// (`availableContextOptions` below) — accessing it earlier throws a TDZ
// ReferenceError that takes the whole member page down.
+ // contextRef → attached connector names (for the per-agent Connectors column,
+ // same design and hover logic as the Agents table).
+ const contextsByRef = useMemo(() => {
+ const map: Record<string, string[]> = {}
+ for (const context of contextResources) {
+ const ref = String(context.spec?.contextId || context.metadata?.name || '').trim()
+ if (!ref) continue
+ map[ref] = Array.isArray(context.spec?.mcpServers) ? context.spec.mcpServers.map(String) : []
+ }
+ return map
+ }, [contextResources])
+
+ const hostsByName = useMemo(() => {
+ const map = new Map<string, HostResource>()
+ for (const host of hosts || []) {
+ const name = String(host.metadata?.name || '').trim()
+ if (name) map.set(name, host)
+ }
+ return map
+ }, [hosts])
+
+ // The granted set is agent-centric (D8): the direct member↔agent mapping,
+ // unioned with agents resolved from legacy scope-only mappings so nothing
+ // granted before this change disappears.
+ const grantedAgentNames = useMemo(() => {
+ const granted = new Set(assignedAgentNames)
+ for (const contextId of assignedContextIds) {
+ for (const [name, host] of hostsByName) {
+ if (
+ String((host.spec as { contextRef?: string } | undefined)?.contextRef || '').trim() ===
+ contextId
+ ) {
+ granted.add(name)
+ }
+ }
+ }
+ return [...granted].sort((a, b) => a.localeCompare(b))
+ }, [assignedAgentNames, assignedContextIds, hostsByName])
+
+ const agentDisplay = (agentName: string): string => {
+ const host = hostsByName.get(agentName)
+ return String((host?.spec as { host?: string } | undefined)?.host || '').trim() || agentName
+ }
+
+ const agentContextRef = (agentName: string): string => {
+ const host = hostsByName.get(agentName)
+ return String((host?.spec as { contextRef?: string } | undefined)?.contextRef || '').trim()
+ }
+
const accessLabeler = useMemo(
() => accessScopeLabeler(contextResources, hosts || []),
[contextResources, hosts]
@@ -152,14 +202,6 @@ export default function UserDetailsPage() {
).sort((a, b) => a.localeCompare(b)),
[hosts]
)
- const availableContextOptions = useMemo(
- () =>
- availableContextIds
- .filter(contextId => !assignedContextIds.includes(contextId))
- .map(contextId => ({ value: contextId, label: accessLabelFor(contextId).label })),
- // eslint-disable-next-line react-hooks/exhaustive-deps
- [assignedContextIds, availableContextIds, contextResources, hosts]
- )
const availableTeamOptions = useMemo(
() =>
allTeams
@@ -286,6 +328,7 @@ export default function UserDetailsPage() {
setUserTeams(Array.isArray(userTeamsData.items) ? userTeamsData.items : [])
setHosts(Array.isArray(hostsData.items) ? hostsData.items : [])
setAssignedAgentNames(agentPartition.active)
+ setDeletedAgentNames(agentPartition.deleted)
setObservedAgentNames([
...(userAgentAccess.agentNames || []),
...(userAgentAccess.deletedAgentNames || []),
@@ -347,44 +390,6 @@ export default function UserDetailsPage() {
}
}
- async function saveContexts(next: string[], message: string) {
- setBusy(true)
- setError('')
- try {
- const normalized = Array.from(new Set(next.map(v => v.trim()).filter(Boolean)))
- const updated = await updateAdminUserContexts(userId, normalized)
- const partition = partitionVisibleAccess(
- updated.contextIds || [],
- availableContextIds,
- updated.deletedContextIds || []
- )
- setAssignedContextIds(partition.active)
- setDeletedContextIds(partition.deleted)
- setSelectedContextIdsToAdd([])
- showToast(message, { tone: 'success' })
- } catch (e) {
- setError(e instanceof Error ? e.message : 'Failed to update member access')
- } finally {
- setBusy(false)
- }
- }
-
- async function removeAccess(contextId: string) {
- const target = accessLabelFor(contextId).label
- const shouldRemove = await confirm({
- title: 'Remove Access',
- message: `Remove ${userName || emailDraft || 'this member'}'s access to ${target}?`,
- confirmLabel: 'Remove access',
- tone: 'danger',
- })
- if (!shouldRemove) return
-
- await saveContexts(
- assignedContextIds.filter(id => id !== contextId),
- 'Access updated.'
- )
- }
-
async function addUserToTeams() {
if (selectedTeamIdsToAdd.length === 0) return
setBusy(true)
@@ -445,40 +450,86 @@ export default function UserDetailsPage() {
}
}
- async function saveAgents(next: string[], message: string) {
+ // D8 composite write: the tab manages AGENTS. Under the hood both legacy
+ // mappings stay in sync — the member↔agent mapping AND the member↔scope
+ // mapping — so whichever table the runtime enforces, the grant works.
+ async function saveAccess(nextGrantedAgents: string[], message: string) {
setBusy(true)
setError('')
try {
- const normalized = Array.from(new Set(next.map(v => v.trim()).filter(Boolean)))
- const updated = await updateAdminUserAgents(userId, normalized, observedAgentNames)
- const partition = partitionVisibleAccess(
- updated.agentNames || [],
- hostNameOptions,
- updated.deletedAgentNames || []
+ const normalizedAgents = Array.from(
+ new Set(nextGrantedAgents.map(v => v.trim()).filter(Boolean))
+ ).sort((a, b) => a.localeCompare(b))
+
+ // Scopes: keep legacy ids that map to no known agent; add the scopes of
+ // newly granted agents; drop the scopes of revoked agents unless
+ // another still-granted agent shares them.
+ const nextRefs = new Set<string>()
+ for (const agentName of normalizedAgents) {
+ const ref = agentContextRef(agentName)
+ if (ref) nextRefs.add(ref)
+ }
+ const nextContextIds = availableContextIds.filter(contextId => {
+ const owner = [...hostsByName.values()].some(
+ host =>
+ String((host.spec as { contextRef?: string } | undefined)?.contextRef || '').trim() ===
+ contextId
+ )
+ // Keep legacy scope-only mappings untouched; managed ones follow the
+ // agent grant state.
+ return owner ? nextRefs.has(contextId) : true
+ })
+ for (const ref of nextRefs) {
+ if (!nextContextIds.includes(ref)) nextContextIds.push(ref)
+ }
+
+ const [updatedAgents, updatedContexts] = await Promise.all([
+ updateAdminUserAgents(userId, normalizedAgents, observedAgentNames),
+ updateAdminUserContexts(
+ userId,
+ nextContextIds.sort((a, b) => a.localeCompare(b))
+ ),
+ ])
+
+ const hostNames = [...hostsByName.keys()]
+ const agentPartition = partitionVisibleAccess(
+ Array.isArray(updatedAgents.agentNames) ? updatedAgents.agentNames : [],
+ hostNames,
+ Array.isArray(updatedAgents.deletedAgentNames) ? updatedAgents.deletedAgentNames : []
+ )
+ const contextPartition = partitionVisibleAccess(
+ Array.isArray(updatedContexts.contextIds) ? updatedContexts.contextIds : [],
+ availableContextIds,
+ Array.isArray(updatedContexts.deletedContextIds) ? updatedContexts.deletedContextIds : []
)
- setAssignedAgentNames(partition.active)
- setObservedAgentNames([...(updated.agentNames || []), ...(updated.deletedAgentNames || [])])
+ setAssignedAgentNames(agentPartition.active)
+ setDeletedAgentNames(agentPartition.deleted)
+ setDeletedAgentNames(agentPartition.deleted)
+ setAssignedContextIds(contextPartition.active)
+ setDeletedContextIds(contextPartition.deleted)
setSelectedAgentNamesToAdd([])
+ setSelectedContextIdsToAdd([])
showToast(message, { tone: 'success' })
} catch (e) {
- setError(e instanceof Error ? e.message : 'Failed to update member agent access')
+ setError(e instanceof Error ? e.message : 'Failed to update member access')
} finally {
setBusy(false)
}
}
- async function revokeAgentAccess(agentName: string) {
- const shouldRevoke = await confirm({
- title: 'Revoke Agent Access',
- message: `Revoke ${userName || emailDraft || 'this member'}'s access to ${agentName}?`,
- confirmLabel: 'Revoke',
+ async function removeAccess(agentName: string) {
+ const target = agentDisplay(agentName)
+ const shouldRemove = await confirm({
+ title: 'Remove Access',
+ message: `Remove ${userName || emailDraft || 'this member'}'s access to ${target}? This revokes the agent and every connector it carries.`,
+ confirmLabel: 'Remove access',
tone: 'danger',
})
- if (!shouldRevoke) return
+ if (!shouldRemove) return
- await saveAgents(
- assignedAgentNames.filter(name => name !== agentName),
- 'Agent access updated.'
+ await saveAccess(
+ grantedAgentNames.filter(name => name !== agentName),
+ 'Access updated.'
)
}
@@ -957,7 +1008,7 @@ export default function UserDetailsPage() {
}}
>
<p className="cu-muted" style={{ fontSize: '0.875rem', margin: 0 }}>
- Agents and connector scopes this member may access.
+ Agents this member may use — and the connectors each one carries.
</p>
<button
type="button"
@@ -974,6 +1025,7 @@ export default function UserDetailsPage() {
<thead>
<tr>
<th>Access</th>
+ <th>Connectors</th>
<th></th>
</tr>
</thead>
@@ -987,12 +1039,13 @@ export default function UserDetailsPage() {
></div>
</td>
<td></td>
+ <td></td>
</tr>
))}
</tbody>
</table>
</div>
- ) : assignedContextIds.length === 0 ? (
+ ) : grantedAgentNames.length === 0 ? (
<div className="cu-empty" style={{ padding: '0.5rem 0' }}>
No access assigned yet.
</div>
@@ -1002,63 +1055,94 @@ export default function UserDetailsPage() {
<thead>
<tr>
<th>Access</th>
+ <th>Connectors</th>
<th></th>
</tr>
</thead>
<tbody>
- {assignedContextIds.map(contextId => {
- const target = accessLabelFor(contextId)
- return (
- <tr key={contextId}>
- <td>
- <span className={target.resolved ? undefined : 'cu-muted'}>
- {target.label}
- </span>
- </td>
- <td>
- <div
- style={{
- display: 'flex',
- gap: '0.35rem',
- justifyContent: 'flex-end',
- }}
+ {grantedAgentNames.map(agentName => (
+ <tr key={agentName}>
+ <td>
+ <button
+ type="button"
+ className="cu-link"
+ onClick={() => router.push(CONTROL_ROUTES.agents.detail(agentName))}
+ >
+ {agentDisplay(agentName)}
+ </button>
+ </td>
+ <td>
+ <ConnectorCountCell
+ agentKey={`user-access-${agentName}`}
+ contextRef={agentContextRef(agentName)}
+ contextsByRef={contextsByRef}
+ onOpenConnectors={() =>
+ router.push(CONTROL_ROUTES.agents.tab(agentName, 'connectors'))
+ }
+ />
+ </td>
+ <td>
+ <div
+ style={{
+ display: 'flex',
+ gap: '0.35rem',
+ justifyContent: 'flex-end',
+ }}
+ >
+ <button
+ type="button"
+ className="cu-btn cu-btn--icon cu-btn--danger-icon"
+ onClick={() => void removeAccess(agentName)}
+ disabled={busy}
+ title="Remove"
+ aria-label="Remove access"
>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--danger-icon"
- onClick={() => void removeAccess(contextId)}
- disabled={busy}
- title="Remove"
- aria-label="Remove access"
- >
- <IconX width={16} height={16} />
- </button>
- </div>
- </td>
- </tr>
- )
- })}
+ <IconX width={16} height={16} />
+ </button>
+ </div>
+ </td>
+ </tr>
+ ))}
</tbody>
</table>
</div>
)}
- {!initialLoading && deletedContextIds.length > 0 && (
+ {!initialLoading && (deletedAgentNames.length > 0 || deletedContextIds.length > 0) ? (
<>
<p className="cu-muted cu-deleted-access-heading">Removed access</p>
<div className="cu-table-wrap">
<table className="cu-table">
<tbody>
- {deletedContextIds.map(contextId => (
- <tr key={contextId}>
- <td>{accessLabelFor(contextId).label}</td>
+ {deletedAgentNames.map(agentName => (
+ <tr key={agentName}>
+ <td>{agentDisplay(agentName)}</td>
<td className="cu-muted">Deleted</td>
</tr>
))}
+ {deletedContextIds
+ .filter(contextId => {
+ // Scope tombstones that a still-listed agent owns are
+ // represented by the agent row above instead.
+ const owned = [...hostsByName.values()].some(
+ host =>
+ String(
+ (host.spec as { contextRef?: string } | undefined)?.contextRef || ''
+ ).trim() === contextId &&
+ grantedAgentNames.includes(String(host.metadata?.name ?? ''))
+ )
+ return !owned
+ })
+ .map(contextId => (
+ <tr key={contextId}>
+ <td className="cu-muted">{accessLabelFor(contextId).label}</td>
+ <td className="cu-muted">Deleted</td>
+ </tr>
+ ))}
</tbody>
</table>
</div>
</>
- )}
+ ) : null}
</>
)}
@@ -1226,108 +1310,6 @@ export default function UserDetailsPage() {
</>
)}
- {activeTab === 'agents' && (
- <>
- <div
- style={{
- display: 'flex',
- flexWrap: 'wrap',
- justifyContent: 'space-between',
- alignItems: 'center',
- gap: '0.5rem',
- marginBottom: '1rem',
- }}
- >
- <p className="cu-muted" style={{ fontSize: '0.875rem', margin: 0 }}>
- Agents this member may use.
- </p>
- <button
- type="button"
- className="cu-btn cu-btn--primary cu-btn--sm"
- onClick={() => setShowAddAgent(true)}
- disabled={busy}
- >
- Grant agent
- </button>
- </div>
- {initialLoading ? (
- <div className="cu-table-wrap">
- <table className="cu-table">
- <thead>
- <tr>
- <th>Agent</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {[1, 2, 3].map(i => (
- <tr key={i}>
- <td>
- <div
- className="cu-skeleton cu-skeleton--cell"
- style={{ width: '10rem' }}
- ></div>
- </td>
- <td></td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
- ) : assignedAgentNames.length === 0 ? (
- <div className="cu-empty" style={{ padding: '0.5rem 0' }}>
- No agent access yet.
- </div>
- ) : (
- <div className="cu-table-wrap">
- <table className="cu-table">
- <thead>
- <tr>
- <th>Agent</th>
- <th></th>
- </tr>
- </thead>
- <tbody>
- {assignedAgentNames.map(agentName => (
- <tr key={agentName}>
- <td>
- <button
- type="button"
- className="cu-link"
- onClick={() => router.push(CONTROL_ROUTES.agents.detail(agentName))}
- >
- {agentName}
- </button>
- </td>
- <td>
- <div
- style={{
- display: 'flex',
- gap: '0.35rem',
- justifyContent: 'flex-end',
- }}
- >
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--danger-icon"
- onClick={() => void revokeAgentAccess(agentName)}
- disabled={busy}
- title="Revoke"
- aria-label="Revoke agent"
- >
- <IconX width={16} height={16} />
- </button>
- </div>
- </td>
- </tr>
- ))}
- </tbody>
- </table>
- </div>
- )}
- </>
- )}
-
{roleEditTeam ? (
<div
className="cu-modal-backdrop"
@@ -1434,9 +1416,12 @@ export default function UserDetailsPage() {
<SelectionDropdown
id="member-access-picker"
inline
- value={selectedContextIdsToAdd}
- onChange={setSelectedContextIdsToAdd}
- options={availableContextOptions}
+ value={selectedAgentNamesToAdd}
+ onChange={setSelectedAgentNamesToAdd}
+ options={[...hostsByName.keys()]
+ .filter(agentName => !grantedAgentNames.includes(agentName))
+ .sort((a, b) => agentDisplay(a).localeCompare(agentDisplay(b)))
+ .map(agentName => ({ value: agentName, label: agentDisplay(agentName) }))}
placeholder="Select access"
searchPlaceholder="Search access..."
selectionLabel="Selected access"
@@ -1458,13 +1443,13 @@ export default function UserDetailsPage() {
type="button"
className="cu-btn cu-btn--primary"
onClick={() => {
- void saveContexts(
- [...assignedContextIds, ...selectedContextIdsToAdd],
+ void saveAccess(
+ [...grantedAgentNames, ...selectedAgentNamesToAdd],
'Access updated.'
)
setShowAddContext(false)
}}
- disabled={busy || selectedContextIdsToAdd.length === 0}
+ disabled={busy || selectedAgentNamesToAdd.length === 0}
>
Add access
</button>
@@ -1565,90 +1550,6 @@ export default function UserDetailsPage() {
</div>
)}
- {showAddAgent && (
- <div
- style={{
- position: 'fixed',
- inset: 0,
- background: 'rgba(0, 0, 0, 0.6)',
- display: 'flex',
- alignItems: 'center',
- justifyContent: 'center',
- zIndex: 1000,
- padding: '1rem',
- }}
- role="presentation"
- onClick={e => {
- if (e.target === e.currentTarget && !busy) setShowAddAgent(false)
- }}
- >
- <div
- className="cu-modal-panel cu-modal-panel--selection"
- role="dialog"
- aria-labelledby="add-agent-title"
- onClick={e => e.stopPropagation()}
- >
- <div className="cu-modal-panel__head">
- <strong id="add-agent-title" style={{ fontSize: '1rem', lineHeight: 1.35 }}>
- Grant agent
- </strong>
- <button
- type="button"
- className="cu-btn cu-btn--icon cu-btn--ghost"
- onClick={() => setShowAddAgent(false)}
- disabled={busy}
- aria-label="Close"
- >
- <IconX width={18} height={18} />
- </button>
- </div>
-
- <div className="cu-field">
- <label htmlFor="member-agent-picker">Agents</label>
- <SelectionDropdown
- id="member-agent-picker"
- inline
- value={selectedAgentNamesToAdd}
- onChange={setSelectedAgentNamesToAdd}
- options={availableAgentOptions}
- placeholder="Select agents"
- searchPlaceholder="Search agents..."
- selectionLabel="Selected agents"
- emptyLabel="No available agents."
- disabled={busy}
- />
- </div>
-
- <div className="cu-modal-panel__foot">
- <button
- type="button"
- className="cu-btn cu-btn--ghost cu-btn--sm"
- onClick={() => setShowAddAgent(false)}
- disabled={busy}
- >
- Cancel
- </button>
- <button
- type="button"
- className="cu-btn cu-btn--primary"
- onClick={() => {
- void saveAgents(
- [...assignedAgentNames, ...selectedAgentNamesToAdd],
- selectedAgentNamesToAdd.length === 1
- ? 'Agent access updated.'
- : 'Agents access updated.'
- )
- setShowAddAgent(false)
- }}
- disabled={busy || selectedAgentNamesToAdd.length === 0}
- >
- {selectedAgentNamesToAdd.length > 1 ? 'Grant agents' : 'Grant agent'}
- </button>
- </div>
- </div>
- </div>
- )}
-
{showDeleteUserConfirm && (
<div
style={{
diff --git a/control-ui/components/ConnectorCountCell.tsx b/control-ui/components/ConnectorCountCell.tsx
new file mode 100644
index 000000000..f6e330c3d
--- /dev/null
+++ b/control-ui/components/ConnectorCountCell.tsx
@@ -0,0 +1,97 @@
+'use client'
+
+import React, { useState } from 'react'
+
+// Hover card over an agent's connectors count. The agent's private connector
+// context is an implementation detail, so the card shows a neutral
+// "Connectors" heading plus the attached MCP-server names — never the context
+// slug. The card is keyboard-accessible (focus + blur mirror hover) and
+// `role="tooltip"` keeps screen readers in sync with what's visible. Clicking
+// opens the agent's own Connectors tab. Shared by the Agents table and the
+// Users & Teams Access rows so both render identically.
+export function ConnectorCountHoverCard({
+ hostKey,
+ servers,
+ onOpenConnectors,
+}: {
+ hostKey: string
+ servers: string[]
+ onOpenConnectors: () => void
+}) {
+ const [open, setOpen] = useState(false)
+ const hasServers = servers.length > 0
+ const cardId = `agent-connectors-${hostKey}`
+
+ const trigger = (
+ <button
+ type="button"
+ className="cu-link cu-host-connectors-count"
+ onClick={e => {
+ e.stopPropagation()
+ onOpenConnectors()
+ }}
+ onKeyDown={e => e.stopPropagation()}
+ aria-describedby={hasServers && open ? cardId : undefined}
+ >
+ {servers.length}
+ </button>
+ )
+
+ if (!hasServers) return trigger
+
+ return (
+ <span
+ className="cu-host-connectors-hover"
+ onMouseEnter={() => setOpen(true)}
+ onMouseLeave={() => setOpen(false)}
+ onFocus={() => setOpen(true)}
+ onBlur={() => setOpen(false)}
+ >
+ {trigger}
+ {open ? (
+ <div role="tooltip" id={cardId} className="cu-agent-connectors-summary">
+ <div className="cu-agent-connectors-summary__head">
+ <span>Connectors</span>
+ <span>{servers.length}</span>
+ </div>
+ <ul className="cu-agent-connectors-summary__list">
+ {servers.map(server => (
+ <li key={server} title={server}>
+ {server}
+ </li>
+ ))}
+ </ul>
+ </div>
+ ) : null}
+ </span>
+ )
+}
+
+// Full cell for an agent row: count pill (or muted placeholders when the
+// enrichment map lacks the agent's scope), hover card, and click-through.
+export function ConnectorCountCell({
+ agentKey,
+ contextRef,
+ contextsByRef,
+ onOpenConnectors,
+}: {
+ agentKey: string
+ contextRef: string
+ contextsByRef: Record<string, string[]>
+ onOpenConnectors: () => void
+}) {
+ const servers = contextRef ? contextsByRef[contextRef] : undefined
+ if (!contextRef) {
+ return <span className="cu-table__cell-muted">—</span>
+ }
+ if (!Array.isArray(servers) || servers.length === 0) {
+ return <span className="cu-table__cell-muted">0</span>
+ }
+ return (
+ <ConnectorCountHoverCard
+ hostKey={agentKey}
+ servers={servers}
+ onOpenConnectors={onOpenConnectors}
+ />
+ )
+}
diff --git a/control-ui/components/HostTable.tsx b/control-ui/components/HostTable.tsx
index d0730fadb..0d85cb9ea 100644
--- a/control-ui/components/HostTable.tsx
+++ b/control-ui/components/HostTable.tsx
@@ -2,6 +2,7 @@
import React, { useMemo, useState } from 'react'
import { getProviderLabel } from '../lib/llm'
+import { ConnectorCountHoverCard } from './ConnectorCountCell'
import type { HostItem, HostRef } from './HostTable.types'
import { LlmProviderIcon } from './LlmProviderIcon'
import { RowActionsMenu } from './RowActionsMenu'
@@ -41,69 +42,6 @@ export function collectProviderIds(spec: Record<string, unknown>): string[] {
return out
}
-// Hover card over the connectors cell. The agent's private connector context
-// is an implementation detail, so the card shows a neutral "Connectors"
-// heading plus the attached MCP-server names — never the context slug. The
-// card is keyboard-accessible (focus + blur mirror hover) and `role="tooltip"`
-// keeps screen readers in sync with what's visible.
-function ConnectorCountHoverCard({
- hostKey,
- servers,
- onOpenConnectors,
-}: {
- hostKey: string
- servers: string[]
- onOpenConnectors: () => void
-}) {
- const [open, setOpen] = useState(false)
- const hasServers = servers.length > 0
- const cardId = `agent-connectors-${hostKey}`
-
- const trigger = (
- <button
- type="button"
- className="cu-link cu-host-connectors-count"
- onClick={e => {
- e.stopPropagation()
- onOpenConnectors()
- }}
- onKeyDown={e => e.stopPropagation()}
- aria-describedby={hasServers && open ? cardId : undefined}
- >
- {servers.length}
- </button>
- )
-
- if (!hasServers) return trigger
-
- return (
- <span
- className="cu-host-connectors-hover"
- onMouseEnter={() => setOpen(true)}
- onMouseLeave={() => setOpen(false)}
- onFocus={() => setOpen(true)}
- onBlur={() => setOpen(false)}
- >
- {trigger}
- {open ? (
- <div role="tooltip" id={cardId} className="cu-agent-connectors-summary">
- <div className="cu-agent-connectors-summary__head">
- <span>Connectors</span>
- <span>{servers.length}</span>
- </div>
- <ul className="cu-agent-connectors-summary__list">
- {servers.map(server => (
- <li key={server} title={server}>
- {server}
- </li>
- ))}
- </ul>
- </div>
- ) : null}
- </span>
- )
-}
-
export function HostTable({
items,
onOpen,
diff --git a/control-ui/e2e/qa-recorder-member-access-multi.spec.ts b/control-ui/e2e/qa-recorder-member-access-multi.spec.ts
index 9a30a6526..5018b4602 100644
--- a/control-ui/e2e/qa-recorder-member-access-multi.spec.ts
+++ b/control-ui/e2e/qa-recorder-member-access-multi.spec.ts
@@ -1,13 +1,15 @@
// control-ui/e2e/qa-recorder-member-access-multi.spec.ts
//
// Optional QA recorder journey (MUTATING). Requires QA_RECORDER_CONFIRM_MUTATIONS=1.
-// Records the member detail Access tab multi-select add flow: two host-backed
-// scopes are seeded out-of-band (one context + one host each), then the
-// "Add access" picker selects BOTH agent display names at once and submits —
-// toast "Access updated." — and both rows render with the agent display names
-// (never the raw contextIds). Each row is then removed through its confirm
-// dialog. The member's original contextIds are restored and the seeded hosts
-// + contexts are deleted in the finally (hosts before contexts).
+// Records the member detail Access tab multi-select add flow (D8): two
+// host-backed scopes are seeded out-of-band (one context + one host each),
+// then the "Add access" picker — options are AGENT display names — selects
+// BOTH at once and submits — toast "Access updated." — and both rows render
+// in the Access/Connectors table with the agent display names (never the raw
+// contextIds). Each row is then removed through its confirm dialog. The tab's
+// writes are D8 composite writes (agents AND contexts mappings), so the
+// member's original contextIds AND agentNames are restored and the seeded
+// hosts + contexts are deleted in the finally (hosts before contexts).
//
// Contract: docs/testing/optional-playwright-qa-recorder.md ("Extending the
// recorder").
@@ -47,6 +49,7 @@ test.describe('optional QA recorder: Control UI member Access multi-select', ()
const hostDisplayB = uniqueE2EName('qa-recorder-mam-agent-b')
let userId = ''
let originalContextIds: string[] | null = null
+ let originalAgentNames: string[] | null = null
try {
await loginThroughUi(page, credentials)
@@ -81,11 +84,14 @@ test.describe('optional QA recorder: Control UI member Access multi-select', ()
timeout: 20_000,
})
await expect(
- page.getByText('Agents and connector scopes this member may access.', { exact: true })
+ page.getByText('Agents this member may use — and the connectors each one carries.', {
+ exact: true,
+ })
).toBeVisible({ timeout: 20_000 })
await screenshotAndLog(page, testInfo, `${journey}-tab`)
- // Remember the member's original contextIds before any mutation.
+ // Remember the member's original contextIds and agentNames before any
+ // mutation — the tab's writes are D8 composite writes.
const originalRes = await api<{ contextIds?: string[] }>(
page.request,
'GET',
@@ -97,6 +103,17 @@ test.describe('optional QA recorder: Control UI member Access multi-select', ()
).toBeLessThan(300)
originalContextIds = originalRes.data.contextIds ?? []
+ const originalAgentsRes = await api<{ agentNames?: string[] }>(
+ page.request,
+ 'GET',
+ `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`
+ )
+ expect(
+ originalAgentsRes.status,
+ `get user agents: ${JSON.stringify(originalAgentsRes.data)}`
+ ).toBeLessThan(300)
+ originalAgentNames = originalAgentsRes.data.agentNames ?? []
+
// Seed two host-backed scopes out-of-band; the behavior under test is
// the picker granting BOTH in a single submit.
for (const [contextName, contextId, hostName, hostDisplay] of [
@@ -125,17 +142,20 @@ test.describe('optional QA recorder: Control UI member Access multi-select', ()
expect(hostRes.status, `create host: ${JSON.stringify(hostRes.data)}`).toBeLessThan(300)
}
- // Reload the tab so the picker offers the freshly seeded scopes, then
+ // Reload the tab so the picker offers the freshly seeded agents, then
// select BOTH agent display names at once and submit.
await page.reload()
await expect(
- page.getByText('Agents and connector scopes this member may access.', { exact: true })
+ page.getByText('Agents this member may use — and the connectors each one carries.', {
+ exact: true,
+ })
).toBeVisible({ timeout: 20_000 })
await page.getByRole('button', { name: 'Add access', exact: true }).click()
const dialog = page.getByRole('dialog', { name: 'Add access' })
await expect(dialog).toBeVisible()
await expect(dialog.getByLabel('Access')).toBeVisible()
+ await expect(dialog.locator('#member-access-picker')).toBeVisible()
const optionA = dialog.getByRole('option', { name: hostDisplayA, exact: true })
const optionB = dialog.getByRole('option', { name: hostDisplayB, exact: true })
await expect(optionA).toBeVisible({ timeout: 20_000 })
@@ -147,13 +167,18 @@ test.describe('optional QA recorder: Control UI member Access multi-select', ()
await screenshotAndLog(page, testInfo, `${journey}-add-modal`)
await dialog.getByRole('button', { name: 'Add access', exact: true }).click()
- // One toast, both rows — each labelled with its agent display name,
- // never the raw wire contextId.
+ // One toast, both rows — D8 renders one table row per granted agent,
+ // each labelled with its agent display name, never the raw wire
+ // contextId.
await expect(
page.getByRole('status').filter({ hasText: 'Access updated.' }).first()
).toBeVisible({
timeout: 20_000,
})
+ await expect(page.getByRole('columnheader', { name: 'Access', exact: true })).toBeVisible()
+ await expect(
+ page.getByRole('columnheader', { name: 'Connectors', exact: true })
+ ).toBeVisible()
const rowA = page
.getByRole('row')
.filter({ has: page.getByRole('cell', { name: hostDisplayA, exact: true }) })
@@ -189,6 +214,29 @@ test.describe('optional QA recorder: Control UI member Access multi-select', ()
{ contextIds: originalContextIds }
)
}
+ // D8 composite write: the picker submit and removals also rewrote the
+ // member↔agent mapping, so restore the original agentNames too (PUT is
+ // compare-and-swap: echo the full set we currently observe).
+ if (userId && originalAgentNames !== null) {
+ const currentAgentsRes = await api<{
+ agentNames?: string[]
+ deletedAgentNames?: string[]
+ }>(page.request, 'GET', `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`)
+ if (currentAgentsRes.status < 300) {
+ await api(
+ page.request,
+ 'PUT',
+ `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`,
+ {
+ agentNames: originalAgentNames,
+ expectedCurrentAgentNames: [
+ ...(currentAgentsRes.data.agentNames ?? []),
+ ...(currentAgentsRes.data.deletedAgentNames ?? []),
+ ],
+ }
+ )
+ }
+ }
await api(page.request, 'DELETE', `/api/v1/admin/hosts/${encodeURIComponent(hostNameA)}`)
await api(page.request, 'DELETE', `/api/v1/admin/hosts/${encodeURIComponent(hostNameB)}`)
await api(
diff --git a/control-ui/e2e/qa-recorder-member-access.spec.ts b/control-ui/e2e/qa-recorder-member-access.spec.ts
index 493c465fb..ac4e91cbc 100644
--- a/control-ui/e2e/qa-recorder-member-access.spec.ts
+++ b/control-ui/e2e/qa-recorder-member-access.spec.ts
@@ -3,12 +3,15 @@
// Optional QA recorder journey (MUTATING). Requires QA_RECORDER_CONFIRM_MUTATIONS=1.
// Records the E6 "Access" rename evidence in Users & Teams — the Teams table
// 'Access' column header (no 'Contexts' header on either table) — then the
-// member detail Access tab: a Control-API-seeded scope granted via PUT
-// /users/<id>/contexts is shown by its agent display name (never the raw
-// contextId), the 'Add access' picker modal opens and cancels, and removal
-// confirms ("Remove Access") → toasts "Access updated." → clears the row. The
-// member's original contextIds are restored and the seeded host + context are
-// deleted in the finally (hosts before contexts).
+// member detail Access tab (D8): a Control-API-seeded scope granted via PUT
+// /users/<id>/contexts is shown as an agent row in the Access/Connectors
+// table, labelled by the owning host's display name (never the raw
+// contextId), the 'Add access' picker modal opens (agent display names) and
+// cancels, and removal confirms ("Remove Access") → toasts "Access updated."
+// → clears the row. The tab's writes are D8 composite writes (agents AND
+// contexts mappings), so the member's original contextIds AND agentNames are
+// restored and the seeded host + context are deleted in the finally (hosts
+// before contexts).
//
// Contract: docs/testing/optional-playwright-qa-recorder.md ("Extending the
// recorder").
@@ -44,6 +47,7 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
const hostDisplayName = uniqueE2EName('qa-recorder-member-agent')
let userId = ''
let originalContextIds: string[] | null = null
+ let originalAgentNames: string[] | null = null
try {
await loginThroughUi(page, credentials)
@@ -63,11 +67,14 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
await expect(teamsTab).toBeEnabled({ timeout: 20_000 })
await teamsTab.click()
await expect(page).toHaveURL(/\/users-and-teams\/teams$/, { timeout: 20_000 })
- await expect(
- page
- .locator('table', { hasText: 'Team name' })
- .getByRole('button', { name: 'Sort by access' })
- ).toBeVisible({ timeout: 20_000 })
+ // Only assert the sortable header when the teams table rendered — a
+ // fresh environment shows the empty state instead.
+ const teamsTable = page.locator('table', { hasText: 'Team name' })
+ if (await teamsTable.isVisible({ timeout: 5_000 }).catch(() => false)) {
+ await expect(teamsTable.getByRole('button', { name: 'Sort by access' })).toBeVisible()
+ } else {
+ await expect(page.getByText('No teams yet.', { exact: true })).toBeVisible()
+ }
await expect(page.getByRole('columnheader', { name: 'Contexts' })).toHaveCount(0)
await screenshotAndLog(page, testInfo, `${journey}-teams-table`)
@@ -101,12 +108,15 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
timeout: 20_000,
})
await expect(
- page.getByText('Agents and connector scopes this member may access.', { exact: true })
+ page.getByText('Agents this member may use — and the connectors each one carries.', {
+ exact: true,
+ })
).toBeVisible({ timeout: 20_000 })
await screenshotAndLog(page, testInfo, `${journey}-tab`)
// Seed a host-backed scope out-of-band, remember the member's original
- // contextIds, then grant the scope through the admin context API.
+ // contextIds and agentNames, then grant the scope through the admin
+ // context API.
const originalRes = await api<{ contextIds?: string[] }>(
page.request,
'GET',
@@ -118,6 +128,17 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
).toBeLessThan(300)
originalContextIds = originalRes.data.contextIds ?? []
+ const originalAgentsRes = await api<{ agentNames?: string[] }>(
+ page.request,
+ 'GET',
+ `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`
+ )
+ expect(
+ originalAgentsRes.status,
+ `get user agents: ${JSON.stringify(originalAgentsRes.data)}`
+ ).toBeLessThan(300)
+ originalAgentNames = originalAgentsRes.data.agentNames ?? []
+
const ctxRes = await api(page.request, 'POST', '/api/v1/admin/contexts', {
metadata: { name: contextName },
spec: {
@@ -149,12 +170,21 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
300
)
- // Reload the tab: the row shows the host display name, never the raw
- // wire contextId.
+ // Reload the tab: D8 renders granted access as a real table — one row
+ // per granted agent, cell 1 the host display name (never the raw wire
+ // contextId), cell 2 the shared Connectors count cell.
await page.reload()
await expect(
- page.getByText('Agents and connector scopes this member may access.', { exact: true })
+ page.getByText('Agents this member may use — and the connectors each one carries.', {
+ exact: true,
+ })
).toBeVisible({ timeout: 20_000 })
+ await expect(page.getByRole('columnheader', { name: 'Access', exact: true })).toBeVisible({
+ timeout: 20_000,
+ })
+ await expect(
+ page.getByRole('columnheader', { name: 'Connectors', exact: true })
+ ).toBeVisible()
const row = page
.getByRole('row')
.filter({ has: page.getByRole('cell', { name: hostDisplayName, exact: true }) })
@@ -162,11 +192,13 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
await expect(row).not.toContainText(contextId)
await screenshotAndLog(page, testInfo, `${journey}-granted`)
- // 'Add access' picker modal opens and cancels.
+ // 'Add access' picker modal opens and cancels. The picker is still
+ // labelled 'Access' but its options are agent display names.
await page.getByRole('button', { name: 'Add access', exact: true }).click()
const dialog = page.getByRole('dialog', { name: 'Add access' })
await expect(dialog).toBeVisible()
await expect(dialog.getByLabel('Access')).toBeVisible()
+ await expect(dialog.locator('#member-access-picker')).toBeVisible()
await screenshotAndLog(page, testInfo, `${journey}-add-modal`)
await dialog.getByRole('button', { name: 'Cancel', exact: true }).click()
await expect(dialog).toHaveCount(0)
@@ -175,6 +207,9 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
await row.getByLabel('Remove access').click()
const confirmDialog = page.getByRole('alertdialog', { name: 'Remove Access' })
await expect(confirmDialog).toBeVisible()
+ await expect(confirmDialog).toContainText(
+ 'This revokes the agent and every connector it carries.'
+ )
await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
await expect(page.getByRole('status').filter({ hasText: 'Access updated.' })).toBeVisible({
timeout: 20_000,
@@ -190,6 +225,29 @@ test.describe('optional QA recorder: Control UI member Access tab', () => {
{ contextIds: originalContextIds }
)
}
+ // D8 composite write: the tab's remove also rewrote the member↔agent
+ // mapping, so restore the original agentNames too (PUT is
+ // compare-and-swap: echo the full set we currently observe).
+ if (userId && originalAgentNames !== null) {
+ const currentAgentsRes = await api<{
+ agentNames?: string[]
+ deletedAgentNames?: string[]
+ }>(page.request, 'GET', `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`)
+ if (currentAgentsRes.status < 300) {
+ await api(
+ page.request,
+ 'PUT',
+ `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`,
+ {
+ agentNames: originalAgentNames,
+ expectedCurrentAgentNames: [
+ ...(currentAgentsRes.data.agentNames ?? []),
+ ...(currentAgentsRes.data.deletedAgentNames ?? []),
+ ],
+ }
+ )
+ }
+ }
await api(page.request, 'DELETE', `/api/v1/admin/hosts/${encodeURIComponent(hostName)}`)
await api(page.request, 'DELETE', `/api/v1/admin/contexts/${encodeURIComponent(contextName)}`)
}
diff --git a/control-ui/e2e/qa-recorder-member-removed-access.spec.ts b/control-ui/e2e/qa-recorder-member-removed-access.spec.ts
index faddec6a9..305064193 100644
--- a/control-ui/e2e/qa-recorder-member-removed-access.spec.ts
+++ b/control-ui/e2e/qa-recorder-member-removed-access.spec.ts
@@ -1,13 +1,13 @@
// control-ui/e2e/qa-recorder-member-removed-access.spec.ts
//
// Optional QA recorder journey (MUTATING). Requires QA_RECORDER_CONFIRM_MUTATIONS=1.
-// Video-tours the member Access tab's tombstone story: a scope granted to a
-// member whose backing Context is then deleted out-of-band renders under the
-// "Removed access" heading (cu-deleted-access-heading) with the resolved
+// Video-tours the member Access tab's tombstone story (D8): a scope granted
+// to a member whose backing Context is then deleted out-of-band renders under
+// the "Removed access" heading (cu-deleted-access-heading) with the resolved
// agent display name and a "Deleted" marker — never a bare contextId row in
-// the active table. The member's original contextIds are restored via PUT
-// and the seeded host is deleted in the finally; the Context stays deleted
-// (it is the journey's fixture), so it is never deleted twice.
+// the active table. The member's original contextIds AND agentNames are
+// restored via PUT and the seeded host is deleted in the finally; the Context
+// stays deleted (it is the journey's fixture), so it is never deleted twice.
//
// Contract: docs/testing/optional-playwright-qa-recorder.md ("Extending the
// recorder").
@@ -43,6 +43,7 @@ test.describe('optional QA recorder: Control UI member removed access', () => {
const hostDisplayName = uniqueE2EName('qa-member-removed-agent')
let userId = ''
let originalContextIds: string[] | null = null
+ let originalAgentNames: string[] | null = null
let restored = false
try {
@@ -62,7 +63,8 @@ test.describe('optional QA recorder: Control UI member removed access', () => {
userId = String(usersRes.data.items?.[0]?.id || '')
expect(userId, 'first user id').toBeTruthy()
- // Remember the member's original contextIds before granting anything.
+ // Remember the member's original contextIds and agentNames before
+ // granting anything (shared-state hygiene for the D8 mappings).
const originalRes = await api<{ contextIds?: string[] }>(
page.request,
'GET',
@@ -74,6 +76,17 @@ test.describe('optional QA recorder: Control UI member removed access', () => {
).toBeLessThan(300)
originalContextIds = originalRes.data.contextIds ?? []
+ const originalAgentsRes = await api<{ agentNames?: string[] }>(
+ page.request,
+ 'GET',
+ `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`
+ )
+ expect(
+ originalAgentsRes.status,
+ `get user agents: ${JSON.stringify(originalAgentsRes.data)}`
+ ).toBeLessThan(300)
+ originalAgentNames = originalAgentsRes.data.agentNames ?? []
+
// Seed: a host-backed scope, granted to the member.
const ctxRes = await api(page.request, 'POST', '/api/v1/admin/contexts', {
metadata: { name: contextName },
@@ -122,7 +135,9 @@ test.describe('optional QA recorder: Control UI member removed access', () => {
`${CONTROL_UI_URL}/users-and-teams/users/${encodeURIComponent(userId)}/access`
)
await expect(
- page.getByText('Agents and connector scopes this member may access.', { exact: true })
+ page.getByText('Agents this member may use — and the connectors each one carries.', {
+ exact: true,
+ })
).toBeVisible({ timeout: 20_000 })
await expect(
@@ -164,6 +179,28 @@ test.describe('optional QA recorder: Control UI member removed access', () => {
{ contextIds: originalContextIds }
)
}
+ // D8 hygiene: restore the member↔agent mapping too (PUT is
+ // compare-and-swap: echo the full set we currently observe).
+ if (userId && originalAgentNames !== null) {
+ const currentAgentsRes = await api<{
+ agentNames?: string[]
+ deletedAgentNames?: string[]
+ }>(page.request, 'GET', `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`)
+ if (currentAgentsRes.status < 300) {
+ await api(
+ page.request,
+ 'PUT',
+ `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`,
+ {
+ agentNames: originalAgentNames,
+ expectedCurrentAgentNames: [
+ ...(currentAgentsRes.data.agentNames ?? []),
+ ...(currentAgentsRes.data.deletedAgentNames ?? []),
+ ],
+ }
+ )
+ }
+ }
await api(page.request, 'DELETE', `/api/v1/admin/hosts/${encodeURIComponent(hostName)}`)
} catch {
// Ignore cleanup failures.
diff --git a/control-ui/e2e/qa-recorder-onboarding-combo.spec.ts b/control-ui/e2e/qa-recorder-onboarding-combo.spec.ts
index ebade78ec..df5880891 100644
--- a/control-ui/e2e/qa-recorder-onboarding-combo.spec.ts
+++ b/control-ui/e2e/qa-recorder-onboarding-combo.spec.ts
@@ -67,7 +67,8 @@ test.describe('optional QA recorder: Control UI onboarding combo', () => {
await page.getByLabel('Team name').fill(teamName)
await page.getByRole('button', { name: 'Continue', exact: true }).click()
await page.getByRole('button', { name: 'Skip', exact: true }).click()
- await page.getByRole('button', { name: 'Skip', exact: true }).click()
+ // The Access step is the last one (D8 merged the Agents step in); its
+ // primary action creates the team directly — no further Skip exists.
await page.getByRole('button', { name: 'Create team', exact: true }).click()
await expect(page).toHaveURL(/\/users-and-teams\/teams$/, { timeout: 20_000 })
teamId = await findTeamIdByName(page.request, teamName)
@@ -112,6 +113,20 @@ test.describe('optional QA recorder: Control UI onboarding combo', () => {
})
expect(ctxRes.status, `create context: ${JSON.stringify(ctxRes.data)}`).toBeLessThan(300)
+ // D8: the Access tab manages agents — grant rides an agent that owns
+ // the scope, so seed one host bound to the context.
+ const agentName = uniqueE2EName('qa-recorder-combo-agent')
+ const hostRes = await api(page.request, 'POST', '/api/v1/admin/hosts', {
+ metadata: { name: agentName },
+ spec: {
+ host: agentName,
+ contextRef: contextName,
+ secretRef: '',
+ channels: [],
+ },
+ })
+ expect(hostRes.status, `create host: ${JSON.stringify(hostRes.data)}`).toBeLessThan(300)
+
// step 5: grant the access scope to the team from the team Access tab.
await page.goto(
`${CONTROL_UI_URL}/users-and-teams/teams/${encodeURIComponent(teamId)}/access`
@@ -124,8 +139,8 @@ test.describe('optional QA recorder: Control UI onboarding combo', () => {
).toBeVisible({ timeout: 20_000 })
await page.getByRole('button', { name: 'Add access', exact: true }).click()
await expect(page.locator('#team-access-picker')).toBeVisible({ timeout: 5_000 })
- await page.locator('#team-access-picker').fill(contextName)
- const accessOption = page.getByRole('option', { name: contextName, exact: true })
+ await page.locator('#team-access-picker').fill(agentName)
+ const accessOption = page.getByRole('option', { name: agentName, exact: true })
await expect(accessOption).toBeVisible({ timeout: 10_000 })
await accessOption.click()
await page
diff --git a/control-ui/e2e/qa-recorder-team-access-shared-label.spec.ts b/control-ui/e2e/qa-recorder-team-access-shared-label.spec.ts
index 925786715..f498ecdc4 100644
--- a/control-ui/e2e/qa-recorder-team-access-shared-label.spec.ts
+++ b/control-ui/e2e/qa-recorder-team-access-shared-label.spec.ts
@@ -2,13 +2,15 @@
//
// Optional QA recorder journey (MUTATING). Requires QA_RECORDER_CONFIRM_MUTATIONS=1.
// Creates a team through the Control API, seeds ONE host-backed access scope
-// shared by TWO hosts, and grants it via PUT /teams/<id>/contexts. The team
-// detail Access tab must render that shared scope as a SINGLE row labelled
-// with both agent display names joined by ", " (lib/accessScopeLabels joins
-// the sorted owner names), never two rows and never the raw contextId.
-// Removal confirms with the joined label in the dialog text and toasts
-// "Team access updated.". The team, hosts, and context are deleted via the
-// Control API in the finally (hosts before the context).
+// shared by TWO hosts, and grants it via PUT /teams/<id>/contexts. Under D8
+// the granted set is agent-centric (the team↔agent mapping UNION legacy scope
+// mappings resolved to their owning agents), so the shared scope renders as
+// TWO table rows — one per agent display name — never a joined "A, B" label
+// and never the raw contextId. Removal of ONE agent confirms with that
+// agent's own display name; the shared scope stays mapped for the other
+// agent, and the union resolves it back to BOTH owners, so both rows remain.
+// The team, hosts, and context are deleted via the Control API in the
+// finally (hosts before the context).
//
// Contract: docs/testing/optional-playwright-qa-recorder.md ("Extending the
// recorder").
@@ -25,8 +27,8 @@ import {
uniqueE2EName,
} from './qa-recorder-helpers'
-test.describe('optional QA recorder: Control UI team Access shared-scope label', () => {
- test('records the joined shared-scope label on the team Access tab and its removal', async ({
+test.describe('optional QA recorder: Control UI team Access shared-scope rows', () => {
+ test('records the per-agent shared-scope rows on the team Access tab and a single-agent removal', async ({
page,
}, testInfo) => {
requireRecorderConfirm(
@@ -45,8 +47,9 @@ test.describe('optional QA recorder: Control UI team Access shared-scope label',
const hostNameB = uniqueE2EName('qa-recorder-tas-host-b')
const hostDisplayA = uniqueE2EName('qa-recorder-tas-agent-a')
const hostDisplayB = uniqueE2EName('qa-recorder-tas-agent-b')
- // accessScopeLabels joins the sorted owner names with ", " — the "a"
- // agent sorts before the "b" agent, so the joined label is deterministic.
+ // Pre-D8 the shared scope rendered one row with the owners joined by
+ // ", "; D8 renders one row per agent, so this joined label is only used
+ // to assert it never appears.
const joinedLabel = `${hostDisplayA}, ${hostDisplayB}`
let teamId = ''
@@ -118,36 +121,49 @@ test.describe('optional QA recorder: Control UI team Access shared-scope label',
timeout: 20_000,
})
- // The shared scope renders as ONE row with the joined "A, B" label —
- // never the raw wire contextId, never one row per host.
+ // D8: the granted set is agent-centric. The legacy scope grant
+ // resolves to BOTH owning agents, so the shared scope renders as TWO
+ // table rows — one per agent display name — never a joined "A, B"
+ // label and never the raw contextId.
await expect(
- page.getByText('Agents and connector scopes this team may access.', { exact: true })
+ page.getByText('Agents this team may use — and the connectors each one carries.', {
+ exact: true,
+ })
).toBeVisible({ timeout: 20_000 })
- const row = page.getByRole('listitem').filter({ hasText: joinedLabel })
- await expect(row).toBeVisible({ timeout: 20_000 })
- await expect(row).not.toContainText(contextId)
- await expect(page.getByRole('listitem').getByText(hostDisplayA, { exact: true })).toHaveCount(
- 0
- )
- await expect(page.getByRole('listitem').getByText(hostDisplayB, { exact: true })).toHaveCount(
- 0
- )
+ const rowA = page
+ .getByRole('row')
+ .filter({ has: page.getByRole('cell', { name: hostDisplayA, exact: true }) })
+ const rowB = page
+ .getByRole('row')
+ .filter({ has: page.getByRole('cell', { name: hostDisplayB, exact: true }) })
+ await expect(rowA).toBeVisible({ timeout: 20_000 })
+ await expect(rowB).toBeVisible({ timeout: 20_000 })
+ await expect(rowA).not.toContainText(contextId)
+ await expect(rowB).not.toContainText(contextId)
+ await expect(page.getByRole('cell', { name: joinedLabel, exact: true })).toHaveCount(0)
await screenshotAndLog(page, testInfo, `${journey}-granted`)
- // Remove the row: confirm dialog names the joined label → toast → row gone.
- await row.getByLabel('Remove access').click()
+ // Remove agent A: the confirm dialog names A alone (not the joined
+ // label, not the raw id). Confirming revokes A's agent mapping, but
+ // the shared scope stays mapped for B and the D8 union resolves it
+ // back to BOTH owners, so both rows remain after the toast.
+ await rowA.getByLabel('Remove access').click()
const confirmDialog = page.getByRole('alertdialog', { name: 'Remove Access' })
await expect(confirmDialog).toBeVisible()
- await expect(confirmDialog).toContainText(joinedLabel)
+ await expect(confirmDialog).toContainText(hostDisplayA)
+ await expect(confirmDialog).not.toContainText(joinedLabel)
await expect(confirmDialog).not.toContainText(contextId)
+ await expect(confirmDialog).toContainText(
+ 'This revokes the agent and every connector it carries.'
+ )
await screenshotAndLog(page, testInfo, `${journey}-remove-confirm`)
await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
await expect(
page.getByRole('status').filter({ hasText: 'Team access updated.' })
).toBeVisible({ timeout: 20_000 })
- await expect(row.getByLabel('Remove access')).toHaveCount(0)
- await expect(page.getByText('No access assigned yet.', { exact: true })).toBeVisible()
- await screenshotAndLog(page, testInfo, `${journey}-removed`)
+ await expect(rowA).toBeVisible({ timeout: 20_000 })
+ await expect(rowB).toBeVisible({ timeout: 20_000 })
+ await screenshotAndLog(page, testInfo, `${journey}-removed-one-agent`)
} finally {
try {
const request = page.request
diff --git a/control-ui/e2e/qa-recorder-team-access.spec.ts b/control-ui/e2e/qa-recorder-team-access.spec.ts
index 9d30b7340..1e6a214c8 100644
--- a/control-ui/e2e/qa-recorder-team-access.spec.ts
+++ b/control-ui/e2e/qa-recorder-team-access.spec.ts
@@ -3,12 +3,13 @@
// Optional QA recorder journey (MUTATING). Requires QA_RECORDER_CONFIRM_MUTATIONS=1.
// Creates a team through the Control API, seeds a host-backed access scope,
// grants it via PUT /teams/<id>/contexts, then records the team detail Access
-// tab: subtitle "Members, connector access, and agents.", intro "Agents and
-// connector scopes this team may access.", the agent-display-name row (never
-// the raw contextId), the 'Add access' modal assertions, removal with the
-// "Team access updated." toast, and the legacy /contexts → /access redirect.
-// The team, host, and context are deleted via the Control API in the finally
-// (hosts before contexts).
+// tab (D8): subtitle "Members, connector access, and agents.", intro "Agents
+// this team may use — and the connectors each one carries.", the Access /
+// Connectors table whose rows are granted agents labelled by display name
+// (never the raw contextId), the 'Add access' modal assertions, removal with
+// the "Team access updated." toast, and the legacy /contexts and /agents deep
+// links redirecting to /access. The team, host, and context are deleted via
+// the Control API in the finally (hosts before contexts).
//
// Contract: docs/testing/optional-playwright-qa-recorder.md ("Extending the
// recorder").
@@ -112,25 +113,35 @@ test.describe('optional QA recorder: Control UI team Access tab', () => {
timeout: 20_000,
})
- // Exact subtitle and intro; the row shows the host display name, never
- // the raw wire contextId. Access rows are role="listitem" divs
- // (.cu-access-row), not table rows.
+ // Exact subtitle and intro; D8 renders granted access as a real table
+ // — one row per granted agent, cell 1 the agent display name (never
+ // the raw wire contextId), cell 2 the shared Connectors count cell.
await expect(
page.getByText('Members, connector access, and agents.', { exact: true })
).toBeVisible({ timeout: 20_000 })
await expect(
- page.getByText('Agents and connector scopes this team may access.', { exact: true })
+ page.getByText('Agents this team may use — and the connectors each one carries.', {
+ exact: true,
+ })
).toBeVisible()
- const row = page.getByRole('listitem').filter({ hasText: hostDisplayName })
+ await expect(page.getByRole('columnheader', { name: 'Access', exact: true })).toBeVisible()
+ await expect(
+ page.getByRole('columnheader', { name: 'Connectors', exact: true })
+ ).toBeVisible()
+ const row = page
+ .getByRole('row')
+ .filter({ has: page.getByRole('cell', { name: hostDisplayName, exact: true }) })
await expect(row).toBeVisible({ timeout: 20_000 })
await expect(row).not.toContainText(contextId)
await screenshotAndLog(page, testInfo, `${journey}-granted`)
- // 'Add access' picker modal assertions, then cancel.
+ // 'Add access' picker modal assertions, then cancel. The picker is
+ // still labelled 'Access' but its options are agent display names.
await page.getByRole('button', { name: 'Add access', exact: true }).click()
const dialog = page.getByRole('dialog', { name: 'Add access' })
await expect(dialog).toBeVisible()
await expect(dialog.getByLabel('Access')).toBeVisible()
+ await expect(dialog.locator('#team-access-picker')).toBeVisible()
await expect(dialog.getByRole('button', { name: 'Add access', exact: true })).toBeVisible()
await screenshotAndLog(page, testInfo, `${journey}-add-modal`)
await dialog.getByRole('button', { name: 'Cancel', exact: true }).click()
@@ -140,6 +151,9 @@ test.describe('optional QA recorder: Control UI team Access tab', () => {
await row.getByLabel('Remove access').click()
const confirmDialog = page.getByRole('alertdialog', { name: 'Remove Access' })
await expect(confirmDialog).toBeVisible()
+ await expect(confirmDialog).toContainText(
+ 'This revokes the agent and every connector it carries.'
+ )
await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
await expect(
page.getByRole('status').filter({ hasText: 'Team access updated.' })
@@ -150,13 +164,19 @@ test.describe('optional QA recorder: Control UI team Access tab', () => {
await expect(page.getByText('No access assigned yet.', { exact: true })).toBeVisible()
await screenshotAndLog(page, testInfo, `${journey}-removed`)
- // Legacy /contexts deep link redirects to /access.
+ // Legacy /contexts and /agents deep links redirect to /access.
await page.goto(
`${CONTROL_UI_URL}/users-and-teams/teams/${encodeURIComponent(teamId)}/contexts`
)
await expect(page).toHaveURL(/\/users-and-teams\/teams\/[^/]+\/access$/, {
timeout: 20_000,
})
+ await page.goto(
+ `${CONTROL_UI_URL}/users-and-teams/teams/${encodeURIComponent(teamId)}/agents`
+ )
+ await expect(page).toHaveURL(/\/users-and-teams\/teams\/[^/]+\/access$/, {
+ timeout: 20_000,
+ })
await screenshotAndLog(page, testInfo, `${journey}-legacy-redirect`)
} finally {
try {
diff --git a/control-ui/e2e/qa-recorder-team-create.spec.ts b/control-ui/e2e/qa-recorder-team-create.spec.ts
index d8014b6b4..9a07ffa84 100644
--- a/control-ui/e2e/qa-recorder-team-create.spec.ts
+++ b/control-ui/e2e/qa-recorder-team-create.spec.ts
@@ -1,8 +1,10 @@
// control-ui/e2e/qa-recorder-team-create.spec.ts
//
// Optional QA recorder journey (MUTATING). Requires QA_RECORDER_CONFIRM_MUTATIONS=1.
-// Creates an empty team through the create-team wizard, tours its detail tabs,
-// then deletes the team via the Control API.
+// Creates an empty team through the 3-step create-team wizard (D8 rail:
+// Team → Members → Access; skipping the Access step creates the team with no
+// access), tours its detail tabs (Members + Access — the separate Agents tab
+// is gone), then deletes the team via the Control API.
import { type Page, expect, test } from '@playwright/test'
import {
CONTROL_API_URL,
@@ -63,18 +65,15 @@ test.describe('optional QA recorder: Control UI team creation', () => {
page.getByText('Choose initial team members and roles.', { exact: true })
).toBeVisible({ timeout: 20_000 })
+ // Step 2 (Access, last step) — agent picker; skipping it creates the
+ // team with no access. There is no fourth step.
await continueWizard(page)
await expect(
- page.getByText('Choose the agents and connector scopes this team can use.', { exact: true })
+ page.getByText('Choose the agents this team can use — their connectors come along.', {
+ exact: true,
+ })
).toBeVisible({ timeout: 20_000 })
- await continueWizard(page)
- await expect(
- page.getByText('Select the agents this team can use.', { exact: true })
- ).toBeVisible({
- timeout: 20_000,
- })
-
const submit = page.getByRole('button', { name: 'Create team', exact: true })
await expect(submit).toBeEnabled()
await submit.click()
@@ -103,15 +102,9 @@ test.describe('optional QA recorder: Control UI team creation', () => {
timeout: 20_000,
})
- const agentsTab = page.getByRole('tab', { name: 'Agents', exact: true })
- await agentsTab.click()
- await expect(page).toHaveURL(/\/users-and-teams\/teams\/[^/]+\/agents$/, {
- timeout: 20_000,
- })
- await expect(agentsTab).toHaveAttribute('aria-selected', 'true')
- await expect(page.getByRole('button', { name: 'Add agent', exact: true })).toBeVisible({
- timeout: 20_000,
- })
+ // D8: the separate Agents tab is gone — the detail tour is Members +
+ // Access only.
+ await expect(page.getByRole('tab', { name: 'Agents', exact: true })).toHaveCount(0)
const membersTab = page.getByRole('tab', { name: 'Members', exact: true })
await membersTab.click()
diff --git a/control-ui/next.config.js b/control-ui/next.config.js
index cb091ac52..9dd2333b8 100644
--- a/control-ui/next.config.js
+++ b/control-ui/next.config.js
@@ -150,6 +150,17 @@ const nextConfig = {
destination: '/users-and-teams/teams/:id/access',
permanent: true,
},
+ // The member/team "Agents" tabs folded into "Access" (D8).
+ {
+ source: '/users-and-teams/users/:id/agents',
+ destination: '/users-and-teams/users/:id/access',
+ permanent: true,
+ },
+ {
+ source: '/users-and-teams/teams/:id/agents',
+ destination: '/users-and-teams/teams/:id/access',
+ permanent: true,
+ },
{ source: '/marketplace', destination: '/marketplace/connectors', permanent: true },
{ source: '/cost-and-usage', destination: '/cost-and-usage/usage', permanent: true },
{
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index a570e2b37..364ead2b7 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.472",
+ "version": "0.1.473",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.472",
+ "version": "0.1.473",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/llm-providers": "file:../packages/llm-providers",
diff --git a/control-ui/package.json b/control-ui/package.json
index 68df7bd3b..f2cc6c72e 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.472",
+ "version": "0.1.473",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",
diff --git a/docs/features/control-ui-context-removal.md b/docs/features/control-ui-context-removal.md
index 873738521..92af46c3a 100644
--- a/docs/features/control-ui-context-removal.md
+++ b/docs/features/control-ui-context-removal.md
@@ -80,6 +80,7 @@ Old `/contexts/*` bookmarks are redirected (see §6.3), not 404'd. For the full
| D4 | Access model naming | Users/teams "Contexts" tabs → **"Access"** tabs; rows labeled with resolved agent names; writes unchanged |
| D5 | Context deletion guardrail | Moot: after Category A removal there is **no user-facing context-delete path** left in the UI |
| D6 | Multi-agent GFS mounts via context detail | **Accepted loss** of that surface (was the only multi-agent mount UI). Single-agent GFS access continues via existing GFS grant surfaces; documented for product follow-up |
+| D8 | Member/team Access tabs | **One concept: agents.** The Access tab lists agents (display name + Connectors column with the same pill/hover as the Agents table; click → agent's Connectors tab). The separate member/team "Agents" tabs are folded in (old URLs redirect to `…/access`). Writes are composite: granting agent X updates BOTH `PUT /{users,teams}/:id/agents` and `PUT /{users,teams}/:id/contexts` (scope synced, legacy scope-only mappings preserved), so whichever table the runtime enforces, the grant works. Granted rows = agent mapping ∪ agents resolved from legacy scope mappings; tombstones show deleted agents (+ unowned deleted scopes). The team wizard collapses to `Team → Members → Access` with an agent picker. Wire frozen — both endpoints already existed |
| D7 | Connector access-grid people | The connectors list + connector-edit Access tab derive Teams/Users from the **agent-centric grants** (`/admin/agents/:name/{users,teams}`) merged across the connector's agents — NOT from the legacy scope-centric `/admin/contexts/:id/{users,teams}`. The operator's chain: connector → agent (scope allowlist) → user/team (Access/Agents tabs). Connector↔user/team direct grants remain out of scope (would need backend) |
**Backend changes required:** none. (Explicitly verified per phase; any backend need would be listed here.)
@@ -179,20 +180,21 @@ Tests updated in the same commit: `HostTable.test.tsx` (hover card now asserts a
2. Unknown slug `…/contexts/legacy-thing` lands on the Agents list.
3. The sidebar has no Contexts entry anywhere.
-## 7. Phase 2 — Category C: access management rebrand
+## 7. Phase 2 — Category C: access management rebrand (superseded in part by D8)
-### 7.1 Member detail (Users & Teams ▸ user)
+### 7.1 Member detail (Users & Teams ▸ user) — as built after D8
-- Tab `contexts`/"Contexts" → tab `access`/"Access" (redirect for old `/users-and-teams/users/<id>/contexts` → `…/access`).
-- Rows: "what this member can reach" — each mapped context rendered by **resolved label**: owning agent display name(s); fallback `displayName`; fallback muted raw id. Row action "Remove access" (confirm reworded, no "Context" wording); the row no longer links into `/contexts`.
-- Add modal: "Add access" — searchable multi-select showing resolved labels, submitting **context IDs unchanged** (`updateAdminUserContexts`).
-- Deleted-mappings section renamed "Removed access".
+- Tabs: Contact / Approval DMs / Communication Channels / **Access** / Teams (the former "Agents" tab folded into Access; `/users-and-teams/users/<id>/agents` redirects to `…/access`).
+- Access tab = **agents**: table rows show the agent display name (link to agent detail), the **Connectors column** (identical pill + hover card + click-through as the Agents list), and "Remove access" (confirm: "This revokes the agent and every connector it carries.").
+- Granted set = agent mapping ∪ agents resolved from legacy scope-only mappings; "Removed access" tombstones list deleted agents (+ unowned deleted scopes, muted).
+- "Add access" picker lists **agents** (display names); submit performs the **composite write** (agents + contexts mappings in sync).
+- Old scope-mapping read path (`getContextUsers/getContextTeams`) no longer used here.
-### 7.2 Team detail + team wizard
+### 7.2 Team detail + team wizard — as built after D8
-- Team detail tab `contexts` → `access`/"Access"; same relabel/resolve treatment as 7.1.
-- Team wizard steps `['Team','Members','Contexts','Agents']` → `['Team','Members','Access','Agents']`; the Access step presents resolved labels, writes context IDs unchanged.
-- Subtitles reworded ("Members, access, and agent access." style).
+- Team detail tabs: Members / **Access** (former "Agents" folded in; legacy URL redirects).
+- Same agent-row table with Connectors column, composite write, and tombstones as 7.1 (toast "Team access updated.").
+- Team wizard: `['Team','Members','Access']` — the Access step is an agent multi-select ("Choose the agents this team can use — their connectors come along."); creation writes both team mappings.
### 7.3 Legacy panel + admin home
@@ -282,6 +284,7 @@ Tests updated in the same commit: `HostTable.test.tsx` (hover card now asserts a
| 2026-08-27 | e2e | Video-format answer + MP4 pipeline: Playwright/Chromium records **WebM** natively (not MP4) — `qa:recorder:convert-mp4` added (`scripts/qa-recorder/convert-videos-mp4.sh`, ffmpeg H.264 + faststart, `--replace` to drop originals; round-trip verified against a synthetic clip). Recorder doc + §9 updated. **No video evidence exists yet anywhere in `.local-notes/` — zero journeys have been executed in this lane; videos are produced only when a journey runs against a live cluster.** |
| 2026-08-28 | e2e | **Execution campaign (mock-backed).** Full T2 bootstrap was ruled out on this host (7 GB RAM, ~3 available → OOM risk; both minikube profiles Stopped, stale branch.mk ownership → fail-closed per repo rules). Instead: built `scripts/qa-recorder/mock-control-api.mjs` — an in-memory control-api implementing the audited wire contract (auth cookie, resourceVersion/409 semantics, users/teams contexts mappings with deleted-history, hosts/contexts/mcp-servers CRUD, registry entries + install, budgets, recipes, rotation `DeploymentReady` simulation) — and ran the REAL control-ui dev server against it. Environment fights solved along the way: mock must bind dual-stack (`localhost` → `::1` first for Playwright's request context); Next dev daemon ignores env/port and grabs its own port (verify + set `CONTROL_UI_URL` per run); each playwright invocation wipes the outputDir (run batches in ONE invocation, copy evidence out after). Spec fixes found by real rendering: connectors rows use `role="button"` (kills `row` role; target `Expand/Collapse connector <name>`), team Access rows are `listitem`s, sort headers expose `Sort by access …` aria-names, tombstone rows persist after removal (assert actionability, not absence), toasts stack (`.last()`), 10s auto-refresh detaches click targets (retry), journeys must re-navigate after seeding (login pre-seed landing makes sidebar clicks no-ops). |
| 2026-08-28 | e2e | **Two REAL production bugs found by the journeys, fixed in `f2eebbc8a`:** (1) member detail page crashed wholesale — `accessLabeler` useMemo was declared after its consumer in `availableContextOptions` (TDZ ReferenceError; no unit tests covered those pages); (2) connectors-page search-by-agent silently broke in the Phase-1 rework (`summary.agents` emptied while the search haystack still reads it). Both fixed; search-by-agent locked with a new unit regression test (`McpServerTable.test.tsx`); unit suite now **1701/1701**, `tsc` clean. |
+| 2026-08-28 | D8 | **Access tabs = agents** (operator-approved design): member + team Access tabs rebuilt as agent tables with the shared Connectors column (extracted `components/ConnectorCountCell.tsx`, now also used by the Agents list — same pill, same hover, same click-through); separate "Agents" tabs folded in with legacy redirects; team wizard collapsed to 3 steps with an agent picker; writes are composite (`agents` + `contexts` mappings synced, legacy scope-only mappings preserved). Verified: `tsc` clean, unit suite green (2 known load flakes pass solo), and all 7 affected recorder journeys re-executed green against the mock stack (member-access ×3, team-access ×2, team-create, onboarding-combo). Spec fallout updated incl. api-client agent-mapping helpers and restore-agentNames hygiene. |
| 2026-08-28 | D7 | **Connector access grid now rides agent grants** (operator decision after flow review): connectors list + connector-edit Access tab fetch Teams/Users via `GET /admin/agents/:name/{users,teams}` merged across each connector's agents, replacing the legacy scope-centric `GET /admin/contexts/:id/{users,teams}` reads. Wire untouched (both endpoints already existed); `getContextUsers/getContextTeams` no longer called from the connectors surfaces. Mock control-api gained the agent-grant endpoints (reverse of the Users & Teams mappings). Verified: `tsc` clean, unit suite 1701/1701 (one unrelated 5s-timeout flake re-run green), and the affected recorder journeys re-executed green against the live mock stack (connectors-agent-access, connector-edit ×2 incl. the rotation journey). Canonical chain documented as: connector → agent (scope allowlist) → user/team (grants). |
| 2026-08-28 | ops | Operator stopped the machine mid-run (commit `3daf915d8` preserved the in-flight spec fixes — thank you). The interrupted final invocation still produced **37 passing journeys / 51 WebM videos + 132 PNG proofs**, preserved in `.local-notes/qa-recorder/evidence-final/`. Two core journeys (marketplace-install, recipe-scope-copy) were environment-killed mid-flight and re-queued; their root causes were fixed (recipe fixture needed `spec.triggers`; the L1 banner fires at the deploy step, not review — verified via validator probe: `validateRecipe` excludes the L1 check by design). Pre-existing journeys needing real cluster depth (rotation-demo, cost-usage/governance, llm-lifecycle/price, invitations, gfs) fail against the mock by design — they belong to the cluster/T2 lane. |
diff --git a/tests/e2e/playwright/control-ui/member-access-shared-label.spec.ts b/tests/e2e/playwright/control-ui/member-access-shared-label.spec.ts
index 9b7c90819..5a5d707dc 100644
--- a/tests/e2e/playwright/control-ui/member-access-shared-label.spec.ts
+++ b/tests/e2e/playwright/control-ui/member-access-shared-label.spec.ts
@@ -1,11 +1,13 @@
/**
- * Control UI — Member Access tab shared-scope label
+ * Control UI — Member Access tab shared-scope rows (D8)
*
- * A single access scope (Context) may back multiple hosts. The member
- * "Access" tab must render that shared scope as ONE row labelled with both
- * agent display names joined by ", " (lib/accessScopeLabels sorts the owner
- * names), never as two rows and never as the raw wire contextId. The remove
- * flow's confirm dialog repeats the same joined label.
+ * A single access scope (Context) may back multiple hosts. Under the D8
+ * agent-centric Access tab the granted set is the member↔agent mapping UNION
+ * legacy scope mappings resolved to their owning agents, so a scope shared by
+ * two hosts renders as TWO table rows — one per agent display name — never a
+ * joined "A, B" label and never the raw wire contextId. Revoking one agent
+ * leaves the shared scope mapped for the other, so both rows remain until
+ * the scope mapping itself is revoked.
*/
import { controlApi } from '../helpers/api-client'
import { expect, test } from '../helpers/auth-fixture'
@@ -17,14 +19,15 @@ const HOST_NAME_A = `e2e-member-shared-host-a-${RUN}`
const HOST_NAME_B = `e2e-member-shared-host-b-${RUN}`
const HOST_DISPLAY_A = `e2e-member-shared-agent-a-${RUN}`
const HOST_DISPLAY_B = `e2e-member-shared-agent-b-${RUN}`
-// accessScopeLabels joins the sorted owner names with ", " — the "a" agent
-// sorts before the "b" agent, so the joined label is deterministic.
+// Pre-D8 the shared scope rendered one row with the owners joined by ", ";
+// D8 renders one row per agent, so the joined label must never appear.
const JOINED_LABEL = `${HOST_DISPLAY_A}, ${HOST_DISPLAY_B}`
let userId = ''
let originalContextIds: string[] = []
+let originalAgentNames: string[] = []
-test.describe('Control UI — Member Access shared scope label', () => {
+test.describe('Control UI — Member Access shared scope rows', () => {
test.describe.configure({ mode: 'serial' })
test.beforeAll(async () => {
@@ -35,6 +38,7 @@ test.describe('Control UI — Member Access shared scope label', () => {
}
userId = items[0].id
originalContextIds = (await controlApi.getUserContexts(userId)).contextIds ?? []
+ originalAgentNames = (await controlApi.getUserAgents(userId)).agentNames ?? []
// One scope shared by two hosts.
await controlApi.createContext({
@@ -62,6 +66,14 @@ test.describe('Control UI — Member Access shared scope label', () => {
if (userId) {
try {
await controlApi.updateUserContexts(userId, originalContextIds)
+ // D8 composite write: the remove flow also rewrote the member↔agent
+ // mapping, so restore the original agentNames too (PUT is
+ // compare-and-swap: echo the full set we currently observe).
+ const current = await controlApi.getUserAgents(userId)
+ await controlApi.putUserAgents(userId, originalAgentNames, [
+ ...(current.agentNames ?? []),
+ ...(current.deletedAgentNames ?? []),
+ ])
} catch {
// best effort restore — cluster may already be unreachable
}
@@ -71,48 +83,70 @@ test.describe('Control UI — Member Access shared scope label', () => {
await controlApi.ensureContextDeleted(CONTEXT_NAME)
})
- test('renders one row with the joined agent names, not two rows or raw ids', async ({
+ test('renders one row per owning agent, not a joined label or raw ids', async ({
authedPage,
}) => {
await authedPage.goto(`/users-and-teams/users/${encodeURIComponent(userId)}/access`)
await expect(
- authedPage.getByText('Agents and connector scopes this member may access.')
+ authedPage.getByText('Agents this member may use — and the connectors each one carries.')
).toBeVisible({ timeout: 15_000 })
- // Exactly one row carries the joined "A, B" label…
- const row = authedPage
+ // The legacy scope grant resolves to BOTH owning agents: two rows, each
+ // labelled with its own agent display name.
+ const rowA = authedPage
.getByRole('row')
- .filter({ has: authedPage.getByRole('cell', { name: JOINED_LABEL, exact: true }) })
- await expect(row).toHaveCount(1)
- await expect(row).not.toContainText(CONTEXT_ID)
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_A, exact: true }) })
+ const rowB = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_B, exact: true }) })
+ await expect(rowA).toHaveCount(1)
+ await expect(rowB).toHaveCount(1)
+ await expect(rowA).not.toContainText(CONTEXT_ID)
+ await expect(rowB).not.toContainText(CONTEXT_ID)
- // …and neither agent appears as its own row (shared scope, not two scopes).
- await expect(authedPage.getByRole('cell', { name: HOST_DISPLAY_A, exact: true })).toHaveCount(0)
- await expect(authedPage.getByRole('cell', { name: HOST_DISPLAY_B, exact: true })).toHaveCount(0)
+ // The pre-D8 joined label never renders.
+ await expect(authedPage.getByRole('cell', { name: JOINED_LABEL, exact: true })).toHaveCount(0)
})
- test('remove confirm dialog shows the joined label', async ({ authedPage }) => {
+ test('remove confirm names the single agent; the shared scope keeps both rows', async ({
+ authedPage,
+ }) => {
await authedPage.goto(`/users-and-teams/users/${encodeURIComponent(userId)}/access`)
- const row = authedPage
+ const rowA = authedPage
.getByRole('row')
- .filter({ has: authedPage.getByRole('cell', { name: JOINED_LABEL, exact: true }) })
- await expect(row).toBeVisible({ timeout: 15_000 })
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_A, exact: true }) })
+ await expect(rowA).toBeVisible({ timeout: 15_000 })
- await row.getByLabel('Remove access').click()
+ await rowA.getByLabel('Remove access').click()
const confirmDialog = authedPage.getByRole('alertdialog', { name: 'Remove Access' })
await expect(confirmDialog).toBeVisible()
- await expect(confirmDialog).toContainText(JOINED_LABEL)
+ await expect(confirmDialog).toContainText(HOST_DISPLAY_A)
+ await expect(confirmDialog).not.toContainText(JOINED_LABEL)
await expect(confirmDialog).not.toContainText(CONTEXT_ID)
+ await expect(confirmDialog).toContainText(
+ 'This revokes the agent and every connector it carries.'
+ )
await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
await expect(authedPage.getByRole('status').filter({ hasText: 'Access updated.' })).toBeVisible(
{ timeout: 15_000 }
)
- await expect(row).toHaveCount(0)
+ // A's agent mapping is revoked, but the shared scope stays mapped for B
+ // and the D8 union resolves it back to BOTH owners — both rows remain.
+ await expect(rowA).toHaveCount(1)
+ await expect(
+ authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_B, exact: true }) })
+ ).toHaveCount(1)
+
+ const { agentNames } = await controlApi.getUserAgents(userId)
+ expect(agentNames ?? []).not.toContain(HOST_NAME_A)
+ expect(agentNames ?? []).toContain(HOST_NAME_B)
const { contextIds } = await controlApi.getUserContexts(userId)
- expect(contextIds ?? []).not.toContain(CONTEXT_ID)
+ expect(contextIds ?? []).toContain(CONTEXT_ID)
})
})
diff --git a/tests/e2e/playwright/control-ui/member-access-tab.spec.ts b/tests/e2e/playwright/control-ui/member-access-tab.spec.ts
index 200f158d9..df0df480c 100644
--- a/tests/e2e/playwright/control-ui/member-access-tab.spec.ts
+++ b/tests/e2e/playwright/control-ui/member-access-tab.spec.ts
@@ -1,9 +1,12 @@
/**
* Control UI — Member detail Access tab tests
*
- * The member "Access" tab (the former "Contexts" tab) must present host-backed
- * access scopes by their agent display name (spec.host), never by the raw wire
- * contextId, and the add/remove flows must round-trip the admin context API.
+ * The member "Access" tab (the former "Contexts" tab) presents granted access
+ * as one table row per agent (D8): the Access/Connectors columns, the owning
+ * host's display name (spec.host) in cell 1 — never the raw wire contextId —
+ * and the shared Connectors count cell in cell 2. The add/remove flows are D8
+ * composite writes (user-agents AND user-contexts mappings), so cleanup
+ * restores both the original contextIds and the original agentNames.
*/
import { controlApi } from '../helpers/api-client'
import { expect, test } from '../helpers/auth-fixture'
@@ -16,6 +19,7 @@ const HOST_DISPLAY_NAME = `e2e-member-access-agent-${RUN}`
let userId = ''
let originalContextIds: string[] = []
+let originalAgentNames: string[] = []
test.describe('Control UI — Member Access tab', () => {
test.describe.configure({ mode: 'serial' })
@@ -28,6 +32,7 @@ test.describe('Control UI — Member Access tab', () => {
}
userId = items[0].id
originalContextIds = (await controlApi.getUserContexts(userId)).contextIds ?? []
+ originalAgentNames = (await controlApi.getUserAgents(userId)).agentNames ?? []
await controlApi.createContext({
metadata: { name: CONTEXT_NAME },
@@ -49,6 +54,14 @@ test.describe('Control UI — Member Access tab', () => {
if (userId) {
try {
await controlApi.updateUserContexts(userId, originalContextIds)
+ // D8 composite write: the tab's remove also rewrote the member↔agent
+ // mapping, so restore the original agentNames too (PUT is
+ // compare-and-swap: echo the full set we currently observe).
+ const current = await controlApi.getUserAgents(userId)
+ await controlApi.putUserAgents(userId, originalAgentNames, [
+ ...(current.agentNames ?? []),
+ ...(current.deletedAgentNames ?? []),
+ ])
} catch {
// best effort restore — cluster may already be unreachable
}
@@ -60,9 +73,17 @@ test.describe('Control UI — Member Access tab', () => {
test('shows the agent display name, not the raw scope id', async ({ authedPage }) => {
await authedPage.goto(`/users-and-teams/users/${encodeURIComponent(userId)}/access`)
await expect(
- authedPage.getByText('Agents and connector scopes this member may access.')
+ authedPage.getByText('Agents this member may use — and the connectors each one carries.')
).toBeVisible({ timeout: 15_000 })
+ // D8: granted access renders as a real table — Access/Connectors columns,
+ // one row per granted agent, labelled by its display name.
+ await expect(
+ authedPage.getByRole('columnheader', { name: 'Access', exact: true })
+ ).toBeVisible()
+ await expect(
+ authedPage.getByRole('columnheader', { name: 'Connectors', exact: true })
+ ).toBeVisible()
const row = authedPage
.getByRole('row')
.filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
@@ -73,7 +94,7 @@ test.describe('Control UI — Member Access tab', () => {
test("'Add access' opens the access picker modal", async ({ authedPage }) => {
await authedPage.goto(`/users-and-teams/users/${encodeURIComponent(userId)}/access`)
await expect(
- authedPage.getByText('Agents and connector scopes this member may access.')
+ authedPage.getByText('Agents this member may use — and the connectors each one carries.')
).toBeVisible({ timeout: 15_000 })
await authedPage.getByRole('button', { name: 'Add access', exact: true }).click()
@@ -81,6 +102,7 @@ test.describe('Control UI — Member Access tab', () => {
const dialog = authedPage.getByRole('dialog', { name: 'Add access' })
await expect(dialog).toBeVisible()
await expect(dialog.getByLabel('Access')).toBeVisible()
+ await expect(dialog.locator('#member-access-picker')).toBeVisible()
await expect(dialog.getByRole('button', { name: 'Add access', exact: true })).toBeVisible()
await dialog.getByRole('button', { name: 'Cancel', exact: true }).click()
await expect(dialog).toHaveCount(0)
@@ -99,17 +121,22 @@ test.describe('Control UI — Member Access tab', () => {
const confirmDialog = authedPage.getByRole('alertdialog', { name: 'Remove Access' })
await expect(confirmDialog).toBeVisible()
+ await expect(confirmDialog).toContainText(
+ 'This revokes the agent and every connector it carries.'
+ )
await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
await expect(authedPage.getByRole('status').filter({ hasText: 'Access updated.' })).toBeVisible(
{ timeout: 15_000 }
)
await expect(row).toHaveCount(0)
- if (originalContextIds.length === 0) {
+ if (originalContextIds.length === 0 && originalAgentNames.length === 0) {
await expect(authedPage.getByText('No access assigned yet.')).toBeVisible()
}
const { contextIds } = await controlApi.getUserContexts(userId)
expect(contextIds ?? []).not.toContain(CONTEXT_ID)
+ const { agentNames } = await controlApi.getUserAgents(userId)
+ expect(agentNames ?? []).not.toContain(HOST_NAME)
})
})
diff --git a/tests/e2e/playwright/control-ui/team-access-tab.spec.ts b/tests/e2e/playwright/control-ui/team-access-tab.spec.ts
index 33d275b82..3f363a16f 100644
--- a/tests/e2e/playwright/control-ui/team-access-tab.spec.ts
+++ b/tests/e2e/playwright/control-ui/team-access-tab.spec.ts
@@ -1,10 +1,12 @@
/**
* Control UI — Team detail Access tab tests
*
- * The team "Access" tab (the former "Contexts" tab) must present host-backed
- * access scopes by their agent display name, the add/remove flows must
- * round-trip the admin team-context API, and the legacy /contexts deep link
- * must redirect to /access.
+ * The team "Access" tab (the former "Contexts" tab) presents granted access
+ * as one table row per agent (D8): the Access/Connectors columns, the agent
+ * display name in cell 1 (never the raw scope id), the shared Connectors
+ * count cell in cell 2. The add/remove flows round-trip the D8 composite
+ * write (team-agents AND team-contexts mappings), and the legacy /contexts
+ * and /agents deep links redirect to /access.
*/
import { controlApi } from '../helpers/api-client'
import { expect, test } from '../helpers/auth-fixture'
@@ -53,11 +55,20 @@ test.describe('Control UI — Team Access tab', () => {
timeout: 15_000,
})
await expect(
- authedPage.getByText('Agents and connector scopes this team may access.')
+ authedPage.getByText('Agents this team may use — and the connectors each one carries.')
).toBeVisible()
- // Access rows are role="listitem" divs (.cu-access-row), not table rows.
- const row = authedPage.getByRole('listitem').filter({ hasText: HOST_DISPLAY_NAME })
+ // D8: granted access renders as a real table — Access/Connectors columns,
+ // one row per granted agent, labelled by its display name.
+ await expect(
+ authedPage.getByRole('columnheader', { name: 'Access', exact: true })
+ ).toBeVisible()
+ await expect(
+ authedPage.getByRole('columnheader', { name: 'Connectors', exact: true })
+ ).toBeVisible()
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
await expect(row).toHaveCount(1)
await expect(row).not.toContainText(CONTEXT_ID)
})
@@ -65,7 +76,7 @@ test.describe('Control UI — Team Access tab', () => {
test("'Add access' opens the access picker modal", async ({ authedPage }) => {
await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/access`)
await expect(
- authedPage.getByText('Agents and connector scopes this team may access.')
+ authedPage.getByText('Agents this team may use — and the connectors each one carries.')
).toBeVisible({ timeout: 15_000 })
await authedPage.getByRole('button', { name: 'Add access', exact: true }).click()
@@ -73,6 +84,7 @@ test.describe('Control UI — Team Access tab', () => {
const dialog = authedPage.getByRole('dialog', { name: 'Add access' })
await expect(dialog).toBeVisible()
await expect(dialog.getByLabel('Access')).toBeVisible()
+ await expect(dialog.locator('#team-access-picker')).toBeVisible()
await expect(dialog.getByRole('button', { name: 'Add access', exact: true })).toBeVisible()
await dialog.getByRole('button', { name: 'Cancel', exact: true }).click()
await expect(dialog).toHaveCount(0)
@@ -82,13 +94,18 @@ test.describe('Control UI — Team Access tab', () => {
authedPage,
}) => {
await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/access`)
- const row = authedPage.getByRole('listitem').filter({ hasText: HOST_DISPLAY_NAME })
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
await expect(row).toBeVisible({ timeout: 15_000 })
await row.getByLabel('Remove access').click()
const confirmDialog = authedPage.getByRole('alertdialog', { name: 'Remove Access' })
await expect(confirmDialog).toBeVisible()
+ await expect(confirmDialog).toContainText(
+ 'This revokes the agent and every connector it carries.'
+ )
await confirmDialog.getByRole('button', { name: 'Remove access', exact: true }).click()
await expect(
@@ -99,6 +116,8 @@ test.describe('Control UI — Team Access tab', () => {
const { contextIds } = await controlApi.getTeamContexts(teamId)
expect(contextIds ?? []).not.toContain(CONTEXT_ID)
+ const { agentNames } = await controlApi.getTeamAgents(teamId)
+ expect(agentNames ?? []).not.toContain(HOST_NAME)
})
test('legacy /contexts deep link redirects to /access', async ({ authedPage }) => {
@@ -106,4 +125,12 @@ test.describe('Control UI — Team Access tab', () => {
await authedPage.waitForURL('**/users-and-teams/teams/*/access', { timeout: 15_000 })
expect(authedPage.url()).toContain(`/teams/${teamId}/access`)
})
+
+ test('legacy /agents deep link redirects to /access (D8 folded the Agents tab)', async ({
+ authedPage,
+ }) => {
+ await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/agents`)
+ await authedPage.waitForURL('**/users-and-teams/teams/*/access', { timeout: 15_000 })
+ expect(authedPage.url()).toContain(`/teams/${teamId}/access`)
+ })
})
diff --git a/tests/e2e/playwright/control-ui/team-create-wizard.spec.ts b/tests/e2e/playwright/control-ui/team-create-wizard.spec.ts
index 3bb4b0552..b40eed7ad 100644
--- a/tests/e2e/playwright/control-ui/team-create-wizard.spec.ts
+++ b/tests/e2e/playwright/control-ui/team-create-wizard.spec.ts
@@ -1,9 +1,10 @@
/**
* Control UI — Team create wizard Access step tests
*
- * The wizard rail is Team → Members → Access → Agents; the Access step offers
- * agent display names (not raw scope ids) and a selection made there lands on
- * the created team as a real context mapping.
+ * The wizard rail is Team → Members → Access (D8 dropped the fourth step);
+ * the Access step offers agent display names (not raw scope ids) and a
+ * selection made there lands on the created team as BOTH the team-contexts
+ * and team-agents mappings (D8 composite write).
*/
import { controlApi } from '../helpers/api-client'
import { expect, test } from '../helpers/auth-fixture'
@@ -64,24 +65,24 @@ test.describe('Control UI — Team create wizard', () => {
test.setTimeout(120_000)
await authedPage.goto('/users-and-teams/teams/new')
+ // D8 rail: three steps, no fourth.
await expect(authedPage.locator('.cu-agent-step-rail__title')).toHaveText([
'Team',
'Members',
'Access',
- 'Agents',
])
- // Step 1 — Team identity
+ // Step 0 — Team identity
await authedPage.getByLabel('Team name').fill(TEAM_NAME)
await authedPage.getByRole('button', { name: 'Continue', exact: true }).click()
- // Step 2 — Members: skip for now
+ // Step 1 — Members: skip for now
await authedPage.getByRole('button', { name: 'Skip', exact: true }).click()
await expect(
- authedPage.getByText('Choose the agents and connector scopes this team can use.')
+ authedPage.getByText('Choose the agents this team can use — their connectors come along.')
).toBeVisible({ timeout: 15_000 })
- // Step 3 — Access: options resolve to agent display names, never raw ids
+ // Step 2 (last) — Access: options are agent display names, never raw ids
await authedPage.locator('#new-team-access-picker').click()
const seededOption = authedPage.getByRole('option', {
name: HOST_DISPLAY_NAME,
@@ -92,9 +93,8 @@ test.describe('Control UI — Team create wizard', () => {
await seededOption.click()
await expect(authedPage.locator('#new-team-access-picker')).toContainText(HOST_DISPLAY_NAME)
await authedPage.keyboard.press('Escape')
- await authedPage.getByRole('button', { name: 'Continue', exact: true }).click()
- // Step 4 — Agents: none for this flow, then create
+ // Last step: the primary action creates the team (no fourth step).
await authedPage.getByRole('button', { name: 'Create team', exact: true }).click()
await authedPage.waitForURL('**/users-and-teams/teams', { timeout: 30_000 })
@@ -103,9 +103,15 @@ test.describe('Control UI — Team create wizard', () => {
const { contextIds } = await controlApi.getTeamContexts(teamId)
expect(contextIds ?? []).toContain(CONTEXT_ID)
+ // D8 composite write: the wizard also persists the team↔agent mapping.
+ const { agentNames } = await controlApi.getTeamAgents(teamId)
+ expect(agentNames ?? []).toContain(HOST_NAME)
+
await authedPage.goto(`/users-and-teams/teams/${encodeURIComponent(teamId)}/access`)
- // Access rows are role="listitem" divs (.cu-access-row), not table rows.
- const row = authedPage.getByRole('listitem').filter({ hasText: HOST_DISPLAY_NAME })
+ // D8: one table row per granted agent, labelled by its display name.
+ const row = authedPage
+ .getByRole('row')
+ .filter({ has: authedPage.getByRole('cell', { name: HOST_DISPLAY_NAME, exact: true }) })
await expect(row).toBeVisible({ timeout: 15_000 })
await expect(row).not.toContainText(CONTEXT_ID)
})
diff --git a/tests/e2e/playwright/helpers/api-client.ts b/tests/e2e/playwright/helpers/api-client.ts
index 85a91409e..bf621e4a7 100644
--- a/tests/e2e/playwright/helpers/api-client.ts
+++ b/tests/e2e/playwright/helpers/api-client.ts
@@ -53,6 +53,11 @@ export type HostCr = {
}
}
+export type AgentAccess = {
+ agentNames: string[]
+ deletedAgentNames?: string[]
+}
+
export const controlApi = {
async validateRecipe(recipe: unknown): Promise<{ valid: boolean; errors?: unknown[] }> {
return apiFetch<{ valid: boolean; errors?: unknown[] }>(
@@ -247,6 +252,42 @@ export const controlApi = {
})
},
+ // ── D8 member/team ↔ agent mappings ──────────────────────────────────────
+ // The Access tab's writes are composite writes (agents AND contexts), so
+ // specs that seed mappings restore both. PUT is compare-and-swap:
+ // expectedCurrentAgentNames must echo the full set the caller last observed
+ // (active ∪ deleted history from a fresh GET).
+
+ async getUserAgents(userId: string): Promise<AgentAccess> {
+ return apiFetch<AgentAccess>('GET', `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`)
+ },
+
+ async putUserAgents(
+ userId: string,
+ agentNames: string[],
+ expectedCurrentAgentNames: string[]
+ ): Promise<unknown> {
+ return apiFetch<unknown>('PUT', `/api/v1/admin/users/${encodeURIComponent(userId)}/agents`, {
+ agentNames,
+ expectedCurrentAgentNames,
+ })
+ },
+
+ async getTeamAgents(teamId: string): Promise<AgentAccess> {
+ return apiFetch<AgentAccess>('GET', `/api/v1/admin/teams/${encodeURIComponent(teamId)}/agents`)
+ },
+
+ async putTeamAgents(
+ teamId: string,
+ agentNames: string[],
+ expectedCurrentAgentNames: string[]
+ ): Promise<unknown> {
+ return apiFetch<unknown>('PUT', `/api/v1/admin/teams/${encodeURIComponent(teamId)}/agents`, {
+ agentNames,
+ expectedCurrentAgentNames,
+ })
+ },
+
async createTeam(name: string): Promise<{ id: string; name: string }> {
return apiFetch<{ id: string; name: string }>('POST', '/api/v1/admin/teams', { name })
},
diff --git a/tests/e2e/playwright/package-lock.json b/tests/e2e/playwright/package-lock.json
index d52deb104..fe1b86930 100644
--- a/tests/e2e/playwright/package-lock.json
+++ b/tests/e2e/playwright/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-playwright-tests",
- "version": "0.1.24",
+ "version": "0.1.25",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-playwright-tests",
- "version": "0.1.24",
+ "version": "0.1.25",
"devDependencies": {
"@playwright/test": "^1.50.0",
"@types/node": "^22.0.0"
diff --git a/tests/e2e/playwright/package.json b/tests/e2e/playwright/package.json
index 30debefd9..c818479fa 100644
--- a/tests/e2e/playwright/package.json
+++ b/tests/e2e/playwright/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-playwright-tests",
- "version": "0.1.24",
+ "version": "0.1.25",
"private": true,
"description": "Playwright E2E tests for Control UI and Desktop App",
"scripts": {