Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

perf(mcp-host): load each generator and its libraries on first use

marcoteb6090c712b321
diff --git a/mcp-host/src/workflow/__tests__/internalTools.images.test.ts b/mcp-host/src/workflow/__tests__/internalTools.images.test.ts
index 3520ec2d1..f3e2f1702 100644
--- a/mcp-host/src/workflow/__tests__/internalTools.images.test.ts
+++ b/mcp-host/src/workflow/__tests__/internalTools.images.test.ts
@@ -5,7 +5,8 @@ import { afterEach, beforeEach, describe, expect, it } from 'vitest'
import * as fs from 'fs'
import * as os from 'os'
import * as path from 'path'
-import { INTERNAL_TOOLS, fitImageBox, imageDisplaySize, imageIntrinsicSize } from '../internalTools'
+import { fitImageBox, imageDisplaySize, imageIntrinsicSize } from '../embeddedImages'
+import { INTERNAL_TOOLS } from '../internalTools'
import type { InternalToolDefinition } from '../types'
import { withPngDensity } from './support/pngDensity'
import { zipEntryText } from './support/zipEntries'
diff --git a/mcp-host/src/workflow/__tests__/internalTools.lazyLoad.test.ts b/mcp-host/src/workflow/__tests__/internalTools.lazyLoad.test.ts
new file mode 100644
index 000000000..44ca76fdb
--- /dev/null
+++ b/mcp-host/src/workflow/__tests__/internalTools.lazyLoad.test.ts
@@ -0,0 +1,42 @@
+// Importing the internal tools loads no document library: the host starts
+// without them, and each loads the first time its generator runs.
+import { describe, expect, it, vi } from 'vitest'
+import { createRequire } from 'module'
+import * as path from 'path'
+
+const LIBRARIES = [
+ 'docx',
+ 'exceljs',
+ 'pdfmake',
+ 'pptxgenjs',
+ 'chart.js',
+ '@napi-rs/canvas',
+ 'jszip',
+]
+
+const imported = vi.hoisted(() => [] as string[])
+vi.mock('docx', () => (imported.push('docx'), {}))
+vi.mock('exceljs', () => (imported.push('exceljs'), {}))
+vi.mock('pdfmake', () => (imported.push('pdfmake'), {}))
+vi.mock('pptxgenjs', () => (imported.push('pptxgenjs'), {}))
+vi.mock('chart.js', () => (imported.push('chart.js'), {}))
+vi.mock('@napi-rs/canvas', () => (imported.push('@napi-rs/canvas'), {}))
+vi.mock('jszip', () => (imported.push('jszip'), {}))
+
+/** Libraries Node has loaded through require, which vi.mock does not see. */
+function required(): string[] {
+ const cache = createRequire(path.resolve('package.json')).cache
+ return LIBRARIES.filter(lib =>
+ Object.keys(cache).some(file => file.includes(`/node_modules/${lib}/`))
+ )
+}
+
+describe('internal tools module', () => {
+ it('loads no document library when imported', async () => {
+ const before = required()
+ const { INTERNAL_TOOLS } = await import('../internalTools')
+ expect(INTERNAL_TOOLS.length).toBeGreaterThan(0)
+ expect(imported).toEqual([])
+ expect(required()).toEqual(before)
+ })
+})
diff --git a/mcp-host/src/workflow/__tests__/internalTools.security.test.ts b/mcp-host/src/workflow/__tests__/internalTools.security.test.ts
index 718dcbcb0..588d51845 100644
--- a/mcp-host/src/workflow/__tests__/internalTools.security.test.ts
+++ b/mcp-host/src/workflow/__tests__/internalTools.security.test.ts
@@ -3,10 +3,10 @@ import ExcelJS from 'exceljs'
import * as fs from 'fs'
import * as os from 'os'
import * as path from 'path'
+import { imageDisplaySize } from '../embeddedImages'
import {
INTERNAL_TOOLS,
escapeHtmlAttr,
- imageDisplaySize,
safeCell,
safeJsonForScript,
validateOutputPath,
diff --git a/mcp-host/src/workflow/chartGenerator.ts b/mcp-host/src/workflow/chartGenerator.ts
index 5eeafe56f..6ae623705 100644
--- a/mcp-host/src/workflow/chartGenerator.ts
+++ b/mcp-host/src/workflow/chartGenerator.ts
@@ -30,7 +30,14 @@ import {
sliceColors,
valueLabelsPlugin,
} from './chartPlugins'
-import { CHART_THEMES, ChartTheme } from './chartThemes'
+import {
+ CHART_THEMES,
+ type ChartTheme,
+ DEFAULT_CHART_HEIGHT,
+ DEFAULT_CHART_WIDTH,
+ MAX_CHART_DIMENSION,
+ MIN_CHART_DIMENSION,
+} from './chartThemes'
import { PNG_BASE_PPM } from './embeddedImages'
import { CHART_FONT_STACK, ensureFontsReady, sanitizeForFont } from './fonts'
import type { InternalToolResult } from './types'
@@ -57,10 +64,6 @@ const TRANSLUCENT_FILL_TYPES = new Set(['line', 'area', 'radar'])
/** Widest a single bar may be drawn, in nominal pixels. */
const MAX_BAR_THICKNESS = 120
-export const DEFAULT_CHART_WIDTH = 800
-export const DEFAULT_CHART_HEIGHT = 400
-export const MAX_CHART_DIMENSION = 4000
-export const MIN_CHART_DIMENSION = 100
/** A plot area narrower or shorter than this, in px, shows too little of the data to read. */
const MIN_PLOT_SIDE = 40
diff --git a/mcp-host/src/workflow/chartThemes.ts b/mcp-host/src/workflow/chartThemes.ts
index bb774c100..9ec2834ed 100644
--- a/mcp-host/src/workflow/chartThemes.ts
+++ b/mcp-host/src/workflow/chartThemes.ts
@@ -1,4 +1,4 @@
-/** Chart colour themes shared by the chart tool, the dashboard and the tool schemas. */
+/** Chart colour themes and size limits shared by the chart tool, the dashboard and the tool schemas. */
export interface ChartTheme {
backgroundColor: string
@@ -59,3 +59,8 @@ export const CHART_THEMES: Record<string, ChartTheme> = {
negative: '#fb7185',
},
}
+
+export const DEFAULT_CHART_WIDTH = 800
+export const DEFAULT_CHART_HEIGHT = 400
+export const MAX_CHART_DIMENSION = 4000
+export const MIN_CHART_DIMENSION = 100
diff --git a/mcp-host/src/workflow/documentChrome.ts b/mcp-host/src/workflow/documentChrome.ts
index 5cbbe9850..cfa37edc4 100644
--- a/mcp-host/src/workflow/documentChrome.ts
+++ b/mcp-host/src/workflow/documentChrome.ts
@@ -1,4 +1,5 @@
/** Branding, footer lines and the empty-document note shared by the PDF and DOCX generators. */
+import { PDF_MAX_FOOTER_LINES } from './documentSchema'
import { htmlToPlainLines, htmlToPlainText } from './inlineMarkup'
import type { UnitMeasure } from './pdfTables'
import { LINE_FILL } from './pdfText'
@@ -33,9 +34,6 @@ export const EMPTY_DOCUMENT_NOTE =
'The document is empty: body has no text, and no title, table or image was given. ' +
'Pass the text to write as body.'
-/** Footer lines that fit once the bottom margin has grown to hold them. */
-export const PDF_MAX_FOOTER_LINES = 6
-
export const PDF_FOOTER_SIZE = 9
/** More characters than a header or footer line ever holds at the running size. */
diff --git a/mcp-host/src/workflow/documentSchema.ts b/mcp-host/src/workflow/documentSchema.ts
new file mode 100644
index 000000000..03d4d6ed6
--- /dev/null
+++ b/mcp-host/src/workflow/documentSchema.ts
@@ -0,0 +1,15 @@
+/**
+ * Limits and argument descriptions the PDF and DOCX tool schemas share with
+ * their generators, kept apart so the schemas load neither generator.
+ */
+
+/** Footer lines that fit once the bottom margin has grown to hold them. */
+export const PDF_MAX_FOOTER_LINES = 6
+
+/** Where images come from, for the schema: the name clerum__generate_chart reports. */
+export const IMAGE_FILE_DESCRIPTION =
+ "File name of a PNG or JPEG (GIF, WebP and SVG are converted) in the output folder, as returned by clerum__generate_chart, e.g. 'sales.png'."
+
+export const DOCX_IMAGE_FILE_DESCRIPTION =
+ "File name in the output folder, as returned by clerum__generate_chart (e.g. 'sales.png'). " +
+ 'PNG, JPEG, GIF, WebP or SVG.'
diff --git a/mcp-host/src/workflow/docxGenerator.ts b/mcp-host/src/workflow/docxGenerator.ts
index deacd2dd0..ccba0cad9 100644
--- a/mcp-host/src/workflow/docxGenerator.ts
+++ b/mcp-host/src/workflow/docxGenerator.ts
@@ -59,10 +59,6 @@ const DOCX_LOGO_BOX = { width: 160, height: 60 }
/** Footer lines kept, as in the PDF. */
const DOCX_MAX_FOOTER_LINES = 6
-export const DOCX_IMAGE_FILE_DESCRIPTION =
- "File name in the output folder, as returned by clerum__generate_chart (e.g. 'sales.png'). " +
- 'PNG, JPEG, GIF, WebP or SVG.'
-
interface DocxBranding {
companyName?: string
logoPath?: string
diff --git a/mcp-host/src/workflow/internalTools.ts b/mcp-host/src/workflow/internalTools.ts
index 85f4cde36..5a43cd945 100644
--- a/mcp-host/src/workflow/internalTools.ts
+++ b/mcp-host/src/workflow/internalTools.ts
@@ -29,8 +29,7 @@ import {
DEFAULT_CHART_WIDTH,
MAX_CHART_DIMENSION,
MIN_CHART_DIMENSION,
- runGenerateChart,
-} from './chartGenerator'
+} from './chartThemes'
import { CONTEXT_FILES_TOOLS, loadContextFilesMounts } from './contextFiles'
import { DASHBOARD_CHART_TYPES } from './dashboardCharts'
import {
@@ -41,21 +40,25 @@ import {
SECTION_TYPES,
runGenerateDashboard,
} from './dashboardRender'
-import { PDF_MAX_FOOTER_LINES } from './documentChrome'
-import { DOCX_IMAGE_FILE_DESCRIPTION, runGenerateDocx } from './docxGenerator'
-import { predecodeImages } from './embeddedImages'
-import { IMAGE_FILE_DESCRIPTION, runGeneratePdf } from './pdfGenerator'
-import { NATIVE_CHART_TYPES } from './pptxCharts'
-import { PPTX_ASPECT_RATIOS, PPTX_PALETTES, buildPptxDeck } from './pptxDeck'
-import { SLIDE_LAYOUTS, STATUSES } from './pptxInput'
-import { PPTX_TEMPLATES, SEVERITIES } from './pptxTemplates'
+import {
+ DOCX_IMAGE_FILE_DESCRIPTION,
+ IMAGE_FILE_DESCRIPTION,
+ PDF_MAX_FOOTER_LINES,
+} from './documentSchema'
+import {
+ NATIVE_CHART_TYPES,
+ PPTX_ASPECT_RATIOS,
+ PPTX_PALETTES,
+ PPTX_TEMPLATES,
+ SEVERITIES,
+ SLIDE_LAYOUTS,
+ STATUSES,
+} from './pptxVocabulary'
import { watchUnknownArguments, withoutUnsetNulls } from './schemaArguments'
import { cleanToolArgs } from './toolText'
import type { InternalToolDefinition, InternalToolResult } from './types'
-import { buildXlsxWorkbook } from './xlsxWorkbook'
export { enforceQuota, getDirectorySize } from './artifactOutput'
-export { fitImageBox, imageDisplaySize, imageIntrinsicSize } from './embeddedImages'
export { CHART_THEMES } from './chartThemes'
export type { ChartTheme } from './chartThemes'
export { escapeHtmlAttr, safeJsonForScript } from './dashboardHtml'
@@ -171,6 +174,24 @@ const CHART_POINT_SCHEMA = {
description: 'A number, null for a gap, or {x, y} / {x, y, r} or [x, y] for scatter / bubble.',
}
+/**
+ * Runs a generator from its own module, loaded on first use so that starting
+ * the host loads no document library. A module that fails to load fails the
+ * call the way a generator error does.
+ */
+async function fromModule<M>(
+ load: () => Promise<M>,
+ run: (loaded: M) => Promise<InternalToolResult>
+): Promise<InternalToolResult> {
+ let loaded: M
+ try {
+ loaded = await load()
+ } catch (err) {
+ return { success: false, error: err instanceof Error ? err.message : String(err) }
+ }
+ return run(loaded)
+}
+
const generateChart: InternalToolDefinition = {
name: 'clerum__generate_chart',
description:
@@ -304,7 +325,10 @@ const generateChart: InternalToolDefinition = {
required: ['filename', 'type', 'data'],
},
execute(args: Record<string, unknown>, outputDir: string): Promise<InternalToolResult> {
- return runGenerateChart(args, outputDir)
+ return fromModule(
+ () => import('./chartGenerator'),
+ m => m.runGenerateChart(args, outputDir)
+ )
},
}
@@ -495,7 +519,10 @@ const generatePdf: InternalToolDefinition = {
required: ['filename', 'body'],
},
execute(args: Record<string, unknown>, outputDir: string): Promise<InternalToolResult> {
- return runGeneratePdf(args, outputDir)
+ return fromModule(
+ () => import('./pdfGenerator'),
+ m => m.runGeneratePdf(args, outputDir)
+ )
},
}
@@ -609,7 +636,10 @@ const generateDocx: InternalToolDefinition = {
required: ['filename', 'body'],
},
execute(args: Record<string, unknown>, outputDir: string): Promise<InternalToolResult> {
- return runGenerateDocx(args, outputDir)
+ return fromModule(
+ () => import('./docxGenerator'),
+ m => m.runGenerateDocx(args, outputDir)
+ )
},
}
@@ -819,6 +849,7 @@ const generateXlsx: InternalToolDefinition = {
try {
const filename = outputFilename(args.filename, 'xlsx', 'output')
const warnings: string[] = []
+ const { buildXlsxWorkbook } = await import('./xlsxWorkbook')
const built = await buildXlsxWorkbook(
args,
outputDir,
@@ -1671,6 +1702,7 @@ const generatePptxTool: InternalToolDefinition = {
try {
const filename = outputFilename(args.filename, 'pptx', 'deck')
const warnings: string[] = []
+ const { buildPptxDeck } = await import('./pptxDeck')
const { buffer, slides } = await buildPptxDeck(args, outputDir, warnings)
// Buffer first, quota check, then write — atomic, no partial files.
ensureDir(outputDir)
@@ -1750,10 +1782,11 @@ function prepared(tool: InternalToolDefinition): InternalToolDefinition {
string,
unknown
>
+ const { predecodeImages } = await import('./embeddedImages')
+ await predecodeImages(clean, outputDir)
} catch (err) {
return { success: false, error: err instanceof Error ? err.message : String(err) }
}
- await predecodeImages(clean, outputDir)
const unknown = watchUnknownArguments(tool.parameters, clean)
const result = await tool.execute(clean, outputDir)
const ignored = unknown.ignored()
diff --git a/mcp-host/src/workflow/pdfGenerator.ts b/mcp-host/src/workflow/pdfGenerator.ts
index d0de67cbf..d5820b6b1 100644
--- a/mcp-host/src/workflow/pdfGenerator.ts
+++ b/mcp-host/src/workflow/pdfGenerator.ts
@@ -753,10 +753,6 @@ function statusColorFromPalette(palette: PdfPalette, status?: string): string |
const IMAGE_ALIGNMENTS = new Set(['left', 'center', 'right'])
-/** Where images come from, for the schema: the name clerum__generate_chart reports. */
-export const IMAGE_FILE_DESCRIPTION =
- "File name of a PNG or JPEG (GIF, WebP and SVG are converted) in the output folder, as returned by clerum__generate_chart, e.g. 'sales.png'."
-
/**
* pdfmake 0.2 calls this with the nodes that follow on the same page as its
* second argument (the bundled typings describe 0.3's query object instead).
diff --git a/mcp-host/src/workflow/pptxCharts.ts b/mcp-host/src/workflow/pptxCharts.ts
index d8f4b47b0..c09f0a4f4 100644
--- a/mcp-host/src/workflow/pptxCharts.ts
+++ b/mcp-host/src/workflow/pptxCharts.ts
@@ -6,18 +6,7 @@
*/
import { ChartDataError, normalizeChartData } from './chartData'
import { PPTX_FONT_FACE } from './pptxText'
-
-/** Types drawn as native charts; the stacked ones are bar and area charts with stacked grouping. */
-export const NATIVE_CHART_TYPES = [
- 'line',
- 'bar',
- 'horizontalBar',
- 'pie',
- 'doughnut',
- 'area',
- 'stackedBar',
- 'stackedArea',
-] as const
+import { NATIVE_CHART_TYPES } from './pptxVocabulary'
export type NativeChartType = (typeof NATIVE_CHART_TYPES)[number]
diff --git a/mcp-host/src/workflow/pptxDeck.ts b/mcp-host/src/workflow/pptxDeck.ts
index ed003f473..084c9aaf9 100644
--- a/mcp-host/src/workflow/pptxDeck.ts
+++ b/mcp-host/src/workflow/pptxDeck.ts
@@ -24,7 +24,7 @@ import {
readText,
} from './pptxInput'
import { type TableLayout, layoutTable } from './pptxTables'
-import { PPTX_TEMPLATES, type PptxTemplate, buildTemplateSlides } from './pptxTemplates'
+import { type PptxTemplate, buildTemplateSlides } from './pptxTemplates'
import {
PPTX_FONT_FACE,
TEXT_INSET_X,
@@ -37,89 +37,19 @@ import {
truncateToLines,
wrapLines,
} from './pptxText'
+import {
+ PPTX_ASPECT_RATIOS,
+ PPTX_PALETTES,
+ PPTX_TEMPLATES,
+ type PptxPalette,
+} from './pptxVocabulary'
import { keepZipTextWhole } from './zipText'
const PptxGenJS = require('pptxgenjs')
-interface PptxPalette {
- primary: string
- primaryDark: string
- text: string
- muted: string
- border: string
- accent: string
- surface: string
- background: string
- statusGreen: string
- statusYellow: string
- statusRed: string
-}
-
-export const PPTX_PALETTES: Record<string, PptxPalette> = {
- default: {
- primary: '#0f172a',
- primaryDark: '#020617',
- text: '#0f172a',
- muted: '#475569',
- border: '#cbd5e1',
- accent: '#3b82f6',
- surface: '#f1f5f9',
- background: '#ffffff',
- statusGreen: '#16a34a',
- statusYellow: '#ca8a04',
- statusRed: '#dc2626',
- },
- corporate: {
- primary: '#1e3a8a',
- primaryDark: '#1e293b',
- text: '#1e293b',
- muted: '#475569',
- border: '#cbd5e1',
- accent: '#0891b2',
- surface: '#e0f2fe',
- background: '#ffffff',
- statusGreen: '#059669',
- statusYellow: '#ca8a04',
- statusRed: '#b91c1c',
- },
- warm: {
- primary: '#b45309',
- primaryDark: '#78350f',
- text: '#2f2823',
- muted: '#66584c',
- border: '#d6d2cc',
- accent: '#0d9488',
- surface: '#f7f7f5',
- background: '#fefdfb',
- statusGreen: '#65a30d',
- statusYellow: '#ca8a04',
- statusRed: '#9f1239',
- },
- alert: {
- primary: '#9f1239',
- primaryDark: '#4c0519',
- text: '#1f2937',
- muted: '#4b5563',
- border: '#fecaca',
- accent: '#dc2626',
- surface: '#fee2e2',
- background: '#ffffff',
- statusGreen: '#16a34a',
- statusYellow: '#ca8a04',
- statusRed: '#dc2626',
- },
-}
-
/** Series colors after the palette's own, so a chart of up to ten slices does not repeat one. */
const EXTRA_SERIES_COLORS = ['#7c3aed', '#0d9488', '#ea580c', '#db2777']
-export const PPTX_ASPECT_RATIOS: Record<string, { name: string; width: number; height: number }> = {
- wide: { name: 'LAYOUT_WIDE', width: 13.333, height: 7.5 },
- '16x9': { name: 'LAYOUT_16x9', width: 10, height: 5.625 },
- '16x10': { name: 'LAYOUT_16x10', width: 10, height: 6.25 },
- '4x3': { name: 'LAYOUT_4x3', width: 10, height: 7.5 },
-}
-
/** pptxgenjs takes bare uppercase hex. */
function hex(c: string): string {
return c.replace(/^#/, '').toUpperCase()
diff --git a/mcp-host/src/workflow/pptxInput.ts b/mcp-host/src/workflow/pptxInput.ts
index 054cbf61e..57fb686ca 100644
--- a/mcp-host/src/workflow/pptxInput.ts
+++ b/mcp-host/src/workflow/pptxInput.ts
@@ -9,26 +9,14 @@
*/
import { type EmbeddableImage, loadEmbeddableImage } from './embeddedImages'
import { ChartSpecError, type NativeChart, readNativeChart } from './pptxCharts'
+import { SLIDE_LAYOUTS, STATUSES } from './pptxVocabulary'
import { headerText, normalizeTableRows } from './tableRows'
/** An argument the deck cannot be built from; the message names the field. */
export class PptxInputError extends Error {}
-export const SLIDE_LAYOUTS = [
- 'cover',
- 'section',
- 'title-bullets',
- 'title-chart',
- 'title-table',
- 'kpis',
- 'two-column',
- 'image',
- 'quote',
-] as const
-
export type SlideLayout = (typeof SLIDE_LAYOUTS)[number]
-export const STATUSES = ['green', 'yellow', 'red'] as const
export type Status = (typeof STATUSES)[number]
const DELTA_DIRECTIONS = ['up', 'down', 'neutral'] as const
diff --git a/mcp-host/src/workflow/pptxTemplates.ts b/mcp-host/src/workflow/pptxTemplates.ts
index 8f61d9750..c2c9da4d0 100644
--- a/mcp-host/src/workflow/pptxTemplates.ts
+++ b/mcp-host/src/workflow/pptxTemplates.ts
@@ -9,7 +9,6 @@ import {
type PptxKpi,
type PptxSlide,
type ReadContext,
- STATUSES,
TEXT_LIMITS,
isRecord,
readChart,
@@ -19,13 +18,7 @@ import {
readTable,
readText,
} from './pptxInput'
-
-export const PPTX_TEMPLATES = [
- 'executive-brief',
- 'quarterly-review',
- 'incident-review',
- 'pitch-deck',
-] as const
+import { PPTX_TEMPLATES, SEVERITIES, STATUSES } from './pptxVocabulary'
export type PptxTemplate = (typeof PPTX_TEMPLATES)[number]
@@ -60,8 +53,6 @@ export const PPTX_TEMPLATE_FIELDS: Record<
},
}
-export const SEVERITIES = ['low', 'medium', 'high', 'critical'] as const
-
function fieldList(template: PptxTemplate): string {
const { required, optional } = PPTX_TEMPLATE_FIELDS[template]
return [...required.map(f => `${f} (required)`), ...optional].join(', ')
diff --git a/mcp-host/src/workflow/pptxVocabulary.ts b/mcp-host/src/workflow/pptxVocabulary.ts
new file mode 100644
index 000000000..00162113d
--- /dev/null
+++ b/mcp-host/src/workflow/pptxVocabulary.ts
@@ -0,0 +1,116 @@
+/**
+ * The pptx tool's vocabulary, shared by its schema and the deck builder: palettes,
+ * aspect ratios, templates, slide layouts, statuses, severities and native chart
+ * types. Plain data, so the schema can name them without loading pptxgenjs.
+ */
+
+export interface PptxPalette {
+ primary: string
+ primaryDark: string
+ text: string
+ muted: string
+ border: string
+ accent: string
+ surface: string
+ background: string
+ statusGreen: string
+ statusYellow: string
+ statusRed: string
+}
+
+export const PPTX_PALETTES: Record<string, PptxPalette> = {
+ default: {
+ primary: '#0f172a',
+ primaryDark: '#020617',
+ text: '#0f172a',
+ muted: '#475569',
+ border: '#cbd5e1',
+ accent: '#3b82f6',
+ surface: '#f1f5f9',
+ background: '#ffffff',
+ statusGreen: '#16a34a',
+ statusYellow: '#ca8a04',
+ statusRed: '#dc2626',
+ },
+ corporate: {
+ primary: '#1e3a8a',
+ primaryDark: '#1e293b',
+ text: '#1e293b',
+ muted: '#475569',
+ border: '#cbd5e1',
+ accent: '#0891b2',
+ surface: '#e0f2fe',
+ background: '#ffffff',
+ statusGreen: '#059669',
+ statusYellow: '#ca8a04',
+ statusRed: '#b91c1c',
+ },
+ warm: {
+ primary: '#b45309',
+ primaryDark: '#78350f',
+ text: '#2f2823',
+ muted: '#66584c',
+ border: '#d6d2cc',
+ accent: '#0d9488',
+ surface: '#f7f7f5',
+ background: '#fefdfb',
+ statusGreen: '#65a30d',
+ statusYellow: '#ca8a04',
+ statusRed: '#9f1239',
+ },
+ alert: {
+ primary: '#9f1239',
+ primaryDark: '#4c0519',
+ text: '#1f2937',
+ muted: '#4b5563',
+ border: '#fecaca',
+ accent: '#dc2626',
+ surface: '#fee2e2',
+ background: '#ffffff',
+ statusGreen: '#16a34a',
+ statusYellow: '#ca8a04',
+ statusRed: '#dc2626',
+ },
+}
+
+export const PPTX_ASPECT_RATIOS: Record<string, { name: string; width: number; height: number }> = {
+ wide: { name: 'LAYOUT_WIDE', width: 13.333, height: 7.5 },
+ '16x9': { name: 'LAYOUT_16x9', width: 10, height: 5.625 },
+ '16x10': { name: 'LAYOUT_16x10', width: 10, height: 6.25 },
+ '4x3': { name: 'LAYOUT_4x3', width: 10, height: 7.5 },
+}
+
+export const PPTX_TEMPLATES = [
+ 'executive-brief',
+ 'quarterly-review',
+ 'incident-review',
+ 'pitch-deck',
+] as const
+
+export const SLIDE_LAYOUTS = [
+ 'cover',
+ 'section',
+ 'title-bullets',
+ 'title-chart',
+ 'title-table',
+ 'kpis',
+ 'two-column',
+ 'image',
+ 'quote',
+] as const
+
+export const STATUSES = ['green', 'yellow', 'red'] as const
+
+export const SEVERITIES = ['low', 'medium', 'high', 'critical'] as const
+
+/** Types drawn as native charts; the stacked ones are bar and area charts with stacked grouping. */
+export const NATIVE_CHART_TYPES = [
+ 'line',
+ 'bar',
+ 'horizontalBar',
+ 'pie',
+ 'doughnut',
+ 'area',
+ 'stackedBar',
+ 'stackedArea',
+] as const