import { useEffect, useState } from "react"; import type { ConnectorRecord } from "@shared/types"; import { findConnectorCatalogEntry } from "@shared/connector-catalog"; import type { CredentialSummary } from "@shared/contracts/schemas-credentials"; import { InlineNotice, StatusPill } from "./ui"; const AUTH_KIND_LABEL: Record = { oauth: "OAuth", api_key: "API key", aws: "AWS", azure: "Azure", gcp_adc: "Google Vertex (ADC)", }; /** * Legacy connector detail view. Real configuration happens in * Settings → Providers. Here we only surface catalog metadata and the current * credential status pulled from the pi-mono credential store. */ export function ConnectorEditor({ connector, }: { connector: ConnectorRecord; onSaved: () => Promise; }) { const [credential, setCredential] = useState(null); const [error, setError] = useState(null); const catalog = findConnectorCatalogEntry(connector.id); useEffect(() => { const desktop = window.agentCompany; if (!desktop) return; let cancelled = false; const refresh = async () => { const result = await desktop.listCredentials(); if (cancelled) return; if (!result.ok) { setError(result.error.message); return; } setCredential(result.data.find((row) => row.connectorId === connector.id) ?? null); }; void refresh(); const unsubscribe = desktop.subscribe((event) => { if (event.type !== "credentials-changed") return; void refresh(); }); return () => { cancelled = true; unsubscribe(); }; }, [connector.id]); return (
{error ? : null}
Status
{credential ? credential.status : "not configured"}
Auth
{catalog ? AUTH_KIND_LABEL[catalog.auth.type] ?? catalog.auth.type : "Unknown"}
Provider id
{catalog?.provider ?? connector.id}
{catalog?.description ? (
Description
{catalog.description}
) : null} {catalog?.notes ? (
Notes
{catalog.notes}
) : null}
Manage credentials in Settings → Providers. Status and OAuth flows are handled by the pi-mono credential store.
{credential?.lastError ? (
Latest credential error
{credential.lastError}
) : null}
); }