(fileName: string)
| 59 | * is enabled; callers gate on isE2BDocEnabled before using this. |
| 60 | */ |
| 61 | export async function getE2BDocFormat(fileName: string): Promise<E2BDocFormat | null> { |
| 62 | const l = fileName.toLowerCase() |
| 63 | if (l.endsWith('.pptx')) |
| 64 | return { |
| 65 | ext: 'pptx', |
| 66 | engine: 'node', |
| 67 | formatName: 'PPTX', |
| 68 | contentType: PPTX_MIME, |
| 69 | sourceMime: PPTXGENJS_SOURCE_MIME, |
| 70 | } |
| 71 | if (l.endsWith('.docx')) |
| 72 | return { |
| 73 | ext: 'docx', |
| 74 | engine: 'node', |
| 75 | formatName: 'DOCX', |
| 76 | contentType: DOCX_MIME, |
| 77 | sourceMime: DOCXJS_SOURCE_MIME, |
| 78 | } |
| 79 | if (l.endsWith('.pdf')) |
| 80 | return { |
| 81 | ext: 'pdf', |
| 82 | engine: 'python', |
| 83 | formatName: 'PDF', |
| 84 | contentType: PDF_MIME, |
| 85 | sourceMime: PYTHON_PDF_SOURCE_MIME, |
| 86 | } |
| 87 | // xlsx is gated behind the mothership-beta feature flag (like plans/changelog): the |
| 88 | // skill + prompt are gated on the Go side, and this is the single Sim chokepoint |
| 89 | // that keeps the compile/serve/check/recalc paths off for xlsx when beta is off. |
| 90 | if (l.endsWith('.xlsx') && (await isFeatureEnabled('mothership-beta'))) |
| 91 | return { |
| 92 | ext: 'xlsx', |
| 93 | engine: 'python', |
| 94 | formatName: 'XLSX', |
| 95 | contentType: XLSX_MIME, |
| 96 | sourceMime: PYTHON_XLSX_SOURCE_MIME, |
| 97 | } |
| 98 | return null |
| 99 | } |
| 100 | |
| 101 | // The skills reference workspace images by BARE file id through the injected |
| 102 | // helpers — `getFileBase64(id)`, `addImage(slide, id, ...)` (pptx), |
no test coverage detected