Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure
TypeScript
feat(gfs): document icons across apps and extension-aware agent file naming
Miguelon Peluchon158230e41e2b
diff --git a/control-ui/components/GfsBrowser.tsx b/control-ui/components/GfsBrowser.tsxindex 379e02f99..a9702c260 100644--- a/control-ui/components/GfsBrowser.tsx+++ b/control-ui/components/GfsBrowser.tsx@@ -4,11 +4,12 @@ import React, { useCallback, useEffect, useRef, useState } from 'react'import { FileUploadModal } from '@components/FileUploadModal'import { GfsImagePreview } from '@components/GfsImagePreview'import { GfsMarkdownPreview } from '@components/GfsMarkdownPreview'-import { IconFolder, IconImage, IconServer } from '@components/Sidebar/icons'+import { IconDocumentText, IconFolder, IconImage, IconServer } from '@components/Sidebar/icons'import { useToast } from '@components/Toast'import { IconChevronRight, IconDownload, IconPaperclip, IconUpload, IconX } from '@components/icons'import { Button, TextInput } from '@components/ui'import { GFS_UPLOAD_TIMEOUT_MS, apiGet, apiSend, gfsDownload, isSilentApiError } from '@lib/api'+import { isGfsDocumentFile } from '@lib/gfsDocumentFile'import { assertGfsFileUploadSize } from '@lib/gfsFileUpload'import { gfsImagePreviewMimeType } from '@lib/gfsImagePreview'import { isGfsMarkdownPreviewFile } from '@lib/gfsMarkdownPreview'@@ -607,6 +608,8 @@ export function GfsBrowser(): React.JSX.Element {<IconFolder />) : gfsImagePreviewMimeType(child.name) ? (<IconImage />+ ) : isGfsDocumentFile(child.name) ? (+ <IconDocumentText />) : (<IconServer />)}@@ -729,6 +732,8 @@ export function GfsBrowser(): React.JSX.Element {<IconFolder />) : gfsImagePreviewMimeType(selected.name) ? (<IconImage />+ ) : isGfsDocumentFile(selected.name) ? (+ <IconDocumentText />) : (<IconPaperclip />)}diff --git a/control-ui/components/Sidebar/icons.tsx b/control-ui/components/Sidebar/icons.tsxindex 3c3287bf7..292bc6998 100644--- a/control-ui/components/Sidebar/icons.tsx+++ b/control-ui/components/Sidebar/icons.tsx@@ -349,6 +349,34 @@ export function IconImage() {)}+export function IconDocumentText() {+ return (+ <svg+ xmlns="http://www.w3.org/2000/svg"+ width="18"+ height="18"+ viewBox="0 0 512 512"+ fill="currentColor"+ stroke="currentColor"+ strokeWidth="0"+ >+ <path+ fill="none"+ strokeLinejoin="round"+ strokeWidth="32"+ d="M416 221.25V416a48 48 0 0 1-48 48H144a48 48 0 0 1-48-48V96a48 48 0 0 1 48-48h98.75a32 32 0 0 1 22.62 9.37l141.26 141.26a32 32 0 0 1 9.37 22.62z"+ />+ <path+ fill="none"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="32"+ d="M256 56v120a32 32 0 0 0 32 32h120m-232 80h160m-160 80h160"+ />+ </svg>+ )+}+export function IconBroadcast() {return (<svgdiff --git a/control-ui/lib/gfsDocumentFile.ts b/control-ui/lib/gfsDocumentFile.tsnew file mode 100644index 000000000..58deb5150--- /dev/null+++ b/control-ui/lib/gfsDocumentFile.ts@@ -0,0 +1,7 @@+const GFS_DOCUMENT_FILE_EXTENSIONS = new Set(['doc', 'docx', 'pdf', 'md', 'txt'])++export function isGfsDocumentFile(fileName: string): boolean {+ const extension = fileName.split('.').pop()?.toLowerCase()+ if (!extension || extension === fileName.toLowerCase()) return false+ return GFS_DOCUMENT_FILE_EXTENSIONS.has(extension)+}diff --git a/control-ui/package-lock.json b/control-ui/package-lock.jsonindex ce8768032..51480167a 100644--- a/control-ui/package-lock.json+++ b/control-ui/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-control-ui",- "version": "0.1.423",+ "version": "0.1.424","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-control-ui",- "version": "0.1.423",+ "version": "0.1.424","dependencies": {"@clerum/llm-providers": "file:../packages/llm-providers","@clerum/workflow-recipe-capability-policy": "file:../packages/workflow-recipe-capability-policy",diff --git a/control-ui/package.json b/control-ui/package.jsonindex 653ecf0fd..180be428b 100644--- a/control-ui/package.json+++ b/control-ui/package.json@@ -1,6 +1,6 @@{"name": "clerum-control-ui",- "version": "0.1.423",+ "version": "0.1.424","private": true,"scripts": {"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",diff --git a/desktop-app/ui/src/components/GfsFileIcon/index.tsx b/desktop-app/ui/src/components/GfsFileIcon/index.tsxnew file mode 100644index 000000000..5b618173c--- /dev/null+++ b/desktop-app/ui/src/components/GfsFileIcon/index.tsx@@ -0,0 +1,12 @@+import { IconAttachFile, IconDocumentText, IconImage } from '@components/SidebarNav/icons'+import { isGfsDocumentFile } from '@lib/gfsDocumentFile'+import { gfsImagePreviewMimeType } from '@lib/gfsImagePreview'+import type { GfsFileIconProps } from './types'++export type { GfsFileIconProps } from './types'++export function GfsFileIcon({ name, ...iconProps }: GfsFileIconProps) {+ if (gfsImagePreviewMimeType(name)) return <IconImage {...iconProps} />+ if (isGfsDocumentFile(name)) return <IconDocumentText {...iconProps} />+ return <IconAttachFile {...iconProps} />+}diff --git a/desktop-app/ui/src/components/GfsFileIcon/types.ts b/desktop-app/ui/src/components/GfsFileIcon/types.tsnew file mode 100644index 000000000..0a6e92c7b--- /dev/null+++ b/desktop-app/ui/src/components/GfsFileIcon/types.ts@@ -0,0 +1,5 @@+import type { SVGProps } from 'react'++export type GfsFileIconProps = {+ name: string+} & SVGProps<SVGSVGElement>diff --git a/desktop-app/ui/src/components/SidebarNav/icons.tsx b/desktop-app/ui/src/components/SidebarNav/icons.tsxindex a363ae66c..ebfe8d295 100644--- a/desktop-app/ui/src/components/SidebarNav/icons.tsx+++ b/desktop-app/ui/src/components/SidebarNav/icons.tsx@@ -346,3 +346,31 @@ export function IconImage(props: IconProps) {</svg>)}++// Document file glyph for doc/docx/pdf/md/txt resources in GFS listings.+export function IconDocumentText(props: IconProps) {+ return (+ <svg+ viewBox="0 0 512 512"+ aria-hidden="true"+ fill="currentColor"+ stroke="currentColor"+ strokeWidth="0"+ {...props}+ >+ <path+ fill="none"+ strokeLinejoin="round"+ strokeWidth="32"+ d="M416 221.25V416a48 48 0 0 1-48 48H144a48 48 0 0 1-48-48V96a48 48 0 0 1 48-48h98.75a32 32 0 0 1 22.62 9.37l141.26 141.26a32 32 0 0 1 9.37 22.62z"+ />+ <path+ fill="none"+ strokeLinecap="round"+ strokeLinejoin="round"+ strokeWidth="32"+ d="M256 56v120a32 32 0 0 0 32 32h120m-232 80h160m-160 80h160"+ />+ </svg>+ )+}diff --git a/desktop-app/ui/src/components/agents/ChatThread.tsx b/desktop-app/ui/src/components/agents/ChatThread.tsxindex 701593e8f..f7cedd349 100644--- a/desktop-app/ui/src/components/agents/ChatThread.tsx+++ b/desktop-app/ui/src/components/agents/ChatThread.tsx@@ -17,14 +17,10 @@ import ReactMarkdown from 'react-markdown'import remarkGfm from 'remark-gfm'import { Button, IconButton, MenuItem } from '@components/Common'import { ConfirmDialog } from '@components/ConfirmDialog'+import { GfsFileIcon } from '@components/GfsFileIcon'import { MessageArtifactActions } from '@components/MessageArtifactActions'import { SecureHtmlPreview } from '@components/SecureHtmlPreview'-import {- IconAttachFile,- IconConnectors,- IconContexts,- IconWorkflows,-} from '@components/SidebarNav/icons'+import { IconConnectors, IconContexts, IconWorkflows } from '@components/SidebarNav/icons'import { WorkflowRunArtifactActions } from '@components/WorkflowRunArtifactActions'import {AGENT_ERROR_CODE_LABELS,@@ -134,12 +130,11 @@ function extractWorkflowArtifactScopeFromProgress(}}-function getChatMessageAttachmentIcon(type: ChatMessageAttachment['type']) {- if (type === 'plugin') return <IconWorkflows />- if (type === 'connector') return <IconConnectors />- if (type === 'agent_file') return <IconContexts />- if (type === 'global_file') return <IconAttachFile />- return <IconAttachFile />+function getChatMessageAttachmentIcon(attachment: ChatMessageAttachment) {+ if (attachment.type === 'plugin') return <IconWorkflows />+ if (attachment.type === 'connector') return <IconConnectors />+ if (attachment.type === 'agent_file') return <IconContexts />+ return <GfsFileIcon name={attachment.filename || attachment.label} />}function canDownloadResponseFileAttachment(attachment: ChatMessageAttachment): boolean {@@ -191,7 +186,7 @@ function MessageAttachmentList({ attachments }: { attachments: ChatMessageAttachclassName={`composer-reference-icon message-attachment-icon composer-reference-icon--${iconTypeClass}`}aria-hidden="true">- {getChatMessageAttachmentIcon(attachment.type)}+ {getChatMessageAttachmentIcon(attachment)}</span>{isResponseFile ? (<span className="message-attachment-type-label">Generated file</span>diff --git a/desktop-app/ui/src/components/agents/ComposerAgentFilesModal.tsx b/desktop-app/ui/src/components/agents/ComposerAgentFilesModal.tsxindex 7aa82a571..cd3d3009d 100644--- a/desktop-app/ui/src/components/agents/ComposerAgentFilesModal.tsx+++ b/desktop-app/ui/src/components/agents/ComposerAgentFilesModal.tsx@@ -1,5 +1,6 @@import { useCallback, useEffect, useMemo, useState } from 'react'import { Button, EmptyState, IconButton } from '@components/Common'+import { GfsFileIcon } from '@components/GfsFileIcon'import { IconAttachFile, IconClose, IconContexts } from '@components/SidebarNav/icons'import { formatSharedFileSize, getSharedFileParentPath, joinSharedFilePath } from '@lib/sharedFiles'import type { ComposerAgentFileReference } from '../../uiTypes'@@ -286,7 +287,7 @@ export function ComposerAgentFilesModal({onChange={() => toggleAgentFileReference(fullPath, 'file')}/><span className="composer-reference-icon composer-reference-icon--agent-file">- <IconAttachFile />+ <GfsFileIcon name={entry.name} /></span><span className="composer-agent-file-details"><strong>{entry.name}</strong>diff --git a/desktop-app/ui/src/components/agents/ComposerGlobalFilesModal/index.tsx b/desktop-app/ui/src/components/agents/ComposerGlobalFilesModal/index.tsxindex b2071bfd7..b2fa28099 100644--- a/desktop-app/ui/src/components/agents/ComposerGlobalFilesModal/index.tsx+++ b/desktop-app/ui/src/components/agents/ComposerGlobalFilesModal/index.tsx@@ -1,11 +1,7 @@import { useCallback, useEffect, useMemo, useRef, useState } from 'react'import { Button, EmptyState, IconButton, StatusBanner } from '@components/Common'-import {- IconAttachFile,- IconChevronRight,- IconClose,- IconContexts,-} from '@components/SidebarNav/icons'+import { GfsFileIcon } from '@components/GfsFileIcon'+import { IconChevronRight, IconClose, IconContexts } from '@components/SidebarNav/icons'import { useGfsBrowserController } from '@hooks/domain/useGfsBrowserController'import { formatSharedFileSize } from '@lib/sharedFiles'import type { ComposerGlobalFileReference } from '@/uiTypes'@@ -168,7 +164,7 @@ export function ComposerGlobalFilesModal({ onAdd, onClose }: ComposerGlobalFilesonChange={() => toggleFile(file)}/><span className="composer-global-files-entry-icon" aria-hidden="true">- <IconAttachFile />+ <GfsFileIcon name={entry.name} /></span><span className="composer-global-files-entry-copy"><strong>{entry.name}</strong>diff --git a/desktop-app/ui/src/components/agents/ComposerPanel.tsx b/desktop-app/ui/src/components/agents/ComposerPanel.tsxindex c645c0812..f30926401 100644--- a/desktop-app/ui/src/components/agents/ComposerPanel.tsx+++ b/desktop-app/ui/src/components/agents/ComposerPanel.tsx@@ -4,6 +4,7 @@ import { useChatComposerStateContext } from '@contexts/ChatComposerStateContext'import { useMcpRuntimeContext } from '@contexts/McpRuntimeContext'import { useNavigationContext } from '@contexts/NavigationContext'import { Button, IconButton, MenuItem } from '@components/Common'+import { GfsFileIcon } from '@components/GfsFileIcon'import {IconAttachFile,IconClose,@@ -54,10 +55,10 @@ function getComposerImageTooltip(attachment: ComposerImageAttachment): string {return `Uploaded File - ${Math.max(1, Math.round(attachment.sizeBytes / 1024))} KB`}-function getComposerReferenceIcon(type: ComposerReferenceAttachment['type']) {- if (type === 'plugin') return <IconWorkflows />- if (type === 'connector') return <IconConnectors />- if (type === 'global_file') return <IconAttachFile />+function getComposerReferenceIcon(attachment: ComposerReferenceAttachment) {+ if (attachment.type === 'plugin') return <IconWorkflows />+ if (attachment.type === 'connector') return <IconConnectors />+ if (attachment.type === 'global_file') return <GfsFileIcon name={attachment.label} />return <IconContexts />}@@ -793,7 +794,7 @@ export function ComposerPanel({ inline = false, agentSelector }: ComposerPanelPrclassName={`composer-reference-icon composer-reference-icon--${attachment.type}`}aria-hidden="true">- {getComposerReferenceIcon(attachment.type)}+ {getComposerReferenceIcon(attachment)}</span><span className="composer-attachment-chip-body"><strong>{attachment.label}</strong>diff --git a/desktop-app/ui/src/lib/gfsDocumentFile.ts b/desktop-app/ui/src/lib/gfsDocumentFile.tsnew file mode 100644index 000000000..58deb5150--- /dev/null+++ b/desktop-app/ui/src/lib/gfsDocumentFile.ts@@ -0,0 +1,7 @@+const GFS_DOCUMENT_FILE_EXTENSIONS = new Set(['doc', 'docx', 'pdf', 'md', 'txt'])++export function isGfsDocumentFile(fileName: string): boolean {+ const extension = fileName.split('.').pop()?.toLowerCase()+ if (!extension || extension === fileName.toLowerCase()) return false+ return GFS_DOCUMENT_FILE_EXTENSIONS.has(extension)+}diff --git a/desktop-app/ui/src/pages/FilesPage.tsx b/desktop-app/ui/src/pages/FilesPage.tsxindex 3842f3176..bd0a6de81 100644--- a/desktop-app/ui/src/pages/FilesPage.tsx+++ b/desktop-app/ui/src/pages/FilesPage.tsx@@ -1,6 +1,7 @@import { type DragEvent as ReactDragEvent, useEffect, useMemo, useRef, useState } from 'react'import { useQuery } from '@tanstack/react-query'import { Button, EmptyState, IconButton, StatusBanner, TextInput } from '@components/Common'+import { GfsFileIcon } from '@components/GfsFileIcon'import { GfsImagePreview } from '@components/GfsImagePreview'import { GfsMarkdownPreview } from '@components/GfsMarkdownPreview'import { GfsResourceMenu } from '@components/GfsResourceMenu'@@ -12,7 +13,6 @@ import {IconContexts,IconDownload,IconEye,- IconImage,} from '@components/SidebarNav/icons'import { desktopQueryKeys } from '@hooks/domain/queryKeys'import { useGfsBrowserController } from '@hooks/domain/useGfsBrowserController'@@ -587,11 +587,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:) : currentIsFile ? (<div className="da-gfs-current-file"><span className="da-gfs-current-file__icon" aria-hidden="true">- {currentIsFile && gfsImagePreviewMimeType(current.name) ? (- <IconImage />- ) : (- <IconAttachFile />- )}+ {currentIsFile ? <GfsFileIcon name={current.name} /> : <IconAttachFile />}</span><div className="da-gfs-current-file__copy"><div className="da-gfs-current-file__title-row">@@ -663,10 +659,8 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:<span className="da-gfs-list__icon da-grid__cell" aria-hidden="true">{resource.kind === 'directory' ? (<IconContexts />- ) : gfsImagePreviewMimeType(resource.name) ? (- <IconImage />) : (- <IconAttachFile />+ <GfsFileIcon name={resource.name} />)}</span><span className="da-gfs-list__identity da-grid__cell">@@ -807,13 +801,7 @@ export function FilesPage({ pushToast, pendingGfsUri, onPendingGfsUriHandled }:className={`da-gfs-manage-dialog__icon${currentIsFolder ? ' da-gfs-manage-dialog__icon--folder' : ''}`}aria-hidden="true">- {currentIsFolder ? (- <IconContexts />- ) : currentIsFile && gfsImagePreviewMimeType(current.name) ? (- <IconImage />- ) : (- <IconAttachFile />- )}+ {currentIsFolder ? <IconContexts /> : <GfsFileIcon name={current.name} />}</span><span className="da-gfs-manage-dialog__heading">{renameOpen ? (diff --git a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsxindex 1df6c4947..3bae932d5 100644--- a/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx+++ b/desktop-app/ui/src/pages/__tests__/FilesPage.test.tsx@@ -1134,6 +1134,53 @@ describe('FilesPage', () => {expect(revokeObjectURL).toHaveBeenCalledWith('blob:gfs-download')})+ it('shows the document icon for txt, md, pdf, doc and docx files instead of the clip', () => {+ hookMock.useGfsBrowserController.mockReturnValue({+ ...baseController(),+ accessibleResources: [+ 'notes.txt',+ 'readme.md',+ 'report.pdf',+ 'memo.doc',+ 'brief.docx',+ 'archive.zip',+ ].map((name, index) => ({+ resourceId: `file-${index}`,+ rid: `file-${index}`,+ gfsUri: `gfs://main/file-${index}`,+ drive: 'main',+ parentResourceId: null,+ name,+ kind: 'file',+ path: `/${name}`,+ version: 0,+ bytes: 3,+ sources: ['grant'],+ permissions: ['read'],+ coversDescendants: false,+ })),+ })++ const { container } = renderFilesPage()++ const documentRows = ['notes.txt', 'readme.md', 'report.pdf', 'memo.doc', 'brief.docx'].map(+ name => screen.getByRole('button', { name }).closest('.da-grid__row')+ )+ for (const row of documentRows) {+ const iconSvg = row?.querySelector('.da-gfs-list__icon svg')+ expect(iconSvg?.getAttribute('viewBox')).toBe('0 0 512 512')+ }++ const clipRow = screen.getByRole('button', { name: 'archive.zip' }).closest('.da-grid__row')+ const clipIcon = clipRow?.querySelector('.da-gfs-list__icon svg')+ expect(clipIcon?.getAttribute('viewBox')).toBe('0 0 24 24')++ const listIconSvg = container.querySelectorAll('.da-gfs-list__icon svg')+ expect(+ [...listIconSvg].filter(svg => svg.getAttribute('viewBox') === '0 0 512 512')+ ).toHaveLength(5)+ })+it('previews an image file in a closable modal without downloading it to disk', async () => {const download = vi.fn(async () => ({ bytes: new Uint8Array([1, 2, 3]).buffer }))const createObjectURL = vi.fn(() => 'blob:gfs-image-preview')diff --git a/mcp-host/package-lock.json b/mcp-host/package-lock.jsonindex a62cdc464..8519e148d 100644--- a/mcp-host/package-lock.json+++ b/mcp-host/package-lock.json@@ -1,12 +1,12 @@{"name": "clerum-mcp-host",- "version": "0.1.238",+ "version": "0.1.239","lockfileVersion": 3,"requires": true,"packages": {"": {"name": "clerum-mcp-host",- "version": "0.1.238",+ "version": "0.1.239","license": "SEE LICENSE IN LICENSE","dependencies": {"@anthropic-ai/sdk": "^0.32.0",diff --git a/mcp-host/package.json b/mcp-host/package.jsonindex 2b209bb31..2dcb39dec 100644--- a/mcp-host/package.json+++ b/mcp-host/package.json@@ -1,6 +1,6 @@{"name": "clerum-mcp-host",- "version": "0.1.238",+ "version": "0.1.239","description": "MCP Host - reads Host CRD and provides LLM access via OpenAI/Claude","main": "dist/main.js","engines": {diff --git a/mcp-host/src/internalTools/gfs.ts b/mcp-host/src/internalTools/gfs.tsindex d898b5705..3b4fd4680 100644--- a/mcp-host/src/internalTools/gfs.ts+++ b/mcp-host/src/internalTools/gfs.ts@@ -243,7 +243,11 @@ export function buildGfsWriteTools(client: GfscWriteClient): InternalToolDefinitproperties: {drive: { type: 'string', description: 'gfs drive name.' },parentResourceId: { type: 'string', description: 'Destination folder resource id.' },- name: { type: 'string', description: 'New file name.' },+ name: {+ type: 'string',+ description:+ 'New file name including its file extension, e.g. "report.txt" or "notes.md". Always match the content format.',+ },content: { type: 'string', description: 'Initial file content.' },},},