Prometheus Entity Management API
    Preparing search index...

    entity-approval.tsx — EntityApproval: human-in-the-loop review of agent changes.

    Built on top of:

    • useEntityDiff (which reuses recordGraphSnapshot / restoreGraphSnapshot)
    • EntityDiff for the visual before/after diff table (controlled via externalDiff)

    Flow:

    1. Before the agent stream starts, autoCapture (default true) captures a baseline on mount.
    2. After the stream completes, click "Refresh diff" to recompute.
    3. User approves → onApprove(diff) is called; graph keeps new state.
    4. User rejects → onReject(diff) is called; graph is restored to baseline.

    Layering: Component → useEntityDiff hook → recordGraphSnapshot / restoreGraphSnapshot (store writes). No direct store access here.

    interface EntityApprovalProps {
        approveLabel?: string;
        autoCapture?: boolean;
        className?: string;
        entityId: string;
        entityType: string;
        includeUnchanged?: boolean;
        onApprove?: (diff: EntityDiffResult) => void;
        onReject?: (diff: EntityDiffResult) => void;
        rejectLabel?: string;
        renderActions?: (
            opts: {
                hasChanges: boolean;
                onApprove: () => void;
                onReject: () => void;
            },
        ) => ReactNode;
        renderDiff?: (diff: EntityDiffResult | null) => ReactNode;
        title?: string;
    }
    Index
    approveLabel?: string

    Label for the approve button. Default: "Approve"

    autoCapture?: boolean

    Automatically capture a baseline snapshot on mount. Default: true

    className?: string

    Additional CSS class on the root element.

    entityId: string
    entityType: string
    includeUnchanged?: boolean

    Include unchanged fields in the diff view. Default: false

    onApprove?: (diff: EntityDiffResult) => void

    Called when the user approves; the entity graph keeps the new state.

    onReject?: (diff: EntityDiffResult) => void

    Called when the user rejects; the graph is rewound to the baseline.

    rejectLabel?: string

    Label for the reject/restore button. Default: "Reject & Restore"

    renderActions?: (
        opts: {
            hasChanges: boolean;
            onApprove: () => void;
            onReject: () => void;
        },
    ) => ReactNode

    Render override for the action buttons.

    renderDiff?: (diff: EntityDiffResult | null) => ReactNode

    Render override for the diff section.

    title?: string

    Title heading.