import type { MouseEvent as ReactMouseEvent } from 'react'; import type { EditorAgentAttachmentRef } from '@/packages/shared/src/contracts'; export enum EditorAgentRightClickAction { CopyText = 'copy_text', CopyImage = 'copy_image', ReferenceImage = 'reference_image', FocusCanvas = 'focus_canvas', DownloadAsset = 'download_asset', } export type EditorAgentContextAsset = | (EditorAgentAttachmentRef & { kind: 'attachment'; mediaType: 'image'; suggestedFileName: string; }) | { kind: 'generated_media'; mediaType: 'image' | 'video' | 'audio'; mediaSrc: string; objectKey?: string | null; resourceId?: string | null; suggestedFileName: string; }; export type RightClickMenuTarget = | { kind: 'text'; text: string } | { kind: 'asset'; asset: EditorAgentContextAsset }; export type RightClickMenuHandler = ( event: ReactMouseEvent, asset: EditorAgentContextAsset, ) => void; export function attachmentKey(attachment: EditorAgentAttachmentRef) { return `${attachment.source}:${attachment.referenceId}`; } export function contextAssetMediaSrc(asset: EditorAgentContextAsset) { return asset.kind === 'attachment' ? asset.imageSrc : asset.mediaSrc; }