Problem
There are three separate Template type definitions that can drift out of sync:
UITemplate in apps/agent/src/templates.py (backend)
Template interface in apps/app/src/components/template-library/index.tsx (frontend)
SeedTemplate in apps/app/src/components/template-library/seed-templates.ts (frontend)
SeedTemplate is missing component_type and component_data fields, so seed templates for charts would need to be cast. Any field added to one type but not the others causes silent mismatches.
Suggested fix
- Unify
Template and SeedTemplate into a single shared frontend type
- Ensure the frontend type matches the backend
UITemplate schema (all optional fields present)
- Consider a shared schema definition (e.g. Zod on frontend, matching TypedDict on backend)
Files
apps/agent/src/templates.py
apps/app/src/components/template-library/index.tsx
apps/app/src/components/template-library/seed-templates.ts
From PR #20 review
Problem
There are three separate Template type definitions that can drift out of sync:
UITemplateinapps/agent/src/templates.py(backend)Templateinterface inapps/app/src/components/template-library/index.tsx(frontend)SeedTemplateinapps/app/src/components/template-library/seed-templates.ts(frontend)SeedTemplateis missingcomponent_typeandcomponent_datafields, so seed templates for charts would need to be cast. Any field added to one type but not the others causes silent mismatches.Suggested fix
TemplateandSeedTemplateinto a single shared frontend typeUITemplateschema (all optional fields present)Files
apps/agent/src/templates.pyapps/app/src/components/template-library/index.tsxapps/app/src/components/template-library/seed-templates.tsFrom PR #20 review