-
-
-
-
Company Secrets
-
-
- Encrypted values that agents can reference from environment variables.
- Rotate to change a secret's value; delete to remove it from the company
- library.
-
-
-
-
-
- {secrets?.length ?? 0} secret{secrets?.length === 1 ? "" : "s"}
-
-
setDialog({ kind: "create" })}
- disabled={!selectedCompanyId}
- >
- New secret
-
-
-
-
- {isLoading ? (
-
Loading…
- ) : !secrets || secrets.length === 0 ? (
-
- No secrets yet. Use New secret to
- create one, or seal a plain env var from the agent configuration page.
-
- ) : (
-
- {secrets.map((secret) => (
-
-
-
{secret.name}
- {secret.description ? (
-
- {secret.description}
-
- ) : null}
-
- v{secret.latestVersion} · last rotated{" "}
- {relativeTime(secret.updatedAt)}
-
-
-
-
setDialog({ kind: "rotate", secret })}
- title="Rotate value"
- >
-
-
-
setDialog({ kind: "edit", secret })}
- title="Edit name and description"
- >
-
-
-
setDialog({ kind: "delete", secret })}
- title="Delete secret"
- className="text-muted-foreground hover:text-destructive"
- >
-
-
-
-
- ))}
-
- )}
-
-
- {dialog.kind === "create" && selectedCompanyId ? (
-
setDialog({ kind: "closed" })}
- onCreated={(name) => {
- pushToast({ tone: "success", title: `Secret "${name}" created` });
- invalidateList();
- setDialog({ kind: "closed" });
- }}
- onError={(error) => handleApiError(error, "Failed to create secret")}
- />
- ) : null}
-
- {dialog.kind === "rotate" ? (
- setDialog({ kind: "closed" })}
- onRotated={() => {
- pushToast({
- tone: "success",
- title: `Secret "${dialog.secret.name}" rotated`,
- });
- invalidateList();
- setDialog({ kind: "closed" });
- }}
- onError={(error) => handleApiError(error, "Failed to rotate secret")}
- />
- ) : null}
-
- {dialog.kind === "edit" ? (
- setDialog({ kind: "closed" })}
- onSaved={(name) => {
- pushToast({ tone: "success", title: `Secret "${name}" updated` });
- invalidateList();
- setDialog({ kind: "closed" });
- }}
- onError={(error) => handleApiError(error, "Failed to update secret")}
- />
- ) : null}
-
- {dialog.kind === "delete" ? (
- setDialog({ kind: "closed" })}
- onDeleted={() => {
- pushToast({
- tone: "success",
- title: `Secret "${dialog.secret.name}" deleted`,
- });
- invalidateList();
- setDialog({ kind: "closed" });
- }}
- />
- ) : null}
-
- );
-}
-
-function CreateSecretDialog({
- companyId,
- onClose,
- onCreated,
- onError,
-}: {
- companyId: string;
- onClose: () => void;
- onCreated: (name: string) => void;
- onError: (error: unknown) => void;
-}) {
- const [name, setName] = useState("");
- const [value, setValue] = useState("");
- const [description, setDescription] = useState("");
-
- const create = useMutation({
- mutationFn: () =>
- secretsApi.create(companyId, {
- name: name.trim(),
- value,
- description: description.trim() || null,
- }),
- onSuccess: () => onCreated(name.trim()),
- onError,
- });
-
- return (
-