Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat(agent-vault): optional label on sessions

Scott Wilson7cec9a3f9b6a
diff --git a/backend/e2e-test/routes/v1/agent-vault.spec.ts b/backend/e2e-test/routes/v1/agent-vault.spec.ts
index f9f140dff5..61f1745b1b 100644
--- a/backend/e2e-test/routes/v1/agent-vault.spec.ts
+++ b/backend/e2e-test/routes/v1/agent-vault.spec.ts
@@ -2631,6 +2631,48 @@ describe("Agent Vault V1 Router", async () => {
expect(issues.some((issue) => issue.path.join(".") === "accessBundles")).toBe(true);
});
+ test("a label is optional, trimmed, returned on every read, and searchable", async () => {
+ const bundle = await createAccessBundle(`session-label-${Date.now()}`);
+
+ const unlabeled = await inject("POST", "/api/v1/agent-vault/sessions", {
+ accessBundles: [bundle.name],
+ ttl: "1h"
+ });
+ expect(unlabeled.statusCode).toBe(200);
+ expect(unlabeled.json().session.label).toBeNull();
+
+ const labeled = await inject("POST", "/api/v1/agent-vault/sessions", {
+ accessBundles: [bundle.name],
+ ttl: "1h",
+ label: " session-label nightly deploy "
+ });
+ expect(labeled.statusCode).toBe(200);
+ const { session } = labeled.json() as { session: { id: string; label: string | null } };
+ expect(session.label).toBe("session-label nightly deploy");
+
+ const byId = await inject("GET", `/api/v1/agent-vault/sessions/${session.id}`);
+ expect(byId.json().session.label).toBe("session-label nightly deploy");
+
+ const search = await inject("GET", "/api/v1/agent-vault/sessions?search=nightly%20deploy");
+ const found = search.json() as { sessions: { id: string; label: string | null }[]; totalCount: number };
+ expect(found.totalCount).toBe(1);
+ expect(found.sessions[0]).toMatchObject({ id: session.id, label: "session-label nightly deploy" });
+
+ const tooLong = await inject("POST", "/api/v1/agent-vault/sessions", {
+ accessBundles: [bundle.name],
+ ttl: "1h",
+ label: "a".repeat(129)
+ });
+ expect(tooLong.statusCode).toBe(422);
+
+ const withNewline = await inject("POST", "/api/v1/agent-vault/sessions", {
+ accessBundles: [bundle.name],
+ ttl: "1h",
+ label: "line one\nline two"
+ });
+ expect(withNewline.statusCode).toBe(422);
+ });
+
test("search filters and counts on the server, not just the page", async () => {
const alpha = await createAccessBundle("search-alpha");
const beta = await createAccessBundle("search-beta");
diff --git a/backend/src/db/migrations/20261020120000_agent-vault-session-label.ts b/backend/src/db/migrations/20261020120000_agent-vault-session-label.ts
new file mode 100644
index 0000000000..e47a5009a5
--- /dev/null
+++ b/backend/src/db/migrations/20261020120000_agent-vault-session-label.ts
@@ -0,0 +1,21 @@
+import { Knex } from "knex";
+
+import { TableName } from "../schemas";
+
+export async function up(knex: Knex): Promise<void> {
+ const hasColumn = await knex.schema.hasColumn(TableName.AgentVaultSession, "label");
+ if (!hasColumn) {
+ await knex.schema.alterTable(TableName.AgentVaultSession, (t) => {
+ t.string("label", 128).nullable();
+ });
+ }
+}
+
+export async function down(knex: Knex): Promise<void> {
+ const hasColumn = await knex.schema.hasColumn(TableName.AgentVaultSession, "label");
+ if (hasColumn) {
+ await knex.schema.alterTable(TableName.AgentVaultSession, (t) => {
+ t.dropColumn("label");
+ });
+ }
+}
diff --git a/backend/src/db/schemas/agent-vault-sessions.ts b/backend/src/db/schemas/agent-vault-sessions.ts
index 740b8d2ba0..fafabf1dcd 100644
--- a/backend/src/db/schemas/agent-vault-sessions.ts
+++ b/backend/src/db/schemas/agent-vault-sessions.ts
@@ -22,7 +22,8 @@ export const AgentVaultSessionsSchema = z.object({
createdAt: z.date(),
updatedAt: z.date(),
encryptedSessionLogKey: zodBuffer.nullable().optional(),
- actorType: z.string().nullable().optional()
+ actorType: z.string().nullable().optional(),
+ label: z.string().nullable().optional()
});
export type TAgentVaultSessions = z.infer<typeof AgentVaultSessionsSchema>;
diff --git a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts
index 3195db7c30..590caf40e4 100644
--- a/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts
+++ b/backend/src/ee/routes/v1/agent-vault-routers/agent-vault-session-router.ts
@@ -34,6 +34,7 @@ const SessionAccessBundleSchema = z.object({
const SessionSchema = z.object({
id: z.string().uuid().describe(AGENT_VAULT.SESSION.sessionId),
+ label: z.string().nullable().describe(AGENT_VAULT.SESSION.label),
actor: AgentVaultSessionActorSchema,
status: z.nativeEnum(AgentVaultSessionStatus),
expiresAt: z.date().nullable().describe(AGENT_VAULT.SESSION.expiresAt),
@@ -161,12 +162,20 @@ export const registerAgentVaultSessionRouter = async (server: FastifyZodProvider
});
}
})
- .describe(AGENT_VAULT.SESSION.ttl)
+ .describe(AGENT_VAULT.SESSION.ttl),
+ label: z
+ .string()
+ .trim()
+ .max(128, "Label must be at most 128 characters")
+ .regex(AGENT_VAULT_NO_CONTROL_CHARS_RE, AGENT_VAULT_NO_CONTROL_CHARS_MESSAGE)
+ .optional()
+ .describe(AGENT_VAULT.SESSION.label)
}),
response: {
200: z.object({
session: z.object({
id: z.string().uuid().describe(AGENT_VAULT.SESSION.sessionId),
+ label: z.string().nullable().describe(AGENT_VAULT.SESSION.label),
token: z.string().describe(AGENT_VAULT.SESSION.token),
expiresAt: z.date().nullable().describe(AGENT_VAULT.SESSION.expiresAt),
createdAt: z.date(),
@@ -204,6 +213,7 @@ export const registerAgentVaultSessionRouter = async (server: FastifyZodProvider
type: EventType.AGENT_VAULT_SESSION_MINT,
metadata: {
sessionId: session.id,
+ label: session.label,
accessBundleId: session.accessBundles[0].id,
accessBundleName: session.accessBundles[0].name,
expiresAt: session.expiresAt?.toISOString() ?? null
diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-dal.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-dal.ts
index 48946623d7..bdfe78ae1e 100644
--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-dal.ts
+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-dal.ts
@@ -16,6 +16,7 @@ export type TAgentVaultSessionListRow = {
id: string;
userId: string | null;
identityId: string | null;
+ label: string | null;
actor: TAgentVaultSessionActor;
expiresAt: Date | null;
revokedAt: Date | null;
@@ -156,6 +157,7 @@ export const agentVaultSessionDALFactory = (db: TDbClient) => {
void query.where((qb) => {
void qb
+ .orWhereILike(`${TableName.AgentVaultSession}.label`, term)
.orWhereILike(`${TableName.Identity}.name`, term)
.orWhereILike(`${TableName.Users}.username`, term)
// Covers a first name, a last name and the two together, so no separate checks are needed.
@@ -228,6 +230,7 @@ export const agentVaultSessionDALFactory = (db: TDbClient) => {
db.ref("id").withSchema(TableName.AgentVaultSession),
db.ref("userId").withSchema(TableName.AgentVaultSession),
db.ref("identityId").withSchema(TableName.AgentVaultSession),
+ db.ref("label").withSchema(TableName.AgentVaultSession),
db.ref("expiresAt").withSchema(TableName.AgentVaultSession),
db.ref("revokedAt").withSchema(TableName.AgentVaultSession),
db.ref("createdAt").withSchema(TableName.AgentVaultSession),
@@ -249,6 +252,7 @@ export const agentVaultSessionDALFactory = (db: TDbClient) => {
id: string;
userId: string | null;
identityId: string | null;
+ label: string | null;
expiresAt: Date | null;
revokedAt: Date | null;
createdAt: Date;
@@ -274,6 +278,7 @@ export const agentVaultSessionDALFactory = (db: TDbClient) => {
id: row.id,
userId: row.userId,
identityId: row.identityId,
+ label: row.label,
actor: toSessionActor(row),
expiresAt: row.expiresAt,
revokedAt: row.revokedAt,
diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-service.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-service.ts
index ba5276358a..edfad96c54 100644
--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-service.ts
+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-service.ts
@@ -60,7 +60,7 @@ export const agentVaultSessionServiceFactory = ({
status: deriveSessionStatus({ ...session, userId, identityId })
});
- const mintSession = async ({ projectId, ctx, accessBundles, actorName, actorEmail, ttl }: TMintSessionDTO) => {
+ const mintSession = async ({ projectId, ctx, accessBundles, actorName, actorEmail, ttl, label }: TMintSessionDTO) => {
const actor = requireSessionActor(ctx);
const { permission, accessBundleIds: reachable } = await getAgentVaultReachability(
{ permissionService, membershipDAL },
@@ -114,6 +114,7 @@ export const agentVaultSessionServiceFactory = ({
actor.type === ActorType.IDENTITY ? AgentVaultMemberType.MachineIdentity : AgentVaultMemberType.User,
actorName,
actorEmail,
+ label: label || null,
tokenHash,
expiresAt,
encryptedSessionLogKey
@@ -137,6 +138,7 @@ export const agentVaultSessionServiceFactory = ({
return {
session: {
id: session.id,
+ label: session.label ?? null,
expiresAt: session.expiresAt ?? null,
createdAt: session.createdAt,
accessBundles: accessBundles.map((name, position) => ({
diff --git a/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts b/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts
index 99c1b88d64..8c9b9cb359 100644
--- a/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts
+++ b/backend/src/ee/services/agent-vault-session/agent-vault-session-types.ts
@@ -13,6 +13,7 @@ export type TMintSessionDTO = {
actorName: string;
actorEmail: string | null;
ttl: string;
+ label?: string;
};
export type TListSessionsDTO = {
diff --git a/backend/src/ee/services/audit-log/audit-log-types.ts b/backend/src/ee/services/audit-log/audit-log-types.ts
index a595050093..3fd94787aa 100644
--- a/backend/src/ee/services/audit-log/audit-log-types.ts
+++ b/backend/src/ee/services/audit-log/audit-log-types.ts
@@ -6669,6 +6669,7 @@ interface AgentVaultSessionMintEvent {
type: EventType.AGENT_VAULT_SESSION_MINT;
metadata: {
sessionId: string;
+ label: string | null;
accessBundleId: string;
accessBundleName: string;
expiresAt: string | null;
diff --git a/backend/src/lib/api-docs/constants.ts b/backend/src/lib/api-docs/constants.ts
index b6f691916a..da96aebe16 100644
--- a/backend/src/lib/api-docs/constants.ts
+++ b/backend/src/lib/api-docs/constants.ts
@@ -4680,12 +4680,14 @@ export const AGENT_VAULT = {
sessionId: "The ID of the session.",
accessBundles: "The access bundle this session carries, by name. A list that accepts exactly one name.",
ttl: "How long the session lasts: a duration such as 30m, 8h or 7d (at least 1m), or never. Defaults to 7d.",
+ label:
+ "A short description of what the session is for, such as `nightly deploy` or `support ticket triage`. Up to 128 characters. Shown wherever the session is listed.",
token: "The session token. Returned once, at mint, and never again.",
expiresAt: "When the session expires, or null when it never does.",
scope: "Whose sessions to list: your own (mine) or everyone's (all, administrators only).",
status:
"Filter by session status: `active`, `revoked` or `expired`. Separate several with commas to match any of them.",
- search: "Match sessions by actor name, actor email or access bundle name.",
+ search: "Match sessions by label, actor name, actor email or access bundle name.",
limit: "The maximum number of sessions to return.",
offset: "How many sessions to skip.",
actorType: "Whether the session belongs to a user or a machine identity.",
diff --git a/docs/documentation/platform/agent-vault/sessions-api.mdx b/docs/documentation/platform/agent-vault/sessions-api.mdx
index 99f858aac6..98a02f52c4 100644
--- a/docs/documentation/platform/agent-vault/sessions-api.mdx
+++ b/docs/documentation/platform/agent-vault/sessions-api.mdx
@@ -52,11 +52,12 @@ Call [the endpoint that creates a session](/api-reference/endpoints/agent-vault-
curl -X POST https://app.infisical.com/api/v1/agent-vault/sessions \
-H "Authorization: Bearer <access-token>" \
-H "Content-Type: application/json" \
- -d '{"accessBundles": ["<access-bundle-name>"], "ttl": "1h"}'
+ -d '{"accessBundles": ["<access-bundle-name>"], "ttl": "1h", "label": "nightly deploy"}'
```
- `accessBundles` takes a list, but a session can have only one access bundle, so the list must have exactly one name
- `ttl` accepts a duration of at least one minute, such as `30m`, `8h`, or `7d`, or `never`, and defaults to `7d` (see [Choose how long a session lasts](#choose-how-long-a-session-lasts) to pick a value)
+- `label` is optional and describes what the session is for, in up to 128 characters. It appears on the **Sessions** page, and you can search sessions by it
The response includes the session's ID, the session token, and when the session expires:
diff --git a/frontend/src/hooks/api/agentVault/types.ts b/frontend/src/hooks/api/agentVault/types.ts
index 3b3dd5e736..878edecd5a 100644
--- a/frontend/src/hooks/api/agentVault/types.ts
+++ b/frontend/src/hooks/api/agentVault/types.ts
@@ -211,6 +211,7 @@ export type TAgentVaultSessionActor =
export type TAgentVaultSession = {
id: string;
+ label: string | null;
actor: TAgentVaultSessionActor;
status: AgentVaultSessionStatus;
expiresAt: string | null;
@@ -221,6 +222,7 @@ export type TAgentVaultSession = {
export type TAgentVaultMintedSession = {
id: string;
+ label: string | null;
token: string;
expiresAt: string | null;
createdAt: string;
@@ -294,6 +296,7 @@ export type TAddAgentVaultMembersDTO = TAgentVaultActorIdsDTO & {
export type TCreateAgentVaultSessionDTO = {
accessBundles: string[];
ttl: string;
+ label?: string;
};
export type TAgentVaultProxySettingsDTO = {
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
index e86c29b533..fa5402a18e 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
@@ -96,6 +96,7 @@ import { RevokeSessionDialog } from "./components/RevokeSessionDialog";
import { SessionCreatedDialog } from "./components/SessionCreatedDialog";
import { SessionDetailSheet } from "./components/SessionDetailSheet";
import { SessionExpiry } from "./components/SessionExpiry";
+import { SessionLabel } from "./components/SessionLabel";
import { SESSION_STATUS_PRESENTATION, SessionStatusBadge } from "./components/SessionStatusBadge";
const STATUS_OPTIONS = [
@@ -289,7 +290,7 @@ export const AgentVaultSessionsPage = () => {
setSearch(e.target.value);
setPage(1);
}}
- placeholder="Search by identity, email, or access bundle..."
+ placeholder="Search by label, identity, email, or access bundle..."
/>
</InputGroup>
<DropdownMenu>
@@ -370,6 +371,8 @@ export const AgentVaultSessionsPage = () => {
<Table>
<TableHeader>
<TableRow>
+ {/* w-px holds the column to its capped content, so a long label truncates at the column's edge */}
+ <TableHead className="w-px">Label</TableHead>
<TableHead>Identity</TableHead>
<TableHead>Access Bundle</TableHead>
<TableHead>Created</TableHead>
@@ -383,7 +386,7 @@ export const AgentVaultSessionsPage = () => {
Array.from({ length: 5 }).map((_, index) => (
// eslint-disable-next-line react/no-array-index-key
<TableRow key={`session-skeleton-${index}`}>
- {Array.from({ length: 6 }).map((__, cell) => (
+ {Array.from({ length: 7 }).map((__, cell) => (
// eslint-disable-next-line react/no-array-index-key
<TableCell key={`session-skeleton-${index}-${cell}`}>
<Skeleton className="h-4 w-full" />
@@ -398,6 +401,13 @@ export const AgentVaultSessionsPage = () => {
onClick={() => openSheet(session.id)}
className="cursor-pointer"
>
+ <TableCell>
+ {session.label ? (
+ <SessionLabel label={session.label} className="max-w-60" />
+ ) : (
+ <span className="text-muted">—</span>
+ )}
+ </TableCell>
<TableCell>
<Tooltip>
<TooltipTrigger asChild>
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/CreateSessionDialog.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/CreateSessionDialog.tsx
index 200a9bdb97..b74cf8ef40 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/CreateSessionDialog.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/CreateSessionDialog.tsx
@@ -47,6 +47,8 @@ const TTL_PRESETS = [
];
const DEFAULT_TTL_PRESET = "7d";
+const MAX_LABEL_LENGTH = 128;
+
const MIN_TTL_MS = 60 * 1000;
// Mirrors the API's ceiling: past it the expiry overflows and the request fails with a 500.
const MAX_TTL_MS = 100 * 365 * 24 * 60 * 60 * 1000;
@@ -85,6 +87,7 @@ export const CreateSessionDialog = ({ isOpen, onOpenChange, onCreated }: Props)
const [selectedBundle, setSelectedBundle] = useState<TAgentVaultAccessBundleListItem | null>(
null
);
+ const [label, setLabel] = useState("");
const [ttlPreset, setTtlPreset] = useState(DEFAULT_TTL_PRESET);
const [customTtl, setCustomTtl] = useState("");
const customTtlInputRef = useRef<HTMLInputElement>(null);
@@ -99,6 +102,7 @@ export const CreateSessionDialog = ({ isOpen, onOpenChange, onCreated }: Props)
useEffect(() => {
if (isOpen) {
setSelectedBundle(null);
+ setLabel("");
setTtlPreset(DEFAULT_TTL_PRESET);
setCustomTtl("");
}
@@ -110,7 +114,8 @@ export const CreateSessionDialog = ({ isOpen, onOpenChange, onCreated }: Props)
try {
const session = await createSession.mutateAsync({
accessBundles: [selectedBundle.name],
- ttl
+ ttl,
+ label: label.trim() || undefined
});
createNotification({ text: "Session created", type: "success" });
onCreated(session);
@@ -167,6 +172,20 @@ export const CreateSessionDialog = ({ isOpen, onOpenChange, onCreated }: Props)
</FieldContent>
</Field>
+ <Field>
+ <FieldLabel htmlFor="agent-vault-session-label">Label</FieldLabel>
+ <FieldContent>
+ <Input
+ id="agent-vault-session-label"
+ value={label}
+ onChange={(e) => setLabel(e.target.value)}
+ maxLength={MAX_LABEL_LENGTH}
+ placeholder="Nightly deploy"
+ />
+ <FieldDescription>Optional. Describes what this session is for.</FieldDescription>
+ </FieldContent>
+ </Field>
+
<Field>
<FieldLabel>Expires</FieldLabel>
<FieldContent>
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx
index af0bad9751..1798a1b028 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionDetailSheet.tsx
@@ -26,6 +26,7 @@ import { TAgentVaultSession } from "@app/hooks/api/agentVault/types";
import { useAgentVaultSheetState } from "@app/hooks/useAgentVaultSheetState";
import { SessionExpiry } from "./SessionExpiry";
+import { SessionLabel } from "./SessionLabel";
import { SessionLogsPanel } from "./SessionLogsPanel";
import { SessionStatusBadge } from "./SessionStatusBadge";
@@ -77,95 +78,110 @@ export const SessionDetailSheet = ({ session, isPending = false, onRevoke }: Pro
</SheetHeader>
<div className="flex min-h-0 flex-1 flex-col gap-4 p-4">
- <div className="flex shrink-0 items-center gap-4 overflow-hidden rounded-md border border-border bg-container py-3 pr-4">
- {/* -ml-px pushes each row's leading divider past the clipped edge, so a wrapped row doesn't start with one */}
- <div className="-ml-px flex min-w-0 flex-1 flex-wrap gap-y-3 *:border-l *:border-border *:px-4">
- <Detail className="min-w-0">
- <DetailLabel>{isMachineIdentity ? "Machine Identity" : "User"}</DetailLabel>
- <DetailValue
- className={twMerge("flex items-center gap-2", isOwnerDeleted && "text-muted")}
- >
- {isMachineIdentity ? (
- <BotIcon className="size-4 shrink-0 text-muted" />
- ) : (
- <UserIcon className="size-4 shrink-0 text-muted" />
- )}
- <span className="truncate">
- {memberDisplayName(session.actor)}
- {isOwnerDeleted && " (deleted)"}
- </span>
- {!isMachineIdentity && (
- <span className="truncate text-muted">{memberSubtitle(session.actor)}</span>
- )}
- </DetailValue>
- </Detail>
- <Detail className="min-w-0">
- <DetailLabel>
- {session.accessBundles.length === 1 ? "Access Bundle" : "Access Bundles"}
- </DetailLabel>
- <DetailValue className="flex flex-wrap gap-x-4 gap-y-1">
- {session.accessBundles.map((bundle) =>
- bundle.id ? (
- <Link
- key={bundle.id}
- to="/organizations/$orgId/agent-vault/access-bundles/$accessBundleId"
- params={{ orgId: currentOrg.id, accessBundleId: bundle.id }}
- className="group flex min-w-0 items-center gap-2"
- >
- <PackageIcon className="size-4 shrink-0 text-muted" />
- <span className="truncate group-hover:underline group-hover:underline-offset-2">
- {bundle.name}
- </span>
- </Link>
+ <div className="shrink-0 overflow-hidden rounded-md border border-border bg-container">
+ <div className="flex items-center gap-4 py-3 pr-4">
+ {/* -ml-px pushes each row's leading divider past the clipped edge, so a wrapped row doesn't start with one */}
+ <div className="-ml-px flex min-w-0 flex-1 flex-wrap gap-y-3 *:border-l *:border-border *:px-4">
+ <Detail className="min-w-0">
+ <DetailLabel>{isMachineIdentity ? "Machine Identity" : "User"}</DetailLabel>
+ <DetailValue
+ className={twMerge(
+ "flex items-center gap-2",
+ isOwnerDeleted && "text-muted"
+ )}
+ >
+ {isMachineIdentity ? (
+ <BotIcon className="size-4 shrink-0 text-muted" />
) : (
- <span
- key={bundle.name}
- className="flex min-w-0 items-center gap-2 text-muted"
- >
- <PackageIcon className="size-4 shrink-0" />
- <span className="truncate">{bundle.name} (deleted)</span>
+ <UserIcon className="size-4 shrink-0 text-muted" />
+ )}
+ <span className="truncate">
+ {memberDisplayName(session.actor)}
+ {isOwnerDeleted && " (deleted)"}
+ </span>
+ {!isMachineIdentity && (
+ <span className="truncate text-muted">
+ {memberSubtitle(session.actor)}
</span>
- )
- )}
- </DetailValue>
- </Detail>
- <Detail>
- <DetailLabel>Created</DetailLabel>
- <DetailValue>
- {format(new Date(session.createdAt), "MMM d, yyyy h:mm a")}
- </DetailValue>
- </Detail>
- {session.revokedAt && (
- <Detail>
- <DetailLabel>Revoked</DetailLabel>
- <DetailValue>
- {format(new Date(session.revokedAt), "MMM d, yyyy h:mm a")}
+ )}
+ </DetailValue>
+ </Detail>
+ <Detail className="min-w-0">
+ <DetailLabel>
+ {session.accessBundles.length === 1 ? "Access Bundle" : "Access Bundles"}
+ </DetailLabel>
+ <DetailValue className="flex flex-wrap gap-x-4 gap-y-1">
+ {session.accessBundles.map((bundle) =>
+ bundle.id ? (
+ <Link
+ key={bundle.id}
+ to="/organizations/$orgId/agent-vault/access-bundles/$accessBundleId"
+ params={{ orgId: currentOrg.id, accessBundleId: bundle.id }}
+ className="group flex min-w-0 items-center gap-2"
+ >
+ <PackageIcon className="size-4 shrink-0 text-muted" />
+ <span className="truncate group-hover:underline group-hover:underline-offset-2">
+ {bundle.name}
+ </span>
+ </Link>
+ ) : (
+ <span
+ key={bundle.name}
+ className="flex min-w-0 items-center gap-2 text-muted"
+ >
+ <PackageIcon className="size-4 shrink-0" />
+ <span className="truncate">{bundle.name} (deleted)</span>
+ </span>
+ )
+ )}
</DetailValue>
</Detail>
- )}
- {session.status !== AgentVaultSessionStatus.Revoked && (
<Detail>
- <DetailLabel>{hasExpired ? "Expired" : "Expires"}</DetailLabel>
+ <DetailLabel>Created</DetailLabel>
<DetailValue>
- <SessionExpiry expiresAt={session.expiresAt} />
+ {format(new Date(session.createdAt), "MMM d, yyyy h:mm a")}
</DetailValue>
</Detail>
+ {session.revokedAt && (
+ <Detail>
+ <DetailLabel>Revoked</DetailLabel>
+ <DetailValue>
+ {format(new Date(session.revokedAt), "MMM d, yyyy h:mm a")}
+ </DetailValue>
+ </Detail>
+ )}
+ {session.status !== AgentVaultSessionStatus.Revoked && (
+ <Detail>
+ <DetailLabel>{hasExpired ? "Expired" : "Expires"}</DetailLabel>
+ <DetailValue>
+ <SessionExpiry expiresAt={session.expiresAt} />
+ </DetailValue>
+ </Detail>
+ )}
+ <Detail className="items-start">
+ <DetailLabel>Status</DetailLabel>
+ <SessionStatusBadge status={session.status} />
+ </Detail>
+ </div>
+ {session.status === AgentVaultSessionStatus.Active && (
+ <Button
+ variant="danger"
+ size="sm"
+ className="shrink-0"
+ onClick={() => onRevoke(session)}
+ >
+ <BanIcon />
+ Revoke Session
+ </Button>
)}
- <Detail className="items-start">
- <DetailLabel>Status</DetailLabel>
- <SessionStatusBadge status={session.status} />
- </Detail>
</div>
- {session.status === AgentVaultSessionStatus.Active && (
- <Button
- variant="danger"
- size="sm"
- className="shrink-0"
- onClick={() => onRevoke(session)}
- >
- <BanIcon />
- Revoke Session
- </Button>
+ {session.label && (
+ <Detail className="min-w-0 border-t border-border px-4 py-3">
+ <DetailLabel>Label</DetailLabel>
+ <DetailValue className="min-w-0">
+ <SessionLabel label={session.label} />
+ </DetailValue>
+ </Detail>
)}
</div>
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionLabel.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionLabel.tsx
new file mode 100644
index 0000000000..947b5876ca
--- /dev/null
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SessionLabel.tsx
@@ -0,0 +1,27 @@
+import { useRef, useState } from "react";
+import { twMerge } from "tailwind-merge";
+
+import { Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
+
+// Opens only when the label is cut off, measured as it opens.
+export const SessionLabel = ({ label, className }: { label: string; className?: string }) => {
+ const ref = useRef<HTMLSpanElement | null>(null);
+ const [isOpen, setIsOpen] = useState(false);
+
+ return (
+ <Tooltip
+ open={isOpen}
+ onOpenChange={(next) => {
+ const el = ref.current;
+ setIsOpen(next && !!el && el.scrollWidth > el.clientWidth);
+ }}
+ >
+ <TooltipTrigger asChild>
+ <span ref={ref} className={twMerge("block truncate", className)}>
+ {label}
+ </span>
+ </TooltipTrigger>
+ <TooltipContent className="max-w-lg break-words">{label}</TooltipContent>
+ </Tooltip>
+ );
+};