Record provider auth sessions

This commit is contained in:
ZacharyZhang-NY committed 2026-05-23 23:03:09 -04:00
1 parent 216d485c58
commit 648544114a
16 files changed
+280 -14

No files matched your search

@@ -65,6 +65,7 @@ export function SettingsPage({ snapshot, actions }: PageProps) {
const employees = useMemo(() => snapshot.employees.filter((item) => item.orgId === orgId), [snapshot.employees, orgId]);
const agents = useMemo(() => snapshot.agents.filter((item) => item.orgId === orgId), [snapshot.agents, orgId]);
const providers = useMemo(() => snapshot.providers.filter((item) => item.orgId === orgId), [snapshot.providers, orgId]);
const providerAuthProfiles = useMemo(() => snapshot.providerAuthProfiles.filter((item) => item.orgId === orgId), [snapshot.providerAuthProfiles, orgId]);
const providerRateLimits = useMemo(() => snapshot.providerRateLimits.filter((item) => item.orgId === orgId), [snapshot.providerRateLimits, orgId]);
const skills = useMemo(() => snapshot.skillDefinitions.filter((item) => item.orgId === orgId), [snapshot.skillDefinitions, orgId]);
const skillRevisions = useMemo(() => {
@@ -137,6 +138,7 @@ export function SettingsPage({ snapshot, actions }: PageProps) {
orgId={orgId}
employeeId={employee.id}
providers={providers}
authProfiles={providerAuthProfiles}
catalog={snapshot.providerCatalog}
agents={agents}
workspaces={workspaces}
@@ -4,6 +4,7 @@ import { Dialog } from "../../shared/Dialog";
import type {
AgentRecord,
ProviderCatalogEntry,
ProviderAuthProfileRecord,
ProviderRateLimitStateRecord,
ProviderRecord,
ProviderRequestRecord,
@@ -18,6 +19,7 @@ interface ProvidersPanelProps {
orgId: string;
employeeId: string;
providers: ProviderRecord[];
authProfiles: ProviderAuthProfileRecord[];
catalog: ProviderCatalogEntry[];
agents: AgentRecord[];
workspaces: WorkspaceRecord[];
@@ -37,7 +39,7 @@ const CLOUD_DEFAULTS: CloudFields = { baseUrl: "", region: "", projectId: "", de
const POLICY_GRID = "minmax(150px, 1.2fr) minmax(118px, 0.8fr) minmax(140px, 1fr) 112px 124px 92px";
type WorkspaceScope = "organization" | "workspace";
export function ProvidersPanel({ orgId, employeeId, providers, catalog, agents, workspaces, providerRateLimits, providerRequests, actions }: ProvidersPanelProps) {
export function ProvidersPanel({ orgId, employeeId, providers, authProfiles, catalog, agents, workspaces, providerRateLimits, providerRequests, actions }: ProvidersPanelProps) {
const [active, setActive] = useState<ProviderRecord | null>(null);
const [signInLaunched, setSignInLaunched] = useState(false);
const connected = providers.filter((provider) => provider.enabled);
@@ -59,6 +61,7 @@ export function ProvidersPanel({ orgId, employeeId, providers, catalog, agents,
providerId: active.id,
secret,
model: String(form.get("model") ?? "").trim() || null,
employeeId,
})).then((result) => { if (result) close(); });
};
@@ -81,6 +84,7 @@ export function ProvidersPanel({ orgId, employeeId, providers, catalog, agents,
<ProviderRow
key={provider.id}
provider={provider}
authProfile={authProfiles.find((profile) => profile.providerId === provider.id && profile.active) ?? null}
agents={agents}
onCheck={() => void actions.run(() => window.agentCompany.checkProviderHealth({ orgId, providerId: provider.id }))}
onManage={() => setActive(provider)}
@@ -388,12 +392,14 @@ function composeSecret(entry: ProviderCatalogEntry, form: FormData): string {
function ProviderRow({
provider,
authProfile,
agents,
onCheck,
onManage,
onRevoke,
}: {
provider: ProviderRecord;
authProfile: ProviderAuthProfileRecord | null;
agents: AgentRecord[];
onCheck: () => void;
onManage: () => void;
@@ -415,8 +421,8 @@ function ProviderRow({
<ProviderLogo label={provider.label} />
<div style={{ flex: 1, minWidth: 0 }}>
<div style={{ fontSize: 13.5, fontWeight: 540, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>{provider.label}</div>
<div style={{ fontSize: 12, color: "var(--text-3)" }}>
{provider.model ? `${provider.model} · ` : ""}{readableAuth(provider.authType)}
<div style={{ fontSize: 12, color: "var(--text-3)", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }}>
{provider.model ? `${provider.model} · ` : ""}{readableAuth(provider.authType)}{authProfile ? ` · ${authProfile.sourceType}` : ""}
</div>
</div>
<ProviderHealth provider={provider} />