diff --git a/site/src/pages/AgentsPage/AgentChatInput.tsx b/site/src/pages/AgentsPage/AgentChatInput.tsx index db9904c96b..13f7f013c8 100644 --- a/site/src/pages/AgentsPage/AgentChatInput.tsx +++ b/site/src/pages/AgentsPage/AgentChatInput.tsx @@ -91,7 +91,7 @@ interface AgentChatInputProps { // Pass `null` to render fallback values (e.g. when limit is unknown). // Omit entirely to hide the indicator. contextUsage?: AgentContextUsage | null; - attachments?: File[]; + attachments?: readonly File[]; onAttach?: (files: File[]) => void; onRemoveAttachment?: (index: number) => void; uploadStates?: Map; @@ -240,7 +240,7 @@ ImageThumbnail.displayName = "ImageThumbnail"; /** Renders a horizontal strip of attachment thumbnails above the input. */ export const AttachmentPreview = memo<{ - attachments: File[]; + attachments: readonly File[]; onRemove: (index: number) => void; uploadStates?: Map; previewUrls?: Map; diff --git a/site/src/pages/AgentsPage/AgentDetail.tsx b/site/src/pages/AgentsPage/AgentDetail.tsx index 1f28dd6122..39e10dcd7d 100644 --- a/site/src/pages/AgentsPage/AgentDetail.tsx +++ b/site/src/pages/AgentsPage/AgentDetail.tsx @@ -108,7 +108,7 @@ interface AgentDetailTimelineProps { onEditUserMessage?: ( messageId: number, text: string, - fileBlocks?: Array<{ mediaType: string; data?: string }>, + fileBlocks?: readonly { mediaType: string; data?: string }[], ) => void; editingMessageId?: number | null; savingMessageId?: number | null; @@ -222,11 +222,11 @@ interface AgentDetailInputProps { onCancelHistoryEdit: () => void; // File blocks from the message being edited, converted to // File objects and pre-populated into attachments. - editingFileBlocks?: Array<{ + editingFileBlocks?: readonly { mediaType: string; data?: string; fileId?: string; - }>; + }[]; } const AgentDetailInput: FC = ({ @@ -430,14 +430,18 @@ export function useConversationEditingState(deps: { string | null >(null); const [editingFileBlocks, setEditingFileBlocks] = useState< - Array<{ mediaType: string; data?: string; fileId?: string }> + readonly { mediaType: string; data?: string; fileId?: string }[] >([]); const handleEditUserMessage = useCallback( ( messageId: number, text: string, - fileBlocks?: Array<{ mediaType: string; data?: string; fileId?: string }>, + fileBlocks?: readonly { + mediaType: string; + data?: string; + fileId?: string; + }[], ) => { setDraftBeforeHistoryEdit((prev) => editingMessageId !== null ? prev : inputValueRef.current, diff --git a/site/src/pages/AgentsPage/DiffViewer.tsx b/site/src/pages/AgentsPage/DiffViewer.tsx index 67eacdc78e..9d33a61e5d 100644 --- a/site/src/pages/AgentsPage/DiffViewer.tsx +++ b/site/src/pages/AgentsPage/DiffViewer.tsx @@ -30,7 +30,7 @@ interface DiffViewerProps { /** Fragment to display in the top-left of the header bar. */ headerLeft?: ReactNode; /** Parsed file diffs to render. */ - parsedFiles: FileDiffMetadata[]; + parsedFiles: readonly FileDiffMetadata[]; /** Cache key prefix for parsePatchFiles worker pool LRU cache. */ cacheKeyPrefix?: string; /** Whether the panel is in expanded mode (affects file tree threshold). */ @@ -165,7 +165,7 @@ interface FileTreeNode { * Single-child directory chains are collapsed so that e.g. * `src/pages/AgentsPage` renders as one row. */ -function buildFileTree(files: FileDiffMetadata[]): FileTreeNode[] { +function buildFileTree(files: readonly FileDiffMetadata[]): FileTreeNode[] { const root: FileTreeNode[] = []; for (const file of files) {