Skip to content

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

fix(agent-vault): address review on the setup checklist and sample session

Scott Wilson3dad456032a5
diff --git a/frontend/AGENTS.md b/frontend/AGENTS.md
index 940c7acfda..5a8809272e 100644
--- a/frontend/AGENTS.md
+++ b/frontend/AGENTS.md
@@ -104,7 +104,7 @@ PAM and Agent Vault live at `/organizations/$orgId/<slug>` over a single implici
A new org-scoped product therefore needs: a `<product>ProjectId` on the `Organization` type, an entry in `ORG_SCOPED_PRODUCT_TYPES` and `getOrgScopedProductFromPath` (`helpers/project.ts`), and a layout `beforeLoad` that bootstraps the id, patches it into the cached org, and returns both `implicitProjectId` and `implicitProductType` (see `pages/agent-vault/layout.tsx`). Use `isOrgScopedProduct(type)` rather than adding another pathname check; the sidebar, navbar, project switcher and nav links all key off it.
-Agent Vault onboards admins through one progress source, `useAgentVaultSetupProgress` (`components/agent-vault/SetupChecklist`): proxy connected, access bundle, service, session. The sidebar checklist and the product's index route (`redirects/agent-vault-index-redirect.tsx`, which opens on the first unfinished step) both read it, so link into Agent Vault through `/organizations/$orgId/agent-vault`, not straight to a page. A checklist step only navigates; the page it lands on opens its own create dialog or sheet through `useAgentVaultCreateIntent` and a `?create=true` flag the page clears, so give any new step's page that hook rather than a dialog in the checklist. The Sessions page shows a hard-coded sample session (`SampleSessionSheet`) until the org has a real one.
+Agent Vault onboards admins through one progress source, `useAgentVaultSetupProgress` (`components/agent-vault/SetupChecklist`): proxy connected, access bundle, service, session. Its queries run only for admins, since listing every session is admin-only on the server, and it reports `nextStep` and `isFailed`. The sidebar checklist, the product's index route (`redirects/agent-vault-index-redirect.tsx`, which opens on `nextStep` and falls back to Sessions when the progress can't be read) and the sample session's setup button all read it, so link into Agent Vault through `/organizations/$orgId/agent-vault`, not straight to a page. Going to a step goes through `useOpenAgentVaultSetupStep`: the page it lands on opens its own create dialog or sheet through `useAgentVaultCreateIntent` and a `?create=true` flag the page clears, so give any new step's page that hook rather than a dialog in the checklist. The Sessions page shows a hard-coded sample session (`SampleSessionSheet`) while an admin's org has no session, or while a member has none of their own.
Certificate Manager is org-scoped too (`/organizations/$orgId/cert-manager/...`), but legacy orgs can hold several instances, so its layout resolves the project from instance state instead of an org field, through `resolveCertManagerProjectId` (`helpers/certManagerActiveProject.ts`): the `infisical-cm-active-project-<orgId>` cookie while the user is a member of that instance, else the active instance. The product switcher and the 403 page use the same helper. The layout writes the resolved id back to the cookie, because `inject-cert-manager-project-id.ts` resolves requests that name no project from it, and reloads the page when the resolved instance changes within one page load, since several cert-manager queries are not keyed by project. Consequences: anything that sends someone into a *specific* instance (the instance picker, a project-scoped identity row, a gateway's discovery row) sets that cookie first, since the URL can't say which; old `/projects/cert-manager/$projectId/...` URLs (emails and alerts sent before the move, bookmarks; the backend now links to `/cert-manager/...`, except legacy PKI Alerts V2 and the legacy-deprecation email) go through `redirects/cert-manager-project-url-redirect.tsx`, which pins the named instance and strips the id. In multi-instance orgs each tab also tags its Certificate Manager API requests with the instance it shows (`setTabCertManagerProjectId`, read by the `apiRequest` interceptor), because the cookie is shared across tabs; single-instance orgs send no project id. Shared views that pick project vs org scope from the URL use `useRouteProjectId()`, which also returns Certificate Manager's implicit project.
diff --git a/frontend/src/components/agent-vault/SetupChecklist/SetupChecklist.tsx b/frontend/src/components/agent-vault/SetupChecklist/SetupChecklist.tsx
index f74a0f5fc8..c592c8eb93 100644
--- a/frontend/src/components/agent-vault/SetupChecklist/SetupChecklist.tsx
+++ b/frontend/src/components/agent-vault/SetupChecklist/SetupChecklist.tsx
@@ -1,89 +1,64 @@
-import { useLocation, useNavigate } from "@tanstack/react-router";
import { CheckIcon, XIcon } from "lucide-react";
import { twMerge } from "tailwind-merge";
import { IconButton, Tooltip, TooltipContent, TooltipTrigger } from "@app/components/v3";
-import { useOrganization } from "@app/context";
-import { useAgentVaultSetupProgress } from "./useAgentVaultSetupProgress";
+import { AgentVaultSetupStep, TAgentVaultSetupProgress } from "./useAgentVaultSetupProgress";
+import { useOpenAgentVaultSetupStep } from "./useOpenAgentVaultSetupStep";
type Step = {
+ step: AgentVaultSetupStep;
title: string;
description: string;
isComplete: boolean;
isBlocked?: boolean;
- pathSuffix: string;
- opensCreate?: boolean;
};
type Props = {
- progress: ReturnType<typeof useAgentVaultSetupProgress>;
+ progress: TAgentVaultSetupProgress;
};
// Each step takes the admin to the page that owns the action and opens it there, so the page behind the
// dialog is always the one they are setting up.
export const SetupChecklist = ({ progress }: Props) => {
- const navigate = useNavigate();
- const { pathname } = useLocation();
- const { currentOrg } = useOrganization();
+ const openStep = useOpenAgentVaultSetupStep(progress);
const { hasProxy, hasConnectedProxy, newestBundle, hasService, hasSession, completedCount } =
progress;
- const basePath = `/organizations/${currentOrg.id}/agent-vault`;
- const isOn = (pathSuffix: string) => pathname === `${basePath}/${pathSuffix}`;
-
const steps: Step[] = [
{
+ step: AgentVaultSetupStep.Proxy,
title: "Set Up a Proxy",
description:
hasProxy && !hasConnectedProxy
? "Waiting for your proxy to connect. Start it with its proxy token where agent traffic leaves your network."
: "Agents send requests through a proxy, which attaches the credentials.",
- isComplete: hasConnectedProxy,
- pathSuffix: "proxies",
- opensCreate: !hasProxy
+ isComplete: hasConnectedProxy
},
{
+ step: AgentVaultSetupStep.AccessBundle,
title: "Create an Access Bundle",
description: "A bundle groups the services an agent can reach.",
- isComplete: Boolean(newestBundle),
- pathSuffix: "access-bundles",
- opensCreate: true
+ isComplete: Boolean(newestBundle)
},
{
+ step: AgentVaultSetupStep.Service,
title: "Add a Service",
description: "Name an API the agent can call and the credential to attach.",
isComplete: hasService,
- isBlocked: !newestBundle,
- pathSuffix: newestBundle ? `access-bundles/${newestBundle.id}` : "access-bundles",
- opensCreate: true
+ isBlocked: !newestBundle
},
{
+ step: AgentVaultSetupStep.Session,
title: "Create a Session",
description: "Get a token an agent runs with.",
isComplete: hasSession,
- isBlocked: !newestBundle,
- pathSuffix: "sessions",
- opensCreate: true
+ isBlocked: !newestBundle
}
];
- // Replacing rather than pushing when already there, since the same URL again would duplicate the
- // history entry.
- const goTo = (step: Step) => {
- const isHere = isOn(step.pathSuffix);
- if (isHere && !step.opensCreate) return;
- navigate({
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- to: `${basePath}/${step.pathSuffix}` as any,
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
- search: (step.opensCreate ? { create: true } : {}) as any,
- replace: isHere
- });
- };
-
- const nextIndex = steps.findIndex((step) => !step.isComplete && !step.isBlocked);
+ const nextIndex = steps.findIndex((step) => step.step === progress.nextStep);
if (!progress.isVisible) return null;
@@ -130,7 +105,7 @@ export const SetupChecklist = ({ progress }: Props) => {
<button
type="button"
disabled={step.isComplete || step.isBlocked}
- onClick={() => goTo(step)}
+ onClick={() => openStep(step.step)}
className="flex w-full cursor-pointer items-start gap-2 rounded-sm px-1.5 py-1.5 text-left outline-none hover:bg-container-hover focus-visible:ring-2 focus-visible:ring-ring disabled:cursor-default disabled:hover:bg-transparent"
>
<span
diff --git a/frontend/src/components/agent-vault/SetupChecklist/index.ts b/frontend/src/components/agent-vault/SetupChecklist/index.ts
index 7e7c87d957..5096b8cd7f 100644
--- a/frontend/src/components/agent-vault/SetupChecklist/index.ts
+++ b/frontend/src/components/agent-vault/SetupChecklist/index.ts
@@ -1,2 +1,8 @@
export { SetupChecklist } from "./SetupChecklist";
-export { useAgentVaultSetupProgress } from "./useAgentVaultSetupProgress";
+export {
+ AgentVaultSetupStep,
+ getAgentVaultSetupStepPath,
+ type TAgentVaultSetupProgress,
+ useAgentVaultSetupProgress
+} from "./useAgentVaultSetupProgress";
+export { useOpenAgentVaultSetupStep } from "./useOpenAgentVaultSetupStep";
diff --git a/frontend/src/components/agent-vault/SetupChecklist/useAgentVaultSetupProgress.ts b/frontend/src/components/agent-vault/SetupChecklist/useAgentVaultSetupProgress.ts
index bdb1702ec6..c3487134d9 100644
--- a/frontend/src/components/agent-vault/SetupChecklist/useAgentVaultSetupProgress.ts
+++ b/frontend/src/components/agent-vault/SetupChecklist/useAgentVaultSetupProgress.ts
@@ -13,45 +13,65 @@ const DISMISSED_STORAGE_KEY = "agentVaultSetupChecklistDismissed";
// Stable identity: useLocalStorageState re-runs its seeding effect whenever this changes.
const NOTHING_DISMISSED: Record<string, boolean | undefined> = {};
+// The API allows at most 10 proxies per org (AGENT_VAULT_MAX_PROXIES_PER_ORG), so one page holds them all.
+const PROXY_PAGE_SIZE = 20;
+
+export enum AgentVaultSetupStep {
+ Proxy = "proxy",
+ AccessBundle = "access-bundle",
+ Service = "service",
+ Session = "session"
+}
+
+// Only admins can set Agent Vault up, and listing every session is admin-only on the server, so none
+// of these queries runs for a member.
export const useAgentVaultSetupProgress = () => {
const { currentOrg } = useOrganization();
const { hasProjectRole } = useProjectPermission();
const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);
- const { data: proxies } = useListAgentVaultProxies({ limit: 20 });
- const { data: newestBundles } = useListAgentVaultAccessBundles({
- orderBy: "createdAt",
- orderDirection: "desc",
- limit: 1
- });
- const { data: fullestBundles } = useListAgentVaultAccessBundles({
- orderBy: "serviceCount",
- orderDirection: "desc",
- limit: 1
- });
- const { data: sessions } = useListAgentVaultSessions({
- scope: AgentVaultSessionScope.All,
- limit: 1
- });
+ const proxies = useListAgentVaultProxies({ limit: PROXY_PAGE_SIZE }, isAdmin);
+ const newestBundles = useListAgentVaultAccessBundles(
+ { orderBy: "createdAt", orderDirection: "desc", limit: 1 },
+ isAdmin
+ );
+ const fullestBundles = useListAgentVaultAccessBundles(
+ { orderBy: "serviceCount", orderDirection: "desc", limit: 1 },
+ isAdmin
+ );
+ const sessions = useListAgentVaultSessions(
+ { scope: AgentVaultSessionScope.All, limit: 1 },
+ isAdmin
+ );
+ const queries = [proxies, newestBundles, fullestBundles, sessions];
const [dismissed, setDismissed] = useLocalStorageState(DISMISSED_STORAGE_KEY, NOTHING_DISMISSED);
const isDismissed = Boolean(dismissed?.[currentOrg.id]);
- const isLoaded = Boolean(proxies && newestBundles && fullestBundles && sessions);
- const hasProxy = (proxies?.totalCount ?? 0) > 0;
- const hasConnectedProxy = Boolean(proxies?.proxies.some((proxy) => proxy.heartbeat));
- const newestBundle = newestBundles?.accessBundles[0];
- const hasService = (fullestBundles?.accessBundles[0]?.serviceCount ?? 0) > 0;
- const hasSession = (sessions?.totalCount ?? 0) > 0;
+ const isLoaded = queries.every((query) => Boolean(query.data));
+ // A query with no data left after its retries would otherwise hold every caller waiting forever.
+ const isFailed = queries.some((query) => query.isError && !query.data);
+ const hasProxy = (proxies.data?.totalCount ?? 0) > 0;
+ const hasConnectedProxy = Boolean(proxies.data?.proxies.some((proxy) => proxy.heartbeat));
+ const newestBundle = newestBundles.data?.accessBundles[0];
+ const hasService = (fullestBundles.data?.accessBundles[0]?.serviceCount ?? 0) > 0;
+ const hasSession = (sessions.data?.totalCount ?? 0) > 0;
const completedCount = [hasConnectedProxy, Boolean(newestBundle), hasService, hasSession].filter(
Boolean
).length;
+ let nextStep: AgentVaultSetupStep | null = null;
+ if (!hasConnectedProxy) nextStep = AgentVaultSetupStep.Proxy;
+ else if (!newestBundle) nextStep = AgentVaultSetupStep.AccessBundle;
+ else if (!hasService) nextStep = AgentVaultSetupStep.Service;
+ else if (!hasSession) nextStep = AgentVaultSetupStep.Session;
+
const isIncomplete = isAdmin && isLoaded && completedCount < 4;
return {
isAdmin,
isLoaded,
+ isFailed,
isVisible: isIncomplete && !isDismissed,
canRestore: isIncomplete && isDismissed,
dismiss: () => setDismissed((current) => ({ ...current, [currentOrg.id]: true })),
@@ -61,6 +81,27 @@ export const useAgentVaultSetupProgress = () => {
newestBundle,
hasService,
hasSession,
- completedCount
+ completedCount,
+ nextStep: isLoaded ? nextStep : null
};
};
+
+export type TAgentVaultSetupProgress = ReturnType<typeof useAgentVaultSetupProgress>;
+
+// The page that owns a step, relative to the product root. The Service step needs a bundle to land on.
+export const getAgentVaultSetupStepPath = (
+ step: AgentVaultSetupStep,
+ newestBundleId?: string
+): string => {
+ if (step === AgentVaultSetupStep.Proxy) return "proxies";
+ if (step === AgentVaultSetupStep.Service && newestBundleId)
+ return `access-bundles/${newestBundleId}`;
+ if (step === AgentVaultSetupStep.Session) return "sessions";
+ return "access-bundles";
+};
+
+// A created-but-unconnected proxy has nothing left to create, so its step only opens the page.
+export const doesAgentVaultSetupStepOpenCreate = (
+ step: AgentVaultSetupStep,
+ progress: Pick<TAgentVaultSetupProgress, "hasProxy">
+) => step !== AgentVaultSetupStep.Proxy || !progress.hasProxy;
diff --git a/frontend/src/components/agent-vault/SetupChecklist/useOpenAgentVaultSetupStep.ts b/frontend/src/components/agent-vault/SetupChecklist/useOpenAgentVaultSetupStep.ts
new file mode 100644
index 0000000000..e0401773e3
--- /dev/null
+++ b/frontend/src/components/agent-vault/SetupChecklist/useOpenAgentVaultSetupStep.ts
@@ -0,0 +1,38 @@
+import { useLocation, useNavigate } from "@tanstack/react-router";
+
+import { useOrganization } from "@app/context";
+
+import {
+ AgentVaultSetupStep,
+ doesAgentVaultSetupStepOpenCreate,
+ getAgentVaultSetupStepPath,
+ TAgentVaultSetupProgress
+} from "./useAgentVaultSetupProgress";
+
+// Goes to the page that owns a step and has that page open its create flow (see
+// useAgentVaultCreateIntent).
+export const useOpenAgentVaultSetupStep = (
+ progress: Pick<TAgentVaultSetupProgress, "hasProxy" | "newestBundle">
+) => {
+ const navigate = useNavigate();
+ const { pathname } = useLocation();
+ const { currentOrg } = useOrganization();
+
+ return (step: AgentVaultSetupStep) => {
+ const path = `/organizations/${currentOrg.id}/agent-vault/${getAgentVaultSetupStepPath(
+ step,
+ progress.newestBundle?.id
+ )}`;
+ const opensCreate = doesAgentVaultSetupStepOpenCreate(step, progress);
+ const isHere = pathname === path;
+ if (isHere && !opensCreate) return;
+ navigate({
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ to: path as any,
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ search: (opensCreate ? { create: true } : {}) as any,
+ // The same URL again would push a duplicate history entry.
+ replace: isHere
+ });
+ };
+};
diff --git a/frontend/src/hooks/api/agentVault/queries.tsx b/frontend/src/hooks/api/agentVault/queries.tsx
index 61afbfcae8..8e6eb5e394 100644
--- a/frontend/src/hooks/api/agentVault/queries.tsx
+++ b/frontend/src/hooks/api/agentVault/queries.tsx
@@ -203,11 +203,15 @@ export const useListAgentVaultAccessBundleMembers = (
});
};
-export const useListAgentVaultAccessBundles = (params: TListAgentVaultAccessBundlesDTO = {}) => {
+export const useListAgentVaultAccessBundles = (
+ params: TListAgentVaultAccessBundlesDTO = {},
+ enabled = true
+) => {
const { currentOrg } = useOrganization();
return useQuery({
queryKey: agentVaultKeys.accessBundleList(currentOrg.id, params),
+ enabled,
queryFn: async () => {
const { data } = await apiRequest.get<{
accessBundles: TAgentVaultAccessBundleListItem[];
@@ -242,11 +246,12 @@ export const useGetAgentVaultAccessBundle = (accessBundleId: string) => {
});
};
-export const useListAgentVaultSessions = (params?: TListAgentVaultSessionsDTO) => {
+export const useListAgentVaultSessions = (params?: TListAgentVaultSessionsDTO, enabled = true) => {
const { currentOrg } = useOrganization();
return useQuery({
queryKey: agentVaultKeys.sessionList(currentOrg.id, params),
+ enabled,
queryFn: async () => {
const { statuses, ...rest } = params ?? {};
const { data } = await apiRequest.get<{
@@ -262,11 +267,15 @@ export const useListAgentVaultSessions = (params?: TListAgentVaultSessionsDTO) =
});
};
-export const useListAgentVaultProxies = (params: TListAgentVaultProxiesDTO = {}) => {
+export const useListAgentVaultProxies = (
+ params: TListAgentVaultProxiesDTO = {},
+ enabled = true
+) => {
const { currentOrg } = useOrganization();
return useQuery({
queryKey: agentVaultKeys.proxyList(currentOrg.id, params),
+ enabled,
queryFn: async () => {
const { data } = await apiRequest.get<{ proxies: TAgentVaultProxy[]; totalCount: number }>(
"/api/v1/agent-vault/proxies",
diff --git a/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/AgentVaultAccessBundleDetailPage.tsx b/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/AgentVaultAccessBundleDetailPage.tsx
index 4ecf4ad3fc..261c224849 100644
--- a/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/AgentVaultAccessBundleDetailPage.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultAccessBundleDetailPage/AgentVaultAccessBundleDetailPage.tsx
@@ -64,10 +64,11 @@ export const AgentVaultAccessBundleDetailPage = () => {
const needsSetup = (accessBundle?.services ?? []).filter(
(service) => service.personalValues && !service.personalValues.isConfigured
);
- const { data: sessions } = useListAgentVaultSessions({
- scope: AgentVaultSessionScope.All,
- limit: 1
- });
+ // Listing every session is admin-only, and only admins see the note that reads this.
+ const { data: sessions } = useListAgentVaultSessions(
+ { scope: AgentVaultSessionScope.All, limit: 1 },
+ isAdmin
+ );
const [isEditOpen, setIsEditOpen] = useState(false);
const [isManageAccessOpen, setIsManageAccessOpen] = useState(false);
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
index 6ea7fd6ab3..ba2a9373b8 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/AgentVaultSessionsPage.tsx
@@ -20,6 +20,11 @@ import {
import { AgentVaultSessionLogUpgradeModal } from "@app/components/agent-vault/AgentVaultSessionLogUpgradeModal";
import { memberDisplayName, memberSubtitle } from "@app/components/agent-vault/MemberName";
+import {
+ AgentVaultSetupStep,
+ useAgentVaultSetupProgress,
+ useOpenAgentVaultSetupStep
+} from "@app/components/agent-vault/SetupChecklist";
import {
Alert,
AlertAction,
@@ -169,6 +174,18 @@ export const AgentVaultSessionsPage = () => {
const hasReachableBundles = (accessBundles?.totalCount ?? 0) > 0;
useAgentVaultCreateIntent(() => setIsCreateDialogOpen(true), hasReachableBundles);
+ const setupProgress = useAgentVaultSetupProgress();
+ const openSetupStep = useOpenAgentVaultSetupStep(setupProgress);
+ // An admin sees the sample only while the org has no session at all. A member can't list the org's
+ // sessions, so they see it while they have none of their own.
+ const isSampleShown =
+ !isFiltered && (!isAdmin || (setupProgress.isLoaded && !setupProgress.hasSession));
+ const startSetup = () => {
+ setupProgress.restore();
+ setIsSampleOpen(false);
+ openSetupStep(setupProgress.nextStep ?? AgentVaultSetupStep.Session);
+ };
+
let emptyTitle: string;
let emptyDescription: string;
if (isFiltered) {
@@ -184,8 +201,7 @@ export const AgentVaultSessionsPage = () => {
emptyDescription = "Create a session to get a token an agent can run with.";
}
- // Until there is anything to list, a sample session shows what one records.
- const emptyState = isFiltered ? (
+ const emptyState = !isSampleShown ? (
<CardContent>
<Empty className="border">
<EmptyHeader>
@@ -573,7 +589,11 @@ export const AgentVaultSessionsPage = () => {
}}
/>
- <SampleSessionSheet isOpen={isSampleOpen} onOpenChange={setIsSampleOpen} />
+ <SampleSessionSheet
+ isOpen={isSampleOpen}
+ onOpenChange={setIsSampleOpen}
+ onSetUp={isAdmin ? startSetup : undefined}
+ />
<SessionDetailSheet
session={openSession}
diff --git a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SampleSessionSheet.tsx b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SampleSessionSheet.tsx
index 05563a7f4f..077bf5a4ef 100644
--- a/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SampleSessionSheet.tsx
+++ b/frontend/src/pages/agent-vault/AgentVaultSessionsPage/components/SampleSessionSheet.tsx
@@ -1,5 +1,4 @@
import { useEffect, useMemo, useState } from "react";
-import { useNavigate } from "@tanstack/react-router";
import { ArrowRightIcon, BotIcon, PackageIcon, SparklesIcon } from "lucide-react";
import {
@@ -25,10 +24,8 @@ import {
TableHeader,
TableRow
} from "@app/components/v3";
-import { useOrganization, useProjectPermission } from "@app/context";
import { AgentVaultSessionLogDecision, AgentVaultSessionStatus } from "@app/hooks/api/agentVault";
import { TAgentVaultSessionLogRecord } from "@app/hooks/api/agentVault/types";
-import { ProjectMembershipRole } from "@app/hooks/api/roles/types";
import { LiveStateBadge } from "./LiveStatusRow";
import { SessionLogRow } from "./SessionLogRow";
@@ -166,14 +163,10 @@ const HeaderPanel = ({
type Props = {
isOpen: boolean;
onOpenChange: (isOpen: boolean) => void;
+ onSetUp?: () => void;
};
-export const SampleSessionSheet = ({ isOpen, onOpenChange }: Props) => {
- const navigate = useNavigate();
- const { currentOrg } = useOrganization();
- const { hasProjectRole } = useProjectPermission();
- const isAdmin = hasProjectRole(ProjectMembershipRole.Admin);
-
+export const SampleSessionSheet = ({ isOpen, onOpenChange, onSetUp }: Props) => {
const [openedAt, setOpenedAt] = useState(() => Date.now());
const [visibleCount, setVisibleCount] = useState(0);
const records = useMemo(() => buildSampleRecords(openedAt), [openedAt]);
@@ -322,17 +315,8 @@ export const SampleSessionSheet = ({ isOpen, onOpenChange }: Props) => {
The proxy attached a credential to each brokered request. Blocked requests were not
forwarded.
</span>
- {isAdmin && (
- <Button
- variant="av"
- onClick={() => {
- onOpenChange(false);
- navigate({
- to: "/organizations/$orgId/agent-vault",
- params: { orgId: currentOrg.id }
- });
- }}
- >
+ {onSetUp && (
+ <Button variant="av" onClick={onSetUp}>
Set Up Your Own
</Button>
)}
diff --git a/frontend/src/pages/redirects/agent-vault-index-redirect.tsx b/frontend/src/pages/redirects/agent-vault-index-redirect.tsx
index 97ffa7b0da..96fc57ec28 100644
--- a/frontend/src/pages/redirects/agent-vault-index-redirect.tsx
+++ b/frontend/src/pages/redirects/agent-vault-index-redirect.tsx
@@ -1,35 +1,31 @@
import { useEffect } from "react";
import { createFileRoute, useNavigate } from "@tanstack/react-router";
-import { useAgentVaultSetupProgress } from "@app/components/agent-vault/SetupChecklist";
+import {
+ getAgentVaultSetupStepPath,
+ useAgentVaultSetupProgress
+} from "@app/components/agent-vault/SetupChecklist";
import { PageLoader } from "@app/components/v3";
import { useOrganization } from "@app/context";
// Until an admin finishes setup (or hides the checklist), the product opens on the first unfinished step.
+// If the progress can't be read, it opens on Sessions as it did before the checklist existed.
const AgentVaultIndexRedirect = () => {
const navigate = useNavigate();
const { currentOrg } = useOrganization();
- const progress = useAgentVaultSetupProgress();
- const { isAdmin, isLoaded, isVisible, hasConnectedProxy, newestBundle, hasService } = progress;
- const isResolved = !isAdmin || isLoaded;
+ const { isAdmin, isLoaded, isFailed, isVisible, nextStep, newestBundle } =
+ useAgentVaultSetupProgress();
+ const isResolved = !isAdmin || isLoaded || isFailed;
useEffect(() => {
if (!isResolved) return;
- const params = { orgId: currentOrg.id };
-
- if (isVisible && !hasConnectedProxy) {
- navigate({ to: "/organizations/$orgId/agent-vault/proxies", params, replace: true });
- } else if (isVisible && !newestBundle) {
- navigate({ to: "/organizations/$orgId/agent-vault/access-bundles", params, replace: true });
- } else if (isVisible && newestBundle && !hasService) {
- navigate({
- to: "/organizations/$orgId/agent-vault/access-bundles/$accessBundleId",
- params: { ...params, accessBundleId: newestBundle.id },
- replace: true
- });
- } else {
- navigate({ to: "/organizations/$orgId/agent-vault/sessions", params, replace: true });
- }
+ const pathSuffix =
+ isVisible && nextStep ? getAgentVaultSetupStepPath(nextStep, newestBundle?.id) : "sessions";
+ navigate({
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ to: `/organizations/${currentOrg.id}/agent-vault/${pathSuffix}` as any,
+ replace: true
+ });
}, [isResolved]);
return <PageLoader />;