(filePath)
| 3738 | } |
| 3739 | |
| 3740 | function buildArtifactFromFilePath(filePath) { |
| 3741 | const normalizedPath = String(filePath ?? '').trim(); |
| 3742 | const kind = inferArtifactKindFromPath(normalizedPath); |
| 3743 | let sizeBytes = null; |
| 3744 | try { |
| 3745 | sizeBytes = fs.statSync(normalizedPath).size; |
| 3746 | } catch { |
| 3747 | sizeBytes = null; |
| 3748 | } |
| 3749 | return { |
| 3750 | kind, |
| 3751 | path: normalizedPath, |
| 3752 | displayName: path.basename(normalizedPath) || null, |
| 3753 | mimeType: inferMimeTypeFromPath(normalizedPath), |
| 3754 | sizeBytes, |
| 3755 | caption: null, |
| 3756 | source: 'provider_native' as const, |
| 3757 | turnId: null, |
| 3758 | }; |
| 3759 | } |
| 3760 | |
| 3761 | function inferArtifactKindFromPath(filePath) { |
| 3762 | const extension = path.extname(String(filePath ?? '')).toLowerCase(); |
no test coverage detected