({
agentPubkey,
viewerIsOwner,
className,
iconClassName,
variant = "ghost",
}: {
agentPubkey: string;
viewerIsOwner: boolean;
className?: string;
iconClassName?: string;
variant?: ButtonProps["variant"];
})
| 53 | } |
| 54 | |
| 55 | export function MemoryRefreshButton({ |
| 56 | agentPubkey, |
| 57 | viewerIsOwner, |
| 58 | className, |
| 59 | iconClassName, |
| 60 | variant = "ghost", |
| 61 | }: { |
| 62 | agentPubkey: string; |
| 63 | viewerIsOwner: boolean; |
| 64 | className?: string; |
| 65 | iconClassName?: string; |
| 66 | variant?: ButtonProps["variant"]; |
| 67 | }): React.ReactElement | null { |
| 68 | const { query } = useAgentMemoryGraph(agentPubkey, { |
| 69 | enabled: viewerIsOwner, |
| 70 | }); |
| 71 | |
| 72 | if (!viewerIsOwner || !query.data) return null; |
| 73 | |
| 74 | return ( |
| 75 | <Button |
| 76 | aria-label="Refresh memory" |
| 77 | className={cn(className, query.isFetching && "cursor-wait")} |
| 78 | data-testid="agent-memory-refetch" |
| 79 | disabled={query.isFetching} |
| 80 | onClick={() => query.refetch()} |
| 81 | size="icon" |
| 82 | type="button" |
| 83 | variant={variant} |
| 84 | > |
| 85 | <RefreshCw |
| 86 | className={cn( |
| 87 | iconClassName ?? "h-4 w-4", |
| 88 | query.isFetching && "animate-spin", |
| 89 | )} |
| 90 | /> |
| 91 | </Button> |
| 92 | ); |
| 93 | } |
| 94 | |
| 95 | function MemorySectionForOwner({ agentPubkey }: { agentPubkey: string }) { |
| 96 | const { query, graph } = useAgentMemoryGraph(agentPubkey); |
nothing calls this directly
no test coverage detected