Full graph-based workflow execution engine with: - WorkflowGraphRuntime with two-phase dispatch (collect → fire Celery tasks) - Node registry with contract validation, socket types, execution kinds - WorkflowRuntimeServices: preflight, context resolution, shadow-mode A/B - WorkflowRouter: CRUD + dispatch/preflight/run-history API endpoints - OutputTypeContracts: workflow binding, rollout-mode resolution - Admin router: output-type workflow binding endpoints - Frontend: complete workflow editor with drag-drop canvas, node inspector, module bundles, reference bundles, preflight panel, validation banner, authoring guidance, blueprint templates, shadow/rollout gate UI - Tests: comprehensive coverage for all workflow modules - Docs: NODE_CONTRACT_AUDIT and VALIDATION_ERROR_INVENTORY All 20 blocks from NEXT_20_BLOCK_BATCH_PLAN completed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
73 lines
2.3 KiB
TypeScript
73 lines
2.3 KiB
TypeScript
import React, { useEffect } from 'react'
|
|
import ReactDOM from 'react-dom/client'
|
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
|
|
import { Toaster } from 'sonner'
|
|
import App from './App'
|
|
import './index.css'
|
|
import '@xyflow/react/dist/style.css'
|
|
import { useThemeStore, applyTheme, resolveTheme, type ThemeMode, type AccentKey } from './store/theme'
|
|
|
|
/* ---------------------------------------------------------------
|
|
Flash prevention: apply theme BEFORE React hydrates.
|
|
Reads directly from localStorage to avoid the Zustand wrapper.
|
|
--------------------------------------------------------------- */
|
|
;(function () {
|
|
try {
|
|
const raw = localStorage.getItem('hartomat-theme')
|
|
if (raw) {
|
|
const { state } = JSON.parse(raw) as { state: { mode: ThemeMode; accent: AccentKey; customHex?: string } }
|
|
applyTheme(state.mode ?? 'light', state.accent ?? 'green', state.customHex)
|
|
}
|
|
} catch {
|
|
// ignore — default theme already applied by CSS
|
|
}
|
|
})()
|
|
|
|
const queryClient = new QueryClient({
|
|
defaultOptions: {
|
|
queries: {
|
|
staleTime: 30_000,
|
|
retry: 1,
|
|
},
|
|
},
|
|
})
|
|
|
|
/** Subscribes to store changes and system preference changes */
|
|
function ThemeProvider({ children }: { children: React.ReactNode }) {
|
|
const mode = useThemeStore((s) => s.mode)
|
|
const accent = useThemeStore((s) => s.accent)
|
|
const customHex = useThemeStore((s) => s.customHex)
|
|
const resolvedTheme = resolveTheme(mode)
|
|
|
|
// Apply whenever mode, accent, or customHex changes
|
|
useEffect(() => {
|
|
applyTheme(mode, accent, customHex)
|
|
}, [mode, accent, customHex])
|
|
|
|
// Listen to system preference changes when mode='system'
|
|
useEffect(() => {
|
|
if (mode !== 'system') return
|
|
const mq = window.matchMedia('(prefers-color-scheme: dark)')
|
|
const handler = () => applyTheme('system', accent, customHex)
|
|
mq.addEventListener('change', handler)
|
|
return () => mq.removeEventListener('change', handler)
|
|
}, [mode, accent, customHex])
|
|
|
|
return (
|
|
<>
|
|
{children}
|
|
<Toaster position="top-left" richColors theme={resolvedTheme} />
|
|
</>
|
|
)
|
|
}
|
|
|
|
ReactDOM.createRoot(document.getElementById('root')!).render(
|
|
<React.StrictMode>
|
|
<QueryClientProvider client={queryClient}>
|
|
<ThemeProvider>
|
|
<App />
|
|
</ThemeProvider>
|
|
</QueryClientProvider>
|
|
</React.StrictMode>,
|
|
)
|