import type { HumanInputSecretAnswerResult } from "@opengeni/sdk"; import { FileLockIcon, LockIcon } from "lucide-react"; import { Fragment, type ReactNode } from "react"; import { cn } from "../lib/cn"; import { useSecretsUi, type SecretReferenceLike, type SecretsUi } from "../secrets-ui"; import { secretReferenceLabel } from "../secret-reference-label"; import { useOpenGeniText } from "../messages/runtime"; export { secretReferenceLabel, secretReferenceLabelText, type SecretReferenceLabel, } from "../secret-reference-label"; /* Secret references (`{{secret:GitHub/password}}`) read as small chips: a lock glyph and the item and field, with the exact reference on hover. Parsing only: a chip never resolves or shows a value. */ const CHIP_CLASS = // em-relative so one chip reads right in prose, payload mono runs and titles. "og-secret-chip inline-flex max-w-full min-w-0 items-center gap-[0.3em] rounded-full border border-og-border bg-og-surface-2 px-[0.5em] align-baseline font-og-sans text-[0.9em] leading-[1.45] font-medium not-italic text-og-fg no-underline [overflow-wrap:normal] [word-break:normal]"; function SecretChipFrame({ icon, primary, suffix, title, srPrefix, href, className, dataAttributes, }: { icon: "lock" | "file"; primary: string; suffix: string; title: string; srPrefix: string; href?: string | null | undefined; className?: string | undefined; dataAttributes?: Record | undefined; }) { const Icon = icon === "file" ? FileLockIcon : LockIcon; const body = ( <>