@superblocksteam/vite-plugin-file-sync 2.0.37-next.3 → 2.0.37-next.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (104) hide show
  1. package/dist/ai-service/agent/apis-system-prompt.d.ts +1 -1
  2. package/dist/ai-service/agent/apis-system-prompt.d.ts.map +1 -1
  3. package/dist/ai-service/agent/apis-system-prompt.js +198 -0
  4. package/dist/ai-service/agent/apis-system-prompt.js.map +1 -1
  5. package/dist/ai-service/agent/apis.d.ts.map +1 -1
  6. package/dist/ai-service/agent/apis.js +26 -3
  7. package/dist/ai-service/agent/apis.js.map +1 -1
  8. package/dist/ai-service/agent/tool-message-utils.js +14 -14
  9. package/dist/ai-service/agent/tool-message-utils.js.map +1 -1
  10. package/dist/ai-service/agent/tools/build-finalize.d.ts.map +1 -1
  11. package/dist/ai-service/agent/tools/build-finalize.js +2 -6
  12. package/dist/ai-service/agent/tools/build-finalize.js.map +1 -1
  13. package/dist/ai-service/agent/tools/build-list-available-components.d.ts.map +1 -1
  14. package/dist/ai-service/agent/tools/build-list-available-components.js +5 -31
  15. package/dist/ai-service/agent/tools/build-list-available-components.js.map +1 -1
  16. package/dist/ai-service/agent/utils.d.ts +5 -0
  17. package/dist/ai-service/agent/utils.d.ts.map +1 -1
  18. package/dist/ai-service/agent/utils.js +38 -3
  19. package/dist/ai-service/agent/utils.js.map +1 -1
  20. package/dist/ai-service/clark-provider/clark-language-model.d.ts.map +1 -1
  21. package/dist/ai-service/clark-provider/clark-language-model.js +23 -10
  22. package/dist/ai-service/clark-provider/clark-language-model.js.map +1 -1
  23. package/dist/ai-service/const.d.ts +0 -12
  24. package/dist/ai-service/const.d.ts.map +1 -1
  25. package/dist/ai-service/const.js +0 -5
  26. package/dist/ai-service/const.js.map +1 -1
  27. package/dist/ai-service/index.d.ts +3 -1
  28. package/dist/ai-service/index.d.ts.map +1 -1
  29. package/dist/ai-service/index.js +24 -1
  30. package/dist/ai-service/index.js.map +1 -1
  31. package/dist/ai-service/integrations/metadata/database.d.ts.map +1 -1
  32. package/dist/ai-service/integrations/metadata/database.js +34 -5
  33. package/dist/ai-service/integrations/metadata/database.js.map +1 -1
  34. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ButtonPropsDocs.js +1 -1
  35. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/CheckboxPropsDocs.js +1 -1
  36. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ColumnPropsDocs.js +1 -1
  37. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ContainerPropsDocs.js +1 -1
  38. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/DatePickerPropsDocs.js +1 -1
  39. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/DropdownPropsDocs.js +1 -1
  40. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/IconPropsDocs.js +1 -1
  41. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ImagePropsDocs.js +1 -1
  42. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/InputPropsDocs.js +1 -1
  43. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/ModalPropsDocs.js +1 -1
  44. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/PagePropsDocs.js +1 -1
  45. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/SectionPropsDocs.js +1 -1
  46. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/SlideoutPropsDocs.js +1 -1
  47. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/SwitchPropsDocs.js +1 -1
  48. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/TablePropsDocs.js +1 -1
  49. package/dist/ai-service/prompt-builder-service/static-fragments/library-components/TextPropsDocs.js +1 -1
  50. package/dist/ai-service/prompt-builder-service/static-fragments/library-typedefs/Dim.js +1 -1
  51. package/dist/ai-service/prompt-builder-service/static-fragments/library-typedefs/EventFlow.js +1 -1
  52. package/dist/ai-service/prompt-builder-service/static-fragments/library-typedefs/TextStyleWithVariant.js +1 -1
  53. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/full-examples.js +1 -1
  54. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-api.js +1 -1
  55. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-components-rules.js +1 -1
  56. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-custom-components.js +1 -1
  57. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-data-filtering.js +1 -1
  58. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-event-flow.js +1 -1
  59. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-forms.js +1 -1
  60. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-layouts.js +1 -1
  61. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-page.js +1 -1
  62. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-rbac.js +1 -1
  63. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-routes.js +1 -1
  64. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-state.js +1 -1
  65. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/superblocks-theming-chakra-new.js +1 -1
  66. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-base.js +1 -1
  67. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-incremental.js +1 -1
  68. package/dist/ai-service/prompt-builder-service/static-fragments/platform-parts/system-specific-edit.js +1 -1
  69. package/dist/ai-service/state-machine/clark-fsm.d.ts +3 -1
  70. package/dist/ai-service/state-machine/clark-fsm.d.ts.map +1 -1
  71. package/dist/ai-service/state-machine/clark-fsm.js.map +1 -1
  72. package/dist/ai-service/state-machine/handlers/agent-planning.d.ts.map +1 -1
  73. package/dist/ai-service/state-machine/handlers/agent-planning.js +2 -1
  74. package/dist/ai-service/state-machine/handlers/agent-planning.js.map +1 -1
  75. package/dist/ai-service/state-machine/handlers/llm-generating.d.ts.map +1 -1
  76. package/dist/ai-service/state-machine/handlers/llm-generating.js +15 -5
  77. package/dist/ai-service/state-machine/handlers/llm-generating.js.map +1 -1
  78. package/dist/ai-service/state-machine/handlers/simple-prompt-builder.d.ts.map +1 -1
  79. package/dist/ai-service/state-machine/handlers/simple-prompt-builder.js +189 -83
  80. package/dist/ai-service/state-machine/handlers/simple-prompt-builder.js.map +1 -1
  81. package/dist/ai-service/state-machine/helpers/cache-breakpoint.d.ts +29 -0
  82. package/dist/ai-service/state-machine/helpers/cache-breakpoint.d.ts.map +1 -0
  83. package/dist/ai-service/state-machine/helpers/cache-breakpoint.js +58 -0
  84. package/dist/ai-service/state-machine/helpers/cache-breakpoint.js.map +1 -0
  85. package/dist/file-sync-vite-plugin.d.ts.map +1 -1
  86. package/dist/file-sync-vite-plugin.js +11 -1
  87. package/dist/file-sync-vite-plugin.js.map +1 -1
  88. package/dist/file-system-manager.d.ts +1 -2
  89. package/dist/file-system-manager.d.ts.map +1 -1
  90. package/dist/file-system-manager.js +0 -25
  91. package/dist/file-system-manager.js.map +1 -1
  92. package/dist/socket-manager.d.ts +2 -1
  93. package/dist/socket-manager.d.ts.map +1 -1
  94. package/dist/socket-manager.js +3 -4
  95. package/dist/socket-manager.js.map +1 -1
  96. package/dist/source-tracker.d.ts +1 -9
  97. package/dist/source-tracker.d.ts.map +1 -1
  98. package/dist/source-tracker.js +0 -16
  99. package/dist/source-tracker.js.map +1 -1
  100. package/package.json +7 -7
  101. package/dist/parsing/theme.d.ts +0 -3
  102. package/dist/parsing/theme.d.ts.map +0 -1
  103. package/dist/parsing/theme.js +0 -87
  104. package/dist/parsing/theme.js.map +0 -1
@@ -11,10 +11,7 @@ For complex multi-step tasks, use the build_manageChecklist tool to:
11
11
 
12
12
  Start complex tasks by creating an initial checklist, then update it throughout your work.
13
13
 
14
- Before you start building applications, you must first understand user's intent, goals, and the context of the application. Use tools like:
15
- - build_listAvailableComponents
16
- - study_currentAppState
17
- to start.
14
+ Before you start building applications, you must first understand user's intent, goals, and the current context of the application.
18
15
 
19
16
  Do not be overly verbose, explain just enough to get your points across to the user.
20
17
 
@@ -65,10 +62,16 @@ This creates a clear boundary:
65
62
  ## App.tsx Layout Structure
66
63
 
67
64
  **For Application-Wide Layout Components:**
68
- Place navigation, sidebars, headers, footers, and other persistent layout components in \`App.tsx\`, not in individual pages.
65
+ For single-page applications:
66
+ - Put all content in Page1/index.tsx
67
+ - Keep App.tsx minimal with just <Outlet />.
68
+
69
+ For multi-page applications:
70
+ - Put shared navigation/layout in App.tsx, including navigation, sidebars, headers, footers, etc. Always include the Outlet component.
71
+ - Put page-specific content in respective page files.
69
72
 
70
73
  \`\`\`tsx
71
- // ✅ CORRECT - Layout components in App.tsx
74
+ // ✅ CORRECT - Layout components in App.tsx for a multi-page application
72
75
  <BaseApp>
73
76
  <Stack direction="horizontal" height={Dim.fill()}>
74
77
  {/* Sidebar - persistent across all pages */}
@@ -93,7 +96,7 @@ Place navigation, sidebars, headers, footers, and other persistent layout compon
93
96
  </BaseApp>
94
97
  \`\`\`
95
98
 
96
- **Individual pages should focus on content, not layout structure:**
99
+ **Individual pages in multi-page applications should focus on content, not layout structure:**
97
100
  \`\`\`tsx
98
101
  // ✅ CORRECT - Page focuses on content only
99
102
  <Page name="Dashboard" height={Dim.fill()} width={Dim.fill()}>
@@ -848,6 +851,109 @@ To have the API run when the page loads, use the onLoad property on Page.
848
851
  \`\`\`
849
852
 
850
853
  </using_apis>
854
+
855
+ <api_state_updates>
856
+ ## 🚨 CRITICAL: Frontend/Backend Separation for State Updates
857
+
858
+ **APIs are backend workflows that can only READ state. State mutations MUST happen on the frontend through EventFlow.**
859
+
860
+ ### The Rule:
861
+ - **Backend (API files)**: Read state, process data, return results
862
+ - **Frontend (scope.ts/pages)**: Update state based on API results using onSuccess/onError handlers
863
+ - **Other frontend state updates**: Can happen anywhere via EventFlow (button clicks, input changes, etc.)
864
+
865
+ ### ❌ WRONG: APIs CANNOT set state variables
866
+ APIs cannot modify StateVars or component properties. They only return data.
867
+
868
+ ### ✅ CORRECT: For API-triggered state updates, use onSuccess/onError handlers in scope
869
+ When registering APIs in the scope file, use onSuccess/onError to handle state updates based on API results:
870
+
871
+ \`\`\`tsx
872
+ // In scope.ts - registering the API with state update handlers
873
+ export const Page1Scope = registerScope("Page1", {
874
+ // ... other entities ...
875
+
876
+ createUserApi: {
877
+ onSuccess: EventFlow.runJS(({ createUserApi }) => {
878
+ // Update state based on API response
879
+ userNameVar.value = createUserApi.response.name;
880
+ userListVar.value = [...userListVar.value, createUserApi.response];
881
+ isLoadingVar.value = false;
882
+ CreateUserDialog.isOpen = false;
883
+
884
+ toast.success("User created successfully!");
885
+ }),
886
+ onError: EventFlow.runJS(() => {
887
+ isLoadingVar.value = false;
888
+ toast.error("Failed to create user");
889
+ })
890
+ },
891
+
892
+ fetchDataApi: {
893
+ onSuccess: EventFlow.setStateVar(dataVar, {
894
+ value: computed(() => fetchDataApi.response)
895
+ })
896
+ }
897
+ });
898
+ \`\`\`
899
+
900
+ ### Common Patterns:
901
+
902
+ **Loading states:**
903
+ \`\`\`tsx
904
+ // In scope.ts
905
+ searchApi: {
906
+ onSuccess: EventFlow.runJS(({ searchApi }) => {
907
+ searchResultsVar.value = searchApi.response;
908
+ isSearchingVar.value = false;
909
+ }),
910
+ onError: EventFlow.runJS(() => {
911
+ isSearchingVar.value = false;
912
+ searchResultsVar.value = [];
913
+ })
914
+ }
915
+
916
+ // In page - set loading state before API call
917
+ <Button onClick={EventFlow
918
+ .setStateVar(isSearchingVar, { value: true })
919
+ .runApis([searchApi])
920
+ } />
921
+ \`\`\`
922
+
923
+ **Form submissions:**
924
+ \`\`\`tsx
925
+ // In scope.ts
926
+ submitFormApi: {
927
+ onSuccess: EventFlow
928
+ .runJS(({ submitFormApi }) => {
929
+ submittedDataVar.value = submitFormApi.response;
930
+ toast.success("Form submitted!");
931
+ })
932
+ .resetComponent(FormInput1)
933
+ .resetComponent(FormInput2)
934
+ .setComponentProperty(FormDialog, { property: "isOpen", value: false })
935
+ }
936
+ \`\`\`
937
+
938
+ **Data refresh after mutation:**
939
+ \`\`\`tsx
940
+ // In scope.ts
941
+ deleteItemApi: {
942
+ onSuccess: EventFlow
943
+ .runJS(() => {
944
+ toast.success("Item deleted");
945
+ })
946
+ .runApis([fetchItemsApi]) // Refresh the list
947
+ }
948
+ \`\`\`
949
+
950
+ ### Why this separation matters for APIs:
951
+ - Keeps data flow unidirectional and predictable
952
+ - APIs remain pure data processors
953
+ - API-triggered state updates are centralized in onSuccess/onError handlers
954
+ - Makes debugging and testing easier
955
+ - Aligns with the Superblocks visual editor model
956
+ </api_state_updates>
851
957
  </apis>
852
958
 
853
959
  <superblocks_state>
@@ -940,25 +1046,25 @@ Bindings give you named references to component instances so you can **read** (a
940
1046
  <writing_to_component_properties>
941
1047
  ## Writing to Component Properties — Policy
942
1048
 
943
- Decide with this test: **“Can the end-user directly modify this value directly during the app lifecycle?”**
1049
+ Decide with this test: **“Can the end-user directly modify this value directly during the app lifecycle?”**
944
1050
  We distinguish **Input-like**, **Data/derived**, and **Control** props.
945
1051
 
946
- - **INPUT-LIKE** (user-edited values)
947
- Examples: \`Input.value\`, \`Select.selected\`, \`Switch.checked\`, \`DatePicker.value\`
948
- - Marked **\`readAndWrite\`** in the component definition.
949
- - JSX provides the **default** (often via a \`default*\` prop that seeds the live \`value\`).
950
- - **Live source of truth** is the user's edits.
1052
+ - **INPUT-LIKE** (user-edited values)
1053
+ Examples: \`Input.value\`, \`Select.selected\`, \`Switch.checked\`, \`DatePicker.value\`
1054
+ - Marked **\`readAndWrite\`** in the component definition.
1055
+ - JSX provides the **default** (often via a \`default*\` prop that seeds the live \`value\`).
1056
+ - **Live source of truth** is the user's edits.
951
1057
  - **Imperative writes are rare & intentional** (reset/clear, apply suggestion). Prefer declarative props otherwise.
952
1058
 
953
- - **DATA / DERIVED / DISPLAY** (driven by app data, APIs, or other props)
954
- Examples: \`Typography.value\`, \`Table.rows\`, \`Chart.series\`, \`Avatar.src\`
955
- - Treat as **declarative** and **reactive** only.
1059
+ - **DATA / DERIVED / DISPLAY** (driven by app data, APIs, or other props)
1060
+ Examples: \`Typography.value\`, \`Table.rows\`, \`Chart.series\`, \`Avatar.src\`
1061
+ - Treat as **declarative** and **reactive** only.
956
1062
  - **Never** set imperatively; pass via JSX with \`computed(...)\` so updates flow automatically.
957
1063
 
958
- - **CONTROL** (visibility/toggle state for dialogs, sheets, modals, drawers, etc.)
959
- Examples: \`Dialog1.isOpen\`, \`Sheet1.isOpen\`
960
- - Not user-typed and not derived data; callers **control** them.
961
- - **Imperative writes are the standard pattern** for opening/closing:
1064
+ - **CONTROL** (visibility/toggle state for dialogs, sheets, modals, drawers, etc.)
1065
+ Examples: \`Dialog1.isOpen\`, \`Sheet1.isOpen\`
1066
+ - Not user-typed and not derived data; callers **control** them.
1067
+ - **Imperative writes are the standard pattern** for opening/closing:
962
1068
  \`\`\`tsx
963
1069
  <Button
964
1070
  onClick={EventFlow.setComponentProperty(Dialog1, {
@@ -978,9 +1084,9 @@ We distinguish **Input-like**, **Data/derived**, and **Control** props.
978
1084
  <setting_component_properties>
979
1085
  ## Setting Component Properties
980
1086
 
981
- **Preferred:** Pass dynamic values in JSX with \`computed(...)\`.
982
- **Exceptions:**
983
- - Imperative writes for **input-like** props when overwriting user input is explicitly desired.
1087
+ **Preferred:** Pass dynamic values in JSX with \`computed(...)\`.
1088
+ **Exceptions:**
1089
+ - Imperative writes for **input-like** props when overwriting user input is explicitly desired.
984
1090
  - Imperative writes for **control** props (open/close) to drive UI affordances.
985
1091
 
986
1092
  ### ✅ Declarative data passed as props in JSX (preferred)
@@ -1534,8 +1640,8 @@ EventFlow.runJS(() => {
1534
1640
  - Always supply children to components as JSX elements, not by attempting to set a children property.
1535
1641
  - Use layout and alignment related props on Stacks/Cards to position children. Make a visually pleasing layout using tailwind classes.
1536
1642
  - Use icon names from the Lucide React library.
1537
- - Use custom components to create UI elements not provided by Superblocks
1538
1643
  - Use custom components to encapsulate common UI patterns like lists, menus, etc.
1644
+ - Prefer using existing components in the application, as the @superblocksteam/library package does not contain components outside of \`App\` and \`Page\`
1539
1645
  </component_usage_guidance>
1540
1646
 
1541
1647
  <application_file_structure>
@@ -2029,18 +2135,18 @@ export default registerComponent("UserList", propertiesDefinition, (props) => {
2029
2135
 
2030
2136
  <design_system_guidance>
2031
2137
 
2032
- - This project uses **Tailwind CSS v4**
2033
- - All design tokens and configuration are defined directly in \`index.css\`
2034
- - Every app comes out of the box with a professional, subtle black-and-white theme
2035
- - All colors must be specified in **OKLCH** format
2138
+ - This project uses **Tailwind CSS v4**
2139
+ - All design tokens and configuration are defined directly in \`index.css\`
2140
+ - Every app comes out of the box with a professional, subtle black-and-white theme
2141
+ - All colors must be specified in **OKLCH** format
2036
2142
 
2037
2143
  <branding_decision_gate>
2038
- Before writing any code, determine whether the user request requires a branding/theme change
2144
+ Before writing any code, determine whether the user request requires a branding/theme change
2039
2145
 
2040
2146
  <brand_change_definition>
2041
2147
  A request requires branding/theme changes only if it explicitly asks to change visual identity
2042
2148
 
2043
- Examples:
2149
+ Examples:
2044
2150
  - Change primary/secondary/neutral colors
2045
2151
  - Switch fonts or type scale
2046
2152
  - Adjust radii or shadows for a brand look
@@ -2054,16 +2160,16 @@ Feature requests like lists, filters, pagination, CRUD, sheets do not require br
2054
2160
  </branding_decision_gate>
2055
2161
 
2056
2162
  <semantic_tokens_rule>
2057
- **USE SEMANTIC TOKENS FOR ALL STYLING** — colors, gradients, fonts, shadows, spacing, etc. DO NOT use direct values or raw Tailwind utilities like \`text-white\`, \`bg-black\`, \`shadow-lg\`, etc. Everything must be themed via the design system tokens defined in \`index.css\`
2163
+ **USE SEMANTIC TOKENS FOR ALL STYLING** — colors, gradients, fonts, shadows, spacing, etc. DO NOT use direct values or raw Tailwind utilities like \`text-white\`, \`bg-black\`, \`shadow-lg\`, etc. Everything must be themed via the design system tokens defined in \`index.css\`
2058
2164
  </semantic_tokens_rule>
2059
2165
 
2060
2166
  <design_system_usage>
2061
- When building components or pages:
2062
- - Always style with semantic tokens (e.g. \`bg-background\`, \`text-foreground\`, \`border-border\`)
2063
- - Never use Tailwind's default color or shadow utilities directly
2064
- - Typography must use semantic tokens for font family and sizes
2065
- - Gradients, spacing, and effects should also come from tokens or utilities built on tokens
2066
- - All components should be responsive by default
2167
+ When building components or pages:
2168
+ - Always style with semantic tokens (e.g. \`bg-background\`, \`text-foreground\`, \`border-border\`)
2169
+ - Never use Tailwind's default color or shadow utilities directly
2170
+ - Typography must use semantic tokens for font family and sizes
2171
+ - Gradients, spacing, and effects should also come from tokens or utilities built on tokens
2172
+ - All components should be responsive by default
2067
2173
 
2068
2174
  ✅ Example (correct):
2069
2175
  \`\`\`tsx
@@ -2077,49 +2183,49 @@ When building components or pages:
2077
2183
  </design_system_usage>
2078
2184
 
2079
2185
  <design_token_modification>
2080
- Modify the design system only when extending functionality All modifications must happen in \`index.css\`
2081
- - Add new tokens with **semantic names** (\`--color-warning\`, \`--shadow-elevated\`)
2082
- - Add reusable utilities with \`@utility\`
2083
- - Create **variants** for Shadcn components instead of writing one-off styles
2186
+ Modify the design system only when extending functionality All modifications must happen in \`index.css\`
2187
+ - Add new tokens with **semantic names** (\`--color-warning\`, \`--shadow-elevated\`)
2188
+ - Add reusable utilities with \`@utility\`
2189
+ - Create **variants** for Shadcn components instead of writing one-off styles
2084
2190
 
2085
- Do NOT remove or rename existing tokens — edit values or add new ones as needed
2191
+ Do NOT remove or rename existing tokens — edit values or add new ones as needed
2086
2192
 
2087
2193
  <color_palette_modification>
2088
- Only modify the color palette if explicitly requested or when replicating the look and feel of an existing brand or product (e.g. Yelp, Instacart)
2089
- - Choose one **primary brand color**
2090
- - Choose 2-3 neutrals (white, gray, black variants) and 1-2 accents
2091
- - Consider both dark and light modes
2092
- - Never exceed 5 colors without explicit approval
2194
+ Only modify the color palette if explicitly requested or when replicating the look and feel of an existing brand or product (e.g. Yelp, Instacart)
2195
+ - Choose one **primary brand color**
2196
+ - Choose 2-3 neutrals (white, gray, black variants) and 1-2 accents
2197
+ - Consider both dark and light modes
2198
+ - Never exceed 5 colors without explicit approval
2093
2199
  </color_palette_modification>
2094
2200
 
2095
2201
  <gradients>
2096
- - Avoid gradients unless explicitly requested
2097
- - If gradients are necessary:
2098
- - Use them only as subtle accents, never for primary fills
2099
- - Use analogous hues (blue→teal, purple→pink, orange→red)
2100
- - Never use clashing opposites (red→cyan, orange→blue)
2101
- - Limit to 2-3 color stops
2202
+ - Avoid gradients unless explicitly requested
2203
+ - If gradients are necessary:
2204
+ - Use them only as subtle accents, never for primary fills
2205
+ - Use analogous hues (blue→teal, purple→pink, orange→red)
2206
+ - Never use clashing opposites (red→cyan, orange→blue)
2207
+ - Limit to 2-3 color stops
2102
2208
  </gradients>
2103
2209
 
2104
2210
  </design_token_modification>
2105
2211
 
2106
2212
  <typography_guidance>
2107
- **Font Families**
2108
- - Prefer a single font family for both headings and body
2109
- - At most 2 families total (one heading, one body)
2110
- - Never use decorative fonts for body text
2111
- - Do not use fonts smaller than 14px
2112
-
2113
- **Font Sizes & Hierarchy**
2114
- - Use as few font sizes as necessary to express hierarchy
2115
- - Default: one size for body, one for section headings, one for main heading
2116
- - Add more levels only when the information hierarchy demands it
2117
- - Avoid bloated scales (h1-h6 + multiple body variants) unless cloning a full design system
2118
- - Use weight, spacing, and color with size to establish hierarchy
2213
+ **Font Families**
2214
+ - Prefer a single font family for both headings and body
2215
+ - At most 2 families total (one heading, one body)
2216
+ - Never use decorative fonts for body text
2217
+ - Do not use fonts smaller than 14px
2218
+
2219
+ **Font Sizes & Hierarchy**
2220
+ - Use as few font sizes as necessary to express hierarchy
2221
+ - Default: one size for body, one for section headings, one for main heading
2222
+ - Add more levels only when the information hierarchy demands it
2223
+ - Avoid bloated scales (h1-h6 + multiple body variants) unless cloning a full design system
2224
+ - Use weight, spacing, and color with size to establish hierarchy
2119
2225
  </typography_guidance>
2120
2226
 
2121
2227
  <index_css_guidance>
2122
- All design tokens are defined in \`index.css\` using CSS custom properties
2228
+ All design tokens are defined in \`index.css\` using CSS custom properties
2123
2229
 
2124
2230
  Example:
2125
2231
 
@@ -2157,12 +2263,12 @@ Example:
2157
2263
  <component_implementation_guidance>
2158
2264
  When working with Shadcn components:
2159
2265
 
2160
- 1. Start with the base component in \`components/ui/\`
2161
- 2. Add reusable styles as **variants** in the component file
2162
- 3. Use \`cn()\` for conditional classes
2163
- 4. Integrate with Superblocks via \`index.tsx\`
2164
- 5. Define props in \`props.ts\`
2165
- 6. Configure editor behavior in \`editor.ts\`
2266
+ 1. Start with the base component in \`components/ui/\`
2267
+ 2. Add reusable styles as **variants** in the component file
2268
+ 3. Use \`cn()\` for conditional classes
2269
+ 4. Integrate with Superblocks via \`index.tsx\`
2270
+ 5. Define props in \`props.ts\`
2271
+ 6. Configure editor behavior in \`editor.ts\`
2166
2272
 
2167
2273
  **Always use design tokens:**
2168
2274
 
@@ -2200,9 +2306,9 @@ const buttonVariants = cva("...", {
2200
2306
  </component_variants>
2201
2307
 
2202
2308
  <outline_caveat>
2203
- Shadcn outline variants are not transparent by default
2204
- If you pair an outline button with light text, it may disappear in certain themes
2205
- Always define outline button variants using semantic tokens for background and foreground so they remain legible in both light and dark modes
2309
+ Shadcn outline variants are not transparent by default
2310
+ If you pair an outline button with light text, it may disappear in certain themes
2311
+ Always define outline button variants using semantic tokens for background and foreground so they remain legible in both light and dark modes
2206
2312
  </outline_caveat>
2207
2313
 
2208
2314
  <avoiding_errors>
@@ -2227,14 +2333,14 @@ created with \`@utility\` in \`index.css\`
2227
2333
  </avoiding_errors>
2228
2334
 
2229
2335
  <expected_outcomes>
2230
- Expected outcomes when following this guidance:
2231
- - All components use semantic tokens, never Tailwind's built-in color or shadow utilities
2232
- - The entire theme is controlled centrally in \`index.css\`
2233
- - All colors are defined in OKLCH format
2234
- - Components are responsive and customizable via variants
2235
- - Typography is minimal, purposeful, and consistent
2236
- - Adding or changing tokens happens only in \`index.css\`
2237
- - Result: consistent, themeable, professional apps that can be branded easily
2336
+ Expected outcomes when following this guidance:
2337
+ - All components use semantic tokens, never Tailwind's built-in color or shadow utilities
2338
+ - The entire theme is controlled centrally in \`index.css\`
2339
+ - All colors are defined in OKLCH format
2340
+ - Components are responsive and customizable via variants
2341
+ - Typography is minimal, purposeful, and consistent
2342
+ - Adding or changing tokens happens only in \`index.css\`
2343
+ - Result: consistent, themeable, professional apps that can be branded easily
2238
2344
  </expected_outcomes>
2239
2345
 
2240
2346
  </design_system_guidance>
@@ -1 +1 @@
1
- {"version":3,"file":"simple-prompt-builder.js","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/handlers/simple-prompt-builder.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,iBAAiB,GAC5B,GAAG,EAAE,CAAC,MAAM,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAq0Ed,CAAC"}
@@ -0,0 +1,29 @@
1
+ import type { Clark } from "../clark-fsm.js";
2
+ import type { PrepareStepFunction } from "ai";
3
+ export declare const cacheBreakpointHelper: (clark: Clark, { agentName, threshold, }: {
4
+ agentName: string;
5
+ threshold?: number;
6
+ }) => {
7
+ nextCacheBreakpoint: () => {
8
+ readonly bedrock: {
9
+ readonly cachePoint: {
10
+ readonly type: "default";
11
+ };
12
+ };
13
+ readonly anthropic: {
14
+ readonly cacheControl: {
15
+ readonly type: "ephemeral";
16
+ };
17
+ };
18
+ } | undefined;
19
+ breakpointAwarePrepareStep: ({ getInputTokens, onAddBreakpoint, }: {
20
+ getInputTokens: () => number;
21
+ onAddBreakpoint?: (stepNumber: number) => void;
22
+ }) => (step: Parameters<PrepareStepFunction<any>>[0]) => {
23
+ steps: import("ai").StepResult<any>[];
24
+ stepNumber: number;
25
+ model: import("ai").LanguageModel;
26
+ messages: Array<import("ai").ModelMessage>;
27
+ };
28
+ };
29
+ //# sourceMappingURL=cache-breakpoint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-breakpoint.d.ts","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/cache-breakpoint.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,IAAI,CAAC;AAK9C,eAAO,MAAM,qBAAqB,GAChC,OAAO,KAAK,EACZ,2BAGG;IACD,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;;;;;;;;;;;;;uEAgCI;QACD,cAAc,EAAE,MAAM,MAAM,CAAC;QAC7B,eAAe,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;KAChD,MACA,MAAM,UAAU,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;;CAiCjD,CAAC"}
@@ -0,0 +1,58 @@
1
+ // claude currently supports up to 4
2
+ const TOTAL_CACHE_BREAKPOINTS = 4;
3
+ export const cacheBreakpointHelper = (clark, { agentName, threshold = 25_000, }) => {
4
+ const numUsed = () => clark.context.usedCacheBreakpoints?.[agentName] || 0;
5
+ const shouldAdd = (inputTokens) => {
6
+ return numUsed() < TOTAL_CACHE_BREAKPOINTS && inputTokens > threshold;
7
+ };
8
+ const next = () => {
9
+ const usedBreakpoints = numUsed();
10
+ if (usedBreakpoints < TOTAL_CACHE_BREAKPOINTS) {
11
+ clark.updateContext({
12
+ usedCacheBreakpoints: {
13
+ ...clark.context.usedCacheBreakpoints,
14
+ [agentName]: usedBreakpoints + 1,
15
+ },
16
+ });
17
+ return {
18
+ bedrock: { cachePoint: { type: "default" } },
19
+ // n.b. Vertex provider uses anthropic key
20
+ anthropic: { cacheControl: { type: "ephemeral" } },
21
+ };
22
+ }
23
+ return undefined;
24
+ };
25
+ const breakpointAwarePrepareStep = ({ getInputTokens, onAddBreakpoint, }) => (step) => {
26
+ const currentInputTokens = getInputTokens();
27
+ if (step.stepNumber > 1 && shouldAdd(currentInputTokens)) {
28
+ // update the last assistant message in place to add breakpoint
29
+ for (let index = step.messages.length - 1; index >= 0; index--) {
30
+ const message = step.messages[index];
31
+ if (message?.role === "assistant") {
32
+ const breakpoint = next();
33
+ if (breakpoint) {
34
+ message.providerOptions = {
35
+ ...message.providerOptions,
36
+ bedrock: {
37
+ ...message.providerOptions?.bedrock,
38
+ ...breakpoint.bedrock,
39
+ },
40
+ anthropic: {
41
+ ...message.providerOptions?.anthropic,
42
+ ...breakpoint.anthropic,
43
+ },
44
+ };
45
+ onAddBreakpoint?.(step.stepNumber);
46
+ }
47
+ break;
48
+ }
49
+ }
50
+ }
51
+ return step;
52
+ };
53
+ return {
54
+ nextCacheBreakpoint: next,
55
+ breakpointAwarePrepareStep,
56
+ };
57
+ };
58
+ //# sourceMappingURL=cache-breakpoint.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-breakpoint.js","sourceRoot":"","sources":["../../../../src/ai-service/state-machine/helpers/cache-breakpoint.ts"],"names":[],"mappings":"AAGA,oCAAoC;AACpC,MAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAY,EACZ,EACE,SAAS,EACT,SAAS,GAAG,MAAM,GAInB,EACD,EAAE;IACF,MAAM,OAAO,GAAG,GAAG,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,oBAAoB,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC;IAE3E,MAAM,SAAS,GAAG,CAAC,WAAmB,EAAE,EAAE;QACxC,OAAO,OAAO,EAAE,GAAG,uBAAuB,IAAI,WAAW,GAAG,SAAS,CAAC;IACxE,CAAC,CAAC;IAEF,MAAM,IAAI,GAAG,GAAG,EAAE;QAChB,MAAM,eAAe,GAAG,OAAO,EAAE,CAAC;QAClC,IAAI,eAAe,GAAG,uBAAuB,EAAE,CAAC;YAC9C,KAAK,CAAC,aAAa,CAAC;gBAClB,oBAAoB,EAAE;oBACpB,GAAG,KAAK,CAAC,OAAO,CAAC,oBAAoB;oBACrC,CAAC,SAAS,CAAC,EAAE,eAAe,GAAG,CAAC;iBACjC;aACF,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,EAAE;gBAC5C,0CAA0C;gBAC1C,SAAS,EAAE,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;aAC1C,CAAC;QACb,CAAC;QAED,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IAEF,MAAM,0BAA0B,GAC9B,CAAC,EACC,cAAc,EACd,eAAe,GAIhB,E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AAM,EAAkB,MAAM,MAAM,CAAC;AAOnD,eAAO,MAAM,kBAAkB,EAAE,CAC/B,YAAY,EAAE,oBAAoB,EAClC,OAAO,CAAC,EAAE,qBAAqB,KAC5B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAkpCzC,CAAC"}
1
+ {"version":3,"file":"file-sync-vite-plugin.d.ts","sourceRoot":"","sources":["../src/file-sync-vite-plugin.ts"],"names":[],"mappings":"AA0DA,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EAAE,MAAM,EAAkB,MAAM,MAAM,CAAC;AAOnD,eAAO,MAAM,kBAAkB,EAAE,CAC/B,YAAY,EAAE,oBAAoB,EAClC,OAAO,CAAC,EAAE,qBAAqB,KAC5B;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,IAAI,CAAA;CAiqCzC,CAAC"}
@@ -650,12 +650,18 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
650
650
  })();
651
651
  });
652
652
  if (syncService && aiService) {
653
- socketManager.on("connect:editor", (socket) => {
653
+ socketManager.on("connect:editor", (socket, peerId) => {
654
654
  void (async () => {
655
+ if (aiService.isBusy()) {
656
+ aiService.handleUserConnected(socket, peerId);
657
+ }
655
658
  const hasDraft = await syncService.hasLocalDraftChanges();
656
659
  return socket.call.aiSetDraftState({ hasDraft });
657
660
  })();
658
661
  });
662
+ socketManager.on("disconnect:editor", (peerId) => {
663
+ aiService.handleUserDisconnected(peerId);
664
+ });
659
665
  syncService.on("draftStateChanged", (hasDraft) => {
660
666
  void (async () => {
661
667
  void socketManager.callEditorClients((socket) => {
@@ -900,6 +906,7 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
900
906
  const err = new Error(error.message);
901
907
  err.stack = error.stack;
902
908
  err.name = error.name;
909
+ void aiService.handleBuildSystemError(err);
903
910
  logger.error(`Error loading import ${module.url}: ${error.message}`, getErrorMeta(err));
904
911
  return [];
905
912
  }
@@ -939,6 +946,9 @@ export const fileSyncVitePlugin = (pluginParams, options) => {
939
946
  return [];
940
947
  }
941
948
  lastImportErrorFiles.add(ctx.file);
949
+ if (aiService?.isBusy()) {
950
+ void aiService.handleBuildSystemError(error);
951
+ }
942
952
  logger.error(`Error loading import ${importPath}: ${error.message}`);
943
953
  ctx.server.ws.send({
944
954
  type: "custom",